wizzard-stepper-react 1.7.1 → 2.0.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.
- package/LICENSE +21 -21
- package/README.md +158 -431
- package/dist/index.cjs +1 -954
- package/dist/index.d.cts +309 -63
- package/dist/index.d.ts +309 -63
- package/dist/index.js +1 -921
- package/package.json +98 -93
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1 from 'react';
|
|
3
3
|
|
|
4
|
+
interface IWizardHandle<T = unknown, StepId extends string = string> {
|
|
5
|
+
state: IWizardState<T, StepId>;
|
|
6
|
+
actions: IWizardActions<StepId>;
|
|
7
|
+
}
|
|
8
|
+
interface IWizardState<T = unknown, StepId extends string = string> {
|
|
9
|
+
data: T;
|
|
10
|
+
errors: Record<string, Record<string, string>>;
|
|
11
|
+
currentStep: IStepConfig<T, StepId> | null;
|
|
12
|
+
currentStepIndex: number;
|
|
13
|
+
isFirstStep: boolean;
|
|
14
|
+
isLastStep: boolean;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
isPending: boolean;
|
|
17
|
+
activeSteps: IStepConfig<T, StepId>[];
|
|
18
|
+
currentStepId: StepId | "";
|
|
19
|
+
history: StepId[];
|
|
20
|
+
busySteps: Set<StepId>;
|
|
21
|
+
visitedSteps: Set<StepId>;
|
|
22
|
+
completedSteps: Set<StepId>;
|
|
23
|
+
errorSteps: Set<StepId>;
|
|
24
|
+
config: IWizardConfig<T, StepId>;
|
|
25
|
+
progress: number;
|
|
26
|
+
activeStepsCount: number;
|
|
27
|
+
isBusy: boolean;
|
|
28
|
+
isDirty: boolean;
|
|
29
|
+
dirtyFields: Set<string>;
|
|
30
|
+
breadcrumbs: IBreadcrumb<StepId>[];
|
|
31
|
+
}
|
|
32
|
+
interface IWizardStore<T, StepId extends string = string> {
|
|
33
|
+
getSnapshot(): IWizardState<T, StepId>;
|
|
34
|
+
dispatch(action: WizardAction<T, StepId>): void;
|
|
35
|
+
update(newData: T, changedPath?: string | string[]): void;
|
|
36
|
+
updateMeta(newMeta: Partial<IWizardState<T, StepId>>): void;
|
|
37
|
+
setInitialData(data: T): void;
|
|
38
|
+
updateErrors(newErrors: Record<string, Record<string, string>>): void;
|
|
39
|
+
setStepErrors(stepId: string, errors: Record<string, string> | undefined | null): boolean;
|
|
40
|
+
deleteError(stepId: string, path: string): boolean;
|
|
41
|
+
subscribe(listener: () => void): () => void;
|
|
42
|
+
subscribeToActions(listener: (action: WizardAction<T, StepId>) => void): () => void;
|
|
43
|
+
errorsMap: Map<string, Map<string, string>>;
|
|
44
|
+
}
|
|
45
|
+
interface IWizardActions<StepId extends string = string> {
|
|
46
|
+
goToNextStep: () => Promise<void>;
|
|
47
|
+
goToPrevStep: () => void;
|
|
48
|
+
goToStep: (stepId: StepId) => Promise<boolean>;
|
|
49
|
+
setStepData: (stepId: StepId, data: unknown) => void;
|
|
50
|
+
handleStepChange: (field: string, value: unknown) => void;
|
|
51
|
+
validateStep: (sid: StepId) => Promise<boolean>;
|
|
52
|
+
validateAll: () => Promise<{
|
|
53
|
+
isValid: boolean;
|
|
54
|
+
errors: Record<string, Record<string, string>>;
|
|
55
|
+
}>;
|
|
56
|
+
save: (stepIds?: StepId | StepId[] | boolean) => void;
|
|
57
|
+
clearStorage: () => void;
|
|
58
|
+
reset: () => void;
|
|
59
|
+
setData: (path: string, value: unknown, options?: {
|
|
60
|
+
debounceValidation?: number;
|
|
61
|
+
}) => void;
|
|
62
|
+
updateData: (data: Partial<any>, options?: {
|
|
63
|
+
replace?: boolean;
|
|
64
|
+
persist?: boolean;
|
|
65
|
+
}) => void;
|
|
66
|
+
getData: (path: string, defaultValue?: unknown) => unknown;
|
|
67
|
+
}
|
|
4
68
|
/**
|
|
5
69
|
* Validation Result Interface
|
|
6
70
|
*/
|
|
@@ -37,19 +101,39 @@ interface IPersistenceAdapter {
|
|
|
37
101
|
getStep: <T>(stepId: string) => T | undefined;
|
|
38
102
|
clear: () => void;
|
|
39
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Step Navigation Direction
|
|
106
|
+
*/
|
|
107
|
+
type StepDirection = 'next' | 'prev';
|
|
40
108
|
/**
|
|
41
109
|
* Step Configuration
|
|
42
110
|
* TStepData: Type of data for this step
|
|
43
111
|
* TGlobalContext: Type of the global wizard data
|
|
44
112
|
*/
|
|
45
|
-
interface IStepConfig<TStepData = unknown,
|
|
113
|
+
interface IStepConfig<TStepData = unknown, StepId extends string = string> {
|
|
46
114
|
id: StepId;
|
|
47
115
|
label: string;
|
|
48
116
|
/**
|
|
49
117
|
* Predicate to determine if step should be included/visible.
|
|
50
|
-
*
|
|
118
|
+
* Supports both synchronous and asynchronous predicates.
|
|
51
119
|
*/
|
|
52
|
-
condition?: (
|
|
120
|
+
condition?: (data: TStepData, metadata: Partial<IWizardState<TStepData, StepId>> & {
|
|
121
|
+
wizardData?: TStepData | undefined;
|
|
122
|
+
allErrors?: any;
|
|
123
|
+
}) => boolean | Promise<boolean>;
|
|
124
|
+
/**
|
|
125
|
+
* If true, the step will be visible while its condition is being resolved.
|
|
126
|
+
* Default: false (step is hidden until condition is resolved)
|
|
127
|
+
*/
|
|
128
|
+
showWhilePending?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Guard function called before leaving the step.
|
|
131
|
+
* Return false or throw to prevent navigation.
|
|
132
|
+
*/
|
|
133
|
+
beforeLeave?: (data: TStepData, direction: StepDirection, metadata: Partial<IWizardState<TStepData, StepId>> & {
|
|
134
|
+
wizardData?: TStepData | undefined;
|
|
135
|
+
allErrors?: any;
|
|
136
|
+
}) => boolean | Promise<boolean>;
|
|
53
137
|
/**
|
|
54
138
|
* Adapter for validation logic
|
|
55
139
|
*/
|
|
@@ -82,6 +166,15 @@ interface IStepConfig<TStepData = unknown, TGlobalContext = unknown, StepId exte
|
|
|
82
166
|
* - 'manual': Save only when manually triggered
|
|
83
167
|
*/
|
|
84
168
|
persistenceMode?: PersistenceMode;
|
|
169
|
+
/**
|
|
170
|
+
* Dependency Tracking: Reset this step's data/status when these paths change.
|
|
171
|
+
*/
|
|
172
|
+
dependsOn?: string[];
|
|
173
|
+
/**
|
|
174
|
+
* Paths to clear when dependencies change.
|
|
175
|
+
* Can be a single path string, an array of paths, or a function returning a data patch to merge.
|
|
176
|
+
*/
|
|
177
|
+
clearData?: string | string[] | ((data: TStepData) => Partial<TStepData>);
|
|
85
178
|
}
|
|
86
179
|
/**
|
|
87
180
|
* Wizard Configuration
|
|
@@ -91,7 +184,7 @@ interface IWizardConfig<T = unknown, StepId extends string = string> {
|
|
|
91
184
|
/**
|
|
92
185
|
* Array of step configurations
|
|
93
186
|
*/
|
|
94
|
-
steps: IStepConfig<
|
|
187
|
+
steps: IStepConfig<T, StepId>[];
|
|
95
188
|
/**
|
|
96
189
|
* Global auto-validation setting (default: true)
|
|
97
190
|
* @deprecated Use validationMode instead
|
|
@@ -111,27 +204,194 @@ interface IWizardConfig<T = unknown, StepId extends string = string> {
|
|
|
111
204
|
* Storage key prefix (default: 'wizard_')
|
|
112
205
|
*/
|
|
113
206
|
storageKey?: string;
|
|
207
|
+
/**
|
|
208
|
+
* Debounce time in ms for 'onChange' persistence (default: 0)
|
|
209
|
+
*/
|
|
210
|
+
debounceTime?: number;
|
|
114
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* Conflict resolution strategy for persistence hydration.
|
|
214
|
+
* - 'merge': Shallow merge local and initial/server data (default)
|
|
215
|
+
* - 'replace': Overwrite local with initial/server data
|
|
216
|
+
* - 'keep-local': Ignore initial/server data if local exists
|
|
217
|
+
*/
|
|
218
|
+
onConflict?: 'merge' | 'replace' | 'keep-local';
|
|
219
|
+
/**
|
|
220
|
+
* Analytics integration.
|
|
221
|
+
*/
|
|
222
|
+
analytics?: {
|
|
223
|
+
onEvent: WizardEventHandler<StepId>;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Optional middlewares to intercept actions.
|
|
227
|
+
*/
|
|
228
|
+
middlewares?: WizardMiddleware<T, StepId>[];
|
|
115
229
|
/**
|
|
116
230
|
* Callback triggered when step changes.
|
|
117
231
|
* Useful for routing integration or analytics.
|
|
118
232
|
*/
|
|
119
233
|
onStepChange?: (fromStep: StepId | null, toStep: StepId, data: T) => void;
|
|
120
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Middleware Action Types
|
|
237
|
+
*/
|
|
238
|
+
type WizardAction<T = any, StepId extends string = string> = {
|
|
239
|
+
type: 'INIT';
|
|
240
|
+
payload: {
|
|
241
|
+
data: T;
|
|
242
|
+
config: IWizardConfig<T, StepId>;
|
|
243
|
+
};
|
|
244
|
+
} | {
|
|
245
|
+
type: 'SET_DATA';
|
|
246
|
+
payload: {
|
|
247
|
+
path: string;
|
|
248
|
+
value: any;
|
|
249
|
+
options?: any;
|
|
250
|
+
};
|
|
251
|
+
} | {
|
|
252
|
+
type: 'UPDATE_DATA';
|
|
253
|
+
payload: {
|
|
254
|
+
data: Partial<T>;
|
|
255
|
+
options?: any;
|
|
256
|
+
};
|
|
257
|
+
} | {
|
|
258
|
+
type: 'GO_TO_STEP';
|
|
259
|
+
payload: {
|
|
260
|
+
from: StepId | null;
|
|
261
|
+
to: StepId;
|
|
262
|
+
};
|
|
263
|
+
} | {
|
|
264
|
+
type: 'VALIDATE_START';
|
|
265
|
+
payload: {
|
|
266
|
+
stepId: StepId;
|
|
267
|
+
};
|
|
268
|
+
} | {
|
|
269
|
+
type: 'VALIDATE_END';
|
|
270
|
+
payload: {
|
|
271
|
+
stepId: StepId;
|
|
272
|
+
result: ValidationResult;
|
|
273
|
+
};
|
|
274
|
+
} | {
|
|
275
|
+
type: 'SET_STEP_ERRORS';
|
|
276
|
+
payload: {
|
|
277
|
+
stepId: string;
|
|
278
|
+
errors: Record<string, string> | undefined | null;
|
|
279
|
+
};
|
|
280
|
+
} | {
|
|
281
|
+
type: 'RESET';
|
|
282
|
+
payload: {
|
|
283
|
+
data: T;
|
|
284
|
+
};
|
|
285
|
+
} | {
|
|
286
|
+
type: 'UPDATE_META';
|
|
287
|
+
payload: {
|
|
288
|
+
meta: Partial<IWizardState<T, StepId>>;
|
|
289
|
+
};
|
|
290
|
+
} | {
|
|
291
|
+
type: 'SET_CURRENT_STEP_ID';
|
|
292
|
+
payload: {
|
|
293
|
+
stepId: StepId | "";
|
|
294
|
+
};
|
|
295
|
+
} | {
|
|
296
|
+
type: 'SET_HISTORY';
|
|
297
|
+
payload: {
|
|
298
|
+
history: StepId[];
|
|
299
|
+
};
|
|
300
|
+
} | {
|
|
301
|
+
type: 'SET_ACTIVE_STEPS';
|
|
302
|
+
payload: {
|
|
303
|
+
steps: IStepConfig<T, StepId>[];
|
|
304
|
+
};
|
|
305
|
+
} | {
|
|
306
|
+
type: 'SET_VISITED_STEPS';
|
|
307
|
+
payload: {
|
|
308
|
+
steps: Set<StepId>;
|
|
309
|
+
};
|
|
310
|
+
} | {
|
|
311
|
+
type: 'SET_COMPLETED_STEPS';
|
|
312
|
+
payload: {
|
|
313
|
+
steps: Set<StepId>;
|
|
314
|
+
};
|
|
315
|
+
} | {
|
|
316
|
+
type: 'SET_ERROR_STEPS';
|
|
317
|
+
payload: {
|
|
318
|
+
steps: Set<StepId>;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Middleware API
|
|
323
|
+
*/
|
|
324
|
+
interface MiddlewareAPI<T = any, StepId extends string = string> {
|
|
325
|
+
dispatch: (action: WizardAction<T, StepId>) => void;
|
|
326
|
+
getState: () => T;
|
|
327
|
+
getSnapshot: () => any;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Middleware Type Definition
|
|
331
|
+
*/
|
|
332
|
+
type WizardMiddleware<T = any, StepId extends string = string> = (api: MiddlewareAPI<T, StepId>) => (next: (action: WizardAction<T, StepId>) => void) => (action: WizardAction<T, StepId>) => void;
|
|
333
|
+
/**
|
|
334
|
+
* Standardized Event Names
|
|
335
|
+
*/
|
|
336
|
+
type WizardEventName = "step_change" | "validation_error" | "wizard_reset";
|
|
337
|
+
/**
|
|
338
|
+
* Event Payloads
|
|
339
|
+
*/
|
|
340
|
+
type WizardEventPayloads<StepId extends string = string> = {
|
|
341
|
+
step_change: {
|
|
342
|
+
from: StepId | null;
|
|
343
|
+
to: StepId;
|
|
344
|
+
timestamp: number;
|
|
345
|
+
};
|
|
346
|
+
validation_error: {
|
|
347
|
+
stepId: StepId;
|
|
348
|
+
errors: Record<string, string> | undefined;
|
|
349
|
+
timestamp: number;
|
|
350
|
+
};
|
|
351
|
+
wizard_reset: {
|
|
352
|
+
data: any;
|
|
353
|
+
timestamp?: number;
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* Generic Event Handler Type
|
|
358
|
+
*/
|
|
359
|
+
type WizardEventHandler<StepId extends string = string> = <E extends WizardEventName>(name: E, payload: WizardEventPayloads<StepId>[E]) => void;
|
|
121
360
|
/**
|
|
122
361
|
* Core Wizard Context State
|
|
123
362
|
*/
|
|
124
363
|
interface IWizardContext<T = unknown, StepId extends string = string> {
|
|
125
|
-
|
|
364
|
+
config: IWizardConfig<T, StepId>;
|
|
365
|
+
currentStep: IStepConfig<T, StepId> | null;
|
|
366
|
+
currentStepId: StepId | "";
|
|
126
367
|
currentStepIndex: number;
|
|
127
368
|
isFirstStep: boolean;
|
|
128
369
|
isLastStep: boolean;
|
|
129
370
|
isLoading: boolean;
|
|
130
371
|
isPending?: boolean;
|
|
372
|
+
isBusy: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Dirty State Tracking
|
|
375
|
+
*/
|
|
376
|
+
isDirty: boolean;
|
|
377
|
+
dirtyFields: Set<string>;
|
|
378
|
+
/**
|
|
379
|
+
* Progress and Stats
|
|
380
|
+
*/
|
|
381
|
+
progress: number;
|
|
382
|
+
activeStepsCount: number;
|
|
131
383
|
/**
|
|
132
384
|
* Active steps (those meeting conditions)
|
|
133
385
|
*/
|
|
134
|
-
activeSteps: IStepConfig<
|
|
386
|
+
activeSteps: IStepConfig<T, StepId>[];
|
|
387
|
+
/**
|
|
388
|
+
* Navigation History
|
|
389
|
+
*/
|
|
390
|
+
history: StepId[];
|
|
391
|
+
/**
|
|
392
|
+
* Steps that are currently performing async actions (conditions, validation, guards)
|
|
393
|
+
*/
|
|
394
|
+
busySteps: Set<StepId>;
|
|
135
395
|
/**
|
|
136
396
|
* Unified Wizard Data
|
|
137
397
|
*/
|
|
@@ -146,6 +406,10 @@ interface IWizardContext<T = unknown, StepId extends string = string> {
|
|
|
146
406
|
visitedSteps: Set<StepId>;
|
|
147
407
|
completedSteps: Set<StepId>;
|
|
148
408
|
errorSteps: Set<StepId>;
|
|
409
|
+
/**
|
|
410
|
+
* Breadcrumbs
|
|
411
|
+
*/
|
|
412
|
+
breadcrumbs: IBreadcrumb<StepId>[];
|
|
149
413
|
/**
|
|
150
414
|
* Navigation Actions
|
|
151
415
|
*/
|
|
@@ -185,60 +449,25 @@ interface IWizardContext<T = unknown, StepId extends string = string> {
|
|
|
185
449
|
}>;
|
|
186
450
|
save: (stepIds?: StepId | StepId[] | boolean) => void;
|
|
187
451
|
clearStorage: () => void;
|
|
452
|
+
reset: () => void;
|
|
453
|
+
/**
|
|
454
|
+
* Dynamic Configuration
|
|
455
|
+
*/
|
|
456
|
+
updateConfig: (config: Partial<IWizardConfig<T, StepId>>) => void;
|
|
188
457
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
errorSteps: Set<StepId>;
|
|
201
|
-
store: WizardStore<T>;
|
|
202
|
-
}
|
|
203
|
-
interface IWizardActions<StepId extends string = string> {
|
|
204
|
-
goToNextStep: () => Promise<void>;
|
|
205
|
-
goToPrevStep: () => void;
|
|
206
|
-
goToStep: (stepId: StepId) => Promise<boolean>;
|
|
207
|
-
setStepData: (stepId: StepId, data: unknown) => void;
|
|
208
|
-
handleStepChange: (field: string, value: unknown) => void;
|
|
209
|
-
validateStep: (sid: StepId) => Promise<boolean>;
|
|
210
|
-
validateAll: () => Promise<{
|
|
211
|
-
isValid: boolean;
|
|
212
|
-
errors: Record<string, Record<string, string>>;
|
|
213
|
-
}>;
|
|
214
|
-
save: (stepIds?: StepId | StepId[] | boolean) => void;
|
|
215
|
-
clearStorage: () => void;
|
|
216
|
-
setData: (path: string, value: unknown, options?: {
|
|
217
|
-
debounceValidation?: number;
|
|
218
|
-
}) => void;
|
|
219
|
-
updateData: (data: Partial<any>, options?: {
|
|
220
|
-
replace?: boolean;
|
|
221
|
-
persist?: boolean;
|
|
222
|
-
}) => void;
|
|
223
|
-
getData: (path: string, defaultValue?: unknown) => unknown;
|
|
224
|
-
}
|
|
225
|
-
declare class WizardStore<T> {
|
|
226
|
-
private state;
|
|
227
|
-
private listeners;
|
|
228
|
-
errorsMap: Map<string, Map<string, string>>;
|
|
229
|
-
constructor(initialData: T);
|
|
230
|
-
getSnapshot(): {
|
|
231
|
-
data: T;
|
|
232
|
-
errors: Record<string, Record<string, string>>;
|
|
233
|
-
};
|
|
234
|
-
update(newData: T): void;
|
|
235
|
-
private syncErrors;
|
|
236
|
-
updateErrors(newErrors: Record<string, Record<string, string>>): void;
|
|
237
|
-
setStepErrors(stepId: string, errors: Record<string, string> | undefined | null): boolean;
|
|
238
|
-
deleteError(stepId: string, path: string): boolean;
|
|
239
|
-
private notify;
|
|
240
|
-
subscribe: (listener: () => void) => () => boolean;
|
|
458
|
+
/**
|
|
459
|
+
* Breadcrumb Status
|
|
460
|
+
*/
|
|
461
|
+
type BreadcrumbStatus = 'visited' | 'current' | 'upcoming' | 'completed' | 'error' | 'hidden';
|
|
462
|
+
/**
|
|
463
|
+
* Breadcrumb Interface
|
|
464
|
+
*/
|
|
465
|
+
interface IBreadcrumb<StepId extends string = string> {
|
|
466
|
+
id: StepId;
|
|
467
|
+
label: string;
|
|
468
|
+
status: BreadcrumbStatus;
|
|
241
469
|
}
|
|
470
|
+
|
|
242
471
|
interface WizardProviderProps<T, StepId extends string> {
|
|
243
472
|
config: IWizardConfig<T, StepId>;
|
|
244
473
|
initialData?: T;
|
|
@@ -256,7 +485,7 @@ declare function useWizardSelector<TSelected = any>(selector: (state: any) => TS
|
|
|
256
485
|
}): TSelected;
|
|
257
486
|
declare function useWizardActions<StepId extends string = string>(): IWizardActions<StepId>;
|
|
258
487
|
declare function useWizardContext<T = any, StepId extends string = string>(): IWizardContext<T, StepId> & {
|
|
259
|
-
store:
|
|
488
|
+
store: IWizardStore<T, StepId>;
|
|
260
489
|
};
|
|
261
490
|
|
|
262
491
|
interface WizardStepRendererProps {
|
|
@@ -268,6 +497,10 @@ interface WizardStepRendererProps {
|
|
|
268
497
|
children: React$1.ReactNode;
|
|
269
498
|
key: string;
|
|
270
499
|
}>;
|
|
500
|
+
/**
|
|
501
|
+
* Optional fallback to show while lazy-loading a step component.
|
|
502
|
+
*/
|
|
503
|
+
fallback?: React$1.ReactNode;
|
|
271
504
|
}
|
|
272
505
|
/**
|
|
273
506
|
* A declarative component that renders the current step based on the configuration.
|
|
@@ -312,18 +545,19 @@ declare function createWizardFactory<TSchema extends Record<string, any>, StepId
|
|
|
312
545
|
}) => react_jsx_runtime.JSX.Element;
|
|
313
546
|
useWizard: () => IWizardContext<TSchema, StepId>;
|
|
314
547
|
useWizardContext: () => IWizardContext<TSchema, StepId> & {
|
|
315
|
-
store:
|
|
548
|
+
store: IWizardStore<TSchema, StepId>;
|
|
316
549
|
};
|
|
317
550
|
useWizardValue: <P extends Path<TSchema>>(path: P, options?: {
|
|
318
551
|
isEqual?: (a: PathValue<TSchema, P>, b: PathValue<TSchema, P>) => boolean;
|
|
319
552
|
}) => PathValue<TSchema, P>;
|
|
320
|
-
useWizardSelector: <TSelected>(selector: (state: TSchema) => TSelected, options?: {
|
|
553
|
+
useWizardSelector: <TSelected>(selector: (state: IWizardContext<TSchema, StepId>) => TSelected, options?: {
|
|
321
554
|
isEqual?: (a: TSelected, b: TSelected) => boolean;
|
|
322
555
|
}) => TSelected;
|
|
323
556
|
useWizardError: <P extends Path<TSchema>>(path: P) => string | undefined;
|
|
324
557
|
useWizardActions: () => IWizardActions<StepId>;
|
|
325
558
|
useWizardState: () => IWizardState<TSchema, StepId>;
|
|
326
|
-
|
|
559
|
+
useBreadcrumbs: () => IBreadcrumb<StepId>[];
|
|
560
|
+
createStep: <TSchema_1 extends Record<string, any>, TStepId extends string = string>(config: IStepConfig<TSchema_1, TStepId>) => IStepConfig<TSchema_1, TStepId>;
|
|
327
561
|
};
|
|
328
562
|
|
|
329
563
|
declare const useWizard: <T = any, StepId extends string = string>() => IWizardContext<T, StepId>;
|
|
@@ -380,6 +614,18 @@ declare class YupAdapter<T> implements IValidatorAdapter<T> {
|
|
|
380
614
|
validate(data: unknown): Promise<ValidationResult>;
|
|
381
615
|
}
|
|
382
616
|
|
|
617
|
+
/**
|
|
618
|
+
* Simple logger middleware for Wizard actions
|
|
619
|
+
*/
|
|
620
|
+
declare const loggerMiddleware: WizardMiddleware<any, any>;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Middleware for Redux DevTools integration
|
|
624
|
+
*/
|
|
625
|
+
declare const devToolsMiddleware: WizardMiddleware<any, any>;
|
|
626
|
+
|
|
627
|
+
declare function WizardDevTools(): react_jsx_runtime.JSX.Element;
|
|
628
|
+
|
|
383
629
|
/**
|
|
384
630
|
* Parses a string path into an array of keys using a cache.
|
|
385
631
|
* Handles dot notation "a.b" and bracket notation "a[0].b".
|
|
@@ -401,4 +647,4 @@ declare function setByPath<T extends object>(obj: T, path: string, value: unknow
|
|
|
401
647
|
*/
|
|
402
648
|
declare function shallowEqual(a: any, b: any): boolean;
|
|
403
649
|
|
|
404
|
-
export { type IPersistenceAdapter, type IStepConfig, type IValidatorAdapter, type IWizardActions, type IWizardConfig, type IWizardContext, type IWizardState, LocalStorageAdapter, MemoryAdapter, type PersistenceMode, type ValidationMode, type ValidationResult, WizardProvider, WizardStepRenderer,
|
|
650
|
+
export { type BreadcrumbStatus, type IBreadcrumb, type IPersistenceAdapter, type IStepConfig, type IValidatorAdapter, type IWizardActions, type IWizardConfig, type IWizardContext, type IWizardHandle, type IWizardState, type IWizardStore, LocalStorageAdapter, MemoryAdapter, type MiddlewareAPI, type PersistenceMode, type StepDirection, type ValidationMode, type ValidationResult, type WizardAction, WizardDevTools, type WizardEventHandler, type WizardEventName, type WizardEventPayloads, type WizardMiddleware, WizardProvider, WizardStepRenderer, YupAdapter, ZodAdapter, createWizardFactory, devToolsMiddleware, getByPath, loggerMiddleware, setByPath, shallowEqual, toPath, useWizard, useWizardActions, useWizardContext, useWizardError, useWizardSelector, useWizardState, useWizardValue };
|