@commmerce/ui 1.0.0 → 1.1.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/README.md +3 -3
- package/dist/cdn.js +610 -414
- package/dist/components/app-frame.d.ts +71 -0
- package/dist/components/app-frame.js +202 -0
- package/dist/components/button.d.ts +42 -5
- package/dist/components/button.js +80 -10
- package/dist/components/combobox.js +7 -19
- package/dist/components/global-search.d.ts +152 -0
- package/dist/components/global-search.js +303 -0
- package/dist/components/header-bar.d.ts +38 -0
- package/dist/components/header-bar.js +148 -6
- package/dist/components/icon.d.ts +1 -1
- package/dist/components/icon.js +2 -2
- package/dist/components/notification-panel.d.ts +41 -0
- package/dist/components/notification-panel.js +67 -8
- package/dist/components/side-navigation.d.ts +25 -0
- package/dist/components/side-navigation.js +79 -10
- package/dist/components/tooltip.d.ts +10 -0
- package/dist/components/tooltip.js +9 -2
- package/dist/custom-elements.json +1478 -86
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/popover.d.ts +8 -0
- package/dist/popover.js +26 -0
- package/package.json +4 -4
package/dist/cdn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
var kl=a=>{throw TypeError(a)};var Wn=(a,i,e)=>i.has(a)||kl("Cannot "+e);var r=(a,i,e)=>(Wn(a,i,"read from private field"),e?e.call(a):i.get(a)),h=(a,i,e)=>i.has(a)?kl("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(a):i.set(a,e),f=(a,i,e,t)=>(Wn(a,i,"write to private field"),t?t.call(a,e):i.set(a,e),e),o=(a,i,e)=>(Wn(a,i,"access private method"),e);var Qr=globalThis,ea=Qr.ShadowRoot&&(Qr.ShadyCSS===void 0||Qr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Yn=Symbol(),El=new WeakMap,Is=class{constructor(i,e,t){if(this._$cssResult$=!0,t!==Yn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=e}get styleSheet(){let i=this.o,e=this.t;if(ea&&i===void 0){let t=e!==void 0&&e.length===1;t&&(i=El.get(e)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),t&&El.set(e,i))}return i}toString(){return this.cssText}},ta=a=>new Is(typeof a=="string"?a:a+"",void 0,Yn),m=(a,...i)=>{let e=a.length===1?a[0]:i.reduce((t,s,l)=>t+(d=>{if(d._$cssResult$===!0)return d.cssText;if(typeof d=="number")return d;throw Error("Value passed to 'css' function must be a 'css' function result: "+d+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+a[l+1],a[0]);return new Is(e,a,Yn)},Ml=(a,i)=>{if(ea)a.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of i){let t=document.createElement("style"),s=Qr.litNonce;s!==void 0&&t.setAttribute("nonce",s),t.textContent=e.cssText,a.appendChild(t)}},Gn=ea?a=>a:a=>a instanceof CSSStyleSheet?(i=>{let e="";for(let t of i.cssRules)e+=t.cssText;return ta(e)})(a):a;var{is:bd,defineProperty:fd,getOwnPropertyDescriptor:gd,getOwnPropertyNames:vd,getOwnPropertySymbols:xd,getPrototypeOf:yd}=Object,ia=globalThis,_l=ia.trustedTypes,$d=_l?_l.emptyScript:"",wd=ia.reactiveElementPolyfillSupport,Hs=(a,i)=>a,Xn={toAttribute(a,i){switch(i){case Boolean:a=a?$d:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,i){let e=a;switch(i){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},Sl=(a,i)=>!bd(a,i),zl={attribute:!0,type:String,converter:Xn,reflect:!1,useDefault:!1,hasChanged:Sl};Symbol.metadata??=Symbol("metadata"),ia.litPropertyMetadata??=new WeakMap;var Se=class extends HTMLElement{static addInitializer(i){this._$Ei(),(this.l??=[]).push(i)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(i,e=zl){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(i)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(i,e),!e.noAccessor){let t=Symbol(),s=this.getPropertyDescriptor(i,t,e);s!==void 0&&fd(this.prototype,i,s)}}static getPropertyDescriptor(i,e,t){let{get:s,set:l}=gd(this.prototype,i)??{get(){return this[e]},set(d){this[e]=d}};return{get:s,set(d){let p=s?.call(this);l?.call(this,d),this.requestUpdate(i,p,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(i){return this.elementProperties.get(i)??zl}static _$Ei(){if(this.hasOwnProperty(Hs("elementProperties")))return;let i=yd(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties)}static finalize(){if(this.hasOwnProperty(Hs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Hs("properties"))){let e=this.properties,t=[...vd(e),...xd(e)];for(let s of t)this.createProperty(s,e[s])}let i=this[Symbol.metadata];if(i!==null){let e=litPropertyMetadata.get(i);if(e!==void 0)for(let[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let s=this._$Eu(e,t);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(i){let e=[];if(Array.isArray(i)){let t=new Set(i.flat(1/0).reverse());for(let s of t)e.unshift(Gn(s))}else i!==void 0&&e.push(Gn(i));return e}static _$Eu(i,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof i=="string"?i.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(i=>this.enableUpdating=i),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this))}addController(i){(this._$EO??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.()}removeController(i){this._$EO?.delete(i)}_$E_(){let i=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(i.set(t,this[t]),delete this[t]);i.size>0&&(this._$Ep=i)}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ml(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(i=>i.hostConnected?.())}enableUpdating(i){}disconnectedCallback(){this._$EO?.forEach(i=>i.hostDisconnected?.())}attributeChangedCallback(i,e,t){this._$AK(i,t)}_$ET(i,e){let t=this.constructor.elementProperties.get(i),s=this.constructor._$Eu(i,t);if(s!==void 0&&t.reflect===!0){let l=(t.converter?.toAttribute!==void 0?t.converter:Xn).toAttribute(e,t.type);this._$Em=i,l==null?this.removeAttribute(s):this.setAttribute(s,l),this._$Em=null}}_$AK(i,e){let t=this.constructor,s=t._$Eh.get(i);if(s!==void 0&&this._$Em!==s){let l=t.getPropertyOptions(s),d=typeof l.converter=="function"?{fromAttribute:l.converter}:l.converter?.fromAttribute!==void 0?l.converter:Xn;this._$Em=s;let p=d.fromAttribute(e,l.type);this[s]=p??this._$Ej?.get(s)??p,this._$Em=null}}requestUpdate(i,e,t,s=!1,l){if(i!==void 0){let d=this.constructor;if(s===!1&&(l=this[i]),t??=d.getPropertyOptions(i),!((t.hasChanged??Sl)(l,e)||t.useDefault&&t.reflect&&l===this._$Ej?.get(i)&&!this.hasAttribute(d._$Eu(i,t))))return;this.C(i,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(i,e,{useDefault:t,reflect:s,wrapped:l},d){t&&!(this._$Ej??=new Map).has(i)&&(this._$Ej.set(i,d??e??this[i]),l!==!0||d!==void 0)||(this._$AL.has(i)||(this.hasUpdated||t||(e=void 0),this._$AL.set(i,e)),s===!0&&this._$Em!==i&&(this._$Eq??=new Set).add(i))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,l]of this._$Ep)this[s]=l;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[s,l]of t){let{wrapped:d}=l,p=this[s];d!==!0||this._$AL.has(s)||p===void 0||this.C(s,void 0,l,p)}}let i=!1,e=this._$AL;try{i=this.shouldUpdate(e),i?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw i=!1,this._$EM(),t}i&&this._$AE(e)}willUpdate(i){}_$AE(i){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(i)),this.updated(i)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(i){return!0}update(i){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(i){}firstUpdated(i){}};Se.elementStyles=[],Se.shadowRootOptions={mode:"open"},Se[Hs("elementProperties")]=new Map,Se[Hs("finalized")]=new Map,wd?.({ReactiveElement:Se}),(ia.reactiveElementVersions??=[]).push("2.1.2");var Zn=globalThis,Tl=a=>a,sa=Zn.trustedTypes,Ll=sa?sa.createPolicy("lit-html",{createHTML:a=>a}):void 0,Qn="$lit$",Te=`lit$${Math.random().toFixed(9).slice(2)}$`,eo="?"+Te,kd=`<${eo}>`,pt=document,qs=()=>pt.createComment(""),Ps=a=>a===null||typeof a!="object"&&typeof a!="function",to=Array.isArray,Il=a=>to(a)||typeof a?.[Symbol.iterator]=="function",Jn=`[
|
|
2
|
+
\f\r]`,Os=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Cl=/-->/g,Al=/>/g,dt=RegExp(`>|${Jn}(?:([^\\s"'>=/]+)(${Jn}*=${Jn}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dl=/'/g,Nl=/"/g,Hl=/^(?:script|style|textarea|title)$/i,io=a=>(i,...e)=>({_$litType$:a,strings:i,values:e}),n=io(1),js=io(2),rh=io(3),Q=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Rl=new WeakMap,ht=pt.createTreeWalker(pt,129);function Ol(a,i){if(!to(a)||!a.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ll!==void 0?Ll.createHTML(i):i}var ql=(a,i)=>{let e=a.length-1,t=[],s,l=i===2?"<svg>":i===3?"<math>":"",d=Os;for(let p=0;p<e;p++){let u=a[p],v,$,x=-1,T=0;for(;T<u.length&&(d.lastIndex=T,$=d.exec(u),$!==null);)T=d.lastIndex,d===Os?$[1]==="!--"?d=Cl:$[1]!==void 0?d=Al:$[2]!==void 0?(Hl.test($[2])&&(s=RegExp("</"+$[2],"g")),d=dt):$[3]!==void 0&&(d=dt):d===dt?$[0]===">"?(d=s??Os,x=-1):$[1]===void 0?x=-2:(x=d.lastIndex-$[2].length,v=$[1],d=$[3]===void 0?dt:$[3]==='"'?Nl:Dl):d===Nl||d===Dl?d=dt:d===Cl||d===Al?d=Os:(d=dt,s=void 0);let M=d===dt&&a[p+1].startsWith("/>")?" ":"";l+=d===Os?u+kd:x>=0?(t.push(v),u.slice(0,x)+Qn+u.slice(x)+Te+M):u+Te+(x===-2?p:M)}return[Ol(a,l+(a[e]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),t]},Bs=class a{constructor({strings:i,_$litType$:e},t){let s;this.parts=[];let l=0,d=0,p=i.length-1,u=this.parts,[v,$]=ql(i,e);if(this.el=a.createElement(v,t),ht.currentNode=this.el.content,e===2||e===3){let x=this.el.content.firstChild;x.replaceWith(...x.childNodes)}for(;(s=ht.nextNode())!==null&&u.length<p;){if(s.nodeType===1){if(s.hasAttributes())for(let x of s.getAttributeNames())if(x.endsWith(Qn)){let T=$[d++],M=s.getAttribute(x).split(Te),C=/([.?@])?(.*)/.exec(T);u.push({type:1,index:l,name:C[2],strings:M,ctor:C[1]==="."?aa:C[1]==="?"?na:C[1]==="@"?oa:ut}),s.removeAttribute(x)}else x.startsWith(Te)&&(u.push({type:6,index:l}),s.removeAttribute(x));if(Hl.test(s.tagName)){let x=s.textContent.split(Te),T=x.length-1;if(T>0){s.textContent=sa?sa.emptyScript:"";for(let M=0;M<T;M++)s.append(x[M],qs()),ht.nextNode(),u.push({type:2,index:++l});s.append(x[T],qs())}}}else if(s.nodeType===8)if(s.data===eo)u.push({type:2,index:l});else{let x=-1;for(;(x=s.data.indexOf(Te,x+1))!==-1;)u.push({type:7,index:l}),x+=Te.length-1}l++}}static createElement(i,e){let t=pt.createElement("template");return t.innerHTML=i,t}};function mt(a,i,e=a,t){if(i===Q)return i;let s=t!==void 0?e._$Co?.[t]:e._$Cl,l=Ps(i)?void 0:i._$litDirective$;return s?.constructor!==l&&(s?._$AO?.(!1),l===void 0?s=void 0:(s=new l(a),s._$AT(a,e,t)),t!==void 0?(e._$Co??=[])[t]=s:e._$Cl=s),s!==void 0&&(i=mt(a,s._$AS(a,i.values),s,t)),i}var ra=class{constructor(i,e){this._$AV=[],this._$AN=void 0,this._$AD=i,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(i){let{el:{content:e},parts:t}=this._$AD,s=(i?.creationScope??pt).importNode(e,!0);ht.currentNode=s;let l=ht.nextNode(),d=0,p=0,u=t[0];for(;u!==void 0;){if(d===u.index){let v;u.type===2?v=new qt(l,l.nextSibling,this,i):u.type===1?v=new u.ctor(l,u.name,u.strings,this,i):u.type===6&&(v=new la(l,this,i)),this._$AV.push(v),u=t[++p]}d!==u?.index&&(l=ht.nextNode(),d++)}return ht.currentNode=pt,s}p(i){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(i,t,e),e+=t.strings.length-2):t._$AI(i[e])),e++}},qt=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(i,e,t,s){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=i,this._$AB=e,this._$AM=t,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let i=this._$AA.parentNode,e=this._$AM;return e!==void 0&&i?.nodeType===11&&(i=e.parentNode),i}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(i,e=this){i=mt(this,i,e),Ps(i)?i===c||i==null||i===""?(this._$AH!==c&&this._$AR(),this._$AH=c):i!==this._$AH&&i!==Q&&this._(i):i._$litType$!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Il(i)?this.k(i):this._(i)}O(i){return this._$AA.parentNode.insertBefore(i,this._$AB)}T(i){this._$AH!==i&&(this._$AR(),this._$AH=this.O(i))}_(i){this._$AH!==c&&Ps(this._$AH)?this._$AA.nextSibling.data=i:this.T(pt.createTextNode(i)),this._$AH=i}$(i){let{values:e,_$litType$:t}=i,s=typeof t=="number"?this._$AC(i):(t.el===void 0&&(t.el=Bs.createElement(Ol(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===s)this._$AH.p(e);else{let l=new ra(s,this),d=l.u(this.options);l.p(e),this.T(d),this._$AH=l}}_$AC(i){let e=Rl.get(i.strings);return e===void 0&&Rl.set(i.strings,e=new Bs(i)),e}k(i){to(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,s=0;for(let l of i)s===e.length?e.push(t=new a(this.O(qs()),this.O(qs()),this,this.options)):t=e[s],t._$AI(l),s++;s<e.length&&(this._$AR(t&&t._$AB.nextSibling,s),e.length=s)}_$AR(i=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);i!==this._$AB;){let t=Tl(i).nextSibling;Tl(i).remove(),i=t}}setConnected(i){this._$AM===void 0&&(this._$Cv=i,this._$AP?.(i))}},ut=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(i,e,t,s,l){this.type=1,this._$AH=c,this._$AN=void 0,this.element=i,this.name=e,this._$AM=s,this.options=l,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=c}_$AI(i,e=this,t,s){let l=this.strings,d=!1;if(l===void 0)i=mt(this,i,e,0),d=!Ps(i)||i!==this._$AH&&i!==Q,d&&(this._$AH=i);else{let p=i,u,v;for(i=l[0],u=0;u<l.length-1;u++)v=mt(this,p[t+u],e,u),v===Q&&(v=this._$AH[u]),d||=!Ps(v)||v!==this._$AH[u],v===c?i=c:i!==c&&(i+=(v??"")+l[u+1]),this._$AH[u]=v}d&&!s&&this.j(i)}j(i){i===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"")}},aa=class extends ut{constructor(){super(...arguments),this.type=3}j(i){this.element[this.name]=i===c?void 0:i}},na=class extends ut{constructor(){super(...arguments),this.type=4}j(i){this.element.toggleAttribute(this.name,!!i&&i!==c)}},oa=class extends ut{constructor(i,e,t,s,l){super(i,e,t,s,l),this.type=5}_$AI(i,e=this){if((i=mt(this,i,e,0)??c)===Q)return;let t=this._$AH,s=i===c&&t!==c||i.capture!==t.capture||i.once!==t.once||i.passive!==t.passive,l=i!==c&&(t===c||s);s&&this.element.removeEventListener(this.name,this,t),l&&this.element.addEventListener(this.name,this,i),this._$AH=i}handleEvent(i){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,i):this._$AH.handleEvent(i)}},la=class{constructor(i,e,t){this.element=i,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(i){mt(this,i)}},Pl={M:Qn,P:Te,A:eo,C:1,L:ql,R:ra,D:Il,V:mt,I:qt,H:ut,N:na,U:oa,B:aa,F:la},Ed=Zn.litHtmlPolyfillSupport;Ed?.(Bs,qt),(Zn.litHtmlVersions??=[]).push("3.3.3");var Bl=(a,i,e)=>{let t=e?.renderBefore??i,s=t._$litPart$;if(s===void 0){let l=e?.renderBefore??null;t._$litPart$=s=new qt(i.insertBefore(qs(),l),l,void 0,e??{})}return s._$AI(a),s};var so=globalThis,k=class extends Se{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this._$Do=Bl(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Q}};k._$litElement$=!0,k.finalized=!0,so.litElementHydrateSupport?.({LitElement:k});var Md=so.litElementPolyfillSupport;Md?.({LitElement:k});(so.litElementVersions??=[]).push("4.2.2");var g=m`
|
|
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,13 +8,20 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,vh=m`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
15
|
-
|
|
14
|
+
`,_d=0,S=a=>`${a}-${++_d}`;function b(a,i){customElements.get(a)||customElements.define(a,i)}function de(a,i){let e=a.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(i).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var zd={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},ca={common:{...zd}},Fs={},Vs={},da;function w(a,i){return ca[a]={...ca[a],...i},i}function Sd(){return Object.fromEntries(Object.entries(ca).map(([a,i])=>[a,{...i}]))}function ha(a,i){for(let[e,t]of Object.entries(i??{}))t&&typeof t=="object"&&(a[e]={...a[e],...t})}function Td(a,i){ha(i?Vs[i.toLowerCase()]??={}:Fs,a),ma()}function Ld(a={}){"locale"in a&&(da=a.locale||void 0),a.strings&&ha(Fs,a.strings);for(let[i,e]of Object.entries(a.translations??{}))ha(Vs[i.toLowerCase()]??={},e);ma()}function Cd(){da=void 0;for(let a of Object.keys(Fs))delete Fs[a];for(let a of Object.keys(Vs))delete Vs[a];ma()}function Us(a){if(da)return da;let i=a;for(;i;){if(i instanceof Element&&i.hasAttribute("lang")&&i.getAttribute("lang"))return i.getAttribute("lang");i=i.parentNode??(i instanceof ShadowRoot?i.host:null)}if(typeof document<"u"&&document.documentElement.lang)return document.documentElement.lang}var jl=new Map;function no(a,i,e,t){let s=`${a}|${i??""}|${JSON.stringify(e)}`,l=jl.get(s);if(!l){try{l=t(i)}catch{l=t(void 0)}jl.set(s,l)}return l}function oo(a,i={},e){return no("n",e,i,t=>new Intl.NumberFormat(t,i)).format(a)}function we(a,i={},e){return no("d",e,i,t=>new Intl.DateTimeFormat(t,i)).format(a)}function pa(a,i){return no("p",i,{},e=>new Intl.PluralRules(e)).select(a)}function Fl(a,i={},e){if(a==null)return"";if(typeof a=="function")return String(a(i));let t;if(typeof a=="object"){let s=Number(i.count??0);t=a[pa(s,e)]??a.other??""}else t=String(a);return t.replace(/\{(\w+)\}/g,(s,l)=>{let d=i[l];return d===void 0?s:typeof d=="number"?oo(d,{},e):String(d)})}function Ad(a,i,e,t){if(t&&t[i]!==void 0)return t[i];let s=[];if(e){let l=e.toLowerCase().split("-");for(let d=l.length;d>0;d--)s.push(l.slice(0,d).join("-"))}for(let l of a==="common"?["common"]:[a,"common"]){for(let p of s){let u=Vs[p]?.[l]?.[i];if(u!==void 0)return u}let d=Fs[l]?.[i]??ca[l]?.[i];if(d!==void 0)return d}}function Vl(a,i,e,t,s){let l=Us(t);return Fl(Ad(a,i,l,s),e,l)}var ao=new Set,ro;function ma(){for(let a of ao)a.requestUpdate()}function Dd(){ro||typeof MutationObserver>"u"||typeof document>"u"||(ro=new MutationObserver(ma),ro.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var Nd=a=>a.replace(/^cm-/,"").replace(/-([a-z])/g,(i,e)=>e.toUpperCase()),y=class extends k{static finalize(){let i=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);if(!i(this,"finalized")&&i(this,"properties"))for(let[e,t]of Object.entries(this.properties)){let s=t.string;if(!s||i(this.prototype,e))continue;let l=Symbol(e);Object.defineProperty(this.prototype,e,{get(){return this[l]??this.t(s)},set(d){this[l]=d},configurable:!0,enumerable:!0})}super.finalize()}get stringsNamespace(){return Nd(this.localName)}t(i,e){return Vl(this.stringsNamespace,i,e,this,this.strings)}get locale(){return Us(this)}formatNumber(i,e){return oo(i,e,this.locale)}connectedCallback(){super.connectedCallback(),ao.add(this),Dd()}disconnectedCallback(){super.disconnectedCallback(),ao.delete(this)}};y.properties={strings:{type:Object}};var ua={"chevron-down":"M6 9l6 6 6-6","chevron-up":"M6 15l6-6 6 6","chevron-right":"M9 6l6 6-6 6","chevron-left":"M15 6l-6 6 6 6",close:"M6 6l12 12M18 6L6 18",search:"M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM16 16l4 4",filter:"M4 7h16M7 12h10M10 17h4",edit:"M4 20h4L19 9l-4-4L4 16v4zM14 6l4 4",trash:"M5 7h14M10 7V5h4v2M7 7l1 13h8l1-13M10 11v6M14 11v6","arrow-up-right":"M7 17L17 7M9 7h8v8",calendar:"M5 6h14v14H5zM5 10h14M9 4v4M15 4v4",upload:"M12 16V6M8 10l4-4 4 4M5 18h14",plus:"M12 5v14M5 12h14",check:"M5 12.5l4.5 4.5L19 7",bell:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15zM10 20h4",help:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6M12 17h.01",rocket:"M14 4c3 0 6 3 6 6l-6 6-6-6c0-3 3-6 6-6zM8 16l-3 3M10 18l-2 3M6 14l-3 2",home:"M4 11l8-7 8 7v9h-5v-6H9v6H4z",box:"M4 8l8-4 8 4v8l-8 4-8-4zM4 8l8 4 8-4M12 12v8",cart:"M5 8h14l-1 12H6zM9 8V6a3 3 0 0 1 6 0v2",more:"M6 12h.01M12 12h.01M18 12h.01",drag:"M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01","eye-off":"M3 3l18 18M10.6 6.1A9 9 0 0 1 21 12a14 14 0 0 1-2.2 2.9M6.6 6.6A14 14 0 0 0 3 12s3 6 9 6a8 8 0 0 0 4-1",external:"M14 5h5v5M19 5l-8 8M18 14v5H5V6h5",users:"M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM2 21v-1a7 7 0 0 1 14 0v1M17 11a3 3 0 1 0 0-6M22 21v-1a5 5 0 0 0-4-5",chart:"M5 20V10M12 20V4M19 20v-7",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM4 12h2M18 12h2M12 4v2M12 18v2M6.3 6.3l1.4 1.4M16.3 16.3l1.4 1.4M6.3 17.7l1.4-1.4M16.3 7.7l1.4-1.4",store:"M4 9l1-5h14l1 5M4 9h16v11H4zM9 20v-6h6v6",pin:"M15 4l5 5-3 1-4 4 1 4-2 2-4-4-4 4M8 12l4-4 1-3",clock:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM12 7v5l3 2",alert:"M12 4l9 16H3zM12 10v4M12 17h.01","check-circle":"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM8 12l3 3 5-6","x-circle":"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM9 9l6 6M15 9l-6 6",bag:"M6 8h12l1 12H5zM9 8a3 3 0 0 1 6 0",sun:"M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4",moon:"M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z",menu:"M4 7h16M4 12h16M4 17h16",copy:"M9 9h11v11H9zM5 15H4V4h11v1",code:"M8 8l-4 4 4 4M16 8l4 4-4 4M14 5l-4 14",download:"M12 4v11M7.5 10.5L12 15l4.5-4.5M5 19h14",book:"M5 5a2 2 0 0 1 2-2h12v15H7a2 2 0 0 0-2 2zM5 20a2 2 0 0 0 2 2h12v-4",pos:"M5 4h14v8H5zM3 16h18v4H3zM8 8h4M12 12v4",website:"M3 5h18v14H3zM3 9h18M9 13h6M9 16h4",apps:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z",megaphone:"M4 10v4h3l8 5V5l-8 5zM18.5 9a4 4 0 0 1 0 6M7 14l1 5h3l-1-4",staff:"M5 4h14v17H5zM9 4V2h6v2M12 13a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zM8 18a4 4 0 0 1 8 0",repeat:"M17 3l3 3-3 3M4 11V9a3 3 0 0 1 3-3h13M7 21l-3-3 3-3M20 13v2a3 3 0 0 1-3 3H4",wallet:"M4 6h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4zM4 6V5a1 1 0 0 1 1-1h11v2M15 13h2",user:"M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",star:"M12 3l2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",percent:"M19 5L5 19M7 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM17 19a2 2 0 1 0 0-4 2 2 0 0 0 0 4z","arrow-left":"M19 12H5M11 6l-6 6 6 6",send:"M21 3L10 14M21 3l-7 18-4-7-7-4z",link:"M10 14a4 4 0 0 0 6 0l3-3a4 4 0 0 0-6-6l-1 1M14 10a4 4 0 0 0-6 0l-3 3a4 4 0 0 0 6 6l1-1",share:"M18 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM8.6 13.5l6.8 4M15.4 6.5l-6.8 4",globe:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18",gift:"M4 11h16v9H4zM3 7h18v4H3zM12 7v13M12 7c-2 0-4-1-4-3s3-1 4 3c1-4 4-5 4-3s-2 3-4 3",mail:"M3 6h18v12H3zM3 6l9 7 9-7",chat:"M4 5h16v11h-9l-4 4v-4H4zM8 9.5h8M8 12.5h5",tag:"M4 4h7l9 9-7 7-9-9zM8.5 10a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",building:"M3 21h18M5 21V4h9v17M14 10h5v11M8 8h3M8 12h3M8 16h3",map:"M3 6l6-2 6 2 6-2v14l-6 2-6-2-6 2zM9 4v14M15 6v14",note:"M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 15h6M9 18h4",eye:"M3 12s3-6 9-6 9 6 9 6-3 6-9 6-9-6-9-6zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",inbox:"M3 13l3-8h12l3 8v6H3zM3 13h5l1 3h6l1-3h5",handshake:"M3 7v8M21 7v8M3 9l5-3h4l-3 3.5a1.5 1.5 0 0 0 2.2 2L13 9.5l5 5M21 9l-4-3h-5M3 15h2l5 4a1.4 1.4 0 0 0 2-2M10 15l3.5 3a1.4 1.4 0 0 0 2-2l-1.5-1.5","log-out":"M10 4H5v16h5M14 8l4 4-4 4M18 12H9",refresh:"M20 12a8 8 0 0 0-14.9-4M4 12a8 8 0 0 0 14.9 4M5 3.5V8h4.5M19 20.5V16h-4.5",tasks:"M5 5h14v14H5zM8.5 12l2.5 2.5 4.5-5"},Ul=["more","drag"],wh=Object.keys(ua);var Kl=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],Pt=class extends k{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=ua[this.name]??ua.more,t=Ul.includes(this.name)?3:1.6;return js`<svg width=${this.size} height=${this.size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
15
|
+
stroke-width=${t} stroke-linecap="round" stroke-linejoin="round"
|
|
16
|
+
role=${this.label?"img":c} aria-label=${this.label||c} aria-hidden=${this.label?c:"true"}
|
|
17
|
+
part="svg" class=${(this.mirror==="auto"?Kl.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Pt.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Pt.styles=m`
|
|
18
|
+
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
19
|
+
svg { display: block; }
|
|
20
|
+
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
21
|
+
`;b("cm-icon",Pt);var Wl=99,Ch=w("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),ba,fa,Ks,bt=class extends y{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;h(this,ba,this.attachInternals());h(this,fa,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,ba).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});h(this,Ks,!1);this.addEventListener("click",r(this,fa),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,Ks)&&(f(this,Ks,!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.size==="large"?20:16,s=this.loading?n`<span class="spinner" aria-hidden="true"></span>`:n`<slot name="icon">${this.icon?n`<cm-icon name=${this.icon} size=${t}></cm-icon>`:c}</slot>`,l=this.iconOnly?n`<span class="vh"><slot></slot></span>`:n`<slot></slot>`,d=e?n`<span class="count" part="count" aria-hidden="true">${e>Wl?this.t("countOverflow",{max:Wl}):this.formatNumber(e)}</span>${this.iconOnly?c:n`<span class="vh"> ${this.t("count",{count:e})}</span>`}`:c,p=this.iconOnly&&(this.label||this.textContent?.trim())||"",u=!this.iconOnly||!p?c:e?this.t("labelWithCount",{label:p,count:e}):this.label||c,v=n`${s}${l}${d}`;return this.href&&!this.disabled?n`<a class="btn" part="control" href=${this.href} target=${this.target??c}
|
|
22
|
+
rel=${this.target==="_blank"?"noopener noreferrer":c} aria-label=${u}>${v}</a>`:n`<button class="btn" part="control" type="button"
|
|
16
23
|
?disabled=${this.disabled} aria-disabled=${this.loading?"true":c}
|
|
17
|
-
aria-busy=${this.loading?"true":c}>${
|
|
24
|
+
aria-busy=${this.loading?"true":c} aria-label=${u}>${v}</button>`}};ba=new WeakMap,fa=new WeakMap,Ks=new WeakMap,bt.formAssociated=!0,bt.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}},bt.styles=[g,m`
|
|
18
25
|
:host { display: inline-flex; vertical-align: middle; }
|
|
19
26
|
.btn {
|
|
20
27
|
display: inline-flex; align-items: center; justify-content: center; gap: 6px;
|
|
@@ -43,21 +50,40 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
43
50
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
44
51
|
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
|
|
45
52
|
::slotted([slot='icon']) { display: inline-flex; }
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
/* Icon-only: a square of the size's height; at least 44 x 44 on touch screens. */
|
|
54
|
+
:host([icon-only]) .btn { position: relative; padding: 0; }
|
|
55
|
+
:host([icon-only][size='large']) .btn { width: 46px; }
|
|
56
|
+
:host([icon-only]) .btn, :host([icon-only][size='medium']) .btn { width: 32px; }
|
|
57
|
+
:host([icon-only][size='slim']) .btn { width: 24px; }
|
|
58
|
+
@media (pointer: coarse) {
|
|
59
|
+
:host([icon-only]) .btn { min-width: 44px; min-height: 44px; }
|
|
60
|
+
}
|
|
61
|
+
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
62
|
+
.count {
|
|
63
|
+
display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
|
|
64
|
+
min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--cm-radius-full);
|
|
65
|
+
font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
|
|
66
|
+
color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
|
|
67
|
+
}
|
|
68
|
+
:host([icon-only]) .count {
|
|
69
|
+
position: absolute; inset-block-start: -7px; inset-inline-end: -7px;
|
|
70
|
+
box-shadow: 0 0 0 2px var(--cm-bg-surface); pointer-events: none;
|
|
71
|
+
}
|
|
72
|
+
`];b("cm-button",bt);var Le={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ga=a=>(...i)=>({_$litDirective$:a,values:i}),Bt=class{constructor(i){}get _$AU(){return this._$AM._$AU}_$AT(i,e,t){this._$Ct=i,this._$AM=e,this._$Ci=t}_$AS(i,e){return this.update(i,e)}update(i,e){return this.render(...e)}};var{I:Ih}=Pl;var Yl=a=>a.strings===void 0;var Rd={},Gl=(a,i=Rd)=>a._$AH=i;var ne=ga(class extends Bt{constructor(a){if(super(a),a.type!==Le.PROPERTY&&a.type!==Le.ATTRIBUTE&&a.type!==Le.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Yl(a))throw Error("`live` bindings can only contain a single expression")}render(a){return a}update(a,[i]){if(i===Q||i===c)return i;let e=a.element,t=a.name;if(a.type===Le.PROPERTY){if(i===e[t])return Q}else if(a.type===Le.BOOLEAN_ATTRIBUTE){if(!!i===e.hasAttribute(t))return Q}else if(a.type===Le.ATTRIBUTE&&e.getAttribute(t)===i+"")return Q;return Gl(a),i}});var Gh=w("textField",{required:"Please fill in this field."}),he,Ce,Ws,Ue,lo,co,Ve=class extends y{constructor(){super(...arguments);h(this,Ue);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.type="text";this.multiline=!1;this.rows=4;this.required=!1;this.disabled=!1;this.readonly=!1;this.size="default";h(this,he,this.attachInternals());h(this,Ce,S("cm-tf"));h(this,Ws,"")}connectedCallback(){super.connectedCallback(),f(this,Ws,this.value)}get form(){return r(this,he).form}get validity(){return r(this,he).validity}get validationMessage(){return r(this,he).validationMessage}checkValidity(){return r(this,he).checkValidity()}reportValidity(){return r(this,he).reportValidity()}formResetCallback(){this.value=r(this,Ws),this.error=""}formDisabledCallback(e){this.disabled=e}updated(){r(this,he).setFormValue(this.value);let e=this.renderRoot.querySelector(".input");this.error?r(this,he).setValidity({customError:!0},this.error,e??void 0):this.required&&!this.value?r(this,he).setValidity({valueMissing:!0},this.t("required"),e??void 0):r(this,he).setValidity({})}render(){let e=[this.error&&`${r(this,Ce)}-err`,this.helpText&&`${r(this,Ce)}-help`].filter(Boolean).join(" ")||c,t={id:r(this,Ce),invalid:this.error?"true":c},s=this.multiline?n`<textarea class="input" part="input" id=${t.id} rows=${this.rows}
|
|
73
|
+
.value=${ne(this.value)} placeholder=${this.placeholder||c}
|
|
48
74
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
49
75
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
50
|
-
@input=${
|
|
51
|
-
.value=${
|
|
76
|
+
@input=${o(this,Ue,lo)} @change=${o(this,Ue,co)}></textarea>`:n`<input class="input" part="input" id=${t.id} type=${this.type}
|
|
77
|
+
.value=${ne(this.value)} placeholder=${this.placeholder||c}
|
|
52
78
|
autocomplete=${this.autocomplete??c}
|
|
53
79
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
54
80
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
55
|
-
@input=${
|
|
56
|
-
${this.label?n`<label for=${r(this,
|
|
81
|
+
@input=${o(this,Ue,lo)} @change=${o(this,Ue,co)} />`;return n`<div class="field">
|
|
82
|
+
${this.label?n`<label for=${r(this,Ce)} part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}${this.hint?n`<span class="hint">[${this.hint}]</span>`:c}</label>`:c}
|
|
57
83
|
${s}
|
|
58
|
-
${this.error?n`<p class="error" id="${r(this,
|
|
59
|
-
${this.helpText?n`<p class="help" id="${r(this,
|
|
60
|
-
</div>`}};
|
|
84
|
+
${this.error?n`<p class="error" id="${r(this,Ce)}-err" role="alert">${this.error}</p>`:c}
|
|
85
|
+
${this.helpText?n`<p class="help" id="${r(this,Ce)}-help">${this.helpText}</p>`:c}
|
|
86
|
+
</div>`}};he=new WeakMap,Ce=new WeakMap,Ws=new WeakMap,Ue=new WeakSet,lo=function(e){this.value=e.target.value},co=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ve.formAssociated=!0,Ve.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Ve.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},type:{},multiline:{type:Boolean},rows:{type:Number},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},autocomplete:{},size:{reflect:!0}},Ve.styles=[g,m`
|
|
61
87
|
:host { display: block; }
|
|
62
88
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
63
89
|
label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -80,13 +106,13 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
80
106
|
:host([size='small']) .field { gap: 6px; }
|
|
81
107
|
:host([size='small']) label { font-size: 12px; }
|
|
82
108
|
:host([size='small']) .input { font-size: 14px; }
|
|
83
|
-
`];
|
|
84
|
-
<input type="checkbox" id=${r(this,
|
|
109
|
+
`];b("cm-text-field",Ve);var tp=w("checkbox",{required:"Please tick this box."}),We,ft,Ys,va,Xl,Ke=class extends y{constructor(){super(...arguments);h(this,va);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;h(this,We,this.attachInternals());h(this,ft,S("cm-cb"));h(this,Ys,!1)}connectedCallback(){super.connectedCallback(),f(this,Ys,this.checked)}get form(){return r(this,We).form}checkValidity(){return r(this,We).checkValidity()}formResetCallback(){this.checked=r(this,Ys)}formDisabledCallback(e){this.disabled=e}updated(){r(this,We).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,We).setValidity({valueMissing:!0},this.t("required")):r(this,We).setValidity({})}render(){let e=this.indeterminate?n`<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>`:n`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6.2 4.8 9 10 3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;return n`<label for=${r(this,ft)}>
|
|
110
|
+
<input type="checkbox" id=${r(this,ft)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
85
111
|
?disabled=${this.disabled} ?required=${this.required}
|
|
86
|
-
aria-describedby=${this.description?`${r(this,
|
|
112
|
+
aria-describedby=${this.description?`${r(this,ft)}-d`:c} @change=${o(this,va,Xl)} />
|
|
87
113
|
<span class="box" part="box">${e}</span>
|
|
88
|
-
${this.label||this.description?n`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?n`<span class="desc" id="${r(this,
|
|
89
|
-
</label>`}};
|
|
114
|
+
${this.label||this.description?n`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?n`<span class="desc" id="${r(this,ft)}-d">${this.description}</span>`:c}</span>`:n`<slot></slot>`}
|
|
115
|
+
</label>`}};We=new WeakMap,ft=new WeakMap,Ys=new WeakMap,va=new WeakSet,Xl=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ke.formAssociated=!0,Ke.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Ke.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},Ke.styles=[g,m`
|
|
90
116
|
:host { display: inline-flex; }
|
|
91
117
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; }
|
|
92
118
|
input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; cursor: inherit; }
|
|
@@ -103,12 +129,12 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
103
129
|
:host([disabled]) label { cursor: not-allowed; }
|
|
104
130
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
105
131
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
106
|
-
`];
|
|
132
|
+
`];b("cm-checkbox",Ke);var Gs,vt=class extends k{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;h(this,Gs,S("cm-radio"))}render(){let e=this.description?`${r(this,Gs)}-d`:null;return n`<div class="radio" part="radio" role="radio" id=${r(this,Gs)}
|
|
107
133
|
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":c}
|
|
108
134
|
aria-describedby=${e??c} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
109
135
|
<span class="dot" part="dot"></span>
|
|
110
136
|
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?n`<span class="desc" id=${e}>${this.description}</span>`:c}</span>
|
|
111
|
-
</div>`}};
|
|
137
|
+
</div>`}};Gs=new WeakMap,vt.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},vt.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}},vt.styles=[g,m`
|
|
112
138
|
:host { display: inline-flex; }
|
|
113
139
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; outline: none; }
|
|
114
140
|
.dot {
|
|
@@ -128,16 +154,16 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
128
154
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
129
155
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-default); }
|
|
130
156
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
131
|
-
`];
|
|
132
|
-
aria-labelledby=${
|
|
157
|
+
`];b("cm-radio",vt);var op=w("radioGroup",{required:"Please select one of these options."}),pe,Ae,Xs,Js,Zs,jt,q,ho,ya,gt,po,Ft,mo,$a,wa,xa,xt=class extends y{constructor(){super();h(this,q);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;h(this,pe,this.attachInternals());h(this,Ae,S("cm-rg"));h(this,Xs,"");h(this,Js,!0);h(this,Zs,!1);h(this,jt,!1);h(this,ya,()=>{o(this,q,ho).call(this),r(this,Ft).call(this)});h(this,Ft,()=>{let e=o(this,q,gt).call(this),t=!1;for(let l of e)l.checked=!!this.value&&l.value===this.value&&!t,l.checked&&(t=!0),l.groupDisabled=this.disabled;let s=e.find(l=>l.checked&&!l.disabled)??o(this,q,po).call(this)[0];for(let l of e)l._tabbable=l===s&&!this.disabled});h(this,$a,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||o(this,q,mo).call(this,t,!0)});h(this,wa,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let s=o(this,q,po).call(this),l=s.indexOf(t),d=de(e,this),p;if(e.key==="ArrowDown"||d==="ArrowRight")p=s[(l+1)%s.length];else if(e.key==="ArrowUp"||d==="ArrowLeft")p=s[(l-1+s.length)%s.length];else if(e.key===" ")p=t.disabled?void 0:t;else return;e.preventDefault(),p&&o(this,q,mo).call(this,p,!0)});this.addEventListener("keydown",r(this,wa)),this.addEventListener("click",r(this,$a))}connectedCallback(){super.connectedCallback(),o(this,q,ho).call(this)}get form(){return r(this,pe).form}get validity(){return r(this,pe).validity}get validationMessage(){return r(this,pe).validationMessage}checkValidity(){return r(this,pe).checkValidity()}reportValidity(){return r(this,pe).reportValidity()}formResetCallback(){this.value=r(this,Xs)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(o(this,q,gt).call(this).find(t=>t._tabbable)??o(this,q,gt).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,Zs)&&!r(this,jt)&&f(this,Js,!1),f(this,Zs,!0),r(this,Ft).call(this),r(this,pe).setFormValue(this.value||null,this.value);let t=o(this,q,gt).call(this)[0];this.error?r(this,pe).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,pe).setValidity({valueMissing:!0},this.t("required"),t):r(this,pe).setValidity({})}render(){let e=[this.error&&`${r(this,Ae)}-err`,this.helpText&&`${r(this,Ae)}-help`].filter(Boolean).join(" ");return n`<div class="group" role="radiogroup" part="group"
|
|
158
|
+
aria-labelledby=${o(this,q,xa).call(this)?`${r(this,Ae)}-l`:c} aria-label=${o(this,q,xa).call(this)?c:this.getAttribute("aria-label")??c}
|
|
133
159
|
aria-describedby=${e||c}
|
|
134
160
|
aria-required=${this.required?"true":c} aria-invalid=${this.error?"true":c}
|
|
135
161
|
aria-disabled=${this.disabled?"true":c}>
|
|
136
|
-
<span class="label" id="${r(this,
|
|
137
|
-
${this.helpText?n`<p class="help" id="${r(this,
|
|
138
|
-
${this.error?n`<p class="error" id="${r(this,
|
|
139
|
-
<div class="options" part="options"><slot @slotchange=${r(this,
|
|
140
|
-
</div>`}};
|
|
162
|
+
<span class="label" id="${r(this,Ae)}-l" part="label" ?hidden=${!o(this,q,xa).call(this)}>${this.label}<slot name="label"></slot>${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>
|
|
163
|
+
${this.helpText?n`<p class="help" id="${r(this,Ae)}-help">${this.helpText}</p>`:c}
|
|
164
|
+
${this.error?n`<p class="error" id="${r(this,Ae)}-err" role="alert">${this.error}</p>`:c}
|
|
165
|
+
<div class="options" part="options"><slot @slotchange=${r(this,ya)}></slot></div>
|
|
166
|
+
</div>`}};pe=new WeakMap,Ae=new WeakMap,Xs=new WeakMap,Js=new WeakMap,Zs=new WeakMap,jt=new WeakMap,q=new WeakSet,ho=function(){r(this,Js)&&(this.value||(f(this,jt,!0),this.value=o(this,q,gt).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>f(this,jt,!1))),f(this,Xs,this.value))},ya=new WeakMap,gt=function(){return[...this.querySelectorAll("cm-radio")]},po=function(){return o(this,q,gt).call(this).filter(e=>!e.disabled&&!this.disabled)},Ft=new WeakMap,mo=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,r(this,Ft).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},$a=new WeakMap,wa=new WeakMap,xa=function(){return!!this.label||!!this.querySelector("[slot=label]")},xt.formAssociated=!0,xt.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}},xt.styles=[g,m`
|
|
141
167
|
:host { display: block; }
|
|
142
168
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
143
169
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -146,13 +172,13 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
146
172
|
.error { color: var(--cm-text-critical); }
|
|
147
173
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-20); padding-top: var(--cm-space-10); }
|
|
148
174
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-30); }
|
|
149
|
-
`];
|
|
150
|
-
<input type="checkbox" role="switch" id=${r(this,
|
|
175
|
+
`];b("cm-radio-group",xt);var Vt,yt,Qs,ka,Jl,Ye=class extends k{constructor(){super(...arguments);h(this,ka);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;h(this,Vt,this.attachInternals());h(this,yt,S("cm-tg"));h(this,Qs,!1)}connectedCallback(){super.connectedCallback(),f(this,Qs,this.checked)}get form(){return r(this,Vt).form}checkValidity(){return r(this,Vt).checkValidity()}formResetCallback(){this.checked=r(this,Qs)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,Vt).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return n`<label for=${r(this,yt)}>
|
|
176
|
+
<input type="checkbox" role="switch" id=${r(this,yt)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
151
177
|
aria-label=${e?c:this.getAttribute("aria-label")??c}
|
|
152
|
-
aria-describedby=${this.description?`${r(this,
|
|
178
|
+
aria-describedby=${this.description?`${r(this,yt)}-d`:c} @change=${o(this,ka,Jl)} />
|
|
153
179
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
154
|
-
${e?n`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?n`<span class="desc" id="${r(this,
|
|
155
|
-
</label>`}};
|
|
180
|
+
${e?n`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?n`<span class="desc" id="${r(this,yt)}-d">${this.description}</span>`:c}</span>`:c}
|
|
181
|
+
</label>`}};Vt=new WeakMap,yt=new WeakMap,Qs=new WeakMap,ka=new WeakSet,Jl=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ye.formAssociated=!0,Ye.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Ye.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},Ye.styles=[g,m`
|
|
156
182
|
:host { display: inline-flex; }
|
|
157
183
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; }
|
|
158
184
|
input { position: absolute; opacity: 0; width: 38px; height: 20px; margin: 0; cursor: inherit; }
|
|
@@ -177,39 +203,32 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
177
203
|
:host([disabled]) .track { opacity: .5; }
|
|
178
204
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
179
205
|
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
180
|
-
`];
|
|
181
|
-
|
|
182
|
-
role=${this.label?"img":c} aria-label=${this.label||c} aria-hidden=${this.label?c:"true"}
|
|
183
|
-
part="svg" class=${(this.mirror==="auto"?ul.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Rt.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Rt.styles=m`
|
|
184
|
-
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
185
|
-
svg { display: block; }
|
|
186
|
-
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
187
|
-
`;u("cm-icon",Rt);var zh=$("select",{required:"Please select an item in the list."}),le,F,qt,ue,Ot,js,C,jn,Bn,Ps,Ht,ft,Ve,ra,aa,Bs,na,oa,Ue=class extends x{constructor(){super(...arguments);h(this,C);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this._active=-1;this._slotted=[];h(this,le,this.attachInternals());h(this,F,T("cm-sel"));h(this,qt,"");h(this,ue,"");h(this,Ot,0);h(this,js,new MutationObserver(()=>l(this,C,jn).call(this)));h(this,aa,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),l(this,C,Ps).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),l(this,C,Ps).call(this),l(this,C,Ve).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let s=l(this,C,ra).call(this,t);l(this,C,Ps).call(this,s>=0?s:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?l(this,C,ft).call(this,this._active):l(this,C,Ve).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?l(this,C,ft).call(this,this._active):l(this,C,Ve).call(this,-1);break;case"Home":e.preventDefault(),l(this,C,Ve).call(this,"first");break;case"End":e.preventDefault(),l(this,C,Ve).call(this,"last");break;case"PageDown":e.preventDefault(),l(this,C,Ve).call(this,10);break;case"PageUp":e.preventDefault(),l(this,C,Ve).call(this,-10);break;case"Enter":e.preventDefault(),l(this,C,ft).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),l(this,C,Ht).call(this);break;case"Tab":l(this,C,ft).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,ue)&&Date.now()-r(this,Ot)<500){let s=l(this,C,ra).call(this," ");s>=0&&(this._active=s)}else l(this,C,ft).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let s=l(this,C,ra).call(this,t);s>=0&&(this._active=s)}}});h(this,Bs,e=>{this.open&&!e.composedPath().includes(this)&&l(this,C,Ht).call(this)});h(this,na,()=>{this.disabled||(this.open?l(this,C,Ht).call(this):l(this,C,Ps).call(this))});h(this,oa,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),l(this,C,jn).call(this),r(this,js).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,Bs),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,js).disconnect(),document.removeEventListener("pointerdown",r(this,Bs),!0)}get form(){return r(this,le).form}get validity(){return r(this,le).validity}get validationMessage(){return r(this,le).validationMessage}checkValidity(){return r(this,le).checkValidity()}reportValidity(){return r(this,le).reportValidity()}formResetCallback(){this.value=r(this,qt),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){r(this,qt)||g(this,qt,this.value)}updated(e){r(this,le).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,le).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,le).setValidity({valueMissing:!0},this.t("required"),t):r(this,le).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,F)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(d=>d.value===this.value),s=[this.error&&`${r(this,F)}-err`,this.helpText&&`${r(this,F)}-help`].filter(Boolean).join(" "),o=this.getAttribute("aria-label");return n`<div class="field">
|
|
188
|
-
${this.label?n`<span class="label" id="${r(this,F)}-l" part="label" @click=${r(this,oa)}>${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
206
|
+
`];b("cm-toggle",Ye);var gp=w("select",{required:"Please select an item in the list."}),me,V,Kt,xe,Wt,tr,D,uo,bo,er,Ut,$t,Ge,Ea,Ma,ir,_a,za,Xe=class extends y{constructor(){super(...arguments);h(this,D);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this._active=-1;this._slotted=[];h(this,me,this.attachInternals());h(this,V,S("cm-sel"));h(this,Kt,"");h(this,xe,"");h(this,Wt,0);h(this,tr,new MutationObserver(()=>o(this,D,uo).call(this)));h(this,Ma,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),o(this,D,er).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),o(this,D,er).call(this),o(this,D,Ge).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let s=o(this,D,Ea).call(this,t);o(this,D,er).call(this,s>=0?s:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?o(this,D,$t).call(this,this._active):o(this,D,Ge).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?o(this,D,$t).call(this,this._active):o(this,D,Ge).call(this,-1);break;case"Home":e.preventDefault(),o(this,D,Ge).call(this,"first");break;case"End":e.preventDefault(),o(this,D,Ge).call(this,"last");break;case"PageDown":e.preventDefault(),o(this,D,Ge).call(this,10);break;case"PageUp":e.preventDefault(),o(this,D,Ge).call(this,-10);break;case"Enter":e.preventDefault(),o(this,D,$t).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),o(this,D,Ut).call(this);break;case"Tab":o(this,D,$t).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,xe)&&Date.now()-r(this,Wt)<500){let s=o(this,D,Ea).call(this," ");s>=0&&(this._active=s)}else o(this,D,$t).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let s=o(this,D,Ea).call(this,t);s>=0&&(this._active=s)}}});h(this,ir,e=>{this.open&&!e.composedPath().includes(this)&&o(this,D,Ut).call(this)});h(this,_a,()=>{this.disabled||(this.open?o(this,D,Ut).call(this):o(this,D,er).call(this))});h(this,za,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),o(this,D,uo).call(this),r(this,tr).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,ir),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,tr).disconnect(),document.removeEventListener("pointerdown",r(this,ir),!0)}get form(){return r(this,me).form}get validity(){return r(this,me).validity}get validationMessage(){return r(this,me).validationMessage}checkValidity(){return r(this,me).checkValidity()}reportValidity(){return r(this,me).reportValidity()}formResetCallback(){this.value=r(this,Kt),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){r(this,Kt)||f(this,Kt,this.value)}updated(e){r(this,me).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,me).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,me).setValidity({valueMissing:!0},this.t("required"),t):r(this,me).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,V)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(d=>d.value===this.value),s=[this.error&&`${r(this,V)}-err`,this.helpText&&`${r(this,V)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label");return n`<div class="field">
|
|
207
|
+
${this.label?n`<span class="label" id="${r(this,V)}-l" part="label" @click=${r(this,za)}>${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
189
208
|
<div class="wrap">
|
|
190
209
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
191
|
-
aria-labelledby=${this.label?`${r(this,
|
|
192
|
-
aria-label=${!this.label&&
|
|
193
|
-
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
194
|
-
aria-activedescendant=${this.open&&this._active>=0?`${r(this,
|
|
210
|
+
aria-labelledby=${this.label?`${r(this,V)}-l`:c}
|
|
211
|
+
aria-label=${!this.label&&l?l:c}
|
|
212
|
+
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,V)}-list"
|
|
213
|
+
aria-activedescendant=${this.open&&this._active>=0?`${r(this,V)}-o${this._active}`:c}
|
|
195
214
|
aria-required=${this.required?"true":c} aria-invalid=${this.error?"true":c}
|
|
196
215
|
aria-disabled=${this.disabled?"true":c} aria-describedby=${s||c}
|
|
197
|
-
@click=${r(this,
|
|
198
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,
|
|
216
|
+
@click=${r(this,_a)} @keydown=${r(this,Ma)} @blur=${()=>o(this,D,Ut).call(this)}>
|
|
217
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,V)}-v">${t?t.label:this.placeholder}</span>
|
|
199
218
|
<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>
|
|
200
219
|
</div>
|
|
201
|
-
<ul role="listbox" id="${r(this,
|
|
202
|
-
aria-label=${!this.label&&
|
|
220
|
+
<ul role="listbox" id="${r(this,V)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,V)}-l`:c}
|
|
221
|
+
aria-label=${!this.label&&l?l:c} ?hidden=${!this.open}
|
|
203
222
|
@pointerdown=${d=>d.preventDefault()}>
|
|
204
|
-
${e.map((d,p)=>n`<li role="option" id="${r(this,
|
|
223
|
+
${e.map((d,p)=>n`<li role="option" id="${r(this,V)}-o${p}" class=${p===this._active?"active":""}
|
|
205
224
|
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":c}
|
|
206
|
-
@pointerenter=${()=>!d.disabled&&(this._active=p)} @click=${()=>
|
|
225
|
+
@pointerenter=${()=>!d.disabled&&(this._active=p)} @click=${()=>o(this,D,$t).call(this,p)}>${d.label}</li>`)}
|
|
207
226
|
</ul>
|
|
208
227
|
</div>
|
|
209
|
-
${this.error?n`<p class="error" id="${r(this,
|
|
210
|
-
${this.helpText?n`<p class="help" id="${r(this,
|
|
228
|
+
${this.error?n`<p class="error" id="${r(this,V)}-err" role="alert">${this.error}</p>`:c}
|
|
229
|
+
${this.helpText?n`<p class="help" id="${r(this,V)}-help">${this.helpText}</p>`:c}
|
|
211
230
|
<slot></slot>
|
|
212
|
-
</div>`}};
|
|
231
|
+
</div>`}};me=new WeakMap,V=new WeakMap,Kt=new WeakMap,xe=new WeakMap,Wt=new WeakMap,tr=new WeakMap,D=new WeakSet,uo=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>({value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled})),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",f(this,Kt,this.value))},bo=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},er=function(e){if(this.disabled)return;let t=this.items.findIndex(s=>s.value===this.value);this.open=!0,this._active=e??(t>=0?t:o(this,D,bo).call(this)[0]??-1)},Ut=function(){this.open=!1},$t=function(e){let t=this.items[e];!t||t.disabled||(o(this,D,Ut).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}))))},Ge=function(e){let t=o(this,D,bo).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 s=t.indexOf(this._active);this._active=s<0?t[0]:t[Math.min(t.length-1,Math.max(0,s+e))]},Ea=function(e){let t=Date.now();f(this,xe,t-r(this,Wt)>500?e:r(this,xe)+e),f(this,Wt,t);let s=this.items,l=this._active<0?0:this._active,d=r(this,xe).split("").every(v=>v===r(this,xe)[0]),p=d?r(this,xe)[0]:r(this,xe),u=d||r(this,xe).length===1?l+1:l;for(let v=0;v<s.length;v++){let $=(u+v)%s.length;if(!s[$].disabled&&s[$].label.toLowerCase().startsWith(p.toLowerCase()))return $}return-1},Ma=new WeakMap,ir=new WeakMap,_a=new WeakMap,za=new WeakMap,Xe.formAssociated=!0,Xe.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Xe.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},_active:{state:!0},_slotted:{state:!0}},Xe.styles=[g,m`
|
|
213
232
|
:host { display: block; position: relative; }
|
|
214
233
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
215
234
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); cursor: default; }
|
|
@@ -246,16 +265,16 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
246
265
|
slot { display: none; }
|
|
247
266
|
@media (max-width: 640px) { [role='option'] { font-size: 14px; min-height: 30px; padding-inline: var(--cm-space-15); } }
|
|
248
267
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
249
|
-
`];
|
|
268
|
+
`];b("cm-select",Xe);var Ep=w("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),Gt,Sa,sr,G,Yt,Zl,Ql,fo,Je=class extends y{constructor(){super(...arguments);h(this,G);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;h(this,Gt,this.attachInternals());h(this,Sa,S("cm-search"));h(this,sr,"")}connectedCallback(){super.connectedCallback(),f(this,sr,this.value)}get form(){return r(this,Gt).form}checkValidity(){return r(this,Gt).checkValidity()}formResetCallback(){this.value=r(this,sr)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,Gt).setFormValue(this.value)}render(){let e=this.size==="large";return n`<div class="box" part="box">
|
|
250
269
|
<cm-icon class="icon" name="search" size=${e?16:14}></cm-icon>
|
|
251
|
-
<input id=${r(this,
|
|
252
|
-
aria-label=${this.label} .value=${
|
|
253
|
-
@input=${
|
|
254
|
-
${this.value&&!this.disabled?n`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${
|
|
270
|
+
<input id=${r(this,Sa)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
271
|
+
aria-label=${this.label} .value=${ne(this.value)} placeholder=${this.placeholder||c} ?disabled=${this.disabled}
|
|
272
|
+
@input=${o(this,G,Zl)} @change=${()=>o(this,G,Yt).call(this,"change")} @keydown=${o(this,G,Ql)} />
|
|
273
|
+
${this.value&&!this.disabled?n`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${o(this,G,fo)}><cm-icon name="close" size="14"></cm-icon></button>`:c}
|
|
255
274
|
${this.filter?n`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
256
275
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
257
|
-
@click=${()=>
|
|
258
|
-
</div>`}};
|
|
276
|
+
@click=${()=>o(this,G,Yt).call(this,"cm-filter")}><cm-icon name="filter" size="18"></cm-icon>${this.filterCount>0?n`<span class="count" aria-hidden="true">${this.filterCount}</span>`:c}</button>`:c}
|
|
277
|
+
</div>`}};Gt=new WeakMap,Sa=new WeakMap,sr=new WeakMap,G=new WeakSet,Yt=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Zl=function(e){this.value=e.target.value},Ql=function(e){e.key==="Enter"?o(this,G,Yt).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),o(this,G,fo).call(this))},fo=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),o(this,G,Yt).call(this,"input"),o(this,G,Yt).call(this,"change")},Je.formAssociated=!0,Je.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Je.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}},Je.styles=[g,m`
|
|
259
278
|
:host { display: block; }
|
|
260
279
|
.box {
|
|
261
280
|
display: flex; align-items: center; gap: var(--cm-space-10); height: 42px; padding: 0 var(--cm-space-10);
|
|
@@ -285,7 +304,19 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
285
304
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
286
305
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
287
306
|
:host([disabled]) button { cursor: not-allowed; }
|
|
288
|
-
`];
|
|
307
|
+
`];b("cm-search",Je);var Ta=m`
|
|
308
|
+
.pop {
|
|
309
|
+
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-10)); inset-inline: 0;
|
|
310
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default);
|
|
311
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100); overflow: hidden;
|
|
312
|
+
}
|
|
313
|
+
.pop[hidden] { display: none; }
|
|
314
|
+
.message { display: flex; align-items: center; gap: var(--cm-space-10); margin: 0; padding: var(--cm-space-15) var(--cm-space-20); font-size: 14px; color: var(--cm-text-tertiary); }
|
|
315
|
+
.vh {
|
|
316
|
+
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
317
|
+
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
318
|
+
}
|
|
319
|
+
`;function La(a,i,e){let t=s=>{i()&&!s.composedPath().includes(a)&&e()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)}var Dp=w("tag",{remove:"Remove {label}"}),Ca,ec,Xt=class extends y{constructor(){super(...arguments);h(this,Ca);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||this.t("remove",{label:this.textContent?.trim()??""}).trim();return n`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?n`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${o(this,Ca,ec)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:c}</span>`}};Ca=new WeakSet,ec=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Xt.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Xt.styles=[g,m`
|
|
289
320
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
290
321
|
.tag {
|
|
291
322
|
display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 26px; padding: 0 var(--cm-space-10);
|
|
@@ -303,13 +334,13 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
303
334
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-default); }
|
|
304
335
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); }
|
|
305
336
|
@media (max-width: 640px) { .tag { height: 22px; } button { width: 18px; height: 18px; } }
|
|
306
|
-
`];
|
|
337
|
+
`];b("cm-tag",Xt);var Jt=class extends y{constructor(){super(...arguments);this.size="large"}render(){let e=this.size==="small"?2.5:3;return n`<span class="spinner" part="spinner" role="status">
|
|
307
338
|
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
308
339
|
<circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
|
|
309
340
|
<path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
|
|
310
341
|
</svg>
|
|
311
342
|
<span class="vh">${this.accessibleLabel||this.t("loading")}</span>
|
|
312
|
-
</span>`}};
|
|
343
|
+
</span>`}};Jt.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},Jt.styles=[g,m`
|
|
313
344
|
:host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
|
|
314
345
|
.spinner { display: inline-flex; }
|
|
315
346
|
svg { inline-size: 44px; block-size: 44px; animation: spin 0.8s linear infinite; }
|
|
@@ -322,42 +353,42 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
322
353
|
}
|
|
323
354
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
324
355
|
@media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
|
|
325
|
-
`];
|
|
326
|
-
`):[]:this.value=e)}get items(){return this.options?.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let s=t.label.toLowerCase();return this.filter==="starts-with"?s.startsWith(e):s.includes(e)})}firstUpdated(){
|
|
327
|
-
`))}else r(this,
|
|
328
|
-
${this.label?n`<label class="label" id="${r(this,
|
|
356
|
+
`];b("cm-spinner",Jt);var Kp=w("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."}),ee,U,lr,ei,cr,dr,E,go,rr,Aa,ar,Zt,Qt,Ze,tc,nr,vo,xo,or,Da,Na,Ra,ic,Qe=class extends y{constructor(){super(...arguments);h(this,E);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this._query="";this._active=-1;this._slotted=[];this._typing=!1;h(this,ee,this.attachInternals());h(this,U,S("cm-cb"));h(this,lr,null);h(this,ei,new Map);h(this,cr,new MutationObserver(()=>o(this,E,go).call(this)));h(this,dr);h(this,Da,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,o(this,E,Qt).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});h(this,Na,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?o(this,E,nr).call(this,1):(o(this,E,Qt).call(this),e.altKey||o(this,E,nr).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?o(this,E,nr).call(this,-1):(o(this,E,Qt).call(this),o(this,E,nr).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),o(this,E,vo).call(this,this._active)):r(this,E,Aa)&&(e.preventDefault(),o(this,E,xo).call(this,r(this,E,Aa)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),o(this,E,Ze).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",o(this,E,Zt).call(this)));break;case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":o(this,E,Ze).call(this);break;default:}});h(this,Ra,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(o(this,E,Ze).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?o(this,E,rr).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),o(this,E,go).call(this),r(this,cr).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),f(this,dr,La(this,()=>this.open,()=>o(this,E,Ze).call(this)))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,cr).disconnect(),(e=r(this,dr))==null||e.call(this)}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,ee).reportValidity()}formResetCallback(){let e=r(this,lr)??{value:"",values:[]};this.value=e.value,this.values=[...e.values],this._query="",this._typing=!1,this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){typeof e=="string"&&(this.multiple?this.values=e?e.split(`
|
|
357
|
+
`):[]:this.value=e)}get items(){return this.options?.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let s=t.label.toLowerCase();return this.filter==="starts-with"?s.startsWith(e):s.includes(e)})}firstUpdated(){f(this,lr,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,ei).set(t.value,t.label);if((e.has("value")||e.has("options")||e.has("_slotted"))&&!this.multiple&&!this._typing&&(this._query=this.value?o(this,E,rr).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=o(this,E,ar).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let l=new FormData;for(let d of this.values)l.append(this.name,d);r(this,ee).setFormValue(l,this.values.join(`
|
|
358
|
+
`))}else r(this,ee).setFormValue(null);else r(this,ee).setFormValue(this.value||null,this.value);let s=this.multiple?!this.values.length:!this.value;this.error?r(this,ee).setValidity({customError:!0},this.error,t):this.required&&s?r(this,ee).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),t):r(this,ee).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,U)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),o(this,E,Zt).call(this))}render(){let e=o(this,E,ar).call(this),t=[this.error&&`${r(this,U)}-err`,this.helpText&&`${r(this,U)}-help`].filter(Boolean).join(" "),s=this.getAttribute("aria-label"),l=p=>this.multiple?this.values.includes(p):p===this.value,d=this.loading?this.loadingText||this.t("loading"):this.open?e.length?this.t("results",{count:e.length}):this.emptyText||this.t("noResults"):"";return n`<div class="field">
|
|
359
|
+
${this.label?n`<label class="label" id="${r(this,U)}-l" for="${r(this,U)}-in" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</label>`:c}
|
|
329
360
|
<div class="wrap">
|
|
330
|
-
<div class="box" part="box" @click=${p=>{p.target.closest("cm-tag")||
|
|
331
|
-
${this.multiple?this.values.map(p=>n`<cm-tag removable ?disabled=${this.disabled} remove-label=${this.t("remove",{label:
|
|
332
|
-
@cm-remove=${()=>{this.removeValue(p),
|
|
333
|
-
<input id="${r(this,
|
|
334
|
-
.value=${
|
|
361
|
+
<div class="box" part="box" @click=${p=>{p.target.closest("cm-tag")||o(this,E,or).call(this)}}>
|
|
362
|
+
${this.multiple?this.values.map(p=>n`<cm-tag removable ?disabled=${this.disabled} remove-label=${this.t("remove",{label:o(this,E,rr).call(this,p)})}
|
|
363
|
+
@cm-remove=${()=>{this.removeValue(p),o(this,E,or).call(this)}}>${o(this,E,rr).call(this,p)}</cm-tag>`):c}
|
|
364
|
+
<input id="${r(this,U)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
365
|
+
.value=${ne(this._query)} placeholder=${this.multiple&&this.values.length?c:this.placeholder||c}
|
|
335
366
|
aria-label=${!this.label&&s?s:c}
|
|
336
|
-
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
337
|
-
aria-activedescendant=${this.open&&this._active>=0?`${r(this,
|
|
367
|
+
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,U)}-list"
|
|
368
|
+
aria-activedescendant=${this.open&&this._active>=0?`${r(this,U)}-o${this._active}`:c}
|
|
338
369
|
aria-invalid=${this.error?"true":c} aria-describedby=${t||c}
|
|
339
370
|
aria-required=${this.required?"true":c} ?disabled=${this.disabled}
|
|
340
|
-
@input=${r(this,
|
|
341
|
-
@click=${()=>{this.open||
|
|
342
|
-
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?
|
|
371
|
+
@input=${r(this,Da)} @keydown=${r(this,Na)} @blur=${r(this,Ra)}
|
|
372
|
+
@click=${()=>{this.open||o(this,E,Qt).call(this)}} @change=${p=>p.stopPropagation()} />
|
|
373
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?o(this,E,Ze).call(this):(o(this,E,Qt).call(this),o(this,E,or).call(this))}}></cm-icon>
|
|
343
374
|
</div>
|
|
344
375
|
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${p=>p.preventDefault()}>
|
|
345
|
-
<ul role="listbox" id="${r(this,
|
|
346
|
-
aria-labelledby=${this.label?`${r(this,
|
|
376
|
+
<ul role="listbox" id="${r(this,U)}-list" part="listbox" ?hidden=${!e.length}
|
|
377
|
+
aria-labelledby=${this.label?`${r(this,U)}-l`:c} aria-label=${!this.label&&s?s:c}
|
|
347
378
|
aria-multiselectable=${this.multiple?"true":c}>
|
|
348
|
-
${e.map((p,
|
|
349
|
-
aria-selected=${p.create?"false":
|
|
350
|
-
@pointerenter=${()=>!p.disabled&&(this._active=
|
|
351
|
-
${p.create?n`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:p.label})}</span>`:n`${this.multiple?n`<cm-icon class="check" name="check" size="16"></cm-icon>`:c}<span>${
|
|
379
|
+
${e.map((p,u)=>n`<li role="option" id="${r(this,U)}-o${u}" class=${u===this._active?"active":""}
|
|
380
|
+
aria-selected=${p.create?"false":l(p.value)?"true":"false"} aria-disabled=${p.disabled?"true":c}
|
|
381
|
+
@pointerenter=${()=>!p.disabled&&(this._active=u)} @click=${()=>o(this,E,vo).call(this,u)}>
|
|
382
|
+
${p.create?n`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:p.label})}</span>`:n`${this.multiple?n`<cm-icon class="check" name="check" size="16"></cm-icon>`:c}<span>${o(this,E,ic).call(this,p.label)}</span>`}</li>`)}
|
|
352
383
|
</ul>
|
|
353
384
|
${this.loading?n`<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?c:n`<p class="message">${this.emptyText||this.t("noResults")}</p>`}
|
|
354
385
|
</div>
|
|
355
386
|
</div>
|
|
356
387
|
<span class="vh" role="status" aria-live="polite">${d}</span>
|
|
357
|
-
${this.error?n`<p class="error" id="${r(this,
|
|
358
|
-
${this.helpText?n`<p class="help" id="${r(this,
|
|
388
|
+
${this.error?n`<p class="error" id="${r(this,U)}-err" role="alert">${this.error}</p>`:c}
|
|
389
|
+
${this.helpText?n`<p class="help" id="${r(this,U)}-help">${this.helpText}</p>`:c}
|
|
359
390
|
<slot></slot>
|
|
360
|
-
</div>`}};
|
|
391
|
+
</div>`}};ee=new WeakMap,U=new WeakMap,lr=new WeakMap,ei=new WeakMap,cr=new WeakMap,dr=new WeakMap,E=new WeakSet,go=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>({value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled})),!this.hasUpdated){let t=e.filter(s=>s.hasAttribute("selected")).map(s=>s.value);this.multiple&&!this.values.length&&t.length&&(this.values=t),!this.multiple&&!this.value&&t.length&&(this.value=t[0])}},rr=function(e){return this.items.find(t=>t.value===e)?.label??r(this,ei).get(e)??e},Aa=function(){if(!this.allowCustom||!this._typing)return"";let e=this._query.trim();if(!e)return"";let t=e.toLowerCase();return this.items.some(s=>s.label.toLowerCase()===t||s.value.toLowerCase()===t)||(this.multiple?this.values.some(s=>s.toLowerCase()===t):this.value.toLowerCase()===t)?"":e},ar=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,E,Aa);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},Zt=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Qt=function(){this.disabled||(this.open=!0)},Ze=function(){this.open=!1,this._active=-1},tc=function(e=o(this,E,ar).call(this)){return e.flatMap((t,s)=>t.disabled?[]:[s])},nr=function(e){let t=o(this,E,tc).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 s=t.indexOf(this._active);if(s<0){this._active=e>0?t[0]:t[t.length-1];return}this._active=t[(s+e+t.length)%t.length]},vo=function(e){let t=o(this,E,ar).call(this)[e];if(!(!t||t.disabled)){if(t.create){o(this,E,xo).call(this,t.value);return}if(this.multiple){this.values=this.values.includes(t.value)?this.values.filter(s=>s!==t.value):[...this.values,t.value],this._query="",this._typing=!1,this._active=-1,o(this,E,Zt).call(this),o(this,E,or).call(this);return}o(this,E,Ze).call(this),this._typing=!1,this._query=t.label,t.value!==this.value&&(this.value=t.value,o(this,E,Zt).call(this))}},xo=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,ei).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(o(this,E,Ze).call(this),this.value=e,this._typing=!1,this._query=e),o(this,E,Zt).call(this))},or=function(){this.renderRoot.querySelector("input")?.focus()},Da=new WeakMap,Na=new WeakMap,Ra=new WeakMap,ic=function(e){let t=this._typing?this._query.trim():"";if(!t||this.filter==="none")return e;let s=e.toLowerCase().indexOf(t.toLowerCase());return s<0||this.filter==="starts-with"&&s!==0?e:n`${e.slice(0,s)}<mark>${e.slice(s,s+t.length)}</mark>${e.slice(s+t.length)}`},Qe.formAssociated=!0,Qe.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Qe.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},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},_query:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},Qe.styles=[g,Ta,m`
|
|
361
392
|
:host { display: block; position: relative; }
|
|
362
393
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
363
394
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -379,12 +410,6 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
379
410
|
:host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
|
|
380
411
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); cursor: not-allowed; }
|
|
381
412
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
382
|
-
.pop {
|
|
383
|
-
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-10)); inset-inline: 0;
|
|
384
|
-
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default);
|
|
385
|
-
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100); overflow: hidden;
|
|
386
|
-
}
|
|
387
|
-
.pop[hidden] { display: none; }
|
|
388
413
|
[role='listbox'] { max-height: 242px; overflow-y: auto; margin: 0; padding: var(--cm-space-10) 0; list-style: none; }
|
|
389
414
|
[role='listbox'][hidden] { display: none; }
|
|
390
415
|
[role='option'] {
|
|
@@ -400,30 +425,102 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
400
425
|
[role='option'][aria-disabled='true'] { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
401
426
|
[role='option'] mark { background: none; color: inherit; font-weight: 600; }
|
|
402
427
|
.create { font-style: normal; }
|
|
403
|
-
.message { display: flex; align-items: center; gap: var(--cm-space-10); margin: 0; padding: var(--cm-space-15) var(--cm-space-20); font-size: 14px; color: var(--cm-text-tertiary); }
|
|
404
|
-
.vh {
|
|
405
|
-
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
406
|
-
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
407
|
-
}
|
|
408
428
|
.help, .error { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
409
429
|
.error { color: var(--cm-text-critical); }
|
|
410
430
|
slot { display: none; }
|
|
411
431
|
@media (max-width: 640px) { [role='option'] { font-size: 14px; min-height: 30px; padding-inline: var(--cm-space-15); } }
|
|
412
432
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
413
|
-
`];
|
|
414
|
-
|
|
433
|
+
`];b("cm-combobox",Qe);var em=w("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),ue,hr,I,Ia,Ha,ti,yo,Oa,sc,qa,pr,$o,rc,wt=class extends y{constructor(){super(...arguments);h(this,I);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;h(this,ue,S("cm-gs"));h(this,hr);h(this,Oa,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),o(this,I,yo).call(this)});h(this,qa,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),o(this,I,sc).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,I,Ha)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,ue)}-o${this._active}`)?.click());break;case"Escape":r(this,I,Ha)?(e.preventDefault(),e.stopPropagation(),o(this,I,ti).call(this)):this.value&&(e.preventDefault(),o(this,I,$o).call(this,!1));break;case"Tab":o(this,I,ti).call(this);break;default:}});h(this,pr,e=>{if(!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented)return;let t=e.composedPath()[0];t&&(t.isContentEditable||/^(input|textarea|select)$/i.test(t.localName??""))||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),f(this,hr,La(this,()=>this.open,()=>o(this,I,ti).call(this))),document.addEventListener("keydown",r(this,pr))}disconnectedCallback(){var e;super.disconnectedCallback(),(e=r(this,hr))==null||e.call(this),document.removeEventListener("keydown",r(this,pr))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=o(this,I,Ia).call(this).length&&(this._active=-1)}updated(e){(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,ue)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=o(this,I,Ia).call(this),t=r(this,I,Ha),s=e.filter(v=>v.item).length,l=this.loading&&t?this.loadingText:t?e.length?this.t("results",{count:s}):this.emptyText:"",d=-1,p=(this.results??[]).filter(v=>v?.items?.length),u=(v,$,x="")=>{d++;let T=d;return n`<a role="option" id="${r(this,ue)}-o${T}" class="${x}${T===this._active?" active":""}" href=${v.href} tabindex="-1"
|
|
434
|
+
aria-selected=${T===this._active?"true":"false"} @pointerenter=${()=>this._active=T}
|
|
435
|
+
@click=${M=>o(this,I,rc).call(this,M,v)}>${$}</a>`};return n`<div class="wrap">
|
|
436
|
+
<div class="box" part="box" @click=${v=>{v.target===v.currentTarget&&this.focus()}}>
|
|
437
|
+
<cm-icon class="icon" name="search" size="14"></cm-icon>
|
|
438
|
+
<input id="${r(this,ue)}-in" part="input" type="search" role="combobox" enterkeyhint="search" autocomplete="off" spellcheck="false"
|
|
439
|
+
aria-label=${this.label} placeholder=${this.placeholder||c} .value=${ne(this.value)}
|
|
440
|
+
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,ue)}-list"
|
|
441
|
+
aria-activedescendant=${t&&this._active>=0?`${r(this,ue)}-o${this._active}`:c}
|
|
442
|
+
aria-keyshortcuts=${this.shortcut||c}
|
|
443
|
+
@input=${r(this,Oa)} @keydown=${r(this,qa)}
|
|
444
|
+
@focus=${()=>{this.value.trim()&&(this.open=!0)}} @click=${()=>{this.value.trim()&&(this.open=!0)}} />
|
|
445
|
+
${this.value?n`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>o(this,I,$o).call(this)}><cm-icon name="close" size="14"></cm-icon></button>`:this.shortcut?n`<kbd aria-hidden="true">${this.shortcut}</kbd>`:c}
|
|
446
|
+
</div>
|
|
447
|
+
<div class="pop" part="popover" ?hidden=${!t} @pointerdown=${v=>v.preventDefault()}>
|
|
448
|
+
<div role="listbox" id="${r(this,ue)}-list" part="listbox" aria-label=${this.label} ?hidden=${!e.length}>
|
|
449
|
+
${p.map((v,$)=>{let x=v.total??v.items.length;return n`<div role="group" aria-labelledby="${r(this,ue)}-g${$}">
|
|
450
|
+
<div role="presentation" class="gh" id="${r(this,ue)}-g${$}"><span>${v.label}</span><span class="count" aria-hidden="true">${this.formatNumber(x)}</span><span class="vh">, ${this.t("results",{count:x})}</span></div>
|
|
451
|
+
${v.items.map(T=>u({group:v,item:T,href:T.href},n`${T.icon?n`<cm-icon name=${T.icon} size="16"></cm-icon>`:c}<span class="text"><span class="title">${T.title}</span>${T.description?n`<span class="vh">, </span><span class="desc">${T.description}</span>`:c}</span>`))}
|
|
452
|
+
${v.href?u({group:v,href:v.href},n`<span class="text">${v.seeAllLabel||this.seeAllLabel}</span>`,"all"):c}
|
|
453
|
+
</div>`})}
|
|
454
|
+
</div>
|
|
455
|
+
${this.loading?n`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText}</span></p>`:e.length?c:n`<p class="message" aria-hidden="true">${this.emptyText}</p>`}
|
|
456
|
+
</div>
|
|
457
|
+
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
458
|
+
</div>`}};ue=new WeakMap,hr=new WeakMap,I=new WeakSet,Ia=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}]:[]])},Ha=function(){return this.open&&!!this.value.trim()},ti=function(){this.open=!1,this._active=-1},yo=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},Oa=new WeakMap,sc=function(e){let t=o(this,I,Ia).call(this).length;if(!t){this._active=-1;return}this._active<0?this._active=e>0?0:t-1:this._active=(this._active+e+t)%t},qa=new WeakMap,pr=new WeakMap,$o=function(e=!0){this.value="",o(this,I,ti).call(this),e&&this.renderRoot.querySelector("input")?.focus(),o(this,I,yo).call(this)},rc=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(),o(this,I,ti).call(this)},wt.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},wt.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}},wt.styles=[g,Ta,m`
|
|
459
|
+
:host { display: block; position: relative; }
|
|
460
|
+
.wrap { position: relative; }
|
|
461
|
+
.box {
|
|
462
|
+
display: flex; align-items: center; gap: var(--cm-space-10); height: 42px; padding: 0 var(--cm-space-10);
|
|
463
|
+
background: var(--cm-bg-page); color: var(--cm-text-default);
|
|
464
|
+
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
465
|
+
}
|
|
466
|
+
.box:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
467
|
+
.icon { flex: none; color: var(--cm-icon-selected); }
|
|
468
|
+
input {
|
|
469
|
+
flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; outline: none;
|
|
470
|
+
font: inherit; font-size: 14px; color: var(--cm-text-default);
|
|
471
|
+
}
|
|
472
|
+
input::placeholder { color: var(--cm-text-tertiary); }
|
|
473
|
+
input::-webkit-search-cancel-button { display: none; }
|
|
474
|
+
.clear {
|
|
475
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center;
|
|
476
|
+
width: 28px; height: 28px; margin: 0 -4px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
477
|
+
background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
478
|
+
}
|
|
479
|
+
.clear:hover { background: var(--cm-bg-hover); }
|
|
480
|
+
.clear:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
481
|
+
kbd {
|
|
482
|
+
flex: none; min-width: 20px; padding: 0 5px; font: inherit; font-size: 12px; line-height: 18px; text-align: center;
|
|
483
|
+
color: var(--cm-text-tertiary); border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-xs);
|
|
484
|
+
}
|
|
485
|
+
.box:focus-within kbd { display: none; }
|
|
486
|
+
.pop {
|
|
487
|
+
position: var(--cm-global-search-results-position, absolute);
|
|
488
|
+
box-shadow: var(--cm-global-search-results-shadow, var(--cm-shadow-100));
|
|
489
|
+
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
490
|
+
}
|
|
491
|
+
[role='listbox'] { padding-block: 6px; }
|
|
492
|
+
[role='listbox'][hidden] { display: none; }
|
|
493
|
+
[role='group'] + [role='group'] { margin-block-start: 6px; padding-block-start: 6px; border-top: var(--cm-border-1) solid var(--cm-border-default); }
|
|
494
|
+
.gh {
|
|
495
|
+
display: flex; align-items: baseline; gap: var(--cm-space-10); padding: 6px var(--cm-space-20) 2px;
|
|
496
|
+
font-size: 12px; line-height: 16px; font-weight: 600; color: var(--cm-text-default);
|
|
497
|
+
}
|
|
498
|
+
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
499
|
+
[role='option'] {
|
|
500
|
+
display: flex; align-items: center; gap: var(--cm-space-10); min-height: 40px; padding: 6px var(--cm-space-20);
|
|
501
|
+
font-size: 14px; line-height: 20px; color: var(--cm-text-default); text-decoration: none; cursor: pointer;
|
|
502
|
+
}
|
|
503
|
+
[role='option'].active { background: var(--cm-bg-hover); box-shadow: inset 2px 0 0 var(--cm-border-strong); }
|
|
504
|
+
[role='option'].active:dir(rtl) { box-shadow: inset -2px 0 0 var(--cm-border-strong); }
|
|
505
|
+
[role='option'] cm-icon { flex: none; color: var(--cm-icon-selected); }
|
|
506
|
+
.text { flex: 1; min-width: 0; }
|
|
507
|
+
.title, .desc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
508
|
+
.desc { font-size: 12px; line-height: 16px; color: var(--cm-text-tertiary); }
|
|
509
|
+
.all { font-size: 13px; text-decoration: underline; }
|
|
510
|
+
`];b("cm-global-search",wt);var Id=/^(\d{4})-(\d{2})-(\d{2})$/;function z(a){let i=Id.exec(a??"");if(!i)return null;let e=new Date(+i[1],+i[2]-1,+i[3]);return e.getFullYear()===+i[1]&&e.getMonth()===+i[2]-1&&e.getDate()===+i[3]?e:null}var ii=(a,i=2)=>String(a).padStart(i,"0"),ie=a=>`${ii(a.getFullYear(),4)}-${ii(a.getMonth()+1)}-${ii(a.getDate())}`,Hd=()=>ie(new Date),te=(a,i)=>new Date(a.getFullYear(),a.getMonth(),a.getDate()+i);function ke(a,i){let e=new Date(a.getFullYear(),a.getMonth()+i,1),t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return new Date(e.getFullYear(),e.getMonth(),Math.min(a.getDate(),t))}var kt=a=>new Date(a.getFullYear(),a.getMonth(),1),Pa=a=>new Date(a.getFullYear(),a.getMonth()+1,0);var si={fromAttribute:a=>a?a.split(/[\s,]+/).filter(Boolean):[],toAttribute:a=>Array.isArray(a)?a.join(" "):a},mr=a=>Array.isArray(a)?a:typeof a=="string"?si.fromAttribute(a):[];function Ba(a,i){let e=[i,Us(a)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function ja(a){try{let i=new Intl.Locale(a),e=i.getWeekInfo?.()??i.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var ac=new Map;function Fa(a){let i=ac.get(a);if(i)return i;let e=M=>new Intl.DateTimeFormat(a,M),t=e({day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"}),s=e({weekday:"short"}),l=e({weekday:"long"}),d=new Date(2024,0,7),p=t.formatToParts(new Date(2026,10,15)),u=p.filter(M=>M.type==="day"||M.type==="month"||M.type==="year").map(M=>M.type),v=p.map(M=>M.type==="day"?"{d}":M.type==="month"?"{m}":M.type==="year"?"{y}":M.value).join(""),$=(M,C)=>Array.from({length:12},(P,H)=>new Intl.DateTimeFormat(M,{month:C}).format(new Date(2024,H,1)).toLowerCase().replace(/\./g,"")),x=Array.from({length:12},(M,C)=>[...new Set([$(a,"long")[C],$(a,"short")[C],$("en","long")[C],$("en","short")[C]])]),T={short:M=>t.format(M),long:M=>we(M,{weekday:"long",day:"numeric",month:"long",year:"numeric"},a),medium:M=>we(M,{day:"numeric",month:"short",year:"numeric"},a),monthYear:M=>we(M,{month:"long",year:"numeric"},a),day:M=>we(M,{day:"numeric"},a),weekdaysShort:Array.from({length:7},(M,C)=>s.format(te(d,C))),weekdaysLong:Array.from({length:7},(M,C)=>l.format(te(d,C))),pattern:u.length===3?v:"{y}-{m}-{d}",order:u.length===3?u:["year","month","day"],months:x};return ac.set(a,T),T}var Va=(a,i)=>a.pattern.replace(/\{([dmy])\}/g,(e,t)=>i[t]);function Ua(a,i){let e=a.trim().toLowerCase();if(!e)return null;let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);if(t.length!==3)return null;let s,l,d,p=t.findIndex(v=>/\p{L}/u.test(v));if(p>=0){let v=t[p];l=i.months.findIndex(M=>M.some(C=>C===v||v.length>=3&&C.startsWith(v)))+1;let $=t.filter((M,C)=>C!==p);if(!l||$.some(M=>!/^\d+$/.test(M)))return null;let x=$.findIndex(M=>M.length===4),T=x>=0?x:1;s=+$[T],d=+$[1-T],$[T].length<=2&&(s+=2e3)}else{if(t.some(x=>!/^\d+$/.test(x)))return null;let v=t[0].length===4?["year","month","day"]:i.order,$=x=>t[v.indexOf(x)];if(s=+$("year"),l=+$("month"),d=+$("day"),$("year").length<=2)s+=2e3;else if($("year").length!==4)return null}let u=`${ii(s,4)}-${ii(l)}-${ii(d)}`;return z(u)?u:null}function Ka(a,i,e,t){let s=(e.getDay()-t+7)%7;switch(a){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,-s);case"End":return te(e,6-s);case"PageDown":return ke(e,i.shiftKey?12:1);case"PageUp":return ke(e,i.shiftKey?-12:-1);default:return null}}var et=(a,i,e)=>i&&a<i?i:e&&a>e?e:a;function Wa(a){let{fmt:i,firstDay:e,month:t,focus:s,min:l,max:d}=a,p=kt(t),u=(p.getDay()-e+7)%7,v=Pa(t).getDate(),$=[],x=Array(u).fill(null);for(let H=1;H<=v;H++)x.push(new Date(t.getFullYear(),t.getMonth(),H)),x.length===7&&($.push(x),x=[]);x.length&&$.push([...x,...Array(7-x.length).fill(null)]);let T=Array.from({length:7},(H,O)=>(O+e)%7),M=Hd(),C=!!l&&Pa(ke(p,-1))<l,P=!!d&&ke(p,1)>d;return n`<div class="cal-head">
|
|
511
|
+
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${a.previousLabel} ?disabled=${C} @click=${()=>a.onMonth(-1)}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
415
512
|
<h2 id="${a.id}-month" class="cal-title" aria-live="polite">${i.monthYear(t)}</h2>
|
|
416
|
-
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${a.nextLabel} ?disabled=${
|
|
513
|
+
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${a.nextLabel} ?disabled=${P} @click=${()=>a.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
417
514
|
</div>
|
|
418
515
|
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${a.id}-month" @keydown=${a.onKey}>
|
|
419
|
-
<thead><tr>${
|
|
420
|
-
<tbody>${
|
|
421
|
-
tabindex=${
|
|
422
|
-
aria-selected=${
|
|
423
|
-
aria-current=${
|
|
424
|
-
aria-label="${i.long(
|
|
425
|
-
@click=${()=>!
|
|
426
|
-
</table>`}var
|
|
516
|
+
<thead><tr>${T.map(H=>n`<th scope="col" abbr=${i.weekdaysLong[H]}><span aria-hidden="true">${i.weekdaysShort[H]}</span><span class="vh">${i.weekdaysLong[H]}</span></th>`)}</tr></thead>
|
|
517
|
+
<tbody>${$.map(H=>n`<tr>${H.map(O=>{if(!O)return n`<td class="empty"></td>`;let Ht=ie(O),Ot=a.isDisabled(O)||!!l&&O<l||!!d&&O>d,$l=a.mark(O),wl=a.note?.(O);return n`<td class="day ${$l} ${Ht===M?"today":""}" data-date=${Ht}
|
|
518
|
+
tabindex=${Ht===ie(s)?"0":"-1"}
|
|
519
|
+
aria-selected=${$l?"true":"false"} aria-disabled=${Ot?"true":c}
|
|
520
|
+
aria-current=${Ht===M?"date":c}
|
|
521
|
+
aria-label="${i.long(O)}${wl?`, ${wl}`:""}"
|
|
522
|
+
@click=${()=>!Ot&&a.onPick(O)} @pointerenter=${()=>a.onHover?.(O)}><span aria-hidden="true">${i.day(O)}</span></td>`})}</tr>`)}</tbody>
|
|
523
|
+
</table>`}var Ya=m`
|
|
427
524
|
.pop {
|
|
428
525
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-10)); inset-inline-start: 0;
|
|
429
526
|
width: max-content; max-width: calc(100vw - 32px); padding: var(--cm-space-15);
|
|
@@ -455,7 +552,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
455
552
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
456
553
|
}
|
|
457
554
|
@media (max-width: 640px) { .day, .empty { height: 36px; } }
|
|
458
|
-
`;function
|
|
555
|
+
`;function Ga(a,i){if(a.key!=="Tab")return;let e=[...i.querySelectorAll('button:not([disabled]), [role=grid] td[tabindex="0"]')];if(!e.length)return;let t=i.getRootNode(),s=e.indexOf(t.activeElement);a.preventDefault(),e[(s+(a.shiftKey?-1:1)+e.length)%e.length].focus()}var Xa=m`
|
|
459
556
|
:host { display: block; position: relative; }
|
|
460
557
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
461
558
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -486,60 +583,60 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
486
583
|
:host([size='small']) .field { gap: 6px; }
|
|
487
584
|
:host([size='small']) .label { font-size: 12px; }
|
|
488
585
|
:host([size='small']) input { font-size: 14px; }
|
|
489
|
-
`;var
|
|
490
|
-
${this.label?n`<label class="label" for="${r(this,
|
|
586
|
+
`;var hm=w("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."}),ni,K,be,oi,li,it,L,wo,ri,ko,Eo,ai,nc,ur,br,Mo,_o,Ja,Za,Qa,en,tn,fr,tt=class extends y{constructor(){super(...arguments);h(this,L);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.min="";this.max="";this.placeholder="";h(this,ni,"");this.disabledDates=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._text="";this._focus=new Date;h(this,K,this.attachInternals());h(this,be,S("cm-dp"));h(this,oi,null);h(this,li,!1);h(this,it,!1);h(this,Ja,()=>{this.disabled||(this.open?this.open=!1:(o(this,L,br).call(this),this.show()))});h(this,Za,e=>{e.key==="Enter"?o(this,L,br).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),o(this,L,br).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});h(this,Qa,e=>{let t=Ka(de(e,this),e,this._focus,r(this,L,ko));if(t){e.preventDefault(),this._focus=et(t,z(this.min),z(this.max)),f(this,it,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),o(this,L,Mo).call(this,this._focus))});h(this,en,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,o(this,L,_o).call(this);return}Ga(e,e.currentTarget)});h(this,tn,e=>{this._focus=et(ke(this._focus,e),z(this.min),z(this.max))});h(this,fr,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,ni)}set locale(e){let t=r(this,ni);f(this,ni,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,oi)===null&&f(this,oi,this.value),document.addEventListener("pointerdown",r(this,fr),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,fr),!0)}get form(){return r(this,K).form}get validity(){return r(this,K).validity}get validationMessage(){return r(this,K).validationMessage}get valueAsDate(){return z(this.value)}checkValidity(){return r(this,K).checkValidity()}reportValidity(){return r(this,K).reportValidity()}formResetCallback(){this.value=r(this,oi)??"",this._text=o(this,L,ai).call(this,this.value),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(o(this,L,nc).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=z(e);if(!t)return!0;let s=z(this.min),l=z(this.max);return s&&t<s||l&&t>l?!0:mr(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){e.has("value")&&!r(this,li)?this._text=o(this,L,ai).call(this,this.value):e.has("locale")&&z(this.value)&&(this._text=o(this,L,ai).call(this,this.value)),f(this,li,!1)}updated(e){r(this,K).setFormValue(this.value||null,this._text);let t=this.renderRoot.querySelector("input")??void 0,s=z(this.value),l=r(this,L,ri);this.error?r(this,K).setValidity({customError:!0},this.error,t):this._text.trim()&&!s?r(this,K).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,L,Eo)}),t):this.required&&!s?r(this,K).setValidity({valueMissing:!0},this.t("required"),t):s&&z(this.min)&&s<z(this.min)?r(this,K).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:l.medium(z(this.min))}),t):s&&z(this.max)&&s>z(this.max)?r(this,K).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:l.medium(z(this.max))}),t):s&&this.isUnavailable(this.value)?r(this,K).setValidity({customError:!0},this.t("unavailable"),t):r(this,K).setValidity({}),this.open&&r(this,it)&&(f(this,it,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&f(this,it,!1)}render(){let e=r(this,L,ri),t=z(this.value),s=[this.error&&`${r(this,be)}-err`,this.helpText&&`${r(this,be)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",p=kt(this._focus);return n`<div class="field">
|
|
587
|
+
${this.label?n`<label class="label" for="${r(this,be)}-in" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</label>`:c}
|
|
491
588
|
<div class="wrap">
|
|
492
589
|
<div class="box" part="box">
|
|
493
|
-
<input id="${r(this,
|
|
494
|
-
.value=${
|
|
495
|
-
aria-label=${!this.label&&
|
|
590
|
+
<input id="${r(this,be)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
591
|
+
.value=${ne(this._text)} placeholder=${this.placeholder||r(this,L,Eo)}
|
|
592
|
+
aria-label=${!this.label&&l?l:c}
|
|
496
593
|
?required=${this.required} ?disabled=${this.disabled}
|
|
497
594
|
aria-invalid=${this.error?"true":c} aria-describedby=${s||c}
|
|
498
|
-
@input=${
|
|
499
|
-
@change=${()=>
|
|
595
|
+
@input=${u=>{u.stopPropagation(),this._text=u.target.value}}
|
|
596
|
+
@change=${()=>o(this,L,br).call(this)} @keydown=${r(this,Za)} />
|
|
500
597
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
501
598
|
aria-label=${t?this.t(d?"changeFor":"change",{label:d,date:e.long(t)}):this.t(d?"chooseFor":"choose",{label:d})}
|
|
502
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
503
|
-
@click=${r(this,
|
|
599
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,be)}-pop"
|
|
600
|
+
@click=${r(this,Ja)}><cm-icon name="calendar" size="18"></cm-icon></button>
|
|
504
601
|
</div>
|
|
505
|
-
<div class="pop" id="${r(this,
|
|
506
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
507
|
-
${this.open?n`<div class="cal">${
|
|
602
|
+
<div class="pop" id="${r(this,be)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
603
|
+
?hidden=${!this.open} @keydown=${r(this,en)}>
|
|
604
|
+
${this.open?n`<div class="cal">${Wa({id:r(this,be),fmt:e,firstDay:r(this,L,ko),month:p,focus:this._focus,min:z(this.min),max:z(this.max),isDisabled:u=>this.isUnavailable(ie(u)),mark:u=>t&&ie(u)===this.value?"selected":"",onPick:u=>o(this,L,Mo).call(this,u),onKey:r(this,Qa),onMonth:r(this,tn),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:c}
|
|
508
605
|
</div>
|
|
509
606
|
</div>
|
|
510
|
-
${this.error?n`<p class="error" id="${r(this,
|
|
511
|
-
${this.helpText?n`<p class="help" id="${r(this,
|
|
512
|
-
</div>`}};
|
|
513
|
-
.value=${
|
|
514
|
-
aria-label=${
|
|
607
|
+
${this.error?n`<p class="error" id="${r(this,be)}-err" role="alert">${this.error}</p>`:c}
|
|
608
|
+
${this.helpText?n`<p class="help" id="${r(this,be)}-help">${this.helpText}</p>`:c}
|
|
609
|
+
</div>`}};ni=new WeakMap,K=new WeakMap,be=new WeakMap,oi=new WeakMap,li=new WeakMap,it=new WeakMap,L=new WeakSet,wo=function(){return Ba(this,this.locale)},ri=function(){return Fa(r(this,L,wo))},ko=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?ja(r(this,L,wo)):(Math.trunc(e)%7+7)%7},Eo=function(){return Va(r(this,L,ri),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},ai=function(e){let t=z(e);return t?r(this,L,ri).short(t):e},nc=function(){let e=new Date,t=z(this.value)??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=et(t,z(this.min),z(this.max)),f(this,it,!0)},ur=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})))},br=function(){let e=this._text.trim();if(!e){o(this,L,ur).call(this,"");return}let t=Ua(e,r(this,L,ri));t?(o(this,L,ur).call(this,t),this._text=o(this,L,ai).call(this,t)):(f(this,li,!0),o(this,L,ur).call(this,""))},Mo=function(e){let t=ie(e);this.isUnavailable(t)||(this.open=!1,o(this,L,ur).call(this,t),this._text=o(this,L,ai).call(this,t),o(this,L,_o).call(this))},_o=function(){this.renderRoot.querySelector(".trigger")?.focus()},Ja=new WeakMap,Za=new WeakMap,Qa=new WeakMap,en=new WeakMap,tn=new WeakMap,fr=new WeakMap,tt.formAssociated=!0,tt.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},tt.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:si},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_text:{state:!0},_focus:{state:!0}},tt.styles=[g,Xa,Ya,m`.pop { min-width: 0; }`];b("cm-date-picker",tt);var xm=w("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"}),Od={today:["Today",a=>[a,a]],yesterday:["Yesterday",a=>[te(a,-1),te(a,-1)]],"last-7-days":["Last 7 days",a=>[te(a,-6),a]],"last-30-days":["Last 30 days",a=>[te(a,-29),a]],"last-90-days":["Last 90 days",a=>[te(a,-89),a]],"this-month":["This month",a=>[kt(a),a]],"last-month":["Last month",a=>[kt(ke(a,-1)),Pa(ke(a,-1))]]},qd=a=>a.replace(/-([a-z0-9])/g,(i,e)=>e.toUpperCase());function oc(a,i=new Date,e){if(typeof a=="object"&&a)return a;let t=Od[a];if(!t)return null;let s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),[l,d]=t[1](s);return{label:e?.(qd(a))||t[0],start:ie(l),end:ie(d)}}var hi,j,oe,pi,mi,rt,_,zo,ci,So,Ne,sn,De,lc,rn,di,To,cc,an,nn,on,ln,cn,gr,Lo,st=class extends y{constructor(){super(...arguments);h(this,_);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";h(this,hi,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;h(this,j,this.attachInternals());h(this,oe,S("cm-drp"));h(this,pi,null);h(this,mi,!1);h(this,rt,!1);h(this,Ne,"start");h(this,nn,()=>{this.disabled||(this.open?this.open=!1:(o(this,_,di).call(this,"start"),o(this,_,di).call(this,"end"),this.show()))});h(this,on,e=>t=>{t.key==="Enter"?o(this,_,di).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),o(this,_,di).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});h(this,ln,e=>{let t=Ka(de(e,this),e,this._focus,r(this,_,So));if(t){e.preventDefault(),this._focus=et(t,z(this.min),z(this.max)),f(this,rt,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),o(this,_,To).call(this,this._focus))});h(this,cn,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,o(this,_,an).call(this);return}Ga(e,e.currentTarget)});h(this,gr,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,hi)}set locale(e){let t=r(this,hi);f(this,hi,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,pi)||f(this,pi,[this.start,this.end]),document.addEventListener("pointerdown",r(this,gr),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,gr),!0)}get form(){return r(this,j).form}get validity(){return r(this,j).validity}get validationMessage(){return r(this,j).validationMessage}checkValidity(){return r(this,j).checkValidity()}reportValidity(){return r(this,j).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,pi)??["",""],this._startText=o(this,_,De).call(this,this.start),this._endText=o(this,_,De).call(this,this.end),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=z(this.start)?this.start:"",this._draftEnd=z(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=et(z(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),z(this.min),z(this.max)),f(this,Ne,"start"),f(this,rt,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=z(e);if(!t)return!0;let s=z(this.min),l=z(this.max);return s&&t<s||l&&t>l?!0:mr(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,mi)||(e.has("start")&&(this._startText=o(this,_,De).call(this,this.start)),e.has("end")&&(this._endText=o(this,_,De).call(this,this.end))),f(this,mi,!1),e.has("locale")&&(z(this.start)&&(this._startText=o(this,_,De).call(this,this.start)),z(this.end)&&(this._endText=o(this,_,De).call(this,this.end)))}updated(){let e=z(this.start),t=z(this.end),s=new FormData;(this.name||this.startName)&&e&&s.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&s.append(this.endName||`${this.name}-end`,this.end),r(this,j).setFormValue(e||t?s:null,`${this.start}/${this.end}`);let l=this.renderRoot.querySelectorAll("input"),[d,p]=[l[0]??void 0,l[1]??void 0],u=r(this,_,ci),v=z(this.min),$=z(this.max);this.error?r(this,j).setValidity({customError:!0},this.error,d):this._startText.trim()&&!e?r(this,j).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,_,sn)}),d):this._endText.trim()&&!t?r(this,j).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,_,sn)}),p):this.required&&(!e||!t)?r(this,j).setValidity({valueMissing:!0},this.t("required"),e?p:d):e&&t&&t<e?r(this,j).setValidity({badInput:!0},this.t("endBeforeStart"),p):e&&v&&e<v||t&&v&&t<v?r(this,j).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:u.medium(v)}),d):e&&$&&e>$||t&&$&&t>$?r(this,j).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:u.medium($)}),p):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,j).setValidity({customError:!0},this.t("unavailable"),d):r(this,j).setValidity({}),this.open&&r(this,rt)&&(f(this,rt,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,_,ci),t=z(this.start),s=z(this.end),l=[this.error&&`${r(this,oe)}-err`,this.helpText&&`${r(this,oe)}-help`].filter(Boolean).join(" "),d=this.getAttribute("aria-label"),p=this.label||d||"",u=mr(this.presets).map(x=>oc(x,new Date,T=>this.t(T))).filter(x=>!!x),v=r(this,Ne)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(z(this._draftStart))}):this.t("chooseStart"),$=x=>{let T=x==="start"?this._startText:this._endText;return n`<input id="${r(this,oe)}-${x}" type="text" autocomplete="off" spellcheck="false"
|
|
610
|
+
.value=${ne(T)} placeholder=${r(this,_,sn)}
|
|
611
|
+
aria-label=${x==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
515
612
|
?required=${this.required} ?disabled=${this.disabled}
|
|
516
|
-
aria-invalid=${this.error?"true":c} aria-describedby=${
|
|
517
|
-
@input=${M=>{M.stopPropagation();let
|
|
518
|
-
@change=${()=>
|
|
519
|
-
${this.label?n`<span class="label" id="${r(this,
|
|
613
|
+
aria-invalid=${this.error?"true":c} aria-describedby=${l||c}
|
|
614
|
+
@input=${M=>{M.stopPropagation();let C=M.target.value;x==="start"?this._startText=C:this._endText=C}}
|
|
615
|
+
@change=${()=>o(this,_,di).call(this,x)} @keydown=${r(this,on).call(this,x)} />`};return n`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,oe)}-l`:c} aria-label=${!this.label&&d?d:c}>
|
|
616
|
+
${this.label?n`<span class="label" id="${r(this,oe)}-l" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
520
617
|
<div class="wrap">
|
|
521
618
|
<div class="box" part="box">
|
|
522
|
-
${
|
|
619
|
+
${$("start")}<span class="sep" aria-hidden="true">–</span>${$("end")}
|
|
523
620
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
524
621
|
aria-label=${t&&s?this.t(p?"changeFor":"change",{label:p,start:e.long(t),end:e.long(s)}):this.t(p?"chooseFor":"choose",{label:p})}
|
|
525
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
526
|
-
@click=${r(this,
|
|
622
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,oe)}-pop"
|
|
623
|
+
@click=${r(this,nn)}><cm-icon name="calendar" size="18"></cm-icon></button>
|
|
527
624
|
</div>
|
|
528
|
-
<div class="pop" id="${r(this,
|
|
529
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
625
|
+
<div class="pop" id="${r(this,oe)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
626
|
+
?hidden=${!this.open} @keydown=${r(this,cn)}>
|
|
530
627
|
${this.open?n`<div class="body">
|
|
531
|
-
${
|
|
532
|
-
<button type="button" class="preset" aria-pressed=${
|
|
533
|
-
@click=${()=>
|
|
534
|
-
<div class="cal">${
|
|
535
|
-
<p class="status" aria-live="polite">${
|
|
628
|
+
${u.length?n`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${u.map(x=>n`<li>
|
|
629
|
+
<button type="button" class="preset" aria-pressed=${x.start===this.start&&x.end===this.end?"true":"false"}
|
|
630
|
+
@click=${()=>o(this,_,cc).call(this,x)}>${x.label}</button></li>`)}</ul>`:c}
|
|
631
|
+
<div class="cal">${Wa({id:r(this,oe),fmt:e,firstDay:r(this,_,So),month:kt(this._focus),focus:this._focus,min:z(this.min),max:z(this.max),isDisabled:x=>this.isUnavailable(ie(x)),mark:x=>o(this,_,Lo).call(this,x),note:x=>{let T=o(this,_,Lo).call(this,x);return T==="start"?this.t("startNote"):T==="end"?this.t("endNote"):""},onPick:x=>o(this,_,To).call(this,x),onKey:r(this,ln),onMonth:x=>{this._focus=et(ke(this._focus,x),z(this.min),z(this.max))},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:x=>{r(this,Ne)==="end"&&(this._hover=x)}})}
|
|
632
|
+
<p class="status" aria-live="polite">${v}</p>
|
|
536
633
|
</div>
|
|
537
634
|
</div>`:c}
|
|
538
635
|
</div>
|
|
539
636
|
</div>
|
|
540
|
-
${this.error?n`<p class="error" id="${r(this,
|
|
541
|
-
${this.helpText?n`<p class="help" id="${r(this,
|
|
542
|
-
</div>`}};
|
|
637
|
+
${this.error?n`<p class="error" id="${r(this,oe)}-err" role="alert">${this.error}</p>`:c}
|
|
638
|
+
${this.helpText?n`<p class="help" id="${r(this,oe)}-help">${this.helpText}</p>`:c}
|
|
639
|
+
</div>`}};hi=new WeakMap,j=new WeakMap,oe=new WeakMap,pi=new WeakMap,mi=new WeakMap,rt=new WeakMap,_=new WeakSet,zo=function(){return Ba(this,this.locale)},ci=function(){return Fa(r(this,_,zo))},So=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?ja(r(this,_,zo)):(Math.trunc(e)%7+7)%7},Ne=new WeakMap,sn=function(){return Va(r(this,_,ci),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},De=function(e){let t=z(e);return t?r(this,_,ci).short(t):e},lc=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},rn=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,o(this,_,lc).call(this))},di=function(e){let t=(e==="start"?this._startText:this._endText).trim(),s=t?Ua(t,r(this,_,ci)):"";t&&!s&&f(this,mi,!0);let l=e==="start"?[s??"",this.end]:[this.start,s??""];o(this,_,rn).call(this,...l),s&&(e==="start"?this._startText=o(this,_,De).call(this,s):this._endText=o(this,_,De).call(this,s))},To=function(e){let t=ie(e);if(!this.isUnavailable(t)){if(r(this,Ne)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",f(this,Ne,"end"),this._focus=e,f(this,rt,!0);return}this._draftEnd=t,this.open=!1,o(this,_,rn).call(this,this._draftStart,t),o(this,_,an).call(this)}},cc=function(e){this.open=!1,o(this,_,rn).call(this,e.start,e.end),o(this,_,an).call(this)},an=function(){this.renderRoot.querySelector(".trigger")?.focus()},nn=new WeakMap,on=new WeakMap,ln=new WeakMap,cn=new WeakMap,gr=new WeakMap,Lo=function(e){let t=ie(e),s=this._draftStart,l=this._draftEnd||(r(this,Ne)==="end"&&s?ie(this._hover??this._focus):"");return t===s?"start":t===l&&l>s?"end":s&&l&&t>s&&t<l?"in-range":""},st.formAssociated=!0,st.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},st.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:si},isDateDisabled:{attribute:!1},presets:{converter:si},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}},st.styles=[g,Xa,Ya,m`
|
|
543
640
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
544
641
|
input { flex: 0 1 6.6em; }
|
|
545
642
|
:host([size='small']) input { flex-basis: 6.6em; }
|
|
@@ -559,29 +656,29 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
559
656
|
.presets li { flex: 0 0 auto; }
|
|
560
657
|
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
561
658
|
}
|
|
562
|
-
`];
|
|
659
|
+
`];b("cm-date-range-picker",st);var Mm=w("fileUpload",{prompt:"Click here to upload",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"});function Pd(a,i){if(!i.trim())return!0;let e=a.name.toLowerCase(),t=a.type.toLowerCase();return i.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean).some(s=>s.startsWith(".")?e.endsWith(s):s.endsWith("/*")?t.startsWith(s.slice(0,-1)):t===s)}var fe,ge,Re,W,Co,dc,hc,dn,Ao,at=class extends y{constructor(){super(...arguments);h(this,W);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="";h(this,fe,this.attachInternals());h(this,ge,S("cm-fu"));h(this,Re,new Map)}get form(){return r(this,fe).form}get validity(){return r(this,fe).validity}get validationMessage(){return r(this,fe).validationMessage}checkValidity(){return r(this,fe).checkValidity()}reportValidity(){return r(this,fe).reportValidity()}formResetCallback(){this.files=[],this._rejected=""}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,Re).values())URL.revokeObjectURL(e);r(this,Re).clear()}updated(e){if(e.has("files"))for(let[d,p]of r(this,Re))this.files.includes(d)||(URL.revokeObjectURL(p),r(this,Re).delete(d));let t=new FormData;for(let d of this.files)t.append(this.name||"file",d);r(this,fe).setFormValue(this.files.length?t:null);let s=this.renderRoot.querySelector("input")??void 0,l=this.error||this._rejected;l?r(this,fe).setValidity({customError:!0},l,s):this.required&&!this.files.length?r(this,fe).setValidity({valueMissing:!0},this.t("required"),s):r(this,fe).setValidity({})}addFiles(e){let t=[...e],s=[],l=[],d=[];for(let u of t)Pd(u,this.accept)?this.maxSize&&u.size>this.maxSize?(l.push(u),d.push(this.t("tooLarge",{name:u.name,size:o(this,W,Co).call(this,this.maxSize)}))):s.push(u):(l.push(u),d.push(this.t("wrongType",{name:u.name})));let p=this.multiple?[...this.files,...s]:s.slice(-1);!this.multiple&&!s.length&&(p=this.files),this.multiple&&this.maxFiles&&p.length>this.maxFiles&&(l.push(...p.slice(this.maxFiles)),d.push(this.t("tooMany",{max:this.maxFiles})),p=p.slice(0,this.maxFiles)),this._rejected=d.join(". "),l.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:l}})),p!==this.files&&(p.length!==this.files.length||p.some((u,v)=>u!==this.files[v]))&&(this.files=p,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){let e=this.error||this._rejected,t=!this.files.length||this.multiple,s=this.files.length>0;return n`
|
|
563
660
|
${this.label||this.hint?n`<div class="head">
|
|
564
|
-
${this.label?n`<span class="label" id="${r(this,
|
|
565
|
-
${this.hint?n`<span class="hint" id="${r(this,
|
|
661
|
+
${this.label?n`<span class="label" id="${r(this,ge)}-l" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
662
|
+
${this.hint?n`<span class="hint" id="${r(this,ge)}-hint">${this.hint}</span>`:c}
|
|
566
663
|
</div>`:c}
|
|
567
664
|
${s?n`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
568
|
-
${this.files.map(
|
|
569
|
-
${
|
|
570
|
-
${this.disabled?c:n`<button type="button" class="remove" aria-label=${this.t("remove",{name:
|
|
665
|
+
${this.files.map(l=>n`<li class="file">
|
|
666
|
+
${l.type.startsWith("image/")?n`<img src=${o(this,W,dc).call(this,l)} alt=${l.name} />`:n`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${l.name}</span><span class="size">${o(this,W,Co).call(this,l.size)}</span></div>`}
|
|
667
|
+
${this.disabled?c:n`<button type="button" class="remove" aria-label=${this.t("remove",{name:l.name})} @click=${()=>this.removeFile(l)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
571
668
|
</li>`)}
|
|
572
|
-
${t?n`<li>${
|
|
573
|
-
</ul>`:
|
|
574
|
-
${e?n`<p class="msg" id="${r(this,
|
|
575
|
-
`}};
|
|
576
|
-
@dragenter=${()=>
|
|
577
|
-
<input type="file" id=${r(this,
|
|
669
|
+
${t?n`<li>${o(this,W,Ao).call(this,!0)}</li>`:c}
|
|
670
|
+
</ul>`:o(this,W,Ao).call(this,!1)}
|
|
671
|
+
${e?n`<p class="msg" id="${r(this,ge)}-msg" role="alert">${e}</p>`:c}
|
|
672
|
+
`}};fe=new WeakMap,ge=new WeakMap,Re=new WeakMap,W=new WeakSet,Co=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})})},dc=function(e){let t=r(this,Re).get(e);return t||(t=URL.createObjectURL(e),r(this,Re).set(e,t)),t},hc=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},dn=function(e){this.toggleAttribute("data-over",e)},Ao=function(e){let t=[this.hint&&`${r(this,ge)}-hint`,(this.error||this._rejected)&&`${r(this,ge)}-msg`].filter(Boolean).join(" ");return n`<label class="zone ${e?"tile":""}" part="zone"
|
|
673
|
+
@dragenter=${()=>o(this,W,dn).call(this,!0)} @dragleave=${()=>o(this,W,dn).call(this,!1)} @drop=${()=>o(this,W,dn).call(this,!1)}>
|
|
674
|
+
<input type="file" id=${r(this,ge)} accept=${this.accept||c} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
578
675
|
?required=${this.required&&!this.files.length}
|
|
579
|
-
aria-labelledby=${[this.label&&`${r(this,
|
|
676
|
+
aria-labelledby=${[this.label&&`${r(this,ge)}-l`,`${r(this,ge)}-p`].filter(Boolean).join(" ")}
|
|
580
677
|
aria-describedby=${t||c} aria-invalid=${this.error||this._rejected?"true":c}
|
|
581
|
-
@change=${
|
|
678
|
+
@change=${o(this,W,hc)} @cancel=${s=>s.stopPropagation()} />
|
|
582
679
|
<cm-icon name=${e?"plus":"upload"} size=${e?24:38}></cm-icon>
|
|
583
|
-
<span id="${r(this,
|
|
584
|
-
</label>`},
|
|
680
|
+
<span id="${r(this,ge)}-p">${e?this.t("addMore"):this.prompt}</span>
|
|
681
|
+
</label>`},at.formAssociated=!0,at.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},at.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},_rejected:{state:!0}},at.styles=[g,m`
|
|
585
682
|
:host { display: block; }
|
|
586
683
|
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-10); margin-bottom: var(--cm-space-20); }
|
|
587
684
|
.label { font-size: var(--cm-type-heading-sm-size); font-weight: 600; }
|
|
@@ -618,17 +715,17 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
618
715
|
.zone:not(.tile) { min-height: 100px; font-size: 14px; }
|
|
619
716
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
620
717
|
}
|
|
621
|
-
`];
|
|
622
|
-
${this.label?n`<span class="label" id="${r(this,
|
|
718
|
+
`];b("cm-file-upload",at);var Am=w("optionGroup",{required:"Please select one of these options."}),ye,vr,ui,xr,Ee,Do,No,pc,Et=class extends y{constructor(){super(...arguments);h(this,Ee);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];h(this,ye,this.attachInternals());h(this,vr,S("cm-og"));h(this,ui,"");h(this,xr,new MutationObserver(()=>o(this,Ee,Do).call(this)))}connectedCallback(){super.connectedCallback(),o(this,Ee,Do).call(this),r(this,xr).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,xr).disconnect()}get form(){return r(this,ye).form}get validity(){return r(this,ye).validity}get validationMessage(){return r(this,ye).validationMessage}checkValidity(){return r(this,ye).checkValidity()}reportValidity(){return r(this,ye).reportValidity()}formResetCallback(){this.value=r(this,ui)}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,ui)||f(this,ui,this.value)}updated(){r(this,ye).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,ye).setValidity({valueMissing:!0},this.t("required"),e):r(this,ye).setValidity({})}render(){let e=this.items,t=e.findIndex(d=>d.value===this.value&&!d.disabled),s=t>=0?t:e.findIndex(d=>!d.disabled),l=this.getAttribute("aria-label");return n`
|
|
719
|
+
${this.label?n`<span class="label" id="${r(this,vr)}-l" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
623
720
|
<div class="options" part="options" role="radiogroup"
|
|
624
|
-
aria-labelledby=${this.label?`${r(this,
|
|
721
|
+
aria-labelledby=${this.label?`${r(this,vr)}-l`:c} aria-label=${!this.label&&l?l:c}
|
|
625
722
|
aria-required=${this.required?"true":c}>
|
|
626
723
|
${e.map((d,p)=>n`<button type="button" role="radio" part="option" aria-checked=${d.value===this.value?"true":"false"}
|
|
627
724
|
tabindex=${p===s?"0":"-1"} ?disabled=${this.disabled||!!d.disabled}
|
|
628
|
-
@click=${()=>
|
|
725
|
+
@click=${()=>o(this,Ee,No).call(this,p)} @keydown=${u=>o(this,Ee,pc).call(this,u,p)}>${d.label}</button>`)}
|
|
629
726
|
</div>
|
|
630
727
|
<slot></slot>
|
|
631
|
-
`}};
|
|
728
|
+
`}};ye=new WeakMap,vr=new WeakMap,ui=new WeakMap,xr=new WeakMap,Ee=new WeakSet,Do=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>({value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled})),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",f(this,ui,this.value))},No=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}))))},pc=function(e,t){let s=de(e,this),l=this.items.flatMap((u,v)=>u.disabled?[]:[v]),d=l.indexOf(t),p;if(s==="ArrowRight"||e.key==="ArrowDown")p=l[(d+1)%l.length];else if(s==="ArrowLeft"||e.key==="ArrowUp")p=l[(d-1+l.length)%l.length];else if(e.key==="Home")p=l[0];else if(e.key==="End")p=l[l.length-1];else return;e.preventDefault(),p!==void 0&&o(this,Ee,No).call(this,p)},Et.formAssociated=!0,Et.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},Et.styles=[g,m`
|
|
632
729
|
:host { display: block; }
|
|
633
730
|
.label { display: block; margin-bottom: var(--cm-space-20); font-size: var(--cm-type-heading-sm-size); font-weight: 600; }
|
|
634
731
|
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
@@ -649,7 +746,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
649
746
|
.options { gap: var(--cm-space-10); }
|
|
650
747
|
button { height: 42px; padding: 0 var(--cm-space-15); font-size: 14px; }
|
|
651
748
|
}
|
|
652
|
-
`];
|
|
749
|
+
`];b("cm-option-group",Et);var qm=w("pageHeader",{back:"Back to {label}",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),yr,Ro,bi=class extends y{constructor(){super(...arguments);h(this,yr);this.heading="";this.breadcrumbs=[];this.pagination=!1;this.hasPrevious=!1;this.hasNext=!1}render(){let e=Array.isArray(this.breadcrumbs)?this.breadcrumbs:[],t=[...e].reverse().find(s=>s.href);return n`<header part="header">
|
|
653
750
|
<div class="lead">
|
|
654
751
|
${t?n`<a class="back" part="back" href=${t.href} aria-label=${this.t("back",{label:t.label})}><cm-icon name="chevron-left" size="20"></cm-icon></a>`:c}
|
|
655
752
|
<div class="titles">
|
|
@@ -662,12 +759,12 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
662
759
|
</div>
|
|
663
760
|
<div class="actions">
|
|
664
761
|
${this.pagination?n`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
665
|
-
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>
|
|
666
|
-
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>
|
|
762
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>o(this,yr,Ro).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
763
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>o(this,yr,Ro).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
667
764
|
</div>`:c}
|
|
668
765
|
<slot name="actions"></slot>
|
|
669
766
|
</div>
|
|
670
|
-
</header>`}};
|
|
767
|
+
</header>`}};yr=new WeakSet,Ro=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},bi.properties={heading:{},breadcrumbs:{type:Array},pagination:{type:Boolean,reflect:!0},hasPrevious:{type:Boolean,attribute:"has-previous"},hasNext:{type:Boolean,attribute:"has-next"}},bi.styles=[g,m`
|
|
671
768
|
:host { display: block; }
|
|
672
769
|
header {
|
|
673
770
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-20);
|
|
@@ -708,7 +805,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
708
805
|
h1 { font-size: 18px; font-weight: 600; }
|
|
709
806
|
.actions { gap: var(--cm-space-10); }
|
|
710
807
|
}
|
|
711
|
-
`];
|
|
808
|
+
`];b("cm-page-header",bi);var Km=w("actionBar",{label:"Actions"}),fi=class extends y{constructor(){super(...arguments);this.eyebrow="";this.heading="";this.tone="default";this.sticky=!1;this.label=""}render(){let e=this.tone==="critical";return n`<div class="bar" part="bar" role="region" aria-label=${this.label||this.heading||this.eyebrow||this.t("label")}>
|
|
712
809
|
<div class="lead">
|
|
713
810
|
${e?n`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:c}
|
|
714
811
|
<div class="text">
|
|
@@ -718,7 +815,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
718
815
|
</div>
|
|
719
816
|
</div>
|
|
720
817
|
<div class="actions"><slot name="actions"></slot></div>
|
|
721
|
-
</div>`}};
|
|
818
|
+
</div>`}};fi.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},fi.styles=[g,m`
|
|
722
819
|
:host { display: block; }
|
|
723
820
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
724
821
|
.bar {
|
|
@@ -749,13 +846,13 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
749
846
|
.icon { width: 30px; height: 30px; }
|
|
750
847
|
.actions { gap: var(--cm-space-10); }
|
|
751
848
|
}
|
|
752
|
-
`];
|
|
849
|
+
`];b("cm-action-bar",fi);var Zm=w("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),Me,Mt,$r,X,Io,Ho,Oo,mc,uc,gi=class extends y{constructor(){super(...arguments);h(this,X);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";h(this,Me,null);h(this,Mt,()=>{this.open=!0});h(this,$r,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>o(this,X,Io).call(this))}disconnectedCallback(){super.disconnectedCallback(),o(this,X,Ho).call(this)}updated(e){e.has("form")&&this.isConnected&&o(this,X,Io).call(this)}render(){return n`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
753
850
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
754
851
|
<div class="actions">
|
|
755
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${
|
|
756
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${
|
|
852
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${o(this,X,uc)}>${this.discardLabel}</cm-button>
|
|
853
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${o(this,X,mc)}>${this.saveLabel}</cm-button>
|
|
757
854
|
</div>
|
|
758
|
-
</div>`}};
|
|
855
|
+
</div>`}};Me=new WeakMap,Mt=new WeakMap,$r=new WeakMap,X=new WeakSet,Io=function(){o(this,X,Ho).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(f(this,Me,e),e.addEventListener("input",r(this,Mt)),e.addEventListener("change",r(this,Mt)),e.addEventListener("reset",r(this,$r)))},Ho=function(){let e=r(this,Me);e&&(e.removeEventListener("input",r(this,Mt)),e.removeEventListener("change",r(this,Mt)),e.removeEventListener("reset",r(this,$r)),f(this,Me,null))},Oo=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},mc=function(){this.loading||this.saveDisabled||o(this,X,Oo).call(this,"cm-save")&&r(this,Me)&&r(this,Me).requestSubmit()},uc=function(){this.loading||o(this,X,Oo).call(this,"cm-discard")&&r(this,Me)&&(r(this,Me).reset(),this.open=!1)},gi.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:{}},gi.styles=[g,m`
|
|
759
856
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
760
857
|
:host(:not([open])) { display: none; }
|
|
761
858
|
.bar {
|
|
@@ -771,14 +868,14 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
771
868
|
.message { font-size: 14px; font-weight: 500; }
|
|
772
869
|
.actions { gap: var(--cm-space-10); }
|
|
773
870
|
}
|
|
774
|
-
`];
|
|
871
|
+
`];b("cm-save-bar",gi);var vi=class extends k{constructor(){super(...arguments);this.heading="";this.action="";this.actionLabel="";this.headingLevel=2;this._list=!0}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return n`<section part="panel" aria-label=${this.heading||c}>
|
|
775
872
|
${this.heading||this.action?n`<header>
|
|
776
873
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
777
874
|
${this.action?n`<button class="action" type="button" part="action" aria-label=${this.actionLabel||c}
|
|
778
875
|
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:c}
|
|
779
876
|
</header>`:c}
|
|
780
877
|
<div class="items" role=${this._list?"list":c}><slot @slotchange=${t=>{this._list=t.target.assignedElements().every(s=>s.localName==="cm-info-item")}}></slot></div>
|
|
781
|
-
</section>`}};
|
|
878
|
+
</section>`}};vi.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},_list:{state:!0}},vi.styles=[g,m`
|
|
782
879
|
:host { display: block; }
|
|
783
880
|
section {
|
|
784
881
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card);
|
|
@@ -794,7 +891,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
794
891
|
.action:hover { text-decoration: underline; }
|
|
795
892
|
.action:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
796
893
|
.items { display: grid; grid-template-columns: 1fr 1fr; gap: var(--cm-space-15) var(--cm-space-20); }
|
|
797
|
-
`];
|
|
894
|
+
`];b("cm-info-panel",vi);var xi=class extends k{constructor(){super(...arguments);this.label="";this.half=!1}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}render(){return n`<div class="label" part="label">${this.label}</div><div class="value" part="value"><slot></slot></div>`}};xi.properties={label:{},half:{type:Boolean,reflect:!0}},xi.styles=[g,m`
|
|
798
895
|
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
799
896
|
:host([half]) { grid-column: auto; }
|
|
800
897
|
.label { font-size: 16px; }
|
|
@@ -802,16 +899,16 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
802
899
|
display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-10);
|
|
803
900
|
margin-top: 6px; font-size: 16px; font-weight: 500; overflow-wrap: anywhere;
|
|
804
901
|
}
|
|
805
|
-
`];
|
|
902
|
+
`];b("cm-info-item",xi);var _t,yi=class extends k{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;h(this,_t,S("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 n`<div class="wrap" part="accordion">
|
|
806
903
|
<div class="h" role="heading" aria-level=${e}>
|
|
807
|
-
<button type="button" part="toggle" id="${r(this,
|
|
904
|
+
<button type="button" part="toggle" id="${r(this,_t)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,_t)}-body"
|
|
808
905
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
809
906
|
<span>${this.heading}</span>
|
|
810
907
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
811
908
|
</button>
|
|
812
909
|
</div>
|
|
813
|
-
<div class="body" part="body" id="${r(this,
|
|
814
|
-
</div>`}};
|
|
910
|
+
<div class="body" part="body" id="${r(this,_t)}-body" role="region" aria-labelledby="${r(this,_t)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
911
|
+
</div>`}};_t=new WeakMap,yi.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},yi.styles=[g,m`
|
|
815
912
|
:host { display: block; }
|
|
816
913
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
817
914
|
.h { margin: 0; font: inherit; }
|
|
@@ -833,14 +930,14 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
833
930
|
.body { padding: var(--cm-space-15) var(--cm-space-20); border-top: var(--cm-border-1) solid var(--cm-border-default); font-size: 14px; }
|
|
834
931
|
.body[hidden] { display: none; }
|
|
835
932
|
@media (max-width: 640px) { button { min-height: 50px; font-size: 14px; } .chev { width: 28px; height: 28px; } }
|
|
836
|
-
`];
|
|
933
|
+
`];b("cm-accordion",yi);var wi,hn,$i=class extends k{constructor(){super(...arguments);h(this,wi);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="large";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=this.image?n`<img src=${this.image} alt="" part="image">`:this.icon?n`<cm-icon name=${this.icon} size="96"></cm-icon>`:c;return n`<div class="wrap" part="empty-state">
|
|
837
934
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?c:"true"}>
|
|
838
|
-
<slot name="image" @slotchange=${s=>
|
|
935
|
+
<slot name="image" @slotchange=${s=>o(this,wi,hn).call(this,s,"hasImage")}>${t}</slot>
|
|
839
936
|
</div>
|
|
840
937
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
841
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${s=>
|
|
842
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s=>
|
|
843
|
-
</div>`}};
|
|
938
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${s=>o(this,wi,hn).call(this,s,"hasText")}></slot></div>
|
|
939
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s=>o(this,wi,hn).call(this,s,"hasActions")}></slot></div>
|
|
940
|
+
</div>`}};wi=new WeakSet,hn=function(e,t){let s=e.target;this[t]=s.assignedNodes({flatten:!0}).some(l=>l.nodeType===1||l.textContent.trim()),this.requestUpdate()},$i.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0}},$i.styles=[g,m`
|
|
844
941
|
:host { display: block; }
|
|
845
942
|
.wrap {
|
|
846
943
|
display: flex; flex-direction: column; align-items: center; text-align: center;
|
|
@@ -864,7 +961,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
864
961
|
.title { margin-top: 30px; font-size: 14px; }
|
|
865
962
|
.actions { gap: var(--cm-space-10); }
|
|
866
963
|
}
|
|
867
|
-
`];
|
|
964
|
+
`];b("cm-empty-state",$i);var bc={small:34,medium:40,large:50,xlarge:186},ki=class extends k{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=bc[this.size]??bc.large;return n`<span class="bone" part="bone" style="width:${t}px;height:${t}px"></span>`}if(this.variant==="block")return n`<span class="bone block" part="bone"></span>`;let e=Math.max(1,Math.floor(this.lines||1));return n`${Array.from({length:e},(t,s)=>n`<span class="bone line ${e>1&&s===e-1?"short":""}" part="bone"></span>`)}`}};ki.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},ki.styles=[g,m`
|
|
868
965
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
869
966
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
870
967
|
.bone {
|
|
@@ -879,17 +976,17 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
879
976
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
880
977
|
}
|
|
881
978
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
882
|
-
`];
|
|
979
|
+
`];b("cm-skeleton",ki);var Bd=[472,90,90,251],jd=[94,266,134,191,138],Ei=class extends y{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1}render(){let e=t=>t.map(s=>n`<span class="bone" style="height:${s}px"></span>`);return n`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
883
980
|
<span class="sr" role="status">${this.label}</span>
|
|
884
981
|
<div class="page" aria-hidden="true">
|
|
885
982
|
${this.navigation?n`<span class="bone nav"></span>`:c}
|
|
886
983
|
<span class="bone head"></span>
|
|
887
984
|
<div class="body">
|
|
888
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
889
|
-
<div class="col side">${e(
|
|
985
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:Bd)}</div>
|
|
986
|
+
<div class="col side">${e(jd)}</div>
|
|
890
987
|
</div>
|
|
891
988
|
</div>
|
|
892
|
-
</div>`}};
|
|
989
|
+
</div>`}};Ei.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},Ei.styles=[g,m`
|
|
893
990
|
:host { display: block; }
|
|
894
991
|
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-10); }
|
|
895
992
|
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
@@ -913,11 +1010,11 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
913
1010
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
914
1011
|
.head { height: 60px; }
|
|
915
1012
|
}
|
|
916
|
-
`];
|
|
1013
|
+
`];b("cm-skeleton-display",Ei);var Eu=w("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),pn,fc,Mi=class extends y{constructor(){super(...arguments);h(this,pn);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=o(this,pn,fc).call(this);return n`<article part="comment">
|
|
917
1014
|
${e?n`<time class="meta" part="time" datetime=${this.datetime||c}>${e}</time>`:c}
|
|
918
1015
|
<div class="body" part="body"><slot></slot></div>
|
|
919
1016
|
${this.author?n`<div class="meta" part="author">– ${this.author}</div>`:c}
|
|
920
|
-
</article>`}};
|
|
1017
|
+
</article>`}};pn=new WeakSet,fc=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:we(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},Mi.properties={author:{},datetime:{},time:{}},Mi.styles=[g,m`
|
|
921
1018
|
:host { display: block; }
|
|
922
1019
|
article {
|
|
923
1020
|
display: flex; flex-direction: column; gap: 6px; padding: var(--cm-space-10);
|
|
@@ -925,16 +1022,16 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
925
1022
|
}
|
|
926
1023
|
.meta { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
927
1024
|
.body { font-size: 14px; line-height: 16px; overflow-wrap: anywhere; }
|
|
928
|
-
`];
|
|
929
|
-
<div class="title" id="${r(this,
|
|
1025
|
+
`];b("cm-comment",Mi);var wr,mn,gc,_i=class extends y{constructor(){super(...arguments);h(this,mn);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;h(this,wr,S("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 s=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(s)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return n`<section part="comment-box" aria-labelledby="${r(this,wr)}-h">
|
|
1026
|
+
<div class="title" id="${r(this,wr)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
930
1027
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||c} .value=${this.value}
|
|
931
1028
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
932
|
-
@keydown=${
|
|
1029
|
+
@keydown=${o(this,mn,gc)}></textarea>
|
|
933
1030
|
<div class="actions"><cm-button variant="primary" size="large" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
934
1031
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
935
1032
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
936
1033
|
</div>
|
|
937
|
-
</section>`}};
|
|
1034
|
+
</section>`}};wr=new WeakMap,mn=new WeakSet,gc=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},_i.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},_i.styles=[g,m`
|
|
938
1035
|
:host { display: block; }
|
|
939
1036
|
section { display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
940
1037
|
.title { margin: 0; font-size: 20px; font-weight: 600; }
|
|
@@ -955,14 +1052,14 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
955
1052
|
textarea { min-height: 100px; }
|
|
956
1053
|
.actions { justify-content: flex-end; }
|
|
957
1054
|
}
|
|
958
|
-
`];
|
|
1055
|
+
`];b("cm-comment-box",_i);var Cu=w("smartTip",{newTab:"(opens in a new tab)"}),Au=w("smartTips",{heading:"Smart tips",tourAction:"Start"}),zi=class extends y{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 n`<a part="tip" href=${this.href||c} target=${this.target||c} rel=${e?"noopener noreferrer":c}>
|
|
959
1056
|
<span class="text">
|
|
960
1057
|
<span class="title" part="heading">${this.heading}</span>
|
|
961
1058
|
<span class="desc" part="description"><slot></slot></span>
|
|
962
1059
|
${e?n`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">${this.t("newTab")}</span>`:c}
|
|
963
1060
|
</span>
|
|
964
1061
|
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
965
|
-
</a>`}};
|
|
1062
|
+
</a>`}};zi.properties={heading:{},href:{},target:{}},zi.styles=[g,m`
|
|
966
1063
|
:host { display: block; }
|
|
967
1064
|
a {
|
|
968
1065
|
display: flex; align-items: flex-start; gap: var(--cm-space-10); padding: var(--cm-space-20) var(--cm-space-10);
|
|
@@ -979,7 +1076,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
979
1076
|
}
|
|
980
1077
|
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
981
1078
|
a:hover .title { text-decoration: underline; }
|
|
982
|
-
`];
|
|
1079
|
+
`];b("cm-smart-tip",zi);var Si=class extends y{constructor(){super(...arguments);this.tourHeading="";this.headingLevel=2}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return n`<div class="card" part="smart-tips">
|
|
983
1080
|
${this.tourHeading?n`<div class="tour" part="tour">
|
|
984
1081
|
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="18"></cm-icon></span>
|
|
985
1082
|
<span class="tour-text">${this.tourHeading}</span>
|
|
@@ -989,7 +1086,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
989
1086
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
990
1087
|
<div class="list" role="list"><slot></slot></div>
|
|
991
1088
|
</section>
|
|
992
|
-
</div>`}};
|
|
1089
|
+
</div>`}};Si.properties={heading:{string:"heading"},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action",string:"tourAction"},headingLevel:{type:Number,attribute:"heading-level"}},Si.styles=[g,m`
|
|
993
1090
|
:host { display: block; }
|
|
994
1091
|
.card { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
995
1092
|
.tour {
|
|
@@ -1007,24 +1104,24 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
1007
1104
|
letter-spacing: var(--cm-tracking-caps); text-transform: uppercase;
|
|
1008
1105
|
}
|
|
1009
1106
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
1010
|
-
`];
|
|
1107
|
+
`];b("cm-smart-tips",Si);var Ou=w("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"}),Ie,Li,vc,xc,Ti=class extends y{constructor(){super(...arguments);h(this,Li);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;h(this,Ie,S("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)),s=this.total?(t-1)*this.pageSize+1:0,l=Math.min(this.total,t*this.pageSize),d=this.pageSizes??[];return n`
|
|
1011
1108
|
<nav part="bar" aria-label=${this.label}>
|
|
1012
1109
|
${d.length?n`<div class="rows" part="rows">
|
|
1013
|
-
<label for="${r(this,
|
|
1014
|
-
<span class="field"><select id="${r(this,
|
|
1015
|
-
${(d.includes(this.pageSize)?d:[...d,this.pageSize].sort((p,
|
|
1110
|
+
<label for="${r(this,Ie)}-s">${this.t("rows")}</label>
|
|
1111
|
+
<span class="field"><select id="${r(this,Ie)}-s" @change=${o(this,Li,vc)}>
|
|
1112
|
+
${(d.includes(this.pageSize)?d:[...d,this.pageSize].sort((p,u)=>p-u)).map(p=>n`<option value=${p} ?selected=${p===this.pageSize}>${p}</option>`)}
|
|
1016
1113
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
1017
1114
|
</div>`:c}
|
|
1018
|
-
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:s,to:
|
|
1115
|
+
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:s,to:l,total:this.total,resource:this.resourceName}).replace(/\s+/g," ").trim():c}</div>
|
|
1019
1116
|
<div class="pages" part="pages">
|
|
1020
1117
|
<span class="counter">
|
|
1021
|
-
<label for="${r(this,
|
|
1022
|
-
<input id="${r(this,
|
|
1023
|
-
.value=${this._draft??String(t)} aria-describedby="${r(this,
|
|
1118
|
+
<label for="${r(this,Ie)}-p">${this.t("page")}</label>
|
|
1119
|
+
<input id="${r(this,Ie)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1120
|
+
.value=${this._draft??String(t)} aria-describedby="${r(this,Ie)}-of"
|
|
1024
1121
|
@input=${p=>this._draft=p.target.value}
|
|
1025
|
-
@keydown=${
|
|
1122
|
+
@keydown=${o(this,Li,xc)}
|
|
1026
1123
|
@change=${p=>this.goTo(Number(p.target.value))} />
|
|
1027
|
-
<span id="${r(this,
|
|
1124
|
+
<span id="${r(this,Ie)}-of">${this.t("of",{count:e})}</span>
|
|
1028
1125
|
</span>
|
|
1029
1126
|
<span class="arrows">
|
|
1030
1127
|
<button class="prev" type="button" part="previous" aria-label=${this.t("previous")} ?disabled=${t<=1}
|
|
@@ -1034,7 +1131,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
1034
1131
|
</span>
|
|
1035
1132
|
</div>
|
|
1036
1133
|
</nav>
|
|
1037
|
-
`}};
|
|
1134
|
+
`}};Ie=new WeakMap,Li=new WeakSet,vc=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})))},xc=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))},Ti.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}},Ti.styles=[g,m`
|
|
1038
1135
|
:host { display: block; }
|
|
1039
1136
|
nav {
|
|
1040
1137
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 60px; padding: 0 var(--cm-space-20);
|
|
@@ -1068,14 +1165,14 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
1068
1165
|
.arrows { display: contents; }
|
|
1069
1166
|
.prev { order: -1; }
|
|
1070
1167
|
}
|
|
1071
|
-
`];
|
|
1168
|
+
`];b("cm-pagination",Ti);var Uu=w("statusTabs",{label:"Status"}),kr,ve,qo,yc,Po,$c,Ci=class extends y{constructor(){super(...arguments);h(this,ve);this.value="";this.tabs=[];this.controls="";this.size="large";this._slotted=[];h(this,kr,new MutationObserver(()=>o(this,ve,qo).call(this)))}connectedCallback(){super.connectedCallback(),o(this,ve,qo).call(this),r(this,kr).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,kr).disconnect()}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(){if(!("ariaControlsElements"in Element.prototype))return;let e=this.getRootNode(),t=this.controls?e.getElementById?.(this.controls):null;for(let s of this.renderRoot.querySelectorAll("button"))s.ariaControlsElements=t?[t]:null}render(){let e=this.items,t=o(this,ve,yc).call(this,e);return n`
|
|
1072
1169
|
<div class="tabs" part="tabs" role="tablist" aria-label=${this.getAttribute("aria-label")||this.t("label")}>
|
|
1073
|
-
${e.map((s,
|
|
1074
|
-
tabindex=${
|
|
1075
|
-
@click=${()=>
|
|
1170
|
+
${e.map((s,l)=>n`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
1171
|
+
tabindex=${l===t?"0":"-1"} ?disabled=${!!s.disabled}
|
|
1172
|
+
@click=${()=>o(this,ve,Po).call(this,l)} @keydown=${d=>o(this,ve,$c).call(this,d,l)}>${s.label}${s.count!==void 0&&!Number.isNaN(s.count)?n` <span class="count">(</span> ${this.formatNumber(s.count)} <span class="count">)</span>`:c}</button>`)}
|
|
1076
1173
|
</div>
|
|
1077
1174
|
<slot></slot>
|
|
1078
|
-
`}};
|
|
1175
|
+
`}};kr=new WeakMap,ve=new WeakSet,qo=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let s=t.getAttribute("count");return{value:t.value,label:t.label||t.textContent.trim(),count:s===null||s===""?void 0:Number(s),disabled:t.disabled}}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"")},yc=function(e){let t=e.findIndex(s=>s.value===this.value&&!s.disabled);return t>=0?t:e.findIndex(s=>!s.disabled)},Po=function(e){let t=this.items[e];!t||t.disabled||(this.updateComplete.then(()=>{let s=this.renderRoot.querySelectorAll("button")[e];s?.focus(),s?.scrollIntoView?.({block:"nearest",inline:"nearest"})}),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},$c=function(e,t){let s=de(e,this),l=this.items.flatMap((u,v)=>u.disabled?[]:[v]),d=l.indexOf(t),p;if(s==="ArrowRight")p=l[(d+1)%l.length];else if(s==="ArrowLeft")p=l[(d-1+l.length)%l.length];else if(e.key==="Home")p=l[0];else if(e.key==="End")p=l[l.length-1];else return;e.preventDefault(),p!==void 0&&o(this,ve,Po).call(this,p)},Ci.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},_slotted:{state:!0}},Ci.styles=[g,m`
|
|
1079
1176
|
:host { display: block; }
|
|
1080
1177
|
.tabs {
|
|
1081
1178
|
display: flex; gap: 28px; overflow-x: auto; scrollbar-width: thin; padding: 2px 2px 0;
|
|
@@ -1099,20 +1196,20 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
1099
1196
|
@media (max-width: 640px) {
|
|
1100
1197
|
.tabs { gap: 18px; font-size: 14px; }
|
|
1101
1198
|
}
|
|
1102
|
-
`];
|
|
1199
|
+
`];b("cm-status-tabs",Ci);var Zu=w("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),un,Er,He,Bo,wc,kc,Ai=class extends y{constructor(){super(...arguments);h(this,He);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;h(this,un,S("cm-th"));h(this,Er,new MutationObserver(()=>o(this,He,Bo).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),o(this,He,Bo).call(this),r(this,Er).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Er).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 n`
|
|
1103
1200
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":c}
|
|
1104
1201
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
1105
1202
|
${this.selectable?n`<span class="cell" role=${e?"columnheader":c}><span class="check">
|
|
1106
|
-
<input id="${r(this,
|
|
1107
|
-
@change=${
|
|
1203
|
+
<input id="${r(this,un)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
1204
|
+
@change=${o(this,He,kc)} />
|
|
1108
1205
|
<span class="box" aria-hidden="true">${this.indeterminate?n`<span class="dash"></span>`:this.checked?n`<cm-icon name="check" size="14"></cm-icon>`:c}</span>
|
|
1109
1206
|
</span></span>`:c}
|
|
1110
|
-
${t.map(s=>{let
|
|
1111
|
-
aria-sort=${e&&s.sortable?d:c}>${s.sortable?n`<button type="button" class=${
|
|
1112
|
-
name=${
|
|
1207
|
+
${t.map(s=>{let l=this.sort===s.key,d=l?this.direction==="descending"?"descending":"ascending":"none",p=s.hidden?n`<span class="sr">${s.label}</span>`:s.label;return n`<span class="cell" part="cell" data-align=${s.align??"start"} role=${e?"columnheader":c}
|
|
1208
|
+
aria-sort=${e&&s.sortable?d:c}>${s.sortable?n`<button type="button" class=${l?"on":""} @click=${()=>o(this,He,wc).call(this,s)}>${p}${e?c:n`<span class="sr">${l?this.t("sorted",{direction:this.t(d)}):this.t("sortable")}</span>`}<cm-icon
|
|
1209
|
+
name=${l&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:p}</span>`})}
|
|
1113
1210
|
</div>
|
|
1114
1211
|
<slot></slot>
|
|
1115
|
-
`}};
|
|
1212
|
+
`}};un=new WeakMap,Er=new WeakMap,He=new WeakSet,Bo=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"}})},wc=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}))},kc=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}))},Ai.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},_slotted:{state:!0},_inTable:{state:!0}},Ai.styles=[g,m`
|
|
1116
1213
|
:host { display: block; }
|
|
1117
1214
|
slot { display: none; } /* <option> children are column data, not content */
|
|
1118
1215
|
.bar {
|
|
@@ -1142,7 +1239,7 @@ var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(
|
|
|
1142
1239
|
.dash { width: 10px; height: 2px; background: var(--cm-icon-selected); }
|
|
1143
1240
|
input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1144
1241
|
slot { display: none; }
|
|
1145
|
-
`];
|
|
1242
|
+
`];b("cm-table-header",Ai);var ab=w("dataTable",{empty:"No data",sorted:"Sorted by {column}, {direction}"}),Ec=!1,Fd=`
|
|
1146
1243
|
cm-data-table > table { width: 100%; border-collapse: separate; border-spacing: 0; font: inherit; font-size: 14px; line-height: 1.5; color: var(--cm-text-default); }
|
|
1147
1244
|
cm-data-table > table caption { text-align: start; font-weight: 500; font-size: 16px; padding-block-end: var(--cm-space-10); }
|
|
1148
1245
|
cm-data-table > table th { font-size: 12px; font-weight: 400; text-align: start; padding: 7px var(--cm-space-20); background: var(--cm-bg-hover); border-block: var(--cm-border-1) solid var(--cm-border-subtle); white-space: nowrap; }
|
|
@@ -1158,22 +1255,22 @@ cm-data-table > table th > button.cm-sort:hover cm-icon, cm-data-table > table t
|
|
|
1158
1255
|
cm-data-table > table th > button.cm-sort:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1159
1256
|
@media (forced-colors: active) { cm-data-table > table th > button.cm-sort cm-icon { opacity: 1; } }
|
|
1160
1257
|
cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-data-table > table [data-type='money'] { text-align: end; font-variant-numeric: tabular-nums; }
|
|
1161
|
-
`;function
|
|
1258
|
+
`;function Vd(){if(Ec||typeof document>"u")return;Ec=!0;let a=new CSSStyleSheet;a.replaceSync(Fd),document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]}var Ud=a=>(a.align??(a.type==="numeric"||a.type==="money"?"end":"start"))==="end";function Mc(a){if(typeof a=="number")return a;let i=String(a??"").trim(),e=/^\(.*\)$/.test(i)||/^-|^[^\d]*-\s*\d/.test(i),t=i.match(/\d[\d,]*(?:\.\d+)?/);if(!t)return NaN;let s=Number(t[0].replace(/,/g,""));return e?-s:s}var _c=a=>a instanceof Date?a.getTime():typeof a=="number"?a:Date.parse(String(a??"")),zc=new Map;function Kd(a){let i=zc.get(a??"");if(!i){try{i=new Intl.Collator(a,{numeric:!0,sensitivity:"base"})}catch{i=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"})}zc.set(a??"",i)}return i}function Sc(a,i,e,t){let s=l=>l==null||l==="";return s(a)||s(i)?s(a)===s(i)?0:s(a)?1:-1:e==="numeric"||e==="money"?(Mc(a)||0)-(Mc(i)||0):e==="date"?(_c(a)||0)-(_c(i)||0):Kd(t).compare(String(a),String(i))}var Ri,Mr,R,jo,Fo,Tc,Vo,Lc,Cc,bn,Di,Ni=class extends y{constructor(){super(...arguments);h(this,R);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._light=!1;this._announce="";h(this,Ri,!1);h(this,Mr,new MutationObserver(()=>o(this,R,jo).call(this)))}connectedCallback(){super.connectedCallback(),o(this,R,jo).call(this),r(this,Mr).observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Mr).disconnect()}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(l=>l.key===this.sort);if(!t||this.sortMode==="manual")return e;let s=this.direction==="descending"?-1:1;return e.map((l,d)=>[l,d]).sort(([l,d],[p,u])=>{let v=l[t.key],$=p[t.key],x=v==null||v==="",T=$==null||$==="";return x||T?x===T?d-u:x?1:-1:s*Sc(v,$,t.type,this.locale)||d-u}).map(([l])=>l)}updated(e){if(r(this,Ri)&&(e.has("sort")||e.has("direction"))&&this.sort){f(this,Ri,!1);let t=this.columns.find(s=>s.key===this.sort);t&&o(this,R,Fo).call(this,t.label,this.direction)}}render(){let e=n`<span class="sr" role="status">${this._announce}</span>`;if(this._light)return n`<div class="scroll" part="scroll"><slot></slot></div>${e}`;let t=this.columns??[],s=this.sortedRows,l=Math.max(1,t.length),d=!this.loading&&s.length===0;return n`
|
|
1162
1259
|
<div class="scroll" part="scroll" tabindex=${this.stickyHeader||this.stickyFirstColumn?"0":c}
|
|
1163
1260
|
role=${this.stickyHeader||this.stickyFirstColumn?"region":c}
|
|
1164
1261
|
aria-label=${(this.stickyHeader||this.stickyFirstColumn)&&this.caption?this.caption:c}>
|
|
1165
1262
|
<table part="table" aria-busy=${this.loading?"true":"false"}>
|
|
1166
1263
|
${this.caption?n`<caption part="caption">${this.caption}</caption>`:c}
|
|
1167
|
-
<thead><tr>${t.map(p=>{let
|
|
1168
|
-
name=${
|
|
1264
|
+
<thead><tr>${t.map(p=>{let u=this.sort===p.key,v=u?this.direction:"none",$=p.hidden?n`<span class="sr">${p.label}</span>`:p.label;return n`<th scope="col" class=${o(this,R,Di).call(this,p)} aria-sort=${p.sortable?v:c}>${p.sortable?n`<button type="button" class=${u?"on":""} @click=${()=>o(this,R,Cc).call(this,p)}>${$}<cm-icon
|
|
1265
|
+
name=${u&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:$}</th>`})}</tr></thead>
|
|
1169
1266
|
<tbody>
|
|
1170
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>n`<tr>${t.map(p=>n`<td class=${
|
|
1171
|
-
${d?n`<tr class="empty"><td colspan=${
|
|
1267
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>n`<tr>${t.map(p=>n`<td class=${o(this,R,Di).call(this,p)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):s.map(p=>n`<tr part="row">${t.map((u,v)=>v===0?n`<th scope="row" class=${o(this,R,Di).call(this,u)} part="cell">${o(this,R,bn).call(this,p[u.key])}</th>`:n`<td class=${o(this,R,Di).call(this,u)} part="cell">${o(this,R,bn).call(this,p[u.key])}</td>`)}</tr>`)}
|
|
1268
|
+
${d?n`<tr class="empty"><td colspan=${l}><slot name="empty">${this.t("empty")}</slot></td></tr>`:c}
|
|
1172
1269
|
</tbody>
|
|
1173
|
-
${this.totals&&!this.loading&&!d?n`<tfoot><tr part="totals">${t.map(p=>n`<td class=${
|
|
1270
|
+
${this.totals&&!this.loading&&!d?n`<tfoot><tr part="totals">${t.map(p=>n`<td class=${o(this,R,Di).call(this,p)}>${o(this,R,bn).call(this,this.totals[p.key])}</td>`)}</tr></tfoot>`:c}
|
|
1174
1271
|
</table>
|
|
1175
1272
|
</div>${e}
|
|
1176
|
-
`}};
|
|
1273
|
+
`}};Ri=new WeakMap,Mr=new WeakMap,R=new WeakSet,jo=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(Vd(),o(this,R,Tc).call(this))},Fo=function(e,t){this._announce=this.t("sorted",{column:e,direction:this.t(t)})},Tc=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;t&&[...t].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"),o(this,R,Vo).call(this,s),d.addEventListener("click",()=>o(this,R,Lc).call(this,e,s,l))})},Vo=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Lc=function(e,t,s){let l=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),d=t.dataset.key||l,p=t.getAttribute("aria-sort")==="ascending"?"descending":"ascending",u=new CustomEvent("cm-sort",{detail:{key:d,direction:p},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(u)||this.sortMode==="manual")return;let v=t.dataset.sort,$=p==="descending"?-1:1;for(let x of e.tBodies){let T=C=>{let P=C.cells[s];return P?(P.dataset.value??P.textContent??"").trim():""},M=[...x.rows].map((C,P)=>[C,T(C),P]).sort(([,C,P],[,H,O])=>C===""||H===""?C===H?P-O:C===""?1:-1:$*Sc(C,H,v,this.locale)||P-O);x.append(...M.map(([C])=>C))}for(let x of e.tHead.rows[0].cells)x.dataset.sort&&(x.setAttribute("aria-sort",x===t?p:"none"),o(this,R,Vo).call(this,x));o(this,R,Fo).call(this,l,p)},Cc=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",s=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),l=this.dispatchEvent(s);f(this,Ri,l),l&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},bn=function(e){return e==null?"":e instanceof Date?we(e,{},this.locale):String(e)},Di=function(e){return`${Ud(e)?"end":""} ${e.type==="numeric"||e.type==="money"?"num":""}`},Ni.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"},_light:{state:!0},_announce:{state:!0}},Ni.styles=[g,m`
|
|
1177
1274
|
:host { display: block; font-size: 14px; line-height: 1.5; }
|
|
1178
1275
|
.scroll { overflow: auto; max-block-size: var(--cm-data-table-max-height, none); }
|
|
1179
1276
|
.scroll:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
@@ -1210,18 +1307,18 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1210
1307
|
.empty td { padding: var(--cm-space-20); border-block-end: 0; }
|
|
1211
1308
|
.light { display: contents; }
|
|
1212
1309
|
@media (forced-colors: active) { button cm-icon { opacity: 1; } }
|
|
1213
|
-
`];
|
|
1214
|
-
aria-expanded=${String(this.open)} aria-controls="${r(this,
|
|
1215
|
-
@click=${r(this,
|
|
1310
|
+
`];b("cm-data-table",Ni);var Ii=class extends k{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1}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}}};Ii.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0}},Ii.styles=m`:host { display: none; }`;b("cm-menu-item",Ii);function _r(a){let i=[];for(let e of Array.from(a.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),s=l=>e.getAttribute(l)||void 0;i.push({label:t,value:s("value")??t,icon:s("icon"),href:s("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0})}else e.localName==="hr"&&i.push({divider:!0});return i}function fn(a,i){let e=new MutationObserver(i);return e.observe(a,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var fb=w("actionMenu",{label:"Actions"}),zr,qi,zt,Sr,N,gn,Tr,Uo,vn,xn,yn,Lr,Cr,Hi,$n,Ac,Dc,Oi=class extends y{constructor(){super(...arguments);h(this,N);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this._slotted=[];this._active=-1;this._custom=!1;h(this,zr);h(this,qi,S("cm-menu"));h(this,zt,"");h(this,Sr,0);h(this,Tr,e=>{this.open&&!e.composedPath().includes(this)&&o(this,N,xn).call(this,!1)});h(this,Lr,e=>{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))});h(this,Cr,()=>{this.open?this.hide():this.show()});h(this,$n,e=>{let t=o(this,N,vn).call(this),s=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),o(this,N,Hi).call(this,t[(s+1)%t.length]);break;case"ArrowUp":e.preventDefault(),o(this,N,Hi).call(this,t[(s-1+t.length)%t.length]);break;case"Home":e.preventDefault(),o(this,N,Hi).call(this,t[0]);break;case"End":e.preventDefault(),o(this,N,Hi).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 l=Date.now();f(this,zt,(l-r(this,Sr)<600?r(this,zt):"")+e.key.toLowerCase()),f(this,Sr,l);let d=this.menuItems,p=r(this,zt).length>1?s:s+1,v=[...t.slice(Math.max(p,0)),...t.slice(0,Math.max(p,0))].find($=>(d[$].label??"").toLowerCase().startsWith(r(this,zt)));v!==void 0&&o(this,N,Hi).call(this,v)}}})}connectedCallback(){super.connectedCallback(),o(this,N,gn).call(this),f(this,zr,fn(this,()=>o(this,N,gn).call(this))),document.addEventListener("pointerdown",r(this,Tr),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,zr)?.disconnect(),document.removeEventListener("pointerdown",r(this,Tr),!0)}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=o(this,N,vn).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,o(this,N,xn).call(this,!0),this.updateComplete.then(()=>o(this,N,yn).call(this))}hide(e=!1){o(this,N,xn).call(this,!1),e&&o(this,N,Uo).call(this)?.focus()}updated(e){if(this._custom){let t=o(this,N,Uo).call(this);if(t){let s=(l,d)=>{t.getAttribute(l)!==d&&t.setAttribute(l,d)};s("aria-haspopup","menu"),s("aria-expanded",String(this.open)),s("aria-controls",`${r(this,qi)}-m`)}}if(e.has("open")&&this.open&&this._active<0){let t=o(this,N,vn).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>o(this,N,yn).call(this))}}render(){let e=this.menuItems,t=this.triggerLabel||this.label,s=this._custom?n`<slot name="trigger" @click=${r(this,Cr)} @keydown=${r(this,Lr)} @slotchange=${()=>o(this,N,gn).call(this)}></slot>`:n`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
1311
|
+
aria-expanded=${String(this.open)} aria-controls="${r(this,qi)}-m" aria-label=${this.iconOnly?t:c}
|
|
1312
|
+
@click=${r(this,Cr)} @keydown=${r(this,Lr)}>${this.iconOnly?n`<cm-icon name=${this.icon} size="18"></cm-icon>`:n`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return n`${s}
|
|
1216
1313
|
<div class="pop" part="menu" ?hidden=${!this.open}>
|
|
1217
1314
|
${this.heading?n`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?n`<span>${this.subheading}</span>`:c}</div>`:c}
|
|
1218
|
-
<div role="menu" id="${r(this,
|
|
1219
|
-
${e.map((
|
|
1315
|
+
<div role="menu" id="${r(this,qi)}-m" aria-label=${this.heading||this.label} @keydown=${r(this,$n)}>
|
|
1316
|
+
${e.map((l,d)=>o(this,N,Dc).call(this,l,d))}
|
|
1220
1317
|
</div>
|
|
1221
1318
|
</div>
|
|
1222
|
-
<slot hidden></slot>`}};
|
|
1223
|
-
@pointerenter=${d.over} @click=${d.click}>${
|
|
1224
|
-
aria-disabled=${e.disabled?"true":c} @pointerenter=${d.over} @click=${d.click}>${
|
|
1319
|
+
<slot hidden></slot>`}};zr=new WeakMap,qi=new WeakMap,zt=new WeakMap,Sr=new WeakMap,N=new WeakSet,gn=function(){this._slotted=_r(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},Tr=new WeakMap,Uo=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},vn=function(){return this.menuItems.map((e,t)=>!e.divider&&!e.disabled?t:-1).filter(e=>e>=0)},xn=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})))},yn=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},Lr=new WeakMap,Cr=new WeakMap,Hi=function(e){this._active=e,this.updateComplete.then(()=>o(this,N,yn).call(this))},$n=new WeakMap,Ac=function(e,t){if(t.disabled){e.preventDefault();return}let s=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));s||e.preventDefault(),this.hide(!t.href||!s)},Dc=function(e,t){if(e.divider)return n`<div role="separator"></div>`;let s=`item${e.critical?" critical":""}${t===this._active?" active":""}`,l=n`${e.icon?n`<cm-icon name=${e.icon} size="16"></cm-icon>`:c}<span>${e.label}</span>`,d={over:()=>{e.disabled||(this._active=t)},click:p=>o(this,N,Ac).call(this,p,e)};return e.href&&!e.disabled?n`<a class=${s} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
1320
|
+
@pointerenter=${d.over} @click=${d.click}>${l}</a>`:n`<button type="button" class=${s} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
1321
|
+
aria-disabled=${e.disabled?"true":c} @pointerenter=${d.over} @click=${d.click}>${l}</button>`},Oi.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:{},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},Oi.styles=[g,m`
|
|
1225
1322
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
1226
1323
|
.trigger {
|
|
1227
1324
|
display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 500;
|
|
@@ -1254,7 +1351,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1254
1351
|
}
|
|
1255
1352
|
.item.active:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 1px; }
|
|
1256
1353
|
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-default); }
|
|
1257
|
-
`];
|
|
1354
|
+
`];b("cm-action-menu",Oi);var kb=w("resourceItem",{select:"Select {name}"}),Eb=w("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}"}),Nc=m`
|
|
1258
1355
|
.check { position: relative; display: inline-flex; flex: none; width: 20px; height: 20px; }
|
|
1259
1356
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
1260
1357
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -1266,9 +1363,9 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1266
1363
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
1267
1364
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1268
1365
|
.check input:disabled + .box { border-color: var(--cm-border-default); background: var(--cm-bg-input-filled); }
|
|
1269
|
-
`,
|
|
1366
|
+
`,kn,En,Rc,Bi=class extends y{constructor(){super();h(this,En);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;h(this,kn,this.attachInternals());r(this,kn).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 n`
|
|
1270
1367
|
${this.href&&!this.disabled?n`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:c}
|
|
1271
|
-
<div class="row" part="row" @click=${
|
|
1368
|
+
<div class="row" part="row" @click=${o(this,En,Rc)}>
|
|
1272
1369
|
${this.selectable?n`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
1273
1370
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
1274
1371
|
<span class="box" aria-hidden="true">${this.selected?n`<cm-icon name="check" size="14"></cm-icon>`:c}</span></span>`:c}
|
|
@@ -1276,7 +1373,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1276
1373
|
<div class="content" part="content"><slot></slot></div>
|
|
1277
1374
|
<div class="actions" part="actions"><slot name="actions"></slot></div>
|
|
1278
1375
|
</div>
|
|
1279
|
-
`}};
|
|
1376
|
+
`}};kn=new WeakMap,En=new WeakSet,Rc=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(s=>s instanceof HTMLElement&&s!==this&&s.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},Bi.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0}},Bi.styles=[g,Nc,m`
|
|
1280
1377
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-default); }
|
|
1281
1378
|
:host(:last-child) { border-bottom: 0; }
|
|
1282
1379
|
.row {
|
|
@@ -1303,29 +1400,29 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1303
1400
|
::slotted([slot='media']) { width: 34px; height: 34px; }
|
|
1304
1401
|
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 34px; }
|
|
1305
1402
|
}
|
|
1306
|
-
`];
|
|
1403
|
+
`];b("cm-resource-item",Bi);var Ar,se,Ic,Pi,wn,Mn,ji=class extends y{constructor(){super();h(this,se);this.selectable=!1;this.total=0;this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this._count=0;this._rows=0;h(this,Ar,S("cm-rl"));h(this,Mn,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,o(this,se,Pi).call(this),o(this,se,wn).call(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),o(this,se,Pi).call(this),o(this,se,wn).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,o(this,se,Pi).call(this),o(this,se,wn).call(this)}clearSelection(){this.selectPage(!1)}updated(e){e.has("selectable")&&o(this,se,Pi).call(this)}render(){let e=this._count,t=this._rows,s=this.items.filter($=>!$.disabled).length,l=s>0&&e>=s,d=o(this,se,Ic).call(this),p=$=>pa($,this.locale)==="one"?this.resourceName:d,u=this.total>t,v=c;return this.allSelected?v=n`${this.t("allSelected",{count:Math.max(this.total,e),resource:d})} <button type="button" @click=${()=>this.clearSelection()}>${this.t("clearSelection")}</button>`:e&&(v=n`${this.t("selected",{count:e,resource:p(e)})}${l&&u?n` <button type="button" @click=${()=>this.selectAll()}>${this.t("selectAll",{count:this.total,resource:d})}</button>`:c}`),n`
|
|
1307
1404
|
${this.selectable?n`<div class="toolbar" part="toolbar">
|
|
1308
1405
|
<span class="select" part="select">
|
|
1309
|
-
<span class="check"><input id="${r(this,
|
|
1310
|
-
?disabled=${!s} @change=${
|
|
1311
|
-
<span class="box" aria-hidden="true">${e>0&&!
|
|
1312
|
-
<label for="${r(this,
|
|
1406
|
+
<span class="check"><input id="${r(this,Ar)}-all" type="checkbox" .checked=${l} .indeterminate=${e>0&&!l}
|
|
1407
|
+
?disabled=${!s} @change=${$=>this.selectPage($.target.checked)} />
|
|
1408
|
+
<span class="box" aria-hidden="true">${e>0&&!l?n`<span class="dash"></span>`:l?n`<cm-icon name="check" size="12"></cm-icon>`:c}</span></span>
|
|
1409
|
+
<label for="${r(this,Ar)}-all">${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:p(t)})}</span></label>
|
|
1313
1410
|
${this.hideSelectMenu?c:n`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")}
|
|
1314
|
-
.items=${[{label:this.t("selectPage",{count:s}),value:"page",disabled:!s},...
|
|
1411
|
+
.items=${[{label:this.t("selectPage",{count:s}),value:"page",disabled:!s},...u?[{label:this.t("selectAll",{count:this.total,resource:d}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${r(this,Mn)}></cm-action-menu>`}
|
|
1315
1412
|
</span>
|
|
1316
1413
|
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
1317
|
-
<span class="status" part="status" role="status">${
|
|
1414
|
+
<span class="status" part="status" role="status">${v}</span>
|
|
1318
1415
|
<span class="actions"><slot name="actions"></slot></span>
|
|
1319
1416
|
</div>`:c}
|
|
1320
|
-
<div class="header"><slot name="header" @slotchange=${
|
|
1417
|
+
<div class="header"><slot name="header" @slotchange=${$=>$.target.parentElement.classList.toggle("has",$.target.assignedElements().length>0)}></slot></div>
|
|
1321
1418
|
<div class="body">
|
|
1322
|
-
<div class="list" part="list" role="list" aria-label=${this.label||d.replace(
|
|
1323
|
-
<slot @slotchange=${()=>
|
|
1419
|
+
<div class="list" part="list" role="list" aria-label=${this.label||d.replace(/^./,$=>$.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
1420
|
+
<slot @slotchange=${()=>o(this,se,Pi).call(this)}></slot>
|
|
1324
1421
|
</div>
|
|
1325
1422
|
${this.loading?n`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:d})}></span>`:c}
|
|
1326
1423
|
</div>
|
|
1327
1424
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
1328
|
-
`}};
|
|
1425
|
+
`}};Ar=new WeakMap,se=new WeakSet,Ic=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},Pi=function(){let e=this.items;e.forEach(t=>t.selectable=this.selectable),this._rows=e.length,this._count=e.filter(t=>t.selected).length},wn=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},Mn=new WeakMap,ji.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:{},_count:{state:!0},_rows:{state:!0}},ji.styles=[g,Nc,m`
|
|
1329
1426
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
1330
1427
|
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-20); padding: var(--cm-space-20) var(--cm-space-20) 0; }
|
|
1331
1428
|
.select {
|
|
@@ -1363,12 +1460,12 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1363
1460
|
.list { padding: 0 var(--cm-space-10); }
|
|
1364
1461
|
.spinner { width: 30px; height: 30px; margin: -15px; border-width: 3px; }
|
|
1365
1462
|
}
|
|
1366
|
-
`];
|
|
1367
|
-
<div class="row" part="row" @dragover=${
|
|
1463
|
+
`];b("cm-resource-list",ji);var Cb=w("nestedItem",{reorder:"Reorder {label}",hint:"Press up or down arrow to move.",moved:"{label} moved to position {position} of {total}."}),Ab=w("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),zn,le,Hc,Oc,qc,Ko,Pc,Oe=class Oe extends y{constructor(){super();h(this,le);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;h(this,zn,this.attachInternals());r(this,zn).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,s=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===s)return!1;let l=new CustomEvent("cm-reorder",{detail:{item:this,from:s,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(l))return!1;let d=t[e];return d.parentElement.insertBefore(this,e>s?d.nextSibling:d),this.closest("cm-nested-list")?.announce(this.t("moved",{label:this.label,position:e+1,total:t.length})),!0}render(){return n`
|
|
1464
|
+
<div class="row" part="row" @dragover=${o(this,le,qc)} @dragleave=${o(this,le,Ko)} @drop=${o(this,le,Pc)}>
|
|
1368
1465
|
${this.sortable?n`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
1369
1466
|
aria-describedby="hint"
|
|
1370
|
-
@keydown=${
|
|
1371
|
-
@dragend=${()=>{this.classList.remove("dragging"),
|
|
1467
|
+
@keydown=${o(this,le,Hc)} @dragstart=${o(this,le,Oc)}
|
|
1468
|
+
@dragend=${()=>{this.classList.remove("dragging"),Oe.dragged=null}}><cm-icon name="drag" size="18"></cm-icon></button>`:c}
|
|
1372
1469
|
${this.sortable?n`<span class="sr" id="hint">${this.t("hint")}</span>`:c}
|
|
1373
1470
|
<span class="label" part="label">${this.label}</span>
|
|
1374
1471
|
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
@@ -1376,7 +1473,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1376
1473
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
1377
1474
|
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(s=>s.localName==="cm-nested-item");t.forEach(s=>s.sortable=this.sortable),this._hasChildren=t.length>0}}></slot>
|
|
1378
1475
|
</div>
|
|
1379
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};
|
|
1476
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};zn=new WeakMap,le=new WeakSet,Hc=function(e){let t=this.siblings.indexOf(this),s;if(e.key==="ArrowUp")s=t-1;else if(e.key==="ArrowDown")s=t+1;else if(e.key==="Home")s=0;else if(e.key==="End")s=this.siblings.length-1;else return;if(e.preventDefault(),this.moveTo(s)){let l=()=>this.renderRoot.querySelector(".handle")?.focus();l(),requestAnimationFrame(l)}},Oc=function(e){e.stopPropagation(),Oe.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},qc=function(e){let t=Oe.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let s=this.renderRoot.querySelector(".row").getBoundingClientRect(),l=e.clientY>s.top+s.height/2;this.classList.toggle("drop-after",l),this.classList.toggle("drop-before",!l)},Ko=function(){this.classList.remove("drop-before","drop-after")},Pc=function(e){let t=Oe.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let s=this.classList.contains("drop-after");o(this,le,Ko).call(this);let l=this.siblings,d=l.indexOf(t),p=l.indexOf(this)+(s?1:0);p>d&&(p-=1),t.moveTo(p)},Oe.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},Oe.styles=[g,m`
|
|
1380
1477
|
:host { display: block; }
|
|
1381
1478
|
.row {
|
|
1382
1479
|
display: flex; align-items: center; gap: var(--cm-space-15); min-height: 60px; padding: 0 var(--cm-space-20);
|
|
@@ -1401,19 +1498,19 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1401
1498
|
.actions { gap: var(--cm-space-10); }
|
|
1402
1499
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
1403
1500
|
}
|
|
1404
|
-
`],
|
|
1501
|
+
`],Oe.dragged=null;var _n=Oe;b("cm-nested-item",_n);var St,Tt,Bc,Wo,Fi=class extends y{constructor(){super(...arguments);h(this,Tt);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this._msg="";h(this,St,S("cm-nl"))}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}updated(e){e.has("sortable")&&o(this,Tt,Wo).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return n`
|
|
1405
1502
|
<div class="bar" part="bar">
|
|
1406
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,
|
|
1503
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,St)}-h">${this.heading}</div>
|
|
1407
1504
|
<span class="actions"><slot name="actions"></slot></span>
|
|
1408
|
-
${this.collapsible?n`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
1409
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${
|
|
1505
|
+
${this.collapsible?n`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,St)}-rows"
|
|
1506
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${o(this,Tt,Bc)}>
|
|
1410
1507
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="14"></cm-icon></button>`:c}
|
|
1411
1508
|
</div>
|
|
1412
|
-
<div class="rows" id="${r(this,
|
|
1413
|
-
<slot @slotchange=${()=>
|
|
1509
|
+
<div class="rows" id="${r(this,St)}-rows" role="list" aria-labelledby="${r(this,St)}-h" ?hidden=${!t}>
|
|
1510
|
+
<slot @slotchange=${()=>o(this,Tt,Wo).call(this)}></slot>
|
|
1414
1511
|
</div>
|
|
1415
1512
|
<span class="sr" role="status">${this._msg}</span>
|
|
1416
|
-
`}};
|
|
1513
|
+
`}};St=new WeakMap,Tt=new WeakSet,Bc=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},Wo=function(){[...this.children].forEach(e=>{e.localName==="cm-nested-item"&&(e.sortable=this.sortable)})},Fi.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"},sortable:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},_msg:{state:!0}},Fi.styles=[g,m`
|
|
1417
1514
|
:host { display: block; }
|
|
1418
1515
|
.bar {
|
|
1419
1516
|
display: flex; align-items: center; gap: var(--cm-space-15); min-height: 90px; padding: 0 var(--cm-space-20);
|
|
@@ -1436,11 +1533,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1436
1533
|
.rows { margin-inline-start: var(--cm-space-10); }
|
|
1437
1534
|
.toggle { width: 30px; height: 30px; }
|
|
1438
1535
|
}
|
|
1439
|
-
`];
|
|
1536
|
+
`];b("cm-nested-list",Fi);var Ob=w("reportTile",{pinned:", pinned"}),Lt=class extends y{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=n`
|
|
1440
1537
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="58"></cm-icon></slot></span>
|
|
1441
1538
|
<span class="label">${this.label}</span>
|
|
1442
1539
|
${this.pinned?n`<span class="pin" part="pin"><cm-icon name="pin" size="18"></cm-icon><span class="sr">${this.t("pinned")}</span></span>`:c}
|
|
1443
|
-
`;return this.href?n`<a class="tile" part="tile" href=${this.href}>${e}</a>`:n`<button class="tile" part="tile" type="button">${e}</button>`}};
|
|
1540
|
+
`;return this.href?n`<a class="tile" part="tile" href=${this.href}>${e}</a>`:n`<button class="tile" part="tile" type="button">${e}</button>`}};Lt.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},Lt.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Lt.styles=[g,m`
|
|
1444
1541
|
:host { display: block; }
|
|
1445
1542
|
.tile {
|
|
1446
1543
|
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-20);
|
|
@@ -1460,10 +1557,10 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1460
1557
|
::slotted([slot='icon']) { width: 38px; height: 38px; }
|
|
1461
1558
|
.pin { top: 8px; inset-inline-end: 8px; }
|
|
1462
1559
|
}
|
|
1463
|
-
`];
|
|
1560
|
+
`];b("cm-report-tile",Lt);var Vi=class extends k{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 n`
|
|
1464
1561
|
${this.heading?n`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:c}
|
|
1465
1562
|
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":c}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
1466
|
-
`}};
|
|
1563
|
+
`}};Vi.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},Vi.styles=[g,m`
|
|
1467
1564
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
1468
1565
|
.title { margin: 0 0 var(--cm-space-20); font-size: 16px; font-weight: 500; }
|
|
1469
1566
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-15); }
|
|
@@ -1473,27 +1570,44 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1473
1570
|
.title { margin-bottom: var(--cm-space-10); font-size: 14px; }
|
|
1474
1571
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-10); }
|
|
1475
1572
|
}
|
|
1476
|
-
`];
|
|
1477
|
-
|
|
1573
|
+
`];b("cm-report-tiles",Vi);var Ui=class extends k{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 jc(this)}};Ui.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}},Ui.styles=m`:host { display: none !important; }`;b("cm-nav-item",Ui);function jc(a){let i=s=>a.getAttribute(s),e={label:i("label")||""};i("icon")&&(e.icon=i("icon")),i("href")&&(e.href=i("href")),i("value")&&(e.value=i("value")),a.hasAttribute("current")&&(e.current=!0),i("badge")&&(e.badge=i("badge")),a.hasAttribute("expanded")&&(e.expanded=!0),a.hasAttribute("primary")&&(e.primary=!0);let t=qe(a);return t.length&&(e.items=t),e}var qe=a=>[...a.children].filter(i=>i.localName==="cm-nav-item").map(jc),Yo=a=>a.value||a.href||a.label,Sn=a=>!!a.current||!!a.items?.some(Sn),nt=(a,i)=>{let e=new MutationObserver(i);return e.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","icon","href","value","current","badge","expanded","primary"]}),e},ot=(a,i)=>a.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:i,value:Yo(i),href:i.href??""}}));var Tn='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',F,Wi,lt,ct,_e,Yi,Gi,ce,Go,Ln,Cn,An,Dn,Xi,Fc,Ct,Xo,Jo,Pe,Ki=class extends k{constructor(){super(...arguments);h(this,ce);this.content="";this.placement="top";this.delay=300;this.open=!1;this.visualOnly=!1;this._side="top";h(this,F);h(this,Wi);h(this,lt,[]);h(this,ct);h(this,_e);h(this,Yi,!1);h(this,Gi,!1);h(this,Ln,()=>{f(this,Yi,!0),clearTimeout(r(this,_e)),this.open||f(this,_e,setTimeout(()=>this.show(),this.delay))});h(this,Cn,()=>{f(this,Yi,!1),clearTimeout(r(this,_e)),r(this,Gi)||f(this,_e,setTimeout(()=>this.hide(),100))});h(this,An,()=>{f(this,Gi,!0),this.show()});h(this,Dn,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(f(this,Gi,!1),r(this,Yi)||this.hide())});h(this,Xi,e=>{e.key==="Escape"&&this.open&&this.hide()});h(this,Ct,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(o(this,ce,Jo).call(this),!t||!this.content||this.visualOnly)return;let s=t.updateComplete;t.localName.includes("-")&&s&&!t.shadowRoot?.querySelector(Tn)&&s.then(()=>{t.shadowRoot?.querySelector(Tn)&&r(this,Ct).call(this)}),r(this,F)||(f(this,F,document.createElement("span")),r(this,F).id=S("cm-tooltip"),r(this,F).hidden=!0,r(this,F).slot="description"),r(this,F).textContent=this.content,r(this,F).isConnected||this.append(r(this,F));let l=o(this,ce,Fc).call(this,t);if(f(this,Wi,l),l.getRootNode()===r(this,F).getRootNode()){let d=(l.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);d.includes(r(this,F).id)||l.setAttribute("aria-describedby",[...d,r(this,F).id].join(" "))}else"ariaDescribedByElements"in l?(o(this,ce,Xo).call(this,l),f(this,ct,new MutationObserver(()=>{l.getAttribute("aria-describedby")!==""&&o(this,ce,Xo).call(this,l)})),r(this,ct).observe(l,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,F).id)});h(this,Pe,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let l=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0]??this).getBoundingClientRect(),d=e.getBoundingClientRect(),p=8,u=8,v=innerWidth,$=innerHeight,x=getComputedStyle(this).direction==="rtl",T=Ot=>Ot==="start"?x?"right":"left":Ot==="end"?x?"left":"right":Ot,M={top:l.top-p-d.height>=u,bottom:l.bottom+p+d.height<=$-u,left:l.left-p-d.width>=u,right:l.right+p+d.width<=v-u},C={top:"bottom",bottom:"top",left:"right",right:"left"},P=T(this.placement);!M[P]&&M[C[P]]&&(P=C[P]);let H,O;P==="top"||P==="bottom"?(H=l.left+l.width/2-d.width/2,O=P==="top"?l.top-p-d.height:l.bottom+p):(O=l.top+l.height/2-d.height/2,H=P==="left"?l.left-p-d.width:l.right+p),H=Math.min(Math.max(u,H),v-u-d.width),O=Math.min(Math.max(u,O),$-u-d.height),e.style.transform=`translate(${Math.round(H)}px, ${Math.round(O)}px)`;let Ht={top:"top",bottom:"bottom",left:x?"end":"start",right:x?"start":"end"};this._side=Ht[P]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,Ln)),this.addEventListener("pointerleave",r(this,Cn)),this.addEventListener("focusin",r(this,An)),this.addEventListener("focusout",r(this,Dn)),this.addEventListener("keydown",r(this,Xi)),this.hasUpdated&&r(this,Ct).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),o(this,ce,Jo).call(this),o(this,ce,Go).call(this),clearTimeout(r(this,_e))}show(){clearTimeout(r(this,_e)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,Xi),!0),addEventListener("scroll",r(this,Pe),!0),addEventListener("resize",r(this,Pe)),this.updateComplete.then(r(this,Pe)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,_e)),this.open&&(this.open=!1,o(this,ce,Go).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,Ct).call(this),this.content?this.open&&r(this,Pe).call(this):this.hide())}render(){return n`<slot @slotchange=${r(this,Ct)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1574
|
+
data-side=${this._side}>${this.content}</div>`}};F=new WeakMap,Wi=new WeakMap,lt=new WeakMap,ct=new WeakMap,_e=new WeakMap,Yi=new WeakMap,Gi=new WeakMap,ce=new WeakSet,Go=function(){document.removeEventListener("keydown",r(this,Xi),!0),removeEventListener("scroll",r(this,Pe),!0),removeEventListener("resize",r(this,Pe))},Ln=new WeakMap,Cn=new WeakMap,An=new WeakMap,Dn=new WeakMap,Xi=new WeakMap,Fc=function(e){return e.matches(Tn)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(Tn)??e},Ct=new WeakMap,Xo=function(e){f(this,lt,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),s=r(this,lt).map(l=>t.getElementById(l)).filter(l=>!!l);e.ariaDescribedByElements=[...s,r(this,F)]},Jo=function(){let e=r(this,Wi);if(!(!e||!r(this,F))){if(r(this,ct))r(this,ct).disconnect(),f(this,ct,void 0),r(this,lt).length?e.setAttribute("aria-describedby",r(this,lt).join(" ")):e.removeAttribute("aria-describedby"),f(this,lt,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(s=>s&&s!==r(this,F).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}f(this,Wi,void 0)}},Pe=new WeakMap,Ki.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},Ki.styles=[g,m`
|
|
1575
|
+
:host { display: inline-block; position: relative; }
|
|
1576
|
+
.tip {
|
|
1577
|
+
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
1578
|
+
max-width: min(280px, calc(100vw - 16px)); width: max-content;
|
|
1579
|
+
padding: 6px var(--cm-space-10); border-radius: var(--cm-radius-sm);
|
|
1580
|
+
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
1581
|
+
font-size: 12px; line-height: 16px; font-weight: 400; white-space: normal; overflow-wrap: anywhere;
|
|
1582
|
+
box-shadow: var(--cm-shadow-100); pointer-events: auto;
|
|
1583
|
+
opacity: 0; visibility: hidden; transition: opacity 120ms ease;
|
|
1584
|
+
}
|
|
1585
|
+
:host([open]) .tip { opacity: 1; visibility: visible; }
|
|
1586
|
+
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1587
|
+
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1588
|
+
`];b("cm-tooltip",Ki);var Zb=w("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),Dr,Nr,In,A,Zo,Nn,Qo,Vc,Uc,el,tl,Kc,il,sl,Rn,rl,Wc,Ji=class extends y{constructor(){super(...arguments);h(this,A);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;h(this,Dr,new Set);h(this,Nr);h(this,In,S("cm-sidenav"))}connectedCallback(){super.connectedCallback(),o(this,A,Zo).call(this),f(this,Nr,nt(this,()=>o(this,A,Zo).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Nr)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let s=o(this,A,Nn).call(this,e,t);r(this,Dr).has(s)||!e.items?.length||(r(this,Dr).add(s),(e.expanded||Sn(e))&&this._open.add(s))})}toggle(e,t){let s=this.navItems[e];if(!s?.items?.length)return;let l=o(this,A,Nn).call(this,s,e),d=t??!this._open.has(l);if(d===this._open.has(l))return;let p=new Set(this._open);d?p.add(l):p.delete(l),this._open=p,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:s,expanded:d}}))}render(){let e=this.collapsed;return n`
|
|
1589
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${o(this,A,Uc)}>
|
|
1478
1590
|
<slot name="header"></slot>
|
|
1479
1591
|
<ul part="list">
|
|
1480
|
-
${this.navItems.map((
|
|
1481
|
-
|
|
1482
|
-
aria-expanded=${
|
|
1483
|
-
${
|
|
1484
|
-
|
|
1485
|
-
</button
|
|
1486
|
-
<ul class="sub" id=${
|
|
1487
|
-
${
|
|
1592
|
+
${this.navItems.map((t,s)=>{if(!t.items?.length)return n`<li>${o(this,A,rl).call(this,t,"",{index:s})}</li>`;let l=!e&&this._open.has(o(this,A,Nn).call(this,t,s)),d=`${r(this,In)}-${s}`;return n`<li>
|
|
1593
|
+
${o(this,A,Rn).call(this,t,n`<button type="button" class="item parent ${Sn(t)?"has-current":""}" part="item" data-index=${s}
|
|
1594
|
+
aria-expanded=${l?"true":"false"} aria-controls=${d} @click=${()=>e?o(this,A,Kc).call(this,s):this.toggle(s)}>
|
|
1595
|
+
${o(this,A,il).call(this,t)}${o(this,A,sl).call(this,t)}
|
|
1596
|
+
${e?c:n`<cm-icon class="chev" name="chevron-down" size="18"></cm-icon>`}
|
|
1597
|
+
</button>`)}
|
|
1598
|
+
<ul class="sub" id=${d} ?hidden=${!l} aria-label=${t.label}>
|
|
1599
|
+
${o(this,A,el).call(this,t.items).map(([p,u])=>n`<li>${o(this,A,rl).call(this,{...p,icon:void 0},u?"deep":"",{parent:s})}</li>`)}
|
|
1488
1600
|
</ul>
|
|
1489
1601
|
</li>`})}
|
|
1490
1602
|
</ul>
|
|
1603
|
+
${o(this,A,Wc).call(this)}
|
|
1491
1604
|
<slot name="footer"></slot>
|
|
1492
1605
|
<slot hidden></slot>
|
|
1493
1606
|
</nav>
|
|
1494
|
-
`}};
|
|
1495
|
-
data-index=${s.index??c} data-parent=${s.parent??c} @click=${d=>
|
|
1496
|
-
data-index=${s.index??c} data-parent=${s.parent??c} @click=${d=>
|
|
1607
|
+
`}};Dr=new WeakMap,Nr=new WeakMap,In=new WeakMap,A=new WeakSet,Zo=function(){this._slotted=qe(this)},Nn=function(e,t){return`${t}:${Yo(e)}`},Qo=function(e,t){ot(this,t)||e.preventDefault()},Vc=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},Uc=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let s=o(this,A,Vc).call(this),l=s.indexOf(t),d=Number(t.dataset.index),p=de(e,this),u;if(e.key==="ArrowDown")u=s[(l+1)%s.length];else if(e.key==="ArrowUp")u=s[(l-1+s.length)%s.length];else if(e.key==="Home")u=s[0];else if(e.key==="End")u=s[s.length-1];else{if(this.collapsed&&(p==="ArrowRight"||p==="ArrowLeft"))return;if(p==="ArrowRight"&&t.classList.contains("parent")){this.toggle(d,!0),e.preventDefault();return}else if(p==="ArrowLeft"){if(t.classList.contains("parent")?this.toggle(d,!1):t.dataset.parent&&(u=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!u){e.preventDefault();return}}else return}e.preventDefault(),u?.focus()},el=function(e,t=0){return e.flatMap(s=>[[s,t],...o(this,A,el).call(this,s.items??[],t+1)])},tl=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},Kc=function(e){let t=this.navItems[e];o(this,A,tl).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},il=function(e){return e.icon?n`<cm-icon name=${e.icon} size="20"></cm-icon>`:this.collapsed?n`<span class="initial" aria-hidden="true">${[...e.label.trim()][0]??""}</span>`:c},sl=function(e){if(!this.collapsed)return n`<span class="label">${e.label}</span>${e.badge?n`<span class="badge">${e.badge}</span>`:c}`;let t=e.badge&&/^\d{1,2}\+?$/.test(e.badge.trim());return n`<span class="sr">${e.label}${e.badge?` (${e.badge})`:""}</span>${e.badge?n`<span class="dot ${t?"count":""}" aria-hidden="true">${t?e.badge:c}</span>`:c}`},Rn=function(e,t){return this.collapsed?n`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},rl=function(e,t,s={}){let l=n`${o(this,A,il).call(this,e)}${o(this,A,sl).call(this,e)}`;return o(this,A,Rn).call(this,e,e.href?n`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":c}
|
|
1608
|
+
data-index=${s.index??c} data-parent=${s.parent??c} @click=${d=>o(this,A,Qo).call(this,d,e)}>${l}</a>`:n`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":c}
|
|
1609
|
+
data-index=${s.index??c} data-parent=${s.parent??c} @click=${d=>o(this,A,Qo).call(this,d,e)}>${l}</button>`)},Wc=function(){if(!this.collapsible)return c;let e=this.t(this.collapsed?"expand":"collapse"),t=n`<cm-icon name=${this.collapsed?"chevron-right":"chevron-left"} size="20"></cm-icon>${this.collapsed?n`<span class="sr">${e}</span>`:n`<span class="label">${e}</span>`}`;return n`<div class="toggle-row">${o(this,A,Rn).call(this,{label:e},n`<button type="button" class="item toggle" part="collapse-button"
|
|
1610
|
+
@click=${()=>o(this,A,tl).call(this,!this.collapsed)}>${t}</button>`)}</div>`},Ji.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},Ji.styles=[g,m`
|
|
1497
1611
|
:host { display: block; width: var(--cm-side-navigation-width, 250px); }
|
|
1498
1612
|
nav {
|
|
1499
1613
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: 16px;
|
|
@@ -1519,7 +1633,60 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1519
1633
|
.sub .item { min-height: 36px; padding-inline-start: 40px; font-size: 14px; }
|
|
1520
1634
|
.sub .item.deep { padding-inline-start: 56px; }
|
|
1521
1635
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
1522
|
-
|
|
1636
|
+
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
|
1637
|
+
.toggle { margin-block-start: 8px; color: var(--cm-text-on-dark-secondary); }
|
|
1638
|
+
.toggle .label { font-size: 14px; }
|
|
1639
|
+
/* Collapsed: an icon rail. */
|
|
1640
|
+
:host([collapsed]) { width: var(--cm-side-navigation-collapsed-width, 72px); }
|
|
1641
|
+
:host([collapsed]) cm-tooltip { display: block; color: inherit; }
|
|
1642
|
+
:host([collapsed]) .item { position: relative; justify-content: center; min-height: 44px; padding: 0; }
|
|
1643
|
+
:host([collapsed]) .item[aria-current='page'], :host([collapsed]) .parent.has-current { background: var(--cm-nav-active); }
|
|
1644
|
+
.initial { display: grid; place-items: center; width: 20px; height: 20px; font-size: 14px; font-weight: 600; text-transform: uppercase; }
|
|
1645
|
+
.dot {
|
|
1646
|
+
position: absolute; inset-block-start: 6px; inset-inline-start: calc(50% + 4px); min-width: 8px; height: 8px; border-radius: var(--cm-radius-full);
|
|
1647
|
+
background: var(--cm-nav-badge); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
1648
|
+
}
|
|
1649
|
+
.dot.count { inset-block-start: 3px; height: 16px; padding: 0 4px; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; color: var(--cm-text-on-dark); }
|
|
1650
|
+
`];b("cm-side-navigation",Ji);var al=0,Yc="";function ol(){al++===0&&(Yc=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function Rr(){al>0&&--al===0&&(document.documentElement.style.overflow=Yc)}function ll(){let a=document.activeElement;for(;a?.shadowRoot?.activeElement;)a=a.shadowRoot.activeElement;return a}var Zi,Be,Qi,Ir,nl,Hn,On,qn,Pn,Bn,B=class extends y{constructor(){super(...arguments);h(this,Ir);this.open=!1;this.label="";this.uid=S("cm-ovl");h(this,Zi,null);h(this,Be,!1);h(this,Qi,!1);h(this,Hn,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});h(this,On,e=>{e.preventDefault(),this.requestClose("escape")});h(this,qn,()=>{this.open&&!this.dialog?.open&&(this.open=!1,o(this,Ir,nl).call(this))});h(this,Pn,e=>{f(this,Qi,e.target===e.currentTarget)});h(this,Bn,e=>{if(e.target===e.currentTarget&&r(this,Qi)){let t=e.currentTarget.getBoundingClientRect();(!(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom)||this.backdropFillsDialog)&&this.requestClose("backdrop")}f(this,Qi,!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}get dialog(){return this.renderRoot?.querySelector("dialog")}updated(e){if(super.updated(e),!e.has("open"))return;let t=this.dialog;if(t)if(this.open&&!t.open){if(f(this,Zi,ll()),!this.isConnected)return;t.showModal(),r(this,Be)||(ol(),f(this,Be,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),o(this,Ir,nl).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,Be)&&(Rr(),f(this,Be,!1))}renderHeader(e=c){return n`<header class="head" part="header">
|
|
1651
|
+
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
1652
|
+
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
1653
|
+
<cm-icon name="close" size="18"></cm-icon></button>
|
|
1654
|
+
</header>`}renderDialog(e,t=""){return n`<dialog part="dialog" class=${t}
|
|
1655
|
+
aria-labelledby=${this.heading?`${this.uid}-h`:c}
|
|
1656
|
+
aria-label=${!this.heading&&this.label?this.label:c}
|
|
1657
|
+
@keydown=${r(this,Hn)} @cancel=${r(this,On)} @close=${r(this,qn)}
|
|
1658
|
+
@pointerdown=${r(this,Pn)} @click=${r(this,Bn)}>${e}</dialog>`}};Zi=new WeakMap,Be=new WeakMap,Qi=new WeakMap,Ir=new WeakSet,nl=function(){r(this,Be)&&(Rr(),f(this,Be,!1));let e=r(this,Zi);f(this,Zi,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},Hn=new WeakMap,On=new WeakMap,qn=new WeakMap,Pn=new WeakMap,Bn=new WeakMap,B.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},B.overlayStyles=[g,m`
|
|
1659
|
+
:host { display: contents; }
|
|
1660
|
+
dialog {
|
|
1661
|
+
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
1662
|
+
font: inherit; overflow: visible;
|
|
1663
|
+
}
|
|
1664
|
+
dialog::backdrop { background: var(--cm-overlay, rgba(0, 0, 0, 0.4)); }
|
|
1665
|
+
.panel {
|
|
1666
|
+
display: flex; flex-direction: column; background: var(--cm-bg-surface); color: var(--cm-text-default);
|
|
1667
|
+
overflow: hidden; outline: none;
|
|
1668
|
+
}
|
|
1669
|
+
.head {
|
|
1670
|
+
display: flex; align-items: center; gap: var(--cm-space-10); flex: none; min-height: 40px; padding-block: 8px; padding-inline: 15px 10px;
|
|
1671
|
+
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
1672
|
+
}
|
|
1673
|
+
.head h2 { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
|
|
1674
|
+
.x {
|
|
1675
|
+
display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
1676
|
+
background: none; color: inherit; cursor: pointer;
|
|
1677
|
+
}
|
|
1678
|
+
.x:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
1679
|
+
.body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--cm-space-20); font-size: 14px; line-height: 20px; }
|
|
1680
|
+
.foot {
|
|
1681
|
+
display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-10); flex: none; padding: var(--cm-space-15) var(--cm-space-20);
|
|
1682
|
+
border-top: var(--cm-border-1) solid var(--cm-border-default);
|
|
1683
|
+
}
|
|
1684
|
+
.foot[hidden] { display: none; }
|
|
1685
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1686
|
+
dialog[open] .panel { animation: cm-ovl-in 160ms ease-out; }
|
|
1687
|
+
}
|
|
1688
|
+
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
1689
|
+
`];function Gc(a){let i=a.trim().split(/[\s._@-]+/).filter(Boolean);if(!i.length)return"";let e=[...i[0]][0]??"",t=i.length>1&&!/[.@]/.test(a)?[...i[i.length-1]][0]??"":"";return(e+t).toLocaleUpperCase()}var es=class extends k{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=Gc(this.name),t=this.decorative||!this.name?c:this.name,s=this.decorative||!this.name?"true":c,l,d="avatar";return this.src&&!this._failed?l=n`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?l=n`<span aria-hidden="true">${e}</span>`:(d+=" icon",l=n`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),n`<span class=${d} part="avatar" role=${t===c?c:"img"} aria-label=${t} aria-hidden=${s}>${l}</span>`}};es.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},es.styles=[g,m`
|
|
1523
1690
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
1524
1691
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
1525
1692
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -1532,29 +1699,40 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1532
1699
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
1533
1700
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
1534
1701
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
1535
|
-
`];
|
|
1702
|
+
`];b("cm-avatar",es);var uf=w("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),ss,je,rs,Y,Hr,cl,ts,is=class extends y{constructor(){super();h(this,Y);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;h(this,ss);h(this,je,!1);h(this,rs,null);this.addEventListener("cm-select",e=>{let t=o(this,Y,Hr).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){o(this,Y,Hr).call(this)?.focus();return}this._searchOpen||(f(this,rs,ll()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),f(this,ss,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,ss).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,ss)?.disconnect(),r(this,je)&&(Rr(),f(this,je,!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,je)||(ol(),f(this,je,!0)),o(this,Y,Hr).call(this)?.focus(),o(this,Y,ts).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,je)&&(Rr(),f(this,je,!1));let s=r(this,rs)??this.renderRoot.querySelector(".search-btn");f(this,rs,null),s?.isConnected&&s.focus(),o(this,Y,ts).call(this,"cm-search-toggle",{open:!1})}}render(){return n`
|
|
1536
1703
|
<header part="bar" role="banner" aria-label=${this.label||c}>
|
|
1537
1704
|
<div class="logo"><slot name="logo"></slot></div>
|
|
1538
1705
|
${this.store?n`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
1539
|
-
@click=${()=>
|
|
1706
|
+
@click=${()=>o(this,Y,ts).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="20"></cm-icon></button>`:c}
|
|
1707
|
+
${this._narrow?c:n`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${o(this,Y,cl)}></slot></div>`}
|
|
1540
1708
|
<span class="grow"></span>
|
|
1541
1709
|
<div class="end">
|
|
1710
|
+
${this._narrow&&this._hasSearch?n`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
1711
|
+
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:c}
|
|
1542
1712
|
<div class="actions"><slot name="actions"></slot></div>
|
|
1543
1713
|
${this.balance?n`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
1544
|
-
@click=${()=>
|
|
1714
|
+
@click=${()=>o(this,Y,ts).call(this,"cm-wallet")}>${this.balance}</button>`:c}
|
|
1545
1715
|
${this.userName?n`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
1546
|
-
@click=${()=>
|
|
1716
|
+
@click=${()=>o(this,Y,ts).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
1547
1717
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:c}
|
|
1548
1718
|
<slot name="end"></slot>
|
|
1549
1719
|
</div>
|
|
1550
1720
|
</header>
|
|
1551
|
-
|
|
1721
|
+
${this._narrow?n`<dialog class="layer" part="search-layer" aria-label=${this.searchLabel}
|
|
1722
|
+
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
1723
|
+
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
1724
|
+
<div class="layer-bar">
|
|
1725
|
+
<div class="layer-search"><slot name="search" @slotchange=${o(this,Y,cl)}></slot></div>
|
|
1726
|
+
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
1727
|
+
</div>
|
|
1728
|
+
</dialog>`:c}
|
|
1729
|
+
`}};ss=new WeakMap,je=new WeakMap,rs=new WeakMap,Y=new WeakSet,Hr=function(){return this.querySelector(':scope > [slot="search"]')},cl=function(){this._hasSearch=!!o(this,Y,Hr).call(this)},ts=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},is.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}},is.styles=[g,m`
|
|
1552
1730
|
:host { display: block; background: var(--cm-bg-surface); container-type: inline-size; }
|
|
1553
1731
|
header {
|
|
1554
1732
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 70px; padding-block: 10px; padding-inline: 27px var(--cm-space-20);
|
|
1555
1733
|
}
|
|
1556
|
-
.logo { display: flex; align-items: center; flex:
|
|
1557
|
-
::slotted([slot='logo']) { display: block; max-height: 24px; width: auto; }
|
|
1734
|
+
.logo { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; }
|
|
1735
|
+
::slotted([slot='logo']) { display: block; max-height: 24px; width: auto; max-width: 100%; object-fit: contain; }
|
|
1558
1736
|
.store, .pill, .user {
|
|
1559
1737
|
display: inline-flex; align-items: center; gap: 8px; font: inherit; color: var(--cm-text-default);
|
|
1560
1738
|
background: none; cursor: pointer;
|
|
@@ -1577,6 +1755,27 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1577
1755
|
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-full);
|
|
1578
1756
|
}
|
|
1579
1757
|
.avatar { --cm-avatar-size: 36px; }
|
|
1758
|
+
.search { display: none; flex: 1 1 240px; min-width: 200px; max-width: 560px; }
|
|
1759
|
+
.search.has { display: block; }
|
|
1760
|
+
.search-btn {
|
|
1761
|
+
display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0;
|
|
1762
|
+
border-radius: var(--cm-radius-sm); background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
1763
|
+
}
|
|
1764
|
+
.search-btn:hover { background: var(--cm-bg-hover); }
|
|
1765
|
+
.layer {
|
|
1766
|
+
position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
|
|
1767
|
+
background: var(--cm-bg-surface); color: var(--cm-text-default); font: inherit;
|
|
1768
|
+
--cm-global-search-results-position: static; --cm-global-search-results-shadow: none; --cm-global-search-results-max-height: none;
|
|
1769
|
+
}
|
|
1770
|
+
.layer[open] { display: flex; flex-direction: column; }
|
|
1771
|
+
.layer::backdrop { background: var(--cm-bg-surface); }
|
|
1772
|
+
.layer-bar { display: flex; align-items: flex-start; gap: var(--cm-space-10); flex: 1 1 auto; min-height: 0; overflow: auto; padding: 8px var(--cm-space-15); }
|
|
1773
|
+
.layer-search { flex: 1; min-width: 0; }
|
|
1774
|
+
.layer-close {
|
|
1775
|
+
display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0;
|
|
1776
|
+
border-radius: var(--cm-radius-sm); background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
1777
|
+
}
|
|
1778
|
+
.layer-close:hover { background: var(--cm-bg-hover); }
|
|
1580
1779
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1581
1780
|
@container (max-width: 1300px) {
|
|
1582
1781
|
.store { margin-inline-start: var(--cm-space-20); }
|
|
@@ -1594,11 +1793,13 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1594
1793
|
.user { padding: 2px; min-height: 0; border-color: transparent; }
|
|
1595
1794
|
.user .name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1596
1795
|
.avatar { --cm-avatar-size: 32px; }
|
|
1796
|
+
/* The controls on the right keep their 44px touch areas, so they need no gap between them; the logo gives way first. */
|
|
1797
|
+
.end { gap: 0; }
|
|
1597
1798
|
}
|
|
1598
|
-
`];
|
|
1599
|
-
<ul>${this.navItems.slice(0,5).map(e=>n`<li>${
|
|
1799
|
+
`];b("cm-header-bar",is);var wf=w("bottomNavigation",{label:"Main"}),Or,At,dl,Xc,as=class extends y{constructor(){super(...arguments);h(this,At);this.items=[];this.fixed=!1;this._slotted=[];h(this,Or)}connectedCallback(){super.connectedCallback(),o(this,At,dl).call(this),f(this,Or,nt(this,()=>o(this,At,dl).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Or)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return n`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
1800
|
+
<ul>${this.navItems.slice(0,5).map(e=>n`<li>${o(this,At,Xc).call(this,e)}</li>`)}</ul>
|
|
1600
1801
|
<slot hidden></slot>
|
|
1601
|
-
</nav>`}};
|
|
1802
|
+
</nav>`}};Or=new WeakMap,At=new WeakSet,dl=function(){this._slotted=qe(this)},Xc=function(e){let t=`item ${e.primary?"primary":""}`,s=n`<span class="icon">${e.icon?n`<cm-icon name=${e.icon} size=${e.primary?16:24}></cm-icon>`:c}</span><span class="label">${e.label}</span>`,l=d=>{ot(this,e)||d.preventDefault()};return e.href?n`<a class=${t} part="item" href=${e.href} aria-current=${e.current?"page":c} @click=${l}>${s}</a>`:n`<button type="button" class=${t} part="item" aria-current=${e.current?"page":c} @click=${l}>${s}</button>`},as.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},as.styles=[g,m`
|
|
1602
1803
|
:host { display: block; }
|
|
1603
1804
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
1604
1805
|
nav {
|
|
@@ -1618,31 +1819,31 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1618
1819
|
.icon { display: grid; place-items: center; width: 26px; height: 26px; }
|
|
1619
1820
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
1620
1821
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1621
|
-
`];
|
|
1822
|
+
`];b("cm-bottom-navigation",as);var Lf=w("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),qr,Dt,J,hl,Jc,pl,ml,Zc,ns=class extends y{constructor(){super(...arguments);h(this,J);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;h(this,qr);h(this,Dt,S("cm-mmenu"))}connectedCallback(){super.connectedCallback(),o(this,J,hl).call(this),f(this,qr,nt(this,()=>o(this,J,hl).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,qr)?.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?n`<nav part="nav" class="sub" aria-label=${this.label||this.t("label")} id="${r(this,Dt)}-sub"
|
|
1622
1823
|
@keydown=${s=>{s.key==="Escape"&&(s.preventDefault(),this.back())}}>
|
|
1623
1824
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="18"></cm-icon>${t.label}</button>
|
|
1624
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(s=>n`<li>${
|
|
1825
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(s=>n`<li>${o(this,J,ml).call(this,s,0,0,!0)}</li>`)}</ul>
|
|
1625
1826
|
<slot hidden></slot>
|
|
1626
1827
|
</nav>`:n`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
1627
|
-
${
|
|
1628
|
-
${e.map((s,
|
|
1828
|
+
${o(this,J,Zc).call(this)}
|
|
1829
|
+
${e.map((s,l)=>{let d=`${r(this,Dt)}-s${l}`;return n`<section aria-labelledby=${s.label?d:c}>
|
|
1629
1830
|
${s.label?n`<h2 class="heading" id=${d}>${s.label}</h2>`:c}
|
|
1630
|
-
<ul class="card">${(s.items??[]).map((p,
|
|
1831
|
+
<ul class="card">${(s.items??[]).map((p,u)=>n`<li>${o(this,J,ml).call(this,p,l,u)}</li>`)}</ul>
|
|
1631
1832
|
</section>`})}
|
|
1632
1833
|
<slot hidden></slot>
|
|
1633
|
-
</nav>`}};
|
|
1634
|
-
@click=${()=>
|
|
1635
|
-
<h2 class="heading" id="${r(this,
|
|
1834
|
+
</nav>`}};qr=new WeakMap,Dt=new WeakMap,J=new WeakSet,hl=function(){this._slotted=qe(this)},Jc=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},pl=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},ml=function(e,t,s,l=!1){let d=$=>{ot(this,e)||$.preventDefault()};if(e.primary&&!l)return n`<button type="button" class="row action" part="row" @click=${d}>${e.label}</button>`;let p=e.icon&&!l?n`<cm-icon class="icon" name=${e.icon} size="24"></cm-icon>`:c,u=e.badge?n`<span class="badge">${e.badge}</span>`:c;if(e.items?.length&&!l)return n`<button type="button" class="row" part="row" data-row="${t}-${s}"
|
|
1835
|
+
@click=${()=>o(this,J,Jc).call(this,t,s)}>${p}<span class="label">${e.label}</span>${u}<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let v=n`${p}<span class="label">${e.label}</span>${u}${e.href&&!l?n`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:c}`;return e.href?n`<a class="row" part="row" href=${e.href} aria-current=${e.current?"page":c} @click=${d}>${v}</a>`:n`<button type="button" class="row" part="row" aria-current=${e.current?"page":c} @click=${d}>${v}</button>`},Zc=function(){if(!this.store&&!this.userName)return c;let e=this.userName.trim().charAt(0).toUpperCase();return n`<section aria-labelledby="${r(this,Dt)}-profile">
|
|
1836
|
+
<h2 class="heading" id="${r(this,Dt)}-profile">${this.t("profile")}</h2>
|
|
1636
1837
|
<ul class="card">
|
|
1637
|
-
${this.store?n`<li><button type="button" class="row" part="row" @click=${()=>
|
|
1838
|
+
${this.store?n`<li><button type="button" class="row" part="row" @click=${()=>o(this,J,pl).call(this,"cm-store-switch")}>
|
|
1638
1839
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
1639
1840
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:c}
|
|
1640
|
-
${this.userName?n`<li><button type="button" class="row" part="row" @click=${()=>
|
|
1841
|
+
${this.userName?n`<li><button type="button" class="row" part="row" @click=${()=>o(this,J,pl).call(this,"cm-account")}>
|
|
1641
1842
|
<span class="avatar">${this.avatarSrc?n`<img src=${this.avatarSrc} alt="">`:n`<span aria-hidden="true">${e}</span>`}</span>
|
|
1642
1843
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?n`<span class="email">${this.userEmail}</span>`:c}</span>
|
|
1643
1844
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:c}
|
|
1644
1845
|
</ul>
|
|
1645
|
-
</section>`},
|
|
1846
|
+
</section>`},ns.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}},ns.styles=[g,m`
|
|
1646
1847
|
:host { display: block; background: var(--cm-bg-page); }
|
|
1647
1848
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
1648
1849
|
.heading {
|
|
@@ -1679,11 +1880,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1679
1880
|
}
|
|
1680
1881
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1681
1882
|
.sub .row { font-size: 16px; min-height: 48px; }
|
|
1682
|
-
`];
|
|
1883
|
+
`];b("cm-mobile-menu",ns);var Hf=w("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),jn,Qc,os=class extends y{constructor(){super(...arguments);h(this,jn);this.icon="send";this.dismissible=!1}render(){return n`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
1683
1884
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?n`<cm-icon name=${this.icon} size="20"></cm-icon>`:c}</slot></span>
|
|
1684
1885
|
<span class="text"><slot></slot></span>
|
|
1685
|
-
${this.dismissible?n`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${
|
|
1686
|
-
</div>`}};
|
|
1886
|
+
${this.dismissible?n`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${o(this,jn,Qc)}><cm-icon name="close" size="18"></cm-icon></button>`:c}
|
|
1887
|
+
</div>`}};jn=new WeakSet,Qc=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},os.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},os.styles=[g,m`
|
|
1687
1888
|
:host { display: block; }
|
|
1688
1889
|
.bar {
|
|
1689
1890
|
position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px;
|
|
@@ -1705,11 +1906,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1705
1906
|
@media (max-width: 640px) {
|
|
1706
1907
|
.bar { font-size: 14px; min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
1707
1908
|
}
|
|
1708
|
-
`];
|
|
1909
|
+
`];b("cm-flash-offer-bar",os);var Uf=w("linkTabs",{label:"Sections"}),Pr,Br,ul,ls=class extends y{constructor(){super(...arguments);h(this,Br);this.items=[];this._slotted=[];h(this,Pr)}connectedCallback(){super.connectedCallback(),o(this,Br,ul).call(this),f(this,Pr,nt(this,()=>o(this,Br,ul).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Pr)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return n`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
1709
1910
|
<ul part="tabs">${this.tabs.map(e=>n`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":c}
|
|
1710
|
-
@click=${t=>{
|
|
1911
|
+
@click=${t=>{ot(this,e)||t.preventDefault()}}>${e.label}${e.badge?n`<span class="badge">(${e.badge})</span>`:c}</a></li>`)}</ul>
|
|
1711
1912
|
<slot hidden></slot>
|
|
1712
|
-
</nav>`}}
|
|
1913
|
+
</nav>`}};Pr=new WeakMap,Br=new WeakSet,ul=function(){this._slotted=qe(this)},ls.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0}},ls.styles=[g,m`
|
|
1713
1914
|
:host { display: block; }
|
|
1714
1915
|
ul {
|
|
1715
1916
|
display: flex; gap: 28px; margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
@@ -1727,19 +1928,19 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1727
1928
|
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
|
|
1728
1929
|
.badge { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
1729
1930
|
@media (max-width: 640px) { ul { gap: 18px; } a { font-size: 14px; } }
|
|
1730
|
-
`];
|
|
1931
|
+
`];b("cm-link-tabs",ls);var Zf=w("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}"}),cs=class extends y{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),s=typeof this.reviews=="number"?this.t("reviews",{count:this.reviews}):"",l=t?this.formatNumber(this.rating,{minimumFractionDigits:1,maximumFractionDigits:1}):"";return n`<article part="card" aria-labelledby="name">
|
|
1731
1932
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
1732
1933
|
<div class="status"><slot name="status"></slot></div>
|
|
1733
1934
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
1734
1935
|
${this.developer?n`<p class="by">${this.t("developer",{developer:this.developer})}</p>`:c}
|
|
1735
1936
|
${t?n`<p class="rating"><cm-icon class="star" name="star" size="12"></cm-icon>
|
|
1736
|
-
<span aria-hidden="true">${
|
|
1937
|
+
<span aria-hidden="true">${l}</span><span class="sr">${this.t("rating",{rating:l})}</span>
|
|
1737
1938
|
${s?this.reviewsHref?n`<a href=${this.reviewsHref}>${s}</a>`:n`<span>${s}</span>`:c}</p>`:c}
|
|
1738
1939
|
${this.pricing?n`<p class="pricing">${this.pricing}</p>`:c}
|
|
1739
1940
|
${this.offer?n`<p class="offer"><cm-icon name="percent" size="12"></cm-icon><span><span class="sr">${this.t("offer")}</span>${this.offer}</span></p>`:c}
|
|
1740
1941
|
<div class="actions"><slot name="actions"></slot>${this.href?n`<a class="details" part="details" href=${this.href}
|
|
1741
1942
|
aria-label=${this.t("detailsLabel",{name:this.name})}>${this.t("details")}</a>`:c}</div>
|
|
1742
|
-
</article>`}};
|
|
1943
|
+
</article>`}};cs.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},cs.styles=[g,m`
|
|
1743
1944
|
:host { display: block; container-type: inline-size; }
|
|
1744
1945
|
article {
|
|
1745
1946
|
position: relative; display: flex; flex-direction: column; gap: 10px; height: 100%; padding: var(--cm-space-20);
|
|
@@ -1775,59 +1976,20 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1775
1976
|
.actions { gap: var(--cm-space-10); }
|
|
1776
1977
|
.details { margin-inline-start: auto; }
|
|
1777
1978
|
}
|
|
1778
|
-
`];
|
|
1779
|
-
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
1780
|
-
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
1781
|
-
<cm-icon name="close" size="18"></cm-icon></button>
|
|
1782
|
-
</header>`}renderDialog(e,t=""){return n`<dialog part="dialog" class=${t}
|
|
1783
|
-
aria-labelledby=${this.heading?`${this.uid}-h`:c}
|
|
1784
|
-
aria-label=${!this.heading&&this.label?this.label:c}
|
|
1785
|
-
@keydown=${r(this,on)} @cancel=${r(this,ln)} @close=${r(this,cn)}
|
|
1786
|
-
@pointerdown=${r(this,dn)} @click=${r(this,hn)}>${e}</dialog>`}};Ki=new WeakMap,Re=new WeakMap,Wi=new WeakMap,kr=new WeakSet,Co=function(){r(this,Re)&&(hc(),g(this,Re,!1));let e=r(this,Ki);g(this,Ki,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},on=new WeakMap,ln=new WeakMap,cn=new WeakMap,dn=new WeakMap,hn=new WeakMap,P.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},P.overlayStyles=[f,m`
|
|
1787
|
-
:host { display: contents; }
|
|
1788
|
-
dialog {
|
|
1789
|
-
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
1790
|
-
font: inherit; overflow: visible;
|
|
1791
|
-
}
|
|
1792
|
-
dialog::backdrop { background: var(--cm-overlay, rgba(0, 0, 0, 0.4)); }
|
|
1793
|
-
.panel {
|
|
1794
|
-
display: flex; flex-direction: column; background: var(--cm-bg-surface); color: var(--cm-text-default);
|
|
1795
|
-
overflow: hidden; outline: none;
|
|
1796
|
-
}
|
|
1797
|
-
.head {
|
|
1798
|
-
display: flex; align-items: center; gap: var(--cm-space-10); flex: none; min-height: 40px; padding-block: 8px; padding-inline: 15px 10px;
|
|
1799
|
-
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
1800
|
-
}
|
|
1801
|
-
.head h2 { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
|
|
1802
|
-
.x {
|
|
1803
|
-
display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
1804
|
-
background: none; color: inherit; cursor: pointer;
|
|
1805
|
-
}
|
|
1806
|
-
.x:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
1807
|
-
.body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--cm-space-20); font-size: 14px; line-height: 20px; }
|
|
1808
|
-
.foot {
|
|
1809
|
-
display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-10); flex: none; padding: var(--cm-space-15) var(--cm-space-20);
|
|
1810
|
-
border-top: var(--cm-border-1) solid var(--cm-border-default);
|
|
1811
|
-
}
|
|
1812
|
-
.foot[hidden] { display: none; }
|
|
1813
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
1814
|
-
dialog[open] .panel { animation: cm-ovl-in 160ms ease-out; }
|
|
1815
|
-
}
|
|
1816
|
-
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
1817
|
-
`];var pn,mc,Yi=class extends P{constructor(){super(...arguments);h(this,pn);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}render(){return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
1979
|
+
`];b("cm-app-card",cs);var Fn,ed,ds=class extends B{constructor(){super(...arguments);h(this,Fn);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}render(){return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
1818
1980
|
${this.renderHeader()}
|
|
1819
1981
|
<div class="body" part="body"><slot></slot></div>
|
|
1820
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${
|
|
1821
|
-
</div>`)}};
|
|
1982
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${o(this,Fn,ed)}></slot></footer>
|
|
1983
|
+
</div>`)}};Fn=new WeakSet,ed=function(e){this._hasFooter=e.target.assignedElements().length>0},ds.properties={...B.properties,size:{reflect:!0},_hasFooter:{state:!0}},ds.styles=[...B.overlayStyles,m`
|
|
1822
1984
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
1823
1985
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
1824
1986
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
1825
1987
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-sm); box-shadow: var(--cm-shadow-100); }
|
|
1826
|
-
`];
|
|
1988
|
+
`];b("cm-modal",ds);var Vn,td,ze=class extends B{constructor(){super(...arguments);h(this,Vn);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}renderBody(){return n`<slot></slot>`}renderFooter(){return n`<slot name="footer" @slotchange=${o(this,Vn,td)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
1827
1989
|
${this.renderHeader()}
|
|
1828
1990
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
1829
1991
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
1830
|
-
</div>`)}};
|
|
1992
|
+
</div>`)}};Vn=new WeakSet,td=function(e){this._hasFooter=e.target.assignedElements().length>0},ze.properties={...B.properties,size:{reflect:!0},_hasFooter:{state:!0}},ze.styles=[...B.overlayStyles,m`
|
|
1831
1993
|
dialog {
|
|
1832
1994
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
1833
1995
|
}
|
|
@@ -1844,25 +2006,25 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1844
2006
|
dialog { inset: 16px; width: auto; height: auto; }
|
|
1845
2007
|
.panel { border-radius: var(--cm-radius-sm); }
|
|
1846
2008
|
}
|
|
1847
|
-
`];
|
|
2009
|
+
`];b("cm-side-panel",ze);var ug=w("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),ps,Un,hs=class extends ze{constructor(){super(...arguments);this.search=!1;this.query="";h(this,ps,()=>{this.dispatchEvent(new CustomEvent("cm-filter-apply",{detail:{values:this.values,query:this.query},bubbles:!0,composed:!0,cancelable:!0}))&&this.requestClose("action")});h(this,Un,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(l,d)=>{if(d==="")return;let p=e[l];e[l]=p===void 0?d:Array.isArray(p)?[...p,d]:[p,d]},s=this.form;if(s){for(let[l,d]of new FormData(s))typeof d=="string"&&t(l,d);return e}return this.querySelectorAll("[name]").forEach(l=>{let d=l.getAttribute("name");"checked"in l&&(l.type==="checkbox"||l.type==="radio"||l.localName.match(/^cm-(checkbox|radio|toggle)$/))?l.checked&&t(d,l.value||"on"):typeof l.value=="string"&&t(d,l.value)}),e}reset(){let e=this.form;e?e.reset():this.querySelectorAll("[name]").forEach(t=>t.formResetCallback?.()),this.query=""}renderBody(){return n`${this.search?n`<cm-search class="search" part="search" .value=${this.query} label=${this.searchLabel}
|
|
1848
2010
|
placeholder=${this.searchPlaceholder}
|
|
1849
2011
|
@input=${e=>{this.query=e.target.value}}
|
|
1850
|
-
@cm-search=${e=>{e.stopPropagation(),r(this,
|
|
1851
|
-
<slot @submit=${e=>{e.preventDefault(),r(this,
|
|
1852
|
-
<cm-button part="apply" variant="primary" @click=${r(this,
|
|
2012
|
+
@cm-search=${e=>{e.stopPropagation(),r(this,ps).call(this)}}></cm-search>`:c}
|
|
2013
|
+
<slot @submit=${e=>{e.preventDefault(),r(this,ps).call(this)}}></slot>`}renderFooter(){return n`<cm-button part="reset" @click=${r(this,Un)}>${this.resetLabel}</cm-button>
|
|
2014
|
+
<cm-button part="apply" variant="primary" @click=${r(this,ps)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};ps=new WeakMap,Un=new WeakMap,hs.properties={...ze.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"}},hs.styles=[...ze.styles,m`
|
|
1853
2015
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
1854
2016
|
.foot { justify-content: center; }
|
|
1855
2017
|
::slotted(form) { display: grid; gap: var(--cm-space-15); }
|
|
1856
|
-
`];
|
|
2018
|
+
`];b("cm-filter-panel",hs);var jr,Nt,bl,id,ms=class extends B{constructor(){super(...arguments);h(this,Nt);this.heading="";this.items=[];this._slotted=[];h(this,jr)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=_r(this),f(this,jr,fn(this,()=>{this._slotted=_r(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,jr)?.disconnect()}render(){let e=this.sheetItems.filter(s=>!s.divider),t=e.some(s=>s.icon);return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
1857
2019
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
1858
2020
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
1859
2021
|
${this.heading?n`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:c}
|
|
1860
2022
|
<div class="content">
|
|
1861
|
-
${e.length?n`<ul class=${t?"icons":""} part="list">${e.map(s=>n`<li>${
|
|
2023
|
+
${e.length?n`<ul class=${t?"icons":""} part="list">${e.map(s=>n`<li>${o(this,Nt,id).call(this,s)}</li>`)}</ul>`:c}
|
|
1862
2024
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
1863
2025
|
</div>
|
|
1864
|
-
</div>`)}};
|
|
1865
|
-
@click=${o
|
|
2026
|
+
</div>`)}};jr=new WeakMap,Nt=new WeakSet,bl=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")},id=function(e){let t=`row${e.critical?" critical":""}`,s=n`${e.icon?n`<cm-icon class="lead" name=${e.icon} size="18"></cm-icon>`:c}<span class="label">${e.label}</span>${e.icon?n`<cm-icon name="chevron-right" size="16"></cm-icon>`:c}`;return e.href&&!e.disabled?n`<a class=${t} part="row" href=${e.href} @click=${l=>o(this,Nt,bl).call(this,l,e)}>${s}</a>`:n`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":c}
|
|
2027
|
+
@click=${l=>o(this,Nt,bl).call(this,l,e)}>${s}</button>`},ms.properties={...B.properties,items:{type:Array},_slotted:{state:!0}},ms.styles=[...B.overlayStyles,m`
|
|
1866
2028
|
dialog {
|
|
1867
2029
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: 22px;
|
|
1868
2030
|
}
|
|
@@ -1896,14 +2058,17 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1896
2058
|
}
|
|
1897
2059
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
1898
2060
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1899
|
-
`];
|
|
1900
|
-
|
|
1901
|
-
${
|
|
2061
|
+
`];b("cm-bottom-sheet",ms);var zg=w("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),Wd={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},us=class extends k{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};us.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},us.styles=m`:host { display: none; }`;b("cm-notification-item",us);var fs,re,fl,gl,sd,rd,ad,bs=class extends B{constructor(){super(...arguments);h(this,re);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;h(this,fs)}connectedCallback(){super.connectedCallback(),o(this,re,fl).call(this),f(this,fs,new MutationObserver(()=>o(this,re,fl).call(this))),r(this,fs).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,fs)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications,t=this.markAllRead&&!this.loading&&e.some(l=>l.unread)?n`<button type="button" class="mark" part="mark-all-read" @click=${o(this,re,rd)}>${this.markAllLabel}</button>`:c,s=this.loading?n`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>n`<li>
|
|
2062
|
+
<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?n`<ul class="list" part="list">${e.map(l=>n`<li>${o(this,re,sd).call(this,l)}</li>`)}</ul>`:n`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
2063
|
+
${this.renderHeader(t)}
|
|
2064
|
+
${s}
|
|
2065
|
+
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
1902
2066
|
${this.moreHref?n`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:c}
|
|
2067
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${o(this,re,ad)}></slot></div>
|
|
1903
2068
|
<slot hidden></slot>
|
|
1904
|
-
</div>`)}};
|
|
1905
|
-
<span class="label">${e.unread?n`<span class="vh">${this.t("unread")}</span>`:c}${
|
|
1906
|
-
${e.time?n`<time>${e.time}</time>`:c}`,
|
|
2069
|
+
</div>`)}};fs=new WeakMap,re=new WeakSet,fl=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=s=>e.getAttribute(s)||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")}})},gl=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")},sd=function(e){let t=e.tone??"information",s=e.description?n`<span class="title">${e.label}</span><span class="vh">, </span><span class="desc">${e.description}</span>`:e.label,l=n`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${e.icon||Wd[t]||"bell"} size="14"></cm-icon></span>
|
|
2070
|
+
<span class="label">${e.unread?n`<span class="vh">${this.t("unread")}</span>`:c}${s}</span>
|
|
2071
|
+
${e.time?n`<time>${e.time}</time>`:c}`,d=`row${e.unread?" unread":""}`;return e.href?n`<a class=${d} part="row" href=${e.href} @click=${p=>o(this,re,gl).call(this,p,e)}>${l}</a>`:n`<button type="button" class=${d} part="row" @click=${p=>o(this,re,gl).call(this,p,e)}>${l}</button>`},rd=async function(e){let t=e.currentTarget;this.dispatchEvent(new CustomEvent("cm-mark-all-read",{bubbles:!0,composed:!0})),await new Promise(s=>setTimeout(s)),await this.updateComplete,!t.isConnected&&this.open&&this.renderRoot.querySelector(".panel")?.focus()},ad=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},bs.properties={...B.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}},bs.styles=[...B.overlayStyles,m`
|
|
1907
2072
|
dialog {
|
|
1908
2073
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
1909
2074
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -1925,6 +2090,22 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1925
2090
|
.critical { background: var(--cm-bg-critical); color: var(--cm-text-critical); }
|
|
1926
2091
|
.label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1927
2092
|
.unread .label { font-weight: 600; }
|
|
2093
|
+
.desc { display: block; font-weight: 400; font-size: 12px; line-height: 16px; color: var(--cm-text-tertiary); }
|
|
2094
|
+
.row:has(.desc) { align-items: flex-start; }
|
|
2095
|
+
.row:has(.desc) .ic, .row:has(.desc) time { margin-block-start: 1px; }
|
|
2096
|
+
.mark {
|
|
2097
|
+
flex: none; padding: 4px 6px; border: 0; border-radius: var(--cm-radius-sm); background: none; color: inherit;
|
|
2098
|
+
font: inherit; font-size: 12px; line-height: 16px; text-decoration: underline; cursor: pointer;
|
|
2099
|
+
}
|
|
2100
|
+
.mark:hover { text-decoration-thickness: 2px; }
|
|
2101
|
+
.mark:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
2102
|
+
.loading { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0; list-style: none; }
|
|
2103
|
+
.loading li { display: flex; align-items: center; gap: var(--cm-space-10); min-height: 40px; padding: 8px var(--cm-space-15); }
|
|
2104
|
+
.loading li:nth-child(even) { background: var(--cm-bg-hover); }
|
|
2105
|
+
.loading .sk-ic { flex: none; width: 22px; }
|
|
2106
|
+
.loading .sk-text { flex: 1; }
|
|
2107
|
+
.footer { flex: none; padding: var(--cm-space-10) var(--cm-space-15); font-size: 13px; border-top: var(--cm-border-1) solid var(--cm-border-default); }
|
|
2108
|
+
.footer[hidden] { display: none; }
|
|
1928
2109
|
time { flex: none; font-size: 11px; color: var(--cm-text-tertiary); }
|
|
1929
2110
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1930
2111
|
.more {
|
|
@@ -1936,14 +2117,14 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1936
2117
|
@media (max-width: 599px) {
|
|
1937
2118
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
1938
2119
|
}
|
|
1939
|
-
`];
|
|
2120
|
+
`];b("cm-notification-panel",bs);var Ng=w("toastRegion",{label:"Notifications"}),Yd=2e3,nd=1e4,od=150,Fr,$e,Fe,Vr,ys,$s,Z,ld,gs,vl,Ur,Kr,Wr,Yr,cd,vs=class extends y{constructor(){super(...arguments);h(this,Z);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;h(this,Fr);h(this,$e);h(this,Fe,0);h(this,Vr,0);h(this,ys,!1);h(this,$s,!1);h(this,Ur,()=>{f(this,ys,!0),o(this,Z,vl).call(this)});h(this,Kr,()=>{f(this,ys,!1),o(this,Z,gs).call(this)});h(this,Wr,()=>{f(this,$s,!0),o(this,Z,vl).call(this)});h(this,Yr,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(f(this,$s,!1),o(this,Z,gs).call(this))})}get effectiveDuration(){let e=this.duration??(this.actionLabel?nd:5e3);return Math.min(nd,Math.max(Yd,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&f(this,Fr,setTimeout(()=>{this._primed=!0},od)),this.addEventListener("pointerenter",r(this,Ur)),this.addEventListener("pointerleave",r(this,Kr)),this.addEventListener("focusin",r(this,Wr)),this.addEventListener("focusout",r(this,Yr))}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(r(this,$e)),clearTimeout(r(this,Fr)),this.removeEventListener("pointerenter",r(this,Ur)),this.removeEventListener("pointerleave",r(this,Kr)),this.removeEventListener("focusin",r(this,Wr)),this.removeEventListener("focusout",r(this,Yr))}updated(e){(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,$e)),this.open&&(this._inRegion||this._primed)&&(f(this,Fe,this.effectiveDuration),o(this,Z,gs).call(this)))}show(){this.open?(f(this,Fe,this.effectiveDuration),o(this,Z,gs).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,$e)),this.open=!1,!0):(e==="timeout"&&(f(this,Fe,this.effectiveDuration),o(this,Z,gs).call(this)),!1)}render(){let e=n`<div class="toast" part="toast">
|
|
1940
2121
|
${this.tone==="critical"?n`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:c}
|
|
1941
2122
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
1942
|
-
${this.actionLabel?n`<button class="action" part="action" @click=${
|
|
2123
|
+
${this.actionLabel?n`<button class="action" part="action" @click=${o(this,Z,cd)}>${this.actionLabel}</button>`:c}
|
|
1943
2124
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
1944
2125
|
<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>
|
|
1945
2126
|
</button>
|
|
1946
|
-
</div>`;return this._inRegion?e:n`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:c}</div>`}};
|
|
2127
|
+
</div>`;return this._inRegion?e:n`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:c}</div>`}};Fr=new WeakMap,$e=new WeakMap,Fe=new WeakMap,Vr=new WeakMap,ys=new WeakMap,$s=new WeakMap,Z=new WeakSet,ld=function(){return r(this,ys)||r(this,$s)},gs=function(){clearTimeout(r(this,$e)),!(!this.open||r(this,Z,ld))&&(f(this,Vr,Date.now()),f(this,$e,setTimeout(()=>this.dismiss("timeout"),r(this,Fe))))},vl=function(){r(this,$e)!==void 0&&(clearTimeout(r(this,$e)),f(this,$e,void 0),f(this,Fe,Math.max(1e3,r(this,Fe)-(Date.now()-r(this,Vr)))))},Ur=new WeakMap,Kr=new WeakMap,Wr=new WeakMap,Yr=new WeakMap,cd=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},vs.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},vs.styles=[g,m`
|
|
1947
2128
|
:host { display: block; pointer-events: auto; }
|
|
1948
2129
|
:host(:not([open])) { display: none; }
|
|
1949
2130
|
.toast {
|
|
@@ -1968,13 +2149,13 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1968
2149
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
1969
2150
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
1970
2151
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
1971
|
-
`];
|
|
2152
|
+
`];b("cm-toast",vs);var Gr,Xr,xs=class extends y{constructor(){super(...arguments);this.max=3;h(this,Gr,!1);h(this,Xr,e=>{let t=e.target;queueMicrotask(()=>{t.localName==="cm-toast"&&!t.open&&t.remove()})})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),f(this,Gr,!0)),this.addEventListener("cm-dismiss",r(this,Xr))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Xr))}updated(){r(this,Gr)&&this.setAttribute("aria-label",this.t("label"))}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")];return t.slice(0,Math.max(0,t.length-Math.max(1,this.max))).forEach(s=>s.remove()),e}render(){return n`<slot></slot>`}};Gr=new WeakMap,Xr=new WeakMap,xs.properties={max:{type:Number}},xs.styles=[g,m`
|
|
1972
2153
|
:host {
|
|
1973
2154
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
1974
2155
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-10);
|
|
1975
2156
|
padding-inline: var(--cm-space-15); pointer-events: none;
|
|
1976
2157
|
}
|
|
1977
|
-
`];
|
|
2158
|
+
`];b("cm-toast-region",xs);function Gd(a,i={}){let e=i.root??document.body,t=e.querySelector(":scope > cm-toast-region"),s=!t;t||(t=document.createElement("cm-toast-region"),e.append(t));let l=document.createElement("cm-toast");if(l.message=String(a),i.tone&&(l.tone=i.tone),i.duration!==void 0&&(l.duration=i.duration),i.action){l.actionLabel=i.action.label;let d=i.action.onAction;l.addEventListener("cm-action",()=>d())}if(s){let d=t;return setTimeout(()=>d.add(l),od),l}return t.add(l)}var Bg=w("progressBar",{inProgress:"In progress"}),Kn,ws=class extends y{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";h(this,Kn,S("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,Kn)}-label`;return n`
|
|
1978
2159
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
1979
2160
|
<span id=${t} part="label">${this.label}</span>
|
|
1980
2161
|
${this.showValue&&e!==null?n`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:c}
|
|
@@ -1984,7 +2165,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1984
2165
|
aria-valuenow=${e===null?c:Math.round(e)}
|
|
1985
2166
|
aria-valuetext=${e===null?this.t("inProgress"):this.formatNumber(Math.round(e)/100,{style:"percent"})}>
|
|
1986
2167
|
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
1987
|
-
</div>`}};
|
|
2168
|
+
</div>`}};Kn=new WeakMap,ws.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},ws.styles=[g,m`
|
|
1988
2169
|
:host { display: block; }
|
|
1989
2170
|
.head { display: flex; justify-content: space-between; gap: var(--cm-space-10); margin-block-end: 6px; font-size: 14px; line-height: 20px; }
|
|
1990
2171
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
@@ -2001,7 +2182,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2001
2182
|
.fill { transition: none; }
|
|
2002
2183
|
.indeterminate .fill { animation-duration: 4s; }
|
|
2003
2184
|
}
|
|
2004
|
-
`];
|
|
2185
|
+
`];b("cm-progress-bar",ws);var ks=class extends k{constructor(){super(...arguments);this.tone="neutral"}render(){return n`<span part="badge"><slot></slot></span>`}};ks.properties={tone:{reflect:!0}},ks.styles=[g,m`
|
|
2005
2186
|
:host { display: inline-flex; vertical-align: middle; }
|
|
2006
2187
|
span {
|
|
2007
2188
|
display: inline-flex; align-items: center; height: 28px; padding: 0 var(--cm-space-10);
|
|
@@ -2013,11 +2194,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2013
2194
|
: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); }
|
|
2014
2195
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
2015
2196
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
2016
|
-
`];
|
|
2197
|
+
`];b("cm-badge",ks);var Es=class extends k{constructor(){super(...arguments);this.heading="";this.description="";this.flush=!1;this.headingLevel=2}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=this.heading?n`<div role="heading" aria-level=${e} class="title" part="title">${this.heading}<slot name="title-adornment"></slot></div>`:c;return n`<section part="card" aria-label=${this.heading||c}>
|
|
2017
2198
|
${this.heading||this.description?n`<header><div>${t}${this.description?n`<p class="desc">${this.description}</p>`:c}</div>
|
|
2018
2199
|
<div class="actions"><slot name="actions"></slot></div></header>`:c}
|
|
2019
2200
|
<slot></slot>
|
|
2020
|
-
</section>`}};
|
|
2201
|
+
</section>`}};Es.properties={heading:{},description:{},flush:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Es.styles=[g,m`
|
|
2021
2202
|
:host { display: block; }
|
|
2022
2203
|
section {
|
|
2023
2204
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card);
|
|
@@ -2029,8 +2210,8 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2029
2210
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); font-weight: 600; display: flex; align-items: center; gap: var(--cm-space-10); }
|
|
2030
2211
|
.desc { margin: 6px 0 0; font-size: 16px; color: var(--cm-text-tertiary); }
|
|
2031
2212
|
.actions { display: flex; gap: var(--cm-space-20); align-items: center; }
|
|
2032
|
-
`];
|
|
2033
|
-
`))}var
|
|
2213
|
+
`];b("cm-card",Es);var Xd=["0","10","12","15","20","22","30"];function Ms(a,i){return ta(Xd.map(e=>`:host([${a}='${e}']) { ${i}: ${e==="0"?"0px":`var(--cm-space-${e})`}; }`).join(`
|
|
2214
|
+
`))}var _s=class extends k{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return n`<slot></slot>`}};_s.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},_s.styles=[g,m`
|
|
2034
2215
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
2035
2216
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
2036
2217
|
:host([wrap]) { flex-wrap: wrap; }
|
|
@@ -2043,13 +2224,13 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2043
2224
|
:host([justify='center']) { justify-content: center; }
|
|
2044
2225
|
:host([justify='end']) { justify-content: flex-end; }
|
|
2045
2226
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
2046
|
-
`,
|
|
2227
|
+
`,Ms("gap","gap")];b("cm-stack",_s);var dd="important",Jd=" !"+dd,hd=ga(class extends Bt{constructor(a){if(super(a),a.type!==Le.ATTRIBUTE||a.name!=="style"||a.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(a){return Object.keys(a).reduce((i,e)=>{let t=a[e];return t==null?i:i+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(a,[i]){let{style:e}=a.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let t of this.ft)i[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in i){let s=i[t];if(s!=null){this.ft.add(t);let l=typeof s=="string"&&s.endsWith(Jd);t.includes("-")||l?e.setProperty(t,l?s.slice(0,-11):s,l?dd:""):e[t]=s}}return Q}});var zs=class extends k{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(),s=t?`repeat(auto-fit, minmax(min(100%, ${t}), 1fr))`:`repeat(${e}, minmax(0, 1fr))`;return n`<div class="grid ${t?"fit":"fixed"}" part="grid" style=${hd({gridTemplateColumns:s})}><slot></slot></div>`}};zs.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},zs.styles=[g,m`
|
|
2047
2228
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
2048
2229
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
2049
2230
|
@container cm-grid (max-width: 640px) {
|
|
2050
2231
|
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
2051
2232
|
}
|
|
2052
|
-
`,
|
|
2233
|
+
`,Ms("gap","--_gap")];b("cm-grid",zs);var Ss=class extends k{constructor(){super(...arguments);this.gap="20"}render(){return n`<div class="layout" part="layout"><slot></slot></div>`}};Ss.properties={gap:{reflect:!0}},Ss.styles=[g,m`
|
|
2053
2234
|
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-20); }
|
|
2054
2235
|
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
2055
2236
|
@container cm-layout (max-width: 767px) {
|
|
@@ -2063,9 +2244,39 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2063
2244
|
::slotted([variant='one-third']) { grid-column: span 2; }
|
|
2064
2245
|
::slotted([variant='two-thirds']) { grid-column: span 4; }
|
|
2065
2246
|
}
|
|
2066
|
-
`,
|
|
2247
|
+
`,Ms("gap","--_gap")];var Ts=class extends k{constructor(){super(...arguments);this.variant="full"}render(){return n`<slot></slot>`}};Ts.properties={variant:{reflect:!0}},Ts.styles=[g,m`
|
|
2067
2248
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
2068
|
-
`];
|
|
2249
|
+
`];b("cm-layout",Ss);b("cm-layout-section",Ts);var xl=1024,Zd=()=>{let a=document.activeElement;for(;a?.shadowRoot?.activeElement;)a=a.shadowRoot.activeElement;return a},It,Cs,ae,yl,Rt,pd,Jr,Zr,Ls=class extends k{constructor(){super(...arguments);h(this,ae);this.menuOpen=!1;this.menuItem="";this._wide=!1;h(this,It);h(this,Cs,null);h(this,Jr,e=>{if(!this.menuItem)return;let t=o(this,ae,pd).call(this,e),s=e.detail?.value;t==="bottom-navigation"&&s===this.menuItem?o(this,ae,Rt).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&o(this,ae,Rt).call(this,!1,!1)});h(this,Zr,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),o(this,ae,Rt).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,Jr)),this.addEventListener("keydown",r(this,Zr));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=xl)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,Jr)),this.removeEventListener("keydown",r(this,Zr)),r(this,It)?.disconnect(),f(this,It,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;f(this,It,new ResizeObserver(()=>{o(this,ae,yl).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=xl!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=xl}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,It).observe(t))}updated(e){e.has("_wide")&&o(this,ae,yl).call(this)}openMenu(){o(this,ae,Rt).call(this,!0)}closeMenu(){o(this,ae,Rt).call(this,!1)}toggleMenu(){o(this,ae,Rt).call(this,!this.menuOpen)}render(){let e=this._wide,t=this.menuOpen&&!e&&!!this.querySelector(':scope > [slot="mobile-menu"]');return n`<div class="frame ${e?"wide":""}" part="frame">
|
|
2250
|
+
<div class="probe"></div>
|
|
2251
|
+
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
2252
|
+
<div class="body">
|
|
2253
|
+
<div class="nav" part="navigation" ?hidden=${!e}><slot name="navigation"></slot></div>
|
|
2254
|
+
<main part="main" ?inert=${t}><slot></slot></main>
|
|
2255
|
+
</div>
|
|
2256
|
+
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
2257
|
+
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
2258
|
+
</div>`}};It=new WeakMap,Cs=new WeakMap,ae=new WeakSet,yl=function(){let e=this.renderRoot.querySelector(".frame");if(!e)return;let t=s=>Math.round(this.renderRoot.querySelector(s)?.getBoundingClientRect().height??0);e.style.setProperty("--_header",`${t(".header")}px`),e.style.setProperty("--_bottom",`${this._wide?0:t(".bottom")}px`)},Rt=function(e,t=!0){e!==this.menuOpen&&(e&&f(this,Cs,Zd()),this.menuOpen=e,this.dispatchEvent(new CustomEvent("cm-menu-toggle",{bubbles:!0,composed:!0,detail:{open:e}})),this.updateComplete.then(()=>{if(e){let s=this.querySelector(':scope > [slot="mobile-menu"]');(s?.shadowRoot??s)?.querySelector("a[href], button")?.focus()}else t&&(r(this,Cs)?.focus(),f(this,Cs,null))}))},pd=function(e){return e.composedPath().find(s=>s.parentElement===this)?.getAttribute("slot")??""},Jr=new WeakMap,Zr=new WeakMap,Ls.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},_wide:{state:!0}},Ls.styles=[g,m`
|
|
2259
|
+
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
2260
|
+
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
2261
|
+
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
2262
|
+
.wide .body { grid-template-columns: auto minmax(0, 1fr); }
|
|
2263
|
+
.nav {
|
|
2264
|
+
position: sticky; inset-block-start: var(--_header); box-sizing: border-box;
|
|
2265
|
+
max-block-size: calc(var(--cm-app-frame-height, 100dvh) - var(--_header));
|
|
2266
|
+
overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
|
|
2267
|
+
padding: var(--cm-space-20); padding-inline-end: 0;
|
|
2268
|
+
}
|
|
2269
|
+
main { display: block; min-inline-size: 0; padding-block-end: var(--_bottom); }
|
|
2270
|
+
main:focus { outline: none; }
|
|
2271
|
+
.bottom { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40; }
|
|
2272
|
+
::slotted([slot='bottom-navigation']) { position: static; }
|
|
2273
|
+
.menu {
|
|
2274
|
+
position: fixed; inset: 0; z-index: 35; overflow-y: auto; overscroll-behavior: contain;
|
|
2275
|
+
padding-block: env(safe-area-inset-top, 0px) var(--_bottom); background: var(--cm-bg-page);
|
|
2276
|
+
}
|
|
2277
|
+
.probe { block-size: 0; }
|
|
2278
|
+
[hidden] { display: none !important; }
|
|
2279
|
+
`];b("cm-app-frame",Ls);var As=class extends k{constructor(){super(...arguments);this.fullWidth=!1;this.narrow=!1}render(){return n`<slot name="header"></slot><div class="content" part="content"><slot></slot></div><slot name="footer"></slot>`}};As.properties={fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},As.styles=[g,m`
|
|
2069
2280
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-bg-page); min-block-size: 100%; }
|
|
2070
2281
|
.content {
|
|
2071
2282
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
@@ -2074,16 +2285,16 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2074
2285
|
:host([narrow]) .content { max-inline-size: 800px; }
|
|
2075
2286
|
:host([full-width]) .content { max-inline-size: none; }
|
|
2076
2287
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-10); } }
|
|
2077
|
-
`];
|
|
2288
|
+
`];b("cm-page",As);var Ns,md,ud,Ds=class extends y{constructor(){super(...arguments);h(this,Ns);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?js`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:js`<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 n`<div class="banner" part="banner" role=${e}>
|
|
2078
2289
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
2079
2290
|
<div class="body">
|
|
2080
2291
|
${this.heading?n`<p class="title">${this.heading}</p>`:c}
|
|
2081
2292
|
<div><slot></slot></div>
|
|
2082
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${
|
|
2293
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${o(this,Ns,md)}></slot></div>
|
|
2083
2294
|
</div>
|
|
2084
|
-
${this.dismissible?n`<button class="close" aria-label=${this.t("dismiss")} @click=${
|
|
2295
|
+
${this.dismissible?n`<button class="close" aria-label=${this.t("dismiss")} @click=${o(this,Ns,ud)}>
|
|
2085
2296
|
<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>`:c}
|
|
2086
|
-
</div>`}};
|
|
2297
|
+
</div>`}};Ns=new WeakSet,md=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},ud=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},Ds.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},Ds.styles=[g,m`
|
|
2087
2298
|
:host { display: block; }
|
|
2088
2299
|
.banner {
|
|
2089
2300
|
display: flex; gap: var(--cm-space-15); align-items: flex-start;
|
|
@@ -2106,25 +2317,10 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2106
2317
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
2107
2318
|
}
|
|
2108
2319
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2109
|
-
`];
|
|
2110
|
-
data-side=${this._side}>${this.content}</div>`}};B=new WeakMap,vs=new WeakMap,st=new WeakMap,rt=new WeakMap,ke=new WeakMap,xs=new WeakMap,ys=new WeakMap,re=new WeakSet,Ro=function(){document.removeEventListener("keydown",r(this,$s),!0),removeEventListener("scroll",r(this,qe),!0),removeEventListener("resize",r(this,qe))},gn=new WeakMap,vn=new WeakMap,xn=new WeakMap,yn=new WeakMap,$s=new WeakMap,Mc=function(e){return e.matches(fn)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(fn)??e},Tt=new WeakMap,Ho=function(e){g(this,st,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),s=r(this,st).map(o=>t.getElementById(o)).filter(o=>!!o);e.ariaDescribedByElements=[...s,r(this,B)]},qo=function(){let e=r(this,vs);if(!(!e||!r(this,B))){if(r(this,rt))r(this,rt).disconnect(),g(this,rt,void 0),r(this,st).length?e.setAttribute("aria-describedby",r(this,st).join(" ")):e.removeAttribute("aria-describedby"),g(this,st,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(s=>s&&s!==r(this,B).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,vs,void 0)}},qe=new WeakMap,gs.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},_side:{state:!0}},gs.styles=[f,m`
|
|
2111
|
-
:host { display: inline-block; position: relative; }
|
|
2112
|
-
.tip {
|
|
2113
|
-
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
2114
|
-
max-width: min(280px, calc(100vw - 16px)); width: max-content;
|
|
2115
|
-
padding: 6px var(--cm-space-10); border-radius: var(--cm-radius-sm);
|
|
2116
|
-
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
2117
|
-
font-size: 12px; line-height: 16px; font-weight: 400; white-space: normal; overflow-wrap: anywhere;
|
|
2118
|
-
box-shadow: var(--cm-shadow-100); pointer-events: auto;
|
|
2119
|
-
opacity: 0; visibility: hidden; transition: opacity 120ms ease;
|
|
2120
|
-
}
|
|
2121
|
-
:host([open]) .tip { opacity: 1; visibility: visible; }
|
|
2122
|
-
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
2123
|
-
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
2124
|
-
`];u("cm-tooltip",gs);var Lg=$("thumbnail",{noImage:"{alt} (no image)"}),ws=class extends x{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 n`<span class="box" part="thumbnail"><img src=${this.src} alt=${this.alt} loading=${this.loading}
|
|
2320
|
+
`];b("cm-banner",Ds);var Nv=w("thumbnail",{noImage:"{alt} (no image)"}),Rs=class extends y{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 n`<span class="box" part="thumbnail"><img src=${this.src} alt=${this.alt} loading=${this.loading}
|
|
2125
2321
|
@error=${()=>{this._failed=!0}}></span>`;let e=this.size==="small"?18:this.size==="large"?32:24;return n`<span class="box" part="thumbnail" role=${this.alt?"img":c}
|
|
2126
2322
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):c} aria-hidden=${this.alt?c:"true"}>
|
|
2127
|
-
<cm-icon name="box" size=${e}></cm-icon></span>`}};
|
|
2323
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};Rs.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},Rs.styles=[g,m`
|
|
2128
2324
|
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
2129
2325
|
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
2130
2326
|
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
@@ -2134,7 +2330,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
2134
2330
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
2135
2331
|
}
|
|
2136
2332
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
2137
|
-
`];
|
|
2333
|
+
`];b("cm-thumbnail",Rs);export{yi as CmAccordion,fi as CmActionBar,Oi as CmActionMenu,cs as CmAppCard,Ls as CmAppFrame,es as CmAvatar,ks as CmBadge,Ds as CmBanner,as as CmBottomNavigation,ms as CmBottomSheet,bt as CmButton,Es as CmCard,Ke as CmCheckbox,Qe as CmCombobox,Mi as CmComment,_i as CmCommentBox,Ni as CmDataTable,tt as CmDatePicker,st as CmDateRangePicker,$i as CmEmptyState,at as CmFileUpload,hs as CmFilterPanel,os as CmFlashOfferBar,wt as CmGlobalSearch,zs as CmGrid,is as CmHeaderBar,Pt as CmIcon,xi as CmInfoItem,vi as CmInfoPanel,Ss as CmLayout,Ts as CmLayoutSection,ls as CmLinkTabs,y as CmLocalizedElement,Ii as CmMenuItem,ns as CmMobileMenu,ds as CmModal,Ui as CmNavItem,_n as CmNestedItem,Fi as CmNestedList,us as CmNotificationItem,bs as CmNotificationPanel,Et as CmOptionGroup,As as CmPage,bi as CmPageHeader,Ti as CmPagination,ws as CmProgressBar,vt as CmRadio,xt as CmRadioGroup,Lt as CmReportTile,Vi as CmReportTiles,Bi as CmResourceItem,ji as CmResourceList,gi as CmSaveBar,Je as CmSearch,Xe as CmSelect,Ji as CmSideNavigation,ze as CmSidePanel,ki as CmSkeleton,Ei as CmSkeletonDisplay,zi as CmSmartTip,Si as CmSmartTips,Jt as CmSpinner,_s as CmStack,Ci as CmStatusTabs,Ai as CmTableHeader,Xt as CmTag,Ve as CmTextField,Rs as CmThumbnail,vs as CmToast,xs as CmToastRegion,Ye as CmToggle,Ki as CmTooltip,Ld as configure,w as defineStrings,Kl as directionalIcons,we as formatDate,Fl as formatMessage,oo as formatNumber,Sd as getDefaultStrings,Gc as initials,Us as localeFor,pa as pluralCategory,Cd as resetStrings,oc as resolvePreset,Td as setStrings,Gd as showToast,Vl as translate};
|
|
2138
2334
|
/*! Bundled license information:
|
|
2139
2335
|
|
|
2140
2336
|
@lit/reactive-element/css-tag.js:
|