@commmerce/ui 1.21.2 → 1.21.4

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.
@@ -11,7 +11,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
11
11
  };
12
12
  var _CmActionMenu_instances, _CmActionMenu_observer, _CmActionMenu_id, _CmActionMenu_typed, _CmActionMenu_typedAt, _CmActionMenu_read, _CmActionMenu_outside, _CmActionMenu_trigger, _CmActionMenu_enabled, _CmActionMenu_setOpen, _CmActionMenu_focusActive, _CmActionMenu_fit, _CmActionMenu_layer, _CmActionMenu_triggerKey, _CmActionMenu_triggerClick, _CmActionMenu_move, _CmActionMenu_menuKey, _CmActionMenu_choose, _CmActionMenu_item, _CmActionMenu_rows;
13
13
  import { html, css, nothing } from 'lit';
14
- import { base, define, nextId } from '../base.js';
14
+ import { base, define, nextId, ignoreAlignHint } from '../base.js';
15
15
  import { CmLocalizedElement, defineStrings } from '../localize.js';
16
16
  import { readMenuItems, watchMenuItems } from './menu-item.js';
17
17
  import { TopLayer } from '../top-layer.js';
@@ -385,3 +385,4 @@ CmActionMenu.styles = [
385
385
  `,
386
386
  ];
387
387
  define('cm-action-menu', CmActionMenu);
388
+ ignoreAlignHint('cm-action-menu');
@@ -11,7 +11,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
11
11
  };
12
12
  var _CmButtonGroup_instances, _CmButtonGroup_hidden, _CmButtonGroup_mo, _CmButtonGroup_ro, _CmButtonGroup_frame, _CmButtonGroup_watched, _CmButtonGroup_refocus, _CmButtonGroup_schedule, _CmButtonGroup_mutated, _CmButtonGroup_buttons, _CmButtonGroup_restore, _CmButtonGroup_more, _CmButtonGroup_layout, _CmButtonGroup_item, _CmButtonGroup_choose, _CmButtonGroup_rescueFocus, _CmButtonGroup_focusMore, _CmButtonGroup_focusLastButton;
13
13
  import { html, css, nothing } from 'lit';
14
- import { base, define } from '../base.js';
14
+ import { base, define, ignoreAlignHint } from '../base.js';
15
15
  import { CmLocalizedElement, defineStrings } from '../localize.js';
16
16
  import './action-menu.js';
17
17
  const strings = defineStrings('buttonGroup', {
@@ -288,3 +288,4 @@ CmButtonGroup.styles = [
288
288
  `,
289
289
  ];
290
290
  define('cm-button-group', CmButtonGroup);
291
+ ignoreAlignHint('cm-button-group');
@@ -170,6 +170,9 @@ CmCard.styles = [
170
170
  .adornment { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); }
171
171
  .adornment[hidden] { display: none; }
172
172
  .desc { margin: var(--cm-space-4) 0 0; font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
173
+ /* A long unbroken heading or description (a reference number, a bank narration) breaks instead of widening the
174
+ card and the page (1.22). */
175
+ .title, .desc { overflow-wrap: anywhere; }
173
176
  .actions { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); align-items: center; }
174
177
  /* Actions on a card without a heading or description: a row of their own, at the end. */
175
178
  .bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
@@ -55,8 +55,12 @@ export interface DataTableColumn {
55
55
  * (the full value shows on hover and is always read by screen readers). `numeric` and `money` are right-aligned with
56
56
  * tabular figures; `date` sorts by date (ISO strings, timestamps or `Date` objects); numbers and dates never wrap.
57
57
  * `actions` (since 1.6) shows the column's `actions` as buttons, right-aligned, with the heading for screen readers only.
58
+ * `controls` (since 1.22, tables you write as `<table>` markup: `<th data-type="controls">`) is for cells that hold a small
59
+ * form, such as an option group with a note field. The column is start-aligned and as wide as its controls need, so
60
+ * options don't wrap one per line; on phones (`mobile="cards"`) the controls take the card's full width. `actions`
61
+ * columns stay for buttons: they are kept as narrow as possible.
58
62
  */
59
- type?: 'text' | 'numeric' | 'money' | 'date' | 'actions';
63
+ type?: 'text' | 'numeric' | 'money' | 'date' | 'actions' | 'controls';
60
64
  /** Heading for screen readers only, e.g. for an actions column. (It does not hide the column: see `visible`.) */
61
65
  hidden?: boolean;
62
66
  /** `false` leaves the column out (since 1.6). The column picker lists it, unticked, so the merchant can show it. */
@@ -72,6 +72,10 @@ cm-data-table > table th > button.cm-sort:focus-visible { outline: 2px solid var
72
72
  cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-data-table > table [data-type='money'], cm-data-table > table [data-type='actions'] { text-align: end; font-variant-numeric: tabular-nums; }
73
73
  cm-data-table > table .numeric, cm-data-table > table [data-type='numeric'], cm-data-table > table [data-type='money'], cm-data-table > table [data-type='date'] { white-space: nowrap; }
74
74
  cm-data-table > table [data-type='actions'] { width: 1%; white-space: nowrap; }
75
+ /* controls (1.22): a small form per cell. Start-aligned and as wide as the form needs (an actions column is 1% wide and
76
+ squeezed option groups to one option per line). */
77
+ cm-data-table > table [data-type='controls'] { text-align: start; white-space: normal; }
78
+ cm-data-table > table td[data-type='controls'] > * { min-inline-size: max-content; }
75
79
  cm-data-table > table td [data-lines] { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
76
80
  cm-data-table > table td [data-lines='1'] { display: block; white-space: nowrap; text-overflow: ellipsis; overflow-wrap: normal; max-inline-size: min(var(--cm-data-table-cell-max-width, 320px), 100%); }
77
81
  cm-data-table > table td [data-lines='3'] { -webkit-line-clamp: 3; line-clamp: 3; }
@@ -97,6 +101,8 @@ cm-data-table:has(> table) { container-type: inline-size; }
97
101
  cm-data-table[mobile='cards'] > table tr > :not(:first-child)[data-label]::before { content: attr(data-label); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); text-align: start; font-weight: 400; }
98
102
  cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
99
103
  cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
104
+ cm-data-table[mobile='cards'] > table td[data-type='controls'] { display: block; text-align: start; padding-block-start: var(--cm-space-8); }
105
+ cm-data-table[mobile='cards'] > table td[data-type='controls'] > * { min-inline-size: 0; }
100
106
  }
101
107
  `;
102
108
  function addLightStyles() {
@@ -425,8 +431,8 @@ _CmDataTable_userSorted = new WeakMap(), _CmDataTable_id = new WeakMap(), _CmDat
425
431
  cell.dataset.label = (th.textContent ?? '').trim();
426
432
  if (th.dataset.priority && !cell.dataset.priority)
427
433
  cell.dataset.priority = th.dataset.priority;
428
- if (th.dataset.type === 'actions' && !cell.dataset.type)
429
- cell.dataset.type = 'actions';
434
+ if ((th.dataset.type === 'actions' || th.dataset.type === 'controls') && !cell.dataset.type)
435
+ cell.dataset.type = th.dataset.type;
430
436
  });
431
437
  }
432
438
  }
@@ -1,5 +1,5 @@
1
1
  import { LitElement, html, css } from 'lit';
2
- import { base, define } from '../base.js';
2
+ import { base, define, ignoreAlignHint } from '../base.js';
3
3
  import { spaceRules } from '../spacing.js';
4
4
  /**
5
5
  * Lays out its children in a column (default) or a row, a spacing token apart. The children stay in your
@@ -47,3 +47,4 @@ CmStack.styles = [
47
47
  spaceRules('gap', 'gap'),
48
48
  ];
49
49
  define('cm-stack', CmStack);
50
+ ignoreAlignHint('cm-stack');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commmerce/ui",
3
- "version": "1.21.2",
3
+ "version": "1.21.4",
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",
@@ -128,8 +128,8 @@
128
128
  "test": "vitest run"
129
129
  },
130
130
  "dependencies": {
131
- "@commmerce/icons": "1.21.2",
132
- "@commmerce/tokens": "1.21.2",
131
+ "@commmerce/icons": "1.21.4",
132
+ "@commmerce/tokens": "1.21.4",
133
133
  "lit": "3.2.1"
134
134
  },
135
135
  "devDependencies": {