@ankhorage/zora 27.6.1 → 27.7.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 (82) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +94 -5
  4. package/dist/capabilities/index.js.map +5 -5
  5. package/dist/constants/authoring.d.ts +4 -3
  6. package/dist/constants/authoring.d.ts.map +1 -1
  7. package/dist/constants/authoring.js +2 -0
  8. package/dist/constants/authoring.js.map +1 -1
  9. package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
  10. package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
  11. package/dist/features/card/cardMeta.d.ts +1 -1
  12. package/dist/features/card/mediaCardMeta.d.ts +1 -1
  13. package/dist/features/card/postCardMeta.d.ts +1 -1
  14. package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
  15. package/dist/features/data-table/adapters/inbound/DataTable.d.ts.map +1 -1
  16. package/dist/features/data-table/adapters/inbound/DataTable.js +90 -18
  17. package/dist/features/data-table/adapters/inbound/DataTable.js.map +1 -1
  18. package/dist/features/data-table/dataTableMeta.d.ts +63 -0
  19. package/dist/features/data-table/dataTableMeta.d.ts.map +1 -1
  20. package/dist/features/data-table/dataTableMeta.js +42 -0
  21. package/dist/features/data-table/dataTableMeta.js.map +1 -1
  22. package/dist/features/data-table/public.d.ts +1 -1
  23. package/dist/features/data-table/public.d.ts.map +1 -1
  24. package/dist/features/data-table/public.js.map +1 -1
  25. package/dist/features/dialog/dialogMeta.d.ts +2 -2
  26. package/dist/features/gradient/gradientMeta.d.ts +1 -1
  27. package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
  28. package/dist/features/layout/gridMeta.d.ts +1 -1
  29. package/dist/features/layout/screenMeta.d.ts +1 -1
  30. package/dist/features/layout/scrollViewMeta.d.ts +1 -1
  31. package/dist/features/layout/viewMeta.d.ts +1 -1
  32. package/dist/features/list/flatListMeta.d.ts +1 -1
  33. package/dist/features/list/sectionListMeta.d.ts +1 -1
  34. package/dist/features/reader/meta.d.ts +2 -2
  35. package/dist/features/registry/bindableComponentMeta.d.ts +42 -3
  36. package/dist/features/registry/bindableComponentMeta.d.ts.map +1 -1
  37. package/dist/features/registry/bindableComponentMeta.js +27 -10
  38. package/dist/features/registry/bindableComponentMeta.js.map +1 -1
  39. package/dist/features/scanner/meta.d.ts +2 -2
  40. package/dist/features/section/screenSectionMeta.d.ts +1 -1
  41. package/dist/features/surface/surfaceMeta.d.ts +1 -1
  42. package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
  43. package/dist/features/timeline/meta.d.ts +79 -3
  44. package/dist/features/timeline/meta.d.ts.map +1 -1
  45. package/dist/features/timeline/meta.js +50 -3
  46. package/dist/features/timeline/meta.js.map +1 -1
  47. package/dist/features/timeline/public.d.ts +1 -1
  48. package/dist/features/timeline/public.d.ts.map +1 -1
  49. package/dist/features/timeline/public.js.map +1 -1
  50. package/dist/readerFree.d.ts +2 -2
  51. package/dist/readerFree.d.ts.map +1 -1
  52. package/dist/readerFree.js.map +1 -1
  53. package/dist/types/data-table.d.ts +37 -0
  54. package/dist/types/data-table.d.ts.map +1 -1
  55. package/dist/types/data-table.js.map +1 -1
  56. package/dist/types/timeline.d.ts +16 -0
  57. package/dist/types/timeline.d.ts.map +1 -1
  58. package/dist/types/timeline.js.map +1 -1
  59. package/package.json +50 -1
  60. package/src/constants/authoring.ts +2 -0
  61. package/src/features/data-table/adapters/inbound/DataTable.test.tsx +127 -6
  62. package/src/features/data-table/adapters/inbound/DataTable.tsx +149 -24
  63. package/src/features/data-table/dataTableMeta.test.ts +23 -0
  64. package/src/features/data-table/dataTableMeta.ts +42 -0
  65. package/src/features/data-table/public.ts +4 -0
  66. package/src/features/registry/bindableComponentMeta.ts +27 -10
  67. package/src/features/registry/componentMeta.test.ts +45 -0
  68. package/src/features/timeline/manifest.test.tsx +115 -0
  69. package/src/features/timeline/meta.ts +50 -3
  70. package/src/features/timeline/public.ts +6 -1
  71. package/src/readerFree.ts +10 -1
  72. package/src/types/data-table.ts +45 -0
  73. package/src/types/timeline.ts +18 -0
  74. package/web-dist/components/data-table/DataTable.d.ts +1 -1
  75. package/web-dist/components/data-table/DataTable.dependency-3.d.ts +1 -0
  76. package/web-dist/components/data-table/DataTable.js +128 -17
  77. package/web-dist/components/data-table/DataTable.types-0.d.ts +42 -0
  78. package/web-dist/components/data-table/index.d.ts +1 -1
  79. package/web-dist/components/timeline/Timeline.d.ts +1 -1
  80. package/web-dist/components/timeline/Timeline.types-0.d.ts +19 -0
  81. package/web-dist/components/timeline/index.d.ts +1 -1
  82. package/web-dist/manifest.json +1 -0
@@ -1,10 +1,11 @@
1
1
  import type { InteractionPolicy } from '@ankhorage/surface';
2
2
  import { Show } from '@ankhorage/surface';
3
3
  import React from 'react';
4
- import { ScrollView, type ViewStyle } from 'react-native';
4
+ import { Linking, Pressable, ScrollView, type ViewStyle } from 'react-native';
5
5
 
6
6
  import type {
7
7
  DataTableCellContext,
8
+ DataTableCellSpec,
8
9
  DataTableColumn,
9
10
  DataTableColumnAlign,
10
11
  DataTableDensity,
@@ -12,11 +13,11 @@ import type {
12
13
  DataTableRowAction,
13
14
  DataTableSortDirection,
14
15
  } from '../../../../types/data-table';
15
- import { Button } from '../../../button/public';
16
- import { IconButton } from '../../../button/public';
16
+ import { Button, IconButton } from '../../../button/public';
17
17
  import { Card } from '../../../card/public';
18
18
  import { EmptyState } from '../../../empty-state/public';
19
19
  import { Checkbox } from '../../../form/checkbox/public';
20
+ import { Image } from '../../../image/public';
20
21
  import { View } from '../../../layout/public';
21
22
  import { PopoverMenu, type PopoverMenuAction } from '../../../popover-menu/public';
22
23
  import { SkeletonList } from '../../../skeleton/public';
@@ -101,6 +102,76 @@ function renderDefaultCell(value: unknown): React.ReactNode {
101
102
  return '—';
102
103
  }
103
104
 
105
+ /** Reads a manifest cell field without accepting executable accessor behavior. */
106
+ function resolveCellField<TRow extends object>(row: TRow, field: keyof TRow): unknown {
107
+ return Object.getOwnPropertyDescriptor(row, field)?.value;
108
+ }
109
+
110
+ /** Resolves a row value into a string suitable for portable text and URL presentation. */
111
+ function resolveCellString(value: unknown): string | undefined {
112
+ return typeof value === 'string' || typeof value === 'number' ? String(value) : undefined;
113
+ }
114
+
115
+ /*** Resolves an untrusted row value to the HTTP(S) URL accepted by the platform navigation boundary. */
116
+ function resolveExternalWebsiteUrl(url: string): string | undefined {
117
+ try {
118
+ const parsedUrl = new URL(url);
119
+ return parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:' ? url : undefined;
120
+ } catch {
121
+ return undefined;
122
+ }
123
+ }
124
+
125
+ /** Opens a validated portable website cell through React Native's platform URL boundary. */
126
+ function openExternalUrl(url: string): void {
127
+ const externalUrl = resolveExternalWebsiteUrl(url);
128
+ if (externalUrl) {
129
+ void Linking.openURL(externalUrl);
130
+ }
131
+ }
132
+
133
+ /** Renders one serializable manifest cell specification with canonical ZORA primitives. */
134
+ function renderPortableCell<TRow extends object>(
135
+ cell: DataTableCellSpec<TRow>,
136
+ row: TRow,
137
+ ): React.ReactNode {
138
+ switch (cell.kind) {
139
+ case 'image': {
140
+ const source = resolveCellString(resolveCellField(row, cell.source));
141
+ const alt = resolveCellString(resolveCellField(row, cell.alt ?? cell.source));
142
+ return <Image alt={alt} height={32} radius="s" source={source} width={32} />;
143
+ }
144
+ case 'text':
145
+ return (
146
+ <Text variant={cell.variant ?? 'bodySmall'} weight={cell.weight}>
147
+ {renderDefaultCell(resolveCellField(row, cell.value))}
148
+ </Text>
149
+ );
150
+ case 'link': {
151
+ const href = resolveCellString(resolveCellField(row, cell.href));
152
+ const label = resolveCellString(resolveCellField(row, cell.label ?? cell.href)) ?? href;
153
+ const externalUrl = href ? resolveExternalWebsiteUrl(href) : undefined;
154
+ return externalUrl ? (
155
+ <Pressable accessibilityRole="link" onPress={() => openExternalUrl(externalUrl)}>
156
+ <Text color="primary" variant={cell.variant ?? 'bodySmall'} weight="medium">
157
+ {label}
158
+ </Text>
159
+ </Pressable>
160
+ ) : (
161
+ <Text variant="bodySmall">—</Text>
162
+ );
163
+ }
164
+ case 'stack':
165
+ return (
166
+ <View align={cell.align} direction={cell.direction} gap={cell.gap}>
167
+ {cell.children.map((child, index) => (
168
+ <React.Fragment key={`cell-${index}`}>{renderPortableCell(child, row)}</React.Fragment>
169
+ ))}
170
+ </View>
171
+ );
172
+ }
173
+ }
174
+
104
175
  function createCellContext<TRow extends object>(
105
176
  column: DataTableColumn<TRow>,
106
177
  row: TRow,
@@ -120,7 +191,9 @@ function renderCell<TRow extends object>(
120
191
  rowIndex: number,
121
192
  ) {
122
193
  const context = createCellContext(column, row, rowIndex);
123
- return column.renderCell ? column.renderCell(context) : renderDefaultCell(context.value);
194
+ if (column.renderCell) return column.renderCell(context);
195
+ if (column.cell) return renderPortableCell(column.cell, row);
196
+ return renderDefaultCell(context.value);
124
197
  }
125
198
 
126
199
  function renderTableCell<TRow extends object>(
@@ -128,9 +201,8 @@ function renderTableCell<TRow extends object>(
128
201
  row: TRow,
129
202
  rowIndex: number,
130
203
  ) {
131
- if (column.renderCell) {
132
- return column.renderCell(createCellContext(column, row, rowIndex));
133
- }
204
+ if (column.renderCell) return column.renderCell(createCellContext(column, row, rowIndex));
205
+ if (column.cell) return renderPortableCell(column.cell, row);
134
206
 
135
207
  return (
136
208
  <Text align={resolveTextAlign(column.align)} variant="bodySmall">
@@ -168,6 +240,16 @@ function resolveNextVisibleSelection(
168
240
  : selectedRowIds.filter((selectedRowId) => !visibleRowIdSet.has(selectedRowId));
169
241
  }
170
242
 
243
+ /** Emits both the established controlled callback and its portable manifest event counterpart. */
244
+ function emitSelectionChange<TRow extends object>(
245
+ selectedRowIds: readonly string[],
246
+ onSelectedRowIdsChange: DataTableProps<TRow>['onSelectedRowIdsChange'],
247
+ onSelectionChange: DataTableProps<TRow>['onSelectionChange'],
248
+ ): void {
249
+ onSelectedRowIdsChange?.(selectedRowIds);
250
+ onSelectionChange?.({ selectedRowIds });
251
+ }
252
+
171
253
  /*** Maps row-scoped DataTable actions into the shared PopoverMenu action contract. */
172
254
  function mapRowActions<TRow extends object>(
173
255
  row: TRow,
@@ -316,6 +398,8 @@ function DataTableDesktop<TRow extends object>({
316
398
  rowKey,
317
399
  selectedRowIds,
318
400
  onSelectedRowIdsChange,
401
+ onSelectionChange,
402
+ onRowActivate,
319
403
  sort,
320
404
  onSortChange,
321
405
  density,
@@ -327,7 +411,9 @@ function DataTableDesktop<TRow extends object>({
327
411
  const controlledSelectedRowIds = selectedRowIds ?? [];
328
412
  const selectedRowIdSet = new Set(controlledSelectedRowIds);
329
413
  const selectionEnabled = selectedRowIds !== undefined;
330
- const selectionDisabled = interactionPolicy === 'passive' || onSelectedRowIdsChange === undefined;
414
+ const selectionDisabled =
415
+ interactionPolicy === 'passive' ||
416
+ (onSelectedRowIdsChange === undefined && onSelectionChange === undefined);
331
417
  const hasRowActions = rows.some((row, rowIndex) => (rowActions?.(row, rowIndex).length ?? 0) > 0);
332
418
  const selection = selectionEnabled
333
419
  ? {
@@ -335,8 +421,10 @@ function DataTableDesktop<TRow extends object>({
335
421
  disabled: selectionDisabled,
336
422
  onAllVisibleSelectedChange: (selected: boolean) => {
337
423
  if (selectionDisabled) return;
338
- onSelectedRowIdsChange(
424
+ emitSelectionChange(
339
425
  resolveNextVisibleSelection(controlledSelectedRowIds, rowIds, selected),
426
+ onSelectedRowIdsChange,
427
+ onSelectionChange,
340
428
  );
341
429
  },
342
430
  }
@@ -379,27 +467,41 @@ function DataTableDesktop<TRow extends object>({
379
467
  interactionPolicy={interactionPolicy}
380
468
  onCheckedChange={(nextSelected) => {
381
469
  if (selectionDisabled) return;
382
- onSelectedRowIdsChange(
470
+ emitSelectionChange(
383
471
  resolveNextSelectedRowIds(
384
472
  controlledSelectedRowIds,
385
473
  currentRowId,
386
474
  nextSelected,
387
475
  ),
476
+ onSelectedRowIdsChange,
477
+ onSelectionChange,
388
478
  );
389
479
  }}
390
480
  />
391
481
  </View>
392
482
  ) : null}
393
- {columns.map((column) => (
394
- <View
395
- key={column.id}
396
- px={padding.px}
397
- py={padding.py}
398
- style={resolveCellStyle(column)}
399
- >
400
- {renderTableCell(column, row, rowIndex)}
401
- </View>
402
- ))}
483
+ <View direction="row" style={{ flexGrow: 1, flexShrink: 1 }}>
484
+ {columns.map((column) => (
485
+ <View
486
+ key={column.id}
487
+ px={padding.px}
488
+ py={padding.py}
489
+ style={resolveCellStyle(column)}
490
+ >
491
+ {renderTableCell(column, row, rowIndex)}
492
+ </View>
493
+ ))}
494
+ </View>
495
+ {onRowActivate ? (
496
+ <IconButton
497
+ icon={{ name: 'arrow-forward' }}
498
+ interactionPolicy={interactionPolicy}
499
+ label={`Activate row ${currentRowId}`}
500
+ onPress={() => onRowActivate({ rowId: currentRowId })}
501
+ size="s"
502
+ variant="ghost"
503
+ />
504
+ ) : null}
403
505
  {hasRowActions ? (
404
506
  <View
405
507
  px={padding.px}
@@ -428,6 +530,8 @@ function DataTableMobile<TRow extends object>({
428
530
  rowKey,
429
531
  selectedRowIds,
430
532
  onSelectedRowIdsChange,
533
+ onSelectionChange,
534
+ onRowActivate,
431
535
  testID,
432
536
  interactionPolicy,
433
537
  }: DataTableProps<TRow>) {
@@ -435,7 +539,9 @@ function DataTableMobile<TRow extends object>({
435
539
  const controlledSelectedRowIds = selectedRowIds ?? [];
436
540
  const selectedRowIdSet = new Set(controlledSelectedRowIds);
437
541
  const selectionEnabled = selectedRowIds !== undefined;
438
- const selectionDisabled = interactionPolicy === 'passive' || onSelectedRowIdsChange === undefined;
542
+ const selectionDisabled =
543
+ interactionPolicy === 'passive' ||
544
+ (onSelectedRowIdsChange === undefined && onSelectionChange === undefined);
439
545
 
440
546
  return (
441
547
  <View gap="s">
@@ -445,10 +551,27 @@ function DataTableMobile<TRow extends object>({
445
551
  ? renderCell(primaryColumn, row, rowIndex)
446
552
  : `Row ${rowIndex + 1}`;
447
553
  const actions = renderRowActions({ row, rowActions, rowIndex, testID, interactionPolicy });
554
+ const rowActivation = onRowActivate ? (
555
+ <IconButton
556
+ icon={{ name: 'arrow-forward' }}
557
+ interactionPolicy={interactionPolicy}
558
+ label={`Activate row ${currentRowId}`}
559
+ onPress={() => onRowActivate({ rowId: currentRowId })}
560
+ size="s"
561
+ variant="ghost"
562
+ />
563
+ ) : null;
448
564
 
449
565
  return (
450
566
  <Card
451
- actions={actions}
567
+ actions={
568
+ rowActivation || actions ? (
569
+ <View direction="row" gap="xs">
570
+ {rowActivation}
571
+ {actions}
572
+ </View>
573
+ ) : null
574
+ }
452
575
  compact
453
576
  interactionPolicy={interactionPolicy}
454
577
  key={currentRowId}
@@ -464,12 +587,14 @@ function DataTableMobile<TRow extends object>({
464
587
  interactionPolicy={interactionPolicy}
465
588
  onCheckedChange={(nextSelected) => {
466
589
  if (selectionDisabled) return;
467
- onSelectedRowIdsChange(
590
+ emitSelectionChange(
468
591
  resolveNextSelectedRowIds(
469
592
  controlledSelectedRowIds,
470
593
  currentRowId,
471
594
  nextSelected,
472
595
  ),
596
+ onSelectedRowIdsChange,
597
+ onSelectionChange,
473
598
  );
474
599
  }}
475
600
  />
@@ -479,7 +604,7 @@ function DataTableMobile<TRow extends object>({
479
604
  <Text emphasis="muted" variant="caption" weight="semiBold">
480
605
  {column.header}
481
606
  </Text>
482
- {column.renderCell ? (
607
+ {column.renderCell || column.cell ? (
483
608
  renderCell(column, row, rowIndex)
484
609
  ) : (
485
610
  <Text variant="bodySmall">
@@ -0,0 +1,23 @@
1
+ import { expect, test } from 'bun:test';
2
+
3
+ import { dataTableMeta } from './dataTableMeta';
4
+
5
+ test('describes serializable controlled selection and row activation manifest events', () => {
6
+ expect(JSON.parse(JSON.stringify(dataTableMeta))).toMatchObject({
7
+ bindings: {
8
+ events: {
9
+ rowActivate: { payload: { eventType: 'dataTable.rowActivate' } },
10
+ selectionChange: { payload: { eventType: 'dataTable.selectionChange' } },
11
+ },
12
+ props: { selectedRowIds: { value: { type: 'array' } } },
13
+ },
14
+ events: {
15
+ rowActivate: { payloadFields: [{ path: 'rowId', type: 'string' }] },
16
+ selectionChange: { payloadFields: [{ path: 'selectedRowIds', type: 'unknown' }] },
17
+ },
18
+ });
19
+ expect(dataTableMeta.props.columns.itemSchema.find(({ key }) => key === 'cell')).toEqual({
20
+ key: 'cell',
21
+ schema: { category: 'Content', label: 'Portable cell presentation', type: 'object' },
22
+ });
23
+ });
@@ -15,6 +15,16 @@ export const dataTableMeta = {
15
15
  { path: 'direction', type: 'string' },
16
16
  ],
17
17
  },
18
+ selectionChange: {
19
+ label: 'Selection change',
20
+ eventType: 'dataTable.selectionChange',
21
+ payloadFields: [{ path: 'selectedRowIds', type: 'unknown', label: 'Selected row IDs' }],
22
+ },
23
+ rowActivate: {
24
+ label: 'Activate row',
25
+ eventType: 'dataTable.rowActivate',
26
+ payloadFields: [{ path: 'rowId', type: 'string', label: 'Row ID' }],
27
+ },
18
28
  },
19
29
  bindings: {
20
30
  props: {
@@ -28,6 +38,29 @@ export const dataTableMeta = {
28
38
  },
29
39
  acceptsFallback: true,
30
40
  },
41
+ selectedRowIds: {
42
+ label: 'Selected row IDs',
43
+ description: 'Controlled stable row identities selected with the checkbox column.',
44
+ value: { type: 'array' },
45
+ acceptsFallback: true,
46
+ acceptsTransforms: true,
47
+ },
48
+ },
49
+ events: {
50
+ selectionChange: {
51
+ label: 'Selection change',
52
+ payload: {
53
+ eventType: 'dataTable.selectionChange',
54
+ fields: [{ path: 'selectedRowIds', type: 'unknown', label: 'Selected row IDs' }],
55
+ },
56
+ },
57
+ rowActivate: {
58
+ label: 'Activate row',
59
+ payload: {
60
+ eventType: 'dataTable.rowActivate',
61
+ fields: [{ path: 'rowId', type: 'string', label: 'Row ID' }],
62
+ },
63
+ },
31
64
  },
32
65
  },
33
66
  props: {
@@ -47,8 +80,17 @@ export const dataTableMeta = {
47
80
  { key: 'width', schema: { type: 'number', category: 'Layout' } },
48
81
  { key: 'minWidth', schema: { type: 'number', category: 'Layout' } },
49
82
  { key: 'sortable', schema: { type: 'boolean', category: 'Behavior' } },
83
+ {
84
+ key: 'cell',
85
+ schema: {
86
+ type: 'object',
87
+ category: 'Content',
88
+ label: 'Portable cell presentation',
89
+ },
90
+ },
50
91
  ],
51
92
  },
93
+ selectedRowIds: { type: 'array', category: 'Selection', label: 'Selected row IDs' },
52
94
  loading: { type: 'boolean', category: 'State' },
53
95
  loadingRows: { type: 'number', category: 'State' },
54
96
  emptyTitle: { type: 'string', category: 'Content' },
@@ -1,10 +1,14 @@
1
1
  export type {
2
2
  DataTableCellContext,
3
+ DataTableCellSpec,
3
4
  DataTableColumn,
4
5
  DataTableColumnAlign,
5
6
  DataTableDensity,
6
7
  DataTableProps,
7
8
  DataTableRowAction,
9
+ DataTableRowActivateEvent,
10
+ DataTableRowField,
11
+ DataTableSelectionChangeEvent,
8
12
  DataTableSortDirection,
9
13
  DataTableSortState,
10
14
  } from '../../types/data-table';
@@ -330,7 +330,7 @@ export const ZORA_BINDABLE_COMPONENT_META = {
330
330
  DataTable: {
331
331
  name: 'DataTable',
332
332
  category: 'component',
333
- description: 'Renders tabular records.',
333
+ description: 'Renders tabular records with portable selection and activation events.',
334
334
  directManifestNode: true,
335
335
  allowedChildren: [],
336
336
  bindings: {
@@ -338,22 +338,39 @@ export const ZORA_BINDABLE_COMPONENT_META = {
338
338
  rows: {
339
339
  label: 'Rows',
340
340
  description: 'Rows rendered by the table.',
341
- value: {
342
- type: 'array',
343
- itemType: 'record',
344
- },
341
+ value: { type: 'array', itemType: 'record' },
342
+ acceptsFallback: true,
343
+ acceptsTransforms: true,
344
+ },
345
+ selectedRowIds: {
346
+ label: 'Selected row IDs',
347
+ description: 'Controlled stable row identities selected with the checkbox column.',
348
+ value: { type: 'array', itemType: 'string' },
345
349
  acceptsFallback: true,
346
350
  acceptsTransforms: true,
347
351
  },
348
352
  },
353
+ events: {
354
+ selectionChange: {
355
+ label: 'Selection change',
356
+ payload: {
357
+ eventType: 'dataTable.selectionChange',
358
+ fields: [{ path: 'selectedRowIds', type: 'unknown', label: 'Selected row IDs' }],
359
+ },
360
+ },
361
+ rowActivate: {
362
+ label: 'Activate row',
363
+ payload: {
364
+ eventType: 'dataTable.rowActivate',
365
+ fields: [{ path: 'rowId', type: 'string', label: 'Row ID' }],
366
+ },
367
+ },
368
+ },
349
369
  },
350
370
  props: {
351
371
  inverted: INVERTED_POLARITY_PROP,
352
- rows: {
353
- type: 'array',
354
- category: 'Data',
355
- label: 'Rows',
356
- },
372
+ rows: { type: 'array', category: 'Data', label: 'Rows' },
373
+ selectedRowIds: { type: 'array', category: 'Selection', label: 'Selected row IDs' },
357
374
  },
358
375
  },
359
376
  Reader: {
@@ -1,5 +1,6 @@
1
1
  import { describe, expect, test } from 'bun:test';
2
2
 
3
+ import { ZORA_COLORS } from '../theme/colorModel';
3
4
  import type { BarcodeScannerViewProps, ZoraComponentEventPayloadKind } from '.';
4
5
  import { ZORA_COMPONENT_META } from '.';
5
6
 
@@ -285,6 +286,7 @@ describe('ZORA_COMPONENT_META invariants', () => {
285
286
  'TimePicker',
286
287
  'TabletopTable',
287
288
  'PokerTrainingTable',
289
+ 'Timeline',
288
290
  ]);
289
291
 
290
292
  const expectedContainerNodes = new Set([
@@ -466,6 +468,49 @@ describe('ZORA_COMPONENT_META invariants', () => {
466
468
  expect(ZORA_COMPONENT_META.ThemeModeToggle.blueprint?.defaultProps).toEqual({ size: 'm' });
467
469
  });
468
470
 
471
+ test('Timeline is a direct manifest leaf with portable dated marker items', () => {
472
+ const timeline = ZORA_COMPONENT_META.Timeline;
473
+
474
+ expect(timeline.directManifestNode).toBe(true);
475
+ expect(timeline.allowedChildren).toEqual([]);
476
+ expect(timeline.blueprint?.defaultProps).toEqual({ items: [] });
477
+ expect(timeline.props.items?.itemSchema).toEqual([
478
+ { key: 'id', schema: { type: 'string', category: 'Identity', label: 'Event ID' } },
479
+ { key: 'title', schema: { type: 'string', category: 'Content', label: 'Title' } },
480
+ {
481
+ key: 'description',
482
+ schema: { type: 'string', category: 'Content', label: 'Description' },
483
+ },
484
+ { key: 'meta', schema: { type: 'string', category: 'Content', label: 'Date and time' } },
485
+ {
486
+ key: 'status',
487
+ schema: {
488
+ type: 'enum',
489
+ category: 'State',
490
+ label: 'Status',
491
+ enum: ZORA_COLORS,
492
+ },
493
+ },
494
+ {
495
+ key: 'marker',
496
+ schema: {
497
+ type: 'media',
498
+ category: 'Content',
499
+ label: 'SVG or image marker',
500
+ mediaKinds: ['image'],
501
+ },
502
+ },
503
+ {
504
+ key: 'markerAlt',
505
+ schema: {
506
+ type: 'string',
507
+ category: 'Accessibility',
508
+ label: 'Marker alternative text',
509
+ },
510
+ },
511
+ ]);
512
+ });
513
+
469
514
  test('KeyboardAvoidingView is a direct manifest container with native behavior props', () => {
470
515
  const keyboardAvoidingView = ZORA_COMPONENT_META.KeyboardAvoidingView;
471
516
 
@@ -0,0 +1,115 @@
1
+ import { join } from 'node:path';
2
+ import { pathToFileURL } from 'node:url';
3
+
4
+ import { isSerializableValue, type MediaAssetRegistry, type UiNode } from '@ankhorage/contracts';
5
+ import { expect, mock, test } from 'bun:test';
6
+ import { Window } from 'happy-dom';
7
+ import React from 'react';
8
+ import { renderToStaticMarkup } from 'react-dom/server';
9
+
10
+ import type { TimelineManifestProps } from '../../types/timeline';
11
+ import type { ZoraProvider as ZoraProviderComponent } from '../theme/runtime';
12
+ import type { Timeline as TimelineComponent } from './adapters/inbound/Timeline';
13
+
14
+ const webDistRoot = join(import.meta.dir, '../../../web-dist');
15
+
16
+ const timelineRuntimePromise = Promise.all([
17
+ import(pathToFileURL(join(webDistRoot, 'components/timeline/index.js')).href) as Promise<{
18
+ Timeline: typeof TimelineComponent;
19
+ }>,
20
+ import(pathToFileURL(join(webDistRoot, 'runtime/ZoraProvider.js')).href) as Promise<{
21
+ ZoraProvider: typeof ZoraProviderComponent;
22
+ }>,
23
+ ]);
24
+
25
+ await mock.module('react-native', () => ({
26
+ StyleSheet: { create: <T,>(styles: T) => styles },
27
+ Text: ({ children }: { children?: React.ReactNode }) => <span>{children}</span>,
28
+ View: ({ children }: { children?: React.ReactNode }) => <div>{children}</div>,
29
+ }));
30
+
31
+ const { RuntimeRenderer } = await import('@ankhorage/runtime');
32
+
33
+ async function loadTimelineRuntime() {
34
+ const [timelineModule, themeModule] = await timelineRuntimePromise;
35
+ return { Timeline: timelineModule.Timeline, ZoraProvider: themeModule.ZoraProvider };
36
+ }
37
+
38
+ const manifestTimelineProps = {
39
+ items: [
40
+ {
41
+ id: 'acquired',
42
+ title: 'Company acquired',
43
+ description:
44
+ 'A deliberately long event description that wraps across lines while its connector flexes to the next event.',
45
+ meta: '2026-11-22T09:00:00Z',
46
+ status: 'success',
47
+ marker: { mediaId: 'acquisition-mark' },
48
+ markerAlt: 'Acquisition marker',
49
+ },
50
+ {
51
+ id: 'integrated',
52
+ title: 'Company integrated',
53
+ meta: '2026-11-23T09:00:00Z',
54
+ status: 'primary',
55
+ },
56
+ ],
57
+ } as const satisfies TimelineManifestProps;
58
+
59
+ const timelineNode = {
60
+ id: 'acquisition-history',
61
+ type: 'Timeline',
62
+ props: manifestTimelineProps,
63
+ } satisfies UiNode;
64
+
65
+ const mediaAssets = {
66
+ 'acquisition-mark': {
67
+ id: 'acquisition-mark',
68
+ name: 'Acquisition marker',
69
+ kind: 'image',
70
+ source: { kind: 'url', url: 'https://example.test/acquisition.svg' },
71
+ },
72
+ } as const satisfies MediaAssetRegistry;
73
+
74
+ test('keeps Timeline manifest items serializable and rejects executable values', () => {
75
+ expect(isSerializableValue(manifestTimelineProps)).toBe(true);
76
+ expect(
77
+ isSerializableValue({
78
+ ...manifestTimelineProps,
79
+ items: [{ ...manifestTimelineProps.items[0], markerAlt: () => 'not serializable' }],
80
+ }),
81
+ ).toBe(false);
82
+ });
83
+
84
+ test('maps serializable Timeline markers through the runtime while preserving item order and connector height', async () => {
85
+ const { Timeline, ZoraProvider } = await loadTimelineRuntime();
86
+ const browser = new Window();
87
+
88
+ try {
89
+ browser.document.body.innerHTML = renderToStaticMarkup(
90
+ <ZoraProvider mode="light">
91
+ <RuntimeRenderer
92
+ isRoot
93
+ mediaAssets={mediaAssets}
94
+ node={timelineNode}
95
+ registry={{ Timeline }}
96
+ />
97
+ </ZoraProvider>,
98
+ );
99
+
100
+ const timeline = browser.document.querySelector('[data-testid="acquisition-history"]');
101
+ const firstItem = timeline?.children.item(0);
102
+ const marker = firstItem?.querySelector('[role="img"]');
103
+ const connector = firstItem?.querySelector('[style*="width:2px"]');
104
+ const content = firstItem?.lastElementChild;
105
+ const text = timeline?.textContent ?? '';
106
+
107
+ expect(marker?.getAttribute('aria-label')).toBe('Acquisition marker');
108
+ expect(text.indexOf('Company acquired')).toBeLessThan(text.indexOf('Company integrated'));
109
+ expect(connector?.getAttribute('style')).toContain('flex:1');
110
+ expect(connector?.getAttribute('style')).not.toContain('height:36px');
111
+ expect(content?.getAttribute('style')).toContain('padding-bottom:24px');
112
+ } finally {
113
+ browser.close();
114
+ }
115
+ });