@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,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { isTemplateStep as d } from "../../../../../ui/src/lib/types/guards.js";
|
|
4
|
+
class u {
|
|
5
|
+
schemaBuilder;
|
|
6
|
+
constructor(t) {
|
|
7
|
+
this.schemaBuilder = t;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Validates a single field
|
|
11
|
+
*/
|
|
12
|
+
async validateField(t, i) {
|
|
13
|
+
try {
|
|
14
|
+
const e = await i.parseAsync(t);
|
|
15
|
+
return {
|
|
16
|
+
isValid: !0,
|
|
17
|
+
errors: [],
|
|
18
|
+
value: e
|
|
19
|
+
};
|
|
20
|
+
} catch (e) {
|
|
21
|
+
let r = [];
|
|
22
|
+
return e && typeof e == "object" && "errors" in e ? r = e.errors.map((a) => a.message) : r = ["Validation failed"], {
|
|
23
|
+
isValid: !1,
|
|
24
|
+
errors: r,
|
|
25
|
+
value: t
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validates a single field synchronously
|
|
31
|
+
*/
|
|
32
|
+
validateFieldSync(t, i) {
|
|
33
|
+
let e = t;
|
|
34
|
+
t == null && (e = ""), console.log("🔍 [ValidationExecutor] validateFieldSync input:", {
|
|
35
|
+
originalValue: t,
|
|
36
|
+
normalizedValue: e,
|
|
37
|
+
valueType: typeof t,
|
|
38
|
+
normalizedValueType: typeof e,
|
|
39
|
+
valueLength: typeof e == "string" ? e.length : "N/A",
|
|
40
|
+
schema: i._def
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
const r = i.parse(e);
|
|
44
|
+
return console.log("🔍 [ValidationExecutor] validateFieldSync SUCCESS:", {
|
|
45
|
+
value: t,
|
|
46
|
+
result: r,
|
|
47
|
+
isValid: !0
|
|
48
|
+
}), {
|
|
49
|
+
isValid: !0,
|
|
50
|
+
errors: [],
|
|
51
|
+
value: r
|
|
52
|
+
};
|
|
53
|
+
} catch (r) {
|
|
54
|
+
console.log("🔍 [ValidationExecutor] validateFieldSync ERROR:", {
|
|
55
|
+
value: t,
|
|
56
|
+
error: r,
|
|
57
|
+
errorType: typeof r
|
|
58
|
+
});
|
|
59
|
+
let s = [];
|
|
60
|
+
if (r && typeof r == "object" && "errors" in r) {
|
|
61
|
+
const a = r;
|
|
62
|
+
s = a.errors.map((o) => o.message), console.log("🔍 [ValidationExecutor] DETAILED Zod errors:", {
|
|
63
|
+
fullZodError: a,
|
|
64
|
+
individualErrors: a.errors.map((o) => ({
|
|
65
|
+
message: o.message,
|
|
66
|
+
path: o.path,
|
|
67
|
+
code: o.code,
|
|
68
|
+
fullError: o
|
|
69
|
+
})),
|
|
70
|
+
inputValue: t,
|
|
71
|
+
inputType: typeof t,
|
|
72
|
+
schemaType: i._def?.typeName || "unknown"
|
|
73
|
+
});
|
|
74
|
+
} else
|
|
75
|
+
s = ["Validation failed"];
|
|
76
|
+
return {
|
|
77
|
+
isValid: !1,
|
|
78
|
+
errors: s,
|
|
79
|
+
value: e
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validates a step
|
|
85
|
+
*/
|
|
86
|
+
async validateStep(t, i) {
|
|
87
|
+
try {
|
|
88
|
+
return await i.parseAsync(t), {
|
|
89
|
+
isValid: !0,
|
|
90
|
+
fieldErrors: {},
|
|
91
|
+
generalErrors: []
|
|
92
|
+
};
|
|
93
|
+
} catch (e) {
|
|
94
|
+
const r = {};
|
|
95
|
+
let s = [];
|
|
96
|
+
if (e && typeof e == "object" && "errors" in e) {
|
|
97
|
+
const a = e;
|
|
98
|
+
for (const o of a.errors)
|
|
99
|
+
if (o.path.length > 0) {
|
|
100
|
+
const l = o.path[0].toString();
|
|
101
|
+
r[l] || (r[l] = []), r[l].push(o.message);
|
|
102
|
+
} else
|
|
103
|
+
s.push(o.message);
|
|
104
|
+
} else
|
|
105
|
+
s = ["Step validation failed"];
|
|
106
|
+
return {
|
|
107
|
+
isValid: !1,
|
|
108
|
+
fieldErrors: r,
|
|
109
|
+
generalErrors: s
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Validates a form
|
|
115
|
+
*/
|
|
116
|
+
async validateForm(t, i) {
|
|
117
|
+
const e = {}, r = [];
|
|
118
|
+
let s = !0;
|
|
119
|
+
for (const a of t.steps) {
|
|
120
|
+
if (d(a)) {
|
|
121
|
+
r.push(
|
|
122
|
+
`Template step '${a.id}' needs to be resolved before validation`
|
|
123
|
+
), s = !1;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const o = a, l = this.schemaBuilder.createStepSchema(o), n = await this.validateStep(i, l);
|
|
127
|
+
n.isValid || (s = !1, Object.assign(e, n.fieldErrors), r.push(...n.generalErrors));
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
isValid: s,
|
|
131
|
+
fieldErrors: e,
|
|
132
|
+
generalErrors: r
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
u as ValidationExecutor
|
|
138
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ValidationEngine as a, defaultValidationEngine as r } from "./ValidationEngine.js";
|
|
3
|
+
function c(e, n = "withLabel") {
|
|
4
|
+
return new a({ messageStyle: n }).getComponentSchema(e);
|
|
5
|
+
}
|
|
6
|
+
function u(e, n, t = "withLabel") {
|
|
7
|
+
const i = new a({ messageStyle: t }).validateField(e, n);
|
|
8
|
+
return i.isValid ? void 0 : i.errors[0];
|
|
9
|
+
}
|
|
10
|
+
function d(e, n) {
|
|
11
|
+
return r.validateField(e, n).errors;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
c as createTanStackSchema,
|
|
15
|
+
u as validateWithTanStack,
|
|
16
|
+
d as validateWithTanStackReturnArray
|
|
17
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ValidationEngine as c } from "./ValidationEngine.js";
|
|
3
|
+
const s = new c();
|
|
4
|
+
async function d(t, e) {
|
|
5
|
+
const n = await s.validateFieldDebounced(
|
|
6
|
+
t,
|
|
7
|
+
e
|
|
8
|
+
);
|
|
9
|
+
return n.isValid ? void 0 : n.errors[0];
|
|
10
|
+
}
|
|
11
|
+
async function l(t, e) {
|
|
12
|
+
return (await s.validateFieldDebounced(
|
|
13
|
+
t,
|
|
14
|
+
e
|
|
15
|
+
)).errors;
|
|
16
|
+
}
|
|
17
|
+
function a(t) {
|
|
18
|
+
return "sections" in t && Array.isArray(t.sections);
|
|
19
|
+
}
|
|
20
|
+
function f(t, e) {
|
|
21
|
+
for (const n of t.steps)
|
|
22
|
+
if (a(n))
|
|
23
|
+
for (const i of n.sections || []) {
|
|
24
|
+
const o = (i.components || []).find(
|
|
25
|
+
(r) => r.id === e
|
|
26
|
+
);
|
|
27
|
+
if (o) return o;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function p(t, e) {
|
|
31
|
+
const n = t.steps.find((o) => o.id === e);
|
|
32
|
+
if (!n || !a(n)) return [];
|
|
33
|
+
const i = [];
|
|
34
|
+
return n.sections?.forEach((o) => {
|
|
35
|
+
o.components?.forEach((r) => {
|
|
36
|
+
i.push(r);
|
|
37
|
+
});
|
|
38
|
+
}), i;
|
|
39
|
+
}
|
|
40
|
+
function m(t) {
|
|
41
|
+
const e = [];
|
|
42
|
+
return t.steps.forEach((n) => {
|
|
43
|
+
a(n) && n.sections?.forEach((i) => {
|
|
44
|
+
i.components?.forEach((o) => {
|
|
45
|
+
e.push(o);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}), e;
|
|
49
|
+
}
|
|
50
|
+
async function v(t, e, n) {
|
|
51
|
+
const i = t.steps.find((r) => r.id === e);
|
|
52
|
+
return !i || !a(i) ? {} : (await s.validateStep(i, n)).fieldErrors;
|
|
53
|
+
}
|
|
54
|
+
async function y(t, e, n) {
|
|
55
|
+
const i = t.steps.find((r) => r.id === e);
|
|
56
|
+
return !i || !a(i) ? !0 : (await s.validateStep(i, n)).isValid;
|
|
57
|
+
}
|
|
58
|
+
async function E(t, e) {
|
|
59
|
+
return (await s.validateForm(t, e)).fieldErrors;
|
|
60
|
+
}
|
|
61
|
+
async function F(t, e) {
|
|
62
|
+
return (await s.validateForm(t, e)).isValid;
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
f as findComponentById,
|
|
66
|
+
m as getAllComponents,
|
|
67
|
+
p as getStepComponents,
|
|
68
|
+
F as isFormValid,
|
|
69
|
+
y as isStepValid,
|
|
70
|
+
d as validateField,
|
|
71
|
+
l as validateFieldReturnArray,
|
|
72
|
+
E as validateForm,
|
|
73
|
+
v as validateStep
|
|
74
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { Alert as c, AlertDescription as u } from "../../../ui/src/components/alert/alert.js";
|
|
5
|
+
import { Button as h } from "../../../ui/src/components/button/button.js";
|
|
6
|
+
import { Checkbox as y } from "../../../ui/src/components/checkbox/checkbox.js";
|
|
7
|
+
import { Input as b } from "../../../ui/src/components/input/input.js";
|
|
8
|
+
import { RadioGroup as f, RadioGroupItem as m } from "../../../ui/src/components/radio-group/radio-group.js";
|
|
9
|
+
import { Select as g, SelectTrigger as v, SelectValue as x, SelectContent as B, SelectItem as A } from "../../../ui/src/components/select/select.js";
|
|
10
|
+
import { Textarea as S } from "../../../ui/src/components/textarea/textarea.js";
|
|
11
|
+
import { ProgressLoaderBar as k } from "../../../ui/src/components/ProgressLoaderBar/ProgressLoaderBar.js";
|
|
12
|
+
const M = ({
|
|
13
|
+
component: n,
|
|
14
|
+
value: o,
|
|
15
|
+
onChange: d,
|
|
16
|
+
isFormView: l
|
|
17
|
+
}) => {
|
|
18
|
+
const e = n.properties ?? {};
|
|
19
|
+
switch (n.type) {
|
|
20
|
+
case "text":
|
|
21
|
+
case "email":
|
|
22
|
+
case "tel":
|
|
23
|
+
case "number":
|
|
24
|
+
case "date":
|
|
25
|
+
return /* @__PURE__ */ r(
|
|
26
|
+
b,
|
|
27
|
+
{
|
|
28
|
+
type: n.type,
|
|
29
|
+
value: typeof o == "string" ? o : "",
|
|
30
|
+
disabled: !!e.disabled,
|
|
31
|
+
readOnly: !!e.readOnly || !l,
|
|
32
|
+
placeholder: typeof e.placeholder == "string" ? e.placeholder : void 0,
|
|
33
|
+
onChange: l ? (a) => d(a.target.value) : void 0
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
case "textarea":
|
|
37
|
+
return /* @__PURE__ */ r(
|
|
38
|
+
S,
|
|
39
|
+
{
|
|
40
|
+
value: typeof o == "string" ? o : "",
|
|
41
|
+
disabled: !!e.disabled,
|
|
42
|
+
readOnly: !!e.readOnly || !l,
|
|
43
|
+
placeholder: typeof e.placeholder == "string" ? e.placeholder : void 0,
|
|
44
|
+
onChange: l ? (a) => d(a.target.value) : void 0
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
case "checkbox":
|
|
48
|
+
return /* @__PURE__ */ r(
|
|
49
|
+
y,
|
|
50
|
+
{
|
|
51
|
+
checked: !!o,
|
|
52
|
+
disabled: !!e.disabled,
|
|
53
|
+
onCheckedChange: l ? (a) => d(a === !0) : void 0
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
case "radioGroup": {
|
|
57
|
+
const a = Array.isArray(e.options) ? e.options : [];
|
|
58
|
+
return /* @__PURE__ */ r(
|
|
59
|
+
f,
|
|
60
|
+
{
|
|
61
|
+
value: typeof o == "string" ? o : "",
|
|
62
|
+
onValueChange: l ? (t) => d(t) : void 0,
|
|
63
|
+
disabled: !!e.disabled,
|
|
64
|
+
children: a.map((t) => /* @__PURE__ */ r(m, { value: t.value, children: t.label }, t.value))
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
case "dropdown": {
|
|
69
|
+
const a = Array.isArray(e.options) ? e.options : [];
|
|
70
|
+
return /* @__PURE__ */ p(
|
|
71
|
+
g,
|
|
72
|
+
{
|
|
73
|
+
value: typeof o == "string" ? o : "",
|
|
74
|
+
onValueChange: l ? (t) => d(t) : void 0,
|
|
75
|
+
disabled: !!e.disabled,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ r(v, { children: /* @__PURE__ */ r(
|
|
78
|
+
x,
|
|
79
|
+
{
|
|
80
|
+
placeholder: typeof e.placeholder == "string" ? e.placeholder : ""
|
|
81
|
+
}
|
|
82
|
+
) }),
|
|
83
|
+
/* @__PURE__ */ r(B, { children: a.map((t) => /* @__PURE__ */ r(A, { value: t.value, children: t.label }, t.value)) })
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
case "button":
|
|
89
|
+
return /* @__PURE__ */ r(
|
|
90
|
+
h,
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
disabled: !!e.disabled,
|
|
94
|
+
onClick: l ? () => d(null) : void 0,
|
|
95
|
+
children: typeof e.label == "string" ? e.label : "Submit"
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
case "heading": {
|
|
99
|
+
const a = typeof e.level == "number" ? e.level : void 0, t = a !== void 0 ? Math.min(6, Math.max(1, a)) : 2, i = typeof e.text == "string" ? e.text : "", s = `h${t}`;
|
|
100
|
+
return /* @__PURE__ */ r(s, { children: i });
|
|
101
|
+
}
|
|
102
|
+
case "paragraph":
|
|
103
|
+
return /* @__PURE__ */ r("p", { children: typeof e.text == "string" ? e.text : "" });
|
|
104
|
+
case "alert":
|
|
105
|
+
return /* @__PURE__ */ r(c, { variant: "default", children: /* @__PURE__ */ r(u, { children: typeof e.message == "string" ? e.message : "" }) });
|
|
106
|
+
case "progress-loader":
|
|
107
|
+
return /* @__PURE__ */ r(
|
|
108
|
+
k,
|
|
109
|
+
{
|
|
110
|
+
mode: typeof e.mode == "string" ? e.mode : "indeterminate",
|
|
111
|
+
status: "loading",
|
|
112
|
+
label: typeof e.label == "string" ? e.label : void 0
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
default:
|
|
116
|
+
return console.warn(
|
|
117
|
+
`[wizardRenderer] Unsupported component type: ${n.type}`
|
|
118
|
+
), null;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
export {
|
|
122
|
+
M as wizardDefaultRenderer
|
|
123
|
+
};
|