@rilaykit/core 3.0.0 → 5.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { z } from 'zod';
1
+ import * as React$1 from 'react';
2
+ import React__default from 'react';
3
3
 
4
4
  /**
5
5
  * Main configuration class for Rilay form components and workflows
@@ -15,123 +15,92 @@ declare class ril<C> {
15
15
  * @param type - The component type (e.g., 'text', 'email', 'heading'), used as a unique identifier.
16
16
  * @param config - Component configuration without id and type
17
17
  * @returns The ril instance for chaining
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // Component avec validation par défaut
22
+ * const factory = ril.create()
23
+ * .addComponent('email', {
24
+ * name: 'Email Input',
25
+ * renderer: EmailInput,
26
+ * validation: {
27
+ * validators: [email('Format email invalide')],
28
+ * validateOnBlur: true,
29
+ * }
30
+ * });
31
+ * ```
18
32
  */
19
33
  addComponent<NewType extends string, TProps = any>(type: NewType, config: Omit<ComponentConfig<TProps>, 'id' | 'type'>): ril<C & {
20
34
  [K in NewType]: TProps;
21
35
  }>;
22
36
  /**
23
- * Generic method to set any renderer type easily
24
- * @param rendererType - The type of renderer to set
25
- * @param renderer - The renderer function
26
- * @returns The ril instance for chaining
27
- */
28
- setRenderer<T extends keyof (FormRenderConfig & WorkflowRenderConfig)>(rendererType: T, renderer: (FormRenderConfig & WorkflowRenderConfig)[T]): this;
29
- /**
30
- * Set multiple renderers at once
31
- * @param renderers - Object with renderer configurations
32
- * @returns The ril instance for chaining
33
- */
34
- setRenderers(renderers: Partial<FormRenderConfig & WorkflowRenderConfig>): this;
35
- /**
36
- * Set custom row renderer
37
- * @param renderer - Custom row renderer function
38
- * @returns The ril instance for chaining
39
- */
40
- setRowRenderer(renderer: FormRowRenderer): this;
41
- /**
42
- * Set custom body renderer
43
- * @param renderer - Custom body renderer function
44
- * @returns The ril instance for chaining
45
- */
46
- setBodyRenderer(renderer: FormBodyRenderer): this;
47
- /**
48
- * Set custom submit button renderer
49
- * @param renderer - Custom submit button renderer function
50
- * @returns The ril instance for chaining
51
- */
52
- setSubmitButtonRenderer(renderer: FormSubmitButtonRenderer): this;
53
- /**
54
- * Set custom field renderer
55
- * @param renderer - Custom field renderer function
56
- * @returns The ril instance for chaining
57
- */
58
- setFieldRenderer(renderer: FieldRenderer): this;
59
- /**
60
- * Set complete form render configuration
61
- * @param config - Form render configuration
62
- * @returns The ril instance for chaining
63
- */
64
- setFormRenderConfig(config: FormRenderConfig): this;
65
- /**
66
- * Get current form render configuration
67
- * @returns Current form render configuration
37
+ * Universal configuration method for all renderer types
38
+ *
39
+ * This method provides a unified API to configure both form and workflow renderers
40
+ * in a single call, automatically categorizing and applying the appropriate configurations.
41
+ *
42
+ * @param config - Configuration object containing renderer settings
43
+ * @param config.rowRenderer - Custom renderer for form rows (form-specific)
44
+ * @param config.bodyRenderer - Custom renderer for form body container (form-specific)
45
+ * @param config.submitButtonRenderer - Custom renderer for form submit buttons (form-specific)
46
+ * @param config.fieldRenderer - Custom renderer for individual form fields (form-specific)
47
+ * @param config.stepperRenderer - Custom renderer for workflow step navigation (workflow-specific)
48
+ * @param config.nextButtonRenderer - Custom renderer for workflow next buttons (workflow-specific)
49
+ * @param config.previousButtonRenderer - Custom renderer for workflow previous buttons (workflow-specific)
50
+ * @param config.skipButtonRenderer - Custom renderer for workflow skip buttons (workflow-specific)
51
+ *
52
+ * @returns The ril instance for method chaining
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * // Configure form renderers only
57
+ * const config = ril.create()
58
+ * .configure({
59
+ * rowRenderer: CustomRowRenderer,
60
+ * submitButtonRenderer: CustomSubmitButton
61
+ * });
62
+ *
63
+ * // Configure workflow renderers only
64
+ * const config = ril.create()
65
+ * .configure({
66
+ * stepperRenderer: CustomStepper,
67
+ * nextButtonRenderer: CustomNextButton
68
+ * });
69
+ *
70
+ * // Configure both form and workflow renderers
71
+ * const config = ril.create()
72
+ * .configure({
73
+ * // Form renderers
74
+ * rowRenderer: CustomRowRenderer,
75
+ * fieldRenderer: CustomFieldRenderer,
76
+ * // Workflow renderers
77
+ * stepperRenderer: CustomStepper,
78
+ * nextButtonRenderer: CustomNextButton
79
+ * });
80
+ * ```
81
+ *
82
+ * @remarks
83
+ * - Renderers are automatically categorized into form or workflow configurations
84
+ * - Existing configurations are merged, not replaced entirely
85
+ * - Invalid renderer keys are silently ignored
86
+ * - This method replaces individual setter methods for better DX
87
+ */
88
+ configure(config: Partial<FormRenderConfig & WorkflowRenderConfig>): this;
89
+ /**
90
+ * Configuration getters
68
91
  */
69
92
  getFormRenderConfig(): FormRenderConfig;
70
- /**
71
- * Set custom stepper renderer for workflows
72
- * @param renderer - Custom stepper renderer function
73
- * @returns The ril instance for chaining
74
- */
75
- setStepperRenderer(renderer: WorkflowStepperRenderer): this;
76
- /**
77
- * Set custom workflow next button renderer
78
- * @param renderer - Custom workflow next button renderer function
79
- * @returns The ril instance for chaining
80
- */
81
- setWorkflowNextButtonRenderer(renderer: WorkflowNextButtonRenderer): this;
82
- /**
83
- * Set custom workflow previous button renderer
84
- * @param renderer - Custom workflow previous button renderer function
85
- * @returns The ril instance for chaining
86
- */
87
- setWorkflowPreviousButtonRenderer(renderer: WorkflowPreviousButtonRenderer): this;
88
- /**
89
- * Set custom workflow skip button renderer
90
- * @param renderer - Custom workflow skip button renderer function
91
- * @returns The ril instance for chaining
92
- */
93
- setWorkflowSkipButtonRenderer(renderer: WorkflowSkipButtonRenderer): this;
94
- /**
95
- * Set complete workflow render configuration
96
- * @param config - Workflow render configuration
97
- * @returns The ril instance for chaining
98
- */
99
- setWorkflowRenderConfig(config: WorkflowRenderConfig): this;
100
- /**
101
- * Get current workflow render configuration
102
- * @returns Current workflow render configuration
103
- */
104
93
  getWorkflowRenderConfig(): WorkflowRenderConfig;
105
94
  /**
106
- * Get a component by its ID
107
- * @param id - Component ID (which is its type)
108
- * @returns Component configuration or undefined
95
+ * Component management methods
109
96
  */
110
97
  getComponent<T extends keyof C & string>(id: T): ComponentConfig<C[T]> | undefined;
111
- /**
112
- * List all registered components
113
- * @returns Array of all components
114
- */
115
98
  getAllComponents(): ComponentConfig[];
116
- /**
117
- * Check if a component exists
118
- * @param id - Component ID
119
- * @returns True if component exists
120
- */
121
99
  hasComponent(id: string): boolean;
122
- /**
123
- * Remove a component from the configuration
124
- * @param id - Component ID
125
- * @returns True if component was removed
126
- */
127
100
  removeComponent(id: string): boolean;
128
- /**
129
- * Clear all components
130
- */
131
101
  clear(): void;
132
102
  /**
133
- * Get statistics about registered components and renderers
134
- * @returns Object with comprehensive statistics
103
+ * Enhanced statistics with more detailed information
135
104
  */
136
105
  getStats(): {
137
106
  total: number;
@@ -148,8 +117,7 @@ declare class ril<C> {
148
117
  };
149
118
  };
150
119
  /**
151
- * Validate the configuration
152
- * @returns Array of validation errors
120
+ * Enhanced validation using shared utilities
153
121
  */
154
122
  validate(): string[];
155
123
  }
@@ -159,81 +127,140 @@ interface RilayLicenseConfig {
159
127
  readonly environment?: 'development' | 'production';
160
128
  readonly allowTrial?: boolean;
161
129
  }
130
+ interface ValidationError {
131
+ readonly message: string;
132
+ readonly code?: string;
133
+ readonly path?: string;
134
+ }
162
135
  interface ValidationResult {
163
136
  readonly isValid: boolean;
164
137
  readonly errors: ValidationError[];
165
138
  }
166
- interface ValidationError {
167
- readonly code: string;
168
- readonly message: string;
169
- readonly path?: string[];
170
- }
171
139
  interface ValidationContext {
172
- readonly fieldId: string;
173
- readonly formData: Record<string, any>;
174
- readonly fieldProps: Record<string, any>;
175
- readonly touched: boolean;
176
- readonly dirty: boolean;
177
- }
178
- type ValidatorFunction<TProps = any> = (value: any, context: ValidationContext, props: TProps) => ValidationResult | Promise<ValidationResult>;
179
- interface ValidationConfig<TProps = any> {
180
- readonly validator?: ValidatorFunction<TProps>;
181
- readonly debounceMs?: number;
140
+ readonly fieldId?: string;
141
+ readonly formId?: string;
142
+ readonly stepId?: string;
143
+ readonly workflowId?: string;
144
+ readonly allFormData?: Record<string, any>;
145
+ readonly stepData?: Record<string, any>;
146
+ readonly workflowData?: Record<string, any>;
147
+ }
148
+ type FieldValidator<T = any> = (value: T, context: ValidationContext) => ValidationResult | Promise<ValidationResult>;
149
+ type FormValidator<T = Record<string, any>> = (formData: T, context: ValidationContext) => ValidationResult | Promise<ValidationResult>;
150
+ type ValidationSchema<T = any> = {
151
+ parse: (value: T) => T;
152
+ safeParse: (value: T) => {
153
+ success: boolean;
154
+ data?: T;
155
+ error?: any;
156
+ };
157
+ };
158
+ interface ValidationAdapter<TSchema = any> {
159
+ readonly name: string;
160
+ readonly version?: string;
161
+ createFieldValidator<T>(schema: TSchema): FieldValidator<T>;
162
+ createFormValidator<T>(schema: TSchema): FormValidator<T>;
163
+ }
164
+ interface FieldValidationConfig {
165
+ readonly validators?: FieldValidator[];
166
+ readonly schema?: ValidationSchema;
182
167
  readonly validateOnChange?: boolean;
183
168
  readonly validateOnBlur?: boolean;
169
+ readonly debounceMs?: number;
170
+ }
171
+ interface FormValidationConfig {
172
+ readonly validators?: FormValidator[];
173
+ readonly schema?: ValidationSchema;
184
174
  readonly validateOnSubmit?: boolean;
185
- readonly dependencies?: string[];
175
+ readonly validateOnStepChange?: boolean;
176
+ }
177
+ type ComponentRenderer<TProps = any> = (props: ComponentRenderProps<TProps>) => React__default.ReactElement;
178
+ type RendererChildrenFunction<TProps = any> = (props: TProps) => React__default.ReactNode;
179
+ interface ComponentRendererBaseProps<TProps = any> {
180
+ className?: string;
181
+ children?: React__default.ReactNode | RendererChildrenFunction<TProps>;
182
+ renderAs?: 'default' | 'children' | boolean;
183
+ }
184
+ interface ComponentRendererWrapperProps<TProps = any> extends Omit<ComponentRendererBaseProps<TProps>, 'className'> {
185
+ name: string;
186
+ props: TProps;
187
+ renderer?: RendererChildrenFunction<TProps>;
186
188
  }
187
- type ComponentRenderer<TProps = any> = (props: ComponentRenderProps<TProps>) => React.ReactElement;
188
189
  interface ComponentRenderProps<TProps = any> {
189
190
  id: string;
190
191
  props: TProps;
191
192
  value?: any;
192
193
  onChange?: (value: any) => void;
193
194
  onBlur?: () => void;
194
- error?: ValidationError[];
195
- touched?: boolean;
196
195
  disabled?: boolean;
196
+ error?: ValidationError[];
197
197
  isValidating?: boolean;
198
198
  [key: string]: any;
199
199
  }
200
- type RendererChildrenFunction<TProps = any> = (props: TProps) => React.ReactNode;
201
- declare function resolveRendererChildren<TProps>(children: React.ReactNode | RendererChildrenFunction<TProps> | undefined, props: TProps): React.ReactNode;
202
200
  interface ComponentConfig<TProps = any> {
203
201
  readonly id: string;
204
202
  readonly type: string;
205
203
  readonly name: string;
206
204
  readonly description?: string;
207
205
  readonly renderer: ComponentRenderer<TProps>;
208
- readonly validation?: ValidationConfig<TProps>;
209
206
  readonly defaultProps?: Partial<TProps>;
210
207
  readonly useFieldRenderer?: boolean;
208
+ readonly validation?: FieldValidationConfig;
211
209
  }
212
210
  interface FormFieldConfig {
213
211
  readonly id: string;
214
212
  readonly componentId: string;
215
213
  readonly props: Record<string, any>;
216
- readonly validation?: ValidationConfig;
217
- readonly conditional?: ConditionalConfig;
214
+ readonly validation?: FieldValidationConfig;
218
215
  }
219
216
  interface FormFieldRow {
220
217
  readonly id: string;
221
218
  readonly fields: FormFieldConfig[];
222
219
  readonly maxColumns?: number;
223
- readonly spacing?: 'tight' | 'normal' | 'loose';
224
- readonly alignment?: 'start' | 'center' | 'end' | 'stretch';
225
220
  }
226
- interface ConditionalConfig {
227
- readonly condition: (formData: Record<string, any>) => boolean;
228
- readonly action: 'show' | 'hide' | 'disable' | 'require';
221
+ interface FormConfiguration<C extends Record<string, any> = Record<string, never>> {
222
+ readonly id: string;
223
+ readonly config: ril<C>;
224
+ readonly rows: FormFieldRow[];
225
+ readonly allFields: FormFieldConfig[];
226
+ readonly renderConfig?: FormRenderConfig;
227
+ readonly validation?: FormValidationConfig;
229
228
  }
230
- interface StepLifecycleHooks {
231
- readonly onBeforeEnter?: (stepData: any, allData: any, context: WorkflowContext) => Promise<void>;
232
- readonly onAfterLeave?: (stepData: any, allData: any, context: WorkflowContext) => Promise<boolean>;
233
- readonly onValidate?: (stepData: any, context: WorkflowContext) => Promise<ValidationResult>;
234
- readonly onTransform?: (stepData: any, context: WorkflowContext) => Promise<any>;
235
- readonly onError?: (error: Error, context: WorkflowContext) => Promise<void>;
229
+ interface FormRenderConfig {
230
+ readonly rowRenderer?: FormRowRenderer;
231
+ readonly bodyRenderer?: FormBodyRenderer;
232
+ readonly submitButtonRenderer?: FormSubmitButtonRenderer;
233
+ readonly fieldRenderer?: FieldRenderer;
234
+ }
235
+ interface FormComponentRendererProps {
236
+ children: React__default.ReactNode;
237
+ }
238
+ interface FormRowRendererProps {
239
+ row: FormFieldRow;
240
+ children: React__default.ReactNode;
241
+ className?: string;
242
+ }
243
+ interface FormBodyRendererProps {
244
+ formConfig: FormConfiguration;
245
+ children: React__default.ReactNode;
246
+ className?: string;
247
+ }
248
+ interface FormSubmitButtonRendererProps {
249
+ isSubmitting: boolean;
250
+ onSubmit: () => void;
251
+ className?: string;
252
+ children?: React__default.ReactNode;
236
253
  }
254
+ interface FieldRendererProps {
255
+ children: React__default.ReactNode;
256
+ id: string;
257
+ disabled?: boolean;
258
+ [key: string]: any;
259
+ }
260
+ type FormRowRenderer = RendererChildrenFunction<FormRowRendererProps>;
261
+ type FormBodyRenderer = RendererChildrenFunction<FormBodyRendererProps>;
262
+ type FormSubmitButtonRenderer = RendererChildrenFunction<FormSubmitButtonRendererProps>;
263
+ type FieldRenderer = RendererChildrenFunction<FieldRendererProps>;
237
264
  interface WorkflowContext {
238
265
  readonly workflowId: string;
239
266
  readonly currentStepIndex: number;
@@ -243,80 +270,61 @@ interface WorkflowContext {
243
270
  readonly isFirstStep: boolean;
244
271
  readonly isLastStep: boolean;
245
272
  readonly visitedSteps: Set<string>;
246
- readonly user?: any;
247
273
  }
248
- interface StepPermissions {
249
- readonly requiredRoles?: string[];
250
- readonly requiredPermissions?: string[];
251
- readonly customGuard?: (user: any, context: WorkflowContext) => boolean | Promise<boolean>;
252
- }
253
- interface DynamicStepConfig {
254
- readonly resolver: (previousData: any, context: WorkflowContext) => Promise<StepConfig[]>;
255
- readonly cacheKey?: string;
256
- readonly retryPolicy?: RetryPolicy;
257
- }
258
- interface RetryPolicy {
259
- readonly maxRetries: number;
260
- readonly delayMs: number;
261
- readonly backoffMultiplier?: number;
274
+ interface StepDataHelper {
275
+ /**
276
+ * Set data for a specific step by step ID
277
+ */
278
+ setStepData: (stepId: string, data: Record<string, any>) => void;
279
+ /**
280
+ * Set specific field values for a step
281
+ */
282
+ setStepFields: (stepId: string, fields: Record<string, any>) => void;
283
+ /**
284
+ * Get current data for a specific step
285
+ */
286
+ getStepData: (stepId: string) => Record<string, any>;
287
+ /**
288
+ * Set field value for the next step
289
+ */
290
+ setNextStepField: (fieldId: string, value: any) => void;
291
+ /**
292
+ * Set multiple fields for the next step
293
+ */
294
+ setNextStepFields: (fields: Record<string, any>) => void;
295
+ /**
296
+ * Get all workflow data
297
+ */
298
+ getAllData: () => Record<string, any>;
299
+ /**
300
+ * Get all step configurations for reference
301
+ */
302
+ getSteps: () => StepConfig[];
262
303
  }
263
304
  interface StepConfig {
264
305
  readonly id: string;
265
306
  readonly title: string;
266
307
  readonly description?: string;
267
308
  readonly formConfig: FormConfiguration;
268
- readonly validation?: StepValidationConfig;
269
- readonly conditional?: StepConditionalConfig;
270
309
  readonly allowSkip?: boolean;
271
- readonly requiredToComplete?: boolean;
272
- readonly hooks?: StepLifecycleHooks;
273
- readonly permissions?: StepPermissions;
274
- readonly isDynamic?: boolean;
275
- readonly dynamicConfig?: DynamicStepConfig;
276
310
  readonly renderer?: CustomStepRenderer;
311
+ readonly onAfterValidation?: (stepData: Record<string, any>, helper: StepDataHelper, context: WorkflowContext) => void | Promise<void>;
277
312
  }
278
- interface StepValidationConfig {
279
- readonly validator?: (stepData: Record<string, any>, allFormData: Record<string, any>, context: WorkflowContext) => ValidationResult | Promise<ValidationResult>;
280
- readonly validateOnStepChange?: boolean;
281
- readonly blockNextIfInvalid?: boolean;
282
- }
283
- interface StepConditionalConfig {
284
- readonly condition: (formData: Record<string, any>, context: WorkflowContext) => boolean;
285
- readonly action: 'show' | 'hide' | 'skip';
286
- }
287
- type CustomStepRenderer = (props: StepConfig) => React.ReactElement;
288
- interface WorkflowPersistenceData {
289
- readonly workflowId: string;
290
- readonly currentStepIndex: number;
291
- readonly allData: Record<string, any>;
292
- readonly metadata: {
293
- readonly timestamp: number;
294
- readonly version?: string;
295
- readonly userId?: string;
296
- readonly sessionId?: string;
297
- };
298
- }
299
- interface PersistenceAdapter {
313
+ type CustomStepRenderer = (props: StepConfig) => React__default.ReactElement;
314
+ interface WorkflowConfig {
315
+ readonly id: string;
300
316
  readonly name: string;
301
- save(key: string, data: WorkflowPersistenceData): Promise<void>;
302
- load(key: string): Promise<WorkflowPersistenceData | null>;
303
- remove(key: string): Promise<void>;
304
- exists(key: string): Promise<boolean>;
305
- list?(pattern?: string): Promise<string[]>;
306
- }
307
- interface PersistenceConfig {
308
- readonly adapter: PersistenceAdapter;
309
- readonly key?: string;
310
- readonly debounceMs?: number;
311
- readonly autoSave?: boolean;
312
- readonly saveOnStepChange?: boolean;
313
- readonly encryptionKey?: string;
314
- readonly maxRetries?: number;
315
- readonly retryDelayMs?: number;
316
- readonly onSave?: (data: WorkflowPersistenceData) => Promise<void> | void;
317
- readonly onLoad?: (data: WorkflowPersistenceData) => Promise<void> | void;
318
- readonly onError?: (error: Error, operation: 'save' | 'load' | 'remove') => Promise<void> | void;
319
- readonly onRetry?: (attempt: number, maxRetries: number, error: Error) => Promise<void> | void;
317
+ readonly description?: string;
318
+ readonly steps: StepConfig[];
319
+ readonly analytics?: WorkflowAnalytics;
320
+ readonly plugins?: WorkflowPlugin[];
321
+ readonly renderConfig?: WorkflowRenderConfig;
322
+ }
323
+ interface WorkflowRenderConfig {
324
+ readonly stepperRenderer?: WorkflowStepperRenderer;
325
+ readonly nextButtonRenderer?: WorkflowNextButtonRenderer;
326
+ readonly previousButtonRenderer?: WorkflowPreviousButtonRenderer;
327
+ readonly skipButtonRenderer?: WorkflowSkipButtonRenderer;
320
328
  }
321
329
  interface WorkflowAnalytics {
322
330
  readonly onWorkflowStart?: (workflowId: string, context: WorkflowContext) => void;
@@ -325,43 +333,21 @@ interface WorkflowAnalytics {
325
333
  readonly onStepStart?: (stepId: string, timestamp: number, context: WorkflowContext) => void;
326
334
  readonly onStepComplete?: (stepId: string, duration: number, data: any, context: WorkflowContext) => void;
327
335
  readonly onStepSkip?: (stepId: string, reason: string, context: WorkflowContext) => void;
328
- readonly onValidationError?: (stepId: string, errors: ValidationError[], context: WorkflowContext) => void;
329
336
  readonly onError?: (error: Error, context: WorkflowContext) => void;
330
337
  }
331
- interface WorkflowHooks {
332
- readonly onStepChange?: (from: string, to: string, context: WorkflowContext) => void;
333
- readonly onDataChange?: (data: any, context: WorkflowContext) => void;
334
- readonly onValidation?: (result: ValidationResult, context: WorkflowContext) => void;
335
- }
336
338
  interface WorkflowPlugin {
337
339
  readonly name: string;
338
340
  readonly version?: string;
339
341
  readonly install: (workflow: any) => void;
340
- readonly hooks?: WorkflowHooks;
341
342
  readonly dependencies?: string[];
342
343
  }
343
- interface WorkflowConfig {
344
- readonly id: string;
345
- readonly name: string;
346
- readonly description?: string;
347
- readonly steps: StepConfig[];
348
- readonly navigation?: NavigationConfig;
349
- readonly persistence?: PersistenceConfig;
350
- readonly completion?: CompletionConfig;
351
- readonly analytics?: WorkflowAnalytics;
352
- readonly plugins?: WorkflowPlugin[];
353
- readonly renderConfig?: WorkflowRenderConfig;
354
- }
355
- interface NavigationConfig {
356
- readonly allowBackNavigation?: boolean;
357
- readonly allowStepSkipping?: boolean;
358
- readonly showProgress?: boolean;
359
- readonly customNavigation?: boolean;
360
- }
361
- interface CompletionConfig {
362
- readonly onComplete?: (formData: Record<string, any>) => void | Promise<void>;
363
- readonly confirmBeforeSubmit?: boolean;
364
- readonly customCompletionStep?: any;
344
+ interface WorkflowComponentRendererBaseProps {
345
+ children?: React__default.ReactNode;
346
+ className?: string;
347
+ currentStep: StepConfig;
348
+ stepData: Record<string, any>;
349
+ allData: Record<string, any>;
350
+ context: WorkflowContext;
365
351
  }
366
352
  interface WorkflowStepperRendererProps {
367
353
  readonly steps: StepConfig[];
@@ -370,258 +356,471 @@ interface WorkflowStepperRendererProps {
370
356
  readonly onStepClick?: (stepIndex: number) => void;
371
357
  readonly className?: string;
372
358
  }
373
- type WorkflowStepperRenderer = (props: WorkflowStepperRendererProps) => React.ReactElement;
374
- interface WorkflowRenderConfig {
375
- readonly stepperRenderer?: WorkflowStepperRenderer;
376
- readonly nextButtonRenderer?: WorkflowNextButtonRenderer;
377
- readonly previousButtonRenderer?: WorkflowPreviousButtonRenderer;
378
- readonly skipButtonRenderer?: WorkflowSkipButtonRenderer;
379
- }
380
- interface FormRowRendererProps {
381
- row: FormFieldRow;
382
- children: React.ReactNode;
383
- className?: string;
384
- spacing?: 'tight' | 'normal' | 'loose';
385
- alignment?: 'start' | 'center' | 'end' | 'stretch';
386
- }
387
- interface FormBodyRendererProps {
388
- formConfig: FormConfiguration;
389
- children: React.ReactNode;
390
- className?: string;
391
- }
392
- interface FormSubmitButtonRendererProps {
393
- isSubmitting: boolean;
394
- isValid: boolean;
395
- isDirty: boolean;
396
- onSubmit: () => void;
397
- className?: string;
398
- children?: React.ReactNode;
399
- }
400
- type FormRowRenderer = (props: FormRowRendererProps) => React.ReactElement;
401
- type FormBodyRenderer = (props: FormBodyRendererProps) => React.ReactElement;
402
- type FormSubmitButtonRenderer = (props: FormSubmitButtonRendererProps) => React.ReactElement;
403
- interface FieldRendererProps {
404
- children: React.ReactNode;
405
- id: string;
406
- error?: ValidationError[];
407
- touched?: boolean;
408
- disabled?: boolean;
409
- isValidating?: boolean;
410
- [key: string]: any;
411
- }
412
- type FieldRenderer = (props: FieldRendererProps) => React.ReactElement;
413
- interface FormRenderConfig {
414
- readonly rowRenderer?: FormRowRenderer;
415
- readonly bodyRenderer?: FormBodyRenderer;
416
- readonly submitButtonRenderer?: FormSubmitButtonRenderer;
417
- readonly fieldRenderer?: FieldRenderer;
418
- }
419
- interface FormConfiguration<C extends Record<string, any> = Record<string, never>> {
420
- readonly id: string;
421
- readonly schema?: any;
422
- readonly config: ril<C>;
423
- readonly rows: FormFieldRow[];
424
- readonly allFields: FormFieldConfig[];
425
- readonly renderConfig?: FormRenderConfig;
426
- }
427
- interface WorkflowNextButtonRendererProps {
359
+ type WorkflowNextButtonRendererProps = WorkflowComponentRendererBaseProps & {
428
360
  isLastStep: boolean;
429
361
  canGoNext: boolean;
430
362
  isSubmitting: boolean;
431
- onNext: (event?: React.FormEvent) => void;
432
- onSubmit: (event?: React.FormEvent) => void;
433
- className?: string;
434
- children?: React.ReactNode;
435
- currentStep: StepConfig;
436
- stepData: Record<string, any>;
437
- allData: Record<string, any>;
438
- context: WorkflowContext;
439
- }
440
- interface WorkflowPreviousButtonRendererProps {
363
+ onSubmit: (event?: React__default.FormEvent) => void;
364
+ };
365
+ type WorkflowPreviousButtonRendererProps = WorkflowComponentRendererBaseProps & {
441
366
  canGoPrevious: boolean;
442
- onPrevious: (event?: React.FormEvent) => void;
443
- className?: string;
444
- children?: React.ReactNode;
445
- currentStep: StepConfig;
446
- stepData: Record<string, any>;
447
- allData: Record<string, any>;
448
- context: WorkflowContext;
449
- }
450
- interface WorkflowSkipButtonRendererProps {
367
+ onPrevious: (event?: React__default.FormEvent) => void;
368
+ };
369
+ type WorkflowSkipButtonRendererProps = WorkflowComponentRendererBaseProps & {
451
370
  canSkip: boolean;
452
- onSkip: (event?: React.FormEvent) => void;
453
- className?: string;
454
- children?: React.ReactNode;
455
- currentStep: StepConfig;
456
- stepData: Record<string, any>;
457
- allData: Record<string, any>;
458
- context: WorkflowContext;
371
+ onSkip: (event?: React__default.FormEvent) => void;
372
+ };
373
+ type WorkflowStepperRenderer = RendererChildrenFunction<WorkflowStepperRendererProps>;
374
+ type WorkflowNextButtonRenderer = RendererChildrenFunction<WorkflowNextButtonRendererProps>;
375
+ type WorkflowPreviousButtonRenderer = RendererChildrenFunction<WorkflowPreviousButtonRendererProps>;
376
+ type WorkflowSkipButtonRenderer = RendererChildrenFunction<WorkflowSkipButtonRendererProps>;
377
+
378
+ declare function ComponentRendererWrapper<TProps = any>({ children, renderAs, renderer, name, props: baseProps, }: ComponentRendererWrapperProps<TProps>): React$1.ReactNode;
379
+
380
+ /**
381
+ * Utility for merging partial configurations into existing objects
382
+ * Eliminates repetitive object spread operations
383
+ */
384
+ declare function mergeInto<T>(target: T, partial: Partial<T>): T;
385
+ /**
386
+ * Validates uniqueness of identifiers and throws descriptive errors
387
+ */
388
+ declare function ensureUnique(ids: string[], entityName: string): void;
389
+ /**
390
+ * Validates required fields exist in configurations
391
+ */
392
+ declare function validateRequired<T>(items: T[], requiredFields: (keyof T)[], entityName: string): void;
393
+ /**
394
+ * Auto-generates IDs when not provided
395
+ */
396
+ declare class IdGenerator {
397
+ private counters;
398
+ next(prefix: string): string;
399
+ reset(prefix?: string): void;
459
400
  }
460
- type WorkflowNextButtonRenderer = (props: WorkflowNextButtonRendererProps) => React.ReactElement;
461
- type WorkflowPreviousButtonRenderer = (props: WorkflowPreviousButtonRendererProps) => React.ReactElement;
462
- type WorkflowSkipButtonRenderer = (props: WorkflowSkipButtonRendererProps) => React.ReactElement;
401
+ /**
402
+ * Polymorphic helper for handling single items or arrays
403
+ */
404
+ declare function normalizeToArray<T>(input: T | T[]): T[];
405
+ /**
406
+ * Deep clone utility for configuration objects
407
+ */
408
+ declare function deepClone<T>(obj: T): T;
409
+ /**
410
+ * Generic configuration merger with type safety
411
+ */
412
+ declare function configureObject<T>(target: T, updates: Partial<T>, allowedKeys?: (keyof T)[]): T;
413
+
414
+ declare function resolveRendererChildren<TProps>(children: React.ReactNode | RendererChildrenFunction<TProps> | undefined, props: TProps): React.ReactNode;
463
415
 
464
416
  /**
465
- * Create a Zod-based validator
466
- * @param schema - Zod schema to validate against
467
- * @returns Validator function
417
+ * @fileoverview Validation utilities
418
+ *
419
+ * This module provides utility functions for working with validation results,
420
+ * combining validators, and managing validation contexts.
468
421
  */
469
- declare const createZodValidator: <T>(schema: z.ZodSchema<T>) => ValidatorFunction;
422
+
470
423
  /**
471
- * Create a custom validator from a validation function
472
- * @param validationFn - Function that returns boolean, string, or Promise
473
- * @returns Validator function
424
+ * Creates a validation result object
425
+ *
426
+ * @param isValid - Whether the validation passed
427
+ * @param errors - Array of validation errors (empty if valid)
428
+ * @returns A complete ValidationResult object
429
+ *
430
+ * @example
431
+ * ```typescript
432
+ * const result = createValidationResult(false, [
433
+ * { message: 'Email is required', code: 'REQUIRED' }
434
+ * ]);
435
+ * ```
474
436
  */
475
- declare const createCustomValidator: (validationFn: (value: any, context: ValidationContext) => boolean | string | Promise<boolean | string>) => ValidatorFunction;
437
+ declare function createValidationResult(isValid: boolean, errors?: ValidationError[]): ValidationResult;
476
438
  /**
477
- * Combine multiple validators
478
- * @param validators - Array of validators to combine
479
- * @param mode - 'all' (all must pass) or 'any' (at least one must pass)
480
- * @returns Combined validator function
439
+ * Combines multiple validation results into a single result
440
+ *
441
+ * The combined result is valid only if all input results are valid.
442
+ * All errors from all results are included in the combined result.
443
+ *
444
+ * @param results - Array of ValidationResult objects to combine
445
+ * @returns A single ValidationResult combining all inputs
446
+ *
447
+ * @example
448
+ * ```typescript
449
+ * const combined = combineValidationResults([
450
+ * emailValidator(value),
451
+ * requiredValidator(value),
452
+ * minLengthValidator(value)
453
+ * ]);
454
+ * ```
481
455
  */
482
- declare const combineValidators: (validators: ValidatorFunction[], mode?: "all" | "any") => ValidatorFunction;
456
+ declare function combineValidationResults(results: ValidationResult[]): ValidationResult;
483
457
  /**
484
- * Create a conditional validator that only runs when condition is met
485
- * @param condition - Function to determine if validation should run
486
- * @param validator - Validator to run when condition is true
487
- * @returns Conditional validator function
458
+ * Runs multiple synchronous validators and combines their results
459
+ *
460
+ * @param validators - Array of validators to run
461
+ * @param value - The value to validate
462
+ * @param context - Validation context
463
+ * @returns Combined validation result
464
+ *
465
+ * @example
466
+ * ```typescript
467
+ * const result = runValidators([
468
+ * required,
469
+ * email,
470
+ * minLength(5)
471
+ * ], emailValue, context);
472
+ * ```
488
473
  */
489
- declare const createConditionalValidator: (condition: (value: any, context: ValidationContext) => boolean, validator: ValidatorFunction) => ValidatorFunction;
474
+ declare function runValidators<T>(validators: FieldValidator<T>[], value: T, context: ValidationContext): ValidationResult;
490
475
  /**
491
- * Common validation patterns
476
+ * Runs multiple asynchronous validators and combines their results
477
+ *
478
+ * @param validators - Array of validators to run (can be sync or async)
479
+ * @param value - The value to validate
480
+ * @param context - Validation context
481
+ * @returns Promise resolving to combined validation result
482
+ *
483
+ * @example
484
+ * ```typescript
485
+ * const result = await runValidatorsAsync([
486
+ * required,
487
+ * email,
488
+ * checkEmailUnique // async validator
489
+ * ], emailValue, context);
490
+ * ```
492
491
  */
493
- declare const commonValidators: {
494
- /**
495
- * Required field validator
496
- */
497
- required: (message?: string) => ValidatorFunction;
498
- /**
499
- * Email validation
500
- */
501
- email: (message?: string) => ValidatorFunction;
502
- /**
503
- * Minimum length validation
504
- */
505
- minLength: (min: number, message?: string) => ValidatorFunction;
506
- /**
507
- * Maximum length validation
508
- */
509
- maxLength: (max: number, message?: string) => ValidatorFunction;
510
- /**
511
- * Pattern/regex validation
512
- */
513
- pattern: (regex: RegExp, message?: string) => ValidatorFunction;
514
- /**
515
- * Number range validation
516
- */
517
- numberRange: (min?: number, max?: number, message?: string) => ValidatorFunction;
518
- /**
519
- * URL validation
520
- */
521
- url: (message?: string) => ValidatorFunction;
522
- /**
523
- * Phone number validation (basic)
524
- */
525
- phoneNumber: (message?: string) => ValidatorFunction;
526
- /**
527
- * Custom async validation with debouncing
528
- */
529
- asyncValidation: (asyncFn: (value: any, context: ValidationContext) => Promise<boolean | string>, debounceMs?: number) => ValidatorFunction;
530
- };
492
+ declare function runValidatorsAsync<T>(validators: FieldValidator<T>[], value: T, context: ValidationContext): Promise<ValidationResult>;
531
493
  /**
532
- * Utility to create validation result
533
- * @param isValid - Whether validation passed
534
- * @param errors - Array of errors (optional)
535
- * @returns ValidationResult object
494
+ * Creates a validation context object
495
+ *
496
+ * @param options - Context configuration options
497
+ * @returns A complete ValidationContext object
498
+ *
499
+ * @example
500
+ * ```typescript
501
+ * const context = createValidationContext({
502
+ * fieldId: 'email',
503
+ * formId: 'registration',
504
+ * allFormData: { email: 'test@example.com', name: 'John' }
505
+ * });
506
+ * ```
536
507
  */
537
- declare const createValidationResult: (isValid: boolean, errors?: ValidationError[]) => ValidationResult;
508
+ declare function createValidationContext(options?: Partial<ValidationContext>): ValidationContext;
509
+
538
510
  /**
539
- * Utility to create validation error
540
- * @param code - Error code
541
- * @param message - Error message
542
- * @param path - Error path (optional)
543
- * @returns ValidationError object
511
+ * @fileoverview Built-in validators
512
+ *
513
+ * This module provides a comprehensive set of built-in validators for common
514
+ * validation scenarios. These validators follow the FieldValidator interface
515
+ * and can be used standalone or combined with other validators.
544
516
  */
545
- declare const createValidationError: (code: string, message: string, path?: string[]) => ValidationError;
546
517
 
547
518
  /**
548
- * LocalStorage persistence adapter
549
- * Perfect for client-side persistence across browser sessions
550
- */
551
- declare class LocalStorageAdapter implements PersistenceAdapter {
552
- readonly name = "localStorage";
553
- save(key: string, data: WorkflowPersistenceData): Promise<void>;
554
- load(key: string): Promise<WorkflowPersistenceData | null>;
555
- remove(key: string): Promise<void>;
556
- exists(key: string): Promise<boolean>;
557
- list(pattern?: string): Promise<string[]>;
558
- }
559
- /**
560
- * SessionStorage persistence adapter
561
- * Perfect for temporary persistence within a single browser session
562
- */
563
- declare class SessionStorageAdapter implements PersistenceAdapter {
564
- readonly name = "sessionStorage";
565
- save(key: string, data: WorkflowPersistenceData): Promise<void>;
566
- load(key: string): Promise<WorkflowPersistenceData | null>;
567
- remove(key: string): Promise<void>;
568
- exists(key: string): Promise<boolean>;
569
- list(pattern?: string): Promise<string[]>;
570
- }
571
- /**
572
- * In-Memory persistence adapter
573
- * Perfect for testing or temporary workflows
574
- */
575
- declare class MemoryAdapter implements PersistenceAdapter {
576
- readonly name = "memory";
577
- private storage;
578
- save(key: string, data: WorkflowPersistenceData): Promise<void>;
579
- load(key: string): Promise<WorkflowPersistenceData | null>;
580
- remove(key: string): Promise<void>;
581
- exists(key: string): Promise<boolean>;
582
- list(pattern?: string): Promise<string[]>;
583
- clear(): void;
519
+ * Validates that a value is not empty, null, or undefined
520
+ *
521
+ * @param message - Custom error message (optional)
522
+ * @returns A FieldValidator function
523
+ *
524
+ * @example
525
+ * ```typescript
526
+ * const nameValidator = required('Name is required');
527
+ * ```
528
+ */
529
+ declare function required(message?: string): FieldValidator;
530
+ /**
531
+ * Validates minimum string length
532
+ *
533
+ * @param min - Minimum length required
534
+ * @param message - Custom error message (optional)
535
+ * @returns A FieldValidator function
536
+ *
537
+ * @example
538
+ * ```typescript
539
+ * const passwordValidator = minLength(8, 'Password must be at least 8 characters');
540
+ * ```
541
+ */
542
+ declare function minLength(min: number, message?: string): FieldValidator<string>;
543
+ /**
544
+ * Validates maximum string length
545
+ *
546
+ * @param max - Maximum length allowed
547
+ * @param message - Custom error message (optional)
548
+ * @returns A FieldValidator function
549
+ *
550
+ * @example
551
+ * ```typescript
552
+ * const bioValidator = maxLength(500, 'Bio must be under 500 characters');
553
+ * ```
554
+ */
555
+ declare function maxLength(max: number, message?: string): FieldValidator<string>;
556
+ /**
557
+ * Validates that a string matches a regular expression pattern
558
+ *
559
+ * @param regex - The regular expression pattern
560
+ * @param message - Custom error message (optional)
561
+ * @returns A FieldValidator function
562
+ *
563
+ * @example
564
+ * ```typescript
565
+ * const phoneValidator = pattern(/^\d{3}-\d{3}-\d{4}$/, 'Invalid phone format');
566
+ * ```
567
+ */
568
+ declare function pattern(regex: RegExp, message?: string): FieldValidator<string>;
569
+ /**
570
+ * Email validation using a comprehensive regex pattern
571
+ *
572
+ * @param message - Custom error message (optional)
573
+ * @returns A FieldValidator function
574
+ *
575
+ * @example
576
+ * ```typescript
577
+ * const emailValidator = email('Please enter a valid email address');
578
+ * ```
579
+ */
580
+ declare function email(message?: string): FieldValidator<string>;
581
+ /**
582
+ * URL validation using a comprehensive regex pattern
583
+ *
584
+ * @param message - Custom error message (optional)
585
+ * @returns A FieldValidator function
586
+ *
587
+ * @example
588
+ * ```typescript
589
+ * const websiteValidator = url('Please enter a valid URL');
590
+ * ```
591
+ */
592
+ declare function url(message?: string): FieldValidator<string>;
593
+ /**
594
+ * Validates that a value is a valid number
595
+ *
596
+ * @param message - Custom error message (optional)
597
+ * @returns A FieldValidator function
598
+ *
599
+ * @example
600
+ * ```typescript
601
+ * const ageValidator = number('Age must be a valid number');
602
+ * ```
603
+ */
604
+ declare function number(message?: string): FieldValidator<string | number>;
605
+ /**
606
+ * Validates minimum numeric value
607
+ *
608
+ * @param minValue - Minimum value allowed
609
+ * @param message - Custom error message (optional)
610
+ * @returns A FieldValidator function
611
+ *
612
+ * @example
613
+ * ```typescript
614
+ * const ageValidator = min(18, 'Must be at least 18 years old');
615
+ * ```
616
+ */
617
+ declare function min(minValue: number, message?: string): FieldValidator<string | number>;
618
+ /**
619
+ * Validates maximum numeric value
620
+ *
621
+ * @param maxValue - Maximum value allowed
622
+ * @param message - Custom error message (optional)
623
+ * @returns A FieldValidator function
624
+ *
625
+ * @example
626
+ * ```typescript
627
+ * const scoreValidator = max(100, 'Score cannot exceed 100');
628
+ * ```
629
+ */
630
+ declare function max(maxValue: number, message?: string): FieldValidator<string | number>;
631
+ /**
632
+ * Creates a custom validator from a validation function
633
+ *
634
+ * @param validateFn - Custom validation function
635
+ * @param message - Error message for failed validation
636
+ * @param code - Optional error code
637
+ * @returns A FieldValidator function
638
+ *
639
+ * @example
640
+ * ```typescript
641
+ * const evenNumberValidator = custom(
642
+ * (value) => Number(value) % 2 === 0,
643
+ * 'Number must be even',
644
+ * 'NOT_EVEN'
645
+ * );
646
+ * ```
647
+ */
648
+ declare function custom<T>(validateFn: (value: T, context: ValidationContext) => boolean, message: string, code?: string): FieldValidator<T>;
649
+ /**
650
+ * Creates a validator that checks if a value matches another field's value
651
+ *
652
+ * @param targetFieldId - ID of the field to match against
653
+ * @param message - Custom error message (optional)
654
+ * @returns A FieldValidator function
655
+ *
656
+ * @example
657
+ * ```typescript
658
+ * const confirmPasswordValidator = matchField('password', 'Passwords must match');
659
+ * ```
660
+ */
661
+ declare function matchField(targetFieldId: string, message?: string): FieldValidator;
662
+ /**
663
+ * Creates a validator that only validates when a condition is met
664
+ *
665
+ * @param condition - Function that determines if validation should run
666
+ * @param validator - The validator to run conditionally
667
+ * @returns A FieldValidator function
668
+ *
669
+ * @example
670
+ * ```typescript
671
+ * const conditionalValidator = when(
672
+ * (value, context) => context.allFormData?.userType === 'premium',
673
+ * required('Premium users must provide this field')
674
+ * );
675
+ * ```
676
+ */
677
+ declare function when<T>(condition: (value: T, context: ValidationContext) => boolean, validator: FieldValidator<T>): FieldValidator<T>;
678
+ /**
679
+ * Creates an async custom validator from a validation function
680
+ *
681
+ * @param validateFn - Async custom validation function that returns a Promise<boolean>
682
+ * @param message - Error message for failed validation
683
+ * @param code - Optional error code
684
+ * @returns A FieldValidator function that returns a Promise
685
+ *
686
+ * @example
687
+ * ```typescript
688
+ * const checkEmailUnique = customAsync(
689
+ * async (email) => {
690
+ * const response = await fetch(`/api/check-email?email=${email}`);
691
+ * const data = await response.json();
692
+ * return data.isUnique;
693
+ * },
694
+ * 'Email address is already taken',
695
+ * 'EMAIL_NOT_UNIQUE'
696
+ * );
697
+ * ```
698
+ */
699
+ declare function async<T>(validateFn: (value: T, context: ValidationContext) => Promise<boolean>, message: string, code?: string): FieldValidator<T>;
700
+
701
+ /**
702
+ * @fileoverview Validation adapters for popular validation libraries
703
+ *
704
+ * This module provides adapters that integrate popular validation libraries
705
+ * like Zod with Rilay's validation system. Adapters convert external schemas
706
+ * into Rilay validators while maintaining type safety and error handling.
707
+ */
708
+
709
+ /**
710
+ * Generic schema interface that Zod and similar libraries implement
711
+ */
712
+ interface ZodLikeSchema<T = any> {
713
+ parse(value: unknown): T;
714
+ safeParse(value: unknown): {
715
+ success: true;
716
+ data: T;
717
+ } | {
718
+ success: false;
719
+ error: {
720
+ errors: Array<{
721
+ message: string;
722
+ path: (string | number)[];
723
+ }>;
724
+ };
725
+ };
584
726
  }
585
727
  /**
586
- * Composite adapter that can use multiple adapters with fallback
587
- * Perfect for robust persistence with primary/backup strategies
728
+ * Zod validation adapter that converts Zod schemas into Rilay validators
729
+ *
730
+ * This adapter provides seamless integration with Zod schemas, automatically
731
+ * converting Zod validation errors into Rilay ValidationError objects while
732
+ * preserving error messages and field paths.
733
+ *
734
+ * @example
735
+ * ```typescript
736
+ * import { z } from 'zod';
737
+ * import { createZodAdapter } from '@rilaykit/core';
738
+ *
739
+ * const zodAdapter = createZodAdapter();
740
+ * const emailValidator = zodAdapter.createFieldValidator(
741
+ * z.string().email('Invalid email format')
742
+ * );
743
+ * ```
588
744
  */
589
- declare class CompositeAdapter implements PersistenceAdapter {
590
- private primary;
591
- private fallbacks;
592
- readonly name = "composite";
593
- constructor(primary: PersistenceAdapter, fallbacks?: PersistenceAdapter[]);
594
- save(key: string, data: WorkflowPersistenceData): Promise<void>;
595
- load(key: string): Promise<WorkflowPersistenceData | null>;
596
- remove(key: string): Promise<void>;
597
- exists(key: string): Promise<boolean>;
598
- list(pattern?: string): Promise<string[]>;
745
+ declare class ZodValidationAdapter implements ValidationAdapter<ZodLikeSchema> {
746
+ readonly name = "ZodValidationAdapter";
747
+ readonly version = "1.0.0";
748
+ /**
749
+ * Creates a field validator from a Zod schema
750
+ *
751
+ * @param schema - The Zod schema to convert
752
+ * @returns A FieldValidator function compatible with Rilay
753
+ *
754
+ * @example
755
+ * ```typescript
756
+ * const emailSchema = z.string().email();
757
+ * const validator = adapter.createFieldValidator(emailSchema);
758
+ * ```
759
+ */
760
+ createFieldValidator<T>(schema: ZodLikeSchema<T>): FieldValidator<T>;
761
+ /**
762
+ * Creates a form validator from a Zod object schema
763
+ *
764
+ * @param schema - The Zod object schema to convert
765
+ * @returns A FormValidator function compatible with Rilay
766
+ *
767
+ * @example
768
+ * ```typescript
769
+ * const formSchema = z.object({
770
+ * email: z.string().email(),
771
+ * password: z.string().min(8)
772
+ * });
773
+ * const validator = adapter.createFormValidator(formSchema);
774
+ * ```
775
+ */
776
+ createFormValidator<T>(schema: ZodLikeSchema<T>): FormValidator<T>;
599
777
  }
600
-
601
778
  /**
602
- * Utility functions to create persistence configurations easily
779
+ * Creates a new Zod validation adapter instance
780
+ *
781
+ * @returns A configured ZodValidationAdapter instance
782
+ *
783
+ * @example
784
+ * ```typescript
785
+ * const adapter = createZodAdapter();
786
+ * ```
603
787
  */
604
- declare const persistence: {
605
- /**
606
- * Create a localStorage-based persistence configuration
607
- */
608
- localStorage(options?: Partial<PersistenceConfig>): PersistenceConfig;
609
- /**
610
- * Create a sessionStorage-based persistence configuration
611
- */
612
- sessionStorage(options?: Partial<PersistenceConfig>): PersistenceConfig;
613
- /**
614
- * Create an in-memory persistence configuration (for testing)
615
- */
616
- memory(options?: Partial<PersistenceConfig>): PersistenceConfig;
617
- /**
618
- * Create a custom persistence configuration
619
- */
620
- custom(adapter: PersistenceAdapter, options?: Partial<PersistenceConfig>): PersistenceConfig;
621
- };
788
+ declare function createZodAdapter(): ZodValidationAdapter;
789
+ /**
790
+ * Helper function to create a field validator directly from a Zod schema
791
+ *
792
+ * This is a convenience function that creates an adapter and field validator
793
+ * in a single call, useful for simple use cases.
794
+ *
795
+ * @param schema - The Zod schema to convert
796
+ * @returns A FieldValidator function
797
+ *
798
+ * @example
799
+ * ```typescript
800
+ * import { z } from 'zod';
801
+ * import { zodFieldValidator } from '@rilaykit/core';
802
+ *
803
+ * const emailValidator = zodFieldValidator(z.string().email());
804
+ * ```
805
+ */
806
+ declare function zodFieldValidator<T>(schema: ZodLikeSchema<T>): FieldValidator<T>;
622
807
  /**
623
- * Utility to create persistence configurations with retry logic
808
+ * Helper function to create a form validator directly from a Zod schema
809
+ *
810
+ * @param schema - The Zod object schema to convert
811
+ * @returns A FormValidator function
812
+ *
813
+ * @example
814
+ * ```typescript
815
+ * import { z } from 'zod';
816
+ * import { zodFormValidator } from '@rilaykit/core';
817
+ *
818
+ * const formValidator = zodFormValidator(z.object({
819
+ * email: z.string().email(),
820
+ * password: z.string().min(8)
821
+ * }));
822
+ * ```
624
823
  */
625
- declare function createResilientPersistence(primary: PersistenceAdapter, fallback?: PersistenceAdapter, options?: Partial<PersistenceConfig>): PersistenceConfig;
824
+ declare function zodFormValidator<T>(schema: ZodLikeSchema<T>): FormValidator<T>;
626
825
 
627
- export { type CompletionConfig, type ComponentConfig, type ComponentRenderProps, type ComponentRenderer, CompositeAdapter, type ConditionalConfig, type CustomStepRenderer, type DynamicStepConfig, type FieldRenderer, type FieldRendererProps, type FormBodyRenderer, type FormBodyRendererProps, type FormConfiguration, type FormFieldConfig, type FormFieldRow, type FormRenderConfig, type FormRowRenderer, type FormRowRendererProps, type FormSubmitButtonRenderer, type FormSubmitButtonRendererProps, LocalStorageAdapter, MemoryAdapter, type NavigationConfig, type PersistenceAdapter, type PersistenceConfig, type RendererChildrenFunction, type RetryPolicy, type RilayLicenseConfig, SessionStorageAdapter, type StepConditionalConfig, type StepConfig, type StepLifecycleHooks, type StepPermissions, type StepValidationConfig, type ValidationConfig, type ValidationContext, type ValidationError, type ValidationResult, type ValidatorFunction, type WorkflowAnalytics, type WorkflowConfig, type WorkflowContext, type WorkflowHooks, type WorkflowNextButtonRenderer, type WorkflowNextButtonRendererProps, type WorkflowPersistenceData, type WorkflowPlugin, type WorkflowPreviousButtonRenderer, type WorkflowPreviousButtonRendererProps, type WorkflowRenderConfig, type WorkflowSkipButtonRenderer, type WorkflowSkipButtonRendererProps, type WorkflowStepperRenderer, type WorkflowStepperRendererProps, combineValidators, commonValidators, createConditionalValidator, createCustomValidator, createResilientPersistence, createValidationError, createValidationResult, createZodValidator, persistence, resolveRendererChildren, ril };
826
+ export { type ComponentConfig, type ComponentRenderProps, type ComponentRenderer, type ComponentRendererBaseProps, ComponentRendererWrapper, type ComponentRendererWrapperProps, type CustomStepRenderer, type FieldRenderer, type FieldRendererProps, type FieldValidationConfig, type FieldValidator, type FormBodyRenderer, type FormBodyRendererProps, type FormComponentRendererProps, type FormConfiguration, type FormFieldConfig, type FormFieldRow, type FormRenderConfig, type FormRowRenderer, type FormRowRendererProps, type FormSubmitButtonRenderer, type FormSubmitButtonRendererProps, type FormValidationConfig, type FormValidator, IdGenerator, type RendererChildrenFunction, type RilayLicenseConfig, type StepConfig, type StepDataHelper, type ValidationAdapter, type ValidationContext, type ValidationError, type ValidationResult, type ValidationSchema, type WorkflowAnalytics, type WorkflowComponentRendererBaseProps, type WorkflowConfig, type WorkflowContext, type WorkflowNextButtonRenderer, type WorkflowNextButtonRendererProps, type WorkflowPlugin, type WorkflowPreviousButtonRenderer, type WorkflowPreviousButtonRendererProps, type WorkflowRenderConfig, type WorkflowSkipButtonRenderer, type WorkflowSkipButtonRendererProps, type WorkflowStepperRenderer, type WorkflowStepperRendererProps, async, combineValidationResults, configureObject, createValidationContext, createValidationResult, createZodAdapter, custom, deepClone, email, ensureUnique, matchField, max, maxLength, mergeInto, min, minLength, normalizeToArray, number, pattern, required, resolveRendererChildren, ril, runValidators, runValidatorsAsync, url, validateRequired, when, zodFieldValidator, zodFormValidator };