@commmerce/ui 1.5.1 → 1.6.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.
Files changed (65) hide show
  1. package/dist/calendar.js +2 -0
  2. package/dist/cdn.js +1018 -659
  3. package/dist/components/action-menu.d.ts +28 -1
  4. package/dist/components/action-menu.js +86 -17
  5. package/dist/components/badge.d.ts +3 -2
  6. package/dist/components/badge.js +4 -3
  7. package/dist/components/bottom-sheet.js +1 -1
  8. package/dist/components/button.d.ts +5 -1
  9. package/dist/components/button.js +18 -6
  10. package/dist/components/calendar.d.ts +6 -1
  11. package/dist/components/calendar.js +15 -1
  12. package/dist/components/card.d.ts +38 -0
  13. package/dist/components/card.js +77 -12
  14. package/dist/components/checkbox.js +7 -2
  15. package/dist/components/color-field.js +2 -0
  16. package/dist/components/combobox.d.ts +27 -2
  17. package/dist/components/combobox.js +109 -15
  18. package/dist/components/data-table.d.ts +127 -9
  19. package/dist/components/data-table.js +577 -67
  20. package/dist/components/date-picker.d.ts +1 -1
  21. package/dist/components/date-picker.js +1 -1
  22. package/dist/components/date-range-picker.d.ts +1 -1
  23. package/dist/components/date-range-picker.js +2 -2
  24. package/dist/components/empty-state.d.ts +8 -6
  25. package/dist/components/empty-state.js +26 -17
  26. package/dist/components/file-upload.d.ts +49 -4
  27. package/dist/components/file-upload.js +136 -29
  28. package/dist/components/layout.d.ts +2 -2
  29. package/dist/components/layout.js +5 -5
  30. package/dist/components/menu-item.d.ts +18 -0
  31. package/dist/components/menu-item.js +8 -0
  32. package/dist/components/page-header.d.ts +6 -0
  33. package/dist/components/page-header.js +22 -5
  34. package/dist/components/pagination.d.ts +3 -2
  35. package/dist/components/pagination.js +13 -10
  36. package/dist/components/radio.js +4 -2
  37. package/dist/components/resource-list.d.ts +28 -3
  38. package/dist/components/resource-list.js +47 -15
  39. package/dist/components/search.d.ts +2 -2
  40. package/dist/components/search.js +4 -2
  41. package/dist/components/segmented-control.js +1 -1
  42. package/dist/components/select.d.ts +11 -1
  43. package/dist/components/select.js +17 -4
  44. package/dist/components/side-navigation.d.ts +1 -1
  45. package/dist/components/side-navigation.js +5 -3
  46. package/dist/components/signature-field.js +2 -2
  47. package/dist/components/status-tabs.d.ts +24 -4
  48. package/dist/components/status-tabs.js +82 -9
  49. package/dist/components/table-header.d.ts +1 -1
  50. package/dist/components/table-header.js +3 -3
  51. package/dist/components/tag.d.ts +7 -0
  52. package/dist/components/tag.js +6 -3
  53. package/dist/components/text-field.d.ts +1 -1
  54. package/dist/components/text-field.js +3 -1
  55. package/dist/components/toggle.js +3 -1
  56. package/dist/components/tooltip.d.ts +5 -2
  57. package/dist/components/tooltip.js +14 -9
  58. package/dist/custom-elements.json +1599 -129
  59. package/dist/density.d.ts +21 -0
  60. package/dist/density.js +46 -0
  61. package/dist/field.d.ts +9 -5
  62. package/dist/field.js +16 -10
  63. package/dist/index.d.ts +1 -1
  64. package/dist/popover.js +1 -1
  65. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
1
  import { CmLocalizedElement } from '../localize.js';
2
2
  import './icon.js';
3
+ import './spinner.js';
3
4
  declare const strings: {
4
5
  /** Validation message when `required` and nothing is chosen. */
5
6
  required: string;
@@ -77,6 +78,10 @@ export declare class CmSelect extends CmLocalizedElement {
77
78
  size: {
78
79
  reflect: boolean;
79
80
  };
81
+ loading: {
82
+ type: BooleanConstructor;
83
+ reflect: boolean;
84
+ };
80
85
  _active: {
81
86
  state: boolean;
82
87
  };
@@ -110,10 +115,15 @@ export declare class CmSelect extends CmLocalizedElement {
110
115
  */
111
116
  showGroup: boolean;
112
117
  /**
113
- * `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 36px box. On touch
118
+ * `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 40px box (since 1.6, owner standard; was 36px). On touch
114
119
  * screens both are 44px. Since 1.5.
115
120
  */
116
121
  size: 'default' | 'small';
122
+ /**
123
+ * Shows a spinner in place of the chevron while you load the options (the box is `aria-busy`); the list doesn't
124
+ * open until it is cleared. For options fetched as the merchant types, use `cm-combobox`. Since 1.6.
125
+ */
126
+ loading: boolean;
117
127
  _active: number;
118
128
  _slotted: SelectOption[];
119
129
  static styles: import("lit").CSSResult[];
@@ -16,6 +16,7 @@ import { CmLocalizedElement, defineStrings } from '../localize.js';
16
16
  import { groupStyles, sortByGroup, groupRuns } from '../popover.js';
17
17
  import { fieldStyles, optionStyles } from '../field.js';
18
18
  import './icon.js';
19
+ import './spinner.js';
19
20
  const strings = defineStrings('select', {
20
21
  /** Validation message when `required` and nothing is chosen. */
21
22
  required: 'Please select an item in the list.',
@@ -64,10 +65,15 @@ export class CmSelect extends CmLocalizedElement {
64
65
  */
65
66
  this.showGroup = false;
66
67
  /**
67
- * `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 36px box. On touch
68
+ * `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 40px box (since 1.6, owner standard; was 36px). On touch
68
69
  * screens both are 44px. Since 1.5.
69
70
  */
70
71
  this.size = 'default';
72
+ /**
73
+ * Shows a spinner in place of the chevron while you load the options (the box is `aria-busy`); the list doesn't
74
+ * open until it is cleared. For options fetched as the merchant types, use `cm-combobox`. Since 1.6.
75
+ */
76
+ this.loading = false;
71
77
  this._active = -1;
72
78
  this._slotted = [];
73
79
  _CmSelect_internals.set(this, this.attachInternals());
@@ -232,10 +238,12 @@ export class CmSelect extends CmLocalizedElement {
232
238
  aria-haspopup="listbox" aria-expanded=${this.open ? 'true' : 'false'} aria-controls="${__classPrivateFieldGet(this, _CmSelect_id, "f")}-list"
233
239
  aria-activedescendant=${this.open && this._active >= 0 ? `${__classPrivateFieldGet(this, _CmSelect_id, "f")}-o${this._active}` : nothing}
234
240
  aria-required=${this.required ? 'true' : nothing} aria-invalid=${this.error ? 'true' : nothing}
235
- aria-disabled=${this.disabled ? 'true' : nothing} aria-describedby=${described || nothing}
241
+ aria-disabled=${this.disabled ? 'true' : nothing} aria-describedby=${described || nothing} aria-busy=${this.loading ? 'true' : nothing}
236
242
  @click=${__classPrivateFieldGet(this, _CmSelect_onBoxClick, "f")} @keydown=${__classPrivateFieldGet(this, _CmSelect_onKeyDown, "f")} @blur=${() => __classPrivateFieldGet(this, _CmSelect_instances, "m", _CmSelect_hide).call(this)}>
237
243
  <span class="text ${current ? '' : 'placeholder'}" id="${__classPrivateFieldGet(this, _CmSelect_id, "f")}-v">${current ? __classPrivateFieldGet(this, _CmSelect_instances, "m", _CmSelect_display).call(this, current) : this.placeholder}</span>
238
- <cm-icon class="chev" name="chevron-down" size="16"></cm-icon>
244
+ ${this.loading
245
+ ? html `<span class="spin"><cm-spinner size="small" aria-hidden="true"></cm-spinner></span>`
246
+ : html `<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
239
247
  </div>
240
248
  <ul role="listbox" id="${__classPrivateFieldGet(this, _CmSelect_id, "f")}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label ? `${__classPrivateFieldGet(this, _CmSelect_id, "f")}-l` : nothing}
241
249
  aria-label=${!this.label && hostLabel ? hostLabel : nothing} ?hidden=${!this.open}
@@ -266,7 +274,7 @@ _CmSelect_internals = new WeakMap(), _CmSelect_id = new WeakMap(), _CmSelect_def
266
274
  __classPrivateFieldSet(this, _CmSelect_defaultValue, this.value, "f");
267
275
  }
268
276
  }, _CmSelect_enabledIndexes = function _CmSelect_enabledIndexes() { return this.items.flatMap((o, i) => (o.disabled ? [] : [i])); }, _CmSelect_show = function _CmSelect_show(active) {
269
- if (this.disabled)
277
+ if (this.disabled || this.loading)
270
278
  return;
271
279
  const sel = this.items.findIndex((o) => o.value === this.value);
272
280
  this.open = true;
@@ -325,6 +333,7 @@ CmSelect.properties = {
325
333
  open: { type: Boolean, reflect: true },
326
334
  showGroup: { type: Boolean, attribute: 'show-group' },
327
335
  size: { reflect: true },
336
+ loading: { type: Boolean, reflect: true },
328
337
  _active: { state: true },
329
338
  _slotted: { state: true },
330
339
  };
@@ -343,9 +352,13 @@ CmSelect.styles = [
343
352
  font-size: var(--_cm-field-font); line-height: var(--cm-line-height-14); color: var(--cm-text-default); background: var(--cm-bg-surface); cursor: pointer;
344
353
  border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm); outline: none; user-select: none;
345
354
  }
355
+ /* Hover (1.6): the outline darkens; focus adds the 2px ring. */
356
+ :host(:not([disabled])) .box:hover { border-color: var(--cm-border-strong); }
346
357
  .box:focus-visible, :host([open]) .box { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
347
358
  .text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
348
359
  .placeholder { color: var(--cm-text-tertiary); }
360
+ .spin { flex: none; display: inline-flex; }
361
+ :host([loading]) .box { cursor: progress; }
349
362
  .chev { flex: none; color: var(--cm-icon-selected); transition: transform var(--cm-duration-fast) var(--cm-easing-standard); }
350
363
  :host([open]) .chev { transform: rotate(180deg); }
351
364
  :host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
@@ -33,7 +33,7 @@ declare module '../localize.js' {
33
33
  * @fires cm-navigate - When an item is chosen. `detail: { item, value, href }`. Cancelable: call `preventDefault()` to route in your app instead of following the link.
34
34
  * @fires cm-expand - When a section opens or closes. `detail: { item, expanded }`.
35
35
  * @fires cm-collapse - When the merchant collapses the menu to icons or expands it again: from the built-in button (`collapsible`), or by choosing a section while collapsed (that expands the menu and opens the section). `detail: { collapsed }`. Cancelable: call `preventDefault()` to keep the current state. Not fired when you set `collapsed` yourself.
36
- * @cssprop --cm-side-navigation-width - Width of the full menu. Default `250px`.
36
+ * @cssprop --cm-side-navigation-width - Width of the full menu. Default `220px` (owner standard, 1.6; was 250px).
37
37
  * @cssprop --cm-side-navigation-collapsed-width - Width of the icon rail (`collapsed`). Default `72px`.
38
38
  */
39
39
  export declare class CmSideNavigation extends CmLocalizedElement {
@@ -42,7 +42,7 @@ const strings = defineStrings('sideNavigation', {
42
42
  * @fires cm-navigate - When an item is chosen. `detail: { item, value, href }`. Cancelable: call `preventDefault()` to route in your app instead of following the link.
43
43
  * @fires cm-expand - When a section opens or closes. `detail: { item, expanded }`.
44
44
  * @fires cm-collapse - When the merchant collapses the menu to icons or expands it again: from the built-in button (`collapsible`), or by choosing a section while collapsed (that expands the menu and opens the section). `detail: { collapsed }`. Cancelable: call `preventDefault()` to keep the current state. Not fired when you set `collapsed` yourself.
45
- * @cssprop --cm-side-navigation-width - Width of the full menu. Default `250px`.
45
+ * @cssprop --cm-side-navigation-width - Width of the full menu. Default `220px` (owner standard, 1.6; was 250px).
46
46
  * @cssprop --cm-side-navigation-collapsed-width - Width of the icon rail (`collapsed`). Default `72px`.
47
47
  */
48
48
  export class CmSideNavigation extends CmLocalizedElement {
@@ -223,7 +223,7 @@ CmSideNavigation.properties = {
223
223
  CmSideNavigation.styles = [
224
224
  base,
225
225
  css `
226
- :host { display: block; width: var(--cm-side-navigation-width, 250px); }
226
+ :host { display: block; width: var(--cm-side-navigation-width, 220px); }
227
227
  nav {
228
228
  background: var(--cm-bg-dashboard); color: var(--cm-text-on-dark-secondary); border-radius: var(--cm-radius-lg);
229
229
  padding: var(--cm-space-12) 0; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
@@ -231,10 +231,12 @@ CmSideNavigation.styles = [
231
231
  ul { list-style: none; margin: 0; padding: 0; }
232
232
  .item {
233
233
  display: flex; align-items: center; gap: var(--cm-space-8); box-sizing: border-box; width: calc(100% - 2 * var(--cm-space-8));
234
- min-height: var(--cm-control-height-md); margin: 0 var(--cm-space-8); padding-block: 0; padding-inline: var(--cm-space-12) var(--cm-space-8);
234
+ min-height: var(--cm-control-height-md); margin: 0 var(--cm-space-8); padding-block: 0; padding-inline: var(--cm-space-12);
235
235
  font: inherit; color: inherit; text-align: start; text-decoration: none; background: none; border: 0; border-radius: var(--cm-radius-sm); cursor: pointer;
236
236
  }
237
+ /* Owner standard (1.6): a 220px menu of 36px rows with 12px side padding. */
237
238
  .item:hover { color: var(--cm-text-on-dark); background: var(--cm-nav-active); }
239
+ .item:active { background: color-mix(in srgb, var(--cm-nav-active), var(--cm-text-on-dark) 10%); }
238
240
  .item:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: -2px; color: var(--cm-text-on-dark); }
239
241
  .item[aria-current='page'] { color: var(--cm-text-on-dark); font-weight: 600; }
240
242
  .parent.has-current { color: var(--cm-text-on-dark); }
@@ -652,8 +652,8 @@ CmSignatureField.styles = [
652
652
  :host([disabled]) .pad { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
653
653
  :host([disabled]) canvas, :host([disabled]) .typed { cursor: not-allowed; }
654
654
  :host([disabled]) .typed { color: var(--cm-text-secondary); }
655
- .help { margin: 0; font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
656
- .error { margin: 0; font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-critical); }
655
+ .help { margin: 0; font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-tertiary); }
656
+ .error { margin: 0; font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-critical); }
657
657
  @media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
658
658
 
659
659
  .vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@@ -1,4 +1,5 @@
1
1
  import { CmLocalizedElement } from '../localize.js';
2
+ import './icon.js';
2
3
  /** One status tab. */
3
4
  export interface StatusTab {
4
5
  value: string;
@@ -10,6 +11,8 @@ export interface StatusTab {
10
11
  declare const strings: {
11
12
  /** Accessible name of the tab list when the element has no `aria-label`. */
12
13
  label: string;
14
+ /** A choice in the `mobile="select"` dropdown that has a count. */
15
+ option: string;
13
16
  };
14
17
  declare module '../localize.js' {
15
18
  interface CmStrings {
@@ -21,12 +24,14 @@ declare module '../localize.js' {
21
24
  * The chosen status is black, semibold and underlined; the others are grey. Each label can carry a count, shown as a
22
25
  * small neutral pill after it (read as "My tasks, 4").
23
26
  * Works as ARIA tabs: one tab stop, arrow keys move and select, Home/End jump to the ends.
24
- * Too many tabs for the width scroll sideways.
27
+ * Too many tabs for the width scroll sideways: the row fades at the edge that has more tabs past it and snaps to a tab
28
+ * (since 1.6, owner standard). On phones `mobile="select"` shows the tabs as a dropdown instead (640px wide or less).
25
29
  *
26
30
  * Tabs come from `<option>` children (`count` attribute for the number) or the `tabs` property.
27
31
  * @element cm-status-tabs
28
32
  * @slot - `<option value="…" count="23">Label</option>` elements. `disabled` and `selected` are honoured.
29
- * @fires change - When the merchant picks another status. Read `value`.
33
+ * @csspart select - The dropdown shown instead of the tabs with `mobile="select"` on narrow screens.
34
+ * @fires change - When the merchant picks another status (a tab, or the dropdown). Read `value`.
30
35
  */
31
36
  export declare class CmStatusTabs extends CmLocalizedElement {
32
37
  #private;
@@ -41,9 +46,15 @@ export declare class CmStatusTabs extends CmLocalizedElement {
41
46
  size: {
42
47
  reflect: boolean;
43
48
  };
49
+ mobile: {
50
+ reflect: boolean;
51
+ };
44
52
  _slotted: {
45
53
  state: boolean;
46
54
  };
55
+ _more: {
56
+ state: boolean;
57
+ };
47
58
  };
48
59
  /** Value of the chosen tab. Defaults to the first tab. */
49
60
  value: string;
@@ -57,15 +68,24 @@ export declare class CmStatusTabs extends CmLocalizedElement {
57
68
  controls: string;
58
69
  /** `large` (the default: 14px labels, page-level statuses) or `small` (13px, tighter, inside a card, e.g. review sorting). */
59
70
  size: 'large' | 'small';
71
+ /**
72
+ * What the tabs become on screens 640px wide or less: `scroll` (default: the row scrolls sideways, with a fade at the
73
+ * edge that has more tabs) or `select` (a dropdown of the same choices, with the counts; one control instead of a long
74
+ * row). Since 1.6.
75
+ */
76
+ mobile: 'scroll' | 'select';
77
+ /** Which edges have more tabs past them: '' | 'start' | 'end' | 'both'. */
78
+ _more: string;
60
79
  _slotted: StatusTab[];
61
80
  static styles: import("lit").CSSResult[];
62
81
  connectedCallback(): void;
63
82
  disconnectedCallback(): void;
83
+ firstUpdated(): void;
64
84
  /** The tabs in use, normalised. */
65
85
  get items(): StatusTab[];
66
- /** Focuses the selected tab. */
86
+ /** Focuses the selected tab (or the dropdown, when `mobile="select"` shows it). */
67
87
  focus(options?: FocusOptions): void;
68
- updated(): void;
88
+ updated(changed: Map<string, unknown>): void;
69
89
  render(): import("lit-html").TemplateResult<1>;
70
90
  }
71
91
  declare global {
@@ -3,25 +3,30 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _CmStatusTabs_instances, _CmStatusTabs_observer, _CmStatusTabs_readChildren, _CmStatusTabs_current, _CmStatusTabs_select, _CmStatusTabs_onKeyDown;
6
+ var _CmStatusTabs_instances, _CmStatusTabs_resize, _CmStatusTabs_observer, _CmStatusTabs_measure, _CmStatusTabs_onPick, _CmStatusTabs_readChildren, _CmStatusTabs_current, _CmStatusTabs_select, _CmStatusTabs_onKeyDown;
7
7
  import { html, css, nothing } from 'lit';
8
8
  import { base, define, logicalKey } from '../base.js';
9
9
  import { CmLocalizedElement, defineStrings } from '../localize.js';
10
+ import './icon.js';
10
11
  const strings = defineStrings('statusTabs', {
11
12
  /** Accessible name of the tab list when the element has no `aria-label`. */
12
13
  label: 'Status',
14
+ /** A choice in the `mobile="select"` dropdown that has a count. */
15
+ option: '{label} ({count})',
13
16
  });
14
17
  /**
15
18
  * A row of statuses that filters the list under it, such as All, Unprocessed, Processing, Fulfilled.
16
19
  * The chosen status is black, semibold and underlined; the others are grey. Each label can carry a count, shown as a
17
20
  * small neutral pill after it (read as "My tasks, 4").
18
21
  * Works as ARIA tabs: one tab stop, arrow keys move and select, Home/End jump to the ends.
19
- * Too many tabs for the width scroll sideways.
22
+ * Too many tabs for the width scroll sideways: the row fades at the edge that has more tabs past it and snaps to a tab
23
+ * (since 1.6, owner standard). On phones `mobile="select"` shows the tabs as a dropdown instead (640px wide or less).
20
24
  *
21
25
  * Tabs come from `<option>` children (`count` attribute for the number) or the `tabs` property.
22
26
  * @element cm-status-tabs
23
27
  * @slot - `<option value="…" count="23">Label</option>` elements. `disabled` and `selected` are honoured.
24
- * @fires change - When the merchant picks another status. Read `value`.
28
+ * @csspart select - The dropdown shown instead of the tabs with `mobile="select"` on narrow screens.
29
+ * @fires change - When the merchant picks another status (a tab, or the dropdown). Read `value`.
25
30
  */
26
31
  export class CmStatusTabs extends CmLocalizedElement {
27
32
  constructor() {
@@ -39,6 +44,15 @@ export class CmStatusTabs extends CmLocalizedElement {
39
44
  this.controls = '';
40
45
  /** `large` (the default: 14px labels, page-level statuses) or `small` (13px, tighter, inside a card, e.g. review sorting). */
41
46
  this.size = 'large';
47
+ /**
48
+ * What the tabs become on screens 640px wide or less: `scroll` (default: the row scrolls sideways, with a fade at the
49
+ * edge that has more tabs) or `select` (a dropdown of the same choices, with the counts; one control instead of a long
50
+ * row). Since 1.6.
51
+ */
52
+ this.mobile = 'scroll';
53
+ /** Which edges have more tabs past them: '' | 'start' | 'end' | 'both'. */
54
+ this._more = '';
55
+ _CmStatusTabs_resize.set(this, new ResizeObserver(() => __classPrivateFieldGet(this, _CmStatusTabs_instances, "m", _CmStatusTabs_measure).call(this)));
42
56
  this._slotted = [];
43
57
  _CmStatusTabs_observer.set(this, new MutationObserver(() => __classPrivateFieldGet(this, _CmStatusTabs_instances, "m", _CmStatusTabs_readChildren).call(this)));
44
58
  }
@@ -50,6 +64,12 @@ export class CmStatusTabs extends CmLocalizedElement {
50
64
  disconnectedCallback() {
51
65
  super.disconnectedCallback();
52
66
  __classPrivateFieldGet(this, _CmStatusTabs_observer, "f").disconnect();
67
+ __classPrivateFieldGet(this, _CmStatusTabs_resize, "f").disconnect();
68
+ }
69
+ firstUpdated() {
70
+ const row = this.renderRoot.querySelector('.tabs');
71
+ __classPrivateFieldGet(this, _CmStatusTabs_resize, "f").observe(row);
72
+ row.addEventListener('scroll', () => __classPrivateFieldGet(this, _CmStatusTabs_instances, "m", _CmStatusTabs_measure).call(this), { passive: true });
53
73
  }
54
74
  /** The tabs in use, normalised. */
55
75
  get items() {
@@ -57,34 +77,63 @@ export class CmStatusTabs extends CmLocalizedElement {
57
77
  return this._slotted;
58
78
  return this.tabs.map((t) => (typeof t === 'string' ? { value: t, label: t } : t));
59
79
  }
60
- /** Focuses the selected tab. */
80
+ /** Focuses the selected tab (or the dropdown, when `mobile="select"` shows it). */
61
81
  focus(options) {
62
- this.renderRoot.querySelector('button[tabindex="0"]')?.focus(options);
82
+ const select = this.renderRoot.querySelector('.pick select');
83
+ if (select && select.offsetParent !== null)
84
+ select.focus(options);
85
+ else
86
+ this.renderRoot.querySelector('button[tabindex="0"]')?.focus(options);
63
87
  }
64
- updated() {
88
+ updated(changed) {
89
+ if (changed.has('tabs') || changed.has('_slotted') || changed.has('size'))
90
+ __classPrivateFieldGet(this, _CmStatusTabs_instances, "m", _CmStatusTabs_measure).call(this);
65
91
  if (!('ariaControlsElements' in Element.prototype))
66
92
  return;
67
93
  const root = this.getRootNode();
68
94
  const target = this.controls ? root.getElementById?.(this.controls) : null;
69
- for (const b of this.renderRoot.querySelectorAll('button'))
95
+ for (const b of this.renderRoot.querySelectorAll('button, select'))
70
96
  b.ariaControlsElements = target ? [target] : null;
71
97
  }
72
98
  render() {
73
99
  const items = this.items;
74
100
  const cur = __classPrivateFieldGet(this, _CmStatusTabs_instances, "m", _CmStatusTabs_current).call(this, items);
101
+ const label = this.getAttribute('aria-label') || this.t('label');
75
102
  return html `
76
- <div class="tabs" part="tabs" role="tablist" aria-label=${this.getAttribute('aria-label') || this.t('label')}>
103
+ <div class=${`tabs${this._more ? ` more-${this._more}` : ''}`} part="tabs" role="tablist" aria-label=${label}>
77
104
  ${items.map((t, i) => html `<button type="button" role="tab" part="tab" aria-selected=${i === cur ? 'true' : 'false'}
78
105
  tabindex=${i === cur ? '0' : '-1'} ?disabled=${!!t.disabled}
79
106
  @click=${() => __classPrivateFieldGet(this, _CmStatusTabs_instances, "m", _CmStatusTabs_select).call(this, i)} @keydown=${(e) => __classPrivateFieldGet(this, _CmStatusTabs_instances, "m", _CmStatusTabs_onKeyDown).call(this, e, i)}><span class="label" data-text=${t.label}>${t.label}</span>${t.count !== undefined && !Number.isNaN(t.count)
80
107
  ? html `<span class="sr">, </span><span class="count" part="count">${this.formatNumber(t.count)}</span>`
81
108
  : nothing}</button>`)}
82
109
  </div>
110
+ ${this.mobile === 'select'
111
+ ? html `<div class="pick"><select part="select" aria-label=${label} @change=${__classPrivateFieldGet(this, _CmStatusTabs_instances, "m", _CmStatusTabs_onPick)}>
112
+ ${items.map((t, i) => html `<option value=${t.value} ?disabled=${!!t.disabled} ?selected=${i === cur} .selected=${i === cur}>${t.count !== undefined && !Number.isNaN(t.count) ? this.t('option', { label: t.label, count: t.count }) : t.label}</option>`)}
113
+ </select><cm-icon name="chevron-down" size="16"></cm-icon></div>`
114
+ : nothing}
83
115
  <slot></slot>
84
116
  `;
85
117
  }
86
118
  }
87
- _CmStatusTabs_observer = new WeakMap(), _CmStatusTabs_instances = new WeakSet(), _CmStatusTabs_readChildren = function _CmStatusTabs_readChildren() {
119
+ _CmStatusTabs_resize = new WeakMap(), _CmStatusTabs_observer = new WeakMap(), _CmStatusTabs_instances = new WeakSet(), _CmStatusTabs_measure = function _CmStatusTabs_measure() {
120
+ const row = this.renderRoot.querySelector('.tabs');
121
+ if (!row)
122
+ return;
123
+ const max = row.scrollWidth - row.clientWidth;
124
+ const at = Math.abs(row.scrollLeft); // negative in right-to-left rows
125
+ const start = max > 1 && at > 1;
126
+ const end = max > 1 && at < max - 1;
127
+ const more = start && end ? 'both' : start ? 'start' : end ? 'end' : '';
128
+ if (more !== this._more)
129
+ this._more = more;
130
+ }, _CmStatusTabs_onPick = function _CmStatusTabs_onPick(e) {
131
+ const value = e.target.value;
132
+ if (value === this.value)
133
+ return;
134
+ this.value = value;
135
+ this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
136
+ }, _CmStatusTabs_readChildren = function _CmStatusTabs_readChildren() {
88
137
  const opts = [...this.querySelectorAll('option')];
89
138
  this._slotted = opts.map((o) => {
90
139
  const c = o.getAttribute('count');
@@ -132,7 +181,9 @@ CmStatusTabs.properties = {
132
181
  tabs: { type: Array },
133
182
  controls: {},
134
183
  size: { reflect: true },
184
+ mobile: { reflect: true },
135
185
  _slotted: { state: true },
186
+ _more: { state: true },
136
187
  };
137
188
  CmStatusTabs.styles = [
138
189
  base,
@@ -141,10 +192,12 @@ CmStatusTabs.styles = [
141
192
  /* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
142
193
  .tabs {
143
194
  display: flex; gap: var(--cm-space-24); overflow-x: auto; scrollbar-width: thin; padding: 2px 2px 0;
195
+ scroll-snap-type: x proximity; scroll-padding-inline: var(--cm-space-24);
144
196
  font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; white-space: nowrap;
145
197
  box-shadow: inset 0 calc(-1 * var(--cm-border-1)) 0 var(--cm-border-subtle);
146
198
  }
147
199
  button {
200
+ scroll-snap-align: start;
148
201
  position: relative; flex: none; display: inline-flex; align-items: center; gap: var(--cm-space-8);
149
202
  min-block-size: var(--cm-control-height-lg); padding: 0; font: inherit; color: var(--cm-text-tertiary);
150
203
  background: none; border: 0; cursor: pointer;
@@ -170,8 +223,28 @@ CmStatusTabs.styles = [
170
223
  :host([size='small']) .tabs { gap: var(--cm-space-16); font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); }
171
224
  :host([size='small']) button { min-block-size: var(--cm-control-height-sm); gap: var(--cm-space-4); }
172
225
  slot { display: none; }
226
+ /* Scroll affordance (1.6): the edge with more tabs past it fades out over 32px, so a cut-off row reads as one that
227
+ scrolls. The mask is a gradient of opacity, not a colour, so it works on any background and theme. */
228
+ .tabs.more-end { mask-image: linear-gradient(to right, #000 calc(100% - var(--cm-space-32)), transparent); }
229
+ .tabs.more-start { mask-image: linear-gradient(to left, #000 calc(100% - var(--cm-space-32)), transparent); }
230
+ .tabs.more-both { mask-image: linear-gradient(to right, transparent, #000 var(--cm-space-32), #000 calc(100% - var(--cm-space-32)), transparent); }
231
+ :host(:dir(rtl)) .tabs.more-end { mask-image: linear-gradient(to left, #000 calc(100% - var(--cm-space-32)), transparent); }
232
+ :host(:dir(rtl)) .tabs.more-start { mask-image: linear-gradient(to right, #000 calc(100% - var(--cm-space-32)), transparent); }
233
+ .pick { display: none; position: relative; }
234
+ .pick select {
235
+ appearance: none; box-sizing: border-box; width: 100%; height: var(--cm-control-height-lg); padding-block: 0;
236
+ padding-inline: var(--cm-space-12) var(--cm-space-40); font: inherit; font-size: var(--cm-font-size-14); font-weight: 500;
237
+ color: var(--cm-text-default); background: var(--cm-bg-surface); cursor: pointer;
238
+ border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
239
+ }
240
+ .pick select:hover { border-color: var(--cm-border-strong); }
241
+ .pick select:focus-visible { outline: none; border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
242
+ .pick cm-icon { position: absolute; inset-inline-end: var(--cm-space-12); inset-block-start: 50%; translate: 0 -50%; pointer-events: none; color: var(--cm-icon-selected); }
243
+ @media (pointer: coarse) { .pick select { height: var(--cm-control-height-touch); font-size: var(--cm-font-size-16); } }
173
244
  @media (max-width: 640px) {
174
245
  .tabs { gap: var(--cm-space-16); }
246
+ :host([mobile='select']) .tabs { display: none; }
247
+ :host([mobile='select']) .pick { display: block; }
175
248
  }
176
249
  `,
177
250
  ];
@@ -24,7 +24,7 @@ export interface TableColumn {
24
24
  hidden?: boolean;
25
25
  }
26
26
  /**
27
- * The grey 32px label bar at the top of a table or resource list: column names in 12px medium type,
27
+ * The grey 40px label bar at the top of a table or resource list (32px before 1.6): column names in 12px semibold type,
28
28
  * optional sort buttons and an optional "select all" checkbox.
29
29
  *
30
30
  * Columns come from `<option>` children or the `columns` property. Lay out the rows with the same
@@ -16,7 +16,7 @@ const strings = defineStrings('tableHeader', {
16
16
  sortable: ', sortable',
17
17
  });
18
18
  /**
19
- * The grey 32px label bar at the top of a table or resource list: column names in 12px medium type,
19
+ * The grey 40px label bar at the top of a table or resource list (32px before 1.6): column names in 12px semibold type,
20
20
  * optional sort buttons and an optional "select all" checkbox.
21
21
  *
22
22
  * Columns come from `<option>` children or the `columns` property. Lay out the rows with the same
@@ -135,8 +135,8 @@ CmTableHeader.styles = [
135
135
  slot { display: none; } /* <option> children are column data, not content */
136
136
  .bar {
137
137
  display: grid; grid-template-columns: var(--cm-table-columns, var(--_cols)); align-items: center; column-gap: var(--cm-space-20);
138
- min-height: var(--cm-control-height-sm); padding: 0 var(--cm-space-20); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12);
139
- font-weight: 500; color: var(--cm-text-tertiary);
138
+ min-height: var(--cm-table-header-height, 40px); padding: 0 var(--cm-space-20); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12);
139
+ font-weight: 600; color: var(--cm-text-tertiary);
140
140
  background: var(--cm-bg-hover); border: var(--cm-border-1) solid var(--cm-border-subtle);
141
141
  border-radius: var(--cm-radius-md) var(--cm-radius-md) 0 0;
142
142
  }
@@ -19,6 +19,13 @@ declare module '../localize.js' {
19
19
  */
20
20
  export declare class CmTag extends CmLocalizedElement {
21
21
  #private;
22
+ /** `focus()` on the tag focuses its remove button. */
23
+ static shadowRootOptions: {
24
+ delegatesFocus: boolean;
25
+ mode: ShadowRootMode;
26
+ serializable?: boolean;
27
+ slotAssignment?: SlotAssignmentMode;
28
+ };
22
29
  static properties: {
23
30
  removable: {
24
31
  type: BooleanConstructor;
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _CmTag_instances, _CmTag_remove;
7
- import { html, css, nothing } from 'lit';
7
+ import { LitElement, html, css, nothing } from 'lit';
8
8
  import { base, define } from '../base.js';
9
9
  import { CmLocalizedElement, defineStrings } from '../localize.js';
10
10
  import './icon.js';
@@ -43,6 +43,8 @@ _CmTag_instances = new WeakSet(), _CmTag_remove = function _CmTag_remove() {
43
43
  return;
44
44
  this.dispatchEvent(new CustomEvent('cm-remove', { bubbles: true, composed: true }));
45
45
  };
46
+ /** `focus()` on the tag focuses its remove button. */
47
+ CmTag.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
46
48
  CmTag.properties = {
47
49
  removable: { type: Boolean, reflect: true },
48
50
  removeLabel: { attribute: 'remove-label' },
@@ -63,10 +65,11 @@ CmTag.styles = [
63
65
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
64
66
  padding: 0; border: 0; border-radius: var(--cm-radius-full); background: none; color: var(--cm-icon-selected); cursor: pointer;
65
67
  }
66
- button:hover { background: var(--cm-bg-hover); }
68
+ button:hover { background: var(--cm-bg-hover); color: var(--cm-text-default); }
69
+ button:active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
67
70
  button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
68
71
  :host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
69
- :host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); }
72
+ :host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
70
73
  `,
71
74
  ];
72
75
  define('cm-tag', CmTag);
@@ -111,7 +111,7 @@ export declare class CmTextField extends CmLocalizedElement {
111
111
  readonly: boolean;
112
112
  /** Native autocomplete hint, e.g. `email`, `postal-code`. */
113
113
  autocomplete?: string;
114
- /** `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 36px box. On touch screens both are 44px. */
114
+ /** `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 40px box (since 1.6, owner standard; was 36px). On touch screens both are 44px. */
115
115
  size: 'default' | 'small';
116
116
  /**
117
117
  * Lowest allowed value for `number`, `date`, `time` and `datetime-local`, in the value's format (`2026-11-16T15:30`
@@ -74,7 +74,7 @@ export class CmTextField extends CmLocalizedElement {
74
74
  this.disabled = false;
75
75
  /** Shows the value on the filled background; the value is still submitted. */
76
76
  this.readonly = false;
77
- /** `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 36px box. On touch screens both are 44px. */
77
+ /** `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 40px box (since 1.6, owner standard; was 36px). On touch screens both are 44px. */
78
78
  this.size = 'default';
79
79
  _CmTextField_internals.set(this, this.attachInternals());
80
80
  _CmTextField_id.set(this, nextId('cm-tf'));
@@ -223,6 +223,8 @@ CmTextField.styles = [
223
223
  }
224
224
  textarea.input { height: auto; min-height: var(--_cm-field-h); padding: var(--cm-space-8) var(--_cm-field-pad); resize: vertical; }
225
225
  .input::placeholder { color: var(--cm-text-tertiary); }
226
+ /* Hover (1.6): the outline darkens; focus adds the 2px ring. */
227
+ .input:hover:not(:disabled):not(:read-only):not(:focus) { border-color: var(--cm-border-strong); }
226
228
  .input:focus { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
227
229
  .input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
228
230
  .input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
@@ -98,10 +98,12 @@ CmToggle.styles = [
98
98
  input:checked + .track .thumb { transform: translateX(16px); }
99
99
  /* On is the end side: the left in right-to-left text. */
100
100
  :host(:dir(rtl)) input:checked + .track .thumb { transform: translateX(-16px); }
101
+ /* Hover (1.6): the outline darkens. */
102
+ label:hover input:not(:disabled) + .track { border-color: var(--cm-border-strong); }
101
103
  input:focus-visible + .track { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
102
104
  .text { display: flex; flex-direction: column; gap: 2px; }
103
105
  .label { font-size: var(--cm-type-body-md-size); line-height: var(--cm-type-body-md-line-height); }
104
- .desc { font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
106
+ .desc { font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-tertiary); }
105
107
  :host([disabled]) label { cursor: not-allowed; }
106
108
  :host([disabled]) .track { opacity: .5; }
107
109
  :host([disabled]) .label { color: var(--cm-text-secondary); }
@@ -1,6 +1,9 @@
1
1
  import { LitElement } from 'lit';
2
2
  /**
3
- * Short text that names or explains a control, shown on hover and keyboard focus.
3
+ * Short text that names or explains a control, shown on hover (after 400ms) and at once on keyboard focus; it hides
4
+ * as soon as the pointer leaves or focus moves on. 12px text on a dark surface, 8 x 12px padding, 6px corners, at
5
+ * most 240px wide (owner standard, 1.6). A tooltip is never the only way to get information: whatever it says must
6
+ * also be in the page, the control's label or its help text, because touch screens never show it.
4
7
  * Wrap exactly one focusable element. The text becomes that element's accessible description, so screen readers
5
8
  * hear it too. It stays open while the pointer is over the control or the tooltip, and Esc closes it
6
9
  * (WCAG 1.4.13). Text only: never put links or buttons in a tooltip.
@@ -38,7 +41,7 @@ export declare class CmTooltip extends LitElement {
38
41
  content: string;
39
42
  /** Preferred side. It flips to the opposite side when there is no room. */
40
43
  placement: 'top' | 'bottom' | 'start' | 'end';
41
- /** Wait before showing on hover, in ms. Keyboard focus shows it at once. */
44
+ /** Wait before showing on hover, in ms. Keyboard focus shows it at once. Default 400 (since 1.6; was 300). */
42
45
  delay: number;
43
46
  /** True while the tooltip is shown. Read it; use `show()` / `hide()` to change it. */
44
47
  open: boolean;
@@ -14,7 +14,10 @@ import { LitElement, html, css } from 'lit';
14
14
  import { base, define, nextId } from '../base.js';
15
15
  const FOCUSABLE = 'button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]';
16
16
  /**
17
- * Short text that names or explains a control, shown on hover and keyboard focus.
17
+ * Short text that names or explains a control, shown on hover (after 400ms) and at once on keyboard focus; it hides
18
+ * as soon as the pointer leaves or focus moves on. 12px text on a dark surface, 8 x 12px padding, 6px corners, at
19
+ * most 240px wide (owner standard, 1.6). A tooltip is never the only way to get information: whatever it says must
20
+ * also be in the page, the control's label or its help text, because touch screens never show it.
18
21
  * Wrap exactly one focusable element. The text becomes that element's accessible description, so screen readers
19
22
  * hear it too. It stays open while the pointer is over the control or the tooltip, and Esc closes it
20
23
  * (WCAG 1.4.13). Text only: never put links or buttons in a tooltip.
@@ -34,8 +37,8 @@ export class CmTooltip extends LitElement {
34
37
  this.content = '';
35
38
  /** Preferred side. It flips to the opposite side when there is no room. */
36
39
  this.placement = 'top';
37
- /** Wait before showing on hover, in ms. Keyboard focus shows it at once. */
38
- this.delay = 300;
40
+ /** Wait before showing on hover, in ms. Keyboard focus shows it at once. Default 400 (since 1.6; was 300). */
41
+ this.delay = 400;
39
42
  /** True while the tooltip is shown. Read it; use `show()` / `hide()` to change it. */
40
43
  this.open = false;
41
44
  /**
@@ -63,7 +66,7 @@ export class CmTooltip extends LitElement {
63
66
  __classPrivateFieldSet(this, _CmTooltip_hovered, false, "f");
64
67
  clearTimeout(__classPrivateFieldGet(this, _CmTooltip_timer, "f"));
65
68
  if (!__classPrivateFieldGet(this, _CmTooltip_focused, "f"))
66
- __classPrivateFieldSet(this, _CmTooltip_timer, setTimeout(() => this.hide(), 100), "f");
69
+ this.hide();
67
70
  });
68
71
  _CmTooltip_onFocusIn.set(this, () => { __classPrivateFieldSet(this, _CmTooltip_focused, true, "f"); this.show(); });
69
72
  _CmTooltip_onFocusOut.set(this, (e) => {
@@ -259,15 +262,17 @@ CmTooltip.styles = [
259
262
  :host { display: inline-block; position: relative; }
260
263
  .tip {
261
264
  position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
262
- max-width: min(280px, calc(100vw - 16px)); width: max-content;
263
- padding: var(--cm-space-4) var(--cm-space-8); border-radius: var(--cm-radius-sm);
265
+ max-width: min(240px, calc(100vw - 16px)); width: max-content;
266
+ padding: var(--cm-space-8) var(--cm-space-12); border-radius: var(--cm-radius-sm);
264
267
  background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
265
268
  font-size: 12px; line-height: 16px; font-weight: 400; white-space: normal; overflow-wrap: anywhere;
266
269
  box-shadow: var(--cm-shadow-sm); pointer-events: auto;
267
- opacity: 0; visibility: hidden; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard);
268
-
270
+ opacity: 0; visibility: hidden;
269
271
  }
270
- :host([open]) .tip { opacity: 1; visibility: visible; }
272
+ /* The pointer can cross the 8px gap onto the bubble without leaving (WCAG 1.4.13 hoverable): the bubble is in this
273
+ element's shadow tree, and this strip bridges the gap. */
274
+ .tip::before { content: ''; position: absolute; inset: calc(-1 * var(--cm-space-8)); }
275
+ :host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
271
276
  @media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
272
277
  @media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
273
278
  `,