@commmerce/ui 1.6.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +822 -679
- package/dist/components/button-group.d.ts +90 -0
- package/dist/components/button-group.js +290 -0
- package/dist/components/command-palette.d.ts +197 -0
- package/dist/components/command-palette.js +325 -0
- package/dist/components/data-table.d.ts +6 -0
- package/dist/components/data-table.js +24 -4
- package/dist/components/global-search.js +10 -37
- package/dist/components/info-panel.d.ts +19 -1
- package/dist/components/info-panel.js +26 -3
- package/dist/components/layout.d.ts +48 -2
- package/dist/components/layout.js +134 -5
- package/dist/components/page-header.d.ts +22 -2
- package/dist/components/page-header.js +25 -5
- package/dist/components/status-tabs.js +7 -2
- package/dist/components/toast.d.ts +38 -1
- package/dist/components/toast.js +163 -15
- package/dist/custom-elements.json +4314 -2522
- package/dist/index.d.ts +6 -2
- package/dist/index.js +4 -1
- package/dist/overlay.d.ts +5 -0
- package/dist/overlay.js +17 -5
- package/dist/popover.d.ts +32 -0
- package/dist/popover.js +55 -1
- package/dist/shortcut.d.ts +21 -0
- package/dist/shortcut.js +107 -0
- package/package.json +3 -3
package/dist/cdn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
var Ru=o=>{throw TypeError(o)};var Uh=(o,n,e)=>n.has(o)||Ru("Cannot "+e);var r=(o,n,e)=>(Uh(o,n,"read from private field"),e?e.call(o):n.get(o)),p=(o,n,e)=>n.has(o)?Ru("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),g=(o,n,e,t)=>(Uh(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),s=(o,n,e)=>(Uh(o,n,"access private method"),e);var Zl=globalThis,Ql=Zl.ShadowRoot&&(Zl.ShadyCSS===void 0||Zl.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vh=Symbol(),Hu=new WeakMap,_n=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==Vh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=n,this.t=e}get styleSheet(){let n=this.o,e=this.t;if(Ql&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=Hu.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&Hu.set(e,n))}return n}toString(){return this.cssText}},ec=o=>new _n(typeof o=="string"?o:o+"",void 0,Vh),x=(o,...n)=>{let e=o.length===1?o[0]:n.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[a+1],o[0]);return new _n(e,o,Vh)},Nu=(o,n)=>{if(Ql)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=Zl.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Kh=Ql?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return ec(e)})(o):o;var{is:Cv,defineProperty:Sv,getOwnPropertyDescriptor:Lv,getOwnPropertyNames:Dv,getOwnPropertySymbols:Av,getPrototypeOf:Rv}=Object,tc=globalThis,Iu=tc.trustedTypes,Hv=Iu?Iu.emptyScript:"",Nv=tc.reactiveElementPolyfillSupport,Cn=(o,n)=>o,Wh={toAttribute(o,n){switch(n){case Boolean:o=o?Hv:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,n){let e=o;switch(n){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Ou=(o,n)=>!Cv(o,n),Pu={attribute:!0,type:String,converter:Wh,reflect:!1,useDefault:!1,hasChanged:Ou};Symbol.metadata??=Symbol("metadata"),tc.litPropertyMetadata??=new WeakMap;var _t=class extends HTMLElement{static addInitializer(n){this._$Ei(),(this.l??=[]).push(n)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(n,e=Pu){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(n)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(n,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(n,t,e);i!==void 0&&Sv(this.prototype,n,i)}}static getPropertyDescriptor(n,e,t){let{get:i,set:a}=Lv(this.prototype,n)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let d=i?.call(this);a?.call(this,l),this.requestUpdate(n,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(n){return this.elementProperties.get(n)??Pu}static _$Ei(){if(this.hasOwnProperty(Cn("elementProperties")))return;let n=Rv(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(Cn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Cn("properties"))){let e=this.properties,t=[...Dv(e),...Av(e)];for(let i of t)this.createProperty(i,e[i])}let n=this[Symbol.metadata];if(n!==null){let e=litPropertyMetadata.get(n);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(n){let e=[];if(Array.isArray(n)){let t=new Set(n.flat(1/0).reverse());for(let i of t)e.unshift(Kh(i))}else n!==void 0&&e.push(Kh(n));return e}static _$Eu(n,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof n=="string"?n.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(n=>n(this))}addController(n){(this._$EO??=new Set).add(n),this.renderRoot!==void 0&&this.isConnected&&n.hostConnected?.()}removeController(n){this._$EO?.delete(n)}_$E_(){let n=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(n.set(t,this[t]),delete this[t]);n.size>0&&(this._$Ep=n)}createRenderRoot(){let n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nu(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(n=>n.hostConnected?.())}enableUpdating(n){}disconnectedCallback(){this._$EO?.forEach(n=>n.hostDisconnected?.())}attributeChangedCallback(n,e,t){this._$AK(n,t)}_$ET(n,e){let t=this.constructor.elementProperties.get(n),i=this.constructor._$Eu(n,t);if(i!==void 0&&t.reflect===!0){let a=(t.converter?.toAttribute!==void 0?t.converter:Wh).toAttribute(e,t.type);this._$Em=n,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(n,e){let t=this.constructor,i=t._$Eh.get(n);if(i!==void 0&&this._$Em!==i){let a=t.getPropertyOptions(i),l=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Wh;this._$Em=i;let d=l.fromAttribute(e,a.type);this[i]=d??this._$Ej?.get(i)??d,this._$Em=null}}requestUpdate(n,e,t,i=!1,a){if(n!==void 0){let l=this.constructor;if(i===!1&&(a=this[n]),t??=l.getPropertyOptions(n),!((t.hasChanged??Ou)(a,e)||t.useDefault&&t.reflect&&a===this._$Ej?.get(n)&&!this.hasAttribute(l._$Eu(n,t))))return;this.C(n,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(n,e,{useDefault:t,reflect:i,wrapped:a},l){t&&!(this._$Ej??=new Map).has(n)&&(this._$Ej.set(n,l??e??this[n]),a!==!0||l!==void 0)||(this._$AL.has(n)||(this.hasUpdated||t||(e=void 0),this._$AL.set(n,e)),i===!0&&this._$Em!==n&&(this._$Eq??=new Set).add(n))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let n=this.scheduleUpdate();return n!=null&&await n,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,a]of t){let{wrapped:l}=a,d=this[i];l!==!0||this._$AL.has(i)||d===void 0||this.C(i,void 0,a,d)}}let n=!1,e=this._$AL;try{n=this.shouldUpdate(e),n?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw n=!1,this._$EM(),t}n&&this._$AE(e)}willUpdate(n){}_$AE(n){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(n)),this.updated(n)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(n){return!0}update(n){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(n){}firstUpdated(n){}};_t.elementStyles=[],_t.shadowRootOptions={mode:"open"},_t[Cn("elementProperties")]=new Map,_t[Cn("finalized")]=new Map,Nv?.({ReactiveElement:_t}),(tc.reactiveElementVersions??=[]).push("2.1.2");var Yh=globalThis,qu=o=>o,ic=Yh.trustedTypes,Bu=ic?ic.createPolicy("lit-html",{createHTML:o=>o}):void 0,Xh="$lit$",Ct=`lit$${Math.random().toFixed(9).slice(2)}$`,Jh="?"+Ct,Iv=`<${Jh}>`,Pi=document,Ln=()=>Pi.createComment(""),Dn=o=>o===null||typeof o!="object"&&typeof o!="function",Zh=Array.isArray,Wu=o=>Zh(o)||typeof o?.[Symbol.iterator]=="function",Gh=`[
|
|
2
|
+
\f\r]`,Sn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fu=/-->/g,ju=/>/g,Ni=RegExp(`>|${Gh}(?:([^\\s"'>=/]+)(${Gh}*=${Gh}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Uu=/'/g,Vu=/"/g,Gu=/^(?:script|style|textarea|title)$/i,Qh=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=Qh(1),Rn=Qh(2),qy=Qh(3),we=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Ku=new WeakMap,Ii=Pi.createTreeWalker(Pi,129);function Yu(o,n){if(!Zh(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bu!==void 0?Bu.createHTML(n):n}var Xu=(o,n)=>{let e=o.length-1,t=[],i,a=n===2?"<svg>":n===3?"<math>":"",l=Sn;for(let d=0;d<e;d++){let m=o[d],u,v,b=-1,w=0;for(;w<m.length&&(l.lastIndex=w,v=l.exec(m),v!==null);)w=l.lastIndex,l===Sn?v[1]==="!--"?l=Fu:v[1]!==void 0?l=ju:v[2]!==void 0?(Gu.test(v[2])&&(i=RegExp("</"+v[2],"g")),l=Ni):v[3]!==void 0&&(l=Ni):l===Ni?v[0]===">"?(l=i??Sn,b=-1):v[1]===void 0?b=-2:(b=l.lastIndex-v[2].length,u=v[1],l=v[3]===void 0?Ni:v[3]==='"'?Vu:Uu):l===Vu||l===Uu?l=Ni:l===Fu||l===ju?l=Sn:(l=Ni,i=void 0);let y=l===Ni&&o[d+1].startsWith("/>")?" ":"";a+=l===Sn?m+Iv:b>=0?(t.push(u),m.slice(0,b)+Xh+m.slice(b)+Ct+y):m+Ct+(b===-2?d:y)}return[Yu(o,a+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},An=class o{constructor({strings:n,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,d=n.length-1,m=this.parts,[u,v]=Xu(n,e);if(this.el=o.createElement(u,t),Ii.currentNode=this.el.content,e===2||e===3){let b=this.el.content.firstChild;b.replaceWith(...b.childNodes)}for(;(i=Ii.nextNode())!==null&&m.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let b of i.getAttributeNames())if(b.endsWith(Xh)){let w=v[l++],y=i.getAttribute(b).split(Ct),M=/([.?@])?(.*)/.exec(w);m.push({type:1,index:a,name:M[2],strings:y,ctor:M[1]==="."?ac:M[1]==="?"?sc:M[1]==="@"?nc:qi}),i.removeAttribute(b)}else b.startsWith(Ct)&&(m.push({type:6,index:a}),i.removeAttribute(b));if(Gu.test(i.tagName)){let b=i.textContent.split(Ct),w=b.length-1;if(w>0){i.textContent=ic?ic.emptyScript:"";for(let y=0;y<w;y++)i.append(b[y],Ln()),Ii.nextNode(),m.push({type:2,index:++a});i.append(b[w],Ln())}}}else if(i.nodeType===8)if(i.data===Jh)m.push({type:2,index:a});else{let b=-1;for(;(b=i.data.indexOf(Ct,b+1))!==-1;)m.push({type:7,index:a}),b+=Ct.length-1}a++}}static createElement(n,e){let t=Pi.createElement("template");return t.innerHTML=n,t}};function Oi(o,n,e=o,t){if(n===we)return n;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Dn(n)?void 0:n._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(n=Oi(o,i._$AS(o,n.values),i,t)),n}var rc=class{constructor(n,e){this._$AV=[],this._$AN=void 0,this._$AD=n,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(n){let{el:{content:e},parts:t}=this._$AD,i=(n?.creationScope??Pi).importNode(e,!0);Ii.currentNode=i;let a=Ii.nextNode(),l=0,d=0,m=t[0];for(;m!==void 0;){if(l===m.index){let u;m.type===2?u=new qr(a,a.nextSibling,this,n):m.type===1?u=new m.ctor(a,m.name,m.strings,this,n):m.type===6&&(u=new oc(a,this,n)),this._$AV.push(u),m=t[++d]}l!==m?.index&&(a=Ii.nextNode(),l++)}return Ii.currentNode=Pi,i}p(n){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(n,t,e),e+=t.strings.length-2):t._$AI(n[e])),e++}},qr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(n,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=n,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let n=this._$AA.parentNode,e=this._$AM;return e!==void 0&&n?.nodeType===11&&(n=e.parentNode),n}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(n,e=this){n=Oi(this,n,e),Dn(n)?n===h||n==null||n===""?(this._$AH!==h&&this._$AR(),this._$AH=h):n!==this._$AH&&n!==we&&this._(n):n._$litType$!==void 0?this.$(n):n.nodeType!==void 0?this.T(n):Wu(n)?this.k(n):this._(n)}O(n){return this._$AA.parentNode.insertBefore(n,this._$AB)}T(n){this._$AH!==n&&(this._$AR(),this._$AH=this.O(n))}_(n){this._$AH!==h&&Dn(this._$AH)?this._$AA.nextSibling.data=n:this.T(Pi.createTextNode(n)),this._$AH=n}$(n){let{values:e,_$litType$:t}=n,i=typeof t=="number"?this._$AC(n):(t.el===void 0&&(t.el=An.createElement(Yu(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let a=new rc(i,this),l=a.u(this.options);a.p(e),this.T(l),this._$AH=a}}_$AC(n){let e=Ku.get(n.strings);return e===void 0&&Ku.set(n.strings,e=new An(n)),e}k(n){Zh(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let a of n)i===e.length?e.push(t=new o(this.O(Ln()),this.O(Ln()),this,this.options)):t=e[i],t._$AI(a),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(n=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);n!==this._$AB;){let t=qu(n).nextSibling;qu(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},qi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(n,e,t,i,a){this.type=1,this._$AH=h,this._$AN=void 0,this.element=n,this.name=e,this._$AM=i,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(n,e=this,t,i){let a=this.strings,l=!1;if(a===void 0)n=Oi(this,n,e,0),l=!Dn(n)||n!==this._$AH&&n!==we,l&&(this._$AH=n);else{let d=n,m,u;for(n=a[0],m=0;m<a.length-1;m++)u=Oi(this,d[t+m],e,m),u===we&&(u=this._$AH[m]),l||=!Dn(u)||u!==this._$AH[m],u===h?n=h:n!==h&&(n+=(u??"")+a[m+1]),this._$AH[m]=u}l&&!i&&this.j(n)}j(n){n===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}},ac=class extends qi{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},sc=class extends qi{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},nc=class extends qi{constructor(n,e,t,i,a){super(n,e,t,i,a),this.type=5}_$AI(n,e=this){if((n=Oi(this,n,e,0)??h)===we)return;let t=this._$AH,i=n===h&&t!==h||n.capture!==t.capture||n.once!==t.once||n.passive!==t.passive,a=n!==h&&(t===h||i);i&&this.element.removeEventListener(this.name,this,t),a&&this.element.addEventListener(this.name,this,n),this._$AH=n}handleEvent(n){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,n):this._$AH.handleEvent(n)}},oc=class{constructor(n,e,t){this.element=n,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(n){Oi(this,n)}},Ju={M:Xh,P:Ct,A:Jh,C:1,L:Xu,R:rc,D:Wu,V:Oi,I:qr,H:qi,N:sc,U:nc,B:ac,F:oc},Pv=Yh.litHtmlPolyfillSupport;Pv?.(An,qr),(Yh.litHtmlVersions??=[]).push("3.3.3");var Zu=(o,n,e)=>{let t=e?.renderBefore??n,i=t._$litPart$;if(i===void 0){let a=e?.renderBefore??null;t._$litPart$=i=new qr(n.insertBefore(Ln(),a),a,void 0,e??{})}return i._$AI(o),i};var em=globalThis,S=class extends _t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let n=super.createRenderRoot();return this.renderOptions.renderBefore??=n.firstChild,n}update(n){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(n),this._$Do=Zu(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return we}};S._$litElement$=!0,S.finalized=!0,em.litElementHydrateSupport?.({LitElement:S});var Ov=em.litElementPolyfillSupport;Ov?.({LitElement:S});(em.litElementVersions??=[]).push("4.2.2");var k=x`
|
|
4
4
|
:host {
|
|
5
5
|
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
6
|
color: var(--cm-text-default, #000);
|
|
@@ -8,20 +8,20 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,ex=x`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
14
|
+
`,qv=0,A=o=>`${o}-${++qv}`;function $(o,n){customElements.get(o)||customElements.define(o,n)}function J(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Bv={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},lc={common:{...Bv}},Hn={},Nn={},cc;function z(o,n){return lc[o]={...lc[o],...n},n}function Fv(){return Object.fromEntries(Object.entries(lc).map(([o,n])=>[o,{...n}]))}function dc(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function jv(o,n){dc(n?Nn[n.toLowerCase()]??={}:Hn,o),pc()}function Uv(o={}){"locale"in o&&(cc=o.locale||void 0),o.strings&&dc(Hn,o.strings);for(let[n,e]of Object.entries(o.translations??{}))dc(Nn[n.toLowerCase()]??={},e);pc()}function Vv(){cc=void 0;for(let o of Object.keys(Hn))delete Hn[o];for(let o of Object.keys(Nn))delete Nn[o];pc()}function In(o){if(cc)return cc;let n=o;for(;n;){if(n instanceof Element&&n.hasAttribute("lang")&&n.getAttribute("lang"))return n.getAttribute("lang");n=n.parentNode??(n instanceof ShadowRoot?n.host:null)}if(typeof document<"u"&&document.documentElement.lang)return document.documentElement.lang}var Qu=new Map;function rm(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,a=Qu.get(i);if(!a){try{a=t(n)}catch{a=t(void 0)}Qu.set(i,a)}return a}function am(o,n={},e){return rm("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function ae(o,n={},e){return rm("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function hc(o,n){return rm("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function eg(o,n={},e){if(o==null)return"";if(typeof o=="function")return String(o(n));let t;if(typeof o=="object"){let i=Number(n.count??0);t=o[hc(i,e)]??o.other??""}else t=String(o);return t.replace(/\{(\w+)\}/g,(i,a)=>{let l=n[a];return l===void 0?i:typeof l=="number"?am(l,{},e):String(l)})}function Kv(o,n,e,t){if(t&&t[n]!==void 0)return t[n];let i=[];if(e){let a=e.toLowerCase().split("-");for(let l=a.length;l>0;l--)i.push(a.slice(0,l).join("-"))}for(let a of o==="common"?["common"]:[o,"common"]){for(let d of i){let m=Nn[d]?.[a]?.[n];if(m!==void 0)return m}let l=Hn[a]?.[n]??lc[a]?.[n];if(l!==void 0)return l}}function mc(o,n,e,t,i){let a=In(t);return eg(Kv(o,n,a,i),e,a)}var im=new Set,tm;function pc(){for(let o of im)o.requestUpdate()}function Wv(){tm||typeof MutationObserver>"u"||typeof document>"u"||(tm=new MutationObserver(pc),tm.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var Gv=o=>o.replace(/^cm-/,"").replace(/-([a-z])/g,(n,e)=>e.toUpperCase()),T=class extends S{static finalize(){let n=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);if(!n(this,"finalized")&&n(this,"properties"))for(let[e,t]of Object.entries(this.properties)){let i=t.string;if(!i||n(this.prototype,e))continue;let a=Symbol(e);Object.defineProperty(this.prototype,e,{get(){return this[a]??this.t(i)},set(l){this[a]=l},configurable:!0,enumerable:!0})}super.finalize()}get stringsNamespace(){return Gv(this.localName)}t(n,e){return mc(this.stringsNamespace,n,e,this,this.strings)}get locale(){return In(this)}formatNumber(n,e){return am(n,e,this.locale)}connectedCallback(){super.connectedCallback(),im.add(this),Wv()}disconnectedCallback(){super.disconnectedCallback(),im.delete(this)}};T.properties={strings:{type:Object}};var uc={"chevron-down":"M6 9l6 6 6-6","chevron-up":"M6 15l6-6 6 6","chevron-right":"M9 6l6 6-6 6","chevron-left":"M15 6l-6 6 6 6",close:"M6 6l12 12M18 6L6 18",search:"M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM16 16l4 4",filter:"M4 7h16M7 12h10M10 17h4",edit:"M4 20h4L19 9l-4-4L4 16v4zM14 6l4 4",trash:"M5 7h14M10 7V5h4v2M7 7l1 13h8l1-13M10 11v6M14 11v6","arrow-up-right":"M7 17L17 7M9 7h8v8",calendar:"M5 6h14v14H5zM5 10h14M9 4v4M15 4v4",upload:"M12 16V6M8 10l4-4 4 4M5 18h14",plus:"M12 5v14M5 12h14",check:"M5 12.5l4.5 4.5L19 7",bell:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15zM10 20h4",help:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6M12 17h.01",rocket:"M14 4c3 0 6 3 6 6l-6 6-6-6c0-3 3-6 6-6zM8 16l-3 3M10 18l-2 3M6 14l-3 2",home:"M4 11l8-7 8 7v9h-5v-6H9v6H4z",box:"M4 8l8-4 8 4v8l-8 4-8-4zM4 8l8 4 8-4M12 12v8",cart:"M5 8h14l-1 12H6zM9 8V6a3 3 0 0 1 6 0v2",more:"M6 12h.01M12 12h.01M18 12h.01",drag:"M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01","eye-off":"M3 3l18 18M10.6 6.1A9 9 0 0 1 21 12a14 14 0 0 1-2.2 2.9M6.6 6.6A14 14 0 0 0 3 12s3 6 9 6a8 8 0 0 0 4-1",external:"M14 5h5v5M19 5l-8 8M18 14v5H5V6h5",users:"M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM2 21v-1a7 7 0 0 1 14 0v1M17 11a3 3 0 1 0 0-6M22 21v-1a5 5 0 0 0-4-5",chart:"M5 20V10M12 20V4M19 20v-7",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM4 12h2M18 12h2M12 4v2M12 18v2M6.3 6.3l1.4 1.4M16.3 16.3l1.4 1.4M6.3 17.7l1.4-1.4M16.3 7.7l1.4-1.4",store:"M4 9l1-5h14l1 5M4 9h16v11H4zM9 20v-6h6v6",pin:"M15 4l5 5-3 1-4 4 1 4-2 2-4-4-4 4M8 12l4-4 1-3",clock:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM12 7v5l3 2",alert:"M12 4l9 16H3zM12 10v4M12 17h.01","check-circle":"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM8 12l3 3 5-6","x-circle":"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM9 9l6 6M15 9l-6 6",bag:"M6 8h12l1 12H5zM9 8a3 3 0 0 1 6 0",sun:"M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4",moon:"M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z",menu:"M4 7h16M4 12h16M4 17h16",copy:"M9 9h11v11H9zM5 15H4V4h11v1",code:"M8 8l-4 4 4 4M16 8l4 4-4 4M14 5l-4 14",download:"M12 4v11M7.5 10.5L12 15l4.5-4.5M5 19h14",book:"M5 5a2 2 0 0 1 2-2h12v15H7a2 2 0 0 0-2 2zM5 20a2 2 0 0 0 2 2h12v-4",pos:"M5 4h14v8H5zM3 16h18v4H3zM8 8h4M12 12v4",website:"M3 5h18v14H3zM3 9h18M9 13h6M9 16h4",apps:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z",megaphone:"M4 10v4h3l8 5V5l-8 5zM18.5 9a4 4 0 0 1 0 6M7 14l1 5h3l-1-4",staff:"M5 4h14v17H5zM9 4V2h6v2M12 13a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zM8 18a4 4 0 0 1 8 0",repeat:"M17 3l3 3-3 3M4 11V9a3 3 0 0 1 3-3h13M7 21l-3-3 3-3M20 13v2a3 3 0 0 1-3 3H4",wallet:"M4 6h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4zM4 6V5a1 1 0 0 1 1-1h11v2M15 13h2",user:"M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",star:"M12 3l2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",percent:"M19 5L5 19M7 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM17 19a2 2 0 1 0 0-4 2 2 0 0 0 0 4z","arrow-left":"M19 12H5M11 6l-6 6 6 6",send:"M21 3L10 14M21 3l-7 18-4-7-7-4z",link:"M10 14a4 4 0 0 0 6 0l3-3a4 4 0 0 0-6-6l-1 1M14 10a4 4 0 0 0-6 0l-3 3a4 4 0 0 0 6 6l1-1",share:"M18 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM8.6 13.5l6.8 4M15.4 6.5l-6.8 4",globe:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18",gift:"M4 11h16v9H4zM3 7h18v4H3zM12 7v13M12 7c-2 0-4-1-4-3s3-1 4 3c1-4 4-5 4-3s-2 3-4 3",mail:"M3 6h18v12H3zM3 6l9 7 9-7",chat:"M4 5h16v11h-9l-4 4v-4H4zM8 9.5h8M8 12.5h5",tag:"M4 4h7l9 9-7 7-9-9zM8.5 10a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",building:"M3 21h18M5 21V4h9v17M14 10h5v11M8 8h3M8 12h3M8 16h3",map:"M3 6l6-2 6 2 6-2v14l-6 2-6-2-6 2zM9 4v14M15 6v14",note:"M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 15h6M9 18h4",eye:"M3 12s3-6 9-6 9 6 9 6-3 6-9 6-9-6-9-6zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",inbox:"M3 13l3-8h12l3 8v6H3zM3 13h5l1 3h6l1-3h5",handshake:"M3 7v8M21 7v8M3 9l5-3h4l-3 3.5a1.5 1.5 0 0 0 2.2 2L13 9.5l5 5M21 9l-4-3h-5M3 15h2l5 4a1.4 1.4 0 0 0 2-2M10 15l3.5 3a1.4 1.4 0 0 0 2-2l-1.5-1.5","log-out":"M10 4H5v16h5M14 8l4 4-4 4M18 12H9",refresh:"M20 12a8 8 0 0 0-14.9-4M4 12a8 8 0 0 0 14.9 4M5 3.5V8h4.5M19 20.5V16h-4.5",tasks:"M5 5h14v14H5zM8.5 12l2.5 2.5 4.5-5",phone:"M5 4h3.5l1.5 4.5-2 1.5a11 11 0 0 0 6 6l1.5-2 4.5 1.5V19a1.5 1.5 0 0 1-1.5 1.5A15.5 15.5 0 0 1 3.5 5.5 1.5 1.5 0 0 1 5 4z",camera:"M3 8.5A1.5 1.5 0 0 1 4.5 7h3L9 4.5h6L16.5 7h3A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5zM12 16.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",image:"M4 5h16v14H4zM4 16l4.5-4.5 4 4 2.5-2.5 5 5M15.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z","id-card":"M3 6h18v12H3zM8.5 11.5a1.75 1.75 0 1 0 0-3.5 1.75 1.75 0 0 0 0 3.5zM5.5 16a3 3 0 0 1 6 0M14 9.5h4M14 12.5h4M14 15.5h2.5",navigation:"M20 4l-6.5 16-2.5-7-7-2.5z","wifi-off":"M8.9 16.9a4 4 0 0 1 3.3-1.4M5.9 14.4a8 8 0 0 1 3-2.3M15.6 12.4a8 8 0 0 1 2.5 2M2.8 11.8a12 12 0 0 1 3-2.6M10.8 7.6a12 12 0 0 1 10.4 4.2M12 19.5h.01M3 3l18 18"},tg=["more","drag"],ax=Object.keys(uc);var ig=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],Br=class extends S{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=uc[this.name]??uc.more,t=tg.includes(this.name)?3:1.6;return Rn`<svg width=${this.size} height=${this.size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
15
15
|
stroke-width=${t} stroke-linecap="round" stroke-linejoin="round"
|
|
16
16
|
role=${this.label?"img":h} aria-label=${this.label||h} aria-hidden=${this.label?h:"true"}
|
|
17
|
-
part="svg" class=${(this.mirror==="auto"?
|
|
17
|
+
part="svg" class=${(this.mirror==="auto"?ig.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Br.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Br.styles=x`
|
|
18
18
|
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
19
19
|
svg { display: block; }
|
|
20
20
|
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
21
|
-
`;$("cm-icon",
|
|
22
|
-
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${
|
|
21
|
+
`;$("cm-icon",Br);var rg=99,px=z("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),gc,bc,Pn,Bi=class extends T{constructor(){super();this.variant="secondary";this.size="medium";this.type="button";this.disabled=!1;this.loading=!1;this.iconOnly=!1;this.icon="";this.label="";this.count=0;p(this,gc,this.attachInternals());p(this,bc,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,gc).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});p(this,Pn,!1);this.addEventListener("click",r(this,bc),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,Pn)&&(g(this,Pn,!0),console.warn("cm-button: an icon-only button needs a `label` (its accessible name).",this))}render(){let e=Number.isFinite(this.count)&&this.count>0?Math.floor(this.count):0,t=this.loading?c`<span class="spinner" aria-hidden="true"></span>`:c`<slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:h}</slot>`,i=this.iconOnly?c`<span class="vh"><slot></slot></span>`:c`<slot></slot>`,a=e?c`<span class="count" part="count" aria-hidden="true">${e>rg?this.t("countOverflow",{max:rg}):this.formatNumber(e)}</span>${this.iconOnly?h:c`<span class="vh"> ${this.t("count",{count:e})}</span>`}`:h,l=this.iconOnly&&(this.label||this.textContent?.trim())||"",d=!this.iconOnly||!l?h:e?this.t("labelWithCount",{label:l,count:e}):this.label||h,m=c`${t}${i}${a}`;return this.href&&!this.disabled?c`<a class="btn" part="control" href=${this.href} target=${this.target??h}
|
|
22
|
+
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${m}</a>`:c`<button class="btn" part="control" type="button"
|
|
23
23
|
?disabled=${this.disabled} aria-disabled=${this.loading?"true":h}
|
|
24
|
-
aria-busy=${this.loading?"true":h} aria-label=${d}>${
|
|
24
|
+
aria-busy=${this.loading?"true":h} aria-label=${d}>${m}</button>`}};gc=new WeakMap,bc=new WeakMap,Pn=new WeakMap,Bi.formAssociated=!0,Bi.properties={variant:{reflect:!0},size:{reflect:!0},type:{},disabled:{type:Boolean,reflect:!0},loading:{type:Boolean,reflect:!0},href:{},target:{},iconOnly:{type:Boolean,reflect:!0,attribute:"icon-only"},icon:{},label:{},count:{type:Number},tone:{reflect:!0}},Bi.styles=[k,x`
|
|
25
25
|
:host { display: inline-flex; vertical-align: middle; }
|
|
26
26
|
.btn {
|
|
27
27
|
position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--cm-space-8);
|
|
@@ -104,7 +104,125 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
104
104
|
position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
|
|
105
105
|
box-shadow: 0 0 0 2px var(--cm-bg-surface); pointer-events: none;
|
|
106
106
|
}
|
|
107
|
-
`];$("cm-button",
|
|
107
|
+
`];$("cm-button",Bi);var Fr=class extends S{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1;this.heading=!1;this.shortcut=""}render(){return null}toItem(){let e=(this.textContent??"").trim();return{label:e,value:this.value||e,icon:this.icon||void 0,href:this.href||void 0,disabled:this.disabled||void 0,critical:this.critical||void 0,heading:this.heading||void 0,shortcut:this.shortcut||void 0}}};Fr.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0},heading:{type:Boolean,reflect:!0},shortcut:{reflect:!0}},Fr.styles=x`:host { display: none; }`;$("cm-menu-item",Fr);function On(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),i=a=>e.getAttribute(a)||void 0;n.push({label:t,value:i("value")??t,icon:i("icon"),href:i("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0,heading:e.hasAttribute("heading")||void 0,shortcut:i("shortcut")})}else e.localName==="hr"&&n.push({divider:!0});return n}function fc(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var jr=class extends T{constructor(){super(...arguments);this.size="large"}render(){let e=this.size==="small"?2.5:3;return c`<span class="spinner" part="spinner" role="status">
|
|
108
|
+
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
109
|
+
<circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
|
|
110
|
+
<path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
|
|
111
|
+
</svg>
|
|
112
|
+
<span class="vh">${this.accessibleLabel||this.t("loading")}</span>
|
|
113
|
+
</span>`}};jr.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},jr.styles=[k,x`
|
|
114
|
+
:host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
|
|
115
|
+
.spinner { display: inline-flex; }
|
|
116
|
+
svg { inline-size: 44px; block-size: 44px; animation: spin 0.8s linear infinite; }
|
|
117
|
+
:host([size='small']) svg { inline-size: 20px; block-size: 20px; }
|
|
118
|
+
.track { stroke: var(--cm-border-subtle); }
|
|
119
|
+
.arc { stroke: currentColor; }
|
|
120
|
+
.vh {
|
|
121
|
+
position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
122
|
+
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
123
|
+
}
|
|
124
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
125
|
+
@media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
|
|
126
|
+
`];$("cm-spinner",jr);var Cx=z("actionMenu",{label:"Actions"}),qn,Fi,ji,Bn,K,vc,Fn,sm,yc,xc,wc,jn,Un,Ur,$c,ag,nm,sg,Vr=class extends T{constructor(){super(...arguments);p(this,K);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this.loading=!1;this.disabled=!1;this._slotted=[];this._active=-1;this._custom=!1;p(this,qn);p(this,Fi,A("cm-menu"));p(this,ji,"");p(this,Bn,0);p(this,Fn,e=>{this.open&&!e.composedPath().includes(this)&&s(this,K,xc).call(this,!1)});p(this,jn,e=>{this.disabled||(e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0)))});p(this,Un,()=>{this.disabled||(this.open?this.hide():this.show())});p(this,$c,e=>{let t=s(this,K,yc).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),s(this,K,Ur).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),s(this,K,Ur).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),s(this,K,Ur).call(this,t[0]);break;case"End":e.preventDefault(),s(this,K,Ur).call(this,t[t.length-1]);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.hide(!0);break;case"Tab":this.hide();break;default:if(e.key.length===1&&/\S/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let a=Date.now();g(this,ji,(a-r(this,Bn)<600?r(this,ji):"")+e.key.toLowerCase()),g(this,Bn,a);let l=this.menuItems,d=r(this,ji).length>1?i:i+1,u=[...t.slice(Math.max(d,0)),...t.slice(0,Math.max(d,0))].find(v=>(l[v].label??"").toLowerCase().startsWith(r(this,ji)));u!==void 0&&s(this,K,Ur).call(this,u)}}})}connectedCallback(){super.connectedCallback(),s(this,K,vc).call(this),g(this,qn,fc(this,()=>s(this,K,vc).call(this))),document.addEventListener("pointerdown",r(this,Fn),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,qn)?.disconnect(),document.removeEventListener("pointerdown",r(this,Fn),!0)}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=s(this,K,yc).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,s(this,K,xc).call(this,!0),this.updateComplete.then(()=>s(this,K,wc).call(this))}hide(e=!1){s(this,K,xc).call(this,!1),e&&s(this,K,sm).call(this)?.focus()}updated(e){if(this._custom){let t=s(this,K,sm).call(this);if(t){let i=(a,l)=>{t.getAttribute(a)!==l&&t.setAttribute(a,l)};i("aria-haspopup","menu"),i("aria-expanded",String(this.open)),i("aria-controls",`${r(this,Fi)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=s(this,K,yc).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>s(this,K,wc).call(this))}}render(){let e=this.menuItems,t=this.triggerLabel||this.label,i=this._custom?c`<slot name="trigger" @click=${r(this,Un)} @keydown=${r(this,jn)} @slotchange=${()=>s(this,K,vc).call(this)}></slot>`:c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
127
|
+
aria-expanded=${String(this.open)} aria-controls="${r(this,Fi)}-m" aria-label=${this.iconOnly?t:h}
|
|
128
|
+
?disabled=${this.disabled} @click=${r(this,Un)} @keydown=${r(this,jn)}>${this.iconOnly?c`<cm-icon name=${this.icon} size="18"></cm-icon>`:c`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return c`${i}
|
|
129
|
+
<div class="pop" part="menu" ?hidden=${!this.open}>
|
|
130
|
+
${this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h}
|
|
131
|
+
<div role="menu" id="${r(this,Fi)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${r(this,$c)}>
|
|
132
|
+
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:s(this,K,sg).call(this,e)}
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
<slot hidden></slot>`}};qn=new WeakMap,Fi=new WeakMap,ji=new WeakMap,Bn=new WeakMap,K=new WeakSet,vc=function(){this._slotted=On(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},Fn=new WeakMap,sm=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},yc=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},xc=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})))},wc=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},jn=new WeakMap,Un=new WeakMap,Ur=function(e){this._active=e,this.updateComplete.then(()=>s(this,K,wc).call(this))},$c=new WeakMap,ag=function(e,t){if(t.disabled){e.preventDefault();return}let i=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));i||e.preventDefault(),this.hide(!t.href||!i)},nm=function(e,t){if(e.divider)return c`<div role="separator"></div>`;let i=`item${e.critical?" critical":""}${t===this._active?" active":""}`,a=c`${e.icon?c`<cm-icon name=${e.icon} size="16"></cm-icon>`:h}<span class="label">${e.label}</span>${e.shortcut?c`<span class="shortcut" part="shortcut" aria-hidden="true">${e.shortcut}</span>`:h}`,l={over:()=>{e.disabled||(this._active=t)},click:d=>s(this,K,ag).call(this,d,e)};return e.href&&!e.disabled?c`<a class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
136
|
+
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</a>`:c`<button type="button" class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
137
|
+
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${a}</button>`},sg=function(e){let t=[];for(let i=0;i<e.length;i++){let a=e[i];if(!a.heading){t.push(s(this,K,nm).call(this,a,i));continue}let l=`${r(this,Fi)}-h${i}`,d=[],m=i+1;for(;m<e.length&&!e[m].heading&&!e[m].divider;m++)d.push(s(this,K,nm).call(this,e[m],m));t.push(c`<div role="group" aria-labelledby=${l}><div class="section" part="section" id=${l} role="presentation">${a.label}</div>${d}</div>`),i=m-1}return t},Vr.properties={items:{type:Array},open:{type:Boolean,reflect:!0},label:{string:"label"},triggerLabel:{attribute:"trigger-label"},iconOnly:{type:Boolean,attribute:"icon-only"},icon:{},align:{reflect:!0},heading:{},subheading:{},density:{reflect:!0},loading:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},Vr.styles=[k,x`
|
|
138
|
+
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
139
|
+
.trigger {
|
|
140
|
+
display: inline-flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-12); font: inherit; font-size: var(--cm-font-size-14); font-weight: 500;
|
|
141
|
+
color: var(--cm-text-default); background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
142
|
+
border-radius: var(--cm-radius-sm); cursor: pointer;
|
|
143
|
+
}
|
|
144
|
+
.trigger.icon { width: var(--cm-control-height-md, 36px); padding: 0; justify-content: center; border-color: transparent; background: none; }
|
|
145
|
+
.trigger:hover:not(:disabled) { background: var(--cm-bg-hover); }
|
|
146
|
+
.trigger:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); cursor: not-allowed; }
|
|
147
|
+
.trigger.icon:disabled { background: none; }
|
|
148
|
+
.trigger:active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
|
|
149
|
+
.trigger[aria-expanded='true'] { background: var(--cm-bg-hover); }
|
|
150
|
+
/* Touch screens (1.6, like cm-button): the trigger is drawn 40px (40 x 40 icon-only) with a 44px hit area. */
|
|
151
|
+
@media (pointer: coarse) {
|
|
152
|
+
.trigger { position: relative; min-height: var(--cm-control-height-lg, 40px); } .trigger.icon { width: var(--cm-control-height-lg, 40px); }
|
|
153
|
+
.trigger::after { content: ''; position: absolute; inset: -2px; }
|
|
154
|
+
.item { min-height: var(--cm-control-height-touch, 44px); }
|
|
155
|
+
}
|
|
156
|
+
.trigger:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
157
|
+
.pop {
|
|
158
|
+
position: absolute; z-index: 20; top: calc(100% + 4px); inset-inline-start: 0; width: max-content; min-width: 180px; max-width: min(320px, calc(100vw - 32px));
|
|
159
|
+
padding: var(--cm-space-4); text-align: start; background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
160
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-md);
|
|
161
|
+
}
|
|
162
|
+
:host([align='end']) .pop { inset-inline-start: auto; inset-inline-end: 0; }
|
|
163
|
+
.pop[hidden] { display: none; }
|
|
164
|
+
.head { padding: var(--cm-space-4) var(--cm-space-12) var(--cm-space-8); margin-bottom: 4px; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); overflow-wrap: anywhere; }
|
|
165
|
+
.head strong { display: block; font-size: 14px; font-weight: 500; }
|
|
166
|
+
.head span { display: block; font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); }
|
|
167
|
+
[role='menu'] { display: flex; flex-direction: column; outline: none; }
|
|
168
|
+
.item {
|
|
169
|
+
display: flex; align-items: center; gap: var(--cm-space-8); width: 100%; min-height: var(--cm-control-height-md, 36px); padding: var(--cm-space-4) var(--cm-space-12); font: inherit; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
|
|
170
|
+
color: var(--cm-text-default); text-align: start; text-decoration: none; background: none; border: 0; border-radius: var(--cm-radius-sm);
|
|
171
|
+
cursor: pointer; outline: none;
|
|
172
|
+
}
|
|
173
|
+
:host([density='compact']) .item { min-height: var(--cm-control-height-sm, 32px); }
|
|
174
|
+
.item cm-icon { flex: none; }
|
|
175
|
+
.label { flex: 1; min-width: 0; }
|
|
176
|
+
.shortcut { flex: none; padding-inline-start: var(--cm-space-16); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
177
|
+
.item.critical { color: var(--cm-text-critical); }
|
|
178
|
+
.item[aria-disabled='true'] { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
179
|
+
.item[aria-disabled='true'] .shortcut { color: var(--cm-text-secondary); }
|
|
180
|
+
.item.active:not([aria-disabled='true']), .item:not([aria-disabled='true']):hover {
|
|
181
|
+
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
182
|
+
}
|
|
183
|
+
.item.active:not([aria-disabled='true']) .shortcut, .item:not([aria-disabled='true']):hover .shortcut { color: var(--cm-text-on-dark-secondary); }
|
|
184
|
+
.item:not([aria-disabled='true']):active { background: color-mix(in srgb, var(--cm-bg-panel-header), var(--cm-text-on-dark) 16%); }
|
|
185
|
+
.item.critical.active:not([aria-disabled='true']), .item.critical:not([aria-disabled='true']):hover { background: var(--cm-bg-critical); color: var(--cm-text-critical); }
|
|
186
|
+
.item.critical.active .shortcut, .item.critical:hover .shortcut { color: var(--cm-text-critical); }
|
|
187
|
+
.item.critical:not([aria-disabled='true']):active { background: color-mix(in srgb, var(--cm-bg-critical), var(--cm-text-critical) 12%); }
|
|
188
|
+
.item.active:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 1px; }
|
|
189
|
+
[role='group'] { display: flex; flex-direction: column; }
|
|
190
|
+
.section {
|
|
191
|
+
padding: var(--cm-space-8) var(--cm-space-12) var(--cm-space-4); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12);
|
|
192
|
+
font-weight: 500; color: var(--cm-text-tertiary);
|
|
193
|
+
}
|
|
194
|
+
.loading { display: flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: var(--cm-space-4) var(--cm-space-12); font-size: var(--cm-font-size-14); color: var(--cm-text-tertiary); }
|
|
195
|
+
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
196
|
+
`];$("cm-action-menu",Vr);var Hx=z("buttonGroup",{more:"More"}),Zt="data-cm-overflow",Yv=["disabled","loading","tone","icon","label","variant","size","icon-only","count","href","hidden","data-priority"],Qt,Ui,St,bt,ei,Vi,U,Kr,ng,Vn,om,kc,Ec,og,Mc,lm,cm,dm,Wr=class extends T{constructor(){super(...arguments);p(this,U);this.overflow="wrap";this.align="start";this.label="";this._items=[];this._size="medium";p(this,Qt,[]);p(this,Ui);p(this,St);p(this,bt,0);p(this,ei,new Set);p(this,Vi,!1);p(this,Mc,e=>{e.stopPropagation();let t=r(this,Qt)[Number(e.detail.value)];if(!t)return;g(this,Vi,!0),(t.shadowRoot?.querySelector('[part="control"]')??t).click(),requestAnimationFrame(()=>requestAnimationFrame(()=>s(this,U,lm).call(this)))})}get overflowing(){return[...r(this,Qt)]}connectedCallback(){super.connectedCallback(),g(this,Ui,new MutationObserver(e=>s(this,U,ng).call(this,e))),r(this,Ui).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:Yv}),typeof ResizeObserver<"u"&&(g(this,St,new ResizeObserver(()=>s(this,U,Kr).call(this))),r(this,St).observe(this),g(this,ei,new Set([this]))),document.fonts?.ready.then(()=>s(this,U,Kr).call(this)),s(this,U,Kr).call(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Ui)?.disconnect(),r(this,St)?.disconnect(),r(this,ei).clear(),cancelAnimationFrame(r(this,bt)),g(this,bt,0),s(this,U,om).call(this,s(this,U,Vn).call(this))}updated(e){(e.has("overflow")||e.has("moreLabel")||e.has("moreIcon")||e.has("size"))&&s(this,U,Kr).call(this)}firstUpdated(){this.updateComplete.then(()=>this.relayout())}relayout(){cancelAnimationFrame(r(this,bt)),g(this,bt,0),s(this,U,Ec).call(this)}render(){let e=this.moreIcon!=null;return c`<div class="row" part="row" role="group" aria-label=${this.label||h}>
|
|
197
|
+
<slot></slot>
|
|
198
|
+
<cm-action-menu class="more ${this._size}${e?" icon":""}" part="more" hidden align="end"
|
|
199
|
+
.items=${this._items} label=${this.moreLabel} ?icon-only=${e} icon=${this.moreIcon||"more"}
|
|
200
|
+
@cm-select=${r(this,Mc)}></cm-action-menu>
|
|
201
|
+
</div>`}};Qt=new WeakMap,Ui=new WeakMap,St=new WeakMap,bt=new WeakMap,ei=new WeakMap,Vi=new WeakMap,U=new WeakSet,Kr=function(){r(this,bt)||!this.isConnected||g(this,bt,requestAnimationFrame(()=>{g(this,bt,0);let e=s(this,U,Vn).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>s(this,U,Ec).call(this)):s(this,U,Ec).call(this)}))},ng=function(e){for(let t of e)for(let i of Array.from(t.removedNodes))i instanceof HTMLElement&&i.hasAttribute(Zt)&&i.parentElement!==this&&(i.removeAttribute(Zt),i.hidden=!1);s(this,U,Kr).call(this)},Vn=function(){return Array.from(this.children).filter(e=>e.localName==="cm-button"&&(!e.hidden||e.hasAttribute(Zt)))},om=function(e){for(let t of e)t.hasAttribute(Zt)&&(t.removeAttribute(Zt),t.hidden=!1)},kc=function(){return this.renderRoot.querySelector(".more")},Ec=function(){let e=this.renderRoot.querySelector(".row"),t=s(this,U,kc).call(this);if(!e||!t||!this.isConnected)return;let i=s(this,U,Vn).call(this),a=this.shadowRoot.activeElement===t?t:i.find(v=>v.matches(":focus-within"))??null,l=i[0]?.getAttribute("size");this._size=this.size||(l==="slim"||l==="large"?l:"medium");let d=new Set;if(r(this,St)){let v=new Set([this,t,...i]);for(let b of r(this,ei))v.has(b)||r(this,St).unobserve(b);for(let b of v)r(this,ei).has(b)||r(this,St).observe(b);g(this,ei,v)}if(this.overflow==="menu"){s(this,U,om).call(this,i),t.hidden=!1;let v=e.clientWidth,b=parseFloat(getComputedStyle(e).columnGap)||0,w=Array.from(this.children).filter(D=>!D.hidden),y=new Map(w.map(D=>[D,D.getBoundingClientRect().width])),M=w.reduce((D,H)=>D+y.get(H),0)+b*Math.max(w.length-1,0);if(M>v+.5){let D=F=>{let W=F.dataset.priority;return W==="low"?0:W==="high"?2:F.getAttribute("variant")==="primary"?3:1},H=i.map((F,W)=>({b:F,i:W,r:D(F)})).sort((F,W)=>F.r-W.r||W.i-F.i),q=M+b+t.getBoundingClientRect().width;for(let{b:F}of H){if(q<=v+.5)break;d.add(F),q-=y.get(F)+b}}}for(let v of i)d.has(v)?(v.setAttribute(Zt,""),v.hidden=!0):v.hasAttribute(Zt)&&(v.removeAttribute(Zt),v.hidden=!1);t.hidden=d.size===0,a===t&&t.hidden?s(this,U,dm).call(this):a&&a!==t&&d.has(a)&&s(this,U,cm).call(this),d.size===0&&t.open&&t.hide(),r(this,Ui)?.takeRecords();let m=i.filter(v=>d.has(v));this._items=m.map((v,b)=>s(this,U,og).call(this,v,b));let u=m.length!==r(this,Qt).length||m.some((v,b)=>v!==r(this,Qt)[b]);g(this,Qt,m),u&&this.dispatchEvent(new CustomEvent("cm-overflow-change",{detail:{hidden:[...m]},bubbles:!0,composed:!0})),r(this,Vi)&&this.updateComplete.then(()=>s(this,U,lm).call(this))},og=function(e,t){let i=Array.from(e.childNodes).filter(d=>!(d instanceof Element&&d.hasAttribute("slot"))).map(d=>d.textContent??"").join("").replace(/\s+/g," ").trim(),a=e.hasAttribute("icon-only")?e.getAttribute("label")||i:i||e.getAttribute("label")||"",l=e.getAttribute("icon")||e.querySelector(':scope > [slot="icon"]')?.getAttribute("name")||void 0;return{label:a,value:String(t),icon:l,disabled:e.hasAttribute("disabled")||e.hasAttribute("loading")||void 0,critical:e.getAttribute("tone")==="critical"||void 0}},Mc=new WeakMap,lm=function(){if(!r(this,Vi))return;g(this,Vi,!1);let e=document.activeElement,t=s(this,U,kc).call(this);(!e||e===document.body||e===document.documentElement||e===this&&(!t||t.hidden||this.shadowRoot.activeElement!==t))&&(t&&!t.hidden?s(this,U,cm).call(this):s(this,U,dm).call(this))},cm=function(){s(this,U,kc).call(this)?.shadowRoot?.querySelector('[part="trigger"]')?.focus()},dm=function(){let e=s(this,U,Vn).call(this).filter(i=>!i.hidden&&!i.hasAttribute("disabled")),t=e[e.length-1];(t?.shadowRoot?.querySelector('[part="control"]')??t)?.focus()},Wr.properties={overflow:{reflect:!0},moreLabel:{attribute:"more-label",string:"more"},moreIcon:{attribute:"more-icon"},size:{reflect:!0},align:{reflect:!0},label:{},_items:{state:!0},_size:{state:!0}},Wr.styles=[k,x`
|
|
202
|
+
:host { display: block; min-inline-size: 0; }
|
|
203
|
+
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); min-inline-size: 0; }
|
|
204
|
+
:host([align='end']) .row { justify-content: flex-end; }
|
|
205
|
+
:host([overflow='menu']) .row { flex-wrap: nowrap; }
|
|
206
|
+
::slotted(*) { flex: none; }
|
|
207
|
+
.more { flex: none; }
|
|
208
|
+
.more[hidden] { display: none; }
|
|
209
|
+
/* The More trigger matches the buttons (owner standard, 1.6): medium 36, slim 32, large 40; 40 on touch screens with
|
|
210
|
+
a 44px hit area (set by cm-action-menu). Text 14px (13px slim), like cm-button. */
|
|
211
|
+
.more::part(trigger) { min-height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-16); font-size: var(--cm-font-size-14); }
|
|
212
|
+
.more.slim::part(trigger) { min-height: var(--cm-control-height-sm, 32px); padding: 0 var(--cm-space-12); font-size: var(--cm-font-size-13); }
|
|
213
|
+
.more.large::part(trigger) { min-height: var(--cm-control-height-lg, 40px); padding: 0 var(--cm-space-20); }
|
|
214
|
+
/* Icon-only: a square outlined like a secondary icon button. */
|
|
215
|
+
.more.icon::part(trigger) {
|
|
216
|
+
width: var(--cm-control-height-md, 36px); padding: 0; background: var(--cm-bg-surface); border-color: var(--cm-border-input);
|
|
217
|
+
}
|
|
218
|
+
.more.icon.slim::part(trigger) { width: var(--cm-control-height-sm, 32px); }
|
|
219
|
+
.more.icon.large::part(trigger) { width: var(--cm-control-height-lg, 40px); }
|
|
220
|
+
.more.icon::part(trigger):hover, .more.icon[open]::part(trigger) { background: var(--cm-bg-hover); }
|
|
221
|
+
@media (pointer: coarse) {
|
|
222
|
+
.more::part(trigger), .more.slim::part(trigger) { min-height: var(--cm-control-height-lg, 40px); }
|
|
223
|
+
.more.icon::part(trigger), .more.icon.slim::part(trigger) { width: var(--cm-control-height-lg, 40px); }
|
|
224
|
+
}
|
|
225
|
+
`];$("cm-button-group",Wr);var ot={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Gr=o=>(...n)=>({_$litDirective$:o,values:n}),ti=class{constructor(n){}get _$AU(){return this._$AM._$AU}_$AT(n,e,t){this._$Ct=n,this._$AM=e,this._$Ci=t}_$AS(n,e){return this.update(n,e)}update(n,e){return this.render(...e)}};var{I:Xv}=Ju,lg=o=>o;var dg=o=>o.strings===void 0,cg=()=>document.createComment(""),Yr=(o,n,e)=>{let t=o._$AA.parentNode,i=n===void 0?o._$AB:n._$AA;if(e===void 0){let a=t.insertBefore(cg(),i),l=t.insertBefore(cg(),i);e=new Xv(a,l,o,o.options)}else{let a=e._$AB.nextSibling,l=e._$AM,d=l!==o;if(d){let m;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(m=o._$AU)!==l._$AU&&e._$AP(m)}if(a!==i||d){let m=e._$AA;for(;m!==a;){let u=lg(m).nextSibling;lg(t).insertBefore(m,i),m=u}}}return e},ii=(o,n,e=o)=>(o._$AI(n,e),o),Jv={},Tc=(o,n=Jv)=>o._$AH=n,hg=o=>o._$AH,zc=o=>{o._$AR(),o._$AA.remove()};var ne=Gr(class extends ti{constructor(o){if(super(o),o.type!==ot.PROPERTY&&o.type!==ot.ATTRIBUTE&&o.type!==ot.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!dg(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[n]){if(n===we||n===h)return n;let e=o.element,t=o.name;if(o.type===ot.PROPERTY){if(n===e[t])return we}else if(o.type===ot.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return we}else if(o.type===ot.ATTRIBUTE&&e.getAttribute(t)===n+"")return we;return Tc(o),n}});var Ge=x`
|
|
108
226
|
:host {
|
|
109
227
|
--_cm-field-h: var(--cm-control-height-lg, 40px);
|
|
110
228
|
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
@@ -125,7 +243,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
125
243
|
.error { color: var(--cm-text-critical); }
|
|
126
244
|
:host([size='small']) .field { gap: var(--cm-space-4); }
|
|
127
245
|
:host([size='small']) .label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); }
|
|
128
|
-
`,
|
|
246
|
+
`,_c=x`
|
|
129
247
|
[role='listbox'] {
|
|
130
248
|
max-height: 264px; overflow-y: auto; margin: 0; padding: var(--cm-space-4); list-style: none;
|
|
131
249
|
}
|
|
@@ -137,22 +255,22 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
137
255
|
[role='option']:not([aria-disabled='true']):not([aria-selected='true']):active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
|
|
138
256
|
:host([size='small']) [role='option'] { min-height: var(--cm-control-height-sm, 32px); }
|
|
139
257
|
@media (pointer: coarse) { [role='option'], :host([size='small']) [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
140
|
-
`;var
|
|
141
|
-
.value=${
|
|
258
|
+
`;var tw=z("textField",{required:"Please fill in this field.",rangeUnderflow:"Enter {min} or later.",rangeOverflow:"Enter {max} or earlier.",numberUnderflow:"Enter {min} or more.",numberOverflow:"Enter {max} or less.",stepMismatch:"Enter a valid value. The two nearest are {lower} and {upper}.",badTime:"Enter a complete time.",badDateTime:"Enter a complete date and time."}),$e,Lt,Wn,oe,Kn,Cc,mg,hm,pg,mm,ri=class extends T{constructor(){super(...arguments);p(this,oe);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.type="text";this.multiline=!1;this.rows=4;this.required=!1;this.disabled=!1;this.readonly=!1;this.size="default";p(this,$e,this.attachInternals());p(this,Lt,A("cm-tf"));p(this,Wn,"")}connectedCallback(){super.connectedCallback(),g(this,Wn,this.value)}get form(){return r(this,$e).form}get validity(){return r(this,$e).validity}get validationMessage(){return r(this,$e).validationMessage}checkValidity(){return s(this,oe,Kn).call(this),r(this,$e).checkValidity()}reportValidity(){return s(this,oe,Kn).call(this),r(this,$e).reportValidity()}formResetCallback(){this.value=r(this,Wn),this.error=""}formDisabledCallback(e){this.disabled=e}updated(){r(this,$e).setFormValue(this.value),s(this,oe,Kn).call(this)}render(){let e=[this.error&&`${r(this,Lt)}-err`,this.helpText&&`${r(this,Lt)}-help`].filter(Boolean).join(" ")||h,t={id:r(this,Lt),invalid:this.error?"true":h},i=this.multiline?c`<textarea class="input" part="input" id=${t.id} rows=${this.rows}
|
|
259
|
+
.value=${ne(this.value)} placeholder=${this.placeholder||h}
|
|
142
260
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
143
261
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
144
|
-
@input=${s(this,
|
|
145
|
-
.value=${
|
|
262
|
+
@input=${s(this,oe,hm)} @change=${s(this,oe,mm)}></textarea>`:c`<input class="input" part="input" id=${t.id} type=${this.type}
|
|
263
|
+
.value=${ne(this.value)} placeholder=${this.placeholder||h}
|
|
146
264
|
autocomplete=${this.autocomplete??h}
|
|
147
265
|
min=${this.min||h} max=${this.max||h} step=${this.step||h}
|
|
148
266
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
149
267
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
150
|
-
@input=${s(this,
|
|
151
|
-
${this.label?c`<label class="label" for=${r(this,
|
|
268
|
+
@input=${s(this,oe,hm)} @change=${s(this,oe,mm)} @blur=${s(this,oe,pg)} />`;return c`<div class="field">
|
|
269
|
+
${this.label?c`<label class="label" for=${r(this,Lt)} part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}${this.hint?c`<span class="hint">[${this.hint}]</span>`:h}</label>`:h}
|
|
152
270
|
${i}
|
|
153
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
154
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
155
|
-
</div>`}}
|
|
271
|
+
${this.error?c`<p class="error" id="${r(this,Lt)}-err" role="alert">${this.error}</p>`:h}
|
|
272
|
+
${this.helpText?c`<p class="help" id="${r(this,Lt)}-help">${this.helpText}</p>`:h}
|
|
273
|
+
</div>`}};$e=new WeakMap,Lt=new WeakMap,Wn=new WeakMap,oe=new WeakSet,Kn=function(){let e=this.renderRoot.querySelector(".input"),t=e instanceof HTMLInputElement?e.validity:null,i=this.type==="time"||this.type==="datetime-local";this.error?r(this,$e).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,$e).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.required&&!this.value?r(this,$e).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,$e).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:s(this,oe,Cc).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,$e).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:s(this,oe,Cc).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,$e).setValidity({stepMismatch:!0},this.t("stepMismatch",s(this,oe,mg).call(this,e)),e??void 0):r(this,$e).setValidity({})},Cc=function(e){let t=this.locale;if(this.type==="number"&&e!==""&&Number.isFinite(Number(e)))return this.formatNumber(Number(e));if(this.type==="time"){let l=/^(\d{2}):(\d{2})/.exec(e);return l?ae(new Date(2e3,0,1,+l[1],+l[2]),{hour:"numeric",minute:"2-digit"},t):e}let i=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(e);if(!i)return e;let a=new Date(+i[1],+i[2]-1,+i[3],+(i[4]??0),+(i[5]??0));return this.type==="datetime-local"?ae(a,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"},t):ae(a,{day:"numeric",month:"short",year:"numeric"},t)},mg=function(e){let t=this.type==="date"?864e5:this.type==="time"||this.type==="datetime-local"?1e3:1,i=Number(this.step)*t||(this.type==="date"?864e5:this.type==="number"?1:6e4),a=e.valueAsNumber,l=document.createElement("input");l.type=this.type,l.value=this.min??"";let d=Number.isFinite(l.valueAsNumber)?l.valueAsNumber:0,m=d+Math.floor((a-d)/i)*i,u=v=>{if(this.type==="number")return this.formatNumber(Number(v.toPrecision(12)));let w=new Date(v).toISOString();return s(this,oe,Cc).call(this,this.type==="time"?w.slice(11,16):this.type==="date"?w.slice(0,10):w.slice(0,16))};return{lower:u(m),upper:u(m+i)}},hm=function(e){this.value=e.target.value},pg=function(){s(this,oe,Kn).call(this)},mm=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ri.formAssociated=!0,ri.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ri.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},type:{},multiline:{type:Boolean},rows:{type:Number},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},autocomplete:{},size:{reflect:!0},min:{},max:{},step:{}},ri.styles=[k,Ge,x`
|
|
156
274
|
:host { display: block; }
|
|
157
275
|
.input {
|
|
158
276
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -168,13 +286,13 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
168
286
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
169
287
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
170
288
|
:host([error]:not([error=''])) .input { border-color: var(--cm-border-critical); }
|
|
171
|
-
`];$("cm-text-field",
|
|
172
|
-
<input type="checkbox" id=${r(this,
|
|
289
|
+
`];$("cm-text-field",ri);var ow=z("checkbox",{required:"Please tick this box."}),si,Ki,Gn,Sc,ug,ai=class extends T{constructor(){super(...arguments);p(this,Sc);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;p(this,si,this.attachInternals());p(this,Ki,A("cm-cb"));p(this,Gn,!1)}connectedCallback(){super.connectedCallback(),g(this,Gn,this.checked)}get form(){return r(this,si).form}checkValidity(){return r(this,si).checkValidity()}formResetCallback(){this.checked=r(this,Gn)}formDisabledCallback(e){this.disabled=e}updated(){r(this,si).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,si).setValidity({valueMissing:!0},this.t("required")):r(this,si).setValidity({})}render(){let e=this.indeterminate?c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6h8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`:c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6.2 4.8 9 10 3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;return c`<label for=${r(this,Ki)}>
|
|
290
|
+
<input type="checkbox" id=${r(this,Ki)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
173
291
|
?disabled=${this.disabled} ?required=${this.required}
|
|
174
|
-
aria-describedby=${this.description?`${r(this,
|
|
292
|
+
aria-describedby=${this.description?`${r(this,Ki)}-d`:h} @change=${s(this,Sc,ug)} />
|
|
175
293
|
<span class="box" part="box">${e}</span>
|
|
176
|
-
${this.label||this.description?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,
|
|
177
|
-
</label>`}};
|
|
294
|
+
${this.label||this.description?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Ki)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
295
|
+
</label>`}};si=new WeakMap,Ki=new WeakMap,Gn=new WeakMap,Sc=new WeakSet,ug=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ai.formAssociated=!0,ai.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ai.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},ai.styles=[k,x`
|
|
178
296
|
:host { display: inline-flex; }
|
|
179
297
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
180
298
|
/* The 16px box (18px on touch screens, owner standard 1.6) sits centred on the label's first line (20px); the
|
|
@@ -197,12 +315,12 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
197
315
|
:host([disabled]) label { cursor: not-allowed; }
|
|
198
316
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
199
317
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
200
|
-
`];$("cm-checkbox",
|
|
318
|
+
`];$("cm-checkbox",ai);var Yn,Gi=class extends S{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;p(this,Yn,A("cm-radio"))}render(){let e=this.description?`${r(this,Yn)}-d`:null;return c`<div class="radio" part="radio" role="radio" id=${r(this,Yn)}
|
|
201
319
|
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":h}
|
|
202
320
|
aria-describedby=${e??h} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
203
321
|
<span class="dot" part="dot"></span>
|
|
204
322
|
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?c`<span class="desc" id=${e}>${this.description}</span>`:h}</span>
|
|
205
|
-
</div>`}};
|
|
323
|
+
</div>`}};Yn=new WeakMap,Gi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Gi.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}},Gi.styles=[k,x`
|
|
206
324
|
:host { display: inline-flex; }
|
|
207
325
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; outline: none; }
|
|
208
326
|
.dot {
|
|
@@ -224,16 +342,16 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
224
342
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
225
343
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
226
344
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
227
|
-
`];$("cm-radio",
|
|
228
|
-
aria-labelledby=${s(this,
|
|
345
|
+
`];$("cm-radio",Gi);var pw=z("radioGroup",{required:"Please select one of these options."}),Ye,Dt,Xn,Jn,Zn,Xr,se,pm,Dc,Wi,um,Jr,gm,Ac,Rc,Lc,Yi=class extends T{constructor(){super();p(this,se);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;p(this,Ye,this.attachInternals());p(this,Dt,A("cm-rg"));p(this,Xn,"");p(this,Jn,!0);p(this,Zn,!1);p(this,Xr,!1);p(this,Dc,()=>{s(this,se,pm).call(this),r(this,Jr).call(this)});p(this,Jr,()=>{let e=s(this,se,Wi).call(this),t=!1;for(let a of e)a.checked=!!this.value&&a.value===this.value&&!t,a.checked&&(t=!0),a.groupDisabled=this.disabled;let i=e.find(a=>a.checked&&!a.disabled)??s(this,se,um).call(this)[0];for(let a of e)a._tabbable=a===i&&!this.disabled});p(this,Ac,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||s(this,se,gm).call(this,t,!0)});p(this,Rc,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let i=s(this,se,um).call(this),a=i.indexOf(t),l=J(e,this),d;if(e.key==="ArrowDown"||l==="ArrowRight")d=i[(a+1)%i.length];else if(e.key==="ArrowUp"||l==="ArrowLeft")d=i[(a-1+i.length)%i.length];else if(e.key===" ")d=t.disabled?void 0:t;else return;e.preventDefault(),d&&s(this,se,gm).call(this,d,!0)});this.addEventListener("keydown",r(this,Rc)),this.addEventListener("click",r(this,Ac))}connectedCallback(){super.connectedCallback(),s(this,se,pm).call(this)}get form(){return r(this,Ye).form}get validity(){return r(this,Ye).validity}get validationMessage(){return r(this,Ye).validationMessage}checkValidity(){return r(this,Ye).checkValidity()}reportValidity(){return r(this,Ye).reportValidity()}formResetCallback(){this.value=r(this,Xn)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(s(this,se,Wi).call(this).find(t=>t._tabbable)??s(this,se,Wi).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,Zn)&&!r(this,Xr)&&g(this,Jn,!1),g(this,Zn,!0),r(this,Jr).call(this),r(this,Ye).setFormValue(this.value||null,this.value);let t=s(this,se,Wi).call(this)[0];this.error?r(this,Ye).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Ye).setValidity({valueMissing:!0},this.t("required"),t):r(this,Ye).setValidity({})}render(){let e=[this.error&&`${r(this,Dt)}-err`,this.helpText&&`${r(this,Dt)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
346
|
+
aria-labelledby=${s(this,se,Lc).call(this)?`${r(this,Dt)}-l`:h} aria-label=${s(this,se,Lc).call(this)?h:this.getAttribute("aria-label")??h}
|
|
229
347
|
aria-describedby=${e||h}
|
|
230
348
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
231
349
|
aria-disabled=${this.disabled?"true":h}>
|
|
232
|
-
<span class="label" id="${r(this,
|
|
233
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
234
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
235
|
-
<div class="options" part="options"><slot @slotchange=${r(this,
|
|
236
|
-
</div>`}};
|
|
350
|
+
<span class="label" id="${r(this,Dt)}-l" part="label" ?hidden=${!s(this,se,Lc).call(this)}>${this.label}<slot name="label"></slot>${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
351
|
+
${this.helpText?c`<p class="help" id="${r(this,Dt)}-help">${this.helpText}</p>`:h}
|
|
352
|
+
${this.error?c`<p class="error" id="${r(this,Dt)}-err" role="alert">${this.error}</p>`:h}
|
|
353
|
+
<div class="options" part="options"><slot @slotchange=${r(this,Dc)}></slot></div>
|
|
354
|
+
</div>`}};Ye=new WeakMap,Dt=new WeakMap,Xn=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,Xr=new WeakMap,se=new WeakSet,pm=function(){r(this,Jn)&&(this.value||(g(this,Xr,!0),this.value=s(this,se,Wi).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>g(this,Xr,!1))),g(this,Xn,this.value))},Dc=new WeakMap,Wi=function(){return[...this.querySelectorAll("cm-radio")]},um=function(){return s(this,se,Wi).call(this).filter(e=>!e.disabled&&!this.disabled)},Jr=new WeakMap,gm=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,r(this,Jr).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Ac=new WeakMap,Rc=new WeakMap,Lc=function(){return!!this.label||!!this.querySelector("[slot=label]")},Yi.formAssociated=!0,Yi.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}},Yi.styles=[k,x`
|
|
237
355
|
:host { display: block; }
|
|
238
356
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
239
357
|
.label { font-size: var(--cm-type-label-size); line-height: var(--cm-type-label-line-height); font-weight: var(--cm-type-label-weight); color: var(--cm-text-default); }
|
|
@@ -242,13 +360,13 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
242
360
|
.error { color: var(--cm-text-critical); }
|
|
243
361
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
244
362
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
245
|
-
`];$("cm-radio-group",
|
|
246
|
-
<input type="checkbox" role="switch" id=${r(this,
|
|
363
|
+
`];$("cm-radio-group",Yi);var Zr,Xi,Qn,Hc,gg,ni=class extends S{constructor(){super(...arguments);p(this,Hc);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;p(this,Zr,this.attachInternals());p(this,Xi,A("cm-tg"));p(this,Qn,!1)}connectedCallback(){super.connectedCallback(),g(this,Qn,this.checked)}get form(){return r(this,Zr).form}checkValidity(){return r(this,Zr).checkValidity()}formResetCallback(){this.checked=r(this,Qn)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,Zr).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${r(this,Xi)}>
|
|
364
|
+
<input type="checkbox" role="switch" id=${r(this,Xi)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
247
365
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
248
|
-
aria-describedby=${this.description?`${r(this,
|
|
366
|
+
aria-describedby=${this.description?`${r(this,Xi)}-d`:h} @change=${s(this,Hc,gg)} />
|
|
249
367
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
250
|
-
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,
|
|
251
|
-
</label>`}};
|
|
368
|
+
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Xi)}-d">${this.description}</span>`:h}</span>`:h}
|
|
369
|
+
</label>`}};Zr=new WeakMap,Xi=new WeakMap,Qn=new WeakMap,Hc=new WeakSet,gg=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ni.formAssociated=!0,ni.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ni.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},ni.styles=[k,x`
|
|
252
370
|
:host { display: inline-flex; }
|
|
253
371
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
254
372
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -276,7 +394,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
276
394
|
:host([disabled]) .track { opacity: .5; }
|
|
277
395
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
278
396
|
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
279
|
-
`];$("cm-toggle",
|
|
397
|
+
`];$("cm-toggle",ni);var Qr=x`
|
|
280
398
|
.pop {
|
|
281
399
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-4)); inset-inline: 0;
|
|
282
400
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
@@ -288,7 +406,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
288
406
|
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
289
407
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
290
408
|
}
|
|
291
|
-
`;function
|
|
409
|
+
`;function Nc(o,n,e){let t=i=>{n()&&!i.composedPath().includes(o)&&e()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)}var oi=x`
|
|
292
410
|
[role='group'] + [role='group'] { margin-block-start: var(--cm-space-4); padding-block-start: var(--cm-space-4); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
293
411
|
[role='option'] + [role='group'], [role='group'] + [role='option'] { margin-block-start: var(--cm-space-4); padding-block-start: var(--cm-space-4); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
294
412
|
.gh {
|
|
@@ -297,52 +415,54 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
297
415
|
}
|
|
298
416
|
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
299
417
|
.gopts { list-style: none; margin: 0; padding: 0; }
|
|
300
|
-
`;function
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
418
|
+
`;function ea(o){if(!o.some(t=>t.group))return o;let n=[],e=new Map;for(let t of o)if(t.group){let i=e.get(t.group);if(i)i.push(t);else{let a=[t];e.set(t.group,a),n.push({key:t.group,items:a})}}else{let i=n[n.length-1];i&&!i.key?i.items.push(t):n.push({key:"",items:[t]})}return n.flatMap(t=>t.items)}function Ic(o){let n=[];return o.forEach((e,t)=>{let i=e.group||"",a=n[n.length-1];a&&a.group===i?a.rows.push({row:e,index:t}):n.push({group:i,rows:[{row:e,index:t}]})}),n}var Pc=x`
|
|
419
|
+
[role='listbox'] { padding-block: var(--cm-space-4); }
|
|
420
|
+
[role='listbox'][hidden] { display: none; }
|
|
421
|
+
[role='option'] {
|
|
422
|
+
display: flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md); padding: var(--cm-space-8) var(--cm-space-12);
|
|
423
|
+
font-size: 14px; line-height: 20px; color: var(--cm-text-default); text-decoration: none; cursor: pointer;
|
|
424
|
+
}
|
|
425
|
+
[role='option'].active { background: var(--cm-bg-hover); box-shadow: inset 2px 0 0 var(--cm-border-strong); }
|
|
426
|
+
[role='option'].active:dir(rtl) { box-shadow: inset -2px 0 0 var(--cm-border-strong); }
|
|
427
|
+
[role='option'] cm-icon { flex: none; color: var(--cm-icon-selected); }
|
|
428
|
+
.text { flex: 1; min-width: 0; }
|
|
429
|
+
.title, .desc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
430
|
+
.desc { font-size: 12px; line-height: 16px; color: var(--cm-text-tertiary); }
|
|
431
|
+
.all { font-size: var(--cm-font-size-13); text-decoration: underline; }
|
|
432
|
+
.gh { padding-inline: var(--cm-space-12); }
|
|
433
|
+
kbd {
|
|
434
|
+
flex: none; min-width: 20px; padding: 0 var(--cm-space-4); font: inherit; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); text-align: center;
|
|
435
|
+
color: var(--cm-text-tertiary); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-xs);
|
|
436
|
+
}
|
|
437
|
+
`;function Oc(o,n,e,t){return c`<div role="presentation" class="gh" id=${o}><span>${n}</span>${e!==void 0?c`<span class="count" aria-hidden="true">${e}</span><span class="vh">, ${t}</span>`:h}</div>`}function qc(o,n=h){return c`${o.icon?c`<cm-icon name=${o.icon} size="16"></cm-icon>`:h}<span class="text"><span class="title">${o.title}</span>${o.description?c`<span class="vh">, </span><span class="desc">${o.description}</span>`:h}</span>${n}`}function Bc(o,n){let e=`${o.cls??""}${o.active?" active":""}`;return o.href?c`<a role="option" id=${o.id} class=${e} href=${o.href} tabindex="-1" aria-selected=${o.active?"true":"false"}
|
|
438
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</a>`:c`<div role="option" id=${o.id} class=${e} tabindex="-1" aria-selected=${o.active?"true":"false"}
|
|
439
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function Fc(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var zw=z("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),Xe,ue,ia,lt,ra,to,B,bm,fm,eo,ta,Ji,li,jc,Uc,io,Vc,bg,Kc,ci=class extends T{constructor(){super(...arguments);p(this,B);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.size="default";this.loading=!1;this._active=-1;this._slotted=[];p(this,Xe,this.attachInternals());p(this,ue,A("cm-sel"));p(this,ia,"");p(this,lt,"");p(this,ra,0);p(this,to,new MutationObserver(()=>s(this,B,bm).call(this)));p(this,Uc,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),s(this,B,eo).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),s(this,B,eo).call(this),s(this,B,li).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,B,jc).call(this,t);s(this,B,eo).call(this,i>=0?i:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?s(this,B,Ji).call(this,this._active):s(this,B,li).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?s(this,B,Ji).call(this,this._active):s(this,B,li).call(this,-1);break;case"Home":e.preventDefault(),s(this,B,li).call(this,"first");break;case"End":e.preventDefault(),s(this,B,li).call(this,"last");break;case"PageDown":e.preventDefault(),s(this,B,li).call(this,10);break;case"PageUp":e.preventDefault(),s(this,B,li).call(this,-10);break;case"Enter":e.preventDefault(),s(this,B,Ji).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),s(this,B,ta).call(this);break;case"Tab":s(this,B,Ji).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,lt)&&Date.now()-r(this,ra)<500){let i=s(this,B,jc).call(this," ");i>=0&&(this._active=i)}else s(this,B,Ji).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=s(this,B,jc).call(this,t);i>=0&&(this._active=i)}}});p(this,io,e=>{this.open&&!e.composedPath().includes(this)&&s(this,B,ta).call(this)});p(this,Vc,()=>{this.disabled||(this.open?s(this,B,ta).call(this):s(this,B,eo).call(this))});p(this,Kc,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),s(this,B,bm).call(this),r(this,to).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,io),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,to).disconnect(),document.removeEventListener("pointerdown",r(this,io),!0)}get form(){return r(this,Xe).form}get validity(){return r(this,Xe).validity}get validationMessage(){return r(this,Xe).validationMessage}checkValidity(){return r(this,Xe).checkValidity()}reportValidity(){return r(this,Xe).reportValidity()}formResetCallback(){this.value=r(this,ia),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?ea(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):ea(this._slotted)}firstUpdated(){r(this,ia)||g(this,ia,this.value)}updated(e){r(this,Xe).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,Xe).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,Xe).setValidity({valueMissing:!0},this.t("required"),t):r(this,Xe).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,ue)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(d=>d.value===this.value),i=[this.error&&`${r(this,ue)}-err`,this.helpText&&`${r(this,ue)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=(d,m)=>c`<li role="option" id="${r(this,ue)}-o${m}" class=${m===this._active?"active":""}
|
|
320
440
|
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":h}
|
|
321
|
-
@pointerenter=${()=>!d.disabled&&(this._active=
|
|
322
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
441
|
+
@pointerenter=${()=>!d.disabled&&(this._active=m)} @click=${()=>s(this,B,Ji).call(this,m)}>${d.label}</li>`;return c`<div class="field">
|
|
442
|
+
${this.label?c`<span class="label" id="${r(this,ue)}-l" part="label" @click=${r(this,Kc)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
323
443
|
<div class="wrap">
|
|
324
444
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
325
|
-
aria-labelledby=${this.label?`${r(this,
|
|
445
|
+
aria-labelledby=${this.label?`${r(this,ue)}-l`:h}
|
|
326
446
|
aria-label=${!this.label&&a?a:h}
|
|
327
|
-
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
328
|
-
aria-activedescendant=${this.open&&this._active>=0?`${r(this,
|
|
447
|
+
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,ue)}-list"
|
|
448
|
+
aria-activedescendant=${this.open&&this._active>=0?`${r(this,ue)}-o${this._active}`:h}
|
|
329
449
|
aria-required=${this.required?"true":h} aria-invalid=${this.error?"true":h}
|
|
330
450
|
aria-disabled=${this.disabled?"true":h} aria-describedby=${i||h} aria-busy=${this.loading?"true":h}
|
|
331
|
-
@click=${r(this,
|
|
332
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,
|
|
451
|
+
@click=${r(this,Vc)} @keydown=${r(this,Uc)} @blur=${()=>s(this,B,ta).call(this)}>
|
|
452
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,ue)}-v">${t?s(this,B,bg).call(this,t):this.placeholder}</span>
|
|
333
453
|
${this.loading?c`<span class="spin"><cm-spinner size="small" aria-hidden="true"></cm-spinner></span>`:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
334
454
|
</div>
|
|
335
|
-
<ul role="listbox" id="${r(this,
|
|
455
|
+
<ul role="listbox" id="${r(this,ue)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,ue)}-l`:h}
|
|
336
456
|
aria-label=${!this.label&&a?a:h} ?hidden=${!this.open}
|
|
337
457
|
@pointerdown=${d=>d.preventDefault()}>
|
|
338
|
-
${
|
|
339
|
-
<ul role="none" class="gopts">${d.rows.map(({row:u,index:v})=>
|
|
458
|
+
${Ic(e).map((d,m)=>d.group?c`<li role="group" aria-labelledby="${r(this,ue)}-g${m}"><div role="presentation" class="gh" id="${r(this,ue)}-g${m}">${d.group}</div>
|
|
459
|
+
<ul role="none" class="gopts">${d.rows.map(({row:u,index:v})=>l(u,v))}</ul></li>`:d.rows.map(({row:u,index:v})=>l(u,v)))}
|
|
340
460
|
</ul>
|
|
341
461
|
</div>
|
|
342
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
343
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
462
|
+
${this.error?c`<p class="error" id="${r(this,ue)}-err" role="alert">${this.error}</p>`:h}
|
|
463
|
+
${this.helpText?c`<p class="help" id="${r(this,ue)}-help">${this.helpText}</p>`:h}
|
|
344
464
|
<slot></slot>
|
|
345
|
-
</div>`}};
|
|
465
|
+
</div>`}};Xe=new WeakMap,ue=new WeakMap,ia=new WeakMap,lt=new WeakMap,ra=new WeakMap,to=new WeakMap,B=new WeakSet,bm=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,ia,this.value))},fm=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},eo=function(e){if(this.disabled||this.loading)return;let t=this.items.findIndex(i=>i.value===this.value);this.open=!0,this._active=e??(t>=0?t:s(this,B,fm).call(this)[0]??-1)},ta=function(){this.open=!1},Ji=function(e){let t=this.items[e];!t||t.disabled||(s(this,B,ta).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}))))},li=function(e){let t=s(this,B,fm).call(this);if(!t.length)return;if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);this._active=i<0?t[0]:t[Math.min(t.length-1,Math.max(0,i+e))]},jc=function(e){let t=Date.now();g(this,lt,t-r(this,ra)>500?e:r(this,lt)+e),g(this,ra,t);let i=this.items,a=this._active<0?0:this._active,l=r(this,lt).split("").every(u=>u===r(this,lt)[0]),d=l?r(this,lt)[0]:r(this,lt),m=l||r(this,lt).length===1?a+1:a;for(let u=0;u<i.length;u++){let v=(m+u)%i.length;if(!i[v].disabled&&i[v].label.toLowerCase().startsWith(d.toLowerCase()))return v}return-1},Uc=new WeakMap,io=new WeakMap,Vc=new WeakMap,bg=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},Kc=new WeakMap,ci.formAssociated=!0,ci.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ci.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},size:{reflect:!0},loading:{type:Boolean,reflect:!0},_active:{state:!0},_slotted:{state:!0}},ci.styles=[k,Ge,_c,oi,x`
|
|
346
466
|
:host { display: block; position: relative; }
|
|
347
467
|
.label { cursor: default; }
|
|
348
468
|
.wrap { position: relative; }
|
|
@@ -375,16 +495,16 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
375
495
|
[role='group'] { display: block; }
|
|
376
496
|
slot { display: none; }
|
|
377
497
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
378
|
-
`];$("cm-select",
|
|
498
|
+
`];$("cm-select",ci);var Hw=z("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),sa,Wc,ro,Te,aa,fg,vg,vm,di=class extends T{constructor(){super(...arguments);p(this,Te);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;p(this,sa,this.attachInternals());p(this,Wc,A("cm-search"));p(this,ro,"")}connectedCallback(){super.connectedCallback(),g(this,ro,this.value)}get form(){return r(this,sa).form}checkValidity(){return r(this,sa).checkValidity()}formResetCallback(){this.value=r(this,ro)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,sa).setFormValue(this.value)}render(){return c`<div class="box" part="box">
|
|
379
499
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
380
|
-
<input id=${r(this,
|
|
381
|
-
aria-label=${this.label} .value=${
|
|
382
|
-
@input=${s(this
|
|
383
|
-
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this
|
|
500
|
+
<input id=${r(this,Wc)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
501
|
+
aria-label=${this.label} .value=${ne(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
502
|
+
@input=${s(this,Te,fg)} @change=${()=>s(this,Te,aa).call(this,"change")} @keydown=${s(this,Te,vg)} />
|
|
503
|
+
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${s(this,Te,vm)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
384
504
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
385
505
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
386
|
-
@click=${()=>s(this
|
|
387
|
-
</div>`}};
|
|
506
|
+
@click=${()=>s(this,Te,aa).call(this,"cm-filter")}><cm-icon name="filter" size="16"></cm-icon>${this.filterCount>0?c`<span class="count" aria-hidden="true">${this.filterCount}</span>`:h}</button>`:h}
|
|
507
|
+
</div>`}};sa=new WeakMap,Wc=new WeakMap,ro=new WeakMap,Te=new WeakSet,aa=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},fg=function(e){this.value=e.target.value},vg=function(e){e.key==="Enter"?s(this,Te,aa).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),s(this,Te,vm).call(this))},vm=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),s(this,Te,aa).call(this,"input"),s(this,Te,aa).call(this,"change")},di.formAssociated=!0,di.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},di.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}},di.styles=[k,Ge,x`
|
|
388
508
|
:host { display: block; }
|
|
389
509
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
390
510
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -418,7 +538,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
418
538
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
419
539
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
420
540
|
:host([disabled]) button { cursor: not-allowed; }
|
|
421
|
-
`];$("cm-search",
|
|
541
|
+
`];$("cm-search",di);var Bw=z("tag",{remove:"Remove {label}"}),Gc,yg,Zi=class extends T{constructor(){super(...arguments);p(this,Gc);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||this.t("remove",{label:this.textContent?.trim()??""}).trim();return c`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?c`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${s(this,Gc,yg)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};Gc=new WeakSet,yg=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Zi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},Zi.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Zi.styles=[k,x`
|
|
422
542
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
423
543
|
.tag {
|
|
424
544
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -436,47 +556,47 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
436
556
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
437
557
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
|
|
438
558
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
|
|
439
|
-
`];$("cm-tag",
|
|
440
|
-
`):[]:this.value=e)}get items(){return this.options?.length?
|
|
441
|
-
`))}else r(this,
|
|
442
|
-
aria-selected=${
|
|
443
|
-
@pointerenter=${()=>!
|
|
444
|
-
${
|
|
445
|
-
${this.label?c`<label class="label" id="${r(this,
|
|
559
|
+
`];$("cm-tag",Zi);var Xw=z("combobox",{noResults:"No results",results:{one:"{count} result",other:"{count} results"},add:"Add \u201C{value}\u201D",remove:"Remove {label}",required:"Please select an item in the list.",requiredMultiple:"Choose at least one item.",grouped:"{group}: {label}",more:"+{count} more"}),Ae,ge,oo,la,lo,co,ho,L,ym,xg,ao,Yc,so,na,oa,At,wg,no,xm,wm,Qi,Xc,Jc,er,$g,Zc,Qc,ed,kg,Eg,hi=class extends T{constructor(){super(...arguments);p(this,L);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.size="default";this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.maxTags=3;this._query="";this._focusIn=!1;this._active=-1;this._slotted=[];this._typing=!1;p(this,Ae,this.attachInternals());p(this,ge,A("cm-cb"));p(this,oo,null);p(this,la,new Map);p(this,lo,new Map);p(this,co,new MutationObserver(()=>s(this,L,ym).call(this)));p(this,ho);p(this,Xc,()=>{this._focusIn=!0});p(this,Jc,()=>{setTimeout(()=>{this._focusIn=this.matches(":focus-within")})});p(this,Zc,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,s(this,L,oa).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});p(this,Qc,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?s(this,L,no).call(this,1):(s(this,L,oa).call(this),e.altKey||s(this,L,no).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?s(this,L,no).call(this,-1):(s(this,L,oa).call(this),s(this,L,no).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),s(this,L,xm).call(this,this._active)):r(this,L,Yc)&&(e.preventDefault(),s(this,L,wm).call(this,r(this,L,Yc)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),s(this,L,At).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",s(this,L,na).call(this)));break;case"ArrowLeft":case"ArrowRight":{let i=e.target;this.multiple&&this.values.length&&J(e,this)==="ArrowLeft"&&i.selectionStart===0&&i.selectionEnd===0&&(e.preventDefault(),s(this,L,At).call(this),s(this,L,er).call(this,this.values.length-1));break}case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":s(this,L,At).call(this);break;default:}});p(this,ed,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(s(this,L,At).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?s(this,L,ao).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),s(this,L,ym).call(this),r(this,co).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),g(this,ho,Nc(this,()=>this.open,()=>s(this,L,At).call(this))),this.addEventListener("focusin",r(this,Xc)),this.addEventListener("focusout",r(this,Jc))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,co).disconnect(),(e=r(this,ho))==null||e.call(this)}get form(){return r(this,Ae).form}get validity(){return r(this,Ae).validity}get validationMessage(){return r(this,Ae).validationMessage}checkValidity(){return r(this,Ae).checkValidity()}reportValidity(){return r(this,Ae).reportValidity()}formResetCallback(){let e=r(this,oo)??{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(`
|
|
560
|
+
`):[]:this.value=e)}get items(){return this.options?.length?ea(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):ea(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let i=t.label.toLowerCase();return this.filter==="starts-with"?i.startsWith(e):i.includes(e)})}firstUpdated(){g(this,oo,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,la).set(t.value,t.label),t.group&&r(this,lo).set(t.value,t.group);if((e.has("value")||e.has("options")||e.has("_slotted")||e.has("showGroup"))&&!this.multiple&&!this._typing&&(this._query=this.value?s(this,L,ao).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=s(this,L,so).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let a=new FormData;for(let l of this.values)a.append(this.name,l);r(this,Ae).setFormValue(a,this.values.join(`
|
|
561
|
+
`))}else r(this,Ae).setFormValue(null);else r(this,Ae).setFormValue(this.value||null,this.value);let i=this.multiple?!this.values.length:!this.value;this.error?r(this,Ae).setValidity({customError:!0},this.error,t):this.required&&i?r(this,Ae).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),t):r(this,Ae).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,ge)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),s(this,L,na).call(this))}focus(e){this.renderRoot.querySelector("input")?.focus(e)}render(){let e=s(this,L,so).call(this),t=[this.error&&`${r(this,ge)}-err`,this.helpText&&`${r(this,ge)}-help`].filter(Boolean).join(" "),i=this.getAttribute("aria-label"),a=m=>this.multiple?this.values.includes(m):m===this.value,l=(m,u)=>c`<li role="option" id="${r(this,ge)}-o${u}" class=${u===this._active?"active":""}
|
|
562
|
+
aria-selected=${m.create?"false":a(m.value)?"true":"false"} aria-disabled=${m.disabled?"true":h}
|
|
563
|
+
@pointerenter=${()=>!m.disabled&&(this._active=u)} @click=${()=>s(this,L,xm).call(this,u)}>
|
|
564
|
+
${m.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:m.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${s(this,L,kg).call(this,m.label)}</span>`}</li>`,d=this.loading?this.loadingText||this.t("loading"):this.open?e.length?this.t("results",{count:e.length}):this.emptyText||this.t("noResults"):"";return c`<div class="field">
|
|
565
|
+
${this.label?c`<label class="label" id="${r(this,ge)}-l" for="${r(this,ge)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
446
566
|
<div class="wrap">
|
|
447
|
-
<div class="box" part="box" @click=${
|
|
567
|
+
<div class="box" part="box" @click=${m=>{m.target.closest("cm-tag[removable]")||s(this,L,Qi).call(this)}}>
|
|
448
568
|
<div class="chips ${this.multiple&&this.values.length?`has-tags${this._focusIn||this.open?"":" idle"}`:""}">
|
|
449
|
-
${this.multiple?s(this,L,
|
|
450
|
-
<input id="${r(this,
|
|
451
|
-
.value=${
|
|
569
|
+
${this.multiple?s(this,L,Eg).call(this):h}
|
|
570
|
+
<input id="${r(this,ge)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
571
|
+
.value=${ne(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
452
572
|
aria-label=${!this.label&&i?i:h}
|
|
453
|
-
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
454
|
-
aria-activedescendant=${this.open&&this._active>=0?`${r(this,
|
|
573
|
+
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,ge)}-list"
|
|
574
|
+
aria-activedescendant=${this.open&&this._active>=0?`${r(this,ge)}-o${this._active}`:h}
|
|
455
575
|
aria-invalid=${this.error?"true":h} aria-describedby=${t||h}
|
|
456
576
|
aria-required=${this.required?"true":h} ?disabled=${this.disabled}
|
|
457
|
-
@input=${r(this,
|
|
458
|
-
@click=${()=>{this.open||s(this,L,
|
|
577
|
+
@input=${r(this,Zc)} @keydown=${r(this,Qc)} @blur=${r(this,ed)}
|
|
578
|
+
@click=${()=>{this.open||s(this,L,oa).call(this)}} @change=${m=>m.stopPropagation()} />
|
|
459
579
|
</div>
|
|
460
|
-
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,L,
|
|
580
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?s(this,L,At).call(this):(s(this,L,oa).call(this),s(this,L,Qi).call(this))}}></cm-icon>
|
|
461
581
|
</div>
|
|
462
|
-
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${
|
|
463
|
-
<ul role="listbox" id="${r(this,
|
|
464
|
-
aria-labelledby=${this.label?`${r(this,
|
|
582
|
+
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${m=>m.preventDefault()}>
|
|
583
|
+
<ul role="listbox" id="${r(this,ge)}-list" part="listbox" ?hidden=${!e.length}
|
|
584
|
+
aria-labelledby=${this.label?`${r(this,ge)}-l`:h} aria-label=${!this.label&&i?i:h}
|
|
465
585
|
aria-multiselectable=${this.multiple?"true":h}>
|
|
466
|
-
${
|
|
467
|
-
<ul role="none" class="gopts">${
|
|
586
|
+
${Ic(e).map((m,u)=>m.group?c`<li role="group" aria-labelledby="${r(this,ge)}-g${u}"><div role="presentation" class="gh" id="${r(this,ge)}-g${u}">${m.group}</div>
|
|
587
|
+
<ul role="none" class="gopts">${m.rows.map(({row:v,index:b})=>l(v,b))}</ul></li>`:m.rows.map(({row:v,index:b})=>l(v,b)))}
|
|
468
588
|
</ul>
|
|
469
589
|
${this.loading?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText||this.t("loading")}</span></p>`:e.length?h:c`<p class="message">${this.emptyText||this.t("noResults")}</p>`}
|
|
470
590
|
</div>
|
|
471
591
|
</div>
|
|
472
592
|
<span class="vh" role="status" aria-live="polite">${d}</span>
|
|
473
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
474
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
593
|
+
${this.error?c`<p class="error" id="${r(this,ge)}-err" role="alert">${this.error}</p>`:h}
|
|
594
|
+
${this.helpText?c`<p class="help" id="${r(this,ge)}-help">${this.helpText}</p>`:h}
|
|
475
595
|
<slot></slot>
|
|
476
|
-
</div>`}};
|
|
477
|
-
remove-label=${this.t("remove",{label:s(this,L,
|
|
478
|
-
@keydown=${
|
|
479
|
-
@cm-remove=${()=>{this.removeValue(i),s(this,L,
|
|
596
|
+
</div>`}};Ae=new WeakMap,ge=new WeakMap,oo=new WeakMap,la=new WeakMap,lo=new WeakMap,co=new WeakMap,ho=new WeakMap,L=new WeakSet,ym=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,a={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(a.group=i.label),a}),!this.hasUpdated){let t=e.filter(i=>i.hasAttribute("selected")).map(i=>i.value);this.multiple&&!this.values.length&&t.length&&(this.values=t),!this.multiple&&!this.value&&t.length&&(this.value=t[0])}},xg=function(e){return this.items.find(t=>t.value===e)?.label??r(this,la).get(e)??e},ao=function(e){let t=s(this,L,xg).call(this,e);if(!this.showGroup)return t;let i=this.items.find(a=>a.value===e)?.group??r(this,lo).get(e);return i?this.t("grouped",{group:i,label:t}):t},Yc=function(){if(!this.allowCustom||!this._typing)return"";let e=this._query.trim();if(!e)return"";let t=e.toLowerCase();return this.items.some(i=>i.label.toLowerCase()===t||i.value.toLowerCase()===t)||(this.multiple?this.values.some(i=>i.toLowerCase()===t):this.value.toLowerCase()===t)?"":e},so=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,L,Yc);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},na=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},oa=function(){this.disabled||(this.open=!0)},At=function(){this.open=!1,this._active=-1},wg=function(e=s(this,L,so).call(this)){return e.flatMap((t,i)=>t.disabled?[]:[i])},no=function(e){let t=s(this,L,wg).call(this);if(!t.length){this._active=-1;return}if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);if(i<0){this._active=e>0?t[0]:t[t.length-1];return}this._active=t[(i+e+t.length)%t.length]},xm=function(e){let t=s(this,L,so).call(this)[e];if(!(!t||t.disabled)){if(t.create){s(this,L,wm).call(this,t.value);return}if(this.multiple){this.values=this.values.includes(t.value)?this.values.filter(i=>i!==t.value):[...this.values,t.value],this._query="",this._typing=!1,this._active=-1,s(this,L,na).call(this),s(this,L,Qi).call(this);return}s(this,L,At).call(this),this._typing=!1,this._query=this.showGroup&&t.group?this.t("grouped",{group:t.group,label:t.label}):t.label,t.value!==this.value&&(this.value=t.value,s(this,L,na).call(this))}},wm=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,la).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(s(this,L,At).call(this),this.value=e,this._typing=!1,this._query=e),s(this,L,na).call(this))},Qi=function(){this.renderRoot.querySelector("input")?.focus()},Xc=new WeakMap,Jc=new WeakMap,er=async function(e){await this.updateComplete;let t=this.renderRoot.querySelectorAll("cm-tag[data-i]");e>=0&&e<t.length?t[e].focus():s(this,L,Qi).call(this)},$g=function(e,t){let i=J(e,this),a=this.values.length-1;if(i==="ArrowLeft")e.preventDefault(),s(this,L,er).call(this,Math.max(0,t-1));else if(i==="ArrowRight")e.preventDefault(),s(this,L,er).call(this,t<a?t+1:-1);else if(i==="Home")e.preventDefault(),s(this,L,er).call(this,0);else if(i==="End")e.preventDefault(),s(this,L,er).call(this,a);else if(i==="Escape")e.preventDefault(),e.stopPropagation(),s(this,L,Qi).call(this);else if((i==="Backspace"||i==="Delete")&&!this.disabled){e.preventDefault(),this.removeValue(this.values[t]);let l=this.values.length;s(this,L,er).call(this,i==="Backspace"?t>0?t-1:l?0:-1:t<l?t:-1)}},Zc=new WeakMap,Qc=new WeakMap,ed=new WeakMap,kg=function(e){let t=this._typing?this._query.trim():"";if(!t||this.filter==="none")return e;let i=e.toLowerCase().indexOf(t.toLowerCase());return i<0||this.filter==="starts-with"&&i!==0?e:c`${e.slice(0,i)}<mark>${e.slice(i,i+t.length)}</mark>${e.slice(i+t.length)}`},Eg=function(){let e=this.maxTags>0&&!this._focusIn&&!this.open&&this.values.length>this.maxTags?this.maxTags:this.values.length,t=this.values.length-e;return c`${this.values.slice(0,e).map((i,a)=>c`<cm-tag removable tabindex="-1" data-i=${a} part="tag" ?disabled=${this.disabled}
|
|
597
|
+
remove-label=${this.t("remove",{label:s(this,L,ao).call(this,i)})}
|
|
598
|
+
@keydown=${l=>s(this,L,$g).call(this,l,a)}
|
|
599
|
+
@cm-remove=${()=>{this.removeValue(i),s(this,L,Qi).call(this)}}>${s(this,L,ao).call(this,i)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},hi.formAssociated=!0,hi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},hi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},values:{type:Array},placeholder:{},options:{type:Array},multiple:{type:Boolean,reflect:!0},size:{reflect:!0},allowCustom:{type:Boolean,attribute:"allow-custom"},filter:{},loading:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},maxTags:{type:Number,attribute:"max-tags"},_query:{state:!0},_focusIn:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},hi.styles=[k,Ge,Qr,_c,oi,x`
|
|
480
600
|
:host { display: block; position: relative; }
|
|
481
601
|
.wrap { position: relative; }
|
|
482
602
|
.box {
|
|
@@ -517,33 +637,31 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
517
637
|
.create { font-style: normal; }
|
|
518
638
|
slot { display: none; }
|
|
519
639
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
520
|
-
`];$("cm-combobox",
|
|
521
|
-
aria-selected=${w===this._active?"true":"false"} @pointerenter=${()=>this._active=w}
|
|
522
|
-
@click=${y=>s(this,Y,fu).call(this,y,u)}>${v}</a>`};return c`<div class="wrap">
|
|
640
|
+
`];$("cm-combobox",hi);function mo(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var Zv={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"};function td(o,n){let e=o.trim().toLowerCase().split("+").map(a=>a.trim());e.length>1&&e[e.length-1]===""&&e[e.length-2]===""&&e.splice(-2,2,"+");let t=e.pop();if(!t)return null;let i={key:Zv[t]??t,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let a of e)if(a==="mod")n?i.meta=!0:i.ctrl=!0;else if(a==="ctrl"||a==="control")i.ctrl=!0;else if(a==="meta"||a==="cmd"||a==="command")i.meta=!0;else if(a==="alt"||a==="option"||a==="opt")i.alt=!0;else if(a==="shift")i.shift=!0;else return null;return i}function $m(o,n=mo()){let e=td(o,n);return!!e&&(e.ctrl||e.meta||e.alt)}function km(o,n,e=mo()){let t=td(n,e);if(!t||!o.key||o.ctrlKey!==t.ctrl||o.metaKey!==t.meta||o.altKey!==t.alt)return!1;let i=/^[a-z0-9]$/.test(t.key);return(i||t.key.length>1)&&o.shiftKey!==t.shift?!1:o.key.toLowerCase()===t.key?!0:i?o.code===(/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`):!1}function id(o){let n=o.composedPath()[0];return!!n&&(n.isContentEditable||/^(input|textarea|select)$/i.test(n.localName??""))}var Qv={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7"},ey={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},ty={escape:"Esc",enter:"\u21B5"," ":"Space",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",backspace:"\u232B",delete:"Del",tab:"Tab",pageup:"PgUp",pagedown:"PgDn",home:"Home",end:"End"},iy=o=>ty[o]??(o.length===1?o.toUpperCase():o[0].toUpperCase()+o.slice(1));function rd(o,n=mo()){let e=[];for(let t of o.trim().split(/\s+/).filter(Boolean)){let i=td(t,n);if(!i)return[o.trim()];let a=n?Qv:ey,l=n?["ctrl","alt","shift","meta"]:["ctrl","meta","alt","shift"];for(let d of l)i[d]&&e.push(a[d]);e.push(iy(i.key))}return e}function Mg(o,n=mo()){if(/\s/.test(o.trim()))return"";let e=td(o,n);if(!e)return"";let t=e.key===" "?"Space":e.key.length===1?e.key.toUpperCase():e.key.replace(/^(arrow|page)?(\w)/,(i,a,l)=>a?`${a[0].toUpperCase()}${a.slice(1)}${l.toUpperCase()}`:l.toUpperCase());return[e.ctrl&&"Control",e.meta&&"Meta",e.alt&&"Alt",e.shift&&"Shift",t].filter(Boolean).join("+")}var n0=z("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),Je,po,X,ad,sd,ca,Em,nd,Tg,od,uo,Mm,zg,tr=class extends T{constructor(){super(...arguments);p(this,X);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;p(this,Je,A("cm-gs"));p(this,po);p(this,nd,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),s(this,X,Em).call(this)});p(this,od,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),s(this,X,Tg).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,X,sd)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,Je)}-o${this._active}`)?.click());break;case"Escape":r(this,X,sd)?(e.preventDefault(),e.stopPropagation(),s(this,X,ca).call(this)):this.value&&(e.preventDefault(),s(this,X,Mm).call(this,!1));break;case"Tab":s(this,X,ca).call(this);break;default:}});p(this,uo,e=>{!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented||id(e)||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),g(this,po,Nc(this,()=>this.open,()=>s(this,X,ca).call(this))),document.addEventListener("keydown",r(this,uo))}disconnectedCallback(){var e;super.disconnectedCallback(),(e=r(this,po))==null||e.call(this),document.removeEventListener("keydown",r(this,uo))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=s(this,X,ad).call(this).length&&(this._active=-1)}updated(e){(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,Je)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=s(this,X,ad).call(this),t=r(this,X,sd),i=e.filter(u=>u.item).length,a=this.loading&&t?this.loadingText:t?e.length?this.t("results",{count:i}):this.emptyText:"",l=-1,d=(this.results??[]).filter(u=>u?.items?.length),m=(u,v,b="")=>{let w=++l;return Bc({id:`${r(this,Je)}-o${w}`,active:w===this._active,href:u.href,cls:b,onHover:()=>this._active=w,onChoose:y=>s(this,X,zg).call(this,y,u)},v)};return c`<div class="wrap">
|
|
523
641
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
524
642
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
525
643
|
|
|
526
|
-
<input id="${r(this,
|
|
527
|
-
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${
|
|
528
|
-
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
529
|
-
aria-activedescendant=${t&&this._active>=0?`${r(this,
|
|
644
|
+
<input id="${r(this,Je)}-in" part="input" type="search" role="combobox" enterkeyhint="search" autocomplete="off" spellcheck="false"
|
|
645
|
+
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${ne(this.value)}
|
|
646
|
+
aria-autocomplete="list" aria-expanded=${t?"true":"false"} aria-controls="${r(this,Je)}-list"
|
|
647
|
+
aria-activedescendant=${t&&this._active>=0?`${r(this,Je)}-o${this._active}`:h}
|
|
530
648
|
aria-keyshortcuts=${this.shortcut||h}
|
|
531
|
-
@input=${r(this,
|
|
649
|
+
@input=${r(this,nd)} @keydown=${r(this,od)}
|
|
532
650
|
@focus=${()=>{this.value.trim()&&(this.open=!0)}} @click=${()=>{this.value.trim()&&(this.open=!0)}} />
|
|
533
|
-
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,
|
|
651
|
+
${this.value?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${()=>s(this,X,Mm).call(this)}><cm-icon name="close" size="14"></cm-icon></button>`:this.shortcut?c`<kbd aria-hidden="true">${this.shortcut}</kbd>`:h}
|
|
534
652
|
</div>
|
|
535
653
|
<div class="pop" part="popover" ?hidden=${!t} @pointerdown=${u=>u.preventDefault()}>
|
|
536
|
-
<div role="listbox" id="${r(this,
|
|
537
|
-
${d.map((u,v)=>{let
|
|
538
|
-
|
|
539
|
-
${u.items.map(w=>
|
|
540
|
-
${u.href?
|
|
654
|
+
<div role="listbox" id="${r(this,Je)}-list" part="listbox" aria-label=${this.label} ?hidden=${!e.length}>
|
|
655
|
+
${d.map((u,v)=>{let b=u.total??u.items.length;return c`<div role="group" aria-labelledby="${r(this,Je)}-g${v}">
|
|
656
|
+
${Oc(`${r(this,Je)}-g${v}`,u.label,this.formatNumber(b),this.t("results",{count:b}))}
|
|
657
|
+
${u.items.map(w=>m({group:u,item:w,href:w.href},qc(w)))}
|
|
658
|
+
${u.href?m({group:u,href:u.href},c`<span class="text">${u.seeAllLabel||this.seeAllLabel}</span>`,"all"):h}
|
|
541
659
|
</div>`})}
|
|
542
660
|
</div>
|
|
543
661
|
${this.loading?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText}</span></p>`:e.length?h:c`<p class="message" aria-hidden="true">${this.emptyText}</p>`}
|
|
544
662
|
</div>
|
|
545
663
|
<span class="vh" role="status" aria-live="polite">${a}</span>
|
|
546
|
-
</div>`}};
|
|
664
|
+
</div>`}};Je=new WeakMap,po=new WeakMap,X=new WeakSet,ad=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}]:[]])},sd=function(){return this.open&&!!this.value.trim()},ca=function(){this.open=!1,this._active=-1},Em=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},nd=new WeakMap,Tg=function(e){this._active=Fc(this._active,e,s(this,X,ad).call(this).length)},od=new WeakMap,uo=new WeakMap,Mm=function(e=!0){this.value="",s(this,X,ca).call(this),e&&this.renderRoot.querySelector("input")?.focus(),s(this,X,Em).call(this)},zg=function(e,t){this.dispatchEvent(new CustomEvent("cm-select",{detail:{href:t.href,item:t.item,group:t.group},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault(),s(this,X,ca).call(this)},tr.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},tr.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}},tr.styles=[k,Qr,oi,Pc,x`
|
|
547
665
|
:host { display: block; position: relative; }
|
|
548
666
|
.wrap { position: relative; }
|
|
549
667
|
.box {
|
|
@@ -566,45 +684,133 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
566
684
|
}
|
|
567
685
|
.clear:hover { background: var(--cm-bg-hover); }
|
|
568
686
|
.clear:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
569
|
-
kbd {
|
|
570
|
-
flex: none; min-width: 20px; padding: 0 var(--cm-space-4); font: inherit; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); text-align: center;
|
|
571
|
-
color: var(--cm-text-tertiary); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-xs);
|
|
572
|
-
}
|
|
573
687
|
.box:focus-within kbd { display: none; }
|
|
574
688
|
.pop {
|
|
575
689
|
position: var(--cm-global-search-results-position, absolute);
|
|
576
690
|
box-shadow: var(--cm-global-search-results-shadow, var(--cm-shadow-md));
|
|
577
691
|
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
578
692
|
}
|
|
579
|
-
[role='listbox'] { padding-block: var(--cm-space-4); }
|
|
580
|
-
[role='listbox'][hidden] { display: none; }
|
|
581
|
-
[role='option'] {
|
|
582
|
-
display: flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md); padding: var(--cm-space-8) var(--cm-space-12);
|
|
583
|
-
font-size: 14px; line-height: 20px; color: var(--cm-text-default); text-decoration: none; cursor: pointer;
|
|
584
|
-
}
|
|
585
|
-
[role='option'].active { background: var(--cm-bg-hover); box-shadow: inset 2px 0 0 var(--cm-border-strong); }
|
|
586
|
-
[role='option'].active:dir(rtl) { box-shadow: inset -2px 0 0 var(--cm-border-strong); }
|
|
587
|
-
[role='option'] cm-icon { flex: none; color: var(--cm-icon-selected); }
|
|
588
|
-
.text { flex: 1; min-width: 0; }
|
|
589
|
-
.title, .desc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
590
|
-
.desc { font-size: 12px; line-height: 16px; color: var(--cm-text-tertiary); }
|
|
591
|
-
.all { font-size: var(--cm-font-size-13); text-decoration: underline; }
|
|
592
|
-
.gh { padding-inline: var(--cm-space-12); }
|
|
593
693
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
594
|
-
`];$("cm-global-search",
|
|
595
|
-
<
|
|
596
|
-
<
|
|
597
|
-
|
|
694
|
+
`];$("cm-global-search",tr);var Tm=0,_g="";function zm(){Tm++===0&&(_g=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function go(){Tm>0&&--Tm===0&&(document.documentElement.style.overflow=_g)}function _m(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var da,Rt,ha,ma,ld,cd,dd,hd,md,pd,ee=class extends T{constructor(){super(...arguments);p(this,ma);this.open=!1;this.label="";this.uid=A("cm-ovl");p(this,da,null);p(this,Rt,!1);p(this,ha,!1);p(this,cd,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});p(this,dd,e=>{e.preventDefault(),this.requestClose("escape")});p(this,hd,()=>{this.open&&!this.dialog?.open&&(this.open=!1,s(this,ma,ld).call(this))});p(this,md,e=>{g(this,ha,e.target===e.currentTarget)});p(this,pd,e=>{if(e.target===e.currentTarget&&r(this,ha)){let t=e.currentTarget.getBoundingClientRect();(!(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom)||this.backdropFillsDialog)&&this.requestClose("backdrop")}g(this,ha,!1)});this.backdropFillsDialog=!1}show(){this.open=!0}close(){this.open=!1}requestClose(e="method"){let t=this.dispatchEvent(new CustomEvent("cm-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0}));return t&&(this.open=!1),t}closeNow(){this.open=!1;let e=this.dialog;e?.open&&(e.close(),s(this,ma,ld).call(this))}get dialog(){return this.renderRoot?.querySelector("dialog")}updated(e){if(super.updated(e),!e.has("open"))return;let t=this.dialog;if(t)if(this.open&&!t.open){if(g(this,da,_m()),!this.isConnected)return;t.showModal(),r(this,Rt)||(zm(),g(this,Rt,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),s(this,ma,ld).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,Rt)&&(go(),g(this,Rt,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
695
|
+
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
696
|
+
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
697
|
+
<cm-icon name="close" size="18"></cm-icon></button>
|
|
698
|
+
</header>`}renderDialog(e,t=""){return c`<dialog part="dialog" class=${t}
|
|
699
|
+
aria-labelledby=${this.heading?`${this.uid}-h`:h}
|
|
700
|
+
aria-label=${!this.heading&&this.label?this.label:h}
|
|
701
|
+
@keydown=${r(this,cd)} @cancel=${r(this,dd)} @close=${r(this,hd)}
|
|
702
|
+
@pointerdown=${r(this,md)} @click=${r(this,pd)}>${e}</dialog>`}};da=new WeakMap,Rt=new WeakMap,ha=new WeakMap,ma=new WeakSet,ld=function(){r(this,Rt)&&(go(),g(this,Rt,!1));let e=r(this,da);g(this,da,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},cd=new WeakMap,dd=new WeakMap,hd=new WeakMap,md=new WeakMap,pd=new WeakMap,ee.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},ee.overlayStyles=[k,x`
|
|
703
|
+
:host { display: contents; }
|
|
704
|
+
dialog {
|
|
705
|
+
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
706
|
+
font: inherit; overflow: visible;
|
|
707
|
+
}
|
|
708
|
+
dialog::backdrop { background: var(--cm-overlay, rgba(0, 0, 0, 0.4)); }
|
|
709
|
+
.panel {
|
|
710
|
+
display: flex; flex-direction: column; background: var(--cm-bg-surface); color: var(--cm-text-default);
|
|
711
|
+
overflow: hidden; outline: none;
|
|
712
|
+
}
|
|
713
|
+
.head {
|
|
714
|
+
display: flex; align-items: center; gap: var(--cm-space-8); flex: none; min-height: 40px; padding-block: var(--cm-space-8); padding-inline: var(--cm-space-16) var(--cm-space-8);
|
|
715
|
+
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
716
|
+
}
|
|
717
|
+
.head h2 { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
|
|
718
|
+
.x {
|
|
719
|
+
display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
720
|
+
background: none; color: inherit; cursor: pointer;
|
|
721
|
+
}
|
|
722
|
+
.x:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
723
|
+
.body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--cm-space-20); font-size: 14px; line-height: 20px; }
|
|
724
|
+
.foot {
|
|
725
|
+
display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-8); flex: none; padding: var(--cm-space-12) var(--cm-space-20);
|
|
726
|
+
border-top: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
727
|
+
}
|
|
728
|
+
.foot[hidden] { display: none; }
|
|
729
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
730
|
+
dialog[open] .panel { animation: cm-ovl-in var(--cm-duration-base) var(--cm-easing-standard); }
|
|
731
|
+
|
|
732
|
+
}
|
|
733
|
+
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
734
|
+
`];var w0=z("commandPalette",{label:"Command palette",placeholder:"Search or run a command",recent:"Recent",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all"}),Cg=o=>o.normalize("NFD").replace(/\p{M}/gu,"").toLocaleLowerCase();function Sg(o,n){let e=Cg(n).split(/\s+/).filter(Boolean);if(!e.length)return!0;let t=Cg([o.title,...o.keywords??[]].join(" "));return e.every(i=>t.includes(i))}var fo,ve,Cm,Sm,bo,ud,gd,Lg,Dg,pa=class extends ee{constructor(){super();p(this,ve);this.value="";this.results=[];this.actions=[];this.recent=[];this.loading=!1;this.shortcut="";this._active=-1;p(this,fo,e=>{!this.shortcut||e.defaultPrevented||e.repeat||!km(e,this.shortcut)||!this.open&&!$m(this.shortcut)&&id(e)||this.open&&!$m(this.shortcut)||(e.preventDefault(),this.toggle())});p(this,ud,e=>{this.value=e.target.value,this._active=s(this,ve,bo).call(this).length?0:-1,this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))});p(this,gd,e=>{let t=s(this,ve,bo).call(this).length;switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this._active=Fc(this._active,e.key==="ArrowDown"?1:-1,t);break;case"Home":case"End":if(e.shiftKey||!t)break;e.preventDefault(),this._active=e.key==="Home"?0:t-1;break;case"Enter":if(e.isComposing||this._active<0)break;e.preventDefault(),this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.click();break;default:}});this.label=void 0}toggle(){this.open?this.requestClose("method"):this.show()}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",r(this,fo))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",r(this,fo))}willUpdate(e){if(super.willUpdate?.(e),e.has("open")&&!this.open&&e.get("open")&&(this.value="",this._active=-1),["results","actions","recent","loading","value","open"].some(t=>e.has(t))){let t=s(this,ve,bo).call(this).length;(this._active>=t||this._active<0)&&(this._active=t?0:-1)}}updated(e){super.updated(e),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.scrollIntoView({block:"nearest"})}focusFirst(){let e=this.renderRoot.querySelector("input");e?.focus(),e?.select()}render(){let e=this.open?s(this,ve,Sm).call(this):[],t=s(this,ve,bo).call(this,e),i=r(this,ve,Cm),a=t.filter(u=>u.item).length,l=!this.open||!i?"":this.loading?this.loadingText:t.length?this.t("results",{count:a}):this.emptyText,d=this.uid,m=-1;return this.renderDialog(c`<div class="panel" part="panel">
|
|
735
|
+
<div class="top">
|
|
736
|
+
<div class="box" part="box">
|
|
737
|
+
<cm-icon name="search" size="16"></cm-icon>
|
|
738
|
+
<input id="${d}-in" part="input" type="text" role="combobox" enterkeyhint="go" autocomplete="off" spellcheck="false"
|
|
739
|
+
aria-label=${this.label} placeholder=${this.placeholder||h} .value=${ne(this.value)}
|
|
740
|
+
aria-autocomplete="list" aria-expanded=${t.length?"true":"false"} aria-controls="${d}-list"
|
|
741
|
+
aria-activedescendant=${this._active>=0&&t.length?`${d}-o${this._active}`:h}
|
|
742
|
+
@input=${r(this,ud)} @keydown=${r(this,gd)} />
|
|
743
|
+
<kbd class="esc" aria-hidden="true">${rd("escape")[0]}</kbd>
|
|
744
|
+
</div>
|
|
745
|
+
<button type="button" class="x" part="close" aria-label=${this.closeLabel} @click=${()=>this.requestClose("close-button")}>
|
|
746
|
+
<cm-icon name="close" size="18"></cm-icon></button>
|
|
747
|
+
</div>
|
|
748
|
+
<div class="list" part="results" @pointerdown=${u=>{u.target.closest?.("[role=option]")&&u.preventDefault()}}>
|
|
749
|
+
${this.loading&&i?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText}</span></p>`:h}
|
|
750
|
+
<div role="listbox" id="${d}-list" part="listbox" aria-label=${this.label} ?hidden=${!t.length}>
|
|
751
|
+
${e.map((u,v)=>c`<div role="group" aria-labelledby="${d}-g${v}">
|
|
752
|
+
${Oc(`${d}-g${v}`,u.group.label,u.group.total!==void 0?this.formatNumber(u.group.total):void 0,this.t("results",{count:u.group.total??0}))}
|
|
753
|
+
${u.rows.map(b=>{let w=++m,y=b.item;return Bc({id:`${d}-o${w}`,active:w===this._active,href:b.href,cls:y?"":"all",keyshortcuts:y?.shortcut?Mg(y.shortcut):void 0,onHover:()=>this._active=w,onChoose:M=>s(this,ve,Lg).call(this,M,b)},y?qc(y,s(this,ve,Dg).call(this,y.shortcut)):c`<span class="text">${b.group.seeAllLabel||this.seeAllLabel}</span>`)})}
|
|
754
|
+
</div>`)}
|
|
755
|
+
</div>
|
|
756
|
+
${i&&!this.loading&&!t.length?c`<p class="message" aria-hidden="true">${this.emptyText}</p>`:h}
|
|
757
|
+
</div>
|
|
758
|
+
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
759
|
+
</div>`)}};fo=new WeakMap,ve=new WeakSet,Cm=function(){return this.value.trim()},Sm=function(){let e=r(this,ve,Cm),t=[],i=(a,l,d=!1)=>{let m=l.map(u=>({group:a,item:u,href:u.href}));d&&a.href&&m.push({group:a,href:a.href}),l.length&&t.push({group:a,rows:m})};if(!e)this.recent?.length&&i({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let a of this.results??[])a?.items?.length&&i(a,a.items,!0);for(let a of this.actions??[])a?.items?.length&&i(a,e?a.items.filter(l=>Sg(l,e)):a.items);return t},bo=function(e=s(this,ve,Sm).call(this)){return e.flatMap(t=>t.rows)},ud=new WeakMap,gd=new WeakMap,Lg=function(e,t){if(this.closeNow(),!this.dispatchEvent(new CustomEvent("cm-select",{detail:{item:t.item,group:t.group,href:t.href},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}t.item?.run?.(t.item)},Dg=function(e){return e?c`<span class="keys" aria-hidden="true">${rd(e).map(t=>c`<kbd>${t}</kbd>`)}</span>`:h},pa.properties={...ee.properties,label:{string:"label"},placeholder:{string:"placeholder"},value:{},results:{type:Array},actions:{type:Array},recent:{type:Array},loading:{type:Boolean,reflect:!0},shortcut:{},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},recentLabel:{attribute:"recent-label",string:"recent"},seeAllLabel:{attribute:"see-all-label",string:"seeAll"},_active:{state:!0}},pa.styles=[...ee.overlayStyles,Qr,oi,Pc,x`
|
|
760
|
+
dialog {
|
|
761
|
+
position: fixed; inset: 0; margin: max(var(--cm-space-16), 12dvh) auto auto; height: fit-content;
|
|
762
|
+
width: min(var(--cm-command-palette-width, 640px), calc(100vw - 32px));
|
|
763
|
+
}
|
|
764
|
+
.panel { max-height: calc(88dvh - 32px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
765
|
+
.box {
|
|
766
|
+
display: flex; align-items: center; gap: var(--cm-space-8); flex: 1; min-width: 0; height: var(--cm-control-height-lg);
|
|
767
|
+
padding-block: 0; padding-inline: var(--cm-space-12) var(--cm-space-8); background: var(--cm-bg-page);
|
|
768
|
+
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
769
|
+
}
|
|
770
|
+
.box:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
771
|
+
.top {
|
|
772
|
+
display: flex; align-items: center; gap: var(--cm-space-8); flex: none; padding: var(--cm-space-12);
|
|
773
|
+
border-bottom: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
774
|
+
}
|
|
775
|
+
.box > cm-icon { flex: none; color: var(--cm-icon-selected); }
|
|
776
|
+
input {
|
|
777
|
+
flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; outline: none;
|
|
778
|
+
font: inherit; font-size: var(--cm-font-size-14); color: var(--cm-text-default);
|
|
779
|
+
}
|
|
780
|
+
input::placeholder { color: var(--cm-text-tertiary); }
|
|
781
|
+
.x { display: none; width: var(--cm-control-height-md); height: var(--cm-control-height-md); color: var(--cm-icon-selected); }
|
|
782
|
+
.x:hover { background: var(--cm-bg-hover); }
|
|
783
|
+
.x:focus-visible { outline: 2px solid var(--cm-border-strong); }
|
|
784
|
+
.list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-inline: var(--cm-space-8); padding-block-end: var(--cm-space-4); }
|
|
785
|
+
[role='option'] { border-radius: var(--cm-radius-sm); }
|
|
786
|
+
.keys { display: flex; flex: none; gap: var(--cm-space-4); }
|
|
787
|
+
.message { padding-inline: var(--cm-space-12); }
|
|
788
|
+
@media (max-width: 640px) {
|
|
789
|
+
dialog { width: 100vw; height: 100dvh; margin: 0; }
|
|
790
|
+
.panel { height: 100%; max-height: none; border-radius: 0; box-shadow: none; }
|
|
791
|
+
.esc { display: none; }
|
|
792
|
+
.x { display: grid; }
|
|
793
|
+
}
|
|
794
|
+
@media (pointer: coarse) {
|
|
795
|
+
.box { height: var(--cm-control-height-touch); }
|
|
796
|
+
input { font-size: var(--cm-font-size-16); }
|
|
797
|
+
.x { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
798
|
+
[role='option'] { min-height: var(--cm-control-height-touch); }
|
|
799
|
+
}
|
|
800
|
+
`];$("cm-command-palette",pa);var ry=/^(\d{4})-(\d{2})-(\d{2})$/;function N(o){let n=ry.exec(o??"");if(!n)return null;let e=new Date(+n[1],+n[2]-1,+n[3]);return e.getFullYear()===+n[1]&&e.getMonth()===+n[2]-1&&e.getDate()===+n[3]?e:null}var ft=(o,n=2)=>String(o).padStart(n,"0"),P=o=>`${ft(o.getFullYear(),4)}-${ft(o.getMonth()+1)}-${ft(o.getDate())}`,Lm=()=>P(new Date),G=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function Ze(o,n){let e=new Date(o.getFullYear(),o.getMonth()+n,1),t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return new Date(e.getFullYear(),e.getMonth(),Math.min(o.getDate(),t))}var Ht=o=>new Date(o.getFullYear(),o.getMonth(),1),ua=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var ay=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function ir(o){let n=ay.exec(o??"");return n?+n[1]*60+ +n[2]:null}var vo=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${ft(Math.floor(n/60))}:${ft(n%60)}`};function Qe(o){let[n="",e=""]=(o??"").split("T"),t=ir(e);return{date:N(n)?n:"",time:t===null?"":vo(t)}}function vt(o,n=!1){let{date:e,time:t}=Qe(o),i=N(e);if(!i)return null;let a=t?ir(t):n?1439:0;return new Date(i.getFullYear(),i.getMonth(),i.getDate(),Math.floor(a/60),a%60)}var Hg=()=>{let o=new Date;return`${P(o)}T${ft(o.getHours())}:${ft(o.getMinutes())}`},Ag=new Map;function bd(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,i=Ag.get(t);if(i)return i;let a={hour:"numeric",minute:"2-digit",numberingSystem:"latn",...e?{hourCycle:e}:{}},l=new Intl.DateTimeFormat(o,a),d=l.resolvedOptions().hourCycle,m=M=>new Date(2e3,0,1,M,30),u=M=>(new Intl.DateTimeFormat(o,{hour:"numeric",hourCycle:"h12"}).formatToParts(m(M)).find(D=>D.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),v=(M,D)=>[...new Set([M,...D].filter(Boolean))],b=M=>M.replace(/[\u202f\u00a0]/g," "),w=b(l.formatToParts(m(9)).map(M=>M.type==="hour"?"{h}":M.type==="minute"?"{m}":M.value).join("")),y={format:M=>b(l.format(new Date(2e3,0,1,Math.floor(M/60),M%60))),dateTime:M=>ae(M,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",...e?{hourCycle:e}:{}},o),pattern:w,hour12:d==="h12"||d==="h11",am:v(u(9),["am","a"]),pm:v(u(15),["pm","p"])};return Ag.set(t,y),y}var Ng=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function Dm(o,n){let e=o.trim().toLowerCase().normalize("NFKC");if(!e)return null;let t=e.replace(/[^\p{L}]/gu,""),i=!!t&&n.pm.includes(t),a=!!t&&n.am.includes(t);if(t&&!i&&!a)return null;let l=e.match(/\d+/g)??[],d,m;if(l.length===1){let u=l[0];if(u.length<=2)d=+u,m=0;else if(u.length<=4)d=+u.slice(0,-2),m=+u.slice(-2);else return null}else if(l.length===2||l.length===3){if(l[0].length>2||l[1].length!==2)return null;d=+l[0],m=+l[1]}else return null;if(m>59)return null;if(a||i){if(d<1||d>12)return null;d=d%12+(i?12:0)}else if(d>23)return null;return vo(d*60+m)}var ga={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},yo=o=>Array.isArray(o)?o:typeof o=="string"?ga.fromAttribute(o):[];function ba(o,n){let e=[n,In(o)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function fa(o){try{let n=new Intl.Locale(o),e=n.getWeekInfo?.()??n.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var Rg=new Map;function va(o){let n=Rg.get(o);if(n)return n;let e=y=>new Intl.DateTimeFormat(o,y),t=e({day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"}),i=e({weekday:"short"}),a=e({weekday:"long"}),l=new Date(2024,0,7),d=t.formatToParts(new Date(2026,10,15)),m=d.filter(y=>y.type==="day"||y.type==="month"||y.type==="year").map(y=>y.type),u=d.map(y=>y.type==="day"?"{d}":y.type==="month"?"{m}":y.type==="year"?"{y}":y.value).join(""),v=(y,M)=>Array.from({length:12},(D,H)=>new Intl.DateTimeFormat(y,{month:M}).format(new Date(2024,H,1)).toLowerCase().replace(/\./g,"")),b=Array.from({length:12},(y,M)=>[...new Set([v(o,"long")[M],v(o,"short")[M],v("en","long")[M],v("en","short")[M]])]),w={short:y=>t.format(y),long:y=>ae(y,{weekday:"long",day:"numeric",month:"long",year:"numeric"},o),medium:y=>ae(y,{day:"numeric",month:"short",year:"numeric"},o),monthYear:y=>ae(y,{month:"long",year:"numeric"},o),day:y=>ae(y,{day:"numeric"},o),weekdaysShort:Array.from({length:7},(y,M)=>i.format(G(l,M))),weekdaysLong:Array.from({length:7},(y,M)=>a.format(G(l,M))),pattern:m.length===3?u:"{y}-{m}-{d}",order:m.length===3?m:["year","month","day"],months:b};return Rg.set(o,w),w}var fd=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function vd(o,n){let e=o.trim().toLowerCase();if(!e)return null;let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);if(t.length!==3)return null;let i,a,l,d=t.findIndex(u=>/\p{L}/u.test(u));if(d>=0){let u=t[d];a=n.months.findIndex(y=>y.some(M=>M===u||u.length>=3&&M.startsWith(u)))+1;let v=t.filter((y,M)=>M!==d);if(!a||v.some(y=>!/^\d+$/.test(y)))return null;let b=v.findIndex(y=>y.length===4),w=b>=0?b:1;i=+v[w],l=+v[1-w],v[w].length<=2&&(i+=2e3)}else{if(t.some(b=>!/^\d+$/.test(b)))return null;let u=t[0].length===4?["year","month","day"]:n.order,v=b=>t[u.indexOf(b)];if(i=+v("year"),a=+v("month"),l=+v("day"),v("year").length<=2)i+=2e3;else if(v("year").length!==4)return null}let m=`${ft(i,4)}-${ft(a)}-${ft(l)}`;return N(m)?m:null}function yd(o,n,e,t){let i=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return G(e,1);case"ArrowLeft":return G(e,-1);case"ArrowDown":return G(e,7);case"ArrowUp":return G(e,-7);case"Home":return G(e,-i);case"End":return G(e,6-i);case"PageDown":return Ze(e,n.shiftKey?12:1);case"PageUp":return Ze(e,n.shiftKey?-12:-1);default:return null}}var mi=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function xd(o){let{fmt:n,firstDay:e,month:t,focus:i,min:a,max:l}=o,d=Ht(t),m=(d.getDay()-e+7)%7,u=ua(t).getDate(),v=[],b=Array(m).fill(null);for(let H=1;H<=u;H++)b.push(new Date(t.getFullYear(),t.getMonth(),H)),b.length===7&&(v.push(b),b=[]);b.length&&v.push([...b,...Array(7-b.length).fill(null)]);let w=Array.from({length:7},(H,q)=>(q+e)%7),y=Lm(),M=!!a&&ua(Ze(d,-1))<a,D=!!l&&Ze(d,1)>l;return c`<div class="cal-head">
|
|
801
|
+
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.previousLabel} ?disabled=${M} @click=${()=>o.onMonth(-1)}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
802
|
+
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
803
|
+
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${D} @click=${()=>o.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
598
804
|
</div>
|
|
599
|
-
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${
|
|
600
|
-
<thead><tr>${w.map(
|
|
601
|
-
<tbody>${v.map(
|
|
602
|
-
tabindex=${
|
|
603
|
-
aria-selected=${
|
|
604
|
-
aria-current=${
|
|
605
|
-
aria-label="${n.long(
|
|
606
|
-
@click=${()=>!
|
|
607
|
-
</table>`}var
|
|
805
|
+
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${o.id}-month" @keydown=${o.onKey}>
|
|
806
|
+
<thead><tr>${w.map(H=>c`<th scope="col" abbr=${n.weekdaysLong[H]}><span aria-hidden="true">${n.weekdaysShort[H]}</span><span class="vh">${n.weekdaysLong[H]}</span></th>`)}</tr></thead>
|
|
807
|
+
<tbody>${v.map(H=>c`<tr>${H.map(q=>{if(!q)return c`<td class="empty"></td>`;let F=P(q),W=o.isDisabled(q)||!!a&&q<a||!!l&&q>l,Tt=o.mark(q),V=o.note?.(q);return c`<td class="day ${Tt} ${F===y?"today":""}" data-date=${F}
|
|
808
|
+
tabindex=${F===P(i)?"0":"-1"}
|
|
809
|
+
aria-selected=${Tt?"true":"false"} aria-disabled=${W?"true":h}
|
|
810
|
+
aria-current=${F===y?"date":h}
|
|
811
|
+
aria-label="${n.long(q)}${V?`, ${V}`:""}"
|
|
812
|
+
@click=${()=>!W&&o.onPick(q)} @pointerenter=${()=>o.onHover?.(q)}><span aria-hidden="true">${n.day(q)}</span></td>`})}</tr>`)}</tbody>
|
|
813
|
+
</table>`}var wd=x`
|
|
608
814
|
.pop {
|
|
609
815
|
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-8)); inset-inline-start: 0;
|
|
610
816
|
width: max-content; max-width: calc(100vw - 32px); padding: var(--cm-space-12);
|
|
@@ -636,8 +842,8 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
636
842
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
637
843
|
}
|
|
638
844
|
@media (max-width: 640px) { .day, .empty { height: 36px; } }
|
|
639
|
-
`;function
|
|
640
|
-
${
|
|
845
|
+
`;function $d(o,n){if(o.key!=="Tab")return;let e=[...n.querySelectorAll('button:not([disabled]), [role=grid] td[tabindex="0"]')];if(!e.length)return;let t=n.getRootNode(),i=e.indexOf(t.activeElement);o.preventDefault(),e[(i+(o.shiftKey?-1:1)+e.length)%e.length].focus()}var kd=x`
|
|
846
|
+
${Ge}
|
|
641
847
|
:host { display: block; position: relative; }
|
|
642
848
|
.wrap { position: relative; }
|
|
643
849
|
.box {
|
|
@@ -668,69 +874,69 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
668
874
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
669
875
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
670
876
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
671
|
-
`;var
|
|
672
|
-
${this.label?c`<label class="label" for="${r(this,
|
|
877
|
+
`;var A0=z("datePicker",{choose:"Choose date",chooseFor:"Choose date for {label}",change:"Change date, {date}",changeFor:"Change date for {label}, {date}",dialog:"Choose date",previousMonth:"Previous month",nextMonth:"Next month",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badInput:"Enter a date like {pattern}.",required:"Enter or choose a date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"This date isn't available. Choose another date.",time:"Time",timeFor:"Time for {label}",patternHour:"hh",patternMinute:"mm",badTime:"Enter a time like {pattern}.",timeMissing:"Enter a time.",stepMismatch:{one:"Choose a time on the minute.",other:"Choose a time in steps of {count} minutes."}}),$a,he,et,ka,Ot,bi,Re,qe,Ea,Ma,E,xo,pi,Ta,Ed,rr,ya,Nt,ui,It,Pt,Md,Am,Rm,xa,ar,Hm,Nm,Ig,Td,Pg,Im,wa,wo,$o,Pm,Og,zd,Om,qm,_d,Cd,Sd,Ld,Dd,ko,gi=class extends T{constructor(){super(...arguments);p(this,E);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.min="";this.max="";this.placeholder="";p(this,$a,"");this.disabledDates=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this.time=!1;this.step=1;this.hourCycle="";this._text="";this._focus=new Date;p(this,he,this.attachInternals());p(this,et,A("cm-dp"));p(this,ka,null);p(this,Ot,!1);p(this,bi,!1);p(this,Re,"");p(this,qe,"");p(this,Ea,!1);p(this,Ma,"");p(this,Ta,!1);p(this,zd,e=>{e.key==="Enter"?s(this,E,Pm).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),s(this,E,Og).call(this,e.key==="ArrowUp"?1:-1))});p(this,_d,()=>{this.disabled||(this.open?this.open=!1:(s(this,E,$o).call(this),this.show()))});p(this,Cd,e=>{e.key==="Enter"?s(this,E,$o).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),s(this,E,$o).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});p(this,Sd,e=>{let t=yd(J(e,this),e,this._focus,r(this,E,Am));if(t){e.preventDefault(),this._focus=mi(t,r(this,E,It),r(this,E,Pt)),g(this,bi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,E,Om).call(this,this._focus))});p(this,Ld,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,E,qm).call(this);return}$d(e,e.currentTarget)});p(this,Dd,e=>{this._focus=mi(Ze(this._focus,e),r(this,E,It),r(this,E,Pt))});p(this,ko,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,$a)}set locale(e){let t=r(this,$a);g(this,$a,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,ka)===null&&g(this,ka,this.value),document.addEventListener("pointerdown",r(this,ko),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,ko),!0)}get form(){return r(this,he).form}get validity(){return r(this,he).validity}get validationMessage(){return r(this,he).validationMessage}get valueAsDate(){return this.time?this.value?vt(this.value):null:N(this.value)}checkValidity(){return s(this,E,Td).call(this),r(this,he).checkValidity()}reportValidity(){return s(this,E,Td).call(this),r(this,he).reportValidity()}formResetCallback(){this.value=r(this,ka)??"",this.time&&(s(this,E,Nm).call(this,this.value),g(this,E,s(this,E,ar).call(this,r(this,qe)),pi)),this._text=s(this,E,xa).call(this,r(this,E,Nt)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(s(this,E,Ig).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=r(this,E,It),a=r(this,E,Pt);return i&&t<i||a&&t>a?!0:yo(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!r(this,Ta)?(s(this,E,Nm).call(this,this.value),r(this,Ea)||g(this,E,s(this,E,ar).call(this,r(this,qe)),pi)):this.time&&(e.has("locale")||e.has("hourCycle"))&&r(this,qe)&&g(this,E,s(this,E,ar).call(this,r(this,qe)),pi),(e.has("value")||e.has("time"))&&!r(this,Ot)?this._text=s(this,E,xa).call(this,r(this,E,Nt)):e.has("locale")&&N(r(this,E,Nt))&&(this._text=s(this,E,xa).call(this,r(this,E,Nt))),g(this,Ot,!1),g(this,Ea,!1),g(this,Ta,!1)}updated(e){r(this,he).setFormValue(this.value||null,this.time?this.value:this._text),s(this,E,Td).call(this),this.open&&r(this,bi)&&(g(this,bi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&g(this,bi,!1)}render(){let e=r(this,E,rr),t=N(r(this,E,Nt)),i=[this.error&&`${r(this,et)}-err`,this.helpText&&`${r(this,et)}-help`].filter(Boolean).join(" "),a=this.getAttribute("aria-label"),l=this.label||a||"",d=Ht(this._focus);return c`<div class="field">
|
|
878
|
+
${this.label?c`<label class="label" for="${r(this,et)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
673
879
|
<div class="wrap ${this.time?"timed":""}">
|
|
674
880
|
<div class="box" part="box">
|
|
675
|
-
<input id="${r(this,
|
|
676
|
-
.value=${
|
|
881
|
+
<input id="${r(this,et)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
882
|
+
.value=${ne(this._text)} placeholder=${this.placeholder||r(this,E,Rm)}
|
|
677
883
|
aria-label=${!this.label&&a?a:h}
|
|
678
884
|
?required=${this.required} ?disabled=${this.disabled}
|
|
679
885
|
aria-invalid=${this.error?"true":h} aria-describedby=${i||h}
|
|
680
|
-
@input=${
|
|
681
|
-
@change=${()=>s(this,E
|
|
886
|
+
@input=${m=>{m.stopPropagation(),this._text=m.target.value}}
|
|
887
|
+
@change=${()=>s(this,E,$o).call(this)} @keydown=${r(this,Cd)} />
|
|
682
888
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
683
|
-
aria-label=${t?this.t(
|
|
684
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
685
|
-
@click=${r(this,
|
|
889
|
+
aria-label=${t?this.t(l?"changeFor":"change",{label:l,date:e.long(t)}):this.t(l?"chooseFor":"choose",{label:l})}
|
|
890
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,et)}-pop"
|
|
891
|
+
@click=${r(this,_d)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
686
892
|
</div>
|
|
687
893
|
${this.time?c`<div class="box time" part="time-box">
|
|
688
894
|
<input class="time-in" part="time-input" type="text" autocomplete="off" spellcheck="false"
|
|
689
|
-
.value=${
|
|
690
|
-
aria-label=${this.t(
|
|
895
|
+
.value=${ne(r(this,E,xo))} placeholder=${r(this,E,Hm)}
|
|
896
|
+
aria-label=${this.t(l?"timeFor":"time",{label:l})}
|
|
691
897
|
?required=${this.required} ?disabled=${this.disabled}
|
|
692
898
|
aria-invalid=${this.error?"true":h} aria-describedby=${i||h}
|
|
693
|
-
@input=${
|
|
694
|
-
@change=${()=>s(this,E,
|
|
899
|
+
@input=${m=>{m.stopPropagation(),g(this,E,m.target.value,pi)}}
|
|
900
|
+
@change=${()=>s(this,E,Pm).call(this)} @keydown=${r(this,zd)} />
|
|
695
901
|
</div>`:h}
|
|
696
|
-
<div class="pop" id="${r(this,
|
|
697
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
698
|
-
${this.open?c`<div class="cal">${
|
|
902
|
+
<div class="pop" id="${r(this,et)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
903
|
+
?hidden=${!this.open} @keydown=${r(this,Ld)}>
|
|
904
|
+
${this.open?c`<div class="cal">${xd({id:r(this,et),fmt:e,firstDay:r(this,E,Am),month:d,focus:this._focus,min:r(this,E,It),max:r(this,E,Pt),isDisabled:m=>this.isUnavailable(P(m)),mark:m=>t&&P(m)===r(this,E,Nt)?"selected":"",onPick:m=>s(this,E,Om).call(this,m),onKey:r(this,Sd),onMonth:r(this,Dd),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:h}
|
|
699
905
|
</div>
|
|
700
906
|
</div>
|
|
701
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
702
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
703
|
-
</div>`}};Xr=new WeakMap,ce=new WeakMap,Je=new WeakMap,Jr=new WeakMap,At=new WeakMap,oi=new WeakMap,Le=new WeakMap,Ie=new WeakMap,Zr=new WeakMap,Qr=new WeakMap,E=new WeakSet,On=function(){return r(this,Qr)},ai=function(e){e!==r(this,Qr)&&(f(this,Qr,e),this.requestUpdate())},ea=new WeakMap,$c=function(){return Vr(this,this.locale)},ji=function(){return Kr(r(this,E,$c))},Wr=function(){return uc(r(this,E,$c),this.hourCycle)},St=function(){return this.time?r(this,Le):this.value},si=function(e){return this.time&&e.trim().toLowerCase()==="now"?xu():e},Lt=function(){return H(Xe(s(this,E,si).call(this,this.min)).date||this.min)},Dt=function(){return H(Xe(s(this,E,si).call(this,this.max)).date||this.max)},kc=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},kh=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ur(r(this,E,$c)):(Math.trunc(e)%7+7)%7},Eh=function(){return gc(r(this,E,ji),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Yr=function(e){let t=H(e);return t?r(this,E,ji).short(t):e},Vi=function(e){let t=Fi(e);return t===null?"":r(this,E,Wr).format(t)},Mh=function(){return wu(r(this,E,Wr),{h:this.t("patternHour"),m:this.t("patternMinute")})},Th=function(e){let{date:t,time:i}=Xe(e);f(this,Le,t),f(this,Ie,t?i:"")},$u=function(){let e=new Date,t=H(r(this,E,St))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=ri(t,r(this,E,Lt),r(this,E,Dt)),f(this,oi,!0)},Ec=function(){let e=this.renderRoot.querySelector("input")??void 0,t=H(r(this,E,St)),i=r(this,E,ji);this.error?r(this,ce).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,ce).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,E,Eh)}),e):this.time?s(this,E,ku).call(this,t,e):this.required&&!t?r(this,ce).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,E,Lt)&&t<r(this,E,Lt)?r(this,ce).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,E,Lt))}),e):t&&r(this,E,Dt)&&t>r(this,E,Dt)?r(this,ce).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,E,Dt))}),e):t&&this.isUnavailable(this.value)?r(this,ce).setValidity({customError:!0},this.t("unavailable"),e):r(this,ce).setValidity({})},ku=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(g,w,y,M=t)=>r(this,ce).setValidity(g,this.t(w,y),M),o=Fi(r(this,Ie));if(r(this,E,On).trim()&&o===null)return a({badInput:!0},"badTime",{pattern:r(this,E,Mh)},i);if(!e&&o===null)return this.required?a({valueMissing:!0},"required"):r(this,ce).setValidity({});if(!e)return a({badInput:!0},"required");if(o===null)return a({badInput:!0},"timeMissing",void 0,i);let d=ut(`${r(this,Le)}T${r(this,Ie)}`),p=ut(s(this,E,si).call(this,this.min)),u=ut(s(this,E,si).call(this,this.max),!0),v=(g,w)=>Xe(g).time?r(this,E,Wr).dateTime(w):r(this,E,ji).medium(w);if(p&&d<p)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,E,si).call(this,this.min),p)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,E,si).call(this,this.max),u)},i);if(o%r(this,E,kc))return a({stepMismatch:!0},"stepMismatch",{count:r(this,E,kc)},i);if(this.isUnavailable(r(this,Le)))return a({customError:!0},"unavailable");r(this,ce).setValidity({})},zh=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})))},Gr=function(e,t){f(this,Le,e),f(this,Ie,t);let i=e&&t?`${e}T${t}`:"";f(this,ea,!0),this.requestUpdate(),s(this,E,zh).call(this,i)},qn=function(e){this.time?s(this,E,Gr).call(this,e,r(this,Ie)):s(this,E,zh).call(this,e)},Bn=function(){let e=this._text.trim();if(!e){s(this,E,qn).call(this,"");return}let t=bc(e,r(this,E,ji));t?(s(this,E,qn).call(this,t),this._text=s(this,E,Yr).call(this,t)):(f(this,At,!0),s(this,E,qn).call(this,""))},_h=function(){let e=r(this,E,On).trim(),t=e?$h(e,r(this,E,Wr)):"";if(f(this,At,!0),t===null){f(this,Zr,!0),s(this,E,Gr).call(this,r(this,Le),"");return}s(this,E,Gr).call(this,r(this,Le),t),f(this,E,s(this,E,Vi).call(this,t),ai)},Eu=function(e){let t=r(this,E,kc),i=$h(r(this,E,On),r(this,E,Wr));if(!i){let p=Xe(s(this,E,si).call(this,this.min)),u=new Date;if(i=p.time&&(!r(this,Le)||r(this,Le)===p.date)?p.time:In(u.getHours()*60+u.getMinutes()),Fi(i)%t===0){f(this,At,!0),s(this,E,Gr).call(this,r(this,Le),i),f(this,E,s(this,E,Vi).call(this,i),ai);return}e=1}let a=Fi(i),o=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=In(o>=1440?0:o<0?Math.floor(1439/t)*t:o);f(this,At,!0),s(this,E,Gr).call(this,r(this,Le),d),f(this,E,s(this,E,Vi).call(this,d),ai)},Mc=new WeakMap,Ch=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,E,qn).call(this,t),this._text=s(this,E,Yr).call(this,t),this.time&&!r(this,Ie)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,E,Sh).call(this))},Sh=function(){this.renderRoot.querySelector(".trigger")?.focus()},Tc=new WeakMap,zc=new WeakMap,_c=new WeakMap,Cc=new WeakMap,Sc=new WeakMap,Fn=new WeakMap,ni.formAssociated=!0,ni.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},ni.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:jr},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_focus:{state:!0}},ni.styles=[k,wc,yc,x`.pop { min-width: 0; }`];$("cm-date-picker",ni);var Bx=_("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"}),Of={today:["Today",l=>[l,l]],yesterday:["Yesterday",l=>[K(l,-1),K(l,-1)]],"last-7-days":["Last 7 days",l=>[K(l,-6),l]],"last-30-days":["Last 30 days",l=>[K(l,-29),l]],"last-90-days":["Last 90 days",l=>[K(l,-89),l]],"this-month":["This month",l=>[Ct(l),l]],"last-month":["Last month",l=>[Ct(Ge(l,-1)),Fr(Ge(l,-1))]]},qf=l=>l.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Mu(l,n=new Date,e){if(typeof l=="object"&&l)return l;let t=Of[l];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,o]=t[1](i);return{label:e?.(qf(l))||t[0],start:P(a),end:P(o)}}var ra,pe,Pe,aa,sa,ci,I,Lh,ta,Dh,Nt,Lc,Rt,Tu,Dc,ia,Ah,zu,Ac,Rc,Nc,Hc,Ic,jn,Rh,li=class extends T{constructor(){super(...arguments);m(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";m(this,ra,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;m(this,pe,this.attachInternals());m(this,Pe,D("cm-drp"));m(this,aa,null);m(this,sa,!1);m(this,ci,!1);m(this,Nt,"start");m(this,Rc,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,ia).call(this,"start"),s(this,I,ia).call(this,"end"),this.show()))});m(this,Nc,e=>t=>{t.key==="Enter"?s(this,I,ia).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,ia).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});m(this,Hc,e=>{let t=fc(G(e,this),e,this._focus,r(this,I,Dh));if(t){e.preventDefault(),this._focus=ri(t,H(this.min),H(this.max)),f(this,ci,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,Ah).call(this,this._focus))});m(this,Ic,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,Ac).call(this);return}xc(e,e.currentTarget)});m(this,jn,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,ra)}set locale(e){let t=r(this,ra);f(this,ra,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,aa)||f(this,aa,[this.start,this.end]),document.addEventListener("pointerdown",r(this,jn),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,jn),!0)}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.start,this.end]=r(this,aa)??["",""],this._startText=s(this,I,Rt).call(this,this.start),this._endText=s(this,I,Rt).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=H(this.start)?this.start:"",this._draftEnd=H(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=ri(H(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),H(this.min),H(this.max)),f(this,Nt,"start"),f(this,ci,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=H(e);if(!t)return!0;let i=H(this.min),a=H(this.max);return i&&t<i||a&&t>a?!0:Pn(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,sa)||(e.has("start")&&(this._startText=s(this,I,Rt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,Rt).call(this,this.end))),f(this,sa,!1),e.has("locale")&&(H(this.start)&&(this._startText=s(this,I,Rt).call(this,this.start)),H(this.end)&&(this._endText=s(this,I,Rt).call(this,this.end)))}updated(){let e=H(this.start),t=H(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,pe).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let a=this.renderRoot.querySelectorAll("input"),[o,d]=[a[0]??void 0,a[1]??void 0],p=r(this,I,ta),u=H(this.min),v=H(this.max);this.error?r(this,pe).setValidity({customError:!0},this.error,o):this._startText.trim()&&!e?r(this,pe).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,I,Lc)}),o):this._endText.trim()&&!t?r(this,pe).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Lc)}),d):this.required&&(!e||!t)?r(this,pe).setValidity({valueMissing:!0},this.t("required"),e?d:o):e&&t&&t<e?r(this,pe).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,pe).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:p.medium(u)}),o):e&&v&&e>v||t&&v&&t>v?r(this,pe).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:p.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,pe).setValidity({customError:!0},this.t("unavailable"),o):r(this,pe).setValidity({}),this.open&&r(this,ci)&&(f(this,ci,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,ta),t=H(this.start),i=H(this.end),a=[this.error&&`${r(this,Pe)}-err`,this.helpText&&`${r(this,Pe)}-help`].filter(Boolean).join(" "),o=this.getAttribute("aria-label"),d=this.label||o||"",p=Pn(this.presets).map(g=>Mu(g,new Date,w=>this.t(w))).filter(g=>!!g),u=r(this,Nt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(H(this._draftStart))}):this.t("chooseStart"),v=g=>{let w=g==="start"?this._startText:this._endText;return c`<input id="${r(this,Pe)}-${g}" type="text" autocomplete="off" spellcheck="false"
|
|
704
|
-
.value=${
|
|
705
|
-
aria-label=${
|
|
907
|
+
${this.error?c`<p class="error" id="${r(this,et)}-err" role="alert">${this.error}</p>`:h}
|
|
908
|
+
${this.helpText?c`<p class="help" id="${r(this,et)}-help">${this.helpText}</p>`:h}
|
|
909
|
+
</div>`}};$a=new WeakMap,he=new WeakMap,et=new WeakMap,ka=new WeakMap,Ot=new WeakMap,bi=new WeakMap,Re=new WeakMap,qe=new WeakMap,Ea=new WeakMap,Ma=new WeakMap,E=new WeakSet,xo=function(){return r(this,Ma)},pi=function(e){e!==r(this,Ma)&&(g(this,Ma,e),this.requestUpdate())},Ta=new WeakMap,Ed=function(){return ba(this,this.locale)},rr=function(){return va(r(this,E,Ed))},ya=function(){return bd(r(this,E,Ed),this.hourCycle)},Nt=function(){return this.time?r(this,Re):this.value},ui=function(e){return this.time&&e.trim().toLowerCase()==="now"?Hg():e},It=function(){return N(Qe(s(this,E,ui).call(this,this.min)).date||this.min)},Pt=function(){return N(Qe(s(this,E,ui).call(this,this.max)).date||this.max)},Md=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Am=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,E,Ed)):(Math.trunc(e)%7+7)%7},Rm=function(){return fd(r(this,E,rr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},xa=function(e){let t=N(e);return t?r(this,E,rr).short(t):e},ar=function(e){let t=ir(e);return t===null?"":r(this,E,ya).format(t)},Hm=function(){return Ng(r(this,E,ya),{h:this.t("patternHour"),m:this.t("patternMinute")})},Nm=function(e){let{date:t,time:i}=Qe(e);g(this,Re,t),g(this,qe,t?i:"")},Ig=function(){let e=new Date,t=N(r(this,E,Nt))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=mi(t,r(this,E,It),r(this,E,Pt)),g(this,bi,!0)},Td=function(){let e=this.renderRoot.querySelector("input")??void 0,t=N(r(this,E,Nt)),i=r(this,E,rr);this.error?r(this,he).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,he).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,E,Rm)}),e):this.time?s(this,E,Pg).call(this,t,e):this.required&&!t?r(this,he).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,E,It)&&t<r(this,E,It)?r(this,he).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,E,It))}),e):t&&r(this,E,Pt)&&t>r(this,E,Pt)?r(this,he).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,E,Pt))}),e):t&&this.isUnavailable(this.value)?r(this,he).setValidity({customError:!0},this.t("unavailable"),e):r(this,he).setValidity({})},Pg=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,a=(b,w,y,M=t)=>r(this,he).setValidity(b,this.t(w,y),M),l=ir(r(this,qe));if(r(this,E,xo).trim()&&l===null)return a({badInput:!0},"badTime",{pattern:r(this,E,Hm)},i);if(!e&&l===null)return this.required?a({valueMissing:!0},"required"):r(this,he).setValidity({});if(!e)return a({badInput:!0},"required");if(l===null)return a({badInput:!0},"timeMissing",void 0,i);let d=vt(`${r(this,Re)}T${r(this,qe)}`),m=vt(s(this,E,ui).call(this,this.min)),u=vt(s(this,E,ui).call(this,this.max),!0),v=(b,w)=>Qe(b).time?r(this,E,ya).dateTime(w):r(this,E,rr).medium(w);if(m&&d<m)return a({rangeUnderflow:!0},"rangeUnderflow",{date:v(s(this,E,ui).call(this,this.min),m)},i);if(u&&d>u)return a({rangeOverflow:!0},"rangeOverflow",{date:v(s(this,E,ui).call(this,this.max),u)},i);if(l%r(this,E,Md))return a({stepMismatch:!0},"stepMismatch",{count:r(this,E,Md)},i);if(this.isUnavailable(r(this,Re)))return a({customError:!0},"unavailable");r(this,he).setValidity({})},Im=function(e){e!==this.value&&(this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},wa=function(e,t){g(this,Re,e),g(this,qe,t);let i=e&&t?`${e}T${t}`:"";g(this,Ta,!0),this.requestUpdate(),s(this,E,Im).call(this,i)},wo=function(e){this.time?s(this,E,wa).call(this,e,r(this,qe)):s(this,E,Im).call(this,e)},$o=function(){let e=this._text.trim();if(!e){s(this,E,wo).call(this,"");return}let t=vd(e,r(this,E,rr));t?(s(this,E,wo).call(this,t),this._text=s(this,E,xa).call(this,t)):(g(this,Ot,!0),s(this,E,wo).call(this,""))},Pm=function(){let e=r(this,E,xo).trim(),t=e?Dm(e,r(this,E,ya)):"";if(g(this,Ot,!0),t===null){g(this,Ea,!0),s(this,E,wa).call(this,r(this,Re),"");return}s(this,E,wa).call(this,r(this,Re),t),g(this,E,s(this,E,ar).call(this,t),pi)},Og=function(e){let t=r(this,E,Md),i=Dm(r(this,E,xo),r(this,E,ya));if(!i){let m=Qe(s(this,E,ui).call(this,this.min)),u=new Date;if(i=m.time&&(!r(this,Re)||r(this,Re)===m.date)?m.time:vo(u.getHours()*60+u.getMinutes()),ir(i)%t===0){g(this,Ot,!0),s(this,E,wa).call(this,r(this,Re),i),g(this,E,s(this,E,ar).call(this,i),pi);return}e=1}let a=ir(i),l=e>0?(Math.floor(a/t)+1)*t:(Math.ceil(a/t)-1)*t,d=vo(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,Ot,!0),s(this,E,wa).call(this,r(this,Re),d),g(this,E,s(this,E,ar).call(this,d),pi)},zd=new WeakMap,Om=function(e){let t=P(e);this.isUnavailable(t)||(this.open=!1,s(this,E,wo).call(this,t),this._text=s(this,E,xa).call(this,t),this.time&&!r(this,qe)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):s(this,E,qm).call(this))},qm=function(){this.renderRoot.querySelector(".trigger")?.focus()},_d=new WeakMap,Cd=new WeakMap,Sd=new WeakMap,Ld=new WeakMap,Dd=new WeakMap,ko=new WeakMap,gi.formAssociated=!0,gi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},gi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:ga},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_focus:{state:!0}},gi.styles=[k,kd,wd,x`.pop { min-width: 0; }`];$("cm-date-picker",gi);var B0=z("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month"}),sy={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[G(o,-1),G(o,-1)]],"last-7-days":["Last 7 days",o=>[G(o,-6),o]],"last-30-days":["Last 30 days",o=>[G(o,-29),o]],"last-90-days":["Last 90 days",o=>[G(o,-89),o]],"this-month":["This month",o=>[Ht(o),o]],"last-month":["Last month",o=>[Ht(Ze(o,-1)),ua(Ze(o,-1))]]},ny=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function qg(o,n=new Date,e){if(typeof o=="object"&&o)return o;let t=sy[o];if(!t)return null;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[a,l]=t[1](i);return{label:e?.(ny(o))||t[0],start:P(a),end:P(l)}}var Ca,be,Be,Sa,La,vi,I,Bm,za,Fm,Bt,Ad,qt,Bg,Rd,_a,jm,Fg,Hd,Nd,Id,Pd,Od,Eo,Um,fi=class extends T{constructor(){super(...arguments);p(this,I);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";p(this,Ca,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;p(this,be,this.attachInternals());p(this,Be,A("cm-drp"));p(this,Sa,null);p(this,La,!1);p(this,vi,!1);p(this,Bt,"start");p(this,Nd,()=>{this.disabled||(this.open?this.open=!1:(s(this,I,_a).call(this,"start"),s(this,I,_a).call(this,"end"),this.show()))});p(this,Id,e=>t=>{t.key==="Enter"?s(this,I,_a).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),s(this,I,_a).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});p(this,Pd,e=>{let t=yd(J(e,this),e,this._focus,r(this,I,Fm));if(t){e.preventDefault(),this._focus=mi(t,N(this.min),N(this.max)),g(this,vi,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),s(this,I,jm).call(this,this._focus))});p(this,Od,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,s(this,I,Hd).call(this);return}$d(e,e.currentTarget)});p(this,Eo,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ca)}set locale(e){let t=r(this,Ca);g(this,Ca,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Sa)||g(this,Sa,[this.start,this.end]),document.addEventListener("pointerdown",r(this,Eo),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Eo),!0)}get form(){return r(this,be).form}get validity(){return r(this,be).validity}get validationMessage(){return r(this,be).validationMessage}checkValidity(){return r(this,be).checkValidity()}reportValidity(){return r(this,be).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,Sa)??["",""],this._startText=s(this,I,qt).call(this,this.start),this._endText=s(this,I,qt).call(this,this.end),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=N(this.start)?this.start:"",this._draftEnd=N(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=mi(N(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),N(this.min),N(this.max)),g(this,Bt,"start"),g(this,vi,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=N(e);if(!t)return!0;let i=N(this.min),a=N(this.max);return i&&t<i||a&&t>a?!0:yo(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,La)||(e.has("start")&&(this._startText=s(this,I,qt).call(this,this.start)),e.has("end")&&(this._endText=s(this,I,qt).call(this,this.end))),g(this,La,!1),e.has("locale")&&(N(this.start)&&(this._startText=s(this,I,qt).call(this,this.start)),N(this.end)&&(this._endText=s(this,I,qt).call(this,this.end)))}updated(){let e=N(this.start),t=N(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,be).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let a=this.renderRoot.querySelectorAll("input"),[l,d]=[a[0]??void 0,a[1]??void 0],m=r(this,I,za),u=N(this.min),v=N(this.max);this.error?r(this,be).setValidity({customError:!0},this.error,l):this._startText.trim()&&!e?r(this,be).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,I,Ad)}),l):this._endText.trim()&&!t?r(this,be).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,I,Ad)}),d):this.required&&(!e||!t)?r(this,be).setValidity({valueMissing:!0},this.t("required"),e?d:l):e&&t&&t<e?r(this,be).setValidity({badInput:!0},this.t("endBeforeStart"),d):e&&u&&e<u||t&&u&&t<u?r(this,be).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:m.medium(u)}),l):e&&v&&e>v||t&&v&&t>v?r(this,be).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:m.medium(v)}),d):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,be).setValidity({customError:!0},this.t("unavailable"),l):r(this,be).setValidity({}),this.open&&r(this,vi)&&(g(this,vi,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,I,za),t=N(this.start),i=N(this.end),a=[this.error&&`${r(this,Be)}-err`,this.helpText&&`${r(this,Be)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=this.label||l||"",m=yo(this.presets).map(b=>qg(b,new Date,w=>this.t(w))).filter(b=>!!b),u=r(this,Bt)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(N(this._draftStart))}):this.t("chooseStart"),v=b=>{let w=b==="start"?this._startText:this._endText;return c`<input id="${r(this,Be)}-${b}" type="text" autocomplete="off" spellcheck="false"
|
|
910
|
+
.value=${ne(w)} placeholder=${r(this,I,Ad)}
|
|
911
|
+
aria-label=${b==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
706
912
|
?required=${this.required} ?disabled=${this.disabled}
|
|
707
913
|
aria-invalid=${this.error?"true":h} aria-describedby=${a||h}
|
|
708
|
-
@input=${y=>{y.stopPropagation();let M=y.target.value;
|
|
709
|
-
@change=${()=>s(this,I,
|
|
710
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
914
|
+
@input=${y=>{y.stopPropagation();let M=y.target.value;b==="start"?this._startText=M:this._endText=M}}
|
|
915
|
+
@change=${()=>s(this,I,_a).call(this,b)} @keydown=${r(this,Id).call(this,b)} />`};return c`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,Be)}-l`:h} aria-label=${!this.label&&l?l:h}>
|
|
916
|
+
${this.label?c`<span class="label" id="${r(this,Be)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
711
917
|
<div class="wrap">
|
|
712
918
|
<div class="box" part="box">
|
|
713
919
|
${v("start")}<span class="sep" aria-hidden="true">–</span>${v("end")}
|
|
714
920
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
715
921
|
aria-label=${t&&i?this.t(d?"changeFor":"change",{label:d,start:e.long(t),end:e.long(i)}):this.t(d?"chooseFor":"choose",{label:d})}
|
|
716
|
-
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,
|
|
717
|
-
@click=${r(this,
|
|
922
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,Be)}-pop"
|
|
923
|
+
@click=${r(this,Nd)}><cm-icon name="calendar" size="16"></cm-icon></button>
|
|
718
924
|
</div>
|
|
719
|
-
<div class="pop" id="${r(this,
|
|
720
|
-
?hidden=${!this.open} @keydown=${r(this,
|
|
925
|
+
<div class="pop" id="${r(this,Be)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
926
|
+
?hidden=${!this.open} @keydown=${r(this,Od)}>
|
|
721
927
|
${this.open?c`<div class="body">
|
|
722
|
-
${
|
|
723
|
-
<button type="button" class="preset" aria-pressed=${
|
|
724
|
-
@click=${()=>s(this,I,
|
|
725
|
-
<div class="cal">${
|
|
928
|
+
${m.length?c`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${m.map(b=>c`<li>
|
|
929
|
+
<button type="button" class="preset" aria-pressed=${b.start===this.start&&b.end===this.end?"true":"false"}
|
|
930
|
+
@click=${()=>s(this,I,Fg).call(this,b)}>${b.label}</button></li>`)}</ul>`:h}
|
|
931
|
+
<div class="cal">${xd({id:r(this,Be),fmt:e,firstDay:r(this,I,Fm),month:Ht(this._focus),focus:this._focus,min:N(this.min),max:N(this.max),isDisabled:b=>this.isUnavailable(P(b)),mark:b=>s(this,I,Um).call(this,b),note:b=>{let w=s(this,I,Um).call(this,b);return w==="start"?this.t("startNote"):w==="end"?this.t("endNote"):""},onPick:b=>s(this,I,jm).call(this,b),onKey:r(this,Pd),onMonth:b=>{this._focus=mi(Ze(this._focus,b),N(this.min),N(this.max))},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:b=>{r(this,Bt)==="end"&&(this._hover=b)}})}
|
|
726
932
|
<p class="status" aria-live="polite">${u}</p>
|
|
727
933
|
</div>
|
|
728
934
|
</div>`:h}
|
|
729
935
|
</div>
|
|
730
936
|
</div>
|
|
731
|
-
${this.error?c`<p class="error" id="${r(this,
|
|
732
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
733
|
-
</div>`}};
|
|
937
|
+
${this.error?c`<p class="error" id="${r(this,Be)}-err" role="alert">${this.error}</p>`:h}
|
|
938
|
+
${this.helpText?c`<p class="help" id="${r(this,Be)}-help">${this.helpText}</p>`:h}
|
|
939
|
+
</div>`}};Ca=new WeakMap,be=new WeakMap,Be=new WeakMap,Sa=new WeakMap,La=new WeakMap,vi=new WeakMap,I=new WeakSet,Bm=function(){return ba(this,this.locale)},za=function(){return va(r(this,I,Bm))},Fm=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,I,Bm)):(Math.trunc(e)%7+7)%7},Bt=new WeakMap,Ad=function(){return fd(r(this,I,za),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},qt=function(e){let t=N(e);return t?r(this,I,za).short(t):e},Bg=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Rd=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,s(this,I,Bg).call(this))},_a=function(e){let t=(e==="start"?this._startText:this._endText).trim(),i=t?vd(t,r(this,I,za)):"";t&&!i&&g(this,La,!0);let a=e==="start"?[i??"",this.end]:[this.start,i??""];s(this,I,Rd).call(this,...a),i&&(e==="start"?this._startText=s(this,I,qt).call(this,i):this._endText=s(this,I,qt).call(this,i))},jm=function(e){let t=P(e);if(!this.isUnavailable(t)){if(r(this,Bt)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",g(this,Bt,"end"),this._focus=e,g(this,vi,!0);return}this._draftEnd=t,this.open=!1,s(this,I,Rd).call(this,this._draftStart,t),s(this,I,Hd).call(this)}},Fg=function(e){this.open=!1,s(this,I,Rd).call(this,e.start,e.end),s(this,I,Hd).call(this)},Hd=function(){this.renderRoot.querySelector(".trigger")?.focus()},Nd=new WeakMap,Id=new WeakMap,Pd=new WeakMap,Od=new WeakMap,Eo=new WeakMap,Um=function(e){let t=P(e),i=this._draftStart,a=this._draftEnd||(r(this,Bt)==="end"&&i?P(this._hover??this._focus):"");return t===i?"start":t===a&&a>i?"end":i&&a&&t>i&&t<a?"in-range":""},fi.formAssociated=!0,fi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},fi.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:ga},isDateDisabled:{attribute:!1},presets:{converter:ga},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}},fi.styles=[k,kd,wd,x`
|
|
734
940
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
735
941
|
input { flex: 0 1 6.6em; }
|
|
736
942
|
:host([size='small']) input { flex-basis: 6.6em; }
|
|
@@ -750,56 +956,56 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
750
956
|
.presets li { flex: 0 0 auto; }
|
|
751
957
|
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
752
958
|
}
|
|
753
|
-
`];$("cm-date-range-picker",
|
|
959
|
+
`];$("cm-date-range-picker",fi);var W0=z("fileUpload",{prompt:"Drag files here or {browse}",browse:"Browse",drop:"Drop files to upload",uploading:"Uploading {name}",cancel:"Cancel uploading {name}",cancelShort:"Cancel",addMore:"Add more",files:"Chosen files",remove:"Remove {name}",kilobytes:"{size} KB",megabytes:"{size} MB",required:"Please choose a file.",wrongType:"{name} is not an allowed file type",tooLarge:"{name} is larger than {size}",tooMany:"You can add up to {max} files",takePhoto:"Take a photo",retake:"Retake",removePhoto:"Remove",retakeName:"Retake {name}",removeName:"Remove {name}",photo:"photo"});function oy(o,n){if(!n.trim())return!0;let e=o.name.toLowerCase(),t=o.type.toLowerCase();return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).some(i=>i.startsWith(".")?e.endsWith(i):i.endsWith("/*")?t.startsWith(i.slice(0,-1)):t===i)}var tt,ie,Ft,O,Mo,Vm,qd,Bd,Km,Wm,Gm,Ym,sr,jg,Ug,Xm,Vg,Kg,yi=class extends T{constructor(){super(...arguments);p(this,O);this.label="";this.hint="";this.name="";this.accept="";this.multiple=!1;this.maxSize=0;this.maxFiles=0;this.required=!1;this.disabled=!1;this.error="";this.files=[];this._rejected="";this._progress=new Map;this._fileErrors=new Map;this._over=!1;p(this,tt,this.attachInternals());p(this,ie,A("cm-fu"));p(this,Ft,new Map)}get form(){return r(this,tt).form}get validity(){return r(this,tt).validity}get validationMessage(){return r(this,tt).validationMessage}checkValidity(){return r(this,tt).checkValidity()}reportValidity(){return r(this,tt).reportValidity()}formResetCallback(){this.files=[],this._rejected="",this._progress=new Map,this._fileErrors=new Map}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,Ft).values())URL.revokeObjectURL(e);r(this,Ft).clear()}updated(e){if(e.has("files"))for(let[l,d]of r(this,Ft))this.files.includes(l)||(URL.revokeObjectURL(d),r(this,Ft).delete(l));let t=new FormData;for(let l of this.files)t.append(this.name||"file",l);r(this,tt).setFormValue(this.files.length?t:null);let i=(r(this,O,Mo)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,a=this.error||this._rejected;a?r(this,tt).setValidity({customError:!0},a,i):this.required&&!this.files.length?r(this,tt).setValidity({valueMissing:!0},this.t("required"),i):r(this,tt).setValidity({})}addFiles(e){let t=[...e],i=[],a=[],l=[];for(let m of t)oy(m,r(this,O,Vm))?this.maxSize&&m.size>this.maxSize?(a.push(m),l.push(this.t("tooLarge",{name:m.name,size:s(this,O,Bd).call(this,this.maxSize)}))):i.push(m):(a.push(m),l.push(this.t("wrongType",{name:m.name})));let d=r(this,O,qd)?[...this.files,...i]:i.slice(-1);!r(this,O,qd)&&!i.length&&(d=this.files),r(this,O,qd)&&this.maxFiles&&d.length>this.maxFiles&&(a.push(...d.slice(this.maxFiles)),l.push(this.t("tooMany",{max:this.maxFiles})),d=d.slice(0,this.maxFiles)),this._rejected=l.join(". "),a.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:a}})),d!==this.files&&(d.length!==this.files.length||d.some((m,u)=>m!==this.files[u]))&&(this.files=d,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}setProgress(e,t){let i=new Map(this._progress);t==null?i.delete(e):i.set(e,Math.min(100,Math.max(0,Number(t)||0))),this._progress=i}setFileError(e,t){let i=new Map(this._fileErrors);t?i.set(e,t):i.delete(e),this._fileErrors=i}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this._progress.has(e)&&this.setProgress(e,null),this._fileErrors.has(e)&&this.setFileError(e,""),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){if(r(this,O,Mo))return s(this,O,Kg).call(this);let e=this.error||this._rejected,t=!this.files.length||this.multiple,i=this.files.length>0;return c`
|
|
754
960
|
${this.label||this.hint&&i?c`<div class="head">
|
|
755
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
756
|
-
${this.hint&&i?c`<span class="hint" id="${r(this,
|
|
961
|
+
${this.label?c`<span class="label" id="${r(this,ie)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
962
|
+
${this.hint&&i?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h}
|
|
757
963
|
</div>`:h}
|
|
758
964
|
${i?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
759
|
-
${this.files.map(a=>s(this,O,
|
|
760
|
-
${t?c`<li>${s(this,O,
|
|
761
|
-
</ul>`:s(this,O,
|
|
762
|
-
${e?c`<p class="msg" id="${r(this,
|
|
763
|
-
`}};
|
|
764
|
-
${e.type.startsWith("image/")?c`<img src=${s(this,O,
|
|
965
|
+
${this.files.map(a=>s(this,O,Ug).call(this,a))}
|
|
966
|
+
${t?c`<li>${s(this,O,Xm).call(this,!0)}</li>`:h}
|
|
967
|
+
</ul>`:s(this,O,Xm).call(this,!1)}
|
|
968
|
+
${e?c`<p class="msg" id="${r(this,ie)}-msg" role="alert">${e}</p>`:h}
|
|
969
|
+
`}};tt=new WeakMap,ie=new WeakMap,Ft=new WeakMap,O=new WeakSet,Mo=function(){return this.variant==="photo"},Vm=function(){return this.accept||(r(this,O,Mo)?"image/*":"")},qd=function(){return this.multiple&&!r(this,O,Mo)},Bd=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})})},Km=function(e){let t=r(this,Ft).get(e);return t||(t=URL.createObjectURL(e),r(this,Ft).set(e,t)),t},Wm=function(e){return this._progress.has(e)},Gm=function(e){let t=this.dispatchEvent(new CustomEvent("cm-cancel",{detail:{file:e},bubbles:!0,composed:!0,cancelable:!0}));this.setProgress(e,null),t&&this.removeFile(e)},Ym=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},sr=function(e){this.toggleAttribute("data-over",e),this._over=e},jg=function(){if(this._over)return this.t("drop");let[e,t]=this.prompt.split("{browse}");return t===void 0?e:c`${e}<span class="browse">${this.t("browse")}</span>${t}`},Ug=function(e){let t=s(this,O,Wm).call(this,e),i=this._fileErrors.get(e)??"",a=`${r(this,ie)}-e${this.files.indexOf(e)}`,l=this._progress.get(e)??0;return c`<li class="item"><div class="file ${t?"busy":""} ${i?"invalid":""}">
|
|
970
|
+
${e.type.startsWith("image/")?c`<img src=${s(this,O,Km).call(this,e)} alt=${e.name} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${s(this,O,Bd).call(this,e.size)}</span></div>`}
|
|
765
971
|
${t?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
766
|
-
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(
|
|
767
|
-
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>s(this,O,
|
|
972
|
+
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(l)}><span style="inline-size:${l}%"></span></div>`:h}
|
|
973
|
+
${this.disabled?h:t?c`<button type="button" class="remove" aria-label=${this.t("cancel",{name:e.name})} @click=${()=>s(this,O,Gm).call(this,e)}><cm-icon name="close" size="12"></cm-icon></button>`:c`<button type="button" class="remove" aria-label=${this.t("remove",{name:e.name})} aria-describedby=${i?a:h}
|
|
768
974
|
@click=${()=>this.removeFile(e)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
769
|
-
</div>${i?c`<p class="ferr" id=${a} role="alert">${i}</p>`:h}</li>`},
|
|
770
|
-
@dragenter=${()=>s(this,O,
|
|
771
|
-
<input type="file" id=${r(this,
|
|
975
|
+
</div>${i?c`<p class="ferr" id=${a} role="alert">${i}</p>`:h}</li>`},Xm=function(e){let t=[this.hint&&`${r(this,ie)}-hint`,(this.error||this._rejected)&&`${r(this,ie)}-msg`].filter(Boolean).join(" "),i=this.error||this._rejected;return c`<label class="zone ${e?"tile":"row"} ${i&&!e?"invalid":""}" part="zone"
|
|
976
|
+
@dragenter=${()=>s(this,O,sr).call(this,!0)} @dragleave=${()=>s(this,O,sr).call(this,!1)} @drop=${()=>s(this,O,sr).call(this,!1)}>
|
|
977
|
+
<input type="file" id=${r(this,ie)} accept=${this.accept||h} capture=${this.capture||h} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
772
978
|
?required=${this.required&&!this.files.length}
|
|
773
|
-
aria-labelledby=${[this.label&&`${r(this,
|
|
979
|
+
aria-labelledby=${[this.label&&`${r(this,ie)}-l`,`${r(this,ie)}-p`].filter(Boolean).join(" ")}
|
|
774
980
|
aria-describedby=${t||h} aria-invalid=${this.error||this._rejected?"true":h}
|
|
775
|
-
@change=${s(this,O,
|
|
776
|
-
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${r(this,
|
|
777
|
-
<span class="words"><span id="${r(this,
|
|
778
|
-
</label>`},
|
|
981
|
+
@change=${s(this,O,Ym)} @cancel=${a=>a.stopPropagation()} />
|
|
982
|
+
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${r(this,ie)}-p">${this.t("addMore")}</span>`:c`<span class="ico"><cm-icon name="upload" size="20"></cm-icon></span>
|
|
983
|
+
<span class="words"><span id="${r(this,ie)}-p">${s(this,O,jg).call(this)}</span>${this.hint?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h}</span>`}
|
|
984
|
+
</label>`},Vg=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Kg=function(){let e=this.files[0],t=this.error||this._rejected||e&&this._fileErrors.get(e)||"",i=!!e&&s(this,O,Wm).call(this,e),a=this.label||this.t("photo"),l=[this.hint&&`${r(this,ie)}-hint`,t&&`${r(this,ie)}-msg`].filter(Boolean).join(" "),d=u=>c`<input type="file" id=${r(this,ie)} accept=${r(this,O,Vm)} capture=${this.capture||h}
|
|
779
985
|
?disabled=${this.disabled} ?required=${this.required&&!e} tabindex=${u?"-1":h} aria-hidden=${u?"true":h}
|
|
780
|
-
?hidden=${u} aria-labelledby=${u?h:`${r(this,
|
|
781
|
-
@change=${s(this,O,
|
|
986
|
+
?hidden=${u} aria-labelledby=${u?h:`${r(this,ie)}-p`} aria-describedby=${!u&&l||h} aria-invalid=${t?"true":h}
|
|
987
|
+
@change=${s(this,O,Ym)} @cancel=${v=>v.stopPropagation()} />`,m=this.hint?c`<span class="hint" id="${r(this,ie)}-hint">${this.hint}</span>`:h;return c`
|
|
782
988
|
${e?c`<div class="shot ${i?"busy":""}" part="photo">
|
|
783
|
-
${e.type.startsWith("image/")?c`<img src=${s(this,O,
|
|
989
|
+
${e.type.startsWith("image/")?c`<img src=${s(this,O,Km).call(this,e)} alt=${a} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${s(this,O,Bd).call(this,e.size)}</span></div>`}
|
|
784
990
|
${i?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
785
991
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(this._progress.get(e)??0)}><span style="inline-size:${this._progress.get(e)??0}%"></span></div>`:h}
|
|
786
992
|
</div>
|
|
787
993
|
<p class="caption" aria-hidden="true">${this.label}</p>
|
|
788
994
|
${d(!0)}
|
|
789
995
|
${this.disabled?h:i?c`<div class="actions" part="actions">
|
|
790
|
-
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,O,
|
|
996
|
+
<button type="button" class="action" aria-label=${this.t("cancel",{name:a})} @click=${()=>s(this,O,Gm).call(this,e)}><cm-icon name="close" size="16"></cm-icon>${this.t("cancelShort")}</button>
|
|
791
997
|
</div>`:c`<div class="actions" part="actions">
|
|
792
|
-
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,
|
|
998
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:a})} aria-describedby=${t?`${r(this,ie)}-msg`:h} @click=${s(this,O,Vg)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
793
999
|
<button type="button" class="action" aria-label=${this.t("removeName",{name:a})} @click=${()=>this.removeFile(e)}><cm-icon name="trash" size="16"></cm-icon>${this.t("removePhoto")}</button>
|
|
794
1000
|
</div>`}`:c`<label class="zone photo ${t?"invalid":""}" part="zone photo"
|
|
795
|
-
@dragenter=${()=>s(this,O,
|
|
1001
|
+
@dragenter=${()=>s(this,O,sr).call(this,!0)} @dragleave=${()=>s(this,O,sr).call(this,!1)} @drop=${()=>s(this,O,sr).call(this,!1)}>
|
|
796
1002
|
${d(!1)}
|
|
797
1003
|
<cm-icon name="camera" size="24"></cm-icon>
|
|
798
|
-
<span class="photo-label" id="${r(this,
|
|
799
|
-
${
|
|
1004
|
+
<span class="photo-label" id="${r(this,ie)}-p" part="label">${this.label||this.t("takePhoto")}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>
|
|
1005
|
+
${m}
|
|
800
1006
|
</label>`}
|
|
801
|
-
${t?c`<p class="msg" id="${r(this,
|
|
802
|
-
`},
|
|
1007
|
+
${t?c`<p class="msg" id="${r(this,ie)}-msg" role="alert">${t}</p>`:h}
|
|
1008
|
+
`},yi.formAssociated=!0,yi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},yi.properties={label:{},hint:{},prompt:{string:"prompt"},name:{reflect:!0},accept:{},multiple:{type:Boolean},maxSize:{type:Number,attribute:"max-size"},maxFiles:{type:Number,attribute:"max-files"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},error:{reflect:!0},files:{attribute:!1},variant:{reflect:!0},capture:{reflect:!0},_rejected:{state:!0},_progress:{state:!0},_fileErrors:{state:!0},_over:{state:!0}},yi.styles=[k,x`
|
|
803
1009
|
:host { display: block; }
|
|
804
1010
|
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-8); margin-bottom: var(--cm-space-12); }
|
|
805
1011
|
.label { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -883,33 +1089,33 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
883
1089
|
@media (max-width: 640px) {
|
|
884
1090
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
885
1091
|
}
|
|
886
|
-
`];$("cm-file-upload",
|
|
887
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1092
|
+
`];$("cm-file-upload",yi);var t$=z("colorField",{swatch:"{name}, {hex}",hex:"Hex code",hexNamed:"{label}, hex code",placeholder:"#RRGGBB",picker:"Choose a custom colour",pickerNamed:"Choose a custom colour for {label}",required:"Please choose a colour.",invalid:"Enter a colour as #RRGGBB, for example #2e6faf.",black:"Black",grey:"Grey",lightGrey:"Light grey",red:"Red",darkOrange:"Dark orange",orange:"Orange",yellow:"Yellow",lightGreen:"Light green",green:"Green",lightBlue:"Light blue",blue:"Blue",indigo:"Indigo"}),ly=[{value:"#000000",key:"black"},{value:"#707070",key:"grey"},{value:"#c9c9c9",key:"lightGrey"},{value:"#de0000",key:"red"},{value:"#ad5500",key:"darkOrange"},{value:"#f1a953",key:"orange"},{value:"#ffc107",key:"yellow"},{value:"#81bb47",key:"lightGreen"},{value:"#3c7c00",key:"green"},{value:"#5394d9",key:"lightBlue"},{value:"#2e6faf",key:"blue"},{value:"#446beb",key:"indigo"}];function jt(o){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(o.trim());return n?`#${(n[1].length===3?[...n[1]].map(t=>t+t).join(""):n[1]).toLowerCase()}`:null}var cy=o=>{let n=parseInt(o.slice(1),16);return[n>>16&255,n>>8&255,n&255].map(e=>e/255).map(e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,i)=>e+t*[.2126,.7152,.0722][i],0)};function dy(o){let n=cy(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var Fe,yt,To,Da,Y,nr,Jm,Wg,Gg,Zm,Yg,Xg,Jg,Zg,xi=class extends T{constructor(){super(...arguments);p(this,Y);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.picker=!1;this.required=!1;this.disabled=!1;this._invalid=!1;p(this,Fe,this.attachInternals());p(this,yt,A("cm-cf"));p(this,To,"");p(this,Da)}connectedCallback(){super.connectedCallback(),g(this,To,jt(this.value)??this.value)}get form(){return r(this,Fe).form}get validity(){return r(this,Fe).validity}get validationMessage(){return r(this,Fe).validationMessage}checkValidity(){return r(this,Fe).checkValidity()}reportValidity(){return r(this,Fe).reportValidity()}formResetCallback(){this.value=r(this,To),this._draft=void 0,this._invalid=!1}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get items(){return this.swatches?this.swatches.flatMap(e=>{let t=typeof e=="string"?{value:e}:e,i=jt(t?.value??"");return i?[{value:i,name:t.name}]:[]}):ly.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=jt(this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==r(this,Da)&&(this._draft=void 0,this._invalid=!1),g(this,Da,void 0)}}updated(){let e=!this.value||jt(this.value)!==null;r(this,Fe).setFormValue(this.value&&e?this.value:null,this.value);let t=this.renderRoot.querySelector(".input")??void 0;this.error?r(this,Fe).setValidity({customError:!0},this.error,t):this._invalid||!e?r(this,Fe).setValidity({patternMismatch:!0},this.t("invalid"),t):this.required&&!this.value?r(this,Fe).setValidity({valueMissing:!0},this.t("required"),t):r(this,Fe).setValidity({})}render(){let e=this.items,t=jt(this.value??""),i=e.findIndex(u=>u.value===t),a=this.error||(this._invalid||this.value&&!t?this.t("invalid"):""),l=[a&&`${r(this,yt)}-err`,this.helpText&&`${r(this,yt)}-help`].filter(Boolean).join(" ")||h,d=this.getAttribute("aria-label"),m=this.label||d||"";return c`<div class="field">
|
|
1093
|
+
${this.label?c`<span class="label" id="${r(this,yt)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}${this.hint?c`<span class="hint">[${this.hint}]</span>`:h}</span>`:h}
|
|
888
1094
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
889
|
-
aria-labelledby=${this.label?`${r(this,
|
|
890
|
-
aria-required=${this.required?"true":h} aria-describedby=${
|
|
891
|
-
${e.map((u,v)=>{let
|
|
892
|
-
aria-label=${
|
|
893
|
-
style="background-color:${u.value};color:${
|
|
894
|
-
@click=${()=>s(this,
|
|
1095
|
+
aria-labelledby=${this.label?`${r(this,yt)}-l`:h} aria-label=${!this.label&&d?d:h}
|
|
1096
|
+
aria-required=${this.required?"true":h} aria-describedby=${l}>
|
|
1097
|
+
${e.map((u,v)=>{let b=u.name?this.t("swatch",{name:u.name,hex:u.value}):u.value;return c`<button type="button" class="swatch" part="swatch" role="radio" aria-checked=${v===i?"true":"false"}
|
|
1098
|
+
aria-label=${b} title=${u.name||u.value} tabindex=${v===(i>=0?i:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
1099
|
+
style="background-color:${u.value};color:${dy(u.value)}"
|
|
1100
|
+
@click=${()=>s(this,Y,Jm).call(this,v)} @keydown=${w=>s(this,Y,Wg).call(this,w,v)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
895
1101
|
</div>`:h}
|
|
896
1102
|
<div class="row">
|
|
897
1103
|
${this.picker?c`<label class="pick" part="picker" style=${t?`background-color:${t}`:h}>
|
|
898
|
-
<input type="color" .value=${
|
|
899
|
-
aria-label=${
|
|
900
|
-
@input=${s(this,
|
|
1104
|
+
<input type="color" .value=${ne(t??"#000000")} ?disabled=${this.disabled}
|
|
1105
|
+
aria-label=${m?this.t("pickerNamed",{label:m}):this.t("picker")}
|
|
1106
|
+
@input=${s(this,Y,Jg)} @change=${s(this,Y,Zg)} />
|
|
901
1107
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
902
1108
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${t?`background-color:${t}`:h}></span>`}
|
|
903
|
-
<input class="input" part="input" id=${r(this,
|
|
904
|
-
maxlength="7" .value=${
|
|
905
|
-
aria-label=${
|
|
1109
|
+
<input class="input" part="input" id=${r(this,yt)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
1110
|
+
maxlength="7" .value=${ne(this._draft??this.value??"")} placeholder=${this.t("placeholder")}
|
|
1111
|
+
aria-label=${m?this.t("hexNamed",{label:m}):this.t("hex")}
|
|
906
1112
|
?required=${this.required} ?disabled=${this.disabled}
|
|
907
|
-
aria-invalid=${a?"true":h} aria-describedby=${
|
|
908
|
-
@input=${s(this,
|
|
1113
|
+
aria-invalid=${a?"true":h} aria-describedby=${l}
|
|
1114
|
+
@input=${s(this,Y,Gg)} @change=${s(this,Y,Yg)} @keydown=${s(this,Y,Xg)} />
|
|
909
1115
|
</div>
|
|
910
|
-
${a?c`<p class="error" id="${r(this,
|
|
911
|
-
${this.helpText?c`<p class="help" id="${r(this,
|
|
912
|
-
</div>`}};
|
|
1116
|
+
${a?c`<p class="error" id="${r(this,yt)}-err" role="alert">${a}</p>`:h}
|
|
1117
|
+
${this.helpText?c`<p class="help" id="${r(this,yt)}-help">${this.helpText}</p>`:h}
|
|
1118
|
+
</div>`}};Fe=new WeakMap,yt=new WeakMap,To=new WeakMap,Da=new WeakMap,Y=new WeakSet,nr=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},Jm=function(e){let t=this.items[e];!t||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".swatch")[e]?.focus()),this._draft=void 0,this._invalid=!1,t.value!==this.value&&(this.value=t.value,s(this,Y,nr).call(this,"input","change")))},Wg=function(e,t){let i=this.items.length,a=J(e,this),l;if(a==="ArrowRight"||e.key==="ArrowDown")l=(t+1)%i;else if(a==="ArrowLeft"||e.key==="ArrowUp")l=(t-1+i)%i;else if(e.key==="Home")l=0;else if(e.key==="End")l=i-1;else if(e.key===" "||e.key==="Enter")l=t;else return;e.preventDefault(),s(this,Y,Jm).call(this,l)},Gg=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let i=/^#?[0-9a-f]{6}$/i.test(t.trim())?jt(t):null;i&&i!==this.value&&(g(this,Da,i),this.value=i,s(this,Y,nr).call(this,"input")),this._invalid&&(i||!t.trim())&&(this._invalid=!1)},Zm=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?jt(e):"";if(t===null){this._invalid=!0;return}let i=this.value;this.value=t,this._draft=void 0,this._invalid=!1,t!==i&&s(this,Y,nr).call(this,"input"),s(this,Y,nr).call(this,"change")},Yg=function(e){e.stopPropagation(),s(this,Y,Zm).call(this)},Xg=function(e){e.key==="Enter"&&s(this,Y,Zm).call(this)},Jg=function(e){e.stopPropagation();let t=jt(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,s(this,Y,nr).call(this,"input"))},Zg=function(e){e.stopPropagation(),s(this,Y,nr).call(this,"change")},xi.formAssociated=!0,xi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},xi.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},swatches:{type:Array},picker:{type:Boolean},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_draft:{state:!0},_invalid:{state:!0}},xi.styles=[k,Ge,x`
|
|
913
1119
|
:host { display: block; }
|
|
914
1120
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
915
1121
|
.swatch {
|
|
@@ -948,18 +1154,18 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
948
1154
|
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
949
1155
|
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
950
1156
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
951
|
-
`];$("cm-color-field",
|
|
1157
|
+
`];$("cm-color-field",xi);var l$=z("signatureField",{modes:"How to sign",draw:"Draw",type:"Type",pad:"Signature drawing area",padSigned:"Signature drawing area, signed",instructions:"Draw your signature with a mouse, finger or pen. To sign with the keyboard, choose Type.",signHere:"Sign here",typeLabel:"Type your full name",typePlaceholder:"Type your full name",undo:"Undo",undoLabel:"Undo last stroke",clear:"Clear",clearLabel:"Clear signature",cleared:"Signature cleared",undone:"Last stroke removed",required:"Please sign here."}),Qm=3,Fd=.7,hy=.0055,jd="#000000",Qg=8,zo=2,my=400,py=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),it,_o,Aa,Co,rt,at,st,$i,ki,ze,So,Ei,Ra,C,ep,Ud,tp,Ut,Vd,ip,rp,eb,ap,Kd,sp,Wd,tb,np,ib,or,Gd,op,lp,rb,cp,ab,dp,sb,nb,wi=class extends T{constructor(){super(...arguments);p(this,C);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.mode="draw";this.typedName="";this.required=!1;this.disabled=!1;this._announce="";p(this,it,this.attachInternals());p(this,_o,A("cm-sig"));p(this,Aa,"");p(this,Co,"");p(this,rt,[]);p(this,at);p(this,st);p(this,$i,"");p(this,ki,0);p(this,ze);p(this,So,"");p(this,Ei);p(this,Ra,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?s(this,C,ep).call(this):(g(this,Aa,this.value),g(this,Co,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),r(this,Ei)?.disconnect(),g(this,Ei,void 0),cancelAnimationFrame(r(this,ki)),g(this,ki,0),r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0))}get form(){return r(this,it).form}get validity(){return r(this,it).validity}get validationMessage(){return r(this,it).validationMessage}checkValidity(){return r(this,it).checkValidity()}reportValidity(){return r(this,it).reportValidity()}formResetCallback(){g(this,rt,[]),g(this,at,void 0),g(this,st,void 0),r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0)),this.typedName=r(this,Co),r(this,Aa)?(g(this,$i,""),this.value=r(this,Aa)):this.updateComplete.then(()=>s(this,C,or).call(this,!1)),s(this,C,Ut).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!r(this,rt).length&&!r(this,st)}toDataURL(){return s(this,C,op).call(this)?.toDataURL("image/png")??""}toBlob(){let e=s(this,C,op).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(g(this,rt,[]),g(this,at,void 0),g(this,st,void 0),s(this,C,Ut).call(this)),s(this,C,or).call(this,!0)}undo(){this.mode==="draw"&&(r(this,rt).length?r(this,rt).pop():g(this,st,void 0),g(this,at,void 0),s(this,C,Ut).call(this),s(this,C,or).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==r(this,$i)){let t=this.value??"";if(g(this,$i,t),g(this,rt,[]),g(this,at,void 0),!t)g(this,st,void 0),this.hasUpdated&&(this.typedName="");else{let i=new Image;i.onload=()=>{r(this,st)===i&&s(this,C,Ut).call(this)},i.src=t,g(this,st,i),this.mode="draw"}s(this,C,Ut).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();g(this,$i,t),this.value=t}}firstUpdated(){s(this,C,ep).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>s(this,C,or).call(this,!1)),s(this,C,Wd).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&s(this,C,Wd).call(this),r(this,it).setFormValue(this.value||null,this.value);let t=(this.mode==="type"?this.renderRoot.querySelector(".typed"):this.renderRoot.querySelector('.tab[aria-selected="true"]'))??void 0;this.error?r(this,it).setValidity({customError:!0},this.error,t):this.required&&this.empty?r(this,it).setValidity({valueMissing:!0},this.t("required"),t):r(this,it).setValidity({})}render(){let e=r(this,_o),t=this.getAttribute("aria-label"),i=this.error,a=[i&&`${e}-err`,this.helpText&&`${e}-help`].filter(Boolean).join(" "),l=this.empty,d=!r(this,rt).length&&!r(this,st),m=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
952
1158
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
953
1159
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
954
|
-
@click=${()=>s(this,C,
|
|
1160
|
+
@click=${()=>s(this,C,lp).call(this,u,!0)} @keydown=${s(this,C,rb)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
955
1161
|
${this.label?c`<span class="label" id="${e}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}${this.hint?c`<span class="hint">[${this.hint}]</span>`:h}</span>`:h}
|
|
956
1162
|
<div class="bar">
|
|
957
1163
|
<div class="tabs" role="tablist" part="tabs"
|
|
958
1164
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
959
|
-
aria-label=${this.label?h:t||this.t("modes")}>${
|
|
1165
|
+
aria-label=${this.label?h:t||this.t("modes")}>${m("draw")}${m("type")}</div>
|
|
960
1166
|
<div class="actions">
|
|
961
|
-
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,
|
|
962
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||
|
|
1167
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${s(this,C,sb)}>${this.t("undo")}</button>`:h}
|
|
1168
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${s(this,C,nb)}>${this.t("clear")}</button>
|
|
963
1169
|
</div>
|
|
964
1170
|
</div>
|
|
965
1171
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -969,8 +1175,8 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
969
1175
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
970
1176
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
971
1177
|
aria-describedby=${[`${e}-instr`,a].filter(Boolean).join(" ")}
|
|
972
|
-
@pointerdown=${s(this,C,
|
|
973
|
-
@lostpointercapture=${s(this,C,
|
|
1178
|
+
@pointerdown=${s(this,C,eb)} @pointermove=${s(this,C,ap)} @pointerup=${s(this,C,Kd)} @pointercancel=${s(this,C,Kd)}
|
|
1179
|
+
@lostpointercapture=${s(this,C,Kd)} @transitionend=${()=>s(this,C,Vd).call(this)}></canvas>
|
|
974
1180
|
</div>
|
|
975
1181
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
976
1182
|
</div>
|
|
@@ -978,17 +1184,17 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
978
1184
|
<div class="pad" part="pad">
|
|
979
1185
|
<span class="line" aria-hidden="true"></span>
|
|
980
1186
|
<input class="typed" part="input" type="text" autocomplete="name" spellcheck="false" maxlength="80"
|
|
981
|
-
.value=${
|
|
1187
|
+
.value=${ne(this.typedName??"")} placeholder=${this.t("typePlaceholder")}
|
|
982
1188
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
983
1189
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
984
1190
|
aria-describedby=${a||h} ?disabled=${this.disabled}
|
|
985
|
-
@input=${s(this,C,
|
|
1191
|
+
@input=${s(this,C,tb)} @change=${s(this,C,ib)} />
|
|
986
1192
|
</div>
|
|
987
1193
|
</div>
|
|
988
1194
|
${i?c`<p class="error" id="${e}-err" role="alert">${i}</p>`:h}
|
|
989
1195
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
990
1196
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
991
|
-
</div>`}};
|
|
1197
|
+
</div>`}};it=new WeakMap,_o=new WeakMap,Aa=new WeakMap,Co=new WeakMap,rt=new WeakMap,at=new WeakMap,st=new WeakMap,$i=new WeakMap,ki=new WeakMap,ze=new WeakMap,So=new WeakMap,Ei=new WeakMap,Ra=new WeakMap,C=new WeakSet,ep=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,Ei)||(g(this,Ei,new ResizeObserver(()=>s(this,C,tp).call(this))),r(this,Ei).observe(e))},Ud=function(){return this.renderRoot.querySelector("canvas")},tp=function(){let e=r(this,C,Ud);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;g(this,Ra,t);let a=window.devicePixelRatio||1,l=Math.round(t*a),d=Math.round(i*a);(e.width!==l||e.height!==d)&&(e.width=l,e.height=d),s(this,C,Vd).call(this)},Ut=function(){r(this,ki)||g(this,ki,requestAnimationFrame(()=>{g(this,ki,0),s(this,C,Vd).call(this)}))},Vd=function(){let e=r(this,C,Ud);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,Ra);if(!i)return;let a=e.width/i;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),t.setTransform(a,0,0,a,0,0);let l=getComputedStyle(e).color||jd;s(this,C,ip).call(this,t,i,l,!0)},ip=function(e,t,i,a){let l=t/Qm,d=r(this,st);if(d?.complete&&d.naturalWidth){let m=Math.min(t*.9/d.naturalWidth,l*.9/d.naturalHeight),u=d.naturalWidth*m,v=d.naturalHeight*m,b=(t-u)/2,w=(l-v)/2;if(a&&!by(i,jd)){let y=document.createElement("canvas");y.width=Math.max(1,Math.round(u*2)),y.height=Math.max(1,Math.round(v*2));let M=y.getContext("2d");M.drawImage(d,0,0,y.width,y.height),M.globalCompositeOperation="source-in",M.fillStyle=i,M.fillRect(0,0,y.width,y.height),e.drawImage(y,b,w,u,v)}else e.drawImage(d,b,w,u,v)}e.strokeStyle=i,e.fillStyle=i,e.lineCap="round",e.lineJoin="round";for(let m of r(this,rt))uy(e,m,t)},rp=function(e,t){let i=e.pointerType==="pen"&&e.pressure>0?e.pressure:.5;return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.width,p:i}},eb=function(e){if(this.disabled||r(this,at)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.currentTarget;e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}let i=[s(this,C,rp).call(this,e,t.getBoundingClientRect())];g(this,at,{id:e.pointerId,stroke:i}),r(this,rt).push(i),s(this,C,Ut).call(this)},ap=function(e){let t=r(this,at);if(!t||e.pointerId!==t.id)return;e.preventDefault();let i=e.currentTarget.getBoundingClientRect(),a=typeof e.getCoalescedEvents=="function"?e.getCoalescedEvents():[];for(let l of a.length?a:[e]){let d=s(this,C,rp).call(this,l,i),m=t.stroke[t.stroke.length-1];Math.hypot(d.x-m.x,d.y-m.y)*i.width<1.5||t.stroke.push(d)}s(this,C,Ut).call(this)},Kd=function(e){let t=r(this,at);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&s(this,C,ap).call(this,e),g(this,at,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}s(this,C,Ut).call(this),s(this,C,or).call(this,!0)}},sp=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},Wd=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${r(this,C,sp)}`,i=!0;try{i=e.check(t,this.typedName||"Signature")}catch{}i||e.load(t,this.typedName||"Signature").then(()=>{this.mode==="type"&&this.typedName.trim()&&s(this,C,or).call(this,!1)},()=>{})},tb=function(e){e.stopPropagation(),r(this,ze)?clearTimeout(r(this,ze)):g(this,So,this.value),this.typedName=e.target.value,g(this,ze,setTimeout(()=>s(this,C,np).call(this),my)),s(this,C,Wd).call(this)},np=function(){r(this,ze)&&(clearTimeout(r(this,ze)),g(this,ze,void 0),this.value!==r(this,So)&&s(this,C,Gd).call(this))},ib=function(e){e.stopPropagation(),this.updateComplete.then(()=>s(this,C,np).call(this))},or=function(e){let t=this.empty?"":this.toDataURL(),i=t!==this.value;i&&(g(this,$i,t),this.value=t),this.requestUpdate(),e&&i&&s(this,C,Gd).call(this)},Gd=function(){let e={value:this.value,empty:this.empty,mode:this.mode};this.dispatchEvent(new CustomEvent("cm-change",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},op=function(){if(this.empty)return;let e=Math.max(r(this,C,Ud)?.clientWidth||r(this,Ra)||600,300),t=e/Qm,i=document.createElement("canvas");i.width=Math.round(e*zo),i.height=Math.round(t*zo);let a=i.getContext("2d",{willReadFrequently:!0});if(a.scale(zo,zo),this.mode==="type"){let l=Math.min(t*.45,64),d=r(this,C,sp);a.font=`400 ${l}px ${d}`;let m=this.typedName.trim(),u=e-2*Qg,v=a.measureText(m).width;v>u&&(l*=u/v,a.font=`400 ${l}px ${d}`),a.direction=getComputedStyle(this).direction==="rtl"?"rtl":"ltr",a.textAlign="center",a.textBaseline="alphabetic",a.fillStyle=jd,a.fillText(m,e/2,t*Fd)}else s(this,C,ip).call(this,a,e,jd,!1);return gy(i,Qg*zo)},lp=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${r(this,_o)}-tab-${e}`)?.focus()),e===this.mode))return;let i=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&s(this,C,tp).call(this),this.value!==i&&s(this,C,Gd).call(this)})},rb=function(e){let t=J(e,this),i;if(t==="ArrowRight"||t==="ArrowLeft")i=this.mode==="draw"?"type":"draw";else if(e.key==="Home")i="draw";else if(e.key==="End")i="type";else return;e.preventDefault(),s(this,C,lp).call(this,i,!0)},cp=function(e){s(this,C,ab).call(this,this.t(e))},ab=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},dp=function(e){this.updateComplete.then(()=>{let t=this.shadowRoot?.activeElement;if(!e||t&&!t.disabled)return;(this.mode==="type"?this.renderRoot.querySelector(".typed"):this.renderRoot.querySelector('.tab[aria-selected="true"]'))?.focus()})},sb=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),s(this,C,cp).call(this,"undone"),s(this,C,dp).call(this,e)},nb=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),s(this,C,cp).call(this,"cleared"),s(this,C,dp).call(this,e)},wi.formAssociated=!0,wi.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},wi.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},mode:{reflect:!0},typedName:{attribute:"typed-name"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_announce:{state:!0}},wi.styles=[k,x`
|
|
992
1198
|
:host { display: block; }
|
|
993
1199
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
994
1200
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -1018,7 +1224,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1018
1224
|
.act:disabled { background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed; }
|
|
1019
1225
|
.panel:focus { outline: none; }
|
|
1020
1226
|
.pad {
|
|
1021
|
-
position: relative; width: 100%; aspect-ratio: ${
|
|
1227
|
+
position: relative; width: 100%; aspect-ratio: ${Qm} / 1; overflow: hidden; container-type: inline-size;
|
|
1022
1228
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
1023
1229
|
}
|
|
1024
1230
|
.panel:focus-visible .pad, .pad:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
@@ -1029,15 +1235,15 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1029
1235
|
color: var(--cm-text-default); transition-property: color; transition-duration: 1ms; /* scale-exempt: not motion; a 1ms colour transition makes a theme change fire transitionend so the ink repaints */
|
|
1030
1236
|
}
|
|
1031
1237
|
.line {
|
|
1032
|
-
position: absolute; inset-inline: var(--cm-space-12); top: ${
|
|
1238
|
+
position: absolute; inset-inline: var(--cm-space-12); top: ${Fd*100}%; height: 0;
|
|
1033
1239
|
border-top: var(--cm-border-1) dashed var(--cm-border-input); pointer-events: none;
|
|
1034
1240
|
}
|
|
1035
1241
|
.here {
|
|
1036
|
-
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-
|
|
1242
|
+
position: absolute; inset-inline-start: var(--cm-space-12); bottom: calc(${(1-Fd)*100}% + 4px);
|
|
1037
1243
|
font-size: 12px; color: var(--cm-text-tertiary); pointer-events: none; user-select: none;
|
|
1038
1244
|
}
|
|
1039
1245
|
.typed {
|
|
1040
|
-
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-
|
|
1246
|
+
position: absolute; inset-inline: var(--cm-space-12); bottom: calc(${(1-Fd)*100}% - 0.18em);
|
|
1041
1247
|
width: calc(100% - 2 * var(--cm-space-12)); padding: 0; margin: 0;
|
|
1042
1248
|
font-family: var(--cm-signature-font, 'Dancing Script', 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', 'Brush Script MT', cursive);
|
|
1043
1249
|
font-size: clamp(24px, 9cqi, 48px); font-weight: 400; line-height: 1.25; text-align: center; /* scale-exempt: a typed signature scales with the pad, like handwriting */
|
|
@@ -1054,17 +1260,17 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1054
1260
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
1055
1261
|
|
|
1056
1262
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1057
|
-
`];function
|
|
1058
|
-
${this.label?c`<span class="label" id="${r(this,
|
|
1263
|
+
`];function uy(o,n,e){let t=d=>e*hy*(.35+d*1.3);if(n.length===1){o.beginPath(),o.arc(n[0].x*e,n[0].y*e,t(n[0].p)/2,0,Math.PI*2),o.fill();return}let i=d=>[d.x*e,d.y*e],a=n[0];for(let d=1;d<n.length-1;d++){let m=py(n[d],n[d+1]);o.beginPath(),o.moveTo(...i(a)),o.quadraticCurveTo(...i(n[d]),...i(m)),o.lineWidth=t(n[d].p),o.stroke(),a=m}let l=n[n.length-1];o.beginPath(),o.moveTo(...i(a)),o.lineTo(...i(l)),o.lineWidth=t(l.p),o.stroke()}function gy(o,n){let{width:e,height:t}=o,i=o.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e,t).data,a=t,l=e,d=-1,m=-1;for(let v=0;v<t;v++){let b=v*e*4;for(let w=0;w<e;w++)i[b+w*4+3]>8&&(w<l&&(l=w),w>d&&(d=w),v<a&&(a=v),m=v)}if(d<0)return;let u=document.createElement("canvas");return u.width=d-l+1+2*n,u.height=m-a+1+2*n,u.getContext("2d").drawImage(o,l,a,d-l+1,m-a+1,n,n,d-l+1,m-a+1),u}function by(o,n){let e=t=>{let i=/^#([0-9a-f]{6})$/i.exec(t.trim());if(i){let a=parseInt(i[1],16);return`${a>>16&255},${a>>8&255},${a&255}`}return(/\d+\s*,\s*\d+\s*,\s*\d+/.exec(t)?.[0]??t).replace(/\s/g,"")};return e(o)===e(n)}$("cm-signature-field",wi);var g$=z("optionGroup",{required:"Please select one of these options."}),ct,Lo,Ha,Do,wt,hp,mp,ob,xt=class extends T{constructor(){super(...arguments);p(this,wt);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];p(this,ct,this.attachInternals());p(this,Lo,A("cm-og"));p(this,Ha,"");p(this,Do,new MutationObserver(()=>s(this,wt,hp).call(this)))}connectedCallback(){super.connectedCallback(),s(this,wt,hp).call(this),r(this,Do).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Do).disconnect()}get form(){return r(this,ct).form}get validity(){return r(this,ct).validity}get validationMessage(){return r(this,ct).validationMessage}checkValidity(){return r(this,ct).checkValidity()}reportValidity(){return r(this,ct).reportValidity()}formResetCallback(){this.value=r(this,Ha)}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,Ha)||g(this,Ha,this.value)}updated(){r(this,ct).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,ct).setValidity({valueMissing:!0},this.t("required"),e):r(this,ct).setValidity({})}render(){let e=this.items,t=e.findIndex(l=>l.value===this.value&&!l.disabled),i=t>=0?t:e.findIndex(l=>!l.disabled),a=this.getAttribute("aria-label");return c`
|
|
1264
|
+
${this.label?c`<span class="label" id="${r(this,Lo)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1059
1265
|
<div class="options" part="options" role="radiogroup"
|
|
1060
|
-
aria-labelledby=${this.label?`${r(this,
|
|
1266
|
+
aria-labelledby=${this.label?`${r(this,Lo)}-l`:h} aria-label=${!this.label&&a?a:h}
|
|
1061
1267
|
aria-required=${this.required?"true":h}>
|
|
1062
|
-
${e.map((
|
|
1063
|
-
tabindex=${d===i?"0":"-1"} ?disabled=${this.disabled||!!
|
|
1064
|
-
@click=${()=>s(this,
|
|
1268
|
+
${e.map((l,d)=>c`<button type="button" role="radio" part="option" class=${l.tone==="critical"||l.tone==="success"?`tone-${l.tone}`:h} aria-checked=${l.value===this.value?"true":"false"}
|
|
1269
|
+
tabindex=${d===i?"0":"-1"} ?disabled=${this.disabled||!!l.disabled}
|
|
1270
|
+
@click=${()=>s(this,wt,mp).call(this,d)} @keydown=${m=>s(this,wt,ob).call(this,m,d)}>${l.label}</button>`)}
|
|
1065
1271
|
</div>
|
|
1066
1272
|
<slot></slot>
|
|
1067
|
-
`}};
|
|
1273
|
+
`}};ct=new WeakMap,Lo=new WeakMap,Ha=new WeakMap,Do=new WeakMap,wt=new WeakSet,hp=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},a=t.getAttribute("tone");return(a==="critical"||a==="success")&&(i.tone=a),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,Ha,this.value))},mp=function(e){let t=this.items[e];!t||t.disabled||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll("button")[e]?.focus()),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},ob=function(e,t){let i=J(e,this),a=this.items.flatMap((m,u)=>m.disabled?[]:[u]),l=a.indexOf(t),d;if(i==="ArrowRight"||e.key==="ArrowDown")d=a[(l+1)%a.length];else if(i==="ArrowLeft"||e.key==="ArrowUp")d=a[(l-1+a.length)%a.length];else if(e.key==="Home")d=a[0];else if(e.key==="End")d=a[a.length-1];else return;e.preventDefault(),d!==void 0&&s(this,wt,mp).call(this,d)},xt.formAssociated=!0,xt.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},xt.styles=[k,x`
|
|
1068
1274
|
:host { display: block; }
|
|
1069
1275
|
.label {
|
|
1070
1276
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1096,7 +1302,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1096
1302
|
}
|
|
1097
1303
|
slot { display: none; }
|
|
1098
1304
|
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
1099
|
-
`];$("cm-option-group",
|
|
1305
|
+
`];$("cm-option-group",xt);var $$=z("segmentedControl",{required:"Please select one of these options."}),Na=class extends xt{constructor(){super(...arguments);this.size="default"}};Na.properties={...xt.properties,size:{reflect:!0}},Na.styles=[k,x`
|
|
1100
1306
|
:host { display: inline-block; vertical-align: middle; max-width: 100%; --_h: var(--cm-control-height-md, 36px); }
|
|
1101
1307
|
:host([size='small']) { --_h: var(--cm-control-height-sm, 32px); }
|
|
1102
1308
|
@media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
|
|
@@ -1126,9 +1332,9 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1126
1332
|
button[aria-checked='true']:disabled { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
1127
1333
|
:host([disabled]) .options { background: var(--cm-bg-input-filled); }
|
|
1128
1334
|
slot { display: none; }
|
|
1129
|
-
`];$("cm-segmented-control",
|
|
1130
|
-
<div class
|
|
1131
|
-
${t?c`<a class
|
|
1335
|
+
`];$("cm-segmented-control",Na);var _$=z("pageHeader",{back:"Back to {label}",backOnly:"Back",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),Ao,pp,Ia=class extends T{constructor(){super(...arguments);p(this,Ao);this.heading="";this.description="";this.breadcrumbs=[];this.backHref="";this.backLabel="";this.pagination=!1;this.hasPrevious=!1;this.hasNext=!1}render(){let e=Array.isArray(this.breadcrumbs)?this.breadcrumbs:[],t=this.backHref?{href:this.backHref,label:this.backLabel}:[...e].reverse().find(i=>i.href);return c`<header part="header">
|
|
1336
|
+
<div class=${this.description?"lead described":"lead"}>
|
|
1337
|
+
${t?c`<a class=${this.backHref?"back always":"back"} part="back" href=${t.href} aria-label=${t.label?this.t("back",{label:t.label}):this.t("backOnly")}><cm-icon name="chevron-left" size="20"></cm-icon></a>`:h}
|
|
1132
1338
|
<div class="titles">
|
|
1133
1339
|
${e.length?c`<nav aria-label=${this.t("breadcrumbs")} part="breadcrumbs"><ol>
|
|
1134
1340
|
${e.map(i=>c`<li>${i.href?c`<a href=${i.href}>${i.label}</a>`:i.label}</li>`)}
|
|
@@ -1140,12 +1346,12 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1140
1346
|
</div>
|
|
1141
1347
|
<div class="actions">
|
|
1142
1348
|
${this.pagination?c`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
1143
|
-
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,
|
|
1144
|
-
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,
|
|
1349
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>s(this,Ao,pp).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
1350
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>s(this,Ao,pp).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
1145
1351
|
</div>`:h}
|
|
1146
1352
|
<slot name="actions"></slot>
|
|
1147
1353
|
</div>
|
|
1148
|
-
</header>`}};
|
|
1354
|
+
</header>`}};Ao=new WeakSet,pp=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Ia.properties={heading:{},description:{},breadcrumbs:{type:Array},backHref:{attribute:"back-href"},backLabel:{attribute:"back-label"},pagination:{type:Boolean,reflect:!0},hasPrevious:{type:Boolean,attribute:"has-previous"},hasNext:{type:Boolean,attribute:"has-next"}},Ia.styles=[k,x`
|
|
1149
1355
|
:host { display: block; }
|
|
1150
1356
|
header {
|
|
1151
1357
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-12) var(--cm-space-20);
|
|
@@ -1183,6 +1389,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1183
1389
|
.arrow:active:not(:disabled), .back:active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
|
|
1184
1390
|
.arrow:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
1185
1391
|
.back { display: none; border: 0; flex: none; text-decoration: none; }
|
|
1392
|
+
.back.always { display: inline-flex; }
|
|
1186
1393
|
/* Icon buttons (1.6): 36 x 36, 40 x 40 on touch screens with a 44px hit area. */
|
|
1187
1394
|
@media (pointer: coarse) {
|
|
1188
1395
|
.arrow, .back { width: var(--cm-control-height-lg, 40px); height: var(--cm-control-height-lg, 40px); }
|
|
@@ -1192,13 +1399,16 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1192
1399
|
/* Title and actions share one row while they fit; otherwise the actions wrap below, so nothing spills sideways. */
|
|
1193
1400
|
header { min-height: 48px; padding: var(--cm-space-8) var(--cm-space-16); gap: var(--cm-space-8); }
|
|
1194
1401
|
.lead { flex: 1 1 160px; }
|
|
1402
|
+
/* With a description (a record's meta line) the title block takes the whole row and the actions go under it,
|
|
1403
|
+
so the meta line is not squeezed into a narrow column beside the buttons. Since 1.7. */
|
|
1404
|
+
.lead.described { flex-basis: 100%; }
|
|
1195
1405
|
.actions { flex: 0 1 auto; min-width: 0; max-width: 100%; justify-content: flex-end; }
|
|
1196
1406
|
nav { display: none; }
|
|
1197
1407
|
.back { display: inline-flex; }
|
|
1198
1408
|
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
1199
1409
|
.actions { gap: var(--cm-space-8); }
|
|
1200
1410
|
}
|
|
1201
|
-
`];$("cm-page-header",
|
|
1411
|
+
`];$("cm-page-header",Ia);var H$=z("actionBar",{label:"Actions"}),Pa=class extends T{constructor(){super(...arguments);this.eyebrow="";this.heading="";this.tone="default";this.sticky=!1;this.label=""}render(){let e=this.tone==="critical";return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.heading||this.eyebrow||this.t("label")}>
|
|
1202
1412
|
<div class="lead">
|
|
1203
1413
|
${e?c`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:h}
|
|
1204
1414
|
<div class="text">
|
|
@@ -1208,7 +1418,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1208
1418
|
</div>
|
|
1209
1419
|
</div>
|
|
1210
1420
|
<div class="actions"><slot name="actions"></slot></div>
|
|
1211
|
-
</div>`}};
|
|
1421
|
+
</div>`}};Pa.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},Pa.styles=[k,x`
|
|
1212
1422
|
:host { display: block; }
|
|
1213
1423
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
1214
1424
|
.bar {
|
|
@@ -1239,13 +1449,13 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1239
1449
|
|
|
1240
1450
|
.actions { gap: var(--cm-space-8); }
|
|
1241
1451
|
}
|
|
1242
|
-
`];$("cm-action-bar",
|
|
1452
|
+
`];$("cm-action-bar",Pa);var B$=z("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),$t,lr,Ro,_e,up,gp,bp,lb,cb,Oa=class extends T{constructor(){super(...arguments);p(this,_e);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";p(this,$t,null);p(this,lr,()=>{this.open=!0});p(this,Ro,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>s(this,_e,up).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,_e,gp).call(this)}updated(e){e.has("form")&&this.isConnected&&s(this,_e,up).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1243
1453
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1244
1454
|
<div class="actions">
|
|
1245
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,
|
|
1246
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,
|
|
1455
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${s(this,_e,cb)}>${this.discardLabel}</cm-button>
|
|
1456
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${s(this,_e,lb)}>${this.saveLabel}</cm-button>
|
|
1247
1457
|
</div>
|
|
1248
|
-
</div>`}}
|
|
1458
|
+
</div>`}};$t=new WeakMap,lr=new WeakMap,Ro=new WeakMap,_e=new WeakSet,up=function(){s(this,_e,gp).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,$t,e),e.addEventListener("input",r(this,lr)),e.addEventListener("change",r(this,lr)),e.addEventListener("reset",r(this,Ro)))},gp=function(){let e=r(this,$t);e&&(e.removeEventListener("input",r(this,lr)),e.removeEventListener("change",r(this,lr)),e.removeEventListener("reset",r(this,Ro)),g(this,$t,null))},bp=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},lb=function(){this.loading||this.saveDisabled||s(this,_e,bp).call(this,"cm-save")&&r(this,$t)&&r(this,$t).requestSubmit()},cb=function(){this.loading||s(this,_e,bp).call(this,"cm-discard")&&r(this,$t)&&(r(this,$t).reset(),this.open=!1)},Oa.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:{}},Oa.styles=[k,x`
|
|
1249
1459
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1250
1460
|
:host(:not([open])) { display: none; }
|
|
1251
1461
|
.bar {
|
|
@@ -1261,18 +1471,18 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1261
1471
|
.message { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; }
|
|
1262
1472
|
|
|
1263
1473
|
}
|
|
1264
|
-
`];$("cm-save-bar",
|
|
1474
|
+
`];$("cm-save-bar",Oa);var qa=class extends S{constructor(){super(...arguments);this.heading="";this.action="";this.actionLabel="";this.headingLevel=2;this.variant="default";this.layout="stacked";this._list=!0}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="panel" aria-label=${this.heading||h}>
|
|
1265
1475
|
${this.heading||this.action?c`<header>
|
|
1266
1476
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
1267
1477
|
${this.action?c`<button class="action" type="button" part="action" aria-label=${this.actionLabel||h}
|
|
1268
1478
|
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h}
|
|
1269
1479
|
</header>`:h}
|
|
1270
1480
|
<div class="items" role=${this._list?"list":h}><slot @slotchange=${t=>{this._list=t.target.assignedElements().every(i=>i.localName==="cm-info-item")}}></slot></div>
|
|
1271
|
-
</section>`}};
|
|
1481
|
+
</section>`}};qa.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},layout:{reflect:!0},_list:{state:!0}},qa.styles=[k,x`
|
|
1272
1482
|
:host { display: block; }
|
|
1273
1483
|
section {
|
|
1274
1484
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
1275
|
-
border-radius: var(--cm-radius-md); padding: var(--cm-space-
|
|
1485
|
+
border-radius: var(--cm-radius-md); padding: var(--cm-space-24);
|
|
1276
1486
|
}
|
|
1277
1487
|
header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--cm-space-16); margin-bottom: var(--cm-space-16); }
|
|
1278
1488
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1284,25 +1494,34 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1284
1494
|
.action:hover { text-decoration-thickness: 2px; }
|
|
1285
1495
|
.action:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1286
1496
|
.items { display: grid; grid-template-columns: 1fr 1fr; gap: var(--cm-space-12) var(--cm-space-20); }
|
|
1287
|
-
|
|
1497
|
+
:host([variant='compact']) section { padding: var(--cm-space-16); }
|
|
1498
|
+
@media (max-width: 640px) { section { padding: var(--cm-space-16); } }
|
|
1499
|
+
:host([variant='compact']) header { margin-bottom: var(--cm-space-12); }
|
|
1500
|
+
/* Rows (1.7): the item's label and value become two columns of its own grid. */
|
|
1501
|
+
:host([layout='rows']) .items { grid-template-columns: minmax(0, 1fr); }
|
|
1502
|
+
:host([layout='rows']) ::slotted(cm-info-item) {
|
|
1503
|
+
display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: baseline;
|
|
1504
|
+
column-gap: var(--cm-space-12); grid-column: 1 / -1; --_cm-info-value-gap: 0px;
|
|
1505
|
+
}
|
|
1506
|
+
`];$("cm-info-panel",qa);var Ba=class extends S{constructor(){super(...arguments);this.label="";this.half=!1}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}render(){return c`<div class="label" part="label">${this.label}</div><div class="value" part="value"><slot></slot></div>`}};Ba.properties={label:{},half:{type:Boolean,reflect:!0}},Ba.styles=[k,x`
|
|
1288
1507
|
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
1289
1508
|
:host([half]) { grid-column: auto; }
|
|
1290
1509
|
.label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
|
|
1291
1510
|
.value {
|
|
1292
1511
|
display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8);
|
|
1293
|
-
margin-top: var(--cm-space-4); font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; overflow-wrap: anywhere;
|
|
1512
|
+
margin-top: var(--_cm-info-value-gap, var(--cm-space-4)); font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; overflow-wrap: anywhere;
|
|
1294
1513
|
|
|
1295
1514
|
}
|
|
1296
|
-
`];$("cm-info-item",
|
|
1515
|
+
`];$("cm-info-item",Ba);var cr,Fa=class extends S{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;p(this,cr,A("cm-accordion"))}toggle(){this.disabled||(this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{bubbles:!0,composed:!0,detail:{open:this.open}})))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||3));return c`<div class="wrap" part="accordion">
|
|
1297
1516
|
<div class="h" role="heading" aria-level=${e}>
|
|
1298
|
-
<button type="button" part="toggle" id="${r(this,
|
|
1517
|
+
<button type="button" part="toggle" id="${r(this,cr)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,cr)}-body"
|
|
1299
1518
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
1300
1519
|
<span>${this.heading}</span>
|
|
1301
1520
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
1302
1521
|
</button>
|
|
1303
1522
|
</div>
|
|
1304
|
-
<div class="body" part="body" id="${r(this,
|
|
1305
|
-
</div>`}};
|
|
1523
|
+
<div class="body" part="body" id="${r(this,cr)}-body" role="region" aria-labelledby="${r(this,cr)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
1524
|
+
</div>`}};cr=new WeakMap,Fa.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Fa.styles=[k,x`
|
|
1306
1525
|
:host { display: block; }
|
|
1307
1526
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
1308
1527
|
.h { margin: 0; font: inherit; }
|
|
@@ -1325,24 +1544,24 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1325
1544
|
.body[hidden] { display: none; }
|
|
1326
1545
|
|
|
1327
1546
|
|
|
1328
|
-
`];$("cm-accordion",
|
|
1547
|
+
`];$("cm-accordion",Fa);var He,dr,fp,db,ja=class extends S{constructor(){super(...arguments);p(this,He);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="default";this.action="";this.actionHref="";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));if(this.size==="inline")return s(this,He,db).call(this,e);let t=this.image?c`<img src=${this.image} alt="" part="image">`:this.icon?c`<cm-icon name=${this.icon} size=${this.size==="large"||this.size==="small"?"48":"24"}></cm-icon>`:h;return c`<div class="wrap" part="empty-state">
|
|
1329
1548
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1330
|
-
<slot name="image" @slotchange=${i=>s(this,
|
|
1549
|
+
<slot name="image" @slotchange=${i=>s(this,He,dr).call(this,i,"hasImage")}>${t}</slot>
|
|
1331
1550
|
</div>
|
|
1332
1551
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1333
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,
|
|
1334
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,
|
|
1335
|
-
</div>`}};
|
|
1336
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},
|
|
1552
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>s(this,He,dr).call(this,i,"hasText")}></slot></div>
|
|
1553
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,He,dr).call(this,i,"hasActions")}></slot></div>${this.action?c`<div class="actions">${s(this,He,fp).call(this)}</div>`:h}
|
|
1554
|
+
</div>`}};He=new WeakSet,dr=function(e,t){let i=e.target;this[t]=i.assignedNodes({flatten:!0}).some(a=>a.nodeType===1||a.textContent.trim()),this.requestUpdate()},fp=function(){return this.action?this.actionHref?c`<a class="text-action" part="action" href=${this.actionHref}>${this.action}</a>`:c`<button class="text-action" type="button" part="action"
|
|
1555
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},db=function(e){let t=this.image?c`<img src=${this.image} alt="" part="image">`:this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h;return c`<div class="wrap inline" part="empty-state">
|
|
1337
1556
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1338
|
-
<slot name="image" @slotchange=${i=>s(this,
|
|
1557
|
+
<slot name="image" @slotchange=${i=>s(this,He,dr).call(this,i,"hasImage")}>${t}</slot>
|
|
1339
1558
|
</span>
|
|
1340
1559
|
<div class="line">
|
|
1341
1560
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1342
|
-
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,
|
|
1343
|
-
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,
|
|
1561
|
+
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>s(this,He,dr).call(this,i,"hasText")}></slot></span>${s(this,He,fp).call(this)}
|
|
1562
|
+
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>s(this,He,dr).call(this,i,"hasActions")}></slot></span>
|
|
1344
1563
|
</div>
|
|
1345
|
-
</div>`},
|
|
1564
|
+
</div>`},ja.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0},action:{},actionHref:{attribute:"action-href"}},ja.styles=[k,x`
|
|
1346
1565
|
:host { display: block; }
|
|
1347
1566
|
/* Default (1.6): a 48px tile with a 24px icon, then 12px to a 16/24 heading, 4px to 13/18 text, 12px to the actions. */
|
|
1348
1567
|
.wrap {
|
|
@@ -1391,7 +1610,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1391
1610
|
:host([size='large']) .circle { width: 120px; height: 120px; }
|
|
1392
1611
|
:host([size='large']) .title { margin-top: var(--cm-space-16); }
|
|
1393
1612
|
}
|
|
1394
|
-
`];$("cm-empty-state",
|
|
1613
|
+
`];$("cm-empty-state",ja);var hb={small:34,medium:40,large:50,xlarge:186},Ua=class extends S{constructor(){super(...arguments);this.variant="text";this.lines=1;this.size="large"}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-hidden","true")}render(){if(this.variant==="thumbnail"){let t=hb[this.size]??hb.large;return c`<span class="bone" part="bone" style="width:${t}px;height:${t}px"></span>`}if(this.variant==="block")return c`<span class="bone block" part="bone"></span>`;let e=Math.max(1,Math.floor(this.lines||1));return c`${Array.from({length:e},(t,i)=>c`<span class="bone line ${e>1&&i===e-1?"short":""}" part="bone"></span>`)}`}};Ua.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},Ua.styles=[k,x`
|
|
1395
1614
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
1396
1615
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
1397
1616
|
.bone {
|
|
@@ -1406,17 +1625,17 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1406
1625
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
1407
1626
|
}
|
|
1408
1627
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
1409
|
-
`];$("cm-skeleton",
|
|
1628
|
+
`];$("cm-skeleton",Ua);var fy=[472,90,90,251],vy=[94,266,134,191,138],Va=class extends T{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1}render(){let e=t=>t.map(i=>c`<span class="bone" style="height:${i}px"></span>`);return c`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
1410
1629
|
<span class="sr" role="status">${this.label}</span>
|
|
1411
1630
|
<div class="page" aria-hidden="true">
|
|
1412
1631
|
${this.navigation?c`<span class="bone nav"></span>`:h}
|
|
1413
1632
|
<span class="bone head"></span>
|
|
1414
1633
|
<div class="body">
|
|
1415
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
1416
|
-
<div class="col side">${e(
|
|
1634
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:fy)}</div>
|
|
1635
|
+
<div class="col side">${e(vy)}</div>
|
|
1417
1636
|
</div>
|
|
1418
1637
|
</div>
|
|
1419
|
-
</div>`}};
|
|
1638
|
+
</div>`}};Va.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},Va.styles=[k,x`
|
|
1420
1639
|
:host { display: block; }
|
|
1421
1640
|
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-8); }
|
|
1422
1641
|
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
@@ -1440,11 +1659,11 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1440
1659
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
1441
1660
|
.head { height: 60px; }
|
|
1442
1661
|
}
|
|
1443
|
-
`];$("cm-skeleton-display",
|
|
1662
|
+
`];$("cm-skeleton-display",Va);var p1=z("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),Yd,mb,Ka=class extends T{constructor(){super(...arguments);p(this,Yd);this.author="";this.datetime="";this.time=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-comment-box"&&this.setAttribute("role","listitem")}render(){let e=s(this,Yd,mb).call(this);return c`<article part="comment">
|
|
1444
1663
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
1445
1664
|
<div class="body" part="body"><slot></slot></div>
|
|
1446
1665
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
1447
|
-
</article>`}};
|
|
1666
|
+
</article>`}};Yd=new WeakSet,mb=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:ae(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},Ka.properties={author:{},datetime:{},time:{}},Ka.styles=[k,x`
|
|
1448
1667
|
:host { display: block; }
|
|
1449
1668
|
article {
|
|
1450
1669
|
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
@@ -1452,16 +1671,16 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1452
1671
|
}
|
|
1453
1672
|
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
1454
1673
|
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
1455
|
-
`];$("cm-comment",
|
|
1456
|
-
<div class="title" id="${r(this,
|
|
1674
|
+
`];$("cm-comment",Ka);var Ho,Xd,pb,Wa=class extends T{constructor(){super(...arguments);p(this,Xd);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;p(this,Ho,A("cm-comment-box"));this.hasComments=!1}submit(){let e=this.renderRoot.querySelector("textarea"),t=(e?.value??this.value).trim();if(this.disabled)return;if(!t){e?.focus();return}let i=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(i)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="comment-box" aria-labelledby="${r(this,Ho)}-h">
|
|
1675
|
+
<div class="title" id="${r(this,Ho)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1457
1676
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
1458
1677
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
1459
|
-
@keydown=${s(this,
|
|
1678
|
+
@keydown=${s(this,Xd,pb)}></textarea>
|
|
1460
1679
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
1461
1680
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
1462
1681
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
1463
1682
|
</div>
|
|
1464
|
-
</section>`}};
|
|
1683
|
+
</section>`}};Ho=new WeakMap,Xd=new WeakSet,pb=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},Wa.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Wa.styles=[k,x`
|
|
1465
1684
|
:host { display: block; }
|
|
1466
1685
|
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
1467
1686
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -1481,8 +1700,8 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1481
1700
|
|
|
1482
1701
|
.actions { justify-content: flex-end; }
|
|
1483
1702
|
}
|
|
1484
|
-
`];$("cm-comment-box",
|
|
1485
|
-
data-side=${this._side}>${this.content}</div>`}};
|
|
1703
|
+
`];$("cm-comment-box",Wa);var Jd='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',fe,Ya,Mi,Ti,Vt,Xa,Ja,je,vp,Zd,Qd,eh,th,Za,ub,hr,yp,xp,Kt,Ga=class extends S{constructor(){super(...arguments);p(this,je);this.content="";this.placement="top";this.delay=400;this.open=!1;this.visualOnly=!1;this._side="top";p(this,fe);p(this,Ya);p(this,Mi,[]);p(this,Ti);p(this,Vt);p(this,Xa,!1);p(this,Ja,!1);p(this,Zd,()=>{g(this,Xa,!0),clearTimeout(r(this,Vt)),this.open||g(this,Vt,setTimeout(()=>this.show(),this.delay))});p(this,Qd,()=>{g(this,Xa,!1),clearTimeout(r(this,Vt)),r(this,Ja)||this.hide()});p(this,eh,()=>{g(this,Ja,!0),this.show()});p(this,th,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(g(this,Ja,!1),r(this,Xa)||this.hide())});p(this,Za,e=>{e.key==="Escape"&&this.open&&this.hide()});p(this,hr,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(s(this,je,xp).call(this),!t||!this.content||this.visualOnly)return;let i=t.updateComplete;t.localName.includes("-")&&i&&!t.shadowRoot?.querySelector(Jd)&&i.then(()=>{t.shadowRoot?.querySelector(Jd)&&r(this,hr).call(this)}),r(this,fe)||(g(this,fe,document.createElement("span")),r(this,fe).id=A("cm-tooltip"),r(this,fe).hidden=!0,r(this,fe).slot="description"),r(this,fe).textContent=this.content,r(this,fe).isConnected||this.append(r(this,fe));let a=s(this,je,ub).call(this,t);if(g(this,Ya,a),a.getRootNode()===r(this,fe).getRootNode()){let l=(a.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);l.includes(r(this,fe).id)||a.setAttribute("aria-describedby",[...l,r(this,fe).id].join(" "))}else"ariaDescribedByElements"in a?(s(this,je,yp).call(this,a),g(this,Ti,new MutationObserver(()=>{a.getAttribute("aria-describedby")!==""&&s(this,je,yp).call(this,a)})),r(this,Ti).observe(a,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,fe).id)});p(this,Kt,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let a=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0]??this).getBoundingClientRect(),l=e.getBoundingClientRect(),d=8,m=8,u=innerWidth,v=innerHeight,b=getComputedStyle(this).direction==="rtl",w=W=>W==="start"?b?"right":"left":W==="end"?b?"left":"right":W,y={top:a.top-d-l.height>=m,bottom:a.bottom+d+l.height<=v-m,left:a.left-d-l.width>=m,right:a.right+d+l.width<=u-m},M={top:"bottom",bottom:"top",left:"right",right:"left"},D=w(this.placement);!y[D]&&y[M[D]]&&(D=M[D]);let H,q;D==="top"||D==="bottom"?(H=a.left+a.width/2-l.width/2,q=D==="top"?a.top-d-l.height:a.bottom+d):(q=a.top+a.height/2-l.height/2,H=D==="left"?a.left-d-l.width:a.right+d),H=Math.min(Math.max(m,H),u-m-l.width),q=Math.min(Math.max(m,q),v-m-l.height),e.style.transform=`translate(${Math.round(H)}px, ${Math.round(q)}px)`;let F={top:"top",bottom:"bottom",left:b?"end":"start",right:b?"start":"end"};this._side=F[D]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,Zd)),this.addEventListener("pointerleave",r(this,Qd)),this.addEventListener("focusin",r(this,eh)),this.addEventListener("focusout",r(this,th)),this.addEventListener("keydown",r(this,Za)),this.hasUpdated&&r(this,hr).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),s(this,je,xp).call(this),s(this,je,vp).call(this),clearTimeout(r(this,Vt))}show(){clearTimeout(r(this,Vt)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,Za),!0),addEventListener("scroll",r(this,Kt),!0),addEventListener("resize",r(this,Kt)),this.updateComplete.then(r(this,Kt)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,Vt)),this.open&&(this.open=!1,s(this,je,vp).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,hr).call(this),this.content?this.open&&r(this,Kt).call(this):this.hide())}render(){return c`<slot @slotchange=${r(this,hr)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1704
|
+
data-side=${this._side}>${this.content}</div>`}};fe=new WeakMap,Ya=new WeakMap,Mi=new WeakMap,Ti=new WeakMap,Vt=new WeakMap,Xa=new WeakMap,Ja=new WeakMap,je=new WeakSet,vp=function(){document.removeEventListener("keydown",r(this,Za),!0),removeEventListener("scroll",r(this,Kt),!0),removeEventListener("resize",r(this,Kt))},Zd=new WeakMap,Qd=new WeakMap,eh=new WeakMap,th=new WeakMap,Za=new WeakMap,ub=function(e){return e.matches(Jd)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(Jd)??e},hr=new WeakMap,yp=function(e){g(this,Mi,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),i=r(this,Mi).map(a=>t.getElementById(a)).filter(a=>!!a);e.ariaDescribedByElements=[...i,r(this,fe)]},xp=function(){let e=r(this,Ya);if(!(!e||!r(this,fe))){if(r(this,Ti))r(this,Ti).disconnect(),g(this,Ti,void 0),r(this,Mi).length?e.setAttribute("aria-describedby",r(this,Mi).join(" ")):e.removeAttribute("aria-describedby"),g(this,Mi,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(i=>i&&i!==r(this,fe).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,Ya,void 0)}},Kt=new WeakMap,Ga.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},Ga.styles=[k,x`
|
|
1486
1705
|
:host { display: inline-block; position: relative; }
|
|
1487
1706
|
.tip {
|
|
1488
1707
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -1499,22 +1718,22 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1499
1718
|
:host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
1500
1719
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1501
1720
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1502
|
-
`];$("cm-tooltip"
|
|
1721
|
+
`];$("cm-tooltip",Ga);var k1=z("timelineItem",{justNow:"Just now",minutesAgo:{one:"{count} minute ago",other:"{count} minutes ago"},hoursAgo:{one:"{count} hour ago",other:"{count} hours ago"},daysAgo:{one:"{count} day ago",other:"{count} days ago"},inMinutes:{one:"In {count} minute",other:"In {count} minutes"},inHours:{one:"In {count} hour",other:"In {count} hours"},inDays:{one:"In {count} day",other:"In {count} days"},showAll:"Show all",showLess:"Show less"}),E1=z("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),yy=7,No=new Set,Io;function gb(o,n){n?No.add(o):No.delete(o),No.size&&!Io&&(Io=setInterval(()=>No.forEach(e=>e.requestUpdate()),6e4)),!No.size&&Io&&(clearInterval(Io),Io=void 0)}var Po,pr,dt,wp,ih,bb,Qa=class extends T{constructor(){super(...arguments);p(this,dt);this.icon="";this.tone="neutral";this.heading="";this.datetime="";this.time="";this.meta="";this.lines=3;this.expanded=!1;this._overflow=!1;this._body=!1;this._meta=!1;this._actions=!1;p(this,Po,A("cm-tl"));p(this,pr)}connectedCallback(){super.connectedCallback(),gb(this,!0)}disconnectedCallback(){super.disconnectedCallback(),gb(this,!1),r(this,pr)?.disconnect(),g(this,pr,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(g(this,pr,new ResizeObserver(()=>s(this,dt,wp).call(this))),r(this,pr).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&s(this,dt,wp).call(this)}get date(){if(!this.datetime)return;let e=new Date(this.datetime);return Number.isNaN(e.getTime())?void 0:e}get relativeTime(){if(this.time)return this.time;let e=this.date;if(!e)return this.datetime;let t=Date.now()-e.getTime(),i=t<0,a=Math.floor(Math.abs(t)/6e4);if(a<1)return this.t("justNow");if(a<60)return this.t(i?"inMinutes":"minutesAgo",{count:a});let l=Math.floor(a/60);if(l<24)return this.t(i?"inHours":"hoursAgo",{count:l});let d=Math.floor(l/24);return d<yy?this.t(i?"inDays":"daysAgo",{count:d}):ae(e,{dateStyle:"medium"},this.locale)}get fullTime(){let e=this.date;return e?ae(e,{dateStyle:"full",timeStyle:"short"},this.locale):""}render(){let e=this.relativeTime,t=this.fullTime,i=this.tone&&this.tone!=="neutral"?this.tone:"",a=this.lines>0&&!this.expanded,l=e?t?c`<cm-tooltip class="when" content=${t} visual-only placement="top"><time part="time" tabindex="0" datetime=${this.datetime}>${e}<span class="sr">, ${t}</span></time></cm-tooltip>`:c`<time class="when" part="time" datetime=${this.datetime||h}>${e}</time>`:h;return c`<div class="item">
|
|
1503
1722
|
<span class="icon ${i}" part="icon" aria-hidden="true">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:c`<span class="dot"></span>`}</span>
|
|
1504
1723
|
<div class="main">
|
|
1505
1724
|
<div class="head">
|
|
1506
1725
|
<span class="title" part="title"><slot name="heading">${this.heading}</slot></span>
|
|
1507
1726
|
<slot name="badge"></slot>
|
|
1508
|
-
${
|
|
1727
|
+
${l}
|
|
1509
1728
|
</div>
|
|
1510
|
-
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,
|
|
1511
|
-
<div class="body ${a?"clamp":""}" id="${r(this,
|
|
1512
|
-
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,
|
|
1729
|
+
<div class="meta" part="meta" ?hidden=${!this.meta&&!this._meta}><slot name="meta" @slotchange=${d=>s(this,dt,ih).call(this,d,"_meta")}>${this.meta}</slot></div>
|
|
1730
|
+
<div class="body ${a?"clamp":""}" id="${r(this,Po)}-body" part="body" ?hidden=${!this._body}
|
|
1731
|
+
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>s(this,dt,ih).call(this,d,"_body")}></slot></div>
|
|
1513
1732
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
1514
|
-
aria-controls="${r(this,
|
|
1515
|
-
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,
|
|
1733
|
+
aria-controls="${r(this,Po)}-body" @click=${s(this,dt,bb)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
1734
|
+
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>s(this,dt,ih).call(this,d,"_actions")}></slot></div>
|
|
1516
1735
|
</div>
|
|
1517
|
-
</div>`}};
|
|
1736
|
+
</div>`}};Po=new WeakMap,pr=new WeakMap,dt=new WeakSet,wp=function(){let e=this.renderRoot.querySelector(".body");if(!e||!this._body||!(this.lines>0)){this._overflow=!1;return}let t=parseFloat(getComputedStyle(e).lineHeight)||20;this._overflow=e.scrollHeight>this.lines*t+1},ih=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(a=>a.nodeType===Node.ELEMENT_NODE||(a.textContent??"").trim())},bb=function(){this.expanded=!this.expanded},Qa.properties={icon:{reflect:!0},tone:{reflect:!0},heading:{},datetime:{reflect:!0},time:{},meta:{},lines:{type:Number},expanded:{type:Boolean,reflect:!0},_overflow:{state:!0},_body:{state:!0},_meta:{state:!0},_actions:{state:!0}},Qa.styles=[k,x`
|
|
1518
1737
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
1519
1738
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
1520
1739
|
.icon {
|
|
@@ -1550,16 +1769,16 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1550
1769
|
[hidden] { display: none !important; }
|
|
1551
1770
|
.sr { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1552
1771
|
::slotted([slot='badge']) { flex: none; }
|
|
1553
|
-
`];$("cm-timeline-item",
|
|
1772
|
+
`];$("cm-timeline-item",Qa);var Oo,es,ur,$p,fb,mr=class extends T{constructor(){super(...arguments);p(this,ur);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];p(this,Oo,new MutationObserver(()=>s(this,ur,$p).call(this)));p(this,es,!1)}connectedCallback(){super.connectedCallback(),s(this,ur,$p).call(this),r(this,Oo).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Oo).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){g(this,es,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach((i,a)=>{this._items[a]&&i.assign(this._items[a])});let t=this.renderRoot.querySelector("slot.empty");t&&t.assign(...this._empty),r(this,es)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,es,!1),this.renderRoot.querySelector("ol")?.focus())}render(){let e=this._items,t=this.loading,i=t&&!e.length?c`<div class="loading" aria-hidden="true">${[0,1,2].map(()=>c`<div class="sk">
|
|
1554
1773
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
1555
1774
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
1556
1775
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
1557
1776
|
</ol>`:h}
|
|
1558
1777
|
${i}
|
|
1559
1778
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
1560
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,
|
|
1779
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${s(this,ur,fb)}>${this.moreLabel}</cm-button></div>`:h}
|
|
1561
1780
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
1562
|
-
`}};
|
|
1781
|
+
`}};Oo=new WeakMap,es=new WeakMap,ur=new WeakSet,$p=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},fb=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},mr.shadowRootOptions={...S.shadowRootOptions,slotAssignment:"manual"},mr.properties={label:{string:"label"},hasMore:{type:Boolean,attribute:"has-more",reflect:!0},loading:{type:Boolean,reflect:!0},moreLabel:{attribute:"more-label",string:"showMore"},_items:{state:!0},_empty:{state:!0}},mr.styles=[k,x`
|
|
1563
1782
|
:host { display: block; }
|
|
1564
1783
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
1565
1784
|
ol:focus { outline: none; }
|
|
@@ -1582,14 +1801,14 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1582
1801
|
@media (max-width: 640px) {
|
|
1583
1802
|
.more { padding-inline-start: 0; }
|
|
1584
1803
|
}
|
|
1585
|
-
`];$("cm-timeline",
|
|
1804
|
+
`];$("cm-timeline",mr);var L1=z("smartTip",{newTab:"(opens in a new tab)"}),D1=z("smartTips",{heading:"Smart tips",tourAction:"Start"}),ts=class extends T{constructor(){super(...arguments);this.heading="";this.href="";this.target=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-smart-tips"&&this.setAttribute("role","listitem")}render(){let e=this.target==="_blank";return c`<a part="tip" href=${this.href||h} target=${this.target||h} rel=${e?"noopener noreferrer":h}>
|
|
1586
1805
|
<span class="text">
|
|
1587
1806
|
<span class="title" part="heading">${this.heading}</span>
|
|
1588
1807
|
<span class="desc" part="description"><slot></slot></span>
|
|
1589
1808
|
${e?c`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">${this.t("newTab")}</span>`:h}
|
|
1590
1809
|
</span>
|
|
1591
1810
|
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
1592
|
-
</a>`}};
|
|
1811
|
+
</a>`}};ts.properties={heading:{},href:{},target:{}},ts.styles=[k,x`
|
|
1593
1812
|
:host { display: block; }
|
|
1594
1813
|
a {
|
|
1595
1814
|
display: flex; align-items: flex-start; gap: var(--cm-space-8); padding: var(--cm-space-16);
|
|
@@ -1606,7 +1825,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1606
1825
|
}
|
|
1607
1826
|
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
1608
1827
|
a:hover .title { text-decoration: underline; }
|
|
1609
|
-
`];$("cm-smart-tip",
|
|
1828
|
+
`];$("cm-smart-tip",ts);var is=class extends T{constructor(){super(...arguments);this.tourHeading="";this.headingLevel=2}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<div class="card" part="smart-tips">
|
|
1610
1829
|
${this.tourHeading?c`<div class="tour" part="tour">
|
|
1611
1830
|
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="16"></cm-icon>
|
|
1612
1831
|
</span>
|
|
@@ -1617,7 +1836,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1617
1836
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1618
1837
|
<div class="list" role="list"><slot></slot></div>
|
|
1619
1838
|
</section>
|
|
1620
|
-
</div>`}};
|
|
1839
|
+
</div>`}};is.properties={heading:{string:"heading"},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action",string:"tourAction"},headingLevel:{type:Number,attribute:"heading-level"}},is.styles=[k,x`
|
|
1621
1840
|
:host { display: block; }
|
|
1622
1841
|
.card { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1623
1842
|
.tour {
|
|
@@ -1634,24 +1853,24 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1634
1853
|
margin: var(--cm-space-8) 0 var(--cm-space-16); text-align: center; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600;
|
|
1635
1854
|
}
|
|
1636
1855
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1637
|
-
`];$("cm-smart-tips",
|
|
1856
|
+
`];$("cm-smart-tips",is);var P1=z("pagination",{label:"Pagination",rows:"Number of rows",summary:"Showing {from}\u2013{to} of {total} {resource}",page:"Page",of:"of {count}",previous:"Previous page",next:"Next page"}),Wt,as,vb,yb,rs=class extends T{constructor(){super(...arguments);p(this,as);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;p(this,Wt,A("cm-pg"))}get pageCount(){return Math.max(1,Math.ceil((this.total||0)/Math.max(1,this.pageSize)))}goTo(e){let t=Math.min(this.pageCount,Math.max(1,Math.round(e)||1));if(this._draft=null,t===this.page){this.requestUpdate();return}this.page=t,this.dispatchEvent(new CustomEvent("cm-page-change",{detail:{page:t},bubbles:!0,composed:!0}))}render(){let e=this.pageCount,t=Math.min(e,Math.max(1,this.page)),i=this.total?(t-1)*this.pageSize+1:0,a=Math.min(this.total,t*this.pageSize),l=this.pageSizes??[];return c`
|
|
1638
1857
|
<nav part="bar" aria-label=${this.label}>
|
|
1639
|
-
${
|
|
1640
|
-
<label for="${r(this,
|
|
1641
|
-
<span class="field"><select id="${r(this,
|
|
1642
|
-
${(
|
|
1858
|
+
${l.length?c`<div class="rows" part="rows">
|
|
1859
|
+
<label for="${r(this,Wt)}-s">${this.t("rows")}</label>
|
|
1860
|
+
<span class="field"><select id="${r(this,Wt)}-s" @change=${s(this,as,vb)}>
|
|
1861
|
+
${(l.includes(this.pageSize)?l:[...l,this.pageSize].sort((d,m)=>d-m)).map(d=>c`<option value=${d} ?selected=${d===this.pageSize}>${d}</option>`)}
|
|
1643
1862
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
1644
1863
|
</div>`:h}
|
|
1645
1864
|
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:i,to:a,total:this.total,resource:this.resourceName}).replace(/\s+/g," ").trim():h}</div>
|
|
1646
1865
|
<div class="pages" part="pages">
|
|
1647
1866
|
<span class="counter">
|
|
1648
|
-
<label for="${r(this,
|
|
1649
|
-
<input id="${r(this,
|
|
1650
|
-
.value=${this._draft??String(t)} aria-describedby="${r(this,
|
|
1867
|
+
<label for="${r(this,Wt)}-p">${this.t("page")}</label>
|
|
1868
|
+
<input id="${r(this,Wt)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1869
|
+
.value=${this._draft??String(t)} aria-describedby="${r(this,Wt)}-of"
|
|
1651
1870
|
@input=${d=>this._draft=d.target.value}
|
|
1652
|
-
@keydown=${s(this,
|
|
1871
|
+
@keydown=${s(this,as,yb)}
|
|
1653
1872
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
1654
|
-
<span id="${r(this,
|
|
1873
|
+
<span id="${r(this,Wt)}-of">${this.t("of",{count:e})}</span>
|
|
1655
1874
|
</span>
|
|
1656
1875
|
<span class="arrows">
|
|
1657
1876
|
<button class="prev" type="button" part="previous" aria-label=${this.t("previous")} ?disabled=${t<=1}
|
|
@@ -1661,7 +1880,7 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1661
1880
|
</span>
|
|
1662
1881
|
</div>
|
|
1663
1882
|
</nav>
|
|
1664
|
-
`}};
|
|
1883
|
+
`}};Wt=new WeakMap,as=new WeakSet,vb=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})))},yb=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))},rs.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}},rs.styles=[k,x`
|
|
1665
1884
|
:host { display: block; }
|
|
1666
1885
|
nav {
|
|
1667
1886
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -1704,17 +1923,17 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1704
1923
|
select, input { height: var(--cm-control-height-touch); }
|
|
1705
1924
|
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
1706
1925
|
}
|
|
1707
|
-
`];$("cm-pagination",
|
|
1926
|
+
`];$("cm-pagination",rs);var V1=z("statusTabs",{label:"Status",option:"{label} ({count})"}),ns,Bo,me,qo,xb,kp,wb,Ep,$b,ss=class extends T{constructor(){super(...arguments);p(this,me);this.value="";this.tabs=[];this.controls="";this.size="large";this.mobile="scroll";this._more="";p(this,ns,new ResizeObserver(()=>s(this,me,qo).call(this)));this._slotted=[];p(this,Bo,new MutationObserver(()=>s(this,me,kp).call(this)))}connectedCallback(){super.connectedCallback(),s(this,me,kp).call(this),r(this,Bo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Bo).disconnect(),r(this,ns).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector(".tabs");r(this,ns).observe(e),e.addEventListener("scroll",()=>s(this,me,qo).call(this),{passive:!0}),document.fonts?.ready.then(()=>s(this,me,qo).call(this))}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){let t=this.renderRoot.querySelector(".pick select");t&&t.offsetParent!==null?t.focus(e):this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(e){s(this,me,qo).call(this);for(let a of this.renderRoot.querySelectorAll(".tabs > *"))r(this,ns).observe(a);if(!("ariaControlsElements"in Element.prototype))return;let t=this.getRootNode(),i=this.controls?t.getElementById?.(this.controls):null;for(let a of this.renderRoot.querySelectorAll("button, select"))a.ariaControlsElements=i?[i]:null}render(){let e=this.items,t=s(this,me,wb).call(this,e),i=this.getAttribute("aria-label")||this.t("label");return c`
|
|
1708
1927
|
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${i}>
|
|
1709
|
-
${e.map((a,
|
|
1710
|
-
tabindex=${
|
|
1711
|
-
@click=${()=>s(this,
|
|
1928
|
+
${e.map((a,l)=>c`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
1929
|
+
tabindex=${l===t?"0":"-1"} ?disabled=${!!a.disabled}
|
|
1930
|
+
@click=${()=>s(this,me,Ep).call(this,l)} @keydown=${d=>s(this,me,$b).call(this,d,l)}><span class="label" data-text=${a.label}>${a.label}</span>${a.count!==void 0&&!Number.isNaN(a.count)?c`<span class="sr">, </span><span class="count" part="count">${this.formatNumber(a.count)}</span>`:h}</button>`)}
|
|
1712
1931
|
</div>
|
|
1713
|
-
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,
|
|
1714
|
-
${e.map((a,
|
|
1932
|
+
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${s(this,me,xb)}>
|
|
1933
|
+
${e.map((a,l)=>c`<option value=${a.value} ?disabled=${!!a.disabled} ?selected=${l===t} .selected=${l===t}>${a.count!==void 0&&!Number.isNaN(a.count)?this.t("option",{label:a.label,count:a.count}):a.label}</option>`)}
|
|
1715
1934
|
</select><cm-icon name="chevron-down" size="16"></cm-icon></div>`:h}
|
|
1716
1935
|
<slot></slot>
|
|
1717
|
-
`}};
|
|
1936
|
+
`}};ns=new WeakMap,Bo=new WeakMap,me=new WeakSet,qo=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),a=t>1&&i>1,l=t>1&&i<t-1,d=a&&l?"both":a?"start":l?"end":"";d!==this._more&&(this._more=d)},xb=function(e){let t=e.target.value;t!==this.value&&(this.value=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},kp=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.getAttribute("count");return{value:t.value,label:t.label||t.textContent.trim(),count:i===null||i===""?void 0:Number(i),disabled:t.disabled}}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"")},wb=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},Ep=function(e){let t=this.items[e];!t||t.disabled||(this.updateComplete.then(()=>{let i=this.renderRoot.querySelectorAll("button")[e];i?.focus(),i?.scrollIntoView?.({block:"nearest",inline:"nearest"})}),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},$b=function(e,t){let i=J(e,this),a=this.items.flatMap((m,u)=>m.disabled?[]:[u]),l=a.indexOf(t),d;if(i==="ArrowRight")d=a[(l+1)%a.length];else if(i==="ArrowLeft")d=a[(l-1+a.length)%a.length];else if(e.key==="Home")d=a[0];else if(e.key==="End")d=a[a.length-1];else return;e.preventDefault(),d!==void 0&&s(this,me,Ep).call(this,d)},ss.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},mobile:{reflect:!0},_slotted:{state:!0},_more:{state:!0}},ss.styles=[k,x`
|
|
1718
1937
|
:host { display: block; }
|
|
1719
1938
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
1720
1939
|
.tabs {
|
|
@@ -1773,20 +1992,20 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1773
1992
|
:host([mobile='select']) .tabs { display: none; }
|
|
1774
1993
|
:host([mobile='select']) .pick { display: block; }
|
|
1775
1994
|
}
|
|
1776
|
-
`];$("cm-status-tabs",
|
|
1995
|
+
`];$("cm-status-tabs",ss);var Z1=z("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),rh,Fo,Gt,Mp,kb,Eb,os=class extends T{constructor(){super(...arguments);p(this,Gt);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;p(this,rh,A("cm-th"));p(this,Fo,new MutationObserver(()=>s(this,Gt,Mp).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),s(this,Gt,Mp).call(this),r(this,Fo).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Fo).disconnect()}get items(){return this.columns.length?this.columns.map(e=>typeof e=="string"?{key:e,label:e}:{...e,key:e.key??e.label}):this._slotted}render(){let e=this._inTable,t=this.items;return c`
|
|
1777
1996
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
1778
1997
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
1779
1998
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
1780
|
-
<input id="${r(this,
|
|
1781
|
-
@change=${s(this,
|
|
1999
|
+
<input id="${r(this,rh)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
2000
|
+
@change=${s(this,Gt,Eb)} />
|
|
1782
2001
|
<span class="box" aria-hidden="true">${this.indeterminate?c`<span class="dash"></span>`:this.checked?c`<cm-icon name="check" size="14"></cm-icon>`:h}</span>
|
|
1783
2002
|
</span></span>`:h}
|
|
1784
|
-
${t.map(i=>{let a=this.sort===i.key,
|
|
1785
|
-
aria-sort=${e&&i.sortable?
|
|
2003
|
+
${t.map(i=>{let a=this.sort===i.key,l=a?this.direction==="descending"?"descending":"ascending":"none",d=i.hidden?c`<span class="sr">${i.label}</span>`:i.label;return c`<span class="cell" part="cell" data-align=${i.align??"start"} role=${e?"columnheader":h}
|
|
2004
|
+
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${a?"on":""} @click=${()=>s(this,Gt,kb).call(this,i)}>${d}${e?h:c`<span class="sr">${a?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
1786
2005
|
name=${a&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
1787
2006
|
</div>
|
|
1788
2007
|
<slot></slot>
|
|
1789
|
-
`}};
|
|
2008
|
+
`}};rh=new WeakMap,Fo=new WeakMap,Gt=new WeakSet,Mp=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"}})},kb=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}))},Eb=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}))},os.properties={columns:{type:Array},sort:{reflect:!0},direction:{reflect:!0},selectable:{type:Boolean,reflect:!0},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean,reflect:!0},resourceRows:{attribute:"resource-rows",reflect:!0},_slotted:{state:!0},_inTable:{state:!0}},os.styles=[k,x`
|
|
1790
2009
|
:host { display: block; }
|
|
1791
2010
|
slot { display: none; } /* <option> children are column data, not content */
|
|
1792
2011
|
.bar {
|
|
@@ -1838,10 +2057,10 @@ var _m=l=>{throw TypeError(l)};var Wd=(l,n,e)=>n.has(l)||_m("Cannot "+e);var r=(
|
|
|
1838
2057
|
:host([resource-rows='selectable']) .bar:not(.sel) { padding-inline-start: calc(var(--_rl) + 20px + var(--cm-space-8)); }
|
|
1839
2058
|
:host([resource-rows]) .bar.sel { grid-template-columns: calc(20px + var(--cm-space-8) - var(--cm-space-20)) var(--cm-table-columns, var(--_cols)); }
|
|
1840
2059
|
}
|
|
1841
|
-
`];$("cm-table-header",
|
|
2060
|
+
`];$("cm-table-header",os);var xy=`
|
|
1842
2061
|
[data-cm-density="compact"] { --cm-table-row-height: 40px; --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
1843
2062
|
[data-cm-density="comfortable"] { --cm-table-row-height: 48px; --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
|
|
1844
|
-
`,
|
|
2063
|
+
`,ah=null,Mb=new WeakSet;function sh(o){if(typeof document>"u"||typeof CSSStyleSheet>"u")return;let n=[document],e=o.getRootNode();e instanceof ShadowRoot&&n.push(e);for(let t of n)if(!Mb.has(t)){Mb.add(t);try{ah||(ah=new CSSStyleSheet,ah.replaceSync(xy)),t.adoptedStyleSheets=[...t.adoptedStyleSheets,ah]}catch{}}}var nk=z("dataTable",{empty:"No data",sorted:"Sorted by {column}, {direction}",scrollHint:"Scroll for more",columns:"Columns",showColumns:"Show columns",resize:"Resize {column} column",resized:"{column} column, {width} pixels wide",viewAll:"View all fields",viewLess:"Hide fields",rowAction:"{action}, {name}"}),Tb=48,zb=16,_b=!1,wy=`
|
|
1845
2064
|
cm-data-table > table { width: 100%; border-collapse: separate; border-spacing: 0; font: inherit; font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); font-variant-numeric: tabular-nums; color: var(--cm-text-default); }
|
|
1846
2065
|
cm-data-table > table caption { text-align: start; font-weight: 600; font-size: var(--cm-font-size-16); line-height: var(--cm-line-height-16); padding-block-end: var(--cm-space-8); }
|
|
1847
2066
|
cm-data-table > table th, cm-data-table > table td { box-sizing: border-box; }
|
|
@@ -1864,6 +2083,10 @@ cm-data-table > table th > button.cm-sort:focus-visible { outline: 2px solid var
|
|
|
1864
2083
|
cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-data-table > table [data-type='money'], cm-data-table > table [data-type='actions'] { text-align: end; font-variant-numeric: tabular-nums; }
|
|
1865
2084
|
cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-data-table > table [data-type='money'], cm-data-table > table [data-type='date'] { white-space: nowrap; }
|
|
1866
2085
|
cm-data-table > table [data-type='actions'] { width: 1%; white-space: nowrap; }
|
|
2086
|
+
cm-data-table > table td [data-lines] { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
|
|
2087
|
+
cm-data-table > table td [data-lines='1'] { display: block; white-space: nowrap; text-overflow: ellipsis; overflow-wrap: normal; max-inline-size: var(--cm-data-table-cell-max-width, 320px); }
|
|
2088
|
+
cm-data-table > table td [data-lines='3'] { -webkit-line-clamp: 3; line-clamp: 3; }
|
|
2089
|
+
cm-data-table > table td [data-lines='4'] { -webkit-line-clamp: 4; line-clamp: 4; }
|
|
1867
2090
|
cm-data-table > table tbody td[data-type='actions'] { padding-block: 0; }
|
|
1868
2091
|
cm-data-table > table td[data-type='actions'] > * + * { margin-inline-start: var(--cm-space-8); }
|
|
1869
2092
|
cm-data-table:not([row-actions='always']) > table tbody tr:not(:hover):not(:focus-within) td[data-type='actions'] > * { opacity: 0; }
|
|
@@ -1884,52 +2107,52 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
1884
2107
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
|
|
1885
2108
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
|
|
1886
2109
|
}
|
|
1887
|
-
`;function
|
|
2110
|
+
`;function $y(){if(_b||typeof document>"u")return;_b=!0;let o=new CSSStyleSheet;o.replaceSync(wy),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var jo=o=>o.type==="numeric"||o.type==="money",ky=o=>(o.align??(jo(o)||o.type==="actions"?"end":"start"))==="end",Ey=o=>!o.type||o.type==="text";function Cb(o){if(typeof o=="number")return o;let n=String(o??"").trim(),e=/^\(.*\)$/.test(n)||/^-|^[^\d]*-\s*\d/.test(n),t=n.match(/\d[\d,]*(?:\.\d+)?/);if(!t)return NaN;let i=Number(t[0].replace(/,/g,""));return e?-i:i}var Sb=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),Lb=new Map;function My(o){let n=Lb.get(o??"");if(!n){try{n=new Intl.Collator(o,{numeric:!0,sensitivity:"base"})}catch{n=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"})}Lb.set(o??"",n)}return n}function Db(o,n,e,t){let i=a=>a==null||a==="";return i(o)||i(n)?i(o)===i(n)?0:i(o)?1:-1:e==="numeric"||e==="money"?(Cb(o)||0)-(Cb(n)||0):e==="date"?(Sb(o)||0)-(Sb(n)||0):My(t).compare(String(o),String(n))}var Ab=o=>o.parentElement??o.getRootNode().host??null,ps,us,Uo,gs,gr,bs,br,dh,_,Tp,zp,_p,Rb,Cp,Hb,Nb,Ib,fr,ls,cs,nh,ds,hs,oh,Sp,Lp,Dp,Pb,Ob,Ap,Rp,lh,qb,Bb,Fb,ch,fs,jb,Ub,Vb,Kb,Wb,Gb,Yb,ms=class extends T{constructor(){super(...arguments);p(this,_);this.columns=[];this.rows=[];this.totals=null;this.caption="";this.captionHidden=!1;this.sort="";this.direction="ascending";this.sortMode="auto";this.stickyHeader=!1;this.stickyFirstColumn=!1;this.loading=!1;this.loadingRows=5;this.mobile="scroll";this.rowActions="hover";this.resizable=!1;this.columnPicker=!1;this._light=!1;this._announce="";this._widths={};this._expanded=new Set;this._picker=!1;this._overflows=!1;p(this,ps,!1);p(this,us,A("cm-dt"));p(this,Uo,new MutationObserver(()=>s(this,_,Tp).call(this)));p(this,gs,typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s(this,_,ls).call(this)));p(this,gr,[]);p(this,bs,0);p(this,br,-1);p(this,dh,e=>{e.target?.closest?.("[data-lines]")&&s(this,_,oh).call(this,e)});p(this,fr,()=>{r(this,bs)||!this.stickyHeader||g(this,bs,requestAnimationFrame(()=>{g(this,bs,0),s(this,_,ls).call(this)}))});p(this,fs,e=>{let t=this.renderRoot.querySelector(".tools");t&&!e.composedPath().includes(t)&&s(this,_,ch).call(this,!1)})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerover",r(this,dh)),sh(this),s(this,_,Tp).call(this),r(this,Uo).observe(this,{childList:!0,subtree:!0}),document.addEventListener("scroll",r(this,fr),{capture:!0,passive:!0}),window.addEventListener("resize",r(this,fr),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Uo).disconnect(),r(this,gs)?.disconnect(),g(this,gr,[]),document.removeEventListener("scroll",r(this,fr),{capture:!0}),window.removeEventListener("resize",r(this,fr)),document.removeEventListener("pointerdown",r(this,fs),{capture:!0})}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(a=>a.key===this.sort);if(!t||this.sortMode==="manual")return e;let i=this.direction==="descending"?-1:1;return e.map((a,l)=>[a,l]).sort(([a,l],[d,m])=>{let u=a[t.key],v=d[t.key],b=u==null||u==="",w=v==null||v==="";return b||w?b===w?l-m:b?1:-1:i*Db(u,v,t.type,this.locale)||l-m}).map(([a])=>a)}get visibleColumns(){return(this.columns??[]).filter(e=>e.visible!==!1)}updated(e){if(r(this,ps)&&(e.has("sort")||e.has("direction"))&&this.sort){g(this,ps,!1);let t=this.columns.find(i=>i.key===this.sort);t&&s(this,_,_p).call(this,t.label,this.direction)}if(e.has("columns")){let t=e.get("columns")??[],i={...this._widths},a=!1;for(let l of this.columns??[]){let d=t.find(m=>m.key===l.key);l.width!==void 0&&d?.width!==l.width&&i[l.key]!==void 0&&(delete i[l.key],a=!0)}a&&(this._widths=i)}s(this,_,Ib).call(this),s(this,_,ls).call(this)}render(){let e=c`<span class="sr" role="status">${this._announce}</span>`,t=c`<p class="hint" part="scroll-hint" aria-hidden="true">${this.t("scrollHint")}<cm-icon name="chevron-right" size="16"></cm-icon></p>`,i=c`<span class="fade s" aria-hidden="true"></span><span class="fade e" aria-hidden="true"></span>`,a=this.stickyHeader||this.stickyFirstColumn||this._overflows;if(this._light)return c`<div class="frame" part="frame"><div class="wrap"><div class="scroll" part="scroll" tabindex=${this._overflows?"0":h}
|
|
1888
2111
|
role=${this._overflows?"region":h} aria-label=${this._overflows?this.querySelector("caption")?.textContent?.trim()||h:h}
|
|
1889
|
-
@scroll=${()=>s(this,
|
|
2112
|
+
@scroll=${()=>s(this,_,ls).call(this)}><slot></slot></div>${i}</div>${t}</div>${e}`;let l=this.visibleColumns,d=s(this,_,Lp).call(this,l),m=this.mobile==="priority"?l.filter(y=>y.priority==="low"&&y!==d):[],u=this.sortedRows,v=Math.max(1,l.length),b=!this.loading&&u.length===0,w=this.mobile==="cards"&&!this.loading&&u.length>0;return c`
|
|
1890
2113
|
<div class="frame" part="frame" ?data-cards=${w}>
|
|
1891
|
-
${this.columnPicker?s(this,
|
|
2114
|
+
${this.columnPicker?s(this,_,Vb).call(this):h}
|
|
1892
2115
|
<div class="wrap">
|
|
1893
2116
|
<div class="scroll" part="scroll" tabindex=${a?"0":h}
|
|
1894
2117
|
role=${a?"region":h}
|
|
1895
|
-
aria-label=${a&&this.caption?this.caption:h} @scroll=${()=>s(this,
|
|
1896
|
-
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,
|
|
1897
|
-
@focusout=${s(this,
|
|
2118
|
+
aria-label=${a&&this.caption?this.caption:h} @scroll=${()=>s(this,_,ls).call(this)}>
|
|
2119
|
+
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${s(this,_,oh)} @focusin=${s(this,_,Sp)}
|
|
2120
|
+
@focusout=${s(this,_,Sp)}>
|
|
1898
2121
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
1899
|
-
<thead><tr>${
|
|
2122
|
+
<thead><tr>${l.map(y=>s(this,_,Kb).call(this,y,d))}</tr></thead>
|
|
1900
2123
|
<tbody>
|
|
1901
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${
|
|
1902
|
-
${
|
|
2124
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(y=>c`<td class=${s(this,_,ds).call(this,y,d)} style=${s(this,_,hs).call(this,y)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((y,M)=>s(this,_,Wb).call(this,y,l,d,m,M))}
|
|
2125
|
+
${b?c`<tr class="empty"><td colspan=${v}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
1903
2126
|
</tbody>
|
|
1904
|
-
${this.totals&&!this.loading&&!
|
|
2127
|
+
${this.totals&&!this.loading&&!b?c`<tfoot><tr part="totals">${l.map(y=>c`<td class=${s(this,_,ds).call(this,y,d)} style=${s(this,_,hs).call(this,y)}>${y.type==="actions"?h:s(this,_,cs).call(this,this.totals[y.key])}</td>`)}</tr></tfoot>`:h}
|
|
1905
2128
|
</table>
|
|
1906
2129
|
</div>
|
|
1907
2130
|
${i}
|
|
1908
2131
|
</div>
|
|
1909
2132
|
${t}
|
|
1910
|
-
${w?s(this,
|
|
2133
|
+
${w?s(this,_,Yb).call(this,u,l,d):h}
|
|
1911
2134
|
</div>${e}
|
|
1912
|
-
`}};
|
|
2135
|
+
`}};ps=new WeakMap,us=new WeakMap,Uo=new WeakMap,gs=new WeakMap,gr=new WeakMap,bs=new WeakMap,br=new WeakMap,dh=new WeakMap,_=new WeakSet,Tp=function(){this._light=!!this.querySelector(":scope > table"),this._light&&($y(),s(this,_,Rb).call(this))},zp=function(e){this._announce=this._announce===e?`${e}\xA0`:e},_p=function(e,t){s(this,_,zp).call(this,this.t("sorted",{column:e,direction:this.t(t)}))},Rb=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;if(!t)return;let i=[...t];i.forEach((a,l)=>{if(!a.dataset.sort||a.querySelector(":scope > button.cm-sort"))return;a.dataset.type=a.dataset.sort;let d=document.createElement("button");d.type="button",d.className="cm-sort",d.append(...a.childNodes);let m=document.createElement("cm-icon");m.setAttribute("size","12"),d.append(m),a.append(d),a.hasAttribute("aria-sort")||a.setAttribute("aria-sort","none"),s(this,_,Cp).call(this,a),d.addEventListener("click",()=>s(this,_,Hb).call(this,e,a,l))});for(let a of[...e.tBodies,...e.tFoot?[e.tFoot]:[]])for(let l of a.rows)[...l.cells].forEach((d,m)=>{let u=i[m];u&&(d.dataset.label||(d.dataset.label=(u.textContent??"").trim()),u.dataset.priority&&!d.dataset.priority&&(d.dataset.priority=u.dataset.priority),u.dataset.type==="actions"&&!d.dataset.type&&(d.dataset.type="actions"))})},Cp=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Hb=function(e,t,i){let a=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),l=t.dataset.key||a,d=t.getAttribute("aria-sort")==="ascending"?"descending":"ascending",m=new CustomEvent("cm-sort",{detail:{key:l,direction:d},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(m)||this.sortMode==="manual")return;let u=t.dataset.sort,v=d==="descending"?-1:1;for(let b of e.tBodies){let w=M=>{let D=M.cells[i];return D?(D.dataset.value??D.textContent??"").trim():""},y=[...b.rows].map((M,D)=>[M,w(M),D]).sort(([,M,D],[,H,q])=>M===""||H===""?M===H?D-q:M===""?1:-1:v*Db(M,H,u,this.locale)||D-q);b.append(...y.map(([M])=>M))}for(let b of e.tHead.rows[0].cells)b.dataset.sort&&(b.setAttribute("aria-sort",b===t?d:"none"),s(this,_,Cp).call(this,b));s(this,_,_p).call(this,a,d)},Nb=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",i=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),a=this.dispatchEvent(i);g(this,ps,a),a&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},Ib=function(){let e=[this.renderRoot.querySelector(".scroll"),this.renderRoot.querySelector("table")??this.querySelector(":scope > table")].filter(Boolean);e.length===r(this,gr).length&&e.every((t,i)=>t===r(this,gr)[i])||(r(this,gs)?.disconnect(),e.forEach(t=>r(this,gs)?.observe(t)),g(this,gr,e))},fr=new WeakMap,ls=function(){let e=this.renderRoot?.querySelector(".scroll"),t=this.renderRoot?.querySelector(".frame");if(!e||!t)return;let i=getComputedStyle(e).maxBlockSize!=="none",a=e.scrollWidth>e.clientWidth+1;a!==this._overflows&&(this._overflows=a),e.toggleAttribute("data-open",this.stickyHeader&&!i&&!a);let l=Math.abs(e.scrollLeft);t.toggleAttribute("data-more-start",a&&l>1),t.toggleAttribute("data-more-end",a&&l+e.clientWidth<e.scrollWidth-1);let d=this.renderRoot.querySelector("caption")??this.querySelector(":scope > table > caption"),m=d&&getComputedStyle(d).position!=="absolute"?`${d.offsetHeight}px`:"";e.parentElement.style.getPropertyValue("--_cap")!==m&&e.parentElement.style.setProperty("--_cap",m);let u=0,v=this.renderRoot.querySelector("table")??this.querySelector(":scope > table"),b=v?.tHead;if(this.stickyHeader&&!i&&a&&v&&b){let w=r(this,br)>0?r(this,br):0,y=b.getBoundingClientRect().top-w,M=v.getBoundingClientRect().bottom-w,D=0;for(let H=Ab(this);H&&H!==document.documentElement&&H!==document.body;H=Ab(H)){let q=getComputedStyle(H);/(auto|scroll|overlay|hidden|clip)/.test(q.overflowY)&&(D=Math.max(D,H.getBoundingClientRect().top+H.clientTop+(parseFloat(q.paddingTop)||0)))}D+=parseFloat(getComputedStyle(this).getPropertyValue("--cm-data-table-sticky-top"))||0,u=Math.max(0,Math.min(D-y,M-y-b.getBoundingClientRect().height))}for(let w of this.renderRoot.querySelectorAll(".rz")){let y=String(Math.round(w.closest("th").getBoundingClientRect().width));w.getAttribute("aria-valuenow")!==y&&w.setAttribute("aria-valuenow",y)}u!==r(this,br)&&(g(this,br,u),u?e.style.setProperty("--_shift",`${u}px`):e.style.removeProperty("--_shift"))},cs=function(e){return e==null?"":e instanceof Date?ae(e,{},this.locale):String(e)},nh=function(e){return this._widths[e.key]??e.width},ds=function(e,t){return[ky(e)&&"end",jo(e)&&"num",(jo(e)||e.type==="date")&&"nw",e.type==="actions"&&"act",e.priority==="low"&&e!==t&&"low",s(this,_,nh).call(this,e)!==void 0&&"w"].filter(Boolean).join(" ")},hs=function(e){let t=s(this,_,nh).call(this,e);return t===void 0?h:`--_w: ${t}px`},oh=function(e){let t=e.composedPath()[0]?.closest?.("[data-lines]");if(t&&this.contains(t)){t.scrollWidth>t.clientWidth+1||t.scrollHeight>t.clientHeight+1?t.title=t.textContent?.trim()??"":t.removeAttribute("title");return}let i=e.composedPath()[0]?.closest?.(".t");i&&(i.scrollWidth>i.clientWidth+1||i.scrollHeight>i.clientHeight+1?i.title=i.textContent??"":i.removeAttribute("title"))},Sp=function(e){e.type==="focusin"&&s(this,_,oh).call(this,e);let t=e.composedPath().find(a=>a instanceof HTMLTableRowElement);if(!t)return;let i=e.type==="focusin"||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget);t.toggleAttribute("data-focus",i)},Lp=function(e){return e.find(t=>t.primary)??e.find(t=>t.type!=="actions")??e[0]},Dp=function(e,t){return t?s(this,_,cs).call(this,e[t.key]):""},Pb=function(e,t){let i=t[e.key];return Array.isArray(i)?i:e.actions??[]},Ob=function(e,t){let i=(this.rows??[]).indexOf(t);this.dispatchEvent(new CustomEvent("cm-row-action",{detail:{action:e.value??e.label,row:t,index:i},bubbles:!0,composed:!0}))},Ap=function(e,t,i){return c`<span class="acts">${s(this,_,Pb).call(this,e,t).map(a=>c`<cm-button size="slim" icon=${a.icon??h}
|
|
1913
2136
|
?icon-only=${!!a.iconOnly} label=${a.iconOnly?this.t("rowAction",{action:a.label,name:i}):h} tone=${a.tone??h}
|
|
1914
|
-
@click=${()=>s(this,
|
|
1915
|
-
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,
|
|
1916
|
-
@click=${()=>s(this,
|
|
1917
|
-
<fieldset class="panel" id="${r(this,
|
|
2137
|
+
@click=${()=>s(this,_,Ob).call(this,a,t)}>${a.label}${a.iconOnly||!i?h:c`<span class="sr">, ${i}</span>`}</cm-button>`)}</span>`},Rp=function(e,t,i){if(e.type==="actions")return s(this,_,Ap).call(this,e,t,i);let a=s(this,_,cs).call(this,t[e.key]);if(!Ey(e))return a;let l=Math.trunc(Number(e.lines))||0;return l>1?c`<span class="t lines" style="--_lines: ${l}">${a}</span>`:c`<span class="t">${a}</span>`},lh=function(e,t,i){let a=Math.max(Tb,Math.round(t));this._widths={...this._widths,[e.key]:a},i&&(s(this,_,zp).call(this,this.t("resized",{column:e.label,width:a})),this.dispatchEvent(new CustomEvent("cm-column-resize",{detail:{key:e.key,width:a},bubbles:!0,composed:!0})))},qb=function(e,t){return s(this,_,nh).call(this,e)??Math.round(t.closest("th").getBoundingClientRect().width)},Bb=function(e,t){let i=J(e,this);i!=="ArrowLeft"&&i!=="ArrowRight"||(e.preventDefault(),s(this,_,lh).call(this,t,s(this,_,qb).call(this,t,e.currentTarget)+(i==="ArrowRight"?zb:-zb),!0))},Fb=function(e,t){if(e.button!==0)return;e.preventDefault();let i=e.currentTarget,a=i.closest("th").getBoundingClientRect().width,l=e.clientX,d=getComputedStyle(this).direction==="rtl";try{i.setPointerCapture(e.pointerId)}catch{}i.setAttribute("data-dragging","");let m=a,u=b=>{m=a+(b.clientX-l)*(d?-1:1),s(this,_,lh).call(this,t,m,!1)},v=()=>{i.removeEventListener("pointermove",u),i.removeEventListener("pointerup",v),i.removeEventListener("pointercancel",v),i.removeAttribute("data-dragging"),s(this,_,lh).call(this,t,m,!0)};i.addEventListener("pointermove",u),i.addEventListener("pointerup",v),i.addEventListener("pointercancel",v)},ch=function(e=!this._picker){this._picker=e,e?document.addEventListener("pointerdown",r(this,fs),{capture:!0}):document.removeEventListener("pointerdown",r(this,fs),{capture:!0})},fs=new WeakMap,jb=function(e){e.key!=="Escape"||!this._picker||(e.stopPropagation(),s(this,_,ch).call(this,!1),this.renderRoot.querySelector(".pick")?.focus())},Ub=function(e,t){let i=this.columns.map(a=>a.key===e?{...a,visible:t}:a);this.columns=i,this.dispatchEvent(new CustomEvent("cm-columns-change",{detail:{key:e,visible:t,columns:i},bubbles:!0,composed:!0}))},Vb=function(){let e=this.columns??[],t=s(this,_,Lp).call(this,this.visibleColumns);return c`<div class="tools" part="tools" @keydown=${s(this,_,jb)}>
|
|
2138
|
+
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,us)}-cols"
|
|
2139
|
+
@click=${()=>s(this,_,ch).call(this)}>${this.t("columns")}<cm-icon name="chevron-down" size="16" aria-hidden="true"></cm-icon></button>
|
|
2140
|
+
<fieldset class="panel" id="${r(this,us)}-cols" part="column-panel" ?hidden=${!this._picker}>
|
|
1918
2141
|
<legend class="sr">${this.t("showColumns")}</legend>
|
|
1919
2142
|
${e.map(i=>c`<label class="opt"><input type="checkbox" .checked=${i.visible!==!1} ?disabled=${i===t}
|
|
1920
|
-
@change=${a=>s(this,
|
|
2143
|
+
@change=${a=>s(this,_,Ub).call(this,i.key,a.target.checked)} />${i.label}</label>`)}
|
|
1921
2144
|
</fieldset>
|
|
1922
|
-
</div>`},
|
|
2145
|
+
</div>`},Kb=function(e,t){let i=this.sort===e.key,a=i?this.direction:"none",d=e.hidden||e.type==="actions"?c`<span class="sr">${e.label}</span>`:c`<span class="t">${e.label}</span>`;return c`<th scope="col" class=${s(this,_,ds).call(this,e,t)} style=${s(this,_,hs).call(this,e)} aria-sort=${e.sortable?a:h}><div class="h">${e.sortable?c`<button type="button" class="sort ${i?"on":""}" @click=${()=>s(this,_,Nb).call(this,e)}>${d}<cm-icon
|
|
1923
2146
|
name=${i&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}${this.resizable&&e.type!=="actions"?c`<span class="rz" part="resize-handle" role="separator" aria-orientation="vertical" tabindex="0" aria-label=${this.t("resize",{column:e.label})}
|
|
1924
|
-
aria-valuemin=${
|
|
1925
|
-
@keydown=${
|
|
1926
|
-
@click=${()=>s(this,
|
|
1927
|
-
<dl class="pairs">${a.map(
|
|
2147
|
+
aria-valuemin=${Tb} aria-valuemax="1600"
|
|
2148
|
+
@keydown=${m=>s(this,_,Bb).call(this,m,e)} @pointerdown=${m=>s(this,_,Fb).call(this,m,e)}></span>`:h}</div></th>`},Wb=function(e,t,i,a,l){let d=s(this,_,Dp).call(this,e,i),m=this._expanded.has(e),u=`${r(this,us)}-more-${l}`,v=c`<tr part="row">${t.map(b=>b===i?c`<th scope="row" class=${s(this,_,ds).call(this,b,i)} style=${s(this,_,hs).call(this,b)} part="cell">${s(this,_,Rp).call(this,b,e,d)}${a.length?c`<button type="button" class="more-btn" aria-expanded=${m?"true":"false"} aria-controls=${u}
|
|
2149
|
+
@click=${()=>s(this,_,Gb).call(this,e)}>${this.t(m?"viewLess":"viewAll")}</button>`:h}</th>`:c`<td class=${s(this,_,ds).call(this,b,i)} style=${s(this,_,hs).call(this,b)} part="cell">${s(this,_,Rp).call(this,b,e,d)}</td>`)}</tr>`;return c`${v}${a.length&&m?c`<tr class="more" id=${u} part="row-details"><td colspan=${t.length-a.length}>
|
|
2150
|
+
<dl class="pairs">${a.map(b=>c`<dt>${b.label}</dt><dd class=${jo(b)?"num":""}>${s(this,_,cs).call(this,e[b.key])}</dd>`)}</dl></td></tr>`:h}`},Gb=function(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t},Yb=function(e,t,i){let a=t.filter(m=>m!==i&&m.type!=="actions"),l=t.filter(m=>m.type==="actions"),d=(m,u=!1)=>{let v=s(this,_,Dp).call(this,m,i);return c`<li class="card ${u?"total":""}" part="card">
|
|
1928
2151
|
<p class="card-title">${v}</p>
|
|
1929
|
-
${a.length?c`<dl class="pairs">${a.map(
|
|
1930
|
-
${!u&&
|
|
2152
|
+
${a.length?c`<dl class="pairs">${a.map(b=>c`<dt>${b.label}</dt><dd class=${jo(b)?"num":""}>${s(this,_,cs).call(this,m[b.key])}</dd>`)}</dl>`:h}
|
|
2153
|
+
${!u&&l.length?c`<div class="card-actions">${l.map(b=>s(this,_,Ap).call(this,b,m,v))}</div>`:h}
|
|
1931
2154
|
</li>`};return c`${this.caption?c`<p class="cards-caption" aria-hidden="true">${this.caption}</p>`:h}
|
|
1932
|
-
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(
|
|
2155
|
+
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(m=>d(m))}${this.totals?d(this.totals,!0):h}</ul>`},ms.properties={columns:{type:Array},rows:{type:Array},totals:{type:Object},caption:{},captionHidden:{type:Boolean,attribute:"caption-hidden",reflect:!0},sort:{reflect:!0},direction:{reflect:!0},sortMode:{attribute:"sort-mode",reflect:!0},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0},stickyFirstColumn:{type:Boolean,attribute:"sticky-first-column",reflect:!0},loading:{type:Boolean,reflect:!0},loadingRows:{type:Number,attribute:"loading-rows"},density:{reflect:!0},mobile:{reflect:!0},rowActions:{attribute:"row-actions",reflect:!0},resizable:{type:Boolean,reflect:!0},columnPicker:{type:Boolean,attribute:"column-picker",reflect:!0},_light:{state:!0},_announce:{state:!0},_widths:{state:!0},_expanded:{state:!0},_picker:{state:!0},_overflows:{state:!0}},ms.styles=[k,x`
|
|
1933
2156
|
:host { display: block; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
1934
2157
|
:host([density='compact']) { --cm-table-row-height: 40px; }
|
|
1935
2158
|
:host([density='comfortable']) { --cm-table-row-height: 48px; }
|
|
@@ -1980,6 +2203,8 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
1980
2203
|
.w { inline-size: var(--_w); min-inline-size: var(--_w); max-inline-size: var(--_w); }
|
|
1981
2204
|
.w > .t, .w > .h { inline-size: 0; min-inline-size: 100%; max-inline-size: none; }
|
|
1982
2205
|
.w > .h .t { max-inline-size: none; }
|
|
2206
|
+
/* lines (1.7): wrap onto up to N lines, then "…". */
|
|
2207
|
+
.t.lines { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--_lines); line-clamp: var(--_lines); white-space: normal; overflow-wrap: anywhere; }
|
|
1983
2208
|
.h { display: flex; align-items: center; min-inline-size: 0; }
|
|
1984
2209
|
.end > .h { justify-content: flex-end; }
|
|
1985
2210
|
.act { inline-size: 1%; white-space: nowrap; }
|
|
@@ -2087,77 +2312,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2087
2312
|
:host([mobile='priority']) tr.more { display: table-row; }
|
|
2088
2313
|
}
|
|
2089
2314
|
@media (forced-colors: active) { button.sort cm-icon { opacity: 1; } .acts { opacity: 1 !important; } }
|
|
2090
|
-
`];$("cm-data-table",
|
|
2091
|
-
aria-expanded=${String(this.open)} aria-controls="${r(this,ar)}-m" aria-label=${this.iconOnly?t:h}
|
|
2092
|
-
?disabled=${this.disabled} @click=${r(this,bo)} @keydown=${r(this,go)}>${this.iconOnly?c`<cm-icon name=${this.icon} size="18"></cm-icon>`:c`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return c`${i}
|
|
2093
|
-
<div class="pop" part="menu" ?hidden=${!this.open}>
|
|
2094
|
-
${this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h}
|
|
2095
|
-
<div role="menu" id="${r(this,ar)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${r(this,md)}>
|
|
2096
|
-
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:s(this,V,Hg).call(this,e)}
|
|
2097
|
-
</div>
|
|
2098
|
-
</div>
|
|
2099
|
-
<slot hidden></slot>`}};po=new WeakMap,ar=new WeakMap,sr=new WeakMap,mo=new WeakMap,V=new WeakSet,cd=function(){this._slotted=ho(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},uo=new WeakMap,Tp=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},dd=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},hd=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})))},pd=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},go=new WeakMap,bo=new WeakMap,Ka=function(e){this._active=e,this.updateComplete.then(()=>s(this,V,pd).call(this))},md=new WeakMap,Ng=function(e,t){if(t.disabled){e.preventDefault();return}let i=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));i||e.preventDefault(),this.hide(!t.href||!i)},zp=function(e,t){if(e.divider)return c`<div role="separator"></div>`;let i=`item${e.critical?" critical":""}${t===this._active?" active":""}`,a=c`${e.icon?c`<cm-icon name=${e.icon} size="16"></cm-icon>`:h}<span class="label">${e.label}</span>${e.shortcut?c`<span class="shortcut" part="shortcut" aria-hidden="true">${e.shortcut}</span>`:h}`,o={over:()=>{e.disabled||(this._active=t)},click:d=>s(this,V,Ng).call(this,d,e)};return e.href&&!e.disabled?c`<a class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
2100
|
-
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${o.over} @click=${o.click}>${a}</a>`:c`<button type="button" class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
2101
|
-
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${o.over} @click=${o.click}>${a}</button>`},Hg=function(e){let t=[];for(let i=0;i<e.length;i++){let a=e[i];if(!a.heading){t.push(s(this,V,zp).call(this,a,i));continue}let o=`${r(this,ar)}-h${i}`,d=[],p=i+1;for(;p<e.length&&!e[p].heading&&!e[p].divider;p++)d.push(s(this,V,zp).call(this,e[p],p));t.push(c`<div role="group" aria-labelledby=${o}><div class="section" part="section" id=${o} role="presentation">${a.label}</div>${d}</div>`),i=p-1}return t},Wa.properties={items:{type:Array},open:{type:Boolean,reflect:!0},label:{string:"label"},triggerLabel:{attribute:"trigger-label"},iconOnly:{type:Boolean,attribute:"icon-only"},icon:{},align:{reflect:!0},heading:{},subheading:{},density:{reflect:!0},loading:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},Wa.styles=[k,x`
|
|
2102
|
-
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
2103
|
-
.trigger {
|
|
2104
|
-
display: inline-flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-12); font: inherit; font-size: var(--cm-font-size-14); font-weight: 500;
|
|
2105
|
-
color: var(--cm-text-default); background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
2106
|
-
border-radius: var(--cm-radius-sm); cursor: pointer;
|
|
2107
|
-
}
|
|
2108
|
-
.trigger.icon { width: var(--cm-control-height-md, 36px); padding: 0; justify-content: center; border-color: transparent; background: none; }
|
|
2109
|
-
.trigger:hover:not(:disabled) { background: var(--cm-bg-hover); }
|
|
2110
|
-
.trigger:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); cursor: not-allowed; }
|
|
2111
|
-
.trigger.icon:disabled { background: none; }
|
|
2112
|
-
.trigger:active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
|
|
2113
|
-
.trigger[aria-expanded='true'] { background: var(--cm-bg-hover); }
|
|
2114
|
-
/* Touch screens (1.6, like cm-button): the trigger is drawn 40px (40 x 40 icon-only) with a 44px hit area. */
|
|
2115
|
-
@media (pointer: coarse) {
|
|
2116
|
-
.trigger { position: relative; min-height: var(--cm-control-height-lg, 40px); } .trigger.icon { width: var(--cm-control-height-lg, 40px); }
|
|
2117
|
-
.trigger::after { content: ''; position: absolute; inset: -2px; }
|
|
2118
|
-
.item { min-height: var(--cm-control-height-touch, 44px); }
|
|
2119
|
-
}
|
|
2120
|
-
.trigger:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2121
|
-
.pop {
|
|
2122
|
-
position: absolute; z-index: 20; top: calc(100% + 4px); inset-inline-start: 0; width: max-content; min-width: 180px; max-width: min(320px, calc(100vw - 32px));
|
|
2123
|
-
padding: var(--cm-space-4); text-align: start; background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
2124
|
-
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-md);
|
|
2125
|
-
}
|
|
2126
|
-
:host([align='end']) .pop { inset-inline-start: auto; inset-inline-end: 0; }
|
|
2127
|
-
.pop[hidden] { display: none; }
|
|
2128
|
-
.head { padding: var(--cm-space-4) var(--cm-space-12) var(--cm-space-8); margin-bottom: 4px; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); overflow-wrap: anywhere; }
|
|
2129
|
-
.head strong { display: block; font-size: 14px; font-weight: 500; }
|
|
2130
|
-
.head span { display: block; font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); }
|
|
2131
|
-
[role='menu'] { display: flex; flex-direction: column; outline: none; }
|
|
2132
|
-
.item {
|
|
2133
|
-
display: flex; align-items: center; gap: var(--cm-space-8); width: 100%; min-height: var(--cm-control-height-md, 36px); padding: var(--cm-space-4) var(--cm-space-12); font: inherit; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
|
|
2134
|
-
color: var(--cm-text-default); text-align: start; text-decoration: none; background: none; border: 0; border-radius: var(--cm-radius-sm);
|
|
2135
|
-
cursor: pointer; outline: none;
|
|
2136
|
-
}
|
|
2137
|
-
:host([density='compact']) .item { min-height: var(--cm-control-height-sm, 32px); }
|
|
2138
|
-
.item cm-icon { flex: none; }
|
|
2139
|
-
.label { flex: 1; min-width: 0; }
|
|
2140
|
-
.shortcut { flex: none; padding-inline-start: var(--cm-space-16); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
2141
|
-
.item.critical { color: var(--cm-text-critical); }
|
|
2142
|
-
.item[aria-disabled='true'] { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
2143
|
-
.item[aria-disabled='true'] .shortcut { color: var(--cm-text-secondary); }
|
|
2144
|
-
.item.active:not([aria-disabled='true']), .item:not([aria-disabled='true']):hover {
|
|
2145
|
-
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
2146
|
-
}
|
|
2147
|
-
.item.active:not([aria-disabled='true']) .shortcut, .item:not([aria-disabled='true']):hover .shortcut { color: var(--cm-text-on-dark-secondary); }
|
|
2148
|
-
.item:not([aria-disabled='true']):active { background: color-mix(in srgb, var(--cm-bg-panel-header), var(--cm-text-on-dark) 16%); }
|
|
2149
|
-
.item.critical.active:not([aria-disabled='true']), .item.critical:not([aria-disabled='true']):hover { background: var(--cm-bg-critical); color: var(--cm-text-critical); }
|
|
2150
|
-
.item.critical.active .shortcut, .item.critical:hover .shortcut { color: var(--cm-text-critical); }
|
|
2151
|
-
.item.critical:not([aria-disabled='true']):active { background: color-mix(in srgb, var(--cm-bg-critical), var(--cm-text-critical) 12%); }
|
|
2152
|
-
.item.active:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 1px; }
|
|
2153
|
-
[role='group'] { display: flex; flex-direction: column; }
|
|
2154
|
-
.section {
|
|
2155
|
-
padding: var(--cm-space-8) var(--cm-space-12) var(--cm-space-4); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12);
|
|
2156
|
-
font-weight: 500; color: var(--cm-text-tertiary);
|
|
2157
|
-
}
|
|
2158
|
-
.loading { display: flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: var(--cm-space-4) var(--cm-space-12); font-size: var(--cm-font-size-14); color: var(--cm-text-tertiary); }
|
|
2159
|
-
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2160
|
-
`];$("cm-action-menu",Wa);var M$=_("resourceItem",{select:"Select {name}"}),T$=_("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}"}),Ig=x`
|
|
2315
|
+
`];$("cm-data-table",ms);var uk=z("resourceItem",{select:"Select {name}"}),gk=z("resourceList",{resourceName:"item",resourceNamePlural:"items",select:"Select",selectPageHidden:"all {count} {resource} on this page",selectionOptions:"Selection options",selectPage:"Select all {count} on this page",selectAll:"Select all {count} {resource}",selectNone:"Select none",selected:"{count} {resource} selected.",allSelected:"All {count} {resource} selected.",clearSelection:"Clear selection",loading:"Loading {resource}"}),Xb=x`
|
|
2161
2316
|
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
2162
2317
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
2163
2318
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -2169,17 +2324,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2169
2324
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
2170
2325
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2171
2326
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
2172
|
-
`,
|
|
2327
|
+
`,mh,ws,Jb,Zb,ys=class extends T{constructor(){super();p(this,ws);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;this.columns=!1;this.actions="auto";this._hasActions=!1;p(this,mh,this.attachInternals());r(this,mh).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get name(){return this.label||this.textContent.replace(/\s+/g," ").trim()}toggle(e){if(this.disabled)return;let t=e??!this.selected;t!==this.selected&&(this.selected=t,this.dispatchEvent(new CustomEvent("cm-resource-select",{detail:{value:this.value,selected:t},bubbles:!0,composed:!0})))}render(){return c`
|
|
2173
2328
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
2174
|
-
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,
|
|
2329
|
+
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${s(this,ws,Zb)}>
|
|
2175
2330
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
2176
2331
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
2177
2332
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
2178
2333
|
<span class="media"><slot name="media"></slot></span>
|
|
2179
2334
|
<div class="content" part="content"><slot></slot></div>
|
|
2180
|
-
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,
|
|
2335
|
+
<div class="actions" part="actions"><slot name="actions" @slotchange=${s(this,ws,Jb)}></slot></div>
|
|
2181
2336
|
</div>
|
|
2182
|
-
`}};
|
|
2337
|
+
`}};mh=new WeakMap,ws=new WeakSet,Jb=function(e){this._hasActions=e.target.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim())},Zb=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i!==this&&i.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},ys.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0},columns:{type:Boolean,reflect:!0},actions:{reflect:!0},_hasActions:{state:!0}},ys.styles=[k,Xb,x`
|
|
2183
2338
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2184
2339
|
:host(:last-child) { border-bottom: 0; }
|
|
2185
2340
|
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
|
|
@@ -2222,32 +2377,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2222
2377
|
::slotted([slot='media']) { width: 32px; height: 32px; }
|
|
2223
2378
|
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 32px; }
|
|
2224
2379
|
}
|
|
2225
|
-
`];$("cm-resource-item",
|
|
2226
|
-
${this.selectable&&
|
|
2227
|
-
<div class="head ${this.selectable||this._hasHeader?"on":""} ${
|
|
2228
|
-
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,
|
|
2229
|
-
${this.selectable?c`<div class="toolbar ${
|
|
2380
|
+
`];$("cm-resource-item",ys);var Vo,Ko,ye,Qb,Hp,ph,uh,vs,hh,gh,xs=class extends T{constructor(){super();p(this,ye);this.selectable=!1;this.total=0;this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this._count=0;this._rows=0;this._hasHeader=!1;this._hasTable=!1;this._hasActions=!1;p(this,Vo,A("cm-rl"));p(this,Ko,new Set);p(this,ph,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,s(this,ye,Hp).call(this,t)});p(this,uh,e=>{this._hasActions=e.target.assignedElements().length>0});p(this,gh,e=>{e.stopPropagation();let t=e.detail.value;t==="page"?this.selectPage(!0):t==="all"?this.selectAll():t==="none"&&this.clearSelection()});this.addEventListener("cm-resource-select",e=>{e.target!==this&&(this.allSelected=!1,s(this,ye,vs).call(this),s(this,ye,hh).call(this))})}connectedCallback(){super.connectedCallback(),sh(this)}get items(){return[...this.querySelectorAll(":scope > cm-resource-item")]}get selected(){return this.items.filter(e=>e.selected).map(e=>e.value)}selectPage(e=!0){this.items.forEach(t=>{t.disabled||(t.selected=e)}),e||(this.allSelected=!1),s(this,ye,vs).call(this),s(this,ye,hh).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,s(this,ye,vs).call(this),s(this,ye,hh).call(this)}clearSelection(){this.selectPage(!1)}updated(e){e.has("selectable")&&(s(this,ye,vs).call(this),s(this,ye,Hp).call(this))}render(){let e=this._count,t=this._rows,i=this.items.filter(M=>!M.disabled).length,a=i>0&&e>=i,l=s(this,ye,Qb).call(this),d=M=>hc(M,this.locale)==="one"?this.resourceName:l,m=this.total>t,u=h;this.allSelected?u=c`${this.t("allSelected",{count:Math.max(this.total,e),resource:l})} <button type="button" @click=${()=>this.clearSelection()}>${this.t("clearSelection")}</button>`:e&&(u=c`${this.t("selected",{count:e,resource:d(e)})}${a&&m?c` <button type="button" @click=${()=>this.selectAll()}>${this.t("selectAll",{count:this.total,resource:l})}</button>`:h}`);let v=e>0||this.allSelected,b=this._hasTable,w=!this.hideSelectMenu&&(!b||v),y=c`<slot name="actions" @slotchange=${r(this,uh)}></slot>`;return c`
|
|
2381
|
+
${this.selectable&&b?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${y}</div>`:h}
|
|
2382
|
+
<div class="head ${this.selectable||this._hasHeader?"on":""} ${b?"over":""}">
|
|
2383
|
+
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,ph)}></slot></div>
|
|
2384
|
+
${this.selectable?c`<div class="toolbar ${b?"over":""} ${v?"busy":""}" part="toolbar">
|
|
2230
2385
|
<span class="select" part="select">
|
|
2231
|
-
<span class="check"><input id="${r(this,
|
|
2386
|
+
<span class="check"><input id="${r(this,Vo)}-all" type="checkbox" .checked=${a} .indeterminate=${e>0&&!a}
|
|
2232
2387
|
?disabled=${!i} @change=${M=>this.selectPage(M.target.checked)} />
|
|
2233
2388
|
<span class="box" aria-hidden="true">${e>0&&!a?c`<span class="dash"></span>`:a?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>
|
|
2234
2389
|
${this.hideSelectMenu?h:c`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")} ?hidden=${!w}
|
|
2235
|
-
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...
|
|
2236
|
-
<label for="${r(this,
|
|
2390
|
+
.items=${[{label:this.t("selectPage",{count:i}),value:"page",disabled:!i},...m?[{label:this.t("selectAll",{count:this.total,resource:l}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${r(this,gh)}></cm-action-menu>`}
|
|
2391
|
+
<label for="${r(this,Vo)}-all" class=${b||v?"sr":"label"}>${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:d(t)})}</span></label>
|
|
2237
2392
|
</span>
|
|
2238
2393
|
<span class="status" part="status" role="status">${u}</span>
|
|
2239
2394
|
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
2240
|
-
${
|
|
2395
|
+
${b?h:c`<span class="actions ${this._hasActions?"has":""}">${y}</span>`}
|
|
2241
2396
|
</div>`:h}
|
|
2242
2397
|
</div>
|
|
2243
2398
|
<div class="body">
|
|
2244
|
-
<div class="list" part="list" role="list" aria-label=${this.label||
|
|
2245
|
-
<slot @slotchange=${()=>s(this,
|
|
2399
|
+
<div class="list" part="list" role="list" aria-label=${this.label||l.replace(/^./,M=>M.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
2400
|
+
<slot @slotchange=${()=>s(this,ye,vs).call(this)}></slot>
|
|
2246
2401
|
</div>
|
|
2247
|
-
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:
|
|
2402
|
+
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
2248
2403
|
</div>
|
|
2249
2404
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
2250
|
-
`}};
|
|
2405
|
+
`}};Vo=new WeakMap,Ko=new WeakMap,ye=new WeakSet,Qb=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},Hp=function(e=this.renderRoot?.querySelector('slot[name="header"]')){if(!e)return;let t=new Set;for(let i of e.assignedElements())i.localName==="cm-table-header"&&t.add(i),i.querySelectorAll("cm-table-header").forEach(a=>t.add(a));for(let i of r(this,Ko))t.has(i)||i.removeAttribute("resource-rows");for(let i of t)i.setAttribute("resource-rows",this.selectable?"selectable":"plain");g(this,Ko,t),this._hasTable=t.size>0},ph=new WeakMap,uh=new WeakMap,vs=function(){let e=this.items;e.forEach(t=>t.selectable=this.selectable),this._rows=e.length,this._count=e.filter(t=>t.selected).length},hh=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},gh=new WeakMap,xs.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name",string:"resourceName"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},density:{reflect:!0},_count:{state:!0},_rows:{state:!0},_hasHeader:{state:!0},_hasTable:{state:!0},_hasActions:{state:!0}},xs.styles=[k,Xb,x`
|
|
2251
2406
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
|
|
2252
2407
|
/* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
|
|
2253
2408
|
:host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
@@ -2303,12 +2458,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2303
2458
|
.toolbar .check { width: 20px; height: 20px; }
|
|
2304
2459
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
2305
2460
|
}
|
|
2306
|
-
`];$("cm-resource-list",
|
|
2307
|
-
<div class="row" part="row" @dragover=${s(this,
|
|
2461
|
+
`];$("cm-resource-list",xs);var $k=z("nestedItem",{reorder:"Reorder {label}",hint:"Press up or down arrow to move.",hintGroup:"Press up or down arrow to move. At either end of the list, the arrow moves it into the list before or after.",moved:"{label} moved to position {position} of {total}.",movedTo:"{label} moved to {list}, position {position} of {total}."}),kk=z("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),fh,re,Np,Ip,ef,tf,zi,rf,af,sf,Pp,nf,ht=class ht extends T{constructor(){super();p(this,re);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;p(this,fh,this.attachInternals());p(this,zi,!1);r(this,fh).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get list(){let e=this.parentElement;return e?.localName==="cm-nested-list"?e:null}moveToList(e,t){let i=this.list;if(!i||!e)return!1;if(e===i)return t===void 0?!1:this.moveTo(t);if(!i.group||e.group!==i.group)return!1;let a=e.items,l=Math.max(0,Math.min(a.length,t??a.length)),d={item:this,from:i.items.indexOf(this),to:l,fromList:i,toList:e};return this.dispatchEvent(new CustomEvent("cm-move",{detail:d,bubbles:!0,composed:!0,cancelable:!0}))?(e.insertBefore(this,a[l]??null),e.announce(this.t("movedTo",{label:this.label,list:e.heading,position:l+1,total:a.length+1})),!0):!1}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,i=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===i)return!1;let a=new CustomEvent("cm-reorder",{detail:{item:this,from:i,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(a))return!1;let l=t[e];return l.parentElement.insertBefore(this,e>i?l.nextSibling:l),this.closest("cm-nested-list")?.announce(this.t("moved",{label:this.label,position:e+1,total:t.length})),!0}render(){return c`
|
|
2462
|
+
<div class="row" part="row" @dragover=${s(this,re,sf)} @dragleave=${s(this,re,Pp)} @drop=${s(this,re,nf)}>
|
|
2308
2463
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
2309
2464
|
aria-describedby="hint"
|
|
2310
|
-
@keydown=${s(this,
|
|
2311
|
-
@dragend=${()=>{this.classList.remove("dragging"),
|
|
2465
|
+
@keydown=${s(this,re,ef)} @dragstart=${s(this,re,tf)} @pointerdown=${s(this,re,rf)}
|
|
2466
|
+
@dragend=${()=>{this.classList.remove("dragging"),ht.dragged=null,Wo(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
2312
2467
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
2313
2468
|
<span class="label" part="label">${this.label}</span>
|
|
2314
2469
|
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
@@ -2316,7 +2471,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2316
2471
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
2317
2472
|
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(i=>i.localName==="cm-nested-item");t.forEach(i=>i.sortable=this.sortable),this._hasChildren=t.length>0}}></slot>
|
|
2318
2473
|
</div>
|
|
2319
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};
|
|
2474
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};fh=new WeakMap,re=new WeakSet,Np=function(){let e=this.list;return e?.group?[...e.getRootNode().querySelectorAll("cm-nested-list")].filter(i=>i===e||i.group===e.group&&i.sortable&&(!i.collapsible||i.open)):[]},Ip=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},ef=function(e){let t=this.siblings.indexOf(this),i=e.key==="ArrowUp",a=e.key==="ArrowDown";if(i&&t===0||a&&t===this.siblings.length-1){let d=r(this,re,Np),m=d[d.indexOf(this.list)+(i?-1:1)];if(m){e.preventDefault(),this.moveToList(m,i?m.items.length:0)&&s(this,re,Ip).call(this);return}}let l;if(e.key==="ArrowUp")l=t-1;else if(e.key==="ArrowDown")l=t+1;else if(e.key==="Home")l=0;else if(e.key==="End")l=this.siblings.length-1;else return;e.preventDefault(),this.moveTo(l)&&s(this,re,Ip).call(this)},tf=function(e){if(e.stopPropagation(),r(this,zi)){e.preventDefault();return}ht.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},zi=new WeakMap,rf=function(e){if(e.pointerType==="mouse"||!e.isPrimary)return;let t=e.clientY,i=null,a=d=>{if(d.pointerId===e.pointerId){if(!r(this,zi)){if(Math.abs(d.clientY-t)<6)return;g(this,zi,!0),ht.dragged=this,this.classList.add("dragging")}d.preventDefault(),i=s(this,re,af).call(this,d.clientX,d.clientY),Wo(this,i)}},l=d=>{if(d.pointerId!==e.pointerId)return;document.removeEventListener("pointermove",a,!0),document.removeEventListener("pointerup",l,!0),document.removeEventListener("pointercancel",l,!0);let m=r(this,zi);g(this,zi,!1),ht.dragged=null,this.classList.remove("dragging"),Wo(this,null),!(!m||d.type==="pointercancel"||!i)&&(i.list?this.moveToList(i.list,i.index):this.moveTo(i.index))};document.addEventListener("pointermove",a,!0),document.addEventListener("pointerup",l,!0),document.addEventListener("pointercancel",l,!0)},af=function(e,t){for(let i of r(this,re,Np)){if(i===this.list)continue;let a=i.getBoundingClientRect();if(e>=a.left&&e<=a.right&&t>=a.top&&t<=a.bottom)return{list:i,index:bh(i.items,this,t)}}return{index:bh(this.siblings,this,t)}},sf=function(e){let t=ht.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.renderRoot.querySelector(".row").getBoundingClientRect(),a=e.clientY>i.top+i.height/2;this.classList.toggle("drop-after",a),this.classList.toggle("drop-before",!a)},Pp=function(){this.classList.remove("drop-before","drop-after")},nf=function(e){let t=ht.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.classList.contains("drop-after");s(this,re,Pp).call(this);let a=this.siblings,l=a.indexOf(t),d=a.indexOf(this)+(i?1:0);d>l&&(d-=1),t.moveTo(d)},ht.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},ht.styles=[k,x`
|
|
2320
2475
|
:host { display: block; }
|
|
2321
2476
|
.row {
|
|
2322
2477
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2343,20 +2498,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2343
2498
|
.actions { gap: var(--cm-space-8); }
|
|
2344
2499
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2345
2500
|
}
|
|
2346
|
-
`],
|
|
2501
|
+
`],ht.dragged=null;var ks=ht;$("cm-nested-item",ks);function bh(o,n,e){return o.filter(t=>{if(t===n)return!1;let i=t.getBoundingClientRect();return i.top+i.height/2<e}).length}function Wo(o,n){if((o.list??o).getRootNode().querySelectorAll("cm-nested-item.drop-before, cm-nested-item.drop-after, cm-nested-list.drop-target").forEach(i=>i.classList.remove("drop-before","drop-after","drop-target")),!n)return;let t=(n.list?n.list.items:o.siblings).filter(i=>i!==o);t.length?n.index<t.length?t[n.index].classList.add("drop-before"):t[t.length-1].classList.add("drop-after"):n.list?.classList.add("drop-target")}var vr,Ne,of,Op,qp,lf,cf,$s=class extends T{constructor(){super(...arguments);p(this,Ne);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;p(this,vr,A("cm-nl"))}get items(){return[...this.children].filter(e=>e.localName==="cm-nested-item")}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}willUpdate(){this.hasUpdated||(this._empty=!this.items.length)}updated(e){(e.has("sortable")||e.has("group"))&&s(this,Ne,Op).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2347
2502
|
<div class="bar" part="bar">
|
|
2348
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,
|
|
2503
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,vr)}-h">${this.heading}</div>
|
|
2349
2504
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2350
|
-
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,
|
|
2351
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,
|
|
2505
|
+
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,vr)}-rows"
|
|
2506
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${s(this,Ne,of)}>
|
|
2352
2507
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2353
2508
|
</div>
|
|
2354
|
-
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,
|
|
2355
|
-
@dragover=${s(this,
|
|
2356
|
-
<slot @slotchange=${()=>{s(this,
|
|
2509
|
+
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,vr)}-rows" role="list" aria-labelledby="${r(this,vr)}-h" ?hidden=${!t}
|
|
2510
|
+
@dragover=${s(this,Ne,lf)} @drop=${s(this,Ne,cf)}>
|
|
2511
|
+
<slot @slotchange=${()=>{s(this,Ne,Op).call(this),this._empty=!this.items.length}}></slot>
|
|
2357
2512
|
</div>
|
|
2358
2513
|
<span class="sr" role="status">${this._msg}</span>
|
|
2359
|
-
`}};
|
|
2514
|
+
`}};vr=new WeakMap,Ne=new WeakSet,of=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},Op=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},qp=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},lf=function(e){let t=ks.dragged;s(this,Ne,qp).call(this,t)&&(e.preventDefault(),Wo(t,{list:this,index:bh(this.items,t,e.clientY)}))},cf=function(e){let t=ks.dragged;if(!s(this,Ne,qp).call(this,t))return;e.preventDefault();let i=bh(this.items,t,e.clientY);Wo(t,null),t.moveToList(this,i)},$s.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"},sortable:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},group:{reflect:!0},_msg:{state:!0},_empty:{state:!0}},$s.styles=[k,x`
|
|
2360
2515
|
:host { display: block; }
|
|
2361
2516
|
.bar {
|
|
2362
2517
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2380,9 +2535,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2380
2535
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2381
2536
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2382
2537
|
}
|
|
2383
|
-
`];$("cm-nested-list"
|
|
2538
|
+
`];$("cm-nested-list",$s);var df=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},hf=Gr(class extends ti{constructor(o){if(super(o),o.type!==ot.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,n,e){let t;e===void 0?e=n:n!==void 0&&(t=n);let i=[],a=[],l=0;for(let d of o)i[l]=t?t(d,l):l,a[l]=e(d,l),l++;return{values:a,keys:i}}render(o,n,e){return this.dt(o,n,e).values}update(o,[n,e,t]){let i=hg(o),{values:a,keys:l}=this.dt(n,e,t);if(!Array.isArray(i))return this.ut=l,a;let d=this.ut??=[],m=[],u,v,b=0,w=i.length-1,y=0,M=a.length-1;for(;b<=w&&y<=M;)if(i[b]===null)b++;else if(i[w]===null)w--;else if(d[b]===l[y])m[y]=ii(i[b],a[y]),b++,y++;else if(d[w]===l[M])m[M]=ii(i[w],a[M]),w--,M--;else if(d[b]===l[M])m[M]=ii(i[b],a[M]),Yr(o,m[M+1],i[b]),b++,M--;else if(d[w]===l[y])m[y]=ii(i[w],a[y]),Yr(o,i[b],i[w]),w--,y++;else if(u===void 0&&(u=df(l,y,M),v=df(d,b,w)),u.has(d[b]))if(u.has(d[w])){let D=v.get(l[y]),H=D!==void 0?i[D]:null;if(H===null){let q=Yr(o,i[b]);ii(q,a[y]),m[y]=q}else m[y]=ii(H,a[y]),Yr(o,i[b],H),i[D]=null;y++}else zc(i[w]),w--;else zc(i[b]),b++;for(;y<=M;){let D=Yr(o,m[M+1]);ii(D,a[y]),m[y++]=D}for(;b<=w;){let D=i[b++];D!==null&&zc(D)}return this.ut=l,Tc(o,m),we}});function mf(o,n,e){let t=l=>e.slotCount(l),i=l=>Math.max(0,t(l)-1),a=l=>{for(let d=n.group+l;d>=0&&d<e.groupCount();d+=l)if(t(d)>0)return{group:d,index:Math.min(n.index,i(d))};return{...n}};switch(o){case"ArrowRight":return a(1);case"ArrowLeft":return a(-1);case"ArrowDown":return{group:n.group,index:Math.min(n.index+1,i(n.group))};case"ArrowUp":return{group:n.group,index:Math.max(n.index-1,0)};case"Home":return{group:n.group,index:0};case"End":return{group:n.group,index:i(n.group)};default:return null}}var le,Ue,Ve,xr=class{constructor(n){p(this,le);p(this,Ue,null);p(this,Ve,null);g(this,le,n)}get active(){return r(this,Ue)!==null}get from(){return r(this,Ue)&&{...r(this,Ue)}}get target(){return r(this,Ve)&&{...r(this,Ve)}}groupCount(){return r(this,le).groupCount()}slotCount(n){return n>=0&&n<r(this,le).groupCount()?r(this,le).slotCount(n):0}pickUp(n){this.active&&this.cancel(),g(this,Ue,{...n}),g(this,Ve,{...n}),r(this,le).onTarget?.(this.target),r(this,le).announce(r(this,le).messages.pickedUp(this.target))}moveTo(n){if(!r(this,Ve))return;let e=Math.max(0,Math.min(n.group,r(this,le).groupCount()-1)),t=this.slotCount(e);t<=0||(g(this,Ve,{group:e,index:Math.max(0,Math.min(n.index,t-1))}),r(this,le).onTarget?.(this.target),r(this,le).announce(r(this,le).messages.over(this.target)))}drop(){if(!r(this,Ue)||!r(this,Ve))return;let n=r(this,Ue),e=r(this,Ve);g(this,Ue,g(this,Ve,null)),r(this,le).onTarget?.(null),r(this,le).onDrop(n,e)}cancel(n=!1){if(!r(this,Ue))return;let e=r(this,Ue),t=n?"":r(this,le).messages.cancelled(e);g(this,Ue,g(this,Ve,null)),r(this,le).onTarget?.(null),r(this,le).onCancel?.(e),t&&r(this,le).announce(t)}handleKey(n,e=n.key){if(!this.active||n.altKey||n.ctrlKey||n.metaKey)return!1;if(e===" "||e==="Enter")return this.drop(),!0;if(e==="Escape")return this.cancel(),!0;if(e==="Tab")return this.cancel(),!1;let t=(r(this,le).navigate??mf)(e,r(this,Ve),this);return t?(this.moveTo(t),!0):!1}};le=new WeakMap,Ue=new WeakMap,Ve=new WeakMap;var Go,yr,wr=class{constructor(n=document,e="assertive"){p(this,Go);p(this,yr);let t=n.createElement("div");t.setAttribute("aria-live",e),t.setAttribute("aria-atomic","true"),t.className="cm-announcer",Object.assign(t.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:"0"}),this.element=t}get text(){return r(this,yr)??this.element.textContent??""}announce(n){clearTimeout(r(this,Go)),this.element.textContent===n?(this.element.textContent="",g(this,yr,n),g(this,Go,setTimeout(()=>{this.element.textContent=n,g(this,yr,void 0)},50))):(g(this,yr,void 0),this.element.textContent=n)}};Go=new WeakMap,yr=new WeakMap;var qk=z("boardCard",{roleDescription:"movable card",instructions:"Press Space to pick up. Then use the arrow keys to choose a column and a position, Space or Enter to drop, and Escape to cancel.",openHint:"Press Enter to open.",saving:"Saving"}),Bk=z("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),Fk=z("board",{label:"Board",pickedUp:"Picked up {card}. Column {column}, position {position} of {count}.",over:"Column {column}, position {position} of {count}.",moved:"Moved {card} to {column}, position {position} of {count}.",sameSpot:"{card} dropped where it started.",cancelled:"Move cancelled. {card} is back in {column}.",refused:"{card} can't be moved to {column}.",reverted:"Couldn't move {card}. It is back in {column}."});var Ty="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",Yo,wh,pf,$r=class extends T{constructor(){super(...arguments);p(this,wh);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";p(this,Yo,A("cm-bc"))}get name(){let e=i=>(i??"").replace(/\s+/g," ").trim();if(this.label)return this.label;if(this.heading)return this.heading;let t=this.querySelector(':scope > [slot="heading"]');return t?e(t.textContent):e(this.textContent).slice(0,80)}get key(){return this.value||this.name}get opener(){if(this.href)return this.renderRoot?.querySelector(".title a")??null;let e=this.querySelector(':scope > [slot="heading"]');return e?e.matches("a[href], button, cm-button")?e:e.querySelector("a[href], button, cm-button"):null}focusHandle(e){let t=this.renderRoot?.querySelector(".handle");t?t.focus(e):this.focus(e)}open(){let e=this.opener;return e?(e.click(),!0):!1}render(){let e=!!(this.href||this.querySelector(':scope > [slot="heading"] a[href], :scope > [slot="heading"] button, :scope > a[slot="heading"][href], :scope > button[slot="heading"]')),t=this.pending;return c`<div class="card" part="card">
|
|
2384
2539
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2385
|
-
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,
|
|
2540
|
+
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,Yo)}-help"></div>`}
|
|
2386
2541
|
<div class="content">
|
|
2387
2542
|
<div class="head">
|
|
2388
2543
|
<div class="title" part="title"><slot name="heading" @slotchange=${()=>this.requestUpdate()}>${this.href?c`<a href=${this.href} tabindex="-1">${this.heading}</a>`:this.heading}</slot></div>
|
|
@@ -2390,11 +2545,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2390
2545
|
<slot name="actions"></slot>
|
|
2391
2546
|
</div>
|
|
2392
2547
|
<div class="lines"><slot></slot></div>
|
|
2393
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,
|
|
2548
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>s(this,wh,pf).call(this,i,"_badges")}></slot></div>
|
|
2394
2549
|
</div>
|
|
2395
2550
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2396
|
-
<span id="${r(this,
|
|
2397
|
-
</div>`}};
|
|
2551
|
+
<span id="${r(this,Yo)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2552
|
+
</div>`}};Yo=new WeakMap,wh=new WeakSet,pf=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},$r.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},$r.properties={value:{reflect:!0},label:{},heading:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0},_badges:{state:!0},_slottedTitle:{state:!0}},$r.styles=[k,x`
|
|
2398
2553
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2399
2554
|
.card {
|
|
2400
2555
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2419,22 +2574,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2419
2574
|
:host([moving]) .content { opacity: 0.5; }
|
|
2420
2575
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2421
2576
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2422
|
-
`];$("cm-board-card"
|
|
2577
|
+
`];$("cm-board-card",$r);var Ts,Xo,zs,_s,Ci,vh,uf,kr=class extends T{constructor(){super(...arguments);p(this,Ci);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;p(this,Ts,!1);this._cards=[];this._drop=null;p(this,Xo,new MutationObserver(()=>s(this,Ci,vh).call(this)));p(this,zs,A("cm-col"));p(this,_s,!1)}get collapsed(){return r(this,Ts)}connectedCallback(){super.connectedCallback(),s(this,Ci,vh).call(this),r(this,Xo).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Xo).disconnect()}get cards(){return[...this.children].filter(e=>e.localName==="cm-board-card"&&!e.hasAttribute("slot"))}get key(){return this.value||this.heading}get count(){return typeof this.total=="number"&&!Number.isNaN(this.total)?this.total:this._cards.length}get scrollElement(){return this.renderRoot?.querySelector(".scroll")??null}_sync(){return s(this,Ci,vh).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");g(this,Ts,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",r(this,Ts)),g(this,_s,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach(i=>{let a=this._cards[Number(i.dataset.i)];a?i.assign(a):i.assign()});let t=i=>[...this.children].filter(a=>a.getAttribute("slot")===i);this.renderRoot.querySelector("slot.actions")?.assign(...t("actions")),this.renderRoot.querySelector("slot.empty")?.assign(...t("empty")),r(this,_s)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,_s,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,i=this.count,a=t?e.filter(y=>y!==t.card):e,l=t?e.indexOf(t.card):-1,d=!!t&&!this.collapsed&&!(l>=0&&t.index===l),m=[];e.forEach((y,M)=>{d&&y!==t.card&&a.indexOf(y)===t.index&&m.push({key:"drop"}),m.push({key:y,card:y,i:M})}),d&&t.index>=a.length&&m.push({key:"drop"});let u=this.hasMore||i>e.length,v=this.loading,b=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),w=this.t("count",{count:i});return c`<section aria-labelledby="${r(this,zs)}-h" class=${t&&this.collapsed?"over":""}>
|
|
2423
2578
|
<header part="header">
|
|
2424
|
-
<div class="title" id="${r(this,
|
|
2579
|
+
<div class="title" id="${r(this,zs)}-h" role="heading" aria-level=${b}>${this.heading}<span class="sr">, ${w}</span></div>
|
|
2425
2580
|
<span class="count" part="count" aria-hidden="true">${this.formatNumber(i)}</span>
|
|
2426
2581
|
<span class="actions"><slot class="actions"></slot></span>
|
|
2427
2582
|
</header>
|
|
2428
2583
|
<div class="scroll">
|
|
2429
|
-
<ul part="list" role="list" aria-labelledby="${r(this,
|
|
2430
|
-
${
|
|
2584
|
+
<ul part="list" role="list" aria-labelledby="${r(this,zs)}-h" aria-busy=${v?"true":"false"} tabindex="-1" ?hidden=${this.collapsed}>
|
|
2585
|
+
${hf(m,y=>y.key,y=>y.card?c`<li><slot data-i=${y.i}></slot></li>`:c`<li class="drop" aria-hidden="true"><div style="min-height:${Math.max(40,t.height)}px">${t.card.name}</div></li>`)}
|
|
2431
2586
|
</ul>
|
|
2432
2587
|
${v&&!e.length&&!this.collapsed?c`<div class="loading" aria-hidden="true"><cm-skeleton variant="block"></cm-skeleton><cm-skeleton variant="block"></cm-skeleton></div>`:h}
|
|
2433
2588
|
<div class="empty" ?hidden=${e.length>0||v||u||this.collapsed||d}><slot class="empty">${this.t("empty")}</slot></div>
|
|
2434
|
-
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,
|
|
2589
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${v} @click=${s(this,Ci,uf)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
2435
2590
|
</div>
|
|
2436
2591
|
<span class="sr" role="status">${v?this.t("loading",{column:this.heading}):""}</span>
|
|
2437
|
-
</section>`}};
|
|
2592
|
+
</section>`}};Ts=new WeakMap,Xo=new WeakMap,zs=new WeakMap,_s=new WeakMap,Ci=new WeakSet,vh=function(){this._cards=this.cards},uf=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},kr.shadowRootOptions={...S.shadowRootOptions,slotAssignment:"manual"},kr.properties={value:{reflect:!0},heading:{},total:{type:Number},hasMore:{type:Boolean,attribute:"has-more",reflect:!0},loading:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"},_cards:{state:!0},_drop:{state:!0}},kr.styles=[k,x`
|
|
2438
2593
|
:host {
|
|
2439
2594
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
2440
2595
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -2471,9 +2626,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2471
2626
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
2472
2627
|
:host([collapsed]) .actions { display: none; }
|
|
2473
2628
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
2474
|
-
`];$("cm-board-column",
|
|
2629
|
+
`];$("cm-board-column",kr);var Ce,ke,de,Er,te,R,Bp,Es,gf,Fp,bf,ff,vf,yf,Jo,xf,Zo,jp,Up,Vp,yh,wf,Qo,el,tl,il,rl,al,sl,Kp,Wp,xh,$f,_i,Ms=class extends T{constructor(){super();p(this,R);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;p(this,Ce,new wr);p(this,ke);p(this,de,null);p(this,Er,new WeakMap);p(this,te,null);p(this,Jo,e=>{if(r(this,te)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,ke).active){r(this,ke).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let i=s(this,R,yf).call(this,e.composedPath());if(!(!i||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===" ")e.preventDefault(),this.pickUp(i);else if(e.key==="Enter")i.open()&&e.preventDefault();else if(t.startsWith("Arrow")){let a=s(this,R,xf).call(this,i,t);a&&(e.preventDefault(),a.focusHandle())}}});p(this,Zo,e=>{if(!r(this,ke).active||!r(this,de))return;let t=e.relatedTarget;t&&(t===r(this,de).card||r(this,de).card.contains(t))||!t&&document.hasFocus()===!1||queueMicrotask(()=>{r(this,ke).active&&r(this,de)&&!r(this,de).card.matches(":focus-within")&&r(this,ke).cancel()})});p(this,Qo,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});p(this,el,e=>{if(r(this,te)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath(),i=t.find(d=>d.localName==="cm-board-card");if(!i||i.locked||i.pending||t.some(d=>d instanceof Element&&d!==i&&d.matches?.(Ty)))return;let a=s(this,R,Es).call(this,i);if(!a)return;r(this,ke).active&&r(this,ke).cancel();let l=i.getBoundingClientRect();g(this,te,{card:i,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,dx:e.clientX-l.left,dy:e.clientY-l.top,width:l.width,height:l.height,from:a.column,fromIndex:a.index}),e.pointerType!=="mouse"&&(r(this,te).timer=setTimeout(()=>{r(this,te)&&!r(this,te).started&&s(this,R,Kp).call(this)},300)),window.addEventListener("pointermove",r(this,rl),!0),window.addEventListener("pointerup",r(this,al),!0),window.addEventListener("pointercancel",r(this,sl),!0),window.addEventListener("touchmove",r(this,tl),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,il),!0)});p(this,tl,e=>{r(this,te)?.started&&e.cancelable&&e.preventDefault()});p(this,il,e=>{r(this,te)&&e.preventDefault()});p(this,rl,e=>{let t=r(this,te);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,R,Kp).call(this):s(this,R,_i).call(this,!1));return}e.preventDefault(),s(this,R,Wp).call(this),s(this,R,xh).call(this)}});p(this,al,e=>{let t=r(this,te);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,R,_i).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,R,_i).call(this,!0)});p(this,sl,e=>{r(this,te)&&e.pointerId===r(this,te).pointerId&&s(this,R,_i).call(this,!1)});g(this,ke,new xr({groupCount:()=>this.columns.length,slotCount:e=>{let t=this.columns[e];return!t||!r(this,de)?0:t.cards.filter(i=>i!==r(this,de).card).length+1},onTarget:e=>s(this,R,bf).call(this,e),onDrop:(e,t)=>s(this,R,vf).call(this,e,t),onCancel:()=>s(this,R,Fp).call(this),messages:{pickedUp:e=>s(this,R,Bp).call(this,"pickedUp",e),over:e=>s(this,R,Bp).call(this,"over",e),cancelled:e=>this.t("cancelled",{card:r(this,de)?.card.name??"",column:this.columns[e.group]?.heading??""})},announce:e=>r(this,Ce).announce(e)}))}get columns(){return[...this.children].filter(e=>e.localName==="cm-board-column")}column(e){return this.columns.find(t=>t.key===e)}card(e){for(let t of this.columns){let i=t.cards.find(a=>a.key===e);if(i)return i}}get heldCard(){return r(this,de)?.card??null}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,Jo)),this.addEventListener("focusout",r(this,Zo)),this.addEventListener("pointerdown",r(this,el)),this.addEventListener("dragstart",r(this,Qo))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,Jo)),this.removeEventListener("focusout",r(this,Zo)),this.removeEventListener("pointerdown",r(this,el)),this.removeEventListener("dragstart",r(this,Qo)),r(this,ke).cancel(!0),s(this,R,_i).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(r(this,Ce).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return r(this,Ce).text}announce(e){r(this,Ce).announce(e)}pickUp(e){let t=typeof e=="string"?this.card(e):e;if(!t||t.locked||t.pending)return!1;let i=s(this,R,Es).call(this,t);return i?(s(this,R,_i).call(this,!1),r(this,ke).cancel(!0),g(this,de,{card:t,column:i.column,index:i.index}),t.moving=!0,s(this,R,gf).call(this,t),r(this,ke).pickUp({group:i.group,index:i.index}),!0):!1}cancelMove(){let e=r(this,te);e?.started&&(s(this,R,_i).call(this,!1),r(this,Ce).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),r(this,ke).cancel()}moveCard(e,t,i){let a=typeof e=="string"?this.card(e):e,l=typeof t=="string"?this.column(t):t;if(!a||!l)return!1;let d=s(this,R,Es).call(this,a);if(!d)return!1;let m=l.cards.filter(v=>v!==a).length,u=Math.max(0,Math.min(i??m,m));return s(this,R,yh).call(this,a,d.column,d.index,l,u,"api")}revert(e){let t=typeof e=="string"?this.card(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Er).get(t);if(this.controlled||!i||(r(this,Er).delete(t),!i.from.isConnected||!this.contains(i.from)))return!1;let a=t.matches(":focus-within");return s(this,R,Up).call(this,t,i.from,i.fromIndex),i.totals&&s(this,R,Vp).call(this,i.to,i.from),s(this,R,jp).call(this,i.to,i.from,a?t:null),r(this,Ce).announce(this.t("reverted",{card:t.name,column:i.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
2475
2630
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
2476
|
-
</div>`}};
|
|
2631
|
+
</div>`}};Ce=new WeakMap,ke=new WeakMap,de=new WeakMap,Er=new WeakMap,te=new WeakMap,R=new WeakSet,Bp=function(e,t){let i=this.columns[t.group];return this.t(e,{card:r(this,de)?.card.name??"",column:i?.heading??"",position:t.index+1,count:r(this,ke).slotCount(t.group)})},Es=function(e){let t=this.columns,i=t.findIndex(a=>a.contains(e)&&e.parentElement===a);return i<0?null:{column:t[i],group:i,index:t[i].cards.indexOf(e)}},gf=function(e){let t=()=>!!e.shadowRoot?.activeElement?.classList.contains("handle");e.focusHandle({preventScroll:!0}),requestAnimationFrame(()=>{r(this,de)?.card===e&&!t()&&e.focusHandle({preventScroll:!0})})},Fp=function(){r(this,de)&&(r(this,de).card.moving=!1),g(this,de,null)},bf=function(e){let t=r(this,de);if(this.columns.forEach((i,a)=>{i._drop=t&&e&&a===e.group?{card:t.card,index:e.index,height:t.card.getBoundingClientRect().height}:null}),e){let i=this.columns[e.group];i?.updateComplete.then(()=>{let a=i.renderRoot.querySelector("li.drop")??(t&&t.column===i?t.card:i);s(this,R,ff).call(this,i,a)})}},ff=function(e,t){let i=this.renderRoot.querySelector(".columns");if(i){let l=i.getBoundingClientRect(),d=e.getBoundingClientRect();d.left<l.left?i.scrollLeft-=l.left-d.left+8:d.right>l.right&&(i.scrollLeft+=d.right-l.right+8)}let a=e.scrollElement;if(a){let l=a.getBoundingClientRect(),d=t.getBoundingClientRect();d.top<l.top?a.scrollTop-=l.top-d.top+8:d.bottom>l.bottom&&(a.scrollTop+=d.bottom-l.bottom+8)}},vf=function(e,t){let i=r(this,de);if(s(this,R,Fp).call(this),!i)return;let a=this.columns[t.group];s(this,R,yh).call(this,i.card,i.column,e.index,a,t.index,"keyboard")},yf=function(e){let t=e[0];if(!(t instanceof HTMLElement)||!t.classList?.contains("handle"))return null;let i=e.find(a=>a.localName==="cm-board-card");return i&&s(this,R,Es).call(this,i)?i:null},Jo=new WeakMap,xf=function(e,t){let i=s(this,R,Es).call(this,e);if(!i)return null;let a=i.column.cards;if(t==="ArrowDown")return a[i.index+1]??null;if(t==="ArrowUp")return a[i.index-1]??null;let l=t==="ArrowRight"?1:-1,d=this.columns;for(let m=i.group+l;m>=0&&m<d.length;m+=l){let u=d[m].cards;if(u.length)return u[Math.min(i.index,u.length-1)]}return null},Zo=new WeakMap,jp=function(e,t,i){e._sync(),t._sync().then(()=>{i?.isConnected&&i.focusHandle({preventScroll:!0})})},Up=function(e,t,i){let a=t.cards.filter(d=>d!==e),l=a[i];l?l.before(e):a.length?a[a.length-1].after(e):t.append(e)},Vp=function(e,t){e!==t&&(typeof e.total=="number"&&(e.total=Math.max(0,e.total-1)),typeof t.total=="number"&&(t.total=t.total+1))},yh=function(e,t,i,a,l,d){let m=e.name;if(t===a&&i===l)return d!=="api"&&r(this,Ce).announce(this.t("sameSpot",{card:m})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let u=[],v={value:e.key,card:e,from:t.key,to:a.key,fromColumn:t,toColumn:a,fromIndex:i,toIndex:l,source:d,waitUntil:y=>{u.push(Promise.resolve(y))}};if(!this.dispatchEvent(new CustomEvent("cm-move",{detail:v,bubbles:!0,composed:!0,cancelable:!0})))return r(this,Ce).announce(this.t("refused",{card:m,column:a.heading})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let w=a.cards.filter(y=>y!==e).length+1;if(this.controlled)d==="keyboard"&&s(this,R,wf).call(this,e.key,a);else{let y=d==="keyboard"||e.matches(":focus-within");s(this,R,Up).call(this,e,a,l);let M=t!==a;M&&s(this,R,Vp).call(this,t,a),r(this,Er).set(e,{card:e,from:t,fromIndex:i,to:a,toIndex:l,totals:M}),s(this,R,jp).call(this,t,a,y?e:null)}return r(this,Ce).announce(this.t("moved",{card:m,column:a.heading,position:l+1,count:w})),u.length&&(e.pending=!0,Promise.all(u).then(()=>{e.pending=!1,this.controlled||r(this,Er).delete(e)},()=>{e.pending=!1,this.controlled?r(this,Ce).announce(this.t("reverted",{card:m,column:t.heading})):this.revert(e)})),!0},wf=function(e,t){let i=()=>t.isConnected?t.cards.find(d=>d.key===e):void 0,a=()=>{let d=i(),m=!document.activeElement||document.activeElement===document.body||!document.activeElement.isConnected;return!d||!(m||this.contains(document.activeElement))?!1:(t._sync().then(()=>d.updateComplete).then(()=>{d.isConnected&&d.focusHandle({preventScroll:!0})}),!0)},l=new MutationObserver(()=>{a()&&l.disconnect()});l.observe(this,{childList:!0,subtree:!0}),setTimeout(()=>l.disconnect(),1e3)},Qo=new WeakMap,el=new WeakMap,tl=new WeakMap,il=new WeakMap,rl=new WeakMap,al=new WeakMap,sl=new WeakMap,Kp=function(){let e=r(this,te);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges();let t=e.card.cloneNode(!0);t.removeAttribute("id"),t.removeAttribute("moving"),t.setAttribute("ghost",""),t.setAttribute("aria-hidden","true"),t.setAttribute("inert",""),Object.assign(t.style,{position:"fixed",zIndex:"2147483000",left:"0",top:"0",width:`${e.width}px`,margin:"0",pointerEvents:"none",willChange:"transform"}),(this.ownerDocument.body??this.ownerDocument.documentElement).appendChild(t),e.ghost=t,e.card.moving=!0,this.dragging=!0,e.to=e.from,e.toIndex=e.fromIndex,r(this,Ce).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),s(this,R,Wp).call(this),s(this,R,xh).call(this);let i=()=>{r(this,te)?.started&&(s(this,R,$f).call(this),r(this,te).raf=requestAnimationFrame(i))};e.raf=requestAnimationFrame(i)},Wp=function(){let e=r(this,te);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},xh=function(){let e=r(this,te);if(!e)return;let t=this.columns;if(!t.length)return;let i=t[0],a=1/0;for(let u of t){let v=u.getBoundingClientRect(),b=e.x<v.left?v.left-e.x:e.x>v.right?e.x-v.right:0;b<a&&(i=u,a=b)}let l=i.cards.filter(u=>u!==e.card),d=l.length;if(i.collapsed)d=0;else for(let u=0;u<l.length;u++){let v=l[u].getBoundingClientRect();if(e.y<v.top+v.height/2){d=u;break}}if(i===e.to&&d===e.toIndex)return;let m=i!==e.to;e.to=i,e.toIndex=d,t.forEach(u=>{u._drop=u===i?{card:e.card,index:d,height:e.height}:null}),m&&r(this,Ce).announce(this.t("over",{column:i.heading,position:d+1,count:l.length+1}))},$f=function(){let e=r(this,te);if(!e)return;let t=48,i=16,a=w=>w<t?Math.ceil((t-Math.max(w,0))/t*i):0,l=!1,d=this.renderRoot.querySelector(".columns");if(d){let w=d.getBoundingClientRect(),y=a(e.x-w.left),M=a(w.right-e.x),D=d.scrollLeft;y?d.scrollLeft-=y:M&&(d.scrollLeft+=M),l||=d.scrollLeft!==D}let m=e.to?.scrollElement;if(m&&m.scrollHeight>m.clientHeight){let w=m.getBoundingClientRect();if(e.x>=w.left&&e.x<=w.right){let y=a(e.y-w.top),M=a(w.bottom-e.y),D=m.scrollTop;y?m.scrollTop-=y:M&&(m.scrollTop+=M),l||=m.scrollTop!==D}}let u=window.innerHeight,v=a(e.y),b=a(u-e.y);if(v||b){let w=window.scrollY;window.scrollBy(0,v?-v:b),l||=window.scrollY!==w}l&&s(this,R,xh).call(this)},_i=function(e){let t=r(this,te);t&&(g(this,te,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,rl),!0),window.removeEventListener("pointerup",r(this,al),!0),window.removeEventListener("pointercancel",r(this,sl),!0),window.removeEventListener("touchmove",r(this,tl),!0),window.removeEventListener("contextmenu",r(this,il),!0),t.ghost?.remove(),t.started&&(t.card.moving=!1,this.dragging=!1,this.columns.forEach(i=>{i._drop=null}),e&&t.to&&t.toIndex!==void 0&&s(this,R,yh).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},Ms.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},Ms.styles=[k,x`
|
|
2477
2632
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
2478
2633
|
.board { height: 100%; }
|
|
2479
2634
|
.columns {
|
|
@@ -2487,90 +2642,90 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2487
2642
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
2488
2643
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
2489
2644
|
}
|
|
2490
|
-
`];$("cm-board",ts);var o1=_("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),os=class extends S{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};os.properties={value:{reflect:!0},heading:{},label:{},start:{},end:{},allDay:{type:Boolean,attribute:"all-day",reflect:!0},kind:{},tone:{reflect:!0},icon:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0}},os.styles=x`:host { display: none !important; }`;$("cm-calendar-event",os);var Ld=l=>String(l).padStart(2,"0"),cb=l=>`${P(l)}T${Ld(l.getHours())}:${Ld(l.getMinutes())}`,Md=(l,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(l.getFullYear(),l.getMonth(),l.getDate()))/864e5),db=["month","week","day"],ov=600,hb=new Map,pb=(l,n)=>{let e=`${l}|${JSON.stringify(n)}`,t=hb.get(e);return t||(t=new Intl.DateTimeFormat(l,n),hb.set(e,t)),t},Bp=l=>l.replace(/[ ]/g," ").trim(),cs,Te,ze,be,X,J,ur,xt,Ve,qo,ki,ds,hs,ps,ms,Bo,b,xe,wi,Do,Td,yt,Fp,Ao,ct,jp,mb,dt,ss,ub,gb,je,Ro,No,zd,bb,fb,vb,mr,Vp,Ho,yb,Io,xb,wb,$b,kb,Fo,jo,Eb,Mb,Vo,Po,Tb,Up,Kp,Wp,zb,_b,Yp,Gp,Xp,Uo,Jp,Cb,Ko,Wo,Yo,Go,Xo,Jo,Zp,_d,Sb,$i,Oo,Lb,Qp,Db,Cd,em,ns,Sd,Ab,Rb,Nb,Hb,Ib,ls=class extends T{constructor(){super();m(this,b);this.view="month";this.date="";this.today="";this.step=15;m(this,cs,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;m(this,Te,D("cm-cal"));m(this,ze,new cr);m(this,be);m(this,X,null);m(this,J,null);m(this,ur,new WeakMap);m(this,xt,"");m(this,Ve,null);m(this,qo,"");m(this,ki,!0);m(this,ds,0);m(this,hs,!1);m(this,ps);m(this,ms,0);m(this,Bo,new MutationObserver(()=>this.requestUpdate()));m(this,Fo,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){f(this,xt,t.dataset.k);for(let i of s(this,b,Io).call(this))i.tabIndex=i===t?0:-1}});m(this,jo,e=>{let t=e.relatedTarget;if(this._more&&!r(this,X)){let i=this.renderRoot.querySelector(".pop"),a=e.composedPath()[0];i&&i.contains(a)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,be).active||!r(this,X)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,be).active||!r(this,X))return;this.renderRoot.activeElement?.dataset.ev!==r(this,X).ev.key&&r(this,be).cancel()}))});m(this,Vo,e=>{if(r(this,J)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=G(e,this);if(r(this,be).active){r(this,be).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let a=i.closest(".pop");if(a&&e.key==="Escape"){e.preventDefault(),s(this,b,Cd).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),f(this,ds,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(a&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...a.querySelectorAll(".chip")],p=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];p&&(e.preventDefault(),p.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),s(this,b,Mb).call(this,i,e.key==="PageUp"?-1:1);return}let o=s(this,b,Eb).call(this,i,t);o?(e.preventDefault(),s(this,b,kb).call(this,o)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});m(this,Uo,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});m(this,Ko,e=>{if(r(this,J)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(p=>p.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),a=i&&s(this,b,ss).call(this,i);if(!a||i.locked||i.pending)return;let o=s(this,b,Kp).call(this,a,t.dataset.day??a.days[0]);if(!o)return;r(this,be).active&&r(this,be).cancel();let d=0;if(o.mode==="time"){let p=s(this,b,Jp).call(this,e.clientX,e.clientY);p&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,p.min-a.min)))}f(this,J,{...o,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...o.from}}),e.pointerType!=="mouse"&&(r(this,J).timer=setTimeout(()=>{r(this,J)&&!r(this,J).started&&s(this,b,Zp).call(this)},300)),window.addEventListener("pointermove",r(this,Go),!0),window.addEventListener("pointerup",r(this,Xo),!0),window.addEventListener("pointercancel",r(this,Jo),!0),window.addEventListener("touchmove",r(this,Wo),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,Yo),!0)});m(this,Wo,e=>{r(this,J)?.started&&e.cancelable&&e.preventDefault()});m(this,Yo,e=>{r(this,J)&&e.preventDefault()});m(this,Go,e=>{let t=r(this,J);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,b,Zp).call(this):s(this,b,$i).call(this,!1));return}e.preventDefault(),s(this,b,_d).call(this)}});m(this,Xo,e=>{let t=r(this,J);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,b,$i).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,b,$i).call(this,!0)});m(this,Jo,e=>{r(this,J)&&e.pointerId===r(this,J).pointerId&&s(this,b,$i).call(this,!1)});f(this,be,new lr({groupCount:()=>s(this,b,dt).call(this).length,slotCount:()=>r(this,X)?r(this,X).mode==="day"?1:s(this,b,Po).call(this,r(this,X).ev.dur):0,navigate:(e,t)=>s(this,b,Tb).call(this,e,t),onTarget:e=>s(this,b,zb).call(this,e),onDrop:(e,t)=>s(this,b,_b).call(this,e,t),onCancel:()=>s(this,b,Wp).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,X)?.ev.name??"",place:s(this,b,mr).call(this,r(this,X),e)}),over:e=>this.t("over",{place:s(this,b,mr).call(this,r(this,X),e)}),cancelled:e=>this.t("cancelled",{event:r(this,X)?.ev.name??"",place:s(this,b,mr).call(this,r(this,X),e)})},announce:e=>r(this,ze).announce(e)}))}get locale(){return r(this,cs)}set locale(e){let t=r(this,cs);f(this,cs,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=s(this,b,dt).call(this);return{view:r(this,b,xe),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,X)?.ev.el??null}get announcement(){return r(this,ze).text}announce(e){r(this,ze).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,Vo)),this.addEventListener("focusin",r(this,Fo)),this.addEventListener("focusout",r(this,jo)),this.addEventListener("pointerdown",r(this,Ko)),this.addEventListener("dragstart",r(this,Uo)),r(this,Bo).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(f(this,ps,new ResizeObserver(()=>{cancelAnimationFrame(r(this,ms)),f(this,ms,requestAnimationFrame(()=>s(this,b,Vp).call(this)))})),r(this,ps).observe(this)),s(this,b,Vp).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,Vo)),this.removeEventListener("focusin",r(this,Fo)),this.removeEventListener("focusout",r(this,jo)),this.removeEventListener("pointerdown",r(this,Ko)),this.removeEventListener("dragstart",r(this,Uo)),r(this,Bo).disconnect(),r(this,ps)?.disconnect(),cancelAnimationFrame(r(this,ms)),r(this,be).cancel(!0),s(this,b,$i).call(this,!1)}willUpdate(e){e.has("view")&&(f(this,ki,!0),e.get("view")!==void 0&&(this._more="",r(this,be).cancel(!0))),(e.has("date")||e.has("_narrow"))&&(this._more=this._more&&this.range.start<=this._more&&this._more<=this.range.end?this._more:"")}firstUpdated(){this.renderRoot.appendChild(r(this,ze).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&f(this,ki,!0),s(this,b,$b).call(this),r(this,Ve)){let o=s(this,b,xb).call(this,r(this,Ve).key);o?(f(this,Ve,null),o.focus({preventScroll:!1})):Date.now()>r(this,Ve).until&&f(this,Ve,null)}r(this,hs)&&(f(this,hs,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,ki)){let o=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));o&&(t.scrollTop=o.offsetHeight*d),f(this,ki,!1)}t||f(this,ki,!0),r(this,X)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,a=`${i.view}|${i.start}|${i.end}`;a!==r(this,qo)&&(f(this,qo,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,b,Ho).call(this,r(this,b,ct),-1))}next(){this.date=P(s(this,b,Ho).call(this,r(this,b,ct),1))}goToToday(){this.date=r(this,b,Ao)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let a=s(this,b,ss).call(this,i);if(!a)return!1;let o=s(this,b,dt).call(this).map(P),d=t&&a.days.includes(t)&&o.includes(t)?t:a.days.find(v=>o.includes(v));if(!d)return!1;let p=s(this,b,Kp).call(this,a,d);if(!p)return!1;s(this,b,$i).call(this,!1),r(this,be).cancel(!0),this._more="",f(this,X,p),i.moving=!0;let u=`ev:${a.key}:${d}`;return f(this,xt,u),f(this,Ve,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,be).pickUp(p.from),!0}cancelMove(){let e=r(this,J);e?.started&&(s(this,b,$i).call(this,!1),r(this,ze).announce(this.t("cancelled",{event:e.ev.name,place:s(this,b,mr).call(this,e,e.from)}))),r(this,be).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,o=a&&s(this,b,ss).call(this,a);if(!o)return!1;let d=o.allDay?H(Xe(t).date||t):ut(t);if(!d)return!1;let p=i?o.allDay?H(Xe(i).date||i):ut(i):null;return(!p||p<d)&&(p=o.allDay?K(d,Md(o.start,o.end)):new Date(d.getTime()+o.dur*6e4)),s(this,b,Xp).call(this,o,d,p,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,ur).get(t);if(this.controlled||!i)return!1;r(this,ur).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let o=s(this,b,ss).call(this,t);return o&&a&&f(this,Ve,{key:`ev:${o.key}:${o.days[0]}`,until:Date.now()+1e3}),r(this,ze).announce(this.t("reverted",{event:t.name,place:o?s(this,b,zd).call(this,o):i.start})),!0}render(){let e=s(this,b,dt).call(this),t=s(this,b,gb).call(this,s(this,b,ub).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2491
|
-
${s(this,
|
|
2492
|
-
${r(this,
|
|
2645
|
+
`];$("cm-board",Ms);var Xk=z("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),Ls=class extends S{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};Ls.properties={value:{reflect:!0},heading:{},label:{},start:{},end:{},allDay:{type:Boolean,attribute:"all-day",reflect:!0},kind:{},tone:{reflect:!0},icon:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0}},Ls.styles=x`:host { display: none !important; }`;$("cm-calendar-event",Ls);var _h=o=>String(o).padStart(2,"0"),kf=o=>`${P(o)}T${_h(o.getHours())}:${_h(o.getMinutes())}`,$h=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Ef=["month","week","day"],zy=600,Mf=new Map,Tf=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Mf.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Mf.set(e,t)),t},Gp=o=>o.replace(/[ ]/g," ").trim(),As,Se,Le,xe,Z,Q,Tr,Et,We,ul,Di,Rs,Hs,Ns,Is,gl,f,Ee,Si,nl,kh,kt,Yp,ol,mt,Xp,zf,pt,Cs,_f,Cf,Ke,ll,cl,Eh,Sf,Lf,Df,Mr,Jp,dl,Af,hl,Rf,Hf,Nf,If,bl,fl,Pf,Of,vl,ml,qf,Zp,Qp,eu,Bf,Ff,tu,iu,ru,yl,au,jf,xl,wl,$l,kl,El,Ml,su,Mh,Uf,Li,pl,Vf,nu,Kf,Th,ou,Ss,zh,Wf,Gf,Yf,Xf,Jf,Ds=class extends T{constructor(){super();p(this,f);this.view="month";this.date="";this.today="";this.step=15;p(this,As,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;p(this,Se,A("cm-cal"));p(this,Le,new wr);p(this,xe);p(this,Z,null);p(this,Q,null);p(this,Tr,new WeakMap);p(this,Et,"");p(this,We,null);p(this,ul,"");p(this,Di,!0);p(this,Rs,0);p(this,Hs,!1);p(this,Ns);p(this,Is,0);p(this,gl,new MutationObserver(()=>this.requestUpdate()));p(this,bl,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Et,t.dataset.k);for(let i of s(this,f,hl).call(this))i.tabIndex=i===t?0:-1}});p(this,fl,e=>{let t=e.relatedTarget;if(this._more&&!r(this,Z)){let i=this.renderRoot.querySelector(".pop"),a=e.composedPath()[0];i&&i.contains(a)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,xe).active||!r(this,Z)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,xe).active||!r(this,Z))return;this.renderRoot.activeElement?.dataset.ev!==r(this,Z).ev.key&&r(this,xe).cancel()}))});p(this,vl,e=>{if(r(this,Q)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=J(e,this);if(r(this,xe).active){r(this,xe).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let a=i.closest(".pop");if(a&&e.key==="Escape"){e.preventDefault(),s(this,f,Th).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,Rs,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(a&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...a.querySelectorAll(".chip")],m=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];m&&(e.preventDefault(),m.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),s(this,f,Of).call(this,i,e.key==="PageUp"?-1:1);return}let l=s(this,f,Pf).call(this,i,t);l?(e.preventDefault(),s(this,f,If).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});p(this,yl,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});p(this,xl,e=>{if(r(this,Q)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(m=>m.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),a=i&&s(this,f,Cs).call(this,i);if(!a||i.locked||i.pending)return;let l=s(this,f,Qp).call(this,a,t.dataset.day??a.days[0]);if(!l)return;r(this,xe).active&&r(this,xe).cancel();let d=0;if(l.mode==="time"){let m=s(this,f,au).call(this,e.clientX,e.clientY);m&&t.classList.contains("time")&&(d=Math.max(0,Math.min(a.dur,m.min-a.min)))}g(this,Q,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,Q).timer=setTimeout(()=>{r(this,Q)&&!r(this,Q).started&&s(this,f,su).call(this)},300)),window.addEventListener("pointermove",r(this,kl),!0),window.addEventListener("pointerup",r(this,El),!0),window.addEventListener("pointercancel",r(this,Ml),!0),window.addEventListener("touchmove",r(this,wl),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,$l),!0)});p(this,wl,e=>{r(this,Q)?.started&&e.cancelable&&e.preventDefault()});p(this,$l,e=>{r(this,Q)&&e.preventDefault()});p(this,kl,e=>{let t=r(this,Q);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?s(this,f,su).call(this):s(this,f,Li).call(this,!1));return}e.preventDefault(),s(this,f,Mh).call(this)}});p(this,El,e=>{let t=r(this,Q);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){s(this,f,Li).call(this,!1);return}let i=a=>{a.stopPropagation(),a.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),s(this,f,Li).call(this,!0)});p(this,Ml,e=>{r(this,Q)&&e.pointerId===r(this,Q).pointerId&&s(this,f,Li).call(this,!1)});g(this,xe,new xr({groupCount:()=>s(this,f,pt).call(this).length,slotCount:()=>r(this,Z)?r(this,Z).mode==="day"?1:s(this,f,ml).call(this,r(this,Z).ev.dur):0,navigate:(e,t)=>s(this,f,qf).call(this,e,t),onTarget:e=>s(this,f,Bf).call(this,e),onDrop:(e,t)=>s(this,f,Ff).call(this,e,t),onCancel:()=>s(this,f,eu).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,Z)?.ev.name??"",place:s(this,f,Mr).call(this,r(this,Z),e)}),over:e=>this.t("over",{place:s(this,f,Mr).call(this,r(this,Z),e)}),cancelled:e=>this.t("cancelled",{event:r(this,Z)?.ev.name??"",place:s(this,f,Mr).call(this,r(this,Z),e)})},announce:e=>r(this,Le).announce(e)}))}get locale(){return r(this,As)}set locale(e){let t=r(this,As);g(this,As,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=s(this,f,pt).call(this);return{view:r(this,f,Ee),start:P(e[0]),end:P(e[e.length-1])}}get heldEvent(){return r(this,Z)?.ev.el??null}get announcement(){return r(this,Le).text}announce(e){r(this,Le).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,vl)),this.addEventListener("focusin",r(this,bl)),this.addEventListener("focusout",r(this,fl)),this.addEventListener("pointerdown",r(this,xl)),this.addEventListener("dragstart",r(this,yl)),r(this,gl).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,Ns,new ResizeObserver(()=>{cancelAnimationFrame(r(this,Is)),g(this,Is,requestAnimationFrame(()=>s(this,f,Jp).call(this)))})),r(this,Ns).observe(this)),s(this,f,Jp).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,vl)),this.removeEventListener("focusin",r(this,bl)),this.removeEventListener("focusout",r(this,fl)),this.removeEventListener("pointerdown",r(this,xl)),this.removeEventListener("dragstart",r(this,yl)),r(this,gl).disconnect(),r(this,Ns)?.disconnect(),cancelAnimationFrame(r(this,Is)),r(this,xe).cancel(!0),s(this,f,Li).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,Di,!0),e.get("view")!==void 0&&(this._more="",r(this,xe).cancel(!0))),(e.has("date")||e.has("_narrow"))&&(this._more=this._more&&this.range.start<=this._more&&this._more<=this.range.end?this._more:"")}firstUpdated(){this.renderRoot.appendChild(r(this,Le).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,Di,!0),s(this,f,Nf).call(this),r(this,We)){let l=s(this,f,Rf).call(this,r(this,We).key);l?(g(this,We,null),l.focus({preventScroll:!1})):Date.now()>r(this,We).until&&g(this,We,null)}r(this,Hs)&&(g(this,Hs,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,Di)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,Di,!1)}t||g(this,Di,!0),r(this,Z)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,a=`${i.view}|${i.start}|${i.end}`;a!==r(this,ul)&&(g(this,ul,a),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=P(s(this,f,dl).call(this,r(this,f,mt),-1))}next(){this.date=P(s(this,f,dl).call(this,r(this,f,mt),1))}goToToday(){this.date=r(this,f,ol)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let a=s(this,f,Cs).call(this,i);if(!a)return!1;let l=s(this,f,pt).call(this).map(P),d=t&&a.days.includes(t)&&l.includes(t)?t:a.days.find(v=>l.includes(v));if(!d)return!1;let m=s(this,f,Qp).call(this,a,d);if(!m)return!1;s(this,f,Li).call(this,!1),r(this,xe).cancel(!0),this._more="",g(this,Z,m),i.moving=!0;let u=`ev:${a.key}:${d}`;return g(this,Et,u),g(this,We,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,xe).pickUp(m.from),!0}cancelMove(){let e=r(this,Q);e?.started&&(s(this,f,Li).call(this,!1),r(this,Le).announce(this.t("cancelled",{event:e.ev.name,place:s(this,f,Mr).call(this,e,e.from)}))),r(this,xe).cancel()}moveEvent(e,t,i){let a=typeof e=="string"?this.event(e):e,l=a&&s(this,f,Cs).call(this,a);if(!l)return!1;let d=l.allDay?N(Qe(t).date||t):vt(t);if(!d)return!1;let m=i?l.allDay?N(Qe(i).date||i):vt(i):null;return(!m||m<d)&&(m=l.allDay?G(d,$h(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),s(this,f,ru).call(this,l,d,m,"api",!1,P(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Tr).get(t);if(this.controlled||!i)return!1;r(this,Tr).delete(t);let a=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=s(this,f,Cs).call(this,t);return l&&a&&g(this,We,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Le).announce(this.t("reverted",{event:t.name,place:l?s(this,f,Eh).call(this,l):i.start})),!0}render(){let e=s(this,f,pt).call(this),t=s(this,f,Cf).call(this,s(this,f,_f).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
2646
|
+
${s(this,f,Wf).call(this,e)}
|
|
2647
|
+
${r(this,f,Ee)==="month"?s(this,f,Yf).call(this,e,t):s(this,f,Jf).call(this,e,t)}
|
|
2493
2648
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
2494
|
-
<span id="${r(this,
|
|
2495
|
-
<span id="${r(this,
|
|
2496
|
-
<span id="${r(this,
|
|
2497
|
-
</div>`}};cs=new WeakMap,Te=new WeakMap,ze=new WeakMap,be=new WeakMap,X=new WeakMap,J=new WeakMap,ur=new WeakMap,xt=new WeakMap,Ve=new WeakMap,qo=new WeakMap,ki=new WeakMap,ds=new WeakMap,hs=new WeakMap,ps=new WeakMap,ms=new WeakMap,Bo=new WeakMap,b=new WeakSet,xe=function(){return db.includes(this.view)?this.view:"month"},wi=function(){return Vr(this,this.locale)},Do=function(){return Kr(r(this,b,wi))},Td=function(){return uc(r(this,b,wi),this.hourCycle)},yt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Fp=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ur(r(this,b,wi)):(Math.trunc(e)%7+7)%7},Ao=function(){return H(this.today)?this.today:wh()},ct=function(){return H(this.date)??H(r(this,b,Ao))},jp=function(){return r(this,b,xe)==="month"&&this._narrow},mb=function(){return r(this,b,xe)!=="month"},dt=function(){let e=r(this,b,ct),t=r(this,b,Fp);if(r(this,b,xe)==="day")return[e];if(r(this,b,xe)==="week"){if(this._narrow)return[e,K(e,1),K(e,2)];let d=K(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(p,u)=>K(d,u))}let i=Ct(e),a=K(i,-((i.getDay()-t+7)%7)),o=Math.ceil((Md(a,Fr(e))+1)/7)*7;return Array.from({length:o},(d,p)=>K(a,p))},ss=function(e){let t=e.name,i=!!H(e.start),a=e.allDay||i;if(a){let u=H(Xe(e.start).date||e.start);if(!u)return null;let v=H(Xe(e.end).date||e.end)??u;v<u&&(v=u);let g=Math.min(Md(u,v),366);return{el:e,key:e.key,name:t,allDay:a,start:u,end:v,min:0,dur:1440,days:Array.from({length:g+1},(w,y)=>P(K(u,y)))}}let o=ut(e.start);if(!o)return null;let d=ut(e.end);(!d||d<=o)&&(d=new Date(o.getTime()+30*6e4));let p=Math.max(1,Math.round((d.getTime()-o.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:a,start:o,end:d,min:o.getHours()*60+o.getMinutes(),dur:p,days:[P(o)]}},ub=function(){return this.events.map(e=>s(this,b,ss).call(this,e)).filter(e=>!!e)},gb=function(e){let t=new Map;for(let i of e)for(let a of i.days)(t.get(a)??t.set(a,[]).get(a)).push(i);for(let i of t.values())i.sort((a,o)=>(a.allDay===o.allDay?0:a.allDay?-1:1)||a.start.getTime()-o.start.getTime()||a.name.localeCompare(o.name));return t},je=function(e){return ie(e,{weekday:"long",day:"numeric",month:"long"},r(this,b,wi))},Ro=function(e){return r(this,b,Td).format((e%1440+1440)%1440)},No=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=pb(r(this,b,wi),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let p=a.formatRangeToParts(e,t),u=p.findIndex(g=>g.source==="endRange"),v=-1;if(p.forEach((g,w)=>{g.source==="startRange"&&(v=w)}),v>=0&&u>v){let g=w=>Bp(w.map(y=>y.value).join(""));return this.t("timeRange",{start:g(p.slice(0,v+1)),end:g(p.slice(u))})}}}catch{}let o=P(e)===P(t),d=p=>o?s(this,b,Ro).call(this,p.getHours()*60+p.getMinutes()):r(this,b,Td).dateTime(p);return this.t("timeRange",{start:d(e),end:d(t)})},zd=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,b,je).call(this,e.start)}):this.t("allDayRange",{start:s(this,b,je).call(this,e.start),end:s(this,b,je).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&Md(e.start,e.end)===1)?s(this,b,No).call(this,e.start,e.end):this.t("timed",{date:s(this,b,je).call(this,e.start),time:s(this,b,No).call(this,e.start,e.end)})},bb=function(e){let t={title:e.name,when:s(this,b,zd).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},fb=function(e){let t=r(this,b,wi);if(r(this,b,xe)==="month")return r(this,b,Do).monthYear(r(this,b,ct));if(e.length===1)return ie(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=pb(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Bp(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},vb=function(e){return r(this,b,Td).hour12?Bp(ie(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,b,wi))):s(this,b,Ro).call(this,e*60)},mr=function(e,t){let{start:i,end:a}=s(this,b,Up).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,b,je).call(this,i),time:s(this,b,No).call(this,i,a)}):s(this,b,je).call(this,K(H(e.origin),t.group-e.from.group))},Vp=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<ov;t!==this._narrow&&(this._narrow=t)},Ho=function(e,t){return r(this,b,xe)==="month"?Ge(e,t):r(this,b,xe)==="week"?K(e,t*(this._narrow?3:7)):K(e,t)},yb=function(e){this.view!==e&&(this.view=e)},Io=function(){return[...this.renderRoot.querySelectorAll(".item")]},xb=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(a=>a.dataset.k===e&&a.classList.contains("item"))??t.find(a=>a.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let a=e.slice(e.lastIndexOf(":")+1);return t.find(o=>o.dataset.k===`more:${a}`)??null}return null},wb=function(){let e=P(r(this,b,ct));if(r(this,b,jp))return`day:${e}`;if(r(this,b,xe)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},$b=function(){let e=s(this,b,Io).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,xt))??e.find(i=>i.dataset.k===s(this,b,wb).call(this))??e.find(i=>i.dataset.day===P(r(this,b,ct)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},kb=function(e){f(this,xt,e.dataset.k??"");for(let t of s(this,b,Io).call(this))t.tabIndex=t===e?0:-1;e.focus()},Fo=new WeakMap,jo=new WeakMap,Eb=function(e,t){let i=new Map;for(let y of s(this,b,Io).call(this)){let M=Number(y.dataset.i);(i.get(M)??i.set(M,[]).get(M)).push(y)}let a=Number(e.dataset.i),o=i.get(a)??[e],d=Math.max(0,o.indexOf(e)),p=s(this,b,dt).call(this).length,u=r(this,b,xe)==="month",v=e.dataset.row,g=(y,M)=>{let R=y>=0&&y<p?i.get(y):void 0;return(R?.length?M(R):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(M=>M.dataset.row===v)??y[0];switch(t){case"ArrowRight":return g(a+1,w);case"ArrowLeft":return g(a-1,w);case"ArrowDown":return o[d+1]??(u?g(a+7,y=>y[0]):null);case"ArrowUp":return d>0?o[d-1]:u?g(a-7,y=>y[y.length-1]):null;case"Home":return u?g(a-a%7,y=>y[0]):g(0,w);case"End":return u?g(Math.min(p-1,a-a%7+6),y=>y[0]):g(p-1,w);default:return null}},Mb=function(e,t){let i=e.dataset.day??P(r(this,b,ct)),a=s(this,b,Ho).call(this,H(i)??r(this,b,ct),t),o=P(a),d=(e.dataset.k??"").split(":")[0],p;r(this,b,jp)?p=`day:${o}`:r(this,b,xe)==="month"?p=this.readonly?`cell:${o}`:`add:${o}`:d==="adadd"||e.dataset.row==="a"?p=`adadd:${o}`:p=`slot:${o}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,b,Ho).call(this,r(this,b,ct),t)),f(this,xt,p),f(this,Ve,{key:p,until:Date.now()+1e3})},Vo=new WeakMap,Po=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,b,yt))+1},Tb=function(e,t){let i=r(this,X);if(!i)return null;let a=s(this,b,dt).call(this).length,o=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,b,xe)==="month";switch(e){case"ArrowRight":return{group:o(t.group+1),index:0};case"ArrowLeft":return{group:o(t.group-1),index:0};case"ArrowDown":return v?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return v?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:v?t.group-t.group%7:0,index:0};case"End":return{group:v?o(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,b,Po).call(this,i.ev.dur)-1,p=Math.max(1,Math.round(60/r(this,b,yt))),u=v=>Math.max(0,Math.min(d,v));switch(e){case"ArrowRight":return{group:o(t.group+1),index:t.index};case"ArrowLeft":return{group:o(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+p)};case"PageUp":return{group:t.group,index:u(t.index-p)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Up=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,b,dt).call(this)[t.group]??H(e.origin),p=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,b,yt));return{start:p,end:new Date(p.getTime()+i.dur*6e4)}}let a=t.group-e.from.group,o=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+a,d.getHours(),d.getMinutes());return{start:o(i.start),end:o(i.end)}},Kp=function(e,t){let a=s(this,b,dt).call(this).map(P).indexOf(t);if(a<0)return null;let o=r(this,b,mb)&&!e.allDay?"time":"day",d=o==="time"?Math.min(Math.floor(e.min/r(this,b,yt)),s(this,b,Po).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:o,from:{group:a,index:d}}},Wp=function(){r(this,X)&&(r(this,X).ev.el.moving=!1),f(this,X,null),this._target=null},zb=function(e){let t=r(this,X);if(!t||!e){this._target=null;return}let i=P(s(this,b,dt).call(this)[e.group]??H(t.origin)),a=e.group===t.from.group&&e.index===t.from.index;this._target=a?null:{iso:i,min:t.mode==="time"?e.index*r(this,b,yt):void 0}},_b=function(e,t){let i=r(this,X);s(this,b,Wp).call(this),i&&(f(this,ds,performance.now()+400),s(this,b,Yp).call(this,i,e,t,"keyboard"))},Yp=function(e,t,i,a){let o=t.group===i.group&&t.index===i.index,{start:d,end:p}=s(this,b,Up).call(this,e,i),u=P(K(H(e.origin),i.group-t.group));s(this,b,Xp).call(this,e.ev,d,p,a,o,e.mode==="time"?P(d):u)},Gp=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:cb(t),end:cb(i)}},Xp=function(e,t,i,a,o,d){let p=e.el,u=e.name,v=s(this,b,Gp).call(this,e.allDay,e.start,e.end),g=s(this,b,Gp).call(this,e.allDay,t,i),w=U=>{a==="keyboard"&&f(this,Ve,{key:U,until:Date.now()+1e3})};if(o||v.start===g.start&&v.end===g.end)return a!=="api"&&r(this,ze).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},M=e.allDay?s(this,b,je).call(this,t):this.t("timed",{date:s(this,b,je).call(this,t),time:s(this,b,No).call(this,t,i)}),R=[],N={value:e.key,event:p,from:v,to:g,allDay:e.allDay,source:a,waitUntil:U=>{R.push(Promise.resolve(U))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:N,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,ur).set(p,v),p.start=g.start,p.end=g.end),w(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,ze).announce(this.t("moved",{event:u,place:y.allDay?s(this,b,je).call(this,t):M})),R.length&&(p.pending=!0,Promise.all(R).then(()=>{p.pending=!1,this.controlled||r(this,ur).delete(p)},()=>{p.pending=!1,this.controlled?r(this,ze).announce(this.t("reverted",{event:u,place:s(this,b,zd).call(this,e)})):this.revert(p)})),!0):(r(this,ze).announce(this.t("refused",{event:u,place:M})),this.requestUpdate(),!1)},Uo=new WeakMap,Jp=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let a=0,o=1/0;i.forEach((p,u)=>{let v=p.getBoundingClientRect(),g=e<v.left?v.left-e:e>v.right?e-v.right:0;g<o&&(o=g,a=Number(p.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},Cb=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let a=null,o=1/0;for(let d of i){let p=d.getBoundingClientRect(),u=e<p.left?p.left-e:e>p.right?e-p.right:0,v=t<p.top?p.top-t:t>p.bottom?t-p.bottom:0,g=Math.hypot(u,v);g<o&&(o=g,a=d)}return a?Number(a.dataset.i):null},Ko=new WeakMap,Wo=new WeakMap,Yo=new WeakMap,Go=new WeakMap,Xo=new WeakMap,Jo=new WeakMap,Zp=function(){let e=r(this,J);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,ze).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,b,mr).call(this,e,e.from)})),s(this,b,_d).call(this);let t=()=>{r(this,J)?.started&&(s(this,b,Sb).call(this),r(this,J).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},_d=function(){let e=r(this,J);if(!e)return;let t=null;if(e.mode==="time"){let o=s(this,b,Jp).call(this,e.x,e.y);if(o){let d=s(this,b,Po).call(this,e.ev.dur)-1;t={group:o.group,index:Math.max(0,Math.min(d,Math.round((o.min-e.grab)/r(this,b,yt))))}}}else{let o=s(this,b,Cb).call(this,e.x,e.y);o!==null&&(t={group:o,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let a=t.group===e.from.group&&t.index===e.from.index;this._target=a?null:{iso:P(s(this,b,dt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,b,yt):void 0},i&&r(this,ze).announce(this.t("over",{place:s(this,b,mr).call(this,e,t)}))},Sb=function(){let e=r(this,J),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,o=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let p=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=o(e.y-p),v=o(d.bottom-e.y),g=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==g&&s(this,b,_d).call(this)},$i=function(e){let t=r(this,J);t&&(f(this,J,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,Go),!0),window.removeEventListener("pointerup",r(this,Xo),!0),window.removeEventListener("pointercancel",r(this,Jo),!0),window.removeEventListener("touchmove",r(this,Wo),!0),window.removeEventListener("contextmenu",r(this,Yo),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,b,Yp).call(this,t,t.from,t.to,"pointer")))},Oo=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,b,xe)},bubbles:!0,composed:!0}))},Lb=function(e,t,i){let a=i*60;if(e.detail>0){let p=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-p.top)/p.height*60/r(this,b,yt))*r(this,b,yt);a+=Math.max(0,Math.min(59,u))}let o=Math.floor(a/60),d=a%60;s(this,b,Oo).call(this,`${t}T${Ld(o)}:${Ld(d)}`,!1)},Qp=function(e,t){if(performance.now()<r(this,ds)||r(this,be).active){e.preventDefault();return}this.dispatchEvent(new CustomEvent("cm-open",{detail:{value:t.key,event:t.el},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault()},Db=function(e){this._more=e,f(this,hs,!0)},Cd=function(e){let t=this._more;this._more="",e&&t&&(f(this,xt,`more:${t}`),f(this,Ve,{key:`more:${t}`,until:Date.now()+1e3}))},em=function(){return r(this,X)?.ev??(r(this,J)?.started?r(this,J).ev:null)},ns=function(e,t,i,a,o,d={}){let p=e.el,u=p.pending,v=s(this,b,bb).call(this,e),g=!this.readonly&&!p.locked&&!u,w=["attention","information","success","critical"].includes(p.tone)?p.tone:"neutral",y=`chip ${a} tone-${w}${o?" item":""}${p.moving?" moving":""}${u?" pending":""}${p.locked?" locked":""}`,M=p.icon?c`<cm-icon name=${p.icon} size="14"></cm-icon>`:h,R=e.allDay?h:c`<span class="tm">${s(this,b,Ro).call(this,e.min)}</span>`,N=p.kind&&(a!=="month"||!p.icon)?c`<span class="k">${p.kind}</span>`:h,F=u?c`<span class="spin" aria-hidden="true"></span>`:h,U=a==="time"?c`<span class="lead">${M}${R}${F}</span><span class="h">${e.name}</span>${N}`:c`${M}${R}<span class="h">${e.name}</span>${N}${F}`,te=u?`${v}, ${this.t("saving")}`:v,$t=g?`${r(this,Te)}-mv`:`${r(this,Te)}-op`,j=`ev:${e.key}:${t}`,He=g?this.t("roleDescription"):h;return p.href?c`<a class=${y} href=${p.href} style=${d.style??h} data-k=${j} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2498
|
-
data-row=${d.row??h} aria-label=${
|
|
2499
|
-
@click=${
|
|
2500
|
-
data-row=${d.row??h} aria-label=${
|
|
2501
|
-
@click=${
|
|
2649
|
+
<span id="${r(this,Se)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
2650
|
+
<span id="${r(this,Se)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
2651
|
+
<span id="${r(this,Se)}-op" hidden>${this.t("openHint")}</span>
|
|
2652
|
+
</div>`}};As=new WeakMap,Se=new WeakMap,Le=new WeakMap,xe=new WeakMap,Z=new WeakMap,Q=new WeakMap,Tr=new WeakMap,Et=new WeakMap,We=new WeakMap,ul=new WeakMap,Di=new WeakMap,Rs=new WeakMap,Hs=new WeakMap,Ns=new WeakMap,Is=new WeakMap,gl=new WeakMap,f=new WeakSet,Ee=function(){return Ef.includes(this.view)?this.view:"month"},Si=function(){return ba(this,this.locale)},nl=function(){return va(r(this,f,Si))},kh=function(){return bd(r(this,f,Si),this.hourCycle)},kt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Yp=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,f,Si)):(Math.trunc(e)%7+7)%7},ol=function(){return N(this.today)?this.today:Lm()},mt=function(){return N(this.date)??N(r(this,f,ol))},Xp=function(){return r(this,f,Ee)==="month"&&this._narrow},zf=function(){return r(this,f,Ee)!=="month"},pt=function(){let e=r(this,f,mt),t=r(this,f,Yp);if(r(this,f,Ee)==="day")return[e];if(r(this,f,Ee)==="week"){if(this._narrow)return[e,G(e,1),G(e,2)];let d=G(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(m,u)=>G(d,u))}let i=Ht(e),a=G(i,-((i.getDay()-t+7)%7)),l=Math.ceil(($h(a,ua(e))+1)/7)*7;return Array.from({length:l},(d,m)=>G(a,m))},Cs=function(e){let t=e.name,i=!!N(e.start),a=e.allDay||i;if(a){let u=N(Qe(e.start).date||e.start);if(!u)return null;let v=N(Qe(e.end).date||e.end)??u;v<u&&(v=u);let b=Math.min($h(u,v),366);return{el:e,key:e.key,name:t,allDay:a,start:u,end:v,min:0,dur:1440,days:Array.from({length:b+1},(w,y)=>P(G(u,y)))}}let l=vt(e.start);if(!l)return null;let d=vt(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let m=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:a,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:m,days:[P(l)]}},_f=function(){return this.events.map(e=>s(this,f,Cs).call(this,e)).filter(e=>!!e)},Cf=function(e){let t=new Map;for(let i of e)for(let a of i.days)(t.get(a)??t.set(a,[]).get(a)).push(i);for(let i of t.values())i.sort((a,l)=>(a.allDay===l.allDay?0:a.allDay?-1:1)||a.start.getTime()-l.start.getTime()||a.name.localeCompare(l.name));return t},Ke=function(e){return ae(e,{weekday:"long",day:"numeric",month:"long"},r(this,f,Si))},ll=function(e){return r(this,f,kh).format((e%1440+1440)%1440)},cl=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},a=Tf(r(this,f,Si),{hour:"numeric",minute:"2-digit",...i});try{if(P(e)===P(t)&&a.formatRangeToParts){let m=a.formatRangeToParts(e,t),u=m.findIndex(b=>b.source==="endRange"),v=-1;if(m.forEach((b,w)=>{b.source==="startRange"&&(v=w)}),v>=0&&u>v){let b=w=>Gp(w.map(y=>y.value).join(""));return this.t("timeRange",{start:b(m.slice(0,v+1)),end:b(m.slice(u))})}}}catch{}let l=P(e)===P(t),d=m=>l?s(this,f,ll).call(this,m.getHours()*60+m.getMinutes()):r(this,f,kh).dateTime(m);return this.t("timeRange",{start:d(e),end:d(t)})},Eh=function(e){return e.allDay?P(e.start)===P(e.end)?this.t("allDayOn",{date:s(this,f,Ke).call(this,e.start)}):this.t("allDayRange",{start:s(this,f,Ke).call(this,e.start),end:s(this,f,Ke).call(this,e.end)}):P(e.start)!==P(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&$h(e.start,e.end)===1)?s(this,f,cl).call(this,e.start,e.end):this.t("timed",{date:s(this,f,Ke).call(this,e.start),time:s(this,f,cl).call(this,e.start,e.end)})},Sf=function(e){let t={title:e.name,when:s(this,f,Eh).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Lf=function(e){let t=r(this,f,Si);if(r(this,f,Ee)==="month")return r(this,f,nl).monthYear(r(this,f,mt));if(e.length===1)return ae(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Tf(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Gp(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Df=function(e){return r(this,f,kh).hour12?Gp(ae(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,f,Si))):s(this,f,ll).call(this,e*60)},Mr=function(e,t){let{start:i,end:a}=s(this,f,Zp).call(this,e,t);return e.mode==="time"?this.t("timed",{date:s(this,f,Ke).call(this,i),time:s(this,f,cl).call(this,i,a)}):s(this,f,Ke).call(this,G(N(e.origin),t.group-e.from.group))},Jp=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<zy;t!==this._narrow&&(this._narrow=t)},dl=function(e,t){return r(this,f,Ee)==="month"?Ze(e,t):r(this,f,Ee)==="week"?G(e,t*(this._narrow?3:7)):G(e,t)},Af=function(e){this.view!==e&&(this.view=e)},hl=function(){return[...this.renderRoot.querySelectorAll(".item")]},Rf=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(a=>a.dataset.k===e&&a.classList.contains("item"))??t.find(a=>a.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let a=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${a}`)??null}return null},Hf=function(){let e=P(r(this,f,mt));if(r(this,f,Xp))return`day:${e}`;if(r(this,f,Ee)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},Nf=function(){let e=s(this,f,hl).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Et))??e.find(i=>i.dataset.k===s(this,f,Hf).call(this))??e.find(i=>i.dataset.day===P(r(this,f,mt)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},If=function(e){g(this,Et,e.dataset.k??"");for(let t of s(this,f,hl).call(this))t.tabIndex=t===e?0:-1;e.focus()},bl=new WeakMap,fl=new WeakMap,Pf=function(e,t){let i=new Map;for(let y of s(this,f,hl).call(this)){let M=Number(y.dataset.i);(i.get(M)??i.set(M,[]).get(M)).push(y)}let a=Number(e.dataset.i),l=i.get(a)??[e],d=Math.max(0,l.indexOf(e)),m=s(this,f,pt).call(this).length,u=r(this,f,Ee)==="month",v=e.dataset.row,b=(y,M)=>{let D=y>=0&&y<m?i.get(y):void 0;return(D?.length?M(D):void 0)??null},w=y=>u?y[Math.min(d,y.length-1)]:y.find(M=>M.dataset.row===v)??y[0];switch(t){case"ArrowRight":return b(a+1,w);case"ArrowLeft":return b(a-1,w);case"ArrowDown":return l[d+1]??(u?b(a+7,y=>y[0]):null);case"ArrowUp":return d>0?l[d-1]:u?b(a-7,y=>y[y.length-1]):null;case"Home":return u?b(a-a%7,y=>y[0]):b(0,w);case"End":return u?b(Math.min(m-1,a-a%7+6),y=>y[0]):b(m-1,w);default:return null}},Of=function(e,t){let i=e.dataset.day??P(r(this,f,mt)),a=s(this,f,dl).call(this,N(i)??r(this,f,mt),t),l=P(a),d=(e.dataset.k??"").split(":")[0],m;r(this,f,Xp)?m=`day:${l}`:r(this,f,Ee)==="month"?m=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?m=`adadd:${l}`:m=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=P(s(this,f,dl).call(this,r(this,f,mt),t)),g(this,Et,m),g(this,We,{key:m,until:Date.now()+1e3})},vl=new WeakMap,ml=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,f,kt))+1},qf=function(e,t){let i=r(this,Z);if(!i)return null;let a=s(this,f,pt).call(this).length,l=v=>Math.max(0,Math.min(a-1,v));if(i.mode==="day"){let v=r(this,f,Ee)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return v?{group:t.group+7<a?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return v?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:v?t.group-t.group%7:0,index:0};case"End":return{group:v?l(t.group-t.group%7+6):a-1,index:0};default:return null}}let d=s(this,f,ml).call(this,i.ev.dur)-1,m=Math.max(1,Math.round(60/r(this,f,kt))),u=v=>Math.max(0,Math.min(d,v));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+m)};case"PageUp":return{group:t.group,index:u(t.index-m)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Zp=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=s(this,f,pt).call(this)[t.group]??N(e.origin),m=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,f,kt));return{start:m,end:new Date(m.getTime()+i.dur*6e4)}}let a=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+a,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},Qp=function(e,t){let a=s(this,f,pt).call(this).map(P).indexOf(t);if(a<0)return null;let l=r(this,f,zf)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,f,kt)),s(this,f,ml).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:a,index:d}}},eu=function(){r(this,Z)&&(r(this,Z).ev.el.moving=!1),g(this,Z,null),this._target=null},Bf=function(e){let t=r(this,Z);if(!t||!e){this._target=null;return}let i=P(s(this,f,pt).call(this)[e.group]??N(t.origin)),a=e.group===t.from.group&&e.index===t.from.index;this._target=a?null:{iso:i,min:t.mode==="time"?e.index*r(this,f,kt):void 0}},Ff=function(e,t){let i=r(this,Z);s(this,f,eu).call(this),i&&(g(this,Rs,performance.now()+400),s(this,f,tu).call(this,i,e,t,"keyboard"))},tu=function(e,t,i,a){let l=t.group===i.group&&t.index===i.index,{start:d,end:m}=s(this,f,Zp).call(this,e,i),u=P(G(N(e.origin),i.group-t.group));s(this,f,ru).call(this,e.ev,d,m,a,l,e.mode==="time"?P(d):u)},iu=function(e,t,i){return e?{start:P(t),end:P(i)}:{start:kf(t),end:kf(i)}},ru=function(e,t,i,a,l,d){let m=e.el,u=e.name,v=s(this,f,iu).call(this,e.allDay,e.start,e.end),b=s(this,f,iu).call(this,e.allDay,t,i),w=F=>{a==="keyboard"&&g(this,We,{key:F,until:Date.now()+1e3})};if(l||v.start===b.start&&v.end===b.end)return a!=="api"&&r(this,Le).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let y={...e,start:t,end:i},M=e.allDay?s(this,f,Ke).call(this,t):this.t("timed",{date:s(this,f,Ke).call(this,t),time:s(this,f,cl).call(this,t,i)}),D=[],H={value:e.key,event:m,from:v,to:b,allDay:e.allDay,source:a,waitUntil:F=>{D.push(Promise.resolve(F))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:H,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Tr).set(m,v),m.start=b.start,m.end=b.end),w(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Le).announce(this.t("moved",{event:u,place:y.allDay?s(this,f,Ke).call(this,t):M})),D.length&&(m.pending=!0,Promise.all(D).then(()=>{m.pending=!1,this.controlled||r(this,Tr).delete(m)},()=>{m.pending=!1,this.controlled?r(this,Le).announce(this.t("reverted",{event:u,place:s(this,f,Eh).call(this,e)})):this.revert(m)})),!0):(r(this,Le).announce(this.t("refused",{event:u,place:M})),this.requestUpdate(),!1)},yl=new WeakMap,au=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let a=0,l=1/0;i.forEach((m,u)=>{let v=m.getBoundingClientRect(),b=e<v.left?v.left-e:e>v.right?e-v.right:0;b<l&&(l=b,a=Number(m.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:a,min:(t-d.top)/d.height*60}},jf=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let a=null,l=1/0;for(let d of i){let m=d.getBoundingClientRect(),u=e<m.left?m.left-e:e>m.right?e-m.right:0,v=t<m.top?m.top-t:t>m.bottom?t-m.bottom:0,b=Math.hypot(u,v);b<l&&(l=b,a=d)}return a?Number(a.dataset.i):null},xl=new WeakMap,wl=new WeakMap,$l=new WeakMap,kl=new WeakMap,El=new WeakMap,Ml=new WeakMap,su=function(){let e=r(this,Q);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Le).announce(this.t("pickedUp",{event:e.ev.name,place:s(this,f,Mr).call(this,e,e.from)})),s(this,f,Mh).call(this);let t=()=>{r(this,Q)?.started&&(s(this,f,Uf).call(this),r(this,Q).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Mh=function(){let e=r(this,Q);if(!e)return;let t=null;if(e.mode==="time"){let l=s(this,f,au).call(this,e.x,e.y);if(l){let d=s(this,f,ml).call(this,e.ev.dur)-1;t={group:l.group,index:Math.max(0,Math.min(d,Math.round((l.min-e.grab)/r(this,f,kt))))}}}else{let l=s(this,f,jf).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let a=t.group===e.from.group&&t.index===e.from.index;this._target=a?null:{iso:P(s(this,f,pt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,f,kt):void 0},i&&r(this,Le).announce(this.t("over",{place:s(this,f,Mr).call(this,e,t)}))},Uf=function(){let e=r(this,Q),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,a=14,l=w=>w<i?Math.ceil((i-Math.max(w,0))/i*a):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let m=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-m),v=l(d.bottom-e.y),b=t.scrollTop;u?t.scrollTop-=u:v&&(t.scrollTop+=v),t.scrollTop!==b&&s(this,f,Mh).call(this)},Li=function(e){let t=r(this,Q);t&&(g(this,Q,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,kl),!0),window.removeEventListener("pointerup",r(this,El),!0),window.removeEventListener("pointercancel",r(this,Ml),!0),window.removeEventListener("touchmove",r(this,wl),!0),window.removeEventListener("contextmenu",r(this,$l),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&s(this,f,tu).call(this,t,t.from,t.to,"pointer")))},pl=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,f,Ee)},bubbles:!0,composed:!0}))},Vf=function(e,t,i){let a=i*60;if(e.detail>0){let m=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-m.top)/m.height*60/r(this,f,kt))*r(this,f,kt);a+=Math.max(0,Math.min(59,u))}let l=Math.floor(a/60),d=a%60;s(this,f,pl).call(this,`${t}T${_h(l)}:${_h(d)}`,!1)},nu=function(e,t){if(performance.now()<r(this,Rs)||r(this,xe).active){e.preventDefault();return}this.dispatchEvent(new CustomEvent("cm-open",{detail:{value:t.key,event:t.el},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault()},Kf=function(e){this._more=e,g(this,Hs,!0)},Th=function(e){let t=this._more;this._more="",e&&t&&(g(this,Et,`more:${t}`),g(this,We,{key:`more:${t}`,until:Date.now()+1e3}))},ou=function(){return r(this,Z)?.ev??(r(this,Q)?.started?r(this,Q).ev:null)},Ss=function(e,t,i,a,l,d={}){let m=e.el,u=m.pending,v=s(this,f,Sf).call(this,e),b=!this.readonly&&!m.locked&&!u,w=["attention","information","success","critical"].includes(m.tone)?m.tone:"neutral",y=`chip ${a} tone-${w}${l?" item":""}${m.moving?" moving":""}${u?" pending":""}${m.locked?" locked":""}`,M=m.icon?c`<cm-icon name=${m.icon} size="14"></cm-icon>`:h,D=e.allDay?h:c`<span class="tm">${s(this,f,ll).call(this,e.min)}</span>`,H=m.kind&&(a!=="month"||!m.icon)?c`<span class="k">${m.kind}</span>`:h,q=u?c`<span class="spin" aria-hidden="true"></span>`:h,F=a==="time"?c`<span class="lead">${M}${D}${q}</span><span class="h">${e.name}</span>${H}`:c`${M}${D}<span class="h">${e.name}</span>${H}${q}`,W=u?`${v}, ${this.t("saving")}`:v,Tt=b?`${r(this,Se)}-mv`:`${r(this,Se)}-op`,V=`ev:${e.key}:${t}`,Oe=b?this.t("roleDescription"):h;return m.href?c`<a class=${y} href=${m.href} style=${d.style??h} data-k=${V} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2653
|
+
data-row=${d.row??h} aria-label=${W} aria-describedby=${Tt} aria-roledescription=${Oe}
|
|
2654
|
+
@click=${nt=>s(this,f,nu).call(this,nt,e)}>${F}</a>`:c`<button type="button" class=${y} style=${d.style??h} data-k=${V} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
2655
|
+
data-row=${d.row??h} aria-label=${W} aria-describedby=${Tt} aria-roledescription=${Oe}
|
|
2656
|
+
@click=${nt=>s(this,f,nu).call(this,nt,e)}>${F}</button>`},zh=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.name}</div>`},Wf=function(e){let t=r(this,f,Ee),i=t==="week"&&this._narrow,a=t==="month"?this.t("previousMonth"):i?this.t("previousDays",{count:3}):t==="week"?this.t("previousWeek"):this.t("previousDay"),l=t==="month"?this.t("nextMonth"):i?this.t("nextDays",{count:3}):t==="week"?this.t("nextWeek"):this.t("nextDay"),d=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2));return c`<div class="head" part="header">
|
|
2502
2657
|
<div class="nav">
|
|
2503
2658
|
<button type="button" class="hb icon prev" aria-label=${a} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
2504
2659
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
2505
|
-
<button type="button" class="hb icon next" aria-label=${
|
|
2660
|
+
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
2506
2661
|
</div>
|
|
2507
|
-
<div class="title" part="title" id="${r(this,
|
|
2662
|
+
<div class="title" part="title" id="${r(this,Se)}-t" role="heading" aria-level=${d} aria-live="polite">${s(this,f,Lf).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
2508
2663
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
2509
|
-
${
|
|
2664
|
+
${Ef.map(m=>c`<button type="button" class="hb" data-view=${m} aria-pressed=${m===t?"true":"false"} @click=${()=>s(this,f,Af).call(this,m)}>${this.t(m)}</button>`)}
|
|
2510
2665
|
</div>
|
|
2511
|
-
</div>`},
|
|
2512
|
-
<button type="button" class="dayb item" data-k="day:${
|
|
2513
|
-
@click=${()=>{this.date=
|
|
2514
|
-
</td>`}let
|
|
2515
|
-
aria-label=${
|
|
2516
|
-
<div class="dh">${
|
|
2517
|
-
${
|
|
2518
|
-
@click=${()=>s(this,
|
|
2666
|
+
</div>`},Gf=function(e){let t=r(this,f,nl),i=Array.from({length:7},(a,l)=>(l+r(this,f,Yp))%7);return c`<thead><tr>${i.map(a=>c`<th scope="col" abbr=${t.weekdaysLong[a]}><span aria-hidden="true">${e?t.weekdaysShort[a].slice(0,2):t.weekdaysShort[a]}</span><span class="vh">${t.weekdaysLong[a]}</span></th>`)}</tr></thead>`},Yf=function(e,t){let i=r(this,f,mt),a=r(this,f,ol),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=s(this,f,ou).call(this),m=this._target,u=Array.from({length:e.length/7},(F,W)=>e.slice(W*7,W*7+7)),v=this._narrow,b=(F,W,Tt)=>{let V=P(F),Oe=t.get(V)??[],nt=s(this,f,Ke).call(this,F),Du=`${F.getMonth()!==i.getMonth()?"other":""} ${V===a?"today":""} ${m?.iso===V?"over":""}`,Au=c`<span class="num" aria-hidden="true">${r(this,f,nl).day(F)}</span>`;if(v){let zt=Oe.slice(0,3).map(Or=>["attention","information","success","critical"].includes(Or.el.tone)?Or.el.tone:"neutral");return c`<td class=${Du} data-drop data-i=${W} aria-selected=${V===P(i)?"true":"false"} aria-current=${V===a?"date":h}>
|
|
2667
|
+
<button type="button" class="dayb item" data-k="day:${V}" data-i=${W} data-day=${V} aria-label=${this.t("dayEvents",{date:nt,count:Oe.length})}
|
|
2668
|
+
@click=${()=>{this.date=V,g(this,Et,`day:${V}`)}}>${Au}<span class="dots">${zt.map(Or=>c`<span class="dot tone-${Or}"></span>`)}</span></button>
|
|
2669
|
+
</td>`}let Pr=Oe,Xl=0;if(Oe.length>l){Pr=Oe.slice(0,l-1);let zt=d&&Oe.find(Or=>Or.key===d.key);zt&&!Pr.includes(zt)&&(Pr=[...Oe.slice(0,l-2),zt]),Xl=Oe.length-Pr.length}let Jl=this.readonly;return c`<td class="${Du}${Jl?" item":""}" data-drop data-i=${W} data-day=${V} data-k=${Jl?`cell:${V}`:h}
|
|
2670
|
+
aria-label=${Jl?this.t("dayEvents",{date:nt,count:Oe.length}):h} aria-current=${V===a?"date":h}>
|
|
2671
|
+
<div class="dh">${Au}<span class="vh">${nt}</span>
|
|
2672
|
+
${Jl?h:c`<button type="button" class="add item" data-k="add:${V}" data-i=${W} data-day=${V} aria-label=${this.t("addOn",{date:nt})}
|
|
2673
|
+
@click=${()=>s(this,f,pl).call(this,V,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2519
2674
|
</div>
|
|
2520
|
-
${
|
|
2521
|
-
${
|
|
2522
|
-
${
|
|
2675
|
+
${Pr.length||m?.iso===V&&d?c`<ul class="evs">
|
|
2676
|
+
${Pr.map(zt=>c`<li>${s(this,f,Ss).call(this,zt,V,W,"month",!0)}</li>`)}
|
|
2677
|
+
${m?.iso===V&&d?c`<li aria-hidden="true">${s(this,f,zh).call(this,d)}</li>`:h}
|
|
2523
2678
|
</ul>`:h}
|
|
2524
|
-
${
|
|
2525
|
-
aria-expanded=${this._more===
|
|
2526
|
-
@click=${()=>this._more===
|
|
2527
|
-
${this._more===
|
|
2528
|
-
<div class="pop-h"><span>${
|
|
2529
|
-
<ul>${
|
|
2679
|
+
${Xl?c`<button type="button" class="more item" data-k="more:${V}" data-i=${W} data-day=${V} aria-haspopup="dialog"
|
|
2680
|
+
aria-expanded=${this._more===V?"true":"false"} aria-label=${this.t("moreLabel",{count:Xl,date:nt})}
|
|
2681
|
+
@click=${()=>this._more===V?s(this,f,Th).call(this,!1):s(this,f,Kf).call(this,V)}>${this.t("more",{count:Xl})}</button>`:h}
|
|
2682
|
+
${this._more===V?c`<div class="pop ${Tt>=4?"end":""}" role="dialog" aria-label=${nt}>
|
|
2683
|
+
<div class="pop-h"><span>${nt}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>s(this,f,Th).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
2684
|
+
<ul>${Oe.map(zt=>c`<li>${s(this,f,Ss).call(this,zt,V,W,"list",!1)}</li>`)}</ul>
|
|
2530
2685
|
</div>`:h}
|
|
2531
|
-
</td>`},w=c`<table class="month ${v?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,
|
|
2686
|
+
</td>`},w=c`<table class="month ${v?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,Se)}-t" aria-describedby="${r(this,Se)}-gh"
|
|
2532
2687
|
aria-busy=${this.loading?"true":"false"}>
|
|
2533
|
-
${s(this,
|
|
2534
|
-
<tbody>${u.map((
|
|
2535
|
-
</table>`;if(!v)return w;let y=P(i),M=t.get(y)??[],
|
|
2536
|
-
<section class="agenda" part="agenda" aria-labelledby="${r(this,
|
|
2688
|
+
${s(this,f,Gf).call(this,v)}
|
|
2689
|
+
<tbody>${u.map((F,W)=>c`<tr>${F.map((Tt,V)=>b(Tt,W*7+V,V))}</tr>`)}</tbody>
|
|
2690
|
+
</table>`;if(!v)return w;let y=P(i),M=t.get(y)??[],D=e.findIndex(F=>P(F)===y),H=s(this,f,Ke).call(this,i),q=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${w}
|
|
2691
|
+
<section class="agenda" part="agenda" aria-labelledby="${r(this,Se)}-ag">
|
|
2537
2692
|
<div class="ag-h">
|
|
2538
|
-
<div class="ag-t" id="${r(this,
|
|
2539
|
-
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:
|
|
2693
|
+
<div class="ag-t" id="${r(this,Se)}-ag" role="heading" aria-level=${q}>${H}</div>
|
|
2694
|
+
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:H})} @click=${()=>s(this,f,pl).call(this,y,!0)}>
|
|
2540
2695
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
2541
2696
|
</div>
|
|
2542
|
-
${M.length?c`<ul class="ag-list">${M.map(
|
|
2543
|
-
</section>`},
|
|
2697
|
+
${M.length?c`<ul class="ag-list">${M.map(F=>c`<li>${s(this,f,Ss).call(this,F,y,D,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
2698
|
+
</section>`},Xf=function(e){let t=new Map,i=e.filter(u=>!u.allDay).sort((u,v)=>u.min-v.min||v.dur-u.dur),a=[],l=[],d=-1,m=()=>{for(let u of a)t.get(u).lanes=l.length;a=[],l=[]};for(let u of i){let v=Math.min(1440,u.min+Math.max(u.dur,20));u.min>=d&&(m(),d=-1);let b=l.findIndex(w=>w<=u.min);b<0?(b=l.length,l.push(v)):l[b]=v,t.set(u,{lane:b,lanes:1}),a.push(u),d=Math.max(d,v)}return m(),t},Jf=function(e,t){let i=r(this,f,ol),a=r(this,f,nl),l=s(this,f,ou).call(this),d=this._target,m=this.readonly,u=e.map(b=>{let w=P(b),y=t.get(w)??[];return{d:b,iso:w,text:s(this,f,Ke).call(this,b),allDay:y.filter(M=>M.allDay),timed:y.filter(M=>!M.allDay),lanes:s(this,f,Xf).call(this,y)}}),v=Array.from({length:24},(b,w)=>w);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${r(this,Se)}-t" aria-describedby="${r(this,Se)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
2544
2699
|
style="--cols:${e.length}">
|
|
2545
2700
|
<div class="tg-top" role="rowgroup">
|
|
2546
2701
|
<div class="row" role="row">
|
|
2547
2702
|
<div class="axis" role="columnheader"><span class="vh">${this.t("time")}</span></div>
|
|
2548
|
-
${u.map(
|
|
2549
|
-
<span class="wd" aria-hidden="true">${a.weekdaysShort[
|
|
2703
|
+
${u.map(b=>c`<div class="colh ${b.iso===i?"today":""}" role="columnheader" aria-current=${b.iso===i?"date":h}>
|
|
2704
|
+
<span class="wd" aria-hidden="true">${a.weekdaysShort[b.d.getDay()]}</span><span class="dn" aria-hidden="true">${a.day(b.d)}</span><span class="vh">${b.text}</span>
|
|
2550
2705
|
</div>`)}
|
|
2551
2706
|
</div>
|
|
2552
2707
|
<div class="row adrow" role="row">
|
|
2553
2708
|
<div class="axis" role="rowheader">${this.t("allDay")}</div>
|
|
2554
|
-
${u.map((
|
|
2555
|
-
${
|
|
2556
|
-
aria-label=${this.t("addAllDay",{date:
|
|
2557
|
-
${
|
|
2558
|
-
${d?.iso===
|
|
2709
|
+
${u.map((b,w)=>c`<div class="adcell ${d?.iso===b.iso&&l?.allDay?"over":""}" role="gridcell" data-drop data-i=${w}>
|
|
2710
|
+
${m?h:c`<button type="button" class="add item" data-k="adadd:${b.iso}" data-i=${w} data-day=${b.iso} data-row="a"
|
|
2711
|
+
aria-label=${this.t("addAllDay",{date:b.text})} @click=${()=>s(this,f,pl).call(this,b.iso,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
2712
|
+
${b.allDay.map(y=>s(this,f,Ss).call(this,y,b.iso,w,"allday",!0,{row:"a"}))}
|
|
2713
|
+
${d?.iso===b.iso&&l?.allDay?s(this,f,zh).call(this,l):h}
|
|
2559
2714
|
</div>`)}
|
|
2560
2715
|
</div>
|
|
2561
2716
|
</div>
|
|
2562
2717
|
<div class="tg-body" role="rowgroup">
|
|
2563
|
-
${v.map(
|
|
2564
|
-
<div class="axis" role="rowheader"><span>${s(this,
|
|
2565
|
-
${u.map((w,y)=>{let M=w.timed.filter(
|
|
2566
|
-
${
|
|
2567
|
-
aria-label=${this.t("addAt",{time:s(this,
|
|
2568
|
-
${M.map(
|
|
2569
|
-
${
|
|
2718
|
+
${v.map(b=>c`<div class="row hr" role="row">
|
|
2719
|
+
<div class="axis" role="rowheader"><span>${s(this,f,Df).call(this,b)}</span></div>
|
|
2720
|
+
${u.map((w,y)=>{let M=w.timed.filter(H=>Math.floor(H.min/60)===b),D=l&&!l.allDay&&d?.iso===w.iso&&d.min!==void 0&&Math.floor(d.min/60)===b;return c`<div class="tcell" role="gridcell" data-i=${y} data-row=${b} data-day=${w.iso}>
|
|
2721
|
+
${m?h:c`<button type="button" class="slot item" data-k="slot:${w.iso}:${b}" data-i=${y} data-row=${b} data-day=${w.iso}
|
|
2722
|
+
aria-label=${this.t("addAt",{time:s(this,f,ll).call(this,b*60),date:w.text})} @click=${H=>s(this,f,Vf).call(this,H,w.iso,b)}></button>`}
|
|
2723
|
+
${M.map(H=>{let q=w.lanes.get(H)??{lane:0,lanes:1},F=Math.min(H.dur,1440-H.min)/60;return s(this,f,Ss).call(this,H,w.iso,y,"time",!0,{row:String(b),style:`--top:${(H.min-b*60)/60};--len:${F};--lane:${q.lane};--lanes:${q.lanes}`})})}
|
|
2724
|
+
${D?s(this,f,zh).call(this,l,"time",`--top:${(d.min-b*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
2570
2725
|
</div>`})}
|
|
2571
2726
|
</div>`)}
|
|
2572
2727
|
</div>
|
|
2573
|
-
</div>`},
|
|
2728
|
+
</div>`},Ds.properties={view:{reflect:!0},date:{reflect:!0},today:{},label:{string:"label"},step:{type:Number},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},hourCycle:{attribute:"hour-cycle"},dayStart:{type:Number,attribute:"day-start"},maxEvents:{type:Number,attribute:"max-events"},headingLevel:{type:Number,attribute:"heading-level"},loading:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0},_narrow:{state:!0},_more:{state:!0},_target:{state:!0}},Ds.styles=[k,x`
|
|
2574
2729
|
:host { display: block; position: relative; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
2575
2730
|
:host([dragging]) { cursor: grabbing; user-select: none; -webkit-user-select: none; }
|
|
2576
2731
|
.cal { display: flex; flex-direction: column; gap: var(--cm-space-12); min-width: 0; }
|
|
@@ -2731,12 +2886,12 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2731
2886
|
.chip.time > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2732
2887
|
.chip.time .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
2733
2888
|
.ph.time { position: absolute; z-index: 3; inset-inline: 0 2px; inset-block-start: calc(var(--top) * var(--h)); height: calc(var(--len) * var(--h)); align-items: flex-start; }
|
|
2734
|
-
`];$("cm-calendar",
|
|
2889
|
+
`];$("cm-calendar",Ds);var iE=z("reportTile",{pinned:", pinned"}),zr=class extends T{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=c`
|
|
2735
2890
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
2736
2891
|
<span class="label">${this.label}</span>
|
|
2737
2892
|
${this.pinned?c`<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
2738
2893
|
<span class="sr">${this.t("pinned")}</span></span>`:h}
|
|
2739
|
-
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};
|
|
2894
|
+
`;return this.href?c`<a class="tile" part="tile" href=${this.href}>${e}</a>`:c`<button class="tile" part="tile" type="button">${e}</button>`}};zr.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},zr.shadowRootOptions={...S.shadowRootOptions,delegatesFocus:!0},zr.styles=[k,x`
|
|
2740
2895
|
:host { display: block; }
|
|
2741
2896
|
.tile {
|
|
2742
2897
|
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-12);
|
|
@@ -2755,10 +2910,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2755
2910
|
.icon cm-icon::part(svg) { width: 32px; height: 32px; }
|
|
2756
2911
|
::slotted([slot='icon']) { width: 32px; height: 32px; }
|
|
2757
2912
|
}
|
|
2758
|
-
`];$("cm-report-tile",
|
|
2913
|
+
`];$("cm-report-tile",zr);var Ps=class extends S{constructor(){super(...arguments);this.heading="";this.headingLevel=2}firstUpdated(){for(let e of this.querySelectorAll(":scope > cm-report-tile"))e.hasAttribute("role")||e.setAttribute("role","listitem")}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2));return c`
|
|
2759
2914
|
${this.heading?c`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:h}
|
|
2760
2915
|
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":h}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
2761
|
-
`}};
|
|
2916
|
+
`}};Ps.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},Ps.styles=[k,x`
|
|
2762
2917
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
2763
2918
|
.title { margin: 0 0 var(--cm-space-16); font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
2764
2919
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-12); }
|
|
@@ -2768,16 +2923,16 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2768
2923
|
.title { margin-bottom: var(--cm-space-8); }
|
|
2769
2924
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
2770
2925
|
}
|
|
2771
|
-
`];$("cm-report-tiles",
|
|
2926
|
+
`];$("cm-report-tiles",Ps);var oE=z("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),Zf=/^\s*-?\d+(\.\d+)?\s*$/,Os=class extends T{constructor(){super(...arguments);this.label="";this.value="";this.hint="";this.change="";this.trendSentiment="auto";this.href="";this.loading=!1;this._hasHint=!1;this.onHintSlot=e=>{this._hasHint=e.target.assignedNodes({flatten:!1}).some(t=>t.nodeType===1||t.textContent?.trim())}}connectedCallback(){super.connectedCallback(),this._hasHint=!!this.querySelector(':scope > [slot="hint"]')}figure(){let e=this.value;if(e===""||e===null||e===void 0)return"";let t=typeof e=="number"?e:Zf.test(String(e))?Number(e):NaN;return Number.isNaN(t)?String(e):this.formatNumber(t)}sentiment(){let e=this.trendSentiment;return e==="positive"||e==="negative"||e==="neutral"?e:this.trend==="up"?"positive":this.trend==="down"?"negative":"neutral"}renderChange(){let e=this.trend&&["up","down","flat"].includes(this.trend)?this.trend:void 0;if(!this.change&&!e)return h;if(!e)return c`<span class="change neutral" part="change">${this.change}</span>`;let t=this.sentiment(),i=this.t(e,{change:this.change}).trim(),a=t==="positive"?this.t("good",{trend:i}):t==="negative"?this.t("bad",{trend:i}):i;return c`<span class="change ${e} ${t}" part="change">
|
|
2772
2927
|
<cm-icon name=${e==="flat"?"arrow-left":"arrow-up-right"} size="16"></cm-icon><span aria-hidden="true">${this.change}</span><span class="sr">${a}</span>
|
|
2773
|
-
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),i=this.renderChange(),a=i!==h||e,
|
|
2928
|
+
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),i=this.renderChange(),a=i!==h||e,l=c`
|
|
2774
2929
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
2775
2930
|
<span class="value" id="value" part="value">${t}</span>
|
|
2776
2931
|
<span class="foot ${a?"on":""}" id="foot" part="footer">
|
|
2777
2932
|
${i}
|
|
2778
2933
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
2779
2934
|
</span>
|
|
2780
|
-
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,
|
|
2935
|
+
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,m=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${a?"foot":h} aria-busy=${m}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${m}>${l}</div>${d}`}};Os.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&Zf.test(e)?Number(e):e??"",toAttribute:e=>e==null?e:String(e)}},hint:{},change:{},trend:{reflect:!0},trendSentiment:{attribute:"trend-sentiment",reflect:!0},href:{},loading:{type:Boolean,reflect:!0},_hasHint:{state:!0}},Os.styles=[k,x`
|
|
2781
2936
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
2782
2937
|
.tile {
|
|
2783
2938
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -2813,29 +2968,29 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2813
2968
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
2814
2969
|
}
|
|
2815
2970
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
2816
|
-
`];$("cm-metric",
|
|
2817
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,
|
|
2971
|
+
`];$("cm-metric",Os);var qs=class extends S{constructor(){super(...arguments);this.label="";this.icon="";this.href="";this.value="";this.current=!1;this.badge="";this.expanded=!1;this.primary=!1}render(){return null}toItem(){return Qf(this)}};qs.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}},qs.styles=x`:host { display: none !important; }`;$("cm-nav-item",qs);function Qf(o){let n=i=>o.getAttribute(i),e={label:n("label")||""};n("icon")&&(e.icon=n("icon")),n("href")&&(e.href=n("href")),n("value")&&(e.value=n("value")),o.hasAttribute("current")&&(e.current=!0),n("badge")&&(e.badge=n("badge")),o.hasAttribute("expanded")&&(e.expanded=!0),o.hasAttribute("primary")&&(e.primary=!0);let t=Yt(o);return t.length&&(e.items=t),e}var Yt=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(Qf),lu=o=>o.value||o.href||o.label,Ch=o=>!!o.current||!!o.items?.some(Ch),Ai=(o,n)=>{let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","icon","href","value","current","badge","expanded","primary"]}),e},Ri=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:lu(n),href:n.href??""}}));var fE=z("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),Tl,zl,Dh,j,cu,Sh,du,ev,tv,hu,mu,iv,pu,uu,Lh,gu,rv,Bs=class extends T{constructor(){super(...arguments);p(this,j);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;p(this,Tl,new Set);p(this,zl);p(this,Dh,A("cm-sidenav"))}connectedCallback(){super.connectedCallback(),s(this,j,cu).call(this),g(this,zl,Ai(this,()=>s(this,j,cu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,zl)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let i=s(this,j,Sh).call(this,e,t);r(this,Tl).has(i)||!e.items?.length||(r(this,Tl).add(i),(e.expanded||Ch(e))&&this._open.add(i))})}toggle(e,t){let i=this.navItems[e];if(!i?.items?.length)return;let a=s(this,j,Sh).call(this,i,e),l=t??!this._open.has(a);if(l===this._open.has(a))return;let d=new Set(this._open);l?d.add(a):d.delete(a),this._open=d,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:i,expanded:l}}))}render(){let e=this.collapsed;return c`
|
|
2972
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${s(this,j,tv)}>
|
|
2818
2973
|
<slot name="header"></slot>
|
|
2819
2974
|
<ul part="list">
|
|
2820
|
-
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,
|
|
2821
|
-
${s(this,
|
|
2822
|
-
aria-expanded=${a?"true":"false"} aria-controls=${
|
|
2823
|
-
${s(this,
|
|
2975
|
+
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${s(this,j,gu).call(this,t,"",{index:i})}</li>`;let a=!e&&this._open.has(s(this,j,Sh).call(this,t,i)),l=`${r(this,Dh)}-${i}`;return c`<li>
|
|
2976
|
+
${s(this,j,Lh).call(this,t,c`<button type="button" class="item parent ${Ch(t)?"has-current":""}" part="item" data-index=${i}
|
|
2977
|
+
aria-expanded=${a?"true":"false"} aria-controls=${l} @click=${()=>e?s(this,j,iv).call(this,i):this.toggle(i)}>
|
|
2978
|
+
${s(this,j,pu).call(this,t)}${s(this,j,uu).call(this,t)}
|
|
2824
2979
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
2825
2980
|
</button>`)}
|
|
2826
|
-
<ul class="sub" id=${
|
|
2827
|
-
${s(this,
|
|
2981
|
+
<ul class="sub" id=${l} ?hidden=${!a} aria-label=${t.label}>
|
|
2982
|
+
${s(this,j,hu).call(this,t.items).map(([d,m])=>c`<li>${s(this,j,gu).call(this,{...d,icon:void 0},m?"deep":"",{parent:i})}</li>`)}
|
|
2828
2983
|
</ul>
|
|
2829
2984
|
</li>`})}
|
|
2830
2985
|
</ul>
|
|
2831
|
-
${s(this,
|
|
2986
|
+
${s(this,j,rv).call(this)}
|
|
2832
2987
|
<slot name="footer"></slot>
|
|
2833
2988
|
<slot hidden></slot>
|
|
2834
2989
|
</nav>
|
|
2835
|
-
`}};
|
|
2836
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${
|
|
2837
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${
|
|
2838
|
-
@click=${()=>s(this,
|
|
2990
|
+
`}};Tl=new WeakMap,zl=new WeakMap,Dh=new WeakMap,j=new WeakSet,cu=function(){this._slotted=Yt(this)},Sh=function(e,t){return`${t}:${lu(e)}`},du=function(e,t){Ri(this,t)||e.preventDefault()},ev=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},tv=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let i=s(this,j,ev).call(this),a=i.indexOf(t),l=Number(t.dataset.index),d=J(e,this),m;if(e.key==="ArrowDown")m=i[(a+1)%i.length];else if(e.key==="ArrowUp")m=i[(a-1+i.length)%i.length];else if(e.key==="Home")m=i[0];else if(e.key==="End")m=i[i.length-1];else{if(this.collapsed&&(d==="ArrowRight"||d==="ArrowLeft"))return;if(d==="ArrowRight"&&t.classList.contains("parent")){this.toggle(l,!0),e.preventDefault();return}else if(d==="ArrowLeft"){if(t.classList.contains("parent")?this.toggle(l,!1):t.dataset.parent&&(m=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!m){e.preventDefault();return}}else return}e.preventDefault(),m?.focus()},hu=function(e,t=0){return e.flatMap(i=>[[i,t],...s(this,j,hu).call(this,i.items??[],t+1)])},mu=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},iv=function(e){let t=this.navItems[e];s(this,j,mu).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},pu=function(e){return e.icon?c`<cm-icon name=${e.icon} size="20"></cm-icon>`:this.collapsed?c`<span class="initial" aria-hidden="true">${([...e.label.trim()][0]??"").toLocaleUpperCase(this.locale)}</span>`:h},uu=function(e){if(!this.collapsed)return c`<span class="label">${e.label}</span>${e.badge?c`<span class="badge">${e.badge}</span>`:h}`;let t=e.badge&&/^\d{1,2}\+?$/.test(e.badge.trim());return c`<span class="sr">${e.label}${e.badge?` (${e.badge})`:""}</span>${e.badge?c`<span class="dot ${t?"count":""}" aria-hidden="true">${t?e.badge:h}</span>`:h}`},Lh=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},gu=function(e,t,i={}){let a=c`${s(this,j,pu).call(this,e)}${s(this,j,uu).call(this,e)}`;return s(this,j,Lh).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
2991
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,du).call(this,l,e)}>${a}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
2992
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>s(this,j,du).call(this,l,e)}>${a}</button>`)},rv=function(){if(!this.collapsible)return h;let e=this.t(this.collapsed?"expand":"collapse"),t=c`<cm-icon name=${this.collapsed?"chevron-right":"chevron-left"} size="20"></cm-icon>${this.collapsed?c`<span class="sr">${e}</span>`:c`<span class="label">${e}</span>`}`;return c`<div class="toggle-row">${s(this,j,Lh).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
2993
|
+
@click=${()=>s(this,j,mu).call(this,!this.collapsed)}>${t}</button>`)}</div>`},Bs.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},Bs.styles=[k,x`
|
|
2839
2994
|
:host { display: block; width: var(--cm-side-navigation-width, 220px); }
|
|
2840
2995
|
nav {
|
|
2841
2996
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: var(--cm-radius-lg);
|
|
@@ -2880,47 +3035,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2880
3035
|
background: var(--cm-nav-badge); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
2881
3036
|
}
|
|
2882
3037
|
.dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); }
|
|
2883
|
-
`];$("cm-side-navigation",
|
|
2884
|
-
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
2885
|
-
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
2886
|
-
<cm-icon name="close" size="18"></cm-icon></button>
|
|
2887
|
-
</header>`}renderDialog(e,t=""){return c`<dialog part="dialog" class=${t}
|
|
2888
|
-
aria-labelledby=${this.heading?`${this.uid}-h`:h}
|
|
2889
|
-
aria-label=${!this.heading&&this.label?this.label:h}
|
|
2890
|
-
@keydown=${r(this,Hd)} @cancel=${r(this,Id)} @close=${r(this,Pd)}
|
|
2891
|
-
@pointerdown=${r(this,Od)} @click=${r(this,qd)}>${e}</dialog>`}};vs=new WeakMap,Vt=new WeakMap,ys=new WeakMap,tl=new WeakSet,dm=function(){r(this,Vt)&&(el(),f(this,Vt,!1));let e=r(this,vs);f(this,vs,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},Hd=new WeakMap,Id=new WeakMap,Pd=new WeakMap,Od=new WeakMap,qd=new WeakMap,oe.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},oe.overlayStyles=[k,x`
|
|
2892
|
-
:host { display: contents; }
|
|
2893
|
-
dialog {
|
|
2894
|
-
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
2895
|
-
font: inherit; overflow: visible;
|
|
2896
|
-
}
|
|
2897
|
-
dialog::backdrop { background: var(--cm-overlay, rgba(0, 0, 0, 0.4)); }
|
|
2898
|
-
.panel {
|
|
2899
|
-
display: flex; flex-direction: column; background: var(--cm-bg-surface); color: var(--cm-text-default);
|
|
2900
|
-
overflow: hidden; outline: none;
|
|
2901
|
-
}
|
|
2902
|
-
.head {
|
|
2903
|
-
display: flex; align-items: center; gap: var(--cm-space-8); flex: none; min-height: 40px; padding-block: var(--cm-space-8); padding-inline: var(--cm-space-16) var(--cm-space-8);
|
|
2904
|
-
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
2905
|
-
}
|
|
2906
|
-
.head h2 { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
|
|
2907
|
-
.x {
|
|
2908
|
-
display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
2909
|
-
background: none; color: inherit; cursor: pointer;
|
|
2910
|
-
}
|
|
2911
|
-
.x:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
2912
|
-
.body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--cm-space-20); font-size: 14px; line-height: 20px; }
|
|
2913
|
-
.foot {
|
|
2914
|
-
display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-8); flex: none; padding: var(--cm-space-12) var(--cm-space-20);
|
|
2915
|
-
border-top: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
2916
|
-
}
|
|
2917
|
-
.foot[hidden] { display: none; }
|
|
2918
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
2919
|
-
dialog[open] .panel { animation: cm-ovl-in var(--cm-duration-base) var(--cm-easing-standard); }
|
|
2920
|
-
|
|
2921
|
-
}
|
|
2922
|
-
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
2923
|
-
`];function Ub(l){let n=l.trim().split(/[\s._@-]+/).filter(Boolean);if(!n.length)return"";let e=[...n[0]][0]??"",t=n.length>1&&!/[.@]/.test(l)?[...n[n.length-1]][0]??"":"";return(e+t).toLocaleUpperCase()}var xs=class extends S{constructor(){super(...arguments);this.name="";this.src="";this.size="medium";this.shape="round";this.decorative=!1;this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){let e=Ub(this.name),t=this.decorative||!this.name?h:this.name,i=this.decorative||!this.name?"true":h,a,o="avatar";return this.src&&!this._failed?a=c`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?a=c`<span aria-hidden="true">${e}</span>`:(o+=" icon",a=c`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),c`<span class=${o} part="avatar" role=${t===h?h:"img"} aria-label=${t} aria-hidden=${i}>${a}</span>`}};xs.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},xs.styles=[k,x`
|
|
3038
|
+
`];$("cm-side-navigation",Bs);function av(o){let n=o.trim().split(/[\s._@-]+/).filter(Boolean);if(!n.length)return"";let e=[...n[0]][0]??"",t=n.length>1&&!/[.@]/.test(o)?[...n[n.length-1]][0]??"":"";return(e+t).toLocaleUpperCase()}var Fs=class extends S{constructor(){super(...arguments);this.name="";this.src="";this.size="medium";this.shape="round";this.decorative=!1;this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){let e=av(this.name),t=this.decorative||!this.name?h:this.name,i=this.decorative||!this.name?"true":h,a,l="avatar";return this.src&&!this._failed?a=c`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?a=c`<span aria-hidden="true">${e}</span>`:(l+=" icon",a=c`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),c`<span class=${l} part="avatar" role=${t===h?h:"img"} aria-label=${t} aria-hidden=${i}>${a}</span>`}};Fs.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},Fs.styles=[k,x`
|
|
2924
3039
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
2925
3040
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
2926
3041
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -2933,21 +3048,21 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2933
3048
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
2934
3049
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
2935
3050
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
2936
|
-
`];$("cm-avatar",
|
|
3051
|
+
`];$("cm-avatar",Fs);var zE=z("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),Vs,Xt,Ks,Me,_l,bu,js,Us=class extends T{constructor(){super();p(this,Me);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;p(this,Vs);p(this,Xt,!1);p(this,Ks,null);this.addEventListener("cm-select",e=>{let t=s(this,Me,_l).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){s(this,Me,_l).call(this)?.focus();return}this._searchOpen||(g(this,Ks,_m()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),g(this,Vs,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,Vs).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Vs)?.disconnect(),r(this,Xt)&&(go(),g(this,Xt,!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,Xt)||(zm(),g(this,Xt,!0)),s(this,Me,_l).call(this)?.focus(),s(this,Me,js).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,Xt)&&(go(),g(this,Xt,!1));let i=r(this,Ks)??this.renderRoot.querySelector(".search-btn");g(this,Ks,null),i?.isConnected&&i.focus(),s(this,Me,js).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
2937
3052
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
2938
3053
|
<div class="logo"><slot name="logo"></slot></div>
|
|
2939
3054
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
2940
|
-
@click=${()=>s(this,
|
|
2941
|
-
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,
|
|
3055
|
+
@click=${()=>s(this,Me,js).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="16"></cm-icon></button>`:h}
|
|
3056
|
+
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${s(this,Me,bu)}></slot></div>`}
|
|
2942
3057
|
<span class="grow"></span>
|
|
2943
3058
|
<div class="end">
|
|
2944
3059
|
${this._narrow&&this._hasSearch?c`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
2945
3060
|
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:h}
|
|
2946
3061
|
<div class="actions"><slot name="actions"></slot></div>
|
|
2947
3062
|
${this.balance?c`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
2948
|
-
@click=${()=>s(this,
|
|
3063
|
+
@click=${()=>s(this,Me,js).call(this,"cm-wallet")}>${this.balance}</button>`:h}
|
|
2949
3064
|
${this.userName?c`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
2950
|
-
@click=${()=>s(this,
|
|
3065
|
+
@click=${()=>s(this,Me,js).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
2951
3066
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:h}
|
|
2952
3067
|
<slot name="end"></slot>
|
|
2953
3068
|
</div>
|
|
@@ -2956,11 +3071,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2956
3071
|
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
2957
3072
|
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
2958
3073
|
<div class="layer-bar">
|
|
2959
|
-
<div class="layer-search"><slot name="search" @slotchange=${s(this,
|
|
3074
|
+
<div class="layer-search"><slot name="search" @slotchange=${s(this,Me,bu)}></slot></div>
|
|
2960
3075
|
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
2961
3076
|
</div>
|
|
2962
3077
|
</dialog>`:h}
|
|
2963
|
-
`}};
|
|
3078
|
+
`}};Vs=new WeakMap,Xt=new WeakMap,Ks=new WeakMap,Me=new WeakSet,_l=function(){return this.querySelector(':scope > [slot="search"]')},bu=function(){this._hasSearch=!!s(this,Me,_l).call(this)},js=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Us.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}},Us.styles=[k,x`
|
|
2964
3079
|
:host {
|
|
2965
3080
|
display: block; background: var(--cm-bg-surface); container-type: inline-size;
|
|
2966
3081
|
--_h: var(--cm-control-height-md); --_touch: var(--cm-control-height-touch);
|
|
@@ -3037,10 +3152,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3037
3152
|
@media (pointer: coarse) {
|
|
3038
3153
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
3039
3154
|
}
|
|
3040
|
-
`];$("cm-header-bar"
|
|
3041
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,
|
|
3155
|
+
`];$("cm-header-bar",Us);var HE=z("bottomNavigation",{label:"Main"}),Cl,_r,fu,sv,Ws=class extends T{constructor(){super(...arguments);p(this,_r);this.items=[];this.fixed=!1;this._slotted=[];p(this,Cl)}connectedCallback(){super.connectedCallback(),s(this,_r,fu).call(this),g(this,Cl,Ai(this,()=>s(this,_r,fu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Cl)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3156
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${s(this,_r,sv).call(this,e)}</li>`)}</ul>
|
|
3042
3157
|
<slot hidden></slot>
|
|
3043
|
-
</nav>`}};
|
|
3158
|
+
</nav>`}};Cl=new WeakMap,_r=new WeakSet,fu=function(){this._slotted=Yt(this)},sv=function(e){let t=`item ${e.primary?"primary":""}`,i=c`<span class="icon">${e.icon?c`<cm-icon name=${e.icon} size=${e.primary?16:20}></cm-icon>`:h}</span><span class="label">${e.label}</span>`,a=l=>{Ri(this,e)||l.preventDefault()};return e.href?c`<a class=${t} part="item" href=${e.href} aria-current=${e.current?"page":h} @click=${a}>${i}</a>`:c`<button type="button" class=${t} part="item" aria-current=${e.current?"page":h} @click=${a}>${i}</button>`},Ws.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},Ws.styles=[k,x`
|
|
3044
3159
|
:host { display: block; }
|
|
3045
3160
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
3046
3161
|
nav {
|
|
@@ -3062,32 +3177,32 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3062
3177
|
.icon { display: grid; place-items: center; width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
3063
3178
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
3064
3179
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3065
|
-
`];$("cm-bottom-navigation",
|
|
3180
|
+
`];$("cm-bottom-navigation",Ws);var jE=z("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Sl,Cr,De,vu,nv,yu,xu,ov,Gs=class extends T{constructor(){super(...arguments);p(this,De);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;p(this,Sl);p(this,Cr,A("cm-mmenu"))}connectedCallback(){super.connectedCallback(),s(this,De,vu).call(this),g(this,Sl,Ai(this,()=>s(this,De,vu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Sl)?.disconnect()}get sections(){return this.items.length?this.items:this._slotted}back(){if(!this._page)return;let[e,t]=this._page;this._page=null,this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-row="${e}-${t}"]`)?.focus())}render(){let e=this.sections,t=this._page?e[this._page[0]]?.items?.[this._page[1]]:void 0;return t?c`<nav part="nav" class="sub" aria-label=${this.label||this.t("label")} id="${r(this,Cr)}-sub"
|
|
3066
3181
|
@keydown=${i=>{i.key==="Escape"&&(i.preventDefault(),this.back())}}>
|
|
3067
3182
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
3068
3183
|
${t.label}</button>
|
|
3069
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,
|
|
3184
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${s(this,De,xu).call(this,i,0,0,!0)}</li>`)}</ul>
|
|
3070
3185
|
<slot hidden></slot>
|
|
3071
3186
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3072
|
-
${s(this,
|
|
3073
|
-
${e.map((i,a)=>{let
|
|
3074
|
-
${i.label?c`<h2 class="heading" id=${
|
|
3075
|
-
<ul class="card">${(i.items??[]).map((d,
|
|
3187
|
+
${s(this,De,ov).call(this)}
|
|
3188
|
+
${e.map((i,a)=>{let l=`${r(this,Cr)}-s${a}`;return c`<section aria-labelledby=${i.label?l:h}>
|
|
3189
|
+
${i.label?c`<h2 class="heading" id=${l}>${i.label}</h2>`:h}
|
|
3190
|
+
<ul class="card">${(i.items??[]).map((d,m)=>c`<li>${s(this,De,xu).call(this,d,a,m)}</li>`)}</ul>
|
|
3076
3191
|
</section>`})}
|
|
3077
3192
|
<slot hidden></slot>
|
|
3078
|
-
</nav>`}};
|
|
3079
|
-
@click=${()=>s(this,
|
|
3080
|
-
<h2 class="heading" id="${r(this,
|
|
3193
|
+
</nav>`}};Sl=new WeakMap,Cr=new WeakMap,De=new WeakSet,vu=function(){this._slotted=Yt(this)},nv=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},yu=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},xu=function(e,t,i,a=!1){let l=v=>{Ri(this,e)||v.preventDefault()};if(e.primary&&!a)return c`<button type="button" class="row action" part="row" @click=${l}>${e.label}</button>`;let d=e.icon&&!a?c`<cm-icon class="icon" name=${e.icon} size="20"></cm-icon>`:h,m=e.badge?c`<span class="badge">${e.badge}</span>`:h;if(e.items?.length&&!a)return c`<button type="button" class="row" part="row" data-row="${t}-${i}"
|
|
3194
|
+
@click=${()=>s(this,De,nv).call(this,t,i)}>${d}<span class="label">${e.label}</span>${m}<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let u=c`${d}<span class="label">${e.label}</span>${m}${e.href&&!a?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return e.href?c`<a class="row" part="row" href=${e.href} aria-current=${e.current?"page":h} @click=${l}>${u}</a>`:c`<button type="button" class="row" part="row" aria-current=${e.current?"page":h} @click=${l}>${u}</button>`},ov=function(){if(!this.store&&!this.userName)return h;let e=this.userName.trim().charAt(0).toUpperCase();return c`<section aria-labelledby="${r(this,Cr)}-profile">
|
|
3195
|
+
<h2 class="heading" id="${r(this,Cr)}-profile">${this.t("profile")}</h2>
|
|
3081
3196
|
<ul class="card">
|
|
3082
|
-
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,
|
|
3197
|
+
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,De,yu).call(this,"cm-store-switch")}>
|
|
3083
3198
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
3084
3199
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3085
|
-
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,
|
|
3200
|
+
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>s(this,De,yu).call(this,"cm-account")}>
|
|
3086
3201
|
<span class="avatar">${this.avatarSrc?c`<img src=${this.avatarSrc} alt="">`:c`<span aria-hidden="true">${e}</span>`}</span>
|
|
3087
3202
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?c`<span class="email">${this.userEmail}</span>`:h}</span>
|
|
3088
3203
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3089
3204
|
</ul>
|
|
3090
|
-
</section>`},
|
|
3205
|
+
</section>`},Gs.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}},Gs.styles=[k,x`
|
|
3091
3206
|
:host { display: block; background: var(--cm-bg-page); }
|
|
3092
3207
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
3093
3208
|
.heading {
|
|
@@ -3124,12 +3239,12 @@ ${t.label}</button>
|
|
|
3124
3239
|
}
|
|
3125
3240
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3126
3241
|
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3127
|
-
`];$("cm-mobile-menu",
|
|
3242
|
+
`];$("cm-mobile-menu",Gs);var XE=z("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),Ah,lv,Ys=class extends T{constructor(){super(...arguments);p(this,Ah);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
3128
3243
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
3129
3244
|
<span class="text"><slot></slot></span>
|
|
3130
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,
|
|
3245
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${s(this,Ah,lv)}><cm-icon name="close" size="16"></cm-icon>
|
|
3131
3246
|
</button>`:h}
|
|
3132
|
-
</div>`}};
|
|
3247
|
+
</div>`}};Ah=new WeakSet,lv=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},Ys.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},Ys.styles=[k,x`
|
|
3133
3248
|
:host { display: block; }
|
|
3134
3249
|
.bar {
|
|
3135
3250
|
position: relative; display: flex; align-items: center; justify-content: center; gap: var(--cm-space-8); min-height: 48px;
|
|
@@ -3151,11 +3266,11 @@ ${t.label}</button>
|
|
|
3151
3266
|
@media (max-width: 640px) {
|
|
3152
3267
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
3153
3268
|
}
|
|
3154
|
-
`];$("cm-flash-offer-bar",
|
|
3269
|
+
`];$("cm-flash-offer-bar",Ys);var aM=z("linkTabs",{label:"Sections"}),Ll,Dl,wu,Xs=class extends T{constructor(){super(...arguments);p(this,Dl);this.items=[];this._slotted=[];p(this,Ll)}connectedCallback(){super.connectedCallback(),s(this,Dl,wu).call(this),g(this,Ll,Ai(this,()=>s(this,Dl,wu).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Ll)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3155
3270
|
<ul part="tabs">${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3156
|
-
@click=${t=>{
|
|
3271
|
+
@click=${t=>{Ri(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
3157
3272
|
<slot hidden></slot>
|
|
3158
|
-
</nav>`}};
|
|
3273
|
+
</nav>`}};Ll=new WeakMap,Dl=new WeakSet,wu=function(){this._slotted=Yt(this)},Xs.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0}},Xs.styles=[k,x`
|
|
3159
3274
|
:host { display: block; }
|
|
3160
3275
|
ul {
|
|
3161
3276
|
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
@@ -3174,7 +3289,7 @@ ${t.label}</button>
|
|
|
3174
3289
|
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
3175
3290
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
3176
3291
|
|
|
3177
|
-
`];$("cm-link-tabs",
|
|
3292
|
+
`];$("cm-link-tabs",Xs);var hM=z("appCard",{developer:"By {developer}",rating:"Rated {rating} out of 5",reviews:{one:"{count} Review",other:"{count} Reviews"},offer:"Offer: ",details:"View Details",detailsLabel:"View details of {name}"}),Js=class extends T{constructor(){super(...arguments);this.name="";this.developer="";this.reviewsHref="";this.pricing="";this.offer="";this.href="";this.headingLevel=3}render(){let e=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),t=typeof this.rating=="number"&&!Number.isNaN(this.rating),i=typeof this.reviews=="number"?this.t("reviews",{count:this.reviews}):"",a=t?this.formatNumber(this.rating,{minimumFractionDigits:1,maximumFractionDigits:1}):"";return c`<article part="card" aria-labelledby="name">
|
|
3178
3293
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
3179
3294
|
<div class="status"><slot name="status"></slot></div>
|
|
3180
3295
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
@@ -3186,7 +3301,7 @@ ${t.label}</button>
|
|
|
3186
3301
|
${this.offer?c`<p class="offer"><cm-icon name="percent" size="12"></cm-icon><span><span class="sr">${this.t("offer")}</span>${this.offer}</span></p>`:h}
|
|
3187
3302
|
<div class="actions"><slot name="actions"></slot>${this.href?c`<a class="details" part="details" href=${this.href}
|
|
3188
3303
|
aria-label=${this.t("detailsLabel",{name:this.name})}>${this.t("details")}</a>`:h}</div>
|
|
3189
|
-
</article>`}};
|
|
3304
|
+
</article>`}};Js.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},Js.styles=[k,x`
|
|
3190
3305
|
:host { display: block; container-type: inline-size; }
|
|
3191
3306
|
article {
|
|
3192
3307
|
position: relative; display: flex; flex-direction: column; gap: var(--cm-space-8); height: 100%; padding: var(--cm-space-20);
|
|
@@ -3223,21 +3338,21 @@ ${t.label}</button>
|
|
|
3223
3338
|
.actions { gap: var(--cm-space-8); }
|
|
3224
3339
|
.details { margin-inline-start: auto; }
|
|
3225
3340
|
}
|
|
3226
|
-
`];$("cm-app-card",
|
|
3341
|
+
`];$("cm-app-card",Js);var Rh,cv,Zs=class extends ee{constructor(){super(...arguments);p(this,Rh);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3227
3342
|
${this.renderHeader()}
|
|
3228
3343
|
<div class="body" part="body"><slot></slot></div>
|
|
3229
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,
|
|
3230
|
-
</div>`)}};
|
|
3344
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${s(this,Rh,cv)}></slot></footer>
|
|
3345
|
+
</div>`)}};Rh=new WeakSet,cv=function(e){this._hasFooter=e.target.assignedElements().length>0},Zs.properties={...ee.properties,size:{reflect:!0},_hasFooter:{state:!0}},Zs.styles=[...ee.overlayStyles,x`
|
|
3231
3346
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
3232
3347
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
3233
3348
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
3234
3349
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
3235
3350
|
|
|
3236
|
-
`];$("cm-modal",
|
|
3351
|
+
`];$("cm-modal",Zs);var Hh,dv,Mt=class extends ee{constructor(){super(...arguments);p(this,Hh);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}renderBody(){return c`<slot></slot>`}renderFooter(){return c`<slot name="footer" @slotchange=${s(this,Hh,dv)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3237
3352
|
${this.renderHeader()}
|
|
3238
3353
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
3239
3354
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
3240
|
-
</div>`)}};
|
|
3355
|
+
</div>`)}};Hh=new WeakSet,dv=function(e){this._hasFooter=e.target.assignedElements().length>0},Mt.properties={...ee.properties,size:{reflect:!0},_hasFooter:{state:!0}},Mt.styles=[...ee.overlayStyles,x`
|
|
3241
3356
|
dialog {
|
|
3242
3357
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
3243
3358
|
}
|
|
@@ -3255,26 +3370,26 @@ ${t.label}</button>
|
|
|
3255
3370
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
3256
3371
|
|
|
3257
3372
|
}
|
|
3258
|
-
`];$("cm-side-panel",
|
|
3373
|
+
`];$("cm-side-panel",Mt);var zM=z("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),en,Nh,Qs=class extends Mt{constructor(){super(...arguments);this.search=!1;this.query="";p(this,en,()=>{this.dispatchEvent(new CustomEvent("cm-filter-apply",{detail:{values:this.values,query:this.query},bubbles:!0,composed:!0,cancelable:!0}))&&this.requestClose("action")});p(this,Nh,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(a,l)=>{if(l==="")return;let d=e[a];e[a]=d===void 0?l:Array.isArray(d)?[...d,l]:[d,l]},i=this.form;if(i){for(let[a,l]of new FormData(i))typeof l=="string"&&t(a,l);return e}return this.querySelectorAll("[name]").forEach(a=>{let l=a.getAttribute("name");"checked"in a&&(a.type==="checkbox"||a.type==="radio"||a.localName.match(/^cm-(checkbox|radio|toggle)$/))?a.checked&&t(l,a.value||"on"):typeof a.value=="string"&&t(l,a.value)}),e}reset(){let e=this.form;e?e.reset():this.querySelectorAll("[name]").forEach(t=>t.formResetCallback?.()),this.query=""}renderBody(){return c`${this.search?c`<cm-search class="search" part="search" .value=${this.query} label=${this.searchLabel}
|
|
3259
3374
|
placeholder=${this.searchPlaceholder}
|
|
3260
3375
|
@input=${e=>{this.query=e.target.value}}
|
|
3261
|
-
@cm-search=${e=>{e.stopPropagation(),r(this,
|
|
3262
|
-
<slot @submit=${e=>{e.preventDefault(),r(this,
|
|
3263
|
-
<cm-button part="apply" variant="primary" @click=${r(this,
|
|
3376
|
+
@cm-search=${e=>{e.stopPropagation(),r(this,en).call(this)}}></cm-search>`:h}
|
|
3377
|
+
<slot @submit=${e=>{e.preventDefault(),r(this,en).call(this)}}></slot>`}renderFooter(){return c`<cm-button part="reset" @click=${r(this,Nh)}>${this.resetLabel}</cm-button>
|
|
3378
|
+
<cm-button part="apply" variant="primary" @click=${r(this,en)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};en=new WeakMap,Nh=new WeakMap,Qs.properties={...Mt.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"}},Qs.styles=[...Mt.styles,x`
|
|
3264
3379
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
3265
3380
|
.foot { justify-content: center; }
|
|
3266
3381
|
::slotted(form) { display: grid; gap: var(--cm-space-12); }
|
|
3267
|
-
`];$("cm-filter-panel",
|
|
3382
|
+
`];$("cm-filter-panel",Qs);var Al,Sr,$u,hv,tn=class extends ee{constructor(){super(...arguments);p(this,Sr);this.heading="";this.items=[];this._slotted=[];p(this,Al)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=On(this),g(this,Al,fc(this,()=>{this._slotted=On(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,Al)?.disconnect()}render(){let e=this.sheetItems.filter(i=>!i.divider&&!i.heading),t=e.some(i=>i.icon);return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3268
3383
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
3269
3384
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
3270
3385
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
3271
3386
|
<div class="content">
|
|
3272
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,
|
|
3387
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${s(this,Sr,hv).call(this,i)}</li>`)}</ul>`:h}
|
|
3273
3388
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
3274
3389
|
</div>
|
|
3275
|
-
</div>`)}};
|
|
3276
|
-
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${a=>s(this,
|
|
3277
|
-
@click=${a=>s(this,
|
|
3390
|
+
</div>`)}};Al=new WeakMap,Sr=new WeakSet,$u=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")},hv=function(e){let t=`row${e.critical?" critical":""}`,i=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
3391
|
+
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${a=>s(this,Sr,$u).call(this,a,e)}>${i}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
3392
|
+
@click=${a=>s(this,Sr,$u).call(this,a,e)}>${i}</button>`},tn.properties={...ee.properties,items:{type:Array},_slotted:{state:!0}},tn.styles=[...ee.overlayStyles,x`
|
|
3278
3393
|
dialog {
|
|
3279
3394
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: var(--cm-space-24);
|
|
3280
3395
|
}
|
|
@@ -3308,17 +3423,17 @@ ${t.label}</button>
|
|
|
3308
3423
|
}
|
|
3309
3424
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
3310
3425
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3311
|
-
`];$("cm-bottom-sheet",
|
|
3312
|
-
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(a=>c`<li>${s(this,
|
|
3426
|
+
`];$("cm-bottom-sheet",tn);var qM=z("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),_y={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},rn=class extends S{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};rn.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},rn.styles=x`:host { display: none; }`;$("cm-notification-item",rn);var sn,Ie,ku,Eu,mv,pv,uv,an=class extends ee{constructor(){super(...arguments);p(this,Ie);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;p(this,sn)}connectedCallback(){super.connectedCallback(),s(this,Ie,ku).call(this),g(this,sn,new MutationObserver(()=>s(this,Ie,ku).call(this))),r(this,sn).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,sn)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications,t=this.markAllRead&&!this.loading&&e.some(a=>a.unread)?c`<button type="button" class="mark" part="mark-all-read" @click=${s(this,Ie,pv)}>${this.markAllLabel}</button>`:h,i=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
3427
|
+
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(a=>c`<li>${s(this,Ie,mv).call(this,a)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3313
3428
|
${this.renderHeader(t)}
|
|
3314
3429
|
${i}
|
|
3315
3430
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3316
3431
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
3317
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,
|
|
3432
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${s(this,Ie,uv)}></slot></div>
|
|
3318
3433
|
<slot hidden></slot>
|
|
3319
|
-
</div>`)}};
|
|
3434
|
+
</div>`)}};sn=new WeakMap,Ie=new WeakSet,ku=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=i=>e.getAttribute(i)||void 0;return{label:(e.textContent??"").trim(),time:t("time"),tone:t("tone")??"information",href:t("href"),unread:e.hasAttribute("unread")||void 0,value:t("value"),description:t("description"),icon:t("icon")}})},Eu=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")},mv=function(e){let t=e.tone??"information",i=e.description?c`<span class="title">${e.label}</span><span class="vh">, </span><span class="desc">${e.description}</span>`:e.label,a=c`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${e.icon||_y[t]||"bell"} size="14"></cm-icon></span>
|
|
3320
3435
|
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${i}</span>
|
|
3321
|
-
${e.time?c`<time>${e.time}</time>`:h}`,
|
|
3436
|
+
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>s(this,Ie,Eu).call(this,d,e)}>${a}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>s(this,Ie,Eu).call(this,d,e)}>${a}</button>`},pv=async function(e){let t=e.currentTarget;this.dispatchEvent(new CustomEvent("cm-mark-all-read",{bubbles:!0,composed:!0})),await new Promise(i=>setTimeout(i)),await this.updateComplete,!t.isConnected&&this.open&&this.renderRoot.querySelector(".panel")?.focus()},uv=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},an.properties={...ee.properties,items:{type:Array},moreHref:{attribute:"more-href"},heading:{string:"heading"},moreLabel:{attribute:"more-label",string:"more"},emptyText:{attribute:"empty-text",string:"empty"},markAllRead:{type:Boolean,attribute:"mark-all-read"},markAllLabel:{attribute:"mark-all-label",string:"markAllRead"},loading:{type:Boolean,reflect:!0},_slotted:{state:!0},_footer:{state:!0}},an.styles=[...ee.overlayStyles,x`
|
|
3322
3437
|
dialog {
|
|
3323
3438
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
3324
3439
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3368,14 +3483,15 @@ ${t.label}</button>
|
|
|
3368
3483
|
@media (max-width: 599px) {
|
|
3369
3484
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3370
3485
|
}
|
|
3371
|
-
`];$("cm-notification-panel",
|
|
3486
|
+
`];$("cm-notification-panel",an);var WM=z("toastRegion",{label:"Notifications"}),GM=z("toast",{undo:"Undo",shortcut:"Press F6 to reach it."}),gv=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o&&o!==document.body?o:null},Mu=(o,n)=>{for(let e=n;e;e=e.parentNode??e.host??null)if(e===o)return!0;return!1},Cy=2e3,bv=1e4,fv=150,Rl,ut,Jt,Hl,cn,dn,Lr,Hi,Dr,pe,Ih,vv,nn,Tu,Nl,Il,Pl,Ol,yv,on=class extends T{constructor(){super(...arguments);p(this,pe);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;p(this,Rl);p(this,ut);p(this,Jt,0);p(this,Hl,0);p(this,cn,!1);p(this,dn,!1);p(this,Lr);p(this,Hi);p(this,Dr);p(this,Nl,()=>{g(this,cn,!0),s(this,pe,Tu).call(this)});p(this,Il,()=>{g(this,cn,!1),s(this,pe,nn).call(this)});p(this,Pl,()=>{g(this,dn,!0),s(this,pe,Tu).call(this)});p(this,Ol,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(g(this,dn,!1),s(this,pe,nn).call(this))})}get closed(){if(!r(this,Lr)){if(!this.open&&r(this,Dr))return Promise.resolve(r(this,Dr));g(this,Lr,new Promise(e=>{g(this,Hi,e)}))}return r(this,Lr)}get effectiveDuration(){let e=this.duration??(this.actionLabel?bv:5e3);return Math.min(bv,Math.max(Cy,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&g(this,Rl,setTimeout(()=>{this._primed=!0},fv)),this.addEventListener("pointerenter",r(this,Nl)),this.addEventListener("pointerleave",r(this,Il)),this.addEventListener("focusin",r(this,Pl)),this.addEventListener("focusout",r(this,Ol))}disconnectedCallback(){super.disconnectedCallback(),this.open&&r(this,Hi)&&queueMicrotask(()=>{!this.isConnected&&this.open&&s(this,pe,Ih).call(this,"removed")}),clearTimeout(r(this,ut)),clearTimeout(r(this,Rl)),this.removeEventListener("pointerenter",r(this,Nl)),this.removeEventListener("pointerleave",r(this,Il)),this.removeEventListener("focusin",r(this,Pl)),this.removeEventListener("focusout",r(this,Ol))}updated(e){e.has("open")&&e.get("open")!==void 0&&(this.open?g(this,Dr,void 0):r(this,Hi)&&s(this,pe,Ih).call(this,"close")),(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,ut)),this.open&&(this._inRegion||this._primed)&&(g(this,Jt,this.effectiveDuration),s(this,pe,nn).call(this)))}show(){this.open?(g(this,Jt,this.effectiveDuration),s(this,pe,nn).call(this)):this.open=!0}dismiss(e="close"){let t=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0,detail:{reason:e}});return this.dispatchEvent(t)?(clearTimeout(r(this,ut)),this.open=!1,s(this,pe,Ih).call(this,e),!0):(e==="timeout"&&(g(this,Jt,this.effectiveDuration),s(this,pe,nn).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3372
3487
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3373
3488
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3374
|
-
${this.actionLabel?c`<button class="action" part="action" @click=${s(this,
|
|
3489
|
+
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${s(this,pe,yv)}>${this.actionLabel}</button>`:h}
|
|
3375
3490
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3376
3491
|
<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>
|
|
3377
3492
|
</button>
|
|
3378
|
-
|
|
3493
|
+
${this.actionLabel&&this._inRegion&&this.t("shortcut")?c`<span class="hint">${this.t("shortcut")}</span>`:h}
|
|
3494
|
+
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Rl=new WeakMap,ut=new WeakMap,Jt=new WeakMap,Hl=new WeakMap,cn=new WeakMap,dn=new WeakMap,Lr=new WeakMap,Hi=new WeakMap,Dr=new WeakMap,pe=new WeakSet,Ih=function(e){g(this,Dr,e);let t=r(this,Hi);g(this,Lr,g(this,Hi,void 0)),t?.(e)},vv=function(){return r(this,cn)||r(this,dn)},nn=function(){clearTimeout(r(this,ut)),!(!this.open||r(this,pe,vv))&&(g(this,Hl,Date.now()),g(this,ut,setTimeout(()=>this.dismiss("timeout"),r(this,Jt))))},Tu=function(){r(this,ut)!==void 0&&(clearTimeout(r(this,ut)),g(this,ut,void 0),g(this,Jt,Math.max(1e3,r(this,Jt)-(Date.now()-r(this,Hl)))))},Nl=new WeakMap,Il=new WeakMap,Pl=new WeakMap,Ol=new WeakMap,yv=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},on.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},on.styles=[k,x`
|
|
3379
3495
|
:host { display: block; pointer-events: auto; }
|
|
3380
3496
|
:host(:not([open])) { display: none; }
|
|
3381
3497
|
.toast {
|
|
@@ -3396,17 +3512,24 @@ ${t.label}</button>
|
|
|
3396
3512
|
}
|
|
3397
3513
|
.action { text-decoration: underline; text-underline-offset: 3px; }
|
|
3398
3514
|
.close { inline-size: 32px; padding: 0; }
|
|
3515
|
+
/* Slim (32) inside the toast; on touch screens drawn 40 with a 44px hit area (owner standard 1.6). */
|
|
3516
|
+
@media (pointer: coarse) {
|
|
3517
|
+
button { position: relative; min-block-size: var(--cm-control-height-lg, 40px); }
|
|
3518
|
+
.close { inline-size: var(--cm-control-height-lg, 40px); }
|
|
3519
|
+
button::after { content: ''; position: absolute; inset: -2px; }
|
|
3520
|
+
}
|
|
3521
|
+
.hint { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3399
3522
|
button:hover { background: color-mix(in srgb, var(--cm-text-on-dark) 14%, transparent); }
|
|
3400
3523
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
3401
3524
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
3402
3525
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
3403
|
-
`];$("cm-toast",
|
|
3526
|
+
`];$("cm-toast",on);var Ar,ql,Bl,Fl,jl,Ul,hn,Ph,ln=class extends T{constructor(){super(...arguments);p(this,hn);this.max=3;p(this,Ar,null);p(this,ql,!1);p(this,Bl,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let i=t.matches(":focus-within");t.remove(),i&&s(this,hn,Ph).call(this)})});p(this,Fl,e=>{let t=e.relatedTarget;t&&!Mu(this,t)&&g(this,Ar,t)});p(this,jl,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(i=>i.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});p(this,Ul,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?s(this,hn,Ph).call(this):this.focusToast())&&e.preventDefault()})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),g(this,ql,!0)),this.addEventListener("cm-dismiss",r(this,Bl)),this.addEventListener("focusin",r(this,Fl)),this.addEventListener("keydown",r(this,jl)),document.addEventListener("keydown",r(this,Ul))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Bl)),this.removeEventListener("focusin",r(this,Fl)),this.removeEventListener("keydown",r(this,jl)),document.removeEventListener("keydown",r(this,Ul))}updated(){r(this,ql)&&this.setAttribute("aria-label",this.t("label"))}focusToast(){let e=[...this.querySelectorAll(":scope > cm-toast[open]")].reverse(),t=e.find(l=>l.actionLabel)??e[0],i=t?.shadowRoot?.querySelector(".action")??t?.shadowRoot?.querySelector(".close");if(!i)return!1;let a=gv();return a&&!Mu(this,a)&&g(this,Ar,a),i.focus(),!0}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")],i=t.slice(0,Math.max(0,t.length-Math.max(1,this.max))),a=i.some(l=>l.matches(":focus-within"));return i.forEach(l=>l.remove()),a&&s(this,hn,Ph).call(this),e}render(){return c`<slot></slot>`}};Ar=new WeakMap,ql=new WeakMap,Bl=new WeakMap,Fl=new WeakMap,jl=new WeakMap,Ul=new WeakMap,hn=new WeakSet,Ph=function(){let e=r(this,Ar);return g(this,Ar,null),e?.isConnected?(e.focus(),Mu(e,gv())||e.shadowRoot?.querySelector("button, a[href], input, select, textarea, [tabindex]")?.focus(),!0):!1},ln.properties={max:{type:Number}},ln.styles=[k,x`
|
|
3404
3527
|
:host {
|
|
3405
3528
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
3406
3529
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
3407
3530
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
3408
3531
|
}
|
|
3409
|
-
`];$("cm-toast-region",
|
|
3532
|
+
`];$("cm-toast-region",ln);function xv(o,n={}){let e=n.root??document.body,t=e.querySelector(":scope > cm-toast-region"),i=!t;t||(t=document.createElement("cm-toast-region"),e.append(t));let a=document.createElement("cm-toast");if(a.message=String(o),n.tone&&(a.tone=n.tone),n.duration!==void 0&&(a.duration=n.duration),n.action){a.actionLabel=n.action.label;let l=n.action.onAction;a.addEventListener("cm-action",()=>l())}if(i){let l=t;return setTimeout(()=>l.add(a),fv),a}return t.add(a)}async function Sy(o,n,e){await o();let{message:t,undoLabel:i,...a}=e,l=i??mc("toast","undo",void 0,a.root??document.body),d=await xv(t,{...a,action:{label:l,onAction:()=>{}}}).closed;return d==="action"&&await n(),d}var t2=z("progressBar",{inProgress:"In progress"}),Oh,mn=class extends T{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";p(this,Oh,A("cm-progress"))}get clampedValue(){let e=this.value;return e==null||Number.isNaN(Number(e))?null:Math.min(100,Math.max(0,Number(e)))}render(){let e=this.clampedValue,t=`${r(this,Oh)}-label`;return c`
|
|
3410
3533
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
3411
3534
|
<span id=${t} part="label">${this.label}</span>
|
|
3412
3535
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -3416,7 +3539,7 @@ ${t.label}</button>
|
|
|
3416
3539
|
aria-valuenow=${e===null?h:Math.round(e)}
|
|
3417
3540
|
aria-valuetext=${e===null?this.t("inProgress"):this.formatNumber(Math.round(e)/100,{style:"percent"})}>
|
|
3418
3541
|
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
3419
|
-
</div>`}};
|
|
3542
|
+
</div>`}};Oh=new WeakMap,mn.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},mn.styles=[k,x`
|
|
3420
3543
|
:host { display: block; }
|
|
3421
3544
|
.head { display: flex; justify-content: space-between; gap: var(--cm-space-8); margin-block-end: var(--cm-space-8); font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3422
3545
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
@@ -3434,7 +3557,7 @@ ${t.label}</button>
|
|
|
3434
3557
|
.fill { transition: none; }
|
|
3435
3558
|
.indeterminate .fill { animation-duration: 4s; }
|
|
3436
3559
|
}
|
|
3437
|
-
`];$("cm-progress-bar",
|
|
3560
|
+
`];$("cm-progress-bar",mn);var pn=class extends S{constructor(){super(...arguments);this.tone="neutral"}render(){return c`<span part="badge"><slot></slot></span>`}};pn.properties={tone:{reflect:!0}},pn.styles=[k,x`
|
|
3438
3561
|
:host { display: inline-flex; vertical-align: middle; }
|
|
3439
3562
|
span {
|
|
3440
3563
|
display: inline-flex; align-items: center; box-sizing: border-box; height: 24px; padding: 0 var(--cm-space-8); white-space: nowrap;
|
|
@@ -3446,12 +3569,12 @@ ${t.label}</button>
|
|
|
3446
3569
|
: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); }
|
|
3447
3570
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
3448
3571
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
3449
|
-
`];$("cm-badge",
|
|
3572
|
+
`];$("cm-badge",pn);var gn,bn,gt,wv,$v,Vl,kv,qh,zu,un=class extends S{constructor(){super(...arguments);p(this,gt);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;this.variant="standard";this.href="";this.target="";this.selected=!1;this.label="";p(this,gn,!1);p(this,bn,!1);p(this,Vl,!1);p(this,qh,()=>{this.href||this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))})}willUpdate(){this.selected&&g(this,Vl,!0)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=r(this,gt,kv),i=t?s(this,gt,zu).call(this,this.heading):this.heading,a=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${i}</span><span class="adornment" ?hidden=${!r(this,gn)}><slot name="title-adornment" @slotchange=${s(this,gt,wv)}></slot></span></div>`:h;return c`<section part="card" aria-label=${!t&&this.heading||h}>${t&&!this.heading?s(this,gt,zu).call(this,h):h}
|
|
3450
3573
|
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${a}${this.description?c`<p class="desc">${this.description}</p>`:h}</div>
|
|
3451
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,
|
|
3574
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,bn)}><div class="actions"><slot name="actions" @slotchange=${s(this,gt,$v)}></slot></div></div>`}
|
|
3452
3575
|
<slot></slot>
|
|
3453
|
-
</section>`}};
|
|
3454
|
-
aria-current=${this.selected?"true":h} aria-label=${i}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":r(this,
|
|
3576
|
+
</section>`}};gn=new WeakMap,bn=new WeakMap,gt=new WeakSet,wv=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,gn)&&(g(this,gn,t),this.requestUpdate())},$v=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,bn)&&(g(this,bn,t),this.requestUpdate())},Vl=new WeakMap,kv=function(){return String(this.variant||"").split(/\s+/).includes("interactive")},qh=new WeakMap,zu=function(e){let t=e===h?"hit cover":"hit",i=e===h?this.label||h:h;return this.href?c`<a class=${t} part="control" href=${this.href} target=${this.target||h} rel=${this.target==="_blank"?"noopener noreferrer":h}
|
|
3577
|
+
aria-current=${this.selected?"true":h} aria-label=${i}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":r(this,Vl)?"false":h} aria-label=${i} @click=${r(this,qh)}>${e}</button>`},un.properties={heading:{},description:{},flush:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},href:{},target:{},selected:{type:Boolean,reflect:!0},label:{}},un.styles=[k,x`
|
|
3455
3578
|
/* Owner standard (1.6): 24px padding and a 16px gap under the header; compact 16px and 12px; 16px on phones. */
|
|
3456
3579
|
:host { display: block; --_pad: var(--cm-space-24); --_gap: var(--cm-space-16); }
|
|
3457
3580
|
:host([variant~='compact']) { --_pad: var(--cm-space-16); --_gap: var(--cm-space-12); }
|
|
@@ -3503,8 +3626,8 @@ ${t.label}</button>
|
|
|
3503
3626
|
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
|
|
3504
3627
|
.bare[hidden] { display: none; }
|
|
3505
3628
|
:host([flush]) .bare { padding: var(--_pad) var(--_pad) 0; margin-bottom: var(--cm-space-8); }
|
|
3506
|
-
`];$("cm-card",
|
|
3507
|
-
`))}var
|
|
3629
|
+
`];$("cm-card",un);var Ly=["0","4","8","12","16","20","24","32","40","48","64"],Dy={10:"8",15:"16",22:"24",30:"32"};function fn(o,n){let e=(t,i)=>`:host([${o}='${t}']) { ${n}: ${i==="0"?"0px":`var(--cm-space-${i})`}; }`;return ec([...Ly.map(t=>e(t,t)),...Object.entries(Dy).map(([t,i])=>e(t,i))].join(`
|
|
3630
|
+
`))}var vn=class extends S{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return c`<slot></slot>`}};vn.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},vn.styles=[k,x`
|
|
3508
3631
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
3509
3632
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
3510
3633
|
:host([wrap]) { flex-wrap: wrap; }
|
|
@@ -3517,13 +3640,13 @@ ${t.label}</button>
|
|
|
3517
3640
|
:host([justify='center']) { justify-content: center; }
|
|
3518
3641
|
:host([justify='end']) { justify-content: flex-end; }
|
|
3519
3642
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
3520
|
-
`,
|
|
3643
|
+
`,fn("gap","gap")];$("cm-stack",vn);var Ev="important",Ay=" !"+Ev,Mv=Gr(class extends ti{constructor(o){if(super(o),o.type!==ot.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((n,e)=>{let t=o[e];return t==null?n:n+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(o,[n]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(let t of this.ft)n[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in n){let i=n[t];if(i!=null){this.ft.add(t);let a=typeof i=="string"&&i.endsWith(Ay);t.includes("-")||a?e.setProperty(t,a?i.slice(0,-11):i,a?Ev:""):e[t]=i}}return we}});var yn=class extends S{constructor(){super(...arguments);this.columns=2;this.gap="20"}render(){let e=Math.max(1,Math.floor(Number(this.columns)||1)),t=this.minColumnWidth?.trim(),i=t?`repeat(auto-fit, minmax(min(100%, ${t}), 1fr))`:`repeat(${e}, minmax(0, 1fr))`;return c`<div class="grid ${t?"fit":"fixed"}" part="grid" style=${Mv({gridTemplateColumns:i})}><slot></slot></div>`}};yn.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},yn.styles=[k,x`
|
|
3521
3644
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
3522
3645
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
3523
3646
|
@container cm-grid (max-width: 640px) {
|
|
3524
3647
|
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
3525
3648
|
}
|
|
3526
|
-
`,
|
|
3649
|
+
`,fn("gap","--_gap")];$("cm-grid",yn);var jh,Rr,Hr,Wl,ce,Bh,_u,Kl,Fh,Cu,xn=class extends S{constructor(){super(...arguments);p(this,ce);this.gap="24";this.variant="default";this.asidePosition="above";this.stickyAside=!1;p(this,jh,this.attachInternals());p(this,Rr);p(this,Hr,[]);p(this,Wl,()=>s(this,ce,Fh).call(this))}disconnectedCallback(){super.disconnectedCallback(),s(this,ce,_u).call(this)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&s(this,ce,Kl).call(this)}updated(e){(e.has("stickyAside")||e.has("variant"))&&s(this,ce,Kl).call(this)}get asideSticks(){let e=s(this,ce,Bh).call(this)[0];return!!e&&getComputedStyle(e).position==="sticky"}render(){return c`<div class="layout" part="layout"><slot @slotchange=${()=>{this.stickyAside&&s(this,ce,Kl).call(this)}}></slot></div>`}};jh=new WeakMap,Rr=new WeakMap,Hr=new WeakMap,Wl=new WeakMap,ce=new WeakSet,Bh=function(){return[...this.children].filter(e=>e.getAttribute("variant")==="aside")},_u=function(){r(this,Rr)?.disconnect(),g(this,Rr,void 0),g(this,Hr,[]),window.removeEventListener("resize",r(this,Wl)),s(this,ce,Cu).call(this,!1)},Kl=function(){s(this,ce,_u).call(this),!(!this.stickyAside||this.variant!=="record"||!this.isConnected)&&(g(this,Rr,new ResizeObserver(()=>s(this,ce,Fh).call(this))),g(this,Hr,[this,...s(this,ce,Bh).call(this)]),r(this,Hr).forEach(e=>r(this,Rr).observe(e)),window.addEventListener("resize",r(this,Wl)),s(this,ce,Fh).call(this))},Fh=function(){let e=s(this,ce,Bh).call(this);if(e.some(i=>!r(this,Hr).includes(i))){s(this,ce,Kl).call(this);return}let t=e.length>0&&e.every(i=>{let a=parseFloat(getComputedStyle(i).insetBlockStart)||0;return i.getBoundingClientRect().height+a<=window.innerHeight});s(this,ce,Cu).call(this,t)},Cu=function(e){let t=r(this,jh).states;if(t)try{e?t.add("aside-fits"):t.delete("aside-fits")}catch{}},xn.properties={gap:{reflect:!0},variant:{reflect:!0},asidePosition:{attribute:"aside-position",reflect:!0},stickyAside:{type:Boolean,attribute:"sticky-aside",reflect:!0}},xn.styles=[k,x`
|
|
3527
3650
|
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-24); }
|
|
3528
3651
|
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
3529
3652
|
@container cm-layout (max-width: 767px) {
|
|
@@ -3534,12 +3657,32 @@ ${t.label}</button>
|
|
|
3534
3657
|
::slotted(*) { grid-column: 1 / -1; min-inline-size: 0; }
|
|
3535
3658
|
@container cm-layout (min-width: 768px) {
|
|
3536
3659
|
::slotted([variant='one-half']) { grid-column: span 3; }
|
|
3537
|
-
::slotted([variant='one-third']) { grid-column: span 2; }
|
|
3660
|
+
::slotted([variant='one-third']), ::slotted([variant='aside']) { grid-column: span 2; }
|
|
3538
3661
|
::slotted([variant='two-thirds']) { grid-column: span 4; }
|
|
3539
3662
|
}
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3663
|
+
|
|
3664
|
+
/* Record layout (1.7). The phone gap is set on .layout, so it also reaches the sections (inherited). */
|
|
3665
|
+
:host([variant='record']) .layout { grid-template-columns: minmax(0, 1fr); }
|
|
3666
|
+
:host([variant='record']) ::slotted(*) { grid-column: 1 / -1; order: 0; --_cm-section-gap: var(--_gap); }
|
|
3667
|
+
:host([variant='record']) ::slotted([variant='aside']) { order: -1; }
|
|
3668
|
+
:host([variant='record'][aside-position='below']) ::slotted([variant='aside']) { order: 1; }
|
|
3669
|
+
@container cm-layout (max-width: 640px) {
|
|
3670
|
+
:host([variant='record'][gap='24']) .layout { --_gap: var(--cm-space-16); }
|
|
3671
|
+
}
|
|
3672
|
+
@container cm-layout (min-width: 880px) {
|
|
3673
|
+
/* Dense placement puts the aside beside the main section whichever comes first in the source. */
|
|
3674
|
+
:host([variant='record']) .layout { grid-template-columns: minmax(0, 1fr) 320px; grid-auto-flow: dense; } /* scale-exempt: the record aside is a fixed 320px column */
|
|
3675
|
+
:host([variant='record']) ::slotted(*) { grid-column: 1; order: 0; }
|
|
3676
|
+
:host([variant='record']) ::slotted([variant='aside']) { grid-column: 2; }
|
|
3677
|
+
:host([variant='record'][sticky-aside]:state(aside-fits)) ::slotted([variant='aside']) { position: sticky; }
|
|
3678
|
+
}
|
|
3679
|
+
:host([variant='record'][sticky-aside]) ::slotted([variant='aside']) {
|
|
3680
|
+
/* Read back by #measure(); only takes effect once the aside is sticky. --_header: cm-app-frame's header height. */
|
|
3681
|
+
inset-block-start: var(--cm-layout-sticky-top, calc(var(--_header, 0px) + var(--cm-space-24)));
|
|
3682
|
+
}
|
|
3683
|
+
`,fn("gap","--_gap")];var wn=class extends S{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};wn.properties={variant:{reflect:!0}},wn.styles=[k,x`
|
|
3684
|
+
:host { display: flex; flex-direction: column; gap: var(--_cm-section-gap, var(--cm-space-24)); min-inline-size: 0; }
|
|
3685
|
+
`];$("cm-layout",xn);$("cm-layout-section",wn);var Su=1024,Ry=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},Ir,kn,Pe,Lu,Nr,Tv,Gl,Yl,$n=class extends S{constructor(){super(...arguments);p(this,Pe);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;p(this,Ir);p(this,kn,null);p(this,Gl,e=>{if(!this.menuItem)return;let t=s(this,Pe,Tv).call(this,e),i=e.detail?.value;t==="bottom-navigation"&&i===this.menuItem?s(this,Pe,Nr).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&s(this,Pe,Nr).call(this,!1,!1)});p(this,Yl,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),s(this,Pe,Nr).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,Gl)),this.addEventListener("keydown",r(this,Yl));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=Su)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,Gl)),this.removeEventListener("keydown",r(this,Yl)),r(this,Ir)?.disconnect(),g(this,Ir,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;g(this,Ir,new ResizeObserver(()=>{s(this,Pe,Lu).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=Su!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=Su}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,Ir).observe(t))}updated(e){e.has("_wide")&&s(this,Pe,Lu).call(this)}openMenu(){s(this,Pe,Nr).call(this,!0)}closeMenu(){s(this,Pe,Nr).call(this,!1)}toggleMenu(){s(this,Pe,Nr).call(this,!this.menuOpen)}render(){let e=this._wide,t=this.menuOpen&&!e&&!!this.querySelector(':scope > [slot="mobile-menu"]');return c`<div class="frame ${e?"wide":""}" part="frame">
|
|
3543
3686
|
<div class="probe"></div>
|
|
3544
3687
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
3545
3688
|
<div class="body">
|
|
@@ -3548,7 +3691,7 @@ ${t.label}</button>
|
|
|
3548
3691
|
</div>
|
|
3549
3692
|
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
3550
3693
|
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
3551
|
-
</div>`}};
|
|
3694
|
+
</div>`}};Ir=new WeakMap,kn=new WeakMap,Pe=new WeakSet,Lu=function(){let e=this.renderRoot.querySelector(".frame");if(!e)return;let t=i=>Math.round(this.renderRoot.querySelector(i)?.getBoundingClientRect().height??0);e.style.setProperty("--_header",`${t(".header")}px`),e.style.setProperty("--_bottom",`${this._wide?0:t(".bottom")}px`)},Nr=function(e,t=!0){e!==this.menuOpen&&(e&&g(this,kn,Ry()),this.menuOpen=e,this.dispatchEvent(new CustomEvent("cm-menu-toggle",{bubbles:!0,composed:!0,detail:{open:e}})),this.updateComplete.then(()=>{if(e){let i=this.querySelector(':scope > [slot="mobile-menu"]');(i?.shadowRoot??i)?.querySelector("a[href], button")?.focus()}else t&&(r(this,kn)?.focus(),g(this,kn,null))}))},Tv=function(e){return e.composedPath().find(i=>i.parentElement===this)?.getAttribute("slot")??""},Gl=new WeakMap,Yl=new WeakMap,$n.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},panel:{type:Boolean,reflect:!0},_wide:{state:!0}},$n.styles=[k,x`
|
|
3552
3695
|
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
3553
3696
|
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
3554
3697
|
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
@@ -3579,7 +3722,7 @@ ${t.label}</button>
|
|
|
3579
3722
|
}
|
|
3580
3723
|
.probe { block-size: 0; }
|
|
3581
3724
|
[hidden] { display: none !important; }
|
|
3582
|
-
`];$("cm-app-frame"
|
|
3725
|
+
`];$("cm-app-frame",$n);var En=class extends S{constructor(){super(...arguments);this.width="";this.fullWidth=!1;this.narrow=!1}render(){return c`<slot name="header"></slot><div class="content" part="content"><slot></slot></div><slot name="footer"></slot>`}};En.properties={width:{reflect:!0},fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},En.styles=[k,x`
|
|
3583
3726
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-page-background, var(--cm-bg-page)); min-block-size: 100%; }
|
|
3584
3727
|
.content {
|
|
3585
3728
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
@@ -3591,16 +3734,16 @@ ${t.label}</button>
|
|
|
3591
3734
|
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
3592
3735
|
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
3593
3736
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
3594
|
-
`];$("cm-page",
|
|
3737
|
+
`];$("cm-page",En);var Tn,zv,_v,Mn=class extends T{constructor(){super(...arguments);p(this,Tn);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?Rn`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:Rn`<circle cx="10" cy="10" r="7.5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M10 6v5M10 13.6v.2" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>`;return c`<div class="banner" part="banner" role=${e}>
|
|
3595
3738
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
3596
3739
|
<div class="body">
|
|
3597
3740
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
3598
3741
|
<div><slot></slot></div>
|
|
3599
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,
|
|
3742
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s(this,Tn,zv)}></slot></div>
|
|
3600
3743
|
</div>
|
|
3601
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,
|
|
3744
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${s(this,Tn,_v)}>
|
|
3602
3745
|
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg></button>`:h}
|
|
3603
|
-
</div>`}};
|
|
3746
|
+
</div>`}};Tn=new WeakSet,zv=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},_v=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},Mn.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},Mn.styles=[k,x`
|
|
3604
3747
|
:host { display: block; }
|
|
3605
3748
|
.banner {
|
|
3606
3749
|
display: flex; gap: var(--cm-space-12); align-items: flex-start;
|
|
@@ -3624,10 +3767,10 @@ ${t.label}</button>
|
|
|
3624
3767
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
3625
3768
|
}
|
|
3626
3769
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3627
|
-
`];$("cm-banner",
|
|
3770
|
+
`];$("cm-banner",Mn);var X2=z("thumbnail",{noImage:"{alt} (no image)"}),zn=class extends T{constructor(){super(...arguments);this.src="";this.alt="";this.size="medium";this.loading="eager";this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){if(this.src&&!this._failed)return c`<span class="box" part="thumbnail"><img src=${this.src} alt=${this.alt} loading=${this.loading}
|
|
3628
3771
|
@error=${()=>{this._failed=!0}}></span>`;let e=this.size==="small"?18:this.size==="large"?32:24;return c`<span class="box" part="thumbnail" role=${this.alt?"img":h}
|
|
3629
3772
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):h} aria-hidden=${this.alt?h:"true"}>
|
|
3630
|
-
<cm-icon name="box" size=${e}></cm-icon></span>`}};
|
|
3773
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};zn.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},zn.styles=[k,x`
|
|
3631
3774
|
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3632
3775
|
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
3633
3776
|
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
@@ -3637,7 +3780,7 @@ ${t.label}</button>
|
|
|
3637
3780
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
3638
3781
|
}
|
|
3639
3782
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
3640
|
-
`];$("cm-thumbnail",
|
|
3783
|
+
`];$("cm-thumbnail",zn);export{wr as Announcer,Fa as CmAccordion,Pa as CmActionBar,Vr as CmActionMenu,Js as CmAppCard,$n as CmAppFrame,Fs as CmAvatar,pn as CmBadge,Mn as CmBanner,Ms as CmBoard,$r as CmBoardCard,kr as CmBoardColumn,Ws as CmBottomNavigation,tn as CmBottomSheet,Bi as CmButton,Wr as CmButtonGroup,Ds as CmCalendar,Ls as CmCalendarEvent,un as CmCard,ai as CmCheckbox,xi as CmColorField,hi as CmCombobox,pa as CmCommandPalette,Ka as CmComment,Wa as CmCommentBox,ms as CmDataTable,gi as CmDatePicker,fi as CmDateRangePicker,ja as CmEmptyState,yi as CmFileUpload,Qs as CmFilterPanel,Ys as CmFlashOfferBar,tr as CmGlobalSearch,yn as CmGrid,Us as CmHeaderBar,Br as CmIcon,Ba as CmInfoItem,qa as CmInfoPanel,xn as CmLayout,wn as CmLayoutSection,Xs as CmLinkTabs,T as CmLocalizedElement,Fr as CmMenuItem,Os as CmMetric,Gs as CmMobileMenu,Zs as CmModal,qs as CmNavItem,ks as CmNestedItem,$s as CmNestedList,rn as CmNotificationItem,an as CmNotificationPanel,xt as CmOptionGroup,En as CmPage,Ia as CmPageHeader,rs as CmPagination,mn as CmProgressBar,Gi as CmRadio,Yi as CmRadioGroup,zr as CmReportTile,Ps as CmReportTiles,ys as CmResourceItem,xs as CmResourceList,Oa as CmSaveBar,di as CmSearch,Na as CmSegmentedControl,ci as CmSelect,Bs as CmSideNavigation,Mt as CmSidePanel,wi as CmSignatureField,Ua as CmSkeleton,Va as CmSkeletonDisplay,ts as CmSmartTip,is as CmSmartTips,jr as CmSpinner,vn as CmStack,ss as CmStatusTabs,os as CmTableHeader,Zi as CmTag,ri as CmTextField,zn as CmThumbnail,mr as CmTimeline,Qa as CmTimelineItem,on as CmToast,ln as CmToastRegion,ni as CmToggle,Ga as CmTooltip,xr as MoveModel,Sg as commandMatches,Uv as configure,z as defineStrings,ig as directionalIcons,ae as formatDate,eg as formatMessage,am as formatNumber,Fv as getDefaultStrings,av as initials,mo as isApplePlatform,mf as listNavigation,In as localeFor,km as matchesShortcut,jt as normalizeHex,hc as pluralCategory,Vv as resetStrings,qg as resolvePreset,jv as setStrings,rd as shortcutKeys,xv as showToast,mc as translate,Sy as undoable};
|
|
3641
3784
|
/*! Bundled license information:
|
|
3642
3785
|
|
|
3643
3786
|
@lit/reactive-element/css-tag.js:
|