@marktiderman/genesis-ui-native 3.1.0 → 3.2.1

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,10 +1,23 @@
1
1
  {
2
2
  "name": "@marktiderman/genesis-ui-native",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "Genesis React Native components (NativeWind v4-5). Part of the Genesis framework.",
8
+ "keywords": [
9
+ "genesis",
10
+ "genesis-framework",
11
+ "react-native",
12
+ "ui",
13
+ "components",
14
+ "nativewind",
15
+ "expo"
16
+ ],
17
+ "homepage": "https://github.com/marktiderman/genesis/tree/main/packages/ui-native#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/marktiderman/genesis/issues"
20
+ },
8
21
  "repository": {
9
22
  "type": "git",
10
23
  "url": "git+https://github.com/marktiderman/genesis.git",
@@ -68,8 +81,8 @@
68
81
  "peerDependencies": {
69
82
  "@expo/ui": ">=58.0.0",
70
83
  "@gorhom/bottom-sheet": ">=5.0.0",
71
- "@hookform/resolvers": "^3.0.0 || ^4.0.0 || ^5.0.0",
72
- "@marktiderman/genesis-core": "^2.1.0",
84
+ "@hookform/resolvers": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
85
+ "@marktiderman/genesis-core": "^2.2.1",
73
86
  "@marktiderman/genesis-design-system": "^1.5.1",
74
87
  "@react-native-community/datetimepicker": ">=8.0.0",
75
88
  "@shopify/flash-list": ">=2.0.0",
@@ -138,13 +151,13 @@
138
151
  "devDependencies": {
139
152
  "@testing-library/react": "^16.3.2",
140
153
  "@types/react": "^19.2.14",
141
- "@vitest/coverage-v8": "^4.1.12",
142
- "happy-dom": "^20.9.0",
154
+ "@vitest/coverage-v8": "^5.0.5",
155
+ "happy-dom": "^21.0.4",
143
156
  "react": "^19.2.5",
144
157
  "react-dom": "^19.2.5",
145
158
  "tsup": "^8.3.0",
146
159
  "typescript": "~6.0.3",
147
- "vitest": "^4.1.12"
160
+ "vitest": "^5.0.5"
148
161
  },
149
162
  "genesis": {
150
163
  "doctor": {
@@ -169,6 +182,7 @@
169
182
  "unless": {
170
183
  "renders": [
171
184
  "NativeResourceView",
185
+ "NativeRecordView",
172
186
  "NativeResourceWorkspace"
173
187
  ]
174
188
  },
@@ -186,10 +200,10 @@
186
200
  "docs": "https://github.com/marktiderman/genesis/blob/main/packages/ui-native/README.md"
187
201
  },
188
202
  {
189
- "need": "a record page on the phone",
190
- "use": "NativeResourceWorkspace",
203
+ "need": "a record view on the phone",
204
+ "use": "NativeRecordView",
191
205
  "import": "@marktiderman/genesis-ui-native/data",
192
- "docs": "https://github.com/marktiderman/genesis/blob/main/docs/RESOURCE-VIEW.md#resourceworkspace"
206
+ "docs": "https://github.com/marktiderman/genesis/blob/main/docs/RESOURCE-VIEW.md#recordview"
193
207
  }
194
208
  ]
195
209
  }
@@ -2,7 +2,7 @@
2
2
  // GenesisModulesProvider. Each records how Genesis called it, so a test can
3
3
  // assert the opt-in path, and renders plain DOM so the tree stays testable.
4
4
  import * as React from "react";
5
- import { vi } from "vitest";
5
+ import { type Mock, vi } from "vitest";
6
6
  import type {
7
7
  GenesisDatePickerProps,
8
8
  GenesisGlassModule,
@@ -14,7 +14,14 @@ import type {
14
14
 
15
15
  type AnyProps = Record<string, unknown> & { children?: React.ReactNode; testID?: string };
16
16
 
17
- export function fakeReanimated() {
17
+ type FakeReanimated = Omit<GenesisReanimatedModule, "useAnimatedStyle" | "withTiming" | "withRepeat" | "cancelAnimation"> & {
18
+ useAnimatedStyle: Mock<(updater: () => Record<string, unknown>) => Record<string, unknown>>;
19
+ withTiming: Mock<(toValue: number) => number>;
20
+ withRepeat: Mock<(animation: number) => number>;
21
+ cancelAnimation: Mock<() => void>;
22
+ };
23
+
24
+ export function fakeReanimated(): FakeReanimated {
18
25
  const AnimatedView = React.forwardRef<HTMLDivElement, AnyProps>(function AnimatedView({ children, testID, style, className, accessibilityLabel, accessibilityRole }, ref) {
19
26
  return (
20
27
  <div
@@ -40,7 +47,7 @@ export function fakeReanimated() {
40
47
  Easing: { inOut: (e: unknown) => e, ease: "ease", out: (e: unknown) => e, cubic: "cubic" },
41
48
  ReduceMotion: { System: "system", Always: "always", Never: "never" },
42
49
  };
43
- return mod satisfies GenesisReanimatedModule;
50
+ return mod satisfies GenesisReanimatedModule as FakeReanimated;
44
51
  }
45
52
 
46
53
  export function fakeGlass({ liquid = true, api = true, throws = false } = {}) {
@@ -1,7 +1,7 @@
1
- // NativeResourceWorkspace: one record's screen from a genesis-core workspace (defineWorkspace),
1
+ // NativeRecordView: one record's screen from a genesis-core record view (defineRecordView),
2
2
  // in native patterns:
3
3
  // - the title in the navigation bar and the actions in the header menu, through
4
- // `getNativeResourceWorkspaceStackOptions` (the host's <Stack.Screen options>), as SettingsPage does;
4
+ // `getNativeRecordViewStackOptions` (the host's <Stack.Screen options>), as SettingsPage does;
5
5
  // - up to four sections as a segmented control; more as pushed rows (`onOpenSection`);
6
6
  // - a list section → an embedded NativeResourceView of the child view, filtered by the row;
7
7
  // - a settings section → inset grouped settings rows, saving only its listed keys, a zero-row
@@ -14,7 +14,7 @@ import { ActionSheetIOS, Alert, Platform, Pressable, ScrollView, View } from "re
14
14
  import { useQuery, useQueryClient } from "@tanstack/react-query";
15
15
  import { DataWriteError, resourceKeys, useCapabilities, useDataProvider, useViewer, type DataRow, type ResourceContract } from "@marktiderman/genesis-core";
16
16
  import { readinessChip, type ReadinessLabels } from "@marktiderman/genesis-core/resource";
17
- import type { Allowed, ResourceWorkspace as Workspace, WorkspaceHeaderAction } from "@marktiderman/genesis-core/resource-view";
17
+ import type { Allowed, RecordView as RecordViewDef, RecordViewHeaderAction } from "@marktiderman/genesis-core/resource-view";
18
18
  import { NativeBadge } from "../../components/badge";
19
19
  import { NativeButton } from "../../components/button";
20
20
  import { NativeIcon } from "../../components/icon";
@@ -37,14 +37,14 @@ import { NativeResourceView, type NativeResourceViewProps } from "./NativeResour
37
37
  type Row = Record<string, unknown>;
38
38
  type Values = Record<string, unknown>;
39
39
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- any contract; the row is what matters here
40
- type AnyWorkspace<T extends Row> = Workspace<ResourceContract<any>, T & DataRow>;
40
+ type AnyRecordView<T extends Row> = RecordViewDef<ResourceContract<any>, T & DataRow>;
41
41
 
42
42
  /**
43
- * The words NativeResourceWorkspace shows. Override any of them with `messages`. The readiness
43
+ * The words NativeRecordView shows. Override any of them with `messages`. The readiness
44
44
  * chip's keys (`ready`, `empty`, `pending`, `problems`, `warnings`) are genesis-core/resource's
45
45
  * `readinessChip` labels: unset, they use its defaults.
46
46
  */
47
- export interface NativeResourceWorkspaceMessages extends ReadinessLabels {
47
+ export interface NativeRecordViewMessages extends ReadinessLabels {
48
48
  actions: string;
49
49
  cancel: string;
50
50
  save: string;
@@ -61,7 +61,7 @@ export interface NativeResourceWorkspaceMessages extends ReadinessLabels {
61
61
  notANumber: string;
62
62
  }
63
63
 
64
- export const defaultNativeResourceWorkspaceMessages: NativeResourceWorkspaceMessages = {
64
+ export const defaultNativeRecordViewMessages: NativeRecordViewMessages = {
65
65
  actions: "Actions",
66
66
  cancel: "Cancel",
67
67
  save: "Save",
@@ -85,22 +85,22 @@ export const SEGMENTED_SECTIONS_MAX = 4;
85
85
 
86
86
  // ── Header: title and menu ────────────────────────────────────────────
87
87
 
88
- export interface NativeResourceWorkspaceHeaderProps<T extends Row = Row> {
89
- workspace: AnyWorkspace<T>;
88
+ export interface NativeRecordViewHeaderProps<T extends Row = Row> {
89
+ view: AnyRecordView<T>;
90
90
  row: T;
91
91
  /** Runs an allowed (and confirmed) action. Default: the provider's `runAction`. */
92
92
  onAction?: (name: string, row: T) => unknown;
93
93
  /** The screen's own rule: `false` hides an action, a sentence refuses it. Only narrows. */
94
94
  can?: (action: string, row: T) => Allowed | boolean;
95
- messages?: Partial<NativeResourceWorkspaceMessages>;
95
+ messages?: Partial<NativeRecordViewMessages>;
96
96
  }
97
97
 
98
98
  /** Runs header actions: guards explain, confirms ask, one at a time, failures in an alert. */
99
- function useHeaderActions<T extends Row>({ workspace, row, onAction, can, messages }: NativeResourceWorkspaceHeaderProps<T>) {
100
- const words = { ...defaultNativeResourceWorkspaceMessages, ...messages };
99
+ function useHeaderActions<T extends Row>({ view: recordView, row, onAction, can, messages }: NativeRecordViewHeaderProps<T>) {
100
+ const words = { ...defaultNativeRecordViewMessages, ...messages };
101
101
  const provider = useDataProvider();
102
102
  const queryClient = useQueryClient();
103
- const view = workspace.view;
103
+ const view = recordView.view;
104
104
  // Actions show only where something can run them, and only those the provider serves when it says.
105
105
  const capabilities = useCapabilities(view.resource, { enabled: !onAction && !!provider.capabilities });
106
106
  const described = useQuery({
@@ -111,7 +111,7 @@ function useHeaderActions<T extends Row>({ workspace, row, onAction, can, messag
111
111
  });
112
112
  // The view's action guards read the viewer (ViewerScope's id, scope and roles).
113
113
  const viewer = useViewer();
114
- const actions = workspace.headerFor(row as T & DataRow, {
114
+ const actions = recordView.headerFor(row as T & DataRow, {
115
115
  viewer,
116
116
  runnable: Boolean(onAction) || (Boolean(provider.runAction) && capabilities.data?.actions !== false),
117
117
  ...(!onAction && described.data?.actions ? { served: described.data.actions.map((a) => a.name) } : {}),
@@ -120,13 +120,13 @@ function useHeaderActions<T extends Row>({ workspace, row, onAction, can, messag
120
120
  // One action at a time: a second press while one runs does nothing.
121
121
  const running = useRef(false);
122
122
  const [pending, setPending] = useState(false);
123
- const run = async (a: WorkspaceHeaderAction) => {
123
+ const run = async (a: RecordViewHeaderAction) => {
124
124
  if (running.current) return;
125
125
  running.current = true;
126
126
  setPending(true);
127
127
  try {
128
128
  if (onAction) await onAction(a.name, row);
129
- else if (provider.runAction) await provider.runAction(view.resource, { id: workspace.recordId(row as T & DataRow), action: a.name });
129
+ else if (provider.runAction) await provider.runAction(view.resource, { id: recordView.recordId(row as T & DataRow), action: a.name });
130
130
  else throw new DataWriteError("error", fill(words.noRunner, { name: a.label }));
131
131
  await queryClient.invalidateQueries({ queryKey: [...resourceKeys(view.resource).all] });
132
132
  } catch (error) {
@@ -136,7 +136,7 @@ function useHeaderActions<T extends Row>({ workspace, row, onAction, can, messag
136
136
  setPending(false);
137
137
  }
138
138
  };
139
- const press = (a: WorkspaceHeaderAction) => {
139
+ const press = (a: RecordViewHeaderAction) => {
140
140
  if (running.current) return;
141
141
  if (a.allowed !== true) return Alert.alert(a.label, a.allowed);
142
142
  if (!a.confirm) return void run(a);
@@ -153,22 +153,22 @@ function useHeaderActions<T extends Row>({ workspace, row, onAction, can, messag
153
153
  const A11Y_PREFIX = "action:";
154
154
 
155
155
  /**
156
- * The header menu: a button that lists the workspace's actions. On iOS an action sheet
156
+ * The header menu: a button that lists the record view's actions. On iOS an action sheet
157
157
  * (ActionSheetIOS, destructive ones in red); elsewhere a sheet of rows, since Android's alert
158
158
  * shows at most three buttons. A refused action stays listed and explains why when pressed.
159
159
  */
160
- export function NativeResourceWorkspaceMenu<T extends Row = Row>(props: NativeResourceWorkspaceHeaderProps<T> & { testID?: string }) {
160
+ export function NativeRecordViewMenu<T extends Row = Row>(props: NativeRecordViewHeaderProps<T> & { testID?: string }) {
161
161
  const { testID = "native-resource-workspace-menu" } = props;
162
162
  const { actions, press, pending, words } = useHeaderActions(props);
163
163
  const [open, setOpen] = useState(false);
164
164
  if (actions.length === 0) return null;
165
- const labelOf = (a: WorkspaceHeaderAction) => (a.allowed === true ? a.label : `${a.label} (${a.allowed})`);
165
+ const labelOf = (a: RecordViewHeaderAction) => (a.allowed === true ? a.label : `${a.label} (${a.allowed})`);
166
166
  const show = () => {
167
167
  if (Platform.OS === "ios") {
168
168
  const destructive = actions.flatMap((a, i) => (a.destructive ? [i] : []));
169
169
  ActionSheetIOS.showActionSheetWithOptions(
170
170
  {
171
- title: props.workspace.headerFor(props.row as T & DataRow).title,
171
+ title: props.view.headerFor(props.row as T & DataRow).title,
172
172
  options: [...actions.map(labelOf), words.cancel],
173
173
  cancelButtonIndex: actions.length,
174
174
  ...(destructive.length ? { destructiveButtonIndex: destructive } : {}),
@@ -238,29 +238,29 @@ export function NativeResourceWorkspaceMenu<T extends Row = Row>(props: NativeRe
238
238
  }
239
239
 
240
240
  /**
241
- * `<Stack.Screen options>` for a workspace: the record's title in the navigation bar and the
241
+ * `<Stack.Screen options>` for a record view: the record's title in the navigation bar and the
242
242
  * actions in the header menu.
243
243
  *
244
244
  * ```tsx
245
- * <Stack.Screen options={getNativeResourceWorkspaceStackOptions({ workspace: brandWorkspace, row: brand })} />
245
+ * <Stack.Screen options={getNativeRecordViewStackOptions({ view: brandRecordView, row: brand })} />
246
246
  * ```
247
247
  */
248
- export function getNativeResourceWorkspaceStackOptions<T extends Row>(
249
- props: NativeResourceWorkspaceHeaderProps<T> & Omit<ScreenHeaderProps, "headerTitle">,
248
+ export function getNativeRecordViewStackOptions<T extends Row>(
249
+ props: NativeRecordViewHeaderProps<T> & Omit<ScreenHeaderProps, "headerTitle">,
250
250
  ): Record<string, unknown> {
251
- const { workspace, row, onAction, can, messages, ...header } = props;
252
- const menu = { workspace, row, ...(onAction ? { onAction } : {}), ...(can ? { can } : {}), ...(messages ? { messages } : {}) };
251
+ const { view: recordView, row, onAction, can, messages, ...header } = props;
252
+ const menu = { view: recordView, row, ...(onAction ? { onAction } : {}), ...(can ? { can } : {}), ...(messages ? { messages } : {}) };
253
253
  return composeHeaderOptions({
254
254
  ...header,
255
- headerTitle: workspace.headerFor(row as T & DataRow).title,
256
- headerRight: header.headerRight ?? (workspace.headerActions.length ? () => <NativeResourceWorkspaceMenu {...menu} /> : undefined),
255
+ headerTitle: recordView.headerFor(row as T & DataRow).title,
256
+ headerRight: header.headerRight ?? (recordView.headerActions.length ? () => <NativeRecordViewMenu {...menu} /> : undefined),
257
257
  });
258
258
  }
259
259
 
260
260
  // ── Screen ────────────────────────────────────────────────────────────
261
261
 
262
- export interface NativeResourceWorkspaceProps<T extends Row = Row> {
263
- workspace: AnyWorkspace<T>;
262
+ export interface NativeRecordViewProps<T extends Row = Row> {
263
+ view: AnyRecordView<T>;
264
264
  /** The record, as the screen loaded it. A save refreshes it through the cache. */
265
265
  row: T;
266
266
  /**
@@ -283,31 +283,31 @@ export interface NativeResourceWorkspaceProps<T extends Row = Row> {
283
283
  slots?: Partial<Record<string, ReactNode>>;
284
284
  /** More props for a list section's NativeResourceView, by section id. */
285
285
  lists?: Partial<Record<string, Partial<Omit<NativeResourceViewProps, "view" | "filter">>>>;
286
- messages?: Partial<NativeResourceWorkspaceMessages>;
286
+ messages?: Partial<NativeRecordViewMessages>;
287
287
  testID?: string;
288
288
  }
289
289
 
290
290
  /**
291
- * One record's screen from a workspace:
291
+ * One record's screen, from its record view (defineRecordView):
292
292
  *
293
293
  * ```tsx
294
- * <Stack.Screen options={getNativeResourceWorkspaceStackOptions({ workspace: brandWorkspace, row: brand })} />
295
- * <NativeResourceWorkspace workspace={brandWorkspace} row={brand} />
294
+ * <Stack.Screen options={getNativeRecordViewStackOptions({ view: brandRecordView, row: brand })} />
295
+ * <NativeRecordView view={brandRecordView} row={brand} />
296
296
  * ```
297
297
  */
298
- export function NativeResourceWorkspace<T extends Row = Row>(props: NativeResourceWorkspaceProps<T>) {
299
- const { workspace, row, section, onSectionChange, onOpenSection, onSaved, switcher, slots, lists, messages, testID = "native-resource-workspace" } = props;
300
- const words = { ...defaultNativeResourceWorkspaceMessages, ...messages };
298
+ export function NativeRecordView<T extends Row = Row>(props: NativeRecordViewProps<T>) {
299
+ const { view: recordView, row, section, onSectionChange, onOpenSection, onSaved, switcher, slots, lists, messages, testID = "native-resource-workspace" } = props;
300
+ const words = { ...defaultNativeRecordViewMessages, ...messages };
301
301
  const colors = useThemeRoles();
302
302
  const queryClient = useQueryClient();
303
303
  const record = row as T & DataRow;
304
- const sections = workspace.sections;
304
+ const sections = recordView.sections;
305
305
  const many = sections.length > SEGMENTED_SECTIONS_MAX;
306
306
  const [local, setLocal] = useState<string | undefined>(undefined);
307
307
  const activeId = section ?? local ?? (many ? undefined : sections[0]?.id);
308
- const active = activeId ? workspace.section(activeId) : undefined;
309
- const readiness = workspace.readinessFor(record);
310
- const summary = workspace.readinessSummary(record);
308
+ const active = activeId ? recordView.section(activeId) : undefined;
309
+ const readiness = recordView.readinessFor(record);
310
+ const summary = recordView.readinessSummary(record);
311
311
  const chip = summary ? readinessChip(summary, words) : null;
312
312
 
313
313
  const choose = (id: string) => {
@@ -395,7 +395,7 @@ export function NativeResourceWorkspace<T extends Row = Row>(props: NativeResour
395
395
  testID={`${testID}-list`}
396
396
  {...lists?.[active.id]}
397
397
  title={false}
398
- filter={workspace.listFilter(active.id, record)}
398
+ filter={recordView.listFilter(active.id, record)}
399
399
  />
400
400
  );
401
401
  } else if (active?.kind === "settings") {
@@ -403,13 +403,13 @@ export function NativeResourceWorkspace<T extends Row = Row>(props: NativeResour
403
403
  <ScrollView contentContainerStyle={{ padding: 16 }} keyboardShouldPersistTaps="handled">
404
404
  <SettingsGroup
405
405
  // A fresh draft per record and section.
406
- key={`${String(workspace.recordId(record))}:${active.id}`}
407
- workspace={workspace}
406
+ key={`${String(recordView.recordId(record))}:${active.id}`}
407
+ recordView={recordView}
408
408
  sectionId={active.id}
409
409
  row={record}
410
410
  words={words}
411
411
  onSaved={(saved) => {
412
- void queryClient.invalidateQueries({ queryKey: [...resourceKeys(workspace.view.resource).all] });
412
+ void queryClient.invalidateQueries({ queryKey: [...resourceKeys(recordView.view.resource).all] });
413
413
  onSaved?.(saved as T);
414
414
  }}
415
415
  testID={`${testID}-settings`}
@@ -432,7 +432,7 @@ export function NativeResourceWorkspace<T extends Row = Row>(props: NativeResour
432
432
  // ── Settings ──────────────────────────────────────────────────────────
433
433
 
434
434
  function SettingsGroup({
435
- workspace,
435
+ recordView,
436
436
  sectionId,
437
437
  row,
438
438
  words,
@@ -440,23 +440,23 @@ function SettingsGroup({
440
440
  testID,
441
441
  }: {
442
442
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- any contract
443
- workspace: Workspace<ResourceContract<any>, any>;
443
+ recordView: RecordViewDef<ResourceContract<any>, any>;
444
444
  sectionId: string;
445
445
  row: DataRow;
446
- words: NativeResourceWorkspaceMessages;
446
+ words: NativeRecordViewMessages;
447
447
  onSaved: (row: DataRow) => void;
448
448
  testID: string;
449
449
  }) {
450
450
  const provider = useDataProvider();
451
- const view = workspace.view;
451
+ const view = recordView.view;
452
452
  // The view's edit-form mapping (the form sheet's), narrowed to this section's keys in their order.
453
453
  const fields = useMemo(() => {
454
454
  const byKey = new Map(formFieldsFor(view, "edit").map((f) => [f.key, f]));
455
- return workspace.settingsFields(sectionId).map((f) => byKey.get(f.field.name)).filter((f): f is NativeFormField => !!f && !f.readOnly);
456
- }, [workspace, view, sectionId]);
455
+ return recordView.settingsFields(sectionId).map((f) => byKey.get(f.field.name)).filter((f): f is NativeFormField => !!f && !f.readOnly);
456
+ }, [recordView, view, sectionId]);
457
457
  // The view's update guard, for this viewer: when it refuses, the settings are read-only with its reason.
458
458
  const viewer = useViewer();
459
- const locked = workspace.settingsLocked(row, viewer);
459
+ const locked = recordView.settingsLocked(row, viewer);
460
460
  const [draft, setDraft] = useState<Values>(() => Object.fromEntries(fields.map((f) => [f.key, row[f.key]])));
461
461
  const [invalid, setInvalid] = useState<Record<string, string>>({});
462
462
  const [saving, setSaving] = useState(false);
@@ -476,7 +476,7 @@ function SettingsGroup({
476
476
  setRefusal(null);
477
477
  try {
478
478
  // Only the section's listed keys, never anything else the row or draft holds.
479
- const result = await provider.update(view.resource, { id: workspace.recordId(row), data: workspace.settingsPatch(sectionId, changed) });
479
+ const result = await provider.update(view.resource, { id: recordView.recordId(row), data: recordView.settingsPatch(sectionId, changed) });
480
480
  // A write that matched no rows is a refusal, never a silent success.
481
481
  if (!result || result.data === null || result.data === undefined) setRefusal(fill(words.notChanged, { noun: view.noun }));
482
482
  else onSaved(result.data as DataRow);
@@ -491,7 +491,7 @@ function SettingsGroup({
491
491
  <View style={{ gap: 12 }}>
492
492
  {refusal ? <NativeInlineAlert testID={`${testID}-refusal`} variant="destructive" description={refusal} /> : null}
493
493
  {locked !== null ? <NativeInlineAlert testID={`${testID}-locked`} variant="info" description={locked} /> : null}
494
- <Group testID={`${testID}-group`} title={workspace.section(sectionId)?.label}>
494
+ <Group testID={`${testID}-group`} title={recordView.section(sectionId)?.label}>
495
495
  {shown.map((f, i) => (
496
496
  <Cell key={f.key} last={i === shown.length - 1}>
497
497
  <SettingRow
@@ -516,6 +516,41 @@ function SettingsGroup({
516
516
  );
517
517
  }
518
518
 
519
+ // The names before record views were called record views ("workspace" now means where the viewer
520
+ // is working: docs/adr/0004-workspaces.md). Kept for one minor release; `workspace` is now `view`.
521
+
522
+ type OldPage<P extends { view: unknown }> = Omit<P, "view"> & { workspace: P["view"] };
523
+
524
+ /** @deprecated Renamed `NativeRecordViewProps`; its `workspace` prop is now `view`. */
525
+ export type NativeResourceWorkspaceProps<T extends Row = Row> = OldPage<NativeRecordViewProps<T>>;
526
+
527
+ /** @deprecated Renamed `NativeRecordView`, with `view` in place of `workspace`. */
528
+ export function NativeResourceWorkspace<T extends Row = Row>({ workspace, ...props }: NativeResourceWorkspaceProps<T>) {
529
+ return <NativeRecordView<T> {...props} view={workspace} />;
530
+ }
531
+
532
+ /** @deprecated Renamed `NativeRecordViewMenu`, with `view` in place of `workspace`. */
533
+ export function NativeResourceWorkspaceMenu<T extends Row = Row>({ workspace, ...props }: OldPage<NativeRecordViewHeaderProps<T>> & { testID?: string }) {
534
+ return <NativeRecordViewMenu<T> {...props} view={workspace} />;
535
+ }
536
+
537
+ /** @deprecated Renamed `getNativeRecordViewStackOptions`, with `view` in place of `workspace`. */
538
+ export function getNativeResourceWorkspaceStackOptions<T extends Row>({
539
+ workspace,
540
+ ...props
541
+ }: OldPage<NativeRecordViewHeaderProps<T>> & Omit<ScreenHeaderProps, "headerTitle">): Record<string, unknown> {
542
+ return getNativeRecordViewStackOptions<T>({ ...props, view: workspace });
543
+ }
544
+
545
+ /** @deprecated Renamed `NativeRecordViewHeaderProps`; its `workspace` prop is now `view`. */
546
+ export type NativeResourceWorkspaceHeaderProps<T extends Row = Row> = OldPage<NativeRecordViewHeaderProps<T>>;
547
+
548
+ /** @deprecated Renamed `NativeRecordViewMessages`. */
549
+ export type NativeResourceWorkspaceMessages = NativeRecordViewMessages;
550
+
551
+ /** @deprecated Renamed `defaultNativeRecordViewMessages`. */
552
+ export const defaultNativeResourceWorkspaceMessages = defaultNativeRecordViewMessages;
553
+
519
554
  /**
520
555
  * A number as typed: "1.5" or, with a comma as the decimal mark, "1,5". Anything else (an empty
521
556
  * string aside) is an error, never NaN.
@@ -542,7 +577,7 @@ function SettingRow({
542
577
  value: unknown;
543
578
  error?: string | undefined;
544
579
  disabled: boolean;
545
- words: NativeResourceWorkspaceMessages;
580
+ words: NativeRecordViewMessages;
546
581
  onChange: (v: unknown, error?: string) => void;
547
582
  testID: string;
548
583
  }) {