extended-dynamic-forms 0.1.10 → 0.1.12

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.
Files changed (53) hide show
  1. package/README.md +165 -0
  2. package/dist/ExtendedForm.d.ts +4 -0
  3. package/dist/components/arrays/ArrayFieldItemTemplate.d.ts +3 -0
  4. package/dist/components/arrays/ArrayFieldTemplate.d.ts +3 -0
  5. package/dist/components/arrays/index.d.ts +2 -0
  6. package/dist/components/fields/AddressField.d.ts +4 -0
  7. package/dist/components/fields/CurrencyField.d.ts +4 -0
  8. package/dist/components/fields/PhoneField.d.ts +4 -0
  9. package/dist/components/index.d.ts +15 -0
  10. package/dist/components/ui/badge.d.ts +9 -0
  11. package/dist/components/ui/button.d.ts +11 -0
  12. package/dist/components/ui/calendar.d.ts +8 -0
  13. package/dist/components/ui/card.d.ts +8 -0
  14. package/dist/components/ui/checkbox.d.ts +4 -0
  15. package/dist/components/ui/date-picker.d.ts +13 -0
  16. package/dist/components/ui/input.d.ts +5 -0
  17. package/dist/components/ui/label.d.ts +5 -0
  18. package/dist/components/ui/popover.d.ts +6 -0
  19. package/dist/components/ui/select.d.ts +13 -0
  20. package/dist/components/ui/slider.d.ts +4 -0
  21. package/dist/components/ui/textarea.d.ts +5 -0
  22. package/dist/conditionals/ConditionalForm.d.ts +7 -0
  23. package/dist/conditionals/index.d.ts +3 -0
  24. package/dist/conditionals/types.d.ts +65 -0
  25. package/dist/conditionals/utils.d.ts +18 -0
  26. package/dist/events/FormEventContext.d.ts +20 -0
  27. package/dist/events/FormEventHub.d.ts +27 -0
  28. package/dist/events/FormEventManager.d.ts +10 -0
  29. package/dist/events/index.d.ts +4 -0
  30. package/dist/index.d.ts +15 -0
  31. package/dist/index.es.js +15350 -0
  32. package/dist/index.umd.js +113 -0
  33. package/dist/layouts/grid/GridLayout.d.ts +11 -0
  34. package/dist/layouts/horizontal/HorizontalLayout.d.ts +10 -0
  35. package/dist/layouts/index.d.ts +3 -0
  36. package/dist/layouts/vertical/VerticalLayout.d.ts +9 -0
  37. package/dist/lib/utils.d.ts +3 -0
  38. package/dist/style.css +1 -0
  39. package/dist/types/index.d.ts +47 -0
  40. package/dist/utils/formDataUtils.d.ts +22 -0
  41. package/dist/utils/index.d.ts +3 -0
  42. package/dist/utils/schemaUtils.d.ts +24 -0
  43. package/dist/utils/validationUtils.d.ts +26 -0
  44. package/dist/vanilla-wrapper.d.ts +35 -0
  45. package/dist/widgets/date/DateWidget.d.ts +4 -0
  46. package/dist/widgets/enhanced/EnhancedWidgets.d.ts +36 -0
  47. package/dist/widgets/file/FileWidget.d.ts +4 -0
  48. package/dist/widgets/index.d.ts +33 -0
  49. package/dist/widgets/input/ColorWidget.d.ts +4 -0
  50. package/dist/widgets/input/RangeWidget.d.ts +4 -0
  51. package/dist/widgets/input/RatingWidget.d.ts +4 -0
  52. package/package.json +6 -2
  53. package/dist/extended-dynamic-forms-vanilla.js +0 -38
package/README.md CHANGED
@@ -11,6 +11,7 @@ A comprehensive extension of React JSON Schema Form (RJSF) v5 with shadcn/ui com
11
11
  - 🎯 **Central Event Orchestration**: Unified system capturing all form field events (focus, blur, change)
12
12
  - 🔗 **Webhook Integration**: Configure multiple webhook endpoints with debouncing and retry logic
13
13
  - 🔧 **Enhanced Form Events**: Before/after submit and validation hooks plus field-level events
14
+ - 🚀 **Conditional Logic**: Show/hide fields, make fields required/optional based on complex conditions
14
15
  - 📦 **TypeScript Support**: Fully typed with comprehensive type definitions
15
16
  - ⚡ **Vite Powered**: Fast development and optimized builds
16
17
  - 🎯 **Tailwind CSS**: Utility-first styling with full customization
@@ -518,6 +519,137 @@ const webhooks: WebhookConfig[] = [
518
519
  />
519
520
  ```
520
521
 
522
+ ## Conditional Forms
523
+
524
+ Extended Dynamic Forms includes powerful conditional logic capabilities that allow you to:
525
+ - Show/hide fields based on other field values
526
+ - Make fields required/optional conditionally
527
+ - Enable/disable fields based on complex conditions
528
+ - Support multiple conditions with AND/OR logic
529
+
530
+ ### Basic Conditional Example
531
+
532
+ ```tsx
533
+ import { ConditionalForm, ConditionalRule } from 'extended-dynamic-forms';
534
+
535
+ const schema = {
536
+ type: 'object',
537
+ properties: {
538
+ accountType: {
539
+ type: 'string',
540
+ enum: ['personal', 'business'],
541
+ title: 'Account Type'
542
+ },
543
+ firstName: { type: 'string', title: 'First Name' },
544
+ lastName: { type: 'string', title: 'Last Name' },
545
+ businessName: { type: 'string', title: 'Business Name' },
546
+ taxId: { type: 'string', title: 'Tax ID' }
547
+ }
548
+ };
549
+
550
+ const conditionalRules: ConditionalRule[] = [
551
+ {
552
+ conditions: {
553
+ accountType: { equals: 'personal' }
554
+ },
555
+ event: {
556
+ type: 'show',
557
+ params: { fields: ['firstName', 'lastName'] }
558
+ }
559
+ },
560
+ {
561
+ conditions: {
562
+ accountType: { equals: 'business' }
563
+ },
564
+ event: {
565
+ type: 'show',
566
+ params: { fields: ['businessName', 'taxId'] }
567
+ }
568
+ }
569
+ ];
570
+
571
+ <ConditionalForm
572
+ schema={schema}
573
+ conditionalRules={conditionalRules}
574
+ onSubmit={handleSubmit}
575
+ />
576
+ ```
577
+
578
+ ### Complex Conditions
579
+
580
+ ```tsx
581
+ const complexRules: ConditionalRule[] = [
582
+ {
583
+ // Show state field when country is US AND has address
584
+ conditions: {
585
+ all: [
586
+ { country: { equals: 'US' } },
587
+ { hasAddress: { equals: true } }
588
+ ]
589
+ },
590
+ event: {
591
+ type: 'show',
592
+ params: { fields: ['state', 'zipCode'] }
593
+ }
594
+ },
595
+ {
596
+ // Show verification for high income personal OR business accounts
597
+ conditions: {
598
+ any: [
599
+ {
600
+ all: [
601
+ { accountType: { equals: 'personal' } },
602
+ { income: { greaterThan: 100000 } }
603
+ ]
604
+ },
605
+ {
606
+ accountType: { equals: 'business' }
607
+ }
608
+ ]
609
+ },
610
+ event: {
611
+ type: 'require',
612
+ params: { fields: ['verificationDocument'] }
613
+ }
614
+ }
615
+ ];
616
+ ```
617
+
618
+ ### Available Conditions
619
+
620
+ - `equals` / `notEquals` - Exact value matching
621
+ - `greaterThan` / `lessThan` - Numeric comparisons
622
+ - `greaterThanOrEqual` / `lessThanOrEqual` - Inclusive numeric comparisons
623
+ - `contains` / `notContains` - String contains
624
+ - `in` / `notIn` - Value in array
625
+ - `empty` / `notEmpty` - Check if field has value
626
+
627
+ ### Available Events
628
+
629
+ - `show` / `hide` - Control field visibility
630
+ - `require` / `unrequire` - Make fields required/optional
631
+ - `enable` / `disable` - Enable/disable fields
632
+
633
+ ### Combining with Webhooks
634
+
635
+ ```tsx
636
+ <ConditionalForm
637
+ schema={schema}
638
+ conditionalRules={rules}
639
+ webhooks={[
640
+ {
641
+ url: 'https://api.example.com/validate',
642
+ events: ['change'],
643
+ debounceMs: 500
644
+ }
645
+ ]}
646
+ onFieldChange={(event) => {
647
+ // Local handling alongside conditional logic
648
+ console.log('Field changed:', event);
649
+ }}
650
+ />
651
+ ```
652
+
521
653
  ## API Reference
522
654
 
523
655
  ### ExtendedFormProps
@@ -575,6 +707,39 @@ interface WebhookConfig {
575
707
  }
576
708
  ```
577
709
 
710
+ ### ConditionalRule
711
+
712
+ ```typescript
713
+ interface ConditionalRule {
714
+ conditions: {
715
+ [fieldPath: string]: FieldCondition;
716
+ all?: Array<{ [fieldPath: string]: FieldCondition }>;
717
+ any?: Array<{ [fieldPath: string]: FieldCondition }>;
718
+ };
719
+ event: {
720
+ type: 'show' | 'hide' | 'require' | 'unrequire' | 'disable' | 'enable';
721
+ params: {
722
+ fields: string[];
723
+ };
724
+ };
725
+ }
726
+
727
+ interface FieldCondition {
728
+ equals?: any;
729
+ notEquals?: any;
730
+ greaterThan?: number;
731
+ lessThan?: number;
732
+ greaterThanOrEqual?: number;
733
+ lessThanOrEqual?: number;
734
+ contains?: string;
735
+ notContains?: string;
736
+ in?: any[];
737
+ notIn?: any[];
738
+ empty?: boolean;
739
+ notEmpty?: boolean;
740
+ }
741
+ ```
742
+
578
743
  ## Utility Functions
579
744
 
580
745
  ```tsx
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { ExtendedFormProps } from './types';
3
+
4
+ export declare const ExtendedForm: React.FC<ExtendedFormProps>;
@@ -0,0 +1,3 @@
1
+ import { ArrayFieldItemTemplateType } from '@rjsf/utils';
2
+
3
+ export declare const ArrayFieldItemTemplate: (props: ArrayFieldItemTemplateType) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { ArrayFieldTemplateProps } from '@rjsf/utils';
2
+
3
+ export declare const ArrayFieldTemplate: (props: ArrayFieldTemplateProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { ArrayFieldTemplate } from './ArrayFieldTemplate';
2
+ export { ArrayFieldItemTemplate } from './ArrayFieldItemTemplate';
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { FieldProps } from '@rjsf/utils';
3
+
4
+ export declare const AddressField: React.FC<FieldProps>;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { FieldProps } from '@rjsf/utils';
3
+
4
+ export declare const CurrencyField: React.FC<FieldProps>;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { FieldProps } from '@rjsf/utils';
3
+
4
+ export declare const PhoneField: React.FC<FieldProps>;
@@ -0,0 +1,15 @@
1
+ import { AddressField } from './fields/AddressField';
2
+ import { PhoneField } from './fields/PhoneField';
3
+ import { CurrencyField } from './fields/CurrencyField';
4
+ import { ArrayFieldTemplate, ArrayFieldItemTemplate } from './arrays';
5
+
6
+ export declare const customFields: {
7
+ address: import('react').FC<import('@rjsf/utils').FieldProps<any, import('@rjsf/utils').RJSFSchema, any>>;
8
+ phone: import('react').FC<import('@rjsf/utils').FieldProps<any, import('@rjsf/utils').RJSFSchema, any>>;
9
+ currency: import('react').FC<import('@rjsf/utils').FieldProps<any, import('@rjsf/utils').RJSFSchema, any>>;
10
+ };
11
+ export declare const customTemplates: {
12
+ ArrayFieldTemplate: (props: import('@rjsf/utils').ArrayFieldTemplateProps) => import("react/jsx-runtime").JSX.Element;
13
+ ArrayFieldItemTemplate: (props: import('@rjsf/utils').ArrayFieldItemTemplateType) => import("react/jsx-runtime").JSX.Element;
14
+ };
15
+ export { AddressField, PhoneField, CurrencyField, ArrayFieldTemplate, ArrayFieldItemTemplate, };
@@ -0,0 +1,9 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ declare const badgeVariants: (props?: ({
4
+ variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
5
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
+ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
7
+ }
8
+ declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
9
+ export { Badge, badgeVariants };
@@ -0,0 +1,11 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export { Button, buttonVariants };
@@ -0,0 +1,8 @@
1
+ import { DayPicker } from 'react-day-picker';
2
+ import * as React from "react";
3
+ export type CalendarProps = React.ComponentProps<typeof DayPicker>;
4
+ declare function Calendar({ className, classNames, showOutsideDays, ...props }: CalendarProps): import("react/jsx-runtime").JSX.Element;
5
+ declare namespace Calendar {
6
+ var displayName: string;
7
+ }
8
+ export { Calendar };
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
4
+ declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
5
+ declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
6
+ declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
+ declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
+ export { Checkbox };
@@ -0,0 +1,13 @@
1
+ interface DatePickerProps {
2
+ id?: string;
3
+ value?: string;
4
+ placeholder?: string;
5
+ disabled?: boolean;
6
+ onChange?: (value: string) => void;
7
+ onBlur?: () => void;
8
+ onFocus?: () => void;
9
+ className?: string;
10
+ "aria-invalid"?: boolean;
11
+ }
12
+ export declare function DatePicker({ id, value, placeholder, disabled, onChange, onBlur, onFocus, className, "aria-invalid": ariaInvalid, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ }
4
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
5
+ export { Input };
@@ -0,0 +1,5 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import * as React from "react";
3
+ import * as LabelPrimitive from "@radix-ui/react-label";
4
+ declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import('class-variance-authority/types').ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
5
+ export { Label };
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
3
+ declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
4
+ declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
+ export { Popover, PopoverTrigger, PopoverContent };
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import * as SelectPrimitive from "@radix-ui/react-select";
3
+ declare const Select: React.FC<SelectPrimitive.SelectProps>;
4
+ declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
5
+ declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
6
+ declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
+ declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
+ declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
+ export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import * as SliderPrimitive from "@radix-ui/react-slider";
3
+ declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
4
+ export { Slider };
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
3
+ }
4
+ declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
5
+ export { Textarea };
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { ConditionalFormProps } from './types';
3
+
4
+ /**
5
+ * Conditional form using json-rules-engine
6
+ */
7
+ export declare const ConditionalForm: React.FC<ConditionalFormProps>;
@@ -0,0 +1,3 @@
1
+ export { ConditionalForm } from './ConditionalForm';
2
+ export * from './types';
3
+ export * from './utils';
@@ -0,0 +1,65 @@
1
+ import { ExtendedFormProps } from '../types';
2
+
3
+ export type ConditionOperator = 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'contains' | 'notContains' | 'in' | 'notIn' | 'empty' | 'notEmpty';
4
+ export interface FieldCondition {
5
+ equals?: any;
6
+ notEquals?: any;
7
+ greaterThan?: number;
8
+ lessThan?: number;
9
+ greaterThanOrEqual?: number;
10
+ lessThanOrEqual?: number;
11
+ contains?: string;
12
+ notContains?: string;
13
+ in?: any[];
14
+ notIn?: any[];
15
+ empty?: boolean;
16
+ notEmpty?: boolean;
17
+ }
18
+ export interface ConditionalRule {
19
+ conditions: {
20
+ [fieldPath: string]: FieldCondition;
21
+ } & {
22
+ all?: Array<{
23
+ [fieldPath: string]: FieldCondition;
24
+ }>;
25
+ any?: Array<{
26
+ [fieldPath: string]: FieldCondition;
27
+ }>;
28
+ };
29
+ event: {
30
+ type: 'show' | 'hide' | 'require' | 'unrequire' | 'disable' | 'enable';
31
+ params: {
32
+ fields: string[];
33
+ };
34
+ };
35
+ }
36
+ export interface ConditionalFormProps extends ExtendedFormProps {
37
+ conditionalRules: ConditionalRule[];
38
+ debug?: boolean;
39
+ }
40
+ export interface RuleEngineEvent {
41
+ type: string;
42
+ params: any;
43
+ }
44
+ export interface RuleEngineCondition {
45
+ fact: string;
46
+ operator: string;
47
+ value: any;
48
+ }
49
+ export interface RuleEngineRule {
50
+ conditions: {
51
+ all?: RuleEngineCondition[];
52
+ any?: RuleEngineCondition[];
53
+ };
54
+ event: RuleEngineEvent;
55
+ }
56
+ export interface ConditionalState {
57
+ hiddenFields: Set<string>;
58
+ disabledFields: Set<string>;
59
+ requiredFields: Set<string>;
60
+ }
61
+ export interface ConditionalContext {
62
+ state: ConditionalState;
63
+ updateState: (updates: Partial<ConditionalState>) => void;
64
+ evaluateRules: (formData: any) => void;
65
+ }
@@ -0,0 +1,18 @@
1
+ import { RJSFSchema, UiSchema } from '@rjsf/utils';
2
+ import { ConditionalRule, ConditionalState } from './types';
3
+
4
+ /**
5
+ * Convert our conditional rules to json-rules-engine format
6
+ */
7
+ export declare function convertToEngineRules(rules: ConditionalRule[]): any[];
8
+ /**
9
+ * Apply conditional state to schema
10
+ */
11
+ export declare function applyConditionalState(schema: RJSFSchema, uiSchema: UiSchema, state: ConditionalState): {
12
+ schema: RJSFSchema;
13
+ uiSchema: UiSchema;
14
+ };
15
+ /**
16
+ * Extract field value from form data using field path
17
+ */
18
+ export declare function getFieldValue(formData: any, fieldPath: string): any;
@@ -0,0 +1,20 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { FormEventHub } from './FormEventHub';
3
+
4
+ interface FormEventContextType {
5
+ eventHub: FormEventHub;
6
+ formData?: any;
7
+ }
8
+ interface FormEventProviderProps {
9
+ eventHub: FormEventHub;
10
+ formData?: any;
11
+ children: ReactNode;
12
+ }
13
+ export declare const FormEventProvider: React.FC<FormEventProviderProps>;
14
+ export declare const useFormEventHub: () => FormEventContextType;
15
+ export declare const useFieldEventHandlers: (fieldId: string, schema?: any, fieldPath?: string[]) => {
16
+ onFocus: (value: any) => Promise<void>;
17
+ onBlur: (value: any) => Promise<void>;
18
+ onChange: (value: any) => Promise<void>;
19
+ };
20
+ export {};
@@ -0,0 +1,27 @@
1
+ import { FormEventHandlers, FieldEventHandlers, WebhookConfig } from '../types';
2
+
3
+ export declare class FormEventHub {
4
+ private formHandlers;
5
+ private fieldHandlers;
6
+ private webhooks;
7
+ private debounceTimers;
8
+ private webhookQueue;
9
+ private isProcessingQueue;
10
+ constructor(formHandlers: FormEventHandlers, fieldHandlers?: FieldEventHandlers, webhooks?: WebhookConfig[]);
11
+ handleBeforeSubmit(data: any): Promise<any>;
12
+ handleAfterSubmit(data: any): Promise<void>;
13
+ handleBeforeValidation(data: any): Promise<any>;
14
+ handleAfterValidation(data: any, errors: any): Promise<void>;
15
+ handleFieldEvent(eventType: 'focus' | 'blur' | 'change', fieldId: string, fieldValue: any, schema?: any, formData?: any, fieldPath?: string[]): Promise<void>;
16
+ private processWebhooks;
17
+ private debounceWebhook;
18
+ private queueWebhook;
19
+ private processWebhookQueue;
20
+ private callWebhook;
21
+ createFieldEventHandlers(fieldId: string, schema?: any, formData?: any, fieldPath?: string[]): {
22
+ onFocus: (value: any) => Promise<void>;
23
+ onBlur: (value: any) => Promise<void>;
24
+ onChange: (value: any) => Promise<void>;
25
+ };
26
+ cleanup(): void;
27
+ }
@@ -0,0 +1,10 @@
1
+ import { FormEventHandlers } from '../types';
2
+
3
+ export declare class FormEventManager {
4
+ private handlers;
5
+ constructor(handlers: FormEventHandlers);
6
+ handleBeforeSubmit(data: any): Promise<any>;
7
+ handleAfterSubmit(data: any): Promise<void>;
8
+ handleBeforeValidation(data: any): Promise<any>;
9
+ handleAfterValidation(data: any, errors: any): Promise<void>;
10
+ }
@@ -0,0 +1,4 @@
1
+ export { FormEventManager } from './FormEventManager';
2
+ export { FormEventHub } from './FormEventHub';
3
+ export { FormEventProvider, useFormEventHub, useFieldEventHandlers } from './FormEventContext';
4
+ export type { FormEventHandlers, FieldEventHandlers, FormFieldEvent, WebhookConfig } from '../types';
@@ -0,0 +1,15 @@
1
+
2
+ export * from './components';
3
+ export * from './widgets';
4
+ export * from './layouts';
5
+ export * from './events';
6
+ export * from './types';
7
+ export * from './utils';
8
+ export * from './lib/utils';
9
+ export type { FormProps, IChangeEvent } from '@rjsf/core';
10
+ export type { RJSFSchema, UiSchema, WidgetProps, FieldProps, ArrayFieldTemplateProps, ObjectFieldTemplateProps, FieldTemplateProps, ErrorSchema, RJSFValidationError } from '@rjsf/utils';
11
+ export { default as validator } from '@rjsf/validator-ajv8';
12
+ export { generateTheme } from '@rjsf/shadcn';
13
+ export { ExtendedForm } from './ExtendedForm';
14
+ export { ConditionalForm } from './conditionals';
15
+ export type { ConditionalFormProps, ConditionalRule, FieldCondition, ConditionalState } from './conditionals/types';