@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.
- package/core/src/types/guards.js +0 -12
- package/core/src/utils/apiBodyUtils.js +43 -75
- package/features/form-runtime/components/FormFooter.d.ts +5 -0
- package/features/form-runtime/hooks/useValidationEvents.d.ts +0 -1
- package/features/state-management/machines/formMachine.d.ts +3 -0
- package/features/state-management/machines/types.d.ts +4 -0
- package/features/state-management/machines/useFormMachine.d.ts +18 -0
- package/index.d.ts +2 -8
- package/index.js +2 -108
- package/package.json +1 -30
- package/styles.css +1 -1
- package/ui/src/lib/utils/templateUtils.js +11 -43
- package/wizard/src/features/api-integration/services/ApiCallService.js +65 -74
- package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +39 -43
- package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +37 -41
- package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +44 -45
- package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +56 -78
- package/wizard/src/features/form-runtime/components/FormField.js +28 -28
- package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
- package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +152 -196
- package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +82 -91
- package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
- package/wizard/src/features/form-runtime/config/configResolver.js +10 -14
- package/wizard/src/features/form-runtime/config/templateLoader.js +71 -108
- package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +45 -88
- package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +27 -41
- package/wizard/src/features/form-runtime/hooks/useFormFieldState.js +5 -5
- package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
- package/wizard/src/features/form-runtime/utils/errorUtils.js +31 -42
- package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +26 -37
- package/wizard/src/features/form-runtime/utils/logger.js +12 -12
- package/wizard/src/features/form-runtime/utils/validationUX.js +14 -55
- package/wizard/src/features/state-management/machines/actions/navigationActions.js +13 -8
- package/wizard/src/features/state-management/machines/componentTriggerEngine.js +167 -432
- package/wizard/src/features/state-management/machines/formMachine.js +558 -677
- package/wizard/src/features/state-management/machines/useFormMachine.js +172 -190
- package/wizard/src/features/trigger-action-system/components/ActionManager.js +35 -86
- package/wizard/src/features/validation-system/validation/SchemaBuilder.js +28 -82
- package/wizard/src/features/validation-system/validation/ValidationCache.js +11 -27
- package/wizard/src/features/validation-system/validation/ValidationEngine.js +24 -29
- package/wizard/src/features/validation-system/validation/ValidationExecutor.js +26 -58
- package/FormWizard.d.ts +0 -10
- package/core/src/types/api.js +0 -12
- package/core/src/types/form-config.js +0 -60
- package/core/src/types/form-wizard-config-schema.js +0 -113
- package/core/src/types/validation.js +0 -61
- package/features/api-integration.d.ts +0 -2
- package/features/api-integration.js +0 -17
- package/features/dialog-system.d.ts +0 -2
- package/features/dialog-system.js +0 -9
- package/features/form-runtime/utils/formSaver.d.ts +0 -22
- package/features/form-runtime.d.ts +0 -2
- package/features/form-runtime.js +0 -63
- package/features/index.d.ts +0 -11
- package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +0 -9
- package/features/state-management/machines/__tests__/setup.d.ts +0 -0
- package/features/state-management/machines/__tests__/vitest.config.d.ts +0 -2
- package/features/state-management/machines/actions/validationActions.d.ts +0 -68
- package/features/state-management/machines/lazyLoading.d.ts +0 -34
- package/features/state-management/machines/validation/index.d.ts +0 -5
- package/features/state-management/machines/validation/validateField.d.ts +0 -2
- package/features/state-management/machines/validation/validateForm.d.ts +0 -2
- package/features/state-management/machines/validation/validateSection.d.ts +0 -2
- package/features/state-management/machines/validation/validateStep.d.ts +0 -2
- package/features/state-management/machines/validation/validationTypes.d.ts +0 -1
- package/features/state-management.d.ts +0 -2
- package/features/state-management.js +0 -21
- package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
- package/features/trigger-action-system.d.ts +0 -2
- package/features/trigger-action-system.js +0 -12
- package/features/validation-system.d.ts +0 -2
- package/features/validation-system.js +0 -23
- package/styles/index.d.ts +0 -0
- package/ui/src/components/badge/badge.js +0 -20
- package/ui/src/components/badge/badge.module.css.js +0 -12
- package/wizard/src/features/api-integration/services/ActionExecutor.js +0 -339
- package/wizard/src/features/api-integration/services/ApiCallExecutor.js +0 -6
- package/wizard/src/features/api-integration/services/DialogExecutor.js +0 -6
- package/wizard/src/features/api-integration/services/GenericTriggerService.js +0 -284
- package/wizard/src/features/api-integration/services/NavigationExecutor.js +0 -6
- package/wizard/src/features/form-runtime/config/templateConfig.js +0 -156
- package/wizard/src/features/form-runtime/config/templateUtils.js +0 -14
- package/wizard/src/features/form-runtime/utils/validation.js +0 -100
- package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.js +0 -46
- package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.module.css.js +0 -30
- package/wizard/src/features/trigger-action-system/utils/GenericTriggerEngine.js +0 -376
- package/wizard/src/features/validation-system/components/ValidationDebugger.js +0 -69
- package/wizard/src/features/validation-system/validation/tanstackSchemaAdapter.js +0 -17
- package/wizard/src/features/validation-system/validation/validationService.js +0 -74
|
@@ -1,58 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getMostRelevantError as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
(
|
|
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
|
|
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
|
-
|
|
126
|
+
d as executePendingNavigation
|
|
122
127
|
};
|