@commmerce/ui 1.19.0 → 1.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +512 -535
- package/dist/components/link-tabs.d.ts +8 -1
- package/dist/components/link-tabs.js +55 -4
- package/dist/custom-elements.json +46 -1
- package/package.json +5 -5
package/dist/cdn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(o,n,e)=>(ou(o,n,"read from private field"),e?e.call(o):n.get(o)),m=(o,n,e)=>n.has(o)?ub("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),g=(o,n,e,t)=>(ou(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),a=(o,n,e)=>(ou(o,n,"access private method"),e);var eh=globalThis,th=eh.ShadowRoot&&(eh.ShadyCSS===void 0||eh.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,lu=Symbol(),gb=new WeakMap,dl=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==lu)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(th&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=gb.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&gb.set(e,n))}return n}toString(){return this.cssText}},ih=o=>new dl(typeof o=="string"?o:o+"",void 0,lu),w=(o,...n)=>{let e=o.length===1?o[0]:n.reduce((t,i,s)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new dl(e,o,lu)},fb=(o,n)=>{if(th)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=eh.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},cu=th?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return ih(e)})(o):o;var{is:Pw,defineProperty:Iw,getOwnPropertyDescriptor:qw,getOwnPropertyNames:Ow,getOwnPropertySymbols:Bw,getPrototypeOf:Fw}=Object,rh=globalThis,bb=rh.trustedTypes,Vw=bb?bb.emptyScript:"",jw=rh.reactiveElementPolyfillSupport,hl=(o,n)=>o,du={toAttribute(o,n){switch(n){case Boolean:o=o?Vw: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}},yb=(o,n)=>!Pw(o,n),vb={attribute:!0,type:String,converter:du,reflect:!1,useDefault:!1,hasChanged:yb};Symbol.metadata??=Symbol("metadata"),rh.litPropertyMetadata??=new WeakMap;var ei=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=vb){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&&Iw(this.prototype,n,i)}}static getPropertyDescriptor(n,e,t){let{get:i,set:s}=qw(this.prototype,n)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let d=i?.call(this);s?.call(this,l),this.requestUpdate(n,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(n){return this.elementProperties.get(n)??vb}static _$Ei(){if(this.hasOwnProperty(hl("elementProperties")))return;let n=Fw(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(hl("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(hl("properties"))){let e=this.properties,t=[...Ow(e),...Bw(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(cu(i))}else n!==void 0&&e.push(cu(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 fb(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 s=(t.converter?.toAttribute!==void 0?t.converter:du).toAttribute(e,t.type);this._$Em=n,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(n,e){let t=this.constructor,i=t._$Eh.get(n);if(i!==void 0&&this._$Em!==i){let s=t.getPropertyOptions(i),l=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:du;this._$Em=i;let d=l.fromAttribute(e,s.type);this[i]=d??this._$Ej?.get(i)??d,this._$Em=null}}requestUpdate(n,e,t,i=!1,s){if(n!==void 0){let l=this.constructor;if(i===!1&&(s=this[n]),t??=l.getPropertyOptions(n),!((t.hasChanged??yb)(s,e)||t.useDefault&&t.reflect&&s===this._$Ej?.get(n)&&!this.hasAttribute(l._$Eu(n,t))))return;this.C(n,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(n,e,{useDefault:t,reflect:i,wrapped:s},l){t&&!(this._$Ej??=new Map).has(n)&&(this._$Ej.set(n,l??e??this[n]),s!==!0||l!==void 0)||(this._$AL.has(n)||(this.hasUpdated||t||(e=void 0),this._$AL.set(n,e)),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,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,s]of t){let{wrapped:l}=s,d=this[i];l!==!0||this._$AL.has(i)||d===void 0||this.C(i,void 0,s,d)}}let n=!1,e=this._$AL;try{n=this.shouldUpdate(e),n?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw n=!1,this._$EM(),t}n&&this._$AE(e)}willUpdate(n){}_$AE(n){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(n)),this.updated(n)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(n){return!0}update(n){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(n){}firstUpdated(n){}};ei.elementStyles=[],ei.shadowRootOptions={mode:"open"},ei[hl("elementProperties")]=new Map,ei[hl("finalized")]=new Map,jw?.({ReactiveElement:ei}),(rh.reactiveElementVersions??=[]).push("2.1.2");var pu=globalThis,xb=o=>o,sh=pu.trustedTypes,wb=sh?sh.createPolicy("lit-html",{createHTML:o=>o}):void 0,mu="$lit$",ti=`lit$${Math.random().toFixed(9).slice(2)}$`,uu="?"+ti,Uw=`<${uu}>`,Mr=document,ml=()=>Mr.createComment(""),ul=o=>o===null||typeof o!="object"&&typeof o!="function",gu=Array.isArray,Tb=o=>gu(o)||typeof o?.[Symbol.iterator]=="function",hu=`[
|
|
2
|
+
\f\r]`,pl=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$b=/-->/g,kb=/>/g,kr=RegExp(`>|${hu}(?:([^\\s"'>=/]+)(${hu}*=${hu}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Eb=/'/g,Mb=/"/g,Cb=/^(?:script|style|textarea|title)$/i,fu=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=fu(1),ii=fu(2),i$=fu(3),Ne=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),_b=new WeakMap,Er=Mr.createTreeWalker(Mr,129);function zb(o,n){if(!gu(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return wb!==void 0?wb.createHTML(n):n}var Sb=(o,n)=>{let e=o.length-1,t=[],i,s=n===2?"<svg>":n===3?"<math>":"",l=pl;for(let d=0;d<e;d++){let p=o[d],u,b,f=-1,x=0;for(;x<p.length&&(l.lastIndex=x,b=l.exec(p),b!==null);)x=l.lastIndex,l===pl?b[1]==="!--"?l=$b:b[1]!==void 0?l=kb:b[2]!==void 0?(Cb.test(b[2])&&(i=RegExp("</"+b[2],"g")),l=kr):b[3]!==void 0&&(l=kr):l===kr?b[0]===">"?(l=i??pl,f=-1):b[1]===void 0?f=-2:(f=l.lastIndex-b[2].length,u=b[1],l=b[3]===void 0?kr:b[3]==='"'?Mb:Eb):l===Mb||l===Eb?l=kr:l===$b||l===kb?l=pl:(l=kr,i=void 0);let v=l===kr&&o[d+1].startsWith("/>")?" ":"";s+=l===pl?p+Uw:f>=0?(t.push(u),p.slice(0,f)+mu+p.slice(f)+ti+v):p+ti+(f===-2?d:v)}return[zb(o,s+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},gl=class o{constructor({strings:n,_$litType$:e},t){let i;this.parts=[];let s=0,l=0,d=n.length-1,p=this.parts,[u,b]=Sb(n,e);if(this.el=o.createElement(u,t),Er.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Er.nextNode())!==null&&p.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(mu)){let x=b[l++],v=i.getAttribute(f).split(ti),k=/([.?@])?(.*)/.exec(x);p.push({type:1,index:s,name:k[2],strings:v,ctor:k[1]==="."?nh:k[1]==="?"?oh:k[1]==="@"?lh:Tr}),i.removeAttribute(f)}else f.startsWith(ti)&&(p.push({type:6,index:s}),i.removeAttribute(f));if(Cb.test(i.tagName)){let f=i.textContent.split(ti),x=f.length-1;if(x>0){i.textContent=sh?sh.emptyScript:"";for(let v=0;v<x;v++)i.append(f[v],ml()),Er.nextNode(),p.push({type:2,index:++s});i.append(f[x],ml())}}}else if(i.nodeType===8)if(i.data===uu)p.push({type:2,index:s});else{let f=-1;for(;(f=i.data.indexOf(ti,f+1))!==-1;)p.push({type:7,index:s}),f+=ti.length-1}s++}}static createElement(n,e){let t=Mr.createElement("template");return t.innerHTML=n,t}};function _r(o,n,e=o,t){if(n===Ne)return n;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=ul(n)?void 0:n._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(n=_r(o,i._$AS(o,n.values),i,t)),n}var ah=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??Mr).importNode(e,!0);Er.currentNode=i;let s=Er.nextNode(),l=0,d=0,p=t[0];for(;p!==void 0;){if(l===p.index){let u;p.type===2?u=new Xs(s,s.nextSibling,this,n):p.type===1?u=new p.ctor(s,p.name,p.strings,this,n):p.type===6&&(u=new ch(s,this,n)),this._$AV.push(u),p=t[++d]}l!==p?.index&&(s=Er.nextNode(),l++)}return Er.currentNode=Mr,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++}},Xs=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=_r(this,n,e),ul(n)?n===h||n==null||n===""?(this._$AH!==h&&this._$AR(),this._$AH=h):n!==this._$AH&&n!==Ne&&this._(n):n._$litType$!==void 0?this.$(n):n.nodeType!==void 0?this.T(n):Tb(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&&ul(this._$AH)?this._$AA.nextSibling.data=n:this.T(Mr.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=gl.createElement(zb(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new ah(i,this),l=s.u(this.options);s.p(e),this.T(l),this._$AH=s}}_$AC(n){let e=_b.get(n.strings);return e===void 0&&_b.set(n.strings,e=new gl(n)),e}k(n){gu(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of n)i===e.length?e.push(t=new o(this.O(ml()),this.O(ml()),this,this.options)):t=e[i],t._$AI(s),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=xb(n).nextSibling;xb(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},Tr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(n,e,t,i,s){this.type=1,this._$AH=h,this._$AN=void 0,this.element=n,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(n,e=this,t,i){let s=this.strings,l=!1;if(s===void 0)n=_r(this,n,e,0),l=!ul(n)||n!==this._$AH&&n!==Ne,l&&(this._$AH=n);else{let d=n,p,u;for(n=s[0],p=0;p<s.length-1;p++)u=_r(this,d[t+p],e,p),u===Ne&&(u=this._$AH[p]),l||=!ul(u)||u!==this._$AH[p],u===h?n=h:n!==h&&(n+=(u??"")+s[p+1]),this._$AH[p]=u}l&&!i&&this.j(n)}j(n){n===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}},nh=class extends Tr{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},oh=class extends Tr{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},lh=class extends Tr{constructor(n,e,t,i,s){super(n,e,t,i,s),this.type=5}_$AI(n,e=this){if((n=_r(this,n,e,0)??h)===Ne)return;let t=this._$AH,i=n===h&&t!==h||n.capture!==t.capture||n.once!==t.once||n.passive!==t.passive,s=n!==h&&(t===h||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,n),this._$AH=n}handleEvent(n){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,n):this._$AH.handleEvent(n)}},ch=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){_r(this,n)}},Lb={M:mu,P:ti,A:uu,C:1,L:Sb,R:ah,D:Tb,V:_r,I:Xs,H:Tr,N:oh,U:lh,B:nh,F:ch},Kw=pu.litHtmlPolyfillSupport;Kw?.(gl,Xs),(pu.litHtmlVersions??=[]).push("3.3.3");var Ab=(o,n,e)=>{let t=e?.renderBefore??n,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new Xs(n.insertBefore(ml(),s),s,void 0,e??{})}return i._$AI(o),i};var bu=globalThis,A=class extends ei{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=Ab(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ne}};A._$litElement$=!0,A.finalized=!0,bu.litElementHydrateSupport?.({LitElement:A});var Ww=bu.litElementPolyfillSupport;Ww?.({LitElement:A});(bu.litElementVersions??=[]).push("4.2.2");var E=w`
|
|
4
4
|
:host {
|
|
5
5
|
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
6
|
color: var(--cm-text-default, #000);
|
|
@@ -8,20 +8,20 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,f$=w`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
14
|
+
`,Gw=0,N=o=>`${o}-${++Gw}`;function $(o,n){customElements.get(o)||customElements.define(o,n)}function se(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Yw={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},dh={common:{...Yw}},fl={},bl={},hh;function z(o,n){return dh[o]={...dh[o],...n},n}function Xw(){return Object.fromEntries(Object.entries(dh).map(([o,n])=>[o,{...n}]))}function ph(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function Jw(o,n){ph(n?bl[n.toLowerCase()]??={}:fl,o),gh()}function Qw(o={}){"locale"in o&&(hh=o.locale||void 0),o.strings&&ph(fl,o.strings);for(let[n,e]of Object.entries(o.translations??{}))ph(bl[n.toLowerCase()]??={},e);gh()}function Zw(){hh=void 0;for(let o of Object.keys(fl))delete fl[o];for(let o of Object.keys(bl))delete bl[o];gh()}function vl(o){if(hh)return hh;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 Db=new Map;function xu(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,s=Db.get(i);if(!s){try{s=t(n)}catch{s=t(void 0)}Db.set(i,s)}return s}function wu(o,n={},e){return xu("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function me(o,n={},e){return xu("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function mh(o,n){return xu("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function Rb(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[mh(i,e)]??o.other??""}else t=String(o);return t.replace(/\{(\w+)\}/g,(i,s)=>{let l=n[s];return l===void 0?i:typeof l=="number"?wu(l,{},e):String(l)})}function e0(o,n,e,t){if(t&&t[n]!==void 0)return t[n];let i=[];if(e){let s=e.toLowerCase().split("-");for(let l=s.length;l>0;l--)i.push(s.slice(0,l).join("-"))}for(let s of o==="common"?["common"]:[o,"common"]){for(let d of i){let p=bl[d]?.[s]?.[n];if(p!==void 0)return p}let l=fl[s]?.[n]??dh[s]?.[n];if(l!==void 0)return l}}function uh(o,n,e,t,i){let s=vl(t);return Rb(e0(o,n,s,i),e,s)}var yu=new Set,vu;function gh(){for(let o of yu)o.requestUpdate()}function t0(){vu||typeof MutationObserver>"u"||typeof document>"u"||(vu=new MutationObserver(gh),vu.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var i0=o=>o.replace(/^cm-/,"").replace(/-([a-z])/g,(n,e)=>e.toUpperCase()),C=class extends A{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 s=Symbol(e);Object.defineProperty(this.prototype,e,{get(){return this[s]??this.t(i)},set(l){this[s]=l},configurable:!0,enumerable:!0})}super.finalize()}get stringsNamespace(){return i0(this.localName)}t(n,e){return uh(this.stringsNamespace,n,e,this,this.strings)}get locale(){return vl(this)}formatNumber(n,e){return wu(n,e,this.locale)}connectedCallback(){super.connectedCallback(),yu.add(this),t0()}disconnectedCallback(){super.disconnectedCallback(),yu.delete(this)}};C.properties={strings:{type:Object}};var fh={"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",eyedropper:"M14 6l4 4M12.5 7.5l4 4M15.5 3.5a2.1 2.1 0 013 0l2 2a2.1 2.1 0 010 3L18 11l-5-5 2.5-2.5zM14 9.5L5.5 18v2h2L16 11.5",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"},Hb=["more","drag"],x$=Object.keys(fh);var Nb=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],Js=class extends A{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=fh[this.name]??fh.more,t=Hb.includes(this.name)?3:1.6;return ii`<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"?Nb.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Js.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Js.styles=w`
|
|
18
18
|
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
19
19
|
svg { display: block; }
|
|
20
20
|
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
21
|
-
`;$("cm-icon",
|
|
21
|
+
`;$("cm-icon",Js);var Pb=99,z$=z("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),bh,vh,yl,Cr=class extends C{constructor(){super();this.variant="secondary";this.size="medium";this.type="button";this.disabled=!1;this.loading=!1;this.iconOnly=!1;this.icon="";this.label="";this.count=0;m(this,bh,this.attachInternals());m(this,vh,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,bh).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});m(this,yl,!1);this.addEventListener("click",r(this,vh),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,yl)&&(g(this,yl,!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>`,s=e?c`<span class="count" part="count" aria-hidden="true">${e>Pb?this.t("countOverflow",{max:Pb}):this.formatNumber(e)}</span>${this.iconOnly?h:c`<span class="vh"> ${this.t("count",{count:e})}</span>`}`:h,l=this.iconOnly&&(this.label||this.textContent?.trim())||"",d=!this.iconOnly||!l?h:e?this.t("labelWithCount",{label:l,count:e}):this.label||h,p=c`${t}${i}${s}`;return this.href&&!this.disabled?c`<a class="btn" part="control" href=${this.href} target=${this.target??h}
|
|
22
22
|
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${p}</a>`:c`<button class="btn" part="control" type="button"
|
|
23
23
|
?disabled=${this.disabled} aria-disabled=${this.loading?"true":h}
|
|
24
|
-
aria-busy=${this.loading?"true":h} aria-label=${d}>${p}</button>`}};
|
|
24
|
+
aria-busy=${this.loading?"true":h} aria-label=${d}>${p}</button>`}};bh=new WeakMap,vh=new WeakMap,yl=new WeakMap,Cr.formAssociated=!0,Cr.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}},Cr.styles=[E,w`
|
|
25
25
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
26
26
|
/* A label longer than the room (a button in a narrow card) ends with an ellipsis instead of spilling out (1.8.1). */
|
|
27
27
|
.text { min-width: 0; overflow: hidden; text-overflow: ellipsis; line-height: var(--cm-line-height-14, 20px); } /* a full line box, so overflow: hidden doesn't cut g, p and y (1.9.3) */
|
|
@@ -110,16 +110,16 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
110
110
|
position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
|
|
111
111
|
box-shadow: 0 0 0 2px var(--cm-bg-surface); pointer-events: none;
|
|
112
112
|
}
|
|
113
|
-
`];$("cm-button",
|
|
113
|
+
`];$("cm-button",Cr);var Qs=class extends A{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}}};Qs.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}},Qs.styles=w`:host { display: none; }`;$("cm-menu-item",Qs);function xl(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),i=s=>e.getAttribute(s)||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 yh(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var Pe=w`
|
|
114
114
|
:where([popover]) { margin: 0; padding: 0; border: 0; color: inherit; background: none; overflow: visible; }
|
|
115
|
-
`,
|
|
115
|
+
`,wl=8,Lt,Zs,ea,ta,zr,xe=class{constructor(){m(this,Lt,null);m(this,Zs,null);m(this,ea,{});m(this,ta,"");m(this,zr,()=>this.place())}get active(){return!!r(this,Lt)}open(n,e,t={}){if(!n||!e||typeof n.showPopover!="function")return!1;r(this,Lt)&&r(this,Lt)!==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,Lt)||g(this,ta,n.style.maxHeight),g(this,Lt,n),g(this,Zs,e),g(this,ea,t),Object.assign(n.style,{position:"fixed",inset:"auto",margin:"0"}),this.place(),i||(window.addEventListener("scroll",r(this,zr),!0),window.addEventListener("resize",r(this,zr))),!0):!1}place(){let n=r(this,Lt),e=r(this,Zs);if(!n||!e)return;let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,s=document.documentElement.clientHeight,l=r(this,ea).gap??4,d=r(this,ea).align??"start";n.style.maxHeight=r(this,ta),d==="stretch"&&(n.style.minWidth=`${Math.round(t.width)}px`);let p=n.getBoundingClientRect(),u=p.width,b=p.height,f=getComputedStyle(e).direction==="rtl",x=f?t.right-u:t.left,v=f?t.left:t.right-u,k=d==="end"?v:x;k+u>i-wl&&(k=f?x:v);let L=Math.max(0,Math.min(wl,t.left)),P=Math.min(i,Math.max(i-wl,t.right))-u;k=Math.max(L,Math.min(k,P));let U=s-t.bottom-l-wl,q=t.top-l-wl,O;if(b<=U||U>=q)O=t.bottom+l,b>U&&(n.style.maxHeight=`${Math.max(80,Math.floor(U))}px`);else{let be=Math.min(b,Math.floor(q));b>q&&(n.style.maxHeight=`${Math.max(80,be)}px`),O=t.top-l-be}n.style.left=`${k}px`,n.style.top=`${O}px`}close(){let n=r(this,Lt);if(window.removeEventListener("scroll",r(this,zr),!0),window.removeEventListener("resize",r(this,zr)),g(this,Lt,null),g(this,Zs,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,ta)}}};Lt=new WeakMap,Zs=new WeakMap,ea=new WeakMap,ta=new WeakMap,zr=new WeakMap;var ia=class extends C{constructor(){super(...arguments);this.size="large";this.custom=!1}onSlotChange(e){let t=e.target.assignedElements().length>0;t!==this.custom&&(this.custom=t,this.requestUpdate())}render(){let e=this.size==="small"?2.5:3;return c`<span class="spinner" part="spinner" role="status">
|
|
116
116
|
${this.custom?h:c`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
117
117
|
<circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
|
|
118
118
|
<path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
|
|
119
119
|
</svg>`}
|
|
120
120
|
<slot @slotchange=${this.onSlotChange}></slot>
|
|
121
121
|
<span class="vh">${this.accessibleLabel||this.t("loading")}</span>
|
|
122
|
-
</span>`}};
|
|
122
|
+
</span>`}};ia.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},ia.styles=[E,w`
|
|
123
123
|
:host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
|
|
124
124
|
.spinner { display: inline-flex; align-items: center; --cm-spinner-duration: 0.8s; --cm-spinner-play-state: running; }
|
|
125
125
|
::slotted(*) { display: block; block-size: 20px; inline-size: auto; }
|
|
@@ -137,18 +137,18 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
137
137
|
svg { animation-duration: 2.4s; }
|
|
138
138
|
.spinner { --cm-spinner-play-state: paused; }
|
|
139
139
|
}
|
|
140
|
-
`];$("cm-spinner",
|
|
141
|
-
aria-expanded=${String(this.open)} aria-controls="${r(this,
|
|
142
|
-
?disabled=${this.disabled} @click=${r(this,
|
|
140
|
+
`];$("cm-spinner",ia);var W$=z("actionMenu",{label:"Actions"}),$l,Sr,Lr,kl,J,xh,El,wh,$h,kh,Eh,Ib,sa,aa,na,ra,Mh,qb,$u,Ob,Ft=class extends C{constructor(){super(...arguments);m(this,J);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this.loading=!1;this.disabled=!1;this._slotted=[];this._active=-1;this._custom=!1;m(this,$l);m(this,Sr,N("cm-menu"));m(this,Lr,"");m(this,kl,0);m(this,El,e=>{this.open&&!e.composedPath().includes(this)&&a(this,J,kh).call(this,!1)});m(this,sa,new xe);m(this,aa,e=>{this.disabled||(e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0)))});m(this,na,()=>{this.disabled||(this.open?this.hide():this.show())});m(this,Mh,e=>{let t=a(this,J,$h).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),a(this,J,ra).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),a(this,J,ra).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),a(this,J,ra).call(this,t[0]);break;case"End":e.preventDefault(),a(this,J,ra).call(this,t[t.length-1]);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.hide(!0);break;case"Tab":this.hide();break;default:if(e.key.length===1&&/\S/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let s=Date.now();g(this,Lr,(s-r(this,kl)<600?r(this,Lr):"")+e.key.toLowerCase()),g(this,kl,s);let l=this.menuItems,d=r(this,Lr).length>1?i:i+1,u=[...t.slice(Math.max(d,0)),...t.slice(0,Math.max(d,0))].find(b=>(l[b].label??"").toLowerCase().startsWith(r(this,Lr)));u!==void 0&&a(this,J,ra).call(this,u)}}})}connectedCallback(){super.connectedCallback(),a(this,J,xh).call(this),g(this,$l,yh(this,()=>a(this,J,xh).call(this))),document.addEventListener("pointerdown",r(this,El),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,$l)?.disconnect(),document.removeEventListener("pointerdown",r(this,El),!0),r(this,sa).close()}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=a(this,J,$h).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,a(this,J,kh).call(this,!0),this.updateComplete.then(()=>a(this,J,Eh).call(this))}hide(e=!1){a(this,J,kh).call(this,!1),e&&a(this,J,wh).call(this)?.focus()}updated(e){if(e.has("open")&&this.open&&a(this,J,Ib).call(this),e.has("open")&&!this.open&&r(this,sa).close(),this._custom){let t=a(this,J,wh).call(this);if(t){let i=(s,l)=>{t.getAttribute(s)!==l&&t.setAttribute(s,l)};i("aria-haspopup","menu"),i("aria-expanded",String(this.open)),i("aria-controls",`${r(this,Sr)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=a(this,J,$h).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>a(this,J,Eh).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,na)} @keydown=${r(this,aa)} @slotchange=${()=>a(this,J,xh).call(this)}></slot>`:this.triggerTemplate(r(this,na),r(this,aa))??c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
141
|
+
aria-expanded=${String(this.open)} aria-controls="${r(this,Sr)}-m" aria-label=${this.iconOnly?t:h}
|
|
142
|
+
?disabled=${this.disabled} @click=${r(this,na)} @keydown=${r(this,aa)}>${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}
|
|
143
143
|
<div class="pop" part="menu" popover="manual" ?hidden=${!this.open}>
|
|
144
144
|
${this.headTemplate()??(this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h)}
|
|
145
|
-
<div role="menu" id="${r(this,
|
|
146
|
-
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:a(this,J,
|
|
145
|
+
<div role="menu" id="${r(this,Sr)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${r(this,Mh)}>
|
|
146
|
+
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:a(this,J,Ob).call(this,e)}
|
|
147
147
|
</div>
|
|
148
148
|
</div>
|
|
149
|
-
<slot hidden></slot>`}}
|
|
149
|
+
<slot hidden></slot>`}};$l=new WeakMap,Sr=new WeakMap,Lr=new WeakMap,kl=new WeakMap,J=new WeakSet,xh=function(){this._slotted=xl(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},El=new WeakMap,wh=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},$h=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},kh=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})))},Eh=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},Ib=function(){let e=this.renderRoot.querySelector(".pop");if(!e||r(this,sa).open(e,a(this,J,wh).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,s=8,l=getComputedStyle(this).direction==="rtl",d=l?t.left<s:t.right>i-s,p=l?t.right>i-s:t.left<s;this.align!=="end"&&d?e.classList.add("to-end"):this.align==="end"&&p&&e.classList.add("to-start")},sa=new WeakMap,aa=new WeakMap,na=new WeakMap,ra=function(e){this._active=e,this.updateComplete.then(()=>a(this,J,Eh).call(this))},Mh=new WeakMap,qb=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)},$u=function(e,t){if(e.divider)return c`<div role="separator"></div>`;let i=`item${e.critical?" critical":""}${t===this._active?" active":""}`,s=c`${e.icon?c`<cm-icon name=${e.icon} size="16"></cm-icon>`:h}<span class="label">${e.label}</span>${e.shortcut?c`<span class="shortcut" part="shortcut" aria-hidden="true">${e.shortcut}</span>`:h}`,l={over:()=>{e.disabled||(this._active=t)},click:d=>a(this,J,qb).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}
|
|
150
150
|
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${s}</a>`:c`<button type="button" class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
151
|
-
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${s}</button>`},
|
|
151
|
+
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${s}</button>`},Ob=function(e){let t=[];for(let i=0;i<e.length;i++){let s=e[i];if(!s.heading){t.push(a(this,J,$u).call(this,s,i));continue}let l=`${r(this,Sr)}-h${i}`,d=[],p=i+1;for(;p<e.length&&!e[p].heading&&!e[p].divider;p++)d.push(a(this,J,$u).call(this,e[p],p));t.push(c`<div role="group" aria-labelledby=${l}><div class="section" part="section" id=${l} role="presentation">${s.label}</div>${d}</div>`),i=p-1}return t},Ft.properties={items:{type:Array},open:{type:Boolean,reflect:!0},label:{string:"label"},triggerLabel:{attribute:"trigger-label"},iconOnly:{type:Boolean,attribute:"icon-only"},icon:{},align:{reflect:!0},heading:{},subheading:{},density:{reflect:!0},loading:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},Ft.styles=[E,w`
|
|
152
152
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
153
153
|
.trigger {
|
|
154
154
|
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;
|
|
@@ -211,12 +211,12 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
211
211
|
}
|
|
212
212
|
.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); }
|
|
213
213
|
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
214
|
-
`];$("cm-action-menu",
|
|
214
|
+
`];$("cm-action-menu",Ft);var Z$=z("buttonGroup",{more:"More"}),Di="data-cm-overflow",r0=["disabled","loading","tone","icon","label","variant","size","icon-only","count","href","hidden","data-priority"],Ri,Ar,ri,Vt,Hi,Dr,Q,oa,Bb,Ml,ku,_h,Th,Fb,Ch,Eu,Mu,_u,la=class extends C{constructor(){super(...arguments);m(this,Q);this.overflow="wrap";this.align="start";this.label="";this._items=[];this._size="medium";m(this,Ri,[]);m(this,Ar);m(this,ri);m(this,Vt,0);m(this,Hi,new Set);m(this,Dr,!1);m(this,Ch,e=>{e.stopPropagation();let t=r(this,Ri)[Number(e.detail.value)];if(!t)return;g(this,Dr,!0),(t.shadowRoot?.querySelector('[part="control"]')??t).click(),requestAnimationFrame(()=>requestAnimationFrame(()=>a(this,Q,Eu).call(this)))})}get overflowing(){return[...r(this,Ri)]}connectedCallback(){super.connectedCallback(),g(this,Ar,new MutationObserver(e=>a(this,Q,Bb).call(this,e))),r(this,Ar).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:r0}),typeof ResizeObserver<"u"&&(g(this,ri,new ResizeObserver(()=>a(this,Q,oa).call(this))),r(this,ri).observe(this),g(this,Hi,new Set([this]))),document.fonts?.ready.then(()=>a(this,Q,oa).call(this)),a(this,Q,oa).call(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Ar)?.disconnect(),r(this,ri)?.disconnect(),r(this,Hi).clear(),cancelAnimationFrame(r(this,Vt)),g(this,Vt,0),a(this,Q,ku).call(this,a(this,Q,Ml).call(this))}updated(e){(e.has("overflow")||e.has("moreLabel")||e.has("moreIcon")||e.has("size"))&&a(this,Q,oa).call(this)}firstUpdated(){this.updateComplete.then(()=>this.relayout())}relayout(){cancelAnimationFrame(r(this,Vt)),g(this,Vt,0),a(this,Q,Th).call(this)}render(){let e=this.moreIcon!=null;return c`<div class="row" part="row" role="group" aria-label=${this.label||h}>
|
|
215
215
|
<slot></slot>
|
|
216
216
|
<cm-action-menu class="more ${this._size}${e?" icon":""}" part="more" hidden align="end"
|
|
217
217
|
.items=${this._items} label=${this.moreLabel} ?icon-only=${e} icon=${this.moreIcon||"more"}
|
|
218
|
-
@cm-select=${r(this,
|
|
219
|
-
</div>`}};
|
|
218
|
+
@cm-select=${r(this,Ch)}></cm-action-menu>
|
|
219
|
+
</div>`}};Ri=new WeakMap,Ar=new WeakMap,ri=new WeakMap,Vt=new WeakMap,Hi=new WeakMap,Dr=new WeakMap,Q=new WeakSet,oa=function(){r(this,Vt)||!this.isConnected||g(this,Vt,requestAnimationFrame(()=>{g(this,Vt,0);let e=a(this,Q,Ml).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>a(this,Q,Th).call(this)):a(this,Q,Th).call(this)}))},Bb=function(e){for(let t of e)for(let i of Array.from(t.removedNodes))i instanceof HTMLElement&&i.hasAttribute(Di)&&i.parentElement!==this&&(i.removeAttribute(Di),i.hidden=!1);a(this,Q,oa).call(this)},Ml=function(){return Array.from(this.children).filter(e=>e.localName==="cm-button"&&(!e.hidden||e.hasAttribute(Di)))},ku=function(e){for(let t of e)t.hasAttribute(Di)&&(t.removeAttribute(Di),t.hidden=!1)},_h=function(){return this.renderRoot.querySelector(".more")},Th=function(){let e=this.renderRoot.querySelector(".row"),t=a(this,Q,_h).call(this);if(!e||!t||!this.isConnected)return;let i=a(this,Q,Ml).call(this),s=this.shadowRoot.activeElement===t?t:i.find(b=>b.matches(":focus-within"))??null,l=i[0]?.getAttribute("size");this._size=this.size||(l==="slim"||l==="large"?l:"medium");let d=new Set;if(r(this,ri)){let b=new Set([this,t,...i]);for(let f of r(this,Hi))b.has(f)||r(this,ri).unobserve(f);for(let f of b)r(this,Hi).has(f)||r(this,ri).observe(f);g(this,Hi,b)}if(this.overflow==="menu"){a(this,Q,ku).call(this,i),t.hidden=!1;let b=e.clientWidth,f=parseFloat(getComputedStyle(e).columnGap)||0,x=Array.from(this.children).filter(L=>!L.hidden),v=new Map(x.map(L=>[L,L.getBoundingClientRect().width])),k=x.reduce((L,P)=>L+v.get(P),0)+f*Math.max(x.length-1,0);if(k>b+.5){let L=q=>{let O=q.dataset.priority;return O==="low"?0:O==="high"?2:q.getAttribute("variant")==="primary"?3:1},P=i.map((q,O)=>({b:q,i:O,r:L(q)})).sort((q,O)=>q.r-O.r||O.i-q.i),U=k+f+t.getBoundingClientRect().width;for(let{b:q}of P){if(U<=b+.5)break;d.add(q),U-=v.get(q)+f}}}for(let b of i)d.has(b)?(b.setAttribute(Di,""),b.hidden=!0):b.hasAttribute(Di)&&(b.removeAttribute(Di),b.hidden=!1);t.hidden=d.size===0,s===t&&t.hidden?a(this,Q,_u).call(this):s&&s!==t&&d.has(s)&&a(this,Q,Mu).call(this),d.size===0&&t.open&&t.hide(),r(this,Ar)?.takeRecords();let p=i.filter(b=>d.has(b));this._items=p.map((b,f)=>a(this,Q,Fb).call(this,b,f));let u=p.length!==r(this,Ri).length||p.some((b,f)=>b!==r(this,Ri)[f]);g(this,Ri,p),u&&this.dispatchEvent(new CustomEvent("cm-overflow-change",{detail:{hidden:[...p]},bubbles:!0,composed:!0})),r(this,Dr)&&this.updateComplete.then(()=>a(this,Q,Eu).call(this))},Fb=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(),s=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:s,value:String(t),icon:l,disabled:e.hasAttribute("disabled")||e.hasAttribute("loading")||void 0,critical:e.getAttribute("tone")==="critical"||void 0}},Ch=new WeakMap,Eu=function(){if(!r(this,Dr))return;g(this,Dr,!1);let e=document.activeElement,t=a(this,Q,_h).call(this);(!e||e===document.body||e===document.documentElement||e===this&&(!t||t.hidden||this.shadowRoot.activeElement!==t))&&(t&&!t.hidden?a(this,Q,Mu).call(this):a(this,Q,_u).call(this))},Mu=function(){a(this,Q,_h).call(this)?.shadowRoot?.querySelector('[part="trigger"]')?.focus()},_u=function(){let e=a(this,Q,Ml).call(this).filter(i=>!i.hidden&&!i.hasAttribute("disabled")),t=e[e.length-1];(t?.shadowRoot?.querySelector('[part="control"]')??t)?.focus()},la.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}},la.styles=[E,w`
|
|
220
220
|
:host { display: block; min-inline-size: 0; }
|
|
221
221
|
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); min-inline-size: 0; }
|
|
222
222
|
:host([align='end']) .row { justify-content: flex-end; }
|
|
@@ -240,7 +240,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
240
240
|
.more::part(trigger), .more.slim::part(trigger) { min-height: var(--cm-control-height-lg, 40px); }
|
|
241
241
|
.more.icon::part(trigger), .more.icon.slim::part(trigger) { width: var(--cm-control-height-lg, 40px); }
|
|
242
242
|
}
|
|
243
|
-
`];$("cm-button-group",
|
|
243
|
+
`];$("cm-button-group",la);var At={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ca=o=>(...n)=>({_$litDirective$:o,values:n}),Ni=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:s0}=Lb,Vb=o=>o;var Ub=o=>o.strings===void 0,jb=()=>document.createComment(""),da=(o,n,e)=>{let t=o._$AA.parentNode,i=n===void 0?o._$AB:n._$AA;if(e===void 0){let s=t.insertBefore(jb(),i),l=t.insertBefore(jb(),i);e=new s0(s,l,o,o.options)}else{let s=e._$AB.nextSibling,l=e._$AM,d=l!==o;if(d){let p;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(p=o._$AU)!==l._$AU&&e._$AP(p)}if(s!==i||d){let p=e._$AA;for(;p!==s;){let u=Vb(p).nextSibling;Vb(t).insertBefore(p,i),p=u}}}return e},Pi=(o,n,e=o)=>(o._$AI(n,e),o),a0={},zh=(o,n=a0)=>o._$AH=n,Kb=o=>o._$AH,Sh=o=>{o._$AR(),o._$AA.remove()};var ee=ca(class extends Ni{constructor(o){if(super(o),o.type!==At.PROPERTY&&o.type!==At.ATTRIBUTE&&o.type!==At.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ub(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[n]){if(n===Ne||n===h)return n;let e=o.element,t=o.name;if(o.type===At.PROPERTY){if(n===e[t])return Ne}else if(o.type===At.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return Ne}else if(o.type===At.ATTRIBUTE&&e.getAttribute(t)===n+"")return Ne;return zh(o),n}});var bt=w`
|
|
244
244
|
:host {
|
|
245
245
|
--_cm-field-h: var(--cm-control-height-lg, 40px);
|
|
246
246
|
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
@@ -264,7 +264,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
264
264
|
.error { color: var(--cm-text-critical); }
|
|
265
265
|
:host([size='small']) .field { gap: var(--cm-space-4); }
|
|
266
266
|
:host([size='small']) .label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); }
|
|
267
|
-
`,
|
|
267
|
+
`,ha=w`
|
|
268
268
|
[role='listbox'] {
|
|
269
269
|
max-height: 264px; overflow-y: auto; margin: 0; padding: var(--cm-space-4); list-style: none;
|
|
270
270
|
}
|
|
@@ -276,25 +276,25 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
276
276
|
[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%); }
|
|
277
277
|
:host([size='small']) [role='option'] { min-height: var(--cm-control-height-sm, 32px); }
|
|
278
278
|
@media (pointer: coarse) { [role='option'], :host([size='small']) [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
279
|
-
`;var
|
|
279
|
+
`;var Lh=!1,Tu=!1,Wb=!1,Gb=()=>{Lh||(Lh=!0,setTimeout(()=>{Lh=!1,Tu=!1}))};function n0(){Wb||typeof document>"u"||(Wb=!0,document.addEventListener("click",Gb,!0),document.addEventListener("keydown",o=>{(o.key==="Enter"||o.ctrlKey||o.metaKey)&&Gb()},!0))}var Ze,Rr,pa,ma,Ii,_l,Hr,Tl,Cu,Cl,Ah,Dh,re=class{constructor(n,e,t){m(this,Tl);m(this,Ze);m(this,Rr);m(this,pa);m(this,ma,!1);m(this,Ii,!1);m(this,_l,"");m(this,Hr,!1);m(this,Cl,()=>{g(this,ma,!0)});m(this,Ah,n=>{let e=n.relatedTarget;e&&(r(this,Ze).contains(e)||r(this,Ze).shadowRoot?.contains(e))||r(this,Ze).updateComplete.then(()=>{if(!r(this,ma)||r(this,Ii))return;let t=r(this,Rr).validity;t.valid||t.valueMissing||(g(this,Ii,!0),r(this,Ze).requestUpdate())})});m(this,Dh,n=>{if(!(!Lh&&!r(this,Hr))){if(n.preventDefault(),g(this,Ii,!0),r(this,Ze).requestUpdate(),r(this,Hr)){r(this,pa).call(this);return}Tu||(Tu=!0,r(this,pa).call(this))}});g(this,Ze,n),g(this,Rr,e),g(this,pa,t??(()=>n.focus())),n0(),n.addEventListener("invalid",r(this,Dh)),n.addEventListener("input",r(this,Cl),!0),n.addEventListener("change",r(this,Cl),!0),n.addEventListener("focusout",r(this,Ah))}get message(){return a(this,Tl,Cu).call(this)}sync(){let n=a(this,Tl,Cu).call(this);r(this,Ze).toggleAttribute("data-cm-invalid",!!n),n!==r(this,_l)&&(g(this,_l,n),queueMicrotask(()=>r(this,Ze).requestUpdate()))}reset(){g(this,ma,g(this,Ii,!1)),r(this,Ze).requestUpdate()}report(n){g(this,Hr,!0);try{return n()}finally{g(this,Hr,!1)}}};Ze=new WeakMap,Rr=new WeakMap,pa=new WeakMap,ma=new WeakMap,Ii=new WeakMap,_l=new WeakMap,Hr=new WeakMap,Tl=new WeakSet,Cu=function(){return r(this,Ze).error?r(this,Ze).error:r(this,Ii)?r(this,Rr).validity.valid?"":r(this,Rr).validationMessage:""},Cl=new WeakMap,Ah=new WeakMap,Dh=new WeakMap;var $1=z("textField",{required:"Please fill in this field.",rangeUnderflow:"Enter {min} or later.",rangeOverflow:"Enter {max} or earlier.",numberUnderflow:"Enter {min} or more.",numberOverflow:"Enter {max} or less.",stepMismatch:"Enter a valid value. The two nearest are {lower} and {upper}.",badTime:"Enter a complete time.",badDateTime:"Enter a complete date and time.",badEmail:"Enter an email address like name@example.com.",badUrl:"Enter a web address like https://example.com.",badNumber:"Enter a number.",pattern:"Enter a value in the requested format.",tooShort:"Enter at least {min} characters.",tooLong:"Enter {max} characters or fewer."}),ue,Nr,si,Sl,oe,Yb,zl,Rh,Xb,zu,Su,Lu,qi=class extends C{constructor(){super(...arguments);m(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.inputMode="";this.size="default";this.patternMessage="";m(this,ue,this.attachInternals());m(this,Nr,new re(this,r(this,ue)));m(this,si,N("cm-tf"));m(this,Sl,"")}connectedCallback(){super.connectedCallback(),g(this,Sl,this.value)}get form(){return r(this,ue).form}get validity(){return r(this,ue).validity}get validationMessage(){return r(this,ue).validationMessage}checkValidity(){return a(this,oe,zl).call(this),r(this,ue).checkValidity()}reportValidity(){return a(this,oe,zl).call(this),r(this,Nr).report(()=>r(this,ue).reportValidity())}formResetCallback(){this.value=r(this,Sl),this.error="",r(this,Nr).reset()}formDisabledCallback(e){this.disabled=e}updated(){r(this,ue).setFormValue(this.value),a(this,oe,zl).call(this)}render(){let e=r(this,Nr).message,t=[e&&`${r(this,si)}-err`,this.helpText&&`${r(this,si)}-help`].filter(Boolean).join(" ")||h,i={id:r(this,si),invalid:e?"true":h},s=this.minLength!=null&&this.minLength>0?this.minLength:h,l=this.maxLength!=null&&this.maxLength>=0?this.maxLength:h,d=this.multiline?c`<textarea class="input" part="input" id=${i.id} rows=${this.rows}
|
|
280
280
|
.value=${ee(this.value)} placeholder=${this.placeholder||h}
|
|
281
281
|
inputmode=${this.inputMode||h}
|
|
282
282
|
minlength=${s} maxlength=${l}
|
|
283
283
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
284
284
|
aria-invalid=${i.invalid} aria-describedby=${t}
|
|
285
|
-
@input=${a(this,oe,
|
|
285
|
+
@input=${a(this,oe,zu)} @change=${a(this,oe,Lu)} @blur=${a(this,oe,Su)}></textarea>`:c`<input class="input" part="input" id=${i.id} type=${this.type}
|
|
286
286
|
.value=${ee(this.value)} placeholder=${this.placeholder||h}
|
|
287
287
|
autocomplete=${this.autocomplete??h} inputmode=${this.inputMode||h}
|
|
288
288
|
min=${this.min||h} max=${this.max||h} step=${this.step||h}
|
|
289
289
|
pattern=${this.pattern||h} minlength=${s} maxlength=${l}
|
|
290
290
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
291
291
|
aria-invalid=${i.invalid} aria-describedby=${t}
|
|
292
|
-
@input=${a(this,oe,
|
|
293
|
-
${this.label?c`<label class="label" for=${r(this,
|
|
292
|
+
@input=${a(this,oe,zu)} @change=${a(this,oe,Lu)} @blur=${a(this,oe,Su)} />`;return c`<div class="field">
|
|
293
|
+
${this.label?c`<label class="label" for=${r(this,si)} 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}
|
|
294
294
|
${d}
|
|
295
|
-
${e?c`<p class="error" id="${r(this,
|
|
296
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
297
|
-
</div>`}};ue=new WeakMap,
|
|
295
|
+
${e?c`<p class="error" id="${r(this,si)}-err" role="alert">${e}</p>`:h}
|
|
296
|
+
${this.helpText?c`<p class="help" id="${r(this,si)}-help">${this.helpText}</p>`:h}
|
|
297
|
+
</div>`}};ue=new WeakMap,Nr=new WeakMap,si=new WeakMap,Sl=new WeakMap,oe=new WeakSet,Yb=function(e){if(!this.pattern)return!0;for(let t of["v","u"])try{return new RegExp(`^(?:${this.pattern})$`,t).test(e)}catch{}return!0},zl=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,ue).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,ue).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.type==="number"&&t?.badInput?r(this,ue).setValidity({badInput:!0},this.t("badNumber"),e??void 0):this.required&&!this.value?r(this,ue).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.typeMismatch?r(this,ue).setValidity({typeMismatch:!0},this.t(this.type==="url"?"badUrl":"badEmail"),e??void 0):this.value&&this.minLength!=null&&this.minLength>0&&this.value.length<this.minLength?r(this,ue).setValidity({tooShort:!0},this.t("tooShort",{min:this.minLength}),e??void 0):this.value&&this.maxLength!=null&&this.maxLength>=0&&this.value.length>this.maxLength?r(this,ue).setValidity({tooLong:!0},this.t("tooLong",{max:this.maxLength}),e??void 0):this.value&&!a(this,oe,Yb).call(this,this.value)?r(this,ue).setValidity({patternMismatch:!0},this.patternMessage||this.t("pattern"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,ue).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:a(this,oe,Rh).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,ue).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:a(this,oe,Rh).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,ue).setValidity({stepMismatch:!0},this.t("stepMismatch",a(this,oe,Xb).call(this,e)),e??void 0):r(this,ue).setValidity({}),r(this,Nr).sync()},Rh=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?me(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 s=new Date(+i[1],+i[2]-1,+i[3],+(i[4]??0),+(i[5]??0));return this.type==="datetime-local"?me(s,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"},t):me(s,{day:"numeric",month:"short",year:"numeric"},t)},Xb=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),s=e.valueAsNumber,l=document.createElement("input");l.type=this.type,l.value=this.min??"";let d=Number.isFinite(l.valueAsNumber)?l.valueAsNumber:0,p=d+Math.floor((s-d)/i)*i,u=b=>{if(this.type==="number")return this.formatNumber(Number(b.toPrecision(12)));let x=new Date(b).toISOString();return a(this,oe,Rh).call(this,this.type==="time"?x.slice(11,16):this.type==="date"?x.slice(0,10):x.slice(0,16))};return{lower:u(p),upper:u(p+i)}},zu=function(e){this.value=e.target.value},Su=function(){a(this,oe,zl).call(this)},Lu=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},qi.formAssociated=!0,qi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},qi.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},type:{},multiline:{type:Boolean},rows:{type:Number},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},autocomplete:{},inputMode:{attribute:"inputmode"},size:{reflect:!0},min:{},max:{},step:{},pattern:{},patternMessage:{attribute:"pattern-message"},minLength:{type:Number,attribute:"minlength"},maxLength:{type:Number,attribute:"maxlength"}},qi.styles=[E,bt,w`
|
|
298
298
|
:host { display: block; }
|
|
299
299
|
.input {
|
|
300
300
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -310,13 +310,13 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
310
310
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
311
311
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
312
312
|
:host([error]:not([error=''])) .input, :host([data-cm-invalid]) .input { border-color: var(--cm-border-critical); }
|
|
313
|
-
`];$("cm-text-field",
|
|
314
|
-
<input type="checkbox" id=${r(this,
|
|
313
|
+
`];$("cm-text-field",qi);var z1=z("checkbox",{required:"Please tick this box."}),vt,Pr,ai,Ll,Hh,Jb,Oi=class extends C{constructor(){super(...arguments);m(this,Hh);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;m(this,vt,this.attachInternals());m(this,Pr,new re(this,r(this,vt)));m(this,ai,N("cm-cb"));m(this,Ll,!1)}connectedCallback(){super.connectedCallback(),g(this,Ll,this.checked)}get form(){return r(this,vt).form}get validity(){return r(this,vt).validity}get validationMessage(){return r(this,vt).validationMessage}checkValidity(){return r(this,vt).checkValidity()}reportValidity(){return r(this,Pr).report(()=>r(this,vt).reportValidity())}formResetCallback(){this.checked=r(this,Ll),r(this,Pr).reset()}formDisabledCallback(e){this.disabled=e}updated(){r(this,vt).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,vt).setValidity({valueMissing:!0},this.t("required")):r(this,vt).setValidity({}),r(this,Pr).sync()}render(){let e=this.indeterminate?c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6h8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`:c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6.2 4.8 9 10 3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,t=r(this,Pr).message,i=[this.description&&`${r(this,ai)}-d`,t&&`${r(this,ai)}-err`].filter(Boolean).join(" ");return c`<label for=${r(this,ai)}>
|
|
314
|
+
<input type="checkbox" id=${r(this,ai)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
315
315
|
?disabled=${this.disabled} ?required=${this.required} aria-invalid=${t?"true":h}
|
|
316
|
-
aria-describedby=${i||h} @change=${a(this,
|
|
316
|
+
aria-describedby=${i||h} @change=${a(this,Hh,Jb)} />
|
|
317
317
|
<span class="box" part="box">${e}</span>
|
|
318
|
-
${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,
|
|
319
|
-
</label>${t?c`<p class="error" id="${r(this,
|
|
318
|
+
${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,ai)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
319
|
+
</label>${t?c`<p class="error" id="${r(this,ai)}-err" role="alert">${t}</p>`:h}`}};vt=new WeakMap,Pr=new WeakMap,ai=new WeakMap,Ll=new WeakMap,Hh=new WeakSet,Jb=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Oi.formAssociated=!0,Oi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Oi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},Oi.styles=[E,w`
|
|
320
320
|
:host { display: inline-flex; flex-direction: column; }
|
|
321
321
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
322
322
|
/* The 16px box (18px on touch screens, owner standard 1.6) sits centred on the label's first line (20px); the
|
|
@@ -342,12 +342,12 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
342
342
|
/* 1.14: the field's own message, under the label text (past the box and its gap). */
|
|
343
343
|
.error { margin: 0; padding-inline-start: var(--cm-space-24); font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-critical); }
|
|
344
344
|
:host([data-cm-invalid]) .box, :host([data-cm-invalid]) label:hover input:not(:disabled) + .box { border-color: var(--cm-border-critical); }
|
|
345
|
-
`];$("cm-checkbox",
|
|
345
|
+
`];$("cm-checkbox",Oi);var Al,qr=class extends A{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;m(this,Al,N("cm-radio"))}render(){let e=this.description?`${r(this,Al)}-d`:null;return c`<div class="radio" part="radio" role="radio" id=${r(this,Al)}
|
|
346
346
|
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":h}
|
|
347
347
|
aria-describedby=${e??h} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
348
348
|
<span class="dot" part="dot"></span>
|
|
349
349
|
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?c`<span class="desc" id=${e}>${this.description}</span>`:h}</span>
|
|
350
|
-
</div>`}};
|
|
350
|
+
</div>`}};Al=new WeakMap,qr.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},qr.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}},qr.styles=[E,w`
|
|
351
351
|
:host { display: inline-flex; }
|
|
352
352
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; outline: none; }
|
|
353
353
|
.dot {
|
|
@@ -369,16 +369,16 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
369
369
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
370
370
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
371
371
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
372
|
-
`];$("cm-radio",
|
|
373
|
-
aria-labelledby=${a(this,ge,
|
|
372
|
+
`];$("cm-radio",qr);var N1=z("radioGroup",{required:"Please select one of these options."}),nt,Br,ni,Dl,Rl,Hl,ua,ge,Au,Ph,Ir,Du,ga,Ru,Ih,qh,Nh,Or=class extends C{constructor(){super();m(this,ge);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;m(this,nt,this.attachInternals());m(this,Br,new re(this,r(this,nt)));m(this,ni,N("cm-rg"));m(this,Dl,"");m(this,Rl,!0);m(this,Hl,!1);m(this,ua,!1);m(this,Ph,()=>{a(this,ge,Au).call(this),r(this,ga).call(this)});m(this,ga,()=>{let e=a(this,ge,Ir).call(this),t=!1;for(let s of e)s.checked=!!this.value&&s.value===this.value&&!t,s.checked&&(t=!0),s.groupDisabled=this.disabled;let i=e.find(s=>s.checked&&!s.disabled)??a(this,ge,Du).call(this)[0];for(let s of e)s._tabbable=s===i&&!this.disabled});m(this,Ih,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||a(this,ge,Ru).call(this,t,!0)});m(this,qh,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let i=a(this,ge,Du).call(this),s=i.indexOf(t),l=se(e,this),d;if(e.key==="ArrowDown"||l==="ArrowRight")d=i[(s+1)%i.length];else if(e.key==="ArrowUp"||l==="ArrowLeft")d=i[(s-1+i.length)%i.length];else if(e.key===" ")d=t.disabled?void 0:t;else return;e.preventDefault(),d&&a(this,ge,Ru).call(this,d,!0)});this.addEventListener("keydown",r(this,qh)),this.addEventListener("click",r(this,Ih))}connectedCallback(){super.connectedCallback(),a(this,ge,Au).call(this)}get form(){return r(this,nt).form}get validity(){return r(this,nt).validity}get validationMessage(){return r(this,nt).validationMessage}checkValidity(){return r(this,nt).checkValidity()}reportValidity(){return r(this,Br).report(()=>r(this,nt).reportValidity())}formResetCallback(){this.value=r(this,Dl),r(this,Br).reset()}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(a(this,ge,Ir).call(this).find(t=>t._tabbable)??a(this,ge,Ir).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,Hl)&&!r(this,ua)&&g(this,Rl,!1),g(this,Hl,!0),r(this,ga).call(this),r(this,nt).setFormValue(this.value||null,this.value);let t=a(this,ge,Ir).call(this)[0];this.error?r(this,nt).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,nt).setValidity({valueMissing:!0},this.t("required"),t):r(this,nt).setValidity({}),r(this,Br).sync()}render(){let e=r(this,Br).message,t=[e&&`${r(this,ni)}-err`,this.helpText&&`${r(this,ni)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
373
|
+
aria-labelledby=${a(this,ge,Nh).call(this)?`${r(this,ni)}-l`:h} aria-label=${a(this,ge,Nh).call(this)?h:this.getAttribute("aria-label")??h}
|
|
374
374
|
aria-describedby=${t||h}
|
|
375
375
|
aria-required=${this.required?"true":h} aria-invalid=${e?"true":h}
|
|
376
376
|
aria-disabled=${this.disabled?"true":h}>
|
|
377
|
-
<span class="label" id="${r(this,
|
|
378
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
379
|
-
${e?c`<p class="error" id="${r(this,
|
|
380
|
-
<div class="options" part="options"><slot @slotchange=${r(this,
|
|
381
|
-
</div>`}};nt=new WeakMap,
|
|
377
|
+
<span class="label" id="${r(this,ni)}-l" part="label" ?hidden=${!a(this,ge,Nh).call(this)}>${this.label}<slot name="label"></slot>${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
378
|
+
${this.helpText?c`<p class="help" id="${r(this,ni)}-help">${this.helpText}</p>`:h}
|
|
379
|
+
${e?c`<p class="error" id="${r(this,ni)}-err" role="alert">${e}</p>`:h}
|
|
380
|
+
<div class="options" part="options"><slot @slotchange=${r(this,Ph)}></slot></div>
|
|
381
|
+
</div>`}};nt=new WeakMap,Br=new WeakMap,ni=new WeakMap,Dl=new WeakMap,Rl=new WeakMap,Hl=new WeakMap,ua=new WeakMap,ge=new WeakSet,Au=function(){r(this,Rl)&&(this.value||(g(this,ua,!0),this.value=a(this,ge,Ir).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>g(this,ua,!1))),g(this,Dl,this.value))},Ph=new WeakMap,Ir=function(){return[...this.querySelectorAll("cm-radio")]},Du=function(){return a(this,ge,Ir).call(this).filter(e=>!e.disabled&&!this.disabled)},ga=new WeakMap,Ru=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,r(this,ga).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Ih=new WeakMap,qh=new WeakMap,Nh=function(){return!!this.label||!!this.querySelector("[slot=label]")},Or.formAssociated=!0,Or.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}},Or.styles=[E,w`
|
|
382
382
|
:host { display: block; }
|
|
383
383
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
384
384
|
.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); }
|
|
@@ -387,13 +387,13 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
387
387
|
.error { color: var(--cm-text-critical); }
|
|
388
388
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
389
389
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
390
|
-
`];$("cm-radio-group",
|
|
391
|
-
<input type="checkbox" role="switch" id=${r(this,
|
|
390
|
+
`];$("cm-radio-group",Or);var fa,Fr,Nl,Oh,Qb,Bi=class extends A{constructor(){super(...arguments);m(this,Oh);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;m(this,fa,this.attachInternals());m(this,Fr,N("cm-tg"));m(this,Nl,!1)}connectedCallback(){super.connectedCallback(),g(this,Nl,this.checked)}get form(){return r(this,fa).form}checkValidity(){return r(this,fa).checkValidity()}formResetCallback(){this.checked=r(this,Nl)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,fa).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${r(this,Fr)}>
|
|
391
|
+
<input type="checkbox" role="switch" id=${r(this,Fr)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
392
392
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
393
|
-
aria-describedby=${this.description?`${r(this,
|
|
393
|
+
aria-describedby=${this.description?`${r(this,Fr)}-d`:h} @change=${a(this,Oh,Qb)} />
|
|
394
394
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
395
|
-
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,
|
|
396
|
-
</label>`}};
|
|
395
|
+
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Fr)}-d">${this.description}</span>`:h}</span>`:h}
|
|
396
|
+
</label>`}};fa=new WeakMap,Fr=new WeakMap,Nl=new WeakMap,Oh=new WeakSet,Qb=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Bi.formAssociated=!0,Bi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Bi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},Bi.styles=[E,w`
|
|
397
397
|
:host { display: inline-flex; }
|
|
398
398
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
399
399
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -421,7 +421,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
421
421
|
:host([disabled]) .track { opacity: .5; }
|
|
422
422
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
423
423
|
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
424
|
-
`];$("cm-toggle",
|
|
424
|
+
`];$("cm-toggle",Bi);var ba=w`
|
|
425
425
|
.pop {
|
|
426
426
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-4)); inset-inline: 0;
|
|
427
427
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -433,7 +433,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
433
433
|
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
434
434
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
435
435
|
}
|
|
436
|
-
`;function
|
|
436
|
+
`;function Bh(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=w`
|
|
437
437
|
[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); }
|
|
438
438
|
[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); }
|
|
439
439
|
.gh {
|
|
@@ -442,7 +442,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
442
442
|
}
|
|
443
443
|
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
444
444
|
.gopts { list-style: none; margin: 0; padding: 0; }
|
|
445
|
-
`;function
|
|
445
|
+
`;function va(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 s=[t];e.set(t.group,s),n.push({key:t.group,items:s})}}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 Fh(o){let n=[];return o.forEach((e,t)=>{let i=e.group||"",s=n[n.length-1];s&&s.group===i?s.rows.push({row:e,index:t}):n.push({group:i,rows:[{row:e,index:t}]})}),n}var Vh=w`
|
|
446
446
|
[role='listbox'] { padding-block: var(--cm-space-4); }
|
|
447
447
|
[role='listbox'][hidden] { display: none; }
|
|
448
448
|
[role='option'] {
|
|
@@ -461,12 +461,12 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
461
461
|
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;
|
|
462
462
|
color: var(--cm-text-tertiary); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-xs);
|
|
463
463
|
}
|
|
464
|
-
`;function
|
|
464
|
+
`;function jh(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 Uh(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 Kh(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"}
|
|
465
465
|
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"}
|
|
466
|
-
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function
|
|
466
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function Wh(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var Q1=z("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),ot,jr,Te,xa,Dt,wa,Il,W,Hu,Ur,Nu,Pl,ya,Vr,Vi,Gh,Yh,ql,Xh,Zb,Jh,ji=class extends C{constructor(){super(...arguments);m(this,W);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.size="default";this.loading=!1;this._active=-1;this._slotted=[];m(this,ot,this.attachInternals());m(this,jr,new re(this,r(this,ot)));m(this,Te,N("cm-sel"));m(this,xa,"");m(this,Dt,"");m(this,wa,0);m(this,Il,new MutationObserver(()=>a(this,W,Hu).call(this)));m(this,Ur,new xe);m(this,Yh,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),a(this,W,Pl).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),a(this,W,Pl).call(this),a(this,W,Vi).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=a(this,W,Gh).call(this,t);a(this,W,Pl).call(this,i>=0?i:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?a(this,W,Vr).call(this,this._active):a(this,W,Vi).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?a(this,W,Vr).call(this,this._active):a(this,W,Vi).call(this,-1);break;case"Home":e.preventDefault(),a(this,W,Vi).call(this,"first");break;case"End":e.preventDefault(),a(this,W,Vi).call(this,"last");break;case"PageDown":e.preventDefault(),a(this,W,Vi).call(this,10);break;case"PageUp":e.preventDefault(),a(this,W,Vi).call(this,-10);break;case"Enter":e.preventDefault(),a(this,W,Vr).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),a(this,W,ya).call(this);break;case"Tab":a(this,W,Vr).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,Dt)&&Date.now()-r(this,wa)<500){let i=a(this,W,Gh).call(this," ");i>=0&&(this._active=i)}else a(this,W,Vr).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=a(this,W,Gh).call(this,t);i>=0&&(this._active=i)}}});m(this,ql,e=>{this.open&&!e.composedPath().includes(this)&&a(this,W,ya).call(this)});m(this,Xh,()=>{this.disabled||(this.open?a(this,W,ya).call(this):a(this,W,Pl).call(this))});m(this,Jh,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),a(this,W,Hu).call(this),r(this,Il).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,ql),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,Ur).close(),r(this,Il).disconnect(),document.removeEventListener("pointerdown",r(this,ql),!0)}get form(){return r(this,ot).form}get validity(){return r(this,ot).validity}get validationMessage(){return r(this,ot).validationMessage}checkValidity(){return r(this,ot).checkValidity()}reportValidity(){return r(this,jr).report(()=>r(this,ot).reportValidity())}formResetCallback(){this.value=r(this,xa),this.open=!1,r(this,jr).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?va(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):va(this._slotted)}firstUpdated(){r(this,xa)||g(this,xa,this.value)}updated(e){r(this,ot).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,ot).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,ot).setValidity({valueMissing:!0},this.t("required"),t):r(this,ot).setValidity({}),r(this,jr).sync(),e.has("open")?this.open?r(this,Ur).open(this.renderRoot.querySelector("[role=listbox]"),this.renderRoot.querySelector(".box"),{align:"stretch"}):r(this,Ur).close():this.open&&e.has("items")&&r(this,Ur).place(),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,Te)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(p=>p.value===this.value),i=r(this,jr).message,s=[i&&`${r(this,Te)}-err`,this.helpText&&`${r(this,Te)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=(p,u)=>c`<li role="option" id="${r(this,Te)}-o${u}" class=${u===this._active?"active":""}
|
|
467
467
|
aria-selected=${p.value===this.value?"true":"false"} aria-disabled=${p.disabled?"true":h}
|
|
468
|
-
@pointerenter=${()=>!p.disabled&&(this._active=u)} @click=${()=>a(this,
|
|
469
|
-
${this.label?c`<span class="label" id="${r(this,Te)}-l" part="label" @click=${r(this,
|
|
468
|
+
@pointerenter=${()=>!p.disabled&&(this._active=u)} @click=${()=>a(this,W,Vr).call(this,u)}>${p.label}</li>`;return c`<div class="field">
|
|
469
|
+
${this.label?c`<span class="label" id="${r(this,Te)}-l" part="label" @click=${r(this,Jh)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
470
470
|
<div class="wrap">
|
|
471
471
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
472
472
|
aria-labelledby=${this.label?`${r(this,Te)}-l`:h}
|
|
@@ -475,21 +475,21 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
475
475
|
aria-activedescendant=${this.open&&this._active>=0?`${r(this,Te)}-o${this._active}`:h}
|
|
476
476
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
477
477
|
aria-disabled=${this.disabled?"true":h} aria-describedby=${s||h} aria-busy=${this.loading?"true":h}
|
|
478
|
-
@click=${r(this,
|
|
479
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,Te)}-v">${t?a(this,
|
|
478
|
+
@click=${r(this,Xh)} @keydown=${r(this,Yh)} @blur=${()=>a(this,W,ya).call(this)}>
|
|
479
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,Te)}-v">${t?a(this,W,Zb).call(this,t):this.placeholder}</span>
|
|
480
480
|
${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>`}
|
|
481
481
|
</div>
|
|
482
482
|
<ul role="listbox" id="${r(this,Te)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,Te)}-l`:h}
|
|
483
483
|
aria-label=${!this.label&&l?l:h} ?hidden=${!this.open}
|
|
484
484
|
@pointerdown=${p=>p.preventDefault()}>
|
|
485
|
-
${
|
|
485
|
+
${Fh(e).map((p,u)=>p.group?c`<li role="group" aria-labelledby="${r(this,Te)}-g${u}"><div role="presentation" class="gh" id="${r(this,Te)}-g${u}">${p.group}</div>
|
|
486
486
|
<ul role="none" class="gopts">${p.rows.map(({row:b,index:f})=>d(b,f))}</ul></li>`:p.rows.map(({row:b,index:f})=>d(b,f)))}
|
|
487
487
|
</ul>
|
|
488
488
|
</div>
|
|
489
489
|
${i?c`<p class="error" id="${r(this,Te)}-err" role="alert">${i}</p>`:h}
|
|
490
490
|
${this.helpText?c`<p class="help" id="${r(this,Te)}-help">${this.helpText}</p>`:h}
|
|
491
491
|
<slot></slot>
|
|
492
|
-
</div>`}};ot=new WeakMap,
|
|
492
|
+
</div>`}};ot=new WeakMap,jr=new WeakMap,Te=new WeakMap,xa=new WeakMap,Dt=new WeakMap,wa=new WeakMap,Il=new WeakMap,W=new WeakSet,Hu=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,s={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(s.group=i.label),s}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,xa,this.value))},Ur=new WeakMap,Nu=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},Pl=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:a(this,W,Nu).call(this)[0]??-1)},ya=function(){this.open=!1},Vr=function(e){let t=this.items[e];!t||t.disabled||(a(this,W,ya).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}))))},Vi=function(e){let t=a(this,W,Nu).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))]},Gh=function(e){let t=Date.now();g(this,Dt,t-r(this,wa)>500?e:r(this,Dt)+e),g(this,wa,t);let i=this.items,s=this._active<0?0:this._active,l=r(this,Dt).split("").every(u=>u===r(this,Dt)[0]),d=l?r(this,Dt)[0]:r(this,Dt),p=l||r(this,Dt).length===1?s+1:s;for(let u=0;u<i.length;u++){let b=(p+u)%i.length;if(!i[b].disabled&&i[b].label.toLowerCase().startsWith(d.toLowerCase()))return b}return-1},Yh=new WeakMap,ql=new WeakMap,Xh=new WeakMap,Zb=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},Jh=new WeakMap,ji.formAssociated=!0,ji.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},ji.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}},ji.styles=[E,Pe,bt,ha,Fi,w`
|
|
493
493
|
:host { display: block; position: relative; }
|
|
494
494
|
.label { cursor: default; }
|
|
495
495
|
.wrap { position: relative; }
|
|
@@ -522,16 +522,16 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
522
522
|
[role='group'] { display: block; }
|
|
523
523
|
slot { display: none; }
|
|
524
524
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
525
|
-
`];$("cm-select",
|
|
525
|
+
`];$("cm-select",ji);var nk=z("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),ka,Qh,Ol,Ve,$a,ev,tv,Pu,Ui=class extends C{constructor(){super(...arguments);m(this,Ve);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;m(this,ka,this.attachInternals());m(this,Qh,N("cm-search"));m(this,Ol,"")}connectedCallback(){super.connectedCallback(),g(this,Ol,this.value)}get form(){return r(this,ka).form}checkValidity(){return r(this,ka).checkValidity()}formResetCallback(){this.value=r(this,Ol)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,ka).setFormValue(this.value)}render(){return c`<div class="box" part="box">
|
|
526
526
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
527
|
-
<input id=${r(this,
|
|
527
|
+
<input id=${r(this,Qh)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
528
528
|
aria-label=${this.label} .value=${ee(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
529
|
-
@input=${a(this,Ve,
|
|
530
|
-
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${a(this,Ve,
|
|
529
|
+
@input=${a(this,Ve,ev)} @change=${()=>a(this,Ve,$a).call(this,"change")} @keydown=${a(this,Ve,tv)} />
|
|
530
|
+
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${a(this,Ve,Pu)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
531
531
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
532
532
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
533
|
-
@click=${()=>a(this,Ve
|
|
534
|
-
</div>`}}
|
|
533
|
+
@click=${()=>a(this,Ve,$a).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}
|
|
534
|
+
</div>`}};ka=new WeakMap,Qh=new WeakMap,Ol=new WeakMap,Ve=new WeakSet,$a=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},ev=function(e){this.value=e.target.value},tv=function(e){e.key==="Enter"?a(this,Ve,$a).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),a(this,Ve,Pu).call(this))},Pu=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),a(this,Ve,$a).call(this,"input"),a(this,Ve,$a).call(this,"change")},Ui.formAssociated=!0,Ui.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Ui.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}},Ui.styles=[E,bt,w`
|
|
535
535
|
:host { display: block; }
|
|
536
536
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
537
537
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -565,7 +565,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
565
565
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
566
566
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
567
567
|
:host([disabled]) button { cursor: not-allowed; }
|
|
568
|
-
`];$("cm-search",
|
|
568
|
+
`];$("cm-search",Ui);var pk=z("tag",{remove:"Remove {label}"}),Zh,iv,Kr=class extends C{constructor(){super(...arguments);m(this,Zh);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||this.t("remove",{label:this.textContent?.trim()??""}).trim();return c`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?c`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${a(this,Zh,iv)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};Zh=new WeakSet,iv=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Kr.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Kr.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Kr.styles=[E,w`
|
|
569
569
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
570
570
|
.tag {
|
|
571
571
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -583,17 +583,17 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
583
583
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
584
584
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
|
|
585
585
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
|
|
586
|
-
`];$("cm-tag",
|
|
587
|
-
`):[]:this.value=e)}get items(){return this.options?.length?
|
|
588
|
-
`))}else r(this,je).setFormValue(null);else r(this,je).setFormValue(this.value||null,this.value);let s=this.multiple?!this.values.length:!this.value;this.error?r(this,je).setValidity({customError:!0},this.error,i):this.required&&s?r(this,je).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),i):r(this,je).setValidity({}),r(this,
|
|
586
|
+
`];$("cm-tag",Kr);var kk=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"}),je,Yr,Ce,jl,_a,Ul,Kl,Wl,H,Iu,rv,Bl,ep,Fl,li,Ea,Ma,oi,sv,Vl,qu,Ou,Wr,tp,ip,Gr,av,rp,sp,ap,nv,ov,Ki=class extends C{constructor(){super(...arguments);m(this,H);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.size="default";this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.maxTags=3;this._query="";this._focusIn=!1;this._active=-1;this._slotted=[];this._typing=!1;m(this,je,this.attachInternals());m(this,Yr,new re(this,r(this,je)));m(this,Ce,N("cm-cb"));m(this,jl,null);m(this,_a,new Map);m(this,Ul,new Map);m(this,Kl,new MutationObserver(()=>a(this,H,Iu).call(this)));m(this,Wl);m(this,li,new xe);m(this,tp,()=>{this._focusIn=!0});m(this,ip,()=>{setTimeout(()=>{this._focusIn=this.matches(":focus-within")})});m(this,rp,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,a(this,H,Ma).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});m(this,sp,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?a(this,H,Vl).call(this,1):(a(this,H,Ma).call(this),e.altKey||a(this,H,Vl).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?a(this,H,Vl).call(this,-1):(a(this,H,Ma).call(this),a(this,H,Vl).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),a(this,H,qu).call(this,this._active)):r(this,H,ep)&&(e.preventDefault(),a(this,H,Ou).call(this,r(this,H,ep)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),a(this,H,oi).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",a(this,H,Ea).call(this)));break;case"ArrowLeft":case"ArrowRight":{let i=e.target;this.multiple&&this.values.length&&se(e,this)==="ArrowLeft"&&i.selectionStart===0&&i.selectionEnd===0&&(e.preventDefault(),a(this,H,oi).call(this),a(this,H,Gr).call(this,this.values.length-1));break}case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":a(this,H,oi).call(this);break;default:}});m(this,ap,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(a(this,H,oi).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?a(this,H,Bl).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),a(this,H,Iu).call(this),r(this,Kl).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),g(this,Wl,Bh(this,()=>this.open,()=>a(this,H,oi).call(this))),this.addEventListener("focusin",r(this,tp)),this.addEventListener("focusout",r(this,ip))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,li).close(),r(this,Kl).disconnect(),(e=r(this,Wl))==null||e.call(this)}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,Yr).report(()=>r(this,je).reportValidity())}formResetCallback(){let e=r(this,jl)??{value:"",values:[]};this.value=e.value,this.values=[...e.values],this._query="",this._typing=!1,this.open=!1,r(this,Yr).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){typeof e=="string"&&(this.multiple?this.values=e?e.split(`
|
|
587
|
+
`):[]:this.value=e)}get items(){return this.options?.length?va(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):va(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let i=t.label.toLowerCase();return this.filter==="starts-with"?i.startsWith(e):i.includes(e)})}firstUpdated(){g(this,jl,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,_a).set(t.value,t.label),t.group&&r(this,Ul).set(t.value,t.group);if((e.has("value")||e.has("options")||e.has("_slotted")||e.has("showGroup"))&&!this.multiple&&!this._typing&&(this._query=this.value?a(this,H,Bl).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=a(this,H,Fl).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.open;t&&!r(this,li).active?r(this,li).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,li).active?r(this,li).close():t&&r(this,li).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,je).setFormValue(l,this.values.join(`
|
|
588
|
+
`))}else r(this,je).setFormValue(null);else r(this,je).setFormValue(this.value||null,this.value);let s=this.multiple?!this.values.length:!this.value;this.error?r(this,je).setValidity({customError:!0},this.error,i):this.required&&s?r(this,je).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),i):r(this,je).setValidity({}),r(this,Yr).sync(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,Ce)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),a(this,H,Ea).call(this))}focus(e){this.renderRoot.querySelector("input")?.focus(e)}render(){let e=a(this,H,Fl).call(this),t=r(this,Yr).message,i=[t&&`${r(this,Ce)}-err`,this.helpText&&`${r(this,Ce)}-help`].filter(Boolean).join(" "),s=this.getAttribute("aria-label"),l=u=>this.multiple?this.values.includes(u):u===this.value,d=(u,b)=>c`<li role="option" id="${r(this,Ce)}-o${b}" class=${b===this._active?"active":""}
|
|
589
589
|
aria-selected=${u.create?"false":l(u.value)?"true":"false"} aria-disabled=${u.disabled?"true":h}
|
|
590
|
-
@pointerenter=${()=>!u.disabled&&(this._active=b)} @click=${()=>a(this,H,
|
|
591
|
-
${u.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:u.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${a(this,H,
|
|
590
|
+
@pointerenter=${()=>!u.disabled&&(this._active=b)} @click=${()=>a(this,H,qu).call(this,b)}>
|
|
591
|
+
${u.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:u.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${a(this,H,nv).call(this,u.label)}</span>`}</li>`,p=this.loading?this.loadingText||this.t("loading"):this.open?e.length?this.t("results",{count:e.length}):this.emptyText||this.t("noResults"):"";return c`<div class="field">
|
|
592
592
|
${this.label?c`<label class="label" id="${r(this,Ce)}-l" for="${r(this,Ce)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
593
593
|
<div class="wrap">
|
|
594
|
-
<div class="box" part="box" @click=${u=>{u.target.closest("cm-tag[removable]")||a(this,H,
|
|
594
|
+
<div class="box" part="box" @click=${u=>{u.target.closest("cm-tag[removable]")||a(this,H,Wr).call(this)}}>
|
|
595
595
|
<div class="chips ${this.multiple&&this.values.length?`has-tags${this._focusIn||this.open?"":" idle"}`:""}">
|
|
596
|
-
${this.multiple?a(this,H,
|
|
596
|
+
${this.multiple?a(this,H,ov).call(this):h}
|
|
597
597
|
<input id="${r(this,Ce)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
598
598
|
.value=${ee(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
599
599
|
aria-label=${!this.label&&s?s:h}
|
|
@@ -601,16 +601,16 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
601
601
|
aria-activedescendant=${this.open&&this._active>=0?`${r(this,Ce)}-o${this._active}`:h}
|
|
602
602
|
aria-invalid=${t?"true":h} aria-describedby=${i||h}
|
|
603
603
|
aria-required=${this.required?"true":h} ?disabled=${this.disabled}
|
|
604
|
-
@input=${r(this,
|
|
605
|
-
@click=${()=>{this.open||a(this,H,
|
|
604
|
+
@input=${r(this,rp)} @keydown=${r(this,sp)} @blur=${r(this,ap)}
|
|
605
|
+
@click=${()=>{this.open||a(this,H,Ma).call(this)}} @change=${u=>u.stopPropagation()} />
|
|
606
606
|
</div>
|
|
607
|
-
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?a(this,H,
|
|
607
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?a(this,H,oi).call(this):(a(this,H,Ma).call(this),a(this,H,Wr).call(this))}}></cm-icon>
|
|
608
608
|
</div>
|
|
609
609
|
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${u=>u.preventDefault()}>
|
|
610
610
|
<ul role="listbox" id="${r(this,Ce)}-list" part="listbox" ?hidden=${!e.length}
|
|
611
611
|
aria-labelledby=${this.label?`${r(this,Ce)}-l`:h} aria-label=${!this.label&&s?s:h}
|
|
612
612
|
aria-multiselectable=${this.multiple?"true":h}>
|
|
613
|
-
${
|
|
613
|
+
${Fh(e).map((u,b)=>u.group?c`<li role="group" aria-labelledby="${r(this,Ce)}-g${b}"><div role="presentation" class="gh" id="${r(this,Ce)}-g${b}">${u.group}</div>
|
|
614
614
|
<ul role="none" class="gopts">${u.rows.map(({row:f,index:x})=>d(f,x))}</ul></li>`:u.rows.map(({row:f,index:x})=>d(f,x)))}
|
|
615
615
|
</ul>
|
|
616
616
|
${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>`}
|
|
@@ -620,10 +620,10 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
620
620
|
${t?c`<p class="error" id="${r(this,Ce)}-err" role="alert">${t}</p>`:h}
|
|
621
621
|
${this.helpText?c`<p class="help" id="${r(this,Ce)}-help">${this.helpText}</p>`:h}
|
|
622
622
|
<slot></slot>
|
|
623
|
-
</div>`}};je=new WeakMap,
|
|
624
|
-
remove-label=${this.t("remove",{label:a(this,H,
|
|
625
|
-
@keydown=${l=>a(this,H,
|
|
626
|
-
@cm-remove=${()=>{this.removeValue(i),a(this,H,
|
|
623
|
+
</div>`}};je=new WeakMap,Yr=new WeakMap,Ce=new WeakMap,jl=new WeakMap,_a=new WeakMap,Ul=new WeakMap,Kl=new WeakMap,Wl=new WeakMap,H=new WeakSet,Iu=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,s={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(s.group=i.label),s}),!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])}},rv=function(e){return this.items.find(t=>t.value===e)?.label??r(this,_a).get(e)??e},Bl=function(e){let t=a(this,H,rv).call(this,e);if(!this.showGroup)return t;let i=this.items.find(s=>s.value===e)?.group??r(this,Ul).get(e);return i?this.t("grouped",{group:i,label:t}):t},ep=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},Fl=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,H,ep);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},li=new WeakMap,Ea=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ma=function(){this.disabled||(this.open=!0)},oi=function(){this.open=!1,this._active=-1},sv=function(e=a(this,H,Fl).call(this)){return e.flatMap((t,i)=>t.disabled?[]:[i])},Vl=function(e){let t=a(this,H,sv).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]},qu=function(e){let t=a(this,H,Fl).call(this)[e];if(!(!t||t.disabled)){if(t.create){a(this,H,Ou).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,a(this,H,Ea).call(this),a(this,H,Wr).call(this);return}a(this,H,oi).call(this),this._typing=!1,this._query=this.showGroup&&t.group?this.t("grouped",{group:t.group,label:t.label}):t.label,t.value!==this.value&&(this.value=t.value,a(this,H,Ea).call(this))}},Ou=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,_a).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(a(this,H,oi).call(this),this.value=e,this._typing=!1,this._query=e),a(this,H,Ea).call(this))},Wr=function(){this.renderRoot.querySelector("input")?.focus()},tp=new WeakMap,ip=new WeakMap,Gr=async function(e){await this.updateComplete;let t=this.renderRoot.querySelectorAll("cm-tag[data-i]");e>=0&&e<t.length?t[e].focus():a(this,H,Wr).call(this)},av=function(e,t){let i=se(e,this),s=this.values.length-1;if(i==="ArrowLeft")e.preventDefault(),a(this,H,Gr).call(this,Math.max(0,t-1));else if(i==="ArrowRight")e.preventDefault(),a(this,H,Gr).call(this,t<s?t+1:-1);else if(i==="Home")e.preventDefault(),a(this,H,Gr).call(this,0);else if(i==="End")e.preventDefault(),a(this,H,Gr).call(this,s);else if(i==="Escape")e.preventDefault(),e.stopPropagation(),a(this,H,Wr).call(this);else if((i==="Backspace"||i==="Delete")&&!this.disabled){e.preventDefault(),this.removeValue(this.values[t]);let l=this.values.length;a(this,H,Gr).call(this,i==="Backspace"?t>0?t-1:l?0:-1:t<l?t:-1)}},rp=new WeakMap,sp=new WeakMap,ap=new WeakMap,nv=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)}`},ov=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,s)=>c`<cm-tag removable tabindex="-1" data-i=${s} part="tag" ?disabled=${this.disabled}
|
|
624
|
+
remove-label=${this.t("remove",{label:a(this,H,Bl).call(this,i)})}
|
|
625
|
+
@keydown=${l=>a(this,H,av).call(this,l,s)}
|
|
626
|
+
@cm-remove=${()=>{this.removeValue(i),a(this,H,Wr).call(this)}}>${a(this,H,Bl).call(this,i)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},Ki.formAssociated=!0,Ki.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Ki.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}},Ki.styles=[E,bt,Pe,ba,ha,Fi,w`
|
|
627
627
|
:host { display: block; position: relative; }
|
|
628
628
|
.wrap { position: relative; }
|
|
629
629
|
.box {
|
|
@@ -664,7 +664,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
664
664
|
.create { font-style: normal; }
|
|
665
665
|
slot { display: none; }
|
|
666
666
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
667
|
-
`];$("cm-combobox",
|
|
667
|
+
`];$("cm-combobox",Ki);function Gl(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var o0={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"};function np(o,n){let e=o.trim().toLowerCase().split("+").map(s=>s.trim());e.length>1&&e[e.length-1]===""&&e[e.length-2]===""&&e.splice(-2,2,"+");let t=e.pop();if(!t)return null;let i={key:o0[t]??t,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let s of e)if(s==="mod")n?i.meta=!0:i.ctrl=!0;else if(s==="ctrl"||s==="control")i.ctrl=!0;else if(s==="meta"||s==="cmd"||s==="command")i.meta=!0;else if(s==="alt"||s==="option"||s==="opt")i.alt=!0;else if(s==="shift")i.shift=!0;else return null;return i}function Bu(o,n=Gl()){let e=np(o,n);return!!e&&(e.ctrl||e.meta||e.alt)}function Fu(o,n,e=Gl()){let t=np(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 op(o){let n=o.composedPath()[0];return!!n&&(n.isContentEditable||/^(input|textarea|select)$/i.test(n.localName??""))}var l0={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7"},c0={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},d0={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"},h0=o=>d0[o]??(o.length===1?o.toUpperCase():o[0].toUpperCase()+o.slice(1));function lp(o,n=Gl()){let e=[];for(let t of o.trim().split(/\s+/).filter(Boolean)){let i=np(t,n);if(!i)return[o.trim()];let s=n?l0:c0,l=n?["ctrl","alt","shift","meta"]:["ctrl","meta","alt","shift"];for(let d of l)i[d]&&e.push(s[d]);e.push(h0(i.key))}return e}function lv(o,n=Gl()){if(/\s/.test(o.trim()))return"";let e=np(o,n);if(!e)return"";let t=e.key===" "?"Space":e.key.length===1?e.key.toUpperCase():e.key.replace(/^(arrow|page)?(\w)/,(i,s,l)=>s?`${s[0].toUpperCase()}${s.slice(1)}${l.toUpperCase()}`:l.toUpperCase());return[e.ctrl&&"Control",e.meta&&"Meta",e.alt&&"Alt",e.shift&&"Shift",t].filter(Boolean).join("+")}var Rk=z("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),yt,Xl,ie,cp,Yl,ci,Ta,Vu,dp,cv,hp,Jl,ju,dv,Xr=class extends C{constructor(){super(...arguments);m(this,ie);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;m(this,yt,N("cm-gs"));m(this,Xl);m(this,ci,new xe);m(this,dp,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),a(this,ie,Vu).call(this)});m(this,hp,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),a(this,ie,cv).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,ie,Yl)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,yt)}-o${this._active}`)?.click());break;case"Escape":r(this,ie,Yl)?(e.preventDefault(),e.stopPropagation(),a(this,ie,Ta).call(this)):this.value&&(e.preventDefault(),a(this,ie,ju).call(this,!1));break;case"Tab":a(this,ie,Ta).call(this);break;default:}});m(this,Jl,e=>{!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented||op(e)||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),g(this,Xl,Bh(this,()=>this.open,()=>a(this,ie,Ta).call(this))),document.addEventListener("keydown",r(this,Jl))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,ci).close(),(e=r(this,Xl))==null||e.call(this),document.removeEventListener("keydown",r(this,Jl))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=a(this,ie,cp).call(this).length&&(this._active=-1)}updated(e){let t=r(this,ie,Yl);t&&!r(this,ci).active?r(this,ci).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,ci).active?r(this,ci).close():t&&r(this,ci).place(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,yt)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=a(this,ie,cp).call(this),t=r(this,ie,Yl),i=e.filter(u=>u.item).length,s=this.loading&&t?this.loadingText:t?e.length?this.t("results",{count:i}):this.emptyText:"",l=-1,d=(this.results??[]).filter(u=>u?.items?.length),p=(u,b,f="")=>{let x=++l;return Kh({id:`${r(this,yt)}-o${x}`,active:x===this._active,href:u.href,cls:f,onHover:()=>this._active=x,onChoose:v=>a(this,ie,dv).call(this,v,u)},b)};return c`<div class="wrap">
|
|
668
668
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
669
669
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
670
670
|
|
|
@@ -673,22 +673,22 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
673
673
|
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,yt)}-list"
|
|
674
674
|
aria-activedescendant=${t&&this._active>=0?`${r(this,yt)}-o${this._active}`:h}
|
|
675
675
|
aria-keyshortcuts=${this.shortcut||h}
|
|
676
|
-
@input=${r(this,
|
|
676
|
+
@input=${r(this,dp)} @keydown=${r(this,hp)}
|
|
677
677
|
@focus=${()=>{this.value.trim()&&(this.open=!0)}} @click=${()=>{this.value.trim()&&(this.open=!0)}} />
|
|
678
|
-
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>a(this,ie,
|
|
678
|
+
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>a(this,ie,ju).call(this)}><cm-icon name="close" size="14"></cm-icon></button>`:this.shortcut?c`<kbd aria-hidden="true">${this.shortcut}</kbd>`:h}
|
|
679
679
|
</div>
|
|
680
680
|
<div class="pop" part="popover" ?hidden=${!t} @pointerdown=${u=>u.preventDefault()}>
|
|
681
681
|
<div role="listbox" id="${r(this,yt)}-list" part="listbox" aria-label=${this.label} ?hidden=${!e.length}>
|
|
682
682
|
${d.map((u,b)=>{let f=u.total??u.items.length;return c`<div role="group" aria-labelledby="${r(this,yt)}-g${b}">
|
|
683
|
-
${
|
|
684
|
-
${u.items.map(x=>p({group:u,item:x,href:x.href},
|
|
683
|
+
${jh(`${r(this,yt)}-g${b}`,u.label,this.formatNumber(f),this.t("results",{count:f}))}
|
|
684
|
+
${u.items.map(x=>p({group:u,item:x,href:x.href},Uh(x)))}
|
|
685
685
|
${u.href?p({group:u,href:u.href},c`<span class="text">${u.seeAllLabel||this.seeAllLabel}</span>`,"all"):h}
|
|
686
686
|
</div>`})}
|
|
687
687
|
</div>
|
|
688
688
|
${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>`}
|
|
689
689
|
</div>
|
|
690
690
|
<span class="vh" role="status" aria-live="polite">${s}</span>
|
|
691
|
-
</div>`}};yt=new WeakMap,
|
|
691
|
+
</div>`}};yt=new WeakMap,Xl=new WeakMap,ie=new WeakSet,cp=function(){return this.loading?[]:(this.results??[]).filter(e=>e?.items?.length).flatMap(e=>[...e.items.map(t=>({group:e,item:t,href:t.href})),...e.href?[{group:e,href:e.href}]:[]])},Yl=function(){return this.open&&!!this.value.trim()},ci=new WeakMap,Ta=function(){this.open=!1,this._active=-1},Vu=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},dp=new WeakMap,cv=function(e){this._active=Wh(this._active,e,a(this,ie,cp).call(this).length)},hp=new WeakMap,Jl=new WeakMap,ju=function(e=!0){this.value="",a(this,ie,Ta).call(this),e&&this.renderRoot.querySelector("input")?.focus(),a(this,ie,Vu).call(this)},dv=function(e,t){this.dispatchEvent(new CustomEvent("cm-select",{detail:{href:t.href,item:t.item,group:t.group},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault(),a(this,ie,Ta).call(this)},Xr.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Xr.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}},Xr.styles=[E,Pe,ba,Fi,Vh,w`
|
|
692
692
|
:host { display: block; position: relative; }
|
|
693
693
|
.wrap { position: relative; }
|
|
694
694
|
.box {
|
|
@@ -718,15 +718,15 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
718
718
|
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
719
719
|
}
|
|
720
720
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
721
|
-
`];$("cm-global-search",
|
|
721
|
+
`];$("cm-global-search",Xr);var Uu=0,hv="";function Ku(){Uu++===0&&(hv=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function Ql(){Uu>0&&--Uu===0&&(document.documentElement.style.overflow=hv)}function Wu(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var Ca,di,za,Sa,pp,mp,up,gp,fp,bp,le=class extends C{constructor(){super(...arguments);m(this,Sa);this.open=!1;this.label="";this.uid=N("cm-ovl");m(this,Ca,null);m(this,di,!1);m(this,za,!1);m(this,mp,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});m(this,up,e=>{e.preventDefault(),this.requestClose("escape")});m(this,gp,()=>{this.open&&!this.dialog?.open&&(this.open=!1,a(this,Sa,pp).call(this))});m(this,fp,e=>{g(this,za,e.target===e.currentTarget)});m(this,bp,e=>{if(e.target===e.currentTarget&&r(this,za)){let t=e.currentTarget.getBoundingClientRect();(!(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom)||this.backdropFillsDialog)&&this.requestClose("backdrop")}g(this,za,!1)});this.backdropFillsDialog=!1}show(){this.open=!0}close(){this.open=!1}requestClose(e="method"){let t=this.dispatchEvent(new CustomEvent("cm-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0}));return t&&(this.open=!1),t}closeNow(){this.open=!1;let e=this.dialog;e?.open&&(e.close(),a(this,Sa,pp).call(this))}get dialog(){return this.renderRoot?.querySelector("dialog")}updated(e){if(super.updated(e),!e.has("open"))return;let t=this.dialog;if(t)if(this.open&&!t.open){if(g(this,Ca,Wu()),!this.isConnected)return;t.showModal(),r(this,di)||(Ku(),g(this,di,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),a(this,Sa,pp).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,di)&&(Ql(),g(this,di,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
722
722
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
723
723
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
724
724
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
725
725
|
</header>`}renderDialog(e,t=""){return c`<dialog part="dialog" class=${t}
|
|
726
726
|
aria-labelledby=${this.heading?`${this.uid}-h`:h}
|
|
727
727
|
aria-label=${!this.heading&&this.label?this.label:h}
|
|
728
|
-
@keydown=${r(this,
|
|
729
|
-
@pointerdown=${r(this,
|
|
728
|
+
@keydown=${r(this,mp)} @cancel=${r(this,up)} @close=${r(this,gp)}
|
|
729
|
+
@pointerdown=${r(this,fp)} @click=${r(this,bp)}>${e}</dialog>`}};Ca=new WeakMap,di=new WeakMap,za=new WeakMap,Sa=new WeakSet,pp=function(){r(this,di)&&(Ql(),g(this,di,!1));let e=r(this,Ca);g(this,Ca,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},mp=new WeakMap,up=new WeakMap,gp=new WeakMap,fp=new WeakMap,bp=new WeakMap,le.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},le.overlayStyles=[E,w`
|
|
730
730
|
:host { display: contents; }
|
|
731
731
|
dialog {
|
|
732
732
|
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
@@ -758,7 +758,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
758
758
|
|
|
759
759
|
}
|
|
760
760
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
761
|
-
`];var
|
|
761
|
+
`];var Yk=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"}),pv=o=>o.normalize("NFD").replace(/\p{M}/gu,"").toLocaleLowerCase();function mv(o,n){let e=pv(n).split(/\s+/).filter(Boolean);if(!e.length)return!0;let t=pv([o.title,...o.keywords??[]].join(" "));return e.every(i=>t.includes(i))}var ec,Ae,Gu,Yu,Zl,vp,yp,uv,gv,La=class extends le{constructor(){super();m(this,Ae);this.value="";this.results=[];this.actions=[];this.recent=[];this.loading=!1;this.shortcut="";this._active=-1;m(this,ec,e=>{!this.shortcut||e.defaultPrevented||e.repeat||!Fu(e,this.shortcut)||!this.open&&!Bu(this.shortcut)&&op(e)||this.open&&!Bu(this.shortcut)||(e.preventDefault(),this.toggle())});m(this,vp,e=>{this.value=e.target.value,this._active=a(this,Ae,Zl).call(this).length?0:-1,this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))});m(this,yp,e=>{let t=a(this,Ae,Zl).call(this).length;switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this._active=Wh(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,ec))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",r(this,ec))}willUpdate(e){if(super.willUpdate?.(e),e.has("open")&&!this.open&&e.get("open")&&(this.value="",this._active=-1),["results","actions","recent","loading","value","open"].some(t=>e.has(t))){let t=a(this,Ae,Zl).call(this).length;(this._active>=t||this._active<0)&&(this._active=t?0:-1)}}updated(e){super.updated(e),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.scrollIntoView({block:"nearest"})}focusFirst(){let e=this.renderRoot.querySelector("input");e?.focus(),e?.select()}render(){let e=this.open?a(this,Ae,Yu).call(this):[],t=a(this,Ae,Zl).call(this,e),i=r(this,Ae,Gu),s=t.filter(u=>u.item).length,l=!this.open||!i?"":this.loading?this.loadingText:t.length?this.t("results",{count:s}):this.emptyText,d=this.uid,p=-1;return this.renderDialog(c`<div class="panel" part="panel">
|
|
762
762
|
<div class="top">
|
|
763
763
|
<div class="box" part="box">
|
|
764
764
|
<cm-icon name="search" size="16"></cm-icon>
|
|
@@ -766,8 +766,8 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
766
766
|
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${ee(this.value)}
|
|
767
767
|
aria-autocomplete="list" aria-expanded=${t.length?"true":"false"} aria-controls="${d}-list"
|
|
768
768
|
aria-activedescendant=${this._active>=0&&t.length?`${d}-o${this._active}`:h}
|
|
769
|
-
@input=${r(this,
|
|
770
|
-
<kbd class="esc" aria-hidden="true">${
|
|
769
|
+
@input=${r(this,vp)} @keydown=${r(this,yp)} />
|
|
770
|
+
<kbd class="esc" aria-hidden="true">${lp("escape")[0]}</kbd>
|
|
771
771
|
</div>
|
|
772
772
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel} @click=${()=>this.requestClose("close-button")}>
|
|
773
773
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
@@ -776,14 +776,14 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
776
776
|
${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}
|
|
777
777
|
<div role="listbox" id="${d}-list" part="listbox" aria-label=${this.label} ?hidden=${!t.length}>
|
|
778
778
|
${e.map((u,b)=>c`<div role="group" aria-labelledby="${d}-g${b}">
|
|
779
|
-
${
|
|
780
|
-
${u.rows.map(f=>{let x=++p,v=f.item;return
|
|
779
|
+
${jh(`${d}-g${b}`,u.group.label,u.group.total!==void 0?this.formatNumber(u.group.total):void 0,this.t("results",{count:u.group.total??0}))}
|
|
780
|
+
${u.rows.map(f=>{let x=++p,v=f.item;return Kh({id:`${d}-o${x}`,active:x===this._active,href:f.href,cls:v?"":"all",keyshortcuts:v?.shortcut?lv(v.shortcut):void 0,onHover:()=>this._active=x,onChoose:k=>a(this,Ae,uv).call(this,k,f)},v?Uh(v,a(this,Ae,gv).call(this,v.shortcut)):c`<span class="text">${f.group.seeAllLabel||this.seeAllLabel}</span>`)})}
|
|
781
781
|
</div>`)}
|
|
782
782
|
</div>
|
|
783
783
|
${i&&!this.loading&&!t.length?c`<p class="message" aria-hidden="true">${this.emptyText}</p>`:h}
|
|
784
784
|
</div>
|
|
785
785
|
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
786
|
-
</div>`)}};
|
|
786
|
+
</div>`)}};ec=new WeakMap,Ae=new WeakSet,Gu=function(){return this.value.trim()},Yu=function(){let e=r(this,Ae,Gu),t=[],i=(s,l,d=!1)=>{let p=l.map(u=>({group:s,item:u,href:u.href}));d&&s.href&&p.push({group:s,href:s.href}),l.length&&t.push({group:s,rows:p})};if(!e)this.recent?.length&&i({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let s of this.results??[])s?.items?.length&&i(s,s.items,!0);for(let s of this.actions??[])s?.items?.length&&i(s,e?s.items.filter(l=>mv(l,e)):s.items);return t},Zl=function(e=a(this,Ae,Yu).call(this)){return e.flatMap(t=>t.rows)},vp=new WeakMap,yp=new WeakMap,uv=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)},gv=function(e){return e?c`<span class="keys" aria-hidden="true">${lp(e).map(t=>c`<kbd>${t}</kbd>`)}</span>`:h},La.properties={...le.properties,label:{string:"label"},placeholder:{string:"placeholder"},value:{},results:{type:Array},actions:{type:Array},recent:{type:Array},loading:{type:Boolean,reflect:!0},shortcut:{},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},recentLabel:{attribute:"recent-label",string:"recent"},seeAllLabel:{attribute:"see-all-label",string:"seeAll"},_active:{state:!0}},La.styles=[...le.overlayStyles,ba,Fi,Vh,w`
|
|
787
787
|
dialog {
|
|
788
788
|
position: fixed; inset: 0; margin: max(var(--cm-space-16), 12dvh) auto auto; height: fit-content;
|
|
789
789
|
width: min(var(--cm-command-palette-width, 640px), calc(100vw - 32px));
|
|
@@ -824,20 +824,20 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
824
824
|
.x { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
825
825
|
[role='option'] { min-height: var(--cm-control-height-touch); }
|
|
826
826
|
}
|
|
827
|
-
`];$("cm-command-palette",
|
|
827
|
+
`];$("cm-command-palette",La);var p0=/^(\d{4})-(\d{2})-(\d{2})$/;function R(o){let n=p0.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 jt=(o,n=2)=>String(o).padStart(n,"0"),B=o=>`${jt(o.getFullYear(),4)}-${jt(o.getMonth()+1)}-${jt(o.getDate())}`,Xu=()=>B(new Date),te=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function fe(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 ze=o=>new Date(o.getFullYear(),o.getMonth(),1),Jr=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var m0=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function ke(o){let n=m0.exec(o??"");return n?+n[1]*60+ +n[2]:null}var hi=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${jt(Math.floor(n/60))}:${jt(n%60)}`};function xt(o){let[n="",e=""]=(o??"").split("T"),t=ke(e);return{date:R(n)?n:"",time:t===null?"":hi(t)}}function Ut(o,n=!1){let{date:e,time:t}=xt(o),i=R(e);if(!i)return null;let s=t?ke(t):n?1439:0;return new Date(i.getFullYear(),i.getMonth(),i.getDate(),Math.floor(s/60),s%60)}var vv=()=>{let o=new Date;return`${B(o)}T${jt(o.getHours())}:${jt(o.getMinutes())}`},fv=new Map;function Aa(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,i=fv.get(t);if(i)return i;let s={hour:e==="h23"?"2-digit":"numeric",minute:"2-digit",numberingSystem:"latn",...e?{hourCycle:e}:{}},l=new Intl.DateTimeFormat(o,s),d=l.resolvedOptions().hourCycle,p=k=>new Date(2e3,0,1,k,30),u=k=>(new Intl.DateTimeFormat(o,{hour:"numeric",hourCycle:"h12"}).formatToParts(p(k)).find(L=>L.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),b=(k,L)=>[...new Set([k,...L].filter(Boolean))],f=k=>k.replace(/[\u202f\u00a0]/g," "),x=f(l.formatToParts(p(9)).map(k=>k.type==="hour"?"{h}":k.type==="minute"?"{m}":k.value).join("")),v={format:k=>f(l.format(new Date(2e3,0,1,Math.floor(k/60),k%60))),dateTime:k=>me(k,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",...e?{hourCycle:e}:{}},o),pattern:x,hour12:d==="h12"||d==="h11",am:b(u(9),["am","a"]),pm:b(u(15),["pm","p"])};return fv.set(t,v),v}var xp=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function Qr(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),s=!!t&&n.am.includes(t);if(t&&!i&&!s)return null;let l=e.match(/\d+/g)??[],d,p;if(l.length===1){let u=l[0];if(u.length<=2)d=+u,p=0;else if(u.length<=4)d=+u.slice(0,-2),p=+u.slice(-2);else return null}else if(l.length===2||l.length===3){if(l[0].length>2||l[1].length!==2)return null;d=+l[0],p=+l[1]}else return null;if(p>59)return null;if(s||i){if(d<1||d>12)return null;d=d%12+(i?12:0)}else if(d>23)return null;return hi(d*60+p)}var Da={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},tc=o=>Array.isArray(o)?o:typeof o=="string"?Da.fromAttribute(o):[];function Wi(o,n){let e=[n,vl(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 bv=new Map;function Ha(o){let n=bv.get(o);if(n)return n;let e=v=>new Intl.DateTimeFormat(o,v),t=e({day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"}),i=e({weekday:"short"}),s=e({weekday:"long"}),l=new Date(2024,0,7),d=t.formatToParts(new Date(2026,10,15)),p=d.filter(v=>v.type==="day"||v.type==="month"||v.type==="year").map(v=>v.type),u=d.map(v=>v.type==="day"?"{d}":v.type==="month"?"{m}":v.type==="year"?"{y}":v.value).join(""),b=(v,k)=>Array.from({length:12},(L,P)=>new Intl.DateTimeFormat(v,{month:k}).format(new Date(2024,P,1)).toLowerCase().replace(/\./g,"")),f=Array.from({length:12},(v,k)=>[...new Set([b(o,"long")[k],b(o,"short")[k],b("en","long")[k],b("en","short")[k]])]),x={short:v=>t.format(v),long:v=>me(v,{weekday:"long",day:"numeric",month:"long",year:"numeric"},o),medium:v=>me(v,{day:"numeric",month:"short",year:"numeric"},o),monthYear:v=>me(v,{month:"long",year:"numeric"},o),day:v=>me(v,{day:"numeric"},o),weekdaysShort:Array.from({length:7},(v,k)=>i.format(te(l,k))),weekdaysLong:Array.from({length:7},(v,k)=>s.format(te(l,k))),pattern:p.length===3?u:"{y}-{m}-{d}",order:p.length===3?p:["year","month","day"],months:f};return bv.set(o,x),x}var wp=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function Na(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,s,l,d=t.findIndex(u=>/\p{L}/u.test(u));if(d>=0){let u=t[d];s=n.months.findIndex(v=>v.some(k=>k===u||u.length>=3&&k.startsWith(u)))+1;let b=t.filter((v,k)=>k!==d);if(!s||b.some(v=>!/^\d+$/.test(v)))return null;let f=b.findIndex(v=>v.length===4),x=f>=0?f:1;i=+b[x],l=+b[1-x],b[x].length<=2&&(i+=2e3)}else{if(t.some(f=>!/^\d+$/.test(f)))return null;let u=t[0].length===4?["year","month","day"]:n.order,b=f=>t[u.indexOf(f)];if(i=+b("year"),s=+b("month"),l=+b("day"),b("year").length<=2)i+=2e3;else if(b("year").length!==4)return null}let p=`${jt(i,4)}-${jt(s)}-${jt(l)}`;return R(p)?p:null}function $p(o,n,e,t){let i=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return te(e,1);case"ArrowLeft":return te(e,-1);case"ArrowDown":return te(e,7);case"ArrowUp":return te(e,-7);case"Home":return te(e,-i);case"End":return te(e,6-i);case"PageDown":return fe(e,n.shiftKey?12:1);case"PageUp":return fe(e,n.shiftKey?-12:-1);default:return null}}var Kt=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function ic(o){let{fmt:n,firstDay:e,month:t,focus:i,min:s,max:l}=o,d=ze(t),p=(d.getDay()-e+7)%7,u=Jr(t).getDate(),b=[],f=Array(p).fill(null);for(let q=1;q<=u;q++)f.push(new Date(t.getFullYear(),t.getMonth(),q)),f.length===7&&(b.push(f),f=[]);f.length&&b.push([...f,...Array(7-f.length).fill(null)]);let x=Array.from({length:7},(q,O)=>(O+e)%7),v=Xu(),k=!!s&&Jr(fe(d,-1))<s,L=!!l&&fe(d,1)>l,P=c`<thead class=${o.head==="title"?"vh-head":""}><tr>${x.map(q=>c`<th scope="col" abbr=${n.weekdaysLong[q]}><span aria-hidden="true">${n.weekdaysShort[q]}</span><span class="vh">${n.weekdaysLong[q]}</span></th>`)}</tr></thead>`,U=o.head==="title"?c`<h3 id="${o.id}-month" class="cal-month" part="calendar-month">${n.monthYear(t)}</h3>`:c`<div class="cal-head">
|
|
828
828
|
${o.hideNav==="previous"?c`<span class="cal-nav-gap"></span>`:c`<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.previousLabel} ?disabled=${k} @click=${()=>o.onMonth(-1)}><cm-icon name="chevron-left" size="18"></cm-icon></button>`}
|
|
829
829
|
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
830
830
|
${o.hideNav==="next"?c`<span class="cal-nav-gap"></span>`:c`<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${L} @click=${()=>o.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>`}
|
|
831
831
|
</div>`;return c`${U}
|
|
832
832
|
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${o.id}-month" @keydown=${o.onKey}>
|
|
833
833
|
${P}
|
|
834
|
-
<tbody>${b.map(q=>c`<tr>${q.map(O=>{if(!O)return c`<td class="empty"></td>`;let be=B(O),
|
|
834
|
+
<tbody>${b.map(q=>c`<tr>${q.map(O=>{if(!O)return c`<td class="empty"></td>`;let be=B(O),G=o.isDisabled(O)||!!s&&O<s||!!l&&O>l,K=o.mark(O),Z=o.note?.(O);return c`<td class="day ${K} ${be===v?"today":""}" data-date=${be}
|
|
835
835
|
tabindex=${be===B(i)?"0":"-1"}
|
|
836
|
-
aria-selected=${K?"true":"false"} aria-disabled=${
|
|
836
|
+
aria-selected=${K?"true":"false"} aria-disabled=${G?"true":h}
|
|
837
837
|
aria-current=${be===v?"date":h}
|
|
838
838
|
aria-label="${n.long(O)}${Z?`, ${Z}`:""}"
|
|
839
|
-
@click=${()=>!
|
|
840
|
-
</table>`}var
|
|
839
|
+
@click=${()=>!G&&o.onPick(O)} @pointerenter=${()=>o.onHover?.(O)}><span aria-hidden="true">${n.day(O)}</span></td>`})}</tr>`)}</tbody>
|
|
840
|
+
</table>`}var kp=w`
|
|
841
841
|
.pop {
|
|
842
842
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-8)); inset-inline-start: 0;
|
|
843
843
|
width: max-content; max-width: calc(100vw - 32px); padding: var(--cm-space-12);
|
|
@@ -871,7 +871,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
871
871
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
872
872
|
}
|
|
873
873
|
@media (max-width: 640px) { .day, .empty { height: 36px; } }
|
|
874
|
-
`;function
|
|
874
|
+
`;function Ep(o,n){if(o.key!=="Tab")return;let e=[...n.querySelectorAll('button:not([disabled]), input: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 Pa=w`
|
|
875
875
|
${bt}
|
|
876
876
|
:host { display: block; position: relative; }
|
|
877
877
|
.wrap { position: relative; }
|
|
@@ -903,69 +903,69 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
903
903
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
904
904
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
905
905
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
906
|
-
`;var
|
|
906
|
+
`;var cE=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."}}),Ba,we,ts,wt,Fa,gi,Ji,et,lt,Va,ja,M,rc,Gi,Ua,Mp,Zr,Ia,pi,Yi,mi,ui,_p,Ju,Tp,qa,es,Cp,Qu,yv,zp,xv,wv,fi,Ka,Zu,Oa,sc,ac,eg,$v,Sp,tg,ig,Lp,Ap,Dp,Rp,Hp,nc,Xi=class extends C{constructor(){super(...arguments);m(this,M);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.min="";this.max="";this.placeholder="";m(this,Ba,"");this.disabledDates=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this.time=!1;this.step=1;this.hourCycle="";this._text="";this._dateError="";this._timeError="";this._focus=new Date;m(this,we,this.attachInternals());m(this,ts,new re(this,r(this,we)));m(this,wt,N("cm-dp"));m(this,Fa,null);m(this,gi,!1);m(this,Ji,!1);m(this,et,"");m(this,lt,"");m(this,Va,!1);m(this,ja,"");m(this,Ua,!1);m(this,fi,new xe);m(this,Ka,!1);m(this,Sp,e=>{e.key==="Enter"?a(this,M,eg).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),a(this,M,$v).call(this,e.key==="ArrowUp"?1:-1))});m(this,Lp,()=>{this.disabled||(this.open?this.open=!1:(a(this,M,ac).call(this),this.show()))});m(this,Ap,e=>{e.key==="Enter"?a(this,M,ac).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),a(this,M,ac).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});m(this,Dp,e=>{let t=$p(se(e,this),e,this._focus,r(this,M,Ju));if(t){e.preventDefault(),this._focus=Kt(t,r(this,M,mi),r(this,M,ui)),g(this,Ji,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,M,tg).call(this,this._focus))});m(this,Rp,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,M,ig).call(this);return}Ep(e,e.currentTarget)});m(this,Hp,e=>{this._focus=Kt(fe(this._focus,e),r(this,M,mi),r(this,M,ui))});m(this,nc,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ba)}set locale(e){let t=r(this,Ba);g(this,Ba,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Fa)===null&&g(this,Fa,this.value),document.addEventListener("pointerdown",r(this,nc),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,fi).close(),document.removeEventListener("pointerdown",r(this,nc),!0)}get form(){return r(this,we).form}get validity(){return r(this,we).validity}get validationMessage(){return r(this,we).validationMessage}get valueAsDate(){return this.time?this.value?Ut(this.value):null:R(this.value)}checkValidity(){return a(this,M,zp).call(this),r(this,we).checkValidity()}reportValidity(){return a(this,M,zp).call(this),r(this,ts).report(()=>r(this,we).reportValidity())}formResetCallback(){r(this,ts).reset(),this._dateError=this._timeError="",this.value=r(this,Fa)??"",this.time&&(a(this,M,Qu).call(this,this.value),g(this,M,a(this,M,es).call(this,r(this,lt)),Gi)),this._text=a(this,M,qa).call(this,r(this,M,pi)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(a(this,M,yv).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=R(e);if(!t)return!0;let i=r(this,M,mi),s=r(this,M,ui);return i&&t<i||s&&t>s?!0:tc(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!r(this,Ua)?(a(this,M,Qu).call(this,this.value),r(this,Va)||g(this,M,a(this,M,es).call(this,r(this,lt)),Gi)):this.time&&(e.has("locale")||e.has("hourCycle"))&&r(this,lt)&&g(this,M,a(this,M,es).call(this,r(this,lt)),Gi),(e.has("value")||e.has("time"))&&!r(this,gi)?this._text=a(this,M,qa).call(this,r(this,M,pi)):e.has("locale")&&R(r(this,M,pi))&&(this._text=a(this,M,qa).call(this,r(this,M,pi))),e.has("value")&&!r(this,Ka)&&(this._dateError=this._timeError=""),g(this,Ka,!1),g(this,gi,!1),g(this,Va,!1),g(this,Ua,!1)}updated(e){this.open&&!r(this,fi).active?r(this,fi).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,fi).active?r(this,fi).close():this.open&&r(this,fi).place(),r(this,we).setFormValue(this.value||null,this.time?this.value:this._text),a(this,M,zp).call(this),this.open&&r(this,Ji)&&(g(this,Ji,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&g(this,Ji,!1)}render(){let e=r(this,M,Zr),t=R(r(this,M,pi)),i=[this._dateError,this._timeError].filter(Boolean).join(" "),s=r(this,ts).message,l=this.error||i||s,d=!this.error&&!i&&!!s,p=[l&&`${r(this,wt)}-err`,this.helpText&&`${r(this,wt)}-help`].filter(Boolean).join(" "),u=this.getAttribute("aria-label"),b=this.label||u||"",f=ze(this._focus);return c`<div class="field">
|
|
907
907
|
${this.label?c`<label class="label" for="${r(this,wt)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
908
908
|
<div class="wrap ${this.time?"timed":""}">
|
|
909
909
|
<div class="box ${this._dateError&&!this.error||d?"invalid":""}" part="box">
|
|
910
910
|
<input id="${r(this,wt)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
911
|
-
.value=${ee(this._text)} placeholder=${this.placeholder||r(this,M,
|
|
911
|
+
.value=${ee(this._text)} placeholder=${this.placeholder||r(this,M,Tp)}
|
|
912
912
|
aria-label=${!this.label&&u?u:h}
|
|
913
913
|
?required=${this.required} ?disabled=${this.disabled}
|
|
914
914
|
aria-invalid=${l?"true":h} aria-describedby=${p||h}
|
|
915
915
|
@input=${x=>{x.stopPropagation(),this._text=x.target.value}}
|
|
916
|
-
@change=${()=>a(this,M,
|
|
916
|
+
@change=${()=>a(this,M,ac).call(this)} @keydown=${r(this,Ap)} />
|
|
917
917
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
918
918
|
aria-label=${t?this.t(b?"changeFor":"change",{label:b,date:e.long(t)}):this.t(b?"chooseFor":"choose",{label:b})}
|
|
919
919
|
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,wt)}-pop"
|
|
920
|
-
@click=${r(this,
|
|
920
|
+
@click=${r(this,Lp)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
921
921
|
</div>
|
|
922
922
|
${this.time?c`<div class="box time ${this._timeError&&!this.error||d?"invalid":""}" part="time-box">
|
|
923
923
|
<input class="time-in" part="time-input" type="text" autocomplete="off" spellcheck="false"
|
|
924
|
-
.value=${ee(r(this,M,
|
|
924
|
+
.value=${ee(r(this,M,rc))} placeholder=${r(this,M,Cp)}
|
|
925
925
|
aria-label=${this.t(b?"timeFor":"time",{label:b})}
|
|
926
926
|
?required=${this.required} ?disabled=${this.disabled}
|
|
927
927
|
aria-invalid=${l?"true":h} aria-describedby=${p||h}
|
|
928
928
|
@input=${x=>{x.stopPropagation(),g(this,M,x.target.value,Gi)}}
|
|
929
|
-
@change=${()=>a(this,M,
|
|
929
|
+
@change=${()=>a(this,M,eg).call(this)} @keydown=${r(this,Sp)} />
|
|
930
930
|
</div>`:h}
|
|
931
931
|
<div class="pop" id="${r(this,wt)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
932
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
933
|
-
${this.open?c`<div class="cal">${
|
|
932
|
+
?hidden=${!this.open} @keydown=${r(this,Rp)}>
|
|
933
|
+
${this.open?c`<div class="cal">${ic({id:r(this,wt),fmt:e,firstDay:r(this,M,Ju),month:f,focus:this._focus,min:r(this,M,mi),max:r(this,M,ui),isDisabled:x=>this.isUnavailable(B(x)),mark:x=>t&&B(x)===r(this,M,pi)?"selected":"",onPick:x=>a(this,M,tg).call(this,x),onKey:r(this,Dp),onMonth:r(this,Hp),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:h}
|
|
934
934
|
</div>
|
|
935
935
|
</div>
|
|
936
936
|
${l?c`<p class="error" id="${r(this,wt)}-err" role="alert">${l}</p>`:h}
|
|
937
937
|
${this.helpText?c`<p class="help" id="${r(this,wt)}-help">${this.helpText}</p>`:h}
|
|
938
|
-
</div>`}};Oa=new WeakMap,we=new WeakMap,es=new WeakMap,wt=new WeakMap,Ba=new WeakMap,ui=new WeakMap,Xi=new WeakMap,et=new WeakMap,lt=new WeakMap,Fa=new WeakMap,Va=new WeakMap,M=new WeakSet,tc=function(){return r(this,Va)},Gi=function(e){e!==r(this,Va)&&(g(this,Va,e),this.requestUpdate())},ja=new WeakMap,$p=function(){return Ki(this,this.locale)},Qr=function(){return Ra(r(this,M,$p))},Pa=function(){return La(r(this,M,$p),this.hourCycle)},hi=function(){return this.time?r(this,et):this.value},Wi=function(e){return this.time&&e.trim().toLowerCase()==="now"?gv():e},pi=function(){return R(xt(a(this,M,Wi).call(this,this.min)).date||this.min)},mi=function(){return R(xt(a(this,M,Wi).call(this,this.max)).date||this.max)},kp=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Wu=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Aa(r(this,M,$p)):(Math.trunc(e)%7+7)%7},Ep=function(){return vp(r(this,M,Qr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Ia=function(e){let t=R(e);return t?r(this,M,Qr).short(t):e},Zr=function(e){let t=ke(e);return t===null?"":r(this,M,Pa).format(t)},Mp=function(){return bp(r(this,M,Pa),{h:this.t("patternHour"),m:this.t("patternMinute")})},Yu=function(e){let{date:t,time:i}=xt(e);g(this,et,t),g(this,lt,t?i:"")},fv=function(){let e=new Date,t=R(r(this,M,hi))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=Ut(t,r(this,M,pi),r(this,M,mi)),g(this,Xi,!0)},_p=function(){a(this,M,bv).call(this),r(this,es).sync()},bv=function(){let e=this.renderRoot.querySelector("input")??void 0,t=R(r(this,M,hi)),i=r(this,M,Qr);this.error?r(this,we).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,we).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,M,Ep)}),e):this.time?a(this,M,vv).call(this,t,e):this.required&&!t?r(this,we).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,pi)&&t<r(this,M,pi)?r(this,we).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,pi))}),e):t&&r(this,M,mi)&&t>r(this,M,mi)?r(this,we).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,mi))}),e):t&&this.isUnavailable(this.value)?r(this,we).setValidity({customError:!0},this.t("unavailable"),e):r(this,we).setValidity({})},vv=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,s=(f,x,v,k=t)=>r(this,we).setValidity(f,this.t(x,v),k),l=ke(r(this,lt));if(r(this,M,tc).trim()&&l===null)return s({badInput:!0},"badTime",{pattern:r(this,M,Mp)},i);if(!e&&l===null)return this.required?s({valueMissing:!0},"required"):r(this,we).setValidity({});if(!e)return s({badInput:!0},"required");if(l===null)return s({badInput:!0},"timeMissing",void 0,i);let d=jt(`${r(this,et)}T${r(this,lt)}`),p=jt(a(this,M,Wi).call(this,this.min)),u=jt(a(this,M,Wi).call(this,this.max),!0),b=(f,x)=>xt(f).time?r(this,M,Pa).dateTime(x):r(this,M,Qr).medium(x);if(p&&d<p)return s({rangeUnderflow:!0},"rangeUnderflow",{date:b(a(this,M,Wi).call(this,this.min),p)},i);if(u&&d>u)return s({rangeOverflow:!0},"rangeOverflow",{date:b(a(this,M,Wi).call(this,this.max),u)},i);if(l%r(this,M,kp))return s({stepMismatch:!0},"stepMismatch",{count:r(this,M,kp)},i);if(this.isUnavailable(r(this,et)))return s({customError:!0},"unavailable");r(this,we).setValidity({})},gi=new WeakMap,Ua=new WeakMap,Xu=function(e){e!==this.value&&(g(this,Ua,!0),this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},qa=function(e,t){g(this,et,e),g(this,lt,t);let i=e&&t?`${e}T${t}`:"";g(this,ja,!0),this.requestUpdate(),a(this,M,Xu).call(this,i)},ic=function(e){this.time?a(this,M,qa).call(this,e,r(this,lt)):a(this,M,Xu).call(this,e)},rc=function(){let e=this._text.trim();if(this._dateError="",!e){a(this,M,ic).call(this,"");return}let t=Ha(e,r(this,M,Qr));t?(a(this,M,ic).call(this,t),this._text=a(this,M,Ia).call(this,t)):(g(this,ui,!0),a(this,M,ic).call(this,""),this._dateError=this.t("badInput",{pattern:r(this,M,Ep)}))},Ju=function(){let e=r(this,M,tc).trim(),t=e?Jr(e,r(this,M,Pa)):"";if(g(this,ui,!0),t===null){g(this,Fa,!0),a(this,M,qa).call(this,r(this,et),""),this._timeError=this.t("badTime",{pattern:r(this,M,Mp)});return}this._timeError="",a(this,M,qa).call(this,r(this,et),t),g(this,M,a(this,M,Zr).call(this,t),Gi)},yv=function(e){let t=r(this,M,kp),i=Jr(r(this,M,tc),r(this,M,Pa));if(!i){let p=xt(a(this,M,Wi).call(this,this.min)),u=new Date;if(i=p.time&&(!r(this,et)||r(this,et)===p.date)?p.time:di(u.getHours()*60+u.getMinutes()),ke(i)%t===0){g(this,ui,!0),a(this,M,qa).call(this,r(this,et),i),g(this,M,a(this,M,Zr).call(this,i),Gi);return}e=1}let s=ke(i),l=e>0?(Math.floor(s/t)+1)*t:(Math.ceil(s/t)-1)*t,d=di(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,ui,!0),a(this,M,qa).call(this,r(this,et),d),g(this,M,a(this,M,Zr).call(this,d),Gi)},Tp=new WeakMap,Qu=function(e){let t=B(e);this.isUnavailable(t)||(this.open=!1,a(this,M,ic).call(this,t),this._text=a(this,M,Ia).call(this,t),this._dateError="",this.time&&!r(this,lt)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):a(this,M,Zu).call(this))},Zu=function(){this.renderRoot.querySelector(".trigger")?.focus()},Cp=new WeakMap,zp=new WeakMap,Sp=new WeakMap,Lp=new WeakMap,Dp=new WeakMap,sc=new WeakMap,Yi.formAssociated=!0,Yi.shadowRootOptions={...D.shadowRootOptions,delegatesFocus:!0},Yi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Da},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_dateError:{state:!0},_timeError:{state:!0},_focus:{state:!0}},Yi.styles=[E,Pe,Na,xp,w`.pop { min-width: 0; }`];$("cm-date-picker",Yi);var gE=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",thisWeek:"This week",lastWeek:"Last week",last28Days:"Last 28 days",last12Months:"Last 12 months",thisYear:"This year",lastYear:"Last year",quarterToDate:"Quarter to date",lastQuarter:"Last quarter",dayCount:{one:"{count} day",other:"{count} days"},custom:"Custom",apply:"Apply",cancel:"Cancel",noRange:"No dates chosen"}),eg=(o,n)=>te(o,-((o.getDay()-n+7)%7)),xv={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[te(o,-1),te(o,-1)]],"this-week":["This week",(o,n)=>[eg(o,n),o]],"last-week":["Last week",(o,n)=>[te(eg(o,n),-7),te(eg(o,n),-1)]],"last-7-days":["Last 7 days",o=>[te(o,-6),o]],"last-28-days":["Last 28 days",o=>[te(o,-27),o]],"last-30-days":["Last 30 days",o=>[te(o,-29),o]],"last-90-days":["Last 90 days",o=>[te(o,-89),o]],"last-12-months":["Last 12 months",o=>[te(fe(o,-12),1),o]],"this-month":["This month",o=>[ze(o),o]],"last-month":["Last month",o=>[ze(fe(o,-1)),Xr(fe(o,-1))]],"quarter-to-date":["Quarter to date",o=>[new Date(o.getFullYear(),o.getMonth()-o.getMonth()%3,1),o]],"last-quarter":["Last quarter",o=>{let n=new Date(o.getFullYear(),o.getMonth()-o.getMonth()%3-3,1);return[n,Xr(fe(n,2))]}],"this-year":["This year",o=>[new Date(o.getFullYear(),0,1),o]],"last-year":["Last year",o=>[new Date(o.getFullYear()-1,0,1),new Date(o.getFullYear()-1,11,31)]]},d0=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Ap(o,n=new Date,e,t=0){if(typeof o=="object"&&o)return o;let i=xv[o];if(!i||!Object.prototype.hasOwnProperty.call(xv,o))return null;let s=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[l,d]=i[1](s,t);return{label:e?.(d0(o))||i[0],start:B(l),end:B(d)}}var h0=["custom","today","yesterday","this-week","last-7-days","last-week","last-28-days","last-30-days","this-month","last-month","last-90-days","quarter-to-date","this-year"],Xa,Ee,is,Se,Ja,Qa,Ue,Za,Kt,Zi,_,ts,ac,Rp,fi,Ji,Ka,nc,Ga,tg,Hp,oc,Ke,lc,At,bi,wv,cc,Wa,Np,ig,rg,sg,ag,Pp,ng,Ya,pc,Ip,mc,uc,gc,dc,hc,$v,kv,Qi=class extends C{constructor(){super(...arguments);m(this,_);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";m(this,Xa,"");this.disabledDates=[];this.presets=[];this.preset="";this.months=1;this.confirm=!1;this.variant="";this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;this._view=ze(new Date);this._draftPreset="";this._dStartText="";this._dEndText="";m(this,Ee,this.attachInternals());m(this,is,new re(this,r(this,Ee)));m(this,Se,N("cm-drp"));m(this,Ja,null);m(this,Qa,!1);m(this,Ue,!1);m(this,Za,!1);m(this,Kt,!1);m(this,Zi,!1);m(this,Ke,"start");m(this,bi,new xe);m(this,pc,()=>{this.disabled||(this.open?this.open=!1:(r(this,_,ts)||(a(this,_,Wa).call(this,"start"),a(this,_,Wa).call(this,"end")),this.show()))});m(this,Ip,e=>t=>{t.key==="Enter"?a(this,_,Wa).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),a(this,_,Wa).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});m(this,mc,e=>{let t=yp(se(e,this),e,this._focus,r(this,_,Ji));if(t){e.preventDefault(),this._focus=Ut(t,R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus),g(this,Kt,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,_,Np).call(this,this._focus))});m(this,uc,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,_,Ya).call(this);return}wp(e,e.currentTarget)});m(this,gc,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Xa)}set locale(e){let t=r(this,Xa);g(this,Xa,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Ja)||g(this,Ja,[this.start,this.end,this.preset]),document.addEventListener("pointerdown",r(this,gc),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,bi).close(),document.removeEventListener("pointerdown",r(this,gc),!0)}get form(){return r(this,Ee).form}get validity(){return r(this,Ee).validity}get validationMessage(){return r(this,Ee).validationMessage}checkValidity(){return r(this,Ee).checkValidity()}reportValidity(){return r(this,is).report(()=>r(this,Ee).reportValidity())}formResetCallback(){[this.start,this.end,this.preset]=r(this,Ja)??["","",""],this._startText=a(this,_,At).call(this,this.start),this._endText=a(this,_,At).call(this,this.end),this.open=!1,r(this,is).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=R(this.start)?this.start:"",this._draftEnd=R(this.end)?this.end:"",this._draftPreset=this.preset,this._hover=null,g(this,Ue,!1);let e=new Date,t=r(this,_,nc)===2?R(this.end)??R(this.start):R(this.start);this._view=ze(fe(Ut(t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),R(this.min),R(this.max)),1-r(this,_,nc))),this._focus=Ut(R(this.start)??t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus),g(this,Ke,"start"),g(this,Kt,!0),g(this,Zi,!0),a(this,_,Ka).call(this),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=R(e);if(!t)return!0;let i=R(this.min),s=R(this.max);return i&&t<i||s&&t>s?!0:Zl(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){if(e.has("preset")&&!r(this,Qa)&&this.preset){let t=Ap(this.preset,new Date,void 0,r(this,_,Ji));t&&(this.start=t.start,this.end=t.end)}g(this,Qa,!1),r(this,Za)||(e.has("start")&&(this._startText=a(this,_,At).call(this,this.start)),e.has("end")&&(this._endText=a(this,_,At).call(this,this.end))),g(this,Za,!1),e.has("locale")&&(R(this.start)&&(this._startText=a(this,_,At).call(this,this.start)),R(this.end)&&(this._endText=a(this,_,At).call(this,this.end)))}updated(){this.open&&!r(this,bi).active?r(this,bi).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,bi).active?r(this,bi).close():this.open&&r(this,bi).place();let e=R(this.start),t=R(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,Ee).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let s=r(this,_,ts)?[]:[...this.renderRoot.querySelectorAll(".box input")],l=this.renderRoot.querySelector(".trigger")??void 0,[d,p]=[s[0]??l,s[1]??l],u=r(this,_,fi),b=R(this.min),f=R(this.max);if(this.error?r(this,Ee).setValidity({customError:!0},this.error,d):this._startText.trim()&&!e?r(this,Ee).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,_,lc)}),d):this._endText.trim()&&!t?r(this,Ee).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,_,lc)}),p):this.required&&(!e||!t)?r(this,Ee).setValidity({valueMissing:!0},this.t("required"),e?p:d):e&&t&&t<e?r(this,Ee).setValidity({badInput:!0},this.t("endBeforeStart"),p):e&&b&&e<b||t&&b&&t<b?r(this,Ee).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:u.medium(b)}),d):e&&f&&e>f||t&&f&&t>f?r(this,Ee).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:u.medium(f)}),p):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,Ee).setValidity({customError:!0},this.t("unavailable"),d):r(this,Ee).setValidity({}),r(this,is).sync(),this.open&&r(this,Kt)&&(g(this,Kt,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),this.open&&r(this,Zi)){g(this,Zi,!1);let x=this.renderRoot.querySelector(".r-months"),v=R(this._draftStart)??this._focus,k=x?.querySelector(`[data-month="${B(ze(v)).slice(0,7)}"]`),L=x?.querySelector(".r-week");x&&k&&(x.scrollTop=k.offsetTop-(L?.offsetHeight??0))}}render(){let e=r(this,_,fi),t=R(this.start),i=R(this.end),s=r(this,is).message,l=[s&&`${r(this,Se)}-err`,this.helpText&&`${r(this,Se)}-help`].filter(Boolean).join(" "),d=this.getAttribute("aria-label"),p=this.label||d||"",u=this.open?r(this,_,Hp):[],[b,f,x]=r(this,_,ac)?[this._draftStart,this._draftEnd,this._draftPreset]:[this.start,this.end,this.preset],v=!r(this,Ue)&&!!x&&u.some(K=>K.key===x),k=K=>!r(this,Ue)&&(v?K.key===x:K.start===b&&K.end===f),L=r(this,Ue)||!u.some(k)&&!!(b||f),P=r(this,_,nc),U=K=>ec({id:P===1?r(this,Se):`${r(this,Se)}-m${K}`,fmt:e,firstDay:r(this,_,Ji),month:fe(this._view,K),focus:this._focus,min:R(this.min),max:R(this.max),isDisabled:Z=>this.isUnavailable(B(Z)),mark:Z=>a(this,_,dc).call(this,Z),note:Z=>{let Ct=a(this,_,dc).call(this,Z);return Ct==="start"?this.t("startNote"):Ct==="end"?this.t("endNote"):""},onPick:Z=>a(this,_,Np).call(this,Z),onKey:r(this,mc),onMonth:Z=>{this._view=fe(this._view,Z),this._focus=Ut(fe(this._focus,Z),R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus)},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:Z=>{r(this,Ke)==="end"&&(this._hover=Z)},hideNav:P===1?void 0:K===0?"next":"previous"}),q=R(this._draftStart),O=R(this._draftEnd),be=r(this,Ke)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(R(this._draftStart))}):this.t("chooseStart"),W=K=>{let Z=K==="start"?this._startText:this._endText;return c`<input id="${r(this,Se)}-${K}" type="text" autocomplete="off" spellcheck="false"
|
|
939
|
-
.value=${ee(Z)} placeholder=${r(this,_,
|
|
938
|
+
</div>`}};Ba=new WeakMap,we=new WeakMap,ts=new WeakMap,wt=new WeakMap,Fa=new WeakMap,gi=new WeakMap,Ji=new WeakMap,et=new WeakMap,lt=new WeakMap,Va=new WeakMap,ja=new WeakMap,M=new WeakSet,rc=function(){return r(this,ja)},Gi=function(e){e!==r(this,ja)&&(g(this,ja,e),this.requestUpdate())},Ua=new WeakMap,Mp=function(){return Wi(this,this.locale)},Zr=function(){return Ha(r(this,M,Mp))},Ia=function(){return Aa(r(this,M,Mp),this.hourCycle)},pi=function(){return this.time?r(this,et):this.value},Yi=function(e){return this.time&&e.trim().toLowerCase()==="now"?vv():e},mi=function(){return R(xt(a(this,M,Yi).call(this,this.min)).date||this.min)},ui=function(){return R(xt(a(this,M,Yi).call(this,this.max)).date||this.max)},_p=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Ju=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,M,Mp)):(Math.trunc(e)%7+7)%7},Tp=function(){return wp(r(this,M,Zr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},qa=function(e){let t=R(e);return t?r(this,M,Zr).short(t):e},es=function(e){let t=ke(e);return t===null?"":r(this,M,Ia).format(t)},Cp=function(){return xp(r(this,M,Ia),{h:this.t("patternHour"),m:this.t("patternMinute")})},Qu=function(e){let{date:t,time:i}=xt(e);g(this,et,t),g(this,lt,t?i:"")},yv=function(){let e=new Date,t=R(r(this,M,pi))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=Kt(t,r(this,M,mi),r(this,M,ui)),g(this,Ji,!0)},zp=function(){a(this,M,xv).call(this),r(this,ts).sync()},xv=function(){let e=this.renderRoot.querySelector("input")??void 0,t=R(r(this,M,pi)),i=r(this,M,Zr);this.error?r(this,we).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,we).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,M,Tp)}),e):this.time?a(this,M,wv).call(this,t,e):this.required&&!t?r(this,we).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,mi)&&t<r(this,M,mi)?r(this,we).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,mi))}),e):t&&r(this,M,ui)&&t>r(this,M,ui)?r(this,we).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,ui))}),e):t&&this.isUnavailable(this.value)?r(this,we).setValidity({customError:!0},this.t("unavailable"),e):r(this,we).setValidity({})},wv=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,s=(f,x,v,k=t)=>r(this,we).setValidity(f,this.t(x,v),k),l=ke(r(this,lt));if(r(this,M,rc).trim()&&l===null)return s({badInput:!0},"badTime",{pattern:r(this,M,Cp)},i);if(!e&&l===null)return this.required?s({valueMissing:!0},"required"):r(this,we).setValidity({});if(!e)return s({badInput:!0},"required");if(l===null)return s({badInput:!0},"timeMissing",void 0,i);let d=Ut(`${r(this,et)}T${r(this,lt)}`),p=Ut(a(this,M,Yi).call(this,this.min)),u=Ut(a(this,M,Yi).call(this,this.max),!0),b=(f,x)=>xt(f).time?r(this,M,Ia).dateTime(x):r(this,M,Zr).medium(x);if(p&&d<p)return s({rangeUnderflow:!0},"rangeUnderflow",{date:b(a(this,M,Yi).call(this,this.min),p)},i);if(u&&d>u)return s({rangeOverflow:!0},"rangeOverflow",{date:b(a(this,M,Yi).call(this,this.max),u)},i);if(l%r(this,M,_p))return s({stepMismatch:!0},"stepMismatch",{count:r(this,M,_p)},i);if(this.isUnavailable(r(this,et)))return s({customError:!0},"unavailable");r(this,we).setValidity({})},fi=new WeakMap,Ka=new WeakMap,Zu=function(e){e!==this.value&&(g(this,Ka,!0),this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Oa=function(e,t){g(this,et,e),g(this,lt,t);let i=e&&t?`${e}T${t}`:"";g(this,Ua,!0),this.requestUpdate(),a(this,M,Zu).call(this,i)},sc=function(e){this.time?a(this,M,Oa).call(this,e,r(this,lt)):a(this,M,Zu).call(this,e)},ac=function(){let e=this._text.trim();if(this._dateError="",!e){a(this,M,sc).call(this,"");return}let t=Na(e,r(this,M,Zr));t?(a(this,M,sc).call(this,t),this._text=a(this,M,qa).call(this,t)):(g(this,gi,!0),a(this,M,sc).call(this,""),this._dateError=this.t("badInput",{pattern:r(this,M,Tp)}))},eg=function(){let e=r(this,M,rc).trim(),t=e?Qr(e,r(this,M,Ia)):"";if(g(this,gi,!0),t===null){g(this,Va,!0),a(this,M,Oa).call(this,r(this,et),""),this._timeError=this.t("badTime",{pattern:r(this,M,Cp)});return}this._timeError="",a(this,M,Oa).call(this,r(this,et),t),g(this,M,a(this,M,es).call(this,t),Gi)},$v=function(e){let t=r(this,M,_p),i=Qr(r(this,M,rc),r(this,M,Ia));if(!i){let p=xt(a(this,M,Yi).call(this,this.min)),u=new Date;if(i=p.time&&(!r(this,et)||r(this,et)===p.date)?p.time:hi(u.getHours()*60+u.getMinutes()),ke(i)%t===0){g(this,gi,!0),a(this,M,Oa).call(this,r(this,et),i),g(this,M,a(this,M,es).call(this,i),Gi);return}e=1}let s=ke(i),l=e>0?(Math.floor(s/t)+1)*t:(Math.ceil(s/t)-1)*t,d=hi(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,gi,!0),a(this,M,Oa).call(this,r(this,et),d),g(this,M,a(this,M,es).call(this,d),Gi)},Sp=new WeakMap,tg=function(e){let t=B(e);this.isUnavailable(t)||(this.open=!1,a(this,M,sc).call(this,t),this._text=a(this,M,qa).call(this,t),this._dateError="",this.time&&!r(this,lt)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):a(this,M,ig).call(this))},ig=function(){this.renderRoot.querySelector(".trigger")?.focus()},Lp=new WeakMap,Ap=new WeakMap,Dp=new WeakMap,Rp=new WeakMap,Hp=new WeakMap,nc=new WeakMap,Xi.formAssociated=!0,Xi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Xi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Da},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_dateError:{state:!0},_timeError:{state:!0},_focus:{state:!0}},Xi.styles=[E,Pe,Pa,kp,w`.pop { min-width: 0; }`];$("cm-date-picker",Xi);var yE=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",thisWeek:"This week",lastWeek:"Last week",last28Days:"Last 28 days",last12Months:"Last 12 months",thisYear:"This year",lastYear:"Last year",quarterToDate:"Quarter to date",lastQuarter:"Last quarter",dayCount:{one:"{count} day",other:"{count} days"},custom:"Custom",apply:"Apply",cancel:"Cancel",noRange:"No dates chosen"}),rg=(o,n)=>te(o,-((o.getDay()-n+7)%7)),kv={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[te(o,-1),te(o,-1)]],"this-week":["This week",(o,n)=>[rg(o,n),o]],"last-week":["Last week",(o,n)=>[te(rg(o,n),-7),te(rg(o,n),-1)]],"last-7-days":["Last 7 days",o=>[te(o,-6),o]],"last-28-days":["Last 28 days",o=>[te(o,-27),o]],"last-30-days":["Last 30 days",o=>[te(o,-29),o]],"last-90-days":["Last 90 days",o=>[te(o,-89),o]],"last-12-months":["Last 12 months",o=>[te(fe(o,-12),1),o]],"this-month":["This month",o=>[ze(o),o]],"last-month":["Last month",o=>[ze(fe(o,-1)),Jr(fe(o,-1))]],"quarter-to-date":["Quarter to date",o=>[new Date(o.getFullYear(),o.getMonth()-o.getMonth()%3,1),o]],"last-quarter":["Last quarter",o=>{let n=new Date(o.getFullYear(),o.getMonth()-o.getMonth()%3-3,1);return[n,Jr(fe(n,2))]}],"this-year":["This year",o=>[new Date(o.getFullYear(),0,1),o]],"last-year":["Last year",o=>[new Date(o.getFullYear()-1,0,1),new Date(o.getFullYear()-1,11,31)]]},u0=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Np(o,n=new Date,e,t=0){if(typeof o=="object"&&o)return o;let i=kv[o];if(!i||!Object.prototype.hasOwnProperty.call(kv,o))return null;let s=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[l,d]=i[1](s,t);return{label:e?.(u0(o))||i[0],start:B(l),end:B(d)}}var g0=["custom","today","yesterday","this-week","last-7-days","last-week","last-28-days","last-30-days","this-month","last-month","last-90-days","quarter-to-date","this-year"],Ja,Ee,rs,Se,Qa,Za,Ue,en,Wt,er,_,is,oc,Pp,bi,Qi,Wa,lc,Ga,sg,Ip,cc,Ke,dc,Rt,vi,Ev,hc,Ya,qp,ag,ng,og,lg,Op,cg,Xa,uc,Bp,gc,fc,bc,pc,mc,Mv,_v,Zi=class extends C{constructor(){super(...arguments);m(this,_);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";m(this,Ja,"");this.disabledDates=[];this.presets=[];this.preset="";this.months=1;this.confirm=!1;this.variant="";this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;this._view=ze(new Date);this._draftPreset="";this._dStartText="";this._dEndText="";m(this,Ee,this.attachInternals());m(this,rs,new re(this,r(this,Ee)));m(this,Se,N("cm-drp"));m(this,Qa,null);m(this,Za,!1);m(this,Ue,!1);m(this,en,!1);m(this,Wt,!1);m(this,er,!1);m(this,Ke,"start");m(this,vi,new xe);m(this,uc,()=>{this.disabled||(this.open?this.open=!1:(r(this,_,is)||(a(this,_,Ya).call(this,"start"),a(this,_,Ya).call(this,"end")),this.show()))});m(this,Bp,e=>t=>{t.key==="Enter"?a(this,_,Ya).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),a(this,_,Ya).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});m(this,gc,e=>{let t=$p(se(e,this),e,this._focus,r(this,_,Qi));if(t){e.preventDefault(),this._focus=Kt(t,R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus),g(this,Wt,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,_,qp).call(this,this._focus))});m(this,fc,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,_,Xa).call(this);return}Ep(e,e.currentTarget)});m(this,bc,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ja)}set locale(e){let t=r(this,Ja);g(this,Ja,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Qa)||g(this,Qa,[this.start,this.end,this.preset]),document.addEventListener("pointerdown",r(this,bc),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,vi).close(),document.removeEventListener("pointerdown",r(this,bc),!0)}get form(){return r(this,Ee).form}get validity(){return r(this,Ee).validity}get validationMessage(){return r(this,Ee).validationMessage}checkValidity(){return r(this,Ee).checkValidity()}reportValidity(){return r(this,rs).report(()=>r(this,Ee).reportValidity())}formResetCallback(){[this.start,this.end,this.preset]=r(this,Qa)??["","",""],this._startText=a(this,_,Rt).call(this,this.start),this._endText=a(this,_,Rt).call(this,this.end),this.open=!1,r(this,rs).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=R(this.start)?this.start:"",this._draftEnd=R(this.end)?this.end:"",this._draftPreset=this.preset,this._hover=null,g(this,Ue,!1);let e=new Date,t=r(this,_,lc)===2?R(this.end)??R(this.start):R(this.start);this._view=ze(fe(Kt(t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),R(this.min),R(this.max)),1-r(this,_,lc))),this._focus=Kt(R(this.start)??t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus),g(this,Ke,"start"),g(this,Wt,!0),g(this,er,!0),a(this,_,Wa).call(this),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=R(e);if(!t)return!0;let i=R(this.min),s=R(this.max);return i&&t<i||s&&t>s?!0:tc(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){if(e.has("preset")&&!r(this,Za)&&this.preset){let t=Np(this.preset,new Date,void 0,r(this,_,Qi));t&&(this.start=t.start,this.end=t.end)}g(this,Za,!1),r(this,en)||(e.has("start")&&(this._startText=a(this,_,Rt).call(this,this.start)),e.has("end")&&(this._endText=a(this,_,Rt).call(this,this.end))),g(this,en,!1),e.has("locale")&&(R(this.start)&&(this._startText=a(this,_,Rt).call(this,this.start)),R(this.end)&&(this._endText=a(this,_,Rt).call(this,this.end)))}updated(){this.open&&!r(this,vi).active?r(this,vi).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,vi).active?r(this,vi).close():this.open&&r(this,vi).place();let e=R(this.start),t=R(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,Ee).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let s=r(this,_,is)?[]:[...this.renderRoot.querySelectorAll(".box input")],l=this.renderRoot.querySelector(".trigger")??void 0,[d,p]=[s[0]??l,s[1]??l],u=r(this,_,bi),b=R(this.min),f=R(this.max);if(this.error?r(this,Ee).setValidity({customError:!0},this.error,d):this._startText.trim()&&!e?r(this,Ee).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,_,dc)}),d):this._endText.trim()&&!t?r(this,Ee).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,_,dc)}),p):this.required&&(!e||!t)?r(this,Ee).setValidity({valueMissing:!0},this.t("required"),e?p:d):e&&t&&t<e?r(this,Ee).setValidity({badInput:!0},this.t("endBeforeStart"),p):e&&b&&e<b||t&&b&&t<b?r(this,Ee).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:u.medium(b)}),d):e&&f&&e>f||t&&f&&t>f?r(this,Ee).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:u.medium(f)}),p):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,Ee).setValidity({customError:!0},this.t("unavailable"),d):r(this,Ee).setValidity({}),r(this,rs).sync(),this.open&&r(this,Wt)&&(g(this,Wt,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),this.open&&r(this,er)){g(this,er,!1);let x=this.renderRoot.querySelector(".r-months"),v=R(this._draftStart)??this._focus,k=x?.querySelector(`[data-month="${B(ze(v)).slice(0,7)}"]`),L=x?.querySelector(".r-week");x&&k&&(x.scrollTop=k.offsetTop-(L?.offsetHeight??0))}}render(){let e=r(this,_,bi),t=R(this.start),i=R(this.end),s=r(this,rs).message,l=[s&&`${r(this,Se)}-err`,this.helpText&&`${r(this,Se)}-help`].filter(Boolean).join(" "),d=this.getAttribute("aria-label"),p=this.label||d||"",u=this.open?r(this,_,Ip):[],[b,f,x]=r(this,_,oc)?[this._draftStart,this._draftEnd,this._draftPreset]:[this.start,this.end,this.preset],v=!r(this,Ue)&&!!x&&u.some(K=>K.key===x),k=K=>!r(this,Ue)&&(v?K.key===x:K.start===b&&K.end===f),L=r(this,Ue)||!u.some(k)&&!!(b||f),P=r(this,_,lc),U=K=>ic({id:P===1?r(this,Se):`${r(this,Se)}-m${K}`,fmt:e,firstDay:r(this,_,Qi),month:fe(this._view,K),focus:this._focus,min:R(this.min),max:R(this.max),isDisabled:Z=>this.isUnavailable(B(Z)),mark:Z=>a(this,_,pc).call(this,Z),note:Z=>{let zt=a(this,_,pc).call(this,Z);return zt==="start"?this.t("startNote"):zt==="end"?this.t("endNote"):""},onPick:Z=>a(this,_,qp).call(this,Z),onKey:r(this,gc),onMonth:Z=>{this._view=fe(this._view,Z),this._focus=Kt(fe(this._focus,Z),R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus)},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:Z=>{r(this,Ke)==="end"&&(this._hover=Z)},hideNav:P===1?void 0:K===0?"next":"previous"}),q=R(this._draftStart),O=R(this._draftEnd),be=r(this,Ke)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(R(this._draftStart))}):this.t("chooseStart"),G=K=>{let Z=K==="start"?this._startText:this._endText;return c`<input id="${r(this,Se)}-${K}" type="text" autocomplete="off" spellcheck="false"
|
|
939
|
+
.value=${ee(Z)} placeholder=${r(this,_,dc)}
|
|
940
940
|
aria-label=${K==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
941
941
|
?required=${this.required} ?disabled=${this.disabled}
|
|
942
942
|
aria-invalid=${s?"true":h} aria-describedby=${l||h}
|
|
943
|
-
@input=${
|
|
944
|
-
@change=${()=>a(this,_,
|
|
943
|
+
@input=${zt=>{zt.stopPropagation();let $r=zt.target.value;K==="start"?this._startText=$r:this._endText=$r}}
|
|
944
|
+
@change=${()=>a(this,_,Ya).call(this,K)} @keydown=${r(this,Bp).call(this,K)} />`};return c`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,Se)}-l`:h} aria-label=${!this.label&&d?d:h}>
|
|
945
945
|
${this.label?c`<span class="label" id="${r(this,Se)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
946
|
-
${r(this,_,
|
|
946
|
+
${r(this,_,is)?a(this,_,_v).call(this,p,s,l):c`<div class="wrap">
|
|
947
947
|
<div class="box" part="box">
|
|
948
|
-
${
|
|
948
|
+
${G("start")}<span class="sep" aria-hidden="true">–</span>${G("end")}
|
|
949
949
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
950
950
|
aria-label=${t&&i?this.t(p?"changeFor":"change",{label:p,start:e.long(t),end:e.long(i)}):this.t(p?"chooseFor":"choose",{label:p})}
|
|
951
951
|
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Se)}-pop"
|
|
952
|
-
@click=${r(this,
|
|
952
|
+
@click=${r(this,uc)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
953
953
|
</div>
|
|
954
954
|
<div class="pop" id="${r(this,Se)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
955
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
955
|
+
?hidden=${!this.open} @keydown=${r(this,fc)}>
|
|
956
956
|
${this.open?c`<div class="body">
|
|
957
|
-
${u.length||r(this,_,
|
|
957
|
+
${u.length||r(this,_,cc)?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${u.map(K=>c`<li>
|
|
958
958
|
<button type="button" class="preset" data-preset=${K.key||h} aria-pressed=${k(K)?"true":"false"}
|
|
959
|
-
@click=${()=>a(this,_,
|
|
959
|
+
@click=${()=>a(this,_,ag).call(this,K)}>${K.label}</button></li>`)}${r(this,_,cc)?c`<li>
|
|
960
960
|
<button type="button" class="preset" data-preset="custom" aria-pressed=${L?"true":"false"}
|
|
961
|
-
@click=${()=>a(this,_,
|
|
961
|
+
@click=${()=>a(this,_,ng).call(this)}>${this.t("custom")}</button></li>`:h}</ul>`:h}
|
|
962
962
|
<div>
|
|
963
963
|
<div class="cals">${Array.from({length:P},(K,Z)=>c`<div class="cal">${U(Z)}</div>`)}</div>
|
|
964
964
|
<p class="status" aria-live="polite">${be}</p>
|
|
965
|
-
${r(this,_,
|
|
965
|
+
${r(this,_,oc)&&!r(this,_,is)?c`<div class="foot" part="footer">
|
|
966
966
|
<span class="draft">${q&&O?`${e.medium(q)} \u2013 ${e.medium(O)}`:q?`${e.medium(q)} \u2013`:this.t("noRange")}</span>
|
|
967
|
-
<button type="button" class="act" @click=${()=>a(this,_,
|
|
968
|
-
<button type="button" class="act primary" ?disabled=${!q||!O} @click=${()=>a(this,_,
|
|
967
|
+
<button type="button" class="act" @click=${()=>a(this,_,cg).call(this)}>${this.t("cancel")}</button>
|
|
968
|
+
<button type="button" class="act primary" ?disabled=${!q||!O} @click=${()=>a(this,_,og).call(this)}>${this.t("apply")}</button>
|
|
969
969
|
</div>`:h}
|
|
970
970
|
</div>
|
|
971
971
|
</div>`:h}
|
|
@@ -973,47 +973,47 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
973
973
|
</div>`}
|
|
974
974
|
${s?c`<p class="error" id="${r(this,Se)}-err" role="alert">${s}</p>`:h}
|
|
975
975
|
${this.helpText?c`<p class="help" id="${r(this,Se)}-help">${this.helpText}</p>`:h}
|
|
976
|
-
</div>`}};
|
|
977
|
-
<input id="${r(this,Se)}-d${X}" type="text" autocomplete="off" spellcheck="false" placeholder=${r(this,_,
|
|
978
|
-
.value=${ee(X==="start"?this._dStartText:this._dEndText)} aria-invalid=${
|
|
976
|
+
</div>`}};Ja=new WeakMap,Ee=new WeakMap,rs=new WeakMap,Se=new WeakMap,Qa=new WeakMap,Za=new WeakMap,Ue=new WeakMap,en=new WeakMap,Wt=new WeakMap,er=new WeakMap,_=new WeakSet,is=function(){return this.variant==="report"},oc=function(){return this.confirm||r(this,_,is)},Pp=function(){return Wi(this,this.locale)},bi=function(){return Ha(r(this,_,Pp))},Qi=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,_,Pp)):(Math.trunc(e)%7+7)%7},Wa=function(){this._dStartText=a(this,_,Rt).call(this,this._draftStart),this._dEndText=a(this,_,Rt).call(this,this._draftEnd)},lc=function(){return Number(this.months)!==2||typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches?1:2},Ga=function(e){let t=r(this,_,lc),i=ze(e);i<this._view?this._view=i:i>=fe(this._view,t)&&(this._view=fe(i,1-t))},sg=function(){let e=tc(this.presets);return e.length||!r(this,_,is)?e:g0},Ip=function(){return r(this,_,sg).flatMap(e=>{let t=Np(e,new Date,i=>this.t(i),r(this,_,Qi));return t?[{...t,key:typeof e=="string"?e:""}]:[]})},cc=function(){return r(this,_,sg).includes("custom")},Ke=new WeakMap,dc=function(){return wp(r(this,_,bi),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Rt=function(e){let t=R(e);return t?r(this,_,bi).short(t):e},vi=new WeakMap,Ev=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},hc=function(e,t,i){let s=i??r(this,_,Ip).find(l=>l.key&&l.start===e&&l.end===t)?.key??"";s!==this.preset&&(g(this,Za,!0),this.preset=s),!(e===this.start&&t===this.end)&&(this.start=e,this.end=t,a(this,_,Ev).call(this))},Ya=function(e){let t=(e==="start"?this._startText:this._endText).trim(),i=t?Na(t,r(this,_,bi)):"";t&&!i&&g(this,en,!0);let s=e==="start"?[i??"",this.end]:[this.start,i??""];a(this,_,hc).call(this,...s),i&&(e==="start"?this._startText=a(this,_,Rt).call(this,i):this._endText=a(this,_,Rt).call(this,i))},qp=function(e){let t=B(e);if(!this.isUnavailable(t)){if(this._draftPreset="",g(this,Ue,!0),r(this,Ke)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",g(this,Ke,"end"),this._focus=e,g(this,Wt,!0),a(this,_,Wa).call(this);return}if(this._draftEnd=t,a(this,_,Wa).call(this),g(this,Ke,"start"),r(this,_,oc)){this._focus=e,g(this,Wt,!0);return}this.open=!1,a(this,_,hc).call(this,this._draftStart,t,""),a(this,_,Xa).call(this)}},ag=function(e){if(r(this,_,oc)){this._draftStart=e.start,this._draftEnd=e.end,this._draftPreset=e.key,g(this,Ue,!1),g(this,Ke,"start");let t=R(e.end);this._focus=Kt(t,R(this.min),R(this.max)),a(this,_,Ga).call(this,R(e.start)),a(this,_,Ga).call(this,t),g(this,er,!0),a(this,_,Wa).call(this);return}this.open=!1,a(this,_,hc).call(this,e.start,e.end,e.key),a(this,_,Xa).call(this)},ng=function(){g(this,Ue,!0),this._draftPreset="",g(this,Ke,"start"),g(this,Wt,!0),this.requestUpdate()},og=function(){!this._draftStart||!this._draftEnd||(this.open=!1,a(this,_,hc).call(this,this._draftStart,this._draftEnd,r(this,Ue)?"":this._draftPreset||void 0),a(this,_,Xa).call(this))},lg=function(e){let t=(e==="start"?this._dStartText:this._dEndText).trim(),i=t?Na(t,r(this,_,bi)):"";if(i===null||i&&this.isUnavailable(i)){this.requestUpdate();return}g(this,Ue,!0),this._draftPreset="",e==="start"?(this._draftStart=i,i&&this._draftEnd&&this._draftEnd<i&&(this._draftEnd="")):i&&this._draftStart&&i<this._draftStart?(this._draftEnd=this._draftStart,this._draftStart=i):this._draftEnd=i,g(this,Ke,this._draftStart&&!this._draftEnd?"end":"start");let s=R(i);s&&(this._focus=s,g(this,er,e==="start")),a(this,_,Wa).call(this)},Op=function(e){let t=(e==="start"?this._dStartText:this._dEndText).trim();if(!t)return!1;let i=Na(t,r(this,_,bi));return!i||this.isUnavailable(i)},cg=function(){this.open=!1,a(this,_,Xa).call(this)},Xa=function(){this.renderRoot.querySelector(".trigger")?.focus()},uc=new WeakMap,Bp=new WeakMap,gc=new WeakMap,fc=new WeakMap,bc=new WeakMap,pc=function(e){let t=B(e),i=this._draftStart,s=this._draftEnd||(r(this,Ke)==="end"&&i?B(this._hover??this._focus):"");return t===i?"start":t===s&&s>i?"end":i&&s&&t>i&&t<s?"in-range":""},mc=function(e,t,i){let s=R(e),l=R(t);if(!s)return"";let d=new Intl.DateTimeFormat(r(this,_,Pp),{day:"numeric",month:"short",...i?{year:"numeric"}:{}}),p=d.formatRange;return(!l||+s==+l?d.format(s):p?p.call(d,s,l):`${d.format(s)} \u2013 ${d.format(l)}`).replace(/[\u202f\u2009\u00a0]/g," ")},Mv=function(){let e=[new Date,R(this._draftStart),R(this._draftEnd),this._focus].filter(p=>!!p).map(Number),t=fe(ze(new Date(Math.min(...e))),-12),i=fe(ze(new Date(Math.max(...e))),2),s=R(this.min),l=R(this.max);s&&ze(s)>t&&(t=ze(s)),l&&ze(l)<i&&(i=ze(l)),t>i&&(t=i);let d=[];for(let p=t;p<=i&&d.length<600;p=fe(p,1))d.push(p);return d},_v=function(e,t,i){let s=r(this,_,bi),l=R(this.start),d=R(this.end),p=this.open?r(this,_,Ip):[],[u,b,f]=[this._draftStart,this._draftEnd,this._draftPreset],x=!r(this,Ue)&&!!f&&p.some(X=>X.key===f),v=X=>!r(this,Ue)&&(x?X.key===f:X.start===u&&X.end===b),k=r(this,Ue)||!p.some(v)&&!!(u||b),L=new Date().getFullYear(),P=this.preset&&this.preset!=="custom"?Np(this.preset,new Date,X=>this.t(X),r(this,_,Qi))?.label??"":l&&d&&r(this,_,cc)?this.t("custom"):"",U=l&&d?a(this,_,mc).call(this,this.start,this.end,!0):"",q=Array.from({length:7},(X,St)=>(St+r(this,_,Qi))%7),O=R(u),be=R(b),G=O&&be?Math.round((+be-+O)/864e5)+1:0,K=r(this,Ke)==="end"&&u?this.t("chooseEnd",{date:s.medium(O)}):this.t("chooseStart"),Z=l&&d?this.t(e?"changeFor":"change",{label:e,start:s.long(l),end:s.long(d)}):this.t(e?"chooseFor":"choose",{label:e}),zt=X=>{let St=a(this,_,Op).call(this,X);return c`<label class="r-in"><span>${X==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}</span>
|
|
977
|
+
<input id="${r(this,Se)}-d${X}" type="text" autocomplete="off" spellcheck="false" placeholder=${r(this,_,dc)}
|
|
978
|
+
.value=${ee(X==="start"?this._dStartText:this._dEndText)} aria-invalid=${St?"true":h}
|
|
979
979
|
@input=${pe=>{pe.stopPropagation();let Fe=pe.target.value;X==="start"?this._dStartText=Fe:this._dEndText=Fe}}
|
|
980
|
-
@change=${pe=>{pe.stopPropagation(),a(this,_,
|
|
981
|
-
@keydown=${pe=>{pe.key==="Enter"&&(pe.preventDefault(),a(this,_,
|
|
982
|
-
<button type="button" class="preset" data-preset=${X.key||h} aria-pressed=${v(X)?"true":"false"} @click=${()=>a(this,_,
|
|
983
|
-
<span class="p-label">${X.label}</span><span class="p-span">${a(this,_,
|
|
980
|
+
@change=${pe=>{pe.stopPropagation(),a(this,_,lg).call(this,X)}}
|
|
981
|
+
@keydown=${pe=>{pe.key==="Enter"&&(pe.preventDefault(),a(this,_,lg).call(this,X))}} /></label>`},$r=X=>c`<li>
|
|
982
|
+
<button type="button" class="preset" data-preset=${X.key||h} aria-pressed=${v(X)?"true":"false"} @click=${()=>a(this,_,ag).call(this,X)}>
|
|
983
|
+
<span class="p-label">${X.label}</span><span class="p-span">${a(this,_,mc).call(this,X.start,X.end,R(X.start).getFullYear()!==L||R(X.end).getFullYear()!==L)}</span>
|
|
984
984
|
</button></li>`;return c`<div class="wrap">
|
|
985
985
|
<button type="button" class="trigger summary" part="trigger" ?disabled=${this.disabled}
|
|
986
986
|
aria-label=${P?`${P}, ${Z}`:Z} aria-describedby=${i||h}
|
|
987
987
|
aria-invalid=${t?"true":h}
|
|
988
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Se)}-pop" @click=${r(this,
|
|
988
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Se)}-pop" @click=${r(this,uc)}>
|
|
989
989
|
${P?c`<span class="chip">${P}</span>`:h}
|
|
990
990
|
<span class="range ${U?"":"empty"}">${U||this.t("choose")}</span>
|
|
991
991
|
<cm-icon name="chevron-down" size="16"></cm-icon>
|
|
992
992
|
</button>
|
|
993
993
|
<div class="pop r-pop" id="${r(this,Se)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
994
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
994
|
+
?hidden=${!this.open} @keydown=${r(this,fc)}>
|
|
995
995
|
${this.open?c`<div class="r-body">
|
|
996
996
|
<ul class="presets r-presets" part="presets" aria-label=${this.t("presets")}>
|
|
997
|
-
${r(this,_,
|
|
998
|
-
@click=${()=>a(this,_,
|
|
999
|
-
${p.map(
|
|
997
|
+
${r(this,_,cc)?c`<li class="custom"><button type="button" class="preset" data-preset="custom" aria-pressed=${k?"true":"false"}
|
|
998
|
+
@click=${()=>a(this,_,ng).call(this)}><span class="p-label">${this.t("custom")}</span></button></li>`:h}
|
|
999
|
+
${p.map($r)}
|
|
1000
1000
|
</ul>
|
|
1001
1001
|
<div class="r-main">
|
|
1002
|
-
<div class="r-inputs">${
|
|
1002
|
+
<div class="r-inputs">${zt("start")}<span class="sep" aria-hidden="true">–</span>${zt("end")}</div>
|
|
1003
1003
|
<div class="r-months" part="months">
|
|
1004
1004
|
<div class="r-week" aria-hidden="true">${q.map(X=>c`<span>${s.weekdaysShort[X]}</span>`)}</div>
|
|
1005
|
-
${r(this,_
|
|
1005
|
+
${r(this,_,Mv).map(X=>{let St=B(X).slice(0,7);return c`<div class="r-month" data-month=${St}>${ic({id:`${r(this,Se)}-${St}`,fmt:s,firstDay:r(this,_,Qi),month:X,focus:this._focus,head:"title",min:R(this.min),max:R(this.max),isDisabled:pe=>this.isUnavailable(B(pe)),mark:pe=>a(this,_,pc).call(this,pe),note:pe=>{let Fe=a(this,_,pc).call(this,pe);return Fe==="start"?this.t("startNote"):Fe==="end"?this.t("endNote"):""},onPick:pe=>a(this,_,qp).call(this,pe),onKey:r(this,gc),onMonth:()=>{},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:pe=>{r(this,Ke)==="end"&&(this._hover=pe)}})}</div>`})}
|
|
1006
1006
|
</div>
|
|
1007
1007
|
<p class="status vh" aria-live="polite">${K}</p>
|
|
1008
1008
|
</div>
|
|
1009
1009
|
</div>
|
|
1010
1010
|
<div class="foot r-foot" part="footer">
|
|
1011
|
-
<span class="draft">${O&&be?c`${a(this,_,
|
|
1012
|
-
<button type="button" class="act" @click=${()=>a(this,_,
|
|
1013
|
-
<button type="button" class="act primary" ?disabled=${!O||!be||a(this,_,
|
|
1011
|
+
<span class="draft">${O&&be?c`${a(this,_,mc).call(this,u,b,!0)} <span class="count">· ${this.t("dayCount",{count:G})}</span>`:O?`${a(this,_,mc).call(this,u,"",!0)} \u2013`:this.t("noRange")}</span>
|
|
1012
|
+
<button type="button" class="act" @click=${()=>a(this,_,cg).call(this)}>${this.t("cancel")}</button>
|
|
1013
|
+
<button type="button" class="act primary" ?disabled=${!O||!be||a(this,_,Op).call(this,"start")||a(this,_,Op).call(this,"end")} @click=${()=>a(this,_,og).call(this)}>${this.t("apply")}</button>
|
|
1014
1014
|
</div>`:h}
|
|
1015
1015
|
</div>
|
|
1016
|
-
</div>`},
|
|
1016
|
+
</div>`},Zi.formAssociated=!0,Zi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Zi.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},preset:{reflect:!0},months:{type:Number,reflect:!0},confirm:{type:Boolean,reflect:!0},variant:{reflect:!0},_dStartText:{state:!0},_dEndText:{state:!0},startLabel:{attribute:"start-label",string:"start"},endLabel:{attribute:"end-label",string:"end"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_startText:{state:!0},_endText:{state:!0},_focus:{state:!0},_draftStart:{state:!0},_draftEnd:{state:!0},_hover:{state:!0},_view:{state:!0},_draftPreset:{state:!0}},Zi.styles=[E,Pe,Pa,kp,w`
|
|
1017
1017
|
:host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
1018
1018
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
1019
1019
|
input { flex: 0 1 6.6em; }
|
|
@@ -1122,33 +1122,33 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1122
1122
|
.r-presets { flex: none; }
|
|
1123
1123
|
.r-months { flex-basis: min(312px, 40vh); }
|
|
1124
1124
|
}
|
|
1125
|
-
`];$("cm-date-range-picker",
|
|
1125
|
+
`];$("cm-date-range-picker",Zi);var SE=z("timePicker",{showTimes:"Show times",times:"Times",timesFor:"Times for {label}",patternHour:"hh",patternMinute:"mm",badInput:"Enter a time like {pattern}.",required:"Enter or choose a time.",rangeUnderflow:"Choose {time} or later.",rangeOverflow:"Choose {time} or earlier.",stepMismatch:{one:"Choose a time on the minute.",other:"Choose a time in steps of {count} minutes."}}),sn,De,ss,$t,an,nn,yi,F,Tv,tr,tn,Cv,dg,rn,Fp,zv,hg,Sv,Vp,jp,pg,Up,Kp,Wp,vc,ir=class extends C{constructor(){super(...arguments);m(this,F);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.min="";this.max="";this.step=1;this.hourCycle="";m(this,sn,"");this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._text="";this._active=-1;m(this,De,this.attachInternals());m(this,ss,new re(this,r(this,De)));m(this,$t,N("cm-tp"));m(this,an,null);m(this,nn,!1);m(this,yi,new xe);m(this,Up,e=>{let t=r(this,F,Fp);switch(e.key){case"ArrowDown":case"ArrowUp":{if(e.preventDefault(),!this.open){this.show();return}if(!t.length)return;let i=e.key==="ArrowDown"?1:-1;this._active=this._active<0?0:Math.min(t.length-1,Math.max(0,this._active+i));return}case"PageDown":case"PageUp":if(!this.open||!t.length)return;e.preventDefault(),this._active=Math.min(t.length-1,Math.max(0,this._active+(e.key==="PageDown"?6:-6)));return;case"Enter":this.open&&this._active>=0&&t[this._active]!==void 0?(e.preventDefault(),a(this,F,pg).call(this,t[this._active])):(this.open=!1,a(this,F,jp).call(this));return;case"Escape":this.open&&(e.preventDefault(),e.stopPropagation(),this.open=!1);return;case"Tab":this.open=!1;return;default:}});m(this,Kp,e=>{if(e.stopPropagation(),this._text=e.target.value,this.open){let t=Qr(this._text,r(this,F,tr));t&&(this._active=a(this,F,hg).call(this,t))}});m(this,Wp,()=>{this.disabled||(this.open?this.open=!1:(a(this,F,jp).call(this),this.show()),this.renderRoot.querySelector("input")?.focus())});m(this,vc,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,sn)}set locale(e){let t=r(this,sn);g(this,sn,e??""),this.requestUpdate("locale",t)}get valueAsNumber(){return ke(this.value)}connectedCallback(){super.connectedCallback(),r(this,an)===null&&g(this,an,this.value),document.addEventListener("pointerdown",r(this,vc),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,yi).close(),document.removeEventListener("pointerdown",r(this,vc),!0)}get form(){return r(this,De).form}get validity(){return r(this,De).validity}get validationMessage(){return r(this,De).validationMessage}checkValidity(){return r(this,De).checkValidity()}reportValidity(){return r(this,ss).report(()=>r(this,De).reportValidity())}formResetCallback(){this.value=r(this,an)??"",this._text=a(this,F,rn).call(this,this.value),this.open=!1,r(this,ss).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(this._active=a(this,F,hg).call(this,ke(this.value)!==null?this.value:Qr(this._text,r(this,F,tr))??a(this,F,zv).call(this)),this.open=!0)}close(){this.open=!1}willUpdate(e){e.has("value")&&!r(this,nn)?this._text=a(this,F,rn).call(this,this.value):(e.has("locale")||e.has("hourCycle"))&&ke(this.value)!==null&&(this._text=a(this,F,rn).call(this,this.value)),g(this,nn,!1)}updated(e){this.open&&!r(this,yi).active?r(this,yi).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch",gap:4}):!this.open&&r(this,yi).active?r(this,yi).close():this.open&&r(this,yi).place(),this.open&&a(this,F,Sv).call(this,e.has("open"));let t=ke(this.value);r(this,De).setFormValue(t===null?null:this.value,this.value);let i=this.renderRoot.querySelector("input")??void 0,s=ke(this.min),l=ke(this.max),d=r(this,F,tr);this.error?r(this,De).setValidity({customError:!0},this.error,i):this._text.trim()&&t===null?r(this,De).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,F,dg)}),i):this.required&&t===null?r(this,De).setValidity({valueMissing:!0},this.t("required"),i):t!==null&&s!==null&&t<s?r(this,De).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{time:d.format(s)}),i):t!==null&&l!==null&&t>l?r(this,De).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{time:d.format(l)}),i):t!==null&&t%r(this,F,tn)?r(this,De).setValidity({stepMismatch:!0},this.t("stepMismatch",{count:r(this,F,tn)}),i):r(this,De).setValidity({}),r(this,ss).sync()}render(){let e=r(this,F,tr),t=r(this,ss).message,i=[t&&`${r(this,$t)}-err`,this.helpText&&`${r(this,$t)}-help`].filter(Boolean).join(" "),s=this.getAttribute("aria-label"),l=this.label||s||"",d=this.open?r(this,F,Fp):[],p=ke(this.value),u=`${r(this,$t)}-list`;return c`<div class="field">
|
|
1126
1126
|
${this.label?c`<label class="label" for="${r(this,$t)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
1127
1127
|
<div class="wrap">
|
|
1128
1128
|
<div class="box" part="box">
|
|
1129
1129
|
<input id="${r(this,$t)}-in" part="input" type="text" autocomplete="off" spellcheck="false" inputmode="text"
|
|
1130
1130
|
role="combobox" aria-autocomplete="none" aria-expanded=${this.open?"true":"false"} aria-controls=${u}
|
|
1131
1131
|
aria-activedescendant=${this.open&&this._active>=0&&d[this._active]!==void 0?`${r(this,$t)}-o${d[this._active]}`:h}
|
|
1132
|
-
.value=${ee(this._text)} placeholder=${this.placeholder||r(this,F,
|
|
1132
|
+
.value=${ee(this._text)} placeholder=${this.placeholder||r(this,F,dg)}
|
|
1133
1133
|
aria-label=${!this.label&&s?s:h}
|
|
1134
1134
|
?required=${this.required} ?disabled=${this.disabled}
|
|
1135
1135
|
aria-invalid=${t?"true":h} aria-describedby=${i||h}
|
|
1136
|
-
@input=${r(this,
|
|
1136
|
+
@input=${r(this,Kp)} @change=${()=>a(this,F,jp).call(this)} @keydown=${r(this,Up)} />
|
|
1137
1137
|
<button type="button" class="trigger" part="trigger" tabindex="-1" ?disabled=${this.disabled}
|
|
1138
1138
|
aria-label=${this.t("showTimes")} aria-expanded=${this.open?"true":"false"} aria-controls=${u}
|
|
1139
|
-
@pointerdown=${b=>b.preventDefault()} @click=${r(this,
|
|
1139
|
+
@pointerdown=${b=>b.preventDefault()} @click=${r(this,Wp)}><cm-icon name="clock" size="16"></cm-icon></button>
|
|
1140
1140
|
</div>
|
|
1141
1141
|
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${b=>b.preventDefault()}>
|
|
1142
1142
|
<ul role="listbox" id=${u} part="listbox" aria-label=${this.t(l?"timesFor":"times",{label:l})}>
|
|
1143
|
-
${d.map((b,f)=>c`<li role="option" id="${r(this,$t)}-o${b}" data-value=${
|
|
1143
|
+
${d.map((b,f)=>c`<li role="option" id="${r(this,$t)}-o${b}" data-value=${hi(b)}
|
|
1144
1144
|
class=${f===this._active?"active":""} aria-selected=${b===p?"true":"false"}
|
|
1145
|
-
@pointerenter=${()=>{this._active=f}} @click=${()=>a(this,F,
|
|
1145
|
+
@pointerenter=${()=>{this._active=f}} @click=${()=>a(this,F,pg).call(this,b)}>${e.format(b)}</li>`)}
|
|
1146
1146
|
</ul>
|
|
1147
1147
|
</div>
|
|
1148
1148
|
</div>
|
|
1149
1149
|
${t?c`<p class="error" id="${r(this,$t)}-err" role="alert">${t}</p>`:h}
|
|
1150
1150
|
${this.helpText?c`<p class="help" id="${r(this,$t)}-help">${this.helpText}</p>`:h}
|
|
1151
|
-
</div>`}};
|
|
1151
|
+
</div>`}};sn=new WeakMap,De=new WeakMap,ss=new WeakMap,$t=new WeakMap,an=new WeakMap,nn=new WeakMap,yi=new WeakMap,F=new WeakSet,Tv=function(){return Wi(this,this.locale)},tr=function(){return Aa(r(this,F,Tv),this.hourCycle)},tn=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=720?e:1},Cv=function(){let e=Math.trunc(Number(this.interval));return e>=1&&e<=720?e:r(this,F,tn)>=5?r(this,F,tn):30},dg=function(){return xp(r(this,F,tr),{h:this.t("patternHour"),m:this.t("patternMinute")})},rn=function(e){let t=ke(e);return t===null?"":r(this,F,tr).format(t)},Fp=function(){let e=ke(this.min)??0,t=ke(this.max)??1439,i=r(this,F,Cv),s=r(this,F,tn),l=[];for(let d=Math.ceil(e/i)*i;d<=t&&l.length<1440;d+=i)d%s===0&&l.push(d);return l},zv=function(){let e=new Date;return hi(e.getHours()*60+e.getMinutes())},hg=function(e){let t=r(this,F,Fp);if(!t.length)return-1;let i=ke(e);if(i===null)return 0;let s=t.findIndex(l=>l>=i);return s===-1?t.length-1:s},Sv=function(e){let t=this.renderRoot.querySelector("[role=listbox]"),i=this.renderRoot.querySelector("[role=option].active");if(!t||!i)return;let s=i.offsetTop-t.offsetTop,l=s+i.offsetHeight;e?t.scrollTop=s-(t.clientHeight-i.offsetHeight)/2:s<t.scrollTop?t.scrollTop=s:l>t.scrollTop+t.clientHeight&&(t.scrollTop=l-t.clientHeight)},Vp=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})))},jp=function(){let e=this._text.trim(),t=e?Qr(e,r(this,F,tr)):"";if(t===null){g(this,nn,!0),a(this,F,Vp).call(this,""),this.requestUpdate();return}a(this,F,Vp).call(this,t),this._text=a(this,F,rn).call(this,t)},pg=function(e){let t=hi(e);this.open=!1,a(this,F,Vp).call(this,t),this._text=a(this,F,rn).call(this,t),this.renderRoot.querySelector("input")?.focus()},Up=new WeakMap,Kp=new WeakMap,Wp=new WeakMap,vc=new WeakMap,ir.formAssociated=!0,ir.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},ir.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},min:{},max:{},step:{type:Number},interval:{type:Number},hourCycle:{attribute:"hour-cycle"},locale:{noAccessor:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_text:{state:!0},_active:{state:!0}},ir.styles=[E,Pe,Pa,ha,w`
|
|
1152
1152
|
:host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
1153
1153
|
:host { max-width: 100%; }
|
|
1154
1154
|
.pop {
|
|
@@ -1162,56 +1162,56 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1162
1162
|
[role='option'][aria-selected='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
1163
1163
|
[role='option'][aria-selected='true'].active { background: var(--cm-action-primary-hover); }
|
|
1164
1164
|
input { font-variant-numeric: tabular-nums; }
|
|
1165
|
-
`];$("cm-time-picker",
|
|
1165
|
+
`];$("cm-time-picker",ir);var PE=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 f0(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 ct,xi,de,wi,j,yc,mg,Gp,Yp,ug,gg,fg,bg,as,Lv,Av,vg,Dv,Rv,rr=class extends C{constructor(){super(...arguments);m(this,j);this.label="";this.hint="";this.name="";this.accept="";this.multiple=!1;this.maxSize=0;this.maxFiles=0;this.required=!1;this.disabled=!1;this.error="";this.files=[];this._rejected="";this._progress=new Map;this._fileErrors=new Map;this._over=!1;m(this,ct,this.attachInternals());m(this,xi,new re(this,r(this,ct)));m(this,de,N("cm-fu"));m(this,wi,new Map)}get form(){return r(this,ct).form}get validity(){return r(this,ct).validity}get validationMessage(){return r(this,ct).validationMessage}checkValidity(){return r(this,ct).checkValidity()}reportValidity(){return r(this,xi).report(()=>r(this,ct).reportValidity())}formResetCallback(){r(this,xi).reset(),this.files=[],this._rejected="",this._progress=new Map,this._fileErrors=new Map}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,wi).values())URL.revokeObjectURL(e);r(this,wi).clear()}updated(e){if(e.has("files"))for(let[l,d]of r(this,wi))this.files.includes(l)||(URL.revokeObjectURL(d),r(this,wi).delete(l));let t=new FormData;for(let l of this.files)t.append(this.name||"file",l);r(this,ct).setFormValue(this.files.length?t:null);let i=(r(this,j,yc)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,s=this.error||this._rejected;s?r(this,ct).setValidity({customError:!0},s,i):this.required&&!this.files.length?r(this,ct).setValidity({valueMissing:!0},this.t("required"),i):r(this,ct).setValidity({}),r(this,xi).sync()}addFiles(e){let t=[...e],i=[],s=[],l=[];for(let p of t)f0(p,r(this,j,mg))?this.maxSize&&p.size>this.maxSize?(s.push(p),l.push(this.t("tooLarge",{name:p.name,size:a(this,j,Yp).call(this,this.maxSize)}))):i.push(p):(s.push(p),l.push(this.t("wrongType",{name:p.name})));let d=r(this,j,Gp)?[...this.files,...i]:i.slice(-1);!r(this,j,Gp)&&!i.length&&(d=this.files),r(this,j,Gp)&&this.maxFiles&&d.length>this.maxFiles&&(s.push(...d.slice(this.maxFiles)),l.push(this.t("tooMany",{max:this.maxFiles})),d=d.slice(0,this.maxFiles)),this._rejected=l.join(". "),s.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:s}})),d!==this.files&&(d.length!==this.files.length||d.some((p,u)=>p!==this.files[u]))&&(this.files=d,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}setProgress(e,t){let 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,j,yc))return a(this,j,Rv).call(this);let e=this.error||this._rejected||r(this,xi).message,t=!this.files.length||this.multiple,i=this.files.length>0;return c`
|
|
1166
1166
|
${this.label||this.hint&&i?c`<div class="head">
|
|
1167
1167
|
${this.label?c`<span class="label" id="${r(this,de)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1168
1168
|
${this.hint&&i?c`<span class="hint" id="${r(this,de)}-hint">${this.hint}</span>`:h}
|
|
1169
1169
|
</div>`:h}
|
|
1170
1170
|
${i?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
1171
|
-
${this.files.map(s=>a(this,j,
|
|
1172
|
-
${t?c`<li>${a(this,j,
|
|
1173
|
-
</ul>`:a(this,j,
|
|
1171
|
+
${this.files.map(s=>a(this,j,Av).call(this,s))}
|
|
1172
|
+
${t?c`<li>${a(this,j,vg).call(this,!0)}</li>`:h}
|
|
1173
|
+
</ul>`:a(this,j,vg).call(this,!1)}
|
|
1174
1174
|
${e?c`<p class="msg" id="${r(this,de)}-msg" role="alert">${e}</p>`:h}
|
|
1175
|
-
`}};ct=new WeakMap,
|
|
1176
|
-
${e.type.startsWith("image/")?c`<img src=${a(this,j,
|
|
1175
|
+
`}};ct=new WeakMap,xi=new WeakMap,de=new WeakMap,wi=new WeakMap,j=new WeakSet,yc=function(){return this.variant==="photo"},mg=function(){return this.accept||(r(this,j,yc)?"image/*":"")},Gp=function(){return this.multiple&&!r(this,j,yc)},Yp=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})})},ug=function(e){let t=r(this,wi).get(e);return t||(t=URL.createObjectURL(e),r(this,wi).set(e,t)),t},gg=function(e){return this._progress.has(e)},fg=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)},bg=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},as=function(e){this.toggleAttribute("data-over",e),this._over=e},Lv=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}`},Av=function(e){let t=a(this,j,gg).call(this,e),i=this._fileErrors.get(e)??"",s=`${r(this,de)}-e${this.files.indexOf(e)}`,l=this._progress.get(e)??0;return c`<li class="item"><div class="file ${t?"busy":""} ${i?"invalid":""}">
|
|
1176
|
+
${e.type.startsWith("image/")?c`<img src=${a(this,j,ug).call(this,e)} alt=${e.name} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${a(this,j,Yp).call(this,e.size)}</span></div>`}
|
|
1177
1177
|
${t?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
1178
1178
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(l)}><span style="inline-size:${l}%"></span></div>`:h}
|
|
1179
|
-
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>a(this,j,
|
|
1179
|
+
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>a(this,j,fg).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?s:h}
|
|
1180
1180
|
@click=${()=>this.removeFile(e)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
1181
|
-
</div>${i?c`<p class="ferr" id=${s} role="alert">${i}</p>`:h}</li>`},
|
|
1182
|
-
@dragenter=${()=>a(this,j,
|
|
1181
|
+
</div>${i?c`<p class="ferr" id=${s} role="alert">${i}</p>`:h}</li>`},vg=function(e){let t=this.error||this._rejected||r(this,xi).message,i=[this.hint&&`${r(this,de)}-hint`,t&&`${r(this,de)}-msg`].filter(Boolean).join(" ");return c`<label class="zone ${e?"tile":"row"} ${t&&!e?"invalid":""}" part="zone"
|
|
1182
|
+
@dragenter=${()=>a(this,j,as).call(this,!0)} @dragleave=${()=>a(this,j,as).call(this,!1)} @drop=${()=>a(this,j,as).call(this,!1)}>
|
|
1183
1183
|
<input type="file" id=${r(this,de)} accept=${this.accept||h} capture=${this.capture||h} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
1184
1184
|
?required=${this.required&&!this.files.length}
|
|
1185
1185
|
aria-labelledby=${[this.label&&`${r(this,de)}-l`,`${r(this,de)}-p`].filter(Boolean).join(" ")}
|
|
1186
1186
|
aria-describedby=${i||h} aria-invalid=${t?"true":h}
|
|
1187
|
-
@change=${a(this,j,
|
|
1187
|
+
@change=${a(this,j,bg)} @cancel=${s=>s.stopPropagation()} />
|
|
1188
1188
|
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${r(this,de)}-p">${this.t("addMore")}</span>`:c`<span class="ico"><cm-icon name="upload" size="20"></cm-icon></span>
|
|
1189
|
-
<span class="words"><span id="${r(this,de)}-p">${a(this,j,
|
|
1190
|
-
</label>`},
|
|
1189
|
+
<span class="words"><span id="${r(this,de)}-p">${a(this,j,Lv).call(this)}</span>${this.hint?c`<span class="hint" id="${r(this,de)}-hint">${this.hint}</span>`:h}</span>`}
|
|
1190
|
+
</label>`},Dv=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Rv=function(){let e=this.files[0],t=this.error||this._rejected||e&&this._fileErrors.get(e)||r(this,xi).message,i=!!e&&a(this,j,gg).call(this,e),s=this.label||this.t("photo"),l=[this.hint&&`${r(this,de)}-hint`,t&&`${r(this,de)}-msg`].filter(Boolean).join(" "),d=u=>c`<input type="file" id=${r(this,de)} accept=${r(this,j,mg)} capture=${this.capture||h}
|
|
1191
1191
|
?disabled=${this.disabled} ?required=${this.required&&!e} tabindex=${u?"-1":h} aria-hidden=${u?"true":h}
|
|
1192
1192
|
?hidden=${u} aria-labelledby=${u?h:`${r(this,de)}-p`} aria-describedby=${!u&&l||h} aria-invalid=${t?"true":h}
|
|
1193
|
-
@change=${a(this,j,
|
|
1193
|
+
@change=${a(this,j,bg)} @cancel=${b=>b.stopPropagation()} />`,p=this.hint?c`<span class="hint" id="${r(this,de)}-hint">${this.hint}</span>`:h;return c`
|
|
1194
1194
|
${e?c`<div class="shot ${i?"busy":""}" part="photo">
|
|
1195
|
-
${e.type.startsWith("image/")?c`<img src=${a(this,j,
|
|
1195
|
+
${e.type.startsWith("image/")?c`<img src=${a(this,j,ug).call(this,e)} alt=${s} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${a(this,j,Yp).call(this,e.size)}</span></div>`}
|
|
1196
1196
|
${i?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
1197
1197
|
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}
|
|
1198
1198
|
</div>
|
|
1199
1199
|
<p class="caption" aria-hidden="true">${this.label}</p>
|
|
1200
1200
|
${d(!0)}
|
|
1201
1201
|
${this.disabled?h:i?c`<div class="actions" part="actions">
|
|
1202
|
-
<button type="button" class="action" aria-label=${this.t("cancel",{name:s})} @click=${()=>a(this,j,
|
|
1202
|
+
<button type="button" class="action" aria-label=${this.t("cancel",{name:s})} @click=${()=>a(this,j,fg).call(this,e)}><cm-icon name="close" size="16"></cm-icon>${this.t("cancelShort")}</button>
|
|
1203
1203
|
</div>`:c`<div class="actions" part="actions">
|
|
1204
|
-
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:s})} aria-describedby=${t?`${r(this,de)}-msg`:h} @click=${a(this,j,
|
|
1204
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:s})} aria-describedby=${t?`${r(this,de)}-msg`:h} @click=${a(this,j,Dv)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
1205
1205
|
<button type="button" class="action" aria-label=${this.t("removeName",{name:s})} @click=${()=>this.removeFile(e)}><cm-icon name="trash" size="16"></cm-icon>${this.t("removePhoto")}</button>
|
|
1206
1206
|
</div>`}`:c`<label class="zone photo ${t?"invalid":""}" part="zone photo"
|
|
1207
|
-
@dragenter=${()=>a(this,j,
|
|
1207
|
+
@dragenter=${()=>a(this,j,as).call(this,!0)} @dragleave=${()=>a(this,j,as).call(this,!1)} @drop=${()=>a(this,j,as).call(this,!1)}>
|
|
1208
1208
|
${d(!1)}
|
|
1209
1209
|
<cm-icon name="camera" size="24"></cm-icon>
|
|
1210
1210
|
<span class="photo-label" id="${r(this,de)}-p" part="label">${this.label||this.t("takePhoto")}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
1211
1211
|
${p}
|
|
1212
1212
|
</label>`}
|
|
1213
1213
|
${t?c`<p class="msg" id="${r(this,de)}-msg" role="alert">${t}</p>`:h}
|
|
1214
|
-
`},
|
|
1214
|
+
`},rr.formAssociated=!0,rr.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},rr.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}},rr.styles=[E,w`
|
|
1215
1215
|
:host { display: block; }
|
|
1216
1216
|
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-8); margin-bottom: var(--cm-space-12); }
|
|
1217
1217
|
.label { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1295,75 +1295,75 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1295
1295
|
@media (max-width: 640px) {
|
|
1296
1296
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
1297
1297
|
}
|
|
1298
|
-
`];$("cm-file-upload",
|
|
1298
|
+
`];$("cm-file-upload",rr);var $i=(o,n,e)=>Math.min(e,Math.max(n,o)),ns=(o,n=0)=>{let e=10**n;return Math.round(o*e)/e};function ls(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}function Xp(o,n){let e=/^(-?\d*\.?\d+(?:e-?\d+)?)(%)?$/i.exec(o.trim());if(!e)return null;let t=parseFloat(e[1]);return e[2]?t/100*n:t}function Nv(o){let n=/^(-?\d*\.?\d+)(deg|turn|rad|grad)?$/i.exec(o.trim());if(!n)return null;let e=parseFloat(n[1]),t=(n[2]??"deg").toLowerCase();return((t==="turn"?e*360:t==="rad"?e*180/Math.PI:t==="grad"?e*.9:e)%360+360)%360}function b0(o){let n=o.trim(),e;if(n.includes(","))e=n.split(",").map(t=>t.trim());else{let[t,i]=n.split("/").map(s=>s.trim());e=t.split(/\s+/),i!==void 0&&e.push(i)}return e.length===3||e.length===4?e:null}function Ie(o){let n=(o??"").trim().toLowerCase();if(!n)return null;if(n==="transparent")return{r:0,g:0,b:0,a:0};let e=/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(n);if(e){let u=e[1];u.length<=4&&(u=[...u].map(f=>f+f).join(""));let b=f=>parseInt(u.slice(f,f+2),16);return{r:b(0),g:b(2),b:b(4),a:u.length===8?ns(b(6)/255,3):1}}let t=/^(rgba?|hsla?)\((.*)\)$/.exec(n);if(!t)return null;let i=b0(t[2]);if(!i)return null;let s=i[3]===void 0?1:Xp(i[3],1);if(s===null)return null;if(t[1].startsWith("rgb")){let[u,b,f]=i.slice(0,3).map(x=>Xp(x,255));return u===null||b===null||f===null?null:{r:$i(Math.round(u),0,255),g:$i(Math.round(b),0,255),b:$i(Math.round(f),0,255),a:$i(ns(s,3),0,1)}}let l=Nv(i[0]),d=Xp(i[1].endsWith("%")?i[1]:`${i[1]}%`,100),p=Xp(i[2].endsWith("%")?i[2]:`${i[2]}%`,100);return l===null||d===null||p===null?null:{...$c({h:l,s:$i(d,0,100),l:$i(p,0,100),a:1}),a:$i(ns(s,3),0,1)}}function Qp({r:o,g:n,b:e,a:t}){let i=o/255,s=n/255,l=e/255,d=Math.max(i,s,l),p=Math.min(i,s,l),u=d-p,b=0;return u&&(b=d===i?(s-l)/u%6:d===s?(l-i)/u+2:(i-s)/u+4),{h:(b*60+360)%360,s:d?u/d*100:0,v:d*100,a:t}}function Zp({h:o,s:n,v:e,a:t}){let i=n/100,s=e/100,l=d=>{let p=(d+o/60)%6;return s-s*i*Math.max(0,Math.min(p,4-p,1))};return{r:Math.round(l(5)*255),g:Math.round(l(3)*255),b:Math.round(l(1)*255),a:t}}function wc({r:o,g:n,b:e,a:t}){let i=o/255,s=n/255,l=e/255,d=Math.max(i,s,l),p=Math.min(i,s,l),u=d-p,b=(d+p)/2,f=u?u/(1-Math.abs(2*b-1)):0;return{h:Qp({r:o,g:n,b:e,a:t}).h,s:f*100,l:b*100,a:t}}function $c({h:o,s:n,l:e,a:t}){let i=n/100,s=e/100,l=u=>(u+o/30)%12,d=i*Math.min(s,1-s),p=u=>s-d*Math.max(-1,Math.min(l(u)-3,9-l(u),1));return{r:Math.round(p(0)*255),g:Math.round(p(8)*255),b:Math.round(p(4)*255),a:t}}var Jp=o=>Math.round(o).toString(16).padStart(2,"0"),xc=({r:o,g:n,b:e})=>`#${Jp(o)}${Jp(n)}${Jp(e)}`;function cs(o,n="hex"){let e=ns($i(o.a,0,1),2),t=e<1;if(n==="rgb")return t?`rgba(${o.r}, ${o.g}, ${o.b}, ${e})`:`rgb(${o.r}, ${o.g}, ${o.b})`;if(n==="hsl"){let{h:i,s,l}=wc(o),d=`${Math.round(i)}, ${Math.round(s)}%, ${Math.round(l)}%`;return t?`hsla(${d}, ${e})`:`hsl(${d})`}return t?`${xc(o)}${Jp(e*255)}`:xc(o)}function v0(o){let n=[],e=0,t=0;for(let i=0;i<o.length;i++)o[i]==="("?e++:o[i]===")"?e--:o[i]===","&&e===0&&(n.push(o.slice(t,i).trim()),t=i+1);return n.push(o.slice(t).trim()),n}var Hv={"to top":0,"to top right":45,"to right top":45,"to right":90,"to bottom right":135,"to right bottom":135,"to bottom":180,"to bottom left":225,"to left bottom":225,"to left":270,"to top left":315,"to left top":315};function Ht(o){let n=/^(linear|radial)-gradient\((.*)\)$/i.exec((o??"").trim());if(!n)return null;let e=n[1].toLowerCase(),t=v0(n[2]),i=180,s=t[0]?.toLowerCase().replace(/\s+/g," ")??"";if(e==="linear"){let p=Nv(s);p!==null&&/[a-z]/.test(s)?(i=p,t.shift()):s in Hv&&(i=Hv[s],t.shift())}else/^(circle|ellipse|closest|farthest|at )/.test(s)&&!Ie(s.split(" ")[0])&&t.shift();let l=t.map(p=>{let u=/^(.*?)(?:\s+(-?\d*\.?\d+)%)?$/.exec(p);return{color:Ie(u[1]),position:u[2]===void 0?void 0:$i(parseFloat(u[2]),0,100)}});if(l.length<2||l.some(p=>!p.color))return null;let d=l.map((p,u)=>({color:p.color,position:p.position??ns(u/(l.length-1)*100,1)}));return{type:e,angle:Math.round(i),stops:d}}function os(o,n="hex"){let e=[...o.stops].sort((t,i)=>t.position-i.position).map(t=>`${cs(t.color,n)} ${ns(t.position,1)}%`).join(", ");return o.type==="radial"?`radial-gradient(circle, ${e})`:`linear-gradient(${Math.round(o.angle)}deg, ${e})`}function Pv(o,n){let e=[...o.stops].sort((t,i)=>t.position-i.position);if(n<=e[0].position)return{...e[0].color};for(let t=1;t<e.length;t++)if(n<=e[t].position){let i=e[t-1],s=e[t],l=(n-i.position)/(s.position-i.position||1),d=(p,u)=>p+(u-p)*l;return{r:Math.round(d(i.color.r,s.color.r)),g:Math.round(d(i.color.g,s.color.g)),b:Math.round(d(i.color.b,s.color.b)),a:ns(d(i.color.a,s.color.a),2)}}return{...e[e.length-1].color}}function kc(o,n){let e=Ie(o),t=Ie(n);if(e&&t)return e.r===t.r&&e.g===t.g&&e.b===t.b&&Math.abs(e.a-t.a)<.005;let i=Ht(o),s=Ht(n);return!!i&&!!s&&os(i)===os(s)}var yg=o=>!!Ie(o)||!!Ht(o);var on=16;function em(o,n,e=16){let t=n.trim().toLowerCase();return[n.trim(),...o.filter(i=>i.trim().toLowerCase()!==t)].slice(0,e)}function xg(o="default",n=16){let e=`cm-recent-colors:${o}`,t=()=>{try{let i=JSON.parse(localStorage.getItem(e)??"[]");return Array.isArray(i)?i.filter(s=>typeof s=="string").slice(0,n):[]}catch{return[]}};return{recentColors:async()=>t(),async addRecentColor(i){let s=em(t(),i,n);try{localStorage.setItem(e,JSON.stringify(s))}catch{}return s}}}function y0(o){let n=o.baseUrl.replace(/\/+$/,""),e=async(t,i={})=>{let s=typeof o.headers=="function"?await o.headers():o.headers??{},l=await(o.fetch??fetch)(`${n}${t}`,{credentials:o.credentials??"same-origin",...i,headers:{Accept:"application/json",...i.body?{"Content-Type":"application/json"}:{},...s}});if(!l.ok)throw new Error(`Colour API ${t}: HTTP ${l.status}`);let d=await l.json();return Array.isArray(d?.colors)?d.colors:[]};return{brandColors:()=>e("/brand-colors"),recentColors:async()=>(await e("/recent-colors")).filter(t=>typeof t=="string"),addRecentColor:async t=>(await e("/recent-colors",{method:"POST",body:JSON.stringify({color:t})})).filter(i=>typeof i=="string")}}var GE=z("colorPicker",{label:"Colour picker",solid:"Solid",gradient:"Gradient",area:"Saturation and brightness",areaValue:"Saturation {s}%, brightness {v}%",hue:"Hue",opacity:"Opacity",format:"Colour format",hex:"Hex",rgb:"RGB",hsl:"HSL",red:"Red",green:"Green",blue:"Blue",saturation:"Saturation",lightness:"Lightness",eyedropper:"Pick a colour from the screen",gradientType:"Gradient type",linear:"Linear",radial:"Radial",angle:"Angle",stops:"Gradient stops",stop:"Stop {n}, {color} at {position}%",addStop:"Add stop",removeStop:"Remove stop",brand:"Brand colours",recent:"Recent",palette:"Palette",swatch:"{name}, {value}"}),Iv=["#000000","#707070","#c9c9c9","#de0000","#ad5500","#f1a953","#ffc107","#81bb47","#3c7c00","#5394d9","#2e6faf","#446beb"].map(o=>({value:o})),x0=["hex","rgb","hsl"],wg=o=>(o??[]).flatMap(n=>{let e=typeof n=="string"?{value:n}:n;return e&&typeof e.value=="string"&&(Ie(e.value)||Ht(e.value))?[{value:e.value.trim(),name:e.name}]:[]}),sm,Tc,dn,Cc,ki,T,$g,kg,qv,sr,ds,dt,Eg,Mg,_g,Ov,Bv,Ec,Fv,Tg,Cg,Vv,tm,zg,jv,Mc,im,_c,Sg,Uv,Kv,Wv,ln,Lg,Gv,Yv,rm,Xv,cn=class extends C{constructor(){super(...arguments);m(this,T);this.value="";this.format="hex";this.formats="hex rgb hsl";this.alpha=!1;this.gradient=!1;this.recentKey="";this.maxRecent=16;this.eyedropper=!0;this.disabled=!1;this._hsva={h:0,s:0,v:0,a:1};this._grad=null;this._stop=0;this._brand=[];this._recent=[];this._drafts={};m(this,sm,N("cm-cp"));m(this,Tc);m(this,dn);m(this,Cc);m(this,ki,null)}connectedCallback(){super.connectedCallback(),a(this,T,kg).call(this)}get allowedFormats(){let e=String(this.formats??"").split(/[\s,]+/).filter(t=>x0.includes(t));return e.length?e:["hex"]}get palette(){return this.swatches?wg(this.swatches):Iv}get brand(){return this.brandColors?wg(this.brandColors):this._brand}get recent(){return(this.recentColors??this._recent).filter(t=>Ie(t)||this.gradient&&Ht(t)).filter(t=>this.alpha||(Ie(t)?.a??1)===1).slice(0,this.maxRecent||16)}willUpdate(e){e.has("recentKey")&&g(this,Cc,void 0),(e.has("source")||e.has("recentKey"))&&a(this,T,kg).call(this),e.has("format")&&!this.allowedFormats.includes(this.format)&&(this.format=this.allowedFormats[0]),e.has("value")&&this.value!==r(this,Tc)&&a(this,T,qv).call(this)}render(){let{h:e,s:t,v:i,a:s}=this._hsva,l=r(this,T,ds),d=xc(l),p=this.allowedFormats,u=this._grad,b=this.matches(":dir(rtl)"),f=this.eyedropper&&typeof window<"u"&&"EyeDropper"in window,x=u?os({...u,type:"linear",angle:b?270:90}):"";return c`<div class="panel" role="group" aria-label=${this.getAttribute("aria-label")||this.t("label")}>
|
|
1299
1299
|
${this.gradient?c`<div class="tabs" role="radiogroup" aria-label=${this.t("label")}>
|
|
1300
|
-
<button type="button" role="radio" aria-checked=${u?"false":"true"} tabindex=${u?"-1":"0"} @click=${()=>a(this,T,
|
|
1301
|
-
@keydown=${v=>{v.key.startsWith("Arrow")&&(v.preventDefault(),a(this,T,
|
|
1302
|
-
<button type="button" role="radio" aria-checked=${u?"true":"false"} tabindex=${u?"0":"-1"} @click=${()=>a(this,T,
|
|
1303
|
-
@keydown=${v=>{v.key.startsWith("Arrow")&&(v.preventDefault(),a(this,T,
|
|
1300
|
+
<button type="button" role="radio" aria-checked=${u?"false":"true"} tabindex=${u?"-1":"0"} @click=${()=>a(this,T,Mc).call(this,!1)}
|
|
1301
|
+
@keydown=${v=>{v.key.startsWith("Arrow")&&(v.preventDefault(),a(this,T,Mc).call(this,!0),this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".tabs button")[1]?.focus()))}}>${this.t("solid")}</button>
|
|
1302
|
+
<button type="button" role="radio" aria-checked=${u?"true":"false"} tabindex=${u?"0":"-1"} @click=${()=>a(this,T,Mc).call(this,!0)}
|
|
1303
|
+
@keydown=${v=>{v.key.startsWith("Arrow")&&(v.preventDefault(),a(this,T,Mc).call(this,!1),this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".tabs button")[0]?.focus()))}}>${this.t("gradient")}</button>
|
|
1304
1304
|
</div>`:h}
|
|
1305
1305
|
${u?c`<div class="row">
|
|
1306
|
-
<select aria-label=${this.t("gradientType")} @change=${v=>{v.stopPropagation(),a(this,T,
|
|
1306
|
+
<select aria-label=${this.t("gradientType")} @change=${v=>{v.stopPropagation(),a(this,T,im).call(this,{type:v.target.value})}}>
|
|
1307
1307
|
<option value="linear" .selected=${ee(u.type==="linear")}>${this.t("linear")}</option><option value="radial" .selected=${ee(u.type==="radial")}>${this.t("radial")}</option>
|
|
1308
1308
|
</select>
|
|
1309
1309
|
${u.type==="linear"?c`<input class="box num" type="text" inputmode="numeric" aria-label=${this.t("angle")} .value=${ee(this._drafts.angle??`${u.angle}\xB0`)}
|
|
1310
1310
|
@input=${v=>{v.stopPropagation(),this._drafts={...this._drafts,angle:v.target.value}}}
|
|
1311
|
-
@change=${v=>{v.stopPropagation();let k=parseFloat(v.target.value);this._drafts={},Number.isFinite(k)&&a(this,T,
|
|
1311
|
+
@change=${v=>{v.stopPropagation();let k=parseFloat(v.target.value);this._drafts={},Number.isFinite(k)&&a(this,T,im).call(this,{angle:(Math.round(k)%360+360)%360})}} />`:h}
|
|
1312
1312
|
<button type="button" class="icon-btn" aria-label=${this.t("removeStop")} title=${this.t("removeStop")} ?disabled=${u.stops.length<=2}
|
|
1313
|
-
@click=${()=>a(this,T,
|
|
1313
|
+
@click=${()=>a(this,T,Lg).call(this,this._stop)}><cm-icon name="trash" size="16"></cm-icon></button>
|
|
1314
1314
|
</div>
|
|
1315
|
-
<div class="bar checker" role="group" aria-label=${this.t("stops")} @pointerdown=${a(this,T,
|
|
1315
|
+
<div class="bar checker" role="group" aria-label=${this.t("stops")} @pointerdown=${a(this,T,Uv)}>
|
|
1316
1316
|
<span class="fill" style="background:${x}"></span>
|
|
1317
1317
|
${u.stops.map((v,k)=>c`<button type="button" class="handle" role="slider" aria-orientation="horizontal"
|
|
1318
1318
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(v.position)}
|
|
1319
|
-
aria-label=${this.t("stop",{n:k+1,color:
|
|
1320
|
-
aria-current=${k===this._stop?"true":"false"} style="inset-inline-start:${v.position}%;background:${
|
|
1321
|
-
@pointerdown=${L=>a(this,T,
|
|
1322
|
-
@pointerup=${a(this,T
|
|
1323
|
-
@keydown=${L=>a(this,T,
|
|
1319
|
+
aria-label=${this.t("stop",{n:k+1,color:cs(v.color,this.format),position:Math.round(v.position)})}
|
|
1320
|
+
aria-current=${k===this._stop?"true":"false"} style="inset-inline-start:${v.position}%;background:${cs(v.color)}"
|
|
1321
|
+
@pointerdown=${L=>a(this,T,Kv).call(this,L,k)} @pointermove=${L=>a(this,T,Wv).call(this,L,k)}
|
|
1322
|
+
@pointerup=${a(this,T,Ec)} @pointercancel=${a(this,T,Ec)} @focus=${()=>{this._stop!==k&&a(this,T,_c).call(this,k)}}
|
|
1323
|
+
@keydown=${L=>a(this,T,Gv).call(this,L,k)}></button>`)}
|
|
1324
1324
|
</div>`:h}
|
|
1325
1325
|
<div class="area" part="area" tabindex="0" role="slider" aria-label=${this.t("area")}
|
|
1326
1326
|
aria-valuetext=${this.t("areaValue",{s:Math.round(t),v:Math.round(i)})} aria-valuenow=${Math.round(t)} aria-valuemin="0" aria-valuemax="100"
|
|
1327
1327
|
style="background-color:hsl(${e} 100% 50%)"
|
|
1328
|
-
@pointerdown=${a(this,T,
|
|
1328
|
+
@pointerdown=${a(this,T,Ov)} @pointermove=${a(this,T,Bv)} @pointerup=${a(this,T,Ec)} @pointercancel=${a(this,T,Ec)} @keydown=${a(this,T,Fv)}>
|
|
1329
1329
|
<span class="thumb" style="left:${b?100-t:t}%;top:${100-i}%;background:${d}"></span>
|
|
1330
1330
|
</div>
|
|
1331
1331
|
<div class="sliders">
|
|
1332
|
-
<span class="preview checker" aria-hidden="true"><span style="background:${u?
|
|
1332
|
+
<span class="preview checker" aria-hidden="true"><span style="background:${u?os(u):cs(l)}"></span></span>
|
|
1333
1333
|
<div class="stack">
|
|
1334
1334
|
<input type="range" class="hue" min="0" max="360" step="1" .value=${ee(String(Math.round(e)))} aria-label=${this.t("hue")}
|
|
1335
|
-
@input=${v=>a(this,T,
|
|
1335
|
+
@input=${v=>a(this,T,Tg).call(this,v,!1)} @change=${v=>a(this,T,Tg).call(this,v,!0)} />
|
|
1336
1336
|
${this.alpha?c`<div class="alpha-wrap checker"><input type="range" min="0" max="100" step="1" .value=${ee(String(Math.round(s*100)))}
|
|
1337
1337
|
aria-label=${this.t("opacity")} aria-valuetext="${Math.round(s*100)}%"
|
|
1338
1338
|
style="--track:linear-gradient(to ${b?"left":"right"}, transparent, ${d})"
|
|
1339
|
-
@input=${v=>a(this,T,
|
|
1339
|
+
@input=${v=>a(this,T,Cg).call(this,v,!1)} @change=${v=>a(this,T,Cg).call(this,v,!0)} /></div>`:h}
|
|
1340
1340
|
</div>
|
|
1341
1341
|
</div>
|
|
1342
1342
|
<div class="row">
|
|
1343
|
-
${p.length>1?c`<select aria-label=${this.t("format")} @change=${a(this,T,
|
|
1343
|
+
${p.length>1?c`<select aria-label=${this.t("format")} @change=${a(this,T,Vv)}>
|
|
1344
1344
|
${p.map(v=>c`<option value=${v} ?selected=${v===this.format} .selected=${ee(v===this.format)}>${this.t(v)}</option>`)}
|
|
1345
1345
|
</select>`:h}
|
|
1346
|
-
${a(this,T,
|
|
1347
|
-
${f?c`<button type="button" class="icon-btn" aria-label=${this.t("eyedropper")} title=${this.t("eyedropper")} @click=${a(this,T,
|
|
1346
|
+
${a(this,T,Xv).call(this)}
|
|
1347
|
+
${f?c`<button type="button" class="icon-btn" aria-label=${this.t("eyedropper")} title=${this.t("eyedropper")} @click=${a(this,T,jv)}>
|
|
1348
1348
|
<cm-icon name="eyedropper" size="16"></cm-icon></button>`:h}
|
|
1349
1349
|
</div>
|
|
1350
|
-
${a(this,T,
|
|
1351
|
-
${a(this,T,
|
|
1352
|
-
${a(this,T,
|
|
1353
|
-
</div>`}};
|
|
1350
|
+
${a(this,T,rm).call(this,"brand",this.brand)}
|
|
1351
|
+
${a(this,T,rm).call(this,"recent",this.recent.map(v=>({value:v})))}
|
|
1352
|
+
${a(this,T,rm).call(this,"palette",this.palette)}
|
|
1353
|
+
</div>`}};sm=new WeakMap,Tc=new WeakMap,dn=new WeakMap,Cc=new WeakMap,ki=new WeakMap,T=new WeakSet,$g=function(){if(this.source)return this.source;if(this.recentKey)return r(this,Cc)??g(this,Cc,xg(this.recentKey))},kg=async function(){let e=a(this,T,$g).call(this);if(!e||e===r(this,dn))return;g(this,dn,e);let[t,i]=await Promise.allSettled([e.brandColors?.()??Promise.resolve([]),e.recentColors?.()??Promise.resolve([])]);r(this,dn)===e&&(t.status==="fulfilled"&&Array.isArray(t.value)&&(this._brand=wg(t.value)),i.status==="fulfilled"&&Array.isArray(i.value)&&(this._recent=i.value.filter(s=>typeof s=="string")))},qv=function(){let e=(this.value??"").trim(),t=this.gradient?Ht(e):null;if(t)this._grad=t,this._stop=Math.min(this._stop,t.stops.length-1),a(this,T,sr).call(this,t.stops[this._stop].color);else{this._grad=null;let i=Ie(e);i&&a(this,T,sr).call(this,i)}/^rgba?\(/i.test(e)&&this.allowedFormats.includes("rgb")?this.format="rgb":/^hsla?\(/i.test(e)&&this.allowedFormats.includes("hsl")&&(this.format="hsl"),this._drafts={}},sr=function(e){let t=Qp(e);(t.s===0||t.v===0)&&(t.h=this._hsva.h),t.v===0&&(t.s=this._hsva.s),this._hsva={...t,a:this.alpha?e.a:1}},ds=function(){return Zp(this._hsva)},dt=function(e=!1){let t;if(this._grad){let s=this._grad.stops.map((l,d)=>d===this._stop?{...l,color:r(this,T,ds)}:l);this._grad={...this._grad,stops:s},t=os(this._grad,this.format)}else t=cs(r(this,T,ds),this.format);let i=t!==this.value;g(this,Tc,t),this.value=t,i&&a(this,T,Eg).call(this,"input"),e&&a(this,T,Mg).call(this)},Eg=function(e){this.dispatchEvent(new Event(e,{bubbles:!0,composed:!0}))},Mg=function(){a(this,T,Eg).call(this,"change");let e=this.value;if(!e||[...this.brand,...this.palette].some(l=>kc(l.value,e)))return;let t=this.recentColors??this._recent;if(t[0]&&kc(t[0],e))return;let i=em(t,e,Math.max(this.maxRecent||16,16));this._recent=i,this.dispatchEvent(new CustomEvent("cm-recent-change",{detail:{colors:i},bubbles:!0,composed:!0})),a(this,T,$g).call(this)?.addRecentColor?.(e)?.then(l=>{Array.isArray(l)&&(this._recent=l)}).catch(()=>{})},_g=function(e){let t=e.currentTarget.getBoundingClientRect(),i=Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),s=Math.min(1,Math.max(0,(e.clientY-t.top)/t.height)),l=getComputedStyle(this).direction==="rtl";this._hsva={...this._hsva,s:(l?1-i:i)*100,v:(1-s)*100},a(this,T,dt).call(this)},Ov=function(e){if(e.button!==0)return;let t=e.currentTarget;try{t.setPointerCapture(e.pointerId)}catch{}t.focus(),g(this,ki,"area"),a(this,T,_g).call(this,e)},Bv=function(e){r(this,ki)==="area"&&a(this,T,_g).call(this,e)},Ec=function(){r(this,ki)!==null&&(g(this,ki,null),a(this,T,Mg).call(this))},Fv=function(e){let t=e.shiftKey?10:1,i=getComputedStyle(this).direction==="rtl",{s,v:l}=this._hsva;if(e.key==="ArrowRight")s+=i?-t:t;else if(e.key==="ArrowLeft")s+=i?t:-t;else if(e.key==="ArrowUp")l+=t;else if(e.key==="ArrowDown")l-=t;else if(e.key==="Home")s=0;else if(e.key==="End")s=100;else if(e.key==="PageUp")l=100;else if(e.key==="PageDown")l=0;else return;e.preventDefault(),this._hsva={...this._hsva,s:Math.min(100,Math.max(0,s)),v:Math.min(100,Math.max(0,l))},a(this,T,dt).call(this,!0)},Tg=function(e,t){e.stopPropagation(),this._hsva={...this._hsva,h:Number(e.target.value)},a(this,T,dt).call(this,t)},Cg=function(e,t){e.stopPropagation(),this._hsva={...this._hsva,a:Number(e.target.value)/100},a(this,T,dt).call(this,t)},Vv=function(e){e.stopPropagation(),this.format=e.target.value,this._drafts={},this.value&&a(this,T,dt).call(this,!0)},tm=function(e,t,i){e.stopPropagation();let s=e.target.value,l=a(this,T,zg).call(this,t,s);if(!l){this._drafts={...this._drafts,[t]:s};return}this._drafts=i?{}:{...this._drafts,[t]:s},a(this,T,sr).call(this,l),a(this,T,dt).call(this,i)},zg=function(e,t){let i=r(this,T,ds);if(e==="hex"){let d=t.trim();if(!/^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(d))return null;let p=Ie(d);return p&&(this.alpha&&/^#?[0-9a-f]{8}$/i.test(d)?p:{...p,a:this._hsva.a})}let s=Number(t);if(t.trim()===""||!Number.isFinite(s))return null;if(e==="a")return s>=0&&s<=100?{...i,a:s/100}:null;if(e==="r"||e==="g"||e==="b")return s>=0&&s<=255?{...i,[e]:Math.round(s)}:null;let l=wc(i);return e==="h"?s>=0&&s<=360?$c({...l,h:s%360,a:i.a}):null:(e==="s"||e==="l")&&s>=0&&s<=100?$c({...l,[e]:s,a:i.a}):null},jv=async function(){let e=window.EyeDropper;if(e)try{let{sRGBHex:t}=await new e().open(),i=Ie(t);if(!i)return;a(this,T,sr).call(this,{...i,a:this._hsva.a}),a(this,T,dt).call(this,!0)}catch{}},Mc=function(e){if(e!==!!this._grad){if(e){let t=r(this,T,ds),i=Zp({...this._hsva,h:(this._hsva.h+60)%360,s:Math.max(this._hsva.s,40),v:Math.max(this._hsva.v,60)});this._grad={type:"linear",angle:90,stops:[{color:t,position:0},{color:i,position:100}]},this._stop=0}else this._grad=null;a(this,T,dt).call(this,!0)}},im=function(e,t=!0){this._grad&&(this._grad={...this._grad,...e},a(this,T,dt).call(this,t))},_c=function(e){this._grad&&(this._stop=e,a(this,T,sr).call(this,this._grad.stops[e].color),this._drafts={})},Sg=function(e,t){let i=t.getBoundingClientRect(),s=Math.min(1,Math.max(0,(e.clientX-i.left)/i.width));return Math.round((getComputedStyle(this).direction==="rtl"?1-s:s)*100)},Uv=function(e){if(!this._grad||e.button!==0||e.target.closest(".handle"))return;let t=a(this,T,Sg).call(this,e,e.currentTarget),i=Pv(this._grad,t),s=[...this._grad.stops,{color:i,position:t}];this._grad={...this._grad,stops:s},a(this,T,_c).call(this,s.length-1),a(this,T,dt).call(this,!0),this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".handle")[s.length-1]?.focus())},Kv=function(e,t){if(e.button===0){e.stopPropagation();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}a(this,T,_c).call(this,t),g(this,ki,t)}},Wv=function(e,t){if(r(this,ki)!==t||!this._grad)return;let i=this.renderRoot.querySelector(".bar");a(this,T,ln).call(this,t,a(this,T,Sg).call(this,e,i),!1)},ln=function(e,t,i){if(!this._grad)return;let s=this._grad.stops.map((l,d)=>d===e?{...l,position:Math.min(100,Math.max(0,t))}:l);a(this,T,im).call(this,{stops:s},i)},Lg=function(e){if(!this._grad||this._grad.stops.length<=2)return;let t=this._grad.stops.filter((i,s)=>s!==e);this._grad={...this._grad,stops:t},a(this,T,_c).call(this,Math.min(e,t.length-1)),a(this,T,dt).call(this,!0),this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".handle")[this._stop]?.focus())},Gv=function(e,t){if(!this._grad)return;let i=e.shiftKey?10:1,s=getComputedStyle(this).direction==="rtl",l=this._grad.stops[t].position;if(e.key==="ArrowRight"||e.key==="ArrowUp")a(this,T,ln).call(this,t,l+(s&&e.key==="ArrowRight"?-i:i),!0);else if(e.key==="ArrowLeft"||e.key==="ArrowDown")a(this,T,ln).call(this,t,l-(s&&e.key==="ArrowLeft"?-i:i),!0);else if(e.key==="Home")a(this,T,ln).call(this,t,0,!0);else if(e.key==="End")a(this,T,ln).call(this,t,100,!0);else if(e.key==="Delete"||e.key==="Backspace")a(this,T,Lg).call(this,t);else return;e.preventDefault()},Yv=function(e){let t=Ht(e);if(t&&this.gradient)this._grad=t,this._stop=0,a(this,T,sr).call(this,t.stops[0].color);else{let i=Ie(e);if(!i)return;this._grad=null,a(this,T,sr).call(this,i)}this._drafts={},a(this,T,dt).call(this,!0)},rm=function(e,t){if(!t.length)return h;let i=`${r(this,sm)}-${e}`;return c`<div class="group" role="group" aria-labelledby=${i}>
|
|
1354
1354
|
<h3 id=${i}>${this.t(e)}</h3>
|
|
1355
|
-
<div class="sws">${t.map(s=>{let l=s.name?this.t("swatch",{name:s.name,value:s.value}):s.value,d=!!this.value&&
|
|
1356
|
-
@click=${()=>a(this,T,
|
|
1357
|
-
</div>`},
|
|
1355
|
+
<div class="sws">${t.map(s=>{let l=s.name?this.t("swatch",{name:s.name,value:s.value}):s.value,d=!!this.value&&kc(s.value,this.value);return c`<button type="button" class="sw checker" part="swatch" aria-pressed=${d?"true":"false"} aria-label=${l} title=${s.name||s.value}
|
|
1356
|
+
@click=${()=>a(this,T,Yv).call(this,s.value)}><span style="background:${s.value}"></span></button>`})}</div>
|
|
1357
|
+
</div>`},Xv=function(){let e=r(this,T,ds),t=this._drafts,i=this.format,s=(d,p,u,b=!0)=>c`<input class="box ${b?"num":""}"
|
|
1358
1358
|
type="text" inputmode=${b?"numeric":"text"} autocomplete="off" spellcheck="false" aria-label=${p}
|
|
1359
|
-
.value=${ee(t[d]??String(u))} aria-invalid=${t[d]!==void 0&&!a(this,T,
|
|
1360
|
-
@input=${f=>a(this,T,
|
|
1361
|
-
@keydown=${f=>{f.key==="Enter"&&a(this,T,
|
|
1362
|
-
${i==="hex"?s("hex",this.t("hex"),
|
|
1359
|
+
.value=${ee(t[d]??String(u))} aria-invalid=${t[d]!==void 0&&!a(this,T,zg).call(this,d,t[d])?"true":h}
|
|
1360
|
+
@input=${f=>a(this,T,tm).call(this,f,d,!1)} @change=${f=>a(this,T,tm).call(this,f,d,!0)}
|
|
1361
|
+
@keydown=${f=>{f.key==="Enter"&&a(this,T,tm).call(this,f,d,!0)}} />`,l=wc(e);return c`<div class="boxes">
|
|
1362
|
+
${i==="hex"?s("hex",this.t("hex"),xc(e),!1):h}
|
|
1363
1363
|
${i==="rgb"?[s("r",this.t("red"),e.r),s("g",this.t("green"),e.g),s("b",this.t("blue"),e.b)]:h}
|
|
1364
1364
|
${i==="hsl"?[s("h",this.t("hue"),Math.round(l.h)),s("s",this.t("saturation"),Math.round(l.s)),s("l",this.t("lightness"),Math.round(l.l))]:h}
|
|
1365
1365
|
${this.alpha?s("a",this.t("opacity"),Math.round(this._hsva.a*100)):h}
|
|
1366
|
-
</div>`},
|
|
1366
|
+
</div>`},cn.properties={value:{},format:{reflect:!0},formats:{},alpha:{type:Boolean},gradient:{type:Boolean},swatches:{type:Array},brandColors:{type:Array,attribute:"brand-colors"},recentColors:{type:Array,attribute:"recent-colors"},source:{attribute:!1},recentKey:{attribute:"recent-key"},maxRecent:{type:Number,attribute:"max-recent"},eyedropper:{type:Boolean},disabled:{type:Boolean,reflect:!0},_hsva:{state:!0},_grad:{state:!0},_stop:{state:!0},_brand:{state:!0},_recent:{state:!0},_drafts:{state:!0}},cn.styles=[E,w`
|
|
1367
1367
|
:host { display: block; inline-size: 272px; max-inline-size: 100%; color: var(--cm-text-default); font-size: var(--cm-font-size-13); }
|
|
1368
1368
|
:host([disabled]) { opacity: 0.5; pointer-events: none; }
|
|
1369
1369
|
.panel { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
@@ -1443,15 +1443,15 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1443
1443
|
.sw[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--cm-bg-surface), 0 0 0 4px var(--cm-border-strong); }
|
|
1444
1444
|
.sw:focus-visible { outline-offset: 4px; }
|
|
1445
1445
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1446
|
-
`];$("cm-color-picker",
|
|
1446
|
+
`];$("cm-color-picker",cn);var aM=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.",invalidAny:"Enter a colour such as #2e6faf or rgb(46, 111, 175).",value:"Colour value",valueNamed:"{label}, colour value",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"}),w0=[{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"}],$0={fromAttribute:o=>o===null?!1:o==="native"?"native":!0,toAttribute:o=>o==="native"?"native":o?"":null},k0=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 E0(o){let n=k0(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var tt,ps,ms,kt,zc,us,V,hn,hs,Sc,Ei,Ag,Jv,Qv,Dg,Zv,ey,ty,iy,ry,sy,ay,ny,ar=class extends C{constructor(){super(...arguments);m(this,V);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.picker=!1;this.alpha=!1;this.gradient=!1;this.formats="hex";this.recentKey="";this._open=!1;this.required=!1;this.disabled=!1;this._invalid=!1;m(this,tt,this.attachInternals());m(this,ps,new xe);m(this,ms,new re(this,r(this,tt)));m(this,kt,N("cm-cf"));m(this,zc,"");m(this,us);m(this,Sc,e=>{this._open&&!e.composedPath().includes(this)&&(this._open=!1)})}connectedCallback(){super.connectedCallback(),g(this,zc,a(this,V,hs).call(this,this.value)??this.value),document.addEventListener("pointerdown",r(this,Sc),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Sc),!0),r(this,ps).close()}show(){!this.disabled&&this.picker&&this.picker!=="native"&&(this._open=!0)}close(){this._open=!1}get form(){return r(this,tt).form}get validity(){return r(this,tt).validity}get validationMessage(){return r(this,tt).validationMessage}checkValidity(){return r(this,tt).checkValidity()}reportValidity(){return r(this,ms).report(()=>r(this,tt).reportValidity())}formResetCallback(){r(this,ms).reset(),this.value=r(this,zc),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=ls(t?.value??"")??(r(this,V,hn)&&t?.value&&yg(t.value)?t.value.trim():null);return i?[{value:i,name:t.name}]:[]}):w0.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=a(this,V,hs).call(this,this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==r(this,us)&&(this._draft=void 0,this._invalid=!1),g(this,us,void 0)}}updated(e){if(e.has("_open")){let s=this.renderRoot.querySelector(".pop");this._open?(r(this,ps).open(s,this.renderRoot.querySelector(".anchor"),{align:"start",gap:8})||s?.setAttribute("data-open",""),this.renderRoot.querySelector("cm-color-picker")?.updateComplete.then(()=>{this.renderRoot.querySelector("cm-color-picker")?.shadowRoot?.querySelector(".area")?.focus()})):e.get("_open")&&(r(this,ps).close(),s?.removeAttribute("data-open"))}else this._open&&r(this,ps).place();let t=!this.value||a(this,V,hs).call(this,this.value)!==null;r(this,tt).setFormValue(this.value&&t?this.value:null,this.value);let i=this.renderRoot.querySelector(".input")??void 0;this.error?r(this,tt).setValidity({customError:!0},this.error,i):this._invalid||!t?r(this,tt).setValidity({patternMismatch:!0},this.t(r(this,V,hn)?"invalidAny":"invalid"),i):this.required&&!this.value?r(this,tt).setValidity({valueMissing:!0},this.t("required"),i):r(this,tt).setValidity({}),r(this,ms).sync()}render(){let e=this.items,t=a(this,V,hs).call(this,this.value??""),i=e.findIndex(x=>x.value===t),s=r(this,V,hn),l=this.error||(this._invalid||this.value&&!t?this.t(s?"invalidAny":"invalid"):"")||r(this,ms).message,d=t?ls(t):null,p=t?`background:${t}`:h,u=[l&&`${r(this,kt)}-err`,this.helpText&&`${r(this,kt)}-help`].filter(Boolean).join(" ")||h,b=this.getAttribute("aria-label"),f=this.label||b||"";return c`<div class="field">
|
|
1447
1447
|
${this.label?c`<span class="label" id="${r(this,kt)}-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}
|
|
1448
1448
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
1449
1449
|
aria-labelledby=${this.label?`${r(this,kt)}-l`:h} aria-label=${!this.label&&b?b:h}
|
|
1450
1450
|
aria-required=${this.required?"true":h} aria-describedby=${u}>
|
|
1451
1451
|
${e.map((x,v)=>{let k=x.name?this.t("swatch",{name:x.name,hex:x.value}):x.value;return c`<button type="button" class="swatch" part="swatch" role="radio" aria-checked=${v===i?"true":"false"}
|
|
1452
1452
|
aria-label=${k} title=${x.name||x.value} tabindex=${v===(i>=0?i:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
1453
|
-
style="background-color:${x.value};color:${
|
|
1454
|
-
@click=${()=>a(this,V,
|
|
1453
|
+
style="background-color:${x.value};color:${E0(x.value)}"
|
|
1454
|
+
@click=${()=>a(this,V,Ag).call(this,v)} @keydown=${L=>a(this,V,Jv).call(this,L,v)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
1455
1455
|
</div>`:h}
|
|
1456
1456
|
<div class="row">
|
|
1457
1457
|
${this.picker&&this.picker!=="native"?c`<span class="anchor"><button type="button" class="pick checker-bg" part="picker" ?disabled=${this.disabled}
|
|
@@ -1462,15 +1462,15 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1462
1462
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1463
1463
|
</button>
|
|
1464
1464
|
<div class="pop" id="${r(this,kt)}-pop" role="dialog" aria-label=${f?this.t("pickerNamed",{label:f}):this.t("picker")}
|
|
1465
|
-
@keydown=${a(this,V,
|
|
1466
|
-
${this._open?c`<cm-color-picker .value=${this.value} .format=${a(this,V,
|
|
1465
|
+
@keydown=${a(this,V,ay)}>
|
|
1466
|
+
${this._open?c`<cm-color-picker .value=${this.value} .format=${a(this,V,ny).call(this)} .formats=${this.formats} .alpha=${this.alpha}
|
|
1467
1467
|
.gradient=${this.gradient} .swatches=${this.swatches?this.items:void 0} .brandColors=${this.brandColors}
|
|
1468
1468
|
.recentColors=${this.recentColors} .source=${this.source} .recentKey=${this.recentKey}
|
|
1469
|
-
@input=${a(this,V,
|
|
1469
|
+
@input=${a(this,V,ry)} @change=${a(this,V,sy)}></cm-color-picker>`:h}
|
|
1470
1470
|
</div></span>`:this.picker?c`<label class="pick" part="picker" style=${d?`background-color:${d}`:h}>
|
|
1471
1471
|
<input type="color" .value=${ee(d??"#000000")} ?disabled=${this.disabled}
|
|
1472
1472
|
aria-label=${f?this.t("pickerNamed",{label:f}):this.t("picker")}
|
|
1473
|
-
@input=${a(this,V,
|
|
1473
|
+
@input=${a(this,V,ty)} @change=${a(this,V,iy)} />
|
|
1474
1474
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1475
1475
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${p}></span>`}
|
|
1476
1476
|
<input part="input" id=${r(this,kt)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
@@ -1478,11 +1478,11 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1478
1478
|
aria-label=${s?f?this.t("valueNamed",{label:f}):this.t("value"):f?this.t("hexNamed",{label:f}):this.t("hex")}
|
|
1479
1479
|
?required=${this.required} ?disabled=${this.disabled}
|
|
1480
1480
|
aria-invalid=${l?"true":h} aria-describedby=${u}
|
|
1481
|
-
@input=${a(this,V,
|
|
1481
|
+
@input=${a(this,V,Qv)} @change=${a(this,V,Zv)} @keydown=${a(this,V,ey)} />
|
|
1482
1482
|
</div>
|
|
1483
1483
|
${l?c`<p class="error" id="${r(this,kt)}-err" role="alert">${l}</p>`:h}
|
|
1484
1484
|
${this.helpText?c`<p class="help" id="${r(this,kt)}-help">${this.helpText}</p>`:h}
|
|
1485
|
-
</div>`}};tt=new WeakMap,
|
|
1485
|
+
</div>`}};tt=new WeakMap,ps=new WeakMap,ms=new WeakMap,kt=new WeakMap,zc=new WeakMap,us=new WeakMap,V=new WeakSet,hn=function(){return this.alpha||this.gradient||/rgb|hsl/.test(this.formats??"")},hs=function(e){let t=(e??"").trim(),i=ls(t);if(i)return i;if(!r(this,V,hn))return null;if(/^#[0-9a-f]{4}$|^#[0-9a-f]{8}$/i.test(t))return this.alpha?t.toLowerCase():null;if(Ht(t))return this.gradient?t:null;let s=Ie(t);return s&&(this.alpha||s.a===1)?t:null},Sc=new WeakMap,Ei=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},Ag=function(e){let t=this.items[e];!t||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".swatch")[e]?.focus()),this._draft=void 0,this._invalid=!1,t.value!==this.value&&(this.value=t.value,a(this,V,Ei).call(this,"input","change")))},Jv=function(e,t){let i=this.items.length,s=se(e,this),l;if(s==="ArrowRight"||e.key==="ArrowDown")l=(t+1)%i;else if(s==="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(),a(this,V,Ag).call(this,l)},Qv=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let i=/^#?[0-9a-f]{6}$/i.test(t.trim())?ls(t):r(this,V,hn)&&/\)\s*$|^#[0-9a-f]{8}$/i.test(t.trim())?a(this,V,hs).call(this,t):null;i&&i!==this.value&&(g(this,us,i),this.value=i,a(this,V,Ei).call(this,"input")),this._invalid&&(i||!t.trim())&&(this._invalid=!1)},Dg=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?a(this,V,hs).call(this,e):"";if(t===null){this._invalid=!0;return}let i=this.value;this.value=t,this._draft=void 0,this._invalid=!1,t!==i&&a(this,V,Ei).call(this,"input"),a(this,V,Ei).call(this,"change")},Zv=function(e){e.stopPropagation(),a(this,V,Dg).call(this)},ey=function(e){e.key==="Enter"&&a(this,V,Dg).call(this)},ty=function(e){e.stopPropagation();let t=ls(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,a(this,V,Ei).call(this,"input"))},iy=function(e){e.stopPropagation(),a(this,V,Ei).call(this,"change")},ry=function(e){e.stopPropagation();let t=e.target.value;t!==this.value&&(g(this,us,t),this.value=t,this._draft=void 0,this._invalid=!1,a(this,V,Ei).call(this,"input"))},sy=function(e){e.stopPropagation(),a(this,V,Ei).call(this,"change")},ay=function(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this._open=!1,this.updateComplete.then(()=>this.renderRoot.querySelector("button.pick")?.focus()))},ny=function(){let e=this.value??"";return/^rgba?\(|gradient\(.*rgba?\(/i.test(e)?"rgb":/^hsla?\(|gradient\(.*hsla?\(/i.test(e)?"hsl":"hex"},ar.formAssociated=!0,ar.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},ar.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},swatches:{type:Array},picker:{converter:$0,reflect:!0},alpha:{type:Boolean},gradient:{type:Boolean},formats:{},brandColors:{type:Array,attribute:"brand-colors"},recentColors:{type:Array,attribute:"recent-colors"},source:{attribute:!1},recentKey:{attribute:"recent-key"},_open:{state:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_draft:{state:!0},_invalid:{state:!0}},ar.styles=[E,bt,Pe,w`
|
|
1486
1486
|
:host { display: block; }
|
|
1487
1487
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
1488
1488
|
.swatch {
|
|
@@ -1535,18 +1535,18 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1535
1535
|
.pop:not(:popover-open):not([data-open]) { display: none; }
|
|
1536
1536
|
.anchor { position: relative; }
|
|
1537
1537
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
1538
|
-
`];$("cm-color-field",
|
|
1538
|
+
`];$("cm-color-field",ar);var mM=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."}),Rg=3,am=.7,M0=.0055,nm="#000000",oy=8,Lc=2,_0=400,T0=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),ht,fs,Ac,pn,Dc,Et,Mt,_t,or,lr,We,Rc,cr,mn,D,Hg,om,Ng,Mi,lm,Pg,Ig,ly,qg,cm,Og,dm,cy,Bg,dy,gs,hm,Fg,Vg,hy,jg,py,Ug,my,uy,nr=class extends C{constructor(){super(...arguments);m(this,D);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.mode="draw";this.typedName="";this.required=!1;this.disabled=!1;this._announce="";m(this,ht,this.attachInternals());m(this,fs,new re(this,r(this,ht)));m(this,Ac,N("cm-sig"));m(this,pn,"");m(this,Dc,"");m(this,Et,[]);m(this,Mt);m(this,_t);m(this,or,"");m(this,lr,0);m(this,We);m(this,Rc,"");m(this,cr);m(this,mn,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?a(this,D,Hg).call(this):(g(this,pn,this.value),g(this,Dc,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),r(this,cr)?.disconnect(),g(this,cr,void 0),cancelAnimationFrame(r(this,lr)),g(this,lr,0),r(this,We)&&(clearTimeout(r(this,We)),g(this,We,void 0))}get form(){return r(this,ht).form}get validity(){return r(this,ht).validity}get validationMessage(){return r(this,ht).validationMessage}checkValidity(){return r(this,ht).checkValidity()}reportValidity(){return r(this,fs).report(()=>r(this,ht).reportValidity())}formResetCallback(){r(this,fs).reset(),g(this,Et,[]),g(this,Mt,void 0),g(this,_t,void 0),r(this,We)&&(clearTimeout(r(this,We)),g(this,We,void 0)),this.typedName=r(this,Dc),r(this,pn)?(g(this,or,""),this.value=r(this,pn)):this.updateComplete.then(()=>a(this,D,gs).call(this,!1)),a(this,D,Mi).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!r(this,Et).length&&!r(this,_t)}toDataURL(){return a(this,D,Fg).call(this)?.toDataURL("image/png")??""}toBlob(){let e=a(this,D,Fg).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(g(this,Et,[]),g(this,Mt,void 0),g(this,_t,void 0),a(this,D,Mi).call(this)),a(this,D,gs).call(this,!0)}undo(){this.mode==="draw"&&(r(this,Et).length?r(this,Et).pop():g(this,_t,void 0),g(this,Mt,void 0),a(this,D,Mi).call(this),a(this,D,gs).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==r(this,or)){let t=this.value??"";if(g(this,or,t),g(this,Et,[]),g(this,Mt,void 0),!t)g(this,_t,void 0),this.hasUpdated&&(this.typedName="");else{let i=new Image;i.addEventListener("load",()=>{r(this,_t)===i&&a(this,D,Mi).call(this)}),i.src=t,g(this,_t,i),this.mode="draw"}a(this,D,Mi).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();g(this,or,t),this.value=t}}firstUpdated(){a(this,D,Hg).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>a(this,D,gs).call(this,!1)),a(this,D,dm).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&a(this,D,dm).call(this),r(this,ht).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,ht).setValidity({customError:!0},this.error,t):this.required&&this.empty?r(this,ht).setValidity({valueMissing:!0},this.t("required"),t):r(this,ht).setValidity({}),r(this,fs).sync()}render(){let e=r(this,Ac),t=this.getAttribute("aria-label"),i=r(this,fs).message,s=[i&&`${e}-err`,this.helpText&&`${e}-help`].filter(Boolean).join(" "),l=this.empty,d=!r(this,Et).length&&!r(this,_t),p=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
1539
1539
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
1540
1540
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
1541
|
-
@click=${()=>a(this,
|
|
1541
|
+
@click=${()=>a(this,D,Vg).call(this,u,!0)} @keydown=${a(this,D,hy)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
1542
1542
|
${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}
|
|
1543
1543
|
<div class="bar">
|
|
1544
1544
|
<div class="tabs" role="tablist" part="tabs"
|
|
1545
1545
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
1546
1546
|
aria-label=${this.label?h:t||this.t("modes")}>${p("draw")}${p("type")}</div>
|
|
1547
1547
|
<div class="actions">
|
|
1548
|
-
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${a(this,
|
|
1549
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${a(this,
|
|
1548
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${a(this,D,my)}>${this.t("undo")}</button>`:h}
|
|
1549
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${a(this,D,uy)}>${this.t("clear")}</button>
|
|
1550
1550
|
</div>
|
|
1551
1551
|
</div>
|
|
1552
1552
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -1556,8 +1556,8 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1556
1556
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
1557
1557
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
1558
1558
|
aria-describedby=${[`${e}-instr`,s].filter(Boolean).join(" ")}
|
|
1559
|
-
@pointerdown=${a(this,
|
|
1560
|
-
@lostpointercapture=${a(this,
|
|
1559
|
+
@pointerdown=${a(this,D,ly)} @pointermove=${a(this,D,qg)} @pointerup=${a(this,D,cm)} @pointercancel=${a(this,D,cm)}
|
|
1560
|
+
@lostpointercapture=${a(this,D,cm)} @transitionend=${()=>a(this,D,lm).call(this)}></canvas>
|
|
1561
1561
|
</div>
|
|
1562
1562
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
1563
1563
|
</div>
|
|
@@ -1569,13 +1569,13 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1569
1569
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
1570
1570
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
1571
1571
|
aria-describedby=${s||h} ?disabled=${this.disabled}
|
|
1572
|
-
@input=${a(this,
|
|
1572
|
+
@input=${a(this,D,cy)} @change=${a(this,D,dy)} />
|
|
1573
1573
|
</div>
|
|
1574
1574
|
</div>
|
|
1575
1575
|
${i?c`<p class="error" id="${e}-err" role="alert">${i}</p>`:h}
|
|
1576
1576
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
1577
1577
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
1578
|
-
</div>`}};ht=new WeakMap,
|
|
1578
|
+
</div>`}};ht=new WeakMap,fs=new WeakMap,Ac=new WeakMap,pn=new WeakMap,Dc=new WeakMap,Et=new WeakMap,Mt=new WeakMap,_t=new WeakMap,or=new WeakMap,lr=new WeakMap,We=new WeakMap,Rc=new WeakMap,cr=new WeakMap,mn=new WeakMap,D=new WeakSet,Hg=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,cr)||(g(this,cr,new ResizeObserver(()=>a(this,D,Ng).call(this))),r(this,cr).observe(e))},om=function(){return this.renderRoot.querySelector("canvas")},Ng=function(){let e=r(this,D,om);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;g(this,mn,t);let s=window.devicePixelRatio||1,l=Math.round(t*s),d=Math.round(i*s);(e.width!==l||e.height!==d)&&(e.width=l,e.height=d),a(this,D,lm).call(this)},Mi=function(){r(this,lr)||g(this,lr,requestAnimationFrame(()=>{g(this,lr,0),a(this,D,lm).call(this)}))},lm=function(){let e=r(this,D,om);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,mn);if(!i)return;let s=e.width/i;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),t.setTransform(s,0,0,s,0,0);let l=getComputedStyle(e).color||nm;a(this,D,Pg).call(this,t,i,l,!0)},Pg=function(e,t,i,s){let l=t/Rg,d=r(this,_t);if(d?.complete&&d.naturalWidth){let p=Math.min(t*.9/d.naturalWidth,l*.9/d.naturalHeight),u=d.naturalWidth*p,b=d.naturalHeight*p,f=(t-u)/2,x=(l-b)/2;if(s&&!S0(i,nm)){let v=document.createElement("canvas");v.width=Math.max(1,Math.round(u*2)),v.height=Math.max(1,Math.round(b*2));let k=v.getContext("2d");k.drawImage(d,0,0,v.width,v.height),k.globalCompositeOperation="source-in",k.fillStyle=i,k.fillRect(0,0,v.width,v.height),e.drawImage(v,f,x,u,b)}else e.drawImage(d,f,x,u,b)}e.strokeStyle=i,e.fillStyle=i,e.lineCap="round",e.lineJoin="round";for(let p of r(this,Et))C0(e,p,t)},Ig=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}},ly=function(e){if(this.disabled||r(this,Mt)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.currentTarget;e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}let i=[a(this,D,Ig).call(this,e,t.getBoundingClientRect())];g(this,Mt,{id:e.pointerId,stroke:i}),r(this,Et).push(i),a(this,D,Mi).call(this)},qg=function(e){let t=r(this,Mt);if(!t||e.pointerId!==t.id)return;e.preventDefault();let i=e.currentTarget.getBoundingClientRect(),s=typeof e.getCoalescedEvents=="function"?e.getCoalescedEvents():[];for(let l of s.length?s:[e]){let d=a(this,D,Ig).call(this,l,i),p=t.stroke[t.stroke.length-1];Math.hypot(d.x-p.x,d.y-p.y)*i.width<1.5||t.stroke.push(d)}a(this,D,Mi).call(this)},cm=function(e){let t=r(this,Mt);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&a(this,D,qg).call(this,e),g(this,Mt,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}a(this,D,Mi).call(this),a(this,D,gs).call(this,!0)}},Og=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},dm=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${r(this,D,Og)}`,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()&&a(this,D,gs).call(this,!1)},()=>{})},cy=function(e){e.stopPropagation(),r(this,We)?clearTimeout(r(this,We)):g(this,Rc,this.value),this.typedName=e.target.value,g(this,We,setTimeout(()=>a(this,D,Bg).call(this),_0)),a(this,D,dm).call(this)},Bg=function(){r(this,We)&&(clearTimeout(r(this,We)),g(this,We,void 0),this.value!==r(this,Rc)&&a(this,D,hm).call(this))},dy=function(e){e.stopPropagation(),this.updateComplete.then(()=>a(this,D,Bg).call(this))},gs=function(e){let t=this.empty?"":this.toDataURL(),i=t!==this.value;i&&(g(this,or,t),this.value=t),this.requestUpdate(),e&&i&&a(this,D,hm).call(this)},hm=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}))},Fg=function(){if(this.empty)return;let e=Math.max(r(this,D,om)?.clientWidth||r(this,mn)||600,300),t=e/Rg,i=document.createElement("canvas");i.width=Math.round(e*Lc),i.height=Math.round(t*Lc);let s=i.getContext("2d",{willReadFrequently:!0});if(s.scale(Lc,Lc),this.mode==="type"){let l=Math.min(t*.45,64),d=r(this,D,Og);s.font=`400 ${l}px ${d}`;let p=this.typedName.trim(),u=e-2*oy,b=s.measureText(p).width;b>u&&(l*=u/b,s.font=`400 ${l}px ${d}`),s.direction=getComputedStyle(this).direction==="rtl"?"rtl":"ltr",s.textAlign="center",s.textBaseline="alphabetic",s.fillStyle=nm,s.fillText(p,e/2,t*am)}else a(this,D,Pg).call(this,s,e,nm,!1);return z0(i,oy*Lc)},Vg=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${r(this,Ac)}-tab-${e}`)?.focus()),e===this.mode))return;let i=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&a(this,D,Ng).call(this),this.value!==i&&a(this,D,hm).call(this)})},hy=function(e){let t=se(e,this),i;if(t==="ArrowRight"||t==="ArrowLeft")i=this.mode==="draw"?"type":"draw";else if(e.key==="Home")i="draw";else if(e.key==="End")i="type";else return;e.preventDefault(),a(this,D,Vg).call(this,i,!0)},jg=function(e){a(this,D,py).call(this,this.t(e))},py=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},Ug=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()})},my=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),a(this,D,jg).call(this,"undone"),a(this,D,Ug).call(this,e)},uy=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),a(this,D,jg).call(this,"cleared"),a(this,D,Ug).call(this,e)},nr.formAssociated=!0,nr.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},nr.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}},nr.styles=[E,w`
|
|
1579
1579
|
:host { display: block; }
|
|
1580
1580
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1581
1581
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -1605,7 +1605,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1605
1605
|
.act:disabled { background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed; }
|
|
1606
1606
|
.panel:focus { outline: none; }
|
|
1607
1607
|
.pad {
|
|
1608
|
-
position: relative; width: 100%; aspect-ratio: ${
|
|
1608
|
+
position: relative; width: 100%; aspect-ratio: ${Rg} / 1; overflow: hidden; container-type: inline-size;
|
|
1609
1609
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
1610
1610
|
}
|
|
1611
1611
|
.panel:focus-visible .pad, .pad:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
@@ -1616,15 +1616,15 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1616
1616
|
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 */
|
|
1617
1617
|
}
|
|
1618
1618
|
.line {
|
|
1619
|
-
position: absolute; inset-inline: var(--cm-space-12); top: ${
|
|
1619
|
+
position: absolute; inset-inline: var(--cm-space-12); top: ${am*100}%; height: 0;
|
|
1620
1620
|
border-top: var(--cm-border-1) dashed var(--cm-border-input); pointer-events: none;
|
|
1621
1621
|
}
|
|
1622
1622
|
.here {
|
|
1623
|
-
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-
|
|
1623
|
+
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-am)*100}% + 4px);
|
|
1624
1624
|
font-size: 12px; color: var(--cm-text-tertiary); pointer-events: none; user-select: none;
|
|
1625
1625
|
}
|
|
1626
1626
|
.typed {
|
|
1627
|
-
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-
|
|
1627
|
+
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-am)*100}% - 0.18em);
|
|
1628
1628
|
width: calc(100% - 2 * var(--cm-space-12)); padding: 0; margin: 0;
|
|
1629
1629
|
font-family: var(--cm-signature-font, 'Dancing Script', 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', 'Brush Script MT', cursive);
|
|
1630
1630
|
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 */
|
|
@@ -1641,19 +1641,19 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1641
1641
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
1642
1642
|
|
|
1643
1643
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1644
|
-
`];function
|
|
1645
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1644
|
+
`];function C0(o,n,e){let t=d=>e*M0*(.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],s=n[0];for(let d=1;d<n.length-1;d++){let p=T0(n[d],n[d+1]);o.beginPath(),o.moveTo(...i(s)),o.quadraticCurveTo(...i(n[d]),...i(p)),o.lineWidth=t(n[d].p),o.stroke(),s=p}let l=n[n.length-1];o.beginPath(),o.moveTo(...i(s)),o.lineTo(...i(l)),o.lineWidth=t(l.p),o.stroke()}function z0(o,n){let{width:e,height:t}=o,i=o.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e,t).data,s=t,l=e,d=-1,p=-1;for(let b=0;b<t;b++){let f=b*e*4;for(let x=0;x<e;x++)i[f+x*4+3]>8&&(x<l&&(l=x),x>d&&(d=x),b<s&&(s=b),p=b)}if(d<0)return;let u=document.createElement("canvas");return u.width=d-l+1+2*n,u.height=p-s+1+2*n,u.getContext("2d").drawImage(o,l,s,d-l+1,p-s+1,n,n,d-l+1,p-s+1),u}function S0(o,n){let e=t=>{let i=/^#([0-9a-f]{6})$/i.exec(t.trim());if(i){let s=parseInt(i[1],16);return`${s>>16&255},${s>>8&255},${s&255}`}return(/\d+\s*,\s*\d+\s*,\s*\d+/.exec(t)?.[0]??t).replace(/\s/g,"")};return e(o)===e(n)}$("cm-signature-field",nr);var xM=z("optionGroup",{required:"Please select one of these options."}),Tt,bs,vs,un,Hc,Yt,Kg,Wg,gy,Gt=class extends C{constructor(){super(...arguments);m(this,Yt);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];m(this,Tt,this.attachInternals());m(this,bs,new re(this,r(this,Tt),()=>this.renderRoot.querySelector('button[tabindex="0"]')?.focus()));m(this,vs,N("cm-og"));m(this,un,"");m(this,Hc,new MutationObserver(()=>a(this,Yt,Kg).call(this)))}connectedCallback(){super.connectedCallback(),a(this,Yt,Kg).call(this),r(this,Hc).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Hc).disconnect()}get form(){return r(this,Tt).form}get validity(){return r(this,Tt).validity}get validationMessage(){return r(this,Tt).validationMessage}checkValidity(){return r(this,Tt).checkValidity()}reportValidity(){return r(this,bs).report(()=>r(this,Tt).reportValidity())}formResetCallback(){this.value=r(this,un),r(this,bs).reset()}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){r(this,un)||g(this,un,this.value)}updated(){r(this,Tt).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,Tt).setValidity({valueMissing:!0},this.t("required"),e):r(this,Tt).setValidity({}),r(this,bs).sync()}render(){let e=this.items,t=e.findIndex(d=>d.value===this.value&&!d.disabled),i=t>=0?t:e.findIndex(d=>!d.disabled),s=this.getAttribute("aria-label"),l=r(this,bs).message;return c`
|
|
1645
|
+
${this.label?c`<span class="label" id="${r(this,vs)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1646
1646
|
<div class="options" part="options" role="radiogroup"
|
|
1647
|
-
aria-labelledby=${this.label?`${r(this,
|
|
1647
|
+
aria-labelledby=${this.label?`${r(this,vs)}-l`:h} aria-label=${!this.label&&s?s:h}
|
|
1648
1648
|
aria-required=${this.required?"true":h} aria-invalid=${l?"true":h}
|
|
1649
|
-
aria-describedby=${l?`${r(this,
|
|
1649
|
+
aria-describedby=${l?`${r(this,vs)}-err`:h}>
|
|
1650
1650
|
${e.map((d,p)=>c`<button type="button" role="radio" part="option" class=${d.tone==="critical"||d.tone==="success"?`tone-${d.tone}`:h} aria-checked=${d.value===this.value?"true":"false"}
|
|
1651
1651
|
tabindex=${p===i?"0":"-1"} ?disabled=${this.disabled||!!d.disabled}
|
|
1652
|
-
@click=${()=>a(this,
|
|
1652
|
+
@click=${()=>a(this,Yt,Wg).call(this,p)} @keydown=${u=>a(this,Yt,gy).call(this,u,p)}>${d.label}</button>`)}
|
|
1653
1653
|
</div>
|
|
1654
|
-
${l?c`<p class="error" id="${r(this,
|
|
1654
|
+
${l?c`<p class="error" id="${r(this,vs)}-err" role="alert">${l}</p>`:h}
|
|
1655
1655
|
<slot></slot>
|
|
1656
|
-
`}};Tt=new WeakMap,
|
|
1656
|
+
`}};Tt=new WeakMap,bs=new WeakMap,vs=new WeakMap,un=new WeakMap,Hc=new WeakMap,Yt=new WeakSet,Kg=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},s=t.getAttribute("tone");return(s==="critical"||s==="success")&&(i.tone=s),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,un,this.value))},Wg=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}))))},gy=function(e,t){let i=se(e,this),s=this.items.flatMap((p,u)=>p.disabled?[]:[u]),l=s.indexOf(t),d;if(i==="ArrowRight"||e.key==="ArrowDown")d=s[(l+1)%s.length];else if(i==="ArrowLeft"||e.key==="ArrowUp")d=s[(l-1+s.length)%s.length];else if(e.key==="Home")d=s[0];else if(e.key==="End")d=s[s.length-1];else return;e.preventDefault(),d!==void 0&&a(this,Yt,Wg).call(this,d)},Gt.formAssociated=!0,Gt.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},Gt.styles=[E,w`
|
|
1657
1657
|
:host { display: block; }
|
|
1658
1658
|
.label {
|
|
1659
1659
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1687,7 +1687,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1687
1687
|
/* 1.14: the field's own message under the options. */
|
|
1688
1688
|
.error { margin: var(--cm-space-8) 0 0; font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-critical); }
|
|
1689
1689
|
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
1690
|
-
`];$("cm-option-group",Gt);var
|
|
1690
|
+
`];$("cm-option-group",Gt);var TM=z("segmentedControl",{required:"Please select one of these options."}),gn=class extends Gt{constructor(){super(...arguments);this.size="default"}};gn.properties={...Gt.properties,size:{reflect:!0}},gn.styles=[E,w`
|
|
1691
1691
|
:host { display: inline-block; vertical-align: middle; max-width: 100%; --_h: var(--cm-control-height-md, 36px); }
|
|
1692
1692
|
:host([size='small']) { --_h: var(--cm-control-height-sm, 32px); }
|
|
1693
1693
|
@media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
|
|
@@ -1717,7 +1717,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1717
1717
|
button[aria-checked='true']:disabled { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
1718
1718
|
:host([disabled]) .options { background: var(--cm-bg-input-filled); }
|
|
1719
1719
|
slot { display: none; }
|
|
1720
|
-
`];$("cm-segmented-control",
|
|
1720
|
+
`];$("cm-segmented-control",gn);var AM=z("pageHeader",{back:"Back to {label}",backOnly:"Back",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),Nc,Gg,fn=class extends C{constructor(){super(...arguments);m(this,Nc);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">
|
|
1721
1721
|
<div class=${this.description?"lead described":"lead"}>
|
|
1722
1722
|
${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}
|
|
1723
1723
|
<div class="titles">
|
|
@@ -1731,12 +1731,12 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1731
1731
|
</div>
|
|
1732
1732
|
<div class="actions">
|
|
1733
1733
|
${this.pagination?c`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
1734
|
-
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>a(this,
|
|
1735
|
-
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>a(this,
|
|
1734
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>a(this,Nc,Gg).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
1735
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>a(this,Nc,Gg).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
1736
1736
|
</div>`:h}
|
|
1737
1737
|
<slot name="actions"></slot>
|
|
1738
1738
|
</div>
|
|
1739
|
-
</header>`}};
|
|
1739
|
+
</header>`}};Nc=new WeakSet,Gg=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},fn.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"}},fn.styles=[E,w`
|
|
1740
1740
|
:host { display: block; }
|
|
1741
1741
|
header {
|
|
1742
1742
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-12) var(--cm-space-20);
|
|
@@ -1794,7 +1794,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1794
1794
|
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
1795
1795
|
.actions { gap: var(--cm-space-8); }
|
|
1796
1796
|
}
|
|
1797
|
-
`];$("cm-page-header",
|
|
1797
|
+
`];$("cm-page-header",fn);var IM=z("actionBar",{label:"Actions"}),bn=class extends C{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")}>
|
|
1798
1798
|
<div class="lead">
|
|
1799
1799
|
${e?c`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:h}
|
|
1800
1800
|
<div class="text">
|
|
@@ -1804,7 +1804,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1804
1804
|
</div>
|
|
1805
1805
|
</div>
|
|
1806
1806
|
<div class="actions"><slot name="actions"></slot></div>
|
|
1807
|
-
</div>`}};
|
|
1807
|
+
</div>`}};bn.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},bn.styles=[E,w`
|
|
1808
1808
|
:host { display: block; }
|
|
1809
1809
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
1810
1810
|
.bar {
|
|
@@ -1835,13 +1835,13 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1835
1835
|
|
|
1836
1836
|
.actions { gap: var(--cm-space-8); }
|
|
1837
1837
|
}
|
|
1838
|
-
`];$("cm-action-bar",
|
|
1838
|
+
`];$("cm-action-bar",bn);var VM=z("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),Xt,ys,Pc,Ge,Yg,Xg,Jg,fy,by,vn=class extends C{constructor(){super(...arguments);m(this,Ge);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";m(this,Xt,null);m(this,ys,()=>{this.open=!0});m(this,Pc,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>a(this,Ge,Yg).call(this))}disconnectedCallback(){super.disconnectedCallback(),a(this,Ge,Xg).call(this)}updated(e){e.has("form")&&this.isConnected&&a(this,Ge,Yg).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1839
1839
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1840
1840
|
<div class="actions">
|
|
1841
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${a(this,
|
|
1842
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${a(this,
|
|
1841
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${a(this,Ge,by)}>${this.discardLabel}</cm-button>
|
|
1842
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${a(this,Ge,fy)}>${this.saveLabel}</cm-button>
|
|
1843
1843
|
</div>
|
|
1844
|
-
</div>`}};
|
|
1844
|
+
</div>`}};Xt=new WeakMap,ys=new WeakMap,Pc=new WeakMap,Ge=new WeakSet,Yg=function(){a(this,Ge,Xg).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,Xt,e),e.addEventListener("input",r(this,ys)),e.addEventListener("change",r(this,ys)),e.addEventListener("reset",r(this,Pc)))},Xg=function(){let e=r(this,Xt);e&&(e.removeEventListener("input",r(this,ys)),e.removeEventListener("change",r(this,ys)),e.removeEventListener("reset",r(this,Pc)),g(this,Xt,null))},Jg=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},fy=function(){this.loading||this.saveDisabled||a(this,Ge,Jg).call(this,"cm-save")&&r(this,Xt)&&r(this,Xt).requestSubmit()},by=function(){this.loading||a(this,Ge,Jg).call(this,"cm-discard")&&r(this,Xt)&&(r(this,Xt).reset(),this.open=!1)},vn.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:{}},vn.styles=[E,w`
|
|
1845
1845
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1846
1846
|
:host(:not([open])) { display: none; }
|
|
1847
1847
|
.bar {
|
|
@@ -1857,14 +1857,14 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1857
1857
|
.message { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; }
|
|
1858
1858
|
|
|
1859
1859
|
}
|
|
1860
|
-
`];$("cm-save-bar",
|
|
1860
|
+
`];$("cm-save-bar",vn);var YM=z("infoItem",{edit:"Edit {label}"}),yn=class extends A{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}>
|
|
1861
1861
|
${this.heading||this.action?c`<header>
|
|
1862
1862
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
1863
1863
|
${this.action?c`<button class="action" type="button" part="action" aria-label=${this.actionLabel||h}
|
|
1864
1864
|
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h}
|
|
1865
1865
|
</header>`:h}
|
|
1866
1866
|
<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>
|
|
1867
|
-
</section>`}};
|
|
1867
|
+
</section>`}};yn.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},layout:{reflect:!0},_list:{state:!0}},yn.styles=[E,w`
|
|
1868
1868
|
:host { display: block; }
|
|
1869
1869
|
section {
|
|
1870
1870
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -1889,9 +1889,9 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1889
1889
|
display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: baseline;
|
|
1890
1890
|
column-gap: var(--cm-space-12); grid-column: 1 / -1; --_cm-info-value-gap: 0px;
|
|
1891
1891
|
}
|
|
1892
|
-
`];$("cm-info-panel",
|
|
1892
|
+
`];$("cm-info-panel",yn);var xn=class extends C{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"
|
|
1893
1893
|
aria-label=${this.editLabel||this.t("edit",{label:this.label})}
|
|
1894
|
-
@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}`}};
|
|
1894
|
+
@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}`}};xn.properties={label:{},half:{type:Boolean,reflect:!0},editable:{type:Boolean,reflect:!0},editLabel:{attribute:"edit-label"}},xn.styles=[E,w`
|
|
1895
1895
|
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
1896
1896
|
:host([half]) { grid-column: auto; }
|
|
1897
1897
|
.label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
|
|
@@ -1910,16 +1910,16 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1910
1910
|
.edit:hover { background: var(--cm-bg-hover); color: var(--cm-icon-selected); }
|
|
1911
1911
|
.edit:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1912
1912
|
@media (pointer: coarse) { .edit::after { content: ''; position: absolute; inset: -8px; } }
|
|
1913
|
-
`];$("cm-info-item",
|
|
1913
|
+
`];$("cm-info-item",xn);var xs,wn=class extends A{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;m(this,xs,N("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">
|
|
1914
1914
|
<div class="h" role="heading" aria-level=${e}>
|
|
1915
|
-
<button type="button" part="toggle" id="${r(this,
|
|
1915
|
+
<button type="button" part="toggle" id="${r(this,xs)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,xs)}-body"
|
|
1916
1916
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
1917
1917
|
<span>${this.heading}</span>
|
|
1918
1918
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
1919
1919
|
</button>
|
|
1920
1920
|
</div>
|
|
1921
|
-
<div class="body" part="body" id="${r(this,
|
|
1922
|
-
</div>`}};
|
|
1921
|
+
<div class="body" part="body" id="${r(this,xs)}-body" role="region" aria-labelledby="${r(this,xs)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
1922
|
+
</div>`}};xs=new WeakMap,wn.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},wn.styles=[E,w`
|
|
1923
1923
|
:host { display: block; }
|
|
1924
1924
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
1925
1925
|
.h { margin: 0; font: inherit; }
|
|
@@ -1942,24 +1942,24 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
1942
1942
|
.body[hidden] { display: none; }
|
|
1943
1943
|
|
|
1944
1944
|
|
|
1945
|
-
`];$("cm-accordion",
|
|
1945
|
+
`];$("cm-accordion",wn);var it,ws,Qg,vy,$n=class extends A{constructor(){super(...arguments);m(this,it);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="default";this.action="";this.actionHref="";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));if(this.size==="inline")return a(this,it,vy).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">
|
|
1946
1946
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1947
|
-
<slot name="image" @slotchange=${i=>a(this,it,
|
|
1947
|
+
<slot name="image" @slotchange=${i=>a(this,it,ws).call(this,i,"hasImage")}>${t}</slot>
|
|
1948
1948
|
</div>
|
|
1949
1949
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1950
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>a(this,it,
|
|
1951
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>a(this,it,
|
|
1952
|
-
</div>`}};it=new WeakSet,
|
|
1953
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},
|
|
1950
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>a(this,it,ws).call(this,i,"hasText")}></slot></div>
|
|
1951
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>a(this,it,ws).call(this,i,"hasActions")}></slot></div>${this.action?c`<div class="actions">${a(this,it,Qg).call(this)}</div>`:h}
|
|
1952
|
+
</div>`}};it=new WeakSet,ws=function(e,t){let i=e.target;this[t]=i.assignedNodes({flatten:!0}).some(s=>s.nodeType===1||s.textContent.trim()),this.requestUpdate()},Qg=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"
|
|
1953
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},vy=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">
|
|
1954
1954
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1955
|
-
<slot name="image" @slotchange=${i=>a(this,it,
|
|
1955
|
+
<slot name="image" @slotchange=${i=>a(this,it,ws).call(this,i,"hasImage")}>${t}</slot>
|
|
1956
1956
|
</span>
|
|
1957
1957
|
<div class="line">
|
|
1958
1958
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1959
|
-
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>a(this,it,
|
|
1960
|
-
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>a(this,it,
|
|
1959
|
+
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>a(this,it,ws).call(this,i,"hasText")}></slot></span>${a(this,it,Qg).call(this)}
|
|
1960
|
+
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>a(this,it,ws).call(this,i,"hasActions")}></slot></span>
|
|
1961
1961
|
</div>
|
|
1962
|
-
</div>`}
|
|
1962
|
+
</div>`},$n.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0},action:{},actionHref:{attribute:"action-href"}},$n.styles=[E,w`
|
|
1963
1963
|
:host { display: block; }
|
|
1964
1964
|
/* 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. */
|
|
1965
1965
|
.wrap {
|
|
@@ -2008,7 +2008,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2008
2008
|
:host([size='large']) .circle { width: 120px; height: 120px; }
|
|
2009
2009
|
:host([size='large']) .title { margin-top: var(--cm-space-16); }
|
|
2010
2010
|
}
|
|
2011
|
-
`];$("cm-empty-state"
|
|
2011
|
+
`];$("cm-empty-state",$n);var yy={small:34,medium:40,large:50,xlarge:186},kn=class extends A{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=yy[this.size]??yy.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>`)}`}};kn.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},kn.styles=[E,w`
|
|
2012
2012
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
2013
2013
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
2014
2014
|
.bone {
|
|
@@ -2023,17 +2023,17 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2023
2023
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
2024
2024
|
}
|
|
2025
2025
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
2026
|
-
`];$("cm-skeleton"
|
|
2026
|
+
`];$("cm-skeleton",kn);var L0=[472,90,90,251],A0=[94,266,134,191,138],En=class extends C{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">
|
|
2027
2027
|
<span class="sr" role="status">${this.label}</span>
|
|
2028
2028
|
<div class="page" aria-hidden="true">
|
|
2029
2029
|
${this.navigation?c`<span class="bone nav"></span>`:h}
|
|
2030
2030
|
<span class="bone head"></span>
|
|
2031
2031
|
<div class="body">
|
|
2032
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
2033
|
-
<div class="col side">${e(
|
|
2032
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:L0)}</div>
|
|
2033
|
+
<div class="col side">${e(A0)}</div>
|
|
2034
2034
|
</div>
|
|
2035
2035
|
</div>
|
|
2036
|
-
</div>`}};
|
|
2036
|
+
</div>`}};En.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},En.styles=[E,w`
|
|
2037
2037
|
:host { display: block; }
|
|
2038
2038
|
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-8); }
|
|
2039
2039
|
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
@@ -2057,11 +2057,11 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2057
2057
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
2058
2058
|
.head { height: 60px; }
|
|
2059
2059
|
}
|
|
2060
|
-
`];$("cm-skeleton-display",
|
|
2060
|
+
`];$("cm-skeleton-display",En);var g2=z("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),pm,xy,Mn=class extends C{constructor(){super(...arguments);m(this,pm);this.author="";this.datetime="";this.time=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-comment-box"&&this.setAttribute("role","listitem")}render(){let e=a(this,pm,xy).call(this);return c`<article part="comment">
|
|
2061
2061
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
2062
2062
|
<div class="body" part="body"><slot></slot></div>
|
|
2063
2063
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
2064
|
-
</article>`}};
|
|
2064
|
+
</article>`}};pm=new WeakSet,xy=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:me(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},Mn.properties={author:{},datetime:{},time:{}},Mn.styles=[E,w`
|
|
2065
2065
|
:host { display: block; }
|
|
2066
2066
|
article {
|
|
2067
2067
|
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
@@ -2069,16 +2069,16 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2069
2069
|
}
|
|
2070
2070
|
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
2071
2071
|
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
2072
|
-
`];$("cm-comment",
|
|
2073
|
-
<div class="title" id="${r(this,
|
|
2072
|
+
`];$("cm-comment",Mn);var Ic,mm,wy,_n=class extends C{constructor(){super(...arguments);m(this,mm);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;m(this,Ic,N("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,Ic)}-h">
|
|
2073
|
+
<div class="title" id="${r(this,Ic)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
2074
2074
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
2075
2075
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
2076
|
-
@keydown=${a(this,
|
|
2076
|
+
@keydown=${a(this,mm,wy)}></textarea>
|
|
2077
2077
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
2078
2078
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
2079
2079
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
2080
2080
|
</div>
|
|
2081
|
-
</section>`}};
|
|
2081
|
+
</section>`}};Ic=new WeakMap,mm=new WeakSet,wy=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},_n.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},_n.styles=[E,w`
|
|
2082
2082
|
:host { display: block; }
|
|
2083
2083
|
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
2084
2084
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -2098,8 +2098,8 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2098
2098
|
|
|
2099
2099
|
.actions { justify-content: flex-end; }
|
|
2100
2100
|
}
|
|
2101
|
-
`];$("cm-comment-box",
|
|
2102
|
-
data-side=${this._side}>${this.content}</div>`}};Le=new WeakMap,
|
|
2101
|
+
`];$("cm-comment-box",_n);var um='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',Le,Cn,dr,hr,_i,zn,Sn,pt,Zg,gm,fm,bm,vm,Ln,$y,$s,ef,tf,Ti,Tn=class extends A{constructor(){super(...arguments);m(this,pt);this.content="";this.placement="top";this.delay=400;this.open=!1;this.visualOnly=!1;this._side="top";m(this,Le);m(this,Cn);m(this,dr,[]);m(this,hr);m(this,_i);m(this,zn,!1);m(this,Sn,!1);m(this,gm,()=>{g(this,zn,!0),clearTimeout(r(this,_i)),this.open||g(this,_i,setTimeout(()=>this.show(),this.delay))});m(this,fm,()=>{g(this,zn,!1),clearTimeout(r(this,_i)),r(this,Sn)||this.hide()});m(this,bm,()=>{g(this,Sn,!0),this.show()});m(this,vm,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(g(this,Sn,!1),r(this,zn)||this.hide())});m(this,Ln,e=>{e.key==="Escape"&&this.open&&this.hide()});m(this,$s,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(a(this,pt,tf).call(this),!t||!this.content||this.visualOnly)return;let i=t.updateComplete;t.localName.includes("-")&&i&&!t.shadowRoot?.querySelector(um)&&i.then(()=>{t.shadowRoot?.querySelector(um)&&r(this,$s).call(this)}),r(this,Le)||(g(this,Le,document.createElement("span")),r(this,Le).id=N("cm-tooltip"),r(this,Le).hidden=!0,r(this,Le).slot="description"),r(this,Le).textContent=this.content,r(this,Le).isConnected||this.append(r(this,Le));let s=a(this,pt,$y).call(this,t);if(g(this,Cn,s),s.getRootNode()===r(this,Le).getRootNode()){let l=(s.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);l.includes(r(this,Le).id)||s.setAttribute("aria-describedby",[...l,r(this,Le).id].join(" "))}else"ariaDescribedByElements"in s?(a(this,pt,ef).call(this,s),g(this,hr,new MutationObserver(()=>{s.getAttribute("aria-describedby")!==""&&a(this,pt,ef).call(this,s)})),r(this,hr).observe(s,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,Le).id)});m(this,Ti,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let s=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0]??this).getBoundingClientRect(),l=e.getBoundingClientRect(),d=8,p=8,u=innerWidth,b=innerHeight,f=getComputedStyle(this).direction==="rtl",x=O=>O==="start"?f?"right":"left":O==="end"?f?"left":"right":O,v={top:s.top-d-l.height>=p,bottom:s.bottom+d+l.height<=b-p,left:s.left-d-l.width>=p,right:s.right+d+l.width<=u-p},k={top:"bottom",bottom:"top",left:"right",right:"left"},L=x(this.placement);!v[L]&&v[k[L]]&&(L=k[L]);let P,U;L==="top"||L==="bottom"?(P=s.left+s.width/2-l.width/2,U=L==="top"?s.top-d-l.height:s.bottom+d):(U=s.top+s.height/2-l.height/2,P=L==="left"?s.left-d-l.width:s.right+d),P=Math.min(Math.max(p,P),u-p-l.width),U=Math.min(Math.max(p,U),b-p-l.height),e.style.transform=`translate(${Math.round(P)}px, ${Math.round(U)}px)`;let q={top:"top",bottom:"bottom",left:f?"end":"start",right:f?"start":"end"};this._side=q[L]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,gm)),this.addEventListener("pointerleave",r(this,fm)),this.addEventListener("focusin",r(this,bm)),this.addEventListener("focusout",r(this,vm)),this.addEventListener("keydown",r(this,Ln)),this.hasUpdated&&r(this,$s).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),a(this,pt,tf).call(this),a(this,pt,Zg).call(this),clearTimeout(r(this,_i))}show(){clearTimeout(r(this,_i)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,Ln),!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,_i)),this.open&&(this.open=!1,a(this,pt,Zg).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,$s).call(this),this.content?this.open&&r(this,Ti).call(this):this.hide())}render(){return c`<slot @slotchange=${r(this,$s)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
2102
|
+
data-side=${this._side}>${this.content}</div>`}};Le=new WeakMap,Cn=new WeakMap,dr=new WeakMap,hr=new WeakMap,_i=new WeakMap,zn=new WeakMap,Sn=new WeakMap,pt=new WeakSet,Zg=function(){document.removeEventListener("keydown",r(this,Ln),!0),removeEventListener("scroll",r(this,Ti),!0),removeEventListener("resize",r(this,Ti))},gm=new WeakMap,fm=new WeakMap,bm=new WeakMap,vm=new WeakMap,Ln=new WeakMap,$y=function(e){return e.matches(um)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(um)??e},$s=new WeakMap,ef=function(e){g(this,dr,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),i=r(this,dr).map(s=>t.getElementById(s)).filter(s=>!!s);e.ariaDescribedByElements=[...i,r(this,Le)]},tf=function(){let e=r(this,Cn);if(!(!e||!r(this,Le))){if(r(this,hr))r(this,hr).disconnect(),g(this,hr,void 0),r(this,dr).length?e.setAttribute("aria-describedby",r(this,dr).join(" ")):e.removeAttribute("aria-describedby"),g(this,dr,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(i=>i&&i!==r(this,Le).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,Cn,void 0)}},Ti=new WeakMap,Tn.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},Tn.styles=[E,w`
|
|
2103
2103
|
:host { display: inline-block; position: relative; }
|
|
2104
2104
|
.tip {
|
|
2105
2105
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -2116,7 +2116,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2116
2116
|
:host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
2117
2117
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
2118
2118
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
2119
|
-
`];$("cm-tooltip",
|
|
2119
|
+
`];$("cm-tooltip",Tn);var M2=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"}),_2=z("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),D0=7,qc=new Set,Oc;function ky(o,n){n?qc.add(o):qc.delete(o),qc.size&&!Oc&&(Oc=setInterval(()=>qc.forEach(e=>e.requestUpdate()),6e4)),!qc.size&&Oc&&(clearInterval(Oc),Oc=void 0)}var Bc,Es,Nt,rf,ym,Ey,An=class extends C{constructor(){super(...arguments);m(this,Nt);this.icon="";this.tone="neutral";this.heading="";this.datetime="";this.time="";this.meta="";this.lines=3;this.expanded=!1;this._overflow=!1;this._body=!1;this._meta=!1;this._actions=!1;m(this,Bc,N("cm-tl"));m(this,Es)}connectedCallback(){super.connectedCallback(),ky(this,!0)}disconnectedCallback(){super.disconnectedCallback(),ky(this,!1),r(this,Es)?.disconnect(),g(this,Es,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(g(this,Es,new ResizeObserver(()=>a(this,Nt,rf).call(this))),r(this,Es).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&a(this,Nt,rf).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,s=Math.floor(Math.abs(t)/6e4);if(s<1)return this.t("justNow");if(s<60)return this.t(i?"inMinutes":"minutesAgo",{count:s});let l=Math.floor(s/60);if(l<24)return this.t(i?"inHours":"hoursAgo",{count:l});let d=Math.floor(l/24);return d<D0?this.t(i?"inDays":"daysAgo",{count:d}):me(e,{dateStyle:"medium"},this.locale)}get fullTime(){let e=this.date;return e?me(e,{dateStyle:"full",timeStyle:"short"},this.locale):""}render(){let e=this.relativeTime,t=this.fullTime,i=this.tone&&this.tone!=="neutral"?this.tone:"",s=this.lines>0&&!this.expanded,l=e?t?c`<cm-tooltip class="when" content=${t} visual-only placement="top"><time part="time" tabindex="0" datetime=${this.datetime}>${e}<span class="sr">, ${t}</span></time></cm-tooltip>`:c`<time class="when" part="time" datetime=${this.datetime||h}>${e}</time>`:h;return c`<div class="item">
|
|
2120
2120
|
<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>
|
|
2121
2121
|
<div class="main">
|
|
2122
2122
|
<div class="head">
|
|
@@ -2124,14 +2124,14 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2124
2124
|
<slot name="badge"></slot></span>
|
|
2125
2125
|
${l}
|
|
2126
2126
|
</div>
|
|
2127
|
-
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>a(this,
|
|
2128
|
-
<div class="body ${s?"clamp":""}" id="${r(this,
|
|
2129
|
-
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>a(this,
|
|
2127
|
+
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>a(this,Nt,ym).call(this,d,"_meta")}>${this.meta}</slot></div>
|
|
2128
|
+
<div class="body ${s?"clamp":""}" id="${r(this,Bc)}-body" part="body" ?hidden=${!this._body}
|
|
2129
|
+
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>a(this,Nt,ym).call(this,d,"_body")}></slot></div>
|
|
2130
2130
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
2131
|
-
aria-controls="${r(this,
|
|
2132
|
-
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>a(this,
|
|
2131
|
+
aria-controls="${r(this,Bc)}-body" @click=${a(this,Nt,Ey)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
2132
|
+
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>a(this,Nt,ym).call(this,d,"_actions")}></slot></div>
|
|
2133
2133
|
</div>
|
|
2134
|
-
</div>`}};
|
|
2134
|
+
</div>`}};Bc=new WeakMap,Es=new WeakMap,Nt=new WeakSet,rf=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},ym=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(s=>s.nodeType===Node.ELEMENT_NODE||(s.textContent??"").trim())},Ey=function(){this.expanded=!this.expanded},An.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}},An.styles=[E,w`
|
|
2135
2135
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
2136
2136
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
2137
2137
|
.icon {
|
|
@@ -2176,16 +2176,16 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2176
2176
|
[hidden] { display: none !important; }
|
|
2177
2177
|
.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; }
|
|
2178
2178
|
::slotted([slot='badge']) { flex: none; }
|
|
2179
|
-
`];$("cm-timeline-item",
|
|
2179
|
+
`];$("cm-timeline-item",An);var Fc,Dn,Ms,sf,My,ks=class extends C{constructor(){super(...arguments);m(this,Ms);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];m(this,Fc,new MutationObserver(()=>a(this,Ms,sf).call(this)));m(this,Dn,!1)}connectedCallback(){super.connectedCallback(),a(this,Ms,sf).call(this),r(this,Fc).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Fc).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){g(this,Dn,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach((i,s)=>{this._items[s]&&i.assign(this._items[s])});let t=this.renderRoot.querySelector("slot.empty");t&&t.assign(...this._empty),r(this,Dn)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,Dn,!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">
|
|
2180
2180
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
2181
2181
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
2182
2182
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
2183
2183
|
</ol>`:h}
|
|
2184
2184
|
${i}
|
|
2185
2185
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
2186
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${a(this,
|
|
2186
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${a(this,Ms,My)}>${this.moreLabel}</cm-button></div>`:h}
|
|
2187
2187
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
2188
|
-
`}};
|
|
2188
|
+
`}};Fc=new WeakMap,Dn=new WeakMap,Ms=new WeakSet,sf=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},My=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},ks.shadowRootOptions={...A.shadowRootOptions,slotAssignment:"manual"},ks.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}},ks.styles=[E,w`
|
|
2189
2189
|
:host { display: block; }
|
|
2190
2190
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
2191
2191
|
ol:focus { outline: none; }
|
|
@@ -2208,14 +2208,14 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2208
2208
|
@media (max-width: 640px) {
|
|
2209
2209
|
.more { padding-inline-start: 0; }
|
|
2210
2210
|
}
|
|
2211
|
-
`];$("cm-timeline"
|
|
2211
|
+
`];$("cm-timeline",ks);var A2=z("smartTip",{newTab:"(opens in a new tab)"}),D2=z("smartTips",{heading:"Smart tips",tourAction:"Start"}),Rn=class extends C{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}>
|
|
2212
2212
|
<span class="text">
|
|
2213
2213
|
<span class="title" part="heading">${this.heading}</span>
|
|
2214
2214
|
<span class="desc" part="description"><slot></slot></span>
|
|
2215
2215
|
${e?c`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">${this.t("newTab")}</span>`:h}
|
|
2216
2216
|
</span>
|
|
2217
2217
|
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
2218
|
-
</a>`}};
|
|
2218
|
+
</a>`}};Rn.properties={heading:{},href:{},target:{}},Rn.styles=[E,w`
|
|
2219
2219
|
:host { display: block; }
|
|
2220
2220
|
a {
|
|
2221
2221
|
display: flex; align-items: flex-start; gap: var(--cm-space-8); padding: var(--cm-space-16);
|
|
@@ -2232,7 +2232,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2232
2232
|
}
|
|
2233
2233
|
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
2234
2234
|
a:hover .title { text-decoration: underline; }
|
|
2235
|
-
`];$("cm-smart-tip",
|
|
2235
|
+
`];$("cm-smart-tip",Rn);var Hn=class extends C{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">
|
|
2236
2236
|
${this.tourHeading?c`<div class="tour" part="tour">
|
|
2237
2237
|
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="16"></cm-icon>
|
|
2238
2238
|
</span>
|
|
@@ -2243,7 +2243,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2243
2243
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
2244
2244
|
<div class="list" role="list"><slot></slot></div>
|
|
2245
2245
|
</section>
|
|
2246
|
-
</div>`}};
|
|
2246
|
+
</div>`}};Hn.properties={heading:{string:"heading"},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action",string:"tourAction"},headingLevel:{type:Number,attribute:"heading-level"}},Hn.styles=[E,w`
|
|
2247
2247
|
:host { display: block; }
|
|
2248
2248
|
.card { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
2249
2249
|
.tour {
|
|
@@ -2260,24 +2260,24 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2260
2260
|
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;
|
|
2261
2261
|
}
|
|
2262
2262
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
2263
|
-
`];$("cm-smart-tips",
|
|
2263
|
+
`];$("cm-smart-tips",Hn);var I2=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"}),Ci,Pn,_y,Ty,Nn=class extends C{constructor(){super(...arguments);m(this,Pn);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;m(this,Ci,N("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,s=Math.min(this.total,t*this.pageSize),l=this.pageSizes??[];return c`
|
|
2264
2264
|
<nav part="bar" aria-label=${this.label}>
|
|
2265
2265
|
${l.length?c`<div class="rows" part="rows">
|
|
2266
|
-
<label for="${r(this,
|
|
2267
|
-
<span class="field"><select id="${r(this,
|
|
2266
|
+
<label for="${r(this,Ci)}-s">${this.t("rows")}</label>
|
|
2267
|
+
<span class="field"><select id="${r(this,Ci)}-s" @change=${a(this,Pn,_y)}>
|
|
2268
2268
|
${(l.includes(this.pageSize)?l:[...l,this.pageSize].sort((d,p)=>d-p)).map(d=>c`<option value=${d} ?selected=${d===this.pageSize}>${d}</option>`)}
|
|
2269
2269
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
2270
2270
|
</div>`:h}
|
|
2271
2271
|
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:i,to:s,total:this.total,resource:this.resourceName}).replace(/\s+/g," ").trim():h}</div>
|
|
2272
2272
|
<div class="pages" part="pages">
|
|
2273
2273
|
<span class="counter">
|
|
2274
|
-
<label for="${r(this,
|
|
2275
|
-
<input id="${r(this,
|
|
2276
|
-
.value=${this._draft??String(t)} aria-describedby="${r(this,
|
|
2274
|
+
<label for="${r(this,Ci)}-p">${this.t("page")}</label>
|
|
2275
|
+
<input id="${r(this,Ci)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
2276
|
+
.value=${this._draft??String(t)} aria-describedby="${r(this,Ci)}-of"
|
|
2277
2277
|
@input=${d=>this._draft=d.target.value}
|
|
2278
|
-
@keydown=${a(this,
|
|
2278
|
+
@keydown=${a(this,Pn,Ty)}
|
|
2279
2279
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
2280
|
-
<span id="${r(this,
|
|
2280
|
+
<span id="${r(this,Ci)}-of">${this.t("of",{count:e})}</span>
|
|
2281
2281
|
</span>
|
|
2282
2282
|
<span class="arrows">
|
|
2283
2283
|
<button class="prev" type="button" part="previous" aria-label=${this.t("previous")} ?disabled=${t<=1}
|
|
@@ -2287,7 +2287,7 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2287
2287
|
</span>
|
|
2288
2288
|
</div>
|
|
2289
2289
|
</nav>
|
|
2290
|
-
`}};
|
|
2290
|
+
`}};Ci=new WeakMap,Pn=new WeakSet,_y=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})))},Ty=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))},Nn.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}},Nn.styles=[E,w`
|
|
2291
2291
|
:host { display: block; }
|
|
2292
2292
|
nav {
|
|
2293
2293
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2330,17 +2330,17 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2330
2330
|
select, input { height: var(--cm-control-height-touch); }
|
|
2331
2331
|
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
2332
2332
|
}
|
|
2333
|
-
`];$("cm-pagination",
|
|
2333
|
+
`];$("cm-pagination",Nn);var j2=z("statusTabs",{label:"Status",option:"{label} ({count})"}),qn,jc,Me,Vc,Cy,af,zy,nf,Sy,In=class extends C{constructor(){super(...arguments);m(this,Me);this.value="";this.tabs=[];this.controls="";this.size="large";this.mobile="scroll";this._more="";m(this,qn,new ResizeObserver(()=>a(this,Me,Vc).call(this)));this._slotted=[];m(this,jc,new MutationObserver(()=>a(this,Me,af).call(this)))}connectedCallback(){super.connectedCallback(),a(this,Me,af).call(this),r(this,jc).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,jc).disconnect(),r(this,qn).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector(".tabs");r(this,qn).observe(e),e.addEventListener("scroll",()=>a(this,Me,Vc).call(this),{passive:!0}),document.fonts?.ready.then(()=>a(this,Me,Vc).call(this))}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){let t=this.renderRoot.querySelector(".pick select");t&&t.offsetParent!==null?t.focus(e):this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(e){a(this,Me,Vc).call(this);for(let s of this.renderRoot.querySelectorAll(".tabs > *"))r(this,qn).observe(s);if(!("ariaControlsElements"in Element.prototype))return;let t=this.getRootNode(),i=this.controls?t.getElementById?.(this.controls):null;for(let s of this.renderRoot.querySelectorAll("button, select"))s.ariaControlsElements=i?[i]:null}render(){let e=this.items,t=a(this,Me,zy).call(this,e),i=this.getAttribute("aria-label")||this.t("label");return c`
|
|
2334
2334
|
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${i}>
|
|
2335
2335
|
${e.map((s,l)=>c`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
2336
2336
|
tabindex=${l===t?"0":"-1"} ?disabled=${!!s.disabled}
|
|
2337
|
-
@click=${()=>a(this,Me,
|
|
2337
|
+
@click=${()=>a(this,Me,nf).call(this,l)} @keydown=${d=>a(this,Me,Sy).call(this,d,l)}><span class="label" data-text=${s.label}>${s.label}</span>${s.count!==void 0&&!Number.isNaN(s.count)?c`<span class="sr">, </span><span class="count" part="count">${this.formatNumber(s.count)}</span>`:h}</button>`)}
|
|
2338
2338
|
</div>
|
|
2339
|
-
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${a(this,Me,
|
|
2339
|
+
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${a(this,Me,Cy)}>
|
|
2340
2340
|
${e.map((s,l)=>c`<option value=${s.value} ?disabled=${!!s.disabled} ?selected=${l===t} .selected=${l===t}>${s.count!==void 0&&!Number.isNaN(s.count)?this.t("option",{label:s.label,count:s.count}):s.label}</option>`)}
|
|
2341
2341
|
</select><cm-icon name="chevron-down" size="16"></cm-icon></div>`:h}
|
|
2342
2342
|
<slot></slot>
|
|
2343
|
-
`}};
|
|
2343
|
+
`}};qn=new WeakMap,jc=new WeakMap,Me=new WeakSet,Vc=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),s=t>1&&i>1,l=t>1&&i<t-1,d=s&&l?"both":s?"start":l?"end":"";d!==this._more&&(this._more=d)},Cy=function(e){let t=e.target.value;t!==this.value&&(this.value=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},af=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??"")},zy=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},nf=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}))))},Sy=function(e,t){let i=se(e,this),s=this.items.flatMap((p,u)=>p.disabled?[]:[u]),l=s.indexOf(t),d;if(i==="ArrowRight")d=s[(l+1)%s.length];else if(i==="ArrowLeft")d=s[(l-1+s.length)%s.length];else if(e.key==="Home")d=s[0];else if(e.key==="End")d=s[s.length-1];else return;e.preventDefault(),d!==void 0&&a(this,Me,nf).call(this,d)},In.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},mobile:{reflect:!0},_slotted:{state:!0},_more:{state:!0}},In.styles=[E,w`
|
|
2344
2344
|
:host { display: block; }
|
|
2345
2345
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
2346
2346
|
.tabs {
|
|
@@ -2399,20 +2399,20 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2399
2399
|
:host([mobile='select']) .tabs { display: none; }
|
|
2400
2400
|
:host([mobile='select']) .pick { display: block; }
|
|
2401
2401
|
}
|
|
2402
|
-
`];$("cm-status-tabs",
|
|
2402
|
+
`];$("cm-status-tabs",In);var X2=z("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),xm,Uc,zi,of,Ly,Ay,On=class extends C{constructor(){super(...arguments);m(this,zi);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;m(this,xm,N("cm-th"));m(this,Uc,new MutationObserver(()=>a(this,zi,of).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),a(this,zi,of).call(this),r(this,Uc).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Uc).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`
|
|
2403
2403
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
2404
2404
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
2405
2405
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
2406
|
-
<input id="${r(this,
|
|
2407
|
-
@change=${a(this,
|
|
2406
|
+
<input id="${r(this,xm)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
2407
|
+
@change=${a(this,zi,Ay)} />
|
|
2408
2408
|
<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>
|
|
2409
2409
|
</span></span>`:h}
|
|
2410
2410
|
${t.map(i=>{let s=this.sort===i.key,l=s?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}
|
|
2411
|
-
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${s?"on":""} @click=${()=>a(this,
|
|
2411
|
+
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${s?"on":""} @click=${()=>a(this,zi,Ly).call(this,i)}>${d}${e?h:c`<span class="sr">${s?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
2412
2412
|
name=${s&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
2413
2413
|
</div>
|
|
2414
2414
|
<slot></slot>
|
|
2415
|
-
`}};
|
|
2415
|
+
`}};xm=new WeakMap,Uc=new WeakMap,zi=new WeakSet,of=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"}})},Ly=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}))},Ay=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}))},On.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}},On.styles=[E,w`
|
|
2416
2416
|
:host { display: block; }
|
|
2417
2417
|
slot { display: none; } /* <option> children are column data, not content */
|
|
2418
2418
|
.bar {
|
|
@@ -2467,10 +2467,10 @@ var hb=o=>{throw TypeError(o)};var su=(o,n,e)=>n.has(o)||hb("Cannot "+e);var r=(
|
|
|
2467
2467
|
:host([resource-rows][mobile='stack']) .bar:not(.sel) { display: flex; flex-wrap: wrap; gap: var(--cm-space-4) var(--cm-space-12); padding-block: var(--cm-space-8); }
|
|
2468
2468
|
:host([resource-rows][mobile='stack']) .bar:not(.sel) > .cell:first-child { flex: 1 1 100%; }
|
|
2469
2469
|
}
|
|
2470
|
-
`];$("cm-table-header",
|
|
2470
|
+
`];$("cm-table-header",On);var R0=`
|
|
2471
2471
|
[data-cm-density="compact"] { --cm-table-row-height: 40px; --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
2472
2472
|
[data-cm-density="comfortable"] { --cm-table-row-height: 48px; --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
|
|
2473
|
-
`,
|
|
2473
|
+
`,wm=null,Dy=new WeakSet;function $m(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(!Dy.has(t)){Dy.add(t);try{wm||(wm=new CSSStyleSheet,wm.replaceSync(R0)),t.adoptedStyleSheets=[...t.adoptedStyleSheets,wm]}catch{}}}var a_=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}"}),Ry=48,Hy=16,Ny=!1,H0=`
|
|
2474
2474
|
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); }
|
|
2475
2475
|
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); }
|
|
2476
2476
|
cm-data-table > table th, cm-data-table > table td { box-sizing: border-box; }
|
|
@@ -2519,52 +2519,52 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2519
2519
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
|
|
2520
2520
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
|
|
2521
2521
|
}
|
|
2522
|
-
`;function
|
|
2522
|
+
`;function N0(){if(Ny||typeof document>"u")return;Ny=!0;let o=new CSSStyleSheet;o.replaceSync(H0),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var Kc=o=>o.type==="numeric"||o.type==="money",P0=o=>(o.align??(Kc(o)||o.type==="actions"?"end":"start"))==="end",I0=o=>!o.type||o.type==="text";function Py(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 Iy=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),qy=new Map;function q0(o){let n=qy.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"})}qy.set(o??"",n)}return n}function Oy(o,n,e,t){let i=s=>s==null||s==="";return i(o)||i(n)?i(o)===i(n)?0:i(o)?1:-1:e==="numeric"||e==="money"?(Py(o)||0)-(Py(n)||0):e==="date"?(Iy(o)||0)-(Iy(n)||0):q0(t).compare(String(o),String(n))}var By=o=>o.parentElement??o.getRootNode().host??null,Kn,Wn,Wc,Gn,_s,Yn,Ts,Tm,S,lf,cf,df,Fy,hf,Vy,jy,Uy,Cs,Bn,Fn,km,Vn,jn,Em,pf,mf,uf,Ky,Wy,gf,ff,Mm,Gy,Yy,Xy,pr,_m,Xn,Jy,Qy,Zy,ex,tx,ix,rx,Un=class extends C{constructor(){super(...arguments);m(this,S);this.columns=[];this.rows=[];this.totals=null;this.caption="";this.captionHidden=!1;this.sort="";this.direction="ascending";this.sortMode="auto";this.stickyHeader=!1;this.stickyFirstColumn=!1;this.loading=!1;this.loadingRows=5;this.mobile="scroll";this.rowActions="hover";this.resizable=!1;this.columnPicker=!1;this._light=!1;this._announce="";this._widths={};this._expanded=new Set;this._picker=!1;this._overflows=!1;m(this,Kn,!1);m(this,Wn,N("cm-dt"));m(this,Wc,new MutationObserver(()=>a(this,S,lf).call(this)));m(this,Gn,typeof ResizeObserver>"u"?null:new ResizeObserver(()=>a(this,S,Bn).call(this)));m(this,_s,[]);m(this,Yn,0);m(this,Ts,-1);m(this,Tm,e=>{e.target?.closest?.("[data-lines]")&&a(this,S,Em).call(this,e)});m(this,Cs,()=>{r(this,Yn)||!this.stickyHeader||g(this,Yn,requestAnimationFrame(()=>{g(this,Yn,0),a(this,S,Bn).call(this)}))});m(this,pr,new xe);m(this,Xn,e=>{let t=this.renderRoot.querySelector(".tools");t&&!e.composedPath().includes(t)&&a(this,S,_m).call(this,!1)})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerover",r(this,Tm)),$m(this),a(this,S,lf).call(this),r(this,Wc).observe(this,{childList:!0,subtree:!0}),document.addEventListener("scroll",r(this,Cs),{capture:!0,passive:!0}),window.addEventListener("resize",r(this,Cs),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,pr).close(),r(this,Wc).disconnect(),r(this,Gn)?.disconnect(),g(this,_s,[]),document.removeEventListener("scroll",r(this,Cs),{capture:!0}),window.removeEventListener("resize",r(this,Cs)),document.removeEventListener("pointerdown",r(this,Xn),{capture:!0})}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(s=>s.key===this.sort);if(!t||this.sortMode==="manual")return e;let i=this.direction==="descending"?-1:1;return e.map((s,l)=>[s,l]).sort(([s,l],[d,p])=>{let u=s[t.key],b=d[t.key],f=u==null||u==="",x=b==null||b==="";return f||x?f===x?l-p:f?1:-1:i*Oy(u,b,t.type,this.locale)||l-p}).map(([s])=>s)}get visibleColumns(){return(this.columns??[]).filter(e=>e.visible!==!1)}updated(e){if(this._picker&&!r(this,pr).active?r(this,pr).open(this.renderRoot.querySelector(".panel"),this.renderRoot.querySelector(".pick"),{align:"end"}):!this._picker&&r(this,pr).active&&r(this,pr).close(),r(this,Kn)&&(e.has("sort")||e.has("direction"))&&this.sort){g(this,Kn,!1);let t=this.columns.find(i=>i.key===this.sort);t&&a(this,S,df).call(this,t.label,this.direction)}if(e.has("columns")){let t=e.get("columns")??[],i={...this._widths},s=!1;for(let l of this.columns??[]){let d=t.find(p=>p.key===l.key);l.width!==void 0&&d?.width!==l.width&&i[l.key]!==void 0&&(delete i[l.key],s=!0)}s&&(this._widths=i)}a(this,S,Uy).call(this),a(this,S,Bn).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>`,s=this.stickyHeader||this.stickyFirstColumn||this._overflows;if(this._light)return c`<div class="frame" part="frame"><div class="wrap"><div class="scroll" part="scroll" tabindex=${this._overflows?"0":h}
|
|
2523
2523
|
role=${this._overflows?"region":h} aria-label=${this._overflows?this.querySelector("caption")?.textContent?.trim()||h:h}
|
|
2524
|
-
@scroll=${()=>a(this,S,
|
|
2524
|
+
@scroll=${()=>a(this,S,Bn).call(this)}><slot></slot></div>${i}</div>${t}</div>${e}`;let l=this.visibleColumns,d=a(this,S,mf).call(this,l),p=this.mobile==="priority"?l.filter(v=>v.priority==="low"&&v!==d):[],u=this.sortedRows,b=Math.max(1,l.length),f=!this.loading&&u.length===0,x=this.mobile==="cards"&&!this.loading&&u.length>0;return c`
|
|
2525
2525
|
<div class="frame" part="frame" ?data-cards=${x}>
|
|
2526
|
-
${this.columnPicker?a(this,S,
|
|
2526
|
+
${this.columnPicker?a(this,S,Zy).call(this):h}
|
|
2527
2527
|
<div class="wrap">
|
|
2528
2528
|
<div class="scroll" part="scroll" tabindex=${s?"0":h}
|
|
2529
2529
|
role=${s?"region":h}
|
|
2530
|
-
aria-label=${s&&this.caption?this.caption:h} @scroll=${()=>a(this,S,
|
|
2531
|
-
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${a(this,S,
|
|
2532
|
-
@focusout=${a(this,S,
|
|
2530
|
+
aria-label=${s&&this.caption?this.caption:h} @scroll=${()=>a(this,S,Bn).call(this)}>
|
|
2531
|
+
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${a(this,S,Em)} @focusin=${a(this,S,pf)}
|
|
2532
|
+
@focusout=${a(this,S,pf)}>
|
|
2533
2533
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
2534
|
-
<thead><tr>${l.map(v=>a(this,S,
|
|
2534
|
+
<thead><tr>${l.map(v=>a(this,S,ex).call(this,v,d))}</tr></thead>
|
|
2535
2535
|
<tbody>
|
|
2536
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(v=>c`<td class=${a(this,S,
|
|
2536
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(v=>c`<td class=${a(this,S,Vn).call(this,v,d)} style=${a(this,S,jn).call(this,v)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((v,k)=>a(this,S,tx).call(this,v,l,d,p,k))}
|
|
2537
2537
|
${f?c`<tr class="empty"><td colspan=${b}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
2538
2538
|
</tbody>
|
|
2539
|
-
${this.totals&&!this.loading&&!f?c`<tfoot><tr part="totals">${l.map(v=>c`<td class=${a(this,S,
|
|
2539
|
+
${this.totals&&!this.loading&&!f?c`<tfoot><tr part="totals">${l.map(v=>c`<td class=${a(this,S,Vn).call(this,v,d)} style=${a(this,S,jn).call(this,v)}>${v.type==="actions"?h:a(this,S,Fn).call(this,this.totals[v.key])}</td>`)}</tr></tfoot>`:h}
|
|
2540
2540
|
</table>
|
|
2541
2541
|
</div>
|
|
2542
2542
|
${i}
|
|
2543
2543
|
</div>
|
|
2544
2544
|
${t}
|
|
2545
|
-
${x?a(this,S,
|
|
2545
|
+
${x?a(this,S,rx).call(this,u,l,d):h}
|
|
2546
2546
|
</div>${e}
|
|
2547
|
-
`}};
|
|
2547
|
+
`}};Kn=new WeakMap,Wn=new WeakMap,Wc=new WeakMap,Gn=new WeakMap,_s=new WeakMap,Yn=new WeakMap,Ts=new WeakMap,Tm=new WeakMap,S=new WeakSet,lf=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(N0(),a(this,S,Fy).call(this))},cf=function(e){this._announce=this._announce===e?`${e}\xA0`:e},df=function(e,t){a(this,S,cf).call(this,this.t("sorted",{column:e,direction:this.t(t)}))},Fy=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;if(!t)return;let i=[...t];i.forEach((s,l)=>{if(!s.dataset.sort||s.querySelector(":scope > button.cm-sort"))return;s.dataset.type=s.dataset.sort;let d=document.createElement("button");d.type="button",d.className="cm-sort",d.append(...s.childNodes);let p=document.createElement("cm-icon");p.setAttribute("size","12"),d.append(p),s.append(d),s.hasAttribute("aria-sort")||s.setAttribute("aria-sort","none"),a(this,S,hf).call(this,s),d.addEventListener("click",()=>a(this,S,Vy).call(this,e,s,l))});for(let s of[...e.tBodies,...e.tFoot?[e.tFoot]:[]])for(let l of s.rows)[...l.cells].forEach((d,p)=>{let u=i[p];u&&(d.dataset.label||(d.dataset.label=(u.textContent??"").trim()),u.dataset.priority&&!d.dataset.priority&&(d.dataset.priority=u.dataset.priority),u.dataset.type==="actions"&&!d.dataset.type&&(d.dataset.type="actions"))})},hf=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Vy=function(e,t,i){let s=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),l=t.dataset.key||s,d=t.getAttribute("aria-sort")==="ascending"?"descending":"ascending",p=new CustomEvent("cm-sort",{detail:{key:l,direction:d},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(p)||this.sortMode==="manual")return;let u=t.dataset.sort,b=d==="descending"?-1:1;for(let f of e.tBodies){let x=k=>{let L=k.cells[i];return L?(L.dataset.value??L.textContent??"").trim():""},v=[...f.rows].map((k,L)=>[k,x(k),L]).sort(([,k,L],[,P,U])=>k===""||P===""?k===P?L-U:k===""?1:-1:b*Oy(k,P,u,this.locale)||L-U);f.append(...v.map(([k])=>k))}for(let f of e.tHead.rows[0].cells)f.dataset.sort&&(f.setAttribute("aria-sort",f===t?d:"none"),a(this,S,hf).call(this,f));a(this,S,df).call(this,s,d)},jy=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}),s=this.dispatchEvent(i);g(this,Kn,s),s&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},Uy=function(){let e=[this.renderRoot.querySelector(".scroll"),this.renderRoot.querySelector("table")??this.querySelector(":scope > table")].filter(Boolean);e.length===r(this,_s).length&&e.every((t,i)=>t===r(this,_s)[i])||(r(this,Gn)?.disconnect(),e.forEach(t=>r(this,Gn)?.observe(t)),g(this,_s,e))},Cs=new WeakMap,Bn=function(){let e=this.renderRoot?.querySelector(".scroll"),t=this.renderRoot?.querySelector(".frame");if(!e||!t)return;let i=getComputedStyle(e).maxBlockSize!=="none",s=e.scrollWidth>e.clientWidth+1;s!==this._overflows&&(this._overflows=s),e.toggleAttribute("data-open",this.stickyHeader&&!i&&!s);let l=Math.abs(e.scrollLeft);t.toggleAttribute("data-more-start",s&&l>1),t.toggleAttribute("data-more-end",s&&l+e.clientWidth<e.scrollWidth-1);let d=this.renderRoot.querySelector("caption")??this.querySelector(":scope > table > caption"),p=d&&getComputedStyle(d).position!=="absolute"?`${d.offsetHeight}px`:"";e.parentElement.style.getPropertyValue("--_cap")!==p&&e.parentElement.style.setProperty("--_cap",p);let u=0,b=this.renderRoot.querySelector("table")??this.querySelector(":scope > table"),f=b?.tHead;if(this.stickyHeader&&!i&&s&&b&&f){let x=r(this,Ts)>0?r(this,Ts):0,v=f.getBoundingClientRect().top-x,k=b.getBoundingClientRect().bottom-x,L=0;for(let P=By(this);P&&P!==document.documentElement&&P!==document.body;P=By(P)){let U=getComputedStyle(P);/(auto|scroll|overlay|hidden|clip)/.test(U.overflowY)&&(L=Math.max(L,P.getBoundingClientRect().top+P.clientTop+(parseFloat(U.paddingTop)||0)))}L+=parseFloat(getComputedStyle(this).getPropertyValue("--cm-data-table-sticky-top"))||0,u=Math.max(0,Math.min(L-v,k-v-f.getBoundingClientRect().height))}for(let x of this.renderRoot.querySelectorAll(".rz")){let v=String(Math.round(x.closest("th").getBoundingClientRect().width));x.getAttribute("aria-valuenow")!==v&&x.setAttribute("aria-valuenow",v)}u!==r(this,Ts)&&(g(this,Ts,u),u?e.style.setProperty("--_shift",`${u}px`):e.style.removeProperty("--_shift"))},Fn=function(e){return e==null?"":e instanceof Date?me(e,{},this.locale):String(e)},km=function(e){return this._widths[e.key]??e.width},Vn=function(e,t){return[P0(e)&&"end",Kc(e)&&"num",(Kc(e)||e.type==="date")&&"nw",e.type==="actions"&&"act",e.priority==="low"&&e!==t&&"low",a(this,S,km).call(this,e)!==void 0&&"w"].filter(Boolean).join(" ")},jn=function(e){let t=a(this,S,km).call(this,e);return t===void 0?h:`--_w: ${t}px`},Em=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"))},pf=function(e){e.type==="focusin"&&a(this,S,Em).call(this,e);let t=e.composedPath().find(s=>s instanceof HTMLTableRowElement);if(!t)return;let i=e.type==="focusin"||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget);t.toggleAttribute("data-focus",i)},mf=function(e){return e.find(t=>t.primary)??e.find(t=>t.type!=="actions")??e[0]},uf=function(e,t){return t?a(this,S,Fn).call(this,e[t.key]):""},Ky=function(e,t){let i=t[e.key];return Array.isArray(i)?i:e.actions??[]},Wy=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}))},gf=function(e,t,i){return c`<span class="acts">${a(this,S,Ky).call(this,e,t).map(s=>c`<cm-button size="slim" icon=${s.icon??h}
|
|
2548
2548
|
?icon-only=${!!s.iconOnly} label=${s.iconOnly?this.t("rowAction",{action:s.label,name:i}):h} tone=${s.tone??h}
|
|
2549
|
-
@click=${()=>a(this,S,
|
|
2550
|
-
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,
|
|
2551
|
-
@click=${()=>a(this,S,
|
|
2552
|
-
<fieldset class="panel" id="${r(this,
|
|
2549
|
+
@click=${()=>a(this,S,Wy).call(this,s,t)}>${s.label}${s.iconOnly||!i?h:c`<span class="sr">, ${i}</span>`}</cm-button>`)}</span>`},ff=function(e,t,i){if(e.type==="actions")return a(this,S,gf).call(this,e,t,i);let s=a(this,S,Fn).call(this,t[e.key]);if(!I0(e))return s;let l=Math.trunc(Number(e.lines))||0;return l>1?c`<span class="t lines" style="--_lines: ${l}">${s}</span>`:c`<span class="t">${s}</span>`},Mm=function(e,t,i){let s=Math.max(Ry,Math.round(t));this._widths={...this._widths,[e.key]:s},i&&(a(this,S,cf).call(this,this.t("resized",{column:e.label,width:s})),this.dispatchEvent(new CustomEvent("cm-column-resize",{detail:{key:e.key,width:s},bubbles:!0,composed:!0})))},Gy=function(e,t){return a(this,S,km).call(this,e)??Math.round(t.closest("th").getBoundingClientRect().width)},Yy=function(e,t){let i=se(e,this);i!=="ArrowLeft"&&i!=="ArrowRight"||(e.preventDefault(),a(this,S,Mm).call(this,t,a(this,S,Gy).call(this,t,e.currentTarget)+(i==="ArrowRight"?Hy:-Hy),!0))},Xy=function(e,t){if(e.button!==0)return;e.preventDefault();let i=e.currentTarget,s=i.closest("th").getBoundingClientRect().width,l=e.clientX,d=getComputedStyle(this).direction==="rtl";try{i.setPointerCapture(e.pointerId)}catch{}i.setAttribute("data-dragging","");let p=s,u=f=>{p=s+(f.clientX-l)*(d?-1:1),a(this,S,Mm).call(this,t,p,!1)},b=()=>{i.removeEventListener("pointermove",u),i.removeEventListener("pointerup",b),i.removeEventListener("pointercancel",b),i.removeAttribute("data-dragging"),a(this,S,Mm).call(this,t,p,!0)};i.addEventListener("pointermove",u),i.addEventListener("pointerup",b),i.addEventListener("pointercancel",b)},pr=new WeakMap,_m=function(e=!this._picker){this._picker=e,e?document.addEventListener("pointerdown",r(this,Xn),{capture:!0}):document.removeEventListener("pointerdown",r(this,Xn),{capture:!0})},Xn=new WeakMap,Jy=function(e){e.key!=="Escape"||!this._picker||(e.stopPropagation(),a(this,S,_m).call(this,!1),this.renderRoot.querySelector(".pick")?.focus())},Qy=function(e,t){let i=this.columns.map(s=>s.key===e?{...s,visible:t}:s);this.columns=i,this.dispatchEvent(new CustomEvent("cm-columns-change",{detail:{key:e,visible:t,columns:i},bubbles:!0,composed:!0}))},Zy=function(){let e=this.columns??[],t=a(this,S,mf).call(this,this.visibleColumns);return c`<div class="tools" part="tools" @keydown=${a(this,S,Jy)}>
|
|
2550
|
+
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,Wn)}-cols"
|
|
2551
|
+
@click=${()=>a(this,S,_m).call(this)}>${this.t("columns")}<cm-icon name="chevron-down" size="16" aria-hidden="true"></cm-icon></button>
|
|
2552
|
+
<fieldset class="panel" id="${r(this,Wn)}-cols" part="column-panel" ?hidden=${!this._picker}>
|
|
2553
2553
|
<legend class="sr">${this.t("showColumns")}</legend>
|
|
2554
2554
|
${e.map(i=>c`<label class="opt"><input type="checkbox" .checked=${i.visible!==!1} ?disabled=${i===t}
|
|
2555
|
-
@change=${s=>a(this,S,
|
|
2555
|
+
@change=${s=>a(this,S,Qy).call(this,i.key,s.target.checked)} />${i.label}</label>`)}
|
|
2556
2556
|
</fieldset>
|
|
2557
|
-
</div>`},
|
|
2557
|
+
</div>`},ex=function(e,t){let i=this.sort===e.key,s=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=${a(this,S,Vn).call(this,e,t)} style=${a(this,S,jn).call(this,e)} aria-sort=${e.sortable?s:h}><div class="h">${e.sortable?c`<button type="button" class="sort ${i?"on":""}" @click=${()=>a(this,S,jy).call(this,e)}>${d}<cm-icon
|
|
2558
2558
|
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})}
|
|
2559
|
-
aria-valuemin=${
|
|
2560
|
-
@keydown=${p=>a(this,S,
|
|
2561
|
-
@click=${()=>a(this,S,
|
|
2562
|
-
<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${
|
|
2559
|
+
aria-valuemin=${Ry} aria-valuemax="1600"
|
|
2560
|
+
@keydown=${p=>a(this,S,Yy).call(this,p,e)} @pointerdown=${p=>a(this,S,Xy).call(this,p,e)}></span>`:h}</div></th>`},tx=function(e,t,i,s,l){let d=a(this,S,uf).call(this,e,i),p=this._expanded.has(e),u=`${r(this,Wn)}-more-${l}`,b=c`<tr part="row">${t.map(f=>f===i?c`<th scope="row" class=${a(this,S,Vn).call(this,f,i)} style=${a(this,S,jn).call(this,f)} part="cell">${a(this,S,ff).call(this,f,e,d)}${s.length?c`<button type="button" class="more-btn" aria-expanded=${p?"true":"false"} aria-controls=${u}
|
|
2561
|
+
@click=${()=>a(this,S,ix).call(this,e)}>${this.t(p?"viewLess":"viewAll")}</button>`:h}</th>`:c`<td class=${a(this,S,Vn).call(this,f,i)} style=${a(this,S,jn).call(this,f)} part="cell">${a(this,S,ff).call(this,f,e,d)}</td>`)}</tr>`;return c`${b}${s.length&&p?c`<tr class="more" id=${u} part="row-details"><td colspan=${t.length-s.length}>
|
|
2562
|
+
<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${Kc(f)?"num":""}>${a(this,S,Fn).call(this,e[f.key])}</dd>`)}</dl></td></tr>`:h}`},ix=function(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t},rx=function(e,t,i){let s=t.filter(p=>p!==i&&p.type!=="actions"),l=t.filter(p=>p.type==="actions"),d=(p,u=!1)=>{let b=a(this,S,uf).call(this,p,i);return c`<li class="card ${u?"total":""}" part="card">
|
|
2563
2563
|
<p class="card-title">${b}</p>
|
|
2564
|
-
${s.length?c`<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${
|
|
2565
|
-
${!u&&l.length?c`<div class="card-actions">${l.map(f=>a(this,S,
|
|
2564
|
+
${s.length?c`<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${Kc(f)?"num":""}>${a(this,S,Fn).call(this,p[f.key])}</dd>`)}</dl>`:h}
|
|
2565
|
+
${!u&&l.length?c`<div class="card-actions">${l.map(f=>a(this,S,gf).call(this,f,p,b))}</div>`:h}
|
|
2566
2566
|
</li>`};return c`${this.caption?c`<p class="cards-caption" aria-hidden="true">${this.caption}</p>`:h}
|
|
2567
|
-
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(p=>d(p))}${this.totals?d(this.totals,!0):h}</ul>`},
|
|
2567
|
+
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(p=>d(p))}${this.totals?d(this.totals,!0):h}</ul>`},Un.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}},Un.styles=[E,Pe,w`
|
|
2568
2568
|
:host { display: block; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
2569
2569
|
:host([density='compact']) { --cm-table-row-height: 40px; }
|
|
2570
2570
|
:host([density='comfortable']) { --cm-table-row-height: 48px; }
|
|
@@ -2724,7 +2724,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2724
2724
|
:host([mobile='priority']) tr.more { display: table-row; }
|
|
2725
2725
|
}
|
|
2726
2726
|
@media (forced-colors: active) { button.sort cm-icon { opacity: 1; } .acts { opacity: 1 !important; } }
|
|
2727
|
-
`];$("cm-data-table",
|
|
2727
|
+
`];$("cm-data-table",Un);var p_=z("resourceItem",{select:"Select {name}"}),m_=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}"}),sx=w`
|
|
2728
2728
|
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
2729
2729
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
2730
2730
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -2736,17 +2736,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2736
2736
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
2737
2737
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2738
2738
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
2739
|
-
`,
|
|
2739
|
+
`,zm,eo,ax,nx,Qn=class extends C{constructor(){super();m(this,eo);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;this.columns=!1;this.actions="auto";this._hasActions=!1;m(this,zm,this.attachInternals());r(this,zm).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`
|
|
2740
2740
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
2741
|
-
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${a(this,
|
|
2741
|
+
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${a(this,eo,nx)}>
|
|
2742
2742
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
2743
2743
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
2744
2744
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
2745
2745
|
<span class="media"><slot name="media"></slot></span>
|
|
2746
2746
|
<div class="content" part="content"><slot></slot></div>
|
|
2747
|
-
<div class="actions" part="actions"><slot name="actions" @slotchange=${a(this,
|
|
2747
|
+
<div class="actions" part="actions"><slot name="actions" @slotchange=${a(this,eo,ax)}></slot></div>
|
|
2748
2748
|
</div>
|
|
2749
|
-
`}};
|
|
2749
|
+
`}};zm=new WeakMap,eo=new WeakSet,ax=function(e){this._hasActions=e.target.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim())},nx=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()},Qn.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0},columns:{type:Boolean,reflect:!0},mobile:{reflect:!0},actions:{reflect:!0},_hasActions:{state:!0}},Qn.styles=[E,sx,w`
|
|
2750
2750
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2751
2751
|
:host(:last-child) { border-bottom: 0; }
|
|
2752
2752
|
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
|
|
@@ -2797,18 +2797,18 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2797
2797
|
:host([columns][mobile='stack']) ::slotted(*) { overflow-wrap: break-word; }
|
|
2798
2798
|
:host([columns][mobile='stack']) ::slotted(:first-child) { flex: 1 1 100%; }
|
|
2799
2799
|
}
|
|
2800
|
-
`];$("cm-resource-item",
|
|
2800
|
+
`];$("cm-resource-item",Qn);var Gc,Yc,Re,ox,bf,Sm,Lm,Jn,Cm,Am,Zn=class extends C{constructor(){super();m(this,Re);this.selectable=!1;this.total=0;this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this.mobile="columns";this._count=0;this._rows=0;this._hasHeader=!1;this._hasTable=!1;this._hasActions=!1;m(this,Gc,N("cm-rl"));m(this,Yc,new Set);m(this,Sm,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,a(this,Re,bf).call(this,t)});m(this,Lm,e=>{this._hasActions=e.target.assignedElements().length>0});m(this,Am,e=>{e.stopPropagation();let t=e.detail.value;t==="page"?this.selectPage(!0):t==="all"?this.selectAll():t==="none"&&this.clearSelection()});this.addEventListener("cm-resource-select",e=>{e.target!==this&&(this.allSelected=!1,a(this,Re,Jn).call(this),a(this,Re,Cm).call(this))})}connectedCallback(){super.connectedCallback(),$m(this)}get items(){return[...this.querySelectorAll(":scope > cm-resource-item")]}get selected(){return this.items.filter(e=>e.selected).map(e=>e.value)}selectPage(e=!0){this.items.forEach(t=>{t.disabled||(t.selected=e)}),e||(this.allSelected=!1),a(this,Re,Jn).call(this),a(this,Re,Cm).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,a(this,Re,Jn).call(this),a(this,Re,Cm).call(this)}clearSelection(){this.selectPage(!1)}updated(e){(e.has("selectable")||e.has("mobile"))&&(a(this,Re,Jn).call(this),a(this,Re,bf).call(this))}render(){let e=this._count,t=this._rows,i=this.items.filter(k=>!k.disabled).length,s=i>0&&e>=i,l=a(this,Re,ox).call(this),d=k=>mh(k,this.locale)==="one"?this.resourceName:l,p=this.total>t,u=h;this.allSelected?u=c`${this.t("allSelected",{count:Math.max(this.total,e),resource:l})} <button type="button" @click=${()=>this.clearSelection()}>${this.t("clearSelection")}</button>`:e&&(u=c`${this.t("selected",{count:e,resource:d(e)})}${s&&p?c` <button type="button" @click=${()=>this.selectAll()}>${this.t("selectAll",{count:this.total,resource:l})}</button>`:h}`);let b=e>0||this.allSelected,f=this._hasTable,x=!this.hideSelectMenu&&(!f||b),v=c`<slot name="actions" @slotchange=${r(this,Lm)}></slot>`;return c`
|
|
2801
2801
|
${this.selectable&&f?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${v}</div>`:h}
|
|
2802
2802
|
<div class="head ${this.selectable||this._hasHeader?"on":""} ${f?"over":""}">
|
|
2803
|
-
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,
|
|
2803
|
+
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,Sm)}></slot></div>
|
|
2804
2804
|
${this.selectable?c`<div class="toolbar ${f?"over":""} ${b?"busy":""}" part="toolbar">
|
|
2805
2805
|
<span class="select" part="select">
|
|
2806
|
-
<span class="check"><input id="${r(this,
|
|
2806
|
+
<span class="check"><input id="${r(this,Gc)}-all" type="checkbox" .checked=${s} .indeterminate=${e>0&&!s}
|
|
2807
2807
|
?disabled=${!i} @change=${k=>this.selectPage(k.target.checked)} />
|
|
2808
2808
|
<span class="box" aria-hidden="true">${e>0&&!s?c`<span class="dash"></span>`:s?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>
|
|
2809
2809
|
${this.hideSelectMenu?h:c`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")} ?hidden=${!x}
|
|
2810
|
-
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...p?[{label:this.t("selectAll",{count:this.total,resource:l}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${r(this,
|
|
2811
|
-
<label for="${r(this,
|
|
2810
|
+
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...p?[{label:this.t("selectAll",{count:this.total,resource:l}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${r(this,Am)}></cm-action-menu>`}
|
|
2811
|
+
<label for="${r(this,Gc)}-all" class=${f||b?"sr":"label"}>${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:d(t)})}</span></label>
|
|
2812
2812
|
</span>
|
|
2813
2813
|
<span class="status" part="status" role="status">${u}</span>
|
|
2814
2814
|
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
@@ -2817,12 +2817,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2817
2817
|
</div>
|
|
2818
2818
|
<div class="body">
|
|
2819
2819
|
<div class="list" part="list" role="list" aria-label=${this.label||l.replace(/^./,k=>k.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
2820
|
-
<slot @slotchange=${()=>a(this,Re,
|
|
2820
|
+
<slot @slotchange=${()=>a(this,Re,Jn).call(this)}></slot>
|
|
2821
2821
|
</div>
|
|
2822
2822
|
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
2823
2823
|
</div>
|
|
2824
2824
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
2825
|
-
`}};
|
|
2825
|
+
`}};Gc=new WeakMap,Yc=new WeakMap,Re=new WeakSet,ox=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},bf=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(s=>t.add(s));for(let i of r(this,Yc))t.has(i)||(i.removeAttribute("resource-rows"),i.removeAttribute("mobile"));for(let i of t)i.setAttribute("resource-rows",this.selectable?"selectable":"plain"),this.mobile==="stack"?i.setAttribute("mobile","stack"):i.removeAttribute("mobile");g(this,Yc,t),this._hasTable=t.size>0},Sm=new WeakMap,Lm=new WeakMap,Jn=function(){let e=this.items;e.forEach(t=>{t.selectable=this.selectable,t.mobile=this.mobile==="stack"?"stack":void 0}),this._rows=e.length,this._count=e.filter(t=>t.selected).length},Cm=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},Am=new WeakMap,Zn.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name",string:"resourceName"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},density:{reflect:!0},mobile:{reflect:!0},_count:{state:!0},_rows:{state:!0},_hasHeader:{state:!0},_hasTable:{state:!0},_hasActions:{state:!0}},Zn.styles=[E,sx,w`
|
|
2826
2826
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); --_cm-row-inset: var(--_pad); }
|
|
2827
2827
|
/* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
|
|
2828
2828
|
:host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
@@ -2880,12 +2880,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2880
2880
|
.toolbar .check { width: 20px; height: 20px; }
|
|
2881
2881
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
2882
2882
|
}
|
|
2883
|
-
`];$("cm-resource-list",
|
|
2884
|
-
<div class="row" part="row" @dragover=${a(this,he,
|
|
2883
|
+
`];$("cm-resource-list",Zn);var y_=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}."}),x_=z("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),Rm,he,vf,yf,lx,cx,mr,dx,hx,px,xf,mx,Pt=class Pt extends C{constructor(){super();m(this,he);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;m(this,Rm,this.attachInternals());m(this,mr,!1);r(this,Rm).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 s=e.items,l=Math.max(0,Math.min(s.length,t??s.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,s[l]??null),e.announce(this.t("movedTo",{label:this.label,list:e.heading,position:l+1,total:s.length+1})),!0):!1}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,i=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===i)return!1;let s=new CustomEvent("cm-reorder",{detail:{item:this,from:i,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(s))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`
|
|
2884
|
+
<div class="row" part="row" @dragover=${a(this,he,px)} @dragleave=${a(this,he,xf)} @drop=${a(this,he,mx)}>
|
|
2885
2885
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
2886
2886
|
aria-describedby="hint"
|
|
2887
|
-
@keydown=${a(this,he,
|
|
2888
|
-
@dragend=${()=>{this.classList.remove("dragging"),
|
|
2887
|
+
@keydown=${a(this,he,lx)} @dragstart=${a(this,he,cx)} @pointerdown=${a(this,he,dx)}
|
|
2888
|
+
@dragend=${()=>{this.classList.remove("dragging"),Pt.dragged=null,Xc(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
2889
2889
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
2890
2890
|
<span class="label" part="label">${this.label}</span>
|
|
2891
2891
|
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
@@ -2893,7 +2893,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2893
2893
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
2894
2894
|
<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>
|
|
2895
2895
|
</div>
|
|
2896
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};
|
|
2896
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};Rm=new WeakMap,he=new WeakSet,vf=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)):[]},yf=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},lx=function(e){let t=this.siblings.indexOf(this),i=e.key==="ArrowUp",s=e.key==="ArrowDown";if(i&&t===0||s&&t===this.siblings.length-1){let d=r(this,he,vf),p=d[d.indexOf(this.list)+(i?-1:1)];if(p){e.preventDefault(),this.moveToList(p,i?p.items.length:0)&&a(this,he,yf).call(this);return}}let l;if(e.key==="ArrowUp")l=t-1;else if(e.key==="ArrowDown")l=t+1;else if(e.key==="Home")l=0;else if(e.key==="End")l=this.siblings.length-1;else return;e.preventDefault(),this.moveTo(l)&&a(this,he,yf).call(this)},cx=function(e){if(e.stopPropagation(),r(this,mr)){e.preventDefault();return}Pt.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},mr=new WeakMap,dx=function(e){if(e.pointerType==="mouse"||!e.isPrimary)return;let t=e.clientY,i=null,s=d=>{if(d.pointerId===e.pointerId){if(!r(this,mr)){if(Math.abs(d.clientY-t)<6)return;g(this,mr,!0),Pt.dragged=this,this.classList.add("dragging")}d.preventDefault(),i=a(this,he,hx).call(this,d.clientX,d.clientY),Xc(this,i)}},l=d=>{if(d.pointerId!==e.pointerId)return;document.removeEventListener("pointermove",s,!0),document.removeEventListener("pointerup",l,!0),document.removeEventListener("pointercancel",l,!0);let p=r(this,mr);g(this,mr,!1),Pt.dragged=null,this.classList.remove("dragging"),Xc(this,null),!(!p||d.type==="pointercancel"||!i)&&(i.list?this.moveToList(i.list,i.index):this.moveTo(i.index))};document.addEventListener("pointermove",s,!0),document.addEventListener("pointerup",l,!0),document.addEventListener("pointercancel",l,!0)},hx=function(e,t){for(let i of r(this,he,vf)){if(i===this.list)continue;let s=i.getBoundingClientRect();if(e>=s.left&&e<=s.right&&t>=s.top&&t<=s.bottom)return{list:i,index:Dm(i.items,this,t)}}return{index:Dm(this.siblings,this,t)}},px=function(e){let t=Pt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.renderRoot.querySelector(".row").getBoundingClientRect(),s=e.clientY>i.top+i.height/2;this.classList.toggle("drop-after",s),this.classList.toggle("drop-before",!s)},xf=function(){this.classList.remove("drop-before","drop-after")},mx=function(e){let t=Pt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.classList.contains("drop-after");a(this,he,xf).call(this);let s=this.siblings,l=s.indexOf(t),d=s.indexOf(this)+(i?1:0);d>l&&(d-=1),t.moveTo(d)},Pt.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},Pt.styles=[E,w`
|
|
2897
2897
|
:host { display: block; }
|
|
2898
2898
|
.row {
|
|
2899
2899
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2920,20 +2920,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2920
2920
|
.actions { gap: var(--cm-space-8); }
|
|
2921
2921
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2922
2922
|
}
|
|
2923
|
-
`],
|
|
2923
|
+
`],Pt.dragged=null;var io=Pt;$("cm-nested-item",io);function Dm(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 Xc(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 zs,rt,ux,wf,$f,gx,fx,to=class extends C{constructor(){super(...arguments);m(this,rt);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;m(this,zs,N("cm-nl"))}get items(){return[...this.children].filter(e=>e.localName==="cm-nested-item")}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}willUpdate(){this.hasUpdated||(this._empty=!this.items.length)}updated(e){(e.has("sortable")||e.has("group"))&&a(this,rt,wf).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2924
2924
|
<div class="bar" part="bar">
|
|
2925
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,
|
|
2925
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,zs)}-h">${this.heading}</div>
|
|
2926
2926
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2927
|
-
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
2928
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${a(this,rt,
|
|
2927
|
+
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,zs)}-rows"
|
|
2928
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${a(this,rt,ux)}>
|
|
2929
2929
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2930
2930
|
</div>
|
|
2931
|
-
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,
|
|
2932
|
-
@dragover=${a(this,rt,
|
|
2933
|
-
<slot @slotchange=${()=>{a(this,rt,
|
|
2931
|
+
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,zs)}-rows" role="list" aria-labelledby="${r(this,zs)}-h" ?hidden=${!t}
|
|
2932
|
+
@dragover=${a(this,rt,gx)} @drop=${a(this,rt,fx)}>
|
|
2933
|
+
<slot @slotchange=${()=>{a(this,rt,wf).call(this),this._empty=!this.items.length}}></slot>
|
|
2934
2934
|
</div>
|
|
2935
2935
|
<span class="sr" role="status">${this._msg}</span>
|
|
2936
|
-
`}};
|
|
2936
|
+
`}};zs=new WeakMap,rt=new WeakSet,ux=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},wf=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},$f=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},gx=function(e){let t=io.dragged;a(this,rt,$f).call(this,t)&&(e.preventDefault(),Xc(t,{list:this,index:Dm(this.items,t,e.clientY)}))},fx=function(e){let t=io.dragged;if(!a(this,rt,$f).call(this,t))return;e.preventDefault();let i=Dm(this.items,t,e.clientY);Xc(t,null),t.moveToList(this,i)},to.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}},to.styles=[E,w`
|
|
2937
2937
|
:host { display: block; }
|
|
2938
2938
|
.bar {
|
|
2939
2939
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2957,9 +2957,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2957
2957
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2958
2958
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2959
2959
|
}
|
|
2960
|
-
`];$("cm-nested-list",
|
|
2960
|
+
`];$("cm-nested-list",to);var bx=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},vx=ca(class extends Ni{constructor(o){if(super(o),o.type!==At.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=[],s=[],l=0;for(let d of o)i[l]=t?t(d,l):l,s[l]=e(d,l),l++;return{values:s,keys:i}}render(o,n,e){return this.dt(o,n,e).values}update(o,[n,e,t]){let i=Kb(o),{values:s,keys:l}=this.dt(n,e,t);if(!Array.isArray(i))return this.ut=l,s;let d=this.ut??=[],p=[],u,b,f=0,x=i.length-1,v=0,k=s.length-1;for(;f<=x&&v<=k;)if(i[f]===null)f++;else if(i[x]===null)x--;else if(d[f]===l[v])p[v]=Pi(i[f],s[v]),f++,v++;else if(d[x]===l[k])p[k]=Pi(i[x],s[k]),x--,k--;else if(d[f]===l[k])p[k]=Pi(i[f],s[k]),da(o,p[k+1],i[f]),f++,k--;else if(d[x]===l[v])p[v]=Pi(i[x],s[v]),da(o,i[f],i[x]),x--,v++;else if(u===void 0&&(u=bx(l,v,k),b=bx(d,f,x)),u.has(d[f]))if(u.has(d[x])){let L=b.get(l[v]),P=L!==void 0?i[L]:null;if(P===null){let U=da(o,i[f]);Pi(U,s[v]),p[v]=U}else p[v]=Pi(P,s[v]),da(o,i[f],P),i[L]=null;v++}else Sh(i[x]),x--;else Sh(i[f]),f++;for(;v<=k;){let L=da(o,p[k+1]);Pi(L,s[v]),p[v++]=L}for(;f<=x;){let L=i[f++];L!==null&&Sh(L)}return this.ut=l,zh(o,p),Ne}});function yx(o,n,e){let t=l=>e.slotCount(l),i=l=>Math.max(0,t(l)-1),s=l=>{for(let d=n.group+l;d>=0&&d<e.groupCount();d+=l)if(t(d)>0)return{group:d,index:Math.min(n.index,i(d))};return{...n}};switch(o){case"ArrowRight":return s(1);case"ArrowLeft":return s(-1);case"ArrowDown":return{group:n.group,index:Math.min(n.index+1,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 ve,mt,ut,Ls=class{constructor(n){m(this,ve);m(this,mt,null);m(this,ut,null);g(this,ve,n)}get active(){return r(this,mt)!==null}get from(){return r(this,mt)&&{...r(this,mt)}}get target(){return r(this,ut)&&{...r(this,ut)}}groupCount(){return r(this,ve).groupCount()}slotCount(n){return n>=0&&n<r(this,ve).groupCount()?r(this,ve).slotCount(n):0}pickUp(n){this.active&&this.cancel(),g(this,mt,{...n}),g(this,ut,{...n}),r(this,ve).onTarget?.(this.target),r(this,ve).announce(r(this,ve).messages.pickedUp(this.target))}moveTo(n){if(!r(this,ut))return;let e=Math.max(0,Math.min(n.group,r(this,ve).groupCount()-1)),t=this.slotCount(e);t<=0||(g(this,ut,{group:e,index:Math.max(0,Math.min(n.index,t-1))}),r(this,ve).onTarget?.(this.target),r(this,ve).announce(r(this,ve).messages.over(this.target)))}drop(){if(!r(this,mt)||!r(this,ut))return;let n=r(this,mt),e=r(this,ut);g(this,mt,g(this,ut,null)),r(this,ve).onTarget?.(null),r(this,ve).onDrop(n,e)}cancel(n=!1){if(!r(this,mt))return;let e=r(this,mt),t=n?"":r(this,ve).messages.cancelled(e);g(this,mt,g(this,ut,null)),r(this,ve).onTarget?.(null),r(this,ve).onCancel?.(e),t&&r(this,ve).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,ve).navigate??yx)(e,r(this,ut),this);return t?(this.moveTo(t),!0):!1}};ve=new WeakMap,mt=new WeakMap,ut=new WeakMap;var Jc,Ss,As=class{constructor(n=document,e="assertive"){m(this,Jc);m(this,Ss);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,Ss)??this.element.textContent??""}announce(n){clearTimeout(r(this,Jc)),this.element.textContent===n?(this.element.textContent="",g(this,Ss,n),g(this,Jc,setTimeout(()=>{this.element.textContent=n,g(this,Ss,void 0)},50))):(g(this,Ss,void 0),this.element.textContent=n)}};Jc=new WeakMap,Ss=new WeakMap;var P_=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"}),I_=z("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),q_=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}."}),O0="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",Qc,Im,xx,Ds=class extends C{constructor(){super(...arguments);m(this,Im);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";m(this,Qc,N("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">
|
|
2961
2961
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2962
|
-
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,
|
|
2962
|
+
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,Qc)}-help"></div>`}
|
|
2963
2963
|
<div class="content">
|
|
2964
2964
|
<div class="head">
|
|
2965
2965
|
<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>
|
|
@@ -2967,11 +2967,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2967
2967
|
<slot name="actions"></slot>
|
|
2968
2968
|
</div>
|
|
2969
2969
|
<div class="lines"><slot></slot></div>
|
|
2970
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>a(this,
|
|
2970
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>a(this,Im,xx).call(this,i,"_badges")}></slot></div>
|
|
2971
2971
|
</div>
|
|
2972
2972
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2973
|
-
<span id="${r(this,
|
|
2974
|
-
</div>`}};
|
|
2973
|
+
<span id="${r(this,Qc)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2974
|
+
</div>`}};Qc=new WeakMap,Im=new WeakSet,xx=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},Ds.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Ds.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}},Ds.styles=[E,w`
|
|
2975
2975
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2976
2976
|
.card {
|
|
2977
2977
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2996,22 +2996,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2996
2996
|
:host([moving]) .content { opacity: 0.5; }
|
|
2997
2997
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2998
2998
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2999
|
-
`];$("cm-board-card",Ds);var
|
|
2999
|
+
`];$("cm-board-card",Ds);var ao,Zc,no,oo,gr,Hm,wx,Rs=class extends C{constructor(){super(...arguments);m(this,gr);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;m(this,ao,!1);this._cards=[];this._drop=null;m(this,Zc,new MutationObserver(()=>a(this,gr,Hm).call(this)));m(this,no,N("cm-col"));m(this,oo,!1)}get collapsed(){return r(this,ao)}connectedCallback(){super.connectedCallback(),a(this,gr,Hm).call(this),r(this,Zc).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Zc).disconnect()}get cards(){return[...this.children].filter(e=>e.localName==="cm-board-card"&&!e.hasAttribute("slot"))}get key(){return this.value||this.heading}get count(){return typeof this.total=="number"&&!Number.isNaN(this.total)?this.total:this._cards.length}get scrollElement(){return this.renderRoot?.querySelector(".scroll")??null}_sync(){return a(this,gr,Hm).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");g(this,ao,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",r(this,ao)),g(this,oo,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach(i=>{let s=this._cards[Number(i.dataset.i)];s?i.assign(s):i.assign()});let t=i=>[...this.children].filter(s=>s.getAttribute("slot")===i);this.renderRoot.querySelector("slot.actions")?.assign(...t("actions")),this.renderRoot.querySelector("slot.empty")?.assign(...t("empty")),r(this,oo)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,oo,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,i=this.count,s=t?e.filter(v=>v!==t.card):e,l=t?e.indexOf(t.card):-1,d=!!t&&!this.collapsed&&!(l>=0&&t.index===l),p=[];e.forEach((v,k)=>{d&&v!==t.card&&s.indexOf(v)===t.index&&p.push({key:"drop"}),p.push({key:v,card:v,i:k})}),d&&t.index>=s.length&&p.push({key:"drop"});let u=this.hasMore||i>e.length,b=this.loading,f=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),x=this.t("count",{count:i});return c`<section aria-labelledby="${r(this,no)}-h" class=${t&&this.collapsed?"over":""}>
|
|
3000
3000
|
<header part="header">
|
|
3001
|
-
<div class="title" id="${r(this,
|
|
3001
|
+
<div class="title" id="${r(this,no)}-h" role="heading" aria-level=${f}>${this.heading}<span class="sr">, ${x}</span></div>
|
|
3002
3002
|
<span class="count" part="count" aria-hidden="true">${this.formatNumber(i)}</span>
|
|
3003
3003
|
<span class="actions"><slot class="actions"></slot></span>
|
|
3004
3004
|
</header>
|
|
3005
3005
|
<div class="scroll">
|
|
3006
|
-
<ul part="list" role="list" aria-labelledby="${r(this,
|
|
3007
|
-
${
|
|
3006
|
+
<ul part="list" role="list" aria-labelledby="${r(this,no)}-h" aria-busy=${b?"true":"false"} tabindex="-1" ?hidden=${this.collapsed}>
|
|
3007
|
+
${vx(p,v=>v.key,v=>v.card?c`<li><slot data-i=${v.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>`)}
|
|
3008
3008
|
</ul>
|
|
3009
3009
|
${b&&!e.length&&!this.collapsed?c`<div class="loading" aria-hidden="true"><cm-skeleton variant="block"></cm-skeleton><cm-skeleton variant="block"></cm-skeleton></div>`:h}
|
|
3010
3010
|
<div class="empty" ?hidden=${e.length>0||b||u||this.collapsed||d}><slot class="empty">${this.t("empty")}</slot></div>
|
|
3011
|
-
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${b} @click=${a(this,
|
|
3011
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${b} @click=${a(this,gr,wx)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
3012
3012
|
</div>
|
|
3013
3013
|
<span class="sr" role="status">${b?this.t("loading",{column:this.heading}):""}</span>
|
|
3014
|
-
</section>`}};
|
|
3014
|
+
</section>`}};ao=new WeakMap,Zc=new WeakMap,no=new WeakMap,oo=new WeakMap,gr=new WeakSet,Hm=function(){this._cards=this.cards},wx=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},Rs.shadowRootOptions={...A.shadowRootOptions,slotAssignment:"manual"},Rs.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}},Rs.styles=[E,w`
|
|
3015
3015
|
:host {
|
|
3016
3016
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
3017
3017
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -3048,9 +3048,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3048
3048
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
3049
3049
|
:host([collapsed]) .actions { display: none; }
|
|
3050
3050
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
3051
|
-
`];$("cm-board-column",
|
|
3051
|
+
`];$("cm-board-column",Rs);var Ye,qe,$e,Hs,ce,I,kf,ro,$x,Ef,kx,Ex,Mx,_x,ed,Tx,td,Mf,_f,Tf,Nm,Cx,id,rd,sd,ad,nd,od,ld,Cf,zf,Pm,zx,ur,so=class extends C{constructor(){super();m(this,I);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;m(this,Ye,new As);m(this,qe);m(this,$e,null);m(this,Hs,new WeakMap);m(this,ce,null);m(this,ed,e=>{if(r(this,ce)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,qe).active){r(this,qe).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let i=a(this,I,_x).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 s=a(this,I,Tx).call(this,i,t);s&&(e.preventDefault(),s.focusHandle())}}});m(this,td,e=>{if(!r(this,qe).active||!r(this,$e))return;let t=e.relatedTarget;t&&(t===r(this,$e).card||r(this,$e).card.contains(t))||!t&&document.hasFocus()===!1||queueMicrotask(()=>{r(this,qe).active&&r(this,$e)&&!r(this,$e).card.matches(":focus-within")&&r(this,qe).cancel()})});m(this,id,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});m(this,rd,e=>{if(r(this,ce)||!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?.(O0)))return;let s=a(this,I,ro).call(this,i);if(!s)return;r(this,qe).active&&r(this,qe).cancel();let l=i.getBoundingClientRect();g(this,ce,{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:s.column,fromIndex:s.index}),e.pointerType!=="mouse"&&(r(this,ce).timer=setTimeout(()=>{r(this,ce)&&!r(this,ce).started&&a(this,I,Cf).call(this)},300)),window.addEventListener("pointermove",r(this,nd),!0),window.addEventListener("pointerup",r(this,od),!0),window.addEventListener("pointercancel",r(this,ld),!0),window.addEventListener("touchmove",r(this,sd),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,ad),!0)});m(this,sd,e=>{r(this,ce)?.started&&e.cancelable&&e.preventDefault()});m(this,ad,e=>{r(this,ce)&&e.preventDefault()});m(this,nd,e=>{let t=r(this,ce);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?a(this,I,Cf).call(this):a(this,I,ur).call(this,!1));return}e.preventDefault(),a(this,I,zf).call(this),a(this,I,Pm).call(this)}});m(this,od,e=>{let t=r(this,ce);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,I,ur).call(this,!1);return}let i=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),a(this,I,ur).call(this,!0)});m(this,ld,e=>{r(this,ce)&&e.pointerId===r(this,ce).pointerId&&a(this,I,ur).call(this,!1)});g(this,qe,new Ls({groupCount:()=>this.columns.length,slotCount:e=>{let t=this.columns[e];return!t||!r(this,$e)?0:t.cards.filter(i=>i!==r(this,$e).card).length+1},onTarget:e=>a(this,I,kx).call(this,e),onDrop:(e,t)=>a(this,I,Mx).call(this,e,t),onCancel:()=>a(this,I,Ef).call(this),messages:{pickedUp:e=>a(this,I,kf).call(this,"pickedUp",e),over:e=>a(this,I,kf).call(this,"over",e),cancelled:e=>this.t("cancelled",{card:r(this,$e)?.card.name??"",column:this.columns[e.group]?.heading??""})},announce:e=>r(this,Ye).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(s=>s.key===e);if(i)return i}}get heldCard(){return r(this,$e)?.card??null}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,ed)),this.addEventListener("focusout",r(this,td)),this.addEventListener("pointerdown",r(this,rd)),this.addEventListener("dragstart",r(this,id))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,ed)),this.removeEventListener("focusout",r(this,td)),this.removeEventListener("pointerdown",r(this,rd)),this.removeEventListener("dragstart",r(this,id)),r(this,qe).cancel(!0),a(this,I,ur).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(r(this,Ye).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return r(this,Ye).text}announce(e){r(this,Ye).announce(e)}pickUp(e){let t=typeof e=="string"?this.card(e):e;if(!t||t.locked||t.pending)return!1;let i=a(this,I,ro).call(this,t);return i?(a(this,I,ur).call(this,!1),r(this,qe).cancel(!0),g(this,$e,{card:t,column:i.column,index:i.index}),t.moving=!0,a(this,I,$x).call(this,t),r(this,qe).pickUp({group:i.group,index:i.index}),!0):!1}cancelMove(){let e=r(this,ce);e?.started&&(a(this,I,ur).call(this,!1),r(this,Ye).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),r(this,qe).cancel()}moveCard(e,t,i){let s=typeof e=="string"?this.card(e):e,l=typeof t=="string"?this.column(t):t;if(!s||!l)return!1;let d=a(this,I,ro).call(this,s);if(!d)return!1;let p=l.cards.filter(b=>b!==s).length,u=Math.max(0,Math.min(i??p,p));return a(this,I,Nm).call(this,s,d.column,d.index,l,u,"api")}revert(e){let t=typeof e=="string"?this.card(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Hs).get(t);if(this.controlled||!i||(r(this,Hs).delete(t),!i.from.isConnected||!this.contains(i.from)))return!1;let s=t.matches(":focus-within");return a(this,I,_f).call(this,t,i.from,i.fromIndex),i.totals&&a(this,I,Tf).call(this,i.to,i.from),a(this,I,Mf).call(this,i.to,i.from,s?t:null),r(this,Ye).announce(this.t("reverted",{card:t.name,column:i.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
3052
3052
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
3053
|
-
</div>`}};Ye=new WeakMap,qe=new WeakMap,$e=new WeakMap,
|
|
3053
|
+
</div>`}};Ye=new WeakMap,qe=new WeakMap,$e=new WeakMap,Hs=new WeakMap,ce=new WeakMap,I=new WeakSet,kf=function(e,t){let i=this.columns[t.group];return this.t(e,{card:r(this,$e)?.card.name??"",column:i?.heading??"",position:t.index+1,count:r(this,qe).slotCount(t.group)})},ro=function(e){let t=this.columns,i=t.findIndex(s=>s.contains(e)&&e.parentElement===s);return i<0?null:{column:t[i],group:i,index:t[i].cards.indexOf(e)}},$x=function(e){let t=()=>!!e.shadowRoot?.activeElement?.classList.contains("handle");e.focusHandle({preventScroll:!0}),requestAnimationFrame(()=>{r(this,$e)?.card===e&&!t()&&e.focusHandle({preventScroll:!0})})},Ef=function(){r(this,$e)&&(r(this,$e).card.moving=!1),g(this,$e,null)},kx=function(e){let t=r(this,$e);if(this.columns.forEach((i,s)=>{i._drop=t&&e&&s===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 s=i.renderRoot.querySelector("li.drop")??(t&&t.column===i?t.card:i);a(this,I,Ex).call(this,i,s)})}},Ex=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 s=e.scrollElement;if(s){let l=s.getBoundingClientRect(),d=t.getBoundingClientRect();d.top<l.top?s.scrollTop-=l.top-d.top+8:d.bottom>l.bottom&&(s.scrollTop+=d.bottom-l.bottom+8)}},Mx=function(e,t){let i=r(this,$e);if(a(this,I,Ef).call(this),!i)return;let s=this.columns[t.group];a(this,I,Nm).call(this,i.card,i.column,e.index,s,t.index,"keyboard")},_x=function(e){let t=e[0];if(!(t instanceof HTMLElement)||!t.classList?.contains("handle"))return null;let i=e.find(s=>s.localName==="cm-board-card");return i&&a(this,I,ro).call(this,i)?i:null},ed=new WeakMap,Tx=function(e,t){let i=a(this,I,ro).call(this,e);if(!i)return null;let s=i.column.cards;if(t==="ArrowDown")return s[i.index+1]??null;if(t==="ArrowUp")return s[i.index-1]??null;let l=t==="ArrowRight"?1:-1,d=this.columns;for(let p=i.group+l;p>=0&&p<d.length;p+=l){let u=d[p].cards;if(u.length)return u[Math.min(i.index,u.length-1)]}return null},td=new WeakMap,Mf=function(e,t,i){e._sync(),t._sync().then(()=>{i?.isConnected&&i.focusHandle({preventScroll:!0})})},_f=function(e,t,i){let s=t.cards.filter(d=>d!==e),l=s[i];l?l.before(e):s.length?s[s.length-1].after(e):t.append(e)},Tf=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))},Nm=function(e,t,i,s,l,d){let p=e.name;if(t===s&&i===l)return d!=="api"&&r(this,Ye).announce(this.t("sameSpot",{card:p})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let u=[],b={value:e.key,card:e,from:t.key,to:s.key,fromColumn:t,toColumn:s,fromIndex:i,toIndex:l,source:d,waitUntil:v=>{u.push(Promise.resolve(v))}};if(!this.dispatchEvent(new CustomEvent("cm-move",{detail:b,bubbles:!0,composed:!0,cancelable:!0})))return r(this,Ye).announce(this.t("refused",{card:p,column:s.heading})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let x=s.cards.filter(v=>v!==e).length+1;if(this.controlled)d==="keyboard"&&a(this,I,Cx).call(this,e.key,s);else{let v=d==="keyboard"||e.matches(":focus-within");a(this,I,_f).call(this,e,s,l);let k=t!==s;k&&a(this,I,Tf).call(this,t,s),r(this,Hs).set(e,{card:e,from:t,fromIndex:i,to:s,toIndex:l,totals:k}),a(this,I,Mf).call(this,t,s,v?e:null)}return r(this,Ye).announce(this.t("moved",{card:p,column:s.heading,position:l+1,count:x})),u.length&&(e.pending=!0,Promise.all(u).then(()=>{e.pending=!1,this.controlled||r(this,Hs).delete(e)},()=>{e.pending=!1,this.controlled?r(this,Ye).announce(this.t("reverted",{card:p,column:t.heading})):this.revert(e)})),!0},Cx=function(e,t){let i=()=>t.isConnected?t.cards.find(d=>d.key===e):void 0,s=()=>{let d=i(),p=!document.activeElement||document.activeElement===document.body||!document.activeElement.isConnected;return!d||!(p||this.contains(document.activeElement))?!1:(t._sync().then(()=>d.updateComplete).then(()=>{d.isConnected&&d.focusHandle({preventScroll:!0})}),!0)},l=new MutationObserver(()=>{s()&&l.disconnect()});l.observe(this,{childList:!0,subtree:!0}),setTimeout(()=>l.disconnect(),1e3)},id=new WeakMap,rd=new WeakMap,sd=new WeakMap,ad=new WeakMap,nd=new WeakMap,od=new WeakMap,ld=new WeakMap,Cf=function(){let e=r(this,ce);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,Ye).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),a(this,I,zf).call(this),a(this,I,Pm).call(this);let i=()=>{r(this,ce)?.started&&(a(this,I,zx).call(this),r(this,ce).raf=requestAnimationFrame(i))};e.raf=requestAnimationFrame(i)},zf=function(){let e=r(this,ce);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},Pm=function(){let e=r(this,ce);if(!e)return;let t=this.columns;if(!t.length)return;let i=t[0],s=1/0;for(let u of t){let b=u.getBoundingClientRect(),f=e.x<b.left?b.left-e.x:e.x>b.right?e.x-b.right:0;f<s&&(i=u,s=f)}let l=i.cards.filter(u=>u!==e.card),d=l.length;if(i.collapsed)d=0;else for(let u=0;u<l.length;u++){let b=l[u].getBoundingClientRect();if(e.y<b.top+b.height/2){d=u;break}}if(i===e.to&&d===e.toIndex)return;let p=i!==e.to;e.to=i,e.toIndex=d,t.forEach(u=>{u._drop=u===i?{card:e.card,index:d,height:e.height}:null}),p&&r(this,Ye).announce(this.t("over",{column:i.heading,position:d+1,count:l.length+1}))},zx=function(){let e=r(this,ce);if(!e)return;let t=48,i=16,s=x=>x<t?Math.ceil((t-Math.max(x,0))/t*i):0,l=!1,d=this.renderRoot.querySelector(".columns");if(d){let x=d.getBoundingClientRect(),v=s(e.x-x.left),k=s(x.right-e.x),L=d.scrollLeft;v?d.scrollLeft-=v:k&&(d.scrollLeft+=k),l||=d.scrollLeft!==L}let p=e.to?.scrollElement;if(p&&p.scrollHeight>p.clientHeight){let x=p.getBoundingClientRect();if(e.x>=x.left&&e.x<=x.right){let v=s(e.y-x.top),k=s(x.bottom-e.y),L=p.scrollTop;v?p.scrollTop-=v:k&&(p.scrollTop+=k),l||=p.scrollTop!==L}}let u=window.innerHeight,b=s(e.y),f=s(u-e.y);if(b||f){let x=window.scrollY;window.scrollBy(0,b?-b:f),l||=window.scrollY!==x}l&&a(this,I,Pm).call(this)},ur=function(e){let t=r(this,ce);t&&(g(this,ce,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,nd),!0),window.removeEventListener("pointerup",r(this,od),!0),window.removeEventListener("pointercancel",r(this,ld),!0),window.removeEventListener("touchmove",r(this,sd),!0),window.removeEventListener("contextmenu",r(this,ad),!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&&a(this,I,Nm).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},so.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},so.styles=[E,w`
|
|
3054
3054
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
3055
3055
|
.board { height: 100%; }
|
|
3056
3056
|
.columns {
|
|
@@ -3064,60 +3064,60 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3064
3064
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
3065
3065
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
3066
3066
|
}
|
|
3067
|
-
`];$("cm-board",ro);var V_=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}."}),co=class extends D{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}};co.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}},co.styles=w`:host { display: none !important; }`;$("cm-calendar-event",co);var Fm=o=>String(o).padStart(2,"0"),Tx=o=>`${B(o)}T${Fm(o.getHours())}:${Fm(o.getMinutes())}`,Nm=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Cx=["month","week","day"],P0=600,zx=new Map,Sx=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=zx.get(e);return t||(t=new Intl.DateTimeFormat(o,n),zx.set(e,t)),t},Tf=o=>o.replace(/[ ]/g," ").trim(),po,Xe,Je,He,ae,ne,Ns,Jt,ft,gd,br,mo,uo,go,fo,fd,y,Oe,gr,od,Pm,Xt,Cf,ld,Pt,zf,Lx,It,oo,Dx,Ax,gt,cd,dd,Im,Rx,Hx,Nx,Hs,Sf,hd,Px,pd,Ix,qx,Ox,Bx,bd,vd,Fx,Vx,yd,md,jx,Lf,Df,Af,Ux,Kx,Rf,Hf,Nf,xd,Pf,Gx,wd,$d,kd,Ed,Md,_d,If,qm,Wx,fr,ud,Yx,qf,Xx,Om,Of,lo,Bm,Jx,Qx,Zx,ew,tw,ho=class extends C{constructor(){super();m(this,y);this.view="month";this.date="";this.today="";this.step=15;m(this,po,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;m(this,Xe,N("cm-cal"));m(this,Je,new Ls);m(this,He);m(this,ae,null);m(this,ne,null);m(this,Ns,new WeakMap);m(this,Jt,"");m(this,ft,null);m(this,gd,"");m(this,br,!0);m(this,mo,0);m(this,uo,!1);m(this,go);m(this,fo,0);m(this,fd,new MutationObserver(()=>this.requestUpdate()));m(this,bd,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Jt,t.dataset.k);for(let i of a(this,y,pd).call(this))i.tabIndex=i===t?0:-1}});m(this,vd,e=>{let t=e.relatedTarget;if(this._more&&!r(this,ae)){let i=this.renderRoot.querySelector(".pop"),s=e.composedPath()[0];i&&i.contains(s)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,He).active||!r(this,ae)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,He).active||!r(this,ae))return;this.renderRoot.activeElement?.dataset.ev!==r(this,ae).ev.key&&r(this,He).cancel()}))});m(this,yd,e=>{if(r(this,ne)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,He).active){r(this,He).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let s=i.closest(".pop");if(s&&e.key==="Escape"){e.preventDefault(),a(this,y,Om).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,mo,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(s&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...s.querySelectorAll(".chip")],p=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];p&&(e.preventDefault(),p.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),a(this,y,Vx).call(this,i,e.key==="PageUp"?-1:1);return}let l=a(this,y,Fx).call(this,i,t);l?(e.preventDefault(),a(this,y,Bx).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});m(this,xd,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});m(this,wd,e=>{if(r(this,ne)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(p=>p.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),s=i&&a(this,y,oo).call(this,i);if(!s||i.locked||i.pending)return;let l=a(this,y,Df).call(this,s,t.dataset.day??s.days[0]);if(!l)return;r(this,He).active&&r(this,He).cancel();let d=0;if(l.mode==="time"){let p=a(this,y,Pf).call(this,e.clientX,e.clientY);p&&t.classList.contains("time")&&(d=Math.max(0,Math.min(s.dur,p.min-s.min)))}g(this,ne,{...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,ne).timer=setTimeout(()=>{r(this,ne)&&!r(this,ne).started&&a(this,y,If).call(this)},300)),window.addEventListener("pointermove",r(this,Ed),!0),window.addEventListener("pointerup",r(this,Md),!0),window.addEventListener("pointercancel",r(this,_d),!0),window.addEventListener("touchmove",r(this,$d),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,kd),!0)});m(this,$d,e=>{r(this,ne)?.started&&e.cancelable&&e.preventDefault()});m(this,kd,e=>{r(this,ne)&&e.preventDefault()});m(this,Ed,e=>{let t=r(this,ne);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?a(this,y,If).call(this):a(this,y,fr).call(this,!1));return}e.preventDefault(),a(this,y,qm).call(this)}});m(this,Md,e=>{let t=r(this,ne);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,y,fr).call(this,!1);return}let i=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),a(this,y,fr).call(this,!0)});m(this,_d,e=>{r(this,ne)&&e.pointerId===r(this,ne).pointerId&&a(this,y,fr).call(this,!1)});g(this,He,new Ss({groupCount:()=>a(this,y,It).call(this).length,slotCount:()=>r(this,ae)?r(this,ae).mode==="day"?1:a(this,y,md).call(this,r(this,ae).ev.dur):0,navigate:(e,t)=>a(this,y,jx).call(this,e,t),onTarget:e=>a(this,y,Ux).call(this,e),onDrop:(e,t)=>a(this,y,Kx).call(this,e,t),onCancel:()=>a(this,y,Af).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,ae)?.ev.name??"",place:a(this,y,Hs).call(this,r(this,ae),e)}),over:e=>this.t("over",{place:a(this,y,Hs).call(this,r(this,ae),e)}),cancelled:e=>this.t("cancelled",{event:r(this,ae)?.ev.name??"",place:a(this,y,Hs).call(this,r(this,ae),e)})},announce:e=>r(this,Je).announce(e)}))}get locale(){return r(this,po)}set locale(e){let t=r(this,po);g(this,po,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=a(this,y,It).call(this);return{view:r(this,y,Oe),start:B(e[0]),end:B(e[e.length-1])}}get heldEvent(){return r(this,ae)?.ev.el??null}get announcement(){return r(this,Je).text}announce(e){r(this,Je).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,yd)),this.addEventListener("focusin",r(this,bd)),this.addEventListener("focusout",r(this,vd)),this.addEventListener("pointerdown",r(this,wd)),this.addEventListener("dragstart",r(this,xd)),r(this,fd).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,go,new ResizeObserver(()=>{cancelAnimationFrame(r(this,fo)),g(this,fo,requestAnimationFrame(()=>a(this,y,Sf).call(this)))})),r(this,go).observe(this)),a(this,y,Sf).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,yd)),this.removeEventListener("focusin",r(this,bd)),this.removeEventListener("focusout",r(this,vd)),this.removeEventListener("pointerdown",r(this,wd)),this.removeEventListener("dragstart",r(this,xd)),r(this,fd).disconnect(),r(this,go)?.disconnect(),cancelAnimationFrame(r(this,fo)),r(this,He).cancel(!0),a(this,y,fr).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,br,!0),e.get("view")!==void 0&&(this._more="",r(this,He).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,Je).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,br,!0),a(this,y,Ox).call(this),r(this,ft)){let l=a(this,y,Ix).call(this,r(this,ft).key);l?(g(this,ft,null),l.focus({preventScroll:!1})):Date.now()>r(this,ft).until&&g(this,ft,null)}r(this,uo)&&(g(this,uo,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,br)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,br,!1)}t||g(this,br,!0),r(this,ae)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,s=`${i.view}|${i.start}|${i.end}`;s!==r(this,gd)&&(g(this,gd,s),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=B(a(this,y,hd).call(this,r(this,y,Pt),-1))}next(){this.date=B(a(this,y,hd).call(this,r(this,y,Pt),1))}goToToday(){this.date=r(this,y,ld)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let s=a(this,y,oo).call(this,i);if(!s)return!1;let l=a(this,y,It).call(this).map(B),d=t&&s.days.includes(t)&&l.includes(t)?t:s.days.find(b=>l.includes(b));if(!d)return!1;let p=a(this,y,Df).call(this,s,d);if(!p)return!1;a(this,y,fr).call(this,!1),r(this,He).cancel(!0),this._more="",g(this,ae,p),i.moving=!0;let u=`ev:${s.key}:${d}`;return g(this,Jt,u),g(this,ft,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,He).pickUp(p.from),!0}cancelMove(){let e=r(this,ne);e?.started&&(a(this,y,fr).call(this,!1),r(this,Je).announce(this.t("cancelled",{event:e.ev.name,place:a(this,y,Hs).call(this,e,e.from)}))),r(this,He).cancel()}moveEvent(e,t,i){let s=typeof e=="string"?this.event(e):e,l=s&&a(this,y,oo).call(this,s);if(!l)return!1;let d=l.allDay?R(xt(t).date||t):jt(t);if(!d)return!1;let p=i?l.allDay?R(xt(i).date||i):jt(i):null;return(!p||p<d)&&(p=l.allDay?te(d,Nm(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),a(this,y,Nf).call(this,l,d,p,"api",!1,B(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Ns).get(t);if(this.controlled||!i)return!1;r(this,Ns).delete(t);let s=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=a(this,y,oo).call(this,t);return l&&s&&g(this,ft,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Je).announce(this.t("reverted",{event:t.name,place:l?a(this,y,Im).call(this,l):i.start})),!0}render(){let e=a(this,y,It).call(this),t=a(this,y,Ax).call(this,a(this,y,Dx).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
3068
|
-
${a(this,y,
|
|
3069
|
-
${r(this,y,Oe)==="month"?a(this,y,
|
|
3067
|
+
`];$("cm-board",so);var W_=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}."}),ho=class extends A{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}};ho.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}},ho.styles=w`:host { display: none !important; }`;$("cm-calendar-event",ho);var Um=o=>String(o).padStart(2,"0"),Sx=o=>`${B(o)}T${Um(o.getHours())}:${Um(o.getMinutes())}`,qm=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Lx=["month","week","day"],B0=600,Ax=new Map,Dx=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Ax.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Ax.set(e,t)),t},Sf=o=>o.replace(/[ ]/g," ").trim(),mo,Xe,Je,He,ae,ne,Ps,Qt,ft,bd,vr,uo,go,fo,bo,vd,y,Oe,fr,cd,Om,Jt,Lf,dd,It,Af,Rx,qt,lo,Hx,Nx,gt,hd,pd,Bm,Px,Ix,qx,Ns,Df,md,Ox,ud,Bx,Fx,Vx,jx,yd,xd,Ux,Kx,wd,gd,Wx,Rf,Hf,Nf,Gx,Yx,Pf,If,qf,$d,Of,Xx,kd,Ed,Md,_d,Td,Cd,Bf,Fm,Jx,br,fd,Qx,Ff,Zx,Vm,Vf,co,jm,ew,tw,iw,rw,sw,po=class extends C{constructor(){super();m(this,y);this.view="month";this.date="";this.today="";this.step=15;m(this,mo,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;m(this,Xe,N("cm-cal"));m(this,Je,new As);m(this,He);m(this,ae,null);m(this,ne,null);m(this,Ps,new WeakMap);m(this,Qt,"");m(this,ft,null);m(this,bd,"");m(this,vr,!0);m(this,uo,0);m(this,go,!1);m(this,fo);m(this,bo,0);m(this,vd,new MutationObserver(()=>this.requestUpdate()));m(this,yd,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Qt,t.dataset.k);for(let i of a(this,y,ud).call(this))i.tabIndex=i===t?0:-1}});m(this,xd,e=>{let t=e.relatedTarget;if(this._more&&!r(this,ae)){let i=this.renderRoot.querySelector(".pop"),s=e.composedPath()[0];i&&i.contains(s)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,He).active||!r(this,ae)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,He).active||!r(this,ae))return;this.renderRoot.activeElement?.dataset.ev!==r(this,ae).ev.key&&r(this,He).cancel()}))});m(this,wd,e=>{if(r(this,ne)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,He).active){r(this,He).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let s=i.closest(".pop");if(s&&e.key==="Escape"){e.preventDefault(),a(this,y,Vm).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,uo,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(s&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...s.querySelectorAll(".chip")],p=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];p&&(e.preventDefault(),p.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),a(this,y,Kx).call(this,i,e.key==="PageUp"?-1:1);return}let l=a(this,y,Ux).call(this,i,t);l?(e.preventDefault(),a(this,y,jx).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});m(this,$d,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});m(this,kd,e=>{if(r(this,ne)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(p=>p.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),s=i&&a(this,y,lo).call(this,i);if(!s||i.locked||i.pending)return;let l=a(this,y,Hf).call(this,s,t.dataset.day??s.days[0]);if(!l)return;r(this,He).active&&r(this,He).cancel();let d=0;if(l.mode==="time"){let p=a(this,y,Of).call(this,e.clientX,e.clientY);p&&t.classList.contains("time")&&(d=Math.max(0,Math.min(s.dur,p.min-s.min)))}g(this,ne,{...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,ne).timer=setTimeout(()=>{r(this,ne)&&!r(this,ne).started&&a(this,y,Bf).call(this)},300)),window.addEventListener("pointermove",r(this,_d),!0),window.addEventListener("pointerup",r(this,Td),!0),window.addEventListener("pointercancel",r(this,Cd),!0),window.addEventListener("touchmove",r(this,Ed),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,Md),!0)});m(this,Ed,e=>{r(this,ne)?.started&&e.cancelable&&e.preventDefault()});m(this,Md,e=>{r(this,ne)&&e.preventDefault()});m(this,_d,e=>{let t=r(this,ne);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?a(this,y,Bf).call(this):a(this,y,br).call(this,!1));return}e.preventDefault(),a(this,y,Fm).call(this)}});m(this,Td,e=>{let t=r(this,ne);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,y,br).call(this,!1);return}let i=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),a(this,y,br).call(this,!0)});m(this,Cd,e=>{r(this,ne)&&e.pointerId===r(this,ne).pointerId&&a(this,y,br).call(this,!1)});g(this,He,new Ls({groupCount:()=>a(this,y,qt).call(this).length,slotCount:()=>r(this,ae)?r(this,ae).mode==="day"?1:a(this,y,gd).call(this,r(this,ae).ev.dur):0,navigate:(e,t)=>a(this,y,Wx).call(this,e,t),onTarget:e=>a(this,y,Gx).call(this,e),onDrop:(e,t)=>a(this,y,Yx).call(this,e,t),onCancel:()=>a(this,y,Nf).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,ae)?.ev.name??"",place:a(this,y,Ns).call(this,r(this,ae),e)}),over:e=>this.t("over",{place:a(this,y,Ns).call(this,r(this,ae),e)}),cancelled:e=>this.t("cancelled",{event:r(this,ae)?.ev.name??"",place:a(this,y,Ns).call(this,r(this,ae),e)})},announce:e=>r(this,Je).announce(e)}))}get locale(){return r(this,mo)}set locale(e){let t=r(this,mo);g(this,mo,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=a(this,y,qt).call(this);return{view:r(this,y,Oe),start:B(e[0]),end:B(e[e.length-1])}}get heldEvent(){return r(this,ae)?.ev.el??null}get announcement(){return r(this,Je).text}announce(e){r(this,Je).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,wd)),this.addEventListener("focusin",r(this,yd)),this.addEventListener("focusout",r(this,xd)),this.addEventListener("pointerdown",r(this,kd)),this.addEventListener("dragstart",r(this,$d)),r(this,vd).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,fo,new ResizeObserver(()=>{cancelAnimationFrame(r(this,bo)),g(this,bo,requestAnimationFrame(()=>a(this,y,Df).call(this)))})),r(this,fo).observe(this)),a(this,y,Df).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,wd)),this.removeEventListener("focusin",r(this,yd)),this.removeEventListener("focusout",r(this,xd)),this.removeEventListener("pointerdown",r(this,kd)),this.removeEventListener("dragstart",r(this,$d)),r(this,vd).disconnect(),r(this,fo)?.disconnect(),cancelAnimationFrame(r(this,bo)),r(this,He).cancel(!0),a(this,y,br).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,vr,!0),e.get("view")!==void 0&&(this._more="",r(this,He).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,Je).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,vr,!0),a(this,y,Vx).call(this),r(this,ft)){let l=a(this,y,Bx).call(this,r(this,ft).key);l?(g(this,ft,null),l.focus({preventScroll:!1})):Date.now()>r(this,ft).until&&g(this,ft,null)}r(this,go)&&(g(this,go,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,vr)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,vr,!1)}t||g(this,vr,!0),r(this,ae)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,s=`${i.view}|${i.start}|${i.end}`;s!==r(this,bd)&&(g(this,bd,s),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=B(a(this,y,md).call(this,r(this,y,It),-1))}next(){this.date=B(a(this,y,md).call(this,r(this,y,It),1))}goToToday(){this.date=r(this,y,dd)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let s=a(this,y,lo).call(this,i);if(!s)return!1;let l=a(this,y,qt).call(this).map(B),d=t&&s.days.includes(t)&&l.includes(t)?t:s.days.find(b=>l.includes(b));if(!d)return!1;let p=a(this,y,Hf).call(this,s,d);if(!p)return!1;a(this,y,br).call(this,!1),r(this,He).cancel(!0),this._more="",g(this,ae,p),i.moving=!0;let u=`ev:${s.key}:${d}`;return g(this,Qt,u),g(this,ft,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,He).pickUp(p.from),!0}cancelMove(){let e=r(this,ne);e?.started&&(a(this,y,br).call(this,!1),r(this,Je).announce(this.t("cancelled",{event:e.ev.name,place:a(this,y,Ns).call(this,e,e.from)}))),r(this,He).cancel()}moveEvent(e,t,i){let s=typeof e=="string"?this.event(e):e,l=s&&a(this,y,lo).call(this,s);if(!l)return!1;let d=l.allDay?R(xt(t).date||t):Ut(t);if(!d)return!1;let p=i?l.allDay?R(xt(i).date||i):Ut(i):null;return(!p||p<d)&&(p=l.allDay?te(d,qm(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),a(this,y,qf).call(this,l,d,p,"api",!1,B(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Ps).get(t);if(this.controlled||!i)return!1;r(this,Ps).delete(t);let s=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=a(this,y,lo).call(this,t);return l&&s&&g(this,ft,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Je).announce(this.t("reverted",{event:t.name,place:l?a(this,y,Bm).call(this,l):i.start})),!0}render(){let e=a(this,y,qt).call(this),t=a(this,y,Nx).call(this,a(this,y,Hx).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
3068
|
+
${a(this,y,ew).call(this,e)}
|
|
3069
|
+
${r(this,y,Oe)==="month"?a(this,y,iw).call(this,e,t):a(this,y,sw).call(this,e,t)}
|
|
3070
3070
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3071
3071
|
<span id="${r(this,Xe)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
3072
3072
|
<span id="${r(this,Xe)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
3073
3073
|
<span id="${r(this,Xe)}-op" hidden>${this.t("openHint")}</span>
|
|
3074
|
-
</div>`}};po=new WeakMap,Xe=new WeakMap,Je=new WeakMap,He=new WeakMap,ae=new WeakMap,ne=new WeakMap,Ns=new WeakMap,Jt=new WeakMap,ft=new WeakMap,gd=new WeakMap,br=new WeakMap,mo=new WeakMap,uo=new WeakMap,go=new WeakMap,fo=new WeakMap,fd=new WeakMap,y=new WeakSet,Oe=function(){return Cx.includes(this.view)?this.view:"month"},gr=function(){return Ki(this,this.locale)},od=function(){return Ra(r(this,y,gr))},Pm=function(){return La(r(this,y,gr),this.hourCycle)},Xt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Cf=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Aa(r(this,y,gr)):(Math.trunc(e)%7+7)%7},ld=function(){return R(this.today)?this.today:Gu()},Pt=function(){return R(this.date)??R(r(this,y,ld))},zf=function(){return r(this,y,Oe)==="month"&&this._narrow},Lx=function(){return r(this,y,Oe)!=="month"},It=function(){let e=r(this,y,Pt),t=r(this,y,Cf);if(r(this,y,Oe)==="day")return[e];if(r(this,y,Oe)==="week"){if(this._narrow)return[e,te(e,1),te(e,2)];let d=te(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(p,u)=>te(d,u))}let i=ze(e),s=te(i,-((i.getDay()-t+7)%7)),l=Math.ceil((Nm(s,Xr(e))+1)/7)*7;return Array.from({length:l},(d,p)=>te(s,p))},oo=function(e){let t=e.name,i=!!R(e.start),s=e.allDay||i;if(s){let u=R(xt(e.start).date||e.start);if(!u)return null;let b=R(xt(e.end).date||e.end)??u;b<u&&(b=u);let f=Math.min(Nm(u,b),366);return{el:e,key:e.key,name:t,allDay:s,start:u,end:b,min:0,dur:1440,days:Array.from({length:f+1},(x,v)=>B(te(u,v)))}}let l=jt(e.start);if(!l)return null;let d=jt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let p=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:s,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:p,days:[B(l)]}},Dx=function(){return this.events.map(e=>a(this,y,oo).call(this,e)).filter(e=>!!e)},Ax=function(e){let t=new Map;for(let i of e)for(let s of i.days)(t.get(s)??t.set(s,[]).get(s)).push(i);for(let i of t.values())i.sort((s,l)=>(s.allDay===l.allDay?0:s.allDay?-1:1)||s.start.getTime()-l.start.getTime()||s.name.localeCompare(l.name));return t},gt=function(e){return me(e,{weekday:"long",day:"numeric",month:"long"},r(this,y,gr))},cd=function(e){return r(this,y,Pm).format((e%1440+1440)%1440)},dd=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},s=Sx(r(this,y,gr),{hour:"numeric",minute:"2-digit",...i});try{if(B(e)===B(t)&&s.formatRangeToParts){let p=s.formatRangeToParts(e,t),u=p.findIndex(f=>f.source==="endRange"),b=-1;if(p.forEach((f,x)=>{f.source==="startRange"&&(b=x)}),b>=0&&u>b){let f=x=>Tf(x.map(v=>v.value).join(""));return this.t("timeRange",{start:f(p.slice(0,b+1)),end:f(p.slice(u))})}}}catch{}let l=B(e)===B(t),d=p=>l?a(this,y,cd).call(this,p.getHours()*60+p.getMinutes()):r(this,y,Pm).dateTime(p);return this.t("timeRange",{start:d(e),end:d(t)})},Im=function(e){return e.allDay?B(e.start)===B(e.end)?this.t("allDayOn",{date:a(this,y,gt).call(this,e.start)}):this.t("allDayRange",{start:a(this,y,gt).call(this,e.start),end:a(this,y,gt).call(this,e.end)}):B(e.start)!==B(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&Nm(e.start,e.end)===1)?a(this,y,dd).call(this,e.start,e.end):this.t("timed",{date:a(this,y,gt).call(this,e.start),time:a(this,y,dd).call(this,e.start,e.end)})},Rx=function(e){let t={title:e.name,when:a(this,y,Im).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Hx=function(e){let t=r(this,y,gr);if(r(this,y,Oe)==="month")return r(this,y,od).monthYear(r(this,y,Pt));if(e.length===1)return me(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Sx(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Tf(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Nx=function(e){return r(this,y,Pm).hour12?Tf(me(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,y,gr))):a(this,y,cd).call(this,e*60)},Hs=function(e,t){let{start:i,end:s}=a(this,y,Lf).call(this,e,t);return e.mode==="time"?this.t("timed",{date:a(this,y,gt).call(this,i),time:a(this,y,dd).call(this,i,s)}):a(this,y,gt).call(this,te(R(e.origin),t.group-e.from.group))},Sf=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<P0;t!==this._narrow&&(this._narrow=t)},hd=function(e,t){return r(this,y,Oe)==="month"?fe(e,t):r(this,y,Oe)==="week"?te(e,t*(this._narrow?3:7)):te(e,t)},Px=function(e){this.view!==e&&(this.view=e)},pd=function(){return[...this.renderRoot.querySelectorAll(".item")]},Ix=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(s=>s.dataset.k===e&&s.classList.contains("item"))??t.find(s=>s.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let s=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${s}`)??null}return null},qx=function(){let e=B(r(this,y,Pt));if(r(this,y,zf))return`day:${e}`;if(r(this,y,Oe)==="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}`},Ox=function(){let e=a(this,y,pd).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Jt))??e.find(i=>i.dataset.k===a(this,y,qx).call(this))??e.find(i=>i.dataset.day===B(r(this,y,Pt)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},Bx=function(e){g(this,Jt,e.dataset.k??"");for(let t of a(this,y,pd).call(this))t.tabIndex=t===e?0:-1;e.focus()},bd=new WeakMap,vd=new WeakMap,Fx=function(e,t){let i=new Map;for(let v of a(this,y,pd).call(this)){let k=Number(v.dataset.i);(i.get(k)??i.set(k,[]).get(k)).push(v)}let s=Number(e.dataset.i),l=i.get(s)??[e],d=Math.max(0,l.indexOf(e)),p=a(this,y,It).call(this).length,u=r(this,y,Oe)==="month",b=e.dataset.row,f=(v,k)=>{let L=v>=0&&v<p?i.get(v):void 0;return(L?.length?k(L):void 0)??null},x=v=>u?v[Math.min(d,v.length-1)]:v.find(k=>k.dataset.row===b)??v[0];switch(t){case"ArrowRight":return f(s+1,x);case"ArrowLeft":return f(s-1,x);case"ArrowDown":return l[d+1]??(u?f(s+7,v=>v[0]):null);case"ArrowUp":return d>0?l[d-1]:u?f(s-7,v=>v[v.length-1]):null;case"Home":return u?f(s-s%7,v=>v[0]):f(0,x);case"End":return u?f(Math.min(p-1,s-s%7+6),v=>v[0]):f(p-1,x);default:return null}},Vx=function(e,t){let i=e.dataset.day??B(r(this,y,Pt)),s=a(this,y,hd).call(this,R(i)??r(this,y,Pt),t),l=B(s),d=(e.dataset.k??"").split(":")[0],p;r(this,y,zf)?p=`day:${l}`:r(this,y,Oe)==="month"?p=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?p=`adadd:${l}`:p=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=B(a(this,y,hd).call(this,r(this,y,Pt),t)),g(this,Jt,p),g(this,ft,{key:p,until:Date.now()+1e3})},yd=new WeakMap,md=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,y,Xt))+1},jx=function(e,t){let i=r(this,ae);if(!i)return null;let s=a(this,y,It).call(this).length,l=b=>Math.max(0,Math.min(s-1,b));if(i.mode==="day"){let b=r(this,y,Oe)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return b?{group:t.group+7<s?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return b?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:b?t.group-t.group%7:0,index:0};case"End":return{group:b?l(t.group-t.group%7+6):s-1,index:0};default:return null}}let d=a(this,y,md).call(this,i.ev.dur)-1,p=Math.max(1,Math.round(60/r(this,y,Xt))),u=b=>Math.max(0,Math.min(d,b));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+p)};case"PageUp":return{group:t.group,index:u(t.index-p)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Lf=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=a(this,y,It).call(this)[t.group]??R(e.origin),p=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,y,Xt));return{start:p,end:new Date(p.getTime()+i.dur*6e4)}}let s=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+s,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},Df=function(e,t){let s=a(this,y,It).call(this).map(B).indexOf(t);if(s<0)return null;let l=r(this,y,Lx)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,y,Xt)),a(this,y,md).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:s,index:d}}},Af=function(){r(this,ae)&&(r(this,ae).ev.el.moving=!1),g(this,ae,null),this._target=null},Ux=function(e){let t=r(this,ae);if(!t||!e){this._target=null;return}let i=B(a(this,y,It).call(this)[e.group]??R(t.origin)),s=e.group===t.from.group&&e.index===t.from.index;this._target=s?null:{iso:i,min:t.mode==="time"?e.index*r(this,y,Xt):void 0}},Kx=function(e,t){let i=r(this,ae);a(this,y,Af).call(this),i&&(g(this,mo,performance.now()+400),a(this,y,Rf).call(this,i,e,t,"keyboard"))},Rf=function(e,t,i,s){let l=t.group===i.group&&t.index===i.index,{start:d,end:p}=a(this,y,Lf).call(this,e,i),u=B(te(R(e.origin),i.group-t.group));a(this,y,Nf).call(this,e.ev,d,p,s,l,e.mode==="time"?B(d):u)},Hf=function(e,t,i){return e?{start:B(t),end:B(i)}:{start:Tx(t),end:Tx(i)}},Nf=function(e,t,i,s,l,d){let p=e.el,u=e.name,b=a(this,y,Hf).call(this,e.allDay,e.start,e.end),f=a(this,y,Hf).call(this,e.allDay,t,i),x=q=>{s==="keyboard"&&g(this,ft,{key:q,until:Date.now()+1e3})};if(l||b.start===f.start&&b.end===f.end)return s!=="api"&&r(this,Je).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let v={...e,start:t,end:i},k=e.allDay?a(this,y,gt).call(this,t):this.t("timed",{date:a(this,y,gt).call(this,t),time:a(this,y,dd).call(this,t,i)}),L=[],P={value:e.key,event:p,from:b,to:f,allDay:e.allDay,source:s,waitUntil:q=>{L.push(Promise.resolve(q))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:P,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Ns).set(p,b),p.start=f.start,p.end=f.end),x(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Je).announce(this.t("moved",{event:u,place:v.allDay?a(this,y,gt).call(this,t):k})),L.length&&(p.pending=!0,Promise.all(L).then(()=>{p.pending=!1,this.controlled||r(this,Ns).delete(p)},()=>{p.pending=!1,this.controlled?r(this,Je).announce(this.t("reverted",{event:u,place:a(this,y,Im).call(this,e)})):this.revert(p)})),!0):(r(this,Je).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},xd=new WeakMap,Pf=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let s=0,l=1/0;i.forEach((p,u)=>{let b=p.getBoundingClientRect(),f=e<b.left?b.left-e:e>b.right?e-b.right:0;f<l&&(l=f,s=Number(p.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:s,min:(t-d.top)/d.height*60}},Gx=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let s=null,l=1/0;for(let d of i){let p=d.getBoundingClientRect(),u=e<p.left?p.left-e:e>p.right?e-p.right:0,b=t<p.top?p.top-t:t>p.bottom?t-p.bottom:0,f=Math.hypot(u,b);f<l&&(l=f,s=d)}return s?Number(s.dataset.i):null},wd=new WeakMap,$d=new WeakMap,kd=new WeakMap,Ed=new WeakMap,Md=new WeakMap,_d=new WeakMap,If=function(){let e=r(this,ne);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Je).announce(this.t("pickedUp",{event:e.ev.name,place:a(this,y,Hs).call(this,e,e.from)})),a(this,y,qm).call(this);let t=()=>{r(this,ne)?.started&&(a(this,y,Wx).call(this),r(this,ne).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},qm=function(){let e=r(this,ne);if(!e)return;let t=null;if(e.mode==="time"){let l=a(this,y,Pf).call(this,e.x,e.y);if(l){let d=a(this,y,md).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,y,Xt))))}}}else{let l=a(this,y,Gx).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let s=t.group===e.from.group&&t.index===e.from.index;this._target=s?null:{iso:B(a(this,y,It).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,y,Xt):void 0},i&&r(this,Je).announce(this.t("over",{place:a(this,y,Hs).call(this,e,t)}))},Wx=function(){let e=r(this,ne),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,s=14,l=x=>x<i?Math.ceil((i-Math.max(x,0))/i*s):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let p=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-p),b=l(d.bottom-e.y),f=t.scrollTop;u?t.scrollTop-=u:b&&(t.scrollTop+=b),t.scrollTop!==f&&a(this,y,qm).call(this)},fr=function(e){let t=r(this,ne);t&&(g(this,ne,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,Ed),!0),window.removeEventListener("pointerup",r(this,Md),!0),window.removeEventListener("pointercancel",r(this,_d),!0),window.removeEventListener("touchmove",r(this,$d),!0),window.removeEventListener("contextmenu",r(this,kd),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&a(this,y,Rf).call(this,t,t.from,t.to,"pointer")))},ud=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,y,Oe)},bubbles:!0,composed:!0}))},Yx=function(e,t,i){let s=i*60;if(e.detail>0){let p=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-p.top)/p.height*60/r(this,y,Xt))*r(this,y,Xt);s+=Math.max(0,Math.min(59,u))}let l=Math.floor(s/60),d=s%60;a(this,y,ud).call(this,`${t}T${Fm(l)}:${Fm(d)}`,!1)},qf=function(e,t){if(performance.now()<r(this,mo)||r(this,He).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()},Xx=function(e){this._more=e,g(this,uo,!0)},Om=function(e){let t=this._more;this._more="",e&&t&&(g(this,Jt,`more:${t}`),g(this,ft,{key:`more:${t}`,until:Date.now()+1e3}))},Of=function(){return r(this,ae)?.ev??(r(this,ne)?.started?r(this,ne).ev:null)},lo=function(e,t,i,s,l,d={}){let p=e.el,u=p.pending,b=a(this,y,Rx).call(this,e),f=!this.readonly&&!p.locked&&!u,x=["attention","information","success","critical"].includes(p.tone)?p.tone:"neutral",v=`chip ${s} tone-${x}${l?" item":""}${p.moving?" moving":""}${u?" pending":""}${p.locked?" locked":""}`,k=p.icon?c`<cm-icon name=${p.icon} size="14"></cm-icon>`:h,L=e.allDay?h:c`<span class="tm">${a(this,y,cd).call(this,e.min)}</span>`,P=p.kind&&(s!=="month"||!p.icon)?c`<span class="k">${p.kind}</span>`:h,U=u?c`<span class="spin" aria-hidden="true"></span>`:h,q=s==="time"?c`<span class="lead">${k}${L}${U}</span><span class="h">${e.name}</span>${P}`:c`${k}${L}<span class="h">${e.name}</span>${P}${U}`,O=u?`${b}, ${this.t("saving")}`:b,be=f?`${r(this,Xe)}-mv`:`${r(this,Xe)}-op`,W=`ev:${e.key}:${t}`,K=f?this.t("roleDescription"):h;return p.href?c`<a class=${v} href=${p.href} style=${d.style??h} data-k=${W} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
3074
|
+
</div>`}};mo=new WeakMap,Xe=new WeakMap,Je=new WeakMap,He=new WeakMap,ae=new WeakMap,ne=new WeakMap,Ps=new WeakMap,Qt=new WeakMap,ft=new WeakMap,bd=new WeakMap,vr=new WeakMap,uo=new WeakMap,go=new WeakMap,fo=new WeakMap,bo=new WeakMap,vd=new WeakMap,y=new WeakSet,Oe=function(){return Lx.includes(this.view)?this.view:"month"},fr=function(){return Wi(this,this.locale)},cd=function(){return Ha(r(this,y,fr))},Om=function(){return Aa(r(this,y,fr),this.hourCycle)},Jt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Lf=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,y,fr)):(Math.trunc(e)%7+7)%7},dd=function(){return R(this.today)?this.today:Xu()},It=function(){return R(this.date)??R(r(this,y,dd))},Af=function(){return r(this,y,Oe)==="month"&&this._narrow},Rx=function(){return r(this,y,Oe)!=="month"},qt=function(){let e=r(this,y,It),t=r(this,y,Lf);if(r(this,y,Oe)==="day")return[e];if(r(this,y,Oe)==="week"){if(this._narrow)return[e,te(e,1),te(e,2)];let d=te(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(p,u)=>te(d,u))}let i=ze(e),s=te(i,-((i.getDay()-t+7)%7)),l=Math.ceil((qm(s,Jr(e))+1)/7)*7;return Array.from({length:l},(d,p)=>te(s,p))},lo=function(e){let t=e.name,i=!!R(e.start),s=e.allDay||i;if(s){let u=R(xt(e.start).date||e.start);if(!u)return null;let b=R(xt(e.end).date||e.end)??u;b<u&&(b=u);let f=Math.min(qm(u,b),366);return{el:e,key:e.key,name:t,allDay:s,start:u,end:b,min:0,dur:1440,days:Array.from({length:f+1},(x,v)=>B(te(u,v)))}}let l=Ut(e.start);if(!l)return null;let d=Ut(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let p=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:s,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:p,days:[B(l)]}},Hx=function(){return this.events.map(e=>a(this,y,lo).call(this,e)).filter(e=>!!e)},Nx=function(e){let t=new Map;for(let i of e)for(let s of i.days)(t.get(s)??t.set(s,[]).get(s)).push(i);for(let i of t.values())i.sort((s,l)=>(s.allDay===l.allDay?0:s.allDay?-1:1)||s.start.getTime()-l.start.getTime()||s.name.localeCompare(l.name));return t},gt=function(e){return me(e,{weekday:"long",day:"numeric",month:"long"},r(this,y,fr))},hd=function(e){return r(this,y,Om).format((e%1440+1440)%1440)},pd=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},s=Dx(r(this,y,fr),{hour:"numeric",minute:"2-digit",...i});try{if(B(e)===B(t)&&s.formatRangeToParts){let p=s.formatRangeToParts(e,t),u=p.findIndex(f=>f.source==="endRange"),b=-1;if(p.forEach((f,x)=>{f.source==="startRange"&&(b=x)}),b>=0&&u>b){let f=x=>Sf(x.map(v=>v.value).join(""));return this.t("timeRange",{start:f(p.slice(0,b+1)),end:f(p.slice(u))})}}}catch{}let l=B(e)===B(t),d=p=>l?a(this,y,hd).call(this,p.getHours()*60+p.getMinutes()):r(this,y,Om).dateTime(p);return this.t("timeRange",{start:d(e),end:d(t)})},Bm=function(e){return e.allDay?B(e.start)===B(e.end)?this.t("allDayOn",{date:a(this,y,gt).call(this,e.start)}):this.t("allDayRange",{start:a(this,y,gt).call(this,e.start),end:a(this,y,gt).call(this,e.end)}):B(e.start)!==B(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&qm(e.start,e.end)===1)?a(this,y,pd).call(this,e.start,e.end):this.t("timed",{date:a(this,y,gt).call(this,e.start),time:a(this,y,pd).call(this,e.start,e.end)})},Px=function(e){let t={title:e.name,when:a(this,y,Bm).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Ix=function(e){let t=r(this,y,fr);if(r(this,y,Oe)==="month")return r(this,y,cd).monthYear(r(this,y,It));if(e.length===1)return me(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Dx(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Sf(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},qx=function(e){return r(this,y,Om).hour12?Sf(me(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,y,fr))):a(this,y,hd).call(this,e*60)},Ns=function(e,t){let{start:i,end:s}=a(this,y,Rf).call(this,e,t);return e.mode==="time"?this.t("timed",{date:a(this,y,gt).call(this,i),time:a(this,y,pd).call(this,i,s)}):a(this,y,gt).call(this,te(R(e.origin),t.group-e.from.group))},Df=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<B0;t!==this._narrow&&(this._narrow=t)},md=function(e,t){return r(this,y,Oe)==="month"?fe(e,t):r(this,y,Oe)==="week"?te(e,t*(this._narrow?3:7)):te(e,t)},Ox=function(e){this.view!==e&&(this.view=e)},ud=function(){return[...this.renderRoot.querySelectorAll(".item")]},Bx=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(s=>s.dataset.k===e&&s.classList.contains("item"))??t.find(s=>s.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let s=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${s}`)??null}return null},Fx=function(){let e=B(r(this,y,It));if(r(this,y,Af))return`day:${e}`;if(r(this,y,Oe)==="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}`},Vx=function(){let e=a(this,y,ud).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Qt))??e.find(i=>i.dataset.k===a(this,y,Fx).call(this))??e.find(i=>i.dataset.day===B(r(this,y,It)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},jx=function(e){g(this,Qt,e.dataset.k??"");for(let t of a(this,y,ud).call(this))t.tabIndex=t===e?0:-1;e.focus()},yd=new WeakMap,xd=new WeakMap,Ux=function(e,t){let i=new Map;for(let v of a(this,y,ud).call(this)){let k=Number(v.dataset.i);(i.get(k)??i.set(k,[]).get(k)).push(v)}let s=Number(e.dataset.i),l=i.get(s)??[e],d=Math.max(0,l.indexOf(e)),p=a(this,y,qt).call(this).length,u=r(this,y,Oe)==="month",b=e.dataset.row,f=(v,k)=>{let L=v>=0&&v<p?i.get(v):void 0;return(L?.length?k(L):void 0)??null},x=v=>u?v[Math.min(d,v.length-1)]:v.find(k=>k.dataset.row===b)??v[0];switch(t){case"ArrowRight":return f(s+1,x);case"ArrowLeft":return f(s-1,x);case"ArrowDown":return l[d+1]??(u?f(s+7,v=>v[0]):null);case"ArrowUp":return d>0?l[d-1]:u?f(s-7,v=>v[v.length-1]):null;case"Home":return u?f(s-s%7,v=>v[0]):f(0,x);case"End":return u?f(Math.min(p-1,s-s%7+6),v=>v[0]):f(p-1,x);default:return null}},Kx=function(e,t){let i=e.dataset.day??B(r(this,y,It)),s=a(this,y,md).call(this,R(i)??r(this,y,It),t),l=B(s),d=(e.dataset.k??"").split(":")[0],p;r(this,y,Af)?p=`day:${l}`:r(this,y,Oe)==="month"?p=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?p=`adadd:${l}`:p=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=B(a(this,y,md).call(this,r(this,y,It),t)),g(this,Qt,p),g(this,ft,{key:p,until:Date.now()+1e3})},wd=new WeakMap,gd=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,y,Jt))+1},Wx=function(e,t){let i=r(this,ae);if(!i)return null;let s=a(this,y,qt).call(this).length,l=b=>Math.max(0,Math.min(s-1,b));if(i.mode==="day"){let b=r(this,y,Oe)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return b?{group:t.group+7<s?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return b?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:b?t.group-t.group%7:0,index:0};case"End":return{group:b?l(t.group-t.group%7+6):s-1,index:0};default:return null}}let d=a(this,y,gd).call(this,i.ev.dur)-1,p=Math.max(1,Math.round(60/r(this,y,Jt))),u=b=>Math.max(0,Math.min(d,b));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+p)};case"PageUp":return{group:t.group,index:u(t.index-p)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Rf=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=a(this,y,qt).call(this)[t.group]??R(e.origin),p=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,y,Jt));return{start:p,end:new Date(p.getTime()+i.dur*6e4)}}let s=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+s,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},Hf=function(e,t){let s=a(this,y,qt).call(this).map(B).indexOf(t);if(s<0)return null;let l=r(this,y,Rx)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,y,Jt)),a(this,y,gd).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:s,index:d}}},Nf=function(){r(this,ae)&&(r(this,ae).ev.el.moving=!1),g(this,ae,null),this._target=null},Gx=function(e){let t=r(this,ae);if(!t||!e){this._target=null;return}let i=B(a(this,y,qt).call(this)[e.group]??R(t.origin)),s=e.group===t.from.group&&e.index===t.from.index;this._target=s?null:{iso:i,min:t.mode==="time"?e.index*r(this,y,Jt):void 0}},Yx=function(e,t){let i=r(this,ae);a(this,y,Nf).call(this),i&&(g(this,uo,performance.now()+400),a(this,y,Pf).call(this,i,e,t,"keyboard"))},Pf=function(e,t,i,s){let l=t.group===i.group&&t.index===i.index,{start:d,end:p}=a(this,y,Rf).call(this,e,i),u=B(te(R(e.origin),i.group-t.group));a(this,y,qf).call(this,e.ev,d,p,s,l,e.mode==="time"?B(d):u)},If=function(e,t,i){return e?{start:B(t),end:B(i)}:{start:Sx(t),end:Sx(i)}},qf=function(e,t,i,s,l,d){let p=e.el,u=e.name,b=a(this,y,If).call(this,e.allDay,e.start,e.end),f=a(this,y,If).call(this,e.allDay,t,i),x=q=>{s==="keyboard"&&g(this,ft,{key:q,until:Date.now()+1e3})};if(l||b.start===f.start&&b.end===f.end)return s!=="api"&&r(this,Je).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let v={...e,start:t,end:i},k=e.allDay?a(this,y,gt).call(this,t):this.t("timed",{date:a(this,y,gt).call(this,t),time:a(this,y,pd).call(this,t,i)}),L=[],P={value:e.key,event:p,from:b,to:f,allDay:e.allDay,source:s,waitUntil:q=>{L.push(Promise.resolve(q))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:P,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Ps).set(p,b),p.start=f.start,p.end=f.end),x(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Je).announce(this.t("moved",{event:u,place:v.allDay?a(this,y,gt).call(this,t):k})),L.length&&(p.pending=!0,Promise.all(L).then(()=>{p.pending=!1,this.controlled||r(this,Ps).delete(p)},()=>{p.pending=!1,this.controlled?r(this,Je).announce(this.t("reverted",{event:u,place:a(this,y,Bm).call(this,e)})):this.revert(p)})),!0):(r(this,Je).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},$d=new WeakMap,Of=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let s=0,l=1/0;i.forEach((p,u)=>{let b=p.getBoundingClientRect(),f=e<b.left?b.left-e:e>b.right?e-b.right:0;f<l&&(l=f,s=Number(p.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:s,min:(t-d.top)/d.height*60}},Xx=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let s=null,l=1/0;for(let d of i){let p=d.getBoundingClientRect(),u=e<p.left?p.left-e:e>p.right?e-p.right:0,b=t<p.top?p.top-t:t>p.bottom?t-p.bottom:0,f=Math.hypot(u,b);f<l&&(l=f,s=d)}return s?Number(s.dataset.i):null},kd=new WeakMap,Ed=new WeakMap,Md=new WeakMap,_d=new WeakMap,Td=new WeakMap,Cd=new WeakMap,Bf=function(){let e=r(this,ne);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Je).announce(this.t("pickedUp",{event:e.ev.name,place:a(this,y,Ns).call(this,e,e.from)})),a(this,y,Fm).call(this);let t=()=>{r(this,ne)?.started&&(a(this,y,Jx).call(this),r(this,ne).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Fm=function(){let e=r(this,ne);if(!e)return;let t=null;if(e.mode==="time"){let l=a(this,y,Of).call(this,e.x,e.y);if(l){let d=a(this,y,gd).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,y,Jt))))}}}else{let l=a(this,y,Xx).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let s=t.group===e.from.group&&t.index===e.from.index;this._target=s?null:{iso:B(a(this,y,qt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,y,Jt):void 0},i&&r(this,Je).announce(this.t("over",{place:a(this,y,Ns).call(this,e,t)}))},Jx=function(){let e=r(this,ne),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,s=14,l=x=>x<i?Math.ceil((i-Math.max(x,0))/i*s):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let p=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-p),b=l(d.bottom-e.y),f=t.scrollTop;u?t.scrollTop-=u:b&&(t.scrollTop+=b),t.scrollTop!==f&&a(this,y,Fm).call(this)},br=function(e){let t=r(this,ne);t&&(g(this,ne,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,_d),!0),window.removeEventListener("pointerup",r(this,Td),!0),window.removeEventListener("pointercancel",r(this,Cd),!0),window.removeEventListener("touchmove",r(this,Ed),!0),window.removeEventListener("contextmenu",r(this,Md),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&a(this,y,Pf).call(this,t,t.from,t.to,"pointer")))},fd=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,y,Oe)},bubbles:!0,composed:!0}))},Qx=function(e,t,i){let s=i*60;if(e.detail>0){let p=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-p.top)/p.height*60/r(this,y,Jt))*r(this,y,Jt);s+=Math.max(0,Math.min(59,u))}let l=Math.floor(s/60),d=s%60;a(this,y,fd).call(this,`${t}T${Um(l)}:${Um(d)}`,!1)},Ff=function(e,t){if(performance.now()<r(this,uo)||r(this,He).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()},Zx=function(e){this._more=e,g(this,go,!0)},Vm=function(e){let t=this._more;this._more="",e&&t&&(g(this,Qt,`more:${t}`),g(this,ft,{key:`more:${t}`,until:Date.now()+1e3}))},Vf=function(){return r(this,ae)?.ev??(r(this,ne)?.started?r(this,ne).ev:null)},co=function(e,t,i,s,l,d={}){let p=e.el,u=p.pending,b=a(this,y,Px).call(this,e),f=!this.readonly&&!p.locked&&!u,x=["attention","information","success","critical"].includes(p.tone)?p.tone:"neutral",v=`chip ${s} tone-${x}${l?" item":""}${p.moving?" moving":""}${u?" pending":""}${p.locked?" locked":""}`,k=p.icon?c`<cm-icon name=${p.icon} size="14"></cm-icon>`:h,L=e.allDay?h:c`<span class="tm">${a(this,y,hd).call(this,e.min)}</span>`,P=p.kind&&(s!=="month"||!p.icon)?c`<span class="k">${p.kind}</span>`:h,U=u?c`<span class="spin" aria-hidden="true"></span>`:h,q=s==="time"?c`<span class="lead">${k}${L}${U}</span><span class="h">${e.name}</span>${P}`:c`${k}${L}<span class="h">${e.name}</span>${P}${U}`,O=u?`${b}, ${this.t("saving")}`:b,be=f?`${r(this,Xe)}-mv`:`${r(this,Xe)}-op`,G=`ev:${e.key}:${t}`,K=f?this.t("roleDescription"):h;return p.href?c`<a class=${v} href=${p.href} style=${d.style??h} data-k=${G} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
3075
3075
|
data-row=${d.row??h} aria-label=${O} aria-describedby=${be} aria-roledescription=${K}
|
|
3076
|
-
@click=${Z=>a(this,y,
|
|
3076
|
+
@click=${Z=>a(this,y,Ff).call(this,Z,e)}>${q}</a>`:c`<button type="button" class=${v} style=${d.style??h} data-k=${G} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
3077
3077
|
data-row=${d.row??h} aria-label=${O} aria-describedby=${be} aria-roledescription=${K}
|
|
3078
|
-
@click=${Z=>a(this,y,
|
|
3078
|
+
@click=${Z=>a(this,y,Ff).call(this,Z,e)}>${q}</button>`},jm=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.name}</div>`},ew=function(e){let t=r(this,y,Oe),i=t==="week"&&this._narrow,s=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">
|
|
3079
3079
|
<div class="nav">
|
|
3080
3080
|
<button type="button" class="hb icon prev" aria-label=${s} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
3081
3081
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
3082
3082
|
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
3083
3083
|
</div>
|
|
3084
|
-
<div class="title" part="title" id="${r(this,Xe)}-t" role="heading" aria-level=${d} aria-live="polite">${a(this,y,
|
|
3084
|
+
<div class="title" part="title" id="${r(this,Xe)}-t" role="heading" aria-level=${d} aria-live="polite">${a(this,y,Ix).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
3085
3085
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
3086
|
-
${
|
|
3086
|
+
${Lx.map(p=>c`<button type="button" class="hb" data-view=${p} aria-pressed=${p===t?"true":"false"} @click=${()=>a(this,y,Ox).call(this,p)}>${this.t(p)}</button>`)}
|
|
3087
3087
|
</div>
|
|
3088
|
-
</div>`},
|
|
3089
|
-
<button type="button" class="dayb item" data-k="day:${
|
|
3090
|
-
@click=${()=>{this.date=
|
|
3091
|
-
</td>`}let X=K,
|
|
3092
|
-
aria-label=${pe?this.t("dayEvents",{date:Z,count:K.length}):h} aria-current=${
|
|
3093
|
-
<div class="dh">${
|
|
3094
|
-
${pe?h:c`<button type="button" class="add item" data-k="add:${
|
|
3095
|
-
@click=${()=>a(this,y,
|
|
3088
|
+
</div>`},tw=function(e){let t=r(this,y,cd),i=Array.from({length:7},(s,l)=>(l+r(this,y,Lf))%7);return c`<thead><tr>${i.map(s=>c`<th scope="col" abbr=${t.weekdaysLong[s]}><span aria-hidden="true">${e?t.weekdaysShort[s].slice(0,2):t.weekdaysShort[s]}</span><span class="vh">${t.weekdaysLong[s]}</span></th>`)}</tr></thead>`},iw=function(e,t){let i=r(this,y,It),s=r(this,y,dd),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=a(this,y,Vf).call(this),p=this._target,u=Array.from({length:e.length/7},(q,O)=>e.slice(O*7,O*7+7)),b=this._narrow,f=(q,O,be)=>{let G=B(q),K=t.get(G)??[],Z=a(this,y,gt).call(this,q),zt=`${q.getMonth()!==i.getMonth()?"other":""} ${G===s?"today":""} ${p?.iso===G?"over":""}`,$r=c`<span class="num" aria-hidden="true">${r(this,y,cd).day(q)}</span>`;if(b){let Fe=K.slice(0,3).map(Ys=>["attention","information","success","critical"].includes(Ys.el.tone)?Ys.el.tone:"neutral");return c`<td class=${zt} data-drop data-i=${O} aria-selected=${G===B(i)?"true":"false"} aria-current=${G===s?"date":h}>
|
|
3089
|
+
<button type="button" class="dayb item" data-k="day:${G}" data-i=${O} data-day=${G} aria-label=${this.t("dayEvents",{date:Z,count:K.length})}
|
|
3090
|
+
@click=${()=>{this.date=G,g(this,Qt,`day:${G}`)}}>${$r}<span class="dots">${Fe.map(Ys=>c`<span class="dot tone-${Ys}"></span>`)}</span></button>
|
|
3091
|
+
</td>`}let X=K,St=0;if(K.length>l){X=K.slice(0,l-1);let Fe=d&&K.find(Ys=>Ys.key===d.key);Fe&&!X.includes(Fe)&&(X=[...K.slice(0,l-2),Fe]),St=K.length-X.length}let pe=this.readonly;return c`<td class="${zt}${pe?" item":""}" data-drop data-i=${O} data-day=${G} data-k=${pe?`cell:${G}`:h}
|
|
3092
|
+
aria-label=${pe?this.t("dayEvents",{date:Z,count:K.length}):h} aria-current=${G===s?"date":h}>
|
|
3093
|
+
<div class="dh">${$r}<span class="vh">${Z}</span>
|
|
3094
|
+
${pe?h:c`<button type="button" class="add item" data-k="add:${G}" data-i=${O} data-day=${G} aria-label=${this.t("addOn",{date:Z})}
|
|
3095
|
+
@click=${()=>a(this,y,fd).call(this,G,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
3096
3096
|
</div>
|
|
3097
|
-
${X.length||p?.iso===
|
|
3098
|
-
${X.map(Fe=>c`<li>${a(this,y,
|
|
3099
|
-
${p?.iso===
|
|
3097
|
+
${X.length||p?.iso===G&&d?c`<ul class="evs">
|
|
3098
|
+
${X.map(Fe=>c`<li>${a(this,y,co).call(this,Fe,G,O,"month",!0)}</li>`)}
|
|
3099
|
+
${p?.iso===G&&d?c`<li aria-hidden="true">${a(this,y,jm).call(this,d)}</li>`:h}
|
|
3100
3100
|
</ul>`:h}
|
|
3101
|
-
${
|
|
3102
|
-
aria-expanded=${this._more===
|
|
3103
|
-
@click=${()=>this._more===
|
|
3104
|
-
${this._more===
|
|
3105
|
-
<div class="pop-h"><span>${Z}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>a(this,y,
|
|
3106
|
-
<ul>${K.map(Fe=>c`<li>${a(this,y,
|
|
3101
|
+
${St?c`<button type="button" class="more item" data-k="more:${G}" data-i=${O} data-day=${G} aria-haspopup="dialog"
|
|
3102
|
+
aria-expanded=${this._more===G?"true":"false"} aria-label=${this.t("moreLabel",{count:St,date:Z})}
|
|
3103
|
+
@click=${()=>this._more===G?a(this,y,Vm).call(this,!1):a(this,y,Zx).call(this,G)}>${this.t("more",{count:St})}</button>`:h}
|
|
3104
|
+
${this._more===G?c`<div class="pop ${be>=4?"end":""}" role="dialog" aria-label=${Z}>
|
|
3105
|
+
<div class="pop-h"><span>${Z}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>a(this,y,Vm).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
3106
|
+
<ul>${K.map(Fe=>c`<li>${a(this,y,co).call(this,Fe,G,O,"list",!1)}</li>`)}</ul>
|
|
3107
3107
|
</div>`:h}
|
|
3108
3108
|
</td>`},x=c`<table class="month ${b?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,Xe)}-t" aria-describedby="${r(this,Xe)}-gh"
|
|
3109
3109
|
aria-busy=${this.loading?"true":"false"}>
|
|
3110
|
-
${a(this,y,
|
|
3111
|
-
<tbody>${u.map((q,O)=>c`<tr>${q.map((be,
|
|
3110
|
+
${a(this,y,tw).call(this,b)}
|
|
3111
|
+
<tbody>${u.map((q,O)=>c`<tr>${q.map((be,G)=>f(be,O*7+G,G))}</tr>`)}</tbody>
|
|
3112
3112
|
</table>`;if(!b)return x;let v=B(i),k=t.get(v)??[],L=e.findIndex(q=>B(q)===v),P=a(this,y,gt).call(this,i),U=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${x}
|
|
3113
3113
|
<section class="agenda" part="agenda" aria-labelledby="${r(this,Xe)}-ag">
|
|
3114
3114
|
<div class="ag-h">
|
|
3115
3115
|
<div class="ag-t" id="${r(this,Xe)}-ag" role="heading" aria-level=${U}>${P}</div>
|
|
3116
|
-
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:P})} @click=${()=>a(this,y,
|
|
3116
|
+
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:P})} @click=${()=>a(this,y,fd).call(this,v,!0)}>
|
|
3117
3117
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
3118
3118
|
</div>
|
|
3119
|
-
${k.length?c`<ul class="ag-list">${k.map(q=>c`<li>${a(this,y,
|
|
3120
|
-
</section>`},
|
|
3119
|
+
${k.length?c`<ul class="ag-list">${k.map(q=>c`<li>${a(this,y,co).call(this,q,v,L,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
3120
|
+
</section>`},rw=function(e){let t=new Map,i=e.filter(u=>!u.allDay).sort((u,b)=>u.min-b.min||b.dur-u.dur),s=[],l=[],d=-1,p=()=>{for(let u of s)t.get(u).lanes=l.length;s=[],l=[]};for(let u of i){let b=Math.min(1440,u.min+Math.max(u.dur,20));u.min>=d&&(p(),d=-1);let f=l.findIndex(x=>x<=u.min);f<0?(f=l.length,l.push(b)):l[f]=b,t.set(u,{lane:f,lanes:1}),s.push(u),d=Math.max(d,b)}return p(),t},sw=function(e,t){let i=r(this,y,dd),s=r(this,y,cd),l=a(this,y,Vf).call(this),d=this._target,p=this.readonly,u=e.map(f=>{let x=B(f),v=t.get(x)??[];return{d:f,iso:x,text:a(this,y,gt).call(this,f),allDay:v.filter(k=>k.allDay),timed:v.filter(k=>!k.allDay),lanes:a(this,y,rw).call(this,v)}}),b=Array.from({length:24},(f,x)=>x);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${r(this,Xe)}-t" aria-describedby="${r(this,Xe)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
3121
3121
|
style="--cols:${e.length}">
|
|
3122
3122
|
<div class="tg-top" role="rowgroup">
|
|
3123
3123
|
<div class="row" role="row">
|
|
@@ -3130,24 +3130,24 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3130
3130
|
<div class="axis" role="rowheader">${this.t("allDay")}</div>
|
|
3131
3131
|
${u.map((f,x)=>c`<div class="adcell ${d?.iso===f.iso&&l?.allDay?"over":""}" role="gridcell" data-drop data-i=${x}>
|
|
3132
3132
|
${p?h:c`<button type="button" class="add item" data-k="adadd:${f.iso}" data-i=${x} data-day=${f.iso} data-row="a"
|
|
3133
|
-
aria-label=${this.t("addAllDay",{date:f.text})} @click=${()=>a(this,y,
|
|
3134
|
-
${f.allDay.map(v=>a(this,y,
|
|
3135
|
-
${d?.iso===f.iso&&l?.allDay?a(this,y,
|
|
3133
|
+
aria-label=${this.t("addAllDay",{date:f.text})} @click=${()=>a(this,y,fd).call(this,f.iso,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
3134
|
+
${f.allDay.map(v=>a(this,y,co).call(this,v,f.iso,x,"allday",!0,{row:"a"}))}
|
|
3135
|
+
${d?.iso===f.iso&&l?.allDay?a(this,y,jm).call(this,l):h}
|
|
3136
3136
|
</div>`)}
|
|
3137
3137
|
</div>
|
|
3138
3138
|
</div>
|
|
3139
3139
|
<div class="tg-body" role="rowgroup">
|
|
3140
3140
|
${b.map(f=>c`<div class="row hr" role="row">
|
|
3141
|
-
<div class="axis" role="rowheader"><span>${a(this,y,
|
|
3141
|
+
<div class="axis" role="rowheader"><span>${a(this,y,qx).call(this,f)}</span></div>
|
|
3142
3142
|
${u.map((x,v)=>{let k=x.timed.filter(P=>Math.floor(P.min/60)===f),L=l&&!l.allDay&&d?.iso===x.iso&&d.min!==void 0&&Math.floor(d.min/60)===f;return c`<div class="tcell" role="gridcell" data-i=${v} data-row=${f} data-day=${x.iso}>
|
|
3143
3143
|
${p?h:c`<button type="button" class="slot item" data-k="slot:${x.iso}:${f}" data-i=${v} data-row=${f} data-day=${x.iso}
|
|
3144
|
-
aria-label=${this.t("addAt",{time:a(this,y,
|
|
3145
|
-
${k.map(P=>{let U=x.lanes.get(P)??{lane:0,lanes:1},q=Math.min(P.dur,1440-P.min)/60;return a(this,y,
|
|
3146
|
-
${L?a(this,y,
|
|
3144
|
+
aria-label=${this.t("addAt",{time:a(this,y,hd).call(this,f*60),date:x.text})} @click=${P=>a(this,y,Qx).call(this,P,x.iso,f)}></button>`}
|
|
3145
|
+
${k.map(P=>{let U=x.lanes.get(P)??{lane:0,lanes:1},q=Math.min(P.dur,1440-P.min)/60;return a(this,y,co).call(this,P,x.iso,v,"time",!0,{row:String(f),style:`--top:${(P.min-f*60)/60};--len:${q};--lane:${U.lane};--lanes:${U.lanes}`})})}
|
|
3146
|
+
${L?a(this,y,jm).call(this,l,"time",`--top:${(d.min-f*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
3147
3147
|
</div>`})}
|
|
3148
3148
|
</div>`)}
|
|
3149
3149
|
</div>
|
|
3150
|
-
</div>`},
|
|
3150
|
+
</div>`},po.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}},po.styles=[E,w`
|
|
3151
3151
|
:host { display: block; position: relative; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
3152
3152
|
:host([dragging]) { cursor: grabbing; user-select: none; -webkit-user-select: none; }
|
|
3153
3153
|
.cal { display: flex; flex-direction: column; gap: var(--cm-space-12); min-width: 0; }
|
|
@@ -3308,12 +3308,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3308
3308
|
.chip.time > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3309
3309
|
.chip.time .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
3310
3310
|
.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; }
|
|
3311
|
-
`];$("cm-calendar",
|
|
3311
|
+
`];$("cm-calendar",po);var Z_=z("reportTile",{pinned:", pinned"}),Is=class extends C{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=c`
|
|
3312
3312
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
3313
3313
|
<span class="label">${this.label}</span>
|
|
3314
3314
|
${this.pinned?c`<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
3315
3315
|
<span class="sr">${this.t("pinned")}</span></span>`:h}
|
|
3316
|
-
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};
|
|
3316
|
+
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};Is.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},Is.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Is.styles=[E,w`
|
|
3317
3317
|
:host { display: block; }
|
|
3318
3318
|
.tile {
|
|
3319
3319
|
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-12);
|
|
@@ -3332,10 +3332,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3332
3332
|
.icon cm-icon::part(svg) { width: 32px; height: 32px; }
|
|
3333
3333
|
::slotted([slot='icon']) { width: 32px; height: 32px; }
|
|
3334
3334
|
}
|
|
3335
|
-
`];$("cm-report-tile",
|
|
3335
|
+
`];$("cm-report-tile",Is);var vo=class extends A{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`
|
|
3336
3336
|
${this.heading?c`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:h}
|
|
3337
3337
|
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":h}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
3338
|
-
`}};
|
|
3338
|
+
`}};vo.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},vo.styles=[E,w`
|
|
3339
3339
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
3340
3340
|
.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; }
|
|
3341
3341
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-12); }
|
|
@@ -3345,7 +3345,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3345
3345
|
.title { margin-bottom: var(--cm-space-8); }
|
|
3346
3346
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
3347
3347
|
}
|
|
3348
|
-
`];$("cm-report-tiles",
|
|
3348
|
+
`];$("cm-report-tiles",vo);var sT=z("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),aw=/^\s*-?\d+(\.\d+)?\s*$/,yo=class extends C{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:aw.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(),s=t==="positive"?this.t("good",{trend:i}):t==="negative"?this.t("bad",{trend:i}):i;return c`<span class="change ${e} ${t}" part="change">
|
|
3349
3349
|
<cm-icon name=${e==="flat"?"arrow-left":"arrow-up-right"} size="16"></cm-icon><span aria-hidden="true">${this.change}</span><span class="sr">${s}</span>
|
|
3350
3350
|
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),i=this.renderChange(),s=i!==h||e,l=c`
|
|
3351
3351
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
@@ -3354,7 +3354,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3354
3354
|
${i}
|
|
3355
3355
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
3356
3356
|
</span>
|
|
3357
|
-
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,p=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${s?"foot":h} aria-busy=${p}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${p}>${l}</div>${d}`}};
|
|
3357
|
+
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,p=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${s?"foot":h} aria-busy=${p}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${p}>${l}</div>${d}`}};yo.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&aw.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}},yo.styles=[E,w`
|
|
3358
3358
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
3359
3359
|
.tile {
|
|
3360
3360
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -3390,29 +3390,29 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3390
3390
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
3391
3391
|
}
|
|
3392
3392
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
3393
|
-
`];$("cm-metric",
|
|
3394
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${a(this,Y,
|
|
3393
|
+
`];$("cm-metric",yo);var xo=class extends A{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 nw(this)}};xo.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}},xo.styles=w`:host { display: none !important; }`;$("cm-nav-item",xo);function nw(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=Si(o);return t.length&&(e.items=t),e}var Si=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(nw),jf=o=>o.value||o.href||o.label,Km=o=>!!o.current||!!o.items?.some(Km),yr=(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},xr=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:jf(n),href:n.href??""}}));var mT=z("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),zd,Sd,Ym,Y,Uf,Wm,Kf,ow,lw,Wf,Gf,cw,Yf,Xf,Gm,Jf,dw,wo=class extends C{constructor(){super(...arguments);m(this,Y);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;m(this,zd,new Set);m(this,Sd);m(this,Ym,N("cm-sidenav"))}connectedCallback(){super.connectedCallback(),a(this,Y,Uf).call(this),g(this,Sd,yr(this,()=>a(this,Y,Uf).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Sd)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let i=a(this,Y,Wm).call(this,e,t);r(this,zd).has(i)||!e.items?.length||(r(this,zd).add(i),(e.expanded||Km(e))&&this._open.add(i))})}toggle(e,t){let i=this.navItems[e];if(!i?.items?.length)return;let s=a(this,Y,Wm).call(this,i,e),l=t??!this._open.has(s);if(l===this._open.has(s))return;let d=new Set(this._open);l?d.add(s):d.delete(s),this._open=d,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:i,expanded:l}}))}render(){let e=this.collapsed;return c`
|
|
3394
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${a(this,Y,lw)}>
|
|
3395
3395
|
<slot name="header"></slot>
|
|
3396
3396
|
<ul part="list">
|
|
3397
|
-
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${a(this,Y,
|
|
3398
|
-
${a(this,Y,
|
|
3399
|
-
aria-expanded=${s?"true":"false"} aria-controls=${l} @click=${()=>e?a(this,Y,
|
|
3400
|
-
${a(this,Y,
|
|
3397
|
+
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${a(this,Y,Jf).call(this,t,"",{index:i})}</li>`;let s=!e&&this._open.has(a(this,Y,Wm).call(this,t,i)),l=`${r(this,Ym)}-${i}`;return c`<li>
|
|
3398
|
+
${a(this,Y,Gm).call(this,t,c`<button type="button" class="item parent ${Km(t)?"has-current":""}" part="item" data-index=${i}
|
|
3399
|
+
aria-expanded=${s?"true":"false"} aria-controls=${l} @click=${()=>e?a(this,Y,cw).call(this,i):this.toggle(i)}>
|
|
3400
|
+
${a(this,Y,Yf).call(this,t)}${a(this,Y,Xf).call(this,t)}
|
|
3401
3401
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
3402
3402
|
</button>`)}
|
|
3403
3403
|
<ul class="sub" id=${l} ?hidden=${!s} aria-label=${t.label}>
|
|
3404
|
-
${a(this,Y,
|
|
3404
|
+
${a(this,Y,Wf).call(this,t.items).map(([d,p])=>c`<li>${a(this,Y,Jf).call(this,{...d,icon:void 0},p?"deep":"",{parent:i})}</li>`)}
|
|
3405
3405
|
</ul>
|
|
3406
3406
|
</li>`})}
|
|
3407
3407
|
</ul>
|
|
3408
|
-
${a(this,Y,
|
|
3408
|
+
${a(this,Y,dw).call(this)}
|
|
3409
3409
|
<slot name="footer"></slot>
|
|
3410
3410
|
<slot hidden></slot>
|
|
3411
3411
|
</nav>
|
|
3412
|
-
`}};
|
|
3413
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>a(this,Y,
|
|
3414
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>a(this,Y,
|
|
3415
|
-
@click=${()=>a(this,Y,
|
|
3412
|
+
`}};zd=new WeakMap,Sd=new WeakMap,Ym=new WeakMap,Y=new WeakSet,Uf=function(){this._slotted=Si(this)},Wm=function(e,t){return`${t}:${jf(e)}`},Kf=function(e,t){xr(this,t)||e.preventDefault()},ow=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},lw=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let i=a(this,Y,ow).call(this),s=i.indexOf(t),l=Number(t.dataset.index),d=se(e,this),p;if(e.key==="ArrowDown")p=i[(s+1)%i.length];else if(e.key==="ArrowUp")p=i[(s-1+i.length)%i.length];else if(e.key==="Home")p=i[0];else if(e.key==="End")p=i[i.length-1];else{if(this.collapsed&&(d==="ArrowRight"||d==="ArrowLeft"))return;if(d==="ArrowRight"&&t.classList.contains("parent")){this.toggle(l,!0),e.preventDefault();return}else if(d==="ArrowLeft"){if(t.classList.contains("parent")?this.toggle(l,!1):t.dataset.parent&&(p=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!p){e.preventDefault();return}}else return}e.preventDefault(),p?.focus()},Wf=function(e,t=0){return e.flatMap(i=>[[i,t],...a(this,Y,Wf).call(this,i.items??[],t+1)])},Gf=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},cw=function(e){a(this,Y,Gf).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},Yf=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},Xf=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}`},Gm=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},Jf=function(e,t,i={}){let s=c`${a(this,Y,Yf).call(this,e)}${a(this,Y,Xf).call(this,e)}`;return a(this,Y,Gm).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
3413
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>a(this,Y,Kf).call(this,l,e)}>${s}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
3414
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>a(this,Y,Kf).call(this,l,e)}>${s}</button>`)},dw=function(){if(!this.collapsible)return h;let e=this.t(this.collapsed?"expand":"collapse"),t=c`<cm-icon name=${this.collapsed?"chevron-right":"chevron-left"} size="20"></cm-icon>${this.collapsed?c`<span class="sr">${e}</span>`:c`<span class="label">${e}</span>`}`;return c`<div class="toggle-row">${a(this,Y,Gm).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
3415
|
+
@click=${()=>a(this,Y,Gf).call(this,!this.collapsed)}>${t}</button>`)}</div>`},wo.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},wo.styles=[E,w`
|
|
3416
3416
|
:host { display: block; width: var(--cm-side-navigation-width, 220px); }
|
|
3417
3417
|
nav {
|
|
3418
3418
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: var(--cm-radius-lg);
|
|
@@ -3457,7 +3457,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3457
3457
|
background: var(--cm-count-bg); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
3458
3458
|
}
|
|
3459
3459
|
.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); }
|
|
3460
|
-
`];$("cm-side-navigation",
|
|
3460
|
+
`];$("cm-side-navigation",wo);function hw(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 $o=class extends A{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=hw(this.name),t=this.decorative||!this.name?h:this.name,i=this.decorative||!this.name?"true":h,s,l="avatar";return this.src&&!this._failed?s=c`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?s=c`<span aria-hidden="true">${e}</span>`:(l+=" icon",s=c`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),c`<span class=${l} part="avatar" role=${t===h?h:"img"} aria-label=${t} aria-hidden=${i}>${s}</span>`}};$o.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},$o.styles=[E,w`
|
|
3461
3461
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3462
3462
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
3463
3463
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -3470,22 +3470,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3470
3470
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
3471
3471
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
3472
3472
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
3473
|
-
`];$("cm-avatar"
|
|
3473
|
+
`];$("cm-avatar",$o);var kT=z("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),Mo,Li,_o,Be,Ld,Qf,ko,Eo=class extends C{constructor(){super();m(this,Be);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;m(this,Mo);m(this,Li,!1);m(this,_o,null);this.addEventListener("cm-select",e=>{let t=a(this,Be,Ld).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){a(this,Be,Ld).call(this)?.focus();return}this._searchOpen||(g(this,_o,Wu()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),g(this,Mo,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,Mo).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Mo)?.disconnect(),r(this,Li)&&(Ql(),g(this,Li,!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,Li)||(Ku(),g(this,Li,!0)),a(this,Be,Ld).call(this)?.focus(),a(this,Be,ko).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,Li)&&(Ql(),g(this,Li,!1));let i=r(this,_o)??this.renderRoot.querySelector(".search-btn");g(this,_o,null),i?.isConnected&&i.focus(),a(this,Be,ko).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
3474
3474
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
3475
3475
|
<div class="logo"><slot name="logo"></slot></div>
|
|
3476
3476
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
3477
|
-
@click=${()=>a(this,Be
|
|
3478
|
-
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${a(this,Be,
|
|
3477
|
+
@click=${()=>a(this,Be,ko).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="16"></cm-icon></button>`:h}
|
|
3478
|
+
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${a(this,Be,Qf)}></slot></div>`}
|
|
3479
3479
|
<span class="grow"></span>
|
|
3480
3480
|
<div class="end">
|
|
3481
3481
|
${this._narrow&&this._hasSearch?c`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
3482
3482
|
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:h}
|
|
3483
3483
|
<div class="actions"><slot name="actions"></slot></div>
|
|
3484
3484
|
${this.balance?c`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
3485
|
-
@click=${()=>a(this,Be
|
|
3485
|
+
@click=${()=>a(this,Be,ko).call(this,"cm-wallet")}>${this.balance}</button>`:h}
|
|
3486
3486
|
<slot name="end"></slot>
|
|
3487
3487
|
${this.userName?c`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
3488
|
-
@click=${()=>a(this,Be
|
|
3488
|
+
@click=${()=>a(this,Be,ko).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
3489
3489
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:h}
|
|
3490
3490
|
<slot name="account"></slot>
|
|
3491
3491
|
</div>
|
|
@@ -3494,11 +3494,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3494
3494
|
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
3495
3495
|
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
3496
3496
|
<div class="layer-bar">
|
|
3497
|
-
<div class="layer-search"><slot name="search" @slotchange=${a(this,Be,
|
|
3497
|
+
<div class="layer-search"><slot name="search" @slotchange=${a(this,Be,Qf)}></slot></div>
|
|
3498
3498
|
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
3499
3499
|
</div>
|
|
3500
3500
|
</dialog>`:h}
|
|
3501
|
-
`}};
|
|
3501
|
+
`}};Mo=new WeakMap,Li=new WeakMap,_o=new WeakMap,Be=new WeakSet,Ld=function(){return this.querySelector(':scope > [slot="search"]')},Qf=function(){this._hasSearch=!!a(this,Be,Ld).call(this)},ko=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Eo.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}},Eo.styles=[E,w`
|
|
3502
3502
|
:host {
|
|
3503
3503
|
display: block; background: var(--cm-bg-surface); container-type: inline-size;
|
|
3504
3504
|
--_h: var(--cm-control-height-md); --_touch: var(--cm-control-height-touch);
|
|
@@ -3575,10 +3575,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3575
3575
|
@media (pointer: coarse) {
|
|
3576
3576
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
3577
3577
|
}
|
|
3578
|
-
`];$("cm-header-bar",
|
|
3579
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${a(this,
|
|
3578
|
+
`];$("cm-header-bar",Eo);var ST=z("bottomNavigation",{label:"Main"}),Ad,qs,Zf,pw,To=class extends C{constructor(){super(...arguments);m(this,qs);this.items=[];this.fixed=!1;this._slotted=[];m(this,Ad)}connectedCallback(){super.connectedCallback(),a(this,qs,Zf).call(this),g(this,Ad,yr(this,()=>a(this,qs,Zf).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Ad)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3579
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${a(this,qs,pw).call(this,e)}</li>`)}</ul>
|
|
3580
3580
|
<slot hidden></slot>
|
|
3581
|
-
</nav>`}};
|
|
3581
|
+
</nav>`}};Ad=new WeakMap,qs=new WeakSet,Zf=function(){this._slotted=Si(this)},pw=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>`,s=l=>{xr(this,e)||l.preventDefault()};return e.href?c`<a class=${t} part="item" href=${e.href} aria-current=${e.current?"page":h} @click=${s}>${i}</a>`:c`<button type="button" class=${t} part="item" aria-current=${e.current?"page":h} @click=${s}>${i}</button>`},To.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},To.styles=[E,w`
|
|
3582
3582
|
:host { display: block; }
|
|
3583
3583
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
3584
3584
|
nav {
|
|
@@ -3603,32 +3603,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3603
3603
|
.primary .icon { width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
3604
3604
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
3605
3605
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3606
|
-
`];$("cm-bottom-navigation",
|
|
3606
|
+
`];$("cm-bottom-navigation",To);var PT=z("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Dd,Os,Qe,eb,mw,tb,ib,uw,Co=class extends C{constructor(){super(...arguments);m(this,Qe);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;m(this,Dd);m(this,Os,N("cm-mmenu"))}connectedCallback(){super.connectedCallback(),a(this,Qe,eb).call(this),g(this,Dd,yr(this,()=>a(this,Qe,eb).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Dd)?.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,Os)}-sub"
|
|
3607
3607
|
@keydown=${i=>{i.key==="Escape"&&(i.preventDefault(),this.back())}}>
|
|
3608
3608
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
3609
3609
|
${t.label}</button>
|
|
3610
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${a(this,Qe,
|
|
3610
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${a(this,Qe,ib).call(this,i,0,0,!0)}</li>`)}</ul>
|
|
3611
3611
|
<slot hidden></slot>
|
|
3612
3612
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3613
|
-
${a(this,Qe,
|
|
3614
|
-
${e.map((i,s)=>{let l=`${r(this,
|
|
3613
|
+
${a(this,Qe,uw).call(this)}
|
|
3614
|
+
${e.map((i,s)=>{let l=`${r(this,Os)}-s${s}`;return c`<section aria-labelledby=${i.label?l:h}>
|
|
3615
3615
|
${i.label?c`<h2 class="heading" id=${l}>${i.label}</h2>`:h}
|
|
3616
|
-
<ul class="card">${(i.items??[]).map((d,p)=>c`<li>${a(this,Qe,
|
|
3616
|
+
<ul class="card">${(i.items??[]).map((d,p)=>c`<li>${a(this,Qe,ib).call(this,d,s,p)}</li>`)}</ul>
|
|
3617
3617
|
</section>`})}
|
|
3618
3618
|
<slot hidden></slot>
|
|
3619
|
-
</nav>`}};
|
|
3620
|
-
@click=${()=>a(this,Qe,
|
|
3621
|
-
<h2 class="heading" id="${r(this,
|
|
3619
|
+
</nav>`}};Dd=new WeakMap,Os=new WeakMap,Qe=new WeakSet,eb=function(){this._slotted=Si(this)},mw=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},tb=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},ib=function(e,t,i,s=!1){let l=b=>{xr(this,e)||b.preventDefault()};if(e.primary&&!s)return c`<button type="button" class="row action" part="row" @click=${l}>${e.label}</button>`;let d=e.icon&&!s?c`<cm-icon class="icon" name=${e.icon} size="20"></cm-icon>`:h,p=e.badge?c`<span class="badge">${e.badge}</span>`:h;if(e.items?.length&&!s)return c`<button type="button" class="row" part="row" data-row="${t}-${i}"
|
|
3620
|
+
@click=${()=>a(this,Qe,mw).call(this,t,i)}>${d}<span class="text"><span class="label">${e.label}</span>${p}</span><cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let u=c`${d}<span class="text"><span class="label">${e.label}</span>${p}</span>${e.href&&!s?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return e.href?c`<a class="row" part="row" href=${e.href} aria-current=${e.current?"page":h} @click=${l}>${u}</a>`:c`<button type="button" class="row" part="row" aria-current=${e.current?"page":h} @click=${l}>${u}</button>`},uw=function(){if(!this.store&&!this.userName)return h;let e=this.userName.trim().charAt(0).toUpperCase();return c`<section aria-labelledby="${r(this,Os)}-profile">
|
|
3621
|
+
<h2 class="heading" id="${r(this,Os)}-profile">${this.t("profile")}</h2>
|
|
3622
3622
|
<ul class="card">
|
|
3623
|
-
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,Qe,
|
|
3623
|
+
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,Qe,tb).call(this,"cm-store-switch")}>
|
|
3624
3624
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
3625
3625
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3626
|
-
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,Qe,
|
|
3626
|
+
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,Qe,tb).call(this,"cm-account")}>
|
|
3627
3627
|
<span class="avatar">${this.avatarSrc?c`<img src=${this.avatarSrc} alt="">`:c`<span aria-hidden="true">${e}</span>`}</span>
|
|
3628
3628
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?c`<span class="email">${this.userEmail}</span>`:h}</span>
|
|
3629
3629
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3630
3630
|
</ul>
|
|
3631
|
-
</section>`},
|
|
3631
|
+
</section>`},Co.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}},Co.styles=[E,w`
|
|
3632
3632
|
:host { display: block; background: var(--cm-bg-page); }
|
|
3633
3633
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
3634
3634
|
.heading {
|
|
@@ -3674,12 +3674,12 @@ ${t.label}</button>
|
|
|
3674
3674
|
}
|
|
3675
3675
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3676
3676
|
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3677
|
-
`];$("cm-mobile-menu",
|
|
3677
|
+
`];$("cm-mobile-menu",Co);var VT=z("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),Xm,gw,zo=class extends C{constructor(){super(...arguments);m(this,Xm);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
3678
3678
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
3679
3679
|
<span class="text"><slot></slot></span>
|
|
3680
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${a(this,
|
|
3680
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${a(this,Xm,gw)}><cm-icon name="close" size="16"></cm-icon>
|
|
3681
3681
|
</button>`:h}
|
|
3682
|
-
</div>`}};
|
|
3682
|
+
</div>`}};Xm=new WeakSet,gw=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},zo.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},zo.styles=[E,w`
|
|
3683
3683
|
:host { display: block; }
|
|
3684
3684
|
.bar {
|
|
3685
3685
|
position: relative; display: flex; align-items: center; justify-content: center; gap: var(--cm-space-8); min-height: 48px;
|
|
@@ -3701,11 +3701,11 @@ ${t.label}</button>
|
|
|
3701
3701
|
@media (max-width: 640px) {
|
|
3702
3702
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
3703
3703
|
}
|
|
3704
|
-
`];$("cm-flash-offer-bar",
|
|
3705
|
-
<ul part="tabs">${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3706
|
-
@click=${t=>{
|
|
3704
|
+
`];$("cm-flash-offer-bar",zo);var XT=z("linkTabs",{label:"Sections"}),Hd,Lo,Nd,Ct,fw,Rd,rb,So=class extends C{constructor(){super(...arguments);m(this,Ct);this.items=[];this._slotted=[];this._more="";m(this,Hd);m(this,Lo,new ResizeObserver(()=>a(this,Ct,Rd).call(this)));m(this,Nd,"")}connectedCallback(){super.connectedCallback(),a(this,Ct,rb).call(this),g(this,Hd,yr(this,()=>a(this,Ct,rb).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Hd)?.disconnect(),r(this,Lo).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector("ul");r(this,Lo).observe(e),e.addEventListener("scroll",()=>a(this,Ct,Rd).call(this),{passive:!0}),document.fonts?.ready.then(()=>a(this,Ct,Rd).call(this))}updated(){for(let e of this.renderRoot.querySelectorAll("li"))r(this,Lo).observe(e);a(this,Ct,fw).call(this),a(this,Ct,Rd).call(this)}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3705
|
+
<ul part="tabs" class=${this._more?`more-${this._more}`:""}>${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3706
|
+
@click=${t=>{xr(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
3707
3707
|
<slot hidden></slot>
|
|
3708
|
-
</nav>`}};
|
|
3708
|
+
</nav>`}};Hd=new WeakMap,Lo=new WeakMap,Nd=new WeakMap,Ct=new WeakSet,fw=function(){let e=this.renderRoot.querySelector("ul"),t=this.renderRoot.querySelector('a[aria-current="page"]'),i=t?.getAttribute("href")??"";if(!e||!t||i===r(this,Nd)||e.scrollWidth<=e.clientWidth)return;g(this,Nd,i);let s=e.getBoundingClientRect(),l=t.getBoundingClientRect(),d=32;l.right>s.right-d?e.scrollLeft+=l.right-s.right+d:l.left<s.left+d&&(e.scrollLeft-=s.left+d-l.left)},Rd=function(){let e=this.renderRoot.querySelector("ul");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),s=t>1&&i>1,l=t>1&&i<t-1,d=s&&l?"both":s?"start":l?"end":"";d!==this._more&&(this._more=d)},rb=function(){this._slotted=Si(this)},So.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0},_more:{state:!0}},So.styles=[E,w`
|
|
3709
3709
|
:host { display: block; }
|
|
3710
3710
|
ul {
|
|
3711
3711
|
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
@@ -3722,9 +3722,16 @@ ${t.label}</button>
|
|
|
3722
3722
|
a[aria-current='page']::after { background: var(--cm-tab-indicator); }
|
|
3723
3723
|
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
|
|
3724
3724
|
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
3725
|
+
/* Scroll affordance, as in Status tabs: the edge with more tabs past it fades out over 32px, so a cut-off row reads
|
|
3726
|
+
as one that scrolls. The mask is a gradient of opacity, so it works on any background and theme. */
|
|
3727
|
+
ul.more-end { mask-image: linear-gradient(to right, #000 calc(100% - var(--cm-space-32)), transparent); }
|
|
3728
|
+
ul.more-start { mask-image: linear-gradient(to left, #000 calc(100% - var(--cm-space-32)), transparent); }
|
|
3729
|
+
ul.more-both { mask-image: linear-gradient(to right, transparent, #000 var(--cm-space-32), #000 calc(100% - var(--cm-space-32)), transparent); }
|
|
3730
|
+
:host(:dir(rtl)) ul.more-end { mask-image: linear-gradient(to left, #000 calc(100% - var(--cm-space-32)), transparent); }
|
|
3731
|
+
:host(:dir(rtl)) ul.more-start { mask-image: linear-gradient(to right, #000 calc(100% - var(--cm-space-32)), transparent); }
|
|
3725
3732
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
3726
3733
|
|
|
3727
|
-
`];$("cm-link-tabs",
|
|
3734
|
+
`];$("cm-link-tabs",So);var iC=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}"}),Ao=class extends C{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}):"",s=t?this.formatNumber(this.rating,{minimumFractionDigits:1,maximumFractionDigits:1}):"";return c`<article part="card" aria-labelledby="name">
|
|
3728
3735
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
3729
3736
|
<div class="status"><slot name="status"></slot></div>
|
|
3730
3737
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
@@ -3736,7 +3743,7 @@ ${t.label}</button>
|
|
|
3736
3743
|
${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}
|
|
3737
3744
|
<div class="actions"><slot name="actions"></slot>${this.href?c`<a class="details" part="details" href=${this.href}
|
|
3738
3745
|
aria-label=${this.t("detailsLabel",{name:this.name})}>${this.t("details")}</a>`:h}</div>
|
|
3739
|
-
</article>`}};
|
|
3746
|
+
</article>`}};Ao.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},Ao.styles=[E,w`
|
|
3740
3747
|
:host { display: block; container-type: inline-size; }
|
|
3741
3748
|
article {
|
|
3742
3749
|
position: relative; display: flex; flex-direction: column; gap: var(--cm-space-8); height: 100%; padding: var(--cm-space-20);
|
|
@@ -3773,21 +3780,21 @@ ${t.label}</button>
|
|
|
3773
3780
|
.actions { gap: var(--cm-space-8); }
|
|
3774
3781
|
.details { margin-inline-start: auto; }
|
|
3775
3782
|
}
|
|
3776
|
-
`];$("cm-app-card",
|
|
3783
|
+
`];$("cm-app-card",Ao);var Jm,bw,Do=class extends le{constructor(){super(...arguments);m(this,Jm);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">
|
|
3777
3784
|
${this.renderHeader()}
|
|
3778
3785
|
<div class="body" part="body"><slot></slot></div>
|
|
3779
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${a(this,
|
|
3780
|
-
</div>`)}};
|
|
3786
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${a(this,Jm,bw)}></slot></footer>
|
|
3787
|
+
</div>`)}};Jm=new WeakSet,bw=function(e){this._hasFooter=e.target.assignedElements().length>0},Do.properties={...le.properties,size:{reflect:!0},_hasFooter:{state:!0}},Do.styles=[...le.overlayStyles,w`
|
|
3781
3788
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
3782
3789
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
3783
3790
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
3784
3791
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
3785
3792
|
|
|
3786
|
-
`];$("cm-modal",
|
|
3793
|
+
`];$("cm-modal",Do);var Qm,vw,Zt=class extends le{constructor(){super(...arguments);m(this,Qm);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}renderBody(){return c`<slot></slot>`}renderFooter(){return c`<slot name="footer" @slotchange=${a(this,Qm,vw)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3787
3794
|
${this.renderHeader()}
|
|
3788
3795
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
3789
3796
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
3790
|
-
</div>`)}};
|
|
3797
|
+
</div>`)}};Qm=new WeakSet,vw=function(e){this._hasFooter=e.target.assignedElements().length>0},Zt.properties={...le.properties,size:{reflect:!0},_hasFooter:{state:!0}},Zt.styles=[...le.overlayStyles,w`
|
|
3791
3798
|
dialog {
|
|
3792
3799
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
3793
3800
|
}
|
|
@@ -3805,23 +3812,23 @@ ${t.label}</button>
|
|
|
3805
3812
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
3806
3813
|
|
|
3807
3814
|
}
|
|
3808
|
-
`];$("cm-side-panel",
|
|
3815
|
+
`];$("cm-side-panel",Zt);var vC=z("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),Ho,Zm,Ro=class extends Zt{constructor(){super(...arguments);this.search=!1;this.query="";m(this,Ho,()=>{this.dispatchEvent(new CustomEvent("cm-filter-apply",{detail:{values:this.values,query:this.query},bubbles:!0,composed:!0,cancelable:!0}))&&this.requestClose("action")});m(this,Zm,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(s,l)=>{if(l==="")return;let d=e[s];e[s]=d===void 0?l:Array.isArray(d)?[...d,l]:[d,l]},i=this.form;if(i){for(let[s,l]of new FormData(i))typeof l=="string"&&t(s,l);return e}return this.querySelectorAll("[name]").forEach(s=>{let l=s.getAttribute("name");"checked"in s&&(s.type==="checkbox"||s.type==="radio"||s.localName.match(/^cm-(checkbox|radio|toggle)$/))?s.checked&&t(l,s.value||"on"):typeof s.value=="string"&&t(l,s.value)}),e}reset(){let e=this.form;e?e.reset():this.querySelectorAll("[name]").forEach(t=>t.formResetCallback?.()),this.query=""}renderBody(){return c`${this.search?c`<cm-search class="search" part="search" .value=${this.query} label=${this.searchLabel}
|
|
3809
3816
|
placeholder=${this.searchPlaceholder}
|
|
3810
3817
|
@input=${e=>{this.query=e.target.value}}
|
|
3811
|
-
@cm-search=${e=>{e.stopPropagation(),r(this,
|
|
3812
|
-
<slot @submit=${e=>{e.preventDefault(),r(this,
|
|
3813
|
-
<cm-button part="apply" variant="primary" @click=${r(this,
|
|
3818
|
+
@cm-search=${e=>{e.stopPropagation(),r(this,Ho).call(this)}}></cm-search>`:h}
|
|
3819
|
+
<slot @submit=${e=>{e.preventDefault(),r(this,Ho).call(this)}}></slot>`}renderFooter(){return c`<cm-button part="reset" @click=${r(this,Zm)}>${this.resetLabel}</cm-button>
|
|
3820
|
+
<cm-button part="apply" variant="primary" @click=${r(this,Ho)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};Ho=new WeakMap,Zm=new WeakMap,Ro.properties={...Zt.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"}},Ro.styles=[...Zt.styles,w`
|
|
3814
3821
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
3815
3822
|
.foot { justify-content: center; }
|
|
3816
3823
|
::slotted(form) { display: grid; gap: var(--cm-space-12); }
|
|
3817
|
-
`];$("cm-filter-panel",
|
|
3824
|
+
`];$("cm-filter-panel",Ro);var MC=z("accountMenu",{trigger:"Account: {name}"}),No=class extends Ft{constructor(){super();this.name="";this.avatarSrc="";this.meta="";this.profileHref="";this.orgName="";this.orgMeta="";this.orgHref="";this.plan="";this.align="end"}triggerTemplate(e,t){return c`<button type="button" class="trigger account" part="trigger" aria-haspopup="menu" aria-expanded=${String(this.open)}
|
|
3818
3825
|
aria-label=${this.t("trigger",{name:this.name})} ?disabled=${this.disabled} @click=${e} @keydown=${t}>
|
|
3819
3826
|
<cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></button>`}headTemplate(){let e=(t,i,s,l,d)=>{let p=c`${s}<span class="who"><strong>${l}</strong>${d?c`<span>${d}</span>`:h}</span>${t?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return t?c`<a class="row" part=${i} href=${t}>${p}</a>`:c`<div class="row" part=${i}>${p}</div>`};return c`<div class="acct">
|
|
3820
3827
|
${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)}
|
|
3821
3828
|
${this.orgName?c`<div class="split"></div>
|
|
3822
3829
|
${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)}
|
|
3823
3830
|
${this.plan?c`<div class="plan"><cm-icon name="check-circle" size="16"></cm-icon>${this.plan}</div>`:h}`:h}
|
|
3824
|
-
</div>`}};
|
|
3831
|
+
</div>`}};No.properties={...Ft.properties,name:{},avatarSrc:{attribute:"avatar-src"},meta:{},profileHref:{attribute:"profile-href"},orgName:{attribute:"org-name"},orgMeta:{attribute:"org-meta"},orgHref:{attribute:"org-href"},plan:{}},No.styles=[...Ft.styles,w`
|
|
3825
3832
|
/* The avatar button: 36px round with a ring (40 and a 44px hit area on touch screens). */
|
|
3826
3833
|
.trigger.account {
|
|
3827
3834
|
position: relative; width: var(--cm-control-height-md, 36px); height: var(--cm-control-height-md, 36px); min-height: 0; padding: 2px;
|
|
@@ -3854,8 +3861,8 @@ ${t.label}</button>
|
|
|
3854
3861
|
.plan cm-icon { color: var(--cm-text-success); }
|
|
3855
3862
|
.split { height: 0; margin: var(--cm-space-4) var(--cm-space-12); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
3856
3863
|
:host(:dir(rtl)) .chev { transform: scaleX(-1); }
|
|
3857
|
-
`];$("cm-account-menu",
|
|
3858
|
-
<line class="base" x1="0" y1=${s} x2=${i} y2=${s}></line>${b}</svg>`}};
|
|
3864
|
+
`];$("cm-account-menu",No);var SC=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"}),F0=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})},V0=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())},Po=class extends C{constructor(){super(...arguments);this.values=[];this.labels=[];this.label="";this.type="bars";this.tone="neutral"}get summary(){let e=this.values??[],t=this.label||"";if(!e.length)return this.t("empty",{label:t});let i=e.reduce((u,b)=>u+b,0),s=Math.max(...e),l=e.indexOf(s),d={label:t,total:this.formatNumber(i),peak:this.formatNumber(s),latest:this.formatNumber(e[e.length-1])},p=this.labels?.[l];return p?this.t("summaryAt",{...d,when:p}):this.t("summary",d)}render(){let e=this.values??[],t=e.length,i=100,s=32,l=2,d=Math.max(1,...e.map(f=>Math.max(0,f))),p=f=>s-Math.max(0,f)/d*(s-l),u=f=>this.labels?.[f]?`${this.labels[f]}: ${this.formatNumber(e[f])}`:"",b=h;if(t&&this.type==="line"){let f=t>1?i/(t-1):0,x=e.map((k,L)=>`${(t>1?L*f:i/2).toFixed(2)},${p(k).toFixed(2)}`).join(" "),v=x.split(" ").pop().split(",");b=ii`<polyline class="line" points=${x}></polyline><line class="dot" x1=${v[0]} y1=${v[1]} x2=${v[0]} y2=${v[1]}></line>`}else if(t){let f=i/t,x=t>1?Math.min(f*.25,2):0,v=f-x;b=e.map((k,L)=>{let P=Math.max(k>0?1.5:0,s-p(k)),U=u(L);return ii`<rect class=${L===t-1?"bar last":"bar"} x=${(L*f+x/2).toFixed(2)} y=${(s-P).toFixed(2)} width=${v.toFixed(2)} height=${P.toFixed(2)} rx="0.6">${U?ii`<title>${U}</title>`:h}</rect>`})}return c`<svg part="chart" role="img" aria-label=${this.summary} viewBox="0 0 ${i} ${s}" preserveAspectRatio="none">
|
|
3865
|
+
<line class="base" x1="0" y1=${s} x2=${i} y2=${s}></line>${b}</svg>`}};Po.properties={values:{converter:{fromAttribute:F0}},labels:{converter:{fromAttribute:V0}},label:{},type:{reflect:!0},tone:{reflect:!0}},Po.styles=[E,w`
|
|
3859
3866
|
:host { display: block; width: 100%; max-width: var(--cm-sparkline-width, none); height: var(--cm-sparkline-height, 32px); color: var(--cm-icon-default); }
|
|
3860
3867
|
:host([tone='information']) { color: var(--cm-text-information); }
|
|
3861
3868
|
:host([tone='success']) { color: var(--cm-text-success); }
|
|
@@ -3868,17 +3875,17 @@ ${t.label}</button>
|
|
|
3868
3875
|
.line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3869
3876
|
.dot { stroke: var(--cm-text-default); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3870
3877
|
:host([tone='information']) .dot, :host([tone='success']) .dot { stroke: currentColor; }
|
|
3871
|
-
`];$("cm-sparkline",
|
|
3878
|
+
`];$("cm-sparkline",Po);var Pd,Bs,sb,yw,Io=class extends le{constructor(){super(...arguments);m(this,Bs);this.heading="";this.items=[];this._slotted=[];m(this,Pd)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=xl(this),g(this,Pd,yh(this,()=>{this._slotted=xl(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,Pd)?.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">
|
|
3872
3879
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
3873
3880
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
3874
3881
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
3875
3882
|
<div class="content">
|
|
3876
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${a(this,
|
|
3883
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${a(this,Bs,yw).call(this,i)}</li>`)}</ul>`:h}
|
|
3877
3884
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
3878
3885
|
</div>
|
|
3879
|
-
</div>`)}};
|
|
3880
|
-
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${s=>a(this,
|
|
3881
|
-
@click=${s=>a(this,
|
|
3886
|
+
</div>`)}};Pd=new WeakMap,Bs=new WeakSet,sb=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")},yw=function(e){let t=`row${e.critical?" critical":""}`,i=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
3887
|
+
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${s=>a(this,Bs,sb).call(this,s,e)}>${i}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
3888
|
+
@click=${s=>a(this,Bs,sb).call(this,s,e)}>${i}</button>`},Io.properties={...le.properties,items:{type:Array},_slotted:{state:!0}},Io.styles=[...le.overlayStyles,w`
|
|
3882
3889
|
dialog {
|
|
3883
3890
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: var(--cm-space-24);
|
|
3884
3891
|
}
|
|
@@ -3912,17 +3919,17 @@ ${t.label}</button>
|
|
|
3912
3919
|
}
|
|
3913
3920
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
3914
3921
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3915
|
-
`];$("cm-bottom-sheet",
|
|
3916
|
-
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(s=>c`<li>${a(this,st,
|
|
3922
|
+
`];$("cm-bottom-sheet",Io);var FC=z("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),j0={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},qo=class extends A{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};qo.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},qo.styles=w`:host { display: none; }`;$("cm-notification-item",qo);var Bo,st,ab,nb,xw,ww,$w,Oo=class extends le{constructor(){super(...arguments);m(this,st);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;m(this,Bo)}connectedCallback(){super.connectedCallback(),a(this,st,ab).call(this),g(this,Bo,new MutationObserver(()=>a(this,st,ab).call(this))),r(this,Bo).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Bo)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications,t=this.markAllRead&&!this.loading&&e.some(s=>s.unread)?c`<button type="button" class="mark" part="mark-all-read" @click=${a(this,st,ww)}>${this.markAllLabel}</button>`:h,i=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
3923
|
+
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(s=>c`<li>${a(this,st,xw).call(this,s)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3917
3924
|
${this.renderHeader(t)}
|
|
3918
3925
|
${i}
|
|
3919
3926
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3920
3927
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
3921
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${a(this,st
|
|
3928
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${a(this,st,$w)}></slot></div>
|
|
3922
3929
|
<slot hidden></slot>
|
|
3923
|
-
</div>`)}};
|
|
3930
|
+
</div>`)}};Bo=new WeakMap,st=new WeakSet,ab=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")}})},nb=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")},xw=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,s=c`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${e.icon||j0[t]||"bell"} size="14"></cm-icon></span>
|
|
3924
3931
|
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${i}</span>
|
|
3925
|
-
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>a(this,st,
|
|
3932
|
+
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>a(this,st,nb).call(this,d,e)}>${s}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>a(this,st,nb).call(this,d,e)}>${s}</button>`},ww=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()},$w=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},Oo.properties={...le.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}},Oo.styles=[...le.overlayStyles,w`
|
|
3926
3933
|
dialog {
|
|
3927
3934
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
3928
3935
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3972,15 +3979,15 @@ ${t.label}</button>
|
|
|
3972
3979
|
@media (max-width: 599px) {
|
|
3973
3980
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3974
3981
|
}
|
|
3975
|
-
`];$("cm-notification-panel",
|
|
3982
|
+
`];$("cm-notification-panel",Oo);var GC=z("toastRegion",{label:"Notifications"}),YC=z("toast",{undo:"Undo",shortcut:"Press F6 to reach it."}),kw=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o&&o!==document.body?o:null},ob=(o,n)=>{for(let e=n;e;e=e.parentNode??e.host??null)if(e===o)return!0;return!1},U0=2e3,Ew=1e4,Mw=150,Id,Ot,Ai,qd,Uo,Ko,Fs,wr,Vs,_e,eu,_w,Fo,lb,Od,Bd,Fd,Vd,Tw,Vo=class extends C{constructor(){super(...arguments);m(this,_e);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;m(this,Id);m(this,Ot);m(this,Ai,0);m(this,qd,0);m(this,Uo,!1);m(this,Ko,!1);m(this,Fs);m(this,wr);m(this,Vs);m(this,Od,()=>{g(this,Uo,!0),a(this,_e,lb).call(this)});m(this,Bd,()=>{g(this,Uo,!1),a(this,_e,Fo).call(this)});m(this,Fd,()=>{g(this,Ko,!0),a(this,_e,lb).call(this)});m(this,Vd,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(g(this,Ko,!1),a(this,_e,Fo).call(this))})}get closed(){if(!r(this,Fs)){if(!this.open&&r(this,Vs))return Promise.resolve(r(this,Vs));g(this,Fs,new Promise(e=>{g(this,wr,e)}))}return r(this,Fs)}get effectiveDuration(){let e=this.duration??(this.actionLabel?Ew:5e3);return Math.min(Ew,Math.max(U0,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&g(this,Id,setTimeout(()=>{this._primed=!0},Mw)),this.addEventListener("pointerenter",r(this,Od)),this.addEventListener("pointerleave",r(this,Bd)),this.addEventListener("focusin",r(this,Fd)),this.addEventListener("focusout",r(this,Vd))}disconnectedCallback(){super.disconnectedCallback(),this.open&&r(this,wr)&&queueMicrotask(()=>{!this.isConnected&&this.open&&a(this,_e,eu).call(this,"removed")}),clearTimeout(r(this,Ot)),clearTimeout(r(this,Id)),this.removeEventListener("pointerenter",r(this,Od)),this.removeEventListener("pointerleave",r(this,Bd)),this.removeEventListener("focusin",r(this,Fd)),this.removeEventListener("focusout",r(this,Vd))}updated(e){e.has("open")&&e.get("open")!==void 0&&(this.open?g(this,Vs,void 0):r(this,wr)&&a(this,_e,eu).call(this,"close")),(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,Ot)),this.open&&(this._inRegion||this._primed)&&(g(this,Ai,this.effectiveDuration),a(this,_e,Fo).call(this)))}show(){this.open?(g(this,Ai,this.effectiveDuration),a(this,_e,Fo).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,Ot)),this.open=!1,a(this,_e,eu).call(this,e),!0):(e==="timeout"&&(g(this,Ai,this.effectiveDuration),a(this,_e,Fo).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3976
3983
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3977
3984
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3978
|
-
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${a(this,_e,
|
|
3985
|
+
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${a(this,_e,Tw)}>${this.actionLabel}</button>`:h}
|
|
3979
3986
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3980
3987
|
<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>
|
|
3981
3988
|
</button>
|
|
3982
3989
|
${this.actionLabel&&this._inRegion&&this.t("shortcut")?c`<span class="hint">${this.t("shortcut")}</span>`:h}
|
|
3983
|
-
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};
|
|
3990
|
+
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Id=new WeakMap,Ot=new WeakMap,Ai=new WeakMap,qd=new WeakMap,Uo=new WeakMap,Ko=new WeakMap,Fs=new WeakMap,wr=new WeakMap,Vs=new WeakMap,_e=new WeakSet,eu=function(e){g(this,Vs,e);let t=r(this,wr);g(this,Fs,g(this,wr,void 0)),t?.(e)},_w=function(){return r(this,Uo)||r(this,Ko)},Fo=function(){clearTimeout(r(this,Ot)),!(!this.open||r(this,_e,_w))&&(g(this,qd,Date.now()),g(this,Ot,setTimeout(()=>this.dismiss("timeout"),r(this,Ai))))},lb=function(){r(this,Ot)!==void 0&&(clearTimeout(r(this,Ot)),g(this,Ot,void 0),g(this,Ai,Math.max(1e3,r(this,Ai)-(Date.now()-r(this,qd)))))},Od=new WeakMap,Bd=new WeakMap,Fd=new WeakMap,Vd=new WeakMap,Tw=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},Vo.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},Vo.styles=[E,w`
|
|
3984
3991
|
:host { display: block; pointer-events: auto; }
|
|
3985
3992
|
:host(:not([open])) { display: none; }
|
|
3986
3993
|
.toast {
|
|
@@ -4012,13 +4019,13 @@ ${t.label}</button>
|
|
|
4012
4019
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
4013
4020
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
4014
4021
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
4015
|
-
`];$("cm-toast",
|
|
4022
|
+
`];$("cm-toast",Vo);var js,jd,Ud,Kd,Wd,Gd,Wo,tu,jo=class extends C{constructor(){super(...arguments);m(this,Wo);this.max=3;m(this,js,null);m(this,jd,!1);m(this,Ud,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let i=t.matches(":focus-within");t.remove(),i&&a(this,Wo,tu).call(this)})});m(this,Kd,e=>{let t=e.relatedTarget;t&&!ob(this,t)&&g(this,js,t)});m(this,Wd,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(i=>i.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});m(this,Gd,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?a(this,Wo,tu).call(this):this.focusToast())&&e.preventDefault()})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),g(this,jd,!0)),this.addEventListener("cm-dismiss",r(this,Ud)),this.addEventListener("focusin",r(this,Kd)),this.addEventListener("keydown",r(this,Wd)),document.addEventListener("keydown",r(this,Gd))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Ud)),this.removeEventListener("focusin",r(this,Kd)),this.removeEventListener("keydown",r(this,Wd)),document.removeEventListener("keydown",r(this,Gd))}updated(){r(this,jd)&&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 s=kw();return s&&!ob(this,s)&&g(this,js,s),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))),s=i.some(l=>l.matches(":focus-within"));return i.forEach(l=>l.remove()),s&&a(this,Wo,tu).call(this),e}render(){return c`<slot></slot>`}};js=new WeakMap,jd=new WeakMap,Ud=new WeakMap,Kd=new WeakMap,Wd=new WeakMap,Gd=new WeakMap,Wo=new WeakSet,tu=function(){let e=r(this,js);return g(this,js,null),e?.isConnected?(e.focus(),ob(e,kw())||e.shadowRoot?.querySelector("button, a[href], input, select, textarea, [tabindex]")?.focus(),!0):!1},jo.properties={max:{type:Number}},jo.styles=[E,w`
|
|
4016
4023
|
:host {
|
|
4017
4024
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
4018
4025
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
4019
4026
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
4020
4027
|
}
|
|
4021
|
-
`];$("cm-toast-region",
|
|
4028
|
+
`];$("cm-toast-region",jo);function Cw(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 s=document.createElement("cm-toast");if(s.message=String(o),n.tone&&(s.tone=n.tone),n.duration!==void 0&&(s.duration=n.duration),n.action){s.actionLabel=n.action.label;let l=n.action.onAction;s.addEventListener("cm-action",()=>l())}if(i){let l=t;return setTimeout(()=>l.add(s),Mw),s}return t.add(s)}async function K0(o,n,e){await o();let{message:t,undoLabel:i,...s}=e,l=i??uh("toast","undo",void 0,s.root??document.body),d=await Cw(t,{...s,action:{label:l,onAction:()=>{}}}).closed;return d==="action"&&await n(),d}var tz=z("progressBar",{inProgress:"In progress"}),iu,Go=class extends C{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";m(this,iu,N("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,iu)}-label`;return c`
|
|
4022
4029
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
4023
4030
|
<span id=${t} part="label">${this.label}</span>
|
|
4024
4031
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -4028,7 +4035,7 @@ ${t.label}</button>
|
|
|
4028
4035
|
aria-valuenow=${e===null?h:Math.round(e)}
|
|
4029
4036
|
aria-valuetext=${e===null?this.t("inProgress"):this.formatNumber(Math.round(e)/100,{style:"percent"})}>
|
|
4030
4037
|
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
4031
|
-
</div>`}};
|
|
4038
|
+
</div>`}};iu=new WeakMap,Go.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},Go.styles=[E,w`
|
|
4032
4039
|
:host { display: block; }
|
|
4033
4040
|
.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); }
|
|
4034
4041
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
@@ -4046,7 +4053,7 @@ ${t.label}</button>
|
|
|
4046
4053
|
.fill { transition: none; }
|
|
4047
4054
|
.indeterminate .fill { animation-duration: 4s; }
|
|
4048
4055
|
}
|
|
4049
|
-
`];$("cm-progress-bar",
|
|
4056
|
+
`];$("cm-progress-bar",Go);var Yo=class extends A{constructor(){super(...arguments);this.tone="neutral"}render(){return c`<span part="badge"><slot></slot></span>`}};Yo.properties={tone:{reflect:!0}},Yo.styles=[E,w`
|
|
4050
4057
|
:host { display: inline-flex; vertical-align: middle; }
|
|
4051
4058
|
span {
|
|
4052
4059
|
display: inline-flex; align-items: center; box-sizing: border-box; height: 24px; padding: 0 var(--cm-space-8); white-space: nowrap;
|
|
@@ -4063,12 +4070,12 @@ ${t.label}</button>
|
|
|
4063
4070
|
: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); }
|
|
4064
4071
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
4065
4072
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
4066
|
-
`];$("cm-badge",
|
|
4073
|
+
`];$("cm-badge",Yo);var Jo,Qo,Bt,zw,Sw,Yd,Lw,ru,cb,Xo=class extends A{constructor(){super(...arguments);m(this,Bt);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;this.variant="standard";this.href="";this.target="";this.selected=!1;this.label="";m(this,Jo,!1);m(this,Qo,!1);m(this,Yd,!1);m(this,ru,()=>{this.href||this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))})}willUpdate(){this.selected&&g(this,Yd,!0)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=r(this,Bt,Lw),i=t?a(this,Bt,cb).call(this,this.heading):this.heading,s=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${i}</span><span class="adornment" ?hidden=${!r(this,Jo)}><slot name="title-adornment" @slotchange=${a(this,Bt,zw)}></slot></span></div>`:h;return c`<section part="card" aria-label=${!t&&this.heading||h}>${t&&!this.heading?a(this,Bt,cb).call(this,h):h}
|
|
4067
4074
|
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${s}${this.description?c`<p class="desc">${this.description}</p>`:h}</div>
|
|
4068
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,
|
|
4075
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,Qo)}><div class="actions"><slot name="actions" @slotchange=${a(this,Bt,Sw)}></slot></div></div>`}
|
|
4069
4076
|
<slot></slot>
|
|
4070
|
-
</section>`}};
|
|
4071
|
-
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,
|
|
4077
|
+
</section>`}};Jo=new WeakMap,Qo=new WeakMap,Bt=new WeakSet,zw=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,Jo)&&(g(this,Jo,t),this.requestUpdate())},Sw=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,Qo)&&(g(this,Qo,t),this.requestUpdate())},Yd=new WeakMap,Lw=function(){return String(this.variant||"").split(/\s+/).includes("interactive")},ru=new WeakMap,cb=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}
|
|
4078
|
+
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,Yd)?"false":h} aria-label=${i} @click=${r(this,ru)}>${e}</button>`},Xo.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:{}},Xo.styles=[E,w`
|
|
4072
4079
|
/* Owner standard (1.6): 24px padding and a 16px gap under the header; compact 16px and 12px; 16px on phones. */
|
|
4073
4080
|
:host { display: block; --_pad: var(--cm-space-24); --_gap: var(--cm-space-16); }
|
|
4074
4081
|
:host([variant~='compact']) { --_pad: var(--cm-space-16); --_gap: var(--cm-space-12); }
|
|
@@ -4120,8 +4127,8 @@ ${t.label}</button>
|
|
|
4120
4127
|
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
|
|
4121
4128
|
.bare[hidden] { display: none; }
|
|
4122
4129
|
:host([flush]) .bare { padding: var(--_pad) var(--_pad) 0; margin-bottom: var(--cm-space-8); }
|
|
4123
|
-
`];$("cm-card",
|
|
4124
|
-
`))}var
|
|
4130
|
+
`];$("cm-card",Xo);var W0=["0","4","8","12","16","20","24","32","40","48","64"],G0={10:"8",15:"16",22:"24",30:"32"};function Zo(o,n){let e=(t,i)=>`:host([${o}='${t}']) { ${n}: ${i==="0"?"0px":`var(--cm-space-${i})`}; }`;return ih([...W0.map(t=>e(t,t)),...Object.entries(G0).map(([t,i])=>e(t,i))].join(`
|
|
4131
|
+
`))}var el=class extends A{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return c`<slot></slot>`}};el.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},el.styles=[E,w`
|
|
4125
4132
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
4126
4133
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
4127
4134
|
:host([wrap]) { flex-wrap: wrap; }
|
|
@@ -4134,13 +4141,13 @@ ${t.label}</button>
|
|
|
4134
4141
|
:host([justify='center']) { justify-content: center; }
|
|
4135
4142
|
:host([justify='end']) { justify-content: flex-end; }
|
|
4136
4143
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
4137
|
-
`,
|
|
4144
|
+
`,Zo("gap","gap")];$("cm-stack",el);var Aw="important",Y0=" !"+Aw,Dw=ca(class extends Ni{constructor(o){if(super(o),o.type!==At.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 s=typeof i=="string"&&i.endsWith(Y0);t.includes("-")||s?e.setProperty(t,s?i.slice(0,-11):i,s?Aw:""):e[t]=i}}return Ne}});var tl=class extends A{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=${Dw({gridTemplateColumns:i})}><slot></slot></div>`}};tl.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},tl.styles=[E,w`
|
|
4138
4145
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
4139
4146
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
4140
4147
|
@container cm-grid (max-width: 640px) {
|
|
4141
4148
|
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
4142
4149
|
}
|
|
4143
|
-
`,
|
|
4150
|
+
`,Zo("gap","--_gap")];$("cm-grid",tl);var nu,Us,Ks,Jd,ye,su,db,Xd,au,hb,il=class extends A{constructor(){super(...arguments);m(this,ye);this.gap="24";this.variant="default";this.asidePosition="above";this.stickyAside=!1;m(this,nu,this.attachInternals());m(this,Us);m(this,Ks,[]);m(this,Jd,()=>a(this,ye,au).call(this))}disconnectedCallback(){super.disconnectedCallback(),a(this,ye,db).call(this)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&a(this,ye,Xd).call(this)}updated(e){(e.has("stickyAside")||e.has("variant"))&&a(this,ye,Xd).call(this)}get asideSticks(){let e=a(this,ye,su).call(this)[0];return!!e&&getComputedStyle(e).position==="sticky"}render(){return c`<div class="layout" part="layout"><slot @slotchange=${()=>{this.stickyAside&&a(this,ye,Xd).call(this)}}></slot></div>`}};nu=new WeakMap,Us=new WeakMap,Ks=new WeakMap,Jd=new WeakMap,ye=new WeakSet,su=function(){return[...this.children].filter(e=>e.getAttribute("variant")==="aside")},db=function(){r(this,Us)?.disconnect(),g(this,Us,void 0),g(this,Ks,[]),window.removeEventListener("resize",r(this,Jd)),a(this,ye,hb).call(this,!1)},Xd=function(){a(this,ye,db).call(this),!(!this.stickyAside||this.variant!=="record"||!this.isConnected)&&(g(this,Us,new ResizeObserver(()=>a(this,ye,au).call(this))),g(this,Ks,[this,...a(this,ye,su).call(this)]),r(this,Ks).forEach(e=>r(this,Us).observe(e)),window.addEventListener("resize",r(this,Jd)),a(this,ye,au).call(this))},au=function(){let e=a(this,ye,su).call(this);if(e.some(i=>!r(this,Ks).includes(i))){a(this,ye,Xd).call(this);return}let t=e.length>0&&e.every(i=>{let s=parseFloat(getComputedStyle(i).insetBlockStart)||0;return i.getBoundingClientRect().height+s<=window.innerHeight});a(this,ye,hb).call(this,t)},hb=function(e){let t=r(this,nu).states;if(t)try{e?t.add("aside-fits"):t.delete("aside-fits")}catch{}},il.properties={gap:{reflect:!0},variant:{reflect:!0},asidePosition:{attribute:"aside-position",reflect:!0},stickyAside:{type:Boolean,attribute:"sticky-aside",reflect:!0}},il.styles=[E,w`
|
|
4144
4151
|
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-24); }
|
|
4145
4152
|
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
4146
4153
|
@container cm-layout (max-width: 767px) {
|
|
@@ -4184,9 +4191,9 @@ ${t.label}</button>
|
|
|
4184
4191
|
/* Read back by #measure(); only takes effect once the aside is sticky. --_header: cm-app-frame's header height. */
|
|
4185
4192
|
inset-block-start: var(--cm-layout-sticky-top, calc(var(--_header, 0px) + var(--cm-space-24)));
|
|
4186
4193
|
}
|
|
4187
|
-
`,
|
|
4194
|
+
`,Zo("gap","--_gap")];var rl=class extends A{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};rl.properties={variant:{reflect:!0}},rl.styles=[E,w`
|
|
4188
4195
|
:host { display: flex; flex-direction: column; gap: var(--_cm-section-gap, var(--cm-space-24)); min-inline-size: 0; }
|
|
4189
|
-
`];$("cm-layout",
|
|
4196
|
+
`];$("cm-layout",il);$("cm-layout-section",rl);var pb=1024,X0=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},Gs,al,at,mb,Ws,Rw,Qd,Zd,sl=class extends A{constructor(){super(...arguments);m(this,at);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;m(this,Gs);m(this,al,null);m(this,Qd,e=>{if(!this.menuItem)return;let t=a(this,at,Rw).call(this,e),i=e.detail?.value;t==="bottom-navigation"&&i===this.menuItem?a(this,at,Ws).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&a(this,at,Ws).call(this,!1,!1)});m(this,Zd,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),a(this,at,Ws).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,Qd)),this.addEventListener("keydown",r(this,Zd));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=pb)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,Qd)),this.removeEventListener("keydown",r(this,Zd)),r(this,Gs)?.disconnect(),g(this,Gs,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;g(this,Gs,new ResizeObserver(()=>{a(this,at,mb).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=pb!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=pb}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,Gs).observe(t))}updated(e){e.has("_wide")&&a(this,at,mb).call(this)}openMenu(){a(this,at,Ws).call(this,!0)}closeMenu(){a(this,at,Ws).call(this,!1)}toggleMenu(){a(this,at,Ws).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">
|
|
4190
4197
|
<div class="probe"></div>
|
|
4191
4198
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
4192
4199
|
<div class="body">
|
|
@@ -4195,7 +4202,7 @@ ${t.label}</button>
|
|
|
4195
4202
|
</div>
|
|
4196
4203
|
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
4197
4204
|
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
4198
|
-
</div>`}};Gs=new WeakMap,
|
|
4205
|
+
</div>`}};Gs=new WeakMap,al=new WeakMap,at=new WeakSet,mb=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`)},Ws=function(e,t=!0){e!==this.menuOpen&&(e&&g(this,al,X0()),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,al)?.focus(),g(this,al,null))}))},Rw=function(e){return e.composedPath().find(i=>i.parentElement===this)?.getAttribute("slot")??""},Qd=new WeakMap,Zd=new WeakMap,sl.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},panel:{type:Boolean,reflect:!0},_wide:{state:!0}},sl.styles=[E,w`
|
|
4199
4206
|
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
4200
4207
|
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
4201
4208
|
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
@@ -4226,7 +4233,7 @@ ${t.label}</button>
|
|
|
4226
4233
|
}
|
|
4227
4234
|
.probe { block-size: 0; }
|
|
4228
4235
|
[hidden] { display: none !important; }
|
|
4229
|
-
`];$("cm-app-frame",
|
|
4236
|
+
`];$("cm-app-frame",sl);var nl=class extends A{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>`}};nl.properties={width:{reflect:!0},fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},nl.styles=[E,w`
|
|
4230
4237
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-page-background, var(--cm-bg-page)); min-block-size: 100%; }
|
|
4231
4238
|
.content {
|
|
4232
4239
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
@@ -4238,16 +4245,16 @@ ${t.label}</button>
|
|
|
4238
4245
|
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
4239
4246
|
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
4240
4247
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
4241
|
-
`];$("cm-page",
|
|
4248
|
+
`];$("cm-page",nl);var ll,Hw,Nw,ol=class extends C{constructor(){super(...arguments);m(this,ll);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?ii`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:ii`<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}>
|
|
4242
4249
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
4243
4250
|
<div class="body">
|
|
4244
4251
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
4245
4252
|
<div><slot></slot></div>
|
|
4246
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${a(this,
|
|
4253
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${a(this,ll,Hw)}></slot></div>
|
|
4247
4254
|
</div>
|
|
4248
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${a(this,
|
|
4255
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${a(this,ll,Nw)}>
|
|
4249
4256
|
<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}
|
|
4250
|
-
</div>`}};
|
|
4257
|
+
</div>`}};ll=new WeakSet,Hw=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},Nw=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},ol.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},ol.styles=[E,w`
|
|
4251
4258
|
:host { display: block; }
|
|
4252
4259
|
.banner {
|
|
4253
4260
|
display: flex; gap: var(--cm-space-12); align-items: flex-start;
|
|
@@ -4271,10 +4278,10 @@ ${t.label}</button>
|
|
|
4271
4278
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
4272
4279
|
}
|
|
4273
4280
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
4274
|
-
`];$("cm-banner",
|
|
4281
|
+
`];$("cm-banner",ol);var Gz=z("thumbnail",{noImage:"{alt} (no image)"}),cl=class extends C{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}
|
|
4275
4282
|
@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}
|
|
4276
4283
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):h} aria-hidden=${this.alt?h:"true"}>
|
|
4277
|
-
<cm-icon name="box" size=${e}></cm-icon></span>`}};
|
|
4284
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};cl.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},cl.styles=[E,w`
|
|
4278
4285
|
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
4279
4286
|
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
4280
4287
|
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
@@ -4284,7 +4291,7 @@ ${t.label}</button>
|
|
|
4284
4291
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
4285
4292
|
}
|
|
4286
4293
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
4287
|
-
`];$("cm-thumbnail",
|
|
4294
|
+
`];$("cm-thumbnail",cl);export{As as Announcer,wn as CmAccordion,No as CmAccountMenu,bn as CmActionBar,Ft as CmActionMenu,Ao as CmAppCard,sl as CmAppFrame,$o as CmAvatar,Yo as CmBadge,ol as CmBanner,so as CmBoard,Ds as CmBoardCard,Rs as CmBoardColumn,To as CmBottomNavigation,Io as CmBottomSheet,Cr as CmButton,la as CmButtonGroup,po as CmCalendar,ho as CmCalendarEvent,Xo as CmCard,Oi as CmCheckbox,ar as CmColorField,cn as CmColorPicker,Ki as CmCombobox,La as CmCommandPalette,Mn as CmComment,_n as CmCommentBox,Un as CmDataTable,Xi as CmDatePicker,Zi as CmDateRangePicker,$n as CmEmptyState,rr as CmFileUpload,Ro as CmFilterPanel,zo as CmFlashOfferBar,Xr as CmGlobalSearch,tl as CmGrid,Eo as CmHeaderBar,Js as CmIcon,xn as CmInfoItem,yn as CmInfoPanel,il as CmLayout,rl as CmLayoutSection,So as CmLinkTabs,C as CmLocalizedElement,Qs as CmMenuItem,yo as CmMetric,Co as CmMobileMenu,Do as CmModal,xo as CmNavItem,io as CmNestedItem,to as CmNestedList,qo as CmNotificationItem,Oo as CmNotificationPanel,Gt as CmOptionGroup,nl as CmPage,fn as CmPageHeader,Nn as CmPagination,Go as CmProgressBar,qr as CmRadio,Or as CmRadioGroup,Is as CmReportTile,vo as CmReportTiles,Qn as CmResourceItem,Zn as CmResourceList,vn as CmSaveBar,Ui as CmSearch,gn as CmSegmentedControl,ji as CmSelect,wo as CmSideNavigation,Zt as CmSidePanel,nr as CmSignatureField,kn as CmSkeleton,En as CmSkeletonDisplay,Rn as CmSmartTip,Hn as CmSmartTips,Po as CmSparkline,ia as CmSpinner,el as CmStack,In as CmStatusTabs,On as CmTableHeader,Kr as CmTag,qi as CmTextField,cl as CmThumbnail,ir as CmTimePicker,ks as CmTimeline,An as CmTimelineItem,Vo as CmToast,jo as CmToastRegion,Bi as CmToggle,Tn as CmTooltip,Iv as DEFAULT_PALETTE,on as MAX_RECENT,Ls as MoveModel,mv as commandMatches,Qw as configure,z as defineStrings,Nb as directionalIcons,cs as formatColor,me as formatDate,os as formatGradient,Rb as formatMessage,wu as formatNumber,Xw as getDefaultStrings,$c as hslToRgb,Zp as hsvToRgb,y0 as httpColorSource,hw as initials,Gl as isApplePlatform,yg as isColorValue,yx as listNavigation,xg as localColorSource,vl as localeFor,Fu as matchesShortcut,ls as normalizeHex,Ie as parseColor,Ht as parseGradient,mh as pluralCategory,em as pushRecent,Zw as resetStrings,Np as resolvePreset,wc as rgbToHsl,Qp as rgbToHsv,kc as sameColor,Jw as setStrings,lp as shortcutKeys,Cw as showToast,uh as translate,K0 as undoable};
|
|
4288
4295
|
/*! Bundled license information:
|
|
4289
4296
|
|
|
4290
4297
|
@lit/reactive-element/css-tag.js:
|
|
@@ -4295,20 +4302,10 @@ ${t.label}</button>
|
|
|
4295
4302
|
*)
|
|
4296
4303
|
|
|
4297
4304
|
@lit/reactive-element/reactive-element.js:
|
|
4298
|
-
(**
|
|
4299
|
-
* @license
|
|
4300
|
-
* Copyright 2017 Google LLC
|
|
4301
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4302
|
-
*)
|
|
4303
|
-
|
|
4304
4305
|
lit-html/lit-html.js:
|
|
4305
|
-
(**
|
|
4306
|
-
* @license
|
|
4307
|
-
* Copyright 2017 Google LLC
|
|
4308
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4309
|
-
*)
|
|
4310
|
-
|
|
4311
4306
|
lit-element/lit-element.js:
|
|
4307
|
+
lit-html/directive.js:
|
|
4308
|
+
lit-html/directives/repeat.js:
|
|
4312
4309
|
(**
|
|
4313
4310
|
* @license
|
|
4314
4311
|
* Copyright 2017 Google LLC
|
|
@@ -4322,20 +4319,7 @@ lit-html/is-server.js:
|
|
|
4322
4319
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4323
4320
|
*)
|
|
4324
4321
|
|
|
4325
|
-
lit-html/directive.js:
|
|
4326
|
-
(**
|
|
4327
|
-
* @license
|
|
4328
|
-
* Copyright 2017 Google LLC
|
|
4329
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4330
|
-
*)
|
|
4331
|
-
|
|
4332
4322
|
lit-html/directive-helpers.js:
|
|
4333
|
-
(**
|
|
4334
|
-
* @license
|
|
4335
|
-
* Copyright 2020 Google LLC
|
|
4336
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4337
|
-
*)
|
|
4338
|
-
|
|
4339
4323
|
lit-html/directives/live.js:
|
|
4340
4324
|
(**
|
|
4341
4325
|
* @license
|
|
@@ -4343,13 +4327,6 @@ lit-html/directives/live.js:
|
|
|
4343
4327
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
4344
4328
|
*)
|
|
4345
4329
|
|
|
4346
|
-
lit-html/directives/repeat.js:
|
|
4347
|
-
(**
|
|
4348
|
-
* @license
|
|
4349
|
-
* Copyright 2017 Google LLC
|
|
4350
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4351
|
-
*)
|
|
4352
|
-
|
|
4353
4330
|
lit-html/directives/style-map.js:
|
|
4354
4331
|
(**
|
|
4355
4332
|
* @license
|