@digiform/wizard 0.3.0 → 0.3.2

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 (89) hide show
  1. package/core/src/types/guards.js +0 -12
  2. package/core/src/utils/apiBodyUtils.js +43 -75
  3. package/features/form-runtime/components/FormFooter.d.ts +5 -0
  4. package/features/form-runtime/hooks/useValidationEvents.d.ts +0 -1
  5. package/features/state-management/machines/formMachine.d.ts +3 -0
  6. package/features/state-management/machines/types.d.ts +4 -0
  7. package/features/state-management/machines/useFormMachine.d.ts +18 -0
  8. package/index.d.ts +2 -8
  9. package/index.js +2 -108
  10. package/package.json +1 -30
  11. package/styles.css +1 -1
  12. package/ui/src/lib/utils/templateUtils.js +11 -43
  13. package/wizard/src/features/api-integration/services/ApiCallService.js +65 -74
  14. package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +39 -43
  15. package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +37 -41
  16. package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +44 -45
  17. package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +56 -78
  18. package/wizard/src/features/form-runtime/components/FormField.js +28 -28
  19. package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
  20. package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +152 -196
  21. package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +82 -91
  22. package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
  23. package/wizard/src/features/form-runtime/config/configResolver.js +10 -14
  24. package/wizard/src/features/form-runtime/config/templateLoader.js +71 -108
  25. package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +45 -88
  26. package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +27 -41
  27. package/wizard/src/features/form-runtime/hooks/useFormFieldState.js +5 -5
  28. package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
  29. package/wizard/src/features/form-runtime/utils/errorUtils.js +31 -42
  30. package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +26 -37
  31. package/wizard/src/features/form-runtime/utils/logger.js +12 -12
  32. package/wizard/src/features/form-runtime/utils/validationUX.js +14 -55
  33. package/wizard/src/features/state-management/machines/actions/navigationActions.js +13 -8
  34. package/wizard/src/features/state-management/machines/componentTriggerEngine.js +167 -432
  35. package/wizard/src/features/state-management/machines/formMachine.js +558 -677
  36. package/wizard/src/features/state-management/machines/useFormMachine.js +172 -190
  37. package/wizard/src/features/trigger-action-system/components/ActionManager.js +35 -86
  38. package/wizard/src/features/validation-system/validation/SchemaBuilder.js +28 -82
  39. package/wizard/src/features/validation-system/validation/ValidationCache.js +11 -27
  40. package/wizard/src/features/validation-system/validation/ValidationEngine.js +24 -29
  41. package/wizard/src/features/validation-system/validation/ValidationExecutor.js +26 -58
  42. package/FormWizard.d.ts +0 -10
  43. package/core/src/types/api.js +0 -12
  44. package/core/src/types/form-config.js +0 -60
  45. package/core/src/types/form-wizard-config-schema.js +0 -113
  46. package/core/src/types/validation.js +0 -61
  47. package/features/api-integration.d.ts +0 -2
  48. package/features/api-integration.js +0 -17
  49. package/features/dialog-system.d.ts +0 -2
  50. package/features/dialog-system.js +0 -9
  51. package/features/form-runtime/utils/formSaver.d.ts +0 -22
  52. package/features/form-runtime.d.ts +0 -2
  53. package/features/form-runtime.js +0 -63
  54. package/features/index.d.ts +0 -11
  55. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +0 -9
  56. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  57. package/features/state-management/machines/__tests__/vitest.config.d.ts +0 -2
  58. package/features/state-management/machines/actions/validationActions.d.ts +0 -68
  59. package/features/state-management/machines/lazyLoading.d.ts +0 -34
  60. package/features/state-management/machines/validation/index.d.ts +0 -5
  61. package/features/state-management/machines/validation/validateField.d.ts +0 -2
  62. package/features/state-management/machines/validation/validateForm.d.ts +0 -2
  63. package/features/state-management/machines/validation/validateSection.d.ts +0 -2
  64. package/features/state-management/machines/validation/validateStep.d.ts +0 -2
  65. package/features/state-management/machines/validation/validationTypes.d.ts +0 -1
  66. package/features/state-management.d.ts +0 -2
  67. package/features/state-management.js +0 -21
  68. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
  69. package/features/trigger-action-system.d.ts +0 -2
  70. package/features/trigger-action-system.js +0 -12
  71. package/features/validation-system.d.ts +0 -2
  72. package/features/validation-system.js +0 -23
  73. package/styles/index.d.ts +0 -0
  74. package/ui/src/components/badge/badge.js +0 -20
  75. package/ui/src/components/badge/badge.module.css.js +0 -12
  76. package/wizard/src/features/api-integration/services/ActionExecutor.js +0 -339
  77. package/wizard/src/features/api-integration/services/ApiCallExecutor.js +0 -6
  78. package/wizard/src/features/api-integration/services/DialogExecutor.js +0 -6
  79. package/wizard/src/features/api-integration/services/GenericTriggerService.js +0 -284
  80. package/wizard/src/features/api-integration/services/NavigationExecutor.js +0 -6
  81. package/wizard/src/features/form-runtime/config/templateConfig.js +0 -156
  82. package/wizard/src/features/form-runtime/config/templateUtils.js +0 -14
  83. package/wizard/src/features/form-runtime/utils/validation.js +0 -100
  84. package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.js +0 -46
  85. package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.module.css.js +0 -30
  86. package/wizard/src/features/trigger-action-system/utils/GenericTriggerEngine.js +0 -376
  87. package/wizard/src/features/validation-system/components/ValidationDebugger.js +0 -69
  88. package/wizard/src/features/validation-system/validation/tanstackSchemaAdapter.js +0 -17
  89. package/wizard/src/features/validation-system/validation/validationService.js +0 -74
@@ -1,58 +1,17 @@
1
1
  "use client";
2
- import { getMostRelevantError as l } from "./errorUtils.js";
3
- const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), g = (r) => {
4
- s.add(r);
5
- }, u = (r) => s.has(r), w = () => {
6
- s.clear();
7
- }, h = (r, t = !1, e) => {
8
- const { errors: i, isTouched: n, isValid: c } = r;
9
- return e && a.has(e) && a.get(e) ? !1 : c ? (e && a.set(e, !0), !1) : !i || i.length === 0 ? !1 : (e && a.set(e, !1), t ? !0 : e && !u(e) ? !1 : n);
10
- }, A = (r, t) => {
11
- a.set(r, t);
12
- }, E = (r, t = !1) => h(r, t) ? l(r.errors || []) : "", o = {
13
- // Text inputs: validate on blur, show errors after touch
14
- textInput: {
15
- validateOn: "blur",
16
- showErrorsAfter: "touch"
17
- },
18
- // Email: validate on blur, show errors after touch
19
- email: {
20
- validateOn: "blur",
21
- showErrorsAfter: "touch"
22
- },
23
- // Numbers: validate on blur, show errors after touch
24
- number: {
25
- validateOn: "blur",
26
- showErrorsAfter: "touch"
27
- },
28
- // Radio groups: validate on change, show errors after touch
29
- radioGroup: {
30
- validateOn: "change",
31
- showErrorsAfter: "touch"
32
- },
33
- // Selects: validate on change, show errors after touch
34
- select: {
35
- validateOn: "change",
36
- showErrorsAfter: "touch"
37
- },
38
- // Checkboxes: validate on change, show errors after touch
39
- checkbox: {
40
- validateOn: "change",
41
- showErrorsAfter: "touch"
42
- },
43
- // Multi-select: validate on change, show errors after touch
44
- multiselect: {
45
- validateOn: "change",
46
- showErrorsAfter: "touch"
47
- }
48
- }, v = (r) => o[r] || o.textInput;
2
+ import { getMostRelevantError as u } from "./errorUtils.js";
3
+ const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), d = (r) => {
4
+ i.add(r);
5
+ }, n = (r) => i.has(r), c = (r, s = !1, e) => {
6
+ const { errors: a, isTouched: l, isValid: f } = r;
7
+ return e && t.has(e) && t.get(e) ? !1 : f ? (e && t.set(e, !0), !1) : !a || a.length === 0 ? !1 : (e && t.set(e, !1), s ? !0 : e && !n(e) ? !1 : l);
8
+ }, g = (r, s) => {
9
+ t.set(r, s);
10
+ }, V = (r, s = !1) => c(r, s) ? u(r.errors || []) : "";
49
11
  export {
50
- o as VALIDATION_TIMING,
51
- w as clearUserInteractionTracking,
52
- E as getDisplayErrorMessage,
53
- v as getValidationTiming,
54
- u as hasUserInteracted,
55
- g as markFieldAsUserInteracted,
56
- h as shouldShowValidationError,
57
- A as updateValidationCache
12
+ V as getDisplayErrorMessage,
13
+ n as hasUserInteracted,
14
+ d as markFieldAsUserInteracted,
15
+ c as shouldShowValidationError,
16
+ g as updateValidationCache
58
17
  };
@@ -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
  };