@commmerce/ui 0.0.0-stage → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +17 -0
- package/README.md +41 -2
- package/dist/base.d.ts +7 -0
- package/dist/base.js +22 -0
- package/dist/cdn.js +1958 -0
- package/dist/components/accordion.d.ts +43 -0
- package/dist/components/accordion.js +83 -0
- package/dist/components/action-bar.d.ts +42 -0
- package/dist/components/action-bar.js +84 -0
- package/dist/components/action-menu.d.ts +89 -0
- package/dist/components/action-menu.js +283 -0
- package/dist/components/app-card.d.ts +57 -0
- package/dist/components/app-card.js +100 -0
- package/dist/components/avatar.d.ts +48 -0
- package/dist/components/avatar.js +82 -0
- package/dist/components/badge.d.ts +23 -0
- package/dist/components/badge.js +35 -0
- package/dist/components/banner.d.ts +36 -0
- package/dist/components/banner.js +88 -0
- package/dist/components/bottom-navigation.d.ts +48 -0
- package/dist/components/bottom-navigation.js +98 -0
- package/dist/components/bottom-sheet.d.ts +54 -0
- package/dist/components/bottom-sheet.js +133 -0
- package/dist/components/button.d.ts +53 -0
- package/dist/components/button.js +101 -0
- package/dist/components/card.d.ts +37 -0
- package/dist/components/card.js +58 -0
- package/dist/components/checkbox.d.ts +68 -0
- package/dist/components/checkbox.js +114 -0
- package/dist/components/comment.d.ts +76 -0
- package/dist/components/comment.js +170 -0
- package/dist/components/data-table.d.ts +132 -0
- package/dist/components/data-table.js +331 -0
- package/dist/components/empty-state.d.ts +49 -0
- package/dist/components/empty-state.js +94 -0
- package/dist/components/file-upload.d.ts +102 -0
- package/dist/components/file-upload.js +243 -0
- package/dist/components/filter-panel.d.ts +86 -0
- package/dist/components/filter-panel.js +128 -0
- package/dist/components/flash-offer-bar.d.ts +34 -0
- package/dist/components/flash-offer-bar.js +73 -0
- package/dist/components/grid.d.ts +39 -0
- package/dist/components/grid.js +42 -0
- package/dist/components/header-bar.d.ts +48 -0
- package/dist/components/header-bar.js +121 -0
- package/dist/components/icon.d.ts +30 -0
- package/dist/components/icon.js +36 -0
- package/dist/components/info-panel.d.ts +63 -0
- package/dist/components/info-panel.js +108 -0
- package/dist/components/layout.d.ts +45 -0
- package/dist/components/layout.js +67 -0
- package/dist/components/link-tabs.d.ts +40 -0
- package/dist/components/link-tabs.js +85 -0
- package/dist/components/menu-item.d.ts +68 -0
- package/dist/components/menu-item.js +64 -0
- package/dist/components/mobile-menu.d.ts +69 -0
- package/dist/components/mobile-menu.js +184 -0
- package/dist/components/modal.d.ts +46 -0
- package/dist/components/modal.js +59 -0
- package/dist/components/nav-item.d.ts +98 -0
- package/dist/components/nav-item.js +84 -0
- package/dist/components/nested-list.d.ts +105 -0
- package/dist/components/nested-list.js +279 -0
- package/dist/components/notification-panel.d.ts +121 -0
- package/dist/components/notification-panel.js +174 -0
- package/dist/components/option-group.d.ts +74 -0
- package/dist/components/option-group.js +172 -0
- package/dist/components/page-header.d.ts +58 -0
- package/dist/components/page-header.js +121 -0
- package/dist/components/page.d.ts +34 -0
- package/dist/components/page.js +41 -0
- package/dist/components/pagination.d.ts +64 -0
- package/dist/components/pagination.js +160 -0
- package/dist/components/progress-bar.d.ts +45 -0
- package/dist/components/progress-bar.js +81 -0
- package/dist/components/radio.d.ts +131 -0
- package/dist/components/radio.js +252 -0
- package/dist/components/report-tile.d.ts +65 -0
- package/dist/components/report-tile.js +112 -0
- package/dist/components/resource-list.d.ts +143 -0
- package/dist/components/resource-list.js +335 -0
- package/dist/components/save-bar.d.ts +58 -0
- package/dist/components/save-bar.js +128 -0
- package/dist/components/search.d.ts +78 -0
- package/dist/components/search.js +144 -0
- package/dist/components/select.d.ts +106 -0
- package/dist/components/select.js +338 -0
- package/dist/components/side-navigation.d.ts +51 -0
- package/dist/components/side-navigation.js +194 -0
- package/dist/components/side-panel.d.ts +50 -0
- package/dist/components/side-panel.js +73 -0
- package/dist/components/skeleton-display.d.ts +32 -0
- package/dist/components/skeleton-display.js +70 -0
- package/dist/components/skeleton.d.ts +41 -0
- package/dist/components/skeleton.js +59 -0
- package/dist/components/smart-tip.d.ts +62 -0
- package/dist/components/smart-tip.js +128 -0
- package/dist/components/spinner.d.ts +27 -0
- package/dist/components/spinner.js +48 -0
- package/dist/components/stack.d.ts +45 -0
- package/dist/components/stack.js +49 -0
- package/dist/components/status-tabs.d.ts +65 -0
- package/dist/components/status-tabs.js +158 -0
- package/dist/components/table-header.d.ts +84 -0
- package/dist/components/table-header.js +151 -0
- package/dist/components/tag.d.ts +39 -0
- package/dist/components/tag.js +68 -0
- package/dist/components/text-field.d.ts +101 -0
- package/dist/components/text-field.js +162 -0
- package/dist/components/thumbnail.d.ts +40 -0
- package/dist/components/thumbnail.js +61 -0
- package/dist/components/toast.d.ts +108 -0
- package/dist/components/toast.js +268 -0
- package/dist/components/toggle.d.ts +60 -0
- package/dist/components/toggle.js +108 -0
- package/dist/components/tooltip.d.ts +56 -0
- package/dist/components/tooltip.js +267 -0
- package/dist/custom-elements.json +13222 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +56 -0
- package/dist/overlay.d.ts +57 -0
- package/dist/overlay.js +205 -0
- package/dist/spacing.d.ts +6 -0
- package/dist/spacing.js +7 -0
- package/package.json +59 -4
package/dist/cdn.js
ADDED
|
@@ -0,0 +1,1958 @@
|
|
|
1
|
+
var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(o,i,e)=>(Ds(o,i,"read from private field"),e?e.call(o):i.get(o)),p=(o,i,e)=>i.has(o)?Dr("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(o):i.set(o,e),v=(o,i,e,t)=>(Ds(o,i,"write to private field"),t?t.call(o,e):i.set(o,e),e),c=(o,i,e)=>(Ds(o,i,"access private method"),e);var _a=globalThis,Ta=_a.ShadowRoot&&(_a.ShadyCSS===void 0||_a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Bs=Symbol(),Br=new WeakMap,Ci=class{constructor(i,e,t){if(this._$cssResult$=!0,t!==Bs)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=e}get styleSheet(){let i=this.o,e=this.t;if(Ta&&i===void 0){let t=e!==void 0&&e.length===1;t&&(i=Br.get(e)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),t&&Br.set(e,i))}return i}toString(){return this.cssText}},La=o=>new Ci(typeof o=="string"?o:o+"",void 0,Bs),m=(o,...i)=>{let e=o.length===1?o[0]:i.reduce((t,a,n)=>t+(d=>{if(d._$cssResult$===!0)return d.cssText;if(typeof d=="number")return d;throw Error("Value passed to 'css' function must be a 'css' function result: "+d+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(a)+o[n+1],o[0]);return new Ci(e,o,Bs)},qr=(o,i)=>{if(Ta)o.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of i){let t=document.createElement("style"),a=_a.litNonce;a!==void 0&&t.setAttribute("nonce",a),t.textContent=e.cssText,o.appendChild(t)}},qs=Ta?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let e="";for(let t of i.cssRules)e+=t.cssText;return La(e)})(o):o;var{is:un,defineProperty:bn,getOwnPropertyDescriptor:fn,getOwnPropertyNames:gn,getOwnPropertySymbols:vn,getPrototypeOf:xn}=Object,Aa=globalThis,Or=Aa.trustedTypes,yn=Or?Or.emptyScript:"",$n=Aa.reactiveElementPolyfillSupport,Ni=(o,i)=>o,Os={toAttribute(o,i){switch(i){case Boolean:o=o?yn:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,i){let e=o;switch(i){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}},jr=(o,i)=>!un(o,i),Pr={attribute:!0,type:String,converter:Os,reflect:!1,useDefault:!1,hasChanged:jr};Symbol.metadata??=Symbol("metadata"),Aa.litPropertyMetadata??=new WeakMap;var re=class extends HTMLElement{static addInitializer(i){this._$Ei(),(this.l??=[]).push(i)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(i,e=Pr){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(i)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(i,e),!e.noAccessor){let t=Symbol(),a=this.getPropertyDescriptor(i,t,e);a!==void 0&&bn(this.prototype,i,a)}}static getPropertyDescriptor(i,e,t){let{get:a,set:n}=fn(this.prototype,i)??{get(){return this[e]},set(d){this[e]=d}};return{get:a,set(d){let h=a?.call(this);n?.call(this,d),this.requestUpdate(i,h,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(i){return this.elementProperties.get(i)??Pr}static _$Ei(){if(this.hasOwnProperty(Ni("elementProperties")))return;let i=xn(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties)}static finalize(){if(this.hasOwnProperty(Ni("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ni("properties"))){let e=this.properties,t=[...gn(e),...vn(e)];for(let a of t)this.createProperty(a,e[a])}let i=this[Symbol.metadata];if(i!==null){let e=litPropertyMetadata.get(i);if(e!==void 0)for(let[t,a]of e)this.elementProperties.set(t,a)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let a=this._$Eu(e,t);a!==void 0&&this._$Eh.set(a,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(i){let e=[];if(Array.isArray(i)){let t=new Set(i.flat(1/0).reverse());for(let a of t)e.unshift(qs(a))}else i!==void 0&&e.push(qs(i));return e}static _$Eu(i,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this))}addController(i){(this._$EO??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.()}removeController(i){this._$EO?.delete(i)}_$E_(){let i=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(i.set(t,this[t]),delete this[t]);i.size>0&&(this._$Ep=i)}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return qr(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(i=>i.hostConnected?.())}enableUpdating(i){}disconnectedCallback(){this._$EO?.forEach(i=>i.hostDisconnected?.())}attributeChangedCallback(i,e,t){this._$AK(i,t)}_$ET(i,e){let t=this.constructor.elementProperties.get(i),a=this.constructor._$Eu(i,t);if(a!==void 0&&t.reflect===!0){let n=(t.converter?.toAttribute!==void 0?t.converter:Os).toAttribute(e,t.type);this._$Em=i,n==null?this.removeAttribute(a):this.setAttribute(a,n),this._$Em=null}}_$AK(i,e){let t=this.constructor,a=t._$Eh.get(i);if(a!==void 0&&this._$Em!==a){let n=t.getPropertyOptions(a),d=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Os;this._$Em=a;let h=d.fromAttribute(e,n.type);this[a]=h??this._$Ej?.get(a)??h,this._$Em=null}}requestUpdate(i,e,t,a=!1,n){if(i!==void 0){let d=this.constructor;if(a===!1&&(n=this[i]),t??=d.getPropertyOptions(i),!((t.hasChanged??jr)(n,e)||t.useDefault&&t.reflect&&n===this._$Ej?.get(i)&&!this.hasAttribute(d._$Eu(i,t))))return;this.C(i,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(i,e,{useDefault:t,reflect:a,wrapped:n},d){t&&!(this._$Ej??=new Map).has(i)&&(this._$Ej.set(i,d??e??this[i]),n!==!0||d!==void 0)||(this._$AL.has(i)||(this.hasUpdated||t||(e=void 0),this._$AL.set(i,e)),a===!0&&this._$Em!==i&&(this._$Eq??=new Set).add(i))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[a,n]of this._$Ep)this[a]=n;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[a,n]of t){let{wrapped:d}=n,h=this[a];d!==!0||this._$AL.has(a)||h===void 0||this.C(a,void 0,n,h)}}let i=!1,e=this._$AL;try{i=this.shouldUpdate(e),i?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw i=!1,this._$EM(),t}i&&this._$AE(e)}willUpdate(i){}_$AE(i){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(i)),this.updated(i)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(i){return!0}update(i){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(i){}firstUpdated(i){}};re.elementStyles=[],re.shadowRootOptions={mode:"open"},re[Ni("elementProperties")]=new Map,re[Ni("finalized")]=new Map,$n?.({ReactiveElement:re}),(Aa.reactiveElementVersions??=[]).push("2.1.2");var js=globalThis,Vr=o=>o,Sa=js.trustedTypes,Ur=Sa?Sa.createPolicy("lit-html",{createHTML:o=>o}):void 0,Vs="$lit$",oe=`lit$${Math.random().toFixed(9).slice(2)}$`,Us="?"+oe,wn=`<${Us}>`,He=document,Ii=()=>He.createComment(""),Ri=o=>o===null||typeof o!="object"&&typeof o!="function",Fs=Array.isArray,Zr=o=>Fs(o)||typeof o?.[Symbol.iterator]=="function",Ps=`[
|
|
2
|
+
\f\r]`,Hi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fr=/-->/g,Kr=/>/g,Ce=RegExp(`>|${Ps}(?:([^\\s"'>=/]+)(${Ps}*=${Ps}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Wr=/'/g,Yr=/"/g,Jr=/^(?:script|style|textarea|title)$/i,Ks=o=>(i,...e)=>({_$litType$:o,strings:i,values:e}),r=Ks(1),Bi=Ks(2),Kn=Ks(3),B=Symbol.for("lit-noChange"),l=Symbol.for("lit-nothing"),Xr=new WeakMap,Ne=He.createTreeWalker(He,129);function Qr(o,i){if(!Fs(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ur!==void 0?Ur.createHTML(i):i}var Gr=(o,i)=>{let e=o.length-1,t=[],a,n=i===2?"<svg>":i===3?"<math>":"",d=Hi;for(let h=0;h<e;h++){let g=o[h],x,$,y=-1,C=0;for(;C<g.length&&(d.lastIndex=C,$=d.exec(g),$!==null);)C=d.lastIndex,d===Hi?$[1]==="!--"?d=Fr:$[1]!==void 0?d=Kr:$[2]!==void 0?(Jr.test($[2])&&(a=RegExp("</"+$[2],"g")),d=Ce):$[3]!==void 0&&(d=Ce):d===Ce?$[0]===">"?(d=a??Hi,y=-1):$[1]===void 0?y=-2:(y=d.lastIndex-$[2].length,x=$[1],d=$[3]===void 0?Ce:$[3]==='"'?Yr:Wr):d===Yr||d===Wr?d=Ce:d===Fr||d===Kr?d=Hi:(d=Ce,a=void 0);let O=d===Ce&&o[h+1].startsWith("/>")?" ":"";n+=d===Hi?g+wn:y>=0?(t.push(x),g.slice(0,y)+Vs+g.slice(y)+oe+O):g+oe+(y===-2?h:O)}return[Qr(o,n+(o[e]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),t]},Di=class o{constructor({strings:i,_$litType$:e},t){let a;this.parts=[];let n=0,d=0,h=i.length-1,g=this.parts,[x,$]=Gr(i,e);if(this.el=o.createElement(x,t),Ne.currentNode=this.el.content,e===2||e===3){let y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(a=Ne.nextNode())!==null&&g.length<h;){if(a.nodeType===1){if(a.hasAttributes())for(let y of a.getAttributeNames())if(y.endsWith(Vs)){let C=$[d++],O=a.getAttribute(y).split(oe),L=/([.?@])?(.*)/.exec(C);g.push({type:1,index:n,name:L[2],strings:O,ctor:L[1]==="."?Na:L[1]==="?"?Ha:L[1]==="@"?Ia:Re}),a.removeAttribute(y)}else y.startsWith(oe)&&(g.push({type:6,index:n}),a.removeAttribute(y));if(Jr.test(a.tagName)){let y=a.textContent.split(oe),C=y.length-1;if(C>0){a.textContent=Sa?Sa.emptyScript:"";for(let O=0;O<C;O++)a.append(y[O],Ii()),Ne.nextNode(),g.push({type:2,index:++n});a.append(y[C],Ii())}}}else if(a.nodeType===8)if(a.data===Us)g.push({type:2,index:n});else{let y=-1;for(;(y=a.data.indexOf(oe,y+1))!==-1;)g.push({type:7,index:n}),y+=oe.length-1}n++}}static createElement(i,e){let t=He.createElement("template");return t.innerHTML=i,t}};function Ie(o,i,e=o,t){if(i===B)return i;let a=t!==void 0?e._$Co?.[t]:e._$Cl,n=Ri(i)?void 0:i._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),n===void 0?a=void 0:(a=new n(o),a._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=a:e._$Cl=a),a!==void 0&&(i=Ie(o,a._$AS(o,i.values),a,t)),i}var Ca=class{constructor(i,e){this._$AV=[],this._$AN=void 0,this._$AD=i,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(i){let{el:{content:e},parts:t}=this._$AD,a=(i?.creationScope??He).importNode(e,!0);Ne.currentNode=a;let n=Ne.nextNode(),d=0,h=0,g=t[0];for(;g!==void 0;){if(d===g.index){let x;g.type===2?x=new tt(n,n.nextSibling,this,i):g.type===1?x=new g.ctor(n,g.name,g.strings,this,i):g.type===6&&(x=new Ra(n,this,i)),this._$AV.push(x),g=t[++h]}d!==g?.index&&(n=Ne.nextNode(),d++)}return Ne.currentNode=He,a}p(i){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(i,t,e),e+=t.strings.length-2):t._$AI(i[e])),e++}},tt=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(i,e,t,a){this.type=2,this._$AH=l,this._$AN=void 0,this._$AA=i,this._$AB=e,this._$AM=t,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let i=this._$AA.parentNode,e=this._$AM;return e!==void 0&&i?.nodeType===11&&(i=e.parentNode),i}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(i,e=this){i=Ie(this,i,e),Ri(i)?i===l||i==null||i===""?(this._$AH!==l&&this._$AR(),this._$AH=l):i!==this._$AH&&i!==B&&this._(i):i._$litType$!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Zr(i)?this.k(i):this._(i)}O(i){return this._$AA.parentNode.insertBefore(i,this._$AB)}T(i){this._$AH!==i&&(this._$AR(),this._$AH=this.O(i))}_(i){this._$AH!==l&&Ri(this._$AH)?this._$AA.nextSibling.data=i:this.T(He.createTextNode(i)),this._$AH=i}$(i){let{values:e,_$litType$:t}=i,a=typeof t=="number"?this._$AC(i):(t.el===void 0&&(t.el=Di.createElement(Qr(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===a)this._$AH.p(e);else{let n=new Ca(a,this),d=n.u(this.options);n.p(e),this.T(d),this._$AH=n}}_$AC(i){let e=Xr.get(i.strings);return e===void 0&&Xr.set(i.strings,e=new Di(i)),e}k(i){Fs(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,a=0;for(let n of i)a===e.length?e.push(t=new o(this.O(Ii()),this.O(Ii()),this,this.options)):t=e[a],t._$AI(n),a++;a<e.length&&(this._$AR(t&&t._$AB.nextSibling,a),e.length=a)}_$AR(i=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);i!==this._$AB;){let t=Vr(i).nextSibling;Vr(i).remove(),i=t}}setConnected(i){this._$AM===void 0&&(this._$Cv=i,this._$AP?.(i))}},Re=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(i,e,t,a,n){this.type=1,this._$AH=l,this._$AN=void 0,this.element=i,this.name=e,this._$AM=a,this.options=n,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=l}_$AI(i,e=this,t,a){let n=this.strings,d=!1;if(n===void 0)i=Ie(this,i,e,0),d=!Ri(i)||i!==this._$AH&&i!==B,d&&(this._$AH=i);else{let h=i,g,x;for(i=n[0],g=0;g<n.length-1;g++)x=Ie(this,h[t+g],e,g),x===B&&(x=this._$AH[g]),d||=!Ri(x)||x!==this._$AH[g],x===l?i=l:i!==l&&(i+=(x??"")+n[g+1]),this._$AH[g]=x}d&&!a&&this.j(i)}j(i){i===l?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"")}},Na=class extends Re{constructor(){super(...arguments),this.type=3}j(i){this.element[this.name]=i===l?void 0:i}},Ha=class extends Re{constructor(){super(...arguments),this.type=4}j(i){this.element.toggleAttribute(this.name,!!i&&i!==l)}},Ia=class extends Re{constructor(i,e,t,a,n){super(i,e,t,a,n),this.type=5}_$AI(i,e=this){if((i=Ie(this,i,e,0)??l)===B)return;let t=this._$AH,a=i===l&&t!==l||i.capture!==t.capture||i.once!==t.once||i.passive!==t.passive,n=i!==l&&(t===l||a);a&&this.element.removeEventListener(this.name,this,t),n&&this.element.addEventListener(this.name,this,i),this._$AH=i}handleEvent(i){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,i):this._$AH.handleEvent(i)}},Ra=class{constructor(i,e,t){this.element=i,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(i){Ie(this,i)}},eo={M:Vs,P:oe,A:Us,C:1,L:Gr,R:Ca,D:Zr,V:Ie,I:tt,H:Re,N:Ha,U:Ia,B:Na,F:Ra},kn=js.litHtmlPolyfillSupport;kn?.(Di,tt),(js.litHtmlVersions??=[]).push("3.3.3");var to=(o,i,e)=>{let t=e?.renderBefore??i,a=t._$litPart$;if(a===void 0){let n=e?.renderBefore??null;t._$litPart$=a=new tt(i.insertBefore(Ii(),n),n,void 0,e??{})}return a._$AI(o),a};var Ws=globalThis,u=class extends re{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this._$Do=to(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}};u._$litElement$=!0,u.finalized=!0,Ws.litElementHydrateSupport?.({LitElement:u});var En=Ws.litElementPolyfillSupport;En?.({LitElement:u});(Ws.litElementVersions??=[]).push("4.2.2");var f=m`
|
|
4
|
+
:host {
|
|
5
|
+
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
|
+
color: var(--cm-text-default, #000);
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
:host([hidden]) { display: none !important; }
|
|
10
|
+
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
+
`,ol=m`
|
|
12
|
+
outline: 2px solid var(--cm-border-strong);
|
|
13
|
+
outline-offset: 2px;
|
|
14
|
+
`,Mn=0,w=o=>`${o}-${++Mn}`;function b(o,i){customElements.get(o)||customElements.define(o,i)}var Da,Ba,De=class extends u{constructor(){super();this.variant="secondary";this.size="medium";this.type="button";this.disabled=!1;this.loading=!1;p(this,Da,this.attachInternals());p(this,Ba,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=s(this,Da).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});this.addEventListener("click",s(this,Ba),{capture:!0})}render(){let e=r`${this.loading?r`<span class="spinner" aria-hidden="true"></span>`:r`<slot name="icon"></slot>`}<slot></slot>`;return this.href&&!this.disabled?r`<a class="btn" part="control" href=${this.href} target=${this.target??l}
|
|
15
|
+
rel=${this.target==="_blank"?"noopener noreferrer":l}>${e}</a>`:r`<button class="btn" part="control" type="button"
|
|
16
|
+
?disabled=${this.disabled} aria-disabled=${this.loading?"true":l}
|
|
17
|
+
aria-busy=${this.loading?"true":l}>${e}</button>`}};Da=new WeakMap,Ba=new WeakMap,De.formAssociated=!0,De.properties={variant:{reflect:!0},size:{reflect:!0},type:{},disabled:{type:Boolean,reflect:!0},loading:{type:Boolean,reflect:!0},href:{},target:{}},De.styles=[f,m`
|
|
18
|
+
:host { display: inline-flex; vertical-align: middle; }
|
|
19
|
+
.btn {
|
|
20
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 6px;
|
|
21
|
+
width: 100%; font: inherit; font-weight: 500; line-height: 1; white-space: nowrap;
|
|
22
|
+
border-radius: var(--cm-radius-sm); border: var(--cm-border-1) solid transparent;
|
|
23
|
+
cursor: pointer; text-decoration: none;
|
|
24
|
+
}
|
|
25
|
+
:host([size='large']) .btn { height: 46px; padding: 0 var(--cm-space-20); font-size: 16px; }
|
|
26
|
+
.btn, :host([size='medium']) .btn { height: 32px; padding: 0 var(--cm-space-15); font-size: 12px; }
|
|
27
|
+
:host([size='slim']) .btn { height: 24px; padding: 0 var(--cm-space-10); font-size: 10px; }
|
|
28
|
+
:host([variant='primary']) .btn { background: var(--cm-action-primary); color: var(--cm-action-primary-text); border-color: var(--cm-action-primary); }
|
|
29
|
+
:host([variant='primary']) .btn:hover { background: var(--cm-action-primary-hover); border-color: var(--cm-action-primary-hover); }
|
|
30
|
+
.btn, :host([variant='secondary']) .btn {
|
|
31
|
+
background: var(--cm-bg-hover); color: var(--cm-text-default); border-color: var(--cm-border-strong);
|
|
32
|
+
}
|
|
33
|
+
:host([variant='secondary']) .btn:hover { background: var(--cm-bg-surface); }
|
|
34
|
+
:host([disabled]) .btn, :host([loading]) .btn {
|
|
35
|
+
background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed;
|
|
36
|
+
}
|
|
37
|
+
.btn:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
38
|
+
.spinner {
|
|
39
|
+
width: 1em; height: 1em; border-radius: 50%;
|
|
40
|
+
border: 2px solid currentColor; border-right-color: transparent;
|
|
41
|
+
animation: spin .7s linear infinite;
|
|
42
|
+
}
|
|
43
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
44
|
+
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
|
|
45
|
+
::slotted([slot='icon']) { display: inline-flex; }
|
|
46
|
+
`];b("cm-button",De);var ne={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},qa=o=>(...i)=>({_$litDirective$:o,values:i}),it=class{constructor(i){}get _$AU(){return this._$AM._$AU}_$AT(i,e,t){this._$Ct=i,this._$AM=e,this._$Ci=t}_$AS(i,e){return this.update(i,e)}update(i,e){return this.render(...e)}};var{I:ul}=eo;var io=o=>o.strings===void 0;var zn={},ao=(o,i=zn)=>o._$AH=i;var qi=qa(class extends it{constructor(o){if(super(o),o.type!==ne.PROPERTY&&o.type!==ne.ATTRIBUTE&&o.type!==ne.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!io(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[i]){if(i===B||i===l)return i;let e=o.element,t=o.name;if(o.type===ne.PROPERTY){if(i===e[t])return B}else if(o.type===ne.BOOLEAN_ATTRIBUTE){if(!!i===e.hasAttribute(t))return B}else if(o.type===ne.ATTRIBUTE&&e.getAttribute(t)===i+"")return B;return ao(o),i}});var U,le,Oi,ye,Ys,Xs,xe=class extends u{constructor(){super(...arguments);p(this,ye);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,U,this.attachInternals());p(this,le,w("cm-tf"));p(this,Oi,"")}connectedCallback(){super.connectedCallback(),v(this,Oi,this.value)}get form(){return s(this,U).form}get validity(){return s(this,U).validity}get validationMessage(){return s(this,U).validationMessage}checkValidity(){return s(this,U).checkValidity()}reportValidity(){return s(this,U).reportValidity()}formResetCallback(){this.value=s(this,Oi),this.error=""}formDisabledCallback(e){this.disabled=e}updated(){s(this,U).setFormValue(this.value);let e=this.renderRoot.querySelector(".input");this.error?s(this,U).setValidity({customError:!0},this.error,e??void 0):this.required&&!this.value?s(this,U).setValidity({valueMissing:!0},"Please fill in this field.",e??void 0):s(this,U).setValidity({})}render(){let e=[this.error&&`${s(this,le)}-err`,this.helpText&&`${s(this,le)}-help`].filter(Boolean).join(" ")||l,t={id:s(this,le),invalid:this.error?"true":l},a=this.multiline?r`<textarea class="input" part="input" id=${t.id} rows=${this.rows}
|
|
47
|
+
.value=${qi(this.value)} placeholder=${this.placeholder||l}
|
|
48
|
+
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
49
|
+
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
50
|
+
@input=${c(this,ye,Ys)} @change=${c(this,ye,Xs)}></textarea>`:r`<input class="input" part="input" id=${t.id} type=${this.type}
|
|
51
|
+
.value=${qi(this.value)} placeholder=${this.placeholder||l}
|
|
52
|
+
autocomplete=${this.autocomplete??l}
|
|
53
|
+
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
54
|
+
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
55
|
+
@input=${c(this,ye,Ys)} @change=${c(this,ye,Xs)} />`;return r`<div class="field">
|
|
56
|
+
${this.label?r`<label for=${s(this,le)} part="label">${this.label}${this.required?r`<span class="req" aria-hidden="true">*</span>`:l}${this.hint?r`<span class="hint">[${this.hint}]</span>`:l}</label>`:l}
|
|
57
|
+
${a}
|
|
58
|
+
${this.error?r`<p class="error" id="${s(this,le)}-err" role="alert">${this.error}</p>`:l}
|
|
59
|
+
${this.helpText?r`<p class="help" id="${s(this,le)}-help">${this.helpText}</p>`:l}
|
|
60
|
+
</div>`}};U=new WeakMap,le=new WeakMap,Oi=new WeakMap,ye=new WeakSet,Ys=function(e){this.value=e.target.value},Xs=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},xe.formAssociated=!0,xe.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0},xe.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}},xe.styles=[f,m`
|
|
61
|
+
:host { display: block; }
|
|
62
|
+
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
63
|
+
label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
64
|
+
.req { color: var(--cm-text-critical); margin-left: 2px; }
|
|
65
|
+
.hint { margin-left: var(--cm-space-10); font-size: 12px; color: var(--cm-text-tertiary); text-transform: lowercase; }
|
|
66
|
+
.input {
|
|
67
|
+
width: 100%; height: 42px; padding: 0 var(--cm-space-10);
|
|
68
|
+
font: inherit; font-size: 16px; color: var(--cm-text-default);
|
|
69
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
70
|
+
border-radius: var(--cm-radius-sm); outline: none;
|
|
71
|
+
}
|
|
72
|
+
textarea.input { height: auto; padding: var(--cm-space-10); resize: vertical; }
|
|
73
|
+
.input::placeholder { color: var(--cm-text-tertiary); }
|
|
74
|
+
.input:focus { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
75
|
+
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
76
|
+
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-default); cursor: not-allowed; }
|
|
77
|
+
:host([error]:not([error=''])) .input { border-color: var(--cm-border-critical); }
|
|
78
|
+
.help { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
79
|
+
.error { margin: 0; font-size: 12px; color: var(--cm-text-critical); }
|
|
80
|
+
:host([size='small']) .field { gap: 6px; }
|
|
81
|
+
:host([size='small']) label { font-size: 12px; }
|
|
82
|
+
:host([size='small']) .input { font-size: 14px; }
|
|
83
|
+
`];b("cm-text-field",xe);var we,Be,Pi,Oa,so,$e=class extends u{constructor(){super(...arguments);p(this,Oa);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;p(this,we,this.attachInternals());p(this,Be,w("cm-cb"));p(this,Pi,!1)}connectedCallback(){super.connectedCallback(),v(this,Pi,this.checked)}get form(){return s(this,we).form}checkValidity(){return s(this,we).checkValidity()}formResetCallback(){this.checked=s(this,Pi)}formDisabledCallback(e){this.disabled=e}updated(){s(this,we).setFormValue(this.checked?this.value:null),this.required&&!this.checked?s(this,we).setValidity({valueMissing:!0},"Please tick this box."):s(this,we).setValidity({})}render(){let e=this.indeterminate?r`<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>`:r`<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 r`<label for=${s(this,Be)}>
|
|
84
|
+
<input type="checkbox" id=${s(this,Be)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
85
|
+
?disabled=${this.disabled} ?required=${this.required}
|
|
86
|
+
aria-describedby=${this.description?`${s(this,Be)}-d`:l} @change=${c(this,Oa,so)} />
|
|
87
|
+
<span class="box" part="box">${e}</span>
|
|
88
|
+
${this.label||this.description?r`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?r`<span class="desc" id="${s(this,Be)}-d">${this.description}</span>`:l}</span>`:r`<slot></slot>`}
|
|
89
|
+
</label>`}};we=new WeakMap,Be=new WeakMap,Pi=new WeakMap,Oa=new WeakSet,so=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},$e.formAssociated=!0,$e.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0},$e.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},$e.styles=[f,m`
|
|
90
|
+
:host { display: inline-flex; }
|
|
91
|
+
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; }
|
|
92
|
+
input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; cursor: inherit; }
|
|
93
|
+
.box {
|
|
94
|
+
flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
|
|
95
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-xs);
|
|
96
|
+
background: var(--cm-bg-surface); color: transparent;
|
|
97
|
+
}
|
|
98
|
+
input:checked + .box, input:indeterminate + .box { color: var(--cm-text-default); }
|
|
99
|
+
input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
100
|
+
.text { display: flex; flex-direction: column; gap: 6px; padding-top: 1px; }
|
|
101
|
+
.label { font-size: 16px; }
|
|
102
|
+
.desc { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
103
|
+
:host([disabled]) label { cursor: not-allowed; }
|
|
104
|
+
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
105
|
+
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
106
|
+
`];b("cm-checkbox",$e);var ji,Oe=class extends u{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;p(this,ji,w("cm-radio"))}render(){let e=this.description?`${s(this,ji)}-d`:null;return r`<div class="radio" part="radio" role="radio" id=${s(this,ji)}
|
|
107
|
+
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":l}
|
|
108
|
+
aria-describedby=${e??l} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
109
|
+
<span class="dot" part="dot"></span>
|
|
110
|
+
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?r`<span class="desc" id=${e}>${this.description}</span>`:l}</span>
|
|
111
|
+
</div>`}};ji=new WeakMap,Oe.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0},Oe.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}},Oe.styles=[f,m`
|
|
112
|
+
:host { display: inline-flex; }
|
|
113
|
+
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; outline: none; }
|
|
114
|
+
.dot {
|
|
115
|
+
position: relative; flex: none; width: 20px; height: 20px; border-radius: var(--cm-radius-full);
|
|
116
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); background: var(--cm-bg-surface);
|
|
117
|
+
}
|
|
118
|
+
:host([checked]) .dot { background: var(--cm-border-strong); }
|
|
119
|
+
:host([checked]) .dot::after {
|
|
120
|
+
content: ''; position: absolute; inset: 0; margin: auto; width: 8px; height: 8px;
|
|
121
|
+
border-radius: var(--cm-radius-full); background: var(--cm-bg-surface);
|
|
122
|
+
}
|
|
123
|
+
.radio:focus-visible .dot { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
124
|
+
.text { display: flex; flex-direction: column; gap: 6px; padding-top: 1px; }
|
|
125
|
+
.label { font-size: 16px; }
|
|
126
|
+
.desc { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
127
|
+
:host([disabled]) .radio, :host([group-disabled]) .radio { cursor: not-allowed; }
|
|
128
|
+
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
129
|
+
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-default); }
|
|
130
|
+
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
131
|
+
`];b("cm-radio",Oe);var F,ce,Vi,Ui,Fi,at,z,Zs,ja,qe,Js,st,Qs,Va,Ua,Pa,Pe=class extends u{constructor(){super();p(this,z);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;p(this,F,this.attachInternals());p(this,ce,w("cm-rg"));p(this,Vi,"");p(this,Ui,!0);p(this,Fi,!1);p(this,at,!1);p(this,ja,()=>{c(this,z,Zs).call(this),s(this,st).call(this)});p(this,st,()=>{let e=c(this,z,qe).call(this),t=!1;for(let n of e)n.checked=!!this.value&&n.value===this.value&&!t,n.checked&&(t=!0),n.groupDisabled=this.disabled;let a=e.find(n=>n.checked&&!n.disabled)??c(this,z,Js).call(this)[0];for(let n of e)n._tabbable=n===a&&!this.disabled});p(this,Va,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||c(this,z,Qs).call(this,t,!0)});p(this,Ua,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let a=c(this,z,Js).call(this),n=a.indexOf(t),d;if(e.key==="ArrowDown"||e.key==="ArrowRight")d=a[(n+1)%a.length];else if(e.key==="ArrowUp"||e.key==="ArrowLeft")d=a[(n-1+a.length)%a.length];else if(e.key===" ")d=t.disabled?void 0:t;else return;e.preventDefault(),d&&c(this,z,Qs).call(this,d,!0)});this.addEventListener("keydown",s(this,Ua)),this.addEventListener("click",s(this,Va))}connectedCallback(){super.connectedCallback(),c(this,z,Zs).call(this)}get form(){return s(this,F).form}get validity(){return s(this,F).validity}get validationMessage(){return s(this,F).validationMessage}checkValidity(){return s(this,F).checkValidity()}reportValidity(){return s(this,F).reportValidity()}formResetCallback(){this.value=s(this,Vi)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(c(this,z,qe).call(this).find(t=>t._tabbable)??c(this,z,qe).call(this)[0])?.focus(e)}updated(e){e.has("value")&&s(this,Fi)&&!s(this,at)&&v(this,Ui,!1),v(this,Fi,!0),s(this,st).call(this),s(this,F).setFormValue(this.value||null,this.value);let t=c(this,z,qe).call(this)[0];this.error?s(this,F).setValidity({customError:!0},this.error,t):this.required&&!this.value?s(this,F).setValidity({valueMissing:!0},"Please select one of these options.",t):s(this,F).setValidity({})}render(){let e=[this.error&&`${s(this,ce)}-err`,this.helpText&&`${s(this,ce)}-help`].filter(Boolean).join(" ");return r`<div class="group" role="radiogroup" part="group"
|
|
132
|
+
aria-labelledby=${c(this,z,Pa).call(this)?`${s(this,ce)}-l`:l} aria-label=${c(this,z,Pa).call(this)?l:this.getAttribute("aria-label")??l}
|
|
133
|
+
aria-describedby=${e||l}
|
|
134
|
+
aria-required=${this.required?"true":l} aria-invalid=${this.error?"true":l}
|
|
135
|
+
aria-disabled=${this.disabled?"true":l}>
|
|
136
|
+
<span class="label" id="${s(this,ce)}-l" part="label" ?hidden=${!c(this,z,Pa).call(this)}>${this.label}<slot name="label"></slot>${this.required?r`<span class="req" aria-hidden="true">*</span>`:l}</span>
|
|
137
|
+
${this.helpText?r`<p class="help" id="${s(this,ce)}-help">${this.helpText}</p>`:l}
|
|
138
|
+
${this.error?r`<p class="error" id="${s(this,ce)}-err" role="alert">${this.error}</p>`:l}
|
|
139
|
+
<div class="options" part="options"><slot @slotchange=${s(this,ja)}></slot></div>
|
|
140
|
+
</div>`}};F=new WeakMap,ce=new WeakMap,Vi=new WeakMap,Ui=new WeakMap,Fi=new WeakMap,at=new WeakMap,z=new WeakSet,Zs=function(){s(this,Ui)&&(this.value||(v(this,at,!0),this.value=c(this,z,qe).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>v(this,at,!1))),v(this,Vi,this.value))},ja=new WeakMap,qe=function(){return[...this.querySelectorAll("cm-radio")]},Js=function(){return c(this,z,qe).call(this).filter(e=>!e.disabled&&!this.disabled)},st=new WeakMap,Qs=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,s(this,st).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Va=new WeakMap,Ua=new WeakMap,Pa=function(){return!!this.label||!!this.querySelector("[slot=label]")},Pe.formAssociated=!0,Pe.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}},Pe.styles=[f,m`
|
|
141
|
+
:host { display: block; }
|
|
142
|
+
.group { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
143
|
+
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
144
|
+
.req { color: var(--cm-text-critical); margin-left: 2px; }
|
|
145
|
+
.help, .error { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
146
|
+
.error { color: var(--cm-text-critical); }
|
|
147
|
+
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-20); padding-top: var(--cm-space-10); }
|
|
148
|
+
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-30); }
|
|
149
|
+
`];b("cm-radio-group",Pe);var rt,je,Ki,Fa,ro,ke=class extends u{constructor(){super(...arguments);p(this,Fa);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;p(this,rt,this.attachInternals());p(this,je,w("cm-tg"));p(this,Ki,!1)}connectedCallback(){super.connectedCallback(),v(this,Ki,this.checked)}get form(){return s(this,rt).form}checkValidity(){return s(this,rt).checkValidity()}formResetCallback(){this.checked=s(this,Ki)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){s(this,rt).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return r`<label for=${s(this,je)}>
|
|
150
|
+
<input type="checkbox" role="switch" id=${s(this,je)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
151
|
+
aria-label=${e?l:this.getAttribute("aria-label")??l}
|
|
152
|
+
aria-describedby=${this.description?`${s(this,je)}-d`:l} @change=${c(this,Fa,ro)} />
|
|
153
|
+
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
154
|
+
${e?r`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?r`<span class="desc" id="${s(this,je)}-d">${this.description}</span>`:l}</span>`:l}
|
|
155
|
+
</label>`}};rt=new WeakMap,je=new WeakMap,Ki=new WeakMap,Fa=new WeakSet,ro=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},ke.formAssociated=!0,ke.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0},ke.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},ke.styles=[f,m`
|
|
156
|
+
:host { display: inline-flex; }
|
|
157
|
+
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; }
|
|
158
|
+
input { position: absolute; opacity: 0; width: 38px; height: 20px; margin: 0; cursor: inherit; }
|
|
159
|
+
.track {
|
|
160
|
+
flex: none; display: inline-flex; align-items: center; width: 38px; height: 20px; padding: 2px;
|
|
161
|
+
border-radius: var(--cm-radius-full); background: var(--cm-toggle-off);
|
|
162
|
+
border: var(--cm-border-1) solid var(--cm-border-input); transition: background-color .15s;
|
|
163
|
+
}
|
|
164
|
+
.thumb {
|
|
165
|
+
width: 14px; height: 14px; border-radius: var(--cm-radius-full); background: var(--cm-bg-surface);
|
|
166
|
+
border: var(--cm-border-1) solid var(--cm-border-input); transition: transform .15s;
|
|
167
|
+
}
|
|
168
|
+
input:checked + .track { background: var(--cm-toggle-on); }
|
|
169
|
+
input:checked + .track .thumb { transform: translateX(18px); }
|
|
170
|
+
input:focus-visible + .track { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
171
|
+
.text { display: flex; flex-direction: column; gap: 4px; padding-top: 1px; }
|
|
172
|
+
.label { font-size: 14px; }
|
|
173
|
+
.desc { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
174
|
+
:host([disabled]) label { cursor: not-allowed; }
|
|
175
|
+
:host([disabled]) .track { opacity: .5; }
|
|
176
|
+
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
177
|
+
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
178
|
+
`];b("cm-toggle",ke);var Ka={"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"},oo=["more","drag"],Ol=Object.keys(Ka);var ot=class extends u{constructor(){super(...arguments);this.name="more";this.size=18;this.label=""}render(){let e=Ka[this.name]??Ka.more,t=oo.includes(this.name)?3:1.6;return Bi`<svg width=${this.size} height=${this.size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
179
|
+
stroke-width=${t} stroke-linecap="round" stroke-linejoin="round"
|
|
180
|
+
role=${this.label?"img":l} aria-label=${this.label||l} aria-hidden=${this.label?l:"true"}
|
|
181
|
+
part="svg"><path d=${e}></path></svg>`}};ot.properties={name:{reflect:!0},size:{type:Number},label:{}},ot.styles=m`
|
|
182
|
+
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
183
|
+
svg { display: block; }
|
|
184
|
+
`;b("cm-icon",ot);var K,N,lt,Z,ct,Yi,k,Gs,er,Wi,nt,Ve,Ee,Wa,Ya,Xi,Xa,Za,Me=class extends u{constructor(){super(...arguments);p(this,k);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this._active=-1;this._slotted=[];p(this,K,this.attachInternals());p(this,N,w("cm-sel"));p(this,lt,"");p(this,Z,"");p(this,ct,0);p(this,Yi,new MutationObserver(()=>c(this,k,Gs).call(this)));p(this,Ya,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),c(this,k,Wi).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),c(this,k,Wi).call(this),c(this,k,Ee).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let a=c(this,k,Wa).call(this,t);c(this,k,Wi).call(this,a>=0?a:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?c(this,k,Ve).call(this,this._active):c(this,k,Ee).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?c(this,k,Ve).call(this,this._active):c(this,k,Ee).call(this,-1);break;case"Home":e.preventDefault(),c(this,k,Ee).call(this,"first");break;case"End":e.preventDefault(),c(this,k,Ee).call(this,"last");break;case"PageDown":e.preventDefault(),c(this,k,Ee).call(this,10);break;case"PageUp":e.preventDefault(),c(this,k,Ee).call(this,-10);break;case"Enter":e.preventDefault(),c(this,k,Ve).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),c(this,k,nt).call(this);break;case"Tab":c(this,k,Ve).call(this,this._active);break;case" ":if(e.preventDefault(),s(this,Z)&&Date.now()-s(this,ct)<500){let a=c(this,k,Wa).call(this," ");a>=0&&(this._active=a)}else c(this,k,Ve).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let a=c(this,k,Wa).call(this,t);a>=0&&(this._active=a)}}});p(this,Xi,e=>{this.open&&!e.composedPath().includes(this)&&c(this,k,nt).call(this)});p(this,Xa,()=>{this.disabled||(this.open?c(this,k,nt).call(this):c(this,k,Wi).call(this))});p(this,Za,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),c(this,k,Gs).call(this),s(this,Yi).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",s(this,Xi),!0)}disconnectedCallback(){super.disconnectedCallback(),s(this,Yi).disconnect(),document.removeEventListener("pointerdown",s(this,Xi),!0)}get form(){return s(this,K).form}get validity(){return s(this,K).validity}get validationMessage(){return s(this,K).validationMessage}checkValidity(){return s(this,K).checkValidity()}reportValidity(){return s(this,K).reportValidity()}formResetCallback(){this.value=s(this,lt),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){s(this,lt)||v(this,lt,this.value)}updated(e){s(this,K).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?s(this,K).setValidity({customError:!0},this.error,t):this.required&&!this.value?s(this,K).setValidity({valueMissing:!0},"Please select an item in the list.",t):s(this,K).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${s(this,N)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(d=>d.value===this.value),a=[this.error&&`${s(this,N)}-err`,this.helpText&&`${s(this,N)}-help`].filter(Boolean).join(" "),n=this.getAttribute("aria-label");return r`<div class="field">
|
|
185
|
+
${this.label?r`<span class="label" id="${s(this,N)}-l" part="label" @click=${s(this,Za)}>${this.label}${this.required?r`<span class="req" aria-hidden="true">*</span>`:l}</span>`:l}
|
|
186
|
+
<div class="wrap">
|
|
187
|
+
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
188
|
+
aria-labelledby=${this.label?`${s(this,N)}-l`:l}
|
|
189
|
+
aria-label=${!this.label&&n?n:l}
|
|
190
|
+
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${s(this,N)}-list"
|
|
191
|
+
aria-activedescendant=${this.open&&this._active>=0?`${s(this,N)}-o${this._active}`:l}
|
|
192
|
+
aria-required=${this.required?"true":l} aria-invalid=${this.error?"true":l}
|
|
193
|
+
aria-disabled=${this.disabled?"true":l} aria-describedby=${a||l}
|
|
194
|
+
@click=${s(this,Xa)} @keydown=${s(this,Ya)} @blur=${()=>c(this,k,nt).call(this)}>
|
|
195
|
+
<span class="text ${t?"":"placeholder"}" id="${s(this,N)}-v">${t?t.label:this.placeholder}</span>
|
|
196
|
+
<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>
|
|
197
|
+
</div>
|
|
198
|
+
<ul role="listbox" id="${s(this,N)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${s(this,N)}-l`:l}
|
|
199
|
+
aria-label=${!this.label&&n?n:l} ?hidden=${!this.open}
|
|
200
|
+
@pointerdown=${d=>d.preventDefault()}>
|
|
201
|
+
${e.map((d,h)=>r`<li role="option" id="${s(this,N)}-o${h}" class=${h===this._active?"active":""}
|
|
202
|
+
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":l}
|
|
203
|
+
@pointerenter=${()=>!d.disabled&&(this._active=h)} @click=${()=>c(this,k,Ve).call(this,h)}>${d.label}</li>`)}
|
|
204
|
+
</ul>
|
|
205
|
+
</div>
|
|
206
|
+
${this.error?r`<p class="error" id="${s(this,N)}-err" role="alert">${this.error}</p>`:l}
|
|
207
|
+
${this.helpText?r`<p class="help" id="${s(this,N)}-help">${this.helpText}</p>`:l}
|
|
208
|
+
<slot></slot>
|
|
209
|
+
</div>`}};K=new WeakMap,N=new WeakMap,lt=new WeakMap,Z=new WeakMap,ct=new WeakMap,Yi=new WeakMap,k=new WeakSet,Gs=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>({value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled})),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",v(this,lt,this.value))},er=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},Wi=function(e){if(this.disabled)return;let t=this.items.findIndex(a=>a.value===this.value);this.open=!0,this._active=e??(t>=0?t:c(this,k,er).call(this)[0]??-1)},nt=function(){this.open=!1},Ve=function(e){let t=this.items[e];!t||t.disabled||(c(this,k,nt).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}))))},Ee=function(e){let t=c(this,k,er).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 a=t.indexOf(this._active);this._active=a<0?t[0]:t[Math.min(t.length-1,Math.max(0,a+e))]},Wa=function(e){let t=Date.now();v(this,Z,t-s(this,ct)>500?e:s(this,Z)+e),v(this,ct,t);let a=this.items,n=this._active<0?0:this._active,d=s(this,Z).split("").every(x=>x===s(this,Z)[0]),h=d?s(this,Z)[0]:s(this,Z),g=d||s(this,Z).length===1?n+1:n;for(let x=0;x<a.length;x++){let $=(g+x)%a.length;if(!a[$].disabled&&a[$].label.toLowerCase().startsWith(h.toLowerCase()))return $}return-1},Ya=new WeakMap,Xi=new WeakMap,Xa=new WeakMap,Za=new WeakMap,Me.formAssociated=!0,Me.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0},Me.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},_active:{state:!0},_slotted:{state:!0}},Me.styles=[f,m`
|
|
210
|
+
:host { display: block; position: relative; }
|
|
211
|
+
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
212
|
+
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); cursor: default; }
|
|
213
|
+
.req { color: var(--cm-text-critical); margin-left: 2px; }
|
|
214
|
+
.wrap { position: relative; }
|
|
215
|
+
.box {
|
|
216
|
+
display: flex; align-items: center; gap: var(--cm-space-10); width: 100%; height: 42px; padding: 0 var(--cm-space-10);
|
|
217
|
+
font-size: 16px; color: var(--cm-text-default); background: var(--cm-bg-surface); cursor: pointer;
|
|
218
|
+
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm); outline: none; user-select: none;
|
|
219
|
+
}
|
|
220
|
+
.box:focus-visible, :host([open]) .box { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
221
|
+
.text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
222
|
+
.placeholder { color: var(--cm-text-tertiary); }
|
|
223
|
+
.chev { flex: none; color: var(--cm-icon-selected); transition: transform .15s; }
|
|
224
|
+
:host([open]) .chev { transform: rotate(180deg); }
|
|
225
|
+
:host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
|
|
226
|
+
:host([disabled]) .box { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-default); cursor: not-allowed; }
|
|
227
|
+
[role='listbox'] {
|
|
228
|
+
position: absolute; z-index: 20; top: calc(100% + var(--cm-space-10)); left: 0; right: 0;
|
|
229
|
+
max-height: 242px; overflow-y: auto; margin: 0; padding: var(--cm-space-10) 0; list-style: none;
|
|
230
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default);
|
|
231
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100);
|
|
232
|
+
}
|
|
233
|
+
[role='option'] {
|
|
234
|
+
display: flex; align-items: center; min-height: 40px; padding: 6px var(--cm-space-20);
|
|
235
|
+
font-size: 16px; color: var(--cm-text-default); cursor: pointer;
|
|
236
|
+
}
|
|
237
|
+
[role='option'].active { background: var(--cm-bg-hover); }
|
|
238
|
+
[role='option'][aria-selected='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
239
|
+
[role='option'][aria-selected='true'].active { background: var(--cm-action-primary-hover); }
|
|
240
|
+
[role='option'][aria-disabled='true'] { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
241
|
+
.help, .error { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
242
|
+
.error { color: var(--cm-text-critical); }
|
|
243
|
+
slot { display: none; }
|
|
244
|
+
@media (max-width: 640px) { [role='option'] { font-size: 14px; min-height: 30px; padding-inline: var(--cm-space-15); } }
|
|
245
|
+
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
246
|
+
`];b("cm-select",Me);var pt,Ja,Zi,H,dt,no,lo,tr,ze=class extends u{constructor(){super(...arguments);p(this,H);this.label="Search";this.name="";this.value="";this.placeholder="Search";this.filter=!1;this.filterLabel="Filter";this.filterCount=0;this.size="default";this.disabled=!1;p(this,pt,this.attachInternals());p(this,Ja,w("cm-search"));p(this,Zi,"")}connectedCallback(){super.connectedCallback(),v(this,Zi,this.value)}get form(){return s(this,pt).form}checkValidity(){return s(this,pt).checkValidity()}formResetCallback(){this.value=s(this,Zi)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){s(this,pt).setFormValue(this.value)}render(){let e=this.size==="large";return r`<div class="box" part="box">
|
|
247
|
+
<cm-icon class="icon" name="search" size=${e?16:14}></cm-icon>
|
|
248
|
+
<input id=${s(this,Ja)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
249
|
+
aria-label=${this.label} .value=${qi(this.value)} placeholder=${this.placeholder||l} ?disabled=${this.disabled}
|
|
250
|
+
@input=${c(this,H,no)} @change=${()=>c(this,H,dt).call(this,"change")} @keydown=${c(this,H,lo)} />
|
|
251
|
+
${this.value&&!this.disabled?r`<button type="button" class="clear" part="clear" aria-label="Clear search" @click=${c(this,H,tr)}><cm-icon name="close" size="14"></cm-icon></button>`:l}
|
|
252
|
+
${this.filter?r`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
253
|
+
aria-label=${this.filterCount>0?`${this.filterLabel} (${this.filterCount} applied)`:this.filterLabel}
|
|
254
|
+
@click=${()=>c(this,H,dt).call(this,"cm-filter")}><cm-icon name="filter" size="18"></cm-icon>${this.filterCount>0?r`<span class="count" aria-hidden="true">${this.filterCount}</span>`:l}</button>`:l}
|
|
255
|
+
</div>`}};pt=new WeakMap,Ja=new WeakMap,Zi=new WeakMap,H=new WeakSet,dt=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},no=function(e){this.value=e.target.value},lo=function(e){e.key==="Enter"?c(this,H,dt).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),c(this,H,tr).call(this))},tr=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),c(this,H,dt).call(this,"input"),c(this,H,dt).call(this,"change")},ze.formAssociated=!0,ze.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0},ze.properties={label:{},name:{reflect:!0},value:{},placeholder:{},filter:{type:Boolean},filterLabel:{attribute:"filter-label"},filterCount:{type:Number,attribute:"filter-count"},size:{reflect:!0},disabled:{type:Boolean,reflect:!0}},ze.styles=[f,m`
|
|
256
|
+
:host { display: block; }
|
|
257
|
+
.box {
|
|
258
|
+
display: flex; align-items: center; gap: var(--cm-space-10); height: 42px; padding: 0 var(--cm-space-10);
|
|
259
|
+
background: var(--cm-bg-page); color: var(--cm-text-default);
|
|
260
|
+
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
261
|
+
}
|
|
262
|
+
:host([size='large']) .box { height: 46px; padding: 0 var(--cm-space-15); }
|
|
263
|
+
.box:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
264
|
+
.icon { flex: none; color: var(--cm-icon-selected); }
|
|
265
|
+
input {
|
|
266
|
+
flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; outline: none;
|
|
267
|
+
font: inherit; font-size: 14px; color: var(--cm-text-default);
|
|
268
|
+
}
|
|
269
|
+
input::placeholder { color: var(--cm-text-tertiary); }
|
|
270
|
+
input::-webkit-search-cancel-button { display: none; }
|
|
271
|
+
button {
|
|
272
|
+
position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center;
|
|
273
|
+
width: 28px; height: 28px; margin: 0 -4px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
274
|
+
background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
275
|
+
}
|
|
276
|
+
button:hover { background: var(--cm-bg-hover); }
|
|
277
|
+
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
278
|
+
.count {
|
|
279
|
+
position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--cm-radius-full);
|
|
280
|
+
background: var(--cm-action-primary); color: var(--cm-action-primary-text); font-size: 10px; line-height: 16px;
|
|
281
|
+
}
|
|
282
|
+
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
283
|
+
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
284
|
+
:host([disabled]) button { cursor: not-allowed; }
|
|
285
|
+
`];b("cm-search",ze);var co=o=>o>=1024*1024?`${+(o/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(o/1024))} KB`;function _n(o,i){if(!i.trim())return!0;let e=o.name.toLowerCase(),t=o.type.toLowerCase();return i.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean).some(a=>a.startsWith(".")?e.endsWith(a):a.endsWith("/*")?t.startsWith(a.slice(0,-1)):t===a)}var W,Y,de,P,po,ho,Qa,ir,_e=class extends u{constructor(){super(...arguments);p(this,P);this.label="";this.hint="";this.prompt="Click here to upload";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="";p(this,W,this.attachInternals());p(this,Y,w("cm-fu"));p(this,de,new Map)}get form(){return s(this,W).form}get validity(){return s(this,W).validity}get validationMessage(){return s(this,W).validationMessage}checkValidity(){return s(this,W).checkValidity()}reportValidity(){return s(this,W).reportValidity()}formResetCallback(){this.files=[],this._rejected=""}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of s(this,de).values())URL.revokeObjectURL(e);s(this,de).clear()}updated(e){if(e.has("files"))for(let[d,h]of s(this,de))this.files.includes(d)||(URL.revokeObjectURL(h),s(this,de).delete(d));let t=new FormData;for(let d of this.files)t.append(this.name||"file",d);s(this,W).setFormValue(this.files.length?t:null);let a=this.renderRoot.querySelector("input")??void 0,n=this.error||this._rejected;n?s(this,W).setValidity({customError:!0},n,a):this.required&&!this.files.length?s(this,W).setValidity({valueMissing:!0},"Please choose a file.",a):s(this,W).setValidity({})}addFiles(e){let t=[...e],a=[],n=[],d=[];for(let g of t)_n(g,this.accept)?this.maxSize&&g.size>this.maxSize?(n.push(g),d.push(`${g.name} is larger than ${co(this.maxSize)}`)):a.push(g):(n.push(g),d.push(`${g.name} is not an allowed file type`));let h=this.multiple?[...this.files,...a]:a.slice(-1);!this.multiple&&!a.length&&(h=this.files),this.multiple&&this.maxFiles&&h.length>this.maxFiles&&(n.push(...h.slice(this.maxFiles)),d.push(`You can add up to ${this.maxFiles} files`),h=h.slice(0,this.maxFiles)),this._rejected=d.join(". "),n.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:n}})),h!==this.files&&(h.length!==this.files.length||h.some((g,x)=>g!==this.files[x]))&&(this.files=h,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){let e=this.error||this._rejected,t=!this.files.length||this.multiple,a=this.files.length>0;return r`
|
|
286
|
+
${this.label||this.hint?r`<div class="head">
|
|
287
|
+
${this.label?r`<span class="label" id="${s(this,Y)}-l" part="label">${this.label}${this.required?r`<span class="req" aria-hidden="true">*</span>`:l}</span>`:l}
|
|
288
|
+
${this.hint?r`<span class="hint" id="${s(this,Y)}-hint">${this.hint}</span>`:l}
|
|
289
|
+
</div>`:l}
|
|
290
|
+
${a?r`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label="Chosen files">
|
|
291
|
+
${this.files.map(n=>r`<li class="file">
|
|
292
|
+
${n.type.startsWith("image/")?r`<img src=${c(this,P,po).call(this,n)} alt=${n.name} />`:r`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${n.name}</span><span class="size">${co(n.size)}</span></div>`}
|
|
293
|
+
${this.disabled?l:r`<button type="button" class="remove" aria-label="Remove ${n.name}" @click=${()=>this.removeFile(n)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
294
|
+
</li>`)}
|
|
295
|
+
${t?r`<li>${c(this,P,ir).call(this,!0)}</li>`:l}
|
|
296
|
+
</ul>`:c(this,P,ir).call(this,!1)}
|
|
297
|
+
${e?r`<p class="msg" id="${s(this,Y)}-msg" role="alert">${e}</p>`:l}
|
|
298
|
+
`}};W=new WeakMap,Y=new WeakMap,de=new WeakMap,P=new WeakSet,po=function(e){let t=s(this,de).get(e);return t||(t=URL.createObjectURL(e),s(this,de).set(e,t)),t},ho=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},Qa=function(e){this.toggleAttribute("data-over",e)},ir=function(e){let t=[this.hint&&`${s(this,Y)}-hint`,(this.error||this._rejected)&&`${s(this,Y)}-msg`].filter(Boolean).join(" ");return r`<label class="zone ${e?"tile":""}" part="zone"
|
|
299
|
+
@dragenter=${()=>c(this,P,Qa).call(this,!0)} @dragleave=${()=>c(this,P,Qa).call(this,!1)} @drop=${()=>c(this,P,Qa).call(this,!1)}>
|
|
300
|
+
<input type="file" id=${s(this,Y)} accept=${this.accept||l} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
301
|
+
?required=${this.required&&!this.files.length}
|
|
302
|
+
aria-labelledby=${[this.label&&`${s(this,Y)}-l`,`${s(this,Y)}-p`].filter(Boolean).join(" ")}
|
|
303
|
+
aria-describedby=${t||l} aria-invalid=${this.error||this._rejected?"true":l}
|
|
304
|
+
@change=${c(this,P,ho)} @cancel=${a=>a.stopPropagation()} />
|
|
305
|
+
<cm-icon name=${e?"plus":"upload"} size=${e?24:38}></cm-icon>
|
|
306
|
+
<span id="${s(this,Y)}-p">${e?"Add more":this.prompt}</span>
|
|
307
|
+
</label>`},_e.formAssociated=!0,_e.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0},_e.properties={label:{},hint:{},prompt:{},name:{reflect:!0},accept:{},multiple:{type:Boolean},maxSize:{type:Number,attribute:"max-size"},maxFiles:{type:Number,attribute:"max-files"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},error:{reflect:!0},files:{attribute:!1},_rejected:{state:!0}},_e.styles=[f,m`
|
|
308
|
+
:host { display: block; }
|
|
309
|
+
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-10); margin-bottom: var(--cm-space-20); }
|
|
310
|
+
.label { font-size: var(--cm-type-heading-sm-size); font-weight: 600; }
|
|
311
|
+
.req { color: var(--cm-text-critical); margin-left: 2px; }
|
|
312
|
+
.hint { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
313
|
+
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 186px)); gap: var(--cm-space-30); }
|
|
314
|
+
.zone {
|
|
315
|
+
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-10);
|
|
316
|
+
min-height: 177px; padding: var(--cm-space-20); text-align: center; font-size: 16px; color: var(--cm-text-default);
|
|
317
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) dashed var(--cm-border-strong); cursor: pointer;
|
|
318
|
+
}
|
|
319
|
+
.zone:hover, :host([data-over]) .zone { background: var(--cm-bg-hover); }
|
|
320
|
+
.zone.tile { min-height: 0; aspect-ratio: 1; border-radius: var(--cm-radius-md); font-size: 14px; }
|
|
321
|
+
.zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: inherit; font-size: 0; }
|
|
322
|
+
.zone:focus-within { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
323
|
+
.file {
|
|
324
|
+
position: relative; aspect-ratio: 1; border-radius: var(--cm-radius-md); background: var(--cm-bg-inset);
|
|
325
|
+
border: var(--cm-border-1) solid var(--cm-border-card);
|
|
326
|
+
}
|
|
327
|
+
.file img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
|
|
328
|
+
.doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 100%; padding: var(--cm-space-10); text-align: center; }
|
|
329
|
+
.doc .name { font-size: 12px; word-break: break-all; }
|
|
330
|
+
.doc .size, .tile .size { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
331
|
+
.remove {
|
|
332
|
+
position: absolute; top: -10px; right: -10px; display: inline-flex; align-items: center; justify-content: center;
|
|
333
|
+
width: 24px; height: 24px; padding: 0; border-radius: var(--cm-radius-full); cursor: pointer;
|
|
334
|
+
background: var(--cm-bg-surface); color: var(--cm-icon-selected); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
335
|
+
}
|
|
336
|
+
.remove:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
337
|
+
.msg { margin: var(--cm-space-10) 0 0; font-size: 12px; color: var(--cm-text-critical); }
|
|
338
|
+
:host([disabled]) .zone { cursor: not-allowed; background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-default); }
|
|
339
|
+
:host([disabled]) .remove { display: none; }
|
|
340
|
+
@media (max-width: 640px) {
|
|
341
|
+
.zone:not(.tile) { min-height: 100px; font-size: 14px; }
|
|
342
|
+
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
343
|
+
}
|
|
344
|
+
`];b("cm-file-upload",_e);var J,Ji,ht,Qi,G,ar,sr,mo,Ue=class extends u{constructor(){super(...arguments);p(this,G);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];p(this,J,this.attachInternals());p(this,Ji,w("cm-og"));p(this,ht,"");p(this,Qi,new MutationObserver(()=>c(this,G,ar).call(this)))}connectedCallback(){super.connectedCallback(),c(this,G,ar).call(this),s(this,Qi).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),s(this,Qi).disconnect()}get form(){return s(this,J).form}get validity(){return s(this,J).validity}get validationMessage(){return s(this,J).validationMessage}checkValidity(){return s(this,J).checkValidity()}reportValidity(){return s(this,J).reportValidity()}formResetCallback(){this.value=s(this,ht)}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(){s(this,ht)||v(this,ht,this.value)}updated(){s(this,J).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?s(this,J).setValidity({valueMissing:!0},"Please select one of these options.",e):s(this,J).setValidity({})}render(){let e=this.items,t=e.findIndex(d=>d.value===this.value&&!d.disabled),a=t>=0?t:e.findIndex(d=>!d.disabled),n=this.getAttribute("aria-label");return r`
|
|
345
|
+
${this.label?r`<span class="label" id="${s(this,Ji)}-l" part="label">${this.label}${this.required?r`<span class="req" aria-hidden="true">*</span>`:l}</span>`:l}
|
|
346
|
+
<div class="options" part="options" role="radiogroup"
|
|
347
|
+
aria-labelledby=${this.label?`${s(this,Ji)}-l`:l} aria-label=${!this.label&&n?n:l}
|
|
348
|
+
aria-required=${this.required?"true":l}>
|
|
349
|
+
${e.map((d,h)=>r`<button type="button" role="radio" part="option" aria-checked=${d.value===this.value?"true":"false"}
|
|
350
|
+
tabindex=${h===a?"0":"-1"} ?disabled=${this.disabled||!!d.disabled}
|
|
351
|
+
@click=${()=>c(this,G,sr).call(this,h)} @keydown=${g=>c(this,G,mo).call(this,g,h)}>${d.label}</button>`)}
|
|
352
|
+
</div>
|
|
353
|
+
<slot></slot>
|
|
354
|
+
`}};J=new WeakMap,Ji=new WeakMap,ht=new WeakMap,Qi=new WeakMap,G=new WeakSet,ar=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>({value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled})),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",v(this,ht,this.value))},sr=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}))))},mo=function(e,t){let a=this.items.flatMap((h,g)=>h.disabled?[]:[g]),n=a.indexOf(t),d;if(e.key==="ArrowRight"||e.key==="ArrowDown")d=a[(n+1)%a.length];else if(e.key==="ArrowLeft"||e.key==="ArrowUp")d=a[(n-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&&c(this,G,sr).call(this,d)},Ue.formAssociated=!0,Ue.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},Ue.styles=[f,m`
|
|
355
|
+
:host { display: block; }
|
|
356
|
+
.label { display: block; margin-bottom: var(--cm-space-20); font-size: var(--cm-type-heading-sm-size); font-weight: 600; }
|
|
357
|
+
.req { color: var(--cm-text-critical); margin-left: 2px; }
|
|
358
|
+
.options { display: flex; flex-wrap: wrap; gap: var(--cm-space-20); }
|
|
359
|
+
button {
|
|
360
|
+
height: 46px; padding: 0 var(--cm-space-20); font: inherit; font-size: 16px; font-weight: 500; white-space: nowrap;
|
|
361
|
+
color: var(--cm-text-default); background: var(--cm-bg-hover); cursor: pointer;
|
|
362
|
+
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
363
|
+
}
|
|
364
|
+
button:hover { border-color: var(--cm-border-strong); }
|
|
365
|
+
button[aria-checked='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); border-color: var(--cm-action-primary); }
|
|
366
|
+
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
367
|
+
button:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-default); cursor: not-allowed; }
|
|
368
|
+
button[aria-checked='true']:disabled { background: var(--cm-action-disabled); color: var(--cm-action-disabled-text); }
|
|
369
|
+
slot { display: none; }
|
|
370
|
+
@media (max-width: 640px) {
|
|
371
|
+
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
372
|
+
.options { gap: var(--cm-space-10); }
|
|
373
|
+
button { height: 42px; padding: 0 var(--cm-space-15); font-size: 14px; }
|
|
374
|
+
}
|
|
375
|
+
`];b("cm-option-group",Ue);var Ga,uo,mt=class extends u{constructor(){super(...arguments);p(this,Ga);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||`Remove ${this.textContent?.trim()??""}`.trim();return r`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?r`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${c(this,Ga,uo)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:l}</span>`}};Ga=new WeakSet,uo=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},mt.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},mt.styles=[f,m`
|
|
376
|
+
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
377
|
+
.tag {
|
|
378
|
+
display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 26px; padding: 0 var(--cm-space-10);
|
|
379
|
+
font-size: 12px; color: var(--cm-text-default); background: var(--cm-bg-tag);
|
|
380
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-full);
|
|
381
|
+
}
|
|
382
|
+
:host([removable]) .tag { padding-right: 4px; }
|
|
383
|
+
.text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
384
|
+
button {
|
|
385
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
|
|
386
|
+
padding: 0; border: 0; border-radius: var(--cm-radius-full); background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
387
|
+
}
|
|
388
|
+
button:hover { background: var(--cm-bg-hover); }
|
|
389
|
+
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
390
|
+
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-default); }
|
|
391
|
+
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); }
|
|
392
|
+
@media (max-width: 640px) { .tag { height: 22px; } button { width: 18px; height: 18px; } }
|
|
393
|
+
`];b("cm-tag",mt);var Gi,rr,ut=class extends u{constructor(){super(...arguments);p(this,Gi);this.heading="";this.breadcrumbs=[];this.pagination=!1;this.hasPrevious=!1;this.hasNext=!1}render(){let e=Array.isArray(this.breadcrumbs)?this.breadcrumbs:[],t=[...e].reverse().find(a=>a.href);return r`<header part="header">
|
|
394
|
+
<div class="lead">
|
|
395
|
+
${t?r`<a class="back" part="back" href=${t.href} aria-label=${`Back to ${t.label}`}><cm-icon name="chevron-left" size="20"></cm-icon></a>`:l}
|
|
396
|
+
<div class="titles">
|
|
397
|
+
${e.length?r`<nav aria-label="Breadcrumb" part="breadcrumbs"><ol>
|
|
398
|
+
${e.map(a=>r`<li>${a.href?r`<a href=${a.href}>${a.label}</a>`:a.label}</li>`)}
|
|
399
|
+
<li><span aria-current="page">${this.heading}</span></li>
|
|
400
|
+
</ol></nav>`:l}
|
|
401
|
+
<h1 part="title"><span class="text">${this.heading}</span><slot name="title-adornment"></slot></h1>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
<div class="actions">
|
|
405
|
+
${this.pagination?r`<div class="arrows" role="group" aria-label="Records">
|
|
406
|
+
<button class="arrow" type="button" aria-label="Previous" ?disabled=${!this.hasPrevious} @click=${()=>c(this,Gi,rr).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
407
|
+
<button class="arrow" type="button" aria-label="Next" ?disabled=${!this.hasNext} @click=${()=>c(this,Gi,rr).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
408
|
+
</div>`:l}
|
|
409
|
+
<slot name="actions"></slot>
|
|
410
|
+
</div>
|
|
411
|
+
</header>`}};Gi=new WeakSet,rr=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},ut.properties={heading:{},breadcrumbs:{type:Array},pagination:{type:Boolean,reflect:!0},hasPrevious:{type:Boolean,attribute:"has-previous"},hasNext:{type:Boolean,attribute:"has-next"}},ut.styles=[f,m`
|
|
412
|
+
:host { display: block; }
|
|
413
|
+
header {
|
|
414
|
+
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-20);
|
|
415
|
+
min-height: 80px; padding: var(--cm-space-12) var(--cm-space-20);
|
|
416
|
+
background: var(--cm-bg-surface); border-bottom: var(--cm-border-1) solid var(--cm-border-default);
|
|
417
|
+
}
|
|
418
|
+
.lead { flex: 1 1 280px; display: flex; align-items: center; gap: var(--cm-space-10); min-width: 0; }
|
|
419
|
+
.titles { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
|
|
420
|
+
nav ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--cm-text-tertiary); }
|
|
421
|
+
nav li { white-space: nowrap; }
|
|
422
|
+
nav li + li::before { content: '/'; padding: 0 0.35em; }
|
|
423
|
+
nav a { color: inherit; text-decoration: none; border-radius: var(--cm-radius-xs); }
|
|
424
|
+
nav a:hover { color: var(--cm-text-default); text-decoration: underline; }
|
|
425
|
+
nav a:focus-visible, .back:focus-visible, .arrow:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
426
|
+
nav [aria-current] { color: var(--cm-text-default); }
|
|
427
|
+
h1 {
|
|
428
|
+
display: flex; align-items: center; gap: var(--cm-space-10); margin: 0; min-width: 0;
|
|
429
|
+
font-size: 26px; font-weight: 500; line-height: 1.2;
|
|
430
|
+
}
|
|
431
|
+
.text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
432
|
+
.actions { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-20); margin-left: auto; }
|
|
433
|
+
.arrows { display: flex; gap: var(--cm-space-10); }
|
|
434
|
+
.arrow, .back {
|
|
435
|
+
display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
|
|
436
|
+
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
437
|
+
background: var(--cm-bg-surface); color: var(--cm-icon-selected); cursor: pointer;
|
|
438
|
+
}
|
|
439
|
+
.arrow:hover:not(:disabled), .back:hover { background: var(--cm-bg-hover); }
|
|
440
|
+
.arrow:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-default); cursor: not-allowed; }
|
|
441
|
+
.back { display: none; border: 0; flex: none; text-decoration: none; }
|
|
442
|
+
@media (max-width: 640px) {
|
|
443
|
+
header { flex-wrap: nowrap; min-height: 50px; padding: var(--cm-space-10); gap: var(--cm-space-10); }
|
|
444
|
+
.lead { flex: 1 1 auto; }
|
|
445
|
+
nav { display: none; }
|
|
446
|
+
.back { display: inline-flex; }
|
|
447
|
+
h1 { font-size: 18px; font-weight: 600; }
|
|
448
|
+
.actions { gap: var(--cm-space-10); }
|
|
449
|
+
}
|
|
450
|
+
`];b("cm-page-header",ut);var bt=class extends u{constructor(){super(...arguments);this.eyebrow="";this.heading="";this.tone="default";this.sticky=!1;this.label=""}render(){let e=this.tone==="critical";return r`<div class="bar" part="bar" role="region" aria-label=${this.label||this.heading||this.eyebrow||"Actions"}>
|
|
451
|
+
<div class="lead">
|
|
452
|
+
${e?r`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:l}
|
|
453
|
+
<div class="text">
|
|
454
|
+
<div class="eyebrow" ?hidden=${!this.eyebrow}>${this.eyebrow}<slot name="adornment"></slot></div>
|
|
455
|
+
${this.heading?r`<p class="heading" part="heading" role=${e?"alert":l}>${this.heading}</p>`:l}
|
|
456
|
+
<slot></slot>
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
460
|
+
</div>`}};bt.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},bt.styles=[f,m`
|
|
461
|
+
:host { display: block; }
|
|
462
|
+
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
463
|
+
.bar {
|
|
464
|
+
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-20);
|
|
465
|
+
min-height: 80px; padding: var(--cm-space-15) var(--cm-space-20) var(--cm-space-15) var(--cm-space-20);
|
|
466
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card); border-radius: var(--cm-radius-md);
|
|
467
|
+
}
|
|
468
|
+
:host([sticky]) .bar { box-shadow: var(--cm-shadow-100); }
|
|
469
|
+
:host([tone='critical']) .bar {
|
|
470
|
+
background: var(--cm-bg-error-bar); border-color: transparent; border-top-color: var(--cm-border-critical); border-radius: 0;
|
|
471
|
+
}
|
|
472
|
+
.lead { flex: 1 1 280px; display: flex; align-items: center; gap: var(--cm-space-10); min-width: 0; }
|
|
473
|
+
.text { min-width: 0; display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
474
|
+
.eyebrow { display: flex; align-items: center; gap: var(--cm-space-10); font-size: 14px; font-weight: 500; }
|
|
475
|
+
.eyebrow[hidden] { display: none; }
|
|
476
|
+
.heading { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
|
|
477
|
+
:host([tone='critical']) .heading { font-weight: 400; }
|
|
478
|
+
.icon {
|
|
479
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
|
|
480
|
+
border-radius: var(--cm-radius-full); background: var(--cm-bg-surface); color: var(--cm-icon-critical);
|
|
481
|
+
}
|
|
482
|
+
.actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-20); margin-left: auto; }
|
|
483
|
+
@media (max-width: 640px) {
|
|
484
|
+
.bar { min-height: 68px; padding: var(--cm-space-10); gap: var(--cm-space-10); }
|
|
485
|
+
.heading { font-size: 14px; }
|
|
486
|
+
.eyebrow { font-size: 12px; }
|
|
487
|
+
.text { gap: var(--cm-space-10); }
|
|
488
|
+
.icon { width: 30px; height: 30px; }
|
|
489
|
+
.actions { gap: var(--cm-space-10); }
|
|
490
|
+
}
|
|
491
|
+
`];b("cm-action-bar",bt);var ee,Fe,ea,I,or,nr,lr,bo,fo,ft=class extends u{constructor(){super(...arguments);p(this,I);this.open=!1;this.message="Unsaved changes";this.saveLabel="Save";this.discardLabel="Discard";this.loading=!1;this.saveDisabled=!1;this.form="";p(this,ee,null);p(this,Fe,()=>{this.open=!0});p(this,ea,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>c(this,I,or).call(this))}disconnectedCallback(){super.disconnectedCallback(),c(this,I,nr).call(this)}updated(e){e.has("form")&&this.isConnected&&c(this,I,or).call(this)}render(){return r`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
492
|
+
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
493
|
+
<div class="actions">
|
|
494
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${c(this,I,fo)}>${this.discardLabel}</cm-button>
|
|
495
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${c(this,I,bo)}>${this.saveLabel}</cm-button>
|
|
496
|
+
</div>
|
|
497
|
+
</div>`}};ee=new WeakMap,Fe=new WeakMap,ea=new WeakMap,I=new WeakSet,or=function(){c(this,I,nr).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(v(this,ee,e),e.addEventListener("input",s(this,Fe)),e.addEventListener("change",s(this,Fe)),e.addEventListener("reset",s(this,ea)))},nr=function(){let e=s(this,ee);e&&(e.removeEventListener("input",s(this,Fe)),e.removeEventListener("change",s(this,Fe)),e.removeEventListener("reset",s(this,ea)),v(this,ee,null))},lr=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},bo=function(){this.loading||this.saveDisabled||c(this,I,lr).call(this,"cm-save")&&s(this,ee)&&s(this,ee).requestSubmit()},fo=function(){this.loading||c(this,I,lr).call(this,"cm-discard")&&s(this,ee)&&(s(this,ee).reset(),this.open=!1)},ft.properties={open:{type:Boolean,reflect:!0},message:{},saveLabel:{attribute:"save-label"},discardLabel:{attribute:"discard-label"},loading:{type:Boolean,reflect:!0},saveDisabled:{type:Boolean,attribute:"save-disabled"},form:{}},ft.styles=[f,m`
|
|
498
|
+
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
499
|
+
:host(:not([open])) { display: none; }
|
|
500
|
+
.bar {
|
|
501
|
+
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-20);
|
|
502
|
+
min-height: 80px; padding: var(--cm-space-15) var(--cm-space-20);
|
|
503
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card);
|
|
504
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100);
|
|
505
|
+
}
|
|
506
|
+
.message { flex: 1 1 200px; margin: 0; font-size: 20px; font-weight: 600; }
|
|
507
|
+
.actions { flex: none; display: flex; gap: var(--cm-space-20); margin-left: auto; }
|
|
508
|
+
@media (max-width: 640px) {
|
|
509
|
+
.bar { min-height: 68px; padding: var(--cm-space-10); gap: var(--cm-space-10); }
|
|
510
|
+
.message { font-size: 14px; font-weight: 500; }
|
|
511
|
+
.actions { gap: var(--cm-space-10); }
|
|
512
|
+
}
|
|
513
|
+
`];b("cm-save-bar",ft);var gt=class extends u{constructor(){super(...arguments);this.heading="";this.action="";this.actionLabel="";this.headingLevel=2;this._list=!0}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return r`<section part="panel" aria-label=${this.heading||l}>
|
|
514
|
+
${this.heading||this.action?r`<header>
|
|
515
|
+
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
516
|
+
${this.action?r`<button class="action" type="button" part="action" aria-label=${this.actionLabel||l}
|
|
517
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:l}
|
|
518
|
+
</header>`:l}
|
|
519
|
+
<div class="items" role=${this._list?"list":l}><slot @slotchange=${t=>{this._list=t.target.assignedElements().every(a=>a.localName==="cm-info-item")}}></slot></div>
|
|
520
|
+
</section>`}};gt.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},_list:{state:!0}},gt.styles=[f,m`
|
|
521
|
+
:host { display: block; }
|
|
522
|
+
section {
|
|
523
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card);
|
|
524
|
+
border-radius: var(--cm-radius-md); padding: var(--cm-space-20);
|
|
525
|
+
}
|
|
526
|
+
header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--cm-space-20); margin-bottom: var(--cm-space-20); }
|
|
527
|
+
.title { margin: 0; font-size: 20px; font-weight: 600; }
|
|
528
|
+
.action {
|
|
529
|
+
padding: 2px 4px; margin: -2px -4px; border: 0; background: none; color: var(--cm-text-default); cursor: pointer;
|
|
530
|
+
font: inherit; font-size: 14px; font-weight: 500; letter-spacing: var(--cm-tracking-caps); text-transform: uppercase;
|
|
531
|
+
border-radius: var(--cm-radius-xs);
|
|
532
|
+
}
|
|
533
|
+
.action:hover { text-decoration: underline; }
|
|
534
|
+
.action:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
535
|
+
.items { display: grid; grid-template-columns: 1fr 1fr; gap: var(--cm-space-15) var(--cm-space-20); }
|
|
536
|
+
`];b("cm-info-panel",gt);var vt=class extends u{constructor(){super(...arguments);this.label="";this.half=!1}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}render(){return r`<div class="label" part="label">${this.label}</div><div class="value" part="value"><slot></slot></div>`}};vt.properties={label:{},half:{type:Boolean,reflect:!0}},vt.styles=[f,m`
|
|
537
|
+
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
538
|
+
:host([half]) { grid-column: auto; }
|
|
539
|
+
.label { font-size: 16px; }
|
|
540
|
+
.value {
|
|
541
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-10);
|
|
542
|
+
margin-top: 6px; font-size: 16px; font-weight: 500; overflow-wrap: anywhere;
|
|
543
|
+
}
|
|
544
|
+
`];b("cm-info-item",vt);var Ke,xt=class extends u{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;p(this,Ke,w("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 r`<div class="wrap" part="accordion">
|
|
545
|
+
<div class="h" role="heading" aria-level=${e}>
|
|
546
|
+
<button type="button" part="toggle" id="${s(this,Ke)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${s(this,Ke)}-body"
|
|
547
|
+
?disabled=${this.disabled} @click=${this.toggle}>
|
|
548
|
+
<span>${this.heading}</span>
|
|
549
|
+
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
550
|
+
</button>
|
|
551
|
+
</div>
|
|
552
|
+
<div class="body" part="body" id="${s(this,Ke)}-body" role="region" aria-labelledby="${s(this,Ke)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
553
|
+
</div>`}};Ke=new WeakMap,xt.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},xt.styles=[f,m`
|
|
554
|
+
:host { display: block; }
|
|
555
|
+
.wrap { border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
556
|
+
.h { margin: 0; font: inherit; }
|
|
557
|
+
button {
|
|
558
|
+
display: flex; align-items: center; justify-content: space-between; gap: var(--cm-space-15); width: 100%;
|
|
559
|
+
min-height: 60px; padding: var(--cm-space-12) var(--cm-space-15) var(--cm-space-12) var(--cm-space-20);
|
|
560
|
+
border: 0; border-radius: inherit; background: none; color: var(--cm-text-default);
|
|
561
|
+
font: inherit; font-size: 16px; text-align: left; cursor: pointer;
|
|
562
|
+
}
|
|
563
|
+
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
564
|
+
button:disabled { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
565
|
+
.chev {
|
|
566
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
|
|
567
|
+
border-radius: var(--cm-radius-full); background: var(--cm-bg-page); color: var(--cm-icon-selected);
|
|
568
|
+
transition: transform .2s ease;
|
|
569
|
+
}
|
|
570
|
+
:host([open]) .chev { transform: rotate(180deg); }
|
|
571
|
+
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
572
|
+
.body { padding: var(--cm-space-15) var(--cm-space-20); border-top: var(--cm-border-1) solid var(--cm-border-default); font-size: 14px; }
|
|
573
|
+
.body[hidden] { display: none; }
|
|
574
|
+
@media (max-width: 640px) { button { min-height: 50px; font-size: 14px; } .chev { width: 28px; height: 28px; } }
|
|
575
|
+
`];b("cm-accordion",xt);var $t,es,yt=class extends u{constructor(){super(...arguments);p(this,$t);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="large";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=this.image?r`<img src=${this.image} alt="" part="image">`:this.icon?r`<cm-icon name=${this.icon} size="96"></cm-icon>`:l;return r`<div class="wrap" part="empty-state">
|
|
576
|
+
<div class="circle" part="circle" aria-hidden=${this.hasImage?l:"true"}>
|
|
577
|
+
<slot name="image" @slotchange=${a=>c(this,$t,es).call(this,a,"hasImage")}>${t}</slot>
|
|
578
|
+
</div>
|
|
579
|
+
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
580
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${a=>c(this,$t,es).call(this,a,"hasText")}></slot></div>
|
|
581
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${a=>c(this,$t,es).call(this,a,"hasActions")}></slot></div>
|
|
582
|
+
</div>`}};$t=new WeakSet,es=function(e,t){let a=e.target;this[t]=a.assignedNodes({flatten:!0}).some(n=>n.nodeType===1||n.textContent.trim()),this.requestUpdate()},yt.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0}},yt.styles=[f,m`
|
|
583
|
+
:host { display: block; }
|
|
584
|
+
.wrap {
|
|
585
|
+
display: flex; flex-direction: column; align-items: center; text-align: center;
|
|
586
|
+
padding: var(--cm-space-30) var(--cm-space-20);
|
|
587
|
+
}
|
|
588
|
+
.circle {
|
|
589
|
+
display: flex; align-items: center; justify-content: center; overflow: hidden;
|
|
590
|
+
width: 250px; height: 250px; border-radius: var(--cm-radius-full);
|
|
591
|
+
background: var(--cm-bg-input-filled); color: var(--cm-icon-selected);
|
|
592
|
+
}
|
|
593
|
+
.circle img, ::slotted([slot='image']) { max-width: 66%; max-height: 66%; object-fit: contain; }
|
|
594
|
+
.title { margin: 40px 0 0; font-size: 16px; font-weight: 400; }
|
|
595
|
+
.text { margin-top: var(--cm-space-10); max-width: 46ch; font-size: 14px; color: var(--cm-text-tertiary); }
|
|
596
|
+
.text[hidden], .actions[hidden] { display: none; }
|
|
597
|
+
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--cm-space-20); margin-top: var(--cm-space-20); }
|
|
598
|
+
:host([size='small']) .circle { width: 200px; height: 200px; }
|
|
599
|
+
:host([size='small']) .title { margin-top: 30px; font-size: 14px; }
|
|
600
|
+
:host([size='small']) .actions { gap: var(--cm-space-10); }
|
|
601
|
+
@media (max-width: 640px) {
|
|
602
|
+
.circle { width: 200px; height: 200px; }
|
|
603
|
+
.title { margin-top: 30px; font-size: 14px; }
|
|
604
|
+
.actions { gap: var(--cm-space-10); }
|
|
605
|
+
}
|
|
606
|
+
`];b("cm-empty-state",yt);var go={small:34,medium:40,large:50,xlarge:186},wt=class extends u{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=go[this.size]??go.large;return r`<span class="bone" part="bone" style="width:${t}px;height:${t}px"></span>`}if(this.variant==="block")return r`<span class="bone block" part="bone"></span>`;let e=Math.max(1,Math.floor(this.lines||1));return r`${Array.from({length:e},(t,a)=>r`<span class="bone line ${e>1&&a===e-1?"short":""}" part="bone"></span>`)}`}};wt.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},wt.styles=[f,m`
|
|
607
|
+
:host { display: block; --cm-skeleton-height: 120px; }
|
|
608
|
+
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
609
|
+
.bone {
|
|
610
|
+
display: block; border-radius: var(--cm-radius-md); background: var(--cm-bg-input-filled);
|
|
611
|
+
animation: pulse 1.6s ease-in-out infinite;
|
|
612
|
+
}
|
|
613
|
+
.line { height: 12px; margin: 6px 0; border-radius: var(--cm-radius-sm); }
|
|
614
|
+
.line.short { width: 60%; }
|
|
615
|
+
.block { height: var(--cm-skeleton-height); }
|
|
616
|
+
@keyframes pulse { 50% { background: var(--cm-thumb-bg); } }
|
|
617
|
+
@media (prefers-reduced-motion: reduce) {
|
|
618
|
+
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
619
|
+
}
|
|
620
|
+
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
621
|
+
`];b("cm-skeleton",wt);var Tn=[472,90,90,251],Ln=[94,266,134,191,138],kt=class extends u{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1;this.label="Loading"}render(){let e=t=>t.map(a=>r`<span class="bone" style="height:${a}px"></span>`);return r`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
622
|
+
<span class="sr" role="status">${this.label}</span>
|
|
623
|
+
<div class="page" aria-hidden="true">
|
|
624
|
+
${this.navigation?r`<span class="bone nav"></span>`:l}
|
|
625
|
+
<span class="bone head"></span>
|
|
626
|
+
<div class="body">
|
|
627
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:Tn)}</div>
|
|
628
|
+
<div class="col side">${e(Ln)}</div>
|
|
629
|
+
</div>
|
|
630
|
+
</div>
|
|
631
|
+
</div>`}};kt.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{}},kt.styles=[f,m`
|
|
632
|
+
:host { display: block; }
|
|
633
|
+
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-10); }
|
|
634
|
+
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
635
|
+
.nav { grid-row: span 2; border-radius: 14px; min-height: 100%; }
|
|
636
|
+
.body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 3fr); gap: var(--cm-space-10); align-items: start; }
|
|
637
|
+
:host([layout='one-column']) .body { grid-template-columns: minmax(0, 1fr); }
|
|
638
|
+
:host([layout='one-column']) .side { display: none; }
|
|
639
|
+
.col { display: grid; gap: var(--cm-space-10); }
|
|
640
|
+
.bone {
|
|
641
|
+
display: block; border-radius: var(--cm-radius-md); background: var(--cm-bg-input-filled);
|
|
642
|
+
animation: pulse 1.6s ease-in-out infinite;
|
|
643
|
+
}
|
|
644
|
+
.head { height: 80px; }
|
|
645
|
+
@keyframes pulse { 50% { background: var(--cm-thumb-bg); } }
|
|
646
|
+
@media (prefers-reduced-motion: reduce) { .bone { animation: none; background: var(--cm-thumb-bg); } }
|
|
647
|
+
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
648
|
+
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
649
|
+
@media (max-width: 768px) {
|
|
650
|
+
:host([navigation]) .page { grid-template-columns: minmax(0, 1fr); }
|
|
651
|
+
.nav { display: none; }
|
|
652
|
+
.body { grid-template-columns: minmax(0, 1fr); }
|
|
653
|
+
.head { height: 60px; }
|
|
654
|
+
}
|
|
655
|
+
`];b("cm-skeleton-display",kt);var ts,vo,Et=class extends u{constructor(){super(...arguments);p(this,ts);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=c(this,ts,vo).call(this);return r`<article part="comment">
|
|
656
|
+
${e?r`<time class="meta" part="time" datetime=${this.datetime||l}>${e}</time>`:l}
|
|
657
|
+
<div class="body" part="body"><slot></slot></div>
|
|
658
|
+
${this.author?r`<div class="meta" part="author">– ${this.author}</div>`:l}
|
|
659
|
+
</article>`}};ts=new WeakSet,vo=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(e)},Et.properties={author:{},datetime:{},time:{}},Et.styles=[f,m`
|
|
660
|
+
:host { display: block; }
|
|
661
|
+
article {
|
|
662
|
+
display: flex; flex-direction: column; gap: 6px; padding: var(--cm-space-10);
|
|
663
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-sm);
|
|
664
|
+
}
|
|
665
|
+
.meta { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
666
|
+
.body { font-size: 14px; line-height: 16px; overflow-wrap: anywhere; }
|
|
667
|
+
`];b("cm-comment",Et);var ta,is,xo,Mt=class extends u{constructor(){super(...arguments);p(this,is);this.heading="Comments";this.label="Add a comment";this.placeholder="";this.action="Post comment";this.value="";this.disabled=!1;this.headingLevel=2;p(this,ta,w("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 a=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(a)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return r`<section part="comment-box" aria-labelledby="${s(this,ta)}-h">
|
|
668
|
+
<div class="title" id="${s(this,ta)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
669
|
+
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||l} .value=${this.value}
|
|
670
|
+
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
671
|
+
@keydown=${c(this,is,xo)}></textarea>
|
|
672
|
+
<div class="actions"><cm-button variant="primary" size="large" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
673
|
+
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
674
|
+
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
675
|
+
</div>
|
|
676
|
+
</section>`}};ta=new WeakMap,is=new WeakSet,xo=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},Mt.properties={heading:{},label:{},placeholder:{},action:{},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},Mt.styles=[f,m`
|
|
677
|
+
:host { display: block; }
|
|
678
|
+
section { display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
679
|
+
.title { margin: 0; font-size: 20px; font-weight: 600; }
|
|
680
|
+
textarea {
|
|
681
|
+
display: block; width: 100%; min-height: 128px; padding: var(--cm-space-10); resize: vertical;
|
|
682
|
+
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
683
|
+
background: var(--cm-bg-surface); color: var(--cm-text-default); font: inherit; font-size: 14px;
|
|
684
|
+
}
|
|
685
|
+
textarea::placeholder { color: var(--cm-text-tertiary); }
|
|
686
|
+
textarea:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; border-color: var(--cm-border-strong); }
|
|
687
|
+
textarea:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); }
|
|
688
|
+
.actions { display: flex; }
|
|
689
|
+
.list { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
690
|
+
.list[hidden] { display: none; }
|
|
691
|
+
@media (max-width: 640px) {
|
|
692
|
+
section { gap: var(--cm-space-10); }
|
|
693
|
+
.title { font-size: 16px; }
|
|
694
|
+
textarea { min-height: 100px; }
|
|
695
|
+
.actions { justify-content: flex-end; }
|
|
696
|
+
}
|
|
697
|
+
`];b("cm-comment-box",Mt);var zt=class extends u{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 r`<a part="tip" href=${this.href||l} target=${this.target||l} rel=${e?"noopener noreferrer":l}>
|
|
698
|
+
<span class="text">
|
|
699
|
+
<span class="title" part="heading">${this.heading}</span>
|
|
700
|
+
<span class="desc" part="description"><slot></slot></span>
|
|
701
|
+
${e?r`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">(opens in a new tab)</span>`:l}
|
|
702
|
+
</span>
|
|
703
|
+
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
704
|
+
</a>`}};zt.properties={heading:{},href:{},target:{}},zt.styles=[f,m`
|
|
705
|
+
:host { display: block; }
|
|
706
|
+
a {
|
|
707
|
+
display: flex; align-items: flex-start; gap: var(--cm-space-10); padding: var(--cm-space-20) var(--cm-space-10) var(--cm-space-20) var(--cm-space-10);
|
|
708
|
+
min-height: 104px; background: var(--cm-bg-surface); color: var(--cm-text-default); text-decoration: none;
|
|
709
|
+
border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md);
|
|
710
|
+
}
|
|
711
|
+
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
712
|
+
.text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
|
|
713
|
+
.title { font-size: 16px; font-weight: 500; line-height: 17px; }
|
|
714
|
+
.desc { font-size: 14px; line-height: 16px; color: var(--cm-text-tertiary); }
|
|
715
|
+
.go {
|
|
716
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
|
|
717
|
+
margin-top: -10px; border-radius: var(--cm-radius-full); background: var(--cm-bg-icon); color: var(--cm-icon-selected);
|
|
718
|
+
}
|
|
719
|
+
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
720
|
+
a:hover .title { text-decoration: underline; }
|
|
721
|
+
`];b("cm-smart-tip",zt);var _t=class extends u{constructor(){super(...arguments);this.heading="Smart tips";this.tourHeading="";this.tourAction="Start";this.headingLevel=2}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return r`<div class="card" part="smart-tips">
|
|
722
|
+
${this.tourHeading?r`<div class="tour" part="tour">
|
|
723
|
+
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="18"></cm-icon></span>
|
|
724
|
+
<span class="tour-text">${this.tourHeading}</span>
|
|
725
|
+
<cm-button size="medium" @click=${()=>this.dispatchEvent(new CustomEvent("cm-tour",{bubbles:!0,composed:!0}))}>${this.tourAction}</cm-button>
|
|
726
|
+
</div>`:l}
|
|
727
|
+
<section class="panel" part="panel" aria-label=${this.heading}>
|
|
728
|
+
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
729
|
+
<div class="list" role="list"><slot></slot></div>
|
|
730
|
+
</section>
|
|
731
|
+
</div>`}};_t.properties={heading:{},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action"},headingLevel:{type:Number,attribute:"heading-level"}},_t.styles=[f,m`
|
|
732
|
+
:host { display: block; }
|
|
733
|
+
.card { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
734
|
+
.tour {
|
|
735
|
+
display: flex; align-items: center; gap: var(--cm-space-10); min-height: 60px; padding: var(--cm-space-12) 14px var(--cm-space-12) var(--cm-space-20);
|
|
736
|
+
border-radius: var(--cm-radius-md); background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
737
|
+
}
|
|
738
|
+
.tour-icon {
|
|
739
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
|
|
740
|
+
border-radius: var(--cm-radius-full); background: var(--cm-nav-active); color: var(--cm-text-on-dark);
|
|
741
|
+
}
|
|
742
|
+
.tour-text { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; line-height: 14px; }
|
|
743
|
+
.panel { padding: var(--cm-space-10); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
744
|
+
.title {
|
|
745
|
+
margin: var(--cm-space-10) 0 var(--cm-space-20); text-align: center; font-size: 14px; font-weight: 500;
|
|
746
|
+
letter-spacing: var(--cm-tracking-caps); text-transform: uppercase;
|
|
747
|
+
}
|
|
748
|
+
.list { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
749
|
+
`];b("cm-smart-tips",_t);var pe,Lt,yo,$o,Tt=class extends u{constructor(){super(...arguments);p(this,Lt);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.label="Pagination";this.resourceName="";this._draft=null;p(this,pe,w("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)),a=this.total?(t-1)*this.pageSize+1:0,n=Math.min(this.total,t*this.pageSize),d=x=>x.toLocaleString(),h=this.pageSizes??[],g=this.resourceName?` ${this.resourceName}`:"";return r`
|
|
750
|
+
<nav part="bar" aria-label=${this.label}>
|
|
751
|
+
${h.length?r`<div class="rows" part="rows">
|
|
752
|
+
<label for="${s(this,pe)}-s">Number of rows</label>
|
|
753
|
+
<span class="field"><select id="${s(this,pe)}-s" @change=${c(this,Lt,yo)}>
|
|
754
|
+
${(h.includes(this.pageSize)?h:[...h,this.pageSize].sort((x,$)=>x-$)).map(x=>r`<option value=${x} ?selected=${x===this.pageSize}>${x}</option>`)}
|
|
755
|
+
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
756
|
+
</div>`:l}
|
|
757
|
+
<div class="summary" part="summary" role="status">${this.total?`Showing ${d(a)}\u2013${d(n)} of ${d(this.total)}${g}`:l}</div>
|
|
758
|
+
<div class="pages" part="pages">
|
|
759
|
+
<span class="counter">
|
|
760
|
+
<label for="${s(this,pe)}-p">Page</label>
|
|
761
|
+
<input id="${s(this,pe)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
762
|
+
.value=${this._draft??String(t)} aria-describedby="${s(this,pe)}-of"
|
|
763
|
+
@input=${x=>this._draft=x.target.value}
|
|
764
|
+
@keydown=${c(this,Lt,$o)}
|
|
765
|
+
@change=${x=>this.goTo(Number(x.target.value))} />
|
|
766
|
+
<span id="${s(this,pe)}-of">of ${d(e)}</span>
|
|
767
|
+
</span>
|
|
768
|
+
<span class="arrows">
|
|
769
|
+
<button class="prev" type="button" part="previous" aria-label="Previous page" ?disabled=${t<=1}
|
|
770
|
+
@click=${()=>this.goTo(t-1)}><cm-icon name="chevron-left" size="12"></cm-icon></button>
|
|
771
|
+
<button class="next" type="button" part="next" aria-label="Next page" ?disabled=${t>=e}
|
|
772
|
+
@click=${()=>this.goTo(t+1)}><cm-icon name="chevron-right" size="12"></cm-icon></button>
|
|
773
|
+
</span>
|
|
774
|
+
</div>
|
|
775
|
+
</nav>
|
|
776
|
+
`}};pe=new WeakMap,Lt=new WeakSet,yo=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})))},$o=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))},Tt.properties={page:{type:Number,reflect:!0},total:{type:Number},pageSize:{type:Number,attribute:"page-size"},pageSizes:{type:Array,attribute:"page-sizes"},label:{},resourceName:{attribute:"resource-name"},_draft:{state:!0}},Tt.styles=[f,m`
|
|
777
|
+
:host { display: block; }
|
|
778
|
+
nav {
|
|
779
|
+
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 60px; padding: 0 var(--cm-space-20);
|
|
780
|
+
background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); font-size: 14px;
|
|
781
|
+
}
|
|
782
|
+
.rows, .pages, .counter { display: flex; align-items: center; gap: var(--cm-space-10); white-space: nowrap; }
|
|
783
|
+
.summary { flex: 1; text-align: center; white-space: nowrap; }
|
|
784
|
+
.field { position: relative; display: inline-flex; }
|
|
785
|
+
select, input {
|
|
786
|
+
height: 34px; font: inherit; font-weight: 500; color: var(--cm-text-default); background: var(--cm-bg-surface);
|
|
787
|
+
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
788
|
+
}
|
|
789
|
+
select { appearance: none; padding: 0 28px 0 10px; min-width: 56px; cursor: pointer; }
|
|
790
|
+
.field cm-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
|
|
791
|
+
input { width: 38px; padding: 0; text-align: center; -moz-appearance: textfield; }
|
|
792
|
+
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
|
|
793
|
+
select:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
794
|
+
.arrows { display: flex; gap: var(--cm-space-10); margin-left: var(--cm-space-10); }
|
|
795
|
+
button {
|
|
796
|
+
width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
|
|
797
|
+
color: var(--cm-icon-selected); background: var(--cm-bg-hover);
|
|
798
|
+
border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-sm);
|
|
799
|
+
}
|
|
800
|
+
button:hover:not(:disabled) { border-color: var(--cm-border-strong); }
|
|
801
|
+
button:disabled { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
802
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
803
|
+
@media (max-width: 640px) {
|
|
804
|
+
nav { min-height: 50px; padding: 0 var(--cm-space-10); justify-content: space-between; }
|
|
805
|
+
.rows, .summary { display: none; }
|
|
806
|
+
.pages { flex: 1; justify-content: space-between; }
|
|
807
|
+
.arrows { display: contents; }
|
|
808
|
+
.prev { order: -1; }
|
|
809
|
+
}
|
|
810
|
+
`];b("cm-pagination",Tt);var ia,X,cr,wo,dr,ko,At=class extends u{constructor(){super(...arguments);p(this,X);this.value="";this.tabs=[];this.controls="";this.size="large";this._slotted=[];p(this,ia,new MutationObserver(()=>c(this,X,cr).call(this)))}connectedCallback(){super.connectedCallback(),c(this,X,cr).call(this),s(this,ia).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),s(this,ia).disconnect()}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(){if(!("ariaControlsElements"in Element.prototype))return;let e=this.getRootNode(),t=this.controls?e.getElementById?.(this.controls):null;for(let a of this.renderRoot.querySelectorAll("button"))a.ariaControlsElements=t?[t]:null}render(){let e=this.items,t=c(this,X,wo).call(this,e);return r`
|
|
811
|
+
<div class="tabs" part="tabs" role="tablist" aria-label=${this.getAttribute("aria-label")||"Status"}>
|
|
812
|
+
${e.map((a,n)=>r`<button type="button" role="tab" part="tab" aria-selected=${n===t?"true":"false"}
|
|
813
|
+
tabindex=${n===t?"0":"-1"} ?disabled=${!!a.disabled}
|
|
814
|
+
@click=${()=>c(this,X,dr).call(this,n)} @keydown=${d=>c(this,X,ko).call(this,d,n)}>${a.label}${a.count!==void 0&&!Number.isNaN(a.count)?r` <span class="count">(</span> ${a.count.toLocaleString()} <span class="count">)</span>`:l}</button>`)}
|
|
815
|
+
</div>
|
|
816
|
+
<slot></slot>
|
|
817
|
+
`}};ia=new WeakMap,X=new WeakSet,cr=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let a=t.getAttribute("count");return{value:t.value,label:t.label||t.textContent.trim(),count:a===null||a===""?void 0:Number(a),disabled:t.disabled}}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"")},wo=function(e){let t=e.findIndex(a=>a.value===this.value&&!a.disabled);return t>=0?t:e.findIndex(a=>!a.disabled)},dr=function(e){let t=this.items[e];!t||t.disabled||(this.updateComplete.then(()=>{let a=this.renderRoot.querySelectorAll("button")[e];a?.focus(),a?.scrollIntoView?.({block:"nearest",inline:"nearest"})}),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},ko=function(e,t){let a=this.items.flatMap((h,g)=>h.disabled?[]:[g]),n=a.indexOf(t),d;if(e.key==="ArrowRight")d=a[(n+1)%a.length];else if(e.key==="ArrowLeft")d=a[(n-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&&c(this,X,dr).call(this,d)},At.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},_slotted:{state:!0}},At.styles=[f,m`
|
|
818
|
+
:host { display: block; }
|
|
819
|
+
.tabs {
|
|
820
|
+
display: flex; gap: 28px; overflow-x: auto; scrollbar-width: thin; padding: 2px 2px 0;
|
|
821
|
+
font-size: 18px; font-weight: 500; white-space: nowrap;
|
|
822
|
+
}
|
|
823
|
+
button {
|
|
824
|
+
position: relative; flex: none; padding: 0 0 12px; font: inherit; color: var(--cm-text-tertiary);
|
|
825
|
+
background: none; border: 0; cursor: pointer;
|
|
826
|
+
}
|
|
827
|
+
button::after {
|
|
828
|
+
content: ''; position: absolute; left: 0; right: 0; bottom: 4px; height: 2px; border-radius: 1px; background: transparent;
|
|
829
|
+
}
|
|
830
|
+
button:hover:not(:disabled) { color: var(--cm-text-default); }
|
|
831
|
+
button[aria-selected='true'] { color: var(--cm-text-default); }
|
|
832
|
+
button[aria-selected='true']::after { background: var(--cm-border-strong); }
|
|
833
|
+
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
|
|
834
|
+
button:disabled { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
835
|
+
.count { font-size: 0.89em; }
|
|
836
|
+
:host([size='small']) .tabs { gap: 18px; font-size: 14px; }
|
|
837
|
+
slot { display: none; }
|
|
838
|
+
@media (max-width: 640px) {
|
|
839
|
+
.tabs { gap: 18px; font-size: 14px; }
|
|
840
|
+
}
|
|
841
|
+
`];b("cm-status-tabs",At);var as,aa,he,pr,Eo,Mo,St=class extends u{constructor(){super(...arguments);p(this,he);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;p(this,as,w("cm-th"));p(this,aa,new MutationObserver(()=>c(this,he,pr).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),c(this,he,pr).call(this),s(this,aa).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),s(this,aa).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 r`
|
|
842
|
+
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":l}
|
|
843
|
+
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
844
|
+
${this.selectable?r`<span class="cell" role=${e?"columnheader":l}><span class="check">
|
|
845
|
+
<input id="${s(this,as)}-all" type="checkbox" aria-label="Select all" .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
846
|
+
@change=${c(this,he,Mo)} />
|
|
847
|
+
<span class="box" aria-hidden="true">${this.indeterminate?r`<span class="dash"></span>`:this.checked?r`<cm-icon name="check" size="14"></cm-icon>`:l}</span>
|
|
848
|
+
</span></span>`:l}
|
|
849
|
+
${t.map(a=>{let n=this.sort===a.key,d=n?this.direction==="descending"?"descending":"ascending":"none",h=a.hidden?r`<span class="sr">${a.label}</span>`:a.label;return r`<span class="cell" part="cell" data-align=${a.align??"start"} role=${e?"columnheader":l}
|
|
850
|
+
aria-sort=${e&&a.sortable?d:l}>${a.sortable?r`<button type="button" class=${n?"on":""} @click=${()=>c(this,he,Eo).call(this,a)}>${h}${e?l:r`<span class="sr">${n?`, sorted ${d}`:", sortable"}</span>`}<cm-icon
|
|
851
|
+
name=${n&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:h}</span>`})}
|
|
852
|
+
</div>
|
|
853
|
+
<slot></slot>
|
|
854
|
+
`}};as=new WeakMap,aa=new WeakMap,he=new WeakSet,pr=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"}})},Eo=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}))},Mo=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}))},St.properties={columns:{type:Array},sort:{reflect:!0},direction:{reflect:!0},selectable:{type:Boolean,reflect:!0},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean,reflect:!0},_slotted:{state:!0},_inTable:{state:!0}},St.styles=[f,m`
|
|
855
|
+
:host { display: block; }
|
|
856
|
+
slot { display: none; } /* <option> children are column data, not content */
|
|
857
|
+
.bar {
|
|
858
|
+
display: grid; grid-template-columns: var(--cm-table-columns, var(--_cols)); align-items: center; column-gap: var(--cm-space-20);
|
|
859
|
+
min-height: 34px; padding: 0 var(--cm-space-20); font-size: 12px; line-height: 1.5; color: var(--cm-text-default);
|
|
860
|
+
background: var(--cm-bg-hover); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
861
|
+
border-radius: var(--cm-radius-md) var(--cm-radius-md) 0 0;
|
|
862
|
+
}
|
|
863
|
+
.bar.sel { grid-template-columns: 20px var(--cm-table-columns, var(--_cols)); padding-left: var(--cm-space-10); }
|
|
864
|
+
.cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
865
|
+
.cell[data-align='center'] { text-align: center; }
|
|
866
|
+
.cell[data-align='end'] { text-align: end; }
|
|
867
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
868
|
+
button {
|
|
869
|
+
display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 0; font: inherit; color: inherit;
|
|
870
|
+
background: none; border: 0; cursor: pointer;
|
|
871
|
+
}
|
|
872
|
+
button cm-icon { color: var(--cm-icon-selected); opacity: 0; }
|
|
873
|
+
button:hover cm-icon, button.on cm-icon { opacity: 1; }
|
|
874
|
+
button:focus-visible, input:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
875
|
+
.check { display: inline-flex; position: relative; width: 20px; height: 20px; }
|
|
876
|
+
input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
|
|
877
|
+
.box {
|
|
878
|
+
width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; pointer-events: none;
|
|
879
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-xs); background: var(--cm-bg-surface);
|
|
880
|
+
}
|
|
881
|
+
.dash { width: 10px; height: 2px; background: var(--cm-icon-selected); }
|
|
882
|
+
input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
883
|
+
slot { display: none; }
|
|
884
|
+
`];b("cm-table-header",St);var zo=!1,An=`
|
|
885
|
+
cm-data-table > table { width: 100%; border-collapse: separate; border-spacing: 0; font: inherit; font-size: 14px; line-height: 1.5; color: var(--cm-text-default); }
|
|
886
|
+
cm-data-table > table caption { text-align: start; font-weight: 500; font-size: 16px; padding-block-end: var(--cm-space-10); }
|
|
887
|
+
cm-data-table > table th { font-size: 12px; font-weight: 400; text-align: start; padding: 7px var(--cm-space-20); background: var(--cm-bg-hover); border-block: var(--cm-border-1) solid var(--cm-border-subtle); white-space: nowrap; }
|
|
888
|
+
cm-data-table > table th:first-child { border-inline-start: var(--cm-border-1) solid var(--cm-border-subtle); border-start-start-radius: var(--cm-radius-md); }
|
|
889
|
+
cm-data-table > table th:last-child { border-inline-end: var(--cm-border-1) solid var(--cm-border-subtle); border-start-end-radius: var(--cm-radius-md); }
|
|
890
|
+
cm-data-table > table td { padding: var(--cm-space-10) var(--cm-space-20); border-block-end: var(--cm-border-1) solid var(--cm-border-default); vertical-align: middle; }
|
|
891
|
+
cm-data-table > table tfoot td, cm-data-table > table tfoot th { font-weight: 500; background: var(--cm-bg-surface); border-block: var(--cm-border-1) solid var(--cm-border-default); font-size: 14px; }
|
|
892
|
+
cm-data-table > table tbody tr:hover td, cm-data-table > table tbody tr:hover th { background: var(--cm-bg-hover); }
|
|
893
|
+
cm-data-table > table th > button.cm-sort { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
|
|
894
|
+
cm-data-table > table th[data-type='numeric'] > button.cm-sort, cm-data-table > table th[data-type='money'] > button.cm-sort { flex-direction: row-reverse; }
|
|
895
|
+
cm-data-table > table th > button.cm-sort cm-icon { color: var(--cm-icon-selected); opacity: 0; }
|
|
896
|
+
cm-data-table > table th > button.cm-sort:hover cm-icon, cm-data-table > table th[aria-sort='ascending'] cm-icon, cm-data-table > table th[aria-sort='descending'] cm-icon { opacity: 1; }
|
|
897
|
+
cm-data-table > table th > button.cm-sort:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
898
|
+
@media (forced-colors: active) { cm-data-table > table th > button.cm-sort cm-icon { opacity: 1; } }
|
|
899
|
+
cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-data-table > table [data-type='money'] { text-align: end; font-variant-numeric: tabular-nums; }
|
|
900
|
+
`;function Sn(){if(zo||typeof document>"u")return;zo=!0;let o=new CSSStyleSheet;o.replaceSync(An),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var Cn=o=>(o.align??(o.type==="numeric"||o.type==="money"?"end":"start"))==="end";function _o(o){if(typeof o=="number")return o;let i=String(o??"").trim(),e=/^\(.*\)$/.test(i)||/^-|^[^\d]*-\s*\d/.test(i),t=i.match(/\d[\d,]*(?:\.\d+)?/);if(!t)return NaN;let a=Number(t[0].replace(/,/g,""));return e?-a:a}var To=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),Nn=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function Lo(o,i,e){let t=a=>a==null||a==="";return t(o)||t(i)?t(o)===t(i)?0:t(o)?1:-1:e==="numeric"||e==="money"?(_o(o)||0)-(_o(i)||0):e==="date"?(To(o)||0)-(To(i)||0):Nn.compare(String(o),String(i))}var Ht,sa,M,hr,mr,Ao,ur,So,Co,ss,Ct,Nt=class extends u{constructor(){super(...arguments);p(this,M);this.columns=[];this.rows=[];this.totals=null;this.caption="";this.captionHidden=!1;this.sort="";this.direction="ascending";this.sortMode="auto";this.stickyHeader=!1;this.stickyFirstColumn=!1;this.loading=!1;this.loadingRows=5;this._light=!1;this._announce="";p(this,Ht,!1);p(this,sa,new MutationObserver(()=>c(this,M,hr).call(this)))}connectedCallback(){super.connectedCallback(),c(this,M,hr).call(this),s(this,sa).observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),s(this,sa).disconnect()}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(n=>n.key===this.sort);if(!t||this.sortMode==="manual")return e;let a=this.direction==="descending"?-1:1;return e.map((n,d)=>[n,d]).sort(([n,d],[h,g])=>{let x=n[t.key],$=h[t.key],y=x==null||x==="",C=$==null||$==="";return y||C?y===C?d-g:y?1:-1:a*Lo(x,$,t.type)||d-g}).map(([n])=>n)}updated(e){if(s(this,Ht)&&(e.has("sort")||e.has("direction"))&&this.sort){v(this,Ht,!1);let t=this.columns.find(a=>a.key===this.sort);t&&c(this,M,mr).call(this,t.label,this.direction)}}render(){let e=r`<span class="sr" role="status">${this._announce}</span>`;if(this._light)return r`<div class="scroll" part="scroll"><slot></slot></div>${e}`;let t=this.columns??[],a=this.sortedRows,n=Math.max(1,t.length),d=!this.loading&&a.length===0;return r`
|
|
901
|
+
<div class="scroll" part="scroll" tabindex=${this.stickyHeader||this.stickyFirstColumn?"0":l}
|
|
902
|
+
role=${this.stickyHeader||this.stickyFirstColumn?"region":l}
|
|
903
|
+
aria-label=${(this.stickyHeader||this.stickyFirstColumn)&&this.caption?this.caption:l}>
|
|
904
|
+
<table part="table" aria-busy=${this.loading?"true":"false"}>
|
|
905
|
+
${this.caption?r`<caption part="caption">${this.caption}</caption>`:l}
|
|
906
|
+
<thead><tr>${t.map(h=>{let g=this.sort===h.key,x=g?this.direction:"none",$=h.hidden?r`<span class="sr">${h.label}</span>`:h.label;return r`<th scope="col" class=${c(this,M,Ct).call(this,h)} aria-sort=${h.sortable?x:l}>${h.sortable?r`<button type="button" class=${g?"on":""} @click=${()=>c(this,M,Co).call(this,h)}>${$}<cm-icon
|
|
907
|
+
name=${g&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:$}</th>`})}</tr></thead>
|
|
908
|
+
<tbody>
|
|
909
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>r`<tr>${t.map(h=>r`<td class=${c(this,M,Ct).call(this,h)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):a.map(h=>r`<tr part="row">${t.map((g,x)=>x===0?r`<th scope="row" class=${c(this,M,Ct).call(this,g)} part="cell">${c(this,M,ss).call(this,h[g.key])}</th>`:r`<td class=${c(this,M,Ct).call(this,g)} part="cell">${c(this,M,ss).call(this,h[g.key])}</td>`)}</tr>`)}
|
|
910
|
+
${d?r`<tr class="empty"><td colspan=${n}><slot name="empty">No data</slot></td></tr>`:l}
|
|
911
|
+
</tbody>
|
|
912
|
+
${this.totals&&!this.loading&&!d?r`<tfoot><tr part="totals">${t.map(h=>r`<td class=${c(this,M,Ct).call(this,h)}>${c(this,M,ss).call(this,this.totals[h.key])}</td>`)}</tr></tfoot>`:l}
|
|
913
|
+
</table>
|
|
914
|
+
</div>${e}
|
|
915
|
+
`}};Ht=new WeakMap,sa=new WeakMap,M=new WeakSet,hr=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(Sn(),c(this,M,Ao).call(this))},mr=function(e,t){this._announce=`Sorted by ${e}, ${t}`},Ao=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;t&&[...t].forEach((a,n)=>{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 h=document.createElement("cm-icon");h.setAttribute("size","12"),d.append(h),a.append(d),a.hasAttribute("aria-sort")||a.setAttribute("aria-sort","none"),c(this,M,ur).call(this,a),d.addEventListener("click",()=>c(this,M,So).call(this,e,a,n))})},ur=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},So=function(e,t,a){let n=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),d=t.dataset.key||n,h=t.getAttribute("aria-sort")==="ascending"?"descending":"ascending",g=new CustomEvent("cm-sort",{detail:{key:d,direction:h},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(g)||this.sortMode==="manual")return;let x=t.dataset.sort,$=h==="descending"?-1:1;for(let y of e.tBodies){let C=L=>{let A=L.cells[a];return A?(A.dataset.value??A.textContent??"").trim():""},O=[...y.rows].map((L,A)=>[L,C(L),A]).sort(([,L,A],[,se,ve])=>L===""||se===""?L===se?A-ve:L===""?1:-1:$*Lo(L,se,x)||A-ve);y.append(...O.map(([L])=>L))}for(let y of e.tHead.rows[0].cells)y.dataset.sort&&(y.setAttribute("aria-sort",y===t?h:"none"),c(this,M,ur).call(this,y));c(this,M,mr).call(this,n,h)},Co=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",a=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),n=this.dispatchEvent(a);v(this,Ht,n),n&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},ss=function(e){return e==null?"":e instanceof Date?e.toLocaleDateString():String(e)},Ct=function(e){return`${Cn(e)?"end":""} ${e.type==="numeric"||e.type==="money"?"num":""}`},Nt.properties={columns:{type:Array},rows:{type:Array},totals:{type:Object},caption:{},captionHidden:{type:Boolean,attribute:"caption-hidden",reflect:!0},sort:{reflect:!0},direction:{reflect:!0},sortMode:{attribute:"sort-mode",reflect:!0},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0},stickyFirstColumn:{type:Boolean,attribute:"sticky-first-column",reflect:!0},loading:{type:Boolean,reflect:!0},loadingRows:{type:Number,attribute:"loading-rows"},_light:{state:!0},_announce:{state:!0}},Nt.styles=[f,m`
|
|
916
|
+
:host { display: block; font-size: 14px; line-height: 1.5; }
|
|
917
|
+
.scroll { overflow: auto; max-block-size: var(--cm-data-table-max-height, none); }
|
|
918
|
+
.scroll:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
919
|
+
table { inline-size: 100%; border-collapse: separate; border-spacing: 0; }
|
|
920
|
+
caption { text-align: start; font-weight: 500; font-size: 16px; padding-block-end: var(--cm-space-10); }
|
|
921
|
+
:host([caption-hidden]) caption {
|
|
922
|
+
position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
|
|
923
|
+
}
|
|
924
|
+
th, td { padding: var(--cm-space-10) var(--cm-space-20); text-align: start; vertical-align: middle; }
|
|
925
|
+
thead th {
|
|
926
|
+
font-size: 12px; font-weight: 400; padding-block: 7px; white-space: nowrap; color: var(--cm-text-default);
|
|
927
|
+
background: var(--cm-bg-hover); border-block: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
928
|
+
}
|
|
929
|
+
thead th:first-child { border-inline-start: var(--cm-border-1) solid var(--cm-border-subtle); border-start-start-radius: var(--cm-radius-md); }
|
|
930
|
+
thead th:last-child { border-inline-end: var(--cm-border-1) solid var(--cm-border-subtle); border-start-end-radius: var(--cm-radius-md); }
|
|
931
|
+
tbody td, tbody th { font-weight: 400; border-block-end: var(--cm-border-1) solid var(--cm-border-default); background: var(--cm-bg-surface); }
|
|
932
|
+
tbody tr:hover td, tbody tr:hover th { background: var(--cm-bg-hover); }
|
|
933
|
+
tfoot td { font-weight: 500; background: var(--cm-bg-surface); border-block-end: var(--cm-border-1) solid var(--cm-border-default); }
|
|
934
|
+
.end { text-align: end; }
|
|
935
|
+
.num { font-variant-numeric: tabular-nums; }
|
|
936
|
+
:host([sticky-header]) thead th { position: sticky; inset-block-start: 0; z-index: 2; }
|
|
937
|
+
:host([sticky-first-column]) tr > :first-child { position: sticky; inset-inline-start: 0; z-index: 1; }
|
|
938
|
+
:host([sticky-first-column]) thead th:first-child { z-index: 3; }
|
|
939
|
+
:host([sticky-first-column]) tfoot td:first-child { background: var(--cm-bg-surface); }
|
|
940
|
+
.sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
941
|
+
button {
|
|
942
|
+
display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; font: inherit; color: inherit;
|
|
943
|
+
background: none; border: 0; cursor: pointer; text-align: inherit;
|
|
944
|
+
}
|
|
945
|
+
.end button { flex-direction: row-reverse; }
|
|
946
|
+
button cm-icon { color: var(--cm-icon-selected); opacity: 0; }
|
|
947
|
+
button:hover cm-icon, button.on cm-icon { opacity: 1; }
|
|
948
|
+
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
949
|
+
.empty td { padding: var(--cm-space-20); border-block-end: 0; }
|
|
950
|
+
.light { display: contents; }
|
|
951
|
+
@media (forced-colors: active) { button cm-icon { opacity: 1; } }
|
|
952
|
+
`];b("cm-data-table",Nt);var It=class extends u{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1}render(){return null}toItem(){let e=(this.textContent??"").trim();return{label:e,value:this.value||e,icon:this.icon||void 0,href:this.href||void 0,disabled:this.disabled||void 0,critical:this.critical||void 0}}};It.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0}},It.styles=m`:host { display: none; }`;b("cm-menu-item",It);function ra(o){let i=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),a=n=>e.getAttribute(n)||void 0;i.push({label:t,value:a("value")??t,icon:a("icon"),href:a("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0})}else e.localName==="hr"&&i.push({divider:!0});return i}function rs(o,i){let e=new MutationObserver(i);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var oa,Bt,We,na,E,os,la,br,ns,ls,cs,ca,da,Rt,ds,No,Ho,Dt=class extends u{constructor(){super(...arguments);p(this,E);this.items=[];this.open=!1;this.label="Actions";this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this._slotted=[];this._active=-1;this._custom=!1;p(this,oa);p(this,Bt,w("cm-menu"));p(this,We,"");p(this,na,0);p(this,la,e=>{this.open&&!e.composedPath().includes(this)&&c(this,E,ls).call(this,!1)});p(this,ca,e=>{e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0))});p(this,da,()=>{this.open?this.hide():this.show()});p(this,ds,e=>{let t=c(this,E,ns).call(this),a=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),c(this,E,Rt).call(this,t[(a+1)%t.length]);break;case"ArrowUp":e.preventDefault(),c(this,E,Rt).call(this,t[(a-1+t.length)%t.length]);break;case"Home":e.preventDefault(),c(this,E,Rt).call(this,t[0]);break;case"End":e.preventDefault(),c(this,E,Rt).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 n=Date.now();v(this,We,(n-s(this,na)<600?s(this,We):"")+e.key.toLowerCase()),v(this,na,n);let d=this.menuItems,h=s(this,We).length>1?a:a+1,x=[...t.slice(Math.max(h,0)),...t.slice(0,Math.max(h,0))].find($=>(d[$].label??"").toLowerCase().startsWith(s(this,We)));x!==void 0&&c(this,E,Rt).call(this,x)}}})}connectedCallback(){super.connectedCallback(),c(this,E,os).call(this),v(this,oa,rs(this,()=>c(this,E,os).call(this))),document.addEventListener("pointerdown",s(this,la),!0)}disconnectedCallback(){super.disconnectedCallback(),s(this,oa)?.disconnect(),document.removeEventListener("pointerdown",s(this,la),!0)}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=c(this,E,ns).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,c(this,E,ls).call(this,!0),this.updateComplete.then(()=>c(this,E,cs).call(this))}hide(e=!1){c(this,E,ls).call(this,!1),e&&c(this,E,br).call(this)?.focus()}updated(e){if(this._custom){let t=c(this,E,br).call(this);if(t){let a=(n,d)=>{t.getAttribute(n)!==d&&t.setAttribute(n,d)};a("aria-haspopup","menu"),a("aria-expanded",String(this.open)),a("aria-controls",`${s(this,Bt)}-m`)}}if(e.has("open")&&this.open&&this._active<0){let t=c(this,E,ns).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>c(this,E,cs).call(this))}}render(){let e=this.menuItems,t=this.triggerLabel||this.label,a=this._custom?r`<slot name="trigger" @click=${s(this,da)} @keydown=${s(this,ca)} @slotchange=${()=>c(this,E,os).call(this)}></slot>`:r`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
953
|
+
aria-expanded=${String(this.open)} aria-controls="${s(this,Bt)}-m" aria-label=${this.iconOnly?t:l}
|
|
954
|
+
@click=${s(this,da)} @keydown=${s(this,ca)}>${this.iconOnly?r`<cm-icon name=${this.icon} size="18"></cm-icon>`:r`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return r`${a}
|
|
955
|
+
<div class="pop" part="menu" ?hidden=${!this.open}>
|
|
956
|
+
${this.heading?r`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?r`<span>${this.subheading}</span>`:l}</div>`:l}
|
|
957
|
+
<div role="menu" id="${s(this,Bt)}-m" aria-label=${this.heading||this.label} @keydown=${s(this,ds)}>
|
|
958
|
+
${e.map((n,d)=>c(this,E,Ho).call(this,n,d))}
|
|
959
|
+
</div>
|
|
960
|
+
</div>
|
|
961
|
+
<slot hidden></slot>`}};oa=new WeakMap,Bt=new WeakMap,We=new WeakMap,na=new WeakMap,E=new WeakSet,os=function(){this._slotted=ra(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},la=new WeakMap,br=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},ns=function(){return this.menuItems.map((e,t)=>!e.divider&&!e.disabled?t:-1).filter(e=>e>=0)},ls=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})))},cs=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},ca=new WeakMap,da=new WeakMap,Rt=function(e){this._active=e,this.updateComplete.then(()=>c(this,E,cs).call(this))},ds=new WeakMap,No=function(e,t){if(t.disabled){e.preventDefault();return}let a=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));a||e.preventDefault(),this.hide(!t.href||!a)},Ho=function(e,t){if(e.divider)return r`<div role="separator"></div>`;let a=`item${e.critical?" critical":""}${t===this._active?" active":""}`,n=r`${e.icon?r`<cm-icon name=${e.icon} size="16"></cm-icon>`:l}<span>${e.label}</span>`,d={over:()=>{e.disabled||(this._active=t)},click:h=>c(this,E,No).call(this,h,e)};return e.href&&!e.disabled?r`<a class=${a} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
962
|
+
@pointerenter=${d.over} @click=${d.click}>${n}</a>`:r`<button type="button" class=${a} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
963
|
+
aria-disabled=${e.disabled?"true":l} @pointerenter=${d.over} @click=${d.click}>${n}</button>`},Dt.properties={items:{type:Array},open:{type:Boolean,reflect:!0},label:{},triggerLabel:{attribute:"trigger-label"},iconOnly:{type:Boolean,attribute:"icon-only"},icon:{},align:{reflect:!0},heading:{},subheading:{},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},Dt.styles=[f,m`
|
|
964
|
+
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
965
|
+
.trigger {
|
|
966
|
+
display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 500;
|
|
967
|
+
color: var(--cm-text-default); background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
968
|
+
border-radius: var(--cm-radius-sm); cursor: pointer;
|
|
969
|
+
}
|
|
970
|
+
.trigger.icon { width: 36px; padding: 0; justify-content: center; border-color: transparent; background: none; }
|
|
971
|
+
.trigger:hover { background: var(--cm-bg-hover); }
|
|
972
|
+
.trigger:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
973
|
+
.pop {
|
|
974
|
+
position: absolute; z-index: 20; top: calc(100% + 4px); inset-inline-start: 0; min-width: 180px; max-width: min(320px, calc(100vw - 32px));
|
|
975
|
+
padding: 6px; text-align: start; background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default);
|
|
976
|
+
border-radius: var(--cm-radius-sm); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
977
|
+
}
|
|
978
|
+
:host([align='end']) .pop { inset-inline-start: auto; inset-inline-end: 0; }
|
|
979
|
+
.pop[hidden] { display: none; }
|
|
980
|
+
.head { padding: 4px 6px 8px; margin-bottom: 4px; border-bottom: var(--cm-border-1) solid var(--cm-border-default); overflow-wrap: anywhere; }
|
|
981
|
+
.head strong { display: block; font-size: 14px; font-weight: 500; }
|
|
982
|
+
.head span { display: block; font-size: 11px; color: var(--cm-text-tertiary); }
|
|
983
|
+
[role='menu'] { display: flex; flex-direction: column; outline: none; }
|
|
984
|
+
.item {
|
|
985
|
+
display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 5px 8px; font: inherit; font-size: 13px; line-height: 18px;
|
|
986
|
+
color: var(--cm-text-default); text-align: start; text-decoration: none; background: none; border: 0; border-radius: var(--cm-radius-xs);
|
|
987
|
+
cursor: pointer; outline: none;
|
|
988
|
+
}
|
|
989
|
+
.item.critical { color: var(--cm-text-critical); }
|
|
990
|
+
.item[aria-disabled='true'] { color: var(--cm-text-secondary); cursor: default; }
|
|
991
|
+
.item.active:not([aria-disabled='true']), .item:not([aria-disabled='true']):hover {
|
|
992
|
+
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
993
|
+
}
|
|
994
|
+
.item.active:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 1px; }
|
|
995
|
+
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-default); }
|
|
996
|
+
`];b("cm-action-menu",Dt);var Io=m`
|
|
997
|
+
.check { position: relative; display: inline-flex; flex: none; width: 20px; height: 20px; }
|
|
998
|
+
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
999
|
+
.check input:disabled { cursor: not-allowed; }
|
|
1000
|
+
.box {
|
|
1001
|
+
width: 100%; height: 100%; display: inline-flex; align-items: center; justify-content: center; pointer-events: none;
|
|
1002
|
+
color: var(--cm-icon-selected); background: var(--cm-bg-surface);
|
|
1003
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-xs);
|
|
1004
|
+
}
|
|
1005
|
+
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
1006
|
+
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1007
|
+
.check input:disabled + .box { border-color: var(--cm-border-default); background: var(--cm-bg-input-filled); }
|
|
1008
|
+
`,hs,ms,Ro,Ot=class extends u{constructor(){super();p(this,ms);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;p(this,hs,this.attachInternals());s(this,hs).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 r`
|
|
1009
|
+
${this.href&&!this.disabled?r`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:l}
|
|
1010
|
+
<div class="row" part="row" @click=${c(this,ms,Ro)}>
|
|
1011
|
+
${this.selectable?r`<span class="check" part="checkbox"><input type="checkbox" aria-label=${`Select ${this.name}`} .checked=${this.selected}
|
|
1012
|
+
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
1013
|
+
<span class="box" aria-hidden="true">${this.selected?r`<cm-icon name="check" size="14"></cm-icon>`:l}</span></span>`:l}
|
|
1014
|
+
<span class="media"><slot name="media"></slot></span>
|
|
1015
|
+
<div class="content" part="content"><slot></slot></div>
|
|
1016
|
+
<div class="actions" part="actions"><slot name="actions"></slot></div>
|
|
1017
|
+
</div>
|
|
1018
|
+
`}};hs=new WeakMap,ms=new WeakSet,Ro=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(a=>a instanceof HTMLElement&&a!==this&&a.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},Ot.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0}},Ot.styles=[f,Io,m`
|
|
1019
|
+
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-default); }
|
|
1020
|
+
:host(:last-child) { border-bottom: 0; }
|
|
1021
|
+
.row {
|
|
1022
|
+
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 70px; padding: var(--cm-space-20) var(--cm-space-10);
|
|
1023
|
+
font-size: 16px; line-height: 18px;
|
|
1024
|
+
}
|
|
1025
|
+
:host(:hover:not([disabled])) .row, :host([selected]) .row { background: var(--cm-bg-inset); }
|
|
1026
|
+
:host([selectable]:not([href]):not([disabled])) .row { cursor: pointer; }
|
|
1027
|
+
:host([disabled]) .row { color: var(--cm-text-tertiary); }
|
|
1028
|
+
.media { display: contents; }
|
|
1029
|
+
::slotted([slot='media']) {
|
|
1030
|
+
flex: none; width: 50px; height: 50px; object-fit: cover; border-radius: var(--cm-radius-sm); background: var(--cm-thumb-bg);
|
|
1031
|
+
}
|
|
1032
|
+
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 50px; background: none; }
|
|
1033
|
+
.content { flex: 1; min-width: 0; }
|
|
1034
|
+
a { position: absolute; inset: 0; z-index: 0; border-radius: var(--cm-radius-xs); }
|
|
1035
|
+
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; }
|
|
1036
|
+
.check, .actions { position: relative; z-index: 1; }
|
|
1037
|
+
.actions { display: flex; gap: var(--cm-space-10); }
|
|
1038
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1039
|
+
@media (max-width: 640px) {
|
|
1040
|
+
.row { gap: var(--cm-space-10); min-height: 64px; padding: 15px 0; font-size: 14px; }
|
|
1041
|
+
.check { width: 18px; height: 18px; }
|
|
1042
|
+
::slotted([slot='media']) { width: 34px; height: 34px; }
|
|
1043
|
+
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 34px; }
|
|
1044
|
+
}
|
|
1045
|
+
`];b("cm-resource-item",Ot);var pa,q,Do,qt,ps,us,Pt=class extends u{constructor(){super();p(this,q);this.selectable=!1;this.total=0;this.resourceName="item";this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this._count=0;this._rows=0;p(this,pa,w("cm-rl"));p(this,us,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,c(this,q,qt).call(this),c(this,q,ps).call(this))})}get items(){return[...this.querySelectorAll(":scope > cm-resource-item")]}get selected(){return this.items.filter(e=>e.selected).map(e=>e.value)}selectPage(e=!0){this.items.forEach(t=>{t.disabled||(t.selected=e)}),e||(this.allSelected=!1),c(this,q,qt).call(this),c(this,q,ps).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,c(this,q,qt).call(this),c(this,q,ps).call(this)}clearSelection(){this.selectPage(!1)}updated(e){e.has("selectable")&&c(this,q,qt).call(this)}render(){let e=this._count,t=this._rows,a=this.items.filter(y=>!y.disabled).length,n=a>0&&e>=a,d=y=>y.toLocaleString(),h=c(this,q,Do).call(this),g=y=>y===1?this.resourceName:h,x=this.total>t,$=l;return this.allSelected?$=r`All ${d(Math.max(this.total,e))} ${h} selected. <button type="button" @click=${()=>this.clearSelection()}>Clear selection</button>`:e&&($=r`${d(e)} ${g(e)} selected.${n&&x?r` <button type="button" @click=${()=>this.selectAll()}>Select all ${d(this.total)} ${h}</button>`:l}`),r`
|
|
1046
|
+
${this.selectable?r`<div class="toolbar" part="toolbar">
|
|
1047
|
+
<span class="select" part="select">
|
|
1048
|
+
<span class="check"><input id="${s(this,pa)}-all" type="checkbox" .checked=${n} .indeterminate=${e>0&&!n}
|
|
1049
|
+
?disabled=${!a} @change=${y=>this.selectPage(y.target.checked)} />
|
|
1050
|
+
<span class="box" aria-hidden="true">${e>0&&!n?r`<span class="dash"></span>`:n?r`<cm-icon name="check" size="12"></cm-icon>`:l}</span></span>
|
|
1051
|
+
<label for="${s(this,pa)}-all">Select<span class="sr"> all ${d(t)} ${g(t)} on this page</span></label>
|
|
1052
|
+
${this.hideSelectMenu?l:r`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label="Selection options"
|
|
1053
|
+
.items=${[{label:`Select all ${d(a)} on this page`,value:"page",disabled:!a},...x?[{label:`Select all ${d(this.total)} ${h}`,value:"all"}]:[],{label:"Select none",value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${s(this,us)}></cm-action-menu>`}
|
|
1054
|
+
</span>
|
|
1055
|
+
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
1056
|
+
<span class="status" part="status" role="status">${$}</span>
|
|
1057
|
+
<span class="actions"><slot name="actions"></slot></span>
|
|
1058
|
+
</div>`:l}
|
|
1059
|
+
<div class="header"><slot name="header" @slotchange=${y=>y.target.parentElement.classList.toggle("has",y.target.assignedElements().length>0)}></slot></div>
|
|
1060
|
+
<div class="body">
|
|
1061
|
+
<div class="list" part="list" role="list" aria-label=${this.label||h.replace(/^./,y=>y.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
1062
|
+
<slot @slotchange=${()=>c(this,q,qt).call(this)}></slot>
|
|
1063
|
+
</div>
|
|
1064
|
+
${this.loading?r`<span class="spinner" part="spinner" role="progressbar" aria-label=${`Loading ${h}`}></span>`:l}
|
|
1065
|
+
</div>
|
|
1066
|
+
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
1067
|
+
`}};pa=new WeakMap,q=new WeakSet,Do=function(){return this.resourceNamePlural||`${this.resourceName}s`},qt=function(){let e=this.items;e.forEach(t=>t.selectable=this.selectable),this._rows=e.length,this._count=e.filter(t=>t.selected).length},ps=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},us=new WeakMap,Pt.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},_count:{state:!0},_rows:{state:!0}},Pt.styles=[f,Io,m`
|
|
1068
|
+
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
1069
|
+
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-20); padding: var(--cm-space-20) var(--cm-space-20) 0; }
|
|
1070
|
+
.select {
|
|
1071
|
+
display: inline-flex; align-items: center; gap: var(--cm-space-10); height: 40px; padding: 0 var(--cm-space-10);
|
|
1072
|
+
font-size: 14px; background: var(--cm-bg-inset); border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-sm);
|
|
1073
|
+
}
|
|
1074
|
+
.select .check { width: 16px; height: 16px; }
|
|
1075
|
+
.select label { cursor: pointer; }
|
|
1076
|
+
.select cm-action-menu { margin-inline-start: -6px; }
|
|
1077
|
+
.select cm-action-menu::part(trigger) { width: 28px; min-height: 28px; }
|
|
1078
|
+
.bulk { display: flex; gap: var(--cm-space-10); }
|
|
1079
|
+
.bulk[hidden] { display: none; }
|
|
1080
|
+
.status { flex: 1; text-align: center; font-size: 16px; }
|
|
1081
|
+
.status button { font: inherit; font-weight: 500; color: inherit; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }
|
|
1082
|
+
.status button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1083
|
+
.actions { display: flex; gap: var(--cm-space-10); margin-left: auto; }
|
|
1084
|
+
.header { display: block; padding: var(--cm-space-20) var(--cm-space-20) 0; }
|
|
1085
|
+
.header:not(.has) { display: none; }
|
|
1086
|
+
.body { position: relative; }
|
|
1087
|
+
.list { padding: 0 var(--cm-space-20) var(--cm-space-10); }
|
|
1088
|
+
:host([loading]) .list ::slotted(*) { opacity: 0.4; }
|
|
1089
|
+
.spinner {
|
|
1090
|
+
position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%;
|
|
1091
|
+
border: 4px solid var(--cm-thumb-bg); border-top-color: var(--cm-icon-selected); animation: spin 0.8s linear infinite;
|
|
1092
|
+
}
|
|
1093
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
1094
|
+
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
|
|
1095
|
+
.empty:not(.show) { display: none; }
|
|
1096
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1097
|
+
@media (max-width: 640px) {
|
|
1098
|
+
.toolbar { gap: var(--cm-space-10); padding: var(--cm-space-10) var(--cm-space-10) 0; }
|
|
1099
|
+
.select { height: 32px; font-size: 12px; }
|
|
1100
|
+
.status { flex-basis: 100%; order: 3; text-align: left; font-size: 12px; }
|
|
1101
|
+
.header { padding: var(--cm-space-10) var(--cm-space-10) 0; }
|
|
1102
|
+
.list { padding: 0 var(--cm-space-10); }
|
|
1103
|
+
.spinner { width: 30px; height: 30px; margin: -15px; border-width: 3px; }
|
|
1104
|
+
}
|
|
1105
|
+
`];b("cm-resource-list",Pt);var fs,j,Bo,qo,Oo,fr,Po,me=class me extends u{constructor(){super();p(this,j);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;p(this,fs,this.attachInternals());s(this,fs).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,a=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===a)return!1;let n=new CustomEvent("cm-reorder",{detail:{item:this,from:a,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(n))return!1;let d=t[e];return d.parentElement.insertBefore(this,e>a?d.nextSibling:d),this.closest("cm-nested-list")?.announce(`${this.label} moved to position ${e+1} of ${t.length}.`),!0}render(){return r`
|
|
1106
|
+
<div class="row" part="row" @dragover=${c(this,j,Oo)} @dragleave=${c(this,j,fr)} @drop=${c(this,j,Po)}>
|
|
1107
|
+
${this.sortable?r`<button class="handle" type="button" part="handle" draggable="true" aria-label=${`Reorder ${this.label}`}
|
|
1108
|
+
aria-describedby="hint"
|
|
1109
|
+
@keydown=${c(this,j,Bo)} @dragstart=${c(this,j,qo)}
|
|
1110
|
+
@dragend=${()=>{this.classList.remove("dragging"),me.dragged=null}}><cm-icon name="drag" size="18"></cm-icon></button>`:l}
|
|
1111
|
+
${this.sortable?r`<span class="sr" id="hint">Press up or down arrow to move.</span>`:l}
|
|
1112
|
+
<span class="label" part="label">${this.label}</span>
|
|
1113
|
+
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
1114
|
+
</div>
|
|
1115
|
+
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
1116
|
+
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(a=>a.localName==="cm-nested-item");t.forEach(a=>a.sortable=this.sortable),this._hasChildren=t.length>0}}></slot>
|
|
1117
|
+
</div>
|
|
1118
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};fs=new WeakMap,j=new WeakSet,Bo=function(e){let t=this.siblings.indexOf(this),a;if(e.key==="ArrowUp")a=t-1;else if(e.key==="ArrowDown")a=t+1;else if(e.key==="Home")a=0;else if(e.key==="End")a=this.siblings.length-1;else return;if(e.preventDefault(),this.moveTo(a)){let n=()=>this.renderRoot.querySelector(".handle")?.focus();n(),requestAnimationFrame(n)}},qo=function(e){e.stopPropagation(),me.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},Oo=function(e){let t=me.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let a=this.renderRoot.querySelector(".row").getBoundingClientRect(),n=e.clientY>a.top+a.height/2;this.classList.toggle("drop-after",n),this.classList.toggle("drop-before",!n)},fr=function(){this.classList.remove("drop-before","drop-after")},Po=function(e){let t=me.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let a=this.classList.contains("drop-after");c(this,j,fr).call(this);let n=this.siblings,d=n.indexOf(t),h=n.indexOf(this)+(a?1:0);h>d&&(h-=1),t.moveTo(h)},me.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},me.styles=[f,m`
|
|
1119
|
+
:host { display: block; }
|
|
1120
|
+
.row {
|
|
1121
|
+
display: flex; align-items: center; gap: var(--cm-space-15); min-height: 60px; padding: 0 var(--cm-space-20);
|
|
1122
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md);
|
|
1123
|
+
font-size: 16px; font-weight: 500;
|
|
1124
|
+
}
|
|
1125
|
+
:host(.dragging) .row { opacity: 0.5; }
|
|
1126
|
+
:host(.drop-before) .row { box-shadow: 0 -3px 0 var(--cm-border-strong); }
|
|
1127
|
+
:host(.drop-after) .row { box-shadow: 0 3px 0 var(--cm-border-strong); }
|
|
1128
|
+
.label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1129
|
+
.actions { display: flex; align-items: center; gap: var(--cm-space-15); }
|
|
1130
|
+
.handle {
|
|
1131
|
+
display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 34px; margin-left: -6px; padding: 0;
|
|
1132
|
+
color: var(--cm-icon-selected); background: none; border: 0; border-radius: var(--cm-radius-xs); cursor: grab;
|
|
1133
|
+
}
|
|
1134
|
+
.handle:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1135
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1136
|
+
.children { margin: var(--cm-space-10) 0 0 50px; display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
1137
|
+
.children:not(.has) { display: none; }
|
|
1138
|
+
@media (max-width: 640px) {
|
|
1139
|
+
.row { min-height: 50px; padding: 0 var(--cm-space-10); gap: var(--cm-space-10); font-size: 14px; }
|
|
1140
|
+
.actions { gap: var(--cm-space-10); }
|
|
1141
|
+
.children { margin-left: var(--cm-space-20); }
|
|
1142
|
+
}
|
|
1143
|
+
`],me.dragged=null;var bs=me;b("cm-nested-item",bs);var Ye,Xe,jo,gr,jt=class extends u{constructor(){super(...arguments);p(this,Xe);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this._msg="";p(this,Ye,w("cm-nl"))}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}updated(e){e.has("sortable")&&c(this,Xe,gr).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return r`
|
|
1144
|
+
<div class="bar" part="bar">
|
|
1145
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${s(this,Ye)}-h">${this.heading}</div>
|
|
1146
|
+
<span class="actions"><slot name="actions"></slot></span>
|
|
1147
|
+
${this.collapsible?r`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${s(this,Ye)}-rows"
|
|
1148
|
+
aria-label=${`${t?"Hide":"Show"} ${this.heading}`} @click=${c(this,Xe,jo)}>
|
|
1149
|
+
<cm-icon name=${t?"chevron-up":"chevron-down"} size="14"></cm-icon></button>`:l}
|
|
1150
|
+
</div>
|
|
1151
|
+
<div class="rows" id="${s(this,Ye)}-rows" role="list" aria-labelledby="${s(this,Ye)}-h" ?hidden=${!t}>
|
|
1152
|
+
<slot @slotchange=${()=>c(this,Xe,gr).call(this)}></slot>
|
|
1153
|
+
</div>
|
|
1154
|
+
<span class="sr" role="status">${this._msg}</span>
|
|
1155
|
+
`}};Ye=new WeakMap,Xe=new WeakSet,jo=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},gr=function(){[...this.children].forEach(e=>{e.localName==="cm-nested-item"&&(e.sortable=this.sortable)})},jt.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"},sortable:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},_msg:{state:!0}},jt.styles=[f,m`
|
|
1156
|
+
:host { display: block; }
|
|
1157
|
+
.bar {
|
|
1158
|
+
display: flex; align-items: center; gap: var(--cm-space-15); min-height: 90px; padding: 0 var(--cm-space-20);
|
|
1159
|
+
background: var(--cm-bg-page); border-radius: var(--cm-radius-md);
|
|
1160
|
+
}
|
|
1161
|
+
.title { flex: 1; min-width: 0; margin: 0; font-size: 26px; font-weight: 500; line-height: 1.3; }
|
|
1162
|
+
.actions { display: flex; align-items: center; gap: var(--cm-space-15); }
|
|
1163
|
+
.toggle {
|
|
1164
|
+
display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; flex: none;
|
|
1165
|
+
color: var(--cm-action-primary-text); background: var(--cm-action-primary); border: 0; border-radius: var(--cm-radius-full); cursor: pointer;
|
|
1166
|
+
}
|
|
1167
|
+
.toggle:hover { background: var(--cm-action-primary-hover); }
|
|
1168
|
+
.toggle:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1169
|
+
.rows { display: flex; flex-direction: column; gap: var(--cm-space-10); margin: var(--cm-space-15) 0 0 50px; }
|
|
1170
|
+
.rows[hidden] { display: none; }
|
|
1171
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1172
|
+
@media (max-width: 640px) {
|
|
1173
|
+
.bar { min-height: 60px; padding: 0 var(--cm-space-10); gap: var(--cm-space-10); }
|
|
1174
|
+
.title { font-size: 18px; }
|
|
1175
|
+
.rows { margin-left: var(--cm-space-10); }
|
|
1176
|
+
.toggle { width: 30px; height: 30px; }
|
|
1177
|
+
}
|
|
1178
|
+
`];b("cm-nested-list",jt);var Ze=class extends u{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=r`
|
|
1179
|
+
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="58"></cm-icon></slot></span>
|
|
1180
|
+
<span class="label">${this.label}</span>
|
|
1181
|
+
${this.pinned?r`<span class="pin" part="pin"><cm-icon name="pin" size="18"></cm-icon><span class="sr">, pinned</span></span>`:l}
|
|
1182
|
+
`;return this.href?r`<a class="tile" part="tile" href=${this.href}>${e}</a>`:r`<button class="tile" part="tile" type="button">${e}</button>`}};Ze.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},Ze.shadowRootOptions={...u.shadowRootOptions,delegatesFocus:!0},Ze.styles=[f,m`
|
|
1183
|
+
:host { display: block; }
|
|
1184
|
+
.tile {
|
|
1185
|
+
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-20);
|
|
1186
|
+
width: 100%; height: 150px; padding: var(--cm-space-10); font: inherit; font-size: 14px; font-weight: 500; text-align: center;
|
|
1187
|
+
color: var(--cm-text-default); text-decoration: none; background: var(--cm-bg-surface); cursor: pointer;
|
|
1188
|
+
border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md);
|
|
1189
|
+
}
|
|
1190
|
+
.tile:hover { border-color: var(--cm-border-strong); }
|
|
1191
|
+
.tile:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1192
|
+
.icon { display: inline-flex; color: var(--cm-icon-selected); }
|
|
1193
|
+
::slotted([slot='icon']) { width: 58px; height: 58px; }
|
|
1194
|
+
.pin { position: absolute; top: 10px; right: 10px; color: var(--cm-icon-selected); }
|
|
1195
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1196
|
+
@media (max-width: 640px) {
|
|
1197
|
+
.tile { height: 118px; gap: var(--cm-space-10); font-size: 12px; }
|
|
1198
|
+
.icon cm-icon::part(svg) { width: 38px; height: 38px; }
|
|
1199
|
+
::slotted([slot='icon']) { width: 38px; height: 38px; }
|
|
1200
|
+
.pin { top: 8px; right: 8px; }
|
|
1201
|
+
}
|
|
1202
|
+
`];b("cm-report-tile",Ze);var Vt=class extends u{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 r`
|
|
1203
|
+
${this.heading?r`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:l}
|
|
1204
|
+
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":l}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
1205
|
+
`}};Vt.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},Vt.styles=[f,m`
|
|
1206
|
+
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
1207
|
+
.title { margin: 0 0 var(--cm-space-20); font-size: 16px; font-weight: 500; }
|
|
1208
|
+
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-15); }
|
|
1209
|
+
@media (min-width: 641px) { .grid { grid-template-columns: repeat(auto-fill, 146px); } }
|
|
1210
|
+
@media (max-width: 640px) {
|
|
1211
|
+
:host { padding: var(--cm-space-10); }
|
|
1212
|
+
.title { margin-bottom: var(--cm-space-10); font-size: 14px; }
|
|
1213
|
+
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-10); }
|
|
1214
|
+
}
|
|
1215
|
+
`];b("cm-report-tiles",Vt);var Ut=class extends u{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 Vo(this)}};Ut.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}},Ut.styles=m`:host { display: none !important; }`;b("cm-nav-item",Ut);function Vo(o){let i=a=>o.getAttribute(a),e={label:i("label")||""};i("icon")&&(e.icon=i("icon")),i("href")&&(e.href=i("href")),i("value")&&(e.value=i("value")),o.hasAttribute("current")&&(e.current=!0),i("badge")&&(e.badge=i("badge")),o.hasAttribute("expanded")&&(e.expanded=!0),o.hasAttribute("primary")&&(e.primary=!0);let t=ue(o);return t.length&&(e.items=t),e}var ue=o=>[...o.children].filter(i=>i.localName==="cm-nav-item").map(Vo),vr=o=>o.value||o.href||o.label,gs=o=>!!o.current||!!o.items?.some(gs),Te=(o,i)=>{let e=new MutationObserver(i);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","icon","href","value","current","badge","expanded","primary"]}),e},Le=(o,i)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:i,value:vr(i),href:i.href??""}}));var ha,ma,xs,_,xr,vs,yr,Uo,Fo,$r,wr,Ft=class extends u{constructor(){super(...arguments);p(this,_);this.items=[];this.label="Main";this._slotted=[];this._open=new Set;p(this,ha,new Set);p(this,ma);p(this,xs,w("cm-sidenav"))}connectedCallback(){super.connectedCallback(),c(this,_,xr).call(this),v(this,ma,Te(this,()=>c(this,_,xr).call(this)))}disconnectedCallback(){super.disconnectedCallback(),s(this,ma)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let a=c(this,_,vs).call(this,e,t);s(this,ha).has(a)||!e.items?.length||(s(this,ha).add(a),(e.expanded||gs(e))&&this._open.add(a))})}toggle(e,t){let a=this.navItems[e];if(!a?.items?.length)return;let n=c(this,_,vs).call(this,a,e),d=t??!this._open.has(n);if(d===this._open.has(n))return;let h=new Set(this._open);d?h.add(n):h.delete(n),this._open=h,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:a,expanded:d}}))}render(){return r`
|
|
1216
|
+
<nav part="nav" aria-label=${this.label||"Main"} @keydown=${c(this,_,Fo)}>
|
|
1217
|
+
<slot name="header"></slot>
|
|
1218
|
+
<ul part="list">
|
|
1219
|
+
${this.navItems.map((e,t)=>{if(!e.items?.length)return r`<li>${c(this,_,wr).call(this,e,"",{index:t})}</li>`;let a=this._open.has(c(this,_,vs).call(this,e,t)),n=`${s(this,xs)}-${t}`;return r`<li>
|
|
1220
|
+
<button type="button" class="item parent ${gs(e)?"has-current":""}" part="item" data-index=${t}
|
|
1221
|
+
aria-expanded=${a?"true":"false"} aria-controls=${n} @click=${()=>this.toggle(t)}>
|
|
1222
|
+
${e.icon?r`<cm-icon name=${e.icon} size="20"></cm-icon>`:l}<span class="label">${e.label}</span>${e.badge?r`<span class="badge">${e.badge}</span>`:l}
|
|
1223
|
+
<cm-icon class="chev" name="chevron-down" size="18"></cm-icon>
|
|
1224
|
+
</button>
|
|
1225
|
+
<ul class="sub" id=${n} ?hidden=${!a} aria-label=${e.label}>
|
|
1226
|
+
${c(this,_,$r).call(this,e.items).map(([d,h])=>r`<li>${c(this,_,wr).call(this,{...d,icon:void 0},h?"deep":"",{parent:t})}</li>`)}
|
|
1227
|
+
</ul>
|
|
1228
|
+
</li>`})}
|
|
1229
|
+
</ul>
|
|
1230
|
+
<slot name="footer"></slot>
|
|
1231
|
+
<slot hidden></slot>
|
|
1232
|
+
</nav>
|
|
1233
|
+
`}};ha=new WeakMap,ma=new WeakMap,xs=new WeakMap,_=new WeakSet,xr=function(){this._slotted=ue(this)},vs=function(e,t){return`${t}:${vr(e)}`},yr=function(e,t){Le(this,t)||e.preventDefault()},Uo=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},Fo=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let a=c(this,_,Uo).call(this),n=a.indexOf(t),d=Number(t.dataset.index),h;if(e.key==="ArrowDown")h=a[(n+1)%a.length];else if(e.key==="ArrowUp")h=a[(n-1+a.length)%a.length];else if(e.key==="Home")h=a[0];else if(e.key==="End")h=a[a.length-1];else if(e.key==="ArrowRight"&&t.classList.contains("parent")){this.toggle(d,!0),e.preventDefault();return}else if(e.key==="ArrowLeft"){if(t.classList.contains("parent")?this.toggle(d,!1):t.dataset.parent&&(h=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!h){e.preventDefault();return}}else return;e.preventDefault(),h?.focus()},$r=function(e,t=0){return e.flatMap(a=>[[a,t],...c(this,_,$r).call(this,a.items??[],t+1)])},wr=function(e,t,a={}){let n=r`${e.icon?r`<cm-icon name=${e.icon} size="20"></cm-icon>`:l}<span class="label">${e.label}</span>${e.badge?r`<span class="badge">${e.badge}</span>`:l}`;return e.href?r`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":l}
|
|
1234
|
+
data-index=${a.index??l} data-parent=${a.parent??l} @click=${d=>c(this,_,yr).call(this,d,e)}>${n}</a>`:r`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":l}
|
|
1235
|
+
data-index=${a.index??l} data-parent=${a.parent??l} @click=${d=>c(this,_,yr).call(this,d,e)}>${n}</button>`},Ft.properties={items:{type:Array},label:{},_slotted:{state:!0},_open:{state:!0}},Ft.styles=[f,m`
|
|
1236
|
+
:host { display: block; width: var(--cm-side-navigation-width, 250px); }
|
|
1237
|
+
nav {
|
|
1238
|
+
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: 16px;
|
|
1239
|
+
padding: 14px 0; font-size: 16px; line-height: 1.25;
|
|
1240
|
+
}
|
|
1241
|
+
ul { list-style: none; margin: 0; padding: 0; }
|
|
1242
|
+
.item {
|
|
1243
|
+
display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); min-height: 40px; margin: 0 8px; padding: 0 10px 0 12px;
|
|
1244
|
+
font: inherit; color: inherit; text-align: start; text-decoration: none; background: none; border: 0; border-radius: 8px; cursor: pointer;
|
|
1245
|
+
}
|
|
1246
|
+
.item:hover { color: var(--cm-text-on-dark); background: var(--cm-nav-active); }
|
|
1247
|
+
.item:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: -2px; color: var(--cm-text-on-dark); }
|
|
1248
|
+
.item[aria-current='page'] { color: var(--cm-text-on-dark); font-weight: 600; }
|
|
1249
|
+
.parent.has-current { color: var(--cm-text-on-dark); }
|
|
1250
|
+
.label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1251
|
+
.chev { transition: transform 0.15s; }
|
|
1252
|
+
[aria-expanded='true'] .chev { transform: rotate(180deg); }
|
|
1253
|
+
.badge {
|
|
1254
|
+
flex: none; padding: 1px 6px; border-radius: var(--cm-radius-full); font-size: 10px; font-weight: 500;
|
|
1255
|
+
letter-spacing: var(--cm-tracking-caps); text-transform: uppercase; color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
|
|
1256
|
+
}
|
|
1257
|
+
.sub { padding: 2px 0 6px; }
|
|
1258
|
+
.sub .item { min-height: 36px; padding-left: 40px; font-size: 14px; }
|
|
1259
|
+
.sub .item.deep { padding-left: 56px; }
|
|
1260
|
+
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
1261
|
+
`];b("cm-side-navigation",Ft);function Ko(o){let i=o.trim().split(/[\s._@-]+/).filter(Boolean);if(!i.length)return"";let e=[...i[0]][0]??"",t=i.length>1&&!/[.@]/.test(o)?[...i[i.length-1]][0]??"":"";return(e+t).toLocaleUpperCase()}var Kt=class extends u{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=Ko(this.name),t=this.decorative||!this.name?l:this.name,a=this.decorative||!this.name?"true":l,n,d="avatar";return this.src&&!this._failed?n=r`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?n=r`<span aria-hidden="true">${e}</span>`:(d+=" icon",n=r`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),r`<span class=${d} part="avatar" role=${t===l?l:"img"} aria-label=${t} aria-hidden=${a}>${n}</span>`}};Kt.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},Kt.styles=[f,m`
|
|
1262
|
+
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
1263
|
+
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
1264
|
+
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
1265
|
+
.avatar {
|
|
1266
|
+
display: grid; place-items: center; overflow: hidden; inline-size: var(--_size); block-size: var(--_size);
|
|
1267
|
+
border-radius: 50%; background: var(--cm-avatar-bg); color: var(--cm-text-default);
|
|
1268
|
+
font-size: calc(var(--_size) * 0.4); font-weight: 500; line-height: 1; user-select: none;
|
|
1269
|
+
}
|
|
1270
|
+
:host([shape='square']) .avatar { border-radius: var(--cm-radius-sm); }
|
|
1271
|
+
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
1272
|
+
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
1273
|
+
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
1274
|
+
`];b("cm-avatar",Kt);var Yt,ys,Wt=class extends u{constructor(){super(...arguments);p(this,Yt);this.store="";this.balance="";this.userName="";this.avatarSrc="";this.label="Admin"}render(){return r`
|
|
1275
|
+
<header part="bar" role="banner" aria-label=${this.label||l}>
|
|
1276
|
+
<div class="logo"><slot name="logo"></slot></div>
|
|
1277
|
+
${this.store?r`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${`Store: ${this.store}. Switch store`}
|
|
1278
|
+
@click=${()=>c(this,Yt,ys).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="20"></cm-icon></button>`:l}
|
|
1279
|
+
<span class="grow"></span>
|
|
1280
|
+
<div class="end">
|
|
1281
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
1282
|
+
${this.balance?r`<button type="button" class="pill" part="balance" aria-label=${`Wallet balance ${this.balance}`}
|
|
1283
|
+
@click=${()=>c(this,Yt,ys).call(this,"cm-wallet")}>${this.balance}</button>`:l}
|
|
1284
|
+
${this.userName?r`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${`Account: ${this.userName}`}
|
|
1285
|
+
@click=${()=>c(this,Yt,ys).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
1286
|
+
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:l}
|
|
1287
|
+
<slot name="end"></slot>
|
|
1288
|
+
</div>
|
|
1289
|
+
</header>
|
|
1290
|
+
`}};Yt=new WeakSet,ys=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Wt.properties={store:{},balance:{},userName:{attribute:"user-name"},avatarSrc:{attribute:"avatar-src"},label:{}},Wt.styles=[f,m`
|
|
1291
|
+
:host { display: block; background: var(--cm-bg-surface); container-type: inline-size; }
|
|
1292
|
+
header {
|
|
1293
|
+
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 70px; padding: 10px var(--cm-space-20) 10px 27px;
|
|
1294
|
+
}
|
|
1295
|
+
.logo { display: flex; align-items: center; flex: none; }
|
|
1296
|
+
::slotted([slot='logo']) { display: block; max-height: 24px; width: auto; }
|
|
1297
|
+
.store, .pill, .user {
|
|
1298
|
+
display: inline-flex; align-items: center; gap: 8px; font: inherit; color: var(--cm-text-default);
|
|
1299
|
+
background: none; cursor: pointer;
|
|
1300
|
+
}
|
|
1301
|
+
.store {
|
|
1302
|
+
margin-left: 60px; padding: 6px 8px; border: 0; border-radius: var(--cm-radius-sm); font-size: 18px; min-width: 0; flex: 0 1 auto;
|
|
1303
|
+
}
|
|
1304
|
+
.store span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1305
|
+
.store:hover { background: var(--cm-bg-hover); }
|
|
1306
|
+
.grow { flex: 1; }
|
|
1307
|
+
.end { display: flex; align-items: center; gap: var(--cm-space-20); flex: none; white-space: nowrap; }
|
|
1308
|
+
.actions { display: flex; align-items: center; gap: var(--cm-space-20); }
|
|
1309
|
+
.pill {
|
|
1310
|
+
min-height: 44px; padding: 0 var(--cm-space-20); font-size: 14px; font-weight: 500;
|
|
1311
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-sm);
|
|
1312
|
+
}
|
|
1313
|
+
.pill:hover, .user:hover { background: var(--cm-bg-hover); }
|
|
1314
|
+
.user {
|
|
1315
|
+
min-height: 50px; padding: 4px 6px 4px 20px; gap: var(--cm-space-20); font-size: 18px;
|
|
1316
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-full);
|
|
1317
|
+
}
|
|
1318
|
+
.avatar { --cm-avatar-size: 36px; }
|
|
1319
|
+
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1320
|
+
@container (max-width: 1300px) {
|
|
1321
|
+
.store { margin-left: var(--cm-space-20); }
|
|
1322
|
+
}
|
|
1323
|
+
@container (max-width: 1100px) {
|
|
1324
|
+
.store { font-size: 16px; }
|
|
1325
|
+
}
|
|
1326
|
+
@container (max-width: 900px) {
|
|
1327
|
+
.actions { display: none; }
|
|
1328
|
+
}
|
|
1329
|
+
@container (max-width: 640px) {
|
|
1330
|
+
header { min-height: 56px; gap: var(--cm-space-10); padding: 8px var(--cm-space-15); }
|
|
1331
|
+
.actions, .pill { display: none; }
|
|
1332
|
+
.store { margin-left: 0; font-size: 14px; }
|
|
1333
|
+
.user { padding: 2px; min-height: 0; border-color: transparent; }
|
|
1334
|
+
.user .name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1335
|
+
.avatar { --cm-avatar-size: 32px; }
|
|
1336
|
+
}
|
|
1337
|
+
`];b("cm-header-bar",Wt);var ua,Je,kr,Wo,Xt=class extends u{constructor(){super(...arguments);p(this,Je);this.items=[];this.label="Main";this.fixed=!1;this._slotted=[];p(this,ua)}connectedCallback(){super.connectedCallback(),c(this,Je,kr).call(this),v(this,ua,Te(this,()=>c(this,Je,kr).call(this)))}disconnectedCallback(){super.disconnectedCallback(),s(this,ua)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return r`<nav part="nav" aria-label=${this.label||"Main"}>
|
|
1338
|
+
<ul>${this.navItems.slice(0,5).map(e=>r`<li>${c(this,Je,Wo).call(this,e)}</li>`)}</ul>
|
|
1339
|
+
<slot hidden></slot>
|
|
1340
|
+
</nav>`}};ua=new WeakMap,Je=new WeakSet,kr=function(){this._slotted=ue(this)},Wo=function(e){let t=`item ${e.primary?"primary":""}`,a=r`<span class="icon">${e.icon?r`<cm-icon name=${e.icon} size=${e.primary?16:24}></cm-icon>`:l}</span><span class="label">${e.label}</span>`,n=d=>{Le(this,e)||d.preventDefault()};return e.href?r`<a class=${t} part="item" href=${e.href} aria-current=${e.current?"page":l} @click=${n}>${a}</a>`:r`<button type="button" class=${t} part="item" aria-current=${e.current?"page":l} @click=${n}>${a}</button>`},Xt.properties={items:{type:Array},label:{},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},Xt.styles=[f,m`
|
|
1341
|
+
:host { display: block; }
|
|
1342
|
+
:host([fixed]) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; }
|
|
1343
|
+
nav {
|
|
1344
|
+
background: var(--cm-bg-surface); border-radius: 16px 16px 0 0; box-shadow: var(--cm-shadow-100);
|
|
1345
|
+
padding: 10px 6px calc(8px + env(safe-area-inset-bottom, 0px));
|
|
1346
|
+
}
|
|
1347
|
+
ul { display: flex; list-style: none; margin: 0; padding: 0; }
|
|
1348
|
+
li { flex: 1; min-width: 0; display: flex; }
|
|
1349
|
+
.item {
|
|
1350
|
+
flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 48px; padding: 2px 2px 0;
|
|
1351
|
+
font: inherit; font-size: 10px; font-weight: 500; letter-spacing: var(--cm-tracking-caps); text-transform: uppercase;
|
|
1352
|
+
color: var(--cm-text-tertiary); text-decoration: none; background: none; border: 0; border-radius: var(--cm-radius-sm); cursor: pointer;
|
|
1353
|
+
}
|
|
1354
|
+
.item:hover, .item[aria-current='page'] { color: var(--cm-text-default); }
|
|
1355
|
+
.item[aria-current='page'] .icon { color: var(--cm-icon-selected); }
|
|
1356
|
+
.item:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
1357
|
+
.icon { display: grid; place-items: center; width: 26px; height: 26px; }
|
|
1358
|
+
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
1359
|
+
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1360
|
+
`];b("cm-bottom-navigation",Xt);var ba,Qe,R,Er,Yo,Mr,zr,Xo,Zt=class extends u{constructor(){super(...arguments);p(this,R);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this.label="Menu";this._slotted=[];this._page=null;p(this,ba);p(this,Qe,w("cm-mmenu"))}connectedCallback(){super.connectedCallback(),c(this,R,Er).call(this),v(this,ba,Te(this,()=>c(this,R,Er).call(this)))}disconnectedCallback(){super.disconnectedCallback(),s(this,ba)?.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?r`<nav part="nav" class="sub" aria-label=${this.label||"Menu"} id="${s(this,Qe)}-sub"
|
|
1361
|
+
@keydown=${a=>{a.key==="Escape"&&(a.preventDefault(),this.back())}}>
|
|
1362
|
+
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="18"></cm-icon>${t.label}</button>
|
|
1363
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(a=>r`<li>${c(this,R,zr).call(this,a,0,0,!0)}</li>`)}</ul>
|
|
1364
|
+
<slot hidden></slot>
|
|
1365
|
+
</nav>`:r`<nav part="nav" aria-label=${this.label||"Menu"}>
|
|
1366
|
+
${c(this,R,Xo).call(this)}
|
|
1367
|
+
${e.map((a,n)=>{let d=`${s(this,Qe)}-s${n}`;return r`<section aria-labelledby=${a.label?d:l}>
|
|
1368
|
+
${a.label?r`<h2 class="heading" id=${d}>${a.label}</h2>`:l}
|
|
1369
|
+
<ul class="card">${(a.items??[]).map((h,g)=>r`<li>${c(this,R,zr).call(this,h,n,g)}</li>`)}</ul>
|
|
1370
|
+
</section>`})}
|
|
1371
|
+
<slot hidden></slot>
|
|
1372
|
+
</nav>`}};ba=new WeakMap,Qe=new WeakMap,R=new WeakSet,Er=function(){this._slotted=ue(this)},Yo=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},Mr=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},zr=function(e,t,a,n=!1){let d=$=>{Le(this,e)||$.preventDefault()};if(e.primary&&!n)return r`<button type="button" class="row action" part="row" @click=${d}>${e.label}</button>`;let h=e.icon&&!n?r`<cm-icon class="icon" name=${e.icon} size="24"></cm-icon>`:l,g=e.badge?r`<span class="badge">${e.badge}</span>`:l;if(e.items?.length&&!n)return r`<button type="button" class="row" part="row" data-row="${t}-${a}"
|
|
1373
|
+
@click=${()=>c(this,R,Yo).call(this,t,a)}>${h}<span class="label">${e.label}</span>${g}<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let x=r`${h}<span class="label">${e.label}</span>${g}${e.href&&!n?r`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:l}`;return e.href?r`<a class="row" part="row" href=${e.href} aria-current=${e.current?"page":l} @click=${d}>${x}</a>`:r`<button type="button" class="row" part="row" aria-current=${e.current?"page":l} @click=${d}>${x}</button>`},Xo=function(){if(!this.store&&!this.userName)return l;let e=this.userName.trim().charAt(0).toUpperCase();return r`<section aria-labelledby="${s(this,Qe)}-profile">
|
|
1374
|
+
<h2 class="heading" id="${s(this,Qe)}-profile">Profile</h2>
|
|
1375
|
+
<ul class="card">
|
|
1376
|
+
${this.store?r`<li><button type="button" class="row" part="row" @click=${()=>c(this,R,Mr).call(this,"cm-store-switch")}>
|
|
1377
|
+
<span class="stack"><span class="eyebrow">Logged in to store</span><span>${this.store}</span></span>
|
|
1378
|
+
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:l}
|
|
1379
|
+
${this.userName?r`<li><button type="button" class="row" part="row" @click=${()=>c(this,R,Mr).call(this,"cm-account")}>
|
|
1380
|
+
<span class="avatar">${this.avatarSrc?r`<img src=${this.avatarSrc} alt="">`:r`<span aria-hidden="true">${e}</span>`}</span>
|
|
1381
|
+
<span class="stack"><span>${this.userName}</span>${this.userEmail?r`<span class="email">${this.userEmail}</span>`:l}</span>
|
|
1382
|
+
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:l}
|
|
1383
|
+
</ul>
|
|
1384
|
+
</section>`},Zt.properties={items:{type:Array},store:{},userName:{attribute:"user-name"},userEmail:{attribute:"user-email"},avatarSrc:{attribute:"avatar-src"},label:{},_slotted:{state:!0},_page:{state:!0}},Zt.styles=[f,m`
|
|
1385
|
+
:host { display: block; background: var(--cm-bg-page); }
|
|
1386
|
+
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
1387
|
+
.heading {
|
|
1388
|
+
margin: 0 0 8px; font-size: 12px; font-weight: 500; letter-spacing: var(--cm-tracking-caps); text-transform: uppercase;
|
|
1389
|
+
color: var(--cm-text-default);
|
|
1390
|
+
}
|
|
1391
|
+
.card { list-style: none; margin: 0; padding: 0 15px; background: var(--cm-bg-surface); border-radius: 12px; }
|
|
1392
|
+
.card > li + li { border-top: var(--cm-border-1) solid var(--cm-border-default); }
|
|
1393
|
+
.row {
|
|
1394
|
+
display: flex; align-items: center; gap: var(--cm-space-15); width: 100%; min-height: 51px; padding: 8px 4px 8px 6px;
|
|
1395
|
+
font: inherit; font-size: 18px; font-weight: 500; color: var(--cm-text-default); text-align: start; text-decoration: none;
|
|
1396
|
+
background: none; border: 0; cursor: pointer;
|
|
1397
|
+
}
|
|
1398
|
+
.row:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; border-radius: var(--cm-radius-sm); }
|
|
1399
|
+
.row .icon { color: var(--cm-icon-responsive-menu); }
|
|
1400
|
+
.label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1401
|
+
.chev { color: var(--cm-icon-selected); }
|
|
1402
|
+
.badge {
|
|
1403
|
+
flex: none; padding: 5px 10px; border-radius: var(--cm-radius-full); font-size: 10px; font-weight: 500;
|
|
1404
|
+
letter-spacing: var(--cm-tracking-caps); text-transform: uppercase; color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
|
|
1405
|
+
}
|
|
1406
|
+
.action { justify-content: center; min-height: 40px; font-size: 12px; letter-spacing: var(--cm-tracking-caps); text-transform: uppercase; }
|
|
1407
|
+
.eyebrow { display: block; font-size: 12px; letter-spacing: var(--cm-tracking-caps); text-transform: uppercase; color: var(--cm-text-tertiary); }
|
|
1408
|
+
.stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
|
|
1409
|
+
.email { font-size: 12px; font-weight: 400; }
|
|
1410
|
+
.avatar {
|
|
1411
|
+
display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
|
|
1412
|
+
font-size: 12px; background: var(--cm-avatar-bg); border: var(--cm-border-1) solid var(--cm-border-strong); color: var(--cm-text-default);
|
|
1413
|
+
}
|
|
1414
|
+
.avatar img { width: 100%; height: 100%; object-fit: cover; }
|
|
1415
|
+
.back {
|
|
1416
|
+
display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 4px; font: inherit; font-size: 16px; font-weight: 500;
|
|
1417
|
+
color: var(--cm-text-default); background: none; border: 0; cursor: pointer; border-radius: var(--cm-radius-sm);
|
|
1418
|
+
}
|
|
1419
|
+
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1420
|
+
.sub .row { font-size: 16px; min-height: 48px; }
|
|
1421
|
+
`];b("cm-mobile-menu",Zt);var $s,Zo,Jt=class extends u{constructor(){super(...arguments);p(this,$s);this.icon="send";this.dismissible=!1;this.label="Offer"}render(){return r`<div class="bar" part="bar" role="region" aria-label=${this.label||"Offer"}>
|
|
1422
|
+
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?r`<cm-icon name=${this.icon} size="20"></cm-icon>`:l}</slot></span>
|
|
1423
|
+
<span class="text"><slot></slot></span>
|
|
1424
|
+
${this.dismissible?r`<button type="button" class="close" part="close" aria-label="Dismiss offer" @click=${c(this,$s,Zo)}><cm-icon name="close" size="18"></cm-icon></button>`:l}
|
|
1425
|
+
</div>`}};$s=new WeakSet,Zo=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},Jt.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{}},Jt.styles=[f,m`
|
|
1426
|
+
:host { display: block; }
|
|
1427
|
+
.bar {
|
|
1428
|
+
position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px;
|
|
1429
|
+
padding: 10px var(--cm-space-20); background: var(--cm-bg-flash-bar); color: var(--cm-text-on-dark);
|
|
1430
|
+
font-size: 18px; text-align: center;
|
|
1431
|
+
}
|
|
1432
|
+
:host([dismissible]) .bar { padding-inline: 56px; }
|
|
1433
|
+
.icon { display: inline-flex; color: var(--cm-text-speciality-on-dark); flex: none; }
|
|
1434
|
+
/* !important: page link colours (usually blue) would otherwise win over ::slotted and fail contrast on the dark bar. */
|
|
1435
|
+
::slotted(a) { color: var(--cm-text-speciality-on-dark) !important; font-weight: 500; text-decoration: none; }
|
|
1436
|
+
::slotted(a:hover) { text-decoration: underline; }
|
|
1437
|
+
::slotted(a:focus-visible) { outline: 2px solid var(--cm-text-on-dark); outline-offset: 2px; border-radius: 2px; }
|
|
1438
|
+
.close {
|
|
1439
|
+
position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
|
|
1440
|
+
width: 32px; height: 32px; padding: 0; color: var(--cm-text-on-dark); background: none; border: 0; border-radius: 50%; cursor: pointer;
|
|
1441
|
+
}
|
|
1442
|
+
.close:hover { background: var(--cm-nav-active); }
|
|
1443
|
+
.close:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
1444
|
+
@media (max-width: 640px) {
|
|
1445
|
+
.bar { font-size: 14px; min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
1446
|
+
}
|
|
1447
|
+
`];b("cm-flash-offer-bar",Jt);var fa,ga,_r,Qt=class extends u{constructor(){super(...arguments);p(this,ga);this.items=[];this.label="Sections";this._slotted=[];p(this,fa)}connectedCallback(){super.connectedCallback(),c(this,ga,_r).call(this),v(this,fa,Te(this,()=>c(this,ga,_r).call(this)))}disconnectedCallback(){super.disconnectedCallback(),s(this,fa)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return r`<nav part="nav" aria-label=${this.label||"Sections"}>
|
|
1448
|
+
<ul part="tabs">${this.tabs.map(e=>r`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":l}
|
|
1449
|
+
@click=${t=>{Le(this,e)||t.preventDefault()}}>${e.label}${e.badge?r`<span class="badge">(${e.badge})</span>`:l}</a></li>`)}</ul>
|
|
1450
|
+
<slot hidden></slot>
|
|
1451
|
+
</nav>`}};fa=new WeakMap,ga=new WeakSet,_r=function(){this._slotted=ue(this)},Qt.properties={items:{type:Array},label:{},_slotted:{state:!0}},Qt.styles=[f,m`
|
|
1452
|
+
:host { display: block; }
|
|
1453
|
+
ul {
|
|
1454
|
+
display: flex; gap: 28px; margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
1455
|
+
border-bottom: var(--cm-border-1) solid var(--cm-border-default); white-space: nowrap;
|
|
1456
|
+
}
|
|
1457
|
+
li { flex: none; display: flex; }
|
|
1458
|
+
a {
|
|
1459
|
+
position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0 14px;
|
|
1460
|
+
font-size: 16px; font-weight: 500; color: var(--cm-text-tertiary); text-decoration: none;
|
|
1461
|
+
}
|
|
1462
|
+
a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 1px; background: transparent; }
|
|
1463
|
+
a:hover { color: var(--cm-text-default); }
|
|
1464
|
+
a[aria-current='page'] { color: var(--cm-text-default); }
|
|
1465
|
+
a[aria-current='page']::after { background: var(--cm-border-strong); }
|
|
1466
|
+
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
|
|
1467
|
+
.badge { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
1468
|
+
@media (max-width: 640px) { ul { gap: 18px; } a { font-size: 14px; } }
|
|
1469
|
+
`];b("cm-link-tabs",Qt);var Gt=class extends u{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),a=typeof this.reviews=="number"?`${this.reviews.toLocaleString()} ${this.reviews===1?"Review":"Reviews"}`:"";return r`<article part="card" aria-labelledby="name">
|
|
1470
|
+
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
1471
|
+
<div class="status"><slot name="status"></slot></div>
|
|
1472
|
+
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
1473
|
+
${this.developer?r`<p class="by">By ${this.developer}</p>`:l}
|
|
1474
|
+
${t?r`<p class="rating"><cm-icon class="star" name="star" size="12"></cm-icon>
|
|
1475
|
+
<span aria-hidden="true">${this.rating.toFixed(1)}</span><span class="sr">Rated ${this.rating.toFixed(1)} out of 5</span>
|
|
1476
|
+
${a?this.reviewsHref?r`<a href=${this.reviewsHref}>${a}</a>`:r`<span>${a}</span>`:l}</p>`:l}
|
|
1477
|
+
${this.pricing?r`<p class="pricing">${this.pricing}</p>`:l}
|
|
1478
|
+
${this.offer?r`<p class="offer"><cm-icon name="percent" size="12"></cm-icon><span><span class="sr">Offer: </span>${this.offer}</span></p>`:l}
|
|
1479
|
+
<div class="actions"><slot name="actions"></slot>${this.href?r`<a class="details" part="details" href=${this.href}
|
|
1480
|
+
aria-label=${`View details of ${this.name}`}>View Details</a>`:l}</div>
|
|
1481
|
+
</article>`}};Gt.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},Gt.styles=[f,m`
|
|
1482
|
+
:host { display: block; container-type: inline-size; }
|
|
1483
|
+
article {
|
|
1484
|
+
position: relative; display: flex; flex-direction: column; gap: 10px; height: 100%; padding: var(--cm-space-20);
|
|
1485
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md);
|
|
1486
|
+
font-size: 12px;
|
|
1487
|
+
}
|
|
1488
|
+
.logo {
|
|
1489
|
+
display: grid; place-items: center; width: 130px; height: 54px; margin-bottom: 10px; padding: 8px; overflow: hidden;
|
|
1490
|
+
background: var(--cm-bg-inset); border-radius: var(--cm-radius-xs);
|
|
1491
|
+
}
|
|
1492
|
+
::slotted([slot='logo']) { max-width: 100%; max-height: 100%; object-fit: contain; }
|
|
1493
|
+
.status { position: absolute; top: var(--cm-space-20); right: var(--cm-space-20); }
|
|
1494
|
+
.name { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
|
|
1495
|
+
.by { margin: -6px 0 0; }
|
|
1496
|
+
.rating { display: flex; align-items: center; gap: 5px; margin: 0; }
|
|
1497
|
+
.star { color: var(--cm-icon-rating); }
|
|
1498
|
+
.star::part(svg) { fill: currentColor; }
|
|
1499
|
+
.rating a, .details { color: var(--cm-text-default); text-decoration: underline; text-underline-offset: 2px; }
|
|
1500
|
+
.rating a:focus-visible, .details:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: 2px; }
|
|
1501
|
+
.pricing { margin: 4px 0 0; }
|
|
1502
|
+
.offer {
|
|
1503
|
+
display: flex; align-items: center; gap: 5px; margin: 0; padding: 4px 6px; font-size: 11px; line-height: 1.3;
|
|
1504
|
+
background: var(--cm-bg-offer-card); border-radius: var(--cm-radius-xs);
|
|
1505
|
+
}
|
|
1506
|
+
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-20); margin-top: auto; padding-top: 6px; }
|
|
1507
|
+
.actions slot { display: contents; }
|
|
1508
|
+
.details { font-weight: 500; }
|
|
1509
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1510
|
+
@container (max-width: 380px) {
|
|
1511
|
+
article { padding: var(--cm-space-10); }
|
|
1512
|
+
.logo { width: 100px; height: 40px; padding: 6px; }
|
|
1513
|
+
.status { top: var(--cm-space-10); right: var(--cm-space-10); }
|
|
1514
|
+
.actions { gap: var(--cm-space-10); }
|
|
1515
|
+
.details { margin-left: auto; }
|
|
1516
|
+
}
|
|
1517
|
+
`];b("cm-app-card",Gt);var Tr=0,Qo="";function Hn(){Tr++===0&&(Qo=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function Jo(){Tr>0&&--Tr===0&&(document.documentElement.style.overflow=Qo)}function In(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var ei,be,ti,va,Lr,ws,ks,Es,Ms,zs,T=class extends u{constructor(){super(...arguments);p(this,va);this.open=!1;this.heading="";this.label="";this.closeLabel="Close";this.uid=w("cm-ovl");p(this,ei,null);p(this,be,!1);p(this,ti,!1);p(this,ws,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});p(this,ks,e=>{e.preventDefault(),this.requestClose("escape")});p(this,Es,()=>{this.open&&(this.open=!1,c(this,va,Lr).call(this))});p(this,Ms,e=>{v(this,ti,e.target===e.currentTarget)});p(this,zs,e=>{if(e.target===e.currentTarget&&s(this,ti)){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")}v(this,ti,!1)});this.backdropFillsDialog=!1}show(){this.open=!0}close(){this.open=!1}requestClose(e="method"){let t=this.dispatchEvent(new CustomEvent("cm-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0}));return t&&(this.open=!1),t}get dialog(){return this.renderRoot?.querySelector("dialog")}updated(e){if(super.updated(e),!e.has("open"))return;let t=this.dialog;if(t)if(this.open&&!t.open){if(v(this,ei,In()),!this.isConnected)return;t.showModal(),s(this,be)||(Hn(),v(this,be,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),c(this,va,Lr).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),s(this,be)&&(Jo(),v(this,be,!1))}renderHeader(e=l){return r`<header class="head" part="header">
|
|
1518
|
+
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
1519
|
+
<button type="button" class="x" part="close" aria-label=${this.closeLabel||"Close"} @click=${()=>this.requestClose("close-button")}>
|
|
1520
|
+
<cm-icon name="close" size="18"></cm-icon></button>
|
|
1521
|
+
</header>`}renderDialog(e,t=""){return r`<dialog part="dialog" class=${t}
|
|
1522
|
+
aria-labelledby=${this.heading?`${this.uid}-h`:l}
|
|
1523
|
+
aria-label=${!this.heading&&this.label?this.label:l}
|
|
1524
|
+
@keydown=${s(this,ws)} @cancel=${s(this,ks)} @close=${s(this,Es)}
|
|
1525
|
+
@pointerdown=${s(this,Ms)} @click=${s(this,zs)}>${e}</dialog>`}};ei=new WeakMap,be=new WeakMap,ti=new WeakMap,va=new WeakSet,Lr=function(){s(this,be)&&(Jo(),v(this,be,!1));let e=s(this,ei);v(this,ei,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},ws=new WeakMap,ks=new WeakMap,Es=new WeakMap,Ms=new WeakMap,zs=new WeakMap,T.properties={open:{type:Boolean,reflect:!0},heading:{},label:{},closeLabel:{attribute:"close-label"}},T.overlayStyles=[f,m`
|
|
1526
|
+
:host { display: contents; }
|
|
1527
|
+
dialog {
|
|
1528
|
+
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
1529
|
+
font: inherit; overflow: visible;
|
|
1530
|
+
}
|
|
1531
|
+
dialog::backdrop { background: var(--cm-overlay, rgba(0, 0, 0, 0.4)); }
|
|
1532
|
+
.panel {
|
|
1533
|
+
display: flex; flex-direction: column; background: var(--cm-bg-surface); color: var(--cm-text-default);
|
|
1534
|
+
overflow: hidden; outline: none;
|
|
1535
|
+
}
|
|
1536
|
+
.head {
|
|
1537
|
+
display: flex; align-items: center; gap: var(--cm-space-10); flex: none; min-height: 40px; padding: 8px 10px 8px 15px;
|
|
1538
|
+
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
1539
|
+
}
|
|
1540
|
+
.head h2 { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
|
|
1541
|
+
.x {
|
|
1542
|
+
display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
1543
|
+
background: none; color: inherit; cursor: pointer;
|
|
1544
|
+
}
|
|
1545
|
+
.x:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
1546
|
+
.body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--cm-space-20); font-size: 14px; line-height: 20px; }
|
|
1547
|
+
.foot {
|
|
1548
|
+
display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-10); flex: none; padding: var(--cm-space-15) var(--cm-space-20);
|
|
1549
|
+
border-top: var(--cm-border-1) solid var(--cm-border-default);
|
|
1550
|
+
}
|
|
1551
|
+
.foot[hidden] { display: none; }
|
|
1552
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1553
|
+
dialog[open] .panel { animation: cm-ovl-in 160ms ease-out; }
|
|
1554
|
+
}
|
|
1555
|
+
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
1556
|
+
`];var _s,Go,ii=class extends T{constructor(){super(...arguments);p(this,_s);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}render(){return this.renderDialog(r`<div class="panel" part="panel" tabindex="-1">
|
|
1557
|
+
${this.renderHeader()}
|
|
1558
|
+
<div class="body" part="body"><slot></slot></div>
|
|
1559
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${c(this,_s,Go)}></slot></footer>
|
|
1560
|
+
</div>`)}};_s=new WeakSet,Go=function(e){this._hasFooter=e.target.assignedElements().length>0},ii.properties={...T.properties,size:{reflect:!0},_hasFooter:{state:!0}},ii.styles=[...T.overlayStyles,m`
|
|
1561
|
+
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
1562
|
+
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
1563
|
+
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
1564
|
+
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-sm); box-shadow: var(--cm-shadow-100); }
|
|
1565
|
+
`];b("cm-modal",ii);var Ts,en,te=class extends T{constructor(){super(...arguments);p(this,Ts);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}renderBody(){return r`<slot></slot>`}renderFooter(){return r`<slot name="footer" @slotchange=${c(this,Ts,en)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(r`<div class="panel" part="panel" tabindex="-1">
|
|
1566
|
+
${this.renderHeader()}
|
|
1567
|
+
<div class="body" part="body">${this.renderBody()}</div>
|
|
1568
|
+
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
1569
|
+
</div>`)}};Ts=new WeakSet,en=function(e){this._hasFooter=e.target.assignedElements().length>0},te.properties={...T.properties,size:{reflect:!0},_hasFooter:{state:!0}},te.styles=[...T.overlayStyles,m`
|
|
1570
|
+
dialog {
|
|
1571
|
+
position: fixed; inset: 0 0 0 auto; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
1572
|
+
}
|
|
1573
|
+
:host([size='small']) dialog { --cm-side-panel-width: 380px; }
|
|
1574
|
+
:host([size='large']) dialog { --cm-side-panel-width: 720px; }
|
|
1575
|
+
.panel { height: 100%; box-shadow: var(--cm-shadow-100); }
|
|
1576
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1577
|
+
dialog[open] .panel { animation: cm-side-in 200ms ease-out; }
|
|
1578
|
+
}
|
|
1579
|
+
@keyframes cm-side-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
1580
|
+
@media (max-width: 599px) {
|
|
1581
|
+
dialog { inset: 16px; width: auto; height: auto; }
|
|
1582
|
+
.panel { border-radius: var(--cm-radius-sm); }
|
|
1583
|
+
}
|
|
1584
|
+
`];b("cm-side-panel",te);var si,Ls,ai=class extends te{constructor(){super(...arguments);this.heading="Search and Filter";this.search=!1;this.query="";this.searchLabel="Search";this.searchPlaceholder="Search anything";this.applyLabel="Search";this.resetLabel="Reset";p(this,si,()=>{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,Ls,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(n,d)=>{if(d==="")return;let h=e[n];e[n]=h===void 0?d:Array.isArray(h)?[...h,d]:[h,d]},a=this.form;if(a){for(let[n,d]of new FormData(a))typeof d=="string"&&t(n,d);return e}return this.querySelectorAll("[name]").forEach(n=>{let d=n.getAttribute("name");"checked"in n&&(n.type==="checkbox"||n.type==="radio"||n.localName.match(/^cm-(checkbox|radio|toggle)$/))?n.checked&&t(d,n.value||"on"):typeof n.value=="string"&&t(d,n.value)}),e}reset(){let e=this.form;e?e.reset():this.querySelectorAll("[name]").forEach(t=>t.formResetCallback?.()),this.query=""}renderBody(){return r`${this.search?r`<cm-search class="search" part="search" .value=${this.query} label=${this.searchLabel}
|
|
1585
|
+
placeholder=${this.searchPlaceholder}
|
|
1586
|
+
@input=${e=>{this.query=e.target.value}}
|
|
1587
|
+
@cm-search=${e=>{e.stopPropagation(),s(this,si).call(this)}}></cm-search>`:l}
|
|
1588
|
+
<slot @submit=${e=>{e.preventDefault(),s(this,si).call(this)}}></slot>`}renderFooter(){return r`<cm-button part="reset" @click=${s(this,Ls)}>${this.resetLabel}</cm-button>
|
|
1589
|
+
<cm-button part="apply" variant="primary" @click=${s(this,si)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};si=new WeakMap,Ls=new WeakMap,ai.properties={...te.properties,search:{type:Boolean},query:{},searchLabel:{attribute:"search-label"},searchPlaceholder:{attribute:"search-placeholder"},applyLabel:{attribute:"apply-label"},resetLabel:{attribute:"reset-label"}},ai.styles=[...te.styles,m`
|
|
1590
|
+
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
1591
|
+
.foot { justify-content: center; }
|
|
1592
|
+
::slotted(form) { display: grid; gap: var(--cm-space-15); }
|
|
1593
|
+
`];b("cm-filter-panel",ai);var xa,Ge,Ar,tn,ri=class extends T{constructor(){super(...arguments);p(this,Ge);this.heading="";this.items=[];this._slotted=[];p(this,xa)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=ra(this),v(this,xa,rs(this,()=>{this._slotted=ra(this)}))}disconnectedCallback(){super.disconnectedCallback(),s(this,xa)?.disconnect()}render(){let e=this.sheetItems.filter(a=>!a.divider),t=e.some(a=>a.icon);return this.renderDialog(r`<div class="panel" part="panel" tabindex="-1">
|
|
1594
|
+
<button type="button" class="x" part="close" aria-label=${this.closeLabel||"Close"} @click=${()=>this.requestClose("close-button")}>
|
|
1595
|
+
<cm-icon name="close" size="16"></cm-icon></button>
|
|
1596
|
+
${this.heading?r`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:l}
|
|
1597
|
+
<div class="content">
|
|
1598
|
+
${e.length?r`<ul class=${t?"icons":""} part="list">${e.map(a=>r`<li>${c(this,Ge,tn).call(this,a)}</li>`)}</ul>`:l}
|
|
1599
|
+
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
1600
|
+
</div>
|
|
1601
|
+
</div>`)}};xa=new WeakMap,Ge=new WeakSet,Ar=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")},tn=function(e){let t=`row${e.critical?" critical":""}`,a=r`${e.icon?r`<cm-icon class="lead" name=${e.icon} size="18"></cm-icon>`:l}<span class="label">${e.label}</span>${e.icon?r`<cm-icon name="chevron-right" size="16"></cm-icon>`:l}`;return e.href&&!e.disabled?r`<a class=${t} part="row" href=${e.href} @click=${n=>c(this,Ge,Ar).call(this,n,e)}>${a}</a>`:r`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":l}
|
|
1602
|
+
@click=${n=>c(this,Ge,Ar).call(this,n,e)}>${a}</button>`},ri.properties={...T.properties,items:{type:Array},_slotted:{state:!0}},ri.styles=[...T.overlayStyles,m`
|
|
1603
|
+
dialog {
|
|
1604
|
+
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: 22px;
|
|
1605
|
+
}
|
|
1606
|
+
.panel {
|
|
1607
|
+
position: relative; overflow: visible; max-height: calc(100dvh - 80px); padding: 18px var(--cm-space-20) max(var(--cm-space-20), env(safe-area-inset-bottom));
|
|
1608
|
+
border-radius: 20px 20px 0 0; box-shadow: var(--cm-shadow-100);
|
|
1609
|
+
}
|
|
1610
|
+
.x {
|
|
1611
|
+
position: absolute; top: -18px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%;
|
|
1612
|
+
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
1613
|
+
}
|
|
1614
|
+
.x:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1615
|
+
.content { overflow: auto; min-height: 0; }
|
|
1616
|
+
ul { list-style: none; margin: 0; padding: 0; }
|
|
1617
|
+
li + li { border-top: var(--cm-border-1) solid var(--cm-border-default); }
|
|
1618
|
+
.row {
|
|
1619
|
+
display: flex; align-items: center; justify-content: center; gap: var(--cm-space-10); width: 100%; min-height: 44px; padding: 8px 4px;
|
|
1620
|
+
font: inherit; font-size: 14px; color: var(--cm-text-default); text-decoration: none; background: none; border: 0; cursor: pointer;
|
|
1621
|
+
}
|
|
1622
|
+
.icons .row { justify-content: flex-start; }
|
|
1623
|
+
.row .label { overflow-wrap: anywhere; }
|
|
1624
|
+
.icons .row .label { flex: 1; text-align: start; }
|
|
1625
|
+
.row.critical { color: var(--cm-text-critical); }
|
|
1626
|
+
.row[aria-disabled='true'] { color: var(--cm-text-secondary); cursor: default; }
|
|
1627
|
+
.row:hover:not([aria-disabled='true']):not(.critical) { background: var(--cm-bg-hover); }
|
|
1628
|
+
.row.critical:hover { text-decoration: underline; } /* text-critical on bg-hover is under 4.5:1 in dark */
|
|
1629
|
+
.row:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; border-radius: var(--cm-radius-sm); }
|
|
1630
|
+
.lead { color: var(--cm-icon-default); }
|
|
1631
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1632
|
+
dialog[open] .panel { animation: cm-sheet-in 200ms ease-out; }
|
|
1633
|
+
}
|
|
1634
|
+
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
1635
|
+
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1636
|
+
`];b("cm-bottom-sheet",ri);var Rn={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},oi=class extends u{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value=""}render(){return null}};oi.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0}},oi.styles=m`:host { display: none; }`;b("cm-notification-item",oi);var li,ie,Sr,Cr,an,ni=class extends T{constructor(){super(...arguments);p(this,ie);this.heading="Notifications";this.items=[];this.moreHref="";this.moreLabel="See more notifications";this.emptyText="No notifications yet.";this._slotted=[];p(this,li)}connectedCallback(){super.connectedCallback(),c(this,ie,Sr).call(this),v(this,li,new MutationObserver(()=>c(this,ie,Sr).call(this))),s(this,li).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),s(this,li)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications;return this.renderDialog(r`<div class="panel" part="panel" tabindex="-1">
|
|
1637
|
+
${this.renderHeader()}
|
|
1638
|
+
${e.length?r`<ul class="list" part="list">${e.map(t=>r`<li>${c(this,ie,an).call(this,t)}</li>`)}</ul>`:r`<p class="empty">${this.emptyText}</p>`}
|
|
1639
|
+
${this.moreHref?r`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:l}
|
|
1640
|
+
<slot hidden></slot>
|
|
1641
|
+
</div>`)}};li=new WeakMap,ie=new WeakSet,Sr=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=a=>e.getAttribute(a)||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")}})},Cr=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")},an=function(e){let t=e.tone??"information",a=r`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${Rn[t]??"bell"} size="14"></cm-icon></span>
|
|
1642
|
+
<span class="label">${e.unread?r`<span class="vh">Unread: </span>`:l}${e.label}</span>
|
|
1643
|
+
${e.time?r`<time>${e.time}</time>`:l}`,n=`row${e.unread?" unread":""}`;return e.href?r`<a class=${n} part="row" href=${e.href} @click=${d=>c(this,ie,Cr).call(this,d,e)}>${a}</a>`:r`<button type="button" class=${n} part="row" @click=${d=>c(this,ie,Cr).call(this,d,e)}>${a}</button>`},ni.properties={...T.properties,items:{type:Array},moreHref:{attribute:"more-href"},moreLabel:{attribute:"more-label"},emptyText:{attribute:"empty-text"},_slotted:{state:!0}},ni.styles=[...T.overlayStyles,m`
|
|
1644
|
+
dialog {
|
|
1645
|
+
position: fixed; inset: var(--cm-notification-panel-top, 64px) var(--cm-notification-panel-end, 20px) auto auto;
|
|
1646
|
+
width: min(380px, calc(100vw - 32px));
|
|
1647
|
+
}
|
|
1648
|
+
.panel { max-height: calc(100dvh - var(--cm-notification-panel-top, 64px) - 16px); border-radius: var(--cm-radius-sm); box-shadow: var(--cm-shadow-100); }
|
|
1649
|
+
.list { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 0; padding: 0; list-style: none; }
|
|
1650
|
+
.list li:nth-child(even) .row { background: var(--cm-bg-hover); }
|
|
1651
|
+
.row {
|
|
1652
|
+
display: flex; align-items: center; gap: var(--cm-space-10); width: 100%; min-height: 40px; padding: 8px var(--cm-space-15);
|
|
1653
|
+
font: inherit; font-size: 13px; line-height: 18px; color: var(--cm-text-default); text-align: start; text-decoration: none;
|
|
1654
|
+
background: var(--cm-bg-surface); border: 0; cursor: pointer;
|
|
1655
|
+
}
|
|
1656
|
+
.row:hover { text-decoration: underline; }
|
|
1657
|
+
.row:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; }
|
|
1658
|
+
.ic { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: var(--cm-radius-xs); }
|
|
1659
|
+
.information { background: var(--cm-bg-information-soft); color: var(--cm-text-information); }
|
|
1660
|
+
.attention { background: var(--cm-bg-attention); color: var(--cm-text-attention); }
|
|
1661
|
+
.success { background: var(--cm-bg-success-soft); color: var(--cm-text-success); }
|
|
1662
|
+
.critical { background: var(--cm-bg-critical); color: var(--cm-text-critical); }
|
|
1663
|
+
.label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1664
|
+
.unread .label { font-weight: 600; }
|
|
1665
|
+
time { flex: none; font-size: 11px; color: var(--cm-text-tertiary); }
|
|
1666
|
+
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1667
|
+
.more {
|
|
1668
|
+
display: block; flex: none; padding: 10px; font-size: 12px; text-align: center; color: var(--cm-text-default);
|
|
1669
|
+
border-top: var(--cm-border-1) solid var(--cm-border-default);
|
|
1670
|
+
}
|
|
1671
|
+
.more:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; }
|
|
1672
|
+
.empty { margin: 0; padding: var(--cm-space-20); font-size: 13px; text-align: center; color: var(--cm-text-tertiary); }
|
|
1673
|
+
@media (max-width: 599px) {
|
|
1674
|
+
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
1675
|
+
}
|
|
1676
|
+
`];b("cm-notification-panel",ni);var Dn=2e3,sn=1e4,rn=150,ya,Q,fe,$a,hi,mi,D,on,ci,Nr,wa,ka,Ea,Ma,nn,di=class extends u{constructor(){super(...arguments);p(this,D);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;p(this,ya);p(this,Q);p(this,fe,0);p(this,$a,0);p(this,hi,!1);p(this,mi,!1);p(this,wa,()=>{v(this,hi,!0),c(this,D,Nr).call(this)});p(this,ka,()=>{v(this,hi,!1),c(this,D,ci).call(this)});p(this,Ea,()=>{v(this,mi,!0),c(this,D,Nr).call(this)});p(this,Ma,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(v(this,mi,!1),c(this,D,ci).call(this))})}get effectiveDuration(){let e=this.duration??(this.actionLabel?sn:5e3);return Math.min(sn,Math.max(Dn,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&v(this,ya,setTimeout(()=>{this._primed=!0},rn)),this.addEventListener("pointerenter",s(this,wa)),this.addEventListener("pointerleave",s(this,ka)),this.addEventListener("focusin",s(this,Ea)),this.addEventListener("focusout",s(this,Ma))}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(s(this,Q)),clearTimeout(s(this,ya)),this.removeEventListener("pointerenter",s(this,wa)),this.removeEventListener("pointerleave",s(this,ka)),this.removeEventListener("focusin",s(this,Ea)),this.removeEventListener("focusout",s(this,Ma))}updated(e){(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(s(this,Q)),this.open&&(this._inRegion||this._primed)&&(v(this,fe,this.effectiveDuration),c(this,D,ci).call(this)))}show(){this.open?(v(this,fe,this.effectiveDuration),c(this,D,ci).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(s(this,Q)),this.open=!1,!0):(e==="timeout"&&(v(this,fe,this.effectiveDuration),c(this,D,ci).call(this)),!1)}render(){let e=r`<div class="toast" part="toast">
|
|
1677
|
+
${this.tone==="critical"?r`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:l}
|
|
1678
|
+
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
1679
|
+
${this.actionLabel?r`<button class="action" part="action" @click=${c(this,D,nn)}>${this.actionLabel}</button>`:l}
|
|
1680
|
+
<button class="close" part="close" aria-label="Dismiss" @click=${()=>this.dismiss("close")}>
|
|
1681
|
+
<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>
|
|
1682
|
+
</button>
|
|
1683
|
+
</div>`;return this._inRegion?e:r`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:l}</div>`}};ya=new WeakMap,Q=new WeakMap,fe=new WeakMap,$a=new WeakMap,hi=new WeakMap,mi=new WeakMap,D=new WeakSet,on=function(){return s(this,hi)||s(this,mi)},ci=function(){clearTimeout(s(this,Q)),!(!this.open||s(this,D,on))&&(v(this,$a,Date.now()),v(this,Q,setTimeout(()=>this.dismiss("timeout"),s(this,fe))))},Nr=function(){s(this,Q)!==void 0&&(clearTimeout(s(this,Q)),v(this,Q,void 0),v(this,fe,Math.max(1e3,s(this,fe)-(Date.now()-s(this,$a)))))},wa=new WeakMap,ka=new WeakMap,Ea=new WeakMap,Ma=new WeakMap,nn=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},di.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},di.styles=[f,m`
|
|
1684
|
+
:host { display: block; pointer-events: auto; }
|
|
1685
|
+
:host(:not([open])) { display: none; }
|
|
1686
|
+
.toast {
|
|
1687
|
+
display: flex; align-items: center; gap: var(--cm-space-15);
|
|
1688
|
+
min-block-size: 48px; max-inline-size: min(480px, calc(100vw - 32px));
|
|
1689
|
+
padding: var(--cm-space-10) var(--cm-space-10) var(--cm-space-10) var(--cm-space-20);
|
|
1690
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100);
|
|
1691
|
+
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark);
|
|
1692
|
+
outline: 1px solid var(--cm-nav-divider); font-size: 14px; line-height: 20px;
|
|
1693
|
+
}
|
|
1694
|
+
:host([tone='critical']) .toast { background: var(--cm-bg-error-bar); color: var(--cm-text-default); outline-color: var(--cm-border-critical); }
|
|
1695
|
+
.icon { flex: none; color: var(--cm-icon-critical); }
|
|
1696
|
+
.message { flex: 1; min-inline-size: 0; padding-block: 4px; }
|
|
1697
|
+
button {
|
|
1698
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center; min-block-size: 32px;
|
|
1699
|
+
padding: 0 var(--cm-space-10); border: 0; border-radius: var(--cm-radius-sm); background: none;
|
|
1700
|
+
color: inherit; font: inherit; font-weight: 600; cursor: pointer;
|
|
1701
|
+
}
|
|
1702
|
+
.action { text-decoration: underline; text-underline-offset: 3px; }
|
|
1703
|
+
.close { inline-size: 32px; padding: 0; }
|
|
1704
|
+
button:hover { background: color-mix(in srgb, var(--cm-text-on-dark) 14%, transparent); }
|
|
1705
|
+
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
1706
|
+
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
1707
|
+
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
1708
|
+
`];b("cm-toast",di);var za,pi=class extends u{constructor(){super(...arguments);this.max=3;p(this,za,e=>{let t=e.target;queueMicrotask(()=>{t.localName==="cm-toast"&&!t.open&&t.remove()})})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Notifications"),this.addEventListener("cm-dismiss",s(this,za))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",s(this,za))}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")];return t.slice(0,Math.max(0,t.length-Math.max(1,this.max))).forEach(a=>a.remove()),e}render(){return r`<slot></slot>`}};za=new WeakMap,pi.properties={max:{type:Number}},pi.styles=[f,m`
|
|
1709
|
+
:host {
|
|
1710
|
+
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
1711
|
+
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-10);
|
|
1712
|
+
padding-inline: var(--cm-space-15); pointer-events: none;
|
|
1713
|
+
}
|
|
1714
|
+
`];b("cm-toast-region",pi);function Bn(o,i={}){let e=i.root??document.body,t=e.querySelector(":scope > cm-toast-region"),a=!t;t||(t=document.createElement("cm-toast-region"),e.append(t));let n=document.createElement("cm-toast");if(n.message=String(o),i.tone&&(n.tone=i.tone),i.duration!==void 0&&(n.duration=i.duration),i.action){n.actionLabel=i.action.label;let d=i.action.onAction;n.addEventListener("cm-action",()=>d())}if(a){let d=t;return setTimeout(()=>d.add(n),rn),n}return t.add(n)}var ui=class extends u{constructor(){super(...arguments);this.size="large";this.accessibleLabel="Loading"}render(){let e=this.size==="small"?2.5:3;return r`<span class="spinner" part="spinner" role="status">
|
|
1715
|
+
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
1716
|
+
<circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
|
|
1717
|
+
<path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
|
|
1718
|
+
</svg>
|
|
1719
|
+
<span class="vh">${this.accessibleLabel||"Loading"}</span>
|
|
1720
|
+
</span>`}};ui.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label"}},ui.styles=[f,m`
|
|
1721
|
+
:host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
|
|
1722
|
+
.spinner { display: inline-flex; }
|
|
1723
|
+
svg { inline-size: 44px; block-size: 44px; animation: spin 0.8s linear infinite; }
|
|
1724
|
+
:host([size='small']) svg { inline-size: 20px; block-size: 20px; }
|
|
1725
|
+
.track { stroke: var(--cm-border-default); }
|
|
1726
|
+
.arc { stroke: currentColor; }
|
|
1727
|
+
.vh {
|
|
1728
|
+
position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
1729
|
+
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
1730
|
+
}
|
|
1731
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
1732
|
+
@media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
|
|
1733
|
+
`];b("cm-spinner",ui);var As,bi=class extends u{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";p(this,As,w("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=`${s(this,As)}-label`;return r`
|
|
1734
|
+
<div class="head ${this.labelHidden?"vh":""}">
|
|
1735
|
+
<span id=${t} part="label">${this.label}</span>
|
|
1736
|
+
${this.showValue&&e!==null?r`<span class="value" aria-hidden="true">${Math.round(e)}%</span>`:l}
|
|
1737
|
+
</div>
|
|
1738
|
+
<div class="track ${e===null?"indeterminate":""}" part="track" role="progressbar"
|
|
1739
|
+
aria-labelledby=${t} aria-valuemin="0" aria-valuemax="100"
|
|
1740
|
+
aria-valuenow=${e===null?l:Math.round(e)}
|
|
1741
|
+
aria-valuetext=${e===null?"In progress":`${Math.round(e)}%`}>
|
|
1742
|
+
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
1743
|
+
</div>`}};As=new WeakMap,bi.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},bi.styles=[f,m`
|
|
1744
|
+
:host { display: block; }
|
|
1745
|
+
.head { display: flex; justify-content: space-between; gap: var(--cm-space-10); margin-block-end: 6px; font-size: 14px; line-height: 20px; }
|
|
1746
|
+
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
1747
|
+
.vh {
|
|
1748
|
+
position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
1749
|
+
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
1750
|
+
}
|
|
1751
|
+
.track { position: relative; block-size: 8px; border-radius: var(--cm-radius-full); background: var(--cm-bg-inset); overflow: hidden; box-shadow: inset 0 0 0 1px var(--cm-border-default); }
|
|
1752
|
+
:host([size='small']) .track { block-size: 4px; }
|
|
1753
|
+
.fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: inherit; background: var(--cm-action-primary); transition: inline-size 0.2s ease; }
|
|
1754
|
+
.indeterminate .fill { inline-size: 35%; animation: slide 1.4s ease-in-out infinite; }
|
|
1755
|
+
@keyframes slide { from { inset-inline-start: -35%; } to { inset-inline-start: 100%; } }
|
|
1756
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1757
|
+
.fill { transition: none; }
|
|
1758
|
+
.indeterminate .fill { animation-duration: 4s; }
|
|
1759
|
+
}
|
|
1760
|
+
`];b("cm-progress-bar",bi);var fi=class extends u{constructor(){super(...arguments);this.tone="neutral"}render(){return r`<span part="badge"><slot></slot></span>`}};fi.properties={tone:{reflect:!0}},fi.styles=[f,m`
|
|
1761
|
+
:host { display: inline-flex; vertical-align: middle; }
|
|
1762
|
+
span {
|
|
1763
|
+
display: inline-flex; align-items: center; height: 28px; padding: 0 var(--cm-space-10);
|
|
1764
|
+
font-size: 10px; font-weight: 500; letter-spacing: var(--cm-tracking-caps); text-transform: uppercase;
|
|
1765
|
+
border-radius: var(--cm-radius-full); background: var(--cm-bg-tag); color: var(--cm-text-default);
|
|
1766
|
+
}
|
|
1767
|
+
/* Tinted tones are laid over the surface colour, so the text keeps AA contrast on any page background. */
|
|
1768
|
+
:host([tone='information']) span { background: linear-gradient(var(--cm-bg-information-soft), var(--cm-bg-information-soft)), var(--cm-bg-surface); color: var(--cm-text-information); }
|
|
1769
|
+
: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); }
|
|
1770
|
+
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
1771
|
+
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
1772
|
+
`];b("cm-badge",fi);var gi=class extends u{constructor(){super(...arguments);this.heading="";this.description="";this.flush=!1;this.headingLevel=2}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=this.heading?r`<div role="heading" aria-level=${e} class="title" part="title">${this.heading}<slot name="title-adornment"></slot></div>`:l;return r`<section part="card" aria-label=${this.heading||l}>
|
|
1773
|
+
${this.heading||this.description?r`<header><div>${t}${this.description?r`<p class="desc">${this.description}</p>`:l}</div>
|
|
1774
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:l}
|
|
1775
|
+
<slot></slot>
|
|
1776
|
+
</section>`}};gi.properties={heading:{},description:{},flush:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},gi.styles=[f,m`
|
|
1777
|
+
:host { display: block; }
|
|
1778
|
+
section {
|
|
1779
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card);
|
|
1780
|
+
border-radius: var(--cm-radius-md); padding: var(--cm-space-20);
|
|
1781
|
+
}
|
|
1782
|
+
:host([flush]) section { padding: 0; }
|
|
1783
|
+
header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--cm-space-20); margin-bottom: var(--cm-space-20); }
|
|
1784
|
+
:host([flush]) header { padding: var(--cm-space-20) var(--cm-space-20) 0; }
|
|
1785
|
+
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); font-weight: 600; display: flex; align-items: center; gap: var(--cm-space-10); }
|
|
1786
|
+
.desc { margin: 6px 0 0; font-size: 16px; color: var(--cm-text-tertiary); }
|
|
1787
|
+
.actions { display: flex; gap: var(--cm-space-20); align-items: center; }
|
|
1788
|
+
`];b("cm-card",gi);var qn=["0","10","12","15","20","22","30"];function vi(o,i){return La(qn.map(e=>`:host([${o}='${e}']) { ${i}: ${e==="0"?"0px":`var(--cm-space-${e})`}; }`).join(`
|
|
1789
|
+
`))}var xi=class extends u{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return r`<slot></slot>`}};xi.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},xi.styles=[f,m`
|
|
1790
|
+
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
1791
|
+
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
1792
|
+
:host([wrap]) { flex-wrap: wrap; }
|
|
1793
|
+
:host([align='start']) { align-items: flex-start; }
|
|
1794
|
+
:host([align='center']) { align-items: center; }
|
|
1795
|
+
:host([align='end']) { align-items: flex-end; }
|
|
1796
|
+
:host([align='stretch']) { align-items: stretch; }
|
|
1797
|
+
:host([align='baseline']) { align-items: baseline; }
|
|
1798
|
+
:host([justify='start']) { justify-content: flex-start; }
|
|
1799
|
+
:host([justify='center']) { justify-content: center; }
|
|
1800
|
+
:host([justify='end']) { justify-content: flex-end; }
|
|
1801
|
+
:host([justify='space-between']) { justify-content: space-between; }
|
|
1802
|
+
`,vi("gap","gap")];b("cm-stack",xi);var ln="important",On=" !"+ln,cn=qa(class extends it{constructor(o){if(super(o),o.type!==ne.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((i,e)=>{let t=o[e];return t==null?i:i+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(o,[i]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let t of this.ft)i[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in i){let a=i[t];if(a!=null){this.ft.add(t);let n=typeof a=="string"&&a.endsWith(On);t.includes("-")||n?e.setProperty(t,n?a.slice(0,-11):a,n?ln:""):e[t]=a}}return B}});var yi=class extends u{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(),a=t?`repeat(auto-fit, minmax(min(100%, ${t}), 1fr))`:`repeat(${e}, minmax(0, 1fr))`;return r`<div class="grid ${t?"fit":"fixed"}" part="grid" style=${cn({gridTemplateColumns:a})}><slot></slot></div>`}};yi.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},yi.styles=[f,m`
|
|
1803
|
+
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
1804
|
+
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
1805
|
+
@container cm-grid (max-width: 640px) {
|
|
1806
|
+
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
1807
|
+
}
|
|
1808
|
+
`,vi("gap","--_gap")];b("cm-grid",yi);var $i=class extends u{constructor(){super(...arguments);this.gap="20"}render(){return r`<div class="layout" part="layout"><slot></slot></div>`}};$i.properties={gap:{reflect:!0}},$i.styles=[f,m`
|
|
1809
|
+
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-20); }
|
|
1810
|
+
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
1811
|
+
@container cm-layout (max-width: 767px) {
|
|
1812
|
+
.layout { grid-template-columns: minmax(0, 1fr); }
|
|
1813
|
+
}
|
|
1814
|
+
/* Section widths live here, not in cm-layout-section: a container name only reaches queries in its own
|
|
1815
|
+
shadow tree in current browsers, and rules on ::slotted from this scope win over the section's :host. */
|
|
1816
|
+
::slotted(*) { grid-column: 1 / -1; min-inline-size: 0; }
|
|
1817
|
+
@container cm-layout (min-width: 768px) {
|
|
1818
|
+
::slotted([variant='one-half']) { grid-column: span 3; }
|
|
1819
|
+
::slotted([variant='one-third']) { grid-column: span 2; }
|
|
1820
|
+
::slotted([variant='two-thirds']) { grid-column: span 4; }
|
|
1821
|
+
}
|
|
1822
|
+
`,vi("gap","--_gap")];var wi=class extends u{constructor(){super(...arguments);this.variant="full"}render(){return r`<slot></slot>`}};wi.properties={variant:{reflect:!0}},wi.styles=[f,m`
|
|
1823
|
+
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
1824
|
+
`];b("cm-layout",$i);b("cm-layout-section",wi);var ki=class extends u{constructor(){super(...arguments);this.fullWidth=!1;this.narrow=!1}render(){return r`<slot name="header"></slot><div class="content" part="content"><slot></slot></div><slot name="footer"></slot>`}};ki.properties={fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},ki.styles=[f,m`
|
|
1825
|
+
:host { display: block; container: cm-page / inline-size; background: var(--cm-bg-page); min-block-size: 100%; }
|
|
1826
|
+
.content {
|
|
1827
|
+
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
1828
|
+
padding: var(--cm-space-20);
|
|
1829
|
+
}
|
|
1830
|
+
:host([narrow]) .content { max-inline-size: 800px; }
|
|
1831
|
+
:host([full-width]) .content { max-inline-size: none; }
|
|
1832
|
+
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-10); } }
|
|
1833
|
+
`];b("cm-page",ki);var Mi,dn,pn,Ei=class extends u{constructor(){super(...arguments);p(this,Mi);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?Bi`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:Bi`<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 r`<div class="banner" part="banner" role=${e}>
|
|
1834
|
+
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
1835
|
+
<div class="body">
|
|
1836
|
+
${this.heading?r`<p class="title">${this.heading}</p>`:l}
|
|
1837
|
+
<div><slot></slot></div>
|
|
1838
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${c(this,Mi,dn)}></slot></div>
|
|
1839
|
+
</div>
|
|
1840
|
+
${this.dismissible?r`<button class="close" aria-label="Dismiss" @click=${c(this,Mi,pn)}>
|
|
1841
|
+
<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>`:l}
|
|
1842
|
+
</div>`}};Mi=new WeakSet,dn=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},pn=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},Ei.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},Ei.styles=[f,m`
|
|
1843
|
+
:host { display: block; }
|
|
1844
|
+
.banner {
|
|
1845
|
+
display: flex; gap: var(--cm-space-15); align-items: flex-start;
|
|
1846
|
+
padding: var(--cm-space-15) var(--cm-space-20); border-radius: var(--cm-radius-md);
|
|
1847
|
+
background: var(--cm-bg-attention); color: var(--cm-text-default); font-size: 14px;
|
|
1848
|
+
}
|
|
1849
|
+
:host([tone='information']) .banner { background: var(--cm-bg-information); }
|
|
1850
|
+
:host([tone='success']) .banner { background: var(--cm-bg-success); }
|
|
1851
|
+
:host([tone='critical']) .banner { background: var(--cm-bg-critical); }
|
|
1852
|
+
.icon { flex: none; margin-top: 2px; color: var(--cm-text-attention); }
|
|
1853
|
+
:host([tone='critical']) .icon { color: var(--cm-icon-critical); }
|
|
1854
|
+
:host([tone='information']) .icon, :host([tone='success']) .icon { color: var(--cm-text-default); }
|
|
1855
|
+
.body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
|
|
1856
|
+
.title { margin: 0; font-size: 16px; font-weight: 600; }
|
|
1857
|
+
:host([tone='critical']) .title { color: var(--cm-text-critical); }
|
|
1858
|
+
.actions { display: flex; gap: var(--cm-space-10); margin-top: var(--cm-space-10); }
|
|
1859
|
+
.actions[hidden] { display: none; }
|
|
1860
|
+
.close {
|
|
1861
|
+
flex: none; display: inline-flex; padding: 4px; margin: -4px; background: none; border: 0;
|
|
1862
|
+
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
1863
|
+
}
|
|
1864
|
+
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1865
|
+
`];b("cm-banner",Ei);var Ss='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',S,_i,Ae,Se,ae,Ti,Li,V,Hr,Cs,Ns,Hs,Is,Ai,hn,et,Ir,Rr,ge,zi=class extends u{constructor(){super(...arguments);p(this,V);this.content="";this.placement="top";this.delay=300;this.open=!1;this._side="top";p(this,S);p(this,_i);p(this,Ae,[]);p(this,Se);p(this,ae);p(this,Ti,!1);p(this,Li,!1);p(this,Cs,()=>{v(this,Ti,!0),clearTimeout(s(this,ae)),this.open||v(this,ae,setTimeout(()=>this.show(),this.delay))});p(this,Ns,()=>{v(this,Ti,!1),clearTimeout(s(this,ae)),s(this,Li)||v(this,ae,setTimeout(()=>this.hide(),100))});p(this,Hs,()=>{v(this,Li,!0),this.show()});p(this,Is,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(v(this,Li,!1),s(this,Ti)||this.hide())});p(this,Ai,e=>{e.key==="Escape"&&this.open&&this.hide()});p(this,et,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(c(this,V,Rr).call(this),!t||!this.content)return;let a=t.updateComplete;t.localName.includes("-")&&a&&!t.shadowRoot?.querySelector(Ss)&&a.then(()=>{t.shadowRoot?.querySelector(Ss)&&s(this,et).call(this)}),s(this,S)||(v(this,S,document.createElement("span")),s(this,S).id=w("cm-tooltip"),s(this,S).hidden=!0,s(this,S).slot="description"),s(this,S).textContent=this.content,s(this,S).isConnected||this.append(s(this,S));let n=c(this,V,hn).call(this,t);if(v(this,_i,n),n.getRootNode()===s(this,S).getRootNode()){let d=(n.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);d.includes(s(this,S).id)||n.setAttribute("aria-describedby",[...d,s(this,S).id].join(" "))}else"ariaDescribedByElements"in n?(c(this,V,Ir).call(this,n),v(this,Se,new MutationObserver(()=>{n.getAttribute("aria-describedby")!==""&&c(this,V,Ir).call(this,n)})),s(this,Se).observe(n,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",s(this,S).id)});p(this,ge,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let n=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0]??this).getBoundingClientRect(),d=e.getBoundingClientRect(),h=8,g=8,x=innerWidth,$=innerHeight,y=getComputedStyle(this).direction==="rtl",C=Rs=>Rs==="start"?y?"right":"left":Rs==="end"?y?"left":"right":Rs,O={top:n.top-h-d.height>=g,bottom:n.bottom+h+d.height<=$-g,left:n.left-h-d.width>=g,right:n.right+h+d.width<=x-g},L={top:"bottom",bottom:"top",left:"right",right:"left"},A=C(this.placement);!O[A]&&O[L[A]]&&(A=L[A]);let se,ve;A==="top"||A==="bottom"?(se=n.left+n.width/2-d.width/2,ve=A==="top"?n.top-h-d.height:n.bottom+h):(ve=n.top+n.height/2-d.height/2,se=A==="left"?n.left-h-d.width:n.right+h),se=Math.min(Math.max(g,se),x-g-d.width),ve=Math.min(Math.max(g,ve),$-g-d.height),e.style.transform=`translate(${Math.round(se)}px, ${Math.round(ve)}px)`;let mn={top:"top",bottom:"bottom",left:y?"end":"start",right:y?"start":"end"};this._side=mn[A]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",s(this,Cs)),this.addEventListener("pointerleave",s(this,Ns)),this.addEventListener("focusin",s(this,Hs)),this.addEventListener("focusout",s(this,Is)),this.addEventListener("keydown",s(this,Ai)),this.hasUpdated&&s(this,et).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),c(this,V,Rr).call(this),c(this,V,Hr).call(this),clearTimeout(s(this,ae))}show(){clearTimeout(s(this,ae)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",s(this,Ai),!0),addEventListener("scroll",s(this,ge),!0),addEventListener("resize",s(this,ge)),this.updateComplete.then(s(this,ge)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(s(this,ae)),this.open&&(this.open=!1,c(this,V,Hr).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){e.has("content")&&(s(this,et).call(this),this.content?this.open&&s(this,ge).call(this):this.hide())}render(){return r`<slot @slotchange=${s(this,et)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
1866
|
+
data-side=${this._side}>${this.content}</div>`}};S=new WeakMap,_i=new WeakMap,Ae=new WeakMap,Se=new WeakMap,ae=new WeakMap,Ti=new WeakMap,Li=new WeakMap,V=new WeakSet,Hr=function(){document.removeEventListener("keydown",s(this,Ai),!0),removeEventListener("scroll",s(this,ge),!0),removeEventListener("resize",s(this,ge))},Cs=new WeakMap,Ns=new WeakMap,Hs=new WeakMap,Is=new WeakMap,Ai=new WeakMap,hn=function(e){return e.matches(Ss)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(Ss)??e},et=new WeakMap,Ir=function(e){v(this,Ae,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),a=s(this,Ae).map(n=>t.getElementById(n)).filter(n=>!!n);e.ariaDescribedByElements=[...a,s(this,S)]},Rr=function(){let e=s(this,_i);if(!(!e||!s(this,S))){if(s(this,Se))s(this,Se).disconnect(),v(this,Se,void 0),s(this,Ae).length?e.setAttribute("aria-describedby",s(this,Ae).join(" ")):e.removeAttribute("aria-describedby"),v(this,Ae,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(a=>a&&a!==s(this,S).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}v(this,_i,void 0)}},ge=new WeakMap,zi.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},_side:{state:!0}},zi.styles=[f,m`
|
|
1867
|
+
:host { display: inline-block; position: relative; }
|
|
1868
|
+
.tip {
|
|
1869
|
+
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
1870
|
+
max-width: min(280px, calc(100vw - 16px)); width: max-content;
|
|
1871
|
+
padding: 6px var(--cm-space-10); border-radius: var(--cm-radius-sm);
|
|
1872
|
+
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
1873
|
+
font-size: 12px; line-height: 16px; font-weight: 400; white-space: normal; overflow-wrap: anywhere;
|
|
1874
|
+
box-shadow: var(--cm-shadow-100); pointer-events: auto;
|
|
1875
|
+
opacity: 0; visibility: hidden; transition: opacity 120ms ease;
|
|
1876
|
+
}
|
|
1877
|
+
:host([open]) .tip { opacity: 1; visibility: visible; }
|
|
1878
|
+
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1879
|
+
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1880
|
+
`];b("cm-tooltip",zi);var Si=class extends u{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 r`<span class="box" part="thumbnail"><img src=${this.src} alt=${this.alt} loading=${this.loading}
|
|
1881
|
+
@error=${()=>{this._failed=!0}}></span>`;let e=this.size==="small"?18:this.size==="large"?32:24;return r`<span class="box" part="thumbnail" role=${this.alt?"img":l}
|
|
1882
|
+
aria-label=${this.alt?`${this.alt} (no image)`:l} aria-hidden=${this.alt?l:"true"}>
|
|
1883
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};Si.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},Si.styles=[f,m`
|
|
1884
|
+
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
1885
|
+
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
1886
|
+
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
1887
|
+
.box {
|
|
1888
|
+
display: grid; place-items: center; overflow: hidden; inline-size: var(--_size); block-size: var(--_size);
|
|
1889
|
+
border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-sm);
|
|
1890
|
+
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
1891
|
+
}
|
|
1892
|
+
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
1893
|
+
`];b("cm-thumbnail",Si);export{xt as CmAccordion,bt as CmActionBar,Dt as CmActionMenu,Gt as CmAppCard,Kt as CmAvatar,fi as CmBadge,Ei as CmBanner,Xt as CmBottomNavigation,ri as CmBottomSheet,De as CmButton,gi as CmCard,$e as CmCheckbox,Et as CmComment,Mt as CmCommentBox,Nt as CmDataTable,yt as CmEmptyState,_e as CmFileUpload,ai as CmFilterPanel,Jt as CmFlashOfferBar,yi as CmGrid,Wt as CmHeaderBar,ot as CmIcon,vt as CmInfoItem,gt as CmInfoPanel,$i as CmLayout,wi as CmLayoutSection,Qt as CmLinkTabs,It as CmMenuItem,Zt as CmMobileMenu,ii as CmModal,Ut as CmNavItem,bs as CmNestedItem,jt as CmNestedList,oi as CmNotificationItem,ni as CmNotificationPanel,Ue as CmOptionGroup,ki as CmPage,ut as CmPageHeader,Tt as CmPagination,bi as CmProgressBar,Oe as CmRadio,Pe as CmRadioGroup,Ze as CmReportTile,Vt as CmReportTiles,Ot as CmResourceItem,Pt as CmResourceList,ft as CmSaveBar,ze as CmSearch,Me as CmSelect,Ft as CmSideNavigation,te as CmSidePanel,wt as CmSkeleton,kt as CmSkeletonDisplay,zt as CmSmartTip,_t as CmSmartTips,ui as CmSpinner,xi as CmStack,At as CmStatusTabs,St as CmTableHeader,mt as CmTag,xe as CmTextField,Si as CmThumbnail,di as CmToast,pi as CmToastRegion,ke as CmToggle,zi as CmTooltip,Ko as initials,Bn as showToast};
|
|
1894
|
+
/*! Bundled license information:
|
|
1895
|
+
|
|
1896
|
+
@lit/reactive-element/css-tag.js:
|
|
1897
|
+
(**
|
|
1898
|
+
* @license
|
|
1899
|
+
* Copyright 2019 Google LLC
|
|
1900
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1901
|
+
*)
|
|
1902
|
+
|
|
1903
|
+
@lit/reactive-element/reactive-element.js:
|
|
1904
|
+
(**
|
|
1905
|
+
* @license
|
|
1906
|
+
* Copyright 2017 Google LLC
|
|
1907
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1908
|
+
*)
|
|
1909
|
+
|
|
1910
|
+
lit-html/lit-html.js:
|
|
1911
|
+
(**
|
|
1912
|
+
* @license
|
|
1913
|
+
* Copyright 2017 Google LLC
|
|
1914
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1915
|
+
*)
|
|
1916
|
+
|
|
1917
|
+
lit-element/lit-element.js:
|
|
1918
|
+
(**
|
|
1919
|
+
* @license
|
|
1920
|
+
* Copyright 2017 Google LLC
|
|
1921
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1922
|
+
*)
|
|
1923
|
+
|
|
1924
|
+
lit-html/is-server.js:
|
|
1925
|
+
(**
|
|
1926
|
+
* @license
|
|
1927
|
+
* Copyright 2022 Google LLC
|
|
1928
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1929
|
+
*)
|
|
1930
|
+
|
|
1931
|
+
lit-html/directive.js:
|
|
1932
|
+
(**
|
|
1933
|
+
* @license
|
|
1934
|
+
* Copyright 2017 Google LLC
|
|
1935
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1936
|
+
*)
|
|
1937
|
+
|
|
1938
|
+
lit-html/directive-helpers.js:
|
|
1939
|
+
(**
|
|
1940
|
+
* @license
|
|
1941
|
+
* Copyright 2020 Google LLC
|
|
1942
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1943
|
+
*)
|
|
1944
|
+
|
|
1945
|
+
lit-html/directives/live.js:
|
|
1946
|
+
(**
|
|
1947
|
+
* @license
|
|
1948
|
+
* Copyright 2020 Google LLC
|
|
1949
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1950
|
+
*)
|
|
1951
|
+
|
|
1952
|
+
lit-html/directives/style-map.js:
|
|
1953
|
+
(**
|
|
1954
|
+
* @license
|
|
1955
|
+
* Copyright 2018 Google LLC
|
|
1956
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1957
|
+
*)
|
|
1958
|
+
*/
|