@commmerce/ui 1.5.2 → 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 (63) hide show
  1. package/dist/calendar.js +2 -0
  2. package/dist/cdn.js +1004 -645
  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/card.d.ts +38 -0
  11. package/dist/components/card.js +77 -12
  12. package/dist/components/checkbox.js +7 -2
  13. package/dist/components/color-field.js +2 -0
  14. package/dist/components/combobox.d.ts +27 -2
  15. package/dist/components/combobox.js +109 -15
  16. package/dist/components/data-table.d.ts +127 -9
  17. package/dist/components/data-table.js +577 -67
  18. package/dist/components/date-picker.d.ts +1 -1
  19. package/dist/components/date-picker.js +1 -1
  20. package/dist/components/date-range-picker.d.ts +1 -1
  21. package/dist/components/date-range-picker.js +2 -2
  22. package/dist/components/empty-state.d.ts +8 -6
  23. package/dist/components/empty-state.js +26 -17
  24. package/dist/components/file-upload.d.ts +49 -4
  25. package/dist/components/file-upload.js +136 -29
  26. package/dist/components/layout.d.ts +2 -2
  27. package/dist/components/layout.js +5 -5
  28. package/dist/components/menu-item.d.ts +18 -0
  29. package/dist/components/menu-item.js +8 -0
  30. package/dist/components/page-header.d.ts +6 -0
  31. package/dist/components/page-header.js +22 -5
  32. package/dist/components/pagination.d.ts +3 -2
  33. package/dist/components/pagination.js +13 -10
  34. package/dist/components/radio.js +4 -2
  35. package/dist/components/resource-list.d.ts +28 -3
  36. package/dist/components/resource-list.js +47 -15
  37. package/dist/components/search.d.ts +2 -2
  38. package/dist/components/search.js +4 -2
  39. package/dist/components/segmented-control.js +1 -1
  40. package/dist/components/select.d.ts +11 -1
  41. package/dist/components/select.js +17 -4
  42. package/dist/components/side-navigation.d.ts +1 -1
  43. package/dist/components/side-navigation.js +5 -3
  44. package/dist/components/signature-field.js +2 -2
  45. package/dist/components/status-tabs.d.ts +24 -4
  46. package/dist/components/status-tabs.js +82 -9
  47. package/dist/components/table-header.d.ts +1 -1
  48. package/dist/components/table-header.js +3 -3
  49. package/dist/components/tag.d.ts +7 -0
  50. package/dist/components/tag.js +6 -3
  51. package/dist/components/text-field.d.ts +1 -1
  52. package/dist/components/text-field.js +3 -1
  53. package/dist/components/toggle.js +3 -1
  54. package/dist/components/tooltip.d.ts +5 -2
  55. package/dist/components/tooltip.js +14 -9
  56. package/dist/custom-elements.json +1594 -137
  57. package/dist/density.d.ts +21 -0
  58. package/dist/density.js +46 -0
  59. package/dist/field.d.ts +9 -5
  60. package/dist/field.js +16 -10
  61. package/dist/index.d.ts +1 -1
  62. package/dist/popover.js +1 -1
  63. package/package.json +3 -3
@@ -11,8 +11,8 @@ import { spaceRules } from '../spacing.js';
11
11
  export class CmLayout extends LitElement {
12
12
  constructor() {
13
13
  super(...arguments);
14
- /** Space between sections, across and down: a spacing step on the 4px grid (`0`, `4`, `8`, `12`, `16`, `20`, `24`, `32`, `40`, `48`, `64`; the pre-1.5 steps `10`, `15`, `22` and `30` still work and draw as 8, 16, 24 and 32). Default `20`. */
15
- this.gap = '20';
14
+ /** Space between sections, across and down: a spacing step on the 4px grid (`0`, `4`, `8`, `12`, `16`, `20`, `24`, `32`, `40`, `48`, `64`; the pre-1.5 steps `10`, `15`, `22` and `30` still work and draw as 8, 16, 24 and 32). Default `24` (owner standard, 1.6: 24px between page sections; was 20). */
15
+ this.gap = '24';
16
16
  }
17
17
  render() {
18
18
  return html `<div class="layout" part="layout"><slot></slot></div>`;
@@ -22,7 +22,7 @@ CmLayout.properties = { gap: { reflect: true } };
22
22
  CmLayout.styles = [
23
23
  base,
24
24
  css `
25
- :host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-20); }
25
+ :host { display: block; container: cm-layout / inline-size; --_gap: var(--cm-space-24); }
26
26
  .layout { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--_gap); align-items: start; }
27
27
  @container cm-layout (max-width: 767px) {
28
28
  .layout { grid-template-columns: minmax(0, 1fr); }
@@ -39,7 +39,7 @@ CmLayout.styles = [
39
39
  spaceRules('gap', '--_gap'),
40
40
  ];
41
41
  /**
42
- * One column of a `cm-layout`. Its children are stacked `space-20` apart (cards on the page).
42
+ * One column of a `cm-layout`. Its children are stacked `space-24` apart (cards on the page; since 1.6, was `space-20`).
43
43
  * @element cm-layout-section
44
44
  * @slot - The section's content, usually cards.
45
45
  */
@@ -60,7 +60,7 @@ CmLayoutSection.properties = { variant: { reflect: true } };
60
60
  CmLayoutSection.styles = [
61
61
  base,
62
62
  css `
63
- :host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
63
+ :host { display: flex; flex-direction: column; gap: var(--cm-space-24); min-inline-size: 0; }
64
64
  `,
65
65
  ];
66
66
  define('cm-layout', CmLayout);
@@ -16,6 +16,13 @@ export interface MenuItem {
16
16
  critical?: boolean;
17
17
  /** A separator line instead of a choice. */
18
18
  divider?: boolean;
19
+ /**
20
+ * A section heading instead of a choice (12px, not focusable): the choices after it, up to the next heading or
21
+ * divider, form a group named by it. Since 1.6.
22
+ */
23
+ heading?: boolean;
24
+ /** Keyboard shortcut shown at the end of the row in 12px grey ("Ctrl+E"), and set as `aria-keyshortcuts`. Since 1.6. */
25
+ shortcut?: string;
19
26
  }
20
27
  /**
21
28
  * A choice described in markup, read by `cm-action-menu` and `cm-bottom-sheet`. It renders nothing itself.
@@ -41,6 +48,13 @@ export declare class CmMenuItem extends LitElement {
41
48
  type: BooleanConstructor;
42
49
  reflect: boolean;
43
50
  };
51
+ heading: {
52
+ type: BooleanConstructor;
53
+ reflect: boolean;
54
+ };
55
+ shortcut: {
56
+ reflect: boolean;
57
+ };
44
58
  };
45
59
  /** Identifies the choice in `cm-select`. Defaults to the text. */
46
60
  value: string;
@@ -52,6 +66,10 @@ export declare class CmMenuItem extends LitElement {
52
66
  disabled: boolean;
53
67
  /** A destructive choice, shown in the critical colour. */
54
68
  critical: boolean;
69
+ /** Makes this a section heading (its text, 12px) instead of a choice. Since 1.6. */
70
+ heading: boolean;
71
+ /** Keyboard shortcut shown at the end of the row ("Ctrl+E"). Since 1.6. */
72
+ shortcut: string;
55
73
  static styles: import("lit").CSSResult;
56
74
  render(): null;
57
75
  /** The item as data. */
@@ -18,6 +18,10 @@ export class CmMenuItem extends LitElement {
18
18
  this.disabled = false;
19
19
  /** A destructive choice, shown in the critical colour. */
20
20
  this.critical = false;
21
+ /** Makes this a section heading (its text, 12px) instead of a choice. Since 1.6. */
22
+ this.heading = false;
23
+ /** Keyboard shortcut shown at the end of the row ("Ctrl+E"). Since 1.6. */
24
+ this.shortcut = '';
21
25
  }
22
26
  render() { return null; }
23
27
  /** The item as data. */
@@ -26,6 +30,7 @@ export class CmMenuItem extends LitElement {
26
30
  return {
27
31
  label, value: this.value || label, icon: this.icon || undefined, href: this.href || undefined,
28
32
  disabled: this.disabled || undefined, critical: this.critical || undefined,
33
+ heading: this.heading || undefined, shortcut: this.shortcut || undefined,
29
34
  };
30
35
  }
31
36
  }
@@ -35,6 +40,8 @@ CmMenuItem.properties = {
35
40
  href: { reflect: true },
36
41
  disabled: { type: Boolean, reflect: true },
37
42
  critical: { type: Boolean, reflect: true },
43
+ heading: { type: Boolean, reflect: true },
44
+ shortcut: { reflect: true },
38
45
  };
39
46
  CmMenuItem.styles = css `:host { display: none; }`;
40
47
  define('cm-menu-item', CmMenuItem);
@@ -49,6 +56,7 @@ export function readMenuItems(host) {
49
56
  out.push({
50
57
  label, value: a('value') ?? label, icon: a('icon'), href: a('href'),
51
58
  disabled: c.hasAttribute('disabled') || undefined, critical: c.hasAttribute('critical') || undefined,
59
+ heading: c.hasAttribute('heading') || undefined, shortcut: a('shortcut'),
52
60
  });
53
61
  }
54
62
  else if (c.localName === 'hr')
@@ -24,9 +24,12 @@ export interface Breadcrumb {
24
24
  * Top of an admin page: breadcrumbs, the page title and the page's main actions.
25
25
  * The Figma file calls this the "Save Bar" (80px desktop, 50px mobile).
26
26
  * On narrow screens the breadcrumbs collapse to a back link to the parent page.
27
+ * Type (owner standard, 1.6): title 24/32 semibold (20/28 on phones), description 13/18, breadcrumbs 13/18.
28
+ * A badge in `title-adornment` sits beside the title and wraps under it only when the title runs out of room.
27
29
  * @element cm-page-header
28
30
  * @slot actions - Buttons, right-aligned, secondary first and the primary action last (large size).
29
31
  * @slot title-adornment - Badge or count next to the title.
32
+ * @csspart description - The `description` line under the title.
30
33
  * @fires cm-previous - When the previous-record arrow is pressed (with `pagination`).
31
34
  * @fires cm-next - When the next-record arrow is pressed (with `pagination`).
32
35
  */
@@ -34,6 +37,7 @@ export declare class CmPageHeader extends CmLocalizedElement {
34
37
  #private;
35
38
  static properties: {
36
39
  heading: {};
40
+ description: {};
37
41
  breadcrumbs: {
38
42
  type: ArrayConstructor;
39
43
  };
@@ -52,6 +56,8 @@ export declare class CmPageHeader extends CmLocalizedElement {
52
56
  };
53
57
  /** Page title, rendered as the page's `<h1>` and as the last (current) breadcrumb. */
54
58
  heading: string;
59
+ /** One line under the title saying what the page is for, 13px in text-tertiary (owner standard: page description 13). Since 1.6. */
60
+ description: string;
55
61
  /**
56
62
  * Parent pages, outermost first, as `{label, href}`. Don't include the current page.
57
63
  * In HTML pass JSON: `breadcrumbs='[{"label":"Products","href":"/products"}]'`.
@@ -22,9 +22,12 @@ const strings = defineStrings('pageHeader', {
22
22
  * Top of an admin page: breadcrumbs, the page title and the page's main actions.
23
23
  * The Figma file calls this the "Save Bar" (80px desktop, 50px mobile).
24
24
  * On narrow screens the breadcrumbs collapse to a back link to the parent page.
25
+ * Type (owner standard, 1.6): title 24/32 semibold (20/28 on phones), description 13/18, breadcrumbs 13/18.
26
+ * A badge in `title-adornment` sits beside the title and wraps under it only when the title runs out of room.
25
27
  * @element cm-page-header
26
28
  * @slot actions - Buttons, right-aligned, secondary first and the primary action last (large size).
27
29
  * @slot title-adornment - Badge or count next to the title.
30
+ * @csspart description - The `description` line under the title.
28
31
  * @fires cm-previous - When the previous-record arrow is pressed (with `pagination`).
29
32
  * @fires cm-next - When the next-record arrow is pressed (with `pagination`).
30
33
  */
@@ -34,6 +37,8 @@ export class CmPageHeader extends CmLocalizedElement {
34
37
  _CmPageHeader_instances.add(this);
35
38
  /** Page title, rendered as the page's `<h1>` and as the last (current) breadcrumb. */
36
39
  this.heading = '';
40
+ /** One line under the title saying what the page is for, 13px in text-tertiary (owner standard: page description 13). Since 1.6. */
41
+ this.description = '';
37
42
  /**
38
43
  * Parent pages, outermost first, as `{label, href}`. Don't include the current page.
39
44
  * In HTML pass JSON: `breadcrumbs='[{"label":"Products","href":"/products"}]'`.
@@ -62,6 +67,7 @@ export class CmPageHeader extends CmLocalizedElement {
62
67
  </ol></nav>`
63
68
  : nothing}
64
69
  <h1 part="title"><span class="text">${this.heading}</span><slot name="title-adornment"></slot></h1>
70
+ ${this.description ? html `<p class="desc" part="description">${this.description}</p>` : nothing}
65
71
  </div>
66
72
  </div>
67
73
  <div class="actions">
@@ -81,6 +87,7 @@ _CmPageHeader_instances = new WeakSet(), _CmPageHeader_emit = function _CmPageHe
81
87
  };
82
88
  CmPageHeader.properties = {
83
89
  heading: {},
90
+ description: {},
84
91
  breadcrumbs: { type: Array },
85
92
  pagination: { type: Boolean, reflect: true },
86
93
  hasPrevious: { type: Boolean, attribute: 'has-previous' },
@@ -96,7 +103,10 @@ CmPageHeader.styles = [
96
103
  background: var(--cm-bg-surface); border-bottom: var(--cm-border-1) solid var(--cm-border-subtle);
97
104
  }
98
105
  .lead { flex: 1 1 280px; display: flex; align-items: center; gap: var(--cm-space-8); min-width: 0; }
99
- .titles { min-width: 0; display: flex; flex-direction: column; gap: var(--cm-space-4); }
106
+ /* flex: 1 (issue #32): the titles column takes the room the lead has, so a title-adornment badge sits beside the
107
+ title. Without it the column shrank to the h1's min-content and the badge always wrapped under the title. */
108
+ .titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--cm-space-4); }
109
+ .desc { margin: 0; font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); overflow-wrap: anywhere; }
100
110
  nav ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
101
111
  nav li { white-space: nowrap; }
102
112
  nav li + li::before { content: '/'; padding: 0 0.35em; }
@@ -108,19 +118,26 @@ CmPageHeader.styles = [
108
118
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-4) var(--cm-space-8); margin: 0; min-width: 0;
109
119
  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);
110
120
  }
111
- /* The title keeps at least about 12 characters; badges in title-adornment wrap below it instead of pushing the page wider. */
112
- .text { flex: 0 1 auto; min-width: min(12ch, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
121
+ /* Badges in title-adornment wrap below the title only when title and badges don't fit on one line (flex-wrap breaks
122
+ lines on the title's full width), instead of pushing the page wider; a title alone on its line is cut short with
123
+ an ellipsis. No min-width: a 12ch minimum (1.2-1.5) pushed badges away from short titles (#32). */
124
+ .text { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
113
125
  .actions { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); margin-inline-start: auto; }
114
126
  .arrows { display: flex; gap: var(--cm-space-8); }
115
127
  .arrow, .back {
116
- display: inline-flex; align-items: center; justify-content: center; width: var(--cm-control-height-sm, 32px); height: var(--cm-control-height-sm, 32px); padding: 0;
128
+ position: relative; display: inline-flex; align-items: center; justify-content: center; width: var(--cm-control-height-md, 36px); height: var(--cm-control-height-md, 36px); padding: 0;
117
129
  border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
118
130
  background: var(--cm-bg-surface); color: var(--cm-icon-selected); cursor: pointer;
119
131
  }
120
132
  .arrow:hover:not(:disabled), .back:hover { background: var(--cm-bg-hover); }
133
+ .arrow:active:not(:disabled), .back:active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
121
134
  .arrow:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
122
135
  .back { display: none; border: 0; flex: none; text-decoration: none; }
123
- @media (pointer: coarse) { .arrow, .back { width: var(--cm-control-height-touch, 44px); height: var(--cm-control-height-touch, 44px); } }
136
+ /* Icon buttons (1.6): 36 x 36, 40 x 40 on touch screens with a 44px hit area. */
137
+ @media (pointer: coarse) {
138
+ .arrow, .back { width: var(--cm-control-height-lg, 40px); height: var(--cm-control-height-lg, 40px); }
139
+ .arrow::after, .back::after { content: ''; position: absolute; inset: -2px; }
140
+ }
124
141
  @media (max-width: 640px) {
125
142
  /* Title and actions share one row while they fit; otherwise the actions wrap below, so nothing spills sideways. */
126
143
  header { min-height: 48px; padding: var(--cm-space-8) var(--cm-space-16); gap: var(--cm-space-8); }
@@ -21,9 +21,10 @@ declare module '../localize.js' {
21
21
  }
22
22
  }
23
23
  /**
24
- * Moves through a long list one page at a time. A 52px bar under a list or table: rows per page on
24
+ * Moves through a long list one page at a time. A 48px bar under a list or table: rows per page on
25
25
  * the left, "Showing 21–40 of 290" in the middle, and "Page [n] of N" with previous/next arrows on
26
- * the right. On phones only the page field and arrows remain.
26
+ * the right. 13px text in tabular figures and compact 32px controls (36px when the window is 640px wide or less,
27
+ * 44px on touch screens; since 1.6, before: 14px text in a 52px bar). On phones only the page field and arrows remain.
27
28
  *
28
29
  * The component does not load data: listen for `cm-page-change` and `cm-page-size-change`, fetch,
29
30
  * then set `page` (and `total`) yourself.
@@ -24,9 +24,10 @@ const strings = defineStrings('pagination', {
24
24
  next: 'Next page',
25
25
  });
26
26
  /**
27
- * Moves through a long list one page at a time. A 52px bar under a list or table: rows per page on
27
+ * Moves through a long list one page at a time. A 48px bar under a list or table: rows per page on
28
28
  * the left, "Showing 21–40 of 290" in the middle, and "Page [n] of N" with previous/next arrows on
29
- * the right. On phones only the page field and arrows remain.
29
+ * the right. 13px text in tabular figures and compact 32px controls (36px when the window is 640px wide or less,
30
+ * 44px on touch screens; since 1.6, before: 14px text in a 52px bar). On phones only the page field and arrows remain.
30
31
  *
31
32
  * The component does not load data: listen for `cm-page-change` and `cm-page-size-change`, fetch,
32
33
  * then set `page` (and `total`) yourself.
@@ -136,8 +137,8 @@ CmPagination.styles = [
136
137
  css `
137
138
  :host { display: block; }
138
139
  nav {
139
- display: flex; align-items: center; gap: var(--cm-space-20); min-height: 52px; padding: 0 var(--cm-space-16);
140
- background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
140
+ display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
141
+ background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13);
141
142
  font-variant-numeric: tabular-nums;
142
143
  }
143
144
  .rows, .pages, .counter { display: flex; align-items: center; gap: var(--cm-space-8); white-space: nowrap; }
@@ -161,19 +162,21 @@ CmPagination.styles = [
161
162
  button:hover:not(:disabled) { border-color: var(--cm-border-strong); }
162
163
  button:disabled { color: var(--cm-text-secondary); cursor: not-allowed; }
163
164
  .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
164
- @media (pointer: coarse) {
165
- select, input { height: var(--cm-control-height-touch); }
166
- button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
167
- }
168
165
  @media (max-width: 640px) {
169
- nav { min-height: 48px;
170
- padding: 0 var(--cm-space-8); justify-content: space-between; }
166
+ nav { min-height: 48px; padding: 0 var(--cm-space-8); justify-content: space-between; }
167
+ select, input { height: var(--cm-control-height-md); }
168
+ button { width: var(--cm-control-height-md); height: var(--cm-control-height-md); }
171
169
 
172
170
  .rows, .summary { display: none; }
173
171
  .pages { flex: 1; justify-content: space-between; }
174
172
  .arrows { display: contents; }
175
173
  .prev { order: -1; }
176
174
  }
175
+ /* After the phone rule: touch screens keep 44px controls at any width. */
176
+ @media (pointer: coarse) {
177
+ select, input { height: var(--cm-control-height-touch); }
178
+ button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
179
+ }
177
180
  `,
178
181
  ];
179
182
  define('cm-pagination', CmPagination);
@@ -73,10 +73,12 @@ CmRadio.styles = [
73
73
  content: ''; position: absolute; inset: 0; margin: auto; width: 8px; height: 8px;
74
74
  border-radius: var(--cm-radius-full); background: var(--cm-bg-surface);
75
75
  }
76
+ /* Hover (1.6): an unchosen dot tints. */
77
+ :host(:not([disabled]):not([group-disabled]):not([checked])) .radio:hover .dot { background: var(--cm-bg-hover); }
76
78
  .radio:focus-visible .dot { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
77
79
  .text { display: flex; flex-direction: column; gap: 2px; }
78
80
  .label { font-size: var(--cm-type-body-md-size); line-height: var(--cm-type-body-md-line-height); }
79
- .desc { font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
81
+ .desc { font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-tertiary); }
80
82
  :host([disabled]) .radio, :host([group-disabled]) .radio { cursor: not-allowed; }
81
83
  :host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
82
84
  :host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
@@ -249,7 +251,7 @@ CmRadioGroup.styles = [
249
251
  .group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
250
252
  .label { font-size: var(--cm-type-label-size); line-height: var(--cm-type-label-line-height); font-weight: var(--cm-type-label-weight); color: var(--cm-text-default); }
251
253
  .req { color: var(--cm-text-critical); margin-inline-start: 2px; }
252
- .help, .error { margin: 0; font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
254
+ .help, .error { margin: 0; font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-tertiary); }
253
255
  .error { color: var(--cm-text-critical); }
254
256
  .options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
255
257
  :host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
@@ -35,8 +35,10 @@ declare module '../localize.js' {
35
35
  * any content. With `href` the whole row is a link; otherwise clicking a selectable row ticks it.
36
36
  * @element cm-resource-item
37
37
  * @slot - Row content: name, details, badges. To line up with a `cm-table-header`, set `columns` and give one element per column.
38
- * @slot media - A 40px thumbnail (32px on phones): a `cm-thumbnail` (recommended; `alt=""` when the row names the product) or an `<img>`.
39
- * @slot actions - Buttons at the end of the row. They do not toggle selection.
38
+ * @slot media - A 40px thumbnail (32px on phones and in compact rows): a `cm-thumbnail` (recommended; `alt=""` when the row names the product) or an `<img>`.
39
+ * @slot actions - Buttons at the end of the row. They do not toggle selection. When the row is too narrow for the
40
+ * content and the buttons (the content would get narrower than 12rem), they wrap onto a line of their own
41
+ * under the content, at the start: on phones (640px or less) by default, at any width with `actions="wrap"` (issue #31).
40
42
  * @fires cm-resource-select - `detail: { value, selected }` when the merchant ticks or unticks the row. The list handles it.
41
43
  */
42
44
  export declare class CmResourceItem extends CmLocalizedElement {
@@ -63,6 +65,12 @@ export declare class CmResourceItem extends CmLocalizedElement {
63
65
  type: BooleanConstructor;
64
66
  reflect: boolean;
65
67
  };
68
+ actions: {
69
+ reflect: boolean;
70
+ };
71
+ _hasActions: {
72
+ state: boolean;
73
+ };
66
74
  };
67
75
  /** Identifies the row in the list's `selected` array. */
68
76
  value: string;
@@ -81,6 +89,14 @@ export declare class CmResourceItem extends CmLocalizedElement {
81
89
  * `space-20` apart: the same grid as a `cm-table-header` in the list's `header` slot, so cells sit under their headings.
82
90
  */
83
91
  columns: boolean;
92
+ /**
93
+ * How the `actions` slot behaves when the row gets narrow (issue #31, since 1.6). `auto` (default): on phones (640px or
94
+ * less) the buttons wrap onto their own line under the content once the content would get narrower than 12rem.
95
+ * `wrap`: the same at any width. `inline`: the buttons always stay on the content's line (the 1.5 behaviour).
96
+ * Rows with `columns` keep their actions inline unless `actions="wrap"`.
97
+ */
98
+ actions: 'auto' | 'wrap' | 'inline';
99
+ _hasActions: boolean;
84
100
  constructor();
85
101
  connectedCallback(): void;
86
102
  static styles: import("lit").CSSResult[];
@@ -105,7 +121,7 @@ export declare class CmResourceItem extends CmLocalizedElement {
105
121
  * @element cm-resource-list
106
122
  * @slot - `cm-resource-item` rows.
107
123
  * @slot header - A `cm-table-header` (or anything) above the rows. A `cm-table-header` here is lined up with the rows, checkbox column included, and shares its row with the select-all box.
108
- * @slot bulk-actions - Buttons that act on the selection, e.g. "Bulk orders". Shown once a row is selected, in the header row: use `size="slim"` buttons (32px, the row's height).
124
+ * @slot bulk-actions - Buttons that act on the selection, e.g. "Bulk orders". Shown once a row is selected, in the header row: use `size="slim"` buttons (32px, in the 40px row).
109
125
  * @slot actions - Buttons at the end of the header row, e.g. "Customise columns". With a slotted header they get a row of their own above it.
110
126
  * @slot empty - Shown instead of the rows when there are none, e.g. a `cm-empty-state`.
111
127
  * @fires cm-selection-change - `detail: { selected, all }`: values of the selected rows, and whether every matching resource (all `total`) is selected.
@@ -141,6 +157,9 @@ export declare class CmResourceList extends CmLocalizedElement {
141
157
  attribute: string;
142
158
  };
143
159
  label: {};
160
+ density: {
161
+ reflect: boolean;
162
+ };
144
163
  _count: {
145
164
  state: boolean;
146
165
  };
@@ -173,12 +192,18 @@ export declare class CmResourceList extends CmLocalizedElement {
173
192
  hideSelectMenu: boolean;
174
193
  /** Accessible name of the list, e.g. "Products". Defaults to the plural noun. */
175
194
  label: string;
195
+ /**
196
+ * Row height (since 1.6): `comfortable` 56px rows with 40px thumbnails, or `compact` 40px rows with 32px thumbnails.
197
+ * Unset: the nearest `data-cm-density` on an ancestor, else comfortable. On touch screens rows are at least 44px tall.
198
+ */
199
+ density?: 'comfortable' | 'compact';
176
200
  _count: number;
177
201
  _rows: number;
178
202
  _hasHeader: boolean;
179
203
  _hasTable: boolean;
180
204
  _hasActions: boolean;
181
205
  static styles: import("lit").CSSResult[];
206
+ connectedCallback(): void;
182
207
  constructor();
183
208
  /** The `cm-resource-item` rows. */
184
209
  get items(): CmResourceItem[];
@@ -9,10 +9,11 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
- var _CmResourceItem_instances, _CmResourceItem_internals, _CmResourceItem_onRowClick, _CmResourceList_instances, _CmResourceList_id, _CmResourceList_headers, _CmResourceList_plural, _CmResourceList_syncHeaders, _CmResourceList_onHeaderSlot, _CmResourceList_onActionsSlot, _CmResourceList_sync, _CmResourceList_emit, _CmResourceList_menuSelect;
12
+ var _CmResourceItem_instances, _CmResourceItem_internals, _CmResourceItem_onActions, _CmResourceItem_onRowClick, _CmResourceList_instances, _CmResourceList_id, _CmResourceList_headers, _CmResourceList_plural, _CmResourceList_syncHeaders, _CmResourceList_onHeaderSlot, _CmResourceList_onActionsSlot, _CmResourceList_sync, _CmResourceList_emit, _CmResourceList_menuSelect;
13
13
  import { html, css, nothing } from 'lit';
14
14
  import { base, define, nextId } from '../base.js';
15
15
  import { CmLocalizedElement, defineStrings, pluralCategory } from '../localize.js';
16
+ import { adoptDensity } from '../density.js';
16
17
  import './icon.js';
17
18
  import './action-menu.js';
18
19
  const itemStrings = defineStrings('resourceItem', {
@@ -56,8 +57,10 @@ const checkboxStyles = css `
56
57
  * any content. With `href` the whole row is a link; otherwise clicking a selectable row ticks it.
57
58
  * @element cm-resource-item
58
59
  * @slot - Row content: name, details, badges. To line up with a `cm-table-header`, set `columns` and give one element per column.
59
- * @slot media - A 40px thumbnail (32px on phones): a `cm-thumbnail` (recommended; `alt=""` when the row names the product) or an `<img>`.
60
- * @slot actions - Buttons at the end of the row. They do not toggle selection.
60
+ * @slot media - A 40px thumbnail (32px on phones and in compact rows): a `cm-thumbnail` (recommended; `alt=""` when the row names the product) or an `<img>`.
61
+ * @slot actions - Buttons at the end of the row. They do not toggle selection. When the row is too narrow for the
62
+ * content and the buttons (the content would get narrower than 12rem), they wrap onto a line of their own
63
+ * under the content, at the start: on phones (640px or less) by default, at any width with `actions="wrap"` (issue #31).
61
64
  * @fires cm-resource-select - `detail: { value, selected }` when the merchant ticks or unticks the row. The list handles it.
62
65
  */
63
66
  export class CmResourceItem extends CmLocalizedElement {
@@ -81,6 +84,14 @@ export class CmResourceItem extends CmLocalizedElement {
81
84
  * `space-20` apart: the same grid as a `cm-table-header` in the list's `header` slot, so cells sit under their headings.
82
85
  */
83
86
  this.columns = false;
87
+ /**
88
+ * How the `actions` slot behaves when the row gets narrow (issue #31, since 1.6). `auto` (default): on phones (640px or
89
+ * less) the buttons wrap onto their own line under the content once the content would get narrower than 12rem.
90
+ * `wrap`: the same at any width. `inline`: the buttons always stay on the content's line (the 1.5 behaviour).
91
+ * Rows with `columns` keep their actions inline unless `actions="wrap"`.
92
+ */
93
+ this.actions = 'auto';
94
+ this._hasActions = false;
84
95
  _CmResourceItem_internals.set(this, this.attachInternals());
85
96
  __classPrivateFieldGet(this, _CmResourceItem_internals, "f").role = 'listitem';
86
97
  }
@@ -107,7 +118,7 @@ export class CmResourceItem extends CmLocalizedElement {
107
118
  render() {
108
119
  return html `
109
120
  ${this.href && !this.disabled ? html `<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>` : nothing}
110
- <div class="row" part="row" @click=${__classPrivateFieldGet(this, _CmResourceItem_instances, "m", _CmResourceItem_onRowClick)}>
121
+ <div class=${this._hasActions ? 'row has-actions' : 'row'} part="row" @click=${__classPrivateFieldGet(this, _CmResourceItem_instances, "m", _CmResourceItem_onRowClick)}>
111
122
  ${this.selectable
112
123
  ? html `<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t('select', { name: this.name })} .checked=${this.selected}
113
124
  ?disabled=${this.disabled} @change=${(e) => this.toggle(e.target.checked)} />
@@ -115,12 +126,14 @@ export class CmResourceItem extends CmLocalizedElement {
115
126
  : nothing}
116
127
  <span class="media"><slot name="media"></slot></span>
117
128
  <div class="content" part="content"><slot></slot></div>
118
- <div class="actions" part="actions"><slot name="actions"></slot></div>
129
+ <div class="actions" part="actions"><slot name="actions" @slotchange=${__classPrivateFieldGet(this, _CmResourceItem_instances, "m", _CmResourceItem_onActions)}></slot></div>
119
130
  </div>
120
131
  `;
121
132
  }
122
133
  }
123
- _CmResourceItem_internals = new WeakMap(), _CmResourceItem_instances = new WeakSet(), _CmResourceItem_onRowClick = function _CmResourceItem_onRowClick(e) {
134
+ _CmResourceItem_internals = new WeakMap(), _CmResourceItem_instances = new WeakSet(), _CmResourceItem_onActions = function _CmResourceItem_onActions(e) {
135
+ this._hasActions = e.target.assignedNodes().some((n) => n.nodeType === Node.ELEMENT_NODE || n.textContent?.trim());
136
+ }, _CmResourceItem_onRowClick = function _CmResourceItem_onRowClick(e) {
124
137
  if (!this.selectable || this.href || this.disabled)
125
138
  return;
126
139
  const path = e.composedPath();
@@ -138,6 +151,8 @@ CmResourceItem.properties = {
138
151
  label: {},
139
152
  selectable: { type: Boolean, reflect: true },
140
153
  columns: { type: Boolean, reflect: true },
154
+ actions: { reflect: true },
155
+ _hasActions: { state: true },
141
156
  };
142
157
  CmResourceItem.styles = [
143
158
  base,
@@ -145,21 +160,24 @@ CmResourceItem.styles = [
145
160
  css `
146
161
  :host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
147
162
  :host(:last-child) { border-bottom: 0; }
148
- /* 56px rows (a 40px thumbnail with space-8 above and below), 14px text. A cm-table-header in the list's header
149
- slot mirrors this geometry (resource-rows in table-header.ts): change both together. */
163
+ /* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
164
+ a 32px thumbnail with space-4 above and below. The list (or a data-cm-density ancestor) sets the custom
165
+ properties, see density.ts. A cm-table-header in the list's header slot mirrors the inline geometry
166
+ (resource-rows in table-header.ts): change both together. */
150
167
  .row {
151
168
  display: flex; align-items: center; gap: var(--cm-space-12); box-sizing: border-box;
152
- min-height: calc(var(--cm-control-height-lg) + 2 * var(--cm-space-8)); padding: var(--cm-space-8);
169
+ min-height: var(--cm-resource-row-height, 56px); padding: var(--cm-resource-row-padding, 8px) var(--cm-space-8);
153
170
  font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
154
171
  }
172
+ @media (pointer: coarse) { .row { min-height: max(var(--cm-resource-row-height, 56px), var(--cm-control-height-touch, 44px)); } }
155
173
  :host(:hover:not([disabled])) .row, :host([selected]) .row { background: var(--cm-bg-hover); }
156
174
  :host([selectable]:not([href]):not([disabled])) .row { cursor: pointer; }
157
175
  :host([disabled]) .row { color: var(--cm-text-tertiary); }
158
176
  .media { display: contents; }
159
177
  ::slotted([slot='media']) {
160
- flex: none; width: 40px; height: 40px; object-fit: cover; border-radius: var(--cm-radius-sm); background: var(--cm-thumb-bg);
178
+ flex: none; width: var(--cm-resource-media-size, 40px); height: var(--cm-resource-media-size, 40px); object-fit: cover; border-radius: var(--cm-radius-sm); background: var(--cm-thumb-bg);
161
179
  }
162
- ::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 40px; background: none; }
180
+ ::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: var(--cm-resource-media-size, 40px); background: none; }
163
181
  .content { flex: 1; min-width: 0; }
164
182
  :host([columns]) .content {
165
183
  display: grid; grid-template-columns: var(--cm-table-columns, minmax(0, 1fr)); column-gap: var(--cm-space-20); align-items: center;
@@ -168,10 +186,16 @@ CmResourceItem.styles = [
168
186
  a { position: absolute; inset: 0; z-index: 0; border-radius: var(--cm-radius-xs); }
169
187
  a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; }
170
188
  .check, .actions { position: relative; z-index: 1; }
171
- .actions { display: flex; gap: var(--cm-space-8); }
189
+ .actions { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
190
+ /* Wrapping actions (#31): the row wraps, the content keeps at least 12rem, so the buttons drop to their own line
191
+ (at the start) when content and buttons don't fit side by side. */
192
+ :host([actions='wrap']) .row.has-actions { flex-wrap: wrap; }
193
+ :host([actions='wrap']) .has-actions .content { flex: 1 1 12rem; }
172
194
  .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
173
195
  @media (max-width: 640px) {
174
- .row { gap: var(--cm-space-8); padding: var(--cm-space-12) 0; }
196
+ :host(:not([actions='inline']):not([columns])) .row.has-actions { flex-wrap: wrap; }
197
+ :host(:not([actions='inline']):not([columns])) .has-actions .content { flex: 1 1 12rem; }
198
+ .row { gap: var(--cm-space-8); padding-inline: 0; }
175
199
  .check { width: 20px; height: 20px; }
176
200
  ::slotted([slot='media']) { width: 32px; height: 32px; }
177
201
  ::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 32px; }
@@ -194,12 +218,16 @@ define('cm-resource-item', CmResourceItem);
194
218
  * @element cm-resource-list
195
219
  * @slot - `cm-resource-item` rows.
196
220
  * @slot header - A `cm-table-header` (or anything) above the rows. A `cm-table-header` here is lined up with the rows, checkbox column included, and shares its row with the select-all box.
197
- * @slot bulk-actions - Buttons that act on the selection, e.g. "Bulk orders". Shown once a row is selected, in the header row: use `size="slim"` buttons (32px, the row's height).
221
+ * @slot bulk-actions - Buttons that act on the selection, e.g. "Bulk orders". Shown once a row is selected, in the header row: use `size="slim"` buttons (32px, in the 40px row).
198
222
  * @slot actions - Buttons at the end of the header row, e.g. "Customise columns". With a slotted header they get a row of their own above it.
199
223
  * @slot empty - Shown instead of the rows when there are none, e.g. a `cm-empty-state`.
200
224
  * @fires cm-selection-change - `detail: { selected, all }`: values of the selected rows, and whether every matching resource (all `total`) is selected.
201
225
  */
202
226
  export class CmResourceList extends CmLocalizedElement {
227
+ connectedCallback() {
228
+ super.connectedCallback();
229
+ adoptDensity(this);
230
+ }
203
231
  constructor() {
204
232
  super();
205
233
  _CmResourceList_instances.add(this);
@@ -377,6 +405,7 @@ CmResourceList.properties = {
377
405
  allSelected: { type: Boolean, attribute: 'all-selected', reflect: true },
378
406
  hideSelectMenu: { type: Boolean, attribute: 'hide-select-menu' },
379
407
  label: {},
408
+ density: { reflect: true },
380
409
  _count: { state: true },
381
410
  _rows: { state: true },
382
411
  _hasHeader: { state: true },
@@ -388,6 +417,9 @@ CmResourceList.styles = [
388
417
  checkboxStyles,
389
418
  css `
390
419
  :host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
420
+ /* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
421
+ :host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
422
+ :host([density='comfortable']) { --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
391
423
  /* The header row. Rows sit --_pad in from the list's edges and pad space-8 inside (0 on phones), so their 16px
392
424
  checkbox starts space-20 from the edge (space-12 on phones, 20px box). The header row runs edge to edge and puts
393
425
  its box at the same place. The slotted header and the toolbar share one grid cell: the toolbar lies over the
@@ -400,7 +432,7 @@ CmResourceList.styles = [
400
432
  .header:not(.has) { display: none; }
401
433
  .toolbar {
402
434
  position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-4) var(--cm-space-8);
403
- box-sizing: border-box; min-height: var(--cm-control-height-sm);
435
+ box-sizing: border-box; min-height: var(--cm-table-header-height, 40px);
404
436
  margin-inline: calc(-1 * var(--_pad)); padding-block: 0; padding-inline: calc(var(--_pad) + var(--cm-space-8)) var(--_pad);
405
437
  font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13);
406
438
  background: var(--cm-bg-hover); box-shadow: inset 0 var(--cm-border-1) 0 var(--cm-border-subtle), inset 0 calc(-1 * var(--cm-border-1)) 0 var(--cm-border-subtle);
@@ -78,8 +78,8 @@ export declare class CmSearch extends CmLocalizedElement {
78
78
  /** Number of filters applied; shown on the filter button when above 0. */
79
79
  filterCount: number;
80
80
  /**
81
- * `default` 36px (lists, table headers); `small` 32px (toolbars and filter rows, since 1.5); `large` 40px (page-level
82
- * search). On touch screens every size is 44px.
81
+ * `default` 40px (since 1.6, owner standard; was 36px); `small` 32px (toolbars, filter rows and table headers, since 1.5);
82
+ * `large` 40px (page-level search; the same as the default since 1.6, kept for compatibility). On touch screens every size is 44px.
83
83
  */
84
84
  size: 'default' | 'small' | 'large';
85
85
  /** Blocks interaction. Also set by a disabled `<fieldset>`. */
@@ -48,8 +48,8 @@ export class CmSearch extends CmLocalizedElement {
48
48
  /** Number of filters applied; shown on the filter button when above 0. */
49
49
  this.filterCount = 0;
50
50
  /**
51
- * `default` 36px (lists, table headers); `small` 32px (toolbars and filter rows, since 1.5); `large` 40px (page-level
52
- * search). On touch screens every size is 44px.
51
+ * `default` 40px (since 1.6, owner standard; was 36px); `small` 32px (toolbars, filter rows and table headers, since 1.5);
52
+ * `large` 40px (page-level search; the same as the default since 1.6, kept for compatibility). On touch screens every size is 44px.
53
53
  */
54
54
  this.size = 'default';
55
55
  /** Blocks interaction. Also set by a disabled `<fieldset>`. */
@@ -127,6 +127,8 @@ CmSearch.styles = [
127
127
  background: var(--cm-bg-surface); color: var(--cm-text-default);
128
128
  border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
129
129
  }
130
+ /* Hover (1.6): the outline darkens; focus adds the 2px ring. */
131
+ :host(:not([disabled])) .box:hover { border-color: var(--cm-border-strong); }
130
132
  .box:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
131
133
  .icon { flex: none; color: var(--cm-text-tertiary); }
132
134
  input {
@@ -47,7 +47,7 @@ CmSegmentedControl.styles = [
47
47
  @media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
48
48
  .label {
49
49
  display: block; margin-bottom: var(--cm-space-8);
50
- font-size: var(--cm-type-label-size); line-height: var(--cm-type-label-line-height); font-weight: var(--cm-type-label-weight);
50
+ font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500;
51
51
  }
52
52
  .req { color: var(--cm-text-critical); margin-inline-start: 2px; }
53
53
  .options {