@nyaruka/temba-components 0.159.4 → 0.159.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyaruka/temba-components",
3
- "version": "0.159.4",
3
+ "version": "0.159.5",
4
4
  "description": "Web components to support rapidpro and related projects",
5
5
  "author": "Nyaruka <code@nyaruka.coim>",
6
6
  "main": "dist/index.js",
package/src/interfaces.ts CHANGED
@@ -114,9 +114,9 @@ export interface Flow {
114
114
  /** Completion ratio in the range 0–1. */
115
115
  completion: number;
116
116
  has_issues: boolean;
117
- status: 'active' | 'archived' | string;
118
117
  labels: ObjectReference[];
119
- /** Recent run counts, oldest to newest — rendered as a sparkline. */
118
+ /** Recent daily engagement counts, oldest to newest — rendered as
119
+ * a sparkline. Empty when there's been no recent engagement. */
120
120
  activity: number[];
121
121
  }
122
122
 
@@ -918,14 +918,12 @@ export class ContentList<T = any> extends RapidElement {
918
918
  color: var(--accent-700);
919
919
  }
920
920
 
921
- /* Leading entity-type icon — a small icon shared by every row
922
- (contact silhouette, flow type icon, etc.). It rides inside the
921
+ /* Leading entity-type icon — a small icon flagging a row (contact
922
+ silhouette, voice/background flow, etc.). It rides inside the
923
923
  first column's cell rather than in its own column, so the column
924
- header aligns with the icon (the row's leading content) rather
925
- than the value beside it and the alignment reads the same
926
- whether or not the list has a leading icon. Subclasses override
927
- {@link getRowIcon}; when it returns null for every row no space
928
- is reserved (see {@link reservesIcon}). */
924
+ header aligns with the row's leading content. Subclasses
925
+ override {@link getRowIcon}; a row whose icon is null renders
926
+ its value flush at the column edge with no reserved gutter. */
929
927
  .lead-wrap {
930
928
  display: flex;
931
929
  align-items: center;
@@ -934,12 +932,12 @@ export class ContentList<T = any> extends RapidElement {
934
932
  .lead-wrap .cell-inner {
935
933
  min-width: 0;
936
934
  }
937
- /* Reserve the icon's 1em footprint plus a snug 5px gap to the
938
- value whether or not this row has an icon, so values stay
939
- aligned down the column. The fixed box also keeps the column's
940
- intrinsic width stable while <temba-icon> upgrades without it
941
- the column briefly measures narrow and downstream pinned columns
942
- jump, which races with whatever moment we snapshot. */
935
+ /* The icon's 1em footprint plus a snug 5px gap to the value.
936
+ The fixed box keeps the column's intrinsic width stable while
937
+ <temba-icon> upgrades without it the column briefly measures
938
+ narrow and downstream pinned columns jump, which races with
939
+ whatever moment we snapshot. Rows without an icon don't render
940
+ this box at all their value sits flush at the column edge. */
943
941
  .lead-icon {
944
942
  flex: 0 0 auto;
945
943
  display: flex;
@@ -2380,11 +2378,14 @@ export class ContentList<T = any> extends RapidElement {
2380
2378
  * cells pin alongside them so identity stays anchored); right-
2381
2379
  * pinned columns contiguous to the last. */
2382
2380
  private computePinLayout(): void {
2383
- // Reserve an empty leading-icon column when any row would carry
2384
- // an icon probe a representative row, then skip the icon
2385
- // per-row if that row's own getRowIcon returns null.
2386
- this.reservesIcon =
2387
- this.items.length > 0 && this.getRowIcon(this.items[0]) !== null;
2381
+ // Whether any row on this page carries a leading icon — probe
2382
+ // every row (a page can lead with icon-less rows, e.g. message
2383
+ // flows). Rows render their icon inline (no gutter on icon-less
2384
+ // rows); this flag just marks the first column's cells as
2385
+ // lead-cells for alignment lookups.
2386
+ this.reservesIcon = this.items.some(
2387
+ (item) => this.getRowIcon(item) !== null
2388
+ );
2388
2389
  this.pinIndexByColumn = new Map();
2389
2390
  this.rightPinIndexByColumn = new Map();
2390
2391
  this.checkPinIndex = -1;
@@ -2728,8 +2729,9 @@ export class ContentList<T = any> extends RapidElement {
2728
2729
  `;
2729
2730
  // The first column carries the row's leading icon (when the list
2730
2731
  // reserves one), so its header aligns with the icon rather than the
2731
- // value. A row with no icon still reserves the space to keep values
2732
- // aligned down the column.
2732
+ // value. A row with no icon renders its value flush at the column
2733
+ // edge the icon is an inline flag on the rows that have one (e.g.
2734
+ // voice flows), not a gutter every row indents around.
2733
2735
  const lead = isLead && this.reservesIcon;
2734
2736
  const icon = lead ? this.getRowIcon(item) : null;
2735
2737
  return html`
@@ -2738,12 +2740,10 @@ export class ContentList<T = any> extends RapidElement {
2738
2740
  ''} ${column.grow ? 'grow' : ''} ${this.columnPinClass(column)}"
2739
2741
  style=${this.columnPinStyle(column)}
2740
2742
  >
2741
- ${lead
2743
+ ${icon
2742
2744
  ? html`<div class="lead-wrap">
2743
2745
  <span class="lead-icon"
2744
- >${icon
2745
- ? html`<temba-icon name=${icon} size="1"></temba-icon>`
2746
- : null}</span
2746
+ ><temba-icon name=${icon} size="1"></temba-icon></span
2747
2747
  >${inner}
2748
2748
  </div>`
2749
2749
  : inner}
@@ -5,10 +5,10 @@ import { Flow, ObjectReference } from '../interfaces';
5
5
 
6
6
  /**
7
7
  * Flow CRUDL list — drop-in replacement for the rapidpro
8
- * `flows/flow_list.html` table. Each row's leading icon reflects
9
- * the flow type (messaging / voice / background / surveyor).
10
- * Columns: name, status, runs, ongoing, completion bar, activity
11
- * sparkline.
8
+ * `flows/flow_list.html` table. Rows of the unusual flow types
9
+ * (voice / background / surveyor) carry a leading type icon;
10
+ * message flows don't. Columns: name, runs, ongoing, completion
11
+ * bar, activity sparkline.
12
12
  */
13
13
  export class FlowList extends ContentList<Flow> {
14
14
  static get styles() {
@@ -92,7 +92,6 @@ export class FlowList extends ContentList<Flow> {
92
92
  width: '280px',
93
93
  pinned: true
94
94
  },
95
- { key: 'status', label: 'Status', width: '110px' },
96
95
  {
97
96
  key: 'runs',
98
97
  label: 'Runs',
@@ -137,7 +136,9 @@ export class FlowList extends ContentList<Flow> {
137
136
  case 'survey':
138
137
  return Icon.flow_surveyor;
139
138
  default:
140
- return Icon.flow_message;
139
+ // message flows are the common case and carry no icon — only
140
+ // the unusual types get flagged, matching the legacy table
141
+ return null;
141
142
  }
142
143
  }
143
144
 
@@ -183,8 +184,6 @@ export class FlowList extends ContentList<Flow> {
183
184
  return this.renderCompletion(item);
184
185
  case 'activity':
185
186
  return this.renderSparkline(item.activity || []);
186
- case 'status':
187
- return this.renderFlowStatus(item);
188
187
  default:
189
188
  return super.renderCell(item, column);
190
189
  }
@@ -235,11 +234,4 @@ export class FlowList extends ContentList<Flow> {
235
234
  </svg>
236
235
  `;
237
236
  }
238
-
239
- private renderFlowStatus(item: Flow): TemplateResult {
240
- const status = (item.status || 'active').toString().toLowerCase();
241
- const kind = status === 'archived' ? 'archived' : 'active';
242
- const label = status === 'archived' ? 'Archived' : 'Active';
243
- return this.renderStatusPill(kind, label);
244
- }
245
237
  }