@ankhorage/zora 28.11.2 → 28.12.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.
@@ -161,7 +161,10 @@ function renderPortableCell(cell, row) {
161
161
  const externalUrl = href ? resolveExternalWebsiteUrl(href) : undefined;
162
162
  return externalUrl ? /* @__PURE__ */ jsx(Pressable, {
163
163
  accessibilityRole: "link",
164
- onPress: () => openExternalUrl(externalUrl),
164
+ onPress: (event) => {
165
+ event.stopPropagation();
166
+ openExternalUrl(externalUrl);
167
+ },
165
168
  children: /* @__PURE__ */ jsx(Text2, {
166
169
  color: "primary",
167
170
  variant: cell.variant ?? "bodySmall",
@@ -349,6 +352,7 @@ function DataTableDesktop({
349
352
  rowActions,
350
353
  rowId,
351
354
  rowKey,
355
+ activeRowId,
352
356
  selectedRowIds,
353
357
  onSelectedRowIdsChange,
354
358
  onSelectionChange,
@@ -397,9 +401,10 @@ function DataTableDesktop({
397
401
  children: rows.map((row, rowIndex) => {
398
402
  const currentRowId = resolveDataTableRowKey(row, rowIndex, rowKey, rowId);
399
403
  const selected = selectedRowIdSet.has(currentRowId);
404
+ const active = activeRowId === currentRowId;
400
405
  return /* @__PURE__ */ jsx(View2, {
401
- bg: "surface",
402
- borderColor: "border",
406
+ bg: active ? "subtle" : "surface",
407
+ borderColor: active ? "primary" : "border",
403
408
  borderWidth: 1,
404
409
  radius: "m",
405
410
  testID: testID ? `${testID}-row-${rowIndex}` : undefined,
@@ -423,9 +428,23 @@ function DataTableDesktop({
423
428
  }
424
429
  })
425
430
  }) : null,
426
- /* @__PURE__ */ jsx(View2, {
427
- direction: "row",
431
+ onRowActivate ? /* @__PURE__ */ jsx(Pressable, {
432
+ accessibilityLabel: `Activate row ${currentRowId}`,
433
+ accessibilityRole: "button",
434
+ disabled: interactionPolicy === "passive",
435
+ onPress: () => onRowActivate({ rowId: currentRowId }),
428
436
  style: { flexGrow: 1, flexShrink: 1 },
437
+ children: /* @__PURE__ */ jsx(View2, {
438
+ direction: "row",
439
+ children: columns.map((column) => /* @__PURE__ */ jsx(View2, {
440
+ px: padding.px,
441
+ py: padding.py,
442
+ style: resolveCellStyle(column),
443
+ children: renderTableCell(column, row, rowIndex)
444
+ }, column.id))
445
+ })
446
+ }) : /* @__PURE__ */ jsx(View2, {
447
+ direction: "row",
429
448
  children: columns.map((column) => /* @__PURE__ */ jsx(View2, {
430
449
  px: padding.px,
431
450
  py: padding.py,
@@ -433,14 +452,6 @@ function DataTableDesktop({
433
452
  children: renderTableCell(column, row, rowIndex)
434
453
  }, column.id))
435
454
  }),
436
- onRowActivate ? /* @__PURE__ */ jsx(IconButton2, {
437
- icon: { name: "arrow-forward" },
438
- interactionPolicy,
439
- label: `Activate row ${currentRowId}`,
440
- onPress: () => onRowActivate({ rowId: currentRowId }),
441
- size: "s",
442
- variant: "ghost"
443
- }) : null,
444
455
  hasRowActions ? /* @__PURE__ */ jsx(View2, {
445
456
  px: padding.px,
446
457
  py: padding.py,
@@ -463,6 +474,7 @@ function DataTableMobile({
463
474
  rowActions,
464
475
  rowId,
465
476
  rowKey,
477
+ activeRowId,
466
478
  selectedRowIds,
467
479
  onSelectedRowIdsChange,
468
480
  onSelectionChange,
@@ -479,60 +491,64 @@ function DataTableMobile({
479
491
  gap: "s",
480
492
  children: rows.map((row, rowIndex) => {
481
493
  const currentRowId = resolveDataTableRowKey(row, rowIndex, rowKey, rowId);
494
+ const active = activeRowId === currentRowId;
482
495
  const title = primaryColumn ? renderCell(primaryColumn, row, rowIndex) : `Row ${rowIndex + 1}`;
483
496
  const actions = renderRowActions({ row, rowActions, rowIndex, testID, interactionPolicy });
484
- const rowActivation = onRowActivate ? /* @__PURE__ */ jsx(IconButton2, {
485
- icon: { name: "arrow-forward" },
486
- interactionPolicy,
487
- label: `Activate row ${currentRowId}`,
488
- onPress: () => onRowActivate({ rowId: currentRowId }),
489
- size: "s",
490
- variant: "ghost"
491
- }) : null;
492
- return /* @__PURE__ */ jsx(Card2, {
493
- actions: rowActivation || actions ? /* @__PURE__ */ jsxs(View2, {
494
- direction: "row",
495
- gap: "xs",
496
- children: [
497
- rowActivation,
498
- actions
499
- ]
500
- }) : null,
497
+ const card = /* @__PURE__ */ jsx(Card2, {
498
+ actions: onRowActivate ? undefined : actions,
499
+ accessibilityLabel: onRowActivate ? `Activate row ${currentRowId}` : undefined,
501
500
  compact: true,
502
501
  interactionPolicy,
502
+ onPress: onRowActivate ? () => onRowActivate({ rowId: currentRowId }) : undefined,
503
503
  testID: testID ? `${testID}-card-${rowIndex}` : undefined,
504
504
  title,
505
- children: /* @__PURE__ */ jsxs(View2, {
505
+ tone: active ? "subtle" : undefined,
506
+ children: /* @__PURE__ */ jsx(View2, {
506
507
  gap: "s",
507
- children: [
508
- selectionEnabled ? /* @__PURE__ */ jsx(Checkbox2, {
509
- accessibilityLabel: `Select row ${currentRowId}`,
510
- checked: selectedRowIdSet.has(currentRowId),
511
- disabled: selectionDisabled,
512
- interactionPolicy,
513
- onCheckedChange: (nextSelected) => {
514
- if (selectionDisabled)
515
- return;
516
- emitSelectionChange(resolveNextSelectedRowIds(controlledSelectedRowIds, currentRowId, nextSelected), onSelectedRowIdsChange, onSelectionChange);
517
- }
518
- }) : null,
519
- detailColumns.map((column) => /* @__PURE__ */ jsxs(View2, {
520
- gap: "xxs",
521
- children: [
522
- /* @__PURE__ */ jsx(Text2, {
523
- emphasis: "muted",
524
- variant: "caption",
525
- weight: "semiBold",
526
- children: column.header
527
- }),
528
- column.renderCell || column.cell ? renderCell(column, row, rowIndex) : /* @__PURE__ */ jsx(Text2, {
529
- variant: "bodySmall",
530
- children: renderDefaultCell(resolveAccessorValue(row, column))
531
- })
532
- ]
533
- }, column.id))
534
- ]
508
+ children: detailColumns.map((column) => /* @__PURE__ */ jsxs(View2, {
509
+ gap: "xxs",
510
+ children: [
511
+ /* @__PURE__ */ jsx(Text2, {
512
+ emphasis: "muted",
513
+ variant: "caption",
514
+ weight: "semiBold",
515
+ children: column.header
516
+ }),
517
+ column.renderCell || column.cell ? renderCell(column, row, rowIndex) : /* @__PURE__ */ jsx(Text2, {
518
+ variant: "bodySmall",
519
+ children: renderDefaultCell(resolveAccessorValue(row, column))
520
+ })
521
+ ]
522
+ }, column.id))
535
523
  })
524
+ });
525
+ return /* @__PURE__ */ jsxs(View2, {
526
+ gap: "s",
527
+ children: [
528
+ onRowActivate && actions ? /* @__PURE__ */ jsxs(View2, {
529
+ align: "flex-start",
530
+ direction: "row",
531
+ gap: "xs",
532
+ children: [
533
+ /* @__PURE__ */ jsx(View2, {
534
+ flex: 1,
535
+ children: card
536
+ }),
537
+ actions
538
+ ]
539
+ }) : card,
540
+ selectionEnabled ? /* @__PURE__ */ jsx(Checkbox2, {
541
+ accessibilityLabel: `Select row ${currentRowId}`,
542
+ checked: selectedRowIdSet.has(currentRowId),
543
+ disabled: selectionDisabled,
544
+ interactionPolicy,
545
+ onCheckedChange: (nextSelected) => {
546
+ if (selectionDisabled)
547
+ return;
548
+ emitSelectionChange(resolveNextSelectedRowIds(controlledSelectedRowIds, currentRowId, nextSelected), onSelectedRowIdsChange, onSelectionChange);
549
+ }
550
+ }) : null
551
+ ]
536
552
  }, currentRowId);
537
553
  })
538
554
  });
@@ -90,6 +90,8 @@ export interface DataTableProps<TRow extends object> extends ZoraBaseProps {
90
90
  rowKey?: keyof TRow;
91
91
  /** Controlled identifiers for rows selected with the optional checkbox column. */
92
92
  selectedRowIds?: readonly string[];
93
+ /** Controlled stable row identity whose activation state is visibly presented. */
94
+ activeRowId?: string;
93
95
  /** Receives the next controlled selection after a row or visible-row toggle. */
94
96
  onSelectedRowIdsChange?: (selectedRowIds: readonly string[]) => void;
95
97
  /** Emits the serializable controlled selection payload used by AppManifest events. */