@mndw/cli 0.1.5 → 0.2.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/dist/meta.json +83 -27
- package/dist/mndw.js +391 -101
- package/host-dev/assets/index-BqQCCILo.css +1 -0
- package/host-dev/assets/index-DFVRx7na.js +94 -0
- package/host-dev/assets/sandbox-url-D8HO7UBF.js +1 -0
- package/host-dev/index.html +3 -3
- package/host-dev/shared/mndw-ui@0.2.0.js +1805 -0
- package/package.json +18 -14
- package/templates/angular/i18n/en.json +4 -9
- package/templates/angular/i18n/ru.json +4 -9
- package/templates/angular/src/app.component.ts +39 -39
- package/templates/angular/src/index.ts +14 -1
- package/templates/angular/src/l10n.test.ts +50 -17
- package/templates/go/i18n/en.json +1 -1
- package/templates/go/i18n/ru.json +1 -1
- package/templates/go/src/index.css +4 -20
- package/templates/go/src/index.test.ts +12 -24
- package/templates/go/src/index.ts +18 -15
- package/templates/go/src/l10n.test.ts +37 -23
- package/templates/svelte/i18n/en.json +4 -9
- package/templates/svelte/i18n/ru.json +4 -9
- package/templates/svelte/src/App.svelte +46 -72
- package/templates/svelte/src/index.ts +7 -0
- package/templates/svelte/src/l10n.test.ts +64 -17
- package/templates/svelte/svelte.config.js +7 -0
- package/templates/svelte/vitest.config.ts +2 -1
- package/templates/vanilla/i18n/en.json +4 -3
- package/templates/vanilla/i18n/ru.json +4 -3
- package/templates/vanilla/src/index.css +4 -20
- package/templates/vanilla/src/index.ts +47 -17
- package/templates/vanilla/src/l10n.test.ts +50 -17
- package/templates/vue/i18n/en.json +4 -9
- package/templates/vue/i18n/ru.json +4 -9
- package/templates/vue/src/App.vue +36 -54
- package/templates/vue/src/index.ts +7 -0
- package/templates/vue/src/l10n.test.ts +50 -17
- package/host-dev/assets/index-CJ80zEWN.js +0 -94
- package/host-dev/assets/index-DNxACGUr.css +0 -1
- package/host-dev/assets/sandbox-url-Dk7HpxDp.js +0 -1
- package/host-dev/shared/mndw-ui@0.1.5.js +0 -1782
- package/templates/angular/src/table.test.ts +0 -59
- package/templates/svelte/src/TableNameCell.svelte +0 -10
- package/templates/svelte/src/table.test.ts +0 -53
- package/templates/vue/src/TableNameCell.vue +0 -12
- package/templates/vue/src/table.test.ts +0 -53
|
@@ -1,1782 +0,0 @@
|
|
|
1
|
-
var yt=globalThis,St=yt.ShadowRoot&&(yt.ShadyCSS===void 0||yt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,dr=Symbol(),li=new WeakMap,De=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==dr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(St&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=li.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&li.set(t,e))}return e}toString(){return this.cssText}},di=i=>new De(typeof i=="string"?i:i+"",void 0,dr),v=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,n,o)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[o+1],i[0]);return new De(t,i,dr)},ci=(i,e)=>{if(St)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),n=yt.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)}},cr=St?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return di(t)})(i):i;var{is:Xn,defineProperty:Jn,getOwnPropertyDescriptor:Zn,getOwnPropertyNames:Qn,getOwnPropertySymbols:eo,getPrototypeOf:to}=Object,xt=globalThis,ui=xt.trustedTypes,ro=ui?ui.emptyScript:"",io=xt.reactiveElementPolyfillSupport,Ne=(i,e)=>i,ur={toAttribute(i,e){switch(e){case Boolean:i=i?ro:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},pi=(i,e)=>!Xn(i,e),hi={attribute:!0,type:String,converter:ur,reflect:!1,useDefault:!1,hasChanged:pi};Symbol.metadata??=Symbol("metadata"),xt.litPropertyMetadata??=new WeakMap;var H=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=hi){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);n!==void 0&&Jn(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:o}=Zn(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:n,set(a){let s=n?.call(this);o?.call(this,a),this.requestUpdate(e,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??hi}static _$Ei(){if(this.hasOwnProperty(Ne("elementProperties")))return;let e=to(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ne("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ne("properties"))){let t=this.properties,r=[...Qn(t),...eo(t)];for(let n of r)this.createProperty(n,t[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,n]of t)this.elementProperties.set(r,n)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let n=this._$Eu(t,r);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(cr(n))}else e!==void 0&&t.push(cr(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ci(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(n!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:ur).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(n!==void 0&&this._$Em!==n){let o=r.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ur;this._$Em=n;let s=a.fromAttribute(t,o.type);this[n]=s??this._$Ej?.get(n)??s,this._$Em=null}}requestUpdate(e,t,r,n=!1,o){if(e!==void 0){let a=this.constructor;if(n===!1&&(o=this[e]),r??=a.getPropertyOptions(e),!((r.hasChanged??pi)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:n,wrapped:o},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),o!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),n===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[n,o]of r){let{wrapped:a}=o,s=this[n];a!==!0||this._$AL.has(n)||s===void 0||this.C(n,void 0,o,s)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};H.elementStyles=[],H.shadowRootOptions={mode:"open"},H[Ne("elementProperties")]=new Map,H[Ne("finalized")]=new Map,io?.({ReactiveElement:H}),(xt.reactiveElementVersions??=[]).push("2.1.2");var pr=globalThis,mi=i=>i,Ct=pr.trustedTypes,bi=Ct?Ct.createPolicy("lit-html",{createHTML:i=>i}):void 0,mr="$lit$",Y=`lit$${Math.random().toFixed(9).slice(2)}$`,br="?"+Y,no=`<${br}>`,oe=document,Oe=()=>oe.createComment(""),Ie=i=>i===null||typeof i!="object"&&typeof i!="function",fr=Array.isArray,Si=i=>fr(i)||typeof i?.[Symbol.iterator]=="function",hr=`[
|
|
2
|
-
\f\r]`,$e=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,fi=/-->/g,vi=/>/g,ie=RegExp(`>|${hr}(?:([^\\s"'>=/]+)(${hr}*=${hr}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),gi=/'/g,wi=/"/g,xi=/^(?:script|style|textarea|title)$/i,vr=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),u=vr(1),le=vr(2),Da=vr(3),X=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),yi=new WeakMap,ne=oe.createTreeWalker(oe,129);function Ci(i,e){if(!fr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return bi!==void 0?bi.createHTML(e):e}var Ei=(i,e)=>{let t=i.length-1,r=[],n,o=e===2?"<svg>":e===3?"<math>":"",a=$e;for(let s=0;s<t;s++){let l=i[s],c,d,h=-1,m=0;for(;m<l.length&&(a.lastIndex=m,d=a.exec(l),d!==null);)m=a.lastIndex,a===$e?d[1]==="!--"?a=fi:d[1]!==void 0?a=vi:d[2]!==void 0?(xi.test(d[2])&&(n=RegExp("</"+d[2],"g")),a=ie):d[3]!==void 0&&(a=ie):a===ie?d[0]===">"?(a=n??$e,h=-1):d[1]===void 0?h=-2:(h=a.lastIndex-d[2].length,c=d[1],a=d[3]===void 0?ie:d[3]==='"'?wi:gi):a===wi||a===gi?a=ie:a===fi||a===vi?a=$e:(a=ie,n=void 0);let f=a===ie&&i[s+1].startsWith("/>")?" ":"";o+=a===$e?l+no:h>=0?(r.push(c),l.slice(0,h)+mr+l.slice(h)+Y+f):l+Y+(h===-2?s:f)}return[Ci(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Fe=class i{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let o=0,a=0,s=e.length-1,l=this.parts,[c,d]=Ei(e,t);if(this.el=i.createElement(c,r),ne.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=ne.nextNode())!==null&&l.length<s;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(mr)){let m=d[a++],f=n.getAttribute(h).split(Y),p=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:p[2],strings:f,ctor:p[1]==="."?Tt:p[1]==="?"?Mt:p[1]==="@"?At:se}),n.removeAttribute(h)}else h.startsWith(Y)&&(l.push({type:6,index:o}),n.removeAttribute(h));if(xi.test(n.tagName)){let h=n.textContent.split(Y),m=h.length-1;if(m>0){n.textContent=Ct?Ct.emptyScript:"";for(let f=0;f<m;f++)n.append(h[f],Oe()),ne.nextNode(),l.push({type:2,index:++o});n.append(h[m],Oe())}}}else if(n.nodeType===8)if(n.data===br)l.push({type:2,index:o});else{let h=-1;for(;(h=n.data.indexOf(Y,h+1))!==-1;)l.push({type:7,index:o}),h+=Y.length-1}o++}}static createElement(e,t){let r=oe.createElement("template");return r.innerHTML=e,r}};function ae(i,e,t=i,r){if(e===X)return e;let n=r!==void 0?t._$Co?.[r]:t._$Cl,o=Ie(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),o===void 0?n=void 0:(n=new o(i),n._$AT(i,t,r)),r!==void 0?(t._$Co??=[])[r]=n:t._$Cl=n),n!==void 0&&(e=ae(i,n._$AS(i,e.values),n,r)),e}var Et=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??oe).importNode(t,!0);ne.currentNode=n;let o=ne.nextNode(),a=0,s=0,l=r[0];for(;l!==void 0;){if(a===l.index){let c;l.type===2?c=new be(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new Rt(o,this,e)),this._$AV.push(c),l=r[++s]}a!==l?.index&&(o=ne.nextNode(),a++)}return ne.currentNode=oe,n}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},be=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=ae(this,e,t),Ie(e)?e===b||e==null||e===""?(this._$AH!==b&&this._$AR(),this._$AH=b):e!==this._$AH&&e!==X&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Si(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==b&&Ie(this._$AH)?this._$AA.nextSibling.data=e:this.T(oe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Fe.createElement(Ci(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let o=new Et(n,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=yi.get(e.strings);return t===void 0&&yi.set(e.strings,t=new Fe(e)),t}k(e){fr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let o of e)n===t.length?t.push(r=new i(this.O(Oe()),this.O(Oe()),this,this.options)):r=t[n],r._$AI(o),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=mi(e).nextSibling;mi(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},se=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,o){this.type=1,this._$AH=b,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=b}_$AI(e,t=this,r,n){let o=this.strings,a=!1;if(o===void 0)e=ae(this,e,t,0),a=!Ie(e)||e!==this._$AH&&e!==X,a&&(this._$AH=e);else{let s=e,l,c;for(e=o[0],l=0;l<o.length-1;l++)c=ae(this,s[r+l],t,l),c===X&&(c=this._$AH[l]),a||=!Ie(c)||c!==this._$AH[l],c===b?e=b:e!==b&&(e+=(c??"")+o[l+1]),this._$AH[l]=c}a&&!n&&this.j(e)}j(e){e===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Tt=class extends se{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===b?void 0:e}},Mt=class extends se{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==b)}},At=class extends se{constructor(e,t,r,n,o){super(e,t,r,n,o),this.type=5}_$AI(e,t=this){if((e=ae(this,e,t,0)??b)===X)return;let r=this._$AH,n=e===b&&r!==b||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==b&&(r===b||n);n&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Rt=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){ae(this,e)}},Ti={M:mr,P:Y,A:br,C:1,L:Ei,R:Et,D:Si,V:ae,I:be,H:se,N:Mt,U:At,B:Tt,F:Rt},oo=pr.litHtmlPolyfillSupport;oo?.(Fe,be),(pr.litHtmlVersions??=[]).push("3.3.3");var Mi=(i,e,t)=>{let r=t?.renderBefore??e,n=r._$litPart$;if(n===void 0){let o=t?.renderBefore??null;r._$litPart$=n=new be(e.insertBefore(Oe(),o),o,void 0,t??{})}return n._$AI(i),n};var gr=globalThis,g=class extends H{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Mi(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}};g._$litElement$=!0,g.finalized=!0,gr.litElementHydrateSupport?.({LitElement:g});var ao=gr.litElementPolyfillSupport;ao?.({LitElement:g});(gr.litElementVersions??=[]).push("4.2.2");import*as V from"d3";var de=i=>{if(i===0)return"0 b/s";let e=Math.abs(i),t=["b/s","Kb/s","Mb/s","Gb/s"],r=0,n=e;for(;n>=1e3&&r<t.length-1;)n/=1e3,r+=1;return`${r===0?n:n.toFixed(1)} ${t[r]}`},Lt=i=>{if(!Number.isFinite(i)||i<=0)return 5e3;let e=String(Math.floor(i)).length-1,t=Math.pow(10,e),r=Math.ceil(i/t)*t;return Math.max(r,5e3)},Q=i=>{let e=new Date(i),t=r=>String(r).padStart(2,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`},kt=i=>`${Math.round(i)}%`,_t=i=>Number.isFinite(i)&&i>0?i:100,so=["accent","success","warning","muted"],Pt=i=>so.includes(i)?i:"accent",He=i=>i.flatMap(e=>!Number.isFinite(e.value)||e.time!==void 0&&!Number.isFinite(e.time)?[]:e.time===void 0?[{value:e.value}]:[{time:e.time,value:e.value}]),z=i=>i.filter(e=>Number.isFinite(e.time)&&Number.isFinite(e.value)),Ai=i=>{let e=[],t=[];for(let r of i){if(!Number.isFinite(r.time)||!Number.isFinite(r.value)){t.length>0&&(e.push(t),t=[]);continue}t.push(r)}return t.length>0&&e.push(t),e},Ri=(i,e)=>{if(e!==void 0&&Number.isFinite(e.start)&&Number.isFinite(e.end)&&e.start<e.end)return{start:e.start,end:e.end};let t=z(i);return t.length===0?null:{start:Math.min(...t.map(r=>r.time)),end:Math.max(...t.map(r=>r.time))}},fe=(i,e,t)=>{let r=He(i);if(r.length===0)return null;let o=r.every(l=>l.time!==void 0)?r.reduce((l,c)=>l.time===void 0||c.time===void 0?l:c.time>l.time?c:l):r[r.length-1],a=Math.min(...r.map(l=>l.value)),s=Math.max(...r.map(l=>l.value));return o===void 0?null:`${e}: latest ${t(o.value)}; range ${t(a)} to ${t(s)}`},Li=(i,e,t=de,r)=>{let n=i.map(a=>fe(a.data,a.label??a.id,t)).filter(a=>a!==null);return n.length===0?e:`${r===void 0?"Chart. ":`Chart. ${r}: `}${n.join("; ")}`},ki=(i,e,t,r=de)=>fe(i,e,r)??t;var ve=class{constructor(e,t){this.host=e;this.onResize=t;e.addController(this)}plotElement=null;disposePlot=null;resizeObserver=null;observedContainer=null;hostConnected(){this.host.setAttribute("role","img"),this.host.requestUpdate()}hostDisconnected(){this.disconnectPlot(),this.resizeObserver!==null&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.observedContainer=null}setPlot(e,t){this.disconnectPlot(),this.plotElement=e,this.disposePlot=t}observeContainer(e){typeof ResizeObserver>"u"||(this.resizeObserver===null&&(this.resizeObserver=new ResizeObserver(t=>{let r=t[0];this.onResize(r===void 0?void 0:{width:r.contentRect.width,height:r.contentRect.height})})),this.observedContainer!==e&&(this.observedContainer!==null&&this.resizeObserver.unobserve(this.observedContainer),this.resizeObserver.observe(e),this.observedContainer=e))}disconnectPlot(){this.disposePlot!==null&&(this.disposePlot(),this.disposePlot=null),this.plotElement=null}};var Dt=v`
|
|
4
|
-
:host {
|
|
5
|
-
display: block;
|
|
6
|
-
width: 100%;
|
|
7
|
-
height: 100%;
|
|
8
|
-
min-width: 0;
|
|
9
|
-
min-height: 0;
|
|
10
|
-
color: var(--mndw-text);
|
|
11
|
-
font-family: inherit;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.container {
|
|
15
|
-
position: relative;
|
|
16
|
-
width: 100%;
|
|
17
|
-
height: 100%;
|
|
18
|
-
min-height: 7.5rem;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
svg {
|
|
22
|
-
display: block;
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: 100%;
|
|
25
|
-
overflow: visible;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.empty {
|
|
29
|
-
display: grid;
|
|
30
|
-
height: 100%;
|
|
31
|
-
min-height: 7.5rem;
|
|
32
|
-
place-items: center;
|
|
33
|
-
color: var(--mndw-text-subtle);
|
|
34
|
-
text-align: center;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.tooltip {
|
|
38
|
-
position: absolute;
|
|
39
|
-
z-index: 1;
|
|
40
|
-
display: none;
|
|
41
|
-
padding: 0.25rem 0.5rem;
|
|
42
|
-
border: 1px solid var(--mndw-border);
|
|
43
|
-
border-radius: 0.25rem;
|
|
44
|
-
background: var(--mndw-surface-raised);
|
|
45
|
-
color: var(--mndw-text);
|
|
46
|
-
font-size: 0.6875rem;
|
|
47
|
-
line-height: 1.4;
|
|
48
|
-
pointer-events: none;
|
|
49
|
-
white-space: nowrap;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.tooltip[data-visible] {
|
|
53
|
-
display: block;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
[part='grid'] .tick line {
|
|
57
|
-
stroke: var(--mndw-border);
|
|
58
|
-
stroke-dasharray: 4, 4;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[part='grid'] .domain,
|
|
62
|
-
[part='axis'] .domain {
|
|
63
|
-
display: none;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
[part='grid'] text,
|
|
67
|
-
[part='axis'] text {
|
|
68
|
-
fill: var(--mndw-text-subtle);
|
|
69
|
-
}
|
|
70
|
-
`,lo=i=>i===null?"":`left: ${i.left}px; top: ${i.top}px;`,Nt=i=>u`
|
|
71
|
-
<div class="container" part="container">
|
|
72
|
-
${i.hasContent?u`<svg part="plot" aria-hidden="true"></svg>`:u`<div class="empty" part="empty">${i.emptyLabel}</div>`}
|
|
73
|
-
<div
|
|
74
|
-
class="tooltip"
|
|
75
|
-
part="tooltip"
|
|
76
|
-
?data-visible=${i.tooltip!==null}
|
|
77
|
-
style=${lo(i.tooltip)}
|
|
78
|
-
>
|
|
79
|
-
${i.tooltip===null?"":i.tooltipBody}
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
`;var _i={select:{placeholder:"Select\u2026",validation:{required:"Please select an option."},overlay:{title:"Select option"}},overlay:{close:"Close"},chart:{empty:"No data available",values:"Values"},input:{password:{show:"Show password",hide:"Hide password"}},checkbox:{validation:{required:"Please select this option."}},segmented:{validation:{required:"Please select an option."}},table:{selectRow:"Select {rowName}",selectAll:"Select all",sortBy:"Sort by {column}",columnMenu:"Column menu",rowFallback:"Row {index}",reordered:"{rowName} moved to position {pos} of {total}",invalidData:"Table data is invalid"}};var Pi={select:{placeholder:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026",validation:{required:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442."},overlay:{title:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442"}},overlay:{close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C"},chart:{empty:"\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445",values:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u044F"},input:{password:{show:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C",hide:"\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"}},checkbox:{validation:{required:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u044D\u0442\u043E\u0442 \u0432\u0430\u0440\u0438\u0430\u043D\u0442."}},segmented:{validation:{required:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442."}},table:{selectRow:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C {rowName}",selectAll:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435",sortBy:"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E {column}",columnMenu:"\u041C\u0435\u043D\u044E \u0441\u0442\u043E\u043B\u0431\u0446\u043E\u0432",rowFallback:"\u0421\u0442\u0440\u043E\u043A\u0430 {index}",reordered:"{rowName} \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0430 \u043D\u0430 \u043F\u043E\u0437\u0438\u0446\u0438\u044E {pos} \u0438\u0437 {total}",invalidData:"\u0414\u0430\u043D\u043D\u044B\u0435 \u0442\u0430\u0431\u043B\u0438\u0446\u044B \u043D\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B"}};var $t={en:_i,ru:Pi},Ot="en",wr=new Set;function ho(i){try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(i)[0]??"en";if(typeof Intl.Locale=="function")return new Intl.Locale(i).toString()}catch{}return"en"}function po(i){let e=i==="en-XA"?"en":ho(i);if($t[e]!==void 0)return e;let t=e.split("-")[0];return $t[t]!==void 0?t:"en"}function yr(i){let e=po(i);if(e!==Ot){Ot=e;for(let t of wr)t()}}function mo(){return Ot}function w(i){return Di($t[Ot],i)??Di($t.en,i)??i}function Di(i,e){let t=i;for(let r of e.split(".")){if(typeof t!="object"||t===void 0)return;t=t[r]}return typeof t=="string"?t:void 0}function Sr(i){return wr.add(i),()=>{wr.delete(i)}}var k=class{constructor(e,t={}){this.host=e;this.options=t;e.addController(this)}unsubscribe=null;hostConnected(){this.options.applyLocale?.(),this.unsubscribe=Sr(()=>{this.options.applyLocale?.(),this.host.requestUpdate()})}hostDisconnected(){this.unsubscribe?.(),this.unsubscribe=null}};var xr=new WeakMap,Ni=new WeakMap;function bo(i,e){let t=Object.getPrototypeOf(i);for(;t!==null;){let r=Object.getOwnPropertyDescriptor(t,e);if(r!==void 0)return{prototype:t,descriptor:r};t=Object.getPrototypeOf(t)}}function fo(i,e){return xr.get(i)?.get(e)}function vo(i,e){let t=Ni.get(i.prototype);t?.has(e)||(t===void 0&&(t=new Map,Ni.set(i.prototype,t)),t.set(e,i.descriptor),Object.defineProperty(i.prototype,e,{configurable:i.descriptor.configurable,enumerable:i.descriptor.enumerable,get:function(){return i.descriptor.get?.call(this)},set:function(r){let n=fo(this,e);n!==void 0&&!n.internal&&(n.dirty=!0),i.descriptor.set?.call(this,r)}}))}function $i(i,e,t){let r=!1,n=i.setAttribute.bind(i),o=i.removeAttribute.bind(i),a=i.toggleAttribute.bind(i);return Object.defineProperty(i,"setAttribute",{configurable:!0,value:(s,l)=>{s===e&&!r&&t(),n(s,l)}}),Object.defineProperty(i,"removeAttribute",{configurable:!0,value:s=>{s===e&&!r&&t(),o(s)}}),Object.defineProperty(i,"toggleAttribute",{configurable:!0,value:(s,l)=>(s===e&&!r&&t(),a(s,l))}),s=>{r=!0;try{s()}finally{r=!1}}}function D(i,e,t=e){let r=bo(i,e);if(r?.descriptor.set===void 0||r.descriptor.get===void 0)throw new Error(`Property ${e} has no accessor on ${i.localName}`);vo(r,e);let n={dirty:i.hasAttribute(t),internal:!1},o=xr.get(i)??new Map;o.set(e,n),xr.set(i,o);let a=$i(i,t,()=>{n.dirty=!0});return{get dirty(){return n.dirty},setGenerated(s){n.dirty||a(()=>{n.internal=!0;try{r.descriptor.set?.call(i,s)}finally{n.internal=!1}})}}}function J(i,e){let t=i.hasAttribute(e),r=$i(i,e,()=>{t=!0});return{get dirty(){return t},setGenerated(n){t||r(()=>{n===null?i.removeAttribute(e):i.setAttribute(e,n)})}}}var Cr="mndw-bar-chart",Ve=class extends g{static shadowRootOptions={mode:"open"};static properties={points:{attribute:!1},emptyLabel:{type:String,attribute:"empty-label"},valueLabel:{type:String,attribute:"value-label"},valueFormatter:{attribute:!1},timeFormatter:{attribute:!1},color:{type:String,reflect:!0}};static styles=[Dt,v`
|
|
83
|
-
[part='hover-band'] {
|
|
84
|
-
fill: color-mix(in srgb, var(--mndw-text) 12%, transparent);
|
|
85
|
-
opacity: 0;
|
|
86
|
-
pointer-events: none;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
[part='hover-band'][data-active] {
|
|
90
|
-
opacity: 1;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.tooltip {
|
|
94
|
-
min-width: 6.25rem;
|
|
95
|
-
}
|
|
96
|
-
`];tooltipState=null;emptyLabelState;valueLabelState;ariaLabelState;localeController=new k(this,{applyLocale:()=>{this.applyLocale()}});frame=new ve(this,e=>{this.drawChart(e)});constructor(){super(),this.points=[],this.valueFormatter=de,this.timeFormatter=Q,this.color="accent",this.emptyLabelState=D(this,"emptyLabel","empty-label"),this.valueLabelState=D(this,"valueLabel","value-label"),this.ariaLabelState=J(this,"aria-label")}render(){let e=z(this.points).length>0;return Nt({hasContent:e,emptyLabel:this.emptyLabel??w("chart.empty"),tooltip:this.tooltipState,tooltipBody:this.tooltipState===null?"":u`
|
|
97
|
-
<div>${this.tooltipState.time}</div>
|
|
98
|
-
<div>${this.valueLabel??w("chart.values")}: <strong>${this.tooltipState.value}</strong></div>
|
|
99
|
-
`})}willUpdate(e){(e.has("points")||e.has("emptyLabel")||e.has("valueLabel")||e.has("valueFormatter")||e.has("timeFormatter")||e.has("color"))&&(this.tooltipState=null)}updated(e){(e.has("points")||e.has("emptyLabel")||e.has("valueLabel")||e.has("valueFormatter")||e.has("timeFormatter")||e.has("color")||this.frame.plotElement===null)&&(this.updateAccessibilityLabel(),this.drawChart())}updateAccessibilityLabel(){this.ariaLabelState.setGenerated(ki(this.points,this.valueLabel??w("chart.values"),this.emptyLabel??w("chart.empty"),this.valueFormatter))}applyLocale(){this.emptyLabelState.setGenerated(w("chart.empty")),this.valueLabelState.setGenerated(w("chart.values"))}drawChart(e){let t=this.renderRoot.querySelector(".container");if(t===null)return;this.frame.observeContainer(t),this.frame.disconnectPlot();let r=this.tooltipState!==null;this.tooltipState=null,r&&this.requestUpdate();let n=t.querySelector("svg"),o=z(this.points).sort((x,A)=>x.time-A.time);if(n===null||o.length===0)return;let a=t.getBoundingClientRect(),s=e?.width||a.width||400,l=e?.height||a.height||200,c=s<300,d=c?{top:15,right:10,bottom:25,left:50}:{top:20,right:15,bottom:30,left:60},h=Math.max(s-d.left-d.right,50),m=Math.max(l-d.top-d.bottom,50),f=Math.max(...o.map(x=>x.value),1),p=Lt(f),S=V.scaleBand().domain(o.map((x,A)=>String(A))).range([0,h]).padding(.15),E=V.scaleLinear().domain([0,p]).range([m,0]),R=V.select(n).attr("width",s).attr("height",l);R.selectAll("*").remove();let T=R.append("g").attr("transform",`translate(${d.left}, ${d.top})`);T.append("g").attr("part","grid").call(V.axisLeft(E).ticks(3).tickSize(-h).tickFormat(()=>"")).select(".domain").remove();let vt=c?9:10,gt=T.append("g").attr("part","axis").call(V.axisLeft(E).ticks(3).tickFormat(x=>this.valueFormatter(x.valueOf())));gt.selectAll("text").attr("font-size",vt),gt.select(".domain").remove();let nr=Pt(this.color),wt=T.append("rect").attr("part","hover-band").attr("y",0).attr("height",m);for(let[x,A]of o.entries()){let N=S(String(x))??0;T.append("rect").attr("data-bar","true").attr("data-color",nr).attr("x",N).attr("y",E(A.value)).attr("width",S.bandwidth()).attr("height",E(0)-E(A.value)).style("fill",`var(--mndw-${nr})`)}let or=Math.min(o.length,5),Re=Math.max(Math.ceil(o.length/or),1),F=[];for(let x=0;x<o.length&&F.length<or;x+=Re)F.push(x);F[F.length-1]!==o.length-1&&o.length>1&&(F[F.length-1]=o.length-1),T.append("g").attr("part","axis").attr("transform",`translate(0, ${m})`).selectAll("text").data(F).enter().append("text").attr("x",x=>(S(String(x))??0)+S.bandwidth()/2).attr("dy","1.2em").style("text-anchor","middle").attr("font-size",vt-1).text(x=>{let A=o[x];return A===void 0?"":this.timeFormatter(A.time)});let Le=T.append("rect").attr("width",h).attr("height",m).attr("fill","transparent").style("cursor","crosshair"),y=x=>{let A=T.node();if(A===null)return;let[N,q]=V.pointer(x,A);if(N<0||N>h||q<0||q>m){wt.attr("data-active",null),this.tooltipState=null,this.requestUpdate();return}let j=S.step(),ke=S(String(0))??0,sr=(j-S.bandwidth())/2,_e=Math.min(Math.max(Math.floor((N-ke+sr)/j),0),o.length-1),me=o[_e];if(me===void 0)return;let Yn=S(String(_e))??0,ai=j,si=Math.max(0,Yn-(ai-S.bandwidth())/2);wt.attr("x",si).attr("width",Math.min(ai,h-si)).attr("data-active","");let lr=N+d.left+8,Pe=q-30;lr+120>s&&(lr=N+d.left-128),Pe<0&&(Pe=0),Pe+50>l&&(Pe=Math.max(0,l-50)),this.tooltipState={left:lr,top:Pe,time:this.timeFormatter(me.time),value:this.valueFormatter(me.value)},this.requestUpdate()};Le.on("mousemove.chart",y),Le.on("mouseleave.chart",()=>{wt.attr("data-active",null),this.tooltipState=null,this.requestUpdate()}),this.frame.setPlot(n,()=>{Le.on(".chart",null)})}};var Tr="mndw-heat-strip",ge=[{at:10,token:"var(--mndw-util-low)"},{at:25,token:"var(--mndw-util-moderate)"},{at:40,token:"var(--mndw-util-elevated)"},{at:55,token:"var(--mndw-util-high)"},{at:70,token:"var(--mndw-util-critical)"}],Oi=ge[0],Er=ge[ge.length-1],Ii=10,go=(i,e,t)=>{let r=Math.min(Math.max(e,0),Math.max(t,0))/2,n=r,o=Math.max(n,t-r);return Math.min(Math.max(i,n),o)},wo=(i,e)=>Number.isFinite(i)?Math.min(Math.max(i,0),e):0,yo=i=>Math.min(100,Math.floor(i/Ii)*Ii),So=i=>{if(i<=Oi.at)return Oi.token;if(i>=Er.at)return Er.token;for(let e=0;e<ge.length-1;e+=1){let t=ge[e],r=ge[e+1];if(i<=r.at){let n=Math.round((r.at-i)/(r.at-t.at)*100);return`color-mix(in srgb, ${t.token} ${n}%, ${r.token})`}}return Er.token},ze=class extends g{static shadowRootOptions={mode:"open"};static properties={points:{attribute:!1},max:{type:Number},emptyLabel:{type:String,attribute:"empty-label"},valueLabel:{type:String,attribute:"value-label"},valueFormatter:{attribute:!1},timeFormatter:{attribute:!1}};static styles=v`
|
|
100
|
-
:host {
|
|
101
|
-
display: block;
|
|
102
|
-
width: 100%;
|
|
103
|
-
color: var(--mndw-text);
|
|
104
|
-
font-family: inherit;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.plot {
|
|
108
|
-
position: relative;
|
|
109
|
-
width: 100%;
|
|
110
|
-
height: var(--mndw-heat-strip-height);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
svg {
|
|
114
|
-
display: block;
|
|
115
|
-
width: 100%;
|
|
116
|
-
height: 100%;
|
|
117
|
-
border-radius: var(--mndw-radius-sm);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.empty {
|
|
121
|
-
display: grid;
|
|
122
|
-
height: var(--mndw-heat-strip-height);
|
|
123
|
-
place-items: center;
|
|
124
|
-
border: 1px solid var(--mndw-border);
|
|
125
|
-
border-radius: var(--mndw-radius-sm);
|
|
126
|
-
color: var(--mndw-text-subtle);
|
|
127
|
-
font-size: 0.6875rem;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.axis {
|
|
131
|
-
display: flex;
|
|
132
|
-
justify-content: space-between;
|
|
133
|
-
margin-top: 0.125rem;
|
|
134
|
-
color: var(--mndw-text-subtle);
|
|
135
|
-
font-size: 0.625rem;
|
|
136
|
-
font-variant-numeric: tabular-nums;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.tooltip {
|
|
140
|
-
position: absolute;
|
|
141
|
-
bottom: calc(100% + 0.125rem);
|
|
142
|
-
transform: translateX(-50%);
|
|
143
|
-
padding: 0.0625rem 0.3125rem;
|
|
144
|
-
border: 1px solid var(--mndw-border);
|
|
145
|
-
border-radius: 0.1875rem;
|
|
146
|
-
background: var(--mndw-surface-raised);
|
|
147
|
-
color: var(--mndw-text);
|
|
148
|
-
font-size: 0.6875rem;
|
|
149
|
-
font-variant-numeric: tabular-nums;
|
|
150
|
-
max-width: calc(100% - 0.5rem);
|
|
151
|
-
white-space: normal;
|
|
152
|
-
overflow-wrap: anywhere;
|
|
153
|
-
pointer-events: none;
|
|
154
|
-
}
|
|
155
|
-
`;hoverIndex=null;emptyLabelState;valueLabelState;ariaLabelState;localeController=new k(this,{applyLocale:()=>{this.applyLocale()}});constructor(){super(),this.points=[],this.max=100,this.emptyLabel=void 0,this.valueLabel=void 0,this.valueFormatter=kt,this.timeFormatter=Q,this.emptyLabelState=D(this,"emptyLabel","empty-label"),this.valueLabelState=D(this,"valueLabel","value-label"),this.ariaLabelState=J(this,"aria-label")}connectedCallback(){super.connectedCallback(),this.setAttribute("role","img")}updated(){this.ariaLabelState.setGenerated(this.computeAriaLabel()),this.positionTooltip()}positionTooltip(){let e=this.shadowRoot?.querySelector(".plot"),t=this.shadowRoot?.querySelector('[part="tooltip"]');if(e==null||t===null||t===void 0)return;let r=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(r.width<=0||n.width<=0)return;let o=Number.parseFloat(t.style.left),a=Number.isFinite(o)?o/100*r.width:r.width/2,s=go(a,n.width,r.width);t.style.left=`${s}px`}render(){let e=this.samples();if(e.length===0)return u`
|
|
156
|
-
<div class="container" part="container">
|
|
157
|
-
<div class="empty" part="empty">${this.emptyLabel??w("chart.empty")}</div>
|
|
158
|
-
</div>
|
|
159
|
-
`;let t=this.tooltipState(e);return u`
|
|
160
|
-
<div class="container" part="container">
|
|
161
|
-
<div class="plot" part="plot">
|
|
162
|
-
<svg
|
|
163
|
-
part="plot"
|
|
164
|
-
viewBox="0 0 ${e.length} 1"
|
|
165
|
-
preserveAspectRatio="none"
|
|
166
|
-
aria-hidden="true"
|
|
167
|
-
@pointermove=${this.onPointerMove}
|
|
168
|
-
@pointerleave=${this.onPointerLeave}
|
|
169
|
-
>
|
|
170
|
-
${e.map((r,n)=>this.renderSlice(r.value,n))}
|
|
171
|
-
${this.hoverIndex===null?b:le`
|
|
172
|
-
<rect
|
|
173
|
-
part="hover-cell"
|
|
174
|
-
fill="color-mix(in srgb, var(--mndw-text) 22%, transparent)"
|
|
175
|
-
pointer-events="none"
|
|
176
|
-
x=${this.hoverIndex}
|
|
177
|
-
y="0"
|
|
178
|
-
width="1.02"
|
|
179
|
-
height="1"
|
|
180
|
-
></rect>
|
|
181
|
-
`}
|
|
182
|
-
</svg>
|
|
183
|
-
${t===null?"":u`
|
|
184
|
-
<div class="tooltip" part="tooltip" style="left: ${t.left}%">${t.time===null?"":u`${t.time} · `}${this.valueFormatter(t.value)}</div>
|
|
185
|
-
`}
|
|
186
|
-
</div>
|
|
187
|
-
${this.renderAxis(e)}
|
|
188
|
-
</div>
|
|
189
|
-
`}renderAxis(e){if(e.length===0||!e.every(n=>n.time!==void 0))return"";let t=e[0]?.time,r=e[e.length-1]?.time;return t===void 0||r===void 0||!Number.isFinite(t)||!Number.isFinite(r)?"":u`
|
|
190
|
-
<div class="axis" part="axis" aria-hidden="true">
|
|
191
|
-
<span>${this.timeFormatter(t)}</span>
|
|
192
|
-
<span>${this.timeFormatter(r)}</span>
|
|
193
|
-
</div>
|
|
194
|
-
`}renderSlice(e,t){let r=_t(this.max),n=wo(e,r),o=yo(n/r*100);return le`
|
|
195
|
-
<rect
|
|
196
|
-
class="slice"
|
|
197
|
-
style=${`fill: ${So(o)}`}
|
|
198
|
-
?data-active=${t===this.hoverIndex}
|
|
199
|
-
x=${t}
|
|
200
|
-
y="0"
|
|
201
|
-
width="1.02"
|
|
202
|
-
height="1"
|
|
203
|
-
></rect>
|
|
204
|
-
`}tooltipState(e){if(this.hoverIndex===null||this.hoverIndex<0||this.hoverIndex>=e.length)return null;let t=e[this.hoverIndex];return t===void 0?null:{left:(this.hoverIndex+.5)/e.length*100,value:t.value,time:t.time===void 0?null:this.timeFormatter(t.time)}}onPointerMove=e=>{let t=this.samples();if(t.length===0)return;let n=e.currentTarget.getBoundingClientRect();if(n.width<=0)return;let o=(e.clientX-n.left)/n.width,a=Math.min(t.length-1,Math.max(0,Math.floor(o*t.length)));a!==this.hoverIndex&&(this.hoverIndex=a,this.requestUpdate())};onPointerLeave=()=>{this.hoverIndex!==null&&(this.hoverIndex=null,this.requestUpdate())};samples(){return He(this.points)}computeAriaLabel(){return fe(this.samples(),this.valueLabel??w("chart.values"),this.valueFormatter)??this.emptyLabel??w("chart.empty")}applyLocale(){this.emptyLabelState.setGenerated(w("chart.empty")),this.valueLabelState.setGenerated(w("chart.values"))}};import*as _ from"d3";var Mr="mndw-line-chart",Fi=i=>`var(--mndw-${i})`,xo=(i,e)=>{let t=e.getBoundingClientRect();return[i.clientX-t.left,i.clientY-t.top]},Ue=class extends g{static shadowRootOptions={mode:"open"};static properties={series:{attribute:!1},bands:{attribute:!1},domain:{attribute:!1},valueDomain:{attribute:!1},emptyLabel:{type:String,attribute:"empty-label"},valueLabel:{type:String,attribute:"value-label"},valueFormatter:{attribute:!1},timeFormatter:{attribute:!1}};static styles=[Dt,v`
|
|
205
|
-
.tooltip {
|
|
206
|
-
min-width: 7.5rem;
|
|
207
|
-
}
|
|
208
|
-
`];tooltipState=null;lastPointerPosition=null;emptyLabelState;valueLabelState;ariaLabelState;localeController=new k(this,{applyLocale:()=>{this.applyLocale()}});frame=new ve(this,e=>{this.drawChart(e)});constructor(){super(),this.series=[],this.bands=[],this.domain=void 0,this.valueFormatter=de,this.timeFormatter=Q,this.emptyLabelState=D(this,"emptyLabel","empty-label"),this.valueLabelState=D(this,"valueLabel","value-label"),this.ariaLabelState=J(this,"aria-label")}render(){let e=this.series.some(t=>z(t.data).length>0)||this.bands.some(t=>t.data.length>0);return Nt({hasContent:e,emptyLabel:this.emptyLabel??w("chart.empty"),tooltip:this.tooltipState,tooltipBody:this.tooltipState===null?"":u`
|
|
209
|
-
<div>${this.tooltipState.time}</div>
|
|
210
|
-
${this.tooltipState.values.map(t=>u`<div>${t.label}: <strong>${t.value}</strong></div>`)}
|
|
211
|
-
`})}willUpdate(e){if(e.has("series")||e.has("bands")||e.has("domain")||e.has("valueDomain")||e.has("emptyLabel")||e.has("valueLabel")||e.has("valueFormatter")||e.has("timeFormatter")){let t=this.series.some(r=>z(r.data).length>0)||this.bands.some(r=>r.data.length>0);(this.lastPointerPosition===null||!t)&&(this.tooltipState=null),t||(this.lastPointerPosition=null)}}updated(e){(e.has("series")||e.has("bands")||e.has("domain")||e.has("valueDomain")||e.has("emptyLabel")||e.has("valueLabel")||e.has("valueFormatter")||e.has("timeFormatter")||this.frame.plotElement===null)&&(this.updateAccessibilityLabel(),this.drawChart())}disconnectedCallback(){this.lastPointerPosition=null,super.disconnectedCallback()}updateAccessibilityLabel(){this.ariaLabelState.setGenerated(Li(this.series,this.emptyLabel??w("chart.empty"),this.valueFormatter,this.valueLabelState.dirty?this.valueLabel:void 0))}applyLocale(){this.emptyLabelState.setGenerated(w("chart.empty")),this.valueLabelState.setGenerated(w("chart.values"))}drawChart(e){let t=this.renderRoot.querySelector(".container");if(t===null)return;this.frame.observeContainer(t),this.frame.disconnectPlot();let r=t.querySelector("svg"),n=this.series.filter(y=>z(y.data).length>0),o=this.bands.filter(y=>y.data.length>0);if(r===null||n.length===0&&o.length===0)return;let a=t.getBoundingClientRect(),s=e?.width||a.width||400,l=e?.height||a.height||200,c=s<400,d=c?{top:6,right:40,bottom:22,left:58}:{top:10,right:60,bottom:30,left:72},h=n.length>0?n.flatMap(y=>z(y.data)):o.flatMap(y=>y.data.map(x=>({time:x.time,value:x.max}))),m=Ri(h,this.domain);if(m===null)return;let f=Math.max(...h.map(y=>y.value),1),p=this.valueDomain?.min??0,S=this.valueDomain?.max??Lt(f),E=_.scaleTime().domain([new Date(m.start),new Date(m.end)]).range([d.left,Math.max(s-d.right,d.left+1)]),R=_.scaleLinear().domain([p,S]).range([Math.max(l-d.bottom,d.top+1),d.top]),T=c?Math.max(8,Math.min(11,Math.floor(s/50))):Math.max(10,Math.min(13,Math.floor(s/50))),O=_.select(r).attr("width",s).attr("height",l);O.selectAll("*").remove();let vt=_.line().x(y=>E(y.time)).y(y=>R(y.value)).curve(_.curveMonotoneX),gt=_.area().x(y=>E(y.time)).y0(R(p)).y1(y=>R(y.value)).curve(_.curveMonotoneX);for(let y of n){let x=Fi(y.color),A=y.segments?.map(N=>z(N.data))??Ai(y.data);for(let N of A.filter(q=>q.length>0))y.fill&&O.append("path").attr("data-color",y.color).style("fill",`color-mix(in srgb, ${x} 15%, transparent)`).attr("d",gt(N)),O.append("path").attr("data-color",y.color).style("fill","none").style("stroke",x).attr("stroke-width",2).attr("d",vt(N))}for(let y of o){let x=_.area().x(A=>E(A.time)).y0(A=>R(A.min)).y1(A=>R(A.max)).curve(_.curveMonotoneX);O.append("path").attr("data-band",y.id).style("fill",`color-mix(in srgb, ${Fi(y.color)} 15%, transparent)`).attr("d",x(y.data))}O.append("g").attr("part","grid").attr("transform",`translate(${d.left}, 0)`).call(_.axisLeft(R).ticks(c?2:4).tickFormat(()=>"").tickSize(-(s-d.left-d.right))).selectAll("text").attr("font-size",T),O.append("g").attr("part","axis").attr("transform",`translate(${d.left}, 0)`).call(_.axisLeft(R).ticks(c?2:4).tickFormat(y=>y.valueOf()===0?"":this.valueFormatter(y.valueOf()))).selectAll("text").attr("font-size",T),O.append("g").attr("part","axis").attr("transform",`translate(0, ${l-d.bottom})`).call(_.axisBottom(E).tickValues(E.domain()).tickFormat(y=>{let x=y instanceof Date?y.getTime():y.valueOf();return this.timeFormatter(x)})).selectAll("text").attr("font-size",T);let Re=O.append("rect").attr("x",d.left).attr("y",d.top).attr("width",Math.max(s-d.left-d.right,1)).attr("height",Math.max(l-d.top-d.bottom,1)).attr("fill","transparent").style("cursor","crosshair"),F=O.append("line").style("stroke","var(--mndw-text-subtle)").attr("pointer-events","none").attr("stroke-width",1).attr("stroke-dasharray","2,2").attr("y1",d.top).attr("y2",l-d.bottom).style("display","none"),ar=(y,x)=>{if(y<d.left||y>s-d.right||x<d.top||x>l-d.bottom){this.lastPointerPosition=null,F.style("display","none"),this.tooltipState=null,this.requestUpdate();return}this.lastPointerPosition=[y,x];let A=E.invert(y),N=n.map(ke=>{let sr=ke.data.reduce((_e,me)=>Math.abs(me.time-A.getTime())<Math.abs(_e.time-A.getTime())?me:_e);return{label:ke.label??ke.id,value:this.valueFormatter(sr.value)}});F.style("display",null).attr("x1",y).attr("x2",y);let q=y+12,j=x-30;q+140>s&&(q=y-152),j<d.top&&(j=d.top+4),j+60>l-d.bottom&&(j=Math.max(d.top,l-d.bottom-64)),this.tooltipState={left:q,top:j,time:this.timeFormatter(A.getTime()),values:N},this.requestUpdate()},Le=y=>{let[x,A]=xo(y,r);ar(x,A)};Re.on("mousemove.chart",Le),Re.on("mouseleave.chart",()=>{this.lastPointerPosition=null,F.style("display","none"),this.tooltipState=null,this.requestUpdate()}),this.frame.setPlot(r,()=>{Re.on(".chart",null)}),this.lastPointerPosition!==null&&ar(...this.lastPointerPosition)}};function Hi(i,e,t,r,n){if(i.length===0||t<=0||r<=0||!(e>0))return[];let o=t/i.length,a=Math.max(1,o-n);return i.map((s,l)=>{let c=Math.min(Math.max(Number.isFinite(s)?s:0,0),e),d=Math.max(1,c/e*r);return{value:s,left:l*o,top:r-d,width:a,height:d}})}function Vi(i,e,t){if(t===0||e<=0)return null;let r=Math.floor(i/e*t);return Math.min(t-1,Math.max(0,r))}var Ar="mndw-sparkline",It=28,Co=1,Eo=240,To=i=>`var(--mndw-${i})`,Be=class extends g{static shadowRootOptions={mode:"open"};static properties={points:{attribute:!1},timeDomain:{attribute:!1},max:{type:Number},color:{type:String},emptyLabel:{type:String,attribute:"empty-label"},valueLabel:{type:String,attribute:"value-label"},valueFormatter:{attribute:!1},timeFormatter:{attribute:!1}};static styles=v`
|
|
212
|
-
:host {
|
|
213
|
-
display: block;
|
|
214
|
-
width: 100%;
|
|
215
|
-
height: 100%;
|
|
216
|
-
color: var(--mndw-text);
|
|
217
|
-
font-family: inherit;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.container {
|
|
221
|
-
display: flex;
|
|
222
|
-
flex-direction: column;
|
|
223
|
-
width: 100%;
|
|
224
|
-
height: 100%;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.plot {
|
|
228
|
-
position: relative;
|
|
229
|
-
flex: 1 1 auto;
|
|
230
|
-
width: 100%;
|
|
231
|
-
min-height: 1.75rem;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
svg {
|
|
235
|
-
display: block;
|
|
236
|
-
width: 100%;
|
|
237
|
-
height: 100%;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.bar {
|
|
241
|
-
fill: var(--spark-fill, var(--mndw-accent));
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.bar[data-active] {
|
|
245
|
-
fill: var(--mndw-text);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.frame {
|
|
249
|
-
stroke: var(--mndw-border);
|
|
250
|
-
stroke-width: 1;
|
|
251
|
-
stroke-dasharray: 2 2;
|
|
252
|
-
vector-effect: non-scaling-stroke;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.empty {
|
|
256
|
-
display: grid;
|
|
257
|
-
flex: 1 1 auto;
|
|
258
|
-
min-height: 1.75rem;
|
|
259
|
-
place-items: center;
|
|
260
|
-
color: var(--mndw-text-subtle);
|
|
261
|
-
font-size: 0.6875rem;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.axis {
|
|
265
|
-
display: flex;
|
|
266
|
-
justify-content: space-between;
|
|
267
|
-
margin-top: 0.125rem;
|
|
268
|
-
color: var(--mndw-text-subtle);
|
|
269
|
-
font-size: 0.625rem;
|
|
270
|
-
font-variant-numeric: tabular-nums;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.tooltip {
|
|
274
|
-
position: absolute;
|
|
275
|
-
bottom: calc(100% + 0.125rem);
|
|
276
|
-
transform: translateX(-50%);
|
|
277
|
-
padding: 0.0625rem 0.3125rem;
|
|
278
|
-
border: 1px solid var(--mndw-border);
|
|
279
|
-
border-radius: 0.1875rem;
|
|
280
|
-
background: var(--mndw-surface-raised);
|
|
281
|
-
color: var(--mndw-text);
|
|
282
|
-
font-size: 0.6875rem;
|
|
283
|
-
font-variant-numeric: tabular-nums;
|
|
284
|
-
white-space: nowrap;
|
|
285
|
-
pointer-events: none;
|
|
286
|
-
}
|
|
287
|
-
`;hoverIndex=null;chartWidth=0;resizeObserver=null;emptyLabelState;valueLabelState;ariaLabelState;localeController=new k(this,{applyLocale:()=>{this.applyLocale()}});constructor(){super(),this.points=[],this.timeDomain=void 0,this.max=100,this.color="accent",this.emptyLabel=void 0,this.valueLabel=void 0,this.valueFormatter=kt,this.timeFormatter=Q,this.emptyLabelState=D(this,"emptyLabel","empty-label"),this.valueLabelState=D(this,"valueLabel","value-label"),this.ariaLabelState=J(this,"aria-label")}connectedCallback(){super.connectedCallback(),this.setAttribute("role","img"),this.observeSize()}disconnectedCallback(){this.resizeObserver?.disconnect(),this.resizeObserver=null,super.disconnectedCallback()}updated(){this.ariaLabelState.setGenerated(this.computeAriaLabel())}render(){if(this.samples().length===0)return u`
|
|
288
|
-
<div class="container" part="container">
|
|
289
|
-
<div class="empty" part="empty">${this.emptyLabel??w("chart.empty")}</div>
|
|
290
|
-
</div>
|
|
291
|
-
`;let t=this.layoutSamples(),r=this.plotWidth(),n=Hi(t.map(s=>s.value),_t(this.max),r,It,Co),o=this.tooltipState(n,t,r),a=Pt(this.color);return u`
|
|
292
|
-
<div class="container" part="container">
|
|
293
|
-
<div class="plot" style=${`--spark-fill: ${To(a)}`}>
|
|
294
|
-
<svg
|
|
295
|
-
part="plot"
|
|
296
|
-
viewBox="0 0 ${r} ${It}"
|
|
297
|
-
preserveAspectRatio="none"
|
|
298
|
-
aria-hidden="true"
|
|
299
|
-
@pointermove=${this.onPointerMove}
|
|
300
|
-
@pointerleave=${this.onPointerLeave}
|
|
301
|
-
>
|
|
302
|
-
${n.map((s,l)=>this.renderBar(s,l))}
|
|
303
|
-
<line class="frame" x1="0" x2=${r} y1="0.5" y2="0.5"></line>
|
|
304
|
-
<line class="frame" x1="0" x2=${r} y1=${It-.5} y2=${It-.5}></line>
|
|
305
|
-
</svg>
|
|
306
|
-
${o===null?"":u`
|
|
307
|
-
<div class="tooltip" part="tooltip" style="left: ${o.left}px">${o.time===null?"":u`${o.time} · `}${this.valueFormatter(o.value)}</div>
|
|
308
|
-
`}
|
|
309
|
-
</div>
|
|
310
|
-
${this.renderAxis(t)}
|
|
311
|
-
</div>
|
|
312
|
-
`}renderBar(e,t){return Number.isFinite(e.value)?le`
|
|
313
|
-
<rect
|
|
314
|
-
class="bar"
|
|
315
|
-
?data-active=${t===this.hoverIndex}
|
|
316
|
-
x=${e.left}
|
|
317
|
-
y=${e.top}
|
|
318
|
-
width=${e.width}
|
|
319
|
-
height=${e.height}
|
|
320
|
-
></rect>
|
|
321
|
-
`:""}renderAxis(e){if(!e.every(n=>n.time!==void 0))return"";let t=this.timeDomain?.start??e[0]?.time,r=this.timeDomain?.end??e[e.length-1]?.time;return t==null||!Number.isFinite(t)||r===null||r===void 0||!Number.isFinite(r)||t>r?"":u`
|
|
322
|
-
<div class="axis" part="axis" aria-hidden="true">
|
|
323
|
-
<span>${this.timeFormatter(t)}</span>
|
|
324
|
-
<span>${this.timeFormatter(r)}</span>
|
|
325
|
-
</div>
|
|
326
|
-
`}tooltipState(e,t,r){if(this.hoverIndex===null||this.hoverIndex<0||this.hoverIndex>=e.length)return null;let n=e[this.hoverIndex],o=t[this.hoverIndex];return o===void 0||!Number.isFinite(o.value)?null:{left:(n.left+n.width/2)/r*(this.chartWidth||r),value:o.value,time:o.time===void 0?null:this.timeFormatter(o.time)}}onPointerMove=e=>{let t=this.layoutSamples();if(t.length===0)return;let n=e.currentTarget.getBoundingClientRect(),o=Vi(e.clientX-n.left,n.width,t.length);o!==this.hoverIndex&&(this.hoverIndex=o,this.requestUpdate())};onPointerLeave=()=>{this.hoverIndex!==null&&(this.hoverIndex=null,this.requestUpdate())};observeSize(){typeof ResizeObserver>"u"||this.resizeObserver!==null||(this.resizeObserver=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;t!==this.chartWidth&&(this.chartWidth=t,this.requestUpdate())}),this.resizeObserver.observe(this))}plotWidth(){return this.chartWidth>0?this.chartWidth:Eo}samples(){return He(this.points)}layoutSamples(){return this.timeDomain===void 0?this.samples():this.points.flatMap(e=>e.time===void 0||!Number.isFinite(e.time)?[]:[{time:e.time,value:e.value}])}computeAriaLabel(){return fe(this.samples(),this.valueLabel??w("chart.values"),this.valueFormatter)??this.emptyLabel??w("chart.empty")}applyLocale(){this.emptyLabelState.setGenerated(w("chart.empty")),this.valueLabelState.setGenerated(w("chart.values"))}};var zi=0,U=class{host;baseId;generatedIds=new Map;constructor(e){this.host=e,this.baseId=`mndw-${e.localName}-${zi}`,zi+=1}sync(e,t=null){let r=new Set,n=e.map((o,a)=>{if(o.id===""){let s=this.generatedIds.get(o);if(s!==void 0)o.id=s;else{let l=a;for(;r.has(`${this.baseId}-label-${l}`);)l+=1;let c=`${this.baseId}-label-${l}`;this.generatedIds.set(o,c),o.id=c}}return r.add(o.id),o.id});n.length===0?this.host.removeAttribute("aria-labelledby"):this.host.setAttribute("aria-labelledby",n.join(" ")),t!==null&&(t.ariaLabelledByElements=Array.from(e))}},P=class{internals;host;options;fieldsetDisabled=!1;initialAttributes=null;constructor(e,t){this.host=e,this.options=t,this.internals=typeof e.attachInternals=="function"?e.attachInternals():null}get form(){return this.internals?.form??null}get labels(){let e=this.internals?.labels;return e?Array.from(e):[]}get effectiveDisabled(){return this.options.isExplicitlyDisabled()||this.fieldsetDisabled}captureInitialAttributes(e){this.initialAttributes||(this.initialAttributes=new Map(e.map(t=>[t,this.host.getAttribute(t)])))}restoreInitialAttributes(){if(this.initialAttributes)for(let[e,t]of this.initialAttributes)t===null?this.host.removeAttribute(e):this.host.setAttribute(e,t)}formDisabledCallback(e){this.fieldsetDisabled=e,this.options.onDisabledChange?.(this.effectiveDisabled)}formResetCallback(){this.restoreInitialAttributes(),this.options.onReset()}formStateRestoreCallback(e,t){this.options.onStateRestore(e,t)}setFormValue(e,t){this.internals&&(t===void 0?this.internals.setFormValue(e):this.internals.setFormValue(e,t))}setValidity(e,t=""){this.internals&&(Object.keys(e).length===0?this.internals.setValidity({}):this.internals.setValidity(e,t))}clearValidity(){this.setValidity({})}};var L=v`
|
|
327
|
-
outline: var(--mndw-focus-w) solid var(--mndw-focus-ring);
|
|
328
|
-
outline-offset: 0.0625rem;
|
|
329
|
-
`,we=v`
|
|
330
|
-
border-color: var(--mndw-text-subtle);
|
|
331
|
-
`,$=v`
|
|
332
|
-
background: var(--mndw-surface-hover);
|
|
333
|
-
`,ye=v`
|
|
334
|
-
background: var(--mndw-control-hover);
|
|
335
|
-
`,ee=v`
|
|
336
|
-
border-color: var(--mndw-accent-hover);
|
|
337
|
-
background: var(--mndw-accent-hover);
|
|
338
|
-
`,te=v`
|
|
339
|
-
color: var(--mndw-text);
|
|
340
|
-
`,B=v`
|
|
341
|
-
box-sizing: border-box;
|
|
342
|
-
min-height: var(--mndw-control-h);
|
|
343
|
-
padding: 0 var(--mndw-space-3);
|
|
344
|
-
border-radius: var(--mndw-radius-md);
|
|
345
|
-
font-family: inherit;
|
|
346
|
-
font-size: inherit;
|
|
347
|
-
line-height: var(--mndw-leading);
|
|
348
|
-
`,C=v`
|
|
349
|
-
font-family: var(--mndw-font-sans);
|
|
350
|
-
font-size: var(--mndw-text-sm);
|
|
351
|
-
`;var Rr="mndw-button",Ge=class extends g{static formAssociated=!0;static shadowRootOptions={mode:"open",delegatesFocus:!0};static properties={variant:{type:String,reflect:!0},disabled:{type:Boolean,reflect:!0},type:{type:String},ariaLabel:{type:String,attribute:"aria-label"}};static styles=v`
|
|
352
|
-
:host {
|
|
353
|
-
${C}
|
|
354
|
-
|
|
355
|
-
display: inline-block;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
:host([disabled]) {
|
|
359
|
-
pointer-events: none;
|
|
360
|
-
opacity: 0.5;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
button {
|
|
364
|
-
${B}
|
|
365
|
-
|
|
366
|
-
display: inline-flex;
|
|
367
|
-
gap: var(--mndw-space-2);
|
|
368
|
-
align-items: center;
|
|
369
|
-
justify-content: center;
|
|
370
|
-
border: 1px solid transparent;
|
|
371
|
-
font-weight: var(--mndw-weight-semibold);
|
|
372
|
-
cursor: pointer;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
button:focus-visible {
|
|
376
|
-
${L}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
:host([variant='primary']) button {
|
|
380
|
-
border-color: var(--mndw-accent);
|
|
381
|
-
background: var(--mndw-accent);
|
|
382
|
-
color: var(--mndw-accent-contrast);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
:host([variant='primary']) button:not(:disabled):hover {
|
|
386
|
-
${ee}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
:host([variant='secondary']) button {
|
|
390
|
-
border-color: var(--mndw-border);
|
|
391
|
-
background: var(--mndw-surface-raised);
|
|
392
|
-
color: var(--mndw-text);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
:host([variant='secondary']) button:not(:disabled):hover {
|
|
396
|
-
${$}
|
|
397
|
-
border-color: var(--mndw-text-subtle);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
:host([variant='ghost']) button {
|
|
401
|
-
background: transparent;
|
|
402
|
-
color: var(--mndw-text-subtle);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
:host([variant='ghost']) button:not(:disabled):hover {
|
|
406
|
-
${ye}
|
|
407
|
-
${te}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/*
|
|
411
|
-
* A tint, not a solid fill: the palette models danger as a foreground and emits no
|
|
412
|
-
* dangerContrast pair, so filling the button with it would be an unvalidated combination.
|
|
413
|
-
*/
|
|
414
|
-
:host([variant='danger']) button {
|
|
415
|
-
border-color: var(--mndw-danger);
|
|
416
|
-
background: var(--mndw-danger-bg);
|
|
417
|
-
color: var(--mndw-danger);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
:host([variant='danger']) button:not(:disabled):hover {
|
|
421
|
-
background: color-mix(in srgb, var(--mndw-danger) 12%, var(--mndw-danger-bg));
|
|
422
|
-
}
|
|
423
|
-
`;formState=new P(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>{},onStateRestore:()=>{},onDisabledChange:()=>{this.requestUpdate()}});constructor(){super(),this.variant="secondary",this.disabled=!1,this.type="button",this.ariaLabel="",this.addEventListener("click",this.onClick)}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}render(){return u`
|
|
424
|
-
<button
|
|
425
|
-
part="button"
|
|
426
|
-
type="button"
|
|
427
|
-
aria-label=${this.ariaLabel||b}
|
|
428
|
-
?disabled=${this.formState.effectiveDisabled}
|
|
429
|
-
>
|
|
430
|
-
<slot></slot>
|
|
431
|
-
</button>
|
|
432
|
-
`}updated(){let e=this.renderRoot.querySelector("button");e&&(e.disabled=this.formState.effectiveDisabled)}onClick=e=>{if(this.formState.effectiveDisabled){e.preventDefault();return}let t=this.formState.form;t&&(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())}};var Ht="mndw-field",Ft="mndwlabelchange";function ce(i){i.dispatchEvent(new Event(Ft,{bubbles:!0,composed:!0}))}var Mo=new Set(["button","input","meter","output","progress","select","textarea"]),Ao=/\s+/u,Ui=0;function Lr(i){let e=i.getRootNode();return typeof e.querySelectorAll=="function"?e:null}function Bi(i,e){return(i.getAttribute(e)??"").split(Ao).filter(t=>t!=="")}var We=class extends H{static properties={label:{type:String},hint:{type:String},error:{type:String},required:{type:Boolean,reflect:!0}};fieldId;observer;ownedTokens=new Map;ownedAttributes=new Map;ownedNodes=null;control=null;ownsControlId=!1;constructor(){super(),Ui+=1,this.fieldId=`mndw-field-${Ui}`,this.label="",this.hint="",this.error="",this.required=!1,this.observer=new MutationObserver(this.onMutations)}connectedCallback(){super.connectedCallback(),this.ownedNodes??=this.createOwnedNodes(),this.classList.add("mndw-field"),this.addEventListener(Ft,this.onLabelChange),this.observe(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(Ft,this.onLabelChange),this.observer.disconnect(),this.releaseControl()}createRenderRoot(){return this}updated(){this.wire()}createOwnedNodes(){let e=document.createElement("label"),t=document.createTextNode(""),r=document.createElement("span"),n=document.createElement("div"),o=document.createElement("div");return e.className="mndw-field__label",e.id=`${this.fieldId}-label`,r.className="mndw-field__required",r.setAttribute("aria-hidden","true"),r.textContent=" *",r.hidden=!0,e.append(t,r),n.className="mndw-field__hint",n.id=`${this.fieldId}-hint`,n.hidden=!0,o.className="mndw-field__error",o.id=`${this.fieldId}-error`,o.setAttribute("role","alert"),o.hidden=!0,{label:e,text:t,marker:r,hint:n,error:o}}wire(){let e=this.ownedNodes;if(!e||!this.isConnected)return;this.placeOwnedNodes(e);let t=this.resolveControl(e);t!==this.control&&(this.releaseControl(),this.control=t,this.observe());let r=this.label.trim()!==""&&(t===null||!this.hasOwnLabel(t,e));if(e.text.textContent=this.label,e.marker.hidden=!this.required,e.label.hidden=!r,e.hint.textContent=this.hint,e.hint.hidden=this.hint==="",e.error.textContent=this.error,e.error.hidden=this.error==="",!t){e.label.removeAttribute("for");return}this.syncControlId(t),this.syncLabelAssociation(t,e,r),this.syncDescriptions(t,e),this.syncStates(t)}placeOwnedNodes(e){this.firstChild!==e.label&&this.insertBefore(e.label,this.firstChild),this.lastChild!==e.error&&this.appendChild(e.error),e.error.previousSibling!==e.hint&&this.insertBefore(e.hint,e.error)}resolveControl(e){for(let t of this.childNodes)if(t.nodeType===Node.ELEMENT_NODE&&!this.isOwnedNode(t,e))return t;return null}syncControlId(e){let t=`${this.fieldId}-control`;e.id===""?(e.id=t,this.ownsControlId=!0):e.id!==t&&(this.ownsControlId=!1)}syncLabelAssociation(e,t,r){if(r&&this.isLabelable(e)){let a=t.label.htmlFor;t.label.htmlFor=e.id;let s=this.syncTokens(e,"aria-labelledby",[]);(a!==t.label.htmlFor||s)&&this.refreshAccessibleName(e);return}let n=t.label.hasAttribute("for");t.label.removeAttribute("for");let o=this.syncTokens(e,"aria-labelledby",r?[t.label.id]:[]);(n||o)&&this.refreshAccessibleName(e)}refreshAccessibleName(e){e.refreshAccessibleName?.call(e)}syncDescriptions(e,t){let r=[];this.hint!==""&&r.push(t.hint.id),this.error!==""&&r.push(t.error.id),this.syncTokens(e,"aria-describedby",r)}syncStates(e){this.error!==""?this.setOwnedAttribute(e,"aria-invalid","true"):this.clearOwnedAttribute(e,"aria-invalid"),this.required?this.setOwnedAttribute(e,"required",""):this.clearOwnedAttribute(e,"required")}syncTokens(e,t,r){let n=this.ownedTokens.get(t)??new Set,o=Bi(e,t).filter(c=>!n.has(c)),a=[...o,...r.filter(c=>!o.includes(c))];if(r.length===0?this.ownedTokens.delete(t):this.ownedTokens.set(t,new Set(r)),a.length===0){let c=e.hasAttribute(t);return e.removeAttribute(t),c}let s=a.join(" "),l=e.getAttribute(t)!==s;return l&&e.setAttribute(t,s),l}setOwnedAttribute(e,t,r){this.ownedAttributes.has(t)||this.ownedAttributes.set(t,e.getAttribute(t)),e.getAttribute(t)!==r&&e.setAttribute(t,r)}clearOwnedAttribute(e,t){if(!this.ownedAttributes.has(t))return;let r=this.ownedAttributes.get(t)??null;this.ownedAttributes.delete(t),r===null?e.removeAttribute(t):e.setAttribute(t,r)}releaseControl(){let e=this.control;if(e){for(let t of[...this.ownedTokens.keys()])this.syncTokens(e,t,[]);for(let t of[...this.ownedAttributes.keys()])this.clearOwnedAttribute(e,t);this.ownsControlId&&e.id===`${this.fieldId}-control`&&e.removeAttribute("id"),this.ownedNodes?.label.removeAttribute("for"),this.ownsControlId=!1,this.control=null}}hasOwnLabel(e,t){return(e.getAttribute("aria-label")??"").trim()!==""||this.hasResolvedLabelledBy(e,t)||this.associatedLabels(e,t).length>0?!0:this.hasControlLabelSource(e)}hasResolvedLabelledBy(e,t){let r=Lr(e);if(!r)return!1;let n=[...r.querySelectorAll("[id]")];return Bi(e,"aria-labelledby").some(a=>n.some(s=>s.id===a&&s!==t.label))}associatedLabels(e,t){let r=Lr(e);return r?[...r.querySelectorAll("label")].filter(n=>n!==t.label&&this.labelsControl(n,e)):[]}labelsControl(e,t){return e.control===t?!0:e.control===null&&e.htmlFor!==""&&e.htmlFor===t.id&&this.isLabelable(t)}hasControlLabelSource(e){let t=e.constructor.mndwLabelSource;if(t==="label-property"){let r=e.label;return typeof r=="string"&&r.trim()!==""}return t==="slot"?(e.textContent??"").trim()!=="":!1}isLabelable(e){return Mo.has(e.localName)?e.localName!=="input"||e.getAttribute("type")!=="hidden":e.constructor.formAssociated===!0}isOwnedNode(e,t){return e===t.label||e===t.hint||e===t.error||t.label.contains(e)||t.hint.contains(e)||t.error.contains(e)}observe(){if(!this.isConnected)return;this.observer.disconnect(),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0});let e=this.control;if(!e)return;this.observer.observe(e,{attributes:!0,attributeFilter:["id","aria-label","aria-labelledby"]});let t=Lr(e);t&&this.observer.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["for"]})}onMutations=e=>{let t=this.ownedNodes;if(!t)return;e.some(n=>this.isRelevantMutation(n,t))&&this.requestUpdate()};isRelevantMutation(e,t){return this.isOwnedNode(e.target,t)||this.isInAnotherField(e.target)?!1:e.type!=="childList"?!0:[...e.addedNodes,...e.removedNodes].some(n=>!this.isOwnedNode(n,t)&&!this.isInAnotherField(n))}isInAnotherField(e){let r=(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(Ht);return r!=null&&r!==this}onLabelChange=()=>{this.requestUpdate()}};var kr="mndw-checkbox",Ke=class extends g{static formAssociated=!0;static mndwLabelSource="slot";static properties={checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},name:{type:String,reflect:!0}};static styles=v`
|
|
433
|
-
:host {
|
|
434
|
-
${C}
|
|
435
|
-
|
|
436
|
-
display: inline-flex;
|
|
437
|
-
align-items: center;
|
|
438
|
-
gap: var(--mndw-space-2);
|
|
439
|
-
color: var(--mndw-text);
|
|
440
|
-
cursor: pointer;
|
|
441
|
-
user-select: none;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
:host([disabled]) {
|
|
445
|
-
color: var(--mndw-text-muted);
|
|
446
|
-
cursor: not-allowed;
|
|
447
|
-
opacity: 0.65;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
[part='label'] {
|
|
451
|
-
cursor: pointer;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
:host([disabled]) [part='label'] {
|
|
455
|
-
cursor: not-allowed;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
[part='box'] {
|
|
459
|
-
position: relative;
|
|
460
|
-
display: inline-grid;
|
|
461
|
-
width: 1.125rem;
|
|
462
|
-
height: 1.125rem;
|
|
463
|
-
place-items: center;
|
|
464
|
-
border: 1px solid var(--mndw-border);
|
|
465
|
-
border-radius: var(--mndw-radius-sm);
|
|
466
|
-
background: var(--mndw-surface);
|
|
467
|
-
color: var(--mndw-accent-contrast);
|
|
468
|
-
flex: 0 0 auto;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
:host([checked]) [part='box'],
|
|
472
|
-
:host([indeterminate]) [part='box'] {
|
|
473
|
-
border-color: var(--mndw-accent);
|
|
474
|
-
background: var(--mndw-accent);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
:host(:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='box'] {
|
|
478
|
-
${$}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
:host([checked]:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='box'],
|
|
482
|
-
:host([indeterminate]:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='box'] {
|
|
483
|
-
${ee}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
[part='mark'] {
|
|
487
|
-
position: absolute;
|
|
488
|
-
top: 50%;
|
|
489
|
-
left: 50%;
|
|
490
|
-
transform: translate(-50%, -50%);
|
|
491
|
-
display: block;
|
|
492
|
-
visibility: hidden;
|
|
493
|
-
font-size: var(--mndw-text-md);
|
|
494
|
-
font-weight: var(--mndw-weight-semibold);
|
|
495
|
-
line-height: 1;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
:host([checked]:not([indeterminate])) [part='mark'] {
|
|
499
|
-
visibility: visible;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
:host([indeterminate]) [part='mark'] {
|
|
503
|
-
visibility: visible;
|
|
504
|
-
width: 0.5625rem;
|
|
505
|
-
height: 0.125rem;
|
|
506
|
-
background: currentColor;
|
|
507
|
-
font-size: 0;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
:host(:focus-visible) {
|
|
511
|
-
outline: none;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
:host(:focus-visible) [part='box'] {
|
|
515
|
-
${L}
|
|
516
|
-
}
|
|
517
|
-
`;formState=new P(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});labelController=new U(this);labelObserver;labelSlot=null;localeController=new k(this);constructor(){super(),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this.required=!1,this.invalid=!1,this.value="on",this.name="",this.labelObserver=new MutationObserver(()=>{ce(this)}),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["checked"]),this.labelObserver.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){this.labelObserver.disconnect(),this.labelSlot?.removeEventListener("slotchange",this.onLabelSlotChange),this.labelSlot=null,super.disconnectedCallback()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}render(){return u`
|
|
518
|
-
<div
|
|
519
|
-
part="box"
|
|
520
|
-
aria-hidden="true"
|
|
521
|
-
>
|
|
522
|
-
<span part="mark"><mndw-icon name="check"></mndw-icon></span>
|
|
523
|
-
</div>
|
|
524
|
-
<slot part="label"></slot>
|
|
525
|
-
`}updated(){let e=this.shadowRoot?.querySelector('slot[part="label"]')??null;e!==this.labelSlot&&(this.labelSlot?.removeEventListener("slotchange",this.onLabelSlotChange),e?.addEventListener("slotchange",this.onLabelSlotChange),this.labelSlot=e);let t=this.indeterminate?"mixed":String(this.checked),r=this.formState.effectiveDisabled;this.setAttribute("role","checkbox"),this.setAttribute("aria-checked",t),this.setAttribute("aria-disabled",String(r)),this.setAttribute("aria-required",String(this.required)),this.tabIndex=r?-1:0;let n=this.formState.labels;this.labelController.sync(n,this.formState.internals),this.formState.internals?.setFormValue(this.checked?this.value:null,this.indeterminate?"indeterminate":this.checked?"checked":"unchecked"),this.formState.internals&&(this.formState.internals.role="checkbox",this.formState.internals.ariaChecked=t,this.formState.internals.ariaDisabled=String(r),this.formState.internals.ariaRequired=String(this.required),this.checked?this.formState.internals.states.add("checked"):this.formState.internals.states.delete("checked")),this.required&&!this.checked?this.formState.setValidity({valueMissing:!0},w("checkbox.validation.required")):this.formState.clearValidity();let o=this.invalid||this.required&&!this.checked||this.formState.internals?.validity?.valid===!1;this.setAttribute("aria-invalid",String(o)),this.formState.internals&&(this.formState.internals.ariaInvalid=String(o))}onLabelSlotChange=()=>{ce(this)};handleClick=e=>{if(this.formState.effectiveDisabled){e.preventDefault();return}this.toggle()};handleKeyDown=e=>{this.formState.effectiveDisabled||e.key!==" "&&e.key!=="Enter"||(e.preventDefault(),this.toggle())};toggle(){this.indeterminate=!1,this.checked=!this.checked,this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{checked:this.checked,indeterminate:this.indeterminate}}))}resetForm=()=>{this.checked=this.hasAttribute("checked"),this.indeterminate=!1};restoreFormState=e=>{typeof e=="string"&&(e==="checked"?(this.checked=!0,this.indeterminate=!1):e==="unchecked"?(this.checked=!1,this.indeterminate=!1):e==="indeterminate"&&(this.checked=!1,this.indeterminate=!0))}};var Gi=["activity","arrow-down","arrow-left","arrow-right","arrow-up","arrow-up-down","check","chevron-down","chevron-left","chevron-right","chevron-up","circle-alert","circle-arrow-up","circle-question-mark","circle-x","copy","download","ellipsis","ellipsis-vertical","eye","eye-off","info","log-out","menu","minus","moon","pencil","plus","refresh-cw","search","settings","sun","trash","unlink","x"],Ro=new Set(Gi);function Wi(i){return Ro.has(i)}var Ki=Symbol.for("mndw.ui.iconSprite"),qi=globalThis;function _r(){let i=qi[Ki];if(i!==void 0)return i;let e={url:"",listeners:new Set};return qi[Ki]=e,e}function ji(){return _r().url}function Yi(i){if(i.includes("#"))throw new Error(`iconSpriteUrl must not contain a fragment reference: "${i}"`);let e=_r();if(i!==e.url){e.url=i;for(let t of[...e.listeners])t()}}function Pr(i){let e=_r().listeners;return e.add(i),()=>{e.delete(i)}}var Dr="mndw-icon",Lo="0 0 24 24";function Xi(i){let e=ji();return e===""?"":`${e}#mndw-icon-${i}`}var qe=class extends g{static properties={name:{type:String,reflect:!0},label:{type:String,reflect:!0}};static styles=v`
|
|
526
|
-
:host {
|
|
527
|
-
display: inline-block;
|
|
528
|
-
width: 1em;
|
|
529
|
-
height: 1em;
|
|
530
|
-
flex: none;
|
|
531
|
-
vertical-align: -0.125em;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
svg {
|
|
535
|
-
display: block;
|
|
536
|
-
width: 100%;
|
|
537
|
-
height: 100%;
|
|
538
|
-
}
|
|
539
|
-
`;constructor(){super(),this.name="",this.label=""}_unsubscribe=null;_onSpriteUrlChange=()=>{this.requestUpdate()};connectedCallback(){super.connectedCallback(),this._unsubscribe?.(),this._unsubscribe=Pr(this._onSpriteUrlChange),this.requestUpdate()}disconnectedCallback(){this._unsubscribe?.(),this._unsubscribe=null,super.disconnectedCallback()}render(){let e=this._href(),t=this.label!=="";return u`
|
|
540
|
-
<svg
|
|
541
|
-
part="svg"
|
|
542
|
-
viewBox=${Lo}
|
|
543
|
-
role="img"
|
|
544
|
-
focusable="false"
|
|
545
|
-
aria-hidden=${t?b:"true"}
|
|
546
|
-
aria-label=${t?this.label:b}
|
|
547
|
-
>
|
|
548
|
-
${e===""?b:le`<use href=${e}></use>`}
|
|
549
|
-
</svg>
|
|
550
|
-
`}_href(){return Wi(this.name)?Xi(this.name):""}};var ko=["id","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-required"],Qi=/\s+/u,_o=/\s+/gu,Po="ariaDescription"in Element.prototype;function Ji(i){let e=i.getRootNode();return typeof e.querySelectorAll=="function"?e:null}function en(i,e){return typeof i.getElementById=="function"?i.getElementById(e):i.querySelector(`[id="${e}"]`)}function I(i,e,t){if(t===""){i.removeAttribute(e);return}i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Nr(i){return(i??"").replace(_o," ").trim()}function $r(i){if(i.nodeType===Node.TEXT_NODE)return i.textContent??"";if(i.nodeType!==Node.ELEMENT_NODE||i.getAttribute("aria-hidden")==="true")return"";let e="";for(let t of i.childNodes)e+=$r(t);return e}function Do(i){return i.map(e=>Nr($r(e))).filter(e=>e!=="").join(" ")}function Zi(i,e){return!i||e===null?"":e.split(Qi).filter(t=>t!=="").map(t=>en(i,t)).filter(t=>t!==null).map(t=>Nr($r(t))).filter(t=>t!=="").join(" ")}function No(i,e,t=Po){return t?i:[i,e].filter(r=>r!=="").join(" ")}function Vt(i){return{badInput:i.badInput,patternMismatch:i.patternMismatch,rangeOverflow:i.rangeOverflow,rangeUnderflow:i.rangeUnderflow,stepMismatch:i.stepMismatch,tooLong:i.tooLong,tooShort:i.tooShort,typeMismatch:i.typeMismatch,valueMissing:i.valueMissing}}var Se=class{host;options;hostObserver;referenceObserver;constructor(e,t){this.host=e,this.options=t,this.hostObserver=new MutationObserver(this.onMutation),this.referenceObserver=new MutationObserver(this.onMutation)}connect(){this.hostObserver.observe(this.host,{attributes:!0,attributeFilter:ko})}disconnect(){this.hostObserver.disconnect(),this.referenceObserver.disconnect()}get hasAriaRequired(){return this.host.getAttribute("aria-required")==="true"}get labels(){let e=this.options.formState.labels;if(e.length>0)return e;let t=Ji(this.host);return!t||this.host.id===""?[]:[...t.querySelectorAll("label")].filter(r=>r.htmlFor===this.host.id)}sync(e){let t=this.labels,r=Ji(this.host),n=this.resolveName(t,r),o=Zi(r,this.host.getAttribute("aria-describedby"));I(e,"aria-label",No(n,o)),I(e,"aria-description",o),I(e,"aria-invalid",this.announcedInvalid()?"true":""),this.observeReferences(t,r)}resolveName(e,t){return this.host.hasAttribute("aria-labelledby")?Zi(t,this.host.getAttribute("aria-labelledby")):this.host.hasAttribute("aria-label")?Nr(this.host.getAttribute("aria-label")):Do(e)}announcedInvalid(){let e=this.host.getAttribute("aria-invalid");return e!==null?e!=="false":this.options.isInvalid()?!0:this.options.formState.internals?.validity.valid===!1}observeReferences(e,t){this.referenceObserver.disconnect();let r=new Set(e);for(let n of["aria-labelledby","aria-describedby"]){let o=this.host.getAttribute(n);if(!(o===null||!t))for(let a of o.split(Qi).filter(s=>s!=="")){let s=en(t,a);s&&r.add(s)}}for(let n of r)this.referenceObserver.observe(n,{childList:!0,subtree:!0,characterData:!0})}onMutation=()=>{this.host.requestUpdate()}},xe=class{onCommit;baseline=null;fromUserInput=!1;constructor(e){this.onCommit=e}captureBaseline(e){this.baseline=e}releaseBaseline(){this.baseline=null}markUserInput(){this.fromUserInput=!0}syncValue(e){if(this.fromUserInput){this.fromUserInput=!1;return}this.baseline!==null&&(this.baseline=e)}commit(e){this.baseline===null||this.baseline===e||(this.baseline=e,this.onCommit(e))}};var Or="mndw-input",tn=["text","password","search","number","url"],je=class extends g{static formAssociated=!0;static shadowRootOptions={mode:"open",delegatesFocus:!0};static properties={value:{type:String},type:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autocomplete:{type:String,reflect:!0},readonly:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},step:{type:Number,reflect:!0},maxlength:{type:Number,reflect:!0}};static styles=v`
|
|
551
|
-
:host {
|
|
552
|
-
${C}
|
|
553
|
-
|
|
554
|
-
display: inline-block;
|
|
555
|
-
width: 100%;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
:host([disabled]) {
|
|
559
|
-
opacity: 0.5;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
[part='field'] {
|
|
563
|
-
${B}
|
|
564
|
-
|
|
565
|
-
display: flex;
|
|
566
|
-
gap: var(--mndw-space-2);
|
|
567
|
-
align-items: center;
|
|
568
|
-
width: 100%;
|
|
569
|
-
border: var(--mndw-border-w) solid var(--mndw-border);
|
|
570
|
-
background: var(--mndw-surface-raised);
|
|
571
|
-
color: var(--mndw-text);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
:host(:not([disabled]):not([readonly]):not([invalid]):not([aria-invalid='true'])) [part='field']:hover {
|
|
575
|
-
${we}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
:host(:focus-within) [part='field'] {
|
|
579
|
-
${L}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
input {
|
|
583
|
-
width: 100%;
|
|
584
|
-
padding: 0;
|
|
585
|
-
border: 0;
|
|
586
|
-
background: none;
|
|
587
|
-
color: inherit;
|
|
588
|
-
font: inherit;
|
|
589
|
-
line-height: var(--mndw-leading);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
input:focus {
|
|
593
|
-
outline: none;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
input::placeholder {
|
|
597
|
-
color: var(--mndw-text-subtle);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
[part='prefix'],
|
|
601
|
-
[part='suffix'] {
|
|
602
|
-
display: inline-flex;
|
|
603
|
-
align-items: center;
|
|
604
|
-
color: var(--mndw-text-subtle);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
[part='prefix'][hidden],
|
|
608
|
-
[part='suffix'][hidden] {
|
|
609
|
-
display: none;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
[part='password-toggle'] {
|
|
613
|
-
display: inline-flex;
|
|
614
|
-
align-items: center;
|
|
615
|
-
justify-content: center;
|
|
616
|
-
flex-shrink: 0;
|
|
617
|
-
padding: var(--mndw-space-1);
|
|
618
|
-
border: 0;
|
|
619
|
-
border-radius: var(--mndw-radius-sm);
|
|
620
|
-
background: none;
|
|
621
|
-
color: var(--mndw-text-subtle);
|
|
622
|
-
cursor: pointer;
|
|
623
|
-
font: inherit;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
:host(:not([disabled]):not([readonly]):not([invalid]):not([aria-invalid='true'])) [part='password-toggle']:hover {
|
|
627
|
-
${te}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
[part='password-toggle'] mndw-icon {
|
|
631
|
-
width: 16px;
|
|
632
|
-
height: 16px;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
:host([disabled]) [part='password-toggle'] {
|
|
636
|
-
pointer-events: none;
|
|
637
|
-
}
|
|
638
|
-
`;formState=new P(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});announcement=new Se(this,{formState:this.formState,isInvalid:()=>this.invalid});commits=new xe(e=>this.emitChange(e));localeController=new k(this);_showPassword=!1;constructor(){super(),this.value="",this.type="text",this.placeholder="",this.autocomplete="",this.readonly=!1,this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.min=null,this.max=null,this.step=null,this.maxlength=null}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"]),this.announcement.connect(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.announcement.disconnect()}refreshAccessibleName(){this.requestUpdate()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}focus(e){this.innerInput?.focus(e)}render(){return u`
|
|
639
|
-
<div part="field">
|
|
640
|
-
<slot name="prefix" part="prefix" @slotchange=${this.onAdornmentSlotChange}></slot>
|
|
641
|
-
<input
|
|
642
|
-
part="input"
|
|
643
|
-
type=${this._effectiveType}
|
|
644
|
-
@input=${this.onInnerInput}
|
|
645
|
-
@focus=${this.onInnerFocus}
|
|
646
|
-
@blur=${this.onInnerBlur}
|
|
647
|
-
@keydown=${this.onInnerKeyDown}
|
|
648
|
-
/>
|
|
649
|
-
${this.type==="password"?this._renderPasswordToggle():b}
|
|
650
|
-
<slot name="suffix" part="suffix" @slotchange=${this.onAdornmentSlotChange}></slot>
|
|
651
|
-
</div>
|
|
652
|
-
`}updated(e){this.syncAdornmentSlots();let t=this.innerInput;t&&(this.syncInner(t),e.has("value")&&this.commits.syncValue(this.value),this.syncFormState(t),this.announcement.sync(t))}syncAdornmentSlots(){let e=this.renderRoot.querySelectorAll('slot[name="prefix"], slot[name="suffix"]');for(let t of e)this.syncAdornmentSlot(t)}syncAdornmentSlot(e){e.hidden=e.assignedNodes().length===0}onAdornmentSlotChange=e=>{let t=e.currentTarget;t&&this.syncAdornmentSlot(t)};get innerInput(){return this.renderRoot.querySelector("input")}get resolvedType(){return tn.includes(this.type)?this.type:"text"}get _effectiveType(){return this.type==="password"&&this._showPassword?"text":this.resolvedType}syncInner(e){I(e,"placeholder",this.placeholder),I(e,"autocomplete",this.autocomplete),I(e,"min",this.min===null?"":String(this.min)),I(e,"max",this.max===null?"":String(this.max)),I(e,"step",this.step===null?"":String(this.step)),I(e,"maxlength",this.maxlength===null?"":String(this.maxlength)),e.toggleAttribute("readonly",this.readonly),e.toggleAttribute("disabled",this.formState.effectiveDisabled),e.toggleAttribute("required",this.required||this.announcement.hasAriaRequired),e.value!==this.value&&(e.value=this.value)}syncFormState(e){this.formState.setFormValue(this.value),this.formState.setValidity(Vt(e.validity),e.validationMessage)}onInnerInput=e=>{this.commits.markUserInput(),this.value=e.target.value,this.dispatchEvent(new CustomEvent("mndwinput",{bubbles:!0,composed:!0,detail:{value:this.value}}))};onInnerFocus=()=>{this.commits.captureBaseline(this.value)};onInnerBlur=()=>{this.commits.commit(this.value),this.commits.releaseBaseline()};onInnerKeyDown=e=>{e.key==="Enter"&&this.commits.commit(this.value)};emitChange(e){this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:e}}))}_onTogglePassword=()=>{this._showPassword=!this._showPassword,this.requestUpdate(),this.updateComplete.then(()=>{this.innerInput?.focus()})};_renderPasswordToggle(){return u`
|
|
653
|
-
<button
|
|
654
|
-
part="password-toggle"
|
|
655
|
-
type="button"
|
|
656
|
-
aria-label=${w(this._showPassword?"input.password.hide":"input.password.show")}
|
|
657
|
-
?disabled=${this.formState.effectiveDisabled}
|
|
658
|
-
@click=${this._onTogglePassword}
|
|
659
|
-
>
|
|
660
|
-
<mndw-icon name=${this._showPassword?"eye-off":"eye"}></mndw-icon>
|
|
661
|
-
</button>
|
|
662
|
-
`}resetForm(){this.value=this.getAttribute("value")??""}restoreFormState(e){typeof e=="string"&&(this.value=e)}};function rn(i){switch(i){case"escape":return"escape";case"outside-click":return"outside";case"host-navigation":case"plugin-unmount":case"replaced":return"detached";default:return"api"}}function nn(i){return{open(e){if(e.presentation==="sheet"){let r=i.open({kind:"drawer",placement:"bottom",title:e.title??w("select.overlay.title"),showCloseButton:!0,closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:!0,restoreFocus:!0,lockScroll:!0,width:"100%",height:"auto",maxHeight:"100dvh",className:["mndw-ui-select-sheet",e.className].filter(Boolean).join(" "),mount(n){n.style.removeProperty("height"),n.style.minHeight="0"}});return{contentElement:r.contentElement,closed:r.closed.then(n=>rn(n.reason)),close:()=>{r.close()},reposition:()=>{}}}let t=i.createLayer({kind:"popover",anchor:{element:e.anchor},placement:"bottom-start",closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:e.trapFocus,restoreFocus:e.restoreFocus,className:e.className});return t.markReady(),{contentElement:t.contentElement,closed:t.closed.then(r=>rn(r.reason)),close:()=>{t.close()},reposition:()=>{t.update({anchor:{element:e.anchor}})}}}}}var $o=600,Oo=8,Io=8,Fo=600,Ho=8,Ir=8,Ut=["bottom-start","top-start","bottom-end","top-end"],Vo=new Set(["right","left","top","bottom"]),zo=new Set(["top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"]);function Uo(i,e=window.innerWidth){return e<=600&&(i==="modal"||i==="drawer")}function Bo(i,e){switch(i){case"modal":return"center";case"drawer":return e&&Vo.has(e)?e:"right";case"popover":return e&&zo.has(e)?e:"bottom-start";case"custom":return e??"center"}}function on(i,e,t){switch(t){case"top-start":return{top:i.top-e.height-8,left:i.left};case"top-end":return{top:i.top-e.height-8,left:i.right-e.width};case"bottom-end":return{top:i.bottom+8,left:i.right-e.width};case"bottom-start":default:return{top:i.bottom+8,left:i.left}}}function an(i,e,t,r){return i>=0&&e>=0&&i+t.height<=r.height&&e+t.width<=r.width}function Fr(i,e,t,r={width:window.innerWidth,height:window.innerHeight}){let n=i.element.getBoundingClientRect(),o=on(n,e,t);if(an(o.top,o.left,e,r))return{...o,placement:t};let a=t===Ut[0]?Ut:[t,...Ut];for(let s of a){let l=on(n,e,s);if(an(l.top,l.left,e,r))return{...l,placement:s}}return{...o,placement:t}}var Go={top:["top","bottom","right","left"],bottom:["bottom","top","right","left"],left:["left","right","bottom","top"],right:["right","left","bottom","top"]};function sn(i,e,t){return Math.max(e,Math.min(i,t))}function ln(i,e,t,r){let n=i.left+(i.width-e.width)/2,o=i.top+(i.height-e.height)/2;switch(t){case"bottom":return{top:i.bottom+r,left:n};case"left":return{top:o,left:i.left-e.width-r};case"right":return{top:o,left:i.right+r};case"top":default:return{top:i.top-e.height-r,left:n}}}function Wo(i,e,t,r,n){switch(t){case"bottom":return i.top+e.height<=r.height-n;case"left":return i.left>=n;case"right":return i.left+e.width<=r.width-n;case"top":default:return i.top>=n}}function Hr(i,e,t,r={width:window.innerWidth,height:window.innerHeight},n=8,o=8){let s=Go[t].find(d=>Wo(ln(i,e,d,n),e,d,r,o))??t,l=ln(i,e,s,n),c=s==="top"||s==="bottom";return{top:c?l.top:sn(l.top,o,Math.max(r.height-o-e.height,o)),left:c?sn(l.left,o,Math.max(r.width-o-e.width,o)):l.left,placement:s}}function Vr(i,e=600){return i<=e?"sheet":"popover"}function zr(i,e,t=8,r=8){let n=t+r,o=Math.max(e.height-i.bottom-n,0),a=Math.max(i.top-n,0);return Math.max(Math.max(o,a),1)}function zt(i){if(i!==void 0)return typeof i=="number"?`${i}px`:i}function Ko(i,e,t=!1){if(t&&(i==="modal"||i==="drawer"))return{width:"100%",height:"auto",maxHeight:"100dvh"};let r=zt(e.width),n=zt(e.height),o=zt(e.maxWidth),a=zt(e.maxHeight);return i==="modal"?{width:r??"min(560px, calc(100vw - 32px))",height:n,maxWidth:o,maxHeight:a??"calc(100vh - 32px)"}:i==="drawer"?{width:r??"min(420px, 100vw)",height:n??"100%",maxWidth:o,maxHeight:a}:{width:r,height:n,maxWidth:o,maxHeight:a}}var qo=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","IFRAME"]),ue=[];function Ce(){let i=document.activeElement;for(;i?.shadowRoot?.activeElement;)i=i.shadowRoot.activeElement;return i}function Ee(i,e){let t=e;for(;t;){if(t===i)return!0;t=t instanceof ShadowRoot?t.host:t.parentNode}return!1}function jo(i){let e=i.getAttribute("contenteditable")?.toLowerCase();if(e!==""&&e!=="true"&&e!=="plaintext-only")return!1;let t=i.parentElement;for(;t;){let r=t.getAttribute("contenteditable")?.toLowerCase();if(r===""||r==="true"||r==="plaintext-only")return!1;if(r==="false")return!0;t=t.parentElement}return!0}function Yo(i){let e=i.getAttribute("tabindex");if(e!==null){let t=Number.parseInt(e,10);return Number.isNaN(t)?-1:t}return i.tagName==="A"?i.hasAttribute("href")?0:-1:jo(i)||qo.has(i.tagName)?0:-1}function Xo(i){if(i.matches(":disabled"))return!0;let e=i.parentElement;for(;e;){if(e instanceof HTMLFieldSetElement&&e.disabled&&![...e.children].find(r=>r instanceof HTMLLegendElement)?.contains(i))return!0;e=e.parentElement}return!1}function Jo(i){return Yo(i)<0||Xo(i)||i instanceof HTMLInputElement&&i.type==="hidden"?!1:typeof i.checkVisibility=="function"?i.checkVisibility():!0}function Zo(i){if(i instanceof HTMLSlotElement){let e=i.assignedNodes({flatten:!0});return e.length>0?e.filter(t=>t instanceof Element):[...i.children]}return i instanceof Element&&i.shadowRoot?[...i.shadowRoot.children]:i instanceof Element||i instanceof ShadowRoot?[...i.children]:[]}function un(i,e){for(let t of Zo(i))t instanceof HTMLElement&&(t.hidden||t.hasAttribute("inert")||(Jo(t)&&e.push(t),un(t,e)))}function Ur(i){let e=[];return un(i,e),e}function hn(i){return i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i}function pn(i){let[e]=Ur(i.container);(e??hn(i.container)).focus()}function dn(i){let e=ue.at(-1);if(!e||i.key!=="Tab"||i.defaultPrevented)return;let t=Ce();if(t&&!Ee(e.container,t)&&e.options.allowFocus?.(t)===!0)return;let r=Ur(e.container);if(i.preventDefault(),r.length===0){hn(e.container).focus();return}let n=t instanceof HTMLElement?r.indexOf(t):-1,o=r.length,a=n===-1?i.shiftKey?o-1:0:(n+(i.shiftKey?-1:1)+o)%o;r[a]?.focus()}function cn(i){let e=ue.at(-1);if(!e)return;let[t]=i.composedPath();if(!(t instanceof Node))return;if(Ee(e.container,t)){e.lastFocused=t instanceof HTMLElement?t:e.lastFocused;return}if(e.options.allowFocus?.(t)===!0)return;let r=e.lastFocused;r?.isConnected===!0&&Ee(e.container,r)?r.focus():pn(e)}function Bt(i,e={}){let t=Ce(),r={container:i,options:e,lastFocused:null};ue.length===0&&(document.addEventListener("keydown",dn),document.addEventListener("focusin",cn,!0)),ue.push(r);let n=Ce();if(n instanceof HTMLElement&&Ee(i,n)&&(r.lastFocused=n),!n||!Ee(i,n)){let a=e.initialFocus?.()??null;a?a.focus():pn(r)}let o=!0;return{deactivate(){if(!o)return;o=!1;let a=ue.indexOf(r);a!==-1&&ue.splice(a,1),ue.length===0&&(document.removeEventListener("keydown",dn),document.removeEventListener("focusin",cn,!0)),e.restoreFocus!==!1&&t instanceof HTMLElement&&t.isConnected&&t.focus()}}}function Qo(){return{open(i){if(i.presentation==="sheet")return ea(i);let e=document.createElement("div");e.className=i.className??"",e.style.position="fixed",e.style.zIndex="1000",e.style.visibility="hidden",document.body.appendChild(e);let t=d=>{},r=new Promise(d=>{t=d}),n=!1,o=null,a=(d="api")=>{n||(n=!0,o?.deactivate(),o=null,document.removeEventListener("pointerdown",s,!0),document.removeEventListener("keydown",l,!0),window.removeEventListener("resize",c),window.removeEventListener("scroll",c,!0),e.remove(),t(d))};function s(d){let h=d.composedPath();h.includes(e)||h.includes(i.anchor)||a("outside")}function l(d){d.key==="Escape"&&a("escape")}function c(){if(n)return;let d=window.innerHeight,h=window.innerWidth,m=e.offsetHeight,f=e.offsetWidth,p=Fr({element:i.anchor},{width:f,height:m},"bottom-start",{width:h,height:d});e.style.left=`${p.left}px`,e.style.top=`${p.top}px`,e.style.visibility="visible"}return document.addEventListener("pointerdown",s,!0),document.addEventListener("keydown",l,!0),window.addEventListener("resize",c),window.addEventListener("scroll",c,!0),i.trapFocus===!0&&requestAnimationFrame(()=>{n||(o=Bt(e,{restoreFocus:!1,allowFocus:d=>d===i.anchor||i.anchor.contains(d)}))}),{contentElement:e,closed:r,setTitle:()=>{},close:()=>{a("api")},reposition:c}}}}function ea(i){let e=document.createElement("div");e.className=["mndw-ui-sheet-root",i.className].filter(Boolean).join(" "),e.style.position="fixed",e.style.inset="0",e.style.zIndex="1000",e.style.display="flex",e.style.flexDirection="column",e.style.justifyContent="flex-end";let t=document.createElement("div");t.className="mndw-ui-sheet__backdrop",t.style.position="absolute",t.style.inset="0";let r=document.createElement("div");r.className="mndw-ui-sheet",r.setAttribute("role","dialog"),r.style.position="relative",r.style.display="flex",r.style.flexDirection="column",r.style.width="100%",r.style.height="auto",r.style.maxHeight="100dvh",r.style.minHeight="0";let n=document.createElement("header");n.className="mndw-ui-sheet__header",n.style.display="flex",n.style.flexShrink="0",n.style.alignItems="center",n.style.justifyContent="space-between";let o=document.createElement("span");o.textContent=i.title??w("select.overlay.title");let a=document.createElement("button");a.type="button",a.setAttribute("aria-label",w("overlay.close"));let s=document.createElement("mndw-icon");s.setAttribute("name","x"),a.append(s);let l=document.createElement("div");l.className="mndw-ui-sheet__body",l.style.flex="0 1 auto",l.style.display="flex",l.style.flexDirection="column",l.style.minHeight="0",l.style.overflow="hidden";let c=document.createElement("div");c.style.display="flex",c.style.flex="1 1 auto",c.style.flexDirection="column",c.style.minHeight="0",c.style.overflow="hidden";let d=T=>{},h=new Promise(T=>{d=T}),m=!1,f=null,p=(T="api")=>{m||(m=!0,f?.deactivate(),f=null,document.removeEventListener("pointerdown",S,!0),document.removeEventListener("keydown",E,!0),a.removeEventListener("click",R),e.remove(),d(T))};function S(T){T.composedPath().includes(r)||p("outside")}function E(T){T.key==="Escape"&&p("escape")}function R(){p("api")}return l.appendChild(c),n.append(o,a),r.append(n,l),e.append(t,r),document.body.appendChild(e),a.addEventListener("click",R),document.addEventListener("pointerdown",S,!0),document.addEventListener("keydown",E,!0),i.trapFocus!==!1&&requestAnimationFrame(()=>{m||(f=Bt(r,{restoreFocus:!1}))}),{contentElement:c,closed:h,setTitle:T=>{o.textContent=T},close:()=>{p("api")},reposition:()=>{}}}var Br,mn;function bn(i){Br=i}function Gt(){return Br||(mn??=Qo(),mn)}var Xe="mndw-option",Je="mndwoptionchange",Ye=class extends HTMLElement{static observedAttributes=["value","disabled"];observer=null;skipNextTextMutation=!1;get textContent(){return super.textContent}set textContent(e){let t=super.textContent;super.textContent=e,t!==e&&(this.skipNextTextMutation=!0,this.announce())}get value(){return this.getAttribute("value")??""}set value(e){this.setAttribute("value",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}connectedCallback(){if(!this.observer&&typeof MutationObserver<"u"){let e=new MutationObserver(()=>{if(this.skipNextTextMutation){this.skipNextTextMutation=!1;return}this.announce()});typeof e.observe=="function"&&(this.observer=e,e.observe(this,{characterData:!0,childList:!0,subtree:!0}))}}disconnectedCallback(){this.observer?.disconnect()}attributeChangedCallback(e,t,r){t!==r&&this.announce()}announce(){this.dispatchEvent(new CustomEvent(Je,{bubbles:!0,composed:!1}))}};var fn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},vn=i=>(...e)=>({_$litDirective$:i,values:e}),Wt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:ta}=Ti,gn=i=>i;var wn=()=>document.createComment(""),Te=(i,e,t)=>{let r=i._$AA.parentNode,n=e===void 0?i._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(wn(),n),a=r.insertBefore(wn(),n);t=new ta(o,a,i,i.options)}else{let o=t._$AB.nextSibling,a=t._$AM,s=a!==i;if(s){let l;t._$AQ?.(i),t._$AM=i,t._$AP!==void 0&&(l=i._$AU)!==a._$AU&&t._$AP(l)}if(o!==n||s){let l=t._$AA;for(;l!==o;){let c=gn(l).nextSibling;gn(r).insertBefore(l,n),l=c}}}return t},re=(i,e,t=i)=>(i._$AI(e,t),i),ra={},yn=(i,e=ra)=>i._$AH=e,Sn=i=>i._$AH,Kt=i=>{i._$AR(),i._$AA.remove()};var xn=(i,e,t)=>{let r=new Map;for(let n=e;n<=t;n++)r.set(i[n],n);return r},qt=vn(class extends Wt{constructor(i){if(super(i),i.type!==fn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let n=[],o=[],a=0;for(let s of i)n[a]=r?r(s,a):a,o[a]=t(s,a),a++;return{values:o,keys:n}}render(i,e,t){return this.dt(i,e,t).values}update(i,[e,t,r]){let n=Sn(i),{values:o,keys:a}=this.dt(e,t,r);if(!Array.isArray(n))return this.ut=a,o;let s=this.ut??=[],l=[],c,d,h=0,m=n.length-1,f=0,p=o.length-1;for(;h<=m&&f<=p;)if(n[h]===null)h++;else if(n[m]===null)m--;else if(s[h]===a[f])l[f]=re(n[h],o[f]),h++,f++;else if(s[m]===a[p])l[p]=re(n[m],o[p]),m--,p--;else if(s[h]===a[p])l[p]=re(n[h],o[p]),Te(i,l[p+1],n[h]),h++,p--;else if(s[m]===a[f])l[f]=re(n[m],o[f]),Te(i,n[h],n[m]),m--,f++;else if(c===void 0&&(c=xn(a,f,p),d=xn(s,h,m)),c.has(s[h]))if(c.has(s[m])){let S=d.get(a[f]),E=S!==void 0?n[S]:null;if(E===null){let R=Te(i,n[h]);re(R,o[f]),l[f]=R}else l[f]=re(E,o[f]),Te(i,n[h],E),n[S]=null;f++}else Kt(n[m]),m--;else Kt(n[h]),h++;for(;f<=p;){let S=Te(i,l[p+1]);re(S,o[f]),l[f++]=S}for(;h<=m;){let S=n[h++];S!==null&&Kt(S)}return this.ut=a,yn(i,l),X}});var Qe="mndw-select-panel",Ze=class extends g{static properties={options:{type:Array},value:{type:String},label:{type:String},sheet:{type:Boolean,reflect:!0},activeIndex:{type:Number,state:!0}};static styles=v`
|
|
663
|
-
:host {
|
|
664
|
-
${C}
|
|
665
|
-
|
|
666
|
-
box-sizing: border-box;
|
|
667
|
-
display: flex;
|
|
668
|
-
flex: 0 1 auto;
|
|
669
|
-
flex-direction: column;
|
|
670
|
-
min-height: 0;
|
|
671
|
-
width: 100%;
|
|
672
|
-
max-width: 100%;
|
|
673
|
-
overflow: hidden;
|
|
674
|
-
border: var(--mndw-border-w) solid var(--mndw-border);
|
|
675
|
-
border-radius: var(--mndw-radius-md);
|
|
676
|
-
background: var(--mndw-surface-raised);
|
|
677
|
-
box-shadow: var(--mndw-shadow-2);
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
mndw-scroll-area {
|
|
681
|
-
flex: 0 1 auto;
|
|
682
|
-
min-height: 0;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
.listbox {
|
|
686
|
-
padding: var(--mndw-space-1);
|
|
687
|
-
padding-inline-end: calc(var(--mndw-space-1) + var(--mndw-scrollbar-size));
|
|
688
|
-
font-family: inherit;
|
|
689
|
-
font-size: inherit;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
:host([sheet]) {
|
|
693
|
-
display: flex;
|
|
694
|
-
flex-direction: column;
|
|
695
|
-
min-height: 0;
|
|
696
|
-
border: none;
|
|
697
|
-
border-radius: 0;
|
|
698
|
-
box-shadow: none;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
.option {
|
|
702
|
-
display: flex;
|
|
703
|
-
gap: var(--mndw-space-2);
|
|
704
|
-
align-items: center;
|
|
705
|
-
justify-content: space-between;
|
|
706
|
-
padding: var(--mndw-space-2) var(--mndw-space-3);
|
|
707
|
-
border-radius: var(--mndw-radius-sm);
|
|
708
|
-
color: var(--mndw-text);
|
|
709
|
-
cursor: pointer;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
.option:not([aria-disabled='true']):hover {
|
|
713
|
-
${$}
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
.option:focus-visible {
|
|
717
|
-
${L}
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
.option[aria-selected='true'] {
|
|
721
|
-
color: var(--mndw-accent);
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
.option[aria-disabled='true'] {
|
|
725
|
-
color: var(--mndw-text-subtle);
|
|
726
|
-
cursor: not-allowed;
|
|
727
|
-
}
|
|
728
|
-
`;constructor(){super(),this.options=[],this.value="",this.label="",this.sheet=!1,this.activeIndex=-1}focusActive(){this.renderRoot.querySelectorAll('[role="option"]').item(this.activeIndex)?.focus()}willUpdate(e){if(e.has("options")||e.has("value")){let t=this.options.findIndex(r=>r.value===this.value);this.activeIndex=t>=0?t:this.firstEnabledIndex()}}render(){return u`
|
|
729
|
-
<mndw-scroll-area exportparts="viewport,scrollbar,track,thumb">
|
|
730
|
-
<div
|
|
731
|
-
class="listbox"
|
|
732
|
-
part="listbox"
|
|
733
|
-
role="listbox"
|
|
734
|
-
aria-label=${this.label}
|
|
735
|
-
@keydown=${this.onKeydown}
|
|
736
|
-
>
|
|
737
|
-
${qt(this.options,(e,t)=>`${t}:${e.value}`,(e,t)=>{let r=e.labelNodes.length>0?e.labelNodes.map(n=>n.cloneNode(!0)):e.label;return u`
|
|
738
|
-
<div
|
|
739
|
-
class="option"
|
|
740
|
-
part="option"
|
|
741
|
-
role="option"
|
|
742
|
-
tabindex=${t===this.activeIndex?0:-1}
|
|
743
|
-
aria-selected=${String(e.value===this.value)}
|
|
744
|
-
aria-disabled=${String(e.disabled)}
|
|
745
|
-
@click=${()=>this.select(t)}
|
|
746
|
-
>
|
|
747
|
-
<span>${r}</span>
|
|
748
|
-
${e.value===this.value?u`<mndw-icon name="check" aria-hidden="true"></mndw-icon>`:null}
|
|
749
|
-
</div>
|
|
750
|
-
`})}
|
|
751
|
-
</div>
|
|
752
|
-
</mndw-scroll-area>
|
|
753
|
-
`}firstEnabledIndex(){return this.options.findIndex(e=>!e.disabled)}onKeydown=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),this.move(1);break;case"ArrowUp":e.preventDefault(),this.move(-1);break;case"Home":e.preventDefault(),this.moveTo(this.firstEnabledIndex());break;case"End":e.preventDefault(),this.moveTo(this.lastEnabledIndex());break;case"Enter":case" ":e.preventDefault(),this.select(this.activeIndex);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.dismiss();break;case"Tab":e.preventDefault(),this.dismiss();break;default:break}};lastEnabledIndex(){for(let e=this.options.length-1;e>=0;e-=1)if(!this.options[e].disabled)return e;return-1}move(e){let t=this.options.length;if(t===0)return;let r=this.activeIndex;for(let n=0;n<t;n+=1)if(r=(r+e+t)%t,!this.options[r].disabled){this.moveTo(r);return}}moveTo(e){e<0||(this.activeIndex=e,this.updateComplete.then(()=>{this.focusActive()}))}select(e){let t=this.options[e];!t||t.disabled||this.dispatchEvent(new CustomEvent("mndwpanelselect",{detail:{value:t.value}}))}dismiss(){this.dispatchEvent(new CustomEvent("mndwpaneldismiss",{detail:{restoreFocus:!0}}))}};function Cn(i){let e=i.querySelectorAll(Xe);return Array.from(e,t=>{let r=t.getAttribute("value")??"",n=(t.textContent??"").replace(/\s+/g," ").trim(),o=Array.from(t.childNodes,a=>a.cloneNode(!0));return{value:r,label:n===""?r:n,labelNodes:o,disabled:t.hasAttribute("disabled")}})}var ia=180;function na(i){return{top:i.top,right:i.right,bottom:i.bottom,left:i.left,width:i.width,height:i.height}}function oa(i,e){return i?.top===e.top&&i.right===e.right&&i.bottom===e.bottom&&i.left===e.left&&i.width===e.width&&i.height===e.height}function En(i,e,t){i.style.minWidth=`${Math.max(e.width,ia)}px`,i.style.maxWidth=`calc(100vw - ${16}px)`,i.style.maxHeight=`${zr(e,t)}px`,i.style.overflow="hidden",i.style.display="flex",i.style.flexDirection="column"}var jt=class{options;geometry=null;needsReposition=!1;frame=null;constructor(e){this.options={...e,requestFrame:e.requestFrame??(t=>requestAnimationFrame(t)),cancelFrame:e.cancelFrame??(t=>cancelAnimationFrame(t))}}start(){this.cancel(),this.needsReposition=!0,this.frame=this.options.requestFrame(this.tick)}cancel(){this.frame!==null&&(this.options.cancelFrame(this.frame),this.frame=null),this.geometry=null,this.needsReposition=!1}tick=()=>{if(this.frame=null,!this.options.isActive())return;let e=this.options.readAnchorRect(),t=na(e),r=!oa(this.geometry,t);r&&(this.options.onGeometryChange(e),this.geometry=t),(this.needsReposition||r)&&this.options.isConnected()&&(this.options.onReposition(),this.needsReposition=!1),this.frame=this.options.requestFrame(this.tick)}};var Gr="mndw-select",et=class extends g{static formAssociated=!0;static mndwLabelSource="label-property";static properties={value:{type:String},placeholder:{type:String},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0},panelClass:{type:String,attribute:"panel-class"},label:{type:String},open:{type:Boolean,state:!0}};static styles=v`
|
|
754
|
-
:host {
|
|
755
|
-
${C}
|
|
756
|
-
|
|
757
|
-
display: inline-block;
|
|
758
|
-
width: 100%;
|
|
759
|
-
border-radius: var(--mndw-radius-md);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
:host([disabled]) {
|
|
763
|
-
pointer-events: none;
|
|
764
|
-
opacity: 0.5;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
[part='trigger'] {
|
|
768
|
-
${B}
|
|
769
|
-
|
|
770
|
-
display: flex;
|
|
771
|
-
gap: var(--mndw-space-2);
|
|
772
|
-
align-items: center;
|
|
773
|
-
justify-content: space-between;
|
|
774
|
-
width: 100%;
|
|
775
|
-
border: 1px solid var(--mndw-border);
|
|
776
|
-
background: var(--mndw-surface-raised);
|
|
777
|
-
color: var(--mndw-text);
|
|
778
|
-
text-align: left;
|
|
779
|
-
cursor: pointer;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
:host(:not([disabled]):not([invalid]):not([aria-invalid='true'])) [part='trigger']:hover {
|
|
783
|
-
${we}
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
:host(:focus-visible) {
|
|
787
|
-
${L}
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
.value {
|
|
791
|
-
overflow: hidden;
|
|
792
|
-
text-overflow: ellipsis;
|
|
793
|
-
white-space: nowrap;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
.value.placeholder {
|
|
797
|
-
color: var(--mndw-text-subtle);
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
.indicator {
|
|
801
|
-
flex-shrink: 0;
|
|
802
|
-
color: var(--mndw-text-subtle);
|
|
803
|
-
}
|
|
804
|
-
`;layer=null;panel=null;panelHadFocus=!1;presentation=null;placeholderState;localeController=new k(this,{applyLocale:()=>{this.applyLocale()}});formState=new P(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});labelController=new U(this);popoverTracker=new jt({isActive:()=>this.presentation==="popover"&&this.layer!==null,isConnected:()=>this.layer?.contentElement.isConnected===!0,readAnchorRect:()=>this.getBoundingClientRect(),onGeometryChange:e=>{this.layer!==null&&this.applyPopoverSizing(this.layer,e)},onReposition:()=>this.layer?.reposition()});constructor(){super(),this.placeholderState=D(this,"placeholder"),this.value="",this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.panelClass="",this.label="",this.open=!1,this.addEventListener("click",this.onTriggerClick),this.addEventListener("keydown",this.onTriggerKeydown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"]),this.addEventListener(Je,this.onOptionChange)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(Je,this.onOptionChange),this.closePanel(!1)}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}refreshAccessibleName(){this.requestUpdate()}render(){let e=this.options().find(t=>t.value===this.value);return u`
|
|
805
|
-
<div
|
|
806
|
-
part="trigger"
|
|
807
|
-
aria-hidden="true"
|
|
808
|
-
@keydown=${this.onTriggerKeydown}
|
|
809
|
-
>
|
|
810
|
-
<span class="value ${e?"":"placeholder"}" part="value">
|
|
811
|
-
${e?e.label:this.placeholder??w("select.placeholder")}
|
|
812
|
-
</span>
|
|
813
|
-
<span class="indicator" part="indicator" aria-hidden="true"><mndw-icon name="chevron-down"></mndw-icon></span>
|
|
814
|
-
</div>
|
|
815
|
-
<slot hidden @slotchange=${this.onSlotChange}></slot>
|
|
816
|
-
`}updated(e){let t=this.formState.effectiveDisabled,r=this.options().find(a=>a.value===this.value),n=r?r.value:null;if(this.setAttribute("role","combobox"),this.setAttribute("aria-haspopup","listbox"),this.setAttribute("aria-expanded",String(this.open)),this.setAttribute("aria-disabled",String(t)),this.setAttribute("aria-required",String(this.required)),this.tabIndex=t?-1:0,this.formState.internals)if(this.formState.internals.ariaLabel=this.label||null,this.formState.internals.ariaExpanded=String(this.open),this.formState.internals.ariaHasPopup="listbox",this.formState.internals.ariaDisabled=String(t),this.formState.internals.ariaRequired=String(this.required),this.label)this.setAttribute("aria-label",this.label),this.removeAttribute("aria-labelledby"),this.formState.internals.ariaLabelledByElements=[];else{this.removeAttribute("aria-label");let a=this.formState.labels;this.labelController.sync(a,this.formState.internals)}else this.label?this.setAttribute("aria-label",this.label):this.removeAttribute("aria-label");this.formState.setFormValue(n,this.value),this.required&&!r?this.formState.setValidity({valueMissing:!0},w("select.validation.required")):this.formState.clearValidity();let o=this.invalid||this.required&&!r||this.formState.internals?.validity?.valid===!1;this.setAttribute("aria-invalid",String(o)),this.formState.internals&&(this.formState.internals.role="combobox",this.formState.internals.ariaInvalid=String(o)),e.has("label")&&e.get("label")!==void 0&&ce(this)}options(){return Cn(this)}applyLocale(){this.placeholderState.setGenerated(w("select.placeholder")),this.layer?.setTitle?.(this.label||w("select.overlay.title"))}onSlotChange=()=>{this.syncOptions()};onOptionChange=()=>{this.syncOptions()};syncOptions(){this.requestUpdate(),this.panel&&(this.panel.options=this.options())}onTriggerClick=()=>{if(this.open){this.closePanel(!0);return}this.openPanel()};onTriggerKeydown=e=>{let t=e.currentTarget!==this;if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),!this.open){let r=e.key==="Home"?"first":e.key==="End"?"last":"selected";this.openPanel(r)}t&&e.stopPropagation()}};openPanel(e="selected"){if(this.formState.effectiveDisabled||this.open||!this.isConnected)return;let t=Vr(window.innerWidth),r=Gt().open({anchor:this,presentation:t,title:this.label||w("select.overlay.title"),className:this.panelClass||void 0});t==="popover"&&(this.applyPopoverSizing(r),window.addEventListener("resize",this.onViewportChange),window.addEventListener("scroll",this.onViewportChange,!0));let n=document.createElement(Qe);n.options=this.options(),n.value=this.value,n.label=this.label,n.sheet=t==="sheet",n.addEventListener("mndwpanelselect",this.onPanelSelect),n.addEventListener("mndwpaneldismiss",this.onPanelDismiss),n.addEventListener("focusout",this.onPanelFocusOut),r.contentElement.appendChild(n),this.formState.internals&&"ariaControlsElements"in this.formState.internals&&(this.formState.internals.ariaControlsElements=[n]),this.layer=r,this.panel=n,this.presentation=t,this.open=!0,t==="popover"&&this.startPopoverTracking(),n.updateComplete.then(()=>{this.layer===r&&(e==="first"?n.activeIndex=this.firstEnabledIndex(n.options):e==="last"&&(n.activeIndex=this.lastEnabledIndex(n.options)),n.focusActive(),this.panelHadFocus=!0)}),r.closed.then(o=>{if(this.layer!==r)return;let a=this.panelHadFocus;this.forgetLayer(),this.restoreFocus(o,a)})}applyPopoverSizing(e,t=this.getBoundingClientRect()){En(e.contentElement,t,{width:window.innerWidth,height:window.innerHeight})}startPopoverTracking(){this.popoverTracker.start()}cancelPopoverTracking(){this.popoverTracker.cancel()}onViewportChange=()=>{let e=this.layer;this.presentation!=="popover"||!e||(this.applyPopoverSizing(e),e.reposition())};restoreFocus(e,t){if(e==="detached"||!this.isConnected)return;let r=Ce(),n=r===null||r===document.body;!t&&!n||this.focus()}onPanelFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&this.panel?.contains(t)!==!0&&(this.panelHadFocus=!1)};onPanelSelect=e=>{let t=e.detail;this.value=t.value,this.closePanel(!0),this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:t.value}}))};onPanelDismiss=e=>{let t=e.detail;this.closePanel(t.restoreFocus)};closePanel(e){let t=this.layer;if(!t)return;let r=this.panelHadFocus;this.forgetLayer(),t.close(),e&&this.restoreFocus("api",r)}forgetLayer(){this.cancelPopoverTracking(),window.removeEventListener("resize",this.onViewportChange),window.removeEventListener("scroll",this.onViewportChange,!0),this.panel?.removeEventListener("mndwpanelselect",this.onPanelSelect),this.panel?.removeEventListener("mndwpaneldismiss",this.onPanelDismiss),this.panel?.removeEventListener("focusout",this.onPanelFocusOut),this.formState.internals&&"ariaControlsElements"in this.formState.internals&&(this.formState.internals.ariaControlsElements=[]),this.panel=null,this.layer=null,this.presentation=null,this.open=!1,this.panelHadFocus=!1}firstEnabledIndex(e){return e.findIndex(t=>!t.disabled)}lastEnabledIndex(e){for(let t=e.length-1;t>=0;t-=1)if(!e[t].disabled)return t;return-1}resetForm(){this.value=this.getAttribute("value")??this.options()[0]?.value??""}restoreFormState(e){typeof e=="string"&&(this.value=e)}};var Wr=24,Kr="mndw-scroll-area";function G(i,e=0){return Number.isFinite(i)&&i>=0?i:e}function Tn(i,e,t){return Math.min(t,Math.max(e,i))}var tt=class extends g{static styles=v`
|
|
817
|
-
:host {
|
|
818
|
-
box-sizing: border-box;
|
|
819
|
-
display: flex;
|
|
820
|
-
flex: 0 1 auto;
|
|
821
|
-
flex-direction: column;
|
|
822
|
-
min-height: 0;
|
|
823
|
-
max-width: 100%;
|
|
824
|
-
position: relative;
|
|
825
|
-
overflow: hidden;
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
.viewport {
|
|
829
|
-
min-height: 0;
|
|
830
|
-
flex: 0 1 auto;
|
|
831
|
-
overflow-x: hidden;
|
|
832
|
-
overflow-y: auto;
|
|
833
|
-
scrollbar-width: none;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
.viewport::-webkit-scrollbar {
|
|
837
|
-
display: none;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
.scrollbar {
|
|
841
|
-
display: none;
|
|
842
|
-
position: absolute;
|
|
843
|
-
inset-block: 0;
|
|
844
|
-
inset-inline-end: 0;
|
|
845
|
-
width: var(--mndw-scrollbar-size);
|
|
846
|
-
touch-action: none;
|
|
847
|
-
user-select: none;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
.track {
|
|
851
|
-
height: 100%;
|
|
852
|
-
border-radius: var(--mndw-scrollbar-radius);
|
|
853
|
-
background: var(--mndw-scrollbar-track);
|
|
854
|
-
touch-action: none;
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
.thumb {
|
|
858
|
-
box-sizing: border-box;
|
|
859
|
-
border: var(--mndw-focus-w) solid var(--mndw-scrollbar-track);
|
|
860
|
-
border-radius: var(--mndw-scrollbar-radius);
|
|
861
|
-
background: var(--mndw-scrollbar-thumb);
|
|
862
|
-
touch-action: none;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
.thumb:hover,
|
|
866
|
-
.thumb.dragging {
|
|
867
|
-
background: var(--mndw-scrollbar-thumb-hover);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
:host(.dragging) {
|
|
871
|
-
user-select: none;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
[data-measure='thumb-min'] {
|
|
875
|
-
position: absolute;
|
|
876
|
-
visibility: hidden;
|
|
877
|
-
width: 0;
|
|
878
|
-
height: var(--mndw-scrollbar-thumb-min-size);
|
|
879
|
-
pointer-events: none;
|
|
880
|
-
}
|
|
881
|
-
`;viewportResizeObserver=null;contentResizeObserver=null;refreshFrame=null;shouldMeasureOnRefresh=!0;measuredMinThumbPx=Wr;assignedContent=null;listenersAttached=!1;activeDrag=null;maxScroll=0;thumbLength=0;trackTravel=0;trackTop=0;get viewportElement(){return this.shadowRoot?.querySelector('[part="viewport"]')??null}refresh(){this.scheduleRefresh(!0)}firstUpdated(){this.attachListeners(),this.scheduleRefresh(!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.attachListeners(),this.scheduleRefresh(!0))}disconnectedCallback(){let e=this.viewportElement;e&&this.listenersAttached&&e.removeEventListener("scroll",this.handleScroll),this.listenersAttached=!1,this.viewportResizeObserver?.disconnect(),this.contentResizeObserver?.disconnect(),this.assignedContent=null,this.refreshFrame!==null&&(cancelAnimationFrame(this.refreshFrame),this.refreshFrame=null),this.shouldMeasureOnRefresh=!0,this.endDrag(),super.disconnectedCallback()}render(){return u`
|
|
882
|
-
<div part="viewport" class="viewport"><slot @slotchange=${this.handleSlotChange}></slot></div>
|
|
883
|
-
<div
|
|
884
|
-
part="scrollbar"
|
|
885
|
-
class="scrollbar"
|
|
886
|
-
aria-hidden="true"
|
|
887
|
-
@pointermove=${this.handlePointerMove}
|
|
888
|
-
@pointerup=${this.handlePointerUp}
|
|
889
|
-
@pointercancel=${this.handlePointerCancel}
|
|
890
|
-
>
|
|
891
|
-
<div part="track" class="track" @pointerdown=${this.handleTrackPointerDown}>
|
|
892
|
-
<div part="thumb" class="thumb" @pointerdown=${this.handleThumbPointerDown}></div>
|
|
893
|
-
</div>
|
|
894
|
-
</div>
|
|
895
|
-
<div data-measure="thumb-min" aria-hidden="true"></div>
|
|
896
|
-
`}attachListeners(){let e=this.viewportElement;e&&(this.listenersAttached||(e.addEventListener("scroll",this.handleScroll,{passive:!0}),this.listenersAttached=!0),typeof ResizeObserver<"u"&&(this.viewportResizeObserver||(this.viewportResizeObserver=new ResizeObserver(this.handleResize)),this.contentResizeObserver||(this.contentResizeObserver=new ResizeObserver(this.handleResize)),this.viewportResizeObserver.observe(e),this.observeAssignedContent()))}observeAssignedContent(){let e=this.shadowRoot?.querySelector("slot");if(!e||!this.contentResizeObserver)return;let t=e.assignedElements({flatten:!0})[0]??null;t!==this.assignedContent&&(this.contentResizeObserver.disconnect(),this.assignedContent=t,t&&this.contentResizeObserver.observe(t))}scheduleRefresh(e){e&&(this.shouldMeasureOnRefresh=!0),this.refreshFrame===null&&(this.refreshFrame=requestAnimationFrame(()=>{this.refreshFrame=null;let t=this.shouldMeasureOnRefresh;this.shouldMeasureOnRefresh=!1,this.updateGeometry(t)}))}updateGeometry(e){let t=this.viewportElement,r=this.shadowRoot?.querySelector('[part="scrollbar"]'),n=this.shadowRoot?.querySelector('[part="track"]'),o=this.shadowRoot?.querySelector('[part="thumb"]');if(!t||!r||!n||!o)return;e&&(this.measuredMinThumbPx=this.measureMinimumThumb());let a=G(t.clientHeight),s=G(t.scrollHeight),l=G(t.scrollTop);r.style.display="block";let c=n.getBoundingClientRect(),d=G(c.height),h=Math.max(0,s-a),f=h>1&&d>0;if(this.trackTop=Number.isFinite(c.top)?c.top:0,this.maxScroll=h,r.style.display=f?"block":"none",!f){this.thumbLength=d,this.trackTravel=0,o.style.height=`${d}px`,o.style.transform="translateY(0px)";return}let p=Math.min(d,this.measuredMinThumbPx),S=s>0?a/s:1,E=G(d*S),R=Math.min(d,Math.max(p,E)),T=Math.max(0,d-R),O=h>0?T*Tn(l,0,h)/h:0;this.thumbLength=R,this.trackTravel=T,o.style.height=`${R}px`,o.style.transform=`translateY(${G(O)}px)`}measureMinimumThumb(){let e=this.shadowRoot?.querySelector('[data-measure="thumb-min"]');if(!e)return Wr;let t=e.getBoundingClientRect().height;return Number.isFinite(t)&&t>0?t:Wr}setScrollFromThumbTop(e){let t=this.viewportElement;if(!t)return;let r=Tn(G(e),0,this.trackTravel),n=this.trackTravel>0?this.maxScroll*r/this.trackTravel:0;t.scrollTop=G(n),this.writeThumbOffset(r),this.scheduleRefresh(!1)}writeThumbOffset(e){let t=this.shadowRoot?.querySelector('[part="thumb"]');t&&(t.style.transform=`translateY(${G(e)}px)`)}setDragging(e){let t=this.shadowRoot?.querySelector('[part="thumb"]');this.classList.toggle("dragging",e),t?.classList.toggle("dragging",e)}endDrag(){if(!this.activeDrag){this.setDragging(!1);return}let{pointerId:e,captureTarget:t}=this.activeDrag;t.releasePointerCapture?.(e),this.activeDrag=null,this.setDragging(!1)}capturePointer(e,t){e.setPointerCapture?.(t)}handleScroll=()=>{this.scheduleRefresh(!1)};handleResize=()=>{this.scheduleRefresh(!0)};handleSlotChange=()=>{this.observeAssignedContent(),this.scheduleRefresh(!1)};handleThumbPointerDown=e=>{let t=e.currentTarget,r=t.getBoundingClientRect();this.activeDrag={pointerId:e.pointerId,offset:G(e.clientY-r.top),captureTarget:t},this.capturePointer(t,e.pointerId),e.preventDefault(),this.setDragging(!0)};handleTrackPointerDown=e=>{let t=this.shadowRoot?.querySelector('[part="thumb"]');if(e.target===t)return;let r=e.currentTarget,n=r.getBoundingClientRect(),o=e.clientY-n.top-this.thumbLength/2;this.setScrollFromThumbTop(o),this.activeDrag={pointerId:e.pointerId,offset:this.thumbLength/2,captureTarget:r},this.capturePointer(r,e.pointerId),e.preventDefault(),this.setDragging(!0)};handlePointerMove=e=>{if(this.activeDrag?.pointerId!==e.pointerId)return;let t=e.clientY-this.trackTop-this.activeDrag.offset;this.setScrollFromThumbTop(t)};handlePointerUp=e=>{this.activeDrag?.pointerId===e.pointerId&&this.endDrag()};handlePointerCancel=e=>{this.activeDrag?.pointerId===e.pointerId&&this.endDrag()}};var Me="mndw-segment",it="mndwsegmentchange",rt=class extends g{static properties={value:{type:String,reflect:!0},disabled:{type:Boolean,reflect:!0}};static styles=v`
|
|
897
|
-
:host {
|
|
898
|
-
${C}
|
|
899
|
-
|
|
900
|
-
display: inline-flex;
|
|
901
|
-
cursor: pointer;
|
|
902
|
-
user-select: none;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
:host([disabled]) {
|
|
906
|
-
cursor: not-allowed;
|
|
907
|
-
opacity: 0.5;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
:host(:focus-visible) {
|
|
911
|
-
outline: none;
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
[part='segment'] {
|
|
915
|
-
${B}
|
|
916
|
-
|
|
917
|
-
display: inline-flex;
|
|
918
|
-
align-items: center;
|
|
919
|
-
justify-content: center;
|
|
920
|
-
border-radius: var(--mndw-radius-sm);
|
|
921
|
-
color: var(--mndw-text-subtle);
|
|
922
|
-
white-space: nowrap;
|
|
923
|
-
transition: background var(--mndw-duration-fast) var(--mndw-easing);
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
:host([aria-checked='true']) [part='segment'] {
|
|
927
|
-
background: var(--mndw-accent);
|
|
928
|
-
color: var(--mndw-accent-contrast);
|
|
929
|
-
font-weight: var(--mndw-weight-semibold);
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
:host([aria-checked='false']:not([disabled]):not([aria-disabled='true']):hover) [part='segment'] {
|
|
933
|
-
${ye}
|
|
934
|
-
${te}
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
:host([aria-checked='true']:not([disabled]):not([aria-disabled='true']):hover) [part='segment'] {
|
|
938
|
-
background: var(--mndw-accent-hover);
|
|
939
|
-
color: var(--mndw-accent-contrast);
|
|
940
|
-
}
|
|
941
|
-
`;constructor(){super(),this.value="",this.disabled=!1}render(){return u`
|
|
942
|
-
<span part="segment">
|
|
943
|
-
<slot></slot>
|
|
944
|
-
</span>
|
|
945
|
-
`}updated(e){["value","disabled"].some(r=>e.has(r)&&e.get(r)!==void 0)&&this.dispatchEvent(new CustomEvent(it,{bubbles:!0,composed:!1}))}};var qr="mndw-segmented",aa=["role","aria-checked","aria-disabled","tabindex"],sa=["ArrowRight","ArrowDown"],la=["ArrowLeft","ArrowUp"],da=[" ","Enter"],nt=class extends g{static formAssociated=!0;static mndwLabelSource="label-property";static properties={value:{type:String},label:{type:String},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}};static styles=v`
|
|
946
|
-
:host {
|
|
947
|
-
${C}
|
|
948
|
-
|
|
949
|
-
display: inline-flex;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
:host([disabled]) {
|
|
953
|
-
pointer-events: none;
|
|
954
|
-
opacity: 0.5;
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
[part='group'] {
|
|
958
|
-
display: inline-flex;
|
|
959
|
-
gap: var(--mndw-space-1);
|
|
960
|
-
padding: var(--mndw-space-1);
|
|
961
|
-
border: var(--mndw-border-w) solid var(--mndw-border);
|
|
962
|
-
border-radius: var(--mndw-radius-md);
|
|
963
|
-
background: var(--mndw-surface);
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
::slotted(mndw-segment:focus-visible) {
|
|
967
|
-
${L}
|
|
968
|
-
|
|
969
|
-
border-radius: var(--mndw-radius-sm);
|
|
970
|
-
}
|
|
971
|
-
`;formState=new P(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});owned=[];ownsAriaLabel=!1;ownedAriaLabel=null;localeController=new k(this);constructor(){super(),this.value="",this.label="",this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeyDown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"]),this.addEventListener(it,this.onSegmentChange)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(it,this.onSegmentChange),this.releaseSegments(this.owned),this.owned=[]}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}render(){return u`
|
|
972
|
-
<div part="group">
|
|
973
|
-
<slot @slotchange=${this.onSlotChange}></slot>
|
|
974
|
-
</div>
|
|
975
|
-
`}updated(e){let t=this.syncSegments();this.syncHost(t),this.syncFormState(t),e.has("label")&&e.get("label")!==void 0&&ce(this)}segments(){return[...this.children].filter(e=>e.localName===Me&&e.value!=="")}isSegmentDisabled(e){return e.disabled||this.formState.effectiveDisabled}syncSegments(){let e=this.segments(),t=e.find(n=>n.value===this.value)??null,r=t&&!this.isSegmentDisabled(t)?t:e.find(n=>!this.isSegmentDisabled(n))??null;this.releaseSegments(this.owned.filter(n=>!e.includes(n)));for(let n of e)n.setAttribute("role","radio"),n.setAttribute("aria-checked",String(n===t)),n.setAttribute("aria-disabled",String(this.isSegmentDisabled(n))),n.setAttribute("tabindex",n===r&&!this.formState.effectiveDisabled?"0":"-1");return this.owned=e,t}releaseSegments(e){for(let t of e)for(let r of aa)t.removeAttribute(r)}syncHost(e){let t=this.formState.effectiveDisabled,r=this.invalid||this.required&&!e;this.setAttribute("role","radiogroup"),this.setAttribute("aria-disabled",String(t)),this.setAttribute("aria-required",String(this.required)),this.setAttribute("aria-invalid",String(r)),this.tabIndex=-1,this.syncAccessibleLabel();let n=this.formState.internals;n&&(n.role="radiogroup",n.ariaLabel=this.label||null,n.ariaDisabled=String(t),n.ariaRequired=String(this.required),n.ariaInvalid=String(r))}syncAccessibleLabel(){let e=this.getAttribute("aria-label");if(this.ownsAriaLabel&&e!==this.ownedAriaLabel&&(this.ownsAriaLabel=!1,this.ownedAriaLabel=null),this.label){(this.ownsAriaLabel||e===null)&&(this.setAttribute("aria-label",this.label),this.ownsAriaLabel=!0,this.ownedAriaLabel=this.label);return}this.ownsAriaLabel&&(this.removeAttribute("aria-label"),this.ownsAriaLabel=!1,this.ownedAriaLabel=null)}syncFormState(e){this.formState.setFormValue(e?e.value:null,this.value),this.required&&!e?this.formState.setValidity({valueMissing:!0},w("segmented.validation.required")):this.formState.clearValidity()}onSlotChange=()=>{this.requestUpdate()};onSegmentChange=()=>{this.requestUpdate()};onClick=e=>{let t=this.segmentFrom(e.target);!t||this.isSegmentDisabled(t)||this.activate(t)};onKeyDown=e=>{if(this.formState.effectiveDisabled)return;let t=this.segments().filter(n=>!this.isSegmentDisabled(n));if(t.length===0)return;let r=this.nextSegment(e.key,t,this.segmentFrom(e.target));r&&(e.preventDefault(),this.activate(r))};nextSegment(e,t,r){let n=r?t.indexOf(r):-1,o=t.length-1;return sa.includes(e)?t[n<0||n===o?0:n+1]:la.includes(e)?t[n<=0?o:n-1]:e==="Home"?t[0]:e==="End"?t[o]:da.includes(e)&&n>=0?t[n]:null}segmentFrom(e){let t=e instanceof Element?e.closest(Me):null;return t?.parentElement===this?t:null}activate(e){let t=this.value!==e.value;this.value=e.value,e.focus(),t&&this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:this.value}}))}resetForm(){this.value=this.getAttribute("value")??""}restoreFormState(e){typeof e=="string"&&(this.value=e)}};var Yr="mndw-slider",jr=0,Mn=100,An=1,ca=10,ua=12,ha=["ArrowRight","ArrowUp"],pa=["ArrowLeft","ArrowDown"],ot=class extends g{static formAssociated=!0;static properties={value:{type:Number},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},step:{type:Number,reflect:!0},valueText:{type:String,attribute:"value-text"},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}};static styles=v`
|
|
976
|
-
:host {
|
|
977
|
-
${C}
|
|
978
|
-
|
|
979
|
-
display: inline-flex;
|
|
980
|
-
width: 100%;
|
|
981
|
-
min-height: var(--mndw-control-h);
|
|
982
|
-
gap: var(--mndw-space-3);
|
|
983
|
-
align-items: center;
|
|
984
|
-
color: var(--mndw-text);
|
|
985
|
-
cursor: pointer;
|
|
986
|
-
touch-action: none;
|
|
987
|
-
user-select: none;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
:host([disabled]) {
|
|
991
|
-
color: var(--mndw-text-muted);
|
|
992
|
-
cursor: not-allowed;
|
|
993
|
-
opacity: 0.65;
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
:host(:focus-visible) {
|
|
997
|
-
outline: none;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
[part='track'] {
|
|
1001
|
-
position: relative;
|
|
1002
|
-
height: var(--mndw-slider-track-h);
|
|
1003
|
-
flex: 1 1 auto;
|
|
1004
|
-
border-radius: var(--mndw-slider-track-h);
|
|
1005
|
-
background: var(--mndw-surface);
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
|
-
:host(:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true'])) [part='track']:hover {
|
|
1009
|
-
${$}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
[part='fill'] {
|
|
1013
|
-
position: absolute;
|
|
1014
|
-
top: 0;
|
|
1015
|
-
left: 0;
|
|
1016
|
-
height: 100%;
|
|
1017
|
-
border-radius: inherit;
|
|
1018
|
-
background: var(--mndw-accent);
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
[part='thumb'] {
|
|
1022
|
-
position: absolute;
|
|
1023
|
-
top: 50%;
|
|
1024
|
-
width: var(--mndw-slider-thumb-size);
|
|
1025
|
-
height: var(--mndw-slider-thumb-size);
|
|
1026
|
-
border: var(--mndw-border-w) solid var(--mndw-accent-contrast);
|
|
1027
|
-
border-radius: 50%;
|
|
1028
|
-
background: var(--mndw-accent);
|
|
1029
|
-
box-sizing: border-box;
|
|
1030
|
-
transform: translate(-50%, -50%);
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
:host(:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true'])) [part='thumb']:hover {
|
|
1034
|
-
${ee}
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
:host(:focus-visible) [part='thumb'] {
|
|
1038
|
-
${L}
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
:host([disabled]) [part='fill'],
|
|
1042
|
-
:host([disabled]) [part='thumb'] {
|
|
1043
|
-
background: var(--mndw-text-subtle);
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
:host([disabled]) [part='thumb'] {
|
|
1047
|
-
border-color: var(--mndw-surface);
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
[part='output'] {
|
|
1051
|
-
flex: 0 0 auto;
|
|
1052
|
-
color: var(--mndw-text-muted);
|
|
1053
|
-
font-size: var(--mndw-text-xs);
|
|
1054
|
-
font-variant-numeric: tabular-nums;
|
|
1055
|
-
}
|
|
1056
|
-
`;formState=new P(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});labelController=new U(this);dragPointer=null;dragBaseline=0;constructor(){super(),this.value=jr,this.min=jr,this.max=Mn,this.step=An,this.valueText="",this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.addEventListener("keydown",this.onKeyDown),this.addEventListener("pointerdown",this.onPointerDown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"])}disconnectedCallback(){super.disconnectedCallback(),this.endDrag(!1)}refreshAccessibleName(){this.requestUpdate()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}willUpdate(){this.min=Number.isFinite(this.min)?this.min:jr,this.max=Number.isFinite(this.max)?this.max:Mn,this.step=Number.isFinite(this.step)&&this.step>0?this.step:An;let e=this.normalizeValue(this.value);e!==this.value&&(this.value=e)}render(){let e=this.percent;return u`
|
|
1057
|
-
<div part="track">
|
|
1058
|
-
<div part="fill" style="width: ${e}%"></div>
|
|
1059
|
-
<div part="thumb" style="left: ${e}%"></div>
|
|
1060
|
-
</div>
|
|
1061
|
-
<span part="output" aria-hidden="true">${this.valueText||String(this.value)}</span>
|
|
1062
|
-
`}updated(){let e=this.formState.effectiveDisabled;this.setAttribute("role","slider"),this.setAttribute("aria-valuenow",String(this.value)),this.setAttribute("aria-valuemin",String(this.min)),this.setAttribute("aria-valuemax",String(this.max)),this.setAttribute("aria-orientation","horizontal"),this.setAttribute("aria-disabled",String(e)),this.tabIndex=e?-1:0,this.valueText?this.setAttribute("aria-valuetext",this.valueText):this.removeAttribute("aria-valuetext"),this.formState.setFormValue(String(this.value),String(this.value)),this.syncValidity(),this.syncLabels()}get percent(){let e=this.max-this.min;return e<=0?0:Math.min(Math.max((this.value-this.min)/e*100,0),100)}normalizeValue(e){let t=Number.isFinite(e)?e:this.min,r=Math.min(Math.max(t,this.min),this.max),n=Math.round((r-this.min)/this.step),o=this.min+n*this.step,a=o>this.max?this.min+Math.floor((this.max-this.min)/this.step)*this.step:o;return Number.parseFloat(a.toPrecision(ua))}syncLabels(){let e=this.formState.labels,t=this.formState.internals;this.labelController.sync(e,t),t&&(t.role="slider",t.ariaValueNow=String(this.value),t.ariaValueMin=String(this.min),t.ariaValueMax=String(this.max),t.ariaValueText=this.valueText||null,t.ariaOrientation="horizontal",t.ariaDisabled=String(this.formState.effectiveDisabled))}syncValidity(){if(this.value<this.min){this.formState.setValidity({rangeUnderflow:!0},`Value must be ${this.min} or more.`);return}if(this.value>this.max){this.formState.setValidity({rangeOverflow:!0},`Value must be ${this.max} or less.`);return}let e=(this.value-this.min)/this.step;if(Math.abs(e-Math.round(e))>Number.EPSILON){this.formState.setValidity({stepMismatch:!0},`Value must be a multiple of ${this.step}.`);return}this.formState.clearValidity()}onKeyDown=e=>{if(this.formState.effectiveDisabled)return;let t=this.keyValue(e.key);t!==null&&(e.preventDefault(),this.applyUserValue(t)&&this.dispatchChange())};keyValue(e){if(ha.includes(e))return this.value+this.step;if(pa.includes(e))return this.value-this.step;let t=Math.max(this.step,(this.max-this.min)/ca);return e==="PageUp"?this.value+t:e==="PageDown"?this.value-t:e==="Home"?this.min:e==="End"?this.max:null}onPointerDown=e=>{this.formState.effectiveDisabled||e.isPrimary===!1||this.dragPointer!==null||(e.preventDefault(),this.dragPointer=e.pointerId,this.dragBaseline=this.value,this.focus(),typeof this.setPointerCapture=="function"&&this.setPointerCapture(e.pointerId),window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerUp),this.applyUserValue(this.valueFromPointer(e)))};onPointerMove=e=>{this.dragPointer===e.pointerId&&this.applyUserValue(this.valueFromPointer(e))};onPointerUp=e=>{this.dragPointer===e.pointerId&&this.endDrag(!0)};endDrag(e){if(this.dragPointer===null)return;let t=this.dragPointer;this.dragPointer=null,window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerUp),typeof this.releasePointerCapture=="function"&&this.hasPointerCapture(t)&&this.releasePointerCapture(t),e&&this.value!==this.dragBaseline&&this.dispatchChange()}valueFromPointer(e){let r=this.renderRoot.querySelector('[part="track"]')?.getBoundingClientRect();return!r||r.width===0?this.value:this.min+(e.clientX-r.left)/r.width*(this.max-this.min)}applyUserValue(e){let t=this.normalizeValue(e);return t===this.value?!1:(this.value=t,this.dispatchEvent(new CustomEvent("mndwinput",{bubbles:!0,composed:!0,detail:{value:t}})),!0)}dispatchChange(){this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:this.value}}))}resetForm(){let e=this.getAttribute("value"),t=e===null?Number.NaN:Number(e);this.value=Number.isFinite(t)?t:this.min}restoreFormState(e){if(typeof e!="string")return;let t=Number(e);Number.isFinite(t)&&e.trim()!==""&&(this.value=t)}};var Xr="mndw-switch",at=class extends g{static formAssociated=!0;static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},name:{type:String,reflect:!0}};static styles=v`
|
|
1063
|
-
:host {
|
|
1064
|
-
${C}
|
|
1065
|
-
|
|
1066
|
-
display: inline-flex;
|
|
1067
|
-
gap: var(--mndw-space-2);
|
|
1068
|
-
align-items: center;
|
|
1069
|
-
color: var(--mndw-text);
|
|
1070
|
-
cursor: pointer;
|
|
1071
|
-
user-select: none;
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
:host([disabled]) {
|
|
1075
|
-
color: var(--mndw-text-muted);
|
|
1076
|
-
cursor: not-allowed;
|
|
1077
|
-
opacity: 0.65;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
:host(:focus-visible) {
|
|
1081
|
-
outline: none;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
[part='track'] {
|
|
1085
|
-
position: relative;
|
|
1086
|
-
display: inline-flex;
|
|
1087
|
-
width: var(--mndw-switch-w);
|
|
1088
|
-
height: var(--mndw-switch-h);
|
|
1089
|
-
flex: 0 0 auto;
|
|
1090
|
-
align-items: center;
|
|
1091
|
-
padding: 0.125rem;
|
|
1092
|
-
border: var(--mndw-border-w) solid var(--mndw-border);
|
|
1093
|
-
border-radius: var(--mndw-switch-h);
|
|
1094
|
-
background: var(--mndw-surface);
|
|
1095
|
-
box-sizing: border-box;
|
|
1096
|
-
transition: background var(--mndw-duration-fast) var(--mndw-easing);
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
:host(:focus-visible) [part='track'] {
|
|
1100
|
-
${L}
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
:host([checked]) [part='track'] {
|
|
1104
|
-
border-color: var(--mndw-accent);
|
|
1105
|
-
background: var(--mndw-accent);
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
:host(:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='track'] {
|
|
1109
|
-
${$}
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
:host([checked]:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='track'] {
|
|
1113
|
-
${ee}
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
[part='thumb'] {
|
|
1117
|
-
width: calc(var(--mndw-switch-h) - 0.5rem);
|
|
1118
|
-
height: calc(var(--mndw-switch-h) - 0.5rem);
|
|
1119
|
-
border-radius: 50%;
|
|
1120
|
-
background: var(--mndw-text-subtle);
|
|
1121
|
-
transition: transform var(--mndw-duration-fast) var(--mndw-easing);
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
:host([checked]) [part='thumb'] {
|
|
1125
|
-
background: var(--mndw-accent-contrast);
|
|
1126
|
-
transform: translateX(calc(var(--mndw-switch-w) - var(--mndw-switch-h)));
|
|
1127
|
-
}
|
|
1128
|
-
`;formState=new P(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});labelController=new U(this);constructor(){super(),this.checked=!1,this.disabled=!1,this.required=!1,this.invalid=!1,this.value="on",this.name="",this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeyDown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["checked"])}refreshAccessibleName(){this.requestUpdate()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}render(){return u`
|
|
1129
|
-
<span part="track" aria-hidden="true">
|
|
1130
|
-
<span part="thumb"></span>
|
|
1131
|
-
</span>
|
|
1132
|
-
<slot part="label"></slot>
|
|
1133
|
-
`}updated(){let e=this.formState.effectiveDisabled,t=String(this.checked);this.setAttribute("role","switch"),this.setAttribute("aria-checked",t),this.setAttribute("aria-disabled",String(e)),this.tabIndex=e?-1:0,this.formState.setFormValue(this.checked?this.value:null,this.checked?"checked":"unchecked");let r=this.formState.internals,n=this.formState.labels;this.labelController.sync(n,r),r&&(r.role="switch",r.ariaChecked=t,r.ariaDisabled=String(e),this.checked?r.states.add("checked"):r.states.delete("checked"))}onClick=e=>{if(this.formState.effectiveDisabled){e.preventDefault();return}this.toggle()};onKeyDown=e=>{this.formState.effectiveDisabled||e.key!==" "&&e.key!=="Enter"||(e.preventDefault(),this.toggle())};toggle(){this.checked=!this.checked,this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{checked:this.checked}}))}resetForm(){this.checked=this.hasAttribute("checked")}restoreFormState(e){e==="checked"?this.checked=!0:e==="unchecked"&&(this.checked=!1)}};var Ae="mndw-tab-panel",Rn=0,st=class extends g{static properties={for:{type:String,reflect:!0}};static styles=v`
|
|
1134
|
-
:host {
|
|
1135
|
-
${C}
|
|
1136
|
-
|
|
1137
|
-
display: block;
|
|
1138
|
-
padding: var(--mndw-space-3);
|
|
1139
|
-
color: var(--mndw-text);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
:host([hidden]) {
|
|
1143
|
-
display: none;
|
|
1144
|
-
}
|
|
1145
|
-
`;constructor(){super(),this.for=""}connectedCallback(){super.connectedCallback(),this.id===""&&(Rn+=1,this.id=`mndw-tab-panel-${Rn}`)}render(){return u`
|
|
1146
|
-
<div part="panel">
|
|
1147
|
-
<slot></slot>
|
|
1148
|
-
</div>
|
|
1149
|
-
`}};var W="mndw-tab",lt=class extends g{static properties={disabled:{type:Boolean,reflect:!0}};static styles=v`
|
|
1150
|
-
:host {
|
|
1151
|
-
${C}
|
|
1152
|
-
|
|
1153
|
-
display: inline-flex;
|
|
1154
|
-
cursor: pointer;
|
|
1155
|
-
user-select: none;
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
:host([aria-disabled='true']) {
|
|
1159
|
-
cursor: not-allowed;
|
|
1160
|
-
opacity: 0.5;
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
:host(:focus-visible) {
|
|
1164
|
-
outline: none;
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
[part='tab'] {
|
|
1168
|
-
${B}
|
|
1169
|
-
|
|
1170
|
-
display: inline-flex;
|
|
1171
|
-
align-items: center;
|
|
1172
|
-
justify-content: center;
|
|
1173
|
-
border-bottom: 2px solid transparent;
|
|
1174
|
-
border-radius: var(--mndw-radius-sm) var(--mndw-radius-sm) 0 0;
|
|
1175
|
-
color: var(--mndw-text-subtle);
|
|
1176
|
-
white-space: nowrap;
|
|
1177
|
-
transition: background var(--mndw-duration-fast) var(--mndw-easing),
|
|
1178
|
-
color var(--mndw-duration-fast) var(--mndw-easing);
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
:host(:focus-visible) [part='tab'] {
|
|
1182
|
-
outline: var(--mndw-focus-w) solid var(--mndw-focus-ring);
|
|
1183
|
-
outline-offset: -0.0625rem;
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
:host([aria-selected='true']) [part='tab'] {
|
|
1187
|
-
border-bottom-color: var(--mndw-accent);
|
|
1188
|
-
color: var(--mndw-text);
|
|
1189
|
-
font-weight: var(--mndw-weight-semibold);
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
:host(:not([disabled]):not([aria-disabled='true']):hover) [part='tab'] {
|
|
1193
|
-
${ye}
|
|
1194
|
-
${te}
|
|
1195
|
-
}
|
|
1196
|
-
`;constructor(){super(),this.disabled=!1}connectedCallback(){super.connectedCallback(),this.hasAttribute("for")&&console.warn(`<${W} id="${this.id}"> has a "for" attribute; the panel points at its tab, so put "for" on the <mndw-tab-panel> instead.`)}render(){return u`
|
|
1197
|
-
<span part="tab">
|
|
1198
|
-
<slot></slot>
|
|
1199
|
-
</span>
|
|
1200
|
-
`}};var Jr="mndw-tabs",ma=["role","aria-selected","aria-controls","aria-disabled","tabindex","slot"],ba=["role","aria-labelledby","hidden"],fa=["id","for","disabled"],va=["ArrowRight","ArrowDown"],ga=["ArrowLeft","ArrowUp"],wa=[" ","Enter"],dt=class extends g{static properties={value:{type:String}};static styles=v`
|
|
1201
|
-
:host {
|
|
1202
|
-
${C}
|
|
1203
|
-
|
|
1204
|
-
display: block;
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
[part='tablist'] {
|
|
1208
|
-
display: flex;
|
|
1209
|
-
gap: var(--mndw-space-1);
|
|
1210
|
-
border-bottom: var(--mndw-border-w) solid var(--mndw-border);
|
|
1211
|
-
}
|
|
1212
|
-
`;observer;ownedTabs=[];ownedPanels=[];warnedPanels=new WeakSet;warnedTabs=new WeakSet;constructor(){super(),this.value="",this.observer=new MutationObserver(this.onMutations),this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeyDown)}connectedCallback(){super.connectedCallback(),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:fa})}disconnectedCallback(){super.disconnectedCallback(),this.observer.disconnect(),this.release(this.ownedTabs,this.ownedPanels),this.ownedTabs=[],this.ownedPanels=[]}render(){return u`
|
|
1213
|
-
<div part="tablist" role="tablist" aria-orientation="horizontal">
|
|
1214
|
-
<slot name="tab"></slot>
|
|
1215
|
-
</div>
|
|
1216
|
-
<slot></slot>
|
|
1217
|
-
`}willUpdate(){if(!this.isConnected)return;let e=this.resolveActive(this.tabChildren());this.value!==(e?.id??"")&&(this.value=e?.id??"")}updated(){if(!this.isConnected)return;let e=this.pairing(),t=this.resolveActive(e.tabs);this.release(this.ownedTabs.filter(r=>!e.tabs.includes(r)),this.ownedPanels.filter(r=>!e.panels.includes(r))),this.syncTabs(e,t),this.syncPanels(e,t),this.ownedTabs=e.tabs,this.ownedPanels=e.panels}tabChildren(){return[...this.children].filter(e=>e.localName===W)}pairing(){let e=this.tabChildren(),t=[...this.children].filter(o=>o.localName===Ae),r=new Map,n=new Set;for(let o of e){if(o.id==="")continue;let a=t.find(s=>s.for===o.id&&!n.has(s));a&&(n.add(a),r.set(o,a))}return{tabs:e,panels:t,panelOf:r}}isSelectable(e){return e.id!==""&&!e.disabled}resolveActive(e){return e.find(r=>r.id===this.value&&this.isSelectable(r))??e.find(r=>this.isSelectable(r))??null}syncTabs(e,t){for(let r of e.tabs){let n=e.panelOf.get(r),o=this.isSelectable(r);r.setAttribute("slot","tab"),r.setAttribute("role","tab"),r.setAttribute("aria-selected",String(r===t)),r.setAttribute("aria-disabled",String(!o)),r.setAttribute("tabindex",r===t?"0":"-1"),n?r.setAttribute("aria-controls",n.id):r.removeAttribute("aria-controls"),r.id===""&&!this.warnedTabs.has(r)&&(this.warnedTabs.add(r),console.warn(`<${W}> needs an id for its panel to reference; this one is inert.`))}}syncPanels(e,t){let r=new Map;for(let[n,o]of e.panelOf)r.set(o,n);for(let n of e.panels){let o=r.get(n);if(n.setAttribute("role","tabpanel"),n.hidden=o!==t,o){n.setAttribute("aria-labelledby",o.id);continue}n.removeAttribute("aria-labelledby"),this.warnedPanels.has(n)||(this.warnedPanels.add(n),console.warn(`<${Ae} for="${n.for}"> matches no <${W}> id; it stays hidden.`))}}release(e,t){for(let r of e)for(let n of ma)r.removeAttribute(n);for(let r of t)for(let n of ba)r.removeAttribute(n)}onMutations=()=>{this.requestUpdate()};onClick=e=>{let t=this.tabFrom(e.target);!t||!this.isSelectable(t)||this.activate(t)};onKeyDown=e=>{let t=[...this.children].filter(n=>n.localName===W).filter(n=>this.isSelectable(n));if(t.length===0)return;let r=this.nextTab(e.key,t,this.tabFrom(e.target));r&&(e.preventDefault(),this.activate(r))};nextTab(e,t,r){let n=r?t.indexOf(r):-1,o=t.length-1;return va.includes(e)?t[n<0||n===o?0:n+1]:ga.includes(e)?t[n<=0?o:n-1]:e==="Home"?t[0]:e==="End"?t[o]:wa.includes(e)&&n>=0?t[n]:null}tabFrom(e){let t=e instanceof Element?e.closest(W):null;return t?.parentElement===this?t:null}activate(e){let t=this.value!==e.id;this.value=e.id,e.focus(),t&&this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:this.value}}))}};var Zr="mndw-textarea",ct=class extends g{static formAssociated=!0;static shadowRootOptions={mode:"open",delegatesFocus:!0};static properties={value:{type:String},rows:{type:Number,reflect:!0},autosize:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0},maxlength:{type:Number,reflect:!0}};static styles=v`
|
|
1218
|
-
:host {
|
|
1219
|
-
${C}
|
|
1220
|
-
|
|
1221
|
-
display: inline-block;
|
|
1222
|
-
width: 100%;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
:host([disabled]) {
|
|
1226
|
-
opacity: 0.5;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
[part='field'] {
|
|
1230
|
-
box-sizing: border-box;
|
|
1231
|
-
display: flex;
|
|
1232
|
-
width: 100%;
|
|
1233
|
-
padding: var(--mndw-space-2) var(--mndw-space-3);
|
|
1234
|
-
border: var(--mndw-border-w) solid var(--mndw-border);
|
|
1235
|
-
border-radius: var(--mndw-radius-md);
|
|
1236
|
-
background: var(--mndw-surface-raised);
|
|
1237
|
-
color: var(--mndw-text);
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
:host(:not([disabled]):not([readonly]):not([invalid]):not([aria-invalid='true'])) [part='field']:hover {
|
|
1241
|
-
${we}
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
:host(:focus-within) [part='field'] {
|
|
1245
|
-
${L}
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
textarea {
|
|
1249
|
-
width: 100%;
|
|
1250
|
-
padding: 0;
|
|
1251
|
-
border: 0;
|
|
1252
|
-
background: none;
|
|
1253
|
-
color: inherit;
|
|
1254
|
-
font: inherit;
|
|
1255
|
-
line-height: var(--mndw-leading);
|
|
1256
|
-
resize: vertical;
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
:host([autosize]) textarea {
|
|
1260
|
-
overflow: hidden;
|
|
1261
|
-
resize: none;
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
textarea:focus {
|
|
1265
|
-
outline: none;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
textarea::placeholder {
|
|
1269
|
-
color: var(--mndw-text-subtle);
|
|
1270
|
-
}
|
|
1271
|
-
`;formState=new P(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});announcement=new Se(this,{formState:this.formState,isInvalid:()=>this.invalid});commits=new xe(e=>this.emitChange(e));resizeObserver=null;constructor(){super(),this.value="",this.rows=3,this.autosize=!1,this.readonly=!1,this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.maxlength=null}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"]),this.announcement.connect(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.announcement.disconnect(),this.stopAutosize()}refreshAccessibleName(){this.requestUpdate()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}focus(e){this.innerTextarea?.focus(e)}render(){return u`
|
|
1272
|
-
<div part="field">
|
|
1273
|
-
<textarea
|
|
1274
|
-
part="textarea"
|
|
1275
|
-
@input=${this.onInnerInput}
|
|
1276
|
-
@focus=${this.onInnerFocus}
|
|
1277
|
-
@blur=${this.onInnerBlur}
|
|
1278
|
-
></textarea>
|
|
1279
|
-
</div>
|
|
1280
|
-
`}updated(e){let t=this.innerTextarea;t&&(this.syncInner(t),e.has("value")&&this.commits.syncValue(this.value),this.syncFormState(t),this.announcement.sync(t),this.syncAutosize(t))}get innerTextarea(){return this.renderRoot.querySelector("textarea")}syncInner(e){I(e,"maxlength",this.maxlength===null?"":String(this.maxlength)),I(e,"rows",this.autosize?"":String(this.rows)),e.toggleAttribute("readonly",this.readonly),e.toggleAttribute("disabled",this.formState.effectiveDisabled),e.toggleAttribute("required",this.required||this.announcement.hasAriaRequired),e.value!==this.value&&(e.value=this.value)}syncFormState(e){this.formState.setFormValue(this.value),this.formState.setValidity(Vt(e.validity),e.validationMessage)}syncAutosize(e){if(!this.autosize){this.stopAutosize(),e.style.removeProperty("height");return}!this.resizeObserver&&typeof ResizeObserver=="function"&&(this.resizeObserver=new ResizeObserver(()=>{this.resizeToContent(e)}),this.resizeObserver.observe(e)),this.resizeToContent(e)}resizeToContent(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}stopAutosize(){this.resizeObserver?.disconnect(),this.resizeObserver=null}onInnerInput=e=>{this.commits.markUserInput(),this.value=e.target.value,this.dispatchEvent(new CustomEvent("mndwinput",{bubbles:!0,composed:!0,detail:{value:this.value}}))};onInnerFocus=()=>{this.commits.captureBaseline(this.value)};onInnerBlur=()=>{this.commits.commit(this.value),this.commits.releaseBaseline()};emitChange(e){this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:e}}))}resetForm(){this.value=this.getAttribute("value")??""}restoreFormState(e){typeof e=="string"&&(this.value=e)}};var Yt="mndw-tooltip",ut="aria-describedby",ya=/\s+/u,Sa=500,Ln=0;function Qr(i){return(i.getAttribute(ut)??"").split(ya).filter(e=>e!=="")}var ht=class extends g{static properties={text:{type:String},placement:{type:String,reflect:!0},delay:{type:Number,reflect:!0},visible:{type:Boolean,state:!0}};static styles=v`
|
|
1281
|
-
:host {
|
|
1282
|
-
${C}
|
|
1283
|
-
|
|
1284
|
-
display: contents;
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
/*
|
|
1288
|
-
* Closed means invisible, never removed: the description is resolved from this text, so
|
|
1289
|
-
* \`display: none\` or \`hidden\` would leave the trigger describing nothing.
|
|
1290
|
-
*/
|
|
1291
|
-
[part='tooltip'] {
|
|
1292
|
-
position: fixed;
|
|
1293
|
-
z-index: 1000;
|
|
1294
|
-
max-width: 15rem;
|
|
1295
|
-
padding: var(--mndw-space-1) var(--mndw-space-2);
|
|
1296
|
-
border: var(--mndw-border-w) solid var(--mndw-border);
|
|
1297
|
-
border-radius: var(--mndw-radius-sm);
|
|
1298
|
-
background: var(--mndw-surface-raised);
|
|
1299
|
-
box-shadow: var(--mndw-shadow-2);
|
|
1300
|
-
color: var(--mndw-text);
|
|
1301
|
-
font-size: var(--mndw-text-xs);
|
|
1302
|
-
line-height: var(--mndw-leading);
|
|
1303
|
-
opacity: 0;
|
|
1304
|
-
pointer-events: none;
|
|
1305
|
-
transition: opacity var(--mndw-duration-fast) var(--mndw-easing);
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
:host([open]) [part='tooltip'] {
|
|
1309
|
-
opacity: 1;
|
|
1310
|
-
}
|
|
1311
|
-
`;observer;trigger=null;ownedToken=null;showTimer=null;warnedExtras=!1;constructor(){super(),this.text="",this.placement="top",this.delay=Sa,this.visible=!1,this.observer=new MutationObserver(this.onMutations),this.addEventListener("keydown",this.onKeyDown)}connectedCallback(){super.connectedCallback(),this.id===""&&(Ln+=1,this.id=`mndw-tooltip-${Ln}`),this.observer.observe(this,{attributes:!0,attributeFilter:["id"],childList:!0})}disconnectedCallback(){super.disconnectedCallback(),this.cancelShow(),this.observer.disconnect(),this.releaseTrigger(),this.visible=!1}render(){return u`
|
|
1312
|
-
<slot></slot>
|
|
1313
|
-
${this.text?u`<div part="tooltip" role="none">${this.text}</div>`:b}
|
|
1314
|
-
`}willUpdate(){this.text||(this.cancelShow(),this.visible=!1)}updated(){this.isConnected&&(this.text?this.setAttribute("role","tooltip"):this.removeAttribute("role"),this.toggleAttribute("open",this.visible),this.wireTrigger())}bubble(){return this.renderRoot.querySelector('[part="tooltip"]')}assignedTrigger(){let t=this.renderRoot.querySelector("slot")?.assignedElements()??[];return t.length>1&&!this.warnedExtras&&(this.warnedExtras=!0,console.warn(`<${Yt} id="${this.id}"> takes one trigger element; the rest are ignored.`)),t[0]??null}wireTrigger(){let e=this.assignedTrigger();if(e!==this.trigger&&(this.releaseTrigger(),this.trigger=e,e&&(this.observer.observe(e,{attributes:!0,attributeFilter:[ut]}),e.addEventListener("pointerenter",this.onShowIntent),e.addEventListener("focusin",this.onShowIntent),e.addEventListener("pointerleave",this.onHideIntent),e.addEventListener("focusout",this.onHideIntent))),!e)return;let t=this.text?this.id:null;if(t===null){this.writeTokens(e,Qr(e).filter(n=>n!==this.ownedToken)),this.ownedToken=null;return}let r=Qr(e).filter(n=>n!==this.ownedToken&&n!==t);this.writeTokens(e,[...r,t]),this.ownedToken=t}writeTokens(e,t){if(t.length===0){e.removeAttribute(ut);return}let r=t.join(" ");e.getAttribute(ut)!==r&&e.setAttribute(ut,r)}releaseTrigger(){let e=this.trigger;e&&(e.removeEventListener("pointerenter",this.onShowIntent),e.removeEventListener("focusin",this.onShowIntent),e.removeEventListener("pointerleave",this.onHideIntent),e.removeEventListener("focusout",this.onHideIntent)),e&&this.ownedToken!==null&&this.writeTokens(e,Qr(e).filter(t=>t!==this.ownedToken)),this.ownedToken=null,this.trigger=null}onMutations=()=>{this.requestUpdate()};onShowIntent=()=>{!this.text||this.visible||this.showTimer!==null||(this.showTimer=setTimeout(()=>{this.showTimer=null,this.show()},Math.max(this.delay,0)))};onHideIntent=()=>{this.cancelShow(),this.hide()};onKeyDown=e=>{e.key==="Escape"&&this.onHideIntent()};cancelShow(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null)}show(){!this.text||!this.isConnected||(this.visible=!0,this.position())}hide(){this.visible=!1}position(){let e=this.bubble();if(!this.trigger||!e)return;let t=this.trigger.getBoundingClientRect(),r=e.getBoundingClientRect(),n=Hr(t,{width:r.width,height:r.height},this.placement);e.style.top=`${n.top}px`,e.style.left=`${n.left}px`,this.setAttribute("data-placement",n.placement)}};var mt="mndw-column-menu",ei="mndwcolumnmenucheck",pt=class extends g{static properties={columns:{type:Array,attribute:!1},hiddenColumns:{type:Array,attribute:!1}};static styles=v`
|
|
1315
|
-
:host {
|
|
1316
|
-
${C}
|
|
1317
|
-
display: block;
|
|
1318
|
-
color: var(--mndw-text);
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
[part='menu'] {
|
|
1322
|
-
display: flex;
|
|
1323
|
-
flex-direction: column;
|
|
1324
|
-
min-width: 11.25rem;
|
|
1325
|
-
padding: var(--mndw-space-2);
|
|
1326
|
-
gap: var(--mndw-space-1);
|
|
1327
|
-
background: var(--mndw-surface-raised);
|
|
1328
|
-
border: 1px solid var(--mndw-border);
|
|
1329
|
-
border-radius: var(--mndw-radius-md);
|
|
1330
|
-
box-shadow: var(--mndw-shadow-2);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
[part='option'] {
|
|
1334
|
-
display: flex;
|
|
1335
|
-
align-items: center;
|
|
1336
|
-
gap: var(--mndw-space-2);
|
|
1337
|
-
padding: var(--mndw-space-2);
|
|
1338
|
-
border: 0;
|
|
1339
|
-
border-radius: var(--mndw-radius-sm);
|
|
1340
|
-
background: none;
|
|
1341
|
-
color: inherit;
|
|
1342
|
-
font: inherit;
|
|
1343
|
-
text-align: start;
|
|
1344
|
-
cursor: pointer;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
[part='option']:hover {
|
|
1348
|
-
${$}
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
[part='option']:focus-visible {
|
|
1352
|
-
${L}
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
[part='indicator'] {
|
|
1356
|
-
display: inline-grid;
|
|
1357
|
-
width: 1.125rem;
|
|
1358
|
-
height: 1.125rem;
|
|
1359
|
-
place-items: center;
|
|
1360
|
-
border: 1px solid var(--mndw-border);
|
|
1361
|
-
border-radius: var(--mndw-radius-sm);
|
|
1362
|
-
background: var(--mndw-surface);
|
|
1363
|
-
color: var(--mndw-accent-contrast);
|
|
1364
|
-
flex: 0 0 auto;
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
[part='indicator'][data-checked='true'] {
|
|
1368
|
-
border-color: var(--mndw-accent);
|
|
1369
|
-
background: var(--mndw-accent);
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
[part='checkmark'] {
|
|
1373
|
-
width: 0.3rem;
|
|
1374
|
-
height: 0.55rem;
|
|
1375
|
-
border: solid currentColor;
|
|
1376
|
-
border-width: 0 2px 2px 0;
|
|
1377
|
-
transform: translateY(-0.0625rem) rotate(45deg);
|
|
1378
|
-
}
|
|
1379
|
-
`;workingHidden=new Set;constructor(){super(),this.columns=[],this.hiddenColumns=[]}connectedCallback(){super.connectedCallback(),this.workingHidden=new Set(this.hiddenColumns)}firstUpdated(){this.focusOption(0)}render(){return u`
|
|
1380
|
-
<div
|
|
1381
|
-
part="menu"
|
|
1382
|
-
role="menu"
|
|
1383
|
-
@keydown=${this.handleKeydown}
|
|
1384
|
-
>
|
|
1385
|
-
${this.columns.map(e=>{let t=!this.workingHidden.has(e.id);return u`
|
|
1386
|
-
<button
|
|
1387
|
-
type="button"
|
|
1388
|
-
part="option"
|
|
1389
|
-
role="menuitemcheckbox"
|
|
1390
|
-
tabindex="-1"
|
|
1391
|
-
data-column-id=${e.id}
|
|
1392
|
-
aria-checked=${String(t)}
|
|
1393
|
-
@click=${()=>this.toggle(e.id)}
|
|
1394
|
-
>
|
|
1395
|
-
<span part="indicator" data-checked=${String(t)} aria-hidden="true">
|
|
1396
|
-
${t?u`<span part="checkmark"></span>`:null}
|
|
1397
|
-
</span>
|
|
1398
|
-
${e.label}
|
|
1399
|
-
</button>
|
|
1400
|
-
`})}
|
|
1401
|
-
</div>
|
|
1402
|
-
`}toggle(e){this.workingHidden.has(e)?this.workingHidden.delete(e):this.workingHidden.add(e),this.requestUpdate(),this.dispatchEvent(new CustomEvent(ei,{bubbles:!0,composed:!0,detail:{hidden:[...this.workingHidden]}}))}focusFirstOption(){this.focusOption(0)}focusOption(e){let t=[...this.renderRoot.querySelectorAll("button[data-column-id]")];t.length!==0&&t[(e%t.length+t.length)%t.length]?.focus()}handleKeydown=e=>{let t=[...this.renderRoot.querySelectorAll("button[data-column-id]")],r=t.indexOf(e.target);switch(e.key){case"ArrowDown":e.preventDefault(),this.focusOption(r+1);break;case"ArrowUp":e.preventDefault(),this.focusOption(r-1);break;case"Home":e.preventDefault(),this.focusOption(0);break;case"End":e.preventDefault(),this.focusOption(t.length-1);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.dismiss(!0);break;case"Tab":e.preventDefault(),this.dismiss(!1);break;default:break}};dismiss(e){this.dispatchEvent(new CustomEvent("mndwpaneldismiss",{bubbles:!0,composed:!0,detail:{restoreFocus:e}}))}};var Xt="mndwselectionchange",ti="mndwsortchange",ri="mndwrowreorder",ii="mndwcolumnvisibilitychange",ni="mndwerror",oi="mndwrowexpand",K="__mndw_detail__";var Jt=class{entries=new Map;host;nextSlotId=1;constructor(e){this.host=e}reconcile(e,t,r,n,o,a=new Set,s){let l=new Set;for(let c of e)this.reconcileRow(c,t(c),r,n,o,l,a,s);this.pruneRemoved(l)}reconcileRow(e,t,r,n,o,a,s,l){let c=this.entries.get(t);c===void 0&&(c=new Map,this.entries.set(t,c));for(let d of r){if(d.renderer===void 0||!n.has(d.id))continue;a.add(`${t}\0${d.id}`);let h=c.get(d.id),m={node:h?.node??document.createElement("div"),row:e,value:o(d,e),colId:d.id};if(h?.rendererFactory===d.renderer){h.renderer.update(m);continue}h!==void 0&&(h.renderer.destroy(),h.node.remove());let f=d.renderer(),p=m.node;p.setAttribute("slot",`mc-${this.nextSlotId++}`),this.host.appendChild(p);let S={slotId:p.getAttribute("slot")??"",node:p,renderer:f,rendererFactory:d.renderer,rowKey:t,colId:d.id};f.mount({node:p,row:e,value:m.value,colId:d.id}),c.set(d.id,S)}if(l!==void 0&&s.has(t)){a.add(`${t}\0${K}`);let d=c.get(K),h={node:d?.node??document.createElement("div"),row:e,value:e,colId:K};if(d?.rendererFactory===l)d.renderer.update(h);else{d!==void 0&&(d.renderer.destroy(),d.node.remove());let m=l(),f=h.node;f.setAttribute("slot",`mc-${this.nextSlotId++}`),this.host.appendChild(f),m.mount({node:f,row:e,value:e,colId:K}),c.set(K,{slotId:f.getAttribute("slot")??"",node:f,renderer:m,rendererFactory:l,rowKey:t,colId:K})}}}pruneRemoved(e){for(let[t,r]of this.entries){for(let[n,o]of r)e.has(`${t}\0${n}`)||(o.renderer.destroy(),o.node.remove(),r.delete(n));r.size===0&&this.entries.delete(t)}}getSlotId(e,t){return this.entries.get(e)?.get(t)?.slotId}getRowKeyForNode(e){for(let[t,r]of this.entries)for(let n of r.values())if(n.node===e||n.node.contains(e))return t}drain(){for(let e of this.entries.values())for(let t of e.values())t.renderer.destroy(),t.node.remove();this.entries.clear()}};function kn(i){for(let e=i.length-1;e>=0;e-=1){let t=i[e]?.rowKey;if(t!==void 0)return t}}var _n=new WeakMap;function Pn(i,e){_n.set(i,e)}function Zt(i){return _n.get(i)}function Dn(){return{createResizeObserver(i){return typeof ResizeObserver>"u"?null:new ResizeObserver(i)},requestAnimationFrame(i){return requestAnimationFrame(i)},cancelAnimationFrame(i){cancelAnimationFrame(i)},measure(i){return i.getBoundingClientRect()},getViewportScrollTop(i){return i.scrollTop},setViewportScrollTop(i,e){i.scrollTop=e},getViewportClientHeight(i){return i.clientHeight},getViewportContentWidth(i){return i.clientWidth}}}function he(i){return i!==void 0&&Number.isFinite(i)&&i>0}function Nn(i,e){return he(i)?i:e}function On(i){let e=Nn(i.estimatedRowHeight,1),t=Nn(i.detailEstimate,1);return i.keys.map(r=>{let n=i.measurements.get(r),o=he(n?.summary)?n.summary:e,a=i.expandedKeys.has(r)?he(n?.detail)?n.detail:t:0;return o+a})}function In(i){let e=[0];for(let t of i)e.push(e[e.length-1]+t);return e}function Fn(i,e){let t=0,r=i.length-1;for(;t<r;){let n=Math.floor((t+r)/2);i[n+1]<e?t=n+1:r=n}return Math.min(t,i.length-2)}function xa(i,e){let t=0,r=i.length-2;for(;t<r;){let n=Math.ceil((t+r)/2);i[n]<=e?t=n:r=n-1}return Math.max(0,t)}function $n(i){if(i.keys.length===0)return{start:0,end:0,paddingBefore:0,paddingAfter:0,totalHeight:0};let e=In(On(i)),t=e[e.length-1],r=Math.max(0,Number.isFinite(i.scrollOffset)?i.scrollOffset:0),n=Math.max(0,Number.isFinite(i.viewportHeight)?i.viewportHeight:0),o=Math.max(0,Number.isFinite(i.overscan)?i.overscan:0),a=Math.max(0,r-o),s=r+n+o,l=Fn(e,a),c=xa(e,s),d=Math.max(l+1,c+1);return{start:l,end:d,paddingBefore:e[l],paddingAfter:Math.max(0,t-e[d]),totalHeight:t}}var Qt=class{config;keys=[];expandedKeys=new Set;measurements=new Map;prefix=[0];prefixDirty=!0;bootstrapSamples=new Map;frozenMean;initialCohortKeys;constructor(e){this.config={...e}}configure(e){let t=this.config.estimatedRowHeight!==e.estimatedRowHeight||this.config.detailEstimate!==e.detailEstimate;this.config={...e},t&&this.frozenMean===void 0&&this.bootstrapSamples.size<4&&(this.prefixDirty=!0)}setRows(e,t){this.keys=[...e],this.expandedKeys=new Set(t),this.removeMissingKeys(new Set(this.keys)),this.prefixDirty=!0}recordSummaryMeasurement(e,t){if(!this.keys.includes(e)||!he(t))return!1;let r=this.measurements.get(e)?.summary;if(he(r)&&Math.abs(r-t)<=.25)return!1;let n=this.measurements.get(e)??{};return n.summary=t,this.measurements.set(e,n),this.prefixDirty=!0,this.frozenMean===void 0&&(this.bootstrapSamples.set(e,t),this.freezeBootstrapIfReady()),!0}recordDetailMeasurement(e,t){if(!this.keys.includes(e)||!he(t))return!1;let r=this.measurements.get(e)?.detail;if(he(r)&&Math.abs(r-t)<=.25)return!1;let n=this.measurements.get(e)??{};return n.detail=t,this.measurements.set(e,n),this.prefixDirty=!0,!0}clearDetailMeasurement(e){let t=this.measurements.get(e);return t?.detail===void 0?!1:(delete t.detail,t.summary===void 0&&this.measurements.delete(e),this.prefixDirty=!0,!0)}removeMissingKeys(e){for(let t of this.measurements.keys())e.has(t)||this.measurements.delete(t);for(let t of this.bootstrapSamples.keys())e.has(t)||this.bootstrapSamples.delete(t);if(this.initialCohortKeys!==void 0)for(let t of this.initialCohortKeys)e.has(t)||this.initialCohortKeys.delete(t);this.prefixDirty=!0}resetWidthEpoch(){this.measurements.clear(),this.bootstrapSamples.clear(),this.frozenMean=void 0,this.initialCohortKeys=void 0,this.prefixDirty=!0}effectiveSummaryEstimate(){return this.frozenMean!==void 0?this.frozenMean:this.bootstrapSamples.size>=4?this.runningMean():this.config.estimatedRowHeight}range(e,t,r){if(this.initialCohortKeys===void 0&&this.keys.length>0){let n=$n(this.input(e,t,r));this.initialCohortKeys=new Set(this.keys.slice(n.start,n.end))}return $n(this.input(e,t,r))}offsetOf(e){let t=this.keys.indexOf(e);if(!(t<0))return this.ensurePrefix(),this.prefix[t]}captureAnchor(e){if(this.keys.length===0)return;this.ensurePrefix();let t=Math.max(0,e),r=Math.min(this.keys.length-1,Fn(this.prefix,t));return{key:this.keys[r],logicalIndex:r,intraRowOffset:Math.max(0,t-this.prefix[r])}}restoreAnchor(e,t){this.ensurePrefix();let r=this.keys.indexOf(e.key),n=r>=0?r:Math.min(Math.max(e.logicalIndex,0),Math.max(0,this.keys.length-1)),o=this.prefix[n]+e.intraRowOffset;return Math.min(Math.max(0,t),Math.max(0,o))}offsetForRow(e,t,r,n){let o=this.keys.indexOf(e);if(o<0)return;this.ensurePrefix();let a=this.prefix[o],s=this.prefix[o+1],l=s-a,c=Math.max(0,r),d=Math.max(0,n);return t==="center"?Math.max(0,a-(c-l)/2):t==="end"?Math.max(0,s-c):t==="nearest"?a<d?a:s>d+c?Math.max(0,s-c):d:a}input(e,t,r){return{keys:this.keys,expandedKeys:this.expandedKeys,measurements:this.measurements,estimatedRowHeight:this.effectiveSummaryEstimate(),detailEstimate:this.config.detailEstimate,scrollOffset:e,viewportHeight:t,overscan:r}}ensurePrefix(){this.prefixDirty&&(this.prefix=In(On(this.input(0,0,0))),this.prefixDirty=!1)}runningMean(){let e=0;for(let t of this.bootstrapSamples.values())e+=t;return e/this.bootstrapSamples.size}freezeBootstrapIfReady(){if(this.bootstrapSamples.size<4)return;let e=this.initialCohortKeys!==void 0&&this.initialCohortKeys.size>=4&&[...this.initialCohortKeys].every(t=>this.bootstrapSamples.has(t));(this.bootstrapSamples.size>=16||e)&&(this.frozenMean=this.runningMean())}};function M(i,e){if(typeof i=="function")return i(e);let t=e[i];return typeof t=="string"?t:""}function zn(i,e){let t=[],r=new Set,n=new Set,o=0;for(let s of i){let l=M(e,s);if(l===""){o++;continue}if(r.has(l)){n.add(l);continue}r.add(l),t.push(s)}let a=[];return n.size>0&&a.push({category:"duplicate-row-key",rowKeys:[...n]}),o>0&&a.push({category:"empty-row-key",count:o}),{rows:t,violations:a}}function Un(i){let e=[],t=new Set,r=new Set;for(let o of i)t.has(o.id)&&r.add(o.id),t.add(o.id);r.size>0&&e.push({category:"duplicate-column-id",columnIds:[...r]});let n=i.map(o=>o.id).filter(o=>o.startsWith("__mndw_"));return n.length>0&&e.push({category:"reserved-column-id",columnIds:n}),e}function Bn(i,e){return i.find(t=>t.id===e)}function tr(i,e){let t=i.accessor;return t===void 0?e[i.id]:typeof t=="function"?t(e):e[t]}function Gn(i,e,t){return e==null||Bn(i,e.columnId)?.sortable!==!0||t.has(e.columnId)?null:e}function Wn(i,e){return i?.columnId!==e?{columnId:e,direction:"asc"}:i.direction==="asc"?{columnId:e,direction:"desc"}:null}function Hn(i){return i==null||typeof i=="number"&&Number.isNaN(i)}function Ca(i,e,t){let r=i.localeCompare(e,t,{sensitivity:"base"});return r!==0?r:i.localeCompare(e,t,{sensitivity:"case"})}function Ea(i,e,t,r="en"){return i.comparator!==void 0?i.comparator(e,t):i.kind==="number"||i.kind==="boolean"?Number(e)-Number(t):Ca(String(e),String(t),r)}function Kn(i,e,t,r="en"){if(t==null)return i;let n=Bn(e,t.columnId);if(n?.sortable!==!0)return i;let o=t.direction==="desc"?-1:1,a=i.map((s,l)=>({row:s,index:l,value:tr(n,s)}));return a.sort((s,l)=>{let c=Hn(s.value),d=Hn(l.value);if(c&&d)return s.index-l.index;if(c)return 1;if(d)return-1;let h=Ea(n,s.value,l.value,r);return h!==0?h*o:s.index-l.index}),a.map(s=>s.row)}function rr(i,e){if(e.length===0)return"none";let t=0;for(let r of e)i.has(r)&&t++;return t===e.length?"all":t===0?"none":"indeterminate"}function qn(i,e){let t=new Set(i);return t.has(e)?t.delete(e):t.add(e),[...t]}function jn(i,e){let t=new Set(i);if(rr(t,e)==="all")for(let n of e)t.delete(n);else for(let n of e)t.add(n);return[...t]}function Vn(i){return new Set(i.filter(e=>e.hideable!==!1).map(e=>e.id))}function Ta(i,e){let t=new Set(i);return t.has(e)?t.delete(e):t.add(e),t}var er=class{internalHidden=new Set;seededIds=new Set;lastEffective=new Set;wasControlled=!1;effectiveHidden(e,t){this.seed(e);let r=Vn(e);if(t!==void 0){let o=new Set;for(let a of t)r.has(a)&&o.add(a);return this.lastEffective=new Set(o),this.wasControlled=!0,o}this.wasControlled&&(this.internalHidden=new Set(this.lastEffective),this.wasControlled=!1);let n=new Set;for(let o of this.internalHidden)r.has(o)&&n.add(o);return n}toggle(e,t,r){let n=this.effectiveHidden(e,t),o=Ta(n,r),a=Vn(e),s=[...o].filter(l=>a.has(l));return t===void 0&&(this.internalHidden=new Set(s)),s}applyInternal(e){this.internalHidden=new Set(e),this.wasControlled=!1}seed(e){for(let t of e)this.seededIds.has(t.id)||(this.seededIds.add(t.id),t.hidden===!0&&this.internalHidden.add(t.id))}};var bt="mndw-table",pe={bubbles:!0,composed:!0,cancelable:!1};function ir(i,e){return i.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??""))}function Z(i){return i.length>0?i.join(" "):b}function Ma(){return{selectRow:i=>ir(w("table.selectRow"),{rowName:i}),selectAll:w("table.selectAll"),sortBy:i=>ir(w("table.sortBy"),{column:i}),columnMenu:w("table.columnMenu"),rowFallback:i=>ir(w("table.rowFallback"),{index:i}),reordered:(i,e,t)=>ir(w("table.reordered"),{rowName:i,pos:e,total:t}),invalidData:w("table.invalidData"),expandRow:i=>`Expand ${i}`,collapseRow:i=>`Collapse ${i}`}}var ft=class i extends g{static properties={columns:{type:Array,attribute:!1},rows:{type:Array,attribute:!1},rowKey:{type:String,attribute:"row-key"},virtual:{type:Boolean,reflect:!0},estimatedRowHeight:{type:Number,attribute:"estimated-row-height",reflect:!0},overscan:{type:Number,attribute:"overscan",reflect:!0},selectable:{type:Boolean,reflect:!0},selected:{type:Array,attribute:!1},reorderable:{type:Boolean,reflect:!0},expandable:{type:Boolean,attribute:!1},expandOn:{type:String,attribute:"expand-on"},toggleCell:{type:String,attribute:"toggle-cell"},toggleAfterColumn:{type:String,attribute:"toggle-after-column"},expanded:{type:Array,attribute:!1},expandedRenderer:{type:Object,attribute:!1},sort:{type:Object,attribute:!1},sortMode:{type:String,attribute:"sort-mode"},hiddenColumns:{type:Array,attribute:!1},columnMenu:{type:Boolean,attribute:!1},columnMenuPanelClass:{type:String,attribute:"column-menu-panel-class"},caption:{type:String},label:{type:String},rowLabel:{type:Object,attribute:!1},labels:{type:Object,attribute:!1},emptyLabel:{type:String,attribute:"empty-label"},layout:{type:String,reflect:!0},minWidth:{type:String,attribute:"min-width"},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0}};static styles=v`
|
|
1403
|
-
:host {
|
|
1404
|
-
${C}
|
|
1405
|
-
display: block;
|
|
1406
|
-
color: var(--mndw-text);
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
[part='viewport'] {
|
|
1410
|
-
box-sizing: border-box;
|
|
1411
|
-
overflow: auto;
|
|
1412
|
-
min-height: 0;
|
|
1413
|
-
overflow-anchor: none;
|
|
1414
|
-
scroll-behavior: auto !important;
|
|
1415
|
-
scrollbar-gutter: stable;
|
|
1416
|
-
/* Keep native table scrolling visually aligned with <mndw-scroll-area>'s custom scrollbar. */
|
|
1417
|
-
scrollbar-width: thin;
|
|
1418
|
-
scrollbar-color: var(--mndw-scrollbar-thumb) var(--mndw-scrollbar-track);
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
[part='viewport']::-webkit-scrollbar {
|
|
1422
|
-
width: var(--mndw-scrollbar-size);
|
|
1423
|
-
height: var(--mndw-scrollbar-size);
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
[part='viewport']::-webkit-scrollbar-track {
|
|
1427
|
-
background: var(--mndw-scrollbar-track);
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
[part='viewport']::-webkit-scrollbar-thumb {
|
|
1431
|
-
border: var(--mndw-focus-w) solid var(--mndw-scrollbar-track);
|
|
1432
|
-
border-radius: var(--mndw-scrollbar-radius);
|
|
1433
|
-
background: var(--mndw-scrollbar-thumb);
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
[part='viewport']::-webkit-scrollbar-thumb:hover {
|
|
1437
|
-
background: var(--mndw-scrollbar-thumb-hover);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
[part='viewport']::-webkit-scrollbar-corner {
|
|
1441
|
-
background: var(--mndw-scrollbar-track);
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
[part='table'] {
|
|
1445
|
-
width: 100%;
|
|
1446
|
-
border-collapse: collapse;
|
|
1447
|
-
table-layout: fixed;
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
:host([layout='auto']) [part='table'] {
|
|
1451
|
-
table-layout: auto;
|
|
1452
|
-
width: max-content;
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
:host([virtual][layout='auto']) [part='table'] {
|
|
1456
|
-
table-layout: fixed;
|
|
1457
|
-
width: 100%;
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
[part='caption'] {
|
|
1461
|
-
text-align: start;
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
[part~='header-cell'] {
|
|
1465
|
-
text-align: start;
|
|
1466
|
-
padding: var(--mndw-space-2);
|
|
1467
|
-
border-bottom: 1px solid var(--mndw-border);
|
|
1468
|
-
font-size: var(--mndw-text-sm);
|
|
1469
|
-
color: var(--mndw-text-muted);
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
[part~='cell'] {
|
|
1473
|
-
padding: var(--mndw-space-2);
|
|
1474
|
-
border-bottom: 1px solid var(--mndw-border);
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
[part~='select-cell'] {
|
|
1478
|
-
width: 2.5rem;
|
|
1479
|
-
padding-inline: var(--mndw-space-1);
|
|
1480
|
-
text-align: center;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
[part~='expand-cell'] {
|
|
1484
|
-
width: 2.5rem;
|
|
1485
|
-
padding-inline: var(--mndw-space-1);
|
|
1486
|
-
text-align: center;
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
[part='expand-toggle'] {
|
|
1490
|
-
border: 0;
|
|
1491
|
-
background: none;
|
|
1492
|
-
color: inherit;
|
|
1493
|
-
font: inherit;
|
|
1494
|
-
cursor: pointer;
|
|
1495
|
-
padding: var(--mndw-space-1);
|
|
1496
|
-
font-size: var(--mndw-text-lg);
|
|
1497
|
-
line-height: 1;
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
[part='expand-toggle']:focus-visible {
|
|
1501
|
-
${L}
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
[part='detail-cell'] {
|
|
1505
|
-
padding: 0;
|
|
1506
|
-
border-bottom: 1px solid var(--mndw-border);
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
[part='detail-row'] [part='detail-cell'] {
|
|
1510
|
-
background: var(--mndw-surface-raised);
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
[part='row']:hover [part~='cell'] {
|
|
1514
|
-
${$}
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
.nowrap {
|
|
1518
|
-
white-space: nowrap;
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
.pinned {
|
|
1522
|
-
position: sticky;
|
|
1523
|
-
z-index: 1;
|
|
1524
|
-
background: var(--mndw-surface);
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
[part~='header-cell'].pinned {
|
|
1528
|
-
z-index: 2;
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
.pinned-last {
|
|
1532
|
-
border-inline-end: 1px solid var(--mndw-border);
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
:host([sticky-header]) [part~='header-cell'] {
|
|
1536
|
-
position: sticky;
|
|
1537
|
-
top: 0;
|
|
1538
|
-
z-index: 2;
|
|
1539
|
-
background: var(--mndw-surface);
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
:host([sticky-header]) [part~='header-cell'].pinned {
|
|
1543
|
-
z-index: 3;
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
[part='sort-indicator'] {
|
|
1547
|
-
display: inline-flex;
|
|
1548
|
-
width: 1rem;
|
|
1549
|
-
flex: 0 0 1rem;
|
|
1550
|
-
align-items: center;
|
|
1551
|
-
justify-content: center;
|
|
1552
|
-
margin-inline-start: var(--mndw-space-1);
|
|
1553
|
-
color: var(--mndw-text-subtle);
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
[part='sort-indicator'][data-sorted] {
|
|
1557
|
-
color: var(--mndw-text);
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
[part='drag-handle'] {
|
|
1561
|
-
cursor: grab;
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
[part='error'] {
|
|
1565
|
-
padding: var(--mndw-space-2);
|
|
1566
|
-
color: var(--mndw-danger);
|
|
1567
|
-
background: var(--mndw-danger-bg);
|
|
1568
|
-
border-radius: var(--mndw-radius-sm);
|
|
1569
|
-
margin-bottom: var(--mndw-space-2);
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
[part='empty'] {
|
|
1573
|
-
padding: var(--mndw-space-3);
|
|
1574
|
-
color: var(--mndw-text-muted);
|
|
1575
|
-
text-align: center;
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
[part='badge'] {
|
|
1579
|
-
display: inline-flex;
|
|
1580
|
-
align-items: center;
|
|
1581
|
-
gap: var(--mndw-space-1);
|
|
1582
|
-
padding: var(--mndw-space-1) var(--mndw-space-2);
|
|
1583
|
-
border-radius: var(--mndw-radius-sm);
|
|
1584
|
-
background: var(--mndw-surface-raised);
|
|
1585
|
-
color: var(--mndw-text);
|
|
1586
|
-
font-size: var(--mndw-text-sm);
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
[part='badge-dot'] {
|
|
1590
|
-
width: 0.5rem;
|
|
1591
|
-
height: 0.5rem;
|
|
1592
|
-
border-radius: 50%;
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
.align-end {
|
|
1596
|
-
text-align: end;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
.align-center {
|
|
1600
|
-
text-align: center;
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
.cell-kind-number {
|
|
1604
|
-
font-variant-numeric: tabular-nums;
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
.sort-button {
|
|
1608
|
-
border: 0;
|
|
1609
|
-
background: none;
|
|
1610
|
-
color: inherit;
|
|
1611
|
-
font: inherit;
|
|
1612
|
-
cursor: pointer;
|
|
1613
|
-
padding: 0;
|
|
1614
|
-
display: inline-flex;
|
|
1615
|
-
align-items: center;
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
.sort-button:focus-visible,
|
|
1619
|
-
[part='drag-handle']:focus-visible,
|
|
1620
|
-
[part='column-menu-trigger']:focus-visible {
|
|
1621
|
-
${L}
|
|
1622
|
-
}
|
|
1623
|
-
`;visibilityState=new er;geometryProvider;virtualizer=null;resizeObserver=null;observedElements=new Set;observedViewport=null;pendingGeometryFrame=null;observerAttempted=!1;warnedInactiveReason=null;warnedStickyReason=null;pinState={byKey:new Map,inactiveReason:null,inactiveColumnId:null};lastViewportContentWidth;pendingScrollTarget=null;expectedProgrammaticScrollTop;cellRegistry=null;localeController=new k(this);menuLayer=null;effectiveColumns=[];displayRows=[];effectiveHidden=new Set;internalVisibilityNeedsReconcile=!1;effectiveSortState=null;selectedKeySet=new Set;lastCellReconcileSignature=null;lastExpandedKeys=new Set;windowRows=[];virtualRange=null;violations=[];lastViolationSignature="";optimisticOrder=null;dragKey=null;announceText="";static WIDTH_EPSILON=1;static UTILITY_COL_WIDTH="2.5rem";static PIN_KEYS={expandLead:"__mndw_pin_expandLead",select:"__mndw_pin_select",drag:"__mndw_pin_drag"};constructor(e){super(),this.geometryProvider=e??Dn(),this.columns=[],this.rows=[],this.rowKey="id",this.virtual=!1,this.estimatedRowHeight=49,this.overscan=400,this.selectable=!1,this.selected=[],this.reorderable=!1,this.expandable=!1,this.expandOn="toggle",this.toggleCell="leading",this.toggleAfterColumn=void 0,this.expanded=[],this.expandedRenderer=void 0,this.sort=null,this.sortMode="client",this.hiddenColumns=void 0,this.columnMenu=!0,this.columnMenuPanelClass="",this.caption="",this.label="",this.rowLabel=void 0,this.labels=void 0,this.emptyLabel="",this.layout="fixed",this.minWidth="",this.stickyHeader=!1,this.addEventListener("mndwchange",this.handleCheckboxChange),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}connectedCallback(){super.connectedCallback(),this.observerAttempted=!1,this.cellRegistry=new Jt(this),this.lastCellReconcileSignature=null}disconnectedCallback(){this.teardownGeometry(),this.closeColumnMenu(),this.cellRegistry?.drain(),this.cellRegistry=null,super.disconnectedCallback()}willUpdate(e){!this.hasUpdated||e.size>0||this.internalVisibilityNeedsReconcile?(this.internalVisibilityNeedsReconcile=!1,this.reconcileState(!0)):this.updateVirtualWindow(),this.unobserveStaleGeometryTargets()}reconcileState(e){let t=this.effectiveSortState,r=this.logicalStructureSignature(this.displayRows,this.lastExpandedKeys),n=this.captureCurrentAnchor();this.configureGeometryMode(),this.configureLayoutMode();let o=Un(this.columns),{rows:a,violations:s}=zn(this.rows,this.rowKey);this.violations=[...o,...s],this.emitErrorIfChanged(),this.effectiveColumns=this.columns.filter((m,f,p)=>p.findIndex(S=>S.id===m.id)===f).filter(m=>!m.id.startsWith("__mndw_")),this.effectiveHidden=this.visibilityState.effectiveHidden(this.effectiveColumns,this.hiddenColumns),this.effectiveSortState=Gn(this.effectiveColumns,this.sort,this.effectiveHidden),this.pinState=this.computePinState(),this.applyStickyInactive(this.pinState);let l=!this.sameSortState(t,this.effectiveSortState),c=new Set(this.effectiveColumns.filter(m=>!this.effectiveHidden.has(m.id)).map(m=>m.id));this.optimisticOrder!==null?this.displayRows=this.optimisticOrder:this.sortMode==="client"&&this.effectiveSortState!==null?this.displayRows=Kn(a,this.effectiveColumns,this.effectiveSortState,this.locale()):this.displayRows=a;let d=this.expandedSet();this.selectedKeySet=new Set(this.selected);let h=r!==this.logicalStructureSignature(this.displayRows,d);if(this.isVirtualRenderingActive()){let m=this.getVirtualizer(),f=this.displayRows.map(p=>M(this.rowKey,p));for(let p of this.lastExpandedKeys)d.has(p)||m.clearDetailMeasurement(p);if(m.configure({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160}),m.setRows(f,d),this.updateVirtualWindow(!1),l){let p=this.viewportElement(),S=this.headerElement();p!==null&&S!==null&&(this.pendingScrollTarget=null,this.writeBodyScrollOffset(p,S,0),this.updateVirtualWindow(!1))}else if(h&&n!==void 0){let p=this.viewportElement(),S=this.headerElement();if(p!==null&&S!==null){let E=m.range(this.bodyScrollOffset(p,S),this.geometryProvider.getViewportClientHeight(p),this.normalizedOverscan()),R=Math.max(0,E.totalHeight-this.geometryProvider.getViewportClientHeight(p)),T=m.restoreAnchor(n,R);this.writeBodyScrollOffset(p,S,T),this.updateVirtualWindow(!1)}}this.lastExpandedKeys=new Set(d)}else this.virtualRange=null,this.windowRows=this.displayRows;this.pendingScrollTarget!==null&&!this.displayRows.some(m=>M(this.rowKey,m)===this.pendingScrollTarget?.key)&&(this.pendingScrollTarget=null),this.reconcileVisibleCells(e,c)}updated(e){if(this.menuLayer?.reposition(),!this.isVirtualRenderingActive()){this.teardownGeometry();return}this.syncGeometryTargets(),this.scheduleGeometryFrame()}render(){let e=this.resolveLabels(),t=this.displayRows.length===0&&this.emptyLabel;return u`
|
|
1624
|
-
${this.violations.length>0?u`<div part="error" role="alert">${e.invalidData}</div>`:b}
|
|
1625
|
-
${t?u`<div part="empty">${this.emptyLabel}</div>`:u`
|
|
1626
|
-
<div class="mndw-table-viewport" part="viewport" tabindex="-1">
|
|
1627
|
-
<table
|
|
1628
|
-
part="table"
|
|
1629
|
-
style=${this.tableStyle()}
|
|
1630
|
-
aria-label=${this.caption?b:this.label||b}
|
|
1631
|
-
aria-rowcount=${this.virtual?this.logicalRowCount():b}
|
|
1632
|
-
>
|
|
1633
|
-
${this.caption?u`<caption part="caption">${this.caption}</caption>`:b}
|
|
1634
|
-
${this.renderHeader(e)}
|
|
1635
|
-
<tbody>
|
|
1636
|
-
${this.virtualRange===null?b:this.renderSpacer(this.virtualRange.paddingBefore)}
|
|
1637
|
-
${qt(this.windowRows,r=>M(this.rowKey,r),(r,n)=>this.renderRow(r,n,e))}
|
|
1638
|
-
${this.virtualRange===null?b:this.renderSpacer(this.virtualRange.paddingAfter)}
|
|
1639
|
-
</tbody>
|
|
1640
|
-
</table>
|
|
1641
|
-
</div>`}
|
|
1642
|
-
<div part="live-region" aria-live="polite">${this.announceText}</div>
|
|
1643
|
-
`}renderSpacer(e){return!Number.isFinite(e)||e<=0?b:u`<tr part="virtual-spacer" aria-hidden="true">
|
|
1644
|
-
<td colspan=${this.columnSpan()} style="height: ${e}px; padding: 0; border: 0;"></td>
|
|
1645
|
-
</tr>`}renderHeader(e){return u`
|
|
1646
|
-
<thead part="header">
|
|
1647
|
-
<tr part="header-row" aria-rowindex=${this.virtual?1:b}>
|
|
1648
|
-
${this.shouldRenderLeadingToggle()?this.renderExpandHeaderCell(i.PIN_KEYS.expandLead):b}
|
|
1649
|
-
${this.selectable?u`<th
|
|
1650
|
-
part="header-cell select-cell"
|
|
1651
|
-
scope="col"
|
|
1652
|
-
class=${Z(this.pinClasses(i.PIN_KEYS.select))}
|
|
1653
|
-
style=${this.utilityPinStyle(i.PIN_KEYS.select)}
|
|
1654
|
-
>
|
|
1655
|
-
${this.renderCheckbox({ariaLabel:e.selectAll,checked:this.isAllSelected(),indeterminate:this.isIndeterminate(),selectAll:!0})}
|
|
1656
|
-
</th>`:b}
|
|
1657
|
-
${this.reorderable&&this.effectiveSortState===null?u`<th
|
|
1658
|
-
part="header-cell"
|
|
1659
|
-
scope="col"
|
|
1660
|
-
class=${Z(this.pinClasses(i.PIN_KEYS.drag))}
|
|
1661
|
-
style=${this.utilityPinStyle(i.PIN_KEYS.drag)}
|
|
1662
|
-
></th>`:b}
|
|
1663
|
-
${this.effectiveColumns.filter(t=>!this.effectiveHidden.has(t.id)).map(t=>u`
|
|
1664
|
-
${this.renderHeaderCell(t,e)}
|
|
1665
|
-
${this.shouldRenderToggleAfter(t.id)?this.renderExpandHeaderCell():b}
|
|
1666
|
-
`)}
|
|
1667
|
-
${this.columnMenu?u`<th part="header-cell" scope="col" class="align-end">
|
|
1668
|
-
<button
|
|
1669
|
-
part="column-menu-trigger"
|
|
1670
|
-
class="sort-button"
|
|
1671
|
-
type="button"
|
|
1672
|
-
aria-label=${e.columnMenu}
|
|
1673
|
-
><mndw-icon name="settings"></mndw-icon></button>
|
|
1674
|
-
</th>`:b}
|
|
1675
|
-
${this.shouldRenderTrailingToggle()?this.renderExpandHeaderCell():b}
|
|
1676
|
-
</tr>
|
|
1677
|
-
</thead>
|
|
1678
|
-
`}renderExpandHeaderCell(e){return u`<th
|
|
1679
|
-
part="header-cell expand-cell"
|
|
1680
|
-
scope="col"
|
|
1681
|
-
class=${Z(e===void 0?[]:this.pinClasses(e))}
|
|
1682
|
-
style=${e===void 0?b:this.utilityPinStyle(e)}
|
|
1683
|
-
></th>`}renderHeaderCell(e,t){let r=Z([...this.alignClassList(e),...this.pinClasses(e.id)]),n=this.columnStyle(e);if(e.sortable!==!0)return u`<th part="header-cell" scope="col" class=${r} style=${n}>${e.label}</th>`;let o=this.effectiveSortState?.columnId===e.id?this.effectiveSortState?.direction:void 0,a=o==="asc"?"ascending":o==="desc"?"descending":b,s=o==="asc"?"arrow-up":o==="desc"?"arrow-down":"arrow-up-down";return u`
|
|
1684
|
-
<th part="header-cell" scope="col" class=${r} style=${n} aria-sort=${a}>
|
|
1685
|
-
<button
|
|
1686
|
-
class="sort-button"
|
|
1687
|
-
type="button"
|
|
1688
|
-
data-sort-column=${e.id}
|
|
1689
|
-
aria-label=${t.sortBy(e.label)}
|
|
1690
|
-
>${e.label}<span part="sort-indicator" ?data-sorted=${o!==void 0}>
|
|
1691
|
-
<mndw-icon name=${s}></mndw-icon>
|
|
1692
|
-
</span></button>
|
|
1693
|
-
</th>
|
|
1694
|
-
`}renderRow(e,t,r){let n=M(this.rowKey,e),o=this.expandedSet().has(n),a=this.cellRegistry?.getSlotId(n,K);return u`
|
|
1695
|
-
<tr part="row" data-row-key=${n} aria-rowindex=${this.virtual?this.logicalRowIndex(n,!1):b}>
|
|
1696
|
-
${this.shouldRenderLeadingToggle()?this.renderExpandCell(e,t,n,r,i.PIN_KEYS.expandLead):b}
|
|
1697
|
-
${this.selectable?u`<td
|
|
1698
|
-
part="select-cell cell"
|
|
1699
|
-
class=${Z(this.pinClasses(i.PIN_KEYS.select))}
|
|
1700
|
-
style=${this.utilityPinStyle(i.PIN_KEYS.select)}
|
|
1701
|
-
>
|
|
1702
|
-
${this.renderCheckbox({ariaLabel:r.selectRow(this.rowName(e,t)),checked:this.selectedKeySet.has(n),indeterminate:!1,rowKey:n})}
|
|
1703
|
-
</td>`:b}
|
|
1704
|
-
${this.reorderable&&this.effectiveSortState===null?u`<td
|
|
1705
|
-
part="cell"
|
|
1706
|
-
class=${Z(this.pinClasses(i.PIN_KEYS.drag))}
|
|
1707
|
-
style=${this.utilityPinStyle(i.PIN_KEYS.drag)}
|
|
1708
|
-
>
|
|
1709
|
-
<button
|
|
1710
|
-
part="drag-handle"
|
|
1711
|
-
type="button"
|
|
1712
|
-
data-row-key=${n}
|
|
1713
|
-
aria-label=${r.selectRow(this.rowName(e,t))}
|
|
1714
|
-
>⠿</button>
|
|
1715
|
-
</td>`:b}
|
|
1716
|
-
${this.effectiveColumns.filter(s=>!this.effectiveHidden.has(s.id)).map(s=>u`
|
|
1717
|
-
${this.renderCell(s,e)}
|
|
1718
|
-
${this.shouldRenderToggleAfter(s.id)?this.renderExpandCell(e,t,n,r):b}
|
|
1719
|
-
`)}
|
|
1720
|
-
${this.columnMenu?u`<td part="cell"></td>`:b}
|
|
1721
|
-
${this.shouldRenderTrailingToggle()?this.renderExpandCell(e,t,n,r):b}
|
|
1722
|
-
</tr>
|
|
1723
|
-
${this.expandable&&o?u`<tr
|
|
1724
|
-
part="detail-row"
|
|
1725
|
-
data-row-key=${n}
|
|
1726
|
-
aria-rowindex=${this.virtual?this.logicalRowIndex(n,!0):b}
|
|
1727
|
-
><td part="detail-cell" colspan=${this.columnSpan()}>${a!==void 0?u`<slot name=${a}></slot>`:b}</td></tr>`:b}
|
|
1728
|
-
`}renderExpandCell(e,t,r,n,o){let a=this.expandedSet().has(r),s=this.rowName(e,t);return u`<td
|
|
1729
|
-
part="cell expand-cell"
|
|
1730
|
-
class=${Z(o===void 0?[]:this.pinClasses(o))}
|
|
1731
|
-
style=${o===void 0?b:this.utilityPinStyle(o)}
|
|
1732
|
-
>
|
|
1733
|
-
<button
|
|
1734
|
-
part="expand-toggle"
|
|
1735
|
-
type="button"
|
|
1736
|
-
data-expand-key=${r}
|
|
1737
|
-
aria-expanded=${a?"true":"false"}
|
|
1738
|
-
aria-label=${a?n.collapseRow(s):n.expandRow(s)}
|
|
1739
|
-
><mndw-icon name=${a?"chevron-down":"chevron-right"}></mndw-icon></button>
|
|
1740
|
-
</td>`}renderCell(e,t){let r=[...this.alignClassList(e),...this.pinClasses(e.id)],n=this.columnStyle(e),o=e.renderer!==void 0?this.cellRegistry?.getSlotId(M(this.rowKey,t),e.id):void 0;if(o!==void 0)return u`<td part="cell" class=${Z(r)} style=${n}><slot name=${o}></slot></td>`;let a=e.kind==="number"?[...r,"cell-kind-number"]:r,s=tr(e,t);return u`<td part="cell" class=${Z(a)} style=${n}>${this.renderBuiltIn(e,s,t)}</td>`}renderBuiltIn(e,t,r){if(e.kind==="badge"){let n=e.badge?.(t,r);return n===void 0?b:u`<span part="badge"
|
|
1741
|
-
><span part="badge-dot" style="background: ${this.toneColor(n.tone)};"></span>${n.text}</span>`}return e.kind==="boolean"?t?u`<mndw-icon name="check"></mndw-icon>`:u`<mndw-icon name="minus"></mndw-icon>`:t==null?"":String(t)}renderCheckbox(e){return u`<mndw-checkbox
|
|
1742
|
-
aria-label=${e.ariaLabel}
|
|
1743
|
-
part=${e.selectAll?"select-all":b}
|
|
1744
|
-
?data-select-all=${e.selectAll??!1}
|
|
1745
|
-
data-row-key=${e.rowKey??b}
|
|
1746
|
-
.checked=${e.checked}
|
|
1747
|
-
.indeterminate=${e.indeterminate}
|
|
1748
|
-
></mndw-checkbox>`}expandedSet(){return new Set(this.expanded)}getVirtualizer(){return this.virtualizer===null&&(this.virtualizer=new Qt({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160})),this.virtualizer}captureCurrentAnchor(){if(!this.isVirtualRenderingActive()||this.virtualizer===null)return;let e=this.viewportElement(),t=this.headerElement();return e===null||t===null?void 0:this.virtualizer.captureAnchor(this.bodyScrollOffset(e,t))}logicalStructureSignature(e,t){return[e.map(r=>M(this.rowKey,r)).join("\0"),[...t].join("\0")].join("")}configureGeometryMode(){if(!this.virtual){this.setVirtualInactiveReason(null),this.teardownGeometry();return}if(this.resizeObserver===null&&!this.observerAttempted&&(this.observerAttempted=!0,this.resizeObserver=this.geometryProvider.createResizeObserver(this.handleGeometryResize)),this.resizeObserver===null){this.setVirtualInactiveReason("resize-observer-unavailable");return}if(this.reorderable){this.teardownGeometry(),this.setVirtualInactiveReason("reorderable");return}this.setVirtualInactiveReason(null)}configureLayoutMode(){this.virtual&&this.layout==="auto"?this.setAttribute("data-mndw-layout-inactive","virtual"):this.removeAttribute("data-mndw-layout-inactive")}isVirtualRenderingActive(){return this.virtual&&!this.reorderable&&this.resizeObserver!==null}setVirtualInactiveReason(e){e===null?this.removeAttribute("data-mndw-virtual-inactive"):(this.setAttribute("data-mndw-virtual-inactive",e),this.warnedInactiveReason!==e&&(this.warnedInactiveReason=e,console.warn(`<${bt}> virtualization inactive: ${e}`)))}updateVirtualWindow(e=!0){if(!this.isVirtualRenderingActive()||this.virtualizer===null)return;let t=this.viewportElement(),r=this.headerElement(),n=t===null||r===null?0:this.bodyScrollOffset(t,r),o=t===null?0:this.geometryProvider.getViewportClientHeight(t);this.virtualRange=this.virtualizer.range(n,o,this.normalizedOverscan());let a=this.displayRows.slice(this.virtualRange.start,this.virtualRange.end);if(t!==null&&this.windowRows!==a){let s=this.windowRows.map(c=>M(this.rowKey,c)).join("\0"),l=a.map(c=>M(this.rowKey,c)).join("\0");s!==l&&this.evacuateFocusBeforeWindowRemoval(t,this.windowRows,a)}this.windowRows=a,e&&this.reconcileVisibleCells(!1)}reconcileVisibleCells(e,t){let r=t??new Set(this.effectiveColumns.filter(o=>!this.effectiveHidden.has(o.id)).map(o=>o.id)),n=[this.windowRows.map(o=>M(this.rowKey,o)).join("\0"),[...r].join("\0"),[...this.expandedSet()].join("\0")].join("");!e&&n===this.lastCellReconcileSignature||(this.cellRegistry?.reconcile(this.windowRows,o=>M(this.rowKey,o),this.effectiveColumns,r,tr,this.expandedSet(),this.expandedRenderer),this.lastCellReconcileSignature=n)}bodyScrollOffset(e,t){return Math.max(0,this.geometryProvider.getViewportScrollTop(e)-this.geometryProvider.measure(t).height)}writeBodyScrollOffset(e,t,r){if(this.virtualizer===null)return;let n=this.geometryProvider.measure(t).height,o=this.geometryProvider.getViewportClientHeight(e),a=this.geometryProvider.getViewportScrollTop(e),s=this.virtualizer.range(this.bodyScrollOffset(e,t),o,this.normalizedOverscan()).totalHeight,l=Math.max(0,n+s-o),c=r<=0&&a<n?a:n+Math.max(0,r),d=Math.min(l,Math.max(0,c));this.expectedProgrammaticScrollTop=d,this.geometryProvider.setViewportScrollTop(e,d)}syncGeometryTargets(){let e=this.resizeObserver,t=this.viewportElement(),r=this.headerElement();if(e===null||t===null||r===null)return;let n=new Map;n.set(t,{kind:"viewport"}),n.set(r,{kind:"header"});for(let o of this.shadowRoot?.querySelectorAll('[part="row"]')??[]){let a=o.getAttribute("data-row-key");a!==null&&a!==""&&n.set(o,{kind:"summary",rowKey:a})}for(let o of this.shadowRoot?.querySelectorAll('[part="detail-row"]')??[]){let a=o.getAttribute("data-row-key");a!==null&&a!==""&&n.set(o,{kind:"detail",rowKey:a})}for(let o of this.observedElements)n.has(o)||(e.unobserve(o),this.observedElements.delete(o));for(let[o,a]of n)Pn(o,a),this.observedElements.has(o)||(e.observe(o),this.observedElements.add(o));this.observedViewport!==t&&(this.observedViewport?.removeEventListener("scroll",this.handleViewportScroll),t.addEventListener("scroll",this.handleViewportScroll),this.observedViewport=t)}unobserveStaleGeometryTargets(){if(this.resizeObserver===null)return;let e=new Set(this.windowRows.map(r=>M(this.rowKey,r))),t=this.expandedSet();for(let r of this.observedElements){let n=Zt(r);(n?.kind==="summary"&&!e.has(n.rowKey)||n?.kind==="detail"&&(!e.has(n.rowKey)||!t.has(n.rowKey)))&&(this.resizeObserver.unobserve(r),this.observedElements.delete(r))}}scheduleGeometryFrame(){!this.isVirtualRenderingActive()||this.pendingGeometryFrame!==null||(this.pendingGeometryFrame=this.geometryProvider.requestAnimationFrame(this.handleGeometryFrame))}handleGeometryResize=()=>{this.scheduleGeometryFrame()};handleViewportScroll=()=>{let e=this.observedViewport;if(e!==null&&this.expectedProgrammaticScrollTop!==void 0){let t=this.geometryProvider.getViewportScrollTop(e);if(Math.abs(t-this.expectedProgrammaticScrollTop)<=.25){this.expectedProgrammaticScrollTop=void 0,this.scheduleGeometryFrame();return}}this.pendingScrollTarget=null,this.scheduleGeometryFrame()};handleGeometryFrame=()=>{if(this.pendingGeometryFrame=null,!this.isConnected||!this.isVirtualRenderingActive()||this.virtualizer===null)return;let e=this.viewportElement(),t=this.headerElement();if(e===null||t===null)return;this.geometryProvider.measure(e);let r=this.geometryProvider.measure(t),n=this.geometryProvider.getViewportContentWidth(e),o=this.bodyScrollOffset(e,t),a=this.virtualizer.captureAnchor(o),s=!1;this.lastViewportContentWidth===void 0?this.lastViewportContentWidth=n:Number.isFinite(n)&&Math.abs(n-this.lastViewportContentWidth)>=i.WIDTH_EPSILON&&(this.lastViewportContentWidth=n,this.virtualizer.resetWidthEpoch(),s=!0);for(let p of this.observedElements){let S=Zt(p);S?.kind==="summary"?s=this.virtualizer.recordSummaryMeasurement(S.rowKey,this.geometryProvider.measure(p).height)||s:S?.kind==="detail"&&(s=this.virtualizer.recordDetailMeasurement(S.rowKey,this.geometryProvider.measure(p).height)||s)}let l=Math.max(0,this.geometryProvider.getViewportScrollTop(e)-r.height),c=this.virtualizer.range(l,this.geometryProvider.getViewportClientHeight(e),this.normalizedOverscan()),d=this.windowRows.map(p=>M(this.rowKey,p)).join("\0"),h=this.displayRows.slice(c.start,c.end),m=h.map(p=>M(this.rowKey,p)).join("\0");d!==m&&this.evacuateFocusBeforeWindowRemoval(e,this.windowRows,h),this.virtualRange=c,this.windowRows=h,this.reconcileVisibleCells(!1);let f=!1;if(this.pendingScrollTarget!==null){let p=this.pendingScrollTarget;if([...this.observedElements].find(E=>{let R=Zt(E);return R?.kind==="summary"&&R.rowKey===p.key})!==void 0){let E=this.virtualizer.offsetForRow(p.key,p.align,this.geometryProvider.getViewportClientHeight(e),l);E!==void 0&&this.writeBodyScrollOffset(e,t,E),this.pendingScrollTarget=null,f=!0}}if(s&&!f&&a!==void 0){let p=Math.max(0,c.totalHeight-this.geometryProvider.getViewportClientHeight(e)),S=this.virtualizer.restoreAnchor(a,p);this.writeBodyScrollOffset(e,t,S)}(s||d!==m)&&this.requestUpdate()};teardownGeometry(){if(this.observedViewport?.removeEventListener("scroll",this.handleViewportScroll),this.observedViewport=null,this.resizeObserver!==null){for(let e of this.observedElements)this.resizeObserver.unobserve(e);this.resizeObserver.disconnect(),this.resizeObserver=null}this.observedElements.clear(),this.observerAttempted=!1,this.pendingGeometryFrame!==null&&(this.geometryProvider.cancelAnimationFrame(this.pendingGeometryFrame),this.pendingGeometryFrame=null),this.lastViewportContentWidth=void 0,this.expectedProgrammaticScrollTop=void 0}normalizedEstimatedRowHeight(){return Number.isFinite(this.estimatedRowHeight)&&this.estimatedRowHeight>0?this.estimatedRowHeight:49}normalizedOverscan(){return Number.isFinite(this.overscan)&&this.overscan>=0?this.overscan:400}viewportElement(){return this.shadowRoot?.querySelector('[part="viewport"]')??null}headerElement(){return this.shadowRoot?.querySelector('[part="header-row"]')??null}collectFocusChain(){let e=[],t=document.activeElement;for(;t!==null;){e.push({rowKey:this.focusedRowKeyForElement(t)});let r=t.shadowRoot?.activeElement;if(!(r instanceof Element)||r===t)break;t=r}return e}focusedRowKeyForElement(e){let t=this.cellRegistry?.getRowKeyForNode(e);return t!==void 0?t:e.closest('[part="row"], [part="detail-row"]')?.getAttribute("data-row-key")??void 0}evacuateFocusBeforeWindowRemoval(e,t,r){let n=new Set(t.map(s=>M(this.rowKey,s))),o=new Set(r.map(s=>M(this.rowKey,s))),a=kn(this.collectFocusChain());a!==void 0&&n.has(a)&&!o.has(a)&&e.focus()}shouldRenderLeadingToggle(){return this.expandable&&this.toggleAfterColumn===void 0&&this.toggleCell==="leading"}shouldRenderTrailingToggle(){return this.expandable&&this.toggleAfterColumn===void 0&&this.toggleCell==="trailing"}shouldRenderToggleAfter(e){return this.expandable&&this.toggleAfterColumn===e}leadingUtilityKeys(){let e=[];return this.shouldRenderLeadingToggle()&&e.push(i.PIN_KEYS.expandLead),this.selectable&&e.push(i.PIN_KEYS.select),this.reorderable&&this.effectiveSortState===null&&e.push(i.PIN_KEYS.drag),e}computePinState(){let e=this.effectiveColumns.filter(a=>!this.effectiveHidden.has(a.id)),t=[],r=null,n=null;for(let a of e){if(a.sticky!=="start")break;if(a.width===void 0){r="missing-width",n=a.id;break}t.push({...a,width:a.width})}if(r===null){let a=e.slice(t.length).find(s=>s.sticky==="start");a!==void 0&&(r="not-leading",n=a.id)}let o=new Map;if(t.length>0){let a=[...this.leadingUtilityKeys().map(l=>({key:l,width:i.UTILITY_COL_WIDTH})),...t.map(l=>({key:l.id,width:l.width}))],s=[];a.forEach((l,c)=>{let d=s.length===0?"0":s.length===1?s[0]:`calc(${s.join(" + ")})`;o.set(l.key,{insetInlineStart:d,isLast:c===a.length-1}),s.push(l.width)})}return{byKey:o,inactiveReason:r,inactiveColumnId:n}}applyStickyInactive(e){if(e.inactiveReason===null){this.removeAttribute("data-mndw-sticky-inactive"),this.warnedStickyReason=null;return}this.setAttribute("data-mndw-sticky-inactive",e.inactiveReason);let t=`${e.inactiveReason}:${e.inactiveColumnId??""}`;this.warnedStickyReason!==t&&(this.warnedStickyReason=t,console.warn(`<${bt}> sticky column "${e.inactiveColumnId??""}" inactive: ${e.inactiveReason}`))}tableStyle(){return this.minWidth===""?b:`min-width: ${this.minWidth};`}columnStyle(e){let t=this.pinState.byKey.get(e.id),r=[];return e.width!==void 0&&r.push(`width: ${e.width};`),t!==void 0&&e.width!==void 0&&r.push(`min-width: ${e.width};`,`max-width: ${e.width};`,"box-sizing: border-box;",`inset-inline-start: ${t.insetInlineStart};`),r.length===0?b:r.join(" ")}pinClasses(e){let t=this.pinState.byKey.get(e);return t===void 0?[]:t.isLast?["pinned","pinned-last"]:["pinned"]}utilityPinStyle(e){let t=this.pinState.byKey.get(e);if(t===void 0)return b;let r=i.UTILITY_COL_WIDTH;return`width: ${r}; min-width: ${r}; max-width: ${r}; box-sizing: border-box; inset-inline-start: ${t.insetInlineStart};`}columnSpan(){let e=this.effectiveColumns.filter(t=>!this.effectiveHidden.has(t.id)).length;return(this.expandable?1:0)+(this.selectable?1:0)+(this.reorderable&&this.effectiveSortState===null?1:0)+e+(this.columnMenu?1:0)}alignClassList(e){let t=[];return e.align==="end"&&t.push("align-end"),e.align==="center"&&t.push("align-center"),e.nowrap===!0&&t.push("nowrap"),t}toneColor(e){return`var(--mndw-${e==="neutral"?"text-muted":e})`}resolveLabels(){return{...Ma(),...this.labels}}rowName(e,t){return this.rowLabel?.(e)??this.resolveLabels().rowFallback(t+1)}sameSortState(e,t){return e?.columnId===t?.columnId&&e?.direction===t?.direction}logicalRowCount(){let e=this.expandedSet(),t=new Set(this.displayRows.map(n=>M(this.rowKey,n))),r=[...e].filter(n=>t.has(n)).length;return 1+this.displayRows.length+r}logicalRowIndex(e,t){let r=2,n=this.expandedSet();for(let o of this.displayRows){let a=M(this.rowKey,o);if(a===e)return t?r+1:r;r+=1,n.has(a)&&(r+=1)}return r}locale(){return document.documentElement.lang||"en"}isAllSelected(){return rr(this.selectedKeySet,this.displayRows.map(e=>M(this.rowKey,e)))==="all"}isIndeterminate(){return rr(this.selectedKeySet,this.displayRows.map(e=>M(this.rowKey,e)))==="indeterminate"}emitErrorIfChanged(){let e=JSON.stringify(this.violations);e!==this.lastViolationSignature&&(this.lastViolationSignature=e,this.violations.length!==0&&this.dispatchEvent(new CustomEvent(ni,{...pe,detail:{violations:this.violations}})))}handleCheckboxChange=e=>{let t=e.composedPath()[0]??null;if(t===null)return;if(t.hasAttribute("data-select-all")){let n=this.displayRows.map(a=>M(this.rowKey,a)),o=jn(this.selected,n);this.dispatchEvent(new CustomEvent(Xt,{...pe,detail:{selected:o}}));return}let r=t.getAttribute("data-row-key");if(r!==null){let n=qn(this.selected,r);this.dispatchEvent(new CustomEvent(Xt,{...pe,detail:{selected:n}}))}};handleClick=e=>{let t=e.composedPath().find(o=>o instanceof HTMLElement)??null,r=t?.closest?.('[part="expand-toggle"]');if(r!=null){this.emitExpand(r.getAttribute("data-expand-key")??"");return}if(this.expandable&&this.expandOn==="row"){let o=e.composedPath();if(!o.some(s=>s instanceof HTMLElement&&(s.tagName==="BUTTON"||s.tagName==="A"||s.tagName==="INPUT"||s.tagName==="MNDW-CHECKBOX"||s.getAttribute("part")==="drag-handle"||s.hasAttribute("data-no-expand")))){let s=o.find(c=>c instanceof HTMLElement&&c.getAttribute("part")==="row"),l=s instanceof HTMLElement?s.getAttribute("data-row-key"):null;l!=null&&l!==""&&this.emitExpand(l)}}let n=t?.closest?.("[data-sort-column]");if(n!=null){this.activateSort(n.getAttribute("data-sort-column")??"");return}t?.closest?.('[part="column-menu-trigger"]')!==null&&t?.closest?.('[part="column-menu-trigger"]')!==void 0&&this.openColumnMenu(t)};emitExpand(e){let t=new Set(this.expanded);t.has(e)?t.delete(e):t.add(e),this.dispatchEvent(new CustomEvent(oi,{...pe,detail:{expanded:[...t]}}))}handleKeyDown=e=>{let t=e.composedPath()[0]??null;t?.getAttribute("part")==="drag-handle"&&(e.key==="ArrowUp"||e.key==="ArrowDown")&&(e.preventDefault(),this.keyboardReorder(t.getAttribute("data-row-key")??"",e.key==="ArrowUp"?-1:1))};activateSort(e){if(this.effectiveColumns.find(n=>n.id===e)?.sortable!==!0)return;let r=Wn(this.sort,e);this.dispatchEvent(new CustomEvent(ti,{...pe,detail:{sort:r}}))}keyboardReorder(e,t){let r=this.displayRows.findIndex(s=>M(this.rowKey,s)===e);if(r===-1)return;let n=r+t;if(n<0||n>=this.displayRows.length)return;let o=t===-1?n:n+1,a=o<this.displayRows.length?M(this.rowKey,this.displayRows[o]):null;this.emitReorder(e,a)}emitReorder(e,t){let r=this.resolveLabels(),n=this.displayRows.find(o=>M(this.rowKey,o)===e);this.announceText=n===void 0?"":r.reordered(this.rowName(n,this.displayRows.indexOf(n)),this.displayRows.indexOf(n)+1,this.displayRows.length),this.dispatchEvent(new CustomEvent(ri,{...pe,detail:{key:e,beforeKey:t}}))}applyColumnVisibility(e){this.dispatchEvent(new CustomEvent(ii,{...pe,detail:{hidden:e}}))}getVisibleColumnIds(){return this.effectiveColumns.filter(e=>!this.effectiveHidden.has(e.id)).map(e=>e.id)}scrollToRow(e,t={}){if(!this.displayRows.some(c=>M(this.rowKey,c)===e))return!1;let n=this.viewportElement(),o=this.headerElement();if(n===null||o===null)return!1;let a=this.getVirtualizer();a.configure({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160}),a.setRows(this.displayRows.map(c=>M(this.rowKey,c)),this.expandedSet());let s=t.align??"nearest",l=a.offsetForRow(e,s,this.geometryProvider.getViewportClientHeight(n),this.bodyScrollOffset(n,o));return l===void 0?!1:(this.isVirtualRenderingActive()&&(this.pendingScrollTarget={key:e,align:s}),this.writeBodyScrollOffset(n,o,l),this.updateVirtualWindow(),this.isVirtualRenderingActive()&&this.requestUpdate(),!0)}openColumnMenu(e){if(this.menuLayer!==null)return;let t=this.effectiveColumns.filter(o=>o.hideable!==!1).map(o=>({id:o.id,label:o.label})),r=Gt().open({anchor:e,presentation:"popover",className:this.columnMenuPanelClass||void 0,trapFocus:!1,restoreFocus:!1}),n=document.createElement(mt);n.columns=t,n.hiddenColumns=[...this.effectiveHidden],n.addEventListener(ei,this.onColumnMenuCheck),n.addEventListener("mndwpaneldismiss",this.onColumnMenuDismiss),r.contentElement.appendChild(n),this.menuLayer=r,n.updateComplete.then(()=>{this.menuLayer===r&&(r.reposition(),n.focusFirstOption())}),r.closed.then(()=>{this.forgetColumnMenu()})}closeColumnMenu(){this.menuLayer?.close(),this.forgetColumnMenu()}forgetColumnMenu(){this.menuLayer=null}onColumnMenuCheck=e=>{let t=e.detail.hidden;if(this.hiddenColumns!==void 0){this.applyColumnVisibility(t);return}this.visibilityState.applyInternal(t),this.internalVisibilityNeedsReconcile=!0,this.requestUpdate(),this.applyColumnVisibility(t)};onColumnMenuDismiss=e=>{let t=e.detail.restoreFocus;this.closeColumnMenu(),t&&this.shadowRoot?.querySelector('[part="column-menu-trigger"]')?.focus()}};function Aa(){function i(e){return e}return i}var Ra=[[Cr,Ve],[Rr,Ge],[kr,Ke],[Ht,We],[Dr,qe],[Or,je],[Mr,Ue],[Xe,Ye],[Kr,tt],[Qe,Ze],[Gr,et],[Me,rt],[qr,nt],[Tr,ze],[Yr,ot],[Ar,Be],[Xr,at],[Ae,st],[W,lt],[Jr,dt],[Zr,ct],[Yt,ht],[bt,ft],[mt,pt]];function Fc(i){i?.initialLocale!==void 0&&yr(i.initialLocale),i?.overlay&&bn(nn(i.overlay)),i?.iconSpriteUrl!==void 0&&Yi(i.iconSpriteUrl);for(let[e,t]of Ra)customElements.get(e)||customElements.define(e,t)}export{K as DETAIL_COL_ID,k as LocaleController,Cr as MNDW_BAR_CHART_TAG,Rr as MNDW_BUTTON_TAG,kr as MNDW_CHECKBOX_TAG,mt as MNDW_COLUMN_MENU_TAG,ii as MNDW_COLUMN_VISIBILITY_CHANGE_EVENT,ni as MNDW_ERROR_EVENT,Ht as MNDW_FIELD_TAG,Tr as MNDW_HEAT_STRIP_TAG,Gi as MNDW_ICON_NAMES,Dr as MNDW_ICON_TAG,Or as MNDW_INPUT_TAG,tn as MNDW_INPUT_TYPES,Ft as MNDW_LABEL_CHANGE_EVENT,Mr as MNDW_LINE_CHART_TAG,Je as MNDW_OPTION_CHANGE_EVENT,Xe as MNDW_OPTION_TAG,oi as MNDW_ROW_EXPAND_EVENT,ri as MNDW_ROW_REORDER_EVENT,Kr as MNDW_SCROLL_AREA_TAG,qr as MNDW_SEGMENTED_TAG,it as MNDW_SEGMENT_CHANGE_EVENT,Me as MNDW_SEGMENT_TAG,Xt as MNDW_SELECTION_CHANGE_EVENT,Qe as MNDW_SELECT_PANEL_TAG,Gr as MNDW_SELECT_TAG,Yr as MNDW_SLIDER_TAG,ti as MNDW_SORT_CHANGE_EVENT,Ar as MNDW_SPARKLINE_TAG,Xr as MNDW_SWITCH_TAG,bt as MNDW_TABLE_TAG,Jr as MNDW_TABS_TAG,Ae as MNDW_TAB_PANEL_TAG,W as MNDW_TAB_TAG,Zr as MNDW_TEXTAREA_TAG,Yt as MNDW_TOOLTIP_TAG,$o as MOBILE_OVERLAY_MAX_WIDTH,Ve as MndwBarChart,Ge as MndwButton,Ke as MndwCheckbox,pt as MndwColumnMenu,We as MndwField,ze as MndwHeatStrip,qe as MndwIcon,je as MndwInput,Ue as MndwLineChart,Ye as MndwOption,tt as MndwScrollArea,rt as MndwSegment,nt as MndwSegmented,et as MndwSelect,Ze as MndwSelectPanel,ot as MndwSlider,Be as MndwSparkline,at as MndwSwitch,lt as MndwTab,st as MndwTabPanel,ft as MndwTable,dt as MndwTabs,ct as MndwTextarea,ht as MndwTooltip,Oo as POPOVER_ANCHOR_GAP,Ut as POPOVER_FLIP_ORDER,Ho as SELECT_ANCHOR_GAP,Fo as SELECT_MOBILE_MAX_WIDTH,Ir as SELECT_VIEWPORT_PADDING,Io as VIEWPORT_PADDING,zr as availablePopoverHeight,Bo as coercePlacement,Aa as column,Ee as composedContains,Fr as computePopoverCoords,Hr as computeTooltipCoords,Bt as createFocusTrap,J as createGeneratedAttribute,D as createLocalizedProperty,Ce as deepActiveElement,Fc as defineMndwUi,de as formatSpeed,mo as getMndwUiLocale,w as getMndwUiText,Uo as isMobileSheet,Xi as mndwIconHref,Ko as resolveSizing,Vr as selectPresentation,yr as setMndwUiLocale,Pr as subscribeMndwIconSprite,Sr as subscribeMndwUiLocale,Ur as tabbableElements};
|
|
1749
|
-
/*! Bundled license information:
|
|
1750
|
-
|
|
1751
|
-
@lit/reactive-element/css-tag.js:
|
|
1752
|
-
(**
|
|
1753
|
-
* @license
|
|
1754
|
-
* Copyright 2019 Google LLC
|
|
1755
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1756
|
-
*)
|
|
1757
|
-
|
|
1758
|
-
@lit/reactive-element/reactive-element.js:
|
|
1759
|
-
lit-html/lit-html.js:
|
|
1760
|
-
lit-element/lit-element.js:
|
|
1761
|
-
lit-html/directive.js:
|
|
1762
|
-
lit-html/directives/repeat.js:
|
|
1763
|
-
(**
|
|
1764
|
-
* @license
|
|
1765
|
-
* Copyright 2017 Google LLC
|
|
1766
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1767
|
-
*)
|
|
1768
|
-
|
|
1769
|
-
lit-html/is-server.js:
|
|
1770
|
-
(**
|
|
1771
|
-
* @license
|
|
1772
|
-
* Copyright 2022 Google LLC
|
|
1773
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1774
|
-
*)
|
|
1775
|
-
|
|
1776
|
-
lit-html/directive-helpers.js:
|
|
1777
|
-
(**
|
|
1778
|
-
* @license
|
|
1779
|
-
* Copyright 2020 Google LLC
|
|
1780
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
1781
|
-
*)
|
|
1782
|
-
*/
|