@digiform/wizard 0.2.10 → 0.2.11
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/api.js +12 -0
- package/core/src/types/form-config.js +60 -0
- package/core/src/types/form-wizard-config-schema.js +113 -0
- package/core/src/types/guards.js +19 -0
- package/core/src/types/validation.js +61 -0
- package/core/src/utils/apiBodyUtils.js +95 -0
- package/features/api-integration.d.ts +2 -0
- package/features/api-integration.js +17 -0
- package/features/dialog-system.d.ts +2 -0
- package/features/dialog-system.js +9 -0
- package/features/form-runtime.d.ts +2 -0
- package/features/form-runtime.js +63 -0
- package/features/state-management.d.ts +2 -0
- package/features/state-management.js +21 -0
- package/features/trigger-action-system.d.ts +2 -0
- package/features/trigger-action-system.js +12 -0
- package/features/validation-system.d.ts +2 -0
- package/features/validation-system.js +23 -0
- package/index.js +108 -17470
- package/package.json +35 -30
- package/styles.css +1 -1
- package/ui/src/component-registry/renderComponent.js +11 -0
- package/ui/src/components/FormLayout/FormLayout.js +135 -0
- package/ui/src/components/FormLayout/FormLayout.module.css.js +20 -0
- package/ui/src/components/GridLayout/GridLayout.js +62 -0
- package/ui/src/components/GridLayout/GridLayout.module.css.js +16 -0
- package/ui/src/components/GridLayoutColumn/GridLayoutColumn.js +37 -0
- package/ui/src/components/GridLayoutColumn/GridLayoutColumn.module.css.js +10 -0
- package/ui/src/components/ProgressLoaderBar/ProgressLoaderBar.js +108 -0
- package/ui/src/components/ProgressLoaderBar/ProgressLoaderBar.module.css.js +20 -0
- package/ui/src/components/ProgressLoaderBar/useProgressAnimation.js +31 -0
- package/ui/src/components/ValidationCode/ValidationCode.js +198 -0
- package/ui/src/components/ValidationCode/ValidationCode.module.css.js +20 -0
- package/ui/src/components/alert/alert.js +30 -0
- package/ui/src/components/alert/alert.module.css.js +14 -0
- package/ui/src/components/badge/badge.js +20 -0
- package/ui/src/components/badge/badge.module.css.js +12 -0
- package/ui/src/components/box/box.js +8 -0
- package/ui/src/components/box/box.module.css.js +8 -0
- package/ui/src/components/button/button.js +25 -0
- package/ui/src/components/button/button.module.css.js +18 -0
- package/ui/src/components/card/card.js +106 -0
- package/ui/src/components/card/card.module.css.js +44 -0
- package/ui/src/components/checkbox/checkbox.js +20 -0
- package/ui/src/components/checkbox/checkbox.module.css.js +10 -0
- package/ui/src/components/dialog/dialog.js +67 -0
- package/ui/src/components/dialog/dialog.module.css.js +20 -0
- package/ui/src/components/form-header-base/form-header-base.js +59 -0
- package/ui/src/components/form-header-base/form-header-base.module.css.js +14 -0
- package/ui/src/components/input/input.js +20 -0
- package/ui/src/components/input/input.module.css.js +8 -0
- package/ui/src/components/radio-group/radio-group.js +30 -0
- package/ui/src/components/radio-group/radio-group.module.css.js +14 -0
- package/ui/src/components/select/select.js +115 -0
- package/ui/src/components/select/select.module.css.js +32 -0
- package/ui/src/components/sheet/sheet.js +71 -0
- package/ui/src/components/sheet/sheet.module.css.js +46 -0
- package/ui/src/components/textarea/textarea.js +19 -0
- package/ui/src/components/textarea/textarea.module.css.js +8 -0
- package/ui/src/design-system/components/FormFieldWrapper.js +16 -0
- package/ui/src/lib/assets/icons/Check.js +26 -0
- package/ui/src/lib/assets/icons/ChevronRight.js +26 -0
- package/ui/src/lib/error-boundaries/BaseErrorBoundary.js +155 -0
- package/ui/src/lib/error-boundaries/ComponentErrorBoundary.js +153 -0
- package/ui/src/lib/error-boundaries/FormWizardErrorBoundary.js +107 -0
- package/ui/src/lib/logger.js +106 -0
- package/ui/src/lib/providers/FormEditingContext.js +21 -0
- package/ui/src/lib/queryClient.js +26 -0
- package/ui/src/lib/types/guards.js +11 -0
- package/ui/src/lib/utils/componentUtils.js +38 -0
- package/ui/src/lib/utils/templateDialogResolver.js +85 -0
- package/ui/src/lib/utils/templateUtils.js +52 -0
- package/ui/src/theme/ThemeProvider.js +15 -0
- package/wizard/src/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.js +370 -0
- package/wizard/src/features/api-integration/services/ActionExecutor.js +339 -0
- package/wizard/src/features/api-integration/services/ApiCallExecutor.js +6 -0
- package/wizard/src/features/api-integration/services/ApiCallService.js +309 -0
- package/wizard/src/features/api-integration/services/DialogExecutor.js +6 -0
- package/wizard/src/features/api-integration/services/GenericTriggerService.js +284 -0
- package/wizard/src/features/api-integration/services/NavigationExecutor.js +6 -0
- package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +115 -0
- package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.module.css.js +29 -0
- package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +64 -0
- package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.module.css.js +22 -0
- package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +149 -0
- package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.module.css.js +40 -0
- package/wizard/src/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.js +107 -0
- package/wizard/src/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.module.css.js +10 -0
- package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +107 -0
- package/wizard/src/features/form-runtime/FormWizard/FormWizard.module.css.js +16 -0
- package/wizard/src/features/form-runtime/components/FormField.js +405 -0
- package/wizard/src/features/form-runtime/components/FormFooter.js +209 -0
- package/wizard/src/features/form-runtime/components/FormHeader.js +29 -0
- package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +279 -0
- package/wizard/src/features/form-runtime/components/FormSection/FormSection.module.css.js +20 -0
- package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +167 -0
- package/wizard/src/features/form-runtime/components/FormStep/FormStep.module.css.js +12 -0
- package/wizard/src/features/form-runtime/components/ProgressLoaderRuntime.js +88 -0
- package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +61 -0
- package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.module.css.js +34 -0
- package/wizard/src/features/form-runtime/components/displayValue/displayValue.js +21 -0
- package/wizard/src/features/form-runtime/components/displayValue/displayValue.module.css.js +10 -0
- package/wizard/src/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.js +28 -0
- package/wizard/src/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.module.css.js +8 -0
- package/wizard/src/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.js +56 -0
- package/wizard/src/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.module.css.js +8 -0
- package/wizard/src/features/form-runtime/config/configResolver.js +38 -0
- package/wizard/src/features/form-runtime/config/templateConfig.js +156 -0
- package/wizard/src/features/form-runtime/config/templateLoader.js +265 -0
- package/wizard/src/features/form-runtime/config/templateUtils.js +14 -0
- package/wizard/src/features/form-runtime/context/LoaderContext.js +36 -0
- package/wizard/src/features/form-runtime/hooks/useApiActions.js +60 -0
- package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +102 -0
- package/wizard/src/features/form-runtime/hooks/useComponentVisibility.js +18 -0
- package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +61 -0
- package/wizard/src/features/form-runtime/hooks/useFormContext.js +13 -0
- package/wizard/src/features/form-runtime/hooks/useFormFieldState.js +40 -0
- package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +39 -0
- package/wizard/src/features/form-runtime/utils/componentDisplayValue.js +22 -0
- package/wizard/src/features/form-runtime/utils/errorUtils.js +93 -0
- package/wizard/src/features/form-runtime/utils/fieldHelpers.js +17 -0
- package/wizard/src/features/form-runtime/utils/formDataBuilder.js +10 -0
- package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +52 -0
- package/wizard/src/features/form-runtime/utils/logger.js +111 -0
- package/wizard/src/features/form-runtime/utils/validation.js +100 -0
- package/wizard/src/features/form-runtime/utils/validationUX.js +58 -0
- package/wizard/src/features/form-runtime/utils/visibilityUtils.js +77 -0
- package/wizard/src/features/state-management/machines/actions/componentActions.js +215 -0
- package/wizard/src/features/state-management/machines/actions/navigationActions.js +122 -0
- package/wizard/src/features/state-management/machines/actions/saveActions.js +101 -0
- package/wizard/src/features/state-management/machines/componentTriggerEngine.js +598 -0
- package/wizard/src/features/state-management/machines/formMachine.js +1565 -0
- package/wizard/src/features/state-management/machines/guards/navigationGuards.js +59 -0
- package/wizard/src/features/state-management/machines/guards/saveGuards.js +21 -0
- package/wizard/src/features/state-management/machines/guards/triggerGuards.js +11 -0
- package/wizard/src/features/state-management/machines/helpers/triggerHelpers.js +12 -0
- package/wizard/src/features/state-management/machines/performance.js +56 -0
- package/wizard/src/features/state-management/machines/useFormMachine.js +412 -0
- package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.js +46 -0
- package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.module.css.js +30 -0
- package/wizard/src/features/trigger-action-system/components/ActionManager.js +108 -0
- package/wizard/src/features/trigger-action-system/components/ComponentAlert/ComponentAlert.js +10 -0
- package/wizard/src/features/trigger-action-system/components/ComponentAlert/ComponentAlert.module.css.js +8 -0
- package/wizard/src/features/trigger-action-system/utils/GenericTriggerEngine.js +376 -0
- package/wizard/src/features/validation-system/components/ValidationDebugger.js +69 -0
- package/wizard/src/features/validation-system/validation/ActionValidation.js +234 -0
- package/wizard/src/features/validation-system/validation/SchemaBuilder.js +239 -0
- package/wizard/src/features/validation-system/validation/ValidationCache.js +76 -0
- package/wizard/src/features/validation-system/validation/ValidationEngine.js +97 -0
- package/wizard/src/features/validation-system/validation/ValidationExecutor.js +138 -0
- package/wizard/src/features/validation-system/validation/tanstackSchemaAdapter.js +17 -0
- package/wizard/src/features/validation-system/validation/validationService.js +74 -0
- package/wizard/src/renderer/wizardRenderer.js +123 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as f, jsx as i, Fragment as M } from "react/jsx-runtime";
|
|
3
|
+
import h from "./FormStep.module.css.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { isTemplateStep as m } from "../../../../../../ui/src/lib/types/guards.js";
|
|
6
|
+
import { logger as U } from "../../../../../../ui/src/lib/logger.js";
|
|
7
|
+
import { EnhancedActionExecutor as C } from "../../../api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.js";
|
|
8
|
+
import { useFormMachine as k } from "../../../state-management/machines/useFormMachine.js";
|
|
9
|
+
import { useForm as W } from "@tanstack/react-form";
|
|
10
|
+
import { useRef as p } from "react";
|
|
11
|
+
import { LoaderProvider as G, useLoaderContext as H } from "../../context/LoaderContext.js";
|
|
12
|
+
import { FormProvider as j } from "../../hooks/useFormContext.js";
|
|
13
|
+
import { buildDefaultValues as E } from "../../utils/formDataBuilder.js";
|
|
14
|
+
import { resetFormDirtyStateAfterApiPopulation as z } from "../../utils/formDirtyStateSync.js";
|
|
15
|
+
import q from "../FormFooter.js";
|
|
16
|
+
import K from "../FormHeader.js";
|
|
17
|
+
import Q from "../FormSection/FormSection.js";
|
|
18
|
+
import { ProgressLoaderRuntime as X } from "../ProgressLoaderRuntime.js";
|
|
19
|
+
import { ValidationEngine as B } from "../../../validation-system/validation/ValidationEngine.js";
|
|
20
|
+
const J = ({
|
|
21
|
+
currentStep: s,
|
|
22
|
+
hasStepLoader: a,
|
|
23
|
+
loaderConfig: o
|
|
24
|
+
}) => {
|
|
25
|
+
const { isLoadingComplete: t } = H(), d = m(s) ? [] : s.sections || [];
|
|
26
|
+
return /* @__PURE__ */ f("div", { className: h.stepContent, children: [
|
|
27
|
+
a && /* @__PURE__ */ i("div", { className: h.loaderWrapper, children: /* @__PURE__ */ i(
|
|
28
|
+
X,
|
|
29
|
+
{
|
|
30
|
+
properties: {
|
|
31
|
+
label: o?.label,
|
|
32
|
+
showPercentage: o?.showPercentage ?? !0,
|
|
33
|
+
duration: o?.duration ?? 3,
|
|
34
|
+
size: o?.size ?? "md",
|
|
35
|
+
variant: o?.variant ?? "default",
|
|
36
|
+
animationSpeed: o?.animationSpeed ?? "normal",
|
|
37
|
+
autoStart: !0,
|
|
38
|
+
hideOnComplete: !0,
|
|
39
|
+
onComplete: o?.completionMessage ? {
|
|
40
|
+
showMessage: {
|
|
41
|
+
enabled: !0,
|
|
42
|
+
text: o.completionMessage,
|
|
43
|
+
type: "success"
|
|
44
|
+
}
|
|
45
|
+
} : void 0
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
) }),
|
|
49
|
+
(!a || t) && /* @__PURE__ */ i(M, { children: d.map((c) => /* @__PURE__ */ i(Q, { section: c }, c.id)) })
|
|
50
|
+
] });
|
|
51
|
+
}, Y = () => {
|
|
52
|
+
const [s, a, o] = k(), { currentStep: t, config: d } = o, c = p(), u = p(), F = p(), b = d.validationMessageStyle || "withLabel";
|
|
53
|
+
c.current || (c.current = new B({ messageStyle: b })), (!u.current || F.current !== t.id) && (m(t) ? u.current = c.current.getStepSchema({
|
|
54
|
+
...t,
|
|
55
|
+
sections: []
|
|
56
|
+
}) : u.current = c.current.getStepSchema(t), F.current = t.id);
|
|
57
|
+
const v = { ...m(t) ? E({
|
|
58
|
+
...t,
|
|
59
|
+
sections: []
|
|
60
|
+
}) : E(t), ...o.data }, y = (e) => {
|
|
61
|
+
(t.actions || []).length > 0 && a({ type: "EXECUTE_ACTIONS", trigger: e });
|
|
62
|
+
}, x = p(), g = p(!1);
|
|
63
|
+
t.id !== x.current && (t.actions || []).length > 0 && !g.current && (x.current = t.id, g.current = !0, setTimeout(() => {
|
|
64
|
+
y("onStepLoad"), setTimeout(() => {
|
|
65
|
+
g.current = !1;
|
|
66
|
+
}, 1e3);
|
|
67
|
+
}, 0));
|
|
68
|
+
const N = async ({
|
|
69
|
+
value: e
|
|
70
|
+
}) => {
|
|
71
|
+
const n = t.actions || [], r = n.some(
|
|
72
|
+
(S) => S.trigger === "onStepFinish"
|
|
73
|
+
);
|
|
74
|
+
console.log("🎯 [FormStep] handleSubmit called with form values:", {
|
|
75
|
+
stepActions: n.length,
|
|
76
|
+
hasFinishActions: r,
|
|
77
|
+
formValue: e
|
|
78
|
+
}), r ? (console.log(
|
|
79
|
+
"🎯 [FormStep] Step has onStepFinish actions, requesting navigation first"
|
|
80
|
+
), a({ type: "REQUEST_NAVIGATION", navigationType: "next" })) : (console.log("🎯 [FormStep] No step actions, direct navigation"), o.nextStep());
|
|
81
|
+
}, D = (e) => {
|
|
82
|
+
}, L = (e) => {
|
|
83
|
+
U.error("Action execution failed", { error: e.message }, e);
|
|
84
|
+
}, O = (e) => {
|
|
85
|
+
console.log("🔥 FormStep: handleShowDialog called", { dialogConfig: e }), a({ type: "SHOW_ACTION_DIALOG", dialogConfig: e }), console.log("🔥 FormStep: SHOW_ACTION_DIALOG event sent");
|
|
86
|
+
}, V = (e) => {
|
|
87
|
+
switch (e.type) {
|
|
88
|
+
case "next":
|
|
89
|
+
o.nextStep();
|
|
90
|
+
break;
|
|
91
|
+
case "previous":
|
|
92
|
+
o.previousStep();
|
|
93
|
+
break;
|
|
94
|
+
case "step":
|
|
95
|
+
e.targetStep && o.goToStep(e.targetStep);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}, l = W({
|
|
99
|
+
defaultValues: v,
|
|
100
|
+
onSubmit: N
|
|
101
|
+
}), w = (e, n) => {
|
|
102
|
+
console.log("🎯 handleFieldUpdate called:", { fieldPath: e, value: n });
|
|
103
|
+
const r = e, S = l.getFieldValue(r), R = s.context.componentOriginalValues[r]?.value;
|
|
104
|
+
if (S !== n) {
|
|
105
|
+
console.log("🔄 Updating TanStack Form field:", { componentId: r, value: n });
|
|
106
|
+
const I = n;
|
|
107
|
+
o.setData(r, I), l.setFieldValue(r, n);
|
|
108
|
+
try {
|
|
109
|
+
z(l, {
|
|
110
|
+
updatedFields: [r],
|
|
111
|
+
debug: process.env.NODE_ENV === "development"
|
|
112
|
+
}), console.log("✅ Dirty state reset complete for:", r);
|
|
113
|
+
} catch (P) {
|
|
114
|
+
console.error("❌ Failed to reset dirty state:", P);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
R !== n && (console.log("🎯 Marking component as populated:", { componentId: r, value: n }), setTimeout(() => {
|
|
118
|
+
a({
|
|
119
|
+
type: "MARK_COMPONENT_AS_POPULATED",
|
|
120
|
+
componentId: r,
|
|
121
|
+
value: n
|
|
122
|
+
});
|
|
123
|
+
}, 0));
|
|
124
|
+
}, A = t, T = !m(t) && A.waitForLoader === !0, _ = T ? A.loaderConfig : void 0;
|
|
125
|
+
return /* @__PURE__ */ f(j, { value: l, children: [
|
|
126
|
+
s.matches("executingActions") && (s.context.executingTrigger === "onStepLoad" || s.context.executingTrigger === "onStepFinish") && /* @__PURE__ */ i(
|
|
127
|
+
C,
|
|
128
|
+
{
|
|
129
|
+
actions: t.actions || [],
|
|
130
|
+
trigger: s.context.executingTrigger || "onStepLoad",
|
|
131
|
+
formData: s.context.data,
|
|
132
|
+
onComplete: D,
|
|
133
|
+
onError: L,
|
|
134
|
+
onFieldUpdate: w,
|
|
135
|
+
onShowDialog: O,
|
|
136
|
+
onNavigate: V,
|
|
137
|
+
machineRef: {
|
|
138
|
+
send: a
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ f(
|
|
143
|
+
"form",
|
|
144
|
+
{
|
|
145
|
+
onSubmit: (e) => {
|
|
146
|
+
e.preventDefault(), e.stopPropagation(), l.handleSubmit();
|
|
147
|
+
},
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ i(K, {}),
|
|
150
|
+
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(
|
|
151
|
+
J,
|
|
152
|
+
{
|
|
153
|
+
currentStep: t,
|
|
154
|
+
hasStepLoader: T,
|
|
155
|
+
loaderConfig: _
|
|
156
|
+
}
|
|
157
|
+
) }),
|
|
158
|
+
/* @__PURE__ */ i(q, { className: h.footer })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
] });
|
|
163
|
+
};
|
|
164
|
+
Y.displayName = "FormStep";
|
|
165
|
+
export {
|
|
166
|
+
Y as default
|
|
167
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { memo as A, useState as d, useRef as f, useEffect as i } from "react";
|
|
5
|
+
import { useLoaderContext as B } from "../context/LoaderContext.js";
|
|
6
|
+
import { ProgressLoaderBar as N } from "../../../../../ui/src/components/ProgressLoaderBar/ProgressLoaderBar.js";
|
|
7
|
+
const O = (t) => t > 90 ? Math.random() * 1 + 0.5 : t > 80 ? Math.random() * 2 + 1 : t > 60 ? Math.random() * 3 + 2 : Math.random() * 4 + 3, P = (t) => {
|
|
8
|
+
const m = {
|
|
9
|
+
slow: { min: 200, max: 400 },
|
|
10
|
+
normal: { min: 80, max: 200 },
|
|
11
|
+
fast: { min: 30, max: 100 }
|
|
12
|
+
}, { min: n, max: r } = m[t];
|
|
13
|
+
return Math.random() * (r - n) + n;
|
|
14
|
+
}, q = A(
|
|
15
|
+
({ properties: t, className: m }) => {
|
|
16
|
+
const { setLoadingComplete: n } = B(), [r, p] = d("idle"), [u, R] = d(0), [D, M] = d(!1), e = f(null), y = f(Date.now()), T = f(!1), {
|
|
17
|
+
autoStart: g = !0,
|
|
18
|
+
hideOnComplete: h = !0,
|
|
19
|
+
duration: L = 3,
|
|
20
|
+
// Default 3 seconds
|
|
21
|
+
mode: S = "determinate",
|
|
22
|
+
label: w,
|
|
23
|
+
showPercentage: b = !0,
|
|
24
|
+
size: v = "md",
|
|
25
|
+
variant: H = "default",
|
|
26
|
+
barColor: E,
|
|
27
|
+
trackColor: I,
|
|
28
|
+
animationSpeed: s = "normal",
|
|
29
|
+
onComplete: j,
|
|
30
|
+
errorHandling: k
|
|
31
|
+
} = t, c = L * 1e3;
|
|
32
|
+
return i(() => {
|
|
33
|
+
if (!g || T.current) return;
|
|
34
|
+
T.current = !0, p("loading");
|
|
35
|
+
const l = setTimeout(() => {
|
|
36
|
+
const a = () => {
|
|
37
|
+
R((o) => {
|
|
38
|
+
if (o >= 100)
|
|
39
|
+
return e.current && (clearTimeout(e.current), e.current = null), 100;
|
|
40
|
+
e.current = setTimeout(
|
|
41
|
+
a,
|
|
42
|
+
P(s)
|
|
43
|
+
);
|
|
44
|
+
const z = O(o), x = o + z;
|
|
45
|
+
return x > 100 ? 100 : x;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
a();
|
|
49
|
+
}, 100);
|
|
50
|
+
return () => {
|
|
51
|
+
clearTimeout(l), e.current && (clearTimeout(e.current), e.current = null);
|
|
52
|
+
};
|
|
53
|
+
}, [g, s]), i(() => {
|
|
54
|
+
if (u >= 100 && r === "loading") {
|
|
55
|
+
const l = Date.now() - y.current, a = Math.max(0, c - l), o = setTimeout(() => {
|
|
56
|
+
p("complete");
|
|
57
|
+
}, a);
|
|
58
|
+
return () => clearTimeout(o);
|
|
59
|
+
}
|
|
60
|
+
}, [u, r, c]), i(() => {
|
|
61
|
+
r === "complete" && (n(!0), h && M(!0));
|
|
62
|
+
}, [r, h, n]), i(() => () => {
|
|
63
|
+
e.current && clearTimeout(e.current);
|
|
64
|
+
}, []), D ? null : /* @__PURE__ */ C("div", { className: m, children: /* @__PURE__ */ C(
|
|
65
|
+
N,
|
|
66
|
+
{
|
|
67
|
+
label: w,
|
|
68
|
+
showPercentage: b,
|
|
69
|
+
mode: S,
|
|
70
|
+
value: u,
|
|
71
|
+
duration: c,
|
|
72
|
+
size: v,
|
|
73
|
+
variant: H,
|
|
74
|
+
barColor: E,
|
|
75
|
+
trackColor: I,
|
|
76
|
+
status: r,
|
|
77
|
+
completionConfig: j,
|
|
78
|
+
errorConfig: k,
|
|
79
|
+
animationSpeed: s
|
|
80
|
+
}
|
|
81
|
+
) });
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
q.displayName = "ProgressLoaderRuntime";
|
|
85
|
+
export {
|
|
86
|
+
q as ProgressLoaderRuntime,
|
|
87
|
+
q as default
|
|
88
|
+
};
|
package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { useFormMachine as h } from "../../../state-management/machines/useFormMachine.js";
|
|
5
|
+
import o from "clsx";
|
|
6
|
+
import e from "./StepProgressIndicator.module.css.js";
|
|
7
|
+
import v from "../../../../../../ui/src/lib/assets/icons/Check.js";
|
|
8
|
+
import N from "../../../../../../ui/src/lib/assets/icons/ChevronRight.js";
|
|
9
|
+
import { Heading as f } from "@rijkshuisstijl-community/components-react";
|
|
10
|
+
const x = () => {
|
|
11
|
+
const [, , m] = h(), { currentStepIndex: l, steps: c, config: p } = m;
|
|
12
|
+
return console.log("🏁 StepProgressIndicator render:", {
|
|
13
|
+
currentStepIndex: l,
|
|
14
|
+
totalSteps: c.length,
|
|
15
|
+
formId: p.id,
|
|
16
|
+
stepIds: c.map((s) => s.id),
|
|
17
|
+
stepTitles: c.map((s) => s.title)
|
|
18
|
+
}), /* @__PURE__ */ r("div", { className: e.stepListWrapper, children: [
|
|
19
|
+
/* @__PURE__ */ t(f, { level: 2, children: "Stappenplan" }),
|
|
20
|
+
/* @__PURE__ */ t("ul", { className: e.stepList, children: c.map((s, i) => {
|
|
21
|
+
const n = i === l, d = i > l, a = i < l;
|
|
22
|
+
return /* @__PURE__ */ r(
|
|
23
|
+
"li",
|
|
24
|
+
{
|
|
25
|
+
className: o(e.stepListItem, {
|
|
26
|
+
[e.inactive]: d,
|
|
27
|
+
[e.completed]: a,
|
|
28
|
+
[e.current]: n
|
|
29
|
+
}),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ r("div", { className: e.leftContainer, children: [
|
|
32
|
+
/* @__PURE__ */ t("div", { className: e.circle, children: a ? /* @__PURE__ */ t(v, {}) : /* @__PURE__ */ t(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: o({
|
|
36
|
+
[e.currentDot]: n
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
) }),
|
|
40
|
+
i < c.length - 1 && /* @__PURE__ */ t("div", { className: e.connector })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ r("div", { className: e.content, children: [
|
|
43
|
+
/* @__PURE__ */ r("div", { className: e.contentText, children: [
|
|
44
|
+
/* @__PURE__ */ r("div", { className: e.stepNumber, children: [
|
|
45
|
+
"Stap ",
|
|
46
|
+
i + 1
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ t("span", { className: e.stepTitle, children: s.title })
|
|
49
|
+
] }),
|
|
50
|
+
n ? /* @__PURE__ */ t("div", { className: e.iconRightContainer, children: /* @__PURE__ */ t(N, {}) }) : null
|
|
51
|
+
] })
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
s.id
|
|
55
|
+
);
|
|
56
|
+
}) })
|
|
57
|
+
] });
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
x as default
|
|
61
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const t = "fb-stepListWrapper_RTLUk", e = "fb-stepList_b7ucJ", n = "fb-stepListItem_G8Nh4", c = "fb-leftContainer_o-gBE", s = "fb-circle_3oinV", o = "fb-currentDot_0e9gN", i = "fb-connector_bDvRA", r = "fb-content_u43H4", p = "fb-stepNumber_c2YRs", b = "fb-stepTitle_w5Be8", f = "fb-iconRightContainer_DCjrS", l = "fb-completed_F-mOG", a = "fb-current_QAO1e", _ = "fb-inactive_tYqvV", u = {
|
|
3
|
+
stepListWrapper: t,
|
|
4
|
+
stepList: e,
|
|
5
|
+
stepListItem: n,
|
|
6
|
+
leftContainer: c,
|
|
7
|
+
circle: s,
|
|
8
|
+
currentDot: o,
|
|
9
|
+
connector: i,
|
|
10
|
+
content: r,
|
|
11
|
+
stepNumber: p,
|
|
12
|
+
stepTitle: b,
|
|
13
|
+
iconRightContainer: f,
|
|
14
|
+
completed: l,
|
|
15
|
+
current: a,
|
|
16
|
+
inactive: _
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
s as circle,
|
|
20
|
+
l as completed,
|
|
21
|
+
i as connector,
|
|
22
|
+
r as content,
|
|
23
|
+
a as current,
|
|
24
|
+
o as currentDot,
|
|
25
|
+
u as default,
|
|
26
|
+
f as iconRightContainer,
|
|
27
|
+
_ as inactive,
|
|
28
|
+
c as leftContainer,
|
|
29
|
+
e as stepList,
|
|
30
|
+
n as stepListItem,
|
|
31
|
+
t as stepListWrapper,
|
|
32
|
+
p as stepNumber,
|
|
33
|
+
b as stepTitle
|
|
34
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import t from "./displayValue.module.css.js";
|
|
4
|
+
const c = (r, e) => e == null || r.type !== "checkbox" && e === "" ? /* @__PURE__ */ n("p", { className: t.emptyValue, children: "No value" }) : /* @__PURE__ */ n("p", { className: t.valueText, children: String(e) }), a = (r, e) => e == null || e === "" ? /* @__PURE__ */ n("p", { className: t.emptyValue, children: "No value" }) : /* @__PURE__ */ n("p", { className: t.valueText, children: String(e) }), d = (r, e) => /* @__PURE__ */ n("p", { className: t.valueText, children: e ? "Checked" : "Unchecked" }), u = (r, e) => {
|
|
5
|
+
if (e == null || e === "")
|
|
6
|
+
return /* @__PURE__ */ n("p", { className: t.emptyValue, children: "No value" });
|
|
7
|
+
const o = (r.properties?.options || []).find((s) => s.value === e);
|
|
8
|
+
return /* @__PURE__ */ n("p", { className: t.valueText, children: o?.label || String(e) });
|
|
9
|
+
}, m = (r, e) => {
|
|
10
|
+
if (e == null || e === "")
|
|
11
|
+
return /* @__PURE__ */ n("p", { className: t.emptyValue, children: "No value" });
|
|
12
|
+
const o = (r.properties?.options || []).find((s) => s.value === e);
|
|
13
|
+
return /* @__PURE__ */ n("p", { className: t.valueText, children: o?.label || String(e) });
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
d as renderCheckboxDisplayValue,
|
|
17
|
+
c as renderDefaultDisplayValue,
|
|
18
|
+
m as renderDropdownDisplayValue,
|
|
19
|
+
u as renderRadioGroupDisplayValue,
|
|
20
|
+
a as renderTextDisplayValue
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { clsx as a } from "clsx";
|
|
4
|
+
import d from "./DisplayModeRenderer.module.css.js";
|
|
5
|
+
import { FormFieldWrapper as m } from "../../../../../../../ui/src/design-system/components/FormFieldWrapper.js";
|
|
6
|
+
import { renderComponentDisplayValue as t } from "../../../utils/componentDisplayValue.js";
|
|
7
|
+
const u = ({
|
|
8
|
+
component: e,
|
|
9
|
+
fieldValue: s
|
|
10
|
+
}) => {
|
|
11
|
+
const l = t(e, s), i = e.properties?.description, o = /* @__PURE__ */ p("div", { className: "form-field-display", children: [
|
|
12
|
+
/* @__PURE__ */ r("div", { className: "rhc-form-field-label", children: e.properties?.label }),
|
|
13
|
+
l,
|
|
14
|
+
i && /* @__PURE__ */ r("p", { className: "rhc-form-field-description", children: i })
|
|
15
|
+
] });
|
|
16
|
+
return /* @__PURE__ */ r(
|
|
17
|
+
m,
|
|
18
|
+
{
|
|
19
|
+
invalid: !1,
|
|
20
|
+
errorMessage: void 0,
|
|
21
|
+
className: a("form-field-wrapper form-field-display-mode", d.displayWrapper),
|
|
22
|
+
input: o
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
u as DisplayModeRenderer
|
|
28
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { clsx as u } from "clsx";
|
|
4
|
+
import v from "./InteractiveFieldRenderer.module.css.js";
|
|
5
|
+
import { FormFieldWrapper as g } from "../../../../../../../ui/src/design-system/components/FormFieldWrapper.js";
|
|
6
|
+
import { adaptComponentForRegistry as y } from "../../../ComponentAdapterComplete/ComponentAdapterComplete.js";
|
|
7
|
+
import { shouldShowValidationError as E, getDisplayErrorMessage as F, markFieldAsUserInteracted as w } from "../../../utils/validationUX.js";
|
|
8
|
+
const O = ({
|
|
9
|
+
component: e,
|
|
10
|
+
field: r,
|
|
11
|
+
readOnly: n,
|
|
12
|
+
needsFormFieldWrapper: d,
|
|
13
|
+
isSubmitAttempted: t,
|
|
14
|
+
onChange: l,
|
|
15
|
+
onBlur: m
|
|
16
|
+
}) => {
|
|
17
|
+
const p = r.state.value, c = r.state.meta.errors || [], f = !r.state.meta.isValid && c.length > 0, s = E(
|
|
18
|
+
r.state.meta,
|
|
19
|
+
t,
|
|
20
|
+
e.id
|
|
21
|
+
// Pass component ID for validation cache
|
|
22
|
+
), a = F(
|
|
23
|
+
r.state.meta,
|
|
24
|
+
t
|
|
25
|
+
), h = y(
|
|
26
|
+
e,
|
|
27
|
+
p,
|
|
28
|
+
l,
|
|
29
|
+
n,
|
|
30
|
+
() => {
|
|
31
|
+
w(e.id), m();
|
|
32
|
+
},
|
|
33
|
+
void 0,
|
|
34
|
+
// errors parameter
|
|
35
|
+
void 0
|
|
36
|
+
// state parameter
|
|
37
|
+
), i = /* @__PURE__ */ o(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
style: { display: "contents" },
|
|
41
|
+
children: h
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
return d ? /* @__PURE__ */ o(
|
|
45
|
+
g,
|
|
46
|
+
{
|
|
47
|
+
invalid: s && f,
|
|
48
|
+
errorMessage: s && a ? a : void 0,
|
|
49
|
+
className: u("form-field-wrapper", v.fieldWrapper),
|
|
50
|
+
input: i
|
|
51
|
+
}
|
|
52
|
+
) : /* @__PURE__ */ o("div", { className: "form-field", children: i });
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
O as InteractiveFieldRenderer
|
|
56
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { resolveTemplateStep as i } from "./templateLoader.js";
|
|
3
|
+
import { isTemplateStep as r } from "../../../../../core/src/types/guards.js";
|
|
4
|
+
async function m(e) {
|
|
5
|
+
const t = {
|
|
6
|
+
next: { label: "Next", enabled: !0 },
|
|
7
|
+
previous: { label: "Previous", enabled: !0 }
|
|
8
|
+
}, l = await Promise.all(
|
|
9
|
+
e.steps.map(async (s, n) => {
|
|
10
|
+
if (r(s)) {
|
|
11
|
+
const a = { ...t };
|
|
12
|
+
n === 0 && (a.previous.enabled = !1), n === e.steps.length - 1 && (a.next.label = "Submit");
|
|
13
|
+
const o = s.stepIndex;
|
|
14
|
+
return await i(
|
|
15
|
+
s,
|
|
16
|
+
a,
|
|
17
|
+
o
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return s;
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
return {
|
|
24
|
+
...e,
|
|
25
|
+
steps: l
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function f(e) {
|
|
29
|
+
return e.steps.some((t) => r(t));
|
|
30
|
+
}
|
|
31
|
+
function d(e) {
|
|
32
|
+
return e.steps.filter(r).map((t) => t.templateId);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
d as getUsedTemplateIds,
|
|
36
|
+
f as hasTemplateSteps,
|
|
37
|
+
m as resolveFormWizardConfig
|
|
38
|
+
};
|