@cas-smartdesign/list 6.3.0
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/LICENSE +8 -0
- package/dist/docs/declarative-list-item.js +1 -0
- package/dist/docs/doc.css +1 -0
- package/dist/docs/doc.mjs +447 -0
- package/dist/docs/icon.svg +1 -0
- package/dist/docs/index.html +28 -0
- package/dist/docs/lock.svg +1 -0
- package/dist/docs/multi-select.js +1 -0
- package/dist/docs/right-arrow.svg +6 -0
- package/dist/docs/sample-data.mjs +1 -0
- package/dist/docs/single-select.js +1 -0
- package/dist/docs/trigger-only.js +1 -0
- package/dist/list-with-externals.js +133 -0
- package/dist/list-with-externals.js.map +7 -0
- package/dist/list.d.ts +68 -0
- package/dist/list.mjs +264 -0
- package/dist/list.mjs.map +1 -0
- package/npm-third-party-licenses.json +192 -0
- package/package.json +35 -0
- package/readme.md +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
7
|
+
<title>List</title>
|
|
8
|
+
<style>
|
|
9
|
+
.markdown-body {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
min-width: 200px;
|
|
12
|
+
max-width: 980px;
|
|
13
|
+
margin: 0 auto !important;
|
|
14
|
+
padding-bottom: 45px;
|
|
15
|
+
}
|
|
16
|
+
.markdown-body img {
|
|
17
|
+
background-color: transparent !important;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
|
+
<script type="module" crossorigin src="./doc.mjs"></script>
|
|
21
|
+
<link rel="stylesheet" crossorigin href="./doc.css">
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<div class="markdown-body">
|
|
25
|
+
<div id="markdown-container"></div>
|
|
26
|
+
</div>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 16c0-1.104.896-2 2-2s2 .896 2 2c0 .738-.404 1.376-1 1.723v2.277h-2v-2.277c-.596-.347-1-.985-1-1.723zm11-6v14h-18v-14h3v-4c0-3.313 2.687-6 6-6s6 2.687 6 6v4h3zm-13 0h8v-4c0-2.206-1.795-4-4-4s-4 1.794-4 4v4zm11 2h-14v10h14v-10z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{L as o}from"./doc.mjs";import{c as r,e as m}from"./sample-data.mjs";o.ensureDefined();const a=document.querySelector("#multi-select-example"),e=document.createElement(o.ID),l=r(m,!0);e.itemGenerator=x(e);e.items=l;e.selectedIndexes=[l.findIndex(s=>s.disabled)];e.tabIndex=0;e.selectionType="multi";e.addEventListener("selection",s=>{const c=s.detail.index,d=e.getListItem(c),i=e.items[c];if(i!=null&&i.extendedListItem){if(s.detail.selected){const t=e.selectedIndexes.indexOf(c);if(t!==-1){const n=[...e.selectedIndexes];n.splice(t,1),e.selectedIndexes=n}}}else{const t=d.querySelector("input");t.checked=s.detail.selected}});a.appendChild(e);function x(s){const c=s.itemGenerator;return(d,i)=>{const t=c(d,i);return t.updateComplete.then(()=>{const n=t.querySelector("input");n&&(n.disabled=d.disabled,n.checked=t.selected)}),t}}export{x as customItemGenerator};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 129 129" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 129 129">
|
|
3
|
+
<g>
|
|
4
|
+
<path d="m40.4,121.3c-0.8,0.8-1.8,1.2-2.9,1.2s-2.1-0.4-2.9-1.2c-1.6-1.6-1.6-4.2 0-5.8l51-51-51-51c-1.6-1.6-1.6-4.2 0-5.8 1.6-1.6 4.2-1.6 5.8,0l53.9,53.9c1.6,1.6 1.6,4.2 0,5.8l-53.9,53.9z"/>
|
|
5
|
+
</g>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const d="./right-arrow.svg",l="./lock.svg",p="./icon.svg",r=i=>{const n=document.createElement("div");n.style.display="flex",n.style.justifyContent="center";const t=document.createElement("img");return t.style.width="24px",t.src=i,n.appendChild(t),n};function u(i,n=!0){const t=[];for(let o=0;o<i.length;o++){const c=i[o],s=c.disabled;t.push({caption:c.caption,description:c.description,rightContentGenerator:()=>{const e=document.createElement("div");return e.style.display="flex",e.style.flexDirection="row-reverse",e.appendChild(r(d)),s&&e.appendChild(r(l)),e},leftContentGenerator:()=>{if(n){const e=document.createElement("input");return e.type="checkbox",e.tabIndex=-1,e.addEventListener("pointerdown",a=>{a.stopPropagation()}),e}},icon:p,disabled:s})}return t.push({extendedListItem:!0,caption:"Extended list",description:"",rightContentGenerator:()=>r(d)}),t}const m=[{caption:"Annette Todarini",description:"Full time employee"},{caption:"Alexandra Plose",description:"Full time employee"},{caption:"Almeria Ganning",description:"Full time employee",disabled:!0},{caption:"Lional Bukac",description:"Student"},{caption:"Lucho Giacopello",description:"Full time employee",disabled:!0},{caption:"Rik Lapham",description:"Student",disabled:!0}];export{u as c,m as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{L as m}from"./doc.mjs";import{c as v,e as h}from"./sample-data.mjs";class a{constructor(e,n){this.eventTarget=e,this.keydownHandler=n,this.catchedKeys=["Down","ArrowDown","Up","ArrowUp","Enter"],this.markAsFocusTargetHandler=()=>this.eventTarget.setAttribute("focus-target",""),this.unmarkAsFocusTargetHandler=()=>this.eventTarget.removeAttribute("focus-target"),this.delegateKeyDownEvent=t=>{if(this.catchedKeys.indexOf(t.key)!==-1){const s=t.key.toLocaleLowerCase();let c=0;const d=s.includes("enter");d||(c=s.includes("down")?1:-1),this.keydownHandler(t,c,d),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}}}static delegateTo(e){return new a(e,n=>e.dispatchEvent(new KeyboardEvent(n.type,n)))}connect(e){var n,t;if(e!=null){e.addEventListener("keydown",this.delegateKeyDownEvent),e.addEventListener("focus",this.markAsFocusTargetHandler),e.addEventListener("blur",this.unmarkAsFocusTargetHandler);const s=document.activeElement;(e.contains(s)||(t=(n=e.shadowRoot)==null?void 0:n.activeElement)!=null&&t.contains(s))&&this.markAsFocusTargetHandler()}}disconnect(e){e!=null&&(e.removeEventListener("keydown",this.delegateKeyDownEvent),e.removeEventListener("focus",this.markAsFocusTargetHandler),e.removeEventListener("blur",this.unmarkAsFocusTargetHandler),this.unmarkAsFocusTargetHandler())}}m.ensureDefined();const l=document.querySelector("#single-select-example"),o=l.querySelector("sd-list"),r=l.querySelector("input"),i=v(h,!1),g=i.length-1;o.items=i;r.addEventListener("input",()=>{o.items=i.filter((u,e)=>e==g||!r.value||u.caption.toLowerCase().indexOf(r.value.toLowerCase())>=0)});a.delegateTo(o).connect(r);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{L as o}from"./doc.mjs";import{c,e as m}from"./sample-data.mjs";const r=document.querySelector("#trigger-only-example"),e=document.createElement(o.ID),s=c(m,!1);e.items=s;e.tabIndex=0;e.selectionType="trigger-only";e.addEventListener("selection",i=>{const n=i.detail.index,t=e.items[n];t!=null&&t.extendedListItem||!i.detail.selected||(s.splice(n,1),e.items=s)});r.appendChild(e);
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var window;(window||={})["@cas-smartdesign/list"]=(()=>{var X=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var Ft=Object.prototype.hasOwnProperty;var jt=(s,t)=>{for(var e in t)X(s,e,{get:t[e],enumerable:!0})},Vt=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wt(t))!Ft.call(s,o)&&o!==e&&X(s,o,{get:()=>t[o],enumerable:!(i=zt(t,o))||i.enumerable});return s};var qt=s=>Vt(X({},"__esModule",{value:!0}),s);var ne={};jt(ne,{default:()=>Ot});var ft=class z extends HTMLElement{memoizedTemplate(){let t=this.is();if(z.TEMPLATE_CACHE[t])return z.TEMPLATE_CACHE[t];let e=this.template();return window.ShadyCSS&&window.ShadyCSS.prepareTemplate(e,this.is()),z.TEMPLATE_CACHE[t]=e,e}connectedCallback(){let t=this.memoizedTemplate();window.ShadyCSS&&window.ShadyCSS.styleElement(this),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(document.importNode(t.content,!0)),requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("ready"))))}whenReady(t){this.shadowRoot?t():this.addEventListener("ready",()=>t())}};ft.TEMPLATE_CACHE={};var vt=ft;var W=window,F=W.ShadowRoot&&(W.ShadyCSS===void 0||W.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Y=Symbol(),gt=new WeakMap,L=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==Y)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(F&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=gt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&>.set(e,t))}return t}toString(){return this.cssText}},j=s=>new L(typeof s=="string"?s:s+"",void 0,Y),Z=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((i,o,r)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+s[r+1],s[0]);return new L(e,s,Y)},Q=(s,t)=>{F?s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{let i=document.createElement("style"),o=W.litNonce;o!==void 0&&i.setAttribute("nonce",o),i.textContent=e.cssText,s.appendChild(i)})},V=F?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return j(e)})(s):s;var tt,q=window,yt=q.trustedTypes,Gt=yt?yt.emptyScript:"",$t=q.reactiveElementPolyfillSupport,it={toAttribute(s,t){switch(t){case Boolean:s=s?Gt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},bt=(s,t)=>t!==s&&(t==t||s==s),et={attribute:!0,type:String,converter:it,reflect:!1,hasChanged:bt},st="finalized",y=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();let t=[];return this.elementProperties.forEach((e,i)=>{let o=this._$Ep(i,e);o!==void 0&&(this._$Ev.set(o,i),t.push(o))}),t}static createProperty(t,e=et){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){let i=typeof t=="symbol"?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);o!==void 0&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){let r=this[t];this[e]=o,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||et}static finalize(){if(this.hasOwnProperty(st))return!1;this[st]=!0;let t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(let o of i)this.createProperty(o,e[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let o of i)e.unshift(V(o))}else t!==void 0&&e.push(V(t));return e}static _$Ep(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;let e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return Q(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=et){var o;let r=this.constructor._$Ep(t,i);if(r!==void 0&&i.reflect===!0){let n=(((o=i.converter)===null||o===void 0?void 0:o.toAttribute)!==void 0?i.converter:it).toAttribute(e,i.type);this._$El=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$El=null}}_$AK(t,e){var i;let o=this.constructor,r=o._$Ev.get(t);if(r!==void 0&&this._$El!==r){let n=o.getPropertyOptions(r),a=typeof n.converter=="function"?{fromAttribute:n.converter}:((i=n.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?n.converter:it;this._$El=r,this[r]=a.fromAttribute(e,n.type),this._$El=null}}requestUpdate(t,e,i){let o=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||bt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((o,r)=>this[r]=o),this._$Ei=void 0);let e=!1,i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$ES)===null||t===void 0||t.forEach(o=>{var r;return(r=o.hostUpdate)===null||r===void 0?void 0:r.call(o)}),this.update(i)):this._$Ek()}catch(o){throw e=!1,this._$Ek(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var o;return(o=i.hostUpdated)===null||o===void 0?void 0:o.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$EO(i,this[i],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};y[st]=!0,y.elementProperties=new Map,y.elementStyles=[],y.shadowRootOptions={mode:"open"},$t?.({ReactiveElement:y}),((tt=q.reactiveElementVersions)!==null&&tt!==void 0?tt:q.reactiveElementVersions=[]).push("1.6.3");var ot,G=window,w=G.trustedTypes,At=w?w.createPolicy("lit-html",{createHTML:s=>s}):void 0,rt="$lit$",b=`lit$${(Math.random()+"").slice(9)}$`,It="?"+b,Kt=`<${It}>`,S=document,H=()=>S.createComment(""),U=s=>s===null||typeof s!="object"&&typeof s!="function",Tt=Array.isArray,Jt=s=>Tt(s)||typeof s?.[Symbol.iterator]=="function",nt=`[
|
|
2
|
+
\f\r]`,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_t=/-->/g,Et=/>/g,_=RegExp(`>|${nt}(?:([^\\s"'>=/]+)(${nt}*=${nt}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),St=/'/g,xt=/"/g,kt=/^(?:script|style|textarea|title)$/i,Lt=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),R=Lt(1),ue=Lt(2),$=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),wt=new WeakMap,E=S.createTreeWalker(S,129,null,!1);function Pt(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return At!==void 0?At.createHTML(t):t}var Xt=(s,t)=>{let e=s.length-1,i=[],o,r=t===2?"<svg>":"",n=P;for(let a=0;a<e;a++){let l=s[a],c,h,u=-1,p=0;for(;p<l.length&&(n.lastIndex=p,h=n.exec(l),h!==null);)p=n.lastIndex,n===P?h[1]==="!--"?n=_t:h[1]!==void 0?n=Et:h[2]!==void 0?(kt.test(h[2])&&(o=RegExp("</"+h[2],"g")),n=_):h[3]!==void 0&&(n=_):n===_?h[0]===">"?(n=o??P,u=-1):h[1]===void 0?u=-2:(u=n.lastIndex-h[2].length,c=h[1],n=h[3]===void 0?_:h[3]==='"'?xt:St):n===xt||n===St?n=_:n===_t||n===Et?n=P:(n=_,o=void 0);let g=n===_&&s[a+1].startsWith("/>")?" ":"";r+=n===P?l+Kt:u>=0?(i.push(c),l.slice(0,u)+rt+l.slice(u)+b+g):l+b+(u===-2?(i.push(void 0),a):g)}return[Pt(s,r+(s[e]||"<?>")+(t===2?"</svg>":"")),i]},M=class s{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,n=0,a=t.length-1,l=this.parts,[c,h]=Xt(t,e);if(this.el=s.createElement(c,i),E.currentNode=this.el.content,e===2){let u=this.el.content,p=u.firstChild;p.remove(),u.append(...p.childNodes)}for(;(o=E.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes()){let u=[];for(let p of o.getAttributeNames())if(p.endsWith(rt)||p.startsWith(b)){let g=h[n++];if(u.push(p),g!==void 0){let Bt=o.getAttribute(g.toLowerCase()+rt).split(b),B=/([.?@])?(.*)/.exec(g);l.push({type:1,index:r,name:B[2],strings:Bt,ctor:B[1]==="."?at:B[1]==="?"?ct:B[1]==="@"?dt:I})}else l.push({type:6,index:r})}for(let p of u)o.removeAttribute(p)}if(kt.test(o.tagName)){let u=o.textContent.split(b),p=u.length-1;if(p>0){o.textContent=w?w.emptyScript:"";for(let g=0;g<p;g++)o.append(u[g],H()),E.nextNode(),l.push({type:2,index:++r});o.append(u[p],H())}}}else if(o.nodeType===8)if(o.data===It)l.push({type:2,index:r});else{let u=-1;for(;(u=o.data.indexOf(b,u+1))!==-1;)l.push({type:7,index:r}),u+=b.length-1}r++}}static createElement(t,e){let i=S.createElement("template");return i.innerHTML=t,i}};function C(s,t,e=s,i){var o,r,n,a;if(t===$)return t;let l=i!==void 0?(o=e._$Co)===null||o===void 0?void 0:o[i]:e._$Cl,c=U(t)?void 0:t._$litDirective$;return l?.constructor!==c&&((r=l?._$AO)===null||r===void 0||r.call(l,!1),c===void 0?l=void 0:(l=new c(s),l._$AT(s,e,i)),i!==void 0?((n=(a=e)._$Co)!==null&&n!==void 0?n:a._$Co=[])[i]=l:e._$Cl=l),l!==void 0&&(t=C(s,l._$AS(s,t.values),l,i)),t}var lt=class{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){var e;let{el:{content:i},parts:o}=this._$AD,r=((e=t?.creationScope)!==null&&e!==void 0?e:S).importNode(i,!0);E.currentNode=r;let n=E.nextNode(),a=0,l=0,c=o[0];for(;c!==void 0;){if(a===c.index){let h;c.type===2?h=new N(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new ht(n,this,t)),this._$AV.push(h),c=o[++l]}a!==c?.index&&(n=E.nextNode(),a++)}return E.currentNode=S,r}v(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},N=class s{constructor(t,e,i,o){var r;this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cp=(r=o?.isConnected)===null||r===void 0||r}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=C(this,t,e),U(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==$&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Jt(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==d&&U(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var e;let{values:i,_$litType$:o}=t,r=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=M.createElement(Pt(o.h,o.h[0]),this.options)),o);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===r)this._$AH.v(i);else{let n=new lt(r,this),a=n.u(this.options);n.v(i),this.$(a),this._$AH=n}}_$AC(t){let e=wt.get(t.strings);return e===void 0&&wt.set(t.strings,e=new M(t)),e}T(t){Tt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,o=0;for(let r of t)o===e.length?e.push(i=new s(this.k(H()),this.k(H()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){let o=t.nextSibling;t.remove(),t=o}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}},I=class{constructor(t,e,i,o,r){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){let r=this.strings,n=!1;if(r===void 0)t=C(this,t,e,0),n=!U(t)||t!==this._$AH&&t!==$,n&&(this._$AH=t);else{let a=t,l,c;for(t=r[0],l=0;l<r.length-1;l++)c=C(this,a[i+l],e,l),c===$&&(c=this._$AH[l]),n||(n=!U(c)||c!==this._$AH[l]),c===d?t=d:t!==d&&(t+=(c??"")+r[l+1]),this._$AH[l]=c}n&&!o&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},at=class extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},Yt=w?w.emptyScript:"",ct=class extends I{constructor(){super(...arguments),this.type=4}j(t){t&&t!==d?this.element.setAttribute(this.name,Yt):this.element.removeAttribute(this.name)}},dt=class extends I{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=(i=C(this,t,e,0))!==null&&i!==void 0?i:d)===$)return;let o=this._$AH,r=t===d&&o!==d||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==d&&(o===d||r);r&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}},ht=class{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){C(this,t)}};var Ct=G.litHtmlPolyfillSupport;Ct?.(M,N),((ot=G.litHtmlVersions)!==null&&ot!==void 0?ot:G.litHtmlVersions=[]).push("2.8.0");var Ht=(s,t,e)=>{var i,o;let r=(i=e?.renderBefore)!==null&&i!==void 0?i:t,n=r._$litPart$;if(n===void 0){let a=(o=e?.renderBefore)!==null&&o!==void 0?o:null;r._$litPart$=n=new N(t.insertBefore(H(),a),a,void 0,e??{})}return n._$AI(s),n};var ut,pt;var A=class extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;let i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ht(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return $}};A.finalized=!0,A._$litElement$=!0,(ut=globalThis.litElementHydrateSupport)===null||ut===void 0||ut.call(globalThis,{LitElement:A});var Ut=globalThis.litElementPolyfillSupport;Ut?.({LitElement:A});((pt=globalThis.litElementVersions)!==null&&pt!==void 0?pt:globalThis.litElementVersions=[]).push("3.3.3");var Zt=(s,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,s)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,s)}},Qt=(s,t,e)=>{t.constructor.createProperty(e,s)};function m(s){return(t,e)=>e!==void 0?Qt(s,t,e):Zt(s,t)}var Mt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Nt=s=>(...t)=>({_$litDirective$:s,values:t}),K=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var D=class extends K{constructor(t){if(super(t),this.et=d,t.type!==Mt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===d||t==null)return this.ft=void 0,this.et=t;if(t===$)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;let e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}};D.directiveName="unsafeHTML",D.resultType=1;var Rt=Nt(D);var O=s=>s??d;var J=class{static showImage(t,e,i,o){let r;if(o||!(t instanceof HTMLImageElement)?r=n=>t.style.backgroundImage=this.prepareSrc(n):r=n=>t.src=n,r(i),e){let n=()=>{r(e)},a=new Image;a.addEventListener("load",n),a.src=e,a.complete&&(a.removeEventListener("load",n),n())}}static prepareSrc(t){return t?t.startsWith("url")?t:`url("${t}")`:null}};var te=':host{display:block;contain:strict;height:50px}:host([selected]){background-color:#d3e6fa}:host(:not([selected]):hover),:host(:not([selected])[focused]){background-color:#e7f1fa}@media (forced-colors: active){:host([selected]){outline:4px solid}:host(:not([selected]):hover){outline:4px dotted}:host(:not([selected])[focused]){outline:4px dashed}}:host([enable-line-clamp]) .labels>:only-child{display:-webkit-box;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal;word-wrap:break-word}.container{display:flex;height:100%;box-sizing:border-box}.container .level-indicator{width:7px;height:100%}.container .level-indicator.level-0{background-color:#a0c3ef}.container .level-indicator.level-1{background-color:#e7c374}.container .level-indicator.level-2{background-color:#bfd596}.container .level-indicator.level-3{background-color:#fd998d}.container .level-indicator.level-4{background-color:#c6e8f5}.container .level-indicator.level-5{background-color:#fde3a4}.container .level-indicator.level-6{background-color:#dcbfe0}.side-content{display:flex;align-items:center;flex-grow:0}.labels{display:flex;flex-direction:column;justify-content:center;flex:1 1 0px;height:100%;line-height:normal;overflow:hidden;padding:var(--sd-list-item-label-content-padding, 0 8px)}.caption,.description{width:100%;font-family:var(--sd-list-item-font-family, "Segoe UI", "Lucida Sans", Arial, sans-serif);font-style:normal;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-webkit-user-select:none;user-select:none;text-decoration:var(--sd-list-item-text-decoration, inherit)}.caption em,.description em{font-weight:bolder}.caption{font-size:var(--sd-list-item-caption-font-size, 16px);color:var(--sd-list-item-caption-text-color, #111);font-weight:var(--sd-list-item-caption-font-weight, normal)}.description{font-size:var(--sd-list-item-description-font-size, 13px);color:var(--sd-list-item-description-text-color, #767676);font-weight:var(--sd-list-item-description-font-weight, normal)}.icon-wrapper{width:var(--sd-list-item-icon-wrapper-width, 45px);height:100%;display:flex;align-items:center;justify-content:center}.icon-wrapper .icon{min-height:var(--sd-list-item-icon-size, 24px);min-width:var(--sd-list-item-icon-size, 24px);background-repeat:no-repeat;background-position:center;background-size:cover}',ee=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,v=(s,t,e,i)=>{for(var o=i>1?void 0:i?ie(t,e):t,r=s.length-1,n;r>=0;r--)(n=s[r])&&(o=(i?n(t,e,o):n(o))||o);return i&&o&&ee(t,e,o),o},x,f=(x=class extends A{constructor(){super(...arguments),this.contentMode="text",this.role="option"}static get styles(){return[Z`
|
|
4
|
+
${j(te)}
|
|
5
|
+
`]}render(){return R`
|
|
6
|
+
<div class="container">
|
|
7
|
+
${this.getLevelIndicators().map((s,t)=>R` <div class="level-indicator level-${t}"></div> `)}
|
|
8
|
+
<div class="side-content">
|
|
9
|
+
<slot name="left-content"></slot>
|
|
10
|
+
${this.renderIcon()}
|
|
11
|
+
</div>
|
|
12
|
+
<div class="labels">
|
|
13
|
+
${this.renderLabel("caption",this.caption,this.captionAttrTitle)}
|
|
14
|
+
${this.renderLabel("description",this.description,this.descriptionAttrTitle)}
|
|
15
|
+
</div>
|
|
16
|
+
<div class="side-content">
|
|
17
|
+
<slot name="right-content"></slot>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`}renderIcon(){if(this.icon||this.iconPlaceholder){let s=this.iconBackgroundColor!=null?`background-color:${this.iconBackgroundColor}`:void 0;return R`
|
|
21
|
+
<div
|
|
22
|
+
class="icon-wrapper"
|
|
23
|
+
@pointerdown="${this.handleIconClick}"
|
|
24
|
+
style="${O(s)}"
|
|
25
|
+
role="img"
|
|
26
|
+
aria-label="${O(this.iconAttrAriaLabel)}"
|
|
27
|
+
title="${O(this.iconAttrTitle)}"
|
|
28
|
+
>
|
|
29
|
+
<div class="icon"></div>
|
|
30
|
+
</div>
|
|
31
|
+
`}return d}renderLabel(s,t,e){return t?R`
|
|
32
|
+
<div class="${s}" title="${O(e)}">
|
|
33
|
+
${this.contentMode==="html"?Rt(t):t}
|
|
34
|
+
</div>
|
|
35
|
+
`:d}updated(s){super.updated(s),(s.has("icon")||s.has("iconPlaceholder"))&&(this.icon||this.iconPlaceholder)&&J.showImage(this.shadowRoot.querySelector(".icon"),this.icon,this.iconPlaceholder),s.has("selected")&&this.setAttribute("aria-selected",String(this.selected))}get missingWidthForTexts(){let s=this.enableLineClamp;this.removeAttribute("enable-line-clamp");let t=0,e=this.shadowRoot.querySelector(".caption");e&&(t+=e.scrollWidth-e.clientWidth);let i=this.shadowRoot.querySelector(".description");return i&&(t=Math.max(t,i.scrollWidth-i.clientWidth)),t>0&&t++,s&&this.setAttribute("enable-line-clamp",""),t}handleIconClick(s){!this.disabled&&!this.dispatchEvent(new PointerEvent("list-item-icon-click",s))&&s.preventDefault()}getLevelIndicators(){return this.level?Array(Number(this.level)).fill(null):[]}},x.ID="sd-list-item",x.ensureDefined=()=>{customElements.get(x.ID)||customElements.define(x.ID,x)},x);v([m({type:String})],f.prototype,"caption",2);v([m({type:String})],f.prototype,"description",2);v([m({type:Boolean})],f.prototype,"selected",2);v([m({type:String})],f.prototype,"icon",2);v([m({type:String})],f.prototype,"iconBackgroundColor",2);v([m({type:String})],f.prototype,"iconPlaceholder",2);v([m({type:Number})],f.prototype,"level",2);v([m()],f.prototype,"contentMode",2);v([m({type:Boolean,reflect:!0,attribute:"enable-line-clamp"})],f.prototype,"enableLineClamp",2);v([m({type:Boolean,reflect:!0,attribute:"aria-disabled"})],f.prototype,"disabled",2);v([m({type:String,attribute:"icon-attr-aria-label"})],f.prototype,"iconAttrAriaLabel",2);v([m({type:String,reflect:!0})],f.prototype,"role",2);v([m({type:String,attribute:"caption-attr-title"})],f.prototype,"captionAttrTitle",2);v([m({type:String,attribute:"description-attr-title"})],f.prototype,"descriptionAttrTitle",2);v([m({type:String,attribute:"icon-attr-title"})],f.prototype,"iconAttrTitle",2);var T=f,Dt=(s,t)=>{let e=document.createElement(T.ID);if(s){if(e.caption=s.caption,e.description=s.description,e.icon=s.icon,e.iconBackgroundColor=s.iconBackgroundColor,e.iconPlaceholder=s.iconPlaceholder,e.level=s.level,e.disabled=s.disabled,s.contentMode&&(e.contentMode=s.contentMode),s.leftContentGenerator){let i=s.leftContentGenerator(s,e);i&&(i.slot="left-content",e.appendChild(i))}if(s.rightContentGenerator){let i=s.rightContentGenerator(s,e);i&&(i.slot="right-content",e.appendChild(i))}}return e};T.ensureDefined();var se=`<style>
|
|
36
|
+
:host {
|
|
37
|
+
background-color: var(--sd-list-base-background-color, white);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.container {
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host(:focus) {
|
|
46
|
+
outline: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host(:focus-visible) ::slotted([focused]) {
|
|
50
|
+
box-shadow: 0 0 0 1px #1467ba inset;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.container ::slotted(*) {
|
|
54
|
+
display: block;
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.container ::slotted(:not(:last-of-type)) {
|
|
59
|
+
border-bottom: 1px solid #d9d9d9;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
62
|
+
|
|
63
|
+
<div class="container">
|
|
64
|
+
<slot name="items"></slot>
|
|
65
|
+
<slot id="default-slot"></slot>
|
|
66
|
+
</div>
|
|
67
|
+
`,oe=0,k=class mt extends vt{constructor(){super(),this._items=[],this._selectedIndexes=[],this._itemGenerator=Dt,this.onDefaultSlotChange=()=>{let t=0;this.defaultSlot.assignedElements().forEach(e=>{this.isSeparator(e)||this.initListItem(e,t++)}),this.updateFocusedElement()},this.handleKeyDown=t=>{let e=!0;switch(t.key){case"ArrowDown":case"Down":this.focusIndex=Math.min(this.getListItems.length-1,this.focusIndex+1);break;case"ArrowUp":case"Up":this.focusIndex=Math.max(0,this.focusIndex-1);break;case"Enter":case"Space":case" ":this.handleSelection(this.focusIndex,t.metaKey||t.ctrlKey);break;case"End":case"PageDown":this.focusIndex=this.items.length-1;break;case"Home":case"PageUp":this.focusIndex=0;break;default:e=!1;break}e&&(t.preventDefault(),t.stopPropagation())},this._fallbackId=mt.ID+"_"+oe++,this.addEventListener("pointerup",t=>{this.focusIndex=this.getListItems.indexOf(t.target),this.updateFocusedElement()}),this.addEventListener("focus",()=>{this.matches(":focus-visible")&&(this.focusIndex==-1?(this.selectedIndexes&&(this.focusIndex=this.selectedIndexes[0]),this.focusIndex==-1&&this.childElementCount>0&&(this.focusIndex=0)):this.updateFocusedElement())}),this.addEventListener("blur",()=>this.removeFocusedItemAttributes())}get items(){return this._items}set items(t){this._items=t,this.render()}get itemGenerator(){return this._itemGenerator}set itemGenerator(t){this._itemGenerator=t,this.render()}get selectionType(){return this.getAttribute("selection-type")}set selectionType(t){t?this.setAttribute("selection-type",t):this.removeAttribute("selection-type")}get focusIndex(){return this.hasAttribute("focus-index")?Number(this.getAttribute("focus-index")):-1}set focusIndex(t){0<=t&&t<this.getListItems.length?this.setAttribute("focus-index",t.toString()):this.removeAttribute("focus-index")}get focusTarget(){return this.hasAttribute("focus-target")}set focusTarget(t){this.toggleAttribute("focus-target",t)}getListItem(t){return this.shadowRoot?this.getListItems[t]:null}get getListItems(){return Array.prototype.slice.call(this.children).filter(t=>!this.isSeparator(t))}get selectedIndexes(){return this._selectedIndexes}set selectedIndexes(t){let e=this._selectedIndexes||[];this._selectedIndexes=t||[],e.filter(i=>!this._selectedIndexes.includes(i)).forEach(i=>{this.setSelectedAttr(this.getListItem(i),!1)}),this._selectedIndexes.filter(i=>!e.includes(i)).forEach(i=>{this.setSelectedAttr(this.getListItem(i),!0)})}static get observedAttributes(){return["focus-index","focus-target"]}is(){return mt.ID}template(){let t=document.createElement("template");return t.innerHTML=se,t}removeFocusedItemAttributes(){if(this.focusIndex!=-1){let t=this.getListItem(this.focusIndex);t&&(t.removeAttribute("focused"),this.removeAttribute("aria-activedescendant"))}}connectedCallback(){super.connectedCallback(),this.defaultSlot.addEventListener("slotchange",this.onDefaultSlotChange),this.hasAttribute("role")||this.setAttribute("role","listbox"),this.id||(this.id=this._fallbackId),this.render(),this.addEventListener("keydown",this.handleKeyDown),this.selectionType||(this.selectionType="trigger-only")}get defaultSlot(){return this.shadowRoot.querySelector("#default-slot")}isSeparator(t){return t.tagName=="HR"||t.getAttribute("role")=="separator"}attributeChangedCallback(t,e,i){if(t==="focus-index"){let o=this.getListItem(e);o&&o.removeAttribute("focused"),this.updateFocusedElement()}else t==="focus-target"&&(this.focusTarget?this.updateFocusedElement():document.activeElement!=this&&this.removeFocusedItemAttributes())}increaseWidthIfNeeded(){window.requestAnimationFrame(()=>{let t=Number.MAX_SAFE_INTEGER,e=getComputedStyle(this).maxWidth,i=this.offsetWidth;e.endsWith("px")&&(t=Number.parseInt(e)-i);let o=this.style.width;if(t==0||o.endsWith("px")&&i<Number.parseInt(o))this.enableLineClampOnItemsIfNeeded();else{let r=[...this.querySelectorAll("[slot='items']")].map(a=>{if(a instanceof T){a.enableLineClamp=!1;let l=a.missingWidthForTexts;return l>t&&(a.enableLineClamp=!0),l}}),n=Math.max(...r);if(n>0){let a=i+n;this.style.width=`${a}px`,this.offsetWidth<a&&this.enableLineClampOnItemsIfNeeded()}}})}enableLineClampOnItemsIfNeeded(){this.querySelectorAll("[slot='items']").forEach(t=>{t instanceof T&&(t.enableLineClamp=t.enableLineClamp||t.missingWidthForTexts>0)})}render(){if(!this.isConnected||!this.items)return;this.querySelectorAll("[slot='items']").forEach(i=>{this.removeChild(i)});let t=document.createDocumentFragment(),e=0;this.items.forEach((i,o)=>{let r=this.itemGenerator(i,o);this.isSeparator(r)||this.initListItem(r,e++),r.slot="items",t.appendChild(r)}),this.appendChild(t),this.updateFocusedElement()}initListItem(t,e){this.setSelectedAttr(t,this.selectedIndexes.includes(e)),t.addEventListener("click",i=>{this.handleItemClick(i,e)}),t.addEventListener("mousedown",i=>{i.button==1&&i.preventDefault()}),t.addEventListener("auxclick",i=>{this.handleItemClick(i,e)}),(!t.id||t.id.startsWith(this.id+"_item_"))&&(t.id=this.id+"_item_"+e)}ensureItemVisible(t){let e=t.getBoundingClientRect(),i=this.getBoundingClientRect();e.bottom>i.bottom?this.scrollTop+=e.bottom-i.bottom:e.top<i.top&&(this.scrollTop-=i.top-e.top)}updateFocusedElement(){let t=this.getListItem(this.focusIndex);t&&(this.focusTarget||document.activeElement==this)?(t.setAttribute("focused",""),this.setAttribute("aria-activedescendant",t.id),this.ensureItemVisible(t)):this.removeAttribute("aria-activedescendant")}handleItemClick(t,e){if(t.button!==null){let i=t.type=="auxclick"&&t.button==1||t.metaKey||t.ctrlKey;(t.button==0||t.button==1)&&this.handleSelection(e,i)}}handleSelection(t,e){let i=this.items[t];if(!i||i.disabled)return;let o=this.getListItem(t),r=this.isSelected(o);this.selectionType!=="trigger-only"&&(this.selectionType==="single"?this.selectedIndexes=r?[]:[t]:this.toggleSelection(o)?this._selectedIndexes.push(t):this.removeFromSelectedIndexes(t)),this.focusIndex=t,this.dispatchEvent(new CustomEvent("selection",{detail:{index:t,selected:this.selectionType=="trigger-only"||!r,hasModifier:e},bubbles:!0,composed:!0}))}removeFromSelectedIndexes(t){let e=this._selectedIndexes.indexOf(t);e!==-1&&this._selectedIndexes.splice(e,1)}toggleSelection(t){let e=!t.hasAttribute("selected");return this.setSelectedAttr(t,e),e}setSelectedAttr(t,e){t&&(e?t.setAttribute("selected",""):t.removeAttribute("selected"),t.setAttribute("aria-selected",String(e)))}isSelected(t){return t.hasAttribute("selected")}};k.ID="sd-list",k.ensureDefined=()=>{T.ensureDefined(),customElements.get(k.ID)||customElements.define(k.ID,k)};var Ot=k;Ot.ensureDefined();return qt(ne);})();
|
|
68
|
+
/*! Bundled license information:
|
|
69
|
+
|
|
70
|
+
@lit/reactive-element/css-tag.js:
|
|
71
|
+
(**
|
|
72
|
+
* @license
|
|
73
|
+
* Copyright 2019 Google LLC
|
|
74
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
75
|
+
*)
|
|
76
|
+
|
|
77
|
+
@lit/reactive-element/reactive-element.js:
|
|
78
|
+
(**
|
|
79
|
+
* @license
|
|
80
|
+
* Copyright 2017 Google LLC
|
|
81
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
82
|
+
*)
|
|
83
|
+
|
|
84
|
+
lit-html/lit-html.js:
|
|
85
|
+
(**
|
|
86
|
+
* @license
|
|
87
|
+
* Copyright 2017 Google LLC
|
|
88
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
89
|
+
*)
|
|
90
|
+
|
|
91
|
+
lit-element/lit-element.js:
|
|
92
|
+
(**
|
|
93
|
+
* @license
|
|
94
|
+
* Copyright 2017 Google LLC
|
|
95
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
96
|
+
*)
|
|
97
|
+
|
|
98
|
+
lit-html/is-server.js:
|
|
99
|
+
(**
|
|
100
|
+
* @license
|
|
101
|
+
* Copyright 2022 Google LLC
|
|
102
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
103
|
+
*)
|
|
104
|
+
|
|
105
|
+
@lit/reactive-element/decorators/property.js:
|
|
106
|
+
(**
|
|
107
|
+
* @license
|
|
108
|
+
* Copyright 2017 Google LLC
|
|
109
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
110
|
+
*)
|
|
111
|
+
|
|
112
|
+
lit-html/directive.js:
|
|
113
|
+
(**
|
|
114
|
+
* @license
|
|
115
|
+
* Copyright 2017 Google LLC
|
|
116
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
117
|
+
*)
|
|
118
|
+
|
|
119
|
+
lit-html/directives/unsafe-html.js:
|
|
120
|
+
(**
|
|
121
|
+
* @license
|
|
122
|
+
* Copyright 2017 Google LLC
|
|
123
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
124
|
+
*)
|
|
125
|
+
|
|
126
|
+
lit-html/directives/if-defined.js:
|
|
127
|
+
(**
|
|
128
|
+
* @license
|
|
129
|
+
* Copyright 2018 Google LLC
|
|
130
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
131
|
+
*)
|
|
132
|
+
*/
|
|
133
|
+
//# sourceMappingURL=list-with-externals.js.map
|