@commmerce/ui 1.0.0-rc.3 → 1.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/base.d.ts +5 -0
- package/dist/base.js +10 -0
- package/dist/calendar.d.ts +95 -0
- package/dist/calendar.js +280 -0
- package/dist/cdn.js +721 -477
- package/dist/components/accordion.js +2 -2
- package/dist/components/action-bar.d.ts +12 -2
- package/dist/components/action-bar.js +10 -5
- package/dist/components/action-menu.d.ts +17 -4
- package/dist/components/action-menu.js +8 -5
- package/dist/components/app-card.d.ts +24 -2
- package/dist/components/app-card.js +25 -10
- package/dist/components/banner.d.ts +2 -2
- package/dist/components/banner.js +4 -3
- package/dist/components/bottom-navigation.d.ts +16 -4
- package/dist/components/bottom-navigation.js +10 -7
- package/dist/components/bottom-sheet.d.ts +4 -1
- package/dist/components/bottom-sheet.js +2 -2
- package/dist/components/checkbox.d.ts +12 -2
- package/dist/components/checkbox.js +7 -2
- package/dist/components/combobox.d.ts +186 -0
- package/dist/components/combobox.js +521 -0
- package/dist/components/comment.d.ts +27 -9
- package/dist/components/comment.js +14 -13
- package/dist/components/data-table.d.ts +14 -2
- package/dist/components/data-table.js +31 -10
- package/dist/components/date-picker.d.ts +179 -0
- package/dist/components/date-picker.js +336 -0
- package/dist/components/date-range-picker.d.ts +251 -0
- package/dist/components/date-range-picker.js +484 -0
- package/dist/components/file-upload.d.ts +30 -4
- package/dist/components/file-upload.js +37 -17
- package/dist/components/filter-panel.d.ts +29 -6
- package/dist/components/filter-panel.js +16 -14
- package/dist/components/flash-offer-bar.d.ts +18 -4
- package/dist/components/flash-offer-bar.js +13 -8
- package/dist/components/header-bar.d.ts +20 -4
- package/dist/components/header-bar.js +20 -13
- package/dist/components/icon.d.ts +7 -0
- package/dist/components/icon.js +9 -1
- package/dist/components/link-tabs.d.ts +16 -4
- package/dist/components/link-tabs.js +10 -7
- package/dist/components/mobile-menu.d.ts +19 -4
- package/dist/components/mobile-menu.js +16 -10
- package/dist/components/modal.d.ts +4 -1
- package/dist/components/nested-list.d.ts +22 -3
- package/dist/components/nested-list.js +25 -12
- package/dist/components/notification-panel.d.ts +26 -5
- package/dist/components/notification-panel.js +17 -11
- package/dist/components/option-group.d.ts +12 -2
- package/dist/components/option-group.js +13 -7
- package/dist/components/page-header.d.ts +18 -2
- package/dist/components/page-header.js +23 -10
- package/dist/components/pagination.d.ts +27 -4
- package/dist/components/pagination.js +28 -16
- package/dist/components/progress-bar.d.ts +12 -2
- package/dist/components/progress-bar.js +9 -4
- package/dist/components/radio.d.ts +12 -1
- package/dist/components/radio.js +12 -6
- package/dist/components/report-tile.d.ts +12 -1
- package/dist/components/report-tile.js +9 -4
- package/dist/components/resource-list.d.ts +36 -5
- package/dist/components/resource-list.js +50 -23
- package/dist/components/save-bar.d.ts +23 -6
- package/dist/components/save-bar.js +14 -12
- package/dist/components/search.d.ts +28 -7
- package/dist/components/search.js +18 -13
- package/dist/components/select.d.ts +12 -2
- package/dist/components/select.js +9 -4
- package/dist/components/side-navigation.d.ts +16 -4
- package/dist/components/side-navigation.js +16 -12
- package/dist/components/side-panel.d.ts +5 -2
- package/dist/components/side-panel.js +5 -3
- package/dist/components/skeleton-display.d.ts +6 -4
- package/dist/components/skeleton-display.js +4 -5
- package/dist/components/smart-tip.d.ts +25 -6
- package/dist/components/smart-tip.js +18 -12
- package/dist/components/spinner.d.ts +4 -3
- package/dist/components/spinner.js +5 -6
- package/dist/components/status-tabs.d.ts +12 -2
- package/dist/components/status-tabs.js +14 -8
- package/dist/components/table-header.d.ts +15 -2
- package/dist/components/table-header.js +13 -5
- package/dist/components/tag.d.ts +12 -2
- package/dist/components/tag.js +9 -4
- package/dist/components/text-field.d.ts +12 -2
- package/dist/components/text-field.js +9 -4
- package/dist/components/thumbnail.d.ts +12 -2
- package/dist/components/thumbnail.js +8 -3
- package/dist/components/toast.d.ts +14 -3
- package/dist/components/toast.js +20 -9
- package/dist/components/toggle.js +2 -0
- package/dist/custom-elements.json +16477 -6434
- package/dist/index.d.ts +7 -1
- package/dist/index.js +5 -1
- package/dist/localize.d.ts +130 -0
- package/dist/localize.js +232 -0
- package/dist/overlay.d.ts +8 -4
- package/dist/overlay.js +9 -12
- package/package.json +4 -4
package/dist/cdn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
var jo=a=>{throw TypeError(a)};var $n=(a,i,e)=>i.has(a)||jo("Cannot "+e);var r=(a,i,e)=>($n(a,i,"read from private field"),e?e.call(a):i.get(a)),h=(a,i,e)=>i.has(a)?jo("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(a):i.set(a,e),g=(a,i,e,t)=>($n(a,i,"write to private field"),t?t.call(a,e):i.set(a,e),e),l=(a,i,e)=>($n(a,i,"access private method"),e);var Dr=globalThis,Nr=Dr.ShadowRoot&&(Dr.ShadyCSS===void 0||Dr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wn=Symbol(),Bo=new WeakMap,ks=class{constructor(i,e,t){if(this._$cssResult$=!0,t!==wn)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(Nr&&i===void 0){let t=e!==void 0&&e.length===1;t&&(i=Bo.get(e)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),t&&Bo.set(e,i))}return i}toString(){return this.cssText}},Ir=a=>new ks(typeof a=="string"?a:a+"",void 0,wn),m=(a,...i)=>{let e=a.length===1?a[0]:i.reduce((t,s,o)=>t+(d=>{if(d._$cssResult$===!0)return d.cssText;if(typeof d=="number")return d;throw Error("Value passed to 'css' function must be a 'css' function result: "+d+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+a[o+1],a[0]);return new ks(e,a,wn)},Fo=(a,i)=>{if(Nr)a.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of i){let t=document.createElement("style"),s=Dr.litNonce;s!==void 0&&t.setAttribute("nonce",s),t.textContent=e.cssText,a.appendChild(t)}},kn=Nr?a=>a:a=>a instanceof CSSStyleSheet?(i=>{let e="";for(let t of i.cssRules)e+=t.cssText;return Ir(e)})(a):a;var{is:_c,defineProperty:zc,getOwnPropertyDescriptor:Tc,getOwnPropertyNames:Lc,getOwnPropertySymbols:Sc,getPrototypeOf:Cc}=Object,Rr=globalThis,Vo=Rr.trustedTypes,Ac=Vo?Vo.emptyScript:"",Dc=Rr.reactiveElementPolyfillSupport,Es=(a,i)=>a,En={toAttribute(a,i){switch(i){case Boolean:a=a?Ac:null;break;case Object:case Array:a=a==null?a:JSON.stringify(a)}return a},fromAttribute(a,i){let e=a;switch(i){case Boolean:e=a!==null;break;case Number:e=a===null?null:Number(a);break;case Object:case Array:try{e=JSON.parse(a)}catch{e=null}}return e}},Ko=(a,i)=>!_c(a,i),Uo={attribute:!0,type:String,converter:En,reflect:!1,useDefault:!1,hasChanged:Ko};Symbol.metadata??=Symbol("metadata"),Rr.litPropertyMetadata??=new WeakMap;var Ee=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=Uo){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(i)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(i,e),!e.noAccessor){let t=Symbol(),s=this.getPropertyDescriptor(i,t,e);s!==void 0&&zc(this.prototype,i,s)}}static getPropertyDescriptor(i,e,t){let{get:s,set:o}=Tc(this.prototype,i)??{get(){return this[e]},set(d){this[e]=d}};return{get:s,set(d){let p=s?.call(this);o?.call(this,d),this.requestUpdate(i,p,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(i){return this.elementProperties.get(i)??Uo}static _$Ei(){if(this.hasOwnProperty(Es("elementProperties")))return;let i=Cc(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties)}static finalize(){if(this.hasOwnProperty(Es("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Es("properties"))){let e=this.properties,t=[...Lc(e),...Sc(e)];for(let s of t)this.createProperty(s,e[s])}let i=this[Symbol.metadata];if(i!==null){let e=litPropertyMetadata.get(i);if(e!==void 0)for(let[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let s=this._$Eu(e,t);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(i){let e=[];if(Array.isArray(i)){let t=new Set(i.flat(1/0).reverse());for(let s of t)e.unshift(kn(s))}else i!==void 0&&e.push(kn(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 Fo(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(i=>i.hostConnected?.())}enableUpdating(i){}disconnectedCallback(){this._$EO?.forEach(i=>i.hostDisconnected?.())}attributeChangedCallback(i,e,t){this._$AK(i,t)}_$ET(i,e){let t=this.constructor.elementProperties.get(i),s=this.constructor._$Eu(i,t);if(s!==void 0&&t.reflect===!0){let o=(t.converter?.toAttribute!==void 0?t.converter:En).toAttribute(e,t.type);this._$Em=i,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(i,e){let t=this.constructor,s=t._$Eh.get(i);if(s!==void 0&&this._$Em!==s){let o=t.getPropertyOptions(s),d=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:En;this._$Em=s;let p=d.fromAttribute(e,o.type);this[s]=p??this._$Ej?.get(s)??p,this._$Em=null}}requestUpdate(i,e,t,s=!1,o){if(i!==void 0){let d=this.constructor;if(s===!1&&(o=this[i]),t??=d.getPropertyOptions(i),!((t.hasChanged??Ko)(o,e)||t.useDefault&&t.reflect&&o===this._$Ej?.get(i)&&!this.hasAttribute(d._$Eu(i,t))))return;this.C(i,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(i,e,{useDefault:t,reflect:s,wrapped:o},d){t&&!(this._$Ej??=new Map).has(i)&&(this._$Ej.set(i,d??e??this[i]),o!==!0||d!==void 0)||(this._$AL.has(i)||(this.hasUpdated||t||(e=void 0),this._$AL.set(i,e)),s===!0&&this._$Em!==i&&(this._$Eq??=new Set).add(i))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[s,o]of t){let{wrapped:d}=o,p=this[s];d!==!0||this._$AL.has(s)||p===void 0||this.C(s,void 0,o,p)}}let i=!1,e=this._$AL;try{i=this.shouldUpdate(e),i?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw i=!1,this._$EM(),t}i&&this._$AE(e)}willUpdate(i){}_$AE(i){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(i)),this.updated(i)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(i){return!0}update(i){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(i){}firstUpdated(i){}};Ee.elementStyles=[],Ee.shadowRootOptions={mode:"open"},Ee[Es("elementProperties")]=new Map,Ee[Es("finalized")]=new Map,Dc?.({ReactiveElement:Ee}),(Rr.reactiveElementVersions??=[]).push("2.1.2");var _n=globalThis,Wo=a=>a,Hr=_n.trustedTypes,Yo=Hr?Hr.createPolicy("lit-html",{createHTML:a=>a}):void 0,zn="$lit$",Me=`lit$${Math.random().toFixed(9).slice(2)}$`,Tn="?"+Me,Nc=`<${Tn}>`,ot=document,_s=()=>ot.createComment(""),zs=a=>a===null||typeof a!="object"&&typeof a!="function",Ln=Array.isArray,el=a=>Ln(a)||typeof a?.[Symbol.iterator]=="function",Mn=`[
|
|
2
|
+
\f\r]`,Ms=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Go=/-->/g,Xo=/>/g,at=RegExp(`>|${Mn}(?:([^\\s"'>=/]+)(${Mn}*=${Mn}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Jo=/'/g,Zo=/"/g,tl=/^(?:script|style|textarea|title)$/i,Sn=a=>(i,...e)=>({_$litType$:a,strings:i,values:e}),n=Sn(1),Ls=Sn(2),fd=Sn(3),J=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Qo=new WeakMap,nt=ot.createTreeWalker(ot,129);function il(a,i){if(!Ln(a)||!a.hasOwnProperty("raw"))throw Error("invalid template strings array");return Yo!==void 0?Yo.createHTML(i):i}var sl=(a,i)=>{let e=a.length-1,t=[],s,o=i===2?"<svg>":i===3?"<math>":"",d=Ms;for(let p=0;p<e;p++){let b=a[p],w,y,v=-1,A=0;for(;A<b.length&&(d.lastIndex=A,y=d.exec(b),y!==null);)A=d.lastIndex,d===Ms?y[1]==="!--"?d=Go:y[1]!==void 0?d=Xo:y[2]!==void 0?(tl.test(y[2])&&(s=RegExp("</"+y[2],"g")),d=at):y[3]!==void 0&&(d=at):d===at?y[0]===">"?(d=s??Ms,v=-1):y[1]===void 0?v=-2:(v=d.lastIndex-y[2].length,w=y[1],d=y[3]===void 0?at:y[3]==='"'?Zo:Jo):d===Zo||d===Jo?d=at:d===Go||d===Xo?d=Ms:(d=at,s=void 0);let M=d===at&&a[p+1].startsWith("/>")?" ":"";o+=d===Ms?b+Nc:v>=0?(t.push(w),b.slice(0,v)+zn+b.slice(v)+Me+M):b+Me+(v===-2?p:M)}return[il(a,o+(a[e]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),t]},Ts=class a{constructor({strings:i,_$litType$:e},t){let s;this.parts=[];let o=0,d=0,p=i.length-1,b=this.parts,[w,y]=sl(i,e);if(this.el=a.createElement(w,t),nt.currentNode=this.el.content,e===2||e===3){let v=this.el.content.firstChild;v.replaceWith(...v.childNodes)}for(;(s=nt.nextNode())!==null&&b.length<p;){if(s.nodeType===1){if(s.hasAttributes())for(let v of s.getAttributeNames())if(v.endsWith(zn)){let A=y[d++],M=s.getAttribute(v).split(Me),S=/([.?@])?(.*)/.exec(A);b.push({type:1,index:o,name:S[2],strings:M,ctor:S[1]==="."?Or:S[1]==="?"?Pr:S[1]==="@"?jr:ct}),s.removeAttribute(v)}else v.startsWith(Me)&&(b.push({type:6,index:o}),s.removeAttribute(v));if(tl.test(s.tagName)){let v=s.textContent.split(Me),A=v.length-1;if(A>0){s.textContent=Hr?Hr.emptyScript:"";for(let M=0;M<A;M++)s.append(v[M],_s()),nt.nextNode(),b.push({type:2,index:++o});s.append(v[A],_s())}}}else if(s.nodeType===8)if(s.data===Tn)b.push({type:2,index:o});else{let v=-1;for(;(v=s.data.indexOf(Me,v+1))!==-1;)b.push({type:7,index:o}),v+=Me.length-1}o++}}static createElement(i,e){let t=ot.createElement("template");return t.innerHTML=i,t}};function lt(a,i,e=a,t){if(i===J)return i;let s=t!==void 0?e._$Co?.[t]:e._$Cl,o=zs(i)?void 0:i._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),o===void 0?s=void 0:(s=new o(a),s._$AT(a,e,t)),t!==void 0?(e._$Co??=[])[t]=s:e._$Cl=s),s!==void 0&&(i=lt(a,s._$AS(a,i.values),s,t)),i}var qr=class{constructor(i,e){this._$AV=[],this._$AN=void 0,this._$AD=i,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(i){let{el:{content:e},parts:t}=this._$AD,s=(i?.creationScope??ot).importNode(e,!0);nt.currentNode=s;let o=nt.nextNode(),d=0,p=0,b=t[0];for(;b!==void 0;){if(d===b.index){let w;b.type===2?w=new Ct(o,o.nextSibling,this,i):b.type===1?w=new b.ctor(o,b.name,b.strings,this,i):b.type===6&&(w=new Br(o,this,i)),this._$AV.push(w),b=t[++p]}d!==b?.index&&(o=nt.nextNode(),d++)}return nt.currentNode=ot,s}p(i){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(i,t,e),e+=t.strings.length-2):t._$AI(i[e])),e++}},Ct=class a{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(i,e,t,s){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=i,this._$AB=e,this._$AM=t,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let i=this._$AA.parentNode,e=this._$AM;return e!==void 0&&i?.nodeType===11&&(i=e.parentNode),i}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(i,e=this){i=lt(this,i,e),zs(i)?i===c||i==null||i===""?(this._$AH!==c&&this._$AR(),this._$AH=c):i!==this._$AH&&i!==J&&this._(i):i._$litType$!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):el(i)?this.k(i):this._(i)}O(i){return this._$AA.parentNode.insertBefore(i,this._$AB)}T(i){this._$AH!==i&&(this._$AR(),this._$AH=this.O(i))}_(i){this._$AH!==c&&zs(this._$AH)?this._$AA.nextSibling.data=i:this.T(ot.createTextNode(i)),this._$AH=i}$(i){let{values:e,_$litType$:t}=i,s=typeof t=="number"?this._$AC(i):(t.el===void 0&&(t.el=Ts.createElement(il(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===s)this._$AH.p(e);else{let o=new qr(s,this),d=o.u(this.options);o.p(e),this.T(d),this._$AH=o}}_$AC(i){let e=Qo.get(i.strings);return e===void 0&&Qo.set(i.strings,e=new Ts(i)),e}k(i){Ln(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,s=0;for(let o of i)s===e.length?e.push(t=new a(this.O(_s()),this.O(_s()),this,this.options)):t=e[s],t._$AI(o),s++;s<e.length&&(this._$AR(t&&t._$AB.nextSibling,s),e.length=s)}_$AR(i=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);i!==this._$AB;){let t=Wo(i).nextSibling;Wo(i).remove(),i=t}}setConnected(i){this._$AM===void 0&&(this._$Cv=i,this._$AP?.(i))}},ct=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(i,e,t,s,o){this.type=1,this._$AH=c,this._$AN=void 0,this.element=i,this.name=e,this._$AM=s,this.options=o,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=c}_$AI(i,e=this,t,s){let o=this.strings,d=!1;if(o===void 0)i=lt(this,i,e,0),d=!zs(i)||i!==this._$AH&&i!==J,d&&(this._$AH=i);else{let p=i,b,w;for(i=o[0],b=0;b<o.length-1;b++)w=lt(this,p[t+b],e,b),w===J&&(w=this._$AH[b]),d||=!zs(w)||w!==this._$AH[b],w===c?i=c:i!==c&&(i+=(w??"")+o[b+1]),this._$AH[b]=w}d&&!s&&this.j(i)}j(i){i===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"")}},Or=class extends ct{constructor(){super(...arguments),this.type=3}j(i){this.element[this.name]=i===c?void 0:i}},Pr=class extends ct{constructor(){super(...arguments),this.type=4}j(i){this.element.toggleAttribute(this.name,!!i&&i!==c)}},jr=class extends ct{constructor(i,e,t,s,o){super(i,e,t,s,o),this.type=5}_$AI(i,e=this){if((i=lt(this,i,e,0)??c)===J)return;let t=this._$AH,s=i===c&&t!==c||i.capture!==t.capture||i.once!==t.once||i.passive!==t.passive,o=i!==c&&(t===c||s);s&&this.element.removeEventListener(this.name,this,t),o&&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)}},Br=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){lt(this,i)}},rl={M:zn,P:Me,A:Tn,C:1,L:sl,R:qr,D:el,V:lt,I:Ct,H:ct,N:Pr,U:jr,B:Or,F:Br},Ic=_n.litHtmlPolyfillSupport;Ic?.(Ts,Ct),(_n.litHtmlVersions??=[]).push("3.3.3");var al=(a,i,e)=>{let t=e?.renderBefore??i,s=t._$litPart$;if(s===void 0){let o=e?.renderBefore??null;t._$litPart$=s=new Ct(i.insertBefore(_s(),o),o,void 0,e??{})}return s._$AI(a),s};var Cn=globalThis,k=class extends Ee{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=al(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return J}};k._$litElement$=!0,k.finalized=!0,Cn.litElementHydrateSupport?.({LitElement:k});var Rc=Cn.litElementPolyfillSupport;Rc?.({LitElement:k});(Cn.litElementVersions??=[]).push("4.2.2");var f=m`
|
|
4
4
|
:host {
|
|
5
5
|
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
6
|
color: var(--cm-text-default, #000);
|
|
@@ -8,13 +8,13 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
`,
|
|
11
|
+
`,Sd=m`
|
|
12
12
|
outline: 2px solid var(--cm-border-strong);
|
|
13
13
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
15
|
-
rel=${this.target==="_blank"?"noopener noreferrer":
|
|
16
|
-
?disabled=${this.disabled} aria-disabled=${this.loading?"true":
|
|
17
|
-
aria-busy=${this.loading?"true":
|
|
14
|
+
`,Hc=0,T=a=>`${a}-${++Hc}`;function u(a,i){customElements.get(a)||customElements.define(a,i)}function ae(a,i){let e=a.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(i).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Fr,Vr,dt=class extends k{constructor(){super();this.variant="secondary";this.size="medium";this.type="button";this.disabled=!1;this.loading=!1;h(this,Fr,this.attachInternals());h(this,Vr,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,Fr).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});this.addEventListener("click",r(this,Vr),{capture:!0})}render(){let e=n`${this.loading?n`<span class="spinner" aria-hidden="true"></span>`:n`<slot name="icon"></slot>`}<slot></slot>`;return this.href&&!this.disabled?n`<a class="btn" part="control" href=${this.href} target=${this.target??c}
|
|
15
|
+
rel=${this.target==="_blank"?"noopener noreferrer":c}>${e}</a>`:n`<button class="btn" part="control" type="button"
|
|
16
|
+
?disabled=${this.disabled} aria-disabled=${this.loading?"true":c}
|
|
17
|
+
aria-busy=${this.loading?"true":c}>${e}</button>`}};Fr=new WeakMap,Vr=new WeakMap,dt.formAssociated=!0,dt.properties={variant:{reflect:!0},size:{reflect:!0},type:{},disabled:{type:Boolean,reflect:!0},loading:{type:Boolean,reflect:!0},href:{},target:{}},dt.styles=[f,m`
|
|
18
18
|
:host { display: inline-flex; vertical-align: middle; }
|
|
19
19
|
.btn {
|
|
20
20
|
display: inline-flex; align-items: center; justify-content: center; gap: 6px;
|
|
@@ -43,26 +43,26 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
43
43
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
44
44
|
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
|
|
45
45
|
::slotted([slot='icon']) { display: inline-flex; }
|
|
46
|
-
`];
|
|
47
|
-
.value=${
|
|
46
|
+
`];u("cm-button",dt);var _e={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ur=a=>(...i)=>({_$litDirective$:a,values:i}),At=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:qd}=rl;var nl=a=>a.strings===void 0;var qc={},ol=(a,i=qc)=>a._$AH=i;var me=Ur(class extends At{constructor(a){if(super(a),a.type!==_e.PROPERTY&&a.type!==_e.ATTRIBUTE&&a.type!==_e.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!nl(a))throw Error("`live` bindings can only contain a single expression")}render(a){return a}update(a,[i]){if(i===J||i===c)return i;let e=a.element,t=a.name;if(a.type===_e.PROPERTY){if(i===e[t])return J}else if(a.type===_e.BOOLEAN_ATTRIBUTE){if(!!i===e.hasAttribute(t))return J}else if(a.type===_e.ATTRIBUTE&&e.getAttribute(t)===i+"")return J;return ol(a),i}});var Oc={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},Kr={common:{...Oc}},Ss={},Cs={},Wr;function $(a,i){return Kr[a]={...Kr[a],...i},i}function Pc(){return Object.fromEntries(Object.entries(Kr).map(([a,i])=>[a,{...i}]))}function Yr(a,i){for(let[e,t]of Object.entries(i??{}))t&&typeof t=="object"&&(a[e]={...a[e],...t})}function jc(a,i){Yr(i?Cs[i.toLowerCase()]??={}:Ss,a),Xr()}function Bc(a={}){"locale"in a&&(Wr=a.locale||void 0),a.strings&&Yr(Ss,a.strings);for(let[i,e]of Object.entries(a.translations??{}))Yr(Cs[i.toLowerCase()]??={},e);Xr()}function Fc(){Wr=void 0;for(let a of Object.keys(Ss))delete Ss[a];for(let a of Object.keys(Cs))delete Cs[a];Xr()}function As(a){if(Wr)return Wr;let i=a;for(;i;){if(i instanceof Element&&i.hasAttribute("lang")&&i.getAttribute("lang"))return i.getAttribute("lang");i=i.parentNode??(i instanceof ShadowRoot?i.host:null)}if(typeof document<"u"&&document.documentElement.lang)return document.documentElement.lang}var ll=new Map;function Nn(a,i,e,t){let s=`${a}|${i??""}|${JSON.stringify(e)}`,o=ll.get(s);if(!o){try{o=t(i)}catch{o=t(void 0)}ll.set(s,o)}return o}function In(a,i={},e){return Nn("n",e,i,t=>new Intl.NumberFormat(t,i)).format(a)}function ge(a,i={},e){return Nn("d",e,i,t=>new Intl.DateTimeFormat(t,i)).format(a)}function Gr(a,i){return Nn("p",i,{},e=>new Intl.PluralRules(e)).select(a)}function cl(a,i={},e){if(a==null)return"";if(typeof a=="function")return String(a(i));let t;if(typeof a=="object"){let s=Number(i.count??0);t=a[Gr(s,e)]??a.other??""}else t=String(a);return t.replace(/\{(\w+)\}/g,(s,o)=>{let d=i[o];return d===void 0?s:typeof d=="number"?In(d,{},e):String(d)})}function Vc(a,i,e,t){if(t&&t[i]!==void 0)return t[i];let s=[];if(e){let o=e.toLowerCase().split("-");for(let d=o.length;d>0;d--)s.push(o.slice(0,d).join("-"))}for(let o of a==="common"?["common"]:[a,"common"]){for(let p of s){let b=Cs[p]?.[o]?.[i];if(b!==void 0)return b}let d=Ss[o]?.[i]??Kr[o]?.[i];if(d!==void 0)return d}}function dl(a,i,e,t,s){let o=As(t);return cl(Vc(a,i,o,s),e,o)}var Dn=new Set,An;function Xr(){for(let a of Dn)a.requestUpdate()}function Uc(){An||typeof MutationObserver>"u"||typeof document>"u"||(An=new MutationObserver(Xr),An.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var Kc=a=>a.replace(/^cm-/,"").replace(/-([a-z])/g,(i,e)=>e.toUpperCase()),x=class extends k{static finalize(){let i=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);if(!i(this,"finalized")&&i(this,"properties"))for(let[e,t]of Object.entries(this.properties)){let s=t.string;if(!s||i(this.prototype,e))continue;let o=Symbol(e);Object.defineProperty(this.prototype,e,{get(){return this[o]??this.t(s)},set(d){this[o]=d},configurable:!0,enumerable:!0})}super.finalize()}get stringsNamespace(){return Kc(this.localName)}t(i,e){return dl(this.stringsNamespace,i,e,this,this.strings)}get locale(){return As(this)}formatNumber(i,e){return In(i,e,this.locale)}connectedCallback(){super.connectedCallback(),Dn.add(this),Uc()}disconnectedCallback(){super.disconnectedCallback(),Dn.delete(this)}};x.properties={strings:{type:Object}};var Qd=$("textField",{required:"Please fill in this field."}),ne,ze,Ds,Pe,Rn,Hn,Oe=class extends x{constructor(){super(...arguments);h(this,Pe);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.type="text";this.multiline=!1;this.rows=4;this.required=!1;this.disabled=!1;this.readonly=!1;this.size="default";h(this,ne,this.attachInternals());h(this,ze,T("cm-tf"));h(this,Ds,"")}connectedCallback(){super.connectedCallback(),g(this,Ds,this.value)}get form(){return r(this,ne).form}get validity(){return r(this,ne).validity}get validationMessage(){return r(this,ne).validationMessage}checkValidity(){return r(this,ne).checkValidity()}reportValidity(){return r(this,ne).reportValidity()}formResetCallback(){this.value=r(this,Ds),this.error=""}formDisabledCallback(e){this.disabled=e}updated(){r(this,ne).setFormValue(this.value);let e=this.renderRoot.querySelector(".input");this.error?r(this,ne).setValidity({customError:!0},this.error,e??void 0):this.required&&!this.value?r(this,ne).setValidity({valueMissing:!0},this.t("required"),e??void 0):r(this,ne).setValidity({})}render(){let e=[this.error&&`${r(this,ze)}-err`,this.helpText&&`${r(this,ze)}-help`].filter(Boolean).join(" ")||c,t={id:r(this,ze),invalid:this.error?"true":c},s=this.multiline?n`<textarea class="input" part="input" id=${t.id} rows=${this.rows}
|
|
47
|
+
.value=${me(this.value)} placeholder=${this.placeholder||c}
|
|
48
48
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
49
49
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
50
|
-
@input=${
|
|
51
|
-
.value=${
|
|
52
|
-
autocomplete=${this.autocomplete??
|
|
50
|
+
@input=${l(this,Pe,Rn)} @change=${l(this,Pe,Hn)}></textarea>`:n`<input class="input" part="input" id=${t.id} type=${this.type}
|
|
51
|
+
.value=${me(this.value)} placeholder=${this.placeholder||c}
|
|
52
|
+
autocomplete=${this.autocomplete??c}
|
|
53
53
|
?required=${this.required} ?disabled=${this.disabled} ?readonly=${this.readonly}
|
|
54
54
|
aria-invalid=${t.invalid} aria-describedby=${e}
|
|
55
|
-
@input=${
|
|
56
|
-
${this.label?
|
|
57
|
-
${
|
|
58
|
-
${this.error?
|
|
59
|
-
${this.helpText?
|
|
60
|
-
</div>`}};
|
|
55
|
+
@input=${l(this,Pe,Rn)} @change=${l(this,Pe,Hn)} />`;return n`<div class="field">
|
|
56
|
+
${this.label?n`<label for=${r(this,ze)} part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}${this.hint?n`<span class="hint">[${this.hint}]</span>`:c}</label>`:c}
|
|
57
|
+
${s}
|
|
58
|
+
${this.error?n`<p class="error" id="${r(this,ze)}-err" role="alert">${this.error}</p>`:c}
|
|
59
|
+
${this.helpText?n`<p class="help" id="${r(this,ze)}-help">${this.helpText}</p>`:c}
|
|
60
|
+
</div>`}};ne=new WeakMap,ze=new WeakMap,Ds=new WeakMap,Pe=new WeakSet,Rn=function(e){this.value=e.target.value},Hn=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Oe.formAssociated=!0,Oe.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Oe.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}},Oe.styles=[f,m`
|
|
61
61
|
:host { display: block; }
|
|
62
62
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
63
63
|
label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
64
|
-
.req { color: var(--cm-text-critical); margin-
|
|
65
|
-
.hint { margin-
|
|
64
|
+
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
65
|
+
.hint { margin-inline-start: var(--cm-space-10); font-size: 12px; color: var(--cm-text-tertiary); text-transform: lowercase; }
|
|
66
66
|
.input {
|
|
67
67
|
width: 100%; height: 42px; padding: 0 var(--cm-space-10);
|
|
68
68
|
font: inherit; font-size: 16px; color: var(--cm-text-default);
|
|
@@ -80,13 +80,13 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
80
80
|
:host([size='small']) .field { gap: 6px; }
|
|
81
81
|
:host([size='small']) label { font-size: 12px; }
|
|
82
82
|
:host([size='small']) .input { font-size: 14px; }
|
|
83
|
-
`];
|
|
84
|
-
<input type="checkbox" id=${
|
|
83
|
+
`];u("cm-text-field",Oe);var ah=$("checkbox",{required:"Please tick this box."}),Be,ht,Ns,Jr,hl,je=class extends x{constructor(){super(...arguments);h(this,Jr);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;h(this,Be,this.attachInternals());h(this,ht,T("cm-cb"));h(this,Ns,!1)}connectedCallback(){super.connectedCallback(),g(this,Ns,this.checked)}get form(){return r(this,Be).form}checkValidity(){return r(this,Be).checkValidity()}formResetCallback(){this.checked=r(this,Ns)}formDisabledCallback(e){this.disabled=e}updated(){r(this,Be).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,Be).setValidity({valueMissing:!0},this.t("required")):r(this,Be).setValidity({})}render(){let e=this.indeterminate?n`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6h8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`:n`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6.2 4.8 9 10 3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;return n`<label for=${r(this,ht)}>
|
|
84
|
+
<input type="checkbox" id=${r(this,ht)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
85
85
|
?disabled=${this.disabled} ?required=${this.required}
|
|
86
|
-
aria-describedby=${this.description?`${
|
|
86
|
+
aria-describedby=${this.description?`${r(this,ht)}-d`:c} @change=${l(this,Jr,hl)} />
|
|
87
87
|
<span class="box" part="box">${e}</span>
|
|
88
|
-
${this.label||this.description?
|
|
89
|
-
</label>`}};
|
|
88
|
+
${this.label||this.description?n`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?n`<span class="desc" id="${r(this,ht)}-d">${this.description}</span>`:c}</span>`:n`<slot></slot>`}
|
|
89
|
+
</label>`}};Be=new WeakMap,ht=new WeakMap,Ns=new WeakMap,Jr=new WeakSet,hl=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},je.formAssociated=!0,je.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},je.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},je.styles=[f,m`
|
|
90
90
|
:host { display: inline-flex; }
|
|
91
91
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; }
|
|
92
92
|
input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; cursor: inherit; }
|
|
@@ -103,12 +103,12 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
103
103
|
:host([disabled]) label { cursor: not-allowed; }
|
|
104
104
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
105
105
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
106
|
-
`];
|
|
107
|
-
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":
|
|
108
|
-
aria-describedby=${e??
|
|
106
|
+
`];u("cm-checkbox",je);var Is,mt=class extends k{constructor(){super(...arguments);this.label="";this.description="";this.value="";this.checked=!1;this.disabled=!1;this.groupDisabled=!1;this._tabbable=!1;h(this,Is,T("cm-radio"))}render(){let e=this.description?`${r(this,Is)}-d`:null;return n`<div class="radio" part="radio" role="radio" id=${r(this,Is)}
|
|
107
|
+
aria-checked=${this.checked?"true":"false"} aria-disabled=${this.disabled||this.groupDisabled?"true":c}
|
|
108
|
+
aria-describedby=${e??c} tabindex=${this._tabbable&&!this.disabled&&!this.groupDisabled?"0":"-1"}>
|
|
109
109
|
<span class="dot" part="dot"></span>
|
|
110
|
-
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?
|
|
111
|
-
</div>`}};
|
|
110
|
+
<span class="text"><span class="label">${this.label}<slot></slot></span>${e?n`<span class="desc" id=${e}>${this.description}</span>`:c}</span>
|
|
111
|
+
</div>`}};Is=new WeakMap,mt.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},mt.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}},mt.styles=[f,m`
|
|
112
112
|
:host { display: inline-flex; }
|
|
113
113
|
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; outline: none; }
|
|
114
114
|
.dot {
|
|
@@ -128,31 +128,31 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
128
128
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
129
129
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-default); }
|
|
130
130
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
131
|
-
`];
|
|
132
|
-
aria-labelledby=${
|
|
133
|
-
aria-describedby=${e||
|
|
134
|
-
aria-required=${this.required?"true":
|
|
135
|
-
aria-disabled=${this.disabled?"true":
|
|
136
|
-
<span class="label" id="${
|
|
137
|
-
${this.helpText?
|
|
138
|
-
${this.error?
|
|
139
|
-
<div class="options" part="options"><slot @slotchange=${
|
|
140
|
-
</div>`}};
|
|
131
|
+
`];u("cm-radio",mt);var hh=$("radioGroup",{required:"Please select one of these options."}),oe,Te,Rs,Hs,qs,Dt,H,qn,Qr,pt,On,Nt,Pn,ea,ta,Zr,ut=class extends x{constructor(){super();h(this,H);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;h(this,oe,this.attachInternals());h(this,Te,T("cm-rg"));h(this,Rs,"");h(this,Hs,!0);h(this,qs,!1);h(this,Dt,!1);h(this,Qr,()=>{l(this,H,qn).call(this),r(this,Nt).call(this)});h(this,Nt,()=>{let e=l(this,H,pt).call(this),t=!1;for(let o of e)o.checked=!!this.value&&o.value===this.value&&!t,o.checked&&(t=!0),o.groupDisabled=this.disabled;let s=e.find(o=>o.checked&&!o.disabled)??l(this,H,On).call(this)[0];for(let o of e)o._tabbable=o===s&&!this.disabled});h(this,ea,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||l(this,H,Pn).call(this,t,!0)});h(this,ta,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let s=l(this,H,On).call(this),o=s.indexOf(t),d=ae(e,this),p;if(e.key==="ArrowDown"||d==="ArrowRight")p=s[(o+1)%s.length];else if(e.key==="ArrowUp"||d==="ArrowLeft")p=s[(o-1+s.length)%s.length];else if(e.key===" ")p=t.disabled?void 0:t;else return;e.preventDefault(),p&&l(this,H,Pn).call(this,p,!0)});this.addEventListener("keydown",r(this,ta)),this.addEventListener("click",r(this,ea))}connectedCallback(){super.connectedCallback(),l(this,H,qn).call(this)}get form(){return r(this,oe).form}get validity(){return r(this,oe).validity}get validationMessage(){return r(this,oe).validationMessage}checkValidity(){return r(this,oe).checkValidity()}reportValidity(){return r(this,oe).reportValidity()}formResetCallback(){this.value=r(this,Rs)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(l(this,H,pt).call(this).find(t=>t._tabbable)??l(this,H,pt).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,qs)&&!r(this,Dt)&&g(this,Hs,!1),g(this,qs,!0),r(this,Nt).call(this),r(this,oe).setFormValue(this.value||null,this.value);let t=l(this,H,pt).call(this)[0];this.error?r(this,oe).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,oe).setValidity({valueMissing:!0},this.t("required"),t):r(this,oe).setValidity({})}render(){let e=[this.error&&`${r(this,Te)}-err`,this.helpText&&`${r(this,Te)}-help`].filter(Boolean).join(" ");return n`<div class="group" role="radiogroup" part="group"
|
|
132
|
+
aria-labelledby=${l(this,H,Zr).call(this)?`${r(this,Te)}-l`:c} aria-label=${l(this,H,Zr).call(this)?c:this.getAttribute("aria-label")??c}
|
|
133
|
+
aria-describedby=${e||c}
|
|
134
|
+
aria-required=${this.required?"true":c} aria-invalid=${this.error?"true":c}
|
|
135
|
+
aria-disabled=${this.disabled?"true":c}>
|
|
136
|
+
<span class="label" id="${r(this,Te)}-l" part="label" ?hidden=${!l(this,H,Zr).call(this)}>${this.label}<slot name="label"></slot>${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>
|
|
137
|
+
${this.helpText?n`<p class="help" id="${r(this,Te)}-help">${this.helpText}</p>`:c}
|
|
138
|
+
${this.error?n`<p class="error" id="${r(this,Te)}-err" role="alert">${this.error}</p>`:c}
|
|
139
|
+
<div class="options" part="options"><slot @slotchange=${r(this,Qr)}></slot></div>
|
|
140
|
+
</div>`}};oe=new WeakMap,Te=new WeakMap,Rs=new WeakMap,Hs=new WeakMap,qs=new WeakMap,Dt=new WeakMap,H=new WeakSet,qn=function(){r(this,Hs)&&(this.value||(g(this,Dt,!0),this.value=l(this,H,pt).call(this).find(e=>e.hasAttribute("checked"))?.getAttribute("value")??"",this.updateComplete.then(()=>g(this,Dt,!1))),g(this,Rs,this.value))},Qr=new WeakMap,pt=function(){return[...this.querySelectorAll("cm-radio")]},On=function(){return l(this,H,pt).call(this).filter(e=>!e.disabled&&!this.disabled)},Nt=new WeakMap,Pn=function(e,t){t&&e.focus(),e.value!==this.value&&(this.value=e.value,r(this,Nt).call(this),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},ea=new WeakMap,ta=new WeakMap,Zr=function(){return!!this.label||!!this.querySelector("[slot=label]")},ut.formAssociated=!0,ut.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}},ut.styles=[f,m`
|
|
141
141
|
:host { display: block; }
|
|
142
142
|
.group { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
143
143
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
144
|
-
.req { color: var(--cm-text-critical); margin-
|
|
144
|
+
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
145
145
|
.help, .error { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
146
146
|
.error { color: var(--cm-text-critical); }
|
|
147
147
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-20); padding-top: var(--cm-space-10); }
|
|
148
148
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-30); }
|
|
149
|
-
`];
|
|
150
|
-
<input type="checkbox" role="switch" id=${
|
|
151
|
-
aria-label=${e?
|
|
152
|
-
aria-describedby=${this.description?`${
|
|
149
|
+
`];u("cm-radio-group",ut);var It,bt,Os,ia,pl,Fe=class extends k{constructor(){super(...arguments);h(this,ia);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;h(this,It,this.attachInternals());h(this,bt,T("cm-tg"));h(this,Os,!1)}connectedCallback(){super.connectedCallback(),g(this,Os,this.checked)}get form(){return r(this,It).form}checkValidity(){return r(this,It).checkValidity()}formResetCallback(){this.checked=r(this,Os)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,It).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return n`<label for=${r(this,bt)}>
|
|
150
|
+
<input type="checkbox" role="switch" id=${r(this,bt)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
151
|
+
aria-label=${e?c:this.getAttribute("aria-label")??c}
|
|
152
|
+
aria-describedby=${this.description?`${r(this,bt)}-d`:c} @change=${l(this,ia,pl)} />
|
|
153
153
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
154
|
-
${e?
|
|
155
|
-
</label>`}};
|
|
154
|
+
${e?n`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?n`<span class="desc" id="${r(this,bt)}-d">${this.description}</span>`:c}</span>`:c}
|
|
155
|
+
</label>`}};It=new WeakMap,bt=new WeakMap,Os=new WeakMap,ia=new WeakSet,pl=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Fe.formAssociated=!0,Fe.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Fe.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},Fe.styles=[f,m`
|
|
156
156
|
:host { display: inline-flex; }
|
|
157
157
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-10); cursor: pointer; }
|
|
158
158
|
input { position: absolute; opacity: 0; width: 38px; height: 20px; margin: 0; cursor: inherit; }
|
|
@@ -167,6 +167,8 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
167
167
|
}
|
|
168
168
|
input:checked + .track { background: var(--cm-toggle-on); }
|
|
169
169
|
input:checked + .track .thumb { transform: translateX(18px); }
|
|
170
|
+
/* On is the end side: the left in right-to-left text. */
|
|
171
|
+
:host(:dir(rtl)) input:checked + .track .thumb { transform: translateX(-18px); }
|
|
170
172
|
input:focus-visible + .track { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
171
173
|
.text { display: flex; flex-direction: column; gap: 4px; padding-top: 1px; }
|
|
172
174
|
.label { font-size: 14px; }
|
|
@@ -175,42 +177,43 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
175
177
|
:host([disabled]) .track { opacity: .5; }
|
|
176
178
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
177
179
|
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } }
|
|
178
|
-
`];
|
|
180
|
+
`];u("cm-toggle",Fe);var sa={"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"},ml=["more","drag"],vh=Object.keys(sa);var ul=["chevron-left","chevron-right","arrow-left","arrow-up-right","send"],Rt=class extends k{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=sa[this.name]??sa.more,t=ml.includes(this.name)?3:1.6;return Ls`<svg width=${this.size} height=${this.size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
179
181
|
stroke-width=${t} stroke-linecap="round" stroke-linejoin="round"
|
|
180
|
-
role=${this.label?"img":
|
|
181
|
-
part="svg"><path d=${e}></path></svg>`}};
|
|
182
|
+
role=${this.label?"img":c} aria-label=${this.label||c} aria-hidden=${this.label?c:"true"}
|
|
183
|
+
part="svg" class=${(this.mirror==="auto"?ul.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Rt.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Rt.styles=m`
|
|
182
184
|
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
183
185
|
svg { display: block; }
|
|
184
|
-
|
|
185
|
-
|
|
186
|
+
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
187
|
+
`;u("cm-icon",Rt);var zh=$("select",{required:"Please select an item in the list."}),le,F,qt,ue,Ot,js,C,jn,Bn,Ps,Ht,ft,Ve,ra,aa,Bs,na,oa,Ue=class extends x{constructor(){super(...arguments);h(this,C);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this._active=-1;this._slotted=[];h(this,le,this.attachInternals());h(this,F,T("cm-sel"));h(this,qt,"");h(this,ue,"");h(this,Ot,0);h(this,js,new MutationObserver(()=>l(this,C,jn).call(this)));h(this,aa,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),l(this,C,Ps).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),l(this,C,Ps).call(this),l(this,C,Ve).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let s=l(this,C,ra).call(this,t);l(this,C,Ps).call(this,s>=0?s:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?l(this,C,ft).call(this,this._active):l(this,C,Ve).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?l(this,C,ft).call(this,this._active):l(this,C,Ve).call(this,-1);break;case"Home":e.preventDefault(),l(this,C,Ve).call(this,"first");break;case"End":e.preventDefault(),l(this,C,Ve).call(this,"last");break;case"PageDown":e.preventDefault(),l(this,C,Ve).call(this,10);break;case"PageUp":e.preventDefault(),l(this,C,Ve).call(this,-10);break;case"Enter":e.preventDefault(),l(this,C,ft).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),l(this,C,Ht).call(this);break;case"Tab":l(this,C,ft).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,ue)&&Date.now()-r(this,Ot)<500){let s=l(this,C,ra).call(this," ");s>=0&&(this._active=s)}else l(this,C,ft).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let s=l(this,C,ra).call(this,t);s>=0&&(this._active=s)}}});h(this,Bs,e=>{this.open&&!e.composedPath().includes(this)&&l(this,C,Ht).call(this)});h(this,na,()=>{this.disabled||(this.open?l(this,C,Ht).call(this):l(this,C,Ps).call(this))});h(this,oa,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),l(this,C,jn).call(this),r(this,js).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,Bs),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,js).disconnect(),document.removeEventListener("pointerdown",r(this,Bs),!0)}get form(){return r(this,le).form}get validity(){return r(this,le).validity}get validationMessage(){return r(this,le).validationMessage}checkValidity(){return r(this,le).checkValidity()}reportValidity(){return r(this,le).reportValidity()}formResetCallback(){this.value=r(this,qt),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){r(this,qt)||g(this,qt,this.value)}updated(e){r(this,le).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,le).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,le).setValidity({valueMissing:!0},this.t("required"),t):r(this,le).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,F)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(d=>d.value===this.value),s=[this.error&&`${r(this,F)}-err`,this.helpText&&`${r(this,F)}-help`].filter(Boolean).join(" "),o=this.getAttribute("aria-label");return n`<div class="field">
|
|
188
|
+
${this.label?n`<span class="label" id="${r(this,F)}-l" part="label" @click=${r(this,oa)}>${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
186
189
|
<div class="wrap">
|
|
187
190
|
<div class="box" part="box" role="combobox" tabindex=${this.disabled?"-1":"0"}
|
|
188
|
-
aria-labelledby=${this.label?`${
|
|
189
|
-
aria-label=${!this.label&&
|
|
190
|
-
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${
|
|
191
|
-
aria-activedescendant=${this.open&&this._active>=0?`${
|
|
192
|
-
aria-required=${this.required?"true":
|
|
193
|
-
aria-disabled=${this.disabled?"true":
|
|
194
|
-
@click=${
|
|
195
|
-
<span class="text ${t?"":"placeholder"}" id="${
|
|
191
|
+
aria-labelledby=${this.label?`${r(this,F)}-l`:c}
|
|
192
|
+
aria-label=${!this.label&&o?o:c}
|
|
193
|
+
aria-haspopup="listbox" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,F)}-list"
|
|
194
|
+
aria-activedescendant=${this.open&&this._active>=0?`${r(this,F)}-o${this._active}`:c}
|
|
195
|
+
aria-required=${this.required?"true":c} aria-invalid=${this.error?"true":c}
|
|
196
|
+
aria-disabled=${this.disabled?"true":c} aria-describedby=${s||c}
|
|
197
|
+
@click=${r(this,na)} @keydown=${r(this,aa)} @blur=${()=>l(this,C,Ht).call(this)}>
|
|
198
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,F)}-v">${t?t.label:this.placeholder}</span>
|
|
196
199
|
<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>
|
|
197
200
|
</div>
|
|
198
|
-
<ul role="listbox" id="${
|
|
199
|
-
aria-label=${!this.label&&
|
|
201
|
+
<ul role="listbox" id="${r(this,F)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,F)}-l`:c}
|
|
202
|
+
aria-label=${!this.label&&o?o:c} ?hidden=${!this.open}
|
|
200
203
|
@pointerdown=${d=>d.preventDefault()}>
|
|
201
|
-
${e.map((d,
|
|
202
|
-
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":
|
|
203
|
-
@pointerenter=${()=>!d.disabled&&(this._active=
|
|
204
|
+
${e.map((d,p)=>n`<li role="option" id="${r(this,F)}-o${p}" class=${p===this._active?"active":""}
|
|
205
|
+
aria-selected=${d.value===this.value?"true":"false"} aria-disabled=${d.disabled?"true":c}
|
|
206
|
+
@pointerenter=${()=>!d.disabled&&(this._active=p)} @click=${()=>l(this,C,ft).call(this,p)}>${d.label}</li>`)}
|
|
204
207
|
</ul>
|
|
205
208
|
</div>
|
|
206
|
-
${this.error?
|
|
207
|
-
${this.helpText?
|
|
209
|
+
${this.error?n`<p class="error" id="${r(this,F)}-err" role="alert">${this.error}</p>`:c}
|
|
210
|
+
${this.helpText?n`<p class="help" id="${r(this,F)}-help">${this.helpText}</p>`:c}
|
|
208
211
|
<slot></slot>
|
|
209
|
-
</div>`}};
|
|
212
|
+
</div>`}};le=new WeakMap,F=new WeakMap,qt=new WeakMap,ue=new WeakMap,Ot=new WeakMap,js=new WeakMap,C=new WeakSet,jn=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??"",g(this,qt,this.value))},Bn=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},Ps=function(e){if(this.disabled)return;let t=this.items.findIndex(s=>s.value===this.value);this.open=!0,this._active=e??(t>=0?t:l(this,C,Bn).call(this)[0]??-1)},Ht=function(){this.open=!1},ft=function(e){let t=this.items[e];!t||t.disabled||(l(this,C,Ht).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}))))},Ve=function(e){let t=l(this,C,Bn).call(this);if(!t.length)return;if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let s=t.indexOf(this._active);this._active=s<0?t[0]:t[Math.min(t.length-1,Math.max(0,s+e))]},ra=function(e){let t=Date.now();g(this,ue,t-r(this,Ot)>500?e:r(this,ue)+e),g(this,Ot,t);let s=this.items,o=this._active<0?0:this._active,d=r(this,ue).split("").every(w=>w===r(this,ue)[0]),p=d?r(this,ue)[0]:r(this,ue),b=d||r(this,ue).length===1?o+1:o;for(let w=0;w<s.length;w++){let y=(b+w)%s.length;if(!s[y].disabled&&s[y].label.toLowerCase().startsWith(p.toLowerCase()))return y}return-1},aa=new WeakMap,Bs=new WeakMap,na=new WeakMap,oa=new WeakMap,Ue.formAssociated=!0,Ue.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Ue.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}},Ue.styles=[f,m`
|
|
210
213
|
:host { display: block; position: relative; }
|
|
211
214
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
212
215
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); cursor: default; }
|
|
213
|
-
.req { color: var(--cm-text-critical); margin-
|
|
216
|
+
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
214
217
|
.wrap { position: relative; }
|
|
215
218
|
.box {
|
|
216
219
|
display: flex; align-items: center; gap: var(--cm-space-10); width: 100%; height: 42px; padding: 0 var(--cm-space-10);
|
|
@@ -225,7 +228,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
225
228
|
:host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
|
|
226
229
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-default); cursor: not-allowed; }
|
|
227
230
|
[role='listbox'] {
|
|
228
|
-
position: absolute; z-index: 20; top: calc(100% + var(--cm-space-10));
|
|
231
|
+
position: absolute; z-index: 20; top: calc(100% + var(--cm-space-10)); inset-inline: 0;
|
|
229
232
|
max-height: 242px; overflow-y: auto; margin: 0; padding: var(--cm-space-10) 0; list-style: none;
|
|
230
233
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default);
|
|
231
234
|
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100);
|
|
@@ -243,16 +246,16 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
243
246
|
slot { display: none; }
|
|
244
247
|
@media (max-width: 640px) { [role='option'] { font-size: 14px; min-height: 30px; padding-inline: var(--cm-space-15); } }
|
|
245
248
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
246
|
-
`];
|
|
249
|
+
`];u("cm-select",Ue);var Nh=$("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),jt,la,Fs,W,Pt,bl,fl,Fn,Ke=class extends x{constructor(){super(...arguments);h(this,W);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;h(this,jt,this.attachInternals());h(this,la,T("cm-search"));h(this,Fs,"")}connectedCallback(){super.connectedCallback(),g(this,Fs,this.value)}get form(){return r(this,jt).form}checkValidity(){return r(this,jt).checkValidity()}formResetCallback(){this.value=r(this,Fs)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,jt).setFormValue(this.value)}render(){let e=this.size==="large";return n`<div class="box" part="box">
|
|
247
250
|
<cm-icon class="icon" name="search" size=${e?16:14}></cm-icon>
|
|
248
|
-
<input id=${
|
|
249
|
-
aria-label=${this.label} .value=${
|
|
250
|
-
@input=${
|
|
251
|
-
${this.value&&!this.disabled?
|
|
252
|
-
${this.filter?
|
|
253
|
-
aria-label=${this.filterCount>0
|
|
254
|
-
@click=${()=>
|
|
255
|
-
</div>`}};
|
|
251
|
+
<input id=${r(this,la)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
252
|
+
aria-label=${this.label} .value=${me(this.value)} placeholder=${this.placeholder||c} ?disabled=${this.disabled}
|
|
253
|
+
@input=${l(this,W,bl)} @change=${()=>l(this,W,Pt).call(this,"change")} @keydown=${l(this,W,fl)} />
|
|
254
|
+
${this.value&&!this.disabled?n`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${l(this,W,Fn)}><cm-icon name="close" size="14"></cm-icon></button>`:c}
|
|
255
|
+
${this.filter?n`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
256
|
+
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
257
|
+
@click=${()=>l(this,W,Pt).call(this,"cm-filter")}><cm-icon name="filter" size="18"></cm-icon>${this.filterCount>0?n`<span class="count" aria-hidden="true">${this.filterCount}</span>`:c}</button>`:c}
|
|
258
|
+
</div>`}};jt=new WeakMap,la=new WeakMap,Fs=new WeakMap,W=new WeakSet,Pt=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},bl=function(e){this.value=e.target.value},fl=function(e){e.key==="Enter"?l(this,W,Pt).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),l(this,W,Fn).call(this))},Fn=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),l(this,W,Pt).call(this,"input"),l(this,W,Pt).call(this,"change")},Ke.formAssociated=!0,Ke.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Ke.properties={label:{string:"label"},name:{reflect:!0},value:{},placeholder:{string:"placeholder"},filter:{type:Boolean},filterLabel:{attribute:"filter-label",string:"filter"},filterCount:{type:Number,attribute:"filter-count"},size:{reflect:!0},disabled:{type:Boolean,reflect:!0}},Ke.styles=[f,m`
|
|
256
259
|
:host { display: block; }
|
|
257
260
|
.box {
|
|
258
261
|
display: flex; align-items: center; gap: var(--cm-space-10); height: 42px; padding: 0 var(--cm-space-10);
|
|
@@ -276,39 +279,313 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
276
279
|
button:hover { background: var(--cm-bg-hover); }
|
|
277
280
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
278
281
|
.count {
|
|
279
|
-
position: absolute; top: -2px;
|
|
282
|
+
position: absolute; top: -2px; inset-inline-end: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--cm-radius-full);
|
|
280
283
|
background: var(--cm-action-primary); color: var(--cm-action-primary-text); font-size: 10px; line-height: 16px;
|
|
281
284
|
}
|
|
282
285
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
283
286
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
284
287
|
:host([disabled]) button { cursor: not-allowed; }
|
|
285
|
-
`];
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
288
|
+
`];u("cm-search",Ke);var jh=$("tag",{remove:"Remove {label}"}),ca,gl,Bt=class extends x{constructor(){super(...arguments);h(this,ca);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||this.t("remove",{label:this.textContent?.trim()??""}).trim();return n`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?n`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${l(this,ca,gl)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:c}</span>`}};ca=new WeakSet,gl=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Bt.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Bt.styles=[f,m`
|
|
289
|
+
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
290
|
+
.tag {
|
|
291
|
+
display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 26px; padding: 0 var(--cm-space-10);
|
|
292
|
+
font-size: 12px; color: var(--cm-text-default); background: var(--cm-bg-tag);
|
|
293
|
+
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-full);
|
|
294
|
+
}
|
|
295
|
+
:host([removable]) .tag { padding-inline-end: 4px; }
|
|
296
|
+
.text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
297
|
+
button {
|
|
298
|
+
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
|
|
299
|
+
padding: 0; border: 0; border-radius: var(--cm-radius-full); background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
300
|
+
}
|
|
301
|
+
button:hover { background: var(--cm-bg-hover); }
|
|
302
|
+
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
303
|
+
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-default); }
|
|
304
|
+
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); }
|
|
305
|
+
@media (max-width: 640px) { .tag { height: 22px; } button { width: 18px; height: 18px; } }
|
|
306
|
+
`];u("cm-tag",Bt);var Ft=class extends x{constructor(){super(...arguments);this.size="large"}render(){let e=this.size==="small"?2.5:3;return n`<span class="spinner" part="spinner" role="status">
|
|
307
|
+
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
308
|
+
<circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
|
|
309
|
+
<path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
|
|
310
|
+
</svg>
|
|
311
|
+
<span class="vh">${this.accessibleLabel||this.t("loading")}</span>
|
|
312
|
+
</span>`}};Ft.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},Ft.styles=[f,m`
|
|
313
|
+
:host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
|
|
314
|
+
.spinner { display: inline-flex; }
|
|
315
|
+
svg { inline-size: 44px; block-size: 44px; animation: spin 0.8s linear infinite; }
|
|
316
|
+
:host([size='small']) svg { inline-size: 20px; block-size: 20px; }
|
|
317
|
+
.track { stroke: var(--cm-border-default); }
|
|
318
|
+
.arc { stroke: currentColor; }
|
|
319
|
+
.vh {
|
|
320
|
+
position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
321
|
+
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
322
|
+
}
|
|
323
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
324
|
+
@media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
|
|
325
|
+
`];u("cm-spinner",Ft);var Qh=$("combobox",{noResults:"No results",results:{one:"{count} result",other:"{count} results"},add:"Add \u201C{value}\u201D",remove:"Remove {label}",required:"Please select an item in the list.",requiredMultiple:"Choose at least one item."}),Z,V,Ys,Kt,Gs,E,Vn,Vs,da,Us,Vt,Ut,We,vl,Ks,Un,Kn,Ws,ha,pa,ma,Xs,xl,Ye=class extends x{constructor(){super(...arguments);h(this,E);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this._query="";this._active=-1;this._slotted=[];this._typing=!1;h(this,Z,this.attachInternals());h(this,V,T("cm-cb"));h(this,Ys,null);h(this,Kt,new Map);h(this,Gs,new MutationObserver(()=>l(this,E,Vn).call(this)));h(this,ha,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,l(this,E,Ut).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});h(this,pa,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?l(this,E,Ks).call(this,1):(l(this,E,Ut).call(this),e.altKey||l(this,E,Ks).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?l(this,E,Ks).call(this,-1):(l(this,E,Ut).call(this),l(this,E,Ks).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),l(this,E,Un).call(this,this._active)):r(this,E,da)&&(e.preventDefault(),l(this,E,Kn).call(this,r(this,E,da)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),l(this,E,We).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",l(this,E,Vt).call(this)));break;case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":l(this,E,We).call(this);break;default:}});h(this,ma,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(l(this,E,We).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?l(this,E,Vs).call(this,this.value):""))})});h(this,Xs,e=>{this.open&&!e.composedPath().includes(this)&&l(this,E,We).call(this)})}connectedCallback(){super.connectedCallback(),l(this,E,Vn).call(this),r(this,Gs).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,Xs),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,Gs).disconnect(),document.removeEventListener("pointerdown",r(this,Xs),!0)}get form(){return r(this,Z).form}get validity(){return r(this,Z).validity}get validationMessage(){return r(this,Z).validationMessage}checkValidity(){return r(this,Z).checkValidity()}reportValidity(){return r(this,Z).reportValidity()}formResetCallback(){let e=r(this,Ys)??{value:"",values:[]};this.value=e.value,this.values=[...e.values],this._query="",this._typing=!1,this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){typeof e=="string"&&(this.multiple?this.values=e?e.split(`
|
|
326
|
+
`):[]:this.value=e)}get items(){return this.options?.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let s=t.label.toLowerCase();return this.filter==="starts-with"?s.startsWith(e):s.includes(e)})}firstUpdated(){g(this,Ys,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,Kt).set(t.value,t.label);if((e.has("value")||e.has("options")||e.has("_slotted"))&&!this.multiple&&!this._typing&&(this._query=this.value?l(this,E,Vs).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=l(this,E,Us).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let o=new FormData;for(let d of this.values)o.append(this.name,d);r(this,Z).setFormValue(o,this.values.join(`
|
|
327
|
+
`))}else r(this,Z).setFormValue(null);else r(this,Z).setFormValue(this.value||null,this.value);let s=this.multiple?!this.values.length:!this.value;this.error?r(this,Z).setValidity({customError:!0},this.error,t):this.required&&s?r(this,Z).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),t):r(this,Z).setValidity({}),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,V)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),l(this,E,Vt).call(this))}render(){let e=l(this,E,Us).call(this),t=[this.error&&`${r(this,V)}-err`,this.helpText&&`${r(this,V)}-help`].filter(Boolean).join(" "),s=this.getAttribute("aria-label"),o=p=>this.multiple?this.values.includes(p):p===this.value,d=this.loading?this.loadingText||this.t("loading"):this.open?e.length?this.t("results",{count:e.length}):this.emptyText||this.t("noResults"):"";return n`<div class="field">
|
|
328
|
+
${this.label?n`<label class="label" id="${r(this,V)}-l" for="${r(this,V)}-in" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</label>`:c}
|
|
329
|
+
<div class="wrap">
|
|
330
|
+
<div class="box" part="box" @click=${p=>{p.target.closest("cm-tag")||l(this,E,Ws).call(this)}}>
|
|
331
|
+
${this.multiple?this.values.map(p=>n`<cm-tag removable ?disabled=${this.disabled} remove-label=${this.t("remove",{label:l(this,E,Vs).call(this,p)})}
|
|
332
|
+
@cm-remove=${()=>{this.removeValue(p),l(this,E,Ws).call(this)}}>${l(this,E,Vs).call(this,p)}</cm-tag>`):c}
|
|
333
|
+
<input id="${r(this,V)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
334
|
+
.value=${me(this._query)} placeholder=${this.multiple&&this.values.length?c:this.placeholder||c}
|
|
335
|
+
aria-label=${!this.label&&s?s:c}
|
|
336
|
+
aria-autocomplete="list" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,V)}-list"
|
|
337
|
+
aria-activedescendant=${this.open&&this._active>=0?`${r(this,V)}-o${this._active}`:c}
|
|
338
|
+
aria-invalid=${this.error?"true":c} aria-describedby=${t||c}
|
|
339
|
+
aria-required=${this.required?"true":c} ?disabled=${this.disabled}
|
|
340
|
+
@input=${r(this,ha)} @keydown=${r(this,pa)} @blur=${r(this,ma)}
|
|
341
|
+
@click=${()=>{this.open||l(this,E,Ut).call(this)}} @change=${p=>p.stopPropagation()} />
|
|
342
|
+
<cm-icon class="chev" name="chevron-down" size="16" @click=${()=>{this.open?l(this,E,We).call(this):(l(this,E,Ut).call(this),l(this,E,Ws).call(this))}}></cm-icon>
|
|
343
|
+
</div>
|
|
344
|
+
<div class="pop" part="popover" ?hidden=${!this.open} @pointerdown=${p=>p.preventDefault()}>
|
|
345
|
+
<ul role="listbox" id="${r(this,V)}-list" part="listbox" ?hidden=${!e.length}
|
|
346
|
+
aria-labelledby=${this.label?`${r(this,V)}-l`:c} aria-label=${!this.label&&s?s:c}
|
|
347
|
+
aria-multiselectable=${this.multiple?"true":c}>
|
|
348
|
+
${e.map((p,b)=>n`<li role="option" id="${r(this,V)}-o${b}" class=${b===this._active?"active":""}
|
|
349
|
+
aria-selected=${p.create?"false":o(p.value)?"true":"false"} aria-disabled=${p.disabled?"true":c}
|
|
350
|
+
@pointerenter=${()=>!p.disabled&&(this._active=b)} @click=${()=>l(this,E,Un).call(this,b)}>
|
|
351
|
+
${p.create?n`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:p.label})}</span>`:n`${this.multiple?n`<cm-icon class="check" name="check" size="16"></cm-icon>`:c}<span>${l(this,E,xl).call(this,p.label)}</span>`}</li>`)}
|
|
352
|
+
</ul>
|
|
353
|
+
${this.loading?n`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText||this.t("loading")}</span></p>`:e.length?c:n`<p class="message">${this.emptyText||this.t("noResults")}</p>`}
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
<span class="vh" role="status" aria-live="polite">${d}</span>
|
|
357
|
+
${this.error?n`<p class="error" id="${r(this,V)}-err" role="alert">${this.error}</p>`:c}
|
|
358
|
+
${this.helpText?n`<p class="help" id="${r(this,V)}-help">${this.helpText}</p>`:c}
|
|
359
|
+
<slot></slot>
|
|
360
|
+
</div>`}};Z=new WeakMap,V=new WeakMap,Ys=new WeakMap,Kt=new WeakMap,Gs=new WeakMap,E=new WeakSet,Vn=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>({value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled})),!this.hasUpdated){let t=e.filter(s=>s.hasAttribute("selected")).map(s=>s.value);this.multiple&&!this.values.length&&t.length&&(this.values=t),!this.multiple&&!this.value&&t.length&&(this.value=t[0])}},Vs=function(e){return this.items.find(t=>t.value===e)?.label??r(this,Kt).get(e)??e},da=function(){if(!this.allowCustom||!this._typing)return"";let e=this._query.trim();if(!e)return"";let t=e.toLowerCase();return this.items.some(s=>s.label.toLowerCase()===t||s.value.toLowerCase()===t)||(this.multiple?this.values.some(s=>s.toLowerCase()===t):this.value.toLowerCase()===t)?"":e},Us=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,E,da);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},Vt=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ut=function(){this.disabled||(this.open=!0)},We=function(){this.open=!1,this._active=-1},vl=function(e=l(this,E,Us).call(this)){return e.flatMap((t,s)=>t.disabled?[]:[s])},Ks=function(e){let t=l(this,E,vl).call(this);if(!t.length){this._active=-1;return}if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let s=t.indexOf(this._active);if(s<0){this._active=e>0?t[0]:t[t.length-1];return}this._active=t[(s+e+t.length)%t.length]},Un=function(e){let t=l(this,E,Us).call(this)[e];if(!(!t||t.disabled)){if(t.create){l(this,E,Kn).call(this,t.value);return}if(this.multiple){this.values=this.values.includes(t.value)?this.values.filter(s=>s!==t.value):[...this.values,t.value],this._query="",this._typing=!1,this._active=-1,l(this,E,Vt).call(this),l(this,E,Ws).call(this);return}l(this,E,We).call(this),this._typing=!1,this._query=t.label,t.value!==this.value&&(this.value=t.value,l(this,E,Vt).call(this))}},Kn=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,Kt).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(l(this,E,We).call(this),this.value=e,this._typing=!1,this._query=e),l(this,E,Vt).call(this))},Ws=function(){this.renderRoot.querySelector("input")?.focus()},ha=new WeakMap,pa=new WeakMap,ma=new WeakMap,Xs=new WeakMap,xl=function(e){let t=this._typing?this._query.trim():"";if(!t||this.filter==="none")return e;let s=e.toLowerCase().indexOf(t.toLowerCase());return s<0||this.filter==="starts-with"&&s!==0?e:n`${e.slice(0,s)}<mark>${e.slice(s,s+t.length)}</mark>${e.slice(s+t.length)}`},Ye.formAssociated=!0,Ye.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Ye.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},values:{type:Array},placeholder:{},options:{type:Array},multiple:{type:Boolean,reflect:!0},allowCustom:{type:Boolean,attribute:"allow-custom"},filter:{},loading:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},_query:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},Ye.styles=[f,m`
|
|
361
|
+
:host { display: block; position: relative; }
|
|
362
|
+
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
363
|
+
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
364
|
+
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
365
|
+
.wrap { position: relative; }
|
|
366
|
+
.box {
|
|
367
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; min-height: 42px; padding: 7px var(--cm-space-10);
|
|
368
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm); cursor: text;
|
|
369
|
+
}
|
|
370
|
+
.box:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
371
|
+
.tags { display: contents; }
|
|
372
|
+
input {
|
|
373
|
+
flex: 1 1 80px; min-width: 80px; height: 26px; padding: 0; border: 0; outline: none; background: none;
|
|
374
|
+
font: inherit; font-size: 16px; color: var(--cm-text-default);
|
|
375
|
+
}
|
|
376
|
+
input::placeholder { color: var(--cm-text-tertiary); }
|
|
377
|
+
.chev { flex: none; margin-inline-start: auto; color: var(--cm-icon-selected); transition: transform .15s; }
|
|
378
|
+
:host([open]) .chev { transform: rotate(180deg); }
|
|
379
|
+
:host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
|
|
380
|
+
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); cursor: not-allowed; }
|
|
381
|
+
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
382
|
+
.pop {
|
|
383
|
+
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-10)); inset-inline: 0;
|
|
384
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-default);
|
|
385
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100); overflow: hidden;
|
|
386
|
+
}
|
|
387
|
+
.pop[hidden] { display: none; }
|
|
388
|
+
[role='listbox'] { max-height: 242px; overflow-y: auto; margin: 0; padding: var(--cm-space-10) 0; list-style: none; }
|
|
389
|
+
[role='listbox'][hidden] { display: none; }
|
|
390
|
+
[role='option'] {
|
|
391
|
+
display: flex; align-items: center; gap: var(--cm-space-10); min-height: 40px; padding: 6px var(--cm-space-20);
|
|
392
|
+
font-size: 16px; color: var(--cm-text-default); cursor: pointer;
|
|
393
|
+
}
|
|
394
|
+
[role='option'] .check { flex: none; visibility: hidden; }
|
|
395
|
+
[role='option'][aria-selected='true'] .check { visibility: visible; }
|
|
396
|
+
[role='option'].active { background: var(--cm-bg-hover); box-shadow: inset 2px 0 0 var(--cm-border-strong); }
|
|
397
|
+
[role='option'].active:dir(rtl) { box-shadow: inset -2px 0 0 var(--cm-border-strong); }
|
|
398
|
+
:host(:not([multiple])) [role='option'][aria-selected='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
399
|
+
:host(:not([multiple])) [role='option'][aria-selected='true'].active { background: var(--cm-action-primary-hover); }
|
|
400
|
+
[role='option'][aria-disabled='true'] { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
401
|
+
[role='option'] mark { background: none; color: inherit; font-weight: 600; }
|
|
402
|
+
.create { font-style: normal; }
|
|
403
|
+
.message { display: flex; align-items: center; gap: var(--cm-space-10); margin: 0; padding: var(--cm-space-15) var(--cm-space-20); font-size: 14px; color: var(--cm-text-tertiary); }
|
|
404
|
+
.vh {
|
|
405
|
+
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
406
|
+
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
407
|
+
}
|
|
408
|
+
.help, .error { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
409
|
+
.error { color: var(--cm-text-critical); }
|
|
410
|
+
slot { display: none; }
|
|
411
|
+
@media (max-width: 640px) { [role='option'] { font-size: 14px; min-height: 30px; padding-inline: var(--cm-space-15); } }
|
|
412
|
+
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
413
|
+
`];u("cm-combobox",Ye);var Wc=/^(\d{4})-(\d{2})-(\d{2})$/;function z(a){let i=Wc.exec(a??"");if(!i)return null;let e=new Date(+i[1],+i[2]-1,+i[3]);return e.getFullYear()===+i[1]&&e.getMonth()===+i[2]-1&&e.getDate()===+i[3]?e:null}var Wt=(a,i=2)=>String(a).padStart(i,"0"),ee=a=>`${Wt(a.getFullYear(),4)}-${Wt(a.getMonth()+1)}-${Wt(a.getDate())}`,Yc=()=>ee(new Date),Q=(a,i)=>new Date(a.getFullYear(),a.getMonth(),a.getDate()+i);function ve(a,i){let e=new Date(a.getFullYear(),a.getMonth()+i,1),t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return new Date(e.getFullYear(),e.getMonth(),Math.min(a.getDate(),t))}var gt=a=>new Date(a.getFullYear(),a.getMonth(),1),ua=a=>new Date(a.getFullYear(),a.getMonth()+1,0);var Yt={fromAttribute:a=>a?a.split(/[\s,]+/).filter(Boolean):[],toAttribute:a=>Array.isArray(a)?a.join(" "):a},Js=a=>Array.isArray(a)?a:typeof a=="string"?Yt.fromAttribute(a):[];function ba(a,i){let e=[i,As(a)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function fa(a){try{let i=new Intl.Locale(a),e=i.getWeekInfo?.()??i.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var yl=new Map;function ga(a){let i=yl.get(a);if(i)return i;let e=M=>new Intl.DateTimeFormat(a,M),t=e({day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"}),s=e({weekday:"short"}),o=e({weekday:"long"}),d=new Date(2024,0,7),p=t.formatToParts(new Date(2026,10,15)),b=p.filter(M=>M.type==="day"||M.type==="month"||M.type==="year").map(M=>M.type),w=p.map(M=>M.type==="day"?"{d}":M.type==="month"?"{m}":M.type==="year"?"{y}":M.value).join(""),y=(M,S)=>Array.from({length:12},(O,I)=>new Intl.DateTimeFormat(M,{month:S}).format(new Date(2024,I,1)).toLowerCase().replace(/\./g,"")),v=Array.from({length:12},(M,S)=>[...new Set([y(a,"long")[S],y(a,"short")[S],y("en","long")[S],y("en","short")[S]])]),A={short:M=>t.format(M),long:M=>ge(M,{weekday:"long",day:"numeric",month:"long",year:"numeric"},a),medium:M=>ge(M,{day:"numeric",month:"short",year:"numeric"},a),monthYear:M=>ge(M,{month:"long",year:"numeric"},a),day:M=>ge(M,{day:"numeric"},a),weekdaysShort:Array.from({length:7},(M,S)=>s.format(Q(d,S))),weekdaysLong:Array.from({length:7},(M,S)=>o.format(Q(d,S))),pattern:b.length===3?w:"{y}-{m}-{d}",order:b.length===3?b:["year","month","day"],months:v};return yl.set(a,A),A}var va=(a,i)=>a.pattern.replace(/\{([dmy])\}/g,(e,t)=>i[t]);function xa(a,i){let e=a.trim().toLowerCase();if(!e)return null;let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);if(t.length!==3)return null;let s,o,d,p=t.findIndex(w=>/\p{L}/u.test(w));if(p>=0){let w=t[p];o=i.months.findIndex(M=>M.some(S=>S===w||w.length>=3&&S.startsWith(w)))+1;let y=t.filter((M,S)=>S!==p);if(!o||y.some(M=>!/^\d+$/.test(M)))return null;let v=y.findIndex(M=>M.length===4),A=v>=0?v:1;s=+y[A],d=+y[1-A],y[A].length<=2&&(s+=2e3)}else{if(t.some(v=>!/^\d+$/.test(v)))return null;let w=t[0].length===4?["year","month","day"]:i.order,y=v=>t[w.indexOf(v)];if(s=+y("year"),o=+y("month"),d=+y("day"),y("year").length<=2)s+=2e3;else if(y("year").length!==4)return null}let b=`${Wt(s,4)}-${Wt(o)}-${Wt(d)}`;return z(b)?b:null}function ya(a,i,e,t){let s=(e.getDay()-t+7)%7;switch(a){case"ArrowRight":return Q(e,1);case"ArrowLeft":return Q(e,-1);case"ArrowDown":return Q(e,7);case"ArrowUp":return Q(e,-7);case"Home":return Q(e,-s);case"End":return Q(e,6-s);case"PageDown":return ve(e,i.shiftKey?12:1);case"PageUp":return ve(e,i.shiftKey?-12:-1);default:return null}}var Ge=(a,i,e)=>i&&a<i?i:e&&a>e?e:a;function $a(a){let{fmt:i,firstDay:e,month:t,focus:s,min:o,max:d}=a,p=gt(t),b=(p.getDay()-e+7)%7,w=ua(t).getDate(),y=[],v=Array(b).fill(null);for(let I=1;I<=w;I++)v.push(new Date(t.getFullYear(),t.getMonth(),I)),v.length===7&&(y.push(v),v=[]);v.length&&y.push([...v,...Array(7-v.length).fill(null)]);let A=Array.from({length:7},(I,R)=>(R+e)%7),M=Yc(),S=!!o&&ua(ve(p,-1))<o,O=!!d&&ve(p,1)>d;return n`<div class="cal-head">
|
|
414
|
+
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${a.previousLabel} ?disabled=${S} @click=${()=>a.onMonth(-1)}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
415
|
+
<h2 id="${a.id}-month" class="cal-title" aria-live="polite">${i.monthYear(t)}</h2>
|
|
416
|
+
<button type="button" class="cal-nav" part="calendar-nav" aria-label=${a.nextLabel} ?disabled=${O} @click=${()=>a.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
417
|
+
</div>
|
|
418
|
+
<table role="grid" class="cal-grid" part="calendar" aria-labelledby="${a.id}-month" @keydown=${a.onKey}>
|
|
419
|
+
<thead><tr>${A.map(I=>n`<th scope="col" abbr=${i.weekdaysLong[I]}><span aria-hidden="true">${i.weekdaysShort[I]}</span><span class="vh">${i.weekdaysLong[I]}</span></th>`)}</tr></thead>
|
|
420
|
+
<tbody>${y.map(I=>n`<tr>${I.map(R=>{if(!R)return n`<td class="empty"></td>`;let Lt=ee(R),St=a.isDisabled(R)||!!o&&R<o||!!d&&R>d,Oo=a.mark(R),Po=a.note?.(R);return n`<td class="day ${Oo} ${Lt===M?"today":""}" data-date=${Lt}
|
|
421
|
+
tabindex=${Lt===ee(s)?"0":"-1"}
|
|
422
|
+
aria-selected=${Oo?"true":"false"} aria-disabled=${St?"true":c}
|
|
423
|
+
aria-current=${Lt===M?"date":c}
|
|
424
|
+
aria-label="${i.long(R)}${Po?`, ${Po}`:""}"
|
|
425
|
+
@click=${()=>!St&&a.onPick(R)} @pointerenter=${()=>a.onHover?.(R)}><span aria-hidden="true">${i.day(R)}</span></td>`})}</tr>`)}</tbody>
|
|
426
|
+
</table>`}var wa=m`
|
|
427
|
+
.pop {
|
|
428
|
+
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-10)); inset-inline-start: 0;
|
|
429
|
+
width: max-content; max-width: calc(100vw - 32px); padding: var(--cm-space-15);
|
|
430
|
+
background: var(--cm-bg-surface); color: var(--cm-text-default);
|
|
431
|
+
border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100);
|
|
432
|
+
}
|
|
433
|
+
.pop[hidden] { display: none; }
|
|
434
|
+
.cal { width: 280px; max-width: 100%; }
|
|
435
|
+
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--cm-space-10); margin-block-end: var(--cm-space-10); }
|
|
436
|
+
.cal-title { flex: 1; margin: 0; text-align: center; font-size: 14px; line-height: 20px; font-weight: 500; }
|
|
437
|
+
.cal-nav {
|
|
438
|
+
display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--cm-radius-sm);
|
|
439
|
+
background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
440
|
+
}
|
|
441
|
+
.cal-nav:hover { background: var(--cm-bg-hover); }
|
|
442
|
+
.cal-nav:disabled { color: var(--cm-text-secondary); cursor: not-allowed; background: none; }
|
|
443
|
+
.cal-nav:focus-visible, .day:focus, .preset:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
444
|
+
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
|
445
|
+
.cal-grid th { height: 32px; padding: 0; font-size: 12px; font-weight: 400; color: var(--cm-text-tertiary); text-align: center; }
|
|
446
|
+
.day, .empty { height: 40px; padding: 0; text-align: center; font-size: 14px; }
|
|
447
|
+
.day { cursor: pointer; border-radius: var(--cm-radius-sm); outline: none; }
|
|
448
|
+
.day:hover { background: var(--cm-bg-hover); }
|
|
449
|
+
.day.today span { text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
|
|
450
|
+
.day.in-range { background: var(--cm-bg-attention-soft); border-radius: 0; }
|
|
451
|
+
.day.selected, .day.start, .day.end { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
452
|
+
.day[aria-disabled='true'] { color: var(--cm-text-secondary); cursor: not-allowed; background: none; text-decoration: line-through; }
|
|
453
|
+
.vh {
|
|
454
|
+
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
455
|
+
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
456
|
+
}
|
|
457
|
+
@media (max-width: 640px) { .day, .empty { height: 36px; } }
|
|
458
|
+
`;function ka(a,i){if(a.key!=="Tab")return;let e=[...i.querySelectorAll('button:not([disabled]), [role=grid] td[tabindex="0"]')];if(!e.length)return;let t=i.getRootNode(),s=e.indexOf(t.activeElement);a.preventDefault(),e[(s+(a.shiftKey?-1:1)+e.length)%e.length].focus()}var Ea=m`
|
|
459
|
+
:host { display: block; position: relative; }
|
|
460
|
+
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
461
|
+
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
462
|
+
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
463
|
+
.wrap { position: relative; }
|
|
464
|
+
.box {
|
|
465
|
+
display: flex; align-items: center; gap: 4px; width: 100%; height: 42px; padding-block: 0; padding-inline: var(--cm-space-10) 4px;
|
|
466
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
467
|
+
}
|
|
468
|
+
.box:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
469
|
+
input {
|
|
470
|
+
flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: none;
|
|
471
|
+
font: inherit; font-size: 16px; color: var(--cm-text-default);
|
|
472
|
+
}
|
|
473
|
+
input::placeholder { color: var(--cm-text-tertiary); }
|
|
474
|
+
.trigger {
|
|
475
|
+
flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0;
|
|
476
|
+
border-radius: var(--cm-radius-sm); background: none; color: var(--cm-icon-selected); cursor: pointer;
|
|
477
|
+
}
|
|
478
|
+
.trigger:hover { background: var(--cm-bg-hover); }
|
|
479
|
+
.trigger:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
480
|
+
:host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
|
|
481
|
+
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-default); }
|
|
482
|
+
:host([disabled]) input, :host([disabled]) .trigger { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
483
|
+
:host([disabled]) .trigger:hover { background: none; }
|
|
484
|
+
.help, .error { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
485
|
+
.error { color: var(--cm-text-critical); }
|
|
486
|
+
:host([size='small']) .field { gap: 6px; }
|
|
487
|
+
:host([size='small']) .label { font-size: 12px; }
|
|
488
|
+
:host([size='small']) input { font-size: 14px; }
|
|
489
|
+
`;var dp=$("datePicker",{choose:"Choose date",chooseFor:"Choose date for {label}",change:"Change date, {date}",changeFor:"Change date for {label}, {date}",dialog:"Choose date",previousMonth:"Previous month",nextMonth:"Next month",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badInput:"Enter a date like {pattern}.",required:"Enter or choose a date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"This date isn't available. Choose another date."}),Jt,U,ce,Zt,Qt,Je,L,Wn,Gt,Yn,Gn,Xt,$l,Zs,Qs,Xn,Jn,Ma,_a,za,Ta,La,er,Xe=class extends x{constructor(){super(...arguments);h(this,L);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.min="";this.max="";this.placeholder="";h(this,Jt,"");this.disabledDates=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._text="";this._focus=new Date;h(this,U,this.attachInternals());h(this,ce,T("cm-dp"));h(this,Zt,null);h(this,Qt,!1);h(this,Je,!1);h(this,Ma,()=>{this.disabled||(this.open?this.open=!1:(l(this,L,Qs).call(this),this.show()))});h(this,_a,e=>{e.key==="Enter"?l(this,L,Qs).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),l(this,L,Qs).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});h(this,za,e=>{let t=ya(ae(e,this),e,this._focus,r(this,L,Yn));if(t){e.preventDefault(),this._focus=Ge(t,z(this.min),z(this.max)),g(this,Je,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),l(this,L,Xn).call(this,this._focus))});h(this,Ta,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,l(this,L,Jn).call(this);return}ka(e,e.currentTarget)});h(this,La,e=>{this._focus=Ge(ve(this._focus,e),z(this.min),z(this.max))});h(this,er,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Jt)}set locale(e){let t=r(this,Jt);g(this,Jt,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Zt)===null&&g(this,Zt,this.value),document.addEventListener("pointerdown",r(this,er),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,er),!0)}get form(){return r(this,U).form}get validity(){return r(this,U).validity}get validationMessage(){return r(this,U).validationMessage}get valueAsDate(){return z(this.value)}checkValidity(){return r(this,U).checkValidity()}reportValidity(){return r(this,U).reportValidity()}formResetCallback(){this.value=r(this,Zt)??"",this._text=l(this,L,Xt).call(this,this.value),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(l(this,L,$l).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=z(e);if(!t)return!0;let s=z(this.min),o=z(this.max);return s&&t<s||o&&t>o?!0:Js(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){e.has("value")&&!r(this,Qt)?this._text=l(this,L,Xt).call(this,this.value):e.has("locale")&&z(this.value)&&(this._text=l(this,L,Xt).call(this,this.value)),g(this,Qt,!1)}updated(e){r(this,U).setFormValue(this.value||null,this._text);let t=this.renderRoot.querySelector("input")??void 0,s=z(this.value),o=r(this,L,Gt);this.error?r(this,U).setValidity({customError:!0},this.error,t):this._text.trim()&&!s?r(this,U).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,L,Gn)}),t):this.required&&!s?r(this,U).setValidity({valueMissing:!0},this.t("required"),t):s&&z(this.min)&&s<z(this.min)?r(this,U).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:o.medium(z(this.min))}),t):s&&z(this.max)&&s>z(this.max)?r(this,U).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:o.medium(z(this.max))}),t):s&&this.isUnavailable(this.value)?r(this,U).setValidity({customError:!0},this.t("unavailable"),t):r(this,U).setValidity({}),this.open&&r(this,Je)&&(g(this,Je,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&g(this,Je,!1)}render(){let e=r(this,L,Gt),t=z(this.value),s=[this.error&&`${r(this,ce)}-err`,this.helpText&&`${r(this,ce)}-help`].filter(Boolean).join(" "),o=this.getAttribute("aria-label"),d=this.label||o||"",p=gt(this._focus);return n`<div class="field">
|
|
490
|
+
${this.label?n`<label class="label" for="${r(this,ce)}-in" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</label>`:c}
|
|
491
|
+
<div class="wrap">
|
|
492
|
+
<div class="box" part="box">
|
|
493
|
+
<input id="${r(this,ce)}-in" part="input" type="text" autocomplete="off" spellcheck="false"
|
|
494
|
+
.value=${me(this._text)} placeholder=${this.placeholder||r(this,L,Gn)}
|
|
495
|
+
aria-label=${!this.label&&o?o:c}
|
|
496
|
+
?required=${this.required} ?disabled=${this.disabled}
|
|
497
|
+
aria-invalid=${this.error?"true":c} aria-describedby=${s||c}
|
|
498
|
+
@input=${b=>{b.stopPropagation(),this._text=b.target.value}}
|
|
499
|
+
@change=${()=>l(this,L,Qs).call(this)} @keydown=${r(this,_a)} />
|
|
500
|
+
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
501
|
+
aria-label=${t?this.t(d?"changeFor":"change",{label:d,date:e.long(t)}):this.t(d?"chooseFor":"choose",{label:d})}
|
|
502
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,ce)}-pop"
|
|
503
|
+
@click=${r(this,Ma)}><cm-icon name="calendar" size="18"></cm-icon></button>
|
|
504
|
+
</div>
|
|
505
|
+
<div class="pop" id="${r(this,ce)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
506
|
+
?hidden=${!this.open} @keydown=${r(this,Ta)}>
|
|
507
|
+
${this.open?n`<div class="cal">${$a({id:r(this,ce),fmt:e,firstDay:r(this,L,Yn),month:p,focus:this._focus,min:z(this.min),max:z(this.max),isDisabled:b=>this.isUnavailable(ee(b)),mark:b=>t&&ee(b)===this.value?"selected":"",onPick:b=>l(this,L,Xn).call(this,b),onKey:r(this,za),onMonth:r(this,La),previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth")})}</div>`:c}
|
|
508
|
+
</div>
|
|
509
|
+
</div>
|
|
510
|
+
${this.error?n`<p class="error" id="${r(this,ce)}-err" role="alert">${this.error}</p>`:c}
|
|
511
|
+
${this.helpText?n`<p class="help" id="${r(this,ce)}-help">${this.helpText}</p>`:c}
|
|
512
|
+
</div>`}};Jt=new WeakMap,U=new WeakMap,ce=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Je=new WeakMap,L=new WeakSet,Wn=function(){return ba(this,this.locale)},Gt=function(){return ga(r(this,L,Wn))},Yn=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,L,Wn)):(Math.trunc(e)%7+7)%7},Gn=function(){return va(r(this,L,Gt),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Xt=function(e){let t=z(e);return t?r(this,L,Gt).short(t):e},$l=function(){let e=new Date,t=z(this.value)??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=Ge(t,z(this.min),z(this.max)),g(this,Je,!0)},Zs=function(e){e!==this.value&&(this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Qs=function(){let e=this._text.trim();if(!e){l(this,L,Zs).call(this,"");return}let t=xa(e,r(this,L,Gt));t?(l(this,L,Zs).call(this,t),this._text=l(this,L,Xt).call(this,t)):(g(this,Qt,!0),l(this,L,Zs).call(this,""))},Xn=function(e){let t=ee(e);this.isUnavailable(t)||(this.open=!1,l(this,L,Zs).call(this,t),this._text=l(this,L,Xt).call(this,t),l(this,L,Jn).call(this))},Jn=function(){this.renderRoot.querySelector(".trigger")?.focus()},Ma=new WeakMap,_a=new WeakMap,za=new WeakMap,Ta=new WeakMap,La=new WeakMap,er=new WeakMap,Xe.formAssociated=!0,Xe.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Xe.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Yt},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_text:{state:!0},_focus:{state:!0}},Xe.styles=[f,Ea,wa,m`.pop { min-width: 0; }`];u("cm-date-picker",Xe);var vp=$("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month"}),Gc={today:["Today",a=>[a,a]],yesterday:["Yesterday",a=>[Q(a,-1),Q(a,-1)]],"last-7-days":["Last 7 days",a=>[Q(a,-6),a]],"last-30-days":["Last 30 days",a=>[Q(a,-29),a]],"last-90-days":["Last 90 days",a=>[Q(a,-89),a]],"this-month":["This month",a=>[gt(a),a]],"last-month":["Last month",a=>[gt(ve(a,-1)),ua(ve(a,-1))]]},Xc=a=>a.replace(/-([a-z0-9])/g,(i,e)=>e.toUpperCase());function wl(a,i=new Date,e){if(typeof a=="object"&&a)return a;let t=Gc[a];if(!t)return null;let s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),[o,d]=t[1](s);return{label:e?.(Xc(a))||t[0],start:ee(o),end:ee(d)}}var ii,j,ie,si,ri,Qe,_,Zn,ei,Qn,Se,Sa,Le,kl,Ca,ti,eo,El,Aa,Da,Na,Ia,Ra,tr,to,Ze=class extends x{constructor(){super(...arguments);h(this,_);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";h(this,ii,"");this.disabledDates=[];this.presets=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;h(this,j,this.attachInternals());h(this,ie,T("cm-drp"));h(this,si,null);h(this,ri,!1);h(this,Qe,!1);h(this,Se,"start");h(this,Da,()=>{this.disabled||(this.open?this.open=!1:(l(this,_,ti).call(this,"start"),l(this,_,ti).call(this,"end"),this.show()))});h(this,Na,e=>t=>{t.key==="Enter"?l(this,_,ti).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),l(this,_,ti).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});h(this,Ia,e=>{let t=ya(ae(e,this),e,this._focus,r(this,_,Qn));if(t){e.preventDefault(),this._focus=Ge(t,z(this.min),z(this.max)),g(this,Qe,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),l(this,_,eo).call(this,this._focus))});h(this,Ra,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,l(this,_,Aa).call(this);return}ka(e,e.currentTarget)});h(this,tr,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,ii)}set locale(e){let t=r(this,ii);g(this,ii,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,si)||g(this,si,[this.start,this.end]),document.addEventListener("pointerdown",r(this,tr),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,tr),!0)}get form(){return r(this,j).form}get validity(){return r(this,j).validity}get validationMessage(){return r(this,j).validationMessage}checkValidity(){return r(this,j).checkValidity()}reportValidity(){return r(this,j).reportValidity()}formResetCallback(){[this.start,this.end]=r(this,si)??["",""],this._startText=l(this,_,Le).call(this,this.start),this._endText=l(this,_,Le).call(this,this.end),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=z(this.start)?this.start:"",this._draftEnd=z(this.end)?this.end:"",this._hover=null;let e=new Date;this._focus=Ge(z(this.start)??new Date(e.getFullYear(),e.getMonth(),e.getDate()),z(this.min),z(this.max)),g(this,Se,"start"),g(this,Qe,!0),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=z(e);if(!t)return!0;let s=z(this.min),o=z(this.max);return s&&t<s||o&&t>o?!0:Js(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){r(this,ri)||(e.has("start")&&(this._startText=l(this,_,Le).call(this,this.start)),e.has("end")&&(this._endText=l(this,_,Le).call(this,this.end))),g(this,ri,!1),e.has("locale")&&(z(this.start)&&(this._startText=l(this,_,Le).call(this,this.start)),z(this.end)&&(this._endText=l(this,_,Le).call(this,this.end)))}updated(){let e=z(this.start),t=z(this.end),s=new FormData;(this.name||this.startName)&&e&&s.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&s.append(this.endName||`${this.name}-end`,this.end),r(this,j).setFormValue(e||t?s:null,`${this.start}/${this.end}`);let o=this.renderRoot.querySelectorAll("input"),[d,p]=[o[0]??void 0,o[1]??void 0],b=r(this,_,ei),w=z(this.min),y=z(this.max);this.error?r(this,j).setValidity({customError:!0},this.error,d):this._startText.trim()&&!e?r(this,j).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,_,Sa)}),d):this._endText.trim()&&!t?r(this,j).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,_,Sa)}),p):this.required&&(!e||!t)?r(this,j).setValidity({valueMissing:!0},this.t("required"),e?p:d):e&&t&&t<e?r(this,j).setValidity({badInput:!0},this.t("endBeforeStart"),p):e&&w&&e<w||t&&w&&t<w?r(this,j).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:b.medium(w)}),d):e&&y&&e>y||t&&y&&t>y?r(this,j).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:b.medium(y)}),p):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,j).setValidity({customError:!0},this.t("unavailable"),d):r(this,j).setValidity({}),this.open&&r(this,Qe)&&(g(this,Qe,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus())}render(){let e=r(this,_,ei),t=z(this.start),s=z(this.end),o=[this.error&&`${r(this,ie)}-err`,this.helpText&&`${r(this,ie)}-help`].filter(Boolean).join(" "),d=this.getAttribute("aria-label"),p=this.label||d||"",b=Js(this.presets).map(v=>wl(v,new Date,A=>this.t(A))).filter(v=>!!v),w=r(this,Se)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(z(this._draftStart))}):this.t("chooseStart"),y=v=>{let A=v==="start"?this._startText:this._endText;return n`<input id="${r(this,ie)}-${v}" type="text" autocomplete="off" spellcheck="false"
|
|
513
|
+
.value=${me(A)} placeholder=${r(this,_,Sa)}
|
|
514
|
+
aria-label=${v==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
515
|
+
?required=${this.required} ?disabled=${this.disabled}
|
|
516
|
+
aria-invalid=${this.error?"true":c} aria-describedby=${o||c}
|
|
517
|
+
@input=${M=>{M.stopPropagation();let S=M.target.value;v==="start"?this._startText=S:this._endText=S}}
|
|
518
|
+
@change=${()=>l(this,_,ti).call(this,v)} @keydown=${r(this,Na).call(this,v)} />`};return n`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,ie)}-l`:c} aria-label=${!this.label&&d?d:c}>
|
|
519
|
+
${this.label?n`<span class="label" id="${r(this,ie)}-l" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
520
|
+
<div class="wrap">
|
|
521
|
+
<div class="box" part="box">
|
|
522
|
+
${y("start")}<span class="sep" aria-hidden="true">–</span>${y("end")}
|
|
523
|
+
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
524
|
+
aria-label=${t&&s?this.t(p?"changeFor":"change",{label:p,start:e.long(t),end:e.long(s)}):this.t(p?"chooseFor":"choose",{label:p})}
|
|
525
|
+
aria-haspopup="dialog" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,ie)}-pop"
|
|
526
|
+
@click=${r(this,Da)}><cm-icon name="calendar" size="18"></cm-icon></button>
|
|
527
|
+
</div>
|
|
528
|
+
<div class="pop" id="${r(this,ie)}-pop" part="popover" role="dialog" aria-modal="true" aria-label=${this.t("dialog")}
|
|
529
|
+
?hidden=${!this.open} @keydown=${r(this,Ra)}>
|
|
530
|
+
${this.open?n`<div class="body">
|
|
531
|
+
${b.length?n`<ul class="presets" part="presets" aria-label=${this.t("presets")}>${b.map(v=>n`<li>
|
|
532
|
+
<button type="button" class="preset" aria-pressed=${v.start===this.start&&v.end===this.end?"true":"false"}
|
|
533
|
+
@click=${()=>l(this,_,El).call(this,v)}>${v.label}</button></li>`)}</ul>`:c}
|
|
534
|
+
<div class="cal">${$a({id:r(this,ie),fmt:e,firstDay:r(this,_,Qn),month:gt(this._focus),focus:this._focus,min:z(this.min),max:z(this.max),isDisabled:v=>this.isUnavailable(ee(v)),mark:v=>l(this,_,to).call(this,v),note:v=>{let A=l(this,_,to).call(this,v);return A==="start"?this.t("startNote"):A==="end"?this.t("endNote"):""},onPick:v=>l(this,_,eo).call(this,v),onKey:r(this,Ia),onMonth:v=>{this._focus=Ge(ve(this._focus,v),z(this.min),z(this.max))},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:v=>{r(this,Se)==="end"&&(this._hover=v)}})}
|
|
535
|
+
<p class="status" aria-live="polite">${w}</p>
|
|
536
|
+
</div>
|
|
537
|
+
</div>`:c}
|
|
538
|
+
</div>
|
|
539
|
+
</div>
|
|
540
|
+
${this.error?n`<p class="error" id="${r(this,ie)}-err" role="alert">${this.error}</p>`:c}
|
|
541
|
+
${this.helpText?n`<p class="help" id="${r(this,ie)}-help">${this.helpText}</p>`:c}
|
|
542
|
+
</div>`}};ii=new WeakMap,j=new WeakMap,ie=new WeakMap,si=new WeakMap,ri=new WeakMap,Qe=new WeakMap,_=new WeakSet,Zn=function(){return ba(this,this.locale)},ei=function(){return ga(r(this,_,Zn))},Qn=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?fa(r(this,_,Zn)):(Math.trunc(e)%7+7)%7},Se=new WeakMap,Sa=function(){return va(r(this,_,ei),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Le=function(e){let t=z(e);return t?r(this,_,ei).short(t):e},kl=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ca=function(e,t){e===this.start&&t===this.end||(this.start=e,this.end=t,l(this,_,kl).call(this))},ti=function(e){let t=(e==="start"?this._startText:this._endText).trim(),s=t?xa(t,r(this,_,ei)):"";t&&!s&&g(this,ri,!0);let o=e==="start"?[s??"",this.end]:[this.start,s??""];l(this,_,Ca).call(this,...o),s&&(e==="start"?this._startText=l(this,_,Le).call(this,s):this._endText=l(this,_,Le).call(this,s))},eo=function(e){let t=ee(e);if(!this.isUnavailable(t)){if(r(this,Se)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",g(this,Se,"end"),this._focus=e,g(this,Qe,!0);return}this._draftEnd=t,this.open=!1,l(this,_,Ca).call(this,this._draftStart,t),l(this,_,Aa).call(this)}},El=function(e){this.open=!1,l(this,_,Ca).call(this,e.start,e.end),l(this,_,Aa).call(this)},Aa=function(){this.renderRoot.querySelector(".trigger")?.focus()},Da=new WeakMap,Na=new WeakMap,Ia=new WeakMap,Ra=new WeakMap,tr=new WeakMap,to=function(e){let t=ee(e),s=this._draftStart,o=this._draftEnd||(r(this,Se)==="end"&&s?ee(this._hover??this._focus):"");return t===s?"start":t===o&&o>s?"end":s&&o&&t>s&&t<o?"in-range":""},Ze.formAssociated=!0,Ze.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Ze.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},startName:{attribute:"start-name"},endName:{attribute:"end-name"},start:{},end:{},min:{},max:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Yt},isDateDisabled:{attribute:!1},presets:{converter:Yt},startLabel:{attribute:"start-label",string:"start"},endLabel:{attribute:"end-label",string:"end"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_startText:{state:!0},_endText:{state:!0},_focus:{state:!0},_draftStart:{state:!0},_draftEnd:{state:!0},_hover:{state:!0}},Ze.styles=[f,Ea,wa,m`
|
|
543
|
+
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
544
|
+
input { flex: 0 1 6.6em; }
|
|
545
|
+
:host([size='small']) input { flex-basis: 6.6em; }
|
|
546
|
+
.trigger { margin-inline-start: auto; }
|
|
547
|
+
.body { display: flex; gap: var(--cm-space-15); }
|
|
548
|
+
.presets { display: flex; flex-direction: column; gap: 2px; min-width: 140px; margin: 0; padding: 0; padding-inline-end: var(--cm-space-15); list-style: none; border-inline-end: var(--cm-border-1) solid var(--cm-border-default); }
|
|
549
|
+
.preset {
|
|
550
|
+
width: 100%; min-height: 36px; padding: 6px var(--cm-space-10); border: 0; border-radius: var(--cm-radius-sm);
|
|
551
|
+
background: none; font: inherit; font-size: 14px; text-align: start; color: var(--cm-text-default); cursor: pointer;
|
|
552
|
+
}
|
|
553
|
+
.preset:hover { background: var(--cm-bg-hover); }
|
|
554
|
+
.preset[aria-pressed='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
555
|
+
.status { margin: var(--cm-space-10) 0 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
556
|
+
@media (max-width: 640px) {
|
|
557
|
+
.body { flex-direction: column; }
|
|
558
|
+
.presets { flex-direction: row; flex-wrap: wrap; min-width: 0; padding: 0 0 var(--cm-space-10); border-inline-end: 0; border-block-end: var(--cm-border-1) solid var(--cm-border-default); }
|
|
559
|
+
.presets li { flex: 0 0 auto; }
|
|
560
|
+
.preset { width: auto; border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-full); min-height: 32px; }
|
|
561
|
+
}
|
|
562
|
+
`];u("cm-date-range-picker",Ze);var Ep=$("fileUpload",{prompt:"Click here to upload",addMore:"Add more",files:"Chosen files",remove:"Remove {name}",kilobytes:"{size} KB",megabytes:"{size} MB",required:"Please choose a file.",wrongType:"{name} is not an allowed file type",tooLarge:"{name} is larger than {size}",tooMany:"You can add up to {max} files"});function Jc(a,i){if(!i.trim())return!0;let e=a.name.toLowerCase(),t=a.type.toLowerCase();return i.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean).some(s=>s.startsWith(".")?e.endsWith(s):s.endsWith("/*")?t.startsWith(s.slice(0,-1)):t===s)}var de,he,Ce,K,io,Ml,_l,Ha,so,et=class extends x{constructor(){super(...arguments);h(this,K);this.label="";this.hint="";this.name="";this.accept="";this.multiple=!1;this.maxSize=0;this.maxFiles=0;this.required=!1;this.disabled=!1;this.error="";this.files=[];this._rejected="";h(this,de,this.attachInternals());h(this,he,T("cm-fu"));h(this,Ce,new Map)}get form(){return r(this,de).form}get validity(){return r(this,de).validity}get validationMessage(){return r(this,de).validationMessage}checkValidity(){return r(this,de).checkValidity()}reportValidity(){return r(this,de).reportValidity()}formResetCallback(){this.files=[],this._rejected=""}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,Ce).values())URL.revokeObjectURL(e);r(this,Ce).clear()}updated(e){if(e.has("files"))for(let[d,p]of r(this,Ce))this.files.includes(d)||(URL.revokeObjectURL(p),r(this,Ce).delete(d));let t=new FormData;for(let d of this.files)t.append(this.name||"file",d);r(this,de).setFormValue(this.files.length?t:null);let s=this.renderRoot.querySelector("input")??void 0,o=this.error||this._rejected;o?r(this,de).setValidity({customError:!0},o,s):this.required&&!this.files.length?r(this,de).setValidity({valueMissing:!0},this.t("required"),s):r(this,de).setValidity({})}addFiles(e){let t=[...e],s=[],o=[],d=[];for(let b of t)Jc(b,this.accept)?this.maxSize&&b.size>this.maxSize?(o.push(b),d.push(this.t("tooLarge",{name:b.name,size:l(this,K,io).call(this,this.maxSize)}))):s.push(b):(o.push(b),d.push(this.t("wrongType",{name:b.name})));let p=this.multiple?[...this.files,...s]:s.slice(-1);!this.multiple&&!s.length&&(p=this.files),this.multiple&&this.maxFiles&&p.length>this.maxFiles&&(o.push(...p.slice(this.maxFiles)),d.push(this.t("tooMany",{max:this.maxFiles})),p=p.slice(0,this.maxFiles)),this._rejected=d.join(". "),o.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:o}})),p!==this.files&&(p.length!==this.files.length||p.some((b,w)=>b!==this.files[w]))&&(this.files=p,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){let e=this.error||this._rejected,t=!this.files.length||this.multiple,s=this.files.length>0;return n`
|
|
563
|
+
${this.label||this.hint?n`<div class="head">
|
|
564
|
+
${this.label?n`<span class="label" id="${r(this,he)}-l" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
565
|
+
${this.hint?n`<span class="hint" id="${r(this,he)}-hint">${this.hint}</span>`:c}
|
|
566
|
+
</div>`:c}
|
|
567
|
+
${s?n`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
568
|
+
${this.files.map(o=>n`<li class="file">
|
|
569
|
+
${o.type.startsWith("image/")?n`<img src=${l(this,K,Ml).call(this,o)} alt=${o.name} />`:n`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${o.name}</span><span class="size">${l(this,K,io).call(this,o.size)}</span></div>`}
|
|
570
|
+
${this.disabled?c:n`<button type="button" class="remove" aria-label=${this.t("remove",{name:o.name})} @click=${()=>this.removeFile(o)}><cm-icon name="close" size="12"></cm-icon></button>`}
|
|
294
571
|
</li>`)}
|
|
295
|
-
${t?
|
|
296
|
-
</ul>`:
|
|
297
|
-
${e?
|
|
298
|
-
`}};
|
|
299
|
-
@dragenter=${()=>
|
|
300
|
-
<input type="file" id=${
|
|
572
|
+
${t?n`<li>${l(this,K,so).call(this,!0)}</li>`:c}
|
|
573
|
+
</ul>`:l(this,K,so).call(this,!1)}
|
|
574
|
+
${e?n`<p class="msg" id="${r(this,he)}-msg" role="alert">${e}</p>`:c}
|
|
575
|
+
`}};de=new WeakMap,he=new WeakMap,Ce=new WeakMap,K=new WeakSet,io=function(e){return e>=1024*1024?this.t("megabytes",{size:this.formatNumber(+(e/1024/1024).toFixed(1),{useGrouping:!1})}):this.t("kilobytes",{size:this.formatNumber(Math.max(1,Math.round(e/1024)),{useGrouping:!1})})},Ml=function(e){let t=r(this,Ce).get(e);return t||(t=URL.createObjectURL(e),r(this,Ce).set(e,t)),t},_l=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},Ha=function(e){this.toggleAttribute("data-over",e)},so=function(e){let t=[this.hint&&`${r(this,he)}-hint`,(this.error||this._rejected)&&`${r(this,he)}-msg`].filter(Boolean).join(" ");return n`<label class="zone ${e?"tile":""}" part="zone"
|
|
576
|
+
@dragenter=${()=>l(this,K,Ha).call(this,!0)} @dragleave=${()=>l(this,K,Ha).call(this,!1)} @drop=${()=>l(this,K,Ha).call(this,!1)}>
|
|
577
|
+
<input type="file" id=${r(this,he)} accept=${this.accept||c} ?multiple=${this.multiple} ?disabled=${this.disabled}
|
|
301
578
|
?required=${this.required&&!this.files.length}
|
|
302
|
-
aria-labelledby=${[this.label&&`${
|
|
303
|
-
aria-describedby=${t||
|
|
304
|
-
@change=${
|
|
579
|
+
aria-labelledby=${[this.label&&`${r(this,he)}-l`,`${r(this,he)}-p`].filter(Boolean).join(" ")}
|
|
580
|
+
aria-describedby=${t||c} aria-invalid=${this.error||this._rejected?"true":c}
|
|
581
|
+
@change=${l(this,K,_l)} @cancel=${s=>s.stopPropagation()} />
|
|
305
582
|
<cm-icon name=${e?"plus":"upload"} size=${e?24:38}></cm-icon>
|
|
306
|
-
<span id="${
|
|
307
|
-
</label>`},
|
|
583
|
+
<span id="${r(this,he)}-p">${e?this.t("addMore"):this.prompt}</span>
|
|
584
|
+
</label>`},et.formAssociated=!0,et.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},et.properties={label:{},hint:{},prompt:{string:"prompt"},name:{reflect:!0},accept:{},multiple:{type:Boolean},maxSize:{type:Number,attribute:"max-size"},maxFiles:{type:Number,attribute:"max-files"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},error:{reflect:!0},files:{attribute:!1},_rejected:{state:!0}},et.styles=[f,m`
|
|
308
585
|
:host { display: block; }
|
|
309
586
|
.head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: var(--cm-space-10); margin-bottom: var(--cm-space-20); }
|
|
310
587
|
.label { font-size: var(--cm-type-heading-sm-size); font-weight: 600; }
|
|
311
|
-
.req { color: var(--cm-text-critical); margin-
|
|
588
|
+
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
312
589
|
.hint { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
313
590
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 186px)); gap: var(--cm-space-30); }
|
|
314
591
|
.zone {
|
|
@@ -329,7 +606,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
329
606
|
.doc .name { font-size: 12px; word-break: break-all; }
|
|
330
607
|
.doc .size, .tile .size { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
331
608
|
.remove {
|
|
332
|
-
position: absolute; top: -10px;
|
|
609
|
+
position: absolute; top: -10px; inset-inline-end: -10px; display: inline-flex; align-items: center; justify-content: center;
|
|
333
610
|
width: 24px; height: 24px; padding: 0; border-radius: var(--cm-radius-full); cursor: pointer;
|
|
334
611
|
background: var(--cm-bg-surface); color: var(--cm-icon-selected); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
335
612
|
}
|
|
@@ -341,20 +618,20 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
341
618
|
.zone:not(.tile) { min-height: 100px; font-size: 14px; }
|
|
342
619
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
343
620
|
}
|
|
344
|
-
`];
|
|
345
|
-
${this.label?
|
|
621
|
+
`];u("cm-file-upload",et);var Cp=$("optionGroup",{required:"Please select one of these options."}),be,ir,ai,sr,xe,ro,ao,zl,vt=class extends x{constructor(){super(...arguments);h(this,xe);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];h(this,be,this.attachInternals());h(this,ir,T("cm-og"));h(this,ai,"");h(this,sr,new MutationObserver(()=>l(this,xe,ro).call(this)))}connectedCallback(){super.connectedCallback(),l(this,xe,ro).call(this),r(this,sr).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,sr).disconnect()}get form(){return r(this,be).form}get validity(){return r(this,be).validity}get validationMessage(){return r(this,be).validationMessage}checkValidity(){return r(this,be).checkValidity()}reportValidity(){return r(this,be).reportValidity()}formResetCallback(){this.value=r(this,ai)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){r(this,ai)||g(this,ai,this.value)}updated(){r(this,be).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,be).setValidity({valueMissing:!0},this.t("required"),e):r(this,be).setValidity({})}render(){let e=this.items,t=e.findIndex(d=>d.value===this.value&&!d.disabled),s=t>=0?t:e.findIndex(d=>!d.disabled),o=this.getAttribute("aria-label");return n`
|
|
622
|
+
${this.label?n`<span class="label" id="${r(this,ir)}-l" part="label">${this.label}${this.required?n`<span class="req" aria-hidden="true">*</span>`:c}</span>`:c}
|
|
346
623
|
<div class="options" part="options" role="radiogroup"
|
|
347
|
-
aria-labelledby=${this.label?`${
|
|
348
|
-
aria-required=${this.required?"true":
|
|
349
|
-
${e.map((d,
|
|
350
|
-
tabindex=${
|
|
351
|
-
@click=${()=>
|
|
624
|
+
aria-labelledby=${this.label?`${r(this,ir)}-l`:c} aria-label=${!this.label&&o?o:c}
|
|
625
|
+
aria-required=${this.required?"true":c}>
|
|
626
|
+
${e.map((d,p)=>n`<button type="button" role="radio" part="option" aria-checked=${d.value===this.value?"true":"false"}
|
|
627
|
+
tabindex=${p===s?"0":"-1"} ?disabled=${this.disabled||!!d.disabled}
|
|
628
|
+
@click=${()=>l(this,xe,ao).call(this,p)} @keydown=${b=>l(this,xe,zl).call(this,b,p)}>${d.label}</button>`)}
|
|
352
629
|
</div>
|
|
353
630
|
<slot></slot>
|
|
354
|
-
`}};
|
|
631
|
+
`}};be=new WeakMap,ir=new WeakMap,ai=new WeakMap,sr=new WeakMap,xe=new WeakSet,ro=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??"",g(this,ai,this.value))},ao=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}))))},zl=function(e,t){let s=ae(e,this),o=this.items.flatMap((b,w)=>b.disabled?[]:[w]),d=o.indexOf(t),p;if(s==="ArrowRight"||e.key==="ArrowDown")p=o[(d+1)%o.length];else if(s==="ArrowLeft"||e.key==="ArrowUp")p=o[(d-1+o.length)%o.length];else if(e.key==="Home")p=o[0];else if(e.key==="End")p=o[o.length-1];else return;e.preventDefault(),p!==void 0&&l(this,xe,ao).call(this,p)},vt.formAssociated=!0,vt.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},vt.styles=[f,m`
|
|
355
632
|
:host { display: block; }
|
|
356
633
|
.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-
|
|
634
|
+
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
358
635
|
.options { display: flex; flex-wrap: wrap; gap: var(--cm-space-20); }
|
|
359
636
|
button {
|
|
360
637
|
height: 46px; padding: 0 var(--cm-space-20); font: inherit; font-size: 16px; font-weight: 500; white-space: nowrap;
|
|
@@ -372,43 +649,25 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
372
649
|
.options { gap: var(--cm-space-10); }
|
|
373
650
|
button { height: 42px; padding: 0 var(--cm-space-15); font-size: 14px; }
|
|
374
651
|
}
|
|
375
|
-
`];
|
|
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">
|
|
652
|
+
`];u("cm-option-group",vt);var qp=$("pageHeader",{back:"Back to {label}",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),rr,no,ni=class extends x{constructor(){super(...arguments);h(this,rr);this.heading="";this.breadcrumbs=[];this.pagination=!1;this.hasPrevious=!1;this.hasNext=!1}render(){let e=Array.isArray(this.breadcrumbs)?this.breadcrumbs:[],t=[...e].reverse().find(s=>s.href);return n`<header part="header">
|
|
394
653
|
<div class="lead">
|
|
395
|
-
${t?
|
|
654
|
+
${t?n`<a class="back" part="back" href=${t.href} aria-label=${this.t("back",{label:t.label})}><cm-icon name="chevron-left" size="20"></cm-icon></a>`:c}
|
|
396
655
|
<div class="titles">
|
|
397
|
-
${e.length?
|
|
398
|
-
${e.map(
|
|
656
|
+
${e.length?n`<nav aria-label=${this.t("breadcrumbs")} part="breadcrumbs"><ol>
|
|
657
|
+
${e.map(s=>n`<li>${s.href?n`<a href=${s.href}>${s.label}</a>`:s.label}</li>`)}
|
|
399
658
|
<li><span aria-current="page">${this.heading}</span></li>
|
|
400
|
-
</ol></nav>`:
|
|
659
|
+
</ol></nav>`:c}
|
|
401
660
|
<h1 part="title"><span class="text">${this.heading}</span><slot name="title-adornment"></slot></h1>
|
|
402
661
|
</div>
|
|
403
662
|
</div>
|
|
404
663
|
<div class="actions">
|
|
405
|
-
${this.pagination?
|
|
406
|
-
<button class="arrow" type="button" aria-label
|
|
407
|
-
<button class="arrow" type="button" aria-label
|
|
408
|
-
</div>`:
|
|
664
|
+
${this.pagination?n`<div class="arrows" role="group" aria-label=${this.t("records")}>
|
|
665
|
+
<button class="arrow" type="button" aria-label=${this.t("previous")} ?disabled=${!this.hasPrevious} @click=${()=>l(this,rr,no).call(this,"cm-previous")}><cm-icon name="chevron-left" size="16"></cm-icon></button>
|
|
666
|
+
<button class="arrow" type="button" aria-label=${this.t("next")} ?disabled=${!this.hasNext} @click=${()=>l(this,rr,no).call(this,"cm-next")}><cm-icon name="chevron-right" size="16"></cm-icon></button>
|
|
667
|
+
</div>`:c}
|
|
409
668
|
<slot name="actions"></slot>
|
|
410
669
|
</div>
|
|
411
|
-
</header>`}};
|
|
670
|
+
</header>`}};rr=new WeakSet,no=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},ni.properties={heading:{},breadcrumbs:{type:Array},pagination:{type:Boolean,reflect:!0},hasPrevious:{type:Boolean,attribute:"has-previous"},hasNext:{type:Boolean,attribute:"has-next"}},ni.styles=[f,m`
|
|
412
671
|
:host { display: block; }
|
|
413
672
|
header {
|
|
414
673
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-20);
|
|
@@ -429,7 +688,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
429
688
|
font-size: 26px; font-weight: 500; line-height: 1.2;
|
|
430
689
|
}
|
|
431
690
|
.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-
|
|
691
|
+
.actions { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-20); margin-inline-start: auto; }
|
|
433
692
|
.arrows { display: flex; gap: var(--cm-space-10); }
|
|
434
693
|
.arrow, .back {
|
|
435
694
|
display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
|
|
@@ -440,29 +699,31 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
440
699
|
.arrow:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-default); cursor: not-allowed; }
|
|
441
700
|
.back { display: none; border: 0; flex: none; text-decoration: none; }
|
|
442
701
|
@media (max-width: 640px) {
|
|
443
|
-
|
|
444
|
-
|
|
702
|
+
/* Title and actions share one row while they fit; otherwise the actions wrap below, so nothing spills sideways. */
|
|
703
|
+
header { min-height: 50px; padding: var(--cm-space-10); gap: var(--cm-space-10); }
|
|
704
|
+
.lead { flex: 1 1 160px; }
|
|
705
|
+
.actions { flex: 0 1 auto; min-width: 0; max-width: 100%; justify-content: flex-end; }
|
|
445
706
|
nav { display: none; }
|
|
446
707
|
.back { display: inline-flex; }
|
|
447
708
|
h1 { font-size: 18px; font-weight: 600; }
|
|
448
709
|
.actions { gap: var(--cm-space-10); }
|
|
449
710
|
}
|
|
450
|
-
`];
|
|
711
|
+
`];u("cm-page-header",ni);var Up=$("actionBar",{label:"Actions"}),oi=class extends x{constructor(){super(...arguments);this.eyebrow="";this.heading="";this.tone="default";this.sticky=!1;this.label=""}render(){let e=this.tone==="critical";return n`<div class="bar" part="bar" role="region" aria-label=${this.label||this.heading||this.eyebrow||this.t("label")}>
|
|
451
712
|
<div class="lead">
|
|
452
|
-
${e?
|
|
713
|
+
${e?n`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:c}
|
|
453
714
|
<div class="text">
|
|
454
715
|
<div class="eyebrow" ?hidden=${!this.eyebrow}>${this.eyebrow}<slot name="adornment"></slot></div>
|
|
455
|
-
${this.heading?
|
|
716
|
+
${this.heading?n`<p class="heading" part="heading" role=${e?"alert":c}>${this.heading}</p>`:c}
|
|
456
717
|
<slot></slot>
|
|
457
718
|
</div>
|
|
458
719
|
</div>
|
|
459
720
|
<div class="actions"><slot name="actions"></slot></div>
|
|
460
|
-
</div>`}};
|
|
721
|
+
</div>`}};oi.properties={eyebrow:{},heading:{},tone:{reflect:!0},sticky:{type:Boolean,reflect:!0},label:{}},oi.styles=[f,m`
|
|
461
722
|
:host { display: block; }
|
|
462
723
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
463
724
|
.bar {
|
|
464
725
|
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)
|
|
726
|
+
min-height: 80px; padding: var(--cm-space-15) var(--cm-space-20);
|
|
466
727
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card); border-radius: var(--cm-radius-md);
|
|
467
728
|
}
|
|
468
729
|
:host([sticky]) .bar { box-shadow: var(--cm-shadow-100); }
|
|
@@ -479,7 +740,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
479
740
|
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
|
|
480
741
|
border-radius: var(--cm-radius-full); background: var(--cm-bg-surface); color: var(--cm-icon-critical);
|
|
481
742
|
}
|
|
482
|
-
.actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-20); margin-
|
|
743
|
+
.actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-20); margin-inline-start: auto; }
|
|
483
744
|
@media (max-width: 640px) {
|
|
484
745
|
.bar { min-height: 68px; padding: var(--cm-space-10); gap: var(--cm-space-10); }
|
|
485
746
|
.heading { font-size: 14px; }
|
|
@@ -488,13 +749,13 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
488
749
|
.icon { width: 30px; height: 30px; }
|
|
489
750
|
.actions { gap: var(--cm-space-10); }
|
|
490
751
|
}
|
|
491
|
-
`];
|
|
752
|
+
`];u("cm-action-bar",oi);var Jp=$("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),ye,xt,ar,Y,oo,lo,co,Tl,Ll,li=class extends x{constructor(){super(...arguments);h(this,Y);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";h(this,ye,null);h(this,xt,()=>{this.open=!0});h(this,ar,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>l(this,Y,oo).call(this))}disconnectedCallback(){super.disconnectedCallback(),l(this,Y,lo).call(this)}updated(e){e.has("form")&&this.isConnected&&l(this,Y,oo).call(this)}render(){return n`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
492
753
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
493
754
|
<div class="actions">
|
|
494
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${
|
|
495
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${
|
|
755
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${l(this,Y,Ll)}>${this.discardLabel}</cm-button>
|
|
756
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${l(this,Y,Tl)}>${this.saveLabel}</cm-button>
|
|
496
757
|
</div>
|
|
497
|
-
</div>`}};
|
|
758
|
+
</div>`}};ye=new WeakMap,xt=new WeakMap,ar=new WeakMap,Y=new WeakSet,oo=function(){l(this,Y,lo).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,ye,e),e.addEventListener("input",r(this,xt)),e.addEventListener("change",r(this,xt)),e.addEventListener("reset",r(this,ar)))},lo=function(){let e=r(this,ye);e&&(e.removeEventListener("input",r(this,xt)),e.removeEventListener("change",r(this,xt)),e.removeEventListener("reset",r(this,ar)),g(this,ye,null))},co=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},Tl=function(){this.loading||this.saveDisabled||l(this,Y,co).call(this,"cm-save")&&r(this,ye)&&r(this,ye).requestSubmit()},Ll=function(){this.loading||l(this,Y,co).call(this,"cm-discard")&&r(this,ye)&&(r(this,ye).reset(),this.open=!1)},li.properties={open:{type:Boolean,reflect:!0},message:{string:"message"},saveLabel:{attribute:"save-label",string:"save"},discardLabel:{attribute:"discard-label",string:"discard"},loading:{type:Boolean,reflect:!0},saveDisabled:{type:Boolean,attribute:"save-disabled"},form:{}},li.styles=[f,m`
|
|
498
759
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
499
760
|
:host(:not([open])) { display: none; }
|
|
500
761
|
.bar {
|
|
@@ -504,20 +765,20 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
504
765
|
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100);
|
|
505
766
|
}
|
|
506
767
|
.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-
|
|
768
|
+
.actions { flex: none; display: flex; gap: var(--cm-space-20); margin-inline-start: auto; }
|
|
508
769
|
@media (max-width: 640px) {
|
|
509
770
|
.bar { min-height: 68px; padding: var(--cm-space-10); gap: var(--cm-space-10); }
|
|
510
771
|
.message { font-size: 14px; font-weight: 500; }
|
|
511
772
|
.actions { gap: var(--cm-space-10); }
|
|
512
773
|
}
|
|
513
|
-
`];
|
|
514
|
-
${this.heading||this.action?
|
|
774
|
+
`];u("cm-save-bar",li);var ci=class extends k{constructor(){super(...arguments);this.heading="";this.action="";this.actionLabel="";this.headingLevel=2;this._list=!0}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return n`<section part="panel" aria-label=${this.heading||c}>
|
|
775
|
+
${this.heading||this.action?n`<header>
|
|
515
776
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
516
|
-
${this.action?
|
|
517
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:
|
|
518
|
-
</header>`:
|
|
519
|
-
<div class="items" role=${this._list?"list":
|
|
520
|
-
</section>`}};
|
|
777
|
+
${this.action?n`<button class="action" type="button" part="action" aria-label=${this.actionLabel||c}
|
|
778
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:c}
|
|
779
|
+
</header>`:c}
|
|
780
|
+
<div class="items" role=${this._list?"list":c}><slot @slotchange=${t=>{this._list=t.target.assignedElements().every(s=>s.localName==="cm-info-item")}}></slot></div>
|
|
781
|
+
</section>`}};ci.properties={heading:{},action:{},actionLabel:{attribute:"action-label"},headingLevel:{type:Number,attribute:"heading-level"},_list:{state:!0}},ci.styles=[f,m`
|
|
521
782
|
:host { display: block; }
|
|
522
783
|
section {
|
|
523
784
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card);
|
|
@@ -533,7 +794,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
533
794
|
.action:hover { text-decoration: underline; }
|
|
534
795
|
.action:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
535
796
|
.items { display: grid; grid-template-columns: 1fr 1fr; gap: var(--cm-space-15) var(--cm-space-20); }
|
|
536
|
-
`];
|
|
797
|
+
`];u("cm-info-panel",ci);var di=class extends k{constructor(){super(...arguments);this.label="";this.half=!1}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}render(){return n`<div class="label" part="label">${this.label}</div><div class="value" part="value"><slot></slot></div>`}};di.properties={label:{},half:{type:Boolean,reflect:!0}},di.styles=[f,m`
|
|
537
798
|
:host { display: block; grid-column: 1 / -1; min-width: 0; }
|
|
538
799
|
:host([half]) { grid-column: auto; }
|
|
539
800
|
.label { font-size: 16px; }
|
|
@@ -541,24 +802,24 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
541
802
|
display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-10);
|
|
542
803
|
margin-top: 6px; font-size: 16px; font-weight: 500; overflow-wrap: anywhere;
|
|
543
804
|
}
|
|
544
|
-
`];
|
|
805
|
+
`];u("cm-info-item",di);var yt,hi=class extends k{constructor(){super(...arguments);this.heading="";this.open=!1;this.disabled=!1;this.headingLevel=3;h(this,yt,T("cm-accordion"))}toggle(){this.disabled||(this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{bubbles:!0,composed:!0,detail:{open:this.open}})))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||3));return n`<div class="wrap" part="accordion">
|
|
545
806
|
<div class="h" role="heading" aria-level=${e}>
|
|
546
|
-
<button type="button" part="toggle" id="${
|
|
807
|
+
<button type="button" part="toggle" id="${r(this,yt)}-btn" aria-expanded=${this.open?"true":"false"} aria-controls="${r(this,yt)}-body"
|
|
547
808
|
?disabled=${this.disabled} @click=${this.toggle}>
|
|
548
809
|
<span>${this.heading}</span>
|
|
549
810
|
<span class="chev" aria-hidden="true"><cm-icon name="chevron-down" size="16"></cm-icon></span>
|
|
550
811
|
</button>
|
|
551
812
|
</div>
|
|
552
|
-
<div class="body" part="body" id="${
|
|
553
|
-
</div>`}};
|
|
813
|
+
<div class="body" part="body" id="${r(this,yt)}-body" role="region" aria-labelledby="${r(this,yt)}-btn" ?hidden=${!this.open}><slot></slot></div>
|
|
814
|
+
</div>`}};yt=new WeakMap,hi.properties={heading:{},open:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},hi.styles=[f,m`
|
|
554
815
|
:host { display: block; }
|
|
555
816
|
.wrap { border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface); }
|
|
556
817
|
.h { margin: 0; font: inherit; }
|
|
557
818
|
button {
|
|
558
819
|
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)
|
|
820
|
+
min-height: 60px; padding-block: var(--cm-space-12); padding-inline: var(--cm-space-20) var(--cm-space-15);
|
|
560
821
|
border: 0; border-radius: inherit; background: none; color: var(--cm-text-default);
|
|
561
|
-
font: inherit; font-size: 16px; text-align:
|
|
822
|
+
font: inherit; font-size: 16px; text-align: start; cursor: pointer;
|
|
562
823
|
}
|
|
563
824
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
564
825
|
button:disabled { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
@@ -572,14 +833,14 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
572
833
|
.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
834
|
.body[hidden] { display: none; }
|
|
574
835
|
@media (max-width: 640px) { button { min-height: 50px; font-size: 14px; } .chev { width: 28px; height: 28px; } }
|
|
575
|
-
`];
|
|
576
|
-
<div class="circle" part="circle" aria-hidden=${this.hasImage?
|
|
577
|
-
<slot name="image" @slotchange=${
|
|
836
|
+
`];u("cm-accordion",hi);var mi,qa,pi=class extends k{constructor(){super(...arguments);h(this,mi);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="large";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=this.image?n`<img src=${this.image} alt="" part="image">`:this.icon?n`<cm-icon name=${this.icon} size="96"></cm-icon>`:c;return n`<div class="wrap" part="empty-state">
|
|
837
|
+
<div class="circle" part="circle" aria-hidden=${this.hasImage?c:"true"}>
|
|
838
|
+
<slot name="image" @slotchange=${s=>l(this,mi,qa).call(this,s,"hasImage")}>${t}</slot>
|
|
578
839
|
</div>
|
|
579
840
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
580
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${
|
|
581
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${
|
|
582
|
-
</div>`}}
|
|
841
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${s=>l(this,mi,qa).call(this,s,"hasText")}></slot></div>
|
|
842
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${s=>l(this,mi,qa).call(this,s,"hasActions")}></slot></div>
|
|
843
|
+
</div>`}};mi=new WeakSet,qa=function(e,t){let s=e.target;this[t]=s.assignedNodes({flatten:!0}).some(o=>o.nodeType===1||o.textContent.trim()),this.requestUpdate()},pi.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0}},pi.styles=[f,m`
|
|
583
844
|
:host { display: block; }
|
|
584
845
|
.wrap {
|
|
585
846
|
display: flex; flex-direction: column; align-items: center; text-align: center;
|
|
@@ -603,7 +864,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
603
864
|
.title { margin-top: 30px; font-size: 14px; }
|
|
604
865
|
.actions { gap: var(--cm-space-10); }
|
|
605
866
|
}
|
|
606
|
-
`];
|
|
867
|
+
`];u("cm-empty-state",pi);var Sl={small:34,medium:40,large:50,xlarge:186},ui=class extends k{constructor(){super(...arguments);this.variant="text";this.lines=1;this.size="large"}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-hidden","true")}render(){if(this.variant==="thumbnail"){let t=Sl[this.size]??Sl.large;return n`<span class="bone" part="bone" style="width:${t}px;height:${t}px"></span>`}if(this.variant==="block")return n`<span class="bone block" part="bone"></span>`;let e=Math.max(1,Math.floor(this.lines||1));return n`${Array.from({length:e},(t,s)=>n`<span class="bone line ${e>1&&s===e-1?"short":""}" part="bone"></span>`)}`}};ui.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},ui.styles=[f,m`
|
|
607
868
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
608
869
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
609
870
|
.bone {
|
|
@@ -618,17 +879,17 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
618
879
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
619
880
|
}
|
|
620
881
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
621
|
-
`];
|
|
882
|
+
`];u("cm-skeleton",ui);var Zc=[472,90,90,251],Qc=[94,266,134,191,138],bi=class extends x{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1}render(){let e=t=>t.map(s=>n`<span class="bone" style="height:${s}px"></span>`);return n`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
622
883
|
<span class="sr" role="status">${this.label}</span>
|
|
623
884
|
<div class="page" aria-hidden="true">
|
|
624
|
-
${this.navigation?
|
|
885
|
+
${this.navigation?n`<span class="bone nav"></span>`:c}
|
|
625
886
|
<span class="bone head"></span>
|
|
626
887
|
<div class="body">
|
|
627
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
628
|
-
<div class="col side">${e(
|
|
888
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:Zc)}</div>
|
|
889
|
+
<div class="col side">${e(Qc)}</div>
|
|
629
890
|
</div>
|
|
630
891
|
</div>
|
|
631
|
-
</div>`}};
|
|
892
|
+
</div>`}};bi.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},bi.styles=[f,m`
|
|
632
893
|
:host { display: block; }
|
|
633
894
|
.page { display: grid; grid-template-columns: 1fr; gap: var(--cm-space-10); }
|
|
634
895
|
:host([navigation]) .page { grid-template-columns: 250px minmax(0, 1fr); }
|
|
@@ -652,11 +913,11 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
652
913
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
653
914
|
.head { height: 60px; }
|
|
654
915
|
}
|
|
655
|
-
`];
|
|
656
|
-
${e?
|
|
916
|
+
`];u("cm-skeleton-display",bi);var km=$("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),Oa,Cl,fi=class extends x{constructor(){super(...arguments);h(this,Oa);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=l(this,Oa,Cl).call(this);return n`<article part="comment">
|
|
917
|
+
${e?n`<time class="meta" part="time" datetime=${this.datetime||c}>${e}</time>`:c}
|
|
657
918
|
<div class="body" part="body"><slot></slot></div>
|
|
658
|
-
${this.author?
|
|
659
|
-
</article>`}};
|
|
919
|
+
${this.author?n`<div class="meta" part="author">– ${this.author}</div>`:c}
|
|
920
|
+
</article>`}};Oa=new WeakSet,Cl=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:ge(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},fi.properties={author:{},datetime:{},time:{}},fi.styles=[f,m`
|
|
660
921
|
:host { display: block; }
|
|
661
922
|
article {
|
|
662
923
|
display: flex; flex-direction: column; gap: 6px; padding: var(--cm-space-10);
|
|
@@ -664,16 +925,16 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
664
925
|
}
|
|
665
926
|
.meta { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
666
927
|
.body { font-size: 14px; line-height: 16px; overflow-wrap: anywhere; }
|
|
667
|
-
`];
|
|
668
|
-
<div class="title" id="${
|
|
669
|
-
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||
|
|
928
|
+
`];u("cm-comment",fi);var nr,Pa,Al,gi=class extends x{constructor(){super(...arguments);h(this,Pa);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;h(this,nr,T("cm-comment-box"));this.hasComments=!1}submit(){let e=this.renderRoot.querySelector("textarea"),t=(e?.value??this.value).trim();if(this.disabled)return;if(!t){e?.focus();return}let s=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(s)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return n`<section part="comment-box" aria-labelledby="${r(this,nr)}-h">
|
|
929
|
+
<div class="title" id="${r(this,nr)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
930
|
+
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||c} .value=${this.value}
|
|
670
931
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
671
|
-
@keydown=${
|
|
932
|
+
@keydown=${l(this,Pa,Al)}></textarea>
|
|
672
933
|
<div class="actions"><cm-button variant="primary" size="large" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
673
934
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
674
935
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
675
936
|
</div>
|
|
676
|
-
</section>`}};
|
|
937
|
+
</section>`}};nr=new WeakMap,Pa=new WeakSet,Al=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},gi.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},gi.styles=[f,m`
|
|
677
938
|
:host { display: block; }
|
|
678
939
|
section { display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
679
940
|
.title { margin: 0; font-size: 20px; font-weight: 600; }
|
|
@@ -694,17 +955,17 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
694
955
|
textarea { min-height: 100px; }
|
|
695
956
|
.actions { justify-content: flex-end; }
|
|
696
957
|
}
|
|
697
|
-
`];
|
|
958
|
+
`];u("cm-comment-box",gi);var Sm=$("smartTip",{newTab:"(opens in a new tab)"}),Cm=$("smartTips",{heading:"Smart tips",tourAction:"Start"}),vi=class extends x{constructor(){super(...arguments);this.heading="";this.href="";this.target=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-smart-tips"&&this.setAttribute("role","listitem")}render(){let e=this.target==="_blank";return n`<a part="tip" href=${this.href||c} target=${this.target||c} rel=${e?"noopener noreferrer":c}>
|
|
698
959
|
<span class="text">
|
|
699
960
|
<span class="title" part="heading">${this.heading}</span>
|
|
700
961
|
<span class="desc" part="description"><slot></slot></span>
|
|
701
|
-
${e?
|
|
962
|
+
${e?n`<span style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">${this.t("newTab")}</span>`:c}
|
|
702
963
|
</span>
|
|
703
964
|
<span class="go" aria-hidden="true"><cm-icon name="arrow-up-right" size="16"></cm-icon></span>
|
|
704
|
-
</a>`}};
|
|
965
|
+
</a>`}};vi.properties={heading:{},href:{},target:{}},vi.styles=[f,m`
|
|
705
966
|
:host { display: block; }
|
|
706
967
|
a {
|
|
707
|
-
display: flex; align-items: flex-start; gap: var(--cm-space-10); padding: var(--cm-space-20) var(--cm-space-10)
|
|
968
|
+
display: flex; align-items: flex-start; gap: var(--cm-space-10); padding: var(--cm-space-20) var(--cm-space-10);
|
|
708
969
|
min-height: 104px; background: var(--cm-bg-surface); color: var(--cm-text-default); text-decoration: none;
|
|
709
970
|
border: var(--cm-border-1) solid var(--cm-border-default); border-radius: var(--cm-radius-md);
|
|
710
971
|
}
|
|
@@ -718,21 +979,21 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
718
979
|
}
|
|
719
980
|
a:hover .go, a:focus-visible .go { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
720
981
|
a:hover .title { text-decoration: underline; }
|
|
721
|
-
`];
|
|
722
|
-
${this.tourHeading?
|
|
982
|
+
`];u("cm-smart-tip",vi);var xi=class extends x{constructor(){super(...arguments);this.tourHeading="";this.headingLevel=2}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return n`<div class="card" part="smart-tips">
|
|
983
|
+
${this.tourHeading?n`<div class="tour" part="tour">
|
|
723
984
|
<span class="tour-icon" aria-hidden="true"><cm-icon name="rocket" size="18"></cm-icon></span>
|
|
724
985
|
<span class="tour-text">${this.tourHeading}</span>
|
|
725
986
|
<cm-button size="medium" @click=${()=>this.dispatchEvent(new CustomEvent("cm-tour",{bubbles:!0,composed:!0}))}>${this.tourAction}</cm-button>
|
|
726
|
-
</div>`:
|
|
987
|
+
</div>`:c}
|
|
727
988
|
<section class="panel" part="panel" aria-label=${this.heading}>
|
|
728
989
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
729
990
|
<div class="list" role="list"><slot></slot></div>
|
|
730
991
|
</section>
|
|
731
|
-
</div>`}};
|
|
992
|
+
</div>`}};xi.properties={heading:{string:"heading"},tourHeading:{attribute:"tour-heading"},tourAction:{attribute:"tour-action",string:"tourAction"},headingLevel:{type:Number,attribute:"heading-level"}},xi.styles=[f,m`
|
|
732
993
|
:host { display: block; }
|
|
733
994
|
.card { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
734
995
|
.tour {
|
|
735
|
-
display: flex; align-items: center; gap: var(--cm-space-10); min-height: 60px; padding: var(--cm-space-12)
|
|
996
|
+
display: flex; align-items: center; gap: var(--cm-space-10); min-height: 60px; padding-block: var(--cm-space-12); padding-inline: var(--cm-space-20) 14px;
|
|
736
997
|
border-radius: var(--cm-radius-md); background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
737
998
|
}
|
|
738
999
|
.tour-icon {
|
|
@@ -746,34 +1007,34 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
746
1007
|
letter-spacing: var(--cm-tracking-caps); text-transform: uppercase;
|
|
747
1008
|
}
|
|
748
1009
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
749
|
-
`];
|
|
1010
|
+
`];u("cm-smart-tips",xi);var Hm=$("pagination",{label:"Pagination",rows:"Number of rows",summary:"Showing {from}\u2013{to} of {total} {resource}",page:"Page",of:"of {count}",previous:"Previous page",next:"Next page"}),Ae,$i,Dl,Nl,yi=class extends x{constructor(){super(...arguments);h(this,$i);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;h(this,Ae,T("cm-pg"))}get pageCount(){return Math.max(1,Math.ceil((this.total||0)/Math.max(1,this.pageSize)))}goTo(e){let t=Math.min(this.pageCount,Math.max(1,Math.round(e)||1));if(this._draft=null,t===this.page){this.requestUpdate();return}this.page=t,this.dispatchEvent(new CustomEvent("cm-page-change",{detail:{page:t},bubbles:!0,composed:!0}))}render(){let e=this.pageCount,t=Math.min(e,Math.max(1,this.page)),s=this.total?(t-1)*this.pageSize+1:0,o=Math.min(this.total,t*this.pageSize),d=this.pageSizes??[];return n`
|
|
750
1011
|
<nav part="bar" aria-label=${this.label}>
|
|
751
|
-
${
|
|
752
|
-
<label for="${
|
|
753
|
-
<span class="field"><select id="${
|
|
754
|
-
${(
|
|
1012
|
+
${d.length?n`<div class="rows" part="rows">
|
|
1013
|
+
<label for="${r(this,Ae)}-s">${this.t("rows")}</label>
|
|
1014
|
+
<span class="field"><select id="${r(this,Ae)}-s" @change=${l(this,$i,Dl)}>
|
|
1015
|
+
${(d.includes(this.pageSize)?d:[...d,this.pageSize].sort((p,b)=>p-b)).map(p=>n`<option value=${p} ?selected=${p===this.pageSize}>${p}</option>`)}
|
|
755
1016
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
756
|
-
</div>`:
|
|
757
|
-
<div class="summary" part="summary" role="status">${this.total
|
|
1017
|
+
</div>`:c}
|
|
1018
|
+
<div class="summary" part="summary" role="status">${this.total?this.t("summary",{from:s,to:o,total:this.total,resource:this.resourceName}).replace(/\s+/g," ").trim():c}</div>
|
|
758
1019
|
<div class="pages" part="pages">
|
|
759
1020
|
<span class="counter">
|
|
760
|
-
<label for="${
|
|
761
|
-
<input id="${
|
|
762
|
-
.value=${this._draft??String(t)} aria-describedby="${
|
|
763
|
-
@input=${
|
|
764
|
-
@keydown=${
|
|
765
|
-
@change=${
|
|
766
|
-
<span id="${
|
|
1021
|
+
<label for="${r(this,Ae)}-p">${this.t("page")}</label>
|
|
1022
|
+
<input id="${r(this,Ae)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
1023
|
+
.value=${this._draft??String(t)} aria-describedby="${r(this,Ae)}-of"
|
|
1024
|
+
@input=${p=>this._draft=p.target.value}
|
|
1025
|
+
@keydown=${l(this,$i,Nl)}
|
|
1026
|
+
@change=${p=>this.goTo(Number(p.target.value))} />
|
|
1027
|
+
<span id="${r(this,Ae)}-of">${this.t("of",{count:e})}</span>
|
|
767
1028
|
</span>
|
|
768
1029
|
<span class="arrows">
|
|
769
|
-
<button class="prev" type="button" part="previous" aria-label
|
|
1030
|
+
<button class="prev" type="button" part="previous" aria-label=${this.t("previous")} ?disabled=${t<=1}
|
|
770
1031
|
@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
|
|
1032
|
+
<button class="next" type="button" part="next" aria-label=${this.t("next")} ?disabled=${t>=e}
|
|
772
1033
|
@click=${()=>this.goTo(t+1)}><cm-icon name="chevron-right" size="12"></cm-icon></button>
|
|
773
1034
|
</span>
|
|
774
1035
|
</div>
|
|
775
1036
|
</nav>
|
|
776
|
-
`}};
|
|
1037
|
+
`}};Ae=new WeakMap,$i=new WeakSet,Dl=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})))},Nl=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))},yi.properties={page:{type:Number,reflect:!0},total:{type:Number},pageSize:{type:Number,attribute:"page-size"},pageSizes:{type:Array,attribute:"page-sizes"},label:{string:"label"},resourceName:{attribute:"resource-name"},_draft:{state:!0}},yi.styles=[f,m`
|
|
777
1038
|
:host { display: block; }
|
|
778
1039
|
nav {
|
|
779
1040
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 60px; padding: 0 var(--cm-space-20);
|
|
@@ -786,12 +1047,12 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
786
1047
|
height: 34px; font: inherit; font-weight: 500; color: var(--cm-text-default); background: var(--cm-bg-surface);
|
|
787
1048
|
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
788
1049
|
}
|
|
789
|
-
select { appearance: none; padding: 0
|
|
790
|
-
.field cm-icon { position: absolute;
|
|
1050
|
+
select { appearance: none; padding-block: 0; padding-inline: 10px 28px; min-width: 56px; cursor: pointer; }
|
|
1051
|
+
.field cm-icon { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
|
|
791
1052
|
input { width: 38px; padding: 0; text-align: center; -moz-appearance: textfield; }
|
|
792
1053
|
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
|
|
793
1054
|
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-
|
|
1055
|
+
.arrows { display: flex; gap: var(--cm-space-10); margin-inline-start: var(--cm-space-10); }
|
|
795
1056
|
button {
|
|
796
1057
|
width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
|
|
797
1058
|
color: var(--cm-icon-selected); background: var(--cm-bg-hover);
|
|
@@ -807,14 +1068,14 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
807
1068
|
.arrows { display: contents; }
|
|
808
1069
|
.prev { order: -1; }
|
|
809
1070
|
}
|
|
810
|
-
`];
|
|
811
|
-
<div class="tabs" part="tabs" role="tablist" aria-label=${this.getAttribute("aria-label")||"
|
|
812
|
-
${e.map((
|
|
813
|
-
tabindex=${
|
|
814
|
-
@click=${()=>
|
|
1071
|
+
`];u("cm-pagination",yi);var Vm=$("statusTabs",{label:"Status"}),or,pe,ho,Il,po,Rl,wi=class extends x{constructor(){super(...arguments);h(this,pe);this.value="";this.tabs=[];this.controls="";this.size="large";this._slotted=[];h(this,or,new MutationObserver(()=>l(this,pe,ho).call(this)))}connectedCallback(){super.connectedCallback(),l(this,pe,ho).call(this),r(this,or).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,or).disconnect()}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(){if(!("ariaControlsElements"in Element.prototype))return;let e=this.getRootNode(),t=this.controls?e.getElementById?.(this.controls):null;for(let s of this.renderRoot.querySelectorAll("button"))s.ariaControlsElements=t?[t]:null}render(){let e=this.items,t=l(this,pe,Il).call(this,e);return n`
|
|
1072
|
+
<div class="tabs" part="tabs" role="tablist" aria-label=${this.getAttribute("aria-label")||this.t("label")}>
|
|
1073
|
+
${e.map((s,o)=>n`<button type="button" role="tab" part="tab" aria-selected=${o===t?"true":"false"}
|
|
1074
|
+
tabindex=${o===t?"0":"-1"} ?disabled=${!!s.disabled}
|
|
1075
|
+
@click=${()=>l(this,pe,po).call(this,o)} @keydown=${d=>l(this,pe,Rl).call(this,d,o)}>${s.label}${s.count!==void 0&&!Number.isNaN(s.count)?n` <span class="count">(</span> ${this.formatNumber(s.count)} <span class="count">)</span>`:c}</button>`)}
|
|
815
1076
|
</div>
|
|
816
1077
|
<slot></slot>
|
|
817
|
-
`}};
|
|
1078
|
+
`}};or=new WeakMap,pe=new WeakSet,ho=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let s=t.getAttribute("count");return{value:t.value,label:t.label||t.textContent.trim(),count:s===null||s===""?void 0:Number(s),disabled:t.disabled}}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"")},Il=function(e){let t=e.findIndex(s=>s.value===this.value&&!s.disabled);return t>=0?t:e.findIndex(s=>!s.disabled)},po=function(e){let t=this.items[e];!t||t.disabled||(this.updateComplete.then(()=>{let s=this.renderRoot.querySelectorAll("button")[e];s?.focus(),s?.scrollIntoView?.({block:"nearest",inline:"nearest"})}),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},Rl=function(e,t){let s=ae(e,this),o=this.items.flatMap((b,w)=>b.disabled?[]:[w]),d=o.indexOf(t),p;if(s==="ArrowRight")p=o[(d+1)%o.length];else if(s==="ArrowLeft")p=o[(d-1+o.length)%o.length];else if(e.key==="Home")p=o[0];else if(e.key==="End")p=o[o.length-1];else return;e.preventDefault(),p!==void 0&&l(this,pe,po).call(this,p)},wi.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},_slotted:{state:!0}},wi.styles=[f,m`
|
|
818
1079
|
:host { display: block; }
|
|
819
1080
|
.tabs {
|
|
820
1081
|
display: flex; gap: 28px; overflow-x: auto; scrollbar-width: thin; padding: 2px 2px 0;
|
|
@@ -825,7 +1086,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
825
1086
|
background: none; border: 0; cursor: pointer;
|
|
826
1087
|
}
|
|
827
1088
|
button::after {
|
|
828
|
-
content: ''; position: absolute;
|
|
1089
|
+
content: ''; position: absolute; inset-inline: 0; bottom: 4px; height: 2px; border-radius: 1px; background: transparent;
|
|
829
1090
|
}
|
|
830
1091
|
button:hover:not(:disabled) { color: var(--cm-text-default); }
|
|
831
1092
|
button[aria-selected='true'] { color: var(--cm-text-default); }
|
|
@@ -838,20 +1099,20 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
838
1099
|
@media (max-width: 640px) {
|
|
839
1100
|
.tabs { gap: 18px; font-size: 14px; }
|
|
840
1101
|
}
|
|
841
|
-
`];
|
|
842
|
-
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":
|
|
1102
|
+
`];u("cm-status-tabs",wi);var Jm=$("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),ja,lr,De,mo,Hl,ql,ki=class extends x{constructor(){super(...arguments);h(this,De);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;h(this,ja,T("cm-th"));h(this,lr,new MutationObserver(()=>l(this,De,mo).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),l(this,De,mo).call(this),r(this,lr).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,lr).disconnect()}get items(){return this.columns.length?this.columns.map(e=>typeof e=="string"?{key:e,label:e}:{...e,key:e.key??e.label}):this._slotted}render(){let e=this._inTable,t=this.items;return n`
|
|
1103
|
+
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":c}
|
|
843
1104
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
844
|
-
${this.selectable?
|
|
845
|
-
<input id="${
|
|
846
|
-
@change=${
|
|
847
|
-
<span class="box" aria-hidden="true">${this.indeterminate?
|
|
848
|
-
</span></span>`:
|
|
849
|
-
${t.map(
|
|
850
|
-
aria-sort=${e&&
|
|
851
|
-
name=${
|
|
1105
|
+
${this.selectable?n`<span class="cell" role=${e?"columnheader":c}><span class="check">
|
|
1106
|
+
<input id="${r(this,ja)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
1107
|
+
@change=${l(this,De,ql)} />
|
|
1108
|
+
<span class="box" aria-hidden="true">${this.indeterminate?n`<span class="dash"></span>`:this.checked?n`<cm-icon name="check" size="14"></cm-icon>`:c}</span>
|
|
1109
|
+
</span></span>`:c}
|
|
1110
|
+
${t.map(s=>{let o=this.sort===s.key,d=o?this.direction==="descending"?"descending":"ascending":"none",p=s.hidden?n`<span class="sr">${s.label}</span>`:s.label;return n`<span class="cell" part="cell" data-align=${s.align??"start"} role=${e?"columnheader":c}
|
|
1111
|
+
aria-sort=${e&&s.sortable?d:c}>${s.sortable?n`<button type="button" class=${o?"on":""} @click=${()=>l(this,De,Hl).call(this,s)}>${p}${e?c:n`<span class="sr">${o?this.t("sorted",{direction:this.t(d)}):this.t("sortable")}</span>`}<cm-icon
|
|
1112
|
+
name=${o&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:p}</span>`})}
|
|
852
1113
|
</div>
|
|
853
1114
|
<slot></slot>
|
|
854
|
-
`}};
|
|
1115
|
+
`}};ja=new WeakMap,lr=new WeakMap,De=new WeakSet,mo=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"}})},Hl=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}))},ql=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}))},ki.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}},ki.styles=[f,m`
|
|
855
1116
|
:host { display: block; }
|
|
856
1117
|
slot { display: none; } /* <option> children are column data, not content */
|
|
857
1118
|
.bar {
|
|
@@ -860,7 +1121,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
860
1121
|
background: var(--cm-bg-hover); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
861
1122
|
border-radius: var(--cm-radius-md) var(--cm-radius-md) 0 0;
|
|
862
1123
|
}
|
|
863
|
-
.bar.sel { grid-template-columns: 20px var(--cm-table-columns, var(--_cols)); padding-
|
|
1124
|
+
.bar.sel { grid-template-columns: 20px var(--cm-table-columns, var(--_cols)); padding-inline-start: var(--cm-space-10); }
|
|
864
1125
|
.cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
865
1126
|
.cell[data-align='center'] { text-align: center; }
|
|
866
1127
|
.cell[data-align='end'] { text-align: end; }
|
|
@@ -881,7 +1142,7 @@ var Dr=o=>{throw TypeError(o)};var Ds=(o,i,e)=>i.has(o)||Dr("Cannot "+e);var s=(
|
|
|
881
1142
|
.dash { width: 10px; height: 2px; background: var(--cm-icon-selected); }
|
|
882
1143
|
input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
883
1144
|
slot { display: none; }
|
|
884
|
-
`];
|
|
1145
|
+
`];u("cm-table-header",ki);var ru=$("dataTable",{empty:"No data",sorted:"Sorted by {column}, {direction}"}),Ol=!1,ed=`
|
|
885
1146
|
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
1147
|
cm-data-table > table caption { text-align: start; font-weight: 500; font-size: 16px; padding-block-end: var(--cm-space-10); }
|
|
887
1148
|
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; }
|
|
@@ -897,22 +1158,22 @@ cm-data-table > table th > button.cm-sort:hover cm-icon, cm-data-table > table t
|
|
|
897
1158
|
cm-data-table > table th > button.cm-sort:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
898
1159
|
@media (forced-colors: active) { cm-data-table > table th > button.cm-sort cm-icon { opacity: 1; } }
|
|
899
1160
|
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
|
|
901
|
-
<div class="scroll" part="scroll" tabindex=${this.stickyHeader||this.stickyFirstColumn?"0":
|
|
902
|
-
role=${this.stickyHeader||this.stickyFirstColumn?"region":
|
|
903
|
-
aria-label=${(this.stickyHeader||this.stickyFirstColumn)&&this.caption?this.caption:
|
|
1161
|
+
`;function td(){if(Ol||typeof document>"u")return;Ol=!0;let a=new CSSStyleSheet;a.replaceSync(ed),document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]}var id=a=>(a.align??(a.type==="numeric"||a.type==="money"?"end":"start"))==="end";function Pl(a){if(typeof a=="number")return a;let i=String(a??"").trim(),e=/^\(.*\)$/.test(i)||/^-|^[^\d]*-\s*\d/.test(i),t=i.match(/\d[\d,]*(?:\.\d+)?/);if(!t)return NaN;let s=Number(t[0].replace(/,/g,""));return e?-s:s}var jl=a=>a instanceof Date?a.getTime():typeof a=="number"?a:Date.parse(String(a??"")),Bl=new Map;function sd(a){let i=Bl.get(a??"");if(!i){try{i=new Intl.Collator(a,{numeric:!0,sensitivity:"base"})}catch{i=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"})}Bl.set(a??"",i)}return i}function Fl(a,i,e,t){let s=o=>o==null||o==="";return s(a)||s(i)?s(a)===s(i)?0:s(a)?1:-1:e==="numeric"||e==="money"?(Pl(a)||0)-(Pl(i)||0):e==="date"?(jl(a)||0)-(jl(i)||0):sd(t).compare(String(a),String(i))}var _i,cr,N,uo,bo,Vl,fo,Ul,Kl,Ba,Ei,Mi=class extends x{constructor(){super(...arguments);h(this,N);this.columns=[];this.rows=[];this.totals=null;this.caption="";this.captionHidden=!1;this.sort="";this.direction="ascending";this.sortMode="auto";this.stickyHeader=!1;this.stickyFirstColumn=!1;this.loading=!1;this.loadingRows=5;this._light=!1;this._announce="";h(this,_i,!1);h(this,cr,new MutationObserver(()=>l(this,N,uo).call(this)))}connectedCallback(){super.connectedCallback(),l(this,N,uo).call(this),r(this,cr).observe(this,{childList:!0,subtree:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,cr).disconnect()}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(o=>o.key===this.sort);if(!t||this.sortMode==="manual")return e;let s=this.direction==="descending"?-1:1;return e.map((o,d)=>[o,d]).sort(([o,d],[p,b])=>{let w=o[t.key],y=p[t.key],v=w==null||w==="",A=y==null||y==="";return v||A?v===A?d-b:v?1:-1:s*Fl(w,y,t.type,this.locale)||d-b}).map(([o])=>o)}updated(e){if(r(this,_i)&&(e.has("sort")||e.has("direction"))&&this.sort){g(this,_i,!1);let t=this.columns.find(s=>s.key===this.sort);t&&l(this,N,bo).call(this,t.label,this.direction)}}render(){let e=n`<span class="sr" role="status">${this._announce}</span>`;if(this._light)return n`<div class="scroll" part="scroll"><slot></slot></div>${e}`;let t=this.columns??[],s=this.sortedRows,o=Math.max(1,t.length),d=!this.loading&&s.length===0;return n`
|
|
1162
|
+
<div class="scroll" part="scroll" tabindex=${this.stickyHeader||this.stickyFirstColumn?"0":c}
|
|
1163
|
+
role=${this.stickyHeader||this.stickyFirstColumn?"region":c}
|
|
1164
|
+
aria-label=${(this.stickyHeader||this.stickyFirstColumn)&&this.caption?this.caption:c}>
|
|
904
1165
|
<table part="table" aria-busy=${this.loading?"true":"false"}>
|
|
905
|
-
${this.caption?
|
|
906
|
-
<thead><tr>${t.map(
|
|
907
|
-
name=${
|
|
1166
|
+
${this.caption?n`<caption part="caption">${this.caption}</caption>`:c}
|
|
1167
|
+
<thead><tr>${t.map(p=>{let b=this.sort===p.key,w=b?this.direction:"none",y=p.hidden?n`<span class="sr">${p.label}</span>`:p.label;return n`<th scope="col" class=${l(this,N,Ei).call(this,p)} aria-sort=${p.sortable?w:c}>${p.sortable?n`<button type="button" class=${b?"on":""} @click=${()=>l(this,N,Kl).call(this,p)}>${y}<cm-icon
|
|
1168
|
+
name=${b&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:y}</th>`})}</tr></thead>
|
|
908
1169
|
<tbody>
|
|
909
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>
|
|
910
|
-
${d?
|
|
1170
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>n`<tr>${t.map(p=>n`<td class=${l(this,N,Ei).call(this,p)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):s.map(p=>n`<tr part="row">${t.map((b,w)=>w===0?n`<th scope="row" class=${l(this,N,Ei).call(this,b)} part="cell">${l(this,N,Ba).call(this,p[b.key])}</th>`:n`<td class=${l(this,N,Ei).call(this,b)} part="cell">${l(this,N,Ba).call(this,p[b.key])}</td>`)}</tr>`)}
|
|
1171
|
+
${d?n`<tr class="empty"><td colspan=${o}><slot name="empty">${this.t("empty")}</slot></td></tr>`:c}
|
|
911
1172
|
</tbody>
|
|
912
|
-
${this.totals&&!this.loading&&!d?
|
|
1173
|
+
${this.totals&&!this.loading&&!d?n`<tfoot><tr part="totals">${t.map(p=>n`<td class=${l(this,N,Ei).call(this,p)}>${l(this,N,Ba).call(this,this.totals[p.key])}</td>`)}</tr></tfoot>`:c}
|
|
913
1174
|
</table>
|
|
914
1175
|
</div>${e}
|
|
915
|
-
`}};
|
|
1176
|
+
`}};_i=new WeakMap,cr=new WeakMap,N=new WeakSet,uo=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(td(),l(this,N,Vl).call(this))},bo=function(e,t){this._announce=this.t("sorted",{column:e,direction:this.t(t)})},Vl=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;t&&[...t].forEach((s,o)=>{if(!s.dataset.sort||s.querySelector(":scope > button.cm-sort"))return;s.dataset.type=s.dataset.sort;let d=document.createElement("button");d.type="button",d.className="cm-sort",d.append(...s.childNodes);let p=document.createElement("cm-icon");p.setAttribute("size","12"),d.append(p),s.append(d),s.hasAttribute("aria-sort")||s.setAttribute("aria-sort","none"),l(this,N,fo).call(this,s),d.addEventListener("click",()=>l(this,N,Ul).call(this,e,s,o))})},fo=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Ul=function(e,t,s){let o=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),d=t.dataset.key||o,p=t.getAttribute("aria-sort")==="ascending"?"descending":"ascending",b=new CustomEvent("cm-sort",{detail:{key:d,direction:p},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(b)||this.sortMode==="manual")return;let w=t.dataset.sort,y=p==="descending"?-1:1;for(let v of e.tBodies){let A=S=>{let O=S.cells[s];return O?(O.dataset.value??O.textContent??"").trim():""},M=[...v.rows].map((S,O)=>[S,A(S),O]).sort(([,S,O],[,I,R])=>S===""||I===""?S===I?O-R:S===""?1:-1:y*Fl(S,I,w,this.locale)||O-R);v.append(...M.map(([S])=>S))}for(let v of e.tHead.rows[0].cells)v.dataset.sort&&(v.setAttribute("aria-sort",v===t?p:"none"),l(this,N,fo).call(this,v));l(this,N,bo).call(this,o,p)},Kl=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",s=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),o=this.dispatchEvent(s);g(this,_i,o),o&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},Ba=function(e){return e==null?"":e instanceof Date?ge(e,{},this.locale):String(e)},Ei=function(e){return`${id(e)?"end":""} ${e.type==="numeric"||e.type==="money"?"num":""}`},Mi.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}},Mi.styles=[f,m`
|
|
916
1177
|
:host { display: block; font-size: 14px; line-height: 1.5; }
|
|
917
1178
|
.scroll { overflow: auto; max-block-size: var(--cm-data-table-max-height, none); }
|
|
918
1179
|
.scroll:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
@@ -949,18 +1210,18 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
949
1210
|
.empty td { padding: var(--cm-space-20); border-block-end: 0; }
|
|
950
1211
|
.light { display: contents; }
|
|
951
1212
|
@media (forced-colors: active) { button cm-icon { opacity: 1; } }
|
|
952
|
-
`];
|
|
953
|
-
aria-expanded=${String(this.open)} aria-controls="${
|
|
954
|
-
@click=${
|
|
1213
|
+
`];u("cm-data-table",Mi);var zi=class extends k{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1}render(){return null}toItem(){let e=(this.textContent??"").trim();return{label:e,value:this.value||e,icon:this.icon||void 0,href:this.href||void 0,disabled:this.disabled||void 0,critical:this.critical||void 0}}};zi.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0}},zi.styles=m`:host { display: none; }`;u("cm-menu-item",zi);function dr(a){let i=[];for(let e of Array.from(a.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),s=o=>e.getAttribute(o)||void 0;i.push({label:t,value:s("value")??t,icon:s("icon"),href:s("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0})}else e.localName==="hr"&&i.push({divider:!0});return i}function Fa(a,i){let e=new MutationObserver(i);return e.observe(a,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var bu=$("actionMenu",{label:"Actions"}),hr,Si,$t,pr,D,Va,mr,go,Ua,Ka,Wa,ur,br,Ti,Ya,Wl,Yl,Li=class extends x{constructor(){super(...arguments);h(this,D);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this._slotted=[];this._active=-1;this._custom=!1;h(this,hr);h(this,Si,T("cm-menu"));h(this,$t,"");h(this,pr,0);h(this,mr,e=>{this.open&&!e.composedPath().includes(this)&&l(this,D,Ka).call(this,!1)});h(this,ur,e=>{e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0))});h(this,br,()=>{this.open?this.hide():this.show()});h(this,Ya,e=>{let t=l(this,D,Ua).call(this),s=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),l(this,D,Ti).call(this,t[(s+1)%t.length]);break;case"ArrowUp":e.preventDefault(),l(this,D,Ti).call(this,t[(s-1+t.length)%t.length]);break;case"Home":e.preventDefault(),l(this,D,Ti).call(this,t[0]);break;case"End":e.preventDefault(),l(this,D,Ti).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 o=Date.now();g(this,$t,(o-r(this,pr)<600?r(this,$t):"")+e.key.toLowerCase()),g(this,pr,o);let d=this.menuItems,p=r(this,$t).length>1?s:s+1,w=[...t.slice(Math.max(p,0)),...t.slice(0,Math.max(p,0))].find(y=>(d[y].label??"").toLowerCase().startsWith(r(this,$t)));w!==void 0&&l(this,D,Ti).call(this,w)}}})}connectedCallback(){super.connectedCallback(),l(this,D,Va).call(this),g(this,hr,Fa(this,()=>l(this,D,Va).call(this))),document.addEventListener("pointerdown",r(this,mr),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,hr)?.disconnect(),document.removeEventListener("pointerdown",r(this,mr),!0)}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=l(this,D,Ua).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,l(this,D,Ka).call(this,!0),this.updateComplete.then(()=>l(this,D,Wa).call(this))}hide(e=!1){l(this,D,Ka).call(this,!1),e&&l(this,D,go).call(this)?.focus()}updated(e){if(this._custom){let t=l(this,D,go).call(this);if(t){let s=(o,d)=>{t.getAttribute(o)!==d&&t.setAttribute(o,d)};s("aria-haspopup","menu"),s("aria-expanded",String(this.open)),s("aria-controls",`${r(this,Si)}-m`)}}if(e.has("open")&&this.open&&this._active<0){let t=l(this,D,Ua).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>l(this,D,Wa).call(this))}}render(){let e=this.menuItems,t=this.triggerLabel||this.label,s=this._custom?n`<slot name="trigger" @click=${r(this,br)} @keydown=${r(this,ur)} @slotchange=${()=>l(this,D,Va).call(this)}></slot>`:n`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
1214
|
+
aria-expanded=${String(this.open)} aria-controls="${r(this,Si)}-m" aria-label=${this.iconOnly?t:c}
|
|
1215
|
+
@click=${r(this,br)} @keydown=${r(this,ur)}>${this.iconOnly?n`<cm-icon name=${this.icon} size="18"></cm-icon>`:n`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return n`${s}
|
|
955
1216
|
<div class="pop" part="menu" ?hidden=${!this.open}>
|
|
956
|
-
${this.heading?
|
|
957
|
-
<div role="menu" id="${
|
|
958
|
-
${e.map((
|
|
1217
|
+
${this.heading?n`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?n`<span>${this.subheading}</span>`:c}</div>`:c}
|
|
1218
|
+
<div role="menu" id="${r(this,Si)}-m" aria-label=${this.heading||this.label} @keydown=${r(this,Ya)}>
|
|
1219
|
+
${e.map((o,d)=>l(this,D,Yl).call(this,o,d))}
|
|
959
1220
|
</div>
|
|
960
1221
|
</div>
|
|
961
|
-
<slot hidden></slot>`}};
|
|
962
|
-
@pointerenter=${d.over} @click=${d.click}>${
|
|
963
|
-
aria-disabled=${e.disabled?"true":
|
|
1222
|
+
<slot hidden></slot>`}};hr=new WeakMap,Si=new WeakMap,$t=new WeakMap,pr=new WeakMap,D=new WeakSet,Va=function(){this._slotted=dr(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},mr=new WeakMap,go=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},Ua=function(){return this.menuItems.map((e,t)=>!e.divider&&!e.disabled?t:-1).filter(e=>e>=0)},Ka=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})))},Wa=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},ur=new WeakMap,br=new WeakMap,Ti=function(e){this._active=e,this.updateComplete.then(()=>l(this,D,Wa).call(this))},Ya=new WeakMap,Wl=function(e,t){if(t.disabled){e.preventDefault();return}let s=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));s||e.preventDefault(),this.hide(!t.href||!s)},Yl=function(e,t){if(e.divider)return n`<div role="separator"></div>`;let s=`item${e.critical?" critical":""}${t===this._active?" active":""}`,o=n`${e.icon?n`<cm-icon name=${e.icon} size="16"></cm-icon>`:c}<span>${e.label}</span>`,d={over:()=>{e.disabled||(this._active=t)},click:p=>l(this,D,Wl).call(this,p,e)};return e.href&&!e.disabled?n`<a class=${s} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
1223
|
+
@pointerenter=${d.over} @click=${d.click}>${o}</a>`:n`<button type="button" class=${s} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
1224
|
+
aria-disabled=${e.disabled?"true":c} @pointerenter=${d.over} @click=${d.click}>${o}</button>`},Li.properties={items:{type:Array},open:{type:Boolean,reflect:!0},label:{string:"label"},triggerLabel:{attribute:"trigger-label"},iconOnly:{type:Boolean,attribute:"icon-only"},icon:{},align:{reflect:!0},heading:{},subheading:{},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},Li.styles=[f,m`
|
|
964
1225
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
965
1226
|
.trigger {
|
|
966
1227
|
display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 500;
|
|
@@ -993,7 +1254,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
993
1254
|
}
|
|
994
1255
|
.item.active:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 1px; }
|
|
995
1256
|
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-default); }
|
|
996
|
-
`];
|
|
1257
|
+
`];u("cm-action-menu",Li);var wu=$("resourceItem",{select:"Select {name}"}),ku=$("resourceList",{resourceName:"item",resourceNamePlural:"items",select:"Select",selectPageHidden:"all {count} {resource} on this page",selectionOptions:"Selection options",selectPage:"Select all {count} on this page",selectAll:"Select all {count} {resource}",selectNone:"Select none",selected:"{count} {resource} selected.",allSelected:"All {count} {resource} selected.",clearSelection:"Clear selection",loading:"Loading {resource}"}),Gl=m`
|
|
997
1258
|
.check { position: relative; display: inline-flex; flex: none; width: 20px; height: 20px; }
|
|
998
1259
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
999
1260
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -1005,17 +1266,17 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1005
1266
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
1006
1267
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1007
1268
|
.check input:disabled + .box { border-color: var(--cm-border-default); background: var(--cm-bg-input-filled); }
|
|
1008
|
-
`,
|
|
1009
|
-
${this.href&&!this.disabled?
|
|
1010
|
-
<div class="row" part="row" @click=${
|
|
1011
|
-
${this.selectable?
|
|
1269
|
+
`,Xa,Ja,Xl,Ai=class extends x{constructor(){super();h(this,Ja);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;h(this,Xa,this.attachInternals());r(this,Xa).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get name(){return this.label||this.textContent.replace(/\s+/g," ").trim()}toggle(e){if(this.disabled)return;let t=e??!this.selected;t!==this.selected&&(this.selected=t,this.dispatchEvent(new CustomEvent("cm-resource-select",{detail:{value:this.value,selected:t},bubbles:!0,composed:!0})))}render(){return n`
|
|
1270
|
+
${this.href&&!this.disabled?n`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:c}
|
|
1271
|
+
<div class="row" part="row" @click=${l(this,Ja,Xl)}>
|
|
1272
|
+
${this.selectable?n`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
1012
1273
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
1013
|
-
<span class="box" aria-hidden="true">${this.selected?
|
|
1274
|
+
<span class="box" aria-hidden="true">${this.selected?n`<cm-icon name="check" size="14"></cm-icon>`:c}</span></span>`:c}
|
|
1014
1275
|
<span class="media"><slot name="media"></slot></span>
|
|
1015
1276
|
<div class="content" part="content"><slot></slot></div>
|
|
1016
1277
|
<div class="actions" part="actions"><slot name="actions"></slot></div>
|
|
1017
1278
|
</div>
|
|
1018
|
-
`}};
|
|
1279
|
+
`}};Xa=new WeakMap,Ja=new WeakSet,Xl=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(s=>s instanceof HTMLElement&&s!==this&&s.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},Ai.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0}},Ai.styles=[f,Gl,m`
|
|
1019
1280
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-default); }
|
|
1020
1281
|
:host(:last-child) { border-bottom: 0; }
|
|
1021
1282
|
.row {
|
|
@@ -1042,29 +1303,29 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1042
1303
|
::slotted([slot='media']) { width: 34px; height: 34px; }
|
|
1043
1304
|
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 34px; }
|
|
1044
1305
|
}
|
|
1045
|
-
`];
|
|
1046
|
-
${this.selectable?
|
|
1306
|
+
`];u("cm-resource-item",Ai);var fr,te,Jl,Ci,Ga,Za,Di=class extends x{constructor(){super();h(this,te);this.selectable=!1;this.total=0;this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this._count=0;this._rows=0;h(this,fr,T("cm-rl"));h(this,Za,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,l(this,te,Ci).call(this),l(this,te,Ga).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),l(this,te,Ci).call(this),l(this,te,Ga).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,l(this,te,Ci).call(this),l(this,te,Ga).call(this)}clearSelection(){this.selectPage(!1)}updated(e){e.has("selectable")&&l(this,te,Ci).call(this)}render(){let e=this._count,t=this._rows,s=this.items.filter(y=>!y.disabled).length,o=s>0&&e>=s,d=l(this,te,Jl).call(this),p=y=>Gr(y,this.locale)==="one"?this.resourceName:d,b=this.total>t,w=c;return this.allSelected?w=n`${this.t("allSelected",{count:Math.max(this.total,e),resource:d})} <button type="button" @click=${()=>this.clearSelection()}>${this.t("clearSelection")}</button>`:e&&(w=n`${this.t("selected",{count:e,resource:p(e)})}${o&&b?n` <button type="button" @click=${()=>this.selectAll()}>${this.t("selectAll",{count:this.total,resource:d})}</button>`:c}`),n`
|
|
1307
|
+
${this.selectable?n`<div class="toolbar" part="toolbar">
|
|
1047
1308
|
<span class="select" part="select">
|
|
1048
|
-
<span class="check"><input id="${
|
|
1049
|
-
?disabled=${!
|
|
1050
|
-
<span class="box" aria-hidden="true">${e>0&&!n
|
|
1051
|
-
<label for="${
|
|
1052
|
-
${this.hideSelectMenu?
|
|
1053
|
-
.items=${[{label
|
|
1309
|
+
<span class="check"><input id="${r(this,fr)}-all" type="checkbox" .checked=${o} .indeterminate=${e>0&&!o}
|
|
1310
|
+
?disabled=${!s} @change=${y=>this.selectPage(y.target.checked)} />
|
|
1311
|
+
<span class="box" aria-hidden="true">${e>0&&!o?n`<span class="dash"></span>`:o?n`<cm-icon name="check" size="12"></cm-icon>`:c}</span></span>
|
|
1312
|
+
<label for="${r(this,fr)}-all">${this.t("select")}<span class="sr"> ${this.t("selectPageHidden",{count:t,resource:p(t)})}</span></label>
|
|
1313
|
+
${this.hideSelectMenu?c:n`<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t("selectionOptions")}
|
|
1314
|
+
.items=${[{label:this.t("selectPage",{count:s}),value:"page",disabled:!s},...b?[{label:this.t("selectAll",{count:this.total,resource:d}),value:"all"}]:[],{label:this.t("selectNone"),value:"none",disabled:!e&&!this.allSelected}]} @cm-select=${r(this,Za)}></cm-action-menu>`}
|
|
1054
1315
|
</span>
|
|
1055
1316
|
<span class="bulk" ?hidden=${!e}><slot name="bulk-actions"></slot></span>
|
|
1056
|
-
<span class="status" part="status" role="status">${
|
|
1317
|
+
<span class="status" part="status" role="status">${w}</span>
|
|
1057
1318
|
<span class="actions"><slot name="actions"></slot></span>
|
|
1058
|
-
</div>`:
|
|
1319
|
+
</div>`:c}
|
|
1059
1320
|
<div class="header"><slot name="header" @slotchange=${y=>y.target.parentElement.classList.toggle("has",y.target.assignedElements().length>0)}></slot></div>
|
|
1060
1321
|
<div class="body">
|
|
1061
|
-
<div class="list" part="list" role="list" aria-label=${this.label||
|
|
1062
|
-
<slot @slotchange=${()=>
|
|
1322
|
+
<div class="list" part="list" role="list" aria-label=${this.label||d.replace(/^./,y=>y.toUpperCase())} aria-busy=${this.loading?"true":"false"}>
|
|
1323
|
+
<slot @slotchange=${()=>l(this,te,Ci).call(this)}></slot>
|
|
1063
1324
|
</div>
|
|
1064
|
-
${this.loading?
|
|
1325
|
+
${this.loading?n`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:d})}></span>`:c}
|
|
1065
1326
|
</div>
|
|
1066
1327
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
1067
|
-
`}};
|
|
1328
|
+
`}};fr=new WeakMap,te=new WeakSet,Jl=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},Ci=function(){let e=this.items;e.forEach(t=>t.selectable=this.selectable),this._rows=e.length,this._count=e.filter(t=>t.selected).length},Ga=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},Za=new WeakMap,Di.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name",string:"resourceName"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},_count:{state:!0},_rows:{state:!0}},Di.styles=[f,Gl,m`
|
|
1068
1329
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
1069
1330
|
.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
1331
|
.select {
|
|
@@ -1080,14 +1341,14 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1080
1341
|
.status { flex: 1; text-align: center; font-size: 16px; }
|
|
1081
1342
|
.status button { font: inherit; font-weight: 500; color: inherit; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }
|
|
1082
1343
|
.status button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1083
|
-
.actions { display: flex; gap: var(--cm-space-10); margin-
|
|
1344
|
+
.actions { display: flex; gap: var(--cm-space-10); margin-inline-start: auto; }
|
|
1084
1345
|
.header { display: block; padding: var(--cm-space-20) var(--cm-space-20) 0; }
|
|
1085
1346
|
.header:not(.has) { display: none; }
|
|
1086
1347
|
.body { position: relative; }
|
|
1087
1348
|
.list { padding: 0 var(--cm-space-20) var(--cm-space-10); }
|
|
1088
1349
|
:host([loading]) .list ::slotted(*) { opacity: 0.4; }
|
|
1089
1350
|
.spinner {
|
|
1090
|
-
position: absolute;
|
|
1351
|
+
position: absolute; inset-inline-start: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%;
|
|
1091
1352
|
border: 4px solid var(--cm-thumb-bg); border-top-color: var(--cm-icon-selected); animation: spin 0.8s linear infinite;
|
|
1092
1353
|
}
|
|
1093
1354
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
@@ -1097,25 +1358,25 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1097
1358
|
@media (max-width: 640px) {
|
|
1098
1359
|
.toolbar { gap: var(--cm-space-10); padding: var(--cm-space-10) var(--cm-space-10) 0; }
|
|
1099
1360
|
.select { height: 32px; font-size: 12px; }
|
|
1100
|
-
.status { flex-basis: 100%; order: 3; text-align:
|
|
1361
|
+
.status { flex-basis: 100%; order: 3; text-align: start; font-size: 12px; }
|
|
1101
1362
|
.header { padding: var(--cm-space-10) var(--cm-space-10) 0; }
|
|
1102
1363
|
.list { padding: 0 var(--cm-space-10); }
|
|
1103
1364
|
.spinner { width: 30px; height: 30px; margin: -15px; border-width: 3px; }
|
|
1104
1365
|
}
|
|
1105
|
-
`];
|
|
1106
|
-
<div class="row" part="row" @dragover=${
|
|
1107
|
-
${this.sortable?
|
|
1366
|
+
`];u("cm-resource-list",Di);var Su=$("nestedItem",{reorder:"Reorder {label}",hint:"Press up or down arrow to move.",moved:"{label} moved to position {position} of {total}."}),Cu=$("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),en,se,Zl,Ql,ec,vo,tc,Ne=class Ne extends x{constructor(){super();h(this,se);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;h(this,en,this.attachInternals());r(this,en).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,s=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===s)return!1;let o=new CustomEvent("cm-reorder",{detail:{item:this,from:s,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(o))return!1;let d=t[e];return d.parentElement.insertBefore(this,e>s?d.nextSibling:d),this.closest("cm-nested-list")?.announce(this.t("moved",{label:this.label,position:e+1,total:t.length})),!0}render(){return n`
|
|
1367
|
+
<div class="row" part="row" @dragover=${l(this,se,ec)} @dragleave=${l(this,se,vo)} @drop=${l(this,se,tc)}>
|
|
1368
|
+
${this.sortable?n`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
1108
1369
|
aria-describedby="hint"
|
|
1109
|
-
@keydown=${
|
|
1110
|
-
@dragend=${()=>{this.classList.remove("dragging"),
|
|
1111
|
-
${this.sortable?
|
|
1370
|
+
@keydown=${l(this,se,Zl)} @dragstart=${l(this,se,Ql)}
|
|
1371
|
+
@dragend=${()=>{this.classList.remove("dragging"),Ne.dragged=null}}><cm-icon name="drag" size="18"></cm-icon></button>`:c}
|
|
1372
|
+
${this.sortable?n`<span class="sr" id="hint">${this.t("hint")}</span>`:c}
|
|
1112
1373
|
<span class="label" part="label">${this.label}</span>
|
|
1113
1374
|
<span class="actions" part="actions"><slot name="actions"></slot></span>
|
|
1114
1375
|
</div>
|
|
1115
1376
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
1116
|
-
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(
|
|
1377
|
+
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(s=>s.localName==="cm-nested-item");t.forEach(s=>s.sortable=this.sortable),this._hasChildren=t.length>0}}></slot>
|
|
1117
1378
|
</div>
|
|
1118
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};
|
|
1379
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};en=new WeakMap,se=new WeakSet,Zl=function(e){let t=this.siblings.indexOf(this),s;if(e.key==="ArrowUp")s=t-1;else if(e.key==="ArrowDown")s=t+1;else if(e.key==="Home")s=0;else if(e.key==="End")s=this.siblings.length-1;else return;if(e.preventDefault(),this.moveTo(s)){let o=()=>this.renderRoot.querySelector(".handle")?.focus();o(),requestAnimationFrame(o)}},Ql=function(e){e.stopPropagation(),Ne.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},ec=function(e){let t=Ne.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let s=this.renderRoot.querySelector(".row").getBoundingClientRect(),o=e.clientY>s.top+s.height/2;this.classList.toggle("drop-after",o),this.classList.toggle("drop-before",!o)},vo=function(){this.classList.remove("drop-before","drop-after")},tc=function(e){let t=Ne.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let s=this.classList.contains("drop-after");l(this,se,vo).call(this);let o=this.siblings,d=o.indexOf(t),p=o.indexOf(this)+(s?1:0);p>d&&(p-=1),t.moveTo(p)},Ne.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},Ne.styles=[f,m`
|
|
1119
1380
|
:host { display: block; }
|
|
1120
1381
|
.row {
|
|
1121
1382
|
display: flex; align-items: center; gap: var(--cm-space-15); min-height: 60px; padding: 0 var(--cm-space-20);
|
|
@@ -1128,31 +1389,31 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1128
1389
|
.label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
1129
1390
|
.actions { display: flex; align-items: center; gap: var(--cm-space-15); }
|
|
1130
1391
|
.handle {
|
|
1131
|
-
display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 34px; margin-
|
|
1392
|
+
display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 34px; margin-inline-start: -6px; padding: 0;
|
|
1132
1393
|
color: var(--cm-icon-selected); background: none; border: 0; border-radius: var(--cm-radius-xs); cursor: grab;
|
|
1133
1394
|
}
|
|
1134
1395
|
.handle:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1135
1396
|
.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
|
|
1397
|
+
.children { margin-block: var(--cm-space-10) 0; margin-inline: 50px 0; display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
1137
1398
|
.children:not(.has) { display: none; }
|
|
1138
1399
|
@media (max-width: 640px) {
|
|
1139
1400
|
.row { min-height: 50px; padding: 0 var(--cm-space-10); gap: var(--cm-space-10); font-size: 14px; }
|
|
1140
1401
|
.actions { gap: var(--cm-space-10); }
|
|
1141
|
-
.children { margin-
|
|
1402
|
+
.children { margin-inline-start: var(--cm-space-20); }
|
|
1142
1403
|
}
|
|
1143
|
-
`],
|
|
1404
|
+
`],Ne.dragged=null;var Qa=Ne;u("cm-nested-item",Qa);var wt,kt,ic,xo,Ni=class extends x{constructor(){super(...arguments);h(this,kt);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this._msg="";h(this,wt,T("cm-nl"))}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}updated(e){e.has("sortable")&&l(this,kt,xo).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return n`
|
|
1144
1405
|
<div class="bar" part="bar">
|
|
1145
|
-
<div class="title" part="heading" role="heading" aria-level=${e} id="${
|
|
1406
|
+
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,wt)}-h">${this.heading}</div>
|
|
1146
1407
|
<span class="actions"><slot name="actions"></slot></span>
|
|
1147
|
-
${this.collapsible?
|
|
1148
|
-
aria-label=${
|
|
1149
|
-
<cm-icon name=${t?"chevron-up":"chevron-down"} size="14"></cm-icon></button>`:
|
|
1408
|
+
${this.collapsible?n`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,wt)}-rows"
|
|
1409
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${l(this,kt,ic)}>
|
|
1410
|
+
<cm-icon name=${t?"chevron-up":"chevron-down"} size="14"></cm-icon></button>`:c}
|
|
1150
1411
|
</div>
|
|
1151
|
-
<div class="rows" id="${
|
|
1152
|
-
<slot @slotchange=${()=>
|
|
1412
|
+
<div class="rows" id="${r(this,wt)}-rows" role="list" aria-labelledby="${r(this,wt)}-h" ?hidden=${!t}>
|
|
1413
|
+
<slot @slotchange=${()=>l(this,kt,xo).call(this)}></slot>
|
|
1153
1414
|
</div>
|
|
1154
1415
|
<span class="sr" role="status">${this._msg}</span>
|
|
1155
|
-
`}};
|
|
1416
|
+
`}};wt=new WeakMap,kt=new WeakSet,ic=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},xo=function(){[...this.children].forEach(e=>{e.localName==="cm-nested-item"&&(e.sortable=this.sortable)})},Ni.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}},Ni.styles=[f,m`
|
|
1156
1417
|
:host { display: block; }
|
|
1157
1418
|
.bar {
|
|
1158
1419
|
display: flex; align-items: center; gap: var(--cm-space-15); min-height: 90px; padding: 0 var(--cm-space-20);
|
|
@@ -1166,20 +1427,20 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1166
1427
|
}
|
|
1167
1428
|
.toggle:hover { background: var(--cm-action-primary-hover); }
|
|
1168
1429
|
.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
|
|
1430
|
+
.rows { display: flex; flex-direction: column; gap: var(--cm-space-10); margin-block: var(--cm-space-15) 0; margin-inline: 50px 0; }
|
|
1170
1431
|
.rows[hidden] { display: none; }
|
|
1171
1432
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1172
1433
|
@media (max-width: 640px) {
|
|
1173
1434
|
.bar { min-height: 60px; padding: 0 var(--cm-space-10); gap: var(--cm-space-10); }
|
|
1174
1435
|
.title { font-size: 18px; }
|
|
1175
|
-
.rows { margin-
|
|
1436
|
+
.rows { margin-inline-start: var(--cm-space-10); }
|
|
1176
1437
|
.toggle { width: 30px; height: 30px; }
|
|
1177
1438
|
}
|
|
1178
|
-
`];
|
|
1439
|
+
`];u("cm-nested-list",Ni);var Hu=$("reportTile",{pinned:", pinned"}),Et=class extends x{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=n`
|
|
1179
1440
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="58"></cm-icon></slot></span>
|
|
1180
1441
|
<span class="label">${this.label}</span>
|
|
1181
|
-
${this.pinned?
|
|
1182
|
-
`;return this.href?
|
|
1442
|
+
${this.pinned?n`<span class="pin" part="pin"><cm-icon name="pin" size="18"></cm-icon><span class="sr">${this.t("pinned")}</span></span>`:c}
|
|
1443
|
+
`;return this.href?n`<a class="tile" part="tile" href=${this.href}>${e}</a>`:n`<button class="tile" part="tile" type="button">${e}</button>`}};Et.properties={label:{},icon:{},href:{},pinned:{type:Boolean,reflect:!0}},Et.shadowRootOptions={...k.shadowRootOptions,delegatesFocus:!0},Et.styles=[f,m`
|
|
1183
1444
|
:host { display: block; }
|
|
1184
1445
|
.tile {
|
|
1185
1446
|
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-20);
|
|
@@ -1191,18 +1452,18 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1191
1452
|
.tile:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1192
1453
|
.icon { display: inline-flex; color: var(--cm-icon-selected); }
|
|
1193
1454
|
::slotted([slot='icon']) { width: 58px; height: 58px; }
|
|
1194
|
-
.pin { position: absolute; top: 10px;
|
|
1455
|
+
.pin { position: absolute; top: 10px; inset-inline-end: 10px; color: var(--cm-icon-selected); }
|
|
1195
1456
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1196
1457
|
@media (max-width: 640px) {
|
|
1197
1458
|
.tile { height: 118px; gap: var(--cm-space-10); font-size: 12px; }
|
|
1198
1459
|
.icon cm-icon::part(svg) { width: 38px; height: 38px; }
|
|
1199
1460
|
::slotted([slot='icon']) { width: 38px; height: 38px; }
|
|
1200
|
-
.pin { top: 8px;
|
|
1461
|
+
.pin { top: 8px; inset-inline-end: 8px; }
|
|
1201
1462
|
}
|
|
1202
|
-
`];
|
|
1203
|
-
${this.heading?
|
|
1204
|
-
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":
|
|
1205
|
-
`}};
|
|
1463
|
+
`];u("cm-report-tile",Et);var Ii=class extends k{constructor(){super(...arguments);this.heading="";this.headingLevel=2}firstUpdated(){for(let e of this.querySelectorAll(":scope > cm-report-tile"))e.hasAttribute("role")||e.setAttribute("role","listitem")}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2));return n`
|
|
1464
|
+
${this.heading?n`<div class="title" part="heading" role="heading" aria-level=${e} id="h">${this.heading}</div>`:c}
|
|
1465
|
+
<div class="grid" part="grid" role="list" aria-labelledby=${this.heading?"h":c}><slot @slotchange=${()=>this.firstUpdated()}></slot></div>
|
|
1466
|
+
`}};Ii.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"}},Ii.styles=[f,m`
|
|
1206
1467
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
1207
1468
|
.title { margin: 0 0 var(--cm-space-20); font-size: 16px; font-weight: 500; }
|
|
1208
1469
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-15); }
|
|
@@ -1212,27 +1473,27 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1212
1473
|
.title { margin-bottom: var(--cm-space-10); font-size: 14px; }
|
|
1213
1474
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-10); }
|
|
1214
1475
|
}
|
|
1215
|
-
`];
|
|
1216
|
-
<nav part="nav" aria-label=${this.label||"
|
|
1476
|
+
`];u("cm-report-tiles",Ii);var Ri=class extends k{constructor(){super(...arguments);this.label="";this.icon="";this.href="";this.value="";this.current=!1;this.badge="";this.expanded=!1;this.primary=!1}render(){return null}toItem(){return sc(this)}};Ri.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}},Ri.styles=m`:host { display: none !important; }`;u("cm-nav-item",Ri);function sc(a){let i=s=>a.getAttribute(s),e={label:i("label")||""};i("icon")&&(e.icon=i("icon")),i("href")&&(e.href=i("href")),i("value")&&(e.value=i("value")),a.hasAttribute("current")&&(e.current=!0),i("badge")&&(e.badge=i("badge")),a.hasAttribute("expanded")&&(e.expanded=!0),a.hasAttribute("primary")&&(e.primary=!0);let t=Ie(a);return t.length&&(e.items=t),e}var Ie=a=>[...a.children].filter(i=>i.localName==="cm-nav-item").map(sc),yo=a=>a.value||a.href||a.label,tn=a=>!!a.current||!!a.items?.some(tn),tt=(a,i)=>{let e=new MutationObserver(i);return e.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","icon","href","value","current","badge","expanded","primary"]}),e},it=(a,i)=>a.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:i,value:yo(i),href:i.href??""}}));var Wu=$("sideNavigation",{label:"Main"}),gr,vr,rn,q,$o,sn,wo,rc,ac,ko,Eo,Hi=class extends x{constructor(){super(...arguments);h(this,q);this.items=[];this._slotted=[];this._open=new Set;h(this,gr,new Set);h(this,vr);h(this,rn,T("cm-sidenav"))}connectedCallback(){super.connectedCallback(),l(this,q,$o).call(this),g(this,vr,tt(this,()=>l(this,q,$o).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,vr)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let s=l(this,q,sn).call(this,e,t);r(this,gr).has(s)||!e.items?.length||(r(this,gr).add(s),(e.expanded||tn(e))&&this._open.add(s))})}toggle(e,t){let s=this.navItems[e];if(!s?.items?.length)return;let o=l(this,q,sn).call(this,s,e),d=t??!this._open.has(o);if(d===this._open.has(o))return;let p=new Set(this._open);d?p.add(o):p.delete(o),this._open=p,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:s,expanded:d}}))}render(){return n`
|
|
1477
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${l(this,q,ac)}>
|
|
1217
1478
|
<slot name="header"></slot>
|
|
1218
1479
|
<ul part="list">
|
|
1219
|
-
${this.navItems.map((e,t)=>{if(!e.items?.length)return
|
|
1220
|
-
<button type="button" class="item parent ${
|
|
1221
|
-
aria-expanded=${
|
|
1222
|
-
${e.icon?
|
|
1480
|
+
${this.navItems.map((e,t)=>{if(!e.items?.length)return n`<li>${l(this,q,Eo).call(this,e,"",{index:t})}</li>`;let s=this._open.has(l(this,q,sn).call(this,e,t)),o=`${r(this,rn)}-${t}`;return n`<li>
|
|
1481
|
+
<button type="button" class="item parent ${tn(e)?"has-current":""}" part="item" data-index=${t}
|
|
1482
|
+
aria-expanded=${s?"true":"false"} aria-controls=${o} @click=${()=>this.toggle(t)}>
|
|
1483
|
+
${e.icon?n`<cm-icon name=${e.icon} size="20"></cm-icon>`:c}<span class="label">${e.label}</span>${e.badge?n`<span class="badge">${e.badge}</span>`:c}
|
|
1223
1484
|
<cm-icon class="chev" name="chevron-down" size="18"></cm-icon>
|
|
1224
1485
|
</button>
|
|
1225
|
-
<ul class="sub" id=${
|
|
1226
|
-
${
|
|
1486
|
+
<ul class="sub" id=${o} ?hidden=${!s} aria-label=${e.label}>
|
|
1487
|
+
${l(this,q,ko).call(this,e.items).map(([d,p])=>n`<li>${l(this,q,Eo).call(this,{...d,icon:void 0},p?"deep":"",{parent:t})}</li>`)}
|
|
1227
1488
|
</ul>
|
|
1228
1489
|
</li>`})}
|
|
1229
1490
|
</ul>
|
|
1230
1491
|
<slot name="footer"></slot>
|
|
1231
1492
|
<slot hidden></slot>
|
|
1232
1493
|
</nav>
|
|
1233
|
-
`}};
|
|
1234
|
-
data-index=${
|
|
1235
|
-
data-index=${
|
|
1494
|
+
`}};gr=new WeakMap,vr=new WeakMap,rn=new WeakMap,q=new WeakSet,$o=function(){this._slotted=Ie(this)},sn=function(e,t){return`${t}:${yo(e)}`},wo=function(e,t){it(this,t)||e.preventDefault()},rc=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},ac=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let s=l(this,q,rc).call(this),o=s.indexOf(t),d=Number(t.dataset.index),p=ae(e,this),b;if(e.key==="ArrowDown")b=s[(o+1)%s.length];else if(e.key==="ArrowUp")b=s[(o-1+s.length)%s.length];else if(e.key==="Home")b=s[0];else if(e.key==="End")b=s[s.length-1];else if(p==="ArrowRight"&&t.classList.contains("parent")){this.toggle(d,!0),e.preventDefault();return}else if(p==="ArrowLeft"){if(t.classList.contains("parent")?this.toggle(d,!1):t.dataset.parent&&(b=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!b){e.preventDefault();return}}else return;e.preventDefault(),b?.focus()},ko=function(e,t=0){return e.flatMap(s=>[[s,t],...l(this,q,ko).call(this,s.items??[],t+1)])},Eo=function(e,t,s={}){let o=n`${e.icon?n`<cm-icon name=${e.icon} size="20"></cm-icon>`:c}<span class="label">${e.label}</span>${e.badge?n`<span class="badge">${e.badge}</span>`:c}`;return e.href?n`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":c}
|
|
1495
|
+
data-index=${s.index??c} data-parent=${s.parent??c} @click=${d=>l(this,q,wo).call(this,d,e)}>${o}</a>`:n`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":c}
|
|
1496
|
+
data-index=${s.index??c} data-parent=${s.parent??c} @click=${d=>l(this,q,wo).call(this,d,e)}>${o}</button>`},Hi.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0},_open:{state:!0}},Hi.styles=[f,m`
|
|
1236
1497
|
:host { display: block; width: var(--cm-side-navigation-width, 250px); }
|
|
1237
1498
|
nav {
|
|
1238
1499
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: 16px;
|
|
@@ -1240,7 +1501,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1240
1501
|
}
|
|
1241
1502
|
ul { list-style: none; margin: 0; padding: 0; }
|
|
1242
1503
|
.item {
|
|
1243
|
-
display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); min-height: 40px; margin: 0 8px; padding: 0
|
|
1504
|
+
display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); min-height: 40px; margin: 0 8px; padding-block: 0; padding-inline: 12px 10px;
|
|
1244
1505
|
font: inherit; color: inherit; text-align: start; text-decoration: none; background: none; border: 0; border-radius: 8px; cursor: pointer;
|
|
1245
1506
|
}
|
|
1246
1507
|
.item:hover { color: var(--cm-text-on-dark); background: var(--cm-nav-active); }
|
|
@@ -1255,10 +1516,10 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1255
1516
|
letter-spacing: var(--cm-tracking-caps); text-transform: uppercase; color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
|
|
1256
1517
|
}
|
|
1257
1518
|
.sub { padding: 2px 0 6px; }
|
|
1258
|
-
.sub .item { min-height: 36px; padding-
|
|
1259
|
-
.sub .item.deep { padding-
|
|
1519
|
+
.sub .item { min-height: 36px; padding-inline-start: 40px; font-size: 14px; }
|
|
1520
|
+
.sub .item.deep { padding-inline-start: 56px; }
|
|
1260
1521
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
1261
|
-
`];
|
|
1522
|
+
`];u("cm-side-navigation",Hi);function nc(a){let i=a.trim().split(/[\s._@-]+/).filter(Boolean);if(!i.length)return"";let e=[...i[0]][0]??"",t=i.length>1&&!/[.@]/.test(a)?[...i[i.length-1]][0]??"":"";return(e+t).toLocaleUpperCase()}var qi=class extends k{constructor(){super(...arguments);this.name="";this.src="";this.size="medium";this.shape="round";this.decorative=!1;this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){let e=nc(this.name),t=this.decorative||!this.name?c:this.name,s=this.decorative||!this.name?"true":c,o,d="avatar";return this.src&&!this._failed?o=n`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?o=n`<span aria-hidden="true">${e}</span>`:(d+=" icon",o=n`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),n`<span class=${d} part="avatar" role=${t===c?c:"img"} aria-label=${t} aria-hidden=${s}>${o}</span>`}};qi.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},qi.styles=[f,m`
|
|
1262
1523
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
1263
1524
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
1264
1525
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -1271,26 +1532,26 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1271
1532
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
1272
1533
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
1273
1534
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
1274
|
-
`];
|
|
1275
|
-
<header part="bar" role="banner" aria-label=${this.label||
|
|
1535
|
+
`];u("cm-avatar",qi);var sb=$("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}"}),Pi,an,Oi=class extends x{constructor(){super(...arguments);h(this,Pi);this.store="";this.balance="";this.userName="";this.avatarSrc=""}render(){return n`
|
|
1536
|
+
<header part="bar" role="banner" aria-label=${this.label||c}>
|
|
1276
1537
|
<div class="logo"><slot name="logo"></slot></div>
|
|
1277
|
-
${this.store?
|
|
1278
|
-
@click=${()=>
|
|
1538
|
+
${this.store?n`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
1539
|
+
@click=${()=>l(this,Pi,an).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="20"></cm-icon></button>`:c}
|
|
1279
1540
|
<span class="grow"></span>
|
|
1280
1541
|
<div class="end">
|
|
1281
1542
|
<div class="actions"><slot name="actions"></slot></div>
|
|
1282
|
-
${this.balance?
|
|
1283
|
-
@click=${()=>
|
|
1284
|
-
${this.userName?
|
|
1285
|
-
@click=${()=>
|
|
1286
|
-
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:
|
|
1543
|
+
${this.balance?n`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
1544
|
+
@click=${()=>l(this,Pi,an).call(this,"cm-wallet")}>${this.balance}</button>`:c}
|
|
1545
|
+
${this.userName?n`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
1546
|
+
@click=${()=>l(this,Pi,an).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
1547
|
+
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:c}
|
|
1287
1548
|
<slot name="end"></slot>
|
|
1288
1549
|
</div>
|
|
1289
1550
|
</header>
|
|
1290
|
-
`}};
|
|
1551
|
+
`}};Pi=new WeakSet,an=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},Oi.properties={store:{},balance:{},userName:{attribute:"user-name"},avatarSrc:{attribute:"avatar-src"},label:{string:"label"}},Oi.styles=[f,m`
|
|
1291
1552
|
:host { display: block; background: var(--cm-bg-surface); container-type: inline-size; }
|
|
1292
1553
|
header {
|
|
1293
|
-
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 70px; padding: 10px var(--cm-space-20)
|
|
1554
|
+
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 70px; padding-block: 10px; padding-inline: 27px var(--cm-space-20);
|
|
1294
1555
|
}
|
|
1295
1556
|
.logo { display: flex; align-items: center; flex: none; }
|
|
1296
1557
|
::slotted([slot='logo']) { display: block; max-height: 24px; width: auto; }
|
|
@@ -1299,7 +1560,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1299
1560
|
background: none; cursor: pointer;
|
|
1300
1561
|
}
|
|
1301
1562
|
.store {
|
|
1302
|
-
margin-
|
|
1563
|
+
margin-inline-start: 60px; padding: 6px 8px; border: 0; border-radius: var(--cm-radius-sm); font-size: 18px; min-width: 0; flex: 0 1 auto;
|
|
1303
1564
|
}
|
|
1304
1565
|
.store span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1305
1566
|
.store:hover { background: var(--cm-bg-hover); }
|
|
@@ -1312,13 +1573,13 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1312
1573
|
}
|
|
1313
1574
|
.pill:hover, .user:hover { background: var(--cm-bg-hover); }
|
|
1314
1575
|
.user {
|
|
1315
|
-
min-height: 50px; padding: 4px
|
|
1576
|
+
min-height: 50px; padding-block: 4px; padding-inline: 20px 6px; gap: var(--cm-space-20); font-size: 18px;
|
|
1316
1577
|
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-full);
|
|
1317
1578
|
}
|
|
1318
1579
|
.avatar { --cm-avatar-size: 36px; }
|
|
1319
1580
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1320
1581
|
@container (max-width: 1300px) {
|
|
1321
|
-
.store { margin-
|
|
1582
|
+
.store { margin-inline-start: var(--cm-space-20); }
|
|
1322
1583
|
}
|
|
1323
1584
|
@container (max-width: 1100px) {
|
|
1324
1585
|
.store { font-size: 16px; }
|
|
@@ -1329,17 +1590,17 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1329
1590
|
@container (max-width: 640px) {
|
|
1330
1591
|
header { min-height: 56px; gap: var(--cm-space-10); padding: 8px var(--cm-space-15); }
|
|
1331
1592
|
.actions, .pill { display: none; }
|
|
1332
|
-
.store { margin-
|
|
1593
|
+
.store { margin-inline-start: 0; font-size: 14px; }
|
|
1333
1594
|
.user { padding: 2px; min-height: 0; border-color: transparent; }
|
|
1334
1595
|
.user .name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1335
1596
|
.avatar { --cm-avatar-size: 32px; }
|
|
1336
1597
|
}
|
|
1337
|
-
`];
|
|
1338
|
-
<ul>${this.navItems.slice(0,5).map(e=>
|
|
1598
|
+
`];u("cm-header-bar",Oi);var hb=$("bottomNavigation",{label:"Main"}),xr,Mt,Mo,oc,ji=class extends x{constructor(){super(...arguments);h(this,Mt);this.items=[];this.fixed=!1;this._slotted=[];h(this,xr)}connectedCallback(){super.connectedCallback(),l(this,Mt,Mo).call(this),g(this,xr,tt(this,()=>l(this,Mt,Mo).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,xr)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return n`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
1599
|
+
<ul>${this.navItems.slice(0,5).map(e=>n`<li>${l(this,Mt,oc).call(this,e)}</li>`)}</ul>
|
|
1339
1600
|
<slot hidden></slot>
|
|
1340
|
-
</nav>`}};
|
|
1601
|
+
</nav>`}};xr=new WeakMap,Mt=new WeakSet,Mo=function(){this._slotted=Ie(this)},oc=function(e){let t=`item ${e.primary?"primary":""}`,s=n`<span class="icon">${e.icon?n`<cm-icon name=${e.icon} size=${e.primary?16:24}></cm-icon>`:c}</span><span class="label">${e.label}</span>`,o=d=>{it(this,e)||d.preventDefault()};return e.href?n`<a class=${t} part="item" href=${e.href} aria-current=${e.current?"page":c} @click=${o}>${s}</a>`:n`<button type="button" class=${t} part="item" aria-current=${e.current?"page":c} @click=${o}>${s}</button>`},ji.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},_slotted:{state:!0}},ji.styles=[f,m`
|
|
1341
1602
|
:host { display: block; }
|
|
1342
|
-
:host([fixed]) { position: fixed;
|
|
1603
|
+
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
1343
1604
|
nav {
|
|
1344
1605
|
background: var(--cm-bg-surface); border-radius: 16px 16px 0 0; box-shadow: var(--cm-shadow-100);
|
|
1345
1606
|
padding: 10px 6px calc(8px + env(safe-area-inset-bottom, 0px));
|
|
@@ -1357,31 +1618,31 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1357
1618
|
.icon { display: grid; place-items: center; width: 26px; height: 26px; }
|
|
1358
1619
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
1359
1620
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1360
|
-
`];
|
|
1361
|
-
@keydown=${
|
|
1621
|
+
`];u("cm-bottom-navigation",ji);var xb=$("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),yr,_t,G,_o,lc,zo,To,cc,Bi=class extends x{constructor(){super(...arguments);h(this,G);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;h(this,yr);h(this,_t,T("cm-mmenu"))}connectedCallback(){super.connectedCallback(),l(this,G,_o).call(this),g(this,yr,tt(this,()=>l(this,G,_o).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,yr)?.disconnect()}get sections(){return this.items.length?this.items:this._slotted}back(){if(!this._page)return;let[e,t]=this._page;this._page=null,this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-row="${e}-${t}"]`)?.focus())}render(){let e=this.sections,t=this._page?e[this._page[0]]?.items?.[this._page[1]]:void 0;return t?n`<nav part="nav" class="sub" aria-label=${this.label||this.t("label")} id="${r(this,_t)}-sub"
|
|
1622
|
+
@keydown=${s=>{s.key==="Escape"&&(s.preventDefault(),this.back())}}>
|
|
1362
1623
|
<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(
|
|
1624
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(s=>n`<li>${l(this,G,To).call(this,s,0,0,!0)}</li>`)}</ul>
|
|
1364
1625
|
<slot hidden></slot>
|
|
1365
|
-
</nav>`:
|
|
1366
|
-
${
|
|
1367
|
-
${e.map((
|
|
1368
|
-
${
|
|
1369
|
-
<ul class="card">${(
|
|
1626
|
+
</nav>`:n`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
1627
|
+
${l(this,G,cc).call(this)}
|
|
1628
|
+
${e.map((s,o)=>{let d=`${r(this,_t)}-s${o}`;return n`<section aria-labelledby=${s.label?d:c}>
|
|
1629
|
+
${s.label?n`<h2 class="heading" id=${d}>${s.label}</h2>`:c}
|
|
1630
|
+
<ul class="card">${(s.items??[]).map((p,b)=>n`<li>${l(this,G,To).call(this,p,o,b)}</li>`)}</ul>
|
|
1370
1631
|
</section>`})}
|
|
1371
1632
|
<slot hidden></slot>
|
|
1372
|
-
</nav>`}};
|
|
1373
|
-
@click=${()=>
|
|
1374
|
-
<h2 class="heading" id="${
|
|
1633
|
+
</nav>`}};yr=new WeakMap,_t=new WeakMap,G=new WeakSet,_o=function(){this._slotted=Ie(this)},lc=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},zo=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},To=function(e,t,s,o=!1){let d=y=>{it(this,e)||y.preventDefault()};if(e.primary&&!o)return n`<button type="button" class="row action" part="row" @click=${d}>${e.label}</button>`;let p=e.icon&&!o?n`<cm-icon class="icon" name=${e.icon} size="24"></cm-icon>`:c,b=e.badge?n`<span class="badge">${e.badge}</span>`:c;if(e.items?.length&&!o)return n`<button type="button" class="row" part="row" data-row="${t}-${s}"
|
|
1634
|
+
@click=${()=>l(this,G,lc).call(this,t,s)}>${p}<span class="label">${e.label}</span>${b}<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let w=n`${p}<span class="label">${e.label}</span>${b}${e.href&&!o?n`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:c}`;return e.href?n`<a class="row" part="row" href=${e.href} aria-current=${e.current?"page":c} @click=${d}>${w}</a>`:n`<button type="button" class="row" part="row" aria-current=${e.current?"page":c} @click=${d}>${w}</button>`},cc=function(){if(!this.store&&!this.userName)return c;let e=this.userName.trim().charAt(0).toUpperCase();return n`<section aria-labelledby="${r(this,_t)}-profile">
|
|
1635
|
+
<h2 class="heading" id="${r(this,_t)}-profile">${this.t("profile")}</h2>
|
|
1375
1636
|
<ul class="card">
|
|
1376
|
-
${this.store?
|
|
1377
|
-
<span class="stack"><span class="eyebrow"
|
|
1378
|
-
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:
|
|
1379
|
-
${this.userName?
|
|
1380
|
-
<span class="avatar">${this.avatarSrc?
|
|
1381
|
-
<span class="stack"><span>${this.userName}</span>${this.userEmail?
|
|
1382
|
-
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:
|
|
1637
|
+
${this.store?n`<li><button type="button" class="row" part="row" @click=${()=>l(this,G,zo).call(this,"cm-store-switch")}>
|
|
1638
|
+
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
1639
|
+
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:c}
|
|
1640
|
+
${this.userName?n`<li><button type="button" class="row" part="row" @click=${()=>l(this,G,zo).call(this,"cm-account")}>
|
|
1641
|
+
<span class="avatar">${this.avatarSrc?n`<img src=${this.avatarSrc} alt="">`:n`<span aria-hidden="true">${e}</span>`}</span>
|
|
1642
|
+
<span class="stack"><span>${this.userName}</span>${this.userEmail?n`<span class="email">${this.userEmail}</span>`:c}</span>
|
|
1643
|
+
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:c}
|
|
1383
1644
|
</ul>
|
|
1384
|
-
</section>`},
|
|
1645
|
+
</section>`},Bi.properties={items:{type:Array},store:{},userName:{attribute:"user-name"},userEmail:{attribute:"user-email"},avatarSrc:{attribute:"avatar-src"},label:{string:"label"},_slotted:{state:!0},_page:{state:!0}},Bi.styles=[f,m`
|
|
1385
1646
|
:host { display: block; background: var(--cm-bg-page); }
|
|
1386
1647
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
1387
1648
|
.heading {
|
|
@@ -1391,7 +1652,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1391
1652
|
.card { list-style: none; margin: 0; padding: 0 15px; background: var(--cm-bg-surface); border-radius: 12px; }
|
|
1392
1653
|
.card > li + li { border-top: var(--cm-border-1) solid var(--cm-border-default); }
|
|
1393
1654
|
.row {
|
|
1394
|
-
display: flex; align-items: center; gap: var(--cm-space-15); width: 100%; min-height: 51px; padding: 8px
|
|
1655
|
+
display: flex; align-items: center; gap: var(--cm-space-15); width: 100%; min-height: 51px; padding-block: 8px; padding-inline: 6px 4px;
|
|
1395
1656
|
font: inherit; font-size: 18px; font-weight: 500; color: var(--cm-text-default); text-align: start; text-decoration: none;
|
|
1396
1657
|
background: none; border: 0; cursor: pointer;
|
|
1397
1658
|
}
|
|
@@ -1418,11 +1679,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1418
1679
|
}
|
|
1419
1680
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1420
1681
|
.sub .row { font-size: 16px; min-height: 48px; }
|
|
1421
|
-
`];
|
|
1422
|
-
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?
|
|
1682
|
+
`];u("cm-mobile-menu",Bi);var _b=$("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),nn,dc,Fi=class extends x{constructor(){super(...arguments);h(this,nn);this.icon="send";this.dismissible=!1}render(){return n`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
1683
|
+
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?n`<cm-icon name=${this.icon} size="20"></cm-icon>`:c}</slot></span>
|
|
1423
1684
|
<span class="text"><slot></slot></span>
|
|
1424
|
-
${this.dismissible?
|
|
1425
|
-
</div>`}}
|
|
1685
|
+
${this.dismissible?n`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${l(this,nn,dc)}><cm-icon name="close" size="18"></cm-icon></button>`:c}
|
|
1686
|
+
</div>`}};nn=new WeakSet,dc=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},Fi.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},Fi.styles=[f,m`
|
|
1426
1687
|
:host { display: block; }
|
|
1427
1688
|
.bar {
|
|
1428
1689
|
position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px;
|
|
@@ -1436,7 +1697,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1436
1697
|
::slotted(a:hover) { text-decoration: underline; }
|
|
1437
1698
|
::slotted(a:focus-visible) { outline: 2px solid var(--cm-text-on-dark); outline-offset: 2px; border-radius: 2px; }
|
|
1438
1699
|
.close {
|
|
1439
|
-
position: absolute;
|
|
1700
|
+
position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
|
|
1440
1701
|
width: 32px; height: 32px; padding: 0; color: var(--cm-text-on-dark); background: none; border: 0; border-radius: 50%; cursor: pointer;
|
|
1441
1702
|
}
|
|
1442
1703
|
.close:hover { background: var(--cm-nav-active); }
|
|
@@ -1444,11 +1705,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1444
1705
|
@media (max-width: 640px) {
|
|
1445
1706
|
.bar { font-size: 14px; min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
1446
1707
|
}
|
|
1447
|
-
`];
|
|
1448
|
-
<ul part="tabs">${this.tabs.map(e=>
|
|
1449
|
-
@click=${t=>{
|
|
1708
|
+
`];u("cm-flash-offer-bar",Fi);var Nb=$("linkTabs",{label:"Sections"}),$r,wr,Lo,Vi=class extends x{constructor(){super(...arguments);h(this,wr);this.items=[];this._slotted=[];h(this,$r)}connectedCallback(){super.connectedCallback(),l(this,wr,Lo).call(this),g(this,$r,tt(this,()=>l(this,wr,Lo).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,$r)?.disconnect()}get tabs(){return this.items.length?this.items:this._slotted}render(){return n`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
1709
|
+
<ul part="tabs">${this.tabs.map(e=>n`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":c}
|
|
1710
|
+
@click=${t=>{it(this,e)||t.preventDefault()}}>${e.label}${e.badge?n`<span class="badge">(${e.badge})</span>`:c}</a></li>`)}</ul>
|
|
1450
1711
|
<slot hidden></slot>
|
|
1451
|
-
</nav>`}}
|
|
1712
|
+
</nav>`}};$r=new WeakMap,wr=new WeakSet,Lo=function(){this._slotted=Ie(this)},Vi.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0}},Vi.styles=[f,m`
|
|
1452
1713
|
:host { display: block; }
|
|
1453
1714
|
ul {
|
|
1454
1715
|
display: flex; gap: 28px; margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
@@ -1459,26 +1720,26 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1459
1720
|
position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0 14px;
|
|
1460
1721
|
font-size: 16px; font-weight: 500; color: var(--cm-text-tertiary); text-decoration: none;
|
|
1461
1722
|
}
|
|
1462
|
-
a::after { content: ''; position: absolute;
|
|
1723
|
+
a::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; border-radius: 1px; background: transparent; }
|
|
1463
1724
|
a:hover { color: var(--cm-text-default); }
|
|
1464
1725
|
a[aria-current='page'] { color: var(--cm-text-default); }
|
|
1465
1726
|
a[aria-current='page']::after { background: var(--cm-border-strong); }
|
|
1466
1727
|
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
|
|
1467
1728
|
.badge { font-size: 12px; color: var(--cm-text-tertiary); }
|
|
1468
1729
|
@media (max-width: 640px) { ul { gap: 18px; } a { font-size: 14px; } }
|
|
1469
|
-
`];
|
|
1730
|
+
`];u("cm-link-tabs",Vi);var jb=$("appCard",{developer:"By {developer}",rating:"Rated {rating} out of 5",reviews:{one:"{count} Review",other:"{count} Reviews"},offer:"Offer: ",details:"View Details",detailsLabel:"View details of {name}"}),Ui=class extends x{constructor(){super(...arguments);this.name="";this.developer="";this.reviewsHref="";this.pricing="";this.offer="";this.href="";this.headingLevel=3}render(){let e=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),t=typeof this.rating=="number"&&!Number.isNaN(this.rating),s=typeof this.reviews=="number"?this.t("reviews",{count:this.reviews}):"",o=t?this.formatNumber(this.rating,{minimumFractionDigits:1,maximumFractionDigits:1}):"";return n`<article part="card" aria-labelledby="name">
|
|
1470
1731
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
1471
1732
|
<div class="status"><slot name="status"></slot></div>
|
|
1472
1733
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
1473
|
-
${this.developer?
|
|
1474
|
-
${t?
|
|
1475
|
-
<span aria-hidden="true">${
|
|
1476
|
-
${
|
|
1477
|
-
${this.pricing?
|
|
1478
|
-
${this.offer?
|
|
1479
|
-
<div class="actions"><slot name="actions"></slot>${this.href?
|
|
1480
|
-
aria-label=${
|
|
1481
|
-
</article>`}};
|
|
1734
|
+
${this.developer?n`<p class="by">${this.t("developer",{developer:this.developer})}</p>`:c}
|
|
1735
|
+
${t?n`<p class="rating"><cm-icon class="star" name="star" size="12"></cm-icon>
|
|
1736
|
+
<span aria-hidden="true">${o}</span><span class="sr">${this.t("rating",{rating:o})}</span>
|
|
1737
|
+
${s?this.reviewsHref?n`<a href=${this.reviewsHref}>${s}</a>`:n`<span>${s}</span>`:c}</p>`:c}
|
|
1738
|
+
${this.pricing?n`<p class="pricing">${this.pricing}</p>`:c}
|
|
1739
|
+
${this.offer?n`<p class="offer"><cm-icon name="percent" size="12"></cm-icon><span><span class="sr">${this.t("offer")}</span>${this.offer}</span></p>`:c}
|
|
1740
|
+
<div class="actions"><slot name="actions"></slot>${this.href?n`<a class="details" part="details" href=${this.href}
|
|
1741
|
+
aria-label=${this.t("detailsLabel",{name:this.name})}>${this.t("details")}</a>`:c}</div>
|
|
1742
|
+
</article>`}};Ui.properties={name:{},developer:{},rating:{type:Number},reviews:{type:Number},reviewsHref:{attribute:"reviews-href"},pricing:{},offer:{},href:{},headingLevel:{type:Number,attribute:"heading-level"}},Ui.styles=[f,m`
|
|
1482
1743
|
:host { display: block; container-type: inline-size; }
|
|
1483
1744
|
article {
|
|
1484
1745
|
position: relative; display: flex; flex-direction: column; gap: 10px; height: 100%; padding: var(--cm-space-20);
|
|
@@ -1490,7 +1751,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1490
1751
|
background: var(--cm-bg-inset); border-radius: var(--cm-radius-xs);
|
|
1491
1752
|
}
|
|
1492
1753
|
::slotted([slot='logo']) { max-width: 100%; max-height: 100%; object-fit: contain; }
|
|
1493
|
-
.status { position: absolute; top: var(--cm-space-20);
|
|
1754
|
+
.status { position: absolute; top: var(--cm-space-20); inset-inline-end: var(--cm-space-20); }
|
|
1494
1755
|
.name { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
|
|
1495
1756
|
.by { margin: -6px 0 0; }
|
|
1496
1757
|
.rating { display: flex; align-items: center; gap: 5px; margin: 0; }
|
|
@@ -1510,19 +1771,19 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1510
1771
|
@container (max-width: 380px) {
|
|
1511
1772
|
article { padding: var(--cm-space-10); }
|
|
1512
1773
|
.logo { width: 100px; height: 40px; padding: 6px; }
|
|
1513
|
-
.status { top: var(--cm-space-10);
|
|
1774
|
+
.status { top: var(--cm-space-10); inset-inline-end: var(--cm-space-10); }
|
|
1514
1775
|
.actions { gap: var(--cm-space-10); }
|
|
1515
|
-
.details { margin-
|
|
1776
|
+
.details { margin-inline-start: auto; }
|
|
1516
1777
|
}
|
|
1517
|
-
`];
|
|
1778
|
+
`];u("cm-app-card",Ui);var So=0,pc="";function rd(){So++===0&&(pc=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden")}function hc(){So>0&&--So===0&&(document.documentElement.style.overflow=pc)}function ad(){let a=document.activeElement;for(;a?.shadowRoot?.activeElement;)a=a.shadowRoot.activeElement;return a}var Ki,Re,Wi,kr,Co,on,ln,cn,dn,hn,P=class extends x{constructor(){super(...arguments);h(this,kr);this.open=!1;this.label="";this.uid=T("cm-ovl");h(this,Ki,null);h(this,Re,!1);h(this,Wi,!1);h(this,on,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});h(this,ln,e=>{e.preventDefault(),this.requestClose("escape")});h(this,cn,()=>{this.open&&!this.dialog?.open&&(this.open=!1,l(this,kr,Co).call(this))});h(this,dn,e=>{g(this,Wi,e.target===e.currentTarget)});h(this,hn,e=>{if(e.target===e.currentTarget&&r(this,Wi)){let t=e.currentTarget.getBoundingClientRect();(!(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom)||this.backdropFillsDialog)&&this.requestClose("backdrop")}g(this,Wi,!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(g(this,Ki,ad()),!this.isConnected)return;t.showModal(),r(this,Re)||(rd(),g(this,Re,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),l(this,kr,Co).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,Re)&&(hc(),g(this,Re,!1))}renderHeader(e=c){return n`<header class="head" part="header">
|
|
1518
1779
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
1519
|
-
<button type="button" class="x" part="close" aria-label=${this.closeLabel||"
|
|
1780
|
+
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
1520
1781
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
1521
|
-
</header>`}renderDialog(e,t=""){return
|
|
1522
|
-
aria-labelledby=${this.heading?`${this.uid}-h`:
|
|
1523
|
-
aria-label=${!this.heading&&this.label?this.label:
|
|
1524
|
-
@keydown=${
|
|
1525
|
-
@pointerdown=${
|
|
1782
|
+
</header>`}renderDialog(e,t=""){return n`<dialog part="dialog" class=${t}
|
|
1783
|
+
aria-labelledby=${this.heading?`${this.uid}-h`:c}
|
|
1784
|
+
aria-label=${!this.heading&&this.label?this.label:c}
|
|
1785
|
+
@keydown=${r(this,on)} @cancel=${r(this,ln)} @close=${r(this,cn)}
|
|
1786
|
+
@pointerdown=${r(this,dn)} @click=${r(this,hn)}>${e}</dialog>`}};Ki=new WeakMap,Re=new WeakMap,Wi=new WeakMap,kr=new WeakSet,Co=function(){r(this,Re)&&(hc(),g(this,Re,!1));let e=r(this,Ki);g(this,Ki,null),e?.isConnected&&e.focus(),this.dispatchEvent(new CustomEvent("cm-closed",{bubbles:!0,composed:!0}))},on=new WeakMap,ln=new WeakMap,cn=new WeakMap,dn=new WeakMap,hn=new WeakMap,P.properties={open:{type:Boolean,reflect:!0},heading:{string:"heading"},label:{},closeLabel:{attribute:"close-label",string:"close"}},P.overlayStyles=[f,m`
|
|
1526
1787
|
:host { display: contents; }
|
|
1527
1788
|
dialog {
|
|
1528
1789
|
padding: 0; border: 0; margin: 0; max-width: none; max-height: none; background: transparent; color: inherit;
|
|
@@ -1534,7 +1795,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1534
1795
|
overflow: hidden; outline: none;
|
|
1535
1796
|
}
|
|
1536
1797
|
.head {
|
|
1537
|
-
display: flex; align-items: center; gap: var(--cm-space-10); flex: none; min-height: 40px; padding: 8px
|
|
1798
|
+
display: flex; align-items: center; gap: var(--cm-space-10); flex: none; min-height: 40px; padding-block: 8px; padding-inline: 15px 10px;
|
|
1538
1799
|
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
1539
1800
|
}
|
|
1540
1801
|
.head h2 { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
|
|
@@ -1553,22 +1814,22 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1553
1814
|
dialog[open] .panel { animation: cm-ovl-in 160ms ease-out; }
|
|
1554
1815
|
}
|
|
1555
1816
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
1556
|
-
`];var
|
|
1817
|
+
`];var pn,mc,Yi=class extends P{constructor(){super(...arguments);h(this,pn);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}render(){return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
1557
1818
|
${this.renderHeader()}
|
|
1558
1819
|
<div class="body" part="body"><slot></slot></div>
|
|
1559
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${
|
|
1560
|
-
</div>`)}};
|
|
1820
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${l(this,pn,mc)}></slot></footer>
|
|
1821
|
+
</div>`)}};pn=new WeakSet,mc=function(e){this._hasFooter=e.target.assignedElements().length>0},Yi.properties={...P.properties,size:{reflect:!0},_hasFooter:{state:!0}},Yi.styles=[...P.overlayStyles,m`
|
|
1561
1822
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
1562
1823
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
1563
1824
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
1564
1825
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-sm); box-shadow: var(--cm-shadow-100); }
|
|
1565
|
-
`];
|
|
1826
|
+
`];u("cm-modal",Yi);var mn,uc,$e=class extends P{constructor(){super(...arguments);h(this,mn);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}renderBody(){return n`<slot></slot>`}renderFooter(){return n`<slot name="footer" @slotchange=${l(this,mn,uc)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
1566
1827
|
${this.renderHeader()}
|
|
1567
1828
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
1568
1829
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
1569
|
-
</div>`)}};
|
|
1830
|
+
</div>`)}};mn=new WeakSet,uc=function(e){this._hasFooter=e.target.assignedElements().length>0},$e.properties={...P.properties,size:{reflect:!0},_hasFooter:{state:!0}},$e.styles=[...P.overlayStyles,m`
|
|
1570
1831
|
dialog {
|
|
1571
|
-
position: fixed; inset: 0
|
|
1832
|
+
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
1572
1833
|
}
|
|
1573
1834
|
:host([size='small']) dialog { --cm-side-panel-width: 380px; }
|
|
1574
1835
|
:host([size='large']) dialog { --cm-side-panel-width: 720px; }
|
|
@@ -1576,30 +1837,32 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1576
1837
|
@media (prefers-reduced-motion: no-preference) {
|
|
1577
1838
|
dialog[open] .panel { animation: cm-side-in 200ms ease-out; }
|
|
1578
1839
|
}
|
|
1579
|
-
|
|
1840
|
+
/* Slides in from the end edge: from the right, or from the left in right-to-left pages. */
|
|
1841
|
+
dialog:dir(rtl) { --_cm-side-from: -24px; }
|
|
1842
|
+
@keyframes cm-side-in { from { transform: translateX(var(--_cm-side-from, 24px)); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
1580
1843
|
@media (max-width: 599px) {
|
|
1581
1844
|
dialog { inset: 16px; width: auto; height: auto; }
|
|
1582
1845
|
.panel { border-radius: var(--cm-radius-sm); }
|
|
1583
1846
|
}
|
|
1584
|
-
`];
|
|
1847
|
+
`];u("cm-side-panel",$e);var cf=$("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),Xi,un,Gi=class extends $e{constructor(){super(...arguments);this.search=!1;this.query="";h(this,Xi,()=>{this.dispatchEvent(new CustomEvent("cm-filter-apply",{detail:{values:this.values,query:this.query},bubbles:!0,composed:!0,cancelable:!0}))&&this.requestClose("action")});h(this,un,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(o,d)=>{if(d==="")return;let p=e[o];e[o]=p===void 0?d:Array.isArray(p)?[...p,d]:[p,d]},s=this.form;if(s){for(let[o,d]of new FormData(s))typeof d=="string"&&t(o,d);return e}return this.querySelectorAll("[name]").forEach(o=>{let d=o.getAttribute("name");"checked"in o&&(o.type==="checkbox"||o.type==="radio"||o.localName.match(/^cm-(checkbox|radio|toggle)$/))?o.checked&&t(d,o.value||"on"):typeof o.value=="string"&&t(d,o.value)}),e}reset(){let e=this.form;e?e.reset():this.querySelectorAll("[name]").forEach(t=>t.formResetCallback?.()),this.query=""}renderBody(){return n`${this.search?n`<cm-search class="search" part="search" .value=${this.query} label=${this.searchLabel}
|
|
1585
1848
|
placeholder=${this.searchPlaceholder}
|
|
1586
1849
|
@input=${e=>{this.query=e.target.value}}
|
|
1587
|
-
@cm-search=${e=>{e.stopPropagation(),
|
|
1588
|
-
<slot @submit=${e=>{e.preventDefault(),
|
|
1589
|
-
<cm-button part="apply" variant="primary" @click=${
|
|
1850
|
+
@cm-search=${e=>{e.stopPropagation(),r(this,Xi).call(this)}}></cm-search>`:c}
|
|
1851
|
+
<slot @submit=${e=>{e.preventDefault(),r(this,Xi).call(this)}}></slot>`}renderFooter(){return n`<cm-button part="reset" @click=${r(this,un)}>${this.resetLabel}</cm-button>
|
|
1852
|
+
<cm-button part="apply" variant="primary" @click=${r(this,Xi)}>${this.applyLabel}</cm-button>`}get showFooter(){return!0}};Xi=new WeakMap,un=new WeakMap,Gi.properties={...$e.properties,search:{type:Boolean},query:{},heading:{string:"heading"},searchLabel:{attribute:"search-label",string:"searchLabel"},searchPlaceholder:{attribute:"search-placeholder",string:"searchPlaceholder"},applyLabel:{attribute:"apply-label",string:"apply"},resetLabel:{attribute:"reset-label",string:"reset"}},Gi.styles=[...$e.styles,m`
|
|
1590
1853
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
1591
1854
|
.foot { justify-content: center; }
|
|
1592
1855
|
::slotted(form) { display: grid; gap: var(--cm-space-15); }
|
|
1593
|
-
`];
|
|
1594
|
-
<button type="button" class="x" part="close" aria-label=${this.closeLabel||"
|
|
1856
|
+
`];u("cm-filter-panel",Gi);var Er,zt,Ao,bc,Ji=class extends P{constructor(){super(...arguments);h(this,zt);this.heading="";this.items=[];this._slotted=[];h(this,Er)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=dr(this),g(this,Er,Fa(this,()=>{this._slotted=dr(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,Er)?.disconnect()}render(){let e=this.sheetItems.filter(s=>!s.divider),t=e.some(s=>s.icon);return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
1857
|
+
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
1595
1858
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
1596
|
-
${this.heading?
|
|
1859
|
+
${this.heading?n`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:c}
|
|
1597
1860
|
<div class="content">
|
|
1598
|
-
${e.length?
|
|
1861
|
+
${e.length?n`<ul class=${t?"icons":""} part="list">${e.map(s=>n`<li>${l(this,zt,bc).call(this,s)}</li>`)}</ul>`:c}
|
|
1599
1862
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
1600
1863
|
</div>
|
|
1601
|
-
</div>`)}};
|
|
1602
|
-
@click=${
|
|
1864
|
+
</div>`)}};Er=new WeakMap,zt=new WeakSet,Ao=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")},bc=function(e){let t=`row${e.critical?" critical":""}`,s=n`${e.icon?n`<cm-icon class="lead" name=${e.icon} size="18"></cm-icon>`:c}<span class="label">${e.label}</span>${e.icon?n`<cm-icon name="chevron-right" size="16"></cm-icon>`:c}`;return e.href&&!e.disabled?n`<a class=${t} part="row" href=${e.href} @click=${o=>l(this,zt,Ao).call(this,o,e)}>${s}</a>`:n`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":c}
|
|
1865
|
+
@click=${o=>l(this,zt,Ao).call(this,o,e)}>${s}</button>`},Ji.properties={...P.properties,items:{type:Array},_slotted:{state:!0}},Ji.styles=[...P.overlayStyles,m`
|
|
1603
1866
|
dialog {
|
|
1604
1867
|
position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(600px, 100vw); padding-top: 22px;
|
|
1605
1868
|
}
|
|
@@ -1608,7 +1871,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1608
1871
|
border-radius: 20px 20px 0 0; box-shadow: var(--cm-shadow-100);
|
|
1609
1872
|
}
|
|
1610
1873
|
.x {
|
|
1611
|
-
position: absolute; top: -18px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%;
|
|
1874
|
+
position: absolute; top: -18px; left: 50%; transform: translateX(-50%); /* centred: the same in both directions */ width: 36px; height: 36px; border-radius: 50%;
|
|
1612
1875
|
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
1613
1876
|
}
|
|
1614
1877
|
.x:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
@@ -1633,16 +1896,16 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1633
1896
|
}
|
|
1634
1897
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
1635
1898
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1636
|
-
`];
|
|
1899
|
+
`];u("cm-bottom-sheet",Ji);var wf=$("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: "}),nd={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},Zi=class extends k{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value=""}render(){return null}};Zi.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0}},Zi.styles=m`:host { display: none; }`;u("cm-notification-item",Zi);var es,we,Do,No,fc,Qi=class extends P{constructor(){super(...arguments);h(this,we);this.items=[];this.moreHref="";this._slotted=[];h(this,es)}connectedCallback(){super.connectedCallback(),l(this,we,Do).call(this),g(this,es,new MutationObserver(()=>l(this,we,Do).call(this))),r(this,es).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,es)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications;return this.renderDialog(n`<div class="panel" part="panel" tabindex="-1">
|
|
1637
1900
|
${this.renderHeader()}
|
|
1638
|
-
${e.length?
|
|
1639
|
-
${this.moreHref?
|
|
1901
|
+
${e.length?n`<ul class="list" part="list">${e.map(t=>n`<li>${l(this,we,fc).call(this,t)}</li>`)}</ul>`:n`<p class="empty">${this.emptyText}</p>`}
|
|
1902
|
+
${this.moreHref?n`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:c}
|
|
1640
1903
|
<slot hidden></slot>
|
|
1641
|
-
</div>`)}};
|
|
1642
|
-
<span class="label">${e.unread?
|
|
1643
|
-
${e.time?
|
|
1904
|
+
</div>`)}};es=new WeakMap,we=new WeakSet,Do=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=s=>e.getAttribute(s)||void 0;return{label:(e.textContent??"").trim(),time:t("time"),tone:t("tone")??"information",href:t("href"),unread:e.hasAttribute("unread")||void 0,value:t("value")}})},No=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")},fc=function(e){let t=e.tone??"information",s=n`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${nd[t]??"bell"} size="14"></cm-icon></span>
|
|
1905
|
+
<span class="label">${e.unread?n`<span class="vh">${this.t("unread")}</span>`:c}${e.label}</span>
|
|
1906
|
+
${e.time?n`<time>${e.time}</time>`:c}`,o=`row${e.unread?" unread":""}`;return e.href?n`<a class=${o} part="row" href=${e.href} @click=${d=>l(this,we,No).call(this,d,e)}>${s}</a>`:n`<button type="button" class=${o} part="row" @click=${d=>l(this,we,No).call(this,d,e)}>${s}</button>`},Qi.properties={...P.properties,items:{type:Array},moreHref:{attribute:"more-href"},heading:{string:"heading"},moreLabel:{attribute:"more-label",string:"more"},emptyText:{attribute:"empty-text",string:"empty"},_slotted:{state:!0}},Qi.styles=[...P.overlayStyles,m`
|
|
1644
1907
|
dialog {
|
|
1645
|
-
position: fixed; inset: var(--cm-notification-panel-top, 64px) var(--cm-notification-panel-end, 20px)
|
|
1908
|
+
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
1646
1909
|
width: min(380px, calc(100vw - 32px));
|
|
1647
1910
|
}
|
|
1648
1911
|
.panel { max-height: calc(100dvh - var(--cm-notification-panel-top, 64px) - 16px); border-radius: var(--cm-radius-sm); box-shadow: var(--cm-shadow-100); }
|
|
@@ -1673,20 +1936,20 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1673
1936
|
@media (max-width: 599px) {
|
|
1674
1937
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
1675
1938
|
}
|
|
1676
|
-
`];
|
|
1677
|
-
${this.tone==="critical"?
|
|
1939
|
+
`];u("cm-notification-panel",Qi);var Lf=$("toastRegion",{label:"Notifications"}),od=2e3,gc=1e4,vc=150,Mr,fe,He,_r,rs,as,X,xc,ts,Io,zr,Tr,Lr,Sr,yc,is=class extends x{constructor(){super(...arguments);h(this,X);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;h(this,Mr);h(this,fe);h(this,He,0);h(this,_r,0);h(this,rs,!1);h(this,as,!1);h(this,zr,()=>{g(this,rs,!0),l(this,X,Io).call(this)});h(this,Tr,()=>{g(this,rs,!1),l(this,X,ts).call(this)});h(this,Lr,()=>{g(this,as,!0),l(this,X,Io).call(this)});h(this,Sr,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(g(this,as,!1),l(this,X,ts).call(this))})}get effectiveDuration(){let e=this.duration??(this.actionLabel?gc:5e3);return Math.min(gc,Math.max(od,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&g(this,Mr,setTimeout(()=>{this._primed=!0},vc)),this.addEventListener("pointerenter",r(this,zr)),this.addEventListener("pointerleave",r(this,Tr)),this.addEventListener("focusin",r(this,Lr)),this.addEventListener("focusout",r(this,Sr))}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(r(this,fe)),clearTimeout(r(this,Mr)),this.removeEventListener("pointerenter",r(this,zr)),this.removeEventListener("pointerleave",r(this,Tr)),this.removeEventListener("focusin",r(this,Lr)),this.removeEventListener("focusout",r(this,Sr))}updated(e){(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,fe)),this.open&&(this._inRegion||this._primed)&&(g(this,He,this.effectiveDuration),l(this,X,ts).call(this)))}show(){this.open?(g(this,He,this.effectiveDuration),l(this,X,ts).call(this)):this.open=!0}dismiss(e="close"){let t=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0,detail:{reason:e}});return this.dispatchEvent(t)?(clearTimeout(r(this,fe)),this.open=!1,!0):(e==="timeout"&&(g(this,He,this.effectiveDuration),l(this,X,ts).call(this)),!1)}render(){let e=n`<div class="toast" part="toast">
|
|
1940
|
+
${this.tone==="critical"?n`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:c}
|
|
1678
1941
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
1679
|
-
${this.actionLabel?
|
|
1680
|
-
<button class="close" part="close" aria-label
|
|
1942
|
+
${this.actionLabel?n`<button class="action" part="action" @click=${l(this,X,yc)}>${this.actionLabel}</button>`:c}
|
|
1943
|
+
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
1681
1944
|
<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
1945
|
</button>
|
|
1683
|
-
</div>`;return this._inRegion?e:
|
|
1946
|
+
</div>`;return this._inRegion?e:n`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:c}</div>`}};Mr=new WeakMap,fe=new WeakMap,He=new WeakMap,_r=new WeakMap,rs=new WeakMap,as=new WeakMap,X=new WeakSet,xc=function(){return r(this,rs)||r(this,as)},ts=function(){clearTimeout(r(this,fe)),!(!this.open||r(this,X,xc))&&(g(this,_r,Date.now()),g(this,fe,setTimeout(()=>this.dismiss("timeout"),r(this,He))))},Io=function(){r(this,fe)!==void 0&&(clearTimeout(r(this,fe)),g(this,fe,void 0),g(this,He,Math.max(1e3,r(this,He)-(Date.now()-r(this,_r)))))},zr=new WeakMap,Tr=new WeakMap,Lr=new WeakMap,Sr=new WeakMap,yc=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},is.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},is.styles=[f,m`
|
|
1684
1947
|
:host { display: block; pointer-events: auto; }
|
|
1685
1948
|
:host(:not([open])) { display: none; }
|
|
1686
1949
|
.toast {
|
|
1687
1950
|
display: flex; align-items: center; gap: var(--cm-space-15);
|
|
1688
1951
|
min-block-size: 48px; max-inline-size: min(480px, calc(100vw - 32px));
|
|
1689
|
-
padding: var(--cm-space-10)
|
|
1952
|
+
padding-block: var(--cm-space-10); padding-inline: var(--cm-space-20) var(--cm-space-10);
|
|
1690
1953
|
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-100);
|
|
1691
1954
|
background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark);
|
|
1692
1955
|
outline: 1px solid var(--cm-nav-divider); font-size: 14px; line-height: 20px;
|
|
@@ -1705,42 +1968,23 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1705
1968
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
1706
1969
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
1707
1970
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
1708
|
-
`];
|
|
1971
|
+
`];u("cm-toast",is);var Cr,Ar,ss=class extends x{constructor(){super(...arguments);this.max=3;h(this,Cr,!1);h(this,Ar,e=>{let t=e.target;queueMicrotask(()=>{t.localName==="cm-toast"&&!t.open&&t.remove()})})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),g(this,Cr,!0)),this.addEventListener("cm-dismiss",r(this,Ar))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Ar))}updated(){r(this,Cr)&&this.setAttribute("aria-label",this.t("label"))}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")];return t.slice(0,Math.max(0,t.length-Math.max(1,this.max))).forEach(s=>s.remove()),e}render(){return n`<slot></slot>`}};Cr=new WeakMap,Ar=new WeakMap,ss.properties={max:{type:Number}},ss.styles=[f,m`
|
|
1709
1972
|
:host {
|
|
1710
1973
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
1711
1974
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-10);
|
|
1712
1975
|
padding-inline: var(--cm-space-15); pointer-events: none;
|
|
1713
1976
|
}
|
|
1714
|
-
`];
|
|
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`
|
|
1977
|
+
`];u("cm-toast-region",ss);function ld(a,i={}){let e=i.root??document.body,t=e.querySelector(":scope > cm-toast-region"),s=!t;t||(t=document.createElement("cm-toast-region"),e.append(t));let o=document.createElement("cm-toast");if(o.message=String(a),i.tone&&(o.tone=i.tone),i.duration!==void 0&&(o.duration=i.duration),i.action){o.actionLabel=i.action.label;let d=i.action.onAction;o.addEventListener("cm-action",()=>d())}if(s){let d=t;return setTimeout(()=>d.add(o),vc),o}return t.add(o)}var Rf=$("progressBar",{inProgress:"In progress"}),bn,ns=class extends x{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";h(this,bn,T("cm-progress"))}get clampedValue(){let e=this.value;return e==null||Number.isNaN(Number(e))?null:Math.min(100,Math.max(0,Number(e)))}render(){let e=this.clampedValue,t=`${r(this,bn)}-label`;return n`
|
|
1734
1978
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
1735
1979
|
<span id=${t} part="label">${this.label}</span>
|
|
1736
|
-
${this.showValue&&e!==null?
|
|
1980
|
+
${this.showValue&&e!==null?n`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:c}
|
|
1737
1981
|
</div>
|
|
1738
1982
|
<div class="track ${e===null?"indeterminate":""}" part="track" role="progressbar"
|
|
1739
1983
|
aria-labelledby=${t} aria-valuemin="0" aria-valuemax="100"
|
|
1740
|
-
aria-valuenow=${e===null?
|
|
1741
|
-
aria-valuetext=${e===null?"
|
|
1984
|
+
aria-valuenow=${e===null?c:Math.round(e)}
|
|
1985
|
+
aria-valuetext=${e===null?this.t("inProgress"):this.formatNumber(Math.round(e)/100,{style:"percent"})}>
|
|
1742
1986
|
<div class="fill" part="fill" style=${e===null?"":`inline-size:${e}%`}></div>
|
|
1743
|
-
</div>`}};
|
|
1987
|
+
</div>`}};bn=new WeakMap,ns.properties={value:{type:Number},label:{},labelHidden:{type:Boolean,attribute:"label-hidden"},showValue:{type:Boolean,attribute:"show-value"},size:{reflect:!0}},ns.styles=[f,m`
|
|
1744
1988
|
:host { display: block; }
|
|
1745
1989
|
.head { display: flex; justify-content: space-between; gap: var(--cm-space-10); margin-block-end: 6px; font-size: 14px; line-height: 20px; }
|
|
1746
1990
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
@@ -1757,7 +2001,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1757
2001
|
.fill { transition: none; }
|
|
1758
2002
|
.indeterminate .fill { animation-duration: 4s; }
|
|
1759
2003
|
}
|
|
1760
|
-
`];
|
|
2004
|
+
`];u("cm-progress-bar",ns);var os=class extends k{constructor(){super(...arguments);this.tone="neutral"}render(){return n`<span part="badge"><slot></slot></span>`}};os.properties={tone:{reflect:!0}},os.styles=[f,m`
|
|
1761
2005
|
:host { display: inline-flex; vertical-align: middle; }
|
|
1762
2006
|
span {
|
|
1763
2007
|
display: inline-flex; align-items: center; height: 28px; padding: 0 var(--cm-space-10);
|
|
@@ -1769,11 +2013,11 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1769
2013
|
: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
2014
|
: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
2015
|
: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
|
-
`];
|
|
1773
|
-
${this.heading||this.description?
|
|
1774
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:
|
|
2016
|
+
`];u("cm-badge",os);var ls=class extends k{constructor(){super(...arguments);this.heading="";this.description="";this.flush=!1;this.headingLevel=2}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=this.heading?n`<div role="heading" aria-level=${e} class="title" part="title">${this.heading}<slot name="title-adornment"></slot></div>`:c;return n`<section part="card" aria-label=${this.heading||c}>
|
|
2017
|
+
${this.heading||this.description?n`<header><div>${t}${this.description?n`<p class="desc">${this.description}</p>`:c}</div>
|
|
2018
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c}
|
|
1775
2019
|
<slot></slot>
|
|
1776
|
-
</section>`}};
|
|
2020
|
+
</section>`}};ls.properties={heading:{},description:{},flush:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},ls.styles=[f,m`
|
|
1777
2021
|
:host { display: block; }
|
|
1778
2022
|
section {
|
|
1779
2023
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card);
|
|
@@ -1785,8 +2029,8 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1785
2029
|
.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
2030
|
.desc { margin: 6px 0 0; font-size: 16px; color: var(--cm-text-tertiary); }
|
|
1787
2031
|
.actions { display: flex; gap: var(--cm-space-20); align-items: center; }
|
|
1788
|
-
`];
|
|
1789
|
-
`))}var
|
|
2032
|
+
`];u("cm-card",ls);var cd=["0","10","12","15","20","22","30"];function cs(a,i){return Ir(cd.map(e=>`:host([${a}='${e}']) { ${i}: ${e==="0"?"0px":`var(--cm-space-${e})`}; }`).join(`
|
|
2033
|
+
`))}var ds=class extends k{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return n`<slot></slot>`}};ds.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},ds.styles=[f,m`
|
|
1790
2034
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
1791
2035
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
1792
2036
|
:host([wrap]) { flex-wrap: wrap; }
|
|
@@ -1799,13 +2043,13 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1799
2043
|
:host([justify='center']) { justify-content: center; }
|
|
1800
2044
|
:host([justify='end']) { justify-content: flex-end; }
|
|
1801
2045
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
1802
|
-
`,
|
|
2046
|
+
`,cs("gap","gap")];u("cm-stack",ds);var $c="important",dd=" !"+$c,wc=Ur(class extends At{constructor(a){if(super(a),a.type!==_e.ATTRIBUTE||a.name!=="style"||a.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(a){return Object.keys(a).reduce((i,e)=>{let t=a[e];return t==null?i:i+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(a,[i]){let{style:e}=a.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let t of this.ft)i[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in i){let s=i[t];if(s!=null){this.ft.add(t);let o=typeof s=="string"&&s.endsWith(dd);t.includes("-")||o?e.setProperty(t,o?s.slice(0,-11):s,o?$c:""):e[t]=s}}return J}});var hs=class extends k{constructor(){super(...arguments);this.columns=2;this.gap="20"}render(){let e=Math.max(1,Math.floor(Number(this.columns)||1)),t=this.minColumnWidth?.trim(),s=t?`repeat(auto-fit, minmax(min(100%, ${t}), 1fr))`:`repeat(${e}, minmax(0, 1fr))`;return n`<div class="grid ${t?"fit":"fixed"}" part="grid" style=${wc({gridTemplateColumns:s})}><slot></slot></div>`}};hs.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},hs.styles=[f,m`
|
|
1803
2047
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
1804
2048
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
1805
2049
|
@container cm-grid (max-width: 640px) {
|
|
1806
2050
|
.grid.fixed { grid-template-columns: minmax(0, 1fr) !important; }
|
|
1807
2051
|
}
|
|
1808
|
-
`,
|
|
2052
|
+
`,cs("gap","--_gap")];u("cm-grid",hs);var ps=class extends k{constructor(){super(...arguments);this.gap="20"}render(){return n`<div class="layout" part="layout"><slot></slot></div>`}};ps.properties={gap:{reflect:!0}},ps.styles=[f,m`
|
|
1809
2053
|
:host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-20); }
|
|
1810
2054
|
.layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
|
|
1811
2055
|
@container cm-layout (max-width: 767px) {
|
|
@@ -1819,9 +2063,9 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1819
2063
|
::slotted([variant='one-third']) { grid-column: span 2; }
|
|
1820
2064
|
::slotted([variant='two-thirds']) { grid-column: span 4; }
|
|
1821
2065
|
}
|
|
1822
|
-
`,
|
|
2066
|
+
`,cs("gap","--_gap")];var ms=class extends k{constructor(){super(...arguments);this.variant="full"}render(){return n`<slot></slot>`}};ms.properties={variant:{reflect:!0}},ms.styles=[f,m`
|
|
1823
2067
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
1824
|
-
`];
|
|
2068
|
+
`];u("cm-layout",ps);u("cm-layout-section",ms);var us=class extends k{constructor(){super(...arguments);this.fullWidth=!1;this.narrow=!1}render(){return n`<slot name="header"></slot><div class="content" part="content"><slot></slot></div><slot name="footer"></slot>`}};us.properties={fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},us.styles=[f,m`
|
|
1825
2069
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-bg-page); min-block-size: 100%; }
|
|
1826
2070
|
.content {
|
|
1827
2071
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
@@ -1830,16 +2074,16 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1830
2074
|
:host([narrow]) .content { max-inline-size: 800px; }
|
|
1831
2075
|
:host([full-width]) .content { max-inline-size: none; }
|
|
1832
2076
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-10); } }
|
|
1833
|
-
`];
|
|
2077
|
+
`];u("cm-page",us);var fs,kc,Ec,bs=class extends x{constructor(){super(...arguments);h(this,fs);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?Ls`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:Ls`<circle cx="10" cy="10" r="7.5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M10 6v5M10 13.6v.2" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>`;return n`<div class="banner" part="banner" role=${e}>
|
|
1834
2078
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
1835
2079
|
<div class="body">
|
|
1836
|
-
${this.heading?
|
|
2080
|
+
${this.heading?n`<p class="title">${this.heading}</p>`:c}
|
|
1837
2081
|
<div><slot></slot></div>
|
|
1838
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${
|
|
2082
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${l(this,fs,kc)}></slot></div>
|
|
1839
2083
|
</div>
|
|
1840
|
-
${this.dismissible?
|
|
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>`:
|
|
1842
|
-
</div>`}};
|
|
2084
|
+
${this.dismissible?n`<button class="close" aria-label=${this.t("dismiss")} @click=${l(this,fs,Ec)}>
|
|
2085
|
+
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg></button>`:c}
|
|
2086
|
+
</div>`}};fs=new WeakSet,kc=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},Ec=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},bs.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},bs.styles=[f,m`
|
|
1843
2087
|
:host { display: block; }
|
|
1844
2088
|
.banner {
|
|
1845
2089
|
display: flex; gap: var(--cm-space-15); align-items: flex-start;
|
|
@@ -1862,8 +2106,8 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1862
2106
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
1863
2107
|
}
|
|
1864
2108
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1865
|
-
`];
|
|
1866
|
-
data-side=${this._side}>${this.content}</div>`}};
|
|
2109
|
+
`];u("cm-banner",bs);var fn='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',B,vs,st,rt,ke,xs,ys,re,Ro,gn,vn,xn,yn,$s,Mc,Tt,Ho,qo,qe,gs=class extends k{constructor(){super(...arguments);h(this,re);this.content="";this.placement="top";this.delay=300;this.open=!1;this._side="top";h(this,B);h(this,vs);h(this,st,[]);h(this,rt);h(this,ke);h(this,xs,!1);h(this,ys,!1);h(this,gn,()=>{g(this,xs,!0),clearTimeout(r(this,ke)),this.open||g(this,ke,setTimeout(()=>this.show(),this.delay))});h(this,vn,()=>{g(this,xs,!1),clearTimeout(r(this,ke)),r(this,ys)||g(this,ke,setTimeout(()=>this.hide(),100))});h(this,xn,()=>{g(this,ys,!0),this.show()});h(this,yn,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(g(this,ys,!1),r(this,xs)||this.hide())});h(this,$s,e=>{e.key==="Escape"&&this.open&&this.hide()});h(this,Tt,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(l(this,re,qo).call(this),!t||!this.content)return;let s=t.updateComplete;t.localName.includes("-")&&s&&!t.shadowRoot?.querySelector(fn)&&s.then(()=>{t.shadowRoot?.querySelector(fn)&&r(this,Tt).call(this)}),r(this,B)||(g(this,B,document.createElement("span")),r(this,B).id=T("cm-tooltip"),r(this,B).hidden=!0,r(this,B).slot="description"),r(this,B).textContent=this.content,r(this,B).isConnected||this.append(r(this,B));let o=l(this,re,Mc).call(this,t);if(g(this,vs,o),o.getRootNode()===r(this,B).getRootNode()){let d=(o.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);d.includes(r(this,B).id)||o.setAttribute("aria-describedby",[...d,r(this,B).id].join(" "))}else"ariaDescribedByElements"in o?(l(this,re,Ho).call(this,o),g(this,rt,new MutationObserver(()=>{o.getAttribute("aria-describedby")!==""&&l(this,re,Ho).call(this,o)})),r(this,rt).observe(o,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,B).id)});h(this,qe,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let o=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0]??this).getBoundingClientRect(),d=e.getBoundingClientRect(),p=8,b=8,w=innerWidth,y=innerHeight,v=getComputedStyle(this).direction==="rtl",A=St=>St==="start"?v?"right":"left":St==="end"?v?"left":"right":St,M={top:o.top-p-d.height>=b,bottom:o.bottom+p+d.height<=y-b,left:o.left-p-d.width>=b,right:o.right+p+d.width<=w-b},S={top:"bottom",bottom:"top",left:"right",right:"left"},O=A(this.placement);!M[O]&&M[S[O]]&&(O=S[O]);let I,R;O==="top"||O==="bottom"?(I=o.left+o.width/2-d.width/2,R=O==="top"?o.top-p-d.height:o.bottom+p):(R=o.top+o.height/2-d.height/2,I=O==="left"?o.left-p-d.width:o.right+p),I=Math.min(Math.max(b,I),w-b-d.width),R=Math.min(Math.max(b,R),y-b-d.height),e.style.transform=`translate(${Math.round(I)}px, ${Math.round(R)}px)`;let Lt={top:"top",bottom:"bottom",left:v?"end":"start",right:v?"start":"end"};this._side=Lt[O]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,gn)),this.addEventListener("pointerleave",r(this,vn)),this.addEventListener("focusin",r(this,xn)),this.addEventListener("focusout",r(this,yn)),this.addEventListener("keydown",r(this,$s)),this.hasUpdated&&r(this,Tt).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),l(this,re,qo).call(this),l(this,re,Ro).call(this),clearTimeout(r(this,ke))}show(){clearTimeout(r(this,ke)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,$s),!0),addEventListener("scroll",r(this,qe),!0),addEventListener("resize",r(this,qe)),this.updateComplete.then(r(this,qe)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,ke)),this.open&&(this.open=!1,l(this,re,Ro).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){e.has("content")&&(r(this,Tt).call(this),this.content?this.open&&r(this,qe).call(this):this.hide())}render(){return n`<slot @slotchange=${r(this,Tt)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
2110
|
+
data-side=${this._side}>${this.content}</div>`}};B=new WeakMap,vs=new WeakMap,st=new WeakMap,rt=new WeakMap,ke=new WeakMap,xs=new WeakMap,ys=new WeakMap,re=new WeakSet,Ro=function(){document.removeEventListener("keydown",r(this,$s),!0),removeEventListener("scroll",r(this,qe),!0),removeEventListener("resize",r(this,qe))},gn=new WeakMap,vn=new WeakMap,xn=new WeakMap,yn=new WeakMap,$s=new WeakMap,Mc=function(e){return e.matches(fn)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(fn)??e},Tt=new WeakMap,Ho=function(e){g(this,st,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),s=r(this,st).map(o=>t.getElementById(o)).filter(o=>!!o);e.ariaDescribedByElements=[...s,r(this,B)]},qo=function(){let e=r(this,vs);if(!(!e||!r(this,B))){if(r(this,rt))r(this,rt).disconnect(),g(this,rt,void 0),r(this,st).length?e.setAttribute("aria-describedby",r(this,st).join(" ")):e.removeAttribute("aria-describedby"),g(this,st,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(s=>s&&s!==r(this,B).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,vs,void 0)}},qe=new WeakMap,gs.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},_side:{state:!0}},gs.styles=[f,m`
|
|
1867
2111
|
:host { display: inline-block; position: relative; }
|
|
1868
2112
|
.tip {
|
|
1869
2113
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -1877,10 +2121,10 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1877
2121
|
:host([open]) .tip { opacity: 1; visibility: visible; }
|
|
1878
2122
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
1879
2123
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
1880
|
-
`];
|
|
1881
|
-
@error=${()=>{this._failed=!0}}></span>`;let e=this.size==="small"?18:this.size==="large"?32:24;return
|
|
1882
|
-
aria-label=${this.alt
|
|
1883
|
-
<cm-icon name="box" size=${e}></cm-icon></span>`}};
|
|
2124
|
+
`];u("cm-tooltip",gs);var Lg=$("thumbnail",{noImage:"{alt} (no image)"}),ws=class extends x{constructor(){super(...arguments);this.src="";this.alt="";this.size="medium";this.loading="eager";this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){if(this.src&&!this._failed)return n`<span class="box" part="thumbnail"><img src=${this.src} alt=${this.alt} loading=${this.loading}
|
|
2125
|
+
@error=${()=>{this._failed=!0}}></span>`;let e=this.size==="small"?18:this.size==="large"?32:24;return n`<span class="box" part="thumbnail" role=${this.alt?"img":c}
|
|
2126
|
+
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):c} aria-hidden=${this.alt?c:"true"}>
|
|
2127
|
+
<cm-icon name="box" size=${e}></cm-icon></span>`}};ws.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},ws.styles=[f,m`
|
|
1884
2128
|
:host { --_size: var(--cm-thumbnail-size, 60px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
1885
2129
|
:host([size='small']) { --_size: var(--cm-thumbnail-size, 40px); }
|
|
1886
2130
|
:host([size='large']) { --_size: var(--cm-thumbnail-size, 80px); }
|
|
@@ -1890,7 +2134,7 @@ cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-
|
|
|
1890
2134
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
1891
2135
|
}
|
|
1892
2136
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
1893
|
-
`];
|
|
2137
|
+
`];u("cm-thumbnail",ws);export{hi as CmAccordion,oi as CmActionBar,Li as CmActionMenu,Ui as CmAppCard,qi as CmAvatar,os as CmBadge,bs as CmBanner,ji as CmBottomNavigation,Ji as CmBottomSheet,dt as CmButton,ls as CmCard,je as CmCheckbox,Ye as CmCombobox,fi as CmComment,gi as CmCommentBox,Mi as CmDataTable,Xe as CmDatePicker,Ze as CmDateRangePicker,pi as CmEmptyState,et as CmFileUpload,Gi as CmFilterPanel,Fi as CmFlashOfferBar,hs as CmGrid,Oi as CmHeaderBar,Rt as CmIcon,di as CmInfoItem,ci as CmInfoPanel,ps as CmLayout,ms as CmLayoutSection,Vi as CmLinkTabs,x as CmLocalizedElement,zi as CmMenuItem,Bi as CmMobileMenu,Yi as CmModal,Ri as CmNavItem,Qa as CmNestedItem,Ni as CmNestedList,Zi as CmNotificationItem,Qi as CmNotificationPanel,vt as CmOptionGroup,us as CmPage,ni as CmPageHeader,yi as CmPagination,ns as CmProgressBar,mt as CmRadio,ut as CmRadioGroup,Et as CmReportTile,Ii as CmReportTiles,Ai as CmResourceItem,Di as CmResourceList,li as CmSaveBar,Ke as CmSearch,Ue as CmSelect,Hi as CmSideNavigation,$e as CmSidePanel,ui as CmSkeleton,bi as CmSkeletonDisplay,vi as CmSmartTip,xi as CmSmartTips,Ft as CmSpinner,ds as CmStack,wi as CmStatusTabs,ki as CmTableHeader,Bt as CmTag,Oe as CmTextField,ws as CmThumbnail,is as CmToast,ss as CmToastRegion,Fe as CmToggle,gs as CmTooltip,Bc as configure,$ as defineStrings,ul as directionalIcons,ge as formatDate,cl as formatMessage,In as formatNumber,Pc as getDefaultStrings,nc as initials,As as localeFor,Gr as pluralCategory,Fc as resetStrings,wl as resolvePreset,jc as setStrings,ld as showToast,dl as translate};
|
|
1894
2138
|
/*! Bundled license information:
|
|
1895
2139
|
|
|
1896
2140
|
@lit/reactive-element/css-tag.js:
|