@commmerce/ui 1.14.0 → 1.16.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/calendar.d.ts +2 -0
- package/dist/calendar.js +5 -3
- package/dist/cdn.js +646 -578
- package/dist/components/date-range-picker.d.ts +59 -4
- package/dist/components/date-range-picker.js +191 -29
- package/dist/components/text-field.d.ts +9 -0
- package/dist/components/text-field.js +9 -1
- package/dist/components/time-picker.d.ts +162 -0
- package/dist/components/time-picker.js +375 -0
- package/dist/custom-elements.json +1029 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -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 rf=o=>{throw TypeError(o)};var cp=(o,n,e)=>n.has(o)||rf("Cannot "+e);var i=(o,n,e)=>(cp(o,n,"read from private field"),e?e.call(o):n.get(o)),m=(o,n,e)=>n.has(o)?rf("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),g=(o,n,e,t)=>(cp(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),a=(o,n,e)=>(cp(o,n,"access private method"),e);var dd=globalThis,hd=dd.ShadowRoot&&(dd.ShadyCSS===void 0||dd.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,dp=Symbol(),sf=new WeakMap,Po=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==dp)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(hd&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=sf.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&sf.set(e,n))}return n}toString(){return this.cssText}},md=o=>new Po(typeof o=="string"?o:o+"",void 0,dp),w=(o,...n)=>{let e=o.length===1?o[0]:n.reduce((t,r,s)=>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.")})(r)+o[s+1],o[0]);return new Po(e,o,dp)},af=(o,n)=>{if(hd)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),r=dd.litNonce;r!==void 0&&t.setAttribute("nonce",r),t.textContent=e.cssText,o.appendChild(t)}},hp=hd?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return md(e)})(o):o;var{is:ox,defineProperty:lx,getOwnPropertyDescriptor:cx,getOwnPropertyNames:dx,getOwnPropertySymbols:hx,getPrototypeOf:mx}=Object,pd=globalThis,nf=pd.trustedTypes,px=nf?nf.emptyScript:"",ux=pd.reactiveElementPolyfillSupport,qo=(o,n)=>o,mp={toAttribute(o,n){switch(n){case Boolean:o=o?px: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}},lf=(o,n)=>!ox(o,n),of={attribute:!0,type:String,converter:mp,reflect:!1,useDefault:!1,hasChanged:lf};Symbol.metadata??=Symbol("metadata"),pd.litPropertyMetadata??=new WeakMap;var jt=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=of){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(),r=this.getPropertyDescriptor(n,t,e);r!==void 0&&lx(this.prototype,n,r)}}static getPropertyDescriptor(n,e,t){let{get:r,set:s}=cx(this.prototype,n)??{get(){return this[e]},set(l){this[e]=l}};return{get:r,set(l){let d=r?.call(this);s?.call(this,l),this.requestUpdate(n,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(n){return this.elementProperties.get(n)??of}static _$Ei(){if(this.hasOwnProperty(qo("elementProperties")))return;let n=mx(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(qo("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qo("properties"))){let e=this.properties,t=[...dx(e),...hx(e)];for(let r of t)this.createProperty(r,e[r])}let n=this[Symbol.metadata];if(n!==null){let e=litPropertyMetadata.get(n);if(e!==void 0)for(let[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let r=this._$Eu(e,t);r!==void 0&&this._$Eh.set(r,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 r of t)e.unshift(hp(r))}else n!==void 0&&e.push(hp(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 af(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),r=this.constructor._$Eu(n,t);if(r!==void 0&&t.reflect===!0){let s=(t.converter?.toAttribute!==void 0?t.converter:mp).toAttribute(e,t.type);this._$Em=n,s==null?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(n,e){let t=this.constructor,r=t._$Eh.get(n);if(r!==void 0&&this._$Em!==r){let s=t.getPropertyOptions(r),l=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:mp;this._$Em=r;let d=l.fromAttribute(e,s.type);this[r]=d??this._$Ej?.get(r)??d,this._$Em=null}}requestUpdate(n,e,t,r=!1,s){if(n!==void 0){let l=this.constructor;if(r===!1&&(s=this[n]),t??=l.getPropertyOptions(n),!((t.hasChanged??lf)(s,e)||t.useDefault&&t.reflect&&s===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:r,wrapped:s},l){t&&!(this._$Ej??=new Map).has(n)&&(this._$Ej.set(n,l??e??this[n]),s!==!0||l!==void 0)||(this._$AL.has(n)||(this.hasUpdated||t||(e=void 0),this._$AL.set(n,e)),r===!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[r,s]of this._$Ep)this[r]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[r,s]of t){let{wrapped:l}=s,d=this[r];l!==!0||this._$AL.has(r)||d===void 0||this.C(r,void 0,s,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){}};jt.elementStyles=[],jt.shadowRootOptions={mode:"open"},jt[qo("elementProperties")]=new Map,jt[qo("finalized")]=new Map,ux?.({ReactiveElement:jt}),(pd.reactiveElementVersions??=[]).push("2.1.2");var up=globalThis,cf=o=>o,ud=up.trustedTypes,df=ud?ud.createPolicy("lit-html",{createHTML:o=>o}):void 0,gp="$lit$",Ut=`lit$${Math.random().toFixed(9).slice(2)}$`,fp="?"+Ut,gx=`<${fp}>`,dr=document,Bo=()=>dr.createComment(""),Fo=o=>o===null||typeof o!="object"&&typeof o!="function",bp=Array.isArray,ff=o=>bp(o)||typeof o?.[Symbol.iterator]=="function",pp=`[
|
|
2
|
+
\f\r]`,Oo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hf=/-->/g,mf=/>/g,lr=RegExp(`>|${pp}(?:([^\\s"'>=/]+)(${pp}*=${pp}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),pf=/'/g,uf=/"/g,bf=/^(?:script|style|textarea|title)$/i,vp=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=vp(1),Kt=vp(2),xw=vp(3),Le=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),gf=new WeakMap,cr=dr.createTreeWalker(dr,129);function vf(o,n){if(!bp(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return df!==void 0?df.createHTML(n):n}var yf=(o,n)=>{let e=o.length-1,t=[],r,s=n===2?"<svg>":n===3?"<math>":"",l=Oo;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===Oo?b[1]==="!--"?l=hf:b[1]!==void 0?l=mf:b[2]!==void 0?(bf.test(b[2])&&(r=RegExp("</"+b[2],"g")),l=lr):b[3]!==void 0&&(l=lr):l===lr?b[0]===">"?(l=r??Oo,f=-1):b[1]===void 0?f=-2:(f=l.lastIndex-b[2].length,u=b[1],l=b[3]===void 0?lr:b[3]==='"'?uf:pf):l===uf||l===pf?l=lr:l===hf||l===mf?l=Oo:(l=lr,r=void 0);let y=l===lr&&o[d+1].startsWith("/>")?" ":"";s+=l===Oo?p+gx:f>=0?(t.push(u),p.slice(0,f)+gp+p.slice(f)+Ut+y):p+Ut+(f===-2?d:y)}return[vf(o,s+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},Vo=class o{constructor({strings:n,_$litType$:e},t){let r;this.parts=[];let s=0,l=0,d=n.length-1,p=this.parts,[u,b]=yf(n,e);if(this.el=o.createElement(u,t),cr.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(r=cr.nextNode())!==null&&p.length<d;){if(r.nodeType===1){if(r.hasAttributes())for(let f of r.getAttributeNames())if(f.endsWith(gp)){let x=b[l++],y=r.getAttribute(f).split(Ut),k=/([.?@])?(.*)/.exec(x);p.push({type:1,index:s,name:k[2],strings:y,ctor:k[1]==="."?fd:k[1]==="?"?bd:k[1]==="@"?vd:mr}),r.removeAttribute(f)}else f.startsWith(Ut)&&(p.push({type:6,index:s}),r.removeAttribute(f));if(bf.test(r.tagName)){let f=r.textContent.split(Ut),x=f.length-1;if(x>0){r.textContent=ud?ud.emptyScript:"";for(let y=0;y<x;y++)r.append(f[y],Bo()),cr.nextNode(),p.push({type:2,index:++s});r.append(f[x],Bo())}}}else if(r.nodeType===8)if(r.data===fp)p.push({type:2,index:s});else{let f=-1;for(;(f=r.data.indexOf(Ut,f+1))!==-1;)p.push({type:7,index:s}),f+=Ut.length-1}s++}}static createElement(n,e){let t=dr.createElement("template");return t.innerHTML=n,t}};function hr(o,n,e=o,t){if(n===Le)return n;let r=t!==void 0?e._$Co?.[t]:e._$Cl,s=Fo(n)?void 0:n._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),s===void 0?r=void 0:(r=new s(o),r._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=r:e._$Cl=r),r!==void 0&&(n=hr(o,r._$AS(o,n.values),r,t)),n}var gd=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,r=(n?.creationScope??dr).importNode(e,!0);cr.currentNode=r;let s=cr.nextNode(),l=0,d=0,p=t[0];for(;p!==void 0;){if(l===p.index){let u;p.type===2?u=new _s(s,s.nextSibling,this,n):p.type===1?u=new p.ctor(s,p.name,p.strings,this,n):p.type===6&&(u=new yd(s,this,n)),this._$AV.push(u),p=t[++d]}l!==p?.index&&(s=cr.nextNode(),l++)}return cr.currentNode=dr,r}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++}},_s=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(n,e,t,r){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=n,this._$AB=e,this._$AM=t,this.options=r,this._$Cv=r?.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=hr(this,n,e),Fo(n)?n===h||n==null||n===""?(this._$AH!==h&&this._$AR(),this._$AH=h):n!==this._$AH&&n!==Le&&this._(n):n._$litType$!==void 0?this.$(n):n.nodeType!==void 0?this.T(n):ff(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&&Fo(this._$AH)?this._$AA.nextSibling.data=n:this.T(dr.createTextNode(n)),this._$AH=n}$(n){let{values:e,_$litType$:t}=n,r=typeof t=="number"?this._$AC(n):(t.el===void 0&&(t.el=Vo.createElement(vf(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===r)this._$AH.p(e);else{let s=new gd(r,this),l=s.u(this.options);s.p(e),this.T(l),this._$AH=s}}_$AC(n){let e=gf.get(n.strings);return e===void 0&&gf.set(n.strings,e=new Vo(n)),e}k(n){bp(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,r=0;for(let s of n)r===e.length?e.push(t=new o(this.O(Bo()),this.O(Bo()),this,this.options)):t=e[r],t._$AI(s),r++;r<e.length&&(this._$AR(t&&t._$AB.nextSibling,r),e.length=r)}_$AR(n=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);n!==this._$AB;){let t=cf(n).nextSibling;cf(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},mr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(n,e,t,r,s){this.type=1,this._$AH=h,this._$AN=void 0,this.element=n,this.name=e,this._$AM=r,this.options=s,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,r){let s=this.strings,l=!1;if(s===void 0)n=hr(this,n,e,0),l=!Fo(n)||n!==this._$AH&&n!==Le,l&&(this._$AH=n);else{let d=n,p,u;for(n=s[0],p=0;p<s.length-1;p++)u=hr(this,d[t+p],e,p),u===Le&&(u=this._$AH[p]),l||=!Fo(u)||u!==this._$AH[p],u===h?n=h:n!==h&&(n+=(u??"")+s[p+1]),this._$AH[p]=u}l&&!r&&this.j(n)}j(n){n===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}},fd=class extends mr{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},bd=class extends mr{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},vd=class extends mr{constructor(n,e,t,r,s){super(n,e,t,r,s),this.type=5}_$AI(n,e=this){if((n=hr(this,n,e,0)??h)===Le)return;let t=this._$AH,r=n===h&&t!==h||n.capture!==t.capture||n.once!==t.once||n.passive!==t.passive,s=n!==h&&(t===h||r);r&&this.element.removeEventListener(this.name,this,t),s&&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)}},yd=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){hr(this,n)}},xf={M:gp,P:Ut,A:fp,C:1,L:yf,R:gd,D:ff,V:hr,I:_s,H:mr,N:bd,U:vd,B:fd,F:yd},fx=up.litHtmlPolyfillSupport;fx?.(Vo,_s),(up.litHtmlVersions??=[]).push("3.3.3");var wf=(o,n,e)=>{let t=e?.renderBefore??n,r=t._$litPart$;if(r===void 0){let s=e?.renderBefore??null;t._$litPart$=r=new _s(n.insertBefore(Bo(),s),s,void 0,e??{})}return r._$AI(o),r};var yp=globalThis,C=class extends jt{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=wf(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Le}};C._$litElement$=!0,C.finalized=!0,yp.litElementHydrateSupport?.({LitElement:C});var bx=yp.litElementPolyfillSupport;bx?.({LitElement:C});(yp.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 Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,Rw=w`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
14
|
+
`,vx=0,H=o=>`${o}-${++vx}`;function $(o,n){customElements.get(o)||customElements.define(o,n)}function te(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var yx={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},xd={common:{...yx}},jo={},Uo={},wd;function _(o,n){return xd[o]={...xd[o],...n},n}function xx(){return Object.fromEntries(Object.entries(xd).map(([o,n])=>[o,{...n}]))}function $d(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function wx(o,n){$d(n?Uo[n.toLowerCase()]??={}:jo,o),Md()}function $x(o={}){"locale"in o&&(wd=o.locale||void 0),o.strings&&$d(jo,o.strings);for(let[n,e]of Object.entries(o.translations??{}))$d(Uo[n.toLowerCase()]??={},e);Md()}function kx(){wd=void 0;for(let o of Object.keys(jo))delete jo[o];for(let o of Object.keys(Uo))delete Uo[o];Md()}function Ko(o){if(wd)return wd;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 $f=new Map;function $p(o,n,e,t){let r=`${o}|${n??""}|${JSON.stringify(e)}`,s=$f.get(r);if(!s){try{s=t(n)}catch{s=t(void 0)}$f.set(r,s)}return s}function kp(o,n={},e){return $p("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function de(o,n={},e){return $p("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function kd(o,n){return $p("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function kf(o,n={},e){if(o==null)return"";if(typeof o=="function")return String(o(n));let t;if(typeof o=="object"){let r=Number(n.count??0);t=o[kd(r,e)]??o.other??""}else t=String(o);return t.replace(/\{(\w+)\}/g,(r,s)=>{let l=n[s];return l===void 0?r:typeof l=="number"?kp(l,{},e):String(l)})}function Ex(o,n,e,t){if(t&&t[n]!==void 0)return t[n];let r=[];if(e){let s=e.toLowerCase().split("-");for(let l=s.length;l>0;l--)r.push(s.slice(0,l).join("-"))}for(let s of o==="common"?["common"]:[o,"common"]){for(let d of r){let p=Uo[d]?.[s]?.[n];if(p!==void 0)return p}let l=jo[s]?.[n]??xd[s]?.[n];if(l!==void 0)return l}}function Ed(o,n,e,t,r){let s=Ko(t);return kf(Ex(o,n,s,r),e,s)}var wp=new Set,xp;function Md(){for(let o of wp)o.requestUpdate()}function Mx(){xp||typeof MutationObserver>"u"||typeof document>"u"||(xp=new MutationObserver(Md),xp.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var Tx=o=>o.replace(/^cm-/,"").replace(/-([a-z])/g,(n,e)=>e.toUpperCase()),T=class extends C{static finalize(){let n=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);if(!n(this,"finalized")&&n(this,"properties"))for(let[e,t]of Object.entries(this.properties)){let r=t.string;if(!r||n(this.prototype,e))continue;let s=Symbol(e);Object.defineProperty(this.prototype,e,{get(){return this[s]??this.t(r)},set(l){this[s]=l},configurable:!0,enumerable:!0})}super.finalize()}get stringsNamespace(){return Tx(this.localName)}t(n,e){return Ed(this.stringsNamespace,n,e,this,this.strings)}get locale(){return Ko(this)}formatNumber(n,e){return kp(n,e,this.locale)}connectedCallback(){super.connectedCallback(),wp.add(this),Mx()}disconnectedCallback(){super.disconnectedCallback(),wp.delete(this)}};T.properties={strings:{type:Object}};var Td={"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"},Ef=["more","drag"],Pw=Object.keys(Td);var Mf=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],zs=class extends C{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=Td[this.name]??Td.more,t=Ef.includes(this.name)?3:1.6;return Kt`<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"?Mf.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};zs.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},zs.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",
|
|
21
|
+
`;$("cm-icon",zs);var Tf=99,Ww=_("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),_d,zd,Wo,pr=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,_d,this.attachInternals());m(this,zd,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=i(this,_d).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});m(this,Wo,!1);this.addEventListener("click",i(this,zd),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!i(this,Wo)&&(g(this,Wo,!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>`,r=this.iconOnly?c`<span class="vh"><slot></slot></span>`:c`<span class="text"><slot></slot></span>`,s=e?c`<span class="count" part="count" aria-hidden="true">${e>Tf?this.t("countOverflow",{max:Tf}):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}${r}${s}`;return this.href&&!this.disabled?c`<a class="btn" part="control" href=${this.href} target=${this.target??h}
|
|
22
22
|
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${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}>${p}</button>`}};
|
|
24
|
+
aria-busy=${this.loading?"true":h} aria-label=${d}>${p}</button>`}};_d=new WeakMap,zd=new WeakMap,Wo=new WeakMap,pr.formAssociated=!0,pr.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}},pr.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 Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("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",pr);var Cs=class extends C{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}}};Cs.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}},Cs.styles=w`:host { display: none; }`;$("cm-menu-item",Cs);function Go(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),r=s=>e.getAttribute(s)||void 0;n.push({label:t,value:r("value")??t,icon:r("icon"),href:r("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0,heading:e.hasAttribute("heading")||void 0,shortcut:r("shortcut")})}else e.localName==="hr"&&n.push({divider:!0});return n}function Cd(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var Ve=w`
|
|
110
110
|
:where([popover]) { margin: 0; padding: 0; border: 0; color: inherit; background: none; overflow: visible; }
|
|
111
|
-
`,
|
|
111
|
+
`,Yo=8,yt,Ls,Ss,Ds,ur,we=class{constructor(){m(this,yt,null);m(this,Ls,null);m(this,Ss,{});m(this,Ds,"");m(this,ur,()=>this.place())}get active(){return!!i(this,yt)}open(n,e,t={}){if(!n||!e||typeof n.showPopover!="function")return!1;i(this,yt)&&i(this,yt)!==n&&this.close(),n.hasAttribute("popover")||n.setAttribute("popover","manual");let r=n.matches(":popover-open");if(!r){if(getComputedStyle(n).position==="static")return n.removeAttribute("popover"),!1;try{n.showPopover()}catch{return!1}}return n.matches(":popover-open")?(i(this,yt)||g(this,Ds,n.style.maxHeight),g(this,yt,n),g(this,Ls,e),g(this,Ss,t),Object.assign(n.style,{position:"fixed",inset:"auto",margin:"0"}),this.place(),r||(window.addEventListener("scroll",i(this,ur),!0),window.addEventListener("resize",i(this,ur))),!0):!1}place(){let n=i(this,yt),e=i(this,Ls);if(!n||!e)return;let t=e.getBoundingClientRect(),r=document.documentElement.clientWidth,s=document.documentElement.clientHeight,l=i(this,Ss).gap??4,d=i(this,Ss).align??"start";n.style.maxHeight=i(this,Ds),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>r-Yo&&(k=f?x:y);let D=Math.max(0,Math.min(Yo,t.left)),R=Math.min(r,Math.max(r-Yo,t.right))-u;k=Math.max(D,Math.min(k,R));let q=s-t.bottom-l-Yo,B=t.top-l-Yo,U;if(b<=q||q>=B)U=t.bottom+l,b>q&&(n.style.maxHeight=`${Math.max(80,Math.floor(q))}px`);else{let Fe=Math.min(b,Math.floor(B));b>B&&(n.style.maxHeight=`${Math.max(80,Fe)}px`),U=t.top-l-Fe}n.style.left=`${k}px`,n.style.top=`${U}px`}close(){let n=i(this,yt);if(window.removeEventListener("scroll",i(this,ur),!0),window.removeEventListener("resize",i(this,ur)),g(this,yt,null),g(this,Ls,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=i(this,Ds)}}};yt=new WeakMap,Ls=new WeakMap,Ss=new WeakMap,Ds=new WeakMap,ur=new WeakMap;var As=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>`}};As.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},As.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 Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("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="${
|
|
138
|
-
?disabled=${this.disabled} @click=${
|
|
136
|
+
`];$("cm-spinner",As);var h0=_("actionMenu",{label:"Actions"}),Xo,gr,fr,Jo,W,Ld,Zo,Sd,Dd,Ad,Rd,_f,Hs,Ns,Is,Rs,Hd,zf,Ep,Cf,Lt=class extends T{constructor(){super(...arguments);m(this,W);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,Xo);m(this,gr,H("cm-menu"));m(this,fr,"");m(this,Jo,0);m(this,Zo,e=>{this.open&&!e.composedPath().includes(this)&&a(this,W,Ad).call(this,!1)});m(this,Hs,new we);m(this,Ns,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,Is,()=>{this.disabled||(this.open?this.hide():this.show())});m(this,Hd,e=>{let t=a(this,W,Dd).call(this),r=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),a(this,W,Rs).call(this,t[(r+1)%t.length]);break;case"ArrowUp":e.preventDefault(),a(this,W,Rs).call(this,t[(r-1+t.length)%t.length]);break;case"Home":e.preventDefault(),a(this,W,Rs).call(this,t[0]);break;case"End":e.preventDefault(),a(this,W,Rs).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 s=Date.now();g(this,fr,(s-i(this,Jo)<600?i(this,fr):"")+e.key.toLowerCase()),g(this,Jo,s);let l=this.menuItems,d=i(this,fr).length>1?r:r+1,u=[...t.slice(Math.max(d,0)),...t.slice(0,Math.max(d,0))].find(b=>(l[b].label??"").toLowerCase().startsWith(i(this,fr)));u!==void 0&&a(this,W,Rs).call(this,u)}}})}connectedCallback(){super.connectedCallback(),a(this,W,Ld).call(this),g(this,Xo,Cd(this,()=>a(this,W,Ld).call(this))),document.addEventListener("pointerdown",i(this,Zo),!0)}disconnectedCallback(){super.disconnectedCallback(),i(this,Xo)?.disconnect(),document.removeEventListener("pointerdown",i(this,Zo),!0),i(this,Hs).close()}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=a(this,W,Dd).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,a(this,W,Ad).call(this,!0),this.updateComplete.then(()=>a(this,W,Rd).call(this))}hide(e=!1){a(this,W,Ad).call(this,!1),e&&a(this,W,Sd).call(this)?.focus()}updated(e){if(e.has("open")&&this.open&&a(this,W,_f).call(this),e.has("open")&&!this.open&&i(this,Hs).close(),this._custom){let t=a(this,W,Sd).call(this);if(t){let r=(s,l)=>{t.getAttribute(s)!==l&&t.setAttribute(s,l)};r("aria-haspopup","menu"),r("aria-expanded",String(this.open)),r("aria-controls",`${i(this,gr)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=a(this,W,Dd).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>a(this,W,Rd).call(this))}}triggerTemplate(e,t){}headTemplate(){}render(){let e=this.menuItems,t=this.triggerLabel||this.label,r=this._custom?c`<slot name="trigger" @click=${i(this,Is)} @keydown=${i(this,Ns)} @slotchange=${()=>a(this,W,Ld).call(this)}></slot>`:this.triggerTemplate(i(this,Is),i(this,Ns))??c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
137
|
+
aria-expanded=${String(this.open)} aria-controls="${i(this,gr)}-m" aria-label=${this.iconOnly?t:h}
|
|
138
|
+
?disabled=${this.disabled} @click=${i(this,Is)} @keydown=${i(this,Ns)}>${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`${r}
|
|
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="${
|
|
142
|
-
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:
|
|
141
|
+
<div role="menu" id="${i(this,gr)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${i(this,Hd)}>
|
|
142
|
+
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:a(this,W,Cf).call(this,e)}
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
|
-
<slot hidden></slot>`}};
|
|
146
|
-
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${
|
|
147
|
-
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${
|
|
145
|
+
<slot hidden></slot>`}};Xo=new WeakMap,gr=new WeakMap,fr=new WeakMap,Jo=new WeakMap,W=new WeakSet,Ld=function(){this._slotted=Go(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},Zo=new WeakMap,Sd=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},Dd=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},Ad=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})))},Rd=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},_f=function(){let e=this.renderRoot.querySelector(".pop");if(!e||i(this,Hs).open(e,a(this,W,Sd).call(this)??this,{align:this.align==="end"?"end":"start"}))return;e.classList.remove("to-end","to-start");let t=e.getBoundingClientRect(),r=document.documentElement.clientWidth,s=8,l=getComputedStyle(this).direction==="rtl",d=l?t.left<s:t.right>r-s,p=l?t.right>r-s:t.left<s;this.align!=="end"&&d?e.classList.add("to-end"):this.align==="end"&&p&&e.classList.add("to-start")},Hs=new WeakMap,Ns=new WeakMap,Is=new WeakMap,Rs=function(e){this._active=e,this.updateComplete.then(()=>a(this,W,Rd).call(this))},Hd=new WeakMap,zf=function(e,t){if(t.disabled){e.preventDefault();return}let r=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));r||e.preventDefault(),this.hide(!t.href||!r)},Ep=function(e,t){if(e.divider)return c`<div role="separator"></div>`;let r=`item${e.critical?" critical":""}${t===this._active?" active":""}`,s=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=>a(this,W,zf).call(this,d,e)};return e.href&&!e.disabled?c`<a class=${r} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
146
|
+
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${s}</a>`:c`<button type="button" class=${r} 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}>${s}</button>`},Cf=function(e){let t=[];for(let r=0;r<e.length;r++){let s=e[r];if(!s.heading){t.push(a(this,W,Ep).call(this,s,r));continue}let l=`${i(this,gr)}-h${r}`,d=[],p=r+1;for(;p<e.length&&!e[p].heading&&!e[p].divider;p++)d.push(a(this,W,Ep).call(this,e[p],p));t.push(c`<div role="group" aria-labelledby=${l}><div class="section" part="section" id=${l} role="presentation">${s.label}</div>${d}</div>`),r=p-1}return t},Lt.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}},Lt.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 Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("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",Lt);var b0=_("buttonGroup",{more:"More"}),$i="data-cm-overflow",_x=["disabled","loading","tone","icon","label","variant","size","icon-only","count","href","hidden","data-priority"],ki,br,Wt,St,Ei,vr,G,Ps,Lf,Qo,Mp,Nd,Id,Sf,Pd,Tp,_p,zp,qs=class extends T{constructor(){super(...arguments);m(this,G);this.overflow="wrap";this.align="start";this.label="";this._items=[];this._size="medium";m(this,ki,[]);m(this,br);m(this,Wt);m(this,St,0);m(this,Ei,new Set);m(this,vr,!1);m(this,Pd,e=>{e.stopPropagation();let t=i(this,ki)[Number(e.detail.value)];if(!t)return;g(this,vr,!0),(t.shadowRoot?.querySelector('[part="control"]')??t).click(),requestAnimationFrame(()=>requestAnimationFrame(()=>a(this,G,Tp).call(this)))})}get overflowing(){return[...i(this,ki)]}connectedCallback(){super.connectedCallback(),g(this,br,new MutationObserver(e=>a(this,G,Lf).call(this,e))),i(this,br).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:_x}),typeof ResizeObserver<"u"&&(g(this,Wt,new ResizeObserver(()=>a(this,G,Ps).call(this))),i(this,Wt).observe(this),g(this,Ei,new Set([this]))),document.fonts?.ready.then(()=>a(this,G,Ps).call(this)),a(this,G,Ps).call(this)}disconnectedCallback(){super.disconnectedCallback(),i(this,br)?.disconnect(),i(this,Wt)?.disconnect(),i(this,Ei).clear(),cancelAnimationFrame(i(this,St)),g(this,St,0),a(this,G,Mp).call(this,a(this,G,Qo).call(this))}updated(e){(e.has("overflow")||e.has("moreLabel")||e.has("moreIcon")||e.has("size"))&&a(this,G,Ps).call(this)}firstUpdated(){this.updateComplete.then(()=>this.relayout())}relayout(){cancelAnimationFrame(i(this,St)),g(this,St,0),a(this,G,Id).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=${
|
|
215
|
-
</div>`}};
|
|
214
|
+
@cm-select=${i(this,Pd)}></cm-action-menu>
|
|
215
|
+
</div>`}};ki=new WeakMap,br=new WeakMap,Wt=new WeakMap,St=new WeakMap,Ei=new WeakMap,vr=new WeakMap,G=new WeakSet,Ps=function(){i(this,St)||!this.isConnected||g(this,St,requestAnimationFrame(()=>{g(this,St,0);let e=a(this,G,Qo).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>a(this,G,Id).call(this)):a(this,G,Id).call(this)}))},Lf=function(e){for(let t of e)for(let r of Array.from(t.removedNodes))r instanceof HTMLElement&&r.hasAttribute($i)&&r.parentElement!==this&&(r.removeAttribute($i),r.hidden=!1);a(this,G,Ps).call(this)},Qo=function(){return Array.from(this.children).filter(e=>e.localName==="cm-button"&&(!e.hidden||e.hasAttribute($i)))},Mp=function(e){for(let t of e)t.hasAttribute($i)&&(t.removeAttribute($i),t.hidden=!1)},Nd=function(){return this.renderRoot.querySelector(".more")},Id=function(){let e=this.renderRoot.querySelector(".row"),t=a(this,G,Nd).call(this);if(!e||!t||!this.isConnected)return;let r=a(this,G,Qo).call(this),s=this.shadowRoot.activeElement===t?t:r.find(b=>b.matches(":focus-within"))??null,l=r[0]?.getAttribute("size");this._size=this.size||(l==="slim"||l==="large"?l:"medium");let d=new Set;if(i(this,Wt)){let b=new Set([this,t,...r]);for(let f of i(this,Ei))b.has(f)||i(this,Wt).unobserve(f);for(let f of b)i(this,Ei).has(f)||i(this,Wt).observe(f);g(this,Ei,b)}if(this.overflow==="menu"){a(this,G,Mp).call(this,r),t.hidden=!1;let b=e.clientWidth,f=parseFloat(getComputedStyle(e).columnGap)||0,x=Array.from(this.children).filter(D=>!D.hidden),y=new Map(x.map(D=>[D,D.getBoundingClientRect().width])),k=x.reduce((D,R)=>D+y.get(R),0)+f*Math.max(x.length-1,0);if(k>b+.5){let D=B=>{let U=B.dataset.priority;return U==="low"?0:U==="high"?2:B.getAttribute("variant")==="primary"?3:1},R=r.map((B,U)=>({b:B,i:U,r:D(B)})).sort((B,U)=>B.r-U.r||U.i-B.i),q=k+f+t.getBoundingClientRect().width;for(let{b:B}of R){if(q<=b+.5)break;d.add(B),q-=y.get(B)+f}}}for(let b of r)d.has(b)?(b.setAttribute($i,""),b.hidden=!0):b.hasAttribute($i)&&(b.removeAttribute($i),b.hidden=!1);t.hidden=d.size===0,s===t&&t.hidden?a(this,G,zp).call(this):s&&s!==t&&d.has(s)&&a(this,G,_p).call(this),d.size===0&&t.open&&t.hide(),i(this,br)?.takeRecords();let p=r.filter(b=>d.has(b));this._items=p.map((b,f)=>a(this,G,Sf).call(this,b,f));let u=p.length!==i(this,ki).length||p.some((b,f)=>b!==i(this,ki)[f]);g(this,ki,p),u&&this.dispatchEvent(new CustomEvent("cm-overflow-change",{detail:{hidden:[...p]},bubbles:!0,composed:!0})),i(this,vr)&&this.updateComplete.then(()=>a(this,G,Tp).call(this))},Sf=function(e,t){let r=Array.from(e.childNodes).filter(d=>!(d instanceof Element&&d.hasAttribute("slot"))).map(d=>d.textContent??"").join("").replace(/\s+/g," ").trim(),s=e.hasAttribute("icon-only")?e.getAttribute("label")||r:r||e.getAttribute("label")||"",l=e.getAttribute("icon")||e.querySelector(':scope > [slot="icon"]')?.getAttribute("name")||void 0;return{label:s,value:String(t),icon:l,disabled:e.hasAttribute("disabled")||e.hasAttribute("loading")||void 0,critical:e.getAttribute("tone")==="critical"||void 0}},Pd=new WeakMap,Tp=function(){if(!i(this,vr))return;g(this,vr,!1);let e=document.activeElement,t=a(this,G,Nd).call(this);(!e||e===document.body||e===document.documentElement||e===this&&(!t||t.hidden||this.shadowRoot.activeElement!==t))&&(t&&!t.hidden?a(this,G,_p).call(this):a(this,G,zp).call(this))},_p=function(){a(this,G,Nd).call(this)?.shadowRoot?.querySelector('[part="trigger"]')?.focus()},zp=function(){let e=a(this,G,Qo).call(this).filter(r=>!r.hidden&&!r.hasAttribute("disabled")),t=e[e.length-1];(t?.shadowRoot?.querySelector('[part="control"]')??t)?.focus()},qs.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}},qs.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 Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("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",qs);var xt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Os=o=>(...n)=>({_$litDirective$:o,values:n}),Mi=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:zx}=xf,Df=o=>o;var Rf=o=>o.strings===void 0,Af=()=>document.createComment(""),Bs=(o,n,e)=>{let t=o._$AA.parentNode,r=n===void 0?o._$AB:n._$AA;if(e===void 0){let s=t.insertBefore(Af(),r),l=t.insertBefore(Af(),r);e=new zx(s,l,o,o.options)}else{let s=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(s!==r||d){let p=e._$AA;for(;p!==s;){let u=Df(p).nextSibling;Df(t).insertBefore(p,r),p=u}}}return e},Ti=(o,n,e=o)=>(o._$AI(n,e),o),Cx={},qd=(o,n=Cx)=>o._$AH=n,Hf=o=>o._$AH,Od=o=>{o._$AR(),o._$AA.remove()};var oe=Os(class extends Mi{constructor(o){if(super(o),o.type!==xt.PROPERTY&&o.type!==xt.ATTRIBUTE&&o.type!==xt.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===Le||n===h)return n;let e=o.element,t=o.name;if(o.type===xt.PROPERTY){if(n===e[t])return Le}else if(o.type===xt.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return Le}else if(o.type===xt.ATTRIBUTE&&e.getAttribute(t)===n+"")return Le;return qd(o),n}});var lt=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 Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("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
|
+
`,Fs=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,24 +272,25 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("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=${
|
|
277
|
-
|
|
275
|
+
`;var Bd=!1,Cp=!1,Nf=!1,If=()=>{Bd||(Bd=!0,setTimeout(()=>{Bd=!1,Cp=!1}))};function Lx(){Nf||typeof document>"u"||(Nf=!0,document.addEventListener("click",If,!0),document.addEventListener("keydown",o=>{(o.key==="Enter"||o.ctrlKey||o.metaKey)&&If()},!0))}var je,yr,Vs,js,_i,el,xr,tl,Lp,il,Fd,Vd,ee=class{constructor(n,e,t){m(this,tl);m(this,je);m(this,yr);m(this,Vs);m(this,js,!1);m(this,_i,!1);m(this,el,"");m(this,xr,!1);m(this,il,()=>{g(this,js,!0)});m(this,Fd,n=>{let e=n.relatedTarget;e&&(i(this,je).contains(e)||i(this,je).shadowRoot?.contains(e))||i(this,je).updateComplete.then(()=>{if(!i(this,js)||i(this,_i))return;let t=i(this,yr).validity;t.valid||t.valueMissing||(g(this,_i,!0),i(this,je).requestUpdate())})});m(this,Vd,n=>{if(!(!Bd&&!i(this,xr))){if(n.preventDefault(),g(this,_i,!0),i(this,je).requestUpdate(),i(this,xr)){i(this,Vs).call(this);return}Cp||(Cp=!0,i(this,Vs).call(this))}});g(this,je,n),g(this,yr,e),g(this,Vs,t??(()=>n.focus())),Lx(),n.addEventListener("invalid",i(this,Vd)),n.addEventListener("input",i(this,il),!0),n.addEventListener("change",i(this,il),!0),n.addEventListener("focusout",i(this,Fd))}get message(){return a(this,tl,Lp).call(this)}sync(){let n=a(this,tl,Lp).call(this);i(this,je).toggleAttribute("data-cm-invalid",!!n),n!==i(this,el)&&(g(this,el,n),queueMicrotask(()=>i(this,je).requestUpdate()))}reset(){g(this,js,g(this,_i,!1)),i(this,je).requestUpdate()}report(n){g(this,xr,!0);try{return n()}finally{g(this,xr,!1)}}};je=new WeakMap,yr=new WeakMap,Vs=new WeakMap,js=new WeakMap,_i=new WeakMap,el=new WeakMap,xr=new WeakMap,tl=new WeakSet,Lp=function(){return i(this,je).error?i(this,je).error:i(this,_i)?i(this,yr).validity.valid?"":i(this,yr).validationMessage:""},il=new WeakMap,Fd=new WeakMap,Vd=new WeakMap;var O0=_("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."}),he,wr,Gt,sl,se,Pf,rl,jd,qf,Sp,Dp,Ap,zi=class extends T{constructor(){super(...arguments);m(this,se);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.inputMode="";this.size="default";this.patternMessage="";m(this,he,this.attachInternals());m(this,wr,new ee(this,i(this,he)));m(this,Gt,H("cm-tf"));m(this,sl,"")}connectedCallback(){super.connectedCallback(),g(this,sl,this.value)}get form(){return i(this,he).form}get validity(){return i(this,he).validity}get validationMessage(){return i(this,he).validationMessage}checkValidity(){return a(this,se,rl).call(this),i(this,he).checkValidity()}reportValidity(){return a(this,se,rl).call(this),i(this,wr).report(()=>i(this,he).reportValidity())}formResetCallback(){this.value=i(this,sl),this.error="",i(this,wr).reset()}formDisabledCallback(e){this.disabled=e}updated(){i(this,he).setFormValue(this.value),a(this,se,rl).call(this)}render(){let e=i(this,wr).message,t=[e&&`${i(this,Gt)}-err`,this.helpText&&`${i(this,Gt)}-help`].filter(Boolean).join(" ")||h,r={id:i(this,Gt),invalid:e?"true":h},s=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=${r.id} rows=${this.rows}
|
|
276
|
+
.value=${oe(this.value)} placeholder=${this.placeholder||h}
|
|
277
|
+
inputmode=${this.inputMode||h}
|
|
278
|
+
minlength=${s} maxlength=${l}
|
|
278
279
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
279
|
-
aria-invalid=${
|
|
280
|
-
@input=${
|
|
281
|
-
.value=${
|
|
282
|
-
autocomplete=${this.autocomplete??h}
|
|
280
|
+
aria-invalid=${r.invalid} aria-describedby=${t}
|
|
281
|
+
@input=${a(this,se,Sp)} @change=${a(this,se,Ap)} @blur=${a(this,se,Dp)}></textarea>`:c`<input class="input" part="input" id=${r.id} type=${this.type}
|
|
282
|
+
.value=${oe(this.value)} placeholder=${this.placeholder||h}
|
|
283
|
+
autocomplete=${this.autocomplete??h} inputmode=${this.inputMode||h}
|
|
283
284
|
min=${this.min||h} max=${this.max||h} step=${this.step||h}
|
|
284
|
-
pattern=${this.pattern||h} minlength=${
|
|
285
|
+
pattern=${this.pattern||h} minlength=${s} maxlength=${l}
|
|
285
286
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
286
|
-
aria-invalid=${
|
|
287
|
-
@input=${
|
|
288
|
-
${this.label?c`<label class="label" for=${
|
|
287
|
+
aria-invalid=${r.invalid} aria-describedby=${t}
|
|
288
|
+
@input=${a(this,se,Sp)} @change=${a(this,se,Ap)} @blur=${a(this,se,Dp)} />`;return c`<div class="field">
|
|
289
|
+
${this.label?c`<label class="label" for=${i(this,Gt)} 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
290
|
${d}
|
|
290
|
-
${e?c`<p class="error" id="${
|
|
291
|
-
${this.helpText?c`<p class="help" id="${
|
|
292
|
-
</div>`}};
|
|
291
|
+
${e?c`<p class="error" id="${i(this,Gt)}-err" role="alert">${e}</p>`:h}
|
|
292
|
+
${this.helpText?c`<p class="help" id="${i(this,Gt)}-help">${this.helpText}</p>`:h}
|
|
293
|
+
</div>`}};he=new WeakMap,wr=new WeakMap,Gt=new WeakMap,sl=new WeakMap,se=new WeakSet,Pf=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},rl=function(){let e=this.renderRoot.querySelector(".input"),t=e instanceof HTMLInputElement?e.validity:null,r=this.type==="time"||this.type==="datetime-local";this.error?i(this,he).setValidity({customError:!0},this.error,e??void 0):r&&t?.badInput?i(this,he).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.type==="number"&&t?.badInput?i(this,he).setValidity({badInput:!0},this.t("badNumber"),e??void 0):this.required&&!this.value?i(this,he).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.typeMismatch?i(this,he).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?i(this,he).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?i(this,he).setValidity({tooLong:!0},this.t("tooLong",{max:this.maxLength}),e??void 0):this.value&&!a(this,se,Pf).call(this,this.value)?i(this,he).setValidity({patternMismatch:!0},this.patternMessage||this.t("pattern"),e??void 0):!this.multiline&&t?.rangeUnderflow?i(this,he).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:a(this,se,jd).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?i(this,he).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:a(this,se,jd).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?i(this,he).setValidity({stepMismatch:!0},this.t("stepMismatch",a(this,se,qf).call(this,e)),e??void 0):i(this,he).setValidity({}),i(this,wr).sync()},jd=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?de(new Date(2e3,0,1,+l[1],+l[2]),{hour:"numeric",minute:"2-digit"},t):e}let r=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(e);if(!r)return e;let s=new Date(+r[1],+r[2]-1,+r[3],+(r[4]??0),+(r[5]??0));return this.type==="datetime-local"?de(s,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"},t):de(s,{day:"numeric",month:"short",year:"numeric"},t)},qf=function(e){let t=this.type==="date"?864e5:this.type==="time"||this.type==="datetime-local"?1e3:1,r=Number(this.step)*t||(this.type==="date"?864e5:this.type==="number"?1:6e4),s=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((s-d)/r)*r,u=b=>{if(this.type==="number")return this.formatNumber(Number(b.toPrecision(12)));let x=new Date(b).toISOString();return a(this,se,jd).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+r)}},Sp=function(e){this.value=e.target.value},Dp=function(){a(this,se,rl).call(this)},Ap=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},zi.formAssociated=!0,zi.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},zi.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:{},inputMode:{attribute:"inputmode"},size:{reflect:!0},min:{},max:{},step:{},pattern:{},patternMessage:{attribute:"pattern-message"},minLength:{type:Number,attribute:"minlength"},maxLength:{type:Number,attribute:"maxlength"}},zi.styles=[E,lt,w`
|
|
293
294
|
:host { display: block; }
|
|
294
295
|
.input {
|
|
295
296
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -305,13 +306,13 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
305
306
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
306
307
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
307
308
|
:host([error]:not([error=''])) .input, :host([data-cm-invalid]) .input { border-color: var(--cm-border-critical); }
|
|
308
|
-
`];$("cm-text-field",
|
|
309
|
-
<input type="checkbox" id=${
|
|
309
|
+
`];$("cm-text-field",zi);var W0=_("checkbox",{required:"Please tick this box."}),ct,$r,Yt,al,Ud,Of,Ci=class extends T{constructor(){super(...arguments);m(this,Ud);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;m(this,ct,this.attachInternals());m(this,$r,new ee(this,i(this,ct)));m(this,Yt,H("cm-cb"));m(this,al,!1)}connectedCallback(){super.connectedCallback(),g(this,al,this.checked)}get form(){return i(this,ct).form}get validity(){return i(this,ct).validity}get validationMessage(){return i(this,ct).validationMessage}checkValidity(){return i(this,ct).checkValidity()}reportValidity(){return i(this,$r).report(()=>i(this,ct).reportValidity())}formResetCallback(){this.checked=i(this,al),i(this,$r).reset()}formDisabledCallback(e){this.disabled=e}updated(){i(this,ct).setFormValue(this.checked?this.value:null),this.required&&!this.checked?i(this,ct).setValidity({valueMissing:!0},this.t("required")):i(this,ct).setValidity({}),i(this,$r).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=i(this,$r).message,r=[this.description&&`${i(this,Yt)}-d`,t&&`${i(this,Yt)}-err`].filter(Boolean).join(" ");return c`<label for=${i(this,Yt)}>
|
|
310
|
+
<input type="checkbox" id=${i(this,Yt)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
310
311
|
?disabled=${this.disabled} ?required=${this.required} aria-invalid=${t?"true":h}
|
|
311
|
-
aria-describedby=${
|
|
312
|
+
aria-describedby=${r||h} @change=${a(this,Ud,Of)} />
|
|
312
313
|
<span class="box" part="box">${e}</span>
|
|
313
|
-
${this.label||this.description?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${
|
|
314
|
-
</label>${t?c`<p class="error" id="${
|
|
314
|
+
${this.label||this.description?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${i(this,Yt)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
315
|
+
</label>${t?c`<p class="error" id="${i(this,Yt)}-err" role="alert">${t}</p>`:h}`}};ct=new WeakMap,$r=new WeakMap,Yt=new WeakMap,al=new WeakMap,Ud=new WeakSet,Of=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ci.formAssociated=!0,Ci.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Ci.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},Ci.styles=[E,w`
|
|
315
316
|
:host { display: inline-flex; flex-direction: column; }
|
|
316
317
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
317
318
|
/* The 16px box (18px on touch screens, owner standard 1.6) sits centred on the label's first line (20px); the
|
|
@@ -337,12 +338,12 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
337
338
|
/* 1.14: the field's own message, under the label text (past the box and its gap). */
|
|
338
339
|
.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
340
|
:host([data-cm-invalid]) .box, :host([data-cm-invalid]) label:hover input:not(:disabled) + .box { border-color: var(--cm-border-critical); }
|
|
340
|
-
`];$("cm-checkbox",
|
|
341
|
+
`];$("cm-checkbox",Ci);var nl,Er=class extends C{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;m(this,nl,H("cm-radio"))}render(){let e=this.description?`${i(this,nl)}-d`:null;return c`<div class="radio" part="radio" role="radio" id=${i(this,nl)}
|
|
341
342
|
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":h}
|
|
342
343
|
aria-describedby=${e??h} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
343
344
|
<span class="dot" part="dot"></span>
|
|
344
345
|
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?c`<span class="desc" id=${e}>${this.description}</span>`:h}</span>
|
|
345
|
-
</div>`}};
|
|
346
|
+
</div>`}};nl=new WeakMap,Er.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Er.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}},Er.styles=[E,w`
|
|
346
347
|
:host { display: inline-flex; }
|
|
347
348
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; outline: none; }
|
|
348
349
|
.dot {
|
|
@@ -364,16 +365,16 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
364
365
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
365
366
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
366
367
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
367
|
-
`];$("cm-radio",
|
|
368
|
-
aria-labelledby=${
|
|
368
|
+
`];$("cm-radio",Er);var e$=_("radioGroup",{required:"Please select one of these options."}),Ze,Tr,Xt,ol,ll,cl,Us,me,Rp,Wd,kr,Hp,Ks,Np,Gd,Yd,Kd,Mr=class extends T{constructor(){super();m(this,me);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;m(this,Ze,this.attachInternals());m(this,Tr,new ee(this,i(this,Ze)));m(this,Xt,H("cm-rg"));m(this,ol,"");m(this,ll,!0);m(this,cl,!1);m(this,Us,!1);m(this,Wd,()=>{a(this,me,Rp).call(this),i(this,Ks).call(this)});m(this,Ks,()=>{let e=a(this,me,kr).call(this),t=!1;for(let s of e)s.checked=!!this.value&&s.value===this.value&&!t,s.checked&&(t=!0),s.groupDisabled=this.disabled;let r=e.find(s=>s.checked&&!s.disabled)??a(this,me,Hp).call(this)[0];for(let s of e)s._tabbable=s===r&&!this.disabled});m(this,Gd,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||a(this,me,Np).call(this,t,!0)});m(this,Yd,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let r=a(this,me,Hp).call(this),s=r.indexOf(t),l=te(e,this),d;if(e.key==="ArrowDown"||l==="ArrowRight")d=r[(s+1)%r.length];else if(e.key==="ArrowUp"||l==="ArrowLeft")d=r[(s-1+r.length)%r.length];else if(e.key===" ")d=t.disabled?void 0:t;else return;e.preventDefault(),d&&a(this,me,Np).call(this,d,!0)});this.addEventListener("keydown",i(this,Yd)),this.addEventListener("click",i(this,Gd))}connectedCallback(){super.connectedCallback(),a(this,me,Rp).call(this)}get form(){return i(this,Ze).form}get validity(){return i(this,Ze).validity}get validationMessage(){return i(this,Ze).validationMessage}checkValidity(){return i(this,Ze).checkValidity()}reportValidity(){return i(this,Tr).report(()=>i(this,Ze).reportValidity())}formResetCallback(){this.value=i(this,ol),i(this,Tr).reset()}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(a(this,me,kr).call(this).find(t=>t._tabbable)??a(this,me,kr).call(this)[0])?.focus(e)}updated(e){e.has("value")&&i(this,cl)&&!i(this,Us)&&g(this,ll,!1),g(this,cl,!0),i(this,Ks).call(this),i(this,Ze).setFormValue(this.value||null,this.value);let t=a(this,me,kr).call(this)[0];this.error?i(this,Ze).setValidity({customError:!0},this.error,t):this.required&&!this.value?i(this,Ze).setValidity({valueMissing:!0},this.t("required"),t):i(this,Ze).setValidity({}),i(this,Tr).sync()}render(){let e=i(this,Tr).message,t=[e&&`${i(this,Xt)}-err`,this.helpText&&`${i(this,Xt)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
369
|
+
aria-labelledby=${a(this,me,Kd).call(this)?`${i(this,Xt)}-l`:h} aria-label=${a(this,me,Kd).call(this)?h:this.getAttribute("aria-label")??h}
|
|
369
370
|
aria-describedby=${t||h}
|
|
370
371
|
aria-required=${this.required?"true":h} aria-invalid=${e?"true":h}
|
|
371
372
|
aria-disabled=${this.disabled?"true":h}>
|
|
372
|
-
<span class="label" id="${
|
|
373
|
-
${this.helpText?c`<p class="help" id="${
|
|
374
|
-
${e?c`<p class="error" id="${
|
|
375
|
-
<div class="options" part="options"><slot @slotchange=${
|
|
376
|
-
</div>`}};
|
|
373
|
+
<span class="label" id="${i(this,Xt)}-l" part="label" ?hidden=${!a(this,me,Kd).call(this)}>${this.label}<slot name="label"></slot>${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
374
|
+
${this.helpText?c`<p class="help" id="${i(this,Xt)}-help">${this.helpText}</p>`:h}
|
|
375
|
+
${e?c`<p class="error" id="${i(this,Xt)}-err" role="alert">${e}</p>`:h}
|
|
376
|
+
<div class="options" part="options"><slot @slotchange=${i(this,Wd)}></slot></div>
|
|
377
|
+
</div>`}};Ze=new WeakMap,Tr=new WeakMap,Xt=new WeakMap,ol=new WeakMap,ll=new WeakMap,cl=new WeakMap,Us=new WeakMap,me=new WeakSet,Rp=function(){i(this,ll)&&(this.value||(g(this,Us,!0),this.value=a(this,me,kr).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>g(this,Us,!1))),g(this,ol,this.value))},Wd=new WeakMap,kr=function(){return[...this.querySelectorAll("cm-radio")]},Hp=function(){return a(this,me,kr).call(this).filter(e=>!e.disabled&&!this.disabled)},Ks=new WeakMap,Np=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,i(this,Ks).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Gd=new WeakMap,Yd=new WeakMap,Kd=function(){return!!this.label||!!this.querySelector("[slot=label]")},Mr.formAssociated=!0,Mr.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}},Mr.styles=[E,w`
|
|
377
378
|
:host { display: block; }
|
|
378
379
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
379
380
|
.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); }
|
|
@@ -382,13 +383,13 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
382
383
|
.error { color: var(--cm-text-critical); }
|
|
383
384
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
384
385
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
385
|
-
`];$("cm-radio-group",
|
|
386
|
-
<input type="checkbox" role="switch" id=${
|
|
386
|
+
`];$("cm-radio-group",Mr);var Ws,_r,dl,Xd,Bf,Li=class extends C{constructor(){super(...arguments);m(this,Xd);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;m(this,Ws,this.attachInternals());m(this,_r,H("cm-tg"));m(this,dl,!1)}connectedCallback(){super.connectedCallback(),g(this,dl,this.checked)}get form(){return i(this,Ws).form}checkValidity(){return i(this,Ws).checkValidity()}formResetCallback(){this.checked=i(this,dl)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){i(this,Ws).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${i(this,_r)}>
|
|
387
|
+
<input type="checkbox" role="switch" id=${i(this,_r)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
387
388
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
388
|
-
aria-describedby=${this.description?`${
|
|
389
|
+
aria-describedby=${this.description?`${i(this,_r)}-d`:h} @change=${a(this,Xd,Bf)} />
|
|
389
390
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
390
|
-
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${
|
|
391
|
-
</label>`}};
|
|
391
|
+
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${i(this,_r)}-d">${this.description}</span>`:h}</span>`:h}
|
|
392
|
+
</label>`}};Ws=new WeakMap,_r=new WeakMap,dl=new WeakMap,Xd=new WeakSet,Bf=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Li.formAssociated=!0,Li.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Li.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},Li.styles=[E,w`
|
|
392
393
|
:host { display: inline-flex; }
|
|
393
394
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
394
395
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -416,7 +417,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
416
417
|
:host([disabled]) .track { opacity: .5; }
|
|
417
418
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
418
419
|
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
419
|
-
`];$("cm-toggle",
|
|
420
|
+
`];$("cm-toggle",Li);var Gs=w`
|
|
420
421
|
.pop {
|
|
421
422
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-4)); inset-inline: 0;
|
|
422
423
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -428,7 +429,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
428
429
|
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
429
430
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
430
431
|
}
|
|
431
|
-
`;function
|
|
432
|
+
`;function Jd(o,n,e){let t=r=>{n()&&!r.composedPath().includes(o)&&e()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)}var Si=w`
|
|
432
433
|
[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); }
|
|
433
434
|
[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); }
|
|
434
435
|
.gh {
|
|
@@ -437,7 +438,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
437
438
|
}
|
|
438
439
|
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
439
440
|
.gopts { list-style: none; margin: 0; padding: 0; }
|
|
440
|
-
`;function
|
|
441
|
+
`;function Ys(o){if(!o.some(t=>t.group))return o;let n=[],e=new Map;for(let t of o)if(t.group){let r=e.get(t.group);if(r)r.push(t);else{let s=[t];e.set(t.group,s),n.push({key:t.group,items:s})}}else{let r=n[n.length-1];r&&!r.key?r.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 r=e.group||"",s=n[n.length-1];s&&s.group===r?s.rows.push({row:e,index:t}):n.push({group:r,rows:[{row:e,index:t}]})}),n}var Qd=w`
|
|
441
442
|
[role='listbox'] { padding-block: var(--cm-space-4); }
|
|
442
443
|
[role='listbox'][hidden] { display: none; }
|
|
443
444
|
[role='option'] {
|
|
@@ -456,35 +457,35 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
456
457
|
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;
|
|
457
458
|
color: var(--cm-text-tertiary); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-xs);
|
|
458
459
|
}
|
|
459
|
-
`;function
|
|
460
|
+
`;function eh(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 th(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 ih(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"}
|
|
460
461
|
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"}
|
|
461
|
-
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function
|
|
462
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function rh(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var f$=_("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),Qe,Cr,$e,Js,wt,Zs,ml,V,Ip,Lr,Pp,hl,Xs,zr,Di,sh,ah,pl,nh,Ff,oh,Ai=class extends T{constructor(){super(...arguments);m(this,V);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,Qe,this.attachInternals());m(this,Cr,new ee(this,i(this,Qe)));m(this,$e,H("cm-sel"));m(this,Js,"");m(this,wt,"");m(this,Zs,0);m(this,ml,new MutationObserver(()=>a(this,V,Ip).call(this)));m(this,Lr,new we);m(this,ah,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),a(this,V,hl).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),a(this,V,hl).call(this),a(this,V,Di).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let r=a(this,V,sh).call(this,t);a(this,V,hl).call(this,r>=0?r:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?a(this,V,zr).call(this,this._active):a(this,V,Di).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?a(this,V,zr).call(this,this._active):a(this,V,Di).call(this,-1);break;case"Home":e.preventDefault(),a(this,V,Di).call(this,"first");break;case"End":e.preventDefault(),a(this,V,Di).call(this,"last");break;case"PageDown":e.preventDefault(),a(this,V,Di).call(this,10);break;case"PageUp":e.preventDefault(),a(this,V,Di).call(this,-10);break;case"Enter":e.preventDefault(),a(this,V,zr).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),a(this,V,Xs).call(this);break;case"Tab":a(this,V,zr).call(this,this._active);break;case" ":if(e.preventDefault(),i(this,wt)&&Date.now()-i(this,Zs)<500){let r=a(this,V,sh).call(this," ");r>=0&&(this._active=r)}else a(this,V,zr).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let r=a(this,V,sh).call(this,t);r>=0&&(this._active=r)}}});m(this,pl,e=>{this.open&&!e.composedPath().includes(this)&&a(this,V,Xs).call(this)});m(this,nh,()=>{this.disabled||(this.open?a(this,V,Xs).call(this):a(this,V,hl).call(this))});m(this,oh,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),a(this,V,Ip).call(this),i(this,ml).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",i(this,pl),!0)}disconnectedCallback(){super.disconnectedCallback(),i(this,Lr).close(),i(this,ml).disconnect(),document.removeEventListener("pointerdown",i(this,pl),!0)}get form(){return i(this,Qe).form}get validity(){return i(this,Qe).validity}get validationMessage(){return i(this,Qe).validationMessage}checkValidity(){return i(this,Qe).checkValidity()}reportValidity(){return i(this,Cr).report(()=>i(this,Qe).reportValidity())}formResetCallback(){this.value=i(this,Js),this.open=!1,i(this,Cr).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?Ys(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):Ys(this._slotted)}firstUpdated(){i(this,Js)||g(this,Js,this.value)}updated(e){i(this,Qe).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?i(this,Qe).setValidity({customError:!0},this.error,t):this.required&&!this.value?i(this,Qe).setValidity({valueMissing:!0},this.t("required"),t):i(this,Qe).setValidity({}),i(this,Cr).sync(),e.has("open")?this.open?i(this,Lr).open(this.renderRoot.querySelector("[role=listbox]"),this.renderRoot.querySelector(".box"),{align:"stretch"}):i(this,Lr).close():this.open&&e.has("items")&&i(this,Lr).place(),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${i(this,$e)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(p=>p.value===this.value),r=i(this,Cr).message,s=[r&&`${i(this,$e)}-err`,this.helpText&&`${i(this,$e)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=(p,u)=>c`<li role="option" id="${i(this,$e)}-o${u}" class=${u===this._active?"active":""}
|
|
462
463
|
aria-selected=${p.value===this.value?"true":"false"} aria-disabled=${p.disabled?"true":h}
|
|
463
|
-
@pointerenter=${()=>!p.disabled&&(this._active=u)} @click=${()=>
|
|
464
|
-
${this.label?c`<span class="label" id="${
|
|
464
|
+
@pointerenter=${()=>!p.disabled&&(this._active=u)} @click=${()=>a(this,V,zr).call(this,u)}>${p.label}</li>`;return c`<div class="field">
|
|
465
|
+
${this.label?c`<span class="label" id="${i(this,$e)}-l" part="label" @click=${i(this,oh)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
465
466
|
<div class="wrap">
|
|
466
467
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
467
|
-
aria-labelledby=${this.label?`${
|
|
468
|
+
aria-labelledby=${this.label?`${i(this,$e)}-l`:h}
|
|
468
469
|
aria-label=${!this.label&&l?l:h}
|
|
469
|
-
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${
|
|
470
|
-
aria-activedescendant=${this.open&&this._active>=0?`${
|
|
471
|
-
aria-required=${this.required?"true":h} aria-invalid=${
|
|
472
|
-
aria-disabled=${this.disabled?"true":h} aria-describedby=${
|
|
473
|
-
@click=${
|
|
474
|
-
<span class="text ${t?"":"placeholder"}" id="${
|
|
470
|
+
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${i(this,$e)}-list"
|
|
471
|
+
aria-activedescendant=${this.open&&this._active>=0?`${i(this,$e)}-o${this._active}`:h}
|
|
472
|
+
aria-required=${this.required?"true":h} aria-invalid=${r?"true":h}
|
|
473
|
+
aria-disabled=${this.disabled?"true":h} aria-describedby=${s||h} aria-busy=${this.loading?"true":h}
|
|
474
|
+
@click=${i(this,nh)} @keydown=${i(this,ah)} @blur=${()=>a(this,V,Xs).call(this)}>
|
|
475
|
+
<span class="text ${t?"":"placeholder"}" id="${i(this,$e)}-v">${t?a(this,V,Ff).call(this,t):this.placeholder}</span>
|
|
475
476
|
${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>`}
|
|
476
477
|
</div>
|
|
477
|
-
<ul role="listbox" id="${
|
|
478
|
+
<ul role="listbox" id="${i(this,$e)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${i(this,$e)}-l`:h}
|
|
478
479
|
aria-label=${!this.label&&l?l:h} ?hidden=${!this.open}
|
|
479
480
|
@pointerdown=${p=>p.preventDefault()}>
|
|
480
|
-
${
|
|
481
|
+
${Zd(e).map((p,u)=>p.group?c`<li role="group" aria-labelledby="${i(this,$e)}-g${u}"><div role="presentation" class="gh" id="${i(this,$e)}-g${u}">${p.group}</div>
|
|
481
482
|
<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)))}
|
|
482
483
|
</ul>
|
|
483
484
|
</div>
|
|
484
|
-
${
|
|
485
|
-
${this.helpText?c`<p class="help" id="${
|
|
485
|
+
${r?c`<p class="error" id="${i(this,$e)}-err" role="alert">${r}</p>`:h}
|
|
486
|
+
${this.helpText?c`<p class="help" id="${i(this,$e)}-help">${this.helpText}</p>`:h}
|
|
486
487
|
<slot></slot>
|
|
487
|
-
</div>`}};
|
|
488
|
+
</div>`}};Qe=new WeakMap,Cr=new WeakMap,$e=new WeakMap,Js=new WeakMap,wt=new WeakMap,Zs=new WeakMap,ml=new WeakMap,V=new WeakSet,Ip=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let r=t.parentElement?.localName==="optgroup"?t.parentElement:null,s={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!r?.disabled};return r?.label&&(s.group=r.label),s}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,Js,this.value))},Lr=new WeakMap,Pp=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},hl=function(e){if(this.disabled||this.loading)return;let t=this.items.findIndex(r=>r.value===this.value);this.open=!0,this._active=e??(t>=0?t:a(this,V,Pp).call(this)[0]??-1)},Xs=function(){this.open=!1},zr=function(e){let t=this.items[e];!t||t.disabled||(a(this,V,Xs).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}))))},Di=function(e){let t=a(this,V,Pp).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 r=t.indexOf(this._active);this._active=r<0?t[0]:t[Math.min(t.length-1,Math.max(0,r+e))]},sh=function(e){let t=Date.now();g(this,wt,t-i(this,Zs)>500?e:i(this,wt)+e),g(this,Zs,t);let r=this.items,s=this._active<0?0:this._active,l=i(this,wt).split("").every(u=>u===i(this,wt)[0]),d=l?i(this,wt)[0]:i(this,wt),p=l||i(this,wt).length===1?s+1:s;for(let u=0;u<r.length;u++){let b=(p+u)%r.length;if(!r[b].disabled&&r[b].label.toLowerCase().startsWith(d.toLowerCase()))return b}return-1},ah=new WeakMap,pl=new WeakMap,nh=new WeakMap,Ff=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},oh=new WeakMap,Ai.formAssociated=!0,Ai.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Ai.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},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}},Ai.styles=[E,Ve,lt,Fs,Si,w`
|
|
488
489
|
:host { display: block; position: relative; }
|
|
489
490
|
.label { cursor: default; }
|
|
490
491
|
.wrap { position: relative; }
|
|
@@ -517,16 +518,16 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
517
518
|
[role='group'] { display: block; }
|
|
518
519
|
slot { display: none; }
|
|
519
520
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
520
|
-
`];$("cm-select",
|
|
521
|
+
`];$("cm-select",Ai);var E$=_("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),ea,lh,ul,Re,Qs,Vf,jf,qp,Ri=class extends T{constructor(){super(...arguments);m(this,Re);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;m(this,ea,this.attachInternals());m(this,lh,H("cm-search"));m(this,ul,"")}connectedCallback(){super.connectedCallback(),g(this,ul,this.value)}get form(){return i(this,ea).form}checkValidity(){return i(this,ea).checkValidity()}formResetCallback(){this.value=i(this,ul)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){i(this,ea).setFormValue(this.value)}render(){return c`<div class="box" part="box">
|
|
521
522
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
522
|
-
<input id=${
|
|
523
|
-
aria-label=${this.label} .value=${
|
|
524
|
-
@input=${
|
|
525
|
-
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${
|
|
523
|
+
<input id=${i(this,lh)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
524
|
+
aria-label=${this.label} .value=${oe(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
525
|
+
@input=${a(this,Re,Vf)} @change=${()=>a(this,Re,Qs).call(this,"change")} @keydown=${a(this,Re,jf)} />
|
|
526
|
+
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${a(this,Re,qp)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
526
527
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
527
528
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
528
|
-
@click=${()=>
|
|
529
|
-
</div>`}};
|
|
529
|
+
@click=${()=>a(this,Re,Qs).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}
|
|
530
|
+
</div>`}};ea=new WeakMap,lh=new WeakMap,ul=new WeakMap,Re=new WeakSet,Qs=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Vf=function(e){this.value=e.target.value},jf=function(e){e.key==="Enter"?a(this,Re,Qs).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),a(this,Re,qp).call(this))},qp=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),a(this,Re,Qs).call(this,"input"),a(this,Re,Qs).call(this,"change")},Ri.formAssociated=!0,Ri.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Ri.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}},Ri.styles=[E,lt,w`
|
|
530
531
|
:host { display: block; }
|
|
531
532
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
532
533
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -560,7 +561,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
560
561
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
561
562
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
562
563
|
:host([disabled]) button { cursor: not-allowed; }
|
|
563
|
-
`];$("cm-search",
|
|
564
|
+
`];$("cm-search",Ri);var L$=_("tag",{remove:"Remove {label}"}),ch,Uf,Sr=class extends T{constructor(){super(...arguments);m(this,ch);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=${a(this,ch,Uf)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};ch=new WeakSet,Uf=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Sr.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Sr.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Sr.styles=[E,w`
|
|
564
565
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
565
566
|
.tag {
|
|
566
567
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -578,47 +579,47 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
578
579
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
579
580
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
|
|
580
581
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
|
|
581
|
-
`];$("cm-tag",
|
|
582
|
-
`):[]:this.value=e)}get items(){return this.options?.length?
|
|
583
|
-
`))}else
|
|
582
|
+
`];$("cm-tag",Sr);var B$=_("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"}),He,Rr,ke,vl,ra,yl,xl,wl,A,Op,Kf,gl,dh,fl,Zt,ta,ia,Jt,Wf,bl,Bp,Fp,Dr,hh,mh,Ar,Gf,ph,uh,gh,Yf,Xf,Hi=class extends T{constructor(){super(...arguments);m(this,A);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,He,this.attachInternals());m(this,Rr,new ee(this,i(this,He)));m(this,ke,H("cm-cb"));m(this,vl,null);m(this,ra,new Map);m(this,yl,new Map);m(this,xl,new MutationObserver(()=>a(this,A,Op).call(this)));m(this,wl);m(this,Zt,new we);m(this,hh,()=>{this._focusIn=!0});m(this,mh,()=>{setTimeout(()=>{this._focusIn=this.matches(":focus-within")})});m(this,ph,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,a(this,A,ia).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});m(this,uh,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?a(this,A,bl).call(this,1):(a(this,A,ia).call(this),e.altKey||a(this,A,bl).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?a(this,A,bl).call(this,-1):(a(this,A,ia).call(this),a(this,A,bl).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),a(this,A,Bp).call(this,this._active)):i(this,A,dh)&&(e.preventDefault(),a(this,A,Fp).call(this,i(this,A,dh)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),a(this,A,Jt).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",a(this,A,ta).call(this)));break;case"ArrowLeft":case"ArrowRight":{let r=e.target;this.multiple&&this.values.length&&te(e,this)==="ArrowLeft"&&r.selectionStart===0&&r.selectionEnd===0&&(e.preventDefault(),a(this,A,Jt).call(this),a(this,A,Ar).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":a(this,A,Jt).call(this);break;default:}});m(this,gh,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(a(this,A,Jt).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?a(this,A,gl).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),a(this,A,Op).call(this),i(this,xl).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),g(this,wl,Jd(this,()=>this.open,()=>a(this,A,Jt).call(this))),this.addEventListener("focusin",i(this,hh)),this.addEventListener("focusout",i(this,mh))}disconnectedCallback(){var e;super.disconnectedCallback(),i(this,Zt).close(),i(this,xl).disconnect(),(e=i(this,wl))==null||e.call(this)}get form(){return i(this,He).form}get validity(){return i(this,He).validity}get validationMessage(){return i(this,He).validationMessage}checkValidity(){return i(this,He).checkValidity()}reportValidity(){return i(this,Rr).report(()=>i(this,He).reportValidity())}formResetCallback(){let e=i(this,vl)??{value:"",values:[]};this.value=e.value,this.values=[...e.values],this._query="",this._typing=!1,this.open=!1,i(this,Rr).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){typeof e=="string"&&(this.multiple?this.values=e?e.split(`
|
|
583
|
+
`):[]:this.value=e)}get items(){return this.options?.length?Ys(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):Ys(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let r=t.label.toLowerCase();return this.filter==="starts-with"?r.startsWith(e):r.includes(e)})}firstUpdated(){g(this,vl,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)i(this,ra).set(t.value,t.label),t.group&&i(this,yl).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?a(this,A,gl).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=a(this,A,fl).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.open;t&&!i(this,Zt).active?i(this,Zt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&i(this,Zt).active?i(this,Zt).close():t&&i(this,Zt).place();let r=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);i(this,He).setFormValue(l,this.values.join(`
|
|
584
|
+
`))}else i(this,He).setFormValue(null);else i(this,He).setFormValue(this.value||null,this.value);let s=this.multiple?!this.values.length:!this.value;this.error?i(this,He).setValidity({customError:!0},this.error,r):this.required&&s?i(this,He).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),r):i(this,He).setValidity({}),i(this,Rr).sync(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${i(this,ke)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),a(this,A,ta).call(this))}focus(e){this.renderRoot.querySelector("input")?.focus(e)}render(){let e=a(this,A,fl).call(this),t=i(this,Rr).message,r=[t&&`${i(this,ke)}-err`,this.helpText&&`${i(this,ke)}-help`].filter(Boolean).join(" "),s=this.getAttribute("aria-label"),l=u=>this.multiple?this.values.includes(u):u===this.value,d=(u,b)=>c`<li role="option" id="${i(this,ke)}-o${b}" class=${b===this._active?"active":""}
|
|
584
585
|
aria-selected=${u.create?"false":l(u.value)?"true":"false"} aria-disabled=${u.disabled?"true":h}
|
|
585
|
-
@pointerenter=${()=>!u.disabled&&(this._active=b)} @click=${()=>
|
|
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>${
|
|
587
|
-
${this.label?c`<label class="label" id="${
|
|
586
|
+
@pointerenter=${()=>!u.disabled&&(this._active=b)} @click=${()=>a(this,A,Bp).call(this,b)}>
|
|
587
|
+
${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>${a(this,A,Yf).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">
|
|
588
|
+
${this.label?c`<label class="label" id="${i(this,ke)}-l" for="${i(this,ke)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
588
589
|
<div class="wrap">
|
|
589
|
-
<div class="box" part="box" @click=${u=>{u.target.closest("cm-tag[removable]")||
|
|
590
|
+
<div class="box" part="box" @click=${u=>{u.target.closest("cm-tag[removable]")||a(this,A,Dr).call(this)}}>
|
|
590
591
|
<div class="chips ${this.multiple&&this.values.length?`has-tags${this._focusIn||this.open?"":" idle"}`:""}">
|
|
591
|
-
${this.multiple?
|
|
592
|
-
<input id="${
|
|
593
|
-
.value=${
|
|
594
|
-
aria-label=${!this.label&&
|
|
595
|
-
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${
|
|
596
|
-
aria-activedescendant=${this.open&&this._active>=0?`${
|
|
597
|
-
aria-invalid=${t?"true":h} aria-describedby=${
|
|
592
|
+
${this.multiple?a(this,A,Xf).call(this):h}
|
|
593
|
+
<input id="${i(this,ke)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
594
|
+
.value=${oe(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
595
|
+
aria-label=${!this.label&&s?s:h}
|
|
596
|
+
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${i(this,ke)}-list"
|
|
597
|
+
aria-activedescendant=${this.open&&this._active>=0?`${i(this,ke)}-o${this._active}`:h}
|
|
598
|
+
aria-invalid=${t?"true":h} aria-describedby=${r||h}
|
|
598
599
|
aria-required=${this.required?"true":h} ?disabled=${this.disabled}
|
|
599
|
-
@input=${
|
|
600
|
-
@click=${()=>{this.open||
|
|
600
|
+
@input=${i(this,ph)} @keydown=${i(this,uh)} @blur=${i(this,gh)}
|
|
601
|
+
@click=${()=>{this.open||a(this,A,ia).call(this)}} @change=${u=>u.stopPropagation()} />
|
|
601
602
|
</div>
|
|
602
|
-
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?
|
|
603
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?a(this,A,Jt).call(this):(a(this,A,ia).call(this),a(this,A,Dr).call(this))}}></cm-icon>
|
|
603
604
|
</div>
|
|
604
605
|
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${u=>u.preventDefault()}>
|
|
605
|
-
<ul role="listbox" id="${
|
|
606
|
-
aria-labelledby=${this.label?`${
|
|
606
|
+
<ul role="listbox" id="${i(this,ke)}-list" part="listbox" ?hidden=${!e.length}
|
|
607
|
+
aria-labelledby=${this.label?`${i(this,ke)}-l`:h} aria-label=${!this.label&&s?s:h}
|
|
607
608
|
aria-multiselectable=${this.multiple?"true":h}>
|
|
608
|
-
${
|
|
609
|
+
${Zd(e).map((u,b)=>u.group?c`<li role="group" aria-labelledby="${i(this,ke)}-g${b}"><div role="presentation" class="gh" id="${i(this,ke)}-g${b}">${u.group}</div>
|
|
609
610
|
<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)))}
|
|
610
611
|
</ul>
|
|
611
612
|
${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>`}
|
|
612
613
|
</div>
|
|
613
614
|
</div>
|
|
614
615
|
<span class="vh" role="status" aria-live="polite">${p}</span>
|
|
615
|
-
${t?c`<p class="error" id="${
|
|
616
|
-
${this.helpText?c`<p class="help" id="${
|
|
616
|
+
${t?c`<p class="error" id="${i(this,ke)}-err" role="alert">${t}</p>`:h}
|
|
617
|
+
${this.helpText?c`<p class="help" id="${i(this,ke)}-help">${this.helpText}</p>`:h}
|
|
617
618
|
<slot></slot>
|
|
618
|
-
</div>`}};
|
|
619
|
-
remove-label=${this.t("remove",{label:
|
|
620
|
-
@keydown=${l=>
|
|
621
|
-
@cm-remove=${()=>{this.removeValue(
|
|
619
|
+
</div>`}};He=new WeakMap,Rr=new WeakMap,ke=new WeakMap,vl=new WeakMap,ra=new WeakMap,yl=new WeakMap,xl=new WeakMap,wl=new WeakMap,A=new WeakSet,Op=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>{let r=t.parentElement?.localName==="optgroup"?t.parentElement:null,s={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!r?.disabled};return r?.label&&(s.group=r.label),s}),!this.hasUpdated){let t=e.filter(r=>r.hasAttribute("selected")).map(r=>r.value);this.multiple&&!this.values.length&&t.length&&(this.values=t),!this.multiple&&!this.value&&t.length&&(this.value=t[0])}},Kf=function(e){return this.items.find(t=>t.value===e)?.label??i(this,ra).get(e)??e},gl=function(e){let t=a(this,A,Kf).call(this,e);if(!this.showGroup)return t;let r=this.items.find(s=>s.value===e)?.group??i(this,yl).get(e);return r?this.t("grouped",{group:r,label:t}):t},dh=function(){if(!this.allowCustom||!this._typing)return"";let e=this._query.trim();if(!e)return"";let t=e.toLowerCase();return this.items.some(r=>r.label.toLowerCase()===t||r.value.toLowerCase()===t)||(this.multiple?this.values.some(r=>r.toLowerCase()===t):this.value.toLowerCase()===t)?"":e},fl=function(){let e=this.loading?[]:[...this.filteredItems],t=i(this,A,dh);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},Zt=new WeakMap,ta=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ia=function(){this.disabled||(this.open=!0)},Jt=function(){this.open=!1,this._active=-1},Wf=function(e=a(this,A,fl).call(this)){return e.flatMap((t,r)=>t.disabled?[]:[r])},bl=function(e){let t=a(this,A,Wf).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 r=t.indexOf(this._active);if(r<0){this._active=e>0?t[0]:t[t.length-1];return}this._active=t[(r+e+t.length)%t.length]},Bp=function(e){let t=a(this,A,fl).call(this)[e];if(!(!t||t.disabled)){if(t.create){a(this,A,Fp).call(this,t.value);return}if(this.multiple){this.values=this.values.includes(t.value)?this.values.filter(r=>r!==t.value):[...this.values,t.value],this._query="",this._typing=!1,this._active=-1,a(this,A,ta).call(this),a(this,A,Dr).call(this);return}a(this,A,Jt).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,a(this,A,ta).call(this))}},Fp=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(i(this,ra).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(a(this,A,Jt).call(this),this.value=e,this._typing=!1,this._query=e),a(this,A,ta).call(this))},Dr=function(){this.renderRoot.querySelector("input")?.focus()},hh=new WeakMap,mh=new WeakMap,Ar=async function(e){await this.updateComplete;let t=this.renderRoot.querySelectorAll("cm-tag[data-i]");e>=0&&e<t.length?t[e].focus():a(this,A,Dr).call(this)},Gf=function(e,t){let r=te(e,this),s=this.values.length-1;if(r==="ArrowLeft")e.preventDefault(),a(this,A,Ar).call(this,Math.max(0,t-1));else if(r==="ArrowRight")e.preventDefault(),a(this,A,Ar).call(this,t<s?t+1:-1);else if(r==="Home")e.preventDefault(),a(this,A,Ar).call(this,0);else if(r==="End")e.preventDefault(),a(this,A,Ar).call(this,s);else if(r==="Escape")e.preventDefault(),e.stopPropagation(),a(this,A,Dr).call(this);else if((r==="Backspace"||r==="Delete")&&!this.disabled){e.preventDefault(),this.removeValue(this.values[t]);let l=this.values.length;a(this,A,Ar).call(this,r==="Backspace"?t>0?t-1:l?0:-1:t<l?t:-1)}},ph=new WeakMap,uh=new WeakMap,gh=new WeakMap,Yf=function(e){let t=this._typing?this._query.trim():"";if(!t||this.filter==="none")return e;let r=e.toLowerCase().indexOf(t.toLowerCase());return r<0||this.filter==="starts-with"&&r!==0?e:c`${e.slice(0,r)}<mark>${e.slice(r,r+t.length)}</mark>${e.slice(r+t.length)}`},Xf=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((r,s)=>c`<cm-tag removable tabindex="-1" data-i=${s} part="tag" ?disabled=${this.disabled}
|
|
620
|
+
remove-label=${this.t("remove",{label:a(this,A,gl).call(this,r)})}
|
|
621
|
+
@keydown=${l=>a(this,A,Gf).call(this,l,s)}
|
|
622
|
+
@cm-remove=${()=>{this.removeValue(r),a(this,A,Dr).call(this)}}>${a(this,A,gl).call(this,r)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},Hi.formAssociated=!0,Hi.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Hi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},values:{type:Array},placeholder:{},options:{type:Array},multiple:{type:Boolean,reflect:!0},size:{reflect:!0},allowCustom:{type:Boolean,attribute:"allow-custom"},filter:{},loading:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},maxTags:{type:Number,attribute:"max-tags"},_query:{state:!0},_focusIn:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},Hi.styles=[E,lt,Ve,Gs,Fs,Si,w`
|
|
622
623
|
:host { display: block; position: relative; }
|
|
623
624
|
.wrap { position: relative; }
|
|
624
625
|
.box {
|
|
@@ -659,31 +660,31 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
659
660
|
.create { font-style: normal; }
|
|
660
661
|
slot { display: none; }
|
|
661
662
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
662
|
-
`];$("cm-combobox",
|
|
663
|
+
`];$("cm-combobox",Hi);function $l(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var Sx={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"};function fh(o,n){let e=o.trim().toLowerCase().split("+").map(s=>s.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 r={key:Sx[t]??t,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let s of e)if(s==="mod")n?r.meta=!0:r.ctrl=!0;else if(s==="ctrl"||s==="control")r.ctrl=!0;else if(s==="meta"||s==="cmd"||s==="command")r.meta=!0;else if(s==="alt"||s==="option"||s==="opt")r.alt=!0;else if(s==="shift")r.shift=!0;else return null;return r}function Vp(o,n=$l()){let e=fh(o,n);return!!e&&(e.ctrl||e.meta||e.alt)}function jp(o,n,e=$l()){let t=fh(n,e);if(!t||!o.key||o.ctrlKey!==t.ctrl||o.metaKey!==t.meta||o.altKey!==t.alt)return!1;let r=/^[a-z0-9]$/.test(t.key);return(r||t.key.length>1)&&o.shiftKey!==t.shift?!1:o.key.toLowerCase()===t.key?!0:r?o.code===(/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`):!1}function bh(o){let n=o.composedPath()[0];return!!n&&(n.isContentEditable||/^(input|textarea|select)$/i.test(n.localName??""))}var Dx={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7"},Ax={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},Rx={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"},Hx=o=>Rx[o]??(o.length===1?o.toUpperCase():o[0].toUpperCase()+o.slice(1));function vh(o,n=$l()){let e=[];for(let t of o.trim().split(/\s+/).filter(Boolean)){let r=fh(t,n);if(!r)return[o.trim()];let s=n?Dx:Ax,l=n?["ctrl","alt","shift","meta"]:["ctrl","meta","alt","shift"];for(let d of l)r[d]&&e.push(s[d]);e.push(Hx(r.key))}return e}function Jf(o,n=$l()){if(/\s/.test(o.trim()))return"";let e=fh(o,n);if(!e)return"";let t=e.key===" "?"Space":e.key.length===1?e.key.toUpperCase():e.key.replace(/^(arrow|page)?(\w)/,(r,s,l)=>s?`${s[0].toUpperCase()}${s.slice(1)}${l.toUpperCase()}`:l.toUpperCase());return[e.ctrl&&"Control",e.meta&&"Meta",e.alt&&"Alt",e.shift&&"Shift",t].filter(Boolean).join("+")}var Z$=_("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),dt,El,Z,yh,kl,Qt,sa,Up,xh,Zf,wh,Ml,Kp,Qf,Hr=class extends T{constructor(){super(...arguments);m(this,Z);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;m(this,dt,H("cm-gs"));m(this,El);m(this,Qt,new we);m(this,xh,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),a(this,Z,Up).call(this)});m(this,wh,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),a(this,Z,Zf).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":i(this,Z,kl)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${i(this,dt)}-o${this._active}`)?.click());break;case"Escape":i(this,Z,kl)?(e.preventDefault(),e.stopPropagation(),a(this,Z,sa).call(this)):this.value&&(e.preventDefault(),a(this,Z,Kp).call(this,!1));break;case"Tab":a(this,Z,sa).call(this);break;default:}});m(this,Ml,e=>{!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented||bh(e)||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),g(this,El,Jd(this,()=>this.open,()=>a(this,Z,sa).call(this))),document.addEventListener("keydown",i(this,Ml))}disconnectedCallback(){var e;super.disconnectedCallback(),i(this,Qt).close(),(e=i(this,El))==null||e.call(this),document.removeEventListener("keydown",i(this,Ml))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=a(this,Z,yh).call(this).length&&(this._active=-1)}updated(e){let t=i(this,Z,kl);t&&!i(this,Qt).active?i(this,Qt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&i(this,Qt).active?i(this,Qt).close():t&&i(this,Qt).place(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${i(this,dt)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=a(this,Z,yh).call(this),t=i(this,Z,kl),r=e.filter(u=>u.item).length,s=this.loading&&t?this.loadingText:t?e.length?this.t("results",{count:r}):this.emptyText:"",l=-1,d=(this.results??[]).filter(u=>u?.items?.length),p=(u,b,f="")=>{let x=++l;return ih({id:`${i(this,dt)}-o${x}`,active:x===this._active,href:u.href,cls:f,onHover:()=>this._active=x,onChoose:y=>a(this,Z,Qf).call(this,y,u)},b)};return c`<div class="wrap">
|
|
663
664
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
664
665
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
665
666
|
|
|
666
|
-
<input id="${
|
|
667
|
-
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${
|
|
668
|
-
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${
|
|
669
|
-
aria-activedescendant=${t&&this._active>=0?`${
|
|
667
|
+
<input id="${i(this,dt)}-in" part="input" type="search" role="combobox" enterkeyhint="search" autocomplete="off" spellcheck="false"
|
|
668
|
+
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${oe(this.value)}
|
|
669
|
+
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${i(this,dt)}-list"
|
|
670
|
+
aria-activedescendant=${t&&this._active>=0?`${i(this,dt)}-o${this._active}`:h}
|
|
670
671
|
aria-keyshortcuts=${this.shortcut||h}
|
|
671
|
-
@input=${
|
|
672
|
+
@input=${i(this,xh)} @keydown=${i(this,wh)}
|
|
672
673
|
@focus=${()=>{this.value.trim()&&(this.open=!0)}} @click=${()=>{this.value.trim()&&(this.open=!0)}} />
|
|
673
|
-
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>
|
|
674
|
+
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>a(this,Z,Kp).call(this)}><cm-icon name="close" size="14"></cm-icon></button>`:this.shortcut?c`<kbd aria-hidden="true">${this.shortcut}</kbd>`:h}
|
|
674
675
|
</div>
|
|
675
676
|
<div class="pop" part="popover" ?hidden=${!t} @pointerdown=${u=>u.preventDefault()}>
|
|
676
|
-
<div role="listbox" id="${
|
|
677
|
-
${d.map((u,b)=>{let f=u.total??u.items.length;return c`<div role="group" aria-labelledby="${
|
|
678
|
-
${
|
|
679
|
-
${u.items.map(x=>p({group:u,item:x,href:x.href},
|
|
677
|
+
<div role="listbox" id="${i(this,dt)}-list" part="listbox" aria-label=${this.label} ?hidden=${!e.length}>
|
|
678
|
+
${d.map((u,b)=>{let f=u.total??u.items.length;return c`<div role="group" aria-labelledby="${i(this,dt)}-g${b}">
|
|
679
|
+
${eh(`${i(this,dt)}-g${b}`,u.label,this.formatNumber(f),this.t("results",{count:f}))}
|
|
680
|
+
${u.items.map(x=>p({group:u,item:x,href:x.href},th(x)))}
|
|
680
681
|
${u.href?p({group:u,href:u.href},c`<span class="text">${u.seeAllLabel||this.seeAllLabel}</span>`,"all"):h}
|
|
681
682
|
</div>`})}
|
|
682
683
|
</div>
|
|
683
684
|
${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>`}
|
|
684
685
|
</div>
|
|
685
|
-
<span class="vh" role="status" aria-live="polite">${
|
|
686
|
-
</div>`}};
|
|
686
|
+
<span class="vh" role="status" aria-live="polite">${s}</span>
|
|
687
|
+
</div>`}};dt=new WeakMap,El=new WeakMap,Z=new WeakSet,yh=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}]:[]])},kl=function(){return this.open&&!!this.value.trim()},Qt=new WeakMap,sa=function(){this.open=!1,this._active=-1},Up=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},xh=new WeakMap,Zf=function(e){this._active=rh(this._active,e,a(this,Z,yh).call(this).length)},wh=new WeakMap,Ml=new WeakMap,Kp=function(e=!0){this.value="",a(this,Z,sa).call(this),e&&this.renderRoot.querySelector("input")?.focus(),a(this,Z,Up).call(this)},Qf=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(),a(this,Z,sa).call(this)},Hr.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Hr.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}},Hr.styles=[E,Ve,Gs,Si,Qd,w`
|
|
687
688
|
:host { display: block; position: relative; }
|
|
688
689
|
.wrap { position: relative; }
|
|
689
690
|
.box {
|
|
@@ -713,15 +714,15 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
713
714
|
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
714
715
|
}
|
|
715
716
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
716
|
-
`];$("cm-global-search",
|
|
717
|
+
`];$("cm-global-search",Hr);var Wp=0,eb="";function Gp(){Wp++===0&&(eb=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function Tl(){Wp>0&&--Wp===0&&(document.documentElement.style.overflow=eb)}function Yp(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var aa,ei,na,oa,$h,kh,Eh,Mh,Th,_h,ae=class extends T{constructor(){super(...arguments);m(this,oa);this.open=!1;this.label="";this.uid=H("cm-ovl");m(this,aa,null);m(this,ei,!1);m(this,na,!1);m(this,kh,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});m(this,Eh,e=>{e.preventDefault(),this.requestClose("escape")});m(this,Mh,()=>{this.open&&!this.dialog?.open&&(this.open=!1,a(this,oa,$h).call(this))});m(this,Th,e=>{g(this,na,e.target===e.currentTarget)});m(this,_h,e=>{if(e.target===e.currentTarget&&i(this,na)){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,na,!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(),a(this,oa,$h).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,aa,Yp()),!this.isConnected)return;t.showModal(),i(this,ei)||(Gp(),g(this,ei,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),a(this,oa,$h).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),i(this,ei)&&(Tl(),g(this,ei,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
717
718
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
718
719
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
719
720
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
720
721
|
</header>`}renderDialog(e,t=""){return c`<dialog part="dialog" class=${t}
|
|
721
722
|
aria-labelledby=${this.heading?`${this.uid}-h`:h}
|
|
722
723
|
aria-label=${!this.heading&&this.label?this.label:h}
|
|
723
|
-
@keydown=${
|
|
724
|
-
@pointerdown=${
|
|
724
|
+
@keydown=${i(this,kh)} @cancel=${i(this,Eh)} @close=${i(this,Mh)}
|
|
725
|
+
@pointerdown=${i(this,Th)} @click=${i(this,_h)}>${e}</dialog>`}};aa=new WeakMap,ei=new WeakMap,na=new WeakMap,oa=new WeakSet,$h=function(){i(this,ei)&&(Tl(),g(this,ei,!1));let e=i(this,aa);g(this,aa,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},kh=new WeakMap,Eh=new WeakMap,Mh=new WeakMap,Th=new WeakMap,_h=new WeakMap,ae.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},ae.overlayStyles=[E,w`
|
|
725
726
|
:host { display: contents; }
|
|
726
727
|
dialog {
|
|
727
728
|
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
@@ -753,32 +754,32 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
753
754
|
|
|
754
755
|
}
|
|
755
756
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
756
|
-
`];var
|
|
757
|
+
`];var p1=_("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"}),tb=o=>o.normalize("NFD").replace(/\p{M}/gu,"").toLocaleLowerCase();function ib(o,n){let e=tb(n).split(/\s+/).filter(Boolean);if(!e.length)return!0;let t=tb([o.title,...o.keywords??[]].join(" "));return e.every(r=>t.includes(r))}var zl,Te,Xp,Jp,_l,zh,Ch,rb,sb,la=class extends ae{constructor(){super();m(this,Te);this.value="";this.results=[];this.actions=[];this.recent=[];this.loading=!1;this.shortcut="";this._active=-1;m(this,zl,e=>{!this.shortcut||e.defaultPrevented||e.repeat||!jp(e,this.shortcut)||!this.open&&!Vp(this.shortcut)&&bh(e)||this.open&&!Vp(this.shortcut)||(e.preventDefault(),this.toggle())});m(this,zh,e=>{this.value=e.target.value,this._active=a(this,Te,_l).call(this).length?0:-1,this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))});m(this,Ch,e=>{let t=a(this,Te,_l).call(this).length;switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this._active=rh(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",i(this,zl))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",i(this,zl))}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=a(this,Te,_l).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?a(this,Te,Jp).call(this):[],t=a(this,Te,_l).call(this,e),r=i(this,Te,Xp),s=t.filter(u=>u.item).length,l=!this.open||!r?"":this.loading?this.loadingText:t.length?this.t("results",{count:s}):this.emptyText,d=this.uid,p=-1;return this.renderDialog(c`<div class="panel" part="panel">
|
|
757
758
|
<div class="top">
|
|
758
759
|
<div class="box" part="box">
|
|
759
760
|
<cm-icon name="search" size="16"></cm-icon>
|
|
760
761
|
<input id="${d}-in" part="input" type="text" role="combobox" enterkeyhint="go" autocomplete="off" spellcheck="false"
|
|
761
|
-
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${
|
|
762
|
+
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${oe(this.value)}
|
|
762
763
|
aria-autocomplete="list" aria-expanded=${t.length?"true":"false"} aria-controls="${d}-list"
|
|
763
764
|
aria-activedescendant=${this._active>=0&&t.length?`${d}-o${this._active}`:h}
|
|
764
|
-
@input=${
|
|
765
|
-
<kbd class="esc" aria-hidden="true">${
|
|
765
|
+
@input=${i(this,zh)} @keydown=${i(this,Ch)} />
|
|
766
|
+
<kbd class="esc" aria-hidden="true">${vh("escape")[0]}</kbd>
|
|
766
767
|
</div>
|
|
767
768
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel} @click=${()=>this.requestClose("close-button")}>
|
|
768
769
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
769
770
|
</div>
|
|
770
771
|
<div class="list" part="results" @pointerdown=${u=>{u.target.closest?.("[role=option]")&&u.preventDefault()}}>
|
|
771
|
-
${this.loading&&
|
|
772
|
+
${this.loading&&r?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText}</span></p>`:h}
|
|
772
773
|
<div role="listbox" id="${d}-list" part="listbox" aria-label=${this.label} ?hidden=${!t.length}>
|
|
773
774
|
${e.map((u,b)=>c`<div role="group" aria-labelledby="${d}-g${b}">
|
|
774
|
-
${
|
|
775
|
-
${u.rows.map(f=>{let x=++p,y=f.item;return
|
|
775
|
+
${eh(`${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}))}
|
|
776
|
+
${u.rows.map(f=>{let x=++p,y=f.item;return ih({id:`${d}-o${x}`,active:x===this._active,href:f.href,cls:y?"":"all",keyshortcuts:y?.shortcut?Jf(y.shortcut):void 0,onHover:()=>this._active=x,onChoose:k=>a(this,Te,rb).call(this,k,f)},y?th(y,a(this,Te,sb).call(this,y.shortcut)):c`<span class="text">${f.group.seeAllLabel||this.seeAllLabel}</span>`)})}
|
|
776
777
|
</div>`)}
|
|
777
778
|
</div>
|
|
778
|
-
${
|
|
779
|
+
${r&&!this.loading&&!t.length?c`<p class="message" aria-hidden="true">${this.emptyText}</p>`:h}
|
|
779
780
|
</div>
|
|
780
781
|
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
781
|
-
</div>`)}};
|
|
782
|
+
</div>`)}};zl=new WeakMap,Te=new WeakSet,Xp=function(){return this.value.trim()},Jp=function(){let e=i(this,Te,Xp),t=[],r=(s,l,d=!1)=>{let p=l.map(u=>({group:s,item:u,href:u.href}));d&&s.href&&p.push({group:s,href:s.href}),l.length&&t.push({group:s,rows:p})};if(!e)this.recent?.length&&r({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let s of this.results??[])s?.items?.length&&r(s,s.items,!0);for(let s of this.actions??[])s?.items?.length&&r(s,e?s.items.filter(l=>ib(l,e)):s.items);return t},_l=function(e=a(this,Te,Jp).call(this)){return e.flatMap(t=>t.rows)},zh=new WeakMap,Ch=new WeakMap,rb=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)},sb=function(e){return e?c`<span class="keys" aria-hidden="true">${vh(e).map(t=>c`<kbd>${t}</kbd>`)}</span>`:h},la.properties={...ae.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}},la.styles=[...ae.overlayStyles,Gs,Si,Qd,w`
|
|
782
783
|
dialog {
|
|
783
784
|
position: fixed; inset: 0; margin: max(var(--cm-space-16), 12dvh) auto auto; height: fit-content;
|
|
784
785
|
width: min(var(--cm-command-palette-width, 640px), calc(100vw - 32px));
|
|
@@ -819,20 +820,20 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
819
820
|
.x { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
820
821
|
[role='option'] { min-height: var(--cm-control-height-touch); }
|
|
821
822
|
}
|
|
822
|
-
`];$("cm-command-palette",
|
|
823
|
-
|
|
823
|
+
`];$("cm-command-palette",la);var Nx=/^(\d{4})-(\d{2})-(\d{2})$/;function N(o){let n=Nx.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 Dt=(o,n=2)=>String(o).padStart(n,"0"),O=o=>`${Dt(o.getFullYear(),4)}-${Dt(o.getMonth()+1)}-${Dt(o.getDate())}`,Zp=()=>O(new Date),X=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function Ee(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 $t=o=>new Date(o.getFullYear(),o.getMonth(),1),ca=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var Ix=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function be(o){let n=Ix.exec(o??"");return n?+n[1]*60+ +n[2]:null}var ti=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${Dt(Math.floor(n/60))}:${Dt(n%60)}`};function ht(o){let[n="",e=""]=(o??"").split("T"),t=be(e);return{date:N(n)?n:"",time:t===null?"":ti(t)}}function At(o,n=!1){let{date:e,time:t}=ht(o),r=N(e);if(!r)return null;let s=t?be(t):n?1439:0;return new Date(r.getFullYear(),r.getMonth(),r.getDate(),Math.floor(s/60),s%60)}var ob=()=>{let o=new Date;return`${O(o)}T${Dt(o.getHours())}:${Dt(o.getMinutes())}`},ab=new Map;function da(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,r=ab.get(t);if(r)return r;let s={hour:e==="h23"?"2-digit":"numeric",minute:"2-digit",numberingSystem:"latn",...e?{hourCycle:e}:{}},l=new Intl.DateTimeFormat(o,s),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(D=>D.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),b=(k,D)=>[...new Set([k,...D].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=>de(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 ab.set(t,y),y}var Lh=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function Nr(o,n){let e=o.trim().toLowerCase().normalize("NFKC");if(!e)return null;let t=e.replace(/[^\p{L}]/gu,""),r=!!t&&n.pm.includes(t),s=!!t&&n.am.includes(t);if(t&&!r&&!s)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(s||r){if(d<1||d>12)return null;d=d%12+(r?12:0)}else if(d>23)return null;return ti(d*60+p)}var ha={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},ma=o=>Array.isArray(o)?o:typeof o=="string"?ha.fromAttribute(o):[];function Ni(o,n){let e=[n,Ko(o)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function pa(o){try{let n=new Intl.Locale(o),e=n.getWeekInfo?.()??n.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var nb=new Map;function ua(o){let n=nb.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"}),r=e({weekday:"short"}),s=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},(D,R)=>new Intl.DateTimeFormat(y,{month:k}).format(new Date(2024,R,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=>de(y,{weekday:"long",day:"numeric",month:"long",year:"numeric"},o),medium:y=>de(y,{day:"numeric",month:"short",year:"numeric"},o),monthYear:y=>de(y,{month:"long",year:"numeric"},o),day:y=>de(y,{day:"numeric"},o),weekdaysShort:Array.from({length:7},(y,k)=>r.format(X(l,k))),weekdaysLong:Array.from({length:7},(y,k)=>s.format(X(l,k))),pattern:p.length===3?u:"{y}-{m}-{d}",order:p.length===3?p:["year","month","day"],months:f};return nb.set(o,x),x}var Sh=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function Dh(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 r,s,l,d=t.findIndex(u=>/\p{L}/u.test(u));if(d>=0){let u=t[d];s=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(!s||b.some(y=>!/^\d+$/.test(y)))return null;let f=b.findIndex(y=>y.length===4),x=f>=0?f:1;r=+b[x],l=+b[1-x],b[x].length<=2&&(r+=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(r=+b("year"),s=+b("month"),l=+b("day"),b("year").length<=2)r+=2e3;else if(b("year").length!==4)return null}let p=`${Dt(r,4)}-${Dt(s)}-${Dt(l)}`;return N(p)?p:null}function Ah(o,n,e,t){let r=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return X(e,1);case"ArrowLeft":return X(e,-1);case"ArrowDown":return X(e,7);case"ArrowUp":return X(e,-7);case"Home":return X(e,-r);case"End":return X(e,6-r);case"PageDown":return Ee(e,n.shiftKey?12:1);case"PageUp":return Ee(e,n.shiftKey?-12:-1);default:return null}}var Rt=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function Rh(o){let{fmt:n,firstDay:e,month:t,focus:r,min:s,max:l}=o,d=$t(t),p=(d.getDay()-e+7)%7,u=ca(t).getDate(),b=[],f=Array(p).fill(null);for(let R=1;R<=u;R++)f.push(new Date(t.getFullYear(),t.getMonth(),R)),f.length===7&&(b.push(f),f=[]);f.length&&b.push([...f,...Array(7-f.length).fill(null)]);let x=Array.from({length:7},(R,q)=>(q+e)%7),y=Zp(),k=!!s&&ca(Ee(d,-1))<s,D=!!l&&Ee(d,1)>l;return c`<div class="cal-head">
|
|
824
|
+
${o.hideNav==="previous"?c`<span class="cal-nav-gap"></span>`:c`<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>`}
|
|
824
825
|
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
825
|
-
|
|
826
|
+
${o.hideNav==="next"?c`<span class="cal-nav-gap"></span>`:c`<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${D} @click=${()=>o.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>`}
|
|
826
827
|
</div>
|
|
827
828
|
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${o.id}-month" @keydown=${o.onKey}>
|
|
828
|
-
<thead><tr>${x.map(
|
|
829
|
-
<tbody>${b.map(
|
|
830
|
-
tabindex=${B===
|
|
831
|
-
aria-selected=${
|
|
829
|
+
<thead><tr>${x.map(R=>c`<th scope="col" abbr=${n.weekdaysLong[R]}><span aria-hidden="true">${n.weekdaysShort[R]}</span><span class="vh">${n.weekdaysLong[R]}</span></th>`)}</tr></thead>
|
|
830
|
+
<tbody>${b.map(R=>c`<tr>${R.map(q=>{if(!q)return c`<td class="empty"></td>`;let B=O(q),U=o.isDisabled(q)||!!s&&q<s||!!l&&q>l,Fe=o.mark(q),K=o.note?.(q);return c`<td class="day ${Fe} ${B===y?"today":""}" data-date=${B}
|
|
831
|
+
tabindex=${B===O(r)?"0":"-1"}
|
|
832
|
+
aria-selected=${Fe?"true":"false"} aria-disabled=${U?"true":h}
|
|
832
833
|
aria-current=${B===y?"date":h}
|
|
833
|
-
aria-label="${n.long(q)}${
|
|
834
|
-
@click=${()=>!
|
|
835
|
-
</table>`}var
|
|
834
|
+
aria-label="${n.long(q)}${K?`, ${K}`:""}"
|
|
835
|
+
@click=${()=>!U&&o.onPick(q)} @pointerenter=${()=>o.onHover?.(q)}><span aria-hidden="true">${n.day(q)}</span></td>`})}</tr>`)}</tbody>
|
|
836
|
+
</table>`}var Hh=w`
|
|
836
837
|
.pop {
|
|
837
838
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-8)); inset-inline-start: 0;
|
|
838
839
|
width: max-content; max-width: calc(100vw - 32px); padding: var(--cm-space-12);
|
|
@@ -847,6 +848,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
847
848
|
display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
848
849
|
background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
849
850
|
}
|
|
851
|
+
.cal-nav-gap { flex: none; width: 32px; }
|
|
850
852
|
.cal-nav:hover { background: var(--cm-bg-hover); }
|
|
851
853
|
.cal-nav:disabled { color: var(--cm-text-secondary); cursor: not-allowed; background: none; }
|
|
852
854
|
.cal-nav:focus-visible, .day:focus, .preset:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
@@ -864,8 +866,8 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
864
866
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
865
867
|
}
|
|
866
868
|
@media (max-width: 640px) { .day, .empty { height: 36px; } }
|
|
867
|
-
`;function
|
|
868
|
-
${
|
|
869
|
+
`;function Nh(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(),r=e.indexOf(t.activeElement);o.preventDefault(),e[(r+(o.shiftKey?-1:1)+e.length)%e.length].focus()}var ga=w`
|
|
870
|
+
${lt}
|
|
869
871
|
:host { display: block; position: relative; }
|
|
870
872
|
.wrap { position: relative; }
|
|
871
873
|
.box {
|
|
@@ -896,69 +898,77 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
896
898
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
897
899
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
898
900
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
899
|
-
`;var
|
|
900
|
-
${this.label?c`<label class="label" for="${
|
|
901
|
+
`;var _1=_("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."}}),ya,ge,qr,mt,xa,ai,Oi,Ue,et,wa,$a,M,Cl,Ii,ka,Ih,Ir,fa,ii,Pi,ri,si,Ph,Qp,qh,ba,Pr,Oh,eu,lb,Bh,cb,db,ni,Ea,tu,va,Ll,Sl,iu,hb,Fh,ru,su,Vh,jh,Uh,Kh,Wh,Dl,qi=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,ya,"");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,ge,this.attachInternals());m(this,qr,new ee(this,i(this,ge)));m(this,mt,H("cm-dp"));m(this,xa,null);m(this,ai,!1);m(this,Oi,!1);m(this,Ue,"");m(this,et,"");m(this,wa,!1);m(this,$a,"");m(this,ka,!1);m(this,ni,new we);m(this,Ea,!1);m(this,Fh,e=>{e.key==="Enter"?a(this,M,iu).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),a(this,M,hb).call(this,e.key==="ArrowUp"?1:-1))});m(this,Vh,()=>{this.disabled||(this.open?this.open=!1:(a(this,M,Sl).call(this),this.show()))});m(this,jh,e=>{e.key==="Enter"?a(this,M,Sl).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),a(this,M,Sl).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});m(this,Uh,e=>{let t=Ah(te(e,this),e,this._focus,i(this,M,Qp));if(t){e.preventDefault(),this._focus=Rt(t,i(this,M,ri),i(this,M,si)),g(this,Oi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,M,ru).call(this,this._focus))});m(this,Kh,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,M,su).call(this);return}Nh(e,e.currentTarget)});m(this,Wh,e=>{this._focus=Rt(Ee(this._focus,e),i(this,M,ri),i(this,M,si))});m(this,Dl,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return i(this,ya)}set locale(e){let t=i(this,ya);g(this,ya,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),i(this,xa)===null&&g(this,xa,this.value),document.addEventListener("pointerdown",i(this,Dl),!0)}disconnectedCallback(){super.disconnectedCallback(),i(this,ni).close(),document.removeEventListener("pointerdown",i(this,Dl),!0)}get form(){return i(this,ge).form}get validity(){return i(this,ge).validity}get validationMessage(){return i(this,ge).validationMessage}get valueAsDate(){return this.time?this.value?At(this.value):null:N(this.value)}checkValidity(){return a(this,M,Bh).call(this),i(this,ge).checkValidity()}reportValidity(){return a(this,M,Bh).call(this),i(this,qr).report(()=>i(this,ge).reportValidity())}formResetCallback(){i(this,qr).reset(),this._dateError=this._timeError="",this.value=i(this,xa)??"",this.time&&(a(this,M,eu).call(this,this.value),g(this,M,a(this,M,Pr).call(this,i(this,et)),Ii)),this._text=a(this,M,ba).call(this,i(this,M,ii)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(a(this,M,lb).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let r=i(this,M,ri),s=i(this,M,si);return r&&t<r||s&&t>s?!0:ma(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!i(this,ka)?(a(this,M,eu).call(this,this.value),i(this,wa)||g(this,M,a(this,M,Pr).call(this,i(this,et)),Ii)):this.time&&(e.has("locale")||e.has("hourCycle"))&&i(this,et)&&g(this,M,a(this,M,Pr).call(this,i(this,et)),Ii),(e.has("value")||e.has("time"))&&!i(this,ai)?this._text=a(this,M,ba).call(this,i(this,M,ii)):e.has("locale")&&N(i(this,M,ii))&&(this._text=a(this,M,ba).call(this,i(this,M,ii))),e.has("value")&&!i(this,Ea)&&(this._dateError=this._timeError=""),g(this,Ea,!1),g(this,ai,!1),g(this,wa,!1),g(this,ka,!1)}updated(e){this.open&&!i(this,ni).active?i(this,ni).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&i(this,ni).active?i(this,ni).close():this.open&&i(this,ni).place(),i(this,ge).setFormValue(this.value||null,this.time?this.value:this._text),a(this,M,Bh).call(this),this.open&&i(this,Oi)&&(g(this,Oi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&g(this,Oi,!1)}render(){let e=i(this,M,Ir),t=N(i(this,M,ii)),r=[this._dateError,this._timeError].filter(Boolean).join(" "),s=i(this,qr).message,l=this.error||r||s,d=!this.error&&!r&&!!s,p=[l&&`${i(this,mt)}-err`,this.helpText&&`${i(this,mt)}-help`].filter(Boolean).join(" "),u=this.getAttribute("aria-label"),b=this.label||u||"",f=$t(this._focus);return c`<div class="field">
|
|
902
|
+
${this.label?c`<label class="label" for="${i(this,mt)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
901
903
|
<div class="wrap ${this.time?"timed":""}">
|
|
902
904
|
<div class="box ${this._dateError&&!this.error||d?"invalid":""}" part="box">
|
|
903
|
-
<input id="${
|
|
904
|
-
.value=${
|
|
905
|
+
<input id="${i(this,mt)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
906
|
+
.value=${oe(this._text)} placeholder=${this.placeholder||i(this,M,qh)}
|
|
905
907
|
aria-label=${!this.label&&u?u:h}
|
|
906
908
|
?required=${this.required} ?disabled=${this.disabled}
|
|
907
909
|
aria-invalid=${l?"true":h} aria-describedby=${p||h}
|
|
908
910
|
@input=${x=>{x.stopPropagation(),this._text=x.target.value}}
|
|
909
|
-
@change=${()=>
|
|
911
|
+
@change=${()=>a(this,M,Sl).call(this)} @keydown=${i(this,jh)} />
|
|
910
912
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
911
913
|
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="${
|
|
913
|
-
@click=${
|
|
914
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${i(this,mt)}-pop"
|
|
915
|
+
@click=${i(this,Vh)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
914
916
|
</div>
|
|
915
917
|
${this.time?c`<div class="box time ${this._timeError&&!this.error||d?"invalid":""}" part="time-box">
|
|
916
918
|
<input class="time-in" part="time-input" type="text" autocomplete="off" spellcheck="false"
|
|
917
|
-
.value=${
|
|
919
|
+
.value=${oe(i(this,M,Cl))} placeholder=${i(this,M,Oh)}
|
|
918
920
|
aria-label=${this.t(b?"timeFor":"time",{label:b})}
|
|
919
921
|
?required=${this.required} ?disabled=${this.disabled}
|
|
920
922
|
aria-invalid=${l?"true":h} aria-describedby=${p||h}
|
|
921
|
-
@input=${x=>{x.stopPropagation(),g(this,M,x.target.value,
|
|
922
|
-
@change=${()=>
|
|
923
|
+
@input=${x=>{x.stopPropagation(),g(this,M,x.target.value,Ii)}}
|
|
924
|
+
@change=${()=>a(this,M,iu).call(this)} @keydown=${i(this,Fh)} />
|
|
923
925
|
</div>`:h}
|
|
924
|
-
<div class="pop" id="${
|
|
925
|
-
?hidden=${!this.open} @keydown=${
|
|
926
|
-
${this.open?c`<div class="cal">${
|
|
926
|
+
<div class="pop" id="${i(this,mt)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
927
|
+
?hidden=${!this.open} @keydown=${i(this,Kh)}>
|
|
928
|
+
${this.open?c`<div class="cal">${Rh({id:i(this,mt),fmt:e,firstDay:i(this,M,Qp),month:f,focus:this._focus,min:i(this,M,ri),max:i(this,M,si),isDisabled:x=>this.isUnavailable(O(x)),mark:x=>t&&O(x)===i(this,M,ii)?"selected":"",onPick:x=>a(this,M,ru).call(this,x),onKey:i(this,Uh),onMonth:i(this,Wh),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:h}
|
|
927
929
|
</div>
|
|
928
930
|
</div>
|
|
929
|
-
${l?c`<p class="error" id="${
|
|
930
|
-
${this.helpText?c`<p class="help" id="${
|
|
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=${
|
|
933
|
-
aria-label=${
|
|
931
|
+
${l?c`<p class="error" id="${i(this,mt)}-err" role="alert">${l}</p>`:h}
|
|
932
|
+
${this.helpText?c`<p class="help" id="${i(this,mt)}-help">${this.helpText}</p>`:h}
|
|
933
|
+
</div>`}};ya=new WeakMap,ge=new WeakMap,qr=new WeakMap,mt=new WeakMap,xa=new WeakMap,ai=new WeakMap,Oi=new WeakMap,Ue=new WeakMap,et=new WeakMap,wa=new WeakMap,$a=new WeakMap,M=new WeakSet,Cl=function(){return i(this,$a)},Ii=function(e){e!==i(this,$a)&&(g(this,$a,e),this.requestUpdate())},ka=new WeakMap,Ih=function(){return Ni(this,this.locale)},Ir=function(){return ua(i(this,M,Ih))},fa=function(){return da(i(this,M,Ih),this.hourCycle)},ii=function(){return this.time?i(this,Ue):this.value},Pi=function(e){return this.time&&e.trim().toLowerCase()==="now"?ob():e},ri=function(){return N(ht(a(this,M,Pi).call(this,this.min)).date||this.min)},si=function(){return N(ht(a(this,M,Pi).call(this,this.max)).date||this.max)},Ph=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Qp=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?pa(i(this,M,Ih)):(Math.trunc(e)%7+7)%7},qh=function(){return Sh(i(this,M,Ir),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},ba=function(e){let t=N(e);return t?i(this,M,Ir).short(t):e},Pr=function(e){let t=be(e);return t===null?"":i(this,M,fa).format(t)},Oh=function(){return Lh(i(this,M,fa),{h:this.t("patternHour"),m:this.t("patternMinute")})},eu=function(e){let{date:t,time:r}=ht(e);g(this,Ue,t),g(this,et,t?r:"")},lb=function(){let e=new Date,t=N(i(this,M,ii))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=Rt(t,i(this,M,ri),i(this,M,si)),g(this,Oi,!0)},Bh=function(){a(this,M,cb).call(this),i(this,qr).sync()},cb=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(i(this,M,ii)),r=i(this,M,Ir);this.error?i(this,ge).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?i(this,ge).setValidity({badInput:!0},this.t("badInput",{pattern:i(this,M,qh)}),e):this.time?a(this,M,db).call(this,t,e):this.required&&!t?i(this,ge).setValidity({valueMissing:!0},this.t("required"),e):t&&i(this,M,ri)&&t<i(this,M,ri)?i(this,ge).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:r.medium(i(this,M,ri))}),e):t&&i(this,M,si)&&t>i(this,M,si)?i(this,ge).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:r.medium(i(this,M,si))}),e):t&&this.isUnavailable(this.value)?i(this,ge).setValidity({customError:!0},this.t("unavailable"),e):i(this,ge).setValidity({})},db=function(e,t){let r=this.renderRoot.querySelector("input.time-in")??t,s=(f,x,y,k=t)=>i(this,ge).setValidity(f,this.t(x,y),k),l=be(i(this,et));if(i(this,M,Cl).trim()&&l===null)return s({badInput:!0},"badTime",{pattern:i(this,M,Oh)},r);if(!e&&l===null)return this.required?s({valueMissing:!0},"required"):i(this,ge).setValidity({});if(!e)return s({badInput:!0},"required");if(l===null)return s({badInput:!0},"timeMissing",void 0,r);let d=At(`${i(this,Ue)}T${i(this,et)}`),p=At(a(this,M,Pi).call(this,this.min)),u=At(a(this,M,Pi).call(this,this.max),!0),b=(f,x)=>ht(f).time?i(this,M,fa).dateTime(x):i(this,M,Ir).medium(x);if(p&&d<p)return s({rangeUnderflow:!0},"rangeUnderflow",{date:b(a(this,M,Pi).call(this,this.min),p)},r);if(u&&d>u)return s({rangeOverflow:!0},"rangeOverflow",{date:b(a(this,M,Pi).call(this,this.max),u)},r);if(l%i(this,M,Ph))return s({stepMismatch:!0},"stepMismatch",{count:i(this,M,Ph)},r);if(this.isUnavailable(i(this,Ue)))return s({customError:!0},"unavailable");i(this,ge).setValidity({})},ni=new WeakMap,Ea=new WeakMap,tu=function(e){e!==this.value&&(g(this,Ea,!0),this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},va=function(e,t){g(this,Ue,e),g(this,et,t);let r=e&&t?`${e}T${t}`:"";g(this,ka,!0),this.requestUpdate(),a(this,M,tu).call(this,r)},Ll=function(e){this.time?a(this,M,va).call(this,e,i(this,et)):a(this,M,tu).call(this,e)},Sl=function(){let e=this._text.trim();if(this._dateError="",!e){a(this,M,Ll).call(this,"");return}let t=Dh(e,i(this,M,Ir));t?(a(this,M,Ll).call(this,t),this._text=a(this,M,ba).call(this,t)):(g(this,ai,!0),a(this,M,Ll).call(this,""),this._dateError=this.t("badInput",{pattern:i(this,M,qh)}))},iu=function(){let e=i(this,M,Cl).trim(),t=e?Nr(e,i(this,M,fa)):"";if(g(this,ai,!0),t===null){g(this,wa,!0),a(this,M,va).call(this,i(this,Ue),""),this._timeError=this.t("badTime",{pattern:i(this,M,Oh)});return}this._timeError="",a(this,M,va).call(this,i(this,Ue),t),g(this,M,a(this,M,Pr).call(this,t),Ii)},hb=function(e){let t=i(this,M,Ph),r=Nr(i(this,M,Cl),i(this,M,fa));if(!r){let p=ht(a(this,M,Pi).call(this,this.min)),u=new Date;if(r=p.time&&(!i(this,Ue)||i(this,Ue)===p.date)?p.time:ti(u.getHours()*60+u.getMinutes()),be(r)%t===0){g(this,ai,!0),a(this,M,va).call(this,i(this,Ue),r),g(this,M,a(this,M,Pr).call(this,r),Ii);return}e=1}let s=be(r),l=e>0?(Math.floor(s/t)+1)*t:(Math.ceil(s/t)-1)*t,d=ti(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,ai,!0),a(this,M,va).call(this,i(this,Ue),d),g(this,M,a(this,M,Pr).call(this,d),Ii)},Fh=new WeakMap,ru=function(e){let t=O(e);this.isUnavailable(t)||(this.open=!1,a(this,M,Ll).call(this,t),this._text=a(this,M,ba).call(this,t),this._dateError="",this.time&&!i(this,et)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):a(this,M,su).call(this))},su=function(){this.renderRoot.querySelector(".trigger")?.focus()},Vh=new WeakMap,jh=new WeakMap,Uh=new WeakMap,Kh=new WeakMap,Wh=new WeakMap,Dl=new WeakMap,qi.formAssociated=!0,qi.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},qi.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:ha},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}},qi.styles=[E,Ve,ga,Hh,w`.pop { min-width: 0; }`];$("cm-date-picker",qi);var I1=_("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",thisWeek:"This week",lastWeek:"Last week",last28Days:"Last 28 days",last12Months:"Last 12 months",thisYear:"This year",lastYear:"Last year",custom:"Custom",apply:"Apply",cancel:"Cancel",noRange:"No dates chosen"}),au=(o,n)=>X(o,-((o.getDay()-n+7)%7)),mb={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[X(o,-1),X(o,-1)]],"this-week":["This week",(o,n)=>[au(o,n),o]],"last-week":["Last week",(o,n)=>[X(au(o,n),-7),X(au(o,n),-1)]],"last-7-days":["Last 7 days",o=>[X(o,-6),o]],"last-28-days":["Last 28 days",o=>[X(o,-27),o]],"last-30-days":["Last 30 days",o=>[X(o,-29),o]],"last-90-days":["Last 90 days",o=>[X(o,-89),o]],"last-12-months":["Last 12 months",o=>[X(Ee(o,-12),1),o]],"this-month":["This month",o=>[$t(o),o]],"last-month":["Last month",o=>[$t(Ee(o,-1)),ca(Ee(o,-1))]],"this-year":["This year",o=>[new Date(o.getFullYear(),0,1),o]],"last-year":["Last year",o=>[new Date(o.getFullYear()-1,0,1),new Date(o.getFullYear()-1,11,31)]]},Px=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function nu(o,n=new Date,e,t=0){if(typeof o=="object"&&o)return o;let r=mb[o];if(!r||!Object.prototype.hasOwnProperty.call(mb,o))return null;let s=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[l,d]=r[1](s,t);return{label:e?.(Px(o))||r[0],start:O(l),end:O(d)}}var Ca,ve,Or,Ke,La,Sa,kt,Da,Ht,S,ou,Ma,Al,Rl,Ta,lu,cu,pt,Gh,oi,li,pb,Hl,_a,du,ub,gb,fb,bb,za,Yh,Xh,Jh,Zh,Nl,hu,Bi=class extends T{constructor(){super(...arguments);m(this,S);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";m(this,Ca,"");this.disabledDates=[];this.presets=[];this.preset="";this.months=1;this.confirm=!1;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;this._view=$t(new Date);this._draftPreset="";m(this,ve,this.attachInternals());m(this,Or,new ee(this,i(this,ve)));m(this,Ke,H("cm-drp"));m(this,La,null);m(this,Sa,!1);m(this,kt,!1);m(this,Da,!1);m(this,Ht,!1);m(this,pt,"start");m(this,li,new we);m(this,Yh,()=>{this.disabled||(this.open?this.open=!1:(a(this,S,_a).call(this,"start"),a(this,S,_a).call(this,"end"),this.show()))});m(this,Xh,e=>t=>{t.key==="Enter"?a(this,S,_a).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),a(this,S,_a).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});m(this,Jh,e=>{let t=Ah(te(e,this),e,this._focus,i(this,S,Al));if(t){e.preventDefault(),this._focus=Rt(t,N(this.min),N(this.max)),a(this,S,Ta).call(this,this._focus),g(this,Ht,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,S,du).call(this,this._focus))});m(this,Zh,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,S,za).call(this);return}Nh(e,e.currentTarget)});m(this,Nl,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return i(this,Ca)}set locale(e){let t=i(this,Ca);g(this,Ca,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),i(this,La)||g(this,La,[this.start,this.end,this.preset]),document.addEventListener("pointerdown",i(this,Nl),!0)}disconnectedCallback(){super.disconnectedCallback(),i(this,li).close(),document.removeEventListener("pointerdown",i(this,Nl),!0)}get form(){return i(this,ve).form}get validity(){return i(this,ve).validity}get validationMessage(){return i(this,ve).validationMessage}checkValidity(){return i(this,ve).checkValidity()}reportValidity(){return i(this,Or).report(()=>i(this,ve).reportValidity())}formResetCallback(){[this.start,this.end,this.preset]=i(this,La)??["","",""],this._startText=a(this,S,oi).call(this,this.start),this._endText=a(this,S,oi).call(this,this.end),this.open=!1,i(this,Or).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._draftPreset=this.preset,this._hover=null,g(this,kt,!1);let e=new Date,t=i(this,S,Rl)===2?N(this.end)??N(this.start):N(this.start);this._view=$t(Ee(Rt(t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),1-i(this,S,Rl))),this._focus=Rt(N(this.start)??t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),a(this,S,Ta).call(this,this._focus),g(this,pt,"start"),g(this,Ht,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let r=N(this.min),s=N(this.max);return r&&t<r||s&&t>s?!0:ma(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){if(e.has("preset")&&!i(this,Sa)&&this.preset){let t=nu(this.preset,new Date,void 0,i(this,S,Al));t&&(this.start=t.start,this.end=t.end)}g(this,Sa,!1),i(this,Da)||(e.has("start")&&(this._startText=a(this,S,oi).call(this,this.start)),e.has("end")&&(this._endText=a(this,S,oi).call(this,this.end))),g(this,Da,!1),e.has("locale")&&(N(this.start)&&(this._startText=a(this,S,oi).call(this,this.start)),N(this.end)&&(this._endText=a(this,S,oi).call(this,this.end)))}updated(){this.open&&!i(this,li).active?i(this,li).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&i(this,li).active?i(this,li).close():this.open&&i(this,li).place();let e=N(this.start),t=N(this.end),r=new FormData;(this.name||this.startName)&&e&&r.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&r.append(this.endName||`${this.name}-end`,this.end),i(this,ve).setFormValue(e||t?r:null,`${this.start}/${this.end}`);let s=this.renderRoot.querySelectorAll("input"),[l,d]=[s[0]??void 0,s[1]??void 0],p=i(this,S,Ma),u=N(this.min),b=N(this.max);this.error?i(this,ve).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?i(this,ve).setValidity({badInput:!0},this.t("badStart",{pattern:i(this,S,Gh)}),l):this._endText.trim()&&!t?i(this,ve).setValidity({badInput:!0},this.t("badEnd",{pattern:i(this,S,Gh)}),d):this.required&&(!e||!t)?i(this,ve).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?i(this,ve).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?i(this,ve).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:p.medium(u)}),l):e&&b&&e>b||t&&b&&t>b?i(this,ve).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:p.medium(b)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?i(this,ve).setValidity({customError:!0},this.t("unavailable"),l):i(this,ve).setValidity({}),i(this,Or).sync(),this.open&&i(this,Ht)&&(g(this,Ht,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=i(this,S,Ma),t=N(this.start),r=N(this.end),s=i(this,Or).message,l=[s&&`${i(this,Ke)}-err`,this.helpText&&`${i(this,Ke)}-help`].filter(Boolean).join(" "),d=this.getAttribute("aria-label"),p=this.label||d||"",u=this.open?i(this,S,lu):[],[b,f,x]=this.confirm?[this._draftStart,this._draftEnd,this._draftPreset]:[this.start,this.end,this.preset],y=!i(this,kt)&&!!x&&u.some(Y=>Y.key===x),k=Y=>!i(this,kt)&&(y?Y.key===x:Y.start===b&&Y.end===f),D=i(this,kt)||!u.some(k)&&!!(b||f),R=i(this,S,Rl),q=Y=>Rh({id:R===1?i(this,Ke):`${i(this,Ke)}-m${Y}`,fmt:e,firstDay:i(this,S,Al),month:Ee(this._view,Y),focus:this._focus,min:N(this.min),max:N(this.max),isDisabled:J=>this.isUnavailable(O(J)),mark:J=>a(this,S,hu).call(this,J),note:J=>{let wi=a(this,S,hu).call(this,J);return wi==="start"?this.t("startNote"):wi==="end"?this.t("endNote"):""},onPick:J=>a(this,S,du).call(this,J),onKey:i(this,Jh),onMonth:J=>{this._view=Ee(this._view,J),this._focus=Rt(Ee(this._focus,J),N(this.min),N(this.max)),a(this,S,Ta).call(this,this._focus)},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:J=>{i(this,pt)==="end"&&(this._hover=J)},hideNav:R===1?void 0:Y===0?"next":"previous"}),B=N(this._draftStart),U=N(this._draftEnd),Fe=i(this,pt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),K=Y=>{let J=Y==="start"?this._startText:this._endText;return c`<input id="${i(this,Ke)}-${Y}" type="text" autocomplete="off" spellcheck="false"
|
|
934
|
+
.value=${oe(J)} placeholder=${i(this,S,Gh)}
|
|
935
|
+
aria-label=${Y==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
934
936
|
?required=${this.required} ?disabled=${this.disabled}
|
|
935
|
-
aria-invalid=${
|
|
936
|
-
@input=${
|
|
937
|
-
@change=${()=>
|
|
938
|
-
${this.label?c`<span class="label" id="${
|
|
937
|
+
aria-invalid=${s?"true":h} aria-describedby=${l||h}
|
|
938
|
+
@input=${wi=>{wi.stopPropagation();let Io=wi.target.value;Y==="start"?this._startText=Io:this._endText=Io}}
|
|
939
|
+
@change=${()=>a(this,S,_a).call(this,Y)} @keydown=${i(this,Xh).call(this,Y)} />`};return c`<div class="field" role="group" aria-labelledby=${this.label?`${i(this,Ke)}-l`:h} aria-label=${!this.label&&d?d:h}>
|
|
940
|
+
${this.label?c`<span class="label" id="${i(this,Ke)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
939
941
|
<div class="wrap">
|
|
940
942
|
<div class="box" part="box">
|
|
941
|
-
${
|
|
943
|
+
${K("start")}<span class="sep" aria-hidden="true">–</span>${K("end")}
|
|
942
944
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
943
|
-
aria-label=${t&&
|
|
944
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${
|
|
945
|
-
@click=${
|
|
945
|
+
aria-label=${t&&r?this.t(p?"changeFor":"change",{label:p,start:e.long(t),end:e.long(r)}):this.t(p?"chooseFor":"choose",{label:p})}
|
|
946
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${i(this,Ke)}-pop"
|
|
947
|
+
@click=${i(this,Yh)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
946
948
|
</div>
|
|
947
|
-
<div class="pop" id="${
|
|
948
|
-
?hidden=${!this.open} @keydown=${
|
|
949
|
+
<div class="pop" id="${i(this,Ke)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
950
|
+
?hidden=${!this.open} @keydown=${i(this,Zh)}>
|
|
949
951
|
${this.open?c`<div class="body">
|
|
950
|
-
${u.length?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${u.map(
|
|
951
|
-
<button type="button" class="preset" aria-pressed=${
|
|
952
|
-
@click=${()=>
|
|
953
|
-
|
|
954
|
-
|
|
952
|
+
${u.length||i(this,S,cu)?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${u.map(Y=>c`<li>
|
|
953
|
+
<button type="button" class="preset" data-preset=${Y.key||h} aria-pressed=${k(Y)?"true":"false"}
|
|
954
|
+
@click=${()=>a(this,S,ub).call(this,Y)}>${Y.label}</button></li>`)}${i(this,S,cu)?c`<li>
|
|
955
|
+
<button type="button" class="preset" data-preset="custom" aria-pressed=${D?"true":"false"}
|
|
956
|
+
@click=${()=>a(this,S,gb).call(this)}>${this.t("custom")}</button></li>`:h}</ul>`:h}
|
|
957
|
+
<div>
|
|
958
|
+
<div class="cals">${Array.from({length:R},(Y,J)=>c`<div class="cal">${q(J)}</div>`)}</div>
|
|
959
|
+
<p class="status" aria-live="polite">${Fe}</p>
|
|
960
|
+
${this.confirm?c`<div class="foot" part="footer">
|
|
961
|
+
<span class="draft">${B&&U?`${e.medium(B)} \u2013 ${e.medium(U)}`:B?`${e.medium(B)} \u2013`:this.t("noRange")}</span>
|
|
962
|
+
<button type="button" class="act" @click=${()=>a(this,S,bb).call(this)}>${this.t("cancel")}</button>
|
|
963
|
+
<button type="button" class="act primary" ?disabled=${!B||!U} @click=${()=>a(this,S,fb).call(this)}>${this.t("apply")}</button>
|
|
964
|
+
</div>`:h}
|
|
955
965
|
</div>
|
|
956
966
|
</div>`:h}
|
|
957
967
|
</div>
|
|
958
968
|
</div>
|
|
959
|
-
${
|
|
960
|
-
${this.helpText?c`<p class="help" id="${
|
|
961
|
-
</div>`}};
|
|
969
|
+
${s?c`<p class="error" id="${i(this,Ke)}-err" role="alert">${s}</p>`:h}
|
|
970
|
+
${this.helpText?c`<p class="help" id="${i(this,Ke)}-help">${this.helpText}</p>`:h}
|
|
971
|
+
</div>`}};Ca=new WeakMap,ve=new WeakMap,Or=new WeakMap,Ke=new WeakMap,La=new WeakMap,Sa=new WeakMap,kt=new WeakMap,Da=new WeakMap,Ht=new WeakMap,S=new WeakSet,ou=function(){return Ni(this,this.locale)},Ma=function(){return ua(i(this,S,ou))},Al=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?pa(i(this,S,ou)):(Math.trunc(e)%7+7)%7},Rl=function(){return Number(this.months)!==2||typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches?1:2},Ta=function(e){let t=i(this,S,Rl),r=$t(e);r<this._view?this._view=r:r>=Ee(this._view,t)&&(this._view=Ee(r,1-t))},lu=function(){return ma(this.presets).flatMap(e=>{let t=nu(e,new Date,r=>this.t(r),i(this,S,Al));return t?[{...t,key:typeof e=="string"?e:""}]:[]})},cu=function(){return ma(this.presets).includes("custom")},pt=new WeakMap,Gh=function(){return Sh(i(this,S,Ma),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},oi=function(e){let t=N(e);return t?i(this,S,Ma).short(t):e},li=new WeakMap,pb=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Hl=function(e,t,r){let s=r??i(this,S,lu).find(l=>l.key&&l.start===e&&l.end===t)?.key??"";s!==this.preset&&(g(this,Sa,!0),this.preset=s),!(e===this.start&&t===this.end)&&(this.start=e,this.end=t,a(this,S,pb).call(this))},_a=function(e){let t=(e==="start"?this._startText:this._endText).trim(),r=t?Dh(t,i(this,S,Ma)):"";t&&!r&&g(this,Da,!0);let s=e==="start"?[r??"",this.end]:[this.start,r??""];a(this,S,Hl).call(this,...s),r&&(e==="start"?this._startText=a(this,S,oi).call(this,r):this._endText=a(this,S,oi).call(this,r))},du=function(e){let t=O(e);if(!this.isUnavailable(t)){if(this._draftPreset="",g(this,kt,!0),i(this,pt)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",g(this,pt,"end"),this._focus=e,g(this,Ht,!0);return}if(this._draftEnd=t,g(this,pt,"start"),this.confirm){this._focus=e,g(this,Ht,!0);return}this.open=!1,a(this,S,Hl).call(this,this._draftStart,t,""),a(this,S,za).call(this)}},ub=function(e){if(this.confirm){this._draftStart=e.start,this._draftEnd=e.end,this._draftPreset=e.key,g(this,kt,!1),g(this,pt,"start");let t=N(e.end);this._focus=Rt(t,N(this.min),N(this.max)),a(this,S,Ta).call(this,N(e.start)),a(this,S,Ta).call(this,t);return}this.open=!1,a(this,S,Hl).call(this,e.start,e.end,e.key),a(this,S,za).call(this)},gb=function(){g(this,kt,!0),this._draftPreset="",g(this,pt,"start"),g(this,Ht,!0),this.requestUpdate()},fb=function(){!this._draftStart||!this._draftEnd||(this.open=!1,a(this,S,Hl).call(this,this._draftStart,this._draftEnd,i(this,kt)?"":this._draftPreset||void 0),a(this,S,za).call(this))},bb=function(){this.open=!1,a(this,S,za).call(this)},za=function(){this.renderRoot.querySelector(".trigger")?.focus()},Yh=new WeakMap,Xh=new WeakMap,Jh=new WeakMap,Zh=new WeakMap,Nl=new WeakMap,hu=function(e){let t=O(e),r=this._draftStart,s=this._draftEnd||(i(this,pt)==="end"&&r?O(this._hover??this._focus):"");return t===r?"start":t===s&&s>r?"end":r&&s&&t>r&&t<s?"in-range":""},Bi.formAssociated=!0,Bi.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Bi.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:ha},isDateDisabled:{attribute:!1},presets:{converter:ha},preset:{reflect:!0},months:{type:Number,reflect:!0},confirm:{type:Boolean,reflect:!0},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},_view:{state:!0},_draftPreset:{state:!0}},Bi.styles=[E,Ve,ga,Hh,w`
|
|
962
972
|
:host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
963
973
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
964
974
|
input { flex: 0 1 6.6em; }
|
|
@@ -972,63 +982,121 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
972
982
|
}
|
|
973
983
|
.preset:hover { background: var(--cm-bg-hover); }
|
|
974
984
|
.preset[aria-pressed='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
985
|
+
.cals { display: flex; gap: var(--cm-space-24); }
|
|
986
|
+
.foot {
|
|
987
|
+
display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--cm-space-8);
|
|
988
|
+
margin-block-start: var(--cm-space-12); padding-block-start: var(--cm-space-12); border-block-start: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
989
|
+
}
|
|
990
|
+
.draft { margin-inline-end: auto; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
991
|
+
.act {
|
|
992
|
+
min-height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-16); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
993
|
+
border-radius: var(--cm-radius-sm); background: var(--cm-bg-surface); color: var(--cm-text-default);
|
|
994
|
+
font: inherit; font-size: var(--cm-font-size-14); font-weight: 500; cursor: pointer;
|
|
995
|
+
}
|
|
996
|
+
.act:hover { background: var(--cm-bg-hover); }
|
|
997
|
+
.act.primary { background: var(--cm-action-primary); border-color: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
998
|
+
.act.primary:hover { background: var(--cm-action-primary-hover); border-color: var(--cm-action-primary-hover); }
|
|
999
|
+
.act:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
1000
|
+
.act:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1001
|
+
@media (pointer: coarse) { .act { min-height: var(--cm-control-height-touch, 44px); } }
|
|
975
1002
|
.status { 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-tertiary); }
|
|
976
1003
|
@media (max-width: 640px) {
|
|
977
1004
|
.body { flex-direction: column; }
|
|
978
1005
|
.presets { flex-direction: row; flex-wrap: wrap; min-width: 0; padding: 0 0 var(--cm-space-8); border-inline-end: 0; border-block-end: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
979
1006
|
.presets li { flex: 0 0 auto; }
|
|
980
1007
|
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
1008
|
+
.draft { flex-basis: 100%; }
|
|
981
1009
|
}
|
|
982
|
-
`];$("cm-date-range-picker",
|
|
983
|
-
${this.label
|
|
984
|
-
|
|
985
|
-
|
|
1010
|
+
`];$("cm-date-range-picker",Bi);var G1=_("timePicker",{showTimes:"Show times",times:"Times",timesFor:"Times for {label}",patternHour:"hh",patternMinute:"mm",badInput:"Enter a time like {pattern}.",required:"Enter or choose a time.",rangeUnderflow:"Choose {time} or later.",rangeOverflow:"Choose {time} or earlier.",stepMismatch:{one:"Choose a time on the minute.",other:"Choose a time in steps of {count} minutes."}}),Ha,_e,Br,ut,Na,Ia,ci,P,vb,Fi,Aa,yb,mu,Ra,Qh,xb,pu,wb,em,tm,uu,im,rm,sm,Il,Vi=class extends T{constructor(){super(...arguments);m(this,P);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.min="";this.max="";this.step=1;this.hourCycle="";m(this,Ha,"");this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._text="";this._active=-1;m(this,_e,this.attachInternals());m(this,Br,new ee(this,i(this,_e)));m(this,ut,H("cm-tp"));m(this,Na,null);m(this,Ia,!1);m(this,ci,new we);m(this,im,e=>{let t=i(this,P,Qh);switch(e.key){case"ArrowDown":case"ArrowUp":{if(e.preventDefault(),!this.open){this.show();return}if(!t.length)return;let r=e.key==="ArrowDown"?1:-1;this._active=this._active<0?0:Math.min(t.length-1,Math.max(0,this._active+r));return}case"PageDown":case"PageUp":if(!this.open||!t.length)return;e.preventDefault(),this._active=Math.min(t.length-1,Math.max(0,this._active+(e.key==="PageDown"?6:-6)));return;case"Enter":this.open&&this._active>=0&&t[this._active]!==void 0?(e.preventDefault(),a(this,P,uu).call(this,t[this._active])):(this.open=!1,a(this,P,tm).call(this));return;case"Escape":this.open&&(e.preventDefault(),e.stopPropagation(),this.open=!1);return;case"Tab":this.open=!1;return;default:}});m(this,rm,e=>{if(e.stopPropagation(),this._text=e.target.value,this.open){let t=Nr(this._text,i(this,P,Fi));t&&(this._active=a(this,P,pu).call(this,t))}});m(this,sm,()=>{this.disabled||(this.open?this.open=!1:(a(this,P,tm).call(this),this.show()),this.renderRoot.querySelector("input")?.focus())});m(this,Il,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return i(this,Ha)}set locale(e){let t=i(this,Ha);g(this,Ha,e??""),this.requestUpdate("locale",t)}get valueAsNumber(){return be(this.value)}connectedCallback(){super.connectedCallback(),i(this,Na)===null&&g(this,Na,this.value),document.addEventListener("pointerdown",i(this,Il),!0)}disconnectedCallback(){super.disconnectedCallback(),i(this,ci).close(),document.removeEventListener("pointerdown",i(this,Il),!0)}get form(){return i(this,_e).form}get validity(){return i(this,_e).validity}get validationMessage(){return i(this,_e).validationMessage}checkValidity(){return i(this,_e).checkValidity()}reportValidity(){return i(this,Br).report(()=>i(this,_e).reportValidity())}formResetCallback(){this.value=i(this,Na)??"",this._text=a(this,P,Ra).call(this,this.value),this.open=!1,i(this,Br).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(this._active=a(this,P,pu).call(this,be(this.value)!==null?this.value:Nr(this._text,i(this,P,Fi))??a(this,P,xb).call(this)),this.open=!0)}close(){this.open=!1}willUpdate(e){e.has("value")&&!i(this,Ia)?this._text=a(this,P,Ra).call(this,this.value):(e.has("locale")||e.has("hourCycle"))&&be(this.value)!==null&&(this._text=a(this,P,Ra).call(this,this.value)),g(this,Ia,!1)}updated(e){this.open&&!i(this,ci).active?i(this,ci).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch",gap:4}):!this.open&&i(this,ci).active?i(this,ci).close():this.open&&i(this,ci).place(),this.open&&a(this,P,wb).call(this,e.has("open"));let t=be(this.value);i(this,_e).setFormValue(t===null?null:this.value,this.value);let r=this.renderRoot.querySelector("input")??void 0,s=be(this.min),l=be(this.max),d=i(this,P,Fi);this.error?i(this,_e).setValidity({customError:!0},this.error,r):this._text.trim()&&t===null?i(this,_e).setValidity({badInput:!0},this.t("badInput",{pattern:i(this,P,mu)}),r):this.required&&t===null?i(this,_e).setValidity({valueMissing:!0},this.t("required"),r):t!==null&&s!==null&&t<s?i(this,_e).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{time:d.format(s)}),r):t!==null&&l!==null&&t>l?i(this,_e).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{time:d.format(l)}),r):t!==null&&t%i(this,P,Aa)?i(this,_e).setValidity({stepMismatch:!0},this.t("stepMismatch",{count:i(this,P,Aa)}),r):i(this,_e).setValidity({}),i(this,Br).sync()}render(){let e=i(this,P,Fi),t=i(this,Br).message,r=[t&&`${i(this,ut)}-err`,this.helpText&&`${i(this,ut)}-help`].filter(Boolean).join(" "),s=this.getAttribute("aria-label"),l=this.label||s||"",d=this.open?i(this,P,Qh):[],p=be(this.value),u=`${i(this,ut)}-list`;return c`<div class="field">
|
|
1011
|
+
${this.label?c`<label class="label" for="${i(this,ut)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
1012
|
+
<div class="wrap">
|
|
1013
|
+
<div class="box" part="box">
|
|
1014
|
+
<input id="${i(this,ut)}-in" part="input" type="text" autocomplete="off" spellcheck="false" inputmode="text"
|
|
1015
|
+
role="combobox" aria-autocomplete="none" aria-expanded=${this.open?"true":"false"} aria-controls=${u}
|
|
1016
|
+
aria-activedescendant=${this.open&&this._active>=0&&d[this._active]!==void 0?`${i(this,ut)}-o${d[this._active]}`:h}
|
|
1017
|
+
.value=${oe(this._text)} placeholder=${this.placeholder||i(this,P,mu)}
|
|
1018
|
+
aria-label=${!this.label&&s?s:h}
|
|
1019
|
+
?required=${this.required} ?disabled=${this.disabled}
|
|
1020
|
+
aria-invalid=${t?"true":h} aria-describedby=${r||h}
|
|
1021
|
+
@input=${i(this,rm)} @change=${()=>a(this,P,tm).call(this)} @keydown=${i(this,im)} />
|
|
1022
|
+
<button type="button" class="trigger" part="trigger" tabindex="-1" ?disabled=${this.disabled}
|
|
1023
|
+
aria-label=${this.t("showTimes")} aria-expanded=${this.open?"true":"false"} aria-controls=${u}
|
|
1024
|
+
@pointerdown=${b=>b.preventDefault()} @click=${i(this,sm)}><cm-icon name="clock" size="16"></cm-icon></button>
|
|
1025
|
+
</div>
|
|
1026
|
+
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${b=>b.preventDefault()}>
|
|
1027
|
+
<ul role="listbox" id=${u} part="listbox" aria-label=${this.t(l?"timesFor":"times",{label:l})}>
|
|
1028
|
+
${d.map((b,f)=>c`<li role="option" id="${i(this,ut)}-o${b}" data-value=${ti(b)}
|
|
1029
|
+
class=${f===this._active?"active":""} aria-selected=${b===p?"true":"false"}
|
|
1030
|
+
@pointerenter=${()=>{this._active=f}} @click=${()=>a(this,P,uu).call(this,b)}>${e.format(b)}</li>`)}
|
|
1031
|
+
</ul>
|
|
1032
|
+
</div>
|
|
1033
|
+
</div>
|
|
1034
|
+
${t?c`<p class="error" id="${i(this,ut)}-err" role="alert">${t}</p>`:h}
|
|
1035
|
+
${this.helpText?c`<p class="help" id="${i(this,ut)}-help">${this.helpText}</p>`:h}
|
|
1036
|
+
</div>`}};Ha=new WeakMap,_e=new WeakMap,Br=new WeakMap,ut=new WeakMap,Na=new WeakMap,Ia=new WeakMap,ci=new WeakMap,P=new WeakSet,vb=function(){return Ni(this,this.locale)},Fi=function(){return da(i(this,P,vb),this.hourCycle)},Aa=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=720?e:1},yb=function(){let e=Math.trunc(Number(this.interval));return e>=1&&e<=720?e:i(this,P,Aa)>=5?i(this,P,Aa):30},mu=function(){return Lh(i(this,P,Fi),{h:this.t("patternHour"),m:this.t("patternMinute")})},Ra=function(e){let t=be(e);return t===null?"":i(this,P,Fi).format(t)},Qh=function(){let e=be(this.min)??0,t=be(this.max)??1439,r=i(this,P,yb),s=i(this,P,Aa),l=[];for(let d=Math.ceil(e/r)*r;d<=t&&l.length<1440;d+=r)d%s===0&&l.push(d);return l},xb=function(){let e=new Date;return ti(e.getHours()*60+e.getMinutes())},pu=function(e){let t=i(this,P,Qh);if(!t.length)return-1;let r=be(e);if(r===null)return 0;let s=t.findIndex(l=>l>=r);return s===-1?t.length-1:s},wb=function(e){let t=this.renderRoot.querySelector("[role=listbox]"),r=this.renderRoot.querySelector("[role=option].active");if(!t||!r)return;let s=r.offsetTop-t.offsetTop,l=s+r.offsetHeight;e?t.scrollTop=s-(t.clientHeight-r.offsetHeight)/2:s<t.scrollTop?t.scrollTop=s:l>t.scrollTop+t.clientHeight&&(t.scrollTop=l-t.clientHeight)},em=function(e){e!==this.value&&(this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},tm=function(){let e=this._text.trim(),t=e?Nr(e,i(this,P,Fi)):"";if(t===null){g(this,Ia,!0),a(this,P,em).call(this,""),this.requestUpdate();return}a(this,P,em).call(this,t),this._text=a(this,P,Ra).call(this,t)},uu=function(e){let t=ti(e);this.open=!1,a(this,P,em).call(this,t),this._text=a(this,P,Ra).call(this,t),this.renderRoot.querySelector("input")?.focus()},im=new WeakMap,rm=new WeakMap,sm=new WeakMap,Il=new WeakMap,Vi.formAssociated=!0,Vi.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Vi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},min:{},max:{},step:{type:Number},interval:{type:Number},hourCycle:{attribute:"hour-cycle"},locale:{noAccessor:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_text:{state:!0},_active:{state:!0}},Vi.styles=[E,Ve,ga,Fs,w`
|
|
1037
|
+
:host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
1038
|
+
:host { max-width: 100%; }
|
|
1039
|
+
.pop {
|
|
1040
|
+
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-4)); inset-inline-start: 0; min-width: 100%;
|
|
1041
|
+
background: var(--cm-bg-surface); color: var(--cm-text-default);
|
|
1042
|
+
border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-md);
|
|
1043
|
+
}
|
|
1044
|
+
.pop[hidden] { display: none; }
|
|
1045
|
+
[role='option'] { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
1046
|
+
[role='option'].active { background: var(--cm-bg-hover); }
|
|
1047
|
+
[role='option'][aria-selected='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
1048
|
+
[role='option'][aria-selected='true'].active { background: var(--cm-action-primary-hover); }
|
|
1049
|
+
input { font-variant-numeric: tabular-nums; }
|
|
1050
|
+
`];$("cm-time-picker",Vi);var tk=_("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 qx(o,n){if(!n.trim())return!0;let e=o.name.toLowerCase(),t=o.type.toLowerCase();return n.split(",").map(r=>r.trim().toLowerCase()).filter(Boolean).some(r=>r.startsWith(".")?e.endsWith(r):r.endsWith("/*")?t.startsWith(r.slice(0,-1)):t===r)}var tt,di,le,hi,F,Pl,gu,am,nm,fu,bu,vu,yu,Fr,$b,kb,xu,Eb,Mb,ji=class extends T{constructor(){super(...arguments);m(this,F);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,tt,this.attachInternals());m(this,di,new ee(this,i(this,tt)));m(this,le,H("cm-fu"));m(this,hi,new Map)}get form(){return i(this,tt).form}get validity(){return i(this,tt).validity}get validationMessage(){return i(this,tt).validationMessage}checkValidity(){return i(this,tt).checkValidity()}reportValidity(){return i(this,di).report(()=>i(this,tt).reportValidity())}formResetCallback(){i(this,di).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 i(this,hi).values())URL.revokeObjectURL(e);i(this,hi).clear()}updated(e){if(e.has("files"))for(let[l,d]of i(this,hi))this.files.includes(l)||(URL.revokeObjectURL(d),i(this,hi).delete(l));let t=new FormData;for(let l of this.files)t.append(this.name||"file",l);i(this,tt).setFormValue(this.files.length?t:null);let r=(i(this,F,Pl)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,s=this.error||this._rejected;s?i(this,tt).setValidity({customError:!0},s,r):this.required&&!this.files.length?i(this,tt).setValidity({valueMissing:!0},this.t("required"),r):i(this,tt).setValidity({}),i(this,di).sync()}addFiles(e){let t=[...e],r=[],s=[],l=[];for(let p of t)qx(p,i(this,F,gu))?this.maxSize&&p.size>this.maxSize?(s.push(p),l.push(this.t("tooLarge",{name:p.name,size:a(this,F,nm).call(this,this.maxSize)}))):r.push(p):(s.push(p),l.push(this.t("wrongType",{name:p.name})));let d=i(this,F,am)?[...this.files,...r]:r.slice(-1);!i(this,F,am)&&!r.length&&(d=this.files),i(this,F,am)&&this.maxFiles&&d.length>this.maxFiles&&(s.push(...d.slice(this.maxFiles)),l.push(this.t("tooMany",{max:this.maxFiles})),d=d.slice(0,this.maxFiles)),this._rejected=l.join(". "),s.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:s}})),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 r=new Map(this._progress);t==null?r.delete(e):r.set(e,Math.min(100,Math.max(0,Number(t)||0))),this._progress=r}setFileError(e,t){let r=new Map(this._fileErrors);t?r.set(e,t):r.delete(e),this._fileErrors=r}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(i(this,F,Pl))return a(this,F,Mb).call(this);let e=this.error||this._rejected||i(this,di).message,t=!this.files.length||this.multiple,r=this.files.length>0;return c`
|
|
1051
|
+
${this.label||this.hint&&r?c`<div class="head">
|
|
1052
|
+
${this.label?c`<span class="label" id="${i(this,le)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1053
|
+
${this.hint&&r?c`<span class="hint" id="${i(this,le)}-hint">${this.hint}</span>`:h}
|
|
986
1054
|
</div>`:h}
|
|
987
|
-
${
|
|
988
|
-
${this.files.map(a
|
|
989
|
-
${t?c`<li>${
|
|
990
|
-
</ul>`:
|
|
991
|
-
${e?c`<p class="msg" id="${
|
|
992
|
-
`}};
|
|
993
|
-
${e.type.startsWith("image/")?c`<img src=${
|
|
1055
|
+
${r?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
1056
|
+
${this.files.map(s=>a(this,F,kb).call(this,s))}
|
|
1057
|
+
${t?c`<li>${a(this,F,xu).call(this,!0)}</li>`:h}
|
|
1058
|
+
</ul>`:a(this,F,xu).call(this,!1)}
|
|
1059
|
+
${e?c`<p class="msg" id="${i(this,le)}-msg" role="alert">${e}</p>`:h}
|
|
1060
|
+
`}};tt=new WeakMap,di=new WeakMap,le=new WeakMap,hi=new WeakMap,F=new WeakSet,Pl=function(){return this.variant==="photo"},gu=function(){return this.accept||(i(this,F,Pl)?"image/*":"")},am=function(){return this.multiple&&!i(this,F,Pl)},nm=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})})},fu=function(e){let t=i(this,hi).get(e);return t||(t=URL.createObjectURL(e),i(this,hi).set(e,t)),t},bu=function(e){return this._progress.has(e)},vu=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)},yu=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},Fr=function(e){this.toggleAttribute("data-over",e),this._over=e},$b=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}`},kb=function(e){let t=a(this,F,bu).call(this,e),r=this._fileErrors.get(e)??"",s=`${i(this,le)}-e${this.files.indexOf(e)}`,l=this._progress.get(e)??0;return c`<li class="item"><div class="file ${t?"busy":""} ${r?"invalid":""}">
|
|
1061
|
+
${e.type.startsWith("image/")?c`<img src=${a(this,F,fu).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">${a(this,F,nm).call(this,e.size)}</span></div>`}
|
|
994
1062
|
${t?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
995
1063
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(l)}><span style="inline-size:${l}%"></span></div>`:h}
|
|
996
|
-
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>
|
|
1064
|
+
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>a(this,F,vu).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=${r?s:h}
|
|
997
1065
|
@click=${()=>this.removeFile(e)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
998
|
-
</div>${
|
|
999
|
-
@dragenter=${()=>
|
|
1000
|
-
<input type="file" id=${
|
|
1066
|
+
</div>${r?c`<p class="ferr" id=${s} role="alert">${r}</p>`:h}</li>`},xu=function(e){let t=this.error||this._rejected||i(this,di).message,r=[this.hint&&`${i(this,le)}-hint`,t&&`${i(this,le)}-msg`].filter(Boolean).join(" ");return c`<label class="zone ${e?"tile":"row"} ${t&&!e?"invalid":""}" part="zone"
|
|
1067
|
+
@dragenter=${()=>a(this,F,Fr).call(this,!0)} @dragleave=${()=>a(this,F,Fr).call(this,!1)} @drop=${()=>a(this,F,Fr).call(this,!1)}>
|
|
1068
|
+
<input type="file" id=${i(this,le)} accept=${this.accept||h} capture=${this.capture||h} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
1001
1069
|
?required=${this.required&&!this.files.length}
|
|
1002
|
-
aria-labelledby=${[this.label&&`${
|
|
1003
|
-
aria-describedby=${
|
|
1004
|
-
@change=${
|
|
1005
|
-
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${
|
|
1006
|
-
<span class="words"><span id="${
|
|
1007
|
-
</label>`},
|
|
1070
|
+
aria-labelledby=${[this.label&&`${i(this,le)}-l`,`${i(this,le)}-p`].filter(Boolean).join(" ")}
|
|
1071
|
+
aria-describedby=${r||h} aria-invalid=${t?"true":h}
|
|
1072
|
+
@change=${a(this,F,yu)} @cancel=${s=>s.stopPropagation()} />
|
|
1073
|
+
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${i(this,le)}-p">${this.t("addMore")}</span>`:c`<span class="ico"><cm-icon name="upload" size="20"></cm-icon></span>
|
|
1074
|
+
<span class="words"><span id="${i(this,le)}-p">${a(this,F,$b).call(this)}</span>${this.hint?c`<span class="hint" id="${i(this,le)}-hint">${this.hint}</span>`:h}</span>`}
|
|
1075
|
+
</label>`},Eb=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Mb=function(){let e=this.files[0],t=this.error||this._rejected||e&&this._fileErrors.get(e)||i(this,di).message,r=!!e&&a(this,F,bu).call(this,e),s=this.label||this.t("photo"),l=[this.hint&&`${i(this,le)}-hint`,t&&`${i(this,le)}-msg`].filter(Boolean).join(" "),d=u=>c`<input type="file" id=${i(this,le)} accept=${i(this,F,gu)} capture=${this.capture||h}
|
|
1008
1076
|
?disabled=${this.disabled} ?required=${this.required&&!e} tabindex=${u?"-1":h} aria-hidden=${u?"true":h}
|
|
1009
|
-
?hidden=${u} aria-labelledby=${u?h:`${
|
|
1010
|
-
@change=${
|
|
1011
|
-
${e?c`<div class="shot ${
|
|
1012
|
-
${e.type.startsWith("image/")?c`<img src=${
|
|
1013
|
-
${
|
|
1077
|
+
?hidden=${u} aria-labelledby=${u?h:`${i(this,le)}-p`} aria-describedby=${!u&&l||h} aria-invalid=${t?"true":h}
|
|
1078
|
+
@change=${a(this,F,yu)} @cancel=${b=>b.stopPropagation()} />`,p=this.hint?c`<span class="hint" id="${i(this,le)}-hint">${this.hint}</span>`:h;return c`
|
|
1079
|
+
${e?c`<div class="shot ${r?"busy":""}" part="photo">
|
|
1080
|
+
${e.type.startsWith("image/")?c`<img src=${a(this,F,fu).call(this,e)} alt=${s} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${a(this,F,nm).call(this,e.size)}</span></div>`}
|
|
1081
|
+
${r?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
1014
1082
|
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}
|
|
1015
1083
|
</div>
|
|
1016
1084
|
<p class="caption" aria-hidden="true">${this.label}</p>
|
|
1017
1085
|
${d(!0)}
|
|
1018
|
-
${this.disabled?h:
|
|
1019
|
-
<button type="button" class="action" aria-label=${this.t("cancel",{name:
|
|
1086
|
+
${this.disabled?h:r?c`<div class="actions" part="actions">
|
|
1087
|
+
<button type="button" class="action" aria-label=${this.t("cancel",{name:s})} @click=${()=>a(this,F,vu).call(this,e)}><cm-icon name="close" size="16"></cm-icon>${this.t("cancelShort")}</button>
|
|
1020
1088
|
</div>`:c`<div class="actions" part="actions">
|
|
1021
|
-
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:
|
|
1022
|
-
<button type="button" class="action" aria-label=${this.t("removeName",{name:
|
|
1089
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:s})} aria-describedby=${t?`${i(this,le)}-msg`:h} @click=${a(this,F,Eb)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
1090
|
+
<button type="button" class="action" aria-label=${this.t("removeName",{name:s})} @click=${()=>this.removeFile(e)}><cm-icon name="trash" size="16"></cm-icon>${this.t("removePhoto")}</button>
|
|
1023
1091
|
</div>`}`:c`<label class="zone photo ${t?"invalid":""}" part="zone photo"
|
|
1024
|
-
@dragenter=${()=>
|
|
1092
|
+
@dragenter=${()=>a(this,F,Fr).call(this,!0)} @dragleave=${()=>a(this,F,Fr).call(this,!1)} @drop=${()=>a(this,F,Fr).call(this,!1)}>
|
|
1025
1093
|
${d(!1)}
|
|
1026
1094
|
<cm-icon name="camera" size="24"></cm-icon>
|
|
1027
|
-
<span class="photo-label" id="${
|
|
1095
|
+
<span class="photo-label" id="${i(this,le)}-p" part="label">${this.label||this.t("takePhoto")}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
1028
1096
|
${p}
|
|
1029
1097
|
</label>`}
|
|
1030
|
-
${t?c`<p class="msg" id="${
|
|
1031
|
-
`},
|
|
1098
|
+
${t?c`<p class="msg" id="${i(this,le)}-msg" role="alert">${t}</p>`:h}
|
|
1099
|
+
`},ji.formAssociated=!0,ji.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},ji.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}},ji.styles=[E,w`
|
|
1032
1100
|
:host { display: block; }
|
|
1033
1101
|
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-8); margin-bottom: var(--cm-space-12); }
|
|
1034
1102
|
.label { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1112,33 +1180,33 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1112
1180
|
@media (max-width: 640px) {
|
|
1113
1181
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
1114
1182
|
}
|
|
1115
|
-
`];$("cm-file-upload",
|
|
1116
|
-
${this.label?c`<span class="label" id="${
|
|
1183
|
+
`];$("cm-file-upload",ji);var dk=_("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"}),Ox=[{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 mi(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 Bx=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,r)=>e+t*[.2126,.7152,.0722][r],0)};function Fx(o){let n=Bx(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var We,jr,Nt,ql,Pa,Q,Vr,wu,Tb,_b,$u,zb,Cb,Lb,Sb,Ui=class extends T{constructor(){super(...arguments);m(this,Q);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,We,this.attachInternals());m(this,jr,new ee(this,i(this,We)));m(this,Nt,H("cm-cf"));m(this,ql,"");m(this,Pa)}connectedCallback(){super.connectedCallback(),g(this,ql,mi(this.value)??this.value)}get form(){return i(this,We).form}get validity(){return i(this,We).validity}get validationMessage(){return i(this,We).validationMessage}checkValidity(){return i(this,We).checkValidity()}reportValidity(){return i(this,jr).report(()=>i(this,We).reportValidity())}formResetCallback(){i(this,jr).reset(),this.value=i(this,ql),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,r=mi(t?.value??"");return r?[{value:r,name:t.name}]:[]}):Ox.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=mi(this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==i(this,Pa)&&(this._draft=void 0,this._invalid=!1),g(this,Pa,void 0)}}updated(){let e=!this.value||mi(this.value)!==null;i(this,We).setFormValue(this.value&&e?this.value:null,this.value);let t=this.renderRoot.querySelector(".input")??void 0;this.error?i(this,We).setValidity({customError:!0},this.error,t):this._invalid||!e?i(this,We).setValidity({patternMismatch:!0},this.t("invalid"),t):this.required&&!this.value?i(this,We).setValidity({valueMissing:!0},this.t("required"),t):i(this,We).setValidity({}),i(this,jr).sync()}render(){let e=this.items,t=mi(this.value??""),r=e.findIndex(u=>u.value===t),s=this.error||(this._invalid||this.value&&!t?this.t("invalid"):"")||i(this,jr).message,l=[s&&`${i(this,Nt)}-err`,this.helpText&&`${i(this,Nt)}-help`].filter(Boolean).join(" ")||h,d=this.getAttribute("aria-label"),p=this.label||d||"";return c`<div class="field">
|
|
1184
|
+
${this.label?c`<span class="label" id="${i(this,Nt)}-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}
|
|
1117
1185
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
1118
|
-
aria-labelledby=${this.label?`${
|
|
1186
|
+
aria-labelledby=${this.label?`${i(this,Nt)}-l`:h} aria-label=${!this.label&&d?d:h}
|
|
1119
1187
|
aria-required=${this.required?"true":h} aria-describedby=${l}>
|
|
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===
|
|
1121
|
-
aria-label=${f} title=${u.name||u.value} tabindex=${b===(
|
|
1122
|
-
style="background-color:${u.value};color:${
|
|
1123
|
-
@click=${()=>
|
|
1188
|
+
${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===r?"true":"false"}
|
|
1189
|
+
aria-label=${f} title=${u.name||u.value} tabindex=${b===(r>=0?r:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
1190
|
+
style="background-color:${u.value};color:${Fx(u.value)}"
|
|
1191
|
+
@click=${()=>a(this,Q,wu).call(this,b)} @keydown=${x=>a(this,Q,Tb).call(this,x,b)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
1124
1192
|
</div>`:h}
|
|
1125
1193
|
<div class="row">
|
|
1126
1194
|
${this.picker?c`<label class="pick" part="picker" style=${t?`background-color:${t}`:h}>
|
|
1127
|
-
<input type="color" .value=${
|
|
1195
|
+
<input type="color" .value=${oe(t??"#000000")} ?disabled=${this.disabled}
|
|
1128
1196
|
aria-label=${p?this.t("pickerNamed",{label:p}):this.t("picker")}
|
|
1129
|
-
@input=${
|
|
1197
|
+
@input=${a(this,Q,Lb)} @change=${a(this,Q,Sb)} />
|
|
1130
1198
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1131
1199
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${t?`background-color:${t}`:h}></span>`}
|
|
1132
|
-
<input class="input" part="input" id=${
|
|
1133
|
-
maxlength="7" .value=${
|
|
1200
|
+
<input class="input" part="input" id=${i(this,Nt)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
1201
|
+
maxlength="7" .value=${oe(this._draft??this.value??"")} placeholder=${this.t("placeholder")}
|
|
1134
1202
|
aria-label=${p?this.t("hexNamed",{label:p}):this.t("hex")}
|
|
1135
1203
|
?required=${this.required} ?disabled=${this.disabled}
|
|
1136
|
-
aria-invalid=${
|
|
1137
|
-
@input=${
|
|
1204
|
+
aria-invalid=${s?"true":h} aria-describedby=${l}
|
|
1205
|
+
@input=${a(this,Q,_b)} @change=${a(this,Q,zb)} @keydown=${a(this,Q,Cb)} />
|
|
1138
1206
|
</div>
|
|
1139
|
-
${
|
|
1140
|
-
${this.helpText?c`<p class="help" id="${
|
|
1141
|
-
</div>`}};
|
|
1207
|
+
${s?c`<p class="error" id="${i(this,Nt)}-err" role="alert">${s}</p>`:h}
|
|
1208
|
+
${this.helpText?c`<p class="help" id="${i(this,Nt)}-help">${this.helpText}</p>`:h}
|
|
1209
|
+
</div>`}};We=new WeakMap,jr=new WeakMap,Nt=new WeakMap,ql=new WeakMap,Pa=new WeakMap,Q=new WeakSet,Vr=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},wu=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,a(this,Q,Vr).call(this,"input","change")))},Tb=function(e,t){let r=this.items.length,s=te(e,this),l;if(s==="ArrowRight"||e.key==="ArrowDown")l=(t+1)%r;else if(s==="ArrowLeft"||e.key==="ArrowUp")l=(t-1+r)%r;else if(e.key==="Home")l=0;else if(e.key==="End")l=r-1;else if(e.key===" "||e.key==="Enter")l=t;else return;e.preventDefault(),a(this,Q,wu).call(this,l)},_b=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let r=/^#?[0-9a-f]{6}$/i.test(t.trim())?mi(t):null;r&&r!==this.value&&(g(this,Pa,r),this.value=r,a(this,Q,Vr).call(this,"input")),this._invalid&&(r||!t.trim())&&(this._invalid=!1)},$u=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?mi(e):"";if(t===null){this._invalid=!0;return}let r=this.value;this.value=t,this._draft=void 0,this._invalid=!1,t!==r&&a(this,Q,Vr).call(this,"input"),a(this,Q,Vr).call(this,"change")},zb=function(e){e.stopPropagation(),a(this,Q,$u).call(this)},Cb=function(e){e.key==="Enter"&&a(this,Q,$u).call(this)},Lb=function(e){e.stopPropagation();let t=mi(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,a(this,Q,Vr).call(this,"input"))},Sb=function(e){e.stopPropagation(),a(this,Q,Vr).call(this,"change")},Ui.formAssociated=!0,Ui.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Ui.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}},Ui.styles=[E,lt,w`
|
|
1142
1210
|
:host { display: block; }
|
|
1143
1211
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
1144
1212
|
.swatch {
|
|
@@ -1177,18 +1245,18 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1177
1245
|
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
1178
1246
|
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
1179
1247
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
1180
|
-
`];$("cm-color-field",
|
|
1248
|
+
`];$("cm-color-field",Ui);var vk=_("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."}),ku=3,om=.7,Vx=.0055,lm="#000000",Db=8,Ol=2,jx=400,Ux=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),it,Kr,Bl,qa,Fl,gt,ft,bt,Wi,Gi,Ne,Vl,Yi,Oa,L,Eu,cm,Mu,pi,dm,Tu,_u,Ab,zu,hm,Cu,mm,Rb,Lu,Hb,Ur,pm,Su,Du,Nb,Au,Ib,Ru,Pb,qb,Ki=class extends T{constructor(){super(...arguments);m(this,L);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,it,this.attachInternals());m(this,Kr,new ee(this,i(this,it)));m(this,Bl,H("cm-sig"));m(this,qa,"");m(this,Fl,"");m(this,gt,[]);m(this,ft);m(this,bt);m(this,Wi,"");m(this,Gi,0);m(this,Ne);m(this,Vl,"");m(this,Yi);m(this,Oa,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?a(this,L,Eu).call(this):(g(this,qa,this.value),g(this,Fl,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),i(this,Yi)?.disconnect(),g(this,Yi,void 0),cancelAnimationFrame(i(this,Gi)),g(this,Gi,0),i(this,Ne)&&(clearTimeout(i(this,Ne)),g(this,Ne,void 0))}get form(){return i(this,it).form}get validity(){return i(this,it).validity}get validationMessage(){return i(this,it).validationMessage}checkValidity(){return i(this,it).checkValidity()}reportValidity(){return i(this,Kr).report(()=>i(this,it).reportValidity())}formResetCallback(){i(this,Kr).reset(),g(this,gt,[]),g(this,ft,void 0),g(this,bt,void 0),i(this,Ne)&&(clearTimeout(i(this,Ne)),g(this,Ne,void 0)),this.typedName=i(this,Fl),i(this,qa)?(g(this,Wi,""),this.value=i(this,qa)):this.updateComplete.then(()=>a(this,L,Ur).call(this,!1)),a(this,L,pi).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!i(this,gt).length&&!i(this,bt)}toDataURL(){return a(this,L,Su).call(this)?.toDataURL("image/png")??""}toBlob(){let e=a(this,L,Su).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(g(this,gt,[]),g(this,ft,void 0),g(this,bt,void 0),a(this,L,pi).call(this)),a(this,L,Ur).call(this,!0)}undo(){this.mode==="draw"&&(i(this,gt).length?i(this,gt).pop():g(this,bt,void 0),g(this,ft,void 0),a(this,L,pi).call(this),a(this,L,Ur).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==i(this,Wi)){let t=this.value??"";if(g(this,Wi,t),g(this,gt,[]),g(this,ft,void 0),!t)g(this,bt,void 0),this.hasUpdated&&(this.typedName="");else{let r=new Image;r.addEventListener("load",()=>{i(this,bt)===r&&a(this,L,pi).call(this)}),r.src=t,g(this,bt,r),this.mode="draw"}a(this,L,pi).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();g(this,Wi,t),this.value=t}}firstUpdated(){a(this,L,Eu).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>a(this,L,Ur).call(this,!1)),a(this,L,mm).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&a(this,L,mm).call(this),i(this,it).setFormValue(this.value||null,this.value);let t=(this.mode==="type"?this.renderRoot.querySelector(".typed"):this.renderRoot.querySelector('.tab[aria-selected="true"]'))??void 0;this.error?i(this,it).setValidity({customError:!0},this.error,t):this.required&&this.empty?i(this,it).setValidity({valueMissing:!0},this.t("required"),t):i(this,it).setValidity({}),i(this,Kr).sync()}render(){let e=i(this,Bl),t=this.getAttribute("aria-label"),r=i(this,Kr).message,s=[r&&`${e}-err`,this.helpText&&`${e}-help`].filter(Boolean).join(" "),l=this.empty,d=!i(this,gt).length&&!i(this,bt),p=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
1181
1249
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
1182
1250
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
1183
|
-
@click=${()=>
|
|
1251
|
+
@click=${()=>a(this,L,Du).call(this,u,!0)} @keydown=${a(this,L,Nb)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
1184
1252
|
${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}
|
|
1185
1253
|
<div class="bar">
|
|
1186
1254
|
<div class="tabs" role="tablist" part="tabs"
|
|
1187
1255
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
1188
1256
|
aria-label=${this.label?h:t||this.t("modes")}>${p("draw")}${p("type")}</div>
|
|
1189
1257
|
<div class="actions">
|
|
1190
|
-
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${
|
|
1191
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${
|
|
1258
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${a(this,L,Pb)}>${this.t("undo")}</button>`:h}
|
|
1259
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${a(this,L,qb)}>${this.t("clear")}</button>
|
|
1192
1260
|
</div>
|
|
1193
1261
|
</div>
|
|
1194
1262
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -1197,9 +1265,9 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1197
1265
|
<span class="line" aria-hidden="true"></span>
|
|
1198
1266
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
1199
1267
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
1200
|
-
aria-describedby=${[`${e}-instr`,
|
|
1201
|
-
@pointerdown=${
|
|
1202
|
-
@lostpointercapture=${
|
|
1268
|
+
aria-describedby=${[`${e}-instr`,s].filter(Boolean).join(" ")}
|
|
1269
|
+
@pointerdown=${a(this,L,Ab)} @pointermove=${a(this,L,zu)} @pointerup=${a(this,L,hm)} @pointercancel=${a(this,L,hm)}
|
|
1270
|
+
@lostpointercapture=${a(this,L,hm)} @transitionend=${()=>a(this,L,dm).call(this)}></canvas>
|
|
1203
1271
|
</div>
|
|
1204
1272
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
1205
1273
|
</div>
|
|
@@ -1207,17 +1275,17 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1207
1275
|
<div class="pad" part="pad">
|
|
1208
1276
|
<span class="line" aria-hidden="true"></span>
|
|
1209
1277
|
<input class="typed" part="input" type="text" autocomplete="name" spellcheck="false" maxlength="80"
|
|
1210
|
-
.value=${
|
|
1278
|
+
.value=${oe(this.typedName??"")} placeholder=${this.t("typePlaceholder")}
|
|
1211
1279
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
1212
|
-
aria-required=${this.required?"true":h} aria-invalid=${
|
|
1213
|
-
aria-describedby=${
|
|
1214
|
-
@input=${
|
|
1280
|
+
aria-required=${this.required?"true":h} aria-invalid=${r?"true":h}
|
|
1281
|
+
aria-describedby=${s||h} ?disabled=${this.disabled}
|
|
1282
|
+
@input=${a(this,L,Rb)} @change=${a(this,L,Hb)} />
|
|
1215
1283
|
</div>
|
|
1216
1284
|
</div>
|
|
1217
|
-
${
|
|
1285
|
+
${r?c`<p class="error" id="${e}-err" role="alert">${r}</p>`:h}
|
|
1218
1286
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
1219
1287
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
1220
|
-
</div>`}};
|
|
1288
|
+
</div>`}};it=new WeakMap,Kr=new WeakMap,Bl=new WeakMap,qa=new WeakMap,Fl=new WeakMap,gt=new WeakMap,ft=new WeakMap,bt=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,Ne=new WeakMap,Vl=new WeakMap,Yi=new WeakMap,Oa=new WeakMap,L=new WeakSet,Eu=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||i(this,Yi)||(g(this,Yi,new ResizeObserver(()=>a(this,L,Mu).call(this))),i(this,Yi).observe(e))},cm=function(){return this.renderRoot.querySelector("canvas")},Mu=function(){let e=i(this,L,cm);if(!e)return;let t=e.clientWidth,r=e.clientHeight;if(!t||!r)return;g(this,Oa,t);let s=window.devicePixelRatio||1,l=Math.round(t*s),d=Math.round(r*s);(e.width!==l||e.height!==d)&&(e.width=l,e.height=d),a(this,L,dm).call(this)},pi=function(){i(this,Gi)||g(this,Gi,requestAnimationFrame(()=>{g(this,Gi,0),a(this,L,dm).call(this)}))},dm=function(){let e=i(this,L,cm);if(!e||!e.width)return;let t=e.getContext("2d"),r=e.clientWidth||i(this,Oa);if(!r)return;let s=e.width/r;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),t.setTransform(s,0,0,s,0,0);let l=getComputedStyle(e).color||lm;a(this,L,Tu).call(this,t,r,l,!0)},Tu=function(e,t,r,s){let l=t/ku,d=i(this,bt);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(s&&!Gx(r,lm)){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=r,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=r,e.fillStyle=r,e.lineCap="round",e.lineJoin="round";for(let p of i(this,gt))Kx(e,p,t)},_u=function(e,t){let r=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:r}},Ab=function(e){if(this.disabled||i(this,ft)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.currentTarget;e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}let r=[a(this,L,_u).call(this,e,t.getBoundingClientRect())];g(this,ft,{id:e.pointerId,stroke:r}),i(this,gt).push(r),a(this,L,pi).call(this)},zu=function(e){let t=i(this,ft);if(!t||e.pointerId!==t.id)return;e.preventDefault();let r=e.currentTarget.getBoundingClientRect(),s=typeof e.getCoalescedEvents=="function"?e.getCoalescedEvents():[];for(let l of s.length?s:[e]){let d=a(this,L,_u).call(this,l,r),p=t.stroke[t.stroke.length-1];Math.hypot(d.x-p.x,d.y-p.y)*r.width<1.5||t.stroke.push(d)}a(this,L,pi).call(this)},hm=function(e){let t=i(this,ft);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&a(this,L,zu).call(this,e),g(this,ft,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}a(this,L,pi).call(this),a(this,L,Ur).call(this,!0)}},Cu=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},mm=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${i(this,L,Cu)}`,r=!0;try{r=e.check(t,this.typedName||"Signature")}catch{}r||e.load(t,this.typedName||"Signature").then(()=>{this.mode==="type"&&this.typedName.trim()&&a(this,L,Ur).call(this,!1)},()=>{})},Rb=function(e){e.stopPropagation(),i(this,Ne)?clearTimeout(i(this,Ne)):g(this,Vl,this.value),this.typedName=e.target.value,g(this,Ne,setTimeout(()=>a(this,L,Lu).call(this),jx)),a(this,L,mm).call(this)},Lu=function(){i(this,Ne)&&(clearTimeout(i(this,Ne)),g(this,Ne,void 0),this.value!==i(this,Vl)&&a(this,L,pm).call(this))},Hb=function(e){e.stopPropagation(),this.updateComplete.then(()=>a(this,L,Lu).call(this))},Ur=function(e){let t=this.empty?"":this.toDataURL(),r=t!==this.value;r&&(g(this,Wi,t),this.value=t),this.requestUpdate(),e&&r&&a(this,L,pm).call(this)},pm=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}))},Su=function(){if(this.empty)return;let e=Math.max(i(this,L,cm)?.clientWidth||i(this,Oa)||600,300),t=e/ku,r=document.createElement("canvas");r.width=Math.round(e*Ol),r.height=Math.round(t*Ol);let s=r.getContext("2d",{willReadFrequently:!0});if(s.scale(Ol,Ol),this.mode==="type"){let l=Math.min(t*.45,64),d=i(this,L,Cu);s.font=`400 ${l}px ${d}`;let p=this.typedName.trim(),u=e-2*Db,b=s.measureText(p).width;b>u&&(l*=u/b,s.font=`400 ${l}px ${d}`),s.direction=getComputedStyle(this).direction==="rtl"?"rtl":"ltr",s.textAlign="center",s.textBaseline="alphabetic",s.fillStyle=lm,s.fillText(p,e/2,t*om)}else a(this,L,Tu).call(this,s,e,lm,!1);return Wx(r,Db*Ol)},Du=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${i(this,Bl)}-tab-${e}`)?.focus()),e===this.mode))return;let r=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&a(this,L,Mu).call(this),this.value!==r&&a(this,L,pm).call(this)})},Nb=function(e){let t=te(e,this),r;if(t==="ArrowRight"||t==="ArrowLeft")r=this.mode==="draw"?"type":"draw";else if(e.key==="Home")r="draw";else if(e.key==="End")r="type";else return;e.preventDefault(),a(this,L,Du).call(this,r,!0)},Au=function(e){a(this,L,Ib).call(this,this.t(e))},Ib=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},Ru=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()})},Pb=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),a(this,L,Au).call(this,"undone"),a(this,L,Ru).call(this,e)},qb=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),a(this,L,Au).call(this,"cleared"),a(this,L,Ru).call(this,e)},Ki.formAssociated=!0,Ki.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},Ki.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}},Ki.styles=[E,w`
|
|
1221
1289
|
:host { display: block; }
|
|
1222
1290
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1223
1291
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -1247,7 +1315,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1247
1315
|
.act:disabled { background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed; }
|
|
1248
1316
|
.panel:focus { outline: none; }
|
|
1249
1317
|
.pad {
|
|
1250
|
-
position: relative; width: 100%; aspect-ratio: ${
|
|
1318
|
+
position: relative; width: 100%; aspect-ratio: ${ku} / 1; overflow: hidden; container-type: inline-size;
|
|
1251
1319
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
1252
1320
|
}
|
|
1253
1321
|
.panel:focus-visible .pad, .pad:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
@@ -1258,15 +1326,15 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1258
1326
|
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 */
|
|
1259
1327
|
}
|
|
1260
1328
|
.line {
|
|
1261
|
-
position: absolute; inset-inline: var(--cm-space-12); top: ${
|
|
1329
|
+
position: absolute; inset-inline: var(--cm-space-12); top: ${om*100}%; height: 0;
|
|
1262
1330
|
border-top: var(--cm-border-1) dashed var(--cm-border-input); pointer-events: none;
|
|
1263
1331
|
}
|
|
1264
1332
|
.here {
|
|
1265
|
-
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-
|
|
1333
|
+
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-om)*100}% + 4px);
|
|
1266
1334
|
font-size: 12px; color: var(--cm-text-tertiary); pointer-events: none; user-select: none;
|
|
1267
1335
|
}
|
|
1268
1336
|
.typed {
|
|
1269
|
-
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-
|
|
1337
|
+
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-om)*100}% - 0.18em);
|
|
1270
1338
|
width: calc(100% - 2 * var(--cm-space-12)); padding: 0; margin: 0;
|
|
1271
1339
|
font-family: var(--cm-signature-font, 'Dancing Script', 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', 'Brush Script MT', cursive);
|
|
1272
1340
|
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 */
|
|
@@ -1283,19 +1351,19 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1283
1351
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
1284
1352
|
|
|
1285
1353
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1286
|
-
`];function
|
|
1287
|
-
${this.label?c`<span class="label" id="${
|
|
1354
|
+
`];function Kx(o,n,e){let t=d=>e*Vx*(.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 r=d=>[d.x*e,d.y*e],s=n[0];for(let d=1;d<n.length-1;d++){let p=Ux(n[d],n[d+1]);o.beginPath(),o.moveTo(...r(s)),o.quadraticCurveTo(...r(n[d]),...r(p)),o.lineWidth=t(n[d].p),o.stroke(),s=p}let l=n[n.length-1];o.beginPath(),o.moveTo(...r(s)),o.lineTo(...r(l)),o.lineWidth=t(l.p),o.stroke()}function Wx(o,n){let{width:e,height:t}=o,r=o.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e,t).data,s=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++)r[f+x*4+3]>8&&(x<l&&(l=x),x>d&&(d=x),b<s&&(s=b),p=b)}if(d<0)return;let u=document.createElement("canvas");return u.width=d-l+1+2*n,u.height=p-s+1+2*n,u.getContext("2d").drawImage(o,l,s,d-l+1,p-s+1,n,n,d-l+1,p-s+1),u}function Gx(o,n){let e=t=>{let r=/^#([0-9a-f]{6})$/i.exec(t.trim());if(r){let s=parseInt(r[1],16);return`${s>>16&255},${s>>8&255},${s&255}`}return(/\d+\s*,\s*\d+\s*,\s*\d+/.exec(t)?.[0]??t).replace(/\s/g,"")};return e(o)===e(n)}$("cm-signature-field",Ki);var Mk=_("optionGroup",{required:"Please select one of these options."}),vt,Wr,Gr,Ba,jl,Pt,Hu,Nu,Ob,It=class extends T{constructor(){super(...arguments);m(this,Pt);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];m(this,vt,this.attachInternals());m(this,Wr,new ee(this,i(this,vt),()=>this.renderRoot.querySelector('button[tabindex="0"]')?.focus()));m(this,Gr,H("cm-og"));m(this,Ba,"");m(this,jl,new MutationObserver(()=>a(this,Pt,Hu).call(this)))}connectedCallback(){super.connectedCallback(),a(this,Pt,Hu).call(this),i(this,jl).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),i(this,jl).disconnect()}get form(){return i(this,vt).form}get validity(){return i(this,vt).validity}get validationMessage(){return i(this,vt).validationMessage}checkValidity(){return i(this,vt).checkValidity()}reportValidity(){return i(this,Wr).report(()=>i(this,vt).reportValidity())}formResetCallback(){this.value=i(this,Ba),i(this,Wr).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(){i(this,Ba)||g(this,Ba,this.value)}updated(){i(this,vt).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?i(this,vt).setValidity({valueMissing:!0},this.t("required"),e):i(this,vt).setValidity({}),i(this,Wr).sync()}render(){let e=this.items,t=e.findIndex(d=>d.value===this.value&&!d.disabled),r=t>=0?t:e.findIndex(d=>!d.disabled),s=this.getAttribute("aria-label"),l=i(this,Wr).message;return c`
|
|
1355
|
+
${this.label?c`<span class="label" id="${i(this,Gr)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1288
1356
|
<div class="options" part="options" role="radiogroup"
|
|
1289
|
-
aria-labelledby=${this.label?`${
|
|
1357
|
+
aria-labelledby=${this.label?`${i(this,Gr)}-l`:h} aria-label=${!this.label&&s?s:h}
|
|
1290
1358
|
aria-required=${this.required?"true":h} aria-invalid=${l?"true":h}
|
|
1291
|
-
aria-describedby=${l?`${
|
|
1359
|
+
aria-describedby=${l?`${i(this,Gr)}-err`:h}>
|
|
1292
1360
|
${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===
|
|
1294
|
-
@click=${()=>
|
|
1361
|
+
tabindex=${p===r?"0":"-1"} ?disabled=${this.disabled||!!d.disabled}
|
|
1362
|
+
@click=${()=>a(this,Pt,Nu).call(this,p)} @keydown=${u=>a(this,Pt,Ob).call(this,u,p)}>${d.label}</button>`)}
|
|
1295
1363
|
</div>
|
|
1296
|
-
${l?c`<p class="error" id="${
|
|
1364
|
+
${l?c`<p class="error" id="${i(this,Gr)}-err" role="alert">${l}</p>`:h}
|
|
1297
1365
|
<slot></slot>
|
|
1298
|
-
`}};
|
|
1366
|
+
`}};vt=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Ba=new WeakMap,jl=new WeakMap,Pt=new WeakSet,Hu=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let r={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},s=t.getAttribute("tone");return(s==="critical"||s==="success")&&(r.tone=s),r}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,Ba,this.value))},Nu=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}))))},Ob=function(e,t){let r=te(e,this),s=this.items.flatMap((p,u)=>p.disabled?[]:[u]),l=s.indexOf(t),d;if(r==="ArrowRight"||e.key==="ArrowDown")d=s[(l+1)%s.length];else if(r==="ArrowLeft"||e.key==="ArrowUp")d=s[(l-1+s.length)%s.length];else if(e.key==="Home")d=s[0];else if(e.key==="End")d=s[s.length-1];else return;e.preventDefault(),d!==void 0&&a(this,Pt,Nu).call(this,d)},It.formAssociated=!0,It.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},It.styles=[E,w`
|
|
1299
1367
|
:host { display: block; }
|
|
1300
1368
|
.label {
|
|
1301
1369
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1329,7 +1397,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1329
1397
|
/* 1.14: the field's own message under the options. */
|
|
1330
1398
|
.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); }
|
|
1331
1399
|
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
1332
|
-
`];$("cm-option-group",
|
|
1400
|
+
`];$("cm-option-group",It);var Dk=_("segmentedControl",{required:"Please select one of these options."}),Fa=class extends It{constructor(){super(...arguments);this.size="default"}};Fa.properties={...It.properties,size:{reflect:!0}},Fa.styles=[E,w`
|
|
1333
1401
|
:host { display: inline-block; vertical-align: middle; max-width: 100%; --_h: var(--cm-control-height-md, 36px); }
|
|
1334
1402
|
:host([size='small']) { --_h: var(--cm-control-height-sm, 32px); }
|
|
1335
1403
|
@media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
|
|
@@ -1359,12 +1427,12 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1359
1427
|
button[aria-checked='true']:disabled { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
1360
1428
|
:host([disabled]) .options { background: var(--cm-bg-input-filled); }
|
|
1361
1429
|
slot { display: none; }
|
|
1362
|
-
`];$("cm-segmented-control",
|
|
1430
|
+
`];$("cm-segmented-control",Fa);var Ik=_("pageHeader",{back:"Back to {label}",backOnly:"Back",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),Ul,Iu,Va=class extends T{constructor(){super(...arguments);m(this,Ul);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(r=>r.href);return c`<header part="header">
|
|
1363
1431
|
<div class=${this.description?"lead described":"lead"}>
|
|
1364
1432
|
${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}
|
|
1365
1433
|
<div class="titles">
|
|
1366
1434
|
${e.length?c`<nav aria-label=${this.t("breadcrumbs")} part="breadcrumbs"><ol>
|
|
1367
|
-
${e.map(
|
|
1435
|
+
${e.map(r=>c`<li>${r.href?c`<a href=${r.href}>${r.label}</a>`:r.label}</li>`)}
|
|
1368
1436
|
<li><span aria-current="page">${this.heading}</span></li>
|
|
1369
1437
|
</ol></nav>`:h}
|
|
1370
1438
|
<h1 part="title"><span class="text">${this.heading}</span><slot name="title-adornment"></slot></h1>
|
|
@@ -1373,12 +1441,12 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1373
1441
|
</div>
|
|
1374
1442
|
<div class="actions">
|
|
1375
1443
|
${this.pagination?c`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
1376
|
-
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>
|
|
1377
|
-
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>
|
|
1444
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>a(this,Ul,Iu).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
1445
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>a(this,Ul,Iu).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
1378
1446
|
</div>`:h}
|
|
1379
1447
|
<slot name="actions"></slot>
|
|
1380
1448
|
</div>
|
|
1381
|
-
</header>`}};
|
|
1449
|
+
</header>`}};Ul=new WeakSet,Iu=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Va.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"}},Va.styles=[E,w`
|
|
1382
1450
|
:host { display: block; }
|
|
1383
1451
|
header {
|
|
1384
1452
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-12) var(--cm-space-20);
|
|
@@ -1436,7 +1504,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1436
1504
|
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
1437
1505
|
.actions { gap: var(--cm-space-8); }
|
|
1438
1506
|
}
|
|
1439
|
-
`];$("cm-page-header",
|
|
1507
|
+
`];$("cm-page-header",Va);var Vk=_("actionBar",{label:"Actions"}),ja=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")}>
|
|
1440
1508
|
<div class="lead">
|
|
1441
1509
|
${e?c`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:h}
|
|
1442
1510
|
<div class="text">
|
|
@@ -1446,7 +1514,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1446
1514
|
</div>
|
|
1447
1515
|
</div>
|
|
1448
1516
|
<div class="actions"><slot name="actions"></slot></div>
|
|
1449
|
-
</div>`}};
|
|
1517
|
+
</div>`}};ja.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},ja.styles=[E,w`
|
|
1450
1518
|
:host { display: block; }
|
|
1451
1519
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
1452
1520
|
.bar {
|
|
@@ -1477,13 +1545,13 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1477
1545
|
|
|
1478
1546
|
.actions { gap: var(--cm-space-8); }
|
|
1479
1547
|
}
|
|
1480
|
-
`];$("cm-action-bar",
|
|
1548
|
+
`];$("cm-action-bar",ja);var Gk=_("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),qt,Yr,Kl,Ie,Pu,qu,Ou,Bb,Fb,Ua=class extends T{constructor(){super(...arguments);m(this,Ie);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";m(this,qt,null);m(this,Yr,()=>{this.open=!0});m(this,Kl,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>a(this,Ie,Pu).call(this))}disconnectedCallback(){super.disconnectedCallback(),a(this,Ie,qu).call(this)}updated(e){e.has("form")&&this.isConnected&&a(this,Ie,Pu).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1481
1549
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1482
1550
|
<div class="actions">
|
|
1483
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${
|
|
1484
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${
|
|
1551
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${a(this,Ie,Fb)}>${this.discardLabel}</cm-button>
|
|
1552
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${a(this,Ie,Bb)}>${this.saveLabel}</cm-button>
|
|
1485
1553
|
</div>
|
|
1486
|
-
</div>`}};
|
|
1554
|
+
</div>`}};qt=new WeakMap,Yr=new WeakMap,Kl=new WeakMap,Ie=new WeakSet,Pu=function(){a(this,Ie,qu).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,qt,e),e.addEventListener("input",i(this,Yr)),e.addEventListener("change",i(this,Yr)),e.addEventListener("reset",i(this,Kl)))},qu=function(){let e=i(this,qt);e&&(e.removeEventListener("input",i(this,Yr)),e.removeEventListener("change",i(this,Yr)),e.removeEventListener("reset",i(this,Kl)),g(this,qt,null))},Ou=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},Bb=function(){this.loading||this.saveDisabled||a(this,Ie,Ou).call(this,"cm-save")&&i(this,qt)&&i(this,qt).requestSubmit()},Fb=function(){this.loading||a(this,Ie,Ou).call(this,"cm-discard")&&i(this,qt)&&(i(this,qt).reset(),this.open=!1)},Ua.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:{}},Ua.styles=[E,w`
|
|
1487
1555
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1488
1556
|
:host(:not([open])) { display: none; }
|
|
1489
1557
|
.bar {
|
|
@@ -1499,14 +1567,14 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1499
1567
|
.message { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; }
|
|
1500
1568
|
|
|
1501
1569
|
}
|
|
1502
|
-
`];$("cm-save-bar"
|
|
1570
|
+
`];$("cm-save-bar",Ua);var eE=_("infoItem",{edit:"Edit {label}"}),Ka=class extends C{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}>
|
|
1503
1571
|
${this.heading||this.action?c`<header>
|
|
1504
1572
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
1505
1573
|
${this.action?c`<button class="action" type="button" part="action" aria-label=${this.actionLabel||h}
|
|
1506
1574
|
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h}
|
|
1507
1575
|
</header>`:h}
|
|
1508
|
-
<div class="items" role=${this._list?"list":h}><slot @slotchange=${t=>{this._list=t.target.assignedElements().every(
|
|
1509
|
-
</section>`}};
|
|
1576
|
+
<div class="items" role=${this._list?"list":h}><slot @slotchange=${t=>{this._list=t.target.assignedElements().every(r=>r.localName==="cm-info-item")}}></slot></div>
|
|
1577
|
+
</section>`}};Ka.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},layout:{reflect:!0},_list:{state:!0}},Ka.styles=[E,w`
|
|
1510
1578
|
:host { display: block; }
|
|
1511
1579
|
section {
|
|
1512
1580
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -1531,9 +1599,9 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1531
1599
|
display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: baseline;
|
|
1532
1600
|
column-gap: var(--cm-space-12); grid-column: 1 / -1; --_cm-info-value-gap: 0px;
|
|
1533
1601
|
}
|
|
1534
|
-
`];$("cm-info-panel",
|
|
1602
|
+
`];$("cm-info-panel",Ka);var Wa=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"
|
|
1535
1603
|
aria-label=${this.editLabel||this.t("edit",{label:this.label})}
|
|
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}`}};
|
|
1604
|
+
@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}`}};Wa.properties={label:{},half:{type:Boolean,reflect:!0},editable:{type:Boolean,reflect:!0},editLabel:{attribute:"edit-label"}},Wa.styles=[E,w`
|
|
1537
1605
|
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
1538
1606
|
:host([half]) { grid-column: auto; }
|
|
1539
1607
|
.label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
|
|
@@ -1552,16 +1620,16 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1552
1620
|
.edit:hover { background: var(--cm-bg-hover); color: var(--cm-icon-selected); }
|
|
1553
1621
|
.edit:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1554
1622
|
@media (pointer: coarse) { .edit::after { content: ''; position: absolute; inset: -8px; } }
|
|
1555
|
-
`];$("cm-info-item",
|
|
1623
|
+
`];$("cm-info-item",Wa);var Xr,Ga=class extends C{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;m(this,Xr,H("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">
|
|
1556
1624
|
<div class="h" role="heading" aria-level=${e}>
|
|
1557
|
-
<button type="button" part="toggle" id="${
|
|
1625
|
+
<button type="button" part="toggle" id="${i(this,Xr)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${i(this,Xr)}-body"
|
|
1558
1626
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
1559
1627
|
<span>${this.heading}</span>
|
|
1560
1628
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
1561
1629
|
</button>
|
|
1562
1630
|
</div>
|
|
1563
|
-
<div class="body" part="body" id="${
|
|
1564
|
-
</div>`}};
|
|
1631
|
+
<div class="body" part="body" id="${i(this,Xr)}-body" role="region" aria-labelledby="${i(this,Xr)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
1632
|
+
</div>`}};Xr=new WeakMap,Ga.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Ga.styles=[E,w`
|
|
1565
1633
|
:host { display: block; }
|
|
1566
1634
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
1567
1635
|
.h { margin: 0; font: inherit; }
|
|
@@ -1584,24 +1652,24 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1584
1652
|
.body[hidden] { display: none; }
|
|
1585
1653
|
|
|
1586
1654
|
|
|
1587
|
-
`];$("cm-accordion",
|
|
1655
|
+
`];$("cm-accordion",Ga);var Ge,Jr,Bu,Vb,Ya=class extends C{constructor(){super(...arguments);m(this,Ge);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 a(this,Ge,Vb).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">
|
|
1588
1656
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1589
|
-
<slot name="image" @slotchange=${
|
|
1657
|
+
<slot name="image" @slotchange=${r=>a(this,Ge,Jr).call(this,r,"hasImage")}>${t}</slot>
|
|
1590
1658
|
</div>
|
|
1591
1659
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1592
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${
|
|
1593
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${
|
|
1594
|
-
</div>`}};
|
|
1595
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},
|
|
1660
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${r=>a(this,Ge,Jr).call(this,r,"hasText")}></slot></div>
|
|
1661
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${r=>a(this,Ge,Jr).call(this,r,"hasActions")}></slot></div>${this.action?c`<div class="actions">${a(this,Ge,Bu).call(this)}</div>`:h}
|
|
1662
|
+
</div>`}};Ge=new WeakSet,Jr=function(e,t){let r=e.target;this[t]=r.assignedNodes({flatten:!0}).some(s=>s.nodeType===1||s.textContent.trim()),this.requestUpdate()},Bu=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"
|
|
1663
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},Vb=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">
|
|
1596
1664
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1597
|
-
<slot name="image" @slotchange=${
|
|
1665
|
+
<slot name="image" @slotchange=${r=>a(this,Ge,Jr).call(this,r,"hasImage")}>${t}</slot>
|
|
1598
1666
|
</span>
|
|
1599
1667
|
<div class="line">
|
|
1600
1668
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1601
|
-
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${
|
|
1602
|
-
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${
|
|
1669
|
+
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${r=>a(this,Ge,Jr).call(this,r,"hasText")}></slot></span>${a(this,Ge,Bu).call(this)}
|
|
1670
|
+
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${r=>a(this,Ge,Jr).call(this,r,"hasActions")}></slot></span>
|
|
1603
1671
|
</div>
|
|
1604
|
-
</div>`},
|
|
1672
|
+
</div>`},Ya.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0},action:{},actionHref:{attribute:"action-href"}},Ya.styles=[E,w`
|
|
1605
1673
|
:host { display: block; }
|
|
1606
1674
|
/* 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. */
|
|
1607
1675
|
.wrap {
|
|
@@ -1650,7 +1718,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1650
1718
|
:host([size='large']) .circle { width: 120px; height: 120px; }
|
|
1651
1719
|
:host([size='large']) .title { margin-top: var(--cm-space-16); }
|
|
1652
1720
|
}
|
|
1653
|
-
`];$("cm-empty-state",
|
|
1721
|
+
`];$("cm-empty-state",Ya);var jb={small:34,medium:40,large:50,xlarge:186},Xa=class extends C{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=jb[this.size]??jb.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,r)=>c`<span class="bone line ${e>1&&r===e-1?"short":""}" part="bone"></span>`)}`}};Xa.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},Xa.styles=[E,w`
|
|
1654
1722
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
1655
1723
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
1656
1724
|
.bone {
|
|
@@ -1665,17 +1733,17 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1665
1733
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
1666
1734
|
}
|
|
1667
1735
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
1668
|
-
`];$("cm-skeleton",
|
|
1736
|
+
`];$("cm-skeleton",Xa);var Yx=[472,90,90,251],Xx=[94,266,134,191,138],Ja=class extends T{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1}render(){let e=t=>t.map(r=>c`<span class="bone" style="height:${r}px"></span>`);return c`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
1669
1737
|
<span class="sr" role="status">${this.label}</span>
|
|
1670
1738
|
<div class="page" aria-hidden="true">
|
|
1671
1739
|
${this.navigation?c`<span class="bone nav"></span>`:h}
|
|
1672
1740
|
<span class="bone head"></span>
|
|
1673
1741
|
<div class="body">
|
|
1674
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
1675
|
-
<div class="col side">${e(
|
|
1742
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:Yx)}</div>
|
|
1743
|
+
<div class="col side">${e(Xx)}</div>
|
|
1676
1744
|
</div>
|
|
1677
1745
|
</div>
|
|
1678
|
-
</div>`}};
|
|
1746
|
+
</div>`}};Ja.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},Ja.styles=[E,w`
|
|
1679
1747
|
:host { display: block; }
|
|
1680
1748
|
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-8); }
|
|
1681
1749
|
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
@@ -1699,11 +1767,11 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1699
1767
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
1700
1768
|
.head { height: 60px; }
|
|
1701
1769
|
}
|
|
1702
|
-
`];$("cm-skeleton-display",
|
|
1770
|
+
`];$("cm-skeleton-display",Ja);var xE=_("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),um,Ub,Za=class extends T{constructor(){super(...arguments);m(this,um);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=a(this,um,Ub).call(this);return c`<article part="comment">
|
|
1703
1771
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
1704
1772
|
<div class="body" part="body"><slot></slot></div>
|
|
1705
1773
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
1706
|
-
</article>`}};
|
|
1774
|
+
</article>`}};um=new WeakSet,Ub=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:de(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},Za.properties={author:{},datetime:{},time:{}},Za.styles=[E,w`
|
|
1707
1775
|
:host { display: block; }
|
|
1708
1776
|
article {
|
|
1709
1777
|
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
@@ -1711,16 +1779,16 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1711
1779
|
}
|
|
1712
1780
|
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
1713
1781
|
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
1714
|
-
`];$("cm-comment",
|
|
1715
|
-
<div class="title" id="${
|
|
1782
|
+
`];$("cm-comment",Za);var Wl,gm,Kb,Qa=class extends T{constructor(){super(...arguments);m(this,gm);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;m(this,Wl,H("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 r=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(r)&&(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="${i(this,Wl)}-h">
|
|
1783
|
+
<div class="title" id="${i(this,Wl)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1716
1784
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
1717
1785
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
1718
|
-
@keydown=${
|
|
1786
|
+
@keydown=${a(this,gm,Kb)}></textarea>
|
|
1719
1787
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
1720
1788
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
1721
1789
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
1722
1790
|
</div>
|
|
1723
|
-
</section>`}};
|
|
1791
|
+
</section>`}};Wl=new WeakMap,gm=new WeakSet,Kb=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},Qa.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Qa.styles=[E,w`
|
|
1724
1792
|
:host { display: block; }
|
|
1725
1793
|
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
1726
1794
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1740,8 +1808,8 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1740
1808
|
|
|
1741
1809
|
.actions { justify-content: flex-end; }
|
|
1742
1810
|
}
|
|
1743
|
-
`];$("cm-comment-box",
|
|
1744
|
-
data-side=${this._side}>${this.content}</div>`}};
|
|
1811
|
+
`];$("cm-comment-box",Qa);var fm='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',Me,tn,Xi,Ji,ui,rn,sn,rt,Fu,bm,vm,ym,xm,an,Wb,Zr,Vu,ju,gi,en=class extends C{constructor(){super(...arguments);m(this,rt);this.content="";this.placement="top";this.delay=400;this.open=!1;this.visualOnly=!1;this._side="top";m(this,Me);m(this,tn);m(this,Xi,[]);m(this,Ji);m(this,ui);m(this,rn,!1);m(this,sn,!1);m(this,bm,()=>{g(this,rn,!0),clearTimeout(i(this,ui)),this.open||g(this,ui,setTimeout(()=>this.show(),this.delay))});m(this,vm,()=>{g(this,rn,!1),clearTimeout(i(this,ui)),i(this,sn)||this.hide()});m(this,ym,()=>{g(this,sn,!0),this.show()});m(this,xm,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(g(this,sn,!1),i(this,rn)||this.hide())});m(this,an,e=>{e.key==="Escape"&&this.open&&this.hide()});m(this,Zr,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(a(this,rt,ju).call(this),!t||!this.content||this.visualOnly)return;let r=t.updateComplete;t.localName.includes("-")&&r&&!t.shadowRoot?.querySelector(fm)&&r.then(()=>{t.shadowRoot?.querySelector(fm)&&i(this,Zr).call(this)}),i(this,Me)||(g(this,Me,document.createElement("span")),i(this,Me).id=H("cm-tooltip"),i(this,Me).hidden=!0,i(this,Me).slot="description"),i(this,Me).textContent=this.content,i(this,Me).isConnected||this.append(i(this,Me));let s=a(this,rt,Wb).call(this,t);if(g(this,tn,s),s.getRootNode()===i(this,Me).getRootNode()){let l=(s.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);l.includes(i(this,Me).id)||s.setAttribute("aria-describedby",[...l,i(this,Me).id].join(" "))}else"ariaDescribedByElements"in s?(a(this,rt,Vu).call(this,s),g(this,Ji,new MutationObserver(()=>{s.getAttribute("aria-describedby")!==""&&a(this,rt,Vu).call(this,s)})),i(this,Ji).observe(s,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",i(this,Me).id)});m(this,gi,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let s=(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=U=>U==="start"?f?"right":"left":U==="end"?f?"left":"right":U,y={top:s.top-d-l.height>=p,bottom:s.bottom+d+l.height<=b-p,left:s.left-d-l.width>=p,right:s.right+d+l.width<=u-p},k={top:"bottom",bottom:"top",left:"right",right:"left"},D=x(this.placement);!y[D]&&y[k[D]]&&(D=k[D]);let R,q;D==="top"||D==="bottom"?(R=s.left+s.width/2-l.width/2,q=D==="top"?s.top-d-l.height:s.bottom+d):(q=s.top+s.height/2-l.height/2,R=D==="left"?s.left-d-l.width:s.right+d),R=Math.min(Math.max(p,R),u-p-l.width),q=Math.min(Math.max(p,q),b-p-l.height),e.style.transform=`translate(${Math.round(R)}px, ${Math.round(q)}px)`;let B={top:"top",bottom:"bottom",left:f?"end":"start",right:f?"start":"end"};this._side=B[D]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",i(this,bm)),this.addEventListener("pointerleave",i(this,vm)),this.addEventListener("focusin",i(this,ym)),this.addEventListener("focusout",i(this,xm)),this.addEventListener("keydown",i(this,an)),this.hasUpdated&&i(this,Zr).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),a(this,rt,ju).call(this),a(this,rt,Fu).call(this),clearTimeout(i(this,ui))}show(){clearTimeout(i(this,ui)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",i(this,an),!0),addEventListener("scroll",i(this,gi),!0),addEventListener("resize",i(this,gi)),this.updateComplete.then(i(this,gi)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(i(this,ui)),this.open&&(this.open=!1,a(this,rt,Fu).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(i(this,Zr).call(this),this.content?this.open&&i(this,gi).call(this):this.hide())}render(){return c`<slot @slotchange=${i(this,Zr)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1812
|
+
data-side=${this._side}>${this.content}</div>`}};Me=new WeakMap,tn=new WeakMap,Xi=new WeakMap,Ji=new WeakMap,ui=new WeakMap,rn=new WeakMap,sn=new WeakMap,rt=new WeakSet,Fu=function(){document.removeEventListener("keydown",i(this,an),!0),removeEventListener("scroll",i(this,gi),!0),removeEventListener("resize",i(this,gi))},bm=new WeakMap,vm=new WeakMap,ym=new WeakMap,xm=new WeakMap,an=new WeakMap,Wb=function(e){return e.matches(fm)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(fm)??e},Zr=new WeakMap,Vu=function(e){g(this,Xi,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),r=i(this,Xi).map(s=>t.getElementById(s)).filter(s=>!!s);e.ariaDescribedByElements=[...r,i(this,Me)]},ju=function(){let e=i(this,tn);if(!(!e||!i(this,Me))){if(i(this,Ji))i(this,Ji).disconnect(),g(this,Ji,void 0),i(this,Xi).length?e.setAttribute("aria-describedby",i(this,Xi).join(" ")):e.removeAttribute("aria-describedby"),g(this,Xi,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(r=>r&&r!==i(this,Me).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,tn,void 0)}},gi=new WeakMap,en.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},en.styles=[E,w`
|
|
1745
1813
|
:host { display: inline-block; position: relative; }
|
|
1746
1814
|
.tip {
|
|
1747
1815
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -1758,22 +1826,22 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1758
1826
|
:host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
1759
1827
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1760
1828
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1761
|
-
`];$("cm-tooltip",
|
|
1762
|
-
<span class="icon ${
|
|
1829
|
+
`];$("cm-tooltip",en);var LE=_("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"}),SE=_("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),Jx=7,Gl=new Set,Yl;function Gb(o,n){n?Gl.add(o):Gl.delete(o),Gl.size&&!Yl&&(Yl=setInterval(()=>Gl.forEach(e=>e.requestUpdate()),6e4)),!Gl.size&&Yl&&(clearInterval(Yl),Yl=void 0)}var Xl,es,Et,Uu,wm,Yb,nn=class extends T{constructor(){super(...arguments);m(this,Et);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,Xl,H("cm-tl"));m(this,es)}connectedCallback(){super.connectedCallback(),Gb(this,!0)}disconnectedCallback(){super.disconnectedCallback(),Gb(this,!1),i(this,es)?.disconnect(),g(this,es,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(g(this,es,new ResizeObserver(()=>a(this,Et,Uu).call(this))),i(this,es).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&a(this,Et,Uu).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(),r=t<0,s=Math.floor(Math.abs(t)/6e4);if(s<1)return this.t("justNow");if(s<60)return this.t(r?"inMinutes":"minutesAgo",{count:s});let l=Math.floor(s/60);if(l<24)return this.t(r?"inHours":"hoursAgo",{count:l});let d=Math.floor(l/24);return d<Jx?this.t(r?"inDays":"daysAgo",{count:d}):de(e,{dateStyle:"medium"},this.locale)}get fullTime(){let e=this.date;return e?de(e,{dateStyle:"full",timeStyle:"short"},this.locale):""}render(){let e=this.relativeTime,t=this.fullTime,r=this.tone&&this.tone!=="neutral"?this.tone:"",s=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">
|
|
1830
|
+
<span class="icon ${r}" part="icon" aria-hidden="true">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:c`<span class="dot"></span>`}</span>
|
|
1763
1831
|
<div class="main">
|
|
1764
1832
|
<div class="head">
|
|
1765
1833
|
<span class="lead"><span class="title" part="title"><slot name="heading">${this.heading}</slot></span>
|
|
1766
1834
|
<slot name="badge"></slot></span>
|
|
1767
1835
|
${l}
|
|
1768
1836
|
</div>
|
|
1769
|
-
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>
|
|
1770
|
-
<div class="body ${
|
|
1771
|
-
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>
|
|
1837
|
+
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>a(this,Et,wm).call(this,d,"_meta")}>${this.meta}</slot></div>
|
|
1838
|
+
<div class="body ${s?"clamp":""}" id="${i(this,Xl)}-body" part="body" ?hidden=${!this._body}
|
|
1839
|
+
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>a(this,Et,wm).call(this,d,"_body")}></slot></div>
|
|
1772
1840
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
1773
|
-
aria-controls="${
|
|
1774
|
-
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>
|
|
1841
|
+
aria-controls="${i(this,Xl)}-body" @click=${a(this,Et,Yb)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
1842
|
+
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>a(this,Et,wm).call(this,d,"_actions")}></slot></div>
|
|
1775
1843
|
</div>
|
|
1776
|
-
</div>`}};
|
|
1844
|
+
</div>`}};Xl=new WeakMap,es=new WeakMap,Et=new WeakSet,Uu=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},wm=function(e,t){let r=e.target.assignedNodes({flatten:!0});this[t]=r.some(s=>s.nodeType===Node.ELEMENT_NODE||(s.textContent??"").trim())},Yb=function(){this.expanded=!this.expanded},nn.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}},nn.styles=[E,w`
|
|
1777
1845
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
1778
1846
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
1779
1847
|
.icon {
|
|
@@ -1818,16 +1886,16 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1818
1886
|
[hidden] { display: none !important; }
|
|
1819
1887
|
.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; }
|
|
1820
1888
|
::slotted([slot='badge']) { flex: none; }
|
|
1821
|
-
`];$("cm-timeline-item",
|
|
1889
|
+
`];$("cm-timeline-item",nn);var Jl,on,ts,Ku,Xb,Qr=class extends T{constructor(){super(...arguments);m(this,ts);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];m(this,Jl,new MutationObserver(()=>a(this,ts,Ku).call(this)));m(this,on,!1)}connectedCallback(){super.connectedCallback(),a(this,ts,Ku).call(this),i(this,Jl).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),i(this,Jl).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){g(this,on,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach((r,s)=>{this._items[s]&&r.assign(this._items[s])});let t=this.renderRoot.querySelector("slot.empty");t&&t.assign(...this._empty),i(this,on)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,on,!1),this.renderRoot.querySelector("ol")?.focus())}render(){let e=this._items,t=this.loading,r=t&&!e.length?c`<div class="loading" aria-hidden="true">${[0,1,2].map(()=>c`<div class="sk">
|
|
1822
1890
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
1823
1891
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
1824
1892
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
1825
1893
|
</ol>`:h}
|
|
1826
|
-
${
|
|
1894
|
+
${r}
|
|
1827
1895
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
1828
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${
|
|
1896
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${a(this,ts,Xb)}>${this.moreLabel}</cm-button></div>`:h}
|
|
1829
1897
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
1830
|
-
`}};
|
|
1898
|
+
`}};Jl=new WeakMap,on=new WeakMap,ts=new WeakSet,Ku=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},Xb=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},Qr.shadowRootOptions={...C.shadowRootOptions,slotAssignment:"manual"},Qr.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}},Qr.styles=[E,w`
|
|
1831
1899
|
:host { display: block; }
|
|
1832
1900
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
1833
1901
|
ol:focus { outline: none; }
|
|
@@ -1850,14 +1918,14 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1850
1918
|
@media (max-width: 640px) {
|
|
1851
1919
|
.more { padding-inline-start: 0; }
|
|
1852
1920
|
}
|
|
1853
|
-
`];$("cm-timeline",
|
|
1921
|
+
`];$("cm-timeline",Qr);var IE=_("smartTip",{newTab:"(opens in a new tab)"}),PE=_("smartTips",{heading:"Smart tips",tourAction:"Start"}),ln=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}>
|
|
1854
1922
|
<span class="text">
|
|
1855
1923
|
<span class="title" part="heading">${this.heading}</span>
|
|
1856
1924
|
<span class="desc" part="description"><slot></slot></span>
|
|
1857
1925
|
${e?c`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">${this.t("newTab")}</span>`:h}
|
|
1858
1926
|
</span>
|
|
1859
1927
|
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
1860
|
-
</a>`}};
|
|
1928
|
+
</a>`}};ln.properties={heading:{},href:{},target:{}},ln.styles=[E,w`
|
|
1861
1929
|
:host { display: block; }
|
|
1862
1930
|
a {
|
|
1863
1931
|
display: flex; align-items: flex-start; gap: var(--cm-space-8); padding: var(--cm-space-16);
|
|
@@ -1874,7 +1942,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1874
1942
|
}
|
|
1875
1943
|
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
1876
1944
|
a:hover .title { text-decoration: underline; }
|
|
1877
|
-
`];$("cm-smart-tip",
|
|
1945
|
+
`];$("cm-smart-tip",ln);var cn=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">
|
|
1878
1946
|
${this.tourHeading?c`<div class="tour" part="tour">
|
|
1879
1947
|
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="16"></cm-icon>
|
|
1880
1948
|
</span>
|
|
@@ -1885,7 +1953,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1885
1953
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1886
1954
|
<div class="list" role="list"><slot></slot></div>
|
|
1887
1955
|
</section>
|
|
1888
|
-
</div>`}};
|
|
1956
|
+
</div>`}};cn.properties={heading:{string:"heading"},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action",string:"tourAction"},headingLevel:{type:Number,attribute:"heading-level"}},cn.styles=[E,w`
|
|
1889
1957
|
:host { display: block; }
|
|
1890
1958
|
.card { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1891
1959
|
.tour {
|
|
@@ -1902,24 +1970,24 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1902
1970
|
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;
|
|
1903
1971
|
}
|
|
1904
1972
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1905
|
-
`];$("cm-smart-tips",
|
|
1973
|
+
`];$("cm-smart-tips",cn);var VE=_("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"}),fi,hn,Jb,Zb,dn=class extends T{constructor(){super(...arguments);m(this,hn);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;m(this,fi,H("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)),r=this.total?(t-1)*this.pageSize+1:0,s=Math.min(this.total,t*this.pageSize),l=this.pageSizes??[];return c`
|
|
1906
1974
|
<nav part="bar" aria-label=${this.label}>
|
|
1907
1975
|
${l.length?c`<div class="rows" part="rows">
|
|
1908
|
-
<label for="${
|
|
1909
|
-
<span class="field"><select id="${
|
|
1976
|
+
<label for="${i(this,fi)}-s">${this.t("rows")}</label>
|
|
1977
|
+
<span class="field"><select id="${i(this,fi)}-s" @change=${a(this,hn,Jb)}>
|
|
1910
1978
|
${(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>`)}
|
|
1911
1979
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
1912
1980
|
</div>`:h}
|
|
1913
|
-
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:
|
|
1981
|
+
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:r,to:s,total:this.total,resource:this.resourceName}).replace(/\s+/g," ").trim():h}</div>
|
|
1914
1982
|
<div class="pages" part="pages">
|
|
1915
1983
|
<span class="counter">
|
|
1916
|
-
<label for="${
|
|
1917
|
-
<input id="${
|
|
1918
|
-
.value=${this._draft??String(t)} aria-describedby="${
|
|
1984
|
+
<label for="${i(this,fi)}-p">${this.t("page")}</label>
|
|
1985
|
+
<input id="${i(this,fi)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1986
|
+
.value=${this._draft??String(t)} aria-describedby="${i(this,fi)}-of"
|
|
1919
1987
|
@input=${d=>this._draft=d.target.value}
|
|
1920
|
-
@keydown=${
|
|
1988
|
+
@keydown=${a(this,hn,Zb)}
|
|
1921
1989
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
1922
|
-
<span id="${
|
|
1990
|
+
<span id="${i(this,fi)}-of">${this.t("of",{count:e})}</span>
|
|
1923
1991
|
</span>
|
|
1924
1992
|
<span class="arrows">
|
|
1925
1993
|
<button class="prev" type="button" part="previous" aria-label=${this.t("previous")} ?disabled=${t<=1}
|
|
@@ -1929,7 +1997,7 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1929
1997
|
</span>
|
|
1930
1998
|
</div>
|
|
1931
1999
|
</nav>
|
|
1932
|
-
`}};
|
|
2000
|
+
`}};fi=new WeakMap,hn=new WeakSet,Jb=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})))},Zb=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))},dn.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}},dn.styles=[E,w`
|
|
1933
2001
|
:host { display: block; }
|
|
1934
2002
|
nav {
|
|
1935
2003
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -1972,17 +2040,17 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
1972
2040
|
select, input { height: var(--cm-control-height-touch); }
|
|
1973
2041
|
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
1974
2042
|
}
|
|
1975
|
-
`];$("cm-pagination",
|
|
1976
|
-
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${
|
|
1977
|
-
${e.map((
|
|
1978
|
-
tabindex=${l===t?"0":"-1"} ?disabled=${!!
|
|
1979
|
-
@click=${()=>
|
|
2043
|
+
`];$("cm-pagination",dn);var YE=_("statusTabs",{label:"Status",option:"{label} ({count})"}),pn,Ql,ye,Zl,Qb,Wu,ev,Gu,tv,mn=class extends T{constructor(){super(...arguments);m(this,ye);this.value="";this.tabs=[];this.controls="";this.size="large";this.mobile="scroll";this._more="";m(this,pn,new ResizeObserver(()=>a(this,ye,Zl).call(this)));this._slotted=[];m(this,Ql,new MutationObserver(()=>a(this,ye,Wu).call(this)))}connectedCallback(){super.connectedCallback(),a(this,ye,Wu).call(this),i(this,Ql).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),i(this,Ql).disconnect(),i(this,pn).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector(".tabs");i(this,pn).observe(e),e.addEventListener("scroll",()=>a(this,ye,Zl).call(this),{passive:!0}),document.fonts?.ready.then(()=>a(this,ye,Zl).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){a(this,ye,Zl).call(this);for(let s of this.renderRoot.querySelectorAll(".tabs > *"))i(this,pn).observe(s);if(!("ariaControlsElements"in Element.prototype))return;let t=this.getRootNode(),r=this.controls?t.getElementById?.(this.controls):null;for(let s of this.renderRoot.querySelectorAll("button, select"))s.ariaControlsElements=r?[r]:null}render(){let e=this.items,t=a(this,ye,ev).call(this,e),r=this.getAttribute("aria-label")||this.t("label");return c`
|
|
2044
|
+
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${r}>
|
|
2045
|
+
${e.map((s,l)=>c`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
2046
|
+
tabindex=${l===t?"0":"-1"} ?disabled=${!!s.disabled}
|
|
2047
|
+
@click=${()=>a(this,ye,Gu).call(this,l)} @keydown=${d=>a(this,ye,tv).call(this,d,l)}><span class="label" data-text=${s.label}>${s.label}</span>${s.count!==void 0&&!Number.isNaN(s.count)?c`<span class="sr">, </span><span class="count" part="count">${this.formatNumber(s.count)}</span>`:h}</button>`)}
|
|
1980
2048
|
</div>
|
|
1981
|
-
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${
|
|
1982
|
-
${e.map((
|
|
2049
|
+
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${r} @change=${a(this,ye,Qb)}>
|
|
2050
|
+
${e.map((s,l)=>c`<option value=${s.value} ?disabled=${!!s.disabled} ?selected=${l===t} .selected=${l===t}>${s.count!==void 0&&!Number.isNaN(s.count)?this.t("option",{label:s.label,count:s.count}):s.label}</option>`)}
|
|
1983
2051
|
</select><cm-icon name="chevron-down" size="16"></cm-icon></div>`:h}
|
|
1984
2052
|
<slot></slot>
|
|
1985
|
-
`}};
|
|
2053
|
+
`}};pn=new WeakMap,Ql=new WeakMap,ye=new WeakSet,Zl=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,r=Math.abs(e.scrollLeft),s=t>1&&r>1,l=t>1&&r<t-1,d=s&&l?"both":s?"start":l?"end":"";d!==this._more&&(this._more=d)},Qb=function(e){let t=e.target.value;t!==this.value&&(this.value=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Wu=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let r=t.getAttribute("count");return{value:t.value,label:t.label||t.textContent.trim(),count:r===null||r===""?void 0:Number(r),disabled:t.disabled}}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"")},ev=function(e){let t=e.findIndex(r=>r.value===this.value&&!r.disabled);return t>=0?t:e.findIndex(r=>!r.disabled)},Gu=function(e){let t=this.items[e];!t||t.disabled||(this.updateComplete.then(()=>{let r=this.renderRoot.querySelectorAll("button")[e];r?.focus(),r?.scrollIntoView?.({block:"nearest",inline:"nearest"})}),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},tv=function(e,t){let r=te(e,this),s=this.items.flatMap((p,u)=>p.disabled?[]:[u]),l=s.indexOf(t),d;if(r==="ArrowRight")d=s[(l+1)%s.length];else if(r==="ArrowLeft")d=s[(l-1+s.length)%s.length];else if(e.key==="Home")d=s[0];else if(e.key==="End")d=s[s.length-1];else return;e.preventDefault(),d!==void 0&&a(this,ye,Gu).call(this,d)},mn.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},mobile:{reflect:!0},_slotted:{state:!0},_more:{state:!0}},mn.styles=[E,w`
|
|
1986
2054
|
:host { display: block; }
|
|
1987
2055
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
1988
2056
|
.tabs {
|
|
@@ -2041,20 +2109,20 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
2041
2109
|
:host([mobile='select']) .tabs { display: none; }
|
|
2042
2110
|
:host([mobile='select']) .pick { display: block; }
|
|
2043
2111
|
}
|
|
2044
|
-
`];$("cm-status-tabs",
|
|
2112
|
+
`];$("cm-status-tabs",mn);var tM=_("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),$m,ec,bi,Yu,iv,rv,un=class extends T{constructor(){super(...arguments);m(this,bi);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;m(this,$m,H("cm-th"));m(this,ec,new MutationObserver(()=>a(this,bi,Yu).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),a(this,bi,Yu).call(this),i(this,ec).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),i(this,ec).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`
|
|
2045
2113
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
2046
2114
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
2047
2115
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
2048
|
-
<input id="${
|
|
2049
|
-
@change=${
|
|
2116
|
+
<input id="${i(this,$m)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
2117
|
+
@change=${a(this,bi,rv)} />
|
|
2050
2118
|
<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>
|
|
2051
2119
|
</span></span>`:h}
|
|
2052
|
-
${t.map(
|
|
2053
|
-
aria-sort=${e&&
|
|
2054
|
-
name=${
|
|
2120
|
+
${t.map(r=>{let s=this.sort===r.key,l=s?this.direction==="descending"?"descending":"ascending":"none",d=r.hidden?c`<span class="sr">${r.label}</span>`:r.label;return c`<span class="cell" part="cell" data-align=${r.align??"start"} role=${e?"columnheader":h}
|
|
2121
|
+
aria-sort=${e&&r.sortable?l:h}>${r.sortable?c`<button type="button" class=${s?"on":""} @click=${()=>a(this,bi,iv).call(this,r)}>${d}${e?h:c`<span class="sr">${s?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
2122
|
+
name=${s&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
2055
2123
|
</div>
|
|
2056
2124
|
<slot></slot>
|
|
2057
|
-
`}}
|
|
2125
|
+
`}};$m=new WeakMap,ec=new WeakMap,bi=new WeakSet,Yu=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"}})},iv=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}))},rv=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}))},un.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}},un.styles=[E,w`
|
|
2058
2126
|
:host { display: block; }
|
|
2059
2127
|
slot { display: none; } /* <option> children are column data, not content */
|
|
2060
2128
|
.bar {
|
|
@@ -2109,10 +2177,10 @@ var Mg=o=>{throw TypeError(o)};var Hm=(o,n,e)=>n.has(o)||Mg("Cannot "+e);var r=(
|
|
|
2109
2177
|
: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); }
|
|
2110
2178
|
:host([resource-rows][mobile='stack']) .bar:not(.sel) > .cell:first-child { flex: 1 1 100%; }
|
|
2111
2179
|
}
|
|
2112
|
-
`];$("cm-table-header",
|
|
2180
|
+
`];$("cm-table-header",un);var Zx=`
|
|
2113
2181
|
[data-cm-density="compact"] { --cm-table-row-height: 40px; --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
2114
2182
|
[data-cm-density="comfortable"] { --cm-table-row-height: 48px; --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
|
|
2115
|
-
`,
|
|
2183
|
+
`,km=null,sv=new WeakSet;function Em(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(!sv.has(t)){sv.add(t);try{km||(km=new CSSStyleSheet,km.replaceSync(Zx)),t.adoptedStyleSheets=[...t.adoptedStyleSheets,km]}catch{}}}var dM=_("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}"}),av=48,nv=16,ov=!1,Qx=`
|
|
2116
2184
|
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); }
|
|
2117
2185
|
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); }
|
|
2118
2186
|
cm-data-table > table th, cm-data-table > table td { box-sizing: border-box; }
|
|
@@ -2161,52 +2229,52 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2161
2229
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
|
|
2162
2230
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
|
|
2163
2231
|
}
|
|
2164
|
-
`;function
|
|
2232
|
+
`;function ew(){if(ov||typeof document>"u")return;ov=!0;let o=new CSSStyleSheet;o.replaceSync(Qx),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var tc=o=>o.type==="numeric"||o.type==="money",tw=o=>(o.align??(tc(o)||o.type==="actions"?"end":"start"))==="end",iw=o=>!o.type||o.type==="text";function lv(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 r=Number(t[0].replace(/,/g,""));return e?-r:r}var cv=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),dv=new Map;function rw(o){let n=dv.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"})}dv.set(o??"",n)}return n}function hv(o,n,e,t){let r=s=>s==null||s==="";return r(o)||r(n)?r(o)===r(n)?0:r(o)?1:-1:e==="numeric"||e==="money"?(lv(o)||0)-(lv(n)||0):e==="date"?(cv(o)||0)-(cv(n)||0):rw(t).compare(String(o),String(n))}var mv=o=>o.parentElement??o.getRootNode().host??null,xn,wn,ic,$n,is,kn,rs,Cm,z,Xu,Ju,Zu,pv,Qu,uv,gv,fv,ss,gn,fn,Mm,bn,vn,Tm,eg,tg,ig,bv,vv,rg,sg,_m,yv,xv,wv,Zi,zm,En,$v,kv,Ev,Mv,Tv,_v,zv,yn=class extends T{constructor(){super(...arguments);m(this,z);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,xn,!1);m(this,wn,H("cm-dt"));m(this,ic,new MutationObserver(()=>a(this,z,Xu).call(this)));m(this,$n,typeof ResizeObserver>"u"?null:new ResizeObserver(()=>a(this,z,gn).call(this)));m(this,is,[]);m(this,kn,0);m(this,rs,-1);m(this,Cm,e=>{e.target?.closest?.("[data-lines]")&&a(this,z,Tm).call(this,e)});m(this,ss,()=>{i(this,kn)||!this.stickyHeader||g(this,kn,requestAnimationFrame(()=>{g(this,kn,0),a(this,z,gn).call(this)}))});m(this,Zi,new we);m(this,En,e=>{let t=this.renderRoot.querySelector(".tools");t&&!e.composedPath().includes(t)&&a(this,z,zm).call(this,!1)})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerover",i(this,Cm)),Em(this),a(this,z,Xu).call(this),i(this,ic).observe(this,{childList:!0,subtree:!0}),document.addEventListener("scroll",i(this,ss),{capture:!0,passive:!0}),window.addEventListener("resize",i(this,ss),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),i(this,Zi).close(),i(this,ic).disconnect(),i(this,$n)?.disconnect(),g(this,is,[]),document.removeEventListener("scroll",i(this,ss),{capture:!0}),window.removeEventListener("resize",i(this,ss)),document.removeEventListener("pointerdown",i(this,En),{capture:!0})}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(s=>s.key===this.sort);if(!t||this.sortMode==="manual")return e;let r=this.direction==="descending"?-1:1;return e.map((s,l)=>[s,l]).sort(([s,l],[d,p])=>{let u=s[t.key],b=d[t.key],f=u==null||u==="",x=b==null||b==="";return f||x?f===x?l-p:f?1:-1:r*hv(u,b,t.type,this.locale)||l-p}).map(([s])=>s)}get visibleColumns(){return(this.columns??[]).filter(e=>e.visible!==!1)}updated(e){if(this._picker&&!i(this,Zi).active?i(this,Zi).open(this.renderRoot.querySelector(".panel"),this.renderRoot.querySelector(".pick"),{align:"end"}):!this._picker&&i(this,Zi).active&&i(this,Zi).close(),i(this,xn)&&(e.has("sort")||e.has("direction"))&&this.sort){g(this,xn,!1);let t=this.columns.find(r=>r.key===this.sort);t&&a(this,z,Zu).call(this,t.label,this.direction)}if(e.has("columns")){let t=e.get("columns")??[],r={...this._widths},s=!1;for(let l of this.columns??[]){let d=t.find(p=>p.key===l.key);l.width!==void 0&&d?.width!==l.width&&r[l.key]!==void 0&&(delete r[l.key],s=!0)}s&&(this._widths=r)}a(this,z,fv).call(this),a(this,z,gn).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>`,r=c`<span class="fade s" aria-hidden="true"></span><span class="fade e" aria-hidden="true"></span>`,s=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}
|
|
2165
2233
|
role=${this._overflows?"region":h} aria-label=${this._overflows?this.querySelector("caption")?.textContent?.trim()||h:h}
|
|
2166
|
-
@scroll=${()=>
|
|
2234
|
+
@scroll=${()=>a(this,z,gn).call(this)}><slot></slot></div>${r}</div>${t}</div>${e}`;let l=this.visibleColumns,d=a(this,z,tg).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
2235
|
<div class="frame" part="frame" ?data-cards=${x}>
|
|
2168
|
-
${this.columnPicker?
|
|
2236
|
+
${this.columnPicker?a(this,z,Ev).call(this):h}
|
|
2169
2237
|
<div class="wrap">
|
|
2170
|
-
<div class="scroll" part="scroll" tabindex=${
|
|
2171
|
-
role=${
|
|
2172
|
-
aria-label=${
|
|
2173
|
-
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${
|
|
2174
|
-
@focusout=${
|
|
2238
|
+
<div class="scroll" part="scroll" tabindex=${s?"0":h}
|
|
2239
|
+
role=${s?"region":h}
|
|
2240
|
+
aria-label=${s&&this.caption?this.caption:h} @scroll=${()=>a(this,z,gn).call(this)}>
|
|
2241
|
+
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${a(this,z,Tm)} @focusin=${a(this,z,eg)}
|
|
2242
|
+
@focusout=${a(this,z,eg)}>
|
|
2175
2243
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
2176
|
-
<thead><tr>${l.map(y=>
|
|
2244
|
+
<thead><tr>${l.map(y=>a(this,z,Mv).call(this,y,d))}</tr></thead>
|
|
2177
2245
|
<tbody>
|
|
2178
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${
|
|
2246
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${a(this,z,bn).call(this,y,d)} style=${a(this,z,vn).call(this,y)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((y,k)=>a(this,z,Tv).call(this,y,l,d,p,k))}
|
|
2179
2247
|
${f?c`<tr class="empty"><td colspan=${b}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
2180
2248
|
</tbody>
|
|
2181
|
-
${this.totals&&!this.loading&&!f?c`<tfoot><tr part="totals">${l.map(y=>c`<td class=${
|
|
2249
|
+
${this.totals&&!this.loading&&!f?c`<tfoot><tr part="totals">${l.map(y=>c`<td class=${a(this,z,bn).call(this,y,d)} style=${a(this,z,vn).call(this,y)}>${y.type==="actions"?h:a(this,z,fn).call(this,this.totals[y.key])}</td>`)}</tr></tfoot>`:h}
|
|
2182
2250
|
</table>
|
|
2183
2251
|
</div>
|
|
2184
|
-
${
|
|
2252
|
+
${r}
|
|
2185
2253
|
</div>
|
|
2186
2254
|
${t}
|
|
2187
|
-
${x?
|
|
2255
|
+
${x?a(this,z,zv).call(this,u,l,d):h}
|
|
2188
2256
|
</div>${e}
|
|
2189
|
-
`}};
|
|
2190
|
-
?icon-only=${!!
|
|
2191
|
-
@click=${()=>
|
|
2192
|
-
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${
|
|
2193
|
-
@click=${()=>
|
|
2194
|
-
<fieldset class="panel" id="${
|
|
2257
|
+
`}};xn=new WeakMap,wn=new WeakMap,ic=new WeakMap,$n=new WeakMap,is=new WeakMap,kn=new WeakMap,rs=new WeakMap,Cm=new WeakMap,z=new WeakSet,Xu=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(ew(),a(this,z,pv).call(this))},Ju=function(e){this._announce=this._announce===e?`${e}\xA0`:e},Zu=function(e,t){a(this,z,Ju).call(this,this.t("sorted",{column:e,direction:this.t(t)}))},pv=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;if(!t)return;let r=[...t];r.forEach((s,l)=>{if(!s.dataset.sort||s.querySelector(":scope > button.cm-sort"))return;s.dataset.type=s.dataset.sort;let d=document.createElement("button");d.type="button",d.className="cm-sort",d.append(...s.childNodes);let p=document.createElement("cm-icon");p.setAttribute("size","12"),d.append(p),s.append(d),s.hasAttribute("aria-sort")||s.setAttribute("aria-sort","none"),a(this,z,Qu).call(this,s),d.addEventListener("click",()=>a(this,z,uv).call(this,e,s,l))});for(let s of[...e.tBodies,...e.tFoot?[e.tFoot]:[]])for(let l of s.rows)[...l.cells].forEach((d,p)=>{let u=r[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"))})},Qu=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},uv=function(e,t,r){let s=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),l=t.dataset.key||s,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 D=k.cells[r];return D?(D.dataset.value??D.textContent??"").trim():""},y=[...f.rows].map((k,D)=>[k,x(k),D]).sort(([,k,D],[,R,q])=>k===""||R===""?k===R?D-q:k===""?1:-1:b*hv(k,R,u,this.locale)||D-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"),a(this,z,Qu).call(this,f));a(this,z,Zu).call(this,s,d)},gv=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",r=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),s=this.dispatchEvent(r);g(this,xn,s),s&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},fv=function(){let e=[this.renderRoot.querySelector(".scroll"),this.renderRoot.querySelector("table")??this.querySelector(":scope > table")].filter(Boolean);e.length===i(this,is).length&&e.every((t,r)=>t===i(this,is)[r])||(i(this,$n)?.disconnect(),e.forEach(t=>i(this,$n)?.observe(t)),g(this,is,e))},ss=new WeakMap,gn=function(){let e=this.renderRoot?.querySelector(".scroll"),t=this.renderRoot?.querySelector(".frame");if(!e||!t)return;let r=getComputedStyle(e).maxBlockSize!=="none",s=e.scrollWidth>e.clientWidth+1;s!==this._overflows&&(this._overflows=s),e.toggleAttribute("data-open",this.stickyHeader&&!r&&!s);let l=Math.abs(e.scrollLeft);t.toggleAttribute("data-more-start",s&&l>1),t.toggleAttribute("data-more-end",s&&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&&!r&&s&&b&&f){let x=i(this,rs)>0?i(this,rs):0,y=f.getBoundingClientRect().top-x,k=b.getBoundingClientRect().bottom-x,D=0;for(let R=mv(this);R&&R!==document.documentElement&&R!==document.body;R=mv(R)){let q=getComputedStyle(R);/(auto|scroll|overlay|hidden|clip)/.test(q.overflowY)&&(D=Math.max(D,R.getBoundingClientRect().top+R.clientTop+(parseFloat(q.paddingTop)||0)))}D+=parseFloat(getComputedStyle(this).getPropertyValue("--cm-data-table-sticky-top"))||0,u=Math.max(0,Math.min(D-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!==i(this,rs)&&(g(this,rs,u),u?e.style.setProperty("--_shift",`${u}px`):e.style.removeProperty("--_shift"))},fn=function(e){return e==null?"":e instanceof Date?de(e,{},this.locale):String(e)},Mm=function(e){return this._widths[e.key]??e.width},bn=function(e,t){return[tw(e)&&"end",tc(e)&&"num",(tc(e)||e.type==="date")&&"nw",e.type==="actions"&&"act",e.priority==="low"&&e!==t&&"low",a(this,z,Mm).call(this,e)!==void 0&&"w"].filter(Boolean).join(" ")},vn=function(e){let t=a(this,z,Mm).call(this,e);return t===void 0?h:`--_w: ${t}px`},Tm=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 r=e.composedPath()[0]?.closest?.(".t");r&&(r.scrollWidth>r.clientWidth+1||r.scrollHeight>r.clientHeight+1?r.title=r.textContent??"":r.removeAttribute("title"))},eg=function(e){e.type==="focusin"&&a(this,z,Tm).call(this,e);let t=e.composedPath().find(s=>s instanceof HTMLTableRowElement);if(!t)return;let r=e.type==="focusin"||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget);t.toggleAttribute("data-focus",r)},tg=function(e){return e.find(t=>t.primary)??e.find(t=>t.type!=="actions")??e[0]},ig=function(e,t){return t?a(this,z,fn).call(this,e[t.key]):""},bv=function(e,t){let r=t[e.key];return Array.isArray(r)?r:e.actions??[]},vv=function(e,t){let r=(this.rows??[]).indexOf(t);this.dispatchEvent(new CustomEvent("cm-row-action",{detail:{action:e.value??e.label,row:t,index:r},bubbles:!0,composed:!0}))},rg=function(e,t,r){return c`<span class="acts">${a(this,z,bv).call(this,e,t).map(s=>c`<cm-button size="slim" icon=${s.icon??h}
|
|
2258
|
+
?icon-only=${!!s.iconOnly} label=${s.iconOnly?this.t("rowAction",{action:s.label,name:r}):h} tone=${s.tone??h}
|
|
2259
|
+
@click=${()=>a(this,z,vv).call(this,s,t)}>${s.label}${s.iconOnly||!r?h:c`<span class="sr">, ${r}</span>`}</cm-button>`)}</span>`},sg=function(e,t,r){if(e.type==="actions")return a(this,z,rg).call(this,e,t,r);let s=a(this,z,fn).call(this,t[e.key]);if(!iw(e))return s;let l=Math.trunc(Number(e.lines))||0;return l>1?c`<span class="t lines" style="--_lines: ${l}">${s}</span>`:c`<span class="t">${s}</span>`},_m=function(e,t,r){let s=Math.max(av,Math.round(t));this._widths={...this._widths,[e.key]:s},r&&(a(this,z,Ju).call(this,this.t("resized",{column:e.label,width:s})),this.dispatchEvent(new CustomEvent("cm-column-resize",{detail:{key:e.key,width:s},bubbles:!0,composed:!0})))},yv=function(e,t){return a(this,z,Mm).call(this,e)??Math.round(t.closest("th").getBoundingClientRect().width)},xv=function(e,t){let r=te(e,this);r!=="ArrowLeft"&&r!=="ArrowRight"||(e.preventDefault(),a(this,z,_m).call(this,t,a(this,z,yv).call(this,t,e.currentTarget)+(r==="ArrowRight"?nv:-nv),!0))},wv=function(e,t){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget,s=r.closest("th").getBoundingClientRect().width,l=e.clientX,d=getComputedStyle(this).direction==="rtl";try{r.setPointerCapture(e.pointerId)}catch{}r.setAttribute("data-dragging","");let p=s,u=f=>{p=s+(f.clientX-l)*(d?-1:1),a(this,z,_m).call(this,t,p,!1)},b=()=>{r.removeEventListener("pointermove",u),r.removeEventListener("pointerup",b),r.removeEventListener("pointercancel",b),r.removeAttribute("data-dragging"),a(this,z,_m).call(this,t,p,!0)};r.addEventListener("pointermove",u),r.addEventListener("pointerup",b),r.addEventListener("pointercancel",b)},Zi=new WeakMap,zm=function(e=!this._picker){this._picker=e,e?document.addEventListener("pointerdown",i(this,En),{capture:!0}):document.removeEventListener("pointerdown",i(this,En),{capture:!0})},En=new WeakMap,$v=function(e){e.key!=="Escape"||!this._picker||(e.stopPropagation(),a(this,z,zm).call(this,!1),this.renderRoot.querySelector(".pick")?.focus())},kv=function(e,t){let r=this.columns.map(s=>s.key===e?{...s,visible:t}:s);this.columns=r,this.dispatchEvent(new CustomEvent("cm-columns-change",{detail:{key:e,visible:t,columns:r},bubbles:!0,composed:!0}))},Ev=function(){let e=this.columns??[],t=a(this,z,tg).call(this,this.visibleColumns);return c`<div class="tools" part="tools" @keydown=${a(this,z,$v)}>
|
|
2260
|
+
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${i(this,wn)}-cols"
|
|
2261
|
+
@click=${()=>a(this,z,zm).call(this)}>${this.t("columns")}<cm-icon name="chevron-down" size="16" aria-hidden="true"></cm-icon></button>
|
|
2262
|
+
<fieldset class="panel" id="${i(this,wn)}-cols" part="column-panel" ?hidden=${!this._picker}>
|
|
2195
2263
|
<legend class="sr">${this.t("showColumns")}</legend>
|
|
2196
|
-
${e.map(
|
|
2197
|
-
@change=${a
|
|
2264
|
+
${e.map(r=>c`<label class="opt"><input type="checkbox" .checked=${r.visible!==!1} ?disabled=${r===t}
|
|
2265
|
+
@change=${s=>a(this,z,kv).call(this,r.key,s.target.checked)} />${r.label}</label>`)}
|
|
2198
2266
|
</fieldset>
|
|
2199
|
-
</div>`},
|
|
2200
|
-
name=${
|
|
2201
|
-
aria-valuemin=${
|
|
2202
|
-
@keydown=${p=>
|
|
2203
|
-
@click=${()=>
|
|
2204
|
-
<dl class="pairs">${
|
|
2267
|
+
</div>`},Mv=function(e,t){let r=this.sort===e.key,s=r?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=${a(this,z,bn).call(this,e,t)} style=${a(this,z,vn).call(this,e)} aria-sort=${e.sortable?s:h}><div class="h">${e.sortable?c`<button type="button" class="sort ${r?"on":""}" @click=${()=>a(this,z,gv).call(this,e)}>${d}<cm-icon
|
|
2268
|
+
name=${r&&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})}
|
|
2269
|
+
aria-valuemin=${av} aria-valuemax="1600"
|
|
2270
|
+
@keydown=${p=>a(this,z,xv).call(this,p,e)} @pointerdown=${p=>a(this,z,wv).call(this,p,e)}></span>`:h}</div></th>`},Tv=function(e,t,r,s,l){let d=a(this,z,ig).call(this,e,r),p=this._expanded.has(e),u=`${i(this,wn)}-more-${l}`,b=c`<tr part="row">${t.map(f=>f===r?c`<th scope="row" class=${a(this,z,bn).call(this,f,r)} style=${a(this,z,vn).call(this,f)} part="cell">${a(this,z,sg).call(this,f,e,d)}${s.length?c`<button type="button" class="more-btn" aria-expanded=${p?"true":"false"} aria-controls=${u}
|
|
2271
|
+
@click=${()=>a(this,z,_v).call(this,e)}>${this.t(p?"viewLess":"viewAll")}</button>`:h}</th>`:c`<td class=${a(this,z,bn).call(this,f,r)} style=${a(this,z,vn).call(this,f)} part="cell">${a(this,z,sg).call(this,f,e,d)}</td>`)}</tr>`;return c`${b}${s.length&&p?c`<tr class="more" id=${u} part="row-details"><td colspan=${t.length-s.length}>
|
|
2272
|
+
<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${tc(f)?"num":""}>${a(this,z,fn).call(this,e[f.key])}</dd>`)}</dl></td></tr>`:h}`},_v=function(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t},zv=function(e,t,r){let s=t.filter(p=>p!==r&&p.type!=="actions"),l=t.filter(p=>p.type==="actions"),d=(p,u=!1)=>{let b=a(this,z,ig).call(this,p,r);return c`<li class="card ${u?"total":""}" part="card">
|
|
2205
2273
|
<p class="card-title">${b}</p>
|
|
2206
|
-
${
|
|
2207
|
-
${!u&&l.length?c`<div class="card-actions">${l.map(f=>
|
|
2274
|
+
${s.length?c`<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${tc(f)?"num":""}>${a(this,z,fn).call(this,p[f.key])}</dd>`)}</dl>`:h}
|
|
2275
|
+
${!u&&l.length?c`<div class="card-actions">${l.map(f=>a(this,z,rg).call(this,f,p,b))}</div>`:h}
|
|
2208
2276
|
</li>`};return c`${this.caption?c`<p class="cards-caption" aria-hidden="true">${this.caption}</p>`:h}
|
|
2209
|
-
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(p=>d(p))}${this.totals?d(this.totals,!0):h}</ul>`},
|
|
2277
|
+
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(p=>d(p))}${this.totals?d(this.totals,!0):h}</ul>`},yn.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}},yn.styles=[E,Ve,w`
|
|
2210
2278
|
:host { display: block; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
2211
2279
|
:host([density='compact']) { --cm-table-row-height: 40px; }
|
|
2212
2280
|
:host([density='comfortable']) { --cm-table-row-height: 48px; }
|
|
@@ -2366,7 +2434,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2366
2434
|
:host([mobile='priority']) tr.more { display: table-row; }
|
|
2367
2435
|
}
|
|
2368
2436
|
@media (forced-colors: active) { button.sort cm-icon { opacity: 1; } .acts { opacity: 1 !important; } }
|
|
2369
|
-
`];$("cm-data-table",
|
|
2437
|
+
`];$("cm-data-table",yn);var bM=_("resourceItem",{select:"Select {name}"}),vM=_("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}"}),Cv=w`
|
|
2370
2438
|
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
2371
2439
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
2372
2440
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -2378,17 +2446,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2378
2446
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
2379
2447
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2380
2448
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
2381
|
-
`,
|
|
2449
|
+
`,Sm,zn,Lv,Sv,Tn=class extends T{constructor(){super();m(this,zn);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,Sm,this.attachInternals());i(this,Sm).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`
|
|
2382
2450
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
2383
|
-
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${
|
|
2451
|
+
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${a(this,zn,Sv)}>
|
|
2384
2452
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
2385
2453
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
2386
2454
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
2387
2455
|
<span class="media"><slot name="media"></slot></span>
|
|
2388
2456
|
<div class="content" part="content"><slot></slot></div>
|
|
2389
|
-
<div class="actions" part="actions"><slot name="actions" @slotchange=${
|
|
2457
|
+
<div class="actions" part="actions"><slot name="actions" @slotchange=${a(this,zn,Lv)}></slot></div>
|
|
2390
2458
|
</div>
|
|
2391
|
-
`}};
|
|
2459
|
+
`}};Sm=new WeakMap,zn=new WeakSet,Lv=function(e){this._hasActions=e.target.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim())},Sv=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(r=>r instanceof HTMLElement&&r!==this&&r.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},Tn.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}},Tn.styles=[E,Cv,w`
|
|
2392
2460
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2393
2461
|
:host(:last-child) { border-bottom: 0; }
|
|
2394
2462
|
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
|
|
@@ -2438,18 +2506,18 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2438
2506
|
:host([columns][mobile='stack']) ::slotted(*) { overflow-wrap: break-word; }
|
|
2439
2507
|
:host([columns][mobile='stack']) ::slotted(:first-child) { flex: 1 1 100%; }
|
|
2440
2508
|
}
|
|
2441
|
-
`];$("cm-resource-item",
|
|
2509
|
+
`];$("cm-resource-item",Tn);var rc,sc,ze,Dv,ag,Dm,Am,Mn,Lm,Rm,_n=class extends T{constructor(){super();m(this,ze);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,rc,H("cm-rl"));m(this,sc,new Set);m(this,Dm,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,a(this,ze,ag).call(this,t)});m(this,Am,e=>{this._hasActions=e.target.assignedElements().length>0});m(this,Rm,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,a(this,ze,Mn).call(this),a(this,ze,Lm).call(this))})}connectedCallback(){super.connectedCallback(),Em(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),a(this,ze,Mn).call(this),a(this,ze,Lm).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,a(this,ze,Mn).call(this),a(this,ze,Lm).call(this)}clearSelection(){this.selectPage(!1)}updated(e){(e.has("selectable")||e.has("mobile"))&&(a(this,ze,Mn).call(this),a(this,ze,ag).call(this))}render(){let e=this._count,t=this._rows,r=this.items.filter(k=>!k.disabled).length,s=r>0&&e>=r,l=a(this,ze,Dv).call(this),d=k=>kd(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)})}${s&&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=${i(this,Am)}></slot>`;return c`
|
|
2442
2510
|
${this.selectable&&f?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${y}</div>`:h}
|
|
2443
2511
|
<div class="head ${this.selectable||this._hasHeader?"on":""} ${f?"over":""}">
|
|
2444
|
-
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${
|
|
2512
|
+
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${i(this,Dm)}></slot></div>
|
|
2445
2513
|
${this.selectable?c`<div class="toolbar ${f?"over":""} ${b?"busy":""}" part="toolbar">
|
|
2446
2514
|
<span class="select" part="select">
|
|
2447
|
-
<span class="check"><input id="${
|
|
2448
|
-
?disabled=${!
|
|
2449
|
-
<span class="box" aria-hidden="true">${e>0&&!
|
|
2515
|
+
<span class="check"><input id="${i(this,rc)}-all" type="checkbox" .checked=${s} .indeterminate=${e>0&&!s}
|
|
2516
|
+
?disabled=${!r} @change=${k=>this.selectPage(k.target.checked)} />
|
|
2517
|
+
<span class="box" aria-hidden="true">${e>0&&!s?c`<span class="dash"></span>`:s?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>
|
|
2450
2518
|
${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:
|
|
2452
|
-
<label for="${
|
|
2519
|
+
.items=${[{label:this.t("selectPage",{count:r}),value:"page",disabled:!r},...p?[{label:this.t("selectAll",{count:this.total,resource:l}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${i(this,Rm)}></cm-action-menu>`}
|
|
2520
|
+
<label for="${i(this,rc)}-all" class=${f||b?"sr":"label"}>${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:d(t)})}</span></label>
|
|
2453
2521
|
</span>
|
|
2454
2522
|
<span class="status" part="status" role="status">${u}</span>
|
|
2455
2523
|
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
@@ -2458,12 +2526,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2458
2526
|
</div>
|
|
2459
2527
|
<div class="body">
|
|
2460
2528
|
<div class="list" part="list" role="list" aria-label=${this.label||l.replace(/^./,k=>k.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
2461
|
-
<slot @slotchange=${()=>
|
|
2529
|
+
<slot @slotchange=${()=>a(this,ze,Mn).call(this)}></slot>
|
|
2462
2530
|
</div>
|
|
2463
2531
|
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
2464
2532
|
</div>
|
|
2465
2533
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
2466
|
-
`}};
|
|
2534
|
+
`}};rc=new WeakMap,sc=new WeakMap,ze=new WeakSet,Dv=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},ag=function(e=this.renderRoot?.querySelector('slot[name="header"]')){if(!e)return;let t=new Set;for(let r of e.assignedElements())r.localName==="cm-table-header"&&t.add(r),r.querySelectorAll("cm-table-header").forEach(s=>t.add(s));for(let r of i(this,sc))t.has(r)||(r.removeAttribute("resource-rows"),r.removeAttribute("mobile"));for(let r of t)r.setAttribute("resource-rows",this.selectable?"selectable":"plain"),this.mobile==="stack"?r.setAttribute("mobile","stack"):r.removeAttribute("mobile");g(this,sc,t),this._hasTable=t.size>0},Dm=new WeakMap,Am=new WeakMap,Mn=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},Lm=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},Rm=new WeakMap,_n.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}},_n.styles=[E,Cv,w`
|
|
2467
2535
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
|
|
2468
2536
|
/* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
|
|
2469
2537
|
:host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
@@ -2519,20 +2587,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2519
2587
|
.toolbar .check { width: 20px; height: 20px; }
|
|
2520
2588
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
2521
2589
|
}
|
|
2522
|
-
`];$("cm-resource-list",
|
|
2523
|
-
<div class="row" part="row" @dragover=${
|
|
2590
|
+
`];$("cm-resource-list",_n);var EM=_("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}."}),MM=_("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),Nm,ce,ng,og,Av,Rv,Qi,Hv,Nv,Iv,lg,Pv,Mt=class Mt extends T{constructor(){super();m(this,ce);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;m(this,Nm,this.attachInternals());m(this,Qi,!1);i(this,Nm).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 r=this.list;if(!r||!e)return!1;if(e===r)return t===void 0?!1:this.moveTo(t);if(!r.group||e.group!==r.group)return!1;let s=e.items,l=Math.max(0,Math.min(s.length,t??s.length)),d={item:this,from:r.items.indexOf(this),to:l,fromList:r,toList:e};return this.dispatchEvent(new CustomEvent("cm-move",{detail:d,bubbles:!0,composed:!0,cancelable:!0}))?(e.insertBefore(this,s[l]??null),e.announce(this.t("movedTo",{label:this.label,list:e.heading,position:l+1,total:s.length+1})),!0):!1}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,r=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===r)return!1;let s=new CustomEvent("cm-reorder",{detail:{item:this,from:r,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(s))return!1;let l=t[e];return l.parentElement.insertBefore(this,e>r?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`
|
|
2591
|
+
<div class="row" part="row" @dragover=${a(this,ce,Iv)} @dragleave=${a(this,ce,lg)} @drop=${a(this,ce,Pv)}>
|
|
2524
2592
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
2525
2593
|
aria-describedby="hint"
|
|
2526
|
-
@keydown=${
|
|
2527
|
-
@dragend=${()=>{this.classList.remove("dragging"),
|
|
2594
|
+
@keydown=${a(this,ce,Av)} @dragstart=${a(this,ce,Rv)} @pointerdown=${a(this,ce,Hv)}
|
|
2595
|
+
@dragend=${()=>{this.classList.remove("dragging"),Mt.dragged=null,ac(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
2528
2596
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
2529
2597
|
<span class="label" part="label">${this.label}</span>
|
|
2530
2598
|
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
2531
2599
|
</div>
|
|
2532
2600
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
2533
|
-
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(
|
|
2601
|
+
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(r=>r.localName==="cm-nested-item");t.forEach(r=>r.sortable=this.sortable),this._hasChildren=t.length>0}}></slot>
|
|
2534
2602
|
</div>
|
|
2535
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};
|
|
2603
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};Nm=new WeakMap,ce=new WeakSet,ng=function(){let e=this.list;return e?.group?[...e.getRootNode().querySelectorAll("cm-nested-list")].filter(r=>r===e||r.group===e.group&&r.sortable&&(!r.collapsible||r.open)):[]},og=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},Av=function(e){let t=this.siblings.indexOf(this),r=e.key==="ArrowUp",s=e.key==="ArrowDown";if(r&&t===0||s&&t===this.siblings.length-1){let d=i(this,ce,ng),p=d[d.indexOf(this.list)+(r?-1:1)];if(p){e.preventDefault(),this.moveToList(p,r?p.items.length:0)&&a(this,ce,og).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)&&a(this,ce,og).call(this)},Rv=function(e){if(e.stopPropagation(),i(this,Qi)){e.preventDefault();return}Mt.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},Qi=new WeakMap,Hv=function(e){if(e.pointerType==="mouse"||!e.isPrimary)return;let t=e.clientY,r=null,s=d=>{if(d.pointerId===e.pointerId){if(!i(this,Qi)){if(Math.abs(d.clientY-t)<6)return;g(this,Qi,!0),Mt.dragged=this,this.classList.add("dragging")}d.preventDefault(),r=a(this,ce,Nv).call(this,d.clientX,d.clientY),ac(this,r)}},l=d=>{if(d.pointerId!==e.pointerId)return;document.removeEventListener("pointermove",s,!0),document.removeEventListener("pointerup",l,!0),document.removeEventListener("pointercancel",l,!0);let p=i(this,Qi);g(this,Qi,!1),Mt.dragged=null,this.classList.remove("dragging"),ac(this,null),!(!p||d.type==="pointercancel"||!r)&&(r.list?this.moveToList(r.list,r.index):this.moveTo(r.index))};document.addEventListener("pointermove",s,!0),document.addEventListener("pointerup",l,!0),document.addEventListener("pointercancel",l,!0)},Nv=function(e,t){for(let r of i(this,ce,ng)){if(r===this.list)continue;let s=r.getBoundingClientRect();if(e>=s.left&&e<=s.right&&t>=s.top&&t<=s.bottom)return{list:r,index:Hm(r.items,this,t)}}return{index:Hm(this.siblings,this,t)}},Iv=function(e){let t=Mt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let r=this.renderRoot.querySelector(".row").getBoundingClientRect(),s=e.clientY>r.top+r.height/2;this.classList.toggle("drop-after",s),this.classList.toggle("drop-before",!s)},lg=function(){this.classList.remove("drop-before","drop-after")},Pv=function(e){let t=Mt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let r=this.classList.contains("drop-after");a(this,ce,lg).call(this);let s=this.siblings,l=s.indexOf(t),d=s.indexOf(this)+(r?1:0);d>l&&(d-=1),t.moveTo(d)},Mt.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},Mt.styles=[E,w`
|
|
2536
2604
|
:host { display: block; }
|
|
2537
2605
|
.row {
|
|
2538
2606
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2559,20 +2627,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2559
2627
|
.actions { gap: var(--cm-space-8); }
|
|
2560
2628
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2561
2629
|
}
|
|
2562
|
-
`],
|
|
2630
|
+
`],Mt.dragged=null;var Ln=Mt;$("cm-nested-item",Ln);function Hm(o,n,e){return o.filter(t=>{if(t===n)return!1;let r=t.getBoundingClientRect();return r.top+r.height/2<e}).length}function ac(o,n){if((o.list??o).getRootNode().querySelectorAll("cm-nested-item.drop-before, cm-nested-item.drop-after, cm-nested-list.drop-target").forEach(r=>r.classList.remove("drop-before","drop-after","drop-target")),!n)return;let t=(n.list?n.list.items:o.siblings).filter(r=>r!==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 as,Ye,qv,cg,dg,Ov,Bv,Cn=class extends T{constructor(){super(...arguments);m(this,Ye);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;m(this,as,H("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"))&&a(this,Ye,cg).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2563
2631
|
<div class="bar" part="bar">
|
|
2564
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${
|
|
2632
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${i(this,as)}-h">${this.heading}</div>
|
|
2565
2633
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2566
|
-
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${
|
|
2567
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${
|
|
2634
|
+
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${i(this,as)}-rows"
|
|
2635
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${a(this,Ye,qv)}>
|
|
2568
2636
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2569
2637
|
</div>
|
|
2570
|
-
<div class="rows ${this.group&&this._empty?"empty":""}" id="${
|
|
2571
|
-
@dragover=${
|
|
2572
|
-
<slot @slotchange=${()=>{
|
|
2638
|
+
<div class="rows ${this.group&&this._empty?"empty":""}" id="${i(this,as)}-rows" role="list" aria-labelledby="${i(this,as)}-h" ?hidden=${!t}
|
|
2639
|
+
@dragover=${a(this,Ye,Ov)} @drop=${a(this,Ye,Bv)}>
|
|
2640
|
+
<slot @slotchange=${()=>{a(this,Ye,cg).call(this),this._empty=!this.items.length}}></slot>
|
|
2573
2641
|
</div>
|
|
2574
2642
|
<span class="sr" role="status">${this._msg}</span>
|
|
2575
|
-
`}};
|
|
2643
|
+
`}};as=new WeakMap,Ye=new WeakSet,qv=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},cg=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},dg=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},Ov=function(e){let t=Ln.dragged;a(this,Ye,dg).call(this,t)&&(e.preventDefault(),ac(t,{list:this,index:Hm(this.items,t,e.clientY)}))},Bv=function(e){let t=Ln.dragged;if(!a(this,Ye,dg).call(this,t))return;e.preventDefault();let r=Hm(this.items,t,e.clientY);ac(t,null),t.moveToList(this,r)},Cn.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}},Cn.styles=[E,w`
|
|
2576
2644
|
:host { display: block; }
|
|
2577
2645
|
.bar {
|
|
2578
2646
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2596,9 +2664,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2596
2664
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2597
2665
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2598
2666
|
}
|
|
2599
|
-
`];$("cm-nested-list",
|
|
2667
|
+
`];$("cm-nested-list",Cn);var Fv=(o,n,e)=>{let t=new Map;for(let r=n;r<=e;r++)t.set(o[r],r);return t},Vv=Os(class extends Mi{constructor(o){if(super(o),o.type!==xt.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 r=[],s=[],l=0;for(let d of o)r[l]=t?t(d,l):l,s[l]=e(d,l),l++;return{values:s,keys:r}}render(o,n,e){return this.dt(o,n,e).values}update(o,[n,e,t]){let r=Hf(o),{values:s,keys:l}=this.dt(n,e,t);if(!Array.isArray(r))return this.ut=l,s;let d=this.ut??=[],p=[],u,b,f=0,x=r.length-1,y=0,k=s.length-1;for(;f<=x&&y<=k;)if(r[f]===null)f++;else if(r[x]===null)x--;else if(d[f]===l[y])p[y]=Ti(r[f],s[y]),f++,y++;else if(d[x]===l[k])p[k]=Ti(r[x],s[k]),x--,k--;else if(d[f]===l[k])p[k]=Ti(r[f],s[k]),Bs(o,p[k+1],r[f]),f++,k--;else if(d[x]===l[y])p[y]=Ti(r[x],s[y]),Bs(o,r[f],r[x]),x--,y++;else if(u===void 0&&(u=Fv(l,y,k),b=Fv(d,f,x)),u.has(d[f]))if(u.has(d[x])){let D=b.get(l[y]),R=D!==void 0?r[D]:null;if(R===null){let q=Bs(o,r[f]);Ti(q,s[y]),p[y]=q}else p[y]=Ti(R,s[y]),Bs(o,r[f],R),r[D]=null;y++}else Od(r[x]),x--;else Od(r[f]),f++;for(;y<=k;){let D=Bs(o,p[k+1]);Ti(D,s[y]),p[y++]=D}for(;f<=x;){let D=r[f++];D!==null&&Od(D)}return this.ut=l,qd(o,p),Le}});function jv(o,n,e){let t=l=>e.slotCount(l),r=l=>Math.max(0,t(l)-1),s=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,r(d))};return{...n}};switch(o){case"ArrowRight":return s(1);case"ArrowLeft":return s(-1);case"ArrowDown":return{group:n.group,index:Math.min(n.index+1,r(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:r(n.group)};default:return null}}var pe,st,at,os=class{constructor(n){m(this,pe);m(this,st,null);m(this,at,null);g(this,pe,n)}get active(){return i(this,st)!==null}get from(){return i(this,st)&&{...i(this,st)}}get target(){return i(this,at)&&{...i(this,at)}}groupCount(){return i(this,pe).groupCount()}slotCount(n){return n>=0&&n<i(this,pe).groupCount()?i(this,pe).slotCount(n):0}pickUp(n){this.active&&this.cancel(),g(this,st,{...n}),g(this,at,{...n}),i(this,pe).onTarget?.(this.target),i(this,pe).announce(i(this,pe).messages.pickedUp(this.target))}moveTo(n){if(!i(this,at))return;let e=Math.max(0,Math.min(n.group,i(this,pe).groupCount()-1)),t=this.slotCount(e);t<=0||(g(this,at,{group:e,index:Math.max(0,Math.min(n.index,t-1))}),i(this,pe).onTarget?.(this.target),i(this,pe).announce(i(this,pe).messages.over(this.target)))}drop(){if(!i(this,st)||!i(this,at))return;let n=i(this,st),e=i(this,at);g(this,st,g(this,at,null)),i(this,pe).onTarget?.(null),i(this,pe).onDrop(n,e)}cancel(n=!1){if(!i(this,st))return;let e=i(this,st),t=n?"":i(this,pe).messages.cancelled(e);g(this,st,g(this,at,null)),i(this,pe).onTarget?.(null),i(this,pe).onCancel?.(e),t&&i(this,pe).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=(i(this,pe).navigate??jv)(e,i(this,at),this);return t?(this.moveTo(t),!0):!1}};pe=new WeakMap,st=new WeakMap,at=new WeakMap;var nc,ns,ls=class{constructor(n=document,e="assertive"){m(this,nc);m(this,ns);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 i(this,ns)??this.element.textContent??""}announce(n){clearTimeout(i(this,nc)),this.element.textContent===n?(this.element.textContent="",g(this,ns,n),g(this,nc,setTimeout(()=>{this.element.textContent=n,g(this,ns,void 0)},50))):(g(this,ns,void 0),this.element.textContent=n)}};nc=new WeakMap,ns=new WeakMap;var FM=_("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"}),VM=_("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),jM=_("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}."}),sw="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",oc,Om,Uv,cs=class extends T{constructor(){super(...arguments);m(this,Om);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";m(this,oc,H("cm-bc"))}get name(){let e=r=>(r??"").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">
|
|
2600
2668
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2601
|
-
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${
|
|
2669
|
+
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${i(this,oc)}-help"></div>`}
|
|
2602
2670
|
<div class="content">
|
|
2603
2671
|
<div class="head">
|
|
2604
2672
|
<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>
|
|
@@ -2606,11 +2674,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2606
2674
|
<slot name="actions"></slot>
|
|
2607
2675
|
</div>
|
|
2608
2676
|
<div class="lines"><slot></slot></div>
|
|
2609
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${
|
|
2677
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${r=>a(this,Om,Uv).call(this,r,"_badges")}></slot></div>
|
|
2610
2678
|
</div>
|
|
2611
2679
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2612
|
-
<span id="${
|
|
2613
|
-
</div>`}};
|
|
2680
|
+
<span id="${i(this,oc)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2681
|
+
</div>`}};oc=new WeakMap,Om=new WeakSet,Uv=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},cs.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},cs.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}},cs.styles=[E,w`
|
|
2614
2682
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2615
2683
|
.card {
|
|
2616
2684
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2635,22 +2703,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2635
2703
|
:host([moving]) .content { opacity: 0.5; }
|
|
2636
2704
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2637
2705
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2638
|
-
`];$("cm-board-card",
|
|
2706
|
+
`];$("cm-board-card",cs);var An,lc,Rn,Hn,tr,Im,Kv,ds=class extends T{constructor(){super(...arguments);m(this,tr);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;m(this,An,!1);this._cards=[];this._drop=null;m(this,lc,new MutationObserver(()=>a(this,tr,Im).call(this)));m(this,Rn,H("cm-col"));m(this,Hn,!1)}get collapsed(){return i(this,An)}connectedCallback(){super.connectedCallback(),a(this,tr,Im).call(this),i(this,lc).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),i(this,lc).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 a(this,tr,Im).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");g(this,An,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",i(this,An)),g(this,Hn,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach(r=>{let s=this._cards[Number(r.dataset.i)];s?r.assign(s):r.assign()});let t=r=>[...this.children].filter(s=>s.getAttribute("slot")===r);this.renderRoot.querySelector("slot.actions")?.assign(...t("actions")),this.renderRoot.querySelector("slot.empty")?.assign(...t("empty")),i(this,Hn)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,Hn,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,r=this.count,s=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&&s.indexOf(y)===t.index&&p.push({key:"drop"}),p.push({key:y,card:y,i:k})}),d&&t.index>=s.length&&p.push({key:"drop"});let u=this.hasMore||r>e.length,b=this.loading,f=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),x=this.t("count",{count:r});return c`<section aria-labelledby="${i(this,Rn)}-h" class=${t&&this.collapsed?"over":""}>
|
|
2639
2707
|
<header part="header">
|
|
2640
|
-
<div class="title" id="${
|
|
2641
|
-
<span class="count" part="count" aria-hidden="true">${this.formatNumber(
|
|
2708
|
+
<div class="title" id="${i(this,Rn)}-h" role="heading" aria-level=${f}>${this.heading}<span class="sr">, ${x}</span></div>
|
|
2709
|
+
<span class="count" part="count" aria-hidden="true">${this.formatNumber(r)}</span>
|
|
2642
2710
|
<span class="actions"><slot class="actions"></slot></span>
|
|
2643
2711
|
</header>
|
|
2644
2712
|
<div class="scroll">
|
|
2645
|
-
<ul part="list" role="list" aria-labelledby="${
|
|
2646
|
-
${
|
|
2713
|
+
<ul part="list" role="list" aria-labelledby="${i(this,Rn)}-h" aria-busy=${b?"true":"false"} tabindex="-1" ?hidden=${this.collapsed}>
|
|
2714
|
+
${Vv(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>`)}
|
|
2647
2715
|
</ul>
|
|
2648
2716
|
${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
2717
|
<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=${
|
|
2718
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${b} @click=${a(this,tr,Kv)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
2651
2719
|
</div>
|
|
2652
2720
|
<span class="sr" role="status">${b?this.t("loading",{column:this.heading}):""}</span>
|
|
2653
|
-
</section>`}};
|
|
2721
|
+
</section>`}};An=new WeakMap,lc=new WeakMap,Rn=new WeakMap,Hn=new WeakMap,tr=new WeakSet,Im=function(){this._cards=this.cards},Kv=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},ds.shadowRootOptions={...C.shadowRootOptions,slotAssignment:"manual"},ds.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}},ds.styles=[E,w`
|
|
2654
2722
|
:host {
|
|
2655
2723
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
2656
2724
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -2687,9 +2755,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2687
2755
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
2688
2756
|
:host([collapsed]) .actions { display: none; }
|
|
2689
2757
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
2690
|
-
`];$("cm-board-column",
|
|
2758
|
+
`];$("cm-board-column",ds);var Pe,Se,fe,hs,ne,I,hg,Sn,Wv,mg,Gv,Yv,Xv,Jv,cc,Zv,dc,pg,ug,gg,Pm,Qv,hc,mc,pc,uc,gc,fc,bc,fg,bg,qm,ey,er,Dn=class extends T{constructor(){super();m(this,I);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;m(this,Pe,new ls);m(this,Se);m(this,fe,null);m(this,hs,new WeakMap);m(this,ne,null);m(this,cc,e=>{if(i(this,ne)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=te(e,this);if(i(this,Se).active){i(this,Se).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let r=a(this,I,Jv).call(this,e.composedPath());if(!(!r||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===" ")e.preventDefault(),this.pickUp(r);else if(e.key==="Enter")r.open()&&e.preventDefault();else if(t.startsWith("Arrow")){let s=a(this,I,Zv).call(this,r,t);s&&(e.preventDefault(),s.focusHandle())}}});m(this,dc,e=>{if(!i(this,Se).active||!i(this,fe))return;let t=e.relatedTarget;t&&(t===i(this,fe).card||i(this,fe).card.contains(t))||!t&&document.hasFocus()===!1||queueMicrotask(()=>{i(this,Se).active&&i(this,fe)&&!i(this,fe).card.matches(":focus-within")&&i(this,Se).cancel()})});m(this,hc,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});m(this,mc,e=>{if(i(this,ne)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath(),r=t.find(d=>d.localName==="cm-board-card");if(!r||r.locked||r.pending||t.some(d=>d instanceof Element&&d!==r&&d.matches?.(sw)))return;let s=a(this,I,Sn).call(this,r);if(!s)return;i(this,Se).active&&i(this,Se).cancel();let l=r.getBoundingClientRect();g(this,ne,{card:r,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:s.column,fromIndex:s.index}),e.pointerType!=="mouse"&&(i(this,ne).timer=setTimeout(()=>{i(this,ne)&&!i(this,ne).started&&a(this,I,fg).call(this)},300)),window.addEventListener("pointermove",i(this,gc),!0),window.addEventListener("pointerup",i(this,fc),!0),window.addEventListener("pointercancel",i(this,bc),!0),window.addEventListener("touchmove",i(this,pc),{capture:!0,passive:!1}),window.addEventListener("contextmenu",i(this,uc),!0)});m(this,pc,e=>{i(this,ne)?.started&&e.cancelable&&e.preventDefault()});m(this,uc,e=>{i(this,ne)&&e.preventDefault()});m(this,gc,e=>{let t=i(this,ne);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let r=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?r>4:r>8)&&(t.type==="mouse"?a(this,I,fg).call(this):a(this,I,er).call(this,!1));return}e.preventDefault(),a(this,I,bg).call(this),a(this,I,qm).call(this)}});m(this,fc,e=>{let t=i(this,ne);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,I,er).call(this,!1);return}let r=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",r,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",r,!0),0),a(this,I,er).call(this,!0)});m(this,bc,e=>{i(this,ne)&&e.pointerId===i(this,ne).pointerId&&a(this,I,er).call(this,!1)});g(this,Se,new os({groupCount:()=>this.columns.length,slotCount:e=>{let t=this.columns[e];return!t||!i(this,fe)?0:t.cards.filter(r=>r!==i(this,fe).card).length+1},onTarget:e=>a(this,I,Gv).call(this,e),onDrop:(e,t)=>a(this,I,Xv).call(this,e,t),onCancel:()=>a(this,I,mg).call(this),messages:{pickedUp:e=>a(this,I,hg).call(this,"pickedUp",e),over:e=>a(this,I,hg).call(this,"over",e),cancelled:e=>this.t("cancelled",{card:i(this,fe)?.card.name??"",column:this.columns[e.group]?.heading??""})},announce:e=>i(this,Pe).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 r=t.cards.find(s=>s.key===e);if(r)return r}}get heldCard(){return i(this,fe)?.card??null}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",i(this,cc)),this.addEventListener("focusout",i(this,dc)),this.addEventListener("pointerdown",i(this,mc)),this.addEventListener("dragstart",i(this,hc))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",i(this,cc)),this.removeEventListener("focusout",i(this,dc)),this.removeEventListener("pointerdown",i(this,mc)),this.removeEventListener("dragstart",i(this,hc)),i(this,Se).cancel(!0),a(this,I,er).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(i(this,Pe).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return i(this,Pe).text}announce(e){i(this,Pe).announce(e)}pickUp(e){let t=typeof e=="string"?this.card(e):e;if(!t||t.locked||t.pending)return!1;let r=a(this,I,Sn).call(this,t);return r?(a(this,I,er).call(this,!1),i(this,Se).cancel(!0),g(this,fe,{card:t,column:r.column,index:r.index}),t.moving=!0,a(this,I,Wv).call(this,t),i(this,Se).pickUp({group:r.group,index:r.index}),!0):!1}cancelMove(){let e=i(this,ne);e?.started&&(a(this,I,er).call(this,!1),i(this,Pe).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),i(this,Se).cancel()}moveCard(e,t,r){let s=typeof e=="string"?this.card(e):e,l=typeof t=="string"?this.column(t):t;if(!s||!l)return!1;let d=a(this,I,Sn).call(this,s);if(!d)return!1;let p=l.cards.filter(b=>b!==s).length,u=Math.max(0,Math.min(r??p,p));return a(this,I,Pm).call(this,s,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 r=i(this,hs).get(t);if(this.controlled||!r||(i(this,hs).delete(t),!r.from.isConnected||!this.contains(r.from)))return!1;let s=t.matches(":focus-within");return a(this,I,ug).call(this,t,r.from,r.fromIndex),r.totals&&a(this,I,gg).call(this,r.to,r.from),a(this,I,pg).call(this,r.to,r.from,s?t:null),i(this,Pe).announce(this.t("reverted",{card:t.name,column:r.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
2691
2759
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
2692
|
-
</div>`}};
|
|
2760
|
+
</div>`}};Pe=new WeakMap,Se=new WeakMap,fe=new WeakMap,hs=new WeakMap,ne=new WeakMap,I=new WeakSet,hg=function(e,t){let r=this.columns[t.group];return this.t(e,{card:i(this,fe)?.card.name??"",column:r?.heading??"",position:t.index+1,count:i(this,Se).slotCount(t.group)})},Sn=function(e){let t=this.columns,r=t.findIndex(s=>s.contains(e)&&e.parentElement===s);return r<0?null:{column:t[r],group:r,index:t[r].cards.indexOf(e)}},Wv=function(e){let t=()=>!!e.shadowRoot?.activeElement?.classList.contains("handle");e.focusHandle({preventScroll:!0}),requestAnimationFrame(()=>{i(this,fe)?.card===e&&!t()&&e.focusHandle({preventScroll:!0})})},mg=function(){i(this,fe)&&(i(this,fe).card.moving=!1),g(this,fe,null)},Gv=function(e){let t=i(this,fe);if(this.columns.forEach((r,s)=>{r._drop=t&&e&&s===e.group?{card:t.card,index:e.index,height:t.card.getBoundingClientRect().height}:null}),e){let r=this.columns[e.group];r?.updateComplete.then(()=>{let s=r.renderRoot.querySelector("li.drop")??(t&&t.column===r?t.card:r);a(this,I,Yv).call(this,r,s)})}},Yv=function(e,t){let r=this.renderRoot.querySelector(".columns");if(r){let l=r.getBoundingClientRect(),d=e.getBoundingClientRect();d.left<l.left?r.scrollLeft-=l.left-d.left+8:d.right>l.right&&(r.scrollLeft+=d.right-l.right+8)}let s=e.scrollElement;if(s){let l=s.getBoundingClientRect(),d=t.getBoundingClientRect();d.top<l.top?s.scrollTop-=l.top-d.top+8:d.bottom>l.bottom&&(s.scrollTop+=d.bottom-l.bottom+8)}},Xv=function(e,t){let r=i(this,fe);if(a(this,I,mg).call(this),!r)return;let s=this.columns[t.group];a(this,I,Pm).call(this,r.card,r.column,e.index,s,t.index,"keyboard")},Jv=function(e){let t=e[0];if(!(t instanceof HTMLElement)||!t.classList?.contains("handle"))return null;let r=e.find(s=>s.localName==="cm-board-card");return r&&a(this,I,Sn).call(this,r)?r:null},cc=new WeakMap,Zv=function(e,t){let r=a(this,I,Sn).call(this,e);if(!r)return null;let s=r.column.cards;if(t==="ArrowDown")return s[r.index+1]??null;if(t==="ArrowUp")return s[r.index-1]??null;let l=t==="ArrowRight"?1:-1,d=this.columns;for(let p=r.group+l;p>=0&&p<d.length;p+=l){let u=d[p].cards;if(u.length)return u[Math.min(r.index,u.length-1)]}return null},dc=new WeakMap,pg=function(e,t,r){e._sync(),t._sync().then(()=>{r?.isConnected&&r.focusHandle({preventScroll:!0})})},ug=function(e,t,r){let s=t.cards.filter(d=>d!==e),l=s[r];l?l.before(e):s.length?s[s.length-1].after(e):t.append(e)},gg=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))},Pm=function(e,t,r,s,l,d){let p=e.name;if(t===s&&r===l)return d!=="api"&&i(this,Pe).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:s.key,fromColumn:t,toColumn:s,fromIndex:r,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 i(this,Pe).announce(this.t("refused",{card:p,column:s.heading})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let x=s.cards.filter(y=>y!==e).length+1;if(this.controlled)d==="keyboard"&&a(this,I,Qv).call(this,e.key,s);else{let y=d==="keyboard"||e.matches(":focus-within");a(this,I,ug).call(this,e,s,l);let k=t!==s;k&&a(this,I,gg).call(this,t,s),i(this,hs).set(e,{card:e,from:t,fromIndex:r,to:s,toIndex:l,totals:k}),a(this,I,pg).call(this,t,s,y?e:null)}return i(this,Pe).announce(this.t("moved",{card:p,column:s.heading,position:l+1,count:x})),u.length&&(e.pending=!0,Promise.all(u).then(()=>{e.pending=!1,this.controlled||i(this,hs).delete(e)},()=>{e.pending=!1,this.controlled?i(this,Pe).announce(this.t("reverted",{card:p,column:t.heading})):this.revert(e)})),!0},Qv=function(e,t){let r=()=>t.isConnected?t.cards.find(d=>d.key===e):void 0,s=()=>{let d=r(),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(()=>{s()&&l.disconnect()});l.observe(this,{childList:!0,subtree:!0}),setTimeout(()=>l.disconnect(),1e3)},hc=new WeakMap,mc=new WeakMap,pc=new WeakMap,uc=new WeakMap,gc=new WeakMap,fc=new WeakMap,bc=new WeakMap,fg=function(){let e=i(this,ne);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,i(this,Pe).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),a(this,I,bg).call(this),a(this,I,qm).call(this);let r=()=>{i(this,ne)?.started&&(a(this,I,ey).call(this),i(this,ne).raf=requestAnimationFrame(r))};e.raf=requestAnimationFrame(r)},bg=function(){let e=i(this,ne);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},qm=function(){let e=i(this,ne);if(!e)return;let t=this.columns;if(!t.length)return;let r=t[0],s=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<s&&(r=u,s=f)}let l=r.cards.filter(u=>u!==e.card),d=l.length;if(r.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(r===e.to&&d===e.toIndex)return;let p=r!==e.to;e.to=r,e.toIndex=d,t.forEach(u=>{u._drop=u===r?{card:e.card,index:d,height:e.height}:null}),p&&i(this,Pe).announce(this.t("over",{column:r.heading,position:d+1,count:l.length+1}))},ey=function(){let e=i(this,ne);if(!e)return;let t=48,r=16,s=x=>x<t?Math.ceil((t-Math.max(x,0))/t*r):0,l=!1,d=this.renderRoot.querySelector(".columns");if(d){let x=d.getBoundingClientRect(),y=s(e.x-x.left),k=s(x.right-e.x),D=d.scrollLeft;y?d.scrollLeft-=y:k&&(d.scrollLeft+=k),l||=d.scrollLeft!==D}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=s(e.y-x.top),k=s(x.bottom-e.y),D=p.scrollTop;y?p.scrollTop-=y:k&&(p.scrollTop+=k),l||=p.scrollTop!==D}}let u=window.innerHeight,b=s(e.y),f=s(u-e.y);if(b||f){let x=window.scrollY;window.scrollBy(0,b?-b:f),l||=window.scrollY!==x}l&&a(this,I,qm).call(this)},er=function(e){let t=i(this,ne);t&&(g(this,ne,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",i(this,gc),!0),window.removeEventListener("pointerup",i(this,fc),!0),window.removeEventListener("pointercancel",i(this,bc),!0),window.removeEventListener("touchmove",i(this,pc),!0),window.removeEventListener("contextmenu",i(this,uc),!0),t.ghost?.remove(),t.started&&(t.card.moving=!1,this.dragging=!1,this.columns.forEach(r=>{r._drop=null}),e&&t.to&&t.toIndex!==void 0&&a(this,I,Pm).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},Dn.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},Dn.styles=[E,w`
|
|
2693
2761
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
2694
2762
|
.board { height: 100%; }
|
|
2695
2763
|
.columns {
|
|
@@ -2703,90 +2771,90 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2703
2771
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
2704
2772
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
2705
2773
|
}
|
|
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
|
-
${
|
|
2708
|
-
${
|
|
2774
|
+
`];$("cm-board",Dn);var ZM=_("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}."}),Pn=class extends C{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};Pn.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}},Pn.styles=w`:host { display: none !important; }`;$("cm-calendar-event",Pn);var Wm=o=>String(o).padStart(2,"0"),ty=o=>`${O(o)}T${Wm(o.getHours())}:${Wm(o.getMinutes())}`,Bm=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),iy=["month","week","day"],aw=600,ry=new Map,sy=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=ry.get(e);return t||(t=new Intl.DateTimeFormat(o,n),ry.set(e,t)),t},vg=o=>o.replace(/[ ]/g," ").trim(),On,qe,Oe,Ce,ie,re,ps,Bt,ot,Tc,sr,Bn,Fn,Vn,jn,_c,v,De,ir,vc,Fm,Ot,yg,yc,Tt,xg,ay,_t,Nn,ny,oy,nt,xc,wc,Vm,ly,cy,dy,ms,wg,$c,hy,kc,my,py,uy,gy,zc,Cc,fy,by,Lc,Ec,vy,$g,kg,Eg,yy,xy,Mg,Tg,_g,Sc,zg,wy,Dc,Ac,Rc,Hc,Nc,Ic,Cg,jm,$y,rr,Mc,ky,Lg,Ey,Um,Sg,In,Km,My,Ty,_y,zy,Cy,qn=class extends T{constructor(){super();m(this,v);this.view="month";this.date="";this.today="";this.step=15;m(this,On,"");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,qe,H("cm-cal"));m(this,Oe,new ls);m(this,Ce);m(this,ie,null);m(this,re,null);m(this,ps,new WeakMap);m(this,Bt,"");m(this,ot,null);m(this,Tc,"");m(this,sr,!0);m(this,Bn,0);m(this,Fn,!1);m(this,Vn);m(this,jn,0);m(this,_c,new MutationObserver(()=>this.requestUpdate()));m(this,zc,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Bt,t.dataset.k);for(let r of a(this,v,kc).call(this))r.tabIndex=r===t?0:-1}});m(this,Cc,e=>{let t=e.relatedTarget;if(this._more&&!i(this,ie)){let r=this.renderRoot.querySelector(".pop"),s=e.composedPath()[0];r&&r.contains(s)&&!(t&&r.contains(t))&&queueMicrotask(()=>{r.contains(this.renderRoot.activeElement)||(this._more="")})}!i(this,Ce).active||!i(this,ie)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!i(this,Ce).active||!i(this,ie))return;this.renderRoot.activeElement?.dataset.ev!==i(this,ie).ev.key&&i(this,Ce).cancel()}))});m(this,Lc,e=>{if(i(this,re)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=te(e,this);if(i(this,Ce).active){i(this,Ce).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let r=e.composedPath()[0];if(!(r instanceof HTMLElement)||r.getRootNode()!==this.renderRoot)return;let s=r.closest(".pop");if(s&&e.key==="Escape"){e.preventDefault(),a(this,v,Um).call(this,!0);return}if(r.dataset.ev&&e.key===" "){e.preventDefault(),g(this,Bn,performance.now()+400),this.pickUp(r.dataset.ev,r.dataset.day);return}if(s&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...s.querySelectorAll(".chip")],p=d[d.indexOf(r)+(t==="ArrowDown"?1:-1)];p&&(e.preventDefault(),p.focus());return}if(!r.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),a(this,v,by).call(this,r,e.key==="PageUp"?-1:1);return}let l=a(this,v,fy).call(this,r,t);l?(e.preventDefault(),a(this,v,gy).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,Dc,e=>{if(i(this,re)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(p=>p.dataset?.ev);if(!t)return;let r=this.event(t.dataset.ev),s=r&&a(this,v,Nn).call(this,r);if(!s||r.locked||r.pending)return;let l=a(this,v,kg).call(this,s,t.dataset.day??s.days[0]);if(!l)return;i(this,Ce).active&&i(this,Ce).cancel();let d=0;if(l.mode==="time"){let p=a(this,v,zg).call(this,e.clientX,e.clientY);p&&t.classList.contains("time")&&(d=Math.max(0,Math.min(s.dur,p.min-s.min)))}g(this,re,{...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"&&(i(this,re).timer=setTimeout(()=>{i(this,re)&&!i(this,re).started&&a(this,v,Cg).call(this)},300)),window.addEventListener("pointermove",i(this,Hc),!0),window.addEventListener("pointerup",i(this,Nc),!0),window.addEventListener("pointercancel",i(this,Ic),!0),window.addEventListener("touchmove",i(this,Ac),{capture:!0,passive:!1}),window.addEventListener("contextmenu",i(this,Rc),!0)});m(this,Ac,e=>{i(this,re)?.started&&e.cancelable&&e.preventDefault()});m(this,Rc,e=>{i(this,re)&&e.preventDefault()});m(this,Hc,e=>{let t=i(this,re);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let r=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?r>4:r>8)&&(t.type==="mouse"?a(this,v,Cg).call(this):a(this,v,rr).call(this,!1));return}e.preventDefault(),a(this,v,jm).call(this)}});m(this,Nc,e=>{let t=i(this,re);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,v,rr).call(this,!1);return}let r=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",r,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",r,!0),0),a(this,v,rr).call(this,!0)});m(this,Ic,e=>{i(this,re)&&e.pointerId===i(this,re).pointerId&&a(this,v,rr).call(this,!1)});g(this,Ce,new os({groupCount:()=>a(this,v,_t).call(this).length,slotCount:()=>i(this,ie)?i(this,ie).mode==="day"?1:a(this,v,Ec).call(this,i(this,ie).ev.dur):0,navigate:(e,t)=>a(this,v,vy).call(this,e,t),onTarget:e=>a(this,v,yy).call(this,e),onDrop:(e,t)=>a(this,v,xy).call(this,e,t),onCancel:()=>a(this,v,Eg).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:i(this,ie)?.ev.name??"",place:a(this,v,ms).call(this,i(this,ie),e)}),over:e=>this.t("over",{place:a(this,v,ms).call(this,i(this,ie),e)}),cancelled:e=>this.t("cancelled",{event:i(this,ie)?.ev.name??"",place:a(this,v,ms).call(this,i(this,ie),e)})},announce:e=>i(this,Oe).announce(e)}))}get locale(){return i(this,On)}set locale(e){let t=i(this,On);g(this,On,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=a(this,v,_t).call(this);return{view:i(this,v,De),start:O(e[0]),end:O(e[e.length-1])}}get heldEvent(){return i(this,ie)?.ev.el??null}get announcement(){return i(this,Oe).text}announce(e){i(this,Oe).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",i(this,Lc)),this.addEventListener("focusin",i(this,zc)),this.addEventListener("focusout",i(this,Cc)),this.addEventListener("pointerdown",i(this,Dc)),this.addEventListener("dragstart",i(this,Sc)),i(this,_c).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,Vn,new ResizeObserver(()=>{cancelAnimationFrame(i(this,jn)),g(this,jn,requestAnimationFrame(()=>a(this,v,wg).call(this)))})),i(this,Vn).observe(this)),a(this,v,wg).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",i(this,Lc)),this.removeEventListener("focusin",i(this,zc)),this.removeEventListener("focusout",i(this,Cc)),this.removeEventListener("pointerdown",i(this,Dc)),this.removeEventListener("dragstart",i(this,Sc)),i(this,_c).disconnect(),i(this,Vn)?.disconnect(),cancelAnimationFrame(i(this,jn)),i(this,Ce).cancel(!0),a(this,v,rr).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,sr,!0),e.get("view")!==void 0&&(this._more="",i(this,Ce).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(i(this,Oe).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),r=t?.querySelector(".tcell");!t||!r||(t.scrollTop=r.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,sr,!0),a(this,v,uy).call(this),i(this,ot)){let l=a(this,v,my).call(this,i(this,ot).key);l?(g(this,ot,null),l.focus({preventScroll:!1})):Date.now()>i(this,ot).until&&g(this,ot,null)}i(this,Fn)&&(g(this,Fn,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&i(this,sr)){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,sr,!1)}t||g(this,sr,!0),i(this,ie)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let r=this.range,s=`${r.view}|${r.start}|${r.end}`;s!==i(this,Tc)&&(g(this,Tc,s),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:r,bubbles:!0,composed:!0})))}previous(){this.date=O(a(this,v,$c).call(this,i(this,v,Tt),-1))}next(){this.date=O(a(this,v,$c).call(this,i(this,v,Tt),1))}goToToday(){this.date=i(this,v,yc)}pickUp(e,t){let r=typeof e=="string"?this.event(e):e;if(!r||r.locked||r.pending||this.readonly)return!1;let s=a(this,v,Nn).call(this,r);if(!s)return!1;let l=a(this,v,_t).call(this).map(O),d=t&&s.days.includes(t)&&l.includes(t)?t:s.days.find(b=>l.includes(b));if(!d)return!1;let p=a(this,v,kg).call(this,s,d);if(!p)return!1;a(this,v,rr).call(this,!1),i(this,Ce).cancel(!0),this._more="",g(this,ie,p),r.moving=!0;let u=`ev:${s.key}:${d}`;return g(this,Bt,u),g(this,ot,{key:u,until:Date.now()+1e3}),this.requestUpdate(),i(this,Ce).pickUp(p.from),!0}cancelMove(){let e=i(this,re);e?.started&&(a(this,v,rr).call(this,!1),i(this,Oe).announce(this.t("cancelled",{event:e.ev.name,place:a(this,v,ms).call(this,e,e.from)}))),i(this,Ce).cancel()}moveEvent(e,t,r){let s=typeof e=="string"?this.event(e):e,l=s&&a(this,v,Nn).call(this,s);if(!l)return!1;let d=l.allDay?N(ht(t).date||t):At(t);if(!d)return!1;let p=r?l.allDay?N(ht(r).date||r):At(r):null;return(!p||p<d)&&(p=l.allDay?X(d,Bm(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),a(this,v,_g).call(this,l,d,p,"api",!1,O(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let r=i(this,ps).get(t);if(this.controlled||!r)return!1;i(this,ps).delete(t);let s=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=r.start,t.end=r.end;let l=a(this,v,Nn).call(this,t);return l&&s&&g(this,ot,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),i(this,Oe).announce(this.t("reverted",{event:t.name,place:l?a(this,v,Vm).call(this,l):r.start})),!0}render(){let e=a(this,v,_t).call(this),t=a(this,v,oy).call(this,a(this,v,ny).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2775
|
+
${a(this,v,My).call(this,e)}
|
|
2776
|
+
${i(this,v,De)==="month"?a(this,v,_y).call(this,e,t):a(this,v,Cy).call(this,e,t)}
|
|
2709
2777
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
2710
|
-
<span id="${
|
|
2711
|
-
<span id="${
|
|
2712
|
-
<span id="${
|
|
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=${
|
|
2715
|
-
@click=${
|
|
2716
|
-
data-row=${d.row??h} aria-label=${
|
|
2717
|
-
@click=${
|
|
2778
|
+
<span id="${i(this,qe)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
2779
|
+
<span id="${i(this,qe)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
2780
|
+
<span id="${i(this,qe)}-op" hidden>${this.t("openHint")}</span>
|
|
2781
|
+
</div>`}};On=new WeakMap,qe=new WeakMap,Oe=new WeakMap,Ce=new WeakMap,ie=new WeakMap,re=new WeakMap,ps=new WeakMap,Bt=new WeakMap,ot=new WeakMap,Tc=new WeakMap,sr=new WeakMap,Bn=new WeakMap,Fn=new WeakMap,Vn=new WeakMap,jn=new WeakMap,_c=new WeakMap,v=new WeakSet,De=function(){return iy.includes(this.view)?this.view:"month"},ir=function(){return Ni(this,this.locale)},vc=function(){return ua(i(this,v,ir))},Fm=function(){return da(i(this,v,ir),this.hourCycle)},Ot=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},yg=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?pa(i(this,v,ir)):(Math.trunc(e)%7+7)%7},yc=function(){return N(this.today)?this.today:Zp()},Tt=function(){return N(this.date)??N(i(this,v,yc))},xg=function(){return i(this,v,De)==="month"&&this._narrow},ay=function(){return i(this,v,De)!=="month"},_t=function(){let e=i(this,v,Tt),t=i(this,v,yg);if(i(this,v,De)==="day")return[e];if(i(this,v,De)==="week"){if(this._narrow)return[e,X(e,1),X(e,2)];let d=X(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(p,u)=>X(d,u))}let r=$t(e),s=X(r,-((r.getDay()-t+7)%7)),l=Math.ceil((Bm(s,ca(e))+1)/7)*7;return Array.from({length:l},(d,p)=>X(s,p))},Nn=function(e){let t=e.name,r=!!N(e.start),s=e.allDay||r;if(s){let u=N(ht(e.start).date||e.start);if(!u)return null;let b=N(ht(e.end).date||e.end)??u;b<u&&(b=u);let f=Math.min(Bm(u,b),366);return{el:e,key:e.key,name:t,allDay:s,start:u,end:b,min:0,dur:1440,days:Array.from({length:f+1},(x,y)=>O(X(u,y)))}}let l=At(e.start);if(!l)return null;let d=At(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:s,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:p,days:[O(l)]}},ny=function(){return this.events.map(e=>a(this,v,Nn).call(this,e)).filter(e=>!!e)},oy=function(e){let t=new Map;for(let r of e)for(let s of r.days)(t.get(s)??t.set(s,[]).get(s)).push(r);for(let r of t.values())r.sort((s,l)=>(s.allDay===l.allDay?0:s.allDay?-1:1)||s.start.getTime()-l.start.getTime()||s.name.localeCompare(l.name));return t},nt=function(e){return de(e,{weekday:"long",day:"numeric",month:"long"},i(this,v,ir))},xc=function(e){return i(this,v,Fm).format((e%1440+1440)%1440)},wc=function(e,t){let r=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},s=sy(i(this,v,ir),{hour:"numeric",minute:"2-digit",...r});try{if(O(e)===O(t)&&s.formatRangeToParts){let p=s.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=>vg(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=O(e)===O(t),d=p=>l?a(this,v,xc).call(this,p.getHours()*60+p.getMinutes()):i(this,v,Fm).dateTime(p);return this.t("timeRange",{start:d(e),end:d(t)})},Vm=function(e){return e.allDay?O(e.start)===O(e.end)?this.t("allDayOn",{date:a(this,v,nt).call(this,e.start)}):this.t("allDayRange",{start:a(this,v,nt).call(this,e.start),end:a(this,v,nt).call(this,e.end)}):O(e.start)!==O(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&Bm(e.start,e.end)===1)?a(this,v,wc).call(this,e.start,e.end):this.t("timed",{date:a(this,v,nt).call(this,e.start),time:a(this,v,wc).call(this,e.start,e.end)})},ly=function(e){let t={title:e.name,when:a(this,v,Vm).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},cy=function(e){let t=i(this,v,ir);if(i(this,v,De)==="month")return i(this,v,vc).monthYear(i(this,v,Tt));if(e.length===1)return de(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let r=sy(t,{day:"numeric",month:"short",year:"numeric"});try{if(r.formatRange)return vg(r.formatRange(e[0],e[e.length-1]))}catch{}return`${r.format(e[0])} \u2013 ${r.format(e[e.length-1])}`},dy=function(e){return i(this,v,Fm).hour12?vg(de(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},i(this,v,ir))):a(this,v,xc).call(this,e*60)},ms=function(e,t){let{start:r,end:s}=a(this,v,$g).call(this,e,t);return e.mode==="time"?this.t("timed",{date:a(this,v,nt).call(this,r),time:a(this,v,wc).call(this,r,s)}):a(this,v,nt).call(this,X(N(e.origin),t.group-e.from.group))},wg=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<aw;t!==this._narrow&&(this._narrow=t)},$c=function(e,t){return i(this,v,De)==="month"?Ee(e,t):i(this,v,De)==="week"?X(e,t*(this._narrow?3:7)):X(e,t)},hy=function(e){this.view!==e&&(this.view=e)},kc=function(){return[...this.renderRoot.querySelectorAll(".item")]},my=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],r=t.find(s=>s.dataset.k===e&&s.classList.contains("item"))??t.find(s=>s.dataset.k===e);if(r)return r;if(e.startsWith("ev:")&&!this.controlled){let s=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${s}`)??null}return null},py=function(){let e=O(i(this,v,Tt));if(i(this,v,xg))return`day:${e}`;if(i(this,v,De)==="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}`},uy=function(){let e=a(this,v,kc).call(this);if(!e.length)return;let t=e.find(r=>r.dataset.k===i(this,Bt))??e.find(r=>r.dataset.k===a(this,v,py).call(this))??e.find(r=>r.dataset.day===O(i(this,v,Tt)))??e[0];for(let r of e)r.tabIndex=r===t?0:-1},gy=function(e){g(this,Bt,e.dataset.k??"");for(let t of a(this,v,kc).call(this))t.tabIndex=t===e?0:-1;e.focus()},zc=new WeakMap,Cc=new WeakMap,fy=function(e,t){let r=new Map;for(let y of a(this,v,kc).call(this)){let k=Number(y.dataset.i);(r.get(k)??r.set(k,[]).get(k)).push(y)}let s=Number(e.dataset.i),l=r.get(s)??[e],d=Math.max(0,l.indexOf(e)),p=a(this,v,_t).call(this).length,u=i(this,v,De)==="month",b=e.dataset.row,f=(y,k)=>{let D=y>=0&&y<p?r.get(y):void 0;return(D?.length?k(D):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(s+1,x);case"ArrowLeft":return f(s-1,x);case"ArrowDown":return l[d+1]??(u?f(s+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?f(s-7,y=>y[y.length-1]):null;case"Home":return u?f(s-s%7,y=>y[0]):f(0,x);case"End":return u?f(Math.min(p-1,s-s%7+6),y=>y[0]):f(p-1,x);default:return null}},by=function(e,t){let r=e.dataset.day??O(i(this,v,Tt)),s=a(this,v,$c).call(this,N(r)??i(this,v,Tt),t),l=O(s),d=(e.dataset.k??"").split(":")[0],p;i(this,v,xg)?p=`day:${l}`:i(this,v,De)==="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=O(a(this,v,$c).call(this,i(this,v,Tt),t)),g(this,Bt,p),g(this,ot,{key:p,until:Date.now()+1e3})},Lc=new WeakMap,Ec=function(e){return Math.floor((1440-Math.min(e,1440))/i(this,v,Ot))+1},vy=function(e,t){let r=i(this,ie);if(!r)return null;let s=a(this,v,_t).call(this).length,l=b=>Math.max(0,Math.min(s-1,b));if(r.mode==="day"){let b=i(this,v,De)==="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<s?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):s-1,index:0};default:return null}}let d=a(this,v,Ec).call(this,r.ev.dur)-1,p=Math.max(1,Math.round(60/i(this,v,Ot))),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}},$g=function(e,t){let{ev:r}=e;if(e.mode==="time"){let d=a(this,v,_t).call(this)[t.group]??N(e.origin),p=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*i(this,v,Ot));return{start:p,end:new Date(p.getTime()+r.dur*6e4)}}let s=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+s,d.getHours(),d.getMinutes());return{start:l(r.start),end:l(r.end)}},kg=function(e,t){let s=a(this,v,_t).call(this).map(O).indexOf(t);if(s<0)return null;let l=i(this,v,ay)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/i(this,v,Ot)),a(this,v,Ec).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:s,index:d}}},Eg=function(){i(this,ie)&&(i(this,ie).ev.el.moving=!1),g(this,ie,null),this._target=null},yy=function(e){let t=i(this,ie);if(!t||!e){this._target=null;return}let r=O(a(this,v,_t).call(this)[e.group]??N(t.origin)),s=e.group===t.from.group&&e.index===t.from.index;this._target=s?null:{iso:r,min:t.mode==="time"?e.index*i(this,v,Ot):void 0}},xy=function(e,t){let r=i(this,ie);a(this,v,Eg).call(this),r&&(g(this,Bn,performance.now()+400),a(this,v,Mg).call(this,r,e,t,"keyboard"))},Mg=function(e,t,r,s){let l=t.group===r.group&&t.index===r.index,{start:d,end:p}=a(this,v,$g).call(this,e,r),u=O(X(N(e.origin),r.group-t.group));a(this,v,_g).call(this,e.ev,d,p,s,l,e.mode==="time"?O(d):u)},Tg=function(e,t,r){return e?{start:O(t),end:O(r)}:{start:ty(t),end:ty(r)}},_g=function(e,t,r,s,l,d){let p=e.el,u=e.name,b=a(this,v,Tg).call(this,e.allDay,e.start,e.end),f=a(this,v,Tg).call(this,e.allDay,t,r),x=B=>{s==="keyboard"&&g(this,ot,{key:B,until:Date.now()+1e3})};if(l||b.start===f.start&&b.end===f.end)return s!=="api"&&i(this,Oe).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:r},k=e.allDay?a(this,v,nt).call(this,t):this.t("timed",{date:a(this,v,nt).call(this,t),time:a(this,v,wc).call(this,t,r)}),D=[],R={value:e.key,event:p,from:b,to:f,allDay:e.allDay,source:s,waitUntil:B=>{D.push(Promise.resolve(B))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:R,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(i(this,ps).set(p,b),p.start=f.start,p.end=f.end),x(`ev:${e.key}:${d}`),this.requestUpdate(),i(this,Oe).announce(this.t("moved",{event:u,place:y.allDay?a(this,v,nt).call(this,t):k})),D.length&&(p.pending=!0,Promise.all(D).then(()=>{p.pending=!1,this.controlled||i(this,ps).delete(p)},()=>{p.pending=!1,this.controlled?i(this,Oe).announce(this.t("reverted",{event:u,place:a(this,v,Vm).call(this,e)})):this.revert(p)})),!0):(i(this,Oe).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},Sc=new WeakMap,zg=function(e,t){let r=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!r.length)return null;let s=0,l=1/0;r.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,s=Number(p.dataset.i??u))});let d=r[0].getBoundingClientRect();return{group:s,min:(t-d.top)/d.height*60}},wy=function(e,t){let r=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!r.length)return null;let s=null,l=1/0;for(let d of r){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,s=d)}return s?Number(s.dataset.i):null},Dc=new WeakMap,Ac=new WeakMap,Rc=new WeakMap,Hc=new WeakMap,Nc=new WeakMap,Ic=new WeakMap,Cg=function(){let e=i(this,re);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,i(this,Oe).announce(this.t("pickedUp",{event:e.ev.name,place:a(this,v,ms).call(this,e,e.from)})),a(this,v,jm).call(this);let t=()=>{i(this,re)?.started&&(a(this,v,$y).call(this),i(this,re).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},jm=function(){let e=i(this,re);if(!e)return;let t=null;if(e.mode==="time"){let l=a(this,v,zg).call(this,e.x,e.y);if(l){let d=a(this,v,Ec).call(this,e.ev.dur)-1;t={group:l.group,index:Math.max(0,Math.min(d,Math.round((l.min-e.grab)/i(this,v,Ot))))}}}else{let l=a(this,v,wy).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 r=t.group!==e.to.group;e.to=t;let s=t.group===e.from.group&&t.index===e.from.index;this._target=s?null:{iso:O(a(this,v,_t).call(this)[t.group]),min:e.mode==="time"?t.index*i(this,v,Ot):void 0},r&&i(this,Oe).announce(this.t("over",{place:a(this,v,ms).call(this,e,t)}))},$y=function(){let e=i(this,re),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let r=40,s=14,l=x=>x<r?Math.ceil((r-Math.max(x,0))/r*s):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&&a(this,v,jm).call(this)},rr=function(e){let t=i(this,re);t&&(g(this,re,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",i(this,Hc),!0),window.removeEventListener("pointerup",i(this,Nc),!0),window.removeEventListener("pointercancel",i(this,Ic),!0),window.removeEventListener("touchmove",i(this,Ac),!0),window.removeEventListener("contextmenu",i(this,Rc),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&a(this,v,Mg).call(this,t,t.from,t.to,"pointer")))},Mc=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:i(this,v,De)},bubbles:!0,composed:!0}))},ky=function(e,t,r){let s=r*60;if(e.detail>0){let p=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-p.top)/p.height*60/i(this,v,Ot))*i(this,v,Ot);s+=Math.max(0,Math.min(59,u))}let l=Math.floor(s/60),d=s%60;a(this,v,Mc).call(this,`${t}T${Wm(l)}:${Wm(d)}`,!1)},Lg=function(e,t){if(performance.now()<i(this,Bn)||i(this,Ce).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()},Ey=function(e){this._more=e,g(this,Fn,!0)},Um=function(e){let t=this._more;this._more="",e&&t&&(g(this,Bt,`more:${t}`),g(this,ot,{key:`more:${t}`,until:Date.now()+1e3}))},Sg=function(){return i(this,ie)?.ev??(i(this,re)?.started?i(this,re).ev:null)},In=function(e,t,r,s,l,d={}){let p=e.el,u=p.pending,b=a(this,v,ly).call(this,e),f=!this.readonly&&!p.locked&&!u,x=["attention","information","success","critical"].includes(p.tone)?p.tone:"neutral",y=`chip ${s} 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,D=e.allDay?h:c`<span class="tm">${a(this,v,xc).call(this,e.min)}</span>`,R=p.kind&&(s!=="month"||!p.icon)?c`<span class="k">${p.kind}</span>`:h,q=u?c`<span class="spin" aria-hidden="true"></span>`:h,B=s==="time"?c`<span class="lead">${k}${D}${q}</span><span class="h">${e.name}</span>${R}`:c`${k}${D}<span class="h">${e.name}</span>${R}${q}`,U=u?`${b}, ${this.t("saving")}`:b,Fe=f?`${i(this,qe)}-mv`:`${i(this,qe)}-op`,K=`ev:${e.key}:${t}`,Y=f?this.t("roleDescription"):h;return p.href?c`<a class=${y} href=${p.href} style=${d.style??h} data-k=${K} data-ev=${e.key} data-day=${t} data-i=${r}
|
|
2782
|
+
data-row=${d.row??h} aria-label=${U} aria-describedby=${Fe} aria-roledescription=${Y}
|
|
2783
|
+
@click=${J=>a(this,v,Lg).call(this,J,e)}>${B}</a>`:c`<button type="button" class=${y} style=${d.style??h} data-k=${K} data-ev=${e.key} data-day=${t} data-i=${r}
|
|
2784
|
+
data-row=${d.row??h} aria-label=${U} aria-describedby=${Fe} aria-roledescription=${Y}
|
|
2785
|
+
@click=${J=>a(this,v,Lg).call(this,J,e)}>${B}</button>`},Km=function(e,t="",r){return c`<div class="ph ${t}" style=${r??h} aria-hidden="true">${e.name}</div>`},My=function(e){let t=i(this,v,De),r=t==="week"&&this._narrow,s=t==="month"?this.t("previousMonth"):r?this.t("previousDays",{count:3}):t==="week"?this.t("previousWeek"):this.t("previousDay"),l=t==="month"?this.t("nextMonth"):r?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">
|
|
2718
2786
|
<div class="nav">
|
|
2719
|
-
<button type="button" class="hb icon prev" aria-label=${
|
|
2787
|
+
<button type="button" class="hb icon prev" aria-label=${s} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
2720
2788
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
2721
2789
|
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
2722
2790
|
</div>
|
|
2723
|
-
<div class="title" part="title" id="${
|
|
2791
|
+
<div class="title" part="title" id="${i(this,qe)}-t" role="heading" aria-level=${d} aria-live="polite">${a(this,v,cy).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
2724
2792
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
2725
|
-
${
|
|
2793
|
+
${iy.map(p=>c`<button type="button" class="hb" data-view=${p} aria-pressed=${p===t?"true":"false"} @click=${()=>a(this,v,hy).call(this,p)}>${this.t(p)}</button>`)}
|
|
2726
2794
|
</div>
|
|
2727
|
-
</div>`},
|
|
2728
|
-
<button type="button" class="dayb item" data-k="day:${
|
|
2729
|
-
@click=${()=>{this.date=
|
|
2730
|
-
</td>`}let
|
|
2731
|
-
aria-label=${
|
|
2732
|
-
<div class="dh">${
|
|
2733
|
-
${
|
|
2734
|
-
@click=${()=>
|
|
2795
|
+
</div>`},Ty=function(e){let t=i(this,v,vc),r=Array.from({length:7},(s,l)=>(l+i(this,v,yg))%7);return c`<thead><tr>${r.map(s=>c`<th scope="col" abbr=${t.weekdaysLong[s]}><span aria-hidden="true">${e?t.weekdaysShort[s].slice(0,2):t.weekdaysShort[s]}</span><span class="vh">${t.weekdaysLong[s]}</span></th>`)}</tr></thead>`},_y=function(e,t){let r=i(this,v,Tt),s=i(this,v,yc),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=a(this,v,Sg).call(this),p=this._target,u=Array.from({length:e.length/7},(B,U)=>e.slice(U*7,U*7+7)),b=this._narrow,f=(B,U,Fe)=>{let K=O(B),Y=t.get(K)??[],J=a(this,v,nt).call(this,B),wi=`${B.getMonth()!==r.getMonth()?"other":""} ${K===s?"today":""} ${p?.iso===K?"over":""}`,Io=c`<span class="num" aria-hidden="true">${i(this,v,vc).day(B)}</span>`;if(b){let Vt=Y.slice(0,3).map(Ts=>["attention","information","success","critical"].includes(Ts.el.tone)?Ts.el.tone:"neutral");return c`<td class=${wi} data-drop data-i=${U} aria-selected=${K===O(r)?"true":"false"} aria-current=${K===s?"date":h}>
|
|
2796
|
+
<button type="button" class="dayb item" data-k="day:${K}" data-i=${U} data-day=${K} aria-label=${this.t("dayEvents",{date:J,count:Y.length})}
|
|
2797
|
+
@click=${()=>{this.date=K,g(this,Bt,`day:${K}`)}}>${Io}<span class="dots">${Vt.map(Ts=>c`<span class="dot tone-${Ts}"></span>`)}</span></button>
|
|
2798
|
+
</td>`}let Ms=Y,ld=0;if(Y.length>l){Ms=Y.slice(0,l-1);let Vt=d&&Y.find(Ts=>Ts.key===d.key);Vt&&!Ms.includes(Vt)&&(Ms=[...Y.slice(0,l-2),Vt]),ld=Y.length-Ms.length}let cd=this.readonly;return c`<td class="${wi}${cd?" item":""}" data-drop data-i=${U} data-day=${K} data-k=${cd?`cell:${K}`:h}
|
|
2799
|
+
aria-label=${cd?this.t("dayEvents",{date:J,count:Y.length}):h} aria-current=${K===s?"date":h}>
|
|
2800
|
+
<div class="dh">${Io}<span class="vh">${J}</span>
|
|
2801
|
+
${cd?h:c`<button type="button" class="add item" data-k="add:${K}" data-i=${U} data-day=${K} aria-label=${this.t("addOn",{date:J})}
|
|
2802
|
+
@click=${()=>a(this,v,Mc).call(this,K,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2735
2803
|
</div>
|
|
2736
|
-
${
|
|
2737
|
-
${
|
|
2738
|
-
${p?.iso===
|
|
2804
|
+
${Ms.length||p?.iso===K&&d?c`<ul class="evs">
|
|
2805
|
+
${Ms.map(Vt=>c`<li>${a(this,v,In).call(this,Vt,K,U,"month",!0)}</li>`)}
|
|
2806
|
+
${p?.iso===K&&d?c`<li aria-hidden="true">${a(this,v,Km).call(this,d)}</li>`:h}
|
|
2739
2807
|
</ul>`:h}
|
|
2740
|
-
${
|
|
2741
|
-
aria-expanded=${this._more===
|
|
2742
|
-
@click=${()=>this._more===
|
|
2743
|
-
${this._more===
|
|
2744
|
-
<div class="pop-h"><span>${
|
|
2745
|
-
<ul>${
|
|
2808
|
+
${ld?c`<button type="button" class="more item" data-k="more:${K}" data-i=${U} data-day=${K} aria-haspopup="dialog"
|
|
2809
|
+
aria-expanded=${this._more===K?"true":"false"} aria-label=${this.t("moreLabel",{count:ld,date:J})}
|
|
2810
|
+
@click=${()=>this._more===K?a(this,v,Um).call(this,!1):a(this,v,Ey).call(this,K)}>${this.t("more",{count:ld})}</button>`:h}
|
|
2811
|
+
${this._more===K?c`<div class="pop ${Fe>=4?"end":""}" role="dialog" aria-label=${J}>
|
|
2812
|
+
<div class="pop-h"><span>${J}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>a(this,v,Um).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
2813
|
+
<ul>${Y.map(Vt=>c`<li>${a(this,v,In).call(this,Vt,K,U,"list",!1)}</li>`)}</ul>
|
|
2746
2814
|
</div>`:h}
|
|
2747
|
-
</td>`},x=c`<table class="month ${b?"compact":""}" part="grid" role="grid" aria-labelledby="${
|
|
2815
|
+
</td>`},x=c`<table class="month ${b?"compact":""}" part="grid" role="grid" aria-labelledby="${i(this,qe)}-t" aria-describedby="${i(this,qe)}-gh"
|
|
2748
2816
|
aria-busy=${this.loading?"true":"false"}>
|
|
2749
|
-
${
|
|
2750
|
-
<tbody>${u.map((B,
|
|
2751
|
-
</table>`;if(!b)return x;let y=
|
|
2752
|
-
<section class="agenda" part="agenda" aria-labelledby="${
|
|
2817
|
+
${a(this,v,Ty).call(this,b)}
|
|
2818
|
+
<tbody>${u.map((B,U)=>c`<tr>${B.map((Fe,K)=>f(Fe,U*7+K,K))}</tr>`)}</tbody>
|
|
2819
|
+
</table>`;if(!b)return x;let y=O(r),k=t.get(y)??[],D=e.findIndex(B=>O(B)===y),R=a(this,v,nt).call(this,r),q=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${x}
|
|
2820
|
+
<section class="agenda" part="agenda" aria-labelledby="${i(this,qe)}-ag">
|
|
2753
2821
|
<div class="ag-h">
|
|
2754
|
-
<div class="ag-t" id="${
|
|
2755
|
-
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:
|
|
2822
|
+
<div class="ag-t" id="${i(this,qe)}-ag" role="heading" aria-level=${q}>${R}</div>
|
|
2823
|
+
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:R})} @click=${()=>a(this,v,Mc).call(this,y,!0)}>
|
|
2756
2824
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
2757
2825
|
</div>
|
|
2758
|
-
${k.length?c`<ul class="ag-list">${k.map(B=>c`<li>${
|
|
2759
|
-
</section>`},
|
|
2826
|
+
${k.length?c`<ul class="ag-list">${k.map(B=>c`<li>${a(this,v,In).call(this,B,y,D,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
2827
|
+
</section>`},zy=function(e){let t=new Map,r=e.filter(u=>!u.allDay).sort((u,b)=>u.min-b.min||b.dur-u.dur),s=[],l=[],d=-1,p=()=>{for(let u of s)t.get(u).lanes=l.length;s=[],l=[]};for(let u of r){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}),s.push(u),d=Math.max(d,b)}return p(),t},Cy=function(e,t){let r=i(this,v,yc),s=i(this,v,vc),l=a(this,v,Sg).call(this),d=this._target,p=this.readonly,u=e.map(f=>{let x=O(f),y=t.get(x)??[];return{d:f,iso:x,text:a(this,v,nt).call(this,f),allDay:y.filter(k=>k.allDay),timed:y.filter(k=>!k.allDay),lanes:a(this,v,zy).call(this,y)}}),b=Array.from({length:24},(f,x)=>x);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${i(this,qe)}-t" aria-describedby="${i(this,qe)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
2760
2828
|
style="--cols:${e.length}">
|
|
2761
2829
|
<div class="tg-top" role="rowgroup">
|
|
2762
2830
|
<div class="row" role="row">
|
|
2763
2831
|
<div class="axis" role="columnheader"><span class="vh">${this.t("time")}</span></div>
|
|
2764
|
-
${u.map(f=>c`<div class="colh ${f.iso===
|
|
2765
|
-
<span class="wd" aria-hidden="true">${
|
|
2832
|
+
${u.map(f=>c`<div class="colh ${f.iso===r?"today":""}" role="columnheader" aria-current=${f.iso===r?"date":h}>
|
|
2833
|
+
<span class="wd" aria-hidden="true">${s.weekdaysShort[f.d.getDay()]}</span><span class="dn" aria-hidden="true">${s.day(f.d)}</span><span class="vh">${f.text}</span>
|
|
2766
2834
|
</div>`)}
|
|
2767
2835
|
</div>
|
|
2768
2836
|
<div class="row adrow" role="row">
|
|
2769
2837
|
<div class="axis" role="rowheader">${this.t("allDay")}</div>
|
|
2770
2838
|
${u.map((f,x)=>c`<div class="adcell ${d?.iso===f.iso&&l?.allDay?"over":""}" role="gridcell" data-drop data-i=${x}>
|
|
2771
2839
|
${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=${()=>
|
|
2773
|
-
${f.allDay.map(y=>
|
|
2774
|
-
${d?.iso===f.iso&&l?.allDay?
|
|
2840
|
+
aria-label=${this.t("addAllDay",{date:f.text})} @click=${()=>a(this,v,Mc).call(this,f.iso,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2841
|
+
${f.allDay.map(y=>a(this,v,In).call(this,y,f.iso,x,"allday",!0,{row:"a"}))}
|
|
2842
|
+
${d?.iso===f.iso&&l?.allDay?a(this,v,Km).call(this,l):h}
|
|
2775
2843
|
</div>`)}
|
|
2776
2844
|
</div>
|
|
2777
2845
|
</div>
|
|
2778
2846
|
<div class="tg-body" role="rowgroup">
|
|
2779
2847
|
${b.map(f=>c`<div class="row hr" role="row">
|
|
2780
|
-
<div class="axis" role="rowheader"><span>${
|
|
2781
|
-
${u.map((x,y)=>{let k=x.timed.filter(
|
|
2848
|
+
<div class="axis" role="rowheader"><span>${a(this,v,dy).call(this,f)}</span></div>
|
|
2849
|
+
${u.map((x,y)=>{let k=x.timed.filter(R=>Math.floor(R.min/60)===f),D=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
2850
|
${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:
|
|
2784
|
-
${k.map(
|
|
2785
|
-
${
|
|
2851
|
+
aria-label=${this.t("addAt",{time:a(this,v,xc).call(this,f*60),date:x.text})} @click=${R=>a(this,v,ky).call(this,R,x.iso,f)}></button>`}
|
|
2852
|
+
${k.map(R=>{let q=x.lanes.get(R)??{lane:0,lanes:1},B=Math.min(R.dur,1440-R.min)/60;return a(this,v,In).call(this,R,x.iso,y,"time",!0,{row:String(f),style:`--top:${(R.min-f*60)/60};--len:${B};--lane:${q.lane};--lanes:${q.lanes}`})})}
|
|
2853
|
+
${D?a(this,v,Km).call(this,l,"time",`--top:${(d.min-f*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
2786
2854
|
</div>`})}
|
|
2787
2855
|
</div>`)}
|
|
2788
2856
|
</div>
|
|
2789
|
-
</div>`},
|
|
2857
|
+
</div>`},qn.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}},qn.styles=[E,w`
|
|
2790
2858
|
:host { display: block; position: relative; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
2791
2859
|
:host([dragging]) { cursor: grabbing; user-select: none; -webkit-user-select: none; }
|
|
2792
2860
|
.cal { display: flex; flex-direction: column; gap: var(--cm-space-12); min-width: 0; }
|
|
@@ -2947,12 +3015,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2947
3015
|
.chip.time > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2948
3016
|
.chip.time .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
2949
3017
|
.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; }
|
|
2950
|
-
`];$("cm-calendar",
|
|
3018
|
+
`];$("cm-calendar",qn);var s2=_("reportTile",{pinned:", pinned"}),us=class extends T{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=c`
|
|
2951
3019
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
2952
3020
|
<span class="label">${this.label}</span>
|
|
2953
3021
|
${this.pinned?c`<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
2954
3022
|
<span class="sr">${this.t("pinned")}</span></span>`:h}
|
|
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>`}};
|
|
3023
|
+
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};us.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},us.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0},us.styles=[E,w`
|
|
2956
3024
|
:host { display: block; }
|
|
2957
3025
|
.tile {
|
|
2958
3026
|
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-12);
|
|
@@ -2971,10 +3039,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2971
3039
|
.icon cm-icon::part(svg) { width: 32px; height: 32px; }
|
|
2972
3040
|
::slotted([slot='icon']) { width: 32px; height: 32px; }
|
|
2973
3041
|
}
|
|
2974
|
-
`];$("cm-report-tile",
|
|
3042
|
+
`];$("cm-report-tile",us);var Un=class extends C{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`
|
|
2975
3043
|
${this.heading?c`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:h}
|
|
2976
3044
|
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":h}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
2977
|
-
`}}
|
|
3045
|
+
`}};Un.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},Un.styles=[E,w`
|
|
2978
3046
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
2979
3047
|
.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; }
|
|
2980
3048
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-12); }
|
|
@@ -2984,16 +3052,16 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2984
3052
|
.title { margin-bottom: var(--cm-space-8); }
|
|
2985
3053
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
2986
3054
|
}
|
|
2987
|
-
`];$("cm-report-tiles"
|
|
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">${
|
|
2989
|
-
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),
|
|
3055
|
+
`];$("cm-report-tiles",Un);var c2=_("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),Ly=/^\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:Ly.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(),r=this.t(e,{change:this.change}).trim(),s=t==="positive"?this.t("good",{trend:r}):t==="negative"?this.t("bad",{trend:r}):r;return c`<span class="change ${e} ${t}" part="change">
|
|
3056
|
+
<cm-icon name=${e==="flat"?"arrow-left":"arrow-up-right"} size="16"></cm-icon><span aria-hidden="true">${this.change}</span><span class="sr">${s}</span>
|
|
3057
|
+
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),r=this.renderChange(),s=r!==h||e,l=c`
|
|
2990
3058
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
2991
3059
|
<span class="value" id="value" part="value">${t}</span>
|
|
2992
|
-
<span class="foot ${
|
|
2993
|
-
${
|
|
3060
|
+
<span class="foot ${s?"on":""}" id="foot" part="footer">
|
|
3061
|
+
${r}
|
|
2994
3062
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
2995
3063
|
</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=${
|
|
3064
|
+
`,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=${s?"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&&Ly.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`
|
|
2997
3065
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
2998
3066
|
.tile {
|
|
2999
3067
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -3029,29 +3097,29 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3029
3097
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
3030
3098
|
}
|
|
3031
3099
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
3032
|
-
`];$("cm-metric",
|
|
3033
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${
|
|
3100
|
+
`];$("cm-metric",Kn);var Wn=class extends C{constructor(){super(...arguments);this.label="";this.icon="";this.href="";this.value="";this.current=!1;this.badge="";this.expanded=!1;this.primary=!1}render(){return null}toItem(){return Sy(this)}};Wn.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}},Wn.styles=w`:host { display: none !important; }`;$("cm-nav-item",Wn);function Sy(o){let n=r=>o.getAttribute(r),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=vi(o);return t.length&&(e.items=t),e}var vi=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(Sy),Dg=o=>o.value||o.href||o.label,Gm=o=>!!o.current||!!o.items?.some(Gm),ar=(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},nr=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:Dg(n),href:n.href??""}}));var v2=_("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),Pc,qc,Jm,j,Ag,Ym,Rg,Dy,Ay,Hg,Ng,Ry,Ig,Pg,Xm,qg,Hy,Gn=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,Pc,new Set);m(this,qc);m(this,Jm,H("cm-sidenav"))}connectedCallback(){super.connectedCallback(),a(this,j,Ag).call(this),g(this,qc,ar(this,()=>a(this,j,Ag).call(this)))}disconnectedCallback(){super.disconnectedCallback(),i(this,qc)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let r=a(this,j,Ym).call(this,e,t);i(this,Pc).has(r)||!e.items?.length||(i(this,Pc).add(r),(e.expanded||Gm(e))&&this._open.add(r))})}toggle(e,t){let r=this.navItems[e];if(!r?.items?.length)return;let s=a(this,j,Ym).call(this,r,e),l=t??!this._open.has(s);if(l===this._open.has(s))return;let d=new Set(this._open);l?d.add(s):d.delete(s),this._open=d,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:r,expanded:l}}))}render(){let e=this.collapsed;return c`
|
|
3101
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${a(this,j,Ay)}>
|
|
3034
3102
|
<slot name="header"></slot>
|
|
3035
3103
|
<ul part="list">
|
|
3036
|
-
${this.navItems.map((t,
|
|
3037
|
-
${
|
|
3038
|
-
aria-expanded=${
|
|
3039
|
-
${
|
|
3104
|
+
${this.navItems.map((t,r)=>{if(!t.items?.length)return c`<li>${a(this,j,qg).call(this,t,"",{index:r})}</li>`;let s=!e&&this._open.has(a(this,j,Ym).call(this,t,r)),l=`${i(this,Jm)}-${r}`;return c`<li>
|
|
3105
|
+
${a(this,j,Xm).call(this,t,c`<button type="button" class="item parent ${Gm(t)?"has-current":""}" part="item" data-index=${r}
|
|
3106
|
+
aria-expanded=${s?"true":"false"} aria-controls=${l} @click=${()=>e?a(this,j,Ry).call(this,r):this.toggle(r)}>
|
|
3107
|
+
${a(this,j,Ig).call(this,t)}${a(this,j,Pg).call(this,t)}
|
|
3040
3108
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
3041
3109
|
</button>`)}
|
|
3042
|
-
<ul class="sub" id=${l} ?hidden=${!
|
|
3043
|
-
${
|
|
3110
|
+
<ul class="sub" id=${l} ?hidden=${!s} aria-label=${t.label}>
|
|
3111
|
+
${a(this,j,Hg).call(this,t.items).map(([d,p])=>c`<li>${a(this,j,qg).call(this,{...d,icon:void 0},p?"deep":"",{parent:r})}</li>`)}
|
|
3044
3112
|
</ul>
|
|
3045
3113
|
</li>`})}
|
|
3046
3114
|
</ul>
|
|
3047
|
-
${
|
|
3115
|
+
${a(this,j,Hy).call(this)}
|
|
3048
3116
|
<slot name="footer"></slot>
|
|
3049
3117
|
<slot hidden></slot>
|
|
3050
3118
|
</nav>
|
|
3051
|
-
`}};
|
|
3052
|
-
data-index=${
|
|
3053
|
-
data-index=${
|
|
3054
|
-
@click=${()=>
|
|
3119
|
+
`}};Pc=new WeakMap,qc=new WeakMap,Jm=new WeakMap,j=new WeakSet,Ag=function(){this._slotted=vi(this)},Ym=function(e,t){return`${t}:${Dg(e)}`},Rg=function(e,t){nr(this,t)||e.preventDefault()},Dy=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},Ay=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let r=a(this,j,Dy).call(this),s=r.indexOf(t),l=Number(t.dataset.index),d=te(e,this),p;if(e.key==="ArrowDown")p=r[(s+1)%r.length];else if(e.key==="ArrowUp")p=r[(s-1+r.length)%r.length];else if(e.key==="Home")p=r[0];else if(e.key==="End")p=r[r.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()},Hg=function(e,t=0){return e.flatMap(r=>[[r,t],...a(this,j,Hg).call(this,r.items??[],t+1)])},Ng=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},Ry=function(e){a(this,j,Ng).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},Ig=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},Pg=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}`},Xm=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},qg=function(e,t,r={}){let s=c`${a(this,j,Ig).call(this,e)}${a(this,j,Pg).call(this,e)}`;return a(this,j,Xm).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
3120
|
+
data-index=${r.index??h} data-parent=${r.parent??h} @click=${l=>a(this,j,Rg).call(this,l,e)}>${s}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
3121
|
+
data-index=${r.index??h} data-parent=${r.parent??h} @click=${l=>a(this,j,Rg).call(this,l,e)}>${s}</button>`)},Hy=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">${a(this,j,Xm).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
3122
|
+
@click=${()=>a(this,j,Ng).call(this,!this.collapsed)}>${t}</button>`)}</div>`},Gn.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},Gn.styles=[E,w`
|
|
3055
3123
|
:host { display: block; width: var(--cm-side-navigation-width, 220px); }
|
|
3056
3124
|
nav {
|
|
3057
3125
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: var(--cm-radius-lg);
|
|
@@ -3096,7 +3164,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3096
3164
|
background: var(--cm-count-bg); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
3097
3165
|
}
|
|
3098
3166
|
.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); }
|
|
3099
|
-
`];$("cm-side-navigation",
|
|
3167
|
+
`];$("cm-side-navigation",Gn);function Ny(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 Yn=class extends C{constructor(){super(...arguments);this.name="";this.src="";this.size="medium";this.shape="round";this.decorative=!1;this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){let e=Ny(this.name),t=this.decorative||!this.name?h:this.name,r=this.decorative||!this.name?"true":h,s,l="avatar";return this.src&&!this._failed?s=c`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?s=c`<span aria-hidden="true">${e}</span>`:(l+=" icon",s=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=${r}>${s}</span>`}};Yn.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},Yn.styles=[E,w`
|
|
3100
3168
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3101
3169
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
3102
3170
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -3109,22 +3177,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3109
3177
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
3110
3178
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
3111
3179
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
3112
|
-
`];$("cm-avatar",
|
|
3180
|
+
`];$("cm-avatar",Yn);var z2=_("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),Zn,yi,Qn,Ae,Oc,Og,Xn,Jn=class extends T{constructor(){super();m(this,Ae);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;m(this,Zn);m(this,yi,!1);m(this,Qn,null);this.addEventListener("cm-select",e=>{let t=a(this,Ae,Oc).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){a(this,Ae,Oc).call(this)?.focus();return}this._searchOpen||(g(this,Qn,Yp()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),g(this,Zn,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),i(this,Zn).observe(this)}disconnectedCallback(){super.disconnectedCallback(),i(this,Zn)?.disconnect(),i(this,yi)&&(Tl(),g(this,yi,!1))}updated(e){if(!e.has("_searchOpen"))return;let t=this.renderRoot.querySelector("dialog.layer");if(this._searchOpen&&t&&!t.open)t.showModal(),i(this,yi)||(Gp(),g(this,yi,!0)),a(this,Ae,Oc).call(this)?.focus(),a(this,Ae,Xn).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),i(this,yi)&&(Tl(),g(this,yi,!1));let r=i(this,Qn)??this.renderRoot.querySelector(".search-btn");g(this,Qn,null),r?.isConnected&&r.focus(),a(this,Ae,Xn).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
3113
3181
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
3114
3182
|
<div class="logo"><slot name="logo"></slot></div>
|
|
3115
3183
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
3116
|
-
@click=${()=>
|
|
3117
|
-
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${
|
|
3184
|
+
@click=${()=>a(this,Ae,Xn).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="16"></cm-icon></button>`:h}
|
|
3185
|
+
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${a(this,Ae,Og)}></slot></div>`}
|
|
3118
3186
|
<span class="grow"></span>
|
|
3119
3187
|
<div class="end">
|
|
3120
3188
|
${this._narrow&&this._hasSearch?c`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
3121
3189
|
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:h}
|
|
3122
3190
|
<div class="actions"><slot name="actions"></slot></div>
|
|
3123
3191
|
${this.balance?c`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
3124
|
-
@click=${()=>
|
|
3192
|
+
@click=${()=>a(this,Ae,Xn).call(this,"cm-wallet")}>${this.balance}</button>`:h}
|
|
3125
3193
|
<slot name="end"></slot>
|
|
3126
3194
|
${this.userName?c`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
3127
|
-
@click=${()=>
|
|
3195
|
+
@click=${()=>a(this,Ae,Xn).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
3128
3196
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:h}
|
|
3129
3197
|
<slot name="account"></slot>
|
|
3130
3198
|
</div>
|
|
@@ -3133,11 +3201,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3133
3201
|
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
3134
3202
|
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
3135
3203
|
<div class="layer-bar">
|
|
3136
|
-
<div class="layer-search"><slot name="search" @slotchange=${
|
|
3204
|
+
<div class="layer-search"><slot name="search" @slotchange=${a(this,Ae,Og)}></slot></div>
|
|
3137
3205
|
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
3138
3206
|
</div>
|
|
3139
3207
|
</dialog>`:h}
|
|
3140
|
-
`}};
|
|
3208
|
+
`}};Zn=new WeakMap,yi=new WeakMap,Qn=new WeakMap,Ae=new WeakSet,Oc=function(){return this.querySelector(':scope > [slot="search"]')},Og=function(){this._hasSearch=!!a(this,Ae,Oc).call(this)},Xn=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Jn.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}},Jn.styles=[E,w`
|
|
3141
3209
|
:host {
|
|
3142
3210
|
display: block; background: var(--cm-bg-surface); container-type: inline-size;
|
|
3143
3211
|
--_h: var(--cm-control-height-md); --_touch: var(--cm-control-height-touch);
|
|
@@ -3214,10 +3282,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3214
3282
|
@media (pointer: coarse) {
|
|
3215
3283
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
3216
3284
|
}
|
|
3217
|
-
`];$("cm-header-bar",
|
|
3218
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${
|
|
3285
|
+
`];$("cm-header-bar",Jn);var H2=_("bottomNavigation",{label:"Main"}),Bc,gs,Bg,Iy,eo=class extends T{constructor(){super(...arguments);m(this,gs);this.items=[];this.fixed=!1;this._slotted=[];m(this,Bc)}connectedCallback(){super.connectedCallback(),a(this,gs,Bg).call(this),g(this,Bc,ar(this,()=>a(this,gs,Bg).call(this)))}disconnectedCallback(){super.disconnectedCallback(),i(this,Bc)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3286
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${a(this,gs,Iy).call(this,e)}</li>`)}</ul>
|
|
3219
3287
|
<slot hidden></slot>
|
|
3220
|
-
</nav>`}};
|
|
3288
|
+
</nav>`}};Bc=new WeakMap,gs=new WeakSet,Bg=function(){this._slotted=vi(this)},Iy=function(e){let t=`item ${e.primary?"primary":""}`,r=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>`,s=l=>{nr(this,e)||l.preventDefault()};return e.href?c`<a class=${t} part="item" href=${e.href} aria-current=${e.current?"page":h} @click=${s}>${r}</a>`:c`<button type="button" class=${t} part="item" aria-current=${e.current?"page":h} @click=${s}>${r}</button>`},eo.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},eo.styles=[E,w`
|
|
3221
3289
|
:host { display: block; }
|
|
3222
3290
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
3223
3291
|
nav {
|
|
@@ -3239,32 +3307,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3239
3307
|
.icon { display: grid; place-items: center; width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
3240
3308
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
3241
3309
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3242
|
-
`];$("cm-bottom-navigation",
|
|
3243
|
-
@keydown=${
|
|
3310
|
+
`];$("cm-bottom-navigation",eo);var F2=_("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Fc,fs,Be,Fg,Py,Vg,jg,qy,to=class extends T{constructor(){super(...arguments);m(this,Be);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;m(this,Fc);m(this,fs,H("cm-mmenu"))}connectedCallback(){super.connectedCallback(),a(this,Be,Fg).call(this),g(this,Fc,ar(this,()=>a(this,Be,Fg).call(this)))}disconnectedCallback(){super.disconnectedCallback(),i(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="${i(this,fs)}-sub"
|
|
3311
|
+
@keydown=${r=>{r.key==="Escape"&&(r.preventDefault(),this.back())}}>
|
|
3244
3312
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
3245
3313
|
${t.label}</button>
|
|
3246
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(
|
|
3314
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(r=>c`<li>${a(this,Be,jg).call(this,r,0,0,!0)}</li>`)}</ul>
|
|
3247
3315
|
<slot hidden></slot>
|
|
3248
3316
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3249
|
-
${
|
|
3250
|
-
${e.map((
|
|
3251
|
-
${
|
|
3252
|
-
<ul class="card">${(
|
|
3317
|
+
${a(this,Be,qy).call(this)}
|
|
3318
|
+
${e.map((r,s)=>{let l=`${i(this,fs)}-s${s}`;return c`<section aria-labelledby=${r.label?l:h}>
|
|
3319
|
+
${r.label?c`<h2 class="heading" id=${l}>${r.label}</h2>`:h}
|
|
3320
|
+
<ul class="card">${(r.items??[]).map((d,p)=>c`<li>${a(this,Be,jg).call(this,d,s,p)}</li>`)}</ul>
|
|
3253
3321
|
</section>`})}
|
|
3254
3322
|
<slot hidden></slot>
|
|
3255
|
-
</nav>`}};
|
|
3256
|
-
@click=${()=>
|
|
3257
|
-
<h2 class="heading" id="${
|
|
3323
|
+
</nav>`}};Fc=new WeakMap,fs=new WeakMap,Be=new WeakSet,Fg=function(){this._slotted=vi(this)},Py=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},Vg=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},jg=function(e,t,r,s=!1){let l=b=>{nr(this,e)||b.preventDefault()};if(e.primary&&!s)return c`<button type="button" class="row action" part="row" @click=${l}>${e.label}</button>`;let d=e.icon&&!s?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&&!s)return c`<button type="button" class="row" part="row" data-row="${t}-${r}"
|
|
3324
|
+
@click=${()=>a(this,Be,Py).call(this,t,r)}>${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&&!s?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>`},qy=function(){if(!this.store&&!this.userName)return h;let e=this.userName.trim().charAt(0).toUpperCase();return c`<section aria-labelledby="${i(this,fs)}-profile">
|
|
3325
|
+
<h2 class="heading" id="${i(this,fs)}-profile">${this.t("profile")}</h2>
|
|
3258
3326
|
<ul class="card">
|
|
3259
|
-
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>
|
|
3327
|
+
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,Be,Vg).call(this,"cm-store-switch")}>
|
|
3260
3328
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
3261
3329
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3262
|
-
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>
|
|
3330
|
+
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,Be,Vg).call(this,"cm-account")}>
|
|
3263
3331
|
<span class="avatar">${this.avatarSrc?c`<img src=${this.avatarSrc} alt="">`:c`<span aria-hidden="true">${e}</span>`}</span>
|
|
3264
3332
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?c`<span class="email">${this.userEmail}</span>`:h}</span>
|
|
3265
3333
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3266
3334
|
</ul>
|
|
3267
|
-
</section>`},
|
|
3335
|
+
</section>`},to.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}},to.styles=[E,w`
|
|
3268
3336
|
:host { display: block; background: var(--cm-bg-page); }
|
|
3269
3337
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
3270
3338
|
.heading {
|
|
@@ -3305,12 +3373,12 @@ ${t.label}</button>
|
|
|
3305
3373
|
}
|
|
3306
3374
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3307
3375
|
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3308
|
-
`];$("cm-mobile-menu",
|
|
3376
|
+
`];$("cm-mobile-menu",to);var G2=_("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),Zm,Oy,io=class extends T{constructor(){super(...arguments);m(this,Zm);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
3309
3377
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
3310
3378
|
<span class="text"><slot></slot></span>
|
|
3311
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${
|
|
3379
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${a(this,Zm,Oy)}><cm-icon name="close" size="16"></cm-icon>
|
|
3312
3380
|
</button>`:h}
|
|
3313
|
-
</div>`}};
|
|
3381
|
+
</div>`}};Zm=new WeakSet,Oy=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},io.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},io.styles=[E,w`
|
|
3314
3382
|
:host { display: block; }
|
|
3315
3383
|
.bar {
|
|
3316
3384
|
position: relative; display: flex; align-items: center; justify-content: center; gap: var(--cm-space-8); min-height: 48px;
|
|
@@ -3332,11 +3400,11 @@ ${t.label}</button>
|
|
|
3332
3400
|
@media (max-width: 640px) {
|
|
3333
3401
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
3334
3402
|
}
|
|
3335
|
-
`];$("cm-flash-offer-bar",
|
|
3403
|
+
`];$("cm-flash-offer-bar",io);var tT=_("linkTabs",{label:"Sections"}),Vc,jc,Ug,ro=class extends T{constructor(){super(...arguments);m(this,jc);this.items=[];this._slotted=[];m(this,Vc)}connectedCallback(){super.connectedCallback(),a(this,jc,Ug).call(this),g(this,Vc,ar(this,()=>a(this,jc,Ug).call(this)))}disconnectedCallback(){super.disconnectedCallback(),i(this,Vc)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3336
3404
|
<ul part="tabs">${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3337
|
-
@click=${t=>{
|
|
3405
|
+
@click=${t=>{nr(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
3338
3406
|
<slot hidden></slot>
|
|
3339
|
-
</nav>`}};
|
|
3407
|
+
</nav>`}};Vc=new WeakMap,jc=new WeakSet,Ug=function(){this._slotted=vi(this)},ro.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0}},ro.styles=[E,w`
|
|
3340
3408
|
:host { display: block; }
|
|
3341
3409
|
ul {
|
|
3342
3410
|
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
@@ -3355,19 +3423,19 @@ ${t.label}</button>
|
|
|
3355
3423
|
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
3356
3424
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
3357
3425
|
|
|
3358
|
-
`];$("cm-link-tabs",
|
|
3426
|
+
`];$("cm-link-tabs",ro);var oT=_("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}"}),so=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),r=typeof this.reviews=="number"?this.t("reviews",{count:this.reviews}):"",s=t?this.formatNumber(this.rating,{minimumFractionDigits:1,maximumFractionDigits:1}):"";return c`<article part="card" aria-labelledby="name">
|
|
3359
3427
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
3360
3428
|
<div class="status"><slot name="status"></slot></div>
|
|
3361
3429
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
3362
3430
|
${this.developer?c`<p class="by">${this.t("developer",{developer:this.developer})}</p>`:h}
|
|
3363
3431
|
${t?c`<p class="rating"><cm-icon class="star" name="star" size="12"></cm-icon>
|
|
3364
|
-
<span aria-hidden="true">${
|
|
3365
|
-
${
|
|
3432
|
+
<span aria-hidden="true">${s}</span><span class="sr">${this.t("rating",{rating:s})}</span>
|
|
3433
|
+
${r?this.reviewsHref?c`<a href=${this.reviewsHref}>${r}</a>`:c`<span>${r}</span>`:h}</p>`:h}
|
|
3366
3434
|
${this.pricing?c`<p class="pricing">${this.pricing}</p>`:h}
|
|
3367
3435
|
${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}
|
|
3368
3436
|
<div class="actions"><slot name="actions"></slot>${this.href?c`<a class="details" part="details" href=${this.href}
|
|
3369
3437
|
aria-label=${this.t("detailsLabel",{name:this.name})}>${this.t("details")}</a>`:h}</div>
|
|
3370
|
-
</article>`}};
|
|
3438
|
+
</article>`}};so.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},so.styles=[E,w`
|
|
3371
3439
|
:host { display: block; container-type: inline-size; }
|
|
3372
3440
|
article {
|
|
3373
3441
|
position: relative; display: flex; flex-direction: column; gap: var(--cm-space-8); height: 100%; padding: var(--cm-space-20);
|
|
@@ -3404,21 +3472,21 @@ ${t.label}</button>
|
|
|
3404
3472
|
.actions { gap: var(--cm-space-8); }
|
|
3405
3473
|
.details { margin-inline-start: auto; }
|
|
3406
3474
|
}
|
|
3407
|
-
`];$("cm-app-card",
|
|
3475
|
+
`];$("cm-app-card",so);var Qm,By,ao=class extends ae{constructor(){super(...arguments);m(this,Qm);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">
|
|
3408
3476
|
${this.renderHeader()}
|
|
3409
3477
|
<div class="body" part="body"><slot></slot></div>
|
|
3410
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${
|
|
3411
|
-
</div>`)}};
|
|
3478
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${a(this,Qm,By)}></slot></footer>
|
|
3479
|
+
</div>`)}};Qm=new WeakSet,By=function(e){this._hasFooter=e.target.assignedElements().length>0},ao.properties={...ae.properties,size:{reflect:!0},_hasFooter:{state:!0}},ao.styles=[...ae.overlayStyles,w`
|
|
3412
3480
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
3413
3481
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
3414
3482
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
3415
3483
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
3416
3484
|
|
|
3417
|
-
`];$("cm-modal",
|
|
3485
|
+
`];$("cm-modal",ao);var ep,Fy,Ft=class extends ae{constructor(){super(...arguments);m(this,ep);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=${a(this,ep,Fy)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3418
3486
|
${this.renderHeader()}
|
|
3419
3487
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
3420
3488
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
3421
|
-
</div>`)}};
|
|
3489
|
+
</div>`)}};ep=new WeakSet,Fy=function(e){this._hasFooter=e.target.assignedElements().length>0},Ft.properties={...ae.properties,size:{reflect:!0},_hasFooter:{state:!0}},Ft.styles=[...ae.overlayStyles,w`
|
|
3422
3490
|
dialog {
|
|
3423
3491
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
3424
3492
|
}
|
|
@@ -3436,23 +3504,23 @@ ${t.label}</button>
|
|
|
3436
3504
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
3437
3505
|
|
|
3438
3506
|
}
|
|
3439
|
-
`];$("cm-side-panel",
|
|
3507
|
+
`];$("cm-side-panel",Ft);var kT=_("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),oo,tp,no=class extends Ft{constructor(){super(...arguments);this.search=!1;this.query="";m(this,oo,()=>{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,tp,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(s,l)=>{if(l==="")return;let d=e[s];e[s]=d===void 0?l:Array.isArray(d)?[...d,l]:[d,l]},r=this.form;if(r){for(let[s,l]of new FormData(r))typeof l=="string"&&t(s,l);return e}return this.querySelectorAll("[name]").forEach(s=>{let l=s.getAttribute("name");"checked"in s&&(s.type==="checkbox"||s.type==="radio"||s.localName.match(/^cm-(checkbox|radio|toggle)$/))?s.checked&&t(l,s.value||"on"):typeof s.value=="string"&&t(l,s.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}
|
|
3440
3508
|
placeholder=${this.searchPlaceholder}
|
|
3441
3509
|
@input=${e=>{this.query=e.target.value}}
|
|
3442
|
-
@cm-search=${e=>{e.stopPropagation(),
|
|
3443
|
-
<slot @submit=${e=>{e.preventDefault(),
|
|
3444
|
-
<cm-button part="apply" variant="primary" @click=${
|
|
3510
|
+
@cm-search=${e=>{e.stopPropagation(),i(this,oo).call(this)}}></cm-search>`:h}
|
|
3511
|
+
<slot @submit=${e=>{e.preventDefault(),i(this,oo).call(this)}}></slot>`}renderFooter(){return c`<cm-button part="reset" @click=${i(this,tp)}>${this.resetLabel}</cm-button>
|
|
3512
|
+
<cm-button part="apply" variant="primary" @click=${i(this,oo)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};oo=new WeakMap,tp=new WeakMap,no.properties={...Ft.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"}},no.styles=[...Ft.styles,w`
|
|
3445
3513
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
3446
3514
|
.foot { justify-content: center; }
|
|
3447
3515
|
::slotted(form) { display: grid; gap: var(--cm-space-12); }
|
|
3448
|
-
`];$("cm-filter-panel",
|
|
3516
|
+
`];$("cm-filter-panel",no);var LT=_("accountMenu",{trigger:"Account: {name}"}),lo=class extends Lt{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)}
|
|
3449
3517
|
aria-label=${this.t("trigger",{name:this.name})} ?disabled=${this.disabled} @click=${e} @keydown=${t}>
|
|
3450
|
-
<cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></button>`}headTemplate(){let e=(t,
|
|
3518
|
+
<cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></button>`}headTemplate(){let e=(t,r,s,l,d)=>{let p=c`${s}<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=${r} href=${t}>${p}</a>`:c`<div class="row" part=${r}>${p}</div>`};return c`<div class="acct">
|
|
3451
3519
|
${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)}
|
|
3452
3520
|
${this.orgName?c`<div class="split"></div>
|
|
3453
3521
|
${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)}
|
|
3454
3522
|
${this.plan?c`<div class="plan"><cm-icon name="check-circle" size="16"></cm-icon>${this.plan}</div>`:h}`:h}
|
|
3455
|
-
</div>`}};
|
|
3523
|
+
</div>`}};lo.properties={...Lt.properties,name:{},avatarSrc:{attribute:"avatar-src"},meta:{},profileHref:{attribute:"profile-href"},orgName:{attribute:"org-name"},orgMeta:{attribute:"org-meta"},orgHref:{attribute:"org-href"},plan:{}},lo.styles=[...Lt.styles,w`
|
|
3456
3524
|
/* The avatar button: 36px round with a ring (40 and a 44px hit area on touch screens). */
|
|
3457
3525
|
.trigger.account {
|
|
3458
3526
|
position: relative; width: var(--cm-control-height-md, 36px); height: var(--cm-control-height-md, 36px); min-height: 0; padding: 2px;
|
|
@@ -3485,8 +3553,8 @@ ${t.label}</button>
|
|
|
3485
3553
|
.plan cm-icon { color: var(--cm-text-success); }
|
|
3486
3554
|
.split { height: 0; margin: var(--cm-space-4) var(--cm-space-12); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
3487
3555
|
:host(:dir(rtl)) .chev { transform: scaleX(-1); }
|
|
3488
|
-
`];$("cm-account-menu",
|
|
3489
|
-
<line class="base" x1="0" y1=${
|
|
3556
|
+
`];$("cm-account-menu",lo);var HT=_("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"}),nw=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 r=Number(t);return Number.isFinite(r)?r:0})},ow=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())},co=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 r=e.reduce((u,b)=>u+b,0),s=Math.max(...e),l=e.indexOf(s),d={label:t,total:this.formatNumber(r),peak:this.formatNumber(s),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,r=100,s=32,l=2,d=Math.max(1,...e.map(f=>Math.max(0,f))),p=f=>s-Math.max(0,f)/d*(s-l),u=f=>this.labels?.[f]?`${this.labels[f]}: ${this.formatNumber(e[f])}`:"",b=h;if(t&&this.type==="line"){let f=t>1?r/(t-1):0,x=e.map((k,D)=>`${(t>1?D*f:r/2).toFixed(2)},${p(k).toFixed(2)}`).join(" "),y=x.split(" ").pop().split(",");b=Kt`<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=r/t,x=t>1?Math.min(f*.25,2):0,y=f-x;b=e.map((k,D)=>{let R=Math.max(k>0?1.5:0,s-p(k)),q=u(D);return Kt`<rect class=${D===t-1?"bar last":"bar"} x=${(D*f+x/2).toFixed(2)} y=${(s-R).toFixed(2)} width=${y.toFixed(2)} height=${R.toFixed(2)} rx="0.6">${q?Kt`<title>${q}</title>`:h}</rect>`})}return c`<svg part="chart" role="img" aria-label=${this.summary} viewBox="0 0 ${r} ${s}" preserveAspectRatio="none">
|
|
3557
|
+
<line class="base" x1="0" y1=${s} x2=${r} y2=${s}></line>${b}</svg>`}};co.properties={values:{converter:{fromAttribute:nw}},labels:{converter:{fromAttribute:ow}},label:{},type:{reflect:!0},tone:{reflect:!0}},co.styles=[E,w`
|
|
3490
3558
|
:host { display: block; width: 100%; max-width: var(--cm-sparkline-width, none); height: var(--cm-sparkline-height, 32px); color: var(--cm-icon-default); }
|
|
3491
3559
|
:host([tone='information']) { color: var(--cm-text-information); }
|
|
3492
3560
|
:host([tone='success']) { color: var(--cm-text-success); }
|
|
@@ -3499,17 +3567,17 @@ ${t.label}</button>
|
|
|
3499
3567
|
.line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3500
3568
|
.dot { stroke: var(--cm-text-default); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3501
3569
|
:host([tone='information']) .dot, :host([tone='success']) .dot { stroke: currentColor; }
|
|
3502
|
-
`];$("cm-sparkline",
|
|
3570
|
+
`];$("cm-sparkline",co);var Uc,bs,Kg,Vy,ho=class extends ae{constructor(){super(...arguments);m(this,bs);this.heading="";this.items=[];this._slotted=[];m(this,Uc)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=Go(this),g(this,Uc,Cd(this,()=>{this._slotted=Go(this)}))}disconnectedCallback(){super.disconnectedCallback(),i(this,Uc)?.disconnect()}render(){let e=this.sheetItems.filter(r=>!r.divider&&!r.heading),t=e.some(r=>r.icon);return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3503
3571
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
3504
3572
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
3505
3573
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
3506
3574
|
<div class="content">
|
|
3507
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(
|
|
3575
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(r=>c`<li>${a(this,bs,Vy).call(this,r)}</li>`)}</ul>`:h}
|
|
3508
3576
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
3509
3577
|
</div>
|
|
3510
|
-
</div>`)}};
|
|
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
|
|
3512
|
-
@click=${a
|
|
3578
|
+
</div>`)}};Uc=new WeakMap,bs=new WeakSet,Kg=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")},Vy=function(e){let t=`row${e.critical?" critical":""}`,r=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
3579
|
+
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${s=>a(this,bs,Kg).call(this,s,e)}>${r}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
3580
|
+
@click=${s=>a(this,bs,Kg).call(this,s,e)}>${r}</button>`},ho.properties={...ae.properties,items:{type:Array},_slotted:{state:!0}},ho.styles=[...ae.overlayStyles,w`
|
|
3513
3581
|
dialog {
|
|
3514
3582
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: var(--cm-space-24);
|
|
3515
3583
|
}
|
|
@@ -3543,17 +3611,17 @@ ${t.label}</button>
|
|
|
3543
3611
|
}
|
|
3544
3612
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
3545
3613
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3546
|
-
`];$("cm-bottom-sheet",
|
|
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(
|
|
3614
|
+
`];$("cm-bottom-sheet",ho);var WT=_("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),lw={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},mo=class extends C{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};mo.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},mo.styles=w`:host { display: none; }`;$("cm-notification-item",mo);var uo,Xe,Wg,Gg,jy,Uy,Ky,po=class extends ae{constructor(){super(...arguments);m(this,Xe);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;m(this,uo)}connectedCallback(){super.connectedCallback(),a(this,Xe,Wg).call(this),g(this,uo,new MutationObserver(()=>a(this,Xe,Wg).call(this))),i(this,uo).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),i(this,uo)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications,t=this.markAllRead&&!this.loading&&e.some(s=>s.unread)?c`<button type="button" class="mark" part="mark-all-read" @click=${a(this,Xe,Uy)}>${this.markAllLabel}</button>`:h,r=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
3615
|
+
<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(s=>c`<li>${a(this,Xe,jy).call(this,s)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3548
3616
|
${this.renderHeader(t)}
|
|
3549
|
-
${
|
|
3617
|
+
${r}
|
|
3550
3618
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3551
3619
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
3552
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${
|
|
3620
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${a(this,Xe,Ky)}></slot></div>
|
|
3553
3621
|
<slot hidden></slot>
|
|
3554
|
-
</div>`)}};
|
|
3555
|
-
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${
|
|
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=>
|
|
3622
|
+
</div>`)}};uo=new WeakMap,Xe=new WeakSet,Wg=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=r=>e.getAttribute(r)||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")},jy=function(e){let t=e.tone??"information",r=e.description?c`<span class="title">${e.label}</span><span class="vh">, </span><span class="desc">${e.description}</span>`:e.label,s=c`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${e.icon||lw[t]||"bell"} size="14"></cm-icon></span>
|
|
3623
|
+
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${r}</span>
|
|
3624
|
+
${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=>a(this,Xe,Gg).call(this,d,e)}>${s}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>a(this,Xe,Gg).call(this,d,e)}>${s}</button>`},Uy=async function(e){let t=e.currentTarget;this.dispatchEvent(new CustomEvent("cm-mark-all-read",{bubbles:!0,composed:!0})),await new Promise(r=>setTimeout(r)),await this.updateComplete,!t.isConnected&&this.open&&this.renderRoot.querySelector(".panel")?.focus()},Ky=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},po.properties={...ae.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}},po.styles=[...ae.overlayStyles,w`
|
|
3557
3625
|
dialog {
|
|
3558
3626
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
3559
3627
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3603,15 +3671,15 @@ ${t.label}</button>
|
|
|
3603
3671
|
@media (max-width: 599px) {
|
|
3604
3672
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3605
3673
|
}
|
|
3606
|
-
`];$("cm-notification-panel",
|
|
3674
|
+
`];$("cm-notification-panel",po);var QT=_("toastRegion",{label:"Notifications"}),e_=_("toast",{undo:"Undo",shortcut:"Press F6 to reach it."}),Wy=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o&&o!==document.body?o:null},Yg=(o,n)=>{for(let e=n;e;e=e.parentNode??e.host??null)if(e===o)return!0;return!1},cw=2e3,Gy=1e4,Yy=150,Kc,zt,xi,Wc,vo,yo,vs,or,ys,xe,ip,Xy,go,Xg,Gc,Yc,Xc,Jc,Jy,fo=class extends T{constructor(){super(...arguments);m(this,xe);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;m(this,Kc);m(this,zt);m(this,xi,0);m(this,Wc,0);m(this,vo,!1);m(this,yo,!1);m(this,vs);m(this,or);m(this,ys);m(this,Gc,()=>{g(this,vo,!0),a(this,xe,Xg).call(this)});m(this,Yc,()=>{g(this,vo,!1),a(this,xe,go).call(this)});m(this,Xc,()=>{g(this,yo,!0),a(this,xe,Xg).call(this)});m(this,Jc,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(g(this,yo,!1),a(this,xe,go).call(this))})}get closed(){if(!i(this,vs)){if(!this.open&&i(this,ys))return Promise.resolve(i(this,ys));g(this,vs,new Promise(e=>{g(this,or,e)}))}return i(this,vs)}get effectiveDuration(){let e=this.duration??(this.actionLabel?Gy:5e3);return Math.min(Gy,Math.max(cw,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&g(this,Kc,setTimeout(()=>{this._primed=!0},Yy)),this.addEventListener("pointerenter",i(this,Gc)),this.addEventListener("pointerleave",i(this,Yc)),this.addEventListener("focusin",i(this,Xc)),this.addEventListener("focusout",i(this,Jc))}disconnectedCallback(){super.disconnectedCallback(),this.open&&i(this,or)&&queueMicrotask(()=>{!this.isConnected&&this.open&&a(this,xe,ip).call(this,"removed")}),clearTimeout(i(this,zt)),clearTimeout(i(this,Kc)),this.removeEventListener("pointerenter",i(this,Gc)),this.removeEventListener("pointerleave",i(this,Yc)),this.removeEventListener("focusin",i(this,Xc)),this.removeEventListener("focusout",i(this,Jc))}updated(e){e.has("open")&&e.get("open")!==void 0&&(this.open?g(this,ys,void 0):i(this,or)&&a(this,xe,ip).call(this,"close")),(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(i(this,zt)),this.open&&(this._inRegion||this._primed)&&(g(this,xi,this.effectiveDuration),a(this,xe,go).call(this)))}show(){this.open?(g(this,xi,this.effectiveDuration),a(this,xe,go).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(i(this,zt)),this.open=!1,a(this,xe,ip).call(this,e),!0):(e==="timeout"&&(g(this,xi,this.effectiveDuration),a(this,xe,go).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3607
3675
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3608
3676
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3609
|
-
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${
|
|
3677
|
+
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${a(this,xe,Jy)}>${this.actionLabel}</button>`:h}
|
|
3610
3678
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3611
3679
|
<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>
|
|
3612
3680
|
</button>
|
|
3613
3681
|
${this.actionLabel&&this._inRegion&&this.t("shortcut")?c`<span class="hint">${this.t("shortcut")}</span>`:h}
|
|
3614
|
-
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};
|
|
3682
|
+
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Kc=new WeakMap,zt=new WeakMap,xi=new WeakMap,Wc=new WeakMap,vo=new WeakMap,yo=new WeakMap,vs=new WeakMap,or=new WeakMap,ys=new WeakMap,xe=new WeakSet,ip=function(e){g(this,ys,e);let t=i(this,or);g(this,vs,g(this,or,void 0)),t?.(e)},Xy=function(){return i(this,vo)||i(this,yo)},go=function(){clearTimeout(i(this,zt)),!(!this.open||i(this,xe,Xy))&&(g(this,Wc,Date.now()),g(this,zt,setTimeout(()=>this.dismiss("timeout"),i(this,xi))))},Xg=function(){i(this,zt)!==void 0&&(clearTimeout(i(this,zt)),g(this,zt,void 0),g(this,xi,Math.max(1e3,i(this,xi)-(Date.now()-i(this,Wc)))))},Gc=new WeakMap,Yc=new WeakMap,Xc=new WeakMap,Jc=new WeakMap,Jy=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},fo.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},fo.styles=[E,w`
|
|
3615
3683
|
:host { display: block; pointer-events: auto; }
|
|
3616
3684
|
:host(:not([open])) { display: none; }
|
|
3617
3685
|
.toast {
|
|
@@ -3643,13 +3711,13 @@ ${t.label}</button>
|
|
|
3643
3711
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
3644
3712
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
3645
3713
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
3646
|
-
`];$("cm-toast",
|
|
3714
|
+
`];$("cm-toast",fo);var xs,Zc,Qc,ed,td,id,xo,rp,bo=class extends T{constructor(){super(...arguments);m(this,xo);this.max=3;m(this,xs,null);m(this,Zc,!1);m(this,Qc,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let r=t.matches(":focus-within");t.remove(),r&&a(this,xo,rp).call(this)})});m(this,ed,e=>{let t=e.relatedTarget;t&&!Yg(this,t)&&g(this,xs,t)});m(this,td,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(r=>r.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});m(this,id,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?a(this,xo,rp).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,Zc,!0)),this.addEventListener("cm-dismiss",i(this,Qc)),this.addEventListener("focusin",i(this,ed)),this.addEventListener("keydown",i(this,td)),document.addEventListener("keydown",i(this,id))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",i(this,Qc)),this.removeEventListener("focusin",i(this,ed)),this.removeEventListener("keydown",i(this,td)),document.removeEventListener("keydown",i(this,id))}updated(){i(this,Zc)&&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],r=t?.shadowRoot?.querySelector(".action")??t?.shadowRoot?.querySelector(".close");if(!r)return!1;let s=Wy();return s&&!Yg(this,s)&&g(this,xs,s),r.focus(),!0}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")],r=t.slice(0,Math.max(0,t.length-Math.max(1,this.max))),s=r.some(l=>l.matches(":focus-within"));return r.forEach(l=>l.remove()),s&&a(this,xo,rp).call(this),e}render(){return c`<slot></slot>`}};xs=new WeakMap,Zc=new WeakMap,Qc=new WeakMap,ed=new WeakMap,td=new WeakMap,id=new WeakMap,xo=new WeakSet,rp=function(){let e=i(this,xs);return g(this,xs,null),e?.isConnected?(e.focus(),Yg(e,Wy())||e.shadowRoot?.querySelector("button, a[href], input, select, textarea, [tabindex]")?.focus(),!0):!1},bo.properties={max:{type:Number}},bo.styles=[E,w`
|
|
3647
3715
|
:host {
|
|
3648
3716
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
3649
3717
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
3650
3718
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
3651
3719
|
}
|
|
3652
|
-
`];$("cm-toast-region",
|
|
3720
|
+
`];$("cm-toast-region",bo);function Zy(o,n={}){let e=n.root??document.body,t=e.querySelector(":scope > cm-toast-region"),r=!t;t||(t=document.createElement("cm-toast-region"),e.append(t));let s=document.createElement("cm-toast");if(s.message=String(o),n.tone&&(s.tone=n.tone),n.duration!==void 0&&(s.duration=n.duration),n.action){s.actionLabel=n.action.label;let l=n.action.onAction;s.addEventListener("cm-action",()=>l())}if(r){let l=t;return setTimeout(()=>l.add(s),Yy),s}return t.add(s)}async function dw(o,n,e){await o();let{message:t,undoLabel:r,...s}=e,l=r??Ed("toast","undo",void 0,s.root??document.body),d=await Zy(t,{...s,action:{label:l,onAction:()=>{}}}).closed;return d==="action"&&await n(),d}var n_=_("progressBar",{inProgress:"In progress"}),sp,wo=class extends T{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";m(this,sp,H("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=`${i(this,sp)}-label`;return c`
|
|
3653
3721
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
3654
3722
|
<span id=${t} part="label">${this.label}</span>
|
|
3655
3723
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -3659,7 +3727,7 @@ ${t.label}</button>
|
|
|
3659
3727
|
aria-valuenow=${e===null?h:Math.round(e)}
|
|
3660
3728
|
aria-valuetext=${e===null?this.t("inProgress"):this.formatNumber(Math.round(e)/100,{style:"percent"})}>
|
|
3661
3729
|
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
3662
|
-
</div>`}};
|
|
3730
|
+
</div>`}};sp=new WeakMap,wo.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},wo.styles=[E,w`
|
|
3663
3731
|
:host { display: block; }
|
|
3664
3732
|
.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); }
|
|
3665
3733
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
@@ -3677,7 +3745,7 @@ ${t.label}</button>
|
|
|
3677
3745
|
.fill { transition: none; }
|
|
3678
3746
|
.indeterminate .fill { animation-duration: 4s; }
|
|
3679
3747
|
}
|
|
3680
|
-
`];$("cm-progress-bar",
|
|
3748
|
+
`];$("cm-progress-bar",wo);var $o=class extends C{constructor(){super(...arguments);this.tone="neutral"}render(){return c`<span part="badge"><slot></slot></span>`}};$o.properties={tone:{reflect:!0}},$o.styles=[E,w`
|
|
3681
3749
|
:host { display: inline-flex; vertical-align: middle; }
|
|
3682
3750
|
span {
|
|
3683
3751
|
display: inline-flex; align-items: center; box-sizing: border-box; height: 24px; padding: 0 var(--cm-space-8); white-space: nowrap;
|
|
@@ -3694,12 +3762,12 @@ ${t.label}</button>
|
|
|
3694
3762
|
: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); }
|
|
3695
3763
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
3696
3764
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
3697
|
-
`];$("cm-badge"
|
|
3698
|
-
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${
|
|
3699
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!
|
|
3765
|
+
`];$("cm-badge",$o);var Eo,Mo,Ct,Qy,ex,rd,tx,ap,Jg,ko=class extends C{constructor(){super(...arguments);m(this,Ct);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,Mo,!1);m(this,rd,!1);m(this,ap,()=>{this.href||this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))})}willUpdate(){this.selected&&g(this,rd,!0)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=i(this,Ct,tx),r=t?a(this,Ct,Jg).call(this,this.heading):this.heading,s=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${r}</span><span class="adornment" ?hidden=${!i(this,Eo)}><slot name="title-adornment" @slotchange=${a(this,Ct,Qy)}></slot></span></div>`:h;return c`<section part="card" aria-label=${!t&&this.heading||h}>${t&&!this.heading?a(this,Ct,Jg).call(this,h):h}
|
|
3766
|
+
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${s}${this.description?c`<p class="desc">${this.description}</p>`:h}</div>
|
|
3767
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!i(this,Mo)}><div class="actions"><slot name="actions" @slotchange=${a(this,Ct,ex)}></slot></div></div>`}
|
|
3700
3768
|
<slot></slot>
|
|
3701
|
-
</section>`}};
|
|
3702
|
-
aria-current=${this.selected?"true":h} aria-label=${
|
|
3769
|
+
</section>`}};Eo=new WeakMap,Mo=new WeakMap,Ct=new WeakSet,Qy=function(e){let t=e.target.assignedNodes().some(r=>r.nodeType===Node.ELEMENT_NODE||r.textContent?.trim());t!==i(this,Eo)&&(g(this,Eo,t),this.requestUpdate())},ex=function(e){let t=e.target.assignedNodes().some(r=>r.nodeType===Node.ELEMENT_NODE||r.textContent?.trim());t!==i(this,Mo)&&(g(this,Mo,t),this.requestUpdate())},rd=new WeakMap,tx=function(){return String(this.variant||"").split(/\s+/).includes("interactive")},ap=new WeakMap,Jg=function(e){let t=e===h?"hit cover":"hit",r=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}
|
|
3770
|
+
aria-current=${this.selected?"true":h} aria-label=${r}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":i(this,rd)?"false":h} aria-label=${r} @click=${i(this,ap)}>${e}</button>`},ko.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:{}},ko.styles=[E,w`
|
|
3703
3771
|
/* Owner standard (1.6): 24px padding and a 16px gap under the header; compact 16px and 12px; 16px on phones. */
|
|
3704
3772
|
:host { display: block; --_pad: var(--cm-space-24); --_gap: var(--cm-space-16); }
|
|
3705
3773
|
:host([variant~='compact']) { --_pad: var(--cm-space-16); --_gap: var(--cm-space-12); }
|
|
@@ -3751,8 +3819,8 @@ ${t.label}</button>
|
|
|
3751
3819
|
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
|
|
3752
3820
|
.bare[hidden] { display: none; }
|
|
3753
3821
|
:host([flush]) .bare { padding: var(--_pad) var(--_pad) 0; margin-bottom: var(--cm-space-8); }
|
|
3754
|
-
`];$("cm-card",
|
|
3755
|
-
`))}var
|
|
3822
|
+
`];$("cm-card",ko);var hw=["0","4","8","12","16","20","24","32","40","48","64"],mw={10:"8",15:"16",22:"24",30:"32"};function To(o,n){let e=(t,r)=>`:host([${o}='${t}']) { ${n}: ${r==="0"?"0px":`var(--cm-space-${r})`}; }`;return md([...hw.map(t=>e(t,t)),...Object.entries(mw).map(([t,r])=>e(t,r))].join(`
|
|
3823
|
+
`))}var _o=class extends C{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return c`<slot></slot>`}};_o.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},_o.styles=[E,w`
|
|
3756
3824
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
3757
3825
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
3758
3826
|
:host([wrap]) { flex-wrap: wrap; }
|
|
@@ -3765,13 +3833,13 @@ ${t.label}</button>
|
|
|
3765
3833
|
:host([justify='center']) { justify-content: center; }
|
|
3766
3834
|
:host([justify='end']) { justify-content: flex-end; }
|
|
3767
3835
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
3768
|
-
`,
|
|
3836
|
+
`,To("gap","gap")];$("cm-stack",_o);var ix="important",pw=" !"+ix,rx=Os(class extends Mi{constructor(o){if(super(o),o.type!==xt.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 r=n[t];if(r!=null){this.ft.add(t);let s=typeof r=="string"&&r.endsWith(pw);t.includes("-")||s?e.setProperty(t,s?r.slice(0,-11):r,s?ix:""):e[t]=r}}return Le}});var zo=class extends C{constructor(){super(...arguments);this.columns=2;this.gap="20"}render(){let e=Math.max(1,Math.floor(Number(this.columns)||1)),t=this.minColumnWidth?.trim(),r=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=${rx({gridTemplateColumns:r})}><slot></slot></div>`}};zo.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},zo.styles=[E,w`
|
|
3769
3837
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
3770
3838
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
3771
3839
|
@container cm-grid (max-width: 640px) {
|
|
3772
3840
|
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
3773
3841
|
}
|
|
3774
|
-
`,
|
|
3842
|
+
`,To("gap","--_gap")];$("cm-grid",zo);var lp,ws,$s,ad,ue,np,Zg,sd,op,Qg,Co=class extends C{constructor(){super(...arguments);m(this,ue);this.gap="24";this.variant="default";this.asidePosition="above";this.stickyAside=!1;m(this,lp,this.attachInternals());m(this,ws);m(this,$s,[]);m(this,ad,()=>a(this,ue,op).call(this))}disconnectedCallback(){super.disconnectedCallback(),a(this,ue,Zg).call(this)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&a(this,ue,sd).call(this)}updated(e){(e.has("stickyAside")||e.has("variant"))&&a(this,ue,sd).call(this)}get asideSticks(){let e=a(this,ue,np).call(this)[0];return!!e&&getComputedStyle(e).position==="sticky"}render(){return c`<div class="layout" part="layout"><slot @slotchange=${()=>{this.stickyAside&&a(this,ue,sd).call(this)}}></slot></div>`}};lp=new WeakMap,ws=new WeakMap,$s=new WeakMap,ad=new WeakMap,ue=new WeakSet,np=function(){return[...this.children].filter(e=>e.getAttribute("variant")==="aside")},Zg=function(){i(this,ws)?.disconnect(),g(this,ws,void 0),g(this,$s,[]),window.removeEventListener("resize",i(this,ad)),a(this,ue,Qg).call(this,!1)},sd=function(){a(this,ue,Zg).call(this),!(!this.stickyAside||this.variant!=="record"||!this.isConnected)&&(g(this,ws,new ResizeObserver(()=>a(this,ue,op).call(this))),g(this,$s,[this,...a(this,ue,np).call(this)]),i(this,$s).forEach(e=>i(this,ws).observe(e)),window.addEventListener("resize",i(this,ad)),a(this,ue,op).call(this))},op=function(){let e=a(this,ue,np).call(this);if(e.some(r=>!i(this,$s).includes(r))){a(this,ue,sd).call(this);return}let t=e.length>0&&e.every(r=>{let s=parseFloat(getComputedStyle(r).insetBlockStart)||0;return r.getBoundingClientRect().height+s<=window.innerHeight});a(this,ue,Qg).call(this,t)},Qg=function(e){let t=i(this,lp).states;if(t)try{e?t.add("aside-fits"):t.delete("aside-fits")}catch{}},Co.properties={gap:{reflect:!0},variant:{reflect:!0},asidePosition:{attribute:"aside-position",reflect:!0},stickyAside:{type:Boolean,attribute:"sticky-aside",reflect:!0}},Co.styles=[E,w`
|
|
3775
3843
|
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-24); }
|
|
3776
3844
|
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
3777
3845
|
@container cm-layout (max-width: 767px) {
|
|
@@ -3815,9 +3883,9 @@ ${t.label}</button>
|
|
|
3815
3883
|
/* Read back by #measure(); only takes effect once the aside is sticky. --_header: cm-app-frame's header height. */
|
|
3816
3884
|
inset-block-start: var(--cm-layout-sticky-top, calc(var(--_header, 0px) + var(--cm-space-24)));
|
|
3817
3885
|
}
|
|
3818
|
-
`,
|
|
3886
|
+
`,To("gap","--_gap")];var Lo=class extends C{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};Lo.properties={variant:{reflect:!0}},Lo.styles=[E,w`
|
|
3819
3887
|
:host { display: flex; flex-direction: column; gap: var(--_cm-section-gap, var(--cm-space-24)); min-inline-size: 0; }
|
|
3820
|
-
`];$("cm-layout",
|
|
3888
|
+
`];$("cm-layout",Co);$("cm-layout-section",Lo);var ef=1024,uw=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},Es,Do,Je,tf,ks,sx,nd,od,So=class extends C{constructor(){super(...arguments);m(this,Je);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;m(this,Es);m(this,Do,null);m(this,nd,e=>{if(!this.menuItem)return;let t=a(this,Je,sx).call(this,e),r=e.detail?.value;t==="bottom-navigation"&&r===this.menuItem?a(this,Je,ks).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&a(this,Je,ks).call(this,!1,!1)});m(this,od,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),a(this,Je,ks).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",i(this,nd)),this.addEventListener("keydown",i(this,od));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=ef)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",i(this,nd)),this.removeEventListener("keydown",i(this,od)),i(this,Es)?.disconnect(),g(this,Es,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;g(this,Es,new ResizeObserver(()=>{a(this,Je,tf).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=ef!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=ef}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>i(this,Es).observe(t))}updated(e){e.has("_wide")&&a(this,Je,tf).call(this)}openMenu(){a(this,Je,ks).call(this,!0)}closeMenu(){a(this,Je,ks).call(this,!1)}toggleMenu(){a(this,Je,ks).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">
|
|
3821
3889
|
<div class="probe"></div>
|
|
3822
3890
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
3823
3891
|
<div class="body">
|
|
@@ -3826,7 +3894,7 @@ ${t.label}</button>
|
|
|
3826
3894
|
</div>
|
|
3827
3895
|
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
3828
3896
|
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
3829
|
-
</div>`}};
|
|
3897
|
+
</div>`}};Es=new WeakMap,Do=new WeakMap,Je=new WeakSet,tf=function(){let e=this.renderRoot.querySelector(".frame");if(!e)return;let t=r=>Math.round(this.renderRoot.querySelector(r)?.getBoundingClientRect().height??0);e.style.setProperty("--_header",`${t(".header")}px`),e.style.setProperty("--_bottom",`${this._wide?0:t(".bottom")}px`)},ks=function(e,t=!0){e!==this.menuOpen&&(e&&g(this,Do,uw()),this.menuOpen=e,this.dispatchEvent(new CustomEvent("cm-menu-toggle",{bubbles:!0,composed:!0,detail:{open:e}})),this.updateComplete.then(()=>{if(e){let r=this.querySelector(':scope > [slot="mobile-menu"]');(r?.shadowRoot??r)?.querySelector("a[href], button")?.focus()}else t&&(i(this,Do)?.focus(),g(this,Do,null))}))},sx=function(e){return e.composedPath().find(r=>r.parentElement===this)?.getAttribute("slot")??""},nd=new WeakMap,od=new WeakMap,So.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},panel:{type:Boolean,reflect:!0},_wide:{state:!0}},So.styles=[E,w`
|
|
3830
3898
|
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
3831
3899
|
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
3832
3900
|
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
@@ -3857,7 +3925,7 @@ ${t.label}</button>
|
|
|
3857
3925
|
}
|
|
3858
3926
|
.probe { block-size: 0; }
|
|
3859
3927
|
[hidden] { display: none !important; }
|
|
3860
|
-
`];$("cm-app-frame",
|
|
3928
|
+
`];$("cm-app-frame",So);var Ao=class extends C{constructor(){super(...arguments);this.width="";this.fullWidth=!1;this.narrow=!1}render(){return c`<slot name="header"></slot><div class="content" part="content"><slot></slot></div><slot name="footer"></slot>`}};Ao.properties={width:{reflect:!0},fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},Ao.styles=[E,w`
|
|
3861
3929
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-page-background, var(--cm-bg-page)); min-block-size: 100%; }
|
|
3862
3930
|
.content {
|
|
3863
3931
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
@@ -3869,16 +3937,16 @@ ${t.label}</button>
|
|
|
3869
3937
|
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
3870
3938
|
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
3871
3939
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
3872
|
-
`];$("cm-page",
|
|
3940
|
+
`];$("cm-page",Ao);var Ho,ax,nx,Ro=class extends T{constructor(){super(...arguments);m(this,Ho);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?Kt`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:Kt`<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}>
|
|
3873
3941
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
3874
3942
|
<div class="body">
|
|
3875
3943
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
3876
3944
|
<div><slot></slot></div>
|
|
3877
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${
|
|
3945
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${a(this,Ho,ax)}></slot></div>
|
|
3878
3946
|
</div>
|
|
3879
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${
|
|
3947
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${a(this,Ho,nx)}>
|
|
3880
3948
|
<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}
|
|
3881
|
-
</div>`}};
|
|
3949
|
+
</div>`}};Ho=new WeakSet,ax=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},nx=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},Ro.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},Ro.styles=[E,w`
|
|
3882
3950
|
:host { display: block; }
|
|
3883
3951
|
.banner {
|
|
3884
3952
|
display: flex; gap: var(--cm-space-12); align-items: flex-start;
|
|
@@ -3902,10 +3970,10 @@ ${t.label}</button>
|
|
|
3902
3970
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
3903
3971
|
}
|
|
3904
3972
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3905
|
-
`];$("cm-banner",
|
|
3973
|
+
`];$("cm-banner",Ro);var Q_=_("thumbnail",{noImage:"{alt} (no image)"}),No=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}
|
|
3906
3974
|
@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}
|
|
3907
3975
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):h} aria-hidden=${this.alt?h:"true"}>
|
|
3908
|
-
<cm-icon name="box" size=${e}></cm-icon></span>`}};
|
|
3976
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};No.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},No.styles=[E,w`
|
|
3909
3977
|
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3910
3978
|
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
3911
3979
|
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
@@ -3915,7 +3983,7 @@ ${t.label}</button>
|
|
|
3915
3983
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
3916
3984
|
}
|
|
3917
3985
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
3918
|
-
`];$("cm-thumbnail",
|
|
3986
|
+
`];$("cm-thumbnail",No);export{ls as Announcer,Ga as CmAccordion,lo as CmAccountMenu,ja as CmActionBar,Lt as CmActionMenu,so as CmAppCard,So as CmAppFrame,Yn as CmAvatar,$o as CmBadge,Ro as CmBanner,Dn as CmBoard,cs as CmBoardCard,ds as CmBoardColumn,eo as CmBottomNavigation,ho as CmBottomSheet,pr as CmButton,qs as CmButtonGroup,qn as CmCalendar,Pn as CmCalendarEvent,ko as CmCard,Ci as CmCheckbox,Ui as CmColorField,Hi as CmCombobox,la as CmCommandPalette,Za as CmComment,Qa as CmCommentBox,yn as CmDataTable,qi as CmDatePicker,Bi as CmDateRangePicker,Ya as CmEmptyState,ji as CmFileUpload,no as CmFilterPanel,io as CmFlashOfferBar,Hr as CmGlobalSearch,zo as CmGrid,Jn as CmHeaderBar,zs as CmIcon,Wa as CmInfoItem,Ka as CmInfoPanel,Co as CmLayout,Lo as CmLayoutSection,ro as CmLinkTabs,T as CmLocalizedElement,Cs as CmMenuItem,Kn as CmMetric,to as CmMobileMenu,ao as CmModal,Wn as CmNavItem,Ln as CmNestedItem,Cn as CmNestedList,mo as CmNotificationItem,po as CmNotificationPanel,It as CmOptionGroup,Ao as CmPage,Va as CmPageHeader,dn as CmPagination,wo as CmProgressBar,Er as CmRadio,Mr as CmRadioGroup,us as CmReportTile,Un as CmReportTiles,Tn as CmResourceItem,_n as CmResourceList,Ua as CmSaveBar,Ri as CmSearch,Fa as CmSegmentedControl,Ai as CmSelect,Gn as CmSideNavigation,Ft as CmSidePanel,Ki as CmSignatureField,Xa as CmSkeleton,Ja as CmSkeletonDisplay,ln as CmSmartTip,cn as CmSmartTips,co as CmSparkline,As as CmSpinner,_o as CmStack,mn as CmStatusTabs,un as CmTableHeader,Sr as CmTag,zi as CmTextField,No as CmThumbnail,Vi as CmTimePicker,Qr as CmTimeline,nn as CmTimelineItem,fo as CmToast,bo as CmToastRegion,Li as CmToggle,en as CmTooltip,os as MoveModel,ib as commandMatches,$x as configure,_ as defineStrings,Mf as directionalIcons,de as formatDate,kf as formatMessage,kp as formatNumber,xx as getDefaultStrings,Ny as initials,$l as isApplePlatform,jv as listNavigation,Ko as localeFor,jp as matchesShortcut,mi as normalizeHex,kd as pluralCategory,kx as resetStrings,nu as resolvePreset,wx as setStrings,vh as shortcutKeys,Zy as showToast,Ed as translate,dw as undoable};
|
|
3919
3987
|
/*! Bundled license information:
|
|
3920
3988
|
|
|
3921
3989
|
@lit/reactive-element/css-tag.js:
|