@commmerce/ui 1.7.2 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +27 -4
- package/dist/cdn.js +256 -239
- package/dist/components/action-menu.js +19 -3
- package/dist/components/board.js +1 -2
- package/dist/components/button.js +5 -3
- package/dist/components/combobox.d.ts +1 -1
- package/dist/components/data-table.js +1 -1
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/date-range-picker.d.ts +1 -1
- package/dist/components/resource-list.d.ts +1 -1
- package/dist/components/resource-list.js +3 -1
- package/dist/components/select.d.ts +4 -3
- package/dist/components/select.js +3 -2
- package/dist/components/side-navigation.js +4 -2
- package/dist/components/signature-field.js +2 -2
- package/dist/components/text-field.d.ts +1 -1
- package/dist/components/text-field.js +2 -2
- package/dist/components/timeline.js +13 -4
- package/dist/custom-elements.json +19 -13
- package/dist/field.js +3 -0
- package/package.json +3 -3
package/dist/cdn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(o,n,e)=>(Uh(o,n,"read from private field"),e?e.call(o):n.get(o)),p=(o,n,e)=>n.has(o)?Ru("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),g=(o,n,e,t)=>(Uh(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),s=(o,n,e)=>(Uh(o,n,"access private method"),e);var Zl=globalThis,Ql=Zl.ShadowRoot&&(Zl.ShadyCSS===void 0||Zl.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vh=Symbol(),Hu=new WeakMap,_n=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==Vh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=n,this.t=e}get styleSheet(){let n=this.o,e=this.t;if(Ql&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=Hu.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&Hu.set(e,n))}return n}toString(){return this.cssText}},ec=o=>new _n(typeof o=="string"?o:o+"",void 0,Vh),x=(o,...n)=>{let e=o.length===1?o[0]:n.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[a+1],o[0]);return new _n(e,o,Vh)},Nu=(o,n)=>{if(Ql)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=Zl.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Kh=Ql?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return ec(e)})(o):o;var{is:
|
|
1
|
+
var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(o,n,e)=>(Uh(o,n,"read from private field"),e?e.call(o):n.get(o)),p=(o,n,e)=>n.has(o)?Ru("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),g=(o,n,e,t)=>(Uh(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),s=(o,n,e)=>(Uh(o,n,"access private method"),e);var Zl=globalThis,Ql=Zl.ShadowRoot&&(Zl.ShadyCSS===void 0||Zl.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vh=Symbol(),Hu=new WeakMap,_n=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==Vh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=n,this.t=e}get styleSheet(){let n=this.o,e=this.t;if(Ql&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=Hu.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&Hu.set(e,n))}return n}toString(){return this.cssText}},ec=o=>new _n(typeof o=="string"?o:o+"",void 0,Vh),x=(o,...n)=>{let e=o.length===1?o[0]:n.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[a+1],o[0]);return new _n(e,o,Vh)},Nu=(o,n)=>{if(Ql)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=Zl.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Kh=Ql?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return ec(e)})(o):o;var{is:Sv,defineProperty:Lv,getOwnPropertyDescriptor:Dv,getOwnPropertyNames:Av,getOwnPropertySymbols:Rv,getPrototypeOf:Hv}=Object,tc=globalThis,Iu=tc.trustedTypes,Nv=Iu?Iu.emptyScript:"",Iv=tc.reactiveElementPolyfillSupport,Cn=(o,n)=>o,Wh={toAttribute(o,n){switch(n){case Boolean:o=o?Nv:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,n){let e=o;switch(n){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Ou=(o,n)=>!Sv(o,n),Pu={attribute:!0,type:String,converter:Wh,reflect:!1,useDefault:!1,hasChanged:Ou};Symbol.metadata??=Symbol("metadata"),tc.litPropertyMetadata??=new WeakMap;var _t=class extends HTMLElement{static addInitializer(n){this._$Ei(),(this.l??=[]).push(n)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(n,e=Pu){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(n)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(n,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(n,t,e);i!==void 0&&Lv(this.prototype,n,i)}}static getPropertyDescriptor(n,e,t){let{get:i,set:a}=Dv(this.prototype,n)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let d=i?.call(this);a?.call(this,l),this.requestUpdate(n,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(n){return this.elementProperties.get(n)??Pu}static _$Ei(){if(this.hasOwnProperty(Cn("elementProperties")))return;let n=Hv(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(Cn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Cn("properties"))){let e=this.properties,t=[...Av(e),...Rv(e)];for(let i of t)this.createProperty(i,e[i])}let n=this[Symbol.metadata];if(n!==null){let e=litPropertyMetadata.get(n);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(n){let e=[];if(Array.isArray(n)){let t=new Set(n.flat(1/0).reverse());for(let i of t)e.unshift(Kh(i))}else n!==void 0&&e.push(Kh(n));return e}static _$Eu(n,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof n=="string"?n.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(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(n=>n(this))}addController(n){(this._$EO??=new Set).add(n),this.renderRoot!==void 0&&this.isConnected&&n.hostConnected?.()}removeController(n){this._$EO?.delete(n)}_$E_(){let n=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(n.set(t,this[t]),delete this[t]);n.size>0&&(this._$Ep=n)}createRenderRoot(){let n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nu(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(n=>n.hostConnected?.())}enableUpdating(n){}disconnectedCallback(){this._$EO?.forEach(n=>n.hostDisconnected?.())}attributeChangedCallback(n,e,t){this._$AK(n,t)}_$ET(n,e){let t=this.constructor.elementProperties.get(n),i=this.constructor._$Eu(n,t);if(i!==void 0&&t.reflect===!0){let a=(t.converter?.toAttribute!==void 0?t.converter:Wh).toAttribute(e,t.type);this._$Em=n,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(n,e){let t=this.constructor,i=t._$Eh.get(n);if(i!==void 0&&this._$Em!==i){let a=t.getPropertyOptions(i),l=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Wh;this._$Em=i;let d=l.fromAttribute(e,a.type);this[i]=d??this._$Ej?.get(i)??d,this._$Em=null}}requestUpdate(n,e,t,i=!1,a){if(n!==void 0){let l=this.constructor;if(i===!1&&(a=this[n]),t??=l.getPropertyOptions(n),!((t.hasChanged??Ou)(a,e)||t.useDefault&&t.reflect&&a===this._$Ej?.get(n)&&!this.hasAttribute(l._$Eu(n,t))))return;this.C(n,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(n,e,{useDefault:t,reflect:i,wrapped:a},l){t&&!(this._$Ej??=new Map).has(n)&&(this._$Ej.set(n,l??e??this[n]),a!==!0||l!==void 0)||(this._$AL.has(n)||(this.hasUpdated||t||(e=void 0),this._$AL.set(n,e)),i===!0&&this._$Em!==n&&(this._$Eq??=new Set).add(n))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let n=this.scheduleUpdate();return n!=null&&await n,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,a]of t){let{wrapped:l}=a,d=this[i];l!==!0||this._$AL.has(i)||d===void 0||this.C(i,void 0,a,d)}}let n=!1,e=this._$AL;try{n=this.shouldUpdate(e),n?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw n=!1,this._$EM(),t}n&&this._$AE(e)}willUpdate(n){}_$AE(n){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(n)),this.updated(n)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(n){return!0}update(n){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(n){}firstUpdated(n){}};_t.elementStyles=[],_t.shadowRootOptions={mode:"open"},_t[Cn("elementProperties")]=new Map,_t[Cn("finalized")]=new Map,Iv?.({ReactiveElement:_t}),(tc.reactiveElementVersions??=[]).push("2.1.2");var Yh=globalThis,qu=o=>o,ic=Yh.trustedTypes,Bu=ic?ic.createPolicy("lit-html",{createHTML:o=>o}):void 0,Xh="$lit$",Ct=`lit$${Math.random().toFixed(9).slice(2)}$`,Jh="?"+Ct,Pv=`<${Jh}>`,Pi=document,Ln=()=>Pi.createComment(""),Dn=o=>o===null||typeof o!="object"&&typeof o!="function",Zh=Array.isArray,Wu=o=>Zh(o)||typeof o?.[Symbol.iterator]=="function",Gh=`[
|
|
2
2
|
\f\r]`,Sn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fu=/-->/g,ju=/>/g,Ni=RegExp(`>|${Gh}(?:([^\\s"'>=/]+)(${Gh}*=${Gh}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Uu=/'/g,Vu=/"/g,Gu=/^(?:script|style|textarea|title)$/i,Qh=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=Qh(1),Rn=Qh(2),
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Uu=/'/g,Vu=/"/g,Gu=/^(?:script|style|textarea|title)$/i,Qh=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=Qh(1),Rn=Qh(2),By=Qh(3),we=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Ku=new WeakMap,Ii=Pi.createTreeWalker(Pi,129);function Yu(o,n){if(!Zh(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bu!==void 0?Bu.createHTML(n):n}var Xu=(o,n)=>{let e=o.length-1,t=[],i,a=n===2?"<svg>":n===3?"<math>":"",l=Sn;for(let d=0;d<e;d++){let m=o[d],u,v,b=-1,w=0;for(;w<m.length&&(l.lastIndex=w,v=l.exec(m),v!==null);)w=l.lastIndex,l===Sn?v[1]==="!--"?l=Fu:v[1]!==void 0?l=ju:v[2]!==void 0?(Gu.test(v[2])&&(i=RegExp("</"+v[2],"g")),l=Ni):v[3]!==void 0&&(l=Ni):l===Ni?v[0]===">"?(l=i??Sn,b=-1):v[1]===void 0?b=-2:(b=l.lastIndex-v[2].length,u=v[1],l=v[3]===void 0?Ni:v[3]==='"'?Vu:Uu):l===Vu||l===Uu?l=Ni:l===Fu||l===ju?l=Sn:(l=Ni,i=void 0);let y=l===Ni&&o[d+1].startsWith("/>")?" ":"";a+=l===Sn?m+Pv:b>=0?(t.push(u),m.slice(0,b)+Xh+m.slice(b)+Ct+y):m+Ct+(b===-2?d:y)}return[Yu(o,a+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},An=class o{constructor({strings:n,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,d=n.length-1,m=this.parts,[u,v]=Xu(n,e);if(this.el=o.createElement(u,t),Ii.currentNode=this.el.content,e===2||e===3){let b=this.el.content.firstChild;b.replaceWith(...b.childNodes)}for(;(i=Ii.nextNode())!==null&&m.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let b of i.getAttributeNames())if(b.endsWith(Xh)){let w=v[l++],y=i.getAttribute(b).split(Ct),M=/([.?@])?(.*)/.exec(w);m.push({type:1,index:a,name:M[2],strings:y,ctor:M[1]==="."?ac:M[1]==="?"?sc:M[1]==="@"?nc:qi}),i.removeAttribute(b)}else b.startsWith(Ct)&&(m.push({type:6,index:a}),i.removeAttribute(b));if(Gu.test(i.tagName)){let b=i.textContent.split(Ct),w=b.length-1;if(w>0){i.textContent=ic?ic.emptyScript:"";for(let y=0;y<w;y++)i.append(b[y],Ln()),Ii.nextNode(),m.push({type:2,index:++a});i.append(b[w],Ln())}}}else if(i.nodeType===8)if(i.data===Jh)m.push({type:2,index:a});else{let b=-1;for(;(b=i.data.indexOf(Ct,b+1))!==-1;)m.push({type:7,index:a}),b+=Ct.length-1}a++}}static createElement(n,e){let t=Pi.createElement("template");return t.innerHTML=n,t}};function Oi(o,n,e=o,t){if(n===we)return n;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Dn(n)?void 0:n._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(n=Oi(o,i._$AS(o,n.values),i,t)),n}var rc=class{constructor(n,e){this._$AV=[],this._$AN=void 0,this._$AD=n,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(n){let{el:{content:e},parts:t}=this._$AD,i=(n?.creationScope??Pi).importNode(e,!0);Ii.currentNode=i;let a=Ii.nextNode(),l=0,d=0,m=t[0];for(;m!==void 0;){if(l===m.index){let u;m.type===2?u=new qr(a,a.nextSibling,this,n):m.type===1?u=new m.ctor(a,m.name,m.strings,this,n):m.type===6&&(u=new oc(a,this,n)),this._$AV.push(u),m=t[++d]}l!==m?.index&&(a=Ii.nextNode(),l++)}return Ii.currentNode=Pi,i}p(n){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(n,t,e),e+=t.strings.length-2):t._$AI(n[e])),e++}},qr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(n,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=n,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let n=this._$AA.parentNode,e=this._$AM;return e!==void 0&&n?.nodeType===11&&(n=e.parentNode),n}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(n,e=this){n=Oi(this,n,e),Dn(n)?n===h||n==null||n===""?(this._$AH!==h&&this._$AR(),this._$AH=h):n!==this._$AH&&n!==we&&this._(n):n._$litType$!==void 0?this.$(n):n.nodeType!==void 0?this.T(n):Wu(n)?this.k(n):this._(n)}O(n){return this._$AA.parentNode.insertBefore(n,this._$AB)}T(n){this._$AH!==n&&(this._$AR(),this._$AH=this.O(n))}_(n){this._$AH!==h&&Dn(this._$AH)?this._$AA.nextSibling.data=n:this.T(Pi.createTextNode(n)),this._$AH=n}$(n){let{values:e,_$litType$:t}=n,i=typeof t=="number"?this._$AC(n):(t.el===void 0&&(t.el=An.createElement(Yu(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new rc(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(n){let e=Ku.get(n.strings);return e===void 0&&Ku.set(n.strings,e=new An(n)),e}k(n){Zh(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of n)i===e.length?e.push(t=new o(this.O(Ln()),this.O(Ln()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(n=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);n!==this._$AB;){let t=qu(n).nextSibling;qu(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},qi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(n,e,t,i,a){this.type=1,this._$AH=h,this._$AN=void 0,this.element=n,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(n,e=this,t,i){let a=this.strings,l=!1;if(a===void 0)n=Oi(this,n,e,0),l=!Dn(n)||n!==this._$AH&&n!==we,l&&(this._$AH=n);else{let d=n,m,u;for(n=a[0],m=0;m<a.length-1;m++)u=Oi(this,d[t+m],e,m),u===we&&(u=this._$AH[m]),l||=!Dn(u)||u!==this._$AH[m],u===h?n=h:n!==h&&(n+=(u??"")+a[m+1]),this._$AH[m]=u}l&&!i&&this.j(n)}j(n){n===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}},ac=class extends qi{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},sc=class extends qi{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},nc=class extends qi{constructor(n,e,t,i,a){super(n,e,t,i,a),this.type=5}_$AI(n,e=this){if((n=Oi(this,n,e,0)??h)===we)return;let t=this._$AH,i=n===h&&t!==h||n.capture!==t.capture||n.once!==t.once||n.passive!==t.passive,a=n!==h&&(t===h||i);i&&this.element.removeEventListener(this.name,this,t),a&&this.element.addEventListener(this.name,this,n),this._$AH=n}handleEvent(n){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,n):this._$AH.handleEvent(n)}},oc=class{constructor(n,e,t){this.element=n,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(n){Oi(this,n)}},Ju={M:Xh,P:Ct,A:Jh,C:1,L:Xu,R:rc,D:Wu,V:Oi,I:qr,H:qi,N:sc,U:nc,B:ac,F:oc},Ov=Yh.litHtmlPolyfillSupport;Ov?.(An,qr),(Yh.litHtmlVersions??=[]).push("3.3.3");var Zu=(o,n,e)=>{let t=e?.renderBefore??n,i=t._$litPart$;if(i===void 0){let a=e?.renderBefore??null;t._$litPart$=i=new qr(n.insertBefore(Ln(),a),a,void 0,e??{})}return i._$AI(o),i};var em=globalThis,S=class extends _t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let n=super.createRenderRoot();return this.renderOptions.renderBefore??=n.firstChild,n}update(n){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(n),this._$Do=Zu(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return we}};S._$litElement$=!0,S.finalized=!0,em.litElementHydrateSupport?.({LitElement:S});var qv=em.litElementPolyfillSupport;qv?.({LitElement:S});(em.litElementVersions??=[]).push("4.2.2");var k=x`
|
|
4
4
|
:host {
|
|
5
5
|
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
6
|
color: var(--cm-text-default, #000);
|
|
@@ -8,24 +8,26 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,tx=x`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
14
|
+
`,Bv=0,A=o=>`${o}-${++Bv}`;function $(o,n){customElements.get(o)||customElements.define(o,n)}function J(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Fv={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},lc={common:{...Fv}},Hn={},Nn={},cc;function z(o,n){return lc[o]={...lc[o],...n},n}function jv(){return Object.fromEntries(Object.entries(lc).map(([o,n])=>[o,{...n}]))}function dc(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function Uv(o,n){dc(n?Nn[n.toLowerCase()]??={}:Hn,o),pc()}function Vv(o={}){"locale"in o&&(cc=o.locale||void 0),o.strings&&dc(Hn,o.strings);for(let[n,e]of Object.entries(o.translations??{}))dc(Nn[n.toLowerCase()]??={},e);pc()}function Kv(){cc=void 0;for(let o of Object.keys(Hn))delete Hn[o];for(let o of Object.keys(Nn))delete Nn[o];pc()}function In(o){if(cc)return cc;let n=o;for(;n;){if(n instanceof Element&&n.hasAttribute("lang")&&n.getAttribute("lang"))return n.getAttribute("lang");n=n.parentNode??(n instanceof ShadowRoot?n.host:null)}if(typeof document<"u"&&document.documentElement.lang)return document.documentElement.lang}var Qu=new Map;function rm(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,a=Qu.get(i);if(!a){try{a=t(n)}catch{a=t(void 0)}Qu.set(i,a)}return a}function am(o,n={},e){return rm("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function ae(o,n={},e){return rm("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function hc(o,n){return rm("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function eg(o,n={},e){if(o==null)return"";if(typeof o=="function")return String(o(n));let t;if(typeof o=="object"){let i=Number(n.count??0);t=o[hc(i,e)]??o.other??""}else t=String(o);return t.replace(/\{(\w+)\}/g,(i,a)=>{let l=n[a];return l===void 0?i:typeof l=="number"?am(l,{},e):String(l)})}function Wv(o,n,e,t){if(t&&t[n]!==void 0)return t[n];let i=[];if(e){let a=e.toLowerCase().split("-");for(let l=a.length;l>0;l--)i.push(a.slice(0,l).join("-"))}for(let a of o==="common"?["common"]:[o,"common"]){for(let d of i){let m=Nn[d]?.[a]?.[n];if(m!==void 0)return m}let l=Hn[a]?.[n]??lc[a]?.[n];if(l!==void 0)return l}}function mc(o,n,e,t,i){let a=In(t);return eg(Wv(o,n,a,i),e,a)}var im=new Set,tm;function pc(){for(let o of im)o.requestUpdate()}function Gv(){tm||typeof MutationObserver>"u"||typeof document>"u"||(tm=new MutationObserver(pc),tm.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var Yv=o=>o.replace(/^cm-/,"").replace(/-([a-z])/g,(n,e)=>e.toUpperCase()),T=class extends S{static finalize(){let n=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);if(!n(this,"finalized")&&n(this,"properties"))for(let[e,t]of Object.entries(this.properties)){let i=t.string;if(!i||n(this.prototype,e))continue;let a=Symbol(e);Object.defineProperty(this.prototype,e,{get(){return this[a]??this.t(i)},set(l){this[a]=l},configurable:!0,enumerable:!0})}super.finalize()}get stringsNamespace(){return Yv(this.localName)}t(n,e){return mc(this.stringsNamespace,n,e,this,this.strings)}get locale(){return In(this)}formatNumber(n,e){return am(n,e,this.locale)}connectedCallback(){super.connectedCallback(),im.add(this),Gv()}disconnectedCallback(){super.disconnectedCallback(),im.delete(this)}};T.properties={strings:{type:Object}};var uc={"chevron-down":"M6 9l6 6 6-6","chevron-up":"M6 15l6-6 6 6","chevron-right":"M9 6l6 6-6 6","chevron-left":"M15 6l-6 6 6 6",close:"M6 6l12 12M18 6L6 18",search:"M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM16 16l4 4",filter:"M4 7h16M7 12h10M10 17h4",edit:"M4 20h4L19 9l-4-4L4 16v4zM14 6l4 4",trash:"M5 7h14M10 7V5h4v2M7 7l1 13h8l1-13M10 11v6M14 11v6","arrow-up-right":"M7 17L17 7M9 7h8v8",calendar:"M5 6h14v14H5zM5 10h14M9 4v4M15 4v4",upload:"M12 16V6M8 10l4-4 4 4M5 18h14",plus:"M12 5v14M5 12h14",check:"M5 12.5l4.5 4.5L19 7",bell:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15zM10 20h4",help:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6M12 17h.01",rocket:"M14 4c3 0 6 3 6 6l-6 6-6-6c0-3 3-6 6-6zM8 16l-3 3M10 18l-2 3M6 14l-3 2",home:"M4 11l8-7 8 7v9h-5v-6H9v6H4z",box:"M4 8l8-4 8 4v8l-8 4-8-4zM4 8l8 4 8-4M12 12v8",cart:"M5 8h14l-1 12H6zM9 8V6a3 3 0 0 1 6 0v2",more:"M6 12h.01M12 12h.01M18 12h.01",drag:"M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01","eye-off":"M3 3l18 18M10.6 6.1A9 9 0 0 1 21 12a14 14 0 0 1-2.2 2.9M6.6 6.6A14 14 0 0 0 3 12s3 6 9 6a8 8 0 0 0 4-1",external:"M14 5h5v5M19 5l-8 8M18 14v5H5V6h5",users:"M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM2 21v-1a7 7 0 0 1 14 0v1M17 11a3 3 0 1 0 0-6M22 21v-1a5 5 0 0 0-4-5",chart:"M5 20V10M12 20V4M19 20v-7",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM4 12h2M18 12h2M12 4v2M12 18v2M6.3 6.3l1.4 1.4M16.3 16.3l1.4 1.4M6.3 17.7l1.4-1.4M16.3 7.7l1.4-1.4",store:"M4 9l1-5h14l1 5M4 9h16v11H4zM9 20v-6h6v6",pin:"M15 4l5 5-3 1-4 4 1 4-2 2-4-4-4 4M8 12l4-4 1-3",clock:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM12 7v5l3 2",alert:"M12 4l9 16H3zM12 10v4M12 17h.01","check-circle":"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM8 12l3 3 5-6","x-circle":"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM9 9l6 6M15 9l-6 6",bag:"M6 8h12l1 12H5zM9 8a3 3 0 0 1 6 0",sun:"M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4",moon:"M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z",menu:"M4 7h16M4 12h16M4 17h16",copy:"M9 9h11v11H9zM5 15H4V4h11v1",code:"M8 8l-4 4 4 4M16 8l4 4-4 4M14 5l-4 14",download:"M12 4v11M7.5 10.5L12 15l4.5-4.5M5 19h14",book:"M5 5a2 2 0 0 1 2-2h12v15H7a2 2 0 0 0-2 2zM5 20a2 2 0 0 0 2 2h12v-4",pos:"M5 4h14v8H5zM3 16h18v4H3zM8 8h4M12 12v4",website:"M3 5h18v14H3zM3 9h18M9 13h6M9 16h4",apps:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z",megaphone:"M4 10v4h3l8 5V5l-8 5zM18.5 9a4 4 0 0 1 0 6M7 14l1 5h3l-1-4",staff:"M5 4h14v17H5zM9 4V2h6v2M12 13a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zM8 18a4 4 0 0 1 8 0",repeat:"M17 3l3 3-3 3M4 11V9a3 3 0 0 1 3-3h13M7 21l-3-3 3-3M20 13v2a3 3 0 0 1-3 3H4",wallet:"M4 6h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4zM4 6V5a1 1 0 0 1 1-1h11v2M15 13h2",user:"M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",star:"M12 3l2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",percent:"M19 5L5 19M7 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM17 19a2 2 0 1 0 0-4 2 2 0 0 0 0 4z","arrow-left":"M19 12H5M11 6l-6 6 6 6",send:"M21 3L10 14M21 3l-7 18-4-7-7-4z",link:"M10 14a4 4 0 0 0 6 0l3-3a4 4 0 0 0-6-6l-1 1M14 10a4 4 0 0 0-6 0l-3 3a4 4 0 0 0 6 6l1-1",share:"M18 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM8.6 13.5l6.8 4M15.4 6.5l-6.8 4",globe:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18",gift:"M4 11h16v9H4zM3 7h18v4H3zM12 7v13M12 7c-2 0-4-1-4-3s3-1 4 3c1-4 4-5 4-3s-2 3-4 3",mail:"M3 6h18v12H3zM3 6l9 7 9-7",chat:"M4 5h16v11h-9l-4 4v-4H4zM8 9.5h8M8 12.5h5",tag:"M4 4h7l9 9-7 7-9-9zM8.5 10a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",building:"M3 21h18M5 21V4h9v17M14 10h5v11M8 8h3M8 12h3M8 16h3",map:"M3 6l6-2 6 2 6-2v14l-6 2-6-2-6 2zM9 4v14M15 6v14",note:"M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 15h6M9 18h4",eye:"M3 12s3-6 9-6 9 6 9 6-3 6-9 6-9-6-9-6zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",inbox:"M3 13l3-8h12l3 8v6H3zM3 13h5l1 3h6l1-3h5",handshake:"M3 7v8M21 7v8M3 9l5-3h4l-3 3.5a1.5 1.5 0 0 0 2.2 2L13 9.5l5 5M21 9l-4-3h-5M3 15h2l5 4a1.4 1.4 0 0 0 2-2M10 15l3.5 3a1.4 1.4 0 0 0 2-2l-1.5-1.5","log-out":"M10 4H5v16h5M14 8l4 4-4 4M18 12H9",refresh:"M20 12a8 8 0 0 0-14.9-4M4 12a8 8 0 0 0 14.9 4M5 3.5V8h4.5M19 20.5V16h-4.5",tasks:"M5 5h14v14H5zM8.5 12l2.5 2.5 4.5-5",phone:"M5 4h3.5l1.5 4.5-2 1.5a11 11 0 0 0 6 6l1.5-2 4.5 1.5V19a1.5 1.5 0 0 1-1.5 1.5A15.5 15.5 0 0 1 3.5 5.5 1.5 1.5 0 0 1 5 4z",camera:"M3 8.5A1.5 1.5 0 0 1 4.5 7h3L9 4.5h6L16.5 7h3A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5zM12 16.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",image:"M4 5h16v14H4zM4 16l4.5-4.5 4 4 2.5-2.5 5 5M15.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z","id-card":"M3 6h18v12H3zM8.5 11.5a1.75 1.75 0 1 0 0-3.5 1.75 1.75 0 0 0 0 3.5zM5.5 16a3 3 0 0 1 6 0M14 9.5h4M14 12.5h4M14 15.5h2.5",navigation:"M20 4l-6.5 16-2.5-7-7-2.5z","wifi-off":"M8.9 16.9a4 4 0 0 1 3.3-1.4M5.9 14.4a8 8 0 0 1 3-2.3M15.6 12.4a8 8 0 0 1 2.5 2M2.8 11.8a12 12 0 0 1 3-2.6M10.8 7.6a12 12 0 0 1 10.4 4.2M12 19.5h.01M3 3l18 18"},tg=["more","drag"],sx=Object.keys(uc);var ig=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],Br=class extends S{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=uc[this.name]??uc.more,t=tg.includes(this.name)?3:1.6;return Rn`<svg width=${this.size} height=${this.size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
15
15
|
stroke-width=${t} stroke-linecap="round" stroke-linejoin="round"
|
|
16
16
|
role=${this.label?"img":h} aria-label=${this.label||h} aria-hidden=${this.label?h:"true"}
|
|
17
17
|
part="svg" class=${(this.mirror==="auto"?ig.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Br.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Br.styles=x`
|
|
18
18
|
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
19
19
|
svg { display: block; }
|
|
20
20
|
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
21
|
-
`;$("cm-icon",Br);var rg=99,
|
|
21
|
+
`;$("cm-icon",Br);var rg=99,ux=z("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),gc,bc,Pn,Bi=class extends T{constructor(){super();this.variant="secondary";this.size="medium";this.type="button";this.disabled=!1;this.loading=!1;this.iconOnly=!1;this.icon="";this.label="";this.count=0;p(this,gc,this.attachInternals());p(this,bc,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,gc).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});p(this,Pn,!1);this.addEventListener("click",r(this,bc),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,Pn)&&(g(this,Pn,!0),console.warn("cm-button: an icon-only button needs a `label` (its accessible name).",this))}render(){let e=Number.isFinite(this.count)&&this.count>0?Math.floor(this.count):0,t=this.loading?c`<span class="spinner" aria-hidden="true"></span>`:c`<slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:h}</slot>`,i=this.iconOnly?c`<span class="vh"><slot></slot></span>`:c`<span class="text"><slot></slot></span>`,a=e?c`<span class="count" part="count" aria-hidden="true">${e>rg?this.t("countOverflow",{max:rg}):this.formatNumber(e)}</span>${this.iconOnly?h:c`<span class="vh"> ${this.t("count",{count:e})}</span>`}`:h,l=this.iconOnly&&(this.label||this.textContent?.trim())||"",d=!this.iconOnly||!l?h:e?this.t("labelWithCount",{label:l,count:e}):this.label||h,m=c`${t}${i}${a}`;return this.href&&!this.disabled?c`<a class="btn" part="control" href=${this.href} target=${this.target??h}
|
|
22
22
|
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${m}</a>`:c`<button class="btn" part="control" type="button"
|
|
23
23
|
?disabled=${this.disabled} aria-disabled=${this.loading?"true":h}
|
|
24
24
|
aria-busy=${this.loading?"true":h} aria-label=${d}>${m}</button>`}};gc=new WeakMap,bc=new WeakMap,Pn=new WeakMap,Bi.formAssociated=!0,Bi.properties={variant:{reflect:!0},size:{reflect:!0},type:{},disabled:{type:Boolean,reflect:!0},loading:{type:Boolean,reflect:!0},href:{},target:{},iconOnly:{type:Boolean,reflect:!0,attribute:"icon-only"},icon:{},label:{},count:{type:Number},tone:{reflect:!0}},Bi.styles=[k,x`
|
|
25
|
-
:host { display: inline-flex; vertical-align: middle; }
|
|
25
|
+
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
26
|
+
/* A label longer than the room (a button in a narrow card) ends with an ellipsis instead of spilling out (1.8.1). */
|
|
27
|
+
.text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
26
28
|
.btn {
|
|
27
29
|
position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--cm-space-8);
|
|
28
|
-
width: 100%; font: inherit; font-weight: 500; line-height: 1; white-space: nowrap;
|
|
30
|
+
width: 100%; min-width: 0; font: inherit; font-weight: 500; line-height: 1; white-space: nowrap;
|
|
29
31
|
border-radius: var(--cm-radius-sm); border: var(--cm-border-1) solid transparent;
|
|
30
32
|
cursor: pointer; text-decoration: none;
|
|
31
33
|
}
|
|
@@ -123,18 +125,18 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
123
125
|
}
|
|
124
126
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
125
127
|
@media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
|
|
126
|
-
`];$("cm-spinner",jr);var
|
|
128
|
+
`];$("cm-spinner",jr);var _x=z("actionMenu",{label:"Actions"}),qn,Fi,ji,Bn,V,vc,Fn,sm,yc,xc,wc,ag,jn,Un,Ur,$c,sg,nm,ng,Vr=class extends T{constructor(){super(...arguments);p(this,V);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this.loading=!1;this.disabled=!1;this._slotted=[];this._active=-1;this._custom=!1;p(this,qn);p(this,Fi,A("cm-menu"));p(this,ji,"");p(this,Bn,0);p(this,Fn,e=>{this.open&&!e.composedPath().includes(this)&&s(this,V,xc).call(this,!1)});p(this,jn,e=>{this.disabled||(e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0)))});p(this,Un,()=>{this.disabled||(this.open?this.hide():this.show())});p(this,$c,e=>{let t=s(this,V,yc).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),s(this,V,Ur).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),s(this,V,Ur).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),s(this,V,Ur).call(this,t[0]);break;case"End":e.preventDefault(),s(this,V,Ur).call(this,t[t.length-1]);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.hide(!0);break;case"Tab":this.hide();break;default:if(e.key.length===1&&/\S/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let a=Date.now();g(this,ji,(a-r(this,Bn)<600?r(this,ji):"")+e.key.toLowerCase()),g(this,Bn,a);let l=this.menuItems,d=r(this,ji).length>1?i:i+1,u=[...t.slice(Math.max(d,0)),...t.slice(0,Math.max(d,0))].find(v=>(l[v].label??"").toLowerCase().startsWith(r(this,ji)));u!==void 0&&s(this,V,Ur).call(this,u)}}})}connectedCallback(){super.connectedCallback(),s(this,V,vc).call(this),g(this,qn,fc(this,()=>s(this,V,vc).call(this))),document.addEventListener("pointerdown",r(this,Fn),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,qn)?.disconnect(),document.removeEventListener("pointerdown",r(this,Fn),!0)}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=s(this,V,yc).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,s(this,V,xc).call(this,!0),this.updateComplete.then(()=>s(this,V,wc).call(this))}hide(e=!1){s(this,V,xc).call(this,!1),e&&s(this,V,sm).call(this)?.focus()}updated(e){if(e.has("open")&&this.open&&s(this,V,ag).call(this),this._custom){let t=s(this,V,sm).call(this);if(t){let i=(a,l)=>{t.getAttribute(a)!==l&&t.setAttribute(a,l)};i("aria-haspopup","menu"),i("aria-expanded",String(this.open)),i("aria-controls",`${r(this,Fi)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=s(this,V,yc).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>s(this,V,wc).call(this))}}render(){let e=this.menuItems,t=this.triggerLabel||this.label,i=this._custom?c`<slot name="trigger" @click=${r(this,Un)} @keydown=${r(this,jn)} @slotchange=${()=>s(this,V,vc).call(this)}></slot>`:c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
127
129
|
aria-expanded=${String(this.open)} aria-controls="${r(this,Fi)}-m" aria-label=${this.iconOnly?t:h}
|
|
128
130
|
?disabled=${this.disabled} @click=${r(this,Un)} @keydown=${r(this,jn)}>${this.iconOnly?c`<cm-icon name=${this.icon} size="18"></cm-icon>`:c`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return c`${i}
|
|
129
131
|
<div class="pop" part="menu" ?hidden=${!this.open}>
|
|
130
132
|
${this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h}
|
|
131
133
|
<div role="menu" id="${r(this,Fi)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${r(this,$c)}>
|
|
132
|
-
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:s(this,
|
|
134
|
+
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:s(this,V,ng).call(this,e)}
|
|
133
135
|
</div>
|
|
134
136
|
</div>
|
|
135
|
-
<slot hidden></slot>`}};qn=new WeakMap,Fi=new WeakMap,ji=new WeakMap,Bn=new WeakMap,
|
|
137
|
+
<slot hidden></slot>`}};qn=new WeakMap,Fi=new WeakMap,ji=new WeakMap,Bn=new WeakMap,V=new WeakSet,vc=function(){this._slotted=On(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},Fn=new WeakMap,sm=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},yc=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},xc=function(e){this.open!==e&&(this.open=e,e||(this._active=-1),this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:e},bubbles:!0,composed:!0})))},wc=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},ag=function(){let e=this.renderRoot.querySelector(".pop");if(!e)return;e.classList.remove("to-end","to-start");let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,a=8,l=getComputedStyle(this).direction==="rtl",d=l?t.left<a:t.right>i-a,m=l?t.right>i-a:t.left<a;this.align!=="end"&&d?e.classList.add("to-end"):this.align==="end"&&m&&e.classList.add("to-start")},jn=new WeakMap,Un=new WeakMap,Ur=function(e){this._active=e,this.updateComplete.then(()=>s(this,V,wc).call(this))},$c=new WeakMap,sg=function(e,t){if(t.disabled){e.preventDefault();return}let i=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));i||e.preventDefault(),this.hide(!t.href||!i)},nm=function(e,t){if(e.divider)return c`<div role="separator"></div>`;let i=`item${e.critical?" critical":""}${t===this._active?" active":""}`,a=c`${e.icon?c`<cm-icon name=${e.icon} size="16"></cm-icon>`:h}<span class="label">${e.label}</span>${e.shortcut?c`<span class="shortcut" part="shortcut" aria-hidden="true">${e.shortcut}</span>`:h}`,l={over:()=>{e.disabled||(this._active=t)},click:d=>s(this,V,sg).call(this,d,e)};return e.href&&!e.disabled?c`<a class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
136
138
|
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</a>`:c`<button type="button" class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
137
|
-
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},
|
|
139
|
+
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},ng=function(e){let t=[];for(let i=0;i<e.length;i++){let a=e[i];if(!a.heading){t.push(s(this,V,nm).call(this,a,i));continue}let l=`${r(this,Fi)}-h${i}`,d=[],m=i+1;for(;m<e.length&&!e[m].heading&&!e[m].divider;m++)d.push(s(this,V,nm).call(this,e[m],m));t.push(c`<div role="group" aria-labelledby=${l}><div class="section" part="section" id=${l} role="presentation">${a.label}</div>${d}</div>`),i=m-1}return t},Vr.properties={items:{type:Array},open:{type:Boolean,reflect:!0},label:{string:"label"},triggerLabel:{attribute:"trigger-label"},iconOnly:{type:Boolean,attribute:"icon-only"},icon:{},align:{reflect:!0},heading:{},subheading:{},density:{reflect:!0},loading:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},Vr.styles=[k,x`
|
|
138
140
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
139
141
|
.trigger {
|
|
140
142
|
display: inline-flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-12); font: inherit; font-size: var(--cm-font-size-14); font-weight: 500;
|
|
@@ -159,7 +161,8 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
159
161
|
padding: var(--cm-space-4); text-align: start; background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
160
162
|
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-md);
|
|
161
163
|
}
|
|
162
|
-
:host([align='end']) .pop { inset-inline-start: auto; inset-inline-end: 0; }
|
|
164
|
+
:host([align='end']) .pop, .pop.to-end { inset-inline-start: auto; inset-inline-end: 0; }
|
|
165
|
+
:host([align='end']) .pop.to-start { inset-inline-start: 0; inset-inline-end: auto; }
|
|
163
166
|
.pop[hidden] { display: none; }
|
|
164
167
|
.head { padding: var(--cm-space-4) var(--cm-space-12) var(--cm-space-8); margin-bottom: 4px; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); overflow-wrap: anywhere; }
|
|
165
168
|
.head strong { display: block; font-size: 14px; font-weight: 500; }
|
|
@@ -193,12 +196,12 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
193
196
|
}
|
|
194
197
|
.loading { display: flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: var(--cm-space-4) var(--cm-space-12); font-size: var(--cm-font-size-14); color: var(--cm-text-tertiary); }
|
|
195
198
|
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
196
|
-
`];$("cm-action-menu",Vr);var
|
|
199
|
+
`];$("cm-action-menu",Vr);var Rx=z("buttonGroup",{more:"More"}),Zt="data-cm-overflow",Xv=["disabled","loading","tone","icon","label","variant","size","icon-only","count","href","hidden","data-priority"],Qt,Ui,St,bt,ei,Vi,U,Kr,og,Vn,om,kc,Ec,lg,Mc,lm,cm,dm,Wr=class extends T{constructor(){super(...arguments);p(this,U);this.overflow="wrap";this.align="start";this.label="";this._items=[];this._size="medium";p(this,Qt,[]);p(this,Ui);p(this,St);p(this,bt,0);p(this,ei,new Set);p(this,Vi,!1);p(this,Mc,e=>{e.stopPropagation();let t=r(this,Qt)[Number(e.detail.value)];if(!t)return;g(this,Vi,!0),(t.shadowRoot?.querySelector('[part="control"]')??t).click(),requestAnimationFrame(()=>requestAnimationFrame(()=>s(this,U,lm).call(this)))})}get overflowing(){return[...r(this,Qt)]}connectedCallback(){super.connectedCallback(),g(this,Ui,new MutationObserver(e=>s(this,U,og).call(this,e))),r(this,Ui).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:Xv}),typeof ResizeObserver<"u"&&(g(this,St,new ResizeObserver(()=>s(this,U,Kr).call(this))),r(this,St).observe(this),g(this,ei,new Set([this]))),document.fonts?.ready.then(()=>s(this,U,Kr).call(this)),s(this,U,Kr).call(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Ui)?.disconnect(),r(this,St)?.disconnect(),r(this,ei).clear(),cancelAnimationFrame(r(this,bt)),g(this,bt,0),s(this,U,om).call(this,s(this,U,Vn).call(this))}updated(e){(e.has("overflow")||e.has("moreLabel")||e.has("moreIcon")||e.has("size"))&&s(this,U,Kr).call(this)}firstUpdated(){this.updateComplete.then(()=>this.relayout())}relayout(){cancelAnimationFrame(r(this,bt)),g(this,bt,0),s(this,U,Ec).call(this)}render(){let e=this.moreIcon!=null;return c`<div class="row" part="row" role="group" aria-label=${this.label||h}>
|
|
197
200
|
<slot></slot>
|
|
198
201
|
<cm-action-menu class="more ${this._size}${e?" icon":""}" part="more" hidden align="end"
|
|
199
202
|
.items=${this._items} label=${this.moreLabel} ?icon-only=${e} icon=${this.moreIcon||"more"}
|
|
200
203
|
@cm-select=${r(this,Mc)}></cm-action-menu>
|
|
201
|
-
</div>`}};Qt=new WeakMap,Ui=new WeakMap,St=new WeakMap,bt=new WeakMap,ei=new WeakMap,Vi=new WeakMap,U=new WeakSet,Kr=function(){r(this,bt)||!this.isConnected||g(this,bt,requestAnimationFrame(()=>{g(this,bt,0);let e=s(this,U,Vn).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>s(this,U,Ec).call(this)):s(this,U,Ec).call(this)}))},
|
|
204
|
+
</div>`}};Qt=new WeakMap,Ui=new WeakMap,St=new WeakMap,bt=new WeakMap,ei=new WeakMap,Vi=new WeakMap,U=new WeakSet,Kr=function(){r(this,bt)||!this.isConnected||g(this,bt,requestAnimationFrame(()=>{g(this,bt,0);let e=s(this,U,Vn).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>s(this,U,Ec).call(this)):s(this,U,Ec).call(this)}))},og=function(e){for(let t of e)for(let i of Array.from(t.removedNodes))i instanceof HTMLElement&&i.hasAttribute(Zt)&&i.parentElement!==this&&(i.removeAttribute(Zt),i.hidden=!1);s(this,U,Kr).call(this)},Vn=function(){return Array.from(this.children).filter(e=>e.localName==="cm-button"&&(!e.hidden||e.hasAttribute(Zt)))},om=function(e){for(let t of e)t.hasAttribute(Zt)&&(t.removeAttribute(Zt),t.hidden=!1)},kc=function(){return this.renderRoot.querySelector(".more")},Ec=function(){let e=this.renderRoot.querySelector(".row"),t=s(this,U,kc).call(this);if(!e||!t||!this.isConnected)return;let i=s(this,U,Vn).call(this),a=this.shadowRoot.activeElement===t?t:i.find(v=>v.matches(":focus-within"))??null,l=i[0]?.getAttribute("size");this._size=this.size||(l==="slim"||l==="large"?l:"medium");let d=new Set;if(r(this,St)){let v=new Set([this,t,...i]);for(let b of r(this,ei))v.has(b)||r(this,St).unobserve(b);for(let b of v)r(this,ei).has(b)||r(this,St).observe(b);g(this,ei,v)}if(this.overflow==="menu"){s(this,U,om).call(this,i),t.hidden=!1;let v=e.clientWidth,b=parseFloat(getComputedStyle(e).columnGap)||0,w=Array.from(this.children).filter(D=>!D.hidden),y=new Map(w.map(D=>[D,D.getBoundingClientRect().width])),M=w.reduce((D,H)=>D+y.get(H),0)+b*Math.max(w.length-1,0);if(M>v+.5){let D=F=>{let W=F.dataset.priority;return W==="low"?0:W==="high"?2:F.getAttribute("variant")==="primary"?3:1},H=i.map((F,W)=>({b:F,i:W,r:D(F)})).sort((F,W)=>F.r-W.r||W.i-F.i),q=M+b+t.getBoundingClientRect().width;for(let{b:F}of H){if(q<=v+.5)break;d.add(F),q-=y.get(F)+b}}}for(let v of i)d.has(v)?(v.setAttribute(Zt,""),v.hidden=!0):v.hasAttribute(Zt)&&(v.removeAttribute(Zt),v.hidden=!1);t.hidden=d.size===0,a===t&&t.hidden?s(this,U,dm).call(this):a&&a!==t&&d.has(a)&&s(this,U,cm).call(this),d.size===0&&t.open&&t.hide(),r(this,Ui)?.takeRecords();let m=i.filter(v=>d.has(v));this._items=m.map((v,b)=>s(this,U,lg).call(this,v,b));let u=m.length!==r(this,Qt).length||m.some((v,b)=>v!==r(this,Qt)[b]);g(this,Qt,m),u&&this.dispatchEvent(new CustomEvent("cm-overflow-change",{detail:{hidden:[...m]},bubbles:!0,composed:!0})),r(this,Vi)&&this.updateComplete.then(()=>s(this,U,lm).call(this))},lg=function(e,t){let i=Array.from(e.childNodes).filter(d=>!(d instanceof Element&&d.hasAttribute("slot"))).map(d=>d.textContent??"").join("").replace(/\s+/g," ").trim(),a=e.hasAttribute("icon-only")?e.getAttribute("label")||i:i||e.getAttribute("label")||"",l=e.getAttribute("icon")||e.querySelector(':scope > [slot="icon"]')?.getAttribute("name")||void 0;return{label:a,value:String(t),icon:l,disabled:e.hasAttribute("disabled")||e.hasAttribute("loading")||void 0,critical:e.getAttribute("tone")==="critical"||void 0}},Mc=new WeakMap,lm=function(){if(!r(this,Vi))return;g(this,Vi,!1);let e=document.activeElement,t=s(this,U,kc).call(this);(!e||e===document.body||e===document.documentElement||e===this&&(!t||t.hidden||this.shadowRoot.activeElement!==t))&&(t&&!t.hidden?s(this,U,cm).call(this):s(this,U,dm).call(this))},cm=function(){s(this,U,kc).call(this)?.shadowRoot?.querySelector('[part="trigger"]')?.focus()},dm=function(){let e=s(this,U,Vn).call(this).filter(i=>!i.hidden&&!i.hasAttribute("disabled")),t=e[e.length-1];(t?.shadowRoot?.querySelector('[part="control"]')??t)?.focus()},Wr.properties={overflow:{reflect:!0},moreLabel:{attribute:"more-label",string:"more"},moreIcon:{attribute:"more-icon"},size:{reflect:!0},align:{reflect:!0},label:{},_items:{state:!0},_size:{state:!0}},Wr.styles=[k,x`
|
|
202
205
|
:host { display: block; min-inline-size: 0; }
|
|
203
206
|
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); min-inline-size: 0; }
|
|
204
207
|
:host([align='end']) .row { justify-content: flex-end; }
|
|
@@ -222,13 +225,16 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
222
225
|
.more::part(trigger), .more.slim::part(trigger) { min-height: var(--cm-control-height-lg, 40px); }
|
|
223
226
|
.more.icon::part(trigger), .more.icon.slim::part(trigger) { width: var(--cm-control-height-lg, 40px); }
|
|
224
227
|
}
|
|
225
|
-
`];$("cm-button-group",Wr);var ot={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Gr=o=>(...n)=>({_$litDirective$:o,values:n}),ti=class{constructor(n){}get _$AU(){return this._$AM._$AU}_$AT(n,e,t){this._$Ct=n,this._$AM=e,this._$Ci=t}_$AS(n,e){return this.update(n,e)}update(n,e){return this.render(...e)}};var{I:
|
|
228
|
+
`];$("cm-button-group",Wr);var ot={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Gr=o=>(...n)=>({_$litDirective$:o,values:n}),ti=class{constructor(n){}get _$AU(){return this._$AM._$AU}_$AT(n,e,t){this._$Ct=n,this._$AM=e,this._$Ci=t}_$AS(n,e){return this.update(n,e)}update(n,e){return this.render(...e)}};var{I:Jv}=Ju,cg=o=>o;var hg=o=>o.strings===void 0,dg=()=>document.createComment(""),Yr=(o,n,e)=>{let t=o._$AA.parentNode,i=n===void 0?o._$AB:n._$AA;if(e===void 0){let a=t.insertBefore(dg(),i),l=t.insertBefore(dg(),i);e=new Jv(a,l,o,o.options)}else{let a=e._$AB.nextSibling,l=e._$AM,d=l!==o;if(d){let m;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(m=o._$AU)!==l._$AU&&e._$AP(m)}if(a!==i||d){let m=e._$AA;for(;m!==a;){let u=cg(m).nextSibling;cg(t).insertBefore(m,i),m=u}}}return e},ii=(o,n,e=o)=>(o._$AI(n,e),o),Zv={},Tc=(o,n=Zv)=>o._$AH=n,mg=o=>o._$AH,zc=o=>{o._$AR(),o._$AA.remove()};var ne=Gr(class extends ti{constructor(o){if(super(o),o.type!==ot.PROPERTY&&o.type!==ot.ATTRIBUTE&&o.type!==ot.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!hg(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[n]){if(n===we||n===h)return n;let e=o.element,t=o.name;if(o.type===ot.PROPERTY){if(n===e[t])return we}else if(o.type===ot.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return we}else if(o.type===ot.ATTRIBUTE&&e.getAttribute(t)===n+"")return we;return Tc(o),n}});var Ge=x`
|
|
226
229
|
:host {
|
|
227
230
|
--_cm-field-h: var(--cm-control-height-lg, 40px);
|
|
228
231
|
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
229
232
|
--_cm-field-pad: var(--cm-space-12, 12px);
|
|
230
233
|
}
|
|
231
234
|
:host([size='small']) { --_cm-field-h: var(--cm-control-height-sm, 32px); --_cm-field-pad: var(--cm-space-8, 8px); }
|
|
235
|
+
/* medium (1.8.1): 36px, the height of a standard button, for fields in a row of buttons (page header actions). */
|
|
236
|
+
:host([size='medium']) { --_cm-field-h: var(--cm-control-height-md, 36px); }
|
|
237
|
+
@media (pointer: coarse) { :host([size='medium']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } }
|
|
232
238
|
@media (pointer: coarse) {
|
|
233
239
|
:host, :host([size='small']) { --_cm-field-h: var(--cm-control-height-touch, 44px); --_cm-field-font: var(--cm-font-size-16, 16px); }
|
|
234
240
|
}
|
|
@@ -255,7 +261,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
255
261
|
[role='option']:not([aria-disabled='true']):not([aria-selected='true']):active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
|
|
256
262
|
:host([size='small']) [role='option'] { min-height: var(--cm-control-height-sm, 32px); }
|
|
257
263
|
@media (pointer: coarse) { [role='option'], :host([size='small']) [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
258
|
-
`;var
|
|
264
|
+
`;var ew=z("textField",{required:"Please fill in this field.",rangeUnderflow:"Enter {min} or later.",rangeOverflow:"Enter {max} or earlier.",numberUnderflow:"Enter {min} or more.",numberOverflow:"Enter {max} or less.",stepMismatch:"Enter a valid value. The two nearest are {lower} and {upper}.",badTime:"Enter a complete time.",badDateTime:"Enter a complete date and time."}),$e,Lt,Wn,oe,Kn,Cc,pg,hm,ug,mm,ri=class extends T{constructor(){super(...arguments);p(this,oe);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.type="text";this.multiline=!1;this.rows=4;this.required=!1;this.disabled=!1;this.readonly=!1;this.size="default";p(this,$e,this.attachInternals());p(this,Lt,A("cm-tf"));p(this,Wn,"")}connectedCallback(){super.connectedCallback(),g(this,Wn,this.value)}get form(){return r(this,$e).form}get validity(){return r(this,$e).validity}get validationMessage(){return r(this,$e).validationMessage}checkValidity(){return s(this,oe,Kn).call(this),r(this,$e).checkValidity()}reportValidity(){return s(this,oe,Kn).call(this),r(this,$e).reportValidity()}formResetCallback(){this.value=r(this,Wn),this.error=""}formDisabledCallback(e){this.disabled=e}updated(){r(this,$e).setFormValue(this.value),s(this,oe,Kn).call(this)}render(){let e=[this.error&&`${r(this,Lt)}-err`,this.helpText&&`${r(this,Lt)}-help`].filter(Boolean).join(" ")||h,t={id:r(this,Lt),invalid:this.error?"true":h},i=this.multiline?c`<textarea class="input" part="input" id=${t.id} rows=${this.rows}
|
|
259
265
|
.value=${ne(this.value)} placeholder=${this.placeholder||h}
|
|
260
266
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
261
267
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
@@ -265,12 +271,12 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
265
271
|
min=${this.min||h} max=${this.max||h} step=${this.step||h}
|
|
266
272
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
267
273
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
268
|
-
@input=${s(this,oe,hm)} @change=${s(this,oe,mm)} @blur=${s(this,oe,
|
|
274
|
+
@input=${s(this,oe,hm)} @change=${s(this,oe,mm)} @blur=${s(this,oe,ug)} />`;return c`<div class="field">
|
|
269
275
|
${this.label?c`<label class="label" for=${r(this,Lt)} part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}${this.hint?c`<span class="hint">[${this.hint}]</span>`:h}</label>`:h}
|
|
270
276
|
${i}
|
|
271
277
|
${this.error?c`<p class="error" id="${r(this,Lt)}-err" role="alert">${this.error}</p>`:h}
|
|
272
278
|
${this.helpText?c`<p class="help" id="${r(this,Lt)}-help">${this.helpText}</p>`:h}
|
|
273
|
-
</div>`}};$e=new WeakMap,Lt=new WeakMap,Wn=new WeakMap,oe=new WeakSet,Kn=function(){let e=this.renderRoot.querySelector(".input"),t=e instanceof HTMLInputElement?e.validity:null,i=this.type==="time"||this.type==="datetime-local";this.error?r(this,$e).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,$e).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.required&&!this.value?r(this,$e).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,$e).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:s(this,oe,Cc).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,$e).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:s(this,oe,Cc).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,$e).setValidity({stepMismatch:!0},this.t("stepMismatch",s(this,oe,
|
|
279
|
+
</div>`}};$e=new WeakMap,Lt=new WeakMap,Wn=new WeakMap,oe=new WeakSet,Kn=function(){let e=this.renderRoot.querySelector(".input"),t=e instanceof HTMLInputElement?e.validity:null,i=this.type==="time"||this.type==="datetime-local";this.error?r(this,$e).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,$e).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.required&&!this.value?r(this,$e).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,$e).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:s(this,oe,Cc).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,$e).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:s(this,oe,Cc).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,$e).setValidity({stepMismatch:!0},this.t("stepMismatch",s(this,oe,pg).call(this,e)),e??void 0):r(this,$e).setValidity({})},Cc=function(e){let t=this.locale;if(this.type==="number"&&e!==""&&Number.isFinite(Number(e)))return this.formatNumber(Number(e));if(this.type==="time"){let l=/^(\d{2}):(\d{2})/.exec(e);return l?ae(new Date(2e3,0,1,+l[1],+l[2]),{hour:"numeric",minute:"2-digit"},t):e}let i=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(e);if(!i)return e;let a=new Date(+i[1],+i[2]-1,+i[3],+(i[4]??0),+(i[5]??0));return this.type==="datetime-local"?ae(a,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"},t):ae(a,{day:"numeric",month:"short",year:"numeric"},t)},pg=function(e){let t=this.type==="date"?864e5:this.type==="time"||this.type==="datetime-local"?1e3:1,i=Number(this.step)*t||(this.type==="date"?864e5:this.type==="number"?1:6e4),a=e.valueAsNumber,l=document.createElement("input");l.type=this.type,l.value=this.min??"";let d=Number.isFinite(l.valueAsNumber)?l.valueAsNumber:0,m=d+Math.floor((a-d)/i)*i,u=v=>{if(this.type==="number")return this.formatNumber(Number(v.toPrecision(12)));let w=new Date(v).toISOString();return s(this,oe,Cc).call(this,this.type==="time"?w.slice(11,16):this.type==="date"?w.slice(0,10):w.slice(0,16))};return{lower:u(m),upper:u(m+i)}},hm=function(e){this.value=e.target.value},ug=function(){s(this,oe,Kn).call(this)},mm=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ri.formAssociated=!0,ri.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ri.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},type:{},multiline:{type:Boolean},rows:{type:Number},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},autocomplete:{},size:{reflect:!0},min:{},max:{},step:{}},ri.styles=[k,Ge,x`
|
|
274
280
|
:host { display: block; }
|
|
275
281
|
.input {
|
|
276
282
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -286,13 +292,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
286
292
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
287
293
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
288
294
|
:host([error]:not([error=''])) .input { border-color: var(--cm-border-critical); }
|
|
289
|
-
`];$("cm-text-field",ri);var
|
|
295
|
+
`];$("cm-text-field",ri);var nw=z("checkbox",{required:"Please tick this box."}),si,Ki,Gn,Sc,gg,ai=class extends T{constructor(){super(...arguments);p(this,Sc);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;p(this,si,this.attachInternals());p(this,Ki,A("cm-cb"));p(this,Gn,!1)}connectedCallback(){super.connectedCallback(),g(this,Gn,this.checked)}get form(){return r(this,si).form}checkValidity(){return r(this,si).checkValidity()}formResetCallback(){this.checked=r(this,Gn)}formDisabledCallback(e){this.disabled=e}updated(){r(this,si).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,si).setValidity({valueMissing:!0},this.t("required")):r(this,si).setValidity({})}render(){let e=this.indeterminate?c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6h8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`:c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6.2 4.8 9 10 3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;return c`<label for=${r(this,Ki)}>
|
|
290
296
|
<input type="checkbox" id=${r(this,Ki)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
291
297
|
?disabled=${this.disabled} ?required=${this.required}
|
|
292
|
-
aria-describedby=${this.description?`${r(this,Ki)}-d`:h} @change=${s(this,Sc,
|
|
298
|
+
aria-describedby=${this.description?`${r(this,Ki)}-d`:h} @change=${s(this,Sc,gg)} />
|
|
293
299
|
<span class="box" part="box">${e}</span>
|
|
294
300
|
${this.label||this.description?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Ki)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
295
|
-
</label>`}};si=new WeakMap,Ki=new WeakMap,Gn=new WeakMap,Sc=new WeakSet,
|
|
301
|
+
</label>`}};si=new WeakMap,Ki=new WeakMap,Gn=new WeakMap,Sc=new WeakSet,gg=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ai.formAssociated=!0,ai.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ai.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},ai.styles=[k,x`
|
|
296
302
|
:host { display: inline-flex; }
|
|
297
303
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
298
304
|
/* The 16px box (18px on touch screens, owner standard 1.6) sits centred on the label's first line (20px); the
|
|
@@ -342,7 +348,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
342
348
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
343
349
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
344
350
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
345
|
-
`];$("cm-radio",Gi);var
|
|
351
|
+
`];$("cm-radio",Gi);var mw=z("radioGroup",{required:"Please select one of these options."}),Ye,Dt,Xn,Jn,Zn,Xr,se,pm,Dc,Wi,um,Jr,gm,Ac,Rc,Lc,Yi=class extends T{constructor(){super();p(this,se);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;p(this,Ye,this.attachInternals());p(this,Dt,A("cm-rg"));p(this,Xn,"");p(this,Jn,!0);p(this,Zn,!1);p(this,Xr,!1);p(this,Dc,()=>{s(this,se,pm).call(this),r(this,Jr).call(this)});p(this,Jr,()=>{let e=s(this,se,Wi).call(this),t=!1;for(let a of e)a.checked=!!this.value&&a.value===this.value&&!t,a.checked&&(t=!0),a.groupDisabled=this.disabled;let i=e.find(a=>a.checked&&!a.disabled)??s(this,se,um).call(this)[0];for(let a of e)a._tabbable=a===i&&!this.disabled});p(this,Ac,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||s(this,se,gm).call(this,t,!0)});p(this,Rc,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let i=s(this,se,um).call(this),a=i.indexOf(t),l=J(e,this),d;if(e.key==="ArrowDown"||l==="ArrowRight")d=i[(a+1)%i.length];else if(e.key==="ArrowUp"||l==="ArrowLeft")d=i[(a-1+i.length)%i.length];else if(e.key===" ")d=t.disabled?void 0:t;else return;e.preventDefault(),d&&s(this,se,gm).call(this,d,!0)});this.addEventListener("keydown",r(this,Rc)),this.addEventListener("click",r(this,Ac))}connectedCallback(){super.connectedCallback(),s(this,se,pm).call(this)}get form(){return r(this,Ye).form}get validity(){return r(this,Ye).validity}get validationMessage(){return r(this,Ye).validationMessage}checkValidity(){return r(this,Ye).checkValidity()}reportValidity(){return r(this,Ye).reportValidity()}formResetCallback(){this.value=r(this,Xn)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(s(this,se,Wi).call(this).find(t=>t._tabbable)??s(this,se,Wi).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,Zn)&&!r(this,Xr)&&g(this,Jn,!1),g(this,Zn,!0),r(this,Jr).call(this),r(this,Ye).setFormValue(this.value||null,this.value);let t=s(this,se,Wi).call(this)[0];this.error?r(this,Ye).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Ye).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ye).setValidity({})}render(){let e=[this.error&&`${r(this,Dt)}-err`,this.helpText&&`${r(this,Dt)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
346
352
|
aria-labelledby=${s(this,se,Lc).call(this)?`${r(this,Dt)}-l`:h} aria-label=${s(this,se,Lc).call(this)?h:this.getAttribute("aria-label")??h}
|
|
347
353
|
aria-describedby=${e||h}
|
|
348
354
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
@@ -360,13 +366,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
360
366
|
.error { color: var(--cm-text-critical); }
|
|
361
367
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
362
368
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
363
|
-
`];$("cm-radio-group",Yi);var Zr,Xi,Qn,Hc,
|
|
369
|
+
`];$("cm-radio-group",Yi);var Zr,Xi,Qn,Hc,bg,ni=class extends S{constructor(){super(...arguments);p(this,Hc);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;p(this,Zr,this.attachInternals());p(this,Xi,A("cm-tg"));p(this,Qn,!1)}connectedCallback(){super.connectedCallback(),g(this,Qn,this.checked)}get form(){return r(this,Zr).form}checkValidity(){return r(this,Zr).checkValidity()}formResetCallback(){this.checked=r(this,Qn)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,Zr).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${r(this,Xi)}>
|
|
364
370
|
<input type="checkbox" role="switch" id=${r(this,Xi)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
365
371
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
366
|
-
aria-describedby=${this.description?`${r(this,Xi)}-d`:h} @change=${s(this,Hc,
|
|
372
|
+
aria-describedby=${this.description?`${r(this,Xi)}-d`:h} @change=${s(this,Hc,bg)} />
|
|
367
373
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
368
374
|
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Xi)}-d">${this.description}</span>`:h}</span>`:h}
|
|
369
|
-
</label>`}};Zr=new WeakMap,Xi=new WeakMap,Qn=new WeakMap,Hc=new WeakSet,
|
|
375
|
+
</label>`}};Zr=new WeakMap,Xi=new WeakMap,Qn=new WeakMap,Hc=new WeakSet,bg=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ni.formAssociated=!0,ni.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ni.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},ni.styles=[k,x`
|
|
370
376
|
:host { display: inline-flex; }
|
|
371
377
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
372
378
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -436,7 +442,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
436
442
|
}
|
|
437
443
|
`;function Oc(o,n,e,t){return c`<div role="presentation" class="gh" id=${o}><span>${n}</span>${e!==void 0?c`<span class="count" aria-hidden="true">${e}</span><span class="vh">, ${t}</span>`:h}</div>`}function qc(o,n=h){return c`${o.icon?c`<cm-icon name=${o.icon} size="16"></cm-icon>`:h}<span class="text"><span class="title">${o.title}</span>${o.description?c`<span class="vh">, </span><span class="desc">${o.description}</span>`:h}</span>${n}`}function Bc(o,n){let e=`${o.cls??""}${o.active?" active":""}`;return o.href?c`<a role="option" id=${o.id} class=${e} href=${o.href} tabindex="-1" aria-selected=${o.active?"true":"false"}
|
|
438
444
|
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</a>`:c`<div role="option" id=${o.id} class=${e} tabindex="-1" aria-selected=${o.active?"true":"false"}
|
|
439
|
-
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function Fc(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var
|
|
445
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function Fc(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var Tw=z("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),Xe,ue,ia,lt,ra,to,B,bm,fm,eo,ta,Ji,li,jc,Uc,io,Vc,fg,Kc,ci=class extends T{constructor(){super(...arguments);p(this,B);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.size="default";this.loading=!1;this._active=-1;this._slotted=[];p(this,Xe,this.attachInternals());p(this,ue,A("cm-sel"));p(this,ia,"");p(this,lt,"");p(this,ra,0);p(this,to,new MutationObserver(()=>s(this,B,bm).call(this)));p(this,Uc,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),s(this,B,eo).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),s(this,B,eo).call(this),s(this,B,li).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,B,jc).call(this,t);s(this,B,eo).call(this,i>=0?i:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?s(this,B,Ji).call(this,this._active):s(this,B,li).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?s(this,B,Ji).call(this,this._active):s(this,B,li).call(this,-1);break;case"Home":e.preventDefault(),s(this,B,li).call(this,"first");break;case"End":e.preventDefault(),s(this,B,li).call(this,"last");break;case"PageDown":e.preventDefault(),s(this,B,li).call(this,10);break;case"PageUp":e.preventDefault(),s(this,B,li).call(this,-10);break;case"Enter":e.preventDefault(),s(this,B,Ji).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),s(this,B,ta).call(this);break;case"Tab":s(this,B,Ji).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,lt)&&Date.now()-r(this,ra)<500){let i=s(this,B,jc).call(this," ");i>=0&&(this._active=i)}else s(this,B,Ji).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,B,jc).call(this,t);i>=0&&(this._active=i)}}});p(this,io,e=>{this.open&&!e.composedPath().includes(this)&&s(this,B,ta).call(this)});p(this,Vc,()=>{this.disabled||(this.open?s(this,B,ta).call(this):s(this,B,eo).call(this))});p(this,Kc,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),s(this,B,bm).call(this),r(this,to).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,io),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,to).disconnect(),document.removeEventListener("pointerdown",r(this,io),!0)}get form(){return r(this,Xe).form}get validity(){return r(this,Xe).validity}get validationMessage(){return r(this,Xe).validationMessage}checkValidity(){return r(this,Xe).checkValidity()}reportValidity(){return r(this,Xe).reportValidity()}formResetCallback(){this.value=r(this,ia),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?ea(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):ea(this._slotted)}firstUpdated(){r(this,ia)||g(this,ia,this.value)}updated(e){r(this,Xe).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,Xe).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Xe).setValidity({valueMissing:!0},this.t("required"),t):r(this,Xe).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,ue)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(d=>d.value===this.value),i=[this.error&&`${r(this,ue)}-err`,this.helpText&&`${r(this,ue)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=(d,m)=>c`<li role="option" id="${r(this,ue)}-o${m}" class=${m===this._active?"active":""}
|
|
440
446
|
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":h}
|
|
441
447
|
@pointerenter=${()=>!d.disabled&&(this._active=m)} @click=${()=>s(this,B,Ji).call(this,m)}>${d.label}</li>`;return c`<div class="field">
|
|
442
448
|
${this.label?c`<span class="label" id="${r(this,ue)}-l" part="label" @click=${r(this,Kc)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
@@ -449,7 +455,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
449
455
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
450
456
|
aria-disabled=${this.disabled?"true":h} aria-describedby=${i||h} aria-busy=${this.loading?"true":h}
|
|
451
457
|
@click=${r(this,Vc)} @keydown=${r(this,Uc)} @blur=${()=>s(this,B,ta).call(this)}>
|
|
452
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,ue)}-v">${t?s(this,B,
|
|
458
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,ue)}-v">${t?s(this,B,fg).call(this,t):this.placeholder}</span>
|
|
453
459
|
${this.loading?c`<span class="spin"><cm-spinner size="small" aria-hidden="true"></cm-spinner></span>`:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
454
460
|
</div>
|
|
455
461
|
<ul role="listbox" id="${r(this,ue)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,ue)}-l`:h}
|
|
@@ -462,7 +468,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
462
468
|
${this.error?c`<p class="error" id="${r(this,ue)}-err" role="alert">${this.error}</p>`:h}
|
|
463
469
|
${this.helpText?c`<p class="help" id="${r(this,ue)}-help">${this.helpText}</p>`:h}
|
|
464
470
|
<slot></slot>
|
|
465
|
-
</div>`}};Xe=new WeakMap,ue=new WeakMap,ia=new WeakMap,lt=new WeakMap,ra=new WeakMap,to=new WeakMap,B=new WeakSet,bm=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,ia,this.value))},fm=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},eo=function(e){if(this.disabled||this.loading)return;let t=this.items.findIndex(i=>i.value===this.value);this.open=!0,this._active=e??(t>=0?t:s(this,B,fm).call(this)[0]??-1)},ta=function(){this.open=!1},Ji=function(e){let t=this.items[e];!t||t.disabled||(s(this,B,ta).call(this),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},li=function(e){let t=s(this,B,fm).call(this);if(!t.length)return;if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);this._active=i<0?t[0]:t[Math.min(t.length-1,Math.max(0,i+e))]},jc=function(e){let t=Date.now();g(this,lt,t-r(this,ra)>500?e:r(this,lt)+e),g(this,ra,t);let i=this.items,a=this._active<0?0:this._active,l=r(this,lt).split("").every(u=>u===r(this,lt)[0]),d=l?r(this,lt)[0]:r(this,lt),m=l||r(this,lt).length===1?a+1:a;for(let u=0;u<i.length;u++){let v=(m+u)%i.length;if(!i[v].disabled&&i[v].label.toLowerCase().startsWith(d.toLowerCase()))return v}return-1},Uc=new WeakMap,io=new WeakMap,Vc=new WeakMap,
|
|
471
|
+
</div>`}};Xe=new WeakMap,ue=new WeakMap,ia=new WeakMap,lt=new WeakMap,ra=new WeakMap,to=new WeakMap,B=new WeakSet,bm=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,ia,this.value))},fm=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},eo=function(e){if(this.disabled||this.loading)return;let t=this.items.findIndex(i=>i.value===this.value);this.open=!0,this._active=e??(t>=0?t:s(this,B,fm).call(this)[0]??-1)},ta=function(){this.open=!1},Ji=function(e){let t=this.items[e];!t||t.disabled||(s(this,B,ta).call(this),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},li=function(e){let t=s(this,B,fm).call(this);if(!t.length)return;if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);this._active=i<0?t[0]:t[Math.min(t.length-1,Math.max(0,i+e))]},jc=function(e){let t=Date.now();g(this,lt,t-r(this,ra)>500?e:r(this,lt)+e),g(this,ra,t);let i=this.items,a=this._active<0?0:this._active,l=r(this,lt).split("").every(u=>u===r(this,lt)[0]),d=l?r(this,lt)[0]:r(this,lt),m=l||r(this,lt).length===1?a+1:a;for(let u=0;u<i.length;u++){let v=(m+u)%i.length;if(!i[v].disabled&&i[v].label.toLowerCase().startsWith(d.toLowerCase()))return v}return-1},Uc=new WeakMap,io=new WeakMap,Vc=new WeakMap,fg=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},Kc=new WeakMap,ci.formAssociated=!0,ci.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ci.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},size:{reflect:!0},loading:{type:Boolean,reflect:!0},_active:{state:!0},_slotted:{state:!0}},ci.styles=[k,Ge,_c,oi,x`
|
|
466
472
|
:host { display: block; position: relative; }
|
|
467
473
|
.label { cursor: default; }
|
|
468
474
|
.wrap { position: relative; }
|
|
@@ -495,16 +501,16 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
495
501
|
[role='group'] { display: block; }
|
|
496
502
|
slot { display: none; }
|
|
497
503
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
498
|
-
`];$("cm-select",ci);var
|
|
504
|
+
`];$("cm-select",ci);var Rw=z("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),sa,Wc,ro,Te,aa,vg,yg,vm,di=class extends T{constructor(){super(...arguments);p(this,Te);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;p(this,sa,this.attachInternals());p(this,Wc,A("cm-search"));p(this,ro,"")}connectedCallback(){super.connectedCallback(),g(this,ro,this.value)}get form(){return r(this,sa).form}checkValidity(){return r(this,sa).checkValidity()}formResetCallback(){this.value=r(this,ro)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,sa).setFormValue(this.value)}render(){return c`<div class="box" part="box">
|
|
499
505
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
500
506
|
<input id=${r(this,Wc)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
501
507
|
aria-label=${this.label} .value=${ne(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
502
|
-
@input=${s(this,Te,
|
|
508
|
+
@input=${s(this,Te,vg)} @change=${()=>s(this,Te,aa).call(this,"change")} @keydown=${s(this,Te,yg)} />
|
|
503
509
|
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,Te,vm)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
504
510
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
505
511
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
506
512
|
@click=${()=>s(this,Te,aa).call(this,"cm-filter")}><cm-icon name="filter" size="16"></cm-icon>${this.filterCount>0?c`<span class="count" aria-hidden="true">${this.filterCount}</span>`:h}</button>`:h}
|
|
507
|
-
</div>`}};sa=new WeakMap,Wc=new WeakMap,ro=new WeakMap,Te=new WeakSet,aa=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},
|
|
513
|
+
</div>`}};sa=new WeakMap,Wc=new WeakMap,ro=new WeakMap,Te=new WeakSet,aa=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},vg=function(e){this.value=e.target.value},yg=function(e){e.key==="Enter"?s(this,Te,aa).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),s(this,Te,vm).call(this))},vm=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),s(this,Te,aa).call(this,"input"),s(this,Te,aa).call(this,"change")},di.formAssociated=!0,di.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},di.properties={label:{string:"label"},name:{reflect:!0},value:{},placeholder:{string:"placeholder"},filter:{type:Boolean},filterLabel:{attribute:"filter-label",string:"filter"},filterCount:{type:Number,attribute:"filter-count"},size:{reflect:!0},disabled:{type:Boolean,reflect:!0}},di.styles=[k,Ge,x`
|
|
508
514
|
:host { display: block; }
|
|
509
515
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
510
516
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -538,7 +544,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
538
544
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
539
545
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
540
546
|
:host([disabled]) button { cursor: not-allowed; }
|
|
541
|
-
`];$("cm-search",di);var
|
|
547
|
+
`];$("cm-search",di);var qw=z("tag",{remove:"Remove {label}"}),Gc,xg,Zi=class extends T{constructor(){super(...arguments);p(this,Gc);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||this.t("remove",{label:this.textContent?.trim()??""}).trim();return c`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?c`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${s(this,Gc,xg)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};Gc=new WeakSet,xg=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Zi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Zi.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Zi.styles=[k,x`
|
|
542
548
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
543
549
|
.tag {
|
|
544
550
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -556,17 +562,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
556
562
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
557
563
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
|
|
558
564
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
|
|
559
|
-
`];$("cm-tag",Zi);var
|
|
565
|
+
`];$("cm-tag",Zi);var Yw=z("combobox",{noResults:"No results",results:{one:"{count} result",other:"{count} results"},add:"Add \u201C{value}\u201D",remove:"Remove {label}",required:"Please select an item in the list.",requiredMultiple:"Choose at least one item.",grouped:"{group}: {label}",more:"+{count} more"}),Ae,ge,oo,la,lo,co,ho,L,ym,wg,ao,Yc,so,na,oa,At,$g,no,xm,wm,Qi,Xc,Jc,er,kg,Zc,Qc,ed,Eg,Mg,hi=class extends T{constructor(){super(...arguments);p(this,L);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.size="default";this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.maxTags=3;this._query="";this._focusIn=!1;this._active=-1;this._slotted=[];this._typing=!1;p(this,Ae,this.attachInternals());p(this,ge,A("cm-cb"));p(this,oo,null);p(this,la,new Map);p(this,lo,new Map);p(this,co,new MutationObserver(()=>s(this,L,ym).call(this)));p(this,ho);p(this,Xc,()=>{this._focusIn=!0});p(this,Jc,()=>{setTimeout(()=>{this._focusIn=this.matches(":focus-within")})});p(this,Zc,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,s(this,L,oa).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});p(this,Qc,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?s(this,L,no).call(this,1):(s(this,L,oa).call(this),e.altKey||s(this,L,no).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?s(this,L,no).call(this,-1):(s(this,L,oa).call(this),s(this,L,no).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),s(this,L,xm).call(this,this._active)):r(this,L,Yc)&&(e.preventDefault(),s(this,L,wm).call(this,r(this,L,Yc)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),s(this,L,At).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",s(this,L,na).call(this)));break;case"ArrowLeft":case"ArrowRight":{let i=e.target;this.multiple&&this.values.length&&J(e,this)==="ArrowLeft"&&i.selectionStart===0&&i.selectionEnd===0&&(e.preventDefault(),s(this,L,At).call(this),s(this,L,er).call(this,this.values.length-1));break}case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":s(this,L,At).call(this);break;default:}});p(this,ed,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(s(this,L,At).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?s(this,L,ao).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),s(this,L,ym).call(this),r(this,co).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),g(this,ho,Nc(this,()=>this.open,()=>s(this,L,At).call(this))),this.addEventListener("focusin",r(this,Xc)),this.addEventListener("focusout",r(this,Jc))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,co).disconnect(),(e=r(this,ho))==null||e.call(this)}get form(){return r(this,Ae).form}get validity(){return r(this,Ae).validity}get validationMessage(){return r(this,Ae).validationMessage}checkValidity(){return r(this,Ae).checkValidity()}reportValidity(){return r(this,Ae).reportValidity()}formResetCallback(){let e=r(this,oo)??{value:"",values:[]};this.value=e.value,this.values=[...e.values],this._query="",this._typing=!1,this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){typeof e=="string"&&(this.multiple?this.values=e?e.split(`
|
|
560
566
|
`):[]:this.value=e)}get items(){return this.options?.length?ea(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):ea(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let i=t.label.toLowerCase();return this.filter==="starts-with"?i.startsWith(e):i.includes(e)})}firstUpdated(){g(this,oo,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,la).set(t.value,t.label),t.group&&r(this,lo).set(t.value,t.group);if((e.has("value")||e.has("options")||e.has("_slotted")||e.has("showGroup"))&&!this.multiple&&!this._typing&&(this._query=this.value?s(this,L,ao).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=s(this,L,so).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let a=new FormData;for(let l of this.values)a.append(this.name,l);r(this,Ae).setFormValue(a,this.values.join(`
|
|
561
567
|
`))}else r(this,Ae).setFormValue(null);else r(this,Ae).setFormValue(this.value||null,this.value);let i=this.multiple?!this.values.length:!this.value;this.error?r(this,Ae).setValidity({customError:!0},this.error,t):this.required&&i?r(this,Ae).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),t):r(this,Ae).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,ge)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),s(this,L,na).call(this))}focus(e){this.renderRoot.querySelector("input")?.focus(e)}render(){let e=s(this,L,so).call(this),t=[this.error&&`${r(this,ge)}-err`,this.helpText&&`${r(this,ge)}-help`].filter(Boolean).join(" "),i=this.getAttribute("aria-label"),a=m=>this.multiple?this.values.includes(m):m===this.value,l=(m,u)=>c`<li role="option" id="${r(this,ge)}-o${u}" class=${u===this._active?"active":""}
|
|
562
568
|
aria-selected=${m.create?"false":a(m.value)?"true":"false"} aria-disabled=${m.disabled?"true":h}
|
|
563
569
|
@pointerenter=${()=>!m.disabled&&(this._active=u)} @click=${()=>s(this,L,xm).call(this,u)}>
|
|
564
|
-
${m.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:m.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${s(this,L,
|
|
570
|
+
${m.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:m.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${s(this,L,Eg).call(this,m.label)}</span>`}</li>`,d=this.loading?this.loadingText||this.t("loading"):this.open?e.length?this.t("results",{count:e.length}):this.emptyText||this.t("noResults"):"";return c`<div class="field">
|
|
565
571
|
${this.label?c`<label class="label" id="${r(this,ge)}-l" for="${r(this,ge)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
566
572
|
<div class="wrap">
|
|
567
573
|
<div class="box" part="box" @click=${m=>{m.target.closest("cm-tag[removable]")||s(this,L,Qi).call(this)}}>
|
|
568
574
|
<div class="chips ${this.multiple&&this.values.length?`has-tags${this._focusIn||this.open?"":" idle"}`:""}">
|
|
569
|
-
${this.multiple?s(this,L,
|
|
575
|
+
${this.multiple?s(this,L,Mg).call(this):h}
|
|
570
576
|
<input id="${r(this,ge)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
571
577
|
.value=${ne(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
572
578
|
aria-label=${!this.label&&i?i:h}
|
|
@@ -593,9 +599,9 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
593
599
|
${this.error?c`<p class="error" id="${r(this,ge)}-err" role="alert">${this.error}</p>`:h}
|
|
594
600
|
${this.helpText?c`<p class="help" id="${r(this,ge)}-help">${this.helpText}</p>`:h}
|
|
595
601
|
<slot></slot>
|
|
596
|
-
</div>`}};Ae=new WeakMap,ge=new WeakMap,oo=new WeakMap,la=new WeakMap,lo=new WeakMap,co=new WeakMap,ho=new WeakMap,L=new WeakSet,ym=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated){let t=e.filter(i=>i.hasAttribute("selected")).map(i=>i.value);this.multiple&&!this.values.length&&t.length&&(this.values=t),!this.multiple&&!this.value&&t.length&&(this.value=t[0])}},
|
|
602
|
+
</div>`}};Ae=new WeakMap,ge=new WeakMap,oo=new WeakMap,la=new WeakMap,lo=new WeakMap,co=new WeakMap,ho=new WeakMap,L=new WeakSet,ym=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated){let t=e.filter(i=>i.hasAttribute("selected")).map(i=>i.value);this.multiple&&!this.values.length&&t.length&&(this.values=t),!this.multiple&&!this.value&&t.length&&(this.value=t[0])}},wg=function(e){return this.items.find(t=>t.value===e)?.label??r(this,la).get(e)??e},ao=function(e){let t=s(this,L,wg).call(this,e);if(!this.showGroup)return t;let i=this.items.find(a=>a.value===e)?.group??r(this,lo).get(e);return i?this.t("grouped",{group:i,label:t}):t},Yc=function(){if(!this.allowCustom||!this._typing)return"";let e=this._query.trim();if(!e)return"";let t=e.toLowerCase();return this.items.some(i=>i.label.toLowerCase()===t||i.value.toLowerCase()===t)||(this.multiple?this.values.some(i=>i.toLowerCase()===t):this.value.toLowerCase()===t)?"":e},so=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,L,Yc);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},na=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},oa=function(){this.disabled||(this.open=!0)},At=function(){this.open=!1,this._active=-1},$g=function(e=s(this,L,so).call(this)){return e.flatMap((t,i)=>t.disabled?[]:[i])},no=function(e){let t=s(this,L,$g).call(this);if(!t.length){this._active=-1;return}if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);if(i<0){this._active=e>0?t[0]:t[t.length-1];return}this._active=t[(i+e+t.length)%t.length]},xm=function(e){let t=s(this,L,so).call(this)[e];if(!(!t||t.disabled)){if(t.create){s(this,L,wm).call(this,t.value);return}if(this.multiple){this.values=this.values.includes(t.value)?this.values.filter(i=>i!==t.value):[...this.values,t.value],this._query="",this._typing=!1,this._active=-1,s(this,L,na).call(this),s(this,L,Qi).call(this);return}s(this,L,At).call(this),this._typing=!1,this._query=this.showGroup&&t.group?this.t("grouped",{group:t.group,label:t.label}):t.label,t.value!==this.value&&(this.value=t.value,s(this,L,na).call(this))}},wm=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,la).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(s(this,L,At).call(this),this.value=e,this._typing=!1,this._query=e),s(this,L,na).call(this))},Qi=function(){this.renderRoot.querySelector("input")?.focus()},Xc=new WeakMap,Jc=new WeakMap,er=async function(e){await this.updateComplete;let t=this.renderRoot.querySelectorAll("cm-tag[data-i]");e>=0&&e<t.length?t[e].focus():s(this,L,Qi).call(this)},kg=function(e,t){let i=J(e,this),a=this.values.length-1;if(i==="ArrowLeft")e.preventDefault(),s(this,L,er).call(this,Math.max(0,t-1));else if(i==="ArrowRight")e.preventDefault(),s(this,L,er).call(this,t<a?t+1:-1);else if(i==="Home")e.preventDefault(),s(this,L,er).call(this,0);else if(i==="End")e.preventDefault(),s(this,L,er).call(this,a);else if(i==="Escape")e.preventDefault(),e.stopPropagation(),s(this,L,Qi).call(this);else if((i==="Backspace"||i==="Delete")&&!this.disabled){e.preventDefault(),this.removeValue(this.values[t]);let l=this.values.length;s(this,L,er).call(this,i==="Backspace"?t>0?t-1:l?0:-1:t<l?t:-1)}},Zc=new WeakMap,Qc=new WeakMap,ed=new WeakMap,Eg=function(e){let t=this._typing?this._query.trim():"";if(!t||this.filter==="none")return e;let i=e.toLowerCase().indexOf(t.toLowerCase());return i<0||this.filter==="starts-with"&&i!==0?e:c`${e.slice(0,i)}<mark>${e.slice(i,i+t.length)}</mark>${e.slice(i+t.length)}`},Mg=function(){let e=this.maxTags>0&&!this._focusIn&&!this.open&&this.values.length>this.maxTags?this.maxTags:this.values.length,t=this.values.length-e;return c`${this.values.slice(0,e).map((i,a)=>c`<cm-tag removable tabindex="-1" data-i=${a} part="tag" ?disabled=${this.disabled}
|
|
597
603
|
remove-label=${this.t("remove",{label:s(this,L,ao).call(this,i)})}
|
|
598
|
-
@keydown=${l=>s(this,L
|
|
604
|
+
@keydown=${l=>s(this,L,kg).call(this,l,a)}
|
|
599
605
|
@cm-remove=${()=>{this.removeValue(i),s(this,L,Qi).call(this)}}>${s(this,L,ao).call(this,i)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},hi.formAssociated=!0,hi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},hi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},values:{type:Array},placeholder:{},options:{type:Array},multiple:{type:Boolean,reflect:!0},size:{reflect:!0},allowCustom:{type:Boolean,attribute:"allow-custom"},filter:{},loading:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},maxTags:{type:Number,attribute:"max-tags"},_query:{state:!0},_focusIn:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},hi.styles=[k,Ge,Qr,_c,oi,x`
|
|
600
606
|
:host { display: block; position: relative; }
|
|
601
607
|
.wrap { position: relative; }
|
|
@@ -637,7 +643,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
637
643
|
.create { font-style: normal; }
|
|
638
644
|
slot { display: none; }
|
|
639
645
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
640
|
-
`];$("cm-combobox",hi);function mo(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var
|
|
646
|
+
`];$("cm-combobox",hi);function mo(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var Qv={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"};function td(o,n){let e=o.trim().toLowerCase().split("+").map(a=>a.trim());e.length>1&&e[e.length-1]===""&&e[e.length-2]===""&&e.splice(-2,2,"+");let t=e.pop();if(!t)return null;let i={key:Qv[t]??t,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let a of e)if(a==="mod")n?i.meta=!0:i.ctrl=!0;else if(a==="ctrl"||a==="control")i.ctrl=!0;else if(a==="meta"||a==="cmd"||a==="command")i.meta=!0;else if(a==="alt"||a==="option"||a==="opt")i.alt=!0;else if(a==="shift")i.shift=!0;else return null;return i}function $m(o,n=mo()){let e=td(o,n);return!!e&&(e.ctrl||e.meta||e.alt)}function km(o,n,e=mo()){let t=td(n,e);if(!t||!o.key||o.ctrlKey!==t.ctrl||o.metaKey!==t.meta||o.altKey!==t.alt)return!1;let i=/^[a-z0-9]$/.test(t.key);return(i||t.key.length>1)&&o.shiftKey!==t.shift?!1:o.key.toLowerCase()===t.key?!0:i?o.code===(/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`):!1}function id(o){let n=o.composedPath()[0];return!!n&&(n.isContentEditable||/^(input|textarea|select)$/i.test(n.localName??""))}var ey={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7"},ty={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},iy={escape:"Esc",enter:"\u21B5"," ":"Space",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",backspace:"\u232B",delete:"Del",tab:"Tab",pageup:"PgUp",pagedown:"PgDn",home:"Home",end:"End"},ry=o=>iy[o]??(o.length===1?o.toUpperCase():o[0].toUpperCase()+o.slice(1));function rd(o,n=mo()){let e=[];for(let t of o.trim().split(/\s+/).filter(Boolean)){let i=td(t,n);if(!i)return[o.trim()];let a=n?ey:ty,l=n?["ctrl","alt","shift","meta"]:["ctrl","meta","alt","shift"];for(let d of l)i[d]&&e.push(a[d]);e.push(ry(i.key))}return e}function Tg(o,n=mo()){if(/\s/.test(o.trim()))return"";let e=td(o,n);if(!e)return"";let t=e.key===" "?"Space":e.key.length===1?e.key.toUpperCase():e.key.replace(/^(arrow|page)?(\w)/,(i,a,l)=>a?`${a[0].toUpperCase()}${a.slice(1)}${l.toUpperCase()}`:l.toUpperCase());return[e.ctrl&&"Control",e.meta&&"Meta",e.alt&&"Alt",e.shift&&"Shift",t].filter(Boolean).join("+")}var s0=z("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),Je,po,X,ad,sd,ca,Em,nd,zg,od,uo,Mm,_g,tr=class extends T{constructor(){super(...arguments);p(this,X);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;p(this,Je,A("cm-gs"));p(this,po);p(this,nd,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),s(this,X,Em).call(this)});p(this,od,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),s(this,X,zg).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,X,sd)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,Je)}-o${this._active}`)?.click());break;case"Escape":r(this,X,sd)?(e.preventDefault(),e.stopPropagation(),s(this,X,ca).call(this)):this.value&&(e.preventDefault(),s(this,X,Mm).call(this,!1));break;case"Tab":s(this,X,ca).call(this);break;default:}});p(this,uo,e=>{!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented||id(e)||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),g(this,po,Nc(this,()=>this.open,()=>s(this,X,ca).call(this))),document.addEventListener("keydown",r(this,uo))}disconnectedCallback(){var e;super.disconnectedCallback(),(e=r(this,po))==null||e.call(this),document.removeEventListener("keydown",r(this,uo))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=s(this,X,ad).call(this).length&&(this._active=-1)}updated(e){(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,Je)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=s(this,X,ad).call(this),t=r(this,X,sd),i=e.filter(u=>u.item).length,a=this.loading&&t?this.loadingText:t?e.length?this.t("results",{count:i}):this.emptyText:"",l=-1,d=(this.results??[]).filter(u=>u?.items?.length),m=(u,v,b="")=>{let w=++l;return Bc({id:`${r(this,Je)}-o${w}`,active:w===this._active,href:u.href,cls:b,onHover:()=>this._active=w,onChoose:y=>s(this,X,_g).call(this,y,u)},v)};return c`<div class="wrap">
|
|
641
647
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
642
648
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
643
649
|
|
|
@@ -661,7 +667,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
661
667
|
${this.loading?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText}</span></p>`:e.length?h:c`<p class="message" aria-hidden="true">${this.emptyText}</p>`}
|
|
662
668
|
</div>
|
|
663
669
|
<span class="vh" role="status" aria-live="polite">${a}</span>
|
|
664
|
-
</div>`}};Je=new WeakMap,po=new WeakMap,X=new WeakSet,ad=function(){return this.loading?[]:(this.results??[]).filter(e=>e?.items?.length).flatMap(e=>[...e.items.map(t=>({group:e,item:t,href:t.href})),...e.href?[{group:e,href:e.href}]:[]])},sd=function(){return this.open&&!!this.value.trim()},ca=function(){this.open=!1,this._active=-1},Em=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},nd=new WeakMap,
|
|
670
|
+
</div>`}};Je=new WeakMap,po=new WeakMap,X=new WeakSet,ad=function(){return this.loading?[]:(this.results??[]).filter(e=>e?.items?.length).flatMap(e=>[...e.items.map(t=>({group:e,item:t,href:t.href})),...e.href?[{group:e,href:e.href}]:[]])},sd=function(){return this.open&&!!this.value.trim()},ca=function(){this.open=!1,this._active=-1},Em=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},nd=new WeakMap,zg=function(e){this._active=Fc(this._active,e,s(this,X,ad).call(this).length)},od=new WeakMap,uo=new WeakMap,Mm=function(e=!0){this.value="",s(this,X,ca).call(this),e&&this.renderRoot.querySelector("input")?.focus(),s(this,X,Em).call(this)},_g=function(e,t){this.dispatchEvent(new CustomEvent("cm-select",{detail:{href:t.href,item:t.item,group:t.group},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault(),s(this,X,ca).call(this)},tr.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},tr.properties={label:{string:"label"},placeholder:{string:"placeholder"},value:{},results:{type:Array},loading:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},seeAllLabel:{attribute:"see-all-label",string:"seeAll"},shortcut:{},_active:{state:!0}},tr.styles=[k,Qr,oi,Pc,x`
|
|
665
671
|
:host { display: block; position: relative; }
|
|
666
672
|
.wrap { position: relative; }
|
|
667
673
|
.box {
|
|
@@ -691,7 +697,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
691
697
|
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
692
698
|
}
|
|
693
699
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
694
|
-
`];$("cm-global-search",tr);var Tm=0,
|
|
700
|
+
`];$("cm-global-search",tr);var Tm=0,Cg="";function zm(){Tm++===0&&(Cg=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function go(){Tm>0&&--Tm===0&&(document.documentElement.style.overflow=Cg)}function _m(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var da,Rt,ha,ma,ld,cd,dd,hd,md,pd,ee=class extends T{constructor(){super(...arguments);p(this,ma);this.open=!1;this.label="";this.uid=A("cm-ovl");p(this,da,null);p(this,Rt,!1);p(this,ha,!1);p(this,cd,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});p(this,dd,e=>{e.preventDefault(),this.requestClose("escape")});p(this,hd,()=>{this.open&&!this.dialog?.open&&(this.open=!1,s(this,ma,ld).call(this))});p(this,md,e=>{g(this,ha,e.target===e.currentTarget)});p(this,pd,e=>{if(e.target===e.currentTarget&&r(this,ha)){let t=e.currentTarget.getBoundingClientRect();(!(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom)||this.backdropFillsDialog)&&this.requestClose("backdrop")}g(this,ha,!1)});this.backdropFillsDialog=!1}show(){this.open=!0}close(){this.open=!1}requestClose(e="method"){let t=this.dispatchEvent(new CustomEvent("cm-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0}));return t&&(this.open=!1),t}closeNow(){this.open=!1;let e=this.dialog;e?.open&&(e.close(),s(this,ma,ld).call(this))}get dialog(){return this.renderRoot?.querySelector("dialog")}updated(e){if(super.updated(e),!e.has("open"))return;let t=this.dialog;if(t)if(this.open&&!t.open){if(g(this,da,_m()),!this.isConnected)return;t.showModal(),r(this,Rt)||(zm(),g(this,Rt,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),s(this,ma,ld).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,Rt)&&(go(),g(this,Rt,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
695
701
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
696
702
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
697
703
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
@@ -731,7 +737,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
731
737
|
|
|
732
738
|
}
|
|
733
739
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
734
|
-
`];var
|
|
740
|
+
`];var x0=z("commandPalette",{label:"Command palette",placeholder:"Search or run a command",recent:"Recent",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all"}),Sg=o=>o.normalize("NFD").replace(/\p{M}/gu,"").toLocaleLowerCase();function Lg(o,n){let e=Sg(n).split(/\s+/).filter(Boolean);if(!e.length)return!0;let t=Sg([o.title,...o.keywords??[]].join(" "));return e.every(i=>t.includes(i))}var fo,ve,Cm,Sm,bo,ud,gd,Dg,Ag,pa=class extends ee{constructor(){super();p(this,ve);this.value="";this.results=[];this.actions=[];this.recent=[];this.loading=!1;this.shortcut="";this._active=-1;p(this,fo,e=>{!this.shortcut||e.defaultPrevented||e.repeat||!km(e,this.shortcut)||!this.open&&!$m(this.shortcut)&&id(e)||this.open&&!$m(this.shortcut)||(e.preventDefault(),this.toggle())});p(this,ud,e=>{this.value=e.target.value,this._active=s(this,ve,bo).call(this).length?0:-1,this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))});p(this,gd,e=>{let t=s(this,ve,bo).call(this).length;switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this._active=Fc(this._active,e.key==="ArrowDown"?1:-1,t);break;case"Home":case"End":if(e.shiftKey||!t)break;e.preventDefault(),this._active=e.key==="Home"?0:t-1;break;case"Enter":if(e.isComposing||this._active<0)break;e.preventDefault(),this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.click();break;default:}});this.label=void 0}toggle(){this.open?this.requestClose("method"):this.show()}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",r(this,fo))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",r(this,fo))}willUpdate(e){if(super.willUpdate?.(e),e.has("open")&&!this.open&&e.get("open")&&(this.value="",this._active=-1),["results","actions","recent","loading","value","open"].some(t=>e.has(t))){let t=s(this,ve,bo).call(this).length;(this._active>=t||this._active<0)&&(this._active=t?0:-1)}}updated(e){super.updated(e),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.scrollIntoView({block:"nearest"})}focusFirst(){let e=this.renderRoot.querySelector("input");e?.focus(),e?.select()}render(){let e=this.open?s(this,ve,Sm).call(this):[],t=s(this,ve,bo).call(this,e),i=r(this,ve,Cm),a=t.filter(u=>u.item).length,l=!this.open||!i?"":this.loading?this.loadingText:t.length?this.t("results",{count:a}):this.emptyText,d=this.uid,m=-1;return this.renderDialog(c`<div class="panel" part="panel">
|
|
735
741
|
<div class="top">
|
|
736
742
|
<div class="box" part="box">
|
|
737
743
|
<cm-icon name="search" size="16"></cm-icon>
|
|
@@ -750,13 +756,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
750
756
|
<div role="listbox" id="${d}-list" part="listbox" aria-label=${this.label} ?hidden=${!t.length}>
|
|
751
757
|
${e.map((u,v)=>c`<div role="group" aria-labelledby="${d}-g${v}">
|
|
752
758
|
${Oc(`${d}-g${v}`,u.group.label,u.group.total!==void 0?this.formatNumber(u.group.total):void 0,this.t("results",{count:u.group.total??0}))}
|
|
753
|
-
${u.rows.map(b=>{let w=++m,y=b.item;return Bc({id:`${d}-o${w}`,active:w===this._active,href:b.href,cls:y?"":"all",keyshortcuts:y?.shortcut?
|
|
759
|
+
${u.rows.map(b=>{let w=++m,y=b.item;return Bc({id:`${d}-o${w}`,active:w===this._active,href:b.href,cls:y?"":"all",keyshortcuts:y?.shortcut?Tg(y.shortcut):void 0,onHover:()=>this._active=w,onChoose:M=>s(this,ve,Dg).call(this,M,b)},y?qc(y,s(this,ve,Ag).call(this,y.shortcut)):c`<span class="text">${b.group.seeAllLabel||this.seeAllLabel}</span>`)})}
|
|
754
760
|
</div>`)}
|
|
755
761
|
</div>
|
|
756
762
|
${i&&!this.loading&&!t.length?c`<p class="message" aria-hidden="true">${this.emptyText}</p>`:h}
|
|
757
763
|
</div>
|
|
758
764
|
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
759
|
-
</div>`)}};fo=new WeakMap,ve=new WeakSet,Cm=function(){return this.value.trim()},Sm=function(){let e=r(this,ve,Cm),t=[],i=(a,l,d=!1)=>{let m=l.map(u=>({group:a,item:u,href:u.href}));d&&a.href&&m.push({group:a,href:a.href}),l.length&&t.push({group:a,rows:m})};if(!e)this.recent?.length&&i({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let a of this.results??[])a?.items?.length&&i(a,a.items,!0);for(let a of this.actions??[])a?.items?.length&&i(a,e?a.items.filter(l=>
|
|
765
|
+
</div>`)}};fo=new WeakMap,ve=new WeakSet,Cm=function(){return this.value.trim()},Sm=function(){let e=r(this,ve,Cm),t=[],i=(a,l,d=!1)=>{let m=l.map(u=>({group:a,item:u,href:u.href}));d&&a.href&&m.push({group:a,href:a.href}),l.length&&t.push({group:a,rows:m})};if(!e)this.recent?.length&&i({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let a of this.results??[])a?.items?.length&&i(a,a.items,!0);for(let a of this.actions??[])a?.items?.length&&i(a,e?a.items.filter(l=>Lg(l,e)):a.items);return t},bo=function(e=s(this,ve,Sm).call(this)){return e.flatMap(t=>t.rows)},ud=new WeakMap,gd=new WeakMap,Dg=function(e,t){if(this.closeNow(),!this.dispatchEvent(new CustomEvent("cm-select",{detail:{item:t.item,group:t.group,href:t.href},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}t.item?.run?.(t.item)},Ag=function(e){return e?c`<span class="keys" aria-hidden="true">${rd(e).map(t=>c`<kbd>${t}</kbd>`)}</span>`:h},pa.properties={...ee.properties,label:{string:"label"},placeholder:{string:"placeholder"},value:{},results:{type:Array},actions:{type:Array},recent:{type:Array},loading:{type:Boolean,reflect:!0},shortcut:{},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},recentLabel:{attribute:"recent-label",string:"recent"},seeAllLabel:{attribute:"see-all-label",string:"seeAll"},_active:{state:!0}},pa.styles=[...ee.overlayStyles,Qr,oi,Pc,x`
|
|
760
766
|
dialog {
|
|
761
767
|
position: fixed; inset: 0; margin: max(var(--cm-space-16), 12dvh) auto auto; height: fit-content;
|
|
762
768
|
width: min(var(--cm-command-palette-width, 640px), calc(100vw - 32px));
|
|
@@ -797,18 +803,18 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
797
803
|
.x { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
798
804
|
[role='option'] { min-height: var(--cm-control-height-touch); }
|
|
799
805
|
}
|
|
800
|
-
`];$("cm-command-palette",pa);var
|
|
806
|
+
`];$("cm-command-palette",pa);var ay=/^(\d{4})-(\d{2})-(\d{2})$/;function N(o){let n=ay.exec(o??"");if(!n)return null;let e=new Date(+n[1],+n[2]-1,+n[3]);return e.getFullYear()===+n[1]&&e.getMonth()===+n[2]-1&&e.getDate()===+n[3]?e:null}var ft=(o,n=2)=>String(o).padStart(n,"0"),P=o=>`${ft(o.getFullYear(),4)}-${ft(o.getMonth()+1)}-${ft(o.getDate())}`,Lm=()=>P(new Date),G=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function Ze(o,n){let e=new Date(o.getFullYear(),o.getMonth()+n,1),t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return new Date(e.getFullYear(),e.getMonth(),Math.min(o.getDate(),t))}var Ht=o=>new Date(o.getFullYear(),o.getMonth(),1),ua=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var sy=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function ir(o){let n=sy.exec(o??"");return n?+n[1]*60+ +n[2]:null}var vo=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${ft(Math.floor(n/60))}:${ft(n%60)}`};function Qe(o){let[n="",e=""]=(o??"").split("T"),t=ir(e);return{date:N(n)?n:"",time:t===null?"":vo(t)}}function vt(o,n=!1){let{date:e,time:t}=Qe(o),i=N(e);if(!i)return null;let a=t?ir(t):n?1439:0;return new Date(i.getFullYear(),i.getMonth(),i.getDate(),Math.floor(a/60),a%60)}var Ng=()=>{let o=new Date;return`${P(o)}T${ft(o.getHours())}:${ft(o.getMinutes())}`},Rg=new Map;function bd(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,i=Rg.get(t);if(i)return i;let a={hour:"numeric",minute:"2-digit",numberingSystem:"latn",...e?{hourCycle:e}:{}},l=new Intl.DateTimeFormat(o,a),d=l.resolvedOptions().hourCycle,m=M=>new Date(2e3,0,1,M,30),u=M=>(new Intl.DateTimeFormat(o,{hour:"numeric",hourCycle:"h12"}).formatToParts(m(M)).find(D=>D.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),v=(M,D)=>[...new Set([M,...D].filter(Boolean))],b=M=>M.replace(/[\u202f\u00a0]/g," "),w=b(l.formatToParts(m(9)).map(M=>M.type==="hour"?"{h}":M.type==="minute"?"{m}":M.value).join("")),y={format:M=>b(l.format(new Date(2e3,0,1,Math.floor(M/60),M%60))),dateTime:M=>ae(M,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",...e?{hourCycle:e}:{}},o),pattern:w,hour12:d==="h12"||d==="h11",am:v(u(9),["am","a"]),pm:v(u(15),["pm","p"])};return Rg.set(t,y),y}var Ig=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function Dm(o,n){let e=o.trim().toLowerCase().normalize("NFKC");if(!e)return null;let t=e.replace(/[^\p{L}]/gu,""),i=!!t&&n.pm.includes(t),a=!!t&&n.am.includes(t);if(t&&!i&&!a)return null;let l=e.match(/\d+/g)??[],d,m;if(l.length===1){let u=l[0];if(u.length<=2)d=+u,m=0;else if(u.length<=4)d=+u.slice(0,-2),m=+u.slice(-2);else return null}else if(l.length===2||l.length===3){if(l[0].length>2||l[1].length!==2)return null;d=+l[0],m=+l[1]}else return null;if(m>59)return null;if(a||i){if(d<1||d>12)return null;d=d%12+(i?12:0)}else if(d>23)return null;return vo(d*60+m)}var ga={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},yo=o=>Array.isArray(o)?o:typeof o=="string"?ga.fromAttribute(o):[];function ba(o,n){let e=[n,In(o)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function fa(o){try{let n=new Intl.Locale(o),e=n.getWeekInfo?.()??n.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var Hg=new Map;function va(o){let n=Hg.get(o);if(n)return n;let e=y=>new Intl.DateTimeFormat(o,y),t=e({day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"}),i=e({weekday:"short"}),a=e({weekday:"long"}),l=new Date(2024,0,7),d=t.formatToParts(new Date(2026,10,15)),m=d.filter(y=>y.type==="day"||y.type==="month"||y.type==="year").map(y=>y.type),u=d.map(y=>y.type==="day"?"{d}":y.type==="month"?"{m}":y.type==="year"?"{y}":y.value).join(""),v=(y,M)=>Array.from({length:12},(D,H)=>new Intl.DateTimeFormat(y,{month:M}).format(new Date(2024,H,1)).toLowerCase().replace(/\./g,"")),b=Array.from({length:12},(y,M)=>[...new Set([v(o,"long")[M],v(o,"short")[M],v("en","long")[M],v("en","short")[M]])]),w={short:y=>t.format(y),long:y=>ae(y,{weekday:"long",day:"numeric",month:"long",year:"numeric"},o),medium:y=>ae(y,{day:"numeric",month:"short",year:"numeric"},o),monthYear:y=>ae(y,{month:"long",year:"numeric"},o),day:y=>ae(y,{day:"numeric"},o),weekdaysShort:Array.from({length:7},(y,M)=>i.format(G(l,M))),weekdaysLong:Array.from({length:7},(y,M)=>a.format(G(l,M))),pattern:m.length===3?u:"{y}-{m}-{d}",order:m.length===3?m:["year","month","day"],months:b};return Hg.set(o,w),w}var fd=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function vd(o,n){let e=o.trim().toLowerCase();if(!e)return null;let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);if(t.length!==3)return null;let i,a,l,d=t.findIndex(u=>/\p{L}/u.test(u));if(d>=0){let u=t[d];a=n.months.findIndex(y=>y.some(M=>M===u||u.length>=3&&M.startsWith(u)))+1;let v=t.filter((y,M)=>M!==d);if(!a||v.some(y=>!/^\d+$/.test(y)))return null;let b=v.findIndex(y=>y.length===4),w=b>=0?b:1;i=+v[w],l=+v[1-w],v[w].length<=2&&(i+=2e3)}else{if(t.some(b=>!/^\d+$/.test(b)))return null;let u=t[0].length===4?["year","month","day"]:n.order,v=b=>t[u.indexOf(b)];if(i=+v("year"),a=+v("month"),l=+v("day"),v("year").length<=2)i+=2e3;else if(v("year").length!==4)return null}let m=`${ft(i,4)}-${ft(a)}-${ft(l)}`;return N(m)?m:null}function yd(o,n,e,t){let i=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return G(e,1);case"ArrowLeft":return G(e,-1);case"ArrowDown":return G(e,7);case"ArrowUp":return G(e,-7);case"Home":return G(e,-i);case"End":return G(e,6-i);case"PageDown":return Ze(e,n.shiftKey?12:1);case"PageUp":return Ze(e,n.shiftKey?-12:-1);default:return null}}var mi=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function xd(o){let{fmt:n,firstDay:e,month:t,focus:i,min:a,max:l}=o,d=Ht(t),m=(d.getDay()-e+7)%7,u=ua(t).getDate(),v=[],b=Array(m).fill(null);for(let H=1;H<=u;H++)b.push(new Date(t.getFullYear(),t.getMonth(),H)),b.length===7&&(v.push(b),b=[]);b.length&&v.push([...b,...Array(7-b.length).fill(null)]);let w=Array.from({length:7},(H,q)=>(q+e)%7),y=Lm(),M=!!a&&ua(Ze(d,-1))<a,D=!!l&&Ze(d,1)>l;return c`<div class="cal-head">
|
|
801
807
|
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.previousLabel} ?disabled=${M} @click=${()=>o.onMonth(-1)}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
802
808
|
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
803
809
|
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${D} @click=${()=>o.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
804
810
|
</div>
|
|
805
811
|
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${o.id}-month" @keydown=${o.onKey}>
|
|
806
812
|
<thead><tr>${w.map(H=>c`<th scope="col" abbr=${n.weekdaysLong[H]}><span aria-hidden="true">${n.weekdaysShort[H]}</span><span class="vh">${n.weekdaysLong[H]}</span></th>`)}</tr></thead>
|
|
807
|
-
<tbody>${v.map(H=>c`<tr>${H.map(q=>{if(!q)return c`<td class="empty"></td>`;let F=P(q),W=o.isDisabled(q)||!!a&&q<a||!!l&&q>l,Tt=o.mark(q),
|
|
813
|
+
<tbody>${v.map(H=>c`<tr>${H.map(q=>{if(!q)return c`<td class="empty"></td>`;let F=P(q),W=o.isDisabled(q)||!!a&&q<a||!!l&&q>l,Tt=o.mark(q),K=o.note?.(q);return c`<td class="day ${Tt} ${F===y?"today":""}" data-date=${F}
|
|
808
814
|
tabindex=${F===P(i)?"0":"-1"}
|
|
809
815
|
aria-selected=${Tt?"true":"false"} aria-disabled=${W?"true":h}
|
|
810
816
|
aria-current=${F===y?"date":h}
|
|
811
|
-
aria-label="${n.long(q)}${
|
|
817
|
+
aria-label="${n.long(q)}${K?`, ${K}`:""}"
|
|
812
818
|
@click=${()=>!W&&o.onPick(q)} @pointerenter=${()=>o.onHover?.(q)}><span aria-hidden="true">${n.day(q)}</span></td>`})}</tr>`)}</tbody>
|
|
813
819
|
</table>`}var wd=x`
|
|
814
820
|
.pop {
|
|
@@ -874,7 +880,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
874
880
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
875
881
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
876
882
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
877
|
-
`;var
|
|
883
|
+
`;var D0=z("datePicker",{choose:"Choose date",chooseFor:"Choose date for {label}",change:"Change date, {date}",changeFor:"Change date for {label}, {date}",dialog:"Choose date",previousMonth:"Previous month",nextMonth:"Next month",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badInput:"Enter a date like {pattern}.",required:"Enter or choose a date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"This date isn't available. Choose another date.",time:"Time",timeFor:"Time for {label}",patternHour:"hh",patternMinute:"mm",badTime:"Enter a time like {pattern}.",timeMissing:"Enter a time.",stepMismatch:{one:"Choose a time on the minute.",other:"Choose a time in steps of {count} minutes."}}),$a,he,et,ka,Ot,bi,Re,qe,Ea,Ma,E,xo,pi,Ta,Ed,rr,ya,Nt,ui,It,Pt,Md,Am,Rm,xa,ar,Hm,Nm,Pg,Td,Og,Im,wa,wo,$o,Pm,qg,zd,Om,qm,_d,Cd,Sd,Ld,Dd,ko,gi=class extends T{constructor(){super(...arguments);p(this,E);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.min="";this.max="";this.placeholder="";p(this,$a,"");this.disabledDates=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this.time=!1;this.step=1;this.hourCycle="";this._text="";this._focus=new Date;p(this,he,this.attachInternals());p(this,et,A("cm-dp"));p(this,ka,null);p(this,Ot,!1);p(this,bi,!1);p(this,Re,"");p(this,qe,"");p(this,Ea,!1);p(this,Ma,"");p(this,Ta,!1);p(this,zd,e=>{e.key==="Enter"?s(this,E,Pm).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),s(this,E,qg).call(this,e.key==="ArrowUp"?1:-1))});p(this,_d,()=>{this.disabled||(this.open?this.open=!1:(s(this,E,$o).call(this),this.show()))});p(this,Cd,e=>{e.key==="Enter"?s(this,E,$o).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),s(this,E,$o).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});p(this,Sd,e=>{let t=yd(J(e,this),e,this._focus,r(this,E,Am));if(t){e.preventDefault(),this._focus=mi(t,r(this,E,It),r(this,E,Pt)),g(this,bi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,E,Om).call(this,this._focus))});p(this,Ld,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,E,qm).call(this);return}$d(e,e.currentTarget)});p(this,Dd,e=>{this._focus=mi(Ze(this._focus,e),r(this,E,It),r(this,E,Pt))});p(this,ko,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,$a)}set locale(e){let t=r(this,$a);g(this,$a,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,ka)===null&&g(this,ka,this.value),document.addEventListener("pointerdown",r(this,ko),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,ko),!0)}get form(){return r(this,he).form}get validity(){return r(this,he).validity}get validationMessage(){return r(this,he).validationMessage}get valueAsDate(){return this.time?this.value?vt(this.value):null:N(this.value)}checkValidity(){return s(this,E,Td).call(this),r(this,he).checkValidity()}reportValidity(){return s(this,E,Td).call(this),r(this,he).reportValidity()}formResetCallback(){this.value=r(this,ka)??"",this.time&&(s(this,E,Nm).call(this,this.value),g(this,E,s(this,E,ar).call(this,r(this,qe)),pi)),this._text=s(this,E,xa).call(this,r(this,E,Nt)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(s(this,E,Pg).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=r(this,E,It),a=r(this,E,Pt);return i&&t<i||a&&t>a?!0:yo(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!r(this,Ta)?(s(this,E,Nm).call(this,this.value),r(this,Ea)||g(this,E,s(this,E,ar).call(this,r(this,qe)),pi)):this.time&&(e.has("locale")||e.has("hourCycle"))&&r(this,qe)&&g(this,E,s(this,E,ar).call(this,r(this,qe)),pi),(e.has("value")||e.has("time"))&&!r(this,Ot)?this._text=s(this,E,xa).call(this,r(this,E,Nt)):e.has("locale")&&N(r(this,E,Nt))&&(this._text=s(this,E,xa).call(this,r(this,E,Nt))),g(this,Ot,!1),g(this,Ea,!1),g(this,Ta,!1)}updated(e){r(this,he).setFormValue(this.value||null,this.time?this.value:this._text),s(this,E,Td).call(this),this.open&&r(this,bi)&&(g(this,bi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&g(this,bi,!1)}render(){let e=r(this,E,rr),t=N(r(this,E,Nt)),i=[this.error&&`${r(this,et)}-err`,this.helpText&&`${r(this,et)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=this.label||a||"",d=Ht(this._focus);return c`<div class="field">
|
|
878
884
|
${this.label?c`<label class="label" for="${r(this,et)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
879
885
|
<div class="wrap ${this.time?"timed":""}">
|
|
880
886
|
<div class="box" part="box">
|
|
@@ -906,7 +912,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
906
912
|
</div>
|
|
907
913
|
${this.error?c`<p class="error" id="${r(this,et)}-err" role="alert">${this.error}</p>`:h}
|
|
908
914
|
${this.helpText?c`<p class="help" id="${r(this,et)}-help">${this.helpText}</p>`:h}
|
|
909
|
-
</div>`}};$a=new WeakMap,he=new WeakMap,et=new WeakMap,ka=new WeakMap,Ot=new WeakMap,bi=new WeakMap,Re=new WeakMap,qe=new WeakMap,Ea=new WeakMap,Ma=new WeakMap,E=new WeakSet,xo=function(){return r(this,Ma)},pi=function(e){e!==r(this,Ma)&&(g(this,Ma,e),this.requestUpdate())},Ta=new WeakMap,Ed=function(){return ba(this,this.locale)},rr=function(){return va(r(this,E,Ed))},ya=function(){return bd(r(this,E,Ed),this.hourCycle)},Nt=function(){return this.time?r(this,Re):this.value},ui=function(e){return this.time&&e.trim().toLowerCase()==="now"?Hg():e},It=function(){return N(Qe(s(this,E,ui).call(this,this.min)).date||this.min)},Pt=function(){return N(Qe(s(this,E,ui).call(this,this.max)).date||this.max)},Md=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Am=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,E,Ed)):(Math.trunc(e)%7+7)%7},Rm=function(){return fd(r(this,E,rr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},xa=function(e){let t=N(e);return t?r(this,E,rr).short(t):e},ar=function(e){let t=ir(e);return t===null?"":r(this,E,ya).format(t)},Hm=function(){return Ng(r(this,E,ya),{h:this.t("patternHour"),m:this.t("patternMinute")})},Nm=function(e){let{date:t,time:i}=Qe(e);g(this,Re,t),g(this,qe,t?i:"")},Ig=function(){let e=new Date,t=N(r(this,E,Nt))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=mi(t,r(this,E,It),r(this,E,Pt)),g(this,bi,!0)},Td=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,E,Nt)),i=r(this,E,rr);this.error?r(this,he).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,he).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,E,Rm)}),e):this.time?s(this,E,Pg).call(this,t,e):this.required&&!t?r(this,he).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,E,It)&&t<r(this,E,It)?r(this,he).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,E,It))}),e):t&&r(this,E,Pt)&&t>r(this,E,Pt)?r(this,he).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,E,Pt))}),e):t&&this.isUnavailable(this.value)?r(this,he).setValidity({customError:!0},this.t("unavailable"),e):r(this,he).setValidity({})},Pg=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(b,w,y,M=t)=>r(this,he).setValidity(b,this.t(w,y),M),l=ir(r(this,qe));if(r(this,E,xo).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,E,Hm)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,he).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=vt(`${r(this,Re)}T${r(this,qe)}`),m=vt(s(this,E,ui).call(this,this.min)),u=vt(s(this,E,ui).call(this,this.max),!0),v=(b,w)=>Qe(b).time?r(this,E,ya).dateTime(w):r(this,E,rr).medium(w);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,E,ui).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,E,ui).call(this,this.max),u)},i);if(l%r(this,E,Md))return a({stepMismatch:!0},"stepMismatch",{count:r(this,E,Md)},i);if(this.isUnavailable(r(this,Re)))return a({customError:!0},"unavailable");r(this,he).setValidity({})},Im=function(e){e!==this.value&&(this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},wa=function(e,t){g(this,Re,e),g(this,qe,t);let i=e&&t?`${e}T${t}`:"";g(this,Ta,!0),this.requestUpdate(),s(this,E,Im).call(this,i)},wo=function(e){this.time?s(this,E,wa).call(this,e,r(this,qe)):s(this,E,Im).call(this,e)},$o=function(){let e=this._text.trim();if(!e){s(this,E,wo).call(this,"");return}let t=vd(e,r(this,E,rr));t?(s(this,E,wo).call(this,t),this._text=s(this,E,xa).call(this,t)):(g(this,Ot,!0),s(this,E,wo).call(this,""))},Pm=function(){let e=r(this,E,xo).trim(),t=e?Dm(e,r(this,E,ya)):"";if(g(this,Ot,!0),t===null){g(this,Ea,!0),s(this,E,wa).call(this,r(this,Re),"");return}s(this,E,wa).call(this,r(this,Re),t),g(this,E,s(this,E,ar).call(this,t),pi)},Og=function(e){let t=r(this,E,Md),i=Dm(r(this,E,xo),r(this,E,ya));if(!i){let m=Qe(s(this,E,ui).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,Re)||r(this,Re)===m.date)?m.time:vo(u.getHours()*60+u.getMinutes()),ir(i)%t===0){g(this,Ot,!0),s(this,E,wa).call(this,r(this,Re),i),g(this,E,s(this,E,ar).call(this,i),pi);return}e=1}let a=ir(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=vo(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,Ot,!0),s(this,E,wa).call(this,r(this,Re),d),g(this,E,s(this,E,ar).call(this,d),pi)},zd=new WeakMap,Om=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,E,wo).call(this,t),this._text=s(this,E,xa).call(this,t),this.time&&!r(this,qe)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,E,qm).call(this))},qm=function(){this.renderRoot.querySelector(".trigger")?.focus()},_d=new WeakMap,Cd=new WeakMap,Sd=new WeakMap,Ld=new WeakMap,Dd=new WeakMap,ko=new WeakMap,gi.formAssociated=!0,gi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},gi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:ga},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_focus:{state:!0}},gi.styles=[k,kd,wd,x`.pop { min-width: 0; }`];$("cm-date-picker",gi);var B0=z("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month"}),sy={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[G(o,-1),G(o,-1)]],"last-7-days":["Last 7 days",o=>[G(o,-6),o]],"last-30-days":["Last 30 days",o=>[G(o,-29),o]],"last-90-days":["Last 90 days",o=>[G(o,-89),o]],"this-month":["This month",o=>[Ht(o),o]],"last-month":["Last month",o=>[Ht(Ze(o,-1)),ua(Ze(o,-1))]]},ny=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function qg(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=sy[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(ny(o))||t[0],start:P(a),end:P(l)}}var Ca,be,Be,Sa,La,vi,I,Bm,za,Fm,Bt,Ad,qt,Bg,Rd,_a,jm,Fg,Hd,Nd,Id,Pd,Od,Eo,Um,fi=class extends T{constructor(){super(...arguments);p(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,Ca,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;p(this,be,this.attachInternals());p(this,Be,A("cm-drp"));p(this,Sa,null);p(this,La,!1);p(this,vi,!1);p(this,Bt,"start");p(this,Nd,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,_a).call(this,"start"),s(this,I,_a).call(this,"end"),this.show()))});p(this,Id,e=>t=>{t.key==="Enter"?s(this,I,_a).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,_a).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,Pd,e=>{let t=yd(J(e,this),e,this._focus,r(this,I,Fm));if(t){e.preventDefault(),this._focus=mi(t,N(this.min),N(this.max)),g(this,vi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,jm).call(this,this._focus))});p(this,Od,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,Hd).call(this);return}$d(e,e.currentTarget)});p(this,Eo,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ca)}set locale(e){let t=r(this,Ca);g(this,Ca,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Sa)||g(this,Sa,[this.start,this.end]),document.addEventListener("pointerdown",r(this,Eo),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Eo),!0)}get form(){return r(this,be).form}get validity(){return r(this,be).validity}get validationMessage(){return r(this,be).validationMessage}checkValidity(){return r(this,be).checkValidity()}reportValidity(){return r(this,be).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,Sa)??["",""],this._startText=s(this,I,qt).call(this,this.start),this._endText=s(this,I,qt).call(this,this.end),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=N(this.start)?this.start:"",this._draftEnd=N(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=mi(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),g(this,Bt,"start"),g(this,vi,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=N(this.min),a=N(this.max);return i&&t<i||a&&t>a?!0:yo(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,La)||(e.has("start")&&(this._startText=s(this,I,qt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,qt).call(this,this.end))),g(this,La,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,qt).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,qt).call(this,this.end)))}updated(){let e=N(this.start),t=N(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,be).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let a=this.renderRoot.querySelectorAll("input"),[l,d]=[a[0]??void 0,a[1]??void 0],m=r(this,I,za),u=N(this.min),v=N(this.max);this.error?r(this,be).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,be).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,I,Ad)}),l):this._endText.trim()&&!t?r(this,be).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Ad)}),d):this.required&&(!e||!t)?r(this,be).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,be).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,be).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,be).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,be).setValidity({customError:!0},this.t("unavailable"),l):r(this,be).setValidity({}),this.open&&r(this,vi)&&(g(this,vi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,za),t=N(this.start),i=N(this.end),a=[this.error&&`${r(this,Be)}-err`,this.helpText&&`${r(this,Be)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=yo(this.presets).map(b=>qg(b,new Date,w=>this.t(w))).filter(b=>!!b),u=r(this,Bt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=b=>{let w=b==="start"?this._startText:this._endText;return c`<input id="${r(this,Be)}-${b}" type="text" autocomplete="off" spellcheck="false"
|
|
915
|
+
</div>`}};$a=new WeakMap,he=new WeakMap,et=new WeakMap,ka=new WeakMap,Ot=new WeakMap,bi=new WeakMap,Re=new WeakMap,qe=new WeakMap,Ea=new WeakMap,Ma=new WeakMap,E=new WeakSet,xo=function(){return r(this,Ma)},pi=function(e){e!==r(this,Ma)&&(g(this,Ma,e),this.requestUpdate())},Ta=new WeakMap,Ed=function(){return ba(this,this.locale)},rr=function(){return va(r(this,E,Ed))},ya=function(){return bd(r(this,E,Ed),this.hourCycle)},Nt=function(){return this.time?r(this,Re):this.value},ui=function(e){return this.time&&e.trim().toLowerCase()==="now"?Ng():e},It=function(){return N(Qe(s(this,E,ui).call(this,this.min)).date||this.min)},Pt=function(){return N(Qe(s(this,E,ui).call(this,this.max)).date||this.max)},Md=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Am=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,E,Ed)):(Math.trunc(e)%7+7)%7},Rm=function(){return fd(r(this,E,rr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},xa=function(e){let t=N(e);return t?r(this,E,rr).short(t):e},ar=function(e){let t=ir(e);return t===null?"":r(this,E,ya).format(t)},Hm=function(){return Ig(r(this,E,ya),{h:this.t("patternHour"),m:this.t("patternMinute")})},Nm=function(e){let{date:t,time:i}=Qe(e);g(this,Re,t),g(this,qe,t?i:"")},Pg=function(){let e=new Date,t=N(r(this,E,Nt))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=mi(t,r(this,E,It),r(this,E,Pt)),g(this,bi,!0)},Td=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,E,Nt)),i=r(this,E,rr);this.error?r(this,he).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,he).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,E,Rm)}),e):this.time?s(this,E,Og).call(this,t,e):this.required&&!t?r(this,he).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,E,It)&&t<r(this,E,It)?r(this,he).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,E,It))}),e):t&&r(this,E,Pt)&&t>r(this,E,Pt)?r(this,he).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,E,Pt))}),e):t&&this.isUnavailable(this.value)?r(this,he).setValidity({customError:!0},this.t("unavailable"),e):r(this,he).setValidity({})},Og=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(b,w,y,M=t)=>r(this,he).setValidity(b,this.t(w,y),M),l=ir(r(this,qe));if(r(this,E,xo).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,E,Hm)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,he).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=vt(`${r(this,Re)}T${r(this,qe)}`),m=vt(s(this,E,ui).call(this,this.min)),u=vt(s(this,E,ui).call(this,this.max),!0),v=(b,w)=>Qe(b).time?r(this,E,ya).dateTime(w):r(this,E,rr).medium(w);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,E,ui).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,E,ui).call(this,this.max),u)},i);if(l%r(this,E,Md))return a({stepMismatch:!0},"stepMismatch",{count:r(this,E,Md)},i);if(this.isUnavailable(r(this,Re)))return a({customError:!0},"unavailable");r(this,he).setValidity({})},Im=function(e){e!==this.value&&(this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},wa=function(e,t){g(this,Re,e),g(this,qe,t);let i=e&&t?`${e}T${t}`:"";g(this,Ta,!0),this.requestUpdate(),s(this,E,Im).call(this,i)},wo=function(e){this.time?s(this,E,wa).call(this,e,r(this,qe)):s(this,E,Im).call(this,e)},$o=function(){let e=this._text.trim();if(!e){s(this,E,wo).call(this,"");return}let t=vd(e,r(this,E,rr));t?(s(this,E,wo).call(this,t),this._text=s(this,E,xa).call(this,t)):(g(this,Ot,!0),s(this,E,wo).call(this,""))},Pm=function(){let e=r(this,E,xo).trim(),t=e?Dm(e,r(this,E,ya)):"";if(g(this,Ot,!0),t===null){g(this,Ea,!0),s(this,E,wa).call(this,r(this,Re),"");return}s(this,E,wa).call(this,r(this,Re),t),g(this,E,s(this,E,ar).call(this,t),pi)},qg=function(e){let t=r(this,E,Md),i=Dm(r(this,E,xo),r(this,E,ya));if(!i){let m=Qe(s(this,E,ui).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,Re)||r(this,Re)===m.date)?m.time:vo(u.getHours()*60+u.getMinutes()),ir(i)%t===0){g(this,Ot,!0),s(this,E,wa).call(this,r(this,Re),i),g(this,E,s(this,E,ar).call(this,i),pi);return}e=1}let a=ir(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=vo(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,Ot,!0),s(this,E,wa).call(this,r(this,Re),d),g(this,E,s(this,E,ar).call(this,d),pi)},zd=new WeakMap,Om=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,E,wo).call(this,t),this._text=s(this,E,xa).call(this,t),this.time&&!r(this,qe)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,E,qm).call(this))},qm=function(){this.renderRoot.querySelector(".trigger")?.focus()},_d=new WeakMap,Cd=new WeakMap,Sd=new WeakMap,Ld=new WeakMap,Dd=new WeakMap,ko=new WeakMap,gi.formAssociated=!0,gi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},gi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:ga},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_focus:{state:!0}},gi.styles=[k,kd,wd,x`.pop { min-width: 0; }`];$("cm-date-picker",gi);var q0=z("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month"}),ny={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[G(o,-1),G(o,-1)]],"last-7-days":["Last 7 days",o=>[G(o,-6),o]],"last-30-days":["Last 30 days",o=>[G(o,-29),o]],"last-90-days":["Last 90 days",o=>[G(o,-89),o]],"this-month":["This month",o=>[Ht(o),o]],"last-month":["Last month",o=>[Ht(Ze(o,-1)),ua(Ze(o,-1))]]},oy=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Bg(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=ny[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(oy(o))||t[0],start:P(a),end:P(l)}}var Ca,be,Be,Sa,La,vi,I,Bm,za,Fm,Bt,Ad,qt,Fg,Rd,_a,jm,jg,Hd,Nd,Id,Pd,Od,Eo,Um,fi=class extends T{constructor(){super(...arguments);p(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,Ca,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;p(this,be,this.attachInternals());p(this,Be,A("cm-drp"));p(this,Sa,null);p(this,La,!1);p(this,vi,!1);p(this,Bt,"start");p(this,Nd,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,_a).call(this,"start"),s(this,I,_a).call(this,"end"),this.show()))});p(this,Id,e=>t=>{t.key==="Enter"?s(this,I,_a).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,_a).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,Pd,e=>{let t=yd(J(e,this),e,this._focus,r(this,I,Fm));if(t){e.preventDefault(),this._focus=mi(t,N(this.min),N(this.max)),g(this,vi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,jm).call(this,this._focus))});p(this,Od,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,Hd).call(this);return}$d(e,e.currentTarget)});p(this,Eo,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ca)}set locale(e){let t=r(this,Ca);g(this,Ca,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Sa)||g(this,Sa,[this.start,this.end]),document.addEventListener("pointerdown",r(this,Eo),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Eo),!0)}get form(){return r(this,be).form}get validity(){return r(this,be).validity}get validationMessage(){return r(this,be).validationMessage}checkValidity(){return r(this,be).checkValidity()}reportValidity(){return r(this,be).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,Sa)??["",""],this._startText=s(this,I,qt).call(this,this.start),this._endText=s(this,I,qt).call(this,this.end),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=N(this.start)?this.start:"",this._draftEnd=N(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=mi(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),g(this,Bt,"start"),g(this,vi,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=N(this.min),a=N(this.max);return i&&t<i||a&&t>a?!0:yo(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,La)||(e.has("start")&&(this._startText=s(this,I,qt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,qt).call(this,this.end))),g(this,La,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,qt).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,qt).call(this,this.end)))}updated(){let e=N(this.start),t=N(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,be).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let a=this.renderRoot.querySelectorAll("input"),[l,d]=[a[0]??void 0,a[1]??void 0],m=r(this,I,za),u=N(this.min),v=N(this.max);this.error?r(this,be).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,be).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,I,Ad)}),l):this._endText.trim()&&!t?r(this,be).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Ad)}),d):this.required&&(!e||!t)?r(this,be).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,be).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,be).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,be).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,be).setValidity({customError:!0},this.t("unavailable"),l):r(this,be).setValidity({}),this.open&&r(this,vi)&&(g(this,vi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,za),t=N(this.start),i=N(this.end),a=[this.error&&`${r(this,Be)}-err`,this.helpText&&`${r(this,Be)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=yo(this.presets).map(b=>Bg(b,new Date,w=>this.t(w))).filter(b=>!!b),u=r(this,Bt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=b=>{let w=b==="start"?this._startText:this._endText;return c`<input id="${r(this,Be)}-${b}" type="text" autocomplete="off" spellcheck="false"
|
|
910
916
|
.value=${ne(w)} placeholder=${r(this,I,Ad)}
|
|
911
917
|
aria-label=${b==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
912
918
|
?required=${this.required} ?disabled=${this.disabled}
|
|
@@ -927,7 +933,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
927
933
|
${this.open?c`<div class="body">
|
|
928
934
|
${m.length?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${m.map(b=>c`<li>
|
|
929
935
|
<button type="button" class="preset" aria-pressed=${b.start===this.start&&b.end===this.end?"true":"false"}
|
|
930
|
-
@click=${()=>s(this,I,
|
|
936
|
+
@click=${()=>s(this,I,jg).call(this,b)}>${b.label}</button></li>`)}</ul>`:h}
|
|
931
937
|
<div class="cal">${xd({id:r(this,Be),fmt:e,firstDay:r(this,I,Fm),month:Ht(this._focus),focus:this._focus,min:N(this.min),max:N(this.max),isDisabled:b=>this.isUnavailable(P(b)),mark:b=>s(this,I,Um).call(this,b),note:b=>{let w=s(this,I,Um).call(this,b);return w==="start"?this.t("startNote"):w==="end"?this.t("endNote"):""},onPick:b=>s(this,I,jm).call(this,b),onKey:r(this,Pd),onMonth:b=>{this._focus=mi(Ze(this._focus,b),N(this.min),N(this.max))},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:b=>{r(this,Bt)==="end"&&(this._hover=b)}})}
|
|
932
938
|
<p class="status" aria-live="polite">${u}</p>
|
|
933
939
|
</div>
|
|
@@ -936,7 +942,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
936
942
|
</div>
|
|
937
943
|
${this.error?c`<p class="error" id="${r(this,Be)}-err" role="alert">${this.error}</p>`:h}
|
|
938
944
|
${this.helpText?c`<p class="help" id="${r(this,Be)}-help">${this.helpText}</p>`:h}
|
|
939
|
-
</div>`}};Ca=new WeakMap,be=new WeakMap,Be=new WeakMap,Sa=new WeakMap,La=new WeakMap,vi=new WeakMap,I=new WeakSet,Bm=function(){return ba(this,this.locale)},za=function(){return va(r(this,I,Bm))},Fm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,I,Bm)):(Math.trunc(e)%7+7)%7},Bt=new WeakMap,Ad=function(){return fd(r(this,I,za),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},qt=function(e){let t=N(e);return t?r(this,I,za).short(t):e},
|
|
945
|
+
</div>`}};Ca=new WeakMap,be=new WeakMap,Be=new WeakMap,Sa=new WeakMap,La=new WeakMap,vi=new WeakMap,I=new WeakSet,Bm=function(){return ba(this,this.locale)},za=function(){return va(r(this,I,Bm))},Fm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,I,Bm)):(Math.trunc(e)%7+7)%7},Bt=new WeakMap,Ad=function(){return fd(r(this,I,za),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},qt=function(e){let t=N(e);return t?r(this,I,za).short(t):e},Fg=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Rd=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,s(this,I,Fg).call(this))},_a=function(e){let t=(e==="start"?this._startText:this._endText).trim(),i=t?vd(t,r(this,I,za)):"";t&&!i&&g(this,La,!0);let a=e==="start"?[i??"",this.end]:[this.start,i??""];s(this,I,Rd).call(this,...a),i&&(e==="start"?this._startText=s(this,I,qt).call(this,i):this._endText=s(this,I,qt).call(this,i))},jm=function(e){let t=P(e);if(!this.isUnavailable(t)){if(r(this,Bt)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",g(this,Bt,"end"),this._focus=e,g(this,vi,!0);return}this._draftEnd=t,this.open=!1,s(this,I,Rd).call(this,this._draftStart,t),s(this,I,Hd).call(this)}},jg=function(e){this.open=!1,s(this,I,Rd).call(this,e.start,e.end),s(this,I,Hd).call(this)},Hd=function(){this.renderRoot.querySelector(".trigger")?.focus()},Nd=new WeakMap,Id=new WeakMap,Pd=new WeakMap,Od=new WeakMap,Eo=new WeakMap,Um=function(e){let t=P(e),i=this._draftStart,a=this._draftEnd||(r(this,Bt)==="end"&&i?P(this._hover??this._focus):"");return t===i?"start":t===a&&a>i?"end":i&&a&&t>i&&t<a?"in-range":""},fi.formAssociated=!0,fi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},fi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},startName:{attribute:"start-name"},endName:{attribute:"end-name"},start:{},end:{},min:{},max:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:ga},isDateDisabled:{attribute:!1},presets:{converter:ga},startLabel:{attribute:"start-label",string:"start"},endLabel:{attribute:"end-label",string:"end"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_startText:{state:!0},_endText:{state:!0},_focus:{state:!0},_draftStart:{state:!0},_draftEnd:{state:!0},_hover:{state:!0}},fi.styles=[k,kd,wd,x`
|
|
940
946
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
941
947
|
input { flex: 0 1 6.6em; }
|
|
942
948
|
:host([size='small']) input { flex-basis: 6.6em; }
|
|
@@ -956,17 +962,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
956
962
|
.presets li { flex: 0 0 auto; }
|
|
957
963
|
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
958
964
|
}
|
|
959
|
-
`];$("cm-date-range-picker",fi);var
|
|
965
|
+
`];$("cm-date-range-picker",fi);var K0=z("fileUpload",{prompt:"Drag files here or {browse}",browse:"Browse",drop:"Drop files to upload",uploading:"Uploading {name}",cancel:"Cancel uploading {name}",cancelShort:"Cancel",addMore:"Add more",files:"Chosen files",remove:"Remove {name}",kilobytes:"{size} KB",megabytes:"{size} MB",required:"Please choose a file.",wrongType:"{name} is not an allowed file type",tooLarge:"{name} is larger than {size}",tooMany:"You can add up to {max} files",takePhoto:"Take a photo",retake:"Retake",removePhoto:"Remove",retakeName:"Retake {name}",removeName:"Remove {name}",photo:"photo"});function ly(o,n){if(!n.trim())return!0;let e=o.name.toLowerCase(),t=o.type.toLowerCase();return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).some(i=>i.startsWith(".")?e.endsWith(i):i.endsWith("/*")?t.startsWith(i.slice(0,-1)):t===i)}var tt,ie,Ft,O,Mo,Vm,qd,Bd,Km,Wm,Gm,Ym,sr,Ug,Vg,Xm,Kg,Wg,yi=class extends T{constructor(){super(...arguments);p(this,O);this.label="";this.hint="";this.name="";this.accept="";this.multiple=!1;this.maxSize=0;this.maxFiles=0;this.required=!1;this.disabled=!1;this.error="";this.files=[];this._rejected="";this._progress=new Map;this._fileErrors=new Map;this._over=!1;p(this,tt,this.attachInternals());p(this,ie,A("cm-fu"));p(this,Ft,new Map)}get form(){return r(this,tt).form}get validity(){return r(this,tt).validity}get validationMessage(){return r(this,tt).validationMessage}checkValidity(){return r(this,tt).checkValidity()}reportValidity(){return r(this,tt).reportValidity()}formResetCallback(){this.files=[],this._rejected="",this._progress=new Map,this._fileErrors=new Map}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,Ft).values())URL.revokeObjectURL(e);r(this,Ft).clear()}updated(e){if(e.has("files"))for(let[l,d]of r(this,Ft))this.files.includes(l)||(URL.revokeObjectURL(d),r(this,Ft).delete(l));let t=new FormData;for(let l of this.files)t.append(this.name||"file",l);r(this,tt).setFormValue(this.files.length?t:null);let i=(r(this,O,Mo)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,a=this.error||this._rejected;a?r(this,tt).setValidity({customError:!0},a,i):this.required&&!this.files.length?r(this,tt).setValidity({valueMissing:!0},this.t("required"),i):r(this,tt).setValidity({})}addFiles(e){let t=[...e],i=[],a=[],l=[];for(let m of t)ly(m,r(this,O,Vm))?this.maxSize&&m.size>this.maxSize?(a.push(m),l.push(this.t("tooLarge",{name:m.name,size:s(this,O,Bd).call(this,this.maxSize)}))):i.push(m):(a.push(m),l.push(this.t("wrongType",{name:m.name})));let d=r(this,O,qd)?[...this.files,...i]:i.slice(-1);!r(this,O,qd)&&!i.length&&(d=this.files),r(this,O,qd)&&this.maxFiles&&d.length>this.maxFiles&&(a.push(...d.slice(this.maxFiles)),l.push(this.t("tooMany",{max:this.maxFiles})),d=d.slice(0,this.maxFiles)),this._rejected=l.join(". "),a.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:a}})),d!==this.files&&(d.length!==this.files.length||d.some((m,u)=>m!==this.files[u]))&&(this.files=d,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}setProgress(e,t){let i=new Map(this._progress);t==null?i.delete(e):i.set(e,Math.min(100,Math.max(0,Number(t)||0))),this._progress=i}setFileError(e,t){let i=new Map(this._fileErrors);t?i.set(e,t):i.delete(e),this._fileErrors=i}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this._progress.has(e)&&this.setProgress(e,null),this._fileErrors.has(e)&&this.setFileError(e,""),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){if(r(this,O,Mo))return s(this,O,Wg).call(this);let e=this.error||this._rejected,t=!this.files.length||this.multiple,i=this.files.length>0;return c`
|
|
960
966
|
${this.label||this.hint&&i?c`<div class="head">
|
|
961
967
|
${this.label?c`<span class="label" id="${r(this,ie)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
962
968
|
${this.hint&&i?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h}
|
|
963
969
|
</div>`:h}
|
|
964
970
|
${i?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
965
|
-
${this.files.map(a=>s(this,O,
|
|
971
|
+
${this.files.map(a=>s(this,O,Vg).call(this,a))}
|
|
966
972
|
${t?c`<li>${s(this,O,Xm).call(this,!0)}</li>`:h}
|
|
967
973
|
</ul>`:s(this,O,Xm).call(this,!1)}
|
|
968
974
|
${e?c`<p class="msg" id="${r(this,ie)}-msg" role="alert">${e}</p>`:h}
|
|
969
|
-
`}};tt=new WeakMap,ie=new WeakMap,Ft=new WeakMap,O=new WeakSet,Mo=function(){return this.variant==="photo"},Vm=function(){return this.accept||(r(this,O,Mo)?"image/*":"")},qd=function(){return this.multiple&&!r(this,O,Mo)},Bd=function(e){return e>=1024*1024?this.t("megabytes",{size:this.formatNumber(+(e/1024/1024).toFixed(1),{useGrouping:!1})}):this.t("kilobytes",{size:this.formatNumber(Math.max(1,Math.round(e/1024)),{useGrouping:!1})})},Km=function(e){let t=r(this,Ft).get(e);return t||(t=URL.createObjectURL(e),r(this,Ft).set(e,t)),t},Wm=function(e){return this._progress.has(e)},Gm=function(e){let t=this.dispatchEvent(new CustomEvent("cm-cancel",{detail:{file:e},bubbles:!0,composed:!0,cancelable:!0}));this.setProgress(e,null),t&&this.removeFile(e)},Ym=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},sr=function(e){this.toggleAttribute("data-over",e),this._over=e},
|
|
975
|
+
`}};tt=new WeakMap,ie=new WeakMap,Ft=new WeakMap,O=new WeakSet,Mo=function(){return this.variant==="photo"},Vm=function(){return this.accept||(r(this,O,Mo)?"image/*":"")},qd=function(){return this.multiple&&!r(this,O,Mo)},Bd=function(e){return e>=1024*1024?this.t("megabytes",{size:this.formatNumber(+(e/1024/1024).toFixed(1),{useGrouping:!1})}):this.t("kilobytes",{size:this.formatNumber(Math.max(1,Math.round(e/1024)),{useGrouping:!1})})},Km=function(e){let t=r(this,Ft).get(e);return t||(t=URL.createObjectURL(e),r(this,Ft).set(e,t)),t},Wm=function(e){return this._progress.has(e)},Gm=function(e){let t=this.dispatchEvent(new CustomEvent("cm-cancel",{detail:{file:e},bubbles:!0,composed:!0,cancelable:!0}));this.setProgress(e,null),t&&this.removeFile(e)},Ym=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},sr=function(e){this.toggleAttribute("data-over",e),this._over=e},Ug=function(){if(this._over)return this.t("drop");let[e,t]=this.prompt.split("{browse}");return t===void 0?e:c`${e}<span class="browse">${this.t("browse")}</span>${t}`},Vg=function(e){let t=s(this,O,Wm).call(this,e),i=this._fileErrors.get(e)??"",a=`${r(this,ie)}-e${this.files.indexOf(e)}`,l=this._progress.get(e)??0;return c`<li class="item"><div class="file ${t?"busy":""} ${i?"invalid":""}">
|
|
970
976
|
${e.type.startsWith("image/")?c`<img src=${s(this,O,Km).call(this,e)} alt=${e.name} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${s(this,O,Bd).call(this,e.size)}</span></div>`}
|
|
971
977
|
${t?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
972
978
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(l)}><span style="inline-size:${l}%"></span></div>`:h}
|
|
@@ -980,8 +986,8 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
980
986
|
aria-describedby=${t||h} aria-invalid=${this.error||this._rejected?"true":h}
|
|
981
987
|
@change=${s(this,O,Ym)} @cancel=${a=>a.stopPropagation()} />
|
|
982
988
|
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${r(this,ie)}-p">${this.t("addMore")}</span>`:c`<span class="ico"><cm-icon name="upload" size="20"></cm-icon></span>
|
|
983
|
-
<span class="words"><span id="${r(this,ie)}-p">${s(this,O,
|
|
984
|
-
</label>`},
|
|
989
|
+
<span class="words"><span id="${r(this,ie)}-p">${s(this,O,Ug).call(this)}</span>${this.hint?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h}</span>`}
|
|
990
|
+
</label>`},Kg=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Wg=function(){let e=this.files[0],t=this.error||this._rejected||e&&this._fileErrors.get(e)||"",i=!!e&&s(this,O,Wm).call(this,e),a=this.label||this.t("photo"),l=[this.hint&&`${r(this,ie)}-hint`,t&&`${r(this,ie)}-msg`].filter(Boolean).join(" "),d=u=>c`<input type="file" id=${r(this,ie)} accept=${r(this,O,Vm)} capture=${this.capture||h}
|
|
985
991
|
?disabled=${this.disabled} ?required=${this.required&&!e} tabindex=${u?"-1":h} aria-hidden=${u?"true":h}
|
|
986
992
|
?hidden=${u} aria-labelledby=${u?h:`${r(this,ie)}-p`} aria-describedby=${!u&&l||h} aria-invalid=${t?"true":h}
|
|
987
993
|
@change=${s(this,O,Ym)} @cancel=${v=>v.stopPropagation()} />`,m=this.hint?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h;return c`
|
|
@@ -995,7 +1001,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
995
1001
|
${this.disabled?h:i?c`<div class="actions" part="actions">
|
|
996
1002
|
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,O,Gm).call(this,e)}><cm-icon name="close" size="16"></cm-icon>${this.t("cancelShort")}</button>
|
|
997
1003
|
</div>`:c`<div class="actions" part="actions">
|
|
998
|
-
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,ie)}-msg`:h} @click=${s(this,O,
|
|
1004
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,ie)}-msg`:h} @click=${s(this,O,Kg)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
999
1005
|
<button type="button" class="action" aria-label=${this.t("removeName",{name:a})} @click=${()=>this.removeFile(e)}><cm-icon name="trash" size="16"></cm-icon>${this.t("removePhoto")}</button>
|
|
1000
1006
|
</div>`}`:c`<label class="zone photo ${t?"invalid":""}" part="zone photo"
|
|
1001
1007
|
@dragenter=${()=>s(this,O,sr).call(this,!0)} @dragleave=${()=>s(this,O,sr).call(this,!1)} @drop=${()=>s(this,O,sr).call(this,!1)}>
|
|
@@ -1089,21 +1095,21 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1089
1095
|
@media (max-width: 640px) {
|
|
1090
1096
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
1091
1097
|
}
|
|
1092
|
-
`];$("cm-file-upload",yi);var
|
|
1098
|
+
`];$("cm-file-upload",yi);var e$=z("colorField",{swatch:"{name}, {hex}",hex:"Hex code",hexNamed:"{label}, hex code",placeholder:"#RRGGBB",picker:"Choose a custom colour",pickerNamed:"Choose a custom colour for {label}",required:"Please choose a colour.",invalid:"Enter a colour as #RRGGBB, for example #2e6faf.",black:"Black",grey:"Grey",lightGrey:"Light grey",red:"Red",darkOrange:"Dark orange",orange:"Orange",yellow:"Yellow",lightGreen:"Light green",green:"Green",lightBlue:"Light blue",blue:"Blue",indigo:"Indigo"}),cy=[{value:"#000000",key:"black"},{value:"#707070",key:"grey"},{value:"#c9c9c9",key:"lightGrey"},{value:"#de0000",key:"red"},{value:"#ad5500",key:"darkOrange"},{value:"#f1a953",key:"orange"},{value:"#ffc107",key:"yellow"},{value:"#81bb47",key:"lightGreen"},{value:"#3c7c00",key:"green"},{value:"#5394d9",key:"lightBlue"},{value:"#2e6faf",key:"blue"},{value:"#446beb",key:"indigo"}];function jt(o){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(o.trim());return n?`#${(n[1].length===3?[...n[1]].map(t=>t+t).join(""):n[1]).toLowerCase()}`:null}var dy=o=>{let n=parseInt(o.slice(1),16);return[n>>16&255,n>>8&255,n&255].map(e=>e/255).map(e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,i)=>e+t*[.2126,.7152,.0722][i],0)};function hy(o){let n=dy(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var Fe,yt,To,Da,Y,nr,Jm,Gg,Yg,Zm,Xg,Jg,Zg,Qg,xi=class extends T{constructor(){super(...arguments);p(this,Y);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.picker=!1;this.required=!1;this.disabled=!1;this._invalid=!1;p(this,Fe,this.attachInternals());p(this,yt,A("cm-cf"));p(this,To,"");p(this,Da)}connectedCallback(){super.connectedCallback(),g(this,To,jt(this.value)??this.value)}get form(){return r(this,Fe).form}get validity(){return r(this,Fe).validity}get validationMessage(){return r(this,Fe).validationMessage}checkValidity(){return r(this,Fe).checkValidity()}reportValidity(){return r(this,Fe).reportValidity()}formResetCallback(){this.value=r(this,To),this._draft=void 0,this._invalid=!1}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get items(){return this.swatches?this.swatches.flatMap(e=>{let t=typeof e=="string"?{value:e}:e,i=jt(t?.value??"");return i?[{value:i,name:t.name}]:[]}):cy.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=jt(this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==r(this,Da)&&(this._draft=void 0,this._invalid=!1),g(this,Da,void 0)}}updated(){let e=!this.value||jt(this.value)!==null;r(this,Fe).setFormValue(this.value&&e?this.value:null,this.value);let t=this.renderRoot.querySelector(".input")??void 0;this.error?r(this,Fe).setValidity({customError:!0},this.error,t):this._invalid||!e?r(this,Fe).setValidity({patternMismatch:!0},this.t("invalid"),t):this.required&&!this.value?r(this,Fe).setValidity({valueMissing:!0},this.t("required"),t):r(this,Fe).setValidity({})}render(){let e=this.items,t=jt(this.value??""),i=e.findIndex(u=>u.value===t),a=this.error||(this._invalid||this.value&&!t?this.t("invalid"):""),l=[a&&`${r(this,yt)}-err`,this.helpText&&`${r(this,yt)}-help`].filter(Boolean).join(" ")||h,d=this.getAttribute("aria-label"),m=this.label||d||"";return c`<div class="field">
|
|
1093
1099
|
${this.label?c`<span class="label" id="${r(this,yt)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}${this.hint?c`<span class="hint">[${this.hint}]</span>`:h}</span>`:h}
|
|
1094
1100
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
1095
1101
|
aria-labelledby=${this.label?`${r(this,yt)}-l`:h} aria-label=${!this.label&&d?d:h}
|
|
1096
1102
|
aria-required=${this.required?"true":h} aria-describedby=${l}>
|
|
1097
1103
|
${e.map((u,v)=>{let b=u.name?this.t("swatch",{name:u.name,hex:u.value}):u.value;return c`<button type="button" class="swatch" part="swatch" role="radio" aria-checked=${v===i?"true":"false"}
|
|
1098
1104
|
aria-label=${b} title=${u.name||u.value} tabindex=${v===(i>=0?i:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
1099
|
-
style="background-color:${u.value};color:${
|
|
1100
|
-
@click=${()=>s(this,Y,Jm).call(this,v)} @keydown=${w=>s(this,Y,
|
|
1105
|
+
style="background-color:${u.value};color:${hy(u.value)}"
|
|
1106
|
+
@click=${()=>s(this,Y,Jm).call(this,v)} @keydown=${w=>s(this,Y,Gg).call(this,w,v)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
1101
1107
|
</div>`:h}
|
|
1102
1108
|
<div class="row">
|
|
1103
1109
|
${this.picker?c`<label class="pick" part="picker" style=${t?`background-color:${t}`:h}>
|
|
1104
1110
|
<input type="color" .value=${ne(t??"#000000")} ?disabled=${this.disabled}
|
|
1105
1111
|
aria-label=${m?this.t("pickerNamed",{label:m}):this.t("picker")}
|
|
1106
|
-
@input=${s(this,Y,
|
|
1112
|
+
@input=${s(this,Y,Zg)} @change=${s(this,Y,Qg)} />
|
|
1107
1113
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1108
1114
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${t?`background-color:${t}`:h}></span>`}
|
|
1109
1115
|
<input class="input" part="input" id=${r(this,yt)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
@@ -1111,11 +1117,11 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1111
1117
|
aria-label=${m?this.t("hexNamed",{label:m}):this.t("hex")}
|
|
1112
1118
|
?required=${this.required} ?disabled=${this.disabled}
|
|
1113
1119
|
aria-invalid=${a?"true":h} aria-describedby=${l}
|
|
1114
|
-
@input=${s(this,Y,
|
|
1120
|
+
@input=${s(this,Y,Yg)} @change=${s(this,Y,Xg)} @keydown=${s(this,Y,Jg)} />
|
|
1115
1121
|
</div>
|
|
1116
1122
|
${a?c`<p class="error" id="${r(this,yt)}-err" role="alert">${a}</p>`:h}
|
|
1117
1123
|
${this.helpText?c`<p class="help" id="${r(this,yt)}-help">${this.helpText}</p>`:h}
|
|
1118
|
-
</div>`}};Fe=new WeakMap,yt=new WeakMap,To=new WeakMap,Da=new WeakMap,Y=new WeakSet,nr=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},Jm=function(e){let t=this.items[e];!t||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".swatch")[e]?.focus()),this._draft=void 0,this._invalid=!1,t.value!==this.value&&(this.value=t.value,s(this,Y,nr).call(this,"input","change")))},
|
|
1124
|
+
</div>`}};Fe=new WeakMap,yt=new WeakMap,To=new WeakMap,Da=new WeakMap,Y=new WeakSet,nr=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},Jm=function(e){let t=this.items[e];!t||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".swatch")[e]?.focus()),this._draft=void 0,this._invalid=!1,t.value!==this.value&&(this.value=t.value,s(this,Y,nr).call(this,"input","change")))},Gg=function(e,t){let i=this.items.length,a=J(e,this),l;if(a==="ArrowRight"||e.key==="ArrowDown")l=(t+1)%i;else if(a==="ArrowLeft"||e.key==="ArrowUp")l=(t-1+i)%i;else if(e.key==="Home")l=0;else if(e.key==="End")l=i-1;else if(e.key===" "||e.key==="Enter")l=t;else return;e.preventDefault(),s(this,Y,Jm).call(this,l)},Yg=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let i=/^#?[0-9a-f]{6}$/i.test(t.trim())?jt(t):null;i&&i!==this.value&&(g(this,Da,i),this.value=i,s(this,Y,nr).call(this,"input")),this._invalid&&(i||!t.trim())&&(this._invalid=!1)},Zm=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?jt(e):"";if(t===null){this._invalid=!0;return}let i=this.value;this.value=t,this._draft=void 0,this._invalid=!1,t!==i&&s(this,Y,nr).call(this,"input"),s(this,Y,nr).call(this,"change")},Xg=function(e){e.stopPropagation(),s(this,Y,Zm).call(this)},Jg=function(e){e.key==="Enter"&&s(this,Y,Zm).call(this)},Zg=function(e){e.stopPropagation();let t=jt(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,s(this,Y,nr).call(this,"input"))},Qg=function(e){e.stopPropagation(),s(this,Y,nr).call(this,"change")},xi.formAssociated=!0,xi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},xi.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},swatches:{type:Array},picker:{type:Boolean},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_draft:{state:!0},_invalid:{state:!0}},xi.styles=[k,Ge,x`
|
|
1119
1125
|
:host { display: block; }
|
|
1120
1126
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
1121
1127
|
.swatch {
|
|
@@ -1154,18 +1160,18 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1154
1160
|
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
1155
1161
|
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
1156
1162
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
1157
|
-
`];$("cm-color-field",xi);var
|
|
1163
|
+
`];$("cm-color-field",xi);var o$=z("signatureField",{modes:"How to sign",draw:"Draw",type:"Type",pad:"Signature drawing area",padSigned:"Signature drawing area, signed",instructions:"Draw your signature with a mouse, finger or pen. To sign with the keyboard, choose Type.",signHere:"Sign here",typeLabel:"Type your full name",typePlaceholder:"Type your full name",undo:"Undo",undoLabel:"Undo last stroke",clear:"Clear",clearLabel:"Clear signature",cleared:"Signature cleared",undone:"Last stroke removed",required:"Please sign here."}),Qm=3,Fd=.7,my=.0055,jd="#000000",eb=8,zo=2,py=400,uy=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),it,_o,Aa,Co,rt,at,st,$i,ki,ze,So,Ei,Ra,C,ep,Ud,tp,Ut,Vd,ip,rp,tb,ap,Kd,sp,Wd,ib,np,rb,or,Gd,op,lp,ab,cp,sb,dp,nb,ob,wi=class extends T{constructor(){super(...arguments);p(this,C);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.mode="draw";this.typedName="";this.required=!1;this.disabled=!1;this._announce="";p(this,it,this.attachInternals());p(this,_o,A("cm-sig"));p(this,Aa,"");p(this,Co,"");p(this,rt,[]);p(this,at);p(this,st);p(this,$i,"");p(this,ki,0);p(this,ze);p(this,So,"");p(this,Ei);p(this,Ra,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?s(this,C,ep).call(this):(g(this,Aa,this.value),g(this,Co,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),r(this,Ei)?.disconnect(),g(this,Ei,void 0),cancelAnimationFrame(r(this,ki)),g(this,ki,0),r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0))}get form(){return r(this,it).form}get validity(){return r(this,it).validity}get validationMessage(){return r(this,it).validationMessage}checkValidity(){return r(this,it).checkValidity()}reportValidity(){return r(this,it).reportValidity()}formResetCallback(){g(this,rt,[]),g(this,at,void 0),g(this,st,void 0),r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0)),this.typedName=r(this,Co),r(this,Aa)?(g(this,$i,""),this.value=r(this,Aa)):this.updateComplete.then(()=>s(this,C,or).call(this,!1)),s(this,C,Ut).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!r(this,rt).length&&!r(this,st)}toDataURL(){return s(this,C,op).call(this)?.toDataURL("image/png")??""}toBlob(){let e=s(this,C,op).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(g(this,rt,[]),g(this,at,void 0),g(this,st,void 0),s(this,C,Ut).call(this)),s(this,C,or).call(this,!0)}undo(){this.mode==="draw"&&(r(this,rt).length?r(this,rt).pop():g(this,st,void 0),g(this,at,void 0),s(this,C,Ut).call(this),s(this,C,or).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==r(this,$i)){let t=this.value??"";if(g(this,$i,t),g(this,rt,[]),g(this,at,void 0),!t)g(this,st,void 0),this.hasUpdated&&(this.typedName="");else{let i=new Image;i.addEventListener("load",()=>{r(this,st)===i&&s(this,C,Ut).call(this)}),i.src=t,g(this,st,i),this.mode="draw"}s(this,C,Ut).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();g(this,$i,t),this.value=t}}firstUpdated(){s(this,C,ep).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>s(this,C,or).call(this,!1)),s(this,C,Wd).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&s(this,C,Wd).call(this),r(this,it).setFormValue(this.value||null,this.value);let t=(this.mode==="type"?this.renderRoot.querySelector(".typed"):this.renderRoot.querySelector('.tab[aria-selected="true"]'))??void 0;this.error?r(this,it).setValidity({customError:!0},this.error,t):this.required&&this.empty?r(this,it).setValidity({valueMissing:!0},this.t("required"),t):r(this,it).setValidity({})}render(){let e=r(this,_o),t=this.getAttribute("aria-label"),i=this.error,a=[i&&`${e}-err`,this.helpText&&`${e}-help`].filter(Boolean).join(" "),l=this.empty,d=!r(this,rt).length&&!r(this,st),m=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
1158
1164
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
1159
1165
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
1160
|
-
@click=${()=>s(this,C,lp).call(this,u,!0)} @keydown=${s(this,C,
|
|
1166
|
+
@click=${()=>s(this,C,lp).call(this,u,!0)} @keydown=${s(this,C,ab)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
1161
1167
|
${this.label?c`<span class="label" id="${e}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}${this.hint?c`<span class="hint">[${this.hint}]</span>`:h}</span>`:h}
|
|
1162
1168
|
<div class="bar">
|
|
1163
1169
|
<div class="tabs" role="tablist" part="tabs"
|
|
1164
1170
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
1165
1171
|
aria-label=${this.label?h:t||this.t("modes")}>${m("draw")}${m("type")}</div>
|
|
1166
1172
|
<div class="actions">
|
|
1167
|
-
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,
|
|
1168
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,
|
|
1173
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,nb)}>${this.t("undo")}</button>`:h}
|
|
1174
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,ob)}>${this.t("clear")}</button>
|
|
1169
1175
|
</div>
|
|
1170
1176
|
</div>
|
|
1171
1177
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -1175,7 +1181,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1175
1181
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
1176
1182
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
1177
1183
|
aria-describedby=${[`${e}-instr`,a].filter(Boolean).join(" ")}
|
|
1178
|
-
@pointerdown=${s(this,C,
|
|
1184
|
+
@pointerdown=${s(this,C,tb)} @pointermove=${s(this,C,ap)} @pointerup=${s(this,C,Kd)} @pointercancel=${s(this,C,Kd)}
|
|
1179
1185
|
@lostpointercapture=${s(this,C,Kd)} @transitionend=${()=>s(this,C,Vd).call(this)}></canvas>
|
|
1180
1186
|
</div>
|
|
1181
1187
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
@@ -1188,13 +1194,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1188
1194
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
1189
1195
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
1190
1196
|
aria-describedby=${a||h} ?disabled=${this.disabled}
|
|
1191
|
-
@input=${s(this,C,
|
|
1197
|
+
@input=${s(this,C,ib)} @change=${s(this,C,rb)} />
|
|
1192
1198
|
</div>
|
|
1193
1199
|
</div>
|
|
1194
1200
|
${i?c`<p class="error" id="${e}-err" role="alert">${i}</p>`:h}
|
|
1195
1201
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
1196
1202
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
1197
|
-
</div>`}};it=new WeakMap,_o=new WeakMap,Aa=new WeakMap,Co=new WeakMap,rt=new WeakMap,at=new WeakMap,st=new WeakMap,$i=new WeakMap,ki=new WeakMap,ze=new WeakMap,So=new WeakMap,Ei=new WeakMap,Ra=new WeakMap,C=new WeakSet,ep=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,Ei)||(g(this,Ei,new ResizeObserver(()=>s(this,C,tp).call(this))),r(this,Ei).observe(e))},Ud=function(){return this.renderRoot.querySelector("canvas")},tp=function(){let e=r(this,C,Ud);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;g(this,Ra,t);let a=window.devicePixelRatio||1,l=Math.round(t*a),d=Math.round(i*a);(e.width!==l||e.height!==d)&&(e.width=l,e.height=d),s(this,C,Vd).call(this)},Ut=function(){r(this,ki)||g(this,ki,requestAnimationFrame(()=>{g(this,ki,0),s(this,C,Vd).call(this)}))},Vd=function(){let e=r(this,C,Ud);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,Ra);if(!i)return;let a=e.width/i;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),t.setTransform(a,0,0,a,0,0);let l=getComputedStyle(e).color||jd;s(this,C,ip).call(this,t,i,l,!0)},ip=function(e,t,i,a){let l=t/Qm,d=r(this,st);if(d?.complete&&d.naturalWidth){let m=Math.min(t*.9/d.naturalWidth,l*.9/d.naturalHeight),u=d.naturalWidth*m,v=d.naturalHeight*m,b=(t-u)/2,w=(l-v)/2;if(a&&!
|
|
1203
|
+
</div>`}};it=new WeakMap,_o=new WeakMap,Aa=new WeakMap,Co=new WeakMap,rt=new WeakMap,at=new WeakMap,st=new WeakMap,$i=new WeakMap,ki=new WeakMap,ze=new WeakMap,So=new WeakMap,Ei=new WeakMap,Ra=new WeakMap,C=new WeakSet,ep=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,Ei)||(g(this,Ei,new ResizeObserver(()=>s(this,C,tp).call(this))),r(this,Ei).observe(e))},Ud=function(){return this.renderRoot.querySelector("canvas")},tp=function(){let e=r(this,C,Ud);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;g(this,Ra,t);let a=window.devicePixelRatio||1,l=Math.round(t*a),d=Math.round(i*a);(e.width!==l||e.height!==d)&&(e.width=l,e.height=d),s(this,C,Vd).call(this)},Ut=function(){r(this,ki)||g(this,ki,requestAnimationFrame(()=>{g(this,ki,0),s(this,C,Vd).call(this)}))},Vd=function(){let e=r(this,C,Ud);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,Ra);if(!i)return;let a=e.width/i;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),t.setTransform(a,0,0,a,0,0);let l=getComputedStyle(e).color||jd;s(this,C,ip).call(this,t,i,l,!0)},ip=function(e,t,i,a){let l=t/Qm,d=r(this,st);if(d?.complete&&d.naturalWidth){let m=Math.min(t*.9/d.naturalWidth,l*.9/d.naturalHeight),u=d.naturalWidth*m,v=d.naturalHeight*m,b=(t-u)/2,w=(l-v)/2;if(a&&!fy(i,jd)){let y=document.createElement("canvas");y.width=Math.max(1,Math.round(u*2)),y.height=Math.max(1,Math.round(v*2));let M=y.getContext("2d");M.drawImage(d,0,0,y.width,y.height),M.globalCompositeOperation="source-in",M.fillStyle=i,M.fillRect(0,0,y.width,y.height),e.drawImage(y,b,w,u,v)}else e.drawImage(d,b,w,u,v)}e.strokeStyle=i,e.fillStyle=i,e.lineCap="round",e.lineJoin="round";for(let m of r(this,rt))gy(e,m,t)},rp=function(e,t){let i=e.pointerType==="pen"&&e.pressure>0?e.pressure:.5;return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.width,p:i}},tb=function(e){if(this.disabled||r(this,at)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.currentTarget;e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}let i=[s(this,C,rp).call(this,e,t.getBoundingClientRect())];g(this,at,{id:e.pointerId,stroke:i}),r(this,rt).push(i),s(this,C,Ut).call(this)},ap=function(e){let t=r(this,at);if(!t||e.pointerId!==t.id)return;e.preventDefault();let i=e.currentTarget.getBoundingClientRect(),a=typeof e.getCoalescedEvents=="function"?e.getCoalescedEvents():[];for(let l of a.length?a:[e]){let d=s(this,C,rp).call(this,l,i),m=t.stroke[t.stroke.length-1];Math.hypot(d.x-m.x,d.y-m.y)*i.width<1.5||t.stroke.push(d)}s(this,C,Ut).call(this)},Kd=function(e){let t=r(this,at);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&s(this,C,ap).call(this,e),g(this,at,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}s(this,C,Ut).call(this),s(this,C,or).call(this,!0)}},sp=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},Wd=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${r(this,C,sp)}`,i=!0;try{i=e.check(t,this.typedName||"Signature")}catch{}i||e.load(t,this.typedName||"Signature").then(()=>{this.mode==="type"&&this.typedName.trim()&&s(this,C,or).call(this,!1)},()=>{})},ib=function(e){e.stopPropagation(),r(this,ze)?clearTimeout(r(this,ze)):g(this,So,this.value),this.typedName=e.target.value,g(this,ze,setTimeout(()=>s(this,C,np).call(this),py)),s(this,C,Wd).call(this)},np=function(){r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0),this.value!==r(this,So)&&s(this,C,Gd).call(this))},rb=function(e){e.stopPropagation(),this.updateComplete.then(()=>s(this,C,np).call(this))},or=function(e){let t=this.empty?"":this.toDataURL(),i=t!==this.value;i&&(g(this,$i,t),this.value=t),this.requestUpdate(),e&&i&&s(this,C,Gd).call(this)},Gd=function(){let e={value:this.value,empty:this.empty,mode:this.mode};this.dispatchEvent(new CustomEvent("cm-change",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},op=function(){if(this.empty)return;let e=Math.max(r(this,C,Ud)?.clientWidth||r(this,Ra)||600,300),t=e/Qm,i=document.createElement("canvas");i.width=Math.round(e*zo),i.height=Math.round(t*zo);let a=i.getContext("2d",{willReadFrequently:!0});if(a.scale(zo,zo),this.mode==="type"){let l=Math.min(t*.45,64),d=r(this,C,sp);a.font=`400 ${l}px ${d}`;let m=this.typedName.trim(),u=e-2*eb,v=a.measureText(m).width;v>u&&(l*=u/v,a.font=`400 ${l}px ${d}`),a.direction=getComputedStyle(this).direction==="rtl"?"rtl":"ltr",a.textAlign="center",a.textBaseline="alphabetic",a.fillStyle=jd,a.fillText(m,e/2,t*Fd)}else s(this,C,ip).call(this,a,e,jd,!1);return by(i,eb*zo)},lp=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${r(this,_o)}-tab-${e}`)?.focus()),e===this.mode))return;let i=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&s(this,C,tp).call(this),this.value!==i&&s(this,C,Gd).call(this)})},ab=function(e){let t=J(e,this),i;if(t==="ArrowRight"||t==="ArrowLeft")i=this.mode==="draw"?"type":"draw";else if(e.key==="Home")i="draw";else if(e.key==="End")i="type";else return;e.preventDefault(),s(this,C,lp).call(this,i,!0)},cp=function(e){s(this,C,sb).call(this,this.t(e))},sb=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},dp=function(e){this.updateComplete.then(()=>{let t=this.shadowRoot?.activeElement;if(!e||t&&!t.disabled)return;(this.mode==="type"?this.renderRoot.querySelector(".typed"):this.renderRoot.querySelector('.tab[aria-selected="true"]'))?.focus()})},nb=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),s(this,C,cp).call(this,"undone"),s(this,C,dp).call(this,e)},ob=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),s(this,C,cp).call(this,"cleared"),s(this,C,dp).call(this,e)},wi.formAssociated=!0,wi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},wi.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},mode:{reflect:!0},typedName:{attribute:"typed-name"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_announce:{state:!0}},wi.styles=[k,x`
|
|
1198
1204
|
:host { display: block; }
|
|
1199
1205
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1200
1206
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -1260,17 +1266,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1260
1266
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
1261
1267
|
|
|
1262
1268
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1263
|
-
`];function
|
|
1269
|
+
`];function gy(o,n,e){let t=d=>e*my*(.35+d*1.3);if(n.length===1){o.beginPath(),o.arc(n[0].x*e,n[0].y*e,t(n[0].p)/2,0,Math.PI*2),o.fill();return}let i=d=>[d.x*e,d.y*e],a=n[0];for(let d=1;d<n.length-1;d++){let m=uy(n[d],n[d+1]);o.beginPath(),o.moveTo(...i(a)),o.quadraticCurveTo(...i(n[d]),...i(m)),o.lineWidth=t(n[d].p),o.stroke(),a=m}let l=n[n.length-1];o.beginPath(),o.moveTo(...i(a)),o.lineTo(...i(l)),o.lineWidth=t(l.p),o.stroke()}function by(o,n){let{width:e,height:t}=o,i=o.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e,t).data,a=t,l=e,d=-1,m=-1;for(let v=0;v<t;v++){let b=v*e*4;for(let w=0;w<e;w++)i[b+w*4+3]>8&&(w<l&&(l=w),w>d&&(d=w),v<a&&(a=v),m=v)}if(d<0)return;let u=document.createElement("canvas");return u.width=d-l+1+2*n,u.height=m-a+1+2*n,u.getContext("2d").drawImage(o,l,a,d-l+1,m-a+1,n,n,d-l+1,m-a+1),u}function fy(o,n){let e=t=>{let i=/^#([0-9a-f]{6})$/i.exec(t.trim());if(i){let a=parseInt(i[1],16);return`${a>>16&255},${a>>8&255},${a&255}`}return(/\d+\s*,\s*\d+\s*,\s*\d+/.exec(t)?.[0]??t).replace(/\s/g,"")};return e(o)===e(n)}$("cm-signature-field",wi);var p$=z("optionGroup",{required:"Please select one of these options."}),ct,Lo,Ha,Do,wt,hp,mp,lb,xt=class extends T{constructor(){super(...arguments);p(this,wt);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];p(this,ct,this.attachInternals());p(this,Lo,A("cm-og"));p(this,Ha,"");p(this,Do,new MutationObserver(()=>s(this,wt,hp).call(this)))}connectedCallback(){super.connectedCallback(),s(this,wt,hp).call(this),r(this,Do).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Do).disconnect()}get form(){return r(this,ct).form}get validity(){return r(this,ct).validity}get validationMessage(){return r(this,ct).validationMessage}checkValidity(){return r(this,ct).checkValidity()}reportValidity(){return r(this,ct).reportValidity()}formResetCallback(){this.value=r(this,Ha)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){r(this,Ha)||g(this,Ha,this.value)}updated(){r(this,ct).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,ct).setValidity({valueMissing:!0},this.t("required"),e):r(this,ct).setValidity({})}render(){let e=this.items,t=e.findIndex(l=>l.value===this.value&&!l.disabled),i=t>=0?t:e.findIndex(l=>!l.disabled),a=this.getAttribute("aria-label");return c`
|
|
1264
1270
|
${this.label?c`<span class="label" id="${r(this,Lo)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1265
1271
|
<div class="options" part="options" role="radiogroup"
|
|
1266
1272
|
aria-labelledby=${this.label?`${r(this,Lo)}-l`:h} aria-label=${!this.label&&a?a:h}
|
|
1267
1273
|
aria-required=${this.required?"true":h}>
|
|
1268
1274
|
${e.map((l,d)=>c`<button type="button" role="radio" part="option" class=${l.tone==="critical"||l.tone==="success"?`tone-${l.tone}`:h} aria-checked=${l.value===this.value?"true":"false"}
|
|
1269
1275
|
tabindex=${d===i?"0":"-1"} ?disabled=${this.disabled||!!l.disabled}
|
|
1270
|
-
@click=${()=>s(this,wt,mp).call(this,d)} @keydown=${m=>s(this,wt,
|
|
1276
|
+
@click=${()=>s(this,wt,mp).call(this,d)} @keydown=${m=>s(this,wt,lb).call(this,m,d)}>${l.label}</button>`)}
|
|
1271
1277
|
</div>
|
|
1272
1278
|
<slot></slot>
|
|
1273
|
-
`}};ct=new WeakMap,Lo=new WeakMap,Ha=new WeakMap,Do=new WeakMap,wt=new WeakSet,hp=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},a=t.getAttribute("tone");return(a==="critical"||a==="success")&&(i.tone=a),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,Ha,this.value))},mp=function(e){let t=this.items[e];!t||t.disabled||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll("button")[e]?.focus()),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},
|
|
1279
|
+
`}};ct=new WeakMap,Lo=new WeakMap,Ha=new WeakMap,Do=new WeakMap,wt=new WeakSet,hp=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},a=t.getAttribute("tone");return(a==="critical"||a==="success")&&(i.tone=a),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,Ha,this.value))},mp=function(e){let t=this.items[e];!t||t.disabled||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll("button")[e]?.focus()),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},lb=function(e,t){let i=J(e,this),a=this.items.flatMap((m,u)=>m.disabled?[]:[u]),l=a.indexOf(t),d;if(i==="ArrowRight"||e.key==="ArrowDown")d=a[(l+1)%a.length];else if(i==="ArrowLeft"||e.key==="ArrowUp")d=a[(l-1+a.length)%a.length];else if(e.key==="Home")d=a[0];else if(e.key==="End")d=a[a.length-1];else return;e.preventDefault(),d!==void 0&&s(this,wt,mp).call(this,d)},xt.formAssociated=!0,xt.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},xt.styles=[k,x`
|
|
1274
1280
|
:host { display: block; }
|
|
1275
1281
|
.label {
|
|
1276
1282
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1302,7 +1308,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1302
1308
|
}
|
|
1303
1309
|
slot { display: none; }
|
|
1304
1310
|
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
1305
|
-
`];$("cm-option-group",xt);var
|
|
1311
|
+
`];$("cm-option-group",xt);var x$=z("segmentedControl",{required:"Please select one of these options."}),Na=class extends xt{constructor(){super(...arguments);this.size="default"}};Na.properties={...xt.properties,size:{reflect:!0}},Na.styles=[k,x`
|
|
1306
1312
|
:host { display: inline-block; vertical-align: middle; max-width: 100%; --_h: var(--cm-control-height-md, 36px); }
|
|
1307
1313
|
:host([size='small']) { --_h: var(--cm-control-height-sm, 32px); }
|
|
1308
1314
|
@media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
|
|
@@ -1332,7 +1338,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1332
1338
|
button[aria-checked='true']:disabled { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
1333
1339
|
:host([disabled]) .options { background: var(--cm-bg-input-filled); }
|
|
1334
1340
|
slot { display: none; }
|
|
1335
|
-
`];$("cm-segmented-control",Na);var
|
|
1341
|
+
`];$("cm-segmented-control",Na);var M$=z("pageHeader",{back:"Back to {label}",backOnly:"Back",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),Ao,pp,Ia=class extends T{constructor(){super(...arguments);p(this,Ao);this.heading="";this.description="";this.breadcrumbs=[];this.backHref="";this.backLabel="";this.pagination=!1;this.hasPrevious=!1;this.hasNext=!1}render(){let e=Array.isArray(this.breadcrumbs)?this.breadcrumbs:[],t=this.backHref?{href:this.backHref,label:this.backLabel}:[...e].reverse().find(i=>i.href);return c`<header part="header">
|
|
1336
1342
|
<div class=${this.description?"lead described":"lead"}>
|
|
1337
1343
|
${t?c`<a class=${this.backHref?"back always":"back"} part="back" href=${t.href} aria-label=${t.label?this.t("back",{label:t.label}):this.t("backOnly")}><cm-icon name="chevron-left" size="20"></cm-icon></a>`:h}
|
|
1338
1344
|
<div class="titles">
|
|
@@ -1408,7 +1414,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1408
1414
|
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
1409
1415
|
.actions { gap: var(--cm-space-8); }
|
|
1410
1416
|
}
|
|
1411
|
-
`];$("cm-page-header",Ia);var
|
|
1417
|
+
`];$("cm-page-header",Ia);var L$=z("actionBar",{label:"Actions"}),Pa=class extends T{constructor(){super(...arguments);this.eyebrow="";this.heading="";this.tone="default";this.sticky=!1;this.label=""}render(){let e=this.tone==="critical";return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.heading||this.eyebrow||this.t("label")}>
|
|
1412
1418
|
<div class="lead">
|
|
1413
1419
|
${e?c`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:h}
|
|
1414
1420
|
<div class="text">
|
|
@@ -1449,13 +1455,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1449
1455
|
|
|
1450
1456
|
.actions { gap: var(--cm-space-8); }
|
|
1451
1457
|
}
|
|
1452
|
-
`];$("cm-action-bar",Pa);var
|
|
1458
|
+
`];$("cm-action-bar",Pa);var N$=z("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),$t,lr,Ro,_e,up,gp,bp,cb,db,Oa=class extends T{constructor(){super(...arguments);p(this,_e);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";p(this,$t,null);p(this,lr,()=>{this.open=!0});p(this,Ro,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>s(this,_e,up).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,_e,gp).call(this)}updated(e){e.has("form")&&this.isConnected&&s(this,_e,up).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1453
1459
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1454
1460
|
<div class="actions">
|
|
1455
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,_e,
|
|
1456
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,_e,
|
|
1461
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,_e,db)}>${this.discardLabel}</cm-button>
|
|
1462
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,_e,cb)}>${this.saveLabel}</cm-button>
|
|
1457
1463
|
</div>
|
|
1458
|
-
</div>`}};$t=new WeakMap,lr=new WeakMap,Ro=new WeakMap,_e=new WeakSet,up=function(){s(this,_e,gp).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,$t,e),e.addEventListener("input",r(this,lr)),e.addEventListener("change",r(this,lr)),e.addEventListener("reset",r(this,Ro)))},gp=function(){let e=r(this,$t);e&&(e.removeEventListener("input",r(this,lr)),e.removeEventListener("change",r(this,lr)),e.removeEventListener("reset",r(this,Ro)),g(this,$t,null))},bp=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},
|
|
1464
|
+
</div>`}};$t=new WeakMap,lr=new WeakMap,Ro=new WeakMap,_e=new WeakSet,up=function(){s(this,_e,gp).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,$t,e),e.addEventListener("input",r(this,lr)),e.addEventListener("change",r(this,lr)),e.addEventListener("reset",r(this,Ro)))},gp=function(){let e=r(this,$t);e&&(e.removeEventListener("input",r(this,lr)),e.removeEventListener("change",r(this,lr)),e.removeEventListener("reset",r(this,Ro)),g(this,$t,null))},bp=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},cb=function(){this.loading||this.saveDisabled||s(this,_e,bp).call(this,"cm-save")&&r(this,$t)&&r(this,$t).requestSubmit()},db=function(){this.loading||s(this,_e,bp).call(this,"cm-discard")&&r(this,$t)&&(r(this,$t).reset(),this.open=!1)},Oa.properties={open:{type:Boolean,reflect:!0},message:{string:"message"},saveLabel:{attribute:"save-label",string:"save"},discardLabel:{attribute:"discard-label",string:"discard"},loading:{type:Boolean,reflect:!0},saveDisabled:{type:Boolean,attribute:"save-disabled"},form:{}},Oa.styles=[k,x`
|
|
1459
1465
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1460
1466
|
:host(:not([open])) { display: none; }
|
|
1461
1467
|
.bar {
|
|
@@ -1544,7 +1550,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1544
1550
|
.body[hidden] { display: none; }
|
|
1545
1551
|
|
|
1546
1552
|
|
|
1547
|
-
`];$("cm-accordion",Fa);var He,dr,fp,
|
|
1553
|
+
`];$("cm-accordion",Fa);var He,dr,fp,hb,ja=class extends S{constructor(){super(...arguments);p(this,He);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="default";this.action="";this.actionHref="";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));if(this.size==="inline")return s(this,He,hb).call(this,e);let t=this.image?c`<img src=${this.image} alt="" part="image">`:this.icon?c`<cm-icon name=${this.icon} size=${this.size==="large"||this.size==="small"?"48":"24"}></cm-icon>`:h;return c`<div class="wrap" part="empty-state">
|
|
1548
1554
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1549
1555
|
<slot name="image" @slotchange=${i=>s(this,He,dr).call(this,i,"hasImage")}>${t}</slot>
|
|
1550
1556
|
</div>
|
|
@@ -1552,7 +1558,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1552
1558
|
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,He,dr).call(this,i,"hasText")}></slot></div>
|
|
1553
1559
|
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,He,dr).call(this,i,"hasActions")}></slot></div>${this.action?c`<div class="actions">${s(this,He,fp).call(this)}</div>`:h}
|
|
1554
1560
|
</div>`}};He=new WeakSet,dr=function(e,t){let i=e.target;this[t]=i.assignedNodes({flatten:!0}).some(a=>a.nodeType===1||a.textContent.trim()),this.requestUpdate()},fp=function(){return this.action?this.actionHref?c`<a class="text-action" part="action" href=${this.actionHref}>${this.action}</a>`:c`<button class="text-action" type="button" part="action"
|
|
1555
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},
|
|
1561
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},hb=function(e){let t=this.image?c`<img src=${this.image} alt="" part="image">`:this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h;return c`<div class="wrap inline" part="empty-state">
|
|
1556
1562
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1557
1563
|
<slot name="image" @slotchange=${i=>s(this,He,dr).call(this,i,"hasImage")}>${t}</slot>
|
|
1558
1564
|
</span>
|
|
@@ -1610,7 +1616,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1610
1616
|
:host([size='large']) .circle { width: 120px; height: 120px; }
|
|
1611
1617
|
:host([size='large']) .title { margin-top: var(--cm-space-16); }
|
|
1612
1618
|
}
|
|
1613
|
-
`];$("cm-empty-state",ja);var
|
|
1619
|
+
`];$("cm-empty-state",ja);var mb={small:34,medium:40,large:50,xlarge:186},Ua=class extends S{constructor(){super(...arguments);this.variant="text";this.lines=1;this.size="large"}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-hidden","true")}render(){if(this.variant==="thumbnail"){let t=mb[this.size]??mb.large;return c`<span class="bone" part="bone" style="width:${t}px;height:${t}px"></span>`}if(this.variant==="block")return c`<span class="bone block" part="bone"></span>`;let e=Math.max(1,Math.floor(this.lines||1));return c`${Array.from({length:e},(t,i)=>c`<span class="bone line ${e>1&&i===e-1?"short":""}" part="bone"></span>`)}`}};Ua.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},Ua.styles=[k,x`
|
|
1614
1620
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
1615
1621
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
1616
1622
|
.bone {
|
|
@@ -1625,14 +1631,14 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1625
1631
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
1626
1632
|
}
|
|
1627
1633
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
1628
|
-
`];$("cm-skeleton",Ua);var
|
|
1634
|
+
`];$("cm-skeleton",Ua);var vy=[472,90,90,251],yy=[94,266,134,191,138],Va=class extends T{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1}render(){let e=t=>t.map(i=>c`<span class="bone" style="height:${i}px"></span>`);return c`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
1629
1635
|
<span class="sr" role="status">${this.label}</span>
|
|
1630
1636
|
<div class="page" aria-hidden="true">
|
|
1631
1637
|
${this.navigation?c`<span class="bone nav"></span>`:h}
|
|
1632
1638
|
<span class="bone head"></span>
|
|
1633
1639
|
<div class="body">
|
|
1634
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
1635
|
-
<div class="col side">${e(
|
|
1640
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:vy)}</div>
|
|
1641
|
+
<div class="col side">${e(yy)}</div>
|
|
1636
1642
|
</div>
|
|
1637
1643
|
</div>
|
|
1638
1644
|
</div>`}};Va.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},Va.styles=[k,x`
|
|
@@ -1659,11 +1665,11 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1659
1665
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
1660
1666
|
.head { height: 60px; }
|
|
1661
1667
|
}
|
|
1662
|
-
`];$("cm-skeleton-display",Va);var
|
|
1668
|
+
`];$("cm-skeleton-display",Va);var n1=z("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),Yd,pb,Ka=class extends T{constructor(){super(...arguments);p(this,Yd);this.author="";this.datetime="";this.time=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-comment-box"&&this.setAttribute("role","listitem")}render(){let e=s(this,Yd,pb).call(this);return c`<article part="comment">
|
|
1663
1669
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
1664
1670
|
<div class="body" part="body"><slot></slot></div>
|
|
1665
1671
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
1666
|
-
</article>`}};Yd=new WeakSet,
|
|
1672
|
+
</article>`}};Yd=new WeakSet,pb=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:ae(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},Ka.properties={author:{},datetime:{},time:{}},Ka.styles=[k,x`
|
|
1667
1673
|
:host { display: block; }
|
|
1668
1674
|
article {
|
|
1669
1675
|
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
@@ -1671,16 +1677,16 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1671
1677
|
}
|
|
1672
1678
|
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
1673
1679
|
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
1674
|
-
`];$("cm-comment",Ka);var Ho,Xd,
|
|
1680
|
+
`];$("cm-comment",Ka);var Ho,Xd,ub,Wa=class extends T{constructor(){super(...arguments);p(this,Xd);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;p(this,Ho,A("cm-comment-box"));this.hasComments=!1}submit(){let e=this.renderRoot.querySelector("textarea"),t=(e?.value??this.value).trim();if(this.disabled)return;if(!t){e?.focus();return}let i=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(i)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="comment-box" aria-labelledby="${r(this,Ho)}-h">
|
|
1675
1681
|
<div class="title" id="${r(this,Ho)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1676
1682
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
1677
1683
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
1678
|
-
@keydown=${s(this,Xd,
|
|
1684
|
+
@keydown=${s(this,Xd,ub)}></textarea>
|
|
1679
1685
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
1680
1686
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
1681
1687
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
1682
1688
|
</div>
|
|
1683
|
-
</section>`}};Ho=new WeakMap,Xd=new WeakSet,
|
|
1689
|
+
</section>`}};Ho=new WeakMap,Xd=new WeakSet,ub=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},Wa.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Wa.styles=[k,x`
|
|
1684
1690
|
:host { display: block; }
|
|
1685
1691
|
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
1686
1692
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1700,8 +1706,8 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1700
1706
|
|
|
1701
1707
|
.actions { justify-content: flex-end; }
|
|
1702
1708
|
}
|
|
1703
|
-
`];$("cm-comment-box",Wa);var Jd='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',fe,Ya,Mi,Ti,Vt,Xa,Ja,je,vp,Zd,Qd,eh,th,Za,
|
|
1704
|
-
data-side=${this._side}>${this.content}</div>`}};fe=new WeakMap,Ya=new WeakMap,Mi=new WeakMap,Ti=new WeakMap,Vt=new WeakMap,Xa=new WeakMap,Ja=new WeakMap,je=new WeakSet,vp=function(){document.removeEventListener("keydown",r(this,Za),!0),removeEventListener("scroll",r(this,Kt),!0),removeEventListener("resize",r(this,Kt))},Zd=new WeakMap,Qd=new WeakMap,eh=new WeakMap,th=new WeakMap,Za=new WeakMap,
|
|
1709
|
+
`];$("cm-comment-box",Wa);var Jd='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',fe,Ya,Mi,Ti,Vt,Xa,Ja,je,vp,Zd,Qd,eh,th,Za,gb,hr,yp,xp,Kt,Ga=class extends S{constructor(){super(...arguments);p(this,je);this.content="";this.placement="top";this.delay=400;this.open=!1;this.visualOnly=!1;this._side="top";p(this,fe);p(this,Ya);p(this,Mi,[]);p(this,Ti);p(this,Vt);p(this,Xa,!1);p(this,Ja,!1);p(this,Zd,()=>{g(this,Xa,!0),clearTimeout(r(this,Vt)),this.open||g(this,Vt,setTimeout(()=>this.show(),this.delay))});p(this,Qd,()=>{g(this,Xa,!1),clearTimeout(r(this,Vt)),r(this,Ja)||this.hide()});p(this,eh,()=>{g(this,Ja,!0),this.show()});p(this,th,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(g(this,Ja,!1),r(this,Xa)||this.hide())});p(this,Za,e=>{e.key==="Escape"&&this.open&&this.hide()});p(this,hr,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(s(this,je,xp).call(this),!t||!this.content||this.visualOnly)return;let i=t.updateComplete;t.localName.includes("-")&&i&&!t.shadowRoot?.querySelector(Jd)&&i.then(()=>{t.shadowRoot?.querySelector(Jd)&&r(this,hr).call(this)}),r(this,fe)||(g(this,fe,document.createElement("span")),r(this,fe).id=A("cm-tooltip"),r(this,fe).hidden=!0,r(this,fe).slot="description"),r(this,fe).textContent=this.content,r(this,fe).isConnected||this.append(r(this,fe));let a=s(this,je,gb).call(this,t);if(g(this,Ya,a),a.getRootNode()===r(this,fe).getRootNode()){let l=(a.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);l.includes(r(this,fe).id)||a.setAttribute("aria-describedby",[...l,r(this,fe).id].join(" "))}else"ariaDescribedByElements"in a?(s(this,je,yp).call(this,a),g(this,Ti,new MutationObserver(()=>{a.getAttribute("aria-describedby")!==""&&s(this,je,yp).call(this,a)})),r(this,Ti).observe(a,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,fe).id)});p(this,Kt,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let a=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0]??this).getBoundingClientRect(),l=e.getBoundingClientRect(),d=8,m=8,u=innerWidth,v=innerHeight,b=getComputedStyle(this).direction==="rtl",w=W=>W==="start"?b?"right":"left":W==="end"?b?"left":"right":W,y={top:a.top-d-l.height>=m,bottom:a.bottom+d+l.height<=v-m,left:a.left-d-l.width>=m,right:a.right+d+l.width<=u-m},M={top:"bottom",bottom:"top",left:"right",right:"left"},D=w(this.placement);!y[D]&&y[M[D]]&&(D=M[D]);let H,q;D==="top"||D==="bottom"?(H=a.left+a.width/2-l.width/2,q=D==="top"?a.top-d-l.height:a.bottom+d):(q=a.top+a.height/2-l.height/2,H=D==="left"?a.left-d-l.width:a.right+d),H=Math.min(Math.max(m,H),u-m-l.width),q=Math.min(Math.max(m,q),v-m-l.height),e.style.transform=`translate(${Math.round(H)}px, ${Math.round(q)}px)`;let F={top:"top",bottom:"bottom",left:b?"end":"start",right:b?"start":"end"};this._side=F[D]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,Zd)),this.addEventListener("pointerleave",r(this,Qd)),this.addEventListener("focusin",r(this,eh)),this.addEventListener("focusout",r(this,th)),this.addEventListener("keydown",r(this,Za)),this.hasUpdated&&r(this,hr).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),s(this,je,xp).call(this),s(this,je,vp).call(this),clearTimeout(r(this,Vt))}show(){clearTimeout(r(this,Vt)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,Za),!0),addEventListener("scroll",r(this,Kt),!0),addEventListener("resize",r(this,Kt)),this.updateComplete.then(r(this,Kt)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,Vt)),this.open&&(this.open=!1,s(this,je,vp).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,hr).call(this),this.content?this.open&&r(this,Kt).call(this):this.hide())}render(){return c`<slot @slotchange=${r(this,hr)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1710
|
+
data-side=${this._side}>${this.content}</div>`}};fe=new WeakMap,Ya=new WeakMap,Mi=new WeakMap,Ti=new WeakMap,Vt=new WeakMap,Xa=new WeakMap,Ja=new WeakMap,je=new WeakSet,vp=function(){document.removeEventListener("keydown",r(this,Za),!0),removeEventListener("scroll",r(this,Kt),!0),removeEventListener("resize",r(this,Kt))},Zd=new WeakMap,Qd=new WeakMap,eh=new WeakMap,th=new WeakMap,Za=new WeakMap,gb=function(e){return e.matches(Jd)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(Jd)??e},hr=new WeakMap,yp=function(e){g(this,Mi,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),i=r(this,Mi).map(a=>t.getElementById(a)).filter(a=>!!a);e.ariaDescribedByElements=[...i,r(this,fe)]},xp=function(){let e=r(this,Ya);if(!(!e||!r(this,fe))){if(r(this,Ti))r(this,Ti).disconnect(),g(this,Ti,void 0),r(this,Mi).length?e.setAttribute("aria-describedby",r(this,Mi).join(" ")):e.removeAttribute("aria-describedby"),g(this,Mi,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(i=>i&&i!==r(this,fe).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,Ya,void 0)}},Kt=new WeakMap,Ga.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},Ga.styles=[k,x`
|
|
1705
1711
|
:host { display: inline-block; position: relative; }
|
|
1706
1712
|
.tip {
|
|
1707
1713
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -1718,22 +1724,22 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1718
1724
|
:host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
1719
1725
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1720
1726
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1721
|
-
`];$("cm-tooltip",Ga);var
|
|
1727
|
+
`];$("cm-tooltip",Ga);var b1=z("timelineItem",{justNow:"Just now",minutesAgo:{one:"{count} minute ago",other:"{count} minutes ago"},hoursAgo:{one:"{count} hour ago",other:"{count} hours ago"},daysAgo:{one:"{count} day ago",other:"{count} days ago"},inMinutes:{one:"In {count} minute",other:"In {count} minutes"},inHours:{one:"In {count} hour",other:"In {count} hours"},inDays:{one:"In {count} day",other:"In {count} days"},showAll:"Show all",showLess:"Show less"}),f1=z("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),xy=7,No=new Set,Io;function bb(o,n){n?No.add(o):No.delete(o),No.size&&!Io&&(Io=setInterval(()=>No.forEach(e=>e.requestUpdate()),6e4)),!No.size&&Io&&(clearInterval(Io),Io=void 0)}var Po,pr,dt,wp,ih,fb,Qa=class extends T{constructor(){super(...arguments);p(this,dt);this.icon="";this.tone="neutral";this.heading="";this.datetime="";this.time="";this.meta="";this.lines=3;this.expanded=!1;this._overflow=!1;this._body=!1;this._meta=!1;this._actions=!1;p(this,Po,A("cm-tl"));p(this,pr)}connectedCallback(){super.connectedCallback(),bb(this,!0)}disconnectedCallback(){super.disconnectedCallback(),bb(this,!1),r(this,pr)?.disconnect(),g(this,pr,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(g(this,pr,new ResizeObserver(()=>s(this,dt,wp).call(this))),r(this,pr).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&s(this,dt,wp).call(this)}get date(){if(!this.datetime)return;let e=new Date(this.datetime);return Number.isNaN(e.getTime())?void 0:e}get relativeTime(){if(this.time)return this.time;let e=this.date;if(!e)return this.datetime;let t=Date.now()-e.getTime(),i=t<0,a=Math.floor(Math.abs(t)/6e4);if(a<1)return this.t("justNow");if(a<60)return this.t(i?"inMinutes":"minutesAgo",{count:a});let l=Math.floor(a/60);if(l<24)return this.t(i?"inHours":"hoursAgo",{count:l});let d=Math.floor(l/24);return d<xy?this.t(i?"inDays":"daysAgo",{count:d}):ae(e,{dateStyle:"medium"},this.locale)}get fullTime(){let e=this.date;return e?ae(e,{dateStyle:"full",timeStyle:"short"},this.locale):""}render(){let e=this.relativeTime,t=this.fullTime,i=this.tone&&this.tone!=="neutral"?this.tone:"",a=this.lines>0&&!this.expanded,l=e?t?c`<cm-tooltip class="when" content=${t} visual-only placement="top"><time part="time" tabindex="0" datetime=${this.datetime}>${e}<span class="sr">, ${t}</span></time></cm-tooltip>`:c`<time class="when" part="time" datetime=${this.datetime||h}>${e}</time>`:h;return c`<div class="item">
|
|
1722
1728
|
<span class="icon ${i}" part="icon" aria-hidden="true">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:c`<span class="dot"></span>`}</span>
|
|
1723
1729
|
<div class="main">
|
|
1724
1730
|
<div class="head">
|
|
1725
|
-
<span class="title" part="title"><slot name="heading">${this.heading}</slot></span>
|
|
1726
|
-
<slot name="badge"></slot>
|
|
1731
|
+
<span class="lead"><span class="title" part="title"><slot name="heading">${this.heading}</slot></span>
|
|
1732
|
+
<slot name="badge"></slot></span>
|
|
1727
1733
|
${l}
|
|
1728
1734
|
</div>
|
|
1729
1735
|
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,dt,ih).call(this,d,"_meta")}>${this.meta}</slot></div>
|
|
1730
1736
|
<div class="body ${a?"clamp":""}" id="${r(this,Po)}-body" part="body" ?hidden=${!this._body}
|
|
1731
1737
|
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,dt,ih).call(this,d,"_body")}></slot></div>
|
|
1732
1738
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
1733
|
-
aria-controls="${r(this,Po)}-body" @click=${s(this,dt,
|
|
1739
|
+
aria-controls="${r(this,Po)}-body" @click=${s(this,dt,fb)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
1734
1740
|
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,dt,ih).call(this,d,"_actions")}></slot></div>
|
|
1735
1741
|
</div>
|
|
1736
|
-
</div>`}};Po=new WeakMap,pr=new WeakMap,dt=new WeakSet,wp=function(){let e=this.renderRoot.querySelector(".body");if(!e||!this._body||!(this.lines>0)){this._overflow=!1;return}let t=parseFloat(getComputedStyle(e).lineHeight)||20;this._overflow=e.scrollHeight>this.lines*t+1},ih=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(a=>a.nodeType===Node.ELEMENT_NODE||(a.textContent??"").trim())},
|
|
1742
|
+
</div>`}};Po=new WeakMap,pr=new WeakMap,dt=new WeakSet,wp=function(){let e=this.renderRoot.querySelector(".body");if(!e||!this._body||!(this.lines>0)){this._overflow=!1;return}let t=parseFloat(getComputedStyle(e).lineHeight)||20;this._overflow=e.scrollHeight>this.lines*t+1},ih=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(a=>a.nodeType===Node.ELEMENT_NODE||(a.textContent??"").trim())},fb=function(){this.expanded=!this.expanded},Qa.properties={icon:{reflect:!0},tone:{reflect:!0},heading:{},datetime:{reflect:!0},time:{},meta:{},lines:{type:Number},expanded:{type:Boolean,reflect:!0},_overflow:{state:!0},_body:{state:!0},_meta:{state:!0},_actions:{state:!0}},Qa.styles=[k,x`
|
|
1737
1743
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
1738
1744
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
1739
1745
|
.icon {
|
|
@@ -1746,9 +1752,12 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1746
1752
|
.icon.critical { background: var(--cm-bg-critical); color: var(--cm-text-critical); border-color: transparent; }
|
|
1747
1753
|
.dot { width: 8px; height: 8px; border-radius: var(--cm-radius-full); background: currentColor; }
|
|
1748
1754
|
.main { flex: 1; min-width: 0; padding-block-start: calc((32px - 20px) / 2); } /* the first line centred on the 32px icon */
|
|
1749
|
-
.head { display: flex;
|
|
1755
|
+
.head { display: flex; align-items: flex-start; gap: var(--cm-space-8); }
|
|
1756
|
+
/* Heading and badges wrap inside their own column, so the time keeps its place at the end of the first line
|
|
1757
|
+
however long the heading is (1.8.1; before, a long heading pushed the time onto a line of its own). */
|
|
1758
|
+
.lead { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--cm-space-8); row-gap: 4px; }
|
|
1750
1759
|
.title { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
|
|
1751
|
-
.when { margin-inline-start: auto; }
|
|
1760
|
+
.when { flex: none; display: flex; margin-inline-start: auto; margin-block-start: 2px; } /* 16px time on the 20px first line */
|
|
1752
1761
|
time {
|
|
1753
1762
|
position: relative; display: inline-block; font-size: 12px; line-height: 16px; color: var(--cm-text-tertiary); white-space: nowrap; font-variant-numeric: tabular-nums;
|
|
1754
1763
|
border-radius: var(--cm-radius-xs);
|
|
@@ -1766,19 +1775,25 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1766
1775
|
}
|
|
1767
1776
|
.toggle:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
|
|
1768
1777
|
.actions { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); margin-block-start: var(--cm-space-8); }
|
|
1778
|
+
/* Phones: the time goes under the heading, left-aligned, so the heading keeps the full width. */
|
|
1779
|
+
@media (max-width: 640px) {
|
|
1780
|
+
.head { flex-wrap: wrap; row-gap: 2px; }
|
|
1781
|
+
.lead { flex-basis: 100%; }
|
|
1782
|
+
.when { margin-inline-start: 0; margin-block-start: 0; }
|
|
1783
|
+
}
|
|
1769
1784
|
[hidden] { display: none !important; }
|
|
1770
1785
|
.sr { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1771
1786
|
::slotted([slot='badge']) { flex: none; }
|
|
1772
|
-
`];$("cm-timeline-item",Qa);var Oo,es,ur,$p,
|
|
1787
|
+
`];$("cm-timeline-item",Qa);var Oo,es,ur,$p,vb,mr=class extends T{constructor(){super(...arguments);p(this,ur);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];p(this,Oo,new MutationObserver(()=>s(this,ur,$p).call(this)));p(this,es,!1)}connectedCallback(){super.connectedCallback(),s(this,ur,$p).call(this),r(this,Oo).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Oo).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){g(this,es,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach((i,a)=>{this._items[a]&&i.assign(this._items[a])});let t=this.renderRoot.querySelector("slot.empty");t&&t.assign(...this._empty),r(this,es)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,es,!1),this.renderRoot.querySelector("ol")?.focus())}render(){let e=this._items,t=this.loading,i=t&&!e.length?c`<div class="loading" aria-hidden="true">${[0,1,2].map(()=>c`<div class="sk">
|
|
1773
1788
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
1774
1789
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
1775
1790
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
1776
1791
|
</ol>`:h}
|
|
1777
1792
|
${i}
|
|
1778
1793
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
1779
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,ur,
|
|
1794
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,ur,vb)}>${this.moreLabel}</cm-button></div>`:h}
|
|
1780
1795
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
1781
|
-
`}};Oo=new WeakMap,es=new WeakMap,ur=new WeakSet,$p=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},
|
|
1796
|
+
`}};Oo=new WeakMap,es=new WeakMap,ur=new WeakSet,$p=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},vb=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},mr.shadowRootOptions={...S.shadowRootOptions,slotAssignment:"manual"},mr.properties={label:{string:"label"},hasMore:{type:Boolean,attribute:"has-more",reflect:!0},loading:{type:Boolean,reflect:!0},moreLabel:{attribute:"more-label",string:"showMore"},_items:{state:!0},_empty:{state:!0}},mr.styles=[k,x`
|
|
1782
1797
|
:host { display: block; }
|
|
1783
1798
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
1784
1799
|
ol:focus { outline: none; }
|
|
@@ -1801,7 +1816,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1801
1816
|
@media (max-width: 640px) {
|
|
1802
1817
|
.more { padding-inline-start: 0; }
|
|
1803
1818
|
}
|
|
1804
|
-
`];$("cm-timeline",mr);var
|
|
1819
|
+
`];$("cm-timeline",mr);var k1=z("smartTip",{newTab:"(opens in a new tab)"}),E1=z("smartTips",{heading:"Smart tips",tourAction:"Start"}),ts=class extends T{constructor(){super(...arguments);this.heading="";this.href="";this.target=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-smart-tips"&&this.setAttribute("role","listitem")}render(){let e=this.target==="_blank";return c`<a part="tip" href=${this.href||h} target=${this.target||h} rel=${e?"noopener noreferrer":h}>
|
|
1805
1820
|
<span class="text">
|
|
1806
1821
|
<span class="title" part="heading">${this.heading}</span>
|
|
1807
1822
|
<span class="desc" part="description"><slot></slot></span>
|
|
@@ -1853,11 +1868,11 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1853
1868
|
margin: var(--cm-space-8) 0 var(--cm-space-16); text-align: center; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600;
|
|
1854
1869
|
}
|
|
1855
1870
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1856
|
-
`];$("cm-smart-tips",is);var
|
|
1871
|
+
`];$("cm-smart-tips",is);var C1=z("pagination",{label:"Pagination",rows:"Number of rows",summary:"Showing {from}\u2013{to} of {total} {resource}",page:"Page",of:"of {count}",previous:"Previous page",next:"Next page"}),Wt,as,yb,xb,rs=class extends T{constructor(){super(...arguments);p(this,as);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;p(this,Wt,A("cm-pg"))}get pageCount(){return Math.max(1,Math.ceil((this.total||0)/Math.max(1,this.pageSize)))}goTo(e){let t=Math.min(this.pageCount,Math.max(1,Math.round(e)||1));if(this._draft=null,t===this.page){this.requestUpdate();return}this.page=t,this.dispatchEvent(new CustomEvent("cm-page-change",{detail:{page:t},bubbles:!0,composed:!0}))}render(){let e=this.pageCount,t=Math.min(e,Math.max(1,this.page)),i=this.total?(t-1)*this.pageSize+1:0,a=Math.min(this.total,t*this.pageSize),l=this.pageSizes??[];return c`
|
|
1857
1872
|
<nav part="bar" aria-label=${this.label}>
|
|
1858
1873
|
${l.length?c`<div class="rows" part="rows">
|
|
1859
1874
|
<label for="${r(this,Wt)}-s">${this.t("rows")}</label>
|
|
1860
|
-
<span class="field"><select id="${r(this,Wt)}-s" @change=${s(this,as,
|
|
1875
|
+
<span class="field"><select id="${r(this,Wt)}-s" @change=${s(this,as,yb)}>
|
|
1861
1876
|
${(l.includes(this.pageSize)?l:[...l,this.pageSize].sort((d,m)=>d-m)).map(d=>c`<option value=${d} ?selected=${d===this.pageSize}>${d}</option>`)}
|
|
1862
1877
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
1863
1878
|
</div>`:h}
|
|
@@ -1868,7 +1883,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1868
1883
|
<input id="${r(this,Wt)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1869
1884
|
.value=${this._draft??String(t)} aria-describedby="${r(this,Wt)}-of"
|
|
1870
1885
|
@input=${d=>this._draft=d.target.value}
|
|
1871
|
-
@keydown=${s(this,as,
|
|
1886
|
+
@keydown=${s(this,as,xb)}
|
|
1872
1887
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
1873
1888
|
<span id="${r(this,Wt)}-of">${this.t("of",{count:e})}</span>
|
|
1874
1889
|
</span>
|
|
@@ -1880,7 +1895,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1880
1895
|
</span>
|
|
1881
1896
|
</div>
|
|
1882
1897
|
</nav>
|
|
1883
|
-
`}};Wt=new WeakMap,as=new WeakSet,
|
|
1898
|
+
`}};Wt=new WeakMap,as=new WeakSet,yb=function(e){let t=Number(e.target.value);t!==this.pageSize&&(this.pageSize=t,this.page=1,this.dispatchEvent(new CustomEvent("cm-page-size-change",{detail:{pageSize:t},bubbles:!0,composed:!0})))},xb=function(e){e.key==="Enter"?(e.preventDefault(),this.goTo(Number(e.target.value))):e.key==="Escape"&&(this._draft=null,e.target.value=String(this.page))},rs.properties={page:{type:Number,reflect:!0},total:{type:Number},pageSize:{type:Number,attribute:"page-size"},pageSizes:{type:Array,attribute:"page-sizes"},label:{string:"label"},resourceName:{attribute:"resource-name"},_draft:{state:!0}},rs.styles=[k,x`
|
|
1884
1899
|
:host { display: block; }
|
|
1885
1900
|
nav {
|
|
1886
1901
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -1923,17 +1938,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1923
1938
|
select, input { height: var(--cm-control-height-touch); }
|
|
1924
1939
|
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
1925
1940
|
}
|
|
1926
|
-
`];$("cm-pagination",rs);var
|
|
1941
|
+
`];$("cm-pagination",rs);var H1=z("statusTabs",{label:"Status",option:"{label} ({count})"}),ns,Bo,me,qo,wb,kp,$b,Ep,kb,ss=class extends T{constructor(){super(...arguments);p(this,me);this.value="";this.tabs=[];this.controls="";this.size="large";this.mobile="scroll";this._more="";p(this,ns,new ResizeObserver(()=>s(this,me,qo).call(this)));this._slotted=[];p(this,Bo,new MutationObserver(()=>s(this,me,kp).call(this)))}connectedCallback(){super.connectedCallback(),s(this,me,kp).call(this),r(this,Bo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Bo).disconnect(),r(this,ns).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector(".tabs");r(this,ns).observe(e),e.addEventListener("scroll",()=>s(this,me,qo).call(this),{passive:!0}),document.fonts?.ready.then(()=>s(this,me,qo).call(this))}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){let t=this.renderRoot.querySelector(".pick select");t&&t.offsetParent!==null?t.focus(e):this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(e){s(this,me,qo).call(this);for(let a of this.renderRoot.querySelectorAll(".tabs > *"))r(this,ns).observe(a);if(!("ariaControlsElements"in Element.prototype))return;let t=this.getRootNode(),i=this.controls?t.getElementById?.(this.controls):null;for(let a of this.renderRoot.querySelectorAll("button, select"))a.ariaControlsElements=i?[i]:null}render(){let e=this.items,t=s(this,me,$b).call(this,e),i=this.getAttribute("aria-label")||this.t("label");return c`
|
|
1927
1942
|
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${i}>
|
|
1928
1943
|
${e.map((a,l)=>c`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
1929
1944
|
tabindex=${l===t?"0":"-1"} ?disabled=${!!a.disabled}
|
|
1930
|
-
@click=${()=>s(this,me,Ep).call(this,l)} @keydown=${d=>s(this,me
|
|
1945
|
+
@click=${()=>s(this,me,Ep).call(this,l)} @keydown=${d=>s(this,me,kb).call(this,d,l)}><span class="label" data-text=${a.label}>${a.label}</span>${a.count!==void 0&&!Number.isNaN(a.count)?c`<span class="sr">, </span><span class="count" part="count">${this.formatNumber(a.count)}</span>`:h}</button>`)}
|
|
1931
1946
|
</div>
|
|
1932
|
-
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,me,
|
|
1947
|
+
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,me,wb)}>
|
|
1933
1948
|
${e.map((a,l)=>c`<option value=${a.value} ?disabled=${!!a.disabled} ?selected=${l===t} .selected=${l===t}>${a.count!==void 0&&!Number.isNaN(a.count)?this.t("option",{label:a.label,count:a.count}):a.label}</option>`)}
|
|
1934
1949
|
</select><cm-icon name="chevron-down" size="16"></cm-icon></div>`:h}
|
|
1935
1950
|
<slot></slot>
|
|
1936
|
-
`}};ns=new WeakMap,Bo=new WeakMap,me=new WeakSet,qo=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),a=t>1&&i>1,l=t>1&&i<t-1,d=a&&l?"both":a?"start":l?"end":"";d!==this._more&&(this._more=d)},
|
|
1951
|
+
`}};ns=new WeakMap,Bo=new WeakMap,me=new WeakSet,qo=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),a=t>1&&i>1,l=t>1&&i<t-1,d=a&&l?"both":a?"start":l?"end":"";d!==this._more&&(this._more=d)},wb=function(e){let t=e.target.value;t!==this.value&&(this.value=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},kp=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.getAttribute("count");return{value:t.value,label:t.label||t.textContent.trim(),count:i===null||i===""?void 0:Number(i),disabled:t.disabled}}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"")},$b=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},Ep=function(e){let t=this.items[e];!t||t.disabled||(this.updateComplete.then(()=>{let i=this.renderRoot.querySelectorAll("button")[e];i?.focus(),i?.scrollIntoView?.({block:"nearest",inline:"nearest"})}),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},kb=function(e,t){let i=J(e,this),a=this.items.flatMap((m,u)=>m.disabled?[]:[u]),l=a.indexOf(t),d;if(i==="ArrowRight")d=a[(l+1)%a.length];else if(i==="ArrowLeft")d=a[(l-1+a.length)%a.length];else if(e.key==="Home")d=a[0];else if(e.key==="End")d=a[a.length-1];else return;e.preventDefault(),d!==void 0&&s(this,me,Ep).call(this,d)},ss.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},mobile:{reflect:!0},_slotted:{state:!0},_more:{state:!0}},ss.styles=[k,x`
|
|
1937
1952
|
:host { display: block; }
|
|
1938
1953
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
1939
1954
|
.tabs {
|
|
@@ -1992,20 +2007,20 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1992
2007
|
:host([mobile='select']) .tabs { display: none; }
|
|
1993
2008
|
:host([mobile='select']) .pick { display: block; }
|
|
1994
2009
|
}
|
|
1995
|
-
`];$("cm-status-tabs",ss);var
|
|
2010
|
+
`];$("cm-status-tabs",ss);var B1=z("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),rh,Fo,Gt,Mp,Eb,Mb,os=class extends T{constructor(){super(...arguments);p(this,Gt);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;p(this,rh,A("cm-th"));p(this,Fo,new MutationObserver(()=>s(this,Gt,Mp).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),s(this,Gt,Mp).call(this),r(this,Fo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Fo).disconnect()}get items(){return this.columns.length?this.columns.map(e=>typeof e=="string"?{key:e,label:e}:{...e,key:e.key??e.label}):this._slotted}render(){let e=this._inTable,t=this.items;return c`
|
|
1996
2011
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
1997
2012
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
1998
2013
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
1999
2014
|
<input id="${r(this,rh)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
2000
|
-
@change=${s(this,Gt,
|
|
2015
|
+
@change=${s(this,Gt,Mb)} />
|
|
2001
2016
|
<span class="box" aria-hidden="true">${this.indeterminate?c`<span class="dash"></span>`:this.checked?c`<cm-icon name="check" size="14"></cm-icon>`:h}</span>
|
|
2002
2017
|
</span></span>`:h}
|
|
2003
2018
|
${t.map(i=>{let a=this.sort===i.key,l=a?this.direction==="descending"?"descending":"ascending":"none",d=i.hidden?c`<span class="sr">${i.label}</span>`:i.label;return c`<span class="cell" part="cell" data-align=${i.align??"start"} role=${e?"columnheader":h}
|
|
2004
|
-
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,Gt,
|
|
2019
|
+
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,Gt,Eb).call(this,i)}>${d}${e?h:c`<span class="sr">${a?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
2005
2020
|
name=${a&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
2006
2021
|
</div>
|
|
2007
2022
|
<slot></slot>
|
|
2008
|
-
`}};rh=new WeakMap,Fo=new WeakMap,Gt=new WeakSet,Mp=function(){this._slotted=[...this.querySelectorAll("option")].map(e=>{let t=e.label||e.textContent.trim();return{key:e.getAttribute("value")??t,label:t,sortable:e.hasAttribute("sortable"),hidden:e.hasAttribute("hidden"),align:e.getAttribute("align")??"start"}})},
|
|
2023
|
+
`}};rh=new WeakMap,Fo=new WeakMap,Gt=new WeakSet,Mp=function(){this._slotted=[...this.querySelectorAll("option")].map(e=>{let t=e.label||e.textContent.trim();return{key:e.getAttribute("value")??t,label:t,sortable:e.hasAttribute("sortable"),hidden:e.hasAttribute("hidden"),align:e.getAttribute("align")??"start"}})},Eb=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending";this.dispatchEvent(new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0}))},Mb=function(e){let t=e.target.checked;this.checked=t,this.indeterminate=!1,this.dispatchEvent(new CustomEvent("cm-select-all",{detail:{checked:t},bubbles:!0,composed:!0}))},os.properties={columns:{type:Array},sort:{reflect:!0},direction:{reflect:!0},selectable:{type:Boolean,reflect:!0},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean,reflect:!0},resourceRows:{attribute:"resource-rows",reflect:!0},_slotted:{state:!0},_inTable:{state:!0}},os.styles=[k,x`
|
|
2009
2024
|
:host { display: block; }
|
|
2010
2025
|
slot { display: none; } /* <option> children are column data, not content */
|
|
2011
2026
|
.bar {
|
|
@@ -2057,10 +2072,10 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
2057
2072
|
:host([resource-rows='selectable']) .bar:not(.sel) { padding-inline-start: calc(var(--_rl) + 20px + var(--cm-space-8)); }
|
|
2058
2073
|
:host([resource-rows]) .bar.sel { grid-template-columns: calc(20px + var(--cm-space-8) - var(--cm-space-20)) var(--cm-table-columns, var(--_cols)); }
|
|
2059
2074
|
}
|
|
2060
|
-
`];$("cm-table-header",os);var
|
|
2075
|
+
`];$("cm-table-header",os);var wy=`
|
|
2061
2076
|
[data-cm-density="compact"] { --cm-table-row-height: 40px; --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
2062
2077
|
[data-cm-density="comfortable"] { --cm-table-row-height: 48px; --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
|
|
2063
|
-
`,ah=null,
|
|
2078
|
+
`,ah=null,Tb=new WeakSet;function sh(o){if(typeof document>"u"||typeof CSSStyleSheet>"u")return;let n=[document],e=o.getRootNode();e instanceof ShadowRoot&&n.push(e);for(let t of n)if(!Tb.has(t)){Tb.add(t);try{ah||(ah=new CSSStyleSheet,ah.replaceSync(wy)),t.adoptedStyleSheets=[...t.adoptedStyleSheets,ah]}catch{}}}var Y1=z("dataTable",{empty:"No data",sorted:"Sorted by {column}, {direction}",scrollHint:"Scroll for more",columns:"Columns",showColumns:"Show columns",resize:"Resize {column} column",resized:"{column} column, {width} pixels wide",viewAll:"View all fields",viewLess:"Hide fields",rowAction:"{action}, {name}"}),zb=48,_b=16,Cb=!1,$y=`
|
|
2064
2079
|
cm-data-table > table { width: 100%; border-collapse: separate; border-spacing: 0; font: inherit; font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); font-variant-numeric: tabular-nums; color: var(--cm-text-default); }
|
|
2065
2080
|
cm-data-table > table caption { text-align: start; font-weight: 600; font-size: var(--cm-font-size-16); line-height: var(--cm-line-height-16); padding-block-end: var(--cm-space-8); }
|
|
2066
2081
|
cm-data-table > table th, cm-data-table > table td { box-sizing: border-box; }
|
|
@@ -2103,17 +2118,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2103
2118
|
cm-data-table[mobile='cards'] > table tr > * { display: flex; justify-content: space-between; gap: var(--cm-space-12); height: auto; padding: var(--cm-space-4) 0; border: 0; background: none; text-align: end; white-space: normal; }
|
|
2104
2119
|
cm-data-table[mobile='cards'] > table tbody tr:hover > * { background: none; }
|
|
2105
2120
|
/* The value side of a card row may shrink, so one-line [data-lines] items end in "\u2026" inside the card (CRM 1.7.1). */
|
|
2106
|
-
cm-data-table[mobile='cards'] > table tr > * > * { min-inline-size: 0; max-inline-size: 100%; }
|
|
2121
|
+
cm-data-table[mobile='cards'] > table tr > * > * { min-inline-size: 0; max-inline-size: 100%; box-sizing: border-box; }
|
|
2107
2122
|
cm-data-table[mobile='cards'] > table tr > :first-child { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 600; text-align: start; }
|
|
2108
2123
|
cm-data-table[mobile='cards'] > table tr > :not(:first-child)[data-label]::before { content: attr(data-label); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); text-align: start; font-weight: 400; }
|
|
2109
2124
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
|
|
2110
2125
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
|
|
2111
2126
|
}
|
|
2112
|
-
`;function
|
|
2127
|
+
`;function ky(){if(Cb||typeof document>"u")return;Cb=!0;let o=new CSSStyleSheet;o.replaceSync($y),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var jo=o=>o.type==="numeric"||o.type==="money",Ey=o=>(o.align??(jo(o)||o.type==="actions"?"end":"start"))==="end",My=o=>!o.type||o.type==="text";function Sb(o){if(typeof o=="number")return o;let n=String(o??"").trim(),e=/^\(.*\)$/.test(n)||/^-|^[^\d]*-\s*\d/.test(n),t=n.match(/\d[\d,]*(?:\.\d+)?/);if(!t)return NaN;let i=Number(t[0].replace(/,/g,""));return e?-i:i}var Lb=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),Db=new Map;function Ty(o){let n=Db.get(o??"");if(!n){try{n=new Intl.Collator(o,{numeric:!0,sensitivity:"base"})}catch{n=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"})}Db.set(o??"",n)}return n}function Ab(o,n,e,t){let i=a=>a==null||a==="";return i(o)||i(n)?i(o)===i(n)?0:i(o)?1:-1:e==="numeric"||e==="money"?(Sb(o)||0)-(Sb(n)||0):e==="date"?(Lb(o)||0)-(Lb(n)||0):Ty(t).compare(String(o),String(n))}var Rb=o=>o.parentElement??o.getRootNode().host??null,ps,us,Uo,gs,gr,bs,br,dh,_,Tp,zp,_p,Hb,Cp,Nb,Ib,Pb,fr,ls,cs,nh,ds,hs,oh,Sp,Lp,Dp,Ob,qb,Ap,Rp,lh,Bb,Fb,jb,ch,fs,Ub,Vb,Kb,Wb,Gb,Yb,Xb,ms=class extends T{constructor(){super(...arguments);p(this,_);this.columns=[];this.rows=[];this.totals=null;this.caption="";this.captionHidden=!1;this.sort="";this.direction="ascending";this.sortMode="auto";this.stickyHeader=!1;this.stickyFirstColumn=!1;this.loading=!1;this.loadingRows=5;this.mobile="scroll";this.rowActions="hover";this.resizable=!1;this.columnPicker=!1;this._light=!1;this._announce="";this._widths={};this._expanded=new Set;this._picker=!1;this._overflows=!1;p(this,ps,!1);p(this,us,A("cm-dt"));p(this,Uo,new MutationObserver(()=>s(this,_,Tp).call(this)));p(this,gs,typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s(this,_,ls).call(this)));p(this,gr,[]);p(this,bs,0);p(this,br,-1);p(this,dh,e=>{e.target?.closest?.("[data-lines]")&&s(this,_,oh).call(this,e)});p(this,fr,()=>{r(this,bs)||!this.stickyHeader||g(this,bs,requestAnimationFrame(()=>{g(this,bs,0),s(this,_,ls).call(this)}))});p(this,fs,e=>{let t=this.renderRoot.querySelector(".tools");t&&!e.composedPath().includes(t)&&s(this,_,ch).call(this,!1)})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerover",r(this,dh)),sh(this),s(this,_,Tp).call(this),r(this,Uo).observe(this,{childList:!0,subtree:!0}),document.addEventListener("scroll",r(this,fr),{capture:!0,passive:!0}),window.addEventListener("resize",r(this,fr),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Uo).disconnect(),r(this,gs)?.disconnect(),g(this,gr,[]),document.removeEventListener("scroll",r(this,fr),{capture:!0}),window.removeEventListener("resize",r(this,fr)),document.removeEventListener("pointerdown",r(this,fs),{capture:!0})}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(a=>a.key===this.sort);if(!t||this.sortMode==="manual")return e;let i=this.direction==="descending"?-1:1;return e.map((a,l)=>[a,l]).sort(([a,l],[d,m])=>{let u=a[t.key],v=d[t.key],b=u==null||u==="",w=v==null||v==="";return b||w?b===w?l-m:b?1:-1:i*Ab(u,v,t.type,this.locale)||l-m}).map(([a])=>a)}get visibleColumns(){return(this.columns??[]).filter(e=>e.visible!==!1)}updated(e){if(r(this,ps)&&(e.has("sort")||e.has("direction"))&&this.sort){g(this,ps,!1);let t=this.columns.find(i=>i.key===this.sort);t&&s(this,_,_p).call(this,t.label,this.direction)}if(e.has("columns")){let t=e.get("columns")??[],i={...this._widths},a=!1;for(let l of this.columns??[]){let d=t.find(m=>m.key===l.key);l.width!==void 0&&d?.width!==l.width&&i[l.key]!==void 0&&(delete i[l.key],a=!0)}a&&(this._widths=i)}s(this,_,Pb).call(this),s(this,_,ls).call(this)}render(){let e=c`<span class="sr" role="status">${this._announce}</span>`,t=c`<p class="hint" part="scroll-hint" aria-hidden="true">${this.t("scrollHint")}<cm-icon name="chevron-right" size="16"></cm-icon></p>`,i=c`<span class="fade s" aria-hidden="true"></span><span class="fade e" aria-hidden="true"></span>`,a=this.stickyHeader||this.stickyFirstColumn||this._overflows;if(this._light)return c`<div class="frame" part="frame"><div class="wrap"><div class="scroll" part="scroll" tabindex=${this._overflows?"0":h}
|
|
2113
2128
|
role=${this._overflows?"region":h} aria-label=${this._overflows?this.querySelector("caption")?.textContent?.trim()||h:h}
|
|
2114
2129
|
@scroll=${()=>s(this,_,ls).call(this)}><slot></slot></div>${i}</div>${t}</div>${e}`;let l=this.visibleColumns,d=s(this,_,Lp).call(this,l),m=this.mobile==="priority"?l.filter(y=>y.priority==="low"&&y!==d):[],u=this.sortedRows,v=Math.max(1,l.length),b=!this.loading&&u.length===0,w=this.mobile==="cards"&&!this.loading&&u.length>0;return c`
|
|
2115
2130
|
<div class="frame" part="frame" ?data-cards=${w}>
|
|
2116
|
-
${this.columnPicker?s(this,_,
|
|
2131
|
+
${this.columnPicker?s(this,_,Kb).call(this):h}
|
|
2117
2132
|
<div class="wrap">
|
|
2118
2133
|
<div class="scroll" part="scroll" tabindex=${a?"0":h}
|
|
2119
2134
|
role=${a?"region":h}
|
|
@@ -2121,9 +2136,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2121
2136
|
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,_,oh)} @focusin=${s(this,_,Sp)}
|
|
2122
2137
|
@focusout=${s(this,_,Sp)}>
|
|
2123
2138
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
2124
|
-
<thead><tr>${l.map(y=>s(this,_,
|
|
2139
|
+
<thead><tr>${l.map(y=>s(this,_,Wb).call(this,y,d))}</tr></thead>
|
|
2125
2140
|
<tbody>
|
|
2126
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,ds).call(this,y,d)} style=${s(this,_,hs).call(this,y)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((y,M)=>s(this,_,
|
|
2141
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,ds).call(this,y,d)} style=${s(this,_,hs).call(this,y)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((y,M)=>s(this,_,Gb).call(this,y,l,d,m,M))}
|
|
2127
2142
|
${b?c`<tr class="empty"><td colspan=${v}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
2128
2143
|
</tbody>
|
|
2129
2144
|
${this.totals&&!this.loading&&!b?c`<tfoot><tr part="totals">${l.map(y=>c`<td class=${s(this,_,ds).call(this,y,d)} style=${s(this,_,hs).call(this,y)}>${y.type==="actions"?h:s(this,_,cs).call(this,this.totals[y.key])}</td>`)}</tr></tfoot>`:h}
|
|
@@ -2132,24 +2147,24 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2132
2147
|
${i}
|
|
2133
2148
|
</div>
|
|
2134
2149
|
${t}
|
|
2135
|
-
${w?s(this,_,
|
|
2150
|
+
${w?s(this,_,Xb).call(this,u,l,d):h}
|
|
2136
2151
|
</div>${e}
|
|
2137
|
-
`}};ps=new WeakMap,us=new WeakMap,Uo=new WeakMap,gs=new WeakMap,gr=new WeakMap,bs=new WeakMap,br=new WeakMap,dh=new WeakMap,_=new WeakSet,Tp=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(
|
|
2152
|
+
`}};ps=new WeakMap,us=new WeakMap,Uo=new WeakMap,gs=new WeakMap,gr=new WeakMap,bs=new WeakMap,br=new WeakMap,dh=new WeakMap,_=new WeakSet,Tp=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(ky(),s(this,_,Hb).call(this))},zp=function(e){this._announce=this._announce===e?`${e}\xA0`:e},_p=function(e,t){s(this,_,zp).call(this,this.t("sorted",{column:e,direction:this.t(t)}))},Hb=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;if(!t)return;let i=[...t];i.forEach((a,l)=>{if(!a.dataset.sort||a.querySelector(":scope > button.cm-sort"))return;a.dataset.type=a.dataset.sort;let d=document.createElement("button");d.type="button",d.className="cm-sort",d.append(...a.childNodes);let m=document.createElement("cm-icon");m.setAttribute("size","12"),d.append(m),a.append(d),a.hasAttribute("aria-sort")||a.setAttribute("aria-sort","none"),s(this,_,Cp).call(this,a),d.addEventListener("click",()=>s(this,_,Nb).call(this,e,a,l))});for(let a of[...e.tBodies,...e.tFoot?[e.tFoot]:[]])for(let l of a.rows)[...l.cells].forEach((d,m)=>{let u=i[m];u&&(d.dataset.label||(d.dataset.label=(u.textContent??"").trim()),u.dataset.priority&&!d.dataset.priority&&(d.dataset.priority=u.dataset.priority),u.dataset.type==="actions"&&!d.dataset.type&&(d.dataset.type="actions"))})},Cp=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Nb=function(e,t,i){let a=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),l=t.dataset.key||a,d=t.getAttribute("aria-sort")==="ascending"?"descending":"ascending",m=new CustomEvent("cm-sort",{detail:{key:l,direction:d},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(m)||this.sortMode==="manual")return;let u=t.dataset.sort,v=d==="descending"?-1:1;for(let b of e.tBodies){let w=M=>{let D=M.cells[i];return D?(D.dataset.value??D.textContent??"").trim():""},y=[...b.rows].map((M,D)=>[M,w(M),D]).sort(([,M,D],[,H,q])=>M===""||H===""?M===H?D-q:M===""?1:-1:v*Ab(M,H,u,this.locale)||D-q);b.append(...y.map(([M])=>M))}for(let b of e.tHead.rows[0].cells)b.dataset.sort&&(b.setAttribute("aria-sort",b===t?d:"none"),s(this,_,Cp).call(this,b));s(this,_,_p).call(this,a,d)},Ib=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",i=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),a=this.dispatchEvent(i);g(this,ps,a),a&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},Pb=function(){let e=[this.renderRoot.querySelector(".scroll"),this.renderRoot.querySelector("table")??this.querySelector(":scope > table")].filter(Boolean);e.length===r(this,gr).length&&e.every((t,i)=>t===r(this,gr)[i])||(r(this,gs)?.disconnect(),e.forEach(t=>r(this,gs)?.observe(t)),g(this,gr,e))},fr=new WeakMap,ls=function(){let e=this.renderRoot?.querySelector(".scroll"),t=this.renderRoot?.querySelector(".frame");if(!e||!t)return;let i=getComputedStyle(e).maxBlockSize!=="none",a=e.scrollWidth>e.clientWidth+1;a!==this._overflows&&(this._overflows=a),e.toggleAttribute("data-open",this.stickyHeader&&!i&&!a);let l=Math.abs(e.scrollLeft);t.toggleAttribute("data-more-start",a&&l>1),t.toggleAttribute("data-more-end",a&&l+e.clientWidth<e.scrollWidth-1);let d=this.renderRoot.querySelector("caption")??this.querySelector(":scope > table > caption"),m=d&&getComputedStyle(d).position!=="absolute"?`${d.offsetHeight}px`:"";e.parentElement.style.getPropertyValue("--_cap")!==m&&e.parentElement.style.setProperty("--_cap",m);let u=0,v=this.renderRoot.querySelector("table")??this.querySelector(":scope > table"),b=v?.tHead;if(this.stickyHeader&&!i&&a&&v&&b){let w=r(this,br)>0?r(this,br):0,y=b.getBoundingClientRect().top-w,M=v.getBoundingClientRect().bottom-w,D=0;for(let H=Rb(this);H&&H!==document.documentElement&&H!==document.body;H=Rb(H)){let q=getComputedStyle(H);/(auto|scroll|overlay|hidden|clip)/.test(q.overflowY)&&(D=Math.max(D,H.getBoundingClientRect().top+H.clientTop+(parseFloat(q.paddingTop)||0)))}D+=parseFloat(getComputedStyle(this).getPropertyValue("--cm-data-table-sticky-top"))||0,u=Math.max(0,Math.min(D-y,M-y-b.getBoundingClientRect().height))}for(let w of this.renderRoot.querySelectorAll(".rz")){let y=String(Math.round(w.closest("th").getBoundingClientRect().width));w.getAttribute("aria-valuenow")!==y&&w.setAttribute("aria-valuenow",y)}u!==r(this,br)&&(g(this,br,u),u?e.style.setProperty("--_shift",`${u}px`):e.style.removeProperty("--_shift"))},cs=function(e){return e==null?"":e instanceof Date?ae(e,{},this.locale):String(e)},nh=function(e){return this._widths[e.key]??e.width},ds=function(e,t){return[Ey(e)&&"end",jo(e)&&"num",(jo(e)||e.type==="date")&&"nw",e.type==="actions"&&"act",e.priority==="low"&&e!==t&&"low",s(this,_,nh).call(this,e)!==void 0&&"w"].filter(Boolean).join(" ")},hs=function(e){let t=s(this,_,nh).call(this,e);return t===void 0?h:`--_w: ${t}px`},oh=function(e){let t=e.composedPath()[0]?.closest?.("[data-lines]");if(t&&this.contains(t)){t.scrollWidth>t.clientWidth+1||t.scrollHeight>t.clientHeight+1?t.title=t.textContent?.trim()??"":t.removeAttribute("title");return}let i=e.composedPath()[0]?.closest?.(".t");i&&(i.scrollWidth>i.clientWidth+1||i.scrollHeight>i.clientHeight+1?i.title=i.textContent??"":i.removeAttribute("title"))},Sp=function(e){e.type==="focusin"&&s(this,_,oh).call(this,e);let t=e.composedPath().find(a=>a instanceof HTMLTableRowElement);if(!t)return;let i=e.type==="focusin"||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget);t.toggleAttribute("data-focus",i)},Lp=function(e){return e.find(t=>t.primary)??e.find(t=>t.type!=="actions")??e[0]},Dp=function(e,t){return t?s(this,_,cs).call(this,e[t.key]):""},Ob=function(e,t){let i=t[e.key];return Array.isArray(i)?i:e.actions??[]},qb=function(e,t){let i=(this.rows??[]).indexOf(t);this.dispatchEvent(new CustomEvent("cm-row-action",{detail:{action:e.value??e.label,row:t,index:i},bubbles:!0,composed:!0}))},Ap=function(e,t,i){return c`<span class="acts">${s(this,_,Ob).call(this,e,t).map(a=>c`<cm-button size="slim" icon=${a.icon??h}
|
|
2138
2153
|
?icon-only=${!!a.iconOnly} label=${a.iconOnly?this.t("rowAction",{action:a.label,name:i}):h} tone=${a.tone??h}
|
|
2139
|
-
@click=${()=>s(this,_,
|
|
2154
|
+
@click=${()=>s(this,_,qb).call(this,a,t)}>${a.label}${a.iconOnly||!i?h:c`<span class="sr">, ${i}</span>`}</cm-button>`)}</span>`},Rp=function(e,t,i){if(e.type==="actions")return s(this,_,Ap).call(this,e,t,i);let a=s(this,_,cs).call(this,t[e.key]);if(!My(e))return a;let l=Math.trunc(Number(e.lines))||0;return l>1?c`<span class="t lines" style="--_lines: ${l}">${a}</span>`:c`<span class="t">${a}</span>`},lh=function(e,t,i){let a=Math.max(zb,Math.round(t));this._widths={...this._widths,[e.key]:a},i&&(s(this,_,zp).call(this,this.t("resized",{column:e.label,width:a})),this.dispatchEvent(new CustomEvent("cm-column-resize",{detail:{key:e.key,width:a},bubbles:!0,composed:!0})))},Bb=function(e,t){return s(this,_,nh).call(this,e)??Math.round(t.closest("th").getBoundingClientRect().width)},Fb=function(e,t){let i=J(e,this);i!=="ArrowLeft"&&i!=="ArrowRight"||(e.preventDefault(),s(this,_,lh).call(this,t,s(this,_,Bb).call(this,t,e.currentTarget)+(i==="ArrowRight"?_b:-_b),!0))},jb=function(e,t){if(e.button!==0)return;e.preventDefault();let i=e.currentTarget,a=i.closest("th").getBoundingClientRect().width,l=e.clientX,d=getComputedStyle(this).direction==="rtl";try{i.setPointerCapture(e.pointerId)}catch{}i.setAttribute("data-dragging","");let m=a,u=b=>{m=a+(b.clientX-l)*(d?-1:1),s(this,_,lh).call(this,t,m,!1)},v=()=>{i.removeEventListener("pointermove",u),i.removeEventListener("pointerup",v),i.removeEventListener("pointercancel",v),i.removeAttribute("data-dragging"),s(this,_,lh).call(this,t,m,!0)};i.addEventListener("pointermove",u),i.addEventListener("pointerup",v),i.addEventListener("pointercancel",v)},ch=function(e=!this._picker){this._picker=e,e?document.addEventListener("pointerdown",r(this,fs),{capture:!0}):document.removeEventListener("pointerdown",r(this,fs),{capture:!0})},fs=new WeakMap,Ub=function(e){e.key!=="Escape"||!this._picker||(e.stopPropagation(),s(this,_,ch).call(this,!1),this.renderRoot.querySelector(".pick")?.focus())},Vb=function(e,t){let i=this.columns.map(a=>a.key===e?{...a,visible:t}:a);this.columns=i,this.dispatchEvent(new CustomEvent("cm-columns-change",{detail:{key:e,visible:t,columns:i},bubbles:!0,composed:!0}))},Kb=function(){let e=this.columns??[],t=s(this,_,Lp).call(this,this.visibleColumns);return c`<div class="tools" part="tools" @keydown=${s(this,_,Ub)}>
|
|
2140
2155
|
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,us)}-cols"
|
|
2141
2156
|
@click=${()=>s(this,_,ch).call(this)}>${this.t("columns")}<cm-icon name="chevron-down" size="16" aria-hidden="true"></cm-icon></button>
|
|
2142
2157
|
<fieldset class="panel" id="${r(this,us)}-cols" part="column-panel" ?hidden=${!this._picker}>
|
|
2143
2158
|
<legend class="sr">${this.t("showColumns")}</legend>
|
|
2144
2159
|
${e.map(i=>c`<label class="opt"><input type="checkbox" .checked=${i.visible!==!1} ?disabled=${i===t}
|
|
2145
|
-
@change=${a=>s(this,_,
|
|
2160
|
+
@change=${a=>s(this,_,Vb).call(this,i.key,a.target.checked)} />${i.label}</label>`)}
|
|
2146
2161
|
</fieldset>
|
|
2147
|
-
</div>`},
|
|
2162
|
+
</div>`},Wb=function(e,t){let i=this.sort===e.key,a=i?this.direction:"none",d=e.hidden||e.type==="actions"?c`<span class="sr">${e.label}</span>`:c`<span class="t">${e.label}</span>`;return c`<th scope="col" class=${s(this,_,ds).call(this,e,t)} style=${s(this,_,hs).call(this,e)} aria-sort=${e.sortable?a:h}><div class="h">${e.sortable?c`<button type="button" class="sort ${i?"on":""}" @click=${()=>s(this,_,Ib).call(this,e)}>${d}<cm-icon
|
|
2148
2163
|
name=${i&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}${this.resizable&&e.type!=="actions"?c`<span class="rz" part="resize-handle" role="separator" aria-orientation="vertical" tabindex="0" aria-label=${this.t("resize",{column:e.label})}
|
|
2149
|
-
aria-valuemin=${
|
|
2150
|
-
@keydown=${m=>s(this,_,
|
|
2151
|
-
@click=${()=>s(this,_,
|
|
2152
|
-
<dl class="pairs">${a.map(b=>c`<dt>${b.label}</dt><dd class=${jo(b)?"num":""}>${s(this,_,cs).call(this,e[b.key])}</dd>`)}</dl></td></tr>`:h}`},
|
|
2164
|
+
aria-valuemin=${zb} aria-valuemax="1600"
|
|
2165
|
+
@keydown=${m=>s(this,_,Fb).call(this,m,e)} @pointerdown=${m=>s(this,_,jb).call(this,m,e)}></span>`:h}</div></th>`},Gb=function(e,t,i,a,l){let d=s(this,_,Dp).call(this,e,i),m=this._expanded.has(e),u=`${r(this,us)}-more-${l}`,v=c`<tr part="row">${t.map(b=>b===i?c`<th scope="row" class=${s(this,_,ds).call(this,b,i)} style=${s(this,_,hs).call(this,b)} part="cell">${s(this,_,Rp).call(this,b,e,d)}${a.length?c`<button type="button" class="more-btn" aria-expanded=${m?"true":"false"} aria-controls=${u}
|
|
2166
|
+
@click=${()=>s(this,_,Yb).call(this,e)}>${this.t(m?"viewLess":"viewAll")}</button>`:h}</th>`:c`<td class=${s(this,_,ds).call(this,b,i)} style=${s(this,_,hs).call(this,b)} part="cell">${s(this,_,Rp).call(this,b,e,d)}</td>`)}</tr>`;return c`${v}${a.length&&m?c`<tr class="more" id=${u} part="row-details"><td colspan=${t.length-a.length}>
|
|
2167
|
+
<dl class="pairs">${a.map(b=>c`<dt>${b.label}</dt><dd class=${jo(b)?"num":""}>${s(this,_,cs).call(this,e[b.key])}</dd>`)}</dl></td></tr>`:h}`},Yb=function(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t},Xb=function(e,t,i){let a=t.filter(m=>m!==i&&m.type!=="actions"),l=t.filter(m=>m.type==="actions"),d=(m,u=!1)=>{let v=s(this,_,Dp).call(this,m,i);return c`<li class="card ${u?"total":""}" part="card">
|
|
2153
2168
|
<p class="card-title">${v}</p>
|
|
2154
2169
|
${a.length?c`<dl class="pairs">${a.map(b=>c`<dt>${b.label}</dt><dd class=${jo(b)?"num":""}>${s(this,_,cs).call(this,m[b.key])}</dd>`)}</dl>`:h}
|
|
2155
2170
|
${!u&&l.length?c`<div class="card-actions">${l.map(b=>s(this,_,Ap).call(this,b,m,v))}</div>`:h}
|
|
@@ -2314,7 +2329,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2314
2329
|
:host([mobile='priority']) tr.more { display: table-row; }
|
|
2315
2330
|
}
|
|
2316
2331
|
@media (forced-colors: active) { button.sort cm-icon { opacity: 1; } .acts { opacity: 1 !important; } }
|
|
2317
|
-
`];$("cm-data-table",ms);var
|
|
2332
|
+
`];$("cm-data-table",ms);var ik=z("resourceItem",{select:"Select {name}"}),rk=z("resourceList",{resourceName:"item",resourceNamePlural:"items",select:"Select",selectPageHidden:"all {count} {resource} on this page",selectionOptions:"Selection options",selectPage:"Select all {count} on this page",selectAll:"Select all {count} {resource}",selectNone:"Select none",selected:"{count} {resource} selected.",allSelected:"All {count} {resource} selected.",clearSelection:"Clear selection",loading:"Loading {resource}"}),Jb=x`
|
|
2318
2333
|
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
2319
2334
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
2320
2335
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -2326,17 +2341,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2326
2341
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
2327
2342
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2328
2343
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
2329
|
-
`,mh,ws,
|
|
2344
|
+
`,mh,ws,Zb,Qb,ys=class extends T{constructor(){super();p(this,ws);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;this.columns=!1;this.actions="auto";this._hasActions=!1;p(this,mh,this.attachInternals());r(this,mh).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get name(){return this.label||this.textContent.replace(/\s+/g," ").trim()}toggle(e){if(this.disabled)return;let t=e??!this.selected;t!==this.selected&&(this.selected=t,this.dispatchEvent(new CustomEvent("cm-resource-select",{detail:{value:this.value,selected:t},bubbles:!0,composed:!0})))}render(){return c`
|
|
2330
2345
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
2331
|
-
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,ws,
|
|
2346
|
+
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,ws,Qb)}>
|
|
2332
2347
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
2333
2348
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
2334
2349
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
2335
2350
|
<span class="media"><slot name="media"></slot></span>
|
|
2336
2351
|
<div class="content" part="content"><slot></slot></div>
|
|
2337
|
-
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,ws,
|
|
2352
|
+
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,ws,Zb)}></slot></div>
|
|
2338
2353
|
</div>
|
|
2339
|
-
`}};mh=new WeakMap,ws=new WeakSet,
|
|
2354
|
+
`}};mh=new WeakMap,ws=new WeakSet,Zb=function(e){this._hasActions=e.target.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim())},Qb=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i!==this&&i.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},ys.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0},columns:{type:Boolean,reflect:!0},actions:{reflect:!0},_hasActions:{state:!0}},ys.styles=[k,Jb,x`
|
|
2340
2355
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2341
2356
|
:host(:last-child) { border-bottom: 0; }
|
|
2342
2357
|
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
|
|
@@ -2357,6 +2372,8 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2357
2372
|
flex: none; width: var(--cm-resource-media-size, 40px); height: var(--cm-resource-media-size, 40px); object-fit: cover; border-radius: var(--cm-radius-sm); background: var(--cm-thumb-bg);
|
|
2358
2373
|
}
|
|
2359
2374
|
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: var(--cm-resource-media-size, 40px); background: none; }
|
|
2375
|
+
/* An icon as the media (a settings or navigation list): centred in the square, in the icon colour (1.8.1). */
|
|
2376
|
+
::slotted(cm-icon[slot='media']) { display: inline-grid; place-items: center; box-sizing: border-box; color: var(--cm-icon-default); }
|
|
2360
2377
|
.content { flex: 1; min-width: 0; }
|
|
2361
2378
|
:host([columns]) .content {
|
|
2362
2379
|
display: grid; grid-template-columns: var(--cm-table-columns, minmax(0, 1fr)); column-gap: var(--cm-space-20); align-items: center;
|
|
@@ -2379,7 +2396,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2379
2396
|
::slotted([slot='media']) { width: 32px; height: 32px; }
|
|
2380
2397
|
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 32px; }
|
|
2381
2398
|
}
|
|
2382
|
-
`];$("cm-resource-item",ys);var Vo,Ko,ye,
|
|
2399
|
+
`];$("cm-resource-item",ys);var Vo,Ko,ye,ef,Hp,ph,uh,vs,hh,gh,xs=class extends T{constructor(){super();p(this,ye);this.selectable=!1;this.total=0;this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this._count=0;this._rows=0;this._hasHeader=!1;this._hasTable=!1;this._hasActions=!1;p(this,Vo,A("cm-rl"));p(this,Ko,new Set);p(this,ph,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,s(this,ye,Hp).call(this,t)});p(this,uh,e=>{this._hasActions=e.target.assignedElements().length>0});p(this,gh,e=>{e.stopPropagation();let t=e.detail.value;t==="page"?this.selectPage(!0):t==="all"?this.selectAll():t==="none"&&this.clearSelection()});this.addEventListener("cm-resource-select",e=>{e.target!==this&&(this.allSelected=!1,s(this,ye,vs).call(this),s(this,ye,hh).call(this))})}connectedCallback(){super.connectedCallback(),sh(this)}get items(){return[...this.querySelectorAll(":scope > cm-resource-item")]}get selected(){return this.items.filter(e=>e.selected).map(e=>e.value)}selectPage(e=!0){this.items.forEach(t=>{t.disabled||(t.selected=e)}),e||(this.allSelected=!1),s(this,ye,vs).call(this),s(this,ye,hh).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,s(this,ye,vs).call(this),s(this,ye,hh).call(this)}clearSelection(){this.selectPage(!1)}updated(e){e.has("selectable")&&(s(this,ye,vs).call(this),s(this,ye,Hp).call(this))}render(){let e=this._count,t=this._rows,i=this.items.filter(M=>!M.disabled).length,a=i>0&&e>=i,l=s(this,ye,ef).call(this),d=M=>hc(M,this.locale)==="one"?this.resourceName:l,m=this.total>t,u=h;this.allSelected?u=c`${this.t("allSelected",{count:Math.max(this.total,e),resource:l})} <button type="button" @click=${()=>this.clearSelection()}>${this.t("clearSelection")}</button>`:e&&(u=c`${this.t("selected",{count:e,resource:d(e)})}${a&&m?c` <button type="button" @click=${()=>this.selectAll()}>${this.t("selectAll",{count:this.total,resource:l})}</button>`:h}`);let v=e>0||this.allSelected,b=this._hasTable,w=!this.hideSelectMenu&&(!b||v),y=c`<slot name="actions" @slotchange=${r(this,uh)}></slot>`;return c`
|
|
2383
2400
|
${this.selectable&&b?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${y}</div>`:h}
|
|
2384
2401
|
<div class="head ${this.selectable||this._hasHeader?"on":""} ${b?"over":""}">
|
|
2385
2402
|
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,ph)}></slot></div>
|
|
@@ -2404,7 +2421,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2404
2421
|
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
2405
2422
|
</div>
|
|
2406
2423
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
2407
|
-
`}};Vo=new WeakMap,Ko=new WeakMap,ye=new WeakSet,
|
|
2424
|
+
`}};Vo=new WeakMap,Ko=new WeakMap,ye=new WeakSet,ef=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},Hp=function(e=this.renderRoot?.querySelector('slot[name="header"]')){if(!e)return;let t=new Set;for(let i of e.assignedElements())i.localName==="cm-table-header"&&t.add(i),i.querySelectorAll("cm-table-header").forEach(a=>t.add(a));for(let i of r(this,Ko))t.has(i)||i.removeAttribute("resource-rows");for(let i of t)i.setAttribute("resource-rows",this.selectable?"selectable":"plain");g(this,Ko,t),this._hasTable=t.size>0},ph=new WeakMap,uh=new WeakMap,vs=function(){let e=this.items;e.forEach(t=>t.selectable=this.selectable),this._rows=e.length,this._count=e.filter(t=>t.selected).length},hh=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},gh=new WeakMap,xs.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name",string:"resourceName"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},density:{reflect:!0},_count:{state:!0},_rows:{state:!0},_hasHeader:{state:!0},_hasTable:{state:!0},_hasActions:{state:!0}},xs.styles=[k,Jb,x`
|
|
2408
2425
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
|
|
2409
2426
|
/* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
|
|
2410
2427
|
:host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
@@ -2460,11 +2477,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2460
2477
|
.toolbar .check { width: 20px; height: 20px; }
|
|
2461
2478
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
2462
2479
|
}
|
|
2463
|
-
`];$("cm-resource-list",xs);var
|
|
2464
|
-
<div class="row" part="row" @dragover=${s(this,re,
|
|
2480
|
+
`];$("cm-resource-list",xs);var ck=z("nestedItem",{reorder:"Reorder {label}",hint:"Press up or down arrow to move.",hintGroup:"Press up or down arrow to move. At either end of the list, the arrow moves it into the list before or after.",moved:"{label} moved to position {position} of {total}.",movedTo:"{label} moved to {list}, position {position} of {total}."}),dk=z("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),fh,re,Np,Ip,tf,rf,zi,af,sf,nf,Pp,of,ht=class ht extends T{constructor(){super();p(this,re);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;p(this,fh,this.attachInternals());p(this,zi,!1);r(this,fh).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get list(){let e=this.parentElement;return e?.localName==="cm-nested-list"?e:null}moveToList(e,t){let i=this.list;if(!i||!e)return!1;if(e===i)return t===void 0?!1:this.moveTo(t);if(!i.group||e.group!==i.group)return!1;let a=e.items,l=Math.max(0,Math.min(a.length,t??a.length)),d={item:this,from:i.items.indexOf(this),to:l,fromList:i,toList:e};return this.dispatchEvent(new CustomEvent("cm-move",{detail:d,bubbles:!0,composed:!0,cancelable:!0}))?(e.insertBefore(this,a[l]??null),e.announce(this.t("movedTo",{label:this.label,list:e.heading,position:l+1,total:a.length+1})),!0):!1}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,i=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===i)return!1;let a=new CustomEvent("cm-reorder",{detail:{item:this,from:i,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(a))return!1;let l=t[e];return l.parentElement.insertBefore(this,e>i?l.nextSibling:l),this.closest("cm-nested-list")?.announce(this.t("moved",{label:this.label,position:e+1,total:t.length})),!0}render(){return c`
|
|
2481
|
+
<div class="row" part="row" @dragover=${s(this,re,nf)} @dragleave=${s(this,re,Pp)} @drop=${s(this,re,of)}>
|
|
2465
2482
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
2466
2483
|
aria-describedby="hint"
|
|
2467
|
-
@keydown=${s(this,re,
|
|
2484
|
+
@keydown=${s(this,re,tf)} @dragstart=${s(this,re,rf)} @pointerdown=${s(this,re,af)}
|
|
2468
2485
|
@dragend=${()=>{this.classList.remove("dragging"),ht.dragged=null,Wo(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
2469
2486
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
2470
2487
|
<span class="label" part="label">${this.label}</span>
|
|
@@ -2473,7 +2490,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2473
2490
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
2474
2491
|
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(i=>i.localName==="cm-nested-item");t.forEach(i=>i.sortable=this.sortable),this._hasChildren=t.length>0}}></slot>
|
|
2475
2492
|
</div>
|
|
2476
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};fh=new WeakMap,re=new WeakSet,Np=function(){let e=this.list;return e?.group?[...e.getRootNode().querySelectorAll("cm-nested-list")].filter(i=>i===e||i.group===e.group&&i.sortable&&(!i.collapsible||i.open)):[]},Ip=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},
|
|
2493
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};fh=new WeakMap,re=new WeakSet,Np=function(){let e=this.list;return e?.group?[...e.getRootNode().querySelectorAll("cm-nested-list")].filter(i=>i===e||i.group===e.group&&i.sortable&&(!i.collapsible||i.open)):[]},Ip=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},tf=function(e){let t=this.siblings.indexOf(this),i=e.key==="ArrowUp",a=e.key==="ArrowDown";if(i&&t===0||a&&t===this.siblings.length-1){let d=r(this,re,Np),m=d[d.indexOf(this.list)+(i?-1:1)];if(m){e.preventDefault(),this.moveToList(m,i?m.items.length:0)&&s(this,re,Ip).call(this);return}}let l;if(e.key==="ArrowUp")l=t-1;else if(e.key==="ArrowDown")l=t+1;else if(e.key==="Home")l=0;else if(e.key==="End")l=this.siblings.length-1;else return;e.preventDefault(),this.moveTo(l)&&s(this,re,Ip).call(this)},rf=function(e){if(e.stopPropagation(),r(this,zi)){e.preventDefault();return}ht.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},zi=new WeakMap,af=function(e){if(e.pointerType==="mouse"||!e.isPrimary)return;let t=e.clientY,i=null,a=d=>{if(d.pointerId===e.pointerId){if(!r(this,zi)){if(Math.abs(d.clientY-t)<6)return;g(this,zi,!0),ht.dragged=this,this.classList.add("dragging")}d.preventDefault(),i=s(this,re,sf).call(this,d.clientX,d.clientY),Wo(this,i)}},l=d=>{if(d.pointerId!==e.pointerId)return;document.removeEventListener("pointermove",a,!0),document.removeEventListener("pointerup",l,!0),document.removeEventListener("pointercancel",l,!0);let m=r(this,zi);g(this,zi,!1),ht.dragged=null,this.classList.remove("dragging"),Wo(this,null),!(!m||d.type==="pointercancel"||!i)&&(i.list?this.moveToList(i.list,i.index):this.moveTo(i.index))};document.addEventListener("pointermove",a,!0),document.addEventListener("pointerup",l,!0),document.addEventListener("pointercancel",l,!0)},sf=function(e,t){for(let i of r(this,re,Np)){if(i===this.list)continue;let a=i.getBoundingClientRect();if(e>=a.left&&e<=a.right&&t>=a.top&&t<=a.bottom)return{list:i,index:bh(i.items,this,t)}}return{index:bh(this.siblings,this,t)}},nf=function(e){let t=ht.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.renderRoot.querySelector(".row").getBoundingClientRect(),a=e.clientY>i.top+i.height/2;this.classList.toggle("drop-after",a),this.classList.toggle("drop-before",!a)},Pp=function(){this.classList.remove("drop-before","drop-after")},of=function(e){let t=ht.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.classList.contains("drop-after");s(this,re,Pp).call(this);let a=this.siblings,l=a.indexOf(t),d=a.indexOf(this)+(i?1:0);d>l&&(d-=1),t.moveTo(d)},ht.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},ht.styles=[k,x`
|
|
2477
2494
|
:host { display: block; }
|
|
2478
2495
|
.row {
|
|
2479
2496
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2500,20 +2517,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2500
2517
|
.actions { gap: var(--cm-space-8); }
|
|
2501
2518
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2502
2519
|
}
|
|
2503
|
-
`],ht.dragged=null;var ks=ht;$("cm-nested-item",ks);function bh(o,n,e){return o.filter(t=>{if(t===n)return!1;let i=t.getBoundingClientRect();return i.top+i.height/2<e}).length}function Wo(o,n){if((o.list??o).getRootNode().querySelectorAll("cm-nested-item.drop-before, cm-nested-item.drop-after, cm-nested-list.drop-target").forEach(i=>i.classList.remove("drop-before","drop-after","drop-target")),!n)return;let t=(n.list?n.list.items:o.siblings).filter(i=>i!==o);t.length?n.index<t.length?t[n.index].classList.add("drop-before"):t[t.length-1].classList.add("drop-after"):n.list?.classList.add("drop-target")}var vr,Ne,
|
|
2520
|
+
`],ht.dragged=null;var ks=ht;$("cm-nested-item",ks);function bh(o,n,e){return o.filter(t=>{if(t===n)return!1;let i=t.getBoundingClientRect();return i.top+i.height/2<e}).length}function Wo(o,n){if((o.list??o).getRootNode().querySelectorAll("cm-nested-item.drop-before, cm-nested-item.drop-after, cm-nested-list.drop-target").forEach(i=>i.classList.remove("drop-before","drop-after","drop-target")),!n)return;let t=(n.list?n.list.items:o.siblings).filter(i=>i!==o);t.length?n.index<t.length?t[n.index].classList.add("drop-before"):t[t.length-1].classList.add("drop-after"):n.list?.classList.add("drop-target")}var vr,Ne,lf,Op,qp,cf,df,$s=class extends T{constructor(){super(...arguments);p(this,Ne);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;p(this,vr,A("cm-nl"))}get items(){return[...this.children].filter(e=>e.localName==="cm-nested-item")}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}willUpdate(){this.hasUpdated||(this._empty=!this.items.length)}updated(e){(e.has("sortable")||e.has("group"))&&s(this,Ne,Op).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2504
2521
|
<div class="bar" part="bar">
|
|
2505
2522
|
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,vr)}-h">${this.heading}</div>
|
|
2506
2523
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2507
2524
|
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,vr)}-rows"
|
|
2508
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,Ne,
|
|
2525
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,Ne,lf)}>
|
|
2509
2526
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2510
2527
|
</div>
|
|
2511
2528
|
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,vr)}-rows" role="list" aria-labelledby="${r(this,vr)}-h" ?hidden=${!t}
|
|
2512
|
-
@dragover=${s(this,Ne,
|
|
2529
|
+
@dragover=${s(this,Ne,cf)} @drop=${s(this,Ne,df)}>
|
|
2513
2530
|
<slot @slotchange=${()=>{s(this,Ne,Op).call(this),this._empty=!this.items.length}}></slot>
|
|
2514
2531
|
</div>
|
|
2515
2532
|
<span class="sr" role="status">${this._msg}</span>
|
|
2516
|
-
`}};vr=new WeakMap,Ne=new WeakSet,
|
|
2533
|
+
`}};vr=new WeakMap,Ne=new WeakSet,lf=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},Op=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},qp=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},cf=function(e){let t=ks.dragged;s(this,Ne,qp).call(this,t)&&(e.preventDefault(),Wo(t,{list:this,index:bh(this.items,t,e.clientY)}))},df=function(e){let t=ks.dragged;if(!s(this,Ne,qp).call(this,t))return;e.preventDefault();let i=bh(this.items,t,e.clientY);Wo(t,null),t.moveToList(this,i)},$s.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"},sortable:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},group:{reflect:!0},_msg:{state:!0},_empty:{state:!0}},$s.styles=[k,x`
|
|
2517
2534
|
:host { display: block; }
|
|
2518
2535
|
.bar {
|
|
2519
2536
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2537,7 +2554,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2537
2554
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2538
2555
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2539
2556
|
}
|
|
2540
|
-
`];$("cm-nested-list",$s);var
|
|
2557
|
+
`];$("cm-nested-list",$s);var hf=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},mf=Gr(class extends ti{constructor(o){if(super(o),o.type!==ot.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,n,e){let t;e===void 0?e=n:n!==void 0&&(t=n);let i=[],a=[],l=0;for(let d of o)i[l]=t?t(d,l):l,a[l]=e(d,l),l++;return{values:a,keys:i}}render(o,n,e){return this.dt(o,n,e).values}update(o,[n,e,t]){let i=mg(o),{values:a,keys:l}=this.dt(n,e,t);if(!Array.isArray(i))return this.ut=l,a;let d=this.ut??=[],m=[],u,v,b=0,w=i.length-1,y=0,M=a.length-1;for(;b<=w&&y<=M;)if(i[b]===null)b++;else if(i[w]===null)w--;else if(d[b]===l[y])m[y]=ii(i[b],a[y]),b++,y++;else if(d[w]===l[M])m[M]=ii(i[w],a[M]),w--,M--;else if(d[b]===l[M])m[M]=ii(i[b],a[M]),Yr(o,m[M+1],i[b]),b++,M--;else if(d[w]===l[y])m[y]=ii(i[w],a[y]),Yr(o,i[b],i[w]),w--,y++;else if(u===void 0&&(u=hf(l,y,M),v=hf(d,b,w)),u.has(d[b]))if(u.has(d[w])){let D=v.get(l[y]),H=D!==void 0?i[D]:null;if(H===null){let q=Yr(o,i[b]);ii(q,a[y]),m[y]=q}else m[y]=ii(H,a[y]),Yr(o,i[b],H),i[D]=null;y++}else zc(i[w]),w--;else zc(i[b]),b++;for(;y<=M;){let D=Yr(o,m[M+1]);ii(D,a[y]),m[y++]=D}for(;b<=w;){let D=i[b++];D!==null&&zc(D)}return this.ut=l,Tc(o,m),we}});function pf(o,n,e){let t=l=>e.slotCount(l),i=l=>Math.max(0,t(l)-1),a=l=>{for(let d=n.group+l;d>=0&&d<e.groupCount();d+=l)if(t(d)>0)return{group:d,index:Math.min(n.index,i(d))};return{...n}};switch(o){case"ArrowRight":return a(1);case"ArrowLeft":return a(-1);case"ArrowDown":return{group:n.group,index:Math.min(n.index+1,i(n.group))};case"ArrowUp":return{group:n.group,index:Math.max(n.index-1,0)};case"Home":return{group:n.group,index:0};case"End":return{group:n.group,index:i(n.group)};default:return null}}var le,Ue,Ve,xr=class{constructor(n){p(this,le);p(this,Ue,null);p(this,Ve,null);g(this,le,n)}get active(){return r(this,Ue)!==null}get from(){return r(this,Ue)&&{...r(this,Ue)}}get target(){return r(this,Ve)&&{...r(this,Ve)}}groupCount(){return r(this,le).groupCount()}slotCount(n){return n>=0&&n<r(this,le).groupCount()?r(this,le).slotCount(n):0}pickUp(n){this.active&&this.cancel(),g(this,Ue,{...n}),g(this,Ve,{...n}),r(this,le).onTarget?.(this.target),r(this,le).announce(r(this,le).messages.pickedUp(this.target))}moveTo(n){if(!r(this,Ve))return;let e=Math.max(0,Math.min(n.group,r(this,le).groupCount()-1)),t=this.slotCount(e);t<=0||(g(this,Ve,{group:e,index:Math.max(0,Math.min(n.index,t-1))}),r(this,le).onTarget?.(this.target),r(this,le).announce(r(this,le).messages.over(this.target)))}drop(){if(!r(this,Ue)||!r(this,Ve))return;let n=r(this,Ue),e=r(this,Ve);g(this,Ue,g(this,Ve,null)),r(this,le).onTarget?.(null),r(this,le).onDrop(n,e)}cancel(n=!1){if(!r(this,Ue))return;let e=r(this,Ue),t=n?"":r(this,le).messages.cancelled(e);g(this,Ue,g(this,Ve,null)),r(this,le).onTarget?.(null),r(this,le).onCancel?.(e),t&&r(this,le).announce(t)}handleKey(n,e=n.key){if(!this.active||n.altKey||n.ctrlKey||n.metaKey)return!1;if(e===" "||e==="Enter")return this.drop(),!0;if(e==="Escape")return this.cancel(),!0;if(e==="Tab")return this.cancel(),!1;let t=(r(this,le).navigate??pf)(e,r(this,Ve),this);return t?(this.moveTo(t),!0):!1}};le=new WeakMap,Ue=new WeakMap,Ve=new WeakMap;var Go,yr,wr=class{constructor(n=document,e="assertive"){p(this,Go);p(this,yr);let t=n.createElement("div");t.setAttribute("aria-live",e),t.setAttribute("aria-atomic","true"),t.className="cm-announcer",Object.assign(t.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:"0"}),this.element=t}get text(){return r(this,yr)??this.element.textContent??""}announce(n){clearTimeout(r(this,Go)),this.element.textContent===n?(this.element.textContent="",g(this,yr,n),g(this,Go,setTimeout(()=>{this.element.textContent=n,g(this,yr,void 0)},50))):(g(this,yr,void 0),this.element.textContent=n)}};Go=new WeakMap,yr=new WeakMap;var zk=z("boardCard",{roleDescription:"movable card",instructions:"Press Space to pick up. Then use the arrow keys to choose a column and a position, Space or Enter to drop, and Escape to cancel.",openHint:"Press Enter to open.",saving:"Saving"}),_k=z("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),Ck=z("board",{label:"Board",pickedUp:"Picked up {card}. Column {column}, position {position} of {count}.",over:"Column {column}, position {position} of {count}.",moved:"Moved {card} to {column}, position {position} of {count}.",sameSpot:"{card} dropped where it started.",cancelled:"Move cancelled. {card} is back in {column}.",refused:"{card} can't be moved to {column}.",reverted:"Couldn't move {card}. It is back in {column}."}),zy="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",Yo,wh,uf,$r=class extends T{constructor(){super(...arguments);p(this,wh);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";p(this,Yo,A("cm-bc"))}get name(){let e=i=>(i??"").replace(/\s+/g," ").trim();if(this.label)return this.label;if(this.heading)return this.heading;let t=this.querySelector(':scope > [slot="heading"]');return t?e(t.textContent):e(this.textContent).slice(0,80)}get key(){return this.value||this.name}get opener(){if(this.href)return this.renderRoot?.querySelector(".title a")??null;let e=this.querySelector(':scope > [slot="heading"]');return e?e.matches("a[href], button, cm-button")?e:e.querySelector("a[href], button, cm-button"):null}focusHandle(e){let t=this.renderRoot?.querySelector(".handle");t?t.focus(e):this.focus(e)}open(){let e=this.opener;return e?(e.click(),!0):!1}render(){let e=!!(this.href||this.querySelector(':scope > [slot="heading"] a[href], :scope > [slot="heading"] button, :scope > a[slot="heading"][href], :scope > button[slot="heading"]')),t=this.pending;return c`<div class="card" part="card">
|
|
2541
2558
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2542
2559
|
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,Yo)}-help"></div>`}
|
|
2543
2560
|
<div class="content">
|
|
@@ -2547,11 +2564,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2547
2564
|
<slot name="actions"></slot>
|
|
2548
2565
|
</div>
|
|
2549
2566
|
<div class="lines"><slot></slot></div>
|
|
2550
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,wh,
|
|
2567
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,wh,uf).call(this,i,"_badges")}></slot></div>
|
|
2551
2568
|
</div>
|
|
2552
2569
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2553
2570
|
<span id="${r(this,Yo)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2554
|
-
</div>`}};Yo=new WeakMap,wh=new WeakSet,
|
|
2571
|
+
</div>`}};Yo=new WeakMap,wh=new WeakSet,uf=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},$r.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},$r.properties={value:{reflect:!0},label:{},heading:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0},_badges:{state:!0},_slottedTitle:{state:!0}},$r.styles=[k,x`
|
|
2555
2572
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2556
2573
|
.card {
|
|
2557
2574
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2576,7 +2593,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2576
2593
|
:host([moving]) .content { opacity: 0.5; }
|
|
2577
2594
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2578
2595
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2579
|
-
`];$("cm-board-card",$r);var Ts,Xo,zs,_s,Ci,vh,
|
|
2596
|
+
`];$("cm-board-card",$r);var Ts,Xo,zs,_s,Ci,vh,gf,kr=class extends T{constructor(){super(...arguments);p(this,Ci);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;p(this,Ts,!1);this._cards=[];this._drop=null;p(this,Xo,new MutationObserver(()=>s(this,Ci,vh).call(this)));p(this,zs,A("cm-col"));p(this,_s,!1)}get collapsed(){return r(this,Ts)}connectedCallback(){super.connectedCallback(),s(this,Ci,vh).call(this),r(this,Xo).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Xo).disconnect()}get cards(){return[...this.children].filter(e=>e.localName==="cm-board-card"&&!e.hasAttribute("slot"))}get key(){return this.value||this.heading}get count(){return typeof this.total=="number"&&!Number.isNaN(this.total)?this.total:this._cards.length}get scrollElement(){return this.renderRoot?.querySelector(".scroll")??null}_sync(){return s(this,Ci,vh).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");g(this,Ts,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",r(this,Ts)),g(this,_s,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach(i=>{let a=this._cards[Number(i.dataset.i)];a?i.assign(a):i.assign()});let t=i=>[...this.children].filter(a=>a.getAttribute("slot")===i);this.renderRoot.querySelector("slot.actions")?.assign(...t("actions")),this.renderRoot.querySelector("slot.empty")?.assign(...t("empty")),r(this,_s)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,_s,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,i=this.count,a=t?e.filter(y=>y!==t.card):e,l=t?e.indexOf(t.card):-1,d=!!t&&!this.collapsed&&!(l>=0&&t.index===l),m=[];e.forEach((y,M)=>{d&&y!==t.card&&a.indexOf(y)===t.index&&m.push({key:"drop"}),m.push({key:y,card:y,i:M})}),d&&t.index>=a.length&&m.push({key:"drop"});let u=this.hasMore||i>e.length,v=this.loading,b=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),w=this.t("count",{count:i});return c`<section aria-labelledby="${r(this,zs)}-h" class=${t&&this.collapsed?"over":""}>
|
|
2580
2597
|
<header part="header">
|
|
2581
2598
|
<div class="title" id="${r(this,zs)}-h" role="heading" aria-level=${b}>${this.heading}<span class="sr">, ${w}</span></div>
|
|
2582
2599
|
<span class="count" part="count" aria-hidden="true">${this.formatNumber(i)}</span>
|
|
@@ -2584,14 +2601,14 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2584
2601
|
</header>
|
|
2585
2602
|
<div class="scroll">
|
|
2586
2603
|
<ul part="list" role="list" aria-labelledby="${r(this,zs)}-h" aria-busy=${v?"true":"false"} tabindex="-1" ?hidden=${this.collapsed}>
|
|
2587
|
-
${
|
|
2604
|
+
${mf(m,y=>y.key,y=>y.card?c`<li><slot data-i=${y.i}></slot></li>`:c`<li class="drop" aria-hidden="true"><div style="min-height:${Math.max(40,t.height)}px">${t.card.name}</div></li>`)}
|
|
2588
2605
|
</ul>
|
|
2589
2606
|
${v&&!e.length&&!this.collapsed?c`<div class="loading" aria-hidden="true"><cm-skeleton variant="block"></cm-skeleton><cm-skeleton variant="block"></cm-skeleton></div>`:h}
|
|
2590
2607
|
<div class="empty" ?hidden=${e.length>0||v||u||this.collapsed||d}><slot class="empty">${this.t("empty")}</slot></div>
|
|
2591
|
-
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,Ci,
|
|
2608
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,Ci,gf)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
2592
2609
|
</div>
|
|
2593
2610
|
<span class="sr" role="status">${v?this.t("loading",{column:this.heading}):""}</span>
|
|
2594
|
-
</section>`}};Ts=new WeakMap,Xo=new WeakMap,zs=new WeakMap,_s=new WeakMap,Ci=new WeakSet,vh=function(){this._cards=this.cards},
|
|
2611
|
+
</section>`}};Ts=new WeakMap,Xo=new WeakMap,zs=new WeakMap,_s=new WeakMap,Ci=new WeakSet,vh=function(){this._cards=this.cards},gf=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},kr.shadowRootOptions={...S.shadowRootOptions,slotAssignment:"manual"},kr.properties={value:{reflect:!0},heading:{},total:{type:Number},hasMore:{type:Boolean,attribute:"has-more",reflect:!0},loading:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"},_cards:{state:!0},_drop:{state:!0}},kr.styles=[k,x`
|
|
2595
2612
|
:host {
|
|
2596
2613
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
2597
2614
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -2607,7 +2624,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2607
2624
|
flex: none; min-width: 24px; padding: 0 8px; font-size: 12px; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
|
|
2608
2625
|
background: var(--cm-bg-surface); color: var(--cm-text-default); border-radius: var(--cm-radius-full);
|
|
2609
2626
|
}
|
|
2610
|
-
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--cm-space-8) var(--cm-space-8); }
|
|
2627
|
+
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; /* x left to chain: a sideways swipe over cards scrolls the board (1.8.1) */ padding: 0 var(--cm-space-8) var(--cm-space-8); }
|
|
2611
2628
|
ul { display: flex; flex-direction: column; gap: var(--cm-space-8); margin: 0; padding: 0; list-style: none; }
|
|
2612
2629
|
ul:focus { outline: none; }
|
|
2613
2630
|
li { display: block; min-width: 0; }
|
|
@@ -2628,9 +2645,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2628
2645
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
2629
2646
|
:host([collapsed]) .actions { display: none; }
|
|
2630
2647
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
2631
|
-
`];$("cm-board-column",kr);var Ce,ke,de,Er,te,R,Bp,Es,
|
|
2648
|
+
`];$("cm-board-column",kr);var Ce,ke,de,Er,te,R,Bp,Es,bf,Fp,ff,vf,yf,xf,Jo,wf,Zo,jp,Up,Vp,yh,$f,Qo,el,tl,il,rl,al,sl,Kp,Wp,xh,kf,_i,Ms=class extends T{constructor(){super();p(this,R);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;p(this,Ce,new wr);p(this,ke);p(this,de,null);p(this,Er,new WeakMap);p(this,te,null);p(this,Jo,e=>{if(r(this,te)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,ke).active){r(this,ke).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let i=s(this,R,xf).call(this,e.composedPath());if(!(!i||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===" ")e.preventDefault(),this.pickUp(i);else if(e.key==="Enter")i.open()&&e.preventDefault();else if(t.startsWith("Arrow")){let a=s(this,R,wf).call(this,i,t);a&&(e.preventDefault(),a.focusHandle())}}});p(this,Zo,e=>{if(!r(this,ke).active||!r(this,de))return;let t=e.relatedTarget;t&&(t===r(this,de).card||r(this,de).card.contains(t))||!t&&document.hasFocus()===!1||queueMicrotask(()=>{r(this,ke).active&&r(this,de)&&!r(this,de).card.matches(":focus-within")&&r(this,ke).cancel()})});p(this,Qo,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});p(this,el,e=>{if(r(this,te)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath(),i=t.find(d=>d.localName==="cm-board-card");if(!i||i.locked||i.pending||t.some(d=>d instanceof Element&&d!==i&&d.matches?.(zy)))return;let a=s(this,R,Es).call(this,i);if(!a)return;r(this,ke).active&&r(this,ke).cancel();let l=i.getBoundingClientRect();g(this,te,{card:i,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,dx:e.clientX-l.left,dy:e.clientY-l.top,width:l.width,height:l.height,from:a.column,fromIndex:a.index}),e.pointerType!=="mouse"&&(r(this,te).timer=setTimeout(()=>{r(this,te)&&!r(this,te).started&&s(this,R,Kp).call(this)},300)),window.addEventListener("pointermove",r(this,rl),!0),window.addEventListener("pointerup",r(this,al),!0),window.addEventListener("pointercancel",r(this,sl),!0),window.addEventListener("touchmove",r(this,tl),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,il),!0)});p(this,tl,e=>{r(this,te)?.started&&e.cancelable&&e.preventDefault()});p(this,il,e=>{r(this,te)&&e.preventDefault()});p(this,rl,e=>{let t=r(this,te);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,R,Kp).call(this):s(this,R,_i).call(this,!1));return}e.preventDefault(),s(this,R,Wp).call(this),s(this,R,xh).call(this)}});p(this,al,e=>{let t=r(this,te);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,R,_i).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,R,_i).call(this,!0)});p(this,sl,e=>{r(this,te)&&e.pointerId===r(this,te).pointerId&&s(this,R,_i).call(this,!1)});g(this,ke,new xr({groupCount:()=>this.columns.length,slotCount:e=>{let t=this.columns[e];return!t||!r(this,de)?0:t.cards.filter(i=>i!==r(this,de).card).length+1},onTarget:e=>s(this,R,ff).call(this,e),onDrop:(e,t)=>s(this,R,yf).call(this,e,t),onCancel:()=>s(this,R,Fp).call(this),messages:{pickedUp:e=>s(this,R,Bp).call(this,"pickedUp",e),over:e=>s(this,R,Bp).call(this,"over",e),cancelled:e=>this.t("cancelled",{card:r(this,de)?.card.name??"",column:this.columns[e.group]?.heading??""})},announce:e=>r(this,Ce).announce(e)}))}get columns(){return[...this.children].filter(e=>e.localName==="cm-board-column")}column(e){return this.columns.find(t=>t.key===e)}card(e){for(let t of this.columns){let i=t.cards.find(a=>a.key===e);if(i)return i}}get heldCard(){return r(this,de)?.card??null}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,Jo)),this.addEventListener("focusout",r(this,Zo)),this.addEventListener("pointerdown",r(this,el)),this.addEventListener("dragstart",r(this,Qo))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,Jo)),this.removeEventListener("focusout",r(this,Zo)),this.removeEventListener("pointerdown",r(this,el)),this.removeEventListener("dragstart",r(this,Qo)),r(this,ke).cancel(!0),s(this,R,_i).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(r(this,Ce).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return r(this,Ce).text}announce(e){r(this,Ce).announce(e)}pickUp(e){let t=typeof e=="string"?this.card(e):e;if(!t||t.locked||t.pending)return!1;let i=s(this,R,Es).call(this,t);return i?(s(this,R,_i).call(this,!1),r(this,ke).cancel(!0),g(this,de,{card:t,column:i.column,index:i.index}),t.moving=!0,s(this,R,bf).call(this,t),r(this,ke).pickUp({group:i.group,index:i.index}),!0):!1}cancelMove(){let e=r(this,te);e?.started&&(s(this,R,_i).call(this,!1),r(this,Ce).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),r(this,ke).cancel()}moveCard(e,t,i){let a=typeof e=="string"?this.card(e):e,l=typeof t=="string"?this.column(t):t;if(!a||!l)return!1;let d=s(this,R,Es).call(this,a);if(!d)return!1;let m=l.cards.filter(v=>v!==a).length,u=Math.max(0,Math.min(i??m,m));return s(this,R,yh).call(this,a,d.column,d.index,l,u,"api")}revert(e){let t=typeof e=="string"?this.card(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Er).get(t);if(this.controlled||!i||(r(this,Er).delete(t),!i.from.isConnected||!this.contains(i.from)))return!1;let a=t.matches(":focus-within");return s(this,R,Up).call(this,t,i.from,i.fromIndex),i.totals&&s(this,R,Vp).call(this,i.to,i.from),s(this,R,jp).call(this,i.to,i.from,a?t:null),r(this,Ce).announce(this.t("reverted",{card:t.name,column:i.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
2632
2649
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
2633
|
-
</div>`}};Ce=new WeakMap,ke=new WeakMap,de=new WeakMap,Er=new WeakMap,te=new WeakMap,R=new WeakSet,Bp=function(e,t){let i=this.columns[t.group];return this.t(e,{card:r(this,de)?.card.name??"",column:i?.heading??"",position:t.index+1,count:r(this,ke).slotCount(t.group)})},Es=function(e){let t=this.columns,i=t.findIndex(a=>a.contains(e)&&e.parentElement===a);return i<0?null:{column:t[i],group:i,index:t[i].cards.indexOf(e)}},
|
|
2650
|
+
</div>`}};Ce=new WeakMap,ke=new WeakMap,de=new WeakMap,Er=new WeakMap,te=new WeakMap,R=new WeakSet,Bp=function(e,t){let i=this.columns[t.group];return this.t(e,{card:r(this,de)?.card.name??"",column:i?.heading??"",position:t.index+1,count:r(this,ke).slotCount(t.group)})},Es=function(e){let t=this.columns,i=t.findIndex(a=>a.contains(e)&&e.parentElement===a);return i<0?null:{column:t[i],group:i,index:t[i].cards.indexOf(e)}},bf=function(e){let t=()=>!!e.shadowRoot?.activeElement?.classList.contains("handle");e.focusHandle({preventScroll:!0}),requestAnimationFrame(()=>{r(this,de)?.card===e&&!t()&&e.focusHandle({preventScroll:!0})})},Fp=function(){r(this,de)&&(r(this,de).card.moving=!1),g(this,de,null)},ff=function(e){let t=r(this,de);if(this.columns.forEach((i,a)=>{i._drop=t&&e&&a===e.group?{card:t.card,index:e.index,height:t.card.getBoundingClientRect().height}:null}),e){let i=this.columns[e.group];i?.updateComplete.then(()=>{let a=i.renderRoot.querySelector("li.drop")??(t&&t.column===i?t.card:i);s(this,R,vf).call(this,i,a)})}},vf=function(e,t){let i=this.renderRoot.querySelector(".columns");if(i){let l=i.getBoundingClientRect(),d=e.getBoundingClientRect();d.left<l.left?i.scrollLeft-=l.left-d.left+8:d.right>l.right&&(i.scrollLeft+=d.right-l.right+8)}let a=e.scrollElement;if(a){let l=a.getBoundingClientRect(),d=t.getBoundingClientRect();d.top<l.top?a.scrollTop-=l.top-d.top+8:d.bottom>l.bottom&&(a.scrollTop+=d.bottom-l.bottom+8)}},yf=function(e,t){let i=r(this,de);if(s(this,R,Fp).call(this),!i)return;let a=this.columns[t.group];s(this,R,yh).call(this,i.card,i.column,e.index,a,t.index,"keyboard")},xf=function(e){let t=e[0];if(!(t instanceof HTMLElement)||!t.classList?.contains("handle"))return null;let i=e.find(a=>a.localName==="cm-board-card");return i&&s(this,R,Es).call(this,i)?i:null},Jo=new WeakMap,wf=function(e,t){let i=s(this,R,Es).call(this,e);if(!i)return null;let a=i.column.cards;if(t==="ArrowDown")return a[i.index+1]??null;if(t==="ArrowUp")return a[i.index-1]??null;let l=t==="ArrowRight"?1:-1,d=this.columns;for(let m=i.group+l;m>=0&&m<d.length;m+=l){let u=d[m].cards;if(u.length)return u[Math.min(i.index,u.length-1)]}return null},Zo=new WeakMap,jp=function(e,t,i){e._sync(),t._sync().then(()=>{i?.isConnected&&i.focusHandle({preventScroll:!0})})},Up=function(e,t,i){let a=t.cards.filter(d=>d!==e),l=a[i];l?l.before(e):a.length?a[a.length-1].after(e):t.append(e)},Vp=function(e,t){e!==t&&(typeof e.total=="number"&&(e.total=Math.max(0,e.total-1)),typeof t.total=="number"&&(t.total=t.total+1))},yh=function(e,t,i,a,l,d){let m=e.name;if(t===a&&i===l)return d!=="api"&&r(this,Ce).announce(this.t("sameSpot",{card:m})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let u=[],v={value:e.key,card:e,from:t.key,to:a.key,fromColumn:t,toColumn:a,fromIndex:i,toIndex:l,source:d,waitUntil:y=>{u.push(Promise.resolve(y))}};if(!this.dispatchEvent(new CustomEvent("cm-move",{detail:v,bubbles:!0,composed:!0,cancelable:!0})))return r(this,Ce).announce(this.t("refused",{card:m,column:a.heading})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let w=a.cards.filter(y=>y!==e).length+1;if(this.controlled)d==="keyboard"&&s(this,R,$f).call(this,e.key,a);else{let y=d==="keyboard"||e.matches(":focus-within");s(this,R,Up).call(this,e,a,l);let M=t!==a;M&&s(this,R,Vp).call(this,t,a),r(this,Er).set(e,{card:e,from:t,fromIndex:i,to:a,toIndex:l,totals:M}),s(this,R,jp).call(this,t,a,y?e:null)}return r(this,Ce).announce(this.t("moved",{card:m,column:a.heading,position:l+1,count:w})),u.length&&(e.pending=!0,Promise.all(u).then(()=>{e.pending=!1,this.controlled||r(this,Er).delete(e)},()=>{e.pending=!1,this.controlled?r(this,Ce).announce(this.t("reverted",{card:m,column:t.heading})):this.revert(e)})),!0},$f=function(e,t){let i=()=>t.isConnected?t.cards.find(d=>d.key===e):void 0,a=()=>{let d=i(),m=!document.activeElement||document.activeElement===document.body||!document.activeElement.isConnected;return!d||!(m||this.contains(document.activeElement))?!1:(t._sync().then(()=>d.updateComplete).then(()=>{d.isConnected&&d.focusHandle({preventScroll:!0})}),!0)},l=new MutationObserver(()=>{a()&&l.disconnect()});l.observe(this,{childList:!0,subtree:!0}),setTimeout(()=>l.disconnect(),1e3)},Qo=new WeakMap,el=new WeakMap,tl=new WeakMap,il=new WeakMap,rl=new WeakMap,al=new WeakMap,sl=new WeakMap,Kp=function(){let e=r(this,te);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges();let t=e.card.cloneNode(!0);t.removeAttribute("id"),t.removeAttribute("moving"),t.setAttribute("ghost",""),t.setAttribute("aria-hidden","true"),t.setAttribute("inert",""),Object.assign(t.style,{position:"fixed",zIndex:"2147483000",left:"0",top:"0",width:`${e.width}px`,margin:"0",pointerEvents:"none",willChange:"transform"}),(this.ownerDocument.body??this.ownerDocument.documentElement).appendChild(t),e.ghost=t,e.card.moving=!0,this.dragging=!0,e.to=e.from,e.toIndex=e.fromIndex,r(this,Ce).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),s(this,R,Wp).call(this),s(this,R,xh).call(this);let i=()=>{r(this,te)?.started&&(s(this,R,kf).call(this),r(this,te).raf=requestAnimationFrame(i))};e.raf=requestAnimationFrame(i)},Wp=function(){let e=r(this,te);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},xh=function(){let e=r(this,te);if(!e)return;let t=this.columns;if(!t.length)return;let i=t[0],a=1/0;for(let u of t){let v=u.getBoundingClientRect(),b=e.x<v.left?v.left-e.x:e.x>v.right?e.x-v.right:0;b<a&&(i=u,a=b)}let l=i.cards.filter(u=>u!==e.card),d=l.length;if(i.collapsed)d=0;else for(let u=0;u<l.length;u++){let v=l[u].getBoundingClientRect();if(e.y<v.top+v.height/2){d=u;break}}if(i===e.to&&d===e.toIndex)return;let m=i!==e.to;e.to=i,e.toIndex=d,t.forEach(u=>{u._drop=u===i?{card:e.card,index:d,height:e.height}:null}),m&&r(this,Ce).announce(this.t("over",{column:i.heading,position:d+1,count:l.length+1}))},kf=function(){let e=r(this,te);if(!e)return;let t=48,i=16,a=w=>w<t?Math.ceil((t-Math.max(w,0))/t*i):0,l=!1,d=this.renderRoot.querySelector(".columns");if(d){let w=d.getBoundingClientRect(),y=a(e.x-w.left),M=a(w.right-e.x),D=d.scrollLeft;y?d.scrollLeft-=y:M&&(d.scrollLeft+=M),l||=d.scrollLeft!==D}let m=e.to?.scrollElement;if(m&&m.scrollHeight>m.clientHeight){let w=m.getBoundingClientRect();if(e.x>=w.left&&e.x<=w.right){let y=a(e.y-w.top),M=a(w.bottom-e.y),D=m.scrollTop;y?m.scrollTop-=y:M&&(m.scrollTop+=M),l||=m.scrollTop!==D}}let u=window.innerHeight,v=a(e.y),b=a(u-e.y);if(v||b){let w=window.scrollY;window.scrollBy(0,v?-v:b),l||=window.scrollY!==w}l&&s(this,R,xh).call(this)},_i=function(e){let t=r(this,te);t&&(g(this,te,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,rl),!0),window.removeEventListener("pointerup",r(this,al),!0),window.removeEventListener("pointercancel",r(this,sl),!0),window.removeEventListener("touchmove",r(this,tl),!0),window.removeEventListener("contextmenu",r(this,il),!0),t.ghost?.remove(),t.started&&(t.card.moving=!1,this.dragging=!1,this.columns.forEach(i=>{i._drop=null}),e&&t.to&&t.toIndex!==void 0&&s(this,R,yh).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},Ms.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},Ms.styles=[k,x`
|
|
2634
2651
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
2635
2652
|
.board { height: 100%; }
|
|
2636
2653
|
.columns {
|
|
@@ -2644,51 +2661,51 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2644
2661
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
2645
2662
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
2646
2663
|
}
|
|
2647
|
-
`];$("cm-board",Ms);var Xk=z("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),Ls=class extends S{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};Ls.properties={value:{reflect:!0},heading:{},label:{},start:{},end:{},allDay:{type:Boolean,attribute:"all-day",reflect:!0},kind:{},tone:{reflect:!0},icon:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0}},Ls.styles=x`:host { display: none !important; }`;$("cm-calendar-event",Ls);var _h=o=>String(o).padStart(2,"0"),kf=o=>`${P(o)}T${_h(o.getHours())}:${_h(o.getMinutes())}`,$h=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Ef=["month","week","day"],zy=600,Mf=new Map,Tf=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Mf.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Mf.set(e,t)),t},Gp=o=>o.replace(/[ ]/g," ").trim(),As,Se,Le,xe,Z,Q,Tr,Et,We,ul,Di,Rs,Hs,Ns,Is,gl,f,Ee,Si,nl,kh,kt,Yp,ol,mt,Xp,zf,pt,Cs,_f,Cf,Ke,ll,cl,Eh,Sf,Lf,Df,Mr,Jp,dl,Af,hl,Rf,Hf,Nf,If,bl,fl,Pf,Of,vl,ml,qf,Zp,Qp,eu,Bf,Ff,tu,iu,ru,yl,au,jf,xl,wl,$l,kl,El,Ml,su,Mh,Uf,Li,pl,Vf,nu,Kf,Th,ou,Ss,zh,Wf,Gf,Yf,Xf,Jf,Ds=class extends T{constructor(){super();p(this,f);this.view="month";this.date="";this.today="";this.step=15;p(this,As,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;p(this,Se,A("cm-cal"));p(this,Le,new wr);p(this,xe);p(this,Z,null);p(this,Q,null);p(this,Tr,new WeakMap);p(this,Et,"");p(this,We,null);p(this,ul,"");p(this,Di,!0);p(this,Rs,0);p(this,Hs,!1);p(this,Ns);p(this,Is,0);p(this,gl,new MutationObserver(()=>this.requestUpdate()));p(this,bl,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Et,t.dataset.k);for(let i of s(this,f,hl).call(this))i.tabIndex=i===t?0:-1}});p(this,fl,e=>{let t=e.relatedTarget;if(this._more&&!r(this,Z)){let i=this.renderRoot.querySelector(".pop"),a=e.composedPath()[0];i&&i.contains(a)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,xe).active||!r(this,Z)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,xe).active||!r(this,Z))return;this.renderRoot.activeElement?.dataset.ev!==r(this,Z).ev.key&&r(this,xe).cancel()}))});p(this,vl,e=>{if(r(this,Q)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,xe).active){r(this,xe).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let a=i.closest(".pop");if(a&&e.key==="Escape"){e.preventDefault(),s(this,f,Th).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,Rs,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(a&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...a.querySelectorAll(".chip")],m=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];m&&(e.preventDefault(),m.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),s(this,f,Of).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,f,Pf).call(this,i,t);l?(e.preventDefault(),s(this,f,If).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,yl,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,xl,e=>{if(r(this,Q)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(m=>m.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),a=i&&s(this,f,Cs).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,f,Qp).call(this,a,t.dataset.day??a.days[0]);if(!l)return;r(this,xe).active&&r(this,xe).cancel();let d=0;if(l.mode==="time"){let m=s(this,f,au).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}g(this,Q,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,Q).timer=setTimeout(()=>{r(this,Q)&&!r(this,Q).started&&s(this,f,su).call(this)},300)),window.addEventListener("pointermove",r(this,kl),!0),window.addEventListener("pointerup",r(this,El),!0),window.addEventListener("pointercancel",r(this,Ml),!0),window.addEventListener("touchmove",r(this,wl),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,$l),!0)});p(this,wl,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});p(this,$l,e=>{r(this,Q)&&e.preventDefault()});p(this,kl,e=>{let t=r(this,Q);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,f,su).call(this):s(this,f,Li).call(this,!1));return}e.preventDefault(),s(this,f,Mh).call(this)}});p(this,El,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,f,Li).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,f,Li).call(this,!0)});p(this,Ml,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,f,Li).call(this,!1)});g(this,xe,new xr({groupCount:()=>s(this,f,pt).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,f,ml).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,f,qf).call(this,e,t),onTarget:e=>s(this,f,Bf).call(this,e),onDrop:(e,t)=>s(this,f,Ff).call(this,e,t),onCancel:()=>s(this,f,eu).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,f,Mr).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,f,Mr).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,f,Mr).call(this,r(this,Z),e)})},announce:e=>r(this,Le).announce(e)}))}get locale(){return r(this,As)}set locale(e){let t=r(this,As);g(this,As,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=s(this,f,pt).call(this);return{view:r(this,f,Ee),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,Z)?.ev.el??null}get announcement(){return r(this,Le).text}announce(e){r(this,Le).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,vl)),this.addEventListener("focusin",r(this,bl)),this.addEventListener("focusout",r(this,fl)),this.addEventListener("pointerdown",r(this,xl)),this.addEventListener("dragstart",r(this,yl)),r(this,gl).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,Ns,new ResizeObserver(()=>{cancelAnimationFrame(r(this,Is)),g(this,Is,requestAnimationFrame(()=>s(this,f,Jp).call(this)))})),r(this,Ns).observe(this)),s(this,f,Jp).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,vl)),this.removeEventListener("focusin",r(this,bl)),this.removeEventListener("focusout",r(this,fl)),this.removeEventListener("pointerdown",r(this,xl)),this.removeEventListener("dragstart",r(this,yl)),r(this,gl).disconnect(),r(this,Ns)?.disconnect(),cancelAnimationFrame(r(this,Is)),r(this,xe).cancel(!0),s(this,f,Li).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,Di,!0),e.get("view")!==void 0&&(this._more="",r(this,xe).cancel(!0))),(e.has("date")||e.has("_narrow"))&&(this._more=this._more&&this.range.start<=this._more&&this._more<=this.range.end?this._more:"")}firstUpdated(){this.renderRoot.appendChild(r(this,Le).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,Di,!0),s(this,f,Nf).call(this),r(this,We)){let l=s(this,f,Rf).call(this,r(this,We).key);l?(g(this,We,null),l.focus({preventScroll:!1})):Date.now()>r(this,We).until&&g(this,We,null)}r(this,Hs)&&(g(this,Hs,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Di)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,Di,!1)}t||g(this,Di,!0),r(this,Z)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,a=`${i.view}|${i.start}|${i.end}`;a!==r(this,ul)&&(g(this,ul,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,f,dl).call(this,r(this,f,mt),-1))}next(){this.date=P(s(this,f,dl).call(this,r(this,f,mt),1))}goToToday(){this.date=r(this,f,ol)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let a=s(this,f,Cs).call(this,i);if(!a)return!1;let l=s(this,f,pt).call(this).map(P),d=t&&a.days.includes(t)&&l.includes(t)?t:a.days.find(v=>l.includes(v));if(!d)return!1;let m=s(this,f,Qp).call(this,a,d);if(!m)return!1;s(this,f,Li).call(this,!1),r(this,xe).cancel(!0),this._more="",g(this,Z,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return g(this,Et,u),g(this,We,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,xe).pickUp(m.from),!0}cancelMove(){let e=r(this,Q);e?.started&&(s(this,f,Li).call(this,!1),r(this,Le).announce(this.t("cancelled",{event:e.ev.name,place:s(this,f,Mr).call(this,e,e.from)}))),r(this,xe).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,l=a&&s(this,f,Cs).call(this,a);if(!l)return!1;let d=l.allDay?N(Qe(t).date||t):vt(t);if(!d)return!1;let m=i?l.allDay?N(Qe(i).date||i):vt(i):null;return(!m||m<d)&&(m=l.allDay?G(d,$h(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,f,ru).call(this,l,d,m,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Tr).get(t);if(this.controlled||!i)return!1;r(this,Tr).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,f,Cs).call(this,t);return l&&a&&g(this,We,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Le).announce(this.t("reverted",{event:t.name,place:l?s(this,f,Eh).call(this,l):i.start})),!0}render(){let e=s(this,f,pt).call(this),t=s(this,f,Cf).call(this,s(this,f,_f).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2648
|
-
${s(this,f,
|
|
2649
|
-
${r(this,f,Ee)==="month"?s(this,f,
|
|
2664
|
+
`];$("cm-board",Ms);var Ik=z("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),Ls=class extends S{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};Ls.properties={value:{reflect:!0},heading:{},label:{},start:{},end:{},allDay:{type:Boolean,attribute:"all-day",reflect:!0},kind:{},tone:{reflect:!0},icon:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0}},Ls.styles=x`:host { display: none !important; }`;$("cm-calendar-event",Ls);var _h=o=>String(o).padStart(2,"0"),Ef=o=>`${P(o)}T${_h(o.getHours())}:${_h(o.getMinutes())}`,$h=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Mf=["month","week","day"],_y=600,Tf=new Map,zf=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Tf.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Tf.set(e,t)),t},Gp=o=>o.replace(/[ ]/g," ").trim(),As,Se,Le,xe,Z,Q,Tr,Et,We,ul,Di,Rs,Hs,Ns,Is,gl,f,Ee,Si,nl,kh,kt,Yp,ol,mt,Xp,_f,pt,Cs,Cf,Sf,Ke,ll,cl,Eh,Lf,Df,Af,Mr,Jp,dl,Rf,hl,Hf,Nf,If,Pf,bl,fl,Of,qf,vl,ml,Bf,Zp,Qp,eu,Ff,jf,tu,iu,ru,yl,au,Uf,xl,wl,$l,kl,El,Ml,su,Mh,Vf,Li,pl,Kf,nu,Wf,Th,ou,Ss,zh,Gf,Yf,Xf,Jf,Zf,Ds=class extends T{constructor(){super();p(this,f);this.view="month";this.date="";this.today="";this.step=15;p(this,As,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;p(this,Se,A("cm-cal"));p(this,Le,new wr);p(this,xe);p(this,Z,null);p(this,Q,null);p(this,Tr,new WeakMap);p(this,Et,"");p(this,We,null);p(this,ul,"");p(this,Di,!0);p(this,Rs,0);p(this,Hs,!1);p(this,Ns);p(this,Is,0);p(this,gl,new MutationObserver(()=>this.requestUpdate()));p(this,bl,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Et,t.dataset.k);for(let i of s(this,f,hl).call(this))i.tabIndex=i===t?0:-1}});p(this,fl,e=>{let t=e.relatedTarget;if(this._more&&!r(this,Z)){let i=this.renderRoot.querySelector(".pop"),a=e.composedPath()[0];i&&i.contains(a)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,xe).active||!r(this,Z)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,xe).active||!r(this,Z))return;this.renderRoot.activeElement?.dataset.ev!==r(this,Z).ev.key&&r(this,xe).cancel()}))});p(this,vl,e=>{if(r(this,Q)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,xe).active){r(this,xe).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let a=i.closest(".pop");if(a&&e.key==="Escape"){e.preventDefault(),s(this,f,Th).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,Rs,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(a&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...a.querySelectorAll(".chip")],m=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];m&&(e.preventDefault(),m.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),s(this,f,qf).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,f,Of).call(this,i,t);l?(e.preventDefault(),s(this,f,Pf).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,yl,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,xl,e=>{if(r(this,Q)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(m=>m.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),a=i&&s(this,f,Cs).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,f,Qp).call(this,a,t.dataset.day??a.days[0]);if(!l)return;r(this,xe).active&&r(this,xe).cancel();let d=0;if(l.mode==="time"){let m=s(this,f,au).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}g(this,Q,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,Q).timer=setTimeout(()=>{r(this,Q)&&!r(this,Q).started&&s(this,f,su).call(this)},300)),window.addEventListener("pointermove",r(this,kl),!0),window.addEventListener("pointerup",r(this,El),!0),window.addEventListener("pointercancel",r(this,Ml),!0),window.addEventListener("touchmove",r(this,wl),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,$l),!0)});p(this,wl,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});p(this,$l,e=>{r(this,Q)&&e.preventDefault()});p(this,kl,e=>{let t=r(this,Q);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,f,su).call(this):s(this,f,Li).call(this,!1));return}e.preventDefault(),s(this,f,Mh).call(this)}});p(this,El,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,f,Li).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,f,Li).call(this,!0)});p(this,Ml,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,f,Li).call(this,!1)});g(this,xe,new xr({groupCount:()=>s(this,f,pt).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,f,ml).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,f,Bf).call(this,e,t),onTarget:e=>s(this,f,Ff).call(this,e),onDrop:(e,t)=>s(this,f,jf).call(this,e,t),onCancel:()=>s(this,f,eu).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,f,Mr).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,f,Mr).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,f,Mr).call(this,r(this,Z),e)})},announce:e=>r(this,Le).announce(e)}))}get locale(){return r(this,As)}set locale(e){let t=r(this,As);g(this,As,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=s(this,f,pt).call(this);return{view:r(this,f,Ee),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,Z)?.ev.el??null}get announcement(){return r(this,Le).text}announce(e){r(this,Le).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,vl)),this.addEventListener("focusin",r(this,bl)),this.addEventListener("focusout",r(this,fl)),this.addEventListener("pointerdown",r(this,xl)),this.addEventListener("dragstart",r(this,yl)),r(this,gl).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,Ns,new ResizeObserver(()=>{cancelAnimationFrame(r(this,Is)),g(this,Is,requestAnimationFrame(()=>s(this,f,Jp).call(this)))})),r(this,Ns).observe(this)),s(this,f,Jp).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,vl)),this.removeEventListener("focusin",r(this,bl)),this.removeEventListener("focusout",r(this,fl)),this.removeEventListener("pointerdown",r(this,xl)),this.removeEventListener("dragstart",r(this,yl)),r(this,gl).disconnect(),r(this,Ns)?.disconnect(),cancelAnimationFrame(r(this,Is)),r(this,xe).cancel(!0),s(this,f,Li).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,Di,!0),e.get("view")!==void 0&&(this._more="",r(this,xe).cancel(!0))),(e.has("date")||e.has("_narrow"))&&(this._more=this._more&&this.range.start<=this._more&&this._more<=this.range.end?this._more:"")}firstUpdated(){this.renderRoot.appendChild(r(this,Le).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,Di,!0),s(this,f,If).call(this),r(this,We)){let l=s(this,f,Hf).call(this,r(this,We).key);l?(g(this,We,null),l.focus({preventScroll:!1})):Date.now()>r(this,We).until&&g(this,We,null)}r(this,Hs)&&(g(this,Hs,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Di)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,Di,!1)}t||g(this,Di,!0),r(this,Z)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,a=`${i.view}|${i.start}|${i.end}`;a!==r(this,ul)&&(g(this,ul,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,f,dl).call(this,r(this,f,mt),-1))}next(){this.date=P(s(this,f,dl).call(this,r(this,f,mt),1))}goToToday(){this.date=r(this,f,ol)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let a=s(this,f,Cs).call(this,i);if(!a)return!1;let l=s(this,f,pt).call(this).map(P),d=t&&a.days.includes(t)&&l.includes(t)?t:a.days.find(v=>l.includes(v));if(!d)return!1;let m=s(this,f,Qp).call(this,a,d);if(!m)return!1;s(this,f,Li).call(this,!1),r(this,xe).cancel(!0),this._more="",g(this,Z,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return g(this,Et,u),g(this,We,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,xe).pickUp(m.from),!0}cancelMove(){let e=r(this,Q);e?.started&&(s(this,f,Li).call(this,!1),r(this,Le).announce(this.t("cancelled",{event:e.ev.name,place:s(this,f,Mr).call(this,e,e.from)}))),r(this,xe).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,l=a&&s(this,f,Cs).call(this,a);if(!l)return!1;let d=l.allDay?N(Qe(t).date||t):vt(t);if(!d)return!1;let m=i?l.allDay?N(Qe(i).date||i):vt(i):null;return(!m||m<d)&&(m=l.allDay?G(d,$h(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,f,ru).call(this,l,d,m,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Tr).get(t);if(this.controlled||!i)return!1;r(this,Tr).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,f,Cs).call(this,t);return l&&a&&g(this,We,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Le).announce(this.t("reverted",{event:t.name,place:l?s(this,f,Eh).call(this,l):i.start})),!0}render(){let e=s(this,f,pt).call(this),t=s(this,f,Sf).call(this,s(this,f,Cf).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2665
|
+
${s(this,f,Gf).call(this,e)}
|
|
2666
|
+
${r(this,f,Ee)==="month"?s(this,f,Xf).call(this,e,t):s(this,f,Zf).call(this,e,t)}
|
|
2650
2667
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
2651
2668
|
<span id="${r(this,Se)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
2652
2669
|
<span id="${r(this,Se)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
2653
2670
|
<span id="${r(this,Se)}-op" hidden>${this.t("openHint")}</span>
|
|
2654
|
-
</div>`}};As=new WeakMap,Se=new WeakMap,Le=new WeakMap,xe=new WeakMap,Z=new WeakMap,Q=new WeakMap,Tr=new WeakMap,Et=new WeakMap,We=new WeakMap,ul=new WeakMap,Di=new WeakMap,Rs=new WeakMap,Hs=new WeakMap,Ns=new WeakMap,Is=new WeakMap,gl=new WeakMap,f=new WeakSet,Ee=function(){return Ef.includes(this.view)?this.view:"month"},Si=function(){return ba(this,this.locale)},nl=function(){return va(r(this,f,Si))},kh=function(){return bd(r(this,f,Si),this.hourCycle)},kt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Yp=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,f,Si)):(Math.trunc(e)%7+7)%7},ol=function(){return N(this.today)?this.today:Lm()},mt=function(){return N(this.date)??N(r(this,f,ol))},Xp=function(){return r(this,f,Ee)==="month"&&this._narrow},zf=function(){return r(this,f,Ee)!=="month"},pt=function(){let e=r(this,f,mt),t=r(this,f,Yp);if(r(this,f,Ee)==="day")return[e];if(r(this,f,Ee)==="week"){if(this._narrow)return[e,G(e,1),G(e,2)];let d=G(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>G(d,u))}let i=Ht(e),a=G(i,-((i.getDay()-t+7)%7)),l=Math.ceil(($h(a,ua(e))+1)/7)*7;return Array.from({length:l},(d,m)=>G(a,m))},Cs=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(Qe(e.start).date||e.start);if(!u)return null;let v=N(Qe(e.end).date||e.end)??u;v<u&&(v=u);let b=Math.min($h(u,v),366);return{el:e,key:e.key,name:t,allDay:a,start:u,end:v,min:0,dur:1440,days:Array.from({length:b+1},(w,y)=>P(G(u,y)))}}let l=vt(e.start);if(!l)return null;let d=vt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let m=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:a,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:m,days:[P(l)]}},_f=function(){return this.events.map(e=>s(this,f,Cs).call(this,e)).filter(e=>!!e)},Cf=function(e){let t=new Map;for(let i of e)for(let a of i.days)(t.get(a)??t.set(a,[]).get(a)).push(i);for(let i of t.values())i.sort((a,l)=>(a.allDay===l.allDay?0:a.allDay?-1:1)||a.start.getTime()-l.start.getTime()||a.name.localeCompare(l.name));return t},Ke=function(e){return ae(e,{weekday:"long",day:"numeric",month:"long"},r(this,f,Si))},ll=function(e){return r(this,f,kh).format((e%1440+1440)%1440)},cl=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=Tf(r(this,f,Si),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(b=>b.source==="endRange"),v=-1;if(m.forEach((b,w)=>{b.source==="startRange"&&(v=w)}),v>=0&&u>v){let b=w=>Gp(w.map(y=>y.value).join(""));return this.t("timeRange",{start:b(m.slice(0,v+1)),end:b(m.slice(u))})}}}catch{}let l=P(e)===P(t),d=m=>l?s(this,f,ll).call(this,m.getHours()*60+m.getMinutes()):r(this,f,kh).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},Eh=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,f,Ke).call(this,e.start)}):this.t("allDayRange",{start:s(this,f,Ke).call(this,e.start),end:s(this,f,Ke).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&$h(e.start,e.end)===1)?s(this,f,cl).call(this,e.start,e.end):this.t("timed",{date:s(this,f,Ke).call(this,e.start),time:s(this,f,cl).call(this,e.start,e.end)})},Sf=function(e){let t={title:e.name,when:s(this,f,Eh).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Lf=function(e){let t=r(this,f,Si);if(r(this,f,Ee)==="month")return r(this,f,nl).monthYear(r(this,f,mt));if(e.length===1)return ae(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Tf(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Gp(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Df=function(e){return r(this,f,kh).hour12?Gp(ae(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,f,Si))):s(this,f,ll).call(this,e*60)},Mr=function(e,t){let{start:i,end:a}=s(this,f,Zp).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,f,Ke).call(this,i),time:s(this,f,cl).call(this,i,a)}):s(this,f,Ke).call(this,G(N(e.origin),t.group-e.from.group))},Jp=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<zy;t!==this._narrow&&(this._narrow=t)},dl=function(e,t){return r(this,f,Ee)==="month"?Ze(e,t):r(this,f,Ee)==="week"?G(e,t*(this._narrow?3:7)):G(e,t)},Af=function(e){this.view!==e&&(this.view=e)},hl=function(){return[...this.renderRoot.querySelectorAll(".item")]},Rf=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(a=>a.dataset.k===e&&a.classList.contains("item"))??t.find(a=>a.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let a=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${a}`)??null}return null},Hf=function(){let e=P(r(this,f,mt));if(r(this,f,Xp))return`day:${e}`;if(r(this,f,Ee)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},Nf=function(){let e=s(this,f,hl).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Et))??e.find(i=>i.dataset.k===s(this,f,Hf).call(this))??e.find(i=>i.dataset.day===P(r(this,f,mt)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},If=function(e){g(this,Et,e.dataset.k??"");for(let t of s(this,f,hl).call(this))t.tabIndex=t===e?0:-1;e.focus()},bl=new WeakMap,fl=new WeakMap,Pf=function(e,t){let i=new Map;for(let y of s(this,f,hl).call(this)){let M=Number(y.dataset.i);(i.get(M)??i.set(M,[]).get(M)).push(y)}let a=Number(e.dataset.i),l=i.get(a)??[e],d=Math.max(0,l.indexOf(e)),m=s(this,f,pt).call(this).length,u=r(this,f,Ee)==="month",v=e.dataset.row,b=(y,M)=>{let D=y>=0&&y<m?i.get(y):void 0;return(D?.length?M(D):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(M=>M.dataset.row===v)??y[0];switch(t){case"ArrowRight":return b(a+1,w);case"ArrowLeft":return b(a-1,w);case"ArrowDown":return l[d+1]??(u?b(a+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?b(a-7,y=>y[y.length-1]):null;case"Home":return u?b(a-a%7,y=>y[0]):b(0,w);case"End":return u?b(Math.min(m-1,a-a%7+6),y=>y[0]):b(m-1,w);default:return null}},Of=function(e,t){let i=e.dataset.day??P(r(this,f,mt)),a=s(this,f,dl).call(this,N(i)??r(this,f,mt),t),l=P(a),d=(e.dataset.k??"").split(":")[0],m;r(this,f,Xp)?m=`day:${l}`:r(this,f,Ee)==="month"?m=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?m=`adadd:${l}`:m=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,f,dl).call(this,r(this,f,mt),t)),g(this,Et,m),g(this,We,{key:m,until:Date.now()+1e3})},vl=new WeakMap,ml=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,f,kt))+1},qf=function(e,t){let i=r(this,Z);if(!i)return null;let a=s(this,f,pt).call(this).length,l=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,f,Ee)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return v?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return v?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:v?t.group-t.group%7:0,index:0};case"End":return{group:v?l(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,f,ml).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,f,kt))),u=v=>Math.max(0,Math.min(d,v));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+m)};case"PageUp":return{group:t.group,index:u(t.index-m)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Zp=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,f,pt).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,f,kt));return{start:m,end:new Date(m.getTime()+i.dur*6e4)}}let a=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+a,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},Qp=function(e,t){let a=s(this,f,pt).call(this).map(P).indexOf(t);if(a<0)return null;let l=r(this,f,zf)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,f,kt)),s(this,f,ml).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},eu=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),g(this,Z,null),this._target=null},Bf=function(e){let t=r(this,Z);if(!t||!e){this._target=null;return}let i=P(s(this,f,pt).call(this)[e.group]??N(t.origin)),a=e.group===t.from.group&&e.index===t.from.index;this._target=a?null:{iso:i,min:t.mode==="time"?e.index*r(this,f,kt):void 0}},Ff=function(e,t){let i=r(this,Z);s(this,f,eu).call(this),i&&(g(this,Rs,performance.now()+400),s(this,f,tu).call(this,i,e,t,"keyboard"))},tu=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,f,Zp).call(this,e,i),u=P(G(N(e.origin),i.group-t.group));s(this,f,ru).call(this,e.ev,d,m,a,l,e.mode==="time"?P(d):u)},iu=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:kf(t),end:kf(i)}},ru=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,f,iu).call(this,e.allDay,e.start,e.end),b=s(this,f,iu).call(this,e.allDay,t,i),w=F=>{a==="keyboard"&&g(this,We,{key:F,until:Date.now()+1e3})};if(l||v.start===b.start&&v.end===b.end)return a!=="api"&&r(this,Le).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},M=e.allDay?s(this,f,Ke).call(this,t):this.t("timed",{date:s(this,f,Ke).call(this,t),time:s(this,f,cl).call(this,t,i)}),D=[],H={value:e.key,event:m,from:v,to:b,allDay:e.allDay,source:a,waitUntil:F=>{D.push(Promise.resolve(F))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:H,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Tr).set(m,v),m.start=b.start,m.end=b.end),w(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Le).announce(this.t("moved",{event:u,place:y.allDay?s(this,f,Ke).call(this,t):M})),D.length&&(m.pending=!0,Promise.all(D).then(()=>{m.pending=!1,this.controlled||r(this,Tr).delete(m)},()=>{m.pending=!1,this.controlled?r(this,Le).announce(this.t("reverted",{event:u,place:s(this,f,Eh).call(this,e)})):this.revert(m)})),!0):(r(this,Le).announce(this.t("refused",{event:u,place:M})),this.requestUpdate(),!1)},yl=new WeakMap,au=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let a=0,l=1/0;i.forEach((m,u)=>{let v=m.getBoundingClientRect(),b=e<v.left?v.left-e:e>v.right?e-v.right:0;b<l&&(l=b,a=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},jf=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let a=null,l=1/0;for(let d of i){let m=d.getBoundingClientRect(),u=e<m.left?m.left-e:e>m.right?e-m.right:0,v=t<m.top?m.top-t:t>m.bottom?t-m.bottom:0,b=Math.hypot(u,v);b<l&&(l=b,a=d)}return a?Number(a.dataset.i):null},xl=new WeakMap,wl=new WeakMap,$l=new WeakMap,kl=new WeakMap,El=new WeakMap,Ml=new WeakMap,su=function(){let e=r(this,Q);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Le).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,f,Mr).call(this,e,e.from)})),s(this,f,Mh).call(this);let t=()=>{r(this,Q)?.started&&(s(this,f,Uf).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Mh=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,f,au).call(this,e.x,e.y);if(l){let d=s(this,f,ml).call(this,e.ev.dur)-1;t={group:l.group,index:Math.max(0,Math.min(d,Math.round((l.min-e.grab)/r(this,f,kt))))}}}else{let l=s(this,f,jf).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let a=t.group===e.from.group&&t.index===e.from.index;this._target=a?null:{iso:P(s(this,f,pt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,f,kt):void 0},i&&r(this,Le).announce(this.t("over",{place:s(this,f,Mr).call(this,e,t)}))},Uf=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let m=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-m),v=l(d.bottom-e.y),b=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==b&&s(this,f,Mh).call(this)},Li=function(e){let t=r(this,Q);t&&(g(this,Q,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,kl),!0),window.removeEventListener("pointerup",r(this,El),!0),window.removeEventListener("pointercancel",r(this,Ml),!0),window.removeEventListener("touchmove",r(this,wl),!0),window.removeEventListener("contextmenu",r(this,$l),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,f,tu).call(this,t,t.from,t.to,"pointer")))},pl=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,f,Ee)},bubbles:!0,composed:!0}))},Vf=function(e,t,i){let a=i*60;if(e.detail>0){let m=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-m.top)/m.height*60/r(this,f,kt))*r(this,f,kt);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,f,pl).call(this,`${t}T${_h(l)}:${_h(d)}`,!1)},nu=function(e,t){if(performance.now()<r(this,Rs)||r(this,xe).active){e.preventDefault();return}this.dispatchEvent(new CustomEvent("cm-open",{detail:{value:t.key,event:t.el},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault()},Kf=function(e){this._more=e,g(this,Hs,!0)},Th=function(e){let t=this._more;this._more="",e&&t&&(g(this,Et,`more:${t}`),g(this,We,{key:`more:${t}`,until:Date.now()+1e3}))},ou=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},Ss=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,f,Sf).call(this,e),b=!this.readonly&&!m.locked&&!u,w=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",y=`chip ${a} tone-${w}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,M=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,D=e.allDay?h:c`<span class="tm">${s(this,f,ll).call(this,e.min)}</span>`,H=m.kind&&(a!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,q=u?c`<span class="spin" aria-hidden="true"></span>`:h,F=a==="time"?c`<span class="lead">${M}${D}${q}</span><span class="h">${e.name}</span>${H}`:c`${M}${D}<span class="h">${e.name}</span>${H}${q}`,W=u?`${v}, ${this.t("saving")}`:v,Tt=b?`${r(this,Se)}-mv`:`${r(this,Se)}-op`,V=`ev:${e.key}:${t}`,Oe=b?this.t("roleDescription"):h;return m.href?c`<a class=${y} href=${m.href} style=${d.style??h} data-k=${V} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2671
|
+
</div>`}};As=new WeakMap,Se=new WeakMap,Le=new WeakMap,xe=new WeakMap,Z=new WeakMap,Q=new WeakMap,Tr=new WeakMap,Et=new WeakMap,We=new WeakMap,ul=new WeakMap,Di=new WeakMap,Rs=new WeakMap,Hs=new WeakMap,Ns=new WeakMap,Is=new WeakMap,gl=new WeakMap,f=new WeakSet,Ee=function(){return Mf.includes(this.view)?this.view:"month"},Si=function(){return ba(this,this.locale)},nl=function(){return va(r(this,f,Si))},kh=function(){return bd(r(this,f,Si),this.hourCycle)},kt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Yp=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,f,Si)):(Math.trunc(e)%7+7)%7},ol=function(){return N(this.today)?this.today:Lm()},mt=function(){return N(this.date)??N(r(this,f,ol))},Xp=function(){return r(this,f,Ee)==="month"&&this._narrow},_f=function(){return r(this,f,Ee)!=="month"},pt=function(){let e=r(this,f,mt),t=r(this,f,Yp);if(r(this,f,Ee)==="day")return[e];if(r(this,f,Ee)==="week"){if(this._narrow)return[e,G(e,1),G(e,2)];let d=G(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>G(d,u))}let i=Ht(e),a=G(i,-((i.getDay()-t+7)%7)),l=Math.ceil(($h(a,ua(e))+1)/7)*7;return Array.from({length:l},(d,m)=>G(a,m))},Cs=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(Qe(e.start).date||e.start);if(!u)return null;let v=N(Qe(e.end).date||e.end)??u;v<u&&(v=u);let b=Math.min($h(u,v),366);return{el:e,key:e.key,name:t,allDay:a,start:u,end:v,min:0,dur:1440,days:Array.from({length:b+1},(w,y)=>P(G(u,y)))}}let l=vt(e.start);if(!l)return null;let d=vt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let m=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:a,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:m,days:[P(l)]}},Cf=function(){return this.events.map(e=>s(this,f,Cs).call(this,e)).filter(e=>!!e)},Sf=function(e){let t=new Map;for(let i of e)for(let a of i.days)(t.get(a)??t.set(a,[]).get(a)).push(i);for(let i of t.values())i.sort((a,l)=>(a.allDay===l.allDay?0:a.allDay?-1:1)||a.start.getTime()-l.start.getTime()||a.name.localeCompare(l.name));return t},Ke=function(e){return ae(e,{weekday:"long",day:"numeric",month:"long"},r(this,f,Si))},ll=function(e){return r(this,f,kh).format((e%1440+1440)%1440)},cl=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=zf(r(this,f,Si),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(b=>b.source==="endRange"),v=-1;if(m.forEach((b,w)=>{b.source==="startRange"&&(v=w)}),v>=0&&u>v){let b=w=>Gp(w.map(y=>y.value).join(""));return this.t("timeRange",{start:b(m.slice(0,v+1)),end:b(m.slice(u))})}}}catch{}let l=P(e)===P(t),d=m=>l?s(this,f,ll).call(this,m.getHours()*60+m.getMinutes()):r(this,f,kh).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},Eh=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,f,Ke).call(this,e.start)}):this.t("allDayRange",{start:s(this,f,Ke).call(this,e.start),end:s(this,f,Ke).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&$h(e.start,e.end)===1)?s(this,f,cl).call(this,e.start,e.end):this.t("timed",{date:s(this,f,Ke).call(this,e.start),time:s(this,f,cl).call(this,e.start,e.end)})},Lf=function(e){let t={title:e.name,when:s(this,f,Eh).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Df=function(e){let t=r(this,f,Si);if(r(this,f,Ee)==="month")return r(this,f,nl).monthYear(r(this,f,mt));if(e.length===1)return ae(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=zf(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Gp(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Af=function(e){return r(this,f,kh).hour12?Gp(ae(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,f,Si))):s(this,f,ll).call(this,e*60)},Mr=function(e,t){let{start:i,end:a}=s(this,f,Zp).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,f,Ke).call(this,i),time:s(this,f,cl).call(this,i,a)}):s(this,f,Ke).call(this,G(N(e.origin),t.group-e.from.group))},Jp=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<_y;t!==this._narrow&&(this._narrow=t)},dl=function(e,t){return r(this,f,Ee)==="month"?Ze(e,t):r(this,f,Ee)==="week"?G(e,t*(this._narrow?3:7)):G(e,t)},Rf=function(e){this.view!==e&&(this.view=e)},hl=function(){return[...this.renderRoot.querySelectorAll(".item")]},Hf=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(a=>a.dataset.k===e&&a.classList.contains("item"))??t.find(a=>a.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let a=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${a}`)??null}return null},Nf=function(){let e=P(r(this,f,mt));if(r(this,f,Xp))return`day:${e}`;if(r(this,f,Ee)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},If=function(){let e=s(this,f,hl).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Et))??e.find(i=>i.dataset.k===s(this,f,Nf).call(this))??e.find(i=>i.dataset.day===P(r(this,f,mt)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},Pf=function(e){g(this,Et,e.dataset.k??"");for(let t of s(this,f,hl).call(this))t.tabIndex=t===e?0:-1;e.focus()},bl=new WeakMap,fl=new WeakMap,Of=function(e,t){let i=new Map;for(let y of s(this,f,hl).call(this)){let M=Number(y.dataset.i);(i.get(M)??i.set(M,[]).get(M)).push(y)}let a=Number(e.dataset.i),l=i.get(a)??[e],d=Math.max(0,l.indexOf(e)),m=s(this,f,pt).call(this).length,u=r(this,f,Ee)==="month",v=e.dataset.row,b=(y,M)=>{let D=y>=0&&y<m?i.get(y):void 0;return(D?.length?M(D):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(M=>M.dataset.row===v)??y[0];switch(t){case"ArrowRight":return b(a+1,w);case"ArrowLeft":return b(a-1,w);case"ArrowDown":return l[d+1]??(u?b(a+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?b(a-7,y=>y[y.length-1]):null;case"Home":return u?b(a-a%7,y=>y[0]):b(0,w);case"End":return u?b(Math.min(m-1,a-a%7+6),y=>y[0]):b(m-1,w);default:return null}},qf=function(e,t){let i=e.dataset.day??P(r(this,f,mt)),a=s(this,f,dl).call(this,N(i)??r(this,f,mt),t),l=P(a),d=(e.dataset.k??"").split(":")[0],m;r(this,f,Xp)?m=`day:${l}`:r(this,f,Ee)==="month"?m=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?m=`adadd:${l}`:m=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,f,dl).call(this,r(this,f,mt),t)),g(this,Et,m),g(this,We,{key:m,until:Date.now()+1e3})},vl=new WeakMap,ml=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,f,kt))+1},Bf=function(e,t){let i=r(this,Z);if(!i)return null;let a=s(this,f,pt).call(this).length,l=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,f,Ee)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return v?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return v?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:v?t.group-t.group%7:0,index:0};case"End":return{group:v?l(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,f,ml).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,f,kt))),u=v=>Math.max(0,Math.min(d,v));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+m)};case"PageUp":return{group:t.group,index:u(t.index-m)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Zp=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,f,pt).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,f,kt));return{start:m,end:new Date(m.getTime()+i.dur*6e4)}}let a=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+a,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},Qp=function(e,t){let a=s(this,f,pt).call(this).map(P).indexOf(t);if(a<0)return null;let l=r(this,f,_f)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,f,kt)),s(this,f,ml).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},eu=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),g(this,Z,null),this._target=null},Ff=function(e){let t=r(this,Z);if(!t||!e){this._target=null;return}let i=P(s(this,f,pt).call(this)[e.group]??N(t.origin)),a=e.group===t.from.group&&e.index===t.from.index;this._target=a?null:{iso:i,min:t.mode==="time"?e.index*r(this,f,kt):void 0}},jf=function(e,t){let i=r(this,Z);s(this,f,eu).call(this),i&&(g(this,Rs,performance.now()+400),s(this,f,tu).call(this,i,e,t,"keyboard"))},tu=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,f,Zp).call(this,e,i),u=P(G(N(e.origin),i.group-t.group));s(this,f,ru).call(this,e.ev,d,m,a,l,e.mode==="time"?P(d):u)},iu=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:Ef(t),end:Ef(i)}},ru=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,f,iu).call(this,e.allDay,e.start,e.end),b=s(this,f,iu).call(this,e.allDay,t,i),w=F=>{a==="keyboard"&&g(this,We,{key:F,until:Date.now()+1e3})};if(l||v.start===b.start&&v.end===b.end)return a!=="api"&&r(this,Le).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},M=e.allDay?s(this,f,Ke).call(this,t):this.t("timed",{date:s(this,f,Ke).call(this,t),time:s(this,f,cl).call(this,t,i)}),D=[],H={value:e.key,event:m,from:v,to:b,allDay:e.allDay,source:a,waitUntil:F=>{D.push(Promise.resolve(F))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:H,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Tr).set(m,v),m.start=b.start,m.end=b.end),w(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Le).announce(this.t("moved",{event:u,place:y.allDay?s(this,f,Ke).call(this,t):M})),D.length&&(m.pending=!0,Promise.all(D).then(()=>{m.pending=!1,this.controlled||r(this,Tr).delete(m)},()=>{m.pending=!1,this.controlled?r(this,Le).announce(this.t("reverted",{event:u,place:s(this,f,Eh).call(this,e)})):this.revert(m)})),!0):(r(this,Le).announce(this.t("refused",{event:u,place:M})),this.requestUpdate(),!1)},yl=new WeakMap,au=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let a=0,l=1/0;i.forEach((m,u)=>{let v=m.getBoundingClientRect(),b=e<v.left?v.left-e:e>v.right?e-v.right:0;b<l&&(l=b,a=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},Uf=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let a=null,l=1/0;for(let d of i){let m=d.getBoundingClientRect(),u=e<m.left?m.left-e:e>m.right?e-m.right:0,v=t<m.top?m.top-t:t>m.bottom?t-m.bottom:0,b=Math.hypot(u,v);b<l&&(l=b,a=d)}return a?Number(a.dataset.i):null},xl=new WeakMap,wl=new WeakMap,$l=new WeakMap,kl=new WeakMap,El=new WeakMap,Ml=new WeakMap,su=function(){let e=r(this,Q);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Le).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,f,Mr).call(this,e,e.from)})),s(this,f,Mh).call(this);let t=()=>{r(this,Q)?.started&&(s(this,f,Vf).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Mh=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,f,au).call(this,e.x,e.y);if(l){let d=s(this,f,ml).call(this,e.ev.dur)-1;t={group:l.group,index:Math.max(0,Math.min(d,Math.round((l.min-e.grab)/r(this,f,kt))))}}}else{let l=s(this,f,Uf).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let a=t.group===e.from.group&&t.index===e.from.index;this._target=a?null:{iso:P(s(this,f,pt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,f,kt):void 0},i&&r(this,Le).announce(this.t("over",{place:s(this,f,Mr).call(this,e,t)}))},Vf=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let m=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-m),v=l(d.bottom-e.y),b=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==b&&s(this,f,Mh).call(this)},Li=function(e){let t=r(this,Q);t&&(g(this,Q,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,kl),!0),window.removeEventListener("pointerup",r(this,El),!0),window.removeEventListener("pointercancel",r(this,Ml),!0),window.removeEventListener("touchmove",r(this,wl),!0),window.removeEventListener("contextmenu",r(this,$l),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,f,tu).call(this,t,t.from,t.to,"pointer")))},pl=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,f,Ee)},bubbles:!0,composed:!0}))},Kf=function(e,t,i){let a=i*60;if(e.detail>0){let m=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-m.top)/m.height*60/r(this,f,kt))*r(this,f,kt);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,f,pl).call(this,`${t}T${_h(l)}:${_h(d)}`,!1)},nu=function(e,t){if(performance.now()<r(this,Rs)||r(this,xe).active){e.preventDefault();return}this.dispatchEvent(new CustomEvent("cm-open",{detail:{value:t.key,event:t.el},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault()},Wf=function(e){this._more=e,g(this,Hs,!0)},Th=function(e){let t=this._more;this._more="",e&&t&&(g(this,Et,`more:${t}`),g(this,We,{key:`more:${t}`,until:Date.now()+1e3}))},ou=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},Ss=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,f,Lf).call(this,e),b=!this.readonly&&!m.locked&&!u,w=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",y=`chip ${a} tone-${w}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,M=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,D=e.allDay?h:c`<span class="tm">${s(this,f,ll).call(this,e.min)}</span>`,H=m.kind&&(a!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,q=u?c`<span class="spin" aria-hidden="true"></span>`:h,F=a==="time"?c`<span class="lead">${M}${D}${q}</span><span class="h">${e.name}</span>${H}`:c`${M}${D}<span class="h">${e.name}</span>${H}${q}`,W=u?`${v}, ${this.t("saving")}`:v,Tt=b?`${r(this,Se)}-mv`:`${r(this,Se)}-op`,K=`ev:${e.key}:${t}`,Oe=b?this.t("roleDescription"):h;return m.href?c`<a class=${y} href=${m.href} style=${d.style??h} data-k=${K} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2655
2672
|
data-row=${d.row??h} aria-label=${W} aria-describedby=${Tt} aria-roledescription=${Oe}
|
|
2656
|
-
@click=${nt=>s(this,f,nu).call(this,nt,e)}>${F}</a>`:c`<button type="button" class=${y} style=${d.style??h} data-k=${
|
|
2673
|
+
@click=${nt=>s(this,f,nu).call(this,nt,e)}>${F}</a>`:c`<button type="button" class=${y} style=${d.style??h} data-k=${K} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2657
2674
|
data-row=${d.row??h} aria-label=${W} aria-describedby=${Tt} aria-roledescription=${Oe}
|
|
2658
|
-
@click=${nt=>s(this,f,nu).call(this,nt,e)}>${F}</button>`},zh=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.name}</div>`},
|
|
2675
|
+
@click=${nt=>s(this,f,nu).call(this,nt,e)}>${F}</button>`},zh=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.name}</div>`},Gf=function(e){let t=r(this,f,Ee),i=t==="week"&&this._narrow,a=t==="month"?this.t("previousMonth"):i?this.t("previousDays",{count:3}):t==="week"?this.t("previousWeek"):this.t("previousDay"),l=t==="month"?this.t("nextMonth"):i?this.t("nextDays",{count:3}):t==="week"?this.t("nextWeek"):this.t("nextDay"),d=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2));return c`<div class="head" part="header">
|
|
2659
2676
|
<div class="nav">
|
|
2660
2677
|
<button type="button" class="hb icon prev" aria-label=${a} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
2661
2678
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
2662
2679
|
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
2663
2680
|
</div>
|
|
2664
|
-
<div class="title" part="title" id="${r(this,Se)}-t" role="heading" aria-level=${d} aria-live="polite">${s(this,f,
|
|
2681
|
+
<div class="title" part="title" id="${r(this,Se)}-t" role="heading" aria-level=${d} aria-live="polite">${s(this,f,Df).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
2665
2682
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
2666
|
-
${
|
|
2683
|
+
${Mf.map(m=>c`<button type="button" class="hb" data-view=${m} aria-pressed=${m===t?"true":"false"} @click=${()=>s(this,f,Rf).call(this,m)}>${this.t(m)}</button>`)}
|
|
2667
2684
|
</div>
|
|
2668
|
-
</div>`},
|
|
2669
|
-
<button type="button" class="dayb item" data-k="day:${
|
|
2670
|
-
@click=${()=>{this.date=
|
|
2671
|
-
</td>`}let Pr=Oe,Xl=0;if(Oe.length>l){Pr=Oe.slice(0,l-1);let zt=d&&Oe.find(Or=>Or.key===d.key);zt&&!Pr.includes(zt)&&(Pr=[...Oe.slice(0,l-2),zt]),Xl=Oe.length-Pr.length}let Jl=this.readonly;return c`<td class="${Du}${Jl?" item":""}" data-drop data-i=${W} data-day=${
|
|
2672
|
-
aria-label=${Jl?this.t("dayEvents",{date:nt,count:Oe.length}):h} aria-current=${
|
|
2685
|
+
</div>`},Yf=function(e){let t=r(this,f,nl),i=Array.from({length:7},(a,l)=>(l+r(this,f,Yp))%7);return c`<thead><tr>${i.map(a=>c`<th scope="col" abbr=${t.weekdaysLong[a]}><span aria-hidden="true">${e?t.weekdaysShort[a].slice(0,2):t.weekdaysShort[a]}</span><span class="vh">${t.weekdaysLong[a]}</span></th>`)}</tr></thead>`},Xf=function(e,t){let i=r(this,f,mt),a=r(this,f,ol),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=s(this,f,ou).call(this),m=this._target,u=Array.from({length:e.length/7},(F,W)=>e.slice(W*7,W*7+7)),v=this._narrow,b=(F,W,Tt)=>{let K=P(F),Oe=t.get(K)??[],nt=s(this,f,Ke).call(this,F),Du=`${F.getMonth()!==i.getMonth()?"other":""} ${K===a?"today":""} ${m?.iso===K?"over":""}`,Au=c`<span class="num" aria-hidden="true">${r(this,f,nl).day(F)}</span>`;if(v){let zt=Oe.slice(0,3).map(Or=>["attention","information","success","critical"].includes(Or.el.tone)?Or.el.tone:"neutral");return c`<td class=${Du} data-drop data-i=${W} aria-selected=${K===P(i)?"true":"false"} aria-current=${K===a?"date":h}>
|
|
2686
|
+
<button type="button" class="dayb item" data-k="day:${K}" data-i=${W} data-day=${K} aria-label=${this.t("dayEvents",{date:nt,count:Oe.length})}
|
|
2687
|
+
@click=${()=>{this.date=K,g(this,Et,`day:${K}`)}}>${Au}<span class="dots">${zt.map(Or=>c`<span class="dot tone-${Or}"></span>`)}</span></button>
|
|
2688
|
+
</td>`}let Pr=Oe,Xl=0;if(Oe.length>l){Pr=Oe.slice(0,l-1);let zt=d&&Oe.find(Or=>Or.key===d.key);zt&&!Pr.includes(zt)&&(Pr=[...Oe.slice(0,l-2),zt]),Xl=Oe.length-Pr.length}let Jl=this.readonly;return c`<td class="${Du}${Jl?" item":""}" data-drop data-i=${W} data-day=${K} data-k=${Jl?`cell:${K}`:h}
|
|
2689
|
+
aria-label=${Jl?this.t("dayEvents",{date:nt,count:Oe.length}):h} aria-current=${K===a?"date":h}>
|
|
2673
2690
|
<div class="dh">${Au}<span class="vh">${nt}</span>
|
|
2674
|
-
${Jl?h:c`<button type="button" class="add item" data-k="add:${
|
|
2675
|
-
@click=${()=>s(this,f,pl).call(this,
|
|
2691
|
+
${Jl?h:c`<button type="button" class="add item" data-k="add:${K}" data-i=${W} data-day=${K} aria-label=${this.t("addOn",{date:nt})}
|
|
2692
|
+
@click=${()=>s(this,f,pl).call(this,K,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2676
2693
|
</div>
|
|
2677
|
-
${Pr.length||m?.iso===
|
|
2678
|
-
${Pr.map(zt=>c`<li>${s(this,f,Ss).call(this,zt,
|
|
2679
|
-
${m?.iso===
|
|
2694
|
+
${Pr.length||m?.iso===K&&d?c`<ul class="evs">
|
|
2695
|
+
${Pr.map(zt=>c`<li>${s(this,f,Ss).call(this,zt,K,W,"month",!0)}</li>`)}
|
|
2696
|
+
${m?.iso===K&&d?c`<li aria-hidden="true">${s(this,f,zh).call(this,d)}</li>`:h}
|
|
2680
2697
|
</ul>`:h}
|
|
2681
|
-
${Xl?c`<button type="button" class="more item" data-k="more:${
|
|
2682
|
-
aria-expanded=${this._more===
|
|
2683
|
-
@click=${()=>this._more===
|
|
2684
|
-
${this._more===
|
|
2698
|
+
${Xl?c`<button type="button" class="more item" data-k="more:${K}" data-i=${W} data-day=${K} aria-haspopup="dialog"
|
|
2699
|
+
aria-expanded=${this._more===K?"true":"false"} aria-label=${this.t("moreLabel",{count:Xl,date:nt})}
|
|
2700
|
+
@click=${()=>this._more===K?s(this,f,Th).call(this,!1):s(this,f,Wf).call(this,K)}>${this.t("more",{count:Xl})}</button>`:h}
|
|
2701
|
+
${this._more===K?c`<div class="pop ${Tt>=4?"end":""}" role="dialog" aria-label=${nt}>
|
|
2685
2702
|
<div class="pop-h"><span>${nt}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>s(this,f,Th).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
2686
|
-
<ul>${Oe.map(zt=>c`<li>${s(this,f,Ss).call(this,zt,
|
|
2703
|
+
<ul>${Oe.map(zt=>c`<li>${s(this,f,Ss).call(this,zt,K,W,"list",!1)}</li>`)}</ul>
|
|
2687
2704
|
</div>`:h}
|
|
2688
2705
|
</td>`},w=c`<table class="month ${v?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,Se)}-t" aria-describedby="${r(this,Se)}-gh"
|
|
2689
2706
|
aria-busy=${this.loading?"true":"false"}>
|
|
2690
|
-
${s(this,f,
|
|
2691
|
-
<tbody>${u.map((F,W)=>c`<tr>${F.map((Tt,
|
|
2707
|
+
${s(this,f,Yf).call(this,v)}
|
|
2708
|
+
<tbody>${u.map((F,W)=>c`<tr>${F.map((Tt,K)=>b(Tt,W*7+K,K))}</tr>`)}</tbody>
|
|
2692
2709
|
</table>`;if(!v)return w;let y=P(i),M=t.get(y)??[],D=e.findIndex(F=>P(F)===y),H=s(this,f,Ke).call(this,i),q=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${w}
|
|
2693
2710
|
<section class="agenda" part="agenda" aria-labelledby="${r(this,Se)}-ag">
|
|
2694
2711
|
<div class="ag-h">
|
|
@@ -2697,7 +2714,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2697
2714
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
2698
2715
|
</div>
|
|
2699
2716
|
${M.length?c`<ul class="ag-list">${M.map(F=>c`<li>${s(this,f,Ss).call(this,F,y,D,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
2700
|
-
</section>`},
|
|
2717
|
+
</section>`},Jf=function(e){let t=new Map,i=e.filter(u=>!u.allDay).sort((u,v)=>u.min-v.min||v.dur-u.dur),a=[],l=[],d=-1,m=()=>{for(let u of a)t.get(u).lanes=l.length;a=[],l=[]};for(let u of i){let v=Math.min(1440,u.min+Math.max(u.dur,20));u.min>=d&&(m(),d=-1);let b=l.findIndex(w=>w<=u.min);b<0?(b=l.length,l.push(v)):l[b]=v,t.set(u,{lane:b,lanes:1}),a.push(u),d=Math.max(d,v)}return m(),t},Zf=function(e,t){let i=r(this,f,ol),a=r(this,f,nl),l=s(this,f,ou).call(this),d=this._target,m=this.readonly,u=e.map(b=>{let w=P(b),y=t.get(w)??[];return{d:b,iso:w,text:s(this,f,Ke).call(this,b),allDay:y.filter(M=>M.allDay),timed:y.filter(M=>!M.allDay),lanes:s(this,f,Jf).call(this,y)}}),v=Array.from({length:24},(b,w)=>w);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${r(this,Se)}-t" aria-describedby="${r(this,Se)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
2701
2718
|
style="--cols:${e.length}">
|
|
2702
2719
|
<div class="tg-top" role="rowgroup">
|
|
2703
2720
|
<div class="row" role="row">
|
|
@@ -2718,10 +2735,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2718
2735
|
</div>
|
|
2719
2736
|
<div class="tg-body" role="rowgroup">
|
|
2720
2737
|
${v.map(b=>c`<div class="row hr" role="row">
|
|
2721
|
-
<div class="axis" role="rowheader"><span>${s(this,f,
|
|
2738
|
+
<div class="axis" role="rowheader"><span>${s(this,f,Af).call(this,b)}</span></div>
|
|
2722
2739
|
${u.map((w,y)=>{let M=w.timed.filter(H=>Math.floor(H.min/60)===b),D=l&&!l.allDay&&d?.iso===w.iso&&d.min!==void 0&&Math.floor(d.min/60)===b;return c`<div class="tcell" role="gridcell" data-i=${y} data-row=${b} data-day=${w.iso}>
|
|
2723
2740
|
${m?h:c`<button type="button" class="slot item" data-k="slot:${w.iso}:${b}" data-i=${y} data-row=${b} data-day=${w.iso}
|
|
2724
|
-
aria-label=${this.t("addAt",{time:s(this,f,ll).call(this,b*60),date:w.text})} @click=${H=>s(this,f,
|
|
2741
|
+
aria-label=${this.t("addAt",{time:s(this,f,ll).call(this,b*60),date:w.text})} @click=${H=>s(this,f,Kf).call(this,H,w.iso,b)}></button>`}
|
|
2725
2742
|
${M.map(H=>{let q=w.lanes.get(H)??{lane:0,lanes:1},F=Math.min(H.dur,1440-H.min)/60;return s(this,f,Ss).call(this,H,w.iso,y,"time",!0,{row:String(b),style:`--top:${(H.min-b*60)/60};--len:${F};--lane:${q.lane};--lanes:${q.lanes}`})})}
|
|
2726
2743
|
${D?s(this,f,zh).call(this,l,"time",`--top:${(d.min-b*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
2727
2744
|
</div>`})}
|
|
@@ -2888,7 +2905,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2888
2905
|
.chip.time > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2889
2906
|
.chip.time .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
2890
2907
|
.ph.time { position: absolute; z-index: 3; inset-inline: 0 2px; inset-block-start: calc(var(--top) * var(--h)); height: calc(var(--len) * var(--h)); align-items: flex-start; }
|
|
2891
|
-
`];$("cm-calendar",Ds);var
|
|
2908
|
+
`];$("cm-calendar",Ds);var jk=z("reportTile",{pinned:", pinned"}),zr=class extends T{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=c`
|
|
2892
2909
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
2893
2910
|
<span class="label">${this.label}</span>
|
|
2894
2911
|
${this.pinned?c`<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
@@ -2925,7 +2942,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2925
2942
|
.title { margin-bottom: var(--cm-space-8); }
|
|
2926
2943
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
2927
2944
|
}
|
|
2928
|
-
`];$("cm-report-tiles",Ps);var
|
|
2945
|
+
`];$("cm-report-tiles",Ps);var Gk=z("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),Qf=/^\s*-?\d+(\.\d+)?\s*$/,Os=class extends T{constructor(){super(...arguments);this.label="";this.value="";this.hint="";this.change="";this.trendSentiment="auto";this.href="";this.loading=!1;this._hasHint=!1;this.onHintSlot=e=>{this._hasHint=e.target.assignedNodes({flatten:!1}).some(t=>t.nodeType===1||t.textContent?.trim())}}connectedCallback(){super.connectedCallback(),this._hasHint=!!this.querySelector(':scope > [slot="hint"]')}figure(){let e=this.value;if(e===""||e===null||e===void 0)return"";let t=typeof e=="number"?e:Qf.test(String(e))?Number(e):NaN;return Number.isNaN(t)?String(e):this.formatNumber(t)}sentiment(){let e=this.trendSentiment;return e==="positive"||e==="negative"||e==="neutral"?e:this.trend==="up"?"positive":this.trend==="down"?"negative":"neutral"}renderChange(){let e=this.trend&&["up","down","flat"].includes(this.trend)?this.trend:void 0;if(!this.change&&!e)return h;if(!e)return c`<span class="change neutral" part="change">${this.change}</span>`;let t=this.sentiment(),i=this.t(e,{change:this.change}).trim(),a=t==="positive"?this.t("good",{trend:i}):t==="negative"?this.t("bad",{trend:i}):i;return c`<span class="change ${e} ${t}" part="change">
|
|
2929
2946
|
<cm-icon name=${e==="flat"?"arrow-left":"arrow-up-right"} size="16"></cm-icon><span aria-hidden="true">${this.change}</span><span class="sr">${a}</span>
|
|
2930
2947
|
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),i=this.renderChange(),a=i!==h||e,l=c`
|
|
2931
2948
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
@@ -2934,7 +2951,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2934
2951
|
${i}
|
|
2935
2952
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
2936
2953
|
</span>
|
|
2937
|
-
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,m=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${a?"foot":h} aria-busy=${m}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${m}>${l}</div>${d}`}};Os.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&
|
|
2954
|
+
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,m=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${a?"foot":h} aria-busy=${m}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${m}>${l}</div>${d}`}};Os.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&Qf.test(e)?Number(e):e??"",toAttribute:e=>e==null?e:String(e)}},hint:{},change:{},trend:{reflect:!0},trendSentiment:{attribute:"trend-sentiment",reflect:!0},href:{},loading:{type:Boolean,reflect:!0},_hasHint:{state:!0}},Os.styles=[k,x`
|
|
2938
2955
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
2939
2956
|
.tile {
|
|
2940
2957
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -2970,13 +2987,13 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2970
2987
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
2971
2988
|
}
|
|
2972
2989
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
2973
|
-
`];$("cm-metric",Os);var qs=class extends S{constructor(){super(...arguments);this.label="";this.icon="";this.href="";this.value="";this.current=!1;this.badge="";this.expanded=!1;this.primary=!1}render(){return null}toItem(){return
|
|
2974
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,j,
|
|
2990
|
+
`];$("cm-metric",Os);var qs=class extends S{constructor(){super(...arguments);this.label="";this.icon="";this.href="";this.value="";this.current=!1;this.badge="";this.expanded=!1;this.primary=!1}render(){return null}toItem(){return ev(this)}};qs.properties={label:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},value:{reflect:!0},current:{type:Boolean,reflect:!0},badge:{reflect:!0},expanded:{type:Boolean,reflect:!0},primary:{type:Boolean,reflect:!0}},qs.styles=x`:host { display: none !important; }`;$("cm-nav-item",qs);function ev(o){let n=i=>o.getAttribute(i),e={label:n("label")||""};n("icon")&&(e.icon=n("icon")),n("href")&&(e.href=n("href")),n("value")&&(e.value=n("value")),o.hasAttribute("current")&&(e.current=!0),n("badge")&&(e.badge=n("badge")),o.hasAttribute("expanded")&&(e.expanded=!0),o.hasAttribute("primary")&&(e.primary=!0);let t=Yt(o);return t.length&&(e.items=t),e}var Yt=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(ev),lu=o=>o.value||o.href||o.label,Ch=o=>!!o.current||!!o.items?.some(Ch),Ai=(o,n)=>{let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","icon","href","value","current","badge","expanded","primary"]}),e},Ri=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:lu(n),href:n.href??""}}));var rE=z("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),Tl,zl,Dh,j,cu,Sh,du,tv,iv,hu,mu,rv,pu,uu,Lh,gu,av,Bs=class extends T{constructor(){super(...arguments);p(this,j);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;p(this,Tl,new Set);p(this,zl);p(this,Dh,A("cm-sidenav"))}connectedCallback(){super.connectedCallback(),s(this,j,cu).call(this),g(this,zl,Ai(this,()=>s(this,j,cu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,zl)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let i=s(this,j,Sh).call(this,e,t);r(this,Tl).has(i)||!e.items?.length||(r(this,Tl).add(i),(e.expanded||Ch(e))&&this._open.add(i))})}toggle(e,t){let i=this.navItems[e];if(!i?.items?.length)return;let a=s(this,j,Sh).call(this,i,e),l=t??!this._open.has(a);if(l===this._open.has(a))return;let d=new Set(this._open);l?d.add(a):d.delete(a),this._open=d,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:i,expanded:l}}))}render(){let e=this.collapsed;return c`
|
|
2991
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,j,iv)}>
|
|
2975
2992
|
<slot name="header"></slot>
|
|
2976
2993
|
<ul part="list">
|
|
2977
2994
|
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,j,gu).call(this,t,"",{index:i})}</li>`;let a=!e&&this._open.has(s(this,j,Sh).call(this,t,i)),l=`${r(this,Dh)}-${i}`;return c`<li>
|
|
2978
2995
|
${s(this,j,Lh).call(this,t,c`<button type="button" class="item parent ${Ch(t)?"has-current":""}" part="item" data-index=${i}
|
|
2979
|
-
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,j,
|
|
2996
|
+
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,j,rv).call(this,i):this.toggle(i)}>
|
|
2980
2997
|
${s(this,j,pu).call(this,t)}${s(this,j,uu).call(this,t)}
|
|
2981
2998
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
2982
2999
|
</button>`)}
|
|
@@ -2985,13 +3002,13 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2985
3002
|
</ul>
|
|
2986
3003
|
</li>`})}
|
|
2987
3004
|
</ul>
|
|
2988
|
-
${s(this,j,
|
|
3005
|
+
${s(this,j,av).call(this)}
|
|
2989
3006
|
<slot name="footer"></slot>
|
|
2990
3007
|
<slot hidden></slot>
|
|
2991
3008
|
</nav>
|
|
2992
|
-
`}};Tl=new WeakMap,zl=new WeakMap,Dh=new WeakMap,j=new WeakSet,cu=function(){this._slotted=Yt(this)},Sh=function(e,t){return`${t}:${lu(e)}`},du=function(e,t){Ri(this,t)||e.preventDefault()},
|
|
3009
|
+
`}};Tl=new WeakMap,zl=new WeakMap,Dh=new WeakMap,j=new WeakSet,cu=function(){this._slotted=Yt(this)},Sh=function(e,t){return`${t}:${lu(e)}`},du=function(e,t){Ri(this,t)||e.preventDefault()},tv=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},iv=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let i=s(this,j,tv).call(this),a=i.indexOf(t),l=Number(t.dataset.index),d=J(e,this),m;if(e.key==="ArrowDown")m=i[(a+1)%i.length];else if(e.key==="ArrowUp")m=i[(a-1+i.length)%i.length];else if(e.key==="Home")m=i[0];else if(e.key==="End")m=i[i.length-1];else{if(this.collapsed&&(d==="ArrowRight"||d==="ArrowLeft"))return;if(d==="ArrowRight"&&t.classList.contains("parent")){this.toggle(l,!0),e.preventDefault();return}else if(d==="ArrowLeft"){if(t.classList.contains("parent")?this.toggle(l,!1):t.dataset.parent&&(m=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!m){e.preventDefault();return}}else return}e.preventDefault(),m?.focus()},hu=function(e,t=0){return e.flatMap(i=>[[i,t],...s(this,j,hu).call(this,i.items??[],t+1)])},mu=function(e){if(e===this.collapsed)return!0;let t=this.dispatchEvent(new CustomEvent("cm-collapse",{bubbles:!0,composed:!0,cancelable:!0,detail:{collapsed:e}}));return t&&(this.collapsed=e),t},rv=function(e){s(this,j,mu).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},pu=function(e){return e.icon?c`<cm-icon name=${e.icon} size="20"></cm-icon>`:this.collapsed?c`<span class="initial" aria-hidden="true">${([...e.label.trim()][0]??"").toLocaleUpperCase(this.locale)}</span>`:h},uu=function(e){if(!this.collapsed)return c`<span class="label">${e.label}</span>${e.badge?c`<span class="badge">${e.badge}</span>`:h}`;let t=e.badge&&/^\d{1,2}\+?$/.test(e.badge.trim());return c`<span class="sr">${e.label}${e.badge?` (${e.badge})`:""}</span>${e.badge?c`<span class="dot ${t?"count":""}" aria-hidden="true">${t?e.badge:h}</span>`:h}`},Lh=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},gu=function(e,t,i={}){let a=c`${s(this,j,pu).call(this,e)}${s(this,j,uu).call(this,e)}`;return s(this,j,Lh).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
2993
3010
|
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,du).call(this,l,e)}>${a}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
2994
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,du).call(this,l,e)}>${a}</button>`)},
|
|
3011
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,du).call(this,l,e)}>${a}</button>`)},av=function(){if(!this.collapsible)return h;let e=this.t(this.collapsed?"expand":"collapse"),t=c`<cm-icon name=${this.collapsed?"chevron-right":"chevron-left"} size="20"></cm-icon>${this.collapsed?c`<span class="sr">${e}</span>`:c`<span class="label">${e}</span>`}`;return c`<div class="toggle-row">${s(this,j,Lh).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
2995
3012
|
@click=${()=>s(this,j,mu).call(this,!this.collapsed)}>${t}</button>`)}</div>`},Bs.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},Bs.styles=[k,x`
|
|
2996
3013
|
:host { display: block; width: var(--cm-side-navigation-width, 220px); }
|
|
2997
3014
|
nav {
|
|
@@ -3037,7 +3054,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3037
3054
|
background: var(--cm-nav-badge); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
3038
3055
|
}
|
|
3039
3056
|
.dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); }
|
|
3040
|
-
`];$("cm-side-navigation",Bs);function
|
|
3057
|
+
`];$("cm-side-navigation",Bs);function sv(o){let n=o.trim().split(/[\s._@-]+/).filter(Boolean);if(!n.length)return"";let e=[...n[0]][0]??"",t=n.length>1&&!/[.@]/.test(o)?[...n[n.length-1]][0]??"":"";return(e+t).toLocaleUpperCase()}var Fs=class extends S{constructor(){super(...arguments);this.name="";this.src="";this.size="medium";this.shape="round";this.decorative=!1;this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){let e=sv(this.name),t=this.decorative||!this.name?h:this.name,i=this.decorative||!this.name?"true":h,a,l="avatar";return this.src&&!this._failed?a=c`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?a=c`<span aria-hidden="true">${e}</span>`:(l+=" icon",a=c`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),c`<span class=${l} part="avatar" role=${t===h?h:"img"} aria-label=${t} aria-hidden=${i}>${a}</span>`}};Fs.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},Fs.styles=[k,x`
|
|
3041
3058
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3042
3059
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
3043
3060
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -3050,7 +3067,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3050
3067
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
3051
3068
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
3052
3069
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
3053
|
-
`];$("cm-avatar",Fs);var
|
|
3070
|
+
`];$("cm-avatar",Fs);var pE=z("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),Vs,Xt,Ks,Me,_l,bu,js,Us=class extends T{constructor(){super();p(this,Me);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;p(this,Vs);p(this,Xt,!1);p(this,Ks,null);this.addEventListener("cm-select",e=>{let t=s(this,Me,_l).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){s(this,Me,_l).call(this)?.focus();return}this._searchOpen||(g(this,Ks,_m()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),g(this,Vs,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,Vs).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Vs)?.disconnect(),r(this,Xt)&&(go(),g(this,Xt,!1))}updated(e){if(!e.has("_searchOpen"))return;let t=this.renderRoot.querySelector("dialog.layer");if(this._searchOpen&&t&&!t.open)t.showModal(),r(this,Xt)||(zm(),g(this,Xt,!0)),s(this,Me,_l).call(this)?.focus(),s(this,Me,js).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,Xt)&&(go(),g(this,Xt,!1));let i=r(this,Ks)??this.renderRoot.querySelector(".search-btn");g(this,Ks,null),i?.isConnected&&i.focus(),s(this,Me,js).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
3054
3071
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
3055
3072
|
<div class="logo"><slot name="logo"></slot></div>
|
|
3056
3073
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
@@ -3154,10 +3171,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3154
3171
|
@media (pointer: coarse) {
|
|
3155
3172
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
3156
3173
|
}
|
|
3157
|
-
`];$("cm-header-bar",Us);var
|
|
3158
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,_r,
|
|
3174
|
+
`];$("cm-header-bar",Us);var xE=z("bottomNavigation",{label:"Main"}),Cl,_r,fu,nv,Ws=class extends T{constructor(){super(...arguments);p(this,_r);this.items=[];this.fixed=!1;this._slotted=[];p(this,Cl)}connectedCallback(){super.connectedCallback(),s(this,_r,fu).call(this),g(this,Cl,Ai(this,()=>s(this,_r,fu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Cl)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3175
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,_r,nv).call(this,e)}</li>`)}</ul>
|
|
3159
3176
|
<slot hidden></slot>
|
|
3160
|
-
</nav>`}};Cl=new WeakMap,_r=new WeakSet,fu=function(){this._slotted=Yt(this)},
|
|
3177
|
+
</nav>`}};Cl=new WeakMap,_r=new WeakSet,fu=function(){this._slotted=Yt(this)},nv=function(e){let t=`item ${e.primary?"primary":""}`,i=c`<span class="icon">${e.icon?c`<cm-icon name=${e.icon} size=${e.primary?16:20}></cm-icon>`:h}</span><span class="label">${e.label}</span>`,a=l=>{Ri(this,e)||l.preventDefault()};return e.href?c`<a class=${t} part="item" href=${e.href} aria-current=${e.current?"page":h} @click=${a}>${i}</a>`:c`<button type="button" class=${t} part="item" aria-current=${e.current?"page":h} @click=${a}>${i}</button>`},Ws.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},Ws.styles=[k,x`
|
|
3161
3178
|
:host { display: block; }
|
|
3162
3179
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
3163
3180
|
nav {
|
|
@@ -3179,21 +3196,21 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3179
3196
|
.icon { display: grid; place-items: center; width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
3180
3197
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
3181
3198
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3182
|
-
`];$("cm-bottom-navigation",Ws);var
|
|
3199
|
+
`];$("cm-bottom-navigation",Ws);var zE=z("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Sl,Cr,De,vu,ov,yu,xu,lv,Gs=class extends T{constructor(){super(...arguments);p(this,De);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;p(this,Sl);p(this,Cr,A("cm-mmenu"))}connectedCallback(){super.connectedCallback(),s(this,De,vu).call(this),g(this,Sl,Ai(this,()=>s(this,De,vu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Sl)?.disconnect()}get sections(){return this.items.length?this.items:this._slotted}back(){if(!this._page)return;let[e,t]=this._page;this._page=null,this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-row="${e}-${t}"]`)?.focus())}render(){let e=this.sections,t=this._page?e[this._page[0]]?.items?.[this._page[1]]:void 0;return t?c`<nav part="nav" class="sub" aria-label=${this.label||this.t("label")} id="${r(this,Cr)}-sub"
|
|
3183
3200
|
@keydown=${i=>{i.key==="Escape"&&(i.preventDefault(),this.back())}}>
|
|
3184
3201
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
3185
3202
|
${t.label}</button>
|
|
3186
3203
|
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,De,xu).call(this,i,0,0,!0)}</li>`)}</ul>
|
|
3187
3204
|
<slot hidden></slot>
|
|
3188
3205
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3189
|
-
${s(this,De,
|
|
3206
|
+
${s(this,De,lv).call(this)}
|
|
3190
3207
|
${e.map((i,a)=>{let l=`${r(this,Cr)}-s${a}`;return c`<section aria-labelledby=${i.label?l:h}>
|
|
3191
3208
|
${i.label?c`<h2 class="heading" id=${l}>${i.label}</h2>`:h}
|
|
3192
3209
|
<ul class="card">${(i.items??[]).map((d,m)=>c`<li>${s(this,De,xu).call(this,d,a,m)}</li>`)}</ul>
|
|
3193
3210
|
</section>`})}
|
|
3194
3211
|
<slot hidden></slot>
|
|
3195
|
-
</nav>`}};Sl=new WeakMap,Cr=new WeakMap,De=new WeakSet,vu=function(){this._slotted=Yt(this)},
|
|
3196
|
-
@click=${()=>s(this,De,
|
|
3212
|
+
</nav>`}};Sl=new WeakMap,Cr=new WeakMap,De=new WeakSet,vu=function(){this._slotted=Yt(this)},ov=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},yu=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},xu=function(e,t,i,a=!1){let l=v=>{Ri(this,e)||v.preventDefault()};if(e.primary&&!a)return c`<button type="button" class="row action" part="row" @click=${l}>${e.label}</button>`;let d=e.icon&&!a?c`<cm-icon class="icon" name=${e.icon} size="20"></cm-icon>`:h,m=e.badge?c`<span class="badge">${e.badge}</span>`:h;if(e.items?.length&&!a)return c`<button type="button" class="row" part="row" data-row="${t}-${i}"
|
|
3213
|
+
@click=${()=>s(this,De,ov).call(this,t,i)}>${d}<span class="label">${e.label}</span>${m}<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let u=c`${d}<span class="label">${e.label}</span>${m}${e.href&&!a?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return e.href?c`<a class="row" part="row" href=${e.href} aria-current=${e.current?"page":h} @click=${l}>${u}</a>`:c`<button type="button" class="row" part="row" aria-current=${e.current?"page":h} @click=${l}>${u}</button>`},lv=function(){if(!this.store&&!this.userName)return h;let e=this.userName.trim().charAt(0).toUpperCase();return c`<section aria-labelledby="${r(this,Cr)}-profile">
|
|
3197
3214
|
<h2 class="heading" id="${r(this,Cr)}-profile">${this.t("profile")}</h2>
|
|
3198
3215
|
<ul class="card">
|
|
3199
3216
|
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,De,yu).call(this,"cm-store-switch")}>
|
|
@@ -3241,12 +3258,12 @@ ${t.label}</button>
|
|
|
3241
3258
|
}
|
|
3242
3259
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3243
3260
|
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3244
|
-
`];$("cm-mobile-menu",Gs);var
|
|
3261
|
+
`];$("cm-mobile-menu",Gs);var AE=z("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),Ah,cv,Ys=class extends T{constructor(){super(...arguments);p(this,Ah);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
3245
3262
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
3246
3263
|
<span class="text"><slot></slot></span>
|
|
3247
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,Ah,
|
|
3264
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,Ah,cv)}><cm-icon name="close" size="16"></cm-icon>
|
|
3248
3265
|
</button>`:h}
|
|
3249
|
-
</div>`}};Ah=new WeakSet,
|
|
3266
|
+
</div>`}};Ah=new WeakSet,cv=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},Ys.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},Ys.styles=[k,x`
|
|
3250
3267
|
:host { display: block; }
|
|
3251
3268
|
.bar {
|
|
3252
3269
|
position: relative; display: flex; align-items: center; justify-content: center; gap: var(--cm-space-8); min-height: 48px;
|
|
@@ -3268,7 +3285,7 @@ ${t.label}</button>
|
|
|
3268
3285
|
@media (max-width: 640px) {
|
|
3269
3286
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
3270
3287
|
}
|
|
3271
|
-
`];$("cm-flash-offer-bar",Ys);var
|
|
3288
|
+
`];$("cm-flash-offer-bar",Ys);var qE=z("linkTabs",{label:"Sections"}),Ll,Dl,wu,Xs=class extends T{constructor(){super(...arguments);p(this,Dl);this.items=[];this._slotted=[];p(this,Ll)}connectedCallback(){super.connectedCallback(),s(this,Dl,wu).call(this),g(this,Ll,Ai(this,()=>s(this,Dl,wu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Ll)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3272
3289
|
<ul part="tabs">${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3273
3290
|
@click=${t=>{Ri(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
3274
3291
|
<slot hidden></slot>
|
|
@@ -3291,7 +3308,7 @@ ${t.label}</button>
|
|
|
3291
3308
|
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
3292
3309
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
3293
3310
|
|
|
3294
|
-
`];$("cm-link-tabs",Xs);var
|
|
3311
|
+
`];$("cm-link-tabs",Xs);var KE=z("appCard",{developer:"By {developer}",rating:"Rated {rating} out of 5",reviews:{one:"{count} Review",other:"{count} Reviews"},offer:"Offer: ",details:"View Details",detailsLabel:"View details of {name}"}),Js=class extends T{constructor(){super(...arguments);this.name="";this.developer="";this.reviewsHref="";this.pricing="";this.offer="";this.href="";this.headingLevel=3}render(){let e=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),t=typeof this.rating=="number"&&!Number.isNaN(this.rating),i=typeof this.reviews=="number"?this.t("reviews",{count:this.reviews}):"",a=t?this.formatNumber(this.rating,{minimumFractionDigits:1,maximumFractionDigits:1}):"";return c`<article part="card" aria-labelledby="name">
|
|
3295
3312
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
3296
3313
|
<div class="status"><slot name="status"></slot></div>
|
|
3297
3314
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
@@ -3340,21 +3357,21 @@ ${t.label}</button>
|
|
|
3340
3357
|
.actions { gap: var(--cm-space-8); }
|
|
3341
3358
|
.details { margin-inline-start: auto; }
|
|
3342
3359
|
}
|
|
3343
|
-
`];$("cm-app-card",Js);var Rh,
|
|
3360
|
+
`];$("cm-app-card",Js);var Rh,dv,Zs=class extends ee{constructor(){super(...arguments);p(this,Rh);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3344
3361
|
${this.renderHeader()}
|
|
3345
3362
|
<div class="body" part="body"><slot></slot></div>
|
|
3346
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,Rh,
|
|
3347
|
-
</div>`)}};Rh=new WeakSet,
|
|
3363
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,Rh,dv)}></slot></footer>
|
|
3364
|
+
</div>`)}};Rh=new WeakSet,dv=function(e){this._hasFooter=e.target.assignedElements().length>0},Zs.properties={...ee.properties,size:{reflect:!0},_hasFooter:{state:!0}},Zs.styles=[...ee.overlayStyles,x`
|
|
3348
3365
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
3349
3366
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
3350
3367
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
3351
3368
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
3352
3369
|
|
|
3353
|
-
`];$("cm-modal",Zs);var Hh,
|
|
3370
|
+
`];$("cm-modal",Zs);var Hh,hv,Mt=class extends ee{constructor(){super(...arguments);p(this,Hh);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}renderBody(){return c`<slot></slot>`}renderFooter(){return c`<slot name="footer" @slotchange=${s(this,Hh,hv)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3354
3371
|
${this.renderHeader()}
|
|
3355
3372
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
3356
3373
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
3357
|
-
</div>`)}};Hh=new WeakSet,
|
|
3374
|
+
</div>`)}};Hh=new WeakSet,hv=function(e){this._hasFooter=e.target.assignedElements().length>0},Mt.properties={...ee.properties,size:{reflect:!0},_hasFooter:{state:!0}},Mt.styles=[...ee.overlayStyles,x`
|
|
3358
3375
|
dialog {
|
|
3359
3376
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
3360
3377
|
}
|
|
@@ -3372,7 +3389,7 @@ ${t.label}</button>
|
|
|
3372
3389
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
3373
3390
|
|
|
3374
3391
|
}
|
|
3375
|
-
`];$("cm-side-panel",Mt);var
|
|
3392
|
+
`];$("cm-side-panel",Mt);var lM=z("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),en,Nh,Qs=class extends Mt{constructor(){super(...arguments);this.search=!1;this.query="";p(this,en,()=>{this.dispatchEvent(new CustomEvent("cm-filter-apply",{detail:{values:this.values,query:this.query},bubbles:!0,composed:!0,cancelable:!0}))&&this.requestClose("action")});p(this,Nh,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(a,l)=>{if(l==="")return;let d=e[a];e[a]=d===void 0?l:Array.isArray(d)?[...d,l]:[d,l]},i=this.form;if(i){for(let[a,l]of new FormData(i))typeof l=="string"&&t(a,l);return e}return this.querySelectorAll("[name]").forEach(a=>{let l=a.getAttribute("name");"checked"in a&&(a.type==="checkbox"||a.type==="radio"||a.localName.match(/^cm-(checkbox|radio|toggle)$/))?a.checked&&t(l,a.value||"on"):typeof a.value=="string"&&t(l,a.value)}),e}reset(){let e=this.form;e?e.reset():this.querySelectorAll("[name]").forEach(t=>t.formResetCallback?.()),this.query=""}renderBody(){return c`${this.search?c`<cm-search class="search" part="search" .value=${this.query} label=${this.searchLabel}
|
|
3376
3393
|
placeholder=${this.searchPlaceholder}
|
|
3377
3394
|
@input=${e=>{this.query=e.target.value}}
|
|
3378
3395
|
@cm-search=${e=>{e.stopPropagation(),r(this,en).call(this)}}></cm-search>`:h}
|
|
@@ -3381,15 +3398,15 @@ ${t.label}</button>
|
|
|
3381
3398
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
3382
3399
|
.foot { justify-content: center; }
|
|
3383
3400
|
::slotted(form) { display: grid; gap: var(--cm-space-12); }
|
|
3384
|
-
`];$("cm-filter-panel",Qs);var Al,Sr,$u,
|
|
3401
|
+
`];$("cm-filter-panel",Qs);var Al,Sr,$u,mv,tn=class extends ee{constructor(){super(...arguments);p(this,Sr);this.heading="";this.items=[];this._slotted=[];p(this,Al)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=On(this),g(this,Al,fc(this,()=>{this._slotted=On(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,Al)?.disconnect()}render(){let e=this.sheetItems.filter(i=>!i.divider&&!i.heading),t=e.some(i=>i.icon);return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3385
3402
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
3386
3403
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
3387
3404
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
3388
3405
|
<div class="content">
|
|
3389
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,Sr,
|
|
3406
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,Sr,mv).call(this,i)}</li>`)}</ul>`:h}
|
|
3390
3407
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
3391
3408
|
</div>
|
|
3392
|
-
</div>`)}};Al=new WeakMap,Sr=new WeakSet,$u=function(e,t){if(t.disabled){e.preventDefault();return}if(!this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}this.requestClose("action")},
|
|
3409
|
+
</div>`)}};Al=new WeakMap,Sr=new WeakSet,$u=function(e,t){if(t.disabled){e.preventDefault();return}if(!this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}this.requestClose("action")},mv=function(e){let t=`row${e.critical?" critical":""}`,i=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
3393
3410
|
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${a=>s(this,Sr,$u).call(this,a,e)}>${i}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
3394
3411
|
@click=${a=>s(this,Sr,$u).call(this,a,e)}>${i}</button>`},tn.properties={...ee.properties,items:{type:Array},_slotted:{state:!0}},tn.styles=[...ee.overlayStyles,x`
|
|
3395
3412
|
dialog {
|
|
@@ -3425,17 +3442,17 @@ ${t.label}</button>
|
|
|
3425
3442
|
}
|
|
3426
3443
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
3427
3444
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3428
|
-
`];$("cm-bottom-sheet",tn);var
|
|
3429
|
-
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(a=>c`<li>${s(this,Ie,
|
|
3445
|
+
`];$("cm-bottom-sheet",tn);var wM=z("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),Cy={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},rn=class extends S{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};rn.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},rn.styles=x`:host { display: none; }`;$("cm-notification-item",rn);var sn,Ie,ku,Eu,pv,uv,gv,an=class extends ee{constructor(){super(...arguments);p(this,Ie);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;p(this,sn)}connectedCallback(){super.connectedCallback(),s(this,Ie,ku).call(this),g(this,sn,new MutationObserver(()=>s(this,Ie,ku).call(this))),r(this,sn).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,sn)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications,t=this.markAllRead&&!this.loading&&e.some(a=>a.unread)?c`<button type="button" class="mark" part="mark-all-read" @click=${s(this,Ie,uv)}>${this.markAllLabel}</button>`:h,i=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
3446
|
+
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(a=>c`<li>${s(this,Ie,pv).call(this,a)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3430
3447
|
${this.renderHeader(t)}
|
|
3431
3448
|
${i}
|
|
3432
3449
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3433
3450
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
3434
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,Ie,
|
|
3451
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,Ie,gv)}></slot></div>
|
|
3435
3452
|
<slot hidden></slot>
|
|
3436
|
-
</div>`)}};sn=new WeakMap,Ie=new WeakSet,ku=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=i=>e.getAttribute(i)||void 0;return{label:(e.textContent??"").trim(),time:t("time"),tone:t("tone")??"information",href:t("href"),unread:e.hasAttribute("unread")||void 0,value:t("value"),description:t("description"),icon:t("icon")}})},Eu=function(e,t){if(!this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.href??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}this.requestClose("action")},
|
|
3453
|
+
</div>`)}};sn=new WeakMap,Ie=new WeakSet,ku=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=i=>e.getAttribute(i)||void 0;return{label:(e.textContent??"").trim(),time:t("time"),tone:t("tone")??"information",href:t("href"),unread:e.hasAttribute("unread")||void 0,value:t("value"),description:t("description"),icon:t("icon")}})},Eu=function(e,t){if(!this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.href??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}this.requestClose("action")},pv=function(e){let t=e.tone??"information",i=e.description?c`<span class="title">${e.label}</span><span class="vh">, </span><span class="desc">${e.description}</span>`:e.label,a=c`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${e.icon||Cy[t]||"bell"} size="14"></cm-icon></span>
|
|
3437
3454
|
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${i}</span>
|
|
3438
|
-
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>s(this,Ie,Eu).call(this,d,e)}>${a}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>s(this,Ie,Eu).call(this,d,e)}>${a}</button>`},
|
|
3455
|
+
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>s(this,Ie,Eu).call(this,d,e)}>${a}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>s(this,Ie,Eu).call(this,d,e)}>${a}</button>`},uv=async function(e){let t=e.currentTarget;this.dispatchEvent(new CustomEvent("cm-mark-all-read",{bubbles:!0,composed:!0})),await new Promise(i=>setTimeout(i)),await this.updateComplete,!t.isConnected&&this.open&&this.renderRoot.querySelector(".panel")?.focus()},gv=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},an.properties={...ee.properties,items:{type:Array},moreHref:{attribute:"more-href"},heading:{string:"heading"},moreLabel:{attribute:"more-label",string:"more"},emptyText:{attribute:"empty-text",string:"empty"},markAllRead:{type:Boolean,attribute:"mark-all-read"},markAllLabel:{attribute:"mark-all-label",string:"markAllRead"},loading:{type:Boolean,reflect:!0},_slotted:{state:!0},_footer:{state:!0}},an.styles=[...ee.overlayStyles,x`
|
|
3439
3456
|
dialog {
|
|
3440
3457
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
3441
3458
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3485,15 +3502,15 @@ ${t.label}</button>
|
|
|
3485
3502
|
@media (max-width: 599px) {
|
|
3486
3503
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3487
3504
|
}
|
|
3488
|
-
`];$("cm-notification-panel",an);var
|
|
3505
|
+
`];$("cm-notification-panel",an);var zM=z("toastRegion",{label:"Notifications"}),_M=z("toast",{undo:"Undo",shortcut:"Press F6 to reach it."}),bv=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o&&o!==document.body?o:null},Mu=(o,n)=>{for(let e=n;e;e=e.parentNode??e.host??null)if(e===o)return!0;return!1},Sy=2e3,fv=1e4,vv=150,Rl,ut,Jt,Hl,cn,dn,Lr,Hi,Dr,pe,Ih,yv,nn,Tu,Nl,Il,Pl,Ol,xv,on=class extends T{constructor(){super(...arguments);p(this,pe);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;p(this,Rl);p(this,ut);p(this,Jt,0);p(this,Hl,0);p(this,cn,!1);p(this,dn,!1);p(this,Lr);p(this,Hi);p(this,Dr);p(this,Nl,()=>{g(this,cn,!0),s(this,pe,Tu).call(this)});p(this,Il,()=>{g(this,cn,!1),s(this,pe,nn).call(this)});p(this,Pl,()=>{g(this,dn,!0),s(this,pe,Tu).call(this)});p(this,Ol,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(g(this,dn,!1),s(this,pe,nn).call(this))})}get closed(){if(!r(this,Lr)){if(!this.open&&r(this,Dr))return Promise.resolve(r(this,Dr));g(this,Lr,new Promise(e=>{g(this,Hi,e)}))}return r(this,Lr)}get effectiveDuration(){let e=this.duration??(this.actionLabel?fv:5e3);return Math.min(fv,Math.max(Sy,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&g(this,Rl,setTimeout(()=>{this._primed=!0},vv)),this.addEventListener("pointerenter",r(this,Nl)),this.addEventListener("pointerleave",r(this,Il)),this.addEventListener("focusin",r(this,Pl)),this.addEventListener("focusout",r(this,Ol))}disconnectedCallback(){super.disconnectedCallback(),this.open&&r(this,Hi)&&queueMicrotask(()=>{!this.isConnected&&this.open&&s(this,pe,Ih).call(this,"removed")}),clearTimeout(r(this,ut)),clearTimeout(r(this,Rl)),this.removeEventListener("pointerenter",r(this,Nl)),this.removeEventListener("pointerleave",r(this,Il)),this.removeEventListener("focusin",r(this,Pl)),this.removeEventListener("focusout",r(this,Ol))}updated(e){e.has("open")&&e.get("open")!==void 0&&(this.open?g(this,Dr,void 0):r(this,Hi)&&s(this,pe,Ih).call(this,"close")),(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,ut)),this.open&&(this._inRegion||this._primed)&&(g(this,Jt,this.effectiveDuration),s(this,pe,nn).call(this)))}show(){this.open?(g(this,Jt,this.effectiveDuration),s(this,pe,nn).call(this)):this.open=!0}dismiss(e="close"){let t=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0,detail:{reason:e}});return this.dispatchEvent(t)?(clearTimeout(r(this,ut)),this.open=!1,s(this,pe,Ih).call(this,e),!0):(e==="timeout"&&(g(this,Jt,this.effectiveDuration),s(this,pe,nn).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3489
3506
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3490
3507
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3491
|
-
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,pe,
|
|
3508
|
+
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,pe,xv)}>${this.actionLabel}</button>`:h}
|
|
3492
3509
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3493
3510
|
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
|
|
3494
3511
|
</button>
|
|
3495
3512
|
${this.actionLabel&&this._inRegion&&this.t("shortcut")?c`<span class="hint">${this.t("shortcut")}</span>`:h}
|
|
3496
|
-
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Rl=new WeakMap,ut=new WeakMap,Jt=new WeakMap,Hl=new WeakMap,cn=new WeakMap,dn=new WeakMap,Lr=new WeakMap,Hi=new WeakMap,Dr=new WeakMap,pe=new WeakSet,Ih=function(e){g(this,Dr,e);let t=r(this,Hi);g(this,Lr,g(this,Hi,void 0)),t?.(e)},
|
|
3513
|
+
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Rl=new WeakMap,ut=new WeakMap,Jt=new WeakMap,Hl=new WeakMap,cn=new WeakMap,dn=new WeakMap,Lr=new WeakMap,Hi=new WeakMap,Dr=new WeakMap,pe=new WeakSet,Ih=function(e){g(this,Dr,e);let t=r(this,Hi);g(this,Lr,g(this,Hi,void 0)),t?.(e)},yv=function(){return r(this,cn)||r(this,dn)},nn=function(){clearTimeout(r(this,ut)),!(!this.open||r(this,pe,yv))&&(g(this,Hl,Date.now()),g(this,ut,setTimeout(()=>this.dismiss("timeout"),r(this,Jt))))},Tu=function(){r(this,ut)!==void 0&&(clearTimeout(r(this,ut)),g(this,ut,void 0),g(this,Jt,Math.max(1e3,r(this,Jt)-(Date.now()-r(this,Hl)))))},Nl=new WeakMap,Il=new WeakMap,Pl=new WeakMap,Ol=new WeakMap,xv=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},on.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},on.styles=[k,x`
|
|
3497
3514
|
:host { display: block; pointer-events: auto; }
|
|
3498
3515
|
:host(:not([open])) { display: none; }
|
|
3499
3516
|
.toast {
|
|
@@ -3525,13 +3542,13 @@ ${t.label}</button>
|
|
|
3525
3542
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
3526
3543
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
3527
3544
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
3528
|
-
`];$("cm-toast",on);var Ar,ql,Bl,Fl,jl,Ul,hn,Ph,ln=class extends T{constructor(){super(...arguments);p(this,hn);this.max=3;p(this,Ar,null);p(this,ql,!1);p(this,Bl,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let i=t.matches(":focus-within");t.remove(),i&&s(this,hn,Ph).call(this)})});p(this,Fl,e=>{let t=e.relatedTarget;t&&!Mu(this,t)&&g(this,Ar,t)});p(this,jl,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(i=>i.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});p(this,Ul,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?s(this,hn,Ph).call(this):this.focusToast())&&e.preventDefault()})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),g(this,ql,!0)),this.addEventListener("cm-dismiss",r(this,Bl)),this.addEventListener("focusin",r(this,Fl)),this.addEventListener("keydown",r(this,jl)),document.addEventListener("keydown",r(this,Ul))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Bl)),this.removeEventListener("focusin",r(this,Fl)),this.removeEventListener("keydown",r(this,jl)),document.removeEventListener("keydown",r(this,Ul))}updated(){r(this,ql)&&this.setAttribute("aria-label",this.t("label"))}focusToast(){let e=[...this.querySelectorAll(":scope > cm-toast[open]")].reverse(),t=e.find(l=>l.actionLabel)??e[0],i=t?.shadowRoot?.querySelector(".action")??t?.shadowRoot?.querySelector(".close");if(!i)return!1;let a=
|
|
3545
|
+
`];$("cm-toast",on);var Ar,ql,Bl,Fl,jl,Ul,hn,Ph,ln=class extends T{constructor(){super(...arguments);p(this,hn);this.max=3;p(this,Ar,null);p(this,ql,!1);p(this,Bl,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let i=t.matches(":focus-within");t.remove(),i&&s(this,hn,Ph).call(this)})});p(this,Fl,e=>{let t=e.relatedTarget;t&&!Mu(this,t)&&g(this,Ar,t)});p(this,jl,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(i=>i.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});p(this,Ul,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?s(this,hn,Ph).call(this):this.focusToast())&&e.preventDefault()})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),g(this,ql,!0)),this.addEventListener("cm-dismiss",r(this,Bl)),this.addEventListener("focusin",r(this,Fl)),this.addEventListener("keydown",r(this,jl)),document.addEventListener("keydown",r(this,Ul))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Bl)),this.removeEventListener("focusin",r(this,Fl)),this.removeEventListener("keydown",r(this,jl)),document.removeEventListener("keydown",r(this,Ul))}updated(){r(this,ql)&&this.setAttribute("aria-label",this.t("label"))}focusToast(){let e=[...this.querySelectorAll(":scope > cm-toast[open]")].reverse(),t=e.find(l=>l.actionLabel)??e[0],i=t?.shadowRoot?.querySelector(".action")??t?.shadowRoot?.querySelector(".close");if(!i)return!1;let a=bv();return a&&!Mu(this,a)&&g(this,Ar,a),i.focus(),!0}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")],i=t.slice(0,Math.max(0,t.length-Math.max(1,this.max))),a=i.some(l=>l.matches(":focus-within"));return i.forEach(l=>l.remove()),a&&s(this,hn,Ph).call(this),e}render(){return c`<slot></slot>`}};Ar=new WeakMap,ql=new WeakMap,Bl=new WeakMap,Fl=new WeakMap,jl=new WeakMap,Ul=new WeakMap,hn=new WeakSet,Ph=function(){let e=r(this,Ar);return g(this,Ar,null),e?.isConnected?(e.focus(),Mu(e,bv())||e.shadowRoot?.querySelector("button, a[href], input, select, textarea, [tabindex]")?.focus(),!0):!1},ln.properties={max:{type:Number}},ln.styles=[k,x`
|
|
3529
3546
|
:host {
|
|
3530
3547
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
3531
3548
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
3532
3549
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
3533
3550
|
}
|
|
3534
|
-
`];$("cm-toast-region",ln);function
|
|
3551
|
+
`];$("cm-toast-region",ln);function wv(o,n={}){let e=n.root??document.body,t=e.querySelector(":scope > cm-toast-region"),i=!t;t||(t=document.createElement("cm-toast-region"),e.append(t));let a=document.createElement("cm-toast");if(a.message=String(o),n.tone&&(a.tone=n.tone),n.duration!==void 0&&(a.duration=n.duration),n.action){a.actionLabel=n.action.label;let l=n.action.onAction;a.addEventListener("cm-action",()=>l())}if(i){let l=t;return setTimeout(()=>l.add(a),vv),a}return t.add(a)}async function Ly(o,n,e){await o();let{message:t,undoLabel:i,...a}=e,l=i??mc("toast","undo",void 0,a.root??document.body),d=await wv(t,{...a,action:{label:l,onAction:()=>{}}}).closed;return d==="action"&&await n(),d}var RM=z("progressBar",{inProgress:"In progress"}),Oh,mn=class extends T{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";p(this,Oh,A("cm-progress"))}get clampedValue(){let e=this.value;return e==null||Number.isNaN(Number(e))?null:Math.min(100,Math.max(0,Number(e)))}render(){let e=this.clampedValue,t=`${r(this,Oh)}-label`;return c`
|
|
3535
3552
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
3536
3553
|
<span id=${t} part="label">${this.label}</span>
|
|
3537
3554
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -3571,11 +3588,11 @@ ${t.label}</button>
|
|
|
3571
3588
|
:host([tone='success']) span { background: linear-gradient(var(--cm-bg-success-soft), var(--cm-bg-success-soft)), var(--cm-bg-surface); color: var(--cm-text-success); }
|
|
3572
3589
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
3573
3590
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
3574
|
-
`];$("cm-badge",pn);var gn,bn,gt
|
|
3591
|
+
`];$("cm-badge",pn);var gn,bn,gt,$v,kv,Vl,Ev,qh,zu,un=class extends S{constructor(){super(...arguments);p(this,gt);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;this.variant="standard";this.href="";this.target="";this.selected=!1;this.label="";p(this,gn,!1);p(this,bn,!1);p(this,Vl,!1);p(this,qh,()=>{this.href||this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))})}willUpdate(){this.selected&&g(this,Vl,!0)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=r(this,gt,Ev),i=t?s(this,gt,zu).call(this,this.heading):this.heading,a=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${i}</span><span class="adornment" ?hidden=${!r(this,gn)}><slot name="title-adornment" @slotchange=${s(this,gt,$v)}></slot></span></div>`:h;return c`<section part="card" aria-label=${!t&&this.heading||h}>${t&&!this.heading?s(this,gt,zu).call(this,h):h}
|
|
3575
3592
|
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${a}${this.description?c`<p class="desc">${this.description}</p>`:h}</div>
|
|
3576
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,bn)}><div class="actions"><slot name="actions" @slotchange=${s(this,gt
|
|
3593
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,bn)}><div class="actions"><slot name="actions" @slotchange=${s(this,gt,kv)}></slot></div></div>`}
|
|
3577
3594
|
<slot></slot>
|
|
3578
|
-
</section>`}};gn=new WeakMap,bn=new WeakMap,gt=new WeakSet
|
|
3595
|
+
</section>`}};gn=new WeakMap,bn=new WeakMap,gt=new WeakSet,$v=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,gn)&&(g(this,gn,t),this.requestUpdate())},kv=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,bn)&&(g(this,bn,t),this.requestUpdate())},Vl=new WeakMap,Ev=function(){return String(this.variant||"").split(/\s+/).includes("interactive")},qh=new WeakMap,zu=function(e){let t=e===h?"hit cover":"hit",i=e===h?this.label||h:h;return this.href?c`<a class=${t} part="control" href=${this.href} target=${this.target||h} rel=${this.target==="_blank"?"noopener noreferrer":h}
|
|
3579
3596
|
aria-current=${this.selected?"true":h} aria-label=${i}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":r(this,Vl)?"false":h} aria-label=${i} @click=${r(this,qh)}>${e}</button>`},un.properties={heading:{},description:{},flush:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},href:{},target:{},selected:{type:Boolean,reflect:!0},label:{}},un.styles=[k,x`
|
|
3580
3597
|
/* Owner standard (1.6): 24px padding and a 16px gap under the header; compact 16px and 12px; 16px on phones. */
|
|
3581
3598
|
:host { display: block; --_pad: var(--cm-space-24); --_gap: var(--cm-space-16); }
|
|
@@ -3628,7 +3645,7 @@ ${t.label}</button>
|
|
|
3628
3645
|
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
|
|
3629
3646
|
.bare[hidden] { display: none; }
|
|
3630
3647
|
:host([flush]) .bare { padding: var(--_pad) var(--_pad) 0; margin-bottom: var(--cm-space-8); }
|
|
3631
|
-
`];$("cm-card",un);var
|
|
3648
|
+
`];$("cm-card",un);var Dy=["0","4","8","12","16","20","24","32","40","48","64"],Ay={10:"8",15:"16",22:"24",30:"32"};function fn(o,n){let e=(t,i)=>`:host([${o}='${t}']) { ${n}: ${i==="0"?"0px":`var(--cm-space-${i})`}; }`;return ec([...Dy.map(t=>e(t,t)),...Object.entries(Ay).map(([t,i])=>e(t,i))].join(`
|
|
3632
3649
|
`))}var vn=class extends S{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return c`<slot></slot>`}};vn.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},vn.styles=[k,x`
|
|
3633
3650
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
3634
3651
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
@@ -3642,7 +3659,7 @@ ${t.label}</button>
|
|
|
3642
3659
|
:host([justify='center']) { justify-content: center; }
|
|
3643
3660
|
:host([justify='end']) { justify-content: flex-end; }
|
|
3644
3661
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
3645
|
-
`,fn("gap","gap")];$("cm-stack",vn);var
|
|
3662
|
+
`,fn("gap","gap")];$("cm-stack",vn);var Mv="important",Ry=" !"+Mv,Tv=Gr(class extends ti{constructor(o){if(super(o),o.type!==ot.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((n,e)=>{let t=o[e];return t==null?n:n+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(o,[n]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(let t of this.ft)n[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in n){let i=n[t];if(i!=null){this.ft.add(t);let a=typeof i=="string"&&i.endsWith(Ry);t.includes("-")||a?e.setProperty(t,a?i.slice(0,-11):i,a?Mv:""):e[t]=i}}return we}});var yn=class extends S{constructor(){super(...arguments);this.columns=2;this.gap="20"}render(){let e=Math.max(1,Math.floor(Number(this.columns)||1)),t=this.minColumnWidth?.trim(),i=t?`repeat(auto-fit, minmax(min(100%, ${t}), 1fr))`:`repeat(${e}, minmax(0, 1fr))`;return c`<div class="grid ${t?"fit":"fixed"}" part="grid" style=${Tv({gridTemplateColumns:i})}><slot></slot></div>`}};yn.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},yn.styles=[k,x`
|
|
3646
3663
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
3647
3664
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
3648
3665
|
@container cm-grid (max-width: 640px) {
|
|
@@ -3684,7 +3701,7 @@ ${t.label}</button>
|
|
|
3684
3701
|
}
|
|
3685
3702
|
`,fn("gap","--_gap")];var wn=class extends S{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};wn.properties={variant:{reflect:!0}},wn.styles=[k,x`
|
|
3686
3703
|
:host { display: flex; flex-direction: column; gap: var(--_cm-section-gap, var(--cm-space-24)); min-inline-size: 0; }
|
|
3687
|
-
`];$("cm-layout",xn);$("cm-layout-section",wn);var Su=1024,
|
|
3704
|
+
`];$("cm-layout",xn);$("cm-layout-section",wn);var Su=1024,Hy=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},Ir,kn,Pe,Lu,Nr,zv,Gl,Yl,$n=class extends S{constructor(){super(...arguments);p(this,Pe);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;p(this,Ir);p(this,kn,null);p(this,Gl,e=>{if(!this.menuItem)return;let t=s(this,Pe,zv).call(this,e),i=e.detail?.value;t==="bottom-navigation"&&i===this.menuItem?s(this,Pe,Nr).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&s(this,Pe,Nr).call(this,!1,!1)});p(this,Yl,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),s(this,Pe,Nr).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,Gl)),this.addEventListener("keydown",r(this,Yl));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=Su)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,Gl)),this.removeEventListener("keydown",r(this,Yl)),r(this,Ir)?.disconnect(),g(this,Ir,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;g(this,Ir,new ResizeObserver(()=>{s(this,Pe,Lu).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=Su!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=Su}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,Ir).observe(t))}updated(e){e.has("_wide")&&s(this,Pe,Lu).call(this)}openMenu(){s(this,Pe,Nr).call(this,!0)}closeMenu(){s(this,Pe,Nr).call(this,!1)}toggleMenu(){s(this,Pe,Nr).call(this,!this.menuOpen)}render(){let e=this._wide,t=this.menuOpen&&!e&&!!this.querySelector(':scope > [slot="mobile-menu"]');return c`<div class="frame ${e?"wide":""}" part="frame">
|
|
3688
3705
|
<div class="probe"></div>
|
|
3689
3706
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
3690
3707
|
<div class="body">
|
|
@@ -3693,7 +3710,7 @@ ${t.label}</button>
|
|
|
3693
3710
|
</div>
|
|
3694
3711
|
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
3695
3712
|
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
3696
|
-
</div>`}};Ir=new WeakMap,kn=new WeakMap,Pe=new WeakSet,Lu=function(){let e=this.renderRoot.querySelector(".frame");if(!e)return;let t=i=>Math.round(this.renderRoot.querySelector(i)?.getBoundingClientRect().height??0);e.style.setProperty("--_header",`${t(".header")}px`),e.style.setProperty("--_bottom",`${this._wide?0:t(".bottom")}px`)},Nr=function(e,t=!0){e!==this.menuOpen&&(e&&g(this,kn,
|
|
3713
|
+
</div>`}};Ir=new WeakMap,kn=new WeakMap,Pe=new WeakSet,Lu=function(){let e=this.renderRoot.querySelector(".frame");if(!e)return;let t=i=>Math.round(this.renderRoot.querySelector(i)?.getBoundingClientRect().height??0);e.style.setProperty("--_header",`${t(".header")}px`),e.style.setProperty("--_bottom",`${this._wide?0:t(".bottom")}px`)},Nr=function(e,t=!0){e!==this.menuOpen&&(e&&g(this,kn,Hy()),this.menuOpen=e,this.dispatchEvent(new CustomEvent("cm-menu-toggle",{bubbles:!0,composed:!0,detail:{open:e}})),this.updateComplete.then(()=>{if(e){let i=this.querySelector(':scope > [slot="mobile-menu"]');(i?.shadowRoot??i)?.querySelector("a[href], button")?.focus()}else t&&(r(this,kn)?.focus(),g(this,kn,null))}))},zv=function(e){return e.composedPath().find(i=>i.parentElement===this)?.getAttribute("slot")??""},Gl=new WeakMap,Yl=new WeakMap,$n.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},panel:{type:Boolean,reflect:!0},_wide:{state:!0}},$n.styles=[k,x`
|
|
3697
3714
|
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
3698
3715
|
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
3699
3716
|
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
@@ -3736,16 +3753,16 @@ ${t.label}</button>
|
|
|
3736
3753
|
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
3737
3754
|
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
3738
3755
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
3739
|
-
`];$("cm-page",En);var Tn,
|
|
3756
|
+
`];$("cm-page",En);var Tn,_v,Cv,Mn=class extends T{constructor(){super(...arguments);p(this,Tn);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?Rn`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:Rn`<circle cx="10" cy="10" r="7.5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M10 6v5M10 13.6v.2" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>`;return c`<div class="banner" part="banner" role=${e}>
|
|
3740
3757
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
3741
3758
|
<div class="body">
|
|
3742
3759
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
3743
3760
|
<div><slot></slot></div>
|
|
3744
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,Tn,
|
|
3761
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,Tn,_v)}></slot></div>
|
|
3745
3762
|
</div>
|
|
3746
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,Tn,
|
|
3763
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,Tn,Cv)}>
|
|
3747
3764
|
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg></button>`:h}
|
|
3748
|
-
</div>`}};Tn=new WeakSet,
|
|
3765
|
+
</div>`}};Tn=new WeakSet,_v=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},Cv=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},Mn.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},Mn.styles=[k,x`
|
|
3749
3766
|
:host { display: block; }
|
|
3750
3767
|
.banner {
|
|
3751
3768
|
display: flex; gap: var(--cm-space-12); align-items: flex-start;
|
|
@@ -3769,7 +3786,7 @@ ${t.label}</button>
|
|
|
3769
3786
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
3770
3787
|
}
|
|
3771
3788
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3772
|
-
`];$("cm-banner",Mn);var
|
|
3789
|
+
`];$("cm-banner",Mn);var z2=z("thumbnail",{noImage:"{alt} (no image)"}),zn=class extends T{constructor(){super(...arguments);this.src="";this.alt="";this.size="medium";this.loading="eager";this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){if(this.src&&!this._failed)return c`<span class="box" part="thumbnail"><img src=${this.src} alt=${this.alt} loading=${this.loading}
|
|
3773
3790
|
@error=${()=>{this._failed=!0}}></span>`;let e=this.size==="small"?18:this.size==="large"?32:24;return c`<span class="box" part="thumbnail" role=${this.alt?"img":h}
|
|
3774
3791
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):h} aria-hidden=${this.alt?h:"true"}>
|
|
3775
3792
|
<cm-icon name="box" size=${e}></cm-icon></span>`}};zn.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},zn.styles=[k,x`
|
|
@@ -3782,7 +3799,7 @@ ${t.label}</button>
|
|
|
3782
3799
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
3783
3800
|
}
|
|
3784
3801
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
3785
|
-
`];$("cm-thumbnail",zn);export{wr as Announcer,Fa as CmAccordion,Pa as CmActionBar,Vr as CmActionMenu,Js as CmAppCard,$n as CmAppFrame,Fs as CmAvatar,pn as CmBadge,Mn as CmBanner,Ms as CmBoard,$r as CmBoardCard,kr as CmBoardColumn,Ws as CmBottomNavigation,tn as CmBottomSheet,Bi as CmButton,Wr as CmButtonGroup,Ds as CmCalendar,Ls as CmCalendarEvent,un as CmCard,ai as CmCheckbox,xi as CmColorField,hi as CmCombobox,pa as CmCommandPalette,Ka as CmComment,Wa as CmCommentBox,ms as CmDataTable,gi as CmDatePicker,fi as CmDateRangePicker,ja as CmEmptyState,yi as CmFileUpload,Qs as CmFilterPanel,Ys as CmFlashOfferBar,tr as CmGlobalSearch,yn as CmGrid,Us as CmHeaderBar,Br as CmIcon,Ba as CmInfoItem,qa as CmInfoPanel,xn as CmLayout,wn as CmLayoutSection,Xs as CmLinkTabs,T as CmLocalizedElement,Fr as CmMenuItem,Os as CmMetric,Gs as CmMobileMenu,Zs as CmModal,qs as CmNavItem,ks as CmNestedItem,$s as CmNestedList,rn as CmNotificationItem,an as CmNotificationPanel,xt as CmOptionGroup,En as CmPage,Ia as CmPageHeader,rs as CmPagination,mn as CmProgressBar,Gi as CmRadio,Yi as CmRadioGroup,zr as CmReportTile,Ps as CmReportTiles,ys as CmResourceItem,xs as CmResourceList,Oa as CmSaveBar,di as CmSearch,Na as CmSegmentedControl,ci as CmSelect,Bs as CmSideNavigation,Mt as CmSidePanel,wi as CmSignatureField,Ua as CmSkeleton,Va as CmSkeletonDisplay,ts as CmSmartTip,is as CmSmartTips,jr as CmSpinner,vn as CmStack,ss as CmStatusTabs,os as CmTableHeader,Zi as CmTag,ri as CmTextField,zn as CmThumbnail,mr as CmTimeline,Qa as CmTimelineItem,on as CmToast,ln as CmToastRegion,ni as CmToggle,Ga as CmTooltip,xr as MoveModel,
|
|
3802
|
+
`];$("cm-thumbnail",zn);export{wr as Announcer,Fa as CmAccordion,Pa as CmActionBar,Vr as CmActionMenu,Js as CmAppCard,$n as CmAppFrame,Fs as CmAvatar,pn as CmBadge,Mn as CmBanner,Ms as CmBoard,$r as CmBoardCard,kr as CmBoardColumn,Ws as CmBottomNavigation,tn as CmBottomSheet,Bi as CmButton,Wr as CmButtonGroup,Ds as CmCalendar,Ls as CmCalendarEvent,un as CmCard,ai as CmCheckbox,xi as CmColorField,hi as CmCombobox,pa as CmCommandPalette,Ka as CmComment,Wa as CmCommentBox,ms as CmDataTable,gi as CmDatePicker,fi as CmDateRangePicker,ja as CmEmptyState,yi as CmFileUpload,Qs as CmFilterPanel,Ys as CmFlashOfferBar,tr as CmGlobalSearch,yn as CmGrid,Us as CmHeaderBar,Br as CmIcon,Ba as CmInfoItem,qa as CmInfoPanel,xn as CmLayout,wn as CmLayoutSection,Xs as CmLinkTabs,T as CmLocalizedElement,Fr as CmMenuItem,Os as CmMetric,Gs as CmMobileMenu,Zs as CmModal,qs as CmNavItem,ks as CmNestedItem,$s as CmNestedList,rn as CmNotificationItem,an as CmNotificationPanel,xt as CmOptionGroup,En as CmPage,Ia as CmPageHeader,rs as CmPagination,mn as CmProgressBar,Gi as CmRadio,Yi as CmRadioGroup,zr as CmReportTile,Ps as CmReportTiles,ys as CmResourceItem,xs as CmResourceList,Oa as CmSaveBar,di as CmSearch,Na as CmSegmentedControl,ci as CmSelect,Bs as CmSideNavigation,Mt as CmSidePanel,wi as CmSignatureField,Ua as CmSkeleton,Va as CmSkeletonDisplay,ts as CmSmartTip,is as CmSmartTips,jr as CmSpinner,vn as CmStack,ss as CmStatusTabs,os as CmTableHeader,Zi as CmTag,ri as CmTextField,zn as CmThumbnail,mr as CmTimeline,Qa as CmTimelineItem,on as CmToast,ln as CmToastRegion,ni as CmToggle,Ga as CmTooltip,xr as MoveModel,Lg as commandMatches,Vv as configure,z as defineStrings,ig as directionalIcons,ae as formatDate,eg as formatMessage,am as formatNumber,jv as getDefaultStrings,sv as initials,mo as isApplePlatform,pf as listNavigation,In as localeFor,km as matchesShortcut,jt as normalizeHex,hc as pluralCategory,Kv as resetStrings,Bg as resolvePreset,Uv as setStrings,rd as shortcutKeys,wv as showToast,mc as translate,Ly as undoable};
|
|
3786
3803
|
/*! Bundled license information:
|
|
3787
3804
|
|
|
3788
3805
|
@lit/reactive-element/css-tag.js:
|