@m3e/list 1.1.6 → 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/README.md +468 -45
- package/dist/css-custom-data.json +1615 -10
- package/dist/custom-elements.json +5099 -94
- package/dist/html-custom-data.json +156 -3
- package/dist/index.js +1423 -85
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +33 -4
- package/dist/index.min.js.map +1 -1
- package/dist/src/ActionListElement.d.ts +46 -0
- package/dist/src/ActionListElement.d.ts.map +1 -0
- package/dist/src/ExpandableListItemElement.d.ts +146 -0
- package/dist/src/ExpandableListItemElement.d.ts.map +1 -0
- package/dist/src/ListActionElement.d.ts +105 -0
- package/dist/src/ListActionElement.d.ts.map +1 -0
- package/dist/src/ListElement.d.ts +41 -2
- package/dist/src/ListElement.d.ts.map +1 -1
- package/dist/src/ListItemButtonElement.d.ts +25 -0
- package/dist/src/ListItemButtonElement.d.ts.map +1 -0
- package/dist/src/ListItemContentType.d.ts +3 -0
- package/dist/src/ListItemContentType.d.ts.map +1 -0
- package/dist/src/ListItemElement.d.ts +50 -14
- package/dist/src/ListItemElement.d.ts.map +1 -1
- package/dist/src/ListOptionElement.d.ts +127 -0
- package/dist/src/ListOptionElement.d.ts.map +1 -0
- package/dist/src/ListVariant.d.ts +3 -0
- package/dist/src/ListVariant.d.ts.map +1 -0
- package/dist/src/SelectionListElement.d.ts +77 -0
- package/dist/src/SelectionListElement.d.ts.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -3,21 +3,50 @@
|
|
|
3
3
|
* Copyright (c) 2025 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import{
|
|
6
|
+
import{selectionManager as t,RovingTabIndexManager as e,SelectionManager as i}from"@m3e/core/a11y";import{LitElement as s,html as o,unsafeCSS as a,css as n}from"lit";import{Role as r,ResizeController as l,DesignToken as d,computeLineCount as c,LinkButton as h,KeyboardClick as m,Focusable as p,Disabled as g,AttachInternals as u,renderPseudoLink as v,Selected as f,getTextContent as b,Labelled as y,Dirty as $,Touched as _,FormAssociated as x,formValue as w}from"@m3e/core";function A(t,e,i,s){var o,a=arguments.length,n=a<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(n=(a<3?o(n):a>3?o(e,i,n):o(e,i))||n);return a>3&&n&&Object.defineProperty(e,i,n),n}function S(t,e,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(t):s?s.value:e.get(t)}function E(t,e,i,s,o){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?o.call(t,i):o?o.value=i:e.set(t,i),i}"function"==typeof SuppressedError&&SuppressedError;
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const C=t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},k=globalThis,P=k.ShadowRoot&&(void 0===k.ShadyCSS||k.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,T=Symbol(),M=new WeakMap;
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2019 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/let
|
|
17
|
+
*/let L=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==T)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(P&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=M.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&M.set(e,t))}return t}toString(){return this.cssText}};const U=P?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new L("string"==typeof t?t:t+"",void 0,T))(e)})(t):t,{is:O,defineProperty:H,getOwnPropertyDescriptor:z,getOwnPropertyNames:N,getOwnPropertySymbols:I,getPrototypeOf:R}=Object,W=globalThis,j=W.trustedTypes,D=j?j.emptyScript:"",q=W.reactiveElementPolyfillSupport,B=(t,e)=>t,V={toAttribute(t,e){switch(e){case Boolean:t=t?D:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},K=(t,e)=>!O(t,e),Z={attribute:!0,type:String,converter:V,reflect:!1,useDefault:!1,hasChanged:K};
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/Symbol.metadata??=Symbol("metadata"),
|
|
22
|
+
*/Symbol.metadata??=Symbol("metadata"),W.litPropertyMetadata??=new WeakMap;class F extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Z){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&H(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=z(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const a=s?.call(this);o?.call(this,e),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Z}static _$Ei(){if(this.hasOwnProperty(B("elementProperties")))return;const t=R(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(B("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(B("properties"))){const t=this.properties,e=[...N(t),...I(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(U(t))}else void 0!==t&&e.push(U(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(P)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),s=k.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:V).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:V;this._$Em=s;const a=o.fromAttribute(e,t.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,o=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??K)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},a){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==o||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}F.elementStyles=[],F.shadowRootOptions={mode:"open"},F[B("elementProperties")]=new Map,F[B("finalized")]=new Map,q?.({ReactiveElement:F}),(W.reactiveElementVersions??=[]).push("2.1.1");
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2017 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/
|
|
28
|
+
const G={attribute:!0,type:String,converter:V,reflect:!1,hasChanged:K},J=(t=G,e,i)=>{const{kind:s,metadata:o}=i;let a=globalThis.litPropertyMetadata.get(o);if(void 0===a&&globalThis.litPropertyMetadata.set(o,a=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),a.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,o,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];e.call(this,i),this.requestUpdate(s,o,t)}}throw Error("Unsupported decorator location: "+s)};function Q(t){return(e,i)=>"object"==typeof i?J(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}
|
|
29
|
+
/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2017 Google LLC
|
|
32
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* @license
|
|
36
|
+
* Copyright 2017 Google LLC
|
|
37
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
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(.-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
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2017 Google LLC
|
|
43
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
+
*/
|
|
45
|
+
const St=globalThis,Et=St.trustedTypes,Ct=Et?Et.createPolicy("lit-html",{createHTML:t=>t}):void 0,kt="$lit$",Pt=`lit$${Math.random().toFixed(9).slice(2)}$`,Tt="?"+Pt,Mt=`<${Tt}>`,Lt=document,Ut=()=>Lt.createComment(""),Ot=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Ht=Array.isArray,zt="[ \t\n\f\r]",Nt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,It=/-->/g,Rt=/>/g,Wt=RegExp(`>|${zt}(?:([^\\s"'>=/]+)(${zt}*=${zt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),jt=/'/g,Dt=/"/g,qt=/^(?:script|style|textarea|title)$/i,Bt=Symbol.for("lit-noChange"),Vt=Symbol.for("lit-nothing"),Kt=new WeakMap,Zt=Lt.createTreeWalker(Lt,129);function Ft(t,e){if(!Ht(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Ct?Ct.createHTML(e):e}const Gt=(t,e)=>{const i=t.length-1,s=[];let o,a=2===e?"<svg>":3===e?"<math>":"",n=Nt;for(let e=0;e<i;e++){const i=t[e];let r,l,d=-1,c=0;for(;c<i.length&&(n.lastIndex=c,l=n.exec(i),null!==l);)c=n.lastIndex,n===Nt?"!--"===l[1]?n=It:void 0!==l[1]?n=Rt:void 0!==l[2]?(qt.test(l[2])&&(o=RegExp("</"+l[2],"g")),n=Wt):void 0!==l[3]&&(n=Wt):n===Wt?">"===l[0]?(n=o??Nt,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,r=l[1],n=void 0===l[3]?Wt:'"'===l[3]?Dt:jt):n===Dt||n===jt?n=Wt:n===It||n===Rt?n=Nt:(n=Wt,o=void 0);const h=n===Wt&&t[e+1].startsWith("/>")?" ":"";a+=n===Nt?i+Mt:d>=0?(s.push(r),i.slice(0,d)+kt+i.slice(d)+Pt+h):i+Pt+(-2===d?e:h)}return[Ft(t,a+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class Jt{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,a=0;const n=t.length-1,r=this.parts,[l,d]=Gt(t,e);if(this.el=Jt.createElement(l,i),Zt.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=Zt.nextNode())&&r.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(kt)){const e=d[a++],i=s.getAttribute(t).split(Pt),n=/([.?@])?(.*)/.exec(e);r.push({type:1,index:o,name:n[2],strings:i,ctor:"."===n[1]?ee:"?"===n[1]?ie:"@"===n[1]?se:te}),s.removeAttribute(t)}else t.startsWith(Pt)&&(r.push({type:6,index:o}),s.removeAttribute(t));if(qt.test(s.tagName)){const t=s.textContent.split(Pt),e=t.length-1;if(e>0){s.textContent=Et?Et.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],Ut()),Zt.nextNode(),r.push({type:2,index:++o});s.append(t[e],Ut())}}}else if(8===s.nodeType)if(s.data===Tt)r.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(Pt,t+1));)r.push({type:7,index:o}),t+=Pt.length-1}o++}}static createElement(t,e){const i=Lt.createElement("template");return i.innerHTML=t,i}}function Qt(t,e,i=t,s){if(e===Bt)return e;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const a=Ot(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),void 0===a?o=void 0:(o=new a(t),o._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(e=Qt(t,o._$AS(t,e.values),o,s)),e}class Xt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??Lt).importNode(e,!0);Zt.currentNode=s;let o=Zt.nextNode(),a=0,n=0,r=i[0];for(;void 0!==r;){if(a===r.index){let e;2===r.type?e=new Yt(o,o.nextSibling,this,t):1===r.type?e=new r.ctor(o,r.name,r.strings,this,t):6===r.type&&(e=new oe(o,this,t)),this._$AV.push(e),r=i[++n]}a!==r?.index&&(o=Zt.nextNode(),a++)}return Zt.currentNode=Lt,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Yt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=Vt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Qt(this,t,e),Ot(t)?t===Vt||null==t||""===t?(this._$AH!==Vt&&this._$AR(),this._$AH=Vt):t!==this._$AH&&t!==Bt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>Ht(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Vt&&Ot(this._$AH)?this._$AA.nextSibling.data=t:this.T(Lt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Jt.createElement(Ft(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new Xt(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=Kt.get(t.strings);return void 0===e&&Kt.set(t.strings,e=new Jt(t)),e}k(t){Ht(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new Yt(this.O(Ut()),this.O(Ut()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class te{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,o){this.type=1,this._$AH=Vt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Vt}_$AI(t,e=this,i,s){const o=this.strings;let a=!1;if(void 0===o)t=Qt(this,t,e,0),a=!Ot(t)||t!==this._$AH&&t!==Bt,a&&(this._$AH=t);else{const s=t;let n,r;for(t=o[0],n=0;n<o.length-1;n++)r=Qt(this,s[i+n],e,n),r===Bt&&(r=this._$AH[n]),a||=!Ot(r)||r!==this._$AH[n],r===Vt?t=Vt:t!==Vt&&(t+=(r??"")+o[n+1]),this._$AH[n]=r}a&&!s&&this.j(t)}j(t){t===Vt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ee extends te{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Vt?void 0:t}}class ie extends te{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Vt)}}class se extends te{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){if((t=Qt(this,t,e,0)??Vt)===Bt)return;const i=this._$AH,s=t===Vt&&i!==Vt||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==Vt&&(i===Vt||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class oe{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Qt(this,t)}}const ae=St.litHtmlPolyfillSupport;ae?.(Jt,Yt),(St.litHtmlVersions??=[]).push("3.3.1");
|
|
46
|
+
/**
|
|
47
|
+
* @license
|
|
48
|
+
* Copyright 2018 Google LLC
|
|
49
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
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; } 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};
|
|
23
52
|
//# sourceMappingURL=index.min.js.map
|