@commmerce/ui 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.txt +101 -0
- package/dist/cdn.js +487 -478
- package/dist/components/action-menu.js +11 -58
- package/dist/components/badge.js +5 -0
- package/dist/components/button.js +1 -1
- package/dist/components/combobox.js +14 -2
- package/dist/components/data-table.js +12 -2
- package/dist/components/date-picker.js +13 -3
- package/dist/components/date-range-picker.js +13 -3
- package/dist/components/global-search.js +14 -2
- package/dist/components/link-tabs.js +1 -1
- package/dist/components/mobile-menu.js +1 -1
- package/dist/components/page-header.js +1 -0
- package/dist/components/resource-list.js +2 -1
- package/dist/components/select.js +15 -2
- package/dist/components/side-navigation.js +3 -3
- package/dist/components/status-tabs.js +1 -1
- package/dist/custom-elements.json +40 -86
- package/dist/top-layer.d.ts +31 -0
- package/dist/top-layer.js +133 -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 Ju=o=>{throw TypeError(o)};var lm=(o,n,e)=>n.has(o)||Ju("Cannot "+e);var r=(o,n,e)=>(lm(o,n,"read from private field"),e?e.call(o):n.get(o)),p=(o,n,e)=>n.has(o)?Ju("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),f=(o,n,e,t)=>(lm(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),s=(o,n,e)=>(lm(o,n,"access private method"),e);var fc=globalThis,bc=fc.ShadowRoot&&(fc.ShadyCSS===void 0||fc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,cm=Symbol(),Zu=new WeakMap,Wn=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==cm)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(bc&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=Zu.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&Zu.set(e,n))}return n}toString(){return this.cssText}},vc=o=>new Wn(typeof o=="string"?o:o+"",void 0,cm),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 Wn(e,o,cm)},Qu=(o,n)=>{if(bc)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=fc.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},dm=bc?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return vc(e)})(o):o;var{is:Wv,defineProperty:Gv,getOwnPropertyDescriptor:Yv,getOwnPropertyNames:Xv,getOwnPropertySymbols:Jv,getPrototypeOf:Zv}=Object,yc=globalThis,eg=yc.trustedTypes,Qv=eg?eg.emptyScript:"",ey=yc.reactiveElementPolyfillSupport,Gn=(o,n)=>o,hm={toAttribute(o,n){switch(n){case Boolean:o=o?Qv: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}},ig=(o,n)=>!Wv(o,n),tg={attribute:!0,type:String,converter:hm,reflect:!1,useDefault:!1,hasChanged:ig};Symbol.metadata??=Symbol("metadata"),yc.litPropertyMetadata??=new WeakMap;var Dt=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=tg){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&&Gv(this.prototype,n,i)}}static getPropertyDescriptor(n,e,t){let{get:i,set:a}=Yv(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)??tg}static _$Ei(){if(this.hasOwnProperty(Gn("elementProperties")))return;let n=Zv(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(Gn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Gn("properties"))){let e=this.properties,t=[...Xv(e),...Jv(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(dm(i))}else n!==void 0&&e.push(dm(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 Qu(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:hm).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:hm;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??ig)(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){}};Dt.elementStyles=[],Dt.shadowRootOptions={mode:"open"},Dt[Gn("elementProperties")]=new Map,Dt[Gn("finalized")]=new Map,ey?.({ReactiveElement:Dt}),(yc.reactiveElementVersions??=[]).push("2.1.2");var pm=globalThis,rg=o=>o,xc=pm.trustedTypes,ag=xc?xc.createPolicy("lit-html",{createHTML:o=>o}):void 0,um="$lit$",At=`lit$${Math.random().toFixed(9).slice(2)}$`,gm="?"+At,ty=`<${gm}>`,Gi=document,Xn=()=>Gi.createComment(""),Jn=o=>o===null||typeof o!="object"&&typeof o!="function",fm=Array.isArray,dg=o=>fm(o)||typeof o?.[Symbol.iterator]=="function",mm=`[
|
|
2
|
+
\f\r]`,Yn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,sg=/-->/g,ng=/>/g,Ki=RegExp(`>|${mm}(?:([^\\s"'>=/]+)(${mm}*=${mm}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),og=/'/g,lg=/"/g,hg=/^(?:script|style|textarea|title)$/i,bm=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=bm(1),Rt=bm(2),nx=bm(3),we=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),cg=new WeakMap,Wi=Gi.createTreeWalker(Gi,129);function mg(o,n){if(!fm(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ag!==void 0?ag.createHTML(n):n}var pg=(o,n)=>{let e=o.length-1,t=[],i,a=n===2?"<svg>":n===3?"<math>":"",l=Yn;for(let d=0;d<e;d++){let m=o[d],u,v,g=-1,w=0;for(;w<m.length&&(l.lastIndex=w,v=l.exec(m),v!==null);)w=l.lastIndex,l===Yn?v[1]==="!--"?l=sg:v[1]!==void 0?l=ng:v[2]!==void 0?(hg.test(v[2])&&(i=RegExp("</"+v[2],"g")),l=Ki):v[3]!==void 0&&(l=Ki):l===Ki?v[0]===">"?(l=i??Yn,g=-1):v[1]===void 0?g=-2:(g=l.lastIndex-v[2].length,u=v[1],l=v[3]===void 0?Ki:v[3]==='"'?lg:og):l===lg||l===og?l=Ki:l===sg||l===ng?l=Yn:(l=Ki,i=void 0);let y=l===Ki&&o[d+1].startsWith("/>")?" ":"";a+=l===Yn?m+ty:g>=0?(t.push(u),m.slice(0,g)+um+m.slice(g)+At+y):m+At+(g===-2?d:y)}return[mg(o,a+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},Zn=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]=pg(n,e);if(this.el=o.createElement(u,t),Wi.currentNode=this.el.content,e===2||e===3){let g=this.el.content.firstChild;g.replaceWith(...g.childNodes)}for(;(i=Wi.nextNode())!==null&&m.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let g of i.getAttributeNames())if(g.endsWith(um)){let w=v[l++],y=i.getAttribute(g).split(At),k=/([.?@])?(.*)/.exec(w);m.push({type:1,index:a,name:k[2],strings:y,ctor:k[1]==="."?$c:k[1]==="?"?kc:k[1]==="@"?Ec:Xi}),i.removeAttribute(g)}else g.startsWith(At)&&(m.push({type:6,index:a}),i.removeAttribute(g));if(hg.test(i.tagName)){let g=i.textContent.split(At),w=g.length-1;if(w>0){i.textContent=xc?xc.emptyScript:"";for(let y=0;y<w;y++)i.append(g[y],Xn()),Wi.nextNode(),m.push({type:2,index:++a});i.append(g[w],Xn())}}}else if(i.nodeType===8)if(i.data===gm)m.push({type:2,index:a});else{let g=-1;for(;(g=i.data.indexOf(At,g+1))!==-1;)m.push({type:7,index:a}),g+=At.length-1}a++}}static createElement(n,e){let t=Gi.createElement("template");return t.innerHTML=n,t}};function Yi(o,n,e=o,t){if(n===we)return n;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Jn(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=Yi(o,i._$AS(o,n.values),i,t)),n}var wc=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??Gi).importNode(e,!0);Wi.currentNode=i;let a=Wi.nextNode(),l=0,d=0,m=t[0];for(;m!==void 0;){if(l===m.index){let u;m.type===2?u=new Zr(a,a.nextSibling,this,n):m.type===1?u=new m.ctor(a,m.name,m.strings,this,n):m.type===6&&(u=new Mc(a,this,n)),this._$AV.push(u),m=t[++d]}l!==m?.index&&(a=Wi.nextNode(),l++)}return Wi.currentNode=Gi,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++}},Zr=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=Yi(this,n,e),Jn(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):dg(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&&Jn(this._$AH)?this._$AA.nextSibling.data=n:this.T(Gi.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=Zn.createElement(mg(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new wc(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(n){let e=cg.get(n.strings);return e===void 0&&cg.set(n.strings,e=new Zn(n)),e}k(n){fm(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(Xn()),this.O(Xn()),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=rg(n).nextSibling;rg(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},Xi=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=Yi(this,n,e,0),l=!Jn(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=Yi(this,d[t+m],e,m),u===we&&(u=this._$AH[m]),l||=!Jn(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??"")}},$c=class extends Xi{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},kc=class extends Xi{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},Ec=class extends Xi{constructor(n,e,t,i,a){super(n,e,t,i,a),this.type=5}_$AI(n,e=this){if((n=Yi(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)}},Mc=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){Yi(this,n)}},ug={M:um,P:At,A:gm,C:1,L:pg,R:wc,D:dg,V:Yi,I:Zr,H:Xi,N:kc,U:Ec,B:$c,F:Mc},iy=pm.litHtmlPolyfillSupport;iy?.(Zn,Zr),(pm.litHtmlVersions??=[]).push("3.3.3");var gg=(o,n,e)=>{let t=e?.renderBefore??n,i=t._$litPart$;if(i===void 0){let a=e?.renderBefore??null;t._$litPart$=i=new Zr(n.insertBefore(Xn(),a),a,void 0,e??{})}return i._$AI(o),i};var vm=globalThis,S=class extends Dt{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=gg(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,vm.litElementHydrateSupport?.({LitElement:S});var ry=vm.litElementPolyfillSupport;ry?.({LitElement:S});(vm.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,20 +8,20 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,xx=x`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
14
|
+
`,ay=0,R=o=>`${o}-${++ay}`;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 sy={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},Tc={common:{...sy}},Qn={},eo={},zc;function z(o,n){return Tc[o]={...Tc[o],...n},n}function ny(){return Object.fromEntries(Object.entries(Tc).map(([o,n])=>[o,{...n}]))}function _c(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function oy(o,n){_c(n?eo[n.toLowerCase()]??={}:Qn,o),Lc()}function ly(o={}){"locale"in o&&(zc=o.locale||void 0),o.strings&&_c(Qn,o.strings);for(let[n,e]of Object.entries(o.translations??{}))_c(eo[n.toLowerCase()]??={},e);Lc()}function cy(){zc=void 0;for(let o of Object.keys(Qn))delete Qn[o];for(let o of Object.keys(eo))delete eo[o];Lc()}function to(o){if(zc)return zc;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 fg=new Map;function wm(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,a=fg.get(i);if(!a){try{a=t(n)}catch{a=t(void 0)}fg.set(i,a)}return a}function $m(o,n={},e){return wm("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function ae(o,n={},e){return wm("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function Cc(o,n){return wm("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function bg(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[Cc(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"?$m(l,{},e):String(l)})}function dy(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=eo[d]?.[a]?.[n];if(m!==void 0)return m}let l=Qn[a]?.[n]??Tc[a]?.[n];if(l!==void 0)return l}}function Sc(o,n,e,t,i){let a=to(t);return bg(dy(o,n,a,i),e,a)}var xm=new Set,ym;function Lc(){for(let o of xm)o.requestUpdate()}function hy(){ym||typeof MutationObserver>"u"||typeof document>"u"||(ym=new MutationObserver(Lc),ym.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var my=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 my(this.localName)}t(n,e){return Sc(this.stringsNamespace,n,e,this,this.strings)}get locale(){return to(this)}formatNumber(n,e){return $m(n,e,this.locale)}connectedCallback(){super.connectedCallback(),xm.add(this),hy()}disconnectedCallback(){super.disconnectedCallback(),xm.delete(this)}};T.properties={strings:{type:Object}};var Dc={"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"},vg=["more","drag"],Ex=Object.keys(Dc);var yg=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],Qr=class extends S{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=Dc[this.name]??Dc.more,t=vg.includes(this.name)?3:1.6;return Rt`<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"?yg.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Qr.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Qr.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",Qr);var xg=99,Ax=z("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),Ac,Rc,io,Ji=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,Ac,this.attachInternals());p(this,Rc,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,Ac).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});p(this,io,!1);this.addEventListener("click",r(this,Rc),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,io)&&(f(this,io,!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>xg?this.t("countOverflow",{max:xg}):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>`}};Ac=new WeakMap,Rc=new WeakMap,io=new WeakMap,Ji.formAssociated=!0,Ji.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}},Ji.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
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) */
|
|
@@ -100,19 +100,21 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
100
100
|
display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
|
|
101
101
|
min-width: 16px; height: 16px; padding: 0 var(--cm-space-4); border-radius: var(--cm-radius-full);
|
|
102
102
|
font-size: var(--cm-font-size-12); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums;
|
|
103
|
-
color: var(--cm-text
|
|
103
|
+
color: var(--cm-count-text); background: var(--cm-count-bg);
|
|
104
104
|
}
|
|
105
105
|
:host([icon-only]) .count {
|
|
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",Ji);var ea=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}}};ea.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}},ea.styles=x`:host { display: none; }`;$("cm-menu-item",ea);function ro(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 Hc(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var Xe=x`
|
|
110
|
+
:where([popover]) { margin: 0; padding: 0; border: 0; color: inherit; background: none; overflow: visible; }
|
|
111
|
+
`,ao=8,dt,ta,ia,ra,Zi,$e=class{constructor(){p(this,dt,null);p(this,ta,null);p(this,ia,{});p(this,ra,"");p(this,Zi,()=>this.place())}get active(){return!!r(this,dt)}open(n,e,t={}){if(!n||!e||typeof n.showPopover!="function")return!1;r(this,dt)&&r(this,dt)!==n&&this.close(),n.hasAttribute("popover")||n.setAttribute("popover","manual");let i=n.matches(":popover-open");if(!i){if(getComputedStyle(n).position==="static")return n.removeAttribute("popover"),!1;try{n.showPopover()}catch{return!1}}return n.matches(":popover-open")?(r(this,dt)||f(this,ra,n.style.maxHeight),f(this,dt,n),f(this,ta,e),f(this,ia,t),Object.assign(n.style,{position:"fixed",inset:"auto",margin:"0"}),this.place(),i||(window.addEventListener("scroll",r(this,Zi),!0),window.addEventListener("resize",r(this,Zi))),!0):!1}place(){let n=r(this,dt),e=r(this,ta);if(!n||!e)return;let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,a=document.documentElement.clientHeight,l=r(this,ia).gap??4,d=r(this,ia).align??"start";n.style.maxHeight=r(this,ra),d==="stretch"&&(n.style.minWidth=`${Math.round(t.width)}px`);let m=n.getBoundingClientRect(),u=m.width,v=m.height,g=getComputedStyle(e).direction==="rtl",w=g?t.right-u:t.left,y=g?t.left:t.right-u,k=d==="end"?y:w;k+u>i-ao&&(k=g?w:y);let L=Math.max(0,Math.min(ao,t.left)),A=Math.min(i,Math.max(i-ao,t.right))-u;k=Math.max(L,Math.min(k,A));let O=a-t.bottom-l-ao,B=t.top-l-ao,K;if(v<=O||O>=B)K=t.bottom+l,v>O&&(n.style.maxHeight=`${Math.max(80,Math.floor(O))}px`);else{let Ye=Math.min(v,Math.floor(B));v>B&&(n.style.maxHeight=`${Math.max(80,Ye)}px`),K=t.top-l-Ye}n.style.left=`${k}px`,n.style.top=`${K}px`}close(){let n=r(this,dt);if(window.removeEventListener("scroll",r(this,Zi),!0),window.removeEventListener("resize",r(this,Zi)),f(this,dt,null),f(this,ta,null),!!n){try{n.matches(":popover-open")&&n.hidePopover()}catch{}for(let e of["position","inset","margin","left","top","minWidth"])n.style[e]="";n.style.maxHeight=r(this,ra)}}};dt=new WeakMap,ta=new WeakMap,ia=new WeakMap,ra=new WeakMap,Zi=new WeakMap;var aa=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
112
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
111
113
|
<circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
|
|
112
114
|
<path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
|
|
113
115
|
</svg>
|
|
114
116
|
<span class="vh">${this.accessibleLabel||this.t("loading")}</span>
|
|
115
|
-
</span>`}};
|
|
117
|
+
</span>`}};aa.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},aa.styles=[E,x`
|
|
116
118
|
:host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
|
|
117
119
|
.spinner { display: inline-flex; }
|
|
118
120
|
svg { inline-size: 44px; block-size: 44px; animation: spin 0.8s linear infinite; }
|
|
@@ -125,18 +127,18 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
125
127
|
}
|
|
126
128
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
127
129
|
@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,
|
|
130
|
+
`];$("cm-spinner",aa);var Jx=z("actionMenu",{label:"Actions"}),so,Qi,er,no,U,Nc,oo,Ic,Pc,Oc,qc,wg,na,oa,la,sa,Bc,$g,km,kg,xt=class extends T{constructor(){super(...arguments);p(this,U);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,so);p(this,Qi,R("cm-menu"));p(this,er,"");p(this,no,0);p(this,oo,e=>{this.open&&!e.composedPath().includes(this)&&s(this,U,Oc).call(this,!1)});p(this,na,new $e);p(this,oa,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,la,()=>{this.disabled||(this.open?this.hide():this.show())});p(this,Bc,e=>{let t=s(this,U,Pc).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),s(this,U,sa).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),s(this,U,sa).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),s(this,U,sa).call(this,t[0]);break;case"End":e.preventDefault(),s(this,U,sa).call(this,t[t.length-1]);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.hide(!0);break;case"Tab":this.hide();break;default:if(e.key.length===1&&/\S/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let a=Date.now();f(this,er,(a-r(this,no)<600?r(this,er):"")+e.key.toLowerCase()),f(this,no,a);let l=this.menuItems,d=r(this,er).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,er)));u!==void 0&&s(this,U,sa).call(this,u)}}})}connectedCallback(){super.connectedCallback(),s(this,U,Nc).call(this),f(this,so,Hc(this,()=>s(this,U,Nc).call(this))),document.addEventListener("pointerdown",r(this,oo),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,so)?.disconnect(),document.removeEventListener("pointerdown",r(this,oo),!0),r(this,na).close()}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=s(this,U,Pc).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,s(this,U,Oc).call(this,!0),this.updateComplete.then(()=>s(this,U,qc).call(this))}hide(e=!1){s(this,U,Oc).call(this,!1),e&&s(this,U,Ic).call(this)?.focus()}updated(e){if(e.has("open")&&this.open&&s(this,U,wg).call(this),e.has("open")&&!this.open&&r(this,na).close(),this._custom){let t=s(this,U,Ic).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,Qi)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=s(this,U,Pc).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>s(this,U,qc).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,la)} @keydown=${r(this,oa)} @slotchange=${()=>s(this,U,Nc).call(this)}></slot>`:this.triggerTemplate(r(this,la),r(this,oa))??c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
131
|
+
aria-expanded=${String(this.open)} aria-controls="${r(this,Qi)}-m" aria-label=${this.iconOnly?t:h}
|
|
132
|
+
?disabled=${this.disabled} @click=${r(this,la)} @keydown=${r(this,oa)}>${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
133
|
<div class="pop" part="menu" popover="manual" ?hidden=${!this.open}>
|
|
132
134
|
${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,
|
|
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,
|
|
135
|
+
<div role="menu" id="${r(this,Qi)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${r(this,Bc)}>
|
|
136
|
+
${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,U,kg).call(this,e)}
|
|
135
137
|
</div>
|
|
136
138
|
</div>
|
|
137
|
-
<slot hidden></slot>`}};
|
|
139
|
+
<slot hidden></slot>`}};so=new WeakMap,Qi=new WeakMap,er=new WeakMap,no=new WeakMap,U=new WeakSet,Nc=function(){this._slotted=ro(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},oo=new WeakMap,Ic=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},Pc=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},Oc=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})))},qc=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},wg=function(){let e=this.renderRoot.querySelector(".pop");if(!e||r(this,na).open(e,s(this,U,Ic).call(this)??this,{align:this.align==="end"?"end":"start"}))return;e.classList.remove("to-end","to-start");let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,a=8,l=getComputedStyle(this).direction==="rtl",d=l?t.left<a:t.right>i-a,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")},na=new WeakMap,oa=new WeakMap,la=new WeakMap,sa=function(e){this._active=e,this.updateComplete.then(()=>s(this,U,qc).call(this))},Bc=new WeakMap,$g=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)},km=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,U,$g).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
140
|
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>`},
|
|
141
|
+
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},kg=function(e){let t=[];for(let i=0;i<e.length;i++){let a=e[i];if(!a.heading){t.push(s(this,U,km).call(this,a,i));continue}let l=`${r(this,Qi)}-h${i}`,d=[],m=i+1;for(;m<e.length&&!e[m].heading&&!e[m].divider;m++)d.push(s(this,U,km).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},xt.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}},xt.styles=[E,x`
|
|
140
142
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
141
143
|
.trigger {
|
|
142
144
|
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;
|
|
@@ -165,7 +167,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
165
167
|
:host([align='end']) .pop.to-start { inset-inline-start: 0; inset-inline-end: auto; }
|
|
166
168
|
.pop[hidden] { display: none; }
|
|
167
169
|
/* 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;
|
|
170
|
+
body) can't clip it; TopLayer (src/top-layer.ts) puts it beside the trigger. Browsers without popovers keep the absolute menu. */
|
|
169
171
|
.pop:popover-open { position: fixed; inset: auto; margin: 0; overflow: auto; color: var(--cm-text-default); }
|
|
170
172
|
.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; }
|
|
171
173
|
.head strong { display: block; font-size: 14px; font-weight: 500; }
|
|
@@ -199,12 +201,12 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
199
201
|
}
|
|
200
202
|
.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); }
|
|
201
203
|
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
202
|
-
`];$("cm-action-menu",
|
|
204
|
+
`];$("cm-action-menu",xt);var rw=z("buttonGroup",{more:"More"}),oi="data-cm-overflow",py=["disabled","loading","tone","icon","label","variant","size","icon-only","count","href","hidden","data-priority"],li,tr,Ht,wt,ci,ir,V,ca,Eg,lo,Em,Fc,jc,Mg,Uc,Mm,Tm,zm,da=class extends T{constructor(){super(...arguments);p(this,V);this.overflow="wrap";this.align="start";this.label="";this._items=[];this._size="medium";p(this,li,[]);p(this,tr);p(this,Ht);p(this,wt,0);p(this,ci,new Set);p(this,ir,!1);p(this,Uc,e=>{e.stopPropagation();let t=r(this,li)[Number(e.detail.value)];if(!t)return;f(this,ir,!0),(t.shadowRoot?.querySelector('[part="control"]')??t).click(),requestAnimationFrame(()=>requestAnimationFrame(()=>s(this,V,Mm).call(this)))})}get overflowing(){return[...r(this,li)]}connectedCallback(){super.connectedCallback(),f(this,tr,new MutationObserver(e=>s(this,V,Eg).call(this,e))),r(this,tr).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:py}),typeof ResizeObserver<"u"&&(f(this,Ht,new ResizeObserver(()=>s(this,V,ca).call(this))),r(this,Ht).observe(this),f(this,ci,new Set([this]))),document.fonts?.ready.then(()=>s(this,V,ca).call(this)),s(this,V,ca).call(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,tr)?.disconnect(),r(this,Ht)?.disconnect(),r(this,ci).clear(),cancelAnimationFrame(r(this,wt)),f(this,wt,0),s(this,V,Em).call(this,s(this,V,lo).call(this))}updated(e){(e.has("overflow")||e.has("moreLabel")||e.has("moreIcon")||e.has("size"))&&s(this,V,ca).call(this)}firstUpdated(){this.updateComplete.then(()=>this.relayout())}relayout(){cancelAnimationFrame(r(this,wt)),f(this,wt,0),s(this,V,jc).call(this)}render(){let e=this.moreIcon!=null;return c`<div class="row" part="row" role="group" aria-label=${this.label||h}>
|
|
203
205
|
<slot></slot>
|
|
204
206
|
<cm-action-menu class="more ${this._size}${e?" icon":""}" part="more" hidden align="end"
|
|
205
207
|
.items=${this._items} label=${this.moreLabel} ?icon-only=${e} icon=${this.moreIcon||"more"}
|
|
206
|
-
@cm-select=${r(this,
|
|
207
|
-
</div>`}};
|
|
208
|
+
@cm-select=${r(this,Uc)}></cm-action-menu>
|
|
209
|
+
</div>`}};li=new WeakMap,tr=new WeakMap,Ht=new WeakMap,wt=new WeakMap,ci=new WeakMap,ir=new WeakMap,V=new WeakSet,ca=function(){r(this,wt)||!this.isConnected||f(this,wt,requestAnimationFrame(()=>{f(this,wt,0);let e=s(this,V,lo).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>s(this,V,jc).call(this)):s(this,V,jc).call(this)}))},Eg=function(e){for(let t of e)for(let i of Array.from(t.removedNodes))i instanceof HTMLElement&&i.hasAttribute(oi)&&i.parentElement!==this&&(i.removeAttribute(oi),i.hidden=!1);s(this,V,ca).call(this)},lo=function(){return Array.from(this.children).filter(e=>e.localName==="cm-button"&&(!e.hidden||e.hasAttribute(oi)))},Em=function(e){for(let t of e)t.hasAttribute(oi)&&(t.removeAttribute(oi),t.hidden=!1)},Fc=function(){return this.renderRoot.querySelector(".more")},jc=function(){let e=this.renderRoot.querySelector(".row"),t=s(this,V,Fc).call(this);if(!e||!t||!this.isConnected)return;let i=s(this,V,lo).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,Ht)){let v=new Set([this,t,...i]);for(let g of r(this,ci))v.has(g)||r(this,Ht).unobserve(g);for(let g of v)r(this,ci).has(g)||r(this,Ht).observe(g);f(this,ci,v)}if(this.overflow==="menu"){s(this,V,Em).call(this,i),t.hidden=!1;let v=e.clientWidth,g=parseFloat(getComputedStyle(e).columnGap)||0,w=Array.from(this.children).filter(L=>!L.hidden),y=new Map(w.map(L=>[L,L.getBoundingClientRect().width])),k=w.reduce((L,A)=>L+y.get(A),0)+g*Math.max(w.length-1,0);if(k>v+.5){let L=B=>{let K=B.dataset.priority;return K==="low"?0:K==="high"?2:B.getAttribute("variant")==="primary"?3:1},A=i.map((B,K)=>({b:B,i:K,r:L(B)})).sort((B,K)=>B.r-K.r||K.i-B.i),O=k+g+t.getBoundingClientRect().width;for(let{b:B}of A){if(O<=v+.5)break;d.add(B),O-=y.get(B)+g}}}for(let v of i)d.has(v)?(v.setAttribute(oi,""),v.hidden=!0):v.hasAttribute(oi)&&(v.removeAttribute(oi),v.hidden=!1);t.hidden=d.size===0,a===t&&t.hidden?s(this,V,zm).call(this):a&&a!==t&&d.has(a)&&s(this,V,Tm).call(this),d.size===0&&t.open&&t.hide(),r(this,tr)?.takeRecords();let m=i.filter(v=>d.has(v));this._items=m.map((v,g)=>s(this,V,Mg).call(this,v,g));let u=m.length!==r(this,li).length||m.some((v,g)=>v!==r(this,li)[g]);f(this,li,m),u&&this.dispatchEvent(new CustomEvent("cm-overflow-change",{detail:{hidden:[...m]},bubbles:!0,composed:!0})),r(this,ir)&&this.updateComplete.then(()=>s(this,V,Mm).call(this))},Mg=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}},Uc=new WeakMap,Mm=function(){if(!r(this,ir))return;f(this,ir,!1);let e=document.activeElement,t=s(this,V,Fc).call(this);(!e||e===document.body||e===document.documentElement||e===this&&(!t||t.hidden||this.shadowRoot.activeElement!==t))&&(t&&!t.hidden?s(this,V,Tm).call(this):s(this,V,zm).call(this))},Tm=function(){s(this,V,Fc).call(this)?.shadowRoot?.querySelector('[part="trigger"]')?.focus()},zm=function(){let e=s(this,V,lo).call(this).filter(i=>!i.hidden&&!i.hasAttribute("disabled")),t=e[e.length-1];(t?.shadowRoot?.querySelector('[part="control"]')??t)?.focus()},da.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}},da.styles=[E,x`
|
|
208
210
|
:host { display: block; min-inline-size: 0; }
|
|
209
211
|
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); min-inline-size: 0; }
|
|
210
212
|
:host([align='end']) .row { justify-content: flex-end; }
|
|
@@ -228,7 +230,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
228
230
|
.more::part(trigger), .more.slim::part(trigger) { min-height: var(--cm-control-height-lg, 40px); }
|
|
229
231
|
.more.icon::part(trigger), .more.icon.slim::part(trigger) { width: var(--cm-control-height-lg, 40px); }
|
|
230
232
|
}
|
|
231
|
-
`];$("cm-button-group",
|
|
233
|
+
`];$("cm-button-group",da);var ht={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ha=o=>(...n)=>({_$litDirective$:o,values:n}),di=class{constructor(n){}get _$AU(){return this._$AM._$AU}_$AT(n,e,t){this._$Ct=n,this._$AM=e,this._$Ci=t}_$AS(n,e){return this.update(n,e)}update(n,e){return this.render(...e)}};var{I:uy}=ug,Tg=o=>o;var _g=o=>o.strings===void 0,zg=()=>document.createComment(""),ma=(o,n,e)=>{let t=o._$AA.parentNode,i=n===void 0?o._$AB:n._$AA;if(e===void 0){let a=t.insertBefore(zg(),i),l=t.insertBefore(zg(),i);e=new uy(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=Tg(m).nextSibling;Tg(t).insertBefore(m,i),m=u}}}return e},hi=(o,n,e=o)=>(o._$AI(n,e),o),gy={},Vc=(o,n=gy)=>o._$AH=n,Cg=o=>o._$AH,Kc=o=>{o._$AR(),o._$AA.remove()};var ne=ha(class extends di{constructor(o){if(super(o),o.type!==ht.PROPERTY&&o.type!==ht.ATTRIBUTE&&o.type!==ht.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!_g(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===ht.PROPERTY){if(n===e[t])return we}else if(o.type===ht.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return we}else if(o.type===ht.ATTRIBUTE&&e.getAttribute(t)===n+"")return we;return Vc(o),n}});var Je=x`
|
|
232
234
|
:host {
|
|
233
235
|
--_cm-field-h: var(--cm-control-height-lg, 40px);
|
|
234
236
|
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
@@ -252,7 +254,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
252
254
|
.error { color: var(--cm-text-critical); }
|
|
253
255
|
:host([size='small']) .field { gap: var(--cm-space-4); }
|
|
254
256
|
:host([size='small']) .label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); }
|
|
255
|
-
`,
|
|
257
|
+
`,Wc=x`
|
|
256
258
|
[role='listbox'] {
|
|
257
259
|
max-height: 264px; overflow-y: auto; margin: 0; padding: var(--cm-space-4); list-style: none;
|
|
258
260
|
}
|
|
@@ -264,22 +266,22 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
264
266
|
[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%); }
|
|
265
267
|
:host([size='small']) [role='option'] { min-height: var(--cm-control-height-sm, 32px); }
|
|
266
268
|
@media (pointer: coarse) { [role='option'], :host([size='small']) [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
267
|
-
`;var
|
|
269
|
+
`;var kw=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."}),ke,Nt,ho,oe,co,Gc,Sg,_m,Lg,Cm,mi=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,ke,this.attachInternals());p(this,Nt,R("cm-tf"));p(this,ho,"")}connectedCallback(){super.connectedCallback(),f(this,ho,this.value)}get form(){return r(this,ke).form}get validity(){return r(this,ke).validity}get validationMessage(){return r(this,ke).validationMessage}checkValidity(){return s(this,oe,co).call(this),r(this,ke).checkValidity()}reportValidity(){return s(this,oe,co).call(this),r(this,ke).reportValidity()}formResetCallback(){this.value=r(this,ho),this.error=""}formDisabledCallback(e){this.disabled=e}updated(){r(this,ke).setFormValue(this.value),s(this,oe,co).call(this)}render(){let e=[this.error&&`${r(this,Nt)}-err`,this.helpText&&`${r(this,Nt)}-help`].filter(Boolean).join(" ")||h,t={id:r(this,Nt),invalid:this.error?"true":h},i=this.multiline?c`<textarea class="input" part="input" id=${t.id} rows=${this.rows}
|
|
268
270
|
.value=${ne(this.value)} placeholder=${this.placeholder||h}
|
|
269
271
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
270
272
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
271
|
-
@input=${s(this,oe,
|
|
273
|
+
@input=${s(this,oe,_m)} @change=${s(this,oe,Cm)}></textarea>`:c`<input class="input" part="input" id=${t.id} type=${this.type}
|
|
272
274
|
.value=${ne(this.value)} placeholder=${this.placeholder||h}
|
|
273
275
|
autocomplete=${this.autocomplete??h}
|
|
274
276
|
min=${this.min||h} max=${this.max||h} step=${this.step||h}
|
|
275
277
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
276
278
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
277
|
-
@input=${s(this,oe,
|
|
278
|
-
${this.label?c`<label class="label" for=${r(this,
|
|
279
|
+
@input=${s(this,oe,_m)} @change=${s(this,oe,Cm)} @blur=${s(this,oe,Lg)} />`;return c`<div class="field">
|
|
280
|
+
${this.label?c`<label class="label" for=${r(this,Nt)} 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}
|
|
279
281
|
${i}
|
|
280
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
281
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
282
|
-
</div>`}}
|
|
282
|
+
${this.error?c`<p class="error" id="${r(this,Nt)}-err" role="alert">${this.error}</p>`:h}
|
|
283
|
+
${this.helpText?c`<p class="help" id="${r(this,Nt)}-help">${this.helpText}</p>`:h}
|
|
284
|
+
</div>`}};ke=new WeakMap,Nt=new WeakMap,ho=new WeakMap,oe=new WeakSet,co=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,ke).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,ke).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.required&&!this.value?r(this,ke).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,ke).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:s(this,oe,Gc).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,ke).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:s(this,oe,Gc).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,ke).setValidity({stepMismatch:!0},this.t("stepMismatch",s(this,oe,Sg).call(this,e)),e??void 0):r(this,ke).setValidity({})},Gc=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)},Sg=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,Gc).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)}},_m=function(e){this.value=e.target.value},Lg=function(){s(this,oe,co).call(this)},Cm=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},mi.formAssociated=!0,mi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},mi.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:{}},mi.styles=[E,Je,x`
|
|
283
285
|
:host { display: block; }
|
|
284
286
|
.input {
|
|
285
287
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -295,13 +297,13 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
295
297
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
296
298
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
297
299
|
:host([error]:not([error=''])) .input { border-color: var(--cm-border-critical); }
|
|
298
|
-
`];$("cm-text-field",
|
|
299
|
-
<input type="checkbox" id=${r(this,
|
|
300
|
+
`];$("cm-text-field",mi);var Cw=z("checkbox",{required:"Please tick this box."}),ui,rr,mo,Yc,Dg,pi=class extends T{constructor(){super(...arguments);p(this,Yc);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;p(this,ui,this.attachInternals());p(this,rr,R("cm-cb"));p(this,mo,!1)}connectedCallback(){super.connectedCallback(),f(this,mo,this.checked)}get form(){return r(this,ui).form}checkValidity(){return r(this,ui).checkValidity()}formResetCallback(){this.checked=r(this,mo)}formDisabledCallback(e){this.disabled=e}updated(){r(this,ui).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,ui).setValidity({valueMissing:!0},this.t("required")):r(this,ui).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,rr)}>
|
|
301
|
+
<input type="checkbox" id=${r(this,rr)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
300
302
|
?disabled=${this.disabled} ?required=${this.required}
|
|
301
|
-
aria-describedby=${this.description?`${r(this,
|
|
303
|
+
aria-describedby=${this.description?`${r(this,rr)}-d`:h} @change=${s(this,Yc,Dg)} />
|
|
302
304
|
<span class="box" part="box">${e}</span>
|
|
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,
|
|
304
|
-
</label>`}};
|
|
305
|
+
${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,rr)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
306
|
+
</label>`}};ui=new WeakMap,rr=new WeakMap,mo=new WeakMap,Yc=new WeakSet,Dg=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},pi.formAssociated=!0,pi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},pi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},pi.styles=[E,x`
|
|
305
307
|
:host { display: inline-flex; }
|
|
306
308
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
307
309
|
/* The 16px box (18px on touch screens, owner standard 1.6) sits centred on the label's first line (20px); the
|
|
@@ -324,12 +326,12 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
324
326
|
:host([disabled]) label { cursor: not-allowed; }
|
|
325
327
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
326
328
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
327
|
-
`];$("cm-checkbox",
|
|
329
|
+
`];$("cm-checkbox",pi);var po,sr=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,po,R("cm-radio"))}render(){let e=this.description?`${r(this,po)}-d`:null;return c`<div class="radio" part="radio" role="radio" id=${r(this,po)}
|
|
328
330
|
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":h}
|
|
329
331
|
aria-describedby=${e??h} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
330
332
|
<span class="dot" part="dot"></span>
|
|
331
333
|
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?c`<span class="desc" id=${e}>${this.description}</span>`:h}</span>
|
|
332
|
-
</div>`}};
|
|
334
|
+
</div>`}};po=new WeakMap,sr.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},sr.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}},sr.styles=[E,x`
|
|
333
335
|
:host { display: inline-flex; }
|
|
334
336
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; outline: none; }
|
|
335
337
|
.dot {
|
|
@@ -351,16 +353,16 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
351
353
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
352
354
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
353
355
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
354
|
-
`];$("cm-radio",
|
|
355
|
-
aria-labelledby=${s(this,se,
|
|
356
|
+
`];$("cm-radio",sr);var Hw=z("radioGroup",{required:"Please select one of these options."}),Ze,It,uo,go,fo,pa,se,Sm,Jc,ar,Lm,ua,Dm,Zc,Qc,Xc,nr=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,Ze,this.attachInternals());p(this,It,R("cm-rg"));p(this,uo,"");p(this,go,!0);p(this,fo,!1);p(this,pa,!1);p(this,Jc,()=>{s(this,se,Sm).call(this),r(this,ua).call(this)});p(this,ua,()=>{let e=s(this,se,ar).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,Lm).call(this)[0];for(let a of e)a._tabbable=a===i&&!this.disabled});p(this,Zc,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||s(this,se,Dm).call(this,t,!0)});p(this,Qc,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let i=s(this,se,Lm).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,Dm).call(this,d,!0)});this.addEventListener("keydown",r(this,Qc)),this.addEventListener("click",r(this,Zc))}connectedCallback(){super.connectedCallback(),s(this,se,Sm).call(this)}get form(){return r(this,Ze).form}get validity(){return r(this,Ze).validity}get validationMessage(){return r(this,Ze).validationMessage}checkValidity(){return r(this,Ze).checkValidity()}reportValidity(){return r(this,Ze).reportValidity()}formResetCallback(){this.value=r(this,uo)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(s(this,se,ar).call(this).find(t=>t._tabbable)??s(this,se,ar).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,fo)&&!r(this,pa)&&f(this,go,!1),f(this,fo,!0),r(this,ua).call(this),r(this,Ze).setFormValue(this.value||null,this.value);let t=s(this,se,ar).call(this)[0];this.error?r(this,Ze).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Ze).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ze).setValidity({})}render(){let e=[this.error&&`${r(this,It)}-err`,this.helpText&&`${r(this,It)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
357
|
+
aria-labelledby=${s(this,se,Xc).call(this)?`${r(this,It)}-l`:h} aria-label=${s(this,se,Xc).call(this)?h:this.getAttribute("aria-label")??h}
|
|
356
358
|
aria-describedby=${e||h}
|
|
357
359
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
358
360
|
aria-disabled=${this.disabled?"true":h}>
|
|
359
|
-
<span class="label" id="${r(this,
|
|
360
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
361
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
362
|
-
<div class="options" part="options"><slot @slotchange=${r(this,
|
|
363
|
-
</div>`}};
|
|
361
|
+
<span class="label" id="${r(this,It)}-l" part="label" ?hidden=${!s(this,se,Xc).call(this)}>${this.label}<slot name="label"></slot>${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
362
|
+
${this.helpText?c`<p class="help" id="${r(this,It)}-help">${this.helpText}</p>`:h}
|
|
363
|
+
${this.error?c`<p class="error" id="${r(this,It)}-err" role="alert">${this.error}</p>`:h}
|
|
364
|
+
<div class="options" part="options"><slot @slotchange=${r(this,Jc)}></slot></div>
|
|
365
|
+
</div>`}};Ze=new WeakMap,It=new WeakMap,uo=new WeakMap,go=new WeakMap,fo=new WeakMap,pa=new WeakMap,se=new WeakSet,Sm=function(){r(this,go)&&(this.value||(f(this,pa,!0),this.value=s(this,se,ar).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>f(this,pa,!1))),f(this,uo,this.value))},Jc=new WeakMap,ar=function(){return[...this.querySelectorAll("cm-radio")]},Lm=function(){return s(this,se,ar).call(this).filter(e=>!e.disabled&&!this.disabled)},ua=new WeakMap,Dm=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,r(this,ua).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Zc=new WeakMap,Qc=new WeakMap,Xc=function(){return!!this.label||!!this.querySelector("[slot=label]")},nr.formAssociated=!0,nr.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}},nr.styles=[E,x`
|
|
364
366
|
:host { display: block; }
|
|
365
367
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
366
368
|
.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); }
|
|
@@ -369,13 +371,13 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
369
371
|
.error { color: var(--cm-text-critical); }
|
|
370
372
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
371
373
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
372
|
-
`];$("cm-radio-group",
|
|
373
|
-
<input type="checkbox" role="switch" id=${r(this,
|
|
374
|
+
`];$("cm-radio-group",nr);var ga,or,bo,ed,Ag,gi=class extends S{constructor(){super(...arguments);p(this,ed);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;p(this,ga,this.attachInternals());p(this,or,R("cm-tg"));p(this,bo,!1)}connectedCallback(){super.connectedCallback(),f(this,bo,this.checked)}get form(){return r(this,ga).form}checkValidity(){return r(this,ga).checkValidity()}formResetCallback(){this.checked=r(this,bo)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,ga).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${r(this,or)}>
|
|
375
|
+
<input type="checkbox" role="switch" id=${r(this,or)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
374
376
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
375
|
-
aria-describedby=${this.description?`${r(this,
|
|
377
|
+
aria-describedby=${this.description?`${r(this,or)}-d`:h} @change=${s(this,ed,Ag)} />
|
|
376
378
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
377
|
-
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,
|
|
378
|
-
</label>`}};
|
|
379
|
+
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,or)}-d">${this.description}</span>`:h}</span>`:h}
|
|
380
|
+
</label>`}};ga=new WeakMap,or=new WeakMap,bo=new WeakMap,ed=new WeakSet,Ag=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},gi.formAssociated=!0,gi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},gi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},gi.styles=[E,x`
|
|
379
381
|
:host { display: inline-flex; }
|
|
380
382
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
381
383
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -403,7 +405,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
403
405
|
:host([disabled]) .track { opacity: .5; }
|
|
404
406
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
405
407
|
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
406
|
-
`];$("cm-toggle",
|
|
408
|
+
`];$("cm-toggle",gi);var fa=x`
|
|
407
409
|
.pop {
|
|
408
410
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-4)); inset-inline: 0;
|
|
409
411
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -415,7 +417,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
415
417
|
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
416
418
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
417
419
|
}
|
|
418
|
-
`;function
|
|
420
|
+
`;function td(o,n,e){let t=i=>{n()&&!i.composedPath().includes(o)&&e()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)}var fi=x`
|
|
419
421
|
[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); }
|
|
420
422
|
[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); }
|
|
421
423
|
.gh {
|
|
@@ -424,7 +426,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
424
426
|
}
|
|
425
427
|
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
426
428
|
.gopts { list-style: none; margin: 0; padding: 0; }
|
|
427
|
-
`;function
|
|
429
|
+
`;function ba(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 id(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 rd=x`
|
|
428
430
|
[role='listbox'] { padding-block: var(--cm-space-4); }
|
|
429
431
|
[role='listbox'][hidden] { display: none; }
|
|
430
432
|
[role='option'] {
|
|
@@ -443,12 +445,12 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
443
445
|
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;
|
|
444
446
|
color: var(--cm-text-tertiary); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-xs);
|
|
445
447
|
}
|
|
446
|
-
`;function
|
|
448
|
+
`;function ad(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 sd(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 nd(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"}
|
|
447
449
|
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"}
|
|
448
|
-
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function
|
|
450
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function od(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var Xw=z("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),Qe,ue,ya,mt,xa,yo,F,Am,cr,Rm,vo,va,lr,bi,ld,cd,xo,dd,Rg,hd,vi=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,Qe,this.attachInternals());p(this,ue,R("cm-sel"));p(this,ya,"");p(this,mt,"");p(this,xa,0);p(this,yo,new MutationObserver(()=>s(this,F,Am).call(this)));p(this,cr,new $e);p(this,cd,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),s(this,F,vo).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),s(this,F,vo).call(this),s(this,F,bi).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,F,ld).call(this,t);s(this,F,vo).call(this,i>=0?i:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?s(this,F,lr).call(this,this._active):s(this,F,bi).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?s(this,F,lr).call(this,this._active):s(this,F,bi).call(this,-1);break;case"Home":e.preventDefault(),s(this,F,bi).call(this,"first");break;case"End":e.preventDefault(),s(this,F,bi).call(this,"last");break;case"PageDown":e.preventDefault(),s(this,F,bi).call(this,10);break;case"PageUp":e.preventDefault(),s(this,F,bi).call(this,-10);break;case"Enter":e.preventDefault(),s(this,F,lr).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),s(this,F,va).call(this);break;case"Tab":s(this,F,lr).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,mt)&&Date.now()-r(this,xa)<500){let i=s(this,F,ld).call(this," ");i>=0&&(this._active=i)}else s(this,F,lr).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,F,ld).call(this,t);i>=0&&(this._active=i)}}});p(this,xo,e=>{this.open&&!e.composedPath().includes(this)&&s(this,F,va).call(this)});p(this,dd,()=>{this.disabled||(this.open?s(this,F,va).call(this):s(this,F,vo).call(this))});p(this,hd,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),s(this,F,Am).call(this),r(this,yo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,xo),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,cr).close(),r(this,yo).disconnect(),document.removeEventListener("pointerdown",r(this,xo),!0)}get form(){return r(this,Qe).form}get validity(){return r(this,Qe).validity}get validationMessage(){return r(this,Qe).validationMessage}checkValidity(){return r(this,Qe).checkValidity()}reportValidity(){return r(this,Qe).reportValidity()}formResetCallback(){this.value=r(this,ya),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?ba(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):ba(this._slotted)}firstUpdated(){r(this,ya)||f(this,ya,this.value)}updated(e){r(this,Qe).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,Qe).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Qe).setValidity({valueMissing:!0},this.t("required"),t):r(this,Qe).setValidity({}),e.has("open")?this.open?r(this,cr).open(this.renderRoot.querySelector("[role=listbox]"),this.renderRoot.querySelector(".box"),{align:"stretch"}):r(this,cr).close():this.open&&e.has("items")&&r(this,cr).place(),(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":""}
|
|
449
451
|
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":h}
|
|
450
|
-
@pointerenter=${()=>!d.disabled&&(this._active=m)} @click=${()=>s(this,F,
|
|
451
|
-
${this.label?c`<span class="label" id="${r(this,ue)}-l" part="label" @click=${r(this,
|
|
452
|
+
@pointerenter=${()=>!d.disabled&&(this._active=m)} @click=${()=>s(this,F,lr).call(this,m)}>${d.label}</li>`;return c`<div class="field">
|
|
453
|
+
${this.label?c`<span class="label" id="${r(this,ue)}-l" part="label" @click=${r(this,hd)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
452
454
|
<div class="wrap">
|
|
453
455
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
454
456
|
aria-labelledby=${this.label?`${r(this,ue)}-l`:h}
|
|
@@ -457,21 +459,21 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
457
459
|
aria-activedescendant=${this.open&&this._active>=0?`${r(this,ue)}-o${this._active}`:h}
|
|
458
460
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
459
461
|
aria-disabled=${this.disabled?"true":h} aria-describedby=${i||h} aria-busy=${this.loading?"true":h}
|
|
460
|
-
@click=${r(this,
|
|
461
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,ue)}-v">${t?s(this,F,
|
|
462
|
+
@click=${r(this,dd)} @keydown=${r(this,cd)} @blur=${()=>s(this,F,va).call(this)}>
|
|
463
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,ue)}-v">${t?s(this,F,Rg).call(this,t):this.placeholder}</span>
|
|
462
464
|
${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>`}
|
|
463
465
|
</div>
|
|
464
466
|
<ul role="listbox" id="${r(this,ue)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,ue)}-l`:h}
|
|
465
467
|
aria-label=${!this.label&&a?a:h} ?hidden=${!this.open}
|
|
466
468
|
@pointerdown=${d=>d.preventDefault()}>
|
|
467
|
-
${
|
|
469
|
+
${id(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>
|
|
468
470
|
<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)))}
|
|
469
471
|
</ul>
|
|
470
472
|
</div>
|
|
471
473
|
${this.error?c`<p class="error" id="${r(this,ue)}-err" role="alert">${this.error}</p>`:h}
|
|
472
474
|
${this.helpText?c`<p class="help" id="${r(this,ue)}-help">${this.helpText}</p>`:h}
|
|
473
475
|
<slot></slot>
|
|
474
|
-
</div>`}};
|
|
476
|
+
</div>`}};Qe=new WeakMap,ue=new WeakMap,ya=new WeakMap,mt=new WeakMap,xa=new WeakMap,yo=new WeakMap,F=new WeakSet,Am=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",f(this,ya,this.value))},cr=new WeakMap,Rm=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},vo=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,Rm).call(this)[0]??-1)},va=function(){this.open=!1},lr=function(e){let t=this.items[e];!t||t.disabled||(s(this,F,va).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}))))},bi=function(e){let t=s(this,F,Rm).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))]},ld=function(e){let t=Date.now();f(this,mt,t-r(this,xa)>500?e:r(this,mt)+e),f(this,xa,t);let i=this.items,a=this._active<0?0:this._active,l=r(this,mt).split("").every(u=>u===r(this,mt)[0]),d=l?r(this,mt)[0]:r(this,mt),m=l||r(this,mt).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},cd=new WeakMap,xo=new WeakMap,dd=new WeakMap,Rg=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},hd=new WeakMap,vi.formAssociated=!0,vi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},vi.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}},vi.styles=[E,Xe,Je,Wc,fi,x`
|
|
475
477
|
:host { display: block; position: relative; }
|
|
476
478
|
.label { cursor: default; }
|
|
477
479
|
.wrap { position: relative; }
|
|
@@ -504,16 +506,16 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
504
506
|
[role='group'] { display: block; }
|
|
505
507
|
slot { display: none; }
|
|
506
508
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
507
|
-
`];$("cm-select",
|
|
509
|
+
`];$("cm-select",vi);var a0=z("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),$a,md,wo,ze,wa,Hg,Ng,Hm,yi=class extends T{constructor(){super(...arguments);p(this,ze);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;p(this,$a,this.attachInternals());p(this,md,R("cm-search"));p(this,wo,"")}connectedCallback(){super.connectedCallback(),f(this,wo,this.value)}get form(){return r(this,$a).form}checkValidity(){return r(this,$a).checkValidity()}formResetCallback(){this.value=r(this,wo)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,$a).setFormValue(this.value)}render(){return c`<div class="box" part="box">
|
|
508
510
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
509
|
-
<input id=${r(this,
|
|
511
|
+
<input id=${r(this,md)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
510
512
|
aria-label=${this.label} .value=${ne(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
511
|
-
@input=${s(this,
|
|
512
|
-
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,
|
|
513
|
+
@input=${s(this,ze,Hg)} @change=${()=>s(this,ze,wa).call(this,"change")} @keydown=${s(this,ze,Ng)} />
|
|
514
|
+
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,ze,Hm)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
513
515
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
514
516
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
515
|
-
@click=${()=>s(this,
|
|
516
|
-
</div>`}}
|
|
517
|
+
@click=${()=>s(this,ze,wa).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}
|
|
518
|
+
</div>`}};$a=new WeakMap,md=new WeakMap,wo=new WeakMap,ze=new WeakSet,wa=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Hg=function(e){this.value=e.target.value},Ng=function(e){e.key==="Enter"?s(this,ze,wa).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),s(this,ze,Hm).call(this))},Hm=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),s(this,ze,wa).call(this,"input"),s(this,ze,wa).call(this,"change")},yi.formAssociated=!0,yi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},yi.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}},yi.styles=[E,Je,x`
|
|
517
519
|
:host { display: block; }
|
|
518
520
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
519
521
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -547,7 +549,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
547
549
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
548
550
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
549
551
|
:host([disabled]) button { cursor: not-allowed; }
|
|
550
|
-
`];$("cm-search",
|
|
552
|
+
`];$("cm-search",yi);var d0=z("tag",{remove:"Remove {label}"}),pd,Ig,dr=class extends T{constructor(){super(...arguments);p(this,pd);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||this.t("remove",{label:this.textContent?.trim()??""}).trim();return c`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?c`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${s(this,pd,Ig)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};pd=new WeakSet,Ig=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},dr.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},dr.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},dr.styles=[E,x`
|
|
551
553
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
552
554
|
.tag {
|
|
553
555
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -565,17 +567,17 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
565
567
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
566
568
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
|
|
567
569
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
|
|
568
|
-
`];$("cm-tag",
|
|
569
|
-
`):[]:this.value=e)}get items(){return this.options?.length?
|
|
570
|
-
`))}else r(this,
|
|
570
|
+
`];$("cm-tag",dr);var x0=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"}),Re,ge,Mo,Ma,To,zo,_o,D,Nm,Pg,$o,ud,ko,Ot,ka,Ea,Pt,Og,Eo,Im,Pm,hr,gd,fd,mr,qg,bd,vd,yd,Bg,Fg,xi=class extends T{constructor(){super(...arguments);p(this,D);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.size="default";this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.maxTags=3;this._query="";this._focusIn=!1;this._active=-1;this._slotted=[];this._typing=!1;p(this,Re,this.attachInternals());p(this,ge,R("cm-cb"));p(this,Mo,null);p(this,Ma,new Map);p(this,To,new Map);p(this,zo,new MutationObserver(()=>s(this,D,Nm).call(this)));p(this,_o);p(this,Ot,new $e);p(this,gd,()=>{this._focusIn=!0});p(this,fd,()=>{setTimeout(()=>{this._focusIn=this.matches(":focus-within")})});p(this,bd,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,s(this,D,Ea).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});p(this,vd,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?s(this,D,Eo).call(this,1):(s(this,D,Ea).call(this),e.altKey||s(this,D,Eo).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?s(this,D,Eo).call(this,-1):(s(this,D,Ea).call(this),s(this,D,Eo).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),s(this,D,Im).call(this,this._active)):r(this,D,ud)&&(e.preventDefault(),s(this,D,Pm).call(this,r(this,D,ud)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),s(this,D,Pt).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",s(this,D,ka).call(this)));break;case"ArrowLeft":case"ArrowRight":{let i=e.target;this.multiple&&this.values.length&&J(e,this)==="ArrowLeft"&&i.selectionStart===0&&i.selectionEnd===0&&(e.preventDefault(),s(this,D,Pt).call(this),s(this,D,mr).call(this,this.values.length-1));break}case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":s(this,D,Pt).call(this);break;default:}});p(this,yd,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(s(this,D,Pt).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?s(this,D,$o).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),s(this,D,Nm).call(this),r(this,zo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),f(this,_o,td(this,()=>this.open,()=>s(this,D,Pt).call(this))),this.addEventListener("focusin",r(this,gd)),this.addEventListener("focusout",r(this,fd))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,Ot).close(),r(this,zo).disconnect(),(e=r(this,_o))==null||e.call(this)}get form(){return r(this,Re).form}get validity(){return r(this,Re).validity}get validationMessage(){return r(this,Re).validationMessage}checkValidity(){return r(this,Re).checkValidity()}reportValidity(){return r(this,Re).reportValidity()}formResetCallback(){let e=r(this,Mo)??{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(`
|
|
571
|
+
`):[]:this.value=e)}get items(){return this.options?.length?ba(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):ba(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let i=t.label.toLowerCase();return this.filter==="starts-with"?i.startsWith(e):i.includes(e)})}firstUpdated(){f(this,Mo,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,Ma).set(t.value,t.label),t.group&&r(this,To).set(t.value,t.group);if((e.has("value")||e.has("options")||e.has("_slotted")||e.has("showGroup"))&&!this.multiple&&!this._typing&&(this._query=this.value?s(this,D,$o).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=s(this,D,ko).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.open;t&&!r(this,Ot).active?r(this,Ot).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,Ot).active?r(this,Ot).close():t&&r(this,Ot).place();let i=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let l=new FormData;for(let d of this.values)l.append(this.name,d);r(this,Re).setFormValue(l,this.values.join(`
|
|
572
|
+
`))}else r(this,Re).setFormValue(null);else r(this,Re).setFormValue(this.value||null,this.value);let a=this.multiple?!this.values.length:!this.value;this.error?r(this,Re).setValidity({customError:!0},this.error,i):this.required&&a?r(this,Re).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),i):r(this,Re).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,D,ka).call(this))}focus(e){this.renderRoot.querySelector("input")?.focus(e)}render(){let e=s(this,D,ko).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":""}
|
|
571
573
|
aria-selected=${m.create?"false":a(m.value)?"true":"false"} aria-disabled=${m.disabled?"true":h}
|
|
572
|
-
@pointerenter=${()=>!m.disabled&&(this._active=u)} @click=${()=>s(this,D,
|
|
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,D,
|
|
574
|
+
@pointerenter=${()=>!m.disabled&&(this._active=u)} @click=${()=>s(this,D,Im).call(this,u)}>
|
|
575
|
+
${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,D,Bg).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">
|
|
574
576
|
${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}
|
|
575
577
|
<div class="wrap">
|
|
576
|
-
<div class="box" part="box" @click=${m=>{m.target.closest("cm-tag[removable]")||s(this,D,
|
|
578
|
+
<div class="box" part="box" @click=${m=>{m.target.closest("cm-tag[removable]")||s(this,D,hr).call(this)}}>
|
|
577
579
|
<div class="chips ${this.multiple&&this.values.length?`has-tags${this._focusIn||this.open?"":" idle"}`:""}">
|
|
578
|
-
${this.multiple?s(this,D,
|
|
580
|
+
${this.multiple?s(this,D,Fg).call(this):h}
|
|
579
581
|
<input id="${r(this,ge)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
580
582
|
.value=${ne(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
581
583
|
aria-label=${!this.label&&i?i:h}
|
|
@@ -583,16 +585,16 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
583
585
|
aria-activedescendant=${this.open&&this._active>=0?`${r(this,ge)}-o${this._active}`:h}
|
|
584
586
|
aria-invalid=${this.error?"true":h} aria-describedby=${t||h}
|
|
585
587
|
aria-required=${this.required?"true":h} ?disabled=${this.disabled}
|
|
586
|
-
@input=${r(this,
|
|
587
|
-
@click=${()=>{this.open||s(this,D,
|
|
588
|
+
@input=${r(this,bd)} @keydown=${r(this,vd)} @blur=${r(this,yd)}
|
|
589
|
+
@click=${()=>{this.open||s(this,D,Ea).call(this)}} @change=${m=>m.stopPropagation()} />
|
|
588
590
|
</div>
|
|
589
|
-
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,D,
|
|
591
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,D,Pt).call(this):(s(this,D,Ea).call(this),s(this,D,hr).call(this))}}></cm-icon>
|
|
590
592
|
</div>
|
|
591
593
|
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${m=>m.preventDefault()}>
|
|
592
594
|
<ul role="listbox" id="${r(this,ge)}-list" part="listbox" ?hidden=${!e.length}
|
|
593
595
|
aria-labelledby=${this.label?`${r(this,ge)}-l`:h} aria-label=${!this.label&&i?i:h}
|
|
594
596
|
aria-multiselectable=${this.multiple?"true":h}>
|
|
595
|
-
${
|
|
597
|
+
${id(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
598
|
<ul role="none" class="gopts">${m.rows.map(({row:v,index:g})=>l(v,g))}</ul></li>`:m.rows.map(({row:v,index:g})=>l(v,g)))}
|
|
597
599
|
</ul>
|
|
598
600
|
${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>`}
|
|
@@ -602,10 +604,10 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
602
604
|
${this.error?c`<p class="error" id="${r(this,ge)}-err" role="alert">${this.error}</p>`:h}
|
|
603
605
|
${this.helpText?c`<p class="help" id="${r(this,ge)}-help">${this.helpText}</p>`:h}
|
|
604
606
|
<slot></slot>
|
|
605
|
-
</div>`}};
|
|
606
|
-
remove-label=${this.t("remove",{label:s(this,D
|
|
607
|
-
@keydown=${l=>s(this,D,
|
|
608
|
-
@cm-remove=${()=>{this.removeValue(i),s(this,D,
|
|
607
|
+
</div>`}};Re=new WeakMap,ge=new WeakMap,Mo=new WeakMap,Ma=new WeakMap,To=new WeakMap,zo=new WeakMap,_o=new WeakMap,D=new WeakSet,Nm=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])}},Pg=function(e){return this.items.find(t=>t.value===e)?.label??r(this,Ma).get(e)??e},$o=function(e){let t=s(this,D,Pg).call(this,e);if(!this.showGroup)return t;let i=this.items.find(a=>a.value===e)?.group??r(this,To).get(e);return i?this.t("grouped",{group:i,label:t}):t},ud=function(){if(!this.allowCustom||!this._typing)return"";let e=this._query.trim();if(!e)return"";let t=e.toLowerCase();return this.items.some(i=>i.label.toLowerCase()===t||i.value.toLowerCase()===t)||(this.multiple?this.values.some(i=>i.toLowerCase()===t):this.value.toLowerCase()===t)?"":e},ko=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,D,ud);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},Ot=new WeakMap,ka=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ea=function(){this.disabled||(this.open=!0)},Pt=function(){this.open=!1,this._active=-1},Og=function(e=s(this,D,ko).call(this)){return e.flatMap((t,i)=>t.disabled?[]:[i])},Eo=function(e){let t=s(this,D,Og).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]},Im=function(e){let t=s(this,D,ko).call(this)[e];if(!(!t||t.disabled)){if(t.create){s(this,D,Pm).call(this,t.value);return}if(this.multiple){this.values=this.values.includes(t.value)?this.values.filter(i=>i!==t.value):[...this.values,t.value],this._query="",this._typing=!1,this._active=-1,s(this,D,ka).call(this),s(this,D,hr).call(this);return}s(this,D,Pt).call(this),this._typing=!1,this._query=this.showGroup&&t.group?this.t("grouped",{group:t.group,label:t.label}):t.label,t.value!==this.value&&(this.value=t.value,s(this,D,ka).call(this))}},Pm=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,Ma).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(s(this,D,Pt).call(this),this.value=e,this._typing=!1,this._query=e),s(this,D,ka).call(this))},hr=function(){this.renderRoot.querySelector("input")?.focus()},gd=new WeakMap,fd=new WeakMap,mr=async function(e){await this.updateComplete;let t=this.renderRoot.querySelectorAll("cm-tag[data-i]");e>=0&&e<t.length?t[e].focus():s(this,D,hr).call(this)},qg=function(e,t){let i=J(e,this),a=this.values.length-1;if(i==="ArrowLeft")e.preventDefault(),s(this,D,mr).call(this,Math.max(0,t-1));else if(i==="ArrowRight")e.preventDefault(),s(this,D,mr).call(this,t<a?t+1:-1);else if(i==="Home")e.preventDefault(),s(this,D,mr).call(this,0);else if(i==="End")e.preventDefault(),s(this,D,mr).call(this,a);else if(i==="Escape")e.preventDefault(),e.stopPropagation(),s(this,D,hr).call(this);else if((i==="Backspace"||i==="Delete")&&!this.disabled){e.preventDefault(),this.removeValue(this.values[t]);let l=this.values.length;s(this,D,mr).call(this,i==="Backspace"?t>0?t-1:l?0:-1:t<l?t:-1)}},bd=new WeakMap,vd=new WeakMap,yd=new WeakMap,Bg=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)}`},Fg=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}
|
|
608
|
+
remove-label=${this.t("remove",{label:s(this,D,$o).call(this,i)})}
|
|
609
|
+
@keydown=${l=>s(this,D,qg).call(this,l,a)}
|
|
610
|
+
@cm-remove=${()=>{this.removeValue(i),s(this,D,hr).call(this)}}>${s(this,D,$o).call(this,i)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},xi.formAssociated=!0,xi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},xi.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}},xi.styles=[E,Je,Xe,fa,Wc,fi,x`
|
|
609
611
|
:host { display: block; position: relative; }
|
|
610
612
|
.wrap { position: relative; }
|
|
611
613
|
.box {
|
|
@@ -646,31 +648,31 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
646
648
|
.create { font-style: normal; }
|
|
647
649
|
slot { display: none; }
|
|
648
650
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
649
|
-
`];$("cm-combobox",
|
|
651
|
+
`];$("cm-combobox",xi);function Co(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var fy={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"};function xd(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:fy[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 Om(o,n=Co()){let e=xd(o,n);return!!e&&(e.ctrl||e.meta||e.alt)}function qm(o,n,e=Co()){let t=xd(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 wd(o){let n=o.composedPath()[0];return!!n&&(n.isContentEditable||/^(input|textarea|select)$/i.test(n.localName??""))}var by={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7"},vy={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},yy={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"},xy=o=>yy[o]??(o.length===1?o.toUpperCase():o[0].toUpperCase()+o.slice(1));function $d(o,n=Co()){let e=[];for(let t of o.trim().split(/\s+/).filter(Boolean)){let i=xd(t,n);if(!i)return[o.trim()];let a=n?by:vy,l=n?["ctrl","alt","shift","meta"]:["ctrl","meta","alt","shift"];for(let d of l)i[d]&&e.push(a[d]);e.push(xy(i.key))}return e}function jg(o,n=Co()){if(/\s/.test(o.trim()))return"";let e=xd(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 L0=z("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),et,Lo,G,kd,So,qt,Ta,Bm,Ed,Ug,Md,Do,Fm,Vg,pr=class extends T{constructor(){super(...arguments);p(this,G);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;p(this,et,R("cm-gs"));p(this,Lo);p(this,qt,new $e);p(this,Ed,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),s(this,G,Bm).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,G,Ug).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,G,So)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,et)}-o${this._active}`)?.click());break;case"Escape":r(this,G,So)?(e.preventDefault(),e.stopPropagation(),s(this,G,Ta).call(this)):this.value&&(e.preventDefault(),s(this,G,Fm).call(this,!1));break;case"Tab":s(this,G,Ta).call(this);break;default:}});p(this,Do,e=>{!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented||wd(e)||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),f(this,Lo,td(this,()=>this.open,()=>s(this,G,Ta).call(this))),document.addEventListener("keydown",r(this,Do))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,qt).close(),(e=r(this,Lo))==null||e.call(this),document.removeEventListener("keydown",r(this,Do))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=s(this,G,kd).call(this).length&&(this._active=-1)}updated(e){let t=r(this,G,So);t&&!r(this,qt).active?r(this,qt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,qt).active?r(this,qt).close():t&&r(this,qt).place(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,et)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=s(this,G,kd).call(this),t=r(this,G,So),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,g="")=>{let w=++l;return nd({id:`${r(this,et)}-o${w}`,active:w===this._active,href:u.href,cls:g,onHover:()=>this._active=w,onChoose:y=>s(this,G,Vg).call(this,y,u)},v)};return c`<div class="wrap">
|
|
650
652
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
651
653
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
652
654
|
|
|
653
|
-
<input id="${r(this,
|
|
655
|
+
<input id="${r(this,et)}-in" part="input" type="search" role="combobox" enterkeyhint="search" autocomplete="off" spellcheck="false"
|
|
654
656
|
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${ne(this.value)}
|
|
655
|
-
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
656
|
-
aria-activedescendant=${t&&this._active>=0?`${r(this,
|
|
657
|
+
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,et)}-list"
|
|
658
|
+
aria-activedescendant=${t&&this._active>=0?`${r(this,et)}-o${this._active}`:h}
|
|
657
659
|
aria-keyshortcuts=${this.shortcut||h}
|
|
658
|
-
@input=${r(this,
|
|
660
|
+
@input=${r(this,Ed)} @keydown=${r(this,Md)}
|
|
659
661
|
@focus=${()=>{this.value.trim()&&(this.open=!0)}} @click=${()=>{this.value.trim()&&(this.open=!0)}} />
|
|
660
|
-
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,
|
|
662
|
+
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,G,Fm).call(this)}><cm-icon name="close" size="14"></cm-icon></button>`:this.shortcut?c`<kbd aria-hidden="true">${this.shortcut}</kbd>`:h}
|
|
661
663
|
</div>
|
|
662
664
|
<div class="pop" part="popover" ?hidden=${!t} @pointerdown=${u=>u.preventDefault()}>
|
|
663
|
-
<div role="listbox" id="${r(this,
|
|
664
|
-
${d.map((u,v)=>{let g=u.total??u.items.length;return c`<div role="group" aria-labelledby="${r(this,
|
|
665
|
-
${
|
|
666
|
-
${u.items.map(w=>m({group:u,item:w,href:w.href},
|
|
665
|
+
<div role="listbox" id="${r(this,et)}-list" part="listbox" aria-label=${this.label} ?hidden=${!e.length}>
|
|
666
|
+
${d.map((u,v)=>{let g=u.total??u.items.length;return c`<div role="group" aria-labelledby="${r(this,et)}-g${v}">
|
|
667
|
+
${ad(`${r(this,et)}-g${v}`,u.label,this.formatNumber(g),this.t("results",{count:g}))}
|
|
668
|
+
${u.items.map(w=>m({group:u,item:w,href:w.href},sd(w)))}
|
|
667
669
|
${u.href?m({group:u,href:u.href},c`<span class="text">${u.seeAllLabel||this.seeAllLabel}</span>`,"all"):h}
|
|
668
670
|
</div>`})}
|
|
669
671
|
</div>
|
|
670
672
|
${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>`}
|
|
671
673
|
</div>
|
|
672
674
|
<span class="vh" role="status" aria-live="polite">${a}</span>
|
|
673
|
-
</div>`}};
|
|
675
|
+
</div>`}};et=new WeakMap,Lo=new WeakMap,G=new WeakSet,kd=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}]:[]])},So=function(){return this.open&&!!this.value.trim()},qt=new WeakMap,Ta=function(){this.open=!1,this._active=-1},Bm=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},Ed=new WeakMap,Ug=function(e){this._active=od(this._active,e,s(this,G,kd).call(this).length)},Md=new WeakMap,Do=new WeakMap,Fm=function(e=!0){this.value="",s(this,G,Ta).call(this),e&&this.renderRoot.querySelector("input")?.focus(),s(this,G,Bm).call(this)},Vg=function(e,t){this.dispatchEvent(new CustomEvent("cm-select",{detail:{href:t.href,item:t.item,group:t.group},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault(),s(this,G,Ta).call(this)},pr.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},pr.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}},pr.styles=[E,Xe,fa,fi,rd,x`
|
|
674
676
|
:host { display: block; position: relative; }
|
|
675
677
|
.wrap { position: relative; }
|
|
676
678
|
.box {
|
|
@@ -700,15 +702,15 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
700
702
|
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
701
703
|
}
|
|
702
704
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
703
|
-
`];$("cm-global-search",
|
|
705
|
+
`];$("cm-global-search",pr);var jm=0,Kg="";function Um(){jm++===0&&(Kg=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function Ao(){jm>0&&--jm===0&&(document.documentElement.style.overflow=Kg)}function Vm(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var za,Bt,_a,Ca,Td,zd,_d,Cd,Sd,Ld,ee=class extends T{constructor(){super(...arguments);p(this,Ca);this.open=!1;this.label="";this.uid=R("cm-ovl");p(this,za,null);p(this,Bt,!1);p(this,_a,!1);p(this,zd,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});p(this,_d,e=>{e.preventDefault(),this.requestClose("escape")});p(this,Cd,()=>{this.open&&!this.dialog?.open&&(this.open=!1,s(this,Ca,Td).call(this))});p(this,Sd,e=>{f(this,_a,e.target===e.currentTarget)});p(this,Ld,e=>{if(e.target===e.currentTarget&&r(this,_a)){let t=e.currentTarget.getBoundingClientRect();(!(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom)||this.backdropFillsDialog)&&this.requestClose("backdrop")}f(this,_a,!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,Ca,Td).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(f(this,za,Vm()),!this.isConnected)return;t.showModal(),r(this,Bt)||(Um(),f(this,Bt,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),s(this,Ca,Td).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,Bt)&&(Ao(),f(this,Bt,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
704
706
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
705
707
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
706
708
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
707
709
|
</header>`}renderDialog(e,t=""){return c`<dialog part="dialog" class=${t}
|
|
708
710
|
aria-labelledby=${this.heading?`${this.uid}-h`:h}
|
|
709
711
|
aria-label=${!this.heading&&this.label?this.label:h}
|
|
710
|
-
@keydown=${r(this,
|
|
711
|
-
@pointerdown=${r(this,
|
|
712
|
+
@keydown=${r(this,zd)} @cancel=${r(this,_d)} @close=${r(this,Cd)}
|
|
713
|
+
@pointerdown=${r(this,Sd)} @click=${r(this,Ld)}>${e}</dialog>`}};za=new WeakMap,Bt=new WeakMap,_a=new WeakMap,Ca=new WeakSet,Td=function(){r(this,Bt)&&(Ao(),f(this,Bt,!1));let e=r(this,za);f(this,za,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},zd=new WeakMap,_d=new WeakMap,Cd=new WeakMap,Sd=new WeakMap,Ld=new WeakMap,ee.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},ee.overlayStyles=[E,x`
|
|
712
714
|
:host { display: contents; }
|
|
713
715
|
dialog {
|
|
714
716
|
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
@@ -740,7 +742,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
740
742
|
|
|
741
743
|
}
|
|
742
744
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
743
|
-
`];var
|
|
745
|
+
`];var K0=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"}),Wg=o=>o.normalize("NFD").replace(/\p{M}/gu,"").toLocaleLowerCase();function Gg(o,n){let e=Wg(n).split(/\s+/).filter(Boolean);if(!e.length)return!0;let t=Wg([o.title,...o.keywords??[]].join(" "));return e.every(i=>t.includes(i))}var Ho,ve,Km,Wm,Ro,Dd,Ad,Yg,Xg,Sa=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,Ho,e=>{!this.shortcut||e.defaultPrevented||e.repeat||!qm(e,this.shortcut)||!this.open&&!Om(this.shortcut)&&wd(e)||this.open&&!Om(this.shortcut)||(e.preventDefault(),this.toggle())});p(this,Dd,e=>{this.value=e.target.value,this._active=s(this,ve,Ro).call(this).length?0:-1,this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))});p(this,Ad,e=>{let t=s(this,ve,Ro).call(this).length;switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this._active=od(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,Ho))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",r(this,Ho))}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,Ro).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,Wm).call(this):[],t=s(this,ve,Ro).call(this,e),i=r(this,ve,Km),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">
|
|
744
746
|
<div class="top">
|
|
745
747
|
<div class="box" part="box">
|
|
746
748
|
<cm-icon name="search" size="16"></cm-icon>
|
|
@@ -748,8 +750,8 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
748
750
|
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${ne(this.value)}
|
|
749
751
|
aria-autocomplete="list" aria-expanded=${t.length?"true":"false"} aria-controls="${d}-list"
|
|
750
752
|
aria-activedescendant=${this._active>=0&&t.length?`${d}-o${this._active}`:h}
|
|
751
|
-
@input=${r(this,
|
|
752
|
-
<kbd class="esc" aria-hidden="true">${
|
|
753
|
+
@input=${r(this,Dd)} @keydown=${r(this,Ad)} />
|
|
754
|
+
<kbd class="esc" aria-hidden="true">${$d("escape")[0]}</kbd>
|
|
753
755
|
</div>
|
|
754
756
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel} @click=${()=>this.requestClose("close-button")}>
|
|
755
757
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
@@ -758,14 +760,14 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
758
760
|
${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}
|
|
759
761
|
<div role="listbox" id="${d}-list" part="listbox" aria-label=${this.label} ?hidden=${!t.length}>
|
|
760
762
|
${e.map((u,v)=>c`<div role="group" aria-labelledby="${d}-g${v}">
|
|
761
|
-
${
|
|
762
|
-
${u.rows.map(g=>{let w=++m,y=g.item;return
|
|
763
|
+
${ad(`${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}))}
|
|
764
|
+
${u.rows.map(g=>{let w=++m,y=g.item;return nd({id:`${d}-o${w}`,active:w===this._active,href:g.href,cls:y?"":"all",keyshortcuts:y?.shortcut?jg(y.shortcut):void 0,onHover:()=>this._active=w,onChoose:k=>s(this,ve,Yg).call(this,k,g)},y?sd(y,s(this,ve,Xg).call(this,y.shortcut)):c`<span class="text">${g.group.seeAllLabel||this.seeAllLabel}</span>`)})}
|
|
763
765
|
</div>`)}
|
|
764
766
|
</div>
|
|
765
767
|
${i&&!this.loading&&!t.length?c`<p class="message" aria-hidden="true">${this.emptyText}</p>`:h}
|
|
766
768
|
</div>
|
|
767
769
|
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
768
|
-
</div>`)}};
|
|
770
|
+
</div>`)}};Ho=new WeakMap,ve=new WeakSet,Km=function(){return this.value.trim()},Wm=function(){let e=r(this,ve,Km),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=>Gg(l,e)):a.items);return t},Ro=function(e=s(this,ve,Wm).call(this)){return e.flatMap(t=>t.rows)},Dd=new WeakMap,Ad=new WeakMap,Yg=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)},Xg=function(e){return e?c`<span class="keys" aria-hidden="true">${$d(e).map(t=>c`<kbd>${t}</kbd>`)}</span>`:h},Sa.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}},Sa.styles=[...ee.overlayStyles,fa,fi,rd,x`
|
|
769
771
|
dialog {
|
|
770
772
|
position: fixed; inset: 0; margin: max(var(--cm-space-16), 12dvh) auto auto; height: fit-content;
|
|
771
773
|
width: min(var(--cm-command-palette-width, 640px), calc(100vw - 32px));
|
|
@@ -806,20 +808,20 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
806
808
|
.x { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
807
809
|
[role='option'] { min-height: var(--cm-control-height-touch); }
|
|
808
810
|
}
|
|
809
|
-
`];$("cm-command-palette",
|
|
811
|
+
`];$("cm-command-palette",Sa);var wy=/^(\d{4})-(\d{2})-(\d{2})$/;function N(o){let n=wy.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 $t=(o,n=2)=>String(o).padStart(n,"0"),P=o=>`${$t(o.getFullYear(),4)}-${$t(o.getMonth()+1)}-${$t(o.getDate())}`,Gm=()=>P(new Date),Y=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function tt(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 Ft=o=>new Date(o.getFullYear(),o.getMonth(),1),La=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var $y=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function ur(o){let n=$y.exec(o??"");return n?+n[1]*60+ +n[2]:null}var No=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${$t(Math.floor(n/60))}:${$t(n%60)}`};function it(o){let[n="",e=""]=(o??"").split("T"),t=ur(e);return{date:N(n)?n:"",time:t===null?"":No(t)}}function kt(o,n=!1){let{date:e,time:t}=it(o),i=N(e);if(!i)return null;let a=t?ur(t):n?1439:0;return new Date(i.getFullYear(),i.getMonth(),i.getDate(),Math.floor(a/60),a%60)}var Qg=()=>{let o=new Date;return`${P(o)}T${$t(o.getHours())}:${$t(o.getMinutes())}`},Jg=new Map;function Rd(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,i=Jg.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(L=>L.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),v=(k,L)=>[...new Set([k,...L].filter(Boolean))],g=k=>k.replace(/[\u202f\u00a0]/g," "),w=g(l.formatToParts(m(9)).map(k=>k.type==="hour"?"{h}":k.type==="minute"?"{m}":k.value).join("")),y={format:k=>g(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 Jg.set(t,y),y}var ef=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function Ym(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 No(d*60+m)}var Da={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},Io=o=>Array.isArray(o)?o:typeof o=="string"?Da.fromAttribute(o):[];function Aa(o,n){let e=[n,to(o)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function Ra(o){try{let n=new Intl.Locale(o),e=n.getWeekInfo?.()??n.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var Zg=new Map;function Ha(o){let n=Zg.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},(L,A)=>new Intl.DateTimeFormat(y,{month:k}).format(new Date(2024,A,1)).toLowerCase().replace(/\./g,"")),g=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(Y(l,k))),weekdaysLong:Array.from({length:7},(y,k)=>a.format(Y(l,k))),pattern:m.length===3?u:"{y}-{m}-{d}",order:m.length===3?m:["year","month","day"],months:g};return Zg.set(o,w),w}var Hd=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function Nd(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 g=v.findIndex(y=>y.length===4),w=g>=0?g:1;i=+v[w],l=+v[1-w],v[w].length<=2&&(i+=2e3)}else{if(t.some(g=>!/^\d+$/.test(g)))return null;let u=t[0].length===4?["year","month","day"]:n.order,v=g=>t[u.indexOf(g)];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=`${$t(i,4)}-${$t(a)}-${$t(l)}`;return N(m)?m:null}function Id(o,n,e,t){let i=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return Y(e,1);case"ArrowLeft":return Y(e,-1);case"ArrowDown":return Y(e,7);case"ArrowUp":return Y(e,-7);case"Home":return Y(e,-i);case"End":return Y(e,6-i);case"PageDown":return tt(e,n.shiftKey?12:1);case"PageUp":return tt(e,n.shiftKey?-12:-1);default:return null}}var wi=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function Pd(o){let{fmt:n,firstDay:e,month:t,focus:i,min:a,max:l}=o,d=Ft(t),m=(d.getDay()-e+7)%7,u=La(t).getDate(),v=[],g=Array(m).fill(null);for(let A=1;A<=u;A++)g.push(new Date(t.getFullYear(),t.getMonth(),A)),g.length===7&&(v.push(g),g=[]);g.length&&v.push([...g,...Array(7-g.length).fill(null)]);let w=Array.from({length:7},(A,O)=>(O+e)%7),y=Gm(),k=!!a&&La(tt(d,-1))<a,L=!!l&&tt(d,1)>l;return c`<div class="cal-head">
|
|
810
812
|
<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>
|
|
811
813
|
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
812
814
|
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${L} @click=${()=>o.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
813
815
|
</div>
|
|
814
816
|
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${o.id}-month" @keydown=${o.onKey}>
|
|
815
|
-
<thead><tr>${w.map(
|
|
816
|
-
<tbody>${v.map(
|
|
817
|
-
tabindex=${
|
|
818
|
-
aria-selected=${
|
|
819
|
-
aria-current=${
|
|
820
|
-
aria-label="${n.long(
|
|
821
|
-
@click=${()=>!
|
|
822
|
-
</table>`}var
|
|
817
|
+
<thead><tr>${w.map(A=>c`<th scope="col" abbr=${n.weekdaysLong[A]}><span aria-hidden="true">${n.weekdaysShort[A]}</span><span class="vh">${n.weekdaysLong[A]}</span></th>`)}</tr></thead>
|
|
818
|
+
<tbody>${v.map(A=>c`<tr>${A.map(O=>{if(!O)return c`<td class="empty"></td>`;let B=P(O),K=o.isDisabled(O)||!!a&&O<a||!!l&&O>l,Ye=o.mark(O),W=o.note?.(O);return c`<td class="day ${Ye} ${B===y?"today":""}" data-date=${B}
|
|
819
|
+
tabindex=${B===P(i)?"0":"-1"}
|
|
820
|
+
aria-selected=${Ye?"true":"false"} aria-disabled=${K?"true":h}
|
|
821
|
+
aria-current=${B===y?"date":h}
|
|
822
|
+
aria-label="${n.long(O)}${W?`, ${W}`:""}"
|
|
823
|
+
@click=${()=>!K&&o.onPick(O)} @pointerenter=${()=>o.onHover?.(O)}><span aria-hidden="true">${n.day(O)}</span></td>`})}</tr>`)}</tbody>
|
|
824
|
+
</table>`}var Od=x`
|
|
823
825
|
.pop {
|
|
824
826
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-8)); inset-inline-start: 0;
|
|
825
827
|
width: max-content; max-width: calc(100vw - 32px); padding: var(--cm-space-12);
|
|
@@ -851,8 +853,8 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
851
853
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
852
854
|
}
|
|
853
855
|
@media (max-width: 640px) { .day, .empty { height: 36px; } }
|
|
854
|
-
`;function
|
|
855
|
-
${
|
|
856
|
+
`;function qd(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 Bd=x`
|
|
857
|
+
${Je}
|
|
856
858
|
:host { display: block; position: relative; }
|
|
857
859
|
.wrap { position: relative; }
|
|
858
860
|
.box {
|
|
@@ -883,69 +885,69 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
883
885
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
884
886
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
885
887
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
886
|
-
`;var
|
|
887
|
-
${this.label?c`<label class="label" for="${r(this,
|
|
888
|
+
`;var s$=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."}}),Oa,he,rt,qa,Kt,Mi,He,Be,Ba,Fa,M,Po,$i,ja,Fd,gr,Na,jt,ki,Ut,Vt,jd,Xm,Jm,Ia,fr,Zm,Qm,tf,Ud,rf,Wt,ep,Pa,Oo,qo,tp,af,Vd,ip,rp,Kd,Wd,Gd,Yd,Xd,Bo,Ei=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,Oa,"");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,rt,R("cm-dp"));p(this,qa,null);p(this,Kt,!1);p(this,Mi,!1);p(this,He,"");p(this,Be,"");p(this,Ba,!1);p(this,Fa,"");p(this,ja,!1);p(this,Wt,new $e);p(this,Vd,e=>{e.key==="Enter"?s(this,M,tp).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),s(this,M,af).call(this,e.key==="ArrowUp"?1:-1))});p(this,Kd,()=>{this.disabled||(this.open?this.open=!1:(s(this,M,qo).call(this),this.show()))});p(this,Wd,e=>{e.key==="Enter"?s(this,M,qo).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),s(this,M,qo).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});p(this,Gd,e=>{let t=Id(J(e,this),e,this._focus,r(this,M,Xm));if(t){e.preventDefault(),this._focus=wi(t,r(this,M,Ut),r(this,M,Vt)),f(this,Mi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,M,ip).call(this,this._focus))});p(this,Yd,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,M,rp).call(this);return}qd(e,e.currentTarget)});p(this,Xd,e=>{this._focus=wi(tt(this._focus,e),r(this,M,Ut),r(this,M,Vt))});p(this,Bo,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Oa)}set locale(e){let t=r(this,Oa);f(this,Oa,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,qa)===null&&f(this,qa,this.value),document.addEventListener("pointerdown",r(this,Bo),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,Wt).close(),document.removeEventListener("pointerdown",r(this,Bo),!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?kt(this.value):null:N(this.value)}checkValidity(){return s(this,M,Ud).call(this),r(this,he).checkValidity()}reportValidity(){return s(this,M,Ud).call(this),r(this,he).reportValidity()}formResetCallback(){this.value=r(this,qa)??"",this.time&&(s(this,M,Qm).call(this,this.value),f(this,M,s(this,M,fr).call(this,r(this,Be)),$i)),this._text=s(this,M,Ia).call(this,r(this,M,jt)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(s(this,M,tf).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=r(this,M,Ut),a=r(this,M,Vt);return i&&t<i||a&&t>a?!0:Io(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!r(this,ja)?(s(this,M,Qm).call(this,this.value),r(this,Ba)||f(this,M,s(this,M,fr).call(this,r(this,Be)),$i)):this.time&&(e.has("locale")||e.has("hourCycle"))&&r(this,Be)&&f(this,M,s(this,M,fr).call(this,r(this,Be)),$i),(e.has("value")||e.has("time"))&&!r(this,Kt)?this._text=s(this,M,Ia).call(this,r(this,M,jt)):e.has("locale")&&N(r(this,M,jt))&&(this._text=s(this,M,Ia).call(this,r(this,M,jt))),f(this,Kt,!1),f(this,Ba,!1),f(this,ja,!1)}updated(e){this.open&&!r(this,Wt).active?r(this,Wt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,Wt).active?r(this,Wt).close():this.open&&r(this,Wt).place(),r(this,he).setFormValue(this.value||null,this.time?this.value:this._text),s(this,M,Ud).call(this),this.open&&r(this,Mi)&&(f(this,Mi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&f(this,Mi,!1)}render(){let e=r(this,M,gr),t=N(r(this,M,jt)),i=[this.error&&`${r(this,rt)}-err`,this.helpText&&`${r(this,rt)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=this.label||a||"",d=Ft(this._focus);return c`<div class="field">
|
|
889
|
+
${this.label?c`<label class="label" for="${r(this,rt)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
888
890
|
<div class="wrap ${this.time?"timed":""}">
|
|
889
891
|
<div class="box" part="box">
|
|
890
|
-
<input id="${r(this,
|
|
891
|
-
.value=${ne(this._text)} placeholder=${this.placeholder||r(this,M,
|
|
892
|
+
<input id="${r(this,rt)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
893
|
+
.value=${ne(this._text)} placeholder=${this.placeholder||r(this,M,Jm)}
|
|
892
894
|
aria-label=${!this.label&&a?a:h}
|
|
893
895
|
?required=${this.required} ?disabled=${this.disabled}
|
|
894
896
|
aria-invalid=${this.error?"true":h} aria-describedby=${i||h}
|
|
895
897
|
@input=${m=>{m.stopPropagation(),this._text=m.target.value}}
|
|
896
|
-
@change=${()=>s(this,M,
|
|
898
|
+
@change=${()=>s(this,M,qo).call(this)} @keydown=${r(this,Wd)} />
|
|
897
899
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
898
900
|
aria-label=${t?this.t(l?"changeFor":"change",{label:l,date:e.long(t)}):this.t(l?"chooseFor":"choose",{label:l})}
|
|
899
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
900
|
-
@click=${r(this,
|
|
901
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,rt)}-pop"
|
|
902
|
+
@click=${r(this,Kd)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
901
903
|
</div>
|
|
902
904
|
${this.time?c`<div class="box time" part="time-box">
|
|
903
905
|
<input class="time-in" part="time-input" type="text" autocomplete="off" spellcheck="false"
|
|
904
|
-
.value=${ne(r(this,M,
|
|
906
|
+
.value=${ne(r(this,M,Po))} placeholder=${r(this,M,Zm)}
|
|
905
907
|
aria-label=${this.t(l?"timeFor":"time",{label:l})}
|
|
906
908
|
?required=${this.required} ?disabled=${this.disabled}
|
|
907
909
|
aria-invalid=${this.error?"true":h} aria-describedby=${i||h}
|
|
908
|
-
@input=${m=>{m.stopPropagation(),f(this,M,m.target.value
|
|
909
|
-
@change=${()=>s(this,M,
|
|
910
|
+
@input=${m=>{m.stopPropagation(),f(this,M,m.target.value,$i)}}
|
|
911
|
+
@change=${()=>s(this,M,tp).call(this)} @keydown=${r(this,Vd)} />
|
|
910
912
|
</div>`:h}
|
|
911
|
-
<div class="pop" id="${r(this,
|
|
912
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
913
|
-
${this.open?c`<div class="cal">${
|
|
913
|
+
<div class="pop" id="${r(this,rt)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
914
|
+
?hidden=${!this.open} @keydown=${r(this,Yd)}>
|
|
915
|
+
${this.open?c`<div class="cal">${Pd({id:r(this,rt),fmt:e,firstDay:r(this,M,Xm),month:d,focus:this._focus,min:r(this,M,Ut),max:r(this,M,Vt),isDisabled:m=>this.isUnavailable(P(m)),mark:m=>t&&P(m)===r(this,M,jt)?"selected":"",onPick:m=>s(this,M,ip).call(this,m),onKey:r(this,Gd),onMonth:r(this,Xd),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:h}
|
|
914
916
|
</div>
|
|
915
917
|
</div>
|
|
916
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
917
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
918
|
-
</div>`}};Ma=new WeakMap,he=new WeakMap,et=new WeakMap,Ta=new WeakMap,Bt=new WeakMap,vi=new WeakMap,Re=new WeakMap,qe=new WeakMap,za=new WeakMap,_a=new WeakMap,M=new WeakSet,Eo=function(){return r(this,_a)},gi=function(e){e!==r(this,_a)&&(f(this,_a,e),this.requestUpdate())},Ca=new WeakMap,Sd=function(){return ya(this,this.locale)},sr=function(){return wa(r(this,M,Sd))},$a=function(){return $d(r(this,M,Sd),this.hourCycle)},Pt=function(){return this.time?r(this,Re):this.value},fi=function(e){return this.time&&e.trim().toLowerCase()==="now"?Fg():e},Ot=function(){return N(Qe(s(this,M,fi).call(this,this.min)).date||this.min)},qt=function(){return N(Qe(s(this,M,fi).call(this,this.max)).date||this.max)},Ld=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Om=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?xa(r(this,M,Sd)):(Math.trunc(e)%7+7)%7},qm=function(){return kd(r(this,M,sr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},ka=function(e){let t=N(e);return t?r(this,M,sr).short(t):e},nr=function(e){let t=ar(e);return t===null?"":r(this,M,$a).format(t)},Bm=function(){return jg(r(this,M,$a),{h:this.t("patternHour"),m:this.t("patternMinute")})},Fm=function(e){let{date:t,time:i}=Qe(e);f(this,Re,t),f(this,qe,t?i:"")},Ug=function(){let e=new Date,t=N(r(this,M,Pt))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=ui(t,r(this,M,Ot),r(this,M,qt)),f(this,vi,!0)},Dd=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,M,Pt)),i=r(this,M,sr);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,qm)}),e):this.time?s(this,M,Vg).call(this,t,e):this.required&&!t?r(this,he).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,Ot)&&t<r(this,M,Ot)?r(this,he).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,Ot))}),e):t&&r(this,M,qt)&&t>r(this,M,qt)?r(this,he).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,qt))}),e):t&&this.isUnavailable(this.value)?r(this,he).setValidity({customError:!0},this.t("unavailable"),e):r(this,he).setValidity({})},Vg=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(g,w,y,k=t)=>r(this,he).setValidity(g,this.t(w,y),k),l=ar(r(this,qe));if(r(this,M,Eo).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,M,Bm)},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,fi).call(this,this.min)),u=yt(s(this,M,fi).call(this,this.max),!0),v=(g,w)=>Qe(g).time?r(this,M,$a).dateTime(w):r(this,M,sr).medium(w);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,M,fi).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,M,fi).call(this,this.max),u)},i);if(l%r(this,M,Ld))return a({stepMismatch:!0},"stepMismatch",{count:r(this,M,Ld)},i);if(this.isUnavailable(r(this,Re)))return a({customError:!0},"unavailable");r(this,he).setValidity({})},jm=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})))},Ea=function(e,t){f(this,Re,e),f(this,qe,t);let i=e&&t?`${e}T${t}`:"";f(this,Ca,!0),this.requestUpdate(),s(this,M,jm).call(this,i)},Mo=function(e){this.time?s(this,M,Ea).call(this,e,r(this,qe)):s(this,M,jm).call(this,e)},To=function(){let e=this._text.trim();if(!e){s(this,M,Mo).call(this,"");return}let t=Ed(e,r(this,M,sr));t?(s(this,M,Mo).call(this,t),this._text=s(this,M,ka).call(this,t)):(f(this,Bt,!0),s(this,M,Mo).call(this,""))},Um=function(){let e=r(this,M,Eo).trim(),t=e?Pm(e,r(this,M,$a)):"";if(f(this,Bt,!0),t===null){f(this,za,!0),s(this,M,Ea).call(this,r(this,Re),"");return}s(this,M,Ea).call(this,r(this,Re),t),f(this,M,s(this,M,nr).call(this,t),gi)},Kg=function(e){let t=r(this,M,Ld),i=Pm(r(this,M,Eo),r(this,M,$a));if(!i){let m=Qe(s(this,M,fi).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,Re)||r(this,Re)===m.date)?m.time:$o(u.getHours()*60+u.getMinutes()),ar(i)%t===0){f(this,Bt,!0),s(this,M,Ea).call(this,r(this,Re),i),f(this,M,s(this,M,nr).call(this,i),gi);return}e=1}let a=ar(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=$o(l>=1440?0:l<0?Math.floor(1439/t)*t:l);f(this,Bt,!0),s(this,M,Ea).call(this,r(this,Re),d),f(this,M,s(this,M,nr).call(this,d),gi)},Ad=new WeakMap,Vm=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,M,Mo).call(this,t),this._text=s(this,M,ka).call(this,t),this.time&&!r(this,qe)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,M,Km).call(this))},Km=function(){this.renderRoot.querySelector(".trigger")?.focus()},Rd=new WeakMap,Hd=new WeakMap,Nd=new WeakMap,Id=new WeakMap,Pd=new WeakMap,zo=new WeakMap,bi.formAssociated=!0,bi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},bi.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:va},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}},bi.styles=[E,Cd,zd,x`.pop { min-width: 0; }`];$("cm-date-picker",bi);var G0=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"}),my={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=>[It(o),o]],"last-month":["Last month",o=>[It(Ze(o,-1)),ba(Ze(o,-1))]]},py=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Wg(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=my[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(py(o))||t[0],start:P(a),end:P(l)}}var Da,fe,Be,Aa,Ra,xi,I,Wm,Sa,Gm,jt,Od,Ft,Gg,qd,La,Ym,Yg,Bd,Fd,jd,Ud,Vd,_o,Xm,yi=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,Da,"");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,Aa,null);p(this,Ra,!1);p(this,xi,!1);p(this,jt,"start");p(this,Fd,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,La).call(this,"start"),s(this,I,La).call(this,"end"),this.show()))});p(this,jd,e=>t=>{t.key==="Enter"?s(this,I,La).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,La).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,Ud,e=>{let t=Md(J(e,this),e,this._focus,r(this,I,Gm));if(t){e.preventDefault(),this._focus=ui(t,N(this.min),N(this.max)),f(this,xi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,Ym).call(this,this._focus))});p(this,Vd,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,Bd).call(this);return}_d(e,e.currentTarget)});p(this,_o,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Da)}set locale(e){let t=r(this,Da);f(this,Da,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Aa)||f(this,Aa,[this.start,this.end]),document.addEventListener("pointerdown",r(this,_o),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,_o),!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,Aa)??["",""],this._startText=s(this,I,Ft).call(this,this.start),this._endText=s(this,I,Ft).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=ui(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),f(this,jt,"start"),f(this,xi,!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:ko(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,Ra)||(e.has("start")&&(this._startText=s(this,I,Ft).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,Ft).call(this,this.end))),f(this,Ra,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,Ft).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,Ft).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,Sa),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,Od)}),l):this._endText.trim()&&!t?r(this,fe).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Od)}),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,xi)&&(f(this,xi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,Sa),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=ko(this.presets).map(g=>Wg(g,new Date,w=>this.t(w))).filter(g=>!!g),u=r(this,jt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=g=>{let w=g==="start"?this._startText:this._endText;return c`<input id="${r(this,Be)}-${g}" type="text" autocomplete="off" spellcheck="false"
|
|
919
|
-
.value=${ne(w)} placeholder=${r(this,I,
|
|
918
|
+
${this.error?c`<p class="error" id="${r(this,rt)}-err" role="alert">${this.error}</p>`:h}
|
|
919
|
+
${this.helpText?c`<p class="help" id="${r(this,rt)}-help">${this.helpText}</p>`:h}
|
|
920
|
+
</div>`}};Oa=new WeakMap,he=new WeakMap,rt=new WeakMap,qa=new WeakMap,Kt=new WeakMap,Mi=new WeakMap,He=new WeakMap,Be=new WeakMap,Ba=new WeakMap,Fa=new WeakMap,M=new WeakSet,Po=function(){return r(this,Fa)},$i=function(e){e!==r(this,Fa)&&(f(this,Fa,e),this.requestUpdate())},ja=new WeakMap,Fd=function(){return Aa(this,this.locale)},gr=function(){return Ha(r(this,M,Fd))},Na=function(){return Rd(r(this,M,Fd),this.hourCycle)},jt=function(){return this.time?r(this,He):this.value},ki=function(e){return this.time&&e.trim().toLowerCase()==="now"?Qg():e},Ut=function(){return N(it(s(this,M,ki).call(this,this.min)).date||this.min)},Vt=function(){return N(it(s(this,M,ki).call(this,this.max)).date||this.max)},jd=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Xm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,M,Fd)):(Math.trunc(e)%7+7)%7},Jm=function(){return Hd(r(this,M,gr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Ia=function(e){let t=N(e);return t?r(this,M,gr).short(t):e},fr=function(e){let t=ur(e);return t===null?"":r(this,M,Na).format(t)},Zm=function(){return ef(r(this,M,Na),{h:this.t("patternHour"),m:this.t("patternMinute")})},Qm=function(e){let{date:t,time:i}=it(e);f(this,He,t),f(this,Be,t?i:"")},tf=function(){let e=new Date,t=N(r(this,M,jt))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=wi(t,r(this,M,Ut),r(this,M,Vt)),f(this,Mi,!0)},Ud=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,M,jt)),i=r(this,M,gr);this.error?r(this,he).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,he).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,M,Jm)}),e):this.time?s(this,M,rf).call(this,t,e):this.required&&!t?r(this,he).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,Ut)&&t<r(this,M,Ut)?r(this,he).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,Ut))}),e):t&&r(this,M,Vt)&&t>r(this,M,Vt)?r(this,he).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,Vt))}),e):t&&this.isUnavailable(this.value)?r(this,he).setValidity({customError:!0},this.t("unavailable"),e):r(this,he).setValidity({})},rf=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(g,w,y,k=t)=>r(this,he).setValidity(g,this.t(w,y),k),l=ur(r(this,Be));if(r(this,M,Po).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,M,Zm)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,he).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=kt(`${r(this,He)}T${r(this,Be)}`),m=kt(s(this,M,ki).call(this,this.min)),u=kt(s(this,M,ki).call(this,this.max),!0),v=(g,w)=>it(g).time?r(this,M,Na).dateTime(w):r(this,M,gr).medium(w);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,M,ki).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,M,ki).call(this,this.max),u)},i);if(l%r(this,M,jd))return a({stepMismatch:!0},"stepMismatch",{count:r(this,M,jd)},i);if(this.isUnavailable(r(this,He)))return a({customError:!0},"unavailable");r(this,he).setValidity({})},Wt=new WeakMap,ep=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})))},Pa=function(e,t){f(this,He,e),f(this,Be,t);let i=e&&t?`${e}T${t}`:"";f(this,ja,!0),this.requestUpdate(),s(this,M,ep).call(this,i)},Oo=function(e){this.time?s(this,M,Pa).call(this,e,r(this,Be)):s(this,M,ep).call(this,e)},qo=function(){let e=this._text.trim();if(!e){s(this,M,Oo).call(this,"");return}let t=Nd(e,r(this,M,gr));t?(s(this,M,Oo).call(this,t),this._text=s(this,M,Ia).call(this,t)):(f(this,Kt,!0),s(this,M,Oo).call(this,""))},tp=function(){let e=r(this,M,Po).trim(),t=e?Ym(e,r(this,M,Na)):"";if(f(this,Kt,!0),t===null){f(this,Ba,!0),s(this,M,Pa).call(this,r(this,He),"");return}s(this,M,Pa).call(this,r(this,He),t),f(this,M,s(this,M,fr).call(this,t),$i)},af=function(e){let t=r(this,M,jd),i=Ym(r(this,M,Po),r(this,M,Na));if(!i){let m=it(s(this,M,ki).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,He)||r(this,He)===m.date)?m.time:No(u.getHours()*60+u.getMinutes()),ur(i)%t===0){f(this,Kt,!0),s(this,M,Pa).call(this,r(this,He),i),f(this,M,s(this,M,fr).call(this,i),$i);return}e=1}let a=ur(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=No(l>=1440?0:l<0?Math.floor(1439/t)*t:l);f(this,Kt,!0),s(this,M,Pa).call(this,r(this,He),d),f(this,M,s(this,M,fr).call(this,d),$i)},Vd=new WeakMap,ip=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,M,Oo).call(this,t),this._text=s(this,M,Ia).call(this,t),this.time&&!r(this,Be)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,M,rp).call(this))},rp=function(){this.renderRoot.querySelector(".trigger")?.focus()},Kd=new WeakMap,Wd=new WeakMap,Gd=new WeakMap,Yd=new WeakMap,Xd=new WeakMap,Bo=new WeakMap,Ei.formAssociated=!0,Ei.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Ei.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Da},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_focus:{state:!0}},Ei.styles=[E,Xe,Bd,Od,x`.pop { min-width: 0; }`];$("cm-date-picker",Ei);var u$=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"}),ky={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[Y(o,-1),Y(o,-1)]],"last-7-days":["Last 7 days",o=>[Y(o,-6),o]],"last-30-days":["Last 30 days",o=>[Y(o,-29),o]],"last-90-days":["Last 90 days",o=>[Y(o,-89),o]],"this-month":["This month",o=>[Ft(o),o]],"last-month":["Last month",o=>[Ft(tt(o,-1)),La(tt(o,-1))]]},Ey=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function sf(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=ky[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(Ey(o))||t[0],start:P(a),end:P(l)}}var Ka,fe,Fe,Wa,Ga,zi,I,ap,Ua,sp,Yt,Jd,Gt,Xt,nf,Zd,Va,np,of,Qd,eh,th,ih,rh,Fo,op,Ti=class extends T{constructor(){super(...arguments);p(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,Ka,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;p(this,fe,this.attachInternals());p(this,Fe,R("cm-drp"));p(this,Wa,null);p(this,Ga,!1);p(this,zi,!1);p(this,Yt,"start");p(this,Xt,new $e);p(this,eh,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,Va).call(this,"start"),s(this,I,Va).call(this,"end"),this.show()))});p(this,th,e=>t=>{t.key==="Enter"?s(this,I,Va).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,Va).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,ih,e=>{let t=Id(J(e,this),e,this._focus,r(this,I,sp));if(t){e.preventDefault(),this._focus=wi(t,N(this.min),N(this.max)),f(this,zi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,np).call(this,this._focus))});p(this,rh,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,Qd).call(this);return}qd(e,e.currentTarget)});p(this,Fo,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ka)}set locale(e){let t=r(this,Ka);f(this,Ka,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Wa)||f(this,Wa,[this.start,this.end]),document.addEventListener("pointerdown",r(this,Fo),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,Xt).close(),document.removeEventListener("pointerdown",r(this,Fo),!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,Wa)??["",""],this._startText=s(this,I,Gt).call(this,this.start),this._endText=s(this,I,Gt).call(this,this.end),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=N(this.start)?this.start:"",this._draftEnd=N(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=wi(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),f(this,Yt,"start"),f(this,zi,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=N(this.min),a=N(this.max);return i&&t<i||a&&t>a?!0:Io(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,Ga)||(e.has("start")&&(this._startText=s(this,I,Gt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,Gt).call(this,this.end))),f(this,Ga,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,Gt).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,Gt).call(this,this.end)))}updated(){this.open&&!r(this,Xt).active?r(this,Xt).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,Xt).active?r(this,Xt).close():this.open&&r(this,Xt).place();let e=N(this.start),t=N(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,fe).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let a=this.renderRoot.querySelectorAll("input"),[l,d]=[a[0]??void 0,a[1]??void 0],m=r(this,I,Ua),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,Jd)}),l):this._endText.trim()&&!t?r(this,fe).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Jd)}),d):this.required&&(!e||!t)?r(this,fe).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,fe).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,fe).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,fe).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,fe).setValidity({customError:!0},this.t("unavailable"),l):r(this,fe).setValidity({}),this.open&&r(this,zi)&&(f(this,zi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,Ua),t=N(this.start),i=N(this.end),a=[this.error&&`${r(this,Fe)}-err`,this.helpText&&`${r(this,Fe)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=Io(this.presets).map(g=>sf(g,new Date,w=>this.t(w))).filter(g=>!!g),u=r(this,Yt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=g=>{let w=g==="start"?this._startText:this._endText;return c`<input id="${r(this,Fe)}-${g}" type="text" autocomplete="off" spellcheck="false"
|
|
921
|
+
.value=${ne(w)} placeholder=${r(this,I,Jd)}
|
|
920
922
|
aria-label=${g==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
921
923
|
?required=${this.required} ?disabled=${this.disabled}
|
|
922
924
|
aria-invalid=${this.error?"true":h} aria-describedby=${a||h}
|
|
923
925
|
@input=${y=>{y.stopPropagation();let k=y.target.value;g==="start"?this._startText=k:this._endText=k}}
|
|
924
|
-
@change=${()=>s(this,I,
|
|
925
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
926
|
+
@change=${()=>s(this,I,Va).call(this,g)} @keydown=${r(this,th).call(this,g)} />`};return c`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,Fe)}-l`:h} aria-label=${!this.label&&l?l:h}>
|
|
927
|
+
${this.label?c`<span class="label" id="${r(this,Fe)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
926
928
|
<div class="wrap">
|
|
927
929
|
<div class="box" part="box">
|
|
928
930
|
${v("start")}<span class="sep" aria-hidden="true">–</span>${v("end")}
|
|
929
931
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
930
932
|
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})}
|
|
931
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
932
|
-
@click=${r(this,
|
|
933
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Fe)}-pop"
|
|
934
|
+
@click=${r(this,eh)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
933
935
|
</div>
|
|
934
|
-
<div class="pop" id="${r(this,
|
|
935
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
936
|
+
<div class="pop" id="${r(this,Fe)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
937
|
+
?hidden=${!this.open} @keydown=${r(this,rh)}>
|
|
936
938
|
${this.open?c`<div class="body">
|
|
937
939
|
${m.length?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${m.map(g=>c`<li>
|
|
938
940
|
<button type="button" class="preset" aria-pressed=${g.start===this.start&&g.end===this.end?"true":"false"}
|
|
939
|
-
@click=${()=>s(this,I,
|
|
940
|
-
<div class="cal">${
|
|
941
|
+
@click=${()=>s(this,I,of).call(this,g)}>${g.label}</button></li>`)}</ul>`:h}
|
|
942
|
+
<div class="cal">${Pd({id:r(this,Fe),fmt:e,firstDay:r(this,I,sp),month:Ft(this._focus),focus:this._focus,min:N(this.min),max:N(this.max),isDisabled:g=>this.isUnavailable(P(g)),mark:g=>s(this,I,op).call(this,g),note:g=>{let w=s(this,I,op).call(this,g);return w==="start"?this.t("startNote"):w==="end"?this.t("endNote"):""},onPick:g=>s(this,I,np).call(this,g),onKey:r(this,ih),onMonth:g=>{this._focus=wi(tt(this._focus,g),N(this.min),N(this.max))},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:g=>{r(this,Yt)==="end"&&(this._hover=g)}})}
|
|
941
943
|
<p class="status" aria-live="polite">${u}</p>
|
|
942
944
|
</div>
|
|
943
945
|
</div>`:h}
|
|
944
946
|
</div>
|
|
945
947
|
</div>
|
|
946
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
947
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
948
|
-
</div>`}};
|
|
948
|
+
${this.error?c`<p class="error" id="${r(this,Fe)}-err" role="alert">${this.error}</p>`:h}
|
|
949
|
+
${this.helpText?c`<p class="help" id="${r(this,Fe)}-help">${this.helpText}</p>`:h}
|
|
950
|
+
</div>`}};Ka=new WeakMap,fe=new WeakMap,Fe=new WeakMap,Wa=new WeakMap,Ga=new WeakMap,zi=new WeakMap,I=new WeakSet,ap=function(){return Aa(this,this.locale)},Ua=function(){return Ha(r(this,I,ap))},sp=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,I,ap)):(Math.trunc(e)%7+7)%7},Yt=new WeakMap,Jd=function(){return Hd(r(this,I,Ua),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Gt=function(e){let t=N(e);return t?r(this,I,Ua).short(t):e},Xt=new WeakMap,nf=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Zd=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,s(this,I,nf).call(this))},Va=function(e){let t=(e==="start"?this._startText:this._endText).trim(),i=t?Nd(t,r(this,I,Ua)):"";t&&!i&&f(this,Ga,!0);let a=e==="start"?[i??"",this.end]:[this.start,i??""];s(this,I,Zd).call(this,...a),i&&(e==="start"?this._startText=s(this,I,Gt).call(this,i):this._endText=s(this,I,Gt).call(this,i))},np=function(e){let t=P(e);if(!this.isUnavailable(t)){if(r(this,Yt)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",f(this,Yt,"end"),this._focus=e,f(this,zi,!0);return}this._draftEnd=t,this.open=!1,s(this,I,Zd).call(this,this._draftStart,t),s(this,I,Qd).call(this)}},of=function(e){this.open=!1,s(this,I,Zd).call(this,e.start,e.end),s(this,I,Qd).call(this)},Qd=function(){this.renderRoot.querySelector(".trigger")?.focus()},eh=new WeakMap,th=new WeakMap,ih=new WeakMap,rh=new WeakMap,Fo=new WeakMap,op=function(e){let t=P(e),i=this._draftStart,a=this._draftEnd||(r(this,Yt)==="end"&&i?P(this._hover??this._focus):"");return t===i?"start":t===a&&a>i?"end":i&&a&&t>i&&t<a?"in-range":""},Ti.formAssociated=!0,Ti.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Ti.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:Da},isDateDisabled:{attribute:!1},presets:{converter:Da},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}},Ti.styles=[E,Xe,Bd,Od,x`
|
|
949
951
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
950
952
|
input { flex: 0 1 6.6em; }
|
|
951
953
|
:host([size='small']) input { flex-basis: 6.6em; }
|
|
@@ -965,56 +967,56 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
965
967
|
.presets li { flex: 0 0 auto; }
|
|
966
968
|
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
967
969
|
}
|
|
968
|
-
`];$("cm-date-range-picker",
|
|
970
|
+
`];$("cm-date-range-picker",Ti);var x$=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 My(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 at,ie,Jt,q,jo,lp,ah,sh,cp,dp,hp,mp,br,lf,cf,pp,df,hf,_i=class extends T{constructor(){super(...arguments);p(this,q);this.label="";this.hint="";this.name="";this.accept="";this.multiple=!1;this.maxSize=0;this.maxFiles=0;this.required=!1;this.disabled=!1;this.error="";this.files=[];this._rejected="";this._progress=new Map;this._fileErrors=new Map;this._over=!1;p(this,at,this.attachInternals());p(this,ie,R("cm-fu"));p(this,Jt,new Map)}get form(){return r(this,at).form}get validity(){return r(this,at).validity}get validationMessage(){return r(this,at).validationMessage}checkValidity(){return r(this,at).checkValidity()}reportValidity(){return r(this,at).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,at).setFormValue(this.files.length?t:null);let i=(r(this,q,jo)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,a=this.error||this._rejected;a?r(this,at).setValidity({customError:!0},a,i):this.required&&!this.files.length?r(this,at).setValidity({valueMissing:!0},this.t("required"),i):r(this,at).setValidity({})}addFiles(e){let t=[...e],i=[],a=[],l=[];for(let m of t)My(m,r(this,q,lp))?this.maxSize&&m.size>this.maxSize?(a.push(m),l.push(this.t("tooLarge",{name:m.name,size:s(this,q,sh).call(this,this.maxSize)}))):i.push(m):(a.push(m),l.push(this.t("wrongType",{name:m.name})));let d=r(this,q,ah)?[...this.files,...i]:i.slice(-1);!r(this,q,ah)&&!i.length&&(d=this.files),r(this,q,ah)&&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,q,jo))return s(this,q,hf).call(this);let e=this.error||this._rejected,t=!this.files.length||this.multiple,i=this.files.length>0;return c`
|
|
969
971
|
${this.label||this.hint&&i?c`<div class="head">
|
|
970
972
|
${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}
|
|
971
973
|
${this.hint&&i?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h}
|
|
972
974
|
</div>`:h}
|
|
973
975
|
${i?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
974
|
-
${this.files.map(a=>s(this,
|
|
975
|
-
${t?c`<li>${s(this,
|
|
976
|
-
</ul>`:s(this,
|
|
976
|
+
${this.files.map(a=>s(this,q,cf).call(this,a))}
|
|
977
|
+
${t?c`<li>${s(this,q,pp).call(this,!0)}</li>`:h}
|
|
978
|
+
</ul>`:s(this,q,pp).call(this,!1)}
|
|
977
979
|
${e?c`<p class="msg" id="${r(this,ie)}-msg" role="alert">${e}</p>`:h}
|
|
978
|
-
`}};
|
|
979
|
-
${e.type.startsWith("image/")?c`<img src=${s(this,
|
|
980
|
+
`}};at=new WeakMap,ie=new WeakMap,Jt=new WeakMap,q=new WeakSet,jo=function(){return this.variant==="photo"},lp=function(){return this.accept||(r(this,q,jo)?"image/*":"")},ah=function(){return this.multiple&&!r(this,q,jo)},sh=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})})},cp=function(e){let t=r(this,Jt).get(e);return t||(t=URL.createObjectURL(e),r(this,Jt).set(e,t)),t},dp=function(e){return this._progress.has(e)},hp=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)},mp=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},br=function(e){this.toggleAttribute("data-over",e),this._over=e},lf=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}`},cf=function(e){let t=s(this,q,dp).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":""}">
|
|
981
|
+
${e.type.startsWith("image/")?c`<img src=${s(this,q,cp).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,q,sh).call(this,e.size)}</span></div>`}
|
|
980
982
|
${t?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
981
983
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(l)}><span style="inline-size:${l}%"></span></div>`:h}
|
|
982
|
-
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>s(this,
|
|
984
|
+
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>s(this,q,hp).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}
|
|
983
985
|
@click=${()=>this.removeFile(e)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
984
|
-
</div>${i?c`<p class="ferr" id=${a} role="alert">${i}</p>`:h}</li>`},
|
|
985
|
-
@dragenter=${()=>s(this,
|
|
986
|
+
</div>${i?c`<p class="ferr" id=${a} role="alert">${i}</p>`:h}</li>`},pp=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"
|
|
987
|
+
@dragenter=${()=>s(this,q,br).call(this,!0)} @dragleave=${()=>s(this,q,br).call(this,!1)} @drop=${()=>s(this,q,br).call(this,!1)}>
|
|
986
988
|
<input type="file" id=${r(this,ie)} accept=${this.accept||h} capture=${this.capture||h} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
987
989
|
?required=${this.required&&!this.files.length}
|
|
988
990
|
aria-labelledby=${[this.label&&`${r(this,ie)}-l`,`${r(this,ie)}-p`].filter(Boolean).join(" ")}
|
|
989
991
|
aria-describedby=${t||h} aria-invalid=${this.error||this._rejected?"true":h}
|
|
990
|
-
@change=${s(this,
|
|
992
|
+
@change=${s(this,q,mp)} @cancel=${a=>a.stopPropagation()} />
|
|
991
993
|
${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>
|
|
992
|
-
<span class="words"><span id="${r(this,ie)}-p">${s(this,
|
|
993
|
-
</label>`},
|
|
994
|
+
<span class="words"><span id="${r(this,ie)}-p">${s(this,q,lf).call(this)}</span>${this.hint?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h}</span>`}
|
|
995
|
+
</label>`},df=function(){this.renderRoot.querySelector("input[type=file]")?.click()},hf=function(){let e=this.files[0],t=this.error||this._rejected||e&&this._fileErrors.get(e)||"",i=!!e&&s(this,q,dp).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,q,lp)} capture=${this.capture||h}
|
|
994
996
|
?disabled=${this.disabled} ?required=${this.required&&!e} tabindex=${u?"-1":h} aria-hidden=${u?"true":h}
|
|
995
997
|
?hidden=${u} aria-labelledby=${u?h:`${r(this,ie)}-p`} aria-describedby=${!u&&l||h} aria-invalid=${t?"true":h}
|
|
996
|
-
@change=${s(this,
|
|
998
|
+
@change=${s(this,q,mp)} @cancel=${v=>v.stopPropagation()} />`,m=this.hint?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h;return c`
|
|
997
999
|
${e?c`<div class="shot ${i?"busy":""}" part="photo">
|
|
998
|
-
${e.type.startsWith("image/")?c`<img src=${s(this,
|
|
1000
|
+
${e.type.startsWith("image/")?c`<img src=${s(this,q,cp).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,q,sh).call(this,e.size)}</span></div>`}
|
|
999
1001
|
${i?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
1000
1002
|
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}
|
|
1001
1003
|
</div>
|
|
1002
1004
|
<p class="caption" aria-hidden="true">${this.label}</p>
|
|
1003
1005
|
${d(!0)}
|
|
1004
1006
|
${this.disabled?h:i?c`<div class="actions" part="actions">
|
|
1005
|
-
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,
|
|
1007
|
+
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,q,hp).call(this,e)}><cm-icon name="close" size="16"></cm-icon>${this.t("cancelShort")}</button>
|
|
1006
1008
|
</div>`:c`<div class="actions" part="actions">
|
|
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,
|
|
1009
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,ie)}-msg`:h} @click=${s(this,q,df)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
1008
1010
|
<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>
|
|
1009
1011
|
</div>`}`:c`<label class="zone photo ${t?"invalid":""}" part="zone photo"
|
|
1010
|
-
@dragenter=${()=>s(this,
|
|
1012
|
+
@dragenter=${()=>s(this,q,br).call(this,!0)} @dragleave=${()=>s(this,q,br).call(this,!1)} @drop=${()=>s(this,q,br).call(this,!1)}>
|
|
1011
1013
|
${d(!1)}
|
|
1012
1014
|
<cm-icon name="camera" size="24"></cm-icon>
|
|
1013
1015
|
<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>
|
|
1014
1016
|
${m}
|
|
1015
1017
|
</label>`}
|
|
1016
1018
|
${t?c`<p class="msg" id="${r(this,ie)}-msg" role="alert">${t}</p>`:h}
|
|
1017
|
-
`},
|
|
1019
|
+
`},_i.formAssociated=!0,_i.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},_i.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}},_i.styles=[E,x`
|
|
1018
1020
|
:host { display: block; }
|
|
1019
1021
|
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-8); margin-bottom: var(--cm-space-12); }
|
|
1020
1022
|
.label { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1098,33 +1100,33 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1098
1100
|
@media (max-width: 640px) {
|
|
1099
1101
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
1100
1102
|
}
|
|
1101
|
-
`];$("cm-file-upload",
|
|
1102
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1103
|
+
`];$("cm-file-upload",_i);var _$=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"}),Ty=[{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 Zt(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 zy=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 _y(o){let n=zy(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var je,Et,Uo,Ya,X,vr,up,mf,pf,gp,uf,gf,ff,bf,Ci=class extends T{constructor(){super(...arguments);p(this,X);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.picker=!1;this.required=!1;this.disabled=!1;this._invalid=!1;p(this,je,this.attachInternals());p(this,Et,R("cm-cf"));p(this,Uo,"");p(this,Ya)}connectedCallback(){super.connectedCallback(),f(this,Uo,Zt(this.value)??this.value)}get form(){return r(this,je).form}get validity(){return r(this,je).validity}get validationMessage(){return r(this,je).validationMessage}checkValidity(){return r(this,je).checkValidity()}reportValidity(){return r(this,je).reportValidity()}formResetCallback(){this.value=r(this,Uo),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=Zt(t?.value??"");return i?[{value:i,name:t.name}]:[]}):Ty.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=Zt(this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==r(this,Ya)&&(this._draft=void 0,this._invalid=!1),f(this,Ya,void 0)}}updated(){let e=!this.value||Zt(this.value)!==null;r(this,je).setFormValue(this.value&&e?this.value:null,this.value);let t=this.renderRoot.querySelector(".input")??void 0;this.error?r(this,je).setValidity({customError:!0},this.error,t):this._invalid||!e?r(this,je).setValidity({patternMismatch:!0},this.t("invalid"),t):this.required&&!this.value?r(this,je).setValidity({valueMissing:!0},this.t("required"),t):r(this,je).setValidity({})}render(){let e=this.items,t=Zt(this.value??""),i=e.findIndex(u=>u.value===t),a=this.error||(this._invalid||this.value&&!t?this.t("invalid"):""),l=[a&&`${r(this,Et)}-err`,this.helpText&&`${r(this,Et)}-help`].filter(Boolean).join(" ")||h,d=this.getAttribute("aria-label"),m=this.label||d||"";return c`<div class="field">
|
|
1104
|
+
${this.label?c`<span class="label" id="${r(this,Et)}-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}
|
|
1103
1105
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
1104
|
-
aria-labelledby=${this.label?`${r(this,
|
|
1106
|
+
aria-labelledby=${this.label?`${r(this,Et)}-l`:h} aria-label=${!this.label&&d?d:h}
|
|
1105
1107
|
aria-required=${this.required?"true":h} aria-describedby=${l}>
|
|
1106
1108
|
${e.map((u,v)=>{let g=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
1109
|
aria-label=${g} title=${u.name||u.value} tabindex=${v===(i>=0?i:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
1108
|
-
style="background-color:${u.value};color:${
|
|
1109
|
-
@click=${()=>s(this,
|
|
1110
|
+
style="background-color:${u.value};color:${_y(u.value)}"
|
|
1111
|
+
@click=${()=>s(this,X,up).call(this,v)} @keydown=${w=>s(this,X,mf).call(this,w,v)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
1110
1112
|
</div>`:h}
|
|
1111
1113
|
<div class="row">
|
|
1112
1114
|
${this.picker?c`<label class="pick" part="picker" style=${t?`background-color:${t}`:h}>
|
|
1113
1115
|
<input type="color" .value=${ne(t??"#000000")} ?disabled=${this.disabled}
|
|
1114
1116
|
aria-label=${m?this.t("pickerNamed",{label:m}):this.t("picker")}
|
|
1115
|
-
@input=${s(this,
|
|
1117
|
+
@input=${s(this,X,ff)} @change=${s(this,X,bf)} />
|
|
1116
1118
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1117
1119
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${t?`background-color:${t}`:h}></span>`}
|
|
1118
|
-
<input class="input" part="input" id=${r(this,
|
|
1120
|
+
<input class="input" part="input" id=${r(this,Et)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
1119
1121
|
maxlength="7" .value=${ne(this._draft??this.value??"")} placeholder=${this.t("placeholder")}
|
|
1120
1122
|
aria-label=${m?this.t("hexNamed",{label:m}):this.t("hex")}
|
|
1121
1123
|
?required=${this.required} ?disabled=${this.disabled}
|
|
1122
1124
|
aria-invalid=${a?"true":h} aria-describedby=${l}
|
|
1123
|
-
@input=${s(this,
|
|
1125
|
+
@input=${s(this,X,pf)} @change=${s(this,X,uf)} @keydown=${s(this,X,gf)} />
|
|
1124
1126
|
</div>
|
|
1125
|
-
${a?c`<p class="error" id="${r(this,
|
|
1126
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
1127
|
-
</div>`}};
|
|
1127
|
+
${a?c`<p class="error" id="${r(this,Et)}-err" role="alert">${a}</p>`:h}
|
|
1128
|
+
${this.helpText?c`<p class="help" id="${r(this,Et)}-help">${this.helpText}</p>`:h}
|
|
1129
|
+
</div>`}};je=new WeakMap,Et=new WeakMap,Uo=new WeakMap,Ya=new WeakMap,X=new WeakSet,vr=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},up=function(e){let t=this.items[e];!t||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".swatch")[e]?.focus()),this._draft=void 0,this._invalid=!1,t.value!==this.value&&(this.value=t.value,s(this,X,vr).call(this,"input","change")))},mf=function(e,t){let i=this.items.length,a=J(e,this),l;if(a==="ArrowRight"||e.key==="ArrowDown")l=(t+1)%i;else if(a==="ArrowLeft"||e.key==="ArrowUp")l=(t-1+i)%i;else if(e.key==="Home")l=0;else if(e.key==="End")l=i-1;else if(e.key===" "||e.key==="Enter")l=t;else return;e.preventDefault(),s(this,X,up).call(this,l)},pf=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let i=/^#?[0-9a-f]{6}$/i.test(t.trim())?Zt(t):null;i&&i!==this.value&&(f(this,Ya,i),this.value=i,s(this,X,vr).call(this,"input")),this._invalid&&(i||!t.trim())&&(this._invalid=!1)},gp=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?Zt(e):"";if(t===null){this._invalid=!0;return}let i=this.value;this.value=t,this._draft=void 0,this._invalid=!1,t!==i&&s(this,X,vr).call(this,"input"),s(this,X,vr).call(this,"change")},uf=function(e){e.stopPropagation(),s(this,X,gp).call(this)},gf=function(e){e.key==="Enter"&&s(this,X,gp).call(this)},ff=function(e){e.stopPropagation();let t=Zt(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,s(this,X,vr).call(this,"input"))},bf=function(e){e.stopPropagation(),s(this,X,vr).call(this,"change")},Ci.formAssociated=!0,Ci.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Ci.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}},Ci.styles=[E,Je,x`
|
|
1128
1130
|
:host { display: block; }
|
|
1129
1131
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
1130
1132
|
.swatch {
|
|
@@ -1163,18 +1165,18 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1163
1165
|
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
1164
1166
|
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
1165
1167
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
1166
|
-
`];$("cm-color-field"
|
|
1168
|
+
`];$("cm-color-field",Ci);var H$=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."}),fp=3,nh=.7,Cy=.0055,oh="#000000",vf=8,Vo=2,Sy=400,Ly=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),st,Ko,Xa,Wo,nt,ot,lt,Li,Di,_e,Go,Ai,Ja,C,bp,lh,vp,Qt,ch,yp,xp,yf,wp,dh,$p,hh,xf,kp,wf,yr,mh,Ep,Mp,$f,Tp,kf,zp,Ef,Mf,Si=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,st,this.attachInternals());p(this,Ko,R("cm-sig"));p(this,Xa,"");p(this,Wo,"");p(this,nt,[]);p(this,ot);p(this,lt);p(this,Li,"");p(this,Di,0);p(this,_e);p(this,Go,"");p(this,Ai);p(this,Ja,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?s(this,C,bp).call(this):(f(this,Xa,this.value),f(this,Wo,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),r(this,Ai)?.disconnect(),f(this,Ai,void 0),cancelAnimationFrame(r(this,Di)),f(this,Di,0),r(this,_e)&&(clearTimeout(r(this,_e)),f(this,_e,void 0))}get form(){return r(this,st).form}get validity(){return r(this,st).validity}get validationMessage(){return r(this,st).validationMessage}checkValidity(){return r(this,st).checkValidity()}reportValidity(){return r(this,st).reportValidity()}formResetCallback(){f(this,nt,[]),f(this,ot,void 0),f(this,lt,void 0),r(this,_e)&&(clearTimeout(r(this,_e)),f(this,_e,void 0)),this.typedName=r(this,Wo),r(this,Xa)?(f(this,Li,""),this.value=r(this,Xa)):this.updateComplete.then(()=>s(this,C,yr).call(this,!1)),s(this,C,Qt).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!r(this,nt).length&&!r(this,lt)}toDataURL(){return s(this,C,Ep).call(this)?.toDataURL("image/png")??""}toBlob(){let e=s(this,C,Ep).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(f(this,nt,[]),f(this,ot,void 0),f(this,lt,void 0),s(this,C,Qt).call(this)),s(this,C,yr).call(this,!0)}undo(){this.mode==="draw"&&(r(this,nt).length?r(this,nt).pop():f(this,lt,void 0),f(this,ot,void 0),s(this,C,Qt).call(this),s(this,C,yr).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==r(this,Li)){let t=this.value??"";if(f(this,Li,t),f(this,nt,[]),f(this,ot,void 0),!t)f(this,lt,void 0),this.hasUpdated&&(this.typedName="");else{let i=new Image;i.addEventListener("load",()=>{r(this,lt)===i&&s(this,C,Qt).call(this)}),i.src=t,f(this,lt,i),this.mode="draw"}s(this,C,Qt).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();f(this,Li,t),this.value=t}}firstUpdated(){s(this,C,bp).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>s(this,C,yr).call(this,!1)),s(this,C,hh).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&s(this,C,hh).call(this),r(this,st).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,st).setValidity({customError:!0},this.error,t):this.required&&this.empty?r(this,st).setValidity({valueMissing:!0},this.t("required"),t):r(this,st).setValidity({})}render(){let e=r(this,Ko),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,nt).length&&!r(this,lt),m=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
1167
1169
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
1168
1170
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
1169
|
-
@click=${()=>s(this,C,
|
|
1171
|
+
@click=${()=>s(this,C,Mp).call(this,u,!0)} @keydown=${s(this,C,$f)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
1170
1172
|
${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}
|
|
1171
1173
|
<div class="bar">
|
|
1172
1174
|
<div class="tabs" role="tablist" part="tabs"
|
|
1173
1175
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
1174
1176
|
aria-label=${this.label?h:t||this.t("modes")}>${m("draw")}${m("type")}</div>
|
|
1175
1177
|
<div class="actions">
|
|
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,
|
|
1177
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,
|
|
1178
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,Ef)}>${this.t("undo")}</button>`:h}
|
|
1179
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,Mf)}>${this.t("clear")}</button>
|
|
1178
1180
|
</div>
|
|
1179
1181
|
</div>
|
|
1180
1182
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -1184,8 +1186,8 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1184
1186
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
1185
1187
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
1186
1188
|
aria-describedby=${[`${e}-instr`,a].filter(Boolean).join(" ")}
|
|
1187
|
-
@pointerdown=${s(this,C,
|
|
1188
|
-
@lostpointercapture=${s(this,C,
|
|
1189
|
+
@pointerdown=${s(this,C,yf)} @pointermove=${s(this,C,wp)} @pointerup=${s(this,C,dh)} @pointercancel=${s(this,C,dh)}
|
|
1190
|
+
@lostpointercapture=${s(this,C,dh)} @transitionend=${()=>s(this,C,ch).call(this)}></canvas>
|
|
1189
1191
|
</div>
|
|
1190
1192
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
1191
1193
|
</div>
|
|
@@ -1197,13 +1199,13 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1197
1199
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
1198
1200
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
1199
1201
|
aria-describedby=${a||h} ?disabled=${this.disabled}
|
|
1200
|
-
@input=${s(this,C,
|
|
1202
|
+
@input=${s(this,C,xf)} @change=${s(this,C,wf)} />
|
|
1201
1203
|
</div>
|
|
1202
1204
|
</div>
|
|
1203
1205
|
${i?c`<p class="error" id="${e}-err" role="alert">${i}</p>`:h}
|
|
1204
1206
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
1205
1207
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
1206
|
-
</div>`}};
|
|
1208
|
+
</div>`}};st=new WeakMap,Ko=new WeakMap,Xa=new WeakMap,Wo=new WeakMap,nt=new WeakMap,ot=new WeakMap,lt=new WeakMap,Li=new WeakMap,Di=new WeakMap,_e=new WeakMap,Go=new WeakMap,Ai=new WeakMap,Ja=new WeakMap,C=new WeakSet,bp=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,Ai)||(f(this,Ai,new ResizeObserver(()=>s(this,C,vp).call(this))),r(this,Ai).observe(e))},lh=function(){return this.renderRoot.querySelector("canvas")},vp=function(){let e=r(this,C,lh);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;f(this,Ja,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,ch).call(this)},Qt=function(){r(this,Di)||f(this,Di,requestAnimationFrame(()=>{f(this,Di,0),s(this,C,ch).call(this)}))},ch=function(){let e=r(this,C,lh);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,Ja);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||oh;s(this,C,yp).call(this,t,i,l,!0)},yp=function(e,t,i,a){let l=t/fp,d=r(this,lt);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,g=(t-u)/2,w=(l-v)/2;if(a&&!Ry(i,oh)){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,g,w,u,v)}else e.drawImage(d,g,w,u,v)}e.strokeStyle=i,e.fillStyle=i,e.lineCap="round",e.lineJoin="round";for(let m of r(this,nt))Dy(e,m,t)},xp=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}},yf=function(e){if(this.disabled||r(this,ot)||!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,xp).call(this,e,t.getBoundingClientRect())];f(this,ot,{id:e.pointerId,stroke:i}),r(this,nt).push(i),s(this,C,Qt).call(this)},wp=function(e){let t=r(this,ot);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,xp).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,Qt).call(this)},dh=function(e){let t=r(this,ot);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&s(this,C,wp).call(this,e),f(this,ot,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}s(this,C,Qt).call(this),s(this,C,yr).call(this,!0)}},$p=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},hh=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${r(this,C,$p)}`,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,yr).call(this,!1)},()=>{})},xf=function(e){e.stopPropagation(),r(this,_e)?clearTimeout(r(this,_e)):f(this,Go,this.value),this.typedName=e.target.value,f(this,_e,setTimeout(()=>s(this,C,kp).call(this),Sy)),s(this,C,hh).call(this)},kp=function(){r(this,_e)&&(clearTimeout(r(this,_e)),f(this,_e,void 0),this.value!==r(this,Go)&&s(this,C,mh).call(this))},wf=function(e){e.stopPropagation(),this.updateComplete.then(()=>s(this,C,kp).call(this))},yr=function(e){let t=this.empty?"":this.toDataURL(),i=t!==this.value;i&&(f(this,Li,t),this.value=t),this.requestUpdate(),e&&i&&s(this,C,mh).call(this)},mh=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}))},Ep=function(){if(this.empty)return;let e=Math.max(r(this,C,lh)?.clientWidth||r(this,Ja)||600,300),t=e/fp,i=document.createElement("canvas");i.width=Math.round(e*Vo),i.height=Math.round(t*Vo);let a=i.getContext("2d",{willReadFrequently:!0});if(a.scale(Vo,Vo),this.mode==="type"){let l=Math.min(t*.45,64),d=r(this,C,$p);a.font=`400 ${l}px ${d}`;let m=this.typedName.trim(),u=e-2*vf,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=oh,a.fillText(m,e/2,t*nh)}else s(this,C,yp).call(this,a,e,oh,!1);return Ay(i,vf*Vo)},Mp=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${r(this,Ko)}-tab-${e}`)?.focus()),e===this.mode))return;let i=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&s(this,C,vp).call(this),this.value!==i&&s(this,C,mh).call(this)})},$f=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,Mp).call(this,i,!0)},Tp=function(e){s(this,C,kf).call(this,this.t(e))},kf=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},zp=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()})},Ef=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),s(this,C,Tp).call(this,"undone"),s(this,C,zp).call(this,e)},Mf=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),s(this,C,Tp).call(this,"cleared"),s(this,C,zp).call(this,e)},Si.formAssociated=!0,Si.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Si.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}},Si.styles=[E,x`
|
|
1207
1209
|
:host { display: block; }
|
|
1208
1210
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1209
1211
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -1233,7 +1235,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1233
1235
|
.act:disabled { background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed; }
|
|
1234
1236
|
.panel:focus { outline: none; }
|
|
1235
1237
|
.pad {
|
|
1236
|
-
position: relative; width: 100%; aspect-ratio: ${
|
|
1238
|
+
position: relative; width: 100%; aspect-ratio: ${fp} / 1; overflow: hidden; container-type: inline-size;
|
|
1237
1239
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
1238
1240
|
}
|
|
1239
1241
|
.panel:focus-visible .pad, .pad:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
@@ -1244,15 +1246,15 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1244
1246
|
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 */
|
|
1245
1247
|
}
|
|
1246
1248
|
.line {
|
|
1247
|
-
position: absolute; inset-inline: var(--cm-space-12); top: ${
|
|
1249
|
+
position: absolute; inset-inline: var(--cm-space-12); top: ${nh*100}%; height: 0;
|
|
1248
1250
|
border-top: var(--cm-border-1) dashed var(--cm-border-input); pointer-events: none;
|
|
1249
1251
|
}
|
|
1250
1252
|
.here {
|
|
1251
|
-
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-
|
|
1253
|
+
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-nh)*100}% + 4px);
|
|
1252
1254
|
font-size: 12px; color: var(--cm-text-tertiary); pointer-events: none; user-select: none;
|
|
1253
1255
|
}
|
|
1254
1256
|
.typed {
|
|
1255
|
-
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-
|
|
1257
|
+
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-nh)*100}% - 0.18em);
|
|
1256
1258
|
width: calc(100% - 2 * var(--cm-space-12)); padding: 0; margin: 0;
|
|
1257
1259
|
font-family: var(--cm-signature-font, 'Dancing Script', 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', 'Brush Script MT', cursive);
|
|
1258
1260
|
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 */
|
|
@@ -1269,17 +1271,17 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1269
1271
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
1270
1272
|
|
|
1271
1273
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1272
|
-
`];function
|
|
1273
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1274
|
+
`];function Dy(o,n,e){let t=d=>e*Cy*(.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=Ly(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 Ay(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 g=v*e*4;for(let w=0;w<e;w++)i[g+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 Ry(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",Si);var B$=z("optionGroup",{required:"Please select one of these options."}),pt,Yo,Za,Xo,Tt,_p,Cp,Tf,Mt=class extends T{constructor(){super(...arguments);p(this,Tt);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];p(this,pt,this.attachInternals());p(this,Yo,R("cm-og"));p(this,Za,"");p(this,Xo,new MutationObserver(()=>s(this,Tt,_p).call(this)))}connectedCallback(){super.connectedCallback(),s(this,Tt,_p).call(this),r(this,Xo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Xo).disconnect()}get form(){return r(this,pt).form}get validity(){return r(this,pt).validity}get validationMessage(){return r(this,pt).validationMessage}checkValidity(){return r(this,pt).checkValidity()}reportValidity(){return r(this,pt).reportValidity()}formResetCallback(){this.value=r(this,Za)}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,Za)||f(this,Za,this.value)}updated(){r(this,pt).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,pt).setValidity({valueMissing:!0},this.t("required"),e):r(this,pt).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`
|
|
1275
|
+
${this.label?c`<span class="label" id="${r(this,Yo)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1274
1276
|
<div class="options" part="options" role="radiogroup"
|
|
1275
|
-
aria-labelledby=${this.label?`${r(this,
|
|
1277
|
+
aria-labelledby=${this.label?`${r(this,Yo)}-l`:h} aria-label=${!this.label&&a?a:h}
|
|
1276
1278
|
aria-required=${this.required?"true":h}>
|
|
1277
1279
|
${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"}
|
|
1278
1280
|
tabindex=${d===i?"0":"-1"} ?disabled=${this.disabled||!!l.disabled}
|
|
1279
|
-
@click=${()=>s(this
|
|
1281
|
+
@click=${()=>s(this,Tt,Cp).call(this,d)} @keydown=${m=>s(this,Tt,Tf).call(this,m,d)}>${l.label}</button>`)}
|
|
1280
1282
|
</div>
|
|
1281
1283
|
<slot></slot>
|
|
1282
|
-
`}};
|
|
1284
|
+
`}};pt=new WeakMap,Yo=new WeakMap,Za=new WeakMap,Xo=new WeakMap,Tt=new WeakSet,_p=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},a=t.getAttribute("tone");return(a==="critical"||a==="success")&&(i.tone=a),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",f(this,Za,this.value))},Cp=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}))))},Tf=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,Tt,Cp).call(this,d)},Mt.formAssociated=!0,Mt.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},Mt.styles=[E,x`
|
|
1283
1285
|
:host { display: block; }
|
|
1284
1286
|
.label {
|
|
1285
1287
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1311,7 +1313,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1311
1313
|
}
|
|
1312
1314
|
slot { display: none; }
|
|
1313
1315
|
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
1314
|
-
`];$("cm-option-group",
|
|
1316
|
+
`];$("cm-option-group",Mt);var G$=z("segmentedControl",{required:"Please select one of these options."}),Qa=class extends Mt{constructor(){super(...arguments);this.size="default"}};Qa.properties={...Mt.properties,size:{reflect:!0}},Qa.styles=[E,x`
|
|
1315
1317
|
:host { display: inline-block; vertical-align: middle; max-width: 100%; --_h: var(--cm-control-height-md, 36px); }
|
|
1316
1318
|
:host([size='small']) { --_h: var(--cm-control-height-sm, 32px); }
|
|
1317
1319
|
@media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
|
|
@@ -1341,7 +1343,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1341
1343
|
button[aria-checked='true']:disabled { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
1342
1344
|
:host([disabled]) .options { background: var(--cm-bg-input-filled); }
|
|
1343
1345
|
slot { display: none; }
|
|
1344
|
-
`];$("cm-segmented-control",
|
|
1346
|
+
`];$("cm-segmented-control",Qa);var Q$=z("pageHeader",{back:"Back to {label}",backOnly:"Back",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),Jo,Sp,es=class extends T{constructor(){super(...arguments);p(this,Jo);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">
|
|
1345
1347
|
<div class=${this.description?"lead described":"lead"}>
|
|
1346
1348
|
${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}
|
|
1347
1349
|
<div class="titles">
|
|
@@ -1355,12 +1357,12 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1355
1357
|
</div>
|
|
1356
1358
|
<div class="actions">
|
|
1357
1359
|
${this.pagination?c`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
1358
|
-
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,
|
|
1359
|
-
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,
|
|
1360
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,Jo,Sp).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
1361
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,Jo,Sp).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
1360
1362
|
</div>`:h}
|
|
1361
1363
|
<slot name="actions"></slot>
|
|
1362
1364
|
</div>
|
|
1363
|
-
</header>`}};
|
|
1365
|
+
</header>`}};Jo=new WeakSet,Sp=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},es.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"}},es.styles=[E,x`
|
|
1364
1366
|
:host { display: block; }
|
|
1365
1367
|
header {
|
|
1366
1368
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-12) var(--cm-space-20);
|
|
@@ -1381,6 +1383,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1381
1383
|
nav [aria-current] { color: var(--cm-text-default); }
|
|
1382
1384
|
h1 {
|
|
1383
1385
|
display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-4) var(--cm-space-8); margin: 0; min-width: 0;
|
|
1386
|
+
font-family: var(--cm-font-display, inherit);
|
|
1384
1387
|
font-size: var(--cm-type-heading-lg-size); font-weight: var(--cm-type-heading-lg-weight); line-height: var(--cm-type-heading-lg-line-height);
|
|
1385
1388
|
}
|
|
1386
1389
|
/* Badges in title-adornment wrap below the title only when title and badges don't fit on one line (flex-wrap breaks
|
|
@@ -1417,7 +1420,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1417
1420
|
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
1418
1421
|
.actions { gap: var(--cm-space-8); }
|
|
1419
1422
|
}
|
|
1420
|
-
`];$("cm-page-header",
|
|
1423
|
+
`];$("cm-page-header",es);var s1=z("actionBar",{label:"Actions"}),ts=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")}>
|
|
1421
1424
|
<div class="lead">
|
|
1422
1425
|
${e?c`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:h}
|
|
1423
1426
|
<div class="text">
|
|
@@ -1427,7 +1430,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1427
1430
|
</div>
|
|
1428
1431
|
</div>
|
|
1429
1432
|
<div class="actions"><slot name="actions"></slot></div>
|
|
1430
|
-
</div>`}};
|
|
1433
|
+
</div>`}};ts.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},ts.styles=[E,x`
|
|
1431
1434
|
:host { display: block; }
|
|
1432
1435
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
1433
1436
|
.bar {
|
|
@@ -1458,13 +1461,13 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1458
1461
|
|
|
1459
1462
|
.actions { gap: var(--cm-space-8); }
|
|
1460
1463
|
}
|
|
1461
|
-
`];$("cm-action-bar",
|
|
1464
|
+
`];$("cm-action-bar",ts);var d1=z("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),zt,xr,Zo,Ce,Lp,Dp,Ap,zf,_f,is=class extends T{constructor(){super(...arguments);p(this,Ce);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";p(this,zt,null);p(this,xr,()=>{this.open=!0});p(this,Zo,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>s(this,Ce,Lp).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,Ce,Dp).call(this)}updated(e){e.has("form")&&this.isConnected&&s(this,Ce,Lp).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1462
1465
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1463
1466
|
<div class="actions">
|
|
1464
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,
|
|
1465
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,
|
|
1467
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,Ce,_f)}>${this.discardLabel}</cm-button>
|
|
1468
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,Ce,zf)}>${this.saveLabel}</cm-button>
|
|
1466
1469
|
</div>
|
|
1467
|
-
</div>`}};
|
|
1470
|
+
</div>`}};zt=new WeakMap,xr=new WeakMap,Zo=new WeakMap,Ce=new WeakSet,Lp=function(){s(this,Ce,Dp).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(f(this,zt,e),e.addEventListener("input",r(this,xr)),e.addEventListener("change",r(this,xr)),e.addEventListener("reset",r(this,Zo)))},Dp=function(){let e=r(this,zt);e&&(e.removeEventListener("input",r(this,xr)),e.removeEventListener("change",r(this,xr)),e.removeEventListener("reset",r(this,Zo)),f(this,zt,null))},Ap=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},zf=function(){this.loading||this.saveDisabled||s(this,Ce,Ap).call(this,"cm-save")&&r(this,zt)&&r(this,zt).requestSubmit()},_f=function(){this.loading||s(this,Ce,Ap).call(this,"cm-discard")&&r(this,zt)&&(r(this,zt).reset(),this.open=!1)},is.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:{}},is.styles=[E,x`
|
|
1468
1471
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1469
1472
|
:host(:not([open])) { display: none; }
|
|
1470
1473
|
.bar {
|
|
@@ -1480,14 +1483,14 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1480
1483
|
.message { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; }
|
|
1481
1484
|
|
|
1482
1485
|
}
|
|
1483
|
-
`];$("cm-save-bar",
|
|
1486
|
+
`];$("cm-save-bar",is);var f1=z("infoItem",{edit:"Edit {label}"}),rs=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}>
|
|
1484
1487
|
${this.heading||this.action?c`<header>
|
|
1485
1488
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
1486
1489
|
${this.action?c`<button class="action" type="button" part="action" aria-label=${this.actionLabel||h}
|
|
1487
1490
|
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h}
|
|
1488
1491
|
</header>`:h}
|
|
1489
1492
|
<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>
|
|
1490
|
-
</section>`}};
|
|
1493
|
+
</section>`}};rs.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},layout:{reflect:!0},_list:{state:!0}},rs.styles=[E,x`
|
|
1491
1494
|
:host { display: block; }
|
|
1492
1495
|
section {
|
|
1493
1496
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -1512,9 +1515,9 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1512
1515
|
display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: baseline;
|
|
1513
1516
|
column-gap: var(--cm-space-12); grid-column: 1 / -1; --_cm-info-value-gap: 0px;
|
|
1514
1517
|
}
|
|
1515
|
-
`];$("cm-info-panel",
|
|
1518
|
+
`];$("cm-info-panel",rs);var as=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"
|
|
1516
1519
|
aria-label=${this.editLabel||this.t("edit",{label:this.label})}
|
|
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}`}};
|
|
1520
|
+
@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}`}};as.properties={label:{},half:{type:Boolean,reflect:!0},editable:{type:Boolean,reflect:!0},editLabel:{attribute:"edit-label"}},as.styles=[E,x`
|
|
1518
1521
|
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
1519
1522
|
:host([half]) { grid-column: auto; }
|
|
1520
1523
|
.label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
|
|
@@ -1533,16 +1536,16 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1533
1536
|
.edit:hover { background: var(--cm-bg-hover); color: var(--cm-icon-selected); }
|
|
1534
1537
|
.edit:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1535
1538
|
@media (pointer: coarse) { .edit::after { content: ''; position: absolute; inset: -8px; } }
|
|
1536
|
-
`];$("cm-info-item",
|
|
1539
|
+
`];$("cm-info-item",as);var wr,ss=class extends S{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;p(this,wr,R("cm-accordion"))}toggle(){this.disabled||(this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{bubbles:!0,composed:!0,detail:{open:this.open}})))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||3));return c`<div class="wrap" part="accordion">
|
|
1537
1540
|
<div class="h" role="heading" aria-level=${e}>
|
|
1538
|
-
<button type="button" part="toggle" id="${r(this,
|
|
1541
|
+
<button type="button" part="toggle" id="${r(this,wr)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,wr)}-body"
|
|
1539
1542
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
1540
1543
|
<span>${this.heading}</span>
|
|
1541
1544
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
1542
1545
|
</button>
|
|
1543
1546
|
</div>
|
|
1544
|
-
<div class="body" part="body" id="${r(this,
|
|
1545
|
-
</div>`}};
|
|
1547
|
+
<div class="body" part="body" id="${r(this,wr)}-body" role="region" aria-labelledby="${r(this,wr)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
1548
|
+
</div>`}};wr=new WeakMap,ss.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},ss.styles=[E,x`
|
|
1546
1549
|
:host { display: block; }
|
|
1547
1550
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
1548
1551
|
.h { margin: 0; font: inherit; }
|
|
@@ -1565,24 +1568,24 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1565
1568
|
.body[hidden] { display: none; }
|
|
1566
1569
|
|
|
1567
1570
|
|
|
1568
|
-
`];$("cm-accordion",
|
|
1571
|
+
`];$("cm-accordion",ss);var Ne,$r,Rp,Cf,ns=class extends S{constructor(){super(...arguments);p(this,Ne);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,Ne,Cf).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">
|
|
1569
1572
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1570
|
-
<slot name="image" @slotchange=${i=>s(this,
|
|
1573
|
+
<slot name="image" @slotchange=${i=>s(this,Ne,$r).call(this,i,"hasImage")}>${t}</slot>
|
|
1571
1574
|
</div>
|
|
1572
1575
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1573
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,
|
|
1574
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,
|
|
1575
|
-
</div>`}};
|
|
1576
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},
|
|
1576
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,Ne,$r).call(this,i,"hasText")}></slot></div>
|
|
1577
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,Ne,$r).call(this,i,"hasActions")}></slot></div>${this.action?c`<div class="actions">${s(this,Ne,Rp).call(this)}</div>`:h}
|
|
1578
|
+
</div>`}};Ne=new WeakSet,$r=function(e,t){let i=e.target;this[t]=i.assignedNodes({flatten:!0}).some(a=>a.nodeType===1||a.textContent.trim()),this.requestUpdate()},Rp=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"
|
|
1579
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},Cf=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">
|
|
1577
1580
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1578
|
-
<slot name="image" @slotchange=${i=>s(this,
|
|
1581
|
+
<slot name="image" @slotchange=${i=>s(this,Ne,$r).call(this,i,"hasImage")}>${t}</slot>
|
|
1579
1582
|
</span>
|
|
1580
1583
|
<div class="line">
|
|
1581
1584
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1582
|
-
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,
|
|
1583
|
-
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,
|
|
1585
|
+
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,Ne,$r).call(this,i,"hasText")}></slot></span>${s(this,Ne,Rp).call(this)}
|
|
1586
|
+
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,Ne,$r).call(this,i,"hasActions")}></slot></span>
|
|
1584
1587
|
</div>
|
|
1585
|
-
</div>`},
|
|
1588
|
+
</div>`},ns.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0},action:{},actionHref:{attribute:"action-href"}},ns.styles=[E,x`
|
|
1586
1589
|
:host { display: block; }
|
|
1587
1590
|
/* 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. */
|
|
1588
1591
|
.wrap {
|
|
@@ -1631,7 +1634,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1631
1634
|
:host([size='large']) .circle { width: 120px; height: 120px; }
|
|
1632
1635
|
:host([size='large']) .title { margin-top: var(--cm-space-16); }
|
|
1633
1636
|
}
|
|
1634
|
-
`];$("cm-empty-state",
|
|
1637
|
+
`];$("cm-empty-state",ns);var Sf={small:34,medium:40,large:50,xlarge:186},os=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=Sf[this.size]??Sf.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>`)}`}};os.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},os.styles=[E,x`
|
|
1635
1638
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
1636
1639
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
1637
1640
|
.bone {
|
|
@@ -1646,17 +1649,17 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1646
1649
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
1647
1650
|
}
|
|
1648
1651
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
1649
|
-
`];$("cm-skeleton",
|
|
1652
|
+
`];$("cm-skeleton",os);var Hy=[472,90,90,251],Ny=[94,266,134,191,138],ls=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">
|
|
1650
1653
|
<span class="sr" role="status">${this.label}</span>
|
|
1651
1654
|
<div class="page" aria-hidden="true">
|
|
1652
1655
|
${this.navigation?c`<span class="bone nav"></span>`:h}
|
|
1653
1656
|
<span class="bone head"></span>
|
|
1654
1657
|
<div class="body">
|
|
1655
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
1656
|
-
<div class="col side">${e(
|
|
1658
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:Hy)}</div>
|
|
1659
|
+
<div class="col side">${e(Ny)}</div>
|
|
1657
1660
|
</div>
|
|
1658
1661
|
</div>
|
|
1659
|
-
</div>`}};
|
|
1662
|
+
</div>`}};ls.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},ls.styles=[E,x`
|
|
1660
1663
|
:host { display: block; }
|
|
1661
1664
|
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-8); }
|
|
1662
1665
|
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
@@ -1680,11 +1683,11 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1680
1683
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
1681
1684
|
.head { height: 60px; }
|
|
1682
1685
|
}
|
|
1683
|
-
`];$("cm-skeleton-display",
|
|
1686
|
+
`];$("cm-skeleton-display",ls);var N1=z("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),ph,Lf,cs=class extends T{constructor(){super(...arguments);p(this,ph);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,ph,Lf).call(this);return c`<article part="comment">
|
|
1684
1687
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
1685
1688
|
<div class="body" part="body"><slot></slot></div>
|
|
1686
1689
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
1687
|
-
</article>`}};
|
|
1690
|
+
</article>`}};ph=new WeakSet,Lf=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)},cs.properties={author:{},datetime:{},time:{}},cs.styles=[E,x`
|
|
1688
1691
|
:host { display: block; }
|
|
1689
1692
|
article {
|
|
1690
1693
|
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
@@ -1692,16 +1695,16 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1692
1695
|
}
|
|
1693
1696
|
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
1694
1697
|
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
1695
|
-
`];$("cm-comment",
|
|
1696
|
-
<div class="title" id="${r(this,
|
|
1698
|
+
`];$("cm-comment",cs);var Qo,uh,Df,ds=class extends T{constructor(){super(...arguments);p(this,uh);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;p(this,Qo,R("cm-comment-box"));this.hasComments=!1}submit(){let e=this.renderRoot.querySelector("textarea"),t=(e?.value??this.value).trim();if(this.disabled)return;if(!t){e?.focus();return}let i=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(i)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="comment-box" aria-labelledby="${r(this,Qo)}-h">
|
|
1699
|
+
<div class="title" id="${r(this,Qo)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1697
1700
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
1698
1701
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
1699
|
-
@keydown=${s(this,
|
|
1702
|
+
@keydown=${s(this,uh,Df)}></textarea>
|
|
1700
1703
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
1701
1704
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
1702
1705
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
1703
1706
|
</div>
|
|
1704
|
-
</section>`}};
|
|
1707
|
+
</section>`}};Qo=new WeakMap,uh=new WeakSet,Df=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},ds.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},ds.styles=[E,x`
|
|
1705
1708
|
:host { display: block; }
|
|
1706
1709
|
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
1707
1710
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1721,8 +1724,8 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1721
1724
|
|
|
1722
1725
|
.actions { justify-content: flex-end; }
|
|
1723
1726
|
}
|
|
1724
|
-
`];$("cm-comment-box",
|
|
1725
|
-
data-side=${this._side}>${this.content}</div>`}};be=new WeakMap,
|
|
1727
|
+
`];$("cm-comment-box",ds);var gh='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',be,ms,Ri,Hi,ei,ps,us,Ue,Hp,fh,bh,vh,yh,gs,Af,kr,Np,Ip,ti,hs=class extends S{constructor(){super(...arguments);p(this,Ue);this.content="";this.placement="top";this.delay=400;this.open=!1;this.visualOnly=!1;this._side="top";p(this,be);p(this,ms);p(this,Ri,[]);p(this,Hi);p(this,ei);p(this,ps,!1);p(this,us,!1);p(this,fh,()=>{f(this,ps,!0),clearTimeout(r(this,ei)),this.open||f(this,ei,setTimeout(()=>this.show(),this.delay))});p(this,bh,()=>{f(this,ps,!1),clearTimeout(r(this,ei)),r(this,us)||this.hide()});p(this,vh,()=>{f(this,us,!0),this.show()});p(this,yh,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(f(this,us,!1),r(this,ps)||this.hide())});p(this,gs,e=>{e.key==="Escape"&&this.open&&this.hide()});p(this,kr,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(s(this,Ue,Ip).call(this),!t||!this.content||this.visualOnly)return;let i=t.updateComplete;t.localName.includes("-")&&i&&!t.shadowRoot?.querySelector(gh)&&i.then(()=>{t.shadowRoot?.querySelector(gh)&&r(this,kr).call(this)}),r(this,be)||(f(this,be,document.createElement("span")),r(this,be).id=R("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,Ue,Af).call(this,t);if(f(this,ms,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,Ue,Np).call(this,a),f(this,Hi,new MutationObserver(()=>{a.getAttribute("aria-describedby")!==""&&s(this,Ue,Np).call(this,a)})),r(this,Hi).observe(a,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,be).id)});p(this,ti,()=>{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,g=getComputedStyle(this).direction==="rtl",w=K=>K==="start"?g?"right":"left":K==="end"?g?"left":"right":K,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"},L=w(this.placement);!y[L]&&y[k[L]]&&(L=k[L]);let A,O;L==="top"||L==="bottom"?(A=a.left+a.width/2-l.width/2,O=L==="top"?a.top-d-l.height:a.bottom+d):(O=a.top+a.height/2-l.height/2,A=L==="left"?a.left-d-l.width:a.right+d),A=Math.min(Math.max(m,A),u-m-l.width),O=Math.min(Math.max(m,O),v-m-l.height),e.style.transform=`translate(${Math.round(A)}px, ${Math.round(O)}px)`;let B={top:"top",bottom:"bottom",left:g?"end":"start",right:g?"start":"end"};this._side=B[L]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,fh)),this.addEventListener("pointerleave",r(this,bh)),this.addEventListener("focusin",r(this,vh)),this.addEventListener("focusout",r(this,yh)),this.addEventListener("keydown",r(this,gs)),this.hasUpdated&&r(this,kr).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),s(this,Ue,Ip).call(this),s(this,Ue,Hp).call(this),clearTimeout(r(this,ei))}show(){clearTimeout(r(this,ei)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,gs),!0),addEventListener("scroll",r(this,ti),!0),addEventListener("resize",r(this,ti)),this.updateComplete.then(r(this,ti)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,ei)),this.open&&(this.open=!1,s(this,Ue,Hp).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,kr).call(this),this.content?this.open&&r(this,ti).call(this):this.hide())}render(){return c`<slot @slotchange=${r(this,kr)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1728
|
+
data-side=${this._side}>${this.content}</div>`}};be=new WeakMap,ms=new WeakMap,Ri=new WeakMap,Hi=new WeakMap,ei=new WeakMap,ps=new WeakMap,us=new WeakMap,Ue=new WeakSet,Hp=function(){document.removeEventListener("keydown",r(this,gs),!0),removeEventListener("scroll",r(this,ti),!0),removeEventListener("resize",r(this,ti))},fh=new WeakMap,bh=new WeakMap,vh=new WeakMap,yh=new WeakMap,gs=new WeakMap,Af=function(e){return e.matches(gh)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(gh)??e},kr=new WeakMap,Np=function(e){f(this,Ri,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),i=r(this,Ri).map(a=>t.getElementById(a)).filter(a=>!!a);e.ariaDescribedByElements=[...i,r(this,be)]},Ip=function(){let e=r(this,ms);if(!(!e||!r(this,be))){if(r(this,Hi))r(this,Hi).disconnect(),f(this,Hi,void 0),r(this,Ri).length?e.setAttribute("aria-describedby",r(this,Ri).join(" ")):e.removeAttribute("aria-describedby"),f(this,Ri,[]);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")}f(this,ms,void 0)}},ti=new WeakMap,hs.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},hs.styles=[E,x`
|
|
1726
1729
|
:host { display: inline-block; position: relative; }
|
|
1727
1730
|
.tip {
|
|
1728
1731
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -1739,7 +1742,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1739
1742
|
:host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
1740
1743
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1741
1744
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1742
|
-
`];$("cm-tooltip",
|
|
1745
|
+
`];$("cm-tooltip",hs);var K1=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"}),W1=z("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),Iy=7,el=new Set,tl;function Rf(o,n){n?el.add(o):el.delete(o),el.size&&!tl&&(tl=setInterval(()=>el.forEach(e=>e.requestUpdate()),6e4)),!el.size&&tl&&(clearInterval(tl),tl=void 0)}var il,Mr,ut,Pp,xh,Hf,fs=class extends T{constructor(){super(...arguments);p(this,ut);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,il,R("cm-tl"));p(this,Mr)}connectedCallback(){super.connectedCallback(),Rf(this,!0)}disconnectedCallback(){super.disconnectedCallback(),Rf(this,!1),r(this,Mr)?.disconnect(),f(this,Mr,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(f(this,Mr,new ResizeObserver(()=>s(this,ut,Pp).call(this))),r(this,Mr).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&s(this,ut,Pp).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<Iy?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">
|
|
1743
1746
|
<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>
|
|
1744
1747
|
<div class="main">
|
|
1745
1748
|
<div class="head">
|
|
@@ -1747,14 +1750,14 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1747
1750
|
<slot name="badge"></slot></span>
|
|
1748
1751
|
${l}
|
|
1749
1752
|
</div>
|
|
1750
|
-
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,
|
|
1751
|
-
<div class="body ${a?"clamp":""}" id="${r(this,
|
|
1752
|
-
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,
|
|
1753
|
+
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,ut,xh).call(this,d,"_meta")}>${this.meta}</slot></div>
|
|
1754
|
+
<div class="body ${a?"clamp":""}" id="${r(this,il)}-body" part="body" ?hidden=${!this._body}
|
|
1755
|
+
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,ut,xh).call(this,d,"_body")}></slot></div>
|
|
1753
1756
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
1754
|
-
aria-controls="${r(this,
|
|
1755
|
-
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,
|
|
1757
|
+
aria-controls="${r(this,il)}-body" @click=${s(this,ut,Hf)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
1758
|
+
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,ut,xh).call(this,d,"_actions")}></slot></div>
|
|
1756
1759
|
</div>
|
|
1757
|
-
</div>`}};
|
|
1760
|
+
</div>`}};il=new WeakMap,Mr=new WeakMap,ut=new WeakSet,Pp=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},xh=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(a=>a.nodeType===Node.ELEMENT_NODE||(a.textContent??"").trim())},Hf=function(){this.expanded=!this.expanded},fs.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}},fs.styles=[E,x`
|
|
1758
1761
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
1759
1762
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
1760
1763
|
.icon {
|
|
@@ -1799,16 +1802,16 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1799
1802
|
[hidden] { display: none !important; }
|
|
1800
1803
|
.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; }
|
|
1801
1804
|
::slotted([slot='badge']) { flex: none; }
|
|
1802
|
-
`];$("cm-timeline-item",
|
|
1805
|
+
`];$("cm-timeline-item",fs);var rl,bs,Tr,Op,Nf,Er=class extends T{constructor(){super(...arguments);p(this,Tr);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];p(this,rl,new MutationObserver(()=>s(this,Tr,Op).call(this)));p(this,bs,!1)}connectedCallback(){super.connectedCallback(),s(this,Tr,Op).call(this),r(this,rl).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,rl).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){f(this,bs,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,bs)&&!this.renderRoot.querySelector(".more cm-button")&&(f(this,bs,!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">
|
|
1803
1806
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
1804
1807
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
1805
1808
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
1806
1809
|
</ol>`:h}
|
|
1807
1810
|
${i}
|
|
1808
1811
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
1809
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,
|
|
1812
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,Tr,Nf)}>${this.moreLabel}</cm-button></div>`:h}
|
|
1810
1813
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
1811
|
-
`}};
|
|
1814
|
+
`}};rl=new WeakMap,bs=new WeakMap,Tr=new WeakSet,Op=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},Nf=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},Er.shadowRootOptions={...S.shadowRootOptions,slotAssignment:"manual"},Er.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}},Er.styles=[E,x`
|
|
1812
1815
|
:host { display: block; }
|
|
1813
1816
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
1814
1817
|
ol:focus { outline: none; }
|
|
@@ -1831,14 +1834,14 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1831
1834
|
@media (max-width: 640px) {
|
|
1832
1835
|
.more { padding-inline-start: 0; }
|
|
1833
1836
|
}
|
|
1834
|
-
`];$("cm-timeline",
|
|
1837
|
+
`];$("cm-timeline",Er);var Q1=z("smartTip",{newTab:"(opens in a new tab)"}),ek=z("smartTips",{heading:"Smart tips",tourAction:"Start"}),vs=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}>
|
|
1835
1838
|
<span class="text">
|
|
1836
1839
|
<span class="title" part="heading">${this.heading}</span>
|
|
1837
1840
|
<span class="desc" part="description"><slot></slot></span>
|
|
1838
1841
|
${e?c`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">${this.t("newTab")}</span>`:h}
|
|
1839
1842
|
</span>
|
|
1840
1843
|
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
1841
|
-
</a>`}};
|
|
1844
|
+
</a>`}};vs.properties={heading:{},href:{},target:{}},vs.styles=[E,x`
|
|
1842
1845
|
:host { display: block; }
|
|
1843
1846
|
a {
|
|
1844
1847
|
display: flex; align-items: flex-start; gap: var(--cm-space-8); padding: var(--cm-space-16);
|
|
@@ -1855,7 +1858,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1855
1858
|
}
|
|
1856
1859
|
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
1857
1860
|
a:hover .title { text-decoration: underline; }
|
|
1858
|
-
`];$("cm-smart-tip",
|
|
1861
|
+
`];$("cm-smart-tip",vs);var ys=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">
|
|
1859
1862
|
${this.tourHeading?c`<div class="tour" part="tour">
|
|
1860
1863
|
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="16"></cm-icon>
|
|
1861
1864
|
</span>
|
|
@@ -1866,7 +1869,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1866
1869
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1867
1870
|
<div class="list" role="list"><slot></slot></div>
|
|
1868
1871
|
</section>
|
|
1869
|
-
</div>`}};
|
|
1872
|
+
</div>`}};ys.properties={heading:{string:"heading"},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action",string:"tourAction"},headingLevel:{type:Number,attribute:"heading-level"}},ys.styles=[E,x`
|
|
1870
1873
|
:host { display: block; }
|
|
1871
1874
|
.card { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1872
1875
|
.tour {
|
|
@@ -1883,24 +1886,24 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1883
1886
|
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;
|
|
1884
1887
|
}
|
|
1885
1888
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1886
|
-
`];$("cm-smart-tips",
|
|
1889
|
+
`];$("cm-smart-tips",ys);var sk=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"}),ii,ws,If,Pf,xs=class extends T{constructor(){super(...arguments);p(this,ws);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;p(this,ii,R("cm-pg"))}get pageCount(){return Math.max(1,Math.ceil((this.total||0)/Math.max(1,this.pageSize)))}goTo(e){let t=Math.min(this.pageCount,Math.max(1,Math.round(e)||1));if(this._draft=null,t===this.page){this.requestUpdate();return}this.page=t,this.dispatchEvent(new CustomEvent("cm-page-change",{detail:{page:t},bubbles:!0,composed:!0}))}render(){let e=this.pageCount,t=Math.min(e,Math.max(1,this.page)),i=this.total?(t-1)*this.pageSize+1:0,a=Math.min(this.total,t*this.pageSize),l=this.pageSizes??[];return c`
|
|
1887
1890
|
<nav part="bar" aria-label=${this.label}>
|
|
1888
1891
|
${l.length?c`<div class="rows" part="rows">
|
|
1889
|
-
<label for="${r(this,
|
|
1890
|
-
<span class="field"><select id="${r(this,
|
|
1892
|
+
<label for="${r(this,ii)}-s">${this.t("rows")}</label>
|
|
1893
|
+
<span class="field"><select id="${r(this,ii)}-s" @change=${s(this,ws,If)}>
|
|
1891
1894
|
${(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>`)}
|
|
1892
1895
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
1893
1896
|
</div>`:h}
|
|
1894
1897
|
<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>
|
|
1895
1898
|
<div class="pages" part="pages">
|
|
1896
1899
|
<span class="counter">
|
|
1897
|
-
<label for="${r(this,
|
|
1898
|
-
<input id="${r(this,
|
|
1899
|
-
.value=${this._draft??String(t)} aria-describedby="${r(this,
|
|
1900
|
+
<label for="${r(this,ii)}-p">${this.t("page")}</label>
|
|
1901
|
+
<input id="${r(this,ii)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1902
|
+
.value=${this._draft??String(t)} aria-describedby="${r(this,ii)}-of"
|
|
1900
1903
|
@input=${d=>this._draft=d.target.value}
|
|
1901
|
-
@keydown=${s(this,
|
|
1904
|
+
@keydown=${s(this,ws,Pf)}
|
|
1902
1905
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
1903
|
-
<span id="${r(this,
|
|
1906
|
+
<span id="${r(this,ii)}-of">${this.t("of",{count:e})}</span>
|
|
1904
1907
|
</span>
|
|
1905
1908
|
<span class="arrows">
|
|
1906
1909
|
<button class="prev" type="button" part="previous" aria-label=${this.t("previous")} ?disabled=${t<=1}
|
|
@@ -1910,7 +1913,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1910
1913
|
</span>
|
|
1911
1914
|
</div>
|
|
1912
1915
|
</nav>
|
|
1913
|
-
`}};
|
|
1916
|
+
`}};ii=new WeakMap,ws=new WeakSet,If=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})))},Pf=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))},xs.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}},xs.styles=[E,x`
|
|
1914
1917
|
:host { display: block; }
|
|
1915
1918
|
nav {
|
|
1916
1919
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -1953,17 +1956,17 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1953
1956
|
select, input { height: var(--cm-control-height-touch); }
|
|
1954
1957
|
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
1955
1958
|
}
|
|
1956
|
-
`];$("cm-pagination",
|
|
1959
|
+
`];$("cm-pagination",xs);var hk=z("statusTabs",{label:"Status",option:"{label} ({count})"}),ks,sl,me,al,Of,qp,qf,Bp,Bf,$s=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,ks,new ResizeObserver(()=>s(this,me,al).call(this)));this._slotted=[];p(this,sl,new MutationObserver(()=>s(this,me,qp).call(this)))}connectedCallback(){super.connectedCallback(),s(this,me,qp).call(this),r(this,sl).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,sl).disconnect(),r(this,ks).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector(".tabs");r(this,ks).observe(e),e.addEventListener("scroll",()=>s(this,me,al).call(this),{passive:!0}),document.fonts?.ready.then(()=>s(this,me,al).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,al).call(this);for(let a of this.renderRoot.querySelectorAll(".tabs > *"))r(this,ks).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,qf).call(this,e),i=this.getAttribute("aria-label")||this.t("label");return c`
|
|
1957
1960
|
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${i}>
|
|
1958
1961
|
${e.map((a,l)=>c`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
1959
1962
|
tabindex=${l===t?"0":"-1"} ?disabled=${!!a.disabled}
|
|
1960
|
-
@click=${()=>s(this,me,
|
|
1963
|
+
@click=${()=>s(this,me,Bp).call(this,l)} @keydown=${d=>s(this,me,Bf).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>`)}
|
|
1961
1964
|
</div>
|
|
1962
|
-
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,me,
|
|
1965
|
+
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,me,Of)}>
|
|
1963
1966
|
${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>`)}
|
|
1964
1967
|
</select><cm-icon name="chevron-down" size="16"></cm-icon></div>`:h}
|
|
1965
1968
|
<slot></slot>
|
|
1966
|
-
`}};
|
|
1969
|
+
`}};ks=new WeakMap,sl=new WeakMap,me=new WeakSet,al=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)},Of=function(e){let t=e.target.value;t!==this.value&&(this.value=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},qp=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??"")},qf=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},Bp=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}))))},Bf=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,Bp).call(this,d)},$s.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},mobile:{reflect:!0},_slotted:{state:!0},_more:{state:!0}},$s.styles=[E,x`
|
|
1967
1970
|
:host { display: block; }
|
|
1968
1971
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
1969
1972
|
.tabs {
|
|
@@ -1983,7 +1986,7 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
1983
1986
|
}
|
|
1984
1987
|
button:hover:not(:disabled) { color: var(--cm-text-default); }
|
|
1985
1988
|
button[aria-selected='true'] { color: var(--cm-text-default); font-weight: 600; }
|
|
1986
|
-
button[aria-selected='true']::after { background: var(--cm-
|
|
1989
|
+
button[aria-selected='true']::after { background: var(--cm-tab-indicator); }
|
|
1987
1990
|
/* The chosen tab's bold label takes no extra room: each label reserves the width of its bold version. */
|
|
1988
1991
|
.label { display: inline-grid; }
|
|
1989
1992
|
.label::after { content: attr(data-text); content: attr(data-text) / ''; font-weight: 600; block-size: 0; overflow: hidden; visibility: hidden; }
|
|
@@ -2022,20 +2025,20 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
2022
2025
|
:host([mobile='select']) .tabs { display: none; }
|
|
2023
2026
|
:host([mobile='select']) .pick { display: block; }
|
|
2024
2027
|
}
|
|
2025
|
-
`];$("cm-status-tabs"
|
|
2028
|
+
`];$("cm-status-tabs",$s);var bk=z("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),wh,nl,ri,Fp,Ff,jf,Es=class extends T{constructor(){super(...arguments);p(this,ri);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;p(this,wh,R("cm-th"));p(this,nl,new MutationObserver(()=>s(this,ri,Fp).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),s(this,ri,Fp).call(this),r(this,nl).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,nl).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`
|
|
2026
2029
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
2027
2030
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
2028
2031
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
2029
|
-
<input id="${r(this,
|
|
2030
|
-
@change=${s(this,
|
|
2032
|
+
<input id="${r(this,wh)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
2033
|
+
@change=${s(this,ri,jf)} />
|
|
2031
2034
|
<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>
|
|
2032
2035
|
</span></span>`:h}
|
|
2033
2036
|
${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}
|
|
2034
|
-
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,
|
|
2037
|
+
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,ri,Ff).call(this,i)}>${d}${e?h:c`<span class="sr">${a?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
2035
2038
|
name=${a&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
2036
2039
|
</div>
|
|
2037
2040
|
<slot></slot>
|
|
2038
|
-
`}};
|
|
2041
|
+
`}};wh=new WeakMap,nl=new WeakMap,ri=new WeakSet,Fp=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"}})},Ff=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}))},jf=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}))},Es.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}},Es.styles=[E,x`
|
|
2039
2042
|
:host { display: block; }
|
|
2040
2043
|
slot { display: none; } /* <option> children are column data, not content */
|
|
2041
2044
|
.bar {
|
|
@@ -2087,10 +2090,10 @@ var qu=o=>{throw TypeError(o)};var Xh=(o,n,e)=>n.has(o)||qu("Cannot "+e);var r=(
|
|
|
2087
2090
|
:host([resource-rows='selectable']) .bar:not(.sel) { padding-inline-start: calc(var(--_rl) + 20px + var(--cm-space-8)); }
|
|
2088
2091
|
:host([resource-rows]) .bar.sel { grid-template-columns: calc(20px + var(--cm-space-8) - var(--cm-space-20)) var(--cm-table-columns, var(--_cols)); }
|
|
2089
2092
|
}
|
|
2090
|
-
`];$("cm-table-header",
|
|
2093
|
+
`];$("cm-table-header",Es);var Py=`
|
|
2091
2094
|
[data-cm-density="compact"] { --cm-table-row-height: 40px; --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
2092
2095
|
[data-cm-density="comfortable"] { --cm-table-row-height: 48px; --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
|
|
2093
|
-
|
|
2096
|
+
`,$h=null,Uf=new WeakSet;function kh(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(!Uf.has(t)){Uf.add(t);try{$h||($h=new CSSStyleSheet,$h.replaceSync(Py)),t.adoptedStyleSheets=[...t.adoptedStyleSheets,$h]}catch{}}}var Tk=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}"}),Vf=48,Kf=16,Wf=!1,Oy=`
|
|
2094
2097
|
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); }
|
|
2095
2098
|
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); }
|
|
2096
2099
|
cm-data-table > table th, cm-data-table > table td { box-sizing: border-box; }
|
|
@@ -2139,52 +2142,52 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2139
2142
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
|
|
2140
2143
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
|
|
2141
2144
|
}
|
|
2142
|
-
`;function
|
|
2145
|
+
`;function qy(){if(Wf||typeof document>"u")return;Wf=!0;let o=new CSSStyleSheet;o.replaceSync(Oy),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var ol=o=>o.type==="numeric"||o.type==="money",By=o=>(o.align??(ol(o)||o.type==="actions"?"end":"start"))==="end",Fy=o=>!o.type||o.type==="text";function Gf(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 Yf=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),Xf=new Map;function jy(o){let n=Xf.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"})}Xf.set(o??"",n)}return n}function Jf(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"?(Gf(o)||0)-(Gf(n)||0):e==="date"?(Yf(o)||0)-(Yf(n)||0):jy(t).compare(String(o),String(n))}var Zf=o=>o.parentElement??o.getRootNode().host??null,Ss,Ls,ll,Ds,zr,As,_r,_h,_,jp,Up,Vp,Qf,Kp,eb,tb,ib,Cr,Ms,Ts,Eh,zs,_s,Mh,Wp,Gp,Yp,rb,ab,Xp,Jp,Th,sb,nb,ob,Ni,zh,Rs,lb,cb,db,hb,mb,pb,ub,Cs=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,Ss,!1);p(this,Ls,R("cm-dt"));p(this,ll,new MutationObserver(()=>s(this,_,jp).call(this)));p(this,Ds,typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s(this,_,Ms).call(this)));p(this,zr,[]);p(this,As,0);p(this,_r,-1);p(this,_h,e=>{e.target?.closest?.("[data-lines]")&&s(this,_,Mh).call(this,e)});p(this,Cr,()=>{r(this,As)||!this.stickyHeader||f(this,As,requestAnimationFrame(()=>{f(this,As,0),s(this,_,Ms).call(this)}))});p(this,Ni,new $e);p(this,Rs,e=>{let t=this.renderRoot.querySelector(".tools");t&&!e.composedPath().includes(t)&&s(this,_,zh).call(this,!1)})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerover",r(this,_h)),kh(this),s(this,_,jp).call(this),r(this,ll).observe(this,{childList:!0,subtree:!0}),document.addEventListener("scroll",r(this,Cr),{capture:!0,passive:!0}),window.addEventListener("resize",r(this,Cr),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Ni).close(),r(this,ll).disconnect(),r(this,Ds)?.disconnect(),f(this,zr,[]),document.removeEventListener("scroll",r(this,Cr),{capture:!0}),window.removeEventListener("resize",r(this,Cr)),document.removeEventListener("pointerdown",r(this,Rs),{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],g=u==null||u==="",w=v==null||v==="";return g||w?g===w?l-m:g?1:-1:i*Jf(u,v,t.type,this.locale)||l-m}).map(([a])=>a)}get visibleColumns(){return(this.columns??[]).filter(e=>e.visible!==!1)}updated(e){if(this._picker&&!r(this,Ni).active?r(this,Ni).open(this.renderRoot.querySelector(".panel"),this.renderRoot.querySelector(".pick"),{align:"end"}):!this._picker&&r(this,Ni).active&&r(this,Ni).close(),r(this,Ss)&&(e.has("sort")||e.has("direction"))&&this.sort){f(this,Ss,!1);let t=this.columns.find(i=>i.key===this.sort);t&&s(this,_,Vp).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,_,ib).call(this),s(this,_,Ms).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}
|
|
2143
2146
|
role=${this._overflows?"region":h} aria-label=${this._overflows?this.querySelector("caption")?.textContent?.trim()||h:h}
|
|
2144
|
-
@scroll=${()=>s(this,_,
|
|
2147
|
+
@scroll=${()=>s(this,_,Ms).call(this)}><slot></slot></div>${i}</div>${t}</div>${e}`;let l=this.visibleColumns,d=s(this,_,Gp).call(this,l),m=this.mobile==="priority"?l.filter(y=>y.priority==="low"&&y!==d):[],u=this.sortedRows,v=Math.max(1,l.length),g=!this.loading&&u.length===0,w=this.mobile==="cards"&&!this.loading&&u.length>0;return c`
|
|
2145
2148
|
<div class="frame" part="frame" ?data-cards=${w}>
|
|
2146
|
-
${this.columnPicker?s(this,_,
|
|
2149
|
+
${this.columnPicker?s(this,_,db).call(this):h}
|
|
2147
2150
|
<div class="wrap">
|
|
2148
2151
|
<div class="scroll" part="scroll" tabindex=${a?"0":h}
|
|
2149
2152
|
role=${a?"region":h}
|
|
2150
|
-
aria-label=${a&&this.caption?this.caption:h} @scroll=${()=>s(this,_,
|
|
2151
|
-
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,_,
|
|
2152
|
-
@focusout=${s(this,_,
|
|
2153
|
+
aria-label=${a&&this.caption?this.caption:h} @scroll=${()=>s(this,_,Ms).call(this)}>
|
|
2154
|
+
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,_,Mh)} @focusin=${s(this,_,Wp)}
|
|
2155
|
+
@focusout=${s(this,_,Wp)}>
|
|
2153
2156
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
2154
|
-
<thead><tr>${l.map(y=>s(this,_,
|
|
2157
|
+
<thead><tr>${l.map(y=>s(this,_,hb).call(this,y,d))}</tr></thead>
|
|
2155
2158
|
<tbody>
|
|
2156
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,
|
|
2159
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,zs).call(this,y,d)} style=${s(this,_,_s).call(this,y)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((y,k)=>s(this,_,mb).call(this,y,l,d,m,k))}
|
|
2157
2160
|
${g?c`<tr class="empty"><td colspan=${v}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
2158
2161
|
</tbody>
|
|
2159
|
-
${this.totals&&!this.loading&&!g?c`<tfoot><tr part="totals">${l.map(y=>c`<td class=${s(this,_,
|
|
2162
|
+
${this.totals&&!this.loading&&!g?c`<tfoot><tr part="totals">${l.map(y=>c`<td class=${s(this,_,zs).call(this,y,d)} style=${s(this,_,_s).call(this,y)}>${y.type==="actions"?h:s(this,_,Ts).call(this,this.totals[y.key])}</td>`)}</tr></tfoot>`:h}
|
|
2160
2163
|
</table>
|
|
2161
2164
|
</div>
|
|
2162
2165
|
${i}
|
|
2163
2166
|
</div>
|
|
2164
2167
|
${t}
|
|
2165
|
-
${w?s(this,_,
|
|
2168
|
+
${w?s(this,_,ub).call(this,u,l,d):h}
|
|
2166
2169
|
</div>${e}
|
|
2167
|
-
`}};
|
|
2170
|
+
`}};Ss=new WeakMap,Ls=new WeakMap,ll=new WeakMap,Ds=new WeakMap,zr=new WeakMap,As=new WeakMap,_r=new WeakMap,_h=new WeakMap,_=new WeakSet,jp=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(qy(),s(this,_,Qf).call(this))},Up=function(e){this._announce=this._announce===e?`${e}\xA0`:e},Vp=function(e,t){s(this,_,Up).call(this,this.t("sorted",{column:e,direction:this.t(t)}))},Qf=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,_,Kp).call(this,a),d.addEventListener("click",()=>s(this,_,eb).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"))})},Kp=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},eb=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 g of e.tBodies){let w=k=>{let L=k.cells[i];return L?(L.dataset.value??L.textContent??"").trim():""},y=[...g.rows].map((k,L)=>[k,w(k),L]).sort(([,k,L],[,A,O])=>k===""||A===""?k===A?L-O:k===""?1:-1:v*Jf(k,A,u,this.locale)||L-O);g.append(...y.map(([k])=>k))}for(let g of e.tHead.rows[0].cells)g.dataset.sort&&(g.setAttribute("aria-sort",g===t?d:"none"),s(this,_,Kp).call(this,g));s(this,_,Vp).call(this,a,d)},tb=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",i=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),a=this.dispatchEvent(i);f(this,Ss,a),a&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},ib=function(){let e=[this.renderRoot.querySelector(".scroll"),this.renderRoot.querySelector("table")??this.querySelector(":scope > table")].filter(Boolean);e.length===r(this,zr).length&&e.every((t,i)=>t===r(this,zr)[i])||(r(this,Ds)?.disconnect(),e.forEach(t=>r(this,Ds)?.observe(t)),f(this,zr,e))},Cr=new WeakMap,Ms=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"),g=v?.tHead;if(this.stickyHeader&&!i&&a&&v&&g){let w=r(this,_r)>0?r(this,_r):0,y=g.getBoundingClientRect().top-w,k=v.getBoundingClientRect().bottom-w,L=0;for(let A=Zf(this);A&&A!==document.documentElement&&A!==document.body;A=Zf(A)){let O=getComputedStyle(A);/(auto|scroll|overlay|hidden|clip)/.test(O.overflowY)&&(L=Math.max(L,A.getBoundingClientRect().top+A.clientTop+(parseFloat(O.paddingTop)||0)))}L+=parseFloat(getComputedStyle(this).getPropertyValue("--cm-data-table-sticky-top"))||0,u=Math.max(0,Math.min(L-y,k-y-g.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,_r)&&(f(this,_r,u),u?e.style.setProperty("--_shift",`${u}px`):e.style.removeProperty("--_shift"))},Ts=function(e){return e==null?"":e instanceof Date?ae(e,{},this.locale):String(e)},Eh=function(e){return this._widths[e.key]??e.width},zs=function(e,t){return[By(e)&&"end",ol(e)&&"num",(ol(e)||e.type==="date")&&"nw",e.type==="actions"&&"act",e.priority==="low"&&e!==t&&"low",s(this,_,Eh).call(this,e)!==void 0&&"w"].filter(Boolean).join(" ")},_s=function(e){let t=s(this,_,Eh).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"))},Wp=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)},Gp=function(e){return e.find(t=>t.primary)??e.find(t=>t.type!=="actions")??e[0]},Yp=function(e,t){return t?s(this,_,Ts).call(this,e[t.key]):""},rb=function(e,t){let i=t[e.key];return Array.isArray(i)?i:e.actions??[]},ab=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}))},Xp=function(e,t,i){return c`<span class="acts">${s(this,_,rb).call(this,e,t).map(a=>c`<cm-button size="slim" icon=${a.icon??h}
|
|
2168
2171
|
?icon-only=${!!a.iconOnly} label=${a.iconOnly?this.t("rowAction",{action:a.label,name:i}):h} tone=${a.tone??h}
|
|
2169
|
-
@click=${()=>s(this,_,
|
|
2170
|
-
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,
|
|
2171
|
-
@click=${()=>s(this,_,
|
|
2172
|
-
<fieldset class="panel" id="${r(this,
|
|
2172
|
+
@click=${()=>s(this,_,ab).call(this,a,t)}>${a.label}${a.iconOnly||!i?h:c`<span class="sr">, ${i}</span>`}</cm-button>`)}</span>`},Jp=function(e,t,i){if(e.type==="actions")return s(this,_,Xp).call(this,e,t,i);let a=s(this,_,Ts).call(this,t[e.key]);if(!Fy(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>`},Th=function(e,t,i){let a=Math.max(Vf,Math.round(t));this._widths={...this._widths,[e.key]:a},i&&(s(this,_,Up).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})))},sb=function(e,t){return s(this,_,Eh).call(this,e)??Math.round(t.closest("th").getBoundingClientRect().width)},nb=function(e,t){let i=J(e,this);i!=="ArrowLeft"&&i!=="ArrowRight"||(e.preventDefault(),s(this,_,Th).call(this,t,s(this,_,sb).call(this,t,e.currentTarget)+(i==="ArrowRight"?Kf:-Kf),!0))},ob=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=g=>{m=a+(g.clientX-l)*(d?-1:1),s(this,_,Th).call(this,t,m,!1)},v=()=>{i.removeEventListener("pointermove",u),i.removeEventListener("pointerup",v),i.removeEventListener("pointercancel",v),i.removeAttribute("data-dragging"),s(this,_,Th).call(this,t,m,!0)};i.addEventListener("pointermove",u),i.addEventListener("pointerup",v),i.addEventListener("pointercancel",v)},Ni=new WeakMap,zh=function(e=!this._picker){this._picker=e,e?document.addEventListener("pointerdown",r(this,Rs),{capture:!0}):document.removeEventListener("pointerdown",r(this,Rs),{capture:!0})},Rs=new WeakMap,lb=function(e){e.key!=="Escape"||!this._picker||(e.stopPropagation(),s(this,_,zh).call(this,!1),this.renderRoot.querySelector(".pick")?.focus())},cb=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}))},db=function(){let e=this.columns??[],t=s(this,_,Gp).call(this,this.visibleColumns);return c`<div class="tools" part="tools" @keydown=${s(this,_,lb)}>
|
|
2173
|
+
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,Ls)}-cols"
|
|
2174
|
+
@click=${()=>s(this,_,zh).call(this)}>${this.t("columns")}<cm-icon name="chevron-down" size="16" aria-hidden="true"></cm-icon></button>
|
|
2175
|
+
<fieldset class="panel" id="${r(this,Ls)}-cols" part="column-panel" ?hidden=${!this._picker}>
|
|
2173
2176
|
<legend class="sr">${this.t("showColumns")}</legend>
|
|
2174
2177
|
${e.map(i=>c`<label class="opt"><input type="checkbox" .checked=${i.visible!==!1} ?disabled=${i===t}
|
|
2175
|
-
@change=${a=>s(this,_,
|
|
2178
|
+
@change=${a=>s(this,_,cb).call(this,i.key,a.target.checked)} />${i.label}</label>`)}
|
|
2176
2179
|
</fieldset>
|
|
2177
|
-
</div>`},
|
|
2180
|
+
</div>`},hb=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,_,zs).call(this,e,t)} style=${s(this,_,_s).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,_,tb).call(this,e)}>${d}<cm-icon
|
|
2178
2181
|
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})}
|
|
2179
|
-
aria-valuemin=${
|
|
2180
|
-
@keydown=${m=>s(this,_,
|
|
2181
|
-
@click=${()=>s(this,_,
|
|
2182
|
-
<dl class="pairs">${a.map(g=>c`<dt>${g.label}</dt><dd class=${
|
|
2182
|
+
aria-valuemin=${Vf} aria-valuemax="1600"
|
|
2183
|
+
@keydown=${m=>s(this,_,nb).call(this,m,e)} @pointerdown=${m=>s(this,_,ob).call(this,m,e)}></span>`:h}</div></th>`},mb=function(e,t,i,a,l){let d=s(this,_,Yp).call(this,e,i),m=this._expanded.has(e),u=`${r(this,Ls)}-more-${l}`,v=c`<tr part="row">${t.map(g=>g===i?c`<th scope="row" class=${s(this,_,zs).call(this,g,i)} style=${s(this,_,_s).call(this,g)} part="cell">${s(this,_,Jp).call(this,g,e,d)}${a.length?c`<button type="button" class="more-btn" aria-expanded=${m?"true":"false"} aria-controls=${u}
|
|
2184
|
+
@click=${()=>s(this,_,pb).call(this,e)}>${this.t(m?"viewLess":"viewAll")}</button>`:h}</th>`:c`<td class=${s(this,_,zs).call(this,g,i)} style=${s(this,_,_s).call(this,g)} part="cell">${s(this,_,Jp).call(this,g,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}>
|
|
2185
|
+
<dl class="pairs">${a.map(g=>c`<dt>${g.label}</dt><dd class=${ol(g)?"num":""}>${s(this,_,Ts).call(this,e[g.key])}</dd>`)}</dl></td></tr>`:h}`},pb=function(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t},ub=function(e,t,i){let a=t.filter(m=>m!==i&&m.type!=="actions"),l=t.filter(m=>m.type==="actions"),d=(m,u=!1)=>{let v=s(this,_,Yp).call(this,m,i);return c`<li class="card ${u?"total":""}" part="card">
|
|
2183
2186
|
<p class="card-title">${v}</p>
|
|
2184
|
-
${a.length?c`<dl class="pairs">${a.map(g=>c`<dt>${g.label}</dt><dd class=${
|
|
2185
|
-
${!u&&l.length?c`<div class="card-actions">${l.map(g=>s(this,_,
|
|
2187
|
+
${a.length?c`<dl class="pairs">${a.map(g=>c`<dt>${g.label}</dt><dd class=${ol(g)?"num":""}>${s(this,_,Ts).call(this,m[g.key])}</dd>`)}</dl>`:h}
|
|
2188
|
+
${!u&&l.length?c`<div class="card-actions">${l.map(g=>s(this,_,Xp).call(this,g,m,v))}</div>`:h}
|
|
2186
2189
|
</li>`};return c`${this.caption?c`<p class="cards-caption" aria-hidden="true">${this.caption}</p>`:h}
|
|
2187
|
-
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(m=>d(m))}${this.totals?d(this.totals,!0):h}</ul>`},
|
|
2190
|
+
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(m=>d(m))}${this.totals?d(this.totals,!0):h}</ul>`},Cs.properties={columns:{type:Array},rows:{type:Array},totals:{type:Object},caption:{},captionHidden:{type:Boolean,attribute:"caption-hidden",reflect:!0},sort:{reflect:!0},direction:{reflect:!0},sortMode:{attribute:"sort-mode",reflect:!0},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0},stickyFirstColumn:{type:Boolean,attribute:"sticky-first-column",reflect:!0},loading:{type:Boolean,reflect:!0},loadingRows:{type:Number,attribute:"loading-rows"},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}},Cs.styles=[E,Xe,x`
|
|
2188
2191
|
:host { display: block; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
2189
2192
|
:host([density='compact']) { --cm-table-row-height: 40px; }
|
|
2190
2193
|
:host([density='comfortable']) { --cm-table-row-height: 48px; }
|
|
@@ -2344,7 +2347,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2344
2347
|
:host([mobile='priority']) tr.more { display: table-row; }
|
|
2345
2348
|
}
|
|
2346
2349
|
@media (forced-colors: active) { button.sort cm-icon { opacity: 1; } .acts { opacity: 1 !important; } }
|
|
2347
|
-
`];$("cm-data-table",
|
|
2350
|
+
`];$("cm-data-table",Cs);var Ak=z("resourceItem",{select:"Select {name}"}),Rk=z("resourceList",{resourceName:"item",resourceNamePlural:"items",select:"Select",selectPageHidden:"all {count} {resource} on this page",selectionOptions:"Selection options",selectPage:"Select all {count} on this page",selectAll:"Select all {count} {resource}",selectNone:"Select none",selected:"{count} {resource} selected.",allSelected:"All {count} {resource} selected.",clearSelection:"Clear selection",loading:"Loading {resource}"}),gb=x`
|
|
2348
2351
|
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
2349
2352
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
2350
2353
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -2356,17 +2359,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2356
2359
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
2357
2360
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2358
2361
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
2359
|
-
`,
|
|
2362
|
+
`,Sh,Ps,fb,bb,Ns=class extends T{constructor(){super();p(this,Ps);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,Sh,this.attachInternals());r(this,Sh).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`
|
|
2360
2363
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
2361
|
-
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,
|
|
2364
|
+
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,Ps,bb)}>
|
|
2362
2365
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
2363
2366
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
2364
2367
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
2365
2368
|
<span class="media"><slot name="media"></slot></span>
|
|
2366
2369
|
<div class="content" part="content"><slot></slot></div>
|
|
2367
|
-
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,
|
|
2370
|
+
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,Ps,fb)}></slot></div>
|
|
2368
2371
|
</div>
|
|
2369
|
-
`}};
|
|
2372
|
+
`}};Sh=new WeakMap,Ps=new WeakSet,fb=function(e){this._hasActions=e.target.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim())},bb=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()},Ns.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}},Ns.styles=[E,gb,x`
|
|
2370
2373
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2371
2374
|
:host(:last-child) { border-bottom: 0; }
|
|
2372
2375
|
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
|
|
@@ -2379,7 +2382,8 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2379
2382
|
font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
|
|
2380
2383
|
}
|
|
2381
2384
|
@media (pointer: coarse) { .row { min-height: max(var(--cm-resource-row-height, 56px), var(--cm-control-height-touch, 44px)); } }
|
|
2382
|
-
:host(:hover:not([disabled])) .row
|
|
2385
|
+
:host(:hover:not([disabled])) .row { background: var(--cm-bg-hover); }
|
|
2386
|
+
:host([selected]) .row { background: var(--cm-bg-selected); }
|
|
2383
2387
|
:host([selectable]:not([href]):not([disabled])) .row { cursor: pointer; }
|
|
2384
2388
|
:host([disabled]) .row { color: var(--cm-text-tertiary); }
|
|
2385
2389
|
.media { display: contents; }
|
|
@@ -2411,18 +2415,18 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2411
2415
|
::slotted([slot='media']) { width: 32px; height: 32px; }
|
|
2412
2416
|
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 32px; }
|
|
2413
2417
|
}
|
|
2414
|
-
`];$("cm-resource-item"
|
|
2418
|
+
`];$("cm-resource-item",Ns);var cl,dl,ye,vb,Zp,Lh,Dh,Hs,Ch,Ah,Is=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,cl,R("cm-rl"));p(this,dl,new Set);p(this,Lh,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,s(this,ye,Zp).call(this,t)});p(this,Dh,e=>{this._hasActions=e.target.assignedElements().length>0});p(this,Ah,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,Hs).call(this),s(this,ye,Ch).call(this))})}connectedCallback(){super.connectedCallback(),kh(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,Hs).call(this),s(this,ye,Ch).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,s(this,ye,Hs).call(this),s(this,ye,Ch).call(this)}clearSelection(){this.selectPage(!1)}updated(e){e.has("selectable")&&(s(this,ye,Hs).call(this),s(this,ye,Zp).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,vb).call(this),d=k=>Cc(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,g=this._hasTable,w=!this.hideSelectMenu&&(!g||v),y=c`<slot name="actions" @slotchange=${r(this,Dh)}></slot>`;return c`
|
|
2415
2419
|
${this.selectable&&g?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${y}</div>`:h}
|
|
2416
2420
|
<div class="head ${this.selectable||this._hasHeader?"on":""} ${g?"over":""}">
|
|
2417
|
-
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,
|
|
2421
|
+
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,Lh)}></slot></div>
|
|
2418
2422
|
${this.selectable?c`<div class="toolbar ${g?"over":""} ${v?"busy":""}" part="toolbar">
|
|
2419
2423
|
<span class="select" part="select">
|
|
2420
|
-
<span class="check"><input id="${r(this,
|
|
2424
|
+
<span class="check"><input id="${r(this,cl)}-all" type="checkbox" .checked=${a} .indeterminate=${e>0&&!a}
|
|
2421
2425
|
?disabled=${!i} @change=${k=>this.selectPage(k.target.checked)} />
|
|
2422
2426
|
<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>
|
|
2423
2427
|
${this.hideSelectMenu?h:c`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")} ?hidden=${!w}
|
|
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,
|
|
2425
|
-
<label for="${r(this,
|
|
2428
|
+
.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,Ah)}></cm-action-menu>`}
|
|
2429
|
+
<label for="${r(this,cl)}-all" class=${g||v?"sr":"label"}>${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:d(t)})}</span></label>
|
|
2426
2430
|
</span>
|
|
2427
2431
|
<span class="status" part="status" role="status">${u}</span>
|
|
2428
2432
|
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
@@ -2431,12 +2435,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2431
2435
|
</div>
|
|
2432
2436
|
<div class="body">
|
|
2433
2437
|
<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,
|
|
2438
|
+
<slot @slotchange=${()=>s(this,ye,Hs).call(this)}></slot>
|
|
2435
2439
|
</div>
|
|
2436
2440
|
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
2437
2441
|
</div>
|
|
2438
2442
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
2439
|
-
`}};
|
|
2443
|
+
`}};cl=new WeakMap,dl=new WeakMap,ye=new WeakSet,vb=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},Zp=function(e=this.renderRoot?.querySelector('slot[name="header"]')){if(!e)return;let t=new Set;for(let i of e.assignedElements())i.localName==="cm-table-header"&&t.add(i),i.querySelectorAll("cm-table-header").forEach(a=>t.add(a));for(let i of r(this,dl))t.has(i)||i.removeAttribute("resource-rows");for(let i of t)i.setAttribute("resource-rows",this.selectable?"selectable":"plain");f(this,dl,t),this._hasTable=t.size>0},Lh=new WeakMap,Dh=new WeakMap,Hs=function(){let e=this.items;e.forEach(t=>t.selectable=this.selectable),this._rows=e.length,this._count=e.filter(t=>t.selected).length},Ch=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},Ah=new WeakMap,Is.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name",string:"resourceName"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},density:{reflect:!0},_count:{state:!0},_rows:{state:!0},_hasHeader:{state:!0},_hasTable:{state:!0},_hasActions:{state:!0}},Is.styles=[E,gb,x`
|
|
2440
2444
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
|
|
2441
2445
|
/* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
|
|
2442
2446
|
:host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
@@ -2492,12 +2496,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2492
2496
|
.toolbar .check { width: 20px; height: 20px; }
|
|
2493
2497
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
2494
2498
|
}
|
|
2495
|
-
`];$("cm-resource-list",
|
|
2496
|
-
<div class="row" part="row" @dragover=${s(this,re,
|
|
2499
|
+
`];$("cm-resource-list",Is);var qk=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}"}),Hh,re,Qp,eu,yb,xb,Ii,wb,$b,kb,tu,Eb,gt=class gt extends T{constructor(){super();p(this,re);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;p(this,Hh,this.attachInternals());p(this,Ii,!1);r(this,Hh).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`
|
|
2500
|
+
<div class="row" part="row" @dragover=${s(this,re,kb)} @dragleave=${s(this,re,tu)} @drop=${s(this,re,Eb)}>
|
|
2497
2501
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
2498
2502
|
aria-describedby="hint"
|
|
2499
|
-
@keydown=${s(this,re,
|
|
2500
|
-
@dragend=${()=>{this.classList.remove("dragging"),
|
|
2503
|
+
@keydown=${s(this,re,yb)} @dragstart=${s(this,re,xb)} @pointerdown=${s(this,re,wb)}
|
|
2504
|
+
@dragend=${()=>{this.classList.remove("dragging"),gt.dragged=null,hl(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
2501
2505
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
2502
2506
|
<span class="label" part="label">${this.label}</span>
|
|
2503
2507
|
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
@@ -2505,7 +2509,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2505
2509
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
2506
2510
|
<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>
|
|
2507
2511
|
</div>
|
|
2508
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};
|
|
2512
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};Hh=new WeakMap,re=new WeakSet,Qp=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)):[]},eu=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},yb=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,Qp),m=d[d.indexOf(this.list)+(i?-1:1)];if(m){e.preventDefault(),this.moveToList(m,i?m.items.length:0)&&s(this,re,eu).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,eu).call(this)},xb=function(e){if(e.stopPropagation(),r(this,Ii)){e.preventDefault();return}gt.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},Ii=new WeakMap,wb=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,Ii)){if(Math.abs(d.clientY-t)<6)return;f(this,Ii,!0),gt.dragged=this,this.classList.add("dragging")}d.preventDefault(),i=s(this,re,$b).call(this,d.clientX,d.clientY),hl(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,Ii);f(this,Ii,!1),gt.dragged=null,this.classList.remove("dragging"),hl(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)},$b=function(e,t){for(let i of r(this,re,Qp)){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:Rh(i.items,this,t)}}return{index:Rh(this.siblings,this,t)}},kb=function(e){let t=gt.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)},tu=function(){this.classList.remove("drop-before","drop-after")},Eb=function(e){let t=gt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.classList.contains("drop-after");s(this,re,tu).call(this);let a=this.siblings,l=a.indexOf(t),d=a.indexOf(this)+(i?1:0);d>l&&(d-=1),t.moveTo(d)},gt.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},gt.styles=[E,x`
|
|
2509
2513
|
:host { display: block; }
|
|
2510
2514
|
.row {
|
|
2511
2515
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2532,20 +2536,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2532
2536
|
.actions { gap: var(--cm-space-8); }
|
|
2533
2537
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2534
2538
|
}
|
|
2535
|
-
`],
|
|
2539
|
+
`],gt.dragged=null;var qs=gt;$("cm-nested-item",qs);function Rh(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 hl(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 Sr,Ie,Mb,iu,ru,Tb,zb,Os=class extends T{constructor(){super(...arguments);p(this,Ie);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;p(this,Sr,R("cm-nl"))}get items(){return[...this.children].filter(e=>e.localName==="cm-nested-item")}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}willUpdate(){this.hasUpdated||(this._empty=!this.items.length)}updated(e){(e.has("sortable")||e.has("group"))&&s(this,Ie,iu).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2536
2540
|
<div class="bar" part="bar">
|
|
2537
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,
|
|
2541
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,Sr)}-h">${this.heading}</div>
|
|
2538
2542
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2539
|
-
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
2540
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,
|
|
2543
|
+
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,Sr)}-rows"
|
|
2544
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,Ie,Mb)}>
|
|
2541
2545
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2542
2546
|
</div>
|
|
2543
|
-
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,
|
|
2544
|
-
@dragover=${s(this,
|
|
2545
|
-
<slot @slotchange=${()=>{s(this,
|
|
2547
|
+
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,Sr)}-rows" role="list" aria-labelledby="${r(this,Sr)}-h" ?hidden=${!t}
|
|
2548
|
+
@dragover=${s(this,Ie,Tb)} @drop=${s(this,Ie,zb)}>
|
|
2549
|
+
<slot @slotchange=${()=>{s(this,Ie,iu).call(this),this._empty=!this.items.length}}></slot>
|
|
2546
2550
|
</div>
|
|
2547
2551
|
<span class="sr" role="status">${this._msg}</span>
|
|
2548
|
-
`}};
|
|
2552
|
+
`}};Sr=new WeakMap,Ie=new WeakSet,Mb=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},iu=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},ru=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},Tb=function(e){let t=qs.dragged;s(this,Ie,ru).call(this,t)&&(e.preventDefault(),hl(t,{list:this,index:Rh(this.items,t,e.clientY)}))},zb=function(e){let t=qs.dragged;if(!s(this,Ie,ru).call(this,t))return;e.preventDefault();let i=Rh(this.items,t,e.clientY);hl(t,null),t.moveToList(this,i)},Os.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}},Os.styles=[E,x`
|
|
2549
2553
|
:host { display: block; }
|
|
2550
2554
|
.bar {
|
|
2551
2555
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2569,9 +2573,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2569
2573
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2570
2574
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2571
2575
|
}
|
|
2572
|
-
`];$("cm-nested-list",
|
|
2576
|
+
`];$("cm-nested-list",Os);var _b=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},Cb=ha(class extends di{constructor(o){if(super(o),o.type!==ht.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=Cg(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,g=0,w=i.length-1,y=0,k=a.length-1;for(;g<=w&&y<=k;)if(i[g]===null)g++;else if(i[w]===null)w--;else if(d[g]===l[y])m[y]=hi(i[g],a[y]),g++,y++;else if(d[w]===l[k])m[k]=hi(i[w],a[k]),w--,k--;else if(d[g]===l[k])m[k]=hi(i[g],a[k]),ma(o,m[k+1],i[g]),g++,k--;else if(d[w]===l[y])m[y]=hi(i[w],a[y]),ma(o,i[g],i[w]),w--,y++;else if(u===void 0&&(u=_b(l,y,k),v=_b(d,g,w)),u.has(d[g]))if(u.has(d[w])){let L=v.get(l[y]),A=L!==void 0?i[L]:null;if(A===null){let O=ma(o,i[g]);hi(O,a[y]),m[y]=O}else m[y]=hi(A,a[y]),ma(o,i[g],A),i[L]=null;y++}else Kc(i[w]),w--;else Kc(i[g]),g++;for(;y<=k;){let L=ma(o,m[k+1]);hi(L,a[y]),m[y++]=L}for(;g<=w;){let L=i[g++];L!==null&&Kc(L)}return this.ut=l,Vc(o,m),we}});function Sb(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,Ve,Ke,Dr=class{constructor(n){p(this,le);p(this,Ve,null);p(this,Ke,null);f(this,le,n)}get active(){return r(this,Ve)!==null}get from(){return r(this,Ve)&&{...r(this,Ve)}}get target(){return r(this,Ke)&&{...r(this,Ke)}}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(),f(this,Ve,{...n}),f(this,Ke,{...n}),r(this,le).onTarget?.(this.target),r(this,le).announce(r(this,le).messages.pickedUp(this.target))}moveTo(n){if(!r(this,Ke))return;let e=Math.max(0,Math.min(n.group,r(this,le).groupCount()-1)),t=this.slotCount(e);t<=0||(f(this,Ke,{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,Ve)||!r(this,Ke))return;let n=r(this,Ve),e=r(this,Ke);f(this,Ve,f(this,Ke,null)),r(this,le).onTarget?.(null),r(this,le).onDrop(n,e)}cancel(n=!1){if(!r(this,Ve))return;let e=r(this,Ve),t=n?"":r(this,le).messages.cancelled(e);f(this,Ve,f(this,Ke,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??Sb)(e,r(this,Ke),this);return t?(this.moveTo(t),!0):!1}};le=new WeakMap,Ve=new WeakMap,Ke=new WeakMap;var ml,Lr,Ar=class{constructor(n=document,e="assertive"){p(this,ml);p(this,Lr);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,Lr)??this.element.textContent??""}announce(n){clearTimeout(r(this,ml)),this.element.textContent===n?(this.element.textContent="",f(this,Lr,n),f(this,ml,setTimeout(()=>{this.element.textContent=n,f(this,Lr,void 0)},50))):(f(this,Lr,void 0),this.element.textContent=n)}};ml=new WeakMap,Lr=new WeakMap;var aE=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"}),sE=z("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),nE=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}."}),Uy="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",pl,Oh,Lb,Rr=class extends T{constructor(){super(...arguments);p(this,Oh);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";p(this,pl,R("cm-bc"))}get name(){let e=i=>(i??"").replace(/\s+/g," ").trim();if(this.label)return this.label;if(this.heading)return this.heading;let t=this.querySelector(':scope > [slot="heading"]');return t?e(t.textContent):e(this.textContent).slice(0,80)}get key(){return this.value||this.name}get opener(){if(this.href)return this.renderRoot?.querySelector(".title a")??null;let e=this.querySelector(':scope > [slot="heading"]');return e?e.matches("a[href], button, cm-button")?e:e.querySelector("a[href], button, cm-button"):null}focusHandle(e){let t=this.renderRoot?.querySelector(".handle");t?t.focus(e):this.focus(e)}open(){let e=this.opener;return e?(e.click(),!0):!1}render(){let e=!!(this.href||this.querySelector(':scope > [slot="heading"] a[href], :scope > [slot="heading"] button, :scope > a[slot="heading"][href], :scope > button[slot="heading"]')),t=this.pending;return c`<div class="card" part="card">
|
|
2573
2577
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2574
|
-
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,
|
|
2578
|
+
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,pl)}-help"></div>`}
|
|
2575
2579
|
<div class="content">
|
|
2576
2580
|
<div class="head">
|
|
2577
2581
|
<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>
|
|
@@ -2579,11 +2583,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2579
2583
|
<slot name="actions"></slot>
|
|
2580
2584
|
</div>
|
|
2581
2585
|
<div class="lines"><slot></slot></div>
|
|
2582
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,
|
|
2586
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,Oh,Lb).call(this,i,"_badges")}></slot></div>
|
|
2583
2587
|
</div>
|
|
2584
2588
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2585
|
-
<span id="${r(this,
|
|
2586
|
-
</div>`}};
|
|
2589
|
+
<span id="${r(this,pl)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2590
|
+
</div>`}};pl=new WeakMap,Oh=new WeakSet,Lb=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},Rr.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Rr.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}},Rr.styles=[E,x`
|
|
2587
2591
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2588
2592
|
.card {
|
|
2589
2593
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2608,22 +2612,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2608
2612
|
:host([moving]) .content { opacity: 0.5; }
|
|
2609
2613
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2610
2614
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2611
|
-
`];$("cm-board-card",
|
|
2615
|
+
`];$("cm-board-card",Rr);var js,ul,Us,Vs,Oi,Nh,Db,Hr=class extends T{constructor(){super(...arguments);p(this,Oi);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;p(this,js,!1);this._cards=[];this._drop=null;p(this,ul,new MutationObserver(()=>s(this,Oi,Nh).call(this)));p(this,Us,R("cm-col"));p(this,Vs,!1)}get collapsed(){return r(this,js)}connectedCallback(){super.connectedCallback(),s(this,Oi,Nh).call(this),r(this,ul).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,ul).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,Oi,Nh).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");f(this,js,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",r(this,js)),f(this,Vs,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach(i=>{let a=this._cards[Number(i.dataset.i)];a?i.assign(a):i.assign()});let t=i=>[...this.children].filter(a=>a.getAttribute("slot")===i);this.renderRoot.querySelector("slot.actions")?.assign(...t("actions")),this.renderRoot.querySelector("slot.empty")?.assign(...t("empty")),r(this,Vs)&&!this.renderRoot.querySelector(".more cm-button")&&(f(this,Vs,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,i=this.count,a=t?e.filter(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,g=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),w=this.t("count",{count:i});return c`<section aria-labelledby="${r(this,Us)}-h" class=${t&&this.collapsed?"over":""}>
|
|
2612
2616
|
<header part="header">
|
|
2613
|
-
<div class="title" id="${r(this,
|
|
2617
|
+
<div class="title" id="${r(this,Us)}-h" role="heading" aria-level=${g}>${this.heading}<span class="sr">, ${w}</span></div>
|
|
2614
2618
|
<span class="count" part="count" aria-hidden="true">${this.formatNumber(i)}</span>
|
|
2615
2619
|
<span class="actions"><slot class="actions"></slot></span>
|
|
2616
2620
|
</header>
|
|
2617
2621
|
<div class="scroll">
|
|
2618
|
-
<ul part="list" role="list" aria-labelledby="${r(this,
|
|
2619
|
-
${
|
|
2622
|
+
<ul part="list" role="list" aria-labelledby="${r(this,Us)}-h" aria-busy=${v?"true":"false"} tabindex="-1" ?hidden=${this.collapsed}>
|
|
2623
|
+
${Cb(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>`)}
|
|
2620
2624
|
</ul>
|
|
2621
2625
|
${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}
|
|
2622
2626
|
<div class="empty" ?hidden=${e.length>0||v||u||this.collapsed||d}><slot class="empty">${this.t("empty")}</slot></div>
|
|
2623
|
-
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,
|
|
2627
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,Oi,Db)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
2624
2628
|
</div>
|
|
2625
2629
|
<span class="sr" role="status">${v?this.t("loading",{column:this.heading}):""}</span>
|
|
2626
|
-
</section>`}};
|
|
2630
|
+
</section>`}};js=new WeakMap,ul=new WeakMap,Us=new WeakMap,Vs=new WeakMap,Oi=new WeakSet,Nh=function(){this._cards=this.cards},Db=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},Hr.shadowRootOptions={...S.shadowRootOptions,slotAssignment:"manual"},Hr.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}},Hr.styles=[E,x`
|
|
2627
2631
|
:host {
|
|
2628
2632
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
2629
2633
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -2660,9 +2664,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2660
2664
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
2661
2665
|
:host([collapsed]) .actions { display: none; }
|
|
2662
2666
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
2663
|
-
`];$("cm-board-column",
|
|
2667
|
+
`];$("cm-board-column",Hr);var Se,Ee,de,Nr,te,H,au,Bs,Ab,su,Rb,Hb,Nb,Ib,gl,Pb,fl,nu,ou,lu,Ih,Ob,bl,vl,yl,xl,wl,$l,kl,cu,du,Ph,qb,Pi,Fs=class extends T{constructor(){super();p(this,H);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;p(this,Se,new Ar);p(this,Ee);p(this,de,null);p(this,Nr,new WeakMap);p(this,te,null);p(this,gl,e=>{if(r(this,te)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,Ee).active){r(this,Ee).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let i=s(this,H,Ib).call(this,e.composedPath());if(!(!i||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===" ")e.preventDefault(),this.pickUp(i);else if(e.key==="Enter")i.open()&&e.preventDefault();else if(t.startsWith("Arrow")){let a=s(this,H,Pb).call(this,i,t);a&&(e.preventDefault(),a.focusHandle())}}});p(this,fl,e=>{if(!r(this,Ee).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,Ee).active&&r(this,de)&&!r(this,de).card.matches(":focus-within")&&r(this,Ee).cancel()})});p(this,bl,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});p(this,vl,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?.(Uy)))return;let a=s(this,H,Bs).call(this,i);if(!a)return;r(this,Ee).active&&r(this,Ee).cancel();let l=i.getBoundingClientRect();f(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,H,cu).call(this)},300)),window.addEventListener("pointermove",r(this,wl),!0),window.addEventListener("pointerup",r(this,$l),!0),window.addEventListener("pointercancel",r(this,kl),!0),window.addEventListener("touchmove",r(this,yl),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,xl),!0)});p(this,yl,e=>{r(this,te)?.started&&e.cancelable&&e.preventDefault()});p(this,xl,e=>{r(this,te)&&e.preventDefault()});p(this,wl,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,H,cu).call(this):s(this,H,Pi).call(this,!1));return}e.preventDefault(),s(this,H,du).call(this),s(this,H,Ph).call(this)}});p(this,$l,e=>{let t=r(this,te);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,H,Pi).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,H,Pi).call(this,!0)});p(this,kl,e=>{r(this,te)&&e.pointerId===r(this,te).pointerId&&s(this,H,Pi).call(this,!1)});f(this,Ee,new Dr({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,H,Rb).call(this,e),onDrop:(e,t)=>s(this,H,Nb).call(this,e,t),onCancel:()=>s(this,H,su).call(this),messages:{pickedUp:e=>s(this,H,au).call(this,"pickedUp",e),over:e=>s(this,H,au).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,Se).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,gl)),this.addEventListener("focusout",r(this,fl)),this.addEventListener("pointerdown",r(this,vl)),this.addEventListener("dragstart",r(this,bl))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,gl)),this.removeEventListener("focusout",r(this,fl)),this.removeEventListener("pointerdown",r(this,vl)),this.removeEventListener("dragstart",r(this,bl)),r(this,Ee).cancel(!0),s(this,H,Pi).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(r(this,Se).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return r(this,Se).text}announce(e){r(this,Se).announce(e)}pickUp(e){let t=typeof e=="string"?this.card(e):e;if(!t||t.locked||t.pending)return!1;let i=s(this,H,Bs).call(this,t);return i?(s(this,H,Pi).call(this,!1),r(this,Ee).cancel(!0),f(this,de,{card:t,column:i.column,index:i.index}),t.moving=!0,s(this,H,Ab).call(this,t),r(this,Ee).pickUp({group:i.group,index:i.index}),!0):!1}cancelMove(){let e=r(this,te);e?.started&&(s(this,H,Pi).call(this,!1),r(this,Se).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),r(this,Ee).cancel()}moveCard(e,t,i){let a=typeof e=="string"?this.card(e):e,l=typeof t=="string"?this.column(t):t;if(!a||!l)return!1;let d=s(this,H,Bs).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,H,Ih).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,Nr).get(t);if(this.controlled||!i||(r(this,Nr).delete(t),!i.from.isConnected||!this.contains(i.from)))return!1;let a=t.matches(":focus-within");return s(this,H,ou).call(this,t,i.from,i.fromIndex),i.totals&&s(this,H,lu).call(this,i.to,i.from),s(this,H,nu).call(this,i.to,i.from,a?t:null),r(this,Se).announce(this.t("reverted",{card:t.name,column:i.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
2664
2668
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
2665
|
-
</div>`}};
|
|
2669
|
+
</div>`}};Se=new WeakMap,Ee=new WeakMap,de=new WeakMap,Nr=new WeakMap,te=new WeakMap,H=new WeakSet,au=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,Ee).slotCount(t.group)})},Bs=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)}},Ab=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})})},su=function(){r(this,de)&&(r(this,de).card.moving=!1),f(this,de,null)},Rb=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,H,Hb).call(this,i,a)})}},Hb=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)}},Nb=function(e,t){let i=r(this,de);if(s(this,H,su).call(this),!i)return;let a=this.columns[t.group];s(this,H,Ih).call(this,i.card,i.column,e.index,a,t.index,"keyboard")},Ib=function(e){let t=e[0];if(!(t instanceof HTMLElement)||!t.classList?.contains("handle"))return null;let i=e.find(a=>a.localName==="cm-board-card");return i&&s(this,H,Bs).call(this,i)?i:null},gl=new WeakMap,Pb=function(e,t){let i=s(this,H,Bs).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},fl=new WeakMap,nu=function(e,t,i){e._sync(),t._sync().then(()=>{i?.isConnected&&i.focusHandle({preventScroll:!0})})},ou=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)},lu=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))},Ih=function(e,t,i,a,l,d){let m=e.name;if(t===a&&i===l)return d!=="api"&&r(this,Se).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,Se).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,H,Ob).call(this,e.key,a);else{let y=d==="keyboard"||e.matches(":focus-within");s(this,H,ou).call(this,e,a,l);let k=t!==a;k&&s(this,H,lu).call(this,t,a),r(this,Nr).set(e,{card:e,from:t,fromIndex:i,to:a,toIndex:l,totals:k}),s(this,H,nu).call(this,t,a,y?e:null)}return r(this,Se).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,Nr).delete(e)},()=>{e.pending=!1,this.controlled?r(this,Se).announce(this.t("reverted",{card:m,column:t.heading})):this.revert(e)})),!0},Ob=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)},bl=new WeakMap,vl=new WeakMap,yl=new WeakMap,xl=new WeakMap,wl=new WeakMap,$l=new WeakMap,kl=new WeakMap,cu=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,Se).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),s(this,H,du).call(this),s(this,H,Ph).call(this);let i=()=>{r(this,te)?.started&&(s(this,H,qb).call(this),r(this,te).raf=requestAnimationFrame(i))};e.raf=requestAnimationFrame(i)},du=function(){let e=r(this,te);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},Ph=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(),g=e.x<v.left?v.left-e.x:e.x>v.right?e.x-v.right:0;g<a&&(i=u,a=g)}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,Se).announce(this.t("over",{column:i.heading,position:d+1,count:l.length+1}))},qb=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),L=d.scrollLeft;y?d.scrollLeft-=y:k&&(d.scrollLeft+=k),l||=d.scrollLeft!==L}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),L=m.scrollTop;y?m.scrollTop-=y:k&&(m.scrollTop+=k),l||=m.scrollTop!==L}}let u=window.innerHeight,v=a(e.y),g=a(u-e.y);if(v||g){let w=window.scrollY;window.scrollBy(0,v?-v:g),l||=window.scrollY!==w}l&&s(this,H,Ph).call(this)},Pi=function(e){let t=r(this,te);t&&(f(this,te,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,wl),!0),window.removeEventListener("pointerup",r(this,$l),!0),window.removeEventListener("pointercancel",r(this,kl),!0),window.removeEventListener("touchmove",r(this,yl),!0),window.removeEventListener("contextmenu",r(this,xl),!0),t.ghost?.remove(),t.started&&(t.card.moving=!1,this.dragging=!1,this.columns.forEach(i=>{i._drop=null}),e&&t.to&&t.toIndex!==void 0&&s(this,H,Ih).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},Fs.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},Fs.styles=[E,x`
|
|
2666
2670
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
2667
2671
|
.board { height: 100%; }
|
|
2668
2672
|
.columns {
|
|
@@ -2676,60 +2680,60 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2676
2680
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
2677
2681
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
2678
2682
|
}
|
|
2679
|
-
`];$("cm-board",_s);var Wk=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}."}),Rs=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}};Rs.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}},Rs.styles=x`:host { display: none !important; }`;$("cm-calendar-event",Rs);var Rh=o=>String(o).padStart(2,"0"),Sb=o=>`${P(o)}T${Rh(o.getHours())}:${Rh(o.getMinutes())}`,_h=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Lb=["month","week","day"],Ry=600,Db=new Map,Ab=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Db.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Db.set(e,t)),t},eu=o=>o.replace(/[ ]/g," ").trim(),Ns,Se,Le,xe,Z,Q,_r,Mt,We,vl,Ri,Is,Ps,Os,qs,yl,b,Ee,Di,dl,Ch,Et,tu,hl,mt,iu,Rb,pt,Ds,Hb,Nb,Ke,ml,pl,Sh,Ib,Pb,Ob,zr,ru,ul,qb,gl,Bb,Fb,jb,Ub,xl,wl,Vb,Kb,$l,fl,Wb,au,su,nu,Gb,Yb,ou,lu,cu,kl,du,Xb,El,Ml,Tl,zl,_l,Cl,hu,Lh,Jb,Ai,bl,Zb,mu,Qb,Dh,pu,As,Ah,ev,tv,iv,rv,av,Hs=class extends T{constructor(){super();p(this,b);this.view="month";this.date="";this.today="";this.step=15;p(this,Ns,"");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 kr);p(this,xe);p(this,Z,null);p(this,Q,null);p(this,_r,new WeakMap);p(this,Mt,"");p(this,We,null);p(this,vl,"");p(this,Ri,!0);p(this,Is,0);p(this,Ps,!1);p(this,Os);p(this,qs,0);p(this,yl,new MutationObserver(()=>this.requestUpdate()));p(this,xl,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){f(this,Mt,t.dataset.k);for(let i of s(this,b,gl).call(this))i.tabIndex=i===t?0:-1}});p(this,wl,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,$l,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,Dh).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),f(this,Is,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,Kb).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,b,Vb).call(this,i,t);l?(e.preventDefault(),s(this,b,Ub).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,kl,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,El,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,Ds).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,b,su).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,du).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}f(this,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,hu).call(this)},300)),window.addEventListener("pointermove",r(this,zl),!0),window.addEventListener("pointerup",r(this,_l),!0),window.addEventListener("pointercancel",r(this,Cl),!0),window.addEventListener("touchmove",r(this,Ml),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,Tl),!0)});p(this,Ml,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});p(this,Tl,e=>{r(this,Q)&&e.preventDefault()});p(this,zl,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,hu).call(this):s(this,b,Ai).call(this,!1));return}e.preventDefault(),s(this,b,Lh).call(this)}});p(this,_l,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,b,Ai).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,Ai).call(this,!0)});p(this,Cl,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,b,Ai).call(this,!1)});f(this,xe,new $r({groupCount:()=>s(this,b,pt).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,b,fl).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,b,Wb).call(this,e,t),onTarget:e=>s(this,b,Gb).call(this,e),onDrop:(e,t)=>s(this,b,Yb).call(this,e,t),onCancel:()=>s(this,b,nu).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,b,zr).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,b,zr).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,b,zr).call(this,r(this,Z),e)})},announce:e=>r(this,Le).announce(e)}))}get locale(){return r(this,Ns)}set locale(e){let t=r(this,Ns);f(this,Ns,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,$l)),this.addEventListener("focusin",r(this,xl)),this.addEventListener("focusout",r(this,wl)),this.addEventListener("pointerdown",r(this,El)),this.addEventListener("dragstart",r(this,kl)),r(this,yl).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(f(this,Os,new ResizeObserver(()=>{cancelAnimationFrame(r(this,qs)),f(this,qs,requestAnimationFrame(()=>s(this,b,ru).call(this)))})),r(this,Os).observe(this)),s(this,b,ru).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,$l)),this.removeEventListener("focusin",r(this,xl)),this.removeEventListener("focusout",r(this,wl)),this.removeEventListener("pointerdown",r(this,El)),this.removeEventListener("dragstart",r(this,kl)),r(this,yl).disconnect(),r(this,Os)?.disconnect(),cancelAnimationFrame(r(this,qs)),r(this,xe).cancel(!0),s(this,b,Ai).call(this,!1)}willUpdate(e){e.has("view")&&(f(this,Ri,!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&&f(this,Ri,!0),s(this,b,jb).call(this),r(this,We)){let l=s(this,b,Bb).call(this,r(this,We).key);l?(f(this,We,null),l.focus({preventScroll:!1})):Date.now()>r(this,We).until&&f(this,We,null)}r(this,Ps)&&(f(this,Ps,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Ri)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),f(this,Ri,!1)}t||f(this,Ri,!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,vl)&&(f(this,vl,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,b,ul).call(this,r(this,b,mt),-1))}next(){this.date=P(s(this,b,ul).call(this,r(this,b,mt),1))}goToToday(){this.date=r(this,b,hl)}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,Ds).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,su).call(this,a,d);if(!m)return!1;s(this,b,Ai).call(this,!1),r(this,xe).cancel(!0),this._more="",f(this,Z,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return f(this,Mt,u),f(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,Ai).call(this,!1),r(this,Le).announce(this.t("cancelled",{event:e.ev.name,place:s(this,b,zr).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,Ds).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,_h(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,b,cu).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,_r).get(t);if(this.controlled||!i)return!1;r(this,_r).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,b,Ds).call(this,t);return l&&a&&f(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,Sh).call(this,l):i.start})),!0}render(){let e=s(this,b,pt).call(this),t=s(this,b,Nb).call(this,s(this,b,Hb).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2680
|
-
${s(this,b,
|
|
2681
|
-
${r(this,b,
|
|
2683
|
+
`];$("cm-board",Fs);var uE=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}."}),Gs=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}};Gs.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}},Gs.styles=x`:host { display: none !important; }`;$("cm-calendar-event",Gs);var Kh=o=>String(o).padStart(2,"0"),Bb=o=>`${P(o)}T${Kh(o.getHours())}:${Kh(o.getMinutes())}`,qh=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Fb=["month","week","day"],Vy=600,jb=new Map,Ub=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=jb.get(e);return t||(t=new Intl.DateTimeFormat(o,n),jb.set(e,t)),t},hu=o=>o.replace(/[ ]/g," ").trim(),Xs,Le,De,xe,Z,Q,Pr,Ct,Ge,Dl,Fi,Js,Zs,Qs,en,Al,b,Me,qi,El,Bh,_t,mu,Ml,ft,pu,Vb,bt,Ks,Kb,Wb,We,Tl,zl,Fh,Gb,Yb,Xb,Ir,uu,_l,Jb,Cl,Zb,Qb,ev,tv,Rl,Hl,iv,rv,Nl,Sl,av,gu,fu,bu,sv,nv,vu,yu,xu,Il,wu,ov,Pl,Ol,ql,Bl,Fl,jl,$u,jh,lv,Bi,Ll,cv,ku,dv,Uh,Eu,Ws,Vh,hv,mv,pv,uv,gv,Ys=class extends T{constructor(){super();p(this,b);this.view="month";this.date="";this.today="";this.step=15;p(this,Xs,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;p(this,Le,R("cm-cal"));p(this,De,new Ar);p(this,xe);p(this,Z,null);p(this,Q,null);p(this,Pr,new WeakMap);p(this,Ct,"");p(this,Ge,null);p(this,Dl,"");p(this,Fi,!0);p(this,Js,0);p(this,Zs,!1);p(this,Qs);p(this,en,0);p(this,Al,new MutationObserver(()=>this.requestUpdate()));p(this,Rl,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){f(this,Ct,t.dataset.k);for(let i of s(this,b,Cl).call(this))i.tabIndex=i===t?0:-1}});p(this,Hl,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,Nl,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,Uh).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),f(this,Js,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,rv).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,b,iv).call(this,i,t);l?(e.preventDefault(),s(this,b,tv).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,Il,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,Pl,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,Ks).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,b,fu).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,wu).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}f(this,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,$u).call(this)},300)),window.addEventListener("pointermove",r(this,Bl),!0),window.addEventListener("pointerup",r(this,Fl),!0),window.addEventListener("pointercancel",r(this,jl),!0),window.addEventListener("touchmove",r(this,Ol),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,ql),!0)});p(this,Ol,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});p(this,ql,e=>{r(this,Q)&&e.preventDefault()});p(this,Bl,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,$u).call(this):s(this,b,Bi).call(this,!1));return}e.preventDefault(),s(this,b,jh).call(this)}});p(this,Fl,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,b,Bi).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,b,Bi).call(this,!0)});p(this,jl,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,b,Bi).call(this,!1)});f(this,xe,new Dr({groupCount:()=>s(this,b,bt).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,b,Sl).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,b,av).call(this,e,t),onTarget:e=>s(this,b,sv).call(this,e),onDrop:(e,t)=>s(this,b,nv).call(this,e,t),onCancel:()=>s(this,b,bu).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,b,Ir).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,b,Ir).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,b,Ir).call(this,r(this,Z),e)})},announce:e=>r(this,De).announce(e)}))}get locale(){return r(this,Xs)}set locale(e){let t=r(this,Xs);f(this,Xs,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,bt).call(this);return{view:r(this,b,Me),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,Z)?.ev.el??null}get announcement(){return r(this,De).text}announce(e){r(this,De).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,Nl)),this.addEventListener("focusin",r(this,Rl)),this.addEventListener("focusout",r(this,Hl)),this.addEventListener("pointerdown",r(this,Pl)),this.addEventListener("dragstart",r(this,Il)),r(this,Al).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(f(this,Qs,new ResizeObserver(()=>{cancelAnimationFrame(r(this,en)),f(this,en,requestAnimationFrame(()=>s(this,b,uu).call(this)))})),r(this,Qs).observe(this)),s(this,b,uu).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,Nl)),this.removeEventListener("focusin",r(this,Rl)),this.removeEventListener("focusout",r(this,Hl)),this.removeEventListener("pointerdown",r(this,Pl)),this.removeEventListener("dragstart",r(this,Il)),r(this,Al).disconnect(),r(this,Qs)?.disconnect(),cancelAnimationFrame(r(this,en)),r(this,xe).cancel(!0),s(this,b,Bi).call(this,!1)}willUpdate(e){e.has("view")&&(f(this,Fi,!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,De).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&f(this,Fi,!0),s(this,b,ev).call(this),r(this,Ge)){let l=s(this,b,Zb).call(this,r(this,Ge).key);l?(f(this,Ge,null),l.focus({preventScroll:!1})):Date.now()>r(this,Ge).until&&f(this,Ge,null)}r(this,Zs)&&(f(this,Zs,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Fi)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),f(this,Fi,!1)}t||f(this,Fi,!0),r(this,Z)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,a=`${i.view}|${i.start}|${i.end}`;a!==r(this,Dl)&&(f(this,Dl,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,b,_l).call(this,r(this,b,ft),-1))}next(){this.date=P(s(this,b,_l).call(this,r(this,b,ft),1))}goToToday(){this.date=r(this,b,Ml)}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,Ks).call(this,i);if(!a)return!1;let l=s(this,b,bt).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,fu).call(this,a,d);if(!m)return!1;s(this,b,Bi).call(this,!1),r(this,xe).cancel(!0),this._more="",f(this,Z,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return f(this,Ct,u),f(this,Ge,{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,Bi).call(this,!1),r(this,De).announce(this.t("cancelled",{event:e.ev.name,place:s(this,b,Ir).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,Ks).call(this,a);if(!l)return!1;let d=l.allDay?N(it(t).date||t):kt(t);if(!d)return!1;let m=i?l.allDay?N(it(i).date||i):kt(i):null;return(!m||m<d)&&(m=l.allDay?Y(d,qh(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,b,xu).call(this,l,d,m,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Pr).get(t);if(this.controlled||!i)return!1;r(this,Pr).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,b,Ks).call(this,t);return l&&a&&f(this,Ge,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,De).announce(this.t("reverted",{event:t.name,place:l?s(this,b,Fh).call(this,l):i.start})),!0}render(){let e=s(this,b,bt).call(this),t=s(this,b,Wb).call(this,s(this,b,Kb).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2684
|
+
${s(this,b,hv).call(this,e)}
|
|
2685
|
+
${r(this,b,Me)==="month"?s(this,b,pv).call(this,e,t):s(this,b,gv).call(this,e,t)}
|
|
2682
2686
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
2683
|
-
<span id="${r(this,
|
|
2684
|
-
<span id="${r(this,
|
|
2685
|
-
<span id="${r(this,
|
|
2686
|
-
</div>`}};Ns=new WeakMap,Se=new WeakMap,Le=new WeakMap,xe=new WeakMap,Z=new WeakMap,Q=new WeakMap,_r=new WeakMap,Mt=new WeakMap,We=new WeakMap,vl=new WeakMap,Ri=new WeakMap,Is=new WeakMap,Ps=new WeakMap,Os=new WeakMap,qs=new WeakMap,yl=new WeakMap,b=new WeakSet,Ee=function(){return Lb.includes(this.view)?this.view:"month"},Di=function(){return ya(this,this.locale)},dl=function(){return wa(r(this,b,Di))},Ch=function(){return $d(r(this,b,Di),this.hourCycle)},Et=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},tu=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?xa(r(this,b,Di)):(Math.trunc(e)%7+7)%7},hl=function(){return N(this.today)?this.today:Im()},mt=function(){return N(this.date)??N(r(this,b,hl))},iu=function(){return r(this,b,Ee)==="month"&&this._narrow},Rb=function(){return r(this,b,Ee)!=="month"},pt=function(){let e=r(this,b,mt),t=r(this,b,tu);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=It(e),a=G(i,-((i.getDay()-t+7)%7)),l=Math.ceil((_h(a,ba(e))+1)/7)*7;return Array.from({length:l},(d,m)=>G(a,m))},Ds=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 g=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:g+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)]}},Hb=function(){return this.events.map(e=>s(this,b,Ds).call(this,e)).filter(e=>!!e)},Nb=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,Di))},ml=function(e){return r(this,b,Ch).format((e%1440+1440)%1440)},pl=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=Ab(r(this,b,Di),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(g=>g.source==="endRange"),v=-1;if(m.forEach((g,w)=>{g.source==="startRange"&&(v=w)}),v>=0&&u>v){let g=w=>eu(w.map(y=>y.value).join(""));return this.t("timeRange",{start:g(m.slice(0,v+1)),end:g(m.slice(u))})}}}catch{}let l=P(e)===P(t),d=m=>l?s(this,b,ml).call(this,m.getHours()*60+m.getMinutes()):r(this,b,Ch).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},Sh=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&&_h(e.start,e.end)===1)?s(this,b,pl).call(this,e.start,e.end):this.t("timed",{date:s(this,b,Ke).call(this,e.start),time:s(this,b,pl).call(this,e.start,e.end)})},Ib=function(e){let t={title:e.name,when:s(this,b,Sh).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Pb=function(e){let t=r(this,b,Di);if(r(this,b,Ee)==="month")return r(this,b,dl).monthYear(r(this,b,mt));if(e.length===1)return ae(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Ab(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return eu(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Ob=function(e){return r(this,b,Ch).hour12?eu(ae(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,b,Di))):s(this,b,ml).call(this,e*60)},zr=function(e,t){let{start:i,end:a}=s(this,b,au).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,b,Ke).call(this,i),time:s(this,b,pl).call(this,i,a)}):s(this,b,Ke).call(this,G(N(e.origin),t.group-e.from.group))},ru=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<Ry;t!==this._narrow&&(this._narrow=t)},ul=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)},qb=function(e){this.view!==e&&(this.view=e)},gl=function(){return[...this.renderRoot.querySelectorAll(".item")]},Bb=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},Fb=function(){let e=P(r(this,b,mt));if(r(this,b,iu))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}`},jb=function(){let e=s(this,b,gl).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,Fb).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},Ub=function(e){f(this,Mt,e.dataset.k??"");for(let t of s(this,b,gl).call(this))t.tabIndex=t===e?0:-1;e.focus()},xl=new WeakMap,wl=new WeakMap,Vb=function(e,t){let i=new Map;for(let y of s(this,b,gl).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,g=(y,k)=>{let L=y>=0&&y<m?i.get(y):void 0;return(L?.length?k(L):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(k=>k.dataset.row===v)??y[0];switch(t){case"ArrowRight":return g(a+1,w);case"ArrowLeft":return g(a-1,w);case"ArrowDown":return l[d+1]??(u?g(a+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?g(a-7,y=>y[y.length-1]):null;case"Home":return u?g(a-a%7,y=>y[0]):g(0,w);case"End":return u?g(Math.min(m-1,a-a%7+6),y=>y[0]):g(m-1,w);default:return null}},Kb=function(e,t){let i=e.dataset.day??P(r(this,b,mt)),a=s(this,b,ul).call(this,N(i)??r(this,b,mt),t),l=P(a),d=(e.dataset.k??"").split(":")[0],m;r(this,b,iu)?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,ul).call(this,r(this,b,mt),t)),f(this,Mt,m),f(this,We,{key:m,until:Date.now()+1e3})},$l=new WeakMap,fl=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,b,Et))+1},Wb=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,fl).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}},au=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)}},su=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,Rb)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,b,Et)),s(this,b,fl).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},nu=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),f(this,Z,null),this._target=null},Gb=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}},Yb=function(e,t){let i=r(this,Z);s(this,b,nu).call(this),i&&(f(this,Is,performance.now()+400),s(this,b,ou).call(this,i,e,t,"keyboard"))},ou=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,b,au).call(this,e,i),u=P(G(N(e.origin),i.group-t.group));s(this,b,cu).call(this,e.ev,d,m,a,l,e.mode==="time"?P(d):u)},lu=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:Sb(t),end:Sb(i)}},cu=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,b,lu).call(this,e.allDay,e.start,e.end),g=s(this,b,lu).call(this,e.allDay,t,i),w=j=>{a==="keyboard"&&f(this,We,{key:j,until:Date.now()+1e3})};if(l||v.start===g.start&&v.end===g.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,pl).call(this,t,i)}),L=[],H={value:e.key,event:m,from:v,to:g,allDay:e.allDay,source:a,waitUntil:j=>{L.push(Promise.resolve(j))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:H,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,_r).set(m,v),m.start=g.start,m.end=g.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})),L.length&&(m.pending=!0,Promise.all(L).then(()=>{m.pending=!1,this.controlled||r(this,_r).delete(m)},()=>{m.pending=!1,this.controlled?r(this,Le).announce(this.t("reverted",{event:u,place:s(this,b,Sh).call(this,e)})):this.revert(m)})),!0):(r(this,Le).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},kl=new WeakMap,du=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let a=0,l=1/0;i.forEach((m,u)=>{let v=m.getBoundingClientRect(),g=e<v.left?v.left-e:e>v.right?e-v.right:0;g<l&&(l=g,a=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},Xb=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let a=null,l=1/0;for(let d of i){let m=d.getBoundingClientRect(),u=e<m.left?m.left-e:e>m.right?e-m.right:0,v=t<m.top?m.top-t:t>m.bottom?t-m.bottom:0,g=Math.hypot(u,v);g<l&&(l=g,a=d)}return a?Number(a.dataset.i):null},El=new WeakMap,Ml=new WeakMap,Tl=new WeakMap,zl=new WeakMap,_l=new WeakMap,Cl=new WeakMap,hu=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,zr).call(this,e,e.from)})),s(this,b,Lh).call(this);let t=()=>{r(this,Q)?.started&&(s(this,b,Jb).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Lh=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,b,du).call(this,e.x,e.y);if(l){let d=s(this,b,fl).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,Xb).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,zr).call(this,e,t)}))},Jb=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let m=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-m),v=l(d.bottom-e.y),g=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==g&&s(this,b,Lh).call(this)},Ai=function(e){let t=r(this,Q);t&&(f(this,Q,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,zl),!0),window.removeEventListener("pointerup",r(this,_l),!0),window.removeEventListener("pointercancel",r(this,Cl),!0),window.removeEventListener("touchmove",r(this,Ml),!0),window.removeEventListener("contextmenu",r(this,Tl),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,b,ou).call(this,t,t.from,t.to,"pointer")))},bl=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}))},Zb=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,bl).call(this,`${t}T${Rh(l)}:${Rh(d)}`,!1)},mu=function(e,t){if(performance.now()<r(this,Is)||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()},Qb=function(e){this._more=e,f(this,Ps,!0)},Dh=function(e){let t=this._more;this._more="",e&&t&&(f(this,Mt,`more:${t}`),f(this,We,{key:`more:${t}`,until:Date.now()+1e3}))},pu=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},As=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,b,Ib).call(this,e),g=!this.readonly&&!m.locked&&!u,w=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",y=`chip ${a} tone-${w}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,k=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,L=e.allDay?h:c`<span class="tm">${s(this,b,ml).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}${L}${B}</span><span class="h">${e.name}</span>${H}`:c`${k}${L}<span class="h">${e.name}</span>${H}${B}`,W=u?`${v}, ${this.t("saving")}`:v,zt=g?`${r(this,Se)}-mv`:`${r(this,Se)}-op`,K=`ev:${e.key}:${t}`,Oe=g?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=${
|
|
2688
|
-
@click=${
|
|
2689
|
-
data-row=${d.row??h} aria-label=${
|
|
2690
|
-
@click=${
|
|
2687
|
+
<span id="${r(this,Le)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
2688
|
+
<span id="${r(this,Le)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
2689
|
+
<span id="${r(this,Le)}-op" hidden>${this.t("openHint")}</span>
|
|
2690
|
+
</div>`}};Xs=new WeakMap,Le=new WeakMap,De=new WeakMap,xe=new WeakMap,Z=new WeakMap,Q=new WeakMap,Pr=new WeakMap,Ct=new WeakMap,Ge=new WeakMap,Dl=new WeakMap,Fi=new WeakMap,Js=new WeakMap,Zs=new WeakMap,Qs=new WeakMap,en=new WeakMap,Al=new WeakMap,b=new WeakSet,Me=function(){return Fb.includes(this.view)?this.view:"month"},qi=function(){return Aa(this,this.locale)},El=function(){return Ha(r(this,b,qi))},Bh=function(){return Rd(r(this,b,qi),this.hourCycle)},_t=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},mu=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,b,qi)):(Math.trunc(e)%7+7)%7},Ml=function(){return N(this.today)?this.today:Gm()},ft=function(){return N(this.date)??N(r(this,b,Ml))},pu=function(){return r(this,b,Me)==="month"&&this._narrow},Vb=function(){return r(this,b,Me)!=="month"},bt=function(){let e=r(this,b,ft),t=r(this,b,mu);if(r(this,b,Me)==="day")return[e];if(r(this,b,Me)==="week"){if(this._narrow)return[e,Y(e,1),Y(e,2)];let d=Y(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>Y(d,u))}let i=Ft(e),a=Y(i,-((i.getDay()-t+7)%7)),l=Math.ceil((qh(a,La(e))+1)/7)*7;return Array.from({length:l},(d,m)=>Y(a,m))},Ks=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(it(e.start).date||e.start);if(!u)return null;let v=N(it(e.end).date||e.end)??u;v<u&&(v=u);let g=Math.min(qh(u,v),366);return{el:e,key:e.key,name:t,allDay:a,start:u,end:v,min:0,dur:1440,days:Array.from({length:g+1},(w,y)=>P(Y(u,y)))}}let l=kt(e.start);if(!l)return null;let d=kt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let m=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:a,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:m,days:[P(l)]}},Kb=function(){return this.events.map(e=>s(this,b,Ks).call(this,e)).filter(e=>!!e)},Wb=function(e){let t=new Map;for(let i of e)for(let a of i.days)(t.get(a)??t.set(a,[]).get(a)).push(i);for(let i of t.values())i.sort((a,l)=>(a.allDay===l.allDay?0:a.allDay?-1:1)||a.start.getTime()-l.start.getTime()||a.name.localeCompare(l.name));return t},We=function(e){return ae(e,{weekday:"long",day:"numeric",month:"long"},r(this,b,qi))},Tl=function(e){return r(this,b,Bh).format((e%1440+1440)%1440)},zl=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=Ub(r(this,b,qi),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(g=>g.source==="endRange"),v=-1;if(m.forEach((g,w)=>{g.source==="startRange"&&(v=w)}),v>=0&&u>v){let g=w=>hu(w.map(y=>y.value).join(""));return this.t("timeRange",{start:g(m.slice(0,v+1)),end:g(m.slice(u))})}}}catch{}let l=P(e)===P(t),d=m=>l?s(this,b,Tl).call(this,m.getHours()*60+m.getMinutes()):r(this,b,Bh).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},Fh=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,b,We).call(this,e.start)}):this.t("allDayRange",{start:s(this,b,We).call(this,e.start),end:s(this,b,We).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&qh(e.start,e.end)===1)?s(this,b,zl).call(this,e.start,e.end):this.t("timed",{date:s(this,b,We).call(this,e.start),time:s(this,b,zl).call(this,e.start,e.end)})},Gb=function(e){let t={title:e.name,when:s(this,b,Fh).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Yb=function(e){let t=r(this,b,qi);if(r(this,b,Me)==="month")return r(this,b,El).monthYear(r(this,b,ft));if(e.length===1)return ae(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Ub(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return hu(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Xb=function(e){return r(this,b,Bh).hour12?hu(ae(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,b,qi))):s(this,b,Tl).call(this,e*60)},Ir=function(e,t){let{start:i,end:a}=s(this,b,gu).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,b,We).call(this,i),time:s(this,b,zl).call(this,i,a)}):s(this,b,We).call(this,Y(N(e.origin),t.group-e.from.group))},uu=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<Vy;t!==this._narrow&&(this._narrow=t)},_l=function(e,t){return r(this,b,Me)==="month"?tt(e,t):r(this,b,Me)==="week"?Y(e,t*(this._narrow?3:7)):Y(e,t)},Jb=function(e){this.view!==e&&(this.view=e)},Cl=function(){return[...this.renderRoot.querySelectorAll(".item")]},Zb=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},Qb=function(){let e=P(r(this,b,ft));if(r(this,b,pu))return`day:${e}`;if(r(this,b,Me)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},ev=function(){let e=s(this,b,Cl).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Ct))??e.find(i=>i.dataset.k===s(this,b,Qb).call(this))??e.find(i=>i.dataset.day===P(r(this,b,ft)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},tv=function(e){f(this,Ct,e.dataset.k??"");for(let t of s(this,b,Cl).call(this))t.tabIndex=t===e?0:-1;e.focus()},Rl=new WeakMap,Hl=new WeakMap,iv=function(e,t){let i=new Map;for(let y of s(this,b,Cl).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,bt).call(this).length,u=r(this,b,Me)==="month",v=e.dataset.row,g=(y,k)=>{let L=y>=0&&y<m?i.get(y):void 0;return(L?.length?k(L):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(k=>k.dataset.row===v)??y[0];switch(t){case"ArrowRight":return g(a+1,w);case"ArrowLeft":return g(a-1,w);case"ArrowDown":return l[d+1]??(u?g(a+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?g(a-7,y=>y[y.length-1]):null;case"Home":return u?g(a-a%7,y=>y[0]):g(0,w);case"End":return u?g(Math.min(m-1,a-a%7+6),y=>y[0]):g(m-1,w);default:return null}},rv=function(e,t){let i=e.dataset.day??P(r(this,b,ft)),a=s(this,b,_l).call(this,N(i)??r(this,b,ft),t),l=P(a),d=(e.dataset.k??"").split(":")[0],m;r(this,b,pu)?m=`day:${l}`:r(this,b,Me)==="month"?m=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?m=`adadd:${l}`:m=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,b,_l).call(this,r(this,b,ft),t)),f(this,Ct,m),f(this,Ge,{key:m,until:Date.now()+1e3})},Nl=new WeakMap,Sl=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,b,_t))+1},av=function(e,t){let i=r(this,Z);if(!i)return null;let a=s(this,b,bt).call(this).length,l=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,b,Me)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return v?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return v?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:v?t.group-t.group%7:0,index:0};case"End":return{group:v?l(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,b,Sl).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,b,_t))),u=v=>Math.max(0,Math.min(d,v));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+m)};case"PageUp":return{group:t.group,index:u(t.index-m)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},gu=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,b,bt).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,b,_t));return{start:m,end:new Date(m.getTime()+i.dur*6e4)}}let a=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+a,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},fu=function(e,t){let a=s(this,b,bt).call(this).map(P).indexOf(t);if(a<0)return null;let l=r(this,b,Vb)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,b,_t)),s(this,b,Sl).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},bu=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),f(this,Z,null),this._target=null},sv=function(e){let t=r(this,Z);if(!t||!e){this._target=null;return}let i=P(s(this,b,bt).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,_t):void 0}},nv=function(e,t){let i=r(this,Z);s(this,b,bu).call(this),i&&(f(this,Js,performance.now()+400),s(this,b,vu).call(this,i,e,t,"keyboard"))},vu=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,b,gu).call(this,e,i),u=P(Y(N(e.origin),i.group-t.group));s(this,b,xu).call(this,e.ev,d,m,a,l,e.mode==="time"?P(d):u)},yu=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:Bb(t),end:Bb(i)}},xu=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,b,yu).call(this,e.allDay,e.start,e.end),g=s(this,b,yu).call(this,e.allDay,t,i),w=B=>{a==="keyboard"&&f(this,Ge,{key:B,until:Date.now()+1e3})};if(l||v.start===g.start&&v.end===g.end)return a!=="api"&&r(this,De).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},k=e.allDay?s(this,b,We).call(this,t):this.t("timed",{date:s(this,b,We).call(this,t),time:s(this,b,zl).call(this,t,i)}),L=[],A={value:e.key,event:m,from:v,to:g,allDay:e.allDay,source:a,waitUntil:B=>{L.push(Promise.resolve(B))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:A,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Pr).set(m,v),m.start=g.start,m.end=g.end),w(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,De).announce(this.t("moved",{event:u,place:y.allDay?s(this,b,We).call(this,t):k})),L.length&&(m.pending=!0,Promise.all(L).then(()=>{m.pending=!1,this.controlled||r(this,Pr).delete(m)},()=>{m.pending=!1,this.controlled?r(this,De).announce(this.t("reverted",{event:u,place:s(this,b,Fh).call(this,e)})):this.revert(m)})),!0):(r(this,De).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},Il=new WeakMap,wu=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let a=0,l=1/0;i.forEach((m,u)=>{let v=m.getBoundingClientRect(),g=e<v.left?v.left-e:e>v.right?e-v.right:0;g<l&&(l=g,a=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},ov=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let a=null,l=1/0;for(let d of i){let m=d.getBoundingClientRect(),u=e<m.left?m.left-e:e>m.right?e-m.right:0,v=t<m.top?m.top-t:t>m.bottom?t-m.bottom:0,g=Math.hypot(u,v);g<l&&(l=g,a=d)}return a?Number(a.dataset.i):null},Pl=new WeakMap,Ol=new WeakMap,ql=new WeakMap,Bl=new WeakMap,Fl=new WeakMap,jl=new WeakMap,$u=function(){let e=r(this,Q);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,De).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,b,Ir).call(this,e,e.from)})),s(this,b,jh).call(this);let t=()=>{r(this,Q)?.started&&(s(this,b,lv).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},jh=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,b,wu).call(this,e.x,e.y);if(l){let d=s(this,b,Sl).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,_t))))}}}else{let l=s(this,b,ov).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,bt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,b,_t):void 0},i&&r(this,De).announce(this.t("over",{place:s(this,b,Ir).call(this,e,t)}))},lv=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let m=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-m),v=l(d.bottom-e.y),g=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==g&&s(this,b,jh).call(this)},Bi=function(e){let t=r(this,Q);t&&(f(this,Q,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,Bl),!0),window.removeEventListener("pointerup",r(this,Fl),!0),window.removeEventListener("pointercancel",r(this,jl),!0),window.removeEventListener("touchmove",r(this,Ol),!0),window.removeEventListener("contextmenu",r(this,ql),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,b,vu).call(this,t,t.from,t.to,"pointer")))},Ll=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,b,Me)},bubbles:!0,composed:!0}))},cv=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,_t))*r(this,b,_t);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,b,Ll).call(this,`${t}T${Kh(l)}:${Kh(d)}`,!1)},ku=function(e,t){if(performance.now()<r(this,Js)||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()},dv=function(e){this._more=e,f(this,Zs,!0)},Uh=function(e){let t=this._more;this._more="",e&&t&&(f(this,Ct,`more:${t}`),f(this,Ge,{key:`more:${t}`,until:Date.now()+1e3}))},Eu=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},Ws=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,b,Gb).call(this,e),g=!this.readonly&&!m.locked&&!u,w=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",y=`chip ${a} tone-${w}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,k=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,L=e.allDay?h:c`<span class="tm">${s(this,b,Tl).call(this,e.min)}</span>`,A=m.kind&&(a!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,O=u?c`<span class="spin" aria-hidden="true"></span>`:h,B=a==="time"?c`<span class="lead">${k}${L}${O}</span><span class="h">${e.name}</span>${A}`:c`${k}${L}<span class="h">${e.name}</span>${A}${O}`,K=u?`${v}, ${this.t("saving")}`:v,Ye=g?`${r(this,Le)}-mv`:`${r(this,Le)}-op`,W=`ev:${e.key}:${t}`,qe=g?this.t("roleDescription"):h;return m.href?c`<a class=${y} href=${m.href} style=${d.style??h} data-k=${W} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2691
|
+
data-row=${d.row??h} aria-label=${K} aria-describedby=${Ye} aria-roledescription=${qe}
|
|
2692
|
+
@click=${ct=>s(this,b,ku).call(this,ct,e)}>${B}</a>`:c`<button type="button" class=${y} style=${d.style??h} data-k=${W} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2693
|
+
data-row=${d.row??h} aria-label=${K} aria-describedby=${Ye} aria-roledescription=${qe}
|
|
2694
|
+
@click=${ct=>s(this,b,ku).call(this,ct,e)}>${B}</button>`},Vh=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.name}</div>`},hv=function(e){let t=r(this,b,Me),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">
|
|
2691
2695
|
<div class="nav">
|
|
2692
2696
|
<button type="button" class="hb icon prev" aria-label=${a} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
2693
2697
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
2694
2698
|
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
2695
2699
|
</div>
|
|
2696
|
-
<div class="title" part="title" id="${r(this,
|
|
2700
|
+
<div class="title" part="title" id="${r(this,Le)}-t" role="heading" aria-level=${d} aria-live="polite">${s(this,b,Yb).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
2697
2701
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
2698
|
-
${
|
|
2702
|
+
${Fb.map(m=>c`<button type="button" class="hb" data-view=${m} aria-pressed=${m===t?"true":"false"} @click=${()=>s(this,b,Jb).call(this,m)}>${this.t(m)}</button>`)}
|
|
2699
2703
|
</div>
|
|
2700
|
-
</div>`},
|
|
2701
|
-
<button type="button" class="dayb item" data-k="day:${
|
|
2702
|
-
@click=${()=>{this.date=
|
|
2703
|
-
</td>`}let
|
|
2704
|
-
aria-label=${
|
|
2705
|
-
<div class="dh">${
|
|
2706
|
-
${
|
|
2707
|
-
@click=${()=>s(this,b,
|
|
2704
|
+
</div>`},mv=function(e){let t=r(this,b,El),i=Array.from({length:7},(a,l)=>(l+r(this,b,mu))%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>`},pv=function(e,t){let i=r(this,b,ft),a=r(this,b,Ml),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=s(this,b,Eu).call(this),m=this._target,u=Array.from({length:e.length/7},(B,K)=>e.slice(K*7,K*7+7)),v=this._narrow,g=(B,K,Ye)=>{let W=P(B),qe=t.get(W)??[],ct=s(this,b,We).call(this,B),Yu=`${B.getMonth()!==i.getMonth()?"other":""} ${W===a?"today":""} ${m?.iso===W?"over":""}`,Xu=c`<span class="num" aria-hidden="true">${r(this,b,El).day(B)}</span>`;if(v){let Lt=qe.slice(0,3).map(Jr=>["attention","information","success","critical"].includes(Jr.el.tone)?Jr.el.tone:"neutral");return c`<td class=${Yu} data-drop data-i=${K} aria-selected=${W===P(i)?"true":"false"} aria-current=${W===a?"date":h}>
|
|
2705
|
+
<button type="button" class="dayb item" data-k="day:${W}" data-i=${K} data-day=${W} aria-label=${this.t("dayEvents",{date:ct,count:qe.length})}
|
|
2706
|
+
@click=${()=>{this.date=W,f(this,Ct,`day:${W}`)}}>${Xu}<span class="dots">${Lt.map(Jr=>c`<span class="dot tone-${Jr}"></span>`)}</span></button>
|
|
2707
|
+
</td>`}let Xr=qe,uc=0;if(qe.length>l){Xr=qe.slice(0,l-1);let Lt=d&&qe.find(Jr=>Jr.key===d.key);Lt&&!Xr.includes(Lt)&&(Xr=[...qe.slice(0,l-2),Lt]),uc=qe.length-Xr.length}let gc=this.readonly;return c`<td class="${Yu}${gc?" item":""}" data-drop data-i=${K} data-day=${W} data-k=${gc?`cell:${W}`:h}
|
|
2708
|
+
aria-label=${gc?this.t("dayEvents",{date:ct,count:qe.length}):h} aria-current=${W===a?"date":h}>
|
|
2709
|
+
<div class="dh">${Xu}<span class="vh">${ct}</span>
|
|
2710
|
+
${gc?h:c`<button type="button" class="add item" data-k="add:${W}" data-i=${K} data-day=${W} aria-label=${this.t("addOn",{date:ct})}
|
|
2711
|
+
@click=${()=>s(this,b,Ll).call(this,W,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2708
2712
|
</div>
|
|
2709
|
-
${
|
|
2710
|
-
${
|
|
2711
|
-
${m?.iso===
|
|
2713
|
+
${Xr.length||m?.iso===W&&d?c`<ul class="evs">
|
|
2714
|
+
${Xr.map(Lt=>c`<li>${s(this,b,Ws).call(this,Lt,W,K,"month",!0)}</li>`)}
|
|
2715
|
+
${m?.iso===W&&d?c`<li aria-hidden="true">${s(this,b,Vh).call(this,d)}</li>`:h}
|
|
2712
2716
|
</ul>`:h}
|
|
2713
|
-
${
|
|
2714
|
-
aria-expanded=${this._more===
|
|
2715
|
-
@click=${()=>this._more===
|
|
2716
|
-
${this._more===
|
|
2717
|
-
<div class="pop-h"><span>${
|
|
2718
|
-
<ul>${
|
|
2717
|
+
${uc?c`<button type="button" class="more item" data-k="more:${W}" data-i=${K} data-day=${W} aria-haspopup="dialog"
|
|
2718
|
+
aria-expanded=${this._more===W?"true":"false"} aria-label=${this.t("moreLabel",{count:uc,date:ct})}
|
|
2719
|
+
@click=${()=>this._more===W?s(this,b,Uh).call(this,!1):s(this,b,dv).call(this,W)}>${this.t("more",{count:uc})}</button>`:h}
|
|
2720
|
+
${this._more===W?c`<div class="pop ${Ye>=4?"end":""}" role="dialog" aria-label=${ct}>
|
|
2721
|
+
<div class="pop-h"><span>${ct}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>s(this,b,Uh).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
2722
|
+
<ul>${qe.map(Lt=>c`<li>${s(this,b,Ws).call(this,Lt,W,K,"list",!1)}</li>`)}</ul>
|
|
2719
2723
|
</div>`:h}
|
|
2720
|
-
</td>`},w=c`<table class="month ${v?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,
|
|
2724
|
+
</td>`},w=c`<table class="month ${v?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,Le)}-t" aria-describedby="${r(this,Le)}-gh"
|
|
2721
2725
|
aria-busy=${this.loading?"true":"false"}>
|
|
2722
|
-
${s(this,b,
|
|
2723
|
-
<tbody>${u.map((
|
|
2724
|
-
</table>`;if(!v)return w;let y=P(i),k=t.get(y)??[],L=e.findIndex(
|
|
2725
|
-
<section class="agenda" part="agenda" aria-labelledby="${r(this,
|
|
2726
|
+
${s(this,b,mv).call(this,v)}
|
|
2727
|
+
<tbody>${u.map((B,K)=>c`<tr>${B.map((Ye,W)=>g(Ye,K*7+W,W))}</tr>`)}</tbody>
|
|
2728
|
+
</table>`;if(!v)return w;let y=P(i),k=t.get(y)??[],L=e.findIndex(B=>P(B)===y),A=s(this,b,We).call(this,i),O=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${w}
|
|
2729
|
+
<section class="agenda" part="agenda" aria-labelledby="${r(this,Le)}-ag">
|
|
2726
2730
|
<div class="ag-h">
|
|
2727
|
-
<div class="ag-t" id="${r(this,
|
|
2728
|
-
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:
|
|
2731
|
+
<div class="ag-t" id="${r(this,Le)}-ag" role="heading" aria-level=${O}>${A}</div>
|
|
2732
|
+
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:A})} @click=${()=>s(this,b,Ll).call(this,y,!0)}>
|
|
2729
2733
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
2730
2734
|
</div>
|
|
2731
|
-
${k.length?c`<ul class="ag-list">${k.map(
|
|
2732
|
-
</section>`},
|
|
2735
|
+
${k.length?c`<ul class="ag-list">${k.map(B=>c`<li>${s(this,b,Ws).call(this,B,y,L,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
2736
|
+
</section>`},uv=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 g=l.findIndex(w=>w<=u.min);g<0?(g=l.length,l.push(v)):l[g]=v,t.set(u,{lane:g,lanes:1}),a.push(u),d=Math.max(d,v)}return m(),t},gv=function(e,t){let i=r(this,b,Ml),a=r(this,b,El),l=s(this,b,Eu).call(this),d=this._target,m=this.readonly,u=e.map(g=>{let w=P(g),y=t.get(w)??[];return{d:g,iso:w,text:s(this,b,We).call(this,g),allDay:y.filter(k=>k.allDay),timed:y.filter(k=>!k.allDay),lanes:s(this,b,uv).call(this,y)}}),v=Array.from({length:24},(g,w)=>w);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${r(this,Le)}-t" aria-describedby="${r(this,Le)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
2733
2737
|
style="--cols:${e.length}">
|
|
2734
2738
|
<div class="tg-top" role="rowgroup">
|
|
2735
2739
|
<div class="row" role="row">
|
|
@@ -2742,24 +2746,24 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2742
2746
|
<div class="axis" role="rowheader">${this.t("allDay")}</div>
|
|
2743
2747
|
${u.map((g,w)=>c`<div class="adcell ${d?.iso===g.iso&&l?.allDay?"over":""}" role="gridcell" data-drop data-i=${w}>
|
|
2744
2748
|
${m?h:c`<button type="button" class="add item" data-k="adadd:${g.iso}" data-i=${w} data-day=${g.iso} data-row="a"
|
|
2745
|
-
aria-label=${this.t("addAllDay",{date:g.text})} @click=${()=>s(this,b,
|
|
2746
|
-
${g.allDay.map(y=>s(this,b,
|
|
2747
|
-
${d?.iso===g.iso&&l?.allDay?s(this,b,
|
|
2749
|
+
aria-label=${this.t("addAllDay",{date:g.text})} @click=${()=>s(this,b,Ll).call(this,g.iso,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2750
|
+
${g.allDay.map(y=>s(this,b,Ws).call(this,y,g.iso,w,"allday",!0,{row:"a"}))}
|
|
2751
|
+
${d?.iso===g.iso&&l?.allDay?s(this,b,Vh).call(this,l):h}
|
|
2748
2752
|
</div>`)}
|
|
2749
2753
|
</div>
|
|
2750
2754
|
</div>
|
|
2751
2755
|
<div class="tg-body" role="rowgroup">
|
|
2752
2756
|
${v.map(g=>c`<div class="row hr" role="row">
|
|
2753
|
-
<div class="axis" role="rowheader"><span>${s(this,b,
|
|
2754
|
-
${u.map((w,y)=>{let k=w.timed.filter(
|
|
2757
|
+
<div class="axis" role="rowheader"><span>${s(this,b,Xb).call(this,g)}</span></div>
|
|
2758
|
+
${u.map((w,y)=>{let k=w.timed.filter(A=>Math.floor(A.min/60)===g),L=l&&!l.allDay&&d?.iso===w.iso&&d.min!==void 0&&Math.floor(d.min/60)===g;return c`<div class="tcell" role="gridcell" data-i=${y} data-row=${g} data-day=${w.iso}>
|
|
2755
2759
|
${m?h:c`<button type="button" class="slot item" data-k="slot:${w.iso}:${g}" data-i=${y} data-row=${g} data-day=${w.iso}
|
|
2756
|
-
aria-label=${this.t("addAt",{time:s(this,b,
|
|
2757
|
-
${k.map(
|
|
2758
|
-
${L?s(this,b,
|
|
2760
|
+
aria-label=${this.t("addAt",{time:s(this,b,Tl).call(this,g*60),date:w.text})} @click=${A=>s(this,b,cv).call(this,A,w.iso,g)}></button>`}
|
|
2761
|
+
${k.map(A=>{let O=w.lanes.get(A)??{lane:0,lanes:1},B=Math.min(A.dur,1440-A.min)/60;return s(this,b,Ws).call(this,A,w.iso,y,"time",!0,{row:String(g),style:`--top:${(A.min-g*60)/60};--len:${B};--lane:${O.lane};--lanes:${O.lanes}`})})}
|
|
2762
|
+
${L?s(this,b,Vh).call(this,l,"time",`--top:${(d.min-g*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
2759
2763
|
</div>`})}
|
|
2760
2764
|
</div>`)}
|
|
2761
2765
|
</div>
|
|
2762
|
-
</div>`},
|
|
2766
|
+
</div>`},Ys.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}},Ys.styles=[E,x`
|
|
2763
2767
|
:host { display: block; position: relative; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
2764
2768
|
:host([dragging]) { cursor: grabbing; user-select: none; -webkit-user-select: none; }
|
|
2765
2769
|
.cal { display: flex; flex-direction: column; gap: var(--cm-space-12); min-width: 0; }
|
|
@@ -2920,12 +2924,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2920
2924
|
.chip.time > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2921
2925
|
.chip.time .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
2922
2926
|
.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; }
|
|
2923
|
-
`];$("cm-calendar",
|
|
2927
|
+
`];$("cm-calendar",Ys);var xE=z("reportTile",{pinned:", pinned"}),Or=class extends T{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=c`
|
|
2924
2928
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
2925
2929
|
<span class="label">${this.label}</span>
|
|
2926
2930
|
${this.pinned?c`<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
2927
2931
|
<span class="sr">${this.t("pinned")}</span></span>`:h}
|
|
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>`}};
|
|
2932
|
+
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};Or.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},Or.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Or.styles=[E,x`
|
|
2929
2933
|
:host { display: block; }
|
|
2930
2934
|
.tile {
|
|
2931
2935
|
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-12);
|
|
@@ -2944,10 +2948,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2944
2948
|
.icon cm-icon::part(svg) { width: 32px; height: 32px; }
|
|
2945
2949
|
::slotted([slot='icon']) { width: 32px; height: 32px; }
|
|
2946
2950
|
}
|
|
2947
|
-
`];$("cm-report-tile",
|
|
2951
|
+
`];$("cm-report-tile",Or);var tn=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`
|
|
2948
2952
|
${this.heading?c`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:h}
|
|
2949
2953
|
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":h}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
2950
|
-
`}};
|
|
2954
|
+
`}};tn.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},tn.styles=[E,x`
|
|
2951
2955
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
2952
2956
|
.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; }
|
|
2953
2957
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-12); }
|
|
@@ -2957,7 +2961,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2957
2961
|
.title { margin-bottom: var(--cm-space-8); }
|
|
2958
2962
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
2959
2963
|
}
|
|
2960
|
-
`];$("cm-report-tiles",
|
|
2964
|
+
`];$("cm-report-tiles",tn);var ME=z("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),fv=/^\s*-?\d+(\.\d+)?\s*$/,rn=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:fv.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">
|
|
2961
2965
|
<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>
|
|
2962
2966
|
</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`
|
|
2963
2967
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
@@ -2966,7 +2970,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2966
2970
|
${i}
|
|
2967
2971
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
2968
2972
|
</span>
|
|
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}`}};
|
|
2973
|
+
`,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}`}};rn.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&fv.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}},rn.styles=[E,x`
|
|
2970
2974
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
2971
2975
|
.tile {
|
|
2972
2976
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -3002,29 +3006,29 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3002
3006
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
3003
3007
|
}
|
|
3004
3008
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
3005
|
-
`];$("cm-metric",
|
|
3006
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,
|
|
3009
|
+
`];$("cm-metric",rn);var an=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 bv(this)}};an.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}},an.styles=x`:host { display: none !important; }`;$("cm-nav-item",an);function bv(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=ai(o);return t.length&&(e.items=t),e}var ai=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(bv),Mu=o=>o.value||o.href||o.label,Wh=o=>!!o.current||!!o.items?.some(Wh),ji=(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},Ui=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:Mu(n),href:n.href??""}}));var RE=z("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),Ul,Vl,Xh,j,Tu,Gh,zu,vv,yv,_u,Cu,xv,Su,Lu,Yh,Du,wv,sn=class extends T{constructor(){super(...arguments);p(this,j);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;p(this,Ul,new Set);p(this,Vl);p(this,Xh,R("cm-sidenav"))}connectedCallback(){super.connectedCallback(),s(this,j,Tu).call(this),f(this,Vl,ji(this,()=>s(this,j,Tu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Vl)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let i=s(this,j,Gh).call(this,e,t);r(this,Ul).has(i)||!e.items?.length||(r(this,Ul).add(i),(e.expanded||Wh(e))&&this._open.add(i))})}toggle(e,t){let i=this.navItems[e];if(!i?.items?.length)return;let a=s(this,j,Gh).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`
|
|
3010
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,j,yv)}>
|
|
3007
3011
|
<slot name="header"></slot>
|
|
3008
3012
|
<ul part="list">
|
|
3009
|
-
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,
|
|
3010
|
-
${s(this,
|
|
3011
|
-
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,
|
|
3012
|
-
${s(this,
|
|
3013
|
+
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,j,Du).call(this,t,"",{index:i})}</li>`;let a=!e&&this._open.has(s(this,j,Gh).call(this,t,i)),l=`${r(this,Xh)}-${i}`;return c`<li>
|
|
3014
|
+
${s(this,j,Yh).call(this,t,c`<button type="button" class="item parent ${Wh(t)?"has-current":""}" part="item" data-index=${i}
|
|
3015
|
+
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,j,xv).call(this,i):this.toggle(i)}>
|
|
3016
|
+
${s(this,j,Su).call(this,t)}${s(this,j,Lu).call(this,t)}
|
|
3013
3017
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
3014
3018
|
</button>`)}
|
|
3015
3019
|
<ul class="sub" id=${l} ?hidden=${!a} aria-label=${t.label}>
|
|
3016
|
-
${s(this,
|
|
3020
|
+
${s(this,j,_u).call(this,t.items).map(([d,m])=>c`<li>${s(this,j,Du).call(this,{...d,icon:void 0},m?"deep":"",{parent:i})}</li>`)}
|
|
3017
3021
|
</ul>
|
|
3018
3022
|
</li>`})}
|
|
3019
3023
|
</ul>
|
|
3020
|
-
${s(this,
|
|
3024
|
+
${s(this,j,wv).call(this)}
|
|
3021
3025
|
<slot name="footer"></slot>
|
|
3022
3026
|
<slot hidden></slot>
|
|
3023
3027
|
</nav>
|
|
3024
|
-
`}};
|
|
3025
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,
|
|
3026
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,
|
|
3027
|
-
@click=${()=>s(this,
|
|
3028
|
+
`}};Ul=new WeakMap,Vl=new WeakMap,Xh=new WeakMap,j=new WeakSet,Tu=function(){this._slotted=ai(this)},Gh=function(e,t){return`${t}:${Mu(e)}`},zu=function(e,t){Ui(this,t)||e.preventDefault()},vv=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},yv=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let i=s(this,j,vv).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()},_u=function(e,t=0){return e.flatMap(i=>[[i,t],...s(this,j,_u).call(this,i.items??[],t+1)])},Cu=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},xv=function(e){s(this,j,Cu).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},Su=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},Lu=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}`},Yh=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},Du=function(e,t,i={}){let a=c`${s(this,j,Su).call(this,e)}${s(this,j,Lu).call(this,e)}`;return s(this,j,Yh).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
3029
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,zu).call(this,l,e)}>${a}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
3030
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,zu).call(this,l,e)}>${a}</button>`)},wv=function(){if(!this.collapsible)return h;let e=this.t(this.collapsed?"expand":"collapse"),t=c`<cm-icon name=${this.collapsed?"chevron-right":"chevron-left"} size="20"></cm-icon>${this.collapsed?c`<span class="sr">${e}</span>`:c`<span class="label">${e}</span>`}`;return c`<div class="toggle-row">${s(this,j,Yh).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
3031
|
+
@click=${()=>s(this,j,Cu).call(this,!this.collapsed)}>${t}</button>`)}</div>`},sn.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},sn.styles=[E,x`
|
|
3028
3032
|
:host { display: block; width: var(--cm-side-navigation-width, 220px); }
|
|
3029
3033
|
nav {
|
|
3030
3034
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: var(--cm-radius-lg);
|
|
@@ -3048,7 +3052,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3048
3052
|
.badge {
|
|
3049
3053
|
flex: none; box-sizing: border-box; min-inline-size: var(--cm-space-20); padding: 0 var(--cm-space-4); text-align: center;
|
|
3050
3054
|
border-radius: var(--cm-radius-full); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500;
|
|
3051
|
-
font-variant-numeric: tabular-nums; color: var(--cm-text
|
|
3055
|
+
font-variant-numeric: tabular-nums; color: var(--cm-count-text); background: var(--cm-count-bg);
|
|
3052
3056
|
}
|
|
3053
3057
|
.sub { padding: 0 0 var(--cm-space-4); }
|
|
3054
3058
|
.sub .item { min-height: var(--cm-control-height-sm); padding-inline-start: calc(var(--cm-space-12) + var(--cm-icon-size-md) + var(--cm-space-8)); }
|
|
@@ -3066,10 +3070,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3066
3070
|
.initial { display: grid; place-items: center; width: var(--cm-icon-size-md); height: var(--cm-icon-size-md); font-size: var(--cm-font-size-14); font-weight: 600; }
|
|
3067
3071
|
.dot {
|
|
3068
3072
|
position: absolute; inset-block-start: 6px; inset-inline-start: calc(50% + 4px); min-width: 8px; height: 8px; border-radius: var(--cm-radius-full);
|
|
3069
|
-
background: var(--cm-
|
|
3073
|
+
background: var(--cm-count-bg); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
3070
3074
|
}
|
|
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
|
|
3072
|
-
`];$("cm-side-navigation",
|
|
3075
|
+
.dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-count-text); }
|
|
3076
|
+
`];$("cm-side-navigation",sn);function $v(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 nn=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=$v(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>`}};nn.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},nn.styles=[E,x`
|
|
3073
3077
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3074
3078
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
3075
3079
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -3082,22 +3086,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3082
3086
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
3083
3087
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
3084
3088
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
3085
|
-
`];$("cm-avatar",
|
|
3089
|
+
`];$("cm-avatar",nn);var UE=z("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),cn,si,dn,Te,Kl,Au,on,ln=class extends T{constructor(){super();p(this,Te);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;p(this,cn);p(this,si,!1);p(this,dn,null);this.addEventListener("cm-select",e=>{let t=s(this,Te,Kl).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){s(this,Te,Kl).call(this)?.focus();return}this._searchOpen||(f(this,dn,Vm()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),f(this,cn,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,cn).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,cn)?.disconnect(),r(this,si)&&(Ao(),f(this,si,!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,si)||(Um(),f(this,si,!0)),s(this,Te,Kl).call(this)?.focus(),s(this,Te,on).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,si)&&(Ao(),f(this,si,!1));let i=r(this,dn)??this.renderRoot.querySelector(".search-btn");f(this,dn,null),i?.isConnected&&i.focus(),s(this,Te,on).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
3086
3090
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
3087
3091
|
<div class="logo"><slot name="logo"></slot></div>
|
|
3088
3092
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
3089
|
-
@click=${()=>s(this,
|
|
3090
|
-
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,
|
|
3093
|
+
@click=${()=>s(this,Te,on).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="16"></cm-icon></button>`:h}
|
|
3094
|
+
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,Te,Au)}></slot></div>`}
|
|
3091
3095
|
<span class="grow"></span>
|
|
3092
3096
|
<div class="end">
|
|
3093
3097
|
${this._narrow&&this._hasSearch?c`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
3094
3098
|
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:h}
|
|
3095
3099
|
<div class="actions"><slot name="actions"></slot></div>
|
|
3096
3100
|
${this.balance?c`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
3097
|
-
@click=${()=>s(this,
|
|
3101
|
+
@click=${()=>s(this,Te,on).call(this,"cm-wallet")}>${this.balance}</button>`:h}
|
|
3098
3102
|
<slot name="end"></slot>
|
|
3099
3103
|
${this.userName?c`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
3100
|
-
@click=${()=>s(this,
|
|
3104
|
+
@click=${()=>s(this,Te,on).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
3101
3105
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:h}
|
|
3102
3106
|
<slot name="account"></slot>
|
|
3103
3107
|
</div>
|
|
@@ -3106,11 +3110,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3106
3110
|
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
3107
3111
|
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
3108
3112
|
<div class="layer-bar">
|
|
3109
|
-
<div class="layer-search"><slot name="search" @slotchange=${s(this,
|
|
3113
|
+
<div class="layer-search"><slot name="search" @slotchange=${s(this,Te,Au)}></slot></div>
|
|
3110
3114
|
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
3111
3115
|
</div>
|
|
3112
3116
|
</dialog>`:h}
|
|
3113
|
-
`}};
|
|
3117
|
+
`}};cn=new WeakMap,si=new WeakMap,dn=new WeakMap,Te=new WeakSet,Kl=function(){return this.querySelector(':scope > [slot="search"]')},Au=function(){this._hasSearch=!!s(this,Te,Kl).call(this)},on=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},ln.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}},ln.styles=[E,x`
|
|
3114
3118
|
:host {
|
|
3115
3119
|
display: block; background: var(--cm-bg-surface); container-type: inline-size;
|
|
3116
3120
|
--_h: var(--cm-control-height-md); --_touch: var(--cm-control-height-touch);
|
|
@@ -3187,10 +3191,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3187
3191
|
@media (pointer: coarse) {
|
|
3188
3192
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
3189
3193
|
}
|
|
3190
|
-
`];$("cm-header-bar",
|
|
3191
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,
|
|
3194
|
+
`];$("cm-header-bar",ln);var JE=z("bottomNavigation",{label:"Main"}),Wl,qr,Ru,kv,hn=class extends T{constructor(){super(...arguments);p(this,qr);this.items=[];this.fixed=!1;this._slotted=[];p(this,Wl)}connectedCallback(){super.connectedCallback(),s(this,qr,Ru).call(this),f(this,Wl,ji(this,()=>s(this,qr,Ru).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Wl)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3195
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,qr,kv).call(this,e)}</li>`)}</ul>
|
|
3192
3196
|
<slot hidden></slot>
|
|
3193
|
-
</nav>`}};
|
|
3197
|
+
</nav>`}};Wl=new WeakMap,qr=new WeakSet,Ru=function(){this._slotted=ai(this)},kv=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=>{Ui(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>`},hn.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},hn.styles=[E,x`
|
|
3194
3198
|
:host { display: block; }
|
|
3195
3199
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
3196
3200
|
nav {
|
|
@@ -3212,32 +3216,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3212
3216
|
.icon { display: grid; place-items: center; width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
3213
3217
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
3214
3218
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3215
|
-
`];$("cm-bottom-navigation",
|
|
3219
|
+
`];$("cm-bottom-navigation",hn);var aM=z("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Gl,Br,Ae,Hu,Ev,Nu,Iu,Mv,mn=class extends T{constructor(){super(...arguments);p(this,Ae);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;p(this,Gl);p(this,Br,R("cm-mmenu"))}connectedCallback(){super.connectedCallback(),s(this,Ae,Hu).call(this),f(this,Gl,ji(this,()=>s(this,Ae,Hu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Gl)?.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,Br)}-sub"
|
|
3216
3220
|
@keydown=${i=>{i.key==="Escape"&&(i.preventDefault(),this.back())}}>
|
|
3217
3221
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
3218
3222
|
${t.label}</button>
|
|
3219
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,
|
|
3223
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,Ae,Iu).call(this,i,0,0,!0)}</li>`)}</ul>
|
|
3220
3224
|
<slot hidden></slot>
|
|
3221
3225
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3222
|
-
${s(this,
|
|
3223
|
-
${e.map((i,a)=>{let l=`${r(this,
|
|
3226
|
+
${s(this,Ae,Mv).call(this)}
|
|
3227
|
+
${e.map((i,a)=>{let l=`${r(this,Br)}-s${a}`;return c`<section aria-labelledby=${i.label?l:h}>
|
|
3224
3228
|
${i.label?c`<h2 class="heading" id=${l}>${i.label}</h2>`:h}
|
|
3225
|
-
<ul class="card">${(i.items??[]).map((d,m)=>c`<li>${s(this,
|
|
3229
|
+
<ul class="card">${(i.items??[]).map((d,m)=>c`<li>${s(this,Ae,Iu).call(this,d,a,m)}</li>`)}</ul>
|
|
3226
3230
|
</section>`})}
|
|
3227
3231
|
<slot hidden></slot>
|
|
3228
|
-
</nav>`}};
|
|
3229
|
-
@click=${()=>s(this,
|
|
3230
|
-
<h2 class="heading" id="${r(this,
|
|
3232
|
+
</nav>`}};Gl=new WeakMap,Br=new WeakMap,Ae=new WeakSet,Hu=function(){this._slotted=ai(this)},Ev=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},Nu=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Iu=function(e,t,i,a=!1){let l=v=>{Ui(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}"
|
|
3233
|
+
@click=${()=>s(this,Ae,Ev).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>`},Mv=function(){if(!this.store&&!this.userName)return h;let e=this.userName.trim().charAt(0).toUpperCase();return c`<section aria-labelledby="${r(this,Br)}-profile">
|
|
3234
|
+
<h2 class="heading" id="${r(this,Br)}-profile">${this.t("profile")}</h2>
|
|
3231
3235
|
<ul class="card">
|
|
3232
|
-
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,
|
|
3236
|
+
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,Ae,Nu).call(this,"cm-store-switch")}>
|
|
3233
3237
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
3234
3238
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3235
|
-
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,
|
|
3239
|
+
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,Ae,Nu).call(this,"cm-account")}>
|
|
3236
3240
|
<span class="avatar">${this.avatarSrc?c`<img src=${this.avatarSrc} alt="">`:c`<span aria-hidden="true">${e}</span>`}</span>
|
|
3237
3241
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?c`<span class="email">${this.userEmail}</span>`:h}</span>
|
|
3238
3242
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3239
3243
|
</ul>
|
|
3240
|
-
</section>`},
|
|
3244
|
+
</section>`},mn.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}},mn.styles=[E,x`
|
|
3241
3245
|
:host { display: block; background: var(--cm-bg-page); }
|
|
3242
3246
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
3243
3247
|
.heading {
|
|
@@ -3257,7 +3261,7 @@ ${t.label}</button>
|
|
|
3257
3261
|
.chev { color: var(--cm-icon-selected); }
|
|
3258
3262
|
.badge {
|
|
3259
3263
|
flex: none; padding: 2px var(--cm-space-8); border-radius: var(--cm-radius-full); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500;
|
|
3260
|
-
font-variant-numeric: tabular-nums; color: var(--cm-text
|
|
3264
|
+
font-variant-numeric: tabular-nums; color: var(--cm-count-text); background: var(--cm-count-bg);
|
|
3261
3265
|
}
|
|
3262
3266
|
.action { justify-content: center; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3263
3267
|
.eyebrow { display: block; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 400; color: var(--cm-text-tertiary); }
|
|
@@ -3274,12 +3278,12 @@ ${t.label}</button>
|
|
|
3274
3278
|
}
|
|
3275
3279
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3276
3280
|
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3277
|
-
`];$("cm-mobile-menu",
|
|
3281
|
+
`];$("cm-mobile-menu",mn);var dM=z("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),Jh,Tv,pn=class extends T{constructor(){super(...arguments);p(this,Jh);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
3278
3282
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
3279
3283
|
<span class="text"><slot></slot></span>
|
|
3280
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,
|
|
3284
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,Jh,Tv)}><cm-icon name="close" size="16"></cm-icon>
|
|
3281
3285
|
</button>`:h}
|
|
3282
|
-
</div>`}};
|
|
3286
|
+
</div>`}};Jh=new WeakSet,Tv=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},pn.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},pn.styles=[E,x`
|
|
3283
3287
|
:host { display: block; }
|
|
3284
3288
|
.bar {
|
|
3285
3289
|
position: relative; display: flex; align-items: center; justify-content: center; gap: var(--cm-space-8); min-height: 48px;
|
|
@@ -3301,11 +3305,11 @@ ${t.label}</button>
|
|
|
3301
3305
|
@media (max-width: 640px) {
|
|
3302
3306
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
3303
3307
|
}
|
|
3304
|
-
`];$("cm-flash-offer-bar",
|
|
3308
|
+
`];$("cm-flash-offer-bar",pn);var bM=z("linkTabs",{label:"Sections"}),Yl,Xl,Pu,un=class extends T{constructor(){super(...arguments);p(this,Xl);this.items=[];this._slotted=[];p(this,Yl)}connectedCallback(){super.connectedCallback(),s(this,Xl,Pu).call(this),f(this,Yl,ji(this,()=>s(this,Xl,Pu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Yl)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3305
3309
|
<ul part="tabs">${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3306
|
-
@click=${t=>{
|
|
3310
|
+
@click=${t=>{Ui(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
3307
3311
|
<slot hidden></slot>
|
|
3308
|
-
</nav>`}};
|
|
3312
|
+
</nav>`}};Yl=new WeakMap,Xl=new WeakSet,Pu=function(){this._slotted=ai(this)},un.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0}},un.styles=[E,x`
|
|
3309
3313
|
:host { display: block; }
|
|
3310
3314
|
ul {
|
|
3311
3315
|
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
@@ -3319,12 +3323,12 @@ ${t.label}</button>
|
|
|
3319
3323
|
a::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; border-radius: var(--cm-radius-full); background: transparent; }
|
|
3320
3324
|
a:hover { color: var(--cm-text-default); }
|
|
3321
3325
|
a[aria-current='page'] { color: var(--cm-text-default); }
|
|
3322
|
-
a[aria-current='page']::after { background: var(--cm-
|
|
3326
|
+
a[aria-current='page']::after { background: var(--cm-tab-indicator); }
|
|
3323
3327
|
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
|
|
3324
3328
|
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
3325
3329
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
3326
3330
|
|
|
3327
|
-
`];$("cm-link-tabs",
|
|
3331
|
+
`];$("cm-link-tabs",un);var kM=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}"}),gn=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">
|
|
3328
3332
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
3329
3333
|
<div class="status"><slot name="status"></slot></div>
|
|
3330
3334
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
@@ -3336,7 +3340,7 @@ ${t.label}</button>
|
|
|
3336
3340
|
${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}
|
|
3337
3341
|
<div class="actions"><slot name="actions"></slot>${this.href?c`<a class="details" part="details" href=${this.href}
|
|
3338
3342
|
aria-label=${this.t("detailsLabel",{name:this.name})}>${this.t("details")}</a>`:h}</div>
|
|
3339
|
-
</article>`}};
|
|
3343
|
+
</article>`}};gn.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},gn.styles=[E,x`
|
|
3340
3344
|
:host { display: block; container-type: inline-size; }
|
|
3341
3345
|
article {
|
|
3342
3346
|
position: relative; display: flex; flex-direction: column; gap: var(--cm-space-8); height: 100%; padding: var(--cm-space-20);
|
|
@@ -3373,21 +3377,21 @@ ${t.label}</button>
|
|
|
3373
3377
|
.actions { gap: var(--cm-space-8); }
|
|
3374
3378
|
.details { margin-inline-start: auto; }
|
|
3375
3379
|
}
|
|
3376
|
-
`];$("cm-app-card",
|
|
3380
|
+
`];$("cm-app-card",gn);var Zh,zv,fn=class extends ee{constructor(){super(...arguments);p(this,Zh);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">
|
|
3377
3381
|
${this.renderHeader()}
|
|
3378
3382
|
<div class="body" part="body"><slot></slot></div>
|
|
3379
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,
|
|
3380
|
-
</div>`)}};
|
|
3383
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,Zh,zv)}></slot></footer>
|
|
3384
|
+
</div>`)}};Zh=new WeakSet,zv=function(e){this._hasFooter=e.target.assignedElements().length>0},fn.properties={...ee.properties,size:{reflect:!0},_hasFooter:{state:!0}},fn.styles=[...ee.overlayStyles,x`
|
|
3381
3385
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
3382
3386
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
3383
3387
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
3384
3388
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
3385
3389
|
|
|
3386
|
-
`];$("cm-modal",
|
|
3390
|
+
`];$("cm-modal",fn);var Qh,_v,St=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,_v)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3387
3391
|
${this.renderHeader()}
|
|
3388
3392
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
3389
3393
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
3390
|
-
</div>`)}};
|
|
3394
|
+
</div>`)}};Qh=new WeakSet,_v=function(e){this._hasFooter=e.target.assignedElements().length>0},St.properties={...ee.properties,size:{reflect:!0},_hasFooter:{state:!0}},St.styles=[...ee.overlayStyles,x`
|
|
3391
3395
|
dialog {
|
|
3392
3396
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
3393
3397
|
}
|
|
@@ -3405,23 +3409,23 @@ ${t.label}</button>
|
|
|
3405
3409
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
3406
3410
|
|
|
3407
3411
|
}
|
|
3408
|
-
`];$("cm-side-panel",
|
|
3412
|
+
`];$("cm-side-panel",St);var OM=z("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),vn,em,bn=class extends St{constructor(){super(...arguments);this.search=!1;this.query="";p(this,vn,()=>{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,em,()=>{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}
|
|
3409
3413
|
placeholder=${this.searchPlaceholder}
|
|
3410
3414
|
@input=${e=>{this.query=e.target.value}}
|
|
3411
|
-
@cm-search=${e=>{e.stopPropagation(),r(this,
|
|
3412
|
-
<slot @submit=${e=>{e.preventDefault(),r(this,
|
|
3413
|
-
<cm-button part="apply" variant="primary" @click=${r(this,
|
|
3415
|
+
@cm-search=${e=>{e.stopPropagation(),r(this,vn).call(this)}}></cm-search>`:h}
|
|
3416
|
+
<slot @submit=${e=>{e.preventDefault(),r(this,vn).call(this)}}></slot>`}renderFooter(){return c`<cm-button part="reset" @click=${r(this,em)}>${this.resetLabel}</cm-button>
|
|
3417
|
+
<cm-button part="apply" variant="primary" @click=${r(this,vn)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};vn=new WeakMap,em=new WeakMap,bn.properties={...St.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"}},bn.styles=[...St.styles,x`
|
|
3414
3418
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
3415
3419
|
.foot { justify-content: center; }
|
|
3416
3420
|
::slotted(form) { display: grid; gap: var(--cm-space-12); }
|
|
3417
|
-
`];$("cm-filter-panel",
|
|
3421
|
+
`];$("cm-filter-panel",bn);var KM=z("accountMenu",{trigger:"Account: {name}"}),yn=class extends xt{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
3422
|
aria-label=${this.t("trigger",{name:this.name})} ?disabled=${this.disabled} @click=${e} @keydown=${t}>
|
|
3419
3423
|
<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
3424
|
${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
3425
|
${this.orgName?c`<div class="split"></div>
|
|
3422
3426
|
${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
3427
|
${this.plan?c`<div class="plan"><cm-icon name="check-circle" size="16"></cm-icon>${this.plan}</div>`:h}`:h}
|
|
3424
|
-
</div>`}};
|
|
3428
|
+
</div>`}};yn.properties={...xt.properties,name:{},avatarSrc:{attribute:"avatar-src"},meta:{},profileHref:{attribute:"profile-href"},orgName:{attribute:"org-name"},orgMeta:{attribute:"org-meta"},orgHref:{attribute:"org-href"},plan:{}},yn.styles=[...xt.styles,x`
|
|
3425
3429
|
/* The avatar button: 36px round with a ring (40 and a 44px hit area on touch screens). */
|
|
3426
3430
|
.trigger.account {
|
|
3427
3431
|
position: relative; width: var(--cm-control-height-md, 36px); height: var(--cm-control-height-md, 36px); min-height: 0; padding: 2px;
|
|
@@ -3454,8 +3458,8 @@ ${t.label}</button>
|
|
|
3454
3458
|
.plan cm-icon { color: var(--cm-text-success); }
|
|
3455
3459
|
.split { height: 0; margin: var(--cm-space-4) var(--cm-space-12); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
3456
3460
|
:host(:dir(rtl)) .chev { transform: scaleX(-1); }
|
|
3457
|
-
`];$("cm-account-menu",
|
|
3458
|
-
<line class="base" x1="0" y1=${a} x2=${i} y2=${a}></line>${v}</svg>`}};
|
|
3461
|
+
`];$("cm-account-menu",yn);var JM=z("sparkline",{summary:"{label}: {total} in all, peak {peak}, latest {latest}",summaryAt:"{label}: {total} in all, peak {peak} on {when}, latest {latest}",empty:"{label}: no data"}),Ky=o=>{if(!o)return[];let n=o.trim(),e=[];if(n.startsWith("["))try{e=JSON.parse(n)}catch{e=[]}else e=n.split(",");return e.map(t=>{let i=Number(t);return Number.isFinite(i)?i:0})},Wy=o=>{if(!o)return[];let n=o.trim();if(n.startsWith("["))try{return JSON.parse(n).map(String)}catch{return[]}return n.split(",").map(e=>e.trim())},xn=class extends T{constructor(){super(...arguments);this.values=[];this.labels=[];this.label="";this.type="bars";this.tone="neutral"}get summary(){let e=this.values??[],t=this.label||"";if(!e.length)return this.t("empty",{label:t});let i=e.reduce((u,v)=>u+v,0),a=Math.max(...e),l=e.indexOf(a),d={label:t,total:this.formatNumber(i),peak:this.formatNumber(a),latest:this.formatNumber(e[e.length-1])},m=this.labels?.[l];return m?this.t("summaryAt",{...d,when:m}):this.t("summary",d)}render(){let e=this.values??[],t=e.length,i=100,a=32,l=2,d=Math.max(1,...e.map(g=>Math.max(0,g))),m=g=>a-Math.max(0,g)/d*(a-l),u=g=>this.labels?.[g]?`${this.labels[g]}: ${this.formatNumber(e[g])}`:"",v=h;if(t&&this.type==="line"){let g=t>1?i/(t-1):0,w=e.map((k,L)=>`${(t>1?L*g:i/2).toFixed(2)},${m(k).toFixed(2)}`).join(" "),y=w.split(" ").pop().split(",");v=Rt`<polyline class="line" points=${w}></polyline><line class="dot" x1=${y[0]} y1=${y[1]} x2=${y[0]} y2=${y[1]}></line>`}else if(t){let g=i/t,w=t>1?Math.min(g*.25,2):0,y=g-w;v=e.map((k,L)=>{let A=Math.max(k>0?1.5:0,a-m(k)),O=u(L);return Rt`<rect class=${L===t-1?"bar last":"bar"} x=${(L*g+w/2).toFixed(2)} y=${(a-A).toFixed(2)} width=${y.toFixed(2)} height=${A.toFixed(2)} rx="0.6">${O?Rt`<title>${O}</title>`:h}</rect>`})}return c`<svg part="chart" role="img" aria-label=${this.summary} viewBox="0 0 ${i} ${a}" preserveAspectRatio="none">
|
|
3462
|
+
<line class="base" x1="0" y1=${a} x2=${i} y2=${a}></line>${v}</svg>`}};xn.properties={values:{converter:{fromAttribute:Ky}},labels:{converter:{fromAttribute:Wy}},label:{},type:{reflect:!0},tone:{reflect:!0}},xn.styles=[E,x`
|
|
3459
3463
|
:host { display: block; width: 100%; max-width: var(--cm-sparkline-width, none); height: var(--cm-sparkline-height, 32px); color: var(--cm-icon-default); }
|
|
3460
3464
|
:host([tone='information']) { color: var(--cm-text-information); }
|
|
3461
3465
|
:host([tone='success']) { color: var(--cm-text-success); }
|
|
@@ -3468,17 +3472,17 @@ ${t.label}</button>
|
|
|
3468
3472
|
.line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3469
3473
|
.dot { stroke: var(--cm-text-default); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3470
3474
|
:host([tone='information']) .dot, :host([tone='success']) .dot { stroke: currentColor; }
|
|
3471
|
-
`];$("cm-sparkline",
|
|
3475
|
+
`];$("cm-sparkline",xn);var Jl,Fr,Ou,Cv,wn=class extends ee{constructor(){super(...arguments);p(this,Fr);this.heading="";this.items=[];this._slotted=[];p(this,Jl)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=ro(this),f(this,Jl,Hc(this,()=>{this._slotted=ro(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,Jl)?.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">
|
|
3472
3476
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
3473
3477
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
3474
3478
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
3475
3479
|
<div class="content">
|
|
3476
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,
|
|
3480
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,Fr,Cv).call(this,i)}</li>`)}</ul>`:h}
|
|
3477
3481
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
3478
3482
|
</div>
|
|
3479
|
-
</div>`)}};
|
|
3480
|
-
`: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,
|
|
3481
|
-
@click=${a=>s(this,
|
|
3483
|
+
</div>`)}};Jl=new WeakMap,Fr=new WeakSet,Ou=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")},Cv=function(e){let t=`row${e.critical?" critical":""}`,i=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
3484
|
+
`: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,Fr,Ou).call(this,a,e)}>${i}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
3485
|
+
@click=${a=>s(this,Fr,Ou).call(this,a,e)}>${i}</button>`},wn.properties={...ee.properties,items:{type:Array},_slotted:{state:!0}},wn.styles=[...ee.overlayStyles,x`
|
|
3482
3486
|
dialog {
|
|
3483
3487
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: var(--cm-space-24);
|
|
3484
3488
|
}
|
|
@@ -3512,17 +3516,17 @@ ${t.label}</button>
|
|
|
3512
3516
|
}
|
|
3513
3517
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
3514
3518
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3515
|
-
`];$("cm-bottom-sheet",
|
|
3516
|
-
<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,
|
|
3519
|
+
`];$("cm-bottom-sheet",wn);var c2=z("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),Gy={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},$n=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}};$n.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},$n.styles=x`:host { display: none; }`;$("cm-notification-item",$n);var En,Pe,qu,Bu,Sv,Lv,Dv,kn=class extends ee{constructor(){super(...arguments);p(this,Pe);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;p(this,En)}connectedCallback(){super.connectedCallback(),s(this,Pe,qu).call(this),f(this,En,new MutationObserver(()=>s(this,Pe,qu).call(this))),r(this,En).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,En)?.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,Pe,Lv)}>${this.markAllLabel}</button>`:h,i=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
3520
|
+
<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,Pe,Sv).call(this,a)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3517
3521
|
${this.renderHeader(t)}
|
|
3518
3522
|
${i}
|
|
3519
3523
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3520
3524
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
3521
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,
|
|
3525
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,Pe,Dv)}></slot></div>
|
|
3522
3526
|
<slot hidden></slot>
|
|
3523
|
-
</div>`)}};
|
|
3527
|
+
</div>`)}};En=new WeakMap,Pe=new WeakSet,qu=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")}})},Bu=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")},Sv=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||Gy[t]||"bell"} size="14"></cm-icon></span>
|
|
3524
3528
|
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${i}</span>
|
|
3525
|
-
${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,
|
|
3529
|
+
${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,Pe,Bu).call(this,d,e)}>${a}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>s(this,Pe,Bu).call(this,d,e)}>${a}</button>`},Lv=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()},Dv=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},kn.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}},kn.styles=[...ee.overlayStyles,x`
|
|
3526
3530
|
dialog {
|
|
3527
3531
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
3528
3532
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3572,15 +3576,15 @@ ${t.label}</button>
|
|
|
3572
3576
|
@media (max-width: 599px) {
|
|
3573
3577
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3574
3578
|
}
|
|
3575
|
-
`];$("cm-notification-panel",
|
|
3579
|
+
`];$("cm-notification-panel",kn);var g2=z("toastRegion",{label:"Notifications"}),f2=z("toast",{undo:"Undo",shortcut:"Press F6 to reach it."}),Av=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o&&o!==document.body?o:null},Fu=(o,n)=>{for(let e=n;e;e=e.parentNode??e.host??null)if(e===o)return!0;return!1},Yy=2e3,Rv=1e4,Hv=150,Zl,vt,ni,Ql,_n,Cn,jr,Vi,Ur,pe,tm,Nv,Mn,ju,ec,tc,ic,rc,Iv,Tn=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,Zl);p(this,vt);p(this,ni,0);p(this,Ql,0);p(this,_n,!1);p(this,Cn,!1);p(this,jr);p(this,Vi);p(this,Ur);p(this,ec,()=>{f(this,_n,!0),s(this,pe,ju).call(this)});p(this,tc,()=>{f(this,_n,!1),s(this,pe,Mn).call(this)});p(this,ic,()=>{f(this,Cn,!0),s(this,pe,ju).call(this)});p(this,rc,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(f(this,Cn,!1),s(this,pe,Mn).call(this))})}get closed(){if(!r(this,jr)){if(!this.open&&r(this,Ur))return Promise.resolve(r(this,Ur));f(this,jr,new Promise(e=>{f(this,Vi,e)}))}return r(this,jr)}get effectiveDuration(){let e=this.duration??(this.actionLabel?Rv:5e3);return Math.min(Rv,Math.max(Yy,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&f(this,Zl,setTimeout(()=>{this._primed=!0},Hv)),this.addEventListener("pointerenter",r(this,ec)),this.addEventListener("pointerleave",r(this,tc)),this.addEventListener("focusin",r(this,ic)),this.addEventListener("focusout",r(this,rc))}disconnectedCallback(){super.disconnectedCallback(),this.open&&r(this,Vi)&&queueMicrotask(()=>{!this.isConnected&&this.open&&s(this,pe,tm).call(this,"removed")}),clearTimeout(r(this,vt)),clearTimeout(r(this,Zl)),this.removeEventListener("pointerenter",r(this,ec)),this.removeEventListener("pointerleave",r(this,tc)),this.removeEventListener("focusin",r(this,ic)),this.removeEventListener("focusout",r(this,rc))}updated(e){e.has("open")&&e.get("open")!==void 0&&(this.open?f(this,Ur,void 0):r(this,Vi)&&s(this,pe,tm).call(this,"close")),(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,vt)),this.open&&(this._inRegion||this._primed)&&(f(this,ni,this.effectiveDuration),s(this,pe,Mn).call(this)))}show(){this.open?(f(this,ni,this.effectiveDuration),s(this,pe,Mn).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,vt)),this.open=!1,s(this,pe,tm).call(this,e),!0):(e==="timeout"&&(f(this,ni,this.effectiveDuration),s(this,pe,Mn).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3576
3580
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3577
3581
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3578
|
-
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,pe,
|
|
3582
|
+
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,pe,Iv)}>${this.actionLabel}</button>`:h}
|
|
3579
3583
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3580
3584
|
<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>
|
|
3581
3585
|
</button>
|
|
3582
3586
|
${this.actionLabel&&this._inRegion&&this.t("shortcut")?c`<span class="hint">${this.t("shortcut")}</span>`:h}
|
|
3583
|
-
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};
|
|
3587
|
+
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Zl=new WeakMap,vt=new WeakMap,ni=new WeakMap,Ql=new WeakMap,_n=new WeakMap,Cn=new WeakMap,jr=new WeakMap,Vi=new WeakMap,Ur=new WeakMap,pe=new WeakSet,tm=function(e){f(this,Ur,e);let t=r(this,Vi);f(this,jr,f(this,Vi,void 0)),t?.(e)},Nv=function(){return r(this,_n)||r(this,Cn)},Mn=function(){clearTimeout(r(this,vt)),!(!this.open||r(this,pe,Nv))&&(f(this,Ql,Date.now()),f(this,vt,setTimeout(()=>this.dismiss("timeout"),r(this,ni))))},ju=function(){r(this,vt)!==void 0&&(clearTimeout(r(this,vt)),f(this,vt,void 0),f(this,ni,Math.max(1e3,r(this,ni)-(Date.now()-r(this,Ql)))))},ec=new WeakMap,tc=new WeakMap,ic=new WeakMap,rc=new WeakMap,Iv=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},Tn.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},Tn.styles=[E,x`
|
|
3584
3588
|
:host { display: block; pointer-events: auto; }
|
|
3585
3589
|
:host(:not([open])) { display: none; }
|
|
3586
3590
|
.toast {
|
|
@@ -3612,13 +3616,13 @@ ${t.label}</button>
|
|
|
3612
3616
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
3613
3617
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
3614
3618
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
3615
|
-
`];$("cm-toast",
|
|
3619
|
+
`];$("cm-toast",Tn);var Vr,ac,sc,nc,oc,lc,Sn,im,zn=class extends T{constructor(){super(...arguments);p(this,Sn);this.max=3;p(this,Vr,null);p(this,ac,!1);p(this,sc,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,Sn,im).call(this)})});p(this,nc,e=>{let t=e.relatedTarget;t&&!Fu(this,t)&&f(this,Vr,t)});p(this,oc,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,lc,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?s(this,Sn,im).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")),f(this,ac,!0)),this.addEventListener("cm-dismiss",r(this,sc)),this.addEventListener("focusin",r(this,nc)),this.addEventListener("keydown",r(this,oc)),document.addEventListener("keydown",r(this,lc))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,sc)),this.removeEventListener("focusin",r(this,nc)),this.removeEventListener("keydown",r(this,oc)),document.removeEventListener("keydown",r(this,lc))}updated(){r(this,ac)&&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=Av();return a&&!Fu(this,a)&&f(this,Vr,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,Sn,im).call(this),e}render(){return c`<slot></slot>`}};Vr=new WeakMap,ac=new WeakMap,sc=new WeakMap,nc=new WeakMap,oc=new WeakMap,lc=new WeakMap,Sn=new WeakSet,im=function(){let e=r(this,Vr);return f(this,Vr,null),e?.isConnected?(e.focus(),Fu(e,Av())||e.shadowRoot?.querySelector("button, a[href], input, select, textarea, [tabindex]")?.focus(),!0):!1},zn.properties={max:{type:Number}},zn.styles=[E,x`
|
|
3616
3620
|
:host {
|
|
3617
3621
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
3618
3622
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
3619
3623
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
3620
3624
|
}
|
|
3621
|
-
`];$("cm-toast-region",
|
|
3625
|
+
`];$("cm-toast-region",zn);function Pv(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),Hv),a}return t.add(a)}async function Xy(o,n,e){await o();let{message:t,undoLabel:i,...a}=e,l=i??Sc("toast","undo",void 0,a.root??document.body),d=await Pv(t,{...a,action:{label:l,onAction:()=>{}}}).closed;return d==="action"&&await n(),d}var $2=z("progressBar",{inProgress:"In progress"}),rm,Ln=class extends T{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";p(this,rm,R("cm-progress"))}get clampedValue(){let e=this.value;return e==null||Number.isNaN(Number(e))?null:Math.min(100,Math.max(0,Number(e)))}render(){let e=this.clampedValue,t=`${r(this,rm)}-label`;return c`
|
|
3622
3626
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
3623
3627
|
<span id=${t} part="label">${this.label}</span>
|
|
3624
3628
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -3628,7 +3632,7 @@ ${t.label}</button>
|
|
|
3628
3632
|
aria-valuenow=${e===null?h:Math.round(e)}
|
|
3629
3633
|
aria-valuetext=${e===null?this.t("inProgress"):this.formatNumber(Math.round(e)/100,{style:"percent"})}>
|
|
3630
3634
|
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
3631
|
-
</div>`}};
|
|
3635
|
+
</div>`}};rm=new WeakMap,Ln.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},Ln.styles=[E,x`
|
|
3632
3636
|
:host { display: block; }
|
|
3633
3637
|
.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); }
|
|
3634
3638
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
@@ -3646,24 +3650,29 @@ ${t.label}</button>
|
|
|
3646
3650
|
.fill { transition: none; }
|
|
3647
3651
|
.indeterminate .fill { animation-duration: 4s; }
|
|
3648
3652
|
}
|
|
3649
|
-
`];$("cm-progress-bar",
|
|
3653
|
+
`];$("cm-progress-bar",Ln);var Dn=class extends S{constructor(){super(...arguments);this.tone="neutral"}render(){return c`<span part="badge"><slot></slot></span>`}};Dn.properties={tone:{reflect:!0}},Dn.styles=[E,x`
|
|
3650
3654
|
:host { display: inline-flex; vertical-align: middle; }
|
|
3651
3655
|
span {
|
|
3652
3656
|
display: inline-flex; align-items: center; box-sizing: border-box; height: 24px; padding: 0 var(--cm-space-8); white-space: nowrap;
|
|
3653
3657
|
font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500; font-variant-numeric: tabular-nums;
|
|
3654
3658
|
border-radius: var(--cm-radius-full); background: var(--cm-bg-tag); color: var(--cm-text-default);
|
|
3655
3659
|
}
|
|
3660
|
+
/* Toned badges start with a dot in the tone's colour when --cm-badge-dot is above 0 (the refined look, 1.11). */
|
|
3661
|
+
:host([tone]:not([tone='neutral'])) span::before {
|
|
3662
|
+
content: ''; flex: none; inline-size: var(--cm-badge-dot, 0px); block-size: var(--cm-badge-dot, 0px);
|
|
3663
|
+
margin-inline-end: var(--cm-badge-dot, 0px); border-radius: var(--cm-radius-full); background: currentColor;
|
|
3664
|
+
}
|
|
3656
3665
|
/* Tinted tones are laid over the surface colour, so the text keeps AA contrast on any page background. */
|
|
3657
3666
|
:host([tone='information']) span { background: linear-gradient(var(--cm-bg-information-soft), var(--cm-bg-information-soft)), var(--cm-bg-surface); color: var(--cm-text-information); }
|
|
3658
3667
|
: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); }
|
|
3659
3668
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
3660
3669
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
3661
|
-
`];$("cm-badge",
|
|
3670
|
+
`];$("cm-badge",Dn);var Rn,Hn,yt,Ov,qv,cc,Bv,am,Uu,An=class extends S{constructor(){super(...arguments);p(this,yt);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;this.variant="standard";this.href="";this.target="";this.selected=!1;this.label="";p(this,Rn,!1);p(this,Hn,!1);p(this,cc,!1);p(this,am,()=>{this.href||this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))})}willUpdate(){this.selected&&f(this,cc,!0)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=r(this,yt,Bv),i=t?s(this,yt,Uu).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,Rn)}><slot name="title-adornment" @slotchange=${s(this,yt,Ov)}></slot></span></div>`:h;return c`<section part="card" aria-label=${!t&&this.heading||h}>${t&&!this.heading?s(this,yt,Uu).call(this,h):h}
|
|
3662
3671
|
${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>
|
|
3663
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,
|
|
3672
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,Hn)}><div class="actions"><slot name="actions" @slotchange=${s(this,yt,qv)}></slot></div></div>`}
|
|
3664
3673
|
<slot></slot>
|
|
3665
|
-
</section>`}};
|
|
3666
|
-
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,
|
|
3674
|
+
</section>`}};Rn=new WeakMap,Hn=new WeakMap,yt=new WeakSet,Ov=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,Rn)&&(f(this,Rn,t),this.requestUpdate())},qv=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,Hn)&&(f(this,Hn,t),this.requestUpdate())},cc=new WeakMap,Bv=function(){return String(this.variant||"").split(/\s+/).includes("interactive")},am=new WeakMap,Uu=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}
|
|
3675
|
+
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,cc)?"false":h} aria-label=${i} @click=${r(this,am)}>${e}</button>`},An.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:{}},An.styles=[E,x`
|
|
3667
3676
|
/* Owner standard (1.6): 24px padding and a 16px gap under the header; compact 16px and 12px; 16px on phones. */
|
|
3668
3677
|
:host { display: block; --_pad: var(--cm-space-24); --_gap: var(--cm-space-16); }
|
|
3669
3678
|
:host([variant~='compact']) { --_pad: var(--cm-space-16); --_gap: var(--cm-space-12); }
|
|
@@ -3715,8 +3724,8 @@ ${t.label}</button>
|
|
|
3715
3724
|
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
|
|
3716
3725
|
.bare[hidden] { display: none; }
|
|
3717
3726
|
:host([flush]) .bare { padding: var(--_pad) var(--_pad) 0; margin-bottom: var(--cm-space-8); }
|
|
3718
|
-
`];$("cm-card",
|
|
3719
|
-
`))}var
|
|
3727
|
+
`];$("cm-card",An);var Jy=["0","4","8","12","16","20","24","32","40","48","64"],Zy={10:"8",15:"16",22:"24",30:"32"};function Nn(o,n){let e=(t,i)=>`:host([${o}='${t}']) { ${n}: ${i==="0"?"0px":`var(--cm-space-${i})`}; }`;return vc([...Jy.map(t=>e(t,t)),...Object.entries(Zy).map(([t,i])=>e(t,i))].join(`
|
|
3728
|
+
`))}var In=class extends S{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return c`<slot></slot>`}};In.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},In.styles=[E,x`
|
|
3720
3729
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
3721
3730
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
3722
3731
|
:host([wrap]) { flex-wrap: wrap; }
|
|
@@ -3729,13 +3738,13 @@ ${t.label}</button>
|
|
|
3729
3738
|
:host([justify='center']) { justify-content: center; }
|
|
3730
3739
|
:host([justify='end']) { justify-content: flex-end; }
|
|
3731
3740
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
3732
|
-
|
|
3741
|
+
`,Nn("gap","gap")];$("cm-stack",In);var Fv="important",Qy=" !"+Fv,jv=ha(class extends di{constructor(o){if(super(o),o.type!==ht.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(Qy);t.includes("-")||a?e.setProperty(t,a?i.slice(0,-11):i,a?Fv:""):e[t]=i}}return we}});var Pn=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=${jv({gridTemplateColumns:i})}><slot></slot></div>`}};Pn.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},Pn.styles=[E,x`
|
|
3733
3742
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
3734
3743
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
3735
3744
|
@container cm-grid (max-width: 640px) {
|
|
3736
3745
|
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
3737
3746
|
}
|
|
3738
|
-
|
|
3747
|
+
`,Nn("gap","--_gap")];$("cm-grid",Pn);var om,Kr,Wr,hc,ce,sm,Vu,dc,nm,Ku,On=class extends S{constructor(){super(...arguments);p(this,ce);this.gap="24";this.variant="default";this.asidePosition="above";this.stickyAside=!1;p(this,om,this.attachInternals());p(this,Kr);p(this,Wr,[]);p(this,hc,()=>s(this,ce,nm).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,ce,Vu).call(this)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&s(this,ce,dc).call(this)}updated(e){(e.has("stickyAside")||e.has("variant"))&&s(this,ce,dc).call(this)}get asideSticks(){let e=s(this,ce,sm).call(this)[0];return!!e&&getComputedStyle(e).position==="sticky"}render(){return c`<div class="layout" part="layout"><slot @slotchange=${()=>{this.stickyAside&&s(this,ce,dc).call(this)}}></slot></div>`}};om=new WeakMap,Kr=new WeakMap,Wr=new WeakMap,hc=new WeakMap,ce=new WeakSet,sm=function(){return[...this.children].filter(e=>e.getAttribute("variant")==="aside")},Vu=function(){r(this,Kr)?.disconnect(),f(this,Kr,void 0),f(this,Wr,[]),window.removeEventListener("resize",r(this,hc)),s(this,ce,Ku).call(this,!1)},dc=function(){s(this,ce,Vu).call(this),!(!this.stickyAside||this.variant!=="record"||!this.isConnected)&&(f(this,Kr,new ResizeObserver(()=>s(this,ce,nm).call(this))),f(this,Wr,[this,...s(this,ce,sm).call(this)]),r(this,Wr).forEach(e=>r(this,Kr).observe(e)),window.addEventListener("resize",r(this,hc)),s(this,ce,nm).call(this))},nm=function(){let e=s(this,ce,sm).call(this);if(e.some(i=>!r(this,Wr).includes(i))){s(this,ce,dc).call(this);return}let t=e.length>0&&e.every(i=>{let a=parseFloat(getComputedStyle(i).insetBlockStart)||0;return i.getBoundingClientRect().height+a<=window.innerHeight});s(this,ce,Ku).call(this,t)},Ku=function(e){let t=r(this,om).states;if(t)try{e?t.add("aside-fits"):t.delete("aside-fits")}catch{}},On.properties={gap:{reflect:!0},variant:{reflect:!0},asidePosition:{attribute:"aside-position",reflect:!0},stickyAside:{type:Boolean,attribute:"sticky-aside",reflect:!0}},On.styles=[E,x`
|
|
3739
3748
|
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-24); }
|
|
3740
3749
|
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
3741
3750
|
@container cm-layout (max-width: 767px) {
|
|
@@ -3779,9 +3788,9 @@ ${t.label}</button>
|
|
|
3779
3788
|
/* Read back by #measure(); only takes effect once the aside is sticky. --_header: cm-app-frame's header height. */
|
|
3780
3789
|
inset-block-start: var(--cm-layout-sticky-top, calc(var(--_header, 0px) + var(--cm-space-24)));
|
|
3781
3790
|
}
|
|
3782
|
-
|
|
3791
|
+
`,Nn("gap","--_gap")];var qn=class extends S{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};qn.properties={variant:{reflect:!0}},qn.styles=[E,x`
|
|
3783
3792
|
:host { display: flex; flex-direction: column; gap: var(--_cm-section-gap, var(--cm-space-24)); min-inline-size: 0; }
|
|
3784
|
-
`];$("cm-layout",
|
|
3793
|
+
`];$("cm-layout",On);$("cm-layout-section",qn);var Wu=1024,ex=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},Yr,Fn,Oe,Gu,Gr,Uv,mc,pc,Bn=class extends S{constructor(){super(...arguments);p(this,Oe);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;p(this,Yr);p(this,Fn,null);p(this,mc,e=>{if(!this.menuItem)return;let t=s(this,Oe,Uv).call(this,e),i=e.detail?.value;t==="bottom-navigation"&&i===this.menuItem?s(this,Oe,Gr).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&s(this,Oe,Gr).call(this,!1,!1)});p(this,pc,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),s(this,Oe,Gr).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,mc)),this.addEventListener("keydown",r(this,pc));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=Wu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,mc)),this.removeEventListener("keydown",r(this,pc)),r(this,Yr)?.disconnect(),f(this,Yr,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;f(this,Yr,new ResizeObserver(()=>{s(this,Oe,Gu).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=Wu!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=Wu}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,Yr).observe(t))}updated(e){e.has("_wide")&&s(this,Oe,Gu).call(this)}openMenu(){s(this,Oe,Gr).call(this,!0)}closeMenu(){s(this,Oe,Gr).call(this,!1)}toggleMenu(){s(this,Oe,Gr).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">
|
|
3785
3794
|
<div class="probe"></div>
|
|
3786
3795
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
3787
3796
|
<div class="body">
|
|
@@ -3790,7 +3799,7 @@ ${t.label}</button>
|
|
|
3790
3799
|
</div>
|
|
3791
3800
|
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
3792
3801
|
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
3793
|
-
</div>`}};
|
|
3802
|
+
</div>`}};Yr=new WeakMap,Fn=new WeakMap,Oe=new WeakSet,Gu=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`)},Gr=function(e,t=!0){e!==this.menuOpen&&(e&&f(this,Fn,ex()),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,Fn)?.focus(),f(this,Fn,null))}))},Uv=function(e){return e.composedPath().find(i=>i.parentElement===this)?.getAttribute("slot")??""},mc=new WeakMap,pc=new WeakMap,Bn.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},panel:{type:Boolean,reflect:!0},_wide:{state:!0}},Bn.styles=[E,x`
|
|
3794
3803
|
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
3795
3804
|
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
3796
3805
|
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
@@ -3821,7 +3830,7 @@ ${t.label}</button>
|
|
|
3821
3830
|
}
|
|
3822
3831
|
.probe { block-size: 0; }
|
|
3823
3832
|
[hidden] { display: none !important; }
|
|
3824
|
-
`];$("cm-app-frame",
|
|
3833
|
+
`];$("cm-app-frame",Bn);var jn=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>`}};jn.properties={width:{reflect:!0},fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},jn.styles=[E,x`
|
|
3825
3834
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-page-background, var(--cm-bg-page)); min-block-size: 100%; }
|
|
3826
3835
|
.content {
|
|
3827
3836
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
@@ -3833,16 +3842,16 @@ ${t.label}</button>
|
|
|
3833
3842
|
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
3834
3843
|
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
3835
3844
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
3836
|
-
`];$("cm-page",
|
|
3845
|
+
`];$("cm-page",jn);var Vn,Vv,Kv,Un=class extends T{constructor(){super(...arguments);p(this,Vn);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?Rt`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:Rt`<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}>
|
|
3837
3846
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
3838
3847
|
<div class="body">
|
|
3839
3848
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
3840
3849
|
<div><slot></slot></div>
|
|
3841
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,
|
|
3850
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,Vn,Vv)}></slot></div>
|
|
3842
3851
|
</div>
|
|
3843
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,
|
|
3852
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,Vn,Kv)}>
|
|
3844
3853
|
<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}
|
|
3845
|
-
</div>`}};
|
|
3854
|
+
</div>`}};Vn=new WeakSet,Vv=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},Kv=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},Un.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},Un.styles=[E,x`
|
|
3846
3855
|
:host { display: block; }
|
|
3847
3856
|
.banner {
|
|
3848
3857
|
display: flex; gap: var(--cm-space-12); align-items: flex-start;
|
|
@@ -3866,10 +3875,10 @@ ${t.label}</button>
|
|
|
3866
3875
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
3867
3876
|
}
|
|
3868
3877
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3869
|
-
`];$("cm-banner",
|
|
3878
|
+
`];$("cm-banner",Un);var gT=z("thumbnail",{noImage:"{alt} (no image)"}),Kn=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}
|
|
3870
3879
|
@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}
|
|
3871
3880
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):h} aria-hidden=${this.alt?h:"true"}>
|
|
3872
|
-
<cm-icon name="box" size=${e}></cm-icon></span>`}};
|
|
3881
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};Kn.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},Kn.styles=[E,x`
|
|
3873
3882
|
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3874
3883
|
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
3875
3884
|
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
@@ -3879,7 +3888,7 @@ ${t.label}</button>
|
|
|
3879
3888
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
3880
3889
|
}
|
|
3881
3890
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
3882
|
-
`];$("cm-thumbnail",
|
|
3891
|
+
`];$("cm-thumbnail",Kn);export{Ar as Announcer,ss as CmAccordion,yn as CmAccountMenu,ts as CmActionBar,xt as CmActionMenu,gn as CmAppCard,Bn as CmAppFrame,nn as CmAvatar,Dn as CmBadge,Un as CmBanner,Fs as CmBoard,Rr as CmBoardCard,Hr as CmBoardColumn,hn as CmBottomNavigation,wn as CmBottomSheet,Ji as CmButton,da as CmButtonGroup,Ys as CmCalendar,Gs as CmCalendarEvent,An as CmCard,pi as CmCheckbox,Ci as CmColorField,xi as CmCombobox,Sa as CmCommandPalette,cs as CmComment,ds as CmCommentBox,Cs as CmDataTable,Ei as CmDatePicker,Ti as CmDateRangePicker,ns as CmEmptyState,_i as CmFileUpload,bn as CmFilterPanel,pn as CmFlashOfferBar,pr as CmGlobalSearch,Pn as CmGrid,ln as CmHeaderBar,Qr as CmIcon,as as CmInfoItem,rs as CmInfoPanel,On as CmLayout,qn as CmLayoutSection,un as CmLinkTabs,T as CmLocalizedElement,ea as CmMenuItem,rn as CmMetric,mn as CmMobileMenu,fn as CmModal,an as CmNavItem,qs as CmNestedItem,Os as CmNestedList,$n as CmNotificationItem,kn as CmNotificationPanel,Mt as CmOptionGroup,jn as CmPage,es as CmPageHeader,xs as CmPagination,Ln as CmProgressBar,sr as CmRadio,nr as CmRadioGroup,Or as CmReportTile,tn as CmReportTiles,Ns as CmResourceItem,Is as CmResourceList,is as CmSaveBar,yi as CmSearch,Qa as CmSegmentedControl,vi as CmSelect,sn as CmSideNavigation,St as CmSidePanel,Si as CmSignatureField,os as CmSkeleton,ls as CmSkeletonDisplay,vs as CmSmartTip,ys as CmSmartTips,xn as CmSparkline,aa as CmSpinner,In as CmStack,$s as CmStatusTabs,Es as CmTableHeader,dr as CmTag,mi as CmTextField,Kn as CmThumbnail,Er as CmTimeline,fs as CmTimelineItem,Tn as CmToast,zn as CmToastRegion,gi as CmToggle,hs as CmTooltip,Dr as MoveModel,Gg as commandMatches,ly as configure,z as defineStrings,yg as directionalIcons,ae as formatDate,bg as formatMessage,$m as formatNumber,ny as getDefaultStrings,$v as initials,Co as isApplePlatform,Sb as listNavigation,to as localeFor,qm as matchesShortcut,Zt as normalizeHex,Cc as pluralCategory,cy as resetStrings,sf as resolvePreset,oy as setStrings,$d as shortcutKeys,Pv as showToast,Sc as translate,Xy as undoable};
|
|
3883
3892
|
/*! Bundled license information:
|
|
3884
3893
|
|
|
3885
3894
|
@lit/reactive-element/css-tag.js:
|