@daltonr/pathwrite-react-native 0.9.0 → 0.10.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/README.md +123 -227
- package/dist/index.d.ts +25 -4
- package/dist/index.js +67 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +139 -30
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# @daltonr/pathwrite-react-native
|
|
2
2
|
|
|
3
|
-
React Native adapter for
|
|
4
|
-
|
|
5
|
-
Works with Expo (managed and bare workflow) and bare React Native projects. Targets iOS and Android.
|
|
3
|
+
React Native adapter for Pathwrite — exposes path engine state via `useSyncExternalStore` with stable callbacks, an optional context provider, and an optional `PathShell` default UI built from React Native primitives.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
@@ -10,293 +8,191 @@ Works with Expo (managed and bare workflow) and bare React Native projects. Targ
|
|
|
10
8
|
npm install @daltonr/pathwrite-core @daltonr/pathwrite-react-native
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
Peer dependencies: `react >=
|
|
14
|
-
|
|
15
|
-
## Exports
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
import {
|
|
19
|
-
PathShell, // React Native UI shell
|
|
20
|
-
usePath, // Hook — creates a scoped engine
|
|
21
|
-
usePathContext, // Hook — reads the nearest PathProvider
|
|
22
|
-
PathProvider, // Context provider
|
|
23
|
-
// Core types re-exported for convenience:
|
|
24
|
-
PathEngine,
|
|
25
|
-
PathData,
|
|
26
|
-
PathDefinition,
|
|
27
|
-
PathEvent,
|
|
28
|
-
PathSnapshot,
|
|
29
|
-
PathStep,
|
|
30
|
-
PathStepContext,
|
|
31
|
-
StepChoice,
|
|
32
|
-
SerializedPathState,
|
|
33
|
-
} from "@daltonr/pathwrite-react-native";
|
|
34
|
-
```
|
|
11
|
+
Peer dependencies: `react-native >= 0.73.0`, `react >= 18.0.0`
|
|
35
12
|
|
|
36
13
|
---
|
|
37
14
|
|
|
38
|
-
## Quick
|
|
39
|
-
|
|
40
|
-
The fastest way to get started. `PathShell` manages the engine lifecycle, renders the active step, and provides navigation buttons. The default header shows numbered step dots (✓ when completed), the current step title, and a progress bar.
|
|
15
|
+
## Quick start
|
|
41
16
|
|
|
42
17
|
```tsx
|
|
43
|
-
import { PathShell } from "@daltonr/pathwrite-react-native";
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import { ReviewStep } from "./ReviewStep";
|
|
18
|
+
import { PathShell, usePathContext } from "@daltonr/pathwrite-react-native";
|
|
19
|
+
import type { PathDefinition, PathData } from "@daltonr/pathwrite-core";
|
|
20
|
+
import { View, Text, TextInput, TouchableOpacity } from "react-native";
|
|
47
21
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<PathShell
|
|
51
|
-
path={myPath}
|
|
52
|
-
initialData={INITIAL_DATA}
|
|
53
|
-
onComplete={(data) => console.log("Done!", data)}
|
|
54
|
-
steps={{
|
|
55
|
-
details: <DetailsStep />,
|
|
56
|
-
review: <ReviewStep />,
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
22
|
+
interface SignupData extends PathData {
|
|
23
|
+
name: string;
|
|
60
24
|
}
|
|
61
|
-
```
|
|
62
25
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const { snapshot, setData } = usePathContext<MyData>();
|
|
71
|
-
const name = snapshot?.data.name ?? "";
|
|
26
|
+
const signupPath: PathDefinition<SignupData> = {
|
|
27
|
+
id: "signup",
|
|
28
|
+
steps: [
|
|
29
|
+
{ id: "details", title: "Your Details", canMoveNext: ({ data }) => data.name.trim().length >= 2 },
|
|
30
|
+
{ id: "review", title: "Review" },
|
|
31
|
+
],
|
|
32
|
+
};
|
|
72
33
|
|
|
34
|
+
function DetailsStep() {
|
|
35
|
+
const { snapshot, setData } = usePathContext<SignupData>();
|
|
36
|
+
if (!snapshot) return null;
|
|
73
37
|
return (
|
|
74
38
|
<TextInput
|
|
75
|
-
value={name}
|
|
39
|
+
value={snapshot.data.name}
|
|
76
40
|
onChangeText={(text) => setData("name", text)}
|
|
77
41
|
placeholder="Your name"
|
|
78
42
|
/>
|
|
79
43
|
);
|
|
80
44
|
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## Option A — `usePath` hook (component-scoped)
|
|
86
|
-
|
|
87
|
-
Each call creates an isolated engine. Good when a single screen owns the path.
|
|
88
|
-
|
|
89
|
-
```tsx
|
|
90
|
-
import { usePath } from "@daltonr/pathwrite-react-native";
|
|
91
|
-
import { myPath } from "./my-path";
|
|
92
|
-
|
|
93
|
-
function MyScreen() {
|
|
94
|
-
const { snapshot, start, next, previous, setData } = usePath({
|
|
95
|
-
onEvent(event) {
|
|
96
|
-
if (event.type === "completed") console.log("Done!", event.data);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
start(myPath, { name: "" });
|
|
102
|
-
}, []);
|
|
103
45
|
|
|
46
|
+
function ReviewStep() {
|
|
47
|
+
const { snapshot } = usePathContext<SignupData>();
|
|
104
48
|
if (!snapshot) return null;
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<View>
|
|
108
|
-
<Text>{snapshot.stepTitle ?? snapshot.stepId}</Text>
|
|
109
|
-
<Text>Step {snapshot.stepIndex + 1} of {snapshot.stepCount}</Text>
|
|
110
|
-
<Pressable onPress={previous} disabled={snapshot.isNavigating}>
|
|
111
|
-
<Text>Back</Text>
|
|
112
|
-
</Pressable>
|
|
113
|
-
<Pressable onPress={next} disabled={snapshot.isNavigating || !snapshot.canMoveNext}>
|
|
114
|
-
<Text>{snapshot.isLastStep ? "Complete" : "Next"}</Text>
|
|
115
|
-
</Pressable>
|
|
116
|
-
</View>
|
|
117
|
-
);
|
|
49
|
+
return <Text>Signing up as {snapshot.data.name}</Text>;
|
|
118
50
|
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Option B — `PathProvider` + `usePathContext` (tree-scoped)
|
|
122
|
-
|
|
123
|
-
Share one engine across a component tree — step components read state without prop-drilling.
|
|
124
51
|
|
|
125
|
-
|
|
126
|
-
import { PathProvider } from "@daltonr/pathwrite-react-native";
|
|
127
|
-
|
|
128
|
-
// Root — start the path once, then render children
|
|
129
|
-
function WizardRoot() {
|
|
130
|
-
const { snapshot, start, next } = usePathContext();
|
|
131
|
-
useEffect(() => { start(myPath, {}); }, []);
|
|
132
|
-
return (
|
|
133
|
-
<View>
|
|
134
|
-
{snapshot && <Text>Step {snapshot.stepIndex + 1}</Text>}
|
|
135
|
-
<Pressable onPress={next}><Text>Next</Text></Pressable>
|
|
136
|
-
</View>
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Wrap in the provider at the navigation/screen level
|
|
141
|
-
export function WizardScreen() {
|
|
52
|
+
export function SignupFlow() {
|
|
142
53
|
return (
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
54
|
+
<PathShell
|
|
55
|
+
path={signupPath}
|
|
56
|
+
initialData={{ name: "" }}
|
|
57
|
+
onComplete={(data) => console.log("Done!", data)}
|
|
58
|
+
steps={{ details: <DetailsStep />, review: <ReviewStep /> }}
|
|
59
|
+
/>
|
|
146
60
|
);
|
|
147
61
|
}
|
|
148
62
|
```
|
|
149
63
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
## Path definition
|
|
153
|
-
|
|
154
|
-
Path definitions are plain objects — no classes, no decorators, framework-agnostic.
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
import type { PathDefinition } from "@daltonr/pathwrite-react-native";
|
|
158
|
-
|
|
159
|
-
interface MyData {
|
|
160
|
-
name: string;
|
|
161
|
-
agreed: boolean;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export const myPath: PathDefinition<MyData> = {
|
|
165
|
-
id: "onboarding",
|
|
166
|
-
steps: [
|
|
167
|
-
{
|
|
168
|
-
id: "name",
|
|
169
|
-
title: "Your Name",
|
|
170
|
-
canMoveNext: ({ data }) => data.name.trim().length >= 2,
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
id: "terms",
|
|
174
|
-
title: "Terms",
|
|
175
|
-
canMoveNext: ({ data }) => data.agreed,
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
id: "done",
|
|
179
|
-
title: "All Done",
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
};
|
|
183
|
-
```
|
|
64
|
+
Step components call `usePathContext()` to access engine state — no prop drilling needed. `<PathShell>` provides the context automatically.
|
|
184
65
|
|
|
185
66
|
---
|
|
186
67
|
|
|
187
|
-
##
|
|
68
|
+
## Metro config
|
|
188
69
|
|
|
189
|
-
|
|
70
|
+
Metro does not follow symlinks by default, so workspace packages installed above the app root are invisible to the bundler. This is the most common setup issue when using Pathwrite in a monorepo. Create or update `metro.config.js` in your React Native or Expo app:
|
|
190
71
|
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
```
|
|
72
|
+
```js
|
|
73
|
+
// metro.config.js
|
|
74
|
+
const { getDefaultConfig } = require("expo/metro-config");
|
|
75
|
+
// For bare React Native: const { getDefaultConfig } = require("@react-native/metro-config");
|
|
76
|
+
const path = require("path");
|
|
197
77
|
|
|
198
|
-
|
|
78
|
+
const projectRoot = __dirname;
|
|
79
|
+
const workspaceRoot = path.resolve(projectRoot, "../../.."); // adjust depth to your repo
|
|
199
80
|
|
|
200
|
-
|
|
81
|
+
const config = getDefaultConfig(projectRoot);
|
|
201
82
|
|
|
202
|
-
|
|
83
|
+
// 1. Watch workspace source files outside the app root.
|
|
84
|
+
config.watchFolders = [workspaceRoot];
|
|
203
85
|
|
|
204
|
-
|
|
205
|
-
{
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
{ id: "address-ie", title: "Irish Address" },
|
|
211
|
-
],
|
|
212
|
-
}
|
|
213
|
-
```
|
|
86
|
+
// 2. Map package names directly to their source directories.
|
|
87
|
+
config.resolver.extraNodeModules = {
|
|
88
|
+
"@daltonr/pathwrite-core": path.resolve(workspaceRoot, "packages/core"),
|
|
89
|
+
"@daltonr/pathwrite-react-native": path.resolve(workspaceRoot, "packages/react-native-adapter"),
|
|
90
|
+
// Add any other workspace packages your app imports here.
|
|
91
|
+
};
|
|
214
92
|
|
|
215
|
-
|
|
93
|
+
// 3. Restrict node_modules lookup to the app's own folder.
|
|
94
|
+
config.resolver.nodeModulesPaths = [
|
|
95
|
+
path.resolve(projectRoot, "node_modules"),
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
// 4. Pin react/react-native/scheduler to the app's own copies.
|
|
99
|
+
config.resolver.resolveRequest = (context, moduleName, platform) => {
|
|
100
|
+
if (
|
|
101
|
+
moduleName === "react" || moduleName.startsWith("react/") ||
|
|
102
|
+
moduleName === "react-native" || moduleName.startsWith("react-native/") ||
|
|
103
|
+
moduleName === "scheduler" || moduleName.startsWith("scheduler/")
|
|
104
|
+
) {
|
|
105
|
+
try {
|
|
106
|
+
return { filePath: require.resolve(moduleName, { paths: [projectRoot] }), type: "sourceFile" };
|
|
107
|
+
} catch { /* fall through */ }
|
|
108
|
+
}
|
|
109
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
110
|
+
};
|
|
216
111
|
|
|
217
|
-
|
|
218
|
-
<PathShell
|
|
219
|
-
path={myPath}
|
|
220
|
-
steps={{
|
|
221
|
-
name: <NameStep />,
|
|
222
|
-
"address-us": <USAddressStep />,
|
|
223
|
-
"address-ie": <IrishAddressStep />,
|
|
224
|
-
done: <DoneStep />,
|
|
225
|
-
}}
|
|
226
|
-
/>
|
|
112
|
+
module.exports = config;
|
|
227
113
|
```
|
|
228
114
|
|
|
229
|
-
|
|
115
|
+
Every new workspace package your app imports must be added to `extraNodeModules`. After changing this file, restart Metro with `npx expo start --clear` (or `npx react-native start --reset-cache` for bare RN).
|
|
230
116
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
Push a sub-path onto the stack from within a step. The parent path resumes from the same step when the sub-path completes.
|
|
117
|
+
---
|
|
234
118
|
|
|
235
|
-
|
|
236
|
-
const { startSubPath } = usePathContext();
|
|
119
|
+
## usePath / PathShell
|
|
237
120
|
|
|
238
|
-
|
|
239
|
-
startSubPath(subWizardPath, {});
|
|
240
|
-
}
|
|
241
|
-
```
|
|
121
|
+
The API is identical to `@daltonr/pathwrite-react`. `usePath` creates an engine instance scoped to the calling component; `usePathContext` reads the nearest `PathShell` or `PathProvider` ancestor.
|
|
242
122
|
|
|
243
|
-
|
|
123
|
+
### usePath return value
|
|
244
124
|
|
|
245
|
-
|
|
125
|
+
| Field | Type | Description |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| `snapshot` | `PathSnapshot \| null` | Current state. `null` when no path is active. |
|
|
128
|
+
| `start(definition, data?)` | function | Start a path. |
|
|
129
|
+
| `next()` | function | Advance one step. Completes on the last step. |
|
|
130
|
+
| `previous()` | function | Go back one step. |
|
|
131
|
+
| `cancel()` | function | Cancel the active path or sub-path. |
|
|
132
|
+
| `goToStep(stepId)` | function | Jump to a step by ID, bypassing guards. |
|
|
133
|
+
| `goToStepChecked(stepId)` | function | Jump to a step by ID, checking the current step's guard first. |
|
|
134
|
+
| `setData(key, value)` | function | Update a single data field. Type-checked when `TData` is provided. |
|
|
135
|
+
| `resetStep()` | function | Restore data to step-entry state. |
|
|
136
|
+
| `startSubPath(definition, data?, meta?)` | function | Push a sub-path. |
|
|
137
|
+
| `restart(definition, data?)` | function | Tear down any active path and start fresh. |
|
|
138
|
+
|
|
139
|
+
All returned callbacks are referentially stable.
|
|
140
|
+
|
|
141
|
+
### PathShell props
|
|
246
142
|
|
|
247
143
|
| Prop | Type | Default | Description |
|
|
248
144
|
|---|---|---|---|
|
|
249
145
|
| `path` | `PathDefinition` | required | The path to drive. |
|
|
250
|
-
| `steps` | `Record<string, ReactNode>` | required | Map of step ID
|
|
146
|
+
| `steps` | `Record<string, ReactNode>` | required | Map of step ID to content. Keys must exactly match step IDs. |
|
|
251
147
|
| `initialData` | `PathData` | `{}` | Initial data passed to `engine.start()`. |
|
|
252
|
-
| `engine` | `PathEngine` | — | Externally
|
|
148
|
+
| `engine` | `PathEngine` | — | Externally-managed engine (e.g. from `restoreOrStart()`). |
|
|
253
149
|
| `autoStart` | `boolean` | `true` | Start the path automatically on mount. |
|
|
254
|
-
| `onComplete` | `(data) => void` | — | Called when the path completes. |
|
|
255
|
-
| `onCancel` | `(data) => void` | — | Called when the path is cancelled. |
|
|
256
|
-
| `onEvent` | `(event) => void` | — | Called for every engine event. |
|
|
150
|
+
| `onComplete` | `(data: PathData) => void` | — | Called when the path completes. |
|
|
151
|
+
| `onCancel` | `(data: PathData) => void` | — | Called when the path is cancelled. |
|
|
152
|
+
| `onEvent` | `(event: PathEvent) => void` | — | Called for every engine event. |
|
|
257
153
|
| `backLabel` | `string` | `"Previous"` | Label for the back button. |
|
|
258
154
|
| `nextLabel` | `string` | `"Next"` | Label for the next button. |
|
|
259
155
|
| `completeLabel` | `string` | `"Complete"` | Label for the next button on the last step. |
|
|
260
156
|
| `cancelLabel` | `string` | `"Cancel"` | Label for the cancel button. |
|
|
261
157
|
| `hideCancel` | `boolean` | `false` | Hide the cancel button. |
|
|
262
|
-
| `hideProgress` | `boolean` | `false` | Hide the progress header
|
|
263
|
-
| `disableBodyScroll` | `boolean` | `false` | Replace the `ScrollView` body
|
|
264
|
-
| `footerLayout` | `"wizard" \| "form" \| "auto"` | `"auto"` | `"wizard"
|
|
158
|
+
| `hideProgress` | `boolean` | `false` | Hide the progress header. Also hidden automatically for single-step paths. |
|
|
159
|
+
| `disableBodyScroll` | `boolean` | `false` | Replace the `ScrollView` body with a plain `View`. Use when a step contains a `FlatList` or other virtualized list. |
|
|
160
|
+
| `footerLayout` | `"wizard" \| "form" \| "auto"` | `"auto"` | `"wizard"`: Back on left. `"form"`: Cancel on left, no Back. |
|
|
265
161
|
| `renderHeader` | `(snapshot) => ReactNode` | — | Replace the default progress header entirely. |
|
|
266
|
-
| `renderFooter` | `(snapshot, actions) => ReactNode` | — | Replace the default
|
|
162
|
+
| `renderFooter` | `(snapshot, actions) => ReactNode` | — | Replace the default navigation buttons. |
|
|
267
163
|
| `style` | `StyleProp<ViewStyle>` | — | Override for the root `View`. |
|
|
268
164
|
|
|
269
|
-
|
|
165
|
+
### PathShellHandle and the restart() ref pattern
|
|
270
166
|
|
|
271
|
-
|
|
167
|
+
`PathShell` is a `forwardRef` component that exposes a `PathShellHandle`. Use a ref to call `restart()` imperatively from outside the shell — for example, from a parent screen's header button:
|
|
272
168
|
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
onEvent?: (event: PathEvent) => void;
|
|
277
|
-
})
|
|
278
|
-
```
|
|
169
|
+
```tsx
|
|
170
|
+
import { useRef } from "react";
|
|
171
|
+
import { PathShell, PathShellHandle } from "@daltonr/pathwrite-react-native";
|
|
279
172
|
|
|
280
|
-
|
|
173
|
+
export function OnboardingScreen() {
|
|
174
|
+
const shellRef = useRef<PathShellHandle>(null);
|
|
281
175
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
| `resetStep` | `() => void` | Restore data to step-entry state. |
|
|
294
|
-
| `restart` | `(path, data?) => void` | Tear down and restart fresh. |
|
|
176
|
+
return (
|
|
177
|
+
<PathShell
|
|
178
|
+
ref={shellRef}
|
|
179
|
+
path={myPath}
|
|
180
|
+
initialData={{ name: "" }}
|
|
181
|
+
onComplete={(data) => console.log(data)}
|
|
182
|
+
steps={{ name: <NameStep /> }}
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
295
187
|
|
|
296
188
|
---
|
|
297
189
|
|
|
298
|
-
##
|
|
190
|
+
## Further reading
|
|
299
191
|
|
|
300
|
-
|
|
192
|
+
- [React Native getting started guide](../../docs/getting-started/frameworks/react-native.md)
|
|
193
|
+
- [Navigation guide](../../docs/guides/navigation.md)
|
|
194
|
+
- [Full docs](../../docs/README.md)
|
|
195
|
+
|
|
196
|
+
---
|
|
301
197
|
|
|
302
|
-
|
|
198
|
+
© 2026 Devjoy Ltd. MIT License.
|
package/dist/index.d.ts
CHANGED
|
@@ -38,22 +38,34 @@ export interface UsePathReturn<TData extends PathData = PathData> {
|
|
|
38
38
|
resetStep: () => void;
|
|
39
39
|
/** Tear down any active path and immediately start the given path fresh. */
|
|
40
40
|
restart: () => void;
|
|
41
|
+
/** Re-runs the operation that set `snapshot.error`. Increments `retryCount` on repeated failure. No-op when there is no pending error. */
|
|
42
|
+
retry: () => void;
|
|
43
|
+
/** Pauses the path with intent to return. Emits `suspended`. All state is preserved. */
|
|
44
|
+
suspend: () => void;
|
|
41
45
|
}
|
|
42
46
|
export type PathProviderProps = PropsWithChildren<{
|
|
43
47
|
onEvent?: (event: PathEvent) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Services object passed through context to all step components.
|
|
50
|
+
* Step components access it via `usePathContext<TData, TServices>()`.
|
|
51
|
+
*/
|
|
52
|
+
services?: unknown;
|
|
44
53
|
}>;
|
|
45
54
|
export declare function usePath<TData extends PathData = PathData>(options?: UsePathOptions): UsePathReturn<TData>;
|
|
46
55
|
/**
|
|
47
56
|
* Provides a single `usePath` instance to all descendants.
|
|
48
57
|
* Consume with `usePathContext()`.
|
|
49
58
|
*/
|
|
50
|
-
export declare function PathProvider({ children, onEvent }: PathProviderProps): ReactElement;
|
|
59
|
+
export declare function PathProvider({ children, onEvent, services }: PathProviderProps): ReactElement;
|
|
51
60
|
/**
|
|
52
|
-
* Access the nearest `PathProvider`'s path instance.
|
|
53
|
-
* Throws if used outside of a `<PathProvider>`.
|
|
61
|
+
* Access the nearest `PathProvider`'s path instance and optional services object.
|
|
62
|
+
* Throws if used outside of a `<PathProvider>` or `<PathShell>`.
|
|
63
|
+
*
|
|
64
|
+
* `TData` narrows `snapshot.data`; `TServices` types the `services` value.
|
|
54
65
|
*/
|
|
55
|
-
export declare function usePathContext<TData extends PathData = PathData>(): Omit<UsePathReturn<TData>, "snapshot"> & {
|
|
66
|
+
export declare function usePathContext<TData extends PathData = PathData, TServices = unknown>(): Omit<UsePathReturn<TData>, "snapshot"> & {
|
|
56
67
|
snapshot: PathSnapshot<TData>;
|
|
68
|
+
services: TServices;
|
|
57
69
|
};
|
|
58
70
|
export interface PathShellHandle {
|
|
59
71
|
/** Restart the shell's current path with its original `initialData`, without unmounting. */
|
|
@@ -67,6 +79,8 @@ export interface PathShellActions {
|
|
|
67
79
|
goToStepChecked: (stepId: string) => void;
|
|
68
80
|
setData: (key: string, value: unknown) => void;
|
|
69
81
|
restart: () => void;
|
|
82
|
+
retry: () => void;
|
|
83
|
+
suspend: () => void;
|
|
70
84
|
}
|
|
71
85
|
export interface PathShellProps {
|
|
72
86
|
/** The path definition to drive. */
|
|
@@ -91,6 +105,8 @@ export interface PathShellProps {
|
|
|
91
105
|
nextLabel?: string;
|
|
92
106
|
/** Label for the Complete button (last step). Defaults to "Complete". */
|
|
93
107
|
completeLabel?: string;
|
|
108
|
+
/** Label shown on the Next/Complete button while an async operation is in progress. When undefined, an ActivityIndicator spinner is shown instead. */
|
|
109
|
+
loadingLabel?: string;
|
|
94
110
|
/** Label for the Cancel button. Defaults to "Cancel". */
|
|
95
111
|
cancelLabel?: string;
|
|
96
112
|
/** If true, hide the Cancel button. */
|
|
@@ -130,6 +146,11 @@ export interface PathShellProps {
|
|
|
130
146
|
* warning. The step is then responsible for managing its own scroll.
|
|
131
147
|
*/
|
|
132
148
|
disableBodyScroll?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Services object passed through context to all step components.
|
|
151
|
+
* Step components access it via `usePathContext<TData, TServices>()`.
|
|
152
|
+
*/
|
|
153
|
+
services?: unknown;
|
|
133
154
|
}
|
|
134
155
|
/**
|
|
135
156
|
* Default UI shell for React Native. Renders a progress dot indicator,
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, createElement, forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useRef, useSyncExternalStore, } from "react";
|
|
3
3
|
import { View, Text, Pressable, ScrollView, StyleSheet, ActivityIndicator, KeyboardAvoidingView, Platform, } from "react-native";
|
|
4
|
-
import { PathEngine, } from "@daltonr/pathwrite-core";
|
|
4
|
+
import { PathEngine, formatFieldKey, errorPhaseMessage, } from "@daltonr/pathwrite-core";
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
// usePath hook
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
@@ -46,30 +46,34 @@ export function usePath(options) {
|
|
|
46
46
|
const setData = useCallback((key, value) => engine.setData(key, value), [engine]);
|
|
47
47
|
const resetStep = useCallback(() => engine.resetStep(), [engine]);
|
|
48
48
|
const restart = useCallback(() => engine.restart(), [engine]);
|
|
49
|
-
|
|
49
|
+
const retry = useCallback(() => engine.retry(), [engine]);
|
|
50
|
+
const suspend = useCallback(() => engine.suspend(), [engine]);
|
|
51
|
+
return { snapshot, start, startSubPath, next, previous, cancel, goToStep, goToStepChecked, setData, resetStep, restart, retry, suspend };
|
|
50
52
|
}
|
|
51
|
-
// ---------------------------------------------------------------------------
|
|
52
|
-
// Context + Provider
|
|
53
|
-
// ---------------------------------------------------------------------------
|
|
54
53
|
const PathContext = createContext(null);
|
|
55
54
|
/**
|
|
56
55
|
* Provides a single `usePath` instance to all descendants.
|
|
57
56
|
* Consume with `usePathContext()`.
|
|
58
57
|
*/
|
|
59
|
-
export function PathProvider({ children, onEvent }) {
|
|
58
|
+
export function PathProvider({ children, onEvent, services }) {
|
|
60
59
|
const path = usePath({ onEvent });
|
|
61
|
-
return createElement(PathContext.Provider, { value: path }, children);
|
|
60
|
+
return createElement(PathContext.Provider, { value: { path, services: services ?? null } }, children);
|
|
62
61
|
}
|
|
63
62
|
/**
|
|
64
|
-
* Access the nearest `PathProvider`'s path instance.
|
|
65
|
-
* Throws if used outside of a `<PathProvider>`.
|
|
63
|
+
* Access the nearest `PathProvider`'s path instance and optional services object.
|
|
64
|
+
* Throws if used outside of a `<PathProvider>` or `<PathShell>`.
|
|
65
|
+
*
|
|
66
|
+
* `TData` narrows `snapshot.data`; `TServices` types the `services` value.
|
|
66
67
|
*/
|
|
67
68
|
export function usePathContext() {
|
|
68
69
|
const ctx = useContext(PathContext);
|
|
69
70
|
if (ctx === null) {
|
|
70
71
|
throw new Error("usePathContext must be used within a <PathProvider>.");
|
|
71
72
|
}
|
|
72
|
-
return
|
|
73
|
+
return {
|
|
74
|
+
...ctx.path,
|
|
75
|
+
services: ctx.services
|
|
76
|
+
};
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
75
79
|
* Default UI shell for React Native. Renders a progress dot indicator,
|
|
@@ -87,7 +91,7 @@ export function usePathContext() {
|
|
|
87
91
|
* />
|
|
88
92
|
* ```
|
|
89
93
|
*/
|
|
90
|
-
export const PathShell = forwardRef(function PathShell({ path: pathDef, engine: externalEngine, steps, initialData = {}, autoStart = true, onComplete, onCancel, onEvent, backLabel = "Previous", nextLabel = "Next", completeLabel = "Complete", cancelLabel = "Cancel", hideCancel = false, hideProgress = false, footerLayout = "auto", validationDisplay = "summary", renderHeader, renderFooter, style, keyboardVerticalOffset = 0, disableBodyScroll = false, }, ref) {
|
|
94
|
+
export const PathShell = forwardRef(function PathShell({ path: pathDef, engine: externalEngine, steps, initialData = {}, autoStart = true, onComplete, onCancel, onEvent, backLabel = "Previous", nextLabel = "Next", completeLabel = "Complete", loadingLabel, cancelLabel = "Cancel", hideCancel = false, hideProgress = false, footerLayout = "auto", validationDisplay = "summary", renderHeader, renderFooter, style, keyboardVerticalOffset = 0, disableBodyScroll = false, services, }, ref) {
|
|
91
95
|
const pathReturn = usePath({
|
|
92
96
|
engine: externalEngine,
|
|
93
97
|
onEvent(event) {
|
|
@@ -98,7 +102,7 @@ export const PathShell = forwardRef(function PathShell({ path: pathDef, engine:
|
|
|
98
102
|
onCancel?.(event.data);
|
|
99
103
|
},
|
|
100
104
|
});
|
|
101
|
-
const { snapshot, start, next, previous, cancel, goToStep, goToStepChecked, setData, restart } = pathReturn;
|
|
105
|
+
const { snapshot, start, next, previous, cancel, goToStep, goToStepChecked, setData, restart, retry, suspend } = pathReturn;
|
|
102
106
|
useImperativeHandle(ref, () => ({
|
|
103
107
|
restart: () => restart(),
|
|
104
108
|
}));
|
|
@@ -114,12 +118,15 @@ export const PathShell = forwardRef(function PathShell({ path: pathDef, engine:
|
|
|
114
118
|
const stepContent = snapshot
|
|
115
119
|
? ((snapshot.formId ? steps[snapshot.formId] : undefined) ?? steps[snapshot.stepId] ?? null)
|
|
116
120
|
: null;
|
|
121
|
+
const contextValue = { path: pathReturn, services: services ?? null };
|
|
117
122
|
const actions = {
|
|
118
123
|
next, previous, cancel, goToStep, goToStepChecked, setData,
|
|
119
124
|
restart: () => restart(),
|
|
125
|
+
retry: () => retry(),
|
|
126
|
+
suspend: () => suspend(),
|
|
120
127
|
};
|
|
121
128
|
if (!snapshot) {
|
|
122
|
-
return (_jsx(PathContext.Provider, { value:
|
|
129
|
+
return (_jsx(PathContext.Provider, { value: contextValue, children: _jsx(View, { style: [styles.shell, style], children: _jsxs(View, { style: styles.emptyState, children: [_jsx(Text, { style: styles.emptyText, children: "No active path." }), !autoStart && (_jsx(Pressable, { style: styles.btnPrimary, onPress: () => start(pathDef, initialData), children: _jsx(Text, { style: styles.btnPrimaryText, children: "Start" }) }))] }) }) }));
|
|
123
130
|
}
|
|
124
131
|
const resolvedLayout = footerLayout === "auto"
|
|
125
132
|
? snapshot.stepCount === 1 && snapshot.nestingLevel === 0
|
|
@@ -128,7 +135,7 @@ export const PathShell = forwardRef(function PathShell({ path: pathDef, engine:
|
|
|
128
135
|
: footerLayout;
|
|
129
136
|
const isFormMode = resolvedLayout === "form";
|
|
130
137
|
const showProgress = !hideProgress && (snapshot.stepCount > 1 || snapshot.nestingLevel > 0);
|
|
131
|
-
return (_jsx(PathContext.Provider, { value:
|
|
138
|
+
return (_jsx(PathContext.Provider, { value: contextValue, children: _jsxs(KeyboardAvoidingView, { style: [styles.shell, style], behavior: Platform.OS === "ios" ? "padding" : undefined, keyboardVerticalOffset: keyboardVerticalOffset, children: [showProgress && (renderHeader
|
|
132
139
|
? renderHeader(snapshot)
|
|
133
140
|
: (_jsxs(View, { style: styles.header, children: [_jsx(View, { style: styles.stepper, children: snapshot.steps.map((step, i) => (_jsx(View, { style: [
|
|
134
141
|
styles.dot,
|
|
@@ -140,19 +147,21 @@ export const PathShell = forwardRef(function PathShell({ path: pathDef, engine:
|
|
|
140
147
|
return title ? _jsx(Text, { style: styles.stepTitle, children: title }) : null;
|
|
141
148
|
})(), _jsx(View, { style: styles.track, children: _jsx(View, { style: [styles.trackFill, { width: `${snapshot.progress * 100}%` }] }) })] }))), disableBodyScroll
|
|
142
149
|
? _jsx(View, { style: [styles.body, styles.bodyContent], children: stepContent })
|
|
143
|
-
: _jsx(ScrollView, { style: styles.body, contentContainerStyle: styles.bodyContent, children: stepContent }), validationDisplay !== "inline" && snapshot.hasAttemptedNext && Object.keys(snapshot.fieldErrors).length > 0 && (_jsx(View, { style: styles.validation, children: Object.entries(snapshot.fieldErrors).map(([key, msg]) => (_jsxs(Text, { style: styles.validationItem, children: [key !== "_" && _jsxs(Text, { style: styles.validationLabel, children: [formatFieldKey(key), ": "] }), msg] }, key))) })), Object.keys(snapshot.fieldWarnings).length > 0 && (_jsx(View, { style: styles.warnings, children: Object.entries(snapshot.fieldWarnings).map(([key, msg]) => (_jsxs(Text, { style: styles.warningItem, children: [key !== "_" && _jsxs(Text, { style: styles.warningLabel, children: [formatFieldKey(key), ": "] }), msg] }, key))) })),
|
|
144
|
-
?
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
: _jsx(ScrollView, { style: styles.body, contentContainerStyle: styles.bodyContent, children: stepContent }), validationDisplay !== "inline" && snapshot.hasAttemptedNext && Object.keys(snapshot.fieldErrors).length > 0 && (_jsx(View, { style: styles.validation, children: Object.entries(snapshot.fieldErrors).map(([key, msg]) => (_jsxs(Text, { style: styles.validationItem, children: [key !== "_" && _jsxs(Text, { style: styles.validationLabel, children: [formatFieldKey(key), ": "] }), msg] }, key))) })), Object.keys(snapshot.fieldWarnings).length > 0 && (_jsx(View, { style: styles.warnings, children: Object.entries(snapshot.fieldWarnings).map(([key, msg]) => (_jsxs(Text, { style: styles.warningItem, children: [key !== "_" && _jsxs(Text, { style: styles.warningLabel, children: [formatFieldKey(key), ": "] }), msg] }, key))) })), validationDisplay !== "inline" && snapshot.hasAttemptedNext && snapshot.blockingError && (_jsx(Text, { style: styles.blockingError, children: snapshot.blockingError })), snapshot.status === "error" && snapshot.error
|
|
151
|
+
? (() => {
|
|
152
|
+
const err = snapshot.error;
|
|
153
|
+
const escalated = err.retryCount >= 2;
|
|
154
|
+
return (_jsxs(View, { style: styles.errorPanel, children: [_jsx(Text, { style: styles.errorTitle, children: escalated ? "Still having trouble." : "Something went wrong." }), _jsxs(Text, { style: styles.errorMessage, children: [errorPhaseMessage(err.phase), err.message ? ` ${err.message}` : ""] }), _jsxs(View, { style: styles.errorActions, children: [!escalated && (_jsx(Pressable, { style: [styles.btn, styles.btnRetry], onPress: retry, children: _jsx(Text, { style: styles.btnPrimaryText, children: "Try again" }) })), snapshot.hasPersistence && (_jsx(Pressable, { style: [styles.btn, escalated ? styles.btnRetry : styles.btnSuspend], onPress: suspend, children: _jsx(Text, { style: escalated ? styles.btnPrimaryText : styles.btnCancelText, children: "Save and come back later" }) })), escalated && !snapshot.hasPersistence && (_jsx(Pressable, { style: [styles.btn, styles.btnRetry], onPress: retry, children: _jsx(Text, { style: styles.btnPrimaryText, children: "Try again" }) }))] })] }));
|
|
155
|
+
})()
|
|
156
|
+
: renderFooter
|
|
157
|
+
? renderFooter(snapshot, actions)
|
|
158
|
+
: (_jsxs(View, { style: styles.footer, children: [_jsxs(View, { style: styles.footerLeft, children: [isFormMode && !hideCancel && (_jsx(Pressable, { style: [styles.btn, styles.btnCancel, snapshot.status !== "idle" && styles.btnDisabled], onPress: cancel, disabled: snapshot.status !== "idle", children: _jsx(Text, { style: styles.btnCancelText, children: cancelLabel }) })), !isFormMode && !snapshot.isFirstStep && (_jsx(Pressable, { style: [styles.btn, styles.btnBack, (snapshot.status !== "idle" || !snapshot.canMovePrevious) && styles.btnDisabled], onPress: previous, disabled: snapshot.status !== "idle" || !snapshot.canMovePrevious, children: _jsxs(Text, { style: styles.btnBackText, children: ["\u2190 ", backLabel] }) }))] }), _jsxs(View, { style: styles.footerRight, children: [!isFormMode && !hideCancel && (_jsx(Pressable, { style: [styles.btn, styles.btnCancel, snapshot.status !== "idle" && styles.btnDisabled], onPress: cancel, disabled: snapshot.status !== "idle", children: _jsx(Text, { style: styles.btnCancelText, children: cancelLabel }) })), _jsx(Pressable, { style: [styles.btn, styles.btnPrimary, snapshot.status !== "idle" && styles.btnDisabled], onPress: next, disabled: snapshot.status !== "idle" || !snapshot.canMoveNext, children: snapshot.status !== "idle" && loadingLabel
|
|
159
|
+
? _jsx(Text, { style: styles.btnPrimaryText, children: loadingLabel })
|
|
160
|
+
: snapshot.status !== "idle"
|
|
161
|
+
? _jsx(ActivityIndicator, { size: "small", color: "#ffffff" })
|
|
162
|
+
: _jsx(Text, { style: styles.btnPrimaryText, children: snapshot.isLastStep ? completeLabel : `${nextLabel} →` }) })] })] }))] }) }));
|
|
148
163
|
});
|
|
149
164
|
// ---------------------------------------------------------------------------
|
|
150
|
-
// Helpers
|
|
151
|
-
// ---------------------------------------------------------------------------
|
|
152
|
-
function formatFieldKey(key) {
|
|
153
|
-
return key.replace(/([A-Z])/g, " $1").replace(/^./, (c) => c.toUpperCase()).trim();
|
|
154
|
-
}
|
|
155
|
-
// ---------------------------------------------------------------------------
|
|
156
165
|
// Styles
|
|
157
166
|
// ---------------------------------------------------------------------------
|
|
158
167
|
const styles = StyleSheet.create({
|
|
@@ -317,5 +326,38 @@ const styles = StyleSheet.create({
|
|
|
317
326
|
fontWeight: "500",
|
|
318
327
|
fontSize: 15,
|
|
319
328
|
},
|
|
329
|
+
blockingError: {
|
|
330
|
+
fontSize: 13,
|
|
331
|
+
color: "#dc2626",
|
|
332
|
+
marginTop: 4,
|
|
333
|
+
},
|
|
334
|
+
btnRetry: {
|
|
335
|
+
backgroundColor: "#dc2626",
|
|
336
|
+
},
|
|
337
|
+
btnSuspend: {
|
|
338
|
+
backgroundColor: "transparent",
|
|
339
|
+
},
|
|
340
|
+
errorPanel: {
|
|
341
|
+
backgroundColor: "#fef2f2",
|
|
342
|
+
borderRadius: 10,
|
|
343
|
+
borderWidth: 1,
|
|
344
|
+
borderColor: "#fecaca",
|
|
345
|
+
padding: 16,
|
|
346
|
+
gap: 8,
|
|
347
|
+
},
|
|
348
|
+
errorTitle: {
|
|
349
|
+
fontSize: 14,
|
|
350
|
+
fontWeight: "600",
|
|
351
|
+
color: "#dc2626",
|
|
352
|
+
},
|
|
353
|
+
errorMessage: {
|
|
354
|
+
fontSize: 13,
|
|
355
|
+
color: "#6b7280",
|
|
356
|
+
},
|
|
357
|
+
errorActions: {
|
|
358
|
+
flexDirection: "row",
|
|
359
|
+
gap: 8,
|
|
360
|
+
marginTop: 4,
|
|
361
|
+
},
|
|
320
362
|
});
|
|
321
363
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,mBAAmB,EAC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package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daltonr/pathwrite-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "React Native adapter for @daltonr/pathwrite-core — hooks, context provider, and optional PathShell default UI.",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"react-native": ">=0.72.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@daltonr/pathwrite-core": "^0.
|
|
47
|
+
"@daltonr/pathwrite-core": "^0.10.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"react": "^18.3.1",
|
package/src/index.tsx
CHANGED
|
@@ -28,6 +28,8 @@ import {
|
|
|
28
28
|
PathEvent,
|
|
29
29
|
PathSnapshot,
|
|
30
30
|
ProgressLayout,
|
|
31
|
+
formatFieldKey,
|
|
32
|
+
errorPhaseMessage,
|
|
31
33
|
} from "@daltonr/pathwrite-core";
|
|
32
34
|
|
|
33
35
|
// ---------------------------------------------------------------------------
|
|
@@ -72,10 +74,19 @@ export interface UsePathReturn<TData extends PathData = PathData> {
|
|
|
72
74
|
resetStep: () => void;
|
|
73
75
|
/** Tear down any active path and immediately start the given path fresh. */
|
|
74
76
|
restart: () => void;
|
|
77
|
+
/** Re-runs the operation that set `snapshot.error`. Increments `retryCount` on repeated failure. No-op when there is no pending error. */
|
|
78
|
+
retry: () => void;
|
|
79
|
+
/** Pauses the path with intent to return. Emits `suspended`. All state is preserved. */
|
|
80
|
+
suspend: () => void;
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
export type PathProviderProps = PropsWithChildren<{
|
|
78
84
|
onEvent?: (event: PathEvent) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Services object passed through context to all step components.
|
|
87
|
+
* Step components access it via `usePathContext<TData, TServices>()`.
|
|
88
|
+
*/
|
|
89
|
+
services?: unknown;
|
|
79
90
|
}>;
|
|
80
91
|
|
|
81
92
|
// ---------------------------------------------------------------------------
|
|
@@ -141,35 +152,47 @@ export function usePath<TData extends PathData = PathData>(options?: UsePathOpti
|
|
|
141
152
|
) as UsePathReturn<TData>["setData"];
|
|
142
153
|
const resetStep = useCallback(() => engine.resetStep(), [engine]);
|
|
143
154
|
const restart = useCallback(() => engine.restart(), [engine]);
|
|
155
|
+
const retry = useCallback(() => engine.retry(), [engine]);
|
|
156
|
+
const suspend = useCallback(() => engine.suspend(), [engine]);
|
|
144
157
|
|
|
145
|
-
return { snapshot, start, startSubPath, next, previous, cancel, goToStep, goToStepChecked, setData, resetStep, restart };
|
|
158
|
+
return { snapshot, start, startSubPath, next, previous, cancel, goToStep, goToStepChecked, setData, resetStep, restart, retry, suspend };
|
|
146
159
|
}
|
|
147
160
|
|
|
148
161
|
// ---------------------------------------------------------------------------
|
|
149
162
|
// Context + Provider
|
|
150
163
|
// ---------------------------------------------------------------------------
|
|
151
164
|
|
|
152
|
-
|
|
165
|
+
interface PathContextValue {
|
|
166
|
+
path: UsePathReturn;
|
|
167
|
+
services: unknown;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const PathContext = createContext<PathContextValue | null>(null);
|
|
153
171
|
|
|
154
172
|
/**
|
|
155
173
|
* Provides a single `usePath` instance to all descendants.
|
|
156
174
|
* Consume with `usePathContext()`.
|
|
157
175
|
*/
|
|
158
|
-
export function PathProvider({ children, onEvent }: PathProviderProps): ReactElement {
|
|
176
|
+
export function PathProvider({ children, onEvent, services }: PathProviderProps): ReactElement {
|
|
159
177
|
const path = usePath({ onEvent });
|
|
160
|
-
return createElement(PathContext.Provider, { value: path }, children);
|
|
178
|
+
return createElement(PathContext.Provider, { value: { path, services: services ?? null } }, children);
|
|
161
179
|
}
|
|
162
180
|
|
|
163
181
|
/**
|
|
164
|
-
* Access the nearest `PathProvider`'s path instance.
|
|
165
|
-
* Throws if used outside of a `<PathProvider>`.
|
|
182
|
+
* Access the nearest `PathProvider`'s path instance and optional services object.
|
|
183
|
+
* Throws if used outside of a `<PathProvider>` or `<PathShell>`.
|
|
184
|
+
*
|
|
185
|
+
* `TData` narrows `snapshot.data`; `TServices` types the `services` value.
|
|
166
186
|
*/
|
|
167
|
-
export function usePathContext<TData extends PathData = PathData>(): Omit<UsePathReturn<TData>, "snapshot"> & { snapshot: PathSnapshot<TData
|
|
187
|
+
export function usePathContext<TData extends PathData = PathData, TServices = unknown>(): Omit<UsePathReturn<TData>, "snapshot"> & { snapshot: PathSnapshot<TData>; services: TServices } {
|
|
168
188
|
const ctx = useContext(PathContext);
|
|
169
189
|
if (ctx === null) {
|
|
170
190
|
throw new Error("usePathContext must be used within a <PathProvider>.");
|
|
171
191
|
}
|
|
172
|
-
return
|
|
192
|
+
return {
|
|
193
|
+
...(ctx.path as unknown as Omit<UsePathReturn<TData>, "snapshot"> & { snapshot: PathSnapshot<TData> }),
|
|
194
|
+
services: ctx.services as TServices
|
|
195
|
+
};
|
|
173
196
|
}
|
|
174
197
|
|
|
175
198
|
// ---------------------------------------------------------------------------
|
|
@@ -189,6 +212,8 @@ export interface PathShellActions {
|
|
|
189
212
|
goToStepChecked: (stepId: string) => void;
|
|
190
213
|
setData: (key: string, value: unknown) => void;
|
|
191
214
|
restart: () => void;
|
|
215
|
+
retry: () => void;
|
|
216
|
+
suspend: () => void;
|
|
192
217
|
}
|
|
193
218
|
|
|
194
219
|
export interface PathShellProps {
|
|
@@ -214,6 +239,8 @@ export interface PathShellProps {
|
|
|
214
239
|
nextLabel?: string;
|
|
215
240
|
/** Label for the Complete button (last step). Defaults to "Complete". */
|
|
216
241
|
completeLabel?: string;
|
|
242
|
+
/** Label shown on the Next/Complete button while an async operation is in progress. When undefined, an ActivityIndicator spinner is shown instead. */
|
|
243
|
+
loadingLabel?: string;
|
|
217
244
|
/** Label for the Cancel button. Defaults to "Cancel". */
|
|
218
245
|
cancelLabel?: string;
|
|
219
246
|
/** If true, hide the Cancel button. */
|
|
@@ -253,6 +280,11 @@ export interface PathShellProps {
|
|
|
253
280
|
* warning. The step is then responsible for managing its own scroll.
|
|
254
281
|
*/
|
|
255
282
|
disableBodyScroll?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Services object passed through context to all step components.
|
|
285
|
+
* Step components access it via `usePathContext<TData, TServices>()`.
|
|
286
|
+
*/
|
|
287
|
+
services?: unknown;
|
|
256
288
|
}
|
|
257
289
|
|
|
258
290
|
/**
|
|
@@ -283,6 +315,7 @@ export const PathShell = forwardRef<PathShellHandle, PathShellProps>(function Pa
|
|
|
283
315
|
backLabel = "Previous",
|
|
284
316
|
nextLabel = "Next",
|
|
285
317
|
completeLabel = "Complete",
|
|
318
|
+
loadingLabel,
|
|
286
319
|
cancelLabel = "Cancel",
|
|
287
320
|
hideCancel = false,
|
|
288
321
|
hideProgress = false,
|
|
@@ -293,6 +326,7 @@ export const PathShell = forwardRef<PathShellHandle, PathShellProps>(function Pa
|
|
|
293
326
|
style,
|
|
294
327
|
keyboardVerticalOffset = 0,
|
|
295
328
|
disableBodyScroll = false,
|
|
329
|
+
services,
|
|
296
330
|
}: PathShellProps, ref): ReactElement {
|
|
297
331
|
const pathReturn = usePath({
|
|
298
332
|
engine: externalEngine,
|
|
@@ -303,7 +337,7 @@ export const PathShell = forwardRef<PathShellHandle, PathShellProps>(function Pa
|
|
|
303
337
|
},
|
|
304
338
|
});
|
|
305
339
|
|
|
306
|
-
const { snapshot, start, next, previous, cancel, goToStep, goToStepChecked, setData, restart } = pathReturn;
|
|
340
|
+
const { snapshot, start, next, previous, cancel, goToStep, goToStepChecked, setData, restart, retry, suspend } = pathReturn;
|
|
307
341
|
|
|
308
342
|
useImperativeHandle(ref, () => ({
|
|
309
343
|
restart: () => restart(),
|
|
@@ -323,14 +357,18 @@ export const PathShell = forwardRef<PathShellHandle, PathShellProps>(function Pa
|
|
|
323
357
|
? ((snapshot.formId ? steps[snapshot.formId] : undefined) ?? steps[snapshot.stepId] ?? null)
|
|
324
358
|
: null;
|
|
325
359
|
|
|
360
|
+
const contextValue: PathContextValue = { path: pathReturn, services: services ?? null };
|
|
361
|
+
|
|
326
362
|
const actions: PathShellActions = {
|
|
327
363
|
next, previous, cancel, goToStep, goToStepChecked, setData,
|
|
328
364
|
restart: () => restart(),
|
|
365
|
+
retry: () => retry(),
|
|
366
|
+
suspend: () => suspend(),
|
|
329
367
|
};
|
|
330
368
|
|
|
331
369
|
if (!snapshot) {
|
|
332
370
|
return (
|
|
333
|
-
<PathContext.Provider value={
|
|
371
|
+
<PathContext.Provider value={contextValue}>
|
|
334
372
|
<View style={[styles.shell, style]}>
|
|
335
373
|
<View style={styles.emptyState}>
|
|
336
374
|
<Text style={styles.emptyText}>No active path.</Text>
|
|
@@ -356,7 +394,7 @@ export const PathShell = forwardRef<PathShellHandle, PathShellProps>(function Pa
|
|
|
356
394
|
!hideProgress && (snapshot.stepCount > 1 || snapshot.nestingLevel > 0);
|
|
357
395
|
|
|
358
396
|
return (
|
|
359
|
-
<PathContext.Provider value={
|
|
397
|
+
<PathContext.Provider value={contextValue}>
|
|
360
398
|
<KeyboardAvoidingView
|
|
361
399
|
style={[styles.shell, style]}
|
|
362
400
|
behavior={Platform.OS === "ios" ? "padding" : undefined}
|
|
@@ -426,26 +464,68 @@ export const PathShell = forwardRef<PathShellHandle, PathShellProps>(function Pa
|
|
|
426
464
|
</View>
|
|
427
465
|
)}
|
|
428
466
|
|
|
429
|
-
{/*
|
|
430
|
-
{
|
|
467
|
+
{/* Blocking error — guard returned { allowed: false, reason } */}
|
|
468
|
+
{validationDisplay !== "inline" && snapshot.hasAttemptedNext && snapshot.blockingError && (
|
|
469
|
+
<Text style={styles.blockingError}>{snapshot.blockingError}</Text>
|
|
470
|
+
)}
|
|
471
|
+
|
|
472
|
+
{/* Error panel — replaces footer when an async operation has failed */}
|
|
473
|
+
{snapshot.status === "error" && snapshot.error
|
|
474
|
+
? (() => {
|
|
475
|
+
const err = snapshot.error!;
|
|
476
|
+
const escalated = err.retryCount >= 2;
|
|
477
|
+
return (
|
|
478
|
+
<View style={styles.errorPanel}>
|
|
479
|
+
<Text style={styles.errorTitle}>
|
|
480
|
+
{escalated ? "Still having trouble." : "Something went wrong."}
|
|
481
|
+
</Text>
|
|
482
|
+
<Text style={styles.errorMessage}>
|
|
483
|
+
{errorPhaseMessage(err.phase)}{err.message ? ` ${err.message}` : ""}
|
|
484
|
+
</Text>
|
|
485
|
+
<View style={styles.errorActions}>
|
|
486
|
+
{!escalated && (
|
|
487
|
+
<Pressable style={[styles.btn, styles.btnRetry]} onPress={retry}>
|
|
488
|
+
<Text style={styles.btnPrimaryText}>Try again</Text>
|
|
489
|
+
</Pressable>
|
|
490
|
+
)}
|
|
491
|
+
{snapshot.hasPersistence && (
|
|
492
|
+
<Pressable
|
|
493
|
+
style={[styles.btn, escalated ? styles.btnRetry : styles.btnSuspend]}
|
|
494
|
+
onPress={suspend}
|
|
495
|
+
>
|
|
496
|
+
<Text style={escalated ? styles.btnPrimaryText : styles.btnCancelText}>
|
|
497
|
+
Save and come back later
|
|
498
|
+
</Text>
|
|
499
|
+
</Pressable>
|
|
500
|
+
)}
|
|
501
|
+
{escalated && !snapshot.hasPersistence && (
|
|
502
|
+
<Pressable style={[styles.btn, styles.btnRetry]} onPress={retry}>
|
|
503
|
+
<Text style={styles.btnPrimaryText}>Try again</Text>
|
|
504
|
+
</Pressable>
|
|
505
|
+
)}
|
|
506
|
+
</View>
|
|
507
|
+
</View>
|
|
508
|
+
);
|
|
509
|
+
})()
|
|
510
|
+
: renderFooter
|
|
431
511
|
? renderFooter(snapshot, actions)
|
|
432
512
|
: (
|
|
433
513
|
<View style={styles.footer}>
|
|
434
514
|
<View style={styles.footerLeft}>
|
|
435
515
|
{isFormMode && !hideCancel && (
|
|
436
516
|
<Pressable
|
|
437
|
-
style={[styles.btn, styles.btnCancel, snapshot.
|
|
517
|
+
style={[styles.btn, styles.btnCancel, snapshot.status !== "idle" && styles.btnDisabled]}
|
|
438
518
|
onPress={cancel}
|
|
439
|
-
disabled={snapshot.
|
|
519
|
+
disabled={snapshot.status !== "idle"}
|
|
440
520
|
>
|
|
441
521
|
<Text style={styles.btnCancelText}>{cancelLabel}</Text>
|
|
442
522
|
</Pressable>
|
|
443
523
|
)}
|
|
444
524
|
{!isFormMode && !snapshot.isFirstStep && (
|
|
445
525
|
<Pressable
|
|
446
|
-
style={[styles.btn, styles.btnBack, (snapshot.
|
|
526
|
+
style={[styles.btn, styles.btnBack, (snapshot.status !== "idle" || !snapshot.canMovePrevious) && styles.btnDisabled]}
|
|
447
527
|
onPress={previous}
|
|
448
|
-
disabled={snapshot.
|
|
528
|
+
disabled={snapshot.status !== "idle" || !snapshot.canMovePrevious}
|
|
449
529
|
>
|
|
450
530
|
<Text style={styles.btnBackText}>← {backLabel}</Text>
|
|
451
531
|
</Pressable>
|
|
@@ -454,21 +534,23 @@ export const PathShell = forwardRef<PathShellHandle, PathShellProps>(function Pa
|
|
|
454
534
|
<View style={styles.footerRight}>
|
|
455
535
|
{!isFormMode && !hideCancel && (
|
|
456
536
|
<Pressable
|
|
457
|
-
style={[styles.btn, styles.btnCancel, snapshot.
|
|
537
|
+
style={[styles.btn, styles.btnCancel, snapshot.status !== "idle" && styles.btnDisabled]}
|
|
458
538
|
onPress={cancel}
|
|
459
|
-
disabled={snapshot.
|
|
539
|
+
disabled={snapshot.status !== "idle"}
|
|
460
540
|
>
|
|
461
541
|
<Text style={styles.btnCancelText}>{cancelLabel}</Text>
|
|
462
542
|
</Pressable>
|
|
463
543
|
)}
|
|
464
544
|
<Pressable
|
|
465
|
-
style={[styles.btn, styles.btnPrimary, snapshot.
|
|
545
|
+
style={[styles.btn, styles.btnPrimary, snapshot.status !== "idle" && styles.btnDisabled]}
|
|
466
546
|
onPress={next}
|
|
467
|
-
disabled={snapshot.
|
|
547
|
+
disabled={snapshot.status !== "idle" || !snapshot.canMoveNext}
|
|
468
548
|
>
|
|
469
|
-
{snapshot.
|
|
470
|
-
? <
|
|
471
|
-
:
|
|
549
|
+
{snapshot.status !== "idle" && loadingLabel
|
|
550
|
+
? <Text style={styles.btnPrimaryText}>{loadingLabel}</Text>
|
|
551
|
+
: snapshot.status !== "idle"
|
|
552
|
+
? <ActivityIndicator size="small" color="#ffffff" />
|
|
553
|
+
: <Text style={styles.btnPrimaryText}>{snapshot.isLastStep ? completeLabel : `${nextLabel} →`}</Text>
|
|
472
554
|
}
|
|
473
555
|
</Pressable>
|
|
474
556
|
</View>
|
|
@@ -480,13 +562,7 @@ export const PathShell = forwardRef<PathShellHandle, PathShellProps>(function Pa
|
|
|
480
562
|
);
|
|
481
563
|
});
|
|
482
564
|
|
|
483
|
-
// ---------------------------------------------------------------------------
|
|
484
|
-
// Helpers
|
|
485
|
-
// ---------------------------------------------------------------------------
|
|
486
565
|
|
|
487
|
-
function formatFieldKey(key: string): string {
|
|
488
|
-
return key.replace(/([A-Z])/g, " $1").replace(/^./, (c) => c.toUpperCase()).trim();
|
|
489
|
-
}
|
|
490
566
|
|
|
491
567
|
// ---------------------------------------------------------------------------
|
|
492
568
|
// Styles
|
|
@@ -654,6 +730,39 @@ const styles = StyleSheet.create({
|
|
|
654
730
|
fontWeight: "500",
|
|
655
731
|
fontSize: 15,
|
|
656
732
|
},
|
|
733
|
+
blockingError: {
|
|
734
|
+
fontSize: 13,
|
|
735
|
+
color: "#dc2626",
|
|
736
|
+
marginTop: 4,
|
|
737
|
+
},
|
|
738
|
+
btnRetry: {
|
|
739
|
+
backgroundColor: "#dc2626",
|
|
740
|
+
},
|
|
741
|
+
btnSuspend: {
|
|
742
|
+
backgroundColor: "transparent",
|
|
743
|
+
},
|
|
744
|
+
errorPanel: {
|
|
745
|
+
backgroundColor: "#fef2f2",
|
|
746
|
+
borderRadius: 10,
|
|
747
|
+
borderWidth: 1,
|
|
748
|
+
borderColor: "#fecaca",
|
|
749
|
+
padding: 16,
|
|
750
|
+
gap: 8,
|
|
751
|
+
},
|
|
752
|
+
errorTitle: {
|
|
753
|
+
fontSize: 14,
|
|
754
|
+
fontWeight: "600",
|
|
755
|
+
color: "#dc2626",
|
|
756
|
+
},
|
|
757
|
+
errorMessage: {
|
|
758
|
+
fontSize: 13,
|
|
759
|
+
color: "#6b7280",
|
|
760
|
+
},
|
|
761
|
+
errorActions: {
|
|
762
|
+
flexDirection: "row",
|
|
763
|
+
gap: 8,
|
|
764
|
+
marginTop: 4,
|
|
765
|
+
},
|
|
657
766
|
});
|
|
658
767
|
|
|
659
768
|
// ---------------------------------------------------------------------------
|