@digiform/wizard 0.3.1 โ†’ 0.3.3

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 (54) hide show
  1. package/features/form-runtime/components/FormFooter.d.ts +5 -0
  2. package/features/form-runtime/hooks/useValidationEvents.d.ts +0 -1
  3. package/features/form-runtime/index.d.ts +0 -1
  4. package/features/state-management/machines/formMachine.d.ts +3 -0
  5. package/features/state-management/machines/types.d.ts +4 -0
  6. package/features/state-management/machines/useFormMachine.d.ts +24 -6
  7. package/package.json +31 -15
  8. package/styles.css +1 -1
  9. package/ui/src/lib/types/guards.js +1 -5
  10. package/wizard/src/features/api-integration/services/ApiCallService.js +65 -74
  11. package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +39 -43
  12. package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +37 -41
  13. package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +44 -45
  14. package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +48 -95
  15. package/wizard/src/features/form-runtime/FormWizard/FormWizard.module.css.js +4 -12
  16. package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
  17. package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +150 -194
  18. package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +92 -108
  19. package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
  20. package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +44 -63
  21. package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +26 -40
  22. package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
  23. package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +26 -37
  24. package/wizard/src/features/form-runtime/utils/logger.js +12 -12
  25. package/wizard/src/features/state-management/machines/actions/navigationActions.js +13 -8
  26. package/wizard/src/features/state-management/machines/componentTriggerEngine.js +167 -432
  27. package/wizard/src/features/state-management/machines/formMachine.js +558 -677
  28. package/wizard/src/features/state-management/machines/useFormMachine.js +173 -191
  29. package/wizard/src/features/trigger-action-system/components/ActionManager.js +35 -86
  30. package/wizard/src/features/validation-system/validation/SchemaBuilder.js +28 -82
  31. package/wizard/src/features/validation-system/validation/ValidationCache.js +11 -27
  32. package/wizard/src/features/validation-system/validation/ValidationExecutor.js +47 -87
  33. package/core/src/types/guards.js +0 -7
  34. package/features/form-runtime/config/configResolver.d.ts +0 -14
  35. package/features/form-runtime/config/index.d.ts +0 -9
  36. package/features/form-runtime/config/templateConfig.d.ts +0 -148
  37. package/features/form-runtime/config/templateLoader.d.ts +0 -25
  38. package/features/form-runtime/config/templateUtils.d.ts +0 -12
  39. package/features/form-runtime/utils/formSaver.d.ts +0 -22
  40. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +0 -9
  41. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  42. package/features/state-management/machines/__tests__/vitest.config.d.ts +0 -2
  43. package/features/state-management/machines/actions/validationActions.d.ts +0 -68
  44. package/features/state-management/machines/lazyLoading.d.ts +0 -34
  45. package/features/state-management/machines/validation/index.d.ts +0 -5
  46. package/features/state-management/machines/validation/validateField.d.ts +0 -2
  47. package/features/state-management/machines/validation/validateForm.d.ts +0 -2
  48. package/features/state-management/machines/validation/validateSection.d.ts +0 -2
  49. package/features/state-management/machines/validation/validateStep.d.ts +0 -2
  50. package/features/state-management/machines/validation/validationTypes.d.ts +0 -1
  51. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
  52. package/ui/src/lib/utils/templateUtils.js +0 -20
  53. package/wizard/src/features/form-runtime/config/configResolver.js +0 -34
  54. package/wizard/src/features/form-runtime/config/templateLoader.js +0 -235
@@ -1,50 +1,39 @@
1
1
  "use client";
2
- function n(u, f = {}) {
3
- const t = u, { updatedFields: a, debug: r = !1 } = f;
4
- r && console.log("๐Ÿ”„ [formDirtyStateSync] Starting dirty state reset:", {
5
- updatedFields: a,
6
- formState: {
7
- isDirty: t.state.isDirty,
8
- dirtyFields: t.state.dirtyFields,
9
- values: t.state.values
10
- }
11
- });
2
+ function n(a, u = {}) {
3
+ const e = a, { updatedFields: c, debug: o = !1 } = u;
12
4
  try {
13
- const i = Object.keys(t.state.values), c = a || i;
14
- r && console.log("๐Ÿ”„ [formDirtyStateSync] Fields to reset:", c), c.forEach((e) => {
15
- const s = t.getFieldValue(e), o = t.getFieldMeta(e);
16
- if (r && console.log(`๐Ÿ”„ [formDirtyStateSync] Resetting field ${e}:`, {
17
- currentValue: s,
18
- isDirtyBefore: o?.isDirty,
19
- isTouchedBefore: o?.isTouched,
20
- isDefaultValueBefore: o?.isDefaultValue
21
- }), t.resetField(e), s != null && s !== "" && t.setFieldValue(e, s, {
5
+ const s = Object.keys(e.state.values);
6
+ (c || s).forEach((t) => {
7
+ const r = e.getFieldValue(t), i = e.getFieldMeta(t);
8
+ if (o && console.log(`[formDirtyStateSync] Field ${t} before reset:`, {
9
+ currentValue: r,
10
+ isDirtyBefore: i?.isDirty,
11
+ isTouchedBefore: i?.isTouched,
12
+ isDefaultValueBefore: i?.isDefaultValue
13
+ }), e.resetField(t), r != null && r !== "" && e.setFieldValue(t, r, {
22
14
  dontUpdateMeta: !0
23
15
  // This prevents updating isDirty/isTouched flags
24
- }), r) {
25
- const l = t.getFieldMeta(e);
26
- console.log(
27
- `โœ… [formDirtyStateSync] Field ${e} reset complete:`,
28
- {
29
- isDirtyAfter: l?.isDirty,
30
- isTouchedAfter: l?.isTouched,
31
- isDefaultValueAfter: l?.isDefaultValue,
32
- currentValueAfter: t.getFieldValue(e)
33
- }
34
- );
16
+ }), o) {
17
+ const l = e.getFieldMeta(t);
18
+ console.log(`[formDirtyStateSync] Field ${t} reset complete:`, {
19
+ isDirtyAfter: l?.isDirty,
20
+ isTouchedAfter: l?.isTouched,
21
+ isDefaultValueAfter: l?.isDefaultValue,
22
+ currentValueAfter: e.getFieldValue(t)
23
+ });
35
24
  }
36
- }), r && console.log("โœ… [formDirtyStateSync] Dirty state reset complete:", {
25
+ }), o && console.log("[formDirtyStateSync] Reset complete:", {
37
26
  formStateAfter: {
38
- isDirty: t.state.isDirty,
39
- dirtyFields: t.state.dirtyFields,
40
- values: t.state.values
27
+ isDirty: e.state.isDirty,
28
+ dirtyFields: e.state.dirtyFields,
29
+ values: e.state.values
41
30
  }
42
31
  });
43
- } catch (i) {
32
+ } catch (s) {
44
33
  throw console.error(
45
34
  "โŒ [formDirtyStateSync] Error during dirty state reset:",
46
- i
47
- ), i;
35
+ s
36
+ ), s;
48
37
  }
49
38
  }
50
39
  export {
@@ -39,13 +39,13 @@ class n {
39
39
  * Debug level logging
40
40
  */
41
41
  debug(e, o) {
42
- this.config.enabled && console.log(`๐Ÿ”ง [FormField] ${e}`, o);
42
+ this.config.enabled && console.log(`[FormField] ${e}`, ...o !== void 0 ? [o] : []);
43
43
  }
44
44
  /**
45
45
  * Info level logging
46
46
  */
47
47
  info(e, o) {
48
- this.config.enabled && console.log(`โ„น๏ธ [FormField] ${e}`, o);
48
+ this.config.enabled && console.log(`[FormField] ${e}`, ...o !== void 0 ? [o] : []);
49
49
  }
50
50
  /**
51
51
  * Warning level logging
@@ -69,43 +69,43 @@ class n {
69
69
  * Validation specific logging
70
70
  */
71
71
  validation(e, o) {
72
- this.config.enabled && console.log(`๐Ÿ” [FormField] ${e}`, o);
72
+ this.config.enabled && console.log(`[FormField:validation] ${e}`, ...o !== void 0 ? [o] : []);
73
73
  }
74
74
  /**
75
75
  * State management specific logging
76
76
  */
77
77
  state(e, o) {
78
- this.config.enabled && console.log(`๐Ÿ“‹ [FormField] ${e}`, o);
78
+ this.config.enabled && console.log(`[FormField:state] ${e}`, ...o !== void 0 ? [o] : []);
79
79
  }
80
80
  /**
81
81
  * Component lifecycle logging
82
82
  */
83
83
  lifecycle(e, o) {
84
- this.config.enabled && console.log(`๐Ÿ [FormField] ${e}`, o);
84
+ this.config.enabled && console.log(`[FormField:lifecycle] ${e}`, ...o !== void 0 ? [o] : []);
85
85
  }
86
86
  /**
87
87
  * Change event logging
88
88
  */
89
89
  change(e, o) {
90
- this.config.enabled && console.log(`๐Ÿ”„ [FormField] ${e}`, o);
90
+ this.config.enabled && console.log(`[FormField:change] ${e}`, ...o !== void 0 ? [o] : []);
91
91
  }
92
92
  /**
93
93
  * Test/experimental logging
94
94
  */
95
95
  test(e, o) {
96
- this.config.enabled && console.log(`๐Ÿงช [FormField] ${e}`, o);
96
+ this.config.enabled && console.log(`[FormField:test] ${e}`, ...o !== void 0 ? [o] : []);
97
97
  }
98
98
  }
99
- const i = new n(), l = () => i.setEnabled(!0), t = () => i.setEnabled(!1), d = () => i.isEnabled();
99
+ const i = new n(), l = () => i.setEnabled(!0), d = () => i.setEnabled(!1), t = () => i.isEnabled();
100
100
  typeof window < "u" && (window.formFieldLogger = {
101
101
  enable: l,
102
- disable: t,
103
- isEnabled: d,
102
+ disable: d,
103
+ isEnabled: t,
104
104
  logger: i
105
105
  });
106
106
  export {
107
- t as disableFormFieldLogging,
107
+ d as disableFormFieldLogging,
108
108
  l as enableFormFieldLogging,
109
- d as isFormFieldLoggingEnabled,
109
+ t as isFormFieldLoggingEnabled,
110
110
  i as logger
111
111
  };
@@ -12,7 +12,8 @@ t({
12
12
  );
13
13
  return e.config.steps[n]?.id || "";
14
14
  },
15
- pendingNavigation: null
15
+ pendingNavigation: null,
16
+ forcedValidationFields: []
16
17
  });
17
18
  t({
18
19
  currentStepIndex: ({ context: e }) => Math.max(e.currentStepIndex - 1, 0),
@@ -20,18 +21,20 @@ t({
20
21
  const n = Math.max(e.currentStepIndex - 1, 0);
21
22
  return e.config.steps[n]?.id || "";
22
23
  },
23
- pendingNavigation: null
24
+ pendingNavigation: null,
25
+ forcedValidationFields: []
24
26
  });
25
27
  t({
26
28
  currentStepIndex: ({ context: e, event: n }) => {
27
29
  if (n.type !== "GO_TO_STEP") return e.currentStepIndex;
28
30
  const i = e.config.steps.findIndex(
29
- (r) => r.id === n.stepId
31
+ (a) => a.id === n.stepId
30
32
  );
31
33
  return i >= 0 ? i : e.currentStepIndex;
32
34
  },
33
35
  currentStepId: ({ context: e, event: n }) => n.type !== "GO_TO_STEP" ? e.currentStepId : n.stepId,
34
- pendingNavigation: null
36
+ pendingNavigation: null,
37
+ forcedValidationFields: []
35
38
  });
36
39
  t({
37
40
  currentStepIndex: ({ context: e }) => {
@@ -42,7 +45,8 @@ t({
42
45
  },
43
46
  currentStepId: ({ context: e }) => e.pendingNavigation?.stepId || e.currentStepId,
44
47
  pendingNavigation: null,
45
- canNavigate: !0
48
+ canNavigate: !0,
49
+ forcedValidationFields: []
46
50
  });
47
51
  t({
48
52
  pendingNavigation: { type: "next" }
@@ -95,9 +99,10 @@ t({
95
99
  activeWarnings: [],
96
100
  pendingVerifications: [],
97
101
  verificationResults: {}
98
- }
102
+ },
103
+ forcedValidationFields: []
99
104
  });
100
- const p = ({
105
+ const d = ({
101
106
  context: e,
102
107
  self: n
103
108
  }) => {
@@ -118,5 +123,5 @@ const p = ({
118
123
  }
119
124
  };
120
125
  export {
121
- p as executePendingNavigation
126
+ d as executePendingNavigation
122
127
  };