@commmerce/ui 1.10.1 → 1.12.0

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.
@@ -14,6 +14,8 @@ Poppins typeface - OFL-1.1 Font files in @commme
14
14
  Dancing Script typeface - OFL-1.1 Font file in @commmerce/tokens and the hosted
15
15
  files: typed signatures in cm-signature-field
16
16
  path_drawing (Dart) 1.0.1 MIT Dependency of the Flutter package commmerce_ui
17
+ Inter typeface - OFL-1.1 Font files in @commmerce/tokens and the hosted
18
+ files: interface text in the refined look
17
19
 
18
20
  The line icons in @commmerce/icons and the design tokens are original
19
21
  Commmerce work and contain no third-party material.
@@ -274,3 +276,102 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
274
276
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
275
277
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
276
278
  SOFTWARE.
279
+
280
+ ==============================================================================
281
+
282
+ Inter typeface
283
+ https://github.com/rsms/inter
284
+
285
+ Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) Inter-Italic[opsz,wght].ttf: Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
286
+
287
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
288
+ This license is copied below, and is also available with a FAQ at:
289
+ http://scripts.sil.org/OFL
290
+
291
+
292
+ -----------------------------------------------------------
293
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
294
+ -----------------------------------------------------------
295
+
296
+ PREAMBLE
297
+ The goals of the Open Font License (OFL) are to stimulate worldwide
298
+ development of collaborative font projects, to support the font creation
299
+ efforts of academic and linguistic communities, and to provide a free and
300
+ open framework in which fonts may be shared and improved in partnership
301
+ with others.
302
+
303
+ The OFL allows the licensed fonts to be used, studied, modified and
304
+ redistributed freely as long as they are not sold by themselves. The
305
+ fonts, including any derivative works, can be bundled, embedded,
306
+ redistributed and/or sold with any software provided that any reserved
307
+ names are not used by derivative works. The fonts and derivatives,
308
+ however, cannot be released under any other type of license. The
309
+ requirement for fonts to remain under this license does not apply
310
+ to any document created using the fonts or their derivatives.
311
+
312
+ DEFINITIONS
313
+ "Font Software" refers to the set of files released by the Copyright
314
+ Holder(s) under this license and clearly marked as such. This may
315
+ include source files, build scripts and documentation.
316
+
317
+ "Reserved Font Name" refers to any names specified as such after the
318
+ copyright statement(s).
319
+
320
+ "Original Version" refers to the collection of Font Software components as
321
+ distributed by the Copyright Holder(s).
322
+
323
+ "Modified Version" refers to any derivative made by adding to, deleting,
324
+ or substituting -- in part or in whole -- any of the components of the
325
+ Original Version, by changing formats or by porting the Font Software to a
326
+ new environment.
327
+
328
+ "Author" refers to any designer, engineer, programmer, technical
329
+ writer or other person who contributed to the Font Software.
330
+
331
+ PERMISSION & CONDITIONS
332
+ Permission is hereby granted, free of charge, to any person obtaining
333
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
334
+ redistribute, and sell modified and unmodified copies of the Font
335
+ Software, subject to the following conditions:
336
+
337
+ 1) Neither the Font Software nor any of its individual components,
338
+ in Original or Modified Versions, may be sold by itself.
339
+
340
+ 2) Original or Modified Versions of the Font Software may be bundled,
341
+ redistributed and/or sold with any software, provided that each copy
342
+ contains the above copyright notice and this license. These can be
343
+ included either as stand-alone text files, human-readable headers or
344
+ in the appropriate machine-readable metadata fields within text or
345
+ binary files as long as those fields can be easily viewed by the user.
346
+
347
+ 3) No Modified Version of the Font Software may use the Reserved Font
348
+ Name(s) unless explicit written permission is granted by the corresponding
349
+ Copyright Holder. This restriction only applies to the primary font name as
350
+ presented to the users.
351
+
352
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
353
+ Software shall not be used to promote, endorse or advertise any
354
+ Modified Version, except to acknowledge the contribution(s) of the
355
+ Copyright Holder(s) and the Author(s) or with their explicit written
356
+ permission.
357
+
358
+ 5) The Font Software, modified or unmodified, in part or in whole,
359
+ must be distributed entirely under this license, and must not be
360
+ distributed under any other license. The requirement for fonts to
361
+ remain under this license does not apply to any document created
362
+ using the Font Software.
363
+
364
+ TERMINATION
365
+ This license becomes null and void if any of the above conditions are
366
+ not met.
367
+
368
+ DISCLAIMER
369
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
370
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
371
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
372
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
373
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
374
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
375
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
376
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
377
+ OTHER DEALINGS IN THE FONT SOFTWARE.
package/dist/cdn.js CHANGED
@@ -100,7 +100,7 @@ var Ju=o=>{throw TypeError(o)};var lm=(o,n,e)=>n.has(o)||Ju("Cannot "+e);var r=(
100
100
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
101
101
  min-width: 16px; height: 16px; padding: 0 var(--cm-space-4); border-radius: var(--cm-radius-full);
102
102
  font-size: var(--cm-font-size-12); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums;
103
- color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
103
+ color: var(--cm-count-text); background: var(--cm-count-bg);
104
104
  }
105
105
  :host([icon-only]) .count {
106
106
  position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
@@ -108,15 +108,18 @@ var Ju=o=>{throw TypeError(o)};var lm=(o,n,e)=>n.has(o)||Ju("Cannot "+e);var r=(
108
108
  }
109
109
  `];$("cm-button",Ji);var ea=class extends S{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1;this.heading=!1;this.shortcut=""}render(){return null}toItem(){let e=(this.textContent??"").trim();return{label:e,value:this.value||e,icon:this.icon||void 0,href:this.href||void 0,disabled:this.disabled||void 0,critical:this.critical||void 0,heading:this.heading||void 0,shortcut:this.shortcut||void 0}}};ea.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0},heading:{type:Boolean,reflect:!0},shortcut:{reflect:!0}},ea.styles=x`:host { display: none; }`;$("cm-menu-item",ea);function ro(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),i=a=>e.getAttribute(a)||void 0;n.push({label:t,value:i("value")??t,icon:i("icon"),href:i("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0,heading:e.hasAttribute("heading")||void 0,shortcut:i("shortcut")})}else e.localName==="hr"&&n.push({divider:!0});return n}function Hc(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var Xe=x`
110
110
  :where([popover]) { margin: 0; padding: 0; border: 0; color: inherit; background: none; overflow: visible; }
111
- `,ao=8,dt,ta,ia,ra,Zi,$e=class{constructor(){p(this,dt,null);p(this,ta,null);p(this,ia,{});p(this,ra,"");p(this,Zi,()=>this.place())}get active(){return!!r(this,dt)}open(n,e,t={}){if(!n||!e||typeof n.showPopover!="function")return!1;r(this,dt)&&r(this,dt)!==n&&this.close(),n.hasAttribute("popover")||n.setAttribute("popover","manual");let i=n.matches(":popover-open");if(!i){if(getComputedStyle(n).position==="static")return n.removeAttribute("popover"),!1;try{n.showPopover()}catch{return!1}}return n.matches(":popover-open")?(r(this,dt)||f(this,ra,n.style.maxHeight),f(this,dt,n),f(this,ta,e),f(this,ia,t),Object.assign(n.style,{position:"fixed",inset:"auto",margin:"0"}),this.place(),i||(window.addEventListener("scroll",r(this,Zi),!0),window.addEventListener("resize",r(this,Zi))),!0):!1}place(){let n=r(this,dt),e=r(this,ta);if(!n||!e)return;let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,a=document.documentElement.clientHeight,l=r(this,ia).gap??4,d=r(this,ia).align??"start";n.style.maxHeight=r(this,ra),d==="stretch"&&(n.style.minWidth=`${Math.round(t.width)}px`);let m=n.getBoundingClientRect(),u=m.width,v=m.height,g=getComputedStyle(e).direction==="rtl",w=g?t.right-u:t.left,y=g?t.left:t.right-u,k=d==="end"?y:w;k+u>i-ao&&(k=g?w:y);let L=Math.max(0,Math.min(ao,t.left)),A=Math.min(i,Math.max(i-ao,t.right))-u;k=Math.max(L,Math.min(k,A));let O=a-t.bottom-l-ao,B=t.top-l-ao,K;if(v<=O||O>=B)K=t.bottom+l,v>O&&(n.style.maxHeight=`${Math.max(80,Math.floor(O))}px`);else{let Ye=Math.min(v,Math.floor(B));v>B&&(n.style.maxHeight=`${Math.max(80,Ye)}px`),K=t.top-l-Ye}n.style.left=`${k}px`,n.style.top=`${K}px`}close(){let n=r(this,dt);if(window.removeEventListener("scroll",r(this,Zi),!0),window.removeEventListener("resize",r(this,Zi)),f(this,dt,null),f(this,ta,null),!!n){try{n.matches(":popover-open")&&n.hidePopover()}catch{}for(let e of["position","inset","margin","left","top","minWidth"])n.style[e]="";n.style.maxHeight=r(this,ra)}}};dt=new WeakMap,ta=new WeakMap,ia=new WeakMap,ra=new WeakMap,Zi=new WeakMap;var aa=class extends T{constructor(){super(...arguments);this.size="large"}render(){let e=this.size==="small"?2.5:3;return c`<span class="spinner" part="spinner" role="status">
112
- <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
111
+ `,ao=8,dt,ta,ia,ra,Zi,$e=class{constructor(){p(this,dt,null);p(this,ta,null);p(this,ia,{});p(this,ra,"");p(this,Zi,()=>this.place())}get active(){return!!r(this,dt)}open(n,e,t={}){if(!n||!e||typeof n.showPopover!="function")return!1;r(this,dt)&&r(this,dt)!==n&&this.close(),n.hasAttribute("popover")||n.setAttribute("popover","manual");let i=n.matches(":popover-open");if(!i){if(getComputedStyle(n).position==="static")return n.removeAttribute("popover"),!1;try{n.showPopover()}catch{return!1}}return n.matches(":popover-open")?(r(this,dt)||f(this,ra,n.style.maxHeight),f(this,dt,n),f(this,ta,e),f(this,ia,t),Object.assign(n.style,{position:"fixed",inset:"auto",margin:"0"}),this.place(),i||(window.addEventListener("scroll",r(this,Zi),!0),window.addEventListener("resize",r(this,Zi))),!0):!1}place(){let n=r(this,dt),e=r(this,ta);if(!n||!e)return;let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,a=document.documentElement.clientHeight,l=r(this,ia).gap??4,d=r(this,ia).align??"start";n.style.maxHeight=r(this,ra),d==="stretch"&&(n.style.minWidth=`${Math.round(t.width)}px`);let m=n.getBoundingClientRect(),u=m.width,v=m.height,g=getComputedStyle(e).direction==="rtl",w=g?t.right-u:t.left,y=g?t.left:t.right-u,k=d==="end"?y:w;k+u>i-ao&&(k=g?w:y);let L=Math.max(0,Math.min(ao,t.left)),A=Math.min(i,Math.max(i-ao,t.right))-u;k=Math.max(L,Math.min(k,A));let O=a-t.bottom-l-ao,B=t.top-l-ao,K;if(v<=O||O>=B)K=t.bottom+l,v>O&&(n.style.maxHeight=`${Math.max(80,Math.floor(O))}px`);else{let Ye=Math.min(v,Math.floor(B));v>B&&(n.style.maxHeight=`${Math.max(80,Ye)}px`),K=t.top-l-Ye}n.style.left=`${k}px`,n.style.top=`${K}px`}close(){let n=r(this,dt);if(window.removeEventListener("scroll",r(this,Zi),!0),window.removeEventListener("resize",r(this,Zi)),f(this,dt,null),f(this,ta,null),!!n){try{n.matches(":popover-open")&&n.hidePopover()}catch{}for(let e of["position","inset","margin","left","top","minWidth"])n.style[e]="";n.style.maxHeight=r(this,ra)}}};dt=new WeakMap,ta=new WeakMap,ia=new WeakMap,ra=new WeakMap,Zi=new WeakMap;var aa=class extends T{constructor(){super(...arguments);this.size="large";this.custom=!1}onSlotChange(e){let t=e.target.assignedElements().length>0;t!==this.custom&&(this.custom=t,this.requestUpdate())}render(){let e=this.size==="small"?2.5:3;return c`<span class="spinner" part="spinner" role="status">
112
+ ${this.custom?h:c`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
113
113
  <circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${e}></circle>
114
114
  <path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${e} stroke-linecap="round"></path>
115
- </svg>
115
+ </svg>`}
116
+ <slot @slotchange=${this.onSlotChange}></slot>
116
117
  <span class="vh">${this.accessibleLabel||this.t("loading")}</span>
117
118
  </span>`}};aa.properties={size:{reflect:!0},accessibleLabel:{attribute:"accessible-label",string:"loading"}},aa.styles=[E,x`
118
119
  :host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
119
- .spinner { display: inline-flex; }
120
+ .spinner { display: inline-flex; align-items: center; --cm-spinner-duration: 0.8s; --cm-spinner-play-state: running; }
121
+ ::slotted(*) { display: block; block-size: 20px; inline-size: auto; }
122
+ :host([size='small']) ::slotted(*) { block-size: 12px; }
120
123
  svg { inline-size: 44px; block-size: 44px; animation: spin 0.8s linear infinite; }
121
124
  :host([size='small']) svg { inline-size: 20px; block-size: 20px; }
122
125
  .track { stroke: var(--cm-border-subtle); }
@@ -126,7 +129,10 @@ var Ju=o=>{throw TypeError(o)};var lm=(o,n,e)=>n.has(o)||Ju("Cannot "+e);var r=(
126
129
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
127
130
  }
128
131
  @keyframes spin { to { transform: rotate(360deg); } }
129
- @media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
132
+ @media (prefers-reduced-motion: reduce) {
133
+ svg { animation-duration: 2.4s; }
134
+ .spinner { --cm-spinner-play-state: paused; }
135
+ }
130
136
  `];$("cm-spinner",aa);var Jx=z("actionMenu",{label:"Actions"}),so,Qi,er,no,U,Nc,oo,Ic,Pc,Oc,qc,wg,na,oa,la,sa,Bc,$g,km,kg,xt=class extends T{constructor(){super(...arguments);p(this,U);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this.loading=!1;this.disabled=!1;this._slotted=[];this._active=-1;this._custom=!1;p(this,so);p(this,Qi,R("cm-menu"));p(this,er,"");p(this,no,0);p(this,oo,e=>{this.open&&!e.composedPath().includes(this)&&s(this,U,Oc).call(this,!1)});p(this,na,new $e);p(this,oa,e=>{this.disabled||(e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0)))});p(this,la,()=>{this.disabled||(this.open?this.hide():this.show())});p(this,Bc,e=>{let t=s(this,U,Pc).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),s(this,U,sa).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),s(this,U,sa).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),s(this,U,sa).call(this,t[0]);break;case"End":e.preventDefault(),s(this,U,sa).call(this,t[t.length-1]);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.hide(!0);break;case"Tab":this.hide();break;default:if(e.key.length===1&&/\S/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let a=Date.now();f(this,er,(a-r(this,no)<600?r(this,er):"")+e.key.toLowerCase()),f(this,no,a);let l=this.menuItems,d=r(this,er).length>1?i:i+1,u=[...t.slice(Math.max(d,0)),...t.slice(0,Math.max(d,0))].find(v=>(l[v].label??"").toLowerCase().startsWith(r(this,er)));u!==void 0&&s(this,U,sa).call(this,u)}}})}connectedCallback(){super.connectedCallback(),s(this,U,Nc).call(this),f(this,so,Hc(this,()=>s(this,U,Nc).call(this))),document.addEventListener("pointerdown",r(this,oo),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,so)?.disconnect(),document.removeEventListener("pointerdown",r(this,oo),!0),r(this,na).close()}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=s(this,U,Pc).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,s(this,U,Oc).call(this,!0),this.updateComplete.then(()=>s(this,U,qc).call(this))}hide(e=!1){s(this,U,Oc).call(this,!1),e&&s(this,U,Ic).call(this)?.focus()}updated(e){if(e.has("open")&&this.open&&s(this,U,wg).call(this),e.has("open")&&!this.open&&r(this,na).close(),this._custom){let t=s(this,U,Ic).call(this);if(t){let i=(a,l)=>{t.getAttribute(a)!==l&&t.setAttribute(a,l)};i("aria-haspopup","menu"),i("aria-expanded",String(this.open)),i("aria-controls",`${r(this,Qi)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=s(this,U,Pc).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>s(this,U,qc).call(this))}}triggerTemplate(e,t){}headTemplate(){}render(){let e=this.menuItems,t=this.triggerLabel||this.label,i=this._custom?c`<slot name="trigger" @click=${r(this,la)} @keydown=${r(this,oa)} @slotchange=${()=>s(this,U,Nc).call(this)}></slot>`:this.triggerTemplate(r(this,la),r(this,oa))??c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
131
137
  aria-expanded=${String(this.open)} aria-controls="${r(this,Qi)}-m" aria-label=${this.iconOnly?t:h}
132
138
  ?disabled=${this.disabled} @click=${r(this,la)} @keydown=${r(this,oa)}>${this.iconOnly?c`<cm-icon name=${this.icon} size="18"></cm-icon>`:c`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return c`${i}
@@ -1383,6 +1389,7 @@ var Ju=o=>{throw TypeError(o)};var lm=(o,n,e)=>n.has(o)||Ju("Cannot "+e);var r=(
1383
1389
  nav [aria-current] { color: var(--cm-text-default); }
1384
1390
  h1 {
1385
1391
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-4) var(--cm-space-8); margin: 0; min-width: 0;
1392
+ font-family: var(--cm-font-display, inherit);
1386
1393
  font-size: var(--cm-type-heading-lg-size); font-weight: var(--cm-type-heading-lg-weight); line-height: var(--cm-type-heading-lg-line-height);
1387
1394
  }
1388
1395
  /* Badges in title-adornment wrap below the title only when title and badges don't fit on one line (flex-wrap breaks
@@ -1985,7 +1992,7 @@ var Ju=o=>{throw TypeError(o)};var lm=(o,n,e)=>n.has(o)||Ju("Cannot "+e);var r=(
1985
1992
  }
1986
1993
  button:hover:not(:disabled) { color: var(--cm-text-default); }
1987
1994
  button[aria-selected='true'] { color: var(--cm-text-default); font-weight: 600; }
1988
- button[aria-selected='true']::after { background: var(--cm-border-strong); }
1995
+ button[aria-selected='true']::after { background: var(--cm-tab-indicator); }
1989
1996
  /* The chosen tab's bold label takes no extra room: each label reserves the width of its bold version. */
1990
1997
  .label { display: inline-grid; }
1991
1998
  .label::after { content: attr(data-text); content: attr(data-text) / ''; font-weight: 600; block-size: 0; overflow: hidden; visibility: hidden; }
@@ -2381,7 +2388,8 @@ cm-data-table:has(> table) { container-type: inline-size; }
2381
2388
  font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
2382
2389
  }
2383
2390
  @media (pointer: coarse) { .row { min-height: max(var(--cm-resource-row-height, 56px), var(--cm-control-height-touch, 44px)); } }
2384
- :host(:hover:not([disabled])) .row, :host([selected]) .row { background: var(--cm-bg-hover); }
2391
+ :host(:hover:not([disabled])) .row { background: var(--cm-bg-hover); }
2392
+ :host([selected]) .row { background: var(--cm-bg-selected); }
2385
2393
  :host([selectable]:not([href]):not([disabled])) .row { cursor: pointer; }
2386
2394
  :host([disabled]) .row { color: var(--cm-text-tertiary); }
2387
2395
  .media { display: contents; }
@@ -3050,7 +3058,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
3050
3058
  .badge {
3051
3059
  flex: none; box-sizing: border-box; min-inline-size: var(--cm-space-20); padding: 0 var(--cm-space-4); text-align: center;
3052
3060
  border-radius: var(--cm-radius-full); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500;
3053
- font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
3061
+ font-variant-numeric: tabular-nums; color: var(--cm-count-text); background: var(--cm-count-bg);
3054
3062
  }
3055
3063
  .sub { padding: 0 0 var(--cm-space-4); }
3056
3064
  .sub .item { min-height: var(--cm-control-height-sm); padding-inline-start: calc(var(--cm-space-12) + var(--cm-icon-size-md) + var(--cm-space-8)); }
@@ -3068,9 +3076,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
3068
3076
  .initial { display: grid; place-items: center; width: var(--cm-icon-size-md); height: var(--cm-icon-size-md); font-size: var(--cm-font-size-14); font-weight: 600; }
3069
3077
  .dot {
3070
3078
  position: absolute; inset-block-start: 6px; inset-inline-start: calc(50% + 4px); min-width: 8px; height: 8px; border-radius: var(--cm-radius-full);
3071
- background: var(--cm-nav-badge); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
3079
+ background: var(--cm-count-bg); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
3072
3080
  }
3073
- .dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); }
3081
+ .dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-count-text); }
3074
3082
  `];$("cm-side-navigation",sn);function $v(o){let n=o.trim().split(/[\s._@-]+/).filter(Boolean);if(!n.length)return"";let e=[...n[0]][0]??"",t=n.length>1&&!/[.@]/.test(o)?[...n[n.length-1]][0]??"":"";return(e+t).toLocaleUpperCase()}var nn=class extends S{constructor(){super(...arguments);this.name="";this.src="";this.size="medium";this.shape="round";this.decorative=!1;this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){let e=$v(this.name),t=this.decorative||!this.name?h:this.name,i=this.decorative||!this.name?"true":h,a,l="avatar";return this.src&&!this._failed?a=c`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?a=c`<span aria-hidden="true">${e}</span>`:(l+=" icon",a=c`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),c`<span class=${l} part="avatar" role=${t===h?h:"img"} aria-label=${t} aria-hidden=${i}>${a}</span>`}};nn.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},nn.styles=[E,x`
3075
3083
  :host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
3076
3084
  :host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
@@ -3259,7 +3267,7 @@ ${t.label}</button>
3259
3267
  .chev { color: var(--cm-icon-selected); }
3260
3268
  .badge {
3261
3269
  flex: none; padding: 2px var(--cm-space-8); border-radius: var(--cm-radius-full); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500;
3262
- font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
3270
+ font-variant-numeric: tabular-nums; color: var(--cm-count-text); background: var(--cm-count-bg);
3263
3271
  }
3264
3272
  .action { justify-content: center; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
3265
3273
  .eyebrow { display: block; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 400; color: var(--cm-text-tertiary); }
@@ -3321,7 +3329,7 @@ ${t.label}</button>
3321
3329
  a::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; border-radius: var(--cm-radius-full); background: transparent; }
3322
3330
  a:hover { color: var(--cm-text-default); }
3323
3331
  a[aria-current='page'] { color: var(--cm-text-default); }
3324
- a[aria-current='page']::after { background: var(--cm-border-strong); }
3332
+ a[aria-current='page']::after { background: var(--cm-tab-indicator); }
3325
3333
  a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
3326
3334
  .badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
3327
3335
  @media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
@@ -3655,6 +3663,11 @@ ${t.label}</button>
3655
3663
  font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500; font-variant-numeric: tabular-nums;
3656
3664
  border-radius: var(--cm-radius-full); background: var(--cm-bg-tag); color: var(--cm-text-default);
3657
3665
  }
3666
+ /* Toned badges start with a dot in the tone's colour when --cm-badge-dot is above 0 (the refined look, 1.11). */
3667
+ :host([tone]:not([tone='neutral'])) span::before {
3668
+ content: ''; flex: none; inline-size: var(--cm-badge-dot, 0px); block-size: var(--cm-badge-dot, 0px);
3669
+ margin-inline-end: var(--cm-badge-dot, 0px); border-radius: var(--cm-radius-full); background: currentColor;
3670
+ }
3658
3671
  /* Tinted tones are laid over the surface colour, so the text keeps AA contrast on any page background. */
3659
3672
  :host([tone='information']) span { background: linear-gradient(var(--cm-bg-information-soft), var(--cm-bg-information-soft)), var(--cm-bg-surface); color: var(--cm-text-information); }
3660
3673
  :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); }
@@ -27,6 +27,11 @@ CmBadge.styles = [
27
27
  font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500; font-variant-numeric: tabular-nums;
28
28
  border-radius: var(--cm-radius-full); background: var(--cm-bg-tag); color: var(--cm-text-default);
29
29
  }
30
+ /* Toned badges start with a dot in the tone's colour when --cm-badge-dot is above 0 (the refined look, 1.11). */
31
+ :host([tone]:not([tone='neutral'])) span::before {
32
+ content: ''; flex: none; inline-size: var(--cm-badge-dot, 0px); block-size: var(--cm-badge-dot, 0px);
33
+ margin-inline-end: var(--cm-badge-dot, 0px); border-radius: var(--cm-radius-full); background: currentColor;
34
+ }
30
35
  /* Tinted tones are laid over the surface colour, so the text keeps AA contrast on any page background. */
31
36
  :host([tone='information']) span { background: linear-gradient(var(--cm-bg-information-soft), var(--cm-bg-information-soft)), var(--cm-bg-surface); color: var(--cm-text-information); }
32
37
  :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); }
@@ -202,7 +202,7 @@ CmButton.styles = [
202
202
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
203
203
  min-width: 16px; height: 16px; padding: 0 var(--cm-space-4); border-radius: var(--cm-radius-full);
204
204
  font-size: var(--cm-font-size-12); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums;
205
- color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
205
+ color: var(--cm-count-text); background: var(--cm-count-bg);
206
206
  }
207
207
  :host([icon-only]) .count {
208
208
  position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
@@ -79,7 +79,7 @@ CmLinkTabs.styles = [
79
79
  a::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; border-radius: var(--cm-radius-full); background: transparent; }
80
80
  a:hover { color: var(--cm-text-default); }
81
81
  a[aria-current='page'] { color: var(--cm-text-default); }
82
- a[aria-current='page']::after { background: var(--cm-border-strong); }
82
+ a[aria-current='page']::after { background: var(--cm-tab-indicator); }
83
83
  a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
84
84
  .badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
85
85
  @media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
@@ -169,7 +169,7 @@ CmMobileMenu.styles = [
169
169
  .chev { color: var(--cm-icon-selected); }
170
170
  .badge {
171
171
  flex: none; padding: 2px var(--cm-space-8); border-radius: var(--cm-radius-full); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500;
172
- font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
172
+ font-variant-numeric: tabular-nums; color: var(--cm-count-text); background: var(--cm-count-bg);
173
173
  }
174
174
  .action { justify-content: center; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
175
175
  .eyebrow { display: block; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 400; color: var(--cm-text-tertiary); }
@@ -134,6 +134,7 @@ CmPageHeader.styles = [
134
134
  nav [aria-current] { color: var(--cm-text-default); }
135
135
  h1 {
136
136
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-4) var(--cm-space-8); margin: 0; min-width: 0;
137
+ font-family: var(--cm-font-display, inherit);
137
138
  font-size: var(--cm-type-heading-lg-size); font-weight: var(--cm-type-heading-lg-weight); line-height: var(--cm-type-heading-lg-line-height);
138
139
  }
139
140
  /* Badges in title-adornment wrap below the title only when title and badges don't fit on one line (flex-wrap breaks
@@ -170,7 +170,8 @@ CmResourceItem.styles = [
170
170
  font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
171
171
  }
172
172
  @media (pointer: coarse) { .row { min-height: max(var(--cm-resource-row-height, 56px), var(--cm-control-height-touch, 44px)); } }
173
- :host(:hover:not([disabled])) .row, :host([selected]) .row { background: var(--cm-bg-hover); }
173
+ :host(:hover:not([disabled])) .row { background: var(--cm-bg-hover); }
174
+ :host([selected]) .row { background: var(--cm-bg-selected); }
174
175
  :host([selectable]:not([href]):not([disabled])) .row { cursor: pointer; }
175
176
  :host([disabled]) .row { color: var(--cm-text-tertiary); }
176
177
  .media { display: contents; }
@@ -248,7 +248,7 @@ CmSideNavigation.styles = [
248
248
  .badge {
249
249
  flex: none; box-sizing: border-box; min-inline-size: var(--cm-space-20); padding: 0 var(--cm-space-4); text-align: center;
250
250
  border-radius: var(--cm-radius-full); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500;
251
- font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
251
+ font-variant-numeric: tabular-nums; color: var(--cm-count-text); background: var(--cm-count-bg);
252
252
  }
253
253
  .sub { padding: 0 0 var(--cm-space-4); }
254
254
  .sub .item { min-height: var(--cm-control-height-sm); padding-inline-start: calc(var(--cm-space-12) + var(--cm-icon-size-md) + var(--cm-space-8)); }
@@ -266,9 +266,9 @@ CmSideNavigation.styles = [
266
266
  .initial { display: grid; place-items: center; width: var(--cm-icon-size-md); height: var(--cm-icon-size-md); font-size: var(--cm-font-size-14); font-weight: 600; }
267
267
  .dot {
268
268
  position: absolute; inset-block-start: 6px; inset-inline-start: calc(50% + 4px); min-width: 8px; height: 8px; border-radius: var(--cm-radius-full);
269
- background: var(--cm-nav-badge); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
269
+ background: var(--cm-count-bg); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
270
270
  }
271
- .dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); }
271
+ .dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-count-text); }
272
272
  `,
273
273
  ];
274
274
  define('cm-side-navigation', CmSideNavigation);
@@ -2,7 +2,15 @@ import { CmLocalizedElement } from '../localize.js';
2
2
  /**
3
3
  * Shows that something is loading when the wait is short or its length unknown. Announced to screen readers
4
4
  * through a status role with a text label.
5
+ *
6
+ * A product can show its own loading graphic instead of the arc by putting it inside (since 1.12). The spinner
7
+ * keeps the status role, the label and the size, and passes `--cm-spinner-duration` (one cycle) and
8
+ * `--cm-spinner-play-state` (`paused` under reduced motion) to the graphic, which animates itself with them.
5
9
  * @element cm-spinner
10
+ * @slot - Optional graphic shown instead of the arc, such as an inline SVG. Decorative: give it `aria-hidden="true"`.
11
+ * Drawn 12px tall (`small`) or 20px (`large`) with its own width; colour it with `currentColor`.
12
+ * @cssprop --cm-spinner-duration - One animation cycle for a slotted graphic. Default 0.8s.
13
+ * @cssprop --cm-spinner-play-state - `running`, or `paused` when the person prefers reduced motion.
6
14
  */
7
15
  export declare class CmSpinner extends CmLocalizedElement {
8
16
  static properties: {
@@ -18,7 +26,10 @@ export declare class CmSpinner extends CmLocalizedElement {
18
26
  size: 'small' | 'large';
19
27
  /** What screen readers announce. Name what is loading when it helps: "Loading orders". Default: the built-in string `loading` ("Loading"). */
20
28
  accessibleLabel: string;
29
+ /** True while a graphic is slotted in place of the arc. */
30
+ private custom;
21
31
  static styles: import("lit").CSSResult[];
32
+ private onSlotChange;
22
33
  render(): import("lit-html").TemplateResult<1>;
23
34
  }
24
35
  declare global {
@@ -1,24 +1,42 @@
1
- import { html, css } from 'lit';
1
+ import { html, css, nothing } from 'lit';
2
2
  import { base, define } from '../base.js';
3
3
  import { CmLocalizedElement } from '../localize.js';
4
4
  /**
5
5
  * Shows that something is loading when the wait is short or its length unknown. Announced to screen readers
6
6
  * through a status role with a text label.
7
+ *
8
+ * A product can show its own loading graphic instead of the arc by putting it inside (since 1.12). The spinner
9
+ * keeps the status role, the label and the size, and passes `--cm-spinner-duration` (one cycle) and
10
+ * `--cm-spinner-play-state` (`paused` under reduced motion) to the graphic, which animates itself with them.
7
11
  * @element cm-spinner
12
+ * @slot - Optional graphic shown instead of the arc, such as an inline SVG. Decorative: give it `aria-hidden="true"`.
13
+ * Drawn 12px tall (`small`) or 20px (`large`) with its own width; colour it with `currentColor`.
14
+ * @cssprop --cm-spinner-duration - One animation cycle for a slotted graphic. Default 0.8s.
15
+ * @cssprop --cm-spinner-play-state - `running`, or `paused` when the person prefers reduced motion.
8
16
  */
9
17
  export class CmSpinner extends CmLocalizedElement {
10
18
  constructor() {
11
19
  super(...arguments);
12
20
  /** `small` (20px) for inline use in buttons, rows and fields; `large` (44px) for a section or page. */
13
21
  this.size = 'large';
22
+ /** True while a graphic is slotted in place of the arc. */
23
+ this.custom = false;
24
+ }
25
+ onSlotChange(e) {
26
+ const has = e.target.assignedElements().length > 0;
27
+ if (has !== this.custom) {
28
+ this.custom = has;
29
+ this.requestUpdate();
30
+ }
14
31
  }
15
32
  render() {
16
33
  const sw = this.size === 'small' ? 2.5 : 3;
17
34
  return html `<span class="spinner" part="spinner" role="status">
18
- <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
35
+ ${this.custom ? nothing : html `<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
19
36
  <circle class="track" cx="12" cy="12" r="10" fill="none" stroke-width=${sw}></circle>
20
37
  <path class="arc" d="M12 2a10 10 0 0 1 10 10" fill="none" stroke-width=${sw} stroke-linecap="round"></path>
21
- </svg>
38
+ </svg>`}
39
+ <slot @slotchange=${this.onSlotChange}></slot>
22
40
  <span class="vh">${this.accessibleLabel || this.t('loading')}</span>
23
41
  </span>`;
24
42
  }
@@ -31,7 +49,9 @@ CmSpinner.styles = [
31
49
  base,
32
50
  css `
33
51
  :host { display: inline-flex; vertical-align: middle; color: var(--cm-border-strong); }
34
- .spinner { display: inline-flex; }
52
+ .spinner { display: inline-flex; align-items: center; --cm-spinner-duration: 0.8s; --cm-spinner-play-state: running; }
53
+ ::slotted(*) { display: block; block-size: 20px; inline-size: auto; }
54
+ :host([size='small']) ::slotted(*) { block-size: 12px; }
35
55
  svg { inline-size: 44px; block-size: 44px; animation: spin 0.8s linear infinite; }
36
56
  :host([size='small']) svg { inline-size: 20px; block-size: 20px; }
37
57
  .track { stroke: var(--cm-border-subtle); }
@@ -41,7 +61,10 @@ CmSpinner.styles = [
41
61
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
42
62
  }
43
63
  @keyframes spin { to { transform: rotate(360deg); } }
44
- @media (prefers-reduced-motion: reduce) { svg { animation-duration: 2.4s; } }
64
+ @media (prefers-reduced-motion: reduce) {
65
+ svg { animation-duration: 2.4s; }
66
+ .spinner { --cm-spinner-play-state: paused; }
67
+ }
45
68
  `,
46
69
  ];
47
70
  define('cm-spinner', CmSpinner);
@@ -212,7 +212,7 @@ CmStatusTabs.styles = [
212
212
  }
213
213
  button:hover:not(:disabled) { color: var(--cm-text-default); }
214
214
  button[aria-selected='true'] { color: var(--cm-text-default); font-weight: 600; }
215
- button[aria-selected='true']::after { background: var(--cm-border-strong); }
215
+ button[aria-selected='true']::after { background: var(--cm-tab-indicator); }
216
216
  /* The chosen tab's bold label takes no extra room: each label reserves the width of its bold version. */
217
217
  .label { display: inline-grid; }
218
218
  .label::after { content: attr(data-text); content: attr(data-text) / ''; font-weight: 600; block-size: 0; overflow: hidden; visibility: hidden; }
@@ -32577,8 +32577,24 @@
32577
32577
  "declarations": [
32578
32578
  {
32579
32579
  "kind": "class",
32580
- "description": "Shows that something is loading when the wait is short or its length unknown. Announced to screen readers\nthrough a status role with a text label.",
32580
+ "description": "Shows that something is loading when the wait is short or its length unknown. Announced to screen readers\nthrough a status role with a text label.\n\nA product can show its own loading graphic instead of the arc by putting it inside (since 1.12). The spinner\nkeeps the status role, the label and the size, and passes `--cm-spinner-duration` (one cycle) and\n`--cm-spinner-play-state` (`paused` under reduced motion) to the graphic, which animates itself with them.",
32581
32581
  "name": "CmSpinner",
32582
+ "cssProperties": [
32583
+ {
32584
+ "description": "One animation cycle for a slotted graphic. Default 0.8s.",
32585
+ "name": "--cm-spinner-duration"
32586
+ },
32587
+ {
32588
+ "description": "`running`, or `paused` when the person prefers reduced motion.",
32589
+ "name": "--cm-spinner-play-state"
32590
+ }
32591
+ ],
32592
+ "slots": [
32593
+ {
32594
+ "description": "Optional graphic shown instead of the arc, such as an inline SVG. Decorative: give it `aria-hidden=\"true\"`. Drawn 12px tall (`small`) or 20px (`large`) with its own width; colour it with `currentColor`.",
32595
+ "name": ""
32596
+ }
32597
+ ],
32582
32598
  "members": [
32583
32599
  {
32584
32600
  "kind": "field",
@@ -32602,6 +32618,29 @@
32602
32618
  "description": "What screen readers announce. Name what is loading when it helps: \"Loading orders\". Default: the built-in string `loading` (\"Loading\").",
32603
32619
  "attribute": "accessible-label"
32604
32620
  },
32621
+ {
32622
+ "kind": "field",
32623
+ "name": "custom",
32624
+ "type": {
32625
+ "text": "boolean"
32626
+ },
32627
+ "privacy": "private",
32628
+ "default": "false",
32629
+ "description": "True while a graphic is slotted in place of the arc."
32630
+ },
32631
+ {
32632
+ "kind": "method",
32633
+ "name": "onSlotChange",
32634
+ "privacy": "private",
32635
+ "parameters": [
32636
+ {
32637
+ "name": "e",
32638
+ "type": {
32639
+ "text": "Event"
32640
+ }
32641
+ }
32642
+ ]
32643
+ },
32605
32644
  {
32606
32645
  "kind": "method",
32607
32646
  "name": "finalize",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commmerce/ui",
3
- "version": "1.10.1",
3
+ "version": "1.12.0",
4
4
  "description": "Commmerce UI web components: build apps that feel native to the Commmerce admin. Works in plain HTML, React, Vue and server-rendered pages.",
5
5
  "keywords": [
6
6
  "web-components",
@@ -50,8 +50,8 @@
50
50
  "test": "vitest run"
51
51
  },
52
52
  "dependencies": {
53
- "@commmerce/icons": "1.10.1",
54
- "@commmerce/tokens": "1.10.1",
53
+ "@commmerce/icons": "1.12.0",
54
+ "@commmerce/tokens": "1.12.0",
55
55
  "lit": "3.2.1"
56
56
  },
57
57
  "devDependencies": {