@onekeyfe/react-native-native-list 6.8.0-2 → 6.8.0-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.
@@ -257,7 +257,9 @@ stacked (phone) table (wide)
257
257
  view. Container, padding, image, `leadingGap` and `index` styles keep the
258
258
  legacy text layout.
259
259
  - *Web:* `secondaryLeadingText` precedes the primary text on the same line,
260
- badges follow it, and secondary text is directly below.
260
+ badges follow it, and secondary text is directly below. An optional
261
+ `webLeadingBadge` on a column is a passive label at the start of that line,
262
+ truncated at half of the column width; iOS and Android ignore it.
261
263
  - Table layout uses the column view on every platform (Android unstyled:
262
264
  the fixed legacy column geometry above).
263
265
  - **Style isolation:** primary and secondary text use independent style targets in
package/docs/SPEC.md CHANGED
@@ -181,10 +181,12 @@ ambiguous sources, invalid metadata and stale output. Stable sorting emits no
181
181
  machine paths or timestamps. Frozen tests compare exact registry key sets;
182
182
  this does not prove that every application-computed name is registered.
183
183
 
184
- The closed manifest contains 43 names with iOS 42, Android 41 and Web 25
184
+ The closed manifest contains 43 names with iOS 42, Android 41 and Web 26
185
185
  registry entries (including DotVerSolid). Document2Outline, WalletOutline and
186
186
  PlusLargeOutline are registered on all three platforms; TicketOutline also
187
- retains Web and adds native coverage. These main-line names use image-owned
187
+ retains Web and adds native coverage. InfoCircleOutline is registered on Web as
188
+ well as native, so a Web data-column `titleIcon` draws the host artwork rather
189
+ than the text glyph. These main-line names use image-owned
188
190
  canonical SVGs, not duplicate NativeList paths or asset catalogs.
189
191
  Existing Activity ten-name and Market/Media private call sites resolve canonical
190
192
  names through the same DOM helper; their previous coverage does not expand.
@@ -2431,6 +2433,8 @@ acceptance or a performance improvement.
2431
2433
 
2432
2434
  `DataColumn.titleIcon` and `secondaryTitleIcon` reuse `IdentityRow.titleIcon` after the primary column text. They preserve native-asset and receipt-token symbols in the desktop asset column. Web `hoverActionKey` uses the same anchored help action as Identity rows; absent icons leave the existing column layout unchanged.
2433
2435
 
2436
+ `DataColumn.webLeadingBadge?: { text: string; textColor: string; backgroundColor: string }` is an optional Web-only passive label on the primary line, placed before `secondaryLeadingText` and the primary text. The caller supplies the visible text and both colors: `text` is non-blank and within the 4096-character text limit, both colors are required `#RRGGBB` or `#RRGGBBAA` values, and no other key is accepted. The label is a 12/16 regular pill (2 by 6 padding, radius 4) that receives no pointer events and has no action, hover target, tone or style slot. While it is present the primary line spans its column, keeps the column's start, center or end alignment and uses an 8-unit gap in place of `titleBadgeGap`. The label is capped at half of the column width, padding included, and truncates with an ellipsis at that cap; the primary text keeps the remaining width and truncates after it, so neither leaves the column. A label that fits is drawn at its intrinsic width. Row height and measurement do not change. Development validation rejects a malformed badge in a snapshot and in a row patch that replaces `columns`; production drops the badge, strips undeclared keys and keeps the row. iOS and Android ignore the field, so a caller that needs the same signal there uses `titleIcon`. A column without the field renders as before. `validation.test.ts` covers the validation rules and `DataRowWebParity.test.ts` the element order, declared layout styles and row reuse in jsdom, which performs no layout. A scoped Chrome 157 measurement of the compiled renderer with `WEB_LIST_CSS` used four-column table rows 1000, 560 and 420 CSS pixels wide, all three alignments and labels of 10, 15 and 63 characters: the label stayed inside its column at no more than half of its width and the primary value kept a visible width in every case, and a label that fits kept the geometry it had without the cap. This is not app-host runtime acceptance.
2437
+
2434
2438
  `IdentityRow.titleSuffixes?: readonly { text: string; tone: 'secondary' | 'disabled'; maxWidth?: number }[]` supports up to three plain 12/16 labels on the title line. Each suffix truncates independently at its optional maximum width. This preserves Recent recipient EVM, network, and relative-time metadata without using background badges; rows without suffixes keep their present title layout.
2435
2439
 
2436
2440
  ### Web slot-list scroll ownership
@@ -702,6 +702,18 @@ function assertButtonGroup(row, path) {
702
702
  }
703
703
  });
704
704
  }
705
+
706
+ // A passive label: its text and two caller colors, with no action or style slot.
707
+ function assertWebLeadingBadge(value, path) {
708
+ if (value === undefined) return;
709
+ const badge = protocolObject(value, path);
710
+ assertUnknownKeys(badge, ['text', 'textColor', 'backgroundColor'], path, 'web leading badge key');
711
+ if (typeof badge.text !== 'string' || !badge.text.trim() || badge.text.length > MAX_TEXT_LENGTH) fail(`${path}.text`, 'must be non-blank within the text limit');
712
+ for (const field of ['textColor', 'backgroundColor']) {
713
+ const color = badge[field];
714
+ if (typeof color !== 'string' || !/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(color)) fail(`${path}.${field}`, 'must be #RRGGBB or #RRGGBBAA');
715
+ }
716
+ }
705
717
  function assertIdentityExtras(row, path) {
706
718
  for (const field of ['titleIcon', 'secondaryTitleIcon']) {
707
719
  const titleIcon = row[field];
@@ -991,6 +1003,7 @@ function assertRow(row, index, path = `rows[${index}]`) {
991
1003
  assertKey(column.key, `${path}.columns[${columnIndex}].key`);
992
1004
  assertText(column.text, `${path}.columns[${columnIndex}].text`);
993
1005
  assertIdentityExtras(column, `${path}.columns[${columnIndex}]`);
1006
+ assertWebLeadingBadge(column.webLeadingBadge, `${path}.columns[${columnIndex}].webLeadingBadge`);
994
1007
  for (const field of ['textSegments', 'secondaryTextSegments']) {
995
1008
  column[field]?.forEach((segment, segmentIndex) => {
996
1009
  assertText(segment.text, `${path}.columns[${columnIndex}].${field}[${segmentIndex}].text`);
@@ -1378,7 +1391,10 @@ function assertRowProtocol(row, path) {
1378
1391
  row.columns.forEach((column, index) => {
1379
1392
  const columnPath = `${path}.columns[${index}]`;
1380
1393
  protocolObject(column, columnPath);
1381
- if (isDevelopment()) assertIdentityExtras(column, columnPath);
1394
+ if (isDevelopment()) {
1395
+ assertIdentityExtras(column, columnPath);
1396
+ assertWebLeadingBadge(column.webLeadingBadge, `${columnPath}.webLeadingBadge`);
1397
+ }
1382
1398
  });
1383
1399
  if (isDevelopment()) assertTrailingAccessories(row.trailing, `${path}.trailing`);
1384
1400
  }
@@ -1585,7 +1601,7 @@ function sanitizeImage(value) {
1585
1601
  }
1586
1602
  const NESTED_DECORATION_FIELDS = {
1587
1603
  webTable: ['columns', 'cells', 'testID', 'draggable', 'contextMenuActionKey'],
1588
- columns: ['key', 'text', 'textSegments', 'titleIcon', 'secondaryTitleIcon', 'secondaryLeadingText', 'secondaryText', 'secondaryTextSegments', 'weight', 'alignment', 'tone', 'secondaryTone', 'width', 'minWidth', 'flex', 'paddingStart', 'paddingEnd'],
1604
+ columns: ['key', 'text', 'textSegments', 'titleIcon', 'secondaryTitleIcon', 'webLeadingBadge', 'secondaryLeadingText', 'secondaryText', 'secondaryTextSegments', 'weight', 'alignment', 'tone', 'secondaryTone', 'width', 'minWidth', 'flex', 'paddingStart', 'paddingEnd'],
1589
1605
  cells: ['key', 'kind', 'active', 'disabled', 'testID', 'hoverActionKey', 'actionKey', 'accessibilityLabel', 'leading', 'title', 'secondary', 'lineGap', 'secondaryBadges', 'hoverImages', 'hoverSecondary', 'hoverActionLabel', 'badges', 'primary', 'partGap', 'points', 'width', 'height', 'strokeColor', 'fillColor'],
1590
1606
  badges: ['key', 'text', 'tone', 'iconName', 'icon', 'textColor', 'backgroundColor', 'actionKey', 'accessibilityLabel', 'style'],
1591
1607
  overlays: ['position', 'size', 'width', 'height', 'padding', 'offset', 'offsetX', 'offsetY', 'image', 'fallbackIcon', 'name', 'text', 'fontWeight', 'tintColor', 'backgroundColor'],
@@ -1594,6 +1610,21 @@ const NESTED_DECORATION_FIELDS = {
1594
1610
  };
1595
1611
  function sanitizeDecoration(value, field) {
1596
1612
  if (value === undefined || value === null) return undefined;
1613
+ // All or nothing: a badge without valid text and both colors is dropped, and
1614
+ // only its three declared fields are kept.
1615
+ if (field === 'webLeadingBadge') {
1616
+ if (!isRecord(value) || typeof value.text !== 'string' || !value.text.trim() || value.text.length > MAX_TEXT_LENGTH) return undefined;
1617
+ const {
1618
+ textColor,
1619
+ backgroundColor
1620
+ } = value;
1621
+ if (typeof textColor !== 'string' || !/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(textColor) || typeof backgroundColor !== 'string' || !/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(backgroundColor)) return undefined;
1622
+ return {
1623
+ text: value.text,
1624
+ textColor,
1625
+ backgroundColor
1626
+ };
1627
+ }
1597
1628
  if (!Array.isArray(value) && ['image', 'networkImage', 'thumbnail', 'source', 'images', 'hoverImages'].includes(field)) return sanitizeImage(value);
1598
1629
  if (['titleImage', 'titleIcon', 'secondaryTitleIcon', 'fallbackIcon', 'cornerIcon', 'media'].includes(field) && !isRecord(value)) return undefined;
1599
1630
  if (field === 'style' && typeof value !== 'string' && !isRecord(value)) return undefined;
@@ -1969,6 +2000,7 @@ function assertPatchChanges(patch, index) {
1969
2000
  assertKey(column.key, `${path}.columns[${columnIndex}].key`);
1970
2001
  assertText(column.text, `${path}.columns[${columnIndex}].text`);
1971
2002
  assertIdentityExtras(column, `${path}.columns[${columnIndex}]`);
2003
+ assertWebLeadingBadge(column.webLeadingBadge, `${path}.columns[${columnIndex}].webLeadingBadge`);
1972
2004
  for (const field of ['textSegments', 'secondaryTextSegments']) {
1973
2005
  column[field]?.forEach((segment, segmentIndex) => {
1974
2006
  assertText(segment.text, `${path}.columns[${columnIndex}].${field}[${segmentIndex}].text`);
@@ -20,6 +20,7 @@ export const nativeListGeneratedIcons = {
20
20
  GasSolid: 'GasSolid',
21
21
  GlobusOutline: 'GlobusOutline',
22
22
  GoogleIllus: 'GoogleIllus',
23
+ InfoCircleOutline: 'InfoCircleOutline',
23
24
  LockSolid: 'LockSolid',
24
25
  PencilOutline: 'PencilOutline',
25
26
  PlusLargeOutline: 'PlusLargeOutline',
@@ -76,6 +76,40 @@ function bind(body, row, primitives) {
76
76
  cell.primary.textContent = column.text;
77
77
  applyValueSegments(cell.primary, column.textSegments, style?.columns?.fontSize ?? 14, style?.columns?.lineHeight ?? 20, fontWeight(style?.columns?.fontWeight, 500));
78
78
  if (style?.columns) primitives.textStyle(cell.primary, style.columns);
79
+ const leadingBadge = column.webLeadingBadge;
80
+ cell.leadingBadge.hidden = !leadingBadge;
81
+ cell.leadingBadge.style.cssText = '';
82
+ cell.leadingBadge.textContent = leadingBadge?.text ?? '';
83
+ if (leadingBadge) {
84
+ // The line spans the column so the badge cap is a share of the column
85
+ // rather than of the line's own content; justifyContent then carries
86
+ // the column alignment the shrink-to-fit line got from its cell.
87
+ cell.primaryLine.style.alignSelf = 'stretch';
88
+ cell.primaryLine.style.justifyContent = column.alignment === 'end' ? 'flex-end' : column.alignment === 'center' ? 'center' : 'flex-start';
89
+ cell.primaryLine.style.gap = '8px';
90
+ // A long label truncates at half the column; the primary text keeps the
91
+ // rest and truncates after it, so neither can leave the column.
92
+ cell.leadingBadge.style.display = 'block';
93
+ cell.leadingBadge.style.boxSizing = 'border-box';
94
+ cell.leadingBadge.style.flexShrink = '0';
95
+ cell.leadingBadge.style.maxWidth = '50%';
96
+ cell.leadingBadge.style.overflow = 'hidden';
97
+ cell.leadingBadge.style.textOverflow = 'ellipsis';
98
+ cell.leadingBadge.style.whiteSpace = 'nowrap';
99
+ cell.leadingBadge.style.padding = '2px 6px';
100
+ cell.leadingBadge.style.borderRadius = '4px';
101
+ cell.leadingBadge.style.fontSize = '12px';
102
+ cell.leadingBadge.style.lineHeight = '16px';
103
+ cell.leadingBadge.style.fontWeight = '400';
104
+ cell.leadingBadge.style.fontFamily = 'var(--nl-font-regular)';
105
+ cell.leadingBadge.style.color = leadingBadge.textColor;
106
+ cell.leadingBadge.style.backgroundColor = leadingBadge.backgroundColor;
107
+ cell.leadingBadge.style.pointerEvents = 'none';
108
+ cell.primary.style.minWidth = '0';
109
+ cell.primary.style.overflow = 'hidden';
110
+ cell.primary.style.textOverflow = 'ellipsis';
111
+ cell.primary.style.whiteSpace = 'nowrap';
112
+ }
79
113
  cell.titleIcons.replaceChildren();
80
114
  if (column.titleIcon || column.secondaryTitleIcon) {
81
115
  cell.primary.style.minWidth = '0';
@@ -134,10 +168,12 @@ function create(document, row, primitives) {
134
168
  const cell = createElement(document, 'span', 'ok-native-list-data-cell');
135
169
  const primaryLine = createElement(document, 'span', 'ok-native-list-data-primary');
136
170
  const primary = tagSlot(createElement(document, 'span'), 'columns');
171
+ const leadingBadge = createElement(document, 'span', 'ok-native-list-data-leading-badge');
172
+ leadingBadge.hidden = true;
137
173
  const titleIcons = createElement(document, 'span');
138
174
  titleIcons.style.display = 'contents';
139
175
  const badges = createElement(document, 'span');
140
- primaryLine.append(primary, titleIcons, badges);
176
+ primaryLine.append(leadingBadge, primary, titleIcons, badges);
141
177
  const secondaryLine = createElement(document, 'span', 'ok-native-list-data-secondary-line');
142
178
  const secondary = Array.from({
143
179
  length: 2
@@ -149,6 +185,7 @@ function create(document, row, primitives) {
149
185
  body: cell,
150
186
  primaryLine,
151
187
  primary,
188
+ leadingBadge,
152
189
  titleIcons,
153
190
  badges,
154
191
  secondaryLine,
@@ -524,6 +524,15 @@ export type DataColumn = Readonly<{
524
524
  textSegments?: readonly ValueTextSegment[];
525
525
  titleIcon?: IdentityRow['titleIcon'];
526
526
  secondaryTitleIcon?: IdentityRow['titleIcon'];
527
+ /**
528
+ * Web-only passive label before the primary column text. The caller supplies
529
+ * both colors as #RRGGBB or #RRGGBBAA; native renderers ignore the field.
530
+ */
531
+ webLeadingBadge?: Readonly<{
532
+ text: string;
533
+ textColor: string;
534
+ backgroundColor: string;
535
+ }>;
527
536
  secondaryLeadingText?: string;
528
537
  secondaryText?: string;
529
538
  secondaryTextSegments?: readonly ValueTextSegment[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "6.8.0-2",
3
+ "version": "6.8.0-4",
4
4
  "description": "Template-driven native RecyclerView and UICollectionView for React Native",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",
@@ -124,6 +124,7 @@ const migrationCoverage = {
124
124
  'GasSolid',
125
125
  'GlobusOutline',
126
126
  'GoogleIllus',
127
+ 'InfoCircleOutline',
127
128
  'LockSolid',
128
129
  'PencilOutline',
129
130
  'PlusLargeOutline',
@@ -158,7 +158,7 @@
158
158
  {
159
159
  "name": "InfoCircleOutline",
160
160
  "source": "outline/info-circle.svg",
161
- "platforms": ["ios", "android"],
161
+ "platforms": ["ios", "android", "web"],
162
162
  "rendering": "template"
163
163
  },
164
164
  {
package/src/models.ts CHANGED
@@ -650,6 +650,15 @@ export type DataColumn = Readonly<{
650
650
  textSegments?: readonly ValueTextSegment[];
651
651
  titleIcon?: IdentityRow['titleIcon'];
652
652
  secondaryTitleIcon?: IdentityRow['titleIcon'];
653
+ /**
654
+ * Web-only passive label before the primary column text. The caller supplies
655
+ * both colors as #RRGGBB or #RRGGBBAA; native renderers ignore the field.
656
+ */
657
+ webLeadingBadge?: Readonly<{
658
+ text: string;
659
+ textColor: string;
660
+ backgroundColor: string;
661
+ }>;
653
662
  secondaryLeadingText?: string;
654
663
  secondaryText?: string;
655
664
  secondaryTextSegments?: readonly ValueTextSegment[];
package/src/validation.ts CHANGED
@@ -1344,6 +1344,32 @@ function assertButtonGroup(
1344
1344
  });
1345
1345
  }
1346
1346
 
1347
+ // A passive label: its text and two caller colors, with no action or style slot.
1348
+ function assertWebLeadingBadge(value: unknown, path: string): void {
1349
+ if (value === undefined) return;
1350
+ const badge = protocolObject(value, path);
1351
+ assertUnknownKeys(
1352
+ badge,
1353
+ ['text', 'textColor', 'backgroundColor'],
1354
+ path,
1355
+ 'web leading badge key'
1356
+ );
1357
+ if (
1358
+ typeof badge.text !== 'string' ||
1359
+ !badge.text.trim() ||
1360
+ badge.text.length > MAX_TEXT_LENGTH
1361
+ )
1362
+ fail(`${path}.text`, 'must be non-blank within the text limit');
1363
+ for (const field of ['textColor', 'backgroundColor']) {
1364
+ const color = badge[field];
1365
+ if (
1366
+ typeof color !== 'string' ||
1367
+ !/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(color)
1368
+ )
1369
+ fail(`${path}.${field}`, 'must be #RRGGBB or #RRGGBBAA');
1370
+ }
1371
+ }
1372
+
1347
1373
  function assertIdentityExtras(
1348
1374
  row: Pick<
1349
1375
  IdentityRow,
@@ -1939,6 +1965,10 @@ function assertRow(
1939
1965
  assertKey(column.key, `${path}.columns[${columnIndex}].key`);
1940
1966
  assertText(column.text, `${path}.columns[${columnIndex}].text`);
1941
1967
  assertIdentityExtras(column, `${path}.columns[${columnIndex}]`);
1968
+ assertWebLeadingBadge(
1969
+ column.webLeadingBadge,
1970
+ `${path}.columns[${columnIndex}].webLeadingBadge`
1971
+ );
1942
1972
  for (const field of [
1943
1973
  'textSegments',
1944
1974
  'secondaryTextSegments',
@@ -3048,7 +3078,13 @@ function assertRowProtocol(row: RowModel, path: string): void {
3048
3078
  row.columns.forEach((column, index) => {
3049
3079
  const columnPath = `${path}.columns[${index}]`;
3050
3080
  protocolObject(column, columnPath);
3051
- if (isDevelopment()) assertIdentityExtras(column, columnPath);
3081
+ if (isDevelopment()) {
3082
+ assertIdentityExtras(column, columnPath);
3083
+ assertWebLeadingBadge(
3084
+ column.webLeadingBadge,
3085
+ `${columnPath}.webLeadingBadge`
3086
+ );
3087
+ }
3052
3088
  });
3053
3089
  if (isDevelopment())
3054
3090
  assertTrailingAccessories(row.trailing, `${path}.trailing`);
@@ -3507,6 +3543,7 @@ const NESTED_DECORATION_FIELDS: Readonly<Record<string, readonly string[]>> = {
3507
3543
  'textSegments',
3508
3544
  'titleIcon',
3509
3545
  'secondaryTitleIcon',
3546
+ 'webLeadingBadge',
3510
3547
  'secondaryLeadingText',
3511
3548
  'secondaryText',
3512
3549
  'secondaryTextSegments',
@@ -3581,6 +3618,26 @@ const NESTED_DECORATION_FIELDS: Readonly<Record<string, readonly string[]>> = {
3581
3618
 
3582
3619
  function sanitizeDecoration(value: unknown, field: string): unknown {
3583
3620
  if (value === undefined || value === null) return undefined;
3621
+ // All or nothing: a badge without valid text and both colors is dropped, and
3622
+ // only its three declared fields are kept.
3623
+ if (field === 'webLeadingBadge') {
3624
+ if (
3625
+ !isRecord(value) ||
3626
+ typeof value.text !== 'string' ||
3627
+ !value.text.trim() ||
3628
+ value.text.length > MAX_TEXT_LENGTH
3629
+ )
3630
+ return undefined;
3631
+ const { textColor, backgroundColor } = value;
3632
+ if (
3633
+ typeof textColor !== 'string' ||
3634
+ !/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(textColor) ||
3635
+ typeof backgroundColor !== 'string' ||
3636
+ !/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(backgroundColor)
3637
+ )
3638
+ return undefined;
3639
+ return { text: value.text, textColor, backgroundColor };
3640
+ }
3584
3641
  if (
3585
3642
  !Array.isArray(value) &&
3586
3643
  [
@@ -4401,6 +4458,10 @@ function assertPatchChanges(patch: PatchValues, index: number): void {
4401
4458
  assertKey(column.key, `${path}.columns[${columnIndex}].key`);
4402
4459
  assertText(column.text, `${path}.columns[${columnIndex}].text`);
4403
4460
  assertIdentityExtras(column, `${path}.columns[${columnIndex}]`);
4461
+ assertWebLeadingBadge(
4462
+ column.webLeadingBadge,
4463
+ `${path}.columns[${columnIndex}].webLeadingBadge`
4464
+ );
4404
4465
  for (const field of [
4405
4466
  'textSegments',
4406
4467
  'secondaryTextSegments',
@@ -18,6 +18,7 @@ export const nativeListGeneratedIcons: Readonly<Record<string, string>> = {
18
18
  GasSolid: 'GasSolid',
19
19
  GlobusOutline: 'GlobusOutline',
20
20
  GoogleIllus: 'GoogleIllus',
21
+ InfoCircleOutline: 'InfoCircleOutline',
21
22
  LockSolid: 'LockSolid',
22
23
  PencilOutline: 'PencilOutline',
23
24
  PlusLargeOutline: 'PlusLargeOutline',
@@ -11,6 +11,7 @@ type ColumnViews = {
11
11
  body: HTMLElement;
12
12
  primaryLine: HTMLElement;
13
13
  primary: HTMLElement;
14
+ leadingBadge: HTMLElement;
14
15
  titleIcons: HTMLElement;
15
16
  badges: HTMLElement;
16
17
  secondaryLine: HTMLElement;
@@ -137,6 +138,45 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
137
138
  fontWeight(style?.columns?.fontWeight, 500)
138
139
  );
139
140
  if (style?.columns) primitives.textStyle(cell.primary, style.columns);
141
+ const leadingBadge = column.webLeadingBadge;
142
+ cell.leadingBadge.hidden = !leadingBadge;
143
+ cell.leadingBadge.style.cssText = '';
144
+ cell.leadingBadge.textContent = leadingBadge?.text ?? '';
145
+ if (leadingBadge) {
146
+ // The line spans the column so the badge cap is a share of the column
147
+ // rather than of the line's own content; justifyContent then carries
148
+ // the column alignment the shrink-to-fit line got from its cell.
149
+ cell.primaryLine.style.alignSelf = 'stretch';
150
+ cell.primaryLine.style.justifyContent =
151
+ column.alignment === 'end'
152
+ ? 'flex-end'
153
+ : column.alignment === 'center'
154
+ ? 'center'
155
+ : 'flex-start';
156
+ cell.primaryLine.style.gap = '8px';
157
+ // A long label truncates at half the column; the primary text keeps the
158
+ // rest and truncates after it, so neither can leave the column.
159
+ cell.leadingBadge.style.display = 'block';
160
+ cell.leadingBadge.style.boxSizing = 'border-box';
161
+ cell.leadingBadge.style.flexShrink = '0';
162
+ cell.leadingBadge.style.maxWidth = '50%';
163
+ cell.leadingBadge.style.overflow = 'hidden';
164
+ cell.leadingBadge.style.textOverflow = 'ellipsis';
165
+ cell.leadingBadge.style.whiteSpace = 'nowrap';
166
+ cell.leadingBadge.style.padding = '2px 6px';
167
+ cell.leadingBadge.style.borderRadius = '4px';
168
+ cell.leadingBadge.style.fontSize = '12px';
169
+ cell.leadingBadge.style.lineHeight = '16px';
170
+ cell.leadingBadge.style.fontWeight = '400';
171
+ cell.leadingBadge.style.fontFamily = 'var(--nl-font-regular)';
172
+ cell.leadingBadge.style.color = leadingBadge.textColor;
173
+ cell.leadingBadge.style.backgroundColor = leadingBadge.backgroundColor;
174
+ cell.leadingBadge.style.pointerEvents = 'none';
175
+ cell.primary.style.minWidth = '0';
176
+ cell.primary.style.overflow = 'hidden';
177
+ cell.primary.style.textOverflow = 'ellipsis';
178
+ cell.primary.style.whiteSpace = 'nowrap';
179
+ }
140
180
  cell.titleIcons.replaceChildren();
141
181
  if (column.titleIcon || column.secondaryTitleIcon) {
142
182
  cell.primary.style.minWidth = '0';
@@ -238,10 +278,16 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
238
278
  'ok-native-list-data-primary'
239
279
  );
240
280
  const primary = tagSlot(createElement(document, 'span'), 'columns');
281
+ const leadingBadge = createElement(
282
+ document,
283
+ 'span',
284
+ 'ok-native-list-data-leading-badge'
285
+ );
286
+ leadingBadge.hidden = true;
241
287
  const titleIcons = createElement(document, 'span');
242
288
  titleIcons.style.display = 'contents';
243
289
  const badges = createElement(document, 'span');
244
- primaryLine.append(primary, titleIcons, badges);
290
+ primaryLine.append(leadingBadge, primary, titleIcons, badges);
245
291
  const secondaryLine = createElement(
246
292
  document,
247
293
  'span',
@@ -260,6 +306,7 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
260
306
  body: cell,
261
307
  primaryLine,
262
308
  primary,
309
+ leadingBadge,
263
310
  titleIcons,
264
311
  badges,
265
312
  secondaryLine,