@commmerce/ui 1.13.1 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +583 -573
- package/dist/components/checkbox.d.ts +3 -0
- package/dist/components/checkbox.js +18 -7
- package/dist/components/color-field.js +8 -4
- package/dist/components/combobox.js +12 -7
- package/dist/components/date-picker.js +17 -6
- package/dist/components/date-range-picker.js +12 -6
- package/dist/components/file-upload.js +12 -9
- package/dist/components/option-group.js +13 -5
- package/dist/components/radio.js +11 -7
- package/dist/components/select.js +12 -8
- package/dist/components/signature-field.js +9 -5
- package/dist/components/text-field.d.ts +29 -0
- package/dist/components/text-field.js +46 -8
- package/dist/custom-elements.json +183 -0
- package/dist/validation.d.ts +39 -0
- package/dist/validation.js +121 -0
- package/package.json +3 -3
package/dist/cdn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(o,n,e)=>(Hm(o,n,"read from private field"),e?e.call(o):n.get(o)),m=(o,n,e)=>n.has(o)?Mg("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),g=(o,n,e,t)=>(Hm(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),s=(o,n,e)=>(Hm(o,n,"access private method"),e);var Pc=globalThis,qc=Pc.ShadowRoot&&(Pc.ShadyCSS===void 0||Pc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Nm=Symbol(),Tg=new WeakMap,uo=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==Nm)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(qc&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=Tg.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&Tg.set(e,n))}return n}toString(){return this.cssText}},Oc=o=>new uo(typeof o=="string"?o:o+"",void 0,Nm),w=(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 uo(e,o,Nm)},zg=(o,n)=>{if(qc)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=Pc.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Im=qc?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return Oc(e)})(o):o;var{is:Ey,defineProperty:My,getOwnPropertyDescriptor:Ty,getOwnPropertyNames:zy,getOwnPropertySymbols:_y,getPrototypeOf:Cy}=Object,Bc=globalThis,_g=Bc.trustedTypes,Ly=_g?_g.emptyScript:"",Sy=Bc.reactiveElementPolyfillSupport,go=(o,n)=>o,Pm={toAttribute(o,n){switch(n){case Boolean:o=o?Ly: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}},Lg=(o,n)=>!Ey(o,n),Cg={attribute:!0,type:String,converter:Pm,reflect:!1,useDefault:!1,hasChanged:Lg};Symbol.metadata??=Symbol("metadata"),Bc.litPropertyMetadata??=new WeakMap;var Ht=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=Cg){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&&My(this.prototype,n,i)}}static getPropertyDescriptor(n,e,t){let{get:i,set:a}=Ty(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)??Cg}static _$Ei(){if(this.hasOwnProperty(go("elementProperties")))return;let n=Cy(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(go("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(go("properties"))){let e=this.properties,t=[...zy(e),..._y(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(Im(i))}else n!==void 0&&e.push(Im(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 zg(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:Pm).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:Pm;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??Lg)(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){}};Ht.elementStyles=[],Ht.shadowRootOptions={mode:"open"},Ht[go("elementProperties")]=new Map,Ht[go("finalized")]=new Map,Sy?.({ReactiveElement:Ht}),(Bc.reactiveElementVersions??=[]).push("2.1.2");var Om=globalThis,Sg=o=>o,Fc=Om.trustedTypes,Dg=Fc?Fc.createPolicy("lit-html",{createHTML:o=>o}):void 0,Bm="$lit$",Nt=`lit$${Math.random().toFixed(9).slice(2)}$`,Fm="?"+Nt,Dy=`<${Fm}>`,Qi=document,bo=()=>Qi.createComment(""),vo=o=>o===null||typeof o!="object"&&typeof o!="function",jm=Array.isArray,Pg=o=>jm(o)||typeof o?.[Symbol.iterator]=="function",qm=`[
|
|
2
|
+
\f\r]`,fo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ag=/-->/g,Rg=/>/g,Ji=RegExp(`>|${qm}(?:([^\\s"'>=/]+)(${qm}*=${qm}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Hg=/'/g,Ng=/"/g,qg=/^(?:script|style|textarea|title)$/i,Vm=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=Vm(1),It=Vm(2),Px=Vm(3),ke=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Ig=new WeakMap,Zi=Qi.createTreeWalker(Qi,129);function Og(o,n){if(!jm(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dg!==void 0?Dg.createHTML(n):n}var Bg=(o,n)=>{let e=o.length-1,t=[],i,a=n===2?"<svg>":n===3?"<math>":"",l=fo;for(let d=0;d<e;d++){let p=o[d],u,b,f=-1,x=0;for(;x<p.length&&(l.lastIndex=x,b=l.exec(p),b!==null);)x=l.lastIndex,l===fo?b[1]==="!--"?l=Ag:b[1]!==void 0?l=Rg:b[2]!==void 0?(qg.test(b[2])&&(i=RegExp("</"+b[2],"g")),l=Ji):b[3]!==void 0&&(l=Ji):l===Ji?b[0]===">"?(l=i??fo,f=-1):b[1]===void 0?f=-2:(f=l.lastIndex-b[2].length,u=b[1],l=b[3]===void 0?Ji:b[3]==='"'?Ng:Hg):l===Ng||l===Hg?l=Ji:l===Ag||l===Rg?l=fo:(l=Ji,i=void 0);let y=l===Ji&&o[d+1].startsWith("/>")?" ":"";a+=l===fo?p+Dy:f>=0?(t.push(u),p.slice(0,f)+Bm+p.slice(f)+Nt+y):p+Nt+(f===-2?d:y)}return[Og(o,a+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},yo=class o{constructor({strings:n,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,d=n.length-1,p=this.parts,[u,b]=Bg(n,e);if(this.el=o.createElement(u,t),Zi.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Zi.nextNode())!==null&&p.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(Bm)){let x=b[l++],y=i.getAttribute(f).split(Nt),k=/([.?@])?(.*)/.exec(x);p.push({type:1,index:a,name:k[2],strings:y,ctor:k[1]==="."?Vc:k[1]==="?"?Uc:k[1]==="@"?Kc:tr}),i.removeAttribute(f)}else f.startsWith(Nt)&&(p.push({type:6,index:a}),i.removeAttribute(f));if(qg.test(i.tagName)){let f=i.textContent.split(Nt),x=f.length-1;if(x>0){i.textContent=Fc?Fc.emptyScript:"";for(let y=0;y<x;y++)i.append(f[y],bo()),Zi.nextNode(),p.push({type:2,index:++a});i.append(f[x],bo())}}}else if(i.nodeType===8)if(i.data===Fm)p.push({type:2,index:a});else{let f=-1;for(;(f=i.data.indexOf(Nt,f+1))!==-1;)p.push({type:7,index:a}),f+=Nt.length-1}a++}}static createElement(n,e){let t=Qi.createElement("template");return t.innerHTML=n,t}};function er(o,n,e=o,t){if(n===ke)return n;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=vo(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=er(o,i._$AS(o,n.values),i,t)),n}var jc=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??Qi).importNode(e,!0);Zi.currentNode=i;let a=Zi.nextNode(),l=0,d=0,p=t[0];for(;p!==void 0;){if(l===p.index){let u;p.type===2?u=new ga(a,a.nextSibling,this,n):p.type===1?u=new p.ctor(a,p.name,p.strings,this,n):p.type===6&&(u=new Wc(a,this,n)),this._$AV.push(u),p=t[++d]}l!==p?.index&&(a=Zi.nextNode(),l++)}return Zi.currentNode=Qi,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++}},ga=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=er(this,n,e),vo(n)?n===h||n==null||n===""?(this._$AH!==h&&this._$AR(),this._$AH=h):n!==this._$AH&&n!==ke&&this._(n):n._$litType$!==void 0?this.$(n):n.nodeType!==void 0?this.T(n):Pg(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&&vo(this._$AH)?this._$AA.nextSibling.data=n:this.T(Qi.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=yo.createElement(Og(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new jc(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(n){let e=Ig.get(n.strings);return e===void 0&&Ig.set(n.strings,e=new yo(n)),e}k(n){jm(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(bo()),this.O(bo()),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=Sg(n).nextSibling;Sg(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},tr=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=er(this,n,e,0),l=!vo(n)||n!==this._$AH&&n!==ke,l&&(this._$AH=n);else{let d=n,p,u;for(n=a[0],p=0;p<a.length-1;p++)u=er(this,d[t+p],e,p),u===ke&&(u=this._$AH[p]),l||=!vo(u)||u!==this._$AH[p],u===h?n=h:n!==h&&(n+=(u??"")+a[p+1]),this._$AH[p]=u}l&&!i&&this.j(n)}j(n){n===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}},Vc=class extends tr{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},Uc=class extends tr{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},Kc=class extends tr{constructor(n,e,t,i,a){super(n,e,t,i,a),this.type=5}_$AI(n,e=this){if((n=er(this,n,e,0)??h)===ke)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)}},Wc=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){er(this,n)}},Fg={M:Bm,P:Nt,A:Fm,C:1,L:Bg,R:jc,D:Pg,V:er,I:ga,H:tr,N:Uc,U:Kc,B:Vc,F:Wc},Ay=Om.litHtmlPolyfillSupport;Ay?.(yo,ga),(Om.litHtmlVersions??=[]).push("3.3.3");var jg=(o,n,e)=>{let t=e?.renderBefore??n,i=t._$litPart$;if(i===void 0){let a=e?.renderBefore??null;t._$litPart$=i=new ga(n.insertBefore(bo(),a),a,void 0,e??{})}return i._$AI(o),i};var Um=globalThis,L=class extends Ht{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=jg(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ke}};L._$litElement$=!0,L.finalized=!0,Um.litElementHydrateSupport?.({LitElement:L});var Ry=Um.litElementPolyfillSupport;Ry?.({LitElement:L});(Um.litElementVersions??=[]).push("4.2.2");var E=w`
|
|
4
4
|
:host {
|
|
5
5
|
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
6
|
color: var(--cm-text-default, #000);
|
|
@@ -8,20 +8,20 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,Zx=w`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
14
|
+
`,Hy=0,R=o=>`${o}-${++Hy}`;function $(o,n){customElements.get(o)||customElements.define(o,n)}function J(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Ny={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},Gc={common:{...Ny}},xo={},wo={},Yc;function z(o,n){return Gc[o]={...Gc[o],...n},n}function Iy(){return Object.fromEntries(Object.entries(Gc).map(([o,n])=>[o,{...n}]))}function Xc(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function Py(o,n){Xc(n?wo[n.toLowerCase()]??={}:xo,o),Qc()}function qy(o={}){"locale"in o&&(Yc=o.locale||void 0),o.strings&&Xc(xo,o.strings);for(let[n,e]of Object.entries(o.translations??{}))Xc(wo[n.toLowerCase()]??={},e);Qc()}function Oy(){Yc=void 0;for(let o of Object.keys(xo))delete xo[o];for(let o of Object.keys(wo))delete wo[o];Qc()}function $o(o){if(Yc)return Yc;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 Vg=new Map;function Gm(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,a=Vg.get(i);if(!a){try{a=t(n)}catch{a=t(void 0)}Vg.set(i,a)}return a}function Ym(o,n={},e){return Gm("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function ne(o,n={},e){return Gm("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function Jc(o,n){return Gm("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function Ug(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[Jc(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"?Ym(l,{},e):String(l)})}function By(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 p=wo[d]?.[a]?.[n];if(p!==void 0)return p}let l=xo[a]?.[n]??Gc[a]?.[n];if(l!==void 0)return l}}function Zc(o,n,e,t,i){let a=$o(t);return Ug(By(o,n,a,i),e,a)}var Wm=new Set,Km;function Qc(){for(let o of Wm)o.requestUpdate()}function Fy(){Km||typeof MutationObserver>"u"||typeof document>"u"||(Km=new MutationObserver(Qc),Km.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var jy=o=>o.replace(/^cm-/,"").replace(/-([a-z])/g,(n,e)=>e.toUpperCase()),T=class extends L{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 jy(this.localName)}t(n,e){return Zc(this.stringsNamespace,n,e,this,this.strings)}get locale(){return $o(this)}formatNumber(n,e){return Ym(n,e,this.locale)}connectedCallback(){super.connectedCallback(),Wm.add(this),Fy()}disconnectedCallback(){super.disconnectedCallback(),Wm.delete(this)}};T.properties={strings:{type:Object}};var ed={"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"},Kg=["more","drag"],iw=Object.keys(ed);var Wg=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],fa=class extends L{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=ed[this.name]??ed.more,t=Kg.includes(this.name)?3:1.6;return It`<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
|
-
part="svg" class=${(this.mirror==="auto"?
|
|
17
|
+
part="svg" class=${(this.mirror==="auto"?Wg.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};fa.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},fa.styles=w`
|
|
18
18
|
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
19
19
|
svg { display: block; }
|
|
20
20
|
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
21
|
-
`;$("cm-icon",
|
|
22
|
-
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${
|
|
21
|
+
`;$("cm-icon",fa);var Gg=99,hw=z("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),td,id,ko,ir=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;m(this,td,this.attachInternals());m(this,id,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,td).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});m(this,ko,!1);this.addEventListener("click",r(this,id),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,ko)&&(g(this,ko,!0),console.warn("cm-button: an icon-only button needs a `label` (its accessible name).",this))}render(){let e=Number.isFinite(this.count)&&this.count>0?Math.floor(this.count):0,t=this.loading?c`<span class="spinner" aria-hidden="true"></span>`:c`<slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:h}</slot>`,i=this.iconOnly?c`<span class="vh"><slot></slot></span>`:c`<span class="text"><slot></slot></span>`,a=e?c`<span class="count" part="count" aria-hidden="true">${e>Gg?this.t("countOverflow",{max:Gg}):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,p=c`${t}${i}${a}`;return this.href&&!this.disabled?c`<a class="btn" part="control" href=${this.href} target=${this.target??h}
|
|
22
|
+
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${p}</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}>${
|
|
24
|
+
aria-busy=${this.loading?"true":h} aria-label=${d}>${p}</button>`}};td=new WeakMap,id=new WeakMap,ko=new WeakMap,ir.formAssociated=!0,ir.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}},ir.styles=[E,w`
|
|
25
25
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
26
26
|
/* A label longer than the room (a button in a narrow card) ends with an ellipsis instead of spilling out (1.8.1). */
|
|
27
27
|
.text { min-width: 0; overflow: hidden; text-overflow: ellipsis; line-height: var(--cm-line-height-14, 20px); } /* a full line box, so overflow: hidden doesn't cut g, p and y (1.9.3) */
|
|
@@ -106,16 +106,16 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
106
106
|
position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
|
|
107
107
|
box-shadow: 0 0 0 2px var(--cm-bg-surface); pointer-events: none;
|
|
108
108
|
}
|
|
109
|
-
`];$("cm-button",
|
|
109
|
+
`];$("cm-button",ir);var ba=class extends L{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1;this.heading=!1;this.shortcut=""}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,heading:this.heading||void 0,shortcut:this.shortcut||void 0}}};ba.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0},heading:{type:Boolean,reflect:!0},shortcut:{reflect:!0}},ba.styles=w`:host { display: none; }`;$("cm-menu-item",ba);function Eo(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,heading:e.hasAttribute("heading")||void 0,shortcut:i("shortcut")})}else e.localName==="hr"&&n.push({divider:!0});return n}function rd(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var it=w`
|
|
110
110
|
:where([popover]) { margin: 0; padding: 0; border: 0; color: inherit; background: none; overflow: visible; }
|
|
111
|
-
`,
|
|
111
|
+
`,Mo=8,ut,va,ya,xa,rr,Ee=class{constructor(){m(this,ut,null);m(this,va,null);m(this,ya,{});m(this,xa,"");m(this,rr,()=>this.place())}get active(){return!!r(this,ut)}open(n,e,t={}){if(!n||!e||typeof n.showPopover!="function")return!1;r(this,ut)&&r(this,ut)!==n&&this.close(),n.hasAttribute("popover")||n.setAttribute("popover","manual");let i=n.matches(":popover-open");if(!i){if(getComputedStyle(n).position==="static")return n.removeAttribute("popover"),!1;try{n.showPopover()}catch{return!1}}return n.matches(":popover-open")?(r(this,ut)||g(this,xa,n.style.maxHeight),g(this,ut,n),g(this,va,e),g(this,ya,t),Object.assign(n.style,{position:"fixed",inset:"auto",margin:"0"}),this.place(),i||(window.addEventListener("scroll",r(this,rr),!0),window.addEventListener("resize",r(this,rr))),!0):!1}place(){let n=r(this,ut),e=r(this,va);if(!n||!e)return;let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,a=document.documentElement.clientHeight,l=r(this,ya).gap??4,d=r(this,ya).align??"start";n.style.maxHeight=r(this,xa),d==="stretch"&&(n.style.minWidth=`${Math.round(t.width)}px`);let p=n.getBoundingClientRect(),u=p.width,b=p.height,f=getComputedStyle(e).direction==="rtl",x=f?t.right-u:t.left,y=f?t.left:t.right-u,k=d==="end"?y:x;k+u>i-Mo&&(k=f?x:y);let S=Math.max(0,Math.min(Mo,t.left)),A=Math.min(i,Math.max(i-Mo,t.right))-u;k=Math.max(S,Math.min(k,A));let q=a-t.bottom-l-Mo,B=t.top-l-Mo,K;if(b<=q||q>=B)K=t.bottom+l,b>q&&(n.style.maxHeight=`${Math.max(80,Math.floor(q))}px`);else{let tt=Math.min(b,Math.floor(B));b>B&&(n.style.maxHeight=`${Math.max(80,tt)}px`),K=t.top-l-tt}n.style.left=`${k}px`,n.style.top=`${K}px`}close(){let n=r(this,ut);if(window.removeEventListener("scroll",r(this,rr),!0),window.removeEventListener("resize",r(this,rr)),g(this,ut,null),g(this,va,null),!!n){try{n.matches(":popover-open")&&n.hidePopover()}catch{}for(let e of["position","inset","margin","left","top","minWidth"])n.style[e]="";n.style.maxHeight=r(this,xa)}}};ut=new WeakMap,va=new WeakMap,ya=new WeakMap,xa=new WeakMap,rr=new WeakMap;var wa=class extends T{constructor(){super(...arguments);this.size="large";this.custom=!1}onSlotChange(e){let t=e.target.assignedElements().length>0;t!==this.custom&&(this.custom=t,this.requestUpdate())}render(){let e=this.size==="small"?2.5:3;return c`<span class="spinner" part="spinner" role="status">
|
|
112
112
|
${this.custom?h:c`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
113
113
|
<circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
|
|
114
114
|
<path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
|
|
115
115
|
</svg>`}
|
|
116
116
|
<slot @slotchange=${this.onSlotChange}></slot>
|
|
117
117
|
<span class="vh">${this.accessibleLabel||this.t("loading")}</span>
|
|
118
|
-
</span>`}};
|
|
118
|
+
</span>`}};wa.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},wa.styles=[E,w`
|
|
119
119
|
:host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
|
|
120
120
|
.spinner { display: inline-flex; align-items: center; --cm-spinner-duration: 0.8s; --cm-spinner-play-state: running; }
|
|
121
121
|
::slotted(*) { display: block; block-size: 20px; inline-size: auto; }
|
|
@@ -133,18 +133,18 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
133
133
|
svg { animation-duration: 2.4s; }
|
|
134
134
|
.spinner { --cm-spinner-play-state: paused; }
|
|
135
135
|
}
|
|
136
|
-
`];$("cm-spinner",
|
|
137
|
-
aria-expanded=${String(this.open)} aria-controls="${r(this,
|
|
138
|
-
?disabled=${this.disabled} @click=${r(this,
|
|
136
|
+
`];$("cm-spinner",wa);var Cw=z("actionMenu",{label:"Actions"}),To,ar,sr,zo,V,ad,_o,sd,nd,od,ld,Yg,ka,Ea,Ma,$a,cd,Xg,Xm,Jg,kt=class extends T{constructor(){super(...arguments);m(this,V);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this.loading=!1;this.disabled=!1;this._slotted=[];this._active=-1;this._custom=!1;m(this,To);m(this,ar,R("cm-menu"));m(this,sr,"");m(this,zo,0);m(this,_o,e=>{this.open&&!e.composedPath().includes(this)&&s(this,V,od).call(this,!1)});m(this,ka,new Ee);m(this,Ea,e=>{this.disabled||(e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0)))});m(this,Ma,()=>{this.disabled||(this.open?this.hide():this.show())});m(this,cd,e=>{let t=s(this,V,nd).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),s(this,V,$a).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),s(this,V,$a).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),s(this,V,$a).call(this,t[0]);break;case"End":e.preventDefault(),s(this,V,$a).call(this,t[t.length-1]);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.hide(!0);break;case"Tab":this.hide();break;default:if(e.key.length===1&&/\S/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let a=Date.now();g(this,sr,(a-r(this,zo)<600?r(this,sr):"")+e.key.toLowerCase()),g(this,zo,a);let l=this.menuItems,d=r(this,sr).length>1?i:i+1,u=[...t.slice(Math.max(d,0)),...t.slice(0,Math.max(d,0))].find(b=>(l[b].label??"").toLowerCase().startsWith(r(this,sr)));u!==void 0&&s(this,V,$a).call(this,u)}}})}connectedCallback(){super.connectedCallback(),s(this,V,ad).call(this),g(this,To,rd(this,()=>s(this,V,ad).call(this))),document.addEventListener("pointerdown",r(this,_o),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,To)?.disconnect(),document.removeEventListener("pointerdown",r(this,_o),!0),r(this,ka).close()}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=s(this,V,nd).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,s(this,V,od).call(this,!0),this.updateComplete.then(()=>s(this,V,ld).call(this))}hide(e=!1){s(this,V,od).call(this,!1),e&&s(this,V,sd).call(this)?.focus()}updated(e){if(e.has("open")&&this.open&&s(this,V,Yg).call(this),e.has("open")&&!this.open&&r(this,ka).close(),this._custom){let t=s(this,V,sd).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,ar)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=s(this,V,nd).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>s(this,V,ld).call(this))}}triggerTemplate(e,t){}headTemplate(){}render(){let e=this.menuItems,t=this.triggerLabel||this.label,i=this._custom?c`<slot name="trigger" @click=${r(this,Ma)} @keydown=${r(this,Ea)} @slotchange=${()=>s(this,V,ad).call(this)}></slot>`:this.triggerTemplate(r(this,Ma),r(this,Ea))??c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
137
|
+
aria-expanded=${String(this.open)} aria-controls="${r(this,ar)}-m" aria-label=${this.iconOnly?t:h}
|
|
138
|
+
?disabled=${this.disabled} @click=${r(this,Ma)} @keydown=${r(this,Ea)}>${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}
|
|
139
139
|
<div class="pop" part="menu" popover="manual" ?hidden=${!this.open}>
|
|
140
140
|
${this.headTemplate()??(this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h)}
|
|
141
|
-
<div role="menu" id="${r(this,
|
|
142
|
-
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:s(this,
|
|
141
|
+
<div role="menu" id="${r(this,ar)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${r(this,cd)}>
|
|
142
|
+
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:s(this,V,Jg).call(this,e)}
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
|
-
<slot hidden></slot>`}};
|
|
145
|
+
<slot hidden></slot>`}};To=new WeakMap,ar=new WeakMap,sr=new WeakMap,zo=new WeakMap,V=new WeakSet,ad=function(){this._slotted=Eo(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},_o=new WeakMap,sd=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},nd=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},od=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})))},ld=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},Yg=function(){let e=this.renderRoot.querySelector(".pop");if(!e||r(this,ka).open(e,s(this,V,sd).call(this)??this,{align:this.align==="end"?"end":"start"}))return;e.classList.remove("to-end","to-start");let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,a=8,l=getComputedStyle(this).direction==="rtl",d=l?t.left<a:t.right>i-a,p=l?t.right>i-a:t.left<a;this.align!=="end"&&d?e.classList.add("to-end"):this.align==="end"&&p&&e.classList.add("to-start")},ka=new WeakMap,Ea=new WeakMap,Ma=new WeakMap,$a=function(e){this._active=e,this.updateComplete.then(()=>s(this,V,ld).call(this))},cd=new WeakMap,Xg=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)},Xm=function(e,t){if(e.divider)return c`<div role="separator"></div>`;let i=`item${e.critical?" critical":""}${t===this._active?" active":""}`,a=c`${e.icon?c`<cm-icon name=${e.icon} size="16"></cm-icon>`:h}<span class="label">${e.label}</span>${e.shortcut?c`<span class="shortcut" part="shortcut" aria-hidden="true">${e.shortcut}</span>`:h}`,l={over:()=>{e.disabled||(this._active=t)},click:d=>s(this,V,Xg).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}
|
|
146
146
|
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</a>`:c`<button type="button" class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
147
|
-
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},
|
|
147
|
+
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},Jg=function(e){let t=[];for(let i=0;i<e.length;i++){let a=e[i];if(!a.heading){t.push(s(this,V,Xm).call(this,a,i));continue}let l=`${r(this,ar)}-h${i}`,d=[],p=i+1;for(;p<e.length&&!e[p].heading&&!e[p].divider;p++)d.push(s(this,V,Xm).call(this,e[p],p));t.push(c`<div role="group" aria-labelledby=${l}><div class="section" part="section" id=${l} role="presentation">${a.label}</div>${d}</div>`),i=p-1}return t},kt.properties={items:{type:Array},open:{type:Boolean,reflect:!0},label:{string:"label"},triggerLabel:{attribute:"trigger-label"},iconOnly:{type:Boolean,attribute:"icon-only"},icon:{},align:{reflect:!0},heading:{},subheading:{},density:{reflect:!0},loading:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},kt.styles=[E,w`
|
|
148
148
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
149
149
|
.trigger {
|
|
150
150
|
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;
|
|
@@ -207,12 +207,12 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
207
207
|
}
|
|
208
208
|
.loading { display: flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: var(--cm-space-4) var(--cm-space-12); font-size: var(--cm-font-size-14); color: var(--cm-text-tertiary); }
|
|
209
209
|
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
210
|
-
`];$("cm-action-menu",
|
|
210
|
+
`];$("cm-action-menu",kt);var Hw=z("buttonGroup",{more:"More"}),mi="data-cm-overflow",Vy=["disabled","loading","tone","icon","label","variant","size","icon-only","count","href","hidden","data-priority"],pi,nr,Pt,Et,ui,or,U,Ta,Zg,Co,Jm,dd,hd,Qg,md,Zm,Qm,ep,za=class extends T{constructor(){super(...arguments);m(this,U);this.overflow="wrap";this.align="start";this.label="";this._items=[];this._size="medium";m(this,pi,[]);m(this,nr);m(this,Pt);m(this,Et,0);m(this,ui,new Set);m(this,or,!1);m(this,md,e=>{e.stopPropagation();let t=r(this,pi)[Number(e.detail.value)];if(!t)return;g(this,or,!0),(t.shadowRoot?.querySelector('[part="control"]')??t).click(),requestAnimationFrame(()=>requestAnimationFrame(()=>s(this,U,Zm).call(this)))})}get overflowing(){return[...r(this,pi)]}connectedCallback(){super.connectedCallback(),g(this,nr,new MutationObserver(e=>s(this,U,Zg).call(this,e))),r(this,nr).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:Vy}),typeof ResizeObserver<"u"&&(g(this,Pt,new ResizeObserver(()=>s(this,U,Ta).call(this))),r(this,Pt).observe(this),g(this,ui,new Set([this]))),document.fonts?.ready.then(()=>s(this,U,Ta).call(this)),s(this,U,Ta).call(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,nr)?.disconnect(),r(this,Pt)?.disconnect(),r(this,ui).clear(),cancelAnimationFrame(r(this,Et)),g(this,Et,0),s(this,U,Jm).call(this,s(this,U,Co).call(this))}updated(e){(e.has("overflow")||e.has("moreLabel")||e.has("moreIcon")||e.has("size"))&&s(this,U,Ta).call(this)}firstUpdated(){this.updateComplete.then(()=>this.relayout())}relayout(){cancelAnimationFrame(r(this,Et)),g(this,Et,0),s(this,U,hd).call(this)}render(){let e=this.moreIcon!=null;return c`<div class="row" part="row" role="group" aria-label=${this.label||h}>
|
|
211
211
|
<slot></slot>
|
|
212
212
|
<cm-action-menu class="more ${this._size}${e?" icon":""}" part="more" hidden align="end"
|
|
213
213
|
.items=${this._items} label=${this.moreLabel} ?icon-only=${e} icon=${this.moreIcon||"more"}
|
|
214
|
-
@cm-select=${r(this,
|
|
215
|
-
</div>`}};
|
|
214
|
+
@cm-select=${r(this,md)}></cm-action-menu>
|
|
215
|
+
</div>`}};pi=new WeakMap,nr=new WeakMap,Pt=new WeakMap,Et=new WeakMap,ui=new WeakMap,or=new WeakMap,U=new WeakSet,Ta=function(){r(this,Et)||!this.isConnected||g(this,Et,requestAnimationFrame(()=>{g(this,Et,0);let e=s(this,U,Co).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>s(this,U,hd).call(this)):s(this,U,hd).call(this)}))},Zg=function(e){for(let t of e)for(let i of Array.from(t.removedNodes))i instanceof HTMLElement&&i.hasAttribute(mi)&&i.parentElement!==this&&(i.removeAttribute(mi),i.hidden=!1);s(this,U,Ta).call(this)},Co=function(){return Array.from(this.children).filter(e=>e.localName==="cm-button"&&(!e.hidden||e.hasAttribute(mi)))},Jm=function(e){for(let t of e)t.hasAttribute(mi)&&(t.removeAttribute(mi),t.hidden=!1)},dd=function(){return this.renderRoot.querySelector(".more")},hd=function(){let e=this.renderRoot.querySelector(".row"),t=s(this,U,dd).call(this);if(!e||!t||!this.isConnected)return;let i=s(this,U,Co).call(this),a=this.shadowRoot.activeElement===t?t:i.find(b=>b.matches(":focus-within"))??null,l=i[0]?.getAttribute("size");this._size=this.size||(l==="slim"||l==="large"?l:"medium");let d=new Set;if(r(this,Pt)){let b=new Set([this,t,...i]);for(let f of r(this,ui))b.has(f)||r(this,Pt).unobserve(f);for(let f of b)r(this,ui).has(f)||r(this,Pt).observe(f);g(this,ui,b)}if(this.overflow==="menu"){s(this,U,Jm).call(this,i),t.hidden=!1;let b=e.clientWidth,f=parseFloat(getComputedStyle(e).columnGap)||0,x=Array.from(this.children).filter(S=>!S.hidden),y=new Map(x.map(S=>[S,S.getBoundingClientRect().width])),k=x.reduce((S,A)=>S+y.get(A),0)+f*Math.max(x.length-1,0);if(k>b+.5){let S=B=>{let K=B.dataset.priority;return K==="low"?0:K==="high"?2:B.getAttribute("variant")==="primary"?3:1},A=i.map((B,K)=>({b:B,i:K,r:S(B)})).sort((B,K)=>B.r-K.r||K.i-B.i),q=k+f+t.getBoundingClientRect().width;for(let{b:B}of A){if(q<=b+.5)break;d.add(B),q-=y.get(B)+f}}}for(let b of i)d.has(b)?(b.setAttribute(mi,""),b.hidden=!0):b.hasAttribute(mi)&&(b.removeAttribute(mi),b.hidden=!1);t.hidden=d.size===0,a===t&&t.hidden?s(this,U,ep).call(this):a&&a!==t&&d.has(a)&&s(this,U,Qm).call(this),d.size===0&&t.open&&t.hide(),r(this,nr)?.takeRecords();let p=i.filter(b=>d.has(b));this._items=p.map((b,f)=>s(this,U,Qg).call(this,b,f));let u=p.length!==r(this,pi).length||p.some((b,f)=>b!==r(this,pi)[f]);g(this,pi,p),u&&this.dispatchEvent(new CustomEvent("cm-overflow-change",{detail:{hidden:[...p]},bubbles:!0,composed:!0})),r(this,or)&&this.updateComplete.then(()=>s(this,U,Zm).call(this))},Qg=function(e,t){let i=Array.from(e.childNodes).filter(d=>!(d instanceof Element&&d.hasAttribute("slot"))).map(d=>d.textContent??"").join("").replace(/\s+/g," ").trim(),a=e.hasAttribute("icon-only")?e.getAttribute("label")||i:i||e.getAttribute("label")||"",l=e.getAttribute("icon")||e.querySelector(':scope > [slot="icon"]')?.getAttribute("name")||void 0;return{label:a,value:String(t),icon:l,disabled:e.hasAttribute("disabled")||e.hasAttribute("loading")||void 0,critical:e.getAttribute("tone")==="critical"||void 0}},md=new WeakMap,Zm=function(){if(!r(this,or))return;g(this,or,!1);let e=document.activeElement,t=s(this,U,dd).call(this);(!e||e===document.body||e===document.documentElement||e===this&&(!t||t.hidden||this.shadowRoot.activeElement!==t))&&(t&&!t.hidden?s(this,U,Qm).call(this):s(this,U,ep).call(this))},Qm=function(){s(this,U,dd).call(this)?.shadowRoot?.querySelector('[part="trigger"]')?.focus()},ep=function(){let e=s(this,U,Co).call(this).filter(i=>!i.hidden&&!i.hasAttribute("disabled")),t=e[e.length-1];(t?.shadowRoot?.querySelector('[part="control"]')??t)?.focus()},za.properties={overflow:{reflect:!0},moreLabel:{attribute:"more-label",string:"more"},moreIcon:{attribute:"more-icon"},size:{reflect:!0},align:{reflect:!0},label:{},_items:{state:!0},_size:{state:!0}},za.styles=[E,w`
|
|
216
216
|
:host { display: block; min-inline-size: 0; }
|
|
217
217
|
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); min-inline-size: 0; }
|
|
218
218
|
:host([align='end']) .row { justify-content: flex-end; }
|
|
@@ -236,7 +236,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
236
236
|
.more::part(trigger), .more.slim::part(trigger) { min-height: var(--cm-control-height-lg, 40px); }
|
|
237
237
|
.more.icon::part(trigger), .more.icon.slim::part(trigger) { width: var(--cm-control-height-lg, 40px); }
|
|
238
238
|
}
|
|
239
|
-
`];$("cm-button-group",
|
|
239
|
+
`];$("cm-button-group",za);var gt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},_a=o=>(...n)=>({_$litDirective$:o,values:n}),gi=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:Uy}=Fg,ef=o=>o;var rf=o=>o.strings===void 0,tf=()=>document.createComment(""),Ca=(o,n,e)=>{let t=o._$AA.parentNode,i=n===void 0?o._$AB:n._$AA;if(e===void 0){let a=t.insertBefore(tf(),i),l=t.insertBefore(tf(),i);e=new Uy(a,l,o,o.options)}else{let a=e._$AB.nextSibling,l=e._$AM,d=l!==o;if(d){let p;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(p=o._$AU)!==l._$AU&&e._$AP(p)}if(a!==i||d){let p=e._$AA;for(;p!==a;){let u=ef(p).nextSibling;ef(t).insertBefore(p,i),p=u}}}return e},fi=(o,n,e=o)=>(o._$AI(n,e),o),Ky={},pd=(o,n=Ky)=>o._$AH=n,af=o=>o._$AH,ud=o=>{o._$AR(),o._$AA.remove()};var ce=_a(class extends gi{constructor(o){if(super(o),o.type!==gt.PROPERTY&&o.type!==gt.ATTRIBUTE&&o.type!==gt.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!rf(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[n]){if(n===ke||n===h)return n;let e=o.element,t=o.name;if(o.type===gt.PROPERTY){if(n===e[t])return ke}else if(o.type===gt.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return ke}else if(o.type===gt.ATTRIBUTE&&e.getAttribute(t)===n+"")return ke;return pd(o),n}});var rt=w`
|
|
240
240
|
:host {
|
|
241
241
|
--_cm-field-h: var(--cm-control-height-lg, 40px);
|
|
242
242
|
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
@@ -260,7 +260,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
260
260
|
.error { color: var(--cm-text-critical); }
|
|
261
261
|
:host([size='small']) .field { gap: var(--cm-space-4); }
|
|
262
262
|
:host([size='small']) .label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); }
|
|
263
|
-
`,
|
|
263
|
+
`,gd=w`
|
|
264
264
|
[role='listbox'] {
|
|
265
265
|
max-height: 264px; overflow-y: auto; margin: 0; padding: var(--cm-space-4); list-style: none;
|
|
266
266
|
}
|
|
@@ -272,22 +272,24 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
272
272
|
[role='option']:not([aria-disabled='true']):not([aria-selected='true']):active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
|
|
273
273
|
:host([size='small']) [role='option'] { min-height: var(--cm-control-height-sm, 32px); }
|
|
274
274
|
@media (pointer: coarse) { [role='option'], :host([size='small']) [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
275
|
-
`;var
|
|
276
|
-
.value=${
|
|
275
|
+
`;var fd=!1,tp=!1,sf=!1,nf=()=>{fd||(fd=!0,setTimeout(()=>{fd=!1,tp=!1}))};function Wy(){sf||typeof document>"u"||(sf=!0,document.addEventListener("click",nf,!0),document.addEventListener("keydown",o=>{(o.key==="Enter"||o.ctrlKey||o.metaKey)&&nf()},!0))}var Ne,lr,La,Sa,bi,Lo,cr,So,ip,Do,bd,vd,ee=class{constructor(n,e,t){m(this,So);m(this,Ne);m(this,lr);m(this,La);m(this,Sa,!1);m(this,bi,!1);m(this,Lo,"");m(this,cr,!1);m(this,Do,()=>{g(this,Sa,!0)});m(this,bd,n=>{let e=n.relatedTarget;e&&(r(this,Ne).contains(e)||r(this,Ne).shadowRoot?.contains(e))||r(this,Ne).updateComplete.then(()=>{if(!r(this,Sa)||r(this,bi))return;let t=r(this,lr).validity;t.valid||t.valueMissing||(g(this,bi,!0),r(this,Ne).requestUpdate())})});m(this,vd,n=>{if(!(!fd&&!r(this,cr))){if(n.preventDefault(),g(this,bi,!0),r(this,Ne).requestUpdate(),r(this,cr)){r(this,La).call(this);return}tp||(tp=!0,r(this,La).call(this))}});g(this,Ne,n),g(this,lr,e),g(this,La,t??(()=>n.focus())),Wy(),n.addEventListener("invalid",r(this,vd)),n.addEventListener("input",r(this,Do),!0),n.addEventListener("change",r(this,Do),!0),n.addEventListener("focusout",r(this,bd))}get message(){return s(this,So,ip).call(this)}sync(){let n=s(this,So,ip).call(this);r(this,Ne).toggleAttribute("data-cm-invalid",!!n),n!==r(this,Lo)&&(g(this,Lo,n),queueMicrotask(()=>r(this,Ne).requestUpdate()))}reset(){g(this,Sa,g(this,bi,!1)),r(this,Ne).requestUpdate()}report(n){g(this,cr,!0);try{return n()}finally{g(this,cr,!1)}}};Ne=new WeakMap,lr=new WeakMap,La=new WeakMap,Sa=new WeakMap,bi=new WeakMap,Lo=new WeakMap,cr=new WeakMap,So=new WeakSet,ip=function(){return r(this,Ne).error?r(this,Ne).error:r(this,bi)?r(this,lr).validity.valid?"":r(this,lr).validationMessage:""},Do=new WeakMap,bd=new WeakMap,vd=new WeakMap;var a0=z("textField",{required:"Please fill in this field.",rangeUnderflow:"Enter {min} or later.",rangeOverflow:"Enter {max} or earlier.",numberUnderflow:"Enter {min} or more.",numberOverflow:"Enter {max} or less.",stepMismatch:"Enter a valid value. The two nearest are {lower} and {upper}.",badTime:"Enter a complete time.",badDateTime:"Enter a complete date and time.",badEmail:"Enter an email address like name@example.com.",badUrl:"Enter a web address like https://example.com.",badNumber:"Enter a number.",pattern:"Enter a value in the requested format.",tooShort:"Enter at least {min} characters.",tooLong:"Enter {max} characters or fewer."}),oe,dr,qt,Ro,te,of,Ao,yd,lf,rp,ap,sp,vi=class extends T{constructor(){super(...arguments);m(this,te);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";this.patternMessage="";m(this,oe,this.attachInternals());m(this,dr,new ee(this,r(this,oe)));m(this,qt,R("cm-tf"));m(this,Ro,"")}connectedCallback(){super.connectedCallback(),g(this,Ro,this.value)}get form(){return r(this,oe).form}get validity(){return r(this,oe).validity}get validationMessage(){return r(this,oe).validationMessage}checkValidity(){return s(this,te,Ao).call(this),r(this,oe).checkValidity()}reportValidity(){return s(this,te,Ao).call(this),r(this,dr).report(()=>r(this,oe).reportValidity())}formResetCallback(){this.value=r(this,Ro),this.error="",r(this,dr).reset()}formDisabledCallback(e){this.disabled=e}updated(){r(this,oe).setFormValue(this.value),s(this,te,Ao).call(this)}render(){let e=r(this,dr).message,t=[e&&`${r(this,qt)}-err`,this.helpText&&`${r(this,qt)}-help`].filter(Boolean).join(" ")||h,i={id:r(this,qt),invalid:e?"true":h},a=this.minLength!=null&&this.minLength>0?this.minLength:h,l=this.maxLength!=null&&this.maxLength>=0?this.maxLength:h,d=this.multiline?c`<textarea class="input" part="input" id=${i.id} rows=${this.rows}
|
|
276
|
+
.value=${ce(this.value)} placeholder=${this.placeholder||h}
|
|
277
|
+
minlength=${a} maxlength=${l}
|
|
277
278
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
278
|
-
aria-invalid=${
|
|
279
|
-
@input=${s(this,
|
|
280
|
-
.value=${
|
|
279
|
+
aria-invalid=${i.invalid} aria-describedby=${t}
|
|
280
|
+
@input=${s(this,te,rp)} @change=${s(this,te,sp)} @blur=${s(this,te,ap)}></textarea>`:c`<input class="input" part="input" id=${i.id} type=${this.type}
|
|
281
|
+
.value=${ce(this.value)} placeholder=${this.placeholder||h}
|
|
281
282
|
autocomplete=${this.autocomplete??h}
|
|
282
283
|
min=${this.min||h} max=${this.max||h} step=${this.step||h}
|
|
284
|
+
pattern=${this.pattern||h} minlength=${a} maxlength=${l}
|
|
283
285
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
284
|
-
aria-invalid=${
|
|
285
|
-
@input=${s(this,
|
|
286
|
-
${this.label?c`<label class="label" for=${r(this,
|
|
287
|
-
${
|
|
288
|
-
${
|
|
289
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
290
|
-
</div>`}};
|
|
286
|
+
aria-invalid=${i.invalid} aria-describedby=${t}
|
|
287
|
+
@input=${s(this,te,rp)} @change=${s(this,te,sp)} @blur=${s(this,te,ap)} />`;return c`<div class="field">
|
|
288
|
+
${this.label?c`<label class="label" for=${r(this,qt)} 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}
|
|
289
|
+
${d}
|
|
290
|
+
${e?c`<p class="error" id="${r(this,qt)}-err" role="alert">${e}</p>`:h}
|
|
291
|
+
${this.helpText?c`<p class="help" id="${r(this,qt)}-help">${this.helpText}</p>`:h}
|
|
292
|
+
</div>`}};oe=new WeakMap,dr=new WeakMap,qt=new WeakMap,Ro=new WeakMap,te=new WeakSet,of=function(e){if(!this.pattern)return!0;for(let t of["v","u"])try{return new RegExp(`^(?:${this.pattern})$`,t).test(e)}catch{}return!0},Ao=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,oe).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,oe).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.type==="number"&&t?.badInput?r(this,oe).setValidity({badInput:!0},this.t("badNumber"),e??void 0):this.required&&!this.value?r(this,oe).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.typeMismatch?r(this,oe).setValidity({typeMismatch:!0},this.t(this.type==="url"?"badUrl":"badEmail"),e??void 0):this.value&&this.minLength!=null&&this.minLength>0&&this.value.length<this.minLength?r(this,oe).setValidity({tooShort:!0},this.t("tooShort",{min:this.minLength}),e??void 0):this.value&&this.maxLength!=null&&this.maxLength>=0&&this.value.length>this.maxLength?r(this,oe).setValidity({tooLong:!0},this.t("tooLong",{max:this.maxLength}),e??void 0):this.value&&!s(this,te,of).call(this,this.value)?r(this,oe).setValidity({patternMismatch:!0},this.patternMessage||this.t("pattern"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,oe).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:s(this,te,yd).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,oe).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:s(this,te,yd).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,oe).setValidity({stepMismatch:!0},this.t("stepMismatch",s(this,te,lf).call(this,e)),e??void 0):r(this,oe).setValidity({}),r(this,dr).sync()},yd=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?ne(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"?ne(a,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"},t):ne(a,{day:"numeric",month:"short",year:"numeric"},t)},lf=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,p=d+Math.floor((a-d)/i)*i,u=b=>{if(this.type==="number")return this.formatNumber(Number(b.toPrecision(12)));let x=new Date(b).toISOString();return s(this,te,yd).call(this,this.type==="time"?x.slice(11,16):this.type==="date"?x.slice(0,10):x.slice(0,16))};return{lower:u(p),upper:u(p+i)}},rp=function(e){this.value=e.target.value},ap=function(){s(this,te,Ao).call(this)},sp=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},vi.formAssociated=!0,vi.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},vi.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:{},pattern:{},patternMessage:{attribute:"pattern-message"},minLength:{type:Number,attribute:"minlength"},maxLength:{type:Number,attribute:"maxlength"}},vi.styles=[E,rt,w`
|
|
291
293
|
:host { display: block; }
|
|
292
294
|
.input {
|
|
293
295
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -302,15 +304,15 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
302
304
|
.input:focus { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
303
305
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
304
306
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
305
|
-
:host([error]:not([error=''])) .input { border-color: var(--cm-border-critical); }
|
|
306
|
-
`];$("cm-text-field",
|
|
307
|
-
<input type="checkbox" id=${r(this,
|
|
308
|
-
?disabled=${this.disabled} ?required=${this.required}
|
|
309
|
-
aria-describedby=${
|
|
307
|
+
:host([error]:not([error=''])) .input, :host([data-cm-invalid]) .input { border-color: var(--cm-border-critical); }
|
|
308
|
+
`];$("cm-text-field",vi);var h0=z("checkbox",{required:"Please tick this box."}),at,hr,Ot,Ho,xd,cf,yi=class extends T{constructor(){super(...arguments);m(this,xd);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;m(this,at,this.attachInternals());m(this,hr,new ee(this,r(this,at)));m(this,Ot,R("cm-cb"));m(this,Ho,!1)}connectedCallback(){super.connectedCallback(),g(this,Ho,this.checked)}get form(){return r(this,at).form}get validity(){return r(this,at).validity}get validationMessage(){return r(this,at).validationMessage}checkValidity(){return r(this,at).checkValidity()}reportValidity(){return r(this,hr).report(()=>r(this,at).reportValidity())}formResetCallback(){this.checked=r(this,Ho),r(this,hr).reset()}formDisabledCallback(e){this.disabled=e}updated(){r(this,at).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,at).setValidity({valueMissing:!0},this.t("required")):r(this,at).setValidity({}),r(this,hr).sync()}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>`,t=r(this,hr).message,i=[this.description&&`${r(this,Ot)}-d`,t&&`${r(this,Ot)}-err`].filter(Boolean).join(" ");return c`<label for=${r(this,Ot)}>
|
|
309
|
+
<input type="checkbox" id=${r(this,Ot)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
310
|
+
?disabled=${this.disabled} ?required=${this.required} aria-invalid=${t?"true":h}
|
|
311
|
+
aria-describedby=${i||h} @change=${s(this,xd,cf)} />
|
|
310
312
|
<span class="box" part="box">${e}</span>
|
|
311
|
-
${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,
|
|
312
|
-
</label
|
|
313
|
-
:host { display: inline-flex; }
|
|
313
|
+
${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,Ot)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
314
|
+
</label>${t?c`<p class="error" id="${r(this,Ot)}-err" role="alert">${t}</p>`:h}`}};at=new WeakMap,hr=new WeakMap,Ot=new WeakMap,Ho=new WeakMap,xd=new WeakSet,cf=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},yi.formAssociated=!0,yi.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},yi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},yi.styles=[E,w`
|
|
315
|
+
:host { display: inline-flex; flex-direction: column; }
|
|
314
316
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
315
317
|
/* The 16px box (18px on touch screens, owner standard 1.6) sits centred on the label's first line (20px); the
|
|
316
318
|
invisible input around it is a 24px target. Without a label the element is 24px tall with the box in the middle,
|
|
@@ -332,12 +334,15 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
332
334
|
:host([disabled]) label { cursor: not-allowed; }
|
|
333
335
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
334
336
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
335
|
-
|
|
337
|
+
/* 1.14: the field's own message, under the label text (past the box and its gap). */
|
|
338
|
+
.error { margin: 0; padding-inline-start: var(--cm-space-24); font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-critical); }
|
|
339
|
+
:host([data-cm-invalid]) .box, :host([data-cm-invalid]) label:hover input:not(:disabled) + .box { border-color: var(--cm-border-critical); }
|
|
340
|
+
`];$("cm-checkbox",yi);var No,pr=class extends L{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;m(this,No,R("cm-radio"))}render(){let e=this.description?`${r(this,No)}-d`:null;return c`<div class="radio" part="radio" role="radio" id=${r(this,No)}
|
|
336
341
|
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":h}
|
|
337
342
|
aria-describedby=${e??h} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
338
343
|
<span class="dot" part="dot"></span>
|
|
339
344
|
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?c`<span class="desc" id=${e}>${this.description}</span>`:h}</span>
|
|
340
|
-
</div>`}};
|
|
345
|
+
</div>`}};No=new WeakMap,pr.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},pr.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}},pr.styles=[E,w`
|
|
341
346
|
:host { display: inline-flex; }
|
|
342
347
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; outline: none; }
|
|
343
348
|
.dot {
|
|
@@ -359,16 +364,16 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
359
364
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
360
365
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
361
366
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
362
|
-
`];$("cm-radio",
|
|
363
|
-
aria-labelledby=${s(this,
|
|
364
|
-
aria-describedby=${
|
|
365
|
-
aria-required=${this.required?"true":h} aria-invalid=${
|
|
367
|
+
`];$("cm-radio",pr);var v0=z("radioGroup",{required:"Please select one of these options."}),Ve,gr,Bt,Io,Po,qo,Da,le,np,$d,mr,op,Aa,lp,kd,Ed,wd,ur=class extends T{constructor(){super();m(this,le);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;m(this,Ve,this.attachInternals());m(this,gr,new ee(this,r(this,Ve)));m(this,Bt,R("cm-rg"));m(this,Io,"");m(this,Po,!0);m(this,qo,!1);m(this,Da,!1);m(this,$d,()=>{s(this,le,np).call(this),r(this,Aa).call(this)});m(this,Aa,()=>{let e=s(this,le,mr).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,le,op).call(this)[0];for(let a of e)a._tabbable=a===i&&!this.disabled});m(this,kd,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||s(this,le,lp).call(this,t,!0)});m(this,Ed,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let i=s(this,le,op).call(this),a=i.indexOf(t),l=J(e,this),d;if(e.key==="ArrowDown"||l==="ArrowRight")d=i[(a+1)%i.length];else if(e.key==="ArrowUp"||l==="ArrowLeft")d=i[(a-1+i.length)%i.length];else if(e.key===" ")d=t.disabled?void 0:t;else return;e.preventDefault(),d&&s(this,le,lp).call(this,d,!0)});this.addEventListener("keydown",r(this,Ed)),this.addEventListener("click",r(this,kd))}connectedCallback(){super.connectedCallback(),s(this,le,np).call(this)}get form(){return r(this,Ve).form}get validity(){return r(this,Ve).validity}get validationMessage(){return r(this,Ve).validationMessage}checkValidity(){return r(this,Ve).checkValidity()}reportValidity(){return r(this,gr).report(()=>r(this,Ve).reportValidity())}formResetCallback(){this.value=r(this,Io),r(this,gr).reset()}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(s(this,le,mr).call(this).find(t=>t._tabbable)??s(this,le,mr).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,qo)&&!r(this,Da)&&g(this,Po,!1),g(this,qo,!0),r(this,Aa).call(this),r(this,Ve).setFormValue(this.value||null,this.value);let t=s(this,le,mr).call(this)[0];this.error?r(this,Ve).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Ve).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ve).setValidity({}),r(this,gr).sync()}render(){let e=r(this,gr).message,t=[e&&`${r(this,Bt)}-err`,this.helpText&&`${r(this,Bt)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
368
|
+
aria-labelledby=${s(this,le,wd).call(this)?`${r(this,Bt)}-l`:h} aria-label=${s(this,le,wd).call(this)?h:this.getAttribute("aria-label")??h}
|
|
369
|
+
aria-describedby=${t||h}
|
|
370
|
+
aria-required=${this.required?"true":h} aria-invalid=${e?"true":h}
|
|
366
371
|
aria-disabled=${this.disabled?"true":h}>
|
|
367
|
-
<span class="label" id="${r(this,
|
|
368
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
369
|
-
${
|
|
370
|
-
<div class="options" part="options"><slot @slotchange=${r(this
|
|
371
|
-
</div>`}};
|
|
372
|
+
<span class="label" id="${r(this,Bt)}-l" part="label" ?hidden=${!s(this,le,wd).call(this)}>${this.label}<slot name="label"></slot>${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
373
|
+
${this.helpText?c`<p class="help" id="${r(this,Bt)}-help">${this.helpText}</p>`:h}
|
|
374
|
+
${e?c`<p class="error" id="${r(this,Bt)}-err" role="alert">${e}</p>`:h}
|
|
375
|
+
<div class="options" part="options"><slot @slotchange=${r(this,$d)}></slot></div>
|
|
376
|
+
</div>`}};Ve=new WeakMap,gr=new WeakMap,Bt=new WeakMap,Io=new WeakMap,Po=new WeakMap,qo=new WeakMap,Da=new WeakMap,le=new WeakSet,np=function(){r(this,Po)&&(this.value||(g(this,Da,!0),this.value=s(this,le,mr).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>g(this,Da,!1))),g(this,Io,this.value))},$d=new WeakMap,mr=function(){return[...this.querySelectorAll("cm-radio")]},op=function(){return s(this,le,mr).call(this).filter(e=>!e.disabled&&!this.disabled)},Aa=new WeakMap,lp=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,r(this,Aa).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},kd=new WeakMap,Ed=new WeakMap,wd=function(){return!!this.label||!!this.querySelector("[slot=label]")},ur.formAssociated=!0,ur.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}},ur.styles=[E,w`
|
|
372
377
|
:host { display: block; }
|
|
373
378
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
374
379
|
.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); }
|
|
@@ -377,13 +382,13 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
377
382
|
.error { color: var(--cm-text-critical); }
|
|
378
383
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
379
384
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
380
|
-
`];$("cm-radio-group",
|
|
381
|
-
<input type="checkbox" role="switch" id=${r(this,
|
|
385
|
+
`];$("cm-radio-group",ur);var Ra,fr,Oo,Md,df,xi=class extends L{constructor(){super(...arguments);m(this,Md);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;m(this,Ra,this.attachInternals());m(this,fr,R("cm-tg"));m(this,Oo,!1)}connectedCallback(){super.connectedCallback(),g(this,Oo,this.checked)}get form(){return r(this,Ra).form}checkValidity(){return r(this,Ra).checkValidity()}formResetCallback(){this.checked=r(this,Oo)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,Ra).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${r(this,fr)}>
|
|
386
|
+
<input type="checkbox" role="switch" id=${r(this,fr)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
382
387
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
383
|
-
aria-describedby=${this.description?`${r(this,
|
|
388
|
+
aria-describedby=${this.description?`${r(this,fr)}-d`:h} @change=${s(this,Md,df)} />
|
|
384
389
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
385
|
-
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,
|
|
386
|
-
</label>`}};
|
|
390
|
+
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,fr)}-d">${this.description}</span>`:h}</span>`:h}
|
|
391
|
+
</label>`}};Ra=new WeakMap,fr=new WeakMap,Oo=new WeakMap,Md=new WeakSet,df=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},xi.formAssociated=!0,xi.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},xi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},xi.styles=[E,w`
|
|
387
392
|
:host { display: inline-flex; }
|
|
388
393
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
389
394
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -411,7 +416,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
411
416
|
:host([disabled]) .track { opacity: .5; }
|
|
412
417
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
413
418
|
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
414
|
-
`];$("cm-toggle",
|
|
419
|
+
`];$("cm-toggle",xi);var Ha=w`
|
|
415
420
|
.pop {
|
|
416
421
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-4)); inset-inline: 0;
|
|
417
422
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -423,7 +428,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
423
428
|
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
424
429
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
425
430
|
}
|
|
426
|
-
`;function
|
|
431
|
+
`;function Td(o,n,e){let t=i=>{n()&&!i.composedPath().includes(o)&&e()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)}var wi=w`
|
|
427
432
|
[role='group'] + [role='group'] { margin-block-start: var(--cm-space-4); padding-block-start: var(--cm-space-4); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
428
433
|
[role='option'] + [role='group'], [role='group'] + [role='option'] { margin-block-start: var(--cm-space-4); padding-block-start: var(--cm-space-4); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
429
434
|
.gh {
|
|
@@ -432,7 +437,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
432
437
|
}
|
|
433
438
|
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
434
439
|
.gopts { list-style: none; margin: 0; padding: 0; }
|
|
435
|
-
`;function
|
|
440
|
+
`;function Na(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 zd(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 _d=w`
|
|
436
441
|
[role='listbox'] { padding-block: var(--cm-space-4); }
|
|
437
442
|
[role='listbox'][hidden] { display: none; }
|
|
438
443
|
[role='option'] {
|
|
@@ -451,35 +456,35 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
451
456
|
flex: none; min-width: 20px; padding: 0 var(--cm-space-4); font: inherit; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); text-align: center;
|
|
452
457
|
color: var(--cm-text-tertiary); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-xs);
|
|
453
458
|
}
|
|
454
|
-
`;function
|
|
459
|
+
`;function Cd(o,n,e,t){return c`<div role="presentation" class="gh" id=${o}><span>${n}</span>${e!==void 0?c`<span class="count" aria-hidden="true">${e}</span><span class="vh">, ${t}</span>`:h}</div>`}function Ld(o,n=h){return c`${o.icon?c`<cm-icon name=${o.icon} size="16"></cm-icon>`:h}<span class="text"><span class="title">${o.title}</span>${o.description?c`<span class="vh">, </span><span class="desc">${o.description}</span>`:h}</span>${n}`}function Sd(o,n){let e=`${o.cls??""}${o.active?" active":""}`;return o.href?c`<a role="option" id=${o.id} class=${e} href=${o.href} tabindex="-1" aria-selected=${o.active?"true":"false"}
|
|
455
460
|
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</a>`:c`<div role="option" id=${o.id} class=${e} tabindex="-1" aria-selected=${o.active?"true":"false"}
|
|
456
|
-
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function
|
|
457
|
-
aria-selected=${
|
|
458
|
-
@pointerenter=${()=>!
|
|
459
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
461
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function Dd(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var R0=z("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),Ue,vr,be,Pa,ft,qa,Fo,F,cp,yr,dp,Bo,Ia,br,$i,Ad,Rd,jo,Hd,hf,Nd,ki=class extends T{constructor(){super(...arguments);m(this,F);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.size="default";this.loading=!1;this._active=-1;this._slotted=[];m(this,Ue,this.attachInternals());m(this,vr,new ee(this,r(this,Ue)));m(this,be,R("cm-sel"));m(this,Pa,"");m(this,ft,"");m(this,qa,0);m(this,Fo,new MutationObserver(()=>s(this,F,cp).call(this)));m(this,yr,new Ee);m(this,Rd,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),s(this,F,Bo).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),s(this,F,Bo).call(this),s(this,F,$i).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,F,Ad).call(this,t);s(this,F,Bo).call(this,i>=0?i:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?s(this,F,br).call(this,this._active):s(this,F,$i).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?s(this,F,br).call(this,this._active):s(this,F,$i).call(this,-1);break;case"Home":e.preventDefault(),s(this,F,$i).call(this,"first");break;case"End":e.preventDefault(),s(this,F,$i).call(this,"last");break;case"PageDown":e.preventDefault(),s(this,F,$i).call(this,10);break;case"PageUp":e.preventDefault(),s(this,F,$i).call(this,-10);break;case"Enter":e.preventDefault(),s(this,F,br).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),s(this,F,Ia).call(this);break;case"Tab":s(this,F,br).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,ft)&&Date.now()-r(this,qa)<500){let i=s(this,F,Ad).call(this," ");i>=0&&(this._active=i)}else s(this,F,br).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,F,Ad).call(this,t);i>=0&&(this._active=i)}}});m(this,jo,e=>{this.open&&!e.composedPath().includes(this)&&s(this,F,Ia).call(this)});m(this,Hd,()=>{this.disabled||(this.open?s(this,F,Ia).call(this):s(this,F,Bo).call(this))});m(this,Nd,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),s(this,F,cp).call(this),r(this,Fo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,jo),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,yr).close(),r(this,Fo).disconnect(),document.removeEventListener("pointerdown",r(this,jo),!0)}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,vr).report(()=>r(this,Ue).reportValidity())}formResetCallback(){this.value=r(this,Pa),this.open=!1,r(this,vr).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?Na(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):Na(this._slotted)}firstUpdated(){r(this,Pa)||g(this,Pa,this.value)}updated(e){r(this,Ue).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 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({}),r(this,vr).sync(),e.has("open")?this.open?r(this,yr).open(this.renderRoot.querySelector("[role=listbox]"),this.renderRoot.querySelector(".box"),{align:"stretch"}):r(this,yr).close():this.open&&e.has("items")&&r(this,yr).place(),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,be)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(p=>p.value===this.value),i=r(this,vr).message,a=[i&&`${r(this,be)}-err`,this.helpText&&`${r(this,be)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=(p,u)=>c`<li role="option" id="${r(this,be)}-o${u}" class=${u===this._active?"active":""}
|
|
462
|
+
aria-selected=${p.value===this.value?"true":"false"} aria-disabled=${p.disabled?"true":h}
|
|
463
|
+
@pointerenter=${()=>!p.disabled&&(this._active=u)} @click=${()=>s(this,F,br).call(this,u)}>${p.label}</li>`;return c`<div class="field">
|
|
464
|
+
${this.label?c`<span class="label" id="${r(this,be)}-l" part="label" @click=${r(this,Nd)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
460
465
|
<div class="wrap">
|
|
461
466
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
462
|
-
aria-labelledby=${this.label?`${r(this,
|
|
463
|
-
aria-label=${!this.label&&
|
|
464
|
-
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
465
|
-
aria-activedescendant=${this.open&&this._active>=0?`${r(this,
|
|
466
|
-
aria-required=${this.required?"true":h} aria-invalid=${
|
|
467
|
-
aria-disabled=${this.disabled?"true":h} aria-describedby=${
|
|
468
|
-
@click=${r(this,
|
|
469
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,
|
|
467
|
+
aria-labelledby=${this.label?`${r(this,be)}-l`:h}
|
|
468
|
+
aria-label=${!this.label&&l?l:h}
|
|
469
|
+
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,be)}-list"
|
|
470
|
+
aria-activedescendant=${this.open&&this._active>=0?`${r(this,be)}-o${this._active}`:h}
|
|
471
|
+
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
472
|
+
aria-disabled=${this.disabled?"true":h} aria-describedby=${a||h} aria-busy=${this.loading?"true":h}
|
|
473
|
+
@click=${r(this,Hd)} @keydown=${r(this,Rd)} @blur=${()=>s(this,F,Ia).call(this)}>
|
|
474
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,be)}-v">${t?s(this,F,hf).call(this,t):this.placeholder}</span>
|
|
470
475
|
${this.loading?c`<span class="spin"><cm-spinner size="small" aria-hidden="true"></cm-spinner></span>`:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
471
476
|
</div>
|
|
472
|
-
<ul role="listbox" id="${r(this,
|
|
473
|
-
aria-label=${!this.label&&
|
|
474
|
-
@pointerdown=${
|
|
475
|
-
${
|
|
476
|
-
<ul role="none" class="gopts">${
|
|
477
|
+
<ul role="listbox" id="${r(this,be)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,be)}-l`:h}
|
|
478
|
+
aria-label=${!this.label&&l?l:h} ?hidden=${!this.open}
|
|
479
|
+
@pointerdown=${p=>p.preventDefault()}>
|
|
480
|
+
${zd(e).map((p,u)=>p.group?c`<li role="group" aria-labelledby="${r(this,be)}-g${u}"><div role="presentation" class="gh" id="${r(this,be)}-g${u}">${p.group}</div>
|
|
481
|
+
<ul role="none" class="gopts">${p.rows.map(({row:b,index:f})=>d(b,f))}</ul></li>`:p.rows.map(({row:b,index:f})=>d(b,f)))}
|
|
477
482
|
</ul>
|
|
478
483
|
</div>
|
|
479
|
-
${
|
|
480
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
484
|
+
${i?c`<p class="error" id="${r(this,be)}-err" role="alert">${i}</p>`:h}
|
|
485
|
+
${this.helpText?c`<p class="help" id="${r(this,be)}-help">${this.helpText}</p>`:h}
|
|
481
486
|
<slot></slot>
|
|
482
|
-
</div>`}};
|
|
487
|
+
</div>`}};Ue=new WeakMap,vr=new WeakMap,be=new WeakMap,Pa=new WeakMap,ft=new WeakMap,qa=new WeakMap,Fo=new WeakMap,F=new WeakSet,cp=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,Pa,this.value))},yr=new WeakMap,dp=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},Bo=function(e){if(this.disabled||this.loading)return;let t=this.items.findIndex(i=>i.value===this.value);this.open=!0,this._active=e??(t>=0?t:s(this,F,dp).call(this)[0]??-1)},Ia=function(){this.open=!1},br=function(e){let t=this.items[e];!t||t.disabled||(s(this,F,Ia).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}))))},$i=function(e){let t=s(this,F,dp).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))]},Ad=function(e){let t=Date.now();g(this,ft,t-r(this,qa)>500?e:r(this,ft)+e),g(this,qa,t);let i=this.items,a=this._active<0?0:this._active,l=r(this,ft).split("").every(u=>u===r(this,ft)[0]),d=l?r(this,ft)[0]:r(this,ft),p=l||r(this,ft).length===1?a+1:a;for(let u=0;u<i.length;u++){let b=(p+u)%i.length;if(!i[b].disabled&&i[b].label.toLowerCase().startsWith(d.toLowerCase()))return b}return-1},Rd=new WeakMap,jo=new WeakMap,Hd=new WeakMap,hf=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},Nd=new WeakMap,ki.formAssociated=!0,ki.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},ki.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},size:{reflect:!0},loading:{type:Boolean,reflect:!0},_active:{state:!0},_slotted:{state:!0}},ki.styles=[E,it,rt,gd,wi,w`
|
|
483
488
|
:host { display: block; position: relative; }
|
|
484
489
|
.label { cursor: default; }
|
|
485
490
|
.wrap { position: relative; }
|
|
@@ -498,7 +503,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
498
503
|
:host([loading]) .box { cursor: progress; }
|
|
499
504
|
.chev { flex: none; color: var(--cm-icon-selected); transition: transform var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
500
505
|
:host([open]) .chev { transform: rotate(180deg); }
|
|
501
|
-
:host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
|
|
506
|
+
:host([error]:not([error=''])) .box, :host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
502
507
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
503
508
|
[role='listbox'] {
|
|
504
509
|
position: absolute; z-index: 20; top: calc(100% + var(--cm-space-4)); inset-inline: 0; min-width: max-content;
|
|
@@ -512,16 +517,16 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
512
517
|
[role='group'] { display: block; }
|
|
513
518
|
slot { display: none; }
|
|
514
519
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
515
|
-
`];$("cm-select",
|
|
520
|
+
`];$("cm-select",ki);var F0=z("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),Ba,Id,Vo,_e,Oa,mf,pf,hp,Ei=class extends T{constructor(){super(...arguments);m(this,_e);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;m(this,Ba,this.attachInternals());m(this,Id,R("cm-search"));m(this,Vo,"")}connectedCallback(){super.connectedCallback(),g(this,Vo,this.value)}get form(){return r(this,Ba).form}checkValidity(){return r(this,Ba).checkValidity()}formResetCallback(){this.value=r(this,Vo)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,Ba).setFormValue(this.value)}render(){return c`<div class="box" part="box">
|
|
516
521
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
517
|
-
<input id=${r(this,
|
|
518
|
-
aria-label=${this.label} .value=${
|
|
519
|
-
@input=${s(this,
|
|
520
|
-
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,
|
|
522
|
+
<input id=${r(this,Id)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
523
|
+
aria-label=${this.label} .value=${ce(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
524
|
+
@input=${s(this,_e,mf)} @change=${()=>s(this,_e,Oa).call(this,"change")} @keydown=${s(this,_e,pf)} />
|
|
525
|
+
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,_e,hp)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
521
526
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
522
527
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
523
|
-
@click=${()=>s(this,
|
|
524
|
-
</div>`}}
|
|
528
|
+
@click=${()=>s(this,_e,Oa).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}
|
|
529
|
+
</div>`}};Ba=new WeakMap,Id=new WeakMap,Vo=new WeakMap,_e=new WeakSet,Oa=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},mf=function(e){this.value=e.target.value},pf=function(e){e.key==="Enter"?s(this,_e,Oa).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),s(this,_e,hp).call(this))},hp=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),s(this,_e,Oa).call(this,"input"),s(this,_e,Oa).call(this,"change")},Ei.formAssociated=!0,Ei.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},Ei.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}},Ei.styles=[E,rt,w`
|
|
525
530
|
:host { display: block; }
|
|
526
531
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
527
532
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -555,7 +560,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
555
560
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
556
561
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
557
562
|
:host([disabled]) button { cursor: not-allowed; }
|
|
558
|
-
`];$("cm-search",
|
|
563
|
+
`];$("cm-search",Ei);var G0=z("tag",{remove:"Remove {label}"}),Pd,uf,xr=class extends T{constructor(){super(...arguments);m(this,Pd);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,Pd,uf)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};Pd=new WeakSet,uf=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},xr.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},xr.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},xr.styles=[E,w`
|
|
559
564
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
560
565
|
.tag {
|
|
561
566
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -573,47 +578,47 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
573
578
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
574
579
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
|
|
575
580
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
|
|
576
|
-
`];$("cm-tag",
|
|
577
|
-
`):[]:this.value=e)}get items(){return this.options?.length?
|
|
578
|
-
`))}else r(this,
|
|
579
|
-
aria-selected=${
|
|
580
|
-
@pointerenter=${()=>!
|
|
581
|
-
${
|
|
582
|
-
${this.label?c`<label class="label" id="${r(this,
|
|
581
|
+
`];$("cm-tag",xr);var s$=z("combobox",{noResults:"No results",results:{one:"{count} result",other:"{count} results"},add:"Add \u201C{value}\u201D",remove:"Remove {label}",required:"Please select an item in the list.",requiredMultiple:"Choose at least one item.",grouped:"{group}: {label}",more:"+{count} more"}),Ce,kr,ve,Go,Va,Yo,Xo,Jo,D,mp,gf,Uo,qd,Ko,jt,Fa,ja,Ft,ff,Wo,pp,up,wr,Od,Bd,$r,bf,Fd,jd,Vd,vf,yf,Mi=class extends T{constructor(){super(...arguments);m(this,D);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.size="default";this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.maxTags=3;this._query="";this._focusIn=!1;this._active=-1;this._slotted=[];this._typing=!1;m(this,Ce,this.attachInternals());m(this,kr,new ee(this,r(this,Ce)));m(this,ve,R("cm-cb"));m(this,Go,null);m(this,Va,new Map);m(this,Yo,new Map);m(this,Xo,new MutationObserver(()=>s(this,D,mp).call(this)));m(this,Jo);m(this,jt,new Ee);m(this,Od,()=>{this._focusIn=!0});m(this,Bd,()=>{setTimeout(()=>{this._focusIn=this.matches(":focus-within")})});m(this,Fd,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,s(this,D,ja).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});m(this,jd,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?s(this,D,Wo).call(this,1):(s(this,D,ja).call(this),e.altKey||s(this,D,Wo).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?s(this,D,Wo).call(this,-1):(s(this,D,ja).call(this),s(this,D,Wo).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),s(this,D,pp).call(this,this._active)):r(this,D,qd)&&(e.preventDefault(),s(this,D,up).call(this,r(this,D,qd)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),s(this,D,Ft).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",s(this,D,Fa).call(this)));break;case"ArrowLeft":case"ArrowRight":{let i=e.target;this.multiple&&this.values.length&&J(e,this)==="ArrowLeft"&&i.selectionStart===0&&i.selectionEnd===0&&(e.preventDefault(),s(this,D,Ft).call(this),s(this,D,$r).call(this,this.values.length-1));break}case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":s(this,D,Ft).call(this);break;default:}});m(this,Vd,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(s(this,D,Ft).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?s(this,D,Uo).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),s(this,D,mp).call(this),r(this,Xo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),g(this,Jo,Td(this,()=>this.open,()=>s(this,D,Ft).call(this))),this.addEventListener("focusin",r(this,Od)),this.addEventListener("focusout",r(this,Bd))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,jt).close(),r(this,Xo).disconnect(),(e=r(this,Jo))==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,kr).report(()=>r(this,Ce).reportValidity())}formResetCallback(){let e=r(this,Go)??{value:"",values:[]};this.value=e.value,this.values=[...e.values],this._query="",this._typing=!1,this.open=!1,r(this,kr).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){typeof e=="string"&&(this.multiple?this.values=e?e.split(`
|
|
582
|
+
`):[]:this.value=e)}get items(){return this.options?.length?Na(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):Na(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let i=t.label.toLowerCase();return this.filter==="starts-with"?i.startsWith(e):i.includes(e)})}firstUpdated(){g(this,Go,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,Va).set(t.value,t.label),t.group&&r(this,Yo).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,D,Uo).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=s(this,D,Ko).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.open;t&&!r(this,jt).active?r(this,jt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,jt).active?r(this,jt).close():t&&r(this,jt).place();let i=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let l=new FormData;for(let d of this.values)l.append(this.name,d);r(this,Ce).setFormValue(l,this.values.join(`
|
|
583
|
+
`))}else r(this,Ce).setFormValue(null);else r(this,Ce).setFormValue(this.value||null,this.value);let a=this.multiple?!this.values.length:!this.value;this.error?r(this,Ce).setValidity({customError:!0},this.error,i):this.required&&a?r(this,Ce).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),i):r(this,Ce).setValidity({}),r(this,kr).sync(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,ve)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),s(this,D,Fa).call(this))}focus(e){this.renderRoot.querySelector("input")?.focus(e)}render(){let e=s(this,D,Ko).call(this),t=r(this,kr).message,i=[t&&`${r(this,ve)}-err`,this.helpText&&`${r(this,ve)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=u=>this.multiple?this.values.includes(u):u===this.value,d=(u,b)=>c`<li role="option" id="${r(this,ve)}-o${b}" class=${b===this._active?"active":""}
|
|
584
|
+
aria-selected=${u.create?"false":l(u.value)?"true":"false"} aria-disabled=${u.disabled?"true":h}
|
|
585
|
+
@pointerenter=${()=>!u.disabled&&(this._active=b)} @click=${()=>s(this,D,pp).call(this,b)}>
|
|
586
|
+
${u.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:u.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${s(this,D,vf).call(this,u.label)}</span>`}</li>`,p=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">
|
|
587
|
+
${this.label?c`<label class="label" id="${r(this,ve)}-l" for="${r(this,ve)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
583
588
|
<div class="wrap">
|
|
584
|
-
<div class="box" part="box" @click=${
|
|
589
|
+
<div class="box" part="box" @click=${u=>{u.target.closest("cm-tag[removable]")||s(this,D,wr).call(this)}}>
|
|
585
590
|
<div class="chips ${this.multiple&&this.values.length?`has-tags${this._focusIn||this.open?"":" idle"}`:""}">
|
|
586
|
-
${this.multiple?s(this,D,
|
|
587
|
-
<input id="${r(this,
|
|
588
|
-
.value=${
|
|
589
|
-
aria-label=${!this.label&&
|
|
590
|
-
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
591
|
-
aria-activedescendant=${this.open&&this._active>=0?`${r(this,
|
|
592
|
-
aria-invalid=${
|
|
591
|
+
${this.multiple?s(this,D,yf).call(this):h}
|
|
592
|
+
<input id="${r(this,ve)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
593
|
+
.value=${ce(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
594
|
+
aria-label=${!this.label&&a?a:h}
|
|
595
|
+
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,ve)}-list"
|
|
596
|
+
aria-activedescendant=${this.open&&this._active>=0?`${r(this,ve)}-o${this._active}`:h}
|
|
597
|
+
aria-invalid=${t?"true":h} aria-describedby=${i||h}
|
|
593
598
|
aria-required=${this.required?"true":h} ?disabled=${this.disabled}
|
|
594
|
-
@input=${r(this,
|
|
595
|
-
@click=${()=>{this.open||s(this,D,
|
|
599
|
+
@input=${r(this,Fd)} @keydown=${r(this,jd)} @blur=${r(this,Vd)}
|
|
600
|
+
@click=${()=>{this.open||s(this,D,ja).call(this)}} @change=${u=>u.stopPropagation()} />
|
|
596
601
|
</div>
|
|
597
|
-
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,D,
|
|
602
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,D,Ft).call(this):(s(this,D,ja).call(this),s(this,D,wr).call(this))}}></cm-icon>
|
|
598
603
|
</div>
|
|
599
|
-
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${
|
|
600
|
-
<ul role="listbox" id="${r(this,
|
|
601
|
-
aria-labelledby=${this.label?`${r(this,
|
|
604
|
+
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${u=>u.preventDefault()}>
|
|
605
|
+
<ul role="listbox" id="${r(this,ve)}-list" part="listbox" ?hidden=${!e.length}
|
|
606
|
+
aria-labelledby=${this.label?`${r(this,ve)}-l`:h} aria-label=${!this.label&&a?a:h}
|
|
602
607
|
aria-multiselectable=${this.multiple?"true":h}>
|
|
603
|
-
${
|
|
604
|
-
<ul role="none" class="gopts">${
|
|
608
|
+
${zd(e).map((u,b)=>u.group?c`<li role="group" aria-labelledby="${r(this,ve)}-g${b}"><div role="presentation" class="gh" id="${r(this,ve)}-g${b}">${u.group}</div>
|
|
609
|
+
<ul role="none" class="gopts">${u.rows.map(({row:f,index:x})=>d(f,x))}</ul></li>`:u.rows.map(({row:f,index:x})=>d(f,x)))}
|
|
605
610
|
</ul>
|
|
606
611
|
${this.loading?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText||this.t("loading")}</span></p>`:e.length?h:c`<p class="message">${this.emptyText||this.t("noResults")}</p>`}
|
|
607
612
|
</div>
|
|
608
613
|
</div>
|
|
609
|
-
<span class="vh" role="status" aria-live="polite">${
|
|
610
|
-
${
|
|
611
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
614
|
+
<span class="vh" role="status" aria-live="polite">${p}</span>
|
|
615
|
+
${t?c`<p class="error" id="${r(this,ve)}-err" role="alert">${t}</p>`:h}
|
|
616
|
+
${this.helpText?c`<p class="help" id="${r(this,ve)}-help">${this.helpText}</p>`:h}
|
|
612
617
|
<slot></slot>
|
|
613
|
-
</div>`}};
|
|
614
|
-
remove-label=${this.t("remove",{label:s(this,D,
|
|
615
|
-
@keydown=${l=>s(this,D,
|
|
616
|
-
@cm-remove=${()=>{this.removeValue(i),s(this,D,
|
|
618
|
+
</div>`}};Ce=new WeakMap,kr=new WeakMap,ve=new WeakMap,Go=new WeakMap,Va=new WeakMap,Yo=new WeakMap,Xo=new WeakMap,Jo=new WeakMap,D=new WeakSet,mp=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])}},gf=function(e){return this.items.find(t=>t.value===e)?.label??r(this,Va).get(e)??e},Uo=function(e){let t=s(this,D,gf).call(this,e);if(!this.showGroup)return t;let i=this.items.find(a=>a.value===e)?.group??r(this,Yo).get(e);return i?this.t("grouped",{group:i,label:t}):t},qd=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},Ko=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,D,qd);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},jt=new WeakMap,Fa=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ja=function(){this.disabled||(this.open=!0)},Ft=function(){this.open=!1,this._active=-1},ff=function(e=s(this,D,Ko).call(this)){return e.flatMap((t,i)=>t.disabled?[]:[i])},Wo=function(e){let t=s(this,D,ff).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]},pp=function(e){let t=s(this,D,Ko).call(this)[e];if(!(!t||t.disabled)){if(t.create){s(this,D,up).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,D,Fa).call(this),s(this,D,wr).call(this);return}s(this,D,Ft).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,D,Fa).call(this))}},up=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,Va).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(s(this,D,Ft).call(this),this.value=e,this._typing=!1,this._query=e),s(this,D,Fa).call(this))},wr=function(){this.renderRoot.querySelector("input")?.focus()},Od=new WeakMap,Bd=new WeakMap,$r=async function(e){await this.updateComplete;let t=this.renderRoot.querySelectorAll("cm-tag[data-i]");e>=0&&e<t.length?t[e].focus():s(this,D,wr).call(this)},bf=function(e,t){let i=J(e,this),a=this.values.length-1;if(i==="ArrowLeft")e.preventDefault(),s(this,D,$r).call(this,Math.max(0,t-1));else if(i==="ArrowRight")e.preventDefault(),s(this,D,$r).call(this,t<a?t+1:-1);else if(i==="Home")e.preventDefault(),s(this,D,$r).call(this,0);else if(i==="End")e.preventDefault(),s(this,D,$r).call(this,a);else if(i==="Escape")e.preventDefault(),e.stopPropagation(),s(this,D,wr).call(this);else if((i==="Backspace"||i==="Delete")&&!this.disabled){e.preventDefault(),this.removeValue(this.values[t]);let l=this.values.length;s(this,D,$r).call(this,i==="Backspace"?t>0?t-1:l?0:-1:t<l?t:-1)}},Fd=new WeakMap,jd=new WeakMap,Vd=new WeakMap,vf=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)}`},yf=function(){let e=this.maxTags>0&&!this._focusIn&&!this.open&&this.values.length>this.maxTags?this.maxTags:this.values.length,t=this.values.length-e;return c`${this.values.slice(0,e).map((i,a)=>c`<cm-tag removable tabindex="-1" data-i=${a} part="tag" ?disabled=${this.disabled}
|
|
619
|
+
remove-label=${this.t("remove",{label:s(this,D,Uo).call(this,i)})}
|
|
620
|
+
@keydown=${l=>s(this,D,bf).call(this,l,a)}
|
|
621
|
+
@cm-remove=${()=>{this.removeValue(i),s(this,D,wr).call(this)}}>${s(this,D,Uo).call(this,i)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},Mi.formAssociated=!0,Mi.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},Mi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},values:{type:Array},placeholder:{},options:{type:Array},multiple:{type:Boolean,reflect:!0},size:{reflect:!0},allowCustom:{type:Boolean,attribute:"allow-custom"},filter:{},loading:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},maxTags:{type:Number,attribute:"max-tags"},_query:{state:!0},_focusIn:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},Mi.styles=[E,rt,it,Ha,gd,wi,w`
|
|
617
622
|
:host { display: block; position: relative; }
|
|
618
623
|
.wrap { position: relative; }
|
|
619
624
|
.box {
|
|
@@ -639,7 +644,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
639
644
|
input::placeholder { color: var(--cm-text-tertiary); }
|
|
640
645
|
.chev { flex: none; color: var(--cm-icon-selected); transition: transform var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
641
646
|
:host([open]) .chev { transform: rotate(180deg); }
|
|
642
|
-
:host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
|
|
647
|
+
:host([error]:not([error=''])) .box, :host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
643
648
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
644
649
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
645
650
|
[role='listbox'][hidden] { display: none; }
|
|
@@ -654,31 +659,31 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
654
659
|
.create { font-style: normal; }
|
|
655
660
|
slot { display: none; }
|
|
656
661
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
657
|
-
`];$("cm-combobox",
|
|
662
|
+
`];$("cm-combobox",Mi);function Zo(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var Gy={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"};function Ud(o,n){let e=o.trim().toLowerCase().split("+").map(a=>a.trim());e.length>1&&e[e.length-1]===""&&e[e.length-2]===""&&e.splice(-2,2,"+");let t=e.pop();if(!t)return null;let i={key:Gy[t]??t,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let a of e)if(a==="mod")n?i.meta=!0:i.ctrl=!0;else if(a==="ctrl"||a==="control")i.ctrl=!0;else if(a==="meta"||a==="cmd"||a==="command")i.meta=!0;else if(a==="alt"||a==="option"||a==="opt")i.alt=!0;else if(a==="shift")i.shift=!0;else return null;return i}function gp(o,n=Zo()){let e=Ud(o,n);return!!e&&(e.ctrl||e.meta||e.alt)}function fp(o,n,e=Zo()){let t=Ud(n,e);if(!t||!o.key||o.ctrlKey!==t.ctrl||o.metaKey!==t.meta||o.altKey!==t.alt)return!1;let i=/^[a-z0-9]$/.test(t.key);return(i||t.key.length>1)&&o.shiftKey!==t.shift?!1:o.key.toLowerCase()===t.key?!0:i?o.code===(/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`):!1}function Kd(o){let n=o.composedPath()[0];return!!n&&(n.isContentEditable||/^(input|textarea|select)$/i.test(n.localName??""))}var Yy={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7"},Xy={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},Jy={escape:"Esc",enter:"\u21B5"," ":"Space",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",backspace:"\u232B",delete:"Del",tab:"Tab",pageup:"PgUp",pagedown:"PgDn",home:"Home",end:"End"},Zy=o=>Jy[o]??(o.length===1?o.toUpperCase():o[0].toUpperCase()+o.slice(1));function Wd(o,n=Zo()){let e=[];for(let t of o.trim().split(/\s+/).filter(Boolean)){let i=Ud(t,n);if(!i)return[o.trim()];let a=n?Yy:Xy,l=n?["ctrl","alt","shift","meta"]:["ctrl","meta","alt","shift"];for(let d of l)i[d]&&e.push(a[d]);e.push(Zy(i.key))}return e}function xf(o,n=Zo()){if(/\s/.test(o.trim()))return"";let e=Ud(o,n);if(!e)return"";let t=e.key===" "?"Space":e.key.length===1?e.key.toUpperCase():e.key.replace(/^(arrow|page)?(\w)/,(i,a,l)=>a?`${a[0].toUpperCase()}${a.slice(1)}${l.toUpperCase()}`:l.toUpperCase());return[e.ctrl&&"Control",e.meta&&"Meta",e.alt&&"Alt",e.shift&&"Shift",t].filter(Boolean).join("+")}var f$=z("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),st,el,G,Gd,Qo,Vt,Ua,bp,Yd,wf,Xd,tl,vp,$f,Er=class extends T{constructor(){super(...arguments);m(this,G);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;m(this,st,R("cm-gs"));m(this,el);m(this,Vt,new Ee);m(this,Yd,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),s(this,G,bp).call(this)});m(this,Xd,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),s(this,G,wf).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,G,Qo)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,st)}-o${this._active}`)?.click());break;case"Escape":r(this,G,Qo)?(e.preventDefault(),e.stopPropagation(),s(this,G,Ua).call(this)):this.value&&(e.preventDefault(),s(this,G,vp).call(this,!1));break;case"Tab":s(this,G,Ua).call(this);break;default:}});m(this,tl,e=>{!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented||Kd(e)||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),g(this,el,Td(this,()=>this.open,()=>s(this,G,Ua).call(this))),document.addEventListener("keydown",r(this,tl))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,Vt).close(),(e=r(this,el))==null||e.call(this),document.removeEventListener("keydown",r(this,tl))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=s(this,G,Gd).call(this).length&&(this._active=-1)}updated(e){let t=r(this,G,Qo);t&&!r(this,Vt).active?r(this,Vt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,Vt).active?r(this,Vt).close():t&&r(this,Vt).place(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,st)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=s(this,G,Gd).call(this),t=r(this,G,Qo),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),p=(u,b,f="")=>{let x=++l;return Sd({id:`${r(this,st)}-o${x}`,active:x===this._active,href:u.href,cls:f,onHover:()=>this._active=x,onChoose:y=>s(this,G,$f).call(this,y,u)},b)};return c`<div class="wrap">
|
|
658
663
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
659
664
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
660
665
|
|
|
661
|
-
<input id="${r(this,
|
|
662
|
-
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${
|
|
663
|
-
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
664
|
-
aria-activedescendant=${t&&this._active>=0?`${r(this,
|
|
666
|
+
<input id="${r(this,st)}-in" part="input" type="search" role="combobox" enterkeyhint="search" autocomplete="off" spellcheck="false"
|
|
667
|
+
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${ce(this.value)}
|
|
668
|
+
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,st)}-list"
|
|
669
|
+
aria-activedescendant=${t&&this._active>=0?`${r(this,st)}-o${this._active}`:h}
|
|
665
670
|
aria-keyshortcuts=${this.shortcut||h}
|
|
666
|
-
@input=${r(this,
|
|
671
|
+
@input=${r(this,Yd)} @keydown=${r(this,Xd)}
|
|
667
672
|
@focus=${()=>{this.value.trim()&&(this.open=!0)}} @click=${()=>{this.value.trim()&&(this.open=!0)}} />
|
|
668
|
-
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,G,
|
|
673
|
+
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,G,vp).call(this)}><cm-icon name="close" size="14"></cm-icon></button>`:this.shortcut?c`<kbd aria-hidden="true">${this.shortcut}</kbd>`:h}
|
|
669
674
|
</div>
|
|
670
675
|
<div class="pop" part="popover" ?hidden=${!t} @pointerdown=${u=>u.preventDefault()}>
|
|
671
|
-
<div role="listbox" id="${r(this,
|
|
672
|
-
${d.map((u,
|
|
673
|
-
${
|
|
674
|
-
${u.items.map(
|
|
675
|
-
${u.href?
|
|
676
|
+
<div role="listbox" id="${r(this,st)}-list" part="listbox" aria-label=${this.label} ?hidden=${!e.length}>
|
|
677
|
+
${d.map((u,b)=>{let f=u.total??u.items.length;return c`<div role="group" aria-labelledby="${r(this,st)}-g${b}">
|
|
678
|
+
${Cd(`${r(this,st)}-g${b}`,u.label,this.formatNumber(f),this.t("results",{count:f}))}
|
|
679
|
+
${u.items.map(x=>p({group:u,item:x,href:x.href},Ld(x)))}
|
|
680
|
+
${u.href?p({group:u,href:u.href},c`<span class="text">${u.seeAllLabel||this.seeAllLabel}</span>`,"all"):h}
|
|
676
681
|
</div>`})}
|
|
677
682
|
</div>
|
|
678
683
|
${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>`}
|
|
679
684
|
</div>
|
|
680
685
|
<span class="vh" role="status" aria-live="polite">${a}</span>
|
|
681
|
-
</div>`}};
|
|
686
|
+
</div>`}};st=new WeakMap,el=new WeakMap,G=new WeakSet,Gd=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}]:[]])},Qo=function(){return this.open&&!!this.value.trim()},Vt=new WeakMap,Ua=function(){this.open=!1,this._active=-1},bp=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},Yd=new WeakMap,wf=function(e){this._active=Dd(this._active,e,s(this,G,Gd).call(this).length)},Xd=new WeakMap,tl=new WeakMap,vp=function(e=!0){this.value="",s(this,G,Ua).call(this),e&&this.renderRoot.querySelector("input")?.focus(),s(this,G,bp).call(this)},$f=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,G,Ua).call(this)},Er.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},Er.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}},Er.styles=[E,it,Ha,wi,_d,w`
|
|
682
687
|
:host { display: block; position: relative; }
|
|
683
688
|
.wrap { position: relative; }
|
|
684
689
|
.box {
|
|
@@ -708,15 +713,15 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
708
713
|
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
709
714
|
}
|
|
710
715
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
711
|
-
`];$("cm-global-search",
|
|
716
|
+
`];$("cm-global-search",Er);var yp=0,kf="";function xp(){yp++===0&&(kf=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function il(){yp>0&&--yp===0&&(document.documentElement.style.overflow=kf)}function wp(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var Ka,Ut,Wa,Ga,Jd,Zd,Qd,eh,th,ih,ie=class extends T{constructor(){super(...arguments);m(this,Ga);this.open=!1;this.label="";this.uid=R("cm-ovl");m(this,Ka,null);m(this,Ut,!1);m(this,Wa,!1);m(this,Zd,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});m(this,Qd,e=>{e.preventDefault(),this.requestClose("escape")});m(this,eh,()=>{this.open&&!this.dialog?.open&&(this.open=!1,s(this,Ga,Jd).call(this))});m(this,th,e=>{g(this,Wa,e.target===e.currentTarget)});m(this,ih,e=>{if(e.target===e.currentTarget&&r(this,Wa)){let t=e.currentTarget.getBoundingClientRect();(!(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom)||this.backdropFillsDialog)&&this.requestClose("backdrop")}g(this,Wa,!1)});this.backdropFillsDialog=!1}show(){this.open=!0}close(){this.open=!1}requestClose(e="method"){let t=this.dispatchEvent(new CustomEvent("cm-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0}));return t&&(this.open=!1),t}closeNow(){this.open=!1;let e=this.dialog;e?.open&&(e.close(),s(this,Ga,Jd).call(this))}get dialog(){return this.renderRoot?.querySelector("dialog")}updated(e){if(super.updated(e),!e.has("open"))return;let t=this.dialog;if(t)if(this.open&&!t.open){if(g(this,Ka,wp()),!this.isConnected)return;t.showModal(),r(this,Ut)||(xp(),g(this,Ut,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),s(this,Ga,Jd).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,Ut)&&(il(),g(this,Ut,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
712
717
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
713
718
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
714
719
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
715
720
|
</header>`}renderDialog(e,t=""){return c`<dialog part="dialog" class=${t}
|
|
716
721
|
aria-labelledby=${this.heading?`${this.uid}-h`:h}
|
|
717
722
|
aria-label=${!this.heading&&this.label?this.label:h}
|
|
718
|
-
@keydown=${r(this,
|
|
719
|
-
@pointerdown=${r(this,
|
|
723
|
+
@keydown=${r(this,Zd)} @cancel=${r(this,Qd)} @close=${r(this,eh)}
|
|
724
|
+
@pointerdown=${r(this,th)} @click=${r(this,ih)}>${e}</dialog>`}};Ka=new WeakMap,Ut=new WeakMap,Wa=new WeakMap,Ga=new WeakSet,Jd=function(){r(this,Ut)&&(il(),g(this,Ut,!1));let e=r(this,Ka);g(this,Ka,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},Zd=new WeakMap,Qd=new WeakMap,eh=new WeakMap,th=new WeakMap,ih=new WeakMap,ie.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},ie.overlayStyles=[E,w`
|
|
720
725
|
:host { display: contents; }
|
|
721
726
|
dialog {
|
|
722
727
|
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
@@ -748,16 +753,16 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
748
753
|
|
|
749
754
|
}
|
|
750
755
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
751
|
-
`];var
|
|
756
|
+
`];var S$=z("commandPalette",{label:"Command palette",placeholder:"Search or run a command",recent:"Recent",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all"}),Ef=o=>o.normalize("NFD").replace(/\p{M}/gu,"").toLocaleLowerCase();function Mf(o,n){let e=Ef(n).split(/\s+/).filter(Boolean);if(!e.length)return!0;let t=Ef([o.title,...o.keywords??[]].join(" "));return e.every(i=>t.includes(i))}var al,xe,$p,kp,rl,rh,ah,Tf,zf,Ya=class extends ie{constructor(){super();m(this,xe);this.value="";this.results=[];this.actions=[];this.recent=[];this.loading=!1;this.shortcut="";this._active=-1;m(this,al,e=>{!this.shortcut||e.defaultPrevented||e.repeat||!fp(e,this.shortcut)||!this.open&&!gp(this.shortcut)&&Kd(e)||this.open&&!gp(this.shortcut)||(e.preventDefault(),this.toggle())});m(this,rh,e=>{this.value=e.target.value,this._active=s(this,xe,rl).call(this).length?0:-1,this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))});m(this,ah,e=>{let t=s(this,xe,rl).call(this).length;switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this._active=Dd(this._active,e.key==="ArrowDown"?1:-1,t);break;case"Home":case"End":if(e.shiftKey||!t)break;e.preventDefault(),this._active=e.key==="Home"?0:t-1;break;case"Enter":if(e.isComposing||this._active<0)break;e.preventDefault(),this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.click();break;default:}});this.label=void 0}toggle(){this.open?this.requestClose("method"):this.show()}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",r(this,al))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",r(this,al))}willUpdate(e){if(super.willUpdate?.(e),e.has("open")&&!this.open&&e.get("open")&&(this.value="",this._active=-1),["results","actions","recent","loading","value","open"].some(t=>e.has(t))){let t=s(this,xe,rl).call(this).length;(this._active>=t||this._active<0)&&(this._active=t?0:-1)}}updated(e){super.updated(e),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.scrollIntoView({block:"nearest"})}focusFirst(){let e=this.renderRoot.querySelector("input");e?.focus(),e?.select()}render(){let e=this.open?s(this,xe,kp).call(this):[],t=s(this,xe,rl).call(this,e),i=r(this,xe,$p),a=t.filter(u=>u.item).length,l=!this.open||!i?"":this.loading?this.loadingText:t.length?this.t("results",{count:a}):this.emptyText,d=this.uid,p=-1;return this.renderDialog(c`<div class="panel" part="panel">
|
|
752
757
|
<div class="top">
|
|
753
758
|
<div class="box" part="box">
|
|
754
759
|
<cm-icon name="search" size="16"></cm-icon>
|
|
755
760
|
<input id="${d}-in" part="input" type="text" role="combobox" enterkeyhint="go" autocomplete="off" spellcheck="false"
|
|
756
|
-
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${
|
|
761
|
+
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${ce(this.value)}
|
|
757
762
|
aria-autocomplete="list" aria-expanded=${t.length?"true":"false"} aria-controls="${d}-list"
|
|
758
763
|
aria-activedescendant=${this._active>=0&&t.length?`${d}-o${this._active}`:h}
|
|
759
|
-
@input=${r(this,
|
|
760
|
-
<kbd class="esc" aria-hidden="true">${
|
|
764
|
+
@input=${r(this,rh)} @keydown=${r(this,ah)} />
|
|
765
|
+
<kbd class="esc" aria-hidden="true">${Wd("escape")[0]}</kbd>
|
|
761
766
|
</div>
|
|
762
767
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel} @click=${()=>this.requestClose("close-button")}>
|
|
763
768
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
@@ -765,15 +770,15 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
765
770
|
<div class="list" part="results" @pointerdown=${u=>{u.target.closest?.("[role=option]")&&u.preventDefault()}}>
|
|
766
771
|
${this.loading&&i?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText}</span></p>`:h}
|
|
767
772
|
<div role="listbox" id="${d}-list" part="listbox" aria-label=${this.label} ?hidden=${!t.length}>
|
|
768
|
-
${e.map((u,
|
|
769
|
-
${
|
|
770
|
-
${u.rows.map(
|
|
773
|
+
${e.map((u,b)=>c`<div role="group" aria-labelledby="${d}-g${b}">
|
|
774
|
+
${Cd(`${d}-g${b}`,u.group.label,u.group.total!==void 0?this.formatNumber(u.group.total):void 0,this.t("results",{count:u.group.total??0}))}
|
|
775
|
+
${u.rows.map(f=>{let x=++p,y=f.item;return Sd({id:`${d}-o${x}`,active:x===this._active,href:f.href,cls:y?"":"all",keyshortcuts:y?.shortcut?xf(y.shortcut):void 0,onHover:()=>this._active=x,onChoose:k=>s(this,xe,Tf).call(this,k,f)},y?Ld(y,s(this,xe,zf).call(this,y.shortcut)):c`<span class="text">${f.group.seeAllLabel||this.seeAllLabel}</span>`)})}
|
|
771
776
|
</div>`)}
|
|
772
777
|
</div>
|
|
773
778
|
${i&&!this.loading&&!t.length?c`<p class="message" aria-hidden="true">${this.emptyText}</p>`:h}
|
|
774
779
|
</div>
|
|
775
780
|
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
776
|
-
</div>`)}};
|
|
781
|
+
</div>`)}};al=new WeakMap,xe=new WeakSet,$p=function(){return this.value.trim()},kp=function(){let e=r(this,xe,$p),t=[],i=(a,l,d=!1)=>{let p=l.map(u=>({group:a,item:u,href:u.href}));d&&a.href&&p.push({group:a,href:a.href}),l.length&&t.push({group:a,rows:p})};if(!e)this.recent?.length&&i({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let a of this.results??[])a?.items?.length&&i(a,a.items,!0);for(let a of this.actions??[])a?.items?.length&&i(a,e?a.items.filter(l=>Mf(l,e)):a.items);return t},rl=function(e=s(this,xe,kp).call(this)){return e.flatMap(t=>t.rows)},rh=new WeakMap,ah=new WeakMap,Tf=function(e,t){if(this.closeNow(),!this.dispatchEvent(new CustomEvent("cm-select",{detail:{item:t.item,group:t.group,href:t.href},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}t.item?.run?.(t.item)},zf=function(e){return e?c`<span class="keys" aria-hidden="true">${Wd(e).map(t=>c`<kbd>${t}</kbd>`)}</span>`:h},Ya.properties={...ie.properties,label:{string:"label"},placeholder:{string:"placeholder"},value:{},results:{type:Array},actions:{type:Array},recent:{type:Array},loading:{type:Boolean,reflect:!0},shortcut:{},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},recentLabel:{attribute:"recent-label",string:"recent"},seeAllLabel:{attribute:"see-all-label",string:"seeAll"},_active:{state:!0}},Ya.styles=[...ie.overlayStyles,Ha,wi,_d,w`
|
|
777
782
|
dialog {
|
|
778
783
|
position: fixed; inset: 0; margin: max(var(--cm-space-16), 12dvh) auto auto; height: fit-content;
|
|
779
784
|
width: min(var(--cm-command-palette-width, 640px), calc(100vw - 32px));
|
|
@@ -814,20 +819,20 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
814
819
|
.x { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
815
820
|
[role='option'] { min-height: var(--cm-control-height-touch); }
|
|
816
821
|
}
|
|
817
|
-
`];$("cm-command-palette",
|
|
822
|
+
`];$("cm-command-palette",Ya);var Qy=/^(\d{4})-(\d{2})-(\d{2})$/;function N(o){let n=Qy.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"),P=o=>`${Mt(o.getFullYear(),4)}-${Mt(o.getMonth()+1)}-${Mt(o.getDate())}`,Ep=()=>P(new Date),Y=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function nt(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 Kt=o=>new Date(o.getFullYear(),o.getMonth(),1),Xa=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var ex=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function Mr(o){let n=ex.exec(o??"");return n?+n[1]*60+ +n[2]:null}var sl=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${Mt(Math.floor(n/60))}:${Mt(n%60)}`};function ot(o){let[n="",e=""]=(o??"").split("T"),t=Mr(e);return{date:N(n)?n:"",time:t===null?"":sl(t)}}function Tt(o,n=!1){let{date:e,time:t}=ot(o),i=N(e);if(!i)return null;let a=t?Mr(t):n?1439:0;return new Date(i.getFullYear(),i.getMonth(),i.getDate(),Math.floor(a/60),a%60)}var Lf=()=>{let o=new Date;return`${P(o)}T${Mt(o.getHours())}:${Mt(o.getMinutes())}`},_f=new Map;function sh(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,i=_f.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,p=k=>new Date(2e3,0,1,k,30),u=k=>(new Intl.DateTimeFormat(o,{hour:"numeric",hourCycle:"h12"}).formatToParts(p(k)).find(S=>S.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),b=(k,S)=>[...new Set([k,...S].filter(Boolean))],f=k=>k.replace(/[\u202f\u00a0]/g," "),x=f(l.formatToParts(p(9)).map(k=>k.type==="hour"?"{h}":k.type==="minute"?"{m}":k.value).join("")),y={format:k=>f(l.format(new Date(2e3,0,1,Math.floor(k/60),k%60))),dateTime:k=>ne(k,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",...e?{hourCycle:e}:{}},o),pattern:x,hour12:d==="h12"||d==="h11",am:b(u(9),["am","a"]),pm:b(u(15),["pm","p"])};return _f.set(t,y),y}var Sf=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function Mp(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,p;if(l.length===1){let u=l[0];if(u.length<=2)d=+u,p=0;else if(u.length<=4)d=+u.slice(0,-2),p=+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],p=+l[1]}else return null;if(p>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 sl(d*60+p)}var Ja={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},nl=o=>Array.isArray(o)?o:typeof o=="string"?Ja.fromAttribute(o):[];function Za(o,n){let e=[n,$o(o)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function Qa(o){try{let n=new Intl.Locale(o),e=n.getWeekInfo?.()??n.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var Cf=new Map;function es(o){let n=Cf.get(o);if(n)return n;let e=y=>new Intl.DateTimeFormat(o,y),t=e({day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"}),i=e({weekday:"short"}),a=e({weekday:"long"}),l=new Date(2024,0,7),d=t.formatToParts(new Date(2026,10,15)),p=d.filter(y=>y.type==="day"||y.type==="month"||y.type==="year").map(y=>y.type),u=d.map(y=>y.type==="day"?"{d}":y.type==="month"?"{m}":y.type==="year"?"{y}":y.value).join(""),b=(y,k)=>Array.from({length:12},(S,A)=>new Intl.DateTimeFormat(y,{month:k}).format(new Date(2024,A,1)).toLowerCase().replace(/\./g,"")),f=Array.from({length:12},(y,k)=>[...new Set([b(o,"long")[k],b(o,"short")[k],b("en","long")[k],b("en","short")[k]])]),x={short:y=>t.format(y),long:y=>ne(y,{weekday:"long",day:"numeric",month:"long",year:"numeric"},o),medium:y=>ne(y,{day:"numeric",month:"short",year:"numeric"},o),monthYear:y=>ne(y,{month:"long",year:"numeric"},o),day:y=>ne(y,{day:"numeric"},o),weekdaysShort:Array.from({length:7},(y,k)=>i.format(Y(l,k))),weekdaysLong:Array.from({length:7},(y,k)=>a.format(Y(l,k))),pattern:p.length===3?u:"{y}-{m}-{d}",order:p.length===3?p:["year","month","day"],months:f};return Cf.set(o,x),x}var nh=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function oh(o,n){let e=o.trim().toLowerCase();if(!e)return null;let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);if(t.length!==3)return null;let i,a,l,d=t.findIndex(u=>/\p{L}/u.test(u));if(d>=0){let u=t[d];a=n.months.findIndex(y=>y.some(k=>k===u||u.length>=3&&k.startsWith(u)))+1;let b=t.filter((y,k)=>k!==d);if(!a||b.some(y=>!/^\d+$/.test(y)))return null;let f=b.findIndex(y=>y.length===4),x=f>=0?f:1;i=+b[x],l=+b[1-x],b[x].length<=2&&(i+=2e3)}else{if(t.some(f=>!/^\d+$/.test(f)))return null;let u=t[0].length===4?["year","month","day"]:n.order,b=f=>t[u.indexOf(f)];if(i=+b("year"),a=+b("month"),l=+b("day"),b("year").length<=2)i+=2e3;else if(b("year").length!==4)return null}let p=`${Mt(i,4)}-${Mt(a)}-${Mt(l)}`;return N(p)?p:null}function lh(o,n,e,t){let i=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return Y(e,1);case"ArrowLeft":return Y(e,-1);case"ArrowDown":return Y(e,7);case"ArrowUp":return Y(e,-7);case"Home":return Y(e,-i);case"End":return Y(e,6-i);case"PageDown":return nt(e,n.shiftKey?12:1);case"PageUp":return nt(e,n.shiftKey?-12:-1);default:return null}}var Ti=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function ch(o){let{fmt:n,firstDay:e,month:t,focus:i,min:a,max:l}=o,d=Kt(t),p=(d.getDay()-e+7)%7,u=Xa(t).getDate(),b=[],f=Array(p).fill(null);for(let A=1;A<=u;A++)f.push(new Date(t.getFullYear(),t.getMonth(),A)),f.length===7&&(b.push(f),f=[]);f.length&&b.push([...f,...Array(7-f.length).fill(null)]);let x=Array.from({length:7},(A,q)=>(q+e)%7),y=Ep(),k=!!a&&Xa(nt(d,-1))<a,S=!!l&&nt(d,1)>l;return c`<div class="cal-head">
|
|
818
823
|
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.previousLabel} ?disabled=${k} @click=${()=>o.onMonth(-1)}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
819
824
|
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
820
|
-
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${
|
|
825
|
+
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${S} @click=${()=>o.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
821
826
|
</div>
|
|
822
827
|
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${o.id}-month" @keydown=${o.onKey}>
|
|
823
|
-
<thead><tr>${
|
|
824
|
-
<tbody>${
|
|
828
|
+
<thead><tr>${x.map(A=>c`<th scope="col" abbr=${n.weekdaysLong[A]}><span aria-hidden="true">${n.weekdaysShort[A]}</span><span class="vh">${n.weekdaysLong[A]}</span></th>`)}</tr></thead>
|
|
829
|
+
<tbody>${b.map(A=>c`<tr>${A.map(q=>{if(!q)return c`<td class="empty"></td>`;let B=P(q),K=o.isDisabled(q)||!!a&&q<a||!!l&&q>l,tt=o.mark(q),W=o.note?.(q);return c`<td class="day ${tt} ${B===y?"today":""}" data-date=${B}
|
|
825
830
|
tabindex=${B===P(i)?"0":"-1"}
|
|
826
|
-
aria-selected=${
|
|
831
|
+
aria-selected=${tt?"true":"false"} aria-disabled=${K?"true":h}
|
|
827
832
|
aria-current=${B===y?"date":h}
|
|
828
|
-
aria-label="${n.long(
|
|
829
|
-
@click=${()=>!K&&o.onPick(
|
|
830
|
-
</table>`}var
|
|
833
|
+
aria-label="${n.long(q)}${W?`, ${W}`:""}"
|
|
834
|
+
@click=${()=>!K&&o.onPick(q)} @pointerenter=${()=>o.onHover?.(q)}><span aria-hidden="true">${n.day(q)}</span></td>`})}</tr>`)}</tbody>
|
|
835
|
+
</table>`}var dh=w`
|
|
831
836
|
.pop {
|
|
832
837
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-8)); inset-inline-start: 0;
|
|
833
838
|
width: max-content; max-width: calc(100vw - 32px); padding: var(--cm-space-12);
|
|
@@ -859,8 +864,8 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
859
864
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
860
865
|
}
|
|
861
866
|
@media (max-width: 640px) { .day, .empty { height: 36px; } }
|
|
862
|
-
`;function
|
|
863
|
-
${
|
|
867
|
+
`;function hh(o,n){if(o.key!=="Tab")return;let e=[...n.querySelectorAll('button:not([disabled]), [role=grid] td[tabindex="0"]')];if(!e.length)return;let t=n.getRootNode(),i=e.indexOf(t.activeElement);o.preventDefault(),e[(i+(o.shiftKey?-1:1)+e.length)%e.length].focus()}var mh=w`
|
|
868
|
+
${rt}
|
|
864
869
|
:host { display: block; position: relative; }
|
|
865
870
|
.wrap { position: relative; }
|
|
866
871
|
.box {
|
|
@@ -891,69 +896,70 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
891
896
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
892
897
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
893
898
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
894
|
-
`;var
|
|
895
|
-
${this.label?c`<label class="label" for="${r(this,
|
|
899
|
+
`;var U$=z("datePicker",{choose:"Choose date",chooseFor:"Choose date for {label}",change:"Change date, {date}",changeFor:"Change date for {label}, {date}",dialog:"Choose date",previousMonth:"Previous month",nextMonth:"Next month",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badInput:"Enter a date like {pattern}.",required:"Enter or choose a date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"This date isn't available. Choose another date.",time:"Time",timeFor:"Time for {label}",patternHour:"hh",patternMinute:"mm",badTime:"Enter a time like {pattern}.",timeMissing:"Enter a time.",stepMismatch:{one:"Choose a time on the minute.",other:"Choose a time in steps of {count} minutes."}}),as,me,_r,lt,ss,Xt,Li,Ie,Ke,ns,os,M,ol,zi,ls,ph,Tr,ts,Wt,_i,Gt,Yt,uh,Tp,gh,is,zr,fh,zp,Df,bh,Af,Rf,Jt,cs,_p,rs,ll,cl,Cp,Hf,vh,Lp,Sp,yh,xh,wh,$h,kh,dl,Ci=class extends T{constructor(){super(...arguments);m(this,M);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.min="";this.max="";this.placeholder="";m(this,as,"");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._dateError="";this._timeError="";this._focus=new Date;m(this,me,this.attachInternals());m(this,_r,new ee(this,r(this,me)));m(this,lt,R("cm-dp"));m(this,ss,null);m(this,Xt,!1);m(this,Li,!1);m(this,Ie,"");m(this,Ke,"");m(this,ns,!1);m(this,os,"");m(this,ls,!1);m(this,Jt,new Ee);m(this,cs,!1);m(this,vh,e=>{e.key==="Enter"?s(this,M,Cp).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),s(this,M,Hf).call(this,e.key==="ArrowUp"?1:-1))});m(this,yh,()=>{this.disabled||(this.open?this.open=!1:(s(this,M,cl).call(this),this.show()))});m(this,xh,e=>{e.key==="Enter"?s(this,M,cl).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),s(this,M,cl).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});m(this,wh,e=>{let t=lh(J(e,this),e,this._focus,r(this,M,Tp));if(t){e.preventDefault(),this._focus=Ti(t,r(this,M,Gt),r(this,M,Yt)),g(this,Li,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,M,Lp).call(this,this._focus))});m(this,$h,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,M,Sp).call(this);return}hh(e,e.currentTarget)});m(this,kh,e=>{this._focus=Ti(nt(this._focus,e),r(this,M,Gt),r(this,M,Yt))});m(this,dl,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,as)}set locale(e){let t=r(this,as);g(this,as,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,ss)===null&&g(this,ss,this.value),document.addEventListener("pointerdown",r(this,dl),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,Jt).close(),document.removeEventListener("pointerdown",r(this,dl),!0)}get form(){return r(this,me).form}get validity(){return r(this,me).validity}get validationMessage(){return r(this,me).validationMessage}get valueAsDate(){return this.time?this.value?Tt(this.value):null:N(this.value)}checkValidity(){return s(this,M,bh).call(this),r(this,me).checkValidity()}reportValidity(){return s(this,M,bh).call(this),r(this,_r).report(()=>r(this,me).reportValidity())}formResetCallback(){r(this,_r).reset(),this._dateError=this._timeError="",this.value=r(this,ss)??"",this.time&&(s(this,M,zp).call(this,this.value),g(this,M,s(this,M,zr).call(this,r(this,Ke)),zi)),this._text=s(this,M,is).call(this,r(this,M,Wt)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(s(this,M,Df).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=r(this,M,Gt),a=r(this,M,Yt);return i&&t<i||a&&t>a?!0:nl(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!r(this,ls)?(s(this,M,zp).call(this,this.value),r(this,ns)||g(this,M,s(this,M,zr).call(this,r(this,Ke)),zi)):this.time&&(e.has("locale")||e.has("hourCycle"))&&r(this,Ke)&&g(this,M,s(this,M,zr).call(this,r(this,Ke)),zi),(e.has("value")||e.has("time"))&&!r(this,Xt)?this._text=s(this,M,is).call(this,r(this,M,Wt)):e.has("locale")&&N(r(this,M,Wt))&&(this._text=s(this,M,is).call(this,r(this,M,Wt))),e.has("value")&&!r(this,cs)&&(this._dateError=this._timeError=""),g(this,cs,!1),g(this,Xt,!1),g(this,ns,!1),g(this,ls,!1)}updated(e){this.open&&!r(this,Jt).active?r(this,Jt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,Jt).active?r(this,Jt).close():this.open&&r(this,Jt).place(),r(this,me).setFormValue(this.value||null,this.time?this.value:this._text),s(this,M,bh).call(this),this.open&&r(this,Li)&&(g(this,Li,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&g(this,Li,!1)}render(){let e=r(this,M,Tr),t=N(r(this,M,Wt)),i=[this._dateError,this._timeError].filter(Boolean).join(" "),a=r(this,_r).message,l=this.error||i||a,d=!this.error&&!i&&!!a,p=[l&&`${r(this,lt)}-err`,this.helpText&&`${r(this,lt)}-help`].filter(Boolean).join(" "),u=this.getAttribute("aria-label"),b=this.label||u||"",f=Kt(this._focus);return c`<div class="field">
|
|
900
|
+
${this.label?c`<label class="label" for="${r(this,lt)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
896
901
|
<div class="wrap ${this.time?"timed":""}">
|
|
897
|
-
<div class="box ${this._dateError&&!this.error?"invalid":""}" part="box">
|
|
898
|
-
<input id="${r(this,
|
|
899
|
-
.value=${
|
|
900
|
-
aria-label=${!this.label&&
|
|
902
|
+
<div class="box ${this._dateError&&!this.error||d?"invalid":""}" part="box">
|
|
903
|
+
<input id="${r(this,lt)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
904
|
+
.value=${ce(this._text)} placeholder=${this.placeholder||r(this,M,gh)}
|
|
905
|
+
aria-label=${!this.label&&u?u:h}
|
|
901
906
|
?required=${this.required} ?disabled=${this.disabled}
|
|
902
|
-
aria-invalid=${
|
|
903
|
-
@input=${
|
|
904
|
-
@change=${()=>s(this,M,
|
|
907
|
+
aria-invalid=${l?"true":h} aria-describedby=${p||h}
|
|
908
|
+
@input=${x=>{x.stopPropagation(),this._text=x.target.value}}
|
|
909
|
+
@change=${()=>s(this,M,cl).call(this)} @keydown=${r(this,xh)} />
|
|
905
910
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
906
|
-
aria-label=${t?this.t(
|
|
907
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
908
|
-
@click=${r(this,
|
|
911
|
+
aria-label=${t?this.t(b?"changeFor":"change",{label:b,date:e.long(t)}):this.t(b?"chooseFor":"choose",{label:b})}
|
|
912
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,lt)}-pop"
|
|
913
|
+
@click=${r(this,yh)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
909
914
|
</div>
|
|
910
|
-
${this.time?c`<div class="box time ${this._timeError&&!this.error?"invalid":""}" part="time-box">
|
|
915
|
+
${this.time?c`<div class="box time ${this._timeError&&!this.error||d?"invalid":""}" part="time-box">
|
|
911
916
|
<input class="time-in" part="time-input" type="text" autocomplete="off" spellcheck="false"
|
|
912
|
-
.value=${
|
|
913
|
-
aria-label=${this.t(
|
|
917
|
+
.value=${ce(r(this,M,ol))} placeholder=${r(this,M,fh)}
|
|
918
|
+
aria-label=${this.t(b?"timeFor":"time",{label:b})}
|
|
914
919
|
?required=${this.required} ?disabled=${this.disabled}
|
|
915
|
-
aria-invalid=${
|
|
916
|
-
@input=${
|
|
917
|
-
@change=${()=>s(this,M,
|
|
920
|
+
aria-invalid=${l?"true":h} aria-describedby=${p||h}
|
|
921
|
+
@input=${x=>{x.stopPropagation(),g(this,M,x.target.value,zi)}}
|
|
922
|
+
@change=${()=>s(this,M,Cp).call(this)} @keydown=${r(this,vh)} />
|
|
918
923
|
</div>`:h}
|
|
919
|
-
<div class="pop" id="${r(this,
|
|
920
|
-
?hidden=${!this.open} @keydown=${r(this
|
|
921
|
-
${this.open?c`<div class="cal">${
|
|
924
|
+
<div class="pop" id="${r(this,lt)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
925
|
+
?hidden=${!this.open} @keydown=${r(this,$h)}>
|
|
926
|
+
${this.open?c`<div class="cal">${ch({id:r(this,lt),fmt:e,firstDay:r(this,M,Tp),month:f,focus:this._focus,min:r(this,M,Gt),max:r(this,M,Yt),isDisabled:x=>this.isUnavailable(P(x)),mark:x=>t&&P(x)===r(this,M,Wt)?"selected":"",onPick:x=>s(this,M,Lp).call(this,x),onKey:r(this,wh),onMonth:r(this,kh),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:h}
|
|
922
927
|
</div>
|
|
923
928
|
</div>
|
|
924
|
-
${
|
|
925
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
926
|
-
</div>`}};Oa=new WeakMap,he=new WeakMap,rt=new WeakMap,qa=new WeakMap,Kt=new WeakMap,Mi=new WeakMap,He=new WeakMap,Be=new WeakMap,Ba=new WeakMap,Fa=new WeakMap,M=new WeakSet,Oo=function(){return r(this,Fa)},$i=function(e){e!==r(this,Fa)&&(b(this,Fa,e),this.requestUpdate())},ja=new WeakMap,jd=function(){return Aa(this,this.locale)},gr=function(){return Ha(r(this,M,jd))},Na=function(){return Hd(r(this,M,jd),this.hourCycle)},jt=function(){return this.time?r(this,He):this.value},ki=function(e){return this.time&&e.trim().toLowerCase()==="now"?eb():e},Ut=function(){return N(it(s(this,M,ki).call(this,this.min)).date||this.min)},Vt=function(){return N(it(s(this,M,ki).call(this,this.max)).date||this.max)},Ud=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Qm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,M,jd)):(Math.trunc(e)%7+7)%7},Vd=function(){return Nd(r(this,M,gr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Ia=function(e){let t=N(e);return t?r(this,M,gr).short(t):e},br=function(e){let t=ur(e);return t===null?"":r(this,M,Na).format(t)},Kd=function(){return tb(r(this,M,Na),{h:this.t("patternHour"),m:this.t("patternMinute")})},ep=function(e){let{date:t,time:i}=it(e);b(this,He,t),b(this,Be,t?i:"")},ib=function(){let e=new Date,t=N(r(this,M,jt))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=wi(t,r(this,M,Ut),r(this,M,Vt)),b(this,Mi,!0)},Wd=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,M,jt)),i=r(this,M,gr);this.error?r(this,he).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,he).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,M,Vd)}),e):this.time?s(this,M,rb).call(this,t,e):this.required&&!t?r(this,he).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,Ut)&&t<r(this,M,Ut)?r(this,he).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,Ut))}),e):t&&r(this,M,Vt)&&t>r(this,M,Vt)?r(this,he).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,Vt))}),e):t&&this.isUnavailable(this.value)?r(this,he).setValidity({customError:!0},this.t("unavailable"),e):r(this,he).setValidity({})},rb=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(g,w,y,k=t)=>r(this,he).setValidity(g,this.t(w,y),k),l=ur(r(this,Be));if(r(this,M,Oo).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,M,Kd)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,he).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=kt(`${r(this,He)}T${r(this,Be)}`),m=kt(s(this,M,ki).call(this,this.min)),u=kt(s(this,M,ki).call(this,this.max),!0),v=(g,w)=>it(g).time?r(this,M,Na).dateTime(w):r(this,M,gr).medium(w);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,M,ki).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,M,ki).call(this,this.max),u)},i);if(l%r(this,M,Ud))return a({stepMismatch:!0},"stepMismatch",{count:r(this,M,Ud)},i);if(this.isUnavailable(r(this,He)))return a({customError:!0},"unavailable");r(this,he).setValidity({})},Wt=new WeakMap,Ua=new WeakMap,tp=function(e){e!==this.value&&(b(this,Ua,!0),this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Pa=function(e,t){b(this,He,e),b(this,Be,t);let i=e&&t?`${e}T${t}`:"";b(this,ja,!0),this.requestUpdate(),s(this,M,tp).call(this,i)},qo=function(e){this.time?s(this,M,Pa).call(this,e,r(this,Be)):s(this,M,tp).call(this,e)},Bo=function(){let e=this._text.trim();if(this._dateError="",!e){s(this,M,qo).call(this,"");return}let t=Id(e,r(this,M,gr));t?(s(this,M,qo).call(this,t),this._text=s(this,M,Ia).call(this,t)):(b(this,Kt,!0),s(this,M,qo).call(this,""),this._dateError=this.t("badInput",{pattern:r(this,M,Vd)}))},ip=function(){let e=r(this,M,Oo).trim(),t=e?Zm(e,r(this,M,Na)):"";if(b(this,Kt,!0),t===null){b(this,Ba,!0),s(this,M,Pa).call(this,r(this,He),""),this._timeError=this.t("badTime",{pattern:r(this,M,Kd)});return}this._timeError="",s(this,M,Pa).call(this,r(this,He),t),b(this,M,s(this,M,br).call(this,t),$i)},ab=function(e){let t=r(this,M,Ud),i=Zm(r(this,M,Oo),r(this,M,Na));if(!i){let m=it(s(this,M,ki).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,He)||r(this,He)===m.date)?m.time:Io(u.getHours()*60+u.getMinutes()),ur(i)%t===0){b(this,Kt,!0),s(this,M,Pa).call(this,r(this,He),i),b(this,M,s(this,M,br).call(this,i),$i);return}e=1}let a=ur(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=Io(l>=1440?0:l<0?Math.floor(1439/t)*t:l);b(this,Kt,!0),s(this,M,Pa).call(this,r(this,He),d),b(this,M,s(this,M,br).call(this,d),$i)},Gd=new WeakMap,rp=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,M,qo).call(this,t),this._text=s(this,M,Ia).call(this,t),this._dateError="",this.time&&!r(this,Be)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,M,ap).call(this))},ap=function(){this.renderRoot.querySelector(".trigger")?.focus()},Yd=new WeakMap,Xd=new WeakMap,Jd=new WeakMap,Zd=new WeakMap,Qd=new WeakMap,Fo=new WeakMap,Ei.formAssociated=!0,Ei.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Ei.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:Da},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},_dateError:{state:!0},_timeError:{state:!0},_focus:{state:!0}},Ei.styles=[E,Xe,Fd,qd,x`.pop { min-width: 0; }`];$("cm-date-picker",Ei);var g1=z("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month"}),Ey={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[Y(o,-1),Y(o,-1)]],"last-7-days":["Last 7 days",o=>[Y(o,-6),o]],"last-30-days":["Last 30 days",o=>[Y(o,-29),o]],"last-90-days":["Last 90 days",o=>[Y(o,-89),o]],"this-month":["This month",o=>[Ft(o),o]],"last-month":["Last month",o=>[Ft(tt(o,-1)),La(tt(o,-1))]]},My=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function sb(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=Ey[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(My(o))||t[0],start:P(a),end:P(l)}}var Wa,fe,Fe,Ga,Ya,zi,I,sp,Va,np,Yt,eh,Gt,Xt,nb,th,Ka,op,ob,ih,rh,ah,sh,nh,jo,lp,Ti=class extends T{constructor(){super(...arguments);p(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,Wa,"");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,fe,this.attachInternals());p(this,Fe,R("cm-drp"));p(this,Ga,null);p(this,Ya,!1);p(this,zi,!1);p(this,Yt,"start");p(this,Xt,new ke);p(this,rh,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,Ka).call(this,"start"),s(this,I,Ka).call(this,"end"),this.show()))});p(this,ah,e=>t=>{t.key==="Enter"?s(this,I,Ka).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,Ka).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,sh,e=>{let t=Pd(J(e,this),e,this._focus,r(this,I,np));if(t){e.preventDefault(),this._focus=wi(t,N(this.min),N(this.max)),b(this,zi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,op).call(this,this._focus))});p(this,nh,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,ih).call(this);return}Bd(e,e.currentTarget)});p(this,jo,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Wa)}set locale(e){let t=r(this,Wa);b(this,Wa,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Ga)||b(this,Ga,[this.start,this.end]),document.addEventListener("pointerdown",r(this,jo),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,Xt).close(),document.removeEventListener("pointerdown",r(this,jo),!0)}get form(){return r(this,fe).form}get validity(){return r(this,fe).validity}get validationMessage(){return r(this,fe).validationMessage}checkValidity(){return r(this,fe).checkValidity()}reportValidity(){return r(this,fe).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,Ga)??["",""],this._startText=s(this,I,Gt).call(this,this.start),this._endText=s(this,I,Gt).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=wi(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),b(this,Yt,"start"),b(this,zi,!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:Po(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,Ya)||(e.has("start")&&(this._startText=s(this,I,Gt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,Gt).call(this,this.end))),b(this,Ya,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,Gt).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,Gt).call(this,this.end)))}updated(){this.open&&!r(this,Xt).active?r(this,Xt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,Xt).active?r(this,Xt).close():this.open&&r(this,Xt).place();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,fe).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let a=this.renderRoot.querySelectorAll("input"),[l,d]=[a[0]??void 0,a[1]??void 0],m=r(this,I,Va),u=N(this.min),v=N(this.max);this.error?r(this,fe).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,fe).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,I,eh)}),l):this._endText.trim()&&!t?r(this,fe).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,eh)}),d):this.required&&(!e||!t)?r(this,fe).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,fe).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,fe).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,fe).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,fe).setValidity({customError:!0},this.t("unavailable"),l):r(this,fe).setValidity({}),this.open&&r(this,zi)&&(b(this,zi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,Va),t=N(this.start),i=N(this.end),a=[this.error&&`${r(this,Fe)}-err`,this.helpText&&`${r(this,Fe)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=Po(this.presets).map(g=>sb(g,new Date,w=>this.t(w))).filter(g=>!!g),u=r(this,Yt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=g=>{let w=g==="start"?this._startText:this._endText;return c`<input id="${r(this,Fe)}-${g}" type="text" autocomplete="off" spellcheck="false"
|
|
927
|
-
.value=${
|
|
928
|
-
aria-label=${
|
|
929
|
+
${l?c`<p class="error" id="${r(this,lt)}-err" role="alert">${l}</p>`:h}
|
|
930
|
+
${this.helpText?c`<p class="help" id="${r(this,lt)}-help">${this.helpText}</p>`:h}
|
|
931
|
+
</div>`}};as=new WeakMap,me=new WeakMap,_r=new WeakMap,lt=new WeakMap,ss=new WeakMap,Xt=new WeakMap,Li=new WeakMap,Ie=new WeakMap,Ke=new WeakMap,ns=new WeakMap,os=new WeakMap,M=new WeakSet,ol=function(){return r(this,os)},zi=function(e){e!==r(this,os)&&(g(this,os,e),this.requestUpdate())},ls=new WeakMap,ph=function(){return Za(this,this.locale)},Tr=function(){return es(r(this,M,ph))},ts=function(){return sh(r(this,M,ph),this.hourCycle)},Wt=function(){return this.time?r(this,Ie):this.value},_i=function(e){return this.time&&e.trim().toLowerCase()==="now"?Lf():e},Gt=function(){return N(ot(s(this,M,_i).call(this,this.min)).date||this.min)},Yt=function(){return N(ot(s(this,M,_i).call(this,this.max)).date||this.max)},uh=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Tp=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Qa(r(this,M,ph)):(Math.trunc(e)%7+7)%7},gh=function(){return nh(r(this,M,Tr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},is=function(e){let t=N(e);return t?r(this,M,Tr).short(t):e},zr=function(e){let t=Mr(e);return t===null?"":r(this,M,ts).format(t)},fh=function(){return Sf(r(this,M,ts),{h:this.t("patternHour"),m:this.t("patternMinute")})},zp=function(e){let{date:t,time:i}=ot(e);g(this,Ie,t),g(this,Ke,t?i:"")},Df=function(){let e=new Date,t=N(r(this,M,Wt))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=Ti(t,r(this,M,Gt),r(this,M,Yt)),g(this,Li,!0)},bh=function(){s(this,M,Af).call(this),r(this,_r).sync()},Af=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,M,Wt)),i=r(this,M,Tr);this.error?r(this,me).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,me).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,M,gh)}),e):this.time?s(this,M,Rf).call(this,t,e):this.required&&!t?r(this,me).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,Gt)&&t<r(this,M,Gt)?r(this,me).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,Gt))}),e):t&&r(this,M,Yt)&&t>r(this,M,Yt)?r(this,me).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,Yt))}),e):t&&this.isUnavailable(this.value)?r(this,me).setValidity({customError:!0},this.t("unavailable"),e):r(this,me).setValidity({})},Rf=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(f,x,y,k=t)=>r(this,me).setValidity(f,this.t(x,y),k),l=Mr(r(this,Ke));if(r(this,M,ol).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,M,fh)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,me).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=Tt(`${r(this,Ie)}T${r(this,Ke)}`),p=Tt(s(this,M,_i).call(this,this.min)),u=Tt(s(this,M,_i).call(this,this.max),!0),b=(f,x)=>ot(f).time?r(this,M,ts).dateTime(x):r(this,M,Tr).medium(x);if(p&&d<p)return a({rangeUnderflow:!0},"rangeUnderflow",{date:b(s(this,M,_i).call(this,this.min),p)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:b(s(this,M,_i).call(this,this.max),u)},i);if(l%r(this,M,uh))return a({stepMismatch:!0},"stepMismatch",{count:r(this,M,uh)},i);if(this.isUnavailable(r(this,Ie)))return a({customError:!0},"unavailable");r(this,me).setValidity({})},Jt=new WeakMap,cs=new WeakMap,_p=function(e){e!==this.value&&(g(this,cs,!0),this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},rs=function(e,t){g(this,Ie,e),g(this,Ke,t);let i=e&&t?`${e}T${t}`:"";g(this,ls,!0),this.requestUpdate(),s(this,M,_p).call(this,i)},ll=function(e){this.time?s(this,M,rs).call(this,e,r(this,Ke)):s(this,M,_p).call(this,e)},cl=function(){let e=this._text.trim();if(this._dateError="",!e){s(this,M,ll).call(this,"");return}let t=oh(e,r(this,M,Tr));t?(s(this,M,ll).call(this,t),this._text=s(this,M,is).call(this,t)):(g(this,Xt,!0),s(this,M,ll).call(this,""),this._dateError=this.t("badInput",{pattern:r(this,M,gh)}))},Cp=function(){let e=r(this,M,ol).trim(),t=e?Mp(e,r(this,M,ts)):"";if(g(this,Xt,!0),t===null){g(this,ns,!0),s(this,M,rs).call(this,r(this,Ie),""),this._timeError=this.t("badTime",{pattern:r(this,M,fh)});return}this._timeError="",s(this,M,rs).call(this,r(this,Ie),t),g(this,M,s(this,M,zr).call(this,t),zi)},Hf=function(e){let t=r(this,M,uh),i=Mp(r(this,M,ol),r(this,M,ts));if(!i){let p=ot(s(this,M,_i).call(this,this.min)),u=new Date;if(i=p.time&&(!r(this,Ie)||r(this,Ie)===p.date)?p.time:sl(u.getHours()*60+u.getMinutes()),Mr(i)%t===0){g(this,Xt,!0),s(this,M,rs).call(this,r(this,Ie),i),g(this,M,s(this,M,zr).call(this,i),zi);return}e=1}let a=Mr(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=sl(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,Xt,!0),s(this,M,rs).call(this,r(this,Ie),d),g(this,M,s(this,M,zr).call(this,d),zi)},vh=new WeakMap,Lp=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,M,ll).call(this,t),this._text=s(this,M,is).call(this,t),this._dateError="",this.time&&!r(this,Ke)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,M,Sp).call(this))},Sp=function(){this.renderRoot.querySelector(".trigger")?.focus()},yh=new WeakMap,xh=new WeakMap,wh=new WeakMap,$h=new WeakMap,kh=new WeakMap,dl=new WeakMap,Ci.formAssociated=!0,Ci.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},Ci.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:Ja},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},_dateError:{state:!0},_timeError:{state:!0},_focus:{state:!0}},Ci.styles=[E,it,mh,dh,w`.pop { min-width: 0; }`];$("cm-date-picker",Ci);var t1=z("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month"}),tx={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[Y(o,-1),Y(o,-1)]],"last-7-days":["Last 7 days",o=>[Y(o,-6),o]],"last-30-days":["Last 30 days",o=>[Y(o,-29),o]],"last-90-days":["Last 90 days",o=>[Y(o,-89),o]],"this-month":["This month",o=>[Kt(o),o]],"last-month":["Last month",o=>[Kt(nt(o,-1)),Xa(nt(o,-1))]]},ix=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Nf(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=tx[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(ix(o))||t[0],start:P(a),end:P(l)}}var ms,ue,Cr,We,ps,us,Di,I,Dp,ds,Ap,Qt,Eh,Zt,ei,If,Mh,hs,Rp,Pf,Th,zh,_h,Ch,Lh,hl,Hp,Si=class extends T{constructor(){super(...arguments);m(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";m(this,ms,"");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;m(this,ue,this.attachInternals());m(this,Cr,new ee(this,r(this,ue)));m(this,We,R("cm-drp"));m(this,ps,null);m(this,us,!1);m(this,Di,!1);m(this,Qt,"start");m(this,ei,new Ee);m(this,zh,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,hs).call(this,"start"),s(this,I,hs).call(this,"end"),this.show()))});m(this,_h,e=>t=>{t.key==="Enter"?s(this,I,hs).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,hs).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});m(this,Ch,e=>{let t=lh(J(e,this),e,this._focus,r(this,I,Ap));if(t){e.preventDefault(),this._focus=Ti(t,N(this.min),N(this.max)),g(this,Di,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,Rp).call(this,this._focus))});m(this,Lh,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,Th).call(this);return}hh(e,e.currentTarget)});m(this,hl,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,ms)}set locale(e){let t=r(this,ms);g(this,ms,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,ps)||g(this,ps,[this.start,this.end]),document.addEventListener("pointerdown",r(this,hl),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,ei).close(),document.removeEventListener("pointerdown",r(this,hl),!0)}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,Cr).report(()=>r(this,ue).reportValidity())}formResetCallback(){[this.start,this.end]=r(this,ps)??["",""],this._startText=s(this,I,Zt).call(this,this.start),this._endText=s(this,I,Zt).call(this,this.end),this.open=!1,r(this,Cr).reset()}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=Ti(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),g(this,Qt,"start"),g(this,Di,!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:nl(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,us)||(e.has("start")&&(this._startText=s(this,I,Zt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,Zt).call(this,this.end))),g(this,us,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,Zt).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,Zt).call(this,this.end)))}updated(){this.open&&!r(this,ei).active?r(this,ei).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,ei).active?r(this,ei).close():this.open&&r(this,ei).place();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,ue).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],p=r(this,I,ds),u=N(this.min),b=N(this.max);this.error?r(this,ue).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,ue).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,I,Eh)}),l):this._endText.trim()&&!t?r(this,ue).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Eh)}),d):this.required&&(!e||!t)?r(this,ue).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,ue).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,ue).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:p.medium(u)}),l):e&&b&&e>b||t&&b&&t>b?r(this,ue).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:p.medium(b)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,ue).setValidity({customError:!0},this.t("unavailable"),l):r(this,ue).setValidity({}),r(this,Cr).sync(),this.open&&r(this,Di)&&(g(this,Di,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,ds),t=N(this.start),i=N(this.end),a=r(this,Cr).message,l=[a&&`${r(this,We)}-err`,this.helpText&&`${r(this,We)}-help`].filter(Boolean).join(" "),d=this.getAttribute("aria-label"),p=this.label||d||"",u=nl(this.presets).map(x=>Nf(x,new Date,y=>this.t(y))).filter(x=>!!x),b=r(this,Qt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),f=x=>{let y=x==="start"?this._startText:this._endText;return c`<input id="${r(this,We)}-${x}" type="text" autocomplete="off" spellcheck="false"
|
|
932
|
+
.value=${ce(y)} placeholder=${r(this,I,Eh)}
|
|
933
|
+
aria-label=${x==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
929
934
|
?required=${this.required} ?disabled=${this.disabled}
|
|
930
|
-
aria-invalid=${
|
|
931
|
-
@input=${
|
|
932
|
-
@change=${()=>s(this,I,
|
|
933
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
935
|
+
aria-invalid=${a?"true":h} aria-describedby=${l||h}
|
|
936
|
+
@input=${k=>{k.stopPropagation();let S=k.target.value;x==="start"?this._startText=S:this._endText=S}}
|
|
937
|
+
@change=${()=>s(this,I,hs).call(this,x)} @keydown=${r(this,_h).call(this,x)} />`};return c`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,We)}-l`:h} aria-label=${!this.label&&d?d:h}>
|
|
938
|
+
${this.label?c`<span class="label" id="${r(this,We)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
934
939
|
<div class="wrap">
|
|
935
940
|
<div class="box" part="box">
|
|
936
|
-
${
|
|
941
|
+
${f("start")}<span class="sep" aria-hidden="true">–</span>${f("end")}
|
|
937
942
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
938
|
-
aria-label=${t&&i?this.t(
|
|
939
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
940
|
-
@click=${r(this,
|
|
943
|
+
aria-label=${t&&i?this.t(p?"changeFor":"change",{label:p,start:e.long(t),end:e.long(i)}):this.t(p?"chooseFor":"choose",{label:p})}
|
|
944
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,We)}-pop"
|
|
945
|
+
@click=${r(this,zh)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
941
946
|
</div>
|
|
942
|
-
<div class="pop" id="${r(this,
|
|
943
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
947
|
+
<div class="pop" id="${r(this,We)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
948
|
+
?hidden=${!this.open} @keydown=${r(this,Lh)}>
|
|
944
949
|
${this.open?c`<div class="body">
|
|
945
|
-
${
|
|
946
|
-
<button type="button" class="preset" aria-pressed=${
|
|
947
|
-
@click=${()=>s(this,I,
|
|
948
|
-
<div class="cal">${
|
|
949
|
-
<p class="status" aria-live="polite">${
|
|
950
|
+
${u.length?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${u.map(x=>c`<li>
|
|
951
|
+
<button type="button" class="preset" aria-pressed=${x.start===this.start&&x.end===this.end?"true":"false"}
|
|
952
|
+
@click=${()=>s(this,I,Pf).call(this,x)}>${x.label}</button></li>`)}</ul>`:h}
|
|
953
|
+
<div class="cal">${ch({id:r(this,We),fmt:e,firstDay:r(this,I,Ap),month:Kt(this._focus),focus:this._focus,min:N(this.min),max:N(this.max),isDisabled:x=>this.isUnavailable(P(x)),mark:x=>s(this,I,Hp).call(this,x),note:x=>{let y=s(this,I,Hp).call(this,x);return y==="start"?this.t("startNote"):y==="end"?this.t("endNote"):""},onPick:x=>s(this,I,Rp).call(this,x),onKey:r(this,Ch),onMonth:x=>{this._focus=Ti(nt(this._focus,x),N(this.min),N(this.max))},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:x=>{r(this,Qt)==="end"&&(this._hover=x)}})}
|
|
954
|
+
<p class="status" aria-live="polite">${b}</p>
|
|
950
955
|
</div>
|
|
951
956
|
</div>`:h}
|
|
952
957
|
</div>
|
|
953
958
|
</div>
|
|
954
|
-
${
|
|
955
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
956
|
-
</div>`}};
|
|
959
|
+
${a?c`<p class="error" id="${r(this,We)}-err" role="alert">${a}</p>`:h}
|
|
960
|
+
${this.helpText?c`<p class="help" id="${r(this,We)}-help">${this.helpText}</p>`:h}
|
|
961
|
+
</div>`}};ms=new WeakMap,ue=new WeakMap,Cr=new WeakMap,We=new WeakMap,ps=new WeakMap,us=new WeakMap,Di=new WeakMap,I=new WeakSet,Dp=function(){return Za(this,this.locale)},ds=function(){return es(r(this,I,Dp))},Ap=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Qa(r(this,I,Dp)):(Math.trunc(e)%7+7)%7},Qt=new WeakMap,Eh=function(){return nh(r(this,I,ds),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Zt=function(e){let t=N(e);return t?r(this,I,ds).short(t):e},ei=new WeakMap,If=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Mh=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,s(this,I,If).call(this))},hs=function(e){let t=(e==="start"?this._startText:this._endText).trim(),i=t?oh(t,r(this,I,ds)):"";t&&!i&&g(this,us,!0);let a=e==="start"?[i??"",this.end]:[this.start,i??""];s(this,I,Mh).call(this,...a),i&&(e==="start"?this._startText=s(this,I,Zt).call(this,i):this._endText=s(this,I,Zt).call(this,i))},Rp=function(e){let t=P(e);if(!this.isUnavailable(t)){if(r(this,Qt)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",g(this,Qt,"end"),this._focus=e,g(this,Di,!0);return}this._draftEnd=t,this.open=!1,s(this,I,Mh).call(this,this._draftStart,t),s(this,I,Th).call(this)}},Pf=function(e){this.open=!1,s(this,I,Mh).call(this,e.start,e.end),s(this,I,Th).call(this)},Th=function(){this.renderRoot.querySelector(".trigger")?.focus()},zh=new WeakMap,_h=new WeakMap,Ch=new WeakMap,Lh=new WeakMap,hl=new WeakMap,Hp=function(e){let t=P(e),i=this._draftStart,a=this._draftEnd||(r(this,Qt)==="end"&&i?P(this._hover??this._focus):"");return t===i?"start":t===a&&a>i?"end":i&&a&&t>i&&t<a?"in-range":""},Si.formAssociated=!0,Si.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},Si.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:Ja},isDateDisabled:{attribute:!1},presets:{converter:Ja},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}},Si.styles=[E,it,mh,dh,w`
|
|
962
|
+
:host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
957
963
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
958
964
|
input { flex: 0 1 6.6em; }
|
|
959
965
|
:host([size='small']) input { flex-basis: 6.6em; }
|
|
@@ -973,56 +979,56 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
973
979
|
.presets li { flex: 0 0 auto; }
|
|
974
980
|
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
975
981
|
}
|
|
976
|
-
`];$("cm-date-range-picker",
|
|
982
|
+
`];$("cm-date-range-picker",Si);var l1=z("fileUpload",{prompt:"Drag files here or {browse}",browse:"Browse",drop:"Drop files to upload",uploading:"Uploading {name}",cancel:"Cancel uploading {name}",cancelShort:"Cancel",addMore:"Add more",files:"Chosen files",remove:"Remove {name}",kilobytes:"{size} KB",megabytes:"{size} MB",required:"Please choose a file.",wrongType:"{name} is not an allowed file type",tooLarge:"{name} is larger than {size}",tooMany:"You can add up to {max} files",takePhoto:"Take a photo",retake:"Retake",removePhoto:"Remove",retakeName:"Retake {name}",removeName:"Remove {name}",photo:"photo"});function rx(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 Ge,ti,ae,ii,O,ml,Np,Sh,Dh,Ip,Pp,qp,Op,Lr,qf,Of,Bp,Bf,Ff,Ai=class extends T{constructor(){super(...arguments);m(this,O);this.label="";this.hint="";this.name="";this.accept="";this.multiple=!1;this.maxSize=0;this.maxFiles=0;this.required=!1;this.disabled=!1;this.error="";this.files=[];this._rejected="";this._progress=new Map;this._fileErrors=new Map;this._over=!1;m(this,Ge,this.attachInternals());m(this,ti,new ee(this,r(this,Ge)));m(this,ae,R("cm-fu"));m(this,ii,new Map)}get form(){return r(this,Ge).form}get validity(){return r(this,Ge).validity}get validationMessage(){return r(this,Ge).validationMessage}checkValidity(){return r(this,Ge).checkValidity()}reportValidity(){return r(this,ti).report(()=>r(this,Ge).reportValidity())}formResetCallback(){r(this,ti).reset(),this.files=[],this._rejected="",this._progress=new Map,this._fileErrors=new Map}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,ii).values())URL.revokeObjectURL(e);r(this,ii).clear()}updated(e){if(e.has("files"))for(let[l,d]of r(this,ii))this.files.includes(l)||(URL.revokeObjectURL(d),r(this,ii).delete(l));let t=new FormData;for(let l of this.files)t.append(this.name||"file",l);r(this,Ge).setFormValue(this.files.length?t:null);let i=(r(this,O,ml)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,a=this.error||this._rejected;a?r(this,Ge).setValidity({customError:!0},a,i):this.required&&!this.files.length?r(this,Ge).setValidity({valueMissing:!0},this.t("required"),i):r(this,Ge).setValidity({}),r(this,ti).sync()}addFiles(e){let t=[...e],i=[],a=[],l=[];for(let p of t)rx(p,r(this,O,Np))?this.maxSize&&p.size>this.maxSize?(a.push(p),l.push(this.t("tooLarge",{name:p.name,size:s(this,O,Dh).call(this,this.maxSize)}))):i.push(p):(a.push(p),l.push(this.t("wrongType",{name:p.name})));let d=r(this,O,Sh)?[...this.files,...i]:i.slice(-1);!r(this,O,Sh)&&!i.length&&(d=this.files),r(this,O,Sh)&&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((p,u)=>p!==this.files[u]))&&(this.files=d,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}setProgress(e,t){let i=new Map(this._progress);t==null?i.delete(e):i.set(e,Math.min(100,Math.max(0,Number(t)||0))),this._progress=i}setFileError(e,t){let i=new Map(this._fileErrors);t?i.set(e,t):i.delete(e),this._fileErrors=i}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this._progress.has(e)&&this.setProgress(e,null),this._fileErrors.has(e)&&this.setFileError(e,""),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){if(r(this,O,ml))return s(this,O,Ff).call(this);let e=this.error||this._rejected||r(this,ti).message,t=!this.files.length||this.multiple,i=this.files.length>0;return c`
|
|
977
983
|
${this.label||this.hint&&i?c`<div class="head">
|
|
978
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
979
|
-
${this.hint&&i?c`<span class="hint" id="${r(this,
|
|
984
|
+
${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}
|
|
985
|
+
${this.hint&&i?c`<span class="hint" id="${r(this,ae)}-hint">${this.hint}</span>`:h}
|
|
980
986
|
</div>`:h}
|
|
981
987
|
${i?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
982
|
-
${this.files.map(a=>s(this,
|
|
983
|
-
${t?c`<li>${s(this,
|
|
984
|
-
</ul>`:s(this,
|
|
985
|
-
${e?c`<p class="msg" id="${r(this,
|
|
986
|
-
`}};
|
|
987
|
-
${e.type.startsWith("image/")?c`<img src=${s(this,
|
|
988
|
+
${this.files.map(a=>s(this,O,Of).call(this,a))}
|
|
989
|
+
${t?c`<li>${s(this,O,Bp).call(this,!0)}</li>`:h}
|
|
990
|
+
</ul>`:s(this,O,Bp).call(this,!1)}
|
|
991
|
+
${e?c`<p class="msg" id="${r(this,ae)}-msg" role="alert">${e}</p>`:h}
|
|
992
|
+
`}};Ge=new WeakMap,ti=new WeakMap,ae=new WeakMap,ii=new WeakMap,O=new WeakSet,ml=function(){return this.variant==="photo"},Np=function(){return this.accept||(r(this,O,ml)?"image/*":"")},Sh=function(){return this.multiple&&!r(this,O,ml)},Dh=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})})},Ip=function(e){let t=r(this,ii).get(e);return t||(t=URL.createObjectURL(e),r(this,ii).set(e,t)),t},Pp=function(e){return this._progress.has(e)},qp=function(e){let t=this.dispatchEvent(new CustomEvent("cm-cancel",{detail:{file:e},bubbles:!0,composed:!0,cancelable:!0}));this.setProgress(e,null),t&&this.removeFile(e)},Op=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},Lr=function(e){this.toggleAttribute("data-over",e),this._over=e},qf=function(){if(this._over)return this.t("drop");let[e,t]=this.prompt.split("{browse}");return t===void 0?e:c`${e}<span class="browse">${this.t("browse")}</span>${t}`},Of=function(e){let t=s(this,O,Pp).call(this,e),i=this._fileErrors.get(e)??"",a=`${r(this,ae)}-e${this.files.indexOf(e)}`,l=this._progress.get(e)??0;return c`<li class="item"><div class="file ${t?"busy":""} ${i?"invalid":""}">
|
|
993
|
+
${e.type.startsWith("image/")?c`<img src=${s(this,O,Ip).call(this,e)} alt=${e.name} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${s(this,O,Dh).call(this,e.size)}</span></div>`}
|
|
988
994
|
${t?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
989
995
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(l)}><span style="inline-size:${l}%"></span></div>`:h}
|
|
990
|
-
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>s(this,
|
|
996
|
+
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>s(this,O,qp).call(this,e)}><cm-icon name="close" size="12"></cm-icon></button>`:c`<button type="button" class="remove" aria-label=${this.t("remove",{name:e.name})} aria-describedby=${i?a:h}
|
|
991
997
|
@click=${()=>this.removeFile(e)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
992
|
-
</div>${i?c`<p class="ferr" id=${a} role="alert">${i}</p>`:h}</li>`},
|
|
993
|
-
@dragenter=${()=>s(this,
|
|
994
|
-
<input type="file" id=${r(this,
|
|
998
|
+
</div>${i?c`<p class="ferr" id=${a} role="alert">${i}</p>`:h}</li>`},Bp=function(e){let t=this.error||this._rejected||r(this,ti).message,i=[this.hint&&`${r(this,ae)}-hint`,t&&`${r(this,ae)}-msg`].filter(Boolean).join(" ");return c`<label class="zone ${e?"tile":"row"} ${t&&!e?"invalid":""}" part="zone"
|
|
999
|
+
@dragenter=${()=>s(this,O,Lr).call(this,!0)} @dragleave=${()=>s(this,O,Lr).call(this,!1)} @drop=${()=>s(this,O,Lr).call(this,!1)}>
|
|
1000
|
+
<input type="file" id=${r(this,ae)} accept=${this.accept||h} capture=${this.capture||h} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
995
1001
|
?required=${this.required&&!this.files.length}
|
|
996
|
-
aria-labelledby=${[this.label&&`${r(this,
|
|
997
|
-
aria-describedby=${
|
|
998
|
-
@change=${s(this,
|
|
999
|
-
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${r(this,
|
|
1000
|
-
<span class="words"><span id="${r(this,
|
|
1001
|
-
</label>`},
|
|
1002
|
+
aria-labelledby=${[this.label&&`${r(this,ae)}-l`,`${r(this,ae)}-p`].filter(Boolean).join(" ")}
|
|
1003
|
+
aria-describedby=${i||h} aria-invalid=${t?"true":h}
|
|
1004
|
+
@change=${s(this,O,Op)} @cancel=${a=>a.stopPropagation()} />
|
|
1005
|
+
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${r(this,ae)}-p">${this.t("addMore")}</span>`:c`<span class="ico"><cm-icon name="upload" size="20"></cm-icon></span>
|
|
1006
|
+
<span class="words"><span id="${r(this,ae)}-p">${s(this,O,qf).call(this)}</span>${this.hint?c`<span class="hint" id="${r(this,ae)}-hint">${this.hint}</span>`:h}</span>`}
|
|
1007
|
+
</label>`},Bf=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Ff=function(){let e=this.files[0],t=this.error||this._rejected||e&&this._fileErrors.get(e)||r(this,ti).message,i=!!e&&s(this,O,Pp).call(this,e),a=this.label||this.t("photo"),l=[this.hint&&`${r(this,ae)}-hint`,t&&`${r(this,ae)}-msg`].filter(Boolean).join(" "),d=u=>c`<input type="file" id=${r(this,ae)} accept=${r(this,O,Np)} capture=${this.capture||h}
|
|
1002
1008
|
?disabled=${this.disabled} ?required=${this.required&&!e} tabindex=${u?"-1":h} aria-hidden=${u?"true":h}
|
|
1003
|
-
?hidden=${u} aria-labelledby=${u?h:`${r(this,
|
|
1004
|
-
@change=${s(this,
|
|
1009
|
+
?hidden=${u} aria-labelledby=${u?h:`${r(this,ae)}-p`} aria-describedby=${!u&&l||h} aria-invalid=${t?"true":h}
|
|
1010
|
+
@change=${s(this,O,Op)} @cancel=${b=>b.stopPropagation()} />`,p=this.hint?c`<span class="hint" id="${r(this,ae)}-hint">${this.hint}</span>`:h;return c`
|
|
1005
1011
|
${e?c`<div class="shot ${i?"busy":""}" part="photo">
|
|
1006
|
-
${e.type.startsWith("image/")?c`<img src=${s(this,
|
|
1012
|
+
${e.type.startsWith("image/")?c`<img src=${s(this,O,Ip).call(this,e)} alt=${a} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${s(this,O,Dh).call(this,e.size)}</span></div>`}
|
|
1007
1013
|
${i?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
1008
1014
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(this._progress.get(e)??0)}><span style="inline-size:${this._progress.get(e)??0}%"></span></div>`:h}
|
|
1009
1015
|
</div>
|
|
1010
1016
|
<p class="caption" aria-hidden="true">${this.label}</p>
|
|
1011
1017
|
${d(!0)}
|
|
1012
1018
|
${this.disabled?h:i?c`<div class="actions" part="actions">
|
|
1013
|
-
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,
|
|
1019
|
+
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,O,qp).call(this,e)}><cm-icon name="close" size="16"></cm-icon>${this.t("cancelShort")}</button>
|
|
1014
1020
|
</div>`:c`<div class="actions" part="actions">
|
|
1015
|
-
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,
|
|
1021
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,ae)}-msg`:h} @click=${s(this,O,Bf)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
1016
1022
|
<button type="button" class="action" aria-label=${this.t("removeName",{name:a})} @click=${()=>this.removeFile(e)}><cm-icon name="trash" size="16"></cm-icon>${this.t("removePhoto")}</button>
|
|
1017
1023
|
</div>`}`:c`<label class="zone photo ${t?"invalid":""}" part="zone photo"
|
|
1018
|
-
@dragenter=${()=>s(this,
|
|
1024
|
+
@dragenter=${()=>s(this,O,Lr).call(this,!0)} @dragleave=${()=>s(this,O,Lr).call(this,!1)} @drop=${()=>s(this,O,Lr).call(this,!1)}>
|
|
1019
1025
|
${d(!1)}
|
|
1020
1026
|
<cm-icon name="camera" size="24"></cm-icon>
|
|
1021
|
-
<span class="photo-label" id="${r(this,
|
|
1022
|
-
${
|
|
1027
|
+
<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>
|
|
1028
|
+
${p}
|
|
1023
1029
|
</label>`}
|
|
1024
|
-
${t?c`<p class="msg" id="${r(this,
|
|
1025
|
-
`},
|
|
1030
|
+
${t?c`<p class="msg" id="${r(this,ae)}-msg" role="alert">${t}</p>`:h}
|
|
1031
|
+
`},Ai.formAssociated=!0,Ai.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},Ai.properties={label:{},hint:{},prompt:{string:"prompt"},name:{reflect:!0},accept:{},multiple:{type:Boolean},maxSize:{type:Number,attribute:"max-size"},maxFiles:{type:Number,attribute:"max-files"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},error:{reflect:!0},files:{attribute:!1},variant:{reflect:!0},capture:{reflect:!0},_rejected:{state:!0},_progress:{state:!0},_fileErrors:{state:!0},_over:{state:!0}},Ai.styles=[E,w`
|
|
1026
1032
|
:host { display: block; }
|
|
1027
1033
|
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-8); margin-bottom: var(--cm-space-12); }
|
|
1028
1034
|
.label { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1106,33 +1112,33 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1106
1112
|
@media (max-width: 640px) {
|
|
1107
1113
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
1108
1114
|
}
|
|
1109
|
-
`];$("cm-file-upload",
|
|
1110
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1115
|
+
`];$("cm-file-upload",Ai);var b1=z("colorField",{swatch:"{name}, {hex}",hex:"Hex code",hexNamed:"{label}, hex code",placeholder:"#RRGGBB",picker:"Choose a custom colour",pickerNamed:"Choose a custom colour for {label}",required:"Please choose a colour.",invalid:"Enter a colour as #RRGGBB, for example #2e6faf.",black:"Black",grey:"Grey",lightGrey:"Light grey",red:"Red",darkOrange:"Dark orange",orange:"Orange",yellow:"Yellow",lightGreen:"Light green",green:"Green",lightBlue:"Light blue",blue:"Blue",indigo:"Indigo"}),ax=[{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 ri(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 sx=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 nx(o){let n=sx(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var Pe,Dr,zt,pl,gs,X,Sr,Fp,jf,Vf,jp,Uf,Kf,Wf,Gf,Ri=class extends T{constructor(){super(...arguments);m(this,X);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.picker=!1;this.required=!1;this.disabled=!1;this._invalid=!1;m(this,Pe,this.attachInternals());m(this,Dr,new ee(this,r(this,Pe)));m(this,zt,R("cm-cf"));m(this,pl,"");m(this,gs)}connectedCallback(){super.connectedCallback(),g(this,pl,ri(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,Dr).report(()=>r(this,Pe).reportValidity())}formResetCallback(){r(this,Dr).reset(),this.value=r(this,pl),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=ri(t?.value??"");return i?[{value:i,name:t.name}]:[]}):ax.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=ri(this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==r(this,gs)&&(this._draft=void 0,this._invalid=!1),g(this,gs,void 0)}}updated(){let e=!this.value||ri(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({}),r(this,Dr).sync()}render(){let e=this.items,t=ri(this.value??""),i=e.findIndex(u=>u.value===t),a=this.error||(this._invalid||this.value&&!t?this.t("invalid"):"")||r(this,Dr).message,l=[a&&`${r(this,zt)}-err`,this.helpText&&`${r(this,zt)}-help`].filter(Boolean).join(" ")||h,d=this.getAttribute("aria-label"),p=this.label||d||"";return c`<div class="field">
|
|
1116
|
+
${this.label?c`<span class="label" id="${r(this,zt)}-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}
|
|
1111
1117
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
1112
|
-
aria-labelledby=${this.label?`${r(this,
|
|
1118
|
+
aria-labelledby=${this.label?`${r(this,zt)}-l`:h} aria-label=${!this.label&&d?d:h}
|
|
1113
1119
|
aria-required=${this.required?"true":h} aria-describedby=${l}>
|
|
1114
|
-
${e.map((u,
|
|
1115
|
-
aria-label=${
|
|
1116
|
-
style="background-color:${u.value};color:${
|
|
1117
|
-
@click=${()=>s(this,X,
|
|
1120
|
+
${e.map((u,b)=>{let f=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=${b===i?"true":"false"}
|
|
1121
|
+
aria-label=${f} title=${u.name||u.value} tabindex=${b===(i>=0?i:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
1122
|
+
style="background-color:${u.value};color:${nx(u.value)}"
|
|
1123
|
+
@click=${()=>s(this,X,Fp).call(this,b)} @keydown=${x=>s(this,X,jf).call(this,x,b)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
1118
1124
|
</div>`:h}
|
|
1119
1125
|
<div class="row">
|
|
1120
1126
|
${this.picker?c`<label class="pick" part="picker" style=${t?`background-color:${t}`:h}>
|
|
1121
|
-
<input type="color" .value=${
|
|
1122
|
-
aria-label=${
|
|
1123
|
-
@input=${s(this,X,
|
|
1127
|
+
<input type="color" .value=${ce(t??"#000000")} ?disabled=${this.disabled}
|
|
1128
|
+
aria-label=${p?this.t("pickerNamed",{label:p}):this.t("picker")}
|
|
1129
|
+
@input=${s(this,X,Wf)} @change=${s(this,X,Gf)} />
|
|
1124
1130
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1125
1131
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${t?`background-color:${t}`:h}></span>`}
|
|
1126
|
-
<input class="input" part="input" id=${r(this,
|
|
1127
|
-
maxlength="7" .value=${
|
|
1128
|
-
aria-label=${
|
|
1132
|
+
<input class="input" part="input" id=${r(this,zt)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
1133
|
+
maxlength="7" .value=${ce(this._draft??this.value??"")} placeholder=${this.t("placeholder")}
|
|
1134
|
+
aria-label=${p?this.t("hexNamed",{label:p}):this.t("hex")}
|
|
1129
1135
|
?required=${this.required} ?disabled=${this.disabled}
|
|
1130
1136
|
aria-invalid=${a?"true":h} aria-describedby=${l}
|
|
1131
|
-
@input=${s(this,X,
|
|
1137
|
+
@input=${s(this,X,Vf)} @change=${s(this,X,Uf)} @keydown=${s(this,X,Kf)} />
|
|
1132
1138
|
</div>
|
|
1133
|
-
${a?c`<p class="error" id="${r(this,
|
|
1134
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
1135
|
-
</div>`}};
|
|
1139
|
+
${a?c`<p class="error" id="${r(this,zt)}-err" role="alert">${a}</p>`:h}
|
|
1140
|
+
${this.helpText?c`<p class="help" id="${r(this,zt)}-help">${this.helpText}</p>`:h}
|
|
1141
|
+
</div>`}};Pe=new WeakMap,Dr=new WeakMap,zt=new WeakMap,pl=new WeakMap,gs=new WeakMap,X=new WeakSet,Sr=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},Fp=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,X,Sr).call(this,"input","change")))},jf=function(e,t){let i=this.items.length,a=J(e,this),l;if(a==="ArrowRight"||e.key==="ArrowDown")l=(t+1)%i;else if(a==="ArrowLeft"||e.key==="ArrowUp")l=(t-1+i)%i;else if(e.key==="Home")l=0;else if(e.key==="End")l=i-1;else if(e.key===" "||e.key==="Enter")l=t;else return;e.preventDefault(),s(this,X,Fp).call(this,l)},Vf=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let i=/^#?[0-9a-f]{6}$/i.test(t.trim())?ri(t):null;i&&i!==this.value&&(g(this,gs,i),this.value=i,s(this,X,Sr).call(this,"input")),this._invalid&&(i||!t.trim())&&(this._invalid=!1)},jp=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?ri(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,X,Sr).call(this,"input"),s(this,X,Sr).call(this,"change")},Uf=function(e){e.stopPropagation(),s(this,X,jp).call(this)},Kf=function(e){e.key==="Enter"&&s(this,X,jp).call(this)},Wf=function(e){e.stopPropagation();let t=ri(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,s(this,X,Sr).call(this,"input"))},Gf=function(e){e.stopPropagation(),s(this,X,Sr).call(this,"change")},Ri.formAssociated=!0,Ri.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},Ri.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}},Ri.styles=[E,rt,w`
|
|
1136
1142
|
:host { display: block; }
|
|
1137
1143
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
1138
1144
|
.swatch {
|
|
@@ -1171,18 +1177,18 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1171
1177
|
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
1172
1178
|
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
1173
1179
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
1174
|
-
`];$("cm-color-field",
|
|
1180
|
+
`];$("cm-color-field",Ri);var M1=z("signatureField",{modes:"How to sign",draw:"Draw",type:"Type",pad:"Signature drawing area",padSigned:"Signature drawing area, signed",instructions:"Draw your signature with a mouse, finger or pen. To sign with the keyboard, choose Type.",signHere:"Sign here",typeLabel:"Type your full name",typePlaceholder:"Type your full name",undo:"Undo",undoLabel:"Undo last stroke",clear:"Clear",clearLabel:"Clear signature",cleared:"Signature cleared",undone:"Last stroke removed",required:"Please sign here."}),Vp=3,Ah=.7,ox=.0055,Rh="#000000",Yf=8,ul=2,lx=400,cx=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),Ye,Rr,gl,fs,fl,ct,dt,ht,Ni,Ii,Le,bl,Pi,bs,C,Up,Hh,Kp,ai,Nh,Wp,Gp,Xf,Yp,Ih,Xp,Ph,Jf,Jp,Zf,Ar,qh,Zp,Qp,Qf,eu,eb,tu,tb,ib,Hi=class extends T{constructor(){super(...arguments);m(this,C);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.mode="draw";this.typedName="";this.required=!1;this.disabled=!1;this._announce="";m(this,Ye,this.attachInternals());m(this,Rr,new ee(this,r(this,Ye)));m(this,gl,R("cm-sig"));m(this,fs,"");m(this,fl,"");m(this,ct,[]);m(this,dt);m(this,ht);m(this,Ni,"");m(this,Ii,0);m(this,Le);m(this,bl,"");m(this,Pi);m(this,bs,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?s(this,C,Up).call(this):(g(this,fs,this.value),g(this,fl,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),r(this,Pi)?.disconnect(),g(this,Pi,void 0),cancelAnimationFrame(r(this,Ii)),g(this,Ii,0),r(this,Le)&&(clearTimeout(r(this,Le)),g(this,Le,void 0))}get form(){return r(this,Ye).form}get validity(){return r(this,Ye).validity}get validationMessage(){return r(this,Ye).validationMessage}checkValidity(){return r(this,Ye).checkValidity()}reportValidity(){return r(this,Rr).report(()=>r(this,Ye).reportValidity())}formResetCallback(){r(this,Rr).reset(),g(this,ct,[]),g(this,dt,void 0),g(this,ht,void 0),r(this,Le)&&(clearTimeout(r(this,Le)),g(this,Le,void 0)),this.typedName=r(this,fl),r(this,fs)?(g(this,Ni,""),this.value=r(this,fs)):this.updateComplete.then(()=>s(this,C,Ar).call(this,!1)),s(this,C,ai).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!r(this,ct).length&&!r(this,ht)}toDataURL(){return s(this,C,Zp).call(this)?.toDataURL("image/png")??""}toBlob(){let e=s(this,C,Zp).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(g(this,ct,[]),g(this,dt,void 0),g(this,ht,void 0),s(this,C,ai).call(this)),s(this,C,Ar).call(this,!0)}undo(){this.mode==="draw"&&(r(this,ct).length?r(this,ct).pop():g(this,ht,void 0),g(this,dt,void 0),s(this,C,ai).call(this),s(this,C,Ar).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==r(this,Ni)){let t=this.value??"";if(g(this,Ni,t),g(this,ct,[]),g(this,dt,void 0),!t)g(this,ht,void 0),this.hasUpdated&&(this.typedName="");else{let i=new Image;i.addEventListener("load",()=>{r(this,ht)===i&&s(this,C,ai).call(this)}),i.src=t,g(this,ht,i),this.mode="draw"}s(this,C,ai).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();g(this,Ni,t),this.value=t}}firstUpdated(){s(this,C,Up).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>s(this,C,Ar).call(this,!1)),s(this,C,Ph).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&s(this,C,Ph).call(this),r(this,Ye).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,Ye).setValidity({customError:!0},this.error,t):this.required&&this.empty?r(this,Ye).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ye).setValidity({}),r(this,Rr).sync()}render(){let e=r(this,gl),t=this.getAttribute("aria-label"),i=r(this,Rr).message,a=[i&&`${e}-err`,this.helpText&&`${e}-help`].filter(Boolean).join(" "),l=this.empty,d=!r(this,ct).length&&!r(this,ht),p=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
1175
1181
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
1176
1182
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
1177
|
-
@click=${()=>s(this,C,
|
|
1183
|
+
@click=${()=>s(this,C,Qp).call(this,u,!0)} @keydown=${s(this,C,Qf)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
1178
1184
|
${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}
|
|
1179
1185
|
<div class="bar">
|
|
1180
1186
|
<div class="tabs" role="tablist" part="tabs"
|
|
1181
1187
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
1182
|
-
aria-label=${this.label?h:t||this.t("modes")}>${
|
|
1188
|
+
aria-label=${this.label?h:t||this.t("modes")}>${p("draw")}${p("type")}</div>
|
|
1183
1189
|
<div class="actions">
|
|
1184
|
-
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,
|
|
1185
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,
|
|
1190
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,tb)}>${this.t("undo")}</button>`:h}
|
|
1191
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,ib)}>${this.t("clear")}</button>
|
|
1186
1192
|
</div>
|
|
1187
1193
|
</div>
|
|
1188
1194
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -1192,8 +1198,8 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1192
1198
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
1193
1199
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
1194
1200
|
aria-describedby=${[`${e}-instr`,a].filter(Boolean).join(" ")}
|
|
1195
|
-
@pointerdown=${s(this,C,
|
|
1196
|
-
@lostpointercapture=${s(this,C,
|
|
1201
|
+
@pointerdown=${s(this,C,Xf)} @pointermove=${s(this,C,Yp)} @pointerup=${s(this,C,Ih)} @pointercancel=${s(this,C,Ih)}
|
|
1202
|
+
@lostpointercapture=${s(this,C,Ih)} @transitionend=${()=>s(this,C,Nh).call(this)}></canvas>
|
|
1197
1203
|
</div>
|
|
1198
1204
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
1199
1205
|
</div>
|
|
@@ -1201,17 +1207,17 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1201
1207
|
<div class="pad" part="pad">
|
|
1202
1208
|
<span class="line" aria-hidden="true"></span>
|
|
1203
1209
|
<input class="typed" part="input" type="text" autocomplete="name" spellcheck="false" maxlength="80"
|
|
1204
|
-
.value=${
|
|
1210
|
+
.value=${ce(this.typedName??"")} placeholder=${this.t("typePlaceholder")}
|
|
1205
1211
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
1206
1212
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
1207
1213
|
aria-describedby=${a||h} ?disabled=${this.disabled}
|
|
1208
|
-
@input=${s(this,C,
|
|
1214
|
+
@input=${s(this,C,Jf)} @change=${s(this,C,Zf)} />
|
|
1209
1215
|
</div>
|
|
1210
1216
|
</div>
|
|
1211
1217
|
${i?c`<p class="error" id="${e}-err" role="alert">${i}</p>`:h}
|
|
1212
1218
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
1213
1219
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
1214
|
-
</div>`}};
|
|
1220
|
+
</div>`}};Ye=new WeakMap,Rr=new WeakMap,gl=new WeakMap,fs=new WeakMap,fl=new WeakMap,ct=new WeakMap,dt=new WeakMap,ht=new WeakMap,Ni=new WeakMap,Ii=new WeakMap,Le=new WeakMap,bl=new WeakMap,Pi=new WeakMap,bs=new WeakMap,C=new WeakSet,Up=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,Pi)||(g(this,Pi,new ResizeObserver(()=>s(this,C,Kp).call(this))),r(this,Pi).observe(e))},Hh=function(){return this.renderRoot.querySelector("canvas")},Kp=function(){let e=r(this,C,Hh);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;g(this,bs,t);let a=window.devicePixelRatio||1,l=Math.round(t*a),d=Math.round(i*a);(e.width!==l||e.height!==d)&&(e.width=l,e.height=d),s(this,C,Nh).call(this)},ai=function(){r(this,Ii)||g(this,Ii,requestAnimationFrame(()=>{g(this,Ii,0),s(this,C,Nh).call(this)}))},Nh=function(){let e=r(this,C,Hh);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,bs);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||Rh;s(this,C,Wp).call(this,t,i,l,!0)},Wp=function(e,t,i,a){let l=t/Vp,d=r(this,ht);if(d?.complete&&d.naturalWidth){let p=Math.min(t*.9/d.naturalWidth,l*.9/d.naturalHeight),u=d.naturalWidth*p,b=d.naturalHeight*p,f=(t-u)/2,x=(l-b)/2;if(a&&!mx(i,Rh)){let y=document.createElement("canvas");y.width=Math.max(1,Math.round(u*2)),y.height=Math.max(1,Math.round(b*2));let k=y.getContext("2d");k.drawImage(d,0,0,y.width,y.height),k.globalCompositeOperation="source-in",k.fillStyle=i,k.fillRect(0,0,y.width,y.height),e.drawImage(y,f,x,u,b)}else e.drawImage(d,f,x,u,b)}e.strokeStyle=i,e.fillStyle=i,e.lineCap="round",e.lineJoin="round";for(let p of r(this,ct))dx(e,p,t)},Gp=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}},Xf=function(e){if(this.disabled||r(this,dt)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.currentTarget;e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}let i=[s(this,C,Gp).call(this,e,t.getBoundingClientRect())];g(this,dt,{id:e.pointerId,stroke:i}),r(this,ct).push(i),s(this,C,ai).call(this)},Yp=function(e){let t=r(this,dt);if(!t||e.pointerId!==t.id)return;e.preventDefault();let i=e.currentTarget.getBoundingClientRect(),a=typeof e.getCoalescedEvents=="function"?e.getCoalescedEvents():[];for(let l of a.length?a:[e]){let d=s(this,C,Gp).call(this,l,i),p=t.stroke[t.stroke.length-1];Math.hypot(d.x-p.x,d.y-p.y)*i.width<1.5||t.stroke.push(d)}s(this,C,ai).call(this)},Ih=function(e){let t=r(this,dt);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&s(this,C,Yp).call(this,e),g(this,dt,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}s(this,C,ai).call(this),s(this,C,Ar).call(this,!0)}},Xp=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},Ph=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${r(this,C,Xp)}`,i=!0;try{i=e.check(t,this.typedName||"Signature")}catch{}i||e.load(t,this.typedName||"Signature").then(()=>{this.mode==="type"&&this.typedName.trim()&&s(this,C,Ar).call(this,!1)},()=>{})},Jf=function(e){e.stopPropagation(),r(this,Le)?clearTimeout(r(this,Le)):g(this,bl,this.value),this.typedName=e.target.value,g(this,Le,setTimeout(()=>s(this,C,Jp).call(this),lx)),s(this,C,Ph).call(this)},Jp=function(){r(this,Le)&&(clearTimeout(r(this,Le)),g(this,Le,void 0),this.value!==r(this,bl)&&s(this,C,qh).call(this))},Zf=function(e){e.stopPropagation(),this.updateComplete.then(()=>s(this,C,Jp).call(this))},Ar=function(e){let t=this.empty?"":this.toDataURL(),i=t!==this.value;i&&(g(this,Ni,t),this.value=t),this.requestUpdate(),e&&i&&s(this,C,qh).call(this)},qh=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}))},Zp=function(){if(this.empty)return;let e=Math.max(r(this,C,Hh)?.clientWidth||r(this,bs)||600,300),t=e/Vp,i=document.createElement("canvas");i.width=Math.round(e*ul),i.height=Math.round(t*ul);let a=i.getContext("2d",{willReadFrequently:!0});if(a.scale(ul,ul),this.mode==="type"){let l=Math.min(t*.45,64),d=r(this,C,Xp);a.font=`400 ${l}px ${d}`;let p=this.typedName.trim(),u=e-2*Yf,b=a.measureText(p).width;b>u&&(l*=u/b,a.font=`400 ${l}px ${d}`),a.direction=getComputedStyle(this).direction==="rtl"?"rtl":"ltr",a.textAlign="center",a.textBaseline="alphabetic",a.fillStyle=Rh,a.fillText(p,e/2,t*Ah)}else s(this,C,Wp).call(this,a,e,Rh,!1);return hx(i,Yf*ul)},Qp=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${r(this,gl)}-tab-${e}`)?.focus()),e===this.mode))return;let i=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&s(this,C,Kp).call(this),this.value!==i&&s(this,C,qh).call(this)})},Qf=function(e){let t=J(e,this),i;if(t==="ArrowRight"||t==="ArrowLeft")i=this.mode==="draw"?"type":"draw";else if(e.key==="Home")i="draw";else if(e.key==="End")i="type";else return;e.preventDefault(),s(this,C,Qp).call(this,i,!0)},eu=function(e){s(this,C,eb).call(this,this.t(e))},eb=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},tu=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()})},tb=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),s(this,C,eu).call(this,"undone"),s(this,C,tu).call(this,e)},ib=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),s(this,C,eu).call(this,"cleared"),s(this,C,tu).call(this,e)},Hi.formAssociated=!0,Hi.shadowRootOptions={...L.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=[E,w`
|
|
1215
1221
|
:host { display: block; }
|
|
1216
1222
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1217
1223
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -1241,26 +1247,26 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1241
1247
|
.act:disabled { background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed; }
|
|
1242
1248
|
.panel:focus { outline: none; }
|
|
1243
1249
|
.pad {
|
|
1244
|
-
position: relative; width: 100%; aspect-ratio: ${
|
|
1250
|
+
position: relative; width: 100%; aspect-ratio: ${Vp} / 1; overflow: hidden; container-type: inline-size;
|
|
1245
1251
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
1246
1252
|
}
|
|
1247
1253
|
.panel:focus-visible .pad, .pad:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
1248
|
-
:host([error]:not([error=''])) .pad { border-color: var(--cm-border-critical); }
|
|
1254
|
+
:host([error]:not([error=''])) .pad, :host([data-cm-invalid]) .pad { border-color: var(--cm-border-critical); }
|
|
1249
1255
|
canvas {
|
|
1250
1256
|
position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair;
|
|
1251
1257
|
/* The ink: read in script. The transition makes a theme change fire transitionend, which repaints the ink. */
|
|
1252
1258
|
color: var(--cm-text-default); transition-property: color; transition-duration: 1ms; /* scale-exempt: not motion; a 1ms colour transition makes a theme change fire transitionend so the ink repaints */
|
|
1253
1259
|
}
|
|
1254
1260
|
.line {
|
|
1255
|
-
position: absolute; inset-inline: var(--cm-space-12); top: ${
|
|
1261
|
+
position: absolute; inset-inline: var(--cm-space-12); top: ${Ah*100}%; height: 0;
|
|
1256
1262
|
border-top: var(--cm-border-1) dashed var(--cm-border-input); pointer-events: none;
|
|
1257
1263
|
}
|
|
1258
1264
|
.here {
|
|
1259
|
-
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-
|
|
1265
|
+
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-Ah)*100}% + 4px);
|
|
1260
1266
|
font-size: 12px; color: var(--cm-text-tertiary); pointer-events: none; user-select: none;
|
|
1261
1267
|
}
|
|
1262
1268
|
.typed {
|
|
1263
|
-
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-
|
|
1269
|
+
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-Ah)*100}% - 0.18em);
|
|
1264
1270
|
width: calc(100% - 2 * var(--cm-space-12)); padding: 0; margin: 0;
|
|
1265
1271
|
font-family: var(--cm-signature-font, 'Dancing Script', 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', 'Brush Script MT', cursive);
|
|
1266
1272
|
font-size: clamp(24px, 9cqi, 48px); font-weight: 400; line-height: 1.25; text-align: center; /* scale-exempt: a typed signature scales with the pad, like handwriting */
|
|
@@ -1277,17 +1283,19 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1277
1283
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
1278
1284
|
|
|
1279
1285
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1280
|
-
`];function
|
|
1281
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1286
|
+
`];function dx(o,n,e){let t=d=>e*ox*(.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 p=cx(n[d],n[d+1]);o.beginPath(),o.moveTo(...i(a)),o.quadraticCurveTo(...i(n[d]),...i(p)),o.lineWidth=t(n[d].p),o.stroke(),a=p}let l=n[n.length-1];o.beginPath(),o.moveTo(...i(a)),o.lineTo(...i(l)),o.lineWidth=t(l.p),o.stroke()}function hx(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,p=-1;for(let b=0;b<t;b++){let f=b*e*4;for(let x=0;x<e;x++)i[f+x*4+3]>8&&(x<l&&(l=x),x>d&&(d=x),b<a&&(a=b),p=b)}if(d<0)return;let u=document.createElement("canvas");return u.width=d-l+1+2*n,u.height=p-a+1+2*n,u.getContext("2d").drawImage(o,l,a,d-l+1,p-a+1,n,n,d-l+1,p-a+1),u}function mx(o,n){let e=t=>{let i=/^#([0-9a-f]{6})$/i.exec(t.trim());if(i){let a=parseInt(i[1],16);return`${a>>16&255},${a>>8&255},${a&255}`}return(/\d+\s*,\s*\d+\s*,\s*\d+/.exec(t)?.[0]??t).replace(/\s/g,"")};return e(o)===e(n)}$("cm-signature-field",Hi);var D1=z("optionGroup",{required:"Please select one of these options."}),mt,Hr,Nr,vs,vl,Ct,iu,ru,rb,_t=class extends T{constructor(){super(...arguments);m(this,Ct);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];m(this,mt,this.attachInternals());m(this,Hr,new ee(this,r(this,mt),()=>this.renderRoot.querySelector('button[tabindex="0"]')?.focus()));m(this,Nr,R("cm-og"));m(this,vs,"");m(this,vl,new MutationObserver(()=>s(this,Ct,iu).call(this)))}connectedCallback(){super.connectedCallback(),s(this,Ct,iu).call(this),r(this,vl).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,vl).disconnect()}get form(){return r(this,mt).form}get validity(){return r(this,mt).validity}get validationMessage(){return r(this,mt).validationMessage}checkValidity(){return r(this,mt).checkValidity()}reportValidity(){return r(this,Hr).report(()=>r(this,mt).reportValidity())}formResetCallback(){this.value=r(this,vs),r(this,Hr).reset()}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,vs)||g(this,vs,this.value)}updated(){r(this,mt).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,mt).setValidity({valueMissing:!0},this.t("required"),e):r(this,mt).setValidity({}),r(this,Hr).sync()}render(){let e=this.items,t=e.findIndex(d=>d.value===this.value&&!d.disabled),i=t>=0?t:e.findIndex(d=>!d.disabled),a=this.getAttribute("aria-label"),l=r(this,Hr).message;return c`
|
|
1287
|
+
${this.label?c`<span class="label" id="${r(this,Nr)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1282
1288
|
<div class="options" part="options" role="radiogroup"
|
|
1283
|
-
aria-labelledby=${this.label?`${r(this,
|
|
1284
|
-
aria-required=${this.required?"true":h}
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1289
|
+
aria-labelledby=${this.label?`${r(this,Nr)}-l`:h} aria-label=${!this.label&&a?a:h}
|
|
1290
|
+
aria-required=${this.required?"true":h} aria-invalid=${l?"true":h}
|
|
1291
|
+
aria-describedby=${l?`${r(this,Nr)}-err`:h}>
|
|
1292
|
+
${e.map((d,p)=>c`<button type="button" role="radio" part="option" class=${d.tone==="critical"||d.tone==="success"?`tone-${d.tone}`:h} aria-checked=${d.value===this.value?"true":"false"}
|
|
1293
|
+
tabindex=${p===i?"0":"-1"} ?disabled=${this.disabled||!!d.disabled}
|
|
1294
|
+
@click=${()=>s(this,Ct,ru).call(this,p)} @keydown=${u=>s(this,Ct,rb).call(this,u,p)}>${d.label}</button>`)}
|
|
1288
1295
|
</div>
|
|
1296
|
+
${l?c`<p class="error" id="${r(this,Nr)}-err" role="alert">${l}</p>`:h}
|
|
1289
1297
|
<slot></slot>
|
|
1290
|
-
`}};
|
|
1298
|
+
`}};mt=new WeakMap,Hr=new WeakMap,Nr=new WeakMap,vs=new WeakMap,vl=new WeakMap,Ct=new WeakSet,iu=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},a=t.getAttribute("tone");return(a==="critical"||a==="success")&&(i.tone=a),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,vs,this.value))},ru=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}))))},rb=function(e,t){let i=J(e,this),a=this.items.flatMap((p,u)=>p.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,Ct,ru).call(this,d)},_t.formAssociated=!0,_t.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},_t.styles=[E,w`
|
|
1291
1299
|
:host { display: block; }
|
|
1292
1300
|
.label {
|
|
1293
1301
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1318,8 +1326,10 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1318
1326
|
background: color-mix(in srgb, var(--_tone) 80%, var(--cm-text-default)); border-color: color-mix(in srgb, var(--_tone) 80%, var(--cm-text-default));
|
|
1319
1327
|
}
|
|
1320
1328
|
slot { display: none; }
|
|
1329
|
+
/* 1.14: the field's own message under the options. */
|
|
1330
|
+
.error { margin: var(--cm-space-8) 0 0; font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-critical); }
|
|
1321
1331
|
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
1322
|
-
`];$("cm-option-group",
|
|
1332
|
+
`];$("cm-option-group",_t);var q1=z("segmentedControl",{required:"Please select one of these options."}),ys=class extends _t{constructor(){super(...arguments);this.size="default"}};ys.properties={..._t.properties,size:{reflect:!0}},ys.styles=[E,w`
|
|
1323
1333
|
:host { display: inline-block; vertical-align: middle; max-width: 100%; --_h: var(--cm-control-height-md, 36px); }
|
|
1324
1334
|
:host([size='small']) { --_h: var(--cm-control-height-sm, 32px); }
|
|
1325
1335
|
@media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
|
|
@@ -1349,7 +1359,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1349
1359
|
button[aria-checked='true']:disabled { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
1350
1360
|
:host([disabled]) .options { background: var(--cm-bg-input-filled); }
|
|
1351
1361
|
slot { display: none; }
|
|
1352
|
-
`];$("cm-segmented-control",
|
|
1362
|
+
`];$("cm-segmented-control",ys);var V1=z("pageHeader",{back:"Back to {label}",backOnly:"Back",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),yl,au,xs=class extends T{constructor(){super(...arguments);m(this,yl);this.heading="";this.description="";this.breadcrumbs=[];this.backHref="";this.backLabel="";this.pagination=!1;this.hasPrevious=!1;this.hasNext=!1}render(){let e=Array.isArray(this.breadcrumbs)?this.breadcrumbs:[],t=this.backHref?{href:this.backHref,label:this.backLabel}:[...e].reverse().find(i=>i.href);return c`<header part="header">
|
|
1353
1363
|
<div class=${this.description?"lead described":"lead"}>
|
|
1354
1364
|
${t?c`<a class=${this.backHref?"back always":"back"} part="back" href=${t.href} aria-label=${t.label?this.t("back",{label:t.label}):this.t("backOnly")}><cm-icon name="chevron-left" size="20"></cm-icon></a>`:h}
|
|
1355
1365
|
<div class="titles">
|
|
@@ -1363,12 +1373,12 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1363
1373
|
</div>
|
|
1364
1374
|
<div class="actions">
|
|
1365
1375
|
${this.pagination?c`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
1366
|
-
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,
|
|
1367
|
-
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,
|
|
1376
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,yl,au).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
1377
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,yl,au).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
1368
1378
|
</div>`:h}
|
|
1369
1379
|
<slot name="actions"></slot>
|
|
1370
1380
|
</div>
|
|
1371
|
-
</header>`}};
|
|
1381
|
+
</header>`}};yl=new WeakSet,au=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},xs.properties={heading:{},description:{},breadcrumbs:{type:Array},backHref:{attribute:"back-href"},backLabel:{attribute:"back-label"},pagination:{type:Boolean,reflect:!0},hasPrevious:{type:Boolean,attribute:"has-previous"},hasNext:{type:Boolean,attribute:"has-next"}},xs.styles=[E,w`
|
|
1372
1382
|
:host { display: block; }
|
|
1373
1383
|
header {
|
|
1374
1384
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-12) var(--cm-space-20);
|
|
@@ -1426,7 +1436,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1426
1436
|
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
1427
1437
|
.actions { gap: var(--cm-space-8); }
|
|
1428
1438
|
}
|
|
1429
|
-
`];$("cm-page-header",
|
|
1439
|
+
`];$("cm-page-header",xs);var X1=z("actionBar",{label:"Actions"}),ws=class extends T{constructor(){super(...arguments);this.eyebrow="";this.heading="";this.tone="default";this.sticky=!1;this.label=""}render(){let e=this.tone==="critical";return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.heading||this.eyebrow||this.t("label")}>
|
|
1430
1440
|
<div class="lead">
|
|
1431
1441
|
${e?c`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:h}
|
|
1432
1442
|
<div class="text">
|
|
@@ -1436,7 +1446,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1436
1446
|
</div>
|
|
1437
1447
|
</div>
|
|
1438
1448
|
<div class="actions"><slot name="actions"></slot></div>
|
|
1439
|
-
</div>`}};
|
|
1449
|
+
</div>`}};ws.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},ws.styles=[E,w`
|
|
1440
1450
|
:host { display: block; }
|
|
1441
1451
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
1442
1452
|
.bar {
|
|
@@ -1467,13 +1477,13 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1467
1477
|
|
|
1468
1478
|
.actions { gap: var(--cm-space-8); }
|
|
1469
1479
|
}
|
|
1470
|
-
`];$("cm-action-bar",
|
|
1480
|
+
`];$("cm-action-bar",ws);var tk=z("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),Lt,Ir,xl,Se,su,nu,ou,ab,sb,$s=class extends T{constructor(){super(...arguments);m(this,Se);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";m(this,Lt,null);m(this,Ir,()=>{this.open=!0});m(this,xl,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>s(this,Se,su).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,Se,nu).call(this)}updated(e){e.has("form")&&this.isConnected&&s(this,Se,su).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1471
1481
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1472
1482
|
<div class="actions">
|
|
1473
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,
|
|
1474
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,
|
|
1483
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,Se,sb)}>${this.discardLabel}</cm-button>
|
|
1484
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,Se,ab)}>${this.saveLabel}</cm-button>
|
|
1475
1485
|
</div>
|
|
1476
|
-
</div>`}};
|
|
1486
|
+
</div>`}};Lt=new WeakMap,Ir=new WeakMap,xl=new WeakMap,Se=new WeakSet,su=function(){s(this,Se,nu).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,Lt,e),e.addEventListener("input",r(this,Ir)),e.addEventListener("change",r(this,Ir)),e.addEventListener("reset",r(this,xl)))},nu=function(){let e=r(this,Lt);e&&(e.removeEventListener("input",r(this,Ir)),e.removeEventListener("change",r(this,Ir)),e.removeEventListener("reset",r(this,xl)),g(this,Lt,null))},ou=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},ab=function(){this.loading||this.saveDisabled||s(this,Se,ou).call(this,"cm-save")&&r(this,Lt)&&r(this,Lt).requestSubmit()},sb=function(){this.loading||s(this,Se,ou).call(this,"cm-discard")&&r(this,Lt)&&(r(this,Lt).reset(),this.open=!1)},$s.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:{}},$s.styles=[E,w`
|
|
1477
1487
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1478
1488
|
:host(:not([open])) { display: none; }
|
|
1479
1489
|
.bar {
|
|
@@ -1489,14 +1499,14 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1489
1499
|
.message { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; }
|
|
1490
1500
|
|
|
1491
1501
|
}
|
|
1492
|
-
`];$("cm-save-bar"
|
|
1502
|
+
`];$("cm-save-bar",$s);var ok=z("infoItem",{edit:"Edit {label}"}),ks=class extends L{constructor(){super(...arguments);this.heading="";this.action="";this.actionLabel="";this.headingLevel=2;this.variant="default";this.layout="stacked";this._list=!0}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="panel" aria-label=${this.heading||h}>
|
|
1493
1503
|
${this.heading||this.action?c`<header>
|
|
1494
1504
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
1495
1505
|
${this.action?c`<button class="action" type="button" part="action" aria-label=${this.actionLabel||h}
|
|
1496
1506
|
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h}
|
|
1497
1507
|
</header>`:h}
|
|
1498
1508
|
<div class="items" role=${this._list?"list":h}><slot @slotchange=${t=>{this._list=t.target.assignedElements().every(i=>i.localName==="cm-info-item")}}></slot></div>
|
|
1499
|
-
</section>`}};
|
|
1509
|
+
</section>`}};ks.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},layout:{reflect:!0},_list:{state:!0}},ks.styles=[E,w`
|
|
1500
1510
|
:host { display: block; }
|
|
1501
1511
|
section {
|
|
1502
1512
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -1521,9 +1531,9 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1521
1531
|
display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: baseline;
|
|
1522
1532
|
column-gap: var(--cm-space-12); grid-column: 1 / -1; --_cm-info-value-gap: 0px;
|
|
1523
1533
|
}
|
|
1524
|
-
`];$("cm-info-panel",
|
|
1534
|
+
`];$("cm-info-panel",ks);var Es=class extends T{constructor(){super(...arguments);this.label="";this.half=!1;this.editable=!1;this.editLabel=""}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}render(){let e=c`<div class="value" part="value"><slot></slot></div>`;return this.editable?c`<div class="label" part="label">${this.label}</div><div class="row">${e}<button class="edit" part="edit" type="button"
|
|
1525
1535
|
aria-label=${this.editLabel||this.t("edit",{label:this.label})}
|
|
1526
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-edit",{bubbles:!0,composed:!0}))}><cm-icon name="edit" size="16"></cm-icon></button></div>`:c`<div class="label" part="label">${this.label}</div>${e}`}};
|
|
1536
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-edit",{bubbles:!0,composed:!0}))}><cm-icon name="edit" size="16"></cm-icon></button></div>`:c`<div class="label" part="label">${this.label}</div>${e}`}};Es.properties={label:{},half:{type:Boolean,reflect:!0},editable:{type:Boolean,reflect:!0},editLabel:{attribute:"edit-label"}},Es.styles=[E,w`
|
|
1527
1537
|
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
1528
1538
|
:host([half]) { grid-column: auto; }
|
|
1529
1539
|
.label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
|
|
@@ -1542,16 +1552,16 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1542
1552
|
.edit:hover { background: var(--cm-bg-hover); color: var(--cm-icon-selected); }
|
|
1543
1553
|
.edit:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1544
1554
|
@media (pointer: coarse) { .edit::after { content: ''; position: absolute; inset: -8px; } }
|
|
1545
|
-
`];$("cm-info-item",
|
|
1555
|
+
`];$("cm-info-item",Es);var Pr,Ms=class extends L{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;m(this,Pr,R("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">
|
|
1546
1556
|
<div class="h" role="heading" aria-level=${e}>
|
|
1547
|
-
<button type="button" part="toggle" id="${r(this,
|
|
1557
|
+
<button type="button" part="toggle" id="${r(this,Pr)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Pr)}-body"
|
|
1548
1558
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
1549
1559
|
<span>${this.heading}</span>
|
|
1550
1560
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
1551
1561
|
</button>
|
|
1552
1562
|
</div>
|
|
1553
|
-
<div class="body" part="body" id="${r(this,
|
|
1554
|
-
</div>`}};
|
|
1563
|
+
<div class="body" part="body" id="${r(this,Pr)}-body" role="region" aria-labelledby="${r(this,Pr)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
1564
|
+
</div>`}};Pr=new WeakMap,Ms.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Ms.styles=[E,w`
|
|
1555
1565
|
:host { display: block; }
|
|
1556
1566
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
1557
1567
|
.h { margin: 0; font: inherit; }
|
|
@@ -1574,24 +1584,24 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1574
1584
|
.body[hidden] { display: none; }
|
|
1575
1585
|
|
|
1576
1586
|
|
|
1577
|
-
`];$("cm-accordion",
|
|
1587
|
+
`];$("cm-accordion",Ms);var qe,qr,lu,nb,Ts=class extends L{constructor(){super(...arguments);m(this,qe);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="default";this.action="";this.actionHref="";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));if(this.size==="inline")return s(this,qe,nb).call(this,e);let t=this.image?c`<img src=${this.image} alt="" part="image">`:this.icon?c`<cm-icon name=${this.icon} size=${this.size==="large"||this.size==="small"?"48":"24"}></cm-icon>`:h;return c`<div class="wrap" part="empty-state">
|
|
1578
1588
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1579
|
-
<slot name="image" @slotchange=${i=>s(this,
|
|
1589
|
+
<slot name="image" @slotchange=${i=>s(this,qe,qr).call(this,i,"hasImage")}>${t}</slot>
|
|
1580
1590
|
</div>
|
|
1581
1591
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1582
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,
|
|
1583
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,
|
|
1584
|
-
</div>`}};
|
|
1585
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},
|
|
1592
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,qe,qr).call(this,i,"hasText")}></slot></div>
|
|
1593
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,qe,qr).call(this,i,"hasActions")}></slot></div>${this.action?c`<div class="actions">${s(this,qe,lu).call(this)}</div>`:h}
|
|
1594
|
+
</div>`}};qe=new WeakSet,qr=function(e,t){let i=e.target;this[t]=i.assignedNodes({flatten:!0}).some(a=>a.nodeType===1||a.textContent.trim()),this.requestUpdate()},lu=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"
|
|
1595
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},nb=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">
|
|
1586
1596
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1587
|
-
<slot name="image" @slotchange=${i=>s(this,
|
|
1597
|
+
<slot name="image" @slotchange=${i=>s(this,qe,qr).call(this,i,"hasImage")}>${t}</slot>
|
|
1588
1598
|
</span>
|
|
1589
1599
|
<div class="line">
|
|
1590
1600
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1591
|
-
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,
|
|
1592
|
-
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,
|
|
1601
|
+
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,qe,qr).call(this,i,"hasText")}></slot></span>${s(this,qe,lu).call(this)}
|
|
1602
|
+
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,qe,qr).call(this,i,"hasActions")}></slot></span>
|
|
1593
1603
|
</div>
|
|
1594
|
-
</div>`},
|
|
1604
|
+
</div>`},Ts.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0},action:{},actionHref:{attribute:"action-href"}},Ts.styles=[E,w`
|
|
1595
1605
|
:host { display: block; }
|
|
1596
1606
|
/* Default (1.6): a 48px tile with a 24px icon, then 12px to a 16/24 heading, 4px to 13/18 text, 12px to the actions. */
|
|
1597
1607
|
.wrap {
|
|
@@ -1640,7 +1650,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1640
1650
|
:host([size='large']) .circle { width: 120px; height: 120px; }
|
|
1641
1651
|
:host([size='large']) .title { margin-top: var(--cm-space-16); }
|
|
1642
1652
|
}
|
|
1643
|
-
`];$("cm-empty-state",
|
|
1653
|
+
`];$("cm-empty-state",Ts);var ob={small:34,medium:40,large:50,xlarge:186},zs=class extends L{constructor(){super(...arguments);this.variant="text";this.lines=1;this.size="large"}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-hidden","true")}render(){if(this.variant==="thumbnail"){let t=ob[this.size]??ob.large;return c`<span class="bone" part="bone" style="width:${t}px;height:${t}px"></span>`}if(this.variant==="block")return c`<span class="bone block" part="bone"></span>`;let e=Math.max(1,Math.floor(this.lines||1));return c`${Array.from({length:e},(t,i)=>c`<span class="bone line ${e>1&&i===e-1?"short":""}" part="bone"></span>`)}`}};zs.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},zs.styles=[E,w`
|
|
1644
1654
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
1645
1655
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
1646
1656
|
.bone {
|
|
@@ -1655,17 +1665,17 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1655
1665
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
1656
1666
|
}
|
|
1657
1667
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
1658
|
-
`];$("cm-skeleton",
|
|
1668
|
+
`];$("cm-skeleton",zs);var px=[472,90,90,251],ux=[94,266,134,191,138],_s=class extends T{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1}render(){let e=t=>t.map(i=>c`<span class="bone" style="height:${i}px"></span>`);return c`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
1659
1669
|
<span class="sr" role="status">${this.label}</span>
|
|
1660
1670
|
<div class="page" aria-hidden="true">
|
|
1661
1671
|
${this.navigation?c`<span class="bone nav"></span>`:h}
|
|
1662
1672
|
<span class="bone head"></span>
|
|
1663
1673
|
<div class="body">
|
|
1664
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
1665
|
-
<div class="col side">${e(
|
|
1674
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:px)}</div>
|
|
1675
|
+
<div class="col side">${e(ux)}</div>
|
|
1666
1676
|
</div>
|
|
1667
1677
|
</div>
|
|
1668
|
-
</div>`}};
|
|
1678
|
+
</div>`}};_s.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},_s.styles=[E,w`
|
|
1669
1679
|
:host { display: block; }
|
|
1670
1680
|
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-8); }
|
|
1671
1681
|
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
@@ -1689,11 +1699,11 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1689
1699
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
1690
1700
|
.head { height: 60px; }
|
|
1691
1701
|
}
|
|
1692
|
-
`];$("cm-skeleton-display",
|
|
1702
|
+
`];$("cm-skeleton-display",_s);var zk=z("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),Oh,lb,Cs=class extends T{constructor(){super(...arguments);m(this,Oh);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,Oh,lb).call(this);return c`<article part="comment">
|
|
1693
1703
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
1694
1704
|
<div class="body" part="body"><slot></slot></div>
|
|
1695
1705
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
1696
|
-
</article>`}};
|
|
1706
|
+
</article>`}};Oh=new WeakSet,lb=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:ne(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},Cs.properties={author:{},datetime:{},time:{}},Cs.styles=[E,w`
|
|
1697
1707
|
:host { display: block; }
|
|
1698
1708
|
article {
|
|
1699
1709
|
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
@@ -1701,16 +1711,16 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1701
1711
|
}
|
|
1702
1712
|
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
1703
1713
|
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
1704
|
-
`];$("cm-comment",
|
|
1705
|
-
<div class="title" id="${r(this,
|
|
1714
|
+
`];$("cm-comment",Cs);var wl,Bh,cb,Ls=class extends T{constructor(){super(...arguments);m(this,Bh);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;m(this,wl,R("cm-comment-box"));this.hasComments=!1}submit(){let e=this.renderRoot.querySelector("textarea"),t=(e?.value??this.value).trim();if(this.disabled)return;if(!t){e?.focus();return}let i=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(i)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="comment-box" aria-labelledby="${r(this,wl)}-h">
|
|
1715
|
+
<div class="title" id="${r(this,wl)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1706
1716
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
1707
1717
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
1708
|
-
@keydown=${s(this,
|
|
1718
|
+
@keydown=${s(this,Bh,cb)}></textarea>
|
|
1709
1719
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
1710
1720
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
1711
1721
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
1712
1722
|
</div>
|
|
1713
|
-
</section>`}};
|
|
1723
|
+
</section>`}};wl=new WeakMap,Bh=new WeakSet,cb=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},Ls.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Ls.styles=[E,w`
|
|
1714
1724
|
:host { display: block; }
|
|
1715
1725
|
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
1716
1726
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1730,8 +1740,8 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1730
1740
|
|
|
1731
1741
|
.actions { justify-content: flex-end; }
|
|
1732
1742
|
}
|
|
1733
|
-
`];$("cm-comment-box",
|
|
1734
|
-
data-side=${this._side}>${this.content}</div>`}};
|
|
1743
|
+
`];$("cm-comment-box",Ls);var Fh='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',ye,Ds,qi,Oi,si,As,Rs,Xe,cu,jh,Vh,Uh,Kh,Hs,db,Or,du,hu,ni,Ss=class extends L{constructor(){super(...arguments);m(this,Xe);this.content="";this.placement="top";this.delay=400;this.open=!1;this.visualOnly=!1;this._side="top";m(this,ye);m(this,Ds);m(this,qi,[]);m(this,Oi);m(this,si);m(this,As,!1);m(this,Rs,!1);m(this,jh,()=>{g(this,As,!0),clearTimeout(r(this,si)),this.open||g(this,si,setTimeout(()=>this.show(),this.delay))});m(this,Vh,()=>{g(this,As,!1),clearTimeout(r(this,si)),r(this,Rs)||this.hide()});m(this,Uh,()=>{g(this,Rs,!0),this.show()});m(this,Kh,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(g(this,Rs,!1),r(this,As)||this.hide())});m(this,Hs,e=>{e.key==="Escape"&&this.open&&this.hide()});m(this,Or,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(s(this,Xe,hu).call(this),!t||!this.content||this.visualOnly)return;let i=t.updateComplete;t.localName.includes("-")&&i&&!t.shadowRoot?.querySelector(Fh)&&i.then(()=>{t.shadowRoot?.querySelector(Fh)&&r(this,Or).call(this)}),r(this,ye)||(g(this,ye,document.createElement("span")),r(this,ye).id=R("cm-tooltip"),r(this,ye).hidden=!0,r(this,ye).slot="description"),r(this,ye).textContent=this.content,r(this,ye).isConnected||this.append(r(this,ye));let a=s(this,Xe,db).call(this,t);if(g(this,Ds,a),a.getRootNode()===r(this,ye).getRootNode()){let l=(a.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);l.includes(r(this,ye).id)||a.setAttribute("aria-describedby",[...l,r(this,ye).id].join(" "))}else"ariaDescribedByElements"in a?(s(this,Xe,du).call(this,a),g(this,Oi,new MutationObserver(()=>{a.getAttribute("aria-describedby")!==""&&s(this,Xe,du).call(this,a)})),r(this,Oi).observe(a,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,ye).id)});m(this,ni,()=>{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,p=8,u=innerWidth,b=innerHeight,f=getComputedStyle(this).direction==="rtl",x=K=>K==="start"?f?"right":"left":K==="end"?f?"left":"right":K,y={top:a.top-d-l.height>=p,bottom:a.bottom+d+l.height<=b-p,left:a.left-d-l.width>=p,right:a.right+d+l.width<=u-p},k={top:"bottom",bottom:"top",left:"right",right:"left"},S=x(this.placement);!y[S]&&y[k[S]]&&(S=k[S]);let A,q;S==="top"||S==="bottom"?(A=a.left+a.width/2-l.width/2,q=S==="top"?a.top-d-l.height:a.bottom+d):(q=a.top+a.height/2-l.height/2,A=S==="left"?a.left-d-l.width:a.right+d),A=Math.min(Math.max(p,A),u-p-l.width),q=Math.min(Math.max(p,q),b-p-l.height),e.style.transform=`translate(${Math.round(A)}px, ${Math.round(q)}px)`;let B={top:"top",bottom:"bottom",left:f?"end":"start",right:f?"start":"end"};this._side=B[S]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,jh)),this.addEventListener("pointerleave",r(this,Vh)),this.addEventListener("focusin",r(this,Uh)),this.addEventListener("focusout",r(this,Kh)),this.addEventListener("keydown",r(this,Hs)),this.hasUpdated&&r(this,Or).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),s(this,Xe,hu).call(this),s(this,Xe,cu).call(this),clearTimeout(r(this,si))}show(){clearTimeout(r(this,si)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,Hs),!0),addEventListener("scroll",r(this,ni),!0),addEventListener("resize",r(this,ni)),this.updateComplete.then(r(this,ni)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,si)),this.open&&(this.open=!1,s(this,Xe,cu).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,Or).call(this),this.content?this.open&&r(this,ni).call(this):this.hide())}render(){return c`<slot @slotchange=${r(this,Or)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1744
|
+
data-side=${this._side}>${this.content}</div>`}};ye=new WeakMap,Ds=new WeakMap,qi=new WeakMap,Oi=new WeakMap,si=new WeakMap,As=new WeakMap,Rs=new WeakMap,Xe=new WeakSet,cu=function(){document.removeEventListener("keydown",r(this,Hs),!0),removeEventListener("scroll",r(this,ni),!0),removeEventListener("resize",r(this,ni))},jh=new WeakMap,Vh=new WeakMap,Uh=new WeakMap,Kh=new WeakMap,Hs=new WeakMap,db=function(e){return e.matches(Fh)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(Fh)??e},Or=new WeakMap,du=function(e){g(this,qi,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),i=r(this,qi).map(a=>t.getElementById(a)).filter(a=>!!a);e.ariaDescribedByElements=[...i,r(this,ye)]},hu=function(){let e=r(this,Ds);if(!(!e||!r(this,ye))){if(r(this,Oi))r(this,Oi).disconnect(),g(this,Oi,void 0),r(this,qi).length?e.setAttribute("aria-describedby",r(this,qi).join(" ")):e.removeAttribute("aria-describedby"),g(this,qi,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(i=>i&&i!==r(this,ye).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,Ds,void 0)}},ni=new WeakMap,Ss.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},Ss.styles=[E,w`
|
|
1735
1745
|
:host { display: inline-block; position: relative; }
|
|
1736
1746
|
.tip {
|
|
1737
1747
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -1748,7 +1758,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1748
1758
|
:host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
1749
1759
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1750
1760
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1751
|
-
`];$("cm-tooltip",
|
|
1761
|
+
`];$("cm-tooltip",Ss);var Ik=z("timelineItem",{justNow:"Just now",minutesAgo:{one:"{count} minute ago",other:"{count} minutes ago"},hoursAgo:{one:"{count} hour ago",other:"{count} hours ago"},daysAgo:{one:"{count} day ago",other:"{count} days ago"},inMinutes:{one:"In {count} minute",other:"In {count} minutes"},inHours:{one:"In {count} hour",other:"In {count} hours"},inDays:{one:"In {count} day",other:"In {count} days"},showAll:"Show all",showLess:"Show less"}),Pk=z("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),gx=7,$l=new Set,kl;function hb(o,n){n?$l.add(o):$l.delete(o),$l.size&&!kl&&(kl=setInterval(()=>$l.forEach(e=>e.requestUpdate()),6e4)),!$l.size&&kl&&(clearInterval(kl),kl=void 0)}var El,Fr,bt,mu,Wh,mb,Ns=class extends T{constructor(){super(...arguments);m(this,bt);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;m(this,El,R("cm-tl"));m(this,Fr)}connectedCallback(){super.connectedCallback(),hb(this,!0)}disconnectedCallback(){super.disconnectedCallback(),hb(this,!1),r(this,Fr)?.disconnect(),g(this,Fr,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(g(this,Fr,new ResizeObserver(()=>s(this,bt,mu).call(this))),r(this,Fr).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&s(this,bt,mu).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<gx?this.t(i?"inDays":"daysAgo",{count:d}):ne(e,{dateStyle:"medium"},this.locale)}get fullTime(){let e=this.date;return e?ne(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">
|
|
1752
1762
|
<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>
|
|
1753
1763
|
<div class="main">
|
|
1754
1764
|
<div class="head">
|
|
@@ -1756,14 +1766,14 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1756
1766
|
<slot name="badge"></slot></span>
|
|
1757
1767
|
${l}
|
|
1758
1768
|
</div>
|
|
1759
|
-
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,
|
|
1760
|
-
<div class="body ${a?"clamp":""}" id="${r(this,
|
|
1761
|
-
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,
|
|
1769
|
+
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,bt,Wh).call(this,d,"_meta")}>${this.meta}</slot></div>
|
|
1770
|
+
<div class="body ${a?"clamp":""}" id="${r(this,El)}-body" part="body" ?hidden=${!this._body}
|
|
1771
|
+
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,bt,Wh).call(this,d,"_body")}></slot></div>
|
|
1762
1772
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
1763
|
-
aria-controls="${r(this,
|
|
1764
|
-
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,
|
|
1773
|
+
aria-controls="${r(this,El)}-body" @click=${s(this,bt,mb)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
1774
|
+
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,bt,Wh).call(this,d,"_actions")}></slot></div>
|
|
1765
1775
|
</div>
|
|
1766
|
-
</div>`}};
|
|
1776
|
+
</div>`}};El=new WeakMap,Fr=new WeakMap,bt=new WeakSet,mu=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},Wh=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(a=>a.nodeType===Node.ELEMENT_NODE||(a.textContent??"").trim())},mb=function(){this.expanded=!this.expanded},Ns.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}},Ns.styles=[E,w`
|
|
1767
1777
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
1768
1778
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
1769
1779
|
.icon {
|
|
@@ -1808,16 +1818,16 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1808
1818
|
[hidden] { display: none !important; }
|
|
1809
1819
|
.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; }
|
|
1810
1820
|
::slotted([slot='badge']) { flex: none; }
|
|
1811
|
-
`];$("cm-timeline-item",
|
|
1821
|
+
`];$("cm-timeline-item",Ns);var Ml,Is,jr,pu,pb,Br=class extends T{constructor(){super(...arguments);m(this,jr);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];m(this,Ml,new MutationObserver(()=>s(this,jr,pu).call(this)));m(this,Is,!1)}connectedCallback(){super.connectedCallback(),s(this,jr,pu).call(this),r(this,Ml).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Ml).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){g(this,Is,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,Is)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,Is,!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">
|
|
1812
1822
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
1813
1823
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
1814
1824
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
1815
1825
|
</ol>`:h}
|
|
1816
1826
|
${i}
|
|
1817
1827
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
1818
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,
|
|
1828
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,jr,pb)}>${this.moreLabel}</cm-button></div>`:h}
|
|
1819
1829
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
1820
|
-
`}};
|
|
1830
|
+
`}};Ml=new WeakMap,Is=new WeakMap,jr=new WeakSet,pu=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},pb=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},Br.shadowRootOptions={...L.shadowRootOptions,slotAssignment:"manual"},Br.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}},Br.styles=[E,w`
|
|
1821
1831
|
:host { display: block; }
|
|
1822
1832
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
1823
1833
|
ol:focus { outline: none; }
|
|
@@ -1840,14 +1850,14 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1840
1850
|
@media (max-width: 640px) {
|
|
1841
1851
|
.more { padding-inline-start: 0; }
|
|
1842
1852
|
}
|
|
1843
|
-
`];$("cm-timeline",
|
|
1853
|
+
`];$("cm-timeline",Br);var Vk=z("smartTip",{newTab:"(opens in a new tab)"}),Uk=z("smartTips",{heading:"Smart tips",tourAction:"Start"}),Ps=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}>
|
|
1844
1854
|
<span class="text">
|
|
1845
1855
|
<span class="title" part="heading">${this.heading}</span>
|
|
1846
1856
|
<span class="desc" part="description"><slot></slot></span>
|
|
1847
1857
|
${e?c`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">${this.t("newTab")}</span>`:h}
|
|
1848
1858
|
</span>
|
|
1849
1859
|
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
1850
|
-
</a>`}};
|
|
1860
|
+
</a>`}};Ps.properties={heading:{},href:{},target:{}},Ps.styles=[E,w`
|
|
1851
1861
|
:host { display: block; }
|
|
1852
1862
|
a {
|
|
1853
1863
|
display: flex; align-items: flex-start; gap: var(--cm-space-8); padding: var(--cm-space-16);
|
|
@@ -1864,7 +1874,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1864
1874
|
}
|
|
1865
1875
|
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
1866
1876
|
a:hover .title { text-decoration: underline; }
|
|
1867
|
-
`];$("cm-smart-tip",
|
|
1877
|
+
`];$("cm-smart-tip",Ps);var qs=class extends T{constructor(){super(...arguments);this.tourHeading="";this.headingLevel=2}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<div class="card" part="smart-tips">
|
|
1868
1878
|
${this.tourHeading?c`<div class="tour" part="tour">
|
|
1869
1879
|
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="16"></cm-icon>
|
|
1870
1880
|
</span>
|
|
@@ -1875,7 +1885,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1875
1885
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1876
1886
|
<div class="list" role="list"><slot></slot></div>
|
|
1877
1887
|
</section>
|
|
1878
|
-
</div>`}};
|
|
1888
|
+
</div>`}};qs.properties={heading:{string:"heading"},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action",string:"tourAction"},headingLevel:{type:Number,attribute:"heading-level"}},qs.styles=[E,w`
|
|
1879
1889
|
:host { display: block; }
|
|
1880
1890
|
.card { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1881
1891
|
.tour {
|
|
@@ -1892,24 +1902,24 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1892
1902
|
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;
|
|
1893
1903
|
}
|
|
1894
1904
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1895
|
-
`];$("cm-smart-tips",
|
|
1905
|
+
`];$("cm-smart-tips",qs);var Xk=z("pagination",{label:"Pagination",rows:"Number of rows",summary:"Showing {from}\u2013{to} of {total} {resource}",page:"Page",of:"of {count}",previous:"Previous page",next:"Next page"}),oi,Bs,ub,gb,Os=class extends T{constructor(){super(...arguments);m(this,Bs);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;m(this,oi,R("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`
|
|
1896
1906
|
<nav part="bar" aria-label=${this.label}>
|
|
1897
1907
|
${l.length?c`<div class="rows" part="rows">
|
|
1898
|
-
<label for="${r(this,
|
|
1899
|
-
<span class="field"><select id="${r(this,
|
|
1900
|
-
${(l.includes(this.pageSize)?l:[...l,this.pageSize].sort((d,
|
|
1908
|
+
<label for="${r(this,oi)}-s">${this.t("rows")}</label>
|
|
1909
|
+
<span class="field"><select id="${r(this,oi)}-s" @change=${s(this,Bs,ub)}>
|
|
1910
|
+
${(l.includes(this.pageSize)?l:[...l,this.pageSize].sort((d,p)=>d-p)).map(d=>c`<option value=${d} ?selected=${d===this.pageSize}>${d}</option>`)}
|
|
1901
1911
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
1902
1912
|
</div>`:h}
|
|
1903
1913
|
<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>
|
|
1904
1914
|
<div class="pages" part="pages">
|
|
1905
1915
|
<span class="counter">
|
|
1906
|
-
<label for="${r(this,
|
|
1907
|
-
<input id="${r(this,
|
|
1908
|
-
.value=${this._draft??String(t)} aria-describedby="${r(this,
|
|
1916
|
+
<label for="${r(this,oi)}-p">${this.t("page")}</label>
|
|
1917
|
+
<input id="${r(this,oi)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1918
|
+
.value=${this._draft??String(t)} aria-describedby="${r(this,oi)}-of"
|
|
1909
1919
|
@input=${d=>this._draft=d.target.value}
|
|
1910
|
-
@keydown=${s(this
|
|
1920
|
+
@keydown=${s(this,Bs,gb)}
|
|
1911
1921
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
1912
|
-
<span id="${r(this,
|
|
1922
|
+
<span id="${r(this,oi)}-of">${this.t("of",{count:e})}</span>
|
|
1913
1923
|
</span>
|
|
1914
1924
|
<span class="arrows">
|
|
1915
1925
|
<button class="prev" type="button" part="previous" aria-label=${this.t("previous")} ?disabled=${t<=1}
|
|
@@ -1919,7 +1929,7 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1919
1929
|
</span>
|
|
1920
1930
|
</div>
|
|
1921
1931
|
</nav>
|
|
1922
|
-
`}};
|
|
1932
|
+
`}};oi=new WeakMap,Bs=new WeakSet,ub=function(e){let t=Number(e.target.value);t!==this.pageSize&&(this.pageSize=t,this.page=1,this.dispatchEvent(new CustomEvent("cm-page-size-change",{detail:{pageSize:t},bubbles:!0,composed:!0})))},gb=function(e){e.key==="Enter"?(e.preventDefault(),this.goTo(Number(e.target.value))):e.key==="Escape"&&(this._draft=null,e.target.value=String(this.page))},Os.properties={page:{type:Number,reflect:!0},total:{type:Number},pageSize:{type:Number,attribute:"page-size"},pageSizes:{type:Array,attribute:"page-sizes"},label:{string:"label"},resourceName:{attribute:"resource-name"},_draft:{state:!0}},Os.styles=[E,w`
|
|
1923
1933
|
:host { display: block; }
|
|
1924
1934
|
nav {
|
|
1925
1935
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -1962,17 +1972,17 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
1962
1972
|
select, input { height: var(--cm-control-height-touch); }
|
|
1963
1973
|
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
1964
1974
|
}
|
|
1965
|
-
`];$("cm-pagination",
|
|
1975
|
+
`];$("cm-pagination",Os);var iE=z("statusTabs",{label:"Status",option:"{label} ({count})"}),js,zl,ge,Tl,fb,uu,bb,gu,vb,Fs=class extends T{constructor(){super(...arguments);m(this,ge);this.value="";this.tabs=[];this.controls="";this.size="large";this.mobile="scroll";this._more="";m(this,js,new ResizeObserver(()=>s(this,ge,Tl).call(this)));this._slotted=[];m(this,zl,new MutationObserver(()=>s(this,ge,uu).call(this)))}connectedCallback(){super.connectedCallback(),s(this,ge,uu).call(this),r(this,zl).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,zl).disconnect(),r(this,js).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector(".tabs");r(this,js).observe(e),e.addEventListener("scroll",()=>s(this,ge,Tl).call(this),{passive:!0}),document.fonts?.ready.then(()=>s(this,ge,Tl).call(this))}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){let t=this.renderRoot.querySelector(".pick select");t&&t.offsetParent!==null?t.focus(e):this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(e){s(this,ge,Tl).call(this);for(let a of this.renderRoot.querySelectorAll(".tabs > *"))r(this,js).observe(a);if(!("ariaControlsElements"in Element.prototype))return;let t=this.getRootNode(),i=this.controls?t.getElementById?.(this.controls):null;for(let a of this.renderRoot.querySelectorAll("button, select"))a.ariaControlsElements=i?[i]:null}render(){let e=this.items,t=s(this,ge,bb).call(this,e),i=this.getAttribute("aria-label")||this.t("label");return c`
|
|
1966
1976
|
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${i}>
|
|
1967
1977
|
${e.map((a,l)=>c`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
1968
1978
|
tabindex=${l===t?"0":"-1"} ?disabled=${!!a.disabled}
|
|
1969
|
-
@click=${()=>s(this,
|
|
1979
|
+
@click=${()=>s(this,ge,gu).call(this,l)} @keydown=${d=>s(this,ge,vb).call(this,d,l)}><span class="label" data-text=${a.label}>${a.label}</span>${a.count!==void 0&&!Number.isNaN(a.count)?c`<span class="sr">, </span><span class="count" part="count">${this.formatNumber(a.count)}</span>`:h}</button>`)}
|
|
1970
1980
|
</div>
|
|
1971
|
-
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,
|
|
1981
|
+
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,ge,fb)}>
|
|
1972
1982
|
${e.map((a,l)=>c`<option value=${a.value} ?disabled=${!!a.disabled} ?selected=${l===t} .selected=${l===t}>${a.count!==void 0&&!Number.isNaN(a.count)?this.t("option",{label:a.label,count:a.count}):a.label}</option>`)}
|
|
1973
1983
|
</select><cm-icon name="chevron-down" size="16"></cm-icon></div>`:h}
|
|
1974
1984
|
<slot></slot>
|
|
1975
|
-
`}};
|
|
1985
|
+
`}};js=new WeakMap,zl=new WeakMap,ge=new WeakSet,Tl=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),a=t>1&&i>1,l=t>1&&i<t-1,d=a&&l?"both":a?"start":l?"end":"";d!==this._more&&(this._more=d)},fb=function(e){let t=e.target.value;t!==this.value&&(this.value=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},uu=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??"")},bb=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},gu=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}))))},vb=function(e,t){let i=J(e,this),a=this.items.flatMap((p,u)=>p.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,ge,gu).call(this,d)},Fs.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},mobile:{reflect:!0},_slotted:{state:!0},_more:{state:!0}},Fs.styles=[E,w`
|
|
1976
1986
|
:host { display: block; }
|
|
1977
1987
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
1978
1988
|
.tabs {
|
|
@@ -2031,20 +2041,20 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
2031
2041
|
:host([mobile='select']) .tabs { display: none; }
|
|
2032
2042
|
:host([mobile='select']) .pick { display: block; }
|
|
2033
2043
|
}
|
|
2034
|
-
`];$("cm-status-tabs",
|
|
2044
|
+
`];$("cm-status-tabs",Fs);var lE=z("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),Gh,_l,li,fu,yb,xb,Vs=class extends T{constructor(){super(...arguments);m(this,li);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;m(this,Gh,R("cm-th"));m(this,_l,new MutationObserver(()=>s(this,li,fu).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),s(this,li,fu).call(this),r(this,_l).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,_l).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`
|
|
2035
2045
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
2036
2046
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
2037
2047
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
2038
|
-
<input id="${r(this,
|
|
2039
|
-
@change=${s(this,
|
|
2048
|
+
<input id="${r(this,Gh)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
2049
|
+
@change=${s(this,li,xb)} />
|
|
2040
2050
|
<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>
|
|
2041
2051
|
</span></span>`:h}
|
|
2042
2052
|
${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}
|
|
2043
|
-
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,
|
|
2053
|
+
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,li,yb).call(this,i)}>${d}${e?h:c`<span class="sr">${a?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
2044
2054
|
name=${a&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
2045
2055
|
</div>
|
|
2046
2056
|
<slot></slot>
|
|
2047
|
-
`}};
|
|
2057
|
+
`}};Gh=new WeakMap,_l=new WeakMap,li=new WeakSet,fu=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"}})},yb=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}))},xb=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}))},Vs.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}},Vs.styles=[E,w`
|
|
2048
2058
|
:host { display: block; }
|
|
2049
2059
|
slot { display: none; } /* <option> children are column data, not content */
|
|
2050
2060
|
.bar {
|
|
@@ -2099,10 +2109,10 @@ var Zu=o=>{throw TypeError(o)};var hm=(o,n,e)=>n.has(o)||Zu("Cannot "+e);var r=(
|
|
|
2099
2109
|
:host([resource-rows][mobile='stack']) .bar:not(.sel) { display: flex; flex-wrap: wrap; gap: var(--cm-space-4) var(--cm-space-12); padding-block: var(--cm-space-8); }
|
|
2100
2110
|
:host([resource-rows][mobile='stack']) .bar:not(.sel) > .cell:first-child { flex: 1 1 100%; }
|
|
2101
2111
|
}
|
|
2102
|
-
`];$("cm-table-header",
|
|
2112
|
+
`];$("cm-table-header",Vs);var fx=`
|
|
2103
2113
|
[data-cm-density="compact"] { --cm-table-row-height: 40px; --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
2104
2114
|
[data-cm-density="comfortable"] { --cm-table-row-height: 48px; --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
|
|
2105
|
-
`,
|
|
2115
|
+
`,Yh=null,wb=new WeakSet;function Xh(o){if(typeof document>"u"||typeof CSSStyleSheet>"u")return;let n=[document],e=o.getRootNode();e instanceof ShadowRoot&&n.push(e);for(let t of n)if(!wb.has(t)){wb.add(t);try{Yh||(Yh=new CSSStyleSheet,Yh.replaceSync(fx)),t.adoptedStyleSheets=[...t.adoptedStyleSheets,Yh]}catch{}}}var bE=z("dataTable",{empty:"No data",sorted:"Sorted by {column}, {direction}",scrollHint:"Scroll for more",columns:"Columns",showColumns:"Show columns",resize:"Resize {column} column",resized:"{column} column, {width} pixels wide",viewAll:"View all fields",viewLess:"Hide fields",rowAction:"{action}, {name}"}),$b=48,kb=16,Eb=!1,bx=`
|
|
2106
2116
|
cm-data-table > table { width: 100%; border-collapse: separate; border-spacing: 0; font: inherit; font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); font-variant-numeric: tabular-nums; color: var(--cm-text-default); }
|
|
2107
2117
|
cm-data-table > table caption { text-align: start; font-weight: 600; font-size: var(--cm-font-size-16); line-height: var(--cm-line-height-16); padding-block-end: var(--cm-space-8); }
|
|
2108
2118
|
cm-data-table > table th, cm-data-table > table td { box-sizing: border-box; }
|
|
@@ -2151,52 +2161,52 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2151
2161
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
|
|
2152
2162
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
|
|
2153
2163
|
}
|
|
2154
|
-
`;function
|
|
2164
|
+
`;function vx(){if(Eb||typeof document>"u")return;Eb=!0;let o=new CSSStyleSheet;o.replaceSync(bx),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var Cl=o=>o.type==="numeric"||o.type==="money",yx=o=>(o.align??(Cl(o)||o.type==="actions"?"end":"start"))==="end",xx=o=>!o.type||o.type==="text";function Mb(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 Tb=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),zb=new Map;function wx(o){let n=zb.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"})}zb.set(o??"",n)}return n}function _b(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"?(Mb(o)||0)-(Mb(n)||0):e==="date"?(Tb(o)||0)-(Tb(n)||0):wx(t).compare(String(o),String(n))}var Cb=o=>o.parentElement??o.getRootNode().host??null,Xs,Js,Ll,Zs,Vr,Qs,Ur,tm,_,bu,vu,yu,Lb,xu,Sb,Db,Ab,Kr,Us,Ks,Jh,Ws,Gs,Zh,wu,$u,ku,Rb,Hb,Eu,Mu,Qh,Nb,Ib,Pb,Bi,em,en,qb,Ob,Bb,Fb,jb,Vb,Ub,Ys=class extends T{constructor(){super(...arguments);m(this,_);this.columns=[];this.rows=[];this.totals=null;this.caption="";this.captionHidden=!1;this.sort="";this.direction="ascending";this.sortMode="auto";this.stickyHeader=!1;this.stickyFirstColumn=!1;this.loading=!1;this.loadingRows=5;this.mobile="scroll";this.rowActions="hover";this.resizable=!1;this.columnPicker=!1;this._light=!1;this._announce="";this._widths={};this._expanded=new Set;this._picker=!1;this._overflows=!1;m(this,Xs,!1);m(this,Js,R("cm-dt"));m(this,Ll,new MutationObserver(()=>s(this,_,bu).call(this)));m(this,Zs,typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s(this,_,Us).call(this)));m(this,Vr,[]);m(this,Qs,0);m(this,Ur,-1);m(this,tm,e=>{e.target?.closest?.("[data-lines]")&&s(this,_,Zh).call(this,e)});m(this,Kr,()=>{r(this,Qs)||!this.stickyHeader||g(this,Qs,requestAnimationFrame(()=>{g(this,Qs,0),s(this,_,Us).call(this)}))});m(this,Bi,new Ee);m(this,en,e=>{let t=this.renderRoot.querySelector(".tools");t&&!e.composedPath().includes(t)&&s(this,_,em).call(this,!1)})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerover",r(this,tm)),Xh(this),s(this,_,bu).call(this),r(this,Ll).observe(this,{childList:!0,subtree:!0}),document.addEventListener("scroll",r(this,Kr),{capture:!0,passive:!0}),window.addEventListener("resize",r(this,Kr),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Bi).close(),r(this,Ll).disconnect(),r(this,Zs)?.disconnect(),g(this,Vr,[]),document.removeEventListener("scroll",r(this,Kr),{capture:!0}),window.removeEventListener("resize",r(this,Kr)),document.removeEventListener("pointerdown",r(this,en),{capture:!0})}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(a=>a.key===this.sort);if(!t||this.sortMode==="manual")return e;let i=this.direction==="descending"?-1:1;return e.map((a,l)=>[a,l]).sort(([a,l],[d,p])=>{let u=a[t.key],b=d[t.key],f=u==null||u==="",x=b==null||b==="";return f||x?f===x?l-p:f?1:-1:i*_b(u,b,t.type,this.locale)||l-p}).map(([a])=>a)}get visibleColumns(){return(this.columns??[]).filter(e=>e.visible!==!1)}updated(e){if(this._picker&&!r(this,Bi).active?r(this,Bi).open(this.renderRoot.querySelector(".panel"),this.renderRoot.querySelector(".pick"),{align:"end"}):!this._picker&&r(this,Bi).active&&r(this,Bi).close(),r(this,Xs)&&(e.has("sort")||e.has("direction"))&&this.sort){g(this,Xs,!1);let t=this.columns.find(i=>i.key===this.sort);t&&s(this,_,yu).call(this,t.label,this.direction)}if(e.has("columns")){let t=e.get("columns")??[],i={...this._widths},a=!1;for(let l of this.columns??[]){let d=t.find(p=>p.key===l.key);l.width!==void 0&&d?.width!==l.width&&i[l.key]!==void 0&&(delete i[l.key],a=!0)}a&&(this._widths=i)}s(this,_,Ab).call(this),s(this,_,Us).call(this)}render(){let e=c`<span class="sr" role="status">${this._announce}</span>`,t=c`<p class="hint" part="scroll-hint" aria-hidden="true">${this.t("scrollHint")}<cm-icon name="chevron-right" size="16"></cm-icon></p>`,i=c`<span class="fade s" aria-hidden="true"></span><span class="fade e" aria-hidden="true"></span>`,a=this.stickyHeader||this.stickyFirstColumn||this._overflows;if(this._light)return c`<div class="frame" part="frame"><div class="wrap"><div class="scroll" part="scroll" tabindex=${this._overflows?"0":h}
|
|
2155
2165
|
role=${this._overflows?"region":h} aria-label=${this._overflows?this.querySelector("caption")?.textContent?.trim()||h:h}
|
|
2156
|
-
@scroll=${()=>s(this,_,
|
|
2157
|
-
<div class="frame" part="frame" ?data-cards=${
|
|
2158
|
-
${this.columnPicker?s(this,_,
|
|
2166
|
+
@scroll=${()=>s(this,_,Us).call(this)}><slot></slot></div>${i}</div>${t}</div>${e}`;let l=this.visibleColumns,d=s(this,_,$u).call(this,l),p=this.mobile==="priority"?l.filter(y=>y.priority==="low"&&y!==d):[],u=this.sortedRows,b=Math.max(1,l.length),f=!this.loading&&u.length===0,x=this.mobile==="cards"&&!this.loading&&u.length>0;return c`
|
|
2167
|
+
<div class="frame" part="frame" ?data-cards=${x}>
|
|
2168
|
+
${this.columnPicker?s(this,_,Bb).call(this):h}
|
|
2159
2169
|
<div class="wrap">
|
|
2160
2170
|
<div class="scroll" part="scroll" tabindex=${a?"0":h}
|
|
2161
2171
|
role=${a?"region":h}
|
|
2162
|
-
aria-label=${a&&this.caption?this.caption:h} @scroll=${()=>s(this,_,
|
|
2163
|
-
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,_,
|
|
2164
|
-
@focusout=${s(this,_,
|
|
2172
|
+
aria-label=${a&&this.caption?this.caption:h} @scroll=${()=>s(this,_,Us).call(this)}>
|
|
2173
|
+
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,_,Zh)} @focusin=${s(this,_,wu)}
|
|
2174
|
+
@focusout=${s(this,_,wu)}>
|
|
2165
2175
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
2166
|
-
<thead><tr>${l.map(y=>s(this,_,
|
|
2176
|
+
<thead><tr>${l.map(y=>s(this,_,Fb).call(this,y,d))}</tr></thead>
|
|
2167
2177
|
<tbody>
|
|
2168
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,
|
|
2169
|
-
${
|
|
2178
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,Ws).call(this,y,d)} style=${s(this,_,Gs).call(this,y)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((y,k)=>s(this,_,jb).call(this,y,l,d,p,k))}
|
|
2179
|
+
${f?c`<tr class="empty"><td colspan=${b}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
2170
2180
|
</tbody>
|
|
2171
|
-
${this.totals&&!this.loading&&!
|
|
2181
|
+
${this.totals&&!this.loading&&!f?c`<tfoot><tr part="totals">${l.map(y=>c`<td class=${s(this,_,Ws).call(this,y,d)} style=${s(this,_,Gs).call(this,y)}>${y.type==="actions"?h:s(this,_,Ks).call(this,this.totals[y.key])}</td>`)}</tr></tfoot>`:h}
|
|
2172
2182
|
</table>
|
|
2173
2183
|
</div>
|
|
2174
2184
|
${i}
|
|
2175
2185
|
</div>
|
|
2176
2186
|
${t}
|
|
2177
|
-
${
|
|
2187
|
+
${x?s(this,_,Ub).call(this,u,l,d):h}
|
|
2178
2188
|
</div>${e}
|
|
2179
|
-
`}};
|
|
2189
|
+
`}};Xs=new WeakMap,Js=new WeakMap,Ll=new WeakMap,Zs=new WeakMap,Vr=new WeakMap,Qs=new WeakMap,Ur=new WeakMap,tm=new WeakMap,_=new WeakSet,bu=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(vx(),s(this,_,Lb).call(this))},vu=function(e){this._announce=this._announce===e?`${e}\xA0`:e},yu=function(e,t){s(this,_,vu).call(this,this.t("sorted",{column:e,direction:this.t(t)}))},Lb=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;if(!t)return;let i=[...t];i.forEach((a,l)=>{if(!a.dataset.sort||a.querySelector(":scope > button.cm-sort"))return;a.dataset.type=a.dataset.sort;let d=document.createElement("button");d.type="button",d.className="cm-sort",d.append(...a.childNodes);let p=document.createElement("cm-icon");p.setAttribute("size","12"),d.append(p),a.append(d),a.hasAttribute("aria-sort")||a.setAttribute("aria-sort","none"),s(this,_,xu).call(this,a),d.addEventListener("click",()=>s(this,_,Sb).call(this,e,a,l))});for(let a of[...e.tBodies,...e.tFoot?[e.tFoot]:[]])for(let l of a.rows)[...l.cells].forEach((d,p)=>{let u=i[p];u&&(d.dataset.label||(d.dataset.label=(u.textContent??"").trim()),u.dataset.priority&&!d.dataset.priority&&(d.dataset.priority=u.dataset.priority),u.dataset.type==="actions"&&!d.dataset.type&&(d.dataset.type="actions"))})},xu=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Sb=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",p=new CustomEvent("cm-sort",{detail:{key:l,direction:d},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(p)||this.sortMode==="manual")return;let u=t.dataset.sort,b=d==="descending"?-1:1;for(let f of e.tBodies){let x=k=>{let S=k.cells[i];return S?(S.dataset.value??S.textContent??"").trim():""},y=[...f.rows].map((k,S)=>[k,x(k),S]).sort(([,k,S],[,A,q])=>k===""||A===""?k===A?S-q:k===""?1:-1:b*_b(k,A,u,this.locale)||S-q);f.append(...y.map(([k])=>k))}for(let f of e.tHead.rows[0].cells)f.dataset.sort&&(f.setAttribute("aria-sort",f===t?d:"none"),s(this,_,xu).call(this,f));s(this,_,yu).call(this,a,d)},Db=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",i=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),a=this.dispatchEvent(i);g(this,Xs,a),a&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},Ab=function(){let e=[this.renderRoot.querySelector(".scroll"),this.renderRoot.querySelector("table")??this.querySelector(":scope > table")].filter(Boolean);e.length===r(this,Vr).length&&e.every((t,i)=>t===r(this,Vr)[i])||(r(this,Zs)?.disconnect(),e.forEach(t=>r(this,Zs)?.observe(t)),g(this,Vr,e))},Kr=new WeakMap,Us=function(){let e=this.renderRoot?.querySelector(".scroll"),t=this.renderRoot?.querySelector(".frame");if(!e||!t)return;let i=getComputedStyle(e).maxBlockSize!=="none",a=e.scrollWidth>e.clientWidth+1;a!==this._overflows&&(this._overflows=a),e.toggleAttribute("data-open",this.stickyHeader&&!i&&!a);let l=Math.abs(e.scrollLeft);t.toggleAttribute("data-more-start",a&&l>1),t.toggleAttribute("data-more-end",a&&l+e.clientWidth<e.scrollWidth-1);let d=this.renderRoot.querySelector("caption")??this.querySelector(":scope > table > caption"),p=d&&getComputedStyle(d).position!=="absolute"?`${d.offsetHeight}px`:"";e.parentElement.style.getPropertyValue("--_cap")!==p&&e.parentElement.style.setProperty("--_cap",p);let u=0,b=this.renderRoot.querySelector("table")??this.querySelector(":scope > table"),f=b?.tHead;if(this.stickyHeader&&!i&&a&&b&&f){let x=r(this,Ur)>0?r(this,Ur):0,y=f.getBoundingClientRect().top-x,k=b.getBoundingClientRect().bottom-x,S=0;for(let A=Cb(this);A&&A!==document.documentElement&&A!==document.body;A=Cb(A)){let q=getComputedStyle(A);/(auto|scroll|overlay|hidden|clip)/.test(q.overflowY)&&(S=Math.max(S,A.getBoundingClientRect().top+A.clientTop+(parseFloat(q.paddingTop)||0)))}S+=parseFloat(getComputedStyle(this).getPropertyValue("--cm-data-table-sticky-top"))||0,u=Math.max(0,Math.min(S-y,k-y-f.getBoundingClientRect().height))}for(let x of this.renderRoot.querySelectorAll(".rz")){let y=String(Math.round(x.closest("th").getBoundingClientRect().width));x.getAttribute("aria-valuenow")!==y&&x.setAttribute("aria-valuenow",y)}u!==r(this,Ur)&&(g(this,Ur,u),u?e.style.setProperty("--_shift",`${u}px`):e.style.removeProperty("--_shift"))},Ks=function(e){return e==null?"":e instanceof Date?ne(e,{},this.locale):String(e)},Jh=function(e){return this._widths[e.key]??e.width},Ws=function(e,t){return[yx(e)&&"end",Cl(e)&&"num",(Cl(e)||e.type==="date")&&"nw",e.type==="actions"&&"act",e.priority==="low"&&e!==t&&"low",s(this,_,Jh).call(this,e)!==void 0&&"w"].filter(Boolean).join(" ")},Gs=function(e){let t=s(this,_,Jh).call(this,e);return t===void 0?h:`--_w: ${t}px`},Zh=function(e){let t=e.composedPath()[0]?.closest?.("[data-lines]");if(t&&this.contains(t)){t.scrollWidth>t.clientWidth+1||t.scrollHeight>t.clientHeight+1?t.title=t.textContent?.trim()??"":t.removeAttribute("title");return}let i=e.composedPath()[0]?.closest?.(".t");i&&(i.scrollWidth>i.clientWidth+1||i.scrollHeight>i.clientHeight+1?i.title=i.textContent??"":i.removeAttribute("title"))},wu=function(e){e.type==="focusin"&&s(this,_,Zh).call(this,e);let t=e.composedPath().find(a=>a instanceof HTMLTableRowElement);if(!t)return;let i=e.type==="focusin"||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget);t.toggleAttribute("data-focus",i)},$u=function(e){return e.find(t=>t.primary)??e.find(t=>t.type!=="actions")??e[0]},ku=function(e,t){return t?s(this,_,Ks).call(this,e[t.key]):""},Rb=function(e,t){let i=t[e.key];return Array.isArray(i)?i:e.actions??[]},Hb=function(e,t){let i=(this.rows??[]).indexOf(t);this.dispatchEvent(new CustomEvent("cm-row-action",{detail:{action:e.value??e.label,row:t,index:i},bubbles:!0,composed:!0}))},Eu=function(e,t,i){return c`<span class="acts">${s(this,_,Rb).call(this,e,t).map(a=>c`<cm-button size="slim" icon=${a.icon??h}
|
|
2180
2190
|
?icon-only=${!!a.iconOnly} label=${a.iconOnly?this.t("rowAction",{action:a.label,name:i}):h} tone=${a.tone??h}
|
|
2181
|
-
@click=${()=>s(this,_,
|
|
2182
|
-
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,
|
|
2183
|
-
@click=${()=>s(this,_,
|
|
2184
|
-
<fieldset class="panel" id="${r(this,
|
|
2191
|
+
@click=${()=>s(this,_,Hb).call(this,a,t)}>${a.label}${a.iconOnly||!i?h:c`<span class="sr">, ${i}</span>`}</cm-button>`)}</span>`},Mu=function(e,t,i){if(e.type==="actions")return s(this,_,Eu).call(this,e,t,i);let a=s(this,_,Ks).call(this,t[e.key]);if(!xx(e))return a;let l=Math.trunc(Number(e.lines))||0;return l>1?c`<span class="t lines" style="--_lines: ${l}">${a}</span>`:c`<span class="t">${a}</span>`},Qh=function(e,t,i){let a=Math.max($b,Math.round(t));this._widths={...this._widths,[e.key]:a},i&&(s(this,_,vu).call(this,this.t("resized",{column:e.label,width:a})),this.dispatchEvent(new CustomEvent("cm-column-resize",{detail:{key:e.key,width:a},bubbles:!0,composed:!0})))},Nb=function(e,t){return s(this,_,Jh).call(this,e)??Math.round(t.closest("th").getBoundingClientRect().width)},Ib=function(e,t){let i=J(e,this);i!=="ArrowLeft"&&i!=="ArrowRight"||(e.preventDefault(),s(this,_,Qh).call(this,t,s(this,_,Nb).call(this,t,e.currentTarget)+(i==="ArrowRight"?kb:-kb),!0))},Pb=function(e,t){if(e.button!==0)return;e.preventDefault();let i=e.currentTarget,a=i.closest("th").getBoundingClientRect().width,l=e.clientX,d=getComputedStyle(this).direction==="rtl";try{i.setPointerCapture(e.pointerId)}catch{}i.setAttribute("data-dragging","");let p=a,u=f=>{p=a+(f.clientX-l)*(d?-1:1),s(this,_,Qh).call(this,t,p,!1)},b=()=>{i.removeEventListener("pointermove",u),i.removeEventListener("pointerup",b),i.removeEventListener("pointercancel",b),i.removeAttribute("data-dragging"),s(this,_,Qh).call(this,t,p,!0)};i.addEventListener("pointermove",u),i.addEventListener("pointerup",b),i.addEventListener("pointercancel",b)},Bi=new WeakMap,em=function(e=!this._picker){this._picker=e,e?document.addEventListener("pointerdown",r(this,en),{capture:!0}):document.removeEventListener("pointerdown",r(this,en),{capture:!0})},en=new WeakMap,qb=function(e){e.key!=="Escape"||!this._picker||(e.stopPropagation(),s(this,_,em).call(this,!1),this.renderRoot.querySelector(".pick")?.focus())},Ob=function(e,t){let i=this.columns.map(a=>a.key===e?{...a,visible:t}:a);this.columns=i,this.dispatchEvent(new CustomEvent("cm-columns-change",{detail:{key:e,visible:t,columns:i},bubbles:!0,composed:!0}))},Bb=function(){let e=this.columns??[],t=s(this,_,$u).call(this,this.visibleColumns);return c`<div class="tools" part="tools" @keydown=${s(this,_,qb)}>
|
|
2192
|
+
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,Js)}-cols"
|
|
2193
|
+
@click=${()=>s(this,_,em).call(this)}>${this.t("columns")}<cm-icon name="chevron-down" size="16" aria-hidden="true"></cm-icon></button>
|
|
2194
|
+
<fieldset class="panel" id="${r(this,Js)}-cols" part="column-panel" ?hidden=${!this._picker}>
|
|
2185
2195
|
<legend class="sr">${this.t("showColumns")}</legend>
|
|
2186
2196
|
${e.map(i=>c`<label class="opt"><input type="checkbox" .checked=${i.visible!==!1} ?disabled=${i===t}
|
|
2187
|
-
@change=${a=>s(this,_,
|
|
2197
|
+
@change=${a=>s(this,_,Ob).call(this,i.key,a.target.checked)} />${i.label}</label>`)}
|
|
2188
2198
|
</fieldset>
|
|
2189
|
-
</div>`},
|
|
2199
|
+
</div>`},Fb=function(e,t){let i=this.sort===e.key,a=i?this.direction:"none",d=e.hidden||e.type==="actions"?c`<span class="sr">${e.label}</span>`:c`<span class="t">${e.label}</span>`;return c`<th scope="col" class=${s(this,_,Ws).call(this,e,t)} style=${s(this,_,Gs).call(this,e)} aria-sort=${e.sortable?a:h}><div class="h">${e.sortable?c`<button type="button" class="sort ${i?"on":""}" @click=${()=>s(this,_,Db).call(this,e)}>${d}<cm-icon
|
|
2190
2200
|
name=${i&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}${this.resizable&&e.type!=="actions"?c`<span class="rz" part="resize-handle" role="separator" aria-orientation="vertical" tabindex="0" aria-label=${this.t("resize",{column:e.label})}
|
|
2191
|
-
aria-valuemin=${
|
|
2192
|
-
@keydown=${
|
|
2193
|
-
@click=${()=>s(this,_,
|
|
2194
|
-
<dl class="pairs">${a.map(
|
|
2195
|
-
<p class="card-title">${
|
|
2196
|
-
${a.length?c`<dl class="pairs">${a.map(
|
|
2197
|
-
${!u&&l.length?c`<div class="card-actions">${l.map(
|
|
2201
|
+
aria-valuemin=${$b} aria-valuemax="1600"
|
|
2202
|
+
@keydown=${p=>s(this,_,Ib).call(this,p,e)} @pointerdown=${p=>s(this,_,Pb).call(this,p,e)}></span>`:h}</div></th>`},jb=function(e,t,i,a,l){let d=s(this,_,ku).call(this,e,i),p=this._expanded.has(e),u=`${r(this,Js)}-more-${l}`,b=c`<tr part="row">${t.map(f=>f===i?c`<th scope="row" class=${s(this,_,Ws).call(this,f,i)} style=${s(this,_,Gs).call(this,f)} part="cell">${s(this,_,Mu).call(this,f,e,d)}${a.length?c`<button type="button" class="more-btn" aria-expanded=${p?"true":"false"} aria-controls=${u}
|
|
2203
|
+
@click=${()=>s(this,_,Vb).call(this,e)}>${this.t(p?"viewLess":"viewAll")}</button>`:h}</th>`:c`<td class=${s(this,_,Ws).call(this,f,i)} style=${s(this,_,Gs).call(this,f)} part="cell">${s(this,_,Mu).call(this,f,e,d)}</td>`)}</tr>`;return c`${b}${a.length&&p?c`<tr class="more" id=${u} part="row-details"><td colspan=${t.length-a.length}>
|
|
2204
|
+
<dl class="pairs">${a.map(f=>c`<dt>${f.label}</dt><dd class=${Cl(f)?"num":""}>${s(this,_,Ks).call(this,e[f.key])}</dd>`)}</dl></td></tr>`:h}`},Vb=function(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t},Ub=function(e,t,i){let a=t.filter(p=>p!==i&&p.type!=="actions"),l=t.filter(p=>p.type==="actions"),d=(p,u=!1)=>{let b=s(this,_,ku).call(this,p,i);return c`<li class="card ${u?"total":""}" part="card">
|
|
2205
|
+
<p class="card-title">${b}</p>
|
|
2206
|
+
${a.length?c`<dl class="pairs">${a.map(f=>c`<dt>${f.label}</dt><dd class=${Cl(f)?"num":""}>${s(this,_,Ks).call(this,p[f.key])}</dd>`)}</dl>`:h}
|
|
2207
|
+
${!u&&l.length?c`<div class="card-actions">${l.map(f=>s(this,_,Eu).call(this,f,p,b))}</div>`:h}
|
|
2198
2208
|
</li>`};return c`${this.caption?c`<p class="cards-caption" aria-hidden="true">${this.caption}</p>`:h}
|
|
2199
|
-
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(
|
|
2209
|
+
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(p=>d(p))}${this.totals?d(this.totals,!0):h}</ul>`},Ys.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"},density:{reflect:!0},mobile:{reflect:!0},rowActions:{attribute:"row-actions",reflect:!0},resizable:{type:Boolean,reflect:!0},columnPicker:{type:Boolean,attribute:"column-picker",reflect:!0},_light:{state:!0},_announce:{state:!0},_widths:{state:!0},_expanded:{state:!0},_picker:{state:!0},_overflows:{state:!0}},Ys.styles=[E,it,w`
|
|
2200
2210
|
:host { display: block; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
2201
2211
|
:host([density='compact']) { --cm-table-row-height: 40px; }
|
|
2202
2212
|
:host([density='comfortable']) { --cm-table-row-height: 48px; }
|
|
@@ -2356,7 +2366,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2356
2366
|
:host([mobile='priority']) tr.more { display: table-row; }
|
|
2357
2367
|
}
|
|
2358
2368
|
@media (forced-colors: active) { button.sort cm-icon { opacity: 1; } .acts { opacity: 1 !important; } }
|
|
2359
|
-
`];$("cm-data-table",
|
|
2369
|
+
`];$("cm-data-table",Ys);var EE=z("resourceItem",{select:"Select {name}"}),ME=z("resourceList",{resourceName:"item",resourceNamePlural:"items",select:"Select",selectPageHidden:"all {count} {resource} on this page",selectionOptions:"Selection options",selectPage:"Select all {count} on this page",selectAll:"Select all {count} {resource}",selectNone:"Select none",selected:"{count} {resource} selected.",allSelected:"All {count} {resource} selected.",clearSelection:"Clear selection",loading:"Loading {resource}"}),Kb=w`
|
|
2360
2370
|
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
2361
2371
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
2362
2372
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -2368,17 +2378,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2368
2378
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
2369
2379
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2370
2380
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
2371
|
-
`,
|
|
2381
|
+
`,rm,sn,Wb,Gb,rn=class extends T{constructor(){super();m(this,sn);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;this.columns=!1;this.actions="auto";this._hasActions=!1;m(this,rm,this.attachInternals());r(this,rm).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`
|
|
2372
2382
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
2373
|
-
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,
|
|
2383
|
+
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,sn,Gb)}>
|
|
2374
2384
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
2375
2385
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
2376
2386
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
2377
2387
|
<span class="media"><slot name="media"></slot></span>
|
|
2378
2388
|
<div class="content" part="content"><slot></slot></div>
|
|
2379
|
-
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,
|
|
2389
|
+
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,sn,Wb)}></slot></div>
|
|
2380
2390
|
</div>
|
|
2381
|
-
`}};
|
|
2391
|
+
`}};rm=new WeakMap,sn=new WeakSet,Wb=function(e){this._hasActions=e.target.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim())},Gb=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i!==this&&i.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},rn.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0},columns:{type:Boolean,reflect:!0},mobile:{reflect:!0},actions:{reflect:!0},_hasActions:{state:!0}},rn.styles=[E,Kb,w`
|
|
2382
2392
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2383
2393
|
:host(:last-child) { border-bottom: 0; }
|
|
2384
2394
|
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
|
|
@@ -2428,32 +2438,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2428
2438
|
:host([columns][mobile='stack']) ::slotted(*) { overflow-wrap: break-word; }
|
|
2429
2439
|
:host([columns][mobile='stack']) ::slotted(:first-child) { flex: 1 1 100%; }
|
|
2430
2440
|
}
|
|
2431
|
-
`];$("cm-resource-item",
|
|
2432
|
-
${this.selectable&&
|
|
2433
|
-
<div class="head ${this.selectable||this._hasHeader?"on":""} ${
|
|
2434
|
-
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,
|
|
2435
|
-
${this.selectable?c`<div class="toolbar ${
|
|
2441
|
+
`];$("cm-resource-item",rn);var Sl,Dl,we,Yb,Tu,am,sm,tn,im,nm,an=class extends T{constructor(){super();m(this,we);this.selectable=!1;this.total=0;this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this.mobile="columns";this._count=0;this._rows=0;this._hasHeader=!1;this._hasTable=!1;this._hasActions=!1;m(this,Sl,R("cm-rl"));m(this,Dl,new Set);m(this,am,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,s(this,we,Tu).call(this,t)});m(this,sm,e=>{this._hasActions=e.target.assignedElements().length>0});m(this,nm,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,we,tn).call(this),s(this,we,im).call(this))})}connectedCallback(){super.connectedCallback(),Xh(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,we,tn).call(this),s(this,we,im).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,s(this,we,tn).call(this),s(this,we,im).call(this)}clearSelection(){this.selectPage(!1)}updated(e){(e.has("selectable")||e.has("mobile"))&&(s(this,we,tn).call(this),s(this,we,Tu).call(this))}render(){let e=this._count,t=this._rows,i=this.items.filter(k=>!k.disabled).length,a=i>0&&e>=i,l=s(this,we,Yb).call(this),d=k=>Jc(k,this.locale)==="one"?this.resourceName:l,p=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&&p?c` <button type="button" @click=${()=>this.selectAll()}>${this.t("selectAll",{count:this.total,resource:l})}</button>`:h}`);let b=e>0||this.allSelected,f=this._hasTable,x=!this.hideSelectMenu&&(!f||b),y=c`<slot name="actions" @slotchange=${r(this,sm)}></slot>`;return c`
|
|
2442
|
+
${this.selectable&&f?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${y}</div>`:h}
|
|
2443
|
+
<div class="head ${this.selectable||this._hasHeader?"on":""} ${f?"over":""}">
|
|
2444
|
+
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,am)}></slot></div>
|
|
2445
|
+
${this.selectable?c`<div class="toolbar ${f?"over":""} ${b?"busy":""}" part="toolbar">
|
|
2436
2446
|
<span class="select" part="select">
|
|
2437
|
-
<span class="check"><input id="${r(this,
|
|
2447
|
+
<span class="check"><input id="${r(this,Sl)}-all" type="checkbox" .checked=${a} .indeterminate=${e>0&&!a}
|
|
2438
2448
|
?disabled=${!i} @change=${k=>this.selectPage(k.target.checked)} />
|
|
2439
2449
|
<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>
|
|
2440
|
-
${this.hideSelectMenu?h:c`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")} ?hidden=${!
|
|
2441
|
-
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...
|
|
2442
|
-
<label for="${r(this,
|
|
2450
|
+
${this.hideSelectMenu?h:c`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")} ?hidden=${!x}
|
|
2451
|
+
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...p?[{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,nm)}></cm-action-menu>`}
|
|
2452
|
+
<label for="${r(this,Sl)}-all" class=${f||b?"sr":"label"}>${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:d(t)})}</span></label>
|
|
2443
2453
|
</span>
|
|
2444
2454
|
<span class="status" part="status" role="status">${u}</span>
|
|
2445
2455
|
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
2446
|
-
${
|
|
2456
|
+
${f?h:c`<span class="actions ${this._hasActions?"has":""}">${y}</span>`}
|
|
2447
2457
|
</div>`:h}
|
|
2448
2458
|
</div>
|
|
2449
2459
|
<div class="body">
|
|
2450
2460
|
<div class="list" part="list" role="list" aria-label=${this.label||l.replace(/^./,k=>k.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
2451
|
-
<slot @slotchange=${()=>s(this,
|
|
2461
|
+
<slot @slotchange=${()=>s(this,we,tn).call(this)}></slot>
|
|
2452
2462
|
</div>
|
|
2453
2463
|
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
2454
2464
|
</div>
|
|
2455
2465
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
2456
|
-
`}};
|
|
2466
|
+
`}};Sl=new WeakMap,Dl=new WeakMap,we=new WeakSet,Yb=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},Tu=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,Dl))t.has(i)||(i.removeAttribute("resource-rows"),i.removeAttribute("mobile"));for(let i of t)i.setAttribute("resource-rows",this.selectable?"selectable":"plain"),this.mobile==="stack"?i.setAttribute("mobile","stack"):i.removeAttribute("mobile");g(this,Dl,t),this._hasTable=t.size>0},am=new WeakMap,sm=new WeakMap,tn=function(){let e=this.items;e.forEach(t=>{t.selectable=this.selectable,t.mobile=this.mobile==="stack"?"stack":void 0}),this._rows=e.length,this._count=e.filter(t=>t.selected).length},im=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},nm=new WeakMap,an.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name",string:"resourceName"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},density:{reflect:!0},mobile:{reflect:!0},_count:{state:!0},_rows:{state:!0},_hasHeader:{state:!0},_hasTable:{state:!0},_hasActions:{state:!0}},an.styles=[E,Kb,w`
|
|
2457
2467
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
|
|
2458
2468
|
/* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
|
|
2459
2469
|
:host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
@@ -2509,12 +2519,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2509
2519
|
.toolbar .check { width: 20px; height: 20px; }
|
|
2510
2520
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
2511
2521
|
}
|
|
2512
|
-
`];$("cm-resource-list",
|
|
2513
|
-
<div class="row" part="row" @dragover=${s(this,
|
|
2522
|
+
`];$("cm-resource-list",an);var SE=z("nestedItem",{reorder:"Reorder {label}",hint:"Press up or down arrow to move.",hintGroup:"Press up or down arrow to move. At either end of the list, the arrow moves it into the list before or after.",moved:"{label} moved to position {position} of {total}.",movedTo:"{label} moved to {list}, position {position} of {total}."}),DE=z("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),lm,se,zu,_u,Xb,Jb,Fi,Zb,Qb,ev,Cu,tv,vt=class vt extends T{constructor(){super();m(this,se);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;m(this,lm,this.attachInternals());m(this,Fi,!1);r(this,lm).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`
|
|
2523
|
+
<div class="row" part="row" @dragover=${s(this,se,ev)} @dragleave=${s(this,se,Cu)} @drop=${s(this,se,tv)}>
|
|
2514
2524
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
2515
2525
|
aria-describedby="hint"
|
|
2516
|
-
@keydown=${s(this,
|
|
2517
|
-
@dragend=${()=>{this.classList.remove("dragging"),
|
|
2526
|
+
@keydown=${s(this,se,Xb)} @dragstart=${s(this,se,Jb)} @pointerdown=${s(this,se,Zb)}
|
|
2527
|
+
@dragend=${()=>{this.classList.remove("dragging"),vt.dragged=null,Al(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
2518
2528
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
2519
2529
|
<span class="label" part="label">${this.label}</span>
|
|
2520
2530
|
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
@@ -2522,7 +2532,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2522
2532
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
2523
2533
|
<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>
|
|
2524
2534
|
</div>
|
|
2525
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};
|
|
2535
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};lm=new WeakMap,se=new WeakSet,zu=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)):[]},_u=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},Xb=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,se,zu),p=d[d.indexOf(this.list)+(i?-1:1)];if(p){e.preventDefault(),this.moveToList(p,i?p.items.length:0)&&s(this,se,_u).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,se,_u).call(this)},Jb=function(e){if(e.stopPropagation(),r(this,Fi)){e.preventDefault();return}vt.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},Fi=new WeakMap,Zb=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,Fi)){if(Math.abs(d.clientY-t)<6)return;g(this,Fi,!0),vt.dragged=this,this.classList.add("dragging")}d.preventDefault(),i=s(this,se,Qb).call(this,d.clientX,d.clientY),Al(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 p=r(this,Fi);g(this,Fi,!1),vt.dragged=null,this.classList.remove("dragging"),Al(this,null),!(!p||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)},Qb=function(e,t){for(let i of r(this,se,zu)){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:om(i.items,this,t)}}return{index:om(this.siblings,this,t)}},ev=function(e){let t=vt.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)},Cu=function(){this.classList.remove("drop-before","drop-after")},tv=function(e){let t=vt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.classList.contains("drop-after");s(this,se,Cu).call(this);let a=this.siblings,l=a.indexOf(t),d=a.indexOf(this)+(i?1:0);d>l&&(d-=1),t.moveTo(d)},vt.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},vt.styles=[E,w`
|
|
2526
2536
|
:host { display: block; }
|
|
2527
2537
|
.row {
|
|
2528
2538
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2549,20 +2559,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2549
2559
|
.actions { gap: var(--cm-space-8); }
|
|
2550
2560
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2551
2561
|
}
|
|
2552
|
-
`],
|
|
2562
|
+
`],vt.dragged=null;var on=vt;$("cm-nested-item",on);function om(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 Al(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 Wr,Oe,iv,Lu,Su,rv,av,nn=class extends T{constructor(){super(...arguments);m(this,Oe);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;m(this,Wr,R("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,Oe,Lu).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2553
2563
|
<div class="bar" part="bar">
|
|
2554
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,
|
|
2564
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,Wr)}-h">${this.heading}</div>
|
|
2555
2565
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2556
|
-
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
2557
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,
|
|
2566
|
+
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,Wr)}-rows"
|
|
2567
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,Oe,iv)}>
|
|
2558
2568
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2559
2569
|
</div>
|
|
2560
|
-
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,
|
|
2561
|
-
@dragover=${s(this,
|
|
2562
|
-
<slot @slotchange=${()=>{s(this,
|
|
2570
|
+
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,Wr)}-rows" role="list" aria-labelledby="${r(this,Wr)}-h" ?hidden=${!t}
|
|
2571
|
+
@dragover=${s(this,Oe,rv)} @drop=${s(this,Oe,av)}>
|
|
2572
|
+
<slot @slotchange=${()=>{s(this,Oe,Lu).call(this),this._empty=!this.items.length}}></slot>
|
|
2563
2573
|
</div>
|
|
2564
2574
|
<span class="sr" role="status">${this._msg}</span>
|
|
2565
|
-
`}};
|
|
2575
|
+
`}};Wr=new WeakMap,Oe=new WeakSet,iv=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},Lu=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},Su=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},rv=function(e){let t=on.dragged;s(this,Oe,Su).call(this,t)&&(e.preventDefault(),Al(t,{list:this,index:om(this.items,t,e.clientY)}))},av=function(e){let t=on.dragged;if(!s(this,Oe,Su).call(this,t))return;e.preventDefault();let i=om(this.items,t,e.clientY);Al(t,null),t.moveToList(this,i)},nn.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}},nn.styles=[E,w`
|
|
2566
2576
|
:host { display: block; }
|
|
2567
2577
|
.bar {
|
|
2568
2578
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2586,9 +2596,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2586
2596
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2587
2597
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2588
2598
|
}
|
|
2589
|
-
`];$("cm-nested-list",
|
|
2599
|
+
`];$("cm-nested-list",nn);var sv=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},nv=_a(class extends gi{constructor(o){if(super(o),o.type!==gt.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=af(o),{values:a,keys:l}=this.dt(n,e,t);if(!Array.isArray(i))return this.ut=l,a;let d=this.ut??=[],p=[],u,b,f=0,x=i.length-1,y=0,k=a.length-1;for(;f<=x&&y<=k;)if(i[f]===null)f++;else if(i[x]===null)x--;else if(d[f]===l[y])p[y]=fi(i[f],a[y]),f++,y++;else if(d[x]===l[k])p[k]=fi(i[x],a[k]),x--,k--;else if(d[f]===l[k])p[k]=fi(i[f],a[k]),Ca(o,p[k+1],i[f]),f++,k--;else if(d[x]===l[y])p[y]=fi(i[x],a[y]),Ca(o,i[f],i[x]),x--,y++;else if(u===void 0&&(u=sv(l,y,k),b=sv(d,f,x)),u.has(d[f]))if(u.has(d[x])){let S=b.get(l[y]),A=S!==void 0?i[S]:null;if(A===null){let q=Ca(o,i[f]);fi(q,a[y]),p[y]=q}else p[y]=fi(A,a[y]),Ca(o,i[f],A),i[S]=null;y++}else ud(i[x]),x--;else ud(i[f]),f++;for(;y<=k;){let S=Ca(o,p[k+1]);fi(S,a[y]),p[y++]=S}for(;f<=x;){let S=i[f++];S!==null&&ud(S)}return this.ut=l,pd(o,p),ke}});function ov(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 de,Je,Ze,Yr=class{constructor(n){m(this,de);m(this,Je,null);m(this,Ze,null);g(this,de,n)}get active(){return r(this,Je)!==null}get from(){return r(this,Je)&&{...r(this,Je)}}get target(){return r(this,Ze)&&{...r(this,Ze)}}groupCount(){return r(this,de).groupCount()}slotCount(n){return n>=0&&n<r(this,de).groupCount()?r(this,de).slotCount(n):0}pickUp(n){this.active&&this.cancel(),g(this,Je,{...n}),g(this,Ze,{...n}),r(this,de).onTarget?.(this.target),r(this,de).announce(r(this,de).messages.pickedUp(this.target))}moveTo(n){if(!r(this,Ze))return;let e=Math.max(0,Math.min(n.group,r(this,de).groupCount()-1)),t=this.slotCount(e);t<=0||(g(this,Ze,{group:e,index:Math.max(0,Math.min(n.index,t-1))}),r(this,de).onTarget?.(this.target),r(this,de).announce(r(this,de).messages.over(this.target)))}drop(){if(!r(this,Je)||!r(this,Ze))return;let n=r(this,Je),e=r(this,Ze);g(this,Je,g(this,Ze,null)),r(this,de).onTarget?.(null),r(this,de).onDrop(n,e)}cancel(n=!1){if(!r(this,Je))return;let e=r(this,Je),t=n?"":r(this,de).messages.cancelled(e);g(this,Je,g(this,Ze,null)),r(this,de).onTarget?.(null),r(this,de).onCancel?.(e),t&&r(this,de).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,de).navigate??ov)(e,r(this,Ze),this);return t?(this.moveTo(t),!0):!1}};de=new WeakMap,Je=new WeakMap,Ze=new WeakMap;var Rl,Gr,Xr=class{constructor(n=document,e="assertive"){m(this,Rl);m(this,Gr);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,Gr)??this.element.textContent??""}announce(n){clearTimeout(r(this,Rl)),this.element.textContent===n?(this.element.textContent="",g(this,Gr,n),g(this,Rl,setTimeout(()=>{this.element.textContent=n,g(this,Gr,void 0)},50))):(g(this,Gr,void 0),this.element.textContent=n)}};Rl=new WeakMap,Gr=new WeakMap;var YE=z("boardCard",{roleDescription:"movable card",instructions:"Press Space to pick up. Then use the arrow keys to choose a column and a position, Space or Enter to drop, and Escape to cancel.",openHint:"Press Enter to open.",saving:"Saving"}),XE=z("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),JE=z("board",{label:"Board",pickedUp:"Picked up {card}. Column {column}, position {position} of {count}.",over:"Column {column}, position {position} of {count}.",moved:"Moved {card} to {column}, position {position} of {count}.",sameSpot:"{card} dropped where it started.",cancelled:"Move cancelled. {card} is back in {column}.",refused:"{card} can't be moved to {column}.",reverted:"Couldn't move {card}. It is back in {column}."}),$x="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",Hl,mm,lv,Jr=class extends T{constructor(){super(...arguments);m(this,mm);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";m(this,Hl,R("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">
|
|
2590
2600
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2591
|
-
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,
|
|
2601
|
+
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,Hl)}-help"></div>`}
|
|
2592
2602
|
<div class="content">
|
|
2593
2603
|
<div class="head">
|
|
2594
2604
|
<div class="title" part="title"><slot name="heading" @slotchange=${()=>this.requestUpdate()}>${this.href?c`<a href=${this.href} tabindex="-1">${this.heading}</a>`:this.heading}</slot></div>
|
|
@@ -2596,11 +2606,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2596
2606
|
<slot name="actions"></slot>
|
|
2597
2607
|
</div>
|
|
2598
2608
|
<div class="lines"><slot></slot></div>
|
|
2599
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,
|
|
2609
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,mm,lv).call(this,i,"_badges")}></slot></div>
|
|
2600
2610
|
</div>
|
|
2601
2611
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2602
|
-
<span id="${r(this,
|
|
2603
|
-
</div>`}};
|
|
2612
|
+
<span id="${r(this,Hl)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2613
|
+
</div>`}};Hl=new WeakMap,mm=new WeakSet,lv=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},Jr.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},Jr.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}},Jr.styles=[E,w`
|
|
2604
2614
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2605
2615
|
.card {
|
|
2606
2616
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2625,22 +2635,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2625
2635
|
:host([moving]) .content { opacity: 0.5; }
|
|
2626
2636
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2627
2637
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2628
|
-
`];$("cm-board-card",
|
|
2638
|
+
`];$("cm-board-card",Jr);var dn,Nl,hn,mn,Vi,cm,cv,Zr=class extends T{constructor(){super(...arguments);m(this,Vi);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;m(this,dn,!1);this._cards=[];this._drop=null;m(this,Nl,new MutationObserver(()=>s(this,Vi,cm).call(this)));m(this,hn,R("cm-col"));m(this,mn,!1)}get collapsed(){return r(this,dn)}connectedCallback(){super.connectedCallback(),s(this,Vi,cm).call(this),r(this,Nl).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Nl).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,Vi,cm).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");g(this,dn,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",r(this,dn)),g(this,mn,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,mn)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,mn,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,i=this.count,a=t?e.filter(y=>y!==t.card):e,l=t?e.indexOf(t.card):-1,d=!!t&&!this.collapsed&&!(l>=0&&t.index===l),p=[];e.forEach((y,k)=>{d&&y!==t.card&&a.indexOf(y)===t.index&&p.push({key:"drop"}),p.push({key:y,card:y,i:k})}),d&&t.index>=a.length&&p.push({key:"drop"});let u=this.hasMore||i>e.length,b=this.loading,f=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),x=this.t("count",{count:i});return c`<section aria-labelledby="${r(this,hn)}-h" class=${t&&this.collapsed?"over":""}>
|
|
2629
2639
|
<header part="header">
|
|
2630
|
-
<div class="title" id="${r(this,
|
|
2640
|
+
<div class="title" id="${r(this,hn)}-h" role="heading" aria-level=${f}>${this.heading}<span class="sr">, ${x}</span></div>
|
|
2631
2641
|
<span class="count" part="count" aria-hidden="true">${this.formatNumber(i)}</span>
|
|
2632
2642
|
<span class="actions"><slot class="actions"></slot></span>
|
|
2633
2643
|
</header>
|
|
2634
2644
|
<div class="scroll">
|
|
2635
|
-
<ul part="list" role="list" aria-labelledby="${r(this,
|
|
2636
|
-
${
|
|
2645
|
+
<ul part="list" role="list" aria-labelledby="${r(this,hn)}-h" aria-busy=${b?"true":"false"} tabindex="-1" ?hidden=${this.collapsed}>
|
|
2646
|
+
${nv(p,y=>y.key,y=>y.card?c`<li><slot data-i=${y.i}></slot></li>`:c`<li class="drop" aria-hidden="true"><div style="min-height:${Math.max(40,t.height)}px">${t.card.name}</div></li>`)}
|
|
2637
2647
|
</ul>
|
|
2638
|
-
${
|
|
2639
|
-
<div class="empty" ?hidden=${e.length>0||
|
|
2640
|
-
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${
|
|
2648
|
+
${b&&!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}
|
|
2649
|
+
<div class="empty" ?hidden=${e.length>0||b||u||this.collapsed||d}><slot class="empty">${this.t("empty")}</slot></div>
|
|
2650
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${b} @click=${s(this,Vi,cv)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
2641
2651
|
</div>
|
|
2642
|
-
<span class="sr" role="status">${
|
|
2643
|
-
</section>`}};
|
|
2652
|
+
<span class="sr" role="status">${b?this.t("loading",{column:this.heading}):""}</span>
|
|
2653
|
+
</section>`}};dn=new WeakMap,Nl=new WeakMap,hn=new WeakMap,mn=new WeakMap,Vi=new WeakSet,cm=function(){this._cards=this.cards},cv=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},Zr.shadowRootOptions={...L.shadowRootOptions,slotAssignment:"manual"},Zr.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}},Zr.styles=[E,w`
|
|
2644
2654
|
:host {
|
|
2645
2655
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
2646
2656
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -2677,9 +2687,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2677
2687
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
2678
2688
|
:host([collapsed]) .actions { display: none; }
|
|
2679
2689
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
2680
|
-
`];$("cm-board-column",
|
|
2690
|
+
`];$("cm-board-column",Zr);var De,Me,pe,Qr,re,H,Du,ln,dv,Au,hv,mv,pv,uv,Il,gv,Pl,Ru,Hu,Nu,dm,fv,ql,Ol,Bl,Fl,jl,Vl,Ul,Iu,Pu,hm,bv,ji,cn=class extends T{constructor(){super();m(this,H);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;m(this,De,new Xr);m(this,Me);m(this,pe,null);m(this,Qr,new WeakMap);m(this,re,null);m(this,Il,e=>{if(r(this,re)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,Me).active){r(this,Me).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let i=s(this,H,uv).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,H,gv).call(this,i,t);a&&(e.preventDefault(),a.focusHandle())}}});m(this,Pl,e=>{if(!r(this,Me).active||!r(this,pe))return;let t=e.relatedTarget;t&&(t===r(this,pe).card||r(this,pe).card.contains(t))||!t&&document.hasFocus()===!1||queueMicrotask(()=>{r(this,Me).active&&r(this,pe)&&!r(this,pe).card.matches(":focus-within")&&r(this,Me).cancel()})});m(this,ql,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});m(this,Ol,e=>{if(r(this,re)||!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?.($x)))return;let a=s(this,H,ln).call(this,i);if(!a)return;r(this,Me).active&&r(this,Me).cancel();let l=i.getBoundingClientRect();g(this,re,{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,re).timer=setTimeout(()=>{r(this,re)&&!r(this,re).started&&s(this,H,Iu).call(this)},300)),window.addEventListener("pointermove",r(this,jl),!0),window.addEventListener("pointerup",r(this,Vl),!0),window.addEventListener("pointercancel",r(this,Ul),!0),window.addEventListener("touchmove",r(this,Bl),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,Fl),!0)});m(this,Bl,e=>{r(this,re)?.started&&e.cancelable&&e.preventDefault()});m(this,Fl,e=>{r(this,re)&&e.preventDefault()});m(this,jl,e=>{let t=r(this,re);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,H,Iu).call(this):s(this,H,ji).call(this,!1));return}e.preventDefault(),s(this,H,Pu).call(this),s(this,H,hm).call(this)}});m(this,Vl,e=>{let t=r(this,re);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,H,ji).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,H,ji).call(this,!0)});m(this,Ul,e=>{r(this,re)&&e.pointerId===r(this,re).pointerId&&s(this,H,ji).call(this,!1)});g(this,Me,new Yr({groupCount:()=>this.columns.length,slotCount:e=>{let t=this.columns[e];return!t||!r(this,pe)?0:t.cards.filter(i=>i!==r(this,pe).card).length+1},onTarget:e=>s(this,H,hv).call(this,e),onDrop:(e,t)=>s(this,H,pv).call(this,e,t),onCancel:()=>s(this,H,Au).call(this),messages:{pickedUp:e=>s(this,H,Du).call(this,"pickedUp",e),over:e=>s(this,H,Du).call(this,"over",e),cancelled:e=>this.t("cancelled",{card:r(this,pe)?.card.name??"",column:this.columns[e.group]?.heading??""})},announce:e=>r(this,De).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,pe)?.card??null}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,Il)),this.addEventListener("focusout",r(this,Pl)),this.addEventListener("pointerdown",r(this,Ol)),this.addEventListener("dragstart",r(this,ql))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,Il)),this.removeEventListener("focusout",r(this,Pl)),this.removeEventListener("pointerdown",r(this,Ol)),this.removeEventListener("dragstart",r(this,ql)),r(this,Me).cancel(!0),s(this,H,ji).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(r(this,De).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return r(this,De).text}announce(e){r(this,De).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,H,ln).call(this,t);return i?(s(this,H,ji).call(this,!1),r(this,Me).cancel(!0),g(this,pe,{card:t,column:i.column,index:i.index}),t.moving=!0,s(this,H,dv).call(this,t),r(this,Me).pickUp({group:i.group,index:i.index}),!0):!1}cancelMove(){let e=r(this,re);e?.started&&(s(this,H,ji).call(this,!1),r(this,De).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),r(this,Me).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,H,ln).call(this,a);if(!d)return!1;let p=l.cards.filter(b=>b!==a).length,u=Math.max(0,Math.min(i??p,p));return s(this,H,dm).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,Qr).get(t);if(this.controlled||!i||(r(this,Qr).delete(t),!i.from.isConnected||!this.contains(i.from)))return!1;let a=t.matches(":focus-within");return s(this,H,Hu).call(this,t,i.from,i.fromIndex),i.totals&&s(this,H,Nu).call(this,i.to,i.from),s(this,H,Ru).call(this,i.to,i.from,a?t:null),r(this,De).announce(this.t("reverted",{card:t.name,column:i.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
2681
2691
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
2682
|
-
</div>`}};
|
|
2692
|
+
</div>`}};De=new WeakMap,Me=new WeakMap,pe=new WeakMap,Qr=new WeakMap,re=new WeakMap,H=new WeakSet,Du=function(e,t){let i=this.columns[t.group];return this.t(e,{card:r(this,pe)?.card.name??"",column:i?.heading??"",position:t.index+1,count:r(this,Me).slotCount(t.group)})},ln=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)}},dv=function(e){let t=()=>!!e.shadowRoot?.activeElement?.classList.contains("handle");e.focusHandle({preventScroll:!0}),requestAnimationFrame(()=>{r(this,pe)?.card===e&&!t()&&e.focusHandle({preventScroll:!0})})},Au=function(){r(this,pe)&&(r(this,pe).card.moving=!1),g(this,pe,null)},hv=function(e){let t=r(this,pe);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,H,mv).call(this,i,a)})}},mv=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)}},pv=function(e,t){let i=r(this,pe);if(s(this,H,Au).call(this),!i)return;let a=this.columns[t.group];s(this,H,dm).call(this,i.card,i.column,e.index,a,t.index,"keyboard")},uv=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,H,ln).call(this,i)?i:null},Il=new WeakMap,gv=function(e,t){let i=s(this,H,ln).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 p=i.group+l;p>=0&&p<d.length;p+=l){let u=d[p].cards;if(u.length)return u[Math.min(i.index,u.length-1)]}return null},Pl=new WeakMap,Ru=function(e,t,i){e._sync(),t._sync().then(()=>{i?.isConnected&&i.focusHandle({preventScroll:!0})})},Hu=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)},Nu=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))},dm=function(e,t,i,a,l,d){let p=e.name;if(t===a&&i===l)return d!=="api"&&r(this,De).announce(this.t("sameSpot",{card:p})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let u=[],b={value:e.key,card:e,from:t.key,to:a.key,fromColumn:t,toColumn:a,fromIndex:i,toIndex:l,source:d,waitUntil:y=>{u.push(Promise.resolve(y))}};if(!this.dispatchEvent(new CustomEvent("cm-move",{detail:b,bubbles:!0,composed:!0,cancelable:!0})))return r(this,De).announce(this.t("refused",{card:p,column:a.heading})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let x=a.cards.filter(y=>y!==e).length+1;if(this.controlled)d==="keyboard"&&s(this,H,fv).call(this,e.key,a);else{let y=d==="keyboard"||e.matches(":focus-within");s(this,H,Hu).call(this,e,a,l);let k=t!==a;k&&s(this,H,Nu).call(this,t,a),r(this,Qr).set(e,{card:e,from:t,fromIndex:i,to:a,toIndex:l,totals:k}),s(this,H,Ru).call(this,t,a,y?e:null)}return r(this,De).announce(this.t("moved",{card:p,column:a.heading,position:l+1,count:x})),u.length&&(e.pending=!0,Promise.all(u).then(()=>{e.pending=!1,this.controlled||r(this,Qr).delete(e)},()=>{e.pending=!1,this.controlled?r(this,De).announce(this.t("reverted",{card:p,column:t.heading})):this.revert(e)})),!0},fv=function(e,t){let i=()=>t.isConnected?t.cards.find(d=>d.key===e):void 0,a=()=>{let d=i(),p=!document.activeElement||document.activeElement===document.body||!document.activeElement.isConnected;return!d||!(p||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)},ql=new WeakMap,Ol=new WeakMap,Bl=new WeakMap,Fl=new WeakMap,jl=new WeakMap,Vl=new WeakMap,Ul=new WeakMap,Iu=function(){let e=r(this,re);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,De).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),s(this,H,Pu).call(this),s(this,H,hm).call(this);let i=()=>{r(this,re)?.started&&(s(this,H,bv).call(this),r(this,re).raf=requestAnimationFrame(i))};e.raf=requestAnimationFrame(i)},Pu=function(){let e=r(this,re);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},hm=function(){let e=r(this,re);if(!e)return;let t=this.columns;if(!t.length)return;let i=t[0],a=1/0;for(let u of t){let b=u.getBoundingClientRect(),f=e.x<b.left?b.left-e.x:e.x>b.right?e.x-b.right:0;f<a&&(i=u,a=f)}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 b=l[u].getBoundingClientRect();if(e.y<b.top+b.height/2){d=u;break}}if(i===e.to&&d===e.toIndex)return;let p=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}),p&&r(this,De).announce(this.t("over",{column:i.heading,position:d+1,count:l.length+1}))},bv=function(){let e=r(this,re);if(!e)return;let t=48,i=16,a=x=>x<t?Math.ceil((t-Math.max(x,0))/t*i):0,l=!1,d=this.renderRoot.querySelector(".columns");if(d){let x=d.getBoundingClientRect(),y=a(e.x-x.left),k=a(x.right-e.x),S=d.scrollLeft;y?d.scrollLeft-=y:k&&(d.scrollLeft+=k),l||=d.scrollLeft!==S}let p=e.to?.scrollElement;if(p&&p.scrollHeight>p.clientHeight){let x=p.getBoundingClientRect();if(e.x>=x.left&&e.x<=x.right){let y=a(e.y-x.top),k=a(x.bottom-e.y),S=p.scrollTop;y?p.scrollTop-=y:k&&(p.scrollTop+=k),l||=p.scrollTop!==S}}let u=window.innerHeight,b=a(e.y),f=a(u-e.y);if(b||f){let x=window.scrollY;window.scrollBy(0,b?-b:f),l||=window.scrollY!==x}l&&s(this,H,hm).call(this)},ji=function(e){let t=r(this,re);t&&(g(this,re,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,jl),!0),window.removeEventListener("pointerup",r(this,Vl),!0),window.removeEventListener("pointercancel",r(this,Ul),!0),window.removeEventListener("touchmove",r(this,Bl),!0),window.removeEventListener("contextmenu",r(this,Fl),!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,H,dm).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},cn.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},cn.styles=[E,w`
|
|
2683
2693
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
2684
2694
|
.board { height: 100%; }
|
|
2685
2695
|
.columns {
|
|
@@ -2693,90 +2703,90 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2693
2703
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
2694
2704
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
2695
2705
|
}
|
|
2696
|
-
`];$("cm-board",js);var gE=z("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),Ys=class extends S{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};Ys.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}},Ys.styles=x`:host { display: none !important; }`;$("cm-calendar-event",Ys);var Yh=o=>String(o).padStart(2,"0"),Ff=o=>`${P(o)}T${Yh(o.getHours())}:${Yh(o.getMinutes())}`,jh=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),jf=["month","week","day"],Ky=600,Uf=new Map,Vf=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Uf.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Uf.set(e,t)),t},mu=o=>o.replace(/[ ]/g," ").trim(),Js,Le,De,we,Z,Q,Pr,Ct,Ge,Al,Fi,Zs,Qs,en,tn,Rl,f,Me,qi,Ml,Uh,_t,pu,Tl,bt,uu,Kf,ft,Ws,Wf,Gf,We,zl,_l,Vh,Yf,Xf,Jf,Ir,gu,Cl,Zf,Sl,Qf,ev,tv,iv,Hl,Nl,rv,av,Il,Ll,sv,bu,fu,vu,nv,ov,yu,xu,wu,Pl,$u,lv,Ol,ql,Bl,Fl,jl,Ul,ku,Kh,cv,Bi,Dl,dv,Eu,hv,Wh,Mu,Gs,Gh,mv,pv,uv,gv,bv,Xs=class extends T{constructor(){super();p(this,f);this.view="month";this.date="";this.today="";this.step=15;p(this,Js,"");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,Le,R("cm-cal"));p(this,De,new Ar);p(this,we);p(this,Z,null);p(this,Q,null);p(this,Pr,new WeakMap);p(this,Ct,"");p(this,Ge,null);p(this,Al,"");p(this,Fi,!0);p(this,Zs,0);p(this,Qs,!1);p(this,en);p(this,tn,0);p(this,Rl,new MutationObserver(()=>this.requestUpdate()));p(this,Hl,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){b(this,Ct,t.dataset.k);for(let i of s(this,f,Sl).call(this))i.tabIndex=i===t?0:-1}});p(this,Nl,e=>{let t=e.relatedTarget;if(this._more&&!r(this,Z)){let i=this.renderRoot.querySelector(".pop"),a=e.composedPath()[0];i&&i.contains(a)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,we).active||!r(this,Z)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,we).active||!r(this,Z))return;this.renderRoot.activeElement?.dataset.ev!==r(this,Z).ev.key&&r(this,we).cancel()}))});p(this,Il,e=>{if(r(this,Q)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,we).active){r(this,we).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let a=i.closest(".pop");if(a&&e.key==="Escape"){e.preventDefault(),s(this,f,Wh).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),b(this,Zs,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(a&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...a.querySelectorAll(".chip")],m=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];m&&(e.preventDefault(),m.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),s(this,f,av).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,f,rv).call(this,i,t);l?(e.preventDefault(),s(this,f,iv).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,Pl,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,Ol,e=>{if(r(this,Q)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(m=>m.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),a=i&&s(this,f,Ws).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,f,fu).call(this,a,t.dataset.day??a.days[0]);if(!l)return;r(this,we).active&&r(this,we).cancel();let d=0;if(l.mode==="time"){let m=s(this,f,$u).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}b(this,Q,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,Q).timer=setTimeout(()=>{r(this,Q)&&!r(this,Q).started&&s(this,f,ku).call(this)},300)),window.addEventListener("pointermove",r(this,Fl),!0),window.addEventListener("pointerup",r(this,jl),!0),window.addEventListener("pointercancel",r(this,Ul),!0),window.addEventListener("touchmove",r(this,ql),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,Bl),!0)});p(this,ql,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});p(this,Bl,e=>{r(this,Q)&&e.preventDefault()});p(this,Fl,e=>{let t=r(this,Q);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,f,ku).call(this):s(this,f,Bi).call(this,!1));return}e.preventDefault(),s(this,f,Kh).call(this)}});p(this,jl,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,f,Bi).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,f,Bi).call(this,!0)});p(this,Ul,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,f,Bi).call(this,!1)});b(this,we,new Dr({groupCount:()=>s(this,f,ft).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,f,Ll).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,f,sv).call(this,e,t),onTarget:e=>s(this,f,nv).call(this,e),onDrop:(e,t)=>s(this,f,ov).call(this,e,t),onCancel:()=>s(this,f,vu).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,f,Ir).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,f,Ir).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,f,Ir).call(this,r(this,Z),e)})},announce:e=>r(this,De).announce(e)}))}get locale(){return r(this,Js)}set locale(e){let t=r(this,Js);b(this,Js,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=s(this,f,ft).call(this);return{view:r(this,f,Me),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,Z)?.ev.el??null}get announcement(){return r(this,De).text}announce(e){r(this,De).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,Il)),this.addEventListener("focusin",r(this,Hl)),this.addEventListener("focusout",r(this,Nl)),this.addEventListener("pointerdown",r(this,Ol)),this.addEventListener("dragstart",r(this,Pl)),r(this,Rl).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(b(this,en,new ResizeObserver(()=>{cancelAnimationFrame(r(this,tn)),b(this,tn,requestAnimationFrame(()=>s(this,f,gu).call(this)))})),r(this,en).observe(this)),s(this,f,gu).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,Il)),this.removeEventListener("focusin",r(this,Hl)),this.removeEventListener("focusout",r(this,Nl)),this.removeEventListener("pointerdown",r(this,Ol)),this.removeEventListener("dragstart",r(this,Pl)),r(this,Rl).disconnect(),r(this,en)?.disconnect(),cancelAnimationFrame(r(this,tn)),r(this,we).cancel(!0),s(this,f,Bi).call(this,!1)}willUpdate(e){e.has("view")&&(b(this,Fi,!0),e.get("view")!==void 0&&(this._more="",r(this,we).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,De).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&&b(this,Fi,!0),s(this,f,tv).call(this),r(this,Ge)){let l=s(this,f,Qf).call(this,r(this,Ge).key);l?(b(this,Ge,null),l.focus({preventScroll:!1})):Date.now()>r(this,Ge).until&&b(this,Ge,null)}r(this,Qs)&&(b(this,Qs,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Fi)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),b(this,Fi,!1)}t||b(this,Fi,!0),r(this,Z)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,a=`${i.view}|${i.start}|${i.end}`;a!==r(this,Al)&&(b(this,Al,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,f,Cl).call(this,r(this,f,bt),-1))}next(){this.date=P(s(this,f,Cl).call(this,r(this,f,bt),1))}goToToday(){this.date=r(this,f,Tl)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let a=s(this,f,Ws).call(this,i);if(!a)return!1;let l=s(this,f,ft).call(this).map(P),d=t&&a.days.includes(t)&&l.includes(t)?t:a.days.find(v=>l.includes(v));if(!d)return!1;let m=s(this,f,fu).call(this,a,d);if(!m)return!1;s(this,f,Bi).call(this,!1),r(this,we).cancel(!0),this._more="",b(this,Z,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return b(this,Ct,u),b(this,Ge,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,we).pickUp(m.from),!0}cancelMove(){let e=r(this,Q);e?.started&&(s(this,f,Bi).call(this,!1),r(this,De).announce(this.t("cancelled",{event:e.ev.name,place:s(this,f,Ir).call(this,e,e.from)}))),r(this,we).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,l=a&&s(this,f,Ws).call(this,a);if(!l)return!1;let d=l.allDay?N(it(t).date||t):kt(t);if(!d)return!1;let m=i?l.allDay?N(it(i).date||i):kt(i):null;return(!m||m<d)&&(m=l.allDay?Y(d,jh(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,f,wu).call(this,l,d,m,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Pr).get(t);if(this.controlled||!i)return!1;r(this,Pr).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,f,Ws).call(this,t);return l&&a&&b(this,Ge,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,De).announce(this.t("reverted",{event:t.name,place:l?s(this,f,Vh).call(this,l):i.start})),!0}render(){let e=s(this,f,ft).call(this),t=s(this,f,Gf).call(this,s(this,f,Wf).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2697
|
-
${s(this,
|
|
2698
|
-
${r(this,
|
|
2706
|
+
`];$("cm-board",cn);var sM=z("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),gn=class extends L{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}};gn.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}},gn.styles=w`:host { display: none !important; }`;$("cm-calendar-event",gn);var ym=o=>String(o).padStart(2,"0"),vv=o=>`${P(o)}T${ym(o.getHours())}:${ym(o.getMinutes())}`,pm=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),yv=["month","week","day"],kx=600,xv=new Map,wv=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=xv.get(e);return t||(t=new Intl.DateTimeFormat(o,n),xv.set(e,t)),t},qu=o=>o.replace(/[ ]/g," ").trim(),bn,Ae,Re,$e,Z,Q,ta,Dt,et,ec,Wi,vn,yn,xn,wn,tc,v,Te,Ui,Kl,um,St,Ou,Wl,yt,Bu,$v,xt,pn,kv,Ev,Qe,Gl,Yl,gm,Mv,Tv,zv,ea,Fu,Xl,_v,Jl,Cv,Lv,Sv,Dv,ic,rc,Av,Rv,ac,Zl,Hv,ju,Vu,Uu,Nv,Iv,Ku,Wu,Gu,sc,Yu,Pv,nc,oc,lc,cc,dc,hc,Xu,fm,qv,Ki,Ql,Ov,Ju,Bv,bm,Zu,un,vm,Fv,jv,Vv,Uv,Kv,fn=class extends T{constructor(){super();m(this,v);this.view="month";this.date="";this.today="";this.step=15;m(this,bn,"");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;m(this,Ae,R("cm-cal"));m(this,Re,new Xr);m(this,$e);m(this,Z,null);m(this,Q,null);m(this,ta,new WeakMap);m(this,Dt,"");m(this,et,null);m(this,ec,"");m(this,Wi,!0);m(this,vn,0);m(this,yn,!1);m(this,xn);m(this,wn,0);m(this,tc,new MutationObserver(()=>this.requestUpdate()));m(this,ic,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Dt,t.dataset.k);for(let i of s(this,v,Jl).call(this))i.tabIndex=i===t?0:-1}});m(this,rc,e=>{let t=e.relatedTarget;if(this._more&&!r(this,Z)){let i=this.renderRoot.querySelector(".pop"),a=e.composedPath()[0];i&&i.contains(a)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,$e).active||!r(this,Z)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,$e).active||!r(this,Z))return;this.renderRoot.activeElement?.dataset.ev!==r(this,Z).ev.key&&r(this,$e).cancel()}))});m(this,ac,e=>{if(r(this,Q)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,$e).active){r(this,$e).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,v,bm).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,vn,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(a&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...a.querySelectorAll(".chip")],p=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];p&&(e.preventDefault(),p.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),s(this,v,Rv).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,v,Av).call(this,i,t);l?(e.preventDefault(),s(this,v,Dv).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});m(this,sc,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});m(this,nc,e=>{if(r(this,Q)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(p=>p.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),a=i&&s(this,v,pn).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,v,Vu).call(this,a,t.dataset.day??a.days[0]);if(!l)return;r(this,$e).active&&r(this,$e).cancel();let d=0;if(l.mode==="time"){let p=s(this,v,Yu).call(this,e.clientX,e.clientY);p&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,p.min-a.min)))}g(this,Q,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,Q).timer=setTimeout(()=>{r(this,Q)&&!r(this,Q).started&&s(this,v,Xu).call(this)},300)),window.addEventListener("pointermove",r(this,cc),!0),window.addEventListener("pointerup",r(this,dc),!0),window.addEventListener("pointercancel",r(this,hc),!0),window.addEventListener("touchmove",r(this,oc),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,lc),!0)});m(this,oc,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});m(this,lc,e=>{r(this,Q)&&e.preventDefault()});m(this,cc,e=>{let t=r(this,Q);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,v,Xu).call(this):s(this,v,Ki).call(this,!1));return}e.preventDefault(),s(this,v,fm).call(this)}});m(this,dc,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,v,Ki).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,v,Ki).call(this,!0)});m(this,hc,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,v,Ki).call(this,!1)});g(this,$e,new Yr({groupCount:()=>s(this,v,xt).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,v,Zl).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,v,Hv).call(this,e,t),onTarget:e=>s(this,v,Nv).call(this,e),onDrop:(e,t)=>s(this,v,Iv).call(this,e,t),onCancel:()=>s(this,v,Uu).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,v,ea).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,v,ea).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,v,ea).call(this,r(this,Z),e)})},announce:e=>r(this,Re).announce(e)}))}get locale(){return r(this,bn)}set locale(e){let t=r(this,bn);g(this,bn,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,v,xt).call(this);return{view:r(this,v,Te),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,Z)?.ev.el??null}get announcement(){return r(this,Re).text}announce(e){r(this,Re).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,ac)),this.addEventListener("focusin",r(this,ic)),this.addEventListener("focusout",r(this,rc)),this.addEventListener("pointerdown",r(this,nc)),this.addEventListener("dragstart",r(this,sc)),r(this,tc).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,xn,new ResizeObserver(()=>{cancelAnimationFrame(r(this,wn)),g(this,wn,requestAnimationFrame(()=>s(this,v,Fu).call(this)))})),r(this,xn).observe(this)),s(this,v,Fu).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,ac)),this.removeEventListener("focusin",r(this,ic)),this.removeEventListener("focusout",r(this,rc)),this.removeEventListener("pointerdown",r(this,nc)),this.removeEventListener("dragstart",r(this,sc)),r(this,tc).disconnect(),r(this,xn)?.disconnect(),cancelAnimationFrame(r(this,wn)),r(this,$e).cancel(!0),s(this,v,Ki).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,Wi,!0),e.get("view")!==void 0&&(this._more="",r(this,$e).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,Re).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,Wi,!0),s(this,v,Sv).call(this),r(this,et)){let l=s(this,v,Cv).call(this,r(this,et).key);l?(g(this,et,null),l.focus({preventScroll:!1})):Date.now()>r(this,et).until&&g(this,et,null)}r(this,yn)&&(g(this,yn,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Wi)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,Wi,!1)}t||g(this,Wi,!0),r(this,Z)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,a=`${i.view}|${i.start}|${i.end}`;a!==r(this,ec)&&(g(this,ec,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,v,Xl).call(this,r(this,v,yt),-1))}next(){this.date=P(s(this,v,Xl).call(this,r(this,v,yt),1))}goToToday(){this.date=r(this,v,Wl)}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,v,pn).call(this,i);if(!a)return!1;let l=s(this,v,xt).call(this).map(P),d=t&&a.days.includes(t)&&l.includes(t)?t:a.days.find(b=>l.includes(b));if(!d)return!1;let p=s(this,v,Vu).call(this,a,d);if(!p)return!1;s(this,v,Ki).call(this,!1),r(this,$e).cancel(!0),this._more="",g(this,Z,p),i.moving=!0;let u=`ev:${a.key}:${d}`;return g(this,Dt,u),g(this,et,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,$e).pickUp(p.from),!0}cancelMove(){let e=r(this,Q);e?.started&&(s(this,v,Ki).call(this,!1),r(this,Re).announce(this.t("cancelled",{event:e.ev.name,place:s(this,v,ea).call(this,e,e.from)}))),r(this,$e).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,l=a&&s(this,v,pn).call(this,a);if(!l)return!1;let d=l.allDay?N(ot(t).date||t):Tt(t);if(!d)return!1;let p=i?l.allDay?N(ot(i).date||i):Tt(i):null;return(!p||p<d)&&(p=l.allDay?Y(d,pm(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,v,Gu).call(this,l,d,p,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,ta).get(t);if(this.controlled||!i)return!1;r(this,ta).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,v,pn).call(this,t);return l&&a&&g(this,et,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Re).announce(this.t("reverted",{event:t.name,place:l?s(this,v,gm).call(this,l):i.start})),!0}render(){let e=s(this,v,xt).call(this),t=s(this,v,Ev).call(this,s(this,v,kv).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2707
|
+
${s(this,v,Fv).call(this,e)}
|
|
2708
|
+
${r(this,v,Te)==="month"?s(this,v,Vv).call(this,e,t):s(this,v,Kv).call(this,e,t)}
|
|
2699
2709
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
2700
|
-
<span id="${r(this,
|
|
2701
|
-
<span id="${r(this,
|
|
2702
|
-
<span id="${r(this,
|
|
2703
|
-
</div>`}};Js=new WeakMap,Le=new WeakMap,De=new WeakMap,we=new WeakMap,Z=new WeakMap,Q=new WeakMap,Pr=new WeakMap,Ct=new WeakMap,Ge=new WeakMap,Al=new WeakMap,Fi=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,en=new WeakMap,tn=new WeakMap,Rl=new WeakMap,f=new WeakSet,Me=function(){return jf.includes(this.view)?this.view:"month"},qi=function(){return Aa(this,this.locale)},Ml=function(){return Ha(r(this,f,qi))},Uh=function(){return Hd(r(this,f,qi),this.hourCycle)},_t=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},pu=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,f,qi)):(Math.trunc(e)%7+7)%7},Tl=function(){return N(this.today)?this.today:Jm()},bt=function(){return N(this.date)??N(r(this,f,Tl))},uu=function(){return r(this,f,Me)==="month"&&this._narrow},Kf=function(){return r(this,f,Me)!=="month"},ft=function(){let e=r(this,f,bt),t=r(this,f,pu);if(r(this,f,Me)==="day")return[e];if(r(this,f,Me)==="week"){if(this._narrow)return[e,Y(e,1),Y(e,2)];let d=Y(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>Y(d,u))}let i=Ft(e),a=Y(i,-((i.getDay()-t+7)%7)),l=Math.ceil((jh(a,La(e))+1)/7)*7;return Array.from({length:l},(d,m)=>Y(a,m))},Ws=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(it(e.start).date||e.start);if(!u)return null;let v=N(it(e.end).date||e.end)??u;v<u&&(v=u);let g=Math.min(jh(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:g+1},(w,y)=>P(Y(u,y)))}}let l=kt(e.start);if(!l)return null;let d=kt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let m=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:a,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:m,days:[P(l)]}},Wf=function(){return this.events.map(e=>s(this,f,Ws).call(this,e)).filter(e=>!!e)},Gf=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},We=function(e){return ae(e,{weekday:"long",day:"numeric",month:"long"},r(this,f,qi))},zl=function(e){return r(this,f,Uh).format((e%1440+1440)%1440)},_l=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=Vf(r(this,f,qi),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(g=>g.source==="endRange"),v=-1;if(m.forEach((g,w)=>{g.source==="startRange"&&(v=w)}),v>=0&&u>v){let g=w=>mu(w.map(y=>y.value).join(""));return this.t("timeRange",{start:g(m.slice(0,v+1)),end:g(m.slice(u))})}}}catch{}let l=P(e)===P(t),d=m=>l?s(this,f,zl).call(this,m.getHours()*60+m.getMinutes()):r(this,f,Uh).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},Vh=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,f,We).call(this,e.start)}):this.t("allDayRange",{start:s(this,f,We).call(this,e.start),end:s(this,f,We).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&jh(e.start,e.end)===1)?s(this,f,_l).call(this,e.start,e.end):this.t("timed",{date:s(this,f,We).call(this,e.start),time:s(this,f,_l).call(this,e.start,e.end)})},Yf=function(e){let t={title:e.name,when:s(this,f,Vh).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Xf=function(e){let t=r(this,f,qi);if(r(this,f,Me)==="month")return r(this,f,Ml).monthYear(r(this,f,bt));if(e.length===1)return ae(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Vf(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return mu(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Jf=function(e){return r(this,f,Uh).hour12?mu(ae(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,f,qi))):s(this,f,zl).call(this,e*60)},Ir=function(e,t){let{start:i,end:a}=s(this,f,bu).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,f,We).call(this,i),time:s(this,f,_l).call(this,i,a)}):s(this,f,We).call(this,Y(N(e.origin),t.group-e.from.group))},gu=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<Ky;t!==this._narrow&&(this._narrow=t)},Cl=function(e,t){return r(this,f,Me)==="month"?tt(e,t):r(this,f,Me)==="week"?Y(e,t*(this._narrow?3:7)):Y(e,t)},Zf=function(e){this.view!==e&&(this.view=e)},Sl=function(){return[...this.renderRoot.querySelectorAll(".item")]},Qf=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},ev=function(){let e=P(r(this,f,bt));if(r(this,f,uu))return`day:${e}`;if(r(this,f,Me)==="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}`},tv=function(){let e=s(this,f,Sl).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Ct))??e.find(i=>i.dataset.k===s(this,f,ev).call(this))??e.find(i=>i.dataset.day===P(r(this,f,bt)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},iv=function(e){b(this,Ct,e.dataset.k??"");for(let t of s(this,f,Sl).call(this))t.tabIndex=t===e?0:-1;e.focus()},Hl=new WeakMap,Nl=new WeakMap,rv=function(e,t){let i=new Map;for(let y of s(this,f,Sl).call(this)){let k=Number(y.dataset.i);(i.get(k)??i.set(k,[]).get(k)).push(y)}let a=Number(e.dataset.i),l=i.get(a)??[e],d=Math.max(0,l.indexOf(e)),m=s(this,f,ft).call(this).length,u=r(this,f,Me)==="month",v=e.dataset.row,g=(y,k)=>{let L=y>=0&&y<m?i.get(y):void 0;return(L?.length?k(L):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(k=>k.dataset.row===v)??y[0];switch(t){case"ArrowRight":return g(a+1,w);case"ArrowLeft":return g(a-1,w);case"ArrowDown":return l[d+1]??(u?g(a+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?g(a-7,y=>y[y.length-1]):null;case"Home":return u?g(a-a%7,y=>y[0]):g(0,w);case"End":return u?g(Math.min(m-1,a-a%7+6),y=>y[0]):g(m-1,w);default:return null}},av=function(e,t){let i=e.dataset.day??P(r(this,f,bt)),a=s(this,f,Cl).call(this,N(i)??r(this,f,bt),t),l=P(a),d=(e.dataset.k??"").split(":")[0],m;r(this,f,uu)?m=`day:${l}`:r(this,f,Me)==="month"?m=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?m=`adadd:${l}`:m=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,f,Cl).call(this,r(this,f,bt),t)),b(this,Ct,m),b(this,Ge,{key:m,until:Date.now()+1e3})},Il=new WeakMap,Ll=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,f,_t))+1},sv=function(e,t){let i=r(this,Z);if(!i)return null;let a=s(this,f,ft).call(this).length,l=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,f,Me)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return v?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return v?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:v?t.group-t.group%7:0,index:0};case"End":return{group:v?l(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,f,Ll).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,f,_t))),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}},bu=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,f,ft).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,f,_t));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)}},fu=function(e,t){let a=s(this,f,ft).call(this).map(P).indexOf(t);if(a<0)return null;let l=r(this,f,Kf)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,f,_t)),s(this,f,Ll).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},vu=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),b(this,Z,null),this._target=null},nv=function(e){let t=r(this,Z);if(!t||!e){this._target=null;return}let i=P(s(this,f,ft).call(this)[e.group]??N(t.origin)),a=e.group===t.from.group&&e.index===t.from.index;this._target=a?null:{iso:i,min:t.mode==="time"?e.index*r(this,f,_t):void 0}},ov=function(e,t){let i=r(this,Z);s(this,f,vu).call(this),i&&(b(this,Zs,performance.now()+400),s(this,f,yu).call(this,i,e,t,"keyboard"))},yu=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,f,bu).call(this,e,i),u=P(Y(N(e.origin),i.group-t.group));s(this,f,wu).call(this,e.ev,d,m,a,l,e.mode==="time"?P(d):u)},xu=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:Ff(t),end:Ff(i)}},wu=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,f,xu).call(this,e.allDay,e.start,e.end),g=s(this,f,xu).call(this,e.allDay,t,i),w=B=>{a==="keyboard"&&b(this,Ge,{key:B,until:Date.now()+1e3})};if(l||v.start===g.start&&v.end===g.end)return a!=="api"&&r(this,De).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},k=e.allDay?s(this,f,We).call(this,t):this.t("timed",{date:s(this,f,We).call(this,t),time:s(this,f,_l).call(this,t,i)}),L=[],A={value:e.key,event:m,from:v,to:g,allDay:e.allDay,source:a,waitUntil:B=>{L.push(Promise.resolve(B))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:A,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Pr).set(m,v),m.start=g.start,m.end=g.end),w(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,De).announce(this.t("moved",{event:u,place:y.allDay?s(this,f,We).call(this,t):k})),L.length&&(m.pending=!0,Promise.all(L).then(()=>{m.pending=!1,this.controlled||r(this,Pr).delete(m)},()=>{m.pending=!1,this.controlled?r(this,De).announce(this.t("reverted",{event:u,place:s(this,f,Vh).call(this,e)})):this.revert(m)})),!0):(r(this,De).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},Pl=new WeakMap,$u=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(),g=e<v.left?v.left-e:e>v.right?e-v.right:0;g<l&&(l=g,a=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},lv=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,g=Math.hypot(u,v);g<l&&(l=g,a=d)}return a?Number(a.dataset.i):null},Ol=new WeakMap,ql=new WeakMap,Bl=new WeakMap,Fl=new WeakMap,jl=new WeakMap,Ul=new WeakMap,ku=function(){let e=r(this,Q);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,De).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,f,Ir).call(this,e,e.from)})),s(this,f,Kh).call(this);let t=()=>{r(this,Q)?.started&&(s(this,f,cv).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Kh=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,f,$u).call(this,e.x,e.y);if(l){let d=s(this,f,Ll).call(this,e.ev.dur)-1;t={group:l.group,index:Math.max(0,Math.min(d,Math.round((l.min-e.grab)/r(this,f,_t))))}}}else{let l=s(this,f,lv).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let a=t.group===e.from.group&&t.index===e.from.index;this._target=a?null:{iso:P(s(this,f,ft).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,f,_t):void 0},i&&r(this,De).announce(this.t("over",{place:s(this,f,Ir).call(this,e,t)}))},cv=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let m=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-m),v=l(d.bottom-e.y),g=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==g&&s(this,f,Kh).call(this)},Bi=function(e){let t=r(this,Q);t&&(b(this,Q,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,Fl),!0),window.removeEventListener("pointerup",r(this,jl),!0),window.removeEventListener("pointercancel",r(this,Ul),!0),window.removeEventListener("touchmove",r(this,ql),!0),window.removeEventListener("contextmenu",r(this,Bl),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,f,yu).call(this,t,t.from,t.to,"pointer")))},Dl=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,f,Me)},bubbles:!0,composed:!0}))},dv=function(e,t,i){let a=i*60;if(e.detail>0){let m=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-m.top)/m.height*60/r(this,f,_t))*r(this,f,_t);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,f,Dl).call(this,`${t}T${Yh(l)}:${Yh(d)}`,!1)},Eu=function(e,t){if(performance.now()<r(this,Zs)||r(this,we).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()},hv=function(e){this._more=e,b(this,Qs,!0)},Wh=function(e){let t=this._more;this._more="",e&&t&&(b(this,Ct,`more:${t}`),b(this,Ge,{key:`more:${t}`,until:Date.now()+1e3}))},Mu=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},Gs=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,f,Yf).call(this,e),g=!this.readonly&&!m.locked&&!u,w=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",y=`chip ${a} tone-${w}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,k=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,L=e.allDay?h:c`<span class="tm">${s(this,f,zl).call(this,e.min)}</span>`,A=m.kind&&(a!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,O=u?c`<span class="spin" aria-hidden="true"></span>`:h,B=a==="time"?c`<span class="lead">${k}${L}${O}</span><span class="h">${e.name}</span>${A}`:c`${k}${L}<span class="h">${e.name}</span>${A}${O}`,K=u?`${v}, ${this.t("saving")}`:v,Ye=g?`${r(this,Le)}-mv`:`${r(this,Le)}-op`,W=`ev:${e.key}:${t}`,qe=g?this.t("roleDescription"):h;return m.href?c`<a class=${y} href=${m.href} style=${d.style??h} data-k=${W} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2704
|
-
data-row=${d.row??h} aria-label=${K} aria-describedby=${
|
|
2705
|
-
@click=${
|
|
2706
|
-
data-row=${d.row??h} aria-label=${K} aria-describedby=${
|
|
2707
|
-
@click=${
|
|
2710
|
+
<span id="${r(this,Ae)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
2711
|
+
<span id="${r(this,Ae)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
2712
|
+
<span id="${r(this,Ae)}-op" hidden>${this.t("openHint")}</span>
|
|
2713
|
+
</div>`}};bn=new WeakMap,Ae=new WeakMap,Re=new WeakMap,$e=new WeakMap,Z=new WeakMap,Q=new WeakMap,ta=new WeakMap,Dt=new WeakMap,et=new WeakMap,ec=new WeakMap,Wi=new WeakMap,vn=new WeakMap,yn=new WeakMap,xn=new WeakMap,wn=new WeakMap,tc=new WeakMap,v=new WeakSet,Te=function(){return yv.includes(this.view)?this.view:"month"},Ui=function(){return Za(this,this.locale)},Kl=function(){return es(r(this,v,Ui))},um=function(){return sh(r(this,v,Ui),this.hourCycle)},St=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Ou=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Qa(r(this,v,Ui)):(Math.trunc(e)%7+7)%7},Wl=function(){return N(this.today)?this.today:Ep()},yt=function(){return N(this.date)??N(r(this,v,Wl))},Bu=function(){return r(this,v,Te)==="month"&&this._narrow},$v=function(){return r(this,v,Te)!=="month"},xt=function(){let e=r(this,v,yt),t=r(this,v,Ou);if(r(this,v,Te)==="day")return[e];if(r(this,v,Te)==="week"){if(this._narrow)return[e,Y(e,1),Y(e,2)];let d=Y(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(p,u)=>Y(d,u))}let i=Kt(e),a=Y(i,-((i.getDay()-t+7)%7)),l=Math.ceil((pm(a,Xa(e))+1)/7)*7;return Array.from({length:l},(d,p)=>Y(a,p))},pn=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(ot(e.start).date||e.start);if(!u)return null;let b=N(ot(e.end).date||e.end)??u;b<u&&(b=u);let f=Math.min(pm(u,b),366);return{el:e,key:e.key,name:t,allDay:a,start:u,end:b,min:0,dur:1440,days:Array.from({length:f+1},(x,y)=>P(Y(u,y)))}}let l=Tt(e.start);if(!l)return null;let d=Tt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let p=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:p,days:[P(l)]}},kv=function(){return this.events.map(e=>s(this,v,pn).call(this,e)).filter(e=>!!e)},Ev=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},Qe=function(e){return ne(e,{weekday:"long",day:"numeric",month:"long"},r(this,v,Ui))},Gl=function(e){return r(this,v,um).format((e%1440+1440)%1440)},Yl=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=wv(r(this,v,Ui),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let p=a.formatRangeToParts(e,t),u=p.findIndex(f=>f.source==="endRange"),b=-1;if(p.forEach((f,x)=>{f.source==="startRange"&&(b=x)}),b>=0&&u>b){let f=x=>qu(x.map(y=>y.value).join(""));return this.t("timeRange",{start:f(p.slice(0,b+1)),end:f(p.slice(u))})}}}catch{}let l=P(e)===P(t),d=p=>l?s(this,v,Gl).call(this,p.getHours()*60+p.getMinutes()):r(this,v,um).dateTime(p);return this.t("timeRange",{start:d(e),end:d(t)})},gm=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,v,Qe).call(this,e.start)}):this.t("allDayRange",{start:s(this,v,Qe).call(this,e.start),end:s(this,v,Qe).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&pm(e.start,e.end)===1)?s(this,v,Yl).call(this,e.start,e.end):this.t("timed",{date:s(this,v,Qe).call(this,e.start),time:s(this,v,Yl).call(this,e.start,e.end)})},Mv=function(e){let t={title:e.name,when:s(this,v,gm).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Tv=function(e){let t=r(this,v,Ui);if(r(this,v,Te)==="month")return r(this,v,Kl).monthYear(r(this,v,yt));if(e.length===1)return ne(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=wv(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return qu(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},zv=function(e){return r(this,v,um).hour12?qu(ne(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,v,Ui))):s(this,v,Gl).call(this,e*60)},ea=function(e,t){let{start:i,end:a}=s(this,v,ju).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,v,Qe).call(this,i),time:s(this,v,Yl).call(this,i,a)}):s(this,v,Qe).call(this,Y(N(e.origin),t.group-e.from.group))},Fu=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<kx;t!==this._narrow&&(this._narrow=t)},Xl=function(e,t){return r(this,v,Te)==="month"?nt(e,t):r(this,v,Te)==="week"?Y(e,t*(this._narrow?3:7)):Y(e,t)},_v=function(e){this.view!==e&&(this.view=e)},Jl=function(){return[...this.renderRoot.querySelectorAll(".item")]},Cv=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},Lv=function(){let e=P(r(this,v,yt));if(r(this,v,Bu))return`day:${e}`;if(r(this,v,Te)==="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}`},Sv=function(){let e=s(this,v,Jl).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Dt))??e.find(i=>i.dataset.k===s(this,v,Lv).call(this))??e.find(i=>i.dataset.day===P(r(this,v,yt)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},Dv=function(e){g(this,Dt,e.dataset.k??"");for(let t of s(this,v,Jl).call(this))t.tabIndex=t===e?0:-1;e.focus()},ic=new WeakMap,rc=new WeakMap,Av=function(e,t){let i=new Map;for(let y of s(this,v,Jl).call(this)){let k=Number(y.dataset.i);(i.get(k)??i.set(k,[]).get(k)).push(y)}let a=Number(e.dataset.i),l=i.get(a)??[e],d=Math.max(0,l.indexOf(e)),p=s(this,v,xt).call(this).length,u=r(this,v,Te)==="month",b=e.dataset.row,f=(y,k)=>{let S=y>=0&&y<p?i.get(y):void 0;return(S?.length?k(S):void 0)??null},x=y=>u?y[Math.min(d,y.length-1)]:y.find(k=>k.dataset.row===b)??y[0];switch(t){case"ArrowRight":return f(a+1,x);case"ArrowLeft":return f(a-1,x);case"ArrowDown":return l[d+1]??(u?f(a+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?f(a-7,y=>y[y.length-1]):null;case"Home":return u?f(a-a%7,y=>y[0]):f(0,x);case"End":return u?f(Math.min(p-1,a-a%7+6),y=>y[0]):f(p-1,x);default:return null}},Rv=function(e,t){let i=e.dataset.day??P(r(this,v,yt)),a=s(this,v,Xl).call(this,N(i)??r(this,v,yt),t),l=P(a),d=(e.dataset.k??"").split(":")[0],p;r(this,v,Bu)?p=`day:${l}`:r(this,v,Te)==="month"?p=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?p=`adadd:${l}`:p=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,v,Xl).call(this,r(this,v,yt),t)),g(this,Dt,p),g(this,et,{key:p,until:Date.now()+1e3})},ac=new WeakMap,Zl=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,v,St))+1},Hv=function(e,t){let i=r(this,Z);if(!i)return null;let a=s(this,v,xt).call(this).length,l=b=>Math.max(0,Math.min(a-1,b));if(i.mode==="day"){let b=r(this,v,Te)==="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 b?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return b?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:b?t.group-t.group%7:0,index:0};case"End":return{group:b?l(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,v,Zl).call(this,i.ev.dur)-1,p=Math.max(1,Math.round(60/r(this,v,St))),u=b=>Math.max(0,Math.min(d,b));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+p)};case"PageUp":return{group:t.group,index:u(t.index-p)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},ju=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,v,xt).call(this)[t.group]??N(e.origin),p=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,v,St));return{start:p,end:new Date(p.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)}},Vu=function(e,t){let a=s(this,v,xt).call(this).map(P).indexOf(t);if(a<0)return null;let l=r(this,v,$v)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,v,St)),s(this,v,Zl).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},Uu=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),g(this,Z,null),this._target=null},Nv=function(e){let t=r(this,Z);if(!t||!e){this._target=null;return}let i=P(s(this,v,xt).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,v,St):void 0}},Iv=function(e,t){let i=r(this,Z);s(this,v,Uu).call(this),i&&(g(this,vn,performance.now()+400),s(this,v,Ku).call(this,i,e,t,"keyboard"))},Ku=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:p}=s(this,v,ju).call(this,e,i),u=P(Y(N(e.origin),i.group-t.group));s(this,v,Gu).call(this,e.ev,d,p,a,l,e.mode==="time"?P(d):u)},Wu=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:vv(t),end:vv(i)}},Gu=function(e,t,i,a,l,d){let p=e.el,u=e.name,b=s(this,v,Wu).call(this,e.allDay,e.start,e.end),f=s(this,v,Wu).call(this,e.allDay,t,i),x=B=>{a==="keyboard"&&g(this,et,{key:B,until:Date.now()+1e3})};if(l||b.start===f.start&&b.end===f.end)return a!=="api"&&r(this,Re).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},k=e.allDay?s(this,v,Qe).call(this,t):this.t("timed",{date:s(this,v,Qe).call(this,t),time:s(this,v,Yl).call(this,t,i)}),S=[],A={value:e.key,event:p,from:b,to:f,allDay:e.allDay,source:a,waitUntil:B=>{S.push(Promise.resolve(B))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:A,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,ta).set(p,b),p.start=f.start,p.end=f.end),x(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Re).announce(this.t("moved",{event:u,place:y.allDay?s(this,v,Qe).call(this,t):k})),S.length&&(p.pending=!0,Promise.all(S).then(()=>{p.pending=!1,this.controlled||r(this,ta).delete(p)},()=>{p.pending=!1,this.controlled?r(this,Re).announce(this.t("reverted",{event:u,place:s(this,v,gm).call(this,e)})):this.revert(p)})),!0):(r(this,Re).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},sc=new WeakMap,Yu=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((p,u)=>{let b=p.getBoundingClientRect(),f=e<b.left?b.left-e:e>b.right?e-b.right:0;f<l&&(l=f,a=Number(p.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},Pv=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 p=d.getBoundingClientRect(),u=e<p.left?p.left-e:e>p.right?e-p.right:0,b=t<p.top?p.top-t:t>p.bottom?t-p.bottom:0,f=Math.hypot(u,b);f<l&&(l=f,a=d)}return a?Number(a.dataset.i):null},nc=new WeakMap,oc=new WeakMap,lc=new WeakMap,cc=new WeakMap,dc=new WeakMap,hc=new WeakMap,Xu=function(){let e=r(this,Q);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Re).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,v,ea).call(this,e,e.from)})),s(this,v,fm).call(this);let t=()=>{r(this,Q)?.started&&(s(this,v,qv).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},fm=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,v,Yu).call(this,e.x,e.y);if(l){let d=s(this,v,Zl).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,v,St))))}}}else{let l=s(this,v,Pv).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let a=t.group===e.from.group&&t.index===e.from.index;this._target=a?null:{iso:P(s(this,v,xt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,v,St):void 0},i&&r(this,Re).announce(this.t("over",{place:s(this,v,ea).call(this,e,t)}))},qv=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=x=>x<i?Math.ceil((i-Math.max(x,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let p=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-p),b=l(d.bottom-e.y),f=t.scrollTop;u?t.scrollTop-=u:b&&(t.scrollTop+=b),t.scrollTop!==f&&s(this,v,fm).call(this)},Ki=function(e){let t=r(this,Q);t&&(g(this,Q,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,cc),!0),window.removeEventListener("pointerup",r(this,dc),!0),window.removeEventListener("pointercancel",r(this,hc),!0),window.removeEventListener("touchmove",r(this,oc),!0),window.removeEventListener("contextmenu",r(this,lc),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,v,Ku).call(this,t,t.from,t.to,"pointer")))},Ql=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,v,Te)},bubbles:!0,composed:!0}))},Ov=function(e,t,i){let a=i*60;if(e.detail>0){let p=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-p.top)/p.height*60/r(this,v,St))*r(this,v,St);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,v,Ql).call(this,`${t}T${ym(l)}:${ym(d)}`,!1)},Ju=function(e,t){if(performance.now()<r(this,vn)||r(this,$e).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()},Bv=function(e){this._more=e,g(this,yn,!0)},bm=function(e){let t=this._more;this._more="",e&&t&&(g(this,Dt,`more:${t}`),g(this,et,{key:`more:${t}`,until:Date.now()+1e3}))},Zu=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},un=function(e,t,i,a,l,d={}){let p=e.el,u=p.pending,b=s(this,v,Mv).call(this,e),f=!this.readonly&&!p.locked&&!u,x=["attention","information","success","critical"].includes(p.tone)?p.tone:"neutral",y=`chip ${a} tone-${x}${l?" item":""}${p.moving?" moving":""}${u?" pending":""}${p.locked?" locked":""}`,k=p.icon?c`<cm-icon name=${p.icon} size="14"></cm-icon>`:h,S=e.allDay?h:c`<span class="tm">${s(this,v,Gl).call(this,e.min)}</span>`,A=p.kind&&(a!=="month"||!p.icon)?c`<span class="k">${p.kind}</span>`:h,q=u?c`<span class="spin" aria-hidden="true"></span>`:h,B=a==="time"?c`<span class="lead">${k}${S}${q}</span><span class="h">${e.name}</span>${A}`:c`${k}${S}<span class="h">${e.name}</span>${A}${q}`,K=u?`${b}, ${this.t("saving")}`:b,tt=f?`${r(this,Ae)}-mv`:`${r(this,Ae)}-op`,W=`ev:${e.key}:${t}`,je=f?this.t("roleDescription"):h;return p.href?c`<a class=${y} href=${p.href} style=${d.style??h} data-k=${W} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2714
|
+
data-row=${d.row??h} aria-label=${K} aria-describedby=${tt} aria-roledescription=${je}
|
|
2715
|
+
@click=${pt=>s(this,v,Ju).call(this,pt,e)}>${B}</a>`:c`<button type="button" class=${y} style=${d.style??h} data-k=${W} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2716
|
+
data-row=${d.row??h} aria-label=${K} aria-describedby=${tt} aria-roledescription=${je}
|
|
2717
|
+
@click=${pt=>s(this,v,Ju).call(this,pt,e)}>${B}</button>`},vm=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.name}</div>`},Fv=function(e){let t=r(this,v,Te),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">
|
|
2708
2718
|
<div class="nav">
|
|
2709
2719
|
<button type="button" class="hb icon prev" aria-label=${a} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
2710
2720
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
2711
2721
|
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
2712
2722
|
</div>
|
|
2713
|
-
<div class="title" part="title" id="${r(this,
|
|
2723
|
+
<div class="title" part="title" id="${r(this,Ae)}-t" role="heading" aria-level=${d} aria-live="polite">${s(this,v,Tv).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
2714
2724
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
2715
|
-
${
|
|
2725
|
+
${yv.map(p=>c`<button type="button" class="hb" data-view=${p} aria-pressed=${p===t?"true":"false"} @click=${()=>s(this,v,_v).call(this,p)}>${this.t(p)}</button>`)}
|
|
2716
2726
|
</div>
|
|
2717
|
-
</div>`},
|
|
2718
|
-
<button type="button" class="dayb item" data-k="day:${W}" data-i=${K} data-day=${W} aria-label=${this.t("dayEvents",{date:
|
|
2719
|
-
@click=${()=>{this.date=W,
|
|
2720
|
-
</td>`}let
|
|
2721
|
-
aria-label=${
|
|
2722
|
-
<div class="dh">${
|
|
2723
|
-
${
|
|
2724
|
-
@click=${()=>s(this,
|
|
2727
|
+
</div>`},jv=function(e){let t=r(this,v,Kl),i=Array.from({length:7},(a,l)=>(l+r(this,v,Ou))%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>`},Vv=function(e,t){let i=r(this,v,yt),a=r(this,v,Wl),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=s(this,v,Zu).call(this),p=this._target,u=Array.from({length:e.length/7},(B,K)=>e.slice(K*7,K*7+7)),b=this._narrow,f=(B,K,tt)=>{let W=P(B),je=t.get(W)??[],pt=s(this,v,Qe).call(this,B),kg=`${B.getMonth()!==i.getMonth()?"other":""} ${W===a?"today":""} ${p?.iso===W?"over":""}`,Eg=c`<span class="num" aria-hidden="true">${r(this,v,Kl).day(B)}</span>`;if(b){let Rt=je.slice(0,3).map(ua=>["attention","information","success","critical"].includes(ua.el.tone)?ua.el.tone:"neutral");return c`<td class=${kg} data-drop data-i=${K} aria-selected=${W===P(i)?"true":"false"} aria-current=${W===a?"date":h}>
|
|
2728
|
+
<button type="button" class="dayb item" data-k="day:${W}" data-i=${K} data-day=${W} aria-label=${this.t("dayEvents",{date:pt,count:je.length})}
|
|
2729
|
+
@click=${()=>{this.date=W,g(this,Dt,`day:${W}`)}}>${Eg}<span class="dots">${Rt.map(ua=>c`<span class="dot tone-${ua}"></span>`)}</span></button>
|
|
2730
|
+
</td>`}let pa=je,Nc=0;if(je.length>l){pa=je.slice(0,l-1);let Rt=d&&je.find(ua=>ua.key===d.key);Rt&&!pa.includes(Rt)&&(pa=[...je.slice(0,l-2),Rt]),Nc=je.length-pa.length}let Ic=this.readonly;return c`<td class="${kg}${Ic?" item":""}" data-drop data-i=${K} data-day=${W} data-k=${Ic?`cell:${W}`:h}
|
|
2731
|
+
aria-label=${Ic?this.t("dayEvents",{date:pt,count:je.length}):h} aria-current=${W===a?"date":h}>
|
|
2732
|
+
<div class="dh">${Eg}<span class="vh">${pt}</span>
|
|
2733
|
+
${Ic?h:c`<button type="button" class="add item" data-k="add:${W}" data-i=${K} data-day=${W} aria-label=${this.t("addOn",{date:pt})}
|
|
2734
|
+
@click=${()=>s(this,v,Ql).call(this,W,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2725
2735
|
</div>
|
|
2726
|
-
${
|
|
2727
|
-
${
|
|
2728
|
-
${
|
|
2736
|
+
${pa.length||p?.iso===W&&d?c`<ul class="evs">
|
|
2737
|
+
${pa.map(Rt=>c`<li>${s(this,v,un).call(this,Rt,W,K,"month",!0)}</li>`)}
|
|
2738
|
+
${p?.iso===W&&d?c`<li aria-hidden="true">${s(this,v,vm).call(this,d)}</li>`:h}
|
|
2729
2739
|
</ul>`:h}
|
|
2730
|
-
${
|
|
2731
|
-
aria-expanded=${this._more===W?"true":"false"} aria-label=${this.t("moreLabel",{count:
|
|
2732
|
-
@click=${()=>this._more===W?s(this,
|
|
2733
|
-
${this._more===W?c`<div class="pop ${
|
|
2734
|
-
<div class="pop-h"><span>${
|
|
2735
|
-
<ul>${
|
|
2740
|
+
${Nc?c`<button type="button" class="more item" data-k="more:${W}" data-i=${K} data-day=${W} aria-haspopup="dialog"
|
|
2741
|
+
aria-expanded=${this._more===W?"true":"false"} aria-label=${this.t("moreLabel",{count:Nc,date:pt})}
|
|
2742
|
+
@click=${()=>this._more===W?s(this,v,bm).call(this,!1):s(this,v,Bv).call(this,W)}>${this.t("more",{count:Nc})}</button>`:h}
|
|
2743
|
+
${this._more===W?c`<div class="pop ${tt>=4?"end":""}" role="dialog" aria-label=${pt}>
|
|
2744
|
+
<div class="pop-h"><span>${pt}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>s(this,v,bm).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
2745
|
+
<ul>${je.map(Rt=>c`<li>${s(this,v,un).call(this,Rt,W,K,"list",!1)}</li>`)}</ul>
|
|
2736
2746
|
</div>`:h}
|
|
2737
|
-
</td>`},
|
|
2747
|
+
</td>`},x=c`<table class="month ${b?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,Ae)}-t" aria-describedby="${r(this,Ae)}-gh"
|
|
2738
2748
|
aria-busy=${this.loading?"true":"false"}>
|
|
2739
|
-
${s(this,
|
|
2740
|
-
<tbody>${u.map((B,K)=>c`<tr>${B.map((
|
|
2741
|
-
</table>`;if(!
|
|
2742
|
-
<section class="agenda" part="agenda" aria-labelledby="${r(this,
|
|
2749
|
+
${s(this,v,jv).call(this,b)}
|
|
2750
|
+
<tbody>${u.map((B,K)=>c`<tr>${B.map((tt,W)=>f(tt,K*7+W,W))}</tr>`)}</tbody>
|
|
2751
|
+
</table>`;if(!b)return x;let y=P(i),k=t.get(y)??[],S=e.findIndex(B=>P(B)===y),A=s(this,v,Qe).call(this,i),q=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${x}
|
|
2752
|
+
<section class="agenda" part="agenda" aria-labelledby="${r(this,Ae)}-ag">
|
|
2743
2753
|
<div class="ag-h">
|
|
2744
|
-
<div class="ag-t" id="${r(this,
|
|
2745
|
-
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:A})} @click=${()=>s(this,
|
|
2754
|
+
<div class="ag-t" id="${r(this,Ae)}-ag" role="heading" aria-level=${q}>${A}</div>
|
|
2755
|
+
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:A})} @click=${()=>s(this,v,Ql).call(this,y,!0)}>
|
|
2746
2756
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
2747
2757
|
</div>
|
|
2748
|
-
${k.length?c`<ul class="ag-list">${k.map(B=>c`<li>${s(this,
|
|
2749
|
-
</section>`},
|
|
2758
|
+
${k.length?c`<ul class="ag-list">${k.map(B=>c`<li>${s(this,v,un).call(this,B,y,S,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
2759
|
+
</section>`},Uv=function(e){let t=new Map,i=e.filter(u=>!u.allDay).sort((u,b)=>u.min-b.min||b.dur-u.dur),a=[],l=[],d=-1,p=()=>{for(let u of a)t.get(u).lanes=l.length;a=[],l=[]};for(let u of i){let b=Math.min(1440,u.min+Math.max(u.dur,20));u.min>=d&&(p(),d=-1);let f=l.findIndex(x=>x<=u.min);f<0?(f=l.length,l.push(b)):l[f]=b,t.set(u,{lane:f,lanes:1}),a.push(u),d=Math.max(d,b)}return p(),t},Kv=function(e,t){let i=r(this,v,Wl),a=r(this,v,Kl),l=s(this,v,Zu).call(this),d=this._target,p=this.readonly,u=e.map(f=>{let x=P(f),y=t.get(x)??[];return{d:f,iso:x,text:s(this,v,Qe).call(this,f),allDay:y.filter(k=>k.allDay),timed:y.filter(k=>!k.allDay),lanes:s(this,v,Uv).call(this,y)}}),b=Array.from({length:24},(f,x)=>x);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${r(this,Ae)}-t" aria-describedby="${r(this,Ae)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
2750
2760
|
style="--cols:${e.length}">
|
|
2751
2761
|
<div class="tg-top" role="rowgroup">
|
|
2752
2762
|
<div class="row" role="row">
|
|
2753
2763
|
<div class="axis" role="columnheader"><span class="vh">${this.t("time")}</span></div>
|
|
2754
|
-
${u.map(
|
|
2755
|
-
<span class="wd" aria-hidden="true">${a.weekdaysShort[
|
|
2764
|
+
${u.map(f=>c`<div class="colh ${f.iso===i?"today":""}" role="columnheader" aria-current=${f.iso===i?"date":h}>
|
|
2765
|
+
<span class="wd" aria-hidden="true">${a.weekdaysShort[f.d.getDay()]}</span><span class="dn" aria-hidden="true">${a.day(f.d)}</span><span class="vh">${f.text}</span>
|
|
2756
2766
|
</div>`)}
|
|
2757
2767
|
</div>
|
|
2758
2768
|
<div class="row adrow" role="row">
|
|
2759
2769
|
<div class="axis" role="rowheader">${this.t("allDay")}</div>
|
|
2760
|
-
${u.map((
|
|
2761
|
-
${
|
|
2762
|
-
aria-label=${this.t("addAllDay",{date:
|
|
2763
|
-
${
|
|
2764
|
-
${d?.iso===
|
|
2770
|
+
${u.map((f,x)=>c`<div class="adcell ${d?.iso===f.iso&&l?.allDay?"over":""}" role="gridcell" data-drop data-i=${x}>
|
|
2771
|
+
${p?h:c`<button type="button" class="add item" data-k="adadd:${f.iso}" data-i=${x} data-day=${f.iso} data-row="a"
|
|
2772
|
+
aria-label=${this.t("addAllDay",{date:f.text})} @click=${()=>s(this,v,Ql).call(this,f.iso,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2773
|
+
${f.allDay.map(y=>s(this,v,un).call(this,y,f.iso,x,"allday",!0,{row:"a"}))}
|
|
2774
|
+
${d?.iso===f.iso&&l?.allDay?s(this,v,vm).call(this,l):h}
|
|
2765
2775
|
</div>`)}
|
|
2766
2776
|
</div>
|
|
2767
2777
|
</div>
|
|
2768
2778
|
<div class="tg-body" role="rowgroup">
|
|
2769
|
-
${
|
|
2770
|
-
<div class="axis" role="rowheader"><span>${s(this,
|
|
2771
|
-
${u.map((
|
|
2772
|
-
${
|
|
2773
|
-
aria-label=${this.t("addAt",{time:s(this,
|
|
2774
|
-
${k.map(A=>{let
|
|
2775
|
-
${
|
|
2779
|
+
${b.map(f=>c`<div class="row hr" role="row">
|
|
2780
|
+
<div class="axis" role="rowheader"><span>${s(this,v,zv).call(this,f)}</span></div>
|
|
2781
|
+
${u.map((x,y)=>{let k=x.timed.filter(A=>Math.floor(A.min/60)===f),S=l&&!l.allDay&&d?.iso===x.iso&&d.min!==void 0&&Math.floor(d.min/60)===f;return c`<div class="tcell" role="gridcell" data-i=${y} data-row=${f} data-day=${x.iso}>
|
|
2782
|
+
${p?h:c`<button type="button" class="slot item" data-k="slot:${x.iso}:${f}" data-i=${y} data-row=${f} data-day=${x.iso}
|
|
2783
|
+
aria-label=${this.t("addAt",{time:s(this,v,Gl).call(this,f*60),date:x.text})} @click=${A=>s(this,v,Ov).call(this,A,x.iso,f)}></button>`}
|
|
2784
|
+
${k.map(A=>{let q=x.lanes.get(A)??{lane:0,lanes:1},B=Math.min(A.dur,1440-A.min)/60;return s(this,v,un).call(this,A,x.iso,y,"time",!0,{row:String(f),style:`--top:${(A.min-f*60)/60};--len:${B};--lane:${q.lane};--lanes:${q.lanes}`})})}
|
|
2785
|
+
${S?s(this,v,vm).call(this,l,"time",`--top:${(d.min-f*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
2776
2786
|
</div>`})}
|
|
2777
2787
|
</div>`)}
|
|
2778
2788
|
</div>
|
|
2779
|
-
</div>`},
|
|
2789
|
+
</div>`},fn.properties={view:{reflect:!0},date:{reflect:!0},today:{},label:{string:"label"},step:{type:Number},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},hourCycle:{attribute:"hour-cycle"},dayStart:{type:Number,attribute:"day-start"},maxEvents:{type:Number,attribute:"max-events"},headingLevel:{type:Number,attribute:"heading-level"},loading:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0},_narrow:{state:!0},_more:{state:!0},_target:{state:!0}},fn.styles=[E,w`
|
|
2780
2790
|
:host { display: block; position: relative; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
2781
2791
|
:host([dragging]) { cursor: grabbing; user-select: none; -webkit-user-select: none; }
|
|
2782
2792
|
.cal { display: flex; flex-direction: column; gap: var(--cm-space-12); min-width: 0; }
|
|
@@ -2937,12 +2947,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2937
2947
|
.chip.time > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2938
2948
|
.chip.time .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
2939
2949
|
.ph.time { position: absolute; z-index: 3; inset-inline: 0 2px; inset-block-start: calc(var(--top) * var(--h)); height: calc(var(--len) * var(--h)); align-items: flex-start; }
|
|
2940
|
-
`];$("cm-calendar",
|
|
2950
|
+
`];$("cm-calendar",fn);var hM=z("reportTile",{pinned:", pinned"}),ia=class extends T{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=c`
|
|
2941
2951
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
2942
2952
|
<span class="label">${this.label}</span>
|
|
2943
2953
|
${this.pinned?c`<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
2944
2954
|
<span class="sr">${this.t("pinned")}</span></span>`:h}
|
|
2945
|
-
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};
|
|
2955
|
+
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};ia.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},ia.shadowRootOptions={...L.shadowRootOptions,delegatesFocus:!0},ia.styles=[E,w`
|
|
2946
2956
|
:host { display: block; }
|
|
2947
2957
|
.tile {
|
|
2948
2958
|
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-12);
|
|
@@ -2961,10 +2971,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2961
2971
|
.icon cm-icon::part(svg) { width: 32px; height: 32px; }
|
|
2962
2972
|
::slotted([slot='icon']) { width: 32px; height: 32px; }
|
|
2963
2973
|
}
|
|
2964
|
-
`];$("cm-report-tile",
|
|
2974
|
+
`];$("cm-report-tile",ia);var $n=class extends L{constructor(){super(...arguments);this.heading="";this.headingLevel=2}firstUpdated(){for(let e of this.querySelectorAll(":scope > cm-report-tile"))e.hasAttribute("role")||e.setAttribute("role","listitem")}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2));return c`
|
|
2965
2975
|
${this.heading?c`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:h}
|
|
2966
2976
|
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":h}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
2967
|
-
`}}
|
|
2977
|
+
`}};$n.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},$n.styles=[E,w`
|
|
2968
2978
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
2969
2979
|
.title { margin: 0 0 var(--cm-space-16); font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
2970
2980
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-12); }
|
|
@@ -2974,7 +2984,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2974
2984
|
.title { margin-bottom: var(--cm-space-8); }
|
|
2975
2985
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
2976
2986
|
}
|
|
2977
|
-
`];$("cm-report-tiles"
|
|
2987
|
+
`];$("cm-report-tiles",$n);var fM=z("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),Wv=/^\s*-?\d+(\.\d+)?\s*$/,kn=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:Wv.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">
|
|
2978
2988
|
<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>
|
|
2979
2989
|
</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`
|
|
2980
2990
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
@@ -2983,7 +2993,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2983
2993
|
${i}
|
|
2984
2994
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
2985
2995
|
</span>
|
|
2986
|
-
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,
|
|
2996
|
+
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,p=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=${p}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${p}>${l}</div>${d}`}};kn.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&Wv.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}},kn.styles=[E,w`
|
|
2987
2997
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
2988
2998
|
.tile {
|
|
2989
2999
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -3019,29 +3029,29 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3019
3029
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
3020
3030
|
}
|
|
3021
3031
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
3022
|
-
`];$("cm-metric",
|
|
3023
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,j,
|
|
3032
|
+
`];$("cm-metric",kn);var En=class extends L{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 Gv(this)}};En.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}},En.styles=w`:host { display: none !important; }`;$("cm-nav-item",En);function Gv(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=ci(o);return t.length&&(e.items=t),e}var ci=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(Gv),Qu=o=>o.value||o.href||o.label,xm=o=>!!o.current||!!o.items?.some(xm),Gi=(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},Yi=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:Qu(n),href:n.href??""}}));var MM=z("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),mc,pc,km,j,eg,wm,tg,Yv,Xv,ig,rg,Jv,ag,sg,$m,ng,Zv,Mn=class extends T{constructor(){super(...arguments);m(this,j);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;m(this,mc,new Set);m(this,pc);m(this,km,R("cm-sidenav"))}connectedCallback(){super.connectedCallback(),s(this,j,eg).call(this),g(this,pc,Gi(this,()=>s(this,j,eg).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,pc)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let i=s(this,j,wm).call(this,e,t);r(this,mc).has(i)||!e.items?.length||(r(this,mc).add(i),(e.expanded||xm(e))&&this._open.add(i))})}toggle(e,t){let i=this.navItems[e];if(!i?.items?.length)return;let a=s(this,j,wm).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`
|
|
3033
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,j,Xv)}>
|
|
3024
3034
|
<slot name="header"></slot>
|
|
3025
3035
|
<ul part="list">
|
|
3026
|
-
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,j,
|
|
3027
|
-
${s(this,j
|
|
3028
|
-
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,j,
|
|
3029
|
-
${s(this,j,
|
|
3036
|
+
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,j,ng).call(this,t,"",{index:i})}</li>`;let a=!e&&this._open.has(s(this,j,wm).call(this,t,i)),l=`${r(this,km)}-${i}`;return c`<li>
|
|
3037
|
+
${s(this,j,$m).call(this,t,c`<button type="button" class="item parent ${xm(t)?"has-current":""}" part="item" data-index=${i}
|
|
3038
|
+
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,j,Jv).call(this,i):this.toggle(i)}>
|
|
3039
|
+
${s(this,j,ag).call(this,t)}${s(this,j,sg).call(this,t)}
|
|
3030
3040
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
3031
3041
|
</button>`)}
|
|
3032
3042
|
<ul class="sub" id=${l} ?hidden=${!a} aria-label=${t.label}>
|
|
3033
|
-
${s(this,j,
|
|
3043
|
+
${s(this,j,ig).call(this,t.items).map(([d,p])=>c`<li>${s(this,j,ng).call(this,{...d,icon:void 0},p?"deep":"",{parent:i})}</li>`)}
|
|
3034
3044
|
</ul>
|
|
3035
3045
|
</li>`})}
|
|
3036
3046
|
</ul>
|
|
3037
|
-
${s(this,j
|
|
3047
|
+
${s(this,j,Zv).call(this)}
|
|
3038
3048
|
<slot name="footer"></slot>
|
|
3039
3049
|
<slot hidden></slot>
|
|
3040
3050
|
</nav>
|
|
3041
|
-
`}};
|
|
3042
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,
|
|
3043
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,
|
|
3044
|
-
@click=${()=>s(this,j,
|
|
3051
|
+
`}};mc=new WeakMap,pc=new WeakMap,km=new WeakMap,j=new WeakSet,eg=function(){this._slotted=ci(this)},wm=function(e,t){return`${t}:${Qu(e)}`},tg=function(e,t){Yi(this,t)||e.preventDefault()},Yv=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},Xv=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let i=s(this,j,Yv).call(this),a=i.indexOf(t),l=Number(t.dataset.index),d=J(e,this),p;if(e.key==="ArrowDown")p=i[(a+1)%i.length];else if(e.key==="ArrowUp")p=i[(a-1+i.length)%i.length];else if(e.key==="Home")p=i[0];else if(e.key==="End")p=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&&(p=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!p){e.preventDefault();return}}else return}e.preventDefault(),p?.focus()},ig=function(e,t=0){return e.flatMap(i=>[[i,t],...s(this,j,ig).call(this,i.items??[],t+1)])},rg=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},Jv=function(e){s(this,j,rg).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},ag=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},sg=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}`},$m=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},ng=function(e,t,i={}){let a=c`${s(this,j,ag).call(this,e)}${s(this,j,sg).call(this,e)}`;return s(this,j,$m).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
3052
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,tg).call(this,l,e)}>${a}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
3053
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,tg).call(this,l,e)}>${a}</button>`)},Zv=function(){if(!this.collapsible)return h;let e=this.t(this.collapsed?"expand":"collapse"),t=c`<cm-icon name=${this.collapsed?"chevron-right":"chevron-left"} size="20"></cm-icon>${this.collapsed?c`<span class="sr">${e}</span>`:c`<span class="label">${e}</span>`}`;return c`<div class="toggle-row">${s(this,j,$m).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
3054
|
+
@click=${()=>s(this,j,rg).call(this,!this.collapsed)}>${t}</button>`)}</div>`},Mn.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},Mn.styles=[E,w`
|
|
3045
3055
|
:host { display: block; width: var(--cm-side-navigation-width, 220px); }
|
|
3046
3056
|
nav {
|
|
3047
3057
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: var(--cm-radius-lg);
|
|
@@ -3086,7 +3096,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3086
3096
|
background: var(--cm-count-bg); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
3087
3097
|
}
|
|
3088
3098
|
.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-count-text); }
|
|
3089
|
-
`];$("cm-side-navigation",
|
|
3099
|
+
`];$("cm-side-navigation",Mn);function Qv(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 Tn=class extends L{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=Qv(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>`}};Tn.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},Tn.styles=[E,w`
|
|
3090
3100
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3091
3101
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
3092
3102
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -3099,22 +3109,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3099
3109
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
3100
3110
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
3101
3111
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
3102
|
-
`];$("cm-avatar",
|
|
3112
|
+
`];$("cm-avatar",Tn);var HM=z("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),Cn,di,Ln,ze,uc,og,zn,_n=class extends T{constructor(){super();m(this,ze);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;m(this,Cn);m(this,di,!1);m(this,Ln,null);this.addEventListener("cm-select",e=>{let t=s(this,ze,uc).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){s(this,ze,uc).call(this)?.focus();return}this._searchOpen||(g(this,Ln,wp()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),g(this,Cn,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,Cn).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Cn)?.disconnect(),r(this,di)&&(il(),g(this,di,!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,di)||(xp(),g(this,di,!0)),s(this,ze,uc).call(this)?.focus(),s(this,ze,zn).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,di)&&(il(),g(this,di,!1));let i=r(this,Ln)??this.renderRoot.querySelector(".search-btn");g(this,Ln,null),i?.isConnected&&i.focus(),s(this,ze,zn).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
3103
3113
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
3104
3114
|
<div class="logo"><slot name="logo"></slot></div>
|
|
3105
3115
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
3106
|
-
@click=${()=>s(this,
|
|
3107
|
-
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,
|
|
3116
|
+
@click=${()=>s(this,ze,zn).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="16"></cm-icon></button>`:h}
|
|
3117
|
+
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,ze,og)}></slot></div>`}
|
|
3108
3118
|
<span class="grow"></span>
|
|
3109
3119
|
<div class="end">
|
|
3110
3120
|
${this._narrow&&this._hasSearch?c`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
3111
3121
|
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:h}
|
|
3112
3122
|
<div class="actions"><slot name="actions"></slot></div>
|
|
3113
3123
|
${this.balance?c`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
3114
|
-
@click=${()=>s(this,
|
|
3124
|
+
@click=${()=>s(this,ze,zn).call(this,"cm-wallet")}>${this.balance}</button>`:h}
|
|
3115
3125
|
<slot name="end"></slot>
|
|
3116
3126
|
${this.userName?c`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
3117
|
-
@click=${()=>s(this,
|
|
3127
|
+
@click=${()=>s(this,ze,zn).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
3118
3128
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:h}
|
|
3119
3129
|
<slot name="account"></slot>
|
|
3120
3130
|
</div>
|
|
@@ -3123,11 +3133,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3123
3133
|
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
3124
3134
|
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
3125
3135
|
<div class="layer-bar">
|
|
3126
|
-
<div class="layer-search"><slot name="search" @slotchange=${s(this,
|
|
3136
|
+
<div class="layer-search"><slot name="search" @slotchange=${s(this,ze,og)}></slot></div>
|
|
3127
3137
|
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
3128
3138
|
</div>
|
|
3129
3139
|
</dialog>`:h}
|
|
3130
|
-
`}};
|
|
3140
|
+
`}};Cn=new WeakMap,di=new WeakMap,Ln=new WeakMap,ze=new WeakSet,uc=function(){return this.querySelector(':scope > [slot="search"]')},og=function(){this._hasSearch=!!s(this,ze,uc).call(this)},zn=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},_n.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}},_n.styles=[E,w`
|
|
3131
3141
|
:host {
|
|
3132
3142
|
display: block; background: var(--cm-bg-surface); container-type: inline-size;
|
|
3133
3143
|
--_h: var(--cm-control-height-md); --_touch: var(--cm-control-height-touch);
|
|
@@ -3204,10 +3214,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3204
3214
|
@media (pointer: coarse) {
|
|
3205
3215
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
3206
3216
|
}
|
|
3207
|
-
`];$("cm-header-bar",
|
|
3208
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,
|
|
3217
|
+
`];$("cm-header-bar",_n);var FM=z("bottomNavigation",{label:"Main"}),gc,ra,lg,ey,Sn=class extends T{constructor(){super(...arguments);m(this,ra);this.items=[];this.fixed=!1;this._slotted=[];m(this,gc)}connectedCallback(){super.connectedCallback(),s(this,ra,lg).call(this),g(this,gc,Gi(this,()=>s(this,ra,lg).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,gc)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3218
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,ra,ey).call(this,e)}</li>`)}</ul>
|
|
3209
3219
|
<slot hidden></slot>
|
|
3210
|
-
</nav>`}};
|
|
3220
|
+
</nav>`}};gc=new WeakMap,ra=new WeakSet,lg=function(){this._slotted=ci(this)},ey=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=>{Yi(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>`},Sn.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},Sn.styles=[E,w`
|
|
3211
3221
|
:host { display: block; }
|
|
3212
3222
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
3213
3223
|
nav {
|
|
@@ -3229,32 +3239,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3229
3239
|
.icon { display: grid; place-items: center; width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
3230
3240
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
3231
3241
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3232
|
-
`];$("cm-bottom-navigation",
|
|
3242
|
+
`];$("cm-bottom-navigation",Sn);var YM=z("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),fc,aa,He,cg,ty,dg,hg,iy,Dn=class extends T{constructor(){super(...arguments);m(this,He);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;m(this,fc);m(this,aa,R("cm-mmenu"))}connectedCallback(){super.connectedCallback(),s(this,He,cg).call(this),g(this,fc,Gi(this,()=>s(this,He,cg).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,fc)?.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,aa)}-sub"
|
|
3233
3243
|
@keydown=${i=>{i.key==="Escape"&&(i.preventDefault(),this.back())}}>
|
|
3234
3244
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
3235
3245
|
${t.label}</button>
|
|
3236
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,
|
|
3246
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,He,hg).call(this,i,0,0,!0)}</li>`)}</ul>
|
|
3237
3247
|
<slot hidden></slot>
|
|
3238
3248
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3239
|
-
${s(this,
|
|
3240
|
-
${e.map((i,a)=>{let l=`${r(this,
|
|
3249
|
+
${s(this,He,iy).call(this)}
|
|
3250
|
+
${e.map((i,a)=>{let l=`${r(this,aa)}-s${a}`;return c`<section aria-labelledby=${i.label?l:h}>
|
|
3241
3251
|
${i.label?c`<h2 class="heading" id=${l}>${i.label}</h2>`:h}
|
|
3242
|
-
<ul class="card">${(i.items??[]).map((d,
|
|
3252
|
+
<ul class="card">${(i.items??[]).map((d,p)=>c`<li>${s(this,He,hg).call(this,d,a,p)}</li>`)}</ul>
|
|
3243
3253
|
</section>`})}
|
|
3244
3254
|
<slot hidden></slot>
|
|
3245
|
-
</nav>`}};
|
|
3246
|
-
@click=${()=>s(this,
|
|
3247
|
-
<h2 class="heading" id="${r(this,
|
|
3255
|
+
</nav>`}};fc=new WeakMap,aa=new WeakMap,He=new WeakSet,cg=function(){this._slotted=ci(this)},ty=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},dg=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},hg=function(e,t,i,a=!1){let l=b=>{Yi(this,e)||b.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,p=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}"
|
|
3256
|
+
@click=${()=>s(this,He,ty).call(this,t,i)}>${d}<span class="text"><span class="label">${e.label}</span>${p}</span><cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let u=c`${d}<span class="text"><span class="label">${e.label}</span>${p}</span>${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>`},iy=function(){if(!this.store&&!this.userName)return h;let e=this.userName.trim().charAt(0).toUpperCase();return c`<section aria-labelledby="${r(this,aa)}-profile">
|
|
3257
|
+
<h2 class="heading" id="${r(this,aa)}-profile">${this.t("profile")}</h2>
|
|
3248
3258
|
<ul class="card">
|
|
3249
|
-
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,
|
|
3259
|
+
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,He,dg).call(this,"cm-store-switch")}>
|
|
3250
3260
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
3251
3261
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3252
|
-
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,
|
|
3262
|
+
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,He,dg).call(this,"cm-account")}>
|
|
3253
3263
|
<span class="avatar">${this.avatarSrc?c`<img src=${this.avatarSrc} alt="">`:c`<span aria-hidden="true">${e}</span>`}</span>
|
|
3254
3264
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?c`<span class="email">${this.userEmail}</span>`:h}</span>
|
|
3255
3265
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3256
3266
|
</ul>
|
|
3257
|
-
</section>`},
|
|
3267
|
+
</section>`},Dn.properties={items:{type:Array},store:{},userName:{attribute:"user-name"},userEmail:{attribute:"user-email"},avatarSrc:{attribute:"avatar-src"},label:{string:"label"},_slotted:{state:!0},_page:{state:!0}},Dn.styles=[E,w`
|
|
3258
3268
|
:host { display: block; background: var(--cm-bg-page); }
|
|
3259
3269
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
3260
3270
|
.heading {
|
|
@@ -3295,12 +3305,12 @@ ${t.label}</button>
|
|
|
3295
3305
|
}
|
|
3296
3306
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3297
3307
|
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3298
|
-
`];$("cm-mobile-menu",
|
|
3308
|
+
`];$("cm-mobile-menu",Dn);var t2=z("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),Em,ry,An=class extends T{constructor(){super(...arguments);m(this,Em);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
3299
3309
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
3300
3310
|
<span class="text"><slot></slot></span>
|
|
3301
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,
|
|
3311
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,Em,ry)}><cm-icon name="close" size="16"></cm-icon>
|
|
3302
3312
|
</button>`:h}
|
|
3303
|
-
</div>`}};
|
|
3313
|
+
</div>`}};Em=new WeakSet,ry=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},An.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},An.styles=[E,w`
|
|
3304
3314
|
:host { display: block; }
|
|
3305
3315
|
.bar {
|
|
3306
3316
|
position: relative; display: flex; align-items: center; justify-content: center; gap: var(--cm-space-8); min-height: 48px;
|
|
@@ -3322,11 +3332,11 @@ ${t.label}</button>
|
|
|
3322
3332
|
@media (max-width: 640px) {
|
|
3323
3333
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
3324
3334
|
}
|
|
3325
|
-
`];$("cm-flash-offer-bar",
|
|
3335
|
+
`];$("cm-flash-offer-bar",An);var l2=z("linkTabs",{label:"Sections"}),bc,vc,mg,Rn=class extends T{constructor(){super(...arguments);m(this,vc);this.items=[];this._slotted=[];m(this,bc)}connectedCallback(){super.connectedCallback(),s(this,vc,mg).call(this),g(this,bc,Gi(this,()=>s(this,vc,mg).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,bc)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3326
3336
|
<ul part="tabs">${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3327
|
-
@click=${t=>{
|
|
3337
|
+
@click=${t=>{Yi(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
3328
3338
|
<slot hidden></slot>
|
|
3329
|
-
</nav>`}};
|
|
3339
|
+
</nav>`}};bc=new WeakMap,vc=new WeakSet,mg=function(){this._slotted=ci(this)},Rn.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0}},Rn.styles=[E,w`
|
|
3330
3340
|
:host { display: block; }
|
|
3331
3341
|
ul {
|
|
3332
3342
|
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
@@ -3345,7 +3355,7 @@ ${t.label}</button>
|
|
|
3345
3355
|
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
3346
3356
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
3347
3357
|
|
|
3348
|
-
`];$("cm-link-tabs",
|
|
3358
|
+
`];$("cm-link-tabs",Rn);var u2=z("appCard",{developer:"By {developer}",rating:"Rated {rating} out of 5",reviews:{one:"{count} Review",other:"{count} Reviews"},offer:"Offer: ",details:"View Details",detailsLabel:"View details of {name}"}),Hn=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">
|
|
3349
3359
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
3350
3360
|
<div class="status"><slot name="status"></slot></div>
|
|
3351
3361
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
@@ -3357,7 +3367,7 @@ ${t.label}</button>
|
|
|
3357
3367
|
${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}
|
|
3358
3368
|
<div class="actions"><slot name="actions"></slot>${this.href?c`<a class="details" part="details" href=${this.href}
|
|
3359
3369
|
aria-label=${this.t("detailsLabel",{name:this.name})}>${this.t("details")}</a>`:h}</div>
|
|
3360
|
-
</article>`}};
|
|
3370
|
+
</article>`}};Hn.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},Hn.styles=[E,w`
|
|
3361
3371
|
:host { display: block; container-type: inline-size; }
|
|
3362
3372
|
article {
|
|
3363
3373
|
position: relative; display: flex; flex-direction: column; gap: var(--cm-space-8); height: 100%; padding: var(--cm-space-20);
|
|
@@ -3394,21 +3404,21 @@ ${t.label}</button>
|
|
|
3394
3404
|
.actions { gap: var(--cm-space-8); }
|
|
3395
3405
|
.details { margin-inline-start: auto; }
|
|
3396
3406
|
}
|
|
3397
|
-
`];$("cm-app-card",
|
|
3407
|
+
`];$("cm-app-card",Hn);var Mm,ay,Nn=class extends ie{constructor(){super(...arguments);m(this,Mm);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">
|
|
3398
3408
|
${this.renderHeader()}
|
|
3399
3409
|
<div class="body" part="body"><slot></slot></div>
|
|
3400
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,
|
|
3401
|
-
</div>`)}};
|
|
3410
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,Mm,ay)}></slot></footer>
|
|
3411
|
+
</div>`)}};Mm=new WeakSet,ay=function(e){this._hasFooter=e.target.assignedElements().length>0},Nn.properties={...ie.properties,size:{reflect:!0},_hasFooter:{state:!0}},Nn.styles=[...ie.overlayStyles,w`
|
|
3402
3412
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
3403
3413
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
3404
3414
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
3405
3415
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
3406
3416
|
|
|
3407
|
-
`];$("cm-modal",
|
|
3417
|
+
`];$("cm-modal",Nn);var Tm,sy,At=class extends ie{constructor(){super(...arguments);m(this,Tm);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,Tm,sy)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3408
3418
|
${this.renderHeader()}
|
|
3409
3419
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
3410
3420
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
3411
|
-
</div>`)}};
|
|
3421
|
+
</div>`)}};Tm=new WeakSet,sy=function(e){this._hasFooter=e.target.assignedElements().length>0},At.properties={...ie.properties,size:{reflect:!0},_hasFooter:{state:!0}},At.styles=[...ie.overlayStyles,w`
|
|
3412
3422
|
dialog {
|
|
3413
3423
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
3414
3424
|
}
|
|
@@ -3426,23 +3436,23 @@ ${t.label}</button>
|
|
|
3426
3436
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
3427
3437
|
|
|
3428
3438
|
}
|
|
3429
|
-
`];$("cm-side-panel",
|
|
3439
|
+
`];$("cm-side-panel",At);var L2=z("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),Pn,zm,In=class extends At{constructor(){super(...arguments);this.search=!1;this.query="";m(this,Pn,()=>{this.dispatchEvent(new CustomEvent("cm-filter-apply",{detail:{values:this.values,query:this.query},bubbles:!0,composed:!0,cancelable:!0}))&&this.requestClose("action")});m(this,zm,()=>{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}
|
|
3430
3440
|
placeholder=${this.searchPlaceholder}
|
|
3431
3441
|
@input=${e=>{this.query=e.target.value}}
|
|
3432
|
-
@cm-search=${e=>{e.stopPropagation(),r(this,
|
|
3433
|
-
<slot @submit=${e=>{e.preventDefault(),r(this,
|
|
3434
|
-
<cm-button part="apply" variant="primary" @click=${r(this,
|
|
3442
|
+
@cm-search=${e=>{e.stopPropagation(),r(this,Pn).call(this)}}></cm-search>`:h}
|
|
3443
|
+
<slot @submit=${e=>{e.preventDefault(),r(this,Pn).call(this)}}></slot>`}renderFooter(){return c`<cm-button part="reset" @click=${r(this,zm)}>${this.resetLabel}</cm-button>
|
|
3444
|
+
<cm-button part="apply" variant="primary" @click=${r(this,Pn)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};Pn=new WeakMap,zm=new WeakMap,In.properties={...At.properties,search:{type:Boolean},query:{},heading:{string:"heading"},searchLabel:{attribute:"search-label",string:"searchLabel"},searchPlaceholder:{attribute:"search-placeholder",string:"searchPlaceholder"},applyLabel:{attribute:"apply-label",string:"apply"},resetLabel:{attribute:"reset-label",string:"reset"}},In.styles=[...At.styles,w`
|
|
3435
3445
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
3436
3446
|
.foot { justify-content: center; }
|
|
3437
3447
|
::slotted(form) { display: grid; gap: var(--cm-space-12); }
|
|
3438
|
-
`];$("cm-filter-panel",
|
|
3448
|
+
`];$("cm-filter-panel",In);var I2=z("accountMenu",{trigger:"Account: {name}"}),qn=class extends kt{constructor(){super();this.name="";this.avatarSrc="";this.meta="";this.profileHref="";this.orgName="";this.orgMeta="";this.orgHref="";this.plan="";this.align="end"}triggerTemplate(e,t){return c`<button type="button" class="trigger account" part="trigger" aria-haspopup="menu" aria-expanded=${String(this.open)}
|
|
3439
3449
|
aria-label=${this.t("trigger",{name:this.name})} ?disabled=${this.disabled} @click=${e} @keydown=${t}>
|
|
3440
|
-
<cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></button>`}headTemplate(){let e=(t,i,a,l,d)=>{let
|
|
3450
|
+
<cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></button>`}headTemplate(){let e=(t,i,a,l,d)=>{let p=c`${a}<span class="who"><strong>${l}</strong>${d?c`<span>${d}</span>`:h}</span>${t?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return t?c`<a class="row" part=${i} href=${t}>${p}</a>`:c`<div class="row" part=${i}>${p}</div>`};return c`<div class="acct">
|
|
3441
3451
|
${e(this.profileHref,"profile",c`<span class="ring"><cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></span>`,this.name,this.meta)}
|
|
3442
3452
|
${this.orgName?c`<div class="split"></div>
|
|
3443
3453
|
${e(this.orgHref,"org",c`<span class="logo"><slot name="org-logo"><cm-icon name="store" size="20"></cm-icon></slot></span>`,this.orgName,this.orgMeta)}
|
|
3444
3454
|
${this.plan?c`<div class="plan"><cm-icon name="check-circle" size="16"></cm-icon>${this.plan}</div>`:h}`:h}
|
|
3445
|
-
</div>`}};
|
|
3455
|
+
</div>`}};qn.properties={...kt.properties,name:{},avatarSrc:{attribute:"avatar-src"},meta:{},profileHref:{attribute:"profile-href"},orgName:{attribute:"org-name"},orgMeta:{attribute:"org-meta"},orgHref:{attribute:"org-href"},plan:{}},qn.styles=[...kt.styles,w`
|
|
3446
3456
|
/* The avatar button: 36px round with a ring (40 and a 44px hit area on touch screens). */
|
|
3447
3457
|
.trigger.account {
|
|
3448
3458
|
position: relative; width: var(--cm-control-height-md, 36px); height: var(--cm-control-height-md, 36px); min-height: 0; padding: 2px;
|
|
@@ -3475,8 +3485,8 @@ ${t.label}</button>
|
|
|
3475
3485
|
.plan cm-icon { color: var(--cm-text-success); }
|
|
3476
3486
|
.split { height: 0; margin: var(--cm-space-4) var(--cm-space-12); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
3477
3487
|
:host(:dir(rtl)) .chev { transform: scaleX(-1); }
|
|
3478
|
-
`];$("cm-account-menu",
|
|
3479
|
-
<line class="base" x1="0" y1=${a} x2=${i} y2=${a}></line>${
|
|
3488
|
+
`];$("cm-account-menu",qn);var F2=z("sparkline",{summary:"{label}: {total} in all, peak {peak}, latest {latest}",summaryAt:"{label}: {total} in all, peak {peak} on {when}, latest {latest}",empty:"{label}: no data"}),Ex=o=>{if(!o)return[];let n=o.trim(),e=[];if(n.startsWith("["))try{e=JSON.parse(n)}catch{e=[]}else e=n.split(",");return e.map(t=>{let i=Number(t);return Number.isFinite(i)?i:0})},Mx=o=>{if(!o)return[];let n=o.trim();if(n.startsWith("["))try{return JSON.parse(n).map(String)}catch{return[]}return n.split(",").map(e=>e.trim())},On=class extends T{constructor(){super(...arguments);this.values=[];this.labels=[];this.label="";this.type="bars";this.tone="neutral"}get summary(){let e=this.values??[],t=this.label||"";if(!e.length)return this.t("empty",{label:t});let i=e.reduce((u,b)=>u+b,0),a=Math.max(...e),l=e.indexOf(a),d={label:t,total:this.formatNumber(i),peak:this.formatNumber(a),latest:this.formatNumber(e[e.length-1])},p=this.labels?.[l];return p?this.t("summaryAt",{...d,when:p}):this.t("summary",d)}render(){let e=this.values??[],t=e.length,i=100,a=32,l=2,d=Math.max(1,...e.map(f=>Math.max(0,f))),p=f=>a-Math.max(0,f)/d*(a-l),u=f=>this.labels?.[f]?`${this.labels[f]}: ${this.formatNumber(e[f])}`:"",b=h;if(t&&this.type==="line"){let f=t>1?i/(t-1):0,x=e.map((k,S)=>`${(t>1?S*f:i/2).toFixed(2)},${p(k).toFixed(2)}`).join(" "),y=x.split(" ").pop().split(",");b=It`<polyline class="line" points=${x}></polyline><line class="dot" x1=${y[0]} y1=${y[1]} x2=${y[0]} y2=${y[1]}></line>`}else if(t){let f=i/t,x=t>1?Math.min(f*.25,2):0,y=f-x;b=e.map((k,S)=>{let A=Math.max(k>0?1.5:0,a-p(k)),q=u(S);return It`<rect class=${S===t-1?"bar last":"bar"} x=${(S*f+x/2).toFixed(2)} y=${(a-A).toFixed(2)} width=${y.toFixed(2)} height=${A.toFixed(2)} rx="0.6">${q?It`<title>${q}</title>`:h}</rect>`})}return c`<svg part="chart" role="img" aria-label=${this.summary} viewBox="0 0 ${i} ${a}" preserveAspectRatio="none">
|
|
3489
|
+
<line class="base" x1="0" y1=${a} x2=${i} y2=${a}></line>${b}</svg>`}};On.properties={values:{converter:{fromAttribute:Ex}},labels:{converter:{fromAttribute:Mx}},label:{},type:{reflect:!0},tone:{reflect:!0}},On.styles=[E,w`
|
|
3480
3490
|
:host { display: block; width: 100%; max-width: var(--cm-sparkline-width, none); height: var(--cm-sparkline-height, 32px); color: var(--cm-icon-default); }
|
|
3481
3491
|
:host([tone='information']) { color: var(--cm-text-information); }
|
|
3482
3492
|
:host([tone='success']) { color: var(--cm-text-success); }
|
|
@@ -3489,17 +3499,17 @@ ${t.label}</button>
|
|
|
3489
3499
|
.line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3490
3500
|
.dot { stroke: var(--cm-text-default); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3491
3501
|
:host([tone='information']) .dot, :host([tone='success']) .dot { stroke: currentColor; }
|
|
3492
|
-
`];$("cm-sparkline",
|
|
3502
|
+
`];$("cm-sparkline",On);var yc,sa,pg,ny,Bn=class extends ie{constructor(){super(...arguments);m(this,sa);this.heading="";this.items=[];this._slotted=[];m(this,yc)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=Eo(this),g(this,yc,rd(this,()=>{this._slotted=Eo(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,yc)?.disconnect()}render(){let e=this.sheetItems.filter(i=>!i.divider&&!i.heading),t=e.some(i=>i.icon);return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3493
3503
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
3494
3504
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
3495
3505
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
3496
3506
|
<div class="content">
|
|
3497
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,
|
|
3507
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,sa,ny).call(this,i)}</li>`)}</ul>`:h}
|
|
3498
3508
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
3499
3509
|
</div>
|
|
3500
|
-
</div>`)}};
|
|
3501
|
-
`: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,
|
|
3502
|
-
@click=${a=>s(this,
|
|
3510
|
+
</div>`)}};yc=new WeakMap,sa=new WeakSet,pg=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")},ny=function(e){let t=`row${e.critical?" critical":""}`,i=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
3511
|
+
`: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,sa,pg).call(this,a,e)}>${i}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
3512
|
+
@click=${a=>s(this,sa,pg).call(this,a,e)}>${i}</button>`},Bn.properties={...ie.properties,items:{type:Array},_slotted:{state:!0}},Bn.styles=[...ie.overlayStyles,w`
|
|
3503
3513
|
dialog {
|
|
3504
3514
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: var(--cm-space-24);
|
|
3505
3515
|
}
|
|
@@ -3533,17 +3543,17 @@ ${t.label}</button>
|
|
|
3533
3543
|
}
|
|
3534
3544
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
3535
3545
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3536
|
-
`];$("cm-bottom-sheet"
|
|
3537
|
-
<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,
|
|
3546
|
+
`];$("cm-bottom-sheet",Bn);var eT=z("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),Tx={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},Fn=class extends L{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};Fn.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},Fn.styles=w`:host { display: none; }`;$("cm-notification-item",Fn);var Vn,Be,ug,gg,oy,ly,cy,jn=class extends ie{constructor(){super(...arguments);m(this,Be);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;m(this,Vn)}connectedCallback(){super.connectedCallback(),s(this,Be,ug).call(this),g(this,Vn,new MutationObserver(()=>s(this,Be,ug).call(this))),r(this,Vn).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Vn)?.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,Be,ly)}>${this.markAllLabel}</button>`:h,i=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
3547
|
+
<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,Be,oy).call(this,a)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3538
3548
|
${this.renderHeader(t)}
|
|
3539
3549
|
${i}
|
|
3540
3550
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3541
3551
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
3542
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,
|
|
3552
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,Be,cy)}></slot></div>
|
|
3543
3553
|
<slot hidden></slot>
|
|
3544
|
-
</div>`)}};
|
|
3554
|
+
</div>`)}};Vn=new WeakMap,Be=new WeakSet,ug=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")}})},gg=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")},oy=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||Tx[t]||"bell"} size="14"></cm-icon></span>
|
|
3545
3555
|
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${i}</span>
|
|
3546
|
-
${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,
|
|
3556
|
+
${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,Be,gg).call(this,d,e)}>${a}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>s(this,Be,gg).call(this,d,e)}>${a}</button>`},ly=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()},cy=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},jn.properties={...ie.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}},jn.styles=[...ie.overlayStyles,w`
|
|
3547
3557
|
dialog {
|
|
3548
3558
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
3549
3559
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3593,15 +3603,15 @@ ${t.label}</button>
|
|
|
3593
3603
|
@media (max-width: 599px) {
|
|
3594
3604
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3595
3605
|
}
|
|
3596
|
-
`];$("cm-notification-panel",
|
|
3606
|
+
`];$("cm-notification-panel",jn);var nT=z("toastRegion",{label:"Notifications"}),oT=z("toast",{undo:"Undo",shortcut:"Press F6 to reach it."}),dy=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o&&o!==document.body?o:null},fg=(o,n)=>{for(let e=n;e;e=e.parentNode??e.host??null)if(e===o)return!0;return!1},zx=2e3,hy=1e4,my=150,xc,wt,hi,wc,Gn,Yn,na,Xi,oa,fe,_m,py,Un,bg,$c,kc,Ec,Mc,uy,Kn=class extends T{constructor(){super(...arguments);m(this,fe);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;m(this,xc);m(this,wt);m(this,hi,0);m(this,wc,0);m(this,Gn,!1);m(this,Yn,!1);m(this,na);m(this,Xi);m(this,oa);m(this,$c,()=>{g(this,Gn,!0),s(this,fe,bg).call(this)});m(this,kc,()=>{g(this,Gn,!1),s(this,fe,Un).call(this)});m(this,Ec,()=>{g(this,Yn,!0),s(this,fe,bg).call(this)});m(this,Mc,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(g(this,Yn,!1),s(this,fe,Un).call(this))})}get closed(){if(!r(this,na)){if(!this.open&&r(this,oa))return Promise.resolve(r(this,oa));g(this,na,new Promise(e=>{g(this,Xi,e)}))}return r(this,na)}get effectiveDuration(){let e=this.duration??(this.actionLabel?hy:5e3);return Math.min(hy,Math.max(zx,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&g(this,xc,setTimeout(()=>{this._primed=!0},my)),this.addEventListener("pointerenter",r(this,$c)),this.addEventListener("pointerleave",r(this,kc)),this.addEventListener("focusin",r(this,Ec)),this.addEventListener("focusout",r(this,Mc))}disconnectedCallback(){super.disconnectedCallback(),this.open&&r(this,Xi)&&queueMicrotask(()=>{!this.isConnected&&this.open&&s(this,fe,_m).call(this,"removed")}),clearTimeout(r(this,wt)),clearTimeout(r(this,xc)),this.removeEventListener("pointerenter",r(this,$c)),this.removeEventListener("pointerleave",r(this,kc)),this.removeEventListener("focusin",r(this,Ec)),this.removeEventListener("focusout",r(this,Mc))}updated(e){e.has("open")&&e.get("open")!==void 0&&(this.open?g(this,oa,void 0):r(this,Xi)&&s(this,fe,_m).call(this,"close")),(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,wt)),this.open&&(this._inRegion||this._primed)&&(g(this,hi,this.effectiveDuration),s(this,fe,Un).call(this)))}show(){this.open?(g(this,hi,this.effectiveDuration),s(this,fe,Un).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,wt)),this.open=!1,s(this,fe,_m).call(this,e),!0):(e==="timeout"&&(g(this,hi,this.effectiveDuration),s(this,fe,Un).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3597
3607
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3598
3608
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3599
|
-
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,
|
|
3609
|
+
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,fe,uy)}>${this.actionLabel}</button>`:h}
|
|
3600
3610
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3601
3611
|
<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>
|
|
3602
3612
|
</button>
|
|
3603
3613
|
${this.actionLabel&&this._inRegion&&this.t("shortcut")?c`<span class="hint">${this.t("shortcut")}</span>`:h}
|
|
3604
|
-
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};
|
|
3614
|
+
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};xc=new WeakMap,wt=new WeakMap,hi=new WeakMap,wc=new WeakMap,Gn=new WeakMap,Yn=new WeakMap,na=new WeakMap,Xi=new WeakMap,oa=new WeakMap,fe=new WeakSet,_m=function(e){g(this,oa,e);let t=r(this,Xi);g(this,na,g(this,Xi,void 0)),t?.(e)},py=function(){return r(this,Gn)||r(this,Yn)},Un=function(){clearTimeout(r(this,wt)),!(!this.open||r(this,fe,py))&&(g(this,wc,Date.now()),g(this,wt,setTimeout(()=>this.dismiss("timeout"),r(this,hi))))},bg=function(){r(this,wt)!==void 0&&(clearTimeout(r(this,wt)),g(this,wt,void 0),g(this,hi,Math.max(1e3,r(this,hi)-(Date.now()-r(this,wc)))))},$c=new WeakMap,kc=new WeakMap,Ec=new WeakMap,Mc=new WeakMap,uy=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},Kn.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},Kn.styles=[E,w`
|
|
3605
3615
|
:host { display: block; pointer-events: auto; }
|
|
3606
3616
|
:host(:not([open])) { display: none; }
|
|
3607
3617
|
.toast {
|
|
@@ -3633,13 +3643,13 @@ ${t.label}</button>
|
|
|
3633
3643
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
3634
3644
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
3635
3645
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
3636
|
-
`];$("cm-toast",
|
|
3646
|
+
`];$("cm-toast",Kn);var la,Tc,zc,_c,Cc,Lc,Xn,Cm,Wn=class extends T{constructor(){super(...arguments);m(this,Xn);this.max=3;m(this,la,null);m(this,Tc,!1);m(this,zc,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let i=t.matches(":focus-within");t.remove(),i&&s(this,Xn,Cm).call(this)})});m(this,_c,e=>{let t=e.relatedTarget;t&&!fg(this,t)&&g(this,la,t)});m(this,Cc,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(i=>i.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});m(this,Lc,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?s(this,Xn,Cm).call(this):this.focusToast())&&e.preventDefault()})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),g(this,Tc,!0)),this.addEventListener("cm-dismiss",r(this,zc)),this.addEventListener("focusin",r(this,_c)),this.addEventListener("keydown",r(this,Cc)),document.addEventListener("keydown",r(this,Lc))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,zc)),this.removeEventListener("focusin",r(this,_c)),this.removeEventListener("keydown",r(this,Cc)),document.removeEventListener("keydown",r(this,Lc))}updated(){r(this,Tc)&&this.setAttribute("aria-label",this.t("label"))}focusToast(){let e=[...this.querySelectorAll(":scope > cm-toast[open]")].reverse(),t=e.find(l=>l.actionLabel)??e[0],i=t?.shadowRoot?.querySelector(".action")??t?.shadowRoot?.querySelector(".close");if(!i)return!1;let a=dy();return a&&!fg(this,a)&&g(this,la,a),i.focus(),!0}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")],i=t.slice(0,Math.max(0,t.length-Math.max(1,this.max))),a=i.some(l=>l.matches(":focus-within"));return i.forEach(l=>l.remove()),a&&s(this,Xn,Cm).call(this),e}render(){return c`<slot></slot>`}};la=new WeakMap,Tc=new WeakMap,zc=new WeakMap,_c=new WeakMap,Cc=new WeakMap,Lc=new WeakMap,Xn=new WeakSet,Cm=function(){let e=r(this,la);return g(this,la,null),e?.isConnected?(e.focus(),fg(e,dy())||e.shadowRoot?.querySelector("button, a[href], input, select, textarea, [tabindex]")?.focus(),!0):!1},Wn.properties={max:{type:Number}},Wn.styles=[E,w`
|
|
3637
3647
|
:host {
|
|
3638
3648
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
3639
3649
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
3640
3650
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
3641
3651
|
}
|
|
3642
|
-
`];$("cm-toast-region",
|
|
3652
|
+
`];$("cm-toast-region",Wn);function gy(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),my),a}return t.add(a)}async function _x(o,n,e){await o();let{message:t,undoLabel:i,...a}=e,l=i??Zc("toast","undo",void 0,a.root??document.body),d=await gy(t,{...a,action:{label:l,onAction:()=>{}}}).closed;return d==="action"&&await n(),d}var pT=z("progressBar",{inProgress:"In progress"}),Lm,Jn=class extends T{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";m(this,Lm,R("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,Lm)}-label`;return c`
|
|
3643
3653
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
3644
3654
|
<span id=${t} part="label">${this.label}</span>
|
|
3645
3655
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -3649,7 +3659,7 @@ ${t.label}</button>
|
|
|
3649
3659
|
aria-valuenow=${e===null?h:Math.round(e)}
|
|
3650
3660
|
aria-valuetext=${e===null?this.t("inProgress"):this.formatNumber(Math.round(e)/100,{style:"percent"})}>
|
|
3651
3661
|
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
3652
|
-
</div>`}};
|
|
3662
|
+
</div>`}};Lm=new WeakMap,Jn.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},Jn.styles=[E,w`
|
|
3653
3663
|
:host { display: block; }
|
|
3654
3664
|
.head { display: flex; justify-content: space-between; gap: var(--cm-space-8); margin-block-end: var(--cm-space-8); font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3655
3665
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
@@ -3667,7 +3677,7 @@ ${t.label}</button>
|
|
|
3667
3677
|
.fill { transition: none; }
|
|
3668
3678
|
.indeterminate .fill { animation-duration: 4s; }
|
|
3669
3679
|
}
|
|
3670
|
-
`];$("cm-progress-bar",
|
|
3680
|
+
`];$("cm-progress-bar",Jn);var Zn=class extends L{constructor(){super(...arguments);this.tone="neutral"}render(){return c`<span part="badge"><slot></slot></span>`}};Zn.properties={tone:{reflect:!0}},Zn.styles=[E,w`
|
|
3671
3681
|
:host { display: inline-flex; vertical-align: middle; }
|
|
3672
3682
|
span {
|
|
3673
3683
|
display: inline-flex; align-items: center; box-sizing: border-box; height: 24px; padding: 0 var(--cm-space-8); white-space: nowrap;
|
|
@@ -3684,12 +3694,12 @@ ${t.label}</button>
|
|
|
3684
3694
|
: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); }
|
|
3685
3695
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
3686
3696
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
3687
|
-
`];$("cm-badge",
|
|
3697
|
+
`];$("cm-badge",Zn);var eo,to,$t,fy,by,Sc,vy,Sm,vg,Qn=class extends L{constructor(){super(...arguments);m(this,$t);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;this.variant="standard";this.href="";this.target="";this.selected=!1;this.label="";m(this,eo,!1);m(this,to,!1);m(this,Sc,!1);m(this,Sm,()=>{this.href||this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))})}willUpdate(){this.selected&&g(this,Sc,!0)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=r(this,$t,vy),i=t?s(this,$t,vg).call(this,this.heading):this.heading,a=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${i}</span><span class="adornment" ?hidden=${!r(this,eo)}><slot name="title-adornment" @slotchange=${s(this,$t,fy)}></slot></span></div>`:h;return c`<section part="card" aria-label=${!t&&this.heading||h}>${t&&!this.heading?s(this,$t,vg).call(this,h):h}
|
|
3688
3698
|
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${a}${this.description?c`<p class="desc">${this.description}</p>`:h}</div>
|
|
3689
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,
|
|
3699
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,to)}><div class="actions"><slot name="actions" @slotchange=${s(this,$t,by)}></slot></div></div>`}
|
|
3690
3700
|
<slot></slot>
|
|
3691
|
-
</section>`}};
|
|
3692
|
-
aria-current=${this.selected?"true":h} aria-label=${i}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":r(this,
|
|
3701
|
+
</section>`}};eo=new WeakMap,to=new WeakMap,$t=new WeakSet,fy=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,eo)&&(g(this,eo,t),this.requestUpdate())},by=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,to)&&(g(this,to,t),this.requestUpdate())},Sc=new WeakMap,vy=function(){return String(this.variant||"").split(/\s+/).includes("interactive")},Sm=new WeakMap,vg=function(e){let t=e===h?"hit cover":"hit",i=e===h?this.label||h:h;return this.href?c`<a class=${t} part="control" href=${this.href} target=${this.target||h} rel=${this.target==="_blank"?"noopener noreferrer":h}
|
|
3702
|
+
aria-current=${this.selected?"true":h} aria-label=${i}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":r(this,Sc)?"false":h} aria-label=${i} @click=${r(this,Sm)}>${e}</button>`},Qn.properties={heading:{},description:{},flush:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},href:{},target:{},selected:{type:Boolean,reflect:!0},label:{}},Qn.styles=[E,w`
|
|
3693
3703
|
/* Owner standard (1.6): 24px padding and a 16px gap under the header; compact 16px and 12px; 16px on phones. */
|
|
3694
3704
|
:host { display: block; --_pad: var(--cm-space-24); --_gap: var(--cm-space-16); }
|
|
3695
3705
|
:host([variant~='compact']) { --_pad: var(--cm-space-16); --_gap: var(--cm-space-12); }
|
|
@@ -3741,8 +3751,8 @@ ${t.label}</button>
|
|
|
3741
3751
|
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
|
|
3742
3752
|
.bare[hidden] { display: none; }
|
|
3743
3753
|
:host([flush]) .bare { padding: var(--_pad) var(--_pad) 0; margin-bottom: var(--cm-space-8); }
|
|
3744
|
-
`];$("cm-card",
|
|
3745
|
-
`))}var
|
|
3754
|
+
`];$("cm-card",Qn);var Cx=["0","4","8","12","16","20","24","32","40","48","64"],Lx={10:"8",15:"16",22:"24",30:"32"};function io(o,n){let e=(t,i)=>`:host([${o}='${t}']) { ${n}: ${i==="0"?"0px":`var(--cm-space-${i})`}; }`;return Oc([...Cx.map(t=>e(t,t)),...Object.entries(Lx).map(([t,i])=>e(t,i))].join(`
|
|
3755
|
+
`))}var ro=class extends L{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return c`<slot></slot>`}};ro.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},ro.styles=[E,w`
|
|
3746
3756
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
3747
3757
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
3748
3758
|
:host([wrap]) { flex-wrap: wrap; }
|
|
@@ -3755,13 +3765,13 @@ ${t.label}</button>
|
|
|
3755
3765
|
:host([justify='center']) { justify-content: center; }
|
|
3756
3766
|
:host([justify='end']) { justify-content: flex-end; }
|
|
3757
3767
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
3758
|
-
`,
|
|
3768
|
+
`,io("gap","gap")];$("cm-stack",ro);var yy="important",Sx=" !"+yy,xy=_a(class extends gi{constructor(o){if(super(o),o.type!==gt.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(Sx);t.includes("-")||a?e.setProperty(t,a?i.slice(0,-11):i,a?yy:""):e[t]=i}}return ke}});var ao=class extends L{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=${xy({gridTemplateColumns:i})}><slot></slot></div>`}};ao.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},ao.styles=[E,w`
|
|
3759
3769
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
3760
3770
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
3761
3771
|
@container cm-grid (max-width: 640px) {
|
|
3762
3772
|
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
3763
3773
|
}
|
|
3764
|
-
`,
|
|
3774
|
+
`,io("gap","--_gap")];$("cm-grid",ao);var Rm,ca,da,Ac,he,Dm,yg,Dc,Am,xg,so=class extends L{constructor(){super(...arguments);m(this,he);this.gap="24";this.variant="default";this.asidePosition="above";this.stickyAside=!1;m(this,Rm,this.attachInternals());m(this,ca);m(this,da,[]);m(this,Ac,()=>s(this,he,Am).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,he,yg).call(this)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&s(this,he,Dc).call(this)}updated(e){(e.has("stickyAside")||e.has("variant"))&&s(this,he,Dc).call(this)}get asideSticks(){let e=s(this,he,Dm).call(this)[0];return!!e&&getComputedStyle(e).position==="sticky"}render(){return c`<div class="layout" part="layout"><slot @slotchange=${()=>{this.stickyAside&&s(this,he,Dc).call(this)}}></slot></div>`}};Rm=new WeakMap,ca=new WeakMap,da=new WeakMap,Ac=new WeakMap,he=new WeakSet,Dm=function(){return[...this.children].filter(e=>e.getAttribute("variant")==="aside")},yg=function(){r(this,ca)?.disconnect(),g(this,ca,void 0),g(this,da,[]),window.removeEventListener("resize",r(this,Ac)),s(this,he,xg).call(this,!1)},Dc=function(){s(this,he,yg).call(this),!(!this.stickyAside||this.variant!=="record"||!this.isConnected)&&(g(this,ca,new ResizeObserver(()=>s(this,he,Am).call(this))),g(this,da,[this,...s(this,he,Dm).call(this)]),r(this,da).forEach(e=>r(this,ca).observe(e)),window.addEventListener("resize",r(this,Ac)),s(this,he,Am).call(this))},Am=function(){let e=s(this,he,Dm).call(this);if(e.some(i=>!r(this,da).includes(i))){s(this,he,Dc).call(this);return}let t=e.length>0&&e.every(i=>{let a=parseFloat(getComputedStyle(i).insetBlockStart)||0;return i.getBoundingClientRect().height+a<=window.innerHeight});s(this,he,xg).call(this,t)},xg=function(e){let t=r(this,Rm).states;if(t)try{e?t.add("aside-fits"):t.delete("aside-fits")}catch{}},so.properties={gap:{reflect:!0},variant:{reflect:!0},asidePosition:{attribute:"aside-position",reflect:!0},stickyAside:{type:Boolean,attribute:"sticky-aside",reflect:!0}},so.styles=[E,w`
|
|
3765
3775
|
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-24); }
|
|
3766
3776
|
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
3767
3777
|
@container cm-layout (max-width: 767px) {
|
|
@@ -3805,9 +3815,9 @@ ${t.label}</button>
|
|
|
3805
3815
|
/* Read back by #measure(); only takes effect once the aside is sticky. --_header: cm-app-frame's header height. */
|
|
3806
3816
|
inset-block-start: var(--cm-layout-sticky-top, calc(var(--_header, 0px) + var(--cm-space-24)));
|
|
3807
3817
|
}
|
|
3808
|
-
`,
|
|
3818
|
+
`,io("gap","--_gap")];var no=class extends L{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};no.properties={variant:{reflect:!0}},no.styles=[E,w`
|
|
3809
3819
|
:host { display: flex; flex-direction: column; gap: var(--_cm-section-gap, var(--cm-space-24)); min-inline-size: 0; }
|
|
3810
|
-
`];$("cm-layout",
|
|
3820
|
+
`];$("cm-layout",so);$("cm-layout-section",no);var wg=1024,Dx=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},ma,lo,Fe,$g,ha,wy,Rc,Hc,oo=class extends L{constructor(){super(...arguments);m(this,Fe);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;m(this,ma);m(this,lo,null);m(this,Rc,e=>{if(!this.menuItem)return;let t=s(this,Fe,wy).call(this,e),i=e.detail?.value;t==="bottom-navigation"&&i===this.menuItem?s(this,Fe,ha).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&s(this,Fe,ha).call(this,!1,!1)});m(this,Hc,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),s(this,Fe,ha).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,Rc)),this.addEventListener("keydown",r(this,Hc));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=wg)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,Rc)),this.removeEventListener("keydown",r(this,Hc)),r(this,ma)?.disconnect(),g(this,ma,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;g(this,ma,new ResizeObserver(()=>{s(this,Fe,$g).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=wg!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=wg}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,ma).observe(t))}updated(e){e.has("_wide")&&s(this,Fe,$g).call(this)}openMenu(){s(this,Fe,ha).call(this,!0)}closeMenu(){s(this,Fe,ha).call(this,!1)}toggleMenu(){s(this,Fe,ha).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">
|
|
3811
3821
|
<div class="probe"></div>
|
|
3812
3822
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
3813
3823
|
<div class="body">
|
|
@@ -3816,7 +3826,7 @@ ${t.label}</button>
|
|
|
3816
3826
|
</div>
|
|
3817
3827
|
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
3818
3828
|
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
3819
|
-
</div>`}};
|
|
3829
|
+
</div>`}};ma=new WeakMap,lo=new WeakMap,Fe=new WeakSet,$g=function(){let e=this.renderRoot.querySelector(".frame");if(!e)return;let t=i=>Math.round(this.renderRoot.querySelector(i)?.getBoundingClientRect().height??0);e.style.setProperty("--_header",`${t(".header")}px`),e.style.setProperty("--_bottom",`${this._wide?0:t(".bottom")}px`)},ha=function(e,t=!0){e!==this.menuOpen&&(e&&g(this,lo,Dx()),this.menuOpen=e,this.dispatchEvent(new CustomEvent("cm-menu-toggle",{bubbles:!0,composed:!0,detail:{open:e}})),this.updateComplete.then(()=>{if(e){let i=this.querySelector(':scope > [slot="mobile-menu"]');(i?.shadowRoot??i)?.querySelector("a[href], button")?.focus()}else t&&(r(this,lo)?.focus(),g(this,lo,null))}))},wy=function(e){return e.composedPath().find(i=>i.parentElement===this)?.getAttribute("slot")??""},Rc=new WeakMap,Hc=new WeakMap,oo.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},panel:{type:Boolean,reflect:!0},_wide:{state:!0}},oo.styles=[E,w`
|
|
3820
3830
|
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
3821
3831
|
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
3822
3832
|
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
@@ -3847,7 +3857,7 @@ ${t.label}</button>
|
|
|
3847
3857
|
}
|
|
3848
3858
|
.probe { block-size: 0; }
|
|
3849
3859
|
[hidden] { display: none !important; }
|
|
3850
|
-
`];$("cm-app-frame",
|
|
3860
|
+
`];$("cm-app-frame",oo);var co=class extends L{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>`}};co.properties={width:{reflect:!0},fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},co.styles=[E,w`
|
|
3851
3861
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-page-background, var(--cm-bg-page)); min-block-size: 100%; }
|
|
3852
3862
|
.content {
|
|
3853
3863
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
@@ -3859,16 +3869,16 @@ ${t.label}</button>
|
|
|
3859
3869
|
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
3860
3870
|
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
3861
3871
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
3862
|
-
`];$("cm-page",
|
|
3872
|
+
`];$("cm-page",co);var mo,$y,ky,ho=class extends T{constructor(){super(...arguments);m(this,mo);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?It`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:It`<circle cx="10" cy="10" r="7.5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M10 6v5M10 13.6v.2" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>`;return c`<div class="banner" part="banner" role=${e}>
|
|
3863
3873
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
3864
3874
|
<div class="body">
|
|
3865
3875
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
3866
3876
|
<div><slot></slot></div>
|
|
3867
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,
|
|
3877
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,mo,$y)}></slot></div>
|
|
3868
3878
|
</div>
|
|
3869
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,
|
|
3879
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,mo,ky)}>
|
|
3870
3880
|
<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}
|
|
3871
|
-
</div>`}};
|
|
3881
|
+
</div>`}};mo=new WeakSet,$y=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},ky=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},ho.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},ho.styles=[E,w`
|
|
3872
3882
|
:host { display: block; }
|
|
3873
3883
|
.banner {
|
|
3874
3884
|
display: flex; gap: var(--cm-space-12); align-items: flex-start;
|
|
@@ -3892,10 +3902,10 @@ ${t.label}</button>
|
|
|
3892
3902
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
3893
3903
|
}
|
|
3894
3904
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3895
|
-
`];$("cm-banner",
|
|
3905
|
+
`];$("cm-banner",ho);var nz=z("thumbnail",{noImage:"{alt} (no image)"}),po=class extends T{constructor(){super(...arguments);this.src="";this.alt="";this.size="medium";this.loading="eager";this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){if(this.src&&!this._failed)return c`<span class="box" part="thumbnail"><img src=${this.src} alt=${this.alt} loading=${this.loading}
|
|
3896
3906
|
@error=${()=>{this._failed=!0}}></span>`;let e=this.size==="small"?18:this.size==="large"?32:24;return c`<span class="box" part="thumbnail" role=${this.alt?"img":h}
|
|
3897
3907
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):h} aria-hidden=${this.alt?h:"true"}>
|
|
3898
|
-
<cm-icon name="box" size=${e}></cm-icon></span>`}};
|
|
3908
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};po.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},po.styles=[E,w`
|
|
3899
3909
|
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3900
3910
|
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
3901
3911
|
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
@@ -3905,7 +3915,7 @@ ${t.label}</button>
|
|
|
3905
3915
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
3906
3916
|
}
|
|
3907
3917
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
3908
|
-
`];$("cm-thumbnail",
|
|
3918
|
+
`];$("cm-thumbnail",po);export{Xr as Announcer,Ms as CmAccordion,qn as CmAccountMenu,ws as CmActionBar,kt as CmActionMenu,Hn as CmAppCard,oo as CmAppFrame,Tn as CmAvatar,Zn as CmBadge,ho as CmBanner,cn as CmBoard,Jr as CmBoardCard,Zr as CmBoardColumn,Sn as CmBottomNavigation,Bn as CmBottomSheet,ir as CmButton,za as CmButtonGroup,fn as CmCalendar,gn as CmCalendarEvent,Qn as CmCard,yi as CmCheckbox,Ri as CmColorField,Mi as CmCombobox,Ya as CmCommandPalette,Cs as CmComment,Ls as CmCommentBox,Ys as CmDataTable,Ci as CmDatePicker,Si as CmDateRangePicker,Ts as CmEmptyState,Ai as CmFileUpload,In as CmFilterPanel,An as CmFlashOfferBar,Er as CmGlobalSearch,ao as CmGrid,_n as CmHeaderBar,fa as CmIcon,Es as CmInfoItem,ks as CmInfoPanel,so as CmLayout,no as CmLayoutSection,Rn as CmLinkTabs,T as CmLocalizedElement,ba as CmMenuItem,kn as CmMetric,Dn as CmMobileMenu,Nn as CmModal,En as CmNavItem,on as CmNestedItem,nn as CmNestedList,Fn as CmNotificationItem,jn as CmNotificationPanel,_t as CmOptionGroup,co as CmPage,xs as CmPageHeader,Os as CmPagination,Jn as CmProgressBar,pr as CmRadio,ur as CmRadioGroup,ia as CmReportTile,$n as CmReportTiles,rn as CmResourceItem,an as CmResourceList,$s as CmSaveBar,Ei as CmSearch,ys as CmSegmentedControl,ki as CmSelect,Mn as CmSideNavigation,At as CmSidePanel,Hi as CmSignatureField,zs as CmSkeleton,_s as CmSkeletonDisplay,Ps as CmSmartTip,qs as CmSmartTips,On as CmSparkline,wa as CmSpinner,ro as CmStack,Fs as CmStatusTabs,Vs as CmTableHeader,xr as CmTag,vi as CmTextField,po as CmThumbnail,Br as CmTimeline,Ns as CmTimelineItem,Kn as CmToast,Wn as CmToastRegion,xi as CmToggle,Ss as CmTooltip,Yr as MoveModel,Mf as commandMatches,qy as configure,z as defineStrings,Wg as directionalIcons,ne as formatDate,Ug as formatMessage,Ym as formatNumber,Iy as getDefaultStrings,Qv as initials,Zo as isApplePlatform,ov as listNavigation,$o as localeFor,fp as matchesShortcut,ri as normalizeHex,Jc as pluralCategory,Oy as resetStrings,Nf as resolvePreset,Py as setStrings,Wd as shortcutKeys,gy as showToast,Zc as translate,_x as undoable};
|
|
3909
3919
|
/*! Bundled license information:
|
|
3910
3920
|
|
|
3911
3921
|
@lit/reactive-element/css-tag.js:
|