@commmerce/ui 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +511 -467
- package/dist/components/account-menu.d.ts +118 -0
- package/dist/components/account-menu.js +114 -0
- package/dist/components/action-menu.d.ts +4 -0
- package/dist/components/action-menu.js +67 -5
- package/dist/components/button.js +1 -1
- package/dist/components/header-bar.d.ts +2 -1
- package/dist/components/header-bar.js +4 -2
- package/dist/custom-elements.json +1215 -1
- 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 Ou=o=>{throw TypeError(o)};var Yh=(o,n,e)=>n.has(o)||Ou("Cannot "+e);var r=(o,n,e)=>(Yh(o,n,"read from private field"),e?e.call(o):n.get(o)),p=(o,n,e)=>n.has(o)?Ou("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),g=(o,n,e,t)=>(Yh(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),s=(o,n,e)=>(Yh(o,n,"access private method"),e);var tc=globalThis,ic=tc.ShadowRoot&&(tc.ShadyCSS===void 0||tc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Xh=Symbol(),qu=new WeakMap,Ln=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==Xh)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(ic&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=qu.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&qu.set(e,n))}return n}toString(){return this.cssText}},rc=o=>new Ln(typeof o=="string"?o:o+"",void 0,Xh),x=(o,...n)=>{let e=o.length===1?o[0]:n.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[a+1],o[0]);return new Ln(e,o,Xh)},Bu=(o,n)=>{if(ic)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=tc.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Jh=ic?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return rc(e)})(o):o;var{is:Hv,defineProperty:Nv,getOwnPropertyDescriptor:Iv,getOwnPropertyNames:Pv,getOwnPropertySymbols:Ov,getPrototypeOf:qv}=Object,ac=globalThis,Fu=ac.trustedTypes,Bv=Fu?Fu.emptyScript:"",Fv=ac.reactiveElementPolyfillSupport,Dn=(o,n)=>o,Zh={toAttribute(o,n){switch(n){case Boolean:o=o?Bv: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}},Uu=(o,n)=>!Hv(o,n),ju={attribute:!0,type:String,converter:Zh,reflect:!1,useDefault:!1,hasChanged:Uu};Symbol.metadata??=Symbol("metadata"),ac.litPropertyMetadata??=new WeakMap;var Ct=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=ju){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(n)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(n,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(n,t,e);i!==void 0&&Nv(this.prototype,n,i)}}static getPropertyDescriptor(n,e,t){let{get:i,set:a}=Iv(this.prototype,n)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let d=i?.call(this);a?.call(this,l),this.requestUpdate(n,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(n){return this.elementProperties.get(n)??ju}static _$Ei(){if(this.hasOwnProperty(Dn("elementProperties")))return;let n=qv(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(Dn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Dn("properties"))){let e=this.properties,t=[...Pv(e),...Ov(e)];for(let i of t)this.createProperty(i,e[i])}let n=this[Symbol.metadata];if(n!==null){let e=litPropertyMetadata.get(n);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(n){let e=[];if(Array.isArray(n)){let t=new Set(n.flat(1/0).reverse());for(let i of t)e.unshift(Jh(i))}else n!==void 0&&e.push(Jh(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 Bu(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(n=>n.hostConnected?.())}enableUpdating(n){}disconnectedCallback(){this._$EO?.forEach(n=>n.hostDisconnected?.())}attributeChangedCallback(n,e,t){this._$AK(n,t)}_$ET(n,e){let t=this.constructor.elementProperties.get(n),i=this.constructor._$Eu(n,t);if(i!==void 0&&t.reflect===!0){let a=(t.converter?.toAttribute!==void 0?t.converter:Zh).toAttribute(e,t.type);this._$Em=n,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(n,e){let t=this.constructor,i=t._$Eh.get(n);if(i!==void 0&&this._$Em!==i){let a=t.getPropertyOptions(i),l=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Zh;this._$Em=i;let d=l.fromAttribute(e,a.type);this[i]=d??this._$Ej?.get(i)??d,this._$Em=null}}requestUpdate(n,e,t,i=!1,a){if(n!==void 0){let l=this.constructor;if(i===!1&&(a=this[n]),t??=l.getPropertyOptions(n),!((t.hasChanged??Uu)(a,e)||t.useDefault&&t.reflect&&a===this._$Ej?.get(n)&&!this.hasAttribute(l._$Eu(n,t))))return;this.C(n,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(n,e,{useDefault:t,reflect:i,wrapped:a},l){t&&!(this._$Ej??=new Map).has(n)&&(this._$Ej.set(n,l??e??this[n]),a!==!0||l!==void 0)||(this._$AL.has(n)||(this.hasUpdated||t||(e=void 0),this._$AL.set(n,e)),i===!0&&this._$Em!==n&&(this._$Eq??=new Set).add(n))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let n=this.scheduleUpdate();return n!=null&&await n,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,a]of t){let{wrapped:l}=a,d=this[i];l!==!0||this._$AL.has(i)||d===void 0||this.C(i,void 0,a,d)}}let n=!1,e=this._$AL;try{n=this.shouldUpdate(e),n?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw n=!1,this._$EM(),t}n&&this._$AE(e)}willUpdate(n){}_$AE(n){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(n)),this.updated(n)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(n){return!0}update(n){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(n){}firstUpdated(n){}};Ct.elementStyles=[],Ct.shadowRootOptions={mode:"open"},Ct[Dn("elementProperties")]=new Map,Ct[Dn("finalized")]=new Map,Fv?.({ReactiveElement:Ct}),(ac.reactiveElementVersions??=[]).push("2.1.2");var em=globalThis,Vu=o=>o,sc=em.trustedTypes,Ku=sc?sc.createPolicy("lit-html",{createHTML:o=>o}):void 0,tm="$lit$",St=`lit$${Math.random().toFixed(9).slice(2)}$`,im="?"+St,jv=`<${im}>`,Oi=document,Rn=()=>Oi.createComment(""),Hn=o=>o===null||typeof o!="object"&&typeof o!="function",rm=Array.isArray,Zu=o=>rm(o)||typeof o?.[Symbol.iterator]=="function",Qh=`[
|
|
2
|
+
\f\r]`,An=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Wu=/-->/g,Gu=/>/g,Ii=RegExp(`>|${Qh}(?:([^\\s"'>=/]+)(${Qh}*=${Qh}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Yu=/'/g,Xu=/"/g,Qu=/^(?:script|style|textarea|title)$/i,am=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=am(1),In=am(2),Ky=am(3),we=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Ju=new WeakMap,Pi=Oi.createTreeWalker(Oi,129);function eg(o,n){if(!rm(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ku!==void 0?Ku.createHTML(n):n}var tg=(o,n)=>{let e=o.length-1,t=[],i,a=n===2?"<svg>":n===3?"<math>":"",l=An;for(let d=0;d<e;d++){let m=o[d],u,v,f=-1,w=0;for(;w<m.length&&(l.lastIndex=w,v=l.exec(m),v!==null);)w=l.lastIndex,l===An?v[1]==="!--"?l=Wu:v[1]!==void 0?l=Gu:v[2]!==void 0?(Qu.test(v[2])&&(i=RegExp("</"+v[2],"g")),l=Ii):v[3]!==void 0&&(l=Ii):l===Ii?v[0]===">"?(l=i??An,f=-1):v[1]===void 0?f=-2:(f=l.lastIndex-v[2].length,u=v[1],l=v[3]===void 0?Ii:v[3]==='"'?Xu:Yu):l===Xu||l===Yu?l=Ii:l===Wu||l===Gu?l=An:(l=Ii,i=void 0);let y=l===Ii&&o[d+1].startsWith("/>")?" ":"";a+=l===An?m+jv:f>=0?(t.push(u),m.slice(0,f)+tm+m.slice(f)+St+y):m+St+(f===-2?d:y)}return[eg(o,a+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},Nn=class o{constructor({strings:n,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,d=n.length-1,m=this.parts,[u,v]=tg(n,e);if(this.el=o.createElement(u,t),Pi.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Pi.nextNode())!==null&&m.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(tm)){let w=v[l++],y=i.getAttribute(f).split(St),k=/([.?@])?(.*)/.exec(w);m.push({type:1,index:a,name:k[2],strings:y,ctor:k[1]==="."?oc:k[1]==="?"?lc:k[1]==="@"?cc:Bi}),i.removeAttribute(f)}else f.startsWith(St)&&(m.push({type:6,index:a}),i.removeAttribute(f));if(Qu.test(i.tagName)){let f=i.textContent.split(St),w=f.length-1;if(w>0){i.textContent=sc?sc.emptyScript:"";for(let y=0;y<w;y++)i.append(f[y],Rn()),Pi.nextNode(),m.push({type:2,index:++a});i.append(f[w],Rn())}}}else if(i.nodeType===8)if(i.data===im)m.push({type:2,index:a});else{let f=-1;for(;(f=i.data.indexOf(St,f+1))!==-1;)m.push({type:7,index:a}),f+=St.length-1}a++}}static createElement(n,e){let t=Oi.createElement("template");return t.innerHTML=n,t}};function qi(o,n,e=o,t){if(n===we)return n;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Hn(n)?void 0:n._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(n=qi(o,i._$AS(o,n.values),i,t)),n}var nc=class{constructor(n,e){this._$AV=[],this._$AN=void 0,this._$AD=n,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(n){let{el:{content:e},parts:t}=this._$AD,i=(n?.creationScope??Oi).importNode(e,!0);Pi.currentNode=i;let a=Pi.nextNode(),l=0,d=0,m=t[0];for(;m!==void 0;){if(l===m.index){let u;m.type===2?u=new Br(a,a.nextSibling,this,n):m.type===1?u=new m.ctor(a,m.name,m.strings,this,n):m.type===6&&(u=new dc(a,this,n)),this._$AV.push(u),m=t[++d]}l!==m?.index&&(a=Pi.nextNode(),l++)}return Pi.currentNode=Oi,i}p(n){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(n,t,e),e+=t.strings.length-2):t._$AI(n[e])),e++}},Br=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(n,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=n,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let n=this._$AA.parentNode,e=this._$AM;return e!==void 0&&n?.nodeType===11&&(n=e.parentNode),n}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(n,e=this){n=qi(this,n,e),Hn(n)?n===h||n==null||n===""?(this._$AH!==h&&this._$AR(),this._$AH=h):n!==this._$AH&&n!==we&&this._(n):n._$litType$!==void 0?this.$(n):n.nodeType!==void 0?this.T(n):Zu(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&&Hn(this._$AH)?this._$AA.nextSibling.data=n:this.T(Oi.createTextNode(n)),this._$AH=n}$(n){let{values:e,_$litType$:t}=n,i=typeof t=="number"?this._$AC(n):(t.el===void 0&&(t.el=Nn.createElement(eg(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new nc(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(n){let e=Ju.get(n.strings);return e===void 0&&Ju.set(n.strings,e=new Nn(n)),e}k(n){rm(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of n)i===e.length?e.push(t=new o(this.O(Rn()),this.O(Rn()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(n=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);n!==this._$AB;){let t=Vu(n).nextSibling;Vu(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},Bi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(n,e,t,i,a){this.type=1,this._$AH=h,this._$AN=void 0,this.element=n,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(n,e=this,t,i){let a=this.strings,l=!1;if(a===void 0)n=qi(this,n,e,0),l=!Hn(n)||n!==this._$AH&&n!==we,l&&(this._$AH=n);else{let d=n,m,u;for(n=a[0],m=0;m<a.length-1;m++)u=qi(this,d[t+m],e,m),u===we&&(u=this._$AH[m]),l||=!Hn(u)||u!==this._$AH[m],u===h?n=h:n!==h&&(n+=(u??"")+a[m+1]),this._$AH[m]=u}l&&!i&&this.j(n)}j(n){n===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}},oc=class extends Bi{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},lc=class extends Bi{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},cc=class extends Bi{constructor(n,e,t,i,a){super(n,e,t,i,a),this.type=5}_$AI(n,e=this){if((n=qi(this,n,e,0)??h)===we)return;let t=this._$AH,i=n===h&&t!==h||n.capture!==t.capture||n.once!==t.once||n.passive!==t.passive,a=n!==h&&(t===h||i);i&&this.element.removeEventListener(this.name,this,t),a&&this.element.addEventListener(this.name,this,n),this._$AH=n}handleEvent(n){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,n):this._$AH.handleEvent(n)}},dc=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){qi(this,n)}},ig={M:tm,P:St,A:im,C:1,L:tg,R:nc,D:Zu,V:qi,I:Br,H:Bi,N:lc,U:cc,B:oc,F:dc},Uv=em.litHtmlPolyfillSupport;Uv?.(Nn,Br),(em.litHtmlVersions??=[]).push("3.3.3");var rg=(o,n,e)=>{let t=e?.renderBefore??n,i=t._$litPart$;if(i===void 0){let a=e?.renderBefore??null;t._$litPart$=i=new Br(n.insertBefore(Rn(),a),a,void 0,e??{})}return i._$AI(o),i};var sm=globalThis,S=class extends Ct{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=rg(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return we}};S._$litElement$=!0,S.finalized=!0,sm.litElementHydrateSupport?.({LitElement:S});var Vv=sm.litElementPolyfillSupport;Vv?.({LitElement:S});(sm.litElementVersions??=[]).push("4.2.2");var E=x`
|
|
4
4
|
:host {
|
|
5
5
|
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
6
|
color: var(--cm-text-default, #000);
|
|
@@ -8,23 +8,23 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,nx=x`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
14
|
+
`,Kv=0,A=o=>`${o}-${++Kv}`;function $(o,n){customElements.get(o)||customElements.define(o,n)}function J(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Wv={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},hc={common:{...Wv}},Pn={},On={},mc;function z(o,n){return hc[o]={...hc[o],...n},n}function Gv(){return Object.fromEntries(Object.entries(hc).map(([o,n])=>[o,{...n}]))}function pc(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function Yv(o,n){pc(n?On[n.toLowerCase()]??={}:Pn,o),fc()}function Xv(o={}){"locale"in o&&(mc=o.locale||void 0),o.strings&&pc(Pn,o.strings);for(let[n,e]of Object.entries(o.translations??{}))pc(On[n.toLowerCase()]??={},e);fc()}function Jv(){mc=void 0;for(let o of Object.keys(Pn))delete Pn[o];for(let o of Object.keys(On))delete On[o];fc()}function qn(o){if(mc)return mc;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 ag=new Map;function lm(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,a=ag.get(i);if(!a){try{a=t(n)}catch{a=t(void 0)}ag.set(i,a)}return a}function cm(o,n={},e){return lm("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function ae(o,n={},e){return lm("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function uc(o,n){return lm("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function sg(o,n={},e){if(o==null)return"";if(typeof o=="function")return String(o(n));let t;if(typeof o=="object"){let i=Number(n.count??0);t=o[uc(i,e)]??o.other??""}else t=String(o);return t.replace(/\{(\w+)\}/g,(i,a)=>{let l=n[a];return l===void 0?i:typeof l=="number"?cm(l,{},e):String(l)})}function Zv(o,n,e,t){if(t&&t[n]!==void 0)return t[n];let i=[];if(e){let a=e.toLowerCase().split("-");for(let l=a.length;l>0;l--)i.push(a.slice(0,l).join("-"))}for(let a of o==="common"?["common"]:[o,"common"]){for(let d of i){let m=On[d]?.[a]?.[n];if(m!==void 0)return m}let l=Pn[a]?.[n]??hc[a]?.[n];if(l!==void 0)return l}}function gc(o,n,e,t,i){let a=qn(t);return sg(Zv(o,n,a,i),e,a)}var om=new Set,nm;function fc(){for(let o of om)o.requestUpdate()}function Qv(){nm||typeof MutationObserver>"u"||typeof document>"u"||(nm=new MutationObserver(fc),nm.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var ey=o=>o.replace(/^cm-/,"").replace(/-([a-z])/g,(n,e)=>e.toUpperCase()),T=class extends S{static finalize(){let n=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);if(!n(this,"finalized")&&n(this,"properties"))for(let[e,t]of Object.entries(this.properties)){let i=t.string;if(!i||n(this.prototype,e))continue;let a=Symbol(e);Object.defineProperty(this.prototype,e,{get(){return this[a]??this.t(i)},set(l){this[a]=l},configurable:!0,enumerable:!0})}super.finalize()}get stringsNamespace(){return ey(this.localName)}t(n,e){return gc(this.stringsNamespace,n,e,this,this.strings)}get locale(){return qn(this)}formatNumber(n,e){return cm(n,e,this.locale)}connectedCallback(){super.connectedCallback(),om.add(this),Qv()}disconnectedCallback(){super.disconnectedCallback(),om.delete(this)}};T.properties={strings:{type:Object}};var bc={"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"},ng=["more","drag"],dx=Object.keys(bc);var og=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],Fr=class extends S{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=bc[this.name]??bc.more,t=ng.includes(this.name)?3:1.6;return In`<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"?og.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Fr.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Fr.styles=x`
|
|
18
18
|
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
19
19
|
svg { display: block; }
|
|
20
20
|
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
21
|
-
`;$("cm-icon",
|
|
21
|
+
`;$("cm-icon",Fr);var lg=99,yx=z("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),vc,yc,Bn,Fi=class extends T{constructor(){super();this.variant="secondary";this.size="medium";this.type="button";this.disabled=!1;this.loading=!1;this.iconOnly=!1;this.icon="";this.label="";this.count=0;p(this,vc,this.attachInternals());p(this,yc,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,vc).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});p(this,Bn,!1);this.addEventListener("click",r(this,yc),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,Bn)&&(g(this,Bn,!0),console.warn("cm-button: an icon-only button needs a `label` (its accessible name).",this))}render(){let e=Number.isFinite(this.count)&&this.count>0?Math.floor(this.count):0,t=this.loading?c`<span class="spinner" aria-hidden="true"></span>`:c`<slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:h}</slot>`,i=this.iconOnly?c`<span class="vh"><slot></slot></span>`:c`<span class="text"><slot></slot></span>`,a=e?c`<span class="count" part="count" aria-hidden="true">${e>lg?this.t("countOverflow",{max:lg}):this.formatNumber(e)}</span>${this.iconOnly?h:c`<span class="vh"> ${this.t("count",{count:e})}</span>`}`:h,l=this.iconOnly&&(this.label||this.textContent?.trim())||"",d=!this.iconOnly||!l?h:e?this.t("labelWithCount",{label:l,count:e}):this.label||h,m=c`${t}${i}${a}`;return this.href&&!this.disabled?c`<a class="btn" part="control" href=${this.href} target=${this.target??h}
|
|
22
22
|
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${m}</a>`:c`<button class="btn" part="control" type="button"
|
|
23
23
|
?disabled=${this.disabled} aria-disabled=${this.loading?"true":h}
|
|
24
|
-
aria-busy=${this.loading?"true":h} aria-label=${d}>${m}</button>`}};
|
|
24
|
+
aria-busy=${this.loading?"true":h} aria-label=${d}>${m}</button>`}};vc=new WeakMap,yc=new WeakMap,Bn=new WeakMap,Fi.formAssociated=!0,Fi.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}},Fi.styles=[E,x`
|
|
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
|
-
.text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
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) */
|
|
28
28
|
.btn {
|
|
29
29
|
position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--cm-space-8);
|
|
30
30
|
width: 100%; min-width: 0; font: inherit; font-weight: 500; line-height: 1; white-space: nowrap;
|
|
@@ -106,13 +106,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("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",Fi);var jr=class extends S{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}}};jr.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}},jr.styles=x`:host { display: none; }`;$("cm-menu-item",jr);function Fn(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),i=a=>e.getAttribute(a)||void 0;n.push({label:t,value:i("value")??t,icon:i("icon"),href:i("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0,heading:e.hasAttribute("heading")||void 0,shortcut:i("shortcut")})}else e.localName==="hr"&&n.push({divider:!0});return n}function xc(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var Ur=class extends T{constructor(){super(...arguments);this.size="large"}render(){let e=this.size==="small"?2.5:3;return c`<span class="spinner" part="spinner" role="status">
|
|
110
110
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
111
111
|
<circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
|
|
112
112
|
<path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
|
|
113
113
|
</svg>
|
|
114
114
|
<span class="vh">${this.accessibleLabel||this.t("loading")}</span>
|
|
115
|
-
</span>`}};
|
|
115
|
+
</span>`}};Ur.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},Ur.styles=[E,x`
|
|
116
116
|
:host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
|
|
117
117
|
.spinner { display: inline-flex; }
|
|
118
118
|
svg { inline-size: 44px; block-size: 44px; animation: spin 0.8s linear infinite; }
|
|
@@ -125,18 +125,18 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
125
125
|
}
|
|
126
126
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
127
127
|
@media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
|
|
128
|
-
`];$("cm-spinner",
|
|
129
|
-
aria-expanded=${String(this.open)} aria-controls="${r(this,
|
|
130
|
-
?disabled=${this.disabled} @click=${r(this,
|
|
131
|
-
<div class="pop" part="menu" ?hidden=${!this.open}>
|
|
132
|
-
${this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h}
|
|
133
|
-
<div role="menu" id="${r(this,
|
|
134
|
-
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:s(this,
|
|
128
|
+
`];$("cm-spinner",Ur);var Ax=z("actionMenu",{label:"Actions"}),jn,ji,Ui,Un,q,wc,Vn,$c,kc,Ec,Mc,cg,dm,Kn,Wn,Tc,Kr,Wr,Vr,zc,dg,hm,hg,ft=class extends T{constructor(){super(...arguments);p(this,q);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this.loading=!1;this.disabled=!1;this._slotted=[];this._active=-1;this._custom=!1;p(this,jn);p(this,ji,A("cm-menu"));p(this,Ui,"");p(this,Un,0);p(this,Vn,e=>{this.open&&!e.composedPath().includes(this)&&s(this,q,Ec).call(this,!1)});p(this,Kn,()=>{let e=this.renderRoot.querySelector(".pop");e&&this.open&&s(this,q,dm).call(this,e)});p(this,Wn,!1);p(this,Kr,e=>{this.disabled||(e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0)))});p(this,Wr,()=>{this.disabled||(this.open?this.hide():this.show())});p(this,zc,e=>{let t=s(this,q,kc).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),s(this,q,Vr).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),s(this,q,Vr).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),s(this,q,Vr).call(this,t[0]);break;case"End":e.preventDefault(),s(this,q,Vr).call(this,t[t.length-1]);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.hide(!0);break;case"Tab":this.hide();break;default:if(e.key.length===1&&/\S/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let a=Date.now();g(this,Ui,(a-r(this,Un)<600?r(this,Ui):"")+e.key.toLowerCase()),g(this,Un,a);let l=this.menuItems,d=r(this,Ui).length>1?i:i+1,u=[...t.slice(Math.max(d,0)),...t.slice(0,Math.max(d,0))].find(v=>(l[v].label??"").toLowerCase().startsWith(r(this,Ui)));u!==void 0&&s(this,q,Vr).call(this,u)}}})}connectedCallback(){super.connectedCallback(),s(this,q,wc).call(this),g(this,jn,xc(this,()=>s(this,q,wc).call(this))),document.addEventListener("pointerdown",r(this,Vn),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,jn)?.disconnect(),document.removeEventListener("pointerdown",r(this,Vn),!0),s(this,q,Tc).call(this,!1)}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=s(this,q,kc).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,s(this,q,Ec).call(this,!0),this.updateComplete.then(()=>s(this,q,Mc).call(this))}hide(e=!1){s(this,q,Ec).call(this,!1),e&&s(this,q,$c).call(this)?.focus()}updated(e){if(e.has("open")&&this.open&&s(this,q,cg).call(this),e.has("open")&&!this.open){s(this,q,Tc).call(this,!1);let t=this.renderRoot.querySelector(".pop");try{t?.matches(":popover-open")&&t.hidePopover()}catch{}}if(this._custom){let t=s(this,q,$c).call(this);if(t){let i=(a,l)=>{t.getAttribute(a)!==l&&t.setAttribute(a,l)};i("aria-haspopup","menu"),i("aria-expanded",String(this.open)),i("aria-controls",`${r(this,ji)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=s(this,q,kc).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>s(this,q,Mc).call(this))}}triggerTemplate(e,t){}headTemplate(){}render(){let e=this.menuItems,t=this.triggerLabel||this.label,i=this._custom?c`<slot name="trigger" @click=${r(this,Wr)} @keydown=${r(this,Kr)} @slotchange=${()=>s(this,q,wc).call(this)}></slot>`:this.triggerTemplate(r(this,Wr),r(this,Kr))??c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
129
|
+
aria-expanded=${String(this.open)} aria-controls="${r(this,ji)}-m" aria-label=${this.iconOnly?t:h}
|
|
130
|
+
?disabled=${this.disabled} @click=${r(this,Wr)} @keydown=${r(this,Kr)}>${this.iconOnly?c`<cm-icon name=${this.icon} size="18"></cm-icon>`:c`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return c`${i}
|
|
131
|
+
<div class="pop" part="menu" popover="manual" ?hidden=${!this.open}>
|
|
132
|
+
${this.headTemplate()??(this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h)}
|
|
133
|
+
<div role="menu" id="${r(this,ji)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${r(this,zc)}>
|
|
134
|
+
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:s(this,q,hg).call(this,e)}
|
|
135
135
|
</div>
|
|
136
136
|
</div>
|
|
137
|
-
<slot hidden></slot>`}};
|
|
137
|
+
<slot hidden></slot>`}};jn=new WeakMap,ji=new WeakMap,Ui=new WeakMap,Un=new WeakMap,q=new WeakSet,wc=function(){this._slotted=Fn(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},Vn=new WeakMap,$c=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},kc=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},Ec=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})))},Mc=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},cg=function(){let e=this.renderRoot.querySelector(".pop");if(!e)return;if(typeof e.showPopover=="function"){try{e.matches(":popover-open")||e.showPopover()}catch{}if(e.matches(":popover-open")){s(this,q,dm).call(this,e),s(this,q,Tc).call(this,!0);return}}e.classList.remove("to-end","to-start");let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,a=8,l=getComputedStyle(this).direction==="rtl",d=l?t.left<a:t.right>i-a,m=l?t.right>i-a:t.left<a;this.align!=="end"&&d?e.classList.add("to-end"):this.align==="end"&&m&&e.classList.add("to-start")},dm=function(e){let i=(s(this,q,$c).call(this)??this).getBoundingClientRect(),a=document.documentElement.clientWidth,l=document.documentElement.clientHeight,d=8,m=4;e.style.maxHeight="";let u=e.offsetWidth,v=e.offsetHeight,f=getComputedStyle(this).direction==="rtl",w=f?i.right-u:i.left,y=f?i.left:i.right-u,k=this.align==="end"?y:w;k+u>a-d&&(k=f?w:y),k<d&&(k=this.align==="end"?w:f?i.left:k),k=Math.max(d,Math.min(k,a-d-u));let D=i.bottom+m;D+v>l-d&&(i.top-m-v>=d?D=i.top-m-v:e.style.maxHeight=`${Math.max(120,l-D-d)}px`),e.style.left=`${Math.round(k)}px`,e.style.top=`${Math.round(D)}px`},Kn=new WeakMap,Wn=new WeakMap,Tc=function(e){if(e===r(this,Wn))return;g(this,Wn,e);let t=e?"addEventListener":"removeEventListener";window[t]("scroll",r(this,Kn),!0),window[t]("resize",r(this,Kn))},Kr=new WeakMap,Wr=new WeakMap,Vr=function(e){this._active=e,this.updateComplete.then(()=>s(this,q,Mc).call(this))},zc=new WeakMap,dg=function(e,t){if(t.disabled){e.preventDefault();return}let i=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));i||e.preventDefault(),this.hide(!t.href||!i)},hm=function(e,t){if(e.divider)return c`<div role="separator"></div>`;let i=`item${e.critical?" critical":""}${t===this._active?" active":""}`,a=c`${e.icon?c`<cm-icon name=${e.icon} size="16"></cm-icon>`:h}<span class="label">${e.label}</span>${e.shortcut?c`<span class="shortcut" part="shortcut" aria-hidden="true">${e.shortcut}</span>`:h}`,l={over:()=>{e.disabled||(this._active=t)},click:d=>s(this,q,dg).call(this,d,e)};return e.href&&!e.disabled?c`<a class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
138
138
|
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</a>`:c`<button type="button" class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
139
|
-
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},
|
|
139
|
+
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},hg=function(e){let t=[];for(let i=0;i<e.length;i++){let a=e[i];if(!a.heading){t.push(s(this,q,hm).call(this,a,i));continue}let l=`${r(this,ji)}-h${i}`,d=[],m=i+1;for(;m<e.length&&!e[m].heading&&!e[m].divider;m++)d.push(s(this,q,hm).call(this,e[m],m));t.push(c`<div role="group" aria-labelledby=${l}><div class="section" part="section" id=${l} role="presentation">${a.label}</div>${d}</div>`),i=m-1}return t},ft.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}},ft.styles=[E,x`
|
|
140
140
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
141
141
|
.trigger {
|
|
142
142
|
display: inline-flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-12); font: inherit; font-size: var(--cm-font-size-14); font-weight: 500;
|
|
@@ -164,6 +164,9 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
164
164
|
:host([align='end']) .pop, .pop.to-end { inset-inline-start: auto; inset-inline-end: 0; }
|
|
165
165
|
:host([align='end']) .pop.to-start { inset-inline-start: 0; inset-inline-end: auto; }
|
|
166
166
|
.pop[hidden] { display: none; }
|
|
167
|
+
/* 1.9.2: the open menu is a popover in the top layer, so a scrolling ancestor (a board column, a table, a card
|
|
168
|
+
body) can't clip it; #place() puts it beside the trigger. Browsers without popovers keep the absolute menu. */
|
|
169
|
+
.pop:popover-open { position: fixed; inset: auto; margin: 0; overflow: auto; color: var(--cm-text-default); }
|
|
167
170
|
.head { padding: var(--cm-space-4) var(--cm-space-12) var(--cm-space-8); margin-bottom: 4px; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); overflow-wrap: anywhere; }
|
|
168
171
|
.head strong { display: block; font-size: 14px; font-weight: 500; }
|
|
169
172
|
.head span { display: block; font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); }
|
|
@@ -196,12 +199,12 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
196
199
|
}
|
|
197
200
|
.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); }
|
|
198
201
|
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
199
|
-
`];$("cm-action-menu",
|
|
202
|
+
`];$("cm-action-menu",ft);var Ox=z("buttonGroup",{more:"More"}),Qt="data-cm-overflow",ty=["disabled","loading","tone","icon","label","variant","size","icon-only","count","href","hidden","data-priority"],ei,Vi,Lt,bt,ti,Ki,V,Gr,mg,Gn,mm,_c,Cc,pg,Sc,pm,um,gm,Yr=class extends T{constructor(){super(...arguments);p(this,V);this.overflow="wrap";this.align="start";this.label="";this._items=[];this._size="medium";p(this,ei,[]);p(this,Vi);p(this,Lt);p(this,bt,0);p(this,ti,new Set);p(this,Ki,!1);p(this,Sc,e=>{e.stopPropagation();let t=r(this,ei)[Number(e.detail.value)];if(!t)return;g(this,Ki,!0),(t.shadowRoot?.querySelector('[part="control"]')??t).click(),requestAnimationFrame(()=>requestAnimationFrame(()=>s(this,V,pm).call(this)))})}get overflowing(){return[...r(this,ei)]}connectedCallback(){super.connectedCallback(),g(this,Vi,new MutationObserver(e=>s(this,V,mg).call(this,e))),r(this,Vi).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:ty}),typeof ResizeObserver<"u"&&(g(this,Lt,new ResizeObserver(()=>s(this,V,Gr).call(this))),r(this,Lt).observe(this),g(this,ti,new Set([this]))),document.fonts?.ready.then(()=>s(this,V,Gr).call(this)),s(this,V,Gr).call(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Vi)?.disconnect(),r(this,Lt)?.disconnect(),r(this,ti).clear(),cancelAnimationFrame(r(this,bt)),g(this,bt,0),s(this,V,mm).call(this,s(this,V,Gn).call(this))}updated(e){(e.has("overflow")||e.has("moreLabel")||e.has("moreIcon")||e.has("size"))&&s(this,V,Gr).call(this)}firstUpdated(){this.updateComplete.then(()=>this.relayout())}relayout(){cancelAnimationFrame(r(this,bt)),g(this,bt,0),s(this,V,Cc).call(this)}render(){let e=this.moreIcon!=null;return c`<div class="row" part="row" role="group" aria-label=${this.label||h}>
|
|
200
203
|
<slot></slot>
|
|
201
204
|
<cm-action-menu class="more ${this._size}${e?" icon":""}" part="more" hidden align="end"
|
|
202
205
|
.items=${this._items} label=${this.moreLabel} ?icon-only=${e} icon=${this.moreIcon||"more"}
|
|
203
|
-
@cm-select=${r(this,
|
|
204
|
-
</div>`}};
|
|
206
|
+
@cm-select=${r(this,Sc)}></cm-action-menu>
|
|
207
|
+
</div>`}};ei=new WeakMap,Vi=new WeakMap,Lt=new WeakMap,bt=new WeakMap,ti=new WeakMap,Ki=new WeakMap,V=new WeakSet,Gr=function(){r(this,bt)||!this.isConnected||g(this,bt,requestAnimationFrame(()=>{g(this,bt,0);let e=s(this,V,Gn).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>s(this,V,Cc).call(this)):s(this,V,Cc).call(this)}))},mg=function(e){for(let t of e)for(let i of Array.from(t.removedNodes))i instanceof HTMLElement&&i.hasAttribute(Qt)&&i.parentElement!==this&&(i.removeAttribute(Qt),i.hidden=!1);s(this,V,Gr).call(this)},Gn=function(){return Array.from(this.children).filter(e=>e.localName==="cm-button"&&(!e.hidden||e.hasAttribute(Qt)))},mm=function(e){for(let t of e)t.hasAttribute(Qt)&&(t.removeAttribute(Qt),t.hidden=!1)},_c=function(){return this.renderRoot.querySelector(".more")},Cc=function(){let e=this.renderRoot.querySelector(".row"),t=s(this,V,_c).call(this);if(!e||!t||!this.isConnected)return;let i=s(this,V,Gn).call(this),a=this.shadowRoot.activeElement===t?t:i.find(v=>v.matches(":focus-within"))??null,l=i[0]?.getAttribute("size");this._size=this.size||(l==="slim"||l==="large"?l:"medium");let d=new Set;if(r(this,Lt)){let v=new Set([this,t,...i]);for(let f of r(this,ti))v.has(f)||r(this,Lt).unobserve(f);for(let f of v)r(this,ti).has(f)||r(this,Lt).observe(f);g(this,ti,v)}if(this.overflow==="menu"){s(this,V,mm).call(this,i),t.hidden=!1;let v=e.clientWidth,f=parseFloat(getComputedStyle(e).columnGap)||0,w=Array.from(this.children).filter(D=>!D.hidden),y=new Map(w.map(D=>[D,D.getBoundingClientRect().width])),k=w.reduce((D,H)=>D+y.get(H),0)+f*Math.max(w.length-1,0);if(k>v+.5){let D=j=>{let W=j.dataset.priority;return W==="low"?0:W==="high"?2:j.getAttribute("variant")==="primary"?3:1},H=i.map((j,W)=>({b:j,i:W,r:D(j)})).sort((j,W)=>j.r-W.r||W.i-j.i),B=k+f+t.getBoundingClientRect().width;for(let{b:j}of H){if(B<=v+.5)break;d.add(j),B-=y.get(j)+f}}}for(let v of i)d.has(v)?(v.setAttribute(Qt,""),v.hidden=!0):v.hasAttribute(Qt)&&(v.removeAttribute(Qt),v.hidden=!1);t.hidden=d.size===0,a===t&&t.hidden?s(this,V,gm).call(this):a&&a!==t&&d.has(a)&&s(this,V,um).call(this),d.size===0&&t.open&&t.hide(),r(this,Vi)?.takeRecords();let m=i.filter(v=>d.has(v));this._items=m.map((v,f)=>s(this,V,pg).call(this,v,f));let u=m.length!==r(this,ei).length||m.some((v,f)=>v!==r(this,ei)[f]);g(this,ei,m),u&&this.dispatchEvent(new CustomEvent("cm-overflow-change",{detail:{hidden:[...m]},bubbles:!0,composed:!0})),r(this,Ki)&&this.updateComplete.then(()=>s(this,V,pm).call(this))},pg=function(e,t){let i=Array.from(e.childNodes).filter(d=>!(d instanceof Element&&d.hasAttribute("slot"))).map(d=>d.textContent??"").join("").replace(/\s+/g," ").trim(),a=e.hasAttribute("icon-only")?e.getAttribute("label")||i:i||e.getAttribute("label")||"",l=e.getAttribute("icon")||e.querySelector(':scope > [slot="icon"]')?.getAttribute("name")||void 0;return{label:a,value:String(t),icon:l,disabled:e.hasAttribute("disabled")||e.hasAttribute("loading")||void 0,critical:e.getAttribute("tone")==="critical"||void 0}},Sc=new WeakMap,pm=function(){if(!r(this,Ki))return;g(this,Ki,!1);let e=document.activeElement,t=s(this,V,_c).call(this);(!e||e===document.body||e===document.documentElement||e===this&&(!t||t.hidden||this.shadowRoot.activeElement!==t))&&(t&&!t.hidden?s(this,V,um).call(this):s(this,V,gm).call(this))},um=function(){s(this,V,_c).call(this)?.shadowRoot?.querySelector('[part="trigger"]')?.focus()},gm=function(){let e=s(this,V,Gn).call(this).filter(i=>!i.hidden&&!i.hasAttribute("disabled")),t=e[e.length-1];(t?.shadowRoot?.querySelector('[part="control"]')??t)?.focus()},Yr.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}},Yr.styles=[E,x`
|
|
205
208
|
:host { display: block; min-inline-size: 0; }
|
|
206
209
|
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); min-inline-size: 0; }
|
|
207
210
|
:host([align='end']) .row { justify-content: flex-end; }
|
|
@@ -225,7 +228,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
225
228
|
.more::part(trigger), .more.slim::part(trigger) { min-height: var(--cm-control-height-lg, 40px); }
|
|
226
229
|
.more.icon::part(trigger), .more.icon.slim::part(trigger) { width: var(--cm-control-height-lg, 40px); }
|
|
227
230
|
}
|
|
228
|
-
`];$("cm-button-group",
|
|
231
|
+
`];$("cm-button-group",Yr);var ot={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Xr=o=>(...n)=>({_$litDirective$:o,values:n}),ii=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:iy}=ig,ug=o=>o;var fg=o=>o.strings===void 0,gg=()=>document.createComment(""),Jr=(o,n,e)=>{let t=o._$AA.parentNode,i=n===void 0?o._$AB:n._$AA;if(e===void 0){let a=t.insertBefore(gg(),i),l=t.insertBefore(gg(),i);e=new iy(a,l,o,o.options)}else{let a=e._$AB.nextSibling,l=e._$AM,d=l!==o;if(d){let m;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(m=o._$AU)!==l._$AU&&e._$AP(m)}if(a!==i||d){let m=e._$AA;for(;m!==a;){let u=ug(m).nextSibling;ug(t).insertBefore(m,i),m=u}}}return e},ri=(o,n,e=o)=>(o._$AI(n,e),o),ry={},Lc=(o,n=ry)=>o._$AH=n,bg=o=>o._$AH,Dc=o=>{o._$AR(),o._$AA.remove()};var ne=Xr(class extends ii{constructor(o){if(super(o),o.type!==ot.PROPERTY&&o.type!==ot.ATTRIBUTE&&o.type!==ot.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!fg(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[n]){if(n===we||n===h)return n;let e=o.element,t=o.name;if(o.type===ot.PROPERTY){if(n===e[t])return we}else if(o.type===ot.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return we}else if(o.type===ot.ATTRIBUTE&&e.getAttribute(t)===n+"")return we;return Lc(o),n}});var Ge=x`
|
|
229
232
|
:host {
|
|
230
233
|
--_cm-field-h: var(--cm-control-height-lg, 40px);
|
|
231
234
|
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
@@ -249,7 +252,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
249
252
|
.error { color: var(--cm-text-critical); }
|
|
250
253
|
:host([size='small']) .field { gap: var(--cm-space-4); }
|
|
251
254
|
:host([size='small']) .label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); }
|
|
252
|
-
`,
|
|
255
|
+
`,Ac=x`
|
|
253
256
|
[role='listbox'] {
|
|
254
257
|
max-height: 264px; overflow-y: auto; margin: 0; padding: var(--cm-space-4); list-style: none;
|
|
255
258
|
}
|
|
@@ -261,22 +264,22 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
261
264
|
[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%); }
|
|
262
265
|
:host([size='small']) [role='option'] { min-height: var(--cm-control-height-sm, 32px); }
|
|
263
266
|
@media (pointer: coarse) { [role='option'], :host([size='small']) [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
264
|
-
`;var
|
|
267
|
+
`;var sw=z("textField",{required:"Please fill in this field.",rangeUnderflow:"Enter {min} or later.",rangeOverflow:"Enter {max} or earlier.",numberUnderflow:"Enter {min} or more.",numberOverflow:"Enter {max} or less.",stepMismatch:"Enter a valid value. The two nearest are {lower} and {upper}.",badTime:"Enter a complete time.",badDateTime:"Enter a complete date and time."}),$e,Dt,Xn,oe,Yn,Rc,vg,fm,yg,bm,ai=class extends T{constructor(){super(...arguments);p(this,oe);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.type="text";this.multiline=!1;this.rows=4;this.required=!1;this.disabled=!1;this.readonly=!1;this.size="default";p(this,$e,this.attachInternals());p(this,Dt,A("cm-tf"));p(this,Xn,"")}connectedCallback(){super.connectedCallback(),g(this,Xn,this.value)}get form(){return r(this,$e).form}get validity(){return r(this,$e).validity}get validationMessage(){return r(this,$e).validationMessage}checkValidity(){return s(this,oe,Yn).call(this),r(this,$e).checkValidity()}reportValidity(){return s(this,oe,Yn).call(this),r(this,$e).reportValidity()}formResetCallback(){this.value=r(this,Xn),this.error=""}formDisabledCallback(e){this.disabled=e}updated(){r(this,$e).setFormValue(this.value),s(this,oe,Yn).call(this)}render(){let e=[this.error&&`${r(this,Dt)}-err`,this.helpText&&`${r(this,Dt)}-help`].filter(Boolean).join(" ")||h,t={id:r(this,Dt),invalid:this.error?"true":h},i=this.multiline?c`<textarea class="input" part="input" id=${t.id} rows=${this.rows}
|
|
265
268
|
.value=${ne(this.value)} placeholder=${this.placeholder||h}
|
|
266
269
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
267
270
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
268
|
-
@input=${s(this,oe,
|
|
271
|
+
@input=${s(this,oe,fm)} @change=${s(this,oe,bm)}></textarea>`:c`<input class="input" part="input" id=${t.id} type=${this.type}
|
|
269
272
|
.value=${ne(this.value)} placeholder=${this.placeholder||h}
|
|
270
273
|
autocomplete=${this.autocomplete??h}
|
|
271
274
|
min=${this.min||h} max=${this.max||h} step=${this.step||h}
|
|
272
275
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
273
276
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
274
|
-
@input=${s(this,oe,
|
|
275
|
-
${this.label?c`<label class="label" for=${r(this,
|
|
277
|
+
@input=${s(this,oe,fm)} @change=${s(this,oe,bm)} @blur=${s(this,oe,yg)} />`;return c`<div class="field">
|
|
278
|
+
${this.label?c`<label class="label" for=${r(this,Dt)} 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}
|
|
276
279
|
${i}
|
|
277
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
278
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
279
|
-
</div>`}};$e=new WeakMap,
|
|
280
|
+
${this.error?c`<p class="error" id="${r(this,Dt)}-err" role="alert">${this.error}</p>`:h}
|
|
281
|
+
${this.helpText?c`<p class="help" id="${r(this,Dt)}-help">${this.helpText}</p>`:h}
|
|
282
|
+
</div>`}};$e=new WeakMap,Dt=new WeakMap,Xn=new WeakMap,oe=new WeakSet,Yn=function(){let e=this.renderRoot.querySelector(".input"),t=e instanceof HTMLInputElement?e.validity:null,i=this.type==="time"||this.type==="datetime-local";this.error?r(this,$e).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,$e).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.required&&!this.value?r(this,$e).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,$e).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:s(this,oe,Rc).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,$e).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:s(this,oe,Rc).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,$e).setValidity({stepMismatch:!0},this.t("stepMismatch",s(this,oe,vg).call(this,e)),e??void 0):r(this,$e).setValidity({})},Rc=function(e){let t=this.locale;if(this.type==="number"&&e!==""&&Number.isFinite(Number(e)))return this.formatNumber(Number(e));if(this.type==="time"){let l=/^(\d{2}):(\d{2})/.exec(e);return l?ae(new Date(2e3,0,1,+l[1],+l[2]),{hour:"numeric",minute:"2-digit"},t):e}let i=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(e);if(!i)return e;let a=new Date(+i[1],+i[2]-1,+i[3],+(i[4]??0),+(i[5]??0));return this.type==="datetime-local"?ae(a,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"},t):ae(a,{day:"numeric",month:"short",year:"numeric"},t)},vg=function(e){let t=this.type==="date"?864e5:this.type==="time"||this.type==="datetime-local"?1e3:1,i=Number(this.step)*t||(this.type==="date"?864e5:this.type==="number"?1:6e4),a=e.valueAsNumber,l=document.createElement("input");l.type=this.type,l.value=this.min??"";let d=Number.isFinite(l.valueAsNumber)?l.valueAsNumber:0,m=d+Math.floor((a-d)/i)*i,u=v=>{if(this.type==="number")return this.formatNumber(Number(v.toPrecision(12)));let w=new Date(v).toISOString();return s(this,oe,Rc).call(this,this.type==="time"?w.slice(11,16):this.type==="date"?w.slice(0,10):w.slice(0,16))};return{lower:u(m),upper:u(m+i)}},fm=function(e){this.value=e.target.value},yg=function(){s(this,oe,Yn).call(this)},bm=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ai.formAssociated=!0,ai.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ai.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},type:{},multiline:{type:Boolean},rows:{type:Number},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},autocomplete:{},size:{reflect:!0},min:{},max:{},step:{}},ai.styles=[E,Ge,x`
|
|
280
283
|
:host { display: block; }
|
|
281
284
|
.input {
|
|
282
285
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -292,13 +295,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
292
295
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
293
296
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
294
297
|
:host([error]:not([error=''])) .input { border-color: var(--cm-border-critical); }
|
|
295
|
-
`];$("cm-text-field",
|
|
296
|
-
<input type="checkbox" id=${r(this,
|
|
298
|
+
`];$("cm-text-field",ai);var hw=z("checkbox",{required:"Please tick this box."}),ni,Wi,Jn,Hc,xg,si=class extends T{constructor(){super(...arguments);p(this,Hc);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;p(this,ni,this.attachInternals());p(this,Wi,A("cm-cb"));p(this,Jn,!1)}connectedCallback(){super.connectedCallback(),g(this,Jn,this.checked)}get form(){return r(this,ni).form}checkValidity(){return r(this,ni).checkValidity()}formResetCallback(){this.checked=r(this,Jn)}formDisabledCallback(e){this.disabled=e}updated(){r(this,ni).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,ni).setValidity({valueMissing:!0},this.t("required")):r(this,ni).setValidity({})}render(){let e=this.indeterminate?c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6h8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`:c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6.2 4.8 9 10 3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;return c`<label for=${r(this,Wi)}>
|
|
299
|
+
<input type="checkbox" id=${r(this,Wi)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
297
300
|
?disabled=${this.disabled} ?required=${this.required}
|
|
298
|
-
aria-describedby=${this.description?`${r(this,
|
|
301
|
+
aria-describedby=${this.description?`${r(this,Wi)}-d`:h} @change=${s(this,Hc,xg)} />
|
|
299
302
|
<span class="box" part="box">${e}</span>
|
|
300
|
-
${this.label||this.description?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,
|
|
301
|
-
</label>`}};
|
|
303
|
+
${this.label||this.description?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Wi)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
304
|
+
</label>`}};ni=new WeakMap,Wi=new WeakMap,Jn=new WeakMap,Hc=new WeakSet,xg=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},si.formAssociated=!0,si.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},si.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},si.styles=[E,x`
|
|
302
305
|
:host { display: inline-flex; }
|
|
303
306
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
304
307
|
/* The 16px box (18px on touch screens, owner standard 1.6) sits centred on the label's first line (20px); the
|
|
@@ -321,12 +324,12 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
321
324
|
:host([disabled]) label { cursor: not-allowed; }
|
|
322
325
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
323
326
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
324
|
-
`];$("cm-checkbox",
|
|
327
|
+
`];$("cm-checkbox",si);var Zn,Yi=class extends S{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;p(this,Zn,A("cm-radio"))}render(){let e=this.description?`${r(this,Zn)}-d`:null;return c`<div class="radio" part="radio" role="radio" id=${r(this,Zn)}
|
|
325
328
|
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":h}
|
|
326
329
|
aria-describedby=${e??h} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
327
330
|
<span class="dot" part="dot"></span>
|
|
328
331
|
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?c`<span class="desc" id=${e}>${this.description}</span>`:h}</span>
|
|
329
|
-
</div>`}};
|
|
332
|
+
</div>`}};Zn=new WeakMap,Yi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Yi.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}},Yi.styles=[E,x`
|
|
330
333
|
:host { display: inline-flex; }
|
|
331
334
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; outline: none; }
|
|
332
335
|
.dot {
|
|
@@ -348,16 +351,16 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
348
351
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
349
352
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
350
353
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
351
|
-
`];$("cm-radio",
|
|
352
|
-
aria-labelledby=${s(this,se,
|
|
354
|
+
`];$("cm-radio",Yi);var bw=z("radioGroup",{required:"Please select one of these options."}),Ye,At,Qn,eo,to,Zr,se,vm,Ic,Gi,ym,Qr,xm,Pc,Oc,Nc,Xi=class extends T{constructor(){super();p(this,se);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;p(this,Ye,this.attachInternals());p(this,At,A("cm-rg"));p(this,Qn,"");p(this,eo,!0);p(this,to,!1);p(this,Zr,!1);p(this,Ic,()=>{s(this,se,vm).call(this),r(this,Qr).call(this)});p(this,Qr,()=>{let e=s(this,se,Gi).call(this),t=!1;for(let a of e)a.checked=!!this.value&&a.value===this.value&&!t,a.checked&&(t=!0),a.groupDisabled=this.disabled;let i=e.find(a=>a.checked&&!a.disabled)??s(this,se,ym).call(this)[0];for(let a of e)a._tabbable=a===i&&!this.disabled});p(this,Pc,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||s(this,se,xm).call(this,t,!0)});p(this,Oc,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let i=s(this,se,ym).call(this),a=i.indexOf(t),l=J(e,this),d;if(e.key==="ArrowDown"||l==="ArrowRight")d=i[(a+1)%i.length];else if(e.key==="ArrowUp"||l==="ArrowLeft")d=i[(a-1+i.length)%i.length];else if(e.key===" ")d=t.disabled?void 0:t;else return;e.preventDefault(),d&&s(this,se,xm).call(this,d,!0)});this.addEventListener("keydown",r(this,Oc)),this.addEventListener("click",r(this,Pc))}connectedCallback(){super.connectedCallback(),s(this,se,vm).call(this)}get form(){return r(this,Ye).form}get validity(){return r(this,Ye).validity}get validationMessage(){return r(this,Ye).validationMessage}checkValidity(){return r(this,Ye).checkValidity()}reportValidity(){return r(this,Ye).reportValidity()}formResetCallback(){this.value=r(this,Qn)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(s(this,se,Gi).call(this).find(t=>t._tabbable)??s(this,se,Gi).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,to)&&!r(this,Zr)&&g(this,eo,!1),g(this,to,!0),r(this,Qr).call(this),r(this,Ye).setFormValue(this.value||null,this.value);let t=s(this,se,Gi).call(this)[0];this.error?r(this,Ye).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Ye).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ye).setValidity({})}render(){let e=[this.error&&`${r(this,At)}-err`,this.helpText&&`${r(this,At)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
355
|
+
aria-labelledby=${s(this,se,Nc).call(this)?`${r(this,At)}-l`:h} aria-label=${s(this,se,Nc).call(this)?h:this.getAttribute("aria-label")??h}
|
|
353
356
|
aria-describedby=${e||h}
|
|
354
357
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
355
358
|
aria-disabled=${this.disabled?"true":h}>
|
|
356
|
-
<span class="label" id="${r(this,
|
|
357
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
358
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
359
|
-
<div class="options" part="options"><slot @slotchange=${r(this,
|
|
360
|
-
</div>`}};Ye=new WeakMap,
|
|
359
|
+
<span class="label" id="${r(this,At)}-l" part="label" ?hidden=${!s(this,se,Nc).call(this)}>${this.label}<slot name="label"></slot>${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
360
|
+
${this.helpText?c`<p class="help" id="${r(this,At)}-help">${this.helpText}</p>`:h}
|
|
361
|
+
${this.error?c`<p class="error" id="${r(this,At)}-err" role="alert">${this.error}</p>`:h}
|
|
362
|
+
<div class="options" part="options"><slot @slotchange=${r(this,Ic)}></slot></div>
|
|
363
|
+
</div>`}};Ye=new WeakMap,At=new WeakMap,Qn=new WeakMap,eo=new WeakMap,to=new WeakMap,Zr=new WeakMap,se=new WeakSet,vm=function(){r(this,eo)&&(this.value||(g(this,Zr,!0),this.value=s(this,se,Gi).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>g(this,Zr,!1))),g(this,Qn,this.value))},Ic=new WeakMap,Gi=function(){return[...this.querySelectorAll("cm-radio")]},ym=function(){return s(this,se,Gi).call(this).filter(e=>!e.disabled&&!this.disabled)},Qr=new WeakMap,xm=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,r(this,Qr).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Pc=new WeakMap,Oc=new WeakMap,Nc=function(){return!!this.label||!!this.querySelector("[slot=label]")},Xi.formAssociated=!0,Xi.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}},Xi.styles=[E,x`
|
|
361
364
|
:host { display: block; }
|
|
362
365
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
363
366
|
.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); }
|
|
@@ -366,13 +369,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
366
369
|
.error { color: var(--cm-text-critical); }
|
|
367
370
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
368
371
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
369
|
-
`];$("cm-radio-group",
|
|
370
|
-
<input type="checkbox" role="switch" id=${r(this,
|
|
372
|
+
`];$("cm-radio-group",Xi);var ea,Ji,io,qc,wg,oi=class extends S{constructor(){super(...arguments);p(this,qc);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;p(this,ea,this.attachInternals());p(this,Ji,A("cm-tg"));p(this,io,!1)}connectedCallback(){super.connectedCallback(),g(this,io,this.checked)}get form(){return r(this,ea).form}checkValidity(){return r(this,ea).checkValidity()}formResetCallback(){this.checked=r(this,io)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,ea).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${r(this,Ji)}>
|
|
373
|
+
<input type="checkbox" role="switch" id=${r(this,Ji)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
371
374
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
372
|
-
aria-describedby=${this.description?`${r(this,
|
|
375
|
+
aria-describedby=${this.description?`${r(this,Ji)}-d`:h} @change=${s(this,qc,wg)} />
|
|
373
376
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
374
|
-
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,
|
|
375
|
-
</label>`}};
|
|
377
|
+
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Ji)}-d">${this.description}</span>`:h}</span>`:h}
|
|
378
|
+
</label>`}};ea=new WeakMap,Ji=new WeakMap,io=new WeakMap,qc=new WeakSet,wg=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},oi.formAssociated=!0,oi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},oi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},oi.styles=[E,x`
|
|
376
379
|
:host { display: inline-flex; }
|
|
377
380
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
378
381
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -400,7 +403,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
400
403
|
:host([disabled]) .track { opacity: .5; }
|
|
401
404
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
402
405
|
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
403
|
-
`];$("cm-toggle",
|
|
406
|
+
`];$("cm-toggle",oi);var ta=x`
|
|
404
407
|
.pop {
|
|
405
408
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-4)); inset-inline: 0;
|
|
406
409
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -412,7 +415,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
412
415
|
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
413
416
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
414
417
|
}
|
|
415
|
-
`;function
|
|
418
|
+
`;function Bc(o,n,e){let t=i=>{n()&&!i.composedPath().includes(o)&&e()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)}var li=x`
|
|
416
419
|
[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); }
|
|
417
420
|
[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); }
|
|
418
421
|
.gh {
|
|
@@ -421,7 +424,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
421
424
|
}
|
|
422
425
|
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
423
426
|
.gopts { list-style: none; margin: 0; padding: 0; }
|
|
424
|
-
`;function
|
|
427
|
+
`;function ia(o){if(!o.some(t=>t.group))return o;let n=[],e=new Map;for(let t of o)if(t.group){let i=e.get(t.group);if(i)i.push(t);else{let a=[t];e.set(t.group,a),n.push({key:t.group,items:a})}}else{let i=n[n.length-1];i&&!i.key?i.items.push(t):n.push({key:"",items:[t]})}return n.flatMap(t=>t.items)}function Fc(o){let n=[];return o.forEach((e,t)=>{let i=e.group||"",a=n[n.length-1];a&&a.group===i?a.rows.push({row:e,index:t}):n.push({group:i,rows:[{row:e,index:t}]})}),n}var jc=x`
|
|
425
428
|
[role='listbox'] { padding-block: var(--cm-space-4); }
|
|
426
429
|
[role='listbox'][hidden] { display: none; }
|
|
427
430
|
[role='option'] {
|
|
@@ -440,12 +443,12 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
440
443
|
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;
|
|
441
444
|
color: var(--cm-text-tertiary); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-xs);
|
|
442
445
|
}
|
|
443
|
-
`;function
|
|
446
|
+
`;function Uc(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 Vc(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 Kc(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"}
|
|
444
447
|
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"}
|
|
445
|
-
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function
|
|
448
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function Wc(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var Lw=z("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),Xe,ue,aa,lt,sa,ao,F,wm,$m,ro,ra,Zi,ci,Gc,Yc,so,Xc,$g,Jc,di=class extends T{constructor(){super(...arguments);p(this,F);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.size="default";this.loading=!1;this._active=-1;this._slotted=[];p(this,Xe,this.attachInternals());p(this,ue,A("cm-sel"));p(this,aa,"");p(this,lt,"");p(this,sa,0);p(this,ao,new MutationObserver(()=>s(this,F,wm).call(this)));p(this,Yc,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),s(this,F,ro).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),s(this,F,ro).call(this),s(this,F,ci).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,F,Gc).call(this,t);s(this,F,ro).call(this,i>=0?i:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?s(this,F,Zi).call(this,this._active):s(this,F,ci).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?s(this,F,Zi).call(this,this._active):s(this,F,ci).call(this,-1);break;case"Home":e.preventDefault(),s(this,F,ci).call(this,"first");break;case"End":e.preventDefault(),s(this,F,ci).call(this,"last");break;case"PageDown":e.preventDefault(),s(this,F,ci).call(this,10);break;case"PageUp":e.preventDefault(),s(this,F,ci).call(this,-10);break;case"Enter":e.preventDefault(),s(this,F,Zi).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),s(this,F,ra).call(this);break;case"Tab":s(this,F,Zi).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,lt)&&Date.now()-r(this,sa)<500){let i=s(this,F,Gc).call(this," ");i>=0&&(this._active=i)}else s(this,F,Zi).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,F,Gc).call(this,t);i>=0&&(this._active=i)}}});p(this,so,e=>{this.open&&!e.composedPath().includes(this)&&s(this,F,ra).call(this)});p(this,Xc,()=>{this.disabled||(this.open?s(this,F,ra).call(this):s(this,F,ro).call(this))});p(this,Jc,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),s(this,F,wm).call(this),r(this,ao).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,so),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,ao).disconnect(),document.removeEventListener("pointerdown",r(this,so),!0)}get form(){return r(this,Xe).form}get validity(){return r(this,Xe).validity}get validationMessage(){return r(this,Xe).validationMessage}checkValidity(){return r(this,Xe).checkValidity()}reportValidity(){return r(this,Xe).reportValidity()}formResetCallback(){this.value=r(this,aa),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?ia(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):ia(this._slotted)}firstUpdated(){r(this,aa)||g(this,aa,this.value)}updated(e){r(this,Xe).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,Xe).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Xe).setValidity({valueMissing:!0},this.t("required"),t):r(this,Xe).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,ue)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(d=>d.value===this.value),i=[this.error&&`${r(this,ue)}-err`,this.helpText&&`${r(this,ue)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=(d,m)=>c`<li role="option" id="${r(this,ue)}-o${m}" class=${m===this._active?"active":""}
|
|
446
449
|
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":h}
|
|
447
|
-
@pointerenter=${()=>!d.disabled&&(this._active=m)} @click=${()=>s(this,
|
|
448
|
-
${this.label?c`<span class="label" id="${r(this,ue)}-l" part="label" @click=${r(this,
|
|
450
|
+
@pointerenter=${()=>!d.disabled&&(this._active=m)} @click=${()=>s(this,F,Zi).call(this,m)}>${d.label}</li>`;return c`<div class="field">
|
|
451
|
+
${this.label?c`<span class="label" id="${r(this,ue)}-l" part="label" @click=${r(this,Jc)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
449
452
|
<div class="wrap">
|
|
450
453
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
451
454
|
aria-labelledby=${this.label?`${r(this,ue)}-l`:h}
|
|
@@ -454,21 +457,21 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
454
457
|
aria-activedescendant=${this.open&&this._active>=0?`${r(this,ue)}-o${this._active}`:h}
|
|
455
458
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
456
459
|
aria-disabled=${this.disabled?"true":h} aria-describedby=${i||h} aria-busy=${this.loading?"true":h}
|
|
457
|
-
@click=${r(this,
|
|
458
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,ue)}-v">${t?s(this,
|
|
460
|
+
@click=${r(this,Xc)} @keydown=${r(this,Yc)} @blur=${()=>s(this,F,ra).call(this)}>
|
|
461
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,ue)}-v">${t?s(this,F,$g).call(this,t):this.placeholder}</span>
|
|
459
462
|
${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>`}
|
|
460
463
|
</div>
|
|
461
464
|
<ul role="listbox" id="${r(this,ue)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,ue)}-l`:h}
|
|
462
465
|
aria-label=${!this.label&&a?a:h} ?hidden=${!this.open}
|
|
463
466
|
@pointerdown=${d=>d.preventDefault()}>
|
|
464
|
-
${
|
|
467
|
+
${Fc(e).map((d,m)=>d.group?c`<li role="group" aria-labelledby="${r(this,ue)}-g${m}"><div role="presentation" class="gh" id="${r(this,ue)}-g${m}">${d.group}</div>
|
|
465
468
|
<ul role="none" class="gopts">${d.rows.map(({row:u,index:v})=>l(u,v))}</ul></li>`:d.rows.map(({row:u,index:v})=>l(u,v)))}
|
|
466
469
|
</ul>
|
|
467
470
|
</div>
|
|
468
471
|
${this.error?c`<p class="error" id="${r(this,ue)}-err" role="alert">${this.error}</p>`:h}
|
|
469
472
|
${this.helpText?c`<p class="help" id="${r(this,ue)}-help">${this.helpText}</p>`:h}
|
|
470
473
|
<slot></slot>
|
|
471
|
-
</div>`}};Xe=new WeakMap,ue=new WeakMap,
|
|
474
|
+
</div>`}};Xe=new WeakMap,ue=new WeakMap,aa=new WeakMap,lt=new WeakMap,sa=new WeakMap,ao=new WeakMap,F=new WeakSet,wm=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,aa,this.value))},$m=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},ro=function(e){if(this.disabled||this.loading)return;let t=this.items.findIndex(i=>i.value===this.value);this.open=!0,this._active=e??(t>=0?t:s(this,F,$m).call(this)[0]??-1)},ra=function(){this.open=!1},Zi=function(e){let t=this.items[e];!t||t.disabled||(s(this,F,ra).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}))))},ci=function(e){let t=s(this,F,$m).call(this);if(!t.length)return;if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);this._active=i<0?t[0]:t[Math.min(t.length-1,Math.max(0,i+e))]},Gc=function(e){let t=Date.now();g(this,lt,t-r(this,sa)>500?e:r(this,lt)+e),g(this,sa,t);let i=this.items,a=this._active<0?0:this._active,l=r(this,lt).split("").every(u=>u===r(this,lt)[0]),d=l?r(this,lt)[0]:r(this,lt),m=l||r(this,lt).length===1?a+1:a;for(let u=0;u<i.length;u++){let v=(m+u)%i.length;if(!i[v].disabled&&i[v].label.toLowerCase().startsWith(d.toLowerCase()))return v}return-1},Yc=new WeakMap,so=new WeakMap,Xc=new WeakMap,$g=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},Jc=new WeakMap,di.formAssociated=!0,di.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},di.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}},di.styles=[E,Ge,Ac,li,x`
|
|
472
475
|
:host { display: block; position: relative; }
|
|
473
476
|
.label { cursor: default; }
|
|
474
477
|
.wrap { position: relative; }
|
|
@@ -501,16 +504,16 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
501
504
|
[role='group'] { display: block; }
|
|
502
505
|
slot { display: none; }
|
|
503
506
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
504
|
-
`];$("cm-select",
|
|
507
|
+
`];$("cm-select",di);var Ow=z("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),oa,Zc,no,Te,na,kg,Eg,km,hi=class extends T{constructor(){super(...arguments);p(this,Te);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;p(this,oa,this.attachInternals());p(this,Zc,A("cm-search"));p(this,no,"")}connectedCallback(){super.connectedCallback(),g(this,no,this.value)}get form(){return r(this,oa).form}checkValidity(){return r(this,oa).checkValidity()}formResetCallback(){this.value=r(this,no)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,oa).setFormValue(this.value)}render(){return c`<div class="box" part="box">
|
|
505
508
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
506
|
-
<input id=${r(this,
|
|
509
|
+
<input id=${r(this,Zc)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
507
510
|
aria-label=${this.label} .value=${ne(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
508
|
-
@input=${s(this,Te,
|
|
509
|
-
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,Te,
|
|
511
|
+
@input=${s(this,Te,kg)} @change=${()=>s(this,Te,na).call(this,"change")} @keydown=${s(this,Te,Eg)} />
|
|
512
|
+
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,Te,km)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
510
513
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
511
514
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
512
|
-
@click=${()=>s(this,Te,
|
|
513
|
-
</div>`}};
|
|
515
|
+
@click=${()=>s(this,Te,na).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}
|
|
516
|
+
</div>`}};oa=new WeakMap,Zc=new WeakMap,no=new WeakMap,Te=new WeakSet,na=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},kg=function(e){this.value=e.target.value},Eg=function(e){e.key==="Enter"?s(this,Te,na).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),s(this,Te,km).call(this))},km=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),s(this,Te,na).call(this,"input"),s(this,Te,na).call(this,"change")},hi.formAssociated=!0,hi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},hi.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}},hi.styles=[E,Ge,x`
|
|
514
517
|
:host { display: block; }
|
|
515
518
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
516
519
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -544,7 +547,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
544
547
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
545
548
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
546
549
|
:host([disabled]) button { cursor: not-allowed; }
|
|
547
|
-
`];$("cm-search",
|
|
550
|
+
`];$("cm-search",hi);var Vw=z("tag",{remove:"Remove {label}"}),Qc,Mg,Qi=class extends T{constructor(){super(...arguments);p(this,Qc);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||this.t("remove",{label:this.textContent?.trim()??""}).trim();return c`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?c`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${s(this,Qc,Mg)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};Qc=new WeakSet,Mg=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Qi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Qi.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Qi.styles=[E,x`
|
|
548
551
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
549
552
|
.tag {
|
|
550
553
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -562,17 +565,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
562
565
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
563
566
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
|
|
564
567
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
|
|
565
|
-
`];$("cm-tag",
|
|
566
|
-
`):[]:this.value=e)}get items(){return this.options?.length?
|
|
567
|
-
`))}else r(this,Ae).setFormValue(null);else r(this,Ae).setFormValue(this.value||null,this.value);let i=this.multiple?!this.values.length:!this.value;this.error?r(this,Ae).setValidity({customError:!0},this.error,t):this.required&&i?r(this,Ae).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),t):r(this,Ae).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,ge)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),s(this,L,
|
|
568
|
+
`];$("cm-tag",Qi);var e0=z("combobox",{noResults:"No results",results:{one:"{count} result",other:"{count} results"},add:"Add \u201C{value}\u201D",remove:"Remove {label}",required:"Please select an item in the list.",requiredMultiple:"Choose at least one item.",grouped:"{group}: {label}",more:"+{count} more"}),Ae,ge,ho,da,mo,po,uo,L,Em,Tg,oo,ed,lo,la,ca,Rt,zg,co,Mm,Tm,er,td,id,tr,_g,rd,ad,sd,Cg,Sg,mi=class extends T{constructor(){super(...arguments);p(this,L);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.size="default";this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.maxTags=3;this._query="";this._focusIn=!1;this._active=-1;this._slotted=[];this._typing=!1;p(this,Ae,this.attachInternals());p(this,ge,A("cm-cb"));p(this,ho,null);p(this,da,new Map);p(this,mo,new Map);p(this,po,new MutationObserver(()=>s(this,L,Em).call(this)));p(this,uo);p(this,td,()=>{this._focusIn=!0});p(this,id,()=>{setTimeout(()=>{this._focusIn=this.matches(":focus-within")})});p(this,rd,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,s(this,L,ca).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});p(this,ad,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?s(this,L,co).call(this,1):(s(this,L,ca).call(this),e.altKey||s(this,L,co).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?s(this,L,co).call(this,-1):(s(this,L,ca).call(this),s(this,L,co).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),s(this,L,Mm).call(this,this._active)):r(this,L,ed)&&(e.preventDefault(),s(this,L,Tm).call(this,r(this,L,ed)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),s(this,L,Rt).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",s(this,L,la).call(this)));break;case"ArrowLeft":case"ArrowRight":{let i=e.target;this.multiple&&this.values.length&&J(e,this)==="ArrowLeft"&&i.selectionStart===0&&i.selectionEnd===0&&(e.preventDefault(),s(this,L,Rt).call(this),s(this,L,tr).call(this,this.values.length-1));break}case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":s(this,L,Rt).call(this);break;default:}});p(this,sd,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(s(this,L,Rt).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?s(this,L,oo).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),s(this,L,Em).call(this),r(this,po).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),g(this,uo,Bc(this,()=>this.open,()=>s(this,L,Rt).call(this))),this.addEventListener("focusin",r(this,td)),this.addEventListener("focusout",r(this,id))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,po).disconnect(),(e=r(this,uo))==null||e.call(this)}get form(){return r(this,Ae).form}get validity(){return r(this,Ae).validity}get validationMessage(){return r(this,Ae).validationMessage}checkValidity(){return r(this,Ae).checkValidity()}reportValidity(){return r(this,Ae).reportValidity()}formResetCallback(){let e=r(this,ho)??{value:"",values:[]};this.value=e.value,this.values=[...e.values],this._query="",this._typing=!1,this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){typeof e=="string"&&(this.multiple?this.values=e?e.split(`
|
|
569
|
+
`):[]:this.value=e)}get items(){return this.options?.length?ia(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):ia(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let i=t.label.toLowerCase();return this.filter==="starts-with"?i.startsWith(e):i.includes(e)})}firstUpdated(){g(this,ho,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,da).set(t.value,t.label),t.group&&r(this,mo).set(t.value,t.group);if((e.has("value")||e.has("options")||e.has("_slotted")||e.has("showGroup"))&&!this.multiple&&!this._typing&&(this._query=this.value?s(this,L,oo).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=s(this,L,lo).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let a=new FormData;for(let l of this.values)a.append(this.name,l);r(this,Ae).setFormValue(a,this.values.join(`
|
|
570
|
+
`))}else r(this,Ae).setFormValue(null);else r(this,Ae).setFormValue(this.value||null,this.value);let i=this.multiple?!this.values.length:!this.value;this.error?r(this,Ae).setValidity({customError:!0},this.error,t):this.required&&i?r(this,Ae).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),t):r(this,Ae).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,ge)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),s(this,L,la).call(this))}focus(e){this.renderRoot.querySelector("input")?.focus(e)}render(){let e=s(this,L,lo).call(this),t=[this.error&&`${r(this,ge)}-err`,this.helpText&&`${r(this,ge)}-help`].filter(Boolean).join(" "),i=this.getAttribute("aria-label"),a=m=>this.multiple?this.values.includes(m):m===this.value,l=(m,u)=>c`<li role="option" id="${r(this,ge)}-o${u}" class=${u===this._active?"active":""}
|
|
568
571
|
aria-selected=${m.create?"false":a(m.value)?"true":"false"} aria-disabled=${m.disabled?"true":h}
|
|
569
|
-
@pointerenter=${()=>!m.disabled&&(this._active=u)} @click=${()=>s(this,L,
|
|
570
|
-
${m.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:m.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${s(this,L,
|
|
572
|
+
@pointerenter=${()=>!m.disabled&&(this._active=u)} @click=${()=>s(this,L,Mm).call(this,u)}>
|
|
573
|
+
${m.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:m.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${s(this,L,Cg).call(this,m.label)}</span>`}</li>`,d=this.loading?this.loadingText||this.t("loading"):this.open?e.length?this.t("results",{count:e.length}):this.emptyText||this.t("noResults"):"";return c`<div class="field">
|
|
571
574
|
${this.label?c`<label class="label" id="${r(this,ge)}-l" for="${r(this,ge)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
572
575
|
<div class="wrap">
|
|
573
|
-
<div class="box" part="box" @click=${m=>{m.target.closest("cm-tag[removable]")||s(this,L,
|
|
576
|
+
<div class="box" part="box" @click=${m=>{m.target.closest("cm-tag[removable]")||s(this,L,er).call(this)}}>
|
|
574
577
|
<div class="chips ${this.multiple&&this.values.length?`has-tags${this._focusIn||this.open?"":" idle"}`:""}">
|
|
575
|
-
${this.multiple?s(this,L,
|
|
578
|
+
${this.multiple?s(this,L,Sg).call(this):h}
|
|
576
579
|
<input id="${r(this,ge)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
577
580
|
.value=${ne(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
578
581
|
aria-label=${!this.label&&i?i:h}
|
|
@@ -580,17 +583,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
580
583
|
aria-activedescendant=${this.open&&this._active>=0?`${r(this,ge)}-o${this._active}`:h}
|
|
581
584
|
aria-invalid=${this.error?"true":h} aria-describedby=${t||h}
|
|
582
585
|
aria-required=${this.required?"true":h} ?disabled=${this.disabled}
|
|
583
|
-
@input=${r(this,
|
|
584
|
-
@click=${()=>{this.open||s(this,L,
|
|
586
|
+
@input=${r(this,rd)} @keydown=${r(this,ad)} @blur=${r(this,sd)}
|
|
587
|
+
@click=${()=>{this.open||s(this,L,ca).call(this)}} @change=${m=>m.stopPropagation()} />
|
|
585
588
|
</div>
|
|
586
|
-
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,L,
|
|
589
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,L,Rt).call(this):(s(this,L,ca).call(this),s(this,L,er).call(this))}}></cm-icon>
|
|
587
590
|
</div>
|
|
588
591
|
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${m=>m.preventDefault()}>
|
|
589
592
|
<ul role="listbox" id="${r(this,ge)}-list" part="listbox" ?hidden=${!e.length}
|
|
590
593
|
aria-labelledby=${this.label?`${r(this,ge)}-l`:h} aria-label=${!this.label&&i?i:h}
|
|
591
594
|
aria-multiselectable=${this.multiple?"true":h}>
|
|
592
|
-
${
|
|
593
|
-
<ul role="none" class="gopts">${m.rows.map(({row:v,index:
|
|
595
|
+
${Fc(e).map((m,u)=>m.group?c`<li role="group" aria-labelledby="${r(this,ge)}-g${u}"><div role="presentation" class="gh" id="${r(this,ge)}-g${u}">${m.group}</div>
|
|
596
|
+
<ul role="none" class="gopts">${m.rows.map(({row:v,index:f})=>l(v,f))}</ul></li>`:m.rows.map(({row:v,index:f})=>l(v,f)))}
|
|
594
597
|
</ul>
|
|
595
598
|
${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>`}
|
|
596
599
|
</div>
|
|
@@ -599,10 +602,10 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
599
602
|
${this.error?c`<p class="error" id="${r(this,ge)}-err" role="alert">${this.error}</p>`:h}
|
|
600
603
|
${this.helpText?c`<p class="help" id="${r(this,ge)}-help">${this.helpText}</p>`:h}
|
|
601
604
|
<slot></slot>
|
|
602
|
-
</div>`}};Ae=new WeakMap,ge=new WeakMap,
|
|
603
|
-
remove-label=${this.t("remove",{label:s(this,L,
|
|
604
|
-
@keydown=${l=>s(this,L,
|
|
605
|
-
@cm-remove=${()=>{this.removeValue(i),s(this,L,
|
|
605
|
+
</div>`}};Ae=new WeakMap,ge=new WeakMap,ho=new WeakMap,da=new WeakMap,mo=new WeakMap,po=new WeakMap,uo=new WeakMap,L=new WeakSet,Em=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated){let t=e.filter(i=>i.hasAttribute("selected")).map(i=>i.value);this.multiple&&!this.values.length&&t.length&&(this.values=t),!this.multiple&&!this.value&&t.length&&(this.value=t[0])}},Tg=function(e){return this.items.find(t=>t.value===e)?.label??r(this,da).get(e)??e},oo=function(e){let t=s(this,L,Tg).call(this,e);if(!this.showGroup)return t;let i=this.items.find(a=>a.value===e)?.group??r(this,mo).get(e);return i?this.t("grouped",{group:i,label:t}):t},ed=function(){if(!this.allowCustom||!this._typing)return"";let e=this._query.trim();if(!e)return"";let t=e.toLowerCase();return this.items.some(i=>i.label.toLowerCase()===t||i.value.toLowerCase()===t)||(this.multiple?this.values.some(i=>i.toLowerCase()===t):this.value.toLowerCase()===t)?"":e},lo=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,L,ed);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},la=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ca=function(){this.disabled||(this.open=!0)},Rt=function(){this.open=!1,this._active=-1},zg=function(e=s(this,L,lo).call(this)){return e.flatMap((t,i)=>t.disabled?[]:[i])},co=function(e){let t=s(this,L,zg).call(this);if(!t.length){this._active=-1;return}if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);if(i<0){this._active=e>0?t[0]:t[t.length-1];return}this._active=t[(i+e+t.length)%t.length]},Mm=function(e){let t=s(this,L,lo).call(this)[e];if(!(!t||t.disabled)){if(t.create){s(this,L,Tm).call(this,t.value);return}if(this.multiple){this.values=this.values.includes(t.value)?this.values.filter(i=>i!==t.value):[...this.values,t.value],this._query="",this._typing=!1,this._active=-1,s(this,L,la).call(this),s(this,L,er).call(this);return}s(this,L,Rt).call(this),this._typing=!1,this._query=this.showGroup&&t.group?this.t("grouped",{group:t.group,label:t.label}):t.label,t.value!==this.value&&(this.value=t.value,s(this,L,la).call(this))}},Tm=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,da).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(s(this,L,Rt).call(this),this.value=e,this._typing=!1,this._query=e),s(this,L,la).call(this))},er=function(){this.renderRoot.querySelector("input")?.focus()},td=new WeakMap,id=new WeakMap,tr=async function(e){await this.updateComplete;let t=this.renderRoot.querySelectorAll("cm-tag[data-i]");e>=0&&e<t.length?t[e].focus():s(this,L,er).call(this)},_g=function(e,t){let i=J(e,this),a=this.values.length-1;if(i==="ArrowLeft")e.preventDefault(),s(this,L,tr).call(this,Math.max(0,t-1));else if(i==="ArrowRight")e.preventDefault(),s(this,L,tr).call(this,t<a?t+1:-1);else if(i==="Home")e.preventDefault(),s(this,L,tr).call(this,0);else if(i==="End")e.preventDefault(),s(this,L,tr).call(this,a);else if(i==="Escape")e.preventDefault(),e.stopPropagation(),s(this,L,er).call(this);else if((i==="Backspace"||i==="Delete")&&!this.disabled){e.preventDefault(),this.removeValue(this.values[t]);let l=this.values.length;s(this,L,tr).call(this,i==="Backspace"?t>0?t-1:l?0:-1:t<l?t:-1)}},rd=new WeakMap,ad=new WeakMap,sd=new WeakMap,Cg=function(e){let t=this._typing?this._query.trim():"";if(!t||this.filter==="none")return e;let i=e.toLowerCase().indexOf(t.toLowerCase());return i<0||this.filter==="starts-with"&&i!==0?e:c`${e.slice(0,i)}<mark>${e.slice(i,i+t.length)}</mark>${e.slice(i+t.length)}`},Sg=function(){let e=this.maxTags>0&&!this._focusIn&&!this.open&&this.values.length>this.maxTags?this.maxTags:this.values.length,t=this.values.length-e;return c`${this.values.slice(0,e).map((i,a)=>c`<cm-tag removable tabindex="-1" data-i=${a} part="tag" ?disabled=${this.disabled}
|
|
606
|
+
remove-label=${this.t("remove",{label:s(this,L,oo).call(this,i)})}
|
|
607
|
+
@keydown=${l=>s(this,L,_g).call(this,l,a)}
|
|
608
|
+
@cm-remove=${()=>{this.removeValue(i),s(this,L,er).call(this)}}>${s(this,L,oo).call(this,i)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},mi.formAssociated=!0,mi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},mi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},values:{type:Array},placeholder:{},options:{type:Array},multiple:{type:Boolean,reflect:!0},size:{reflect:!0},allowCustom:{type:Boolean,attribute:"allow-custom"},filter:{},loading:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},maxTags:{type:Number,attribute:"max-tags"},_query:{state:!0},_focusIn:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},mi.styles=[E,Ge,ta,Ac,li,x`
|
|
606
609
|
:host { display: block; position: relative; }
|
|
607
610
|
.wrap { position: relative; }
|
|
608
611
|
.box {
|
|
@@ -643,7 +646,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
643
646
|
.create { font-style: normal; }
|
|
644
647
|
slot { display: none; }
|
|
645
648
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
646
|
-
`];$("cm-combobox",
|
|
649
|
+
`];$("cm-combobox",mi);function go(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var ay={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"};function nd(o,n){let e=o.trim().toLowerCase().split("+").map(a=>a.trim());e.length>1&&e[e.length-1]===""&&e[e.length-2]===""&&e.splice(-2,2,"+");let t=e.pop();if(!t)return null;let i={key:ay[t]??t,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let a of e)if(a==="mod")n?i.meta=!0:i.ctrl=!0;else if(a==="ctrl"||a==="control")i.ctrl=!0;else if(a==="meta"||a==="cmd"||a==="command")i.meta=!0;else if(a==="alt"||a==="option"||a==="opt")i.alt=!0;else if(a==="shift")i.shift=!0;else return null;return i}function zm(o,n=go()){let e=nd(o,n);return!!e&&(e.ctrl||e.meta||e.alt)}function _m(o,n,e=go()){let t=nd(n,e);if(!t||!o.key||o.ctrlKey!==t.ctrl||o.metaKey!==t.meta||o.altKey!==t.alt)return!1;let i=/^[a-z0-9]$/.test(t.key);return(i||t.key.length>1)&&o.shiftKey!==t.shift?!1:o.key.toLowerCase()===t.key?!0:i?o.code===(/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`):!1}function od(o){let n=o.composedPath()[0];return!!n&&(n.isContentEditable||/^(input|textarea|select)$/i.test(n.localName??""))}var sy={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7"},ny={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},oy={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"},ly=o=>oy[o]??(o.length===1?o.toUpperCase():o[0].toUpperCase()+o.slice(1));function ld(o,n=go()){let e=[];for(let t of o.trim().split(/\s+/).filter(Boolean)){let i=nd(t,n);if(!i)return[o.trim()];let a=n?sy:ny,l=n?["ctrl","alt","shift","meta"]:["ctrl","meta","alt","shift"];for(let d of l)i[d]&&e.push(a[d]);e.push(ly(i.key))}return e}function Lg(o,n=go()){if(/\s/.test(o.trim()))return"";let e=nd(o,n);if(!e)return"";let t=e.key===" "?"Space":e.key.length===1?e.key.toUpperCase():e.key.replace(/^(arrow|page)?(\w)/,(i,a,l)=>a?`${a[0].toUpperCase()}${a.slice(1)}${l.toUpperCase()}`:l.toUpperCase());return[e.ctrl&&"Control",e.meta&&"Meta",e.alt&&"Alt",e.shift&&"Shift",t].filter(Boolean).join("+")}var d0=z("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),Je,fo,X,cd,dd,ha,Cm,hd,Dg,md,bo,Sm,Ag,ir=class extends T{constructor(){super(...arguments);p(this,X);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;p(this,Je,A("cm-gs"));p(this,fo);p(this,hd,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),s(this,X,Cm).call(this)});p(this,md,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),s(this,X,Dg).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,X,dd)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,Je)}-o${this._active}`)?.click());break;case"Escape":r(this,X,dd)?(e.preventDefault(),e.stopPropagation(),s(this,X,ha).call(this)):this.value&&(e.preventDefault(),s(this,X,Sm).call(this,!1));break;case"Tab":s(this,X,ha).call(this);break;default:}});p(this,bo,e=>{!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented||od(e)||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),g(this,fo,Bc(this,()=>this.open,()=>s(this,X,ha).call(this))),document.addEventListener("keydown",r(this,bo))}disconnectedCallback(){var e;super.disconnectedCallback(),(e=r(this,fo))==null||e.call(this),document.removeEventListener("keydown",r(this,bo))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=s(this,X,cd).call(this).length&&(this._active=-1)}updated(e){(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,Je)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=s(this,X,cd).call(this),t=r(this,X,dd),i=e.filter(u=>u.item).length,a=this.loading&&t?this.loadingText:t?e.length?this.t("results",{count:i}):this.emptyText:"",l=-1,d=(this.results??[]).filter(u=>u?.items?.length),m=(u,v,f="")=>{let w=++l;return Kc({id:`${r(this,Je)}-o${w}`,active:w===this._active,href:u.href,cls:f,onHover:()=>this._active=w,onChoose:y=>s(this,X,Ag).call(this,y,u)},v)};return c`<div class="wrap">
|
|
647
650
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
648
651
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
649
652
|
|
|
@@ -652,22 +655,22 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
652
655
|
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,Je)}-list"
|
|
653
656
|
aria-activedescendant=${t&&this._active>=0?`${r(this,Je)}-o${this._active}`:h}
|
|
654
657
|
aria-keyshortcuts=${this.shortcut||h}
|
|
655
|
-
@input=${r(this,
|
|
658
|
+
@input=${r(this,hd)} @keydown=${r(this,md)}
|
|
656
659
|
@focus=${()=>{this.value.trim()&&(this.open=!0)}} @click=${()=>{this.value.trim()&&(this.open=!0)}} />
|
|
657
|
-
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,X,
|
|
660
|
+
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,X,Sm).call(this)}><cm-icon name="close" size="14"></cm-icon></button>`:this.shortcut?c`<kbd aria-hidden="true">${this.shortcut}</kbd>`:h}
|
|
658
661
|
</div>
|
|
659
662
|
<div class="pop" part="popover" ?hidden=${!t} @pointerdown=${u=>u.preventDefault()}>
|
|
660
663
|
<div role="listbox" id="${r(this,Je)}-list" part="listbox" aria-label=${this.label} ?hidden=${!e.length}>
|
|
661
|
-
${d.map((u,v)=>{let
|
|
662
|
-
${
|
|
663
|
-
${u.items.map(w=>m({group:u,item:w,href:w.href},
|
|
664
|
+
${d.map((u,v)=>{let f=u.total??u.items.length;return c`<div role="group" aria-labelledby="${r(this,Je)}-g${v}">
|
|
665
|
+
${Uc(`${r(this,Je)}-g${v}`,u.label,this.formatNumber(f),this.t("results",{count:f}))}
|
|
666
|
+
${u.items.map(w=>m({group:u,item:w,href:w.href},Vc(w)))}
|
|
664
667
|
${u.href?m({group:u,href:u.href},c`<span class="text">${u.seeAllLabel||this.seeAllLabel}</span>`,"all"):h}
|
|
665
668
|
</div>`})}
|
|
666
669
|
</div>
|
|
667
670
|
${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>`}
|
|
668
671
|
</div>
|
|
669
672
|
<span class="vh" role="status" aria-live="polite">${a}</span>
|
|
670
|
-
</div>`}};Je=new WeakMap,
|
|
673
|
+
</div>`}};Je=new WeakMap,fo=new WeakMap,X=new WeakSet,cd=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}]:[]])},dd=function(){return this.open&&!!this.value.trim()},ha=function(){this.open=!1,this._active=-1},Cm=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},hd=new WeakMap,Dg=function(e){this._active=Wc(this._active,e,s(this,X,cd).call(this).length)},md=new WeakMap,bo=new WeakMap,Sm=function(e=!0){this.value="",s(this,X,ha).call(this),e&&this.renderRoot.querySelector("input")?.focus(),s(this,X,Cm).call(this)},Ag=function(e,t){this.dispatchEvent(new CustomEvent("cm-select",{detail:{href:t.href,item:t.item,group:t.group},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault(),s(this,X,ha).call(this)},ir.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ir.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}},ir.styles=[E,ta,li,jc,x`
|
|
671
674
|
:host { display: block; position: relative; }
|
|
672
675
|
.wrap { position: relative; }
|
|
673
676
|
.box {
|
|
@@ -697,15 +700,15 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
697
700
|
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
698
701
|
}
|
|
699
702
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
700
|
-
`];$("cm-global-search",
|
|
703
|
+
`];$("cm-global-search",ir);var Lm=0,Rg="";function Dm(){Lm++===0&&(Rg=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function vo(){Lm>0&&--Lm===0&&(document.documentElement.style.overflow=Rg)}function Am(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var ma,Ht,pa,ua,pd,ud,gd,fd,bd,vd,ee=class extends T{constructor(){super(...arguments);p(this,ua);this.open=!1;this.label="";this.uid=A("cm-ovl");p(this,ma,null);p(this,Ht,!1);p(this,pa,!1);p(this,ud,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});p(this,gd,e=>{e.preventDefault(),this.requestClose("escape")});p(this,fd,()=>{this.open&&!this.dialog?.open&&(this.open=!1,s(this,ua,pd).call(this))});p(this,bd,e=>{g(this,pa,e.target===e.currentTarget)});p(this,vd,e=>{if(e.target===e.currentTarget&&r(this,pa)){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,pa,!1)});this.backdropFillsDialog=!1}show(){this.open=!0}close(){this.open=!1}requestClose(e="method"){let t=this.dispatchEvent(new CustomEvent("cm-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0}));return t&&(this.open=!1),t}closeNow(){this.open=!1;let e=this.dialog;e?.open&&(e.close(),s(this,ua,pd).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,ma,Am()),!this.isConnected)return;t.showModal(),r(this,Ht)||(Dm(),g(this,Ht,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),s(this,ua,pd).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,Ht)&&(vo(),g(this,Ht,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
701
704
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
702
705
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
703
706
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
704
707
|
</header>`}renderDialog(e,t=""){return c`<dialog part="dialog" class=${t}
|
|
705
708
|
aria-labelledby=${this.heading?`${this.uid}-h`:h}
|
|
706
709
|
aria-label=${!this.heading&&this.label?this.label:h}
|
|
707
|
-
@keydown=${r(this,
|
|
708
|
-
@pointerdown=${r(this,
|
|
710
|
+
@keydown=${r(this,ud)} @cancel=${r(this,gd)} @close=${r(this,fd)}
|
|
711
|
+
@pointerdown=${r(this,bd)} @click=${r(this,vd)}>${e}</dialog>`}};ma=new WeakMap,Ht=new WeakMap,pa=new WeakMap,ua=new WeakSet,pd=function(){r(this,Ht)&&(vo(),g(this,Ht,!1));let e=r(this,ma);g(this,ma,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},ud=new WeakMap,gd=new WeakMap,fd=new WeakMap,bd=new WeakMap,vd=new WeakMap,ee.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},ee.overlayStyles=[E,x`
|
|
709
712
|
:host { display: contents; }
|
|
710
713
|
dialog {
|
|
711
714
|
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
@@ -737,7 +740,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
737
740
|
|
|
738
741
|
}
|
|
739
742
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
740
|
-
`];var
|
|
743
|
+
`];var M0=z("commandPalette",{label:"Command palette",placeholder:"Search or run a command",recent:"Recent",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all"}),Hg=o=>o.normalize("NFD").replace(/\p{M}/gu,"").toLocaleLowerCase();function Ng(o,n){let e=Hg(n).split(/\s+/).filter(Boolean);if(!e.length)return!0;let t=Hg([o.title,...o.keywords??[]].join(" "));return e.every(i=>t.includes(i))}var xo,ve,Rm,Hm,yo,yd,xd,Ig,Pg,ga=class extends ee{constructor(){super();p(this,ve);this.value="";this.results=[];this.actions=[];this.recent=[];this.loading=!1;this.shortcut="";this._active=-1;p(this,xo,e=>{!this.shortcut||e.defaultPrevented||e.repeat||!_m(e,this.shortcut)||!this.open&&!zm(this.shortcut)&&od(e)||this.open&&!zm(this.shortcut)||(e.preventDefault(),this.toggle())});p(this,yd,e=>{this.value=e.target.value,this._active=s(this,ve,yo).call(this).length?0:-1,this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))});p(this,xd,e=>{let t=s(this,ve,yo).call(this).length;switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this._active=Wc(this._active,e.key==="ArrowDown"?1:-1,t);break;case"Home":case"End":if(e.shiftKey||!t)break;e.preventDefault(),this._active=e.key==="Home"?0:t-1;break;case"Enter":if(e.isComposing||this._active<0)break;e.preventDefault(),this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.click();break;default:}});this.label=void 0}toggle(){this.open?this.requestClose("method"):this.show()}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",r(this,xo))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",r(this,xo))}willUpdate(e){if(super.willUpdate?.(e),e.has("open")&&!this.open&&e.get("open")&&(this.value="",this._active=-1),["results","actions","recent","loading","value","open"].some(t=>e.has(t))){let t=s(this,ve,yo).call(this).length;(this._active>=t||this._active<0)&&(this._active=t?0:-1)}}updated(e){super.updated(e),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.scrollIntoView({block:"nearest"})}focusFirst(){let e=this.renderRoot.querySelector("input");e?.focus(),e?.select()}render(){let e=this.open?s(this,ve,Hm).call(this):[],t=s(this,ve,yo).call(this,e),i=r(this,ve,Rm),a=t.filter(u=>u.item).length,l=!this.open||!i?"":this.loading?this.loadingText:t.length?this.t("results",{count:a}):this.emptyText,d=this.uid,m=-1;return this.renderDialog(c`<div class="panel" part="panel">
|
|
741
744
|
<div class="top">
|
|
742
745
|
<div class="box" part="box">
|
|
743
746
|
<cm-icon name="search" size="16"></cm-icon>
|
|
@@ -745,8 +748,8 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
745
748
|
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${ne(this.value)}
|
|
746
749
|
aria-autocomplete="list" aria-expanded=${t.length?"true":"false"} aria-controls="${d}-list"
|
|
747
750
|
aria-activedescendant=${this._active>=0&&t.length?`${d}-o${this._active}`:h}
|
|
748
|
-
@input=${r(this,
|
|
749
|
-
<kbd class="esc" aria-hidden="true">${
|
|
751
|
+
@input=${r(this,yd)} @keydown=${r(this,xd)} />
|
|
752
|
+
<kbd class="esc" aria-hidden="true">${ld("escape")[0]}</kbd>
|
|
750
753
|
</div>
|
|
751
754
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel} @click=${()=>this.requestClose("close-button")}>
|
|
752
755
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
@@ -755,14 +758,14 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
755
758
|
${this.loading&&i?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText}</span></p>`:h}
|
|
756
759
|
<div role="listbox" id="${d}-list" part="listbox" aria-label=${this.label} ?hidden=${!t.length}>
|
|
757
760
|
${e.map((u,v)=>c`<div role="group" aria-labelledby="${d}-g${v}">
|
|
758
|
-
${
|
|
759
|
-
${u.rows.map(
|
|
761
|
+
${Uc(`${d}-g${v}`,u.group.label,u.group.total!==void 0?this.formatNumber(u.group.total):void 0,this.t("results",{count:u.group.total??0}))}
|
|
762
|
+
${u.rows.map(f=>{let w=++m,y=f.item;return Kc({id:`${d}-o${w}`,active:w===this._active,href:f.href,cls:y?"":"all",keyshortcuts:y?.shortcut?Lg(y.shortcut):void 0,onHover:()=>this._active=w,onChoose:k=>s(this,ve,Ig).call(this,k,f)},y?Vc(y,s(this,ve,Pg).call(this,y.shortcut)):c`<span class="text">${f.group.seeAllLabel||this.seeAllLabel}</span>`)})}
|
|
760
763
|
</div>`)}
|
|
761
764
|
</div>
|
|
762
765
|
${i&&!this.loading&&!t.length?c`<p class="message" aria-hidden="true">${this.emptyText}</p>`:h}
|
|
763
766
|
</div>
|
|
764
767
|
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
765
|
-
</div>`)}};
|
|
768
|
+
</div>`)}};xo=new WeakMap,ve=new WeakSet,Rm=function(){return this.value.trim()},Hm=function(){let e=r(this,ve,Rm),t=[],i=(a,l,d=!1)=>{let m=l.map(u=>({group:a,item:u,href:u.href}));d&&a.href&&m.push({group:a,href:a.href}),l.length&&t.push({group:a,rows:m})};if(!e)this.recent?.length&&i({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let a of this.results??[])a?.items?.length&&i(a,a.items,!0);for(let a of this.actions??[])a?.items?.length&&i(a,e?a.items.filter(l=>Ng(l,e)):a.items);return t},yo=function(e=s(this,ve,Hm).call(this)){return e.flatMap(t=>t.rows)},yd=new WeakMap,xd=new WeakMap,Ig=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)},Pg=function(e){return e?c`<span class="keys" aria-hidden="true">${ld(e).map(t=>c`<kbd>${t}</kbd>`)}</span>`:h},ga.properties={...ee.properties,label:{string:"label"},placeholder:{string:"placeholder"},value:{},results:{type:Array},actions:{type:Array},recent:{type:Array},loading:{type:Boolean,reflect:!0},shortcut:{},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},recentLabel:{attribute:"recent-label",string:"recent"},seeAllLabel:{attribute:"see-all-label",string:"seeAll"},_active:{state:!0}},ga.styles=[...ee.overlayStyles,ta,li,jc,x`
|
|
766
769
|
dialog {
|
|
767
770
|
position: fixed; inset: 0; margin: max(var(--cm-space-16), 12dvh) auto auto; height: fit-content;
|
|
768
771
|
width: min(var(--cm-command-palette-width, 640px), calc(100vw - 32px));
|
|
@@ -803,20 +806,20 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
803
806
|
.x { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
804
807
|
[role='option'] { min-height: var(--cm-control-height-touch); }
|
|
805
808
|
}
|
|
806
|
-
`];$("cm-command-palette",
|
|
807
|
-
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.previousLabel} ?disabled=${
|
|
809
|
+
`];$("cm-command-palette",ga);var cy=/^(\d{4})-(\d{2})-(\d{2})$/;function N(o){let n=cy.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 vt=(o,n=2)=>String(o).padStart(n,"0"),P=o=>`${vt(o.getFullYear(),4)}-${vt(o.getMonth()+1)}-${vt(o.getDate())}`,Nm=()=>P(new Date),G=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function Ze(o,n){let e=new Date(o.getFullYear(),o.getMonth()+n,1),t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return new Date(e.getFullYear(),e.getMonth(),Math.min(o.getDate(),t))}var Nt=o=>new Date(o.getFullYear(),o.getMonth(),1),fa=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var dy=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function rr(o){let n=dy.exec(o??"");return n?+n[1]*60+ +n[2]:null}var wo=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${vt(Math.floor(n/60))}:${vt(n%60)}`};function Qe(o){let[n="",e=""]=(o??"").split("T"),t=rr(e);return{date:N(n)?n:"",time:t===null?"":wo(t)}}function yt(o,n=!1){let{date:e,time:t}=Qe(o),i=N(e);if(!i)return null;let a=t?rr(t):n?1439:0;return new Date(i.getFullYear(),i.getMonth(),i.getDate(),Math.floor(a/60),a%60)}var Bg=()=>{let o=new Date;return`${P(o)}T${vt(o.getHours())}:${vt(o.getMinutes())}`},Og=new Map;function wd(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,i=Og.get(t);if(i)return i;let a={hour:"numeric",minute:"2-digit",numberingSystem:"latn",...e?{hourCycle:e}:{}},l=new Intl.DateTimeFormat(o,a),d=l.resolvedOptions().hourCycle,m=k=>new Date(2e3,0,1,k,30),u=k=>(new Intl.DateTimeFormat(o,{hour:"numeric",hourCycle:"h12"}).formatToParts(m(k)).find(D=>D.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),v=(k,D)=>[...new Set([k,...D].filter(Boolean))],f=k=>k.replace(/[\u202f\u00a0]/g," "),w=f(l.formatToParts(m(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=>ae(k,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",...e?{hourCycle:e}:{}},o),pattern:w,hour12:d==="h12"||d==="h11",am:v(u(9),["am","a"]),pm:v(u(15),["pm","p"])};return Og.set(t,y),y}var Fg=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function Im(o,n){let e=o.trim().toLowerCase().normalize("NFKC");if(!e)return null;let t=e.replace(/[^\p{L}]/gu,""),i=!!t&&n.pm.includes(t),a=!!t&&n.am.includes(t);if(t&&!i&&!a)return null;let l=e.match(/\d+/g)??[],d,m;if(l.length===1){let u=l[0];if(u.length<=2)d=+u,m=0;else if(u.length<=4)d=+u.slice(0,-2),m=+u.slice(-2);else return null}else if(l.length===2||l.length===3){if(l[0].length>2||l[1].length!==2)return null;d=+l[0],m=+l[1]}else return null;if(m>59)return null;if(a||i){if(d<1||d>12)return null;d=d%12+(i?12:0)}else if(d>23)return null;return wo(d*60+m)}var ba={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},$o=o=>Array.isArray(o)?o:typeof o=="string"?ba.fromAttribute(o):[];function va(o,n){let e=[n,qn(o)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function ya(o){try{let n=new Intl.Locale(o),e=n.getWeekInfo?.()??n.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var qg=new Map;function xa(o){let n=qg.get(o);if(n)return n;let e=y=>new Intl.DateTimeFormat(o,y),t=e({day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"}),i=e({weekday:"short"}),a=e({weekday:"long"}),l=new Date(2024,0,7),d=t.formatToParts(new Date(2026,10,15)),m=d.filter(y=>y.type==="day"||y.type==="month"||y.type==="year").map(y=>y.type),u=d.map(y=>y.type==="day"?"{d}":y.type==="month"?"{m}":y.type==="year"?"{y}":y.value).join(""),v=(y,k)=>Array.from({length:12},(D,H)=>new Intl.DateTimeFormat(y,{month:k}).format(new Date(2024,H,1)).toLowerCase().replace(/\./g,"")),f=Array.from({length:12},(y,k)=>[...new Set([v(o,"long")[k],v(o,"short")[k],v("en","long")[k],v("en","short")[k]])]),w={short:y=>t.format(y),long:y=>ae(y,{weekday:"long",day:"numeric",month:"long",year:"numeric"},o),medium:y=>ae(y,{day:"numeric",month:"short",year:"numeric"},o),monthYear:y=>ae(y,{month:"long",year:"numeric"},o),day:y=>ae(y,{day:"numeric"},o),weekdaysShort:Array.from({length:7},(y,k)=>i.format(G(l,k))),weekdaysLong:Array.from({length:7},(y,k)=>a.format(G(l,k))),pattern:m.length===3?u:"{y}-{m}-{d}",order:m.length===3?m:["year","month","day"],months:f};return qg.set(o,w),w}var $d=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function kd(o,n){let e=o.trim().toLowerCase();if(!e)return null;let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);if(t.length!==3)return null;let i,a,l,d=t.findIndex(u=>/\p{L}/u.test(u));if(d>=0){let u=t[d];a=n.months.findIndex(y=>y.some(k=>k===u||u.length>=3&&k.startsWith(u)))+1;let v=t.filter((y,k)=>k!==d);if(!a||v.some(y=>!/^\d+$/.test(y)))return null;let f=v.findIndex(y=>y.length===4),w=f>=0?f:1;i=+v[w],l=+v[1-w],v[w].length<=2&&(i+=2e3)}else{if(t.some(f=>!/^\d+$/.test(f)))return null;let u=t[0].length===4?["year","month","day"]:n.order,v=f=>t[u.indexOf(f)];if(i=+v("year"),a=+v("month"),l=+v("day"),v("year").length<=2)i+=2e3;else if(v("year").length!==4)return null}let m=`${vt(i,4)}-${vt(a)}-${vt(l)}`;return N(m)?m:null}function Ed(o,n,e,t){let i=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return G(e,1);case"ArrowLeft":return G(e,-1);case"ArrowDown":return G(e,7);case"ArrowUp":return G(e,-7);case"Home":return G(e,-i);case"End":return G(e,6-i);case"PageDown":return Ze(e,n.shiftKey?12:1);case"PageUp":return Ze(e,n.shiftKey?-12:-1);default:return null}}var pi=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function Md(o){let{fmt:n,firstDay:e,month:t,focus:i,min:a,max:l}=o,d=Nt(t),m=(d.getDay()-e+7)%7,u=fa(t).getDate(),v=[],f=Array(m).fill(null);for(let H=1;H<=u;H++)f.push(new Date(t.getFullYear(),t.getMonth(),H)),f.length===7&&(v.push(f),f=[]);f.length&&v.push([...f,...Array(7-f.length).fill(null)]);let w=Array.from({length:7},(H,B)=>(B+e)%7),y=Nm(),k=!!a&&fa(Ze(d,-1))<a,D=!!l&&Ze(d,1)>l;return c`<div class="cal-head">
|
|
810
|
+
<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>
|
|
808
811
|
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
809
812
|
<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>
|
|
810
813
|
</div>
|
|
811
814
|
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${o.id}-month" @keydown=${o.onKey}>
|
|
812
815
|
<thead><tr>${w.map(H=>c`<th scope="col" abbr=${n.weekdaysLong[H]}><span aria-hidden="true">${n.weekdaysShort[H]}</span><span class="vh">${n.weekdaysLong[H]}</span></th>`)}</tr></thead>
|
|
813
|
-
<tbody>${v.map(H=>c`<tr>${H.map(
|
|
814
|
-
tabindex=${
|
|
815
|
-
aria-selected=${
|
|
816
|
-
aria-current=${
|
|
817
|
-
aria-label="${n.long(
|
|
818
|
-
@click=${()=>!W&&o.onPick(
|
|
819
|
-
</table>`}var
|
|
816
|
+
<tbody>${v.map(H=>c`<tr>${H.map(B=>{if(!B)return c`<td class="empty"></td>`;let j=P(B),W=o.isDisabled(B)||!!a&&B<a||!!l&&B>l,zt=o.mark(B),K=o.note?.(B);return c`<td class="day ${zt} ${j===y?"today":""}" data-date=${j}
|
|
817
|
+
tabindex=${j===P(i)?"0":"-1"}
|
|
818
|
+
aria-selected=${zt?"true":"false"} aria-disabled=${W?"true":h}
|
|
819
|
+
aria-current=${j===y?"date":h}
|
|
820
|
+
aria-label="${n.long(B)}${K?`, ${K}`:""}"
|
|
821
|
+
@click=${()=>!W&&o.onPick(B)} @pointerenter=${()=>o.onHover?.(B)}><span aria-hidden="true">${n.day(B)}</span></td>`})}</tr>`)}</tbody>
|
|
822
|
+
</table>`}var Td=x`
|
|
820
823
|
.pop {
|
|
821
824
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-8)); inset-inline-start: 0;
|
|
822
825
|
width: max-content; max-width: calc(100vw - 32px); padding: var(--cm-space-12);
|
|
@@ -848,7 +851,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
848
851
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
849
852
|
}
|
|
850
853
|
@media (max-width: 640px) { .day, .empty { height: 36px; } }
|
|
851
|
-
`;function
|
|
854
|
+
`;function zd(o,n){if(o.key!=="Tab")return;let e=[...n.querySelectorAll('button:not([disabled]), [role=grid] td[tabindex="0"]')];if(!e.length)return;let t=n.getRootNode(),i=e.indexOf(t.activeElement);o.preventDefault(),e[(i+(o.shiftKey?-1:1)+e.length)%e.length].focus()}var _d=x`
|
|
852
855
|
${Ge}
|
|
853
856
|
:host { display: block; position: relative; }
|
|
854
857
|
.wrap { position: relative; }
|
|
@@ -880,45 +883,45 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
880
883
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
881
884
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
882
885
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
883
|
-
`;var
|
|
886
|
+
`;var I0=z("datePicker",{choose:"Choose date",chooseFor:"Choose date for {label}",change:"Change date, {date}",changeFor:"Change date for {label}, {date}",dialog:"Choose date",previousMonth:"Previous month",nextMonth:"Next month",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badInput:"Enter a date like {pattern}.",required:"Enter or choose a date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"This date isn't available. Choose another date.",time:"Time",timeFor:"Time for {label}",patternHour:"hh",patternMinute:"mm",badTime:"Enter a time like {pattern}.",timeMissing:"Enter a time.",stepMismatch:{one:"Choose a time on the minute.",other:"Choose a time in steps of {count} minutes."}}),Ea,he,et,Ma,qt,bi,Re,qe,Ta,za,M,ko,ui,_a,Cd,ar,wa,It,gi,Pt,Ot,Sd,Pm,Om,$a,sr,qm,Bm,jg,Ld,Ug,Fm,ka,Eo,Mo,jm,Vg,Dd,Um,Vm,Ad,Rd,Hd,Nd,Id,To,fi=class extends T{constructor(){super(...arguments);p(this,M);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.min="";this.max="";this.placeholder="";p(this,Ea,"");this.disabledDates=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this.time=!1;this.step=1;this.hourCycle="";this._text="";this._focus=new Date;p(this,he,this.attachInternals());p(this,et,A("cm-dp"));p(this,Ma,null);p(this,qt,!1);p(this,bi,!1);p(this,Re,"");p(this,qe,"");p(this,Ta,!1);p(this,za,"");p(this,_a,!1);p(this,Dd,e=>{e.key==="Enter"?s(this,M,jm).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),s(this,M,Vg).call(this,e.key==="ArrowUp"?1:-1))});p(this,Ad,()=>{this.disabled||(this.open?this.open=!1:(s(this,M,Mo).call(this),this.show()))});p(this,Rd,e=>{e.key==="Enter"?s(this,M,Mo).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),s(this,M,Mo).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});p(this,Hd,e=>{let t=Ed(J(e,this),e,this._focus,r(this,M,Pm));if(t){e.preventDefault(),this._focus=pi(t,r(this,M,Pt),r(this,M,Ot)),g(this,bi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,M,Um).call(this,this._focus))});p(this,Nd,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,M,Vm).call(this);return}zd(e,e.currentTarget)});p(this,Id,e=>{this._focus=pi(Ze(this._focus,e),r(this,M,Pt),r(this,M,Ot))});p(this,To,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ea)}set locale(e){let t=r(this,Ea);g(this,Ea,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Ma)===null&&g(this,Ma,this.value),document.addEventListener("pointerdown",r(this,To),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,To),!0)}get form(){return r(this,he).form}get validity(){return r(this,he).validity}get validationMessage(){return r(this,he).validationMessage}get valueAsDate(){return this.time?this.value?yt(this.value):null:N(this.value)}checkValidity(){return s(this,M,Ld).call(this),r(this,he).checkValidity()}reportValidity(){return s(this,M,Ld).call(this),r(this,he).reportValidity()}formResetCallback(){this.value=r(this,Ma)??"",this.time&&(s(this,M,Bm).call(this,this.value),g(this,M,s(this,M,sr).call(this,r(this,qe)),ui)),this._text=s(this,M,$a).call(this,r(this,M,It)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(s(this,M,jg).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=r(this,M,Pt),a=r(this,M,Ot);return i&&t<i||a&&t>a?!0:$o(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!r(this,_a)?(s(this,M,Bm).call(this,this.value),r(this,Ta)||g(this,M,s(this,M,sr).call(this,r(this,qe)),ui)):this.time&&(e.has("locale")||e.has("hourCycle"))&&r(this,qe)&&g(this,M,s(this,M,sr).call(this,r(this,qe)),ui),(e.has("value")||e.has("time"))&&!r(this,qt)?this._text=s(this,M,$a).call(this,r(this,M,It)):e.has("locale")&&N(r(this,M,It))&&(this._text=s(this,M,$a).call(this,r(this,M,It))),g(this,qt,!1),g(this,Ta,!1),g(this,_a,!1)}updated(e){r(this,he).setFormValue(this.value||null,this.time?this.value:this._text),s(this,M,Ld).call(this),this.open&&r(this,bi)&&(g(this,bi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&g(this,bi,!1)}render(){let e=r(this,M,ar),t=N(r(this,M,It)),i=[this.error&&`${r(this,et)}-err`,this.helpText&&`${r(this,et)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=this.label||a||"",d=Nt(this._focus);return c`<div class="field">
|
|
884
887
|
${this.label?c`<label class="label" for="${r(this,et)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
885
888
|
<div class="wrap ${this.time?"timed":""}">
|
|
886
889
|
<div class="box" part="box">
|
|
887
890
|
<input id="${r(this,et)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
888
|
-
.value=${ne(this._text)} placeholder=${this.placeholder||r(this,
|
|
891
|
+
.value=${ne(this._text)} placeholder=${this.placeholder||r(this,M,Om)}
|
|
889
892
|
aria-label=${!this.label&&a?a:h}
|
|
890
893
|
?required=${this.required} ?disabled=${this.disabled}
|
|
891
894
|
aria-invalid=${this.error?"true":h} aria-describedby=${i||h}
|
|
892
895
|
@input=${m=>{m.stopPropagation(),this._text=m.target.value}}
|
|
893
|
-
@change=${()=>s(this,
|
|
896
|
+
@change=${()=>s(this,M,Mo).call(this)} @keydown=${r(this,Rd)} />
|
|
894
897
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
895
898
|
aria-label=${t?this.t(l?"changeFor":"change",{label:l,date:e.long(t)}):this.t(l?"chooseFor":"choose",{label:l})}
|
|
896
899
|
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,et)}-pop"
|
|
897
|
-
@click=${r(this,
|
|
900
|
+
@click=${r(this,Ad)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
898
901
|
</div>
|
|
899
902
|
${this.time?c`<div class="box time" part="time-box">
|
|
900
903
|
<input class="time-in" part="time-input" type="text" autocomplete="off" spellcheck="false"
|
|
901
|
-
.value=${ne(r(this,
|
|
904
|
+
.value=${ne(r(this,M,ko))} placeholder=${r(this,M,qm)}
|
|
902
905
|
aria-label=${this.t(l?"timeFor":"time",{label:l})}
|
|
903
906
|
?required=${this.required} ?disabled=${this.disabled}
|
|
904
907
|
aria-invalid=${this.error?"true":h} aria-describedby=${i||h}
|
|
905
|
-
@input=${m=>{m.stopPropagation(),g(this,
|
|
906
|
-
@change=${()=>s(this,
|
|
908
|
+
@input=${m=>{m.stopPropagation(),g(this,M,m.target.value,ui)}}
|
|
909
|
+
@change=${()=>s(this,M,jm).call(this)} @keydown=${r(this,Dd)} />
|
|
907
910
|
</div>`:h}
|
|
908
911
|
<div class="pop" id="${r(this,et)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
909
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
910
|
-
${this.open?c`<div class="cal">${
|
|
912
|
+
?hidden=${!this.open} @keydown=${r(this,Nd)}>
|
|
913
|
+
${this.open?c`<div class="cal">${Md({id:r(this,et),fmt:e,firstDay:r(this,M,Pm),month:d,focus:this._focus,min:r(this,M,Pt),max:r(this,M,Ot),isDisabled:m=>this.isUnavailable(P(m)),mark:m=>t&&P(m)===r(this,M,It)?"selected":"",onPick:m=>s(this,M,Um).call(this,m),onKey:r(this,Hd),onMonth:r(this,Id),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:h}
|
|
911
914
|
</div>
|
|
912
915
|
</div>
|
|
913
916
|
${this.error?c`<p class="error" id="${r(this,et)}-err" role="alert">${this.error}</p>`:h}
|
|
914
917
|
${this.helpText?c`<p class="help" id="${r(this,et)}-help">${this.helpText}</p>`:h}
|
|
915
|
-
</div>`}};$a=new WeakMap,he=new WeakMap,et=new WeakMap,ka=new WeakMap,Ot=new WeakMap,bi=new WeakMap,Re=new WeakMap,qe=new WeakMap,Ea=new WeakMap,Ma=new WeakMap,E=new WeakSet,xo=function(){return r(this,Ma)},pi=function(e){e!==r(this,Ma)&&(g(this,Ma,e),this.requestUpdate())},Ta=new WeakMap,Ed=function(){return ba(this,this.locale)},rr=function(){return va(r(this,E,Ed))},ya=function(){return bd(r(this,E,Ed),this.hourCycle)},Nt=function(){return this.time?r(this,Re):this.value},ui=function(e){return this.time&&e.trim().toLowerCase()==="now"?Ng():e},It=function(){return N(Qe(s(this,E,ui).call(this,this.min)).date||this.min)},Pt=function(){return N(Qe(s(this,E,ui).call(this,this.max)).date||this.max)},Md=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Am=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,E,Ed)):(Math.trunc(e)%7+7)%7},Rm=function(){return fd(r(this,E,rr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},xa=function(e){let t=N(e);return t?r(this,E,rr).short(t):e},ar=function(e){let t=ir(e);return t===null?"":r(this,E,ya).format(t)},Hm=function(){return Ig(r(this,E,ya),{h:this.t("patternHour"),m:this.t("patternMinute")})},Nm=function(e){let{date:t,time:i}=Qe(e);g(this,Re,t),g(this,qe,t?i:"")},Pg=function(){let e=new Date,t=N(r(this,E,Nt))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=mi(t,r(this,E,It),r(this,E,Pt)),g(this,bi,!0)},Td=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,E,Nt)),i=r(this,E,rr);this.error?r(this,he).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,he).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,E,Rm)}),e):this.time?s(this,E,Og).call(this,t,e):this.required&&!t?r(this,he).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,E,It)&&t<r(this,E,It)?r(this,he).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,E,It))}),e):t&&r(this,E,Pt)&&t>r(this,E,Pt)?r(this,he).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,E,Pt))}),e):t&&this.isUnavailable(this.value)?r(this,he).setValidity({customError:!0},this.t("unavailable"),e):r(this,he).setValidity({})},Og=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(b,w,y,M=t)=>r(this,he).setValidity(b,this.t(w,y),M),l=ir(r(this,qe));if(r(this,E,xo).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,E,Hm)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,he).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=vt(`${r(this,Re)}T${r(this,qe)}`),m=vt(s(this,E,ui).call(this,this.min)),u=vt(s(this,E,ui).call(this,this.max),!0),v=(b,w)=>Qe(b).time?r(this,E,ya).dateTime(w):r(this,E,rr).medium(w);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,E,ui).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,E,ui).call(this,this.max),u)},i);if(l%r(this,E,Md))return a({stepMismatch:!0},"stepMismatch",{count:r(this,E,Md)},i);if(this.isUnavailable(r(this,Re)))return a({customError:!0},"unavailable");r(this,he).setValidity({})},Im=function(e){e!==this.value&&(this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},wa=function(e,t){g(this,Re,e),g(this,qe,t);let i=e&&t?`${e}T${t}`:"";g(this,Ta,!0),this.requestUpdate(),s(this,E,Im).call(this,i)},wo=function(e){this.time?s(this,E,wa).call(this,e,r(this,qe)):s(this,E,Im).call(this,e)},$o=function(){let e=this._text.trim();if(!e){s(this,E,wo).call(this,"");return}let t=vd(e,r(this,E,rr));t?(s(this,E,wo).call(this,t),this._text=s(this,E,xa).call(this,t)):(g(this,Ot,!0),s(this,E,wo).call(this,""))},Pm=function(){let e=r(this,E,xo).trim(),t=e?Dm(e,r(this,E,ya)):"";if(g(this,Ot,!0),t===null){g(this,Ea,!0),s(this,E,wa).call(this,r(this,Re),"");return}s(this,E,wa).call(this,r(this,Re),t),g(this,E,s(this,E,ar).call(this,t),pi)},qg=function(e){let t=r(this,E,Md),i=Dm(r(this,E,xo),r(this,E,ya));if(!i){let m=Qe(s(this,E,ui).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,Re)||r(this,Re)===m.date)?m.time:vo(u.getHours()*60+u.getMinutes()),ir(i)%t===0){g(this,Ot,!0),s(this,E,wa).call(this,r(this,Re),i),g(this,E,s(this,E,ar).call(this,i),pi);return}e=1}let a=ir(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=vo(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,Ot,!0),s(this,E,wa).call(this,r(this,Re),d),g(this,E,s(this,E,ar).call(this,d),pi)},zd=new WeakMap,Om=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,E,wo).call(this,t),this._text=s(this,E,xa).call(this,t),this.time&&!r(this,qe)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,E,qm).call(this))},qm=function(){this.renderRoot.querySelector(".trigger")?.focus()},_d=new WeakMap,Cd=new WeakMap,Sd=new WeakMap,Ld=new WeakMap,Dd=new WeakMap,ko=new WeakMap,gi.formAssociated=!0,gi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},gi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:ga},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_focus:{state:!0}},gi.styles=[k,kd,wd,x`.pop { min-width: 0; }`];$("cm-date-picker",gi);var q0=z("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month"}),ny={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[G(o,-1),G(o,-1)]],"last-7-days":["Last 7 days",o=>[G(o,-6),o]],"last-30-days":["Last 30 days",o=>[G(o,-29),o]],"last-90-days":["Last 90 days",o=>[G(o,-89),o]],"this-month":["This month",o=>[Ht(o),o]],"last-month":["Last month",o=>[Ht(Ze(o,-1)),ua(Ze(o,-1))]]},oy=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Bg(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=ny[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(oy(o))||t[0],start:P(a),end:P(l)}}var Ca,be,Be,Sa,La,vi,I,Bm,za,Fm,Bt,Ad,qt,Fg,Rd,_a,jm,jg,Hd,Nd,Id,Pd,Od,Eo,Um,fi=class extends T{constructor(){super(...arguments);p(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,Ca,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;p(this,be,this.attachInternals());p(this,Be,A("cm-drp"));p(this,Sa,null);p(this,La,!1);p(this,vi,!1);p(this,Bt,"start");p(this,Nd,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,_a).call(this,"start"),s(this,I,_a).call(this,"end"),this.show()))});p(this,Id,e=>t=>{t.key==="Enter"?s(this,I,_a).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,_a).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,Pd,e=>{let t=yd(J(e,this),e,this._focus,r(this,I,Fm));if(t){e.preventDefault(),this._focus=mi(t,N(this.min),N(this.max)),g(this,vi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,jm).call(this,this._focus))});p(this,Od,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,Hd).call(this);return}$d(e,e.currentTarget)});p(this,Eo,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ca)}set locale(e){let t=r(this,Ca);g(this,Ca,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Sa)||g(this,Sa,[this.start,this.end]),document.addEventListener("pointerdown",r(this,Eo),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Eo),!0)}get form(){return r(this,be).form}get validity(){return r(this,be).validity}get validationMessage(){return r(this,be).validationMessage}checkValidity(){return r(this,be).checkValidity()}reportValidity(){return r(this,be).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,Sa)??["",""],this._startText=s(this,I,qt).call(this,this.start),this._endText=s(this,I,qt).call(this,this.end),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=N(this.start)?this.start:"",this._draftEnd=N(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=mi(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),g(this,Bt,"start"),g(this,vi,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=N(this.min),a=N(this.max);return i&&t<i||a&&t>a?!0:yo(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,La)||(e.has("start")&&(this._startText=s(this,I,qt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,qt).call(this,this.end))),g(this,La,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,qt).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,qt).call(this,this.end)))}updated(){let e=N(this.start),t=N(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,be).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let a=this.renderRoot.querySelectorAll("input"),[l,d]=[a[0]??void 0,a[1]??void 0],m=r(this,I,za),u=N(this.min),v=N(this.max);this.error?r(this,be).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,be).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,I,Ad)}),l):this._endText.trim()&&!t?r(this,be).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Ad)}),d):this.required&&(!e||!t)?r(this,be).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,be).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,be).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,be).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,be).setValidity({customError:!0},this.t("unavailable"),l):r(this,be).setValidity({}),this.open&&r(this,vi)&&(g(this,vi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,za),t=N(this.start),i=N(this.end),a=[this.error&&`${r(this,Be)}-err`,this.helpText&&`${r(this,Be)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=yo(this.presets).map(b=>Bg(b,new Date,w=>this.t(w))).filter(b=>!!b),u=r(this,Bt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=b=>{let w=b==="start"?this._startText:this._endText;return c`<input id="${r(this,Be)}-${b}" type="text" autocomplete="off" spellcheck="false"
|
|
916
|
-
.value=${ne(w)} placeholder=${r(this,I,
|
|
917
|
-
aria-label=${
|
|
918
|
+
</div>`}};Ea=new WeakMap,he=new WeakMap,et=new WeakMap,Ma=new WeakMap,qt=new WeakMap,bi=new WeakMap,Re=new WeakMap,qe=new WeakMap,Ta=new WeakMap,za=new WeakMap,M=new WeakSet,ko=function(){return r(this,za)},ui=function(e){e!==r(this,za)&&(g(this,za,e),this.requestUpdate())},_a=new WeakMap,Cd=function(){return va(this,this.locale)},ar=function(){return xa(r(this,M,Cd))},wa=function(){return wd(r(this,M,Cd),this.hourCycle)},It=function(){return this.time?r(this,Re):this.value},gi=function(e){return this.time&&e.trim().toLowerCase()==="now"?Bg():e},Pt=function(){return N(Qe(s(this,M,gi).call(this,this.min)).date||this.min)},Ot=function(){return N(Qe(s(this,M,gi).call(this,this.max)).date||this.max)},Sd=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Pm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?ya(r(this,M,Cd)):(Math.trunc(e)%7+7)%7},Om=function(){return $d(r(this,M,ar),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},$a=function(e){let t=N(e);return t?r(this,M,ar).short(t):e},sr=function(e){let t=rr(e);return t===null?"":r(this,M,wa).format(t)},qm=function(){return Fg(r(this,M,wa),{h:this.t("patternHour"),m:this.t("patternMinute")})},Bm=function(e){let{date:t,time:i}=Qe(e);g(this,Re,t),g(this,qe,t?i:"")},jg=function(){let e=new Date,t=N(r(this,M,It))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=pi(t,r(this,M,Pt),r(this,M,Ot)),g(this,bi,!0)},Ld=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,M,It)),i=r(this,M,ar);this.error?r(this,he).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,he).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,M,Om)}),e):this.time?s(this,M,Ug).call(this,t,e):this.required&&!t?r(this,he).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,Pt)&&t<r(this,M,Pt)?r(this,he).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,Pt))}),e):t&&r(this,M,Ot)&&t>r(this,M,Ot)?r(this,he).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,Ot))}),e):t&&this.isUnavailable(this.value)?r(this,he).setValidity({customError:!0},this.t("unavailable"),e):r(this,he).setValidity({})},Ug=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(f,w,y,k=t)=>r(this,he).setValidity(f,this.t(w,y),k),l=rr(r(this,qe));if(r(this,M,ko).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,M,qm)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,he).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=yt(`${r(this,Re)}T${r(this,qe)}`),m=yt(s(this,M,gi).call(this,this.min)),u=yt(s(this,M,gi).call(this,this.max),!0),v=(f,w)=>Qe(f).time?r(this,M,wa).dateTime(w):r(this,M,ar).medium(w);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,M,gi).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,M,gi).call(this,this.max),u)},i);if(l%r(this,M,Sd))return a({stepMismatch:!0},"stepMismatch",{count:r(this,M,Sd)},i);if(this.isUnavailable(r(this,Re)))return a({customError:!0},"unavailable");r(this,he).setValidity({})},Fm=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})))},ka=function(e,t){g(this,Re,e),g(this,qe,t);let i=e&&t?`${e}T${t}`:"";g(this,_a,!0),this.requestUpdate(),s(this,M,Fm).call(this,i)},Eo=function(e){this.time?s(this,M,ka).call(this,e,r(this,qe)):s(this,M,Fm).call(this,e)},Mo=function(){let e=this._text.trim();if(!e){s(this,M,Eo).call(this,"");return}let t=kd(e,r(this,M,ar));t?(s(this,M,Eo).call(this,t),this._text=s(this,M,$a).call(this,t)):(g(this,qt,!0),s(this,M,Eo).call(this,""))},jm=function(){let e=r(this,M,ko).trim(),t=e?Im(e,r(this,M,wa)):"";if(g(this,qt,!0),t===null){g(this,Ta,!0),s(this,M,ka).call(this,r(this,Re),"");return}s(this,M,ka).call(this,r(this,Re),t),g(this,M,s(this,M,sr).call(this,t),ui)},Vg=function(e){let t=r(this,M,Sd),i=Im(r(this,M,ko),r(this,M,wa));if(!i){let m=Qe(s(this,M,gi).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,Re)||r(this,Re)===m.date)?m.time:wo(u.getHours()*60+u.getMinutes()),rr(i)%t===0){g(this,qt,!0),s(this,M,ka).call(this,r(this,Re),i),g(this,M,s(this,M,sr).call(this,i),ui);return}e=1}let a=rr(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=wo(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,qt,!0),s(this,M,ka).call(this,r(this,Re),d),g(this,M,s(this,M,sr).call(this,d),ui)},Dd=new WeakMap,Um=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,M,Eo).call(this,t),this._text=s(this,M,$a).call(this,t),this.time&&!r(this,qe)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,M,Vm).call(this))},Vm=function(){this.renderRoot.querySelector(".trigger")?.focus()},Ad=new WeakMap,Rd=new WeakMap,Hd=new WeakMap,Nd=new WeakMap,Id=new WeakMap,To=new WeakMap,fi.formAssociated=!0,fi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},fi.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:ba},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_focus:{state:!0}},fi.styles=[E,_d,Td,x`.pop { min-width: 0; }`];$("cm-date-picker",fi);var V0=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"}),hy={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[G(o,-1),G(o,-1)]],"last-7-days":["Last 7 days",o=>[G(o,-6),o]],"last-30-days":["Last 30 days",o=>[G(o,-29),o]],"last-90-days":["Last 90 days",o=>[G(o,-89),o]],"this-month":["This month",o=>[Nt(o),o]],"last-month":["Last month",o=>[Nt(Ze(o,-1)),fa(Ze(o,-1))]]},my=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Kg(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=hy[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(my(o))||t[0],start:P(a),end:P(l)}}var La,fe,Be,Da,Aa,yi,I,Km,Ca,Wm,Ft,Pd,Bt,Wg,Od,Sa,Gm,Gg,qd,Bd,Fd,jd,Ud,zo,Ym,vi=class extends T{constructor(){super(...arguments);p(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,La,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;p(this,fe,this.attachInternals());p(this,Be,A("cm-drp"));p(this,Da,null);p(this,Aa,!1);p(this,yi,!1);p(this,Ft,"start");p(this,Bd,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,Sa).call(this,"start"),s(this,I,Sa).call(this,"end"),this.show()))});p(this,Fd,e=>t=>{t.key==="Enter"?s(this,I,Sa).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,Sa).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,jd,e=>{let t=Ed(J(e,this),e,this._focus,r(this,I,Wm));if(t){e.preventDefault(),this._focus=pi(t,N(this.min),N(this.max)),g(this,yi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,Gm).call(this,this._focus))});p(this,Ud,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,qd).call(this);return}zd(e,e.currentTarget)});p(this,zo,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,La)}set locale(e){let t=r(this,La);g(this,La,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Da)||g(this,Da,[this.start,this.end]),document.addEventListener("pointerdown",r(this,zo),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,zo),!0)}get form(){return r(this,fe).form}get validity(){return r(this,fe).validity}get validationMessage(){return r(this,fe).validationMessage}checkValidity(){return r(this,fe).checkValidity()}reportValidity(){return r(this,fe).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,Da)??["",""],this._startText=s(this,I,Bt).call(this,this.start),this._endText=s(this,I,Bt).call(this,this.end),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=N(this.start)?this.start:"",this._draftEnd=N(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=pi(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),g(this,Ft,"start"),g(this,yi,!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:$o(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,Aa)||(e.has("start")&&(this._startText=s(this,I,Bt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,Bt).call(this,this.end))),g(this,Aa,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,Bt).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,Bt).call(this,this.end)))}updated(){let e=N(this.start),t=N(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,fe).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let a=this.renderRoot.querySelectorAll("input"),[l,d]=[a[0]??void 0,a[1]??void 0],m=r(this,I,Ca),u=N(this.min),v=N(this.max);this.error?r(this,fe).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,fe).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,I,Pd)}),l):this._endText.trim()&&!t?r(this,fe).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Pd)}),d):this.required&&(!e||!t)?r(this,fe).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,fe).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,fe).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,fe).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,fe).setValidity({customError:!0},this.t("unavailable"),l):r(this,fe).setValidity({}),this.open&&r(this,yi)&&(g(this,yi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,Ca),t=N(this.start),i=N(this.end),a=[this.error&&`${r(this,Be)}-err`,this.helpText&&`${r(this,Be)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=$o(this.presets).map(f=>Kg(f,new Date,w=>this.t(w))).filter(f=>!!f),u=r(this,Ft)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=f=>{let w=f==="start"?this._startText:this._endText;return c`<input id="${r(this,Be)}-${f}" type="text" autocomplete="off" spellcheck="false"
|
|
919
|
+
.value=${ne(w)} placeholder=${r(this,I,Pd)}
|
|
920
|
+
aria-label=${f==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
918
921
|
?required=${this.required} ?disabled=${this.disabled}
|
|
919
922
|
aria-invalid=${this.error?"true":h} aria-describedby=${a||h}
|
|
920
|
-
@input=${y=>{y.stopPropagation();let
|
|
921
|
-
@change=${()=>s(this,I,
|
|
923
|
+
@input=${y=>{y.stopPropagation();let k=y.target.value;f==="start"?this._startText=k:this._endText=k}}
|
|
924
|
+
@change=${()=>s(this,I,Sa).call(this,f)} @keydown=${r(this,Fd).call(this,f)} />`};return c`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,Be)}-l`:h} aria-label=${!this.label&&l?l:h}>
|
|
922
925
|
${this.label?c`<span class="label" id="${r(this,Be)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
923
926
|
<div class="wrap">
|
|
924
927
|
<div class="box" part="box">
|
|
@@ -926,15 +929,15 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
926
929
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
927
930
|
aria-label=${t&&i?this.t(d?"changeFor":"change",{label:d,start:e.long(t),end:e.long(i)}):this.t(d?"chooseFor":"choose",{label:d})}
|
|
928
931
|
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Be)}-pop"
|
|
929
|
-
@click=${r(this,
|
|
932
|
+
@click=${r(this,Bd)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
930
933
|
</div>
|
|
931
934
|
<div class="pop" id="${r(this,Be)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
932
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
935
|
+
?hidden=${!this.open} @keydown=${r(this,Ud)}>
|
|
933
936
|
${this.open?c`<div class="body">
|
|
934
|
-
${m.length?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${m.map(
|
|
935
|
-
<button type="button" class="preset" aria-pressed=${
|
|
936
|
-
@click=${()=>s(this,I,
|
|
937
|
-
<div class="cal">${
|
|
937
|
+
${m.length?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${m.map(f=>c`<li>
|
|
938
|
+
<button type="button" class="preset" aria-pressed=${f.start===this.start&&f.end===this.end?"true":"false"}
|
|
939
|
+
@click=${()=>s(this,I,Gg).call(this,f)}>${f.label}</button></li>`)}</ul>`:h}
|
|
940
|
+
<div class="cal">${Md({id:r(this,Be),fmt:e,firstDay:r(this,I,Wm),month:Nt(this._focus),focus:this._focus,min:N(this.min),max:N(this.max),isDisabled:f=>this.isUnavailable(P(f)),mark:f=>s(this,I,Ym).call(this,f),note:f=>{let w=s(this,I,Ym).call(this,f);return w==="start"?this.t("startNote"):w==="end"?this.t("endNote"):""},onPick:f=>s(this,I,Gm).call(this,f),onKey:r(this,jd),onMonth:f=>{this._focus=pi(Ze(this._focus,f),N(this.min),N(this.max))},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:f=>{r(this,Ft)==="end"&&(this._hover=f)}})}
|
|
938
941
|
<p class="status" aria-live="polite">${u}</p>
|
|
939
942
|
</div>
|
|
940
943
|
</div>`:h}
|
|
@@ -942,7 +945,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
942
945
|
</div>
|
|
943
946
|
${this.error?c`<p class="error" id="${r(this,Be)}-err" role="alert">${this.error}</p>`:h}
|
|
944
947
|
${this.helpText?c`<p class="help" id="${r(this,Be)}-help">${this.helpText}</p>`:h}
|
|
945
|
-
</div>`}};
|
|
948
|
+
</div>`}};La=new WeakMap,fe=new WeakMap,Be=new WeakMap,Da=new WeakMap,Aa=new WeakMap,yi=new WeakMap,I=new WeakSet,Km=function(){return va(this,this.locale)},Ca=function(){return xa(r(this,I,Km))},Wm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?ya(r(this,I,Km)):(Math.trunc(e)%7+7)%7},Ft=new WeakMap,Pd=function(){return $d(r(this,I,Ca),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Bt=function(e){let t=N(e);return t?r(this,I,Ca).short(t):e},Wg=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Od=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,s(this,I,Wg).call(this))},Sa=function(e){let t=(e==="start"?this._startText:this._endText).trim(),i=t?kd(t,r(this,I,Ca)):"";t&&!i&&g(this,Aa,!0);let a=e==="start"?[i??"",this.end]:[this.start,i??""];s(this,I,Od).call(this,...a),i&&(e==="start"?this._startText=s(this,I,Bt).call(this,i):this._endText=s(this,I,Bt).call(this,i))},Gm=function(e){let t=P(e);if(!this.isUnavailable(t)){if(r(this,Ft)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",g(this,Ft,"end"),this._focus=e,g(this,yi,!0);return}this._draftEnd=t,this.open=!1,s(this,I,Od).call(this,this._draftStart,t),s(this,I,qd).call(this)}},Gg=function(e){this.open=!1,s(this,I,Od).call(this,e.start,e.end),s(this,I,qd).call(this)},qd=function(){this.renderRoot.querySelector(".trigger")?.focus()},Bd=new WeakMap,Fd=new WeakMap,jd=new WeakMap,Ud=new WeakMap,zo=new WeakMap,Ym=function(e){let t=P(e),i=this._draftStart,a=this._draftEnd||(r(this,Ft)==="end"&&i?P(this._hover??this._focus):"");return t===i?"start":t===a&&a>i?"end":i&&a&&t>i&&t<a?"in-range":""},vi.formAssociated=!0,vi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},vi.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:ba},isDateDisabled:{attribute:!1},presets:{converter:ba},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}},vi.styles=[E,_d,Td,x`
|
|
946
949
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
947
950
|
input { flex: 0 1 6.6em; }
|
|
948
951
|
:host([size='small']) input { flex-basis: 6.6em; }
|
|
@@ -962,56 +965,56 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
962
965
|
.presets li { flex: 0 0 auto; }
|
|
963
966
|
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
964
967
|
}
|
|
965
|
-
`];$("cm-date-range-picker",
|
|
968
|
+
`];$("cm-date-range-picker",vi);var J0=z("fileUpload",{prompt:"Drag files here or {browse}",browse:"Browse",drop:"Drop files to upload",uploading:"Uploading {name}",cancel:"Cancel uploading {name}",cancelShort:"Cancel",addMore:"Add more",files:"Chosen files",remove:"Remove {name}",kilobytes:"{size} KB",megabytes:"{size} MB",required:"Please choose a file.",wrongType:"{name} is not an allowed file type",tooLarge:"{name} is larger than {size}",tooMany:"You can add up to {max} files",takePhoto:"Take a photo",retake:"Retake",removePhoto:"Remove",retakeName:"Retake {name}",removeName:"Remove {name}",photo:"photo"});function py(o,n){if(!n.trim())return!0;let e=o.name.toLowerCase(),t=o.type.toLowerCase();return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).some(i=>i.startsWith(".")?e.endsWith(i):i.endsWith("/*")?t.startsWith(i.slice(0,-1)):t===i)}var tt,ie,jt,O,_o,Xm,Vd,Kd,Jm,Zm,Qm,ep,nr,Yg,Xg,tp,Jg,Zg,xi=class extends T{constructor(){super(...arguments);p(this,O);this.label="";this.hint="";this.name="";this.accept="";this.multiple=!1;this.maxSize=0;this.maxFiles=0;this.required=!1;this.disabled=!1;this.error="";this.files=[];this._rejected="";this._progress=new Map;this._fileErrors=new Map;this._over=!1;p(this,tt,this.attachInternals());p(this,ie,A("cm-fu"));p(this,jt,new Map)}get form(){return r(this,tt).form}get validity(){return r(this,tt).validity}get validationMessage(){return r(this,tt).validationMessage}checkValidity(){return r(this,tt).checkValidity()}reportValidity(){return r(this,tt).reportValidity()}formResetCallback(){this.files=[],this._rejected="",this._progress=new Map,this._fileErrors=new Map}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,jt).values())URL.revokeObjectURL(e);r(this,jt).clear()}updated(e){if(e.has("files"))for(let[l,d]of r(this,jt))this.files.includes(l)||(URL.revokeObjectURL(d),r(this,jt).delete(l));let t=new FormData;for(let l of this.files)t.append(this.name||"file",l);r(this,tt).setFormValue(this.files.length?t:null);let i=(r(this,O,_o)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,a=this.error||this._rejected;a?r(this,tt).setValidity({customError:!0},a,i):this.required&&!this.files.length?r(this,tt).setValidity({valueMissing:!0},this.t("required"),i):r(this,tt).setValidity({})}addFiles(e){let t=[...e],i=[],a=[],l=[];for(let m of t)py(m,r(this,O,Xm))?this.maxSize&&m.size>this.maxSize?(a.push(m),l.push(this.t("tooLarge",{name:m.name,size:s(this,O,Kd).call(this,this.maxSize)}))):i.push(m):(a.push(m),l.push(this.t("wrongType",{name:m.name})));let d=r(this,O,Vd)?[...this.files,...i]:i.slice(-1);!r(this,O,Vd)&&!i.length&&(d=this.files),r(this,O,Vd)&&this.maxFiles&&d.length>this.maxFiles&&(a.push(...d.slice(this.maxFiles)),l.push(this.t("tooMany",{max:this.maxFiles})),d=d.slice(0,this.maxFiles)),this._rejected=l.join(". "),a.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:a}})),d!==this.files&&(d.length!==this.files.length||d.some((m,u)=>m!==this.files[u]))&&(this.files=d,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}setProgress(e,t){let i=new Map(this._progress);t==null?i.delete(e):i.set(e,Math.min(100,Math.max(0,Number(t)||0))),this._progress=i}setFileError(e,t){let i=new Map(this._fileErrors);t?i.set(e,t):i.delete(e),this._fileErrors=i}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this._progress.has(e)&&this.setProgress(e,null),this._fileErrors.has(e)&&this.setFileError(e,""),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){if(r(this,O,_o))return s(this,O,Zg).call(this);let e=this.error||this._rejected,t=!this.files.length||this.multiple,i=this.files.length>0;return c`
|
|
966
969
|
${this.label||this.hint&&i?c`<div class="head">
|
|
967
970
|
${this.label?c`<span class="label" id="${r(this,ie)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
968
971
|
${this.hint&&i?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h}
|
|
969
972
|
</div>`:h}
|
|
970
973
|
${i?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
971
|
-
${this.files.map(a=>s(this,O,
|
|
972
|
-
${t?c`<li>${s(this,O,
|
|
973
|
-
</ul>`:s(this,O,
|
|
974
|
+
${this.files.map(a=>s(this,O,Xg).call(this,a))}
|
|
975
|
+
${t?c`<li>${s(this,O,tp).call(this,!0)}</li>`:h}
|
|
976
|
+
</ul>`:s(this,O,tp).call(this,!1)}
|
|
974
977
|
${e?c`<p class="msg" id="${r(this,ie)}-msg" role="alert">${e}</p>`:h}
|
|
975
|
-
`}};tt=new WeakMap,ie=new WeakMap,
|
|
976
|
-
${e.type.startsWith("image/")?c`<img src=${s(this,O,
|
|
978
|
+
`}};tt=new WeakMap,ie=new WeakMap,jt=new WeakMap,O=new WeakSet,_o=function(){return this.variant==="photo"},Xm=function(){return this.accept||(r(this,O,_o)?"image/*":"")},Vd=function(){return this.multiple&&!r(this,O,_o)},Kd=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})})},Jm=function(e){let t=r(this,jt).get(e);return t||(t=URL.createObjectURL(e),r(this,jt).set(e,t)),t},Zm=function(e){return this._progress.has(e)},Qm=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)},ep=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},nr=function(e){this.toggleAttribute("data-over",e),this._over=e},Yg=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}`},Xg=function(e){let t=s(this,O,Zm).call(this,e),i=this._fileErrors.get(e)??"",a=`${r(this,ie)}-e${this.files.indexOf(e)}`,l=this._progress.get(e)??0;return c`<li class="item"><div class="file ${t?"busy":""} ${i?"invalid":""}">
|
|
979
|
+
${e.type.startsWith("image/")?c`<img src=${s(this,O,Jm).call(this,e)} alt=${e.name} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${s(this,O,Kd).call(this,e.size)}</span></div>`}
|
|
977
980
|
${t?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
978
981
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(l)}><span style="inline-size:${l}%"></span></div>`:h}
|
|
979
|
-
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>s(this,O,
|
|
982
|
+
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>s(this,O,Qm).call(this,e)}><cm-icon name="close" size="12"></cm-icon></button>`:c`<button type="button" class="remove" aria-label=${this.t("remove",{name:e.name})} aria-describedby=${i?a:h}
|
|
980
983
|
@click=${()=>this.removeFile(e)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
981
|
-
</div>${i?c`<p class="ferr" id=${a} role="alert">${i}</p>`:h}</li>`},
|
|
982
|
-
@dragenter=${()=>s(this,O,
|
|
984
|
+
</div>${i?c`<p class="ferr" id=${a} role="alert">${i}</p>`:h}</li>`},tp=function(e){let t=[this.hint&&`${r(this,ie)}-hint`,(this.error||this._rejected)&&`${r(this,ie)}-msg`].filter(Boolean).join(" "),i=this.error||this._rejected;return c`<label class="zone ${e?"tile":"row"} ${i&&!e?"invalid":""}" part="zone"
|
|
985
|
+
@dragenter=${()=>s(this,O,nr).call(this,!0)} @dragleave=${()=>s(this,O,nr).call(this,!1)} @drop=${()=>s(this,O,nr).call(this,!1)}>
|
|
983
986
|
<input type="file" id=${r(this,ie)} accept=${this.accept||h} capture=${this.capture||h} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
984
987
|
?required=${this.required&&!this.files.length}
|
|
985
988
|
aria-labelledby=${[this.label&&`${r(this,ie)}-l`,`${r(this,ie)}-p`].filter(Boolean).join(" ")}
|
|
986
989
|
aria-describedby=${t||h} aria-invalid=${this.error||this._rejected?"true":h}
|
|
987
|
-
@change=${s(this,O,
|
|
990
|
+
@change=${s(this,O,ep)} @cancel=${a=>a.stopPropagation()} />
|
|
988
991
|
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${r(this,ie)}-p">${this.t("addMore")}</span>`:c`<span class="ico"><cm-icon name="upload" size="20"></cm-icon></span>
|
|
989
|
-
<span class="words"><span id="${r(this,ie)}-p">${s(this,O,
|
|
990
|
-
</label>`},
|
|
992
|
+
<span class="words"><span id="${r(this,ie)}-p">${s(this,O,Yg).call(this)}</span>${this.hint?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h}</span>`}
|
|
993
|
+
</label>`},Jg=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Zg=function(){let e=this.files[0],t=this.error||this._rejected||e&&this._fileErrors.get(e)||"",i=!!e&&s(this,O,Zm).call(this,e),a=this.label||this.t("photo"),l=[this.hint&&`${r(this,ie)}-hint`,t&&`${r(this,ie)}-msg`].filter(Boolean).join(" "),d=u=>c`<input type="file" id=${r(this,ie)} accept=${r(this,O,Xm)} capture=${this.capture||h}
|
|
991
994
|
?disabled=${this.disabled} ?required=${this.required&&!e} tabindex=${u?"-1":h} aria-hidden=${u?"true":h}
|
|
992
995
|
?hidden=${u} aria-labelledby=${u?h:`${r(this,ie)}-p`} aria-describedby=${!u&&l||h} aria-invalid=${t?"true":h}
|
|
993
|
-
@change=${s(this,O,
|
|
996
|
+
@change=${s(this,O,ep)} @cancel=${v=>v.stopPropagation()} />`,m=this.hint?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h;return c`
|
|
994
997
|
${e?c`<div class="shot ${i?"busy":""}" part="photo">
|
|
995
|
-
${e.type.startsWith("image/")?c`<img src=${s(this,O,
|
|
998
|
+
${e.type.startsWith("image/")?c`<img src=${s(this,O,Jm).call(this,e)} alt=${a} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${s(this,O,Kd).call(this,e.size)}</span></div>`}
|
|
996
999
|
${i?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
997
1000
|
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}
|
|
998
1001
|
</div>
|
|
999
1002
|
<p class="caption" aria-hidden="true">${this.label}</p>
|
|
1000
1003
|
${d(!0)}
|
|
1001
1004
|
${this.disabled?h:i?c`<div class="actions" part="actions">
|
|
1002
|
-
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,O,
|
|
1005
|
+
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,O,Qm).call(this,e)}><cm-icon name="close" size="16"></cm-icon>${this.t("cancelShort")}</button>
|
|
1003
1006
|
</div>`:c`<div class="actions" part="actions">
|
|
1004
|
-
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,ie)}-msg`:h} @click=${s(this,O,
|
|
1007
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,ie)}-msg`:h} @click=${s(this,O,Jg)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
1005
1008
|
<button type="button" class="action" aria-label=${this.t("removeName",{name:a})} @click=${()=>this.removeFile(e)}><cm-icon name="trash" size="16"></cm-icon>${this.t("removePhoto")}</button>
|
|
1006
1009
|
</div>`}`:c`<label class="zone photo ${t?"invalid":""}" part="zone photo"
|
|
1007
|
-
@dragenter=${()=>s(this,O,
|
|
1010
|
+
@dragenter=${()=>s(this,O,nr).call(this,!0)} @dragleave=${()=>s(this,O,nr).call(this,!1)} @drop=${()=>s(this,O,nr).call(this,!1)}>
|
|
1008
1011
|
${d(!1)}
|
|
1009
1012
|
<cm-icon name="camera" size="24"></cm-icon>
|
|
1010
1013
|
<span class="photo-label" id="${r(this,ie)}-p" part="label">${this.label||this.t("takePhoto")}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
1011
1014
|
${m}
|
|
1012
1015
|
</label>`}
|
|
1013
1016
|
${t?c`<p class="msg" id="${r(this,ie)}-msg" role="alert">${t}</p>`:h}
|
|
1014
|
-
`},
|
|
1017
|
+
`},xi.formAssociated=!0,xi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},xi.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}},xi.styles=[E,x`
|
|
1015
1018
|
:host { display: block; }
|
|
1016
1019
|
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-8); margin-bottom: var(--cm-space-12); }
|
|
1017
1020
|
.label { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1095,33 +1098,33 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1095
1098
|
@media (max-width: 640px) {
|
|
1096
1099
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
1097
1100
|
}
|
|
1098
|
-
`];$("cm-file-upload",
|
|
1099
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1101
|
+
`];$("cm-file-upload",xi);var s1=z("colorField",{swatch:"{name}, {hex}",hex:"Hex code",hexNamed:"{label}, hex code",placeholder:"#RRGGBB",picker:"Choose a custom colour",pickerNamed:"Choose a custom colour for {label}",required:"Please choose a colour.",invalid:"Enter a colour as #RRGGBB, for example #2e6faf.",black:"Black",grey:"Grey",lightGrey:"Light grey",red:"Red",darkOrange:"Dark orange",orange:"Orange",yellow:"Yellow",lightGreen:"Light green",green:"Green",lightBlue:"Light blue",blue:"Blue",indigo:"Indigo"}),uy=[{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 Ut(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 gy=o=>{let n=parseInt(o.slice(1),16);return[n>>16&255,n>>8&255,n&255].map(e=>e/255).map(e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,i)=>e+t*[.2126,.7152,.0722][i],0)};function fy(o){let n=gy(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var Fe,xt,Co,Ra,Y,or,ip,Qg,ef,rp,tf,rf,af,sf,wi=class extends T{constructor(){super(...arguments);p(this,Y);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.picker=!1;this.required=!1;this.disabled=!1;this._invalid=!1;p(this,Fe,this.attachInternals());p(this,xt,A("cm-cf"));p(this,Co,"");p(this,Ra)}connectedCallback(){super.connectedCallback(),g(this,Co,Ut(this.value)??this.value)}get form(){return r(this,Fe).form}get validity(){return r(this,Fe).validity}get validationMessage(){return r(this,Fe).validationMessage}checkValidity(){return r(this,Fe).checkValidity()}reportValidity(){return r(this,Fe).reportValidity()}formResetCallback(){this.value=r(this,Co),this._draft=void 0,this._invalid=!1}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get items(){return this.swatches?this.swatches.flatMap(e=>{let t=typeof e=="string"?{value:e}:e,i=Ut(t?.value??"");return i?[{value:i,name:t.name}]:[]}):uy.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=Ut(this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==r(this,Ra)&&(this._draft=void 0,this._invalid=!1),g(this,Ra,void 0)}}updated(){let e=!this.value||Ut(this.value)!==null;r(this,Fe).setFormValue(this.value&&e?this.value:null,this.value);let t=this.renderRoot.querySelector(".input")??void 0;this.error?r(this,Fe).setValidity({customError:!0},this.error,t):this._invalid||!e?r(this,Fe).setValidity({patternMismatch:!0},this.t("invalid"),t):this.required&&!this.value?r(this,Fe).setValidity({valueMissing:!0},this.t("required"),t):r(this,Fe).setValidity({})}render(){let e=this.items,t=Ut(this.value??""),i=e.findIndex(u=>u.value===t),a=this.error||(this._invalid||this.value&&!t?this.t("invalid"):""),l=[a&&`${r(this,xt)}-err`,this.helpText&&`${r(this,xt)}-help`].filter(Boolean).join(" ")||h,d=this.getAttribute("aria-label"),m=this.label||d||"";return c`<div class="field">
|
|
1102
|
+
${this.label?c`<span class="label" id="${r(this,xt)}-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}
|
|
1100
1103
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
1101
|
-
aria-labelledby=${this.label?`${r(this,
|
|
1104
|
+
aria-labelledby=${this.label?`${r(this,xt)}-l`:h} aria-label=${!this.label&&d?d:h}
|
|
1102
1105
|
aria-required=${this.required?"true":h} aria-describedby=${l}>
|
|
1103
|
-
${e.map((u,v)=>{let
|
|
1104
|
-
aria-label=${
|
|
1105
|
-
style="background-color:${u.value};color:${
|
|
1106
|
-
@click=${()=>s(this,Y,
|
|
1106
|
+
${e.map((u,v)=>{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=${v===i?"true":"false"}
|
|
1107
|
+
aria-label=${f} title=${u.name||u.value} tabindex=${v===(i>=0?i:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
1108
|
+
style="background-color:${u.value};color:${fy(u.value)}"
|
|
1109
|
+
@click=${()=>s(this,Y,ip).call(this,v)} @keydown=${w=>s(this,Y,Qg).call(this,w,v)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
1107
1110
|
</div>`:h}
|
|
1108
1111
|
<div class="row">
|
|
1109
1112
|
${this.picker?c`<label class="pick" part="picker" style=${t?`background-color:${t}`:h}>
|
|
1110
1113
|
<input type="color" .value=${ne(t??"#000000")} ?disabled=${this.disabled}
|
|
1111
1114
|
aria-label=${m?this.t("pickerNamed",{label:m}):this.t("picker")}
|
|
1112
|
-
@input=${s(this,Y,
|
|
1115
|
+
@input=${s(this,Y,af)} @change=${s(this,Y,sf)} />
|
|
1113
1116
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1114
1117
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${t?`background-color:${t}`:h}></span>`}
|
|
1115
|
-
<input class="input" part="input" id=${r(this,
|
|
1118
|
+
<input class="input" part="input" id=${r(this,xt)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
1116
1119
|
maxlength="7" .value=${ne(this._draft??this.value??"")} placeholder=${this.t("placeholder")}
|
|
1117
1120
|
aria-label=${m?this.t("hexNamed",{label:m}):this.t("hex")}
|
|
1118
1121
|
?required=${this.required} ?disabled=${this.disabled}
|
|
1119
1122
|
aria-invalid=${a?"true":h} aria-describedby=${l}
|
|
1120
|
-
@input=${s(this,Y,
|
|
1123
|
+
@input=${s(this,Y,ef)} @change=${s(this,Y,tf)} @keydown=${s(this,Y,rf)} />
|
|
1121
1124
|
</div>
|
|
1122
|
-
${a?c`<p class="error" id="${r(this,
|
|
1123
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
1124
|
-
</div>`}};Fe=new WeakMap,
|
|
1125
|
+
${a?c`<p class="error" id="${r(this,xt)}-err" role="alert">${a}</p>`:h}
|
|
1126
|
+
${this.helpText?c`<p class="help" id="${r(this,xt)}-help">${this.helpText}</p>`:h}
|
|
1127
|
+
</div>`}};Fe=new WeakMap,xt=new WeakMap,Co=new WeakMap,Ra=new WeakMap,Y=new WeakSet,or=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},ip=function(e){let t=this.items[e];!t||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".swatch")[e]?.focus()),this._draft=void 0,this._invalid=!1,t.value!==this.value&&(this.value=t.value,s(this,Y,or).call(this,"input","change")))},Qg=function(e,t){let i=this.items.length,a=J(e,this),l;if(a==="ArrowRight"||e.key==="ArrowDown")l=(t+1)%i;else if(a==="ArrowLeft"||e.key==="ArrowUp")l=(t-1+i)%i;else if(e.key==="Home")l=0;else if(e.key==="End")l=i-1;else if(e.key===" "||e.key==="Enter")l=t;else return;e.preventDefault(),s(this,Y,ip).call(this,l)},ef=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let i=/^#?[0-9a-f]{6}$/i.test(t.trim())?Ut(t):null;i&&i!==this.value&&(g(this,Ra,i),this.value=i,s(this,Y,or).call(this,"input")),this._invalid&&(i||!t.trim())&&(this._invalid=!1)},rp=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?Ut(e):"";if(t===null){this._invalid=!0;return}let i=this.value;this.value=t,this._draft=void 0,this._invalid=!1,t!==i&&s(this,Y,or).call(this,"input"),s(this,Y,or).call(this,"change")},tf=function(e){e.stopPropagation(),s(this,Y,rp).call(this)},rf=function(e){e.key==="Enter"&&s(this,Y,rp).call(this)},af=function(e){e.stopPropagation();let t=Ut(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,s(this,Y,or).call(this,"input"))},sf=function(e){e.stopPropagation(),s(this,Y,or).call(this,"change")},wi.formAssociated=!0,wi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},wi.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}},wi.styles=[E,Ge,x`
|
|
1125
1128
|
:host { display: block; }
|
|
1126
1129
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
1127
1130
|
.swatch {
|
|
@@ -1160,18 +1163,18 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1160
1163
|
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
1161
1164
|
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
1162
1165
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
1163
|
-
`];$("cm-color-field",
|
|
1166
|
+
`];$("cm-color-field",wi);var m1=z("signatureField",{modes:"How to sign",draw:"Draw",type:"Type",pad:"Signature drawing area",padSigned:"Signature drawing area, signed",instructions:"Draw your signature with a mouse, finger or pen. To sign with the keyboard, choose Type.",signHere:"Sign here",typeLabel:"Type your full name",typePlaceholder:"Type your full name",undo:"Undo",undoLabel:"Undo last stroke",clear:"Clear",clearLabel:"Clear signature",cleared:"Signature cleared",undone:"Last stroke removed",required:"Please sign here."}),ap=3,Wd=.7,by=.0055,Gd="#000000",nf=8,So=2,vy=400,yy=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),it,Lo,Ha,Do,rt,at,st,ki,Ei,ze,Ao,Mi,Na,C,sp,Yd,np,Vt,Xd,op,lp,of,cp,Jd,dp,Zd,lf,hp,cf,lr,Qd,mp,pp,df,up,hf,gp,mf,pf,$i=class extends T{constructor(){super(...arguments);p(this,C);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.mode="draw";this.typedName="";this.required=!1;this.disabled=!1;this._announce="";p(this,it,this.attachInternals());p(this,Lo,A("cm-sig"));p(this,Ha,"");p(this,Do,"");p(this,rt,[]);p(this,at);p(this,st);p(this,ki,"");p(this,Ei,0);p(this,ze);p(this,Ao,"");p(this,Mi);p(this,Na,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?s(this,C,sp).call(this):(g(this,Ha,this.value),g(this,Do,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),r(this,Mi)?.disconnect(),g(this,Mi,void 0),cancelAnimationFrame(r(this,Ei)),g(this,Ei,0),r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0))}get form(){return r(this,it).form}get validity(){return r(this,it).validity}get validationMessage(){return r(this,it).validationMessage}checkValidity(){return r(this,it).checkValidity()}reportValidity(){return r(this,it).reportValidity()}formResetCallback(){g(this,rt,[]),g(this,at,void 0),g(this,st,void 0),r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0)),this.typedName=r(this,Do),r(this,Ha)?(g(this,ki,""),this.value=r(this,Ha)):this.updateComplete.then(()=>s(this,C,lr).call(this,!1)),s(this,C,Vt).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!r(this,rt).length&&!r(this,st)}toDataURL(){return s(this,C,mp).call(this)?.toDataURL("image/png")??""}toBlob(){let e=s(this,C,mp).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(g(this,rt,[]),g(this,at,void 0),g(this,st,void 0),s(this,C,Vt).call(this)),s(this,C,lr).call(this,!0)}undo(){this.mode==="draw"&&(r(this,rt).length?r(this,rt).pop():g(this,st,void 0),g(this,at,void 0),s(this,C,Vt).call(this),s(this,C,lr).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==r(this,ki)){let t=this.value??"";if(g(this,ki,t),g(this,rt,[]),g(this,at,void 0),!t)g(this,st,void 0),this.hasUpdated&&(this.typedName="");else{let i=new Image;i.addEventListener("load",()=>{r(this,st)===i&&s(this,C,Vt).call(this)}),i.src=t,g(this,st,i),this.mode="draw"}s(this,C,Vt).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();g(this,ki,t),this.value=t}}firstUpdated(){s(this,C,sp).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>s(this,C,lr).call(this,!1)),s(this,C,Zd).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&s(this,C,Zd).call(this),r(this,it).setFormValue(this.value||null,this.value);let t=(this.mode==="type"?this.renderRoot.querySelector(".typed"):this.renderRoot.querySelector('.tab[aria-selected="true"]'))??void 0;this.error?r(this,it).setValidity({customError:!0},this.error,t):this.required&&this.empty?r(this,it).setValidity({valueMissing:!0},this.t("required"),t):r(this,it).setValidity({})}render(){let e=r(this,Lo),t=this.getAttribute("aria-label"),i=this.error,a=[i&&`${e}-err`,this.helpText&&`${e}-help`].filter(Boolean).join(" "),l=this.empty,d=!r(this,rt).length&&!r(this,st),m=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
1164
1167
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
1165
1168
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
1166
|
-
@click=${()=>s(this,C,
|
|
1169
|
+
@click=${()=>s(this,C,pp).call(this,u,!0)} @keydown=${s(this,C,df)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
1167
1170
|
${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}
|
|
1168
1171
|
<div class="bar">
|
|
1169
1172
|
<div class="tabs" role="tablist" part="tabs"
|
|
1170
1173
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
1171
1174
|
aria-label=${this.label?h:t||this.t("modes")}>${m("draw")}${m("type")}</div>
|
|
1172
1175
|
<div class="actions">
|
|
1173
|
-
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,
|
|
1174
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,
|
|
1176
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,mf)}>${this.t("undo")}</button>`:h}
|
|
1177
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,pf)}>${this.t("clear")}</button>
|
|
1175
1178
|
</div>
|
|
1176
1179
|
</div>
|
|
1177
1180
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -1181,8 +1184,8 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1181
1184
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
1182
1185
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
1183
1186
|
aria-describedby=${[`${e}-instr`,a].filter(Boolean).join(" ")}
|
|
1184
|
-
@pointerdown=${s(this,C,
|
|
1185
|
-
@lostpointercapture=${s(this,C,
|
|
1187
|
+
@pointerdown=${s(this,C,of)} @pointermove=${s(this,C,cp)} @pointerup=${s(this,C,Jd)} @pointercancel=${s(this,C,Jd)}
|
|
1188
|
+
@lostpointercapture=${s(this,C,Jd)} @transitionend=${()=>s(this,C,Xd).call(this)}></canvas>
|
|
1186
1189
|
</div>
|
|
1187
1190
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
1188
1191
|
</div>
|
|
@@ -1194,13 +1197,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1194
1197
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
1195
1198
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
1196
1199
|
aria-describedby=${a||h} ?disabled=${this.disabled}
|
|
1197
|
-
@input=${s(this,C,
|
|
1200
|
+
@input=${s(this,C,lf)} @change=${s(this,C,cf)} />
|
|
1198
1201
|
</div>
|
|
1199
1202
|
</div>
|
|
1200
1203
|
${i?c`<p class="error" id="${e}-err" role="alert">${i}</p>`:h}
|
|
1201
1204
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
1202
1205
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
1203
|
-
</div>`}};it=new WeakMap,
|
|
1206
|
+
</div>`}};it=new WeakMap,Lo=new WeakMap,Ha=new WeakMap,Do=new WeakMap,rt=new WeakMap,at=new WeakMap,st=new WeakMap,ki=new WeakMap,Ei=new WeakMap,ze=new WeakMap,Ao=new WeakMap,Mi=new WeakMap,Na=new WeakMap,C=new WeakSet,sp=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,Mi)||(g(this,Mi,new ResizeObserver(()=>s(this,C,np).call(this))),r(this,Mi).observe(e))},Yd=function(){return this.renderRoot.querySelector("canvas")},np=function(){let e=r(this,C,Yd);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;g(this,Na,t);let a=window.devicePixelRatio||1,l=Math.round(t*a),d=Math.round(i*a);(e.width!==l||e.height!==d)&&(e.width=l,e.height=d),s(this,C,Xd).call(this)},Vt=function(){r(this,Ei)||g(this,Ei,requestAnimationFrame(()=>{g(this,Ei,0),s(this,C,Xd).call(this)}))},Xd=function(){let e=r(this,C,Yd);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,Na);if(!i)return;let a=e.width/i;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),t.setTransform(a,0,0,a,0,0);let l=getComputedStyle(e).color||Gd;s(this,C,op).call(this,t,i,l,!0)},op=function(e,t,i,a){let l=t/ap,d=r(this,st);if(d?.complete&&d.naturalWidth){let m=Math.min(t*.9/d.naturalWidth,l*.9/d.naturalHeight),u=d.naturalWidth*m,v=d.naturalHeight*m,f=(t-u)/2,w=(l-v)/2;if(a&&!$y(i,Gd)){let y=document.createElement("canvas");y.width=Math.max(1,Math.round(u*2)),y.height=Math.max(1,Math.round(v*2));let k=y.getContext("2d");k.drawImage(d,0,0,y.width,y.height),k.globalCompositeOperation="source-in",k.fillStyle=i,k.fillRect(0,0,y.width,y.height),e.drawImage(y,f,w,u,v)}else e.drawImage(d,f,w,u,v)}e.strokeStyle=i,e.fillStyle=i,e.lineCap="round",e.lineJoin="round";for(let m of r(this,rt))xy(e,m,t)},lp=function(e,t){let i=e.pointerType==="pen"&&e.pressure>0?e.pressure:.5;return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.width,p:i}},of=function(e){if(this.disabled||r(this,at)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.currentTarget;e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}let i=[s(this,C,lp).call(this,e,t.getBoundingClientRect())];g(this,at,{id:e.pointerId,stroke:i}),r(this,rt).push(i),s(this,C,Vt).call(this)},cp=function(e){let t=r(this,at);if(!t||e.pointerId!==t.id)return;e.preventDefault();let i=e.currentTarget.getBoundingClientRect(),a=typeof e.getCoalescedEvents=="function"?e.getCoalescedEvents():[];for(let l of a.length?a:[e]){let d=s(this,C,lp).call(this,l,i),m=t.stroke[t.stroke.length-1];Math.hypot(d.x-m.x,d.y-m.y)*i.width<1.5||t.stroke.push(d)}s(this,C,Vt).call(this)},Jd=function(e){let t=r(this,at);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&s(this,C,cp).call(this,e),g(this,at,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}s(this,C,Vt).call(this),s(this,C,lr).call(this,!0)}},dp=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},Zd=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${r(this,C,dp)}`,i=!0;try{i=e.check(t,this.typedName||"Signature")}catch{}i||e.load(t,this.typedName||"Signature").then(()=>{this.mode==="type"&&this.typedName.trim()&&s(this,C,lr).call(this,!1)},()=>{})},lf=function(e){e.stopPropagation(),r(this,ze)?clearTimeout(r(this,ze)):g(this,Ao,this.value),this.typedName=e.target.value,g(this,ze,setTimeout(()=>s(this,C,hp).call(this),vy)),s(this,C,Zd).call(this)},hp=function(){r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0),this.value!==r(this,Ao)&&s(this,C,Qd).call(this))},cf=function(e){e.stopPropagation(),this.updateComplete.then(()=>s(this,C,hp).call(this))},lr=function(e){let t=this.empty?"":this.toDataURL(),i=t!==this.value;i&&(g(this,ki,t),this.value=t),this.requestUpdate(),e&&i&&s(this,C,Qd).call(this)},Qd=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}))},mp=function(){if(this.empty)return;let e=Math.max(r(this,C,Yd)?.clientWidth||r(this,Na)||600,300),t=e/ap,i=document.createElement("canvas");i.width=Math.round(e*So),i.height=Math.round(t*So);let a=i.getContext("2d",{willReadFrequently:!0});if(a.scale(So,So),this.mode==="type"){let l=Math.min(t*.45,64),d=r(this,C,dp);a.font=`400 ${l}px ${d}`;let m=this.typedName.trim(),u=e-2*nf,v=a.measureText(m).width;v>u&&(l*=u/v,a.font=`400 ${l}px ${d}`),a.direction=getComputedStyle(this).direction==="rtl"?"rtl":"ltr",a.textAlign="center",a.textBaseline="alphabetic",a.fillStyle=Gd,a.fillText(m,e/2,t*Wd)}else s(this,C,op).call(this,a,e,Gd,!1);return wy(i,nf*So)},pp=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${r(this,Lo)}-tab-${e}`)?.focus()),e===this.mode))return;let i=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&s(this,C,np).call(this),this.value!==i&&s(this,C,Qd).call(this)})},df=function(e){let t=J(e,this),i;if(t==="ArrowRight"||t==="ArrowLeft")i=this.mode==="draw"?"type":"draw";else if(e.key==="Home")i="draw";else if(e.key==="End")i="type";else return;e.preventDefault(),s(this,C,pp).call(this,i,!0)},up=function(e){s(this,C,hf).call(this,this.t(e))},hf=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},gp=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()})},mf=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),s(this,C,up).call(this,"undone"),s(this,C,gp).call(this,e)},pf=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),s(this,C,up).call(this,"cleared"),s(this,C,gp).call(this,e)},$i.formAssociated=!0,$i.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},$i.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}},$i.styles=[E,x`
|
|
1204
1207
|
:host { display: block; }
|
|
1205
1208
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1206
1209
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -1230,7 +1233,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1230
1233
|
.act:disabled { background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed; }
|
|
1231
1234
|
.panel:focus { outline: none; }
|
|
1232
1235
|
.pad {
|
|
1233
|
-
position: relative; width: 100%; aspect-ratio: ${
|
|
1236
|
+
position: relative; width: 100%; aspect-ratio: ${ap} / 1; overflow: hidden; container-type: inline-size;
|
|
1234
1237
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
1235
1238
|
}
|
|
1236
1239
|
.panel:focus-visible .pad, .pad:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
@@ -1241,15 +1244,15 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1241
1244
|
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 */
|
|
1242
1245
|
}
|
|
1243
1246
|
.line {
|
|
1244
|
-
position: absolute; inset-inline: var(--cm-space-12); top: ${
|
|
1247
|
+
position: absolute; inset-inline: var(--cm-space-12); top: ${Wd*100}%; height: 0;
|
|
1245
1248
|
border-top: var(--cm-border-1) dashed var(--cm-border-input); pointer-events: none;
|
|
1246
1249
|
}
|
|
1247
1250
|
.here {
|
|
1248
|
-
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-
|
|
1251
|
+
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-Wd)*100}% + 4px);
|
|
1249
1252
|
font-size: 12px; color: var(--cm-text-tertiary); pointer-events: none; user-select: none;
|
|
1250
1253
|
}
|
|
1251
1254
|
.typed {
|
|
1252
|
-
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-
|
|
1255
|
+
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-Wd)*100}% - 0.18em);
|
|
1253
1256
|
width: calc(100% - 2 * var(--cm-space-12)); padding: 0; margin: 0;
|
|
1254
1257
|
font-family: var(--cm-signature-font, 'Dancing Script', 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', 'Brush Script MT', cursive);
|
|
1255
1258
|
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 */
|
|
@@ -1266,17 +1269,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1266
1269
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
1267
1270
|
|
|
1268
1271
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1269
|
-
`];function
|
|
1270
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1272
|
+
`];function xy(o,n,e){let t=d=>e*by*(.35+d*1.3);if(n.length===1){o.beginPath(),o.arc(n[0].x*e,n[0].y*e,t(n[0].p)/2,0,Math.PI*2),o.fill();return}let i=d=>[d.x*e,d.y*e],a=n[0];for(let d=1;d<n.length-1;d++){let m=yy(n[d],n[d+1]);o.beginPath(),o.moveTo(...i(a)),o.quadraticCurveTo(...i(n[d]),...i(m)),o.lineWidth=t(n[d].p),o.stroke(),a=m}let l=n[n.length-1];o.beginPath(),o.moveTo(...i(a)),o.lineTo(...i(l)),o.lineWidth=t(l.p),o.stroke()}function wy(o,n){let{width:e,height:t}=o,i=o.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e,t).data,a=t,l=e,d=-1,m=-1;for(let v=0;v<t;v++){let f=v*e*4;for(let w=0;w<e;w++)i[f+w*4+3]>8&&(w<l&&(l=w),w>d&&(d=w),v<a&&(a=v),m=v)}if(d<0)return;let u=document.createElement("canvas");return u.width=d-l+1+2*n,u.height=m-a+1+2*n,u.getContext("2d").drawImage(o,l,a,d-l+1,m-a+1,n,n,d-l+1,m-a+1),u}function $y(o,n){let e=t=>{let i=/^#([0-9a-f]{6})$/i.exec(t.trim());if(i){let a=parseInt(i[1],16);return`${a>>16&255},${a>>8&255},${a&255}`}return(/\d+\s*,\s*\d+\s*,\s*\d+/.exec(t)?.[0]??t).replace(/\s/g,"")};return e(o)===e(n)}$("cm-signature-field",$i);var v1=z("optionGroup",{required:"Please select one of these options."}),ct,Ro,Ia,Ho,$t,fp,bp,uf,wt=class extends T{constructor(){super(...arguments);p(this,$t);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];p(this,ct,this.attachInternals());p(this,Ro,A("cm-og"));p(this,Ia,"");p(this,Ho,new MutationObserver(()=>s(this,$t,fp).call(this)))}connectedCallback(){super.connectedCallback(),s(this,$t,fp).call(this),r(this,Ho).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Ho).disconnect()}get form(){return r(this,ct).form}get validity(){return r(this,ct).validity}get validationMessage(){return r(this,ct).validationMessage}checkValidity(){return r(this,ct).checkValidity()}reportValidity(){return r(this,ct).reportValidity()}formResetCallback(){this.value=r(this,Ia)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){r(this,Ia)||g(this,Ia,this.value)}updated(){r(this,ct).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,ct).setValidity({valueMissing:!0},this.t("required"),e):r(this,ct).setValidity({})}render(){let e=this.items,t=e.findIndex(l=>l.value===this.value&&!l.disabled),i=t>=0?t:e.findIndex(l=>!l.disabled),a=this.getAttribute("aria-label");return c`
|
|
1273
|
+
${this.label?c`<span class="label" id="${r(this,Ro)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1271
1274
|
<div class="options" part="options" role="radiogroup"
|
|
1272
|
-
aria-labelledby=${this.label?`${r(this,
|
|
1275
|
+
aria-labelledby=${this.label?`${r(this,Ro)}-l`:h} aria-label=${!this.label&&a?a:h}
|
|
1273
1276
|
aria-required=${this.required?"true":h}>
|
|
1274
1277
|
${e.map((l,d)=>c`<button type="button" role="radio" part="option" class=${l.tone==="critical"||l.tone==="success"?`tone-${l.tone}`:h} aria-checked=${l.value===this.value?"true":"false"}
|
|
1275
1278
|
tabindex=${d===i?"0":"-1"} ?disabled=${this.disabled||!!l.disabled}
|
|
1276
|
-
@click=${()=>s(this,
|
|
1279
|
+
@click=${()=>s(this,$t,bp).call(this,d)} @keydown=${m=>s(this,$t,uf).call(this,m,d)}>${l.label}</button>`)}
|
|
1277
1280
|
</div>
|
|
1278
1281
|
<slot></slot>
|
|
1279
|
-
`}};ct=new WeakMap,
|
|
1282
|
+
`}};ct=new WeakMap,Ro=new WeakMap,Ia=new WeakMap,Ho=new WeakMap,$t=new WeakSet,fp=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},a=t.getAttribute("tone");return(a==="critical"||a==="success")&&(i.tone=a),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,Ia,this.value))},bp=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}))))},uf=function(e,t){let i=J(e,this),a=this.items.flatMap((m,u)=>m.disabled?[]:[u]),l=a.indexOf(t),d;if(i==="ArrowRight"||e.key==="ArrowDown")d=a[(l+1)%a.length];else if(i==="ArrowLeft"||e.key==="ArrowUp")d=a[(l-1+a.length)%a.length];else if(e.key==="Home")d=a[0];else if(e.key==="End")d=a[a.length-1];else return;e.preventDefault(),d!==void 0&&s(this,$t,bp).call(this,d)},wt.formAssociated=!0,wt.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},wt.styles=[E,x`
|
|
1280
1283
|
:host { display: block; }
|
|
1281
1284
|
.label {
|
|
1282
1285
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1308,7 +1311,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1308
1311
|
}
|
|
1309
1312
|
slot { display: none; }
|
|
1310
1313
|
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
1311
|
-
`];$("cm-option-group",
|
|
1314
|
+
`];$("cm-option-group",wt);var M1=z("segmentedControl",{required:"Please select one of these options."}),Pa=class extends wt{constructor(){super(...arguments);this.size="default"}};Pa.properties={...wt.properties,size:{reflect:!0}},Pa.styles=[E,x`
|
|
1312
1315
|
:host { display: inline-block; vertical-align: middle; max-width: 100%; --_h: var(--cm-control-height-md, 36px); }
|
|
1313
1316
|
:host([size='small']) { --_h: var(--cm-control-height-sm, 32px); }
|
|
1314
1317
|
@media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
|
|
@@ -1338,7 +1341,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1338
1341
|
button[aria-checked='true']:disabled { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
1339
1342
|
:host([disabled]) .options { background: var(--cm-bg-input-filled); }
|
|
1340
1343
|
slot { display: none; }
|
|
1341
|
-
`];$("cm-segmented-control",
|
|
1344
|
+
`];$("cm-segmented-control",Pa);var S1=z("pageHeader",{back:"Back to {label}",backOnly:"Back",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),No,vp,Oa=class extends T{constructor(){super(...arguments);p(this,No);this.heading="";this.description="";this.breadcrumbs=[];this.backHref="";this.backLabel="";this.pagination=!1;this.hasPrevious=!1;this.hasNext=!1}render(){let e=Array.isArray(this.breadcrumbs)?this.breadcrumbs:[],t=this.backHref?{href:this.backHref,label:this.backLabel}:[...e].reverse().find(i=>i.href);return c`<header part="header">
|
|
1342
1345
|
<div class=${this.description?"lead described":"lead"}>
|
|
1343
1346
|
${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}
|
|
1344
1347
|
<div class="titles">
|
|
@@ -1352,12 +1355,12 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1352
1355
|
</div>
|
|
1353
1356
|
<div class="actions">
|
|
1354
1357
|
${this.pagination?c`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
1355
|
-
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,
|
|
1356
|
-
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,
|
|
1358
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,No,vp).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
1359
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,No,vp).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
1357
1360
|
</div>`:h}
|
|
1358
1361
|
<slot name="actions"></slot>
|
|
1359
1362
|
</div>
|
|
1360
|
-
</header>`}};
|
|
1363
|
+
</header>`}};No=new WeakSet,vp=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Oa.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"}},Oa.styles=[E,x`
|
|
1361
1364
|
:host { display: block; }
|
|
1362
1365
|
header {
|
|
1363
1366
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-12) var(--cm-space-20);
|
|
@@ -1414,7 +1417,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1414
1417
|
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
1415
1418
|
.actions { gap: var(--cm-space-8); }
|
|
1416
1419
|
}
|
|
1417
|
-
`];$("cm-page-header",
|
|
1420
|
+
`];$("cm-page-header",Oa);var N1=z("actionBar",{label:"Actions"}),qa=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")}>
|
|
1418
1421
|
<div class="lead">
|
|
1419
1422
|
${e?c`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:h}
|
|
1420
1423
|
<div class="text">
|
|
@@ -1424,7 +1427,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1424
1427
|
</div>
|
|
1425
1428
|
</div>
|
|
1426
1429
|
<div class="actions"><slot name="actions"></slot></div>
|
|
1427
|
-
</div>`}};
|
|
1430
|
+
</div>`}};qa.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},qa.styles=[E,x`
|
|
1428
1431
|
:host { display: block; }
|
|
1429
1432
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
1430
1433
|
.bar {
|
|
@@ -1455,13 +1458,13 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1455
1458
|
|
|
1456
1459
|
.actions { gap: var(--cm-space-8); }
|
|
1457
1460
|
}
|
|
1458
|
-
`];$("cm-action-bar",
|
|
1461
|
+
`];$("cm-action-bar",qa);var B1=z("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),kt,cr,Io,_e,yp,xp,wp,gf,ff,Ba=class extends T{constructor(){super(...arguments);p(this,_e);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";p(this,kt,null);p(this,cr,()=>{this.open=!0});p(this,Io,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>s(this,_e,yp).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,_e,xp).call(this)}updated(e){e.has("form")&&this.isConnected&&s(this,_e,yp).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1459
1462
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1460
1463
|
<div class="actions">
|
|
1461
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,_e,
|
|
1462
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,_e,
|
|
1464
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,_e,ff)}>${this.discardLabel}</cm-button>
|
|
1465
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,_e,gf)}>${this.saveLabel}</cm-button>
|
|
1463
1466
|
</div>
|
|
1464
|
-
</div>`}}
|
|
1467
|
+
</div>`}};kt=new WeakMap,cr=new WeakMap,Io=new WeakMap,_e=new WeakSet,yp=function(){s(this,_e,xp).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,kt,e),e.addEventListener("input",r(this,cr)),e.addEventListener("change",r(this,cr)),e.addEventListener("reset",r(this,Io)))},xp=function(){let e=r(this,kt);e&&(e.removeEventListener("input",r(this,cr)),e.removeEventListener("change",r(this,cr)),e.removeEventListener("reset",r(this,Io)),g(this,kt,null))},wp=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},gf=function(){this.loading||this.saveDisabled||s(this,_e,wp).call(this,"cm-save")&&r(this,kt)&&r(this,kt).requestSubmit()},ff=function(){this.loading||s(this,_e,wp).call(this,"cm-discard")&&r(this,kt)&&(r(this,kt).reset(),this.open=!1)},Ba.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:{}},Ba.styles=[E,x`
|
|
1465
1468
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1466
1469
|
:host(:not([open])) { display: none; }
|
|
1467
1470
|
.bar {
|
|
@@ -1477,14 +1480,14 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1477
1480
|
.message { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; }
|
|
1478
1481
|
|
|
1479
1482
|
}
|
|
1480
|
-
`];$("cm-save-bar",
|
|
1483
|
+
`];$("cm-save-bar",Ba);var W1=z("infoItem",{edit:"Edit {label}"}),Fa=class extends S{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}>
|
|
1481
1484
|
${this.heading||this.action?c`<header>
|
|
1482
1485
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
1483
1486
|
${this.action?c`<button class="action" type="button" part="action" aria-label=${this.actionLabel||h}
|
|
1484
1487
|
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h}
|
|
1485
1488
|
</header>`:h}
|
|
1486
1489
|
<div class="items" role=${this._list?"list":h}><slot @slotchange=${t=>{this._list=t.target.assignedElements().every(i=>i.localName==="cm-info-item")}}></slot></div>
|
|
1487
|
-
</section>`}};
|
|
1490
|
+
</section>`}};Fa.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},layout:{reflect:!0},_list:{state:!0}},Fa.styles=[E,x`
|
|
1488
1491
|
:host { display: block; }
|
|
1489
1492
|
section {
|
|
1490
1493
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -1509,9 +1512,9 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1509
1512
|
display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: baseline;
|
|
1510
1513
|
column-gap: var(--cm-space-12); grid-column: 1 / -1; --_cm-info-value-gap: 0px;
|
|
1511
1514
|
}
|
|
1512
|
-
`];$("cm-info-panel",
|
|
1515
|
+
`];$("cm-info-panel",Fa);var ja=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"
|
|
1513
1516
|
aria-label=${this.editLabel||this.t("edit",{label:this.label})}
|
|
1514
|
-
@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}`}};
|
|
1517
|
+
@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}`}};ja.properties={label:{},half:{type:Boolean,reflect:!0},editable:{type:Boolean,reflect:!0},editLabel:{attribute:"edit-label"}},ja.styles=[E,x`
|
|
1515
1518
|
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
1516
1519
|
:host([half]) { grid-column: auto; }
|
|
1517
1520
|
.label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
|
|
@@ -1530,16 +1533,16 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1530
1533
|
.edit:hover { background: var(--cm-bg-hover); color: var(--cm-icon-selected); }
|
|
1531
1534
|
.edit:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1532
1535
|
@media (pointer: coarse) { .edit::after { content: ''; position: absolute; inset: -8px; } }
|
|
1533
|
-
`];$("cm-info-item",
|
|
1536
|
+
`];$("cm-info-item",ja);var dr,Ua=class extends S{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;p(this,dr,A("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">
|
|
1534
1537
|
<div class="h" role="heading" aria-level=${e}>
|
|
1535
|
-
<button type="button" part="toggle" id="${r(this,
|
|
1538
|
+
<button type="button" part="toggle" id="${r(this,dr)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,dr)}-body"
|
|
1536
1539
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
1537
1540
|
<span>${this.heading}</span>
|
|
1538
1541
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
1539
1542
|
</button>
|
|
1540
1543
|
</div>
|
|
1541
|
-
<div class="body" part="body" id="${r(this,
|
|
1542
|
-
</div>`}};
|
|
1544
|
+
<div class="body" part="body" id="${r(this,dr)}-body" role="region" aria-labelledby="${r(this,dr)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
1545
|
+
</div>`}};dr=new WeakMap,Ua.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Ua.styles=[E,x`
|
|
1543
1546
|
:host { display: block; }
|
|
1544
1547
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
1545
1548
|
.h { margin: 0; font: inherit; }
|
|
@@ -1562,24 +1565,24 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1562
1565
|
.body[hidden] { display: none; }
|
|
1563
1566
|
|
|
1564
1567
|
|
|
1565
|
-
`];$("cm-accordion",
|
|
1568
|
+
`];$("cm-accordion",Ua);var He,hr,$p,bf,Va=class extends S{constructor(){super(...arguments);p(this,He);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="default";this.action="";this.actionHref="";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));if(this.size==="inline")return s(this,He,bf).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">
|
|
1566
1569
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1567
|
-
<slot name="image" @slotchange=${i=>s(this,He,
|
|
1570
|
+
<slot name="image" @slotchange=${i=>s(this,He,hr).call(this,i,"hasImage")}>${t}</slot>
|
|
1568
1571
|
</div>
|
|
1569
1572
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1570
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,He,
|
|
1571
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,He,
|
|
1572
|
-
</div>`}};He=new WeakSet,
|
|
1573
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},
|
|
1573
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,He,hr).call(this,i,"hasText")}></slot></div>
|
|
1574
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,He,hr).call(this,i,"hasActions")}></slot></div>${this.action?c`<div class="actions">${s(this,He,$p).call(this)}</div>`:h}
|
|
1575
|
+
</div>`}};He=new WeakSet,hr=function(e,t){let i=e.target;this[t]=i.assignedNodes({flatten:!0}).some(a=>a.nodeType===1||a.textContent.trim()),this.requestUpdate()},$p=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"
|
|
1576
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},bf=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">
|
|
1574
1577
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1575
|
-
<slot name="image" @slotchange=${i=>s(this,He,
|
|
1578
|
+
<slot name="image" @slotchange=${i=>s(this,He,hr).call(this,i,"hasImage")}>${t}</slot>
|
|
1576
1579
|
</span>
|
|
1577
1580
|
<div class="line">
|
|
1578
1581
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1579
|
-
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,He,
|
|
1580
|
-
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,He,
|
|
1582
|
+
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,He,hr).call(this,i,"hasText")}></slot></span>${s(this,He,$p).call(this)}
|
|
1583
|
+
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,He,hr).call(this,i,"hasActions")}></slot></span>
|
|
1581
1584
|
</div>
|
|
1582
|
-
</div>`},
|
|
1585
|
+
</div>`},Va.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0},action:{},actionHref:{attribute:"action-href"}},Va.styles=[E,x`
|
|
1583
1586
|
:host { display: block; }
|
|
1584
1587
|
/* 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. */
|
|
1585
1588
|
.wrap {
|
|
@@ -1628,7 +1631,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1628
1631
|
:host([size='large']) .circle { width: 120px; height: 120px; }
|
|
1629
1632
|
:host([size='large']) .title { margin-top: var(--cm-space-16); }
|
|
1630
1633
|
}
|
|
1631
|
-
`];$("cm-empty-state",
|
|
1634
|
+
`];$("cm-empty-state",Va);var vf={small:34,medium:40,large:50,xlarge:186},Ka=class extends S{constructor(){super(...arguments);this.variant="text";this.lines=1;this.size="large"}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-hidden","true")}render(){if(this.variant==="thumbnail"){let t=vf[this.size]??vf.large;return c`<span class="bone" part="bone" style="width:${t}px;height:${t}px"></span>`}if(this.variant==="block")return c`<span class="bone block" part="bone"></span>`;let e=Math.max(1,Math.floor(this.lines||1));return c`${Array.from({length:e},(t,i)=>c`<span class="bone line ${e>1&&i===e-1?"short":""}" part="bone"></span>`)}`}};Ka.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},Ka.styles=[E,x`
|
|
1632
1635
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
1633
1636
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
1634
1637
|
.bone {
|
|
@@ -1643,17 +1646,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1643
1646
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
1644
1647
|
}
|
|
1645
1648
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
1646
|
-
`];$("cm-skeleton",
|
|
1649
|
+
`];$("cm-skeleton",Ka);var ky=[472,90,90,251],Ey=[94,266,134,191,138],Wa=class extends T{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1}render(){let e=t=>t.map(i=>c`<span class="bone" style="height:${i}px"></span>`);return c`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
1647
1650
|
<span class="sr" role="status">${this.label}</span>
|
|
1648
1651
|
<div class="page" aria-hidden="true">
|
|
1649
1652
|
${this.navigation?c`<span class="bone nav"></span>`:h}
|
|
1650
1653
|
<span class="bone head"></span>
|
|
1651
1654
|
<div class="body">
|
|
1652
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
1653
|
-
<div class="col side">${e(
|
|
1655
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:ky)}</div>
|
|
1656
|
+
<div class="col side">${e(Ey)}</div>
|
|
1654
1657
|
</div>
|
|
1655
1658
|
</div>
|
|
1656
|
-
</div>`}};
|
|
1659
|
+
</div>`}};Wa.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},Wa.styles=[E,x`
|
|
1657
1660
|
:host { display: block; }
|
|
1658
1661
|
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-8); }
|
|
1659
1662
|
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
@@ -1677,11 +1680,11 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1677
1680
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
1678
1681
|
.head { height: 60px; }
|
|
1679
1682
|
}
|
|
1680
|
-
`];$("cm-skeleton-display",
|
|
1683
|
+
`];$("cm-skeleton-display",Wa);var p$=z("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),eh,yf,Ga=class extends T{constructor(){super(...arguments);p(this,eh);this.author="";this.datetime="";this.time=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-comment-box"&&this.setAttribute("role","listitem")}render(){let e=s(this,eh,yf).call(this);return c`<article part="comment">
|
|
1681
1684
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
1682
1685
|
<div class="body" part="body"><slot></slot></div>
|
|
1683
1686
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
1684
|
-
</article>`}};
|
|
1687
|
+
</article>`}};eh=new WeakSet,yf=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:ae(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},Ga.properties={author:{},datetime:{},time:{}},Ga.styles=[E,x`
|
|
1685
1688
|
:host { display: block; }
|
|
1686
1689
|
article {
|
|
1687
1690
|
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
@@ -1689,16 +1692,16 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1689
1692
|
}
|
|
1690
1693
|
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
1691
1694
|
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
1692
|
-
`];$("cm-comment",
|
|
1693
|
-
<div class="title" id="${r(this,
|
|
1695
|
+
`];$("cm-comment",Ga);var Po,th,xf,Ya=class extends T{constructor(){super(...arguments);p(this,th);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;p(this,Po,A("cm-comment-box"));this.hasComments=!1}submit(){let e=this.renderRoot.querySelector("textarea"),t=(e?.value??this.value).trim();if(this.disabled)return;if(!t){e?.focus();return}let i=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(i)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="comment-box" aria-labelledby="${r(this,Po)}-h">
|
|
1696
|
+
<div class="title" id="${r(this,Po)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1694
1697
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
1695
1698
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
1696
|
-
@keydown=${s(this,
|
|
1699
|
+
@keydown=${s(this,th,xf)}></textarea>
|
|
1697
1700
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
1698
1701
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
1699
1702
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
1700
1703
|
</div>
|
|
1701
|
-
</section>`}};
|
|
1704
|
+
</section>`}};Po=new WeakMap,th=new WeakSet,xf=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},Ya.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Ya.styles=[E,x`
|
|
1702
1705
|
:host { display: block; }
|
|
1703
1706
|
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
1704
1707
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1718,8 +1721,8 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1718
1721
|
|
|
1719
1722
|
.actions { justify-content: flex-end; }
|
|
1720
1723
|
}
|
|
1721
|
-
`];$("cm-comment-box",
|
|
1722
|
-
data-side=${this._side}>${this.content}</div>`}};
|
|
1724
|
+
`];$("cm-comment-box",Ya);var ih='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',be,Ja,Ti,zi,Kt,Za,Qa,je,kp,rh,ah,sh,nh,es,wf,mr,Ep,Mp,Wt,Xa=class extends S{constructor(){super(...arguments);p(this,je);this.content="";this.placement="top";this.delay=400;this.open=!1;this.visualOnly=!1;this._side="top";p(this,be);p(this,Ja);p(this,Ti,[]);p(this,zi);p(this,Kt);p(this,Za,!1);p(this,Qa,!1);p(this,rh,()=>{g(this,Za,!0),clearTimeout(r(this,Kt)),this.open||g(this,Kt,setTimeout(()=>this.show(),this.delay))});p(this,ah,()=>{g(this,Za,!1),clearTimeout(r(this,Kt)),r(this,Qa)||this.hide()});p(this,sh,()=>{g(this,Qa,!0),this.show()});p(this,nh,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(g(this,Qa,!1),r(this,Za)||this.hide())});p(this,es,e=>{e.key==="Escape"&&this.open&&this.hide()});p(this,mr,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(s(this,je,Mp).call(this),!t||!this.content||this.visualOnly)return;let i=t.updateComplete;t.localName.includes("-")&&i&&!t.shadowRoot?.querySelector(ih)&&i.then(()=>{t.shadowRoot?.querySelector(ih)&&r(this,mr).call(this)}),r(this,be)||(g(this,be,document.createElement("span")),r(this,be).id=A("cm-tooltip"),r(this,be).hidden=!0,r(this,be).slot="description"),r(this,be).textContent=this.content,r(this,be).isConnected||this.append(r(this,be));let a=s(this,je,wf).call(this,t);if(g(this,Ja,a),a.getRootNode()===r(this,be).getRootNode()){let l=(a.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);l.includes(r(this,be).id)||a.setAttribute("aria-describedby",[...l,r(this,be).id].join(" "))}else"ariaDescribedByElements"in a?(s(this,je,Ep).call(this,a),g(this,zi,new MutationObserver(()=>{a.getAttribute("aria-describedby")!==""&&s(this,je,Ep).call(this,a)})),r(this,zi).observe(a,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,be).id)});p(this,Wt,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let a=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0]??this).getBoundingClientRect(),l=e.getBoundingClientRect(),d=8,m=8,u=innerWidth,v=innerHeight,f=getComputedStyle(this).direction==="rtl",w=W=>W==="start"?f?"right":"left":W==="end"?f?"left":"right":W,y={top:a.top-d-l.height>=m,bottom:a.bottom+d+l.height<=v-m,left:a.left-d-l.width>=m,right:a.right+d+l.width<=u-m},k={top:"bottom",bottom:"top",left:"right",right:"left"},D=w(this.placement);!y[D]&&y[k[D]]&&(D=k[D]);let H,B;D==="top"||D==="bottom"?(H=a.left+a.width/2-l.width/2,B=D==="top"?a.top-d-l.height:a.bottom+d):(B=a.top+a.height/2-l.height/2,H=D==="left"?a.left-d-l.width:a.right+d),H=Math.min(Math.max(m,H),u-m-l.width),B=Math.min(Math.max(m,B),v-m-l.height),e.style.transform=`translate(${Math.round(H)}px, ${Math.round(B)}px)`;let j={top:"top",bottom:"bottom",left:f?"end":"start",right:f?"start":"end"};this._side=j[D]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,rh)),this.addEventListener("pointerleave",r(this,ah)),this.addEventListener("focusin",r(this,sh)),this.addEventListener("focusout",r(this,nh)),this.addEventListener("keydown",r(this,es)),this.hasUpdated&&r(this,mr).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),s(this,je,Mp).call(this),s(this,je,kp).call(this),clearTimeout(r(this,Kt))}show(){clearTimeout(r(this,Kt)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,es),!0),addEventListener("scroll",r(this,Wt),!0),addEventListener("resize",r(this,Wt)),this.updateComplete.then(r(this,Wt)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,Kt)),this.open&&(this.open=!1,s(this,je,kp).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,mr).call(this),this.content?this.open&&r(this,Wt).call(this):this.hide())}render(){return c`<slot @slotchange=${r(this,mr)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1725
|
+
data-side=${this._side}>${this.content}</div>`}};be=new WeakMap,Ja=new WeakMap,Ti=new WeakMap,zi=new WeakMap,Kt=new WeakMap,Za=new WeakMap,Qa=new WeakMap,je=new WeakSet,kp=function(){document.removeEventListener("keydown",r(this,es),!0),removeEventListener("scroll",r(this,Wt),!0),removeEventListener("resize",r(this,Wt))},rh=new WeakMap,ah=new WeakMap,sh=new WeakMap,nh=new WeakMap,es=new WeakMap,wf=function(e){return e.matches(ih)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(ih)??e},mr=new WeakMap,Ep=function(e){g(this,Ti,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),i=r(this,Ti).map(a=>t.getElementById(a)).filter(a=>!!a);e.ariaDescribedByElements=[...i,r(this,be)]},Mp=function(){let e=r(this,Ja);if(!(!e||!r(this,be))){if(r(this,zi))r(this,zi).disconnect(),g(this,zi,void 0),r(this,Ti).length?e.setAttribute("aria-describedby",r(this,Ti).join(" ")):e.removeAttribute("aria-describedby"),g(this,Ti,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(i=>i&&i!==r(this,be).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,Ja,void 0)}},Wt=new WeakMap,Xa.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},Xa.styles=[E,x`
|
|
1723
1726
|
:host { display: inline-block; position: relative; }
|
|
1724
1727
|
.tip {
|
|
1725
1728
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -1736,7 +1739,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1736
1739
|
:host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
1737
1740
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1738
1741
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1739
|
-
`];$("cm-tooltip",
|
|
1742
|
+
`];$("cm-tooltip",Xa);var k$=z("timelineItem",{justNow:"Just now",minutesAgo:{one:"{count} minute ago",other:"{count} minutes ago"},hoursAgo:{one:"{count} hour ago",other:"{count} hours ago"},daysAgo:{one:"{count} day ago",other:"{count} days ago"},inMinutes:{one:"In {count} minute",other:"In {count} minutes"},inHours:{one:"In {count} hour",other:"In {count} hours"},inDays:{one:"In {count} day",other:"In {count} days"},showAll:"Show all",showLess:"Show less"}),E$=z("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),My=7,Oo=new Set,qo;function $f(o,n){n?Oo.add(o):Oo.delete(o),Oo.size&&!qo&&(qo=setInterval(()=>Oo.forEach(e=>e.requestUpdate()),6e4)),!Oo.size&&qo&&(clearInterval(qo),qo=void 0)}var Bo,ur,dt,Tp,oh,kf,ts=class extends T{constructor(){super(...arguments);p(this,dt);this.icon="";this.tone="neutral";this.heading="";this.datetime="";this.time="";this.meta="";this.lines=3;this.expanded=!1;this._overflow=!1;this._body=!1;this._meta=!1;this._actions=!1;p(this,Bo,A("cm-tl"));p(this,ur)}connectedCallback(){super.connectedCallback(),$f(this,!0)}disconnectedCallback(){super.disconnectedCallback(),$f(this,!1),r(this,ur)?.disconnect(),g(this,ur,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(g(this,ur,new ResizeObserver(()=>s(this,dt,Tp).call(this))),r(this,ur).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&s(this,dt,Tp).call(this)}get date(){if(!this.datetime)return;let e=new Date(this.datetime);return Number.isNaN(e.getTime())?void 0:e}get relativeTime(){if(this.time)return this.time;let e=this.date;if(!e)return this.datetime;let t=Date.now()-e.getTime(),i=t<0,a=Math.floor(Math.abs(t)/6e4);if(a<1)return this.t("justNow");if(a<60)return this.t(i?"inMinutes":"minutesAgo",{count:a});let l=Math.floor(a/60);if(l<24)return this.t(i?"inHours":"hoursAgo",{count:l});let d=Math.floor(l/24);return d<My?this.t(i?"inDays":"daysAgo",{count:d}):ae(e,{dateStyle:"medium"},this.locale)}get fullTime(){let e=this.date;return e?ae(e,{dateStyle:"full",timeStyle:"short"},this.locale):""}render(){let e=this.relativeTime,t=this.fullTime,i=this.tone&&this.tone!=="neutral"?this.tone:"",a=this.lines>0&&!this.expanded,l=e?t?c`<cm-tooltip class="when" content=${t} visual-only placement="top"><time part="time" tabindex="0" datetime=${this.datetime}>${e}<span class="sr">, ${t}</span></time></cm-tooltip>`:c`<time class="when" part="time" datetime=${this.datetime||h}>${e}</time>`:h;return c`<div class="item">
|
|
1740
1743
|
<span class="icon ${i}" part="icon" aria-hidden="true">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:c`<span class="dot"></span>`}</span>
|
|
1741
1744
|
<div class="main">
|
|
1742
1745
|
<div class="head">
|
|
@@ -1744,14 +1747,14 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1744
1747
|
<slot name="badge"></slot></span>
|
|
1745
1748
|
${l}
|
|
1746
1749
|
</div>
|
|
1747
|
-
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,dt,
|
|
1748
|
-
<div class="body ${a?"clamp":""}" id="${r(this,
|
|
1749
|
-
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,dt,
|
|
1750
|
+
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,dt,oh).call(this,d,"_meta")}>${this.meta}</slot></div>
|
|
1751
|
+
<div class="body ${a?"clamp":""}" id="${r(this,Bo)}-body" part="body" ?hidden=${!this._body}
|
|
1752
|
+
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,dt,oh).call(this,d,"_body")}></slot></div>
|
|
1750
1753
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
1751
|
-
aria-controls="${r(this,
|
|
1752
|
-
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,dt,
|
|
1754
|
+
aria-controls="${r(this,Bo)}-body" @click=${s(this,dt,kf)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
1755
|
+
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,dt,oh).call(this,d,"_actions")}></slot></div>
|
|
1753
1756
|
</div>
|
|
1754
|
-
</div>`}};
|
|
1757
|
+
</div>`}};Bo=new WeakMap,ur=new WeakMap,dt=new WeakSet,Tp=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},oh=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(a=>a.nodeType===Node.ELEMENT_NODE||(a.textContent??"").trim())},kf=function(){this.expanded=!this.expanded},ts.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}},ts.styles=[E,x`
|
|
1755
1758
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
1756
1759
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
1757
1760
|
.icon {
|
|
@@ -1796,16 +1799,16 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1796
1799
|
[hidden] { display: none !important; }
|
|
1797
1800
|
.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; }
|
|
1798
1801
|
::slotted([slot='badge']) { flex: none; }
|
|
1799
|
-
`];$("cm-timeline-item",
|
|
1802
|
+
`];$("cm-timeline-item",ts);var Fo,is,gr,zp,Ef,pr=class extends T{constructor(){super(...arguments);p(this,gr);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];p(this,Fo,new MutationObserver(()=>s(this,gr,zp).call(this)));p(this,is,!1)}connectedCallback(){super.connectedCallback(),s(this,gr,zp).call(this),r(this,Fo).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Fo).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){g(this,is,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach((i,a)=>{this._items[a]&&i.assign(this._items[a])});let t=this.renderRoot.querySelector("slot.empty");t&&t.assign(...this._empty),r(this,is)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,is,!1),this.renderRoot.querySelector("ol")?.focus())}render(){let e=this._items,t=this.loading,i=t&&!e.length?c`<div class="loading" aria-hidden="true">${[0,1,2].map(()=>c`<div class="sk">
|
|
1800
1803
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
1801
1804
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
1802
1805
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
1803
1806
|
</ol>`:h}
|
|
1804
1807
|
${i}
|
|
1805
1808
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
1806
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,
|
|
1809
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,gr,Ef)}>${this.moreLabel}</cm-button></div>`:h}
|
|
1807
1810
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
1808
|
-
`}};
|
|
1811
|
+
`}};Fo=new WeakMap,is=new WeakMap,gr=new WeakSet,zp=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},Ef=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},pr.shadowRootOptions={...S.shadowRootOptions,slotAssignment:"manual"},pr.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}},pr.styles=[E,x`
|
|
1809
1812
|
:host { display: block; }
|
|
1810
1813
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
1811
1814
|
ol:focus { outline: none; }
|
|
@@ -1828,14 +1831,14 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1828
1831
|
@media (max-width: 640px) {
|
|
1829
1832
|
.more { padding-inline-start: 0; }
|
|
1830
1833
|
}
|
|
1831
|
-
`];$("cm-timeline",
|
|
1834
|
+
`];$("cm-timeline",pr);var S$=z("smartTip",{newTab:"(opens in a new tab)"}),L$=z("smartTips",{heading:"Smart tips",tourAction:"Start"}),rs=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}>
|
|
1832
1835
|
<span class="text">
|
|
1833
1836
|
<span class="title" part="heading">${this.heading}</span>
|
|
1834
1837
|
<span class="desc" part="description"><slot></slot></span>
|
|
1835
1838
|
${e?c`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">${this.t("newTab")}</span>`:h}
|
|
1836
1839
|
</span>
|
|
1837
1840
|
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
1838
|
-
</a>`}};
|
|
1841
|
+
</a>`}};rs.properties={heading:{},href:{},target:{}},rs.styles=[E,x`
|
|
1839
1842
|
:host { display: block; }
|
|
1840
1843
|
a {
|
|
1841
1844
|
display: flex; align-items: flex-start; gap: var(--cm-space-8); padding: var(--cm-space-16);
|
|
@@ -1852,7 +1855,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1852
1855
|
}
|
|
1853
1856
|
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
1854
1857
|
a:hover .title { text-decoration: underline; }
|
|
1855
|
-
`];$("cm-smart-tip",
|
|
1858
|
+
`];$("cm-smart-tip",rs);var as=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">
|
|
1856
1859
|
${this.tourHeading?c`<div class="tour" part="tour">
|
|
1857
1860
|
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="16"></cm-icon>
|
|
1858
1861
|
</span>
|
|
@@ -1863,7 +1866,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1863
1866
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1864
1867
|
<div class="list" role="list"><slot></slot></div>
|
|
1865
1868
|
</section>
|
|
1866
|
-
</div>`}};
|
|
1869
|
+
</div>`}};as.properties={heading:{string:"heading"},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action",string:"tourAction"},headingLevel:{type:Number,attribute:"heading-level"}},as.styles=[E,x`
|
|
1867
1870
|
:host { display: block; }
|
|
1868
1871
|
.card { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1869
1872
|
.tour {
|
|
@@ -1880,24 +1883,24 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1880
1883
|
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;
|
|
1881
1884
|
}
|
|
1882
1885
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1883
|
-
`];$("cm-smart-tips",
|
|
1886
|
+
`];$("cm-smart-tips",as);var N$=z("pagination",{label:"Pagination",rows:"Number of rows",summary:"Showing {from}\u2013{to} of {total} {resource}",page:"Page",of:"of {count}",previous:"Previous page",next:"Next page"}),Gt,ns,Mf,Tf,ss=class extends T{constructor(){super(...arguments);p(this,ns);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;p(this,Gt,A("cm-pg"))}get pageCount(){return Math.max(1,Math.ceil((this.total||0)/Math.max(1,this.pageSize)))}goTo(e){let t=Math.min(this.pageCount,Math.max(1,Math.round(e)||1));if(this._draft=null,t===this.page){this.requestUpdate();return}this.page=t,this.dispatchEvent(new CustomEvent("cm-page-change",{detail:{page:t},bubbles:!0,composed:!0}))}render(){let e=this.pageCount,t=Math.min(e,Math.max(1,this.page)),i=this.total?(t-1)*this.pageSize+1:0,a=Math.min(this.total,t*this.pageSize),l=this.pageSizes??[];return c`
|
|
1884
1887
|
<nav part="bar" aria-label=${this.label}>
|
|
1885
1888
|
${l.length?c`<div class="rows" part="rows">
|
|
1886
|
-
<label for="${r(this,
|
|
1887
|
-
<span class="field"><select id="${r(this,
|
|
1889
|
+
<label for="${r(this,Gt)}-s">${this.t("rows")}</label>
|
|
1890
|
+
<span class="field"><select id="${r(this,Gt)}-s" @change=${s(this,ns,Mf)}>
|
|
1888
1891
|
${(l.includes(this.pageSize)?l:[...l,this.pageSize].sort((d,m)=>d-m)).map(d=>c`<option value=${d} ?selected=${d===this.pageSize}>${d}</option>`)}
|
|
1889
1892
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
1890
1893
|
</div>`:h}
|
|
1891
1894
|
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:i,to:a,total:this.total,resource:this.resourceName}).replace(/\s+/g," ").trim():h}</div>
|
|
1892
1895
|
<div class="pages" part="pages">
|
|
1893
1896
|
<span class="counter">
|
|
1894
|
-
<label for="${r(this,
|
|
1895
|
-
<input id="${r(this,
|
|
1896
|
-
.value=${this._draft??String(t)} aria-describedby="${r(this,
|
|
1897
|
+
<label for="${r(this,Gt)}-p">${this.t("page")}</label>
|
|
1898
|
+
<input id="${r(this,Gt)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1899
|
+
.value=${this._draft??String(t)} aria-describedby="${r(this,Gt)}-of"
|
|
1897
1900
|
@input=${d=>this._draft=d.target.value}
|
|
1898
|
-
@keydown=${s(this,
|
|
1901
|
+
@keydown=${s(this,ns,Tf)}
|
|
1899
1902
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
1900
|
-
<span id="${r(this,
|
|
1903
|
+
<span id="${r(this,Gt)}-of">${this.t("of",{count:e})}</span>
|
|
1901
1904
|
</span>
|
|
1902
1905
|
<span class="arrows">
|
|
1903
1906
|
<button class="prev" type="button" part="previous" aria-label=${this.t("previous")} ?disabled=${t<=1}
|
|
@@ -1907,7 +1910,7 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1907
1910
|
</span>
|
|
1908
1911
|
</div>
|
|
1909
1912
|
</nav>
|
|
1910
|
-
`}};
|
|
1913
|
+
`}};Gt=new WeakMap,ns=new WeakSet,Mf=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})))},Tf=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))},ss.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}},ss.styles=[E,x`
|
|
1911
1914
|
:host { display: block; }
|
|
1912
1915
|
nav {
|
|
1913
1916
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -1950,17 +1953,17 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
1950
1953
|
select, input { height: var(--cm-control-height-touch); }
|
|
1951
1954
|
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
1952
1955
|
}
|
|
1953
|
-
`];$("cm-pagination",
|
|
1956
|
+
`];$("cm-pagination",ss);var F$=z("statusTabs",{label:"Status",option:"{label} ({count})"}),ls,Uo,me,jo,zf,_p,_f,Cp,Cf,os=class extends T{constructor(){super(...arguments);p(this,me);this.value="";this.tabs=[];this.controls="";this.size="large";this.mobile="scroll";this._more="";p(this,ls,new ResizeObserver(()=>s(this,me,jo).call(this)));this._slotted=[];p(this,Uo,new MutationObserver(()=>s(this,me,_p).call(this)))}connectedCallback(){super.connectedCallback(),s(this,me,_p).call(this),r(this,Uo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Uo).disconnect(),r(this,ls).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector(".tabs");r(this,ls).observe(e),e.addEventListener("scroll",()=>s(this,me,jo).call(this),{passive:!0}),document.fonts?.ready.then(()=>s(this,me,jo).call(this))}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){let t=this.renderRoot.querySelector(".pick select");t&&t.offsetParent!==null?t.focus(e):this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(e){s(this,me,jo).call(this);for(let a of this.renderRoot.querySelectorAll(".tabs > *"))r(this,ls).observe(a);if(!("ariaControlsElements"in Element.prototype))return;let t=this.getRootNode(),i=this.controls?t.getElementById?.(this.controls):null;for(let a of this.renderRoot.querySelectorAll("button, select"))a.ariaControlsElements=i?[i]:null}render(){let e=this.items,t=s(this,me,_f).call(this,e),i=this.getAttribute("aria-label")||this.t("label");return c`
|
|
1954
1957
|
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${i}>
|
|
1955
1958
|
${e.map((a,l)=>c`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
1956
1959
|
tabindex=${l===t?"0":"-1"} ?disabled=${!!a.disabled}
|
|
1957
|
-
@click=${()=>s(this,me,
|
|
1960
|
+
@click=${()=>s(this,me,Cp).call(this,l)} @keydown=${d=>s(this,me,Cf).call(this,d,l)}><span class="label" data-text=${a.label}>${a.label}</span>${a.count!==void 0&&!Number.isNaN(a.count)?c`<span class="sr">, </span><span class="count" part="count">${this.formatNumber(a.count)}</span>`:h}</button>`)}
|
|
1958
1961
|
</div>
|
|
1959
|
-
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,me,
|
|
1962
|
+
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,me,zf)}>
|
|
1960
1963
|
${e.map((a,l)=>c`<option value=${a.value} ?disabled=${!!a.disabled} ?selected=${l===t} .selected=${l===t}>${a.count!==void 0&&!Number.isNaN(a.count)?this.t("option",{label:a.label,count:a.count}):a.label}</option>`)}
|
|
1961
1964
|
</select><cm-icon name="chevron-down" size="16"></cm-icon></div>`:h}
|
|
1962
1965
|
<slot></slot>
|
|
1963
|
-
`}};
|
|
1966
|
+
`}};ls=new WeakMap,Uo=new WeakMap,me=new WeakSet,jo=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),a=t>1&&i>1,l=t>1&&i<t-1,d=a&&l?"both":a?"start":l?"end":"";d!==this._more&&(this._more=d)},zf=function(e){let t=e.target.value;t!==this.value&&(this.value=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},_p=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.getAttribute("count");return{value:t.value,label:t.label||t.textContent.trim(),count:i===null||i===""?void 0:Number(i),disabled:t.disabled}}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"")},_f=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},Cp=function(e){let t=this.items[e];!t||t.disabled||(this.updateComplete.then(()=>{let i=this.renderRoot.querySelectorAll("button")[e];i?.focus(),i?.scrollIntoView?.({block:"nearest",inline:"nearest"})}),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},Cf=function(e,t){let i=J(e,this),a=this.items.flatMap((m,u)=>m.disabled?[]:[u]),l=a.indexOf(t),d;if(i==="ArrowRight")d=a[(l+1)%a.length];else if(i==="ArrowLeft")d=a[(l-1+a.length)%a.length];else if(e.key==="Home")d=a[0];else if(e.key==="End")d=a[a.length-1];else return;e.preventDefault(),d!==void 0&&s(this,me,Cp).call(this,d)},os.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},mobile:{reflect:!0},_slotted:{state:!0},_more:{state:!0}},os.styles=[E,x`
|
|
1964
1967
|
:host { display: block; }
|
|
1965
1968
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
1966
1969
|
.tabs {
|
|
@@ -2019,20 +2022,20 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
2019
2022
|
:host([mobile='select']) .tabs { display: none; }
|
|
2020
2023
|
:host([mobile='select']) .pick { display: block; }
|
|
2021
2024
|
}
|
|
2022
|
-
`];$("cm-status-tabs",
|
|
2025
|
+
`];$("cm-status-tabs",os);var G$=z("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),lh,Vo,Yt,Sp,Sf,Lf,cs=class extends T{constructor(){super(...arguments);p(this,Yt);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;p(this,lh,A("cm-th"));p(this,Vo,new MutationObserver(()=>s(this,Yt,Sp).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),s(this,Yt,Sp).call(this),r(this,Vo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Vo).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`
|
|
2023
2026
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
2024
2027
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
2025
2028
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
2026
|
-
<input id="${r(this,
|
|
2027
|
-
@change=${s(this,
|
|
2029
|
+
<input id="${r(this,lh)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
2030
|
+
@change=${s(this,Yt,Lf)} />
|
|
2028
2031
|
<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>
|
|
2029
2032
|
</span></span>`:h}
|
|
2030
2033
|
${t.map(i=>{let a=this.sort===i.key,l=a?this.direction==="descending"?"descending":"ascending":"none",d=i.hidden?c`<span class="sr">${i.label}</span>`:i.label;return c`<span class="cell" part="cell" data-align=${i.align??"start"} role=${e?"columnheader":h}
|
|
2031
|
-
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,
|
|
2034
|
+
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,Yt,Sf).call(this,i)}>${d}${e?h:c`<span class="sr">${a?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
2032
2035
|
name=${a&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
2033
2036
|
</div>
|
|
2034
2037
|
<slot></slot>
|
|
2035
|
-
`}};
|
|
2038
|
+
`}};lh=new WeakMap,Vo=new WeakMap,Yt=new WeakSet,Sp=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"}})},Sf=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}))},Lf=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}))},cs.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}},cs.styles=[E,x`
|
|
2036
2039
|
:host { display: block; }
|
|
2037
2040
|
slot { display: none; } /* <option> children are column data, not content */
|
|
2038
2041
|
.bar {
|
|
@@ -2084,10 +2087,10 @@ var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(
|
|
|
2084
2087
|
:host([resource-rows='selectable']) .bar:not(.sel) { padding-inline-start: calc(var(--_rl) + 20px + var(--cm-space-8)); }
|
|
2085
2088
|
:host([resource-rows]) .bar.sel { grid-template-columns: calc(20px + var(--cm-space-8) - var(--cm-space-20)) var(--cm-table-columns, var(--_cols)); }
|
|
2086
2089
|
}
|
|
2087
|
-
`];$("cm-table-header",
|
|
2090
|
+
`];$("cm-table-header",cs);var Ty=`
|
|
2088
2091
|
[data-cm-density="compact"] { --cm-table-row-height: 40px; --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
2089
2092
|
[data-cm-density="comfortable"] { --cm-table-row-height: 48px; --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
|
|
2090
|
-
`,
|
|
2093
|
+
`,ch=null,Df=new WeakSet;function dh(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(!Df.has(t)){Df.add(t);try{ch||(ch=new CSSStyleSheet,ch.replaceSync(Ty)),t.adoptedStyleSheets=[...t.adoptedStyleSheets,ch]}catch{}}}var ik=z("dataTable",{empty:"No data",sorted:"Sorted by {column}, {direction}",scrollHint:"Scroll for more",columns:"Columns",showColumns:"Show columns",resize:"Resize {column} column",resized:"{column} column, {width} pixels wide",viewAll:"View all fields",viewLess:"Hide fields",rowAction:"{action}, {name}"}),Af=48,Rf=16,Hf=!1,zy=`
|
|
2091
2094
|
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); }
|
|
2092
2095
|
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); }
|
|
2093
2096
|
cm-data-table > table th, cm-data-table > table td { box-sizing: border-box; }
|
|
@@ -2136,52 +2139,52 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2136
2139
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
|
|
2137
2140
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
|
|
2138
2141
|
}
|
|
2139
|
-
`;function
|
|
2142
|
+
`;function _y(){if(Hf||typeof document>"u")return;Hf=!0;let o=new CSSStyleSheet;o.replaceSync(zy),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var Ko=o=>o.type==="numeric"||o.type==="money",Cy=o=>(o.align??(Ko(o)||o.type==="actions"?"end":"start"))==="end",Sy=o=>!o.type||o.type==="text";function Nf(o){if(typeof o=="number")return o;let n=String(o??"").trim(),e=/^\(.*\)$/.test(n)||/^-|^[^\d]*-\s*\d/.test(n),t=n.match(/\d[\d,]*(?:\.\d+)?/);if(!t)return NaN;let i=Number(t[0].replace(/,/g,""));return e?-i:i}var If=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),Pf=new Map;function Ly(o){let n=Pf.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"})}Pf.set(o??"",n)}return n}function Of(o,n,e,t){let i=a=>a==null||a==="";return i(o)||i(n)?i(o)===i(n)?0:i(o)?1:-1:e==="numeric"||e==="money"?(Nf(o)||0)-(Nf(n)||0):e==="date"?(If(o)||0)-(If(n)||0):Ly(t).compare(String(o),String(n))}var qf=o=>o.parentElement??o.getRootNode().host??null,gs,fs,Wo,bs,fr,vs,br,gh,_,Lp,Dp,Ap,Bf,Rp,Ff,jf,Uf,vr,ds,hs,hh,ms,ps,mh,Hp,Np,Ip,Vf,Kf,Pp,Op,ph,Wf,Gf,Yf,uh,ys,Xf,Jf,Zf,Qf,eb,tb,ib,us=class extends T{constructor(){super(...arguments);p(this,_);this.columns=[];this.rows=[];this.totals=null;this.caption="";this.captionHidden=!1;this.sort="";this.direction="ascending";this.sortMode="auto";this.stickyHeader=!1;this.stickyFirstColumn=!1;this.loading=!1;this.loadingRows=5;this.mobile="scroll";this.rowActions="hover";this.resizable=!1;this.columnPicker=!1;this._light=!1;this._announce="";this._widths={};this._expanded=new Set;this._picker=!1;this._overflows=!1;p(this,gs,!1);p(this,fs,A("cm-dt"));p(this,Wo,new MutationObserver(()=>s(this,_,Lp).call(this)));p(this,bs,typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s(this,_,ds).call(this)));p(this,fr,[]);p(this,vs,0);p(this,br,-1);p(this,gh,e=>{e.target?.closest?.("[data-lines]")&&s(this,_,mh).call(this,e)});p(this,vr,()=>{r(this,vs)||!this.stickyHeader||g(this,vs,requestAnimationFrame(()=>{g(this,vs,0),s(this,_,ds).call(this)}))});p(this,ys,e=>{let t=this.renderRoot.querySelector(".tools");t&&!e.composedPath().includes(t)&&s(this,_,uh).call(this,!1)})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerover",r(this,gh)),dh(this),s(this,_,Lp).call(this),r(this,Wo).observe(this,{childList:!0,subtree:!0}),document.addEventListener("scroll",r(this,vr),{capture:!0,passive:!0}),window.addEventListener("resize",r(this,vr),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Wo).disconnect(),r(this,bs)?.disconnect(),g(this,fr,[]),document.removeEventListener("scroll",r(this,vr),{capture:!0}),window.removeEventListener("resize",r(this,vr)),document.removeEventListener("pointerdown",r(this,ys),{capture:!0})}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(a=>a.key===this.sort);if(!t||this.sortMode==="manual")return e;let i=this.direction==="descending"?-1:1;return e.map((a,l)=>[a,l]).sort(([a,l],[d,m])=>{let u=a[t.key],v=d[t.key],f=u==null||u==="",w=v==null||v==="";return f||w?f===w?l-m:f?1:-1:i*Of(u,v,t.type,this.locale)||l-m}).map(([a])=>a)}get visibleColumns(){return(this.columns??[]).filter(e=>e.visible!==!1)}updated(e){if(r(this,gs)&&(e.has("sort")||e.has("direction"))&&this.sort){g(this,gs,!1);let t=this.columns.find(i=>i.key===this.sort);t&&s(this,_,Ap).call(this,t.label,this.direction)}if(e.has("columns")){let t=e.get("columns")??[],i={...this._widths},a=!1;for(let l of this.columns??[]){let d=t.find(m=>m.key===l.key);l.width!==void 0&&d?.width!==l.width&&i[l.key]!==void 0&&(delete i[l.key],a=!0)}a&&(this._widths=i)}s(this,_,Uf).call(this),s(this,_,ds).call(this)}render(){let e=c`<span class="sr" role="status">${this._announce}</span>`,t=c`<p class="hint" part="scroll-hint" aria-hidden="true">${this.t("scrollHint")}<cm-icon name="chevron-right" size="16"></cm-icon></p>`,i=c`<span class="fade s" aria-hidden="true"></span><span class="fade e" aria-hidden="true"></span>`,a=this.stickyHeader||this.stickyFirstColumn||this._overflows;if(this._light)return c`<div class="frame" part="frame"><div class="wrap"><div class="scroll" part="scroll" tabindex=${this._overflows?"0":h}
|
|
2140
2143
|
role=${this._overflows?"region":h} aria-label=${this._overflows?this.querySelector("caption")?.textContent?.trim()||h:h}
|
|
2141
|
-
@scroll=${()=>s(this,_,
|
|
2144
|
+
@scroll=${()=>s(this,_,ds).call(this)}><slot></slot></div>${i}</div>${t}</div>${e}`;let l=this.visibleColumns,d=s(this,_,Np).call(this,l),m=this.mobile==="priority"?l.filter(y=>y.priority==="low"&&y!==d):[],u=this.sortedRows,v=Math.max(1,l.length),f=!this.loading&&u.length===0,w=this.mobile==="cards"&&!this.loading&&u.length>0;return c`
|
|
2142
2145
|
<div class="frame" part="frame" ?data-cards=${w}>
|
|
2143
|
-
${this.columnPicker?s(this,_,
|
|
2146
|
+
${this.columnPicker?s(this,_,Zf).call(this):h}
|
|
2144
2147
|
<div class="wrap">
|
|
2145
2148
|
<div class="scroll" part="scroll" tabindex=${a?"0":h}
|
|
2146
2149
|
role=${a?"region":h}
|
|
2147
|
-
aria-label=${a&&this.caption?this.caption:h} @scroll=${()=>s(this,_,
|
|
2148
|
-
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,_,
|
|
2149
|
-
@focusout=${s(this,_,
|
|
2150
|
+
aria-label=${a&&this.caption?this.caption:h} @scroll=${()=>s(this,_,ds).call(this)}>
|
|
2151
|
+
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,_,mh)} @focusin=${s(this,_,Hp)}
|
|
2152
|
+
@focusout=${s(this,_,Hp)}>
|
|
2150
2153
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
2151
|
-
<thead><tr>${l.map(y=>s(this,_,
|
|
2154
|
+
<thead><tr>${l.map(y=>s(this,_,Qf).call(this,y,d))}</tr></thead>
|
|
2152
2155
|
<tbody>
|
|
2153
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,
|
|
2154
|
-
${
|
|
2156
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,ms).call(this,y,d)} style=${s(this,_,ps).call(this,y)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((y,k)=>s(this,_,eb).call(this,y,l,d,m,k))}
|
|
2157
|
+
${f?c`<tr class="empty"><td colspan=${v}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
2155
2158
|
</tbody>
|
|
2156
|
-
${this.totals&&!this.loading&&!
|
|
2159
|
+
${this.totals&&!this.loading&&!f?c`<tfoot><tr part="totals">${l.map(y=>c`<td class=${s(this,_,ms).call(this,y,d)} style=${s(this,_,ps).call(this,y)}>${y.type==="actions"?h:s(this,_,hs).call(this,this.totals[y.key])}</td>`)}</tr></tfoot>`:h}
|
|
2157
2160
|
</table>
|
|
2158
2161
|
</div>
|
|
2159
2162
|
${i}
|
|
2160
2163
|
</div>
|
|
2161
2164
|
${t}
|
|
2162
|
-
${w?s(this,_,
|
|
2165
|
+
${w?s(this,_,ib).call(this,u,l,d):h}
|
|
2163
2166
|
</div>${e}
|
|
2164
|
-
`}};
|
|
2167
|
+
`}};gs=new WeakMap,fs=new WeakMap,Wo=new WeakMap,bs=new WeakMap,fr=new WeakMap,vs=new WeakMap,br=new WeakMap,gh=new WeakMap,_=new WeakSet,Lp=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(_y(),s(this,_,Bf).call(this))},Dp=function(e){this._announce=this._announce===e?`${e}\xA0`:e},Ap=function(e,t){s(this,_,Dp).call(this,this.t("sorted",{column:e,direction:this.t(t)}))},Bf=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;if(!t)return;let i=[...t];i.forEach((a,l)=>{if(!a.dataset.sort||a.querySelector(":scope > button.cm-sort"))return;a.dataset.type=a.dataset.sort;let d=document.createElement("button");d.type="button",d.className="cm-sort",d.append(...a.childNodes);let m=document.createElement("cm-icon");m.setAttribute("size","12"),d.append(m),a.append(d),a.hasAttribute("aria-sort")||a.setAttribute("aria-sort","none"),s(this,_,Rp).call(this,a),d.addEventListener("click",()=>s(this,_,Ff).call(this,e,a,l))});for(let a of[...e.tBodies,...e.tFoot?[e.tFoot]:[]])for(let l of a.rows)[...l.cells].forEach((d,m)=>{let u=i[m];u&&(d.dataset.label||(d.dataset.label=(u.textContent??"").trim()),u.dataset.priority&&!d.dataset.priority&&(d.dataset.priority=u.dataset.priority),u.dataset.type==="actions"&&!d.dataset.type&&(d.dataset.type="actions"))})},Rp=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Ff=function(e,t,i){let a=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),l=t.dataset.key||a,d=t.getAttribute("aria-sort")==="ascending"?"descending":"ascending",m=new CustomEvent("cm-sort",{detail:{key:l,direction:d},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(m)||this.sortMode==="manual")return;let u=t.dataset.sort,v=d==="descending"?-1:1;for(let f of e.tBodies){let w=k=>{let D=k.cells[i];return D?(D.dataset.value??D.textContent??"").trim():""},y=[...f.rows].map((k,D)=>[k,w(k),D]).sort(([,k,D],[,H,B])=>k===""||H===""?k===H?D-B:k===""?1:-1:v*Of(k,H,u,this.locale)||D-B);f.append(...y.map(([k])=>k))}for(let f of e.tHead.rows[0].cells)f.dataset.sort&&(f.setAttribute("aria-sort",f===t?d:"none"),s(this,_,Rp).call(this,f));s(this,_,Ap).call(this,a,d)},jf=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",i=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),a=this.dispatchEvent(i);g(this,gs,a),a&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},Uf=function(){let e=[this.renderRoot.querySelector(".scroll"),this.renderRoot.querySelector("table")??this.querySelector(":scope > table")].filter(Boolean);e.length===r(this,fr).length&&e.every((t,i)=>t===r(this,fr)[i])||(r(this,bs)?.disconnect(),e.forEach(t=>r(this,bs)?.observe(t)),g(this,fr,e))},vr=new WeakMap,ds=function(){let e=this.renderRoot?.querySelector(".scroll"),t=this.renderRoot?.querySelector(".frame");if(!e||!t)return;let i=getComputedStyle(e).maxBlockSize!=="none",a=e.scrollWidth>e.clientWidth+1;a!==this._overflows&&(this._overflows=a),e.toggleAttribute("data-open",this.stickyHeader&&!i&&!a);let l=Math.abs(e.scrollLeft);t.toggleAttribute("data-more-start",a&&l>1),t.toggleAttribute("data-more-end",a&&l+e.clientWidth<e.scrollWidth-1);let d=this.renderRoot.querySelector("caption")??this.querySelector(":scope > table > caption"),m=d&&getComputedStyle(d).position!=="absolute"?`${d.offsetHeight}px`:"";e.parentElement.style.getPropertyValue("--_cap")!==m&&e.parentElement.style.setProperty("--_cap",m);let u=0,v=this.renderRoot.querySelector("table")??this.querySelector(":scope > table"),f=v?.tHead;if(this.stickyHeader&&!i&&a&&v&&f){let w=r(this,br)>0?r(this,br):0,y=f.getBoundingClientRect().top-w,k=v.getBoundingClientRect().bottom-w,D=0;for(let H=qf(this);H&&H!==document.documentElement&&H!==document.body;H=qf(H)){let B=getComputedStyle(H);/(auto|scroll|overlay|hidden|clip)/.test(B.overflowY)&&(D=Math.max(D,H.getBoundingClientRect().top+H.clientTop+(parseFloat(B.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 w of this.renderRoot.querySelectorAll(".rz")){let y=String(Math.round(w.closest("th").getBoundingClientRect().width));w.getAttribute("aria-valuenow")!==y&&w.setAttribute("aria-valuenow",y)}u!==r(this,br)&&(g(this,br,u),u?e.style.setProperty("--_shift",`${u}px`):e.style.removeProperty("--_shift"))},hs=function(e){return e==null?"":e instanceof Date?ae(e,{},this.locale):String(e)},hh=function(e){return this._widths[e.key]??e.width},ms=function(e,t){return[Cy(e)&&"end",Ko(e)&&"num",(Ko(e)||e.type==="date")&&"nw",e.type==="actions"&&"act",e.priority==="low"&&e!==t&&"low",s(this,_,hh).call(this,e)!==void 0&&"w"].filter(Boolean).join(" ")},ps=function(e){let t=s(this,_,hh).call(this,e);return t===void 0?h:`--_w: ${t}px`},mh=function(e){let t=e.composedPath()[0]?.closest?.("[data-lines]");if(t&&this.contains(t)){t.scrollWidth>t.clientWidth+1||t.scrollHeight>t.clientHeight+1?t.title=t.textContent?.trim()??"":t.removeAttribute("title");return}let i=e.composedPath()[0]?.closest?.(".t");i&&(i.scrollWidth>i.clientWidth+1||i.scrollHeight>i.clientHeight+1?i.title=i.textContent??"":i.removeAttribute("title"))},Hp=function(e){e.type==="focusin"&&s(this,_,mh).call(this,e);let t=e.composedPath().find(a=>a instanceof HTMLTableRowElement);if(!t)return;let i=e.type==="focusin"||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget);t.toggleAttribute("data-focus",i)},Np=function(e){return e.find(t=>t.primary)??e.find(t=>t.type!=="actions")??e[0]},Ip=function(e,t){return t?s(this,_,hs).call(this,e[t.key]):""},Vf=function(e,t){let i=t[e.key];return Array.isArray(i)?i:e.actions??[]},Kf=function(e,t){let i=(this.rows??[]).indexOf(t);this.dispatchEvent(new CustomEvent("cm-row-action",{detail:{action:e.value??e.label,row:t,index:i},bubbles:!0,composed:!0}))},Pp=function(e,t,i){return c`<span class="acts">${s(this,_,Vf).call(this,e,t).map(a=>c`<cm-button size="slim" icon=${a.icon??h}
|
|
2165
2168
|
?icon-only=${!!a.iconOnly} label=${a.iconOnly?this.t("rowAction",{action:a.label,name:i}):h} tone=${a.tone??h}
|
|
2166
|
-
@click=${()=>s(this,_,
|
|
2167
|
-
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,
|
|
2168
|
-
@click=${()=>s(this,_,
|
|
2169
|
-
<fieldset class="panel" id="${r(this,
|
|
2169
|
+
@click=${()=>s(this,_,Kf).call(this,a,t)}>${a.label}${a.iconOnly||!i?h:c`<span class="sr">, ${i}</span>`}</cm-button>`)}</span>`},Op=function(e,t,i){if(e.type==="actions")return s(this,_,Pp).call(this,e,t,i);let a=s(this,_,hs).call(this,t[e.key]);if(!Sy(e))return a;let l=Math.trunc(Number(e.lines))||0;return l>1?c`<span class="t lines" style="--_lines: ${l}">${a}</span>`:c`<span class="t">${a}</span>`},ph=function(e,t,i){let a=Math.max(Af,Math.round(t));this._widths={...this._widths,[e.key]:a},i&&(s(this,_,Dp).call(this,this.t("resized",{column:e.label,width:a})),this.dispatchEvent(new CustomEvent("cm-column-resize",{detail:{key:e.key,width:a},bubbles:!0,composed:!0})))},Wf=function(e,t){return s(this,_,hh).call(this,e)??Math.round(t.closest("th").getBoundingClientRect().width)},Gf=function(e,t){let i=J(e,this);i!=="ArrowLeft"&&i!=="ArrowRight"||(e.preventDefault(),s(this,_,ph).call(this,t,s(this,_,Wf).call(this,t,e.currentTarget)+(i==="ArrowRight"?Rf:-Rf),!0))},Yf=function(e,t){if(e.button!==0)return;e.preventDefault();let i=e.currentTarget,a=i.closest("th").getBoundingClientRect().width,l=e.clientX,d=getComputedStyle(this).direction==="rtl";try{i.setPointerCapture(e.pointerId)}catch{}i.setAttribute("data-dragging","");let m=a,u=f=>{m=a+(f.clientX-l)*(d?-1:1),s(this,_,ph).call(this,t,m,!1)},v=()=>{i.removeEventListener("pointermove",u),i.removeEventListener("pointerup",v),i.removeEventListener("pointercancel",v),i.removeAttribute("data-dragging"),s(this,_,ph).call(this,t,m,!0)};i.addEventListener("pointermove",u),i.addEventListener("pointerup",v),i.addEventListener("pointercancel",v)},uh=function(e=!this._picker){this._picker=e,e?document.addEventListener("pointerdown",r(this,ys),{capture:!0}):document.removeEventListener("pointerdown",r(this,ys),{capture:!0})},ys=new WeakMap,Xf=function(e){e.key!=="Escape"||!this._picker||(e.stopPropagation(),s(this,_,uh).call(this,!1),this.renderRoot.querySelector(".pick")?.focus())},Jf=function(e,t){let i=this.columns.map(a=>a.key===e?{...a,visible:t}:a);this.columns=i,this.dispatchEvent(new CustomEvent("cm-columns-change",{detail:{key:e,visible:t,columns:i},bubbles:!0,composed:!0}))},Zf=function(){let e=this.columns??[],t=s(this,_,Np).call(this,this.visibleColumns);return c`<div class="tools" part="tools" @keydown=${s(this,_,Xf)}>
|
|
2170
|
+
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,fs)}-cols"
|
|
2171
|
+
@click=${()=>s(this,_,uh).call(this)}>${this.t("columns")}<cm-icon name="chevron-down" size="16" aria-hidden="true"></cm-icon></button>
|
|
2172
|
+
<fieldset class="panel" id="${r(this,fs)}-cols" part="column-panel" ?hidden=${!this._picker}>
|
|
2170
2173
|
<legend class="sr">${this.t("showColumns")}</legend>
|
|
2171
2174
|
${e.map(i=>c`<label class="opt"><input type="checkbox" .checked=${i.visible!==!1} ?disabled=${i===t}
|
|
2172
|
-
@change=${a=>s(this,_,
|
|
2175
|
+
@change=${a=>s(this,_,Jf).call(this,i.key,a.target.checked)} />${i.label}</label>`)}
|
|
2173
2176
|
</fieldset>
|
|
2174
|
-
</div>`},
|
|
2177
|
+
</div>`},Qf=function(e,t){let i=this.sort===e.key,a=i?this.direction:"none",d=e.hidden||e.type==="actions"?c`<span class="sr">${e.label}</span>`:c`<span class="t">${e.label}</span>`;return c`<th scope="col" class=${s(this,_,ms).call(this,e,t)} style=${s(this,_,ps).call(this,e)} aria-sort=${e.sortable?a:h}><div class="h">${e.sortable?c`<button type="button" class="sort ${i?"on":""}" @click=${()=>s(this,_,jf).call(this,e)}>${d}<cm-icon
|
|
2175
2178
|
name=${i&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}${this.resizable&&e.type!=="actions"?c`<span class="rz" part="resize-handle" role="separator" aria-orientation="vertical" tabindex="0" aria-label=${this.t("resize",{column:e.label})}
|
|
2176
|
-
aria-valuemin=${
|
|
2177
|
-
@keydown=${m=>s(this,_,
|
|
2178
|
-
@click=${()=>s(this,_,
|
|
2179
|
-
<dl class="pairs">${a.map(
|
|
2179
|
+
aria-valuemin=${Af} aria-valuemax="1600"
|
|
2180
|
+
@keydown=${m=>s(this,_,Gf).call(this,m,e)} @pointerdown=${m=>s(this,_,Yf).call(this,m,e)}></span>`:h}</div></th>`},eb=function(e,t,i,a,l){let d=s(this,_,Ip).call(this,e,i),m=this._expanded.has(e),u=`${r(this,fs)}-more-${l}`,v=c`<tr part="row">${t.map(f=>f===i?c`<th scope="row" class=${s(this,_,ms).call(this,f,i)} style=${s(this,_,ps).call(this,f)} part="cell">${s(this,_,Op).call(this,f,e,d)}${a.length?c`<button type="button" class="more-btn" aria-expanded=${m?"true":"false"} aria-controls=${u}
|
|
2181
|
+
@click=${()=>s(this,_,tb).call(this,e)}>${this.t(m?"viewLess":"viewAll")}</button>`:h}</th>`:c`<td class=${s(this,_,ms).call(this,f,i)} style=${s(this,_,ps).call(this,f)} part="cell">${s(this,_,Op).call(this,f,e,d)}</td>`)}</tr>`;return c`${v}${a.length&&m?c`<tr class="more" id=${u} part="row-details"><td colspan=${t.length-a.length}>
|
|
2182
|
+
<dl class="pairs">${a.map(f=>c`<dt>${f.label}</dt><dd class=${Ko(f)?"num":""}>${s(this,_,hs).call(this,e[f.key])}</dd>`)}</dl></td></tr>`:h}`},tb=function(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t},ib=function(e,t,i){let a=t.filter(m=>m!==i&&m.type!=="actions"),l=t.filter(m=>m.type==="actions"),d=(m,u=!1)=>{let v=s(this,_,Ip).call(this,m,i);return c`<li class="card ${u?"total":""}" part="card">
|
|
2180
2183
|
<p class="card-title">${v}</p>
|
|
2181
|
-
${a.length?c`<dl class="pairs">${a.map(
|
|
2182
|
-
${!u&&l.length?c`<div class="card-actions">${l.map(
|
|
2184
|
+
${a.length?c`<dl class="pairs">${a.map(f=>c`<dt>${f.label}</dt><dd class=${Ko(f)?"num":""}>${s(this,_,hs).call(this,m[f.key])}</dd>`)}</dl>`:h}
|
|
2185
|
+
${!u&&l.length?c`<div class="card-actions">${l.map(f=>s(this,_,Pp).call(this,f,m,v))}</div>`:h}
|
|
2183
2186
|
</li>`};return c`${this.caption?c`<p class="cards-caption" aria-hidden="true">${this.caption}</p>`:h}
|
|
2184
|
-
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(m=>d(m))}${this.totals?d(this.totals,!0):h}</ul>`},
|
|
2187
|
+
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(m=>d(m))}${this.totals?d(this.totals,!0):h}</ul>`},us.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}},us.styles=[E,x`
|
|
2185
2188
|
:host { display: block; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
2186
2189
|
:host([density='compact']) { --cm-table-row-height: 40px; }
|
|
2187
2190
|
:host([density='comfortable']) { --cm-table-row-height: 48px; }
|
|
@@ -2341,7 +2344,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2341
2344
|
:host([mobile='priority']) tr.more { display: table-row; }
|
|
2342
2345
|
}
|
|
2343
2346
|
@media (forced-colors: active) { button.sort cm-icon { opacity: 1; } .acts { opacity: 1 !important; } }
|
|
2344
|
-
`];$("cm-data-table",
|
|
2347
|
+
`];$("cm-data-table",us);var ck=z("resourceItem",{select:"Select {name}"}),dk=z("resourceList",{resourceName:"item",resourceNamePlural:"items",select:"Select",selectPageHidden:"all {count} {resource} on this page",selectionOptions:"Selection options",selectPage:"Select all {count} on this page",selectAll:"Select all {count} {resource}",selectNone:"Select none",selected:"{count} {resource} selected.",allSelected:"All {count} {resource} selected.",clearSelection:"Clear selection",loading:"Loading {resource}"}),rb=x`
|
|
2345
2348
|
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
2346
2349
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
2347
2350
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -2353,17 +2356,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2353
2356
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
2354
2357
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2355
2358
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
2356
|
-
`,
|
|
2359
|
+
`,bh,ks,ab,sb,ws=class extends T{constructor(){super();p(this,ks);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;this.columns=!1;this.actions="auto";this._hasActions=!1;p(this,bh,this.attachInternals());r(this,bh).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`
|
|
2357
2360
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
2358
|
-
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,
|
|
2361
|
+
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,ks,sb)}>
|
|
2359
2362
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
2360
2363
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
2361
2364
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
2362
2365
|
<span class="media"><slot name="media"></slot></span>
|
|
2363
2366
|
<div class="content" part="content"><slot></slot></div>
|
|
2364
|
-
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,
|
|
2367
|
+
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,ks,ab)}></slot></div>
|
|
2365
2368
|
</div>
|
|
2366
|
-
`}};
|
|
2369
|
+
`}};bh=new WeakMap,ks=new WeakSet,ab=function(e){this._hasActions=e.target.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim())},sb=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i!==this&&i.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},ws.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0},columns:{type:Boolean,reflect:!0},actions:{reflect:!0},_hasActions:{state:!0}},ws.styles=[E,rb,x`
|
|
2367
2370
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2368
2371
|
:host(:last-child) { border-bottom: 0; }
|
|
2369
2372
|
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
|
|
@@ -2408,32 +2411,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2408
2411
|
::slotted([slot='media']) { width: 32px; height: 32px; }
|
|
2409
2412
|
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 32px; }
|
|
2410
2413
|
}
|
|
2411
|
-
`];$("cm-resource-item",
|
|
2412
|
-
${this.selectable&&
|
|
2413
|
-
<div class="head ${this.selectable||this._hasHeader?"on":""} ${
|
|
2414
|
-
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,
|
|
2415
|
-
${this.selectable?c`<div class="toolbar ${
|
|
2414
|
+
`];$("cm-resource-item",ws);var Go,Yo,ye,nb,qp,vh,yh,xs,fh,xh,$s=class extends T{constructor(){super();p(this,ye);this.selectable=!1;this.total=0;this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this._count=0;this._rows=0;this._hasHeader=!1;this._hasTable=!1;this._hasActions=!1;p(this,Go,A("cm-rl"));p(this,Yo,new Set);p(this,vh,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,s(this,ye,qp).call(this,t)});p(this,yh,e=>{this._hasActions=e.target.assignedElements().length>0});p(this,xh,e=>{e.stopPropagation();let t=e.detail.value;t==="page"?this.selectPage(!0):t==="all"?this.selectAll():t==="none"&&this.clearSelection()});this.addEventListener("cm-resource-select",e=>{e.target!==this&&(this.allSelected=!1,s(this,ye,xs).call(this),s(this,ye,fh).call(this))})}connectedCallback(){super.connectedCallback(),dh(this)}get items(){return[...this.querySelectorAll(":scope > cm-resource-item")]}get selected(){return this.items.filter(e=>e.selected).map(e=>e.value)}selectPage(e=!0){this.items.forEach(t=>{t.disabled||(t.selected=e)}),e||(this.allSelected=!1),s(this,ye,xs).call(this),s(this,ye,fh).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,s(this,ye,xs).call(this),s(this,ye,fh).call(this)}clearSelection(){this.selectPage(!1)}updated(e){e.has("selectable")&&(s(this,ye,xs).call(this),s(this,ye,qp).call(this))}render(){let e=this._count,t=this._rows,i=this.items.filter(k=>!k.disabled).length,a=i>0&&e>=i,l=s(this,ye,nb).call(this),d=k=>uc(k,this.locale)==="one"?this.resourceName:l,m=this.total>t,u=h;this.allSelected?u=c`${this.t("allSelected",{count:Math.max(this.total,e),resource:l})} <button type="button" @click=${()=>this.clearSelection()}>${this.t("clearSelection")}</button>`:e&&(u=c`${this.t("selected",{count:e,resource:d(e)})}${a&&m?c` <button type="button" @click=${()=>this.selectAll()}>${this.t("selectAll",{count:this.total,resource:l})}</button>`:h}`);let v=e>0||this.allSelected,f=this._hasTable,w=!this.hideSelectMenu&&(!f||v),y=c`<slot name="actions" @slotchange=${r(this,yh)}></slot>`;return c`
|
|
2415
|
+
${this.selectable&&f?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${y}</div>`:h}
|
|
2416
|
+
<div class="head ${this.selectable||this._hasHeader?"on":""} ${f?"over":""}">
|
|
2417
|
+
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,vh)}></slot></div>
|
|
2418
|
+
${this.selectable?c`<div class="toolbar ${f?"over":""} ${v?"busy":""}" part="toolbar">
|
|
2416
2419
|
<span class="select" part="select">
|
|
2417
|
-
<span class="check"><input id="${r(this,
|
|
2418
|
-
?disabled=${!i} @change=${
|
|
2420
|
+
<span class="check"><input id="${r(this,Go)}-all" type="checkbox" .checked=${a} .indeterminate=${e>0&&!a}
|
|
2421
|
+
?disabled=${!i} @change=${k=>this.selectPage(k.target.checked)} />
|
|
2419
2422
|
<span class="box" aria-hidden="true">${e>0&&!a?c`<span class="dash"></span>`:a?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>
|
|
2420
2423
|
${this.hideSelectMenu?h:c`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")} ?hidden=${!w}
|
|
2421
|
-
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...m?[{label:this.t("selectAll",{count:this.total,resource:l}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${r(this,
|
|
2422
|
-
<label for="${r(this,
|
|
2424
|
+
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...m?[{label:this.t("selectAll",{count:this.total,resource:l}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${r(this,xh)}></cm-action-menu>`}
|
|
2425
|
+
<label for="${r(this,Go)}-all" class=${f||v?"sr":"label"}>${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:d(t)})}</span></label>
|
|
2423
2426
|
</span>
|
|
2424
2427
|
<span class="status" part="status" role="status">${u}</span>
|
|
2425
2428
|
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
2426
|
-
${
|
|
2429
|
+
${f?h:c`<span class="actions ${this._hasActions?"has":""}">${y}</span>`}
|
|
2427
2430
|
</div>`:h}
|
|
2428
2431
|
</div>
|
|
2429
2432
|
<div class="body">
|
|
2430
|
-
<div class="list" part="list" role="list" aria-label=${this.label||l.replace(/^./,
|
|
2431
|
-
<slot @slotchange=${()=>s(this,ye,
|
|
2433
|
+
<div class="list" part="list" role="list" aria-label=${this.label||l.replace(/^./,k=>k.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
2434
|
+
<slot @slotchange=${()=>s(this,ye,xs).call(this)}></slot>
|
|
2432
2435
|
</div>
|
|
2433
2436
|
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
2434
2437
|
</div>
|
|
2435
2438
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
2436
|
-
`}};
|
|
2439
|
+
`}};Go=new WeakMap,Yo=new WeakMap,ye=new WeakSet,nb=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},qp=function(e=this.renderRoot?.querySelector('slot[name="header"]')){if(!e)return;let t=new Set;for(let i of e.assignedElements())i.localName==="cm-table-header"&&t.add(i),i.querySelectorAll("cm-table-header").forEach(a=>t.add(a));for(let i of r(this,Yo))t.has(i)||i.removeAttribute("resource-rows");for(let i of t)i.setAttribute("resource-rows",this.selectable?"selectable":"plain");g(this,Yo,t),this._hasTable=t.size>0},vh=new WeakMap,yh=new WeakMap,xs=function(){let e=this.items;e.forEach(t=>t.selectable=this.selectable),this._rows=e.length,this._count=e.filter(t=>t.selected).length},fh=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},xh=new WeakMap,$s.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name",string:"resourceName"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},density:{reflect:!0},_count:{state:!0},_rows:{state:!0},_hasHeader:{state:!0},_hasTable:{state:!0},_hasActions:{state:!0}},$s.styles=[E,rb,x`
|
|
2437
2440
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
|
|
2438
2441
|
/* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
|
|
2439
2442
|
:host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
@@ -2489,12 +2492,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2489
2492
|
.toolbar .check { width: 20px; height: 20px; }
|
|
2490
2493
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
2491
2494
|
}
|
|
2492
|
-
`];$("cm-resource-list"
|
|
2493
|
-
<div class="row" part="row" @dragover=${s(this,re,
|
|
2495
|
+
`];$("cm-resource-list",$s);var fk=z("nestedItem",{reorder:"Reorder {label}",hint:"Press up or down arrow to move.",hintGroup:"Press up or down arrow to move. At either end of the list, the arrow moves it into the list before or after.",moved:"{label} moved to position {position} of {total}.",movedTo:"{label} moved to {list}, position {position} of {total}."}),bk=z("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),$h,re,Bp,Fp,ob,lb,_i,cb,db,hb,jp,mb,ht=class ht extends T{constructor(){super();p(this,re);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;p(this,$h,this.attachInternals());p(this,_i,!1);r(this,$h).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get list(){let e=this.parentElement;return e?.localName==="cm-nested-list"?e:null}moveToList(e,t){let i=this.list;if(!i||!e)return!1;if(e===i)return t===void 0?!1:this.moveTo(t);if(!i.group||e.group!==i.group)return!1;let a=e.items,l=Math.max(0,Math.min(a.length,t??a.length)),d={item:this,from:i.items.indexOf(this),to:l,fromList:i,toList:e};return this.dispatchEvent(new CustomEvent("cm-move",{detail:d,bubbles:!0,composed:!0,cancelable:!0}))?(e.insertBefore(this,a[l]??null),e.announce(this.t("movedTo",{label:this.label,list:e.heading,position:l+1,total:a.length+1})),!0):!1}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,i=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===i)return!1;let a=new CustomEvent("cm-reorder",{detail:{item:this,from:i,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(a))return!1;let l=t[e];return l.parentElement.insertBefore(this,e>i?l.nextSibling:l),this.closest("cm-nested-list")?.announce(this.t("moved",{label:this.label,position:e+1,total:t.length})),!0}render(){return c`
|
|
2496
|
+
<div class="row" part="row" @dragover=${s(this,re,hb)} @dragleave=${s(this,re,jp)} @drop=${s(this,re,mb)}>
|
|
2494
2497
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
2495
2498
|
aria-describedby="hint"
|
|
2496
|
-
@keydown=${s(this,re,
|
|
2497
|
-
@dragend=${()=>{this.classList.remove("dragging"),ht.dragged=null,
|
|
2499
|
+
@keydown=${s(this,re,ob)} @dragstart=${s(this,re,lb)} @pointerdown=${s(this,re,cb)}
|
|
2500
|
+
@dragend=${()=>{this.classList.remove("dragging"),ht.dragged=null,Xo(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
2498
2501
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
2499
2502
|
<span class="label" part="label">${this.label}</span>
|
|
2500
2503
|
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
@@ -2502,7 +2505,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2502
2505
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
2503
2506
|
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(i=>i.localName==="cm-nested-item");t.forEach(i=>i.sortable=this.sortable),this._hasChildren=t.length>0}}></slot>
|
|
2504
2507
|
</div>
|
|
2505
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}}
|
|
2508
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};$h=new WeakMap,re=new WeakSet,Bp=function(){let e=this.list;return e?.group?[...e.getRootNode().querySelectorAll("cm-nested-list")].filter(i=>i===e||i.group===e.group&&i.sortable&&(!i.collapsible||i.open)):[]},Fp=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},ob=function(e){let t=this.siblings.indexOf(this),i=e.key==="ArrowUp",a=e.key==="ArrowDown";if(i&&t===0||a&&t===this.siblings.length-1){let d=r(this,re,Bp),m=d[d.indexOf(this.list)+(i?-1:1)];if(m){e.preventDefault(),this.moveToList(m,i?m.items.length:0)&&s(this,re,Fp).call(this);return}}let l;if(e.key==="ArrowUp")l=t-1;else if(e.key==="ArrowDown")l=t+1;else if(e.key==="Home")l=0;else if(e.key==="End")l=this.siblings.length-1;else return;e.preventDefault(),this.moveTo(l)&&s(this,re,Fp).call(this)},lb=function(e){if(e.stopPropagation(),r(this,_i)){e.preventDefault();return}ht.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},_i=new WeakMap,cb=function(e){if(e.pointerType==="mouse"||!e.isPrimary)return;let t=e.clientY,i=null,a=d=>{if(d.pointerId===e.pointerId){if(!r(this,_i)){if(Math.abs(d.clientY-t)<6)return;g(this,_i,!0),ht.dragged=this,this.classList.add("dragging")}d.preventDefault(),i=s(this,re,db).call(this,d.clientX,d.clientY),Xo(this,i)}},l=d=>{if(d.pointerId!==e.pointerId)return;document.removeEventListener("pointermove",a,!0),document.removeEventListener("pointerup",l,!0),document.removeEventListener("pointercancel",l,!0);let m=r(this,_i);g(this,_i,!1),ht.dragged=null,this.classList.remove("dragging"),Xo(this,null),!(!m||d.type==="pointercancel"||!i)&&(i.list?this.moveToList(i.list,i.index):this.moveTo(i.index))};document.addEventListener("pointermove",a,!0),document.addEventListener("pointerup",l,!0),document.addEventListener("pointercancel",l,!0)},db=function(e,t){for(let i of r(this,re,Bp)){if(i===this.list)continue;let a=i.getBoundingClientRect();if(e>=a.left&&e<=a.right&&t>=a.top&&t<=a.bottom)return{list:i,index:wh(i.items,this,t)}}return{index:wh(this.siblings,this,t)}},hb=function(e){let t=ht.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.renderRoot.querySelector(".row").getBoundingClientRect(),a=e.clientY>i.top+i.height/2;this.classList.toggle("drop-after",a),this.classList.toggle("drop-before",!a)},jp=function(){this.classList.remove("drop-before","drop-after")},mb=function(e){let t=ht.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.classList.contains("drop-after");s(this,re,jp).call(this);let a=this.siblings,l=a.indexOf(t),d=a.indexOf(this)+(i?1:0);d>l&&(d-=1),t.moveTo(d)},ht.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},ht.styles=[E,x`
|
|
2506
2509
|
:host { display: block; }
|
|
2507
2510
|
.row {
|
|
2508
2511
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2529,20 +2532,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2529
2532
|
.actions { gap: var(--cm-space-8); }
|
|
2530
2533
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2531
2534
|
}
|
|
2532
|
-
`],ht.dragged=null;var
|
|
2535
|
+
`],ht.dragged=null;var Ms=ht;$("cm-nested-item",Ms);function wh(o,n,e){return o.filter(t=>{if(t===n)return!1;let i=t.getBoundingClientRect();return i.top+i.height/2<e}).length}function Xo(o,n){if((o.list??o).getRootNode().querySelectorAll("cm-nested-item.drop-before, cm-nested-item.drop-after, cm-nested-list.drop-target").forEach(i=>i.classList.remove("drop-before","drop-after","drop-target")),!n)return;let t=(n.list?n.list.items:o.siblings).filter(i=>i!==o);t.length?n.index<t.length?t[n.index].classList.add("drop-before"):t[t.length-1].classList.add("drop-after"):n.list?.classList.add("drop-target")}var yr,Ne,pb,Up,Vp,ub,gb,Es=class extends T{constructor(){super(...arguments);p(this,Ne);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;p(this,yr,A("cm-nl"))}get items(){return[...this.children].filter(e=>e.localName==="cm-nested-item")}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}willUpdate(){this.hasUpdated||(this._empty=!this.items.length)}updated(e){(e.has("sortable")||e.has("group"))&&s(this,Ne,Up).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2533
2536
|
<div class="bar" part="bar">
|
|
2534
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,
|
|
2537
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,yr)}-h">${this.heading}</div>
|
|
2535
2538
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2536
|
-
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
2537
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,Ne,
|
|
2539
|
+
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,yr)}-rows"
|
|
2540
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,Ne,pb)}>
|
|
2538
2541
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2539
2542
|
</div>
|
|
2540
|
-
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,
|
|
2541
|
-
@dragover=${s(this,Ne,
|
|
2542
|
-
<slot @slotchange=${()=>{s(this,Ne,
|
|
2543
|
+
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,yr)}-rows" role="list" aria-labelledby="${r(this,yr)}-h" ?hidden=${!t}
|
|
2544
|
+
@dragover=${s(this,Ne,ub)} @drop=${s(this,Ne,gb)}>
|
|
2545
|
+
<slot @slotchange=${()=>{s(this,Ne,Up).call(this),this._empty=!this.items.length}}></slot>
|
|
2543
2546
|
</div>
|
|
2544
2547
|
<span class="sr" role="status">${this._msg}</span>
|
|
2545
|
-
`}};
|
|
2548
|
+
`}};yr=new WeakMap,Ne=new WeakSet,pb=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},Up=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},Vp=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},ub=function(e){let t=Ms.dragged;s(this,Ne,Vp).call(this,t)&&(e.preventDefault(),Xo(t,{list:this,index:wh(this.items,t,e.clientY)}))},gb=function(e){let t=Ms.dragged;if(!s(this,Ne,Vp).call(this,t))return;e.preventDefault();let i=wh(this.items,t,e.clientY);Xo(t,null),t.moveToList(this,i)},Es.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}},Es.styles=[E,x`
|
|
2546
2549
|
:host { display: block; }
|
|
2547
2550
|
.bar {
|
|
2548
2551
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2566,9 +2569,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2566
2569
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2567
2570
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2568
2571
|
}
|
|
2569
|
-
`];$("cm-nested-list"
|
|
2572
|
+
`];$("cm-nested-list",Es);var fb=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},bb=Xr(class extends ii{constructor(o){if(super(o),o.type!==ot.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,n,e){let t;e===void 0?e=n:n!==void 0&&(t=n);let i=[],a=[],l=0;for(let d of o)i[l]=t?t(d,l):l,a[l]=e(d,l),l++;return{values:a,keys:i}}render(o,n,e){return this.dt(o,n,e).values}update(o,[n,e,t]){let i=bg(o),{values:a,keys:l}=this.dt(n,e,t);if(!Array.isArray(i))return this.ut=l,a;let d=this.ut??=[],m=[],u,v,f=0,w=i.length-1,y=0,k=a.length-1;for(;f<=w&&y<=k;)if(i[f]===null)f++;else if(i[w]===null)w--;else if(d[f]===l[y])m[y]=ri(i[f],a[y]),f++,y++;else if(d[w]===l[k])m[k]=ri(i[w],a[k]),w--,k--;else if(d[f]===l[k])m[k]=ri(i[f],a[k]),Jr(o,m[k+1],i[f]),f++,k--;else if(d[w]===l[y])m[y]=ri(i[w],a[y]),Jr(o,i[f],i[w]),w--,y++;else if(u===void 0&&(u=fb(l,y,k),v=fb(d,f,w)),u.has(d[f]))if(u.has(d[w])){let D=v.get(l[y]),H=D!==void 0?i[D]:null;if(H===null){let B=Jr(o,i[f]);ri(B,a[y]),m[y]=B}else m[y]=ri(H,a[y]),Jr(o,i[f],H),i[D]=null;y++}else Dc(i[w]),w--;else Dc(i[f]),f++;for(;y<=k;){let D=Jr(o,m[k+1]);ri(D,a[y]),m[y++]=D}for(;f<=w;){let D=i[f++];D!==null&&Dc(D)}return this.ut=l,Lc(o,m),we}});function vb(o,n,e){let t=l=>e.slotCount(l),i=l=>Math.max(0,t(l)-1),a=l=>{for(let d=n.group+l;d>=0&&d<e.groupCount();d+=l)if(t(d)>0)return{group:d,index:Math.min(n.index,i(d))};return{...n}};switch(o){case"ArrowRight":return a(1);case"ArrowLeft":return a(-1);case"ArrowDown":return{group:n.group,index:Math.min(n.index+1,i(n.group))};case"ArrowUp":return{group:n.group,index:Math.max(n.index-1,0)};case"Home":return{group:n.group,index:0};case"End":return{group:n.group,index:i(n.group)};default:return null}}var le,Ue,Ve,wr=class{constructor(n){p(this,le);p(this,Ue,null);p(this,Ve,null);g(this,le,n)}get active(){return r(this,Ue)!==null}get from(){return r(this,Ue)&&{...r(this,Ue)}}get target(){return r(this,Ve)&&{...r(this,Ve)}}groupCount(){return r(this,le).groupCount()}slotCount(n){return n>=0&&n<r(this,le).groupCount()?r(this,le).slotCount(n):0}pickUp(n){this.active&&this.cancel(),g(this,Ue,{...n}),g(this,Ve,{...n}),r(this,le).onTarget?.(this.target),r(this,le).announce(r(this,le).messages.pickedUp(this.target))}moveTo(n){if(!r(this,Ve))return;let e=Math.max(0,Math.min(n.group,r(this,le).groupCount()-1)),t=this.slotCount(e);t<=0||(g(this,Ve,{group:e,index:Math.max(0,Math.min(n.index,t-1))}),r(this,le).onTarget?.(this.target),r(this,le).announce(r(this,le).messages.over(this.target)))}drop(){if(!r(this,Ue)||!r(this,Ve))return;let n=r(this,Ue),e=r(this,Ve);g(this,Ue,g(this,Ve,null)),r(this,le).onTarget?.(null),r(this,le).onDrop(n,e)}cancel(n=!1){if(!r(this,Ue))return;let e=r(this,Ue),t=n?"":r(this,le).messages.cancelled(e);g(this,Ue,g(this,Ve,null)),r(this,le).onTarget?.(null),r(this,le).onCancel?.(e),t&&r(this,le).announce(t)}handleKey(n,e=n.key){if(!this.active||n.altKey||n.ctrlKey||n.metaKey)return!1;if(e===" "||e==="Enter")return this.drop(),!0;if(e==="Escape")return this.cancel(),!0;if(e==="Tab")return this.cancel(),!1;let t=(r(this,le).navigate??vb)(e,r(this,Ve),this);return t?(this.moveTo(t),!0):!1}};le=new WeakMap,Ue=new WeakMap,Ve=new WeakMap;var Jo,xr,$r=class{constructor(n=document,e="assertive"){p(this,Jo);p(this,xr);let t=n.createElement("div");t.setAttribute("aria-live",e),t.setAttribute("aria-atomic","true"),t.className="cm-announcer",Object.assign(t.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:"0"}),this.element=t}get text(){return r(this,xr)??this.element.textContent??""}announce(n){clearTimeout(r(this,Jo)),this.element.textContent===n?(this.element.textContent="",g(this,xr,n),g(this,Jo,setTimeout(()=>{this.element.textContent=n,g(this,xr,void 0)},50))):(g(this,xr,void 0),this.element.textContent=n)}};Jo=new WeakMap,xr=new WeakMap;var Rk=z("boardCard",{roleDescription:"movable card",instructions:"Press Space to pick up. Then use the arrow keys to choose a column and a position, Space or Enter to drop, and Escape to cancel.",openHint:"Press Enter to open.",saving:"Saving"}),Hk=z("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),Nk=z("board",{label:"Board",pickedUp:"Picked up {card}. Column {column}, position {position} of {count}.",over:"Column {column}, position {position} of {count}.",moved:"Moved {card} to {column}, position {position} of {count}.",sameSpot:"{card} dropped where it started.",cancelled:"Move cancelled. {card} is back in {column}.",refused:"{card} can't be moved to {column}.",reverted:"Couldn't move {card}. It is back in {column}."}),Dy="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",Zo,Th,yb,kr=class extends T{constructor(){super(...arguments);p(this,Th);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";p(this,Zo,A("cm-bc"))}get name(){let e=i=>(i??"").replace(/\s+/g," ").trim();if(this.label)return this.label;if(this.heading)return this.heading;let t=this.querySelector(':scope > [slot="heading"]');return t?e(t.textContent):e(this.textContent).slice(0,80)}get key(){return this.value||this.name}get opener(){if(this.href)return this.renderRoot?.querySelector(".title a")??null;let e=this.querySelector(':scope > [slot="heading"]');return e?e.matches("a[href], button, cm-button")?e:e.querySelector("a[href], button, cm-button"):null}focusHandle(e){let t=this.renderRoot?.querySelector(".handle");t?t.focus(e):this.focus(e)}open(){let e=this.opener;return e?(e.click(),!0):!1}render(){let e=!!(this.href||this.querySelector(':scope > [slot="heading"] a[href], :scope > [slot="heading"] button, :scope > a[slot="heading"][href], :scope > button[slot="heading"]')),t=this.pending;return c`<div class="card" part="card">
|
|
2570
2573
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2571
|
-
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,
|
|
2574
|
+
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,Zo)}-help"></div>`}
|
|
2572
2575
|
<div class="content">
|
|
2573
2576
|
<div class="head">
|
|
2574
2577
|
<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>
|
|
@@ -2576,11 +2579,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2576
2579
|
<slot name="actions"></slot>
|
|
2577
2580
|
</div>
|
|
2578
2581
|
<div class="lines"><slot></slot></div>
|
|
2579
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,
|
|
2582
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,Th,yb).call(this,i,"_badges")}></slot></div>
|
|
2580
2583
|
</div>
|
|
2581
2584
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2582
|
-
<span id="${r(this,
|
|
2583
|
-
</div>`}};
|
|
2585
|
+
<span id="${r(this,Zo)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2586
|
+
</div>`}};Zo=new WeakMap,Th=new WeakSet,yb=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},kr.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},kr.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}},kr.styles=[E,x`
|
|
2584
2587
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2585
2588
|
.card {
|
|
2586
2589
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2605,22 +2608,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2605
2608
|
:host([moving]) .content { opacity: 0.5; }
|
|
2606
2609
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2607
2610
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2608
|
-
`];$("cm-board-card"
|
|
2611
|
+
`];$("cm-board-card",kr);var _s,Qo,Cs,Ss,Si,kh,xb,Er=class extends T{constructor(){super(...arguments);p(this,Si);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;p(this,_s,!1);this._cards=[];this._drop=null;p(this,Qo,new MutationObserver(()=>s(this,Si,kh).call(this)));p(this,Cs,A("cm-col"));p(this,Ss,!1)}get collapsed(){return r(this,_s)}connectedCallback(){super.connectedCallback(),s(this,Si,kh).call(this),r(this,Qo).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Qo).disconnect()}get cards(){return[...this.children].filter(e=>e.localName==="cm-board-card"&&!e.hasAttribute("slot"))}get key(){return this.value||this.heading}get count(){return typeof this.total=="number"&&!Number.isNaN(this.total)?this.total:this._cards.length}get scrollElement(){return this.renderRoot?.querySelector(".scroll")??null}_sync(){return s(this,Si,kh).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");g(this,_s,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",r(this,_s)),g(this,Ss,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach(i=>{let a=this._cards[Number(i.dataset.i)];a?i.assign(a):i.assign()});let t=i=>[...this.children].filter(a=>a.getAttribute("slot")===i);this.renderRoot.querySelector("slot.actions")?.assign(...t("actions")),this.renderRoot.querySelector("slot.empty")?.assign(...t("empty")),r(this,Ss)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,Ss,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,i=this.count,a=t?e.filter(y=>y!==t.card):e,l=t?e.indexOf(t.card):-1,d=!!t&&!this.collapsed&&!(l>=0&&t.index===l),m=[];e.forEach((y,k)=>{d&&y!==t.card&&a.indexOf(y)===t.index&&m.push({key:"drop"}),m.push({key:y,card:y,i:k})}),d&&t.index>=a.length&&m.push({key:"drop"});let u=this.hasMore||i>e.length,v=this.loading,f=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),w=this.t("count",{count:i});return c`<section aria-labelledby="${r(this,Cs)}-h" class=${t&&this.collapsed?"over":""}>
|
|
2609
2612
|
<header part="header">
|
|
2610
|
-
<div class="title" id="${r(this,
|
|
2613
|
+
<div class="title" id="${r(this,Cs)}-h" role="heading" aria-level=${f}>${this.heading}<span class="sr">, ${w}</span></div>
|
|
2611
2614
|
<span class="count" part="count" aria-hidden="true">${this.formatNumber(i)}</span>
|
|
2612
2615
|
<span class="actions"><slot class="actions"></slot></span>
|
|
2613
2616
|
</header>
|
|
2614
2617
|
<div class="scroll">
|
|
2615
|
-
<ul part="list" role="list" aria-labelledby="${r(this,
|
|
2616
|
-
${
|
|
2618
|
+
<ul part="list" role="list" aria-labelledby="${r(this,Cs)}-h" aria-busy=${v?"true":"false"} tabindex="-1" ?hidden=${this.collapsed}>
|
|
2619
|
+
${bb(m,y=>y.key,y=>y.card?c`<li><slot data-i=${y.i}></slot></li>`:c`<li class="drop" aria-hidden="true"><div style="min-height:${Math.max(40,t.height)}px">${t.card.name}</div></li>`)}
|
|
2617
2620
|
</ul>
|
|
2618
2621
|
${v&&!e.length&&!this.collapsed?c`<div class="loading" aria-hidden="true"><cm-skeleton variant="block"></cm-skeleton><cm-skeleton variant="block"></cm-skeleton></div>`:h}
|
|
2619
2622
|
<div class="empty" ?hidden=${e.length>0||v||u||this.collapsed||d}><slot class="empty">${this.t("empty")}</slot></div>
|
|
2620
|
-
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,
|
|
2623
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,Si,xb)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
2621
2624
|
</div>
|
|
2622
2625
|
<span class="sr" role="status">${v?this.t("loading",{column:this.heading}):""}</span>
|
|
2623
|
-
</section>`}};
|
|
2626
|
+
</section>`}};_s=new WeakMap,Qo=new WeakMap,Cs=new WeakMap,Ss=new WeakMap,Si=new WeakSet,kh=function(){this._cards=this.cards},xb=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},Er.shadowRootOptions={...S.shadowRootOptions,slotAssignment:"manual"},Er.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}},Er.styles=[E,x`
|
|
2624
2627
|
:host {
|
|
2625
2628
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
2626
2629
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -2657,9 +2660,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2657
2660
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
2658
2661
|
:host([collapsed]) .actions { display: none; }
|
|
2659
2662
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
2660
|
-
`];$("cm-board-column",
|
|
2663
|
+
`];$("cm-board-column",Er);var Ce,ke,de,Mr,te,R,Kp,Ts,wb,Wp,$b,kb,Eb,Mb,el,Tb,tl,Gp,Yp,Xp,Eh,zb,il,rl,al,sl,nl,ol,ll,Jp,Zp,Mh,_b,Ci,zs=class extends T{constructor(){super();p(this,R);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;p(this,Ce,new $r);p(this,ke);p(this,de,null);p(this,Mr,new WeakMap);p(this,te,null);p(this,el,e=>{if(r(this,te)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,ke).active){r(this,ke).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let i=s(this,R,Mb).call(this,e.composedPath());if(!(!i||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===" ")e.preventDefault(),this.pickUp(i);else if(e.key==="Enter")i.open()&&e.preventDefault();else if(t.startsWith("Arrow")){let a=s(this,R,Tb).call(this,i,t);a&&(e.preventDefault(),a.focusHandle())}}});p(this,tl,e=>{if(!r(this,ke).active||!r(this,de))return;let t=e.relatedTarget;t&&(t===r(this,de).card||r(this,de).card.contains(t))||!t&&document.hasFocus()===!1||queueMicrotask(()=>{r(this,ke).active&&r(this,de)&&!r(this,de).card.matches(":focus-within")&&r(this,ke).cancel()})});p(this,il,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});p(this,rl,e=>{if(r(this,te)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath(),i=t.find(d=>d.localName==="cm-board-card");if(!i||i.locked||i.pending||t.some(d=>d instanceof Element&&d!==i&&d.matches?.(Dy)))return;let a=s(this,R,Ts).call(this,i);if(!a)return;r(this,ke).active&&r(this,ke).cancel();let l=i.getBoundingClientRect();g(this,te,{card:i,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,dx:e.clientX-l.left,dy:e.clientY-l.top,width:l.width,height:l.height,from:a.column,fromIndex:a.index}),e.pointerType!=="mouse"&&(r(this,te).timer=setTimeout(()=>{r(this,te)&&!r(this,te).started&&s(this,R,Jp).call(this)},300)),window.addEventListener("pointermove",r(this,nl),!0),window.addEventListener("pointerup",r(this,ol),!0),window.addEventListener("pointercancel",r(this,ll),!0),window.addEventListener("touchmove",r(this,al),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,sl),!0)});p(this,al,e=>{r(this,te)?.started&&e.cancelable&&e.preventDefault()});p(this,sl,e=>{r(this,te)&&e.preventDefault()});p(this,nl,e=>{let t=r(this,te);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,R,Jp).call(this):s(this,R,Ci).call(this,!1));return}e.preventDefault(),s(this,R,Zp).call(this),s(this,R,Mh).call(this)}});p(this,ol,e=>{let t=r(this,te);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,R,Ci).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,R,Ci).call(this,!0)});p(this,ll,e=>{r(this,te)&&e.pointerId===r(this,te).pointerId&&s(this,R,Ci).call(this,!1)});g(this,ke,new wr({groupCount:()=>this.columns.length,slotCount:e=>{let t=this.columns[e];return!t||!r(this,de)?0:t.cards.filter(i=>i!==r(this,de).card).length+1},onTarget:e=>s(this,R,$b).call(this,e),onDrop:(e,t)=>s(this,R,Eb).call(this,e,t),onCancel:()=>s(this,R,Wp).call(this),messages:{pickedUp:e=>s(this,R,Kp).call(this,"pickedUp",e),over:e=>s(this,R,Kp).call(this,"over",e),cancelled:e=>this.t("cancelled",{card:r(this,de)?.card.name??"",column:this.columns[e.group]?.heading??""})},announce:e=>r(this,Ce).announce(e)}))}get columns(){return[...this.children].filter(e=>e.localName==="cm-board-column")}column(e){return this.columns.find(t=>t.key===e)}card(e){for(let t of this.columns){let i=t.cards.find(a=>a.key===e);if(i)return i}}get heldCard(){return r(this,de)?.card??null}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,el)),this.addEventListener("focusout",r(this,tl)),this.addEventListener("pointerdown",r(this,rl)),this.addEventListener("dragstart",r(this,il))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,el)),this.removeEventListener("focusout",r(this,tl)),this.removeEventListener("pointerdown",r(this,rl)),this.removeEventListener("dragstart",r(this,il)),r(this,ke).cancel(!0),s(this,R,Ci).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(r(this,Ce).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return r(this,Ce).text}announce(e){r(this,Ce).announce(e)}pickUp(e){let t=typeof e=="string"?this.card(e):e;if(!t||t.locked||t.pending)return!1;let i=s(this,R,Ts).call(this,t);return i?(s(this,R,Ci).call(this,!1),r(this,ke).cancel(!0),g(this,de,{card:t,column:i.column,index:i.index}),t.moving=!0,s(this,R,wb).call(this,t),r(this,ke).pickUp({group:i.group,index:i.index}),!0):!1}cancelMove(){let e=r(this,te);e?.started&&(s(this,R,Ci).call(this,!1),r(this,Ce).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),r(this,ke).cancel()}moveCard(e,t,i){let a=typeof e=="string"?this.card(e):e,l=typeof t=="string"?this.column(t):t;if(!a||!l)return!1;let d=s(this,R,Ts).call(this,a);if(!d)return!1;let m=l.cards.filter(v=>v!==a).length,u=Math.max(0,Math.min(i??m,m));return s(this,R,Eh).call(this,a,d.column,d.index,l,u,"api")}revert(e){let t=typeof e=="string"?this.card(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Mr).get(t);if(this.controlled||!i||(r(this,Mr).delete(t),!i.from.isConnected||!this.contains(i.from)))return!1;let a=t.matches(":focus-within");return s(this,R,Yp).call(this,t,i.from,i.fromIndex),i.totals&&s(this,R,Xp).call(this,i.to,i.from),s(this,R,Gp).call(this,i.to,i.from,a?t:null),r(this,Ce).announce(this.t("reverted",{card:t.name,column:i.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
2661
2664
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
2662
|
-
</div>`}};Ce=new WeakMap,ke=new WeakMap,de=new WeakMap,
|
|
2665
|
+
</div>`}};Ce=new WeakMap,ke=new WeakMap,de=new WeakMap,Mr=new WeakMap,te=new WeakMap,R=new WeakSet,Kp=function(e,t){let i=this.columns[t.group];return this.t(e,{card:r(this,de)?.card.name??"",column:i?.heading??"",position:t.index+1,count:r(this,ke).slotCount(t.group)})},Ts=function(e){let t=this.columns,i=t.findIndex(a=>a.contains(e)&&e.parentElement===a);return i<0?null:{column:t[i],group:i,index:t[i].cards.indexOf(e)}},wb=function(e){let t=()=>!!e.shadowRoot?.activeElement?.classList.contains("handle");e.focusHandle({preventScroll:!0}),requestAnimationFrame(()=>{r(this,de)?.card===e&&!t()&&e.focusHandle({preventScroll:!0})})},Wp=function(){r(this,de)&&(r(this,de).card.moving=!1),g(this,de,null)},$b=function(e){let t=r(this,de);if(this.columns.forEach((i,a)=>{i._drop=t&&e&&a===e.group?{card:t.card,index:e.index,height:t.card.getBoundingClientRect().height}:null}),e){let i=this.columns[e.group];i?.updateComplete.then(()=>{let a=i.renderRoot.querySelector("li.drop")??(t&&t.column===i?t.card:i);s(this,R,kb).call(this,i,a)})}},kb=function(e,t){let i=this.renderRoot.querySelector(".columns");if(i){let l=i.getBoundingClientRect(),d=e.getBoundingClientRect();d.left<l.left?i.scrollLeft-=l.left-d.left+8:d.right>l.right&&(i.scrollLeft+=d.right-l.right+8)}let a=e.scrollElement;if(a){let l=a.getBoundingClientRect(),d=t.getBoundingClientRect();d.top<l.top?a.scrollTop-=l.top-d.top+8:d.bottom>l.bottom&&(a.scrollTop+=d.bottom-l.bottom+8)}},Eb=function(e,t){let i=r(this,de);if(s(this,R,Wp).call(this),!i)return;let a=this.columns[t.group];s(this,R,Eh).call(this,i.card,i.column,e.index,a,t.index,"keyboard")},Mb=function(e){let t=e[0];if(!(t instanceof HTMLElement)||!t.classList?.contains("handle"))return null;let i=e.find(a=>a.localName==="cm-board-card");return i&&s(this,R,Ts).call(this,i)?i:null},el=new WeakMap,Tb=function(e,t){let i=s(this,R,Ts).call(this,e);if(!i)return null;let a=i.column.cards;if(t==="ArrowDown")return a[i.index+1]??null;if(t==="ArrowUp")return a[i.index-1]??null;let l=t==="ArrowRight"?1:-1,d=this.columns;for(let m=i.group+l;m>=0&&m<d.length;m+=l){let u=d[m].cards;if(u.length)return u[Math.min(i.index,u.length-1)]}return null},tl=new WeakMap,Gp=function(e,t,i){e._sync(),t._sync().then(()=>{i?.isConnected&&i.focusHandle({preventScroll:!0})})},Yp=function(e,t,i){let a=t.cards.filter(d=>d!==e),l=a[i];l?l.before(e):a.length?a[a.length-1].after(e):t.append(e)},Xp=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))},Eh=function(e,t,i,a,l,d){let m=e.name;if(t===a&&i===l)return d!=="api"&&r(this,Ce).announce(this.t("sameSpot",{card:m})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let u=[],v={value:e.key,card:e,from:t.key,to:a.key,fromColumn:t,toColumn:a,fromIndex:i,toIndex:l,source:d,waitUntil:y=>{u.push(Promise.resolve(y))}};if(!this.dispatchEvent(new CustomEvent("cm-move",{detail:v,bubbles:!0,composed:!0,cancelable:!0})))return r(this,Ce).announce(this.t("refused",{card:m,column:a.heading})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let w=a.cards.filter(y=>y!==e).length+1;if(this.controlled)d==="keyboard"&&s(this,R,zb).call(this,e.key,a);else{let y=d==="keyboard"||e.matches(":focus-within");s(this,R,Yp).call(this,e,a,l);let k=t!==a;k&&s(this,R,Xp).call(this,t,a),r(this,Mr).set(e,{card:e,from:t,fromIndex:i,to:a,toIndex:l,totals:k}),s(this,R,Gp).call(this,t,a,y?e:null)}return r(this,Ce).announce(this.t("moved",{card:m,column:a.heading,position:l+1,count:w})),u.length&&(e.pending=!0,Promise.all(u).then(()=>{e.pending=!1,this.controlled||r(this,Mr).delete(e)},()=>{e.pending=!1,this.controlled?r(this,Ce).announce(this.t("reverted",{card:m,column:t.heading})):this.revert(e)})),!0},zb=function(e,t){let i=()=>t.isConnected?t.cards.find(d=>d.key===e):void 0,a=()=>{let d=i(),m=!document.activeElement||document.activeElement===document.body||!document.activeElement.isConnected;return!d||!(m||this.contains(document.activeElement))?!1:(t._sync().then(()=>d.updateComplete).then(()=>{d.isConnected&&d.focusHandle({preventScroll:!0})}),!0)},l=new MutationObserver(()=>{a()&&l.disconnect()});l.observe(this,{childList:!0,subtree:!0}),setTimeout(()=>l.disconnect(),1e3)},il=new WeakMap,rl=new WeakMap,al=new WeakMap,sl=new WeakMap,nl=new WeakMap,ol=new WeakMap,ll=new WeakMap,Jp=function(){let e=r(this,te);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges();let t=e.card.cloneNode(!0);t.removeAttribute("id"),t.removeAttribute("moving"),t.setAttribute("ghost",""),t.setAttribute("aria-hidden","true"),t.setAttribute("inert",""),Object.assign(t.style,{position:"fixed",zIndex:"2147483000",left:"0",top:"0",width:`${e.width}px`,margin:"0",pointerEvents:"none",willChange:"transform"}),(this.ownerDocument.body??this.ownerDocument.documentElement).appendChild(t),e.ghost=t,e.card.moving=!0,this.dragging=!0,e.to=e.from,e.toIndex=e.fromIndex,r(this,Ce).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),s(this,R,Zp).call(this),s(this,R,Mh).call(this);let i=()=>{r(this,te)?.started&&(s(this,R,_b).call(this),r(this,te).raf=requestAnimationFrame(i))};e.raf=requestAnimationFrame(i)},Zp=function(){let e=r(this,te);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},Mh=function(){let e=r(this,te);if(!e)return;let t=this.columns;if(!t.length)return;let i=t[0],a=1/0;for(let u of t){let v=u.getBoundingClientRect(),f=e.x<v.left?v.left-e.x:e.x>v.right?e.x-v.right:0;f<a&&(i=u,a=f)}let l=i.cards.filter(u=>u!==e.card),d=l.length;if(i.collapsed)d=0;else for(let u=0;u<l.length;u++){let v=l[u].getBoundingClientRect();if(e.y<v.top+v.height/2){d=u;break}}if(i===e.to&&d===e.toIndex)return;let m=i!==e.to;e.to=i,e.toIndex=d,t.forEach(u=>{u._drop=u===i?{card:e.card,index:d,height:e.height}:null}),m&&r(this,Ce).announce(this.t("over",{column:i.heading,position:d+1,count:l.length+1}))},_b=function(){let e=r(this,te);if(!e)return;let t=48,i=16,a=w=>w<t?Math.ceil((t-Math.max(w,0))/t*i):0,l=!1,d=this.renderRoot.querySelector(".columns");if(d){let w=d.getBoundingClientRect(),y=a(e.x-w.left),k=a(w.right-e.x),D=d.scrollLeft;y?d.scrollLeft-=y:k&&(d.scrollLeft+=k),l||=d.scrollLeft!==D}let m=e.to?.scrollElement;if(m&&m.scrollHeight>m.clientHeight){let w=m.getBoundingClientRect();if(e.x>=w.left&&e.x<=w.right){let y=a(e.y-w.top),k=a(w.bottom-e.y),D=m.scrollTop;y?m.scrollTop-=y:k&&(m.scrollTop+=k),l||=m.scrollTop!==D}}let u=window.innerHeight,v=a(e.y),f=a(u-e.y);if(v||f){let w=window.scrollY;window.scrollBy(0,v?-v:f),l||=window.scrollY!==w}l&&s(this,R,Mh).call(this)},Ci=function(e){let t=r(this,te);t&&(g(this,te,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,nl),!0),window.removeEventListener("pointerup",r(this,ol),!0),window.removeEventListener("pointercancel",r(this,ll),!0),window.removeEventListener("touchmove",r(this,al),!0),window.removeEventListener("contextmenu",r(this,sl),!0),t.ghost?.remove(),t.started&&(t.card.moving=!1,this.dragging=!1,this.columns.forEach(i=>{i._drop=null}),e&&t.to&&t.toIndex!==void 0&&s(this,R,Eh).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},zs.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},zs.styles=[E,x`
|
|
2663
2666
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
2664
2667
|
.board { height: 100%; }
|
|
2665
2668
|
.columns {
|
|
@@ -2673,90 +2676,90 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2673
2676
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
2674
2677
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
2675
2678
|
}
|
|
2676
|
-
`];$("cm-board",Ms);var Ok=z("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),Ls=class extends S{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};Ls.properties={value:{reflect:!0},heading:{},label:{},start:{},end:{},allDay:{type:Boolean,attribute:"all-day",reflect:!0},kind:{},tone:{reflect:!0},icon:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0}},Ls.styles=x`:host { display: none !important; }`;$("cm-calendar-event",Ls);var _h=o=>String(o).padStart(2,"0"),Ef=o=>`${P(o)}T${_h(o.getHours())}:${_h(o.getMinutes())}`,$h=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Mf=["month","week","day"],_y=600,Tf=new Map,zf=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Tf.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Tf.set(e,t)),t},Gp=o=>o.replace(/[ ]/g," ").trim(),As,Se,Le,xe,Z,Q,Tr,Et,We,ul,Di,Rs,Hs,Ns,Is,gl,f,Ee,Si,nl,kh,kt,Yp,ol,mt,Xp,_f,pt,Cs,Cf,Sf,Ke,ll,cl,Eh,Lf,Df,Af,Mr,Jp,dl,Rf,hl,Hf,Nf,If,Pf,bl,fl,Of,qf,vl,ml,Bf,Zp,Qp,eu,Ff,jf,tu,iu,ru,yl,au,Uf,xl,wl,$l,kl,El,Ml,su,Mh,Vf,Li,pl,Kf,nu,Wf,Th,ou,Ss,zh,Gf,Yf,Xf,Jf,Zf,Ds=class extends T{constructor(){super();p(this,f);this.view="month";this.date="";this.today="";this.step=15;p(this,As,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;p(this,Se,A("cm-cal"));p(this,Le,new wr);p(this,xe);p(this,Z,null);p(this,Q,null);p(this,Tr,new WeakMap);p(this,Et,"");p(this,We,null);p(this,ul,"");p(this,Di,!0);p(this,Rs,0);p(this,Hs,!1);p(this,Ns);p(this,Is,0);p(this,gl,new MutationObserver(()=>this.requestUpdate()));p(this,bl,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Et,t.dataset.k);for(let i of s(this,f,hl).call(this))i.tabIndex=i===t?0:-1}});p(this,fl,e=>{let t=e.relatedTarget;if(this._more&&!r(this,Z)){let i=this.renderRoot.querySelector(".pop"),a=e.composedPath()[0];i&&i.contains(a)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,xe).active||!r(this,Z)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,xe).active||!r(this,Z))return;this.renderRoot.activeElement?.dataset.ev!==r(this,Z).ev.key&&r(this,xe).cancel()}))});p(this,vl,e=>{if(r(this,Q)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,xe).active){r(this,xe).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let a=i.closest(".pop");if(a&&e.key==="Escape"){e.preventDefault(),s(this,f,Th).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,Rs,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(a&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...a.querySelectorAll(".chip")],m=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];m&&(e.preventDefault(),m.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),s(this,f,qf).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,f,Of).call(this,i,t);l?(e.preventDefault(),s(this,f,Pf).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,yl,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,xl,e=>{if(r(this,Q)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(m=>m.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),a=i&&s(this,f,Cs).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,f,Qp).call(this,a,t.dataset.day??a.days[0]);if(!l)return;r(this,xe).active&&r(this,xe).cancel();let d=0;if(l.mode==="time"){let m=s(this,f,au).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}g(this,Q,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,Q).timer=setTimeout(()=>{r(this,Q)&&!r(this,Q).started&&s(this,f,su).call(this)},300)),window.addEventListener("pointermove",r(this,kl),!0),window.addEventListener("pointerup",r(this,El),!0),window.addEventListener("pointercancel",r(this,Ml),!0),window.addEventListener("touchmove",r(this,wl),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,$l),!0)});p(this,wl,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});p(this,$l,e=>{r(this,Q)&&e.preventDefault()});p(this,kl,e=>{let t=r(this,Q);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,f,su).call(this):s(this,f,Li).call(this,!1));return}e.preventDefault(),s(this,f,Mh).call(this)}});p(this,El,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,f,Li).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,f,Li).call(this,!0)});p(this,Ml,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,f,Li).call(this,!1)});g(this,xe,new xr({groupCount:()=>s(this,f,pt).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,f,ml).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,f,Bf).call(this,e,t),onTarget:e=>s(this,f,Ff).call(this,e),onDrop:(e,t)=>s(this,f,jf).call(this,e,t),onCancel:()=>s(this,f,eu).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,f,Mr).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,f,Mr).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,f,Mr).call(this,r(this,Z),e)})},announce:e=>r(this,Le).announce(e)}))}get locale(){return r(this,As)}set locale(e){let t=r(this,As);g(this,As,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=s(this,f,pt).call(this);return{view:r(this,f,Ee),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,Z)?.ev.el??null}get announcement(){return r(this,Le).text}announce(e){r(this,Le).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,vl)),this.addEventListener("focusin",r(this,bl)),this.addEventListener("focusout",r(this,fl)),this.addEventListener("pointerdown",r(this,xl)),this.addEventListener("dragstart",r(this,yl)),r(this,gl).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,Ns,new ResizeObserver(()=>{cancelAnimationFrame(r(this,Is)),g(this,Is,requestAnimationFrame(()=>s(this,f,Jp).call(this)))})),r(this,Ns).observe(this)),s(this,f,Jp).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,vl)),this.removeEventListener("focusin",r(this,bl)),this.removeEventListener("focusout",r(this,fl)),this.removeEventListener("pointerdown",r(this,xl)),this.removeEventListener("dragstart",r(this,yl)),r(this,gl).disconnect(),r(this,Ns)?.disconnect(),cancelAnimationFrame(r(this,Is)),r(this,xe).cancel(!0),s(this,f,Li).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,Di,!0),e.get("view")!==void 0&&(this._more="",r(this,xe).cancel(!0))),(e.has("date")||e.has("_narrow"))&&(this._more=this._more&&this.range.start<=this._more&&this._more<=this.range.end?this._more:"")}firstUpdated(){this.renderRoot.appendChild(r(this,Le).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,Di,!0),s(this,f,If).call(this),r(this,We)){let l=s(this,f,Hf).call(this,r(this,We).key);l?(g(this,We,null),l.focus({preventScroll:!1})):Date.now()>r(this,We).until&&g(this,We,null)}r(this,Hs)&&(g(this,Hs,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Di)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,Di,!1)}t||g(this,Di,!0),r(this,Z)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,a=`${i.view}|${i.start}|${i.end}`;a!==r(this,ul)&&(g(this,ul,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,f,dl).call(this,r(this,f,mt),-1))}next(){this.date=P(s(this,f,dl).call(this,r(this,f,mt),1))}goToToday(){this.date=r(this,f,ol)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let a=s(this,f,Cs).call(this,i);if(!a)return!1;let l=s(this,f,pt).call(this).map(P),d=t&&a.days.includes(t)&&l.includes(t)?t:a.days.find(v=>l.includes(v));if(!d)return!1;let m=s(this,f,Qp).call(this,a,d);if(!m)return!1;s(this,f,Li).call(this,!1),r(this,xe).cancel(!0),this._more="",g(this,Z,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return g(this,Et,u),g(this,We,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,xe).pickUp(m.from),!0}cancelMove(){let e=r(this,Q);e?.started&&(s(this,f,Li).call(this,!1),r(this,Le).announce(this.t("cancelled",{event:e.ev.name,place:s(this,f,Mr).call(this,e,e.from)}))),r(this,xe).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,l=a&&s(this,f,Cs).call(this,a);if(!l)return!1;let d=l.allDay?N(Qe(t).date||t):vt(t);if(!d)return!1;let m=i?l.allDay?N(Qe(i).date||i):vt(i):null;return(!m||m<d)&&(m=l.allDay?G(d,$h(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,f,ru).call(this,l,d,m,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Tr).get(t);if(this.controlled||!i)return!1;r(this,Tr).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,f,Cs).call(this,t);return l&&a&&g(this,We,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Le).announce(this.t("reverted",{event:t.name,place:l?s(this,f,Eh).call(this,l):i.start})),!0}render(){let e=s(this,f,pt).call(this),t=s(this,f,Sf).call(this,s(this,f,Cf).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2677
|
-
${s(this,
|
|
2678
|
-
${r(this,
|
|
2679
|
+
`];$("cm-board",zs);var Uk=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}."}),As=class extends S{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};As.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}},As.styles=x`:host { display: none !important; }`;$("cm-calendar-event",As);var Ah=o=>String(o).padStart(2,"0"),Cb=o=>`${P(o)}T${Ah(o.getHours())}:${Ah(o.getMinutes())}`,zh=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Sb=["month","week","day"],Ay=600,Lb=new Map,Db=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Lb.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Lb.set(e,t)),t},Qp=o=>o.replace(/[ ]/g," ").trim(),Hs,Se,Le,xe,Z,Q,zr,Mt,We,bl,Ai,Ns,Is,Ps,Os,vl,b,Ee,Li,cl,_h,Et,eu,dl,mt,tu,Ab,pt,Ls,Rb,Hb,Ke,hl,ml,Ch,Nb,Ib,Pb,Tr,iu,pl,Ob,ul,qb,Bb,Fb,jb,yl,xl,Ub,Vb,wl,gl,Kb,ru,au,su,Wb,Gb,nu,ou,lu,$l,cu,Yb,kl,El,Ml,Tl,zl,_l,du,Sh,Xb,Di,fl,Jb,hu,Zb,Lh,mu,Ds,Dh,Qb,ev,tv,iv,rv,Rs=class extends T{constructor(){super();p(this,b);this.view="month";this.date="";this.today="";this.step=15;p(this,Hs,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;p(this,Se,A("cm-cal"));p(this,Le,new $r);p(this,xe);p(this,Z,null);p(this,Q,null);p(this,zr,new WeakMap);p(this,Mt,"");p(this,We,null);p(this,bl,"");p(this,Ai,!0);p(this,Ns,0);p(this,Is,!1);p(this,Ps);p(this,Os,0);p(this,vl,new MutationObserver(()=>this.requestUpdate()));p(this,yl,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Mt,t.dataset.k);for(let i of s(this,b,ul).call(this))i.tabIndex=i===t?0:-1}});p(this,xl,e=>{let t=e.relatedTarget;if(this._more&&!r(this,Z)){let i=this.renderRoot.querySelector(".pop"),a=e.composedPath()[0];i&&i.contains(a)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,xe).active||!r(this,Z)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,xe).active||!r(this,Z))return;this.renderRoot.activeElement?.dataset.ev!==r(this,Z).ev.key&&r(this,xe).cancel()}))});p(this,wl,e=>{if(r(this,Q)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,xe).active){r(this,xe).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let a=i.closest(".pop");if(a&&e.key==="Escape"){e.preventDefault(),s(this,b,Lh).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,Ns,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(a&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...a.querySelectorAll(".chip")],m=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];m&&(e.preventDefault(),m.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),s(this,b,Vb).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,b,Ub).call(this,i,t);l?(e.preventDefault(),s(this,b,jb).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,$l,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,kl,e=>{if(r(this,Q)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(m=>m.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),a=i&&s(this,b,Ls).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,b,au).call(this,a,t.dataset.day??a.days[0]);if(!l)return;r(this,xe).active&&r(this,xe).cancel();let d=0;if(l.mode==="time"){let m=s(this,b,cu).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}g(this,Q,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,Q).timer=setTimeout(()=>{r(this,Q)&&!r(this,Q).started&&s(this,b,du).call(this)},300)),window.addEventListener("pointermove",r(this,Tl),!0),window.addEventListener("pointerup",r(this,zl),!0),window.addEventListener("pointercancel",r(this,_l),!0),window.addEventListener("touchmove",r(this,El),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,Ml),!0)});p(this,El,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});p(this,Ml,e=>{r(this,Q)&&e.preventDefault()});p(this,Tl,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,b,du).call(this):s(this,b,Di).call(this,!1));return}e.preventDefault(),s(this,b,Sh).call(this)}});p(this,zl,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,b,Di).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,b,Di).call(this,!0)});p(this,_l,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,b,Di).call(this,!1)});g(this,xe,new wr({groupCount:()=>s(this,b,pt).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,b,gl).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,b,Kb).call(this,e,t),onTarget:e=>s(this,b,Wb).call(this,e),onDrop:(e,t)=>s(this,b,Gb).call(this,e,t),onCancel:()=>s(this,b,su).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,b,Tr).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,b,Tr).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,b,Tr).call(this,r(this,Z),e)})},announce:e=>r(this,Le).announce(e)}))}get locale(){return r(this,Hs)}set locale(e){let t=r(this,Hs);g(this,Hs,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,b,pt).call(this);return{view:r(this,b,Ee),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,Z)?.ev.el??null}get announcement(){return r(this,Le).text}announce(e){r(this,Le).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,wl)),this.addEventListener("focusin",r(this,yl)),this.addEventListener("focusout",r(this,xl)),this.addEventListener("pointerdown",r(this,kl)),this.addEventListener("dragstart",r(this,$l)),r(this,vl).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,Ps,new ResizeObserver(()=>{cancelAnimationFrame(r(this,Os)),g(this,Os,requestAnimationFrame(()=>s(this,b,iu).call(this)))})),r(this,Ps).observe(this)),s(this,b,iu).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,wl)),this.removeEventListener("focusin",r(this,yl)),this.removeEventListener("focusout",r(this,xl)),this.removeEventListener("pointerdown",r(this,kl)),this.removeEventListener("dragstart",r(this,$l)),r(this,vl).disconnect(),r(this,Ps)?.disconnect(),cancelAnimationFrame(r(this,Os)),r(this,xe).cancel(!0),s(this,b,Di).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,Ai,!0),e.get("view")!==void 0&&(this._more="",r(this,xe).cancel(!0))),(e.has("date")||e.has("_narrow"))&&(this._more=this._more&&this.range.start<=this._more&&this._more<=this.range.end?this._more:"")}firstUpdated(){this.renderRoot.appendChild(r(this,Le).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,Ai,!0),s(this,b,Fb).call(this),r(this,We)){let l=s(this,b,qb).call(this,r(this,We).key);l?(g(this,We,null),l.focus({preventScroll:!1})):Date.now()>r(this,We).until&&g(this,We,null)}r(this,Is)&&(g(this,Is,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Ai)){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,Ai,!1)}t||g(this,Ai,!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,bl)&&(g(this,bl,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,b,pl).call(this,r(this,b,mt),-1))}next(){this.date=P(s(this,b,pl).call(this,r(this,b,mt),1))}goToToday(){this.date=r(this,b,dl)}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,b,Ls).call(this,i);if(!a)return!1;let l=s(this,b,pt).call(this).map(P),d=t&&a.days.includes(t)&&l.includes(t)?t:a.days.find(v=>l.includes(v));if(!d)return!1;let m=s(this,b,au).call(this,a,d);if(!m)return!1;s(this,b,Di).call(this,!1),r(this,xe).cancel(!0),this._more="",g(this,Z,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return g(this,Mt,u),g(this,We,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,xe).pickUp(m.from),!0}cancelMove(){let e=r(this,Q);e?.started&&(s(this,b,Di).call(this,!1),r(this,Le).announce(this.t("cancelled",{event:e.ev.name,place:s(this,b,Tr).call(this,e,e.from)}))),r(this,xe).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,l=a&&s(this,b,Ls).call(this,a);if(!l)return!1;let d=l.allDay?N(Qe(t).date||t):yt(t);if(!d)return!1;let m=i?l.allDay?N(Qe(i).date||i):yt(i):null;return(!m||m<d)&&(m=l.allDay?G(d,zh(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,b,lu).call(this,l,d,m,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,zr).get(t);if(this.controlled||!i)return!1;r(this,zr).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,b,Ls).call(this,t);return l&&a&&g(this,We,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Le).announce(this.t("reverted",{event:t.name,place:l?s(this,b,Ch).call(this,l):i.start})),!0}render(){let e=s(this,b,pt).call(this),t=s(this,b,Hb).call(this,s(this,b,Rb).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2680
|
+
${s(this,b,Qb).call(this,e)}
|
|
2681
|
+
${r(this,b,Ee)==="month"?s(this,b,tv).call(this,e,t):s(this,b,rv).call(this,e,t)}
|
|
2679
2682
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
2680
2683
|
<span id="${r(this,Se)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
2681
2684
|
<span id="${r(this,Se)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
2682
2685
|
<span id="${r(this,Se)}-op" hidden>${this.t("openHint")}</span>
|
|
2683
|
-
</div>`}};As=new WeakMap,Se=new WeakMap,Le=new WeakMap,xe=new WeakMap,Z=new WeakMap,Q=new WeakMap,Tr=new WeakMap,Et=new WeakMap,We=new WeakMap,ul=new WeakMap,Di=new WeakMap,Rs=new WeakMap,Hs=new WeakMap,Ns=new WeakMap,Is=new WeakMap,gl=new WeakMap,f=new WeakSet,Ee=function(){return Mf.includes(this.view)?this.view:"month"},Si=function(){return ba(this,this.locale)},nl=function(){return va(r(this,f,Si))},kh=function(){return bd(r(this,f,Si),this.hourCycle)},kt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Yp=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,f,Si)):(Math.trunc(e)%7+7)%7},ol=function(){return N(this.today)?this.today:Lm()},mt=function(){return N(this.date)??N(r(this,f,ol))},Xp=function(){return r(this,f,Ee)==="month"&&this._narrow},_f=function(){return r(this,f,Ee)!=="month"},pt=function(){let e=r(this,f,mt),t=r(this,f,Yp);if(r(this,f,Ee)==="day")return[e];if(r(this,f,Ee)==="week"){if(this._narrow)return[e,G(e,1),G(e,2)];let d=G(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>G(d,u))}let i=Ht(e),a=G(i,-((i.getDay()-t+7)%7)),l=Math.ceil(($h(a,ua(e))+1)/7)*7;return Array.from({length:l},(d,m)=>G(a,m))},Cs=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(Qe(e.start).date||e.start);if(!u)return null;let v=N(Qe(e.end).date||e.end)??u;v<u&&(v=u);let b=Math.min($h(u,v),366);return{el:e,key:e.key,name:t,allDay:a,start:u,end:v,min:0,dur:1440,days:Array.from({length:b+1},(w,y)=>P(G(u,y)))}}let l=vt(e.start);if(!l)return null;let d=vt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let m=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:a,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:m,days:[P(l)]}},Cf=function(){return this.events.map(e=>s(this,f,Cs).call(this,e)).filter(e=>!!e)},Sf=function(e){let t=new Map;for(let i of e)for(let a of i.days)(t.get(a)??t.set(a,[]).get(a)).push(i);for(let i of t.values())i.sort((a,l)=>(a.allDay===l.allDay?0:a.allDay?-1:1)||a.start.getTime()-l.start.getTime()||a.name.localeCompare(l.name));return t},Ke=function(e){return ae(e,{weekday:"long",day:"numeric",month:"long"},r(this,f,Si))},ll=function(e){return r(this,f,kh).format((e%1440+1440)%1440)},cl=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=zf(r(this,f,Si),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(b=>b.source==="endRange"),v=-1;if(m.forEach((b,w)=>{b.source==="startRange"&&(v=w)}),v>=0&&u>v){let b=w=>Gp(w.map(y=>y.value).join(""));return this.t("timeRange",{start:b(m.slice(0,v+1)),end:b(m.slice(u))})}}}catch{}let l=P(e)===P(t),d=m=>l?s(this,f,ll).call(this,m.getHours()*60+m.getMinutes()):r(this,f,kh).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},Eh=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,f,Ke).call(this,e.start)}):this.t("allDayRange",{start:s(this,f,Ke).call(this,e.start),end:s(this,f,Ke).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&$h(e.start,e.end)===1)?s(this,f,cl).call(this,e.start,e.end):this.t("timed",{date:s(this,f,Ke).call(this,e.start),time:s(this,f,cl).call(this,e.start,e.end)})},Lf=function(e){let t={title:e.name,when:s(this,f,Eh).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Df=function(e){let t=r(this,f,Si);if(r(this,f,Ee)==="month")return r(this,f,nl).monthYear(r(this,f,mt));if(e.length===1)return ae(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=zf(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Gp(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Af=function(e){return r(this,f,kh).hour12?Gp(ae(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,f,Si))):s(this,f,ll).call(this,e*60)},Mr=function(e,t){let{start:i,end:a}=s(this,f,Zp).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,f,Ke).call(this,i),time:s(this,f,cl).call(this,i,a)}):s(this,f,Ke).call(this,G(N(e.origin),t.group-e.from.group))},Jp=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<_y;t!==this._narrow&&(this._narrow=t)},dl=function(e,t){return r(this,f,Ee)==="month"?Ze(e,t):r(this,f,Ee)==="week"?G(e,t*(this._narrow?3:7)):G(e,t)},Rf=function(e){this.view!==e&&(this.view=e)},hl=function(){return[...this.renderRoot.querySelectorAll(".item")]},Hf=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(a=>a.dataset.k===e&&a.classList.contains("item"))??t.find(a=>a.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let a=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${a}`)??null}return null},Nf=function(){let e=P(r(this,f,mt));if(r(this,f,Xp))return`day:${e}`;if(r(this,f,Ee)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},If=function(){let e=s(this,f,hl).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Et))??e.find(i=>i.dataset.k===s(this,f,Nf).call(this))??e.find(i=>i.dataset.day===P(r(this,f,mt)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},Pf=function(e){g(this,Et,e.dataset.k??"");for(let t of s(this,f,hl).call(this))t.tabIndex=t===e?0:-1;e.focus()},bl=new WeakMap,fl=new WeakMap,Of=function(e,t){let i=new Map;for(let y of s(this,f,hl).call(this)){let M=Number(y.dataset.i);(i.get(M)??i.set(M,[]).get(M)).push(y)}let a=Number(e.dataset.i),l=i.get(a)??[e],d=Math.max(0,l.indexOf(e)),m=s(this,f,pt).call(this).length,u=r(this,f,Ee)==="month",v=e.dataset.row,b=(y,M)=>{let D=y>=0&&y<m?i.get(y):void 0;return(D?.length?M(D):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(M=>M.dataset.row===v)??y[0];switch(t){case"ArrowRight":return b(a+1,w);case"ArrowLeft":return b(a-1,w);case"ArrowDown":return l[d+1]??(u?b(a+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?b(a-7,y=>y[y.length-1]):null;case"Home":return u?b(a-a%7,y=>y[0]):b(0,w);case"End":return u?b(Math.min(m-1,a-a%7+6),y=>y[0]):b(m-1,w);default:return null}},qf=function(e,t){let i=e.dataset.day??P(r(this,f,mt)),a=s(this,f,dl).call(this,N(i)??r(this,f,mt),t),l=P(a),d=(e.dataset.k??"").split(":")[0],m;r(this,f,Xp)?m=`day:${l}`:r(this,f,Ee)==="month"?m=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?m=`adadd:${l}`:m=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,f,dl).call(this,r(this,f,mt),t)),g(this,Et,m),g(this,We,{key:m,until:Date.now()+1e3})},vl=new WeakMap,ml=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,f,kt))+1},Bf=function(e,t){let i=r(this,Z);if(!i)return null;let a=s(this,f,pt).call(this).length,l=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,f,Ee)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return v?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return v?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:v?t.group-t.group%7:0,index:0};case"End":return{group:v?l(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,f,ml).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,f,kt))),u=v=>Math.max(0,Math.min(d,v));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+m)};case"PageUp":return{group:t.group,index:u(t.index-m)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Zp=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,f,pt).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,f,kt));return{start:m,end:new Date(m.getTime()+i.dur*6e4)}}let a=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+a,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},Qp=function(e,t){let a=s(this,f,pt).call(this).map(P).indexOf(t);if(a<0)return null;let l=r(this,f,_f)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,f,kt)),s(this,f,ml).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},eu=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),g(this,Z,null),this._target=null},Ff=function(e){let t=r(this,Z);if(!t||!e){this._target=null;return}let i=P(s(this,f,pt).call(this)[e.group]??N(t.origin)),a=e.group===t.from.group&&e.index===t.from.index;this._target=a?null:{iso:i,min:t.mode==="time"?e.index*r(this,f,kt):void 0}},jf=function(e,t){let i=r(this,Z);s(this,f,eu).call(this),i&&(g(this,Rs,performance.now()+400),s(this,f,tu).call(this,i,e,t,"keyboard"))},tu=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,f,Zp).call(this,e,i),u=P(G(N(e.origin),i.group-t.group));s(this,f,ru).call(this,e.ev,d,m,a,l,e.mode==="time"?P(d):u)},iu=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:Ef(t),end:Ef(i)}},ru=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,f,iu).call(this,e.allDay,e.start,e.end),b=s(this,f,iu).call(this,e.allDay,t,i),w=F=>{a==="keyboard"&&g(this,We,{key:F,until:Date.now()+1e3})};if(l||v.start===b.start&&v.end===b.end)return a!=="api"&&r(this,Le).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},M=e.allDay?s(this,f,Ke).call(this,t):this.t("timed",{date:s(this,f,Ke).call(this,t),time:s(this,f,cl).call(this,t,i)}),D=[],H={value:e.key,event:m,from:v,to:b,allDay:e.allDay,source:a,waitUntil:F=>{D.push(Promise.resolve(F))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:H,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Tr).set(m,v),m.start=b.start,m.end=b.end),w(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Le).announce(this.t("moved",{event:u,place:y.allDay?s(this,f,Ke).call(this,t):M})),D.length&&(m.pending=!0,Promise.all(D).then(()=>{m.pending=!1,this.controlled||r(this,Tr).delete(m)},()=>{m.pending=!1,this.controlled?r(this,Le).announce(this.t("reverted",{event:u,place:s(this,f,Eh).call(this,e)})):this.revert(m)})),!0):(r(this,Le).announce(this.t("refused",{event:u,place:M})),this.requestUpdate(),!1)},yl=new WeakMap,au=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let a=0,l=1/0;i.forEach((m,u)=>{let v=m.getBoundingClientRect(),b=e<v.left?v.left-e:e>v.right?e-v.right:0;b<l&&(l=b,a=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},Uf=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let a=null,l=1/0;for(let d of i){let m=d.getBoundingClientRect(),u=e<m.left?m.left-e:e>m.right?e-m.right:0,v=t<m.top?m.top-t:t>m.bottom?t-m.bottom:0,b=Math.hypot(u,v);b<l&&(l=b,a=d)}return a?Number(a.dataset.i):null},xl=new WeakMap,wl=new WeakMap,$l=new WeakMap,kl=new WeakMap,El=new WeakMap,Ml=new WeakMap,su=function(){let e=r(this,Q);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Le).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,f,Mr).call(this,e,e.from)})),s(this,f,Mh).call(this);let t=()=>{r(this,Q)?.started&&(s(this,f,Vf).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Mh=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,f,au).call(this,e.x,e.y);if(l){let d=s(this,f,ml).call(this,e.ev.dur)-1;t={group:l.group,index:Math.max(0,Math.min(d,Math.round((l.min-e.grab)/r(this,f,kt))))}}}else{let l=s(this,f,Uf).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let a=t.group===e.from.group&&t.index===e.from.index;this._target=a?null:{iso:P(s(this,f,pt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,f,kt):void 0},i&&r(this,Le).announce(this.t("over",{place:s(this,f,Mr).call(this,e,t)}))},Vf=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let m=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-m),v=l(d.bottom-e.y),b=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==b&&s(this,f,Mh).call(this)},Li=function(e){let t=r(this,Q);t&&(g(this,Q,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,kl),!0),window.removeEventListener("pointerup",r(this,El),!0),window.removeEventListener("pointercancel",r(this,Ml),!0),window.removeEventListener("touchmove",r(this,wl),!0),window.removeEventListener("contextmenu",r(this,$l),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,f,tu).call(this,t,t.from,t.to,"pointer")))},pl=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,f,Ee)},bubbles:!0,composed:!0}))},Kf=function(e,t,i){let a=i*60;if(e.detail>0){let m=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-m.top)/m.height*60/r(this,f,kt))*r(this,f,kt);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,f,pl).call(this,`${t}T${_h(l)}:${_h(d)}`,!1)},nu=function(e,t){if(performance.now()<r(this,Rs)||r(this,xe).active){e.preventDefault();return}this.dispatchEvent(new CustomEvent("cm-open",{detail:{value:t.key,event:t.el},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault()},Wf=function(e){this._more=e,g(this,Hs,!0)},Th=function(e){let t=this._more;this._more="",e&&t&&(g(this,Et,`more:${t}`),g(this,We,{key:`more:${t}`,until:Date.now()+1e3}))},ou=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},Ss=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,f,Lf).call(this,e),b=!this.readonly&&!m.locked&&!u,w=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",y=`chip ${a} tone-${w}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,M=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,D=e.allDay?h:c`<span class="tm">${s(this,f,ll).call(this,e.min)}</span>`,H=m.kind&&(a!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,q=u?c`<span class="spin" aria-hidden="true"></span>`:h,F=a==="time"?c`<span class="lead">${M}${D}${q}</span><span class="h">${e.name}</span>${H}`:c`${M}${D}<span class="h">${e.name}</span>${H}${q}`,W=u?`${v}, ${this.t("saving")}`:v,Tt=b?`${r(this,Se)}-mv`:`${r(this,Se)}-op`,K=`ev:${e.key}:${t}`,Oe=b?this.t("roleDescription"):h;return m.href?c`<a class=${y} href=${m.href} style=${d.style??h} data-k=${K} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2684
|
-
data-row=${d.row??h} aria-label=${W} aria-describedby=${
|
|
2685
|
-
@click=${nt=>s(this,
|
|
2686
|
-
data-row=${d.row??h} aria-label=${W} aria-describedby=${
|
|
2687
|
-
@click=${nt=>s(this,
|
|
2686
|
+
</div>`}};Hs=new WeakMap,Se=new WeakMap,Le=new WeakMap,xe=new WeakMap,Z=new WeakMap,Q=new WeakMap,zr=new WeakMap,Mt=new WeakMap,We=new WeakMap,bl=new WeakMap,Ai=new WeakMap,Ns=new WeakMap,Is=new WeakMap,Ps=new WeakMap,Os=new WeakMap,vl=new WeakMap,b=new WeakSet,Ee=function(){return Sb.includes(this.view)?this.view:"month"},Li=function(){return va(this,this.locale)},cl=function(){return xa(r(this,b,Li))},_h=function(){return wd(r(this,b,Li),this.hourCycle)},Et=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},eu=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?ya(r(this,b,Li)):(Math.trunc(e)%7+7)%7},dl=function(){return N(this.today)?this.today:Nm()},mt=function(){return N(this.date)??N(r(this,b,dl))},tu=function(){return r(this,b,Ee)==="month"&&this._narrow},Ab=function(){return r(this,b,Ee)!=="month"},pt=function(){let e=r(this,b,mt),t=r(this,b,eu);if(r(this,b,Ee)==="day")return[e];if(r(this,b,Ee)==="week"){if(this._narrow)return[e,G(e,1),G(e,2)];let d=G(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>G(d,u))}let i=Nt(e),a=G(i,-((i.getDay()-t+7)%7)),l=Math.ceil((zh(a,fa(e))+1)/7)*7;return Array.from({length:l},(d,m)=>G(a,m))},Ls=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(Qe(e.start).date||e.start);if(!u)return null;let v=N(Qe(e.end).date||e.end)??u;v<u&&(v=u);let f=Math.min(zh(u,v),366);return{el:e,key:e.key,name:t,allDay:a,start:u,end:v,min:0,dur:1440,days:Array.from({length:f+1},(w,y)=>P(G(u,y)))}}let l=yt(e.start);if(!l)return null;let d=yt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let m=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:a,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:m,days:[P(l)]}},Rb=function(){return this.events.map(e=>s(this,b,Ls).call(this,e)).filter(e=>!!e)},Hb=function(e){let t=new Map;for(let i of e)for(let a of i.days)(t.get(a)??t.set(a,[]).get(a)).push(i);for(let i of t.values())i.sort((a,l)=>(a.allDay===l.allDay?0:a.allDay?-1:1)||a.start.getTime()-l.start.getTime()||a.name.localeCompare(l.name));return t},Ke=function(e){return ae(e,{weekday:"long",day:"numeric",month:"long"},r(this,b,Li))},hl=function(e){return r(this,b,_h).format((e%1440+1440)%1440)},ml=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=Db(r(this,b,Li),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(f=>f.source==="endRange"),v=-1;if(m.forEach((f,w)=>{f.source==="startRange"&&(v=w)}),v>=0&&u>v){let f=w=>Qp(w.map(y=>y.value).join(""));return this.t("timeRange",{start:f(m.slice(0,v+1)),end:f(m.slice(u))})}}}catch{}let l=P(e)===P(t),d=m=>l?s(this,b,hl).call(this,m.getHours()*60+m.getMinutes()):r(this,b,_h).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},Ch=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,b,Ke).call(this,e.start)}):this.t("allDayRange",{start:s(this,b,Ke).call(this,e.start),end:s(this,b,Ke).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&zh(e.start,e.end)===1)?s(this,b,ml).call(this,e.start,e.end):this.t("timed",{date:s(this,b,Ke).call(this,e.start),time:s(this,b,ml).call(this,e.start,e.end)})},Nb=function(e){let t={title:e.name,when:s(this,b,Ch).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Ib=function(e){let t=r(this,b,Li);if(r(this,b,Ee)==="month")return r(this,b,cl).monthYear(r(this,b,mt));if(e.length===1)return ae(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Db(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Qp(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Pb=function(e){return r(this,b,_h).hour12?Qp(ae(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,b,Li))):s(this,b,hl).call(this,e*60)},Tr=function(e,t){let{start:i,end:a}=s(this,b,ru).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,b,Ke).call(this,i),time:s(this,b,ml).call(this,i,a)}):s(this,b,Ke).call(this,G(N(e.origin),t.group-e.from.group))},iu=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<Ay;t!==this._narrow&&(this._narrow=t)},pl=function(e,t){return r(this,b,Ee)==="month"?Ze(e,t):r(this,b,Ee)==="week"?G(e,t*(this._narrow?3:7)):G(e,t)},Ob=function(e){this.view!==e&&(this.view=e)},ul=function(){return[...this.renderRoot.querySelectorAll(".item")]},qb=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},Bb=function(){let e=P(r(this,b,mt));if(r(this,b,tu))return`day:${e}`;if(r(this,b,Ee)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},Fb=function(){let e=s(this,b,ul).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Mt))??e.find(i=>i.dataset.k===s(this,b,Bb).call(this))??e.find(i=>i.dataset.day===P(r(this,b,mt)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},jb=function(e){g(this,Mt,e.dataset.k??"");for(let t of s(this,b,ul).call(this))t.tabIndex=t===e?0:-1;e.focus()},yl=new WeakMap,xl=new WeakMap,Ub=function(e,t){let i=new Map;for(let y of s(this,b,ul).call(this)){let k=Number(y.dataset.i);(i.get(k)??i.set(k,[]).get(k)).push(y)}let a=Number(e.dataset.i),l=i.get(a)??[e],d=Math.max(0,l.indexOf(e)),m=s(this,b,pt).call(this).length,u=r(this,b,Ee)==="month",v=e.dataset.row,f=(y,k)=>{let D=y>=0&&y<m?i.get(y):void 0;return(D?.length?k(D):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(k=>k.dataset.row===v)??y[0];switch(t){case"ArrowRight":return f(a+1,w);case"ArrowLeft":return f(a-1,w);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,w);case"End":return u?f(Math.min(m-1,a-a%7+6),y=>y[0]):f(m-1,w);default:return null}},Vb=function(e,t){let i=e.dataset.day??P(r(this,b,mt)),a=s(this,b,pl).call(this,N(i)??r(this,b,mt),t),l=P(a),d=(e.dataset.k??"").split(":")[0],m;r(this,b,tu)?m=`day:${l}`:r(this,b,Ee)==="month"?m=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?m=`adadd:${l}`:m=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,b,pl).call(this,r(this,b,mt),t)),g(this,Mt,m),g(this,We,{key:m,until:Date.now()+1e3})},wl=new WeakMap,gl=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,b,Et))+1},Kb=function(e,t){let i=r(this,Z);if(!i)return null;let a=s(this,b,pt).call(this).length,l=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,b,Ee)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return v?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return v?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:v?t.group-t.group%7:0,index:0};case"End":return{group:v?l(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,b,gl).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,b,Et))),u=v=>Math.max(0,Math.min(d,v));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+m)};case"PageUp":return{group:t.group,index:u(t.index-m)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},ru=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,b,pt).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,b,Et));return{start:m,end:new Date(m.getTime()+i.dur*6e4)}}let a=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+a,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},au=function(e,t){let a=s(this,b,pt).call(this).map(P).indexOf(t);if(a<0)return null;let l=r(this,b,Ab)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,b,Et)),s(this,b,gl).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},su=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),g(this,Z,null),this._target=null},Wb=function(e){let t=r(this,Z);if(!t||!e){this._target=null;return}let i=P(s(this,b,pt).call(this)[e.group]??N(t.origin)),a=e.group===t.from.group&&e.index===t.from.index;this._target=a?null:{iso:i,min:t.mode==="time"?e.index*r(this,b,Et):void 0}},Gb=function(e,t){let i=r(this,Z);s(this,b,su).call(this),i&&(g(this,Ns,performance.now()+400),s(this,b,nu).call(this,i,e,t,"keyboard"))},nu=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,b,ru).call(this,e,i),u=P(G(N(e.origin),i.group-t.group));s(this,b,lu).call(this,e.ev,d,m,a,l,e.mode==="time"?P(d):u)},ou=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:Cb(t),end:Cb(i)}},lu=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,b,ou).call(this,e.allDay,e.start,e.end),f=s(this,b,ou).call(this,e.allDay,t,i),w=j=>{a==="keyboard"&&g(this,We,{key:j,until:Date.now()+1e3})};if(l||v.start===f.start&&v.end===f.end)return a!=="api"&&r(this,Le).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},k=e.allDay?s(this,b,Ke).call(this,t):this.t("timed",{date:s(this,b,Ke).call(this,t),time:s(this,b,ml).call(this,t,i)}),D=[],H={value:e.key,event:m,from:v,to:f,allDay:e.allDay,source:a,waitUntil:j=>{D.push(Promise.resolve(j))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:H,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,zr).set(m,v),m.start=f.start,m.end=f.end),w(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Le).announce(this.t("moved",{event:u,place:y.allDay?s(this,b,Ke).call(this,t):k})),D.length&&(m.pending=!0,Promise.all(D).then(()=>{m.pending=!1,this.controlled||r(this,zr).delete(m)},()=>{m.pending=!1,this.controlled?r(this,Le).announce(this.t("reverted",{event:u,place:s(this,b,Ch).call(this,e)})):this.revert(m)})),!0):(r(this,Le).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},$l=new WeakMap,cu=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let a=0,l=1/0;i.forEach((m,u)=>{let v=m.getBoundingClientRect(),f=e<v.left?v.left-e:e>v.right?e-v.right:0;f<l&&(l=f,a=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},Yb=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let a=null,l=1/0;for(let d of i){let m=d.getBoundingClientRect(),u=e<m.left?m.left-e:e>m.right?e-m.right:0,v=t<m.top?m.top-t:t>m.bottom?t-m.bottom:0,f=Math.hypot(u,v);f<l&&(l=f,a=d)}return a?Number(a.dataset.i):null},kl=new WeakMap,El=new WeakMap,Ml=new WeakMap,Tl=new WeakMap,zl=new WeakMap,_l=new WeakMap,du=function(){let e=r(this,Q);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Le).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,b,Tr).call(this,e,e.from)})),s(this,b,Sh).call(this);let t=()=>{r(this,Q)?.started&&(s(this,b,Xb).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Sh=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,b,cu).call(this,e.x,e.y);if(l){let d=s(this,b,gl).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,b,Et))))}}}else{let l=s(this,b,Yb).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,b,pt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,b,Et):void 0},i&&r(this,Le).announce(this.t("over",{place:s(this,b,Tr).call(this,e,t)}))},Xb=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let m=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-m),v=l(d.bottom-e.y),f=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==f&&s(this,b,Sh).call(this)},Di=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,Tl),!0),window.removeEventListener("pointerup",r(this,zl),!0),window.removeEventListener("pointercancel",r(this,_l),!0),window.removeEventListener("touchmove",r(this,El),!0),window.removeEventListener("contextmenu",r(this,Ml),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,b,nu).call(this,t,t.from,t.to,"pointer")))},fl=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,b,Ee)},bubbles:!0,composed:!0}))},Jb=function(e,t,i){let a=i*60;if(e.detail>0){let m=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-m.top)/m.height*60/r(this,b,Et))*r(this,b,Et);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,b,fl).call(this,`${t}T${Ah(l)}:${Ah(d)}`,!1)},hu=function(e,t){if(performance.now()<r(this,Ns)||r(this,xe).active){e.preventDefault();return}this.dispatchEvent(new CustomEvent("cm-open",{detail:{value:t.key,event:t.el},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault()},Zb=function(e){this._more=e,g(this,Is,!0)},Lh=function(e){let t=this._more;this._more="",e&&t&&(g(this,Mt,`more:${t}`),g(this,We,{key:`more:${t}`,until:Date.now()+1e3}))},mu=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},Ds=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,b,Nb).call(this,e),f=!this.readonly&&!m.locked&&!u,w=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",y=`chip ${a} tone-${w}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,k=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,D=e.allDay?h:c`<span class="tm">${s(this,b,hl).call(this,e.min)}</span>`,H=m.kind&&(a!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,B=u?c`<span class="spin" aria-hidden="true"></span>`:h,j=a==="time"?c`<span class="lead">${k}${D}${B}</span><span class="h">${e.name}</span>${H}`:c`${k}${D}<span class="h">${e.name}</span>${H}${B}`,W=u?`${v}, ${this.t("saving")}`:v,zt=f?`${r(this,Se)}-mv`:`${r(this,Se)}-op`,K=`ev:${e.key}:${t}`,Oe=f?this.t("roleDescription"):h;return m.href?c`<a class=${y} href=${m.href} style=${d.style??h} data-k=${K} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2687
|
+
data-row=${d.row??h} aria-label=${W} aria-describedby=${zt} aria-roledescription=${Oe}
|
|
2688
|
+
@click=${nt=>s(this,b,hu).call(this,nt,e)}>${j}</a>`:c`<button type="button" class=${y} style=${d.style??h} data-k=${K} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2689
|
+
data-row=${d.row??h} aria-label=${W} aria-describedby=${zt} aria-roledescription=${Oe}
|
|
2690
|
+
@click=${nt=>s(this,b,hu).call(this,nt,e)}>${j}</button>`},Dh=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.name}</div>`},Qb=function(e){let t=r(this,b,Ee),i=t==="week"&&this._narrow,a=t==="month"?this.t("previousMonth"):i?this.t("previousDays",{count:3}):t==="week"?this.t("previousWeek"):this.t("previousDay"),l=t==="month"?this.t("nextMonth"):i?this.t("nextDays",{count:3}):t==="week"?this.t("nextWeek"):this.t("nextDay"),d=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2));return c`<div class="head" part="header">
|
|
2688
2691
|
<div class="nav">
|
|
2689
2692
|
<button type="button" class="hb icon prev" aria-label=${a} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
2690
2693
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
2691
2694
|
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
2692
2695
|
</div>
|
|
2693
|
-
<div class="title" part="title" id="${r(this,Se)}-t" role="heading" aria-level=${d} aria-live="polite">${s(this,
|
|
2696
|
+
<div class="title" part="title" id="${r(this,Se)}-t" role="heading" aria-level=${d} aria-live="polite">${s(this,b,Ib).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
2694
2697
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
2695
|
-
${
|
|
2698
|
+
${Sb.map(m=>c`<button type="button" class="hb" data-view=${m} aria-pressed=${m===t?"true":"false"} @click=${()=>s(this,b,Ob).call(this,m)}>${this.t(m)}</button>`)}
|
|
2696
2699
|
</div>
|
|
2697
|
-
</div>`},
|
|
2700
|
+
</div>`},ev=function(e){let t=r(this,b,cl),i=Array.from({length:7},(a,l)=>(l+r(this,b,eu))%7);return c`<thead><tr>${i.map(a=>c`<th scope="col" abbr=${t.weekdaysLong[a]}><span aria-hidden="true">${e?t.weekdaysShort[a].slice(0,2):t.weekdaysShort[a]}</span><span class="vh">${t.weekdaysLong[a]}</span></th>`)}</tr></thead>`},tv=function(e,t){let i=r(this,b,mt),a=r(this,b,dl),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=s(this,b,mu).call(this),m=this._target,u=Array.from({length:e.length/7},(j,W)=>e.slice(W*7,W*7+7)),v=this._narrow,f=(j,W,zt)=>{let K=P(j),Oe=t.get(K)??[],nt=s(this,b,Ke).call(this,j),Iu=`${j.getMonth()!==i.getMonth()?"other":""} ${K===a?"today":""} ${m?.iso===K?"over":""}`,Pu=c`<span class="num" aria-hidden="true">${r(this,b,cl).day(j)}</span>`;if(v){let _t=Oe.slice(0,3).map(qr=>["attention","information","success","critical"].includes(qr.el.tone)?qr.el.tone:"neutral");return c`<td class=${Iu} data-drop data-i=${W} aria-selected=${K===P(i)?"true":"false"} aria-current=${K===a?"date":h}>
|
|
2698
2701
|
<button type="button" class="dayb item" data-k="day:${K}" data-i=${W} data-day=${K} aria-label=${this.t("dayEvents",{date:nt,count:Oe.length})}
|
|
2699
|
-
@click=${()=>{this.date=K,g(this,
|
|
2700
|
-
</td>`}let
|
|
2701
|
-
aria-label=${
|
|
2702
|
-
<div class="dh">${
|
|
2703
|
-
${
|
|
2704
|
-
@click=${()=>s(this,
|
|
2702
|
+
@click=${()=>{this.date=K,g(this,Mt,`day:${K}`)}}>${Pu}<span class="dots">${_t.map(qr=>c`<span class="dot tone-${qr}"></span>`)}</span></button>
|
|
2703
|
+
</td>`}let Or=Oe,Ql=0;if(Oe.length>l){Or=Oe.slice(0,l-1);let _t=d&&Oe.find(qr=>qr.key===d.key);_t&&!Or.includes(_t)&&(Or=[...Oe.slice(0,l-2),_t]),Ql=Oe.length-Or.length}let ec=this.readonly;return c`<td class="${Iu}${ec?" item":""}" data-drop data-i=${W} data-day=${K} data-k=${ec?`cell:${K}`:h}
|
|
2704
|
+
aria-label=${ec?this.t("dayEvents",{date:nt,count:Oe.length}):h} aria-current=${K===a?"date":h}>
|
|
2705
|
+
<div class="dh">${Pu}<span class="vh">${nt}</span>
|
|
2706
|
+
${ec?h:c`<button type="button" class="add item" data-k="add:${K}" data-i=${W} data-day=${K} aria-label=${this.t("addOn",{date:nt})}
|
|
2707
|
+
@click=${()=>s(this,b,fl).call(this,K,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2705
2708
|
</div>
|
|
2706
|
-
${
|
|
2707
|
-
${
|
|
2708
|
-
${m?.iso===K&&d?c`<li aria-hidden="true">${s(this,
|
|
2709
|
+
${Or.length||m?.iso===K&&d?c`<ul class="evs">
|
|
2710
|
+
${Or.map(_t=>c`<li>${s(this,b,Ds).call(this,_t,K,W,"month",!0)}</li>`)}
|
|
2711
|
+
${m?.iso===K&&d?c`<li aria-hidden="true">${s(this,b,Dh).call(this,d)}</li>`:h}
|
|
2709
2712
|
</ul>`:h}
|
|
2710
|
-
${
|
|
2711
|
-
aria-expanded=${this._more===K?"true":"false"} aria-label=${this.t("moreLabel",{count:
|
|
2712
|
-
@click=${()=>this._more===K?s(this,
|
|
2713
|
-
${this._more===K?c`<div class="pop ${
|
|
2714
|
-
<div class="pop-h"><span>${nt}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>s(this,
|
|
2715
|
-
<ul>${Oe.map(
|
|
2713
|
+
${Ql?c`<button type="button" class="more item" data-k="more:${K}" data-i=${W} data-day=${K} aria-haspopup="dialog"
|
|
2714
|
+
aria-expanded=${this._more===K?"true":"false"} aria-label=${this.t("moreLabel",{count:Ql,date:nt})}
|
|
2715
|
+
@click=${()=>this._more===K?s(this,b,Lh).call(this,!1):s(this,b,Zb).call(this,K)}>${this.t("more",{count:Ql})}</button>`:h}
|
|
2716
|
+
${this._more===K?c`<div class="pop ${zt>=4?"end":""}" role="dialog" aria-label=${nt}>
|
|
2717
|
+
<div class="pop-h"><span>${nt}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>s(this,b,Lh).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
2718
|
+
<ul>${Oe.map(_t=>c`<li>${s(this,b,Ds).call(this,_t,K,W,"list",!1)}</li>`)}</ul>
|
|
2716
2719
|
</div>`:h}
|
|
2717
2720
|
</td>`},w=c`<table class="month ${v?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,Se)}-t" aria-describedby="${r(this,Se)}-gh"
|
|
2718
2721
|
aria-busy=${this.loading?"true":"false"}>
|
|
2719
|
-
${s(this,
|
|
2720
|
-
<tbody>${u.map((
|
|
2721
|
-
</table>`;if(!v)return w;let y=P(i),
|
|
2722
|
+
${s(this,b,ev).call(this,v)}
|
|
2723
|
+
<tbody>${u.map((j,W)=>c`<tr>${j.map((zt,K)=>f(zt,W*7+K,K))}</tr>`)}</tbody>
|
|
2724
|
+
</table>`;if(!v)return w;let y=P(i),k=t.get(y)??[],D=e.findIndex(j=>P(j)===y),H=s(this,b,Ke).call(this,i),B=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${w}
|
|
2722
2725
|
<section class="agenda" part="agenda" aria-labelledby="${r(this,Se)}-ag">
|
|
2723
2726
|
<div class="ag-h">
|
|
2724
|
-
<div class="ag-t" id="${r(this,Se)}-ag" role="heading" aria-level=${
|
|
2725
|
-
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:H})} @click=${()=>s(this,
|
|
2727
|
+
<div class="ag-t" id="${r(this,Se)}-ag" role="heading" aria-level=${B}>${H}</div>
|
|
2728
|
+
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:H})} @click=${()=>s(this,b,fl).call(this,y,!0)}>
|
|
2726
2729
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
2727
2730
|
</div>
|
|
2728
|
-
${
|
|
2729
|
-
</section>`},
|
|
2731
|
+
${k.length?c`<ul class="ag-list">${k.map(j=>c`<li>${s(this,b,Ds).call(this,j,y,D,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
2732
|
+
</section>`},iv=function(e){let t=new Map,i=e.filter(u=>!u.allDay).sort((u,v)=>u.min-v.min||v.dur-u.dur),a=[],l=[],d=-1,m=()=>{for(let u of a)t.get(u).lanes=l.length;a=[],l=[]};for(let u of i){let v=Math.min(1440,u.min+Math.max(u.dur,20));u.min>=d&&(m(),d=-1);let f=l.findIndex(w=>w<=u.min);f<0?(f=l.length,l.push(v)):l[f]=v,t.set(u,{lane:f,lanes:1}),a.push(u),d=Math.max(d,v)}return m(),t},rv=function(e,t){let i=r(this,b,dl),a=r(this,b,cl),l=s(this,b,mu).call(this),d=this._target,m=this.readonly,u=e.map(f=>{let w=P(f),y=t.get(w)??[];return{d:f,iso:w,text:s(this,b,Ke).call(this,f),allDay:y.filter(k=>k.allDay),timed:y.filter(k=>!k.allDay),lanes:s(this,b,iv).call(this,y)}}),v=Array.from({length:24},(f,w)=>w);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${r(this,Se)}-t" aria-describedby="${r(this,Se)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
2730
2733
|
style="--cols:${e.length}">
|
|
2731
2734
|
<div class="tg-top" role="rowgroup">
|
|
2732
2735
|
<div class="row" role="row">
|
|
2733
2736
|
<div class="axis" role="columnheader"><span class="vh">${this.t("time")}</span></div>
|
|
2734
|
-
${u.map(
|
|
2735
|
-
<span class="wd" aria-hidden="true">${a.weekdaysShort[
|
|
2737
|
+
${u.map(f=>c`<div class="colh ${f.iso===i?"today":""}" role="columnheader" aria-current=${f.iso===i?"date":h}>
|
|
2738
|
+
<span class="wd" aria-hidden="true">${a.weekdaysShort[f.d.getDay()]}</span><span class="dn" aria-hidden="true">${a.day(f.d)}</span><span class="vh">${f.text}</span>
|
|
2736
2739
|
</div>`)}
|
|
2737
2740
|
</div>
|
|
2738
2741
|
<div class="row adrow" role="row">
|
|
2739
2742
|
<div class="axis" role="rowheader">${this.t("allDay")}</div>
|
|
2740
|
-
${u.map((
|
|
2741
|
-
${m?h:c`<button type="button" class="add item" data-k="adadd:${
|
|
2742
|
-
aria-label=${this.t("addAllDay",{date:
|
|
2743
|
-
${
|
|
2744
|
-
${d?.iso===
|
|
2743
|
+
${u.map((f,w)=>c`<div class="adcell ${d?.iso===f.iso&&l?.allDay?"over":""}" role="gridcell" data-drop data-i=${w}>
|
|
2744
|
+
${m?h:c`<button type="button" class="add item" data-k="adadd:${f.iso}" data-i=${w} data-day=${f.iso} data-row="a"
|
|
2745
|
+
aria-label=${this.t("addAllDay",{date:f.text})} @click=${()=>s(this,b,fl).call(this,f.iso,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2746
|
+
${f.allDay.map(y=>s(this,b,Ds).call(this,y,f.iso,w,"allday",!0,{row:"a"}))}
|
|
2747
|
+
${d?.iso===f.iso&&l?.allDay?s(this,b,Dh).call(this,l):h}
|
|
2745
2748
|
</div>`)}
|
|
2746
2749
|
</div>
|
|
2747
2750
|
</div>
|
|
2748
2751
|
<div class="tg-body" role="rowgroup">
|
|
2749
|
-
${v.map(
|
|
2750
|
-
<div class="axis" role="rowheader"><span>${s(this,
|
|
2751
|
-
${u.map((w,y)=>{let
|
|
2752
|
-
${m?h:c`<button type="button" class="slot item" data-k="slot:${w.iso}:${
|
|
2753
|
-
aria-label=${this.t("addAt",{time:s(this,
|
|
2754
|
-
${
|
|
2755
|
-
${D?s(this,
|
|
2752
|
+
${v.map(f=>c`<div class="row hr" role="row">
|
|
2753
|
+
<div class="axis" role="rowheader"><span>${s(this,b,Pb).call(this,f)}</span></div>
|
|
2754
|
+
${u.map((w,y)=>{let k=w.timed.filter(H=>Math.floor(H.min/60)===f),D=l&&!l.allDay&&d?.iso===w.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=${w.iso}>
|
|
2755
|
+
${m?h:c`<button type="button" class="slot item" data-k="slot:${w.iso}:${f}" data-i=${y} data-row=${f} data-day=${w.iso}
|
|
2756
|
+
aria-label=${this.t("addAt",{time:s(this,b,hl).call(this,f*60),date:w.text})} @click=${H=>s(this,b,Jb).call(this,H,w.iso,f)}></button>`}
|
|
2757
|
+
${k.map(H=>{let B=w.lanes.get(H)??{lane:0,lanes:1},j=Math.min(H.dur,1440-H.min)/60;return s(this,b,Ds).call(this,H,w.iso,y,"time",!0,{row:String(f),style:`--top:${(H.min-f*60)/60};--len:${j};--lane:${B.lane};--lanes:${B.lanes}`})})}
|
|
2758
|
+
${D?s(this,b,Dh).call(this,l,"time",`--top:${(d.min-f*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
2756
2759
|
</div>`})}
|
|
2757
2760
|
</div>`)}
|
|
2758
2761
|
</div>
|
|
2759
|
-
</div>`},
|
|
2762
|
+
</div>`},Rs.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}},Rs.styles=[E,x`
|
|
2760
2763
|
:host { display: block; position: relative; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
2761
2764
|
:host([dragging]) { cursor: grabbing; user-select: none; -webkit-user-select: none; }
|
|
2762
2765
|
.cal { display: flex; flex-direction: column; gap: var(--cm-space-12); min-width: 0; }
|
|
@@ -2917,12 +2920,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2917
2920
|
.chip.time > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2918
2921
|
.chip.time .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
2919
2922
|
.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; }
|
|
2920
|
-
`];$("cm-calendar",
|
|
2923
|
+
`];$("cm-calendar",Rs);var Xk=z("reportTile",{pinned:", pinned"}),_r=class extends T{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=c`
|
|
2921
2924
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
2922
2925
|
<span class="label">${this.label}</span>
|
|
2923
2926
|
${this.pinned?c`<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
2924
2927
|
<span class="sr">${this.t("pinned")}</span></span>`:h}
|
|
2925
|
-
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};
|
|
2928
|
+
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};_r.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},_r.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},_r.styles=[E,x`
|
|
2926
2929
|
:host { display: block; }
|
|
2927
2930
|
.tile {
|
|
2928
2931
|
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-12);
|
|
@@ -2941,10 +2944,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2941
2944
|
.icon cm-icon::part(svg) { width: 32px; height: 32px; }
|
|
2942
2945
|
::slotted([slot='icon']) { width: 32px; height: 32px; }
|
|
2943
2946
|
}
|
|
2944
|
-
`];$("cm-report-tile",
|
|
2947
|
+
`];$("cm-report-tile",_r);var qs=class extends S{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`
|
|
2945
2948
|
${this.heading?c`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:h}
|
|
2946
2949
|
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":h}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
2947
|
-
`}};
|
|
2950
|
+
`}};qs.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},qs.styles=[E,x`
|
|
2948
2951
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
2949
2952
|
.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; }
|
|
2950
2953
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-12); }
|
|
@@ -2954,7 +2957,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2954
2957
|
.title { margin-bottom: var(--cm-space-8); }
|
|
2955
2958
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
2956
2959
|
}
|
|
2957
|
-
`];$("cm-report-tiles",
|
|
2960
|
+
`];$("cm-report-tiles",qs);var tE=z("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),av=/^\s*-?\d+(\.\d+)?\s*$/,Bs=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:av.test(String(e))?Number(e):NaN;return Number.isNaN(t)?String(e):this.formatNumber(t)}sentiment(){let e=this.trendSentiment;return e==="positive"||e==="negative"||e==="neutral"?e:this.trend==="up"?"positive":this.trend==="down"?"negative":"neutral"}renderChange(){let e=this.trend&&["up","down","flat"].includes(this.trend)?this.trend:void 0;if(!this.change&&!e)return h;if(!e)return c`<span class="change neutral" part="change">${this.change}</span>`;let t=this.sentiment(),i=this.t(e,{change:this.change}).trim(),a=t==="positive"?this.t("good",{trend:i}):t==="negative"?this.t("bad",{trend:i}):i;return c`<span class="change ${e} ${t}" part="change">
|
|
2958
2961
|
<cm-icon name=${e==="flat"?"arrow-left":"arrow-up-right"} size="16"></cm-icon><span aria-hidden="true">${this.change}</span><span class="sr">${a}</span>
|
|
2959
2962
|
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),i=this.renderChange(),a=i!==h||e,l=c`
|
|
2960
2963
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
@@ -2963,7 +2966,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2963
2966
|
${i}
|
|
2964
2967
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
2965
2968
|
</span>
|
|
2966
|
-
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,m=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${a?"foot":h} aria-busy=${m}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${m}>${l}</div>${d}`}};
|
|
2969
|
+
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,m=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${a?"foot":h} aria-busy=${m}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${m}>${l}</div>${d}`}};Bs.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&av.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}},Bs.styles=[E,x`
|
|
2967
2970
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
2968
2971
|
.tile {
|
|
2969
2972
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -2999,29 +3002,29 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2999
3002
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
3000
3003
|
}
|
|
3001
3004
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
3002
|
-
`];$("cm-metric",
|
|
3003
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,
|
|
3005
|
+
`];$("cm-metric",Bs);var Fs=class extends S{constructor(){super(...arguments);this.label="";this.icon="";this.href="";this.value="";this.current=!1;this.badge="";this.expanded=!1;this.primary=!1}render(){return null}toItem(){return sv(this)}};Fs.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}},Fs.styles=x`:host { display: none !important; }`;$("cm-nav-item",Fs);function sv(o){let n=i=>o.getAttribute(i),e={label:n("label")||""};n("icon")&&(e.icon=n("icon")),n("href")&&(e.href=n("href")),n("value")&&(e.value=n("value")),o.hasAttribute("current")&&(e.current=!0),n("badge")&&(e.badge=n("badge")),o.hasAttribute("expanded")&&(e.expanded=!0),o.hasAttribute("primary")&&(e.primary=!0);let t=Xt(o);return t.length&&(e.items=t),e}var Xt=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(sv),pu=o=>o.value||o.href||o.label,Rh=o=>!!o.current||!!o.items?.some(Rh),Ri=(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},Hi=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:pu(n),href:n.href??""}}));var dE=z("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),Cl,Sl,Ih,U,uu,Hh,gu,nv,ov,fu,bu,lv,vu,yu,Nh,xu,cv,js=class extends T{constructor(){super(...arguments);p(this,U);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;p(this,Cl,new Set);p(this,Sl);p(this,Ih,A("cm-sidenav"))}connectedCallback(){super.connectedCallback(),s(this,U,uu).call(this),g(this,Sl,Ri(this,()=>s(this,U,uu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Sl)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let i=s(this,U,Hh).call(this,e,t);r(this,Cl).has(i)||!e.items?.length||(r(this,Cl).add(i),(e.expanded||Rh(e))&&this._open.add(i))})}toggle(e,t){let i=this.navItems[e];if(!i?.items?.length)return;let a=s(this,U,Hh).call(this,i,e),l=t??!this._open.has(a);if(l===this._open.has(a))return;let d=new Set(this._open);l?d.add(a):d.delete(a),this._open=d,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:i,expanded:l}}))}render(){let e=this.collapsed;return c`
|
|
3006
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,U,ov)}>
|
|
3004
3007
|
<slot name="header"></slot>
|
|
3005
3008
|
<ul part="list">
|
|
3006
|
-
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,
|
|
3007
|
-
${s(this,
|
|
3008
|
-
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,
|
|
3009
|
-
${s(this,
|
|
3009
|
+
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,U,xu).call(this,t,"",{index:i})}</li>`;let a=!e&&this._open.has(s(this,U,Hh).call(this,t,i)),l=`${r(this,Ih)}-${i}`;return c`<li>
|
|
3010
|
+
${s(this,U,Nh).call(this,t,c`<button type="button" class="item parent ${Rh(t)?"has-current":""}" part="item" data-index=${i}
|
|
3011
|
+
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,U,lv).call(this,i):this.toggle(i)}>
|
|
3012
|
+
${s(this,U,vu).call(this,t)}${s(this,U,yu).call(this,t)}
|
|
3010
3013
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
3011
3014
|
</button>`)}
|
|
3012
3015
|
<ul class="sub" id=${l} ?hidden=${!a} aria-label=${t.label}>
|
|
3013
|
-
${s(this,
|
|
3016
|
+
${s(this,U,fu).call(this,t.items).map(([d,m])=>c`<li>${s(this,U,xu).call(this,{...d,icon:void 0},m?"deep":"",{parent:i})}</li>`)}
|
|
3014
3017
|
</ul>
|
|
3015
3018
|
</li>`})}
|
|
3016
3019
|
</ul>
|
|
3017
|
-
${s(this,
|
|
3020
|
+
${s(this,U,cv).call(this)}
|
|
3018
3021
|
<slot name="footer"></slot>
|
|
3019
3022
|
<slot hidden></slot>
|
|
3020
3023
|
</nav>
|
|
3021
|
-
`}};
|
|
3022
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,
|
|
3023
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,
|
|
3024
|
-
@click=${()=>s(this,
|
|
3024
|
+
`}};Cl=new WeakMap,Sl=new WeakMap,Ih=new WeakMap,U=new WeakSet,uu=function(){this._slotted=Xt(this)},Hh=function(e,t){return`${t}:${pu(e)}`},gu=function(e,t){Hi(this,t)||e.preventDefault()},nv=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},ov=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let i=s(this,U,nv).call(this),a=i.indexOf(t),l=Number(t.dataset.index),d=J(e,this),m;if(e.key==="ArrowDown")m=i[(a+1)%i.length];else if(e.key==="ArrowUp")m=i[(a-1+i.length)%i.length];else if(e.key==="Home")m=i[0];else if(e.key==="End")m=i[i.length-1];else{if(this.collapsed&&(d==="ArrowRight"||d==="ArrowLeft"))return;if(d==="ArrowRight"&&t.classList.contains("parent")){this.toggle(l,!0),e.preventDefault();return}else if(d==="ArrowLeft"){if(t.classList.contains("parent")?this.toggle(l,!1):t.dataset.parent&&(m=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!m){e.preventDefault();return}}else return}e.preventDefault(),m?.focus()},fu=function(e,t=0){return e.flatMap(i=>[[i,t],...s(this,U,fu).call(this,i.items??[],t+1)])},bu=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},lv=function(e){s(this,U,bu).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},vu=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},yu=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}`},Nh=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},xu=function(e,t,i={}){let a=c`${s(this,U,vu).call(this,e)}${s(this,U,yu).call(this,e)}`;return s(this,U,Nh).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
3025
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,U,gu).call(this,l,e)}>${a}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
3026
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,U,gu).call(this,l,e)}>${a}</button>`)},cv=function(){if(!this.collapsible)return h;let e=this.t(this.collapsed?"expand":"collapse"),t=c`<cm-icon name=${this.collapsed?"chevron-right":"chevron-left"} size="20"></cm-icon>${this.collapsed?c`<span class="sr">${e}</span>`:c`<span class="label">${e}</span>`}`;return c`<div class="toggle-row">${s(this,U,Nh).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
3027
|
+
@click=${()=>s(this,U,bu).call(this,!this.collapsed)}>${t}</button>`)}</div>`},js.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},js.styles=[E,x`
|
|
3025
3028
|
:host { display: block; width: var(--cm-side-navigation-width, 220px); }
|
|
3026
3029
|
nav {
|
|
3027
3030
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: var(--cm-radius-lg);
|
|
@@ -3066,7 +3069,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3066
3069
|
background: var(--cm-nav-badge); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
3067
3070
|
}
|
|
3068
3071
|
.dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); }
|
|
3069
|
-
`];$("cm-side-navigation",
|
|
3072
|
+
`];$("cm-side-navigation",js);function dv(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 Us=class extends S{constructor(){super(...arguments);this.name="";this.src="";this.size="medium";this.shape="round";this.decorative=!1;this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){let e=dv(this.name),t=this.decorative||!this.name?h:this.name,i=this.decorative||!this.name?"true":h,a,l="avatar";return this.src&&!this._failed?a=c`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?a=c`<span aria-hidden="true">${e}</span>`:(l+=" icon",a=c`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),c`<span class=${l} part="avatar" role=${t===h?h:"img"} aria-label=${t} aria-hidden=${i}>${a}</span>`}};Us.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},Us.styles=[E,x`
|
|
3070
3073
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3071
3074
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
3072
3075
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -3079,34 +3082,35 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3079
3082
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
3080
3083
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
3081
3084
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
3082
|
-
`];$("cm-avatar",
|
|
3085
|
+
`];$("cm-avatar",Us);var xE=z("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),Ws,Jt,Gs,Me,Ll,wu,Vs,Ks=class extends T{constructor(){super();p(this,Me);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;p(this,Ws);p(this,Jt,!1);p(this,Gs,null);this.addEventListener("cm-select",e=>{let t=s(this,Me,Ll).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){s(this,Me,Ll).call(this)?.focus();return}this._searchOpen||(g(this,Gs,Am()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),g(this,Ws,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,Ws).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Ws)?.disconnect(),r(this,Jt)&&(vo(),g(this,Jt,!1))}updated(e){if(!e.has("_searchOpen"))return;let t=this.renderRoot.querySelector("dialog.layer");if(this._searchOpen&&t&&!t.open)t.showModal(),r(this,Jt)||(Dm(),g(this,Jt,!0)),s(this,Me,Ll).call(this)?.focus(),s(this,Me,Vs).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,Jt)&&(vo(),g(this,Jt,!1));let i=r(this,Gs)??this.renderRoot.querySelector(".search-btn");g(this,Gs,null),i?.isConnected&&i.focus(),s(this,Me,Vs).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
3083
3086
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
3084
3087
|
<div class="logo"><slot name="logo"></slot></div>
|
|
3085
3088
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
3086
|
-
@click=${()=>s(this,Me,
|
|
3087
|
-
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,Me,
|
|
3089
|
+
@click=${()=>s(this,Me,Vs).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="16"></cm-icon></button>`:h}
|
|
3090
|
+
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,Me,wu)}></slot></div>`}
|
|
3088
3091
|
<span class="grow"></span>
|
|
3089
3092
|
<div class="end">
|
|
3090
3093
|
${this._narrow&&this._hasSearch?c`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
3091
3094
|
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:h}
|
|
3092
3095
|
<div class="actions"><slot name="actions"></slot></div>
|
|
3093
3096
|
${this.balance?c`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
3094
|
-
@click=${()=>s(this,Me,
|
|
3097
|
+
@click=${()=>s(this,Me,Vs).call(this,"cm-wallet")}>${this.balance}</button>`:h}
|
|
3098
|
+
<slot name="end"></slot>
|
|
3095
3099
|
${this.userName?c`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
3096
|
-
@click=${()=>s(this,Me,
|
|
3100
|
+
@click=${()=>s(this,Me,Vs).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
3097
3101
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:h}
|
|
3098
|
-
<slot name="
|
|
3102
|
+
<slot name="account"></slot>
|
|
3099
3103
|
</div>
|
|
3100
3104
|
</header>
|
|
3101
3105
|
${this._narrow?c`<dialog class="layer" part="search-layer" aria-label=${this.searchLabel}
|
|
3102
3106
|
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
3103
3107
|
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
3104
3108
|
<div class="layer-bar">
|
|
3105
|
-
<div class="layer-search"><slot name="search" @slotchange=${s(this,Me,
|
|
3109
|
+
<div class="layer-search"><slot name="search" @slotchange=${s(this,Me,wu)}></slot></div>
|
|
3106
3110
|
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
3107
3111
|
</div>
|
|
3108
3112
|
</dialog>`:h}
|
|
3109
|
-
`}};
|
|
3113
|
+
`}};Ws=new WeakMap,Jt=new WeakMap,Gs=new WeakMap,Me=new WeakSet,Ll=function(){return this.querySelector(':scope > [slot="search"]')},wu=function(){this._hasSearch=!!s(this,Me,Ll).call(this)},Vs=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Ks.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}},Ks.styles=[E,x`
|
|
3110
3114
|
:host {
|
|
3111
3115
|
display: block; background: var(--cm-bg-surface); container-type: inline-size;
|
|
3112
3116
|
--_h: var(--cm-control-height-md); --_touch: var(--cm-control-height-touch);
|
|
@@ -3183,10 +3187,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3183
3187
|
@media (pointer: coarse) {
|
|
3184
3188
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
3185
3189
|
}
|
|
3186
|
-
`];$("cm-header-bar",
|
|
3187
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,
|
|
3190
|
+
`];$("cm-header-bar",Ks);var zE=z("bottomNavigation",{label:"Main"}),Dl,Cr,$u,hv,Ys=class extends T{constructor(){super(...arguments);p(this,Cr);this.items=[];this.fixed=!1;this._slotted=[];p(this,Dl)}connectedCallback(){super.connectedCallback(),s(this,Cr,$u).call(this),g(this,Dl,Ri(this,()=>s(this,Cr,$u).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Dl)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3191
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,Cr,hv).call(this,e)}</li>`)}</ul>
|
|
3188
3192
|
<slot hidden></slot>
|
|
3189
|
-
</nav>`}};
|
|
3193
|
+
</nav>`}};Dl=new WeakMap,Cr=new WeakSet,$u=function(){this._slotted=Xt(this)},hv=function(e){let t=`item ${e.primary?"primary":""}`,i=c`<span class="icon">${e.icon?c`<cm-icon name=${e.icon} size=${e.primary?16:20}></cm-icon>`:h}</span><span class="label">${e.label}</span>`,a=l=>{Hi(this,e)||l.preventDefault()};return e.href?c`<a class=${t} part="item" href=${e.href} aria-current=${e.current?"page":h} @click=${a}>${i}</a>`:c`<button type="button" class=${t} part="item" aria-current=${e.current?"page":h} @click=${a}>${i}</button>`},Ys.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},Ys.styles=[E,x`
|
|
3190
3194
|
:host { display: block; }
|
|
3191
3195
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
3192
3196
|
nav {
|
|
@@ -3208,32 +3212,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3208
3212
|
.icon { display: grid; place-items: center; width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
3209
3213
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
3210
3214
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3211
|
-
`];$("cm-bottom-navigation",
|
|
3215
|
+
`];$("cm-bottom-navigation",Ys);var RE=z("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Al,Sr,De,ku,mv,Eu,Mu,pv,Xs=class extends T{constructor(){super(...arguments);p(this,De);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;p(this,Al);p(this,Sr,A("cm-mmenu"))}connectedCallback(){super.connectedCallback(),s(this,De,ku).call(this),g(this,Al,Ri(this,()=>s(this,De,ku).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Al)?.disconnect()}get sections(){return this.items.length?this.items:this._slotted}back(){if(!this._page)return;let[e,t]=this._page;this._page=null,this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-row="${e}-${t}"]`)?.focus())}render(){let e=this.sections,t=this._page?e[this._page[0]]?.items?.[this._page[1]]:void 0;return t?c`<nav part="nav" class="sub" aria-label=${this.label||this.t("label")} id="${r(this,Sr)}-sub"
|
|
3212
3216
|
@keydown=${i=>{i.key==="Escape"&&(i.preventDefault(),this.back())}}>
|
|
3213
3217
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
3214
3218
|
${t.label}</button>
|
|
3215
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,De,
|
|
3219
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,De,Mu).call(this,i,0,0,!0)}</li>`)}</ul>
|
|
3216
3220
|
<slot hidden></slot>
|
|
3217
3221
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3218
|
-
${s(this,De,
|
|
3219
|
-
${e.map((i,a)=>{let l=`${r(this,
|
|
3222
|
+
${s(this,De,pv).call(this)}
|
|
3223
|
+
${e.map((i,a)=>{let l=`${r(this,Sr)}-s${a}`;return c`<section aria-labelledby=${i.label?l:h}>
|
|
3220
3224
|
${i.label?c`<h2 class="heading" id=${l}>${i.label}</h2>`:h}
|
|
3221
|
-
<ul class="card">${(i.items??[]).map((d,m)=>c`<li>${s(this,De,
|
|
3225
|
+
<ul class="card">${(i.items??[]).map((d,m)=>c`<li>${s(this,De,Mu).call(this,d,a,m)}</li>`)}</ul>
|
|
3222
3226
|
</section>`})}
|
|
3223
3227
|
<slot hidden></slot>
|
|
3224
|
-
</nav>`}};
|
|
3225
|
-
@click=${()=>s(this,De,
|
|
3226
|
-
<h2 class="heading" id="${r(this,
|
|
3228
|
+
</nav>`}};Al=new WeakMap,Sr=new WeakMap,De=new WeakSet,ku=function(){this._slotted=Xt(this)},mv=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},Eu=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Mu=function(e,t,i,a=!1){let l=v=>{Hi(this,e)||v.preventDefault()};if(e.primary&&!a)return c`<button type="button" class="row action" part="row" @click=${l}>${e.label}</button>`;let d=e.icon&&!a?c`<cm-icon class="icon" name=${e.icon} size="20"></cm-icon>`:h,m=e.badge?c`<span class="badge">${e.badge}</span>`:h;if(e.items?.length&&!a)return c`<button type="button" class="row" part="row" data-row="${t}-${i}"
|
|
3229
|
+
@click=${()=>s(this,De,mv).call(this,t,i)}>${d}<span class="label">${e.label}</span>${m}<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let u=c`${d}<span class="label">${e.label}</span>${m}${e.href&&!a?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return e.href?c`<a class="row" part="row" href=${e.href} aria-current=${e.current?"page":h} @click=${l}>${u}</a>`:c`<button type="button" class="row" part="row" aria-current=${e.current?"page":h} @click=${l}>${u}</button>`},pv=function(){if(!this.store&&!this.userName)return h;let e=this.userName.trim().charAt(0).toUpperCase();return c`<section aria-labelledby="${r(this,Sr)}-profile">
|
|
3230
|
+
<h2 class="heading" id="${r(this,Sr)}-profile">${this.t("profile")}</h2>
|
|
3227
3231
|
<ul class="card">
|
|
3228
|
-
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,De,
|
|
3232
|
+
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,De,Eu).call(this,"cm-store-switch")}>
|
|
3229
3233
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
3230
3234
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3231
|
-
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,De,
|
|
3235
|
+
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,De,Eu).call(this,"cm-account")}>
|
|
3232
3236
|
<span class="avatar">${this.avatarSrc?c`<img src=${this.avatarSrc} alt="">`:c`<span aria-hidden="true">${e}</span>`}</span>
|
|
3233
3237
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?c`<span class="email">${this.userEmail}</span>`:h}</span>
|
|
3234
3238
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3235
3239
|
</ul>
|
|
3236
|
-
</section>`},
|
|
3240
|
+
</section>`},Xs.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}},Xs.styles=[E,x`
|
|
3237
3241
|
:host { display: block; background: var(--cm-bg-page); }
|
|
3238
3242
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
3239
3243
|
.heading {
|
|
@@ -3270,12 +3274,12 @@ ${t.label}</button>
|
|
|
3270
3274
|
}
|
|
3271
3275
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3272
3276
|
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3273
|
-
`];$("cm-mobile-menu",
|
|
3277
|
+
`];$("cm-mobile-menu",Xs);var qE=z("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),Ph,uv,Js=class extends T{constructor(){super(...arguments);p(this,Ph);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
3274
3278
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
3275
3279
|
<span class="text"><slot></slot></span>
|
|
3276
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,
|
|
3280
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,Ph,uv)}><cm-icon name="close" size="16"></cm-icon>
|
|
3277
3281
|
</button>`:h}
|
|
3278
|
-
</div>`}};
|
|
3282
|
+
</div>`}};Ph=new WeakSet,uv=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},Js.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},Js.styles=[E,x`
|
|
3279
3283
|
:host { display: block; }
|
|
3280
3284
|
.bar {
|
|
3281
3285
|
position: relative; display: flex; align-items: center; justify-content: center; gap: var(--cm-space-8); min-height: 48px;
|
|
@@ -3297,11 +3301,11 @@ ${t.label}</button>
|
|
|
3297
3301
|
@media (max-width: 640px) {
|
|
3298
3302
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
3299
3303
|
}
|
|
3300
|
-
`];$("cm-flash-offer-bar",
|
|
3304
|
+
`];$("cm-flash-offer-bar",Js);var WE=z("linkTabs",{label:"Sections"}),Rl,Hl,Tu,Zs=class extends T{constructor(){super(...arguments);p(this,Hl);this.items=[];this._slotted=[];p(this,Rl)}connectedCallback(){super.connectedCallback(),s(this,Hl,Tu).call(this),g(this,Rl,Ri(this,()=>s(this,Hl,Tu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Rl)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3301
3305
|
<ul part="tabs">${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3302
|
-
@click=${t=>{
|
|
3306
|
+
@click=${t=>{Hi(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
3303
3307
|
<slot hidden></slot>
|
|
3304
|
-
</nav>`}};
|
|
3308
|
+
</nav>`}};Rl=new WeakMap,Hl=new WeakSet,Tu=function(){this._slotted=Xt(this)},Zs.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0}},Zs.styles=[E,x`
|
|
3305
3309
|
:host { display: block; }
|
|
3306
3310
|
ul {
|
|
3307
3311
|
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
@@ -3320,7 +3324,7 @@ ${t.label}</button>
|
|
|
3320
3324
|
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
3321
3325
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
3322
3326
|
|
|
3323
|
-
`];$("cm-link-tabs",
|
|
3327
|
+
`];$("cm-link-tabs",Zs);var QE=z("appCard",{developer:"By {developer}",rating:"Rated {rating} out of 5",reviews:{one:"{count} Review",other:"{count} Reviews"},offer:"Offer: ",details:"View Details",detailsLabel:"View details of {name}"}),Qs=class extends T{constructor(){super(...arguments);this.name="";this.developer="";this.reviewsHref="";this.pricing="";this.offer="";this.href="";this.headingLevel=3}render(){let e=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),t=typeof this.rating=="number"&&!Number.isNaN(this.rating),i=typeof this.reviews=="number"?this.t("reviews",{count:this.reviews}):"",a=t?this.formatNumber(this.rating,{minimumFractionDigits:1,maximumFractionDigits:1}):"";return c`<article part="card" aria-labelledby="name">
|
|
3324
3328
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
3325
3329
|
<div class="status"><slot name="status"></slot></div>
|
|
3326
3330
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
@@ -3332,7 +3336,7 @@ ${t.label}</button>
|
|
|
3332
3336
|
${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}
|
|
3333
3337
|
<div class="actions"><slot name="actions"></slot>${this.href?c`<a class="details" part="details" href=${this.href}
|
|
3334
3338
|
aria-label=${this.t("detailsLabel",{name:this.name})}>${this.t("details")}</a>`:h}</div>
|
|
3335
|
-
</article>`}};
|
|
3339
|
+
</article>`}};Qs.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},Qs.styles=[E,x`
|
|
3336
3340
|
:host { display: block; container-type: inline-size; }
|
|
3337
3341
|
article {
|
|
3338
3342
|
position: relative; display: flex; flex-direction: column; gap: var(--cm-space-8); height: 100%; padding: var(--cm-space-20);
|
|
@@ -3369,21 +3373,21 @@ ${t.label}</button>
|
|
|
3369
3373
|
.actions { gap: var(--cm-space-8); }
|
|
3370
3374
|
.details { margin-inline-start: auto; }
|
|
3371
3375
|
}
|
|
3372
|
-
`];$("cm-app-card",
|
|
3376
|
+
`];$("cm-app-card",Qs);var Oh,gv,en=class extends ee{constructor(){super(...arguments);p(this,Oh);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">
|
|
3373
3377
|
${this.renderHeader()}
|
|
3374
3378
|
<div class="body" part="body"><slot></slot></div>
|
|
3375
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,
|
|
3376
|
-
</div>`)}};
|
|
3379
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,Oh,gv)}></slot></footer>
|
|
3380
|
+
</div>`)}};Oh=new WeakSet,gv=function(e){this._hasFooter=e.target.assignedElements().length>0},en.properties={...ee.properties,size:{reflect:!0},_hasFooter:{state:!0}},en.styles=[...ee.overlayStyles,x`
|
|
3377
3381
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
3378
3382
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
3379
3383
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
3380
3384
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
3381
3385
|
|
|
3382
|
-
`];$("cm-modal",
|
|
3386
|
+
`];$("cm-modal",en);var qh,fv,Tt=class extends ee{constructor(){super(...arguments);p(this,qh);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}renderBody(){return c`<slot></slot>`}renderFooter(){return c`<slot name="footer" @slotchange=${s(this,qh,fv)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3383
3387
|
${this.renderHeader()}
|
|
3384
3388
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
3385
3389
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
3386
|
-
</div>`)}};
|
|
3390
|
+
</div>`)}};qh=new WeakSet,fv=function(e){this._hasFooter=e.target.assignedElements().length>0},Tt.properties={...ee.properties,size:{reflect:!0},_hasFooter:{state:!0}},Tt.styles=[...ee.overlayStyles,x`
|
|
3387
3391
|
dialog {
|
|
3388
3392
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
3389
3393
|
}
|
|
@@ -3401,26 +3405,66 @@ ${t.label}</button>
|
|
|
3401
3405
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
3402
3406
|
|
|
3403
3407
|
}
|
|
3404
|
-
`];$("cm-side-panel",
|
|
3408
|
+
`];$("cm-side-panel",Tt);var gM=z("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),rn,Bh,tn=class extends Tt{constructor(){super(...arguments);this.search=!1;this.query="";p(this,rn,()=>{this.dispatchEvent(new CustomEvent("cm-filter-apply",{detail:{values:this.values,query:this.query},bubbles:!0,composed:!0,cancelable:!0}))&&this.requestClose("action")});p(this,Bh,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(a,l)=>{if(l==="")return;let d=e[a];e[a]=d===void 0?l:Array.isArray(d)?[...d,l]:[d,l]},i=this.form;if(i){for(let[a,l]of new FormData(i))typeof l=="string"&&t(a,l);return e}return this.querySelectorAll("[name]").forEach(a=>{let l=a.getAttribute("name");"checked"in a&&(a.type==="checkbox"||a.type==="radio"||a.localName.match(/^cm-(checkbox|radio|toggle)$/))?a.checked&&t(l,a.value||"on"):typeof a.value=="string"&&t(l,a.value)}),e}reset(){let e=this.form;e?e.reset():this.querySelectorAll("[name]").forEach(t=>t.formResetCallback?.()),this.query=""}renderBody(){return c`${this.search?c`<cm-search class="search" part="search" .value=${this.query} label=${this.searchLabel}
|
|
3405
3409
|
placeholder=${this.searchPlaceholder}
|
|
3406
3410
|
@input=${e=>{this.query=e.target.value}}
|
|
3407
|
-
@cm-search=${e=>{e.stopPropagation(),r(this,
|
|
3408
|
-
<slot @submit=${e=>{e.preventDefault(),r(this,
|
|
3409
|
-
<cm-button part="apply" variant="primary" @click=${r(this,
|
|
3411
|
+
@cm-search=${e=>{e.stopPropagation(),r(this,rn).call(this)}}></cm-search>`:h}
|
|
3412
|
+
<slot @submit=${e=>{e.preventDefault(),r(this,rn).call(this)}}></slot>`}renderFooter(){return c`<cm-button part="reset" @click=${r(this,Bh)}>${this.resetLabel}</cm-button>
|
|
3413
|
+
<cm-button part="apply" variant="primary" @click=${r(this,rn)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};rn=new WeakMap,Bh=new WeakMap,tn.properties={...Tt.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"}},tn.styles=[...Tt.styles,x`
|
|
3410
3414
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
3411
3415
|
.foot { justify-content: center; }
|
|
3412
3416
|
::slotted(form) { display: grid; gap: var(--cm-space-12); }
|
|
3413
|
-
`];$("cm-filter-panel",
|
|
3417
|
+
`];$("cm-filter-panel",tn);var $M=z("accountMenu",{trigger:"Account: {name}"}),an=class extends ft{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)}
|
|
3418
|
+
aria-label=${this.t("trigger",{name:this.name})} ?disabled=${this.disabled} @click=${e} @keydown=${t}>
|
|
3419
|
+
<cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></button>`}headTemplate(){let e=(t,i,a,l,d)=>{let m=c`${a}<span class="who"><strong>${l}</strong>${d?c`<span>${d}</span>`:h}</span>${t?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return t?c`<a class="row" part=${i} href=${t}>${m}</a>`:c`<div class="row" part=${i}>${m}</div>`};return c`<div class="acct">
|
|
3420
|
+
${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)}
|
|
3421
|
+
${this.orgName?c`<div class="split"></div>
|
|
3422
|
+
${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)}
|
|
3423
|
+
${this.plan?c`<div class="plan"><cm-icon name="check-circle" size="16"></cm-icon>${this.plan}</div>`:h}`:h}
|
|
3424
|
+
</div>`}};an.properties={...ft.properties,name:{},avatarSrc:{attribute:"avatar-src"},meta:{},profileHref:{attribute:"profile-href"},orgName:{attribute:"org-name"},orgMeta:{attribute:"org-meta"},orgHref:{attribute:"org-href"},plan:{}},an.styles=[...ft.styles,x`
|
|
3425
|
+
/* The avatar button: 36px round with a ring (40 and a 44px hit area on touch screens). */
|
|
3426
|
+
.trigger.account {
|
|
3427
|
+
position: relative; width: var(--cm-control-height-md, 36px); height: var(--cm-control-height-md, 36px); min-height: 0; padding: 2px;
|
|
3428
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-full); background: var(--cm-bg-surface);
|
|
3429
|
+
}
|
|
3430
|
+
.trigger.account:hover { background: var(--cm-bg-hover); }
|
|
3431
|
+
.trigger.account cm-avatar { --cm-avatar-size: 28px; } /* 36 less the 2px gap and 1px ring on each side */
|
|
3432
|
+
@media (pointer: coarse) {
|
|
3433
|
+
.trigger.account { width: var(--cm-control-height-lg, 40px); height: var(--cm-control-height-lg, 40px); }
|
|
3434
|
+
.trigger.account cm-avatar { --cm-avatar-size: 32px; }
|
|
3435
|
+
.trigger.account::after { content: ''; position: absolute; inset: -3px; }
|
|
3436
|
+
}
|
|
3437
|
+
.pop { width: min(320px, calc(100vw - 32px)); }
|
|
3438
|
+
.acct { display: flex; flex-direction: column; padding: var(--cm-space-4) 0; margin-bottom: var(--cm-space-4); border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
3439
|
+
.row {
|
|
3440
|
+
display: flex; align-items: center; gap: var(--cm-space-12); padding: var(--cm-space-8) var(--cm-space-12); border-radius: var(--cm-radius-sm);
|
|
3441
|
+
color: var(--cm-text-default); text-decoration: none;
|
|
3442
|
+
}
|
|
3443
|
+
a.row:hover { background: var(--cm-bg-hover); }
|
|
3444
|
+
a.row:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; }
|
|
3445
|
+
.ring { flex: none; display: grid; place-items: center; width: 40px; height: 40px; box-sizing: border-box; padding: 2px; border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-full); }
|
|
3446
|
+
.ring cm-avatar { --cm-avatar-size: 34px; }
|
|
3447
|
+
.logo { flex: none; display: grid; place-items: center; width: 40px; height: 40px; overflow: hidden; border-radius: var(--cm-radius-full); background: var(--cm-bg-brand, var(--cm-action-primary)); color: var(--cm-text-on-brand, var(--cm-action-primary-text)); }
|
|
3448
|
+
::slotted([slot='org-logo']) { width: 40px; height: 40px; object-fit: cover; }
|
|
3449
|
+
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
3450
|
+
.who strong { font-size: var(--cm-font-size-16); line-height: var(--cm-line-height-16); font-weight: 500; overflow-wrap: anywhere; }
|
|
3451
|
+
.who span { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); overflow-wrap: anywhere; }
|
|
3452
|
+
.chev { flex: none; color: var(--cm-icon-default); }
|
|
3453
|
+
.plan { display: flex; align-items: center; gap: var(--cm-space-8); padding: 0 var(--cm-space-12) var(--cm-space-8); font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
|
|
3454
|
+
.plan cm-icon { color: var(--cm-text-success); }
|
|
3455
|
+
.split { height: 0; margin: var(--cm-space-4) var(--cm-space-12); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
3456
|
+
:host(:dir(rtl)) .chev { transform: scaleX(-1); }
|
|
3457
|
+
`];$("cm-account-menu",an);var Nl,Lr,zu,bv,sn=class extends ee{constructor(){super(...arguments);p(this,Lr);this.heading="";this.items=[];this._slotted=[];p(this,Nl)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=Fn(this),g(this,Nl,xc(this,()=>{this._slotted=Fn(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,Nl)?.disconnect()}render(){let e=this.sheetItems.filter(i=>!i.divider&&!i.heading),t=e.some(i=>i.icon);return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3414
3458
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
3415
3459
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
3416
3460
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
3417
3461
|
<div class="content">
|
|
3418
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,
|
|
3462
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,Lr,bv).call(this,i)}</li>`)}</ul>`:h}
|
|
3419
3463
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
3420
3464
|
</div>
|
|
3421
|
-
</div>`)}};
|
|
3422
|
-
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${a=>s(this,
|
|
3423
|
-
@click=${a=>s(this,
|
|
3465
|
+
</div>`)}};Nl=new WeakMap,Lr=new WeakSet,zu=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")},bv=function(e){let t=`row${e.critical?" critical":""}`,i=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
3466
|
+
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${a=>s(this,Lr,zu).call(this,a,e)}>${i}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
3467
|
+
@click=${a=>s(this,Lr,zu).call(this,a,e)}>${i}</button>`},sn.properties={...ee.properties,items:{type:Array},_slotted:{state:!0}},sn.styles=[...ee.overlayStyles,x`
|
|
3424
3468
|
dialog {
|
|
3425
3469
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: var(--cm-space-24);
|
|
3426
3470
|
}
|
|
@@ -3454,17 +3498,17 @@ ${t.label}</button>
|
|
|
3454
3498
|
}
|
|
3455
3499
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
3456
3500
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3457
|
-
`];$("cm-bottom-sheet",
|
|
3458
|
-
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(a=>c`<li>${s(this,Ie,
|
|
3501
|
+
`];$("cm-bottom-sheet",sn);var RM=z("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),Ry={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},nn=class extends S{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};nn.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},nn.styles=x`:host { display: none; }`;$("cm-notification-item",nn);var ln,Ie,_u,Cu,vv,yv,xv,on=class extends ee{constructor(){super(...arguments);p(this,Ie);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;p(this,ln)}connectedCallback(){super.connectedCallback(),s(this,Ie,_u).call(this),g(this,ln,new MutationObserver(()=>s(this,Ie,_u).call(this))),r(this,ln).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,ln)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications,t=this.markAllRead&&!this.loading&&e.some(a=>a.unread)?c`<button type="button" class="mark" part="mark-all-read" @click=${s(this,Ie,yv)}>${this.markAllLabel}</button>`:h,i=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
3502
|
+
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(a=>c`<li>${s(this,Ie,vv).call(this,a)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3459
3503
|
${this.renderHeader(t)}
|
|
3460
3504
|
${i}
|
|
3461
3505
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3462
3506
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
3463
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,Ie,
|
|
3507
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,Ie,xv)}></slot></div>
|
|
3464
3508
|
<slot hidden></slot>
|
|
3465
|
-
</div>`)}};
|
|
3509
|
+
</div>`)}};ln=new WeakMap,Ie=new WeakSet,_u=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=i=>e.getAttribute(i)||void 0;return{label:(e.textContent??"").trim(),time:t("time"),tone:t("tone")??"information",href:t("href"),unread:e.hasAttribute("unread")||void 0,value:t("value"),description:t("description"),icon:t("icon")}})},Cu=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")},vv=function(e){let t=e.tone??"information",i=e.description?c`<span class="title">${e.label}</span><span class="vh">, </span><span class="desc">${e.description}</span>`:e.label,a=c`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${e.icon||Ry[t]||"bell"} size="14"></cm-icon></span>
|
|
3466
3510
|
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${i}</span>
|
|
3467
|
-
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>s(this,Ie,
|
|
3511
|
+
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>s(this,Ie,Cu).call(this,d,e)}>${a}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>s(this,Ie,Cu).call(this,d,e)}>${a}</button>`},yv=async function(e){let t=e.currentTarget;this.dispatchEvent(new CustomEvent("cm-mark-all-read",{bubbles:!0,composed:!0})),await new Promise(i=>setTimeout(i)),await this.updateComplete,!t.isConnected&&this.open&&this.renderRoot.querySelector(".panel")?.focus()},xv=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},on.properties={...ee.properties,items:{type:Array},moreHref:{attribute:"more-href"},heading:{string:"heading"},moreLabel:{attribute:"more-label",string:"more"},emptyText:{attribute:"empty-text",string:"empty"},markAllRead:{type:Boolean,attribute:"mark-all-read"},markAllLabel:{attribute:"mark-all-label",string:"markAllRead"},loading:{type:Boolean,reflect:!0},_slotted:{state:!0},_footer:{state:!0}},on.styles=[...ee.overlayStyles,x`
|
|
3468
3512
|
dialog {
|
|
3469
3513
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
3470
3514
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3514,15 +3558,15 @@ ${t.label}</button>
|
|
|
3514
3558
|
@media (max-width: 599px) {
|
|
3515
3559
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3516
3560
|
}
|
|
3517
|
-
`];$("cm-notification-panel",
|
|
3561
|
+
`];$("cm-notification-panel",on);var qM=z("toastRegion",{label:"Notifications"}),BM=z("toast",{undo:"Undo",shortcut:"Press F6 to reach it."}),wv=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o&&o!==document.body?o:null},Su=(o,n)=>{for(let e=n;e;e=e.parentNode??e.host??null)if(e===o)return!0;return!1},Hy=2e3,$v=1e4,kv=150,Il,ut,Zt,Pl,mn,pn,Dr,Ni,Ar,pe,Fh,Ev,cn,Lu,Ol,ql,Bl,Fl,Mv,dn=class extends T{constructor(){super(...arguments);p(this,pe);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;p(this,Il);p(this,ut);p(this,Zt,0);p(this,Pl,0);p(this,mn,!1);p(this,pn,!1);p(this,Dr);p(this,Ni);p(this,Ar);p(this,Ol,()=>{g(this,mn,!0),s(this,pe,Lu).call(this)});p(this,ql,()=>{g(this,mn,!1),s(this,pe,cn).call(this)});p(this,Bl,()=>{g(this,pn,!0),s(this,pe,Lu).call(this)});p(this,Fl,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(g(this,pn,!1),s(this,pe,cn).call(this))})}get closed(){if(!r(this,Dr)){if(!this.open&&r(this,Ar))return Promise.resolve(r(this,Ar));g(this,Dr,new Promise(e=>{g(this,Ni,e)}))}return r(this,Dr)}get effectiveDuration(){let e=this.duration??(this.actionLabel?$v:5e3);return Math.min($v,Math.max(Hy,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&g(this,Il,setTimeout(()=>{this._primed=!0},kv)),this.addEventListener("pointerenter",r(this,Ol)),this.addEventListener("pointerleave",r(this,ql)),this.addEventListener("focusin",r(this,Bl)),this.addEventListener("focusout",r(this,Fl))}disconnectedCallback(){super.disconnectedCallback(),this.open&&r(this,Ni)&&queueMicrotask(()=>{!this.isConnected&&this.open&&s(this,pe,Fh).call(this,"removed")}),clearTimeout(r(this,ut)),clearTimeout(r(this,Il)),this.removeEventListener("pointerenter",r(this,Ol)),this.removeEventListener("pointerleave",r(this,ql)),this.removeEventListener("focusin",r(this,Bl)),this.removeEventListener("focusout",r(this,Fl))}updated(e){e.has("open")&&e.get("open")!==void 0&&(this.open?g(this,Ar,void 0):r(this,Ni)&&s(this,pe,Fh).call(this,"close")),(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,ut)),this.open&&(this._inRegion||this._primed)&&(g(this,Zt,this.effectiveDuration),s(this,pe,cn).call(this)))}show(){this.open?(g(this,Zt,this.effectiveDuration),s(this,pe,cn).call(this)):this.open=!0}dismiss(e="close"){let t=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0,detail:{reason:e}});return this.dispatchEvent(t)?(clearTimeout(r(this,ut)),this.open=!1,s(this,pe,Fh).call(this,e),!0):(e==="timeout"&&(g(this,Zt,this.effectiveDuration),s(this,pe,cn).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3518
3562
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3519
3563
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3520
|
-
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,pe,
|
|
3564
|
+
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,pe,Mv)}>${this.actionLabel}</button>`:h}
|
|
3521
3565
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3522
3566
|
<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>
|
|
3523
3567
|
</button>
|
|
3524
3568
|
${this.actionLabel&&this._inRegion&&this.t("shortcut")?c`<span class="hint">${this.t("shortcut")}</span>`:h}
|
|
3525
|
-
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};
|
|
3569
|
+
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Il=new WeakMap,ut=new WeakMap,Zt=new WeakMap,Pl=new WeakMap,mn=new WeakMap,pn=new WeakMap,Dr=new WeakMap,Ni=new WeakMap,Ar=new WeakMap,pe=new WeakSet,Fh=function(e){g(this,Ar,e);let t=r(this,Ni);g(this,Dr,g(this,Ni,void 0)),t?.(e)},Ev=function(){return r(this,mn)||r(this,pn)},cn=function(){clearTimeout(r(this,ut)),!(!this.open||r(this,pe,Ev))&&(g(this,Pl,Date.now()),g(this,ut,setTimeout(()=>this.dismiss("timeout"),r(this,Zt))))},Lu=function(){r(this,ut)!==void 0&&(clearTimeout(r(this,ut)),g(this,ut,void 0),g(this,Zt,Math.max(1e3,r(this,Zt)-(Date.now()-r(this,Pl)))))},Ol=new WeakMap,ql=new WeakMap,Bl=new WeakMap,Fl=new WeakMap,Mv=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},dn.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},dn.styles=[E,x`
|
|
3526
3570
|
:host { display: block; pointer-events: auto; }
|
|
3527
3571
|
:host(:not([open])) { display: none; }
|
|
3528
3572
|
.toast {
|
|
@@ -3554,13 +3598,13 @@ ${t.label}</button>
|
|
|
3554
3598
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
3555
3599
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
3556
3600
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
3557
|
-
`];$("cm-toast",
|
|
3601
|
+
`];$("cm-toast",dn);var Rr,jl,Ul,Vl,Kl,Wl,un,jh,hn=class extends T{constructor(){super(...arguments);p(this,un);this.max=3;p(this,Rr,null);p(this,jl,!1);p(this,Ul,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let i=t.matches(":focus-within");t.remove(),i&&s(this,un,jh).call(this)})});p(this,Vl,e=>{let t=e.relatedTarget;t&&!Su(this,t)&&g(this,Rr,t)});p(this,Kl,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(i=>i.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});p(this,Wl,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?s(this,un,jh).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,jl,!0)),this.addEventListener("cm-dismiss",r(this,Ul)),this.addEventListener("focusin",r(this,Vl)),this.addEventListener("keydown",r(this,Kl)),document.addEventListener("keydown",r(this,Wl))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Ul)),this.removeEventListener("focusin",r(this,Vl)),this.removeEventListener("keydown",r(this,Kl)),document.removeEventListener("keydown",r(this,Wl))}updated(){r(this,jl)&&this.setAttribute("aria-label",this.t("label"))}focusToast(){let e=[...this.querySelectorAll(":scope > cm-toast[open]")].reverse(),t=e.find(l=>l.actionLabel)??e[0],i=t?.shadowRoot?.querySelector(".action")??t?.shadowRoot?.querySelector(".close");if(!i)return!1;let a=wv();return a&&!Su(this,a)&&g(this,Rr,a),i.focus(),!0}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")],i=t.slice(0,Math.max(0,t.length-Math.max(1,this.max))),a=i.some(l=>l.matches(":focus-within"));return i.forEach(l=>l.remove()),a&&s(this,un,jh).call(this),e}render(){return c`<slot></slot>`}};Rr=new WeakMap,jl=new WeakMap,Ul=new WeakMap,Vl=new WeakMap,Kl=new WeakMap,Wl=new WeakMap,un=new WeakSet,jh=function(){let e=r(this,Rr);return g(this,Rr,null),e?.isConnected?(e.focus(),Su(e,wv())||e.shadowRoot?.querySelector("button, a[href], input, select, textarea, [tabindex]")?.focus(),!0):!1},hn.properties={max:{type:Number}},hn.styles=[E,x`
|
|
3558
3602
|
:host {
|
|
3559
3603
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
3560
3604
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
3561
3605
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
3562
3606
|
}
|
|
3563
|
-
`];$("cm-toast-region",
|
|
3607
|
+
`];$("cm-toast-region",hn);function Tv(o,n={}){let e=n.root??document.body,t=e.querySelector(":scope > cm-toast-region"),i=!t;t||(t=document.createElement("cm-toast-region"),e.append(t));let a=document.createElement("cm-toast");if(a.message=String(o),n.tone&&(a.tone=n.tone),n.duration!==void 0&&(a.duration=n.duration),n.action){a.actionLabel=n.action.label;let l=n.action.onAction;a.addEventListener("cm-action",()=>l())}if(i){let l=t;return setTimeout(()=>l.add(a),kv),a}return t.add(a)}async function Ny(o,n,e){await o();let{message:t,undoLabel:i,...a}=e,l=i??gc("toast","undo",void 0,a.root??document.body),d=await Tv(t,{...a,action:{label:l,onAction:()=>{}}}).closed;return d==="action"&&await n(),d}var WM=z("progressBar",{inProgress:"In progress"}),Uh,gn=class extends T{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";p(this,Uh,A("cm-progress"))}get clampedValue(){let e=this.value;return e==null||Number.isNaN(Number(e))?null:Math.min(100,Math.max(0,Number(e)))}render(){let e=this.clampedValue,t=`${r(this,Uh)}-label`;return c`
|
|
3564
3608
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
3565
3609
|
<span id=${t} part="label">${this.label}</span>
|
|
3566
3610
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -3570,7 +3614,7 @@ ${t.label}</button>
|
|
|
3570
3614
|
aria-valuenow=${e===null?h:Math.round(e)}
|
|
3571
3615
|
aria-valuetext=${e===null?this.t("inProgress"):this.formatNumber(Math.round(e)/100,{style:"percent"})}>
|
|
3572
3616
|
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
3573
|
-
</div>`}};
|
|
3617
|
+
</div>`}};Uh=new WeakMap,gn.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},gn.styles=[E,x`
|
|
3574
3618
|
:host { display: block; }
|
|
3575
3619
|
.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); }
|
|
3576
3620
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
@@ -3588,7 +3632,7 @@ ${t.label}</button>
|
|
|
3588
3632
|
.fill { transition: none; }
|
|
3589
3633
|
.indeterminate .fill { animation-duration: 4s; }
|
|
3590
3634
|
}
|
|
3591
|
-
`];$("cm-progress-bar",
|
|
3635
|
+
`];$("cm-progress-bar",gn);var fn=class extends S{constructor(){super(...arguments);this.tone="neutral"}render(){return c`<span part="badge"><slot></slot></span>`}};fn.properties={tone:{reflect:!0}},fn.styles=[E,x`
|
|
3592
3636
|
:host { display: inline-flex; vertical-align: middle; }
|
|
3593
3637
|
span {
|
|
3594
3638
|
display: inline-flex; align-items: center; box-sizing: border-box; height: 24px; padding: 0 var(--cm-space-8); white-space: nowrap;
|
|
@@ -3600,12 +3644,12 @@ ${t.label}</button>
|
|
|
3600
3644
|
: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); }
|
|
3601
3645
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
3602
3646
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
3603
|
-
`];$("cm-badge",
|
|
3647
|
+
`];$("cm-badge",fn);var vn,yn,gt,zv,_v,Gl,Cv,Vh,Du,bn=class extends S{constructor(){super(...arguments);p(this,gt);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;this.variant="standard";this.href="";this.target="";this.selected=!1;this.label="";p(this,vn,!1);p(this,yn,!1);p(this,Gl,!1);p(this,Vh,()=>{this.href||this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))})}willUpdate(){this.selected&&g(this,Gl,!0)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=r(this,gt,Cv),i=t?s(this,gt,Du).call(this,this.heading):this.heading,a=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${i}</span><span class="adornment" ?hidden=${!r(this,vn)}><slot name="title-adornment" @slotchange=${s(this,gt,zv)}></slot></span></div>`:h;return c`<section part="card" aria-label=${!t&&this.heading||h}>${t&&!this.heading?s(this,gt,Du).call(this,h):h}
|
|
3604
3648
|
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${a}${this.description?c`<p class="desc">${this.description}</p>`:h}</div>
|
|
3605
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,
|
|
3649
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,yn)}><div class="actions"><slot name="actions" @slotchange=${s(this,gt,_v)}></slot></div></div>`}
|
|
3606
3650
|
<slot></slot>
|
|
3607
|
-
</section>`}};
|
|
3608
|
-
aria-current=${this.selected?"true":h} aria-label=${i}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":r(this,
|
|
3651
|
+
</section>`}};vn=new WeakMap,yn=new WeakMap,gt=new WeakSet,zv=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,vn)&&(g(this,vn,t),this.requestUpdate())},_v=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,yn)&&(g(this,yn,t),this.requestUpdate())},Gl=new WeakMap,Cv=function(){return String(this.variant||"").split(/\s+/).includes("interactive")},Vh=new WeakMap,Du=function(e){let t=e===h?"hit cover":"hit",i=e===h?this.label||h:h;return this.href?c`<a class=${t} part="control" href=${this.href} target=${this.target||h} rel=${this.target==="_blank"?"noopener noreferrer":h}
|
|
3652
|
+
aria-current=${this.selected?"true":h} aria-label=${i}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":r(this,Gl)?"false":h} aria-label=${i} @click=${r(this,Vh)}>${e}</button>`},bn.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:{}},bn.styles=[E,x`
|
|
3609
3653
|
/* Owner standard (1.6): 24px padding and a 16px gap under the header; compact 16px and 12px; 16px on phones. */
|
|
3610
3654
|
:host { display: block; --_pad: var(--cm-space-24); --_gap: var(--cm-space-16); }
|
|
3611
3655
|
:host([variant~='compact']) { --_pad: var(--cm-space-16); --_gap: var(--cm-space-12); }
|
|
@@ -3657,8 +3701,8 @@ ${t.label}</button>
|
|
|
3657
3701
|
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
|
|
3658
3702
|
.bare[hidden] { display: none; }
|
|
3659
3703
|
:host([flush]) .bare { padding: var(--_pad) var(--_pad) 0; margin-bottom: var(--cm-space-8); }
|
|
3660
|
-
`];$("cm-card",
|
|
3661
|
-
`))}var
|
|
3704
|
+
`];$("cm-card",bn);var Iy=["0","4","8","12","16","20","24","32","40","48","64"],Py={10:"8",15:"16",22:"24",30:"32"};function xn(o,n){let e=(t,i)=>`:host([${o}='${t}']) { ${n}: ${i==="0"?"0px":`var(--cm-space-${i})`}; }`;return rc([...Iy.map(t=>e(t,t)),...Object.entries(Py).map(([t,i])=>e(t,i))].join(`
|
|
3705
|
+
`))}var wn=class extends S{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return c`<slot></slot>`}};wn.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},wn.styles=[E,x`
|
|
3662
3706
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
3663
3707
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
3664
3708
|
:host([wrap]) { flex-wrap: wrap; }
|
|
@@ -3671,13 +3715,13 @@ ${t.label}</button>
|
|
|
3671
3715
|
:host([justify='center']) { justify-content: center; }
|
|
3672
3716
|
:host([justify='end']) { justify-content: flex-end; }
|
|
3673
3717
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
3674
|
-
`,
|
|
3718
|
+
`,xn("gap","gap")];$("cm-stack",wn);var Sv="important",Oy=" !"+Sv,Lv=Xr(class extends ii{constructor(o){if(super(o),o.type!==ot.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((n,e)=>{let t=o[e];return t==null?n:n+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(o,[n]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(let t of this.ft)n[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in n){let i=n[t];if(i!=null){this.ft.add(t);let a=typeof i=="string"&&i.endsWith(Oy);t.includes("-")||a?e.setProperty(t,a?i.slice(0,-11):i,a?Sv:""):e[t]=i}}return we}});var $n=class extends S{constructor(){super(...arguments);this.columns=2;this.gap="20"}render(){let e=Math.max(1,Math.floor(Number(this.columns)||1)),t=this.minColumnWidth?.trim(),i=t?`repeat(auto-fit, minmax(min(100%, ${t}), 1fr))`:`repeat(${e}, minmax(0, 1fr))`;return c`<div class="grid ${t?"fit":"fixed"}" part="grid" style=${Lv({gridTemplateColumns:i})}><slot></slot></div>`}};$n.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},$n.styles=[E,x`
|
|
3675
3719
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
3676
3720
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
3677
3721
|
@container cm-grid (max-width: 640px) {
|
|
3678
3722
|
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
3679
3723
|
}
|
|
3680
|
-
`,
|
|
3724
|
+
`,xn("gap","--_gap")];$("cm-grid",$n);var Gh,Hr,Nr,Xl,ce,Kh,Au,Yl,Wh,Ru,kn=class extends S{constructor(){super(...arguments);p(this,ce);this.gap="24";this.variant="default";this.asidePosition="above";this.stickyAside=!1;p(this,Gh,this.attachInternals());p(this,Hr);p(this,Nr,[]);p(this,Xl,()=>s(this,ce,Wh).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,ce,Au).call(this)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&s(this,ce,Yl).call(this)}updated(e){(e.has("stickyAside")||e.has("variant"))&&s(this,ce,Yl).call(this)}get asideSticks(){let e=s(this,ce,Kh).call(this)[0];return!!e&&getComputedStyle(e).position==="sticky"}render(){return c`<div class="layout" part="layout"><slot @slotchange=${()=>{this.stickyAside&&s(this,ce,Yl).call(this)}}></slot></div>`}};Gh=new WeakMap,Hr=new WeakMap,Nr=new WeakMap,Xl=new WeakMap,ce=new WeakSet,Kh=function(){return[...this.children].filter(e=>e.getAttribute("variant")==="aside")},Au=function(){r(this,Hr)?.disconnect(),g(this,Hr,void 0),g(this,Nr,[]),window.removeEventListener("resize",r(this,Xl)),s(this,ce,Ru).call(this,!1)},Yl=function(){s(this,ce,Au).call(this),!(!this.stickyAside||this.variant!=="record"||!this.isConnected)&&(g(this,Hr,new ResizeObserver(()=>s(this,ce,Wh).call(this))),g(this,Nr,[this,...s(this,ce,Kh).call(this)]),r(this,Nr).forEach(e=>r(this,Hr).observe(e)),window.addEventListener("resize",r(this,Xl)),s(this,ce,Wh).call(this))},Wh=function(){let e=s(this,ce,Kh).call(this);if(e.some(i=>!r(this,Nr).includes(i))){s(this,ce,Yl).call(this);return}let t=e.length>0&&e.every(i=>{let a=parseFloat(getComputedStyle(i).insetBlockStart)||0;return i.getBoundingClientRect().height+a<=window.innerHeight});s(this,ce,Ru).call(this,t)},Ru=function(e){let t=r(this,Gh).states;if(t)try{e?t.add("aside-fits"):t.delete("aside-fits")}catch{}},kn.properties={gap:{reflect:!0},variant:{reflect:!0},asidePosition:{attribute:"aside-position",reflect:!0},stickyAside:{type:Boolean,attribute:"sticky-aside",reflect:!0}},kn.styles=[E,x`
|
|
3681
3725
|
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-24); }
|
|
3682
3726
|
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
3683
3727
|
@container cm-layout (max-width: 767px) {
|
|
@@ -3721,9 +3765,9 @@ ${t.label}</button>
|
|
|
3721
3765
|
/* Read back by #measure(); only takes effect once the aside is sticky. --_header: cm-app-frame's header height. */
|
|
3722
3766
|
inset-block-start: var(--cm-layout-sticky-top, calc(var(--_header, 0px) + var(--cm-space-24)));
|
|
3723
3767
|
}
|
|
3724
|
-
`,
|
|
3768
|
+
`,xn("gap","--_gap")];var En=class extends S{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};En.properties={variant:{reflect:!0}},En.styles=[E,x`
|
|
3725
3769
|
:host { display: flex; flex-direction: column; gap: var(--_cm-section-gap, var(--cm-space-24)); min-inline-size: 0; }
|
|
3726
|
-
`];$("cm-layout",
|
|
3770
|
+
`];$("cm-layout",kn);$("cm-layout-section",En);var Hu=1024,qy=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},Pr,Tn,Pe,Nu,Ir,Dv,Jl,Zl,Mn=class extends S{constructor(){super(...arguments);p(this,Pe);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;p(this,Pr);p(this,Tn,null);p(this,Jl,e=>{if(!this.menuItem)return;let t=s(this,Pe,Dv).call(this,e),i=e.detail?.value;t==="bottom-navigation"&&i===this.menuItem?s(this,Pe,Ir).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&s(this,Pe,Ir).call(this,!1,!1)});p(this,Zl,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),s(this,Pe,Ir).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,Jl)),this.addEventListener("keydown",r(this,Zl));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=Hu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,Jl)),this.removeEventListener("keydown",r(this,Zl)),r(this,Pr)?.disconnect(),g(this,Pr,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;g(this,Pr,new ResizeObserver(()=>{s(this,Pe,Nu).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=Hu!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=Hu}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,Pr).observe(t))}updated(e){e.has("_wide")&&s(this,Pe,Nu).call(this)}openMenu(){s(this,Pe,Ir).call(this,!0)}closeMenu(){s(this,Pe,Ir).call(this,!1)}toggleMenu(){s(this,Pe,Ir).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">
|
|
3727
3771
|
<div class="probe"></div>
|
|
3728
3772
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
3729
3773
|
<div class="body">
|
|
@@ -3732,7 +3776,7 @@ ${t.label}</button>
|
|
|
3732
3776
|
</div>
|
|
3733
3777
|
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
3734
3778
|
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
3735
|
-
</div>`}};
|
|
3779
|
+
</div>`}};Pr=new WeakMap,Tn=new WeakMap,Pe=new WeakSet,Nu=function(){let e=this.renderRoot.querySelector(".frame");if(!e)return;let t=i=>Math.round(this.renderRoot.querySelector(i)?.getBoundingClientRect().height??0);e.style.setProperty("--_header",`${t(".header")}px`),e.style.setProperty("--_bottom",`${this._wide?0:t(".bottom")}px`)},Ir=function(e,t=!0){e!==this.menuOpen&&(e&&g(this,Tn,qy()),this.menuOpen=e,this.dispatchEvent(new CustomEvent("cm-menu-toggle",{bubbles:!0,composed:!0,detail:{open:e}})),this.updateComplete.then(()=>{if(e){let i=this.querySelector(':scope > [slot="mobile-menu"]');(i?.shadowRoot??i)?.querySelector("a[href], button")?.focus()}else t&&(r(this,Tn)?.focus(),g(this,Tn,null))}))},Dv=function(e){return e.composedPath().find(i=>i.parentElement===this)?.getAttribute("slot")??""},Jl=new WeakMap,Zl=new WeakMap,Mn.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},panel:{type:Boolean,reflect:!0},_wide:{state:!0}},Mn.styles=[E,x`
|
|
3736
3780
|
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
3737
3781
|
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
3738
3782
|
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
@@ -3763,7 +3807,7 @@ ${t.label}</button>
|
|
|
3763
3807
|
}
|
|
3764
3808
|
.probe { block-size: 0; }
|
|
3765
3809
|
[hidden] { display: none !important; }
|
|
3766
|
-
`];$("cm-app-frame"
|
|
3810
|
+
`];$("cm-app-frame",Mn);var zn=class extends S{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>`}};zn.properties={width:{reflect:!0},fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},zn.styles=[E,x`
|
|
3767
3811
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-page-background, var(--cm-bg-page)); min-block-size: 100%; }
|
|
3768
3812
|
.content {
|
|
3769
3813
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
@@ -3775,16 +3819,16 @@ ${t.label}</button>
|
|
|
3775
3819
|
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
3776
3820
|
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
3777
3821
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
3778
|
-
`];$("cm-page",
|
|
3822
|
+
`];$("cm-page",zn);var Cn,Av,Rv,_n=class extends T{constructor(){super(...arguments);p(this,Cn);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?In`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:In`<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}>
|
|
3779
3823
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
3780
3824
|
<div class="body">
|
|
3781
3825
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
3782
3826
|
<div><slot></slot></div>
|
|
3783
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,
|
|
3827
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,Cn,Av)}></slot></div>
|
|
3784
3828
|
</div>
|
|
3785
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,
|
|
3829
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,Cn,Rv)}>
|
|
3786
3830
|
<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}
|
|
3787
|
-
</div>`}};
|
|
3831
|
+
</div>`}};Cn=new WeakSet,Av=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},Rv=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},_n.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},_n.styles=[E,x`
|
|
3788
3832
|
:host { display: block; }
|
|
3789
3833
|
.banner {
|
|
3790
3834
|
display: flex; gap: var(--cm-space-12); align-items: flex-start;
|
|
@@ -3808,10 +3852,10 @@ ${t.label}</button>
|
|
|
3808
3852
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
3809
3853
|
}
|
|
3810
3854
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3811
|
-
`];$("cm-banner",
|
|
3855
|
+
`];$("cm-banner",_n);var q2=z("thumbnail",{noImage:"{alt} (no image)"}),Sn=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}
|
|
3812
3856
|
@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}
|
|
3813
3857
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):h} aria-hidden=${this.alt?h:"true"}>
|
|
3814
|
-
<cm-icon name="box" size=${e}></cm-icon></span>`}};
|
|
3858
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};Sn.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},Sn.styles=[E,x`
|
|
3815
3859
|
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3816
3860
|
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
3817
3861
|
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
@@ -3821,7 +3865,7 @@ ${t.label}</button>
|
|
|
3821
3865
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
3822
3866
|
}
|
|
3823
3867
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
3824
|
-
`];$("cm-thumbnail",
|
|
3868
|
+
`];$("cm-thumbnail",Sn);export{$r as Announcer,Ua as CmAccordion,an as CmAccountMenu,qa as CmActionBar,ft as CmActionMenu,Qs as CmAppCard,Mn as CmAppFrame,Us as CmAvatar,fn as CmBadge,_n as CmBanner,zs as CmBoard,kr as CmBoardCard,Er as CmBoardColumn,Ys as CmBottomNavigation,sn as CmBottomSheet,Fi as CmButton,Yr as CmButtonGroup,Rs as CmCalendar,As as CmCalendarEvent,bn as CmCard,si as CmCheckbox,wi as CmColorField,mi as CmCombobox,ga as CmCommandPalette,Ga as CmComment,Ya as CmCommentBox,us as CmDataTable,fi as CmDatePicker,vi as CmDateRangePicker,Va as CmEmptyState,xi as CmFileUpload,tn as CmFilterPanel,Js as CmFlashOfferBar,ir as CmGlobalSearch,$n as CmGrid,Ks as CmHeaderBar,Fr as CmIcon,ja as CmInfoItem,Fa as CmInfoPanel,kn as CmLayout,En as CmLayoutSection,Zs as CmLinkTabs,T as CmLocalizedElement,jr as CmMenuItem,Bs as CmMetric,Xs as CmMobileMenu,en as CmModal,Fs as CmNavItem,Ms as CmNestedItem,Es as CmNestedList,nn as CmNotificationItem,on as CmNotificationPanel,wt as CmOptionGroup,zn as CmPage,Oa as CmPageHeader,ss as CmPagination,gn as CmProgressBar,Yi as CmRadio,Xi as CmRadioGroup,_r as CmReportTile,qs as CmReportTiles,ws as CmResourceItem,$s as CmResourceList,Ba as CmSaveBar,hi as CmSearch,Pa as CmSegmentedControl,di as CmSelect,js as CmSideNavigation,Tt as CmSidePanel,$i as CmSignatureField,Ka as CmSkeleton,Wa as CmSkeletonDisplay,rs as CmSmartTip,as as CmSmartTips,Ur as CmSpinner,wn as CmStack,os as CmStatusTabs,cs as CmTableHeader,Qi as CmTag,ai as CmTextField,Sn as CmThumbnail,pr as CmTimeline,ts as CmTimelineItem,dn as CmToast,hn as CmToastRegion,oi as CmToggle,Xa as CmTooltip,wr as MoveModel,Ng as commandMatches,Xv as configure,z as defineStrings,og as directionalIcons,ae as formatDate,sg as formatMessage,cm as formatNumber,Gv as getDefaultStrings,dv as initials,go as isApplePlatform,vb as listNavigation,qn as localeFor,_m as matchesShortcut,Ut as normalizeHex,uc as pluralCategory,Jv as resetStrings,Kg as resolvePreset,Yv as setStrings,ld as shortcutKeys,Tv as showToast,gc as translate,Ny as undoable};
|
|
3825
3869
|
/*! Bundled license information:
|
|
3826
3870
|
|
|
3827
3871
|
@lit/reactive-element/css-tag.js:
|