@digiform/wizard 0.2.10 → 0.2.16

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 (154) hide show
  1. package/core/src/types/api.js +12 -0
  2. package/core/src/types/form-config.js +60 -0
  3. package/core/src/types/form-wizard-config-schema.js +113 -0
  4. package/core/src/types/guards.js +19 -0
  5. package/core/src/types/validation.js +61 -0
  6. package/core/src/utils/apiBodyUtils.js +95 -0
  7. package/features/api-integration.d.ts +2 -0
  8. package/features/api-integration.js +17 -0
  9. package/features/dialog-system.d.ts +2 -0
  10. package/features/dialog-system.js +9 -0
  11. package/features/form-runtime.d.ts +2 -0
  12. package/features/form-runtime.js +63 -0
  13. package/features/state-management.d.ts +2 -0
  14. package/features/state-management.js +21 -0
  15. package/features/trigger-action-system.d.ts +2 -0
  16. package/features/trigger-action-system.js +12 -0
  17. package/features/validation-system.d.ts +2 -0
  18. package/features/validation-system.js +23 -0
  19. package/index.js +108 -17470
  20. package/package.json +41 -30
  21. package/styles.css +1 -4
  22. package/ui/src/component-registry/renderComponent.js +11 -0
  23. package/ui/src/components/FormLayout/FormLayout.js +135 -0
  24. package/ui/src/components/FormLayout/FormLayout.module.css.js +20 -0
  25. package/ui/src/components/GridLayout/GridLayout.js +62 -0
  26. package/ui/src/components/GridLayout/GridLayout.module.css.js +16 -0
  27. package/ui/src/components/GridLayoutColumn/GridLayoutColumn.js +37 -0
  28. package/ui/src/components/GridLayoutColumn/GridLayoutColumn.module.css.js +10 -0
  29. package/ui/src/components/ProgressLoaderBar/ProgressLoaderBar.js +108 -0
  30. package/ui/src/components/ProgressLoaderBar/ProgressLoaderBar.module.css.js +20 -0
  31. package/ui/src/components/ProgressLoaderBar/useProgressAnimation.js +31 -0
  32. package/ui/src/components/ValidationCode/ValidationCode.js +198 -0
  33. package/ui/src/components/ValidationCode/ValidationCode.module.css.js +20 -0
  34. package/ui/src/components/alert/alert.js +30 -0
  35. package/ui/src/components/alert/alert.module.css.js +14 -0
  36. package/ui/src/components/badge/badge.js +20 -0
  37. package/ui/src/components/badge/badge.module.css.js +12 -0
  38. package/ui/src/components/box/box.js +8 -0
  39. package/ui/src/components/box/box.module.css.js +8 -0
  40. package/ui/src/components/button/button.js +25 -0
  41. package/ui/src/components/button/button.module.css.js +18 -0
  42. package/ui/src/components/card/card.js +106 -0
  43. package/ui/src/components/card/card.module.css.js +44 -0
  44. package/ui/src/components/checkbox/checkbox.js +20 -0
  45. package/ui/src/components/checkbox/checkbox.module.css.js +10 -0
  46. package/ui/src/components/dialog/dialog.js +67 -0
  47. package/ui/src/components/dialog/dialog.module.css.js +20 -0
  48. package/ui/src/components/form-header-base/form-header-base.js +59 -0
  49. package/ui/src/components/form-header-base/form-header-base.module.css.js +14 -0
  50. package/ui/src/components/input/input.js +20 -0
  51. package/ui/src/components/input/input.module.css.js +8 -0
  52. package/ui/src/components/radio-group/radio-group.js +30 -0
  53. package/ui/src/components/radio-group/radio-group.module.css.js +14 -0
  54. package/ui/src/components/select/select.js +115 -0
  55. package/ui/src/components/select/select.module.css.js +32 -0
  56. package/ui/src/components/sheet/sheet.js +71 -0
  57. package/ui/src/components/sheet/sheet.module.css.js +46 -0
  58. package/ui/src/components/textarea/textarea.js +19 -0
  59. package/ui/src/components/textarea/textarea.module.css.js +8 -0
  60. package/ui/src/design-system/components/FormFieldWrapper.js +16 -0
  61. package/ui/src/lib/assets/icons/Check.js +26 -0
  62. package/ui/src/lib/assets/icons/ChevronRight.js +26 -0
  63. package/ui/src/lib/error-boundaries/BaseErrorBoundary.js +155 -0
  64. package/ui/src/lib/error-boundaries/ComponentErrorBoundary.js +153 -0
  65. package/ui/src/lib/error-boundaries/FormWizardErrorBoundary.js +107 -0
  66. package/ui/src/lib/logger.js +106 -0
  67. package/ui/src/lib/providers/FormEditingContext.js +21 -0
  68. package/ui/src/lib/queryClient.js +26 -0
  69. package/ui/src/lib/types/guards.js +11 -0
  70. package/ui/src/lib/utils/componentUtils.js +38 -0
  71. package/ui/src/lib/utils/templateDialogResolver.js +85 -0
  72. package/ui/src/lib/utils/templateUtils.js +52 -0
  73. package/ui/src/theme/ThemeProvider.js +15 -0
  74. package/wizard/src/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.js +370 -0
  75. package/wizard/src/features/api-integration/services/ActionExecutor.js +339 -0
  76. package/wizard/src/features/api-integration/services/ApiCallExecutor.js +6 -0
  77. package/wizard/src/features/api-integration/services/ApiCallService.js +309 -0
  78. package/wizard/src/features/api-integration/services/DialogExecutor.js +6 -0
  79. package/wizard/src/features/api-integration/services/GenericTriggerService.js +284 -0
  80. package/wizard/src/features/api-integration/services/NavigationExecutor.js +6 -0
  81. package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +115 -0
  82. package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.module.css.js +29 -0
  83. package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +64 -0
  84. package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.module.css.js +22 -0
  85. package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +149 -0
  86. package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.module.css.js +40 -0
  87. package/wizard/src/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.js +107 -0
  88. package/wizard/src/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.module.css.js +10 -0
  89. package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +107 -0
  90. package/wizard/src/features/form-runtime/FormWizard/FormWizard.module.css.js +16 -0
  91. package/wizard/src/features/form-runtime/components/FormField.js +405 -0
  92. package/wizard/src/features/form-runtime/components/FormFooter.js +209 -0
  93. package/wizard/src/features/form-runtime/components/FormHeader.js +29 -0
  94. package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +279 -0
  95. package/wizard/src/features/form-runtime/components/FormSection/FormSection.module.css.js +20 -0
  96. package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +167 -0
  97. package/wizard/src/features/form-runtime/components/FormStep/FormStep.module.css.js +12 -0
  98. package/wizard/src/features/form-runtime/components/ProgressLoaderRuntime.js +88 -0
  99. package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +61 -0
  100. package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.module.css.js +34 -0
  101. package/wizard/src/features/form-runtime/components/displayValue/displayValue.js +21 -0
  102. package/wizard/src/features/form-runtime/components/displayValue/displayValue.module.css.js +10 -0
  103. package/wizard/src/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.js +28 -0
  104. package/wizard/src/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.module.css.js +8 -0
  105. package/wizard/src/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.js +56 -0
  106. package/wizard/src/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.module.css.js +8 -0
  107. package/wizard/src/features/form-runtime/config/configResolver.js +38 -0
  108. package/wizard/src/features/form-runtime/config/templateConfig.js +156 -0
  109. package/wizard/src/features/form-runtime/config/templateLoader.js +265 -0
  110. package/wizard/src/features/form-runtime/config/templateUtils.js +14 -0
  111. package/wizard/src/features/form-runtime/context/LoaderContext.js +36 -0
  112. package/wizard/src/features/form-runtime/hooks/useApiActions.js +60 -0
  113. package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +102 -0
  114. package/wizard/src/features/form-runtime/hooks/useComponentVisibility.js +18 -0
  115. package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +61 -0
  116. package/wizard/src/features/form-runtime/hooks/useFormContext.js +13 -0
  117. package/wizard/src/features/form-runtime/hooks/useFormFieldState.js +40 -0
  118. package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +39 -0
  119. package/wizard/src/features/form-runtime/utils/componentDisplayValue.js +22 -0
  120. package/wizard/src/features/form-runtime/utils/errorUtils.js +93 -0
  121. package/wizard/src/features/form-runtime/utils/fieldHelpers.js +17 -0
  122. package/wizard/src/features/form-runtime/utils/formDataBuilder.js +10 -0
  123. package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +52 -0
  124. package/wizard/src/features/form-runtime/utils/logger.js +111 -0
  125. package/wizard/src/features/form-runtime/utils/validation.js +100 -0
  126. package/wizard/src/features/form-runtime/utils/validationUX.js +58 -0
  127. package/wizard/src/features/form-runtime/utils/visibilityUtils.js +77 -0
  128. package/wizard/src/features/state-management/machines/actions/componentActions.js +215 -0
  129. package/wizard/src/features/state-management/machines/actions/navigationActions.js +122 -0
  130. package/wizard/src/features/state-management/machines/actions/saveActions.js +101 -0
  131. package/wizard/src/features/state-management/machines/componentTriggerEngine.js +598 -0
  132. package/wizard/src/features/state-management/machines/formMachine.js +1565 -0
  133. package/wizard/src/features/state-management/machines/guards/navigationGuards.js +59 -0
  134. package/wizard/src/features/state-management/machines/guards/saveGuards.js +21 -0
  135. package/wizard/src/features/state-management/machines/guards/triggerGuards.js +11 -0
  136. package/wizard/src/features/state-management/machines/helpers/triggerHelpers.js +12 -0
  137. package/wizard/src/features/state-management/machines/performance.js +56 -0
  138. package/wizard/src/features/state-management/machines/useFormMachine.js +412 -0
  139. package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.js +46 -0
  140. package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.module.css.js +30 -0
  141. package/wizard/src/features/trigger-action-system/components/ActionManager.js +108 -0
  142. package/wizard/src/features/trigger-action-system/components/ComponentAlert/ComponentAlert.js +10 -0
  143. package/wizard/src/features/trigger-action-system/components/ComponentAlert/ComponentAlert.module.css.js +8 -0
  144. package/wizard/src/features/trigger-action-system/utils/GenericTriggerEngine.js +376 -0
  145. package/wizard/src/features/validation-system/components/ValidationDebugger.js +69 -0
  146. package/wizard/src/features/validation-system/validation/ActionValidation.js +234 -0
  147. package/wizard/src/features/validation-system/validation/SchemaBuilder.js +239 -0
  148. package/wizard/src/features/validation-system/validation/ValidationCache.js +76 -0
  149. package/wizard/src/features/validation-system/validation/ValidationEngine.js +97 -0
  150. package/wizard/src/features/validation-system/validation/ValidationExecutor.js +138 -0
  151. package/wizard/src/features/validation-system/validation/tanstackSchemaAdapter.js +17 -0
  152. package/wizard/src/features/validation-system/validation/validationService.js +74 -0
  153. package/wizard/src/renderer/wizardRenderer.js +123 -0
  154. package/README.md +0 -147
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ const o = "fb-dialogContent_hdJb3", e = "fb-headerRow_dowgv", n = "fb-iconSuccess_787to", t = "fb-iconMail_yICFX", c = "fb-successButtonRow_LilmE", s = "fb-minWidthButton_Y-HfD", d = "fb-formContent_DRlgi", i = "fb-codeSection_vJqzI", f = "fb-codeLabel_PvgkB", b = "fb-codeCenter_j2TST", r = "fb-resendText_fsAeq", u = "fb-blockedText_ZGaBs", l = "fb-resendLink_dRMub", a = "fb-resendLinkDefault_sVy7D", _ = "fb-footerButtonRow_dFkH0", k = "fb-iconSm_JkMbO", B = "fb-iconMd_y--1E", R = {
3
+ dialogContent: o,
4
+ headerRow: e,
5
+ iconSuccess: n,
6
+ iconMail: t,
7
+ successButtonRow: c,
8
+ minWidthButton: s,
9
+ formContent: d,
10
+ codeSection: i,
11
+ codeLabel: f,
12
+ codeCenter: b,
13
+ resendText: r,
14
+ blockedText: u,
15
+ resendLink: l,
16
+ resendLinkDefault: a,
17
+ footerButtonRow: _,
18
+ iconSm: k,
19
+ iconMd: B
20
+ };
21
+ export {
22
+ u as blockedText,
23
+ b as codeCenter,
24
+ f as codeLabel,
25
+ i as codeSection,
26
+ R as default,
27
+ o as dialogContent,
28
+ _ as footerButtonRow,
29
+ d as formContent,
30
+ e as headerRow,
31
+ t as iconMail,
32
+ B as iconMd,
33
+ k as iconSm,
34
+ n as iconSuccess,
35
+ s as minWidthButton,
36
+ l as resendLink,
37
+ a as resendLinkDefault,
38
+ r as resendText,
39
+ c as successButtonRow
40
+ };
@@ -0,0 +1,107 @@
1
+ "use client";
2
+ import { jsx as l, jsxs as m } from "react/jsx-runtime";
3
+ import c from "./ComponentAdapterComplete.module.css.js";
4
+ import { FormFieldWrapper as x } from "../../../../../ui/src/design-system/components/FormFieldWrapper.js";
5
+ /* empty css */
6
+ import { renderComponent as C } from "../../../../../ui/src/component-registry/renderComponent.js";
7
+ const a = {
8
+ text: "text",
9
+ date: "date",
10
+ tel: "tel",
11
+ email: "email",
12
+ number: "number",
13
+ checkbox: "checkbox",
14
+ radioGroup: "radioGroup",
15
+ dropdown: "dropdown",
16
+ button: "button",
17
+ heading: "heading",
18
+ paragraph: "paragraph",
19
+ alert: "alert",
20
+ password: "password",
21
+ textarea: "textarea",
22
+ range: "range",
23
+ time: "time",
24
+ "datetime-local": "datetime-local",
25
+ radio: "radio",
26
+ select: "select",
27
+ file: "file",
28
+ hidden: "hidden",
29
+ submit: "submit",
30
+ reset: "reset",
31
+ "code-input": "code-input",
32
+ "progress-loader": "progress-loader"
33
+ }, F = (e) => a[e] ? a[e] : (console.warn(
34
+ `⚠️ [ComponentAdapter] Component type "${e}" not found in TYPE_MAP, falling back to "text". Available types: ${Object.keys(a).join(", ")}`
35
+ ), "text"), O = (e) => e.map((r) => ({
36
+ id: r.id,
37
+ field: r.field || r.targetComponentId || "",
38
+ // Ensure field is always set
39
+ targetStepId: r.targetStepId || "",
40
+ // Default empty as form wizard doesn't have this concept
41
+ targetComponentId: r.field || r.targetComponentId,
42
+ // Map field to targetComponentId
43
+ operator: w(r.operator),
44
+ value: r.value,
45
+ logicalOperator: r.logicalOperator
46
+ })), v = {
47
+ equals: "equals",
48
+ notEquals: "notEquals",
49
+ contains: "contains",
50
+ empty: "empty",
51
+ notEmpty: "notEmpty"
52
+ }, w = (e) => v[e] || "equals", I = [
53
+ "heading",
54
+ "paragraph",
55
+ "alert",
56
+ "button",
57
+ "progress-loader"
58
+ ], _ = (e, r, u, g, o, f, y) => {
59
+ try {
60
+ const t = F(e.type), h = {
61
+ // Base component properties
62
+ ...e,
63
+ // Override the type with the mapped version
64
+ type: t,
65
+ // Spread all properties from component.properties to the top level for backward compatibility
66
+ ...e.properties,
67
+ // Add onBlur if provided
68
+ ...o && { onBlur: o },
69
+ // Keep the properties object with potential overrides
70
+ properties: {
71
+ ...e.properties,
72
+ // Also set readOnly in the nested properties object
73
+ readOnly: g ?? e.properties?.readOnly ?? !1,
74
+ // Add onBlur to nested properties if provided
75
+ ...o && { onBlur: o }
76
+ },
77
+ // Convert conditions if they exist
78
+ conditions: e.conditions ? O(e.conditions) : void 0
79
+ }, s = C({
80
+ component: h,
81
+ value: r,
82
+ onChange: u,
83
+ isFormView: !0
84
+ }), E = !I.includes(t), n = e.id, i = f?.[n], p = y?.context?.fieldStates?.[n]?.error, d = e.properties?.errorMessage || i || p, b = e.properties?.invalid === !0 || !!i || !!p;
85
+ return E ? /* @__PURE__ */ l(
86
+ x,
87
+ {
88
+ invalid: b,
89
+ errorMessage: typeof d == "string" ? d : void 0,
90
+ className: "form-field-wrapper",
91
+ input: s
92
+ }
93
+ ) : s;
94
+ } catch (t) {
95
+ return console.error("Error rendering component with registry:", t), /* @__PURE__ */ m("div", { className: c.errorFallback, children: [
96
+ /* @__PURE__ */ m("p", { children: [
97
+ "Failed to render component: ",
98
+ e.type
99
+ ] }),
100
+ /* @__PURE__ */ l("p", { className: c.errorDetail, children: t instanceof Error ? t.message : String(t) })
101
+ ] });
102
+ }
103
+ };
104
+ export {
105
+ _ as adaptComponentForRegistry,
106
+ _ as default
107
+ };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ const r = "fb-errorFallback_CNx1M", e = "fb-errorDetail_Nvh9V", l = {
3
+ errorFallback: r,
4
+ errorDetail: e
5
+ };
6
+ export {
7
+ l as default,
8
+ e as errorDetail,
9
+ r as errorFallback
10
+ };
@@ -0,0 +1,107 @@
1
+ "use client";
2
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
3
+ import { useFormMachineProvider as E, FormMachineContext as z } from "../../state-management/machines/useFormMachine.js";
4
+ import { ActionManager as M } from "../../trigger-action-system/components/ActionManager.js";
5
+ /* empty css */
6
+ import { FormLayout as s } from "../../../../../ui/src/components/FormLayout/FormLayout.js";
7
+ import { formWizardQueryClient as N } from "../../../../../ui/src/lib/queryClient.js";
8
+ import { QueryClientProvider as W } from "@tanstack/react-query";
9
+ import { clsx as g } from "clsx";
10
+ import { memo as w, useState as h, useEffect as L, useMemo as u } from "react";
11
+ import n from "./FormWizard.module.css.js";
12
+ import P from "../components/FormStep/FormStep.js";
13
+ import T from "../components/StepProgressIndicator/StepProgressIndicator.js";
14
+ import { hasTemplateSteps as I, resolveFormWizardConfig as x } from "../config/configResolver.js";
15
+ import { ThemeProvider as b, useThemeConfig as U } from "../../../../../ui/src/theme/ThemeProvider.js";
16
+ import j from "../../../../../ui/src/lib/error-boundaries/FormWizardErrorBoundary.js";
17
+ import { FormEditingProvider as O } from "../../../../../ui/src/lib/providers/FormEditingContext.js";
18
+ import m from "../../../../../ui/src/lib/error-boundaries/ComponentErrorBoundary.js";
19
+ import { ValidationEngine as V } from "../../validation-system/validation/ValidationEngine.js";
20
+ import { Heading as k } from "@rijkshuisstijl-community/components-react";
21
+ const v = w(
22
+ ({
23
+ config: r,
24
+ initialData: a = {},
25
+ onSubmit: y,
26
+ queryClient: C = N
27
+ }) => {
28
+ console.log(
29
+ "🏁 [FormWizard] FormWizardCore component MOUNTING with config:",
30
+ {
31
+ configId: r.id,
32
+ configTitle: r.title,
33
+ stepCount: r.steps?.length,
34
+ validationMessageStyle: r.validationMessageStyle,
35
+ hasInitialData: Object.keys(a).length > 0
36
+ }
37
+ ), typeof window < "u" && setTimeout(() => {
38
+ console.log(
39
+ "🚨 [FormWizard] MOUNTED SUCCESSFULLY - Check console for detailed logs"
40
+ );
41
+ }, 100);
42
+ const [t, d] = h(null), [c, f] = h(null);
43
+ L(() => {
44
+ (async () => {
45
+ try {
46
+ if (f(null), I(r)) {
47
+ const o = await x(r);
48
+ d(o);
49
+ } else
50
+ d(r);
51
+ } catch (o) {
52
+ f(
53
+ o instanceof Error ? o.message : "Failed to resolve configuration"
54
+ ), console.error("Error resolving form configuration:", o);
55
+ }
56
+ })();
57
+ }, [r]);
58
+ const p = u(() => {
59
+ console.log(
60
+ "🚀 [FormWizard] Creating ValidationEngine with messageStyle:",
61
+ r.validationMessageStyle || "withLabel"
62
+ );
63
+ const i = new V({
64
+ messageStyle: r.validationMessageStyle || "withLabel"
65
+ });
66
+ return console.log("✅ [FormWizard] ValidationEngine created:", {
67
+ engine: !!i,
68
+ validateField: typeof i.validateField,
69
+ messageStyle: r.validationMessageStyle || "withLabel"
70
+ }), i;
71
+ }, [r.validationMessageStyle]), S = u(() => t ? {
72
+ ...t,
73
+ steps: t.steps.map((i) => {
74
+ const o = i;
75
+ return {
76
+ ...o,
77
+ schema: o.schema || p.getStepSchema(o)
78
+ };
79
+ })
80
+ } : null, [t, p]), F = E({
81
+ config: S || r,
82
+ // Fallback to original config if resolution fails
83
+ initialData: a,
84
+ onSubmit: y
85
+ });
86
+ return c ? /* @__PURE__ */ l("div", { className: g("form-wizard-error", n.errorState), children: [
87
+ /* @__PURE__ */ e("h3", { className: n.errorHeading, children: "Configuration Error" }),
88
+ /* @__PURE__ */ e("p", { children: c })
89
+ ] }) : t ? /* @__PURE__ */ e(W, { client: C, children: /* @__PURE__ */ e(j, { formId: r.id, children: /* @__PURE__ */ e(O, { children: /* @__PURE__ */ l(z.Provider, { value: F, children: [
90
+ /* @__PURE__ */ e(m, { componentName: "ActionManager", children: /* @__PURE__ */ e(M, {}) }),
91
+ /* @__PURE__ */ l(s, { className: n.formLayout, children: [
92
+ /* @__PURE__ */ e(s.Title, { children: /* @__PURE__ */ e(k, { level: 1, children: r.title }) }),
93
+ /* @__PURE__ */ e(s.LeftColumn, { children: /* @__PURE__ */ e(m, { componentName: "StepProgressIndicator", children: /* @__PURE__ */ e(T, {}) }) }),
94
+ /* @__PURE__ */ e(m, { componentName: "FormStep", children: /* @__PURE__ */ e(P, {}) })
95
+ ] })
96
+ ] }) }) }) }) : /* @__PURE__ */ e("div", { className: g("form-wizard-loading", n.loadingState), children: /* @__PURE__ */ e("div", { className: n.loadingPulse, children: "Loading form templates..." }) });
97
+ }
98
+ );
99
+ v.displayName = "FormWizardCore";
100
+ const A = (r) => {
101
+ const a = U();
102
+ return /* @__PURE__ */ e(b, { config: a, children: /* @__PURE__ */ e(v, { ...r }) });
103
+ };
104
+ A.displayName = "FormWizard";
105
+ export {
106
+ A as default
107
+ };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ const o = "fb-errorState_khSRW", t = "fb-errorHeading_dGdN2", e = "fb-loadingState_Pdhds", r = "fb-loadingPulse_QIw08", a = "fb-formLayout_JzC8E", n = {
3
+ errorState: o,
4
+ errorHeading: t,
5
+ loadingState: e,
6
+ loadingPulse: r,
7
+ formLayout: a
8
+ };
9
+ export {
10
+ n as default,
11
+ t as errorHeading,
12
+ o as errorState,
13
+ a as formLayout,
14
+ r as loadingPulse,
15
+ e as loadingState
16
+ };
@@ -0,0 +1,405 @@
1
+ "use client";
2
+ import { jsx as n, jsxs as p } from "react/jsx-runtime";
3
+ import { useFormMachine as M } from "../../state-management/machines/useFormMachine.js";
4
+ import { ComponentAlerts as F } from "../../trigger-action-system/components/ComponentAlert/ComponentAlert.js";
5
+ /* empty css */
6
+ import { memo as N, useMemo as x } from "react";
7
+ import { adaptComponentForRegistry as _ } from "../ComponentAdapterComplete/ComponentAdapterComplete.js";
8
+ import { useComponentTriggers as B } from "../hooks/useComponentTriggers.js";
9
+ import { useComponentVisibility as H } from "../hooks/useComponentVisibility.js";
10
+ import { useFieldEventHandlers as O } from "../hooks/useFieldEventHandlers.js";
11
+ import { useFormContext as U } from "../hooks/useFormContext.js";
12
+ import { useFormFieldState as G } from "../hooks/useFormFieldState.js";
13
+ import { useValidationEvents as z } from "../hooks/useValidationEvents.js";
14
+ import { checkHasIsDirtyTriggers as P, shouldBeFormField as j, checkFieldHasValue as q, getValidationDisplayState as J, shouldShowComponentAlerts as W, shouldShowDisplayMode as X } from "../utils/fieldHelpers.js";
15
+ import { logger as e } from "../utils/logger.js";
16
+ import { updateValidationCache as C } from "../utils/validationUX.js";
17
+ import { ProgressLoaderRuntime as Z } from "./ProgressLoaderRuntime.js";
18
+ import { DisplayModeRenderer as K } from "./renderers/DisplayModeRenderer/DisplayModeRenderer.js";
19
+ import { InteractiveFieldRenderer as Q } from "./renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.js";
20
+ import Y from "../../../../../ui/src/lib/error-boundaries/ComponentErrorBoundary.js";
21
+ const ii = N(
22
+ ({ component: i, readOnly: V = !1 }) => {
23
+ const [D, ai, g] = M(), c = U(), { isVisible: T } = H({
24
+ visibilityConditions: i.visibilityConditions,
25
+ formData: D.context.data
26
+ }), { forceShowValidation: A, resetValidationState: $ } = z({
27
+ componentId: i.id
28
+ }), y = P(i), { originalValueFromMachine: b, initializeField: R, getEnhancedIsDirty: S } = G({
29
+ componentId: i.id,
30
+ hasIsDirtyTriggers: y
31
+ }), { handleChange: L, handleBlur: k } = O({
32
+ componentId: i.id,
33
+ hasIsDirtyTriggers: y,
34
+ originalValueFromMachine: b,
35
+ getEnhancedIsDirty: S,
36
+ resetValidationState: $
37
+ }), f = B({
38
+ componentId: i.id
39
+ }), m = x(() => {
40
+ const a = g.validationEngine;
41
+ return e.debug(`ValidationEngine instance check for ${i.id}:`, {
42
+ validationEngine: !!a,
43
+ validationEngineType: typeof a,
44
+ hasValidateField: !!a?.validateField,
45
+ engineConstructor: a?.constructor?.name
46
+ }), ({ value: t }) => {
47
+ const l = `${i.id}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
48
+ try {
49
+ if (e.validation(
50
+ `VALIDATION START [${l}] for ${i.id}:`,
51
+ {
52
+ componentType: i.type,
53
+ componentId: i.id,
54
+ value: t,
55
+ valueType: typeof t,
56
+ valueLength: typeof t == "string" ? t.length : "N/A",
57
+ hasValidation: !!i.validation,
58
+ validationRules: i.validation,
59
+ validationEngineExists: !!a,
60
+ validatorCallId: l
61
+ }
62
+ ), !i.validation)
63
+ if (i.type === "email")
64
+ e.validation(
65
+ `Email component ${i.id} [${l}] has no explicit validation rules but will be validated for email format`
66
+ );
67
+ else {
68
+ e.validation(
69
+ `No validation rules for ${i.id} [${l}], returning VALID (undefined)`
70
+ ), C(i.id, !0);
71
+ return;
72
+ }
73
+ let s = t;
74
+ i.type === "radioGroup" && t === null && (s = "", e.debug(
75
+ `Normalized radio group null value to empty string for ${i.id} [${l}]`
76
+ )), e.validation(
77
+ `About to call ValidationEngine.validateField [${l}] for ${i.id}:`,
78
+ {
79
+ componentConfig: {
80
+ id: i.id,
81
+ type: i.type,
82
+ validation: i.validation
83
+ },
84
+ normalizedValue: s,
85
+ validationEngineMethod: typeof a.validateField
86
+ }
87
+ );
88
+ const d = a.validateField(
89
+ i,
90
+ s
91
+ );
92
+ e.validation(
93
+ `ValidationEngine.validateField result [${l}] for ${i.id}:`,
94
+ {
95
+ result: d,
96
+ resultType: typeof d,
97
+ resultIsValid: d?.isValid,
98
+ resultErrors: d?.errors,
99
+ resultValue: d?.value,
100
+ errorsLength: d?.errors?.length
101
+ }
102
+ );
103
+ const u = (d.errors || []).length === 0;
104
+ C(i.id, u);
105
+ let o;
106
+ return u ? o = void 0 : (d.errors || []).length === 1 ? o = (d.errors || [])[0] : o = d.errors || [], e.validation(
107
+ `VALIDATION END [${l}] for ${i.id}:`,
108
+ {
109
+ originalValue: t,
110
+ normalizedValue: s,
111
+ validationEngineResult: d,
112
+ isValidCalculated: u,
113
+ errors: d.errors,
114
+ hasValidationRules: !!i.validation,
115
+ returnValueToTanStack: o,
116
+ returnValueType: typeof o,
117
+ validatorCallId: l,
118
+ // 🚨 CRITICAL VALIDATION CHECK:
119
+ EXPECTED_BEHAVIOR: i.id === "username" && t === "dd" ? "Should be INVALID (length 2, minLength 3)" : "Normal validation",
120
+ ACTUAL_RESULT: u ? "VALID" : "INVALID",
121
+ CRITICAL_ISSUE_DETECTED: i.id === "username" && t === "dd" && u
122
+ }
123
+ ), i.id === "username" && t === "dd" && o === void 0 && e.critical(
124
+ `CRITICAL BUG DETECTED [${l}]: ValidationEngine incorrectly validated "dd" as VALID for username field!`,
125
+ {
126
+ value: "dd",
127
+ expectedLength: 3,
128
+ actualLength: 2,
129
+ validationRules: i.validation,
130
+ validationEngineResult: d,
131
+ schemaUsed: "Check ValidationEngine.getComponentSchema",
132
+ possibleCauses: [
133
+ "Schema generation error",
134
+ "ValidationEngine bug",
135
+ "Zod schema not properly created"
136
+ ]
137
+ }
138
+ ), o;
139
+ } catch (s) {
140
+ return e.error(
141
+ `Validation ERROR [${l}] for ${i.id}:`,
142
+ s
143
+ ), e.error(`ValidationEngine state [${l}]:`, {
144
+ validationEngine: !!a,
145
+ validateFieldMethod: typeof a?.validateField,
146
+ componentValidation: i.validation,
147
+ value: t
148
+ }), "Validation failed";
149
+ }
150
+ };
151
+ }, [i.validation, g.validationEngine, i]);
152
+ R(), e.lifecycle(`Component MOUNTED for ${i.id}:`, {
153
+ componentId: i.id,
154
+ componentType: i.type,
155
+ hasValidation: !!i.validation,
156
+ validationRules: i.validation,
157
+ validationEngineExists: !!g.validationEngine
158
+ });
159
+ const w = j(i);
160
+ if (i.validation && g.validationEngine)
161
+ try {
162
+ const a = g.validationEngine.validateField(
163
+ i,
164
+ ""
165
+ ), t = g.validationEngine.validateField(
166
+ i,
167
+ i.type === "radioGroup" ? "option-2" : "test"
168
+ );
169
+ e.test(`VALIDATION ENGINE TEST for ${i.id}:`, {
170
+ componentType: i.type,
171
+ hasValidation: !!i.validation,
172
+ emptyTest: {
173
+ isValid: a.isValid,
174
+ errors: a.errors
175
+ },
176
+ validTest: {
177
+ isValid: t.isValid,
178
+ errors: t.errors
179
+ }
180
+ });
181
+ } catch (a) {
182
+ e.error(
183
+ `ValidationEngine test failed for ${i.id}:`,
184
+ a
185
+ );
186
+ }
187
+ const I = !!(i.validation || i.required !== void 0);
188
+ return /* @__PURE__ */ n(
189
+ "div",
190
+ {
191
+ style: {
192
+ display: T ? "block" : "none"
193
+ },
194
+ "data-component-id": i.id,
195
+ "data-visible": T,
196
+ children: /* @__PURE__ */ n(
197
+ Y,
198
+ {
199
+ componentName: `FormField-${i.type}-${i.id}`,
200
+ children: w ? /* @__PURE__ */ n(
201
+ c.Field,
202
+ {
203
+ name: i.id,
204
+ validators: {
205
+ onChange: m,
206
+ onBlur: m
207
+ },
208
+ defaultMeta: {
209
+ // VALIDATION UX FIX: Prevent fields from being marked as touched initially
210
+ // This ensures validation errors don't show until user actually interacts with the field
211
+ isTouched: !1
212
+ },
213
+ children: (a) => {
214
+ const t = a.state.value, l = S(
215
+ t,
216
+ a.state.meta.isDirty
217
+ );
218
+ if (e.state(`TanStack Form field state for ${i.id}:`, {
219
+ componentId: i.id,
220
+ fieldValue: t,
221
+ fieldValueType: typeof t,
222
+ fieldMeta: {
223
+ isValid: a.state.meta.isValid,
224
+ isDirty: a.state.meta.isDirty,
225
+ isTouched: a.state.meta.isTouched,
226
+ errors: a.state.meta.errors
227
+ },
228
+ formCanSubmit: c.state.canSubmit,
229
+ formIsValid: c.state.isValid
230
+ }), i.validation)
231
+ try {
232
+ const r = m({
233
+ value: t
234
+ }), v = r === void 0 !== a.state.meta.isValid, E = {
235
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
236
+ componentId: i.id,
237
+ currentFieldValue: t,
238
+ fieldValueType: typeof t,
239
+ validatorDirectResult: r,
240
+ validatorDirectResultType: typeof r,
241
+ tanStackFormIsValid: a.state.meta.isValid,
242
+ tanStackFormErrors: a.state.meta.errors,
243
+ tanStackFormErrorsLength: (a.state.meta.errors || []).length,
244
+ validatorSaysValid: r === void 0,
245
+ tanStackFormSaysValid: a.state.meta.isValid,
246
+ MISMATCH: v,
247
+ validationRules: i.validation,
248
+ // Test specific values that are problematic
249
+ ...t === "dd" && {
250
+ SPECIFIC_DD_TEST: {
251
+ description: 'Testing problematic "dd" value',
252
+ validatorResult: r,
253
+ tanStackResult: a.state.meta.isValid,
254
+ CRITICAL_MISMATCH: r === void 0 !== a.state.meta.isValid,
255
+ expectedBehavior: "Should be INVALID (length 2, min required 3)"
256
+ }
257
+ }
258
+ };
259
+ if (e.critical(
260
+ `Validator vs TanStack Form mismatch test for ${i.id}:`,
261
+ E
262
+ ), typeof window < "u" && window.localStorage)
263
+ try {
264
+ const h = JSON.parse(
265
+ window.localStorage.getItem(
266
+ "validation_debug_logs"
267
+ ) || "[]"
268
+ );
269
+ h.push(E), window.localStorage.setItem(
270
+ "validation_debug_logs",
271
+ JSON.stringify(h.slice(-50))
272
+ );
273
+ } catch (h) {
274
+ console.warn(
275
+ "Could not save debug logs to localStorage:",
276
+ h
277
+ );
278
+ }
279
+ if (v) {
280
+ e.critical(
281
+ `VALIDATION MISMATCH DETECTED for ${i.id}:`,
282
+ {
283
+ description: "Validator function and TanStack Form disagree on validation state",
284
+ validatorSaysValid: r === void 0,
285
+ tanStackSaysValid: a.state.meta.isValid,
286
+ debugInfo: E,
287
+ possibleCauses: [
288
+ "Validator function return value not properly understood by TanStack Form",
289
+ "Cached validation state in TanStack Form",
290
+ "Validator function called with different value than TanStack Form has",
291
+ "Multiple validators running with different logic",
292
+ "TanStack Form validator configuration issue"
293
+ ],
294
+ nextSteps: [
295
+ "Check TanStack Form validator configuration",
296
+ "Verify return value format (undefined vs string/array)",
297
+ "Check for validator caching issues",
298
+ "Test validator function in isolation"
299
+ ]
300
+ }
301
+ );
302
+ try {
303
+ e.debug(
304
+ `Attempting to force revalidation for ${i.id}`
305
+ ), a.handleChange(t);
306
+ } catch (h) {
307
+ e.error(
308
+ "Failed to force revalidation:",
309
+ h
310
+ );
311
+ }
312
+ }
313
+ } catch (r) {
314
+ e.error(
315
+ `Validator direct test FAILED for ${i.id}:`,
316
+ r
317
+ );
318
+ }
319
+ const s = q(t, i.type), d = X(
320
+ V,
321
+ s
322
+ ), { isSubmitAttempted: u } = J(
323
+ a.state.meta,
324
+ c.state,
325
+ A
326
+ ), o = W(
327
+ y,
328
+ l,
329
+ f.alerts.length
330
+ );
331
+ return d && I ? /* @__PURE__ */ p("div", { children: [
332
+ /* @__PURE__ */ n(
333
+ K,
334
+ {
335
+ component: i,
336
+ fieldValue: t
337
+ }
338
+ ),
339
+ o && f.alerts.length > 0 && /* @__PURE__ */ n(F, { alerts: f.alerts })
340
+ ] }) : /* @__PURE__ */ p("div", { children: [
341
+ /* @__PURE__ */ n(
342
+ Q,
343
+ {
344
+ component: i,
345
+ field: a,
346
+ readOnly: V,
347
+ needsFormFieldWrapper: I,
348
+ isSubmitAttempted: u,
349
+ onChange: (r) => {
350
+ e.change(`onChange triggered for ${i.id}:`, {
351
+ newValue: r,
352
+ previousValue: t,
353
+ valueType: typeof r
354
+ });
355
+ const v = Array.isArray(r) ? r.length > 0 ? r[0] : null : r;
356
+ e.change(`Converted value for ${i.id}:`, {
357
+ originalValue: r,
358
+ sharedValue: v,
359
+ sharedValueType: typeof v
360
+ }), L(a)(v);
361
+ },
362
+ onBlur: k(a)
363
+ }
364
+ ),
365
+ o && f.alerts.length > 0 && /* @__PURE__ */ n(F, { alerts: f.alerts })
366
+ ] });
367
+ }
368
+ }
369
+ ) : i.type === "progress-loader" ? (
370
+ // Special handling for progress-loader: use runtime wrapper for auto-start
371
+ /* @__PURE__ */ n(
372
+ Z,
373
+ {
374
+ properties: i.properties || {}
375
+ }
376
+ )
377
+ ) : (
378
+ // For display-only components, render directly without form.Field wrapper
379
+ _(
380
+ i,
381
+ null,
382
+ // no form value
383
+ () => {
384
+ },
385
+ // no onChange handler
386
+ V,
387
+ () => {
388
+ },
389
+ // no onBlur handler
390
+ void 0,
391
+ // no errors
392
+ void 0
393
+ // no state
394
+ )
395
+ )
396
+ }
397
+ )
398
+ }
399
+ );
400
+ }
401
+ );
402
+ ii.displayName = "FormField";
403
+ export {
404
+ ii as default
405
+ };