@commmerce/ui 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +287 -285
- package/dist/components/app-frame.js +2 -0
- package/dist/components/calendar.d.ts +6 -1
- package/dist/components/calendar.js +15 -1
- package/dist/components/page.d.ts +2 -1
- package/dist/components/page.js +3 -2
- package/dist/custom-elements.json +20 -1
- package/package.json +3 -3
package/dist/cdn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(o,n,e)=>(Md(o,n,"read from private field"),e?e.call(o):n.get(o)),p=(o,n,e)=>n.has(o)?Gm("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),f=(o,n,e,t)=>(Md(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),
|
|
2
|
-
\f\r]`,Wa=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,rp=/-->/g,sp=/>/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),ap=/'/g,np=/"/g,cp=/^(?:script|style|textarea|title)$/i,Nd=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=Nd(1),Ja=Nd(2),gb=Nd(3),fe=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),op=new WeakMap,
|
|
1
|
+
var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(o,n,e)=>(Md(o,n,"read from private field"),e?e.call(o):n.get(o)),p=(o,n,e)=>n.has(o)?Gm("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),f=(o,n,e,t)=>(Md(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),s=(o,n,e)=>(Md(o,n,"access private method"),e);var nl=globalThis,ol=nl.ShadowRoot&&(nl.ShadyCSS===void 0||nl.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Td=Symbol(),Xm=new WeakMap,Ua=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==Td)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(ol&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=Xm.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&Xm.set(e,n))}return n}toString(){return this.cssText}},ll=o=>new Ua(typeof o=="string"?o:o+"",void 0,Td),y=(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 Ua(e,o,Td)},Jm=(o,n)=>{if(ol)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=nl.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},_d=ol?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return ll(e)})(o):o;var{is:mf,defineProperty:pf,getOwnPropertyDescriptor:uf,getOwnPropertyNames:gf,getOwnPropertySymbols:ff,getPrototypeOf:bf}=Object,cl=globalThis,Zm=cl.trustedTypes,vf=Zm?Zm.emptyScript:"",yf=cl.reactiveElementPolyfillSupport,Ka=(o,n)=>o,zd={toAttribute(o,n){switch(n){case Boolean:o=o?vf: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}},ep=(o,n)=>!mf(o,n),Qm={attribute:!0,type:String,converter:zd,reflect:!1,useDefault:!1,hasChanged:ep};Symbol.metadata??=Symbol("metadata"),cl.litPropertyMetadata??=new WeakMap;var Et=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=Qm){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&&pf(this.prototype,n,i)}}static getPropertyDescriptor(n,e,t){let{get:i,set:a}=uf(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)??Qm}static _$Ei(){if(this.hasOwnProperty(Ka("elementProperties")))return;let n=bf(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(Ka("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ka("properties"))){let e=this.properties,t=[...gf(e),...ff(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(_d(i))}else n!==void 0&&e.push(_d(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 Jm(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:zd).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:zd;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??ep)(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){}};Et.elementStyles=[],Et.shadowRootOptions={mode:"open"},Et[Ka("elementProperties")]=new Map,Et[Ka("finalized")]=new Map,yf?.({ReactiveElement:Et}),(cl.reactiveElementVersions??=[]).push("2.1.2");var Ld=globalThis,tp=o=>o,dl=Ld.trustedTypes,ip=dl?dl.createPolicy("lit-html",{createHTML:o=>o}):void 0,Sd="$lit$",Mt=`lit$${Math.random().toFixed(9).slice(2)}$`,Dd="?"+Mt,xf=`<${Dd}>`,_i=document,Ya=()=>_i.createComment(""),Ga=o=>o===null||typeof o!="object"&&typeof o!="function",Ad=Array.isArray,lp=o=>Ad(o)||typeof o?.[Symbol.iterator]=="function",Cd=`[
|
|
2
|
+
\f\r]`,Wa=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,rp=/-->/g,sp=/>/g,Mi=RegExp(`>|${Cd}(?:([^\\s"'>=/]+)(${Cd}*=${Cd}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ap=/'/g,np=/"/g,cp=/^(?:script|style|textarea|title)$/i,Nd=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=Nd(1),Ja=Nd(2),gb=Nd(3),fe=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),op=new WeakMap,Ti=_i.createTreeWalker(_i,129);function dp(o,n){if(!Ad(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ip!==void 0?ip.createHTML(n):n}var hp=(o,n)=>{let e=o.length-1,t=[],i,a=n===2?"<svg>":n===3?"<math>":"",l=Wa;for(let d=0;d<e;d++){let m=o[d],u,v,b=-1,$=0;for(;$<m.length&&(l.lastIndex=$,v=l.exec(m),v!==null);)$=l.lastIndex,l===Wa?v[1]==="!--"?l=rp:v[1]!==void 0?l=sp:v[2]!==void 0?(cp.test(v[2])&&(i=RegExp("</"+v[2],"g")),l=Mi):v[3]!==void 0&&(l=Mi):l===Mi?v[0]===">"?(l=i??Wa,b=-1):v[1]===void 0?b=-2:(b=l.lastIndex-v[2].length,u=v[1],l=v[3]===void 0?Mi:v[3]==='"'?np:ap):l===np||l===ap?l=Mi:l===rp||l===sp?l=Wa:(l=Mi,i=void 0);let x=l===Mi&&o[d+1].startsWith("/>")?" ":"";a+=l===Wa?m+xf:b>=0?(t.push(u),m.slice(0,b)+Sd+m.slice(b)+Mt+x):m+Mt+(b===-2?d:x)}return[dp(o,a+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},Xa=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]=hp(n,e);if(this.el=o.createElement(u,t),Ti.currentNode=this.el.content,e===2||e===3){let b=this.el.content.firstChild;b.replaceWith(...b.childNodes)}for(;(i=Ti.nextNode())!==null&&m.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let b of i.getAttributeNames())if(b.endsWith(Sd)){let $=v[l++],x=i.getAttribute(b).split(Mt),M=/([.?@])?(.*)/.exec($);m.push({type:1,index:a,name:M[2],strings:x,ctor:M[1]==="."?ml:M[1]==="?"?pl:M[1]==="@"?ul:Ci}),i.removeAttribute(b)}else b.startsWith(Mt)&&(m.push({type:6,index:a}),i.removeAttribute(b));if(cp.test(i.tagName)){let b=i.textContent.split(Mt),$=b.length-1;if($>0){i.textContent=dl?dl.emptyScript:"";for(let x=0;x<$;x++)i.append(b[x],Ya()),Ti.nextNode(),m.push({type:2,index:++a});i.append(b[$],Ya())}}}else if(i.nodeType===8)if(i.data===Dd)m.push({type:2,index:a});else{let b=-1;for(;(b=i.data.indexOf(Mt,b+1))!==-1;)m.push({type:7,index:a}),b+=Mt.length-1}a++}}static createElement(n,e){let t=_i.createElement("template");return t.innerHTML=n,t}};function zi(o,n,e=o,t){if(n===fe)return n;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Ga(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=zi(o,i._$AS(o,n.values),i,t)),n}var hl=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??_i).importNode(e,!0);Ti.currentNode=i;let a=Ti.nextNode(),l=0,d=0,m=t[0];for(;m!==void 0;){if(l===m.index){let u;m.type===2?u=new gr(a,a.nextSibling,this,n):m.type===1?u=new m.ctor(a,m.name,m.strings,this,n):m.type===6&&(u=new gl(a,this,n)),this._$AV.push(u),m=t[++d]}l!==m?.index&&(a=Ti.nextNode(),l++)}return Ti.currentNode=_i,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++}},gr=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=zi(this,n,e),Ga(n)?n===h||n==null||n===""?(this._$AH!==h&&this._$AR(),this._$AH=h):n!==this._$AH&&n!==fe&&this._(n):n._$litType$!==void 0?this.$(n):n.nodeType!==void 0?this.T(n):lp(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&&Ga(this._$AH)?this._$AA.nextSibling.data=n:this.T(_i.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=Xa.createElement(dp(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new hl(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(n){let e=op.get(n.strings);return e===void 0&&op.set(n.strings,e=new Xa(n)),e}k(n){Ad(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(Ya()),this.O(Ya()),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=tp(n).nextSibling;tp(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},Ci=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=zi(this,n,e,0),l=!Ga(n)||n!==this._$AH&&n!==fe,l&&(this._$AH=n);else{let d=n,m,u;for(n=a[0],m=0;m<a.length-1;m++)u=zi(this,d[t+m],e,m),u===fe&&(u=this._$AH[m]),l||=!Ga(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??"")}},ml=class extends Ci{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},pl=class extends Ci{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},ul=class extends Ci{constructor(n,e,t,i,a){super(n,e,t,i,a),this.type=5}_$AI(n,e=this){if((n=zi(this,n,e,0)??h)===fe)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)}},gl=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){zi(this,n)}},mp={M:Sd,P:Mt,A:Dd,C:1,L:hp,R:hl,D:lp,V:zi,I:gr,H:Ci,N:pl,U:ul,B:ml,F:gl},wf=Ld.litHtmlPolyfillSupport;wf?.(Xa,gr),(Ld.litHtmlVersions??=[]).push("3.3.3");var pp=(o,n,e)=>{let t=e?.renderBefore??n,i=t._$litPart$;if(i===void 0){let a=e?.renderBefore??null;t._$litPart$=i=new gr(n.insertBefore(Ya(),a),a,void 0,e??{})}return i._$AI(o),i};var Rd=globalThis,C=class extends Et{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=pp(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return fe}};C._$litElement$=!0,C.finalized=!0,Rd.litElementHydrateSupport?.({LitElement:C});var $f=Rd.litElementPolyfillSupport;$f?.({LitElement:C});(Rd.litElementVersions??=[]).push("4.2.2");var k=y`
|
|
4
4
|
:host {
|
|
5
5
|
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
6
|
color: var(--cm-text-default, #000);
|
|
@@ -11,17 +11,17 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
11
11
|
`,Cb=y`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,kf=0,D=o=>`${o}-${++kf}`;function w(o,n){customElements.get(o)||customElements.define(o,n)}function se(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Ef={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},fl={common:{...Ef}},Za={},Qa={},bl;function _(o,n){return fl[o]={...fl[o],...n},n}function Mf(){return Object.fromEntries(Object.entries(fl).map(([o,n])=>[o,{...n}]))}function vl(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function Tf(o,n){vl(n?Qa[n.toLowerCase()]??={}:Za,o),xl()}function _f(o={}){"locale"in o&&(bl=o.locale||void 0),o.strings&&vl(Za,o.strings);for(let[n,e]of Object.entries(o.translations??{}))vl(Qa[n.toLowerCase()]??={},e);xl()}function zf(){bl=void 0;for(let o of Object.keys(Za))delete Za[o];for(let o of Object.keys(Qa))delete Qa[o];xl()}function en(o){if(bl)return bl;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 up=new Map;function Pd(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,
|
|
14
|
+
`,kf=0,D=o=>`${o}-${++kf}`;function w(o,n){customElements.get(o)||customElements.define(o,n)}function se(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Ef={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},fl={common:{...Ef}},Za={},Qa={},bl;function _(o,n){return fl[o]={...fl[o],...n},n}function Mf(){return Object.fromEntries(Object.entries(fl).map(([o,n])=>[o,{...n}]))}function vl(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function Tf(o,n){vl(n?Qa[n.toLowerCase()]??={}:Za,o),xl()}function _f(o={}){"locale"in o&&(bl=o.locale||void 0),o.strings&&vl(Za,o.strings);for(let[n,e]of Object.entries(o.translations??{}))vl(Qa[n.toLowerCase()]??={},e);xl()}function zf(){bl=void 0;for(let o of Object.keys(Za))delete Za[o];for(let o of Object.keys(Qa))delete Qa[o];xl()}function en(o){if(bl)return bl;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 up=new Map;function Pd(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,a=up.get(i);if(!a){try{a=t(n)}catch{a=t(void 0)}up.set(i,a)}return a}function Od(o,n={},e){return Pd("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function ee(o,n={},e){return Pd("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function yl(o,n){return Pd("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function gp(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[yl(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"?Od(l,{},e):String(l)})}function Cf(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=Qa[d]?.[a]?.[n];if(m!==void 0)return m}let l=Za[a]?.[n]??fl[a]?.[n];if(l!==void 0)return l}}function fp(o,n,e,t,i){let a=en(t);return gp(Cf(o,n,a,i),e,a)}var Id=new Set,Hd;function xl(){for(let o of Id)o.requestUpdate()}function Lf(){Hd||typeof MutationObserver>"u"||typeof document>"u"||(Hd=new MutationObserver(xl),Hd.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var Sf=o=>o.replace(/^cm-/,"").replace(/-([a-z])/g,(n,e)=>e.toUpperCase()),T=class extends C{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 Sf(this.localName)}t(n,e){return fp(this.stringsNamespace,n,e,this,this.strings)}get locale(){return en(this)}formatNumber(n,e){return Od(n,e,this.locale)}connectedCallback(){super.connectedCallback(),Id.add(this),Lf()}disconnectedCallback(){super.disconnectedCallback(),Id.delete(this)}};T.properties={strings:{type:Object}};var wl={"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"},bp=["more","drag"],Ab=Object.keys(wl);var vp=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],fr=class extends C{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=wl[this.name]??wl.more,t=bp.includes(this.name)?3:1.6;return Ja`<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"?vp.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};fr.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},fr.styles=y`
|
|
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
|
-
`;w("cm-icon",fr);var yp=99,Fb=_("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),$l,kl,tn,
|
|
21
|
+
`;w("cm-icon",fr);var yp=99,Fb=_("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),$l,kl,tn,Li=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,$l,this.attachInternals());p(this,kl,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,$l).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});p(this,tn,!1);this.addEventListener("click",r(this,kl),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,tn)&&(f(this,tn,!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`<slot></slot>`,a=e?c`<span class="count" part="count" aria-hidden="true">${e>yp?this.t("countOverflow",{max:yp}):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
|
-
aria-busy=${this.loading?"true":h} aria-label=${d}>${m}</button>`}};$l=new WeakMap,kl=new WeakMap,tn=new WeakMap,
|
|
24
|
+
aria-busy=${this.loading?"true":h} aria-label=${d}>${m}</button>`}};$l=new WeakMap,kl=new WeakMap,tn=new WeakMap,Li.formAssociated=!0,Li.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}},Li.styles=[k,y`
|
|
25
25
|
:host { display: inline-flex; vertical-align: middle; }
|
|
26
26
|
.btn {
|
|
27
27
|
display: inline-flex; align-items: center; justify-content: center; gap: var(--cm-space-8);
|
|
@@ -96,7 +96,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
96
96
|
position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
|
|
97
97
|
box-shadow: 0 0 0 2px var(--cm-bg-surface); pointer-events: none;
|
|
98
98
|
}
|
|
99
|
-
`];w("cm-button",
|
|
99
|
+
`];w("cm-button",Li);var st={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},br=o=>(...n)=>({_$litDirective$:o,values:n}),Ut=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:Df}=mp,xp=o=>o;var $p=o=>o.strings===void 0,wp=()=>document.createComment(""),vr=(o,n,e)=>{let t=o._$AA.parentNode,i=n===void 0?o._$AB:n._$AA;if(e===void 0){let a=t.insertBefore(wp(),i),l=t.insertBefore(wp(),i);e=new Df(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=xp(m).nextSibling;xp(t).insertBefore(m,i),m=u}}}return e},Kt=(o,n,e=o)=>(o._$AI(n,e),o),Af={},El=(o,n=Af)=>o._$AH=n,kp=o=>o._$AH,Ml=o=>{o._$AR(),o._$AA.remove()};var le=br(class extends Ut{constructor(o){if(super(o),o.type!==st.PROPERTY&&o.type!==st.ATTRIBUTE&&o.type!==st.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!$p(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[n]){if(n===fe||n===h)return n;let e=o.element,t=o.name;if(o.type===st.PROPERTY){if(n===e[t])return fe}else if(o.type===st.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return fe}else if(o.type===st.ATTRIBUTE&&e.getAttribute(t)===n+"")return fe;return El(o),n}});var Ve=y`
|
|
100
100
|
:host {
|
|
101
101
|
--_cm-field-h: var(--cm-control-height-md, 36px);
|
|
102
102
|
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
@@ -127,22 +127,22 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
127
127
|
border-radius: var(--cm-radius-sm); cursor: pointer;
|
|
128
128
|
}
|
|
129
129
|
@media (pointer: coarse) { [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
130
|
-
`;var lv=_("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."}),be,Tt,sn,ie,rn,_l,Ep,qd,Mp,Bd,Wt=class extends T{constructor(){super(...arguments);p(this,ie);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,be,this.attachInternals());p(this,Tt,D("cm-tf"));p(this,sn,"")}connectedCallback(){super.connectedCallback(),f(this,sn,this.value)}get form(){return r(this,be).form}get validity(){return r(this,be).validity}get validationMessage(){return r(this,be).validationMessage}checkValidity(){return
|
|
130
|
+
`;var lv=_("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."}),be,Tt,sn,ie,rn,_l,Ep,qd,Mp,Bd,Wt=class extends T{constructor(){super(...arguments);p(this,ie);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,be,this.attachInternals());p(this,Tt,D("cm-tf"));p(this,sn,"")}connectedCallback(){super.connectedCallback(),f(this,sn,this.value)}get form(){return r(this,be).form}get validity(){return r(this,be).validity}get validationMessage(){return r(this,be).validationMessage}checkValidity(){return s(this,ie,rn).call(this),r(this,be).checkValidity()}reportValidity(){return s(this,ie,rn).call(this),r(this,be).reportValidity()}formResetCallback(){this.value=r(this,sn),this.error=""}formDisabledCallback(e){this.disabled=e}updated(){r(this,be).setFormValue(this.value),s(this,ie,rn).call(this)}render(){let e=[this.error&&`${r(this,Tt)}-err`,this.helpText&&`${r(this,Tt)}-help`].filter(Boolean).join(" ")||h,t={id:r(this,Tt),invalid:this.error?"true":h},i=this.multiline?c`<textarea class="input" part="input" id=${t.id} rows=${this.rows}
|
|
131
131
|
.value=${le(this.value)} placeholder=${this.placeholder||h}
|
|
132
132
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
133
133
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
134
|
-
@input=${
|
|
134
|
+
@input=${s(this,ie,qd)} @change=${s(this,ie,Bd)}></textarea>`:c`<input class="input" part="input" id=${t.id} type=${this.type}
|
|
135
135
|
.value=${le(this.value)} placeholder=${this.placeholder||h}
|
|
136
136
|
autocomplete=${this.autocomplete??h}
|
|
137
137
|
min=${this.min||h} max=${this.max||h} step=${this.step||h}
|
|
138
138
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
139
139
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
140
|
-
@input=${
|
|
140
|
+
@input=${s(this,ie,qd)} @change=${s(this,ie,Bd)} @blur=${s(this,ie,Mp)} />`;return c`<div class="field">
|
|
141
141
|
${this.label?c`<label class="label" for=${r(this,Tt)} 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}
|
|
142
142
|
${i}
|
|
143
143
|
${this.error?c`<p class="error" id="${r(this,Tt)}-err" role="alert">${this.error}</p>`:h}
|
|
144
144
|
${this.helpText?c`<p class="help" id="${r(this,Tt)}-help">${this.helpText}</p>`:h}
|
|
145
|
-
</div>`}};be=new WeakMap,Tt=new WeakMap,sn=new WeakMap,ie=new WeakSet,rn=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,be).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,be).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.required&&!this.value?r(this,be).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,be).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:
|
|
145
|
+
</div>`}};be=new WeakMap,Tt=new WeakMap,sn=new WeakMap,ie=new WeakSet,rn=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,be).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,be).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.required&&!this.value?r(this,be).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,be).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:s(this,ie,_l).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,be).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:s(this,ie,_l).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,be).setValidity({stepMismatch:!0},this.t("stepMismatch",s(this,ie,Ep).call(this,e)),e??void 0):r(this,be).setValidity({})},_l=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?ee(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"?ee(a,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"},t):ee(a,{day:"numeric",month:"short",year:"numeric"},t)},Ep=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 $=new Date(v).toISOString();return s(this,ie,_l).call(this,this.type==="time"?$.slice(11,16):this.type==="date"?$.slice(0,10):$.slice(0,16))};return{lower:u(m),upper:u(m+i)}},qd=function(e){this.value=e.target.value},Mp=function(){s(this,ie,rn).call(this)},Bd=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Wt.formAssociated=!0,Wt.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Wt.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:{}},Wt.styles=[k,Ve,y`
|
|
146
146
|
:host { display: block; }
|
|
147
147
|
.input {
|
|
148
148
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -156,13 +156,13 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
156
156
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
157
157
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
158
158
|
:host([error]:not([error=''])) .input { border-color: var(--cm-border-critical); }
|
|
159
|
-
`];w("cm-text-field",Wt);var uv=_("checkbox",{required:"Please tick this box."}),Gt,
|
|
160
|
-
<input type="checkbox" id=${r(this,
|
|
159
|
+
`];w("cm-text-field",Wt);var uv=_("checkbox",{required:"Please tick this box."}),Gt,Si,an,zl,Tp,Yt=class extends T{constructor(){super(...arguments);p(this,zl);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;p(this,Gt,this.attachInternals());p(this,Si,D("cm-cb"));p(this,an,!1)}connectedCallback(){super.connectedCallback(),f(this,an,this.checked)}get form(){return r(this,Gt).form}checkValidity(){return r(this,Gt).checkValidity()}formResetCallback(){this.checked=r(this,an)}formDisabledCallback(e){this.disabled=e}updated(){r(this,Gt).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,Gt).setValidity({valueMissing:!0},this.t("required")):r(this,Gt).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,Si)}>
|
|
160
|
+
<input type="checkbox" id=${r(this,Si)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
161
161
|
?disabled=${this.disabled} ?required=${this.required}
|
|
162
|
-
aria-describedby=${this.description?`${r(this,
|
|
162
|
+
aria-describedby=${this.description?`${r(this,Si)}-d`:h} @change=${s(this,zl,Tp)} />
|
|
163
163
|
<span class="box" part="box">${e}</span>
|
|
164
|
-
${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,
|
|
165
|
-
</label>`}};Gt=new WeakMap,
|
|
164
|
+
${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,Si)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
165
|
+
</label>`}};Gt=new WeakMap,Si=new WeakMap,an=new WeakMap,zl=new WeakSet,Tp=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Yt.formAssociated=!0,Yt.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Yt.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},Yt.styles=[k,y`
|
|
166
166
|
:host { display: inline-flex; }
|
|
167
167
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
168
168
|
/* The 16px box sits on the label's first line (20px); the invisible input around it is a 24px target. */
|
|
@@ -180,12 +180,12 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
180
180
|
:host([disabled]) label { cursor: not-allowed; }
|
|
181
181
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
182
182
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
183
|
-
`];w("cm-checkbox",Yt);var nn,
|
|
183
|
+
`];w("cm-checkbox",Yt);var nn,Ai=class extends C{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;p(this,nn,D("cm-radio"))}render(){let e=this.description?`${r(this,nn)}-d`:null;return c`<div class="radio" part="radio" role="radio" id=${r(this,nn)}
|
|
184
184
|
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":h}
|
|
185
185
|
aria-describedby=${e??h} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
186
186
|
<span class="dot" part="dot"></span>
|
|
187
187
|
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?c`<span class="desc" id=${e}>${this.description}</span>`:h}</span>
|
|
188
|
-
</div>`}};nn=new WeakMap,
|
|
188
|
+
</div>`}};nn=new WeakMap,Ai.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Ai.properties={label:{},description:{},value:{reflect:!0},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},groupDisabled:{type:Boolean,reflect:!0,attribute:"group-disabled"},_tabbable:{state:!0}},Ai.styles=[k,y`
|
|
189
189
|
:host { display: inline-flex; }
|
|
190
190
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; outline: none; }
|
|
191
191
|
.dot {
|
|
@@ -205,16 +205,16 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
205
205
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
206
206
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
207
207
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
208
|
-
`];w("cm-radio",
|
|
209
|
-
aria-labelledby=${
|
|
208
|
+
`];w("cm-radio",Ai);var xv=_("radioGroup",{required:"Please select one of these options."}),Ue,_t,on,ln,cn,yr,te,Fd,Ll,Di,jd,xr,Vd,Sl,Dl,Cl,Ni=class extends T{constructor(){super();p(this,te);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;p(this,Ue,this.attachInternals());p(this,_t,D("cm-rg"));p(this,on,"");p(this,ln,!0);p(this,cn,!1);p(this,yr,!1);p(this,Ll,()=>{s(this,te,Fd).call(this),r(this,xr).call(this)});p(this,xr,()=>{let e=s(this,te,Di).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,te,jd).call(this)[0];for(let a of e)a._tabbable=a===i&&!this.disabled});p(this,Sl,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||s(this,te,Vd).call(this,t,!0)});p(this,Dl,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let i=s(this,te,jd).call(this),a=i.indexOf(t),l=se(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,te,Vd).call(this,d,!0)});this.addEventListener("keydown",r(this,Dl)),this.addEventListener("click",r(this,Sl))}connectedCallback(){super.connectedCallback(),s(this,te,Fd).call(this)}get form(){return r(this,Ue).form}get validity(){return r(this,Ue).validity}get validationMessage(){return r(this,Ue).validationMessage}checkValidity(){return r(this,Ue).checkValidity()}reportValidity(){return r(this,Ue).reportValidity()}formResetCallback(){this.value=r(this,on)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(s(this,te,Di).call(this).find(t=>t._tabbable)??s(this,te,Di).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,cn)&&!r(this,yr)&&f(this,ln,!1),f(this,cn,!0),r(this,xr).call(this),r(this,Ue).setFormValue(this.value||null,this.value);let t=s(this,te,Di).call(this)[0];this.error?r(this,Ue).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Ue).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ue).setValidity({})}render(){let e=[this.error&&`${r(this,_t)}-err`,this.helpText&&`${r(this,_t)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
209
|
+
aria-labelledby=${s(this,te,Cl).call(this)?`${r(this,_t)}-l`:h} aria-label=${s(this,te,Cl).call(this)?h:this.getAttribute("aria-label")??h}
|
|
210
210
|
aria-describedby=${e||h}
|
|
211
211
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
212
212
|
aria-disabled=${this.disabled?"true":h}>
|
|
213
|
-
<span class="label" id="${r(this,_t)}-l" part="label" ?hidden=${!
|
|
213
|
+
<span class="label" id="${r(this,_t)}-l" part="label" ?hidden=${!s(this,te,Cl).call(this)}>${this.label}<slot name="label"></slot>${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
214
214
|
${this.helpText?c`<p class="help" id="${r(this,_t)}-help">${this.helpText}</p>`:h}
|
|
215
215
|
${this.error?c`<p class="error" id="${r(this,_t)}-err" role="alert">${this.error}</p>`:h}
|
|
216
216
|
<div class="options" part="options"><slot @slotchange=${r(this,Ll)}></slot></div>
|
|
217
|
-
</div>`}};Ue=new WeakMap,_t=new WeakMap,on=new WeakMap,ln=new WeakMap,cn=new WeakMap,yr=new WeakMap,te=new WeakSet,Fd=function(){r(this,ln)&&(this.value||(f(this,yr,!0),this.value=
|
|
217
|
+
</div>`}};Ue=new WeakMap,_t=new WeakMap,on=new WeakMap,ln=new WeakMap,cn=new WeakMap,yr=new WeakMap,te=new WeakSet,Fd=function(){r(this,ln)&&(this.value||(f(this,yr,!0),this.value=s(this,te,Di).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>f(this,yr,!1))),f(this,on,this.value))},Ll=new WeakMap,Di=function(){return[...this.querySelectorAll("cm-radio")]},jd=function(){return s(this,te,Di).call(this).filter(e=>!e.disabled&&!this.disabled)},xr=new WeakMap,Vd=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,r(this,xr).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Sl=new WeakMap,Dl=new WeakMap,Cl=function(){return!!this.label||!!this.querySelector("[slot=label]")},Ni.formAssociated=!0,Ni.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{reflect:!0},orientation:{reflect:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},Ni.styles=[k,y`
|
|
218
218
|
:host { display: block; }
|
|
219
219
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
220
220
|
.label { font-size: var(--cm-type-label-size); line-height: var(--cm-type-label-line-height); font-weight: var(--cm-type-label-weight); color: var(--cm-text-default); }
|
|
@@ -223,13 +223,13 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
223
223
|
.error { color: var(--cm-text-critical); }
|
|
224
224
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
225
225
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
226
|
-
`];w("cm-radio-group",
|
|
227
|
-
<input type="checkbox" role="switch" id=${r(this,
|
|
226
|
+
`];w("cm-radio-group",Ni);var wr,Ri,dn,Al,_p,Xt=class extends C{constructor(){super(...arguments);p(this,Al);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;p(this,wr,this.attachInternals());p(this,Ri,D("cm-tg"));p(this,dn,!1)}connectedCallback(){super.connectedCallback(),f(this,dn,this.checked)}get form(){return r(this,wr).form}checkValidity(){return r(this,wr).checkValidity()}formResetCallback(){this.checked=r(this,dn)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,wr).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${r(this,Ri)}>
|
|
227
|
+
<input type="checkbox" role="switch" id=${r(this,Ri)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
228
228
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
229
|
-
aria-describedby=${this.description?`${r(this,
|
|
229
|
+
aria-describedby=${this.description?`${r(this,Ri)}-d`:h} @change=${s(this,Al,_p)} />
|
|
230
230
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
231
|
-
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,
|
|
232
|
-
</label>`}};wr=new WeakMap,
|
|
231
|
+
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Ri)}-d">${this.description}</span>`:h}</span>`:h}
|
|
232
|
+
</label>`}};wr=new WeakMap,Ri=new WeakMap,dn=new WeakMap,Al=new WeakSet,_p=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Xt.formAssociated=!0,Xt.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Xt.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},Xt.styles=[k,y`
|
|
233
233
|
:host { display: inline-flex; }
|
|
234
234
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
235
235
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -276,24 +276,24 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
276
276
|
}
|
|
277
277
|
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
278
278
|
.gopts { list-style: none; margin: 0; padding: 0; }
|
|
279
|
-
`;function kr(o){if(!o.some(t=>t.group))return o;let n=[],e=new Map;for(let t of o)if(t.group){let i=e.get(t.group);if(i)i.push(t);else{let
|
|
279
|
+
`;function kr(o){if(!o.some(t=>t.group))return o;let n=[],e=new Map;for(let t of o)if(t.group){let i=e.get(t.group);if(i)i.push(t);else{let a=[t];e.set(t.group,a),n.push({key:t.group,items:a})}}else{let i=n[n.length-1];i&&!i.key?i.items.push(t):n.push({key:"",items:[t]})}return n.flatMap(t=>t.items)}function Hl(o){let n=[];return o.forEach((e,t)=>{let i=e.group||"",a=n[n.length-1];a&&a.group===i?a.rows.push({row:e,index:t}):n.push({group:i,rows:[{row:e,index:t}]})}),n}var Nv=_("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),Ke,de,Mr,at,Tr,mn,P,Ud,Kd,hn,Er,Hi,Jt,Il,Pl,pn,Ol,zp,ql,Zt=class extends T{constructor(){super(...arguments);p(this,P);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._active=-1;this._slotted=[];p(this,Ke,this.attachInternals());p(this,de,D("cm-sel"));p(this,Mr,"");p(this,at,"");p(this,Tr,0);p(this,mn,new MutationObserver(()=>s(this,P,Ud).call(this)));p(this,Pl,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),s(this,P,hn).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),s(this,P,hn).call(this),s(this,P,Jt).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,P,Il).call(this,t);s(this,P,hn).call(this,i>=0?i:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?s(this,P,Hi).call(this,this._active):s(this,P,Jt).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?s(this,P,Hi).call(this,this._active):s(this,P,Jt).call(this,-1);break;case"Home":e.preventDefault(),s(this,P,Jt).call(this,"first");break;case"End":e.preventDefault(),s(this,P,Jt).call(this,"last");break;case"PageDown":e.preventDefault(),s(this,P,Jt).call(this,10);break;case"PageUp":e.preventDefault(),s(this,P,Jt).call(this,-10);break;case"Enter":e.preventDefault(),s(this,P,Hi).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),s(this,P,Er).call(this);break;case"Tab":s(this,P,Hi).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,at)&&Date.now()-r(this,Tr)<500){let i=s(this,P,Il).call(this," ");i>=0&&(this._active=i)}else s(this,P,Hi).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,P,Il).call(this,t);i>=0&&(this._active=i)}}});p(this,pn,e=>{this.open&&!e.composedPath().includes(this)&&s(this,P,Er).call(this)});p(this,Ol,()=>{this.disabled||(this.open?s(this,P,Er).call(this):s(this,P,hn).call(this))});p(this,ql,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),s(this,P,Ud).call(this),r(this,mn).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,pn),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,mn).disconnect(),document.removeEventListener("pointerdown",r(this,pn),!0)}get form(){return r(this,Ke).form}get validity(){return r(this,Ke).validity}get validationMessage(){return r(this,Ke).validationMessage}checkValidity(){return r(this,Ke).checkValidity()}reportValidity(){return r(this,Ke).reportValidity()}formResetCallback(){this.value=r(this,Mr),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?kr(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):kr(this._slotted)}firstUpdated(){r(this,Mr)||f(this,Mr,this.value)}updated(e){r(this,Ke).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,Ke).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Ke).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ke).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,de)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(d=>d.value===this.value),i=[this.error&&`${r(this,de)}-err`,this.helpText&&`${r(this,de)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=(d,m)=>c`<li role="option" id="${r(this,de)}-o${m}" class=${m===this._active?"active":""}
|
|
280
280
|
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":h}
|
|
281
|
-
@pointerenter=${()=>!d.disabled&&(this._active=m)} @click=${()=>
|
|
281
|
+
@pointerenter=${()=>!d.disabled&&(this._active=m)} @click=${()=>s(this,P,Hi).call(this,m)}>${d.label}</li>`;return c`<div class="field">
|
|
282
282
|
${this.label?c`<span class="label" id="${r(this,de)}-l" part="label" @click=${r(this,ql)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
283
283
|
<div class="wrap">
|
|
284
284
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
285
285
|
aria-labelledby=${this.label?`${r(this,de)}-l`:h}
|
|
286
|
-
aria-label=${!this.label&&
|
|
286
|
+
aria-label=${!this.label&&a?a:h}
|
|
287
287
|
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,de)}-list"
|
|
288
288
|
aria-activedescendant=${this.open&&this._active>=0?`${r(this,de)}-o${this._active}`:h}
|
|
289
289
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
290
290
|
aria-disabled=${this.disabled?"true":h} aria-describedby=${i||h}
|
|
291
|
-
@click=${r(this,Ol)} @keydown=${r(this,Pl)} @blur=${()=>
|
|
292
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,de)}-v">${t?
|
|
291
|
+
@click=${r(this,Ol)} @keydown=${r(this,Pl)} @blur=${()=>s(this,P,Er).call(this)}>
|
|
292
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,de)}-v">${t?s(this,P,zp).call(this,t):this.placeholder}</span>
|
|
293
293
|
<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>
|
|
294
294
|
</div>
|
|
295
295
|
<ul role="listbox" id="${r(this,de)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,de)}-l`:h}
|
|
296
|
-
aria-label=${!this.label&&
|
|
296
|
+
aria-label=${!this.label&&a?a:h} ?hidden=${!this.open}
|
|
297
297
|
@pointerdown=${d=>d.preventDefault()}>
|
|
298
298
|
${Hl(e).map((d,m)=>d.group?c`<li role="group" aria-labelledby="${r(this,de)}-g${m}"><div role="presentation" class="gh" id="${r(this,de)}-g${m}">${d.group}</div>
|
|
299
299
|
<ul role="none" class="gopts">${d.rows.map(({row:u,index:v})=>l(u,v))}</ul></li>`:d.rows.map(({row:u,index:v})=>l(u,v)))}
|
|
@@ -302,7 +302,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
302
302
|
${this.error?c`<p class="error" id="${r(this,de)}-err" role="alert">${this.error}</p>`:h}
|
|
303
303
|
${this.helpText?c`<p class="help" id="${r(this,de)}-help">${this.helpText}</p>`:h}
|
|
304
304
|
<slot></slot>
|
|
305
|
-
</div>`}};Ke=new WeakMap,de=new WeakMap,Mr=new WeakMap,at=new WeakMap,Tr=new WeakMap,mn=new WeakMap,P=new WeakSet,Ud=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,
|
|
305
|
+
</div>`}};Ke=new WeakMap,de=new WeakMap,Mr=new WeakMap,at=new WeakMap,Tr=new WeakMap,mn=new WeakMap,P=new WeakSet,Ud=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??"",f(this,Mr,this.value))},Kd=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},hn=function(e){if(this.disabled)return;let t=this.items.findIndex(i=>i.value===this.value);this.open=!0,this._active=e??(t>=0?t:s(this,P,Kd).call(this)[0]??-1)},Er=function(){this.open=!1},Hi=function(e){let t=this.items[e];!t||t.disabled||(s(this,P,Er).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}))))},Jt=function(e){let t=s(this,P,Kd).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))]},Il=function(e){let t=Date.now();f(this,at,t-r(this,Tr)>500?e:r(this,at)+e),f(this,Tr,t);let i=this.items,a=this._active<0?0:this._active,l=r(this,at).split("").every(u=>u===r(this,at)[0]),d=l?r(this,at)[0]:r(this,at),m=l||r(this,at).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},Pl=new WeakMap,pn=new WeakMap,Ol=new WeakMap,zp=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},ql=new WeakMap,Zt.formAssociated=!0,Zt.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Zt.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},_active:{state:!0},_slotted:{state:!0}},Zt.styles=[k,Ve,Tl,$r,y`
|
|
306
306
|
:host { display: block; position: relative; }
|
|
307
307
|
.label { cursor: default; }
|
|
308
308
|
.wrap { position: relative; }
|
|
@@ -335,12 +335,12 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
335
335
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
336
336
|
<input id=${r(this,Bl)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
337
337
|
aria-label=${this.label} .value=${le(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
338
|
-
@input=${
|
|
339
|
-
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${
|
|
338
|
+
@input=${s(this,we,Cp)} @change=${()=>s(this,we,_r).call(this,"change")} @keydown=${s(this,we,Lp)} />
|
|
339
|
+
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,we,Wd)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
340
340
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
341
341
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
342
|
-
@click=${()=>
|
|
343
|
-
</div>`}};zr=new WeakMap,Bl=new WeakMap,un=new WeakMap,we=new WeakSet,_r=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Cp=function(e){this.value=e.target.value},Lp=function(e){e.key==="Enter"?
|
|
342
|
+
@click=${()=>s(this,we,_r).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}
|
|
343
|
+
</div>`}};zr=new WeakMap,Bl=new WeakMap,un=new WeakMap,we=new WeakSet,_r=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Cp=function(e){this.value=e.target.value},Lp=function(e){e.key==="Enter"?s(this,we,_r).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),s(this,we,Wd).call(this))},Wd=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),s(this,we,_r).call(this,"input"),s(this,we,_r).call(this,"change")},Qt.formAssociated=!0,Qt.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Qt.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}},Qt.styles=[k,Ve,y`
|
|
344
344
|
:host { display: block; }
|
|
345
345
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
346
346
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -372,7 +372,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
372
372
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
373
373
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
374
374
|
:host([disabled]) button { cursor: not-allowed; }
|
|
375
|
-
`];w("cm-search",Qt);var Gv=_("tag",{remove:"Remove {label}"}),Fl,Sp,Cr=class extends T{constructor(){super(...arguments);p(this,Fl);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=${
|
|
375
|
+
`];w("cm-search",Qt);var Gv=_("tag",{remove:"Remove {label}"}),Fl,Sp,Cr=class extends T{constructor(){super(...arguments);p(this,Fl);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,Fl,Sp)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};Fl=new WeakSet,Sp=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Cr.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Cr.styles=[k,y`
|
|
376
376
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
377
377
|
.tag {
|
|
378
378
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -408,17 +408,17 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
408
408
|
}
|
|
409
409
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
410
410
|
@media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
|
|
411
|
-
`];w("cm-spinner",Lr);var cy=_("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}"}),Ce,he,yn,Ar,xn,wn,$n,L,Yd,Dp,gn,jl,fn,Sr,Dr,ei,Ap,bn,Gd,Xd,vn,Vl,Ul,Kl,Np,ti=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._query="";this._active=-1;this._slotted=[];this._typing=!1;p(this,Ce,this.attachInternals());p(this,he,D("cm-cb"));p(this,yn,null);p(this,Ar,new Map);p(this,xn,new Map);p(this,wn,new MutationObserver(()=>
|
|
412
|
-
`):[]:this.value=e)}get items(){return this.options?.length?kr(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):kr(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(){f(this,yn,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,Ar).set(t.value,t.label),t.group&&r(this,xn).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?
|
|
413
|
-
`))}else r(this,Ce).setFormValue(null);else r(this,Ce).setFormValue(this.value||null,this.value);let i=this.multiple?!this.values.length:!this.value;this.error?r(this,Ce).setValidity({customError:!0},this.error,t):this.required&&i?r(this,Ce).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),t):r(this,Ce).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,he)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),
|
|
414
|
-
aria-selected=${m.create?"false":
|
|
415
|
-
@pointerenter=${()=>!m.disabled&&(this._active=u)} @click=${()=>
|
|
416
|
-
${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>${
|
|
411
|
+
`];w("cm-spinner",Lr);var cy=_("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}"}),Ce,he,yn,Ar,xn,wn,$n,L,Yd,Dp,gn,jl,fn,Sr,Dr,ei,Ap,bn,Gd,Xd,vn,Vl,Ul,Kl,Np,ti=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._query="";this._active=-1;this._slotted=[];this._typing=!1;p(this,Ce,this.attachInternals());p(this,he,D("cm-cb"));p(this,yn,null);p(this,Ar,new Map);p(this,xn,new Map);p(this,wn,new MutationObserver(()=>s(this,L,Yd).call(this)));p(this,$n);p(this,Vl,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,s(this,L,Dr).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});p(this,Ul,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?s(this,L,bn).call(this,1):(s(this,L,Dr).call(this),e.altKey||s(this,L,bn).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?s(this,L,bn).call(this,-1):(s(this,L,Dr).call(this),s(this,L,bn).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),s(this,L,Gd).call(this,this._active)):r(this,L,jl)&&(e.preventDefault(),s(this,L,Xd).call(this,r(this,L,jl)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),s(this,L,ei).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",s(this,L,Sr).call(this)));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,ei).call(this);break;default:}});p(this,Kl,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(s(this,L,ei).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?s(this,L,gn).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),s(this,L,Yd).call(this),r(this,wn).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),f(this,$n,Rl(this,()=>this.open,()=>s(this,L,ei).call(this)))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,wn).disconnect(),(e=r(this,$n))==null||e.call(this)}get form(){return r(this,Ce).form}get validity(){return r(this,Ce).validity}get validationMessage(){return r(this,Ce).validationMessage}checkValidity(){return r(this,Ce).checkValidity()}reportValidity(){return r(this,Ce).reportValidity()}formResetCallback(){let e=r(this,yn)??{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(`
|
|
412
|
+
`):[]:this.value=e)}get items(){return this.options?.length?kr(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):kr(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(){f(this,yn,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,Ar).set(t.value,t.label),t.group&&r(this,xn).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,gn).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=s(this,L,fn).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,Ce).setFormValue(a,this.values.join(`
|
|
413
|
+
`))}else r(this,Ce).setFormValue(null);else r(this,Ce).setFormValue(this.value||null,this.value);let i=this.multiple?!this.values.length:!this.value;this.error?r(this,Ce).setValidity({customError:!0},this.error,t):this.required&&i?r(this,Ce).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),t):r(this,Ce).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,he)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),s(this,L,Sr).call(this))}render(){let e=s(this,L,fn).call(this),t=[this.error&&`${r(this,he)}-err`,this.helpText&&`${r(this,he)}-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,he)}-o${u}" class=${u===this._active?"active":""}
|
|
414
|
+
aria-selected=${m.create?"false":a(m.value)?"true":"false"} aria-disabled=${m.disabled?"true":h}
|
|
415
|
+
@pointerenter=${()=>!m.disabled&&(this._active=u)} @click=${()=>s(this,L,Gd).call(this,u)}>
|
|
416
|
+
${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,Np).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">
|
|
417
417
|
${this.label?c`<label class="label" id="${r(this,he)}-l" for="${r(this,he)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
418
418
|
<div class="wrap">
|
|
419
|
-
<div class="box" part="box" @click=${m=>{m.target.closest("cm-tag")||
|
|
420
|
-
${this.multiple?this.values.map(m=>c`<cm-tag removable ?disabled=${this.disabled} remove-label=${this.t("remove",{label:
|
|
421
|
-
@cm-remove=${()=>{this.removeValue(m),
|
|
419
|
+
<div class="box" part="box" @click=${m=>{m.target.closest("cm-tag")||s(this,L,vn).call(this)}}>
|
|
420
|
+
${this.multiple?this.values.map(m=>c`<cm-tag removable ?disabled=${this.disabled} remove-label=${this.t("remove",{label:s(this,L,gn).call(this,m)})}
|
|
421
|
+
@cm-remove=${()=>{this.removeValue(m),s(this,L,vn).call(this)}}>${s(this,L,gn).call(this,m)}</cm-tag>`):h}
|
|
422
422
|
<input id="${r(this,he)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
423
423
|
.value=${le(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
424
424
|
aria-label=${!this.label&&i?i:h}
|
|
@@ -427,8 +427,8 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
427
427
|
aria-invalid=${this.error?"true":h} aria-describedby=${t||h}
|
|
428
428
|
aria-required=${this.required?"true":h} ?disabled=${this.disabled}
|
|
429
429
|
@input=${r(this,Vl)} @keydown=${r(this,Ul)} @blur=${r(this,Kl)}
|
|
430
|
-
@click=${()=>{this.open||
|
|
431
|
-
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?
|
|
430
|
+
@click=${()=>{this.open||s(this,L,Dr).call(this)}} @change=${m=>m.stopPropagation()} />
|
|
431
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,L,ei).call(this):(s(this,L,Dr).call(this),s(this,L,vn).call(this))}}></cm-icon>
|
|
432
432
|
</div>
|
|
433
433
|
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${m=>m.preventDefault()}>
|
|
434
434
|
<ul role="listbox" id="${r(this,he)}-list" part="listbox" ?hidden=${!e.length}
|
|
@@ -444,7 +444,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
444
444
|
${this.error?c`<p class="error" id="${r(this,he)}-err" role="alert">${this.error}</p>`:h}
|
|
445
445
|
${this.helpText?c`<p class="help" id="${r(this,he)}-help">${this.helpText}</p>`:h}
|
|
446
446
|
<slot></slot>
|
|
447
|
-
</div>`}};Ce=new WeakMap,he=new WeakMap,yn=new WeakMap,Ar=new WeakMap,xn=new WeakMap,wn=new WeakMap,$n=new WeakMap,L=new WeakSet,Yd=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,
|
|
447
|
+
</div>`}};Ce=new WeakMap,he=new WeakMap,yn=new WeakMap,Ar=new WeakMap,xn=new WeakMap,wn=new WeakMap,$n=new WeakMap,L=new WeakSet,Yd=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])}},Dp=function(e){return this.items.find(t=>t.value===e)?.label??r(this,Ar).get(e)??e},gn=function(e){let t=s(this,L,Dp).call(this,e);if(!this.showGroup)return t;let i=this.items.find(a=>a.value===e)?.group??r(this,xn).get(e);return i?this.t("grouped",{group:i,label:t}):t},jl=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},fn=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,L,jl);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},Sr=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Dr=function(){this.disabled||(this.open=!0)},ei=function(){this.open=!1,this._active=-1},Ap=function(e=s(this,L,fn).call(this)){return e.flatMap((t,i)=>t.disabled?[]:[i])},bn=function(e){let t=s(this,L,Ap).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]},Gd=function(e){let t=s(this,L,fn).call(this)[e];if(!(!t||t.disabled)){if(t.create){s(this,L,Xd).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,Sr).call(this),s(this,L,vn).call(this);return}s(this,L,ei).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,Sr).call(this))}},Xd=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,Ar).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(s(this,L,ei).call(this),this.value=e,this._typing=!1,this._query=e),s(this,L,Sr).call(this))},vn=function(){this.renderRoot.querySelector("input")?.focus()},Vl=new WeakMap,Ul=new WeakMap,Kl=new WeakMap,Np=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)}`},ti.formAssociated=!0,ti.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},ti.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"},_query:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},ti.styles=[k,Ve,Nl,Tl,$r,y`
|
|
448
448
|
:host { display: block; position: relative; }
|
|
449
449
|
.wrap { position: relative; }
|
|
450
450
|
.box {
|
|
@@ -477,9 +477,9 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
477
477
|
.create { font-style: normal; }
|
|
478
478
|
slot { display: none; }
|
|
479
479
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
480
|
-
`];w("cm-combobox",ti);var by=_("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),We,kn,Y,Wl,Yl,Nr,Jd,Gl,Rp,Xl,En,Zd,Hp,
|
|
480
|
+
`];w("cm-combobox",ti);var by=_("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),We,kn,Y,Wl,Yl,Nr,Jd,Gl,Rp,Xl,En,Zd,Hp,Ii=class extends T{constructor(){super(...arguments);p(this,Y);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;p(this,We,D("cm-gs"));p(this,kn);p(this,Gl,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),s(this,Y,Jd).call(this)});p(this,Xl,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),s(this,Y,Rp).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,Y,Yl)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,We)}-o${this._active}`)?.click());break;case"Escape":r(this,Y,Yl)?(e.preventDefault(),e.stopPropagation(),s(this,Y,Nr).call(this)):this.value&&(e.preventDefault(),s(this,Y,Zd).call(this,!1));break;case"Tab":s(this,Y,Nr).call(this);break;default:}});p(this,En,e=>{if(!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented)return;let t=e.composedPath()[0];t&&(t.isContentEditable||/^(input|textarea|select)$/i.test(t.localName??""))||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),f(this,kn,Rl(this,()=>this.open,()=>s(this,Y,Nr).call(this))),document.addEventListener("keydown",r(this,En))}disconnectedCallback(){var e;super.disconnectedCallback(),(e=r(this,kn))==null||e.call(this),document.removeEventListener("keydown",r(this,En))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=s(this,Y,Wl).call(this).length&&(this._active=-1)}updated(e){(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,We)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=s(this,Y,Wl).call(this),t=r(this,Y,Yl),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="")=>{l++;let $=l;return c`<a role="option" id="${r(this,We)}-o${$}" class="${b}${$===this._active?" active":""}" href=${u.href} tabindex="-1"
|
|
481
481
|
aria-selected=${$===this._active?"true":"false"} @pointerenter=${()=>this._active=$}
|
|
482
|
-
@click=${x=>
|
|
482
|
+
@click=${x=>s(this,Y,Hp).call(this,x,u)}>${v}</a>`};return c`<div class="wrap">
|
|
483
483
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
484
484
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
485
485
|
|
|
@@ -490,7 +490,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
490
490
|
aria-keyshortcuts=${this.shortcut||h}
|
|
491
491
|
@input=${r(this,Gl)} @keydown=${r(this,Xl)}
|
|
492
492
|
@focus=${()=>{this.value.trim()&&(this.open=!0)}} @click=${()=>{this.value.trim()&&(this.open=!0)}} />
|
|
493
|
-
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>
|
|
493
|
+
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,Y,Zd).call(this)}><cm-icon name="close" size="14"></cm-icon></button>`:this.shortcut?c`<kbd aria-hidden="true">${this.shortcut}</kbd>`:h}
|
|
494
494
|
</div>
|
|
495
495
|
<div class="pop" part="popover" ?hidden=${!t} @pointerdown=${u=>u.preventDefault()}>
|
|
496
496
|
<div role="listbox" id="${r(this,We)}-list" part="listbox" aria-label=${this.label} ?hidden=${!e.length}>
|
|
@@ -502,8 +502,8 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
502
502
|
</div>
|
|
503
503
|
${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>`}
|
|
504
504
|
</div>
|
|
505
|
-
<span class="vh" role="status" aria-live="polite">${
|
|
506
|
-
</div>`}};We=new WeakMap,kn=new WeakMap,Y=new WeakSet,Wl=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}]:[]])},Yl=function(){return this.open&&!!this.value.trim()},Nr=function(){this.open=!1,this._active=-1},Jd=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},Gl=new WeakMap,Rp=function(e){let t=
|
|
505
|
+
<span class="vh" role="status" aria-live="polite">${a}</span>
|
|
506
|
+
</div>`}};We=new WeakMap,kn=new WeakMap,Y=new WeakSet,Wl=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}]:[]])},Yl=function(){return this.open&&!!this.value.trim()},Nr=function(){this.open=!1,this._active=-1},Jd=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},Gl=new WeakMap,Rp=function(e){let t=s(this,Y,Wl).call(this).length;if(!t){this._active=-1;return}this._active<0?this._active=e>0?0:t-1:this._active=(this._active+e+t)%t},Xl=new WeakMap,En=new WeakMap,Zd=function(e=!0){this.value="",s(this,Y,Nr).call(this),e&&this.renderRoot.querySelector("input")?.focus(),s(this,Y,Jd).call(this)},Hp=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,Y,Nr).call(this)},Ii.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Ii.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}},Ii.styles=[k,Nl,$r,y`
|
|
507
507
|
:host { display: block; position: relative; }
|
|
508
508
|
.wrap { position: relative; }
|
|
509
509
|
.box {
|
|
@@ -551,14 +551,14 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
551
551
|
.all { font-size: var(--cm-font-size-13); text-decoration: underline; }
|
|
552
552
|
.gh { padding-inline: var(--cm-space-12); }
|
|
553
553
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
554
|
-
`];w("cm-global-search",
|
|
554
|
+
`];w("cm-global-search",Ii);var Nf=/^(\d{4})-(\d{2})-(\d{2})$/;function N(o){let n=Nf.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 mt=(o,n=2)=>String(o).padStart(n,"0"),H=o=>`${mt(o.getFullYear(),4)}-${mt(o.getMonth()+1)}-${mt(o.getDate())}`,Qd=()=>H(new Date),U=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function Ye(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 zt=o=>new Date(o.getFullYear(),o.getMonth(),1),Rr=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var Rf=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function Pi(o){let n=Rf.exec(o??"");return n?+n[1]*60+ +n[2]:null}var Mn=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${mt(Math.floor(n/60))}:${mt(n%60)}`};function Ge(o){let[n="",e=""]=(o??"").split("T"),t=Pi(e);return{date:N(n)?n:"",time:t===null?"":Mn(t)}}function pt(o,n=!1){let{date:e,time:t}=Ge(o),i=N(e);if(!i)return null;let a=t?Pi(t):n?1439:0;return new Date(i.getFullYear(),i.getMonth(),i.getDate(),Math.floor(a/60),a%60)}var Op=()=>{let o=new Date;return`${H(o)}T${mt(o.getHours())}:${mt(o.getMinutes())}`},Ip=new Map;function Jl(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,i=Ip.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(A=>A.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),v=(M,A)=>[...new Set([M,...A].filter(Boolean))],b=M=>M.replace(/[\u202f\u00a0]/g," "),$=b(l.formatToParts(m(9)).map(M=>M.type==="hour"?"{h}":M.type==="minute"?"{m}":M.value).join("")),x={format:M=>b(l.format(new Date(2e3,0,1,Math.floor(M/60),M%60))),dateTime:M=>ee(M,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",...e?{hourCycle:e}:{}},o),pattern:$,hour12:d==="h12"||d==="h11",am:v(u(9),["am","a"]),pm:v(u(15),["pm","p"])};return Ip.set(t,x),x}var qp=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function eh(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 Mn(d*60+m)}var Hr={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},Tn=o=>Array.isArray(o)?o:typeof o=="string"?Hr.fromAttribute(o):[];function Ir(o,n){let e=[n,en(o)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function Pr(o){try{let n=new Intl.Locale(o),e=n.getWeekInfo?.()??n.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var Pp=new Map;function Or(o){let n=Pp.get(o);if(n)return n;let e=x=>new Intl.DateTimeFormat(o,x),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(x=>x.type==="day"||x.type==="month"||x.type==="year").map(x=>x.type),u=d.map(x=>x.type==="day"?"{d}":x.type==="month"?"{m}":x.type==="year"?"{y}":x.value).join(""),v=(x,M)=>Array.from({length:12},(A,I)=>new Intl.DateTimeFormat(x,{month:M}).format(new Date(2024,I,1)).toLowerCase().replace(/\./g,"")),b=Array.from({length:12},(x,M)=>[...new Set([v(o,"long")[M],v(o,"short")[M],v("en","long")[M],v("en","short")[M]])]),$={short:x=>t.format(x),long:x=>ee(x,{weekday:"long",day:"numeric",month:"long",year:"numeric"},o),medium:x=>ee(x,{day:"numeric",month:"short",year:"numeric"},o),monthYear:x=>ee(x,{month:"long",year:"numeric"},o),day:x=>ee(x,{day:"numeric"},o),weekdaysShort:Array.from({length:7},(x,M)=>i.format(U(l,M))),weekdaysLong:Array.from({length:7},(x,M)=>a.format(U(l,M))),pattern:m.length===3?u:"{y}-{m}-{d}",order:m.length===3?m:["year","month","day"],months:b};return Pp.set(o,$),$}var Zl=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function Ql(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(x=>x.some(M=>M===u||u.length>=3&&M.startsWith(u)))+1;let v=t.filter((x,M)=>M!==d);if(!a||v.some(x=>!/^\d+$/.test(x)))return null;let b=v.findIndex(x=>x.length===4),$=b>=0?b:1;i=+v[$],l=+v[1-$],v[$].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=`${mt(i,4)}-${mt(a)}-${mt(l)}`;return N(m)?m:null}function ec(o,n,e,t){let i=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return U(e,1);case"ArrowLeft":return U(e,-1);case"ArrowDown":return U(e,7);case"ArrowUp":return U(e,-7);case"Home":return U(e,-i);case"End":return U(e,6-i);case"PageDown":return Ye(e,n.shiftKey?12:1);case"PageUp":return Ye(e,n.shiftKey?-12:-1);default:return null}}var ii=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function tc(o){let{fmt:n,firstDay:e,month:t,focus:i,min:a,max:l}=o,d=zt(t),m=(d.getDay()-e+7)%7,u=Rr(t).getDate(),v=[],b=Array(m).fill(null);for(let I=1;I<=u;I++)b.push(new Date(t.getFullYear(),t.getMonth(),I)),b.length===7&&(v.push(b),b=[]);b.length&&v.push([...b,...Array(7-b.length).fill(null)]);let $=Array.from({length:7},(I,B)=>(B+e)%7),x=Qd(),M=!!a&&Rr(Ye(d,-1))<a,A=!!l&&Ye(d,1)>l;return c`<div class="cal-head">
|
|
555
555
|
<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>
|
|
556
556
|
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
557
557
|
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${A} @click=${()=>o.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
558
558
|
</div>
|
|
559
559
|
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${o.id}-month" @keydown=${o.onKey}>
|
|
560
560
|
<thead><tr>${$.map(I=>c`<th scope="col" abbr=${n.weekdaysLong[I]}><span aria-hidden="true">${n.weekdaysShort[I]}</span><span class="vh">${n.weekdaysLong[I]}</span></th>`)}</tr></thead>
|
|
561
|
-
<tbody>${v.map(I=>c`<tr>${I.map(B=>{if(!B)return c`<td class="empty"></td>`;let V=H(B),Q=o.isDisabled(B)||!!
|
|
561
|
+
<tbody>${v.map(I=>c`<tr>${I.map(B=>{if(!B)return c`<td class="empty"></td>`;let V=H(B),Q=o.isDisabled(B)||!!a&&B<a||!!l&&B>l,$t=o.mark(B),F=o.note?.(B);return c`<td class="day ${$t} ${V===x?"today":""}" data-date=${V}
|
|
562
562
|
tabindex=${V===H(i)?"0":"-1"}
|
|
563
563
|
aria-selected=${$t?"true":"false"} aria-disabled=${Q?"true":h}
|
|
564
564
|
aria-current=${V===x?"date":h}
|
|
@@ -626,17 +626,17 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
626
626
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
627
627
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
628
628
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
629
|
-
`;var Cy=_("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."}}),jr,ce,Xe,Vr,Dt,ni,Le,He,Ur,Kr,E,_n,ri,Wr,ac,
|
|
629
|
+
`;var Cy=_("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."}}),jr,ce,Xe,Vr,Dt,ni,Le,He,Ur,Kr,E,_n,ri,Wr,ac,Oi,qr,Ct,si,Lt,St,nc,th,ih,Br,qi,rh,sh,Bp,oc,Fp,ah,Fr,zn,Cn,nh,jp,lc,oh,lh,cc,dc,hc,mc,pc,Ln,ai=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,jr,"");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,ce,this.attachInternals());p(this,Xe,D("cm-dp"));p(this,Vr,null);p(this,Dt,!1);p(this,ni,!1);p(this,Le,"");p(this,He,"");p(this,Ur,!1);p(this,Kr,"");p(this,Wr,!1);p(this,lc,e=>{e.key==="Enter"?s(this,E,nh).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),s(this,E,jp).call(this,e.key==="ArrowUp"?1:-1))});p(this,cc,()=>{this.disabled||(this.open?this.open=!1:(s(this,E,Cn).call(this),this.show()))});p(this,dc,e=>{e.key==="Enter"?s(this,E,Cn).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),s(this,E,Cn).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});p(this,hc,e=>{let t=ec(se(e,this),e,this._focus,r(this,E,th));if(t){e.preventDefault(),this._focus=ii(t,r(this,E,Lt),r(this,E,St)),f(this,ni,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,E,oh).call(this,this._focus))});p(this,mc,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,E,lh).call(this);return}rc(e,e.currentTarget)});p(this,pc,e=>{this._focus=ii(Ye(this._focus,e),r(this,E,Lt),r(this,E,St))});p(this,Ln,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,jr)}set locale(e){let t=r(this,jr);f(this,jr,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Vr)===null&&f(this,Vr,this.value),document.addEventListener("pointerdown",r(this,Ln),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Ln),!0)}get form(){return r(this,ce).form}get validity(){return r(this,ce).validity}get validationMessage(){return r(this,ce).validationMessage}get valueAsDate(){return this.time?this.value?pt(this.value):null:N(this.value)}checkValidity(){return s(this,E,oc).call(this),r(this,ce).checkValidity()}reportValidity(){return s(this,E,oc).call(this),r(this,ce).reportValidity()}formResetCallback(){this.value=r(this,Vr)??"",this.time&&(s(this,E,sh).call(this,this.value),f(this,E,s(this,E,qi).call(this,r(this,He)),ri)),this._text=s(this,E,Br).call(this,r(this,E,Ct)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(s(this,E,Bp).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=r(this,E,Lt),a=r(this,E,St);return i&&t<i||a&&t>a?!0:Tn(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!r(this,Wr)?(s(this,E,sh).call(this,this.value),r(this,Ur)||f(this,E,s(this,E,qi).call(this,r(this,He)),ri)):this.time&&(e.has("locale")||e.has("hourCycle"))&&r(this,He)&&f(this,E,s(this,E,qi).call(this,r(this,He)),ri),(e.has("value")||e.has("time"))&&!r(this,Dt)?this._text=s(this,E,Br).call(this,r(this,E,Ct)):e.has("locale")&&N(r(this,E,Ct))&&(this._text=s(this,E,Br).call(this,r(this,E,Ct))),f(this,Dt,!1),f(this,Ur,!1),f(this,Wr,!1)}updated(e){r(this,ce).setFormValue(this.value||null,this.time?this.value:this._text),s(this,E,oc).call(this),this.open&&r(this,ni)&&(f(this,ni,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&f(this,ni,!1)}render(){let e=r(this,E,Oi),t=N(r(this,E,Ct)),i=[this.error&&`${r(this,Xe)}-err`,this.helpText&&`${r(this,Xe)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=this.label||a||"",d=zt(this._focus);return c`<div class="field">
|
|
630
630
|
${this.label?c`<label class="label" for="${r(this,Xe)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
631
631
|
<div class="wrap ${this.time?"timed":""}">
|
|
632
632
|
<div class="box" part="box">
|
|
633
633
|
<input id="${r(this,Xe)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
634
634
|
.value=${le(this._text)} placeholder=${this.placeholder||r(this,E,ih)}
|
|
635
|
-
aria-label=${!this.label&&
|
|
635
|
+
aria-label=${!this.label&&a?a:h}
|
|
636
636
|
?required=${this.required} ?disabled=${this.disabled}
|
|
637
637
|
aria-invalid=${this.error?"true":h} aria-describedby=${i||h}
|
|
638
638
|
@input=${m=>{m.stopPropagation(),this._text=m.target.value}}
|
|
639
|
-
@change=${()=>
|
|
639
|
+
@change=${()=>s(this,E,Cn).call(this)} @keydown=${r(this,dc)} />
|
|
640
640
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
641
641
|
aria-label=${t?this.t(l?"changeFor":"change",{label:l,date:e.long(t)}):this.t(l?"chooseFor":"choose",{label:l})}
|
|
642
642
|
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Xe)}-pop"
|
|
@@ -649,22 +649,22 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
649
649
|
?required=${this.required} ?disabled=${this.disabled}
|
|
650
650
|
aria-invalid=${this.error?"true":h} aria-describedby=${i||h}
|
|
651
651
|
@input=${m=>{m.stopPropagation(),f(this,E,m.target.value,ri)}}
|
|
652
|
-
@change=${()=>
|
|
652
|
+
@change=${()=>s(this,E,nh).call(this)} @keydown=${r(this,lc)} />
|
|
653
653
|
</div>`:h}
|
|
654
654
|
<div class="pop" id="${r(this,Xe)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
655
655
|
?hidden=${!this.open} @keydown=${r(this,mc)}>
|
|
656
|
-
${this.open?c`<div class="cal">${tc({id:r(this,Xe),fmt:e,firstDay:r(this,E,th),month:d,focus:this._focus,min:r(this,E,Lt),max:r(this,E,St),isDisabled:m=>this.isUnavailable(H(m)),mark:m=>t&&H(m)===r(this,E,Ct)?"selected":"",onPick:m=>
|
|
656
|
+
${this.open?c`<div class="cal">${tc({id:r(this,Xe),fmt:e,firstDay:r(this,E,th),month:d,focus:this._focus,min:r(this,E,Lt),max:r(this,E,St),isDisabled:m=>this.isUnavailable(H(m)),mark:m=>t&&H(m)===r(this,E,Ct)?"selected":"",onPick:m=>s(this,E,oh).call(this,m),onKey:r(this,hc),onMonth:r(this,pc),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:h}
|
|
657
657
|
</div>
|
|
658
658
|
</div>
|
|
659
659
|
${this.error?c`<p class="error" id="${r(this,Xe)}-err" role="alert">${this.error}</p>`:h}
|
|
660
660
|
${this.helpText?c`<p class="help" id="${r(this,Xe)}-help">${this.helpText}</p>`:h}
|
|
661
|
-
</div>`}};jr=new WeakMap,ce=new WeakMap,Xe=new WeakMap,Vr=new WeakMap,Dt=new WeakMap,ni=new WeakMap,Le=new WeakMap,He=new WeakMap,Ur=new WeakMap,Kr=new WeakMap,E=new WeakSet,_n=function(){return r(this,Kr)},ri=function(e){e!==r(this,Kr)&&(f(this,Kr,e),this.requestUpdate())},Wr=new WeakMap,ac=function(){return Ir(this,this.locale)},Pi=function(){return Or(r(this,E,ac))},qr=function(){return Jl(r(this,E,ac),this.hourCycle)},Ct=function(){return this.time?r(this,Le):this.value},si=function(e){return this.time&&e.trim().toLowerCase()==="now"?Op():e},Lt=function(){return N(Ge(a(this,E,si).call(this,this.min)).date||this.min)},St=function(){return N(Ge(a(this,E,si).call(this,this.max)).date||this.max)},nc=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},th=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Pr(r(this,E,ac)):(Math.trunc(e)%7+7)%7},ih=function(){return Zl(r(this,E,Pi),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Br=function(e){let t=N(e);return t?r(this,E,Pi).short(t):e},Oi=function(e){let t=Ii(e);return t===null?"":r(this,E,qr).format(t)},rh=function(){return qp(r(this,E,qr),{h:this.t("patternHour"),m:this.t("patternMinute")})},sh=function(e){let{date:t,time:i}=Ge(e);f(this,Le,t),f(this,He,t?i:"")},Bp=function(){let e=new Date,t=N(r(this,E,Ct))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=ii(t,r(this,E,Lt),r(this,E,St)),f(this,ni,!0)},oc=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,E,Ct)),i=r(this,E,Pi);this.error?r(this,ce).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,ce).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,E,ih)}),e):this.time?a(this,E,Fp).call(this,t,e):this.required&&!t?r(this,ce).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,E,Lt)&&t<r(this,E,Lt)?r(this,ce).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,E,Lt))}),e):t&&r(this,E,St)&&t>r(this,E,St)?r(this,ce).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,E,St))}),e):t&&this.isUnavailable(this.value)?r(this,ce).setValidity({customError:!0},this.t("unavailable"),e):r(this,ce).setValidity({})},Fp=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,s=(b,$,x,M=t)=>r(this,ce).setValidity(b,this.t($,x),M),l=Ii(r(this,He));if(r(this,E,_n).trim()&&l===null)return s({badInput:!0},"badTime",{pattern:r(this,E,rh)},i);if(!e&&l===null)return this.required?s({valueMissing:!0},"required"):r(this,ce).setValidity({});if(!e)return s({badInput:!0},"required");if(l===null)return s({badInput:!0},"timeMissing",void 0,i);let d=pt(`${r(this,Le)}T${r(this,He)}`),m=pt(a(this,E,si).call(this,this.min)),u=pt(a(this,E,si).call(this,this.max),!0),v=(b,$)=>Ge(b).time?r(this,E,qr).dateTime($):r(this,E,Pi).medium($);if(m&&d<m)return s({rangeUnderflow:!0},"rangeUnderflow",{date:v(a(this,E,si).call(this,this.min),m)},i);if(u&&d>u)return s({rangeOverflow:!0},"rangeOverflow",{date:v(a(this,E,si).call(this,this.max),u)},i);if(l%r(this,E,nc))return s({stepMismatch:!0},"stepMismatch",{count:r(this,E,nc)},i);if(this.isUnavailable(r(this,Le)))return s({customError:!0},"unavailable");r(this,ce).setValidity({})},ah=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})))},Fr=function(e,t){f(this,Le,e),f(this,He,t);let i=e&&t?`${e}T${t}`:"";f(this,Wr,!0),this.requestUpdate(),a(this,E,ah).call(this,i)},zn=function(e){this.time?a(this,E,Fr).call(this,e,r(this,He)):a(this,E,ah).call(this,e)},Cn=function(){let e=this._text.trim();if(!e){a(this,E,zn).call(this,"");return}let t=Ql(e,r(this,E,Pi));t?(a(this,E,zn).call(this,t),this._text=a(this,E,Br).call(this,t)):(f(this,Dt,!0),a(this,E,zn).call(this,""))},nh=function(){let e=r(this,E,_n).trim(),t=e?eh(e,r(this,E,qr)):"";if(f(this,Dt,!0),t===null){f(this,Ur,!0),a(this,E,Fr).call(this,r(this,Le),"");return}a(this,E,Fr).call(this,r(this,Le),t),f(this,E,a(this,E,Oi).call(this,t),ri)},jp=function(e){let t=r(this,E,nc),i=eh(r(this,E,_n),r(this,E,qr));if(!i){let m=Ge(a(this,E,si).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,Le)||r(this,Le)===m.date)?m.time:Mn(u.getHours()*60+u.getMinutes()),Ii(i)%t===0){f(this,Dt,!0),a(this,E,Fr).call(this,r(this,Le),i),f(this,E,a(this,E,Oi).call(this,i),ri);return}e=1}let s=Ii(i),l=e>0?(Math.floor(s/t)+1)*t:(Math.ceil(s/t)-1)*t,d=Mn(l>=1440?0:l<0?Math.floor(1439/t)*t:l);f(this,Dt,!0),a(this,E,Fr).call(this,r(this,Le),d),f(this,E,a(this,E,Oi).call(this,d),ri)},lc=new WeakMap,oh=function(e){let t=H(e);this.isUnavailable(t)||(this.open=!1,a(this,E,zn).call(this,t),this._text=a(this,E,Br).call(this,t),this.time&&!r(this,He)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):a(this,E,lh).call(this))},lh=function(){this.renderRoot.querySelector(".trigger")?.focus()},cc=new WeakMap,dc=new WeakMap,hc=new WeakMap,mc=new WeakMap,pc=new WeakMap,Ln=new WeakMap,ai.formAssociated=!0,ai.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},ai.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:Hr},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}},ai.styles=[k,sc,ic,y`.pop { min-width: 0; }`];w("cm-date-picker",ai);var Iy=_("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"}),Hf={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[U(o,-1),U(o,-1)]],"last-7-days":["Last 7 days",o=>[U(o,-6),o]],"last-30-days":["Last 30 days",o=>[U(o,-29),o]],"last-90-days":["Last 90 days",o=>[U(o,-89),o]],"this-month":["This month",o=>[zt(o),o]],"last-month":["Last month",o=>[zt(Ye(o,-1)),Rr(Ye(o,-1))]]},If=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Vp(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=Hf[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[s,l]=t[1](i);return{label:e?.(If(o))||t[0],start:H(s),end:H(l)}}var Xr,me,Ie,Jr,Zr,li,R,ch,Yr,dh,Nt,uc,At,Up,gc,Gr,hh,Kp,fc,bc,vc,yc,xc,Sn,mh,oi=class extends T{constructor(){super(...arguments);p(this,R);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,Xr,"");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,me,this.attachInternals());p(this,Ie,D("cm-drp"));p(this,Jr,null);p(this,Zr,!1);p(this,li,!1);p(this,Nt,"start");p(this,bc,()=>{this.disabled||(this.open?this.open=!1:(a(this,R,Gr).call(this,"start"),a(this,R,Gr).call(this,"end"),this.show()))});p(this,vc,e=>t=>{t.key==="Enter"?a(this,R,Gr).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),a(this,R,Gr).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,yc,e=>{let t=ec(se(e,this),e,this._focus,r(this,R,dh));if(t){e.preventDefault(),this._focus=ii(t,N(this.min),N(this.max)),f(this,li,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,R,hh).call(this,this._focus))});p(this,xc,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,R,fc).call(this);return}rc(e,e.currentTarget)});p(this,Sn,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Xr)}set locale(e){let t=r(this,Xr);f(this,Xr,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Jr)||f(this,Jr,[this.start,this.end]),document.addEventListener("pointerdown",r(this,Sn),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Sn),!0)}get form(){return r(this,me).form}get validity(){return r(this,me).validity}get validationMessage(){return r(this,me).validationMessage}checkValidity(){return r(this,me).checkValidity()}reportValidity(){return r(this,me).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,Jr)??["",""],this._startText=a(this,R,At).call(this,this.start),this._endText=a(this,R,At).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=ii(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),f(this,Nt,"start"),f(this,li,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=N(this.min),s=N(this.max);return i&&t<i||s&&t>s?!0:Tn(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,Zr)||(e.has("start")&&(this._startText=a(this,R,At).call(this,this.start)),e.has("end")&&(this._endText=a(this,R,At).call(this,this.end))),f(this,Zr,!1),e.has("locale")&&(N(this.start)&&(this._startText=a(this,R,At).call(this,this.start)),N(this.end)&&(this._endText=a(this,R,At).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,me).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let s=this.renderRoot.querySelectorAll("input"),[l,d]=[s[0]??void 0,s[1]??void 0],m=r(this,R,Yr),u=N(this.min),v=N(this.max);this.error?r(this,me).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,me).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,R,uc)}),l):this._endText.trim()&&!t?r(this,me).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,R,uc)}),d):this.required&&(!e||!t)?r(this,me).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,me).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,me).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,me).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,me).setValidity({customError:!0},this.t("unavailable"),l):r(this,me).setValidity({}),this.open&&r(this,li)&&(f(this,li,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,R,Yr),t=N(this.start),i=N(this.end),s=[this.error&&`${r(this,Ie)}-err`,this.helpText&&`${r(this,Ie)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=Tn(this.presets).map(b=>Vp(b,new Date,$=>this.t($))).filter(b=>!!b),u=r(this,Nt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=b=>{let $=b==="start"?this._startText:this._endText;return c`<input id="${r(this,Ie)}-${b}" type="text" autocomplete="off" spellcheck="false"
|
|
661
|
+
</div>`}};jr=new WeakMap,ce=new WeakMap,Xe=new WeakMap,Vr=new WeakMap,Dt=new WeakMap,ni=new WeakMap,Le=new WeakMap,He=new WeakMap,Ur=new WeakMap,Kr=new WeakMap,E=new WeakSet,_n=function(){return r(this,Kr)},ri=function(e){e!==r(this,Kr)&&(f(this,Kr,e),this.requestUpdate())},Wr=new WeakMap,ac=function(){return Ir(this,this.locale)},Oi=function(){return Or(r(this,E,ac))},qr=function(){return Jl(r(this,E,ac),this.hourCycle)},Ct=function(){return this.time?r(this,Le):this.value},si=function(e){return this.time&&e.trim().toLowerCase()==="now"?Op():e},Lt=function(){return N(Ge(s(this,E,si).call(this,this.min)).date||this.min)},St=function(){return N(Ge(s(this,E,si).call(this,this.max)).date||this.max)},nc=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},th=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Pr(r(this,E,ac)):(Math.trunc(e)%7+7)%7},ih=function(){return Zl(r(this,E,Oi),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Br=function(e){let t=N(e);return t?r(this,E,Oi).short(t):e},qi=function(e){let t=Pi(e);return t===null?"":r(this,E,qr).format(t)},rh=function(){return qp(r(this,E,qr),{h:this.t("patternHour"),m:this.t("patternMinute")})},sh=function(e){let{date:t,time:i}=Ge(e);f(this,Le,t),f(this,He,t?i:"")},Bp=function(){let e=new Date,t=N(r(this,E,Ct))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=ii(t,r(this,E,Lt),r(this,E,St)),f(this,ni,!0)},oc=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,E,Ct)),i=r(this,E,Oi);this.error?r(this,ce).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,ce).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,E,ih)}),e):this.time?s(this,E,Fp).call(this,t,e):this.required&&!t?r(this,ce).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,E,Lt)&&t<r(this,E,Lt)?r(this,ce).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,E,Lt))}),e):t&&r(this,E,St)&&t>r(this,E,St)?r(this,ce).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,E,St))}),e):t&&this.isUnavailable(this.value)?r(this,ce).setValidity({customError:!0},this.t("unavailable"),e):r(this,ce).setValidity({})},Fp=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(b,$,x,M=t)=>r(this,ce).setValidity(b,this.t($,x),M),l=Pi(r(this,He));if(r(this,E,_n).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,E,rh)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,ce).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=pt(`${r(this,Le)}T${r(this,He)}`),m=pt(s(this,E,si).call(this,this.min)),u=pt(s(this,E,si).call(this,this.max),!0),v=(b,$)=>Ge(b).time?r(this,E,qr).dateTime($):r(this,E,Oi).medium($);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,E,si).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,E,si).call(this,this.max),u)},i);if(l%r(this,E,nc))return a({stepMismatch:!0},"stepMismatch",{count:r(this,E,nc)},i);if(this.isUnavailable(r(this,Le)))return a({customError:!0},"unavailable");r(this,ce).setValidity({})},ah=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})))},Fr=function(e,t){f(this,Le,e),f(this,He,t);let i=e&&t?`${e}T${t}`:"";f(this,Wr,!0),this.requestUpdate(),s(this,E,ah).call(this,i)},zn=function(e){this.time?s(this,E,Fr).call(this,e,r(this,He)):s(this,E,ah).call(this,e)},Cn=function(){let e=this._text.trim();if(!e){s(this,E,zn).call(this,"");return}let t=Ql(e,r(this,E,Oi));t?(s(this,E,zn).call(this,t),this._text=s(this,E,Br).call(this,t)):(f(this,Dt,!0),s(this,E,zn).call(this,""))},nh=function(){let e=r(this,E,_n).trim(),t=e?eh(e,r(this,E,qr)):"";if(f(this,Dt,!0),t===null){f(this,Ur,!0),s(this,E,Fr).call(this,r(this,Le),"");return}s(this,E,Fr).call(this,r(this,Le),t),f(this,E,s(this,E,qi).call(this,t),ri)},jp=function(e){let t=r(this,E,nc),i=eh(r(this,E,_n),r(this,E,qr));if(!i){let m=Ge(s(this,E,si).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,Le)||r(this,Le)===m.date)?m.time:Mn(u.getHours()*60+u.getMinutes()),Pi(i)%t===0){f(this,Dt,!0),s(this,E,Fr).call(this,r(this,Le),i),f(this,E,s(this,E,qi).call(this,i),ri);return}e=1}let a=Pi(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=Mn(l>=1440?0:l<0?Math.floor(1439/t)*t:l);f(this,Dt,!0),s(this,E,Fr).call(this,r(this,Le),d),f(this,E,s(this,E,qi).call(this,d),ri)},lc=new WeakMap,oh=function(e){let t=H(e);this.isUnavailable(t)||(this.open=!1,s(this,E,zn).call(this,t),this._text=s(this,E,Br).call(this,t),this.time&&!r(this,He)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,E,lh).call(this))},lh=function(){this.renderRoot.querySelector(".trigger")?.focus()},cc=new WeakMap,dc=new WeakMap,hc=new WeakMap,mc=new WeakMap,pc=new WeakMap,Ln=new WeakMap,ai.formAssociated=!0,ai.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},ai.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:Hr},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}},ai.styles=[k,sc,ic,y`.pop { min-width: 0; }`];w("cm-date-picker",ai);var Iy=_("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"}),Hf={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[U(o,-1),U(o,-1)]],"last-7-days":["Last 7 days",o=>[U(o,-6),o]],"last-30-days":["Last 30 days",o=>[U(o,-29),o]],"last-90-days":["Last 90 days",o=>[U(o,-89),o]],"this-month":["This month",o=>[zt(o),o]],"last-month":["Last month",o=>[zt(Ye(o,-1)),Rr(Ye(o,-1))]]},If=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Vp(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=Hf[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(If(o))||t[0],start:H(a),end:H(l)}}var Xr,me,Ie,Jr,Zr,li,R,ch,Yr,dh,Nt,uc,At,Up,gc,Gr,hh,Kp,fc,bc,vc,yc,xc,Sn,mh,oi=class extends T{constructor(){super(...arguments);p(this,R);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,Xr,"");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,me,this.attachInternals());p(this,Ie,D("cm-drp"));p(this,Jr,null);p(this,Zr,!1);p(this,li,!1);p(this,Nt,"start");p(this,bc,()=>{this.disabled||(this.open?this.open=!1:(s(this,R,Gr).call(this,"start"),s(this,R,Gr).call(this,"end"),this.show()))});p(this,vc,e=>t=>{t.key==="Enter"?s(this,R,Gr).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,R,Gr).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,yc,e=>{let t=ec(se(e,this),e,this._focus,r(this,R,dh));if(t){e.preventDefault(),this._focus=ii(t,N(this.min),N(this.max)),f(this,li,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,R,hh).call(this,this._focus))});p(this,xc,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,R,fc).call(this);return}rc(e,e.currentTarget)});p(this,Sn,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Xr)}set locale(e){let t=r(this,Xr);f(this,Xr,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Jr)||f(this,Jr,[this.start,this.end]),document.addEventListener("pointerdown",r(this,Sn),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Sn),!0)}get form(){return r(this,me).form}get validity(){return r(this,me).validity}get validationMessage(){return r(this,me).validationMessage}checkValidity(){return r(this,me).checkValidity()}reportValidity(){return r(this,me).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,Jr)??["",""],this._startText=s(this,R,At).call(this,this.start),this._endText=s(this,R,At).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=ii(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),f(this,Nt,"start"),f(this,li,!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:Tn(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,Zr)||(e.has("start")&&(this._startText=s(this,R,At).call(this,this.start)),e.has("end")&&(this._endText=s(this,R,At).call(this,this.end))),f(this,Zr,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,R,At).call(this,this.start)),N(this.end)&&(this._endText=s(this,R,At).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,me).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,R,Yr),u=N(this.min),v=N(this.max);this.error?r(this,me).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,me).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,R,uc)}),l):this._endText.trim()&&!t?r(this,me).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,R,uc)}),d):this.required&&(!e||!t)?r(this,me).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,me).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,me).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,me).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,me).setValidity({customError:!0},this.t("unavailable"),l):r(this,me).setValidity({}),this.open&&r(this,li)&&(f(this,li,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,R,Yr),t=N(this.start),i=N(this.end),a=[this.error&&`${r(this,Ie)}-err`,this.helpText&&`${r(this,Ie)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=Tn(this.presets).map(b=>Vp(b,new Date,$=>this.t($))).filter(b=>!!b),u=r(this,Nt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=b=>{let $=b==="start"?this._startText:this._endText;return c`<input id="${r(this,Ie)}-${b}" type="text" autocomplete="off" spellcheck="false"
|
|
662
662
|
.value=${le($)} placeholder=${r(this,R,uc)}
|
|
663
663
|
aria-label=${b==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
664
664
|
?required=${this.required} ?disabled=${this.disabled}
|
|
665
|
-
aria-invalid=${this.error?"true":h} aria-describedby=${
|
|
665
|
+
aria-invalid=${this.error?"true":h} aria-describedby=${a||h}
|
|
666
666
|
@input=${x=>{x.stopPropagation();let M=x.target.value;b==="start"?this._startText=M:this._endText=M}}
|
|
667
|
-
@change=${()=>
|
|
667
|
+
@change=${()=>s(this,R,Gr).call(this,b)} @keydown=${r(this,vc).call(this,b)} />`};return c`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,Ie)}-l`:h} aria-label=${!this.label&&l?l:h}>
|
|
668
668
|
${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}
|
|
669
669
|
<div class="wrap">
|
|
670
670
|
<div class="box" part="box">
|
|
@@ -679,8 +679,8 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
679
679
|
${this.open?c`<div class="body">
|
|
680
680
|
${m.length?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${m.map(b=>c`<li>
|
|
681
681
|
<button type="button" class="preset" aria-pressed=${b.start===this.start&&b.end===this.end?"true":"false"}
|
|
682
|
-
@click=${()=>
|
|
683
|
-
<div class="cal">${tc({id:r(this,Ie),fmt:e,firstDay:r(this,R,dh),month:zt(this._focus),focus:this._focus,min:N(this.min),max:N(this.max),isDisabled:b=>this.isUnavailable(H(b)),mark:b=>
|
|
682
|
+
@click=${()=>s(this,R,Kp).call(this,b)}>${b.label}</button></li>`)}</ul>`:h}
|
|
683
|
+
<div class="cal">${tc({id:r(this,Ie),fmt:e,firstDay:r(this,R,dh),month:zt(this._focus),focus:this._focus,min:N(this.min),max:N(this.max),isDisabled:b=>this.isUnavailable(H(b)),mark:b=>s(this,R,mh).call(this,b),note:b=>{let $=s(this,R,mh).call(this,b);return $==="start"?this.t("startNote"):$==="end"?this.t("endNote"):""},onPick:b=>s(this,R,hh).call(this,b),onKey:r(this,yc),onMonth:b=>{this._focus=ii(Ye(this._focus,b),N(this.min),N(this.max))},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:b=>{r(this,Nt)==="end"&&(this._hover=b)}})}
|
|
684
684
|
<p class="status" aria-live="polite">${u}</p>
|
|
685
685
|
</div>
|
|
686
686
|
</div>`:h}
|
|
@@ -688,7 +688,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
688
688
|
</div>
|
|
689
689
|
${this.error?c`<p class="error" id="${r(this,Ie)}-err" role="alert">${this.error}</p>`:h}
|
|
690
690
|
${this.helpText?c`<p class="help" id="${r(this,Ie)}-help">${this.helpText}</p>`:h}
|
|
691
|
-
</div>`}};Xr=new WeakMap,me=new WeakMap,Ie=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,li=new WeakMap,R=new WeakSet,ch=function(){return Ir(this,this.locale)},Yr=function(){return Or(r(this,R,ch))},dh=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Pr(r(this,R,ch)):(Math.trunc(e)%7+7)%7},Nt=new WeakMap,uc=function(){return Zl(r(this,R,Yr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},At=function(e){let t=N(e);return t?r(this,R,Yr).short(t):e},Up=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},gc=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,
|
|
691
|
+
</div>`}};Xr=new WeakMap,me=new WeakMap,Ie=new WeakMap,Jr=new WeakMap,Zr=new WeakMap,li=new WeakMap,R=new WeakSet,ch=function(){return Ir(this,this.locale)},Yr=function(){return Or(r(this,R,ch))},dh=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Pr(r(this,R,ch)):(Math.trunc(e)%7+7)%7},Nt=new WeakMap,uc=function(){return Zl(r(this,R,Yr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},At=function(e){let t=N(e);return t?r(this,R,Yr).short(t):e},Up=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},gc=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,s(this,R,Up).call(this))},Gr=function(e){let t=(e==="start"?this._startText:this._endText).trim(),i=t?Ql(t,r(this,R,Yr)):"";t&&!i&&f(this,Zr,!0);let a=e==="start"?[i??"",this.end]:[this.start,i??""];s(this,R,gc).call(this,...a),i&&(e==="start"?this._startText=s(this,R,At).call(this,i):this._endText=s(this,R,At).call(this,i))},hh=function(e){let t=H(e);if(!this.isUnavailable(t)){if(r(this,Nt)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",f(this,Nt,"end"),this._focus=e,f(this,li,!0);return}this._draftEnd=t,this.open=!1,s(this,R,gc).call(this,this._draftStart,t),s(this,R,fc).call(this)}},Kp=function(e){this.open=!1,s(this,R,gc).call(this,e.start,e.end),s(this,R,fc).call(this)},fc=function(){this.renderRoot.querySelector(".trigger")?.focus()},bc=new WeakMap,vc=new WeakMap,yc=new WeakMap,xc=new WeakMap,Sn=new WeakMap,mh=function(e){let t=H(e),i=this._draftStart,a=this._draftEnd||(r(this,Nt)==="end"&&i?H(this._hover??this._focus):"");return t===i?"start":t===a&&a>i?"end":i&&a&&t>i&&t<a?"in-range":""},oi.formAssociated=!0,oi.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},oi.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:Hr},isDateDisabled:{attribute:!1},presets:{converter:Hr},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}},oi.styles=[k,sc,ic,y`
|
|
692
692
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
693
693
|
input { flex: 0 1 6.6em; }
|
|
694
694
|
:host([size='small']) input { flex-basis: 6.6em; }
|
|
@@ -708,43 +708,43 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
708
708
|
.presets li { flex: 0 0 auto; }
|
|
709
709
|
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
710
710
|
}
|
|
711
|
-
`];w("cm-date-range-picker",oi);var jy=_("fileUpload",{prompt:"Click here to upload",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 Pf(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 Je,ae,Rt,q,Dn,ph,wc,$c,uh,gh,
|
|
711
|
+
`];w("cm-date-range-picker",oi);var jy=_("fileUpload",{prompt:"Click here to upload",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 Pf(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 Je,ae,Rt,q,Dn,ph,wc,$c,uh,gh,Bi,fh,Wp,Yp,ci=class extends T{constructor(){super(...arguments);p(this,q);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="";p(this,Je,this.attachInternals());p(this,ae,D("cm-fu"));p(this,Rt,new Map)}get form(){return r(this,Je).form}get validity(){return r(this,Je).validity}get validationMessage(){return r(this,Je).validationMessage}checkValidity(){return r(this,Je).checkValidity()}reportValidity(){return r(this,Je).reportValidity()}formResetCallback(){this.files=[],this._rejected=""}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,Rt).values())URL.revokeObjectURL(e);r(this,Rt).clear()}updated(e){if(e.has("files"))for(let[l,d]of r(this,Rt))this.files.includes(l)||(URL.revokeObjectURL(d),r(this,Rt).delete(l));let t=new FormData;for(let l of this.files)t.append(this.name||"file",l);r(this,Je).setFormValue(this.files.length?t:null);let i=(r(this,q,Dn)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,a=this.error||this._rejected;a?r(this,Je).setValidity({customError:!0},a,i):this.required&&!this.files.length?r(this,Je).setValidity({valueMissing:!0},this.t("required"),i):r(this,Je).setValidity({})}addFiles(e){let t=[...e],i=[],a=[],l=[];for(let m of t)Pf(m,r(this,q,ph))?this.maxSize&&m.size>this.maxSize?(a.push(m),l.push(this.t("tooLarge",{name:m.name,size:s(this,q,$c).call(this,this.maxSize)}))):i.push(m):(a.push(m),l.push(this.t("wrongType",{name:m.name})));let d=r(this,q,wc)?[...this.files,...i]:i.slice(-1);!r(this,q,wc)&&!i.length&&(d=this.files),r(this,q,wc)&&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})))}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){if(r(this,q,Dn))return s(this,q,Yp).call(this);let e=this.error||this._rejected,t=!this.files.length||this.multiple,i=this.files.length>0;return c`
|
|
712
712
|
${this.label||this.hint?c`<div class="head">
|
|
713
713
|
${this.label?c`<span class="label" id="${r(this,ae)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
714
714
|
${this.hint?c`<span class="hint" id="${r(this,ae)}-hint">${this.hint}</span>`:h}
|
|
715
715
|
</div>`:h}
|
|
716
716
|
${i?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
717
|
-
${this.files.map(
|
|
718
|
-
${
|
|
719
|
-
${this.disabled?h:c`<button type="button" class="remove" aria-label=${this.t("remove",{name:
|
|
717
|
+
${this.files.map(a=>c`<li class="file">
|
|
718
|
+
${a.type.startsWith("image/")?c`<img src=${s(this,q,uh).call(this,a)} alt=${a.name} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${a.name}</span><span class="size">${s(this,q,$c).call(this,a.size)}</span></div>`}
|
|
719
|
+
${this.disabled?h:c`<button type="button" class="remove" aria-label=${this.t("remove",{name:a.name})} @click=${()=>this.removeFile(a)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
720
720
|
</li>`)}
|
|
721
|
-
${t?c`<li>${
|
|
722
|
-
</ul>`:
|
|
721
|
+
${t?c`<li>${s(this,q,fh).call(this,!0)}</li>`:h}
|
|
722
|
+
</ul>`:s(this,q,fh).call(this,!1)}
|
|
723
723
|
${e?c`<p class="msg" id="${r(this,ae)}-msg" role="alert">${e}</p>`:h}
|
|
724
|
-
`}};Je=new WeakMap,ae=new WeakMap,Rt=new WeakMap,q=new WeakSet,Dn=function(){return this.variant==="photo"},ph=function(){return this.accept||(r(this,q,Dn)?"image/*":"")},wc=function(){return this.multiple&&!r(this,q,Dn)},$c=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})})},uh=function(e){let t=r(this,Rt).get(e);return t||(t=URL.createObjectURL(e),r(this,Rt).set(e,t)),t},gh=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},
|
|
725
|
-
@dragenter=${()=>
|
|
724
|
+
`}};Je=new WeakMap,ae=new WeakMap,Rt=new WeakMap,q=new WeakSet,Dn=function(){return this.variant==="photo"},ph=function(){return this.accept||(r(this,q,Dn)?"image/*":"")},wc=function(){return this.multiple&&!r(this,q,Dn)},$c=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})})},uh=function(e){let t=r(this,Rt).get(e);return t||(t=URL.createObjectURL(e),r(this,Rt).set(e,t)),t},gh=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},Bi=function(e){this.toggleAttribute("data-over",e)},fh=function(e){let t=[this.hint&&`${r(this,ae)}-hint`,(this.error||this._rejected)&&`${r(this,ae)}-msg`].filter(Boolean).join(" ");return c`<label class="zone ${e?"tile":""}" part="zone"
|
|
725
|
+
@dragenter=${()=>s(this,q,Bi).call(this,!0)} @dragleave=${()=>s(this,q,Bi).call(this,!1)} @drop=${()=>s(this,q,Bi).call(this,!1)}>
|
|
726
726
|
<input type="file" id=${r(this,ae)} accept=${this.accept||h} capture=${this.capture||h} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
727
727
|
?required=${this.required&&!this.files.length}
|
|
728
728
|
aria-labelledby=${[this.label&&`${r(this,ae)}-l`,`${r(this,ae)}-p`].filter(Boolean).join(" ")}
|
|
729
729
|
aria-describedby=${t||h} aria-invalid=${this.error||this._rejected?"true":h}
|
|
730
|
-
@change=${
|
|
730
|
+
@change=${s(this,q,gh)} @cancel=${i=>i.stopPropagation()} />
|
|
731
731
|
<cm-icon name=${e?"plus":"upload"} size=${e?24:32}
|
|
732
732
|
></cm-icon>
|
|
733
733
|
<span id="${r(this,ae)}-p">${e?this.t("addMore"):this.prompt}</span>
|
|
734
|
-
</label>`},Wp=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Yp=function(){let e=this.error||this._rejected,t=this.files[0],i=this.label||this.t("photo"),
|
|
734
|
+
</label>`},Wp=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Yp=function(){let e=this.error||this._rejected,t=this.files[0],i=this.label||this.t("photo"),a=[this.hint&&`${r(this,ae)}-hint`,e&&`${r(this,ae)}-msg`].filter(Boolean).join(" "),l=m=>c`<input type="file" id=${r(this,ae)} accept=${r(this,q,ph)} capture=${this.capture||h}
|
|
735
735
|
?disabled=${this.disabled} ?required=${this.required&&!t} tabindex=${m?"-1":h} aria-hidden=${m?"true":h}
|
|
736
|
-
?hidden=${m} aria-labelledby=${m?h:`${r(this,ae)}-p`} aria-describedby=${!m&&
|
|
737
|
-
@change=${
|
|
736
|
+
?hidden=${m} aria-labelledby=${m?h:`${r(this,ae)}-p`} aria-describedby=${!m&&a||h} aria-invalid=${e?"true":h}
|
|
737
|
+
@change=${s(this,q,gh)} @cancel=${u=>u.stopPropagation()} />`,d=this.hint?c`<span class="hint" id="${r(this,ae)}-hint">${this.hint}</span>`:h;return c`
|
|
738
738
|
${t?c`<div class="shot" part="photo">
|
|
739
|
-
${t.type.startsWith("image/")?c`<img src=${
|
|
739
|
+
${t.type.startsWith("image/")?c`<img src=${s(this,q,uh).call(this,t)} alt=${i} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${t.name}</span><span class="size">${s(this,q,$c).call(this,t.size)}</span></div>`}
|
|
740
740
|
</div>
|
|
741
741
|
<p class="caption" aria-hidden="true">${this.label}</p>
|
|
742
742
|
${l(!0)}
|
|
743
743
|
${this.disabled?h:c`<div class="actions" part="actions">
|
|
744
|
-
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:i})} aria-describedby=${e?`${r(this,ae)}-msg`:h} @click=${
|
|
744
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:i})} aria-describedby=${e?`${r(this,ae)}-msg`:h} @click=${s(this,q,Wp)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
745
745
|
<button type="button" class="action" aria-label=${this.t("removeName",{name:i})} @click=${()=>this.removeFile(t)}><cm-icon name="trash" size="16"></cm-icon>${this.t("removePhoto")}</button>
|
|
746
746
|
</div>`}`:c`<label class="zone photo ${e?"invalid":""}" part="zone photo"
|
|
747
|
-
@dragenter=${()=>
|
|
747
|
+
@dragenter=${()=>s(this,q,Bi).call(this,!0)} @dragleave=${()=>s(this,q,Bi).call(this,!1)} @drop=${()=>s(this,q,Bi).call(this,!1)}>
|
|
748
748
|
${l(!1)}
|
|
749
749
|
<cm-icon name="camera" size="32"></cm-icon>
|
|
750
750
|
<span class="photo-label" id="${r(this,ae)}-p" part="label">${this.label||this.t("takePhoto")}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
@@ -809,7 +809,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
809
809
|
.zone:not(.tile):not(.photo) { min-height: 100px; }
|
|
810
810
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
811
811
|
}
|
|
812
|
-
`];w("cm-file-upload",ci);var Jy=_("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"}),Of=[{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 Ht(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 qf=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 Bf(o){let n=qf(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var Pe,ut,An,Qr,K,
|
|
812
|
+
`];w("cm-file-upload",ci);var Jy=_("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"}),Of=[{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 Ht(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 qf=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 Bf(o){let n=qf(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var Pe,ut,An,Qr,K,Fi,bh,Gp,Xp,vh,Jp,Zp,Qp,eu,di=class extends T{constructor(){super(...arguments);p(this,K);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,Pe,this.attachInternals());p(this,ut,D("cm-cf"));p(this,An,"");p(this,Qr)}connectedCallback(){super.connectedCallback(),f(this,An,Ht(this.value)??this.value)}get form(){return r(this,Pe).form}get validity(){return r(this,Pe).validity}get validationMessage(){return r(this,Pe).validationMessage}checkValidity(){return r(this,Pe).checkValidity()}reportValidity(){return r(this,Pe).reportValidity()}formResetCallback(){this.value=r(this,An),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=Ht(t?.value??"");return i?[{value:i,name:t.name}]:[]}):Of.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=Ht(this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==r(this,Qr)&&(this._draft=void 0,this._invalid=!1),f(this,Qr,void 0)}}updated(){let e=!this.value||Ht(this.value)!==null;r(this,Pe).setFormValue(this.value&&e?this.value:null,this.value);let t=this.renderRoot.querySelector(".input")??void 0;this.error?r(this,Pe).setValidity({customError:!0},this.error,t):this._invalid||!e?r(this,Pe).setValidity({patternMismatch:!0},this.t("invalid"),t):this.required&&!this.value?r(this,Pe).setValidity({valueMissing:!0},this.t("required"),t):r(this,Pe).setValidity({})}render(){let e=this.items,t=Ht(this.value??""),i=e.findIndex(u=>u.value===t),a=this.error||(this._invalid||this.value&&!t?this.t("invalid"):""),l=[a&&`${r(this,ut)}-err`,this.helpText&&`${r(this,ut)}-help`].filter(Boolean).join(" ")||h,d=this.getAttribute("aria-label"),m=this.label||d||"";return c`<div class="field">
|
|
813
813
|
${this.label?c`<span class="label" id="${r(this,ut)}-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}
|
|
814
814
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
815
815
|
aria-labelledby=${this.label?`${r(this,ut)}-l`:h} aria-label=${!this.label&&d?d:h}
|
|
@@ -817,25 +817,25 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
817
817
|
${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"}
|
|
818
818
|
aria-label=${b} title=${u.name||u.value} tabindex=${v===(i>=0?i:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
819
819
|
style="background-color:${u.value};color:${Bf(u.value)}"
|
|
820
|
-
@click=${()=>
|
|
820
|
+
@click=${()=>s(this,K,bh).call(this,v)} @keydown=${$=>s(this,K,Gp).call(this,$,v)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
821
821
|
</div>`:h}
|
|
822
822
|
<div class="row">
|
|
823
823
|
${this.picker?c`<label class="pick" part="picker" style=${t?`background-color:${t}`:h}>
|
|
824
824
|
<input type="color" .value=${le(t??"#000000")} ?disabled=${this.disabled}
|
|
825
825
|
aria-label=${m?this.t("pickerNamed",{label:m}):this.t("picker")}
|
|
826
|
-
@input=${
|
|
826
|
+
@input=${s(this,K,Qp)} @change=${s(this,K,eu)} />
|
|
827
827
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
828
828
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${t?`background-color:${t}`:h}></span>`}
|
|
829
829
|
<input class="input" part="input" id=${r(this,ut)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
830
830
|
maxlength="7" .value=${le(this._draft??this.value??"")} placeholder=${this.t("placeholder")}
|
|
831
831
|
aria-label=${m?this.t("hexNamed",{label:m}):this.t("hex")}
|
|
832
832
|
?required=${this.required} ?disabled=${this.disabled}
|
|
833
|
-
aria-invalid=${
|
|
834
|
-
@input=${
|
|
833
|
+
aria-invalid=${a?"true":h} aria-describedby=${l}
|
|
834
|
+
@input=${s(this,K,Xp)} @change=${s(this,K,Jp)} @keydown=${s(this,K,Zp)} />
|
|
835
835
|
</div>
|
|
836
|
-
${
|
|
836
|
+
${a?c`<p class="error" id="${r(this,ut)}-err" role="alert">${a}</p>`:h}
|
|
837
837
|
${this.helpText?c`<p class="help" id="${r(this,ut)}-help">${this.helpText}</p>`:h}
|
|
838
|
-
</div>`}};Pe=new WeakMap,ut=new WeakMap,An=new WeakMap,Qr=new WeakMap,K=new WeakSet,
|
|
838
|
+
</div>`}};Pe=new WeakMap,ut=new WeakMap,An=new WeakMap,Qr=new WeakMap,K=new WeakSet,Fi=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},bh=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,K,Fi).call(this,"input","change")))},Gp=function(e,t){let i=this.items.length,a=se(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,K,bh).call(this,l)},Xp=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let i=/^#?[0-9a-f]{6}$/i.test(t.trim())?Ht(t):null;i&&i!==this.value&&(f(this,Qr,i),this.value=i,s(this,K,Fi).call(this,"input")),this._invalid&&(i||!t.trim())&&(this._invalid=!1)},vh=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?Ht(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,K,Fi).call(this,"input"),s(this,K,Fi).call(this,"change")},Jp=function(e){e.stopPropagation(),s(this,K,vh).call(this)},Zp=function(e){e.key==="Enter"&&s(this,K,vh).call(this)},Qp=function(e){e.stopPropagation();let t=Ht(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,s(this,K,Fi).call(this,"input"))},eu=function(e){e.stopPropagation(),s(this,K,Fi).call(this,"change")},di.formAssociated=!0,di.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},di.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}},di.styles=[k,Ve,y`
|
|
839
839
|
:host { display: block; }
|
|
840
840
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
841
841
|
.swatch {
|
|
@@ -872,18 +872,18 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
872
872
|
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
873
873
|
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
874
874
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
875
|
-
`];w("cm-color-field",di);var sx=_("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."}),yh=3,kc=.7,Ff=.0055,Ec="#000000",tu=8,Nn=2,jf=400,Vf=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),Ze,Rn,es,Hn,Qe,et,tt,mi,pi,$e,In,ui,ts,z,xh,Mc,wh,It,Tc,$h,kh,iu,Eh,_c,Mh,zc,ru,Th,su,
|
|
875
|
+
`];w("cm-color-field",di);var sx=_("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."}),yh=3,kc=.7,Ff=.0055,Ec="#000000",tu=8,Nn=2,jf=400,Vf=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),Ze,Rn,es,Hn,Qe,et,tt,mi,pi,$e,In,ui,ts,z,xh,Mc,wh,It,Tc,$h,kh,iu,Eh,_c,Mh,zc,ru,Th,su,ji,Cc,_h,zh,au,Ch,nu,Lh,ou,lu,hi=class extends T{constructor(){super(...arguments);p(this,z);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,Ze,this.attachInternals());p(this,Rn,D("cm-sig"));p(this,es,"");p(this,Hn,"");p(this,Qe,[]);p(this,et);p(this,tt);p(this,mi,"");p(this,pi,0);p(this,$e);p(this,In,"");p(this,ui);p(this,ts,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?s(this,z,xh).call(this):(f(this,es,this.value),f(this,Hn,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),r(this,ui)?.disconnect(),f(this,ui,void 0),cancelAnimationFrame(r(this,pi)),f(this,pi,0),r(this,$e)&&(clearTimeout(r(this,$e)),f(this,$e,void 0))}get form(){return r(this,Ze).form}get validity(){return r(this,Ze).validity}get validationMessage(){return r(this,Ze).validationMessage}checkValidity(){return r(this,Ze).checkValidity()}reportValidity(){return r(this,Ze).reportValidity()}formResetCallback(){f(this,Qe,[]),f(this,et,void 0),f(this,tt,void 0),r(this,$e)&&(clearTimeout(r(this,$e)),f(this,$e,void 0)),this.typedName=r(this,Hn),r(this,es)?(f(this,mi,""),this.value=r(this,es)):this.updateComplete.then(()=>s(this,z,ji).call(this,!1)),s(this,z,It).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!r(this,Qe).length&&!r(this,tt)}toDataURL(){return s(this,z,_h).call(this)?.toDataURL("image/png")??""}toBlob(){let e=s(this,z,_h).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(f(this,Qe,[]),f(this,et,void 0),f(this,tt,void 0),s(this,z,It).call(this)),s(this,z,ji).call(this,!0)}undo(){this.mode==="draw"&&(r(this,Qe).length?r(this,Qe).pop():f(this,tt,void 0),f(this,et,void 0),s(this,z,It).call(this),s(this,z,ji).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==r(this,mi)){let t=this.value??"";if(f(this,mi,t),f(this,Qe,[]),f(this,et,void 0),!t)f(this,tt,void 0),this.hasUpdated&&(this.typedName="");else{let i=new Image;i.onload=()=>{r(this,tt)===i&&s(this,z,It).call(this)},i.src=t,f(this,tt,i),this.mode="draw"}s(this,z,It).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();f(this,mi,t),this.value=t}}firstUpdated(){s(this,z,xh).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>s(this,z,ji).call(this,!1)),s(this,z,zc).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&s(this,z,zc).call(this),r(this,Ze).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,Ze).setValidity({customError:!0},this.error,t):this.required&&this.empty?r(this,Ze).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ze).setValidity({})}render(){let e=r(this,Rn),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,Qe).length&&!r(this,tt),m=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
876
876
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
877
877
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
878
|
-
@click=${()=>
|
|
878
|
+
@click=${()=>s(this,z,zh).call(this,u,!0)} @keydown=${s(this,z,au)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
879
879
|
${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}
|
|
880
880
|
<div class="bar">
|
|
881
881
|
<div class="tabs" role="tablist" part="tabs"
|
|
882
882
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
883
883
|
aria-label=${this.label?h:t||this.t("modes")}>${m("draw")}${m("type")}</div>
|
|
884
884
|
<div class="actions">
|
|
885
|
-
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${
|
|
886
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${
|
|
885
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,z,ou)}>${this.t("undo")}</button>`:h}
|
|
886
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,z,lu)}>${this.t("clear")}</button>
|
|
887
887
|
</div>
|
|
888
888
|
</div>
|
|
889
889
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -892,9 +892,9 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
892
892
|
<span class="line" aria-hidden="true"></span>
|
|
893
893
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
894
894
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
895
|
-
aria-describedby=${[`${e}-instr`,
|
|
896
|
-
@pointerdown=${
|
|
897
|
-
@lostpointercapture=${
|
|
895
|
+
aria-describedby=${[`${e}-instr`,a].filter(Boolean).join(" ")}
|
|
896
|
+
@pointerdown=${s(this,z,iu)} @pointermove=${s(this,z,Eh)} @pointerup=${s(this,z,_c)} @pointercancel=${s(this,z,_c)}
|
|
897
|
+
@lostpointercapture=${s(this,z,_c)} @transitionend=${()=>s(this,z,Tc).call(this)}></canvas>
|
|
898
898
|
</div>
|
|
899
899
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
900
900
|
</div>
|
|
@@ -905,14 +905,14 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
905
905
|
.value=${le(this.typedName??"")} placeholder=${this.t("typePlaceholder")}
|
|
906
906
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
907
907
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
908
|
-
aria-describedby=${
|
|
909
|
-
@input=${
|
|
908
|
+
aria-describedby=${a||h} ?disabled=${this.disabled}
|
|
909
|
+
@input=${s(this,z,ru)} @change=${s(this,z,su)} />
|
|
910
910
|
</div>
|
|
911
911
|
</div>
|
|
912
912
|
${i?c`<p class="error" id="${e}-err" role="alert">${i}</p>`:h}
|
|
913
913
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
914
914
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
915
|
-
</div>`}};Ze=new WeakMap,Rn=new WeakMap,es=new WeakMap,Hn=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt=new WeakMap,mi=new WeakMap,pi=new WeakMap,$e=new WeakMap,In=new WeakMap,ui=new WeakMap,ts=new WeakMap,z=new WeakSet,xh=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,ui)||(f(this,ui,new ResizeObserver(()=>
|
|
915
|
+
</div>`}};Ze=new WeakMap,Rn=new WeakMap,es=new WeakMap,Hn=new WeakMap,Qe=new WeakMap,et=new WeakMap,tt=new WeakMap,mi=new WeakMap,pi=new WeakMap,$e=new WeakMap,In=new WeakMap,ui=new WeakMap,ts=new WeakMap,z=new WeakSet,xh=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,ui)||(f(this,ui,new ResizeObserver(()=>s(this,z,wh).call(this))),r(this,ui).observe(e))},Mc=function(){return this.renderRoot.querySelector("canvas")},wh=function(){let e=r(this,z,Mc);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;f(this,ts,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,z,Tc).call(this)},It=function(){r(this,pi)||f(this,pi,requestAnimationFrame(()=>{f(this,pi,0),s(this,z,Tc).call(this)}))},Tc=function(){let e=r(this,z,Mc);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,ts);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||Ec;s(this,z,$h).call(this,t,i,l,!0)},$h=function(e,t,i,a){let l=t/yh,d=r(this,tt);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,$=(l-v)/2;if(a&&!Wf(i,Ec)){let x=document.createElement("canvas");x.width=Math.max(1,Math.round(u*2)),x.height=Math.max(1,Math.round(v*2));let M=x.getContext("2d");M.drawImage(d,0,0,x.width,x.height),M.globalCompositeOperation="source-in",M.fillStyle=i,M.fillRect(0,0,x.width,x.height),e.drawImage(x,b,$,u,v)}else e.drawImage(d,b,$,u,v)}e.strokeStyle=i,e.fillStyle=i,e.lineCap="round",e.lineJoin="round";for(let m of r(this,Qe))Uf(e,m,t)},kh=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}},iu=function(e){if(this.disabled||r(this,et)||!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,z,kh).call(this,e,t.getBoundingClientRect())];f(this,et,{id:e.pointerId,stroke:i}),r(this,Qe).push(i),s(this,z,It).call(this)},Eh=function(e){let t=r(this,et);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,z,kh).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,z,It).call(this)},_c=function(e){let t=r(this,et);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&s(this,z,Eh).call(this,e),f(this,et,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}s(this,z,It).call(this),s(this,z,ji).call(this,!0)}},Mh=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},zc=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${r(this,z,Mh)}`,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,z,ji).call(this,!1)},()=>{})},ru=function(e){e.stopPropagation(),r(this,$e)?clearTimeout(r(this,$e)):f(this,In,this.value),this.typedName=e.target.value,f(this,$e,setTimeout(()=>s(this,z,Th).call(this),jf)),s(this,z,zc).call(this)},Th=function(){r(this,$e)&&(clearTimeout(r(this,$e)),f(this,$e,void 0),this.value!==r(this,In)&&s(this,z,Cc).call(this))},su=function(e){e.stopPropagation(),this.updateComplete.then(()=>s(this,z,Th).call(this))},ji=function(e){let t=this.empty?"":this.toDataURL(),i=t!==this.value;i&&(f(this,mi,t),this.value=t),this.requestUpdate(),e&&i&&s(this,z,Cc).call(this)},Cc=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}))},_h=function(){if(this.empty)return;let e=Math.max(r(this,z,Mc)?.clientWidth||r(this,ts)||600,300),t=e/yh,i=document.createElement("canvas");i.width=Math.round(e*Nn),i.height=Math.round(t*Nn);let a=i.getContext("2d",{willReadFrequently:!0});if(a.scale(Nn,Nn),this.mode==="type"){let l=Math.min(t*.45,64),d=r(this,z,Mh);a.font=`400 ${l}px ${d}`;let m=this.typedName.trim(),u=e-2*tu,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=Ec,a.fillText(m,e/2,t*kc)}else s(this,z,$h).call(this,a,e,Ec,!1);return Kf(i,tu*Nn)},zh=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${r(this,Rn)}-tab-${e}`)?.focus()),e===this.mode))return;let i=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&s(this,z,wh).call(this),this.value!==i&&s(this,z,Cc).call(this)})},au=function(e){let t=se(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,z,zh).call(this,i,!0)},Ch=function(e){s(this,z,nu).call(this,this.t(e))},nu=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},Lh=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()})},ou=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),s(this,z,Ch).call(this,"undone"),s(this,z,Lh).call(this,e)},lu=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),s(this,z,Ch).call(this,"cleared"),s(this,z,Lh).call(this,e)},hi.formAssociated=!0,hi.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},hi.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}},hi.styles=[k,y`
|
|
916
916
|
:host { display: block; }
|
|
917
917
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
918
918
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -978,17 +978,17 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
978
978
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
979
979
|
|
|
980
980
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
981
|
-
`];function Uf(o,n,e){let t=d=>e*Ff*(.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],
|
|
981
|
+
`];function Uf(o,n,e){let t=d=>e*Ff*(.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=Vf(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 Kf(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 $=0;$<e;$++)i[b+$*4+3]>8&&($<l&&(l=$),$>d&&(d=$),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 Wf(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)}w("cm-signature-field",hi);var hx=_("optionGroup",{required:"Please select one of these options."}),nt,Pn,is,On,ft,Sh,Dh,cu,gt=class extends T{constructor(){super(...arguments);p(this,ft);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];p(this,nt,this.attachInternals());p(this,Pn,D("cm-og"));p(this,is,"");p(this,On,new MutationObserver(()=>s(this,ft,Sh).call(this)))}connectedCallback(){super.connectedCallback(),s(this,ft,Sh).call(this),r(this,On).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,On).disconnect()}get form(){return r(this,nt).form}get validity(){return r(this,nt).validity}get validationMessage(){return r(this,nt).validationMessage}checkValidity(){return r(this,nt).checkValidity()}reportValidity(){return r(this,nt).reportValidity()}formResetCallback(){this.value=r(this,is)}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,is)||f(this,is,this.value)}updated(){r(this,nt).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,nt).setValidity({valueMissing:!0},this.t("required"),e):r(this,nt).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`
|
|
982
982
|
${this.label?c`<span class="label" id="${r(this,Pn)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
983
983
|
<div class="options" part="options" role="radiogroup"
|
|
984
|
-
aria-labelledby=${this.label?`${r(this,Pn)}-l`:h} aria-label=${!this.label&&
|
|
984
|
+
aria-labelledby=${this.label?`${r(this,Pn)}-l`:h} aria-label=${!this.label&&a?a:h}
|
|
985
985
|
aria-required=${this.required?"true":h}>
|
|
986
986
|
${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"}
|
|
987
987
|
tabindex=${d===i?"0":"-1"} ?disabled=${this.disabled||!!l.disabled}
|
|
988
|
-
@click=${()=>
|
|
988
|
+
@click=${()=>s(this,ft,Dh).call(this,d)} @keydown=${m=>s(this,ft,cu).call(this,m,d)}>${l.label}</button>`)}
|
|
989
989
|
</div>
|
|
990
990
|
<slot></slot>
|
|
991
|
-
`}};nt=new WeakMap,Pn=new WeakMap,is=new WeakMap,On=new WeakMap,ft=new WeakSet,Sh=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},
|
|
991
|
+
`}};nt=new WeakMap,Pn=new WeakMap,is=new WeakMap,On=new WeakMap,ft=new WeakSet,Sh=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??"",f(this,is,this.value))},Dh=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}))))},cu=function(e,t){let i=se(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,ft,Dh).call(this,d)},gt.formAssociated=!0,gt.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},gt.styles=[k,y`
|
|
992
992
|
:host { display: block; }
|
|
993
993
|
.label {
|
|
994
994
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1063,8 +1063,8 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1063
1063
|
</div>
|
|
1064
1064
|
<div class="actions">
|
|
1065
1065
|
${this.pagination?c`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
1066
|
-
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>
|
|
1067
|
-
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>
|
|
1066
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,qn,Ah).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
1067
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,qn,Ah).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
1068
1068
|
</div>`:h}
|
|
1069
1069
|
<slot name="actions"></slot>
|
|
1070
1070
|
</div>
|
|
@@ -1152,13 +1152,13 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1152
1152
|
|
|
1153
1153
|
.actions { gap: var(--cm-space-8); }
|
|
1154
1154
|
}
|
|
1155
|
-
`];w("cm-action-bar",as);var Ix=_("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),bt,
|
|
1155
|
+
`];w("cm-action-bar",as);var Ix=_("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),bt,Vi,Bn,ke,Nh,Rh,Hh,du,hu,ns=class extends T{constructor(){super(...arguments);p(this,ke);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";p(this,bt,null);p(this,Vi,()=>{this.open=!0});p(this,Bn,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>s(this,ke,Nh).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,ke,Rh).call(this)}updated(e){e.has("form")&&this.isConnected&&s(this,ke,Nh).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1156
1156
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1157
1157
|
<div class="actions">
|
|
1158
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${
|
|
1159
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${
|
|
1158
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,ke,hu)}>${this.discardLabel}</cm-button>
|
|
1159
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,ke,du)}>${this.saveLabel}</cm-button>
|
|
1160
1160
|
</div>
|
|
1161
|
-
</div>`}};bt=new WeakMap,
|
|
1161
|
+
</div>`}};bt=new WeakMap,Vi=new WeakMap,Bn=new WeakMap,ke=new WeakSet,Nh=function(){s(this,ke,Rh).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(f(this,bt,e),e.addEventListener("input",r(this,Vi)),e.addEventListener("change",r(this,Vi)),e.addEventListener("reset",r(this,Bn)))},Rh=function(){let e=r(this,bt);e&&(e.removeEventListener("input",r(this,Vi)),e.removeEventListener("change",r(this,Vi)),e.removeEventListener("reset",r(this,Bn)),f(this,bt,null))},Hh=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},du=function(){this.loading||this.saveDisabled||s(this,ke,Hh).call(this,"cm-save")&&r(this,bt)&&r(this,bt).requestSubmit()},hu=function(){this.loading||s(this,ke,Hh).call(this,"cm-discard")&&r(this,bt)&&(r(this,bt).reset(),this.open=!1)},ns.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:{}},ns.styles=[k,y`
|
|
1162
1162
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1163
1163
|
:host(:not([open])) { display: none; }
|
|
1164
1164
|
.bar {
|
|
@@ -1206,16 +1206,16 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1206
1206
|
margin-top: var(--cm-space-4); font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; overflow-wrap: anywhere;
|
|
1207
1207
|
|
|
1208
1208
|
}
|
|
1209
|
-
`];w("cm-info-item",ls);var
|
|
1209
|
+
`];w("cm-info-item",ls);var Ui,cs=class extends C{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;p(this,Ui,D("cm-accordion"))}toggle(){this.disabled||(this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{bubbles:!0,composed:!0,detail:{open:this.open}})))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||3));return c`<div class="wrap" part="accordion">
|
|
1210
1210
|
<div class="h" role="heading" aria-level=${e}>
|
|
1211
|
-
<button type="button" part="toggle" id="${r(this,
|
|
1211
|
+
<button type="button" part="toggle" id="${r(this,Ui)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Ui)}-body"
|
|
1212
1212
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
1213
1213
|
<span>${this.heading}</span>
|
|
1214
1214
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
1215
1215
|
</button>
|
|
1216
1216
|
</div>
|
|
1217
|
-
<div class="body" part="body" id="${r(this,
|
|
1218
|
-
</div>`}};
|
|
1217
|
+
<div class="body" part="body" id="${r(this,Ui)}-body" role="region" aria-labelledby="${r(this,Ui)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
1218
|
+
</div>`}};Ui=new WeakMap,cs.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},cs.styles=[k,y`
|
|
1219
1219
|
:host { display: block; }
|
|
1220
1220
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
1221
1221
|
.h { margin: 0; font: inherit; }
|
|
@@ -1238,23 +1238,23 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1238
1238
|
.body[hidden] { display: none; }
|
|
1239
1239
|
|
|
1240
1240
|
|
|
1241
|
-
`];w("cm-accordion",cs);var Se,
|
|
1241
|
+
`];w("cm-accordion",cs);var Se,Ki,Ih,mu,ds=class extends C{constructor(){super(...arguments);p(this,Se);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="large";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,Se,mu).call(this,e);let t=this.image?c`<img src=${this.image} alt="" part="image">`:this.icon?c`<cm-icon name=${this.icon} size="48"></cm-icon>
|
|
1242
1242
|
`:h;return c`<div class="wrap" part="empty-state">
|
|
1243
1243
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1244
|
-
<slot name="image" @slotchange=${i=>
|
|
1244
|
+
<slot name="image" @slotchange=${i=>s(this,Se,Ki).call(this,i,"hasImage")}>${t}</slot>
|
|
1245
1245
|
</div>
|
|
1246
1246
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1247
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>
|
|
1248
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>
|
|
1249
|
-
</div>`}};Se=new WeakSet,
|
|
1247
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,Se,Ki).call(this,i,"hasText")}></slot></div>
|
|
1248
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,Se,Ki).call(this,i,"hasActions")}></slot></div>${this.action?c`<div class="actions">${s(this,Se,Ih).call(this)}</div>`:h}
|
|
1249
|
+
</div>`}};Se=new WeakSet,Ki=function(e,t){let i=e.target;this[t]=i.assignedNodes({flatten:!0}).some(a=>a.nodeType===1||a.textContent.trim()),this.requestUpdate()},Ih=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"
|
|
1250
1250
|
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},mu=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">
|
|
1251
1251
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1252
|
-
<slot name="image" @slotchange=${i=>
|
|
1252
|
+
<slot name="image" @slotchange=${i=>s(this,Se,Ki).call(this,i,"hasImage")}>${t}</slot>
|
|
1253
1253
|
</span>
|
|
1254
1254
|
<div class="line">
|
|
1255
1255
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1256
|
-
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>
|
|
1257
|
-
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>
|
|
1256
|
+
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,Se,Ki).call(this,i,"hasText")}></slot></span>${s(this,Se,Ih).call(this)}
|
|
1257
|
+
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,Se,Ki).call(this,i,"hasActions")}></slot></span>
|
|
1258
1258
|
</div>
|
|
1259
1259
|
</div>`},ds.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0},action:{},actionHref:{attribute:"action-href"}},ds.styles=[k,y`
|
|
1260
1260
|
:host { display: block; }
|
|
@@ -1346,7 +1346,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1346
1346
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
1347
1347
|
.head { height: 60px; }
|
|
1348
1348
|
}
|
|
1349
|
-
`];w("cm-skeleton-display",ms);var c0=_("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),Lc,uu,ps=class extends T{constructor(){super(...arguments);p(this,Lc);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=
|
|
1349
|
+
`];w("cm-skeleton-display",ms);var c0=_("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),Lc,uu,ps=class extends T{constructor(){super(...arguments);p(this,Lc);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,Lc,uu).call(this);return c`<article part="comment">
|
|
1350
1350
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
1351
1351
|
<div class="body" part="body"><slot></slot></div>
|
|
1352
1352
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
@@ -1362,7 +1362,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1362
1362
|
<div class="title" id="${r(this,Fn)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1363
1363
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
1364
1364
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
1365
|
-
@keydown=${
|
|
1365
|
+
@keydown=${s(this,Sc,gu)}></textarea>
|
|
1366
1366
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
1367
1367
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
1368
1368
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
@@ -1387,8 +1387,8 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1387
1387
|
|
|
1388
1388
|
.actions { justify-content: flex-end; }
|
|
1389
1389
|
}
|
|
1390
|
-
`];w("cm-comment-box",us);var Dc='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',pe,fs,gi,fi,vt,bs,vs,Oe,Ph,Ac,Nc,Rc,Hc,ys,fu,
|
|
1391
|
-
data-side=${this._side}>${this.content}</div>`}};pe=new WeakMap,fs=new WeakMap,gi=new WeakMap,fi=new WeakMap,vt=new WeakMap,bs=new WeakMap,vs=new WeakMap,Oe=new WeakSet,Ph=function(){document.removeEventListener("keydown",r(this,ys),!0),removeEventListener("scroll",r(this,Pt),!0),removeEventListener("resize",r(this,Pt))},Ac=new WeakMap,Nc=new WeakMap,Rc=new WeakMap,Hc=new WeakMap,ys=new WeakMap,fu=function(e){return e.matches(Dc)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(Dc)??e},
|
|
1390
|
+
`];w("cm-comment-box",us);var Dc='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',pe,fs,gi,fi,vt,bs,vs,Oe,Ph,Ac,Nc,Rc,Hc,ys,fu,Wi,Oh,qh,Pt,gs=class extends C{constructor(){super(...arguments);p(this,Oe);this.content="";this.placement="top";this.delay=300;this.open=!1;this.visualOnly=!1;this._side="top";p(this,pe);p(this,fs);p(this,gi,[]);p(this,fi);p(this,vt);p(this,bs,!1);p(this,vs,!1);p(this,Ac,()=>{f(this,bs,!0),clearTimeout(r(this,vt)),this.open||f(this,vt,setTimeout(()=>this.show(),this.delay))});p(this,Nc,()=>{f(this,bs,!1),clearTimeout(r(this,vt)),r(this,vs)||f(this,vt,setTimeout(()=>this.hide(),100))});p(this,Rc,()=>{f(this,vs,!0),this.show()});p(this,Hc,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(f(this,vs,!1),r(this,bs)||this.hide())});p(this,ys,e=>{e.key==="Escape"&&this.open&&this.hide()});p(this,Wi,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(s(this,Oe,qh).call(this),!t||!this.content||this.visualOnly)return;let i=t.updateComplete;t.localName.includes("-")&&i&&!t.shadowRoot?.querySelector(Dc)&&i.then(()=>{t.shadowRoot?.querySelector(Dc)&&r(this,Wi).call(this)}),r(this,pe)||(f(this,pe,document.createElement("span")),r(this,pe).id=D("cm-tooltip"),r(this,pe).hidden=!0,r(this,pe).slot="description"),r(this,pe).textContent=this.content,r(this,pe).isConnected||this.append(r(this,pe));let a=s(this,Oe,fu).call(this,t);if(f(this,fs,a),a.getRootNode()===r(this,pe).getRootNode()){let l=(a.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);l.includes(r(this,pe).id)||a.setAttribute("aria-describedby",[...l,r(this,pe).id].join(" "))}else"ariaDescribedByElements"in a?(s(this,Oe,Oh).call(this,a),f(this,fi,new MutationObserver(()=>{a.getAttribute("aria-describedby")!==""&&s(this,Oe,Oh).call(this,a)})),r(this,fi).observe(a,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,pe).id)});p(this,Pt,()=>{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",$=Q=>Q==="start"?b?"right":"left":Q==="end"?b?"left":"right":Q,x={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"},A=$(this.placement);!x[A]&&x[M[A]]&&(A=M[A]);let I,B;A==="top"||A==="bottom"?(I=a.left+a.width/2-l.width/2,B=A==="top"?a.top-d-l.height:a.bottom+d):(B=a.top+a.height/2-l.height/2,I=A==="left"?a.left-d-l.width:a.right+d),I=Math.min(Math.max(m,I),u-m-l.width),B=Math.min(Math.max(m,B),v-m-l.height),e.style.transform=`translate(${Math.round(I)}px, ${Math.round(B)}px)`;let V={top:"top",bottom:"bottom",left:b?"end":"start",right:b?"start":"end"};this._side=V[A]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,Ac)),this.addEventListener("pointerleave",r(this,Nc)),this.addEventListener("focusin",r(this,Rc)),this.addEventListener("focusout",r(this,Hc)),this.addEventListener("keydown",r(this,ys)),this.hasUpdated&&r(this,Wi).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),s(this,Oe,qh).call(this),s(this,Oe,Ph).call(this),clearTimeout(r(this,vt))}show(){clearTimeout(r(this,vt)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,ys),!0),addEventListener("scroll",r(this,Pt),!0),addEventListener("resize",r(this,Pt)),this.updateComplete.then(r(this,Pt)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,vt)),this.open&&(this.open=!1,s(this,Oe,Ph).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,Wi).call(this),this.content?this.open&&r(this,Pt).call(this):this.hide())}render(){return c`<slot @slotchange=${r(this,Wi)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1391
|
+
data-side=${this._side}>${this.content}</div>`}};pe=new WeakMap,fs=new WeakMap,gi=new WeakMap,fi=new WeakMap,vt=new WeakMap,bs=new WeakMap,vs=new WeakMap,Oe=new WeakSet,Ph=function(){document.removeEventListener("keydown",r(this,ys),!0),removeEventListener("scroll",r(this,Pt),!0),removeEventListener("resize",r(this,Pt))},Ac=new WeakMap,Nc=new WeakMap,Rc=new WeakMap,Hc=new WeakMap,ys=new WeakMap,fu=function(e){return e.matches(Dc)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(Dc)??e},Wi=new WeakMap,Oh=function(e){f(this,gi,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),i=r(this,gi).map(a=>t.getElementById(a)).filter(a=>!!a);e.ariaDescribedByElements=[...i,r(this,pe)]},qh=function(){let e=r(this,fs);if(!(!e||!r(this,pe))){if(r(this,fi))r(this,fi).disconnect(),f(this,fi,void 0),r(this,gi).length?e.setAttribute("aria-describedby",r(this,gi).join(" ")):e.removeAttribute("aria-describedby"),f(this,gi,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(i=>i&&i!==r(this,pe).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}f(this,fs,void 0)}},Pt=new WeakMap,gs.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},gs.styles=[k,y`
|
|
1392
1392
|
:host { display: inline-block; position: relative; }
|
|
1393
1393
|
.tip {
|
|
1394
1394
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -1403,7 +1403,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1403
1403
|
:host([open]) .tip { opacity: 1; visibility: visible; }
|
|
1404
1404
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1405
1405
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1406
|
-
`];w("cm-tooltip",gs);var y0=_("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"}),x0=_("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),Xf=7,jn=new Set,Vn;function bu(o,n){n?jn.add(o):jn.delete(o),jn.size&&!Vn&&(Vn=setInterval(()=>jn.forEach(e=>e.requestUpdate()),6e4)),!jn.size&&Vn&&(clearInterval(Vn),Vn=void 0)}var Un,
|
|
1406
|
+
`];w("cm-tooltip",gs);var y0=_("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"}),x0=_("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),Xf=7,jn=new Set,Vn;function bu(o,n){n?jn.add(o):jn.delete(o),jn.size&&!Vn&&(Vn=setInterval(()=>jn.forEach(e=>e.requestUpdate()),6e4)),!jn.size&&Vn&&(clearInterval(Vn),Vn=void 0)}var Un,Gi,ot,Bh,Ic,vu,xs=class extends T{constructor(){super(...arguments);p(this,ot);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,Un,D("cm-tl"));p(this,Gi)}connectedCallback(){super.connectedCallback(),bu(this,!0)}disconnectedCallback(){super.disconnectedCallback(),bu(this,!1),r(this,Gi)?.disconnect(),f(this,Gi,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(f(this,Gi,new ResizeObserver(()=>s(this,ot,Bh).call(this))),r(this,Gi).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&s(this,ot,Bh).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<Xf?this.t(i?"inDays":"daysAgo",{count:d}):ee(e,{dateStyle:"medium"},this.locale)}get fullTime(){let e=this.date;return e?ee(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">
|
|
1407
1407
|
<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>
|
|
1408
1408
|
<div class="main">
|
|
1409
1409
|
<div class="head">
|
|
@@ -1411,14 +1411,14 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1411
1411
|
<slot name="badge"></slot>
|
|
1412
1412
|
${l}
|
|
1413
1413
|
</div>
|
|
1414
|
-
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>
|
|
1415
|
-
<div class="body ${
|
|
1416
|
-
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>
|
|
1414
|
+
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,ot,Ic).call(this,d,"_meta")}>${this.meta}</slot></div>
|
|
1415
|
+
<div class="body ${a?"clamp":""}" id="${r(this,Un)}-body" part="body" ?hidden=${!this._body}
|
|
1416
|
+
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,ot,Ic).call(this,d,"_body")}></slot></div>
|
|
1417
1417
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
1418
|
-
aria-controls="${r(this,Un)}-body" @click=${
|
|
1419
|
-
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>
|
|
1418
|
+
aria-controls="${r(this,Un)}-body" @click=${s(this,ot,vu)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
1419
|
+
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,ot,Ic).call(this,d,"_actions")}></slot></div>
|
|
1420
1420
|
</div>
|
|
1421
|
-
</div>`}};Un=new WeakMap,
|
|
1421
|
+
</div>`}};Un=new WeakMap,Gi=new WeakMap,ot=new WeakSet,Bh=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},Ic=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(a=>a.nodeType===Node.ELEMENT_NODE||(a.textContent??"").trim())},vu=function(){this.expanded=!this.expanded},xs.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}},xs.styles=[k,y`
|
|
1422
1422
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
1423
1423
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
1424
1424
|
.icon {
|
|
@@ -1454,16 +1454,16 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1454
1454
|
[hidden] { display: none !important; }
|
|
1455
1455
|
.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; }
|
|
1456
1456
|
::slotted([slot='badge']) { flex: none; }
|
|
1457
|
-
`];w("cm-timeline-item",xs);var Kn,ws,
|
|
1457
|
+
`];w("cm-timeline-item",xs);var Kn,ws,Xi,Fh,yu,Yi=class extends T{constructor(){super(...arguments);p(this,Xi);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];p(this,Kn,new MutationObserver(()=>s(this,Xi,Fh).call(this)));p(this,ws,!1)}connectedCallback(){super.connectedCallback(),s(this,Xi,Fh).call(this),r(this,Kn).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Kn).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){f(this,ws,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,ws)&&!this.renderRoot.querySelector(".more cm-button")&&(f(this,ws,!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">
|
|
1458
1458
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
1459
1459
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
1460
1460
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
1461
1461
|
</ol>`:h}
|
|
1462
1462
|
${i}
|
|
1463
1463
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
1464
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${
|
|
1464
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,Xi,yu)}>${this.moreLabel}</cm-button></div>`:h}
|
|
1465
1465
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
1466
|
-
`}};Kn=new WeakMap,ws=new WeakMap,
|
|
1466
|
+
`}};Kn=new WeakMap,ws=new WeakMap,Xi=new WeakSet,Fh=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},yu=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},Yi.shadowRootOptions={...C.shadowRootOptions,slotAssignment:"manual"},Yi.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}},Yi.styles=[k,y`
|
|
1467
1467
|
:host { display: block; }
|
|
1468
1468
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
1469
1469
|
ol:focus { outline: none; }
|
|
@@ -1486,7 +1486,7 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1486
1486
|
@media (max-width: 640px) {
|
|
1487
1487
|
.more { padding-inline-start: 0; }
|
|
1488
1488
|
}
|
|
1489
|
-
`];w("cm-timeline",
|
|
1489
|
+
`];w("cm-timeline",Yi);var _0=_("smartTip",{newTab:"(opens in a new tab)"}),z0=_("smartTips",{heading:"Smart tips",tourAction:"Start"}),$s=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}>
|
|
1490
1490
|
<span class="text">
|
|
1491
1491
|
<span class="title" part="heading">${this.heading}</span>
|
|
1492
1492
|
<span class="desc" part="description"><slot></slot></span>
|
|
@@ -1538,22 +1538,22 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1538
1538
|
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;
|
|
1539
1539
|
}
|
|
1540
1540
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1541
|
-
`];w("cm-smart-tips",ks);var N0=_("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"}),Ot,Ms,xu,wu,Es=class extends T{constructor(){super(...arguments);p(this,Ms);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;p(this,Ot,D("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,
|
|
1541
|
+
`];w("cm-smart-tips",ks);var N0=_("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"}),Ot,Ms,xu,wu,Es=class extends T{constructor(){super(...arguments);p(this,Ms);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;p(this,Ot,D("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`
|
|
1542
1542
|
<nav part="bar" aria-label=${this.label}>
|
|
1543
1543
|
${l.length?c`<div class="rows" part="rows">
|
|
1544
1544
|
<label for="${r(this,Ot)}-s">${this.t("rows")}</label>
|
|
1545
|
-
<span class="field"><select id="${r(this,Ot)}-s" @change=${
|
|
1545
|
+
<span class="field"><select id="${r(this,Ot)}-s" @change=${s(this,Ms,xu)}>
|
|
1546
1546
|
${(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>`)}
|
|
1547
1547
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
1548
1548
|
</div>`:h}
|
|
1549
|
-
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:i,to:
|
|
1549
|
+
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:i,to:a,total:this.total,resource:this.resourceName}).replace(/\s+/g," ").trim():h}</div>
|
|
1550
1550
|
<div class="pages" part="pages">
|
|
1551
1551
|
<span class="counter">
|
|
1552
1552
|
<label for="${r(this,Ot)}-p">${this.t("page")}</label>
|
|
1553
1553
|
<input id="${r(this,Ot)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1554
1554
|
.value=${this._draft??String(t)} aria-describedby="${r(this,Ot)}-of"
|
|
1555
1555
|
@input=${d=>this._draft=d.target.value}
|
|
1556
|
-
@keydown=${
|
|
1556
|
+
@keydown=${s(this,Ms,wu)}
|
|
1557
1557
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
1558
1558
|
<span id="${r(this,Ot)}-of">${this.t("of",{count:e})}</span>
|
|
1559
1559
|
</span>
|
|
@@ -1606,14 +1606,14 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1606
1606
|
.arrows { display: contents; }
|
|
1607
1607
|
.prev { order: -1; }
|
|
1608
1608
|
}
|
|
1609
|
-
`];w("cm-pagination",Es);var B0=_("statusTabs",{label:"Status"}),Wn,it,jh,$u,Vh,ku,Ts=class extends T{constructor(){super(...arguments);p(this,it);this.value="";this.tabs=[];this.controls="";this.size="large";this._slotted=[];p(this,Wn,new MutationObserver(()=>
|
|
1609
|
+
`];w("cm-pagination",Es);var B0=_("statusTabs",{label:"Status"}),Wn,it,jh,$u,Vh,ku,Ts=class extends T{constructor(){super(...arguments);p(this,it);this.value="";this.tabs=[];this.controls="";this.size="large";this._slotted=[];p(this,Wn,new MutationObserver(()=>s(this,it,jh).call(this)))}connectedCallback(){super.connectedCallback(),s(this,it,jh).call(this),r(this,Wn).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Wn).disconnect()}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(){if(!("ariaControlsElements"in Element.prototype))return;let e=this.getRootNode(),t=this.controls?e.getElementById?.(this.controls):null;for(let i of this.renderRoot.querySelectorAll("button"))i.ariaControlsElements=t?[t]:null}render(){let e=this.items,t=s(this,it,$u).call(this,e);return c`
|
|
1610
1610
|
<div class="tabs" part="tabs" role="tablist" aria-label=${this.getAttribute("aria-label")||this.t("label")}>
|
|
1611
|
-
${e.map((i,
|
|
1612
|
-
tabindex=${
|
|
1613
|
-
@click=${()=>
|
|
1611
|
+
${e.map((i,a)=>c`<button type="button" role="tab" part="tab" aria-selected=${a===t?"true":"false"}
|
|
1612
|
+
tabindex=${a===t?"0":"-1"} ?disabled=${!!i.disabled}
|
|
1613
|
+
@click=${()=>s(this,it,Vh).call(this,a)} @keydown=${l=>s(this,it,ku).call(this,l,a)}><span class="label" data-text=${i.label}>${i.label}</span>${i.count!==void 0&&!Number.isNaN(i.count)?c`<span class="sr">, </span><span class="count" part="count">${this.formatNumber(i.count)}</span>`:h}</button>`)}
|
|
1614
1614
|
</div>
|
|
1615
1615
|
<slot></slot>
|
|
1616
|
-
`}};Wn=new WeakMap,it=new WeakSet,jh=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??"")},$u=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},Vh=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}))))},ku=function(e,t){let i=se(e,this),
|
|
1616
|
+
`}};Wn=new WeakMap,it=new WeakSet,jh=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??"")},$u=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},Vh=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}))))},ku=function(e,t){let i=se(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,it,Vh).call(this,d)},Ts.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},_slotted:{state:!0}},Ts.styles=[k,y`
|
|
1617
1617
|
:host { display: block; }
|
|
1618
1618
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
1619
1619
|
.tabs {
|
|
@@ -1650,17 +1650,17 @@ var Gm=o=>{throw TypeError(o)};var Md=(o,n,e)=>n.has(o)||Gm("Cannot "+e);var r=(
|
|
|
1650
1650
|
@media (max-width: 640px) {
|
|
1651
1651
|
.tabs { gap: var(--cm-space-16); }
|
|
1652
1652
|
}
|
|
1653
|
-
`];w("cm-status-tabs",Ts);var Y0=_("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),Pc,Yn,qt,Uh,Eu,Mu,_s=class extends T{constructor(){super(...arguments);p(this,qt);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;p(this,Pc,D("cm-th"));p(this,Yn,new MutationObserver(()=>
|
|
1653
|
+
`];w("cm-status-tabs",Ts);var Y0=_("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),Pc,Yn,qt,Uh,Eu,Mu,_s=class extends T{constructor(){super(...arguments);p(this,qt);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;p(this,Pc,D("cm-th"));p(this,Yn,new MutationObserver(()=>s(this,qt,Uh).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),s(this,qt,Uh).call(this),r(this,Yn).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Yn).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`
|
|
1654
1654
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
1655
1655
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
1656
1656
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
1657
1657
|
<input id="${r(this,Pc)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
1658
|
-
@change=${
|
|
1658
|
+
@change=${s(this,qt,Mu)} />
|
|
1659
1659
|
<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>
|
|
1660
1660
|
</span></span>`:h}
|
|
1661
|
-
${t.map(i=>{let
|
|
1662
|
-
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${
|
|
1663
|
-
name=${
|
|
1661
|
+
${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}
|
|
1662
|
+
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,qt,Eu).call(this,i)}>${d}${e?h:c`<span class="sr">${a?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
1663
|
+
name=${a&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
1664
1664
|
</div>
|
|
1665
1665
|
<slot></slot>
|
|
1666
1666
|
`}};Pc=new WeakMap,Yn=new WeakMap,qt=new WeakSet,Uh=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"}})},Eu=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}))},Mu=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}))},_s.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}},_s.styles=[k,y`
|
|
@@ -1731,22 +1731,22 @@ cm-data-table > table th > button.cm-sort:hover cm-icon, cm-data-table > table t
|
|
|
1731
1731
|
cm-data-table > table th > button.cm-sort:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1732
1732
|
@media (forced-colors: active) { cm-data-table > table th > button.cm-sort cm-icon { opacity: 1; } }
|
|
1733
1733
|
cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-data-table > table [data-type='money'] { text-align: end; font-variant-numeric: tabular-nums; }
|
|
1734
|
-
`;function Zf(){if(Tu||typeof document>"u")return;Tu=!0;let o=new CSSStyleSheet;o.replaceSync(Jf),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var Qf=o=>(o.align??(o.type==="numeric"||o.type==="money"?"end":"start"))==="end";function _u(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 zu=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),Cu=new Map;function eb(o){let n=Cu.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"})}Cu.set(o??"",n)}return n}function Lu(o,n,e,t){let i=
|
|
1734
|
+
`;function Zf(){if(Tu||typeof document>"u")return;Tu=!0;let o=new CSSStyleSheet;o.replaceSync(Jf),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var Qf=o=>(o.align??(o.type==="numeric"||o.type==="money"?"end":"start"))==="end";function _u(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 zu=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),Cu=new Map;function eb(o){let n=Cu.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"})}Cu.set(o??"",n)}return n}function Lu(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"?(_u(o)||0)-(_u(n)||0):e==="date"?(zu(o)||0)-(zu(n)||0):eb(t).compare(String(o),String(n))}var Ls,Gn,W,Kh,Wh,Su,Yh,Du,Au,Oc,zs,Cs=class extends T{constructor(){super(...arguments);p(this,W);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._light=!1;this._announce="";p(this,Ls,!1);p(this,Gn,new MutationObserver(()=>s(this,W,Kh).call(this)))}connectedCallback(){super.connectedCallback(),s(this,W,Kh).call(this),r(this,Gn).observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Gn).disconnect()}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==="",$=v==null||v==="";return b||$?b===$?l-m:b?1:-1:i*Lu(u,v,t.type,this.locale)||l-m}).map(([a])=>a)}updated(e){if(r(this,Ls)&&(e.has("sort")||e.has("direction"))&&this.sort){f(this,Ls,!1);let t=this.columns.find(i=>i.key===this.sort);t&&s(this,W,Wh).call(this,t.label,this.direction)}}render(){let e=c`<span class="sr" role="status">${this._announce}</span>`;if(this._light)return c`<div class="scroll" part="scroll"><slot></slot></div>${e}`;let t=this.columns??[],i=this.sortedRows,a=Math.max(1,t.length),l=!this.loading&&i.length===0;return c`
|
|
1735
1735
|
<div class="scroll" part="scroll" tabindex=${this.stickyHeader||this.stickyFirstColumn?"0":h}
|
|
1736
1736
|
role=${this.stickyHeader||this.stickyFirstColumn?"region":h}
|
|
1737
1737
|
aria-label=${(this.stickyHeader||this.stickyFirstColumn)&&this.caption?this.caption:h}>
|
|
1738
1738
|
<table part="table" aria-busy=${this.loading?"true":"false"}>
|
|
1739
1739
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
1740
|
-
<thead><tr>${t.map(d=>{let m=this.sort===d.key,u=m?this.direction:"none",v=d.hidden?c`<span class="sr">${d.label}</span>`:d.label;return c`<th scope="col" class=${
|
|
1740
|
+
<thead><tr>${t.map(d=>{let m=this.sort===d.key,u=m?this.direction:"none",v=d.hidden?c`<span class="sr">${d.label}</span>`:d.label;return c`<th scope="col" class=${s(this,W,zs).call(this,d)} aria-sort=${d.sortable?u:h}>${d.sortable?c`<button type="button" class=${m?"on":""} @click=${()=>s(this,W,Au).call(this,d)}>${v}<cm-icon
|
|
1741
1741
|
name=${m&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:v}</th>`})}</tr></thead>
|
|
1742
1742
|
<tbody>
|
|
1743
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${t.map(d=>c`<td class=${
|
|
1744
|
-
${l?c`<tr class="empty"><td colspan=${
|
|
1743
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${t.map(d=>c`<td class=${s(this,W,zs).call(this,d)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):i.map(d=>c`<tr part="row">${t.map((m,u)=>u===0?c`<th scope="row" class=${s(this,W,zs).call(this,m)} part="cell">${s(this,W,Oc).call(this,d[m.key])}</th>`:c`<td class=${s(this,W,zs).call(this,m)} part="cell">${s(this,W,Oc).call(this,d[m.key])}</td>`)}</tr>`)}
|
|
1744
|
+
${l?c`<tr class="empty"><td colspan=${a}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
1745
1745
|
</tbody>
|
|
1746
|
-
${this.totals&&!this.loading&&!l?c`<tfoot><tr part="totals">${t.map(d=>c`<td class=${
|
|
1746
|
+
${this.totals&&!this.loading&&!l?c`<tfoot><tr part="totals">${t.map(d=>c`<td class=${s(this,W,zs).call(this,d)}>${s(this,W,Oc).call(this,this.totals[d.key])}</td>`)}</tr></tfoot>`:h}
|
|
1747
1747
|
</table>
|
|
1748
1748
|
</div>${e}
|
|
1749
|
-
`}};Ls=new WeakMap,Gn=new WeakMap,W=new WeakSet,Kh=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(Zf(),
|
|
1749
|
+
`}};Ls=new WeakMap,Gn=new WeakMap,W=new WeakSet,Kh=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(Zf(),s(this,W,Su).call(this))},Wh=function(e,t){this._announce=this.t("sorted",{column:e,direction:this.t(t)})},Su=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;t&&[...t].forEach((i,a)=>{if(!i.dataset.sort||i.querySelector(":scope > button.cm-sort"))return;i.dataset.type=i.dataset.sort;let l=document.createElement("button");l.type="button",l.className="cm-sort",l.append(...i.childNodes);let d=document.createElement("cm-icon");d.setAttribute("size","12"),l.append(d),i.append(l),i.hasAttribute("aria-sort")||i.setAttribute("aria-sort","none"),s(this,W,Yh).call(this,i),l.addEventListener("click",()=>s(this,W,Du).call(this,e,i,a))})},Yh=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Du=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 $=M=>{let A=M.cells[i];return A?(A.dataset.value??A.textContent??"").trim():""},x=[...b.rows].map((M,A)=>[M,$(M),A]).sort(([,M,A],[,I,B])=>M===""||I===""?M===I?A-B:M===""?1:-1:v*Lu(M,I,u,this.locale)||A-B);b.append(...x.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,W,Yh).call(this,b));s(this,W,Wh).call(this,a,d)},Au=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);f(this,Ls,a),a&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},Oc=function(e){return e==null?"":e instanceof Date?ee(e,{},this.locale):String(e)},zs=function(e){return`${Qf(e)?"end":""} ${e.type==="numeric"||e.type==="money"?"num":""}`},Cs.properties={columns:{type:Array},rows:{type:Array},totals:{type:Object},caption:{},captionHidden:{type:Boolean,attribute:"caption-hidden",reflect:!0},sort:{reflect:!0},direction:{reflect:!0},sortMode:{attribute:"sort-mode",reflect:!0},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0},stickyFirstColumn:{type:Boolean,attribute:"sticky-first-column",reflect:!0},loading:{type:Boolean,reflect:!0},loadingRows:{type:Number,attribute:"loading-rows"},_light:{state:!0},_announce:{state:!0}},Cs.styles=[k,y`
|
|
1750
1750
|
:host { display: block; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
1751
1751
|
.scroll { overflow: auto; max-block-size: var(--cm-data-table-max-height, none); }
|
|
1752
1752
|
.scroll:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
@@ -1784,18 +1784,18 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1784
1784
|
.empty td { padding: var(--cm-space-20); border-block-end: 0; }
|
|
1785
1785
|
.light { display: contents; }
|
|
1786
1786
|
@media (forced-colors: active) { button cm-icon { opacity: 1; } }
|
|
1787
|
-
`];w("cm-data-table",Cs);var Ss=class extends C{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1}render(){return null}toItem(){let e=(this.textContent??"").trim();return{label:e,value:this.value||e,icon:this.icon||void 0,href:this.href||void 0,disabled:this.disabled||void 0,critical:this.critical||void 0}}};Ss.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0}},Ss.styles=y`:host { display: none; }`;w("cm-menu-item",Ss);function Xn(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),i=
|
|
1787
|
+
`];w("cm-data-table",Cs);var Ss=class extends C{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1}render(){return null}toItem(){let e=(this.textContent??"").trim();return{label:e,value:this.value||e,icon:this.icon||void 0,href:this.href||void 0,disabled:this.disabled||void 0,critical:this.critical||void 0}}};Ss.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0}},Ss.styles=y`:host { display: none; }`;w("cm-menu-item",Ss);function Xn(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),i=a=>e.getAttribute(a)||void 0;n.push({label:t,value:i("value")??t,icon:i("icon"),href:i("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0})}else e.localName==="hr"&&n.push({divider:!0});return n}function qc(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var mw=_("actionMenu",{label:"Actions"}),Jn,Ns,Ji,Zn,j,Bc,Qn,Gh,Fc,jc,Vc,eo,to,Ds,Uc,Nu,Ru,As=class extends T{constructor(){super(...arguments);p(this,j);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this._slotted=[];this._active=-1;this._custom=!1;p(this,Jn);p(this,Ns,D("cm-menu"));p(this,Ji,"");p(this,Zn,0);p(this,Qn,e=>{this.open&&!e.composedPath().includes(this)&&s(this,j,jc).call(this,!1)});p(this,eo,e=>{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,to,()=>{this.open?this.hide():this.show()});p(this,Uc,e=>{let t=s(this,j,Fc).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),s(this,j,Ds).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),s(this,j,Ds).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),s(this,j,Ds).call(this,t[0]);break;case"End":e.preventDefault(),s(this,j,Ds).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();f(this,Ji,(a-r(this,Zn)<600?r(this,Ji):"")+e.key.toLowerCase()),f(this,Zn,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,j,Ds).call(this,u)}}})}connectedCallback(){super.connectedCallback(),s(this,j,Bc).call(this),f(this,Jn,qc(this,()=>s(this,j,Bc).call(this))),document.addEventListener("pointerdown",r(this,Qn),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,Jn)?.disconnect(),document.removeEventListener("pointerdown",r(this,Qn),!0)}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=s(this,j,Fc).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,s(this,j,jc).call(this,!0),this.updateComplete.then(()=>s(this,j,Vc).call(this))}hide(e=!1){s(this,j,jc).call(this,!1),e&&s(this,j,Gh).call(this)?.focus()}updated(e){if(this._custom){let t=s(this,j,Gh).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,Ns)}-m`)}}if(e.has("open")&&this.open&&this._active<0){let t=s(this,j,Fc).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>s(this,j,Vc).call(this))}}render(){let e=this.menuItems,t=this.triggerLabel||this.label,i=this._custom?c`<slot name="trigger" @click=${r(this,to)} @keydown=${r(this,eo)} @slotchange=${()=>s(this,j,Bc).call(this)}></slot>`:c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
1788
1788
|
aria-expanded=${String(this.open)} aria-controls="${r(this,Ns)}-m" aria-label=${this.iconOnly?t:h}
|
|
1789
1789
|
@click=${r(this,to)} @keydown=${r(this,eo)}>${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}
|
|
1790
1790
|
<div class="pop" part="menu" ?hidden=${!this.open}>
|
|
1791
1791
|
${this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h}
|
|
1792
1792
|
<div role="menu" id="${r(this,Ns)}-m" aria-label=${this.heading||this.label} @keydown=${r(this,Uc)}>
|
|
1793
|
-
${e.map((
|
|
1793
|
+
${e.map((a,l)=>s(this,j,Ru).call(this,a,l))}
|
|
1794
1794
|
</div>
|
|
1795
1795
|
</div>
|
|
1796
|
-
<slot hidden></slot>`}};Jn=new WeakMap,Ns=new WeakMap,
|
|
1797
|
-
@pointerenter=${l.over} @click=${l.click}>${
|
|
1798
|
-
aria-disabled=${e.disabled?"true":h} @pointerenter=${l.over} @click=${l.click}>${
|
|
1796
|
+
<slot hidden></slot>`}};Jn=new WeakMap,Ns=new WeakMap,Ji=new WeakMap,Zn=new WeakMap,j=new WeakSet,Bc=function(){this._slotted=Xn(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},Qn=new WeakMap,Gh=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},Fc=function(){return this.menuItems.map((e,t)=>!e.divider&&!e.disabled?t:-1).filter(e=>e>=0)},jc=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})))},Vc=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},eo=new WeakMap,to=new WeakMap,Ds=function(e){this._active=e,this.updateComplete.then(()=>s(this,j,Vc).call(this))},Uc=new WeakMap,Nu=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)},Ru=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>${e.label}</span>`,l={over:()=>{e.disabled||(this._active=t)},click:d=>s(this,j,Nu).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}
|
|
1797
|
+
@pointerenter=${l.over} @click=${l.click}>${a}</a>`:c`<button type="button" class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
1798
|
+
aria-disabled=${e.disabled?"true":h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},As.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:{},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},As.styles=[k,y`
|
|
1799
1799
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
1800
1800
|
.trigger {
|
|
1801
1801
|
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;
|
|
@@ -1843,7 +1843,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1843
1843
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
1844
1844
|
`,Wc,Yc,Iu,Hs=class extends T{constructor(){super();p(this,Yc);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;this.columns=!1;p(this,Wc,this.attachInternals());r(this,Wc).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`
|
|
1845
1845
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
1846
|
-
<div class="row" part="row" @click=${
|
|
1846
|
+
<div class="row" part="row" @click=${s(this,Yc,Iu)}>
|
|
1847
1847
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
1848
1848
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
1849
1849
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
@@ -1885,15 +1885,15 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1885
1885
|
::slotted([slot='media']) { width: 32px; height: 32px; }
|
|
1886
1886
|
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 32px; }
|
|
1887
1887
|
}
|
|
1888
|
-
`];w("cm-resource-item",Hs);var io,ro,ue,Pu,Xh,Gc,Xc,Rs,Kc,Jc,Is=class extends T{constructor(){super();p(this,ue);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,io,D("cm-rl"));p(this,ro,new Set);p(this,Gc,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,
|
|
1888
|
+
`];w("cm-resource-item",Hs);var io,ro,ue,Pu,Xh,Gc,Xc,Rs,Kc,Jc,Is=class extends T{constructor(){super();p(this,ue);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,io,D("cm-rl"));p(this,ro,new Set);p(this,Gc,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,s(this,ue,Xh).call(this,t)});p(this,Xc,e=>{this._hasActions=e.target.assignedElements().length>0});p(this,Jc,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,ue,Rs).call(this),s(this,ue,Kc).call(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,ue,Rs).call(this),s(this,ue,Kc).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,s(this,ue,Rs).call(this),s(this,ue,Kc).call(this)}clearSelection(){this.selectPage(!1)}updated(e){e.has("selectable")&&(s(this,ue,Rs).call(this),s(this,ue,Xh).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,ue,Pu).call(this),d=M=>yl(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,$=!this.hideSelectMenu&&(!b||v),x=c`<slot name="actions" @slotchange=${r(this,Xc)}></slot>`;return c`
|
|
1889
1889
|
${this.selectable&&b?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${x}</div>`:h}
|
|
1890
1890
|
<div class="head ${this.selectable||this._hasHeader?"on":""} ${b?"over":""}">
|
|
1891
1891
|
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,Gc)}></slot></div>
|
|
1892
1892
|
${this.selectable?c`<div class="toolbar ${b?"over":""} ${v?"busy":""}" part="toolbar">
|
|
1893
1893
|
<span class="select" part="select">
|
|
1894
|
-
<span class="check"><input id="${r(this,io)}-all" type="checkbox" .checked=${
|
|
1894
|
+
<span class="check"><input id="${r(this,io)}-all" type="checkbox" .checked=${a} .indeterminate=${e>0&&!a}
|
|
1895
1895
|
?disabled=${!i} @change=${M=>this.selectPage(M.target.checked)} />
|
|
1896
|
-
<span class="box" aria-hidden="true">${e>0&&!
|
|
1896
|
+
<span class="box" aria-hidden="true">${e>0&&!a?c`<span class="dash"></span>`:a?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>
|
|
1897
1897
|
${this.hideSelectMenu?h:c`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")} ?hidden=${!$}
|
|
1898
1898
|
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...m?[{label:this.t("selectAll",{count:this.total,resource:l}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${r(this,Jc)}></cm-action-menu>`}
|
|
1899
1899
|
<label for="${r(this,io)}-all" class=${b||v?"sr":"label"}>${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:d(t)})}</span></label>
|
|
@@ -1905,12 +1905,12 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1905
1905
|
</div>
|
|
1906
1906
|
<div class="body">
|
|
1907
1907
|
<div class="list" part="list" role="list" aria-label=${this.label||l.replace(/^./,M=>M.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
1908
|
-
<slot @slotchange=${()=>
|
|
1908
|
+
<slot @slotchange=${()=>s(this,ue,Rs).call(this)}></slot>
|
|
1909
1909
|
</div>
|
|
1910
1910
|
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
1911
1911
|
</div>
|
|
1912
1912
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
1913
|
-
`}};io=new WeakMap,ro=new WeakMap,ue=new WeakSet,Pu=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},Xh=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(
|
|
1913
|
+
`}};io=new WeakMap,ro=new WeakMap,ue=new WeakSet,Pu=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},Xh=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,ro))t.has(i)||i.removeAttribute("resource-rows");for(let i of t)i.setAttribute("resource-rows",this.selectable?"selectable":"plain");f(this,ro,t),this._hasTable=t.size>0},Gc=new WeakMap,Xc=new WeakMap,Rs=function(){let e=this.items;e.forEach(t=>t.selectable=this.selectable),this._rows=e.length,this._count=e.filter(t=>t.selected).length},Kc=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},Jc=new WeakMap,Is.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:{},_count:{state:!0},_rows:{state:!0},_hasHeader:{state:!0},_hasTable:{state:!0},_hasActions:{state:!0}},Is.styles=[k,Hu,y`
|
|
1914
1914
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
|
|
1915
1915
|
/* The header row. Rows sit --_pad in from the list's edges and pad space-8 inside (0 on phones), so their 16px
|
|
1916
1916
|
checkbox starts space-20 from the edge (space-12 on phones, 20px box). The header row runs edge to edge and puts
|
|
@@ -1963,11 +1963,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1963
1963
|
.toolbar .check { width: 20px; height: 20px; }
|
|
1964
1964
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
1965
1965
|
}
|
|
1966
|
-
`];w("cm-resource-list",Is);var _w=_("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}."}),zw=_("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),Qc,Z,Jh,Zh,Ou,qu,bi,Bu,Fu,ju,Qh,Vu,lt=class lt extends T{constructor(){super();p(this,Z);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;p(this,Qc,this.attachInternals());p(this,bi,!1);r(this,Qc).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
|
|
1967
|
-
<div class="row" part="row" @dragover=${
|
|
1966
|
+
`];w("cm-resource-list",Is);var _w=_("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}."}),zw=_("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),Qc,Z,Jh,Zh,Ou,qu,bi,Bu,Fu,ju,Qh,Vu,lt=class lt extends T{constructor(){super();p(this,Z);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;p(this,Qc,this.attachInternals());p(this,bi,!1);r(this,Qc).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`
|
|
1967
|
+
<div class="row" part="row" @dragover=${s(this,Z,ju)} @dragleave=${s(this,Z,Qh)} @drop=${s(this,Z,Vu)}>
|
|
1968
1968
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
1969
1969
|
aria-describedby="hint"
|
|
1970
|
-
@keydown=${
|
|
1970
|
+
@keydown=${s(this,Z,Ou)} @dragstart=${s(this,Z,qu)} @pointerdown=${s(this,Z,Bu)}
|
|
1971
1971
|
@dragend=${()=>{this.classList.remove("dragging"),lt.dragged=null,so(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
1972
1972
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
1973
1973
|
<span class="label" part="label">${this.label}</span>
|
|
@@ -1976,7 +1976,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1976
1976
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
1977
1977
|
<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>
|
|
1978
1978
|
</div>
|
|
1979
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};Qc=new WeakMap,Z=new WeakSet,Jh=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)):[]},Zh=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},Ou=function(e){let t=this.siblings.indexOf(this),i=e.key==="ArrowUp",
|
|
1979
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};Qc=new WeakMap,Z=new WeakSet,Jh=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)):[]},Zh=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},Ou=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,Z,Jh),m=d[d.indexOf(this.list)+(i?-1:1)];if(m){e.preventDefault(),this.moveToList(m,i?m.items.length:0)&&s(this,Z,Zh).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,Z,Zh).call(this)},qu=function(e){if(e.stopPropagation(),r(this,bi)){e.preventDefault();return}lt.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},bi=new WeakMap,Bu=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,bi)){if(Math.abs(d.clientY-t)<6)return;f(this,bi,!0),lt.dragged=this,this.classList.add("dragging")}d.preventDefault(),i=s(this,Z,Fu).call(this,d.clientX,d.clientY),so(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,bi);f(this,bi,!1),lt.dragged=null,this.classList.remove("dragging"),so(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)},Fu=function(e,t){for(let i of r(this,Z,Jh)){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:Zc(i.items,this,t)}}return{index:Zc(this.siblings,this,t)}},ju=function(e){let t=lt.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)},Qh=function(){this.classList.remove("drop-before","drop-after")},Vu=function(e){let t=lt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.classList.contains("drop-after");s(this,Z,Qh).call(this);let a=this.siblings,l=a.indexOf(t),d=a.indexOf(this)+(i?1:0);d>l&&(d-=1),t.moveTo(d)},lt.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},lt.styles=[k,y`
|
|
1980
1980
|
:host { display: block; }
|
|
1981
1981
|
.row {
|
|
1982
1982
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2003,20 +2003,20 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2003
2003
|
.actions { gap: var(--cm-space-8); }
|
|
2004
2004
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2005
2005
|
}
|
|
2006
|
-
`],lt.dragged=null;var Os=lt;w("cm-nested-item",Os);function Zc(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 so(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
|
|
2006
|
+
`],lt.dragged=null;var Os=lt;w("cm-nested-item",Os);function Zc(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 so(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 Zi,De,Uu,em,tm,Ku,Wu,Ps=class extends T{constructor(){super(...arguments);p(this,De);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;p(this,Zi,D("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,De,em).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2007
2007
|
<div class="bar" part="bar">
|
|
2008
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,
|
|
2008
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,Zi)}-h">${this.heading}</div>
|
|
2009
2009
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2010
|
-
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
2011
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${
|
|
2010
|
+
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,Zi)}-rows"
|
|
2011
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,De,Uu)}>
|
|
2012
2012
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2013
2013
|
</div>
|
|
2014
|
-
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,
|
|
2015
|
-
@dragover=${
|
|
2016
|
-
<slot @slotchange=${()=>{
|
|
2014
|
+
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,Zi)}-rows" role="list" aria-labelledby="${r(this,Zi)}-h" ?hidden=${!t}
|
|
2015
|
+
@dragover=${s(this,De,Ku)} @drop=${s(this,De,Wu)}>
|
|
2016
|
+
<slot @slotchange=${()=>{s(this,De,em).call(this),this._empty=!this.items.length}}></slot>
|
|
2017
2017
|
</div>
|
|
2018
2018
|
<span class="sr" role="status">${this._msg}</span>
|
|
2019
|
-
`}};
|
|
2019
|
+
`}};Zi=new WeakMap,De=new WeakSet,Uu=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},em=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},tm=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},Ku=function(e){let t=Os.dragged;s(this,De,tm).call(this,t)&&(e.preventDefault(),so(t,{list:this,index:Zc(this.items,t,e.clientY)}))},Wu=function(e){let t=Os.dragged;if(!s(this,De,tm).call(this,t))return;e.preventDefault();let i=Zc(this.items,t,e.clientY);so(t,null),t.moveToList(this,i)},Ps.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}},Ps.styles=[k,y`
|
|
2020
2020
|
:host { display: block; }
|
|
2021
2021
|
.bar {
|
|
2022
2022
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2040,7 +2040,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2040
2040
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2041
2041
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2042
2042
|
}
|
|
2043
|
-
`];w("cm-nested-list",Ps);var Yu=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},Gu=br(class extends Ut{constructor(o){if(super(o),o.type!==st.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=[],
|
|
2043
|
+
`];w("cm-nested-list",Ps);var Yu=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},Gu=br(class extends Ut{constructor(o){if(super(o),o.type!==st.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=kp(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,$=i.length-1,x=0,M=a.length-1;for(;b<=$&&x<=M;)if(i[b]===null)b++;else if(i[$]===null)$--;else if(d[b]===l[x])m[x]=Kt(i[b],a[x]),b++,x++;else if(d[$]===l[M])m[M]=Kt(i[$],a[M]),$--,M--;else if(d[b]===l[M])m[M]=Kt(i[b],a[M]),vr(o,m[M+1],i[b]),b++,M--;else if(d[$]===l[x])m[x]=Kt(i[$],a[x]),vr(o,i[b],i[$]),$--,x++;else if(u===void 0&&(u=Yu(l,x,M),v=Yu(d,b,$)),u.has(d[b]))if(u.has(d[$])){let A=v.get(l[x]),I=A!==void 0?i[A]:null;if(I===null){let B=vr(o,i[b]);Kt(B,a[x]),m[x]=B}else m[x]=Kt(I,a[x]),vr(o,i[b],I),i[A]=null;x++}else Ml(i[$]),$--;else Ml(i[b]),b++;for(;x<=M;){let A=vr(o,m[M+1]);Kt(A,a[x]),m[x++]=A}for(;b<=$;){let A=i[b++];A!==null&&Ml(A)}return this.ut=l,El(o,m),fe}});function Xu(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 re,qe,Be,er=class{constructor(n){p(this,re);p(this,qe,null);p(this,Be,null);f(this,re,n)}get active(){return r(this,qe)!==null}get from(){return r(this,qe)&&{...r(this,qe)}}get target(){return r(this,Be)&&{...r(this,Be)}}groupCount(){return r(this,re).groupCount()}slotCount(n){return n>=0&&n<r(this,re).groupCount()?r(this,re).slotCount(n):0}pickUp(n){this.active&&this.cancel(),f(this,qe,{...n}),f(this,Be,{...n}),r(this,re).onTarget?.(this.target),r(this,re).announce(r(this,re).messages.pickedUp(this.target))}moveTo(n){if(!r(this,Be))return;let e=Math.max(0,Math.min(n.group,r(this,re).groupCount()-1)),t=this.slotCount(e);t<=0||(f(this,Be,{group:e,index:Math.max(0,Math.min(n.index,t-1))}),r(this,re).onTarget?.(this.target),r(this,re).announce(r(this,re).messages.over(this.target)))}drop(){if(!r(this,qe)||!r(this,Be))return;let n=r(this,qe),e=r(this,Be);f(this,qe,f(this,Be,null)),r(this,re).onTarget?.(null),r(this,re).onDrop(n,e)}cancel(n=!1){if(!r(this,qe))return;let e=r(this,qe),t=n?"":r(this,re).messages.cancelled(e);f(this,qe,f(this,Be,null)),r(this,re).onTarget?.(null),r(this,re).onCancel?.(e),t&&r(this,re).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,re).navigate??Xu)(e,r(this,Be),this);return t?(this.moveTo(t),!0):!1}};re=new WeakMap,qe=new WeakMap,Be=new WeakMap;var ao,Qi,tr=class{constructor(n=document,e="assertive"){p(this,ao);p(this,Qi);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,Qi)??this.element.textContent??""}announce(n){clearTimeout(r(this,ao)),this.element.textContent===n?(this.element.textContent="",f(this,Qi,n),f(this,ao,setTimeout(()=>{this.element.textContent=n,f(this,Qi,void 0)},50))):(f(this,Qi,void 0),this.element.textContent=n)}};ao=new WeakMap,Qi=new WeakMap;var Uw=_("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"}),Kw=_("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),Ww=_("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}."});var tb="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",no,rd,Ju,ir=class extends T{constructor(){super(...arguments);p(this,rd);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";p(this,no,D("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">
|
|
2044
2044
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2045
2045
|
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,no)}-help"></div>`}
|
|
2046
2046
|
<div class="content">
|
|
@@ -2050,11 +2050,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2050
2050
|
<slot name="actions"></slot>
|
|
2051
2051
|
</div>
|
|
2052
2052
|
<div class="lines"><slot></slot></div>
|
|
2053
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>
|
|
2053
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,rd,Ju).call(this,i,"_badges")}></slot></div>
|
|
2054
2054
|
</div>
|
|
2055
2055
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2056
2056
|
<span id="${r(this,no)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2057
|
-
</div>`}};no=new WeakMap,rd=new WeakSet,Ju=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},
|
|
2057
|
+
</div>`}};no=new WeakMap,rd=new WeakSet,Ju=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},ir.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},ir.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}},ir.styles=[k,y`
|
|
2058
2058
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2059
2059
|
.card {
|
|
2060
2060
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2079,7 +2079,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2079
2079
|
:host([moving]) .content { opacity: 0.5; }
|
|
2080
2080
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2081
2081
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2082
|
-
`];w("cm-board-card",
|
|
2082
|
+
`];w("cm-board-card",ir);var Fs,oo,js,Vs,yi,ed,Zu,rr=class extends T{constructor(){super(...arguments);p(this,yi);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;p(this,Fs,!1);this._cards=[];this._drop=null;p(this,oo,new MutationObserver(()=>s(this,yi,ed).call(this)));p(this,js,D("cm-col"));p(this,Vs,!1)}get collapsed(){return r(this,Fs)}connectedCallback(){super.connectedCallback(),s(this,yi,ed).call(this),r(this,oo).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,oo).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,yi,ed).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");f(this,Fs,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",r(this,Fs)),f(this,Vs,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,Vs)&&!this.renderRoot.querySelector(".more cm-button")&&(f(this,Vs,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,i=this.count,a=t?e.filter(x=>x!==t.card):e,l=t?e.indexOf(t.card):-1,d=!!t&&!this.collapsed&&!(l>=0&&t.index===l),m=[];e.forEach((x,M)=>{d&&x!==t.card&&a.indexOf(x)===t.index&&m.push({key:"drop"}),m.push({key:x,card:x,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)),$=this.t("count",{count:i});return c`<section aria-labelledby="${r(this,js)}-h" class=${t&&this.collapsed?"over":""}>
|
|
2083
2083
|
<header part="header">
|
|
2084
2084
|
<div class="title" id="${r(this,js)}-h" role="heading" aria-level=${b}>${this.heading}<span class="sr">, ${$}</span></div>
|
|
2085
2085
|
<span class="count" part="count" aria-hidden="true">${this.formatNumber(i)}</span>
|
|
@@ -2091,10 +2091,10 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2091
2091
|
</ul>
|
|
2092
2092
|
${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}
|
|
2093
2093
|
<div class="empty" ?hidden=${e.length>0||v||u||this.collapsed||d}><slot class="empty">${this.t("empty")}</slot></div>
|
|
2094
|
-
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${
|
|
2094
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,yi,Zu)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
2095
2095
|
</div>
|
|
2096
2096
|
<span class="sr" role="status">${v?this.t("loading",{column:this.heading}):""}</span>
|
|
2097
|
-
</section>`}};Fs=new WeakMap,oo=new WeakMap,js=new WeakMap,Vs=new WeakMap,yi=new WeakSet,ed=function(){this._cards=this.cards},Zu=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},
|
|
2097
|
+
</section>`}};Fs=new WeakMap,oo=new WeakMap,js=new WeakMap,Vs=new WeakMap,yi=new WeakSet,ed=function(){this._cards=this.cards},Zu=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},rr.shadowRootOptions={...C.shadowRootOptions,slotAssignment:"manual"},rr.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}},rr.styles=[k,y`
|
|
2098
2098
|
:host {
|
|
2099
2099
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
2100
2100
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -2131,9 +2131,9 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2131
2131
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
2132
2132
|
:host([collapsed]) .actions { display: none; }
|
|
2133
2133
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
2134
|
-
`];w("cm-board-column",
|
|
2134
|
+
`];w("cm-board-column",rr);var Ee,ve,ne,sr,J,S,im,qs,Qu,rm,eg,tg,ig,rg,lo,sg,co,sm,am,nm,td,ag,ho,mo,po,uo,go,fo,bo,om,lm,id,ng,vi,Bs=class extends T{constructor(){super();p(this,S);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;p(this,Ee,new tr);p(this,ve);p(this,ne,null);p(this,sr,new WeakMap);p(this,J,null);p(this,lo,e=>{if(r(this,J)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,ve).active){r(this,ve).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let i=s(this,S,rg).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,S,sg).call(this,i,t);a&&(e.preventDefault(),a.focusHandle())}}});p(this,co,e=>{if(!r(this,ve).active||!r(this,ne))return;let t=e.relatedTarget;t&&(t===r(this,ne).card||r(this,ne).card.contains(t))||!t&&document.hasFocus()===!1||queueMicrotask(()=>{r(this,ve).active&&r(this,ne)&&!r(this,ne).card.matches(":focus-within")&&r(this,ve).cancel()})});p(this,ho,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});p(this,mo,e=>{if(r(this,J)||!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?.(tb)))return;let a=s(this,S,qs).call(this,i);if(!a)return;r(this,ve).active&&r(this,ve).cancel();let l=i.getBoundingClientRect();f(this,J,{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,J).timer=setTimeout(()=>{r(this,J)&&!r(this,J).started&&s(this,S,om).call(this)},300)),window.addEventListener("pointermove",r(this,go),!0),window.addEventListener("pointerup",r(this,fo),!0),window.addEventListener("pointercancel",r(this,bo),!0),window.addEventListener("touchmove",r(this,po),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,uo),!0)});p(this,po,e=>{r(this,J)?.started&&e.cancelable&&e.preventDefault()});p(this,uo,e=>{r(this,J)&&e.preventDefault()});p(this,go,e=>{let t=r(this,J);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,S,om).call(this):s(this,S,vi).call(this,!1));return}e.preventDefault(),s(this,S,lm).call(this),s(this,S,id).call(this)}});p(this,fo,e=>{let t=r(this,J);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,S,vi).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,S,vi).call(this,!0)});p(this,bo,e=>{r(this,J)&&e.pointerId===r(this,J).pointerId&&s(this,S,vi).call(this,!1)});f(this,ve,new er({groupCount:()=>this.columns.length,slotCount:e=>{let t=this.columns[e];return!t||!r(this,ne)?0:t.cards.filter(i=>i!==r(this,ne).card).length+1},onTarget:e=>s(this,S,eg).call(this,e),onDrop:(e,t)=>s(this,S,ig).call(this,e,t),onCancel:()=>s(this,S,rm).call(this),messages:{pickedUp:e=>s(this,S,im).call(this,"pickedUp",e),over:e=>s(this,S,im).call(this,"over",e),cancelled:e=>this.t("cancelled",{card:r(this,ne)?.card.name??"",column:this.columns[e.group]?.heading??""})},announce:e=>r(this,Ee).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,ne)?.card??null}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,lo)),this.addEventListener("focusout",r(this,co)),this.addEventListener("pointerdown",r(this,mo)),this.addEventListener("dragstart",r(this,ho))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,lo)),this.removeEventListener("focusout",r(this,co)),this.removeEventListener("pointerdown",r(this,mo)),this.removeEventListener("dragstart",r(this,ho)),r(this,ve).cancel(!0),s(this,S,vi).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(r(this,Ee).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return r(this,Ee).text}announce(e){r(this,Ee).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,S,qs).call(this,t);return i?(s(this,S,vi).call(this,!1),r(this,ve).cancel(!0),f(this,ne,{card:t,column:i.column,index:i.index}),t.moving=!0,s(this,S,Qu).call(this,t),r(this,ve).pickUp({group:i.group,index:i.index}),!0):!1}cancelMove(){let e=r(this,J);e?.started&&(s(this,S,vi).call(this,!1),r(this,Ee).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),r(this,ve).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,S,qs).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,S,td).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,sr).get(t);if(this.controlled||!i||(r(this,sr).delete(t),!i.from.isConnected||!this.contains(i.from)))return!1;let a=t.matches(":focus-within");return s(this,S,am).call(this,t,i.from,i.fromIndex),i.totals&&s(this,S,nm).call(this,i.to,i.from),s(this,S,sm).call(this,i.to,i.from,a?t:null),r(this,Ee).announce(this.t("reverted",{card:t.name,column:i.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
2135
2135
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
2136
|
-
</div>`}};Ee=new WeakMap,ve=new WeakMap,ne=new WeakMap,
|
|
2136
|
+
</div>`}};Ee=new WeakMap,ve=new WeakMap,ne=new WeakMap,sr=new WeakMap,J=new WeakMap,S=new WeakSet,im=function(e,t){let i=this.columns[t.group];return this.t(e,{card:r(this,ne)?.card.name??"",column:i?.heading??"",position:t.index+1,count:r(this,ve).slotCount(t.group)})},qs=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)}},Qu=function(e){let t=()=>!!e.shadowRoot?.activeElement?.classList.contains("handle");e.focusHandle({preventScroll:!0}),requestAnimationFrame(()=>{r(this,ne)?.card===e&&!t()&&e.focusHandle({preventScroll:!0})})},rm=function(){r(this,ne)&&(r(this,ne).card.moving=!1),f(this,ne,null)},eg=function(e){let t=r(this,ne);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,S,tg).call(this,i,a)})}},tg=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)}},ig=function(e,t){let i=r(this,ne);if(s(this,S,rm).call(this),!i)return;let a=this.columns[t.group];s(this,S,td).call(this,i.card,i.column,e.index,a,t.index,"keyboard")},rg=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,S,qs).call(this,i)?i:null},lo=new WeakMap,sg=function(e,t){let i=s(this,S,qs).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},co=new WeakMap,sm=function(e,t,i){e._sync(),t._sync().then(()=>{i?.isConnected&&i.focusHandle({preventScroll:!0})})},am=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)},nm=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))},td=function(e,t,i,a,l,d){let m=e.name;if(t===a&&i===l)return d!=="api"&&r(this,Ee).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:x=>{u.push(Promise.resolve(x))}};if(!this.dispatchEvent(new CustomEvent("cm-move",{detail:v,bubbles:!0,composed:!0,cancelable:!0})))return r(this,Ee).announce(this.t("refused",{card:m,column:a.heading})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let $=a.cards.filter(x=>x!==e).length+1;if(this.controlled)d==="keyboard"&&s(this,S,ag).call(this,e.key,a);else{let x=d==="keyboard"||e.matches(":focus-within");s(this,S,am).call(this,e,a,l);let M=t!==a;M&&s(this,S,nm).call(this,t,a),r(this,sr).set(e,{card:e,from:t,fromIndex:i,to:a,toIndex:l,totals:M}),s(this,S,sm).call(this,t,a,x?e:null)}return r(this,Ee).announce(this.t("moved",{card:m,column:a.heading,position:l+1,count:$})),u.length&&(e.pending=!0,Promise.all(u).then(()=>{e.pending=!1,this.controlled||r(this,sr).delete(e)},()=>{e.pending=!1,this.controlled?r(this,Ee).announce(this.t("reverted",{card:m,column:t.heading})):this.revert(e)})),!0},ag=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)},ho=new WeakMap,mo=new WeakMap,po=new WeakMap,uo=new WeakMap,go=new WeakMap,fo=new WeakMap,bo=new WeakMap,om=function(){let e=r(this,J);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,Ee).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),s(this,S,lm).call(this),s(this,S,id).call(this);let i=()=>{r(this,J)?.started&&(s(this,S,ng).call(this),r(this,J).raf=requestAnimationFrame(i))};e.raf=requestAnimationFrame(i)},lm=function(){let e=r(this,J);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},id=function(){let e=r(this,J);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,Ee).announce(this.t("over",{column:i.heading,position:d+1,count:l.length+1}))},ng=function(){let e=r(this,J);if(!e)return;let t=48,i=16,a=$=>$<t?Math.ceil((t-Math.max($,0))/t*i):0,l=!1,d=this.renderRoot.querySelector(".columns");if(d){let $=d.getBoundingClientRect(),x=a(e.x-$.left),M=a($.right-e.x),A=d.scrollLeft;x?d.scrollLeft-=x:M&&(d.scrollLeft+=M),l||=d.scrollLeft!==A}let m=e.to?.scrollElement;if(m&&m.scrollHeight>m.clientHeight){let $=m.getBoundingClientRect();if(e.x>=$.left&&e.x<=$.right){let x=a(e.y-$.top),M=a($.bottom-e.y),A=m.scrollTop;x?m.scrollTop-=x:M&&(m.scrollTop+=M),l||=m.scrollTop!==A}}let u=window.innerHeight,v=a(e.y),b=a(u-e.y);if(v||b){let $=window.scrollY;window.scrollBy(0,v?-v:b),l||=window.scrollY!==$}l&&s(this,S,id).call(this)},vi=function(e){let t=r(this,J);t&&(f(this,J,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,go),!0),window.removeEventListener("pointerup",r(this,fo),!0),window.removeEventListener("pointercancel",r(this,bo),!0),window.removeEventListener("touchmove",r(this,po),!0),window.removeEventListener("contextmenu",r(this,uo),!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,S,td).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},Bs.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},Bs.styles=[k,y`
|
|
2137
2137
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
2138
2138
|
.board { height: 100%; }
|
|
2139
2139
|
.columns {
|
|
@@ -2147,86 +2147,86 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2147
2147
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
2148
2148
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
2149
2149
|
}
|
|
2150
|
-
`];w("cm-board",Bs);var t$=_("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}."}),Ws=class extends C{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}};Ws.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}},Ws.styles=y`:host { display: none !important; }`;w("cm-calendar-event",Ws);var dd=o=>String(o).padStart(2,"0"),og=o=>`${H(o)}T${dd(o.getHours())}:${dd(o.getMinutes())}`,sd=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),lg=["month","week","day"],ib=600,cg=new Map,dg=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=cg.get(e);return t||(t=new Intl.DateTimeFormat(o,n),cg.set(e,t)),t},cm=o=>o.replace(/[ ]/g," ").trim(),Gs,Me,Te,ge,G,X,ar,xt,je,To,nr,Xs,Js,Zs,Qs,_o,g,ye,xi,vo,ad,yt,dm,yo,ct,hm,hg,dt,Us,mg,pg,Fe,xo,wo,nd,ug,gg,fg,sr,mm,$o,bg,ko,vg,yg,xg,wg,zo,Co,$g,kg,Lo,Eo,Eg,pm,um,gm,Mg,Tg,fm,bm,vm,So,ym,_g,Do,Ao,No,Ro,Ho,Io,xm,od,zg,wi,Mo,Cg,wm,Lg,ld,$m,Ks,cd,Sg,Dg,Ag,Ng,Rg,Ys=class extends T{constructor(){super();p(this,g);this.view="month";this.date="";this.today="";this.step=15;p(this,Gs,"");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,Me,D("cm-cal"));p(this,Te,new er);p(this,ge);p(this,G,null);p(this,X,null);p(this,ar,new WeakMap);p(this,xt,"");p(this,je,null);p(this,To,"");p(this,nr,!0);p(this,Xs,0);p(this,Js,!1);p(this,Zs);p(this,Qs,0);p(this,_o,new MutationObserver(()=>this.requestUpdate()));p(this,zo,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){f(this,xt,t.dataset.k);for(let i of a(this,g,ko).call(this))i.tabIndex=i===t?0:-1}});p(this,Co,e=>{let t=e.relatedTarget;if(this._more&&!r(this,G)){let i=this.renderRoot.querySelector(".pop"),s=e.composedPath()[0];i&&i.contains(s)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,ge).active||!r(this,G)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,ge).active||!r(this,G))return;this.renderRoot.activeElement?.dataset.ev!==r(this,G).ev.key&&r(this,ge).cancel()}))});p(this,Lo,e=>{if(r(this,X)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,ge).active){r(this,ge).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 s=i.closest(".pop");if(s&&e.key==="Escape"){e.preventDefault(),a(this,g,ld).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),f(this,Xs,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(s&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...s.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(),a(this,g,kg).call(this,i,e.key==="PageUp"?-1:1);return}let l=a(this,g,$g).call(this,i,t);l?(e.preventDefault(),a(this,g,wg).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,So,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,Do,e=>{if(r(this,X)||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),s=i&&a(this,g,Us).call(this,i);if(!s||i.locked||i.pending)return;let l=a(this,g,um).call(this,s,t.dataset.day??s.days[0]);if(!l)return;r(this,ge).active&&r(this,ge).cancel();let d=0;if(l.mode==="time"){let m=a(this,g,ym).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(s.dur,m.min-s.min)))}f(this,X,{...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,X).timer=setTimeout(()=>{r(this,X)&&!r(this,X).started&&a(this,g,xm).call(this)},300)),window.addEventListener("pointermove",r(this,Ro),!0),window.addEventListener("pointerup",r(this,Ho),!0),window.addEventListener("pointercancel",r(this,Io),!0),window.addEventListener("touchmove",r(this,Ao),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,No),!0)});p(this,Ao,e=>{r(this,X)?.started&&e.cancelable&&e.preventDefault()});p(this,No,e=>{r(this,X)&&e.preventDefault()});p(this,Ro,e=>{let t=r(this,X);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"?a(this,g,xm).call(this):a(this,g,wi).call(this,!1));return}e.preventDefault(),a(this,g,od).call(this)}});p(this,Ho,e=>{let t=r(this,X);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,g,wi).call(this,!1);return}let i=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),a(this,g,wi).call(this,!0)});p(this,Io,e=>{r(this,X)&&e.pointerId===r(this,X).pointerId&&a(this,g,wi).call(this,!1)});f(this,ge,new Qi({groupCount:()=>a(this,g,dt).call(this).length,slotCount:()=>r(this,G)?r(this,G).mode==="day"?1:a(this,g,Eo).call(this,r(this,G).ev.dur):0,navigate:(e,t)=>a(this,g,Eg).call(this,e,t),onTarget:e=>a(this,g,Mg).call(this,e),onDrop:(e,t)=>a(this,g,Tg).call(this,e,t),onCancel:()=>a(this,g,gm).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,G)?.ev.name??"",place:a(this,g,sr).call(this,r(this,G),e)}),over:e=>this.t("over",{place:a(this,g,sr).call(this,r(this,G),e)}),cancelled:e=>this.t("cancelled",{event:r(this,G)?.ev.name??"",place:a(this,g,sr).call(this,r(this,G),e)})},announce:e=>r(this,Te).announce(e)}))}get locale(){return r(this,Gs)}set locale(e){let t=r(this,Gs);f(this,Gs,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=a(this,g,dt).call(this);return{view:r(this,g,ye),start:H(e[0]),end:H(e[e.length-1])}}get heldEvent(){return r(this,G)?.ev.el??null}get announcement(){return r(this,Te).text}announce(e){r(this,Te).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,Lo)),this.addEventListener("focusin",r(this,zo)),this.addEventListener("focusout",r(this,Co)),this.addEventListener("pointerdown",r(this,Do)),this.addEventListener("dragstart",r(this,So)),r(this,_o).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(f(this,Zs,new ResizeObserver(()=>{cancelAnimationFrame(r(this,Qs)),f(this,Qs,requestAnimationFrame(()=>a(this,g,mm).call(this)))})),r(this,Zs).observe(this)),a(this,g,mm).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,Lo)),this.removeEventListener("focusin",r(this,zo)),this.removeEventListener("focusout",r(this,Co)),this.removeEventListener("pointerdown",r(this,Do)),this.removeEventListener("dragstart",r(this,So)),r(this,_o).disconnect(),r(this,Zs)?.disconnect(),cancelAnimationFrame(r(this,Qs)),r(this,ge).cancel(!0),a(this,g,wi).call(this,!1)}willUpdate(e){e.has("view")&&(f(this,nr,!0),e.get("view")!==void 0&&(this._more="",r(this,ge).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,Te).element)}updated(){if(a(this,g,xg).call(this),r(this,je)){let s=a(this,g,vg).call(this,r(this,je).key);s?(f(this,je,null),s.focus({preventScroll:!1})):Date.now()>r(this,je).until&&f(this,je,null)}r(this,Js)&&(f(this,Js,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let e=this.renderRoot.querySelector(".tg");if(e&&r(this,nr)){let s=e.querySelector(".tcell"),l=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));s&&(e.scrollTop=s.offsetHeight*l),f(this,nr,!1)}e||f(this,nr,!0),r(this,G)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let t=this.range,i=`${t.view}|${t.start}|${t.end}`;i!==r(this,To)&&(f(this,To,i),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:t,bubbles:!0,composed:!0})))}previous(){this.date=H(a(this,g,$o).call(this,r(this,g,ct),-1))}next(){this.date=H(a(this,g,$o).call(this,r(this,g,ct),1))}goToToday(){this.date=r(this,g,yo)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let s=a(this,g,Us).call(this,i);if(!s)return!1;let l=a(this,g,dt).call(this).map(H),d=t&&s.days.includes(t)&&l.includes(t)?t:s.days.find(v=>l.includes(v));if(!d)return!1;let m=a(this,g,um).call(this,s,d);if(!m)return!1;a(this,g,wi).call(this,!1),r(this,ge).cancel(!0),this._more="",f(this,G,m),i.moving=!0;let u=`ev:${s.key}:${d}`;return f(this,xt,u),f(this,je,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,ge).pickUp(m.from),!0}cancelMove(){let e=r(this,X);e?.started&&(a(this,g,wi).call(this,!1),r(this,Te).announce(this.t("cancelled",{event:e.ev.name,place:a(this,g,sr).call(this,e,e.from)}))),r(this,ge).cancel()}moveEvent(e,t,i){let s=typeof e=="string"?this.event(e):e,l=s&&a(this,g,Us).call(this,s);if(!l)return!1;let d=l.allDay?N(Ge(t).date||t):pt(t);if(!d)return!1;let m=i?l.allDay?N(Ge(i).date||i):pt(i):null;return(!m||m<d)&&(m=l.allDay?U(d,sd(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),a(this,g,vm).call(this,l,d,m,"api",!1,H(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,ar).get(t);if(this.controlled||!i)return!1;r(this,ar).delete(t);let s=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=a(this,g,Us).call(this,t);return l&&s&&f(this,je,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Te).announce(this.t("reverted",{event:t.name,place:l?a(this,g,nd).call(this,l):i.start})),!0}render(){let e=a(this,g,dt).call(this),t=a(this,g,pg).call(this,a(this,g,mg).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2151
|
-
${
|
|
2152
|
-
${r(this,g,ye)==="month"?
|
|
2150
|
+
`];w("cm-board",Bs);var t$=_("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}."}),Ws=class extends C{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}};Ws.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}},Ws.styles=y`:host { display: none !important; }`;w("cm-calendar-event",Ws);var dd=o=>String(o).padStart(2,"0"),og=o=>`${H(o)}T${dd(o.getHours())}:${dd(o.getMinutes())}`,sd=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),lg=["month","week","day"],ib=600,cg=new Map,dg=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=cg.get(e);return t||(t=new Intl.DateTimeFormat(o,n),cg.set(e,t)),t},cm=o=>o.replace(/[ ]/g," ").trim(),Gs,Me,Te,ge,G,X,nr,xt,je,To,$i,Xs,Js,Zs,Qs,_o,g,ye,xi,vo,ad,yt,dm,yo,ct,hm,hg,dt,Us,mg,pg,Fe,xo,wo,nd,ug,gg,fg,ar,mm,$o,bg,ko,vg,yg,xg,wg,zo,Co,$g,kg,Lo,Eo,Eg,pm,um,gm,Mg,Tg,fm,bm,vm,So,ym,_g,Do,Ao,No,Ro,Ho,Io,xm,od,zg,wi,Mo,Cg,wm,Lg,ld,$m,Ks,cd,Sg,Dg,Ag,Ng,Rg,Ys=class extends T{constructor(){super();p(this,g);this.view="month";this.date="";this.today="";this.step=15;p(this,Gs,"");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,Me,D("cm-cal"));p(this,Te,new tr);p(this,ge);p(this,G,null);p(this,X,null);p(this,nr,new WeakMap);p(this,xt,"");p(this,je,null);p(this,To,"");p(this,$i,!0);p(this,Xs,0);p(this,Js,!1);p(this,Zs);p(this,Qs,0);p(this,_o,new MutationObserver(()=>this.requestUpdate()));p(this,zo,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){f(this,xt,t.dataset.k);for(let i of s(this,g,ko).call(this))i.tabIndex=i===t?0:-1}});p(this,Co,e=>{let t=e.relatedTarget;if(this._more&&!r(this,G)){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,ge).active||!r(this,G)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,ge).active||!r(this,G))return;this.renderRoot.activeElement?.dataset.ev!==r(this,G).ev.key&&r(this,ge).cancel()}))});p(this,Lo,e=>{if(r(this,X)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,ge).active){r(this,ge).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,g,ld).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),f(this,Xs,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,g,kg).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,g,$g).call(this,i,t);l?(e.preventDefault(),s(this,g,wg).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,So,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,Do,e=>{if(r(this,X)||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,g,Us).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,g,um).call(this,a,t.dataset.day??a.days[0]);if(!l)return;r(this,ge).active&&r(this,ge).cancel();let d=0;if(l.mode==="time"){let m=s(this,g,ym).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}f(this,X,{...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,X).timer=setTimeout(()=>{r(this,X)&&!r(this,X).started&&s(this,g,xm).call(this)},300)),window.addEventListener("pointermove",r(this,Ro),!0),window.addEventListener("pointerup",r(this,Ho),!0),window.addEventListener("pointercancel",r(this,Io),!0),window.addEventListener("touchmove",r(this,Ao),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,No),!0)});p(this,Ao,e=>{r(this,X)?.started&&e.cancelable&&e.preventDefault()});p(this,No,e=>{r(this,X)&&e.preventDefault()});p(this,Ro,e=>{let t=r(this,X);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,g,xm).call(this):s(this,g,wi).call(this,!1));return}e.preventDefault(),s(this,g,od).call(this)}});p(this,Ho,e=>{let t=r(this,X);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,g,wi).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,g,wi).call(this,!0)});p(this,Io,e=>{r(this,X)&&e.pointerId===r(this,X).pointerId&&s(this,g,wi).call(this,!1)});f(this,ge,new er({groupCount:()=>s(this,g,dt).call(this).length,slotCount:()=>r(this,G)?r(this,G).mode==="day"?1:s(this,g,Eo).call(this,r(this,G).ev.dur):0,navigate:(e,t)=>s(this,g,Eg).call(this,e,t),onTarget:e=>s(this,g,Mg).call(this,e),onDrop:(e,t)=>s(this,g,Tg).call(this,e,t),onCancel:()=>s(this,g,gm).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,G)?.ev.name??"",place:s(this,g,ar).call(this,r(this,G),e)}),over:e=>this.t("over",{place:s(this,g,ar).call(this,r(this,G),e)}),cancelled:e=>this.t("cancelled",{event:r(this,G)?.ev.name??"",place:s(this,g,ar).call(this,r(this,G),e)})},announce:e=>r(this,Te).announce(e)}))}get locale(){return r(this,Gs)}set locale(e){let t=r(this,Gs);f(this,Gs,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,g,dt).call(this);return{view:r(this,g,ye),start:H(e[0]),end:H(e[e.length-1])}}get heldEvent(){return r(this,G)?.ev.el??null}get announcement(){return r(this,Te).text}announce(e){r(this,Te).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,Lo)),this.addEventListener("focusin",r(this,zo)),this.addEventListener("focusout",r(this,Co)),this.addEventListener("pointerdown",r(this,Do)),this.addEventListener("dragstart",r(this,So)),r(this,_o).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(f(this,Zs,new ResizeObserver(()=>{cancelAnimationFrame(r(this,Qs)),f(this,Qs,requestAnimationFrame(()=>s(this,g,mm).call(this)))})),r(this,Zs).observe(this)),s(this,g,mm).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,Lo)),this.removeEventListener("focusin",r(this,zo)),this.removeEventListener("focusout",r(this,Co)),this.removeEventListener("pointerdown",r(this,Do)),this.removeEventListener("dragstart",r(this,So)),r(this,_o).disconnect(),r(this,Zs)?.disconnect(),cancelAnimationFrame(r(this,Qs)),r(this,ge).cancel(!0),s(this,g,wi).call(this,!1)}willUpdate(e){e.has("view")&&(f(this,$i,!0),e.get("view")!==void 0&&(this._more="",r(this,ge).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,Te).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&&f(this,$i,!0),s(this,g,xg).call(this),r(this,je)){let l=s(this,g,vg).call(this,r(this,je).key);l?(f(this,je,null),l.focus({preventScroll:!1})):Date.now()>r(this,je).until&&f(this,je,null)}r(this,Js)&&(f(this,Js,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,$i)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),f(this,$i,!1)}t||f(this,$i,!0),r(this,G)&&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,To)&&(f(this,To,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=H(s(this,g,$o).call(this,r(this,g,ct),-1))}next(){this.date=H(s(this,g,$o).call(this,r(this,g,ct),1))}goToToday(){this.date=r(this,g,yo)}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,g,Us).call(this,i);if(!a)return!1;let l=s(this,g,dt).call(this).map(H),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,g,um).call(this,a,d);if(!m)return!1;s(this,g,wi).call(this,!1),r(this,ge).cancel(!0),this._more="",f(this,G,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return f(this,xt,u),f(this,je,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,ge).pickUp(m.from),!0}cancelMove(){let e=r(this,X);e?.started&&(s(this,g,wi).call(this,!1),r(this,Te).announce(this.t("cancelled",{event:e.ev.name,place:s(this,g,ar).call(this,e,e.from)}))),r(this,ge).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,l=a&&s(this,g,Us).call(this,a);if(!l)return!1;let d=l.allDay?N(Ge(t).date||t):pt(t);if(!d)return!1;let m=i?l.allDay?N(Ge(i).date||i):pt(i):null;return(!m||m<d)&&(m=l.allDay?U(d,sd(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,g,vm).call(this,l,d,m,"api",!1,H(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,nr).get(t);if(this.controlled||!i)return!1;r(this,nr).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,g,Us).call(this,t);return l&&a&&f(this,je,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Te).announce(this.t("reverted",{event:t.name,place:l?s(this,g,nd).call(this,l):i.start})),!0}render(){let e=s(this,g,dt).call(this),t=s(this,g,pg).call(this,s(this,g,mg).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2151
|
+
${s(this,g,Sg).call(this,e)}
|
|
2152
|
+
${r(this,g,ye)==="month"?s(this,g,Ag).call(this,e,t):s(this,g,Rg).call(this,e,t)}
|
|
2153
2153
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
2154
2154
|
<span id="${r(this,Me)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
2155
2155
|
<span id="${r(this,Me)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
2156
2156
|
<span id="${r(this,Me)}-op" hidden>${this.t("openHint")}</span>
|
|
2157
|
-
</div>`}};Gs=new WeakMap,Me=new WeakMap,Te=new WeakMap,ge=new WeakMap,G=new WeakMap,X=new WeakMap,ar=new WeakMap,xt=new WeakMap,je=new WeakMap,To=new WeakMap,nr=new WeakMap,Xs=new WeakMap,Js=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,_o=new WeakMap,g=new WeakSet,ye=function(){return lg.includes(this.view)?this.view:"month"},xi=function(){return Ir(this,this.locale)},vo=function(){return Or(r(this,g,xi))},ad=function(){return Jl(r(this,g,xi),this.hourCycle)},yt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},dm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Pr(r(this,g,xi)):(Math.trunc(e)%7+7)%7},yo=function(){return N(this.today)?this.today:Qd()},ct=function(){return N(this.date)??N(r(this,g,yo))},hm=function(){return r(this,g,ye)==="month"&&this._narrow},hg=function(){return r(this,g,ye)!=="month"},dt=function(){let e=r(this,g,ct),t=r(this,g,dm);if(r(this,g,ye)==="day")return[e];if(r(this,g,ye)==="week"){if(this._narrow)return[e,U(e,1),U(e,2)];let d=U(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>U(d,u))}let i=zt(e),s=U(i,-((i.getDay()-t+7)%7)),l=Math.ceil((sd(s,Rr(e))+1)/7)*7;return Array.from({length:l},(d,m)=>U(s,m))},Us=function(e){let t=e.name,i=!!N(e.start),s=e.allDay||i;if(s){let u=N(Ge(e.start).date||e.start);if(!u)return null;let v=N(Ge(e.end).date||e.end)??u;v<u&&(v=u);let b=Math.min(sd(u,v),366);return{el:e,key:e.key,name:t,allDay:s,start:u,end:v,min:0,dur:1440,days:Array.from({length:b+1},($,x)=>H(U(u,x)))}}let l=pt(e.start);if(!l)return null;let d=pt(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:s,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:m,days:[H(l)]}},mg=function(){return this.events.map(e=>a(this,g,Us).call(this,e)).filter(e=>!!e)},pg=function(e){let t=new Map;for(let i of e)for(let s of i.days)(t.get(s)??t.set(s,[]).get(s)).push(i);for(let i of t.values())i.sort((s,l)=>(s.allDay===l.allDay?0:s.allDay?-1:1)||s.start.getTime()-l.start.getTime()||s.name.localeCompare(l.name));return t},Fe=function(e){return ee(e,{weekday:"long",day:"numeric",month:"long"},r(this,g,xi))},xo=function(e){return r(this,g,ad).format((e%1440+1440)%1440)},wo=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},s=dg(r(this,g,xi),{hour:"numeric",minute:"2-digit",...i});try{if(H(e)===H(t)&&s.formatRangeToParts){let m=s.formatRangeToParts(e,t),u=m.findIndex(b=>b.source==="endRange"),v=-1;if(m.forEach((b,$)=>{b.source==="startRange"&&(v=$)}),v>=0&&u>v){let b=$=>cm($.map(x=>x.value).join(""));return this.t("timeRange",{start:b(m.slice(0,v+1)),end:b(m.slice(u))})}}}catch{}let l=H(e)===H(t),d=m=>l?a(this,g,xo).call(this,m.getHours()*60+m.getMinutes()):r(this,g,ad).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},nd=function(e){return e.allDay?H(e.start)===H(e.end)?this.t("allDayOn",{date:a(this,g,Fe).call(this,e.start)}):this.t("allDayRange",{start:a(this,g,Fe).call(this,e.start),end:a(this,g,Fe).call(this,e.end)}):H(e.start)!==H(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&sd(e.start,e.end)===1)?a(this,g,wo).call(this,e.start,e.end):this.t("timed",{date:a(this,g,Fe).call(this,e.start),time:a(this,g,wo).call(this,e.start,e.end)})},ug=function(e){let t={title:e.name,when:a(this,g,nd).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},gg=function(e){let t=r(this,g,xi);if(r(this,g,ye)==="month")return r(this,g,vo).monthYear(r(this,g,ct));if(e.length===1)return ee(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=dg(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return cm(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},fg=function(e){return r(this,g,ad).hour12?cm(ee(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,g,xi))):a(this,g,xo).call(this,e*60)},sr=function(e,t){let{start:i,end:s}=a(this,g,pm).call(this,e,t);return e.mode==="time"?this.t("timed",{date:a(this,g,Fe).call(this,i),time:a(this,g,wo).call(this,i,s)}):a(this,g,Fe).call(this,U(N(e.origin),t.group-e.from.group))},mm=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<ib;t!==this._narrow&&(this._narrow=t)},$o=function(e,t){return r(this,g,ye)==="month"?Ye(e,t):r(this,g,ye)==="week"?U(e,t*(this._narrow?3:7)):U(e,t)},bg=function(e){this.view!==e&&(this.view=e)},ko=function(){return[...this.renderRoot.querySelectorAll(".item")]},vg=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(s=>s.dataset.k===e&&s.classList.contains("item"))??t.find(s=>s.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let s=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${s}`)??null}return null},yg=function(){let e=H(r(this,g,ct));if(r(this,g,hm))return`day:${e}`;if(r(this,g,ye)==="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}`},xg=function(){let e=a(this,g,ko).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,xt))??e.find(i=>i.dataset.k===a(this,g,yg).call(this))??e.find(i=>i.dataset.day===H(r(this,g,ct)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},wg=function(e){f(this,xt,e.dataset.k??"");for(let t of a(this,g,ko).call(this))t.tabIndex=t===e?0:-1;e.focus()},zo=new WeakMap,Co=new WeakMap,$g=function(e,t){let i=new Map;for(let x of a(this,g,ko).call(this)){let M=Number(x.dataset.i);(i.get(M)??i.set(M,[]).get(M)).push(x)}let s=Number(e.dataset.i),l=i.get(s)??[e],d=Math.max(0,l.indexOf(e)),m=a(this,g,dt).call(this).length,u=r(this,g,ye)==="month",v=e.dataset.row,b=(x,M)=>{let A=x>=0&&x<m?i.get(x):void 0;return(A?.length?M(A):void 0)??null},$=x=>u?x[Math.min(d,x.length-1)]:x.find(M=>M.dataset.row===v)??x[0];switch(t){case"ArrowRight":return b(s+1,$);case"ArrowLeft":return b(s-1,$);case"ArrowDown":return l[d+1]??(u?b(s+7,x=>x[0]):null);case"ArrowUp":return d>0?l[d-1]:u?b(s-7,x=>x[x.length-1]):null;case"Home":return u?b(s-s%7,x=>x[0]):b(0,$);case"End":return u?b(Math.min(m-1,s-s%7+6),x=>x[0]):b(m-1,$);default:return null}},kg=function(e,t){let i=e.dataset.day??H(r(this,g,ct)),s=a(this,g,$o).call(this,N(i)??r(this,g,ct),t),l=H(s),d=(e.dataset.k??"").split(":")[0],m;r(this,g,hm)?m=`day:${l}`:r(this,g,ye)==="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=H(a(this,g,$o).call(this,r(this,g,ct),t)),f(this,xt,m),f(this,je,{key:m,until:Date.now()+1e3})},Lo=new WeakMap,Eo=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,g,yt))+1},Eg=function(e,t){let i=r(this,G);if(!i)return null;let s=a(this,g,dt).call(this).length,l=v=>Math.max(0,Math.min(s-1,v));if(i.mode==="day"){let v=r(this,g,ye)==="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<s?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):s-1,index:0};default:return null}}let d=a(this,g,Eo).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,g,yt))),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}},pm=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=a(this,g,dt).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,g,yt));return{start:m,end:new Date(m.getTime()+i.dur*6e4)}}let s=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+s,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},um=function(e,t){let s=a(this,g,dt).call(this).map(H).indexOf(t);if(s<0)return null;let l=r(this,g,hg)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,g,yt)),a(this,g,Eo).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:s,index:d}}},gm=function(){r(this,G)&&(r(this,G).ev.el.moving=!1),f(this,G,null),this._target=null},Mg=function(e){let t=r(this,G);if(!t||!e){this._target=null;return}let i=H(a(this,g,dt).call(this)[e.group]??N(t.origin)),s=e.group===t.from.group&&e.index===t.from.index;this._target=s?null:{iso:i,min:t.mode==="time"?e.index*r(this,g,yt):void 0}},Tg=function(e,t){let i=r(this,G);a(this,g,gm).call(this),i&&(f(this,Xs,performance.now()+400),a(this,g,fm).call(this,i,e,t,"keyboard"))},fm=function(e,t,i,s){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=a(this,g,pm).call(this,e,i),u=H(U(N(e.origin),i.group-t.group));a(this,g,vm).call(this,e.ev,d,m,s,l,e.mode==="time"?H(d):u)},bm=function(e,t,i){return e?{start:H(t),end:H(i)}:{start:og(t),end:og(i)}},vm=function(e,t,i,s,l,d){let m=e.el,u=e.name,v=a(this,g,bm).call(this,e.allDay,e.start,e.end),b=a(this,g,bm).call(this,e.allDay,t,i),$=V=>{s==="keyboard"&&f(this,je,{key:V,until:Date.now()+1e3})};if(l||v.start===b.start&&v.end===b.end)return s!=="api"&&r(this,Te).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let x={...e,start:t,end:i},M=e.allDay?a(this,g,Fe).call(this,t):this.t("timed",{date:a(this,g,Fe).call(this,t),time:a(this,g,wo).call(this,t,i)}),A=[],I={value:e.key,event:m,from:v,to:b,allDay:e.allDay,source:s,waitUntil:V=>{A.push(Promise.resolve(V))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:I,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,ar).set(m,v),m.start=b.start,m.end=b.end),$(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Te).announce(this.t("moved",{event:u,place:x.allDay?a(this,g,Fe).call(this,t):M})),A.length&&(m.pending=!0,Promise.all(A).then(()=>{m.pending=!1,this.controlled||r(this,ar).delete(m)},()=>{m.pending=!1,this.controlled?r(this,Te).announce(this.t("reverted",{event:u,place:a(this,g,nd).call(this,e)})):this.revert(m)})),!0):(r(this,Te).announce(this.t("refused",{event:u,place:M})),this.requestUpdate(),!1)},So=new WeakMap,ym=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let s=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,s=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:s,min:(t-d.top)/d.height*60}},_g=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let s=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,s=d)}return s?Number(s.dataset.i):null},Do=new WeakMap,Ao=new WeakMap,No=new WeakMap,Ro=new WeakMap,Ho=new WeakMap,Io=new WeakMap,xm=function(){let e=r(this,X);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Te).announce(this.t("pickedUp",{event:e.ev.name,place:a(this,g,sr).call(this,e,e.from)})),a(this,g,od).call(this);let t=()=>{r(this,X)?.started&&(a(this,g,zg).call(this),r(this,X).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},od=function(){let e=r(this,X);if(!e)return;let t=null;if(e.mode==="time"){let l=a(this,g,ym).call(this,e.x,e.y);if(l){let d=a(this,g,Eo).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,g,yt))))}}}else{let l=a(this,g,_g).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 s=t.group===e.from.group&&t.index===e.from.index;this._target=s?null:{iso:H(a(this,g,dt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,g,yt):void 0},i&&r(this,Te).announce(this.t("over",{place:a(this,g,sr).call(this,e,t)}))},zg=function(){let e=r(this,X),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,s=14,l=$=>$<i?Math.ceil((i-Math.max($,0))/i*s):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&&a(this,g,od).call(this)},wi=function(e){let t=r(this,X);t&&(f(this,X,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,Ro),!0),window.removeEventListener("pointerup",r(this,Ho),!0),window.removeEventListener("pointercancel",r(this,Io),!0),window.removeEventListener("touchmove",r(this,Ao),!0),window.removeEventListener("contextmenu",r(this,No),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&a(this,g,fm).call(this,t,t.from,t.to,"pointer")))},Mo=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,g,ye)},bubbles:!0,composed:!0}))},Cg=function(e,t,i){let s=i*60;if(e.detail>0){let m=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-m.top)/m.height*60/r(this,g,yt))*r(this,g,yt);s+=Math.max(0,Math.min(59,u))}let l=Math.floor(s/60),d=s%60;a(this,g,Mo).call(this,`${t}T${dd(l)}:${dd(d)}`,!1)},wm=function(e,t){if(performance.now()<r(this,Xs)||r(this,ge).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()},Lg=function(e){this._more=e,f(this,Js,!0)},ld=function(e){let t=this._more;this._more="",e&&t&&(f(this,xt,`more:${t}`),f(this,je,{key:`more:${t}`,until:Date.now()+1e3}))},$m=function(){return r(this,G)?.ev??(r(this,X)?.started?r(this,X).ev:null)},Ks=function(e,t,i,s,l,d={}){let m=e.el,u=m.pending,v=a(this,g,ug).call(this,e),b=!this.readonly&&!m.locked&&!u,$=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",x=`chip ${s} tone-${$}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,M=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,A=e.allDay?h:c`<span class="tm">${a(this,g,xo).call(this,e.min)}</span>`,I=m.kind&&(s!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,B=u?c`<span class="spin" aria-hidden="true"></span>`:h,V=s==="time"?c`<span class="lead">${M}${A}${B}</span><span class="h">${e.name}</span>${I}`:c`${M}${A}<span class="h">${e.name}</span>${I}${B}`,Q=u?`${v}, ${this.t("saving")}`:v,$t=b?`${r(this,Me)}-mv`:`${r(this,Me)}-op`,F=`ev:${e.key}:${t}`,Re=b?this.t("roleDescription"):h;return m.href?c`<a class=${x} href=${m.href} style=${d.style??h} data-k=${F} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2157
|
+
</div>`}};Gs=new WeakMap,Me=new WeakMap,Te=new WeakMap,ge=new WeakMap,G=new WeakMap,X=new WeakMap,nr=new WeakMap,xt=new WeakMap,je=new WeakMap,To=new WeakMap,$i=new WeakMap,Xs=new WeakMap,Js=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,_o=new WeakMap,g=new WeakSet,ye=function(){return lg.includes(this.view)?this.view:"month"},xi=function(){return Ir(this,this.locale)},vo=function(){return Or(r(this,g,xi))},ad=function(){return Jl(r(this,g,xi),this.hourCycle)},yt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},dm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Pr(r(this,g,xi)):(Math.trunc(e)%7+7)%7},yo=function(){return N(this.today)?this.today:Qd()},ct=function(){return N(this.date)??N(r(this,g,yo))},hm=function(){return r(this,g,ye)==="month"&&this._narrow},hg=function(){return r(this,g,ye)!=="month"},dt=function(){let e=r(this,g,ct),t=r(this,g,dm);if(r(this,g,ye)==="day")return[e];if(r(this,g,ye)==="week"){if(this._narrow)return[e,U(e,1),U(e,2)];let d=U(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>U(d,u))}let i=zt(e),a=U(i,-((i.getDay()-t+7)%7)),l=Math.ceil((sd(a,Rr(e))+1)/7)*7;return Array.from({length:l},(d,m)=>U(a,m))},Us=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(Ge(e.start).date||e.start);if(!u)return null;let v=N(Ge(e.end).date||e.end)??u;v<u&&(v=u);let b=Math.min(sd(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},($,x)=>H(U(u,x)))}}let l=pt(e.start);if(!l)return null;let d=pt(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:[H(l)]}},mg=function(){return this.events.map(e=>s(this,g,Us).call(this,e)).filter(e=>!!e)},pg=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},Fe=function(e){return ee(e,{weekday:"long",day:"numeric",month:"long"},r(this,g,xi))},xo=function(e){return r(this,g,ad).format((e%1440+1440)%1440)},wo=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=dg(r(this,g,xi),{hour:"numeric",minute:"2-digit",...i});try{if(H(e)===H(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(b=>b.source==="endRange"),v=-1;if(m.forEach((b,$)=>{b.source==="startRange"&&(v=$)}),v>=0&&u>v){let b=$=>cm($.map(x=>x.value).join(""));return this.t("timeRange",{start:b(m.slice(0,v+1)),end:b(m.slice(u))})}}}catch{}let l=H(e)===H(t),d=m=>l?s(this,g,xo).call(this,m.getHours()*60+m.getMinutes()):r(this,g,ad).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},nd=function(e){return e.allDay?H(e.start)===H(e.end)?this.t("allDayOn",{date:s(this,g,Fe).call(this,e.start)}):this.t("allDayRange",{start:s(this,g,Fe).call(this,e.start),end:s(this,g,Fe).call(this,e.end)}):H(e.start)!==H(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&sd(e.start,e.end)===1)?s(this,g,wo).call(this,e.start,e.end):this.t("timed",{date:s(this,g,Fe).call(this,e.start),time:s(this,g,wo).call(this,e.start,e.end)})},ug=function(e){let t={title:e.name,when:s(this,g,nd).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},gg=function(e){let t=r(this,g,xi);if(r(this,g,ye)==="month")return r(this,g,vo).monthYear(r(this,g,ct));if(e.length===1)return ee(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=dg(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return cm(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},fg=function(e){return r(this,g,ad).hour12?cm(ee(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,g,xi))):s(this,g,xo).call(this,e*60)},ar=function(e,t){let{start:i,end:a}=s(this,g,pm).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,g,Fe).call(this,i),time:s(this,g,wo).call(this,i,a)}):s(this,g,Fe).call(this,U(N(e.origin),t.group-e.from.group))},mm=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<ib;t!==this._narrow&&(this._narrow=t)},$o=function(e,t){return r(this,g,ye)==="month"?Ye(e,t):r(this,g,ye)==="week"?U(e,t*(this._narrow?3:7)):U(e,t)},bg=function(e){this.view!==e&&(this.view=e)},ko=function(){return[...this.renderRoot.querySelectorAll(".item")]},vg=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},yg=function(){let e=H(r(this,g,ct));if(r(this,g,hm))return`day:${e}`;if(r(this,g,ye)==="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}`},xg=function(){let e=s(this,g,ko).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,xt))??e.find(i=>i.dataset.k===s(this,g,yg).call(this))??e.find(i=>i.dataset.day===H(r(this,g,ct)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},wg=function(e){f(this,xt,e.dataset.k??"");for(let t of s(this,g,ko).call(this))t.tabIndex=t===e?0:-1;e.focus()},zo=new WeakMap,Co=new WeakMap,$g=function(e,t){let i=new Map;for(let x of s(this,g,ko).call(this)){let M=Number(x.dataset.i);(i.get(M)??i.set(M,[]).get(M)).push(x)}let a=Number(e.dataset.i),l=i.get(a)??[e],d=Math.max(0,l.indexOf(e)),m=s(this,g,dt).call(this).length,u=r(this,g,ye)==="month",v=e.dataset.row,b=(x,M)=>{let A=x>=0&&x<m?i.get(x):void 0;return(A?.length?M(A):void 0)??null},$=x=>u?x[Math.min(d,x.length-1)]:x.find(M=>M.dataset.row===v)??x[0];switch(t){case"ArrowRight":return b(a+1,$);case"ArrowLeft":return b(a-1,$);case"ArrowDown":return l[d+1]??(u?b(a+7,x=>x[0]):null);case"ArrowUp":return d>0?l[d-1]:u?b(a-7,x=>x[x.length-1]):null;case"Home":return u?b(a-a%7,x=>x[0]):b(0,$);case"End":return u?b(Math.min(m-1,a-a%7+6),x=>x[0]):b(m-1,$);default:return null}},kg=function(e,t){let i=e.dataset.day??H(r(this,g,ct)),a=s(this,g,$o).call(this,N(i)??r(this,g,ct),t),l=H(a),d=(e.dataset.k??"").split(":")[0],m;r(this,g,hm)?m=`day:${l}`:r(this,g,ye)==="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=H(s(this,g,$o).call(this,r(this,g,ct),t)),f(this,xt,m),f(this,je,{key:m,until:Date.now()+1e3})},Lo=new WeakMap,Eo=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,g,yt))+1},Eg=function(e,t){let i=r(this,G);if(!i)return null;let a=s(this,g,dt).call(this).length,l=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,g,ye)==="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,g,Eo).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,g,yt))),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}},pm=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,g,dt).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,g,yt));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)}},um=function(e,t){let a=s(this,g,dt).call(this).map(H).indexOf(t);if(a<0)return null;let l=r(this,g,hg)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,g,yt)),s(this,g,Eo).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},gm=function(){r(this,G)&&(r(this,G).ev.el.moving=!1),f(this,G,null),this._target=null},Mg=function(e){let t=r(this,G);if(!t||!e){this._target=null;return}let i=H(s(this,g,dt).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,g,yt):void 0}},Tg=function(e,t){let i=r(this,G);s(this,g,gm).call(this),i&&(f(this,Xs,performance.now()+400),s(this,g,fm).call(this,i,e,t,"keyboard"))},fm=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,g,pm).call(this,e,i),u=H(U(N(e.origin),i.group-t.group));s(this,g,vm).call(this,e.ev,d,m,a,l,e.mode==="time"?H(d):u)},bm=function(e,t,i){return e?{start:H(t),end:H(i)}:{start:og(t),end:og(i)}},vm=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,g,bm).call(this,e.allDay,e.start,e.end),b=s(this,g,bm).call(this,e.allDay,t,i),$=V=>{a==="keyboard"&&f(this,je,{key:V,until:Date.now()+1e3})};if(l||v.start===b.start&&v.end===b.end)return a!=="api"&&r(this,Te).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let x={...e,start:t,end:i},M=e.allDay?s(this,g,Fe).call(this,t):this.t("timed",{date:s(this,g,Fe).call(this,t),time:s(this,g,wo).call(this,t,i)}),A=[],I={value:e.key,event:m,from:v,to:b,allDay:e.allDay,source:a,waitUntil:V=>{A.push(Promise.resolve(V))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:I,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,nr).set(m,v),m.start=b.start,m.end=b.end),$(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Te).announce(this.t("moved",{event:u,place:x.allDay?s(this,g,Fe).call(this,t):M})),A.length&&(m.pending=!0,Promise.all(A).then(()=>{m.pending=!1,this.controlled||r(this,nr).delete(m)},()=>{m.pending=!1,this.controlled?r(this,Te).announce(this.t("reverted",{event:u,place:s(this,g,nd).call(this,e)})):this.revert(m)})),!0):(r(this,Te).announce(this.t("refused",{event:u,place:M})),this.requestUpdate(),!1)},So=new WeakMap,ym=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}},_g=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},Do=new WeakMap,Ao=new WeakMap,No=new WeakMap,Ro=new WeakMap,Ho=new WeakMap,Io=new WeakMap,xm=function(){let e=r(this,X);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Te).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,g,ar).call(this,e,e.from)})),s(this,g,od).call(this);let t=()=>{r(this,X)?.started&&(s(this,g,zg).call(this),r(this,X).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},od=function(){let e=r(this,X);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,g,ym).call(this,e.x,e.y);if(l){let d=s(this,g,Eo).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,g,yt))))}}}else{let l=s(this,g,_g).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:H(s(this,g,dt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,g,yt):void 0},i&&r(this,Te).announce(this.t("over",{place:s(this,g,ar).call(this,e,t)}))},zg=function(){let e=r(this,X),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=$=>$<i?Math.ceil((i-Math.max($,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,g,od).call(this)},wi=function(e){let t=r(this,X);t&&(f(this,X,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,Ro),!0),window.removeEventListener("pointerup",r(this,Ho),!0),window.removeEventListener("pointercancel",r(this,Io),!0),window.removeEventListener("touchmove",r(this,Ao),!0),window.removeEventListener("contextmenu",r(this,No),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,g,fm).call(this,t,t.from,t.to,"pointer")))},Mo=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,g,ye)},bubbles:!0,composed:!0}))},Cg=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,g,yt))*r(this,g,yt);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,g,Mo).call(this,`${t}T${dd(l)}:${dd(d)}`,!1)},wm=function(e,t){if(performance.now()<r(this,Xs)||r(this,ge).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()},Lg=function(e){this._more=e,f(this,Js,!0)},ld=function(e){let t=this._more;this._more="",e&&t&&(f(this,xt,`more:${t}`),f(this,je,{key:`more:${t}`,until:Date.now()+1e3}))},$m=function(){return r(this,G)?.ev??(r(this,X)?.started?r(this,X).ev:null)},Ks=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,g,ug).call(this,e),b=!this.readonly&&!m.locked&&!u,$=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",x=`chip ${a} tone-${$}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,M=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,A=e.allDay?h:c`<span class="tm">${s(this,g,xo).call(this,e.min)}</span>`,I=m.kind&&(a!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,B=u?c`<span class="spin" aria-hidden="true"></span>`:h,V=a==="time"?c`<span class="lead">${M}${A}${B}</span><span class="h">${e.name}</span>${I}`:c`${M}${A}<span class="h">${e.name}</span>${I}${B}`,Q=u?`${v}, ${this.t("saving")}`:v,$t=b?`${r(this,Me)}-mv`:`${r(this,Me)}-op`,F=`ev:${e.key}:${t}`,Re=b?this.t("roleDescription"):h;return m.href?c`<a class=${x} href=${m.href} style=${d.style??h} data-k=${F} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2158
2158
|
data-row=${d.row??h} aria-label=${Q} aria-describedby=${$t} aria-roledescription=${Re}
|
|
2159
|
-
@click=${rt=>
|
|
2159
|
+
@click=${rt=>s(this,g,wm).call(this,rt,e)}>${V}</a>`:c`<button type="button" class=${x} style=${d.style??h} data-k=${F} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2160
2160
|
data-row=${d.row??h} aria-label=${Q} aria-describedby=${$t} aria-roledescription=${Re}
|
|
2161
|
-
@click=${rt=>
|
|
2161
|
+
@click=${rt=>s(this,g,wm).call(this,rt,e)}>${V}</button>`},cd=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.name}</div>`},Sg=function(e){let t=r(this,g,ye),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">
|
|
2162
2162
|
<div class="nav">
|
|
2163
|
-
<button type="button" class="hb icon prev" aria-label=${
|
|
2163
|
+
<button type="button" class="hb icon prev" aria-label=${a} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
2164
2164
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
2165
2165
|
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
2166
2166
|
</div>
|
|
2167
|
-
<div class="title" part="title" id="${r(this,Me)}-t" role="heading" aria-level=${d} aria-live="polite">${
|
|
2167
|
+
<div class="title" part="title" id="${r(this,Me)}-t" role="heading" aria-level=${d} aria-live="polite">${s(this,g,gg).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
2168
2168
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
2169
|
-
${lg.map(m=>c`<button type="button" class="hb" data-view=${m} aria-pressed=${m===t?"true":"false"} @click=${()=>
|
|
2169
|
+
${lg.map(m=>c`<button type="button" class="hb" data-view=${m} aria-pressed=${m===t?"true":"false"} @click=${()=>s(this,g,bg).call(this,m)}>${this.t(m)}</button>`)}
|
|
2170
2170
|
</div>
|
|
2171
|
-
</div>`},Dg=function(e){let t=r(this,g,vo),i=Array.from({length:7},(
|
|
2171
|
+
</div>`},Dg=function(e){let t=r(this,g,vo),i=Array.from({length:7},(a,l)=>(l+r(this,g,dm))%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>`},Ag=function(e,t){let i=r(this,g,ct),a=r(this,g,yo),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=s(this,g,$m).call(this),m=this._target,u=Array.from({length:e.length/7},(V,Q)=>e.slice(Q*7,Q*7+7)),v=this._narrow,b=(V,Q,$t)=>{let F=H(V),Re=t.get(F)??[],rt=s(this,g,Fe).call(this,V),Wm=`${V.getMonth()!==i.getMonth()?"other":""} ${F===a?"today":""} ${m?.iso===F?"over":""}`,Ym=c`<span class="num" aria-hidden="true">${r(this,g,vo).day(V)}</span>`;if(v){let kt=Re.slice(0,3).map(ur=>["attention","information","success","critical"].includes(ur.el.tone)?ur.el.tone:"neutral");return c`<td class=${Wm} data-drop data-i=${Q} aria-selected=${F===H(i)?"true":"false"} aria-current=${F===a?"date":h}>
|
|
2172
2172
|
<button type="button" class="dayb item" data-k="day:${F}" data-i=${Q} data-day=${F} aria-label=${this.t("dayEvents",{date:rt,count:Re.length})}
|
|
2173
2173
|
@click=${()=>{this.date=F,f(this,xt,`day:${F}`)}}>${Ym}<span class="dots">${kt.map(ur=>c`<span class="dot tone-${ur}"></span>`)}</span></button>
|
|
2174
2174
|
</td>`}let pr=Re,sl=0;if(Re.length>l){pr=Re.slice(0,l-1);let kt=d&&Re.find(ur=>ur.key===d.key);kt&&!pr.includes(kt)&&(pr=[...Re.slice(0,l-2),kt]),sl=Re.length-pr.length}let al=this.readonly;return c`<td class="${Wm}${al?" item":""}" data-drop data-i=${Q} data-day=${F} data-k=${al?`cell:${F}`:h}
|
|
2175
|
-
aria-label=${al?this.t("dayEvents",{date:rt,count:Re.length}):h} aria-current=${F===
|
|
2175
|
+
aria-label=${al?this.t("dayEvents",{date:rt,count:Re.length}):h} aria-current=${F===a?"date":h}>
|
|
2176
2176
|
<div class="dh">${Ym}<span class="vh">${rt}</span>
|
|
2177
2177
|
${al?h:c`<button type="button" class="add item" data-k="add:${F}" data-i=${Q} data-day=${F} aria-label=${this.t("addOn",{date:rt})}
|
|
2178
|
-
@click=${()=>
|
|
2178
|
+
@click=${()=>s(this,g,Mo).call(this,F,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2179
2179
|
</div>
|
|
2180
2180
|
${pr.length||m?.iso===F&&d?c`<ul class="evs">
|
|
2181
|
-
${pr.map(kt=>c`<li>${
|
|
2182
|
-
${m?.iso===F&&d?c`<li aria-hidden="true">${
|
|
2181
|
+
${pr.map(kt=>c`<li>${s(this,g,Ks).call(this,kt,F,Q,"month",!0)}</li>`)}
|
|
2182
|
+
${m?.iso===F&&d?c`<li aria-hidden="true">${s(this,g,cd).call(this,d)}</li>`:h}
|
|
2183
2183
|
</ul>`:h}
|
|
2184
2184
|
${sl?c`<button type="button" class="more item" data-k="more:${F}" data-i=${Q} data-day=${F} aria-haspopup="dialog"
|
|
2185
2185
|
aria-expanded=${this._more===F?"true":"false"} aria-label=${this.t("moreLabel",{count:sl,date:rt})}
|
|
2186
|
-
@click=${()=>this._more===F?
|
|
2186
|
+
@click=${()=>this._more===F?s(this,g,ld).call(this,!1):s(this,g,Lg).call(this,F)}>${this.t("more",{count:sl})}</button>`:h}
|
|
2187
2187
|
${this._more===F?c`<div class="pop ${$t>=4?"end":""}" role="dialog" aria-label=${rt}>
|
|
2188
|
-
<div class="pop-h"><span>${rt}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>
|
|
2189
|
-
<ul>${Re.map(kt=>c`<li>${
|
|
2188
|
+
<div class="pop-h"><span>${rt}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>s(this,g,ld).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
2189
|
+
<ul>${Re.map(kt=>c`<li>${s(this,g,Ks).call(this,kt,F,Q,"list",!1)}</li>`)}</ul>
|
|
2190
2190
|
</div>`:h}
|
|
2191
2191
|
</td>`},$=c`<table class="month ${v?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,Me)}-t" aria-describedby="${r(this,Me)}-gh"
|
|
2192
2192
|
aria-busy=${this.loading?"true":"false"}>
|
|
2193
|
-
${
|
|
2193
|
+
${s(this,g,Dg).call(this,v)}
|
|
2194
2194
|
<tbody>${u.map((V,Q)=>c`<tr>${V.map(($t,F)=>b($t,Q*7+F,F))}</tr>`)}</tbody>
|
|
2195
|
-
</table>`;if(!v)return $;let x=H(i),M=t.get(x)??[],A=e.findIndex(V=>H(V)===x),I=
|
|
2195
|
+
</table>`;if(!v)return $;let x=H(i),M=t.get(x)??[],A=e.findIndex(V=>H(V)===x),I=s(this,g,Fe).call(this,i),B=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${$}
|
|
2196
2196
|
<section class="agenda" part="agenda" aria-labelledby="${r(this,Me)}-ag">
|
|
2197
2197
|
<div class="ag-h">
|
|
2198
2198
|
<div class="ag-t" id="${r(this,Me)}-ag" role="heading" aria-level=${B}>${I}</div>
|
|
2199
|
-
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:I})} @click=${()=>
|
|
2199
|
+
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:I})} @click=${()=>s(this,g,Mo).call(this,x,!0)}>
|
|
2200
2200
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
2201
2201
|
</div>
|
|
2202
|
-
${M.length?c`<ul class="ag-list">${M.map(V=>c`<li>${
|
|
2203
|
-
</section>`},Ng=function(e){let t=new Map,i=e.filter(u=>!u.allDay).sort((u,v)=>u.min-v.min||v.dur-u.dur),
|
|
2202
|
+
${M.length?c`<ul class="ag-list">${M.map(V=>c`<li>${s(this,g,Ks).call(this,V,x,A,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
2203
|
+
</section>`},Ng=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($=>$<=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},Rg=function(e,t){let i=r(this,g,yo),a=r(this,g,vo),l=s(this,g,$m).call(this),d=this._target,m=this.readonly,u=e.map(b=>{let $=H(b),x=t.get($)??[];return{d:b,iso:$,text:s(this,g,Fe).call(this,b),allDay:x.filter(M=>M.allDay),timed:x.filter(M=>!M.allDay),lanes:s(this,g,Ng).call(this,x)}}),v=Array.from({length:24},(b,$)=>$);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${r(this,Me)}-t" aria-describedby="${r(this,Me)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
2204
2204
|
style="--cols:${e.length}">
|
|
2205
2205
|
<div class="tg-top" role="rowgroup">
|
|
2206
2206
|
<div class="row" role="row">
|
|
2207
2207
|
<div class="axis" role="columnheader"><span class="vh">${this.t("time")}</span></div>
|
|
2208
2208
|
${u.map(b=>c`<div class="colh ${b.iso===i?"today":""}" role="columnheader" aria-current=${b.iso===i?"date":h}>
|
|
2209
|
-
<span class="wd" aria-hidden="true">${
|
|
2209
|
+
<span class="wd" aria-hidden="true">${a.weekdaysShort[b.d.getDay()]}</span><span class="dn" aria-hidden="true">${a.day(b.d)}</span><span class="vh">${b.text}</span>
|
|
2210
2210
|
</div>`)}
|
|
2211
2211
|
</div>
|
|
2212
2212
|
<div class="row adrow" role="row">
|
|
2213
2213
|
<div class="axis" role="rowheader">${this.t("allDay")}</div>
|
|
2214
2214
|
${u.map((b,$)=>c`<div class="adcell ${d?.iso===b.iso&&l?.allDay?"over":""}" role="gridcell" data-drop data-i=${$}>
|
|
2215
2215
|
${m?h:c`<button type="button" class="add item" data-k="adadd:${b.iso}" data-i=${$} data-day=${b.iso} data-row="a"
|
|
2216
|
-
aria-label=${this.t("addAllDay",{date:b.text})} @click=${()=>
|
|
2217
|
-
${b.allDay.map(x=>
|
|
2218
|
-
${d?.iso===b.iso&&l?.allDay?
|
|
2216
|
+
aria-label=${this.t("addAllDay",{date:b.text})} @click=${()=>s(this,g,Mo).call(this,b.iso,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2217
|
+
${b.allDay.map(x=>s(this,g,Ks).call(this,x,b.iso,$,"allday",!0,{row:"a"}))}
|
|
2218
|
+
${d?.iso===b.iso&&l?.allDay?s(this,g,cd).call(this,l):h}
|
|
2219
2219
|
</div>`)}
|
|
2220
2220
|
</div>
|
|
2221
2221
|
</div>
|
|
2222
2222
|
<div class="tg-body" role="rowgroup">
|
|
2223
2223
|
${v.map(b=>c`<div class="row hr" role="row">
|
|
2224
|
-
<div class="axis" role="rowheader"><span>${
|
|
2224
|
+
<div class="axis" role="rowheader"><span>${s(this,g,fg).call(this,b)}</span></div>
|
|
2225
2225
|
${u.map(($,x)=>{let M=$.timed.filter(I=>Math.floor(I.min/60)===b),A=l&&!l.allDay&&d?.iso===$.iso&&d.min!==void 0&&Math.floor(d.min/60)===b;return c`<div class="tcell" role="gridcell" data-i=${x} data-row=${b} data-day=${$.iso}>
|
|
2226
2226
|
${m?h:c`<button type="button" class="slot item" data-k="slot:${$.iso}:${b}" data-i=${x} data-row=${b} data-day=${$.iso}
|
|
2227
|
-
aria-label=${this.t("addAt",{time:
|
|
2228
|
-
${M.map(I=>{let B=$.lanes.get(I)??{lane:0,lanes:1},V=Math.min(I.dur,1440-I.min)/60;return
|
|
2229
|
-
${A?
|
|
2227
|
+
aria-label=${this.t("addAt",{time:s(this,g,xo).call(this,b*60),date:$.text})} @click=${I=>s(this,g,Cg).call(this,I,$.iso,b)}></button>`}
|
|
2228
|
+
${M.map(I=>{let B=$.lanes.get(I)??{lane:0,lanes:1},V=Math.min(I.dur,1440-I.min)/60;return s(this,g,Ks).call(this,I,$.iso,x,"time",!0,{row:String(b),style:`--top:${(I.min-b*60)/60};--len:${V};--lane:${B.lane};--lanes:${B.lanes}`})})}
|
|
2229
|
+
${A?s(this,g,cd).call(this,l,"time",`--top:${(d.min-b*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
2230
2230
|
</div>`})}
|
|
2231
2231
|
</div>`)}
|
|
2232
2232
|
</div>
|
|
@@ -2428,16 +2428,16 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2428
2428
|
.title { margin-bottom: var(--cm-space-8); }
|
|
2429
2429
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
2430
2430
|
}
|
|
2431
|
-
`];w("cm-report-tiles",ea);var m$=_("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),Hg=/^\s*-?\d+(\.\d+)?\s*$/,ta=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:Hg.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(),
|
|
2432
|
-
<cm-icon name=${e==="flat"?"arrow-left":"arrow-up-right"} size="16"></cm-icon><span aria-hidden="true">${this.change}</span><span class="sr">${
|
|
2433
|
-
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),i=this.renderChange(),
|
|
2431
|
+
`];w("cm-report-tiles",ea);var m$=_("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),Hg=/^\s*-?\d+(\.\d+)?\s*$/,ta=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:Hg.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">
|
|
2432
|
+
<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>
|
|
2433
|
+
</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`
|
|
2434
2434
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
2435
2435
|
<span class="value" id="value" part="value">${t}</span>
|
|
2436
|
-
<span class="foot ${
|
|
2436
|
+
<span class="foot ${a?"on":""}" id="foot" part="footer">
|
|
2437
2437
|
${i}
|
|
2438
2438
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
2439
2439
|
</span>
|
|
2440
|
-
`,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=${
|
|
2440
|
+
`,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}`}};ta.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&Hg.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}},ta.styles=[k,y`
|
|
2441
2441
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
2442
2442
|
.tile {
|
|
2443
2443
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -2473,29 +2473,29 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2473
2473
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
2474
2474
|
}
|
|
2475
2475
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
2476
|
-
`];w("cm-metric",ta);var ia=class extends C{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 Ig(this)}};ia.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}},ia.styles=y`:host { display: none !important; }`;w("cm-nav-item",ia);function Ig(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=Bt(o);return t.length&&(e.items=t),e}var Bt=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(Ig),km=o=>o.value||o.href||o.label,hd=o=>!!o.current||!!o.items?.some(hd)
|
|
2477
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${
|
|
2476
|
+
`];w("cm-metric",ta);var ia=class extends C{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 Ig(this)}};ia.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}},ia.styles=y`:host { display: none !important; }`;w("cm-nav-item",ia);function Ig(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=Bt(o);return t.length&&(e.items=t),e}var Bt=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(Ig),km=o=>o.value||o.href||o.label,hd=o=>!!o.current||!!o.items?.some(hd),ki=(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},Ei=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:km(n),href:n.href??""}}));var $$=_("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),Po,Oo,ud,O,Em,md,Mm,Pg,Og,Tm,_m,qg,zm,Cm,pd,Lm,Bg,ra=class extends T{constructor(){super(...arguments);p(this,O);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;p(this,Po,new Set);p(this,Oo);p(this,ud,D("cm-sidenav"))}connectedCallback(){super.connectedCallback(),s(this,O,Em).call(this),f(this,Oo,ki(this,()=>s(this,O,Em).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Oo)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let i=s(this,O,md).call(this,e,t);r(this,Po).has(i)||!e.items?.length||(r(this,Po).add(i),(e.expanded||hd(e))&&this._open.add(i))})}toggle(e,t){let i=this.navItems[e];if(!i?.items?.length)return;let a=s(this,O,md).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`
|
|
2477
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,O,Og)}>
|
|
2478
2478
|
<slot name="header"></slot>
|
|
2479
2479
|
<ul part="list">
|
|
2480
|
-
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${
|
|
2481
|
-
${
|
|
2482
|
-
aria-expanded=${
|
|
2483
|
-
${
|
|
2480
|
+
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,O,Lm).call(this,t,"",{index:i})}</li>`;let a=!e&&this._open.has(s(this,O,md).call(this,t,i)),l=`${r(this,ud)}-${i}`;return c`<li>
|
|
2481
|
+
${s(this,O,pd).call(this,t,c`<button type="button" class="item parent ${hd(t)?"has-current":""}" part="item" data-index=${i}
|
|
2482
|
+
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,O,qg).call(this,i):this.toggle(i)}>
|
|
2483
|
+
${s(this,O,zm).call(this,t)}${s(this,O,Cm).call(this,t)}
|
|
2484
2484
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
2485
2485
|
</button>`)}
|
|
2486
|
-
<ul class="sub" id=${l} ?hidden=${!
|
|
2487
|
-
${
|
|
2486
|
+
<ul class="sub" id=${l} ?hidden=${!a} aria-label=${t.label}>
|
|
2487
|
+
${s(this,O,Tm).call(this,t.items).map(([d,m])=>c`<li>${s(this,O,Lm).call(this,{...d,icon:void 0},m?"deep":"",{parent:i})}</li>`)}
|
|
2488
2488
|
</ul>
|
|
2489
2489
|
</li>`})}
|
|
2490
2490
|
</ul>
|
|
2491
|
-
${
|
|
2491
|
+
${s(this,O,Bg).call(this)}
|
|
2492
2492
|
<slot name="footer"></slot>
|
|
2493
2493
|
<slot hidden></slot>
|
|
2494
2494
|
</nav>
|
|
2495
|
-
`}};Po=new WeakMap,Oo=new WeakMap,ud=new WeakMap,O=new WeakSet,Em=function(){this._slotted=Bt(this)},md=function(e,t){return`${t}:${km(e)}`},Mm=function(e,t){
|
|
2496
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>
|
|
2497
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>
|
|
2498
|
-
@click=${()=>
|
|
2495
|
+
`}};Po=new WeakMap,Oo=new WeakMap,ud=new WeakMap,O=new WeakSet,Em=function(){this._slotted=Bt(this)},md=function(e,t){return`${t}:${km(e)}`},Mm=function(e,t){Ei(this,t)||e.preventDefault()},Pg=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},Og=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let i=s(this,O,Pg).call(this),a=i.indexOf(t),l=Number(t.dataset.index),d=se(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()},Tm=function(e,t=0){return e.flatMap(i=>[[i,t],...s(this,O,Tm).call(this,i.items??[],t+1)])},_m=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},qg=function(e){let t=this.navItems[e];s(this,O,_m).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},zm=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},Cm=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}`},pd=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},Lm=function(e,t,i={}){let a=c`${s(this,O,zm).call(this,e)}${s(this,O,Cm).call(this,e)}`;return s(this,O,pd).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
2496
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,O,Mm).call(this,l,e)}>${a}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
2497
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,O,Mm).call(this,l,e)}>${a}</button>`)},Bg=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,O,pd).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
2498
|
+
@click=${()=>s(this,O,_m).call(this,!this.collapsed)}>${t}</button>`)}</div>`},ra.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},ra.styles=[k,y`
|
|
2499
2499
|
:host { display: block; width: var(--cm-side-navigation-width, 250px); }
|
|
2500
2500
|
nav {
|
|
2501
2501
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: var(--cm-radius-lg);
|
|
@@ -2538,7 +2538,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2538
2538
|
background: var(--cm-nav-badge); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
2539
2539
|
}
|
|
2540
2540
|
.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); }
|
|
2541
|
-
`];w("cm-side-navigation",ra);var Sm=0,Fg="";function Am(){Sm++===0&&(Fg=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function qo(){Sm>0&&--Sm===0&&(document.documentElement.style.overflow=Fg)}function Nm(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var sa,Ft,aa,Bo,Dm,gd,fd,bd,vd,yd,oe=class extends T{constructor(){super(...arguments);p(this,Bo);this.open=!1;this.label="";this.uid=D("cm-ovl");p(this,sa,null);p(this,Ft,!1);p(this,aa,!1);p(this,gd,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});p(this,fd,e=>{e.preventDefault(),this.requestClose("escape")});p(this,bd,()=>{this.open&&!this.dialog?.open&&(this.open=!1,
|
|
2541
|
+
`];w("cm-side-navigation",ra);var Sm=0,Fg="";function Am(){Sm++===0&&(Fg=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function qo(){Sm>0&&--Sm===0&&(document.documentElement.style.overflow=Fg)}function Nm(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var sa,Ft,aa,Bo,Dm,gd,fd,bd,vd,yd,oe=class extends T{constructor(){super(...arguments);p(this,Bo);this.open=!1;this.label="";this.uid=D("cm-ovl");p(this,sa,null);p(this,Ft,!1);p(this,aa,!1);p(this,gd,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});p(this,fd,e=>{e.preventDefault(),this.requestClose("escape")});p(this,bd,()=>{this.open&&!this.dialog?.open&&(this.open=!1,s(this,Bo,Dm).call(this))});p(this,vd,e=>{f(this,aa,e.target===e.currentTarget)});p(this,yd,e=>{if(e.target===e.currentTarget&&r(this,aa)){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")}f(this,aa,!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}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(f(this,sa,Nm()),!this.isConnected)return;t.showModal(),r(this,Ft)||(Am(),f(this,Ft,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),s(this,Bo,Dm).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,Ft)&&(qo(),f(this,Ft,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
2542
2542
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
2543
2543
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
2544
2544
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
@@ -2578,7 +2578,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2578
2578
|
|
|
2579
2579
|
}
|
|
2580
2580
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
2581
|
-
`];function jg(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 na=class extends C{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=jg(this.name),t=this.decorative||!this.name?h:this.name,i=this.decorative||!this.name?"true":h,
|
|
2581
|
+
`];function jg(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 na=class extends C{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=jg(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>`}};na.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},na.styles=[k,y`
|
|
2582
2582
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
2583
2583
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
2584
2584
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -2591,21 +2591,21 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2591
2591
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
2592
2592
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
2593
2593
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
2594
|
-
`];w("cm-avatar",na);var I$=_("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),ca,jt,da,xe,Fo,Rm,oa,la=class extends T{constructor(){super();p(this,xe);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;p(this,ca);p(this,jt,!1);p(this,da,null);this.addEventListener("cm-select",e=>{let t=
|
|
2594
|
+
`];w("cm-avatar",na);var I$=_("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),ca,jt,da,xe,Fo,Rm,oa,la=class extends T{constructor(){super();p(this,xe);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;p(this,ca);p(this,jt,!1);p(this,da,null);this.addEventListener("cm-select",e=>{let t=s(this,xe,Fo).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){s(this,xe,Fo).call(this)?.focus();return}this._searchOpen||(f(this,da,Nm()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),f(this,ca,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,ca).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,ca)?.disconnect(),r(this,jt)&&(qo(),f(this,jt,!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,jt)||(Am(),f(this,jt,!0)),s(this,xe,Fo).call(this)?.focus(),s(this,xe,oa).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,jt)&&(qo(),f(this,jt,!1));let i=r(this,da)??this.renderRoot.querySelector(".search-btn");f(this,da,null),i?.isConnected&&i.focus(),s(this,xe,oa).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
2595
2595
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
2596
2596
|
<div class="logo"><slot name="logo"></slot></div>
|
|
2597
2597
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
2598
|
-
@click=${()=>
|
|
2599
|
-
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${
|
|
2598
|
+
@click=${()=>s(this,xe,oa).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="16"></cm-icon></button>`:h}
|
|
2599
|
+
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,xe,Rm)}></slot></div>`}
|
|
2600
2600
|
<span class="grow"></span>
|
|
2601
2601
|
<div class="end">
|
|
2602
2602
|
${this._narrow&&this._hasSearch?c`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
2603
2603
|
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:h}
|
|
2604
2604
|
<div class="actions"><slot name="actions"></slot></div>
|
|
2605
2605
|
${this.balance?c`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
2606
|
-
@click=${()=>
|
|
2606
|
+
@click=${()=>s(this,xe,oa).call(this,"cm-wallet")}>${this.balance}</button>`:h}
|
|
2607
2607
|
${this.userName?c`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
2608
|
-
@click=${()=>
|
|
2608
|
+
@click=${()=>s(this,xe,oa).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
2609
2609
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:h}
|
|
2610
2610
|
<slot name="end"></slot>
|
|
2611
2611
|
</div>
|
|
@@ -2614,11 +2614,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2614
2614
|
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
2615
2615
|
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
2616
2616
|
<div class="layer-bar">
|
|
2617
|
-
<div class="layer-search"><slot name="search" @slotchange=${
|
|
2617
|
+
<div class="layer-search"><slot name="search" @slotchange=${s(this,xe,Rm)}></slot></div>
|
|
2618
2618
|
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
2619
2619
|
</div>
|
|
2620
2620
|
</dialog>`:h}
|
|
2621
|
-
`}};ca=new WeakMap,jt=new WeakMap,da=new WeakMap,xe=new WeakSet,Fo=function(){return this.querySelector(':scope > [slot="search"]')},Rm=function(){this._hasSearch=!!
|
|
2621
|
+
`}};ca=new WeakMap,jt=new WeakMap,da=new WeakMap,xe=new WeakSet,Fo=function(){return this.querySelector(':scope > [slot="search"]')},Rm=function(){this._hasSearch=!!s(this,xe,Fo).call(this)},oa=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},la.properties={store:{},balance:{},userName:{attribute:"user-name"},avatarSrc:{attribute:"avatar-src"},label:{string:"label"},searchLabel:{attribute:"search-label",string:"search"},_narrow:{state:!0},_hasSearch:{state:!0},_searchOpen:{state:!0}},la.styles=[k,y`
|
|
2622
2622
|
:host {
|
|
2623
2623
|
display: block; background: var(--cm-bg-surface); container-type: inline-size;
|
|
2624
2624
|
--_h: var(--cm-control-height-md); --_touch: var(--cm-control-height-touch);
|
|
@@ -2695,10 +2695,10 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2695
2695
|
@media (pointer: coarse) {
|
|
2696
2696
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
2697
2697
|
}
|
|
2698
|
-
`];w("cm-header-bar",la);var U$=_("bottomNavigation",{label:"Main"}),jo,lr,Hm,Vg,ha=class extends T{constructor(){super(...arguments);p(this,lr);this.items=[];this.fixed=!1;this._slotted=[];p(this,jo)}connectedCallback(){super.connectedCallback(),
|
|
2699
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${
|
|
2698
|
+
`];w("cm-header-bar",la);var U$=_("bottomNavigation",{label:"Main"}),jo,lr,Hm,Vg,ha=class extends T{constructor(){super(...arguments);p(this,lr);this.items=[];this.fixed=!1;this._slotted=[];p(this,jo)}connectedCallback(){super.connectedCallback(),s(this,lr,Hm).call(this),f(this,jo,ki(this,()=>s(this,lr,Hm).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,jo)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
2699
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,lr,Vg).call(this,e)}</li>`)}</ul>
|
|
2700
2700
|
<slot hidden></slot>
|
|
2701
|
-
</nav>`}};jo=new WeakMap,lr=new WeakSet,Hm=function(){this._slotted=Bt(this)},Vg=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>`,
|
|
2701
|
+
</nav>`}};jo=new WeakMap,lr=new WeakSet,Hm=function(){this._slotted=Bt(this)},Vg=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=>{Ei(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>`},ha.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},ha.styles=[k,y`
|
|
2702
2702
|
:host { display: block; }
|
|
2703
2703
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
2704
2704
|
nav {
|
|
@@ -2720,27 +2720,27 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2720
2720
|
.icon { display: grid; place-items: center; width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
2721
2721
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
2722
2722
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2723
|
-
`];w("cm-bottom-navigation",ha);var Q$=_("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Vo,cr,_e,Im,Ug,Pm,Om,Kg,ma=class extends T{constructor(){super(...arguments);p(this,_e);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;p(this,Vo);p(this,cr,D("cm-mmenu"))}connectedCallback(){super.connectedCallback(),
|
|
2723
|
+
`];w("cm-bottom-navigation",ha);var Q$=_("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Vo,cr,_e,Im,Ug,Pm,Om,Kg,ma=class extends T{constructor(){super(...arguments);p(this,_e);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;p(this,Vo);p(this,cr,D("cm-mmenu"))}connectedCallback(){super.connectedCallback(),s(this,_e,Im).call(this),f(this,Vo,ki(this,()=>s(this,_e,Im).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Vo)?.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"
|
|
2724
2724
|
@keydown=${i=>{i.key==="Escape"&&(i.preventDefault(),this.back())}}>
|
|
2725
2725
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
2726
2726
|
${t.label}</button>
|
|
2727
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${
|
|
2727
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,_e,Om).call(this,i,0,0,!0)}</li>`)}</ul>
|
|
2728
2728
|
<slot hidden></slot>
|
|
2729
2729
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
2730
|
-
${
|
|
2731
|
-
${e.map((i,
|
|
2730
|
+
${s(this,_e,Kg).call(this)}
|
|
2731
|
+
${e.map((i,a)=>{let l=`${r(this,cr)}-s${a}`;return c`<section aria-labelledby=${i.label?l:h}>
|
|
2732
2732
|
${i.label?c`<h2 class="heading" id=${l}>${i.label}</h2>`:h}
|
|
2733
|
-
<ul class="card">${(i.items??[]).map((d,m)=>c`<li>${
|
|
2733
|
+
<ul class="card">${(i.items??[]).map((d,m)=>c`<li>${s(this,_e,Om).call(this,d,a,m)}</li>`)}</ul>
|
|
2734
2734
|
</section>`})}
|
|
2735
2735
|
<slot hidden></slot>
|
|
2736
|
-
</nav>`}};Vo=new WeakMap,cr=new WeakMap,_e=new WeakSet,Im=function(){this._slotted=Bt(this)},Ug=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},Pm=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Om=function(e,t,i,
|
|
2737
|
-
@click=${()=>
|
|
2736
|
+
</nav>`}};Vo=new WeakMap,cr=new WeakMap,_e=new WeakSet,Im=function(){this._slotted=Bt(this)},Ug=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},Pm=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Om=function(e,t,i,a=!1){let l=v=>{Ei(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}"
|
|
2737
|
+
@click=${()=>s(this,_e,Ug).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>`},Kg=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">
|
|
2738
2738
|
<h2 class="heading" id="${r(this,cr)}-profile">${this.t("profile")}</h2>
|
|
2739
2739
|
<ul class="card">
|
|
2740
|
-
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>
|
|
2740
|
+
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,_e,Pm).call(this,"cm-store-switch")}>
|
|
2741
2741
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
2742
2742
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
2743
|
-
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>
|
|
2743
|
+
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,_e,Pm).call(this,"cm-account")}>
|
|
2744
2744
|
<span class="avatar">${this.avatarSrc?c`<img src=${this.avatarSrc} alt="">`:c`<span aria-hidden="true">${e}</span>`}</span>
|
|
2745
2745
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?c`<span class="email">${this.userEmail}</span>`:h}</span>
|
|
2746
2746
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
@@ -2785,7 +2785,7 @@ ${t.label}</button>
|
|
|
2785
2785
|
`];w("cm-mobile-menu",ma);var n1=_("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),xd,Wg,pa=class extends T{constructor(){super(...arguments);p(this,xd);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
2786
2786
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
2787
2787
|
<span class="text"><slot></slot></span>
|
|
2788
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${
|
|
2788
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,xd,Wg)}><cm-icon name="close" size="16"></cm-icon>
|
|
2789
2789
|
</button>`:h}
|
|
2790
2790
|
</div>`}};xd=new WeakSet,Wg=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},pa.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},pa.styles=[k,y`
|
|
2791
2791
|
:host { display: block; }
|
|
@@ -2809,9 +2809,9 @@ ${t.label}</button>
|
|
|
2809
2809
|
@media (max-width: 640px) {
|
|
2810
2810
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
2811
2811
|
}
|
|
2812
|
-
`];w("cm-flash-offer-bar",pa);var u1=_("linkTabs",{label:"Sections"}),Uo,Ko,qm,ua=class extends T{constructor(){super(...arguments);p(this,Ko);this.items=[];this._slotted=[];p(this,Uo)}connectedCallback(){super.connectedCallback(),
|
|
2812
|
+
`];w("cm-flash-offer-bar",pa);var u1=_("linkTabs",{label:"Sections"}),Uo,Ko,qm,ua=class extends T{constructor(){super(...arguments);p(this,Ko);this.items=[];this._slotted=[];p(this,Uo)}connectedCallback(){super.connectedCallback(),s(this,Ko,qm).call(this),f(this,Uo,ki(this,()=>s(this,Ko,qm).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Uo)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
2813
2813
|
<ul part="tabs">${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
2814
|
-
@click=${t=>{
|
|
2814
|
+
@click=${t=>{Ei(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
2815
2815
|
<slot hidden></slot>
|
|
2816
2816
|
</nav>`}};Uo=new WeakMap,Ko=new WeakSet,qm=function(){this._slotted=Bt(this)},ua.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0}},ua.styles=[k,y`
|
|
2817
2817
|
:host { display: block; }
|
|
@@ -2832,13 +2832,13 @@ ${t.label}</button>
|
|
|
2832
2832
|
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
2833
2833
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
2834
2834
|
|
|
2835
|
-
`];w("cm-link-tabs",ua);var w1=_("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}"}),ga=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}):"",
|
|
2835
|
+
`];w("cm-link-tabs",ua);var w1=_("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}"}),ga=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">
|
|
2836
2836
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
2837
2837
|
<div class="status"><slot name="status"></slot></div>
|
|
2838
2838
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
2839
2839
|
${this.developer?c`<p class="by">${this.t("developer",{developer:this.developer})}</p>`:h}
|
|
2840
2840
|
${t?c`<p class="rating"><cm-icon class="star" name="star" size="12"></cm-icon>
|
|
2841
|
-
<span aria-hidden="true">${
|
|
2841
|
+
<span aria-hidden="true">${a}</span><span class="sr">${this.t("rating",{rating:a})}</span>
|
|
2842
2842
|
${i?this.reviewsHref?c`<a href=${this.reviewsHref}>${i}</a>`:c`<span>${i}</span>`:h}</p>`:h}
|
|
2843
2843
|
${this.pricing?c`<p class="pricing">${this.pricing}</p>`:h}
|
|
2844
2844
|
${this.offer?c`<p class="offer"><cm-icon name="percent" size="12"></cm-icon><span><span class="sr">${this.t("offer")}</span>${this.offer}</span></p>`:h}
|
|
@@ -2884,14 +2884,14 @@ ${t.label}</button>
|
|
|
2884
2884
|
`];w("cm-app-card",ga);var wd,Yg,fa=class extends oe{constructor(){super(...arguments);p(this,wd);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">
|
|
2885
2885
|
${this.renderHeader()}
|
|
2886
2886
|
<div class="body" part="body"><slot></slot></div>
|
|
2887
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${
|
|
2887
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,wd,Yg)}></slot></footer>
|
|
2888
2888
|
</div>`)}};wd=new WeakSet,Yg=function(e){this._hasFooter=e.target.assignedElements().length>0},fa.properties={...oe.properties,size:{reflect:!0},_hasFooter:{state:!0}},fa.styles=[...oe.overlayStyles,y`
|
|
2889
2889
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
2890
2890
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
2891
2891
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
2892
2892
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
2893
2893
|
|
|
2894
|
-
`];w("cm-modal",fa);var $d,Gg,wt=class extends oe{constructor(){super(...arguments);p(this,$d);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=${
|
|
2894
|
+
`];w("cm-modal",fa);var $d,Gg,wt=class extends oe{constructor(){super(...arguments);p(this,$d);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,$d,Gg)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
2895
2895
|
${this.renderHeader()}
|
|
2896
2896
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
2897
2897
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
@@ -2913,7 +2913,7 @@ ${t.label}</button>
|
|
|
2913
2913
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
2914
2914
|
|
|
2915
2915
|
}
|
|
2916
|
-
`];w("cm-side-panel",wt);var I1=_("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),va,kd,ba=class extends wt{constructor(){super(...arguments);this.search=!1;this.query="";p(this,va,()=>{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,kd,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(
|
|
2916
|
+
`];w("cm-side-panel",wt);var I1=_("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),va,kd,ba=class extends wt{constructor(){super(...arguments);this.search=!1;this.query="";p(this,va,()=>{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,kd,()=>{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}
|
|
2917
2917
|
placeholder=${this.searchPlaceholder}
|
|
2918
2918
|
@input=${e=>{this.query=e.target.value}}
|
|
2919
2919
|
@cm-search=${e=>{e.stopPropagation(),r(this,va).call(this)}}></cm-search>`:h}
|
|
@@ -2927,12 +2927,12 @@ ${t.label}</button>
|
|
|
2927
2927
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
2928
2928
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
2929
2929
|
<div class="content">
|
|
2930
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${
|
|
2930
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,dr,Xg).call(this,i)}</li>`)}</ul>`:h}
|
|
2931
2931
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
2932
2932
|
</div>
|
|
2933
2933
|
</div>`)}};Wo=new WeakMap,dr=new WeakSet,Bm=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")},Xg=function(e){let t=`row${e.critical?" critical":""}`,i=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
2934
|
-
`: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=${s
|
|
2935
|
-
@click=${s
|
|
2934
|
+
`: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,dr,Bm).call(this,a,e)}>${i}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
2935
|
+
@click=${a=>s(this,dr,Bm).call(this,a,e)}>${i}</button>`},ya.properties={...oe.properties,items:{type:Array},_slotted:{state:!0}},ya.styles=[...oe.overlayStyles,y`
|
|
2936
2936
|
dialog {
|
|
2937
2937
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: var(--cm-space-24);
|
|
2938
2938
|
}
|
|
@@ -2966,17 +2966,17 @@ ${t.label}</button>
|
|
|
2966
2966
|
}
|
|
2967
2967
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
2968
2968
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
2969
|
-
`];w("cm-bottom-sheet",ya);var X1=_("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),rb={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},xa=class extends C{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};xa.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},xa.styles=y`:host { display: none; }`;w("cm-notification-item",xa);var $a,Ae,Fm,jm,Jg,Zg,Qg,wa=class extends oe{constructor(){super(...arguments);p(this,Ae);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;p(this,$a)}connectedCallback(){super.connectedCallback(),
|
|
2970
|
-
<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(
|
|
2969
|
+
`];w("cm-bottom-sheet",ya);var X1=_("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),rb={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},xa=class extends C{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};xa.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},xa.styles=y`:host { display: none; }`;w("cm-notification-item",xa);var $a,Ae,Fm,jm,Jg,Zg,Qg,wa=class extends oe{constructor(){super(...arguments);p(this,Ae);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;p(this,$a)}connectedCallback(){super.connectedCallback(),s(this,Ae,Fm).call(this),f(this,$a,new MutationObserver(()=>s(this,Ae,Fm).call(this))),r(this,$a).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,$a)?.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,Ae,Zg)}>${this.markAllLabel}</button>`:h,i=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
2970
|
+
<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,Ae,Jg).call(this,a)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
2971
2971
|
${this.renderHeader(t)}
|
|
2972
2972
|
${i}
|
|
2973
2973
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
2974
2974
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
2975
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${
|
|
2975
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,Ae,Qg)}></slot></div>
|
|
2976
2976
|
<slot hidden></slot>
|
|
2977
|
-
</div>`)}};$a=new WeakMap,Ae=new WeakSet,Fm=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")}})},jm=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")},Jg=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,
|
|
2977
|
+
</div>`)}};$a=new WeakMap,Ae=new WeakSet,Fm=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")}})},jm=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")},Jg=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||rb[t]||"bell"} size="14"></cm-icon></span>
|
|
2978
2978
|
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${i}</span>
|
|
2979
|
-
${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=>
|
|
2979
|
+
${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,Ae,jm).call(this,d,e)}>${a}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>s(this,Ae,jm).call(this,d,e)}>${a}</button>`},Zg=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()},Qg=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},wa.properties={...oe.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}},wa.styles=[...oe.overlayStyles,y`
|
|
2980
2980
|
dialog {
|
|
2981
2981
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
2982
2982
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3026,10 +3026,10 @@ ${t.label}</button>
|
|
|
3026
3026
|
@media (max-width: 599px) {
|
|
3027
3027
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3028
3028
|
}
|
|
3029
|
-
`];w("cm-notification-panel",wa);var rk=_("toastRegion",{label:"Notifications"}),sb=2e3,ef=1e4,tf=150,Yo,ht,Vt,Go,Ta,_a,ze,rf,ka,Vm,Xo,Jo,Zo,Qo,sf,Ea=class extends T{constructor(){super(...arguments);p(this,ze);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;p(this,Yo);p(this,ht);p(this,Vt,0);p(this,Go,0);p(this,Ta,!1);p(this,_a,!1);p(this,Xo,()=>{f(this,Ta,!0),
|
|
3029
|
+
`];w("cm-notification-panel",wa);var rk=_("toastRegion",{label:"Notifications"}),sb=2e3,ef=1e4,tf=150,Yo,ht,Vt,Go,Ta,_a,ze,rf,ka,Vm,Xo,Jo,Zo,Qo,sf,Ea=class extends T{constructor(){super(...arguments);p(this,ze);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;p(this,Yo);p(this,ht);p(this,Vt,0);p(this,Go,0);p(this,Ta,!1);p(this,_a,!1);p(this,Xo,()=>{f(this,Ta,!0),s(this,ze,Vm).call(this)});p(this,Jo,()=>{f(this,Ta,!1),s(this,ze,ka).call(this)});p(this,Zo,()=>{f(this,_a,!0),s(this,ze,Vm).call(this)});p(this,Qo,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(f(this,_a,!1),s(this,ze,ka).call(this))})}get effectiveDuration(){let e=this.duration??(this.actionLabel?ef:5e3);return Math.min(ef,Math.max(sb,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&f(this,Yo,setTimeout(()=>{this._primed=!0},tf)),this.addEventListener("pointerenter",r(this,Xo)),this.addEventListener("pointerleave",r(this,Jo)),this.addEventListener("focusin",r(this,Zo)),this.addEventListener("focusout",r(this,Qo))}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(r(this,ht)),clearTimeout(r(this,Yo)),this.removeEventListener("pointerenter",r(this,Xo)),this.removeEventListener("pointerleave",r(this,Jo)),this.removeEventListener("focusin",r(this,Zo)),this.removeEventListener("focusout",r(this,Qo))}updated(e){(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,ht)),this.open&&(this._inRegion||this._primed)&&(f(this,Vt,this.effectiveDuration),s(this,ze,ka).call(this)))}show(){this.open?(f(this,Vt,this.effectiveDuration),s(this,ze,ka).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,ht)),this.open=!1,!0):(e==="timeout"&&(f(this,Vt,this.effectiveDuration),s(this,ze,ka).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3030
3030
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3031
3031
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3032
|
-
${this.actionLabel?c`<button class="action" part="action" @click=${
|
|
3032
|
+
${this.actionLabel?c`<button class="action" part="action" @click=${s(this,ze,sf)}>${this.actionLabel}</button>`:h}
|
|
3033
3033
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3034
3034
|
<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>
|
|
3035
3035
|
</button>
|
|
@@ -3064,7 +3064,7 @@ ${t.label}</button>
|
|
|
3064
3064
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
3065
3065
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
3066
3066
|
}
|
|
3067
|
-
`];w("cm-toast-region",Ma);function ab(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
|
|
3067
|
+
`];w("cm-toast-region",Ma);function ab(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),tf),a}return t.add(a)}var dk=_("progressBar",{inProgress:"In progress"}),Ed,za=class extends T{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";p(this,Ed,D("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,Ed)}-label`;return c`
|
|
3068
3068
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
3069
3069
|
<span id=${t} part="label">${this.label}</span>
|
|
3070
3070
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -3104,9 +3104,9 @@ ${t.label}</button>
|
|
|
3104
3104
|
: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); }
|
|
3105
3105
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
3106
3106
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
3107
|
-
`];w("cm-badge",Ca);var Sa,Da,Aa,af,nf,La=class extends C{constructor(){super(...arguments);p(this,Aa);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;p(this,Sa,!1);p(this,Da,!1)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${this.heading}</span><span class="adornment" ?hidden=${!r(this,Sa)}><slot name="title-adornment" @slotchange=${
|
|
3107
|
+
`];w("cm-badge",Ca);var Sa,Da,Aa,af,nf,La=class extends C{constructor(){super(...arguments);p(this,Aa);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;p(this,Sa,!1);p(this,Da,!1)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${this.heading}</span><span class="adornment" ?hidden=${!r(this,Sa)}><slot name="title-adornment" @slotchange=${s(this,Aa,af)}></slot></span></div>`:h;return c`<section part="card" aria-label=${this.heading||h}>
|
|
3108
3108
|
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${t}${this.description?c`<p class="desc">${this.description}</p>`:h}</div>
|
|
3109
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,Da)}><div class="actions"><slot name="actions" @slotchange=${
|
|
3109
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,Da)}><div class="actions"><slot name="actions" @slotchange=${s(this,Aa,nf)}></slot></div></div>`}
|
|
3110
3110
|
<slot></slot>
|
|
3111
3111
|
</section>`}};Sa=new WeakMap,Da=new WeakMap,Aa=new WeakSet,af=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,Sa)&&(f(this,Sa,t),this.requestUpdate())},nf=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,Da)&&(f(this,Da,t),this.requestUpdate())},La.properties={heading:{},description:{},flush:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},La.styles=[k,y`
|
|
3112
3112
|
:host { display: block; }
|
|
@@ -3158,7 +3158,7 @@ ${t.label}</button>
|
|
|
3158
3158
|
:host([justify='center']) { justify-content: center; }
|
|
3159
3159
|
:host([justify='end']) { justify-content: flex-end; }
|
|
3160
3160
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
3161
|
-
`,Na("gap","gap")];w("cm-stack",Ra);var of="important",lb=" !"+of,lf=br(class extends Ut{constructor(o){if(super(o),o.type!==st.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
|
|
3161
|
+
`,Na("gap","gap")];w("cm-stack",Ra);var of="important",lb=" !"+of,lf=br(class extends Ut{constructor(o){if(super(o),o.type!==st.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(lb);t.includes("-")||a?e.setProperty(t,a?i.slice(0,-11):i,a?of:""):e[t]=i}}return fe}});var Ha=class extends C{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=${lf({gridTemplateColumns:i})}><slot></slot></div>`}};Ha.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},Ha.styles=[k,y`
|
|
3162
3162
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
3163
3163
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
3164
3164
|
@container cm-grid (max-width: 640px) {
|
|
@@ -3180,7 +3180,7 @@ ${t.label}</button>
|
|
|
3180
3180
|
}
|
|
3181
3181
|
`,Na("gap","--_gap")];var Pa=class extends C{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};Pa.properties={variant:{reflect:!0}},Pa.styles=[k,y`
|
|
3182
3182
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
3183
|
-
`];w("cm-layout",Ia);w("cm-layout-section",Pa);var Um=1024,cb=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},mr,qa,Ne,Km,hr,cf,il,rl,Oa=class extends C{constructor(){super(...arguments);p(this,Ne);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;p(this,mr);p(this,qa,null);p(this,il,e=>{if(!this.menuItem)return;let t=
|
|
3183
|
+
`];w("cm-layout",Ia);w("cm-layout-section",Pa);var Um=1024,cb=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},mr,qa,Ne,Km,hr,cf,il,rl,Oa=class extends C{constructor(){super(...arguments);p(this,Ne);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;p(this,mr);p(this,qa,null);p(this,il,e=>{if(!this.menuItem)return;let t=s(this,Ne,cf).call(this,e),i=e.detail?.value;t==="bottom-navigation"&&i===this.menuItem?s(this,Ne,hr).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&s(this,Ne,hr).call(this,!1,!1)});p(this,rl,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),s(this,Ne,hr).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,il)),this.addEventListener("keydown",r(this,rl));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=Um)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,il)),this.removeEventListener("keydown",r(this,rl)),r(this,mr)?.disconnect(),f(this,mr,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;f(this,mr,new ResizeObserver(()=>{s(this,Ne,Km).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=Um!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=Um}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,mr).observe(t))}updated(e){e.has("_wide")&&s(this,Ne,Km).call(this)}openMenu(){s(this,Ne,hr).call(this,!0)}closeMenu(){s(this,Ne,hr).call(this,!1)}toggleMenu(){s(this,Ne,hr).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">
|
|
3184
3184
|
<div class="probe"></div>
|
|
3185
3185
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
3186
3186
|
<div class="body">
|
|
@@ -3208,6 +3208,8 @@ ${t.label}</button>
|
|
|
3208
3208
|
box-sizing: border-box; margin: var(--_gutter); min-block-size: calc(var(--cm-app-frame-height, 100dvh) - var(--_header) - 2 * var(--_gutter));
|
|
3209
3209
|
border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-lg);
|
|
3210
3210
|
}
|
|
3211
|
+
/* Inherited, so a cm-page inside a wrapper element (not slotted directly) is transparent too. */
|
|
3212
|
+
:host([panel]) { --cm-page-background: transparent; }
|
|
3211
3213
|
:host([panel]) ::slotted(cm-page) { background: transparent; }
|
|
3212
3214
|
main:focus { outline: none; }
|
|
3213
3215
|
.bottom { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40; }
|
|
@@ -3219,7 +3221,7 @@ ${t.label}</button>
|
|
|
3219
3221
|
.probe { block-size: 0; }
|
|
3220
3222
|
[hidden] { display: none !important; }
|
|
3221
3223
|
`];w("cm-app-frame",Oa);var Ba=class extends C{constructor(){super(...arguments);this.width="";this.fullWidth=!1;this.narrow=!1}render(){return c`<slot name="header"></slot><div class="content" part="content"><slot></slot></div><slot name="footer"></slot>`}};Ba.properties={width:{reflect:!0},fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},Ba.styles=[k,y`
|
|
3222
|
-
:host { display: block; container: cm-page / inline-size; background: var(--cm-bg-page); min-block-size: 100%; }
|
|
3224
|
+
:host { display: block; container: cm-page / inline-size; background: var(--cm-page-background, var(--cm-bg-page)); min-block-size: 100%; }
|
|
3223
3225
|
.content {
|
|
3224
3226
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
3225
3227
|
padding: var(--cm-space-24);
|
|
@@ -3235,9 +3237,9 @@ ${t.label}</button>
|
|
|
3235
3237
|
<div class="body">
|
|
3236
3238
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
3237
3239
|
<div><slot></slot></div>
|
|
3238
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${
|
|
3240
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,ja,df)}></slot></div>
|
|
3239
3241
|
</div>
|
|
3240
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${
|
|
3242
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,ja,hf)}>
|
|
3241
3243
|
<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}
|
|
3242
3244
|
</div>`}};ja=new WeakSet,df=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},hf=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},Fa.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},Fa.styles=[k,y`
|
|
3243
3245
|
:host { display: block; }
|
|
@@ -3276,7 +3278,7 @@ ${t.label}</button>
|
|
|
3276
3278
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
3277
3279
|
}
|
|
3278
3280
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
3279
|
-
`];w("cm-thumbnail",Va);export{
|
|
3281
|
+
`];w("cm-thumbnail",Va);export{tr as Announcer,cs as CmAccordion,as as CmActionBar,As as CmActionMenu,ga as CmAppCard,Oa as CmAppFrame,na as CmAvatar,Ca as CmBadge,Fa as CmBanner,Bs as CmBoard,ir as CmBoardCard,rr as CmBoardColumn,ha as CmBottomNavigation,ya as CmBottomSheet,Li as CmButton,Ys as CmCalendar,Ws as CmCalendarEvent,La as CmCard,Yt as CmCheckbox,di as CmColorField,ti as CmCombobox,ps as CmComment,us as CmCommentBox,Cs as CmDataTable,ai as CmDatePicker,oi as CmDateRangePicker,ds as CmEmptyState,ci as CmFileUpload,ba as CmFilterPanel,pa as CmFlashOfferBar,Ii as CmGlobalSearch,Ha as CmGrid,la as CmHeaderBar,fr as CmIcon,ls as CmInfoItem,os as CmInfoPanel,Ia as CmLayout,Pa as CmLayoutSection,ua as CmLinkTabs,T as CmLocalizedElement,Ss as CmMenuItem,ta as CmMetric,ma as CmMobileMenu,fa as CmModal,ia as CmNavItem,Os as CmNestedItem,Ps as CmNestedList,xa as CmNotificationItem,wa as CmNotificationPanel,gt as CmOptionGroup,Ba as CmPage,ss as CmPageHeader,Es as CmPagination,za as CmProgressBar,Ai as CmRadio,Ni as CmRadioGroup,or as CmReportTile,ea as CmReportTiles,Hs as CmResourceItem,Is as CmResourceList,ns as CmSaveBar,Qt as CmSearch,rs as CmSegmentedControl,Zt as CmSelect,ra as CmSideNavigation,wt as CmSidePanel,hi as CmSignatureField,hs as CmSkeleton,ms as CmSkeletonDisplay,$s as CmSmartTip,ks as CmSmartTips,Lr as CmSpinner,Ra as CmStack,Ts as CmStatusTabs,_s as CmTableHeader,Cr as CmTag,Wt as CmTextField,Va as CmThumbnail,Yi as CmTimeline,xs as CmTimelineItem,Ea as CmToast,Ma as CmToastRegion,Xt as CmToggle,gs as CmTooltip,er as MoveModel,_f as configure,_ as defineStrings,vp as directionalIcons,ee as formatDate,gp as formatMessage,Od as formatNumber,Mf as getDefaultStrings,jg as initials,Xu as listNavigation,en as localeFor,Ht as normalizeHex,yl as pluralCategory,zf as resetStrings,Vp as resolvePreset,Tf as setStrings,ab as showToast,fp as translate};
|
|
3280
3282
|
/*! Bundled license information:
|
|
3281
3283
|
|
|
3282
3284
|
@lit/reactive-element/css-tag.js:
|