@digiform/wizard 0.4.0 → 0.5.0
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/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.d.ts +1 -1
- package/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.d.ts +0 -1
- package/package.json +1 -1
- package/wizard/src/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.js +33 -46
- package/wizard/src/features/form-runtime/components/FormField.js +24 -30
- package/wizard/src/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.js +7 -16
- package/wizard/src/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.js +21 -34
- package/wizard/src/renderer/RHCRenderer.js +105 -62
- package/wizard/src/renderer/rhc-field-type-map.js +17 -15
- package/ui/src/design-system/components/FormFieldWrapper.js +0 -16
package/package.json
CHANGED
package/wizard/src/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { renderComponent as C } from "../../../../../core/src/registry/renderComponent.js";
|
|
2
|
+
import { jsxs as n, jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import s from "./ComponentAdapterComplete.module.css.js";
|
|
4
|
+
import { renderComponent as u } from "../../../../../core/src/registry/renderComponent.js";
|
|
6
5
|
const a = {
|
|
7
6
|
text: "text",
|
|
8
7
|
date: "date",
|
|
@@ -29,38 +28,32 @@ const a = {
|
|
|
29
28
|
reset: "reset",
|
|
30
29
|
"code-input": "code-input",
|
|
31
30
|
"progress-loader": "progress-loader"
|
|
32
|
-
},
|
|
31
|
+
}, g = (e) => a[e] ? a[e] : (console.warn(
|
|
33
32
|
`⚠️ [ComponentAdapter] Component type "${e}" not found in TYPE_MAP, falling back to "text". Available types: ${Object.keys(a).join(", ")}`
|
|
34
|
-
), "text"),
|
|
35
|
-
id:
|
|
36
|
-
field:
|
|
33
|
+
), "text"), y = (e) => e.map((t) => ({
|
|
34
|
+
id: t.id,
|
|
35
|
+
field: t.field || t.targetComponentId || "",
|
|
37
36
|
// Ensure field is always set
|
|
38
|
-
targetStepId:
|
|
37
|
+
targetStepId: t.targetStepId || "",
|
|
39
38
|
// Default empty as form wizard doesn't have this concept
|
|
40
|
-
targetComponentId:
|
|
39
|
+
targetComponentId: t.field || t.targetComponentId,
|
|
41
40
|
// Map field to targetComponentId
|
|
42
|
-
operator:
|
|
43
|
-
value:
|
|
44
|
-
logicalOperator:
|
|
45
|
-
})),
|
|
41
|
+
operator: h(t.operator),
|
|
42
|
+
value: t.value,
|
|
43
|
+
logicalOperator: t.logicalOperator
|
|
44
|
+
})), f = {
|
|
46
45
|
equals: "equals",
|
|
47
46
|
notEquals: "notEquals",
|
|
48
47
|
contains: "contains",
|
|
49
48
|
empty: "empty",
|
|
50
49
|
notEmpty: "notEmpty"
|
|
51
|
-
},
|
|
52
|
-
"heading",
|
|
53
|
-
"paragraph",
|
|
54
|
-
"alert",
|
|
55
|
-
"button",
|
|
56
|
-
"progress-loader"
|
|
57
|
-
], T = (e, r, u, g, o, f, y) => {
|
|
50
|
+
}, h = (e) => f[e] || "equals", A = (e, t, p, d, o, C, b, i, l) => {
|
|
58
51
|
try {
|
|
59
|
-
const
|
|
52
|
+
const r = g(e.type), m = {
|
|
60
53
|
// Base component properties
|
|
61
54
|
...e,
|
|
62
55
|
// Override the type with the mapped version
|
|
63
|
-
type:
|
|
56
|
+
type: r,
|
|
64
57
|
// Spread all properties from component.properties to the top level for backward compatibility
|
|
65
58
|
...e.properties,
|
|
66
59
|
// Add onBlur if provided
|
|
@@ -69,38 +62,32 @@ const a = {
|
|
|
69
62
|
properties: {
|
|
70
63
|
...e.properties,
|
|
71
64
|
// Also set readOnly in the nested properties object
|
|
72
|
-
readOnly:
|
|
65
|
+
readOnly: d ?? e.properties?.readOnly ?? !1,
|
|
73
66
|
// Add onBlur to nested properties if provided
|
|
74
67
|
...o && { onBlur: o }
|
|
75
68
|
},
|
|
76
69
|
// Convert conditions if they exist
|
|
77
|
-
conditions: e.conditions ?
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
input: s
|
|
91
|
-
}
|
|
92
|
-
) : s;
|
|
93
|
-
} catch (t) {
|
|
94
|
-
return console.error("Error rendering component with registry:", t), /* @__PURE__ */ m("div", { className: c.errorFallback, children: [
|
|
95
|
-
/* @__PURE__ */ m("p", { children: [
|
|
70
|
+
conditions: e.conditions ? y(e.conditions) : void 0
|
|
71
|
+
};
|
|
72
|
+
return u({
|
|
73
|
+
component: m,
|
|
74
|
+
value: t,
|
|
75
|
+
onChange: p,
|
|
76
|
+
isFormView: !0,
|
|
77
|
+
invalid: i,
|
|
78
|
+
errorMessage: l
|
|
79
|
+
});
|
|
80
|
+
} catch (r) {
|
|
81
|
+
return console.error("Error rendering component with registry:", r), /* @__PURE__ */ n("div", { className: s.errorFallback, children: [
|
|
82
|
+
/* @__PURE__ */ n("p", { children: [
|
|
96
83
|
"Failed to render component: ",
|
|
97
84
|
e.type
|
|
98
85
|
] }),
|
|
99
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ c("p", { className: s.errorDetail, children: r instanceof Error ? r.message : String(r) })
|
|
100
87
|
] });
|
|
101
88
|
}
|
|
102
89
|
};
|
|
103
90
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
A as adaptComponentForRegistry,
|
|
92
|
+
A as default
|
|
106
93
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as n, jsxs as
|
|
3
|
-
import { ComponentAlerts as
|
|
2
|
+
import { jsx as n, jsxs as I } from "react/jsx-runtime";
|
|
3
|
+
import { ComponentAlerts as p } from "../../trigger-action-system/components/ComponentAlert/ComponentAlert.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { memo as M, useMemo as N } from "react";
|
|
6
6
|
import { adaptComponentForRegistry as x } from "../ComponentAdapterComplete/ComponentAdapterComplete.js";
|
|
@@ -12,7 +12,7 @@ import { useFormFieldState as U } from "../hooks/useFormFieldState.js";
|
|
|
12
12
|
import { useValidationEvents as G } from "../hooks/useValidationEvents.js";
|
|
13
13
|
import { checkHasIsDirtyTriggers as z, shouldBeFormField as P, checkFieldHasValue as j, getValidationDisplayState as q, shouldShowComponentAlerts as J, shouldShowDisplayMode as W } from "../utils/fieldHelpers.js";
|
|
14
14
|
import { logger as e } from "../utils/logger.js";
|
|
15
|
-
import { updateValidationCache as
|
|
15
|
+
import { updateValidationCache as F } from "../utils/validationUX.js";
|
|
16
16
|
import { ProgressLoaderRuntime as X } from "./ProgressLoaderRuntime.js";
|
|
17
17
|
import { DisplayModeRenderer as Z } from "./renderers/DisplayModeRenderer/DisplayModeRenderer.js";
|
|
18
18
|
import { InteractiveFieldRenderer as K } from "./renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.js";
|
|
@@ -20,20 +20,20 @@ import { useFormMachine as Q } from "../../state-management/machines/useFormMach
|
|
|
20
20
|
import Y from "../../../../../ui/src/lib/error-boundaries/ComponentErrorBoundary.js";
|
|
21
21
|
const ii = M(
|
|
22
22
|
({ component: i, readOnly: V = !1 }) => {
|
|
23
|
-
const [
|
|
23
|
+
const [C, ai, g] = Q(), c = O(), { isVisible: T } = B({
|
|
24
24
|
visibilityConditions: i.visibilityConditions,
|
|
25
|
-
formData:
|
|
26
|
-
}), { forceShowValidation:
|
|
25
|
+
formData: C.context.data
|
|
26
|
+
}), { forceShowValidation: D, resetValidationState: A } = G({
|
|
27
27
|
componentId: i.id
|
|
28
|
-
}), y = z(i), { originalValueFromMachine:
|
|
28
|
+
}), y = z(i), { originalValueFromMachine: $, initializeField: b, getEnhancedIsDirty: S } = U({
|
|
29
29
|
componentId: i.id,
|
|
30
30
|
hasIsDirtyTriggers: y
|
|
31
|
-
}), { handleChange:
|
|
31
|
+
}), { handleChange: R, handleBlur: L } = H({
|
|
32
32
|
componentId: i.id,
|
|
33
33
|
hasIsDirtyTriggers: y,
|
|
34
|
-
originalValueFromMachine:
|
|
34
|
+
originalValueFromMachine: $,
|
|
35
35
|
getEnhancedIsDirty: S,
|
|
36
|
-
resetValidationState:
|
|
36
|
+
resetValidationState: A
|
|
37
37
|
}), f = _({
|
|
38
38
|
componentId: i.id
|
|
39
39
|
}), m = N(() => {
|
|
@@ -67,7 +67,7 @@ const ii = M(
|
|
|
67
67
|
else {
|
|
68
68
|
e.validation(
|
|
69
69
|
`No validation rules for ${i.id} [${l}], returning VALID (undefined)`
|
|
70
|
-
),
|
|
70
|
+
), F(i.id, !0);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
let s = t;
|
|
@@ -101,7 +101,7 @@ const ii = M(
|
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
103
|
const u = (d.errors || []).length === 0;
|
|
104
|
-
|
|
104
|
+
F(i.id, u);
|
|
105
105
|
let o;
|
|
106
106
|
return u ? o = void 0 : (d.errors || []).length === 1 ? o = (d.errors || [])[0] : o = d.errors || [], e.validation(
|
|
107
107
|
`VALIDATION END [${l}] for ${i.id}:`,
|
|
@@ -149,14 +149,14 @@ const ii = M(
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
}, [i.validation, g.validationEngine, i]);
|
|
152
|
-
|
|
152
|
+
b(), e.lifecycle(`Component MOUNTED for ${i.id}:`, {
|
|
153
153
|
componentId: i.id,
|
|
154
154
|
componentType: i.type,
|
|
155
155
|
hasValidation: !!i.validation,
|
|
156
156
|
validationRules: i.validation,
|
|
157
157
|
validationEngineExists: !!g.validationEngine
|
|
158
158
|
});
|
|
159
|
-
const
|
|
159
|
+
const k = P(i);
|
|
160
160
|
if (i.validation && g.validationEngine)
|
|
161
161
|
try {
|
|
162
162
|
const a = g.validationEngine.validateField(
|
|
@@ -184,7 +184,7 @@ const ii = M(
|
|
|
184
184
|
a
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
|
-
const
|
|
187
|
+
const w = !!(i.validation || i.required !== void 0);
|
|
188
188
|
return /* @__PURE__ */ n(
|
|
189
189
|
"div",
|
|
190
190
|
{
|
|
@@ -197,7 +197,7 @@ const ii = M(
|
|
|
197
197
|
Y,
|
|
198
198
|
{
|
|
199
199
|
componentName: `FormField-${i.type}-${i.id}`,
|
|
200
|
-
children:
|
|
200
|
+
children: k ? /* @__PURE__ */ n(
|
|
201
201
|
c.Field,
|
|
202
202
|
{
|
|
203
203
|
name: i.id,
|
|
@@ -322,13 +322,13 @@ const ii = M(
|
|
|
322
322
|
), { isSubmitAttempted: u } = q(
|
|
323
323
|
a.state.meta,
|
|
324
324
|
c.state,
|
|
325
|
-
|
|
325
|
+
D
|
|
326
326
|
), o = J(
|
|
327
327
|
y,
|
|
328
328
|
l,
|
|
329
329
|
f.alerts.length
|
|
330
330
|
);
|
|
331
|
-
return d &&
|
|
331
|
+
return d && w ? /* @__PURE__ */ I("div", { children: [
|
|
332
332
|
/* @__PURE__ */ n(
|
|
333
333
|
Z,
|
|
334
334
|
{
|
|
@@ -336,15 +336,14 @@ const ii = M(
|
|
|
336
336
|
fieldValue: t
|
|
337
337
|
}
|
|
338
338
|
),
|
|
339
|
-
o && f.alerts.length > 0 && /* @__PURE__ */ n(
|
|
340
|
-
] }) : /* @__PURE__ */
|
|
339
|
+
o && f.alerts.length > 0 && /* @__PURE__ */ n(p, { alerts: f.alerts })
|
|
340
|
+
] }) : /* @__PURE__ */ I("div", { children: [
|
|
341
341
|
/* @__PURE__ */ n(
|
|
342
342
|
K,
|
|
343
343
|
{
|
|
344
344
|
component: i,
|
|
345
345
|
field: a,
|
|
346
346
|
readOnly: V,
|
|
347
|
-
needsFormFieldWrapper: I,
|
|
348
347
|
isSubmitAttempted: u,
|
|
349
348
|
onChange: (r) => {
|
|
350
349
|
e.change(`onChange triggered for ${i.id}:`, {
|
|
@@ -357,12 +356,12 @@ const ii = M(
|
|
|
357
356
|
originalValue: r,
|
|
358
357
|
sharedValue: v,
|
|
359
358
|
sharedValueType: typeof v
|
|
360
|
-
}),
|
|
359
|
+
}), R(a)(v);
|
|
361
360
|
},
|
|
362
|
-
onBlur:
|
|
361
|
+
onBlur: L(a)
|
|
363
362
|
}
|
|
364
363
|
),
|
|
365
|
-
o && f.alerts.length > 0 && /* @__PURE__ */ n(
|
|
364
|
+
o && f.alerts.length > 0 && /* @__PURE__ */ n(p, { alerts: f.alerts })
|
|
366
365
|
] });
|
|
367
366
|
}
|
|
368
367
|
}
|
|
@@ -385,12 +384,7 @@ const ii = M(
|
|
|
385
384
|
// no onChange handler
|
|
386
385
|
V,
|
|
387
386
|
() => {
|
|
388
|
-
}
|
|
389
|
-
// no onBlur handler
|
|
390
|
-
void 0,
|
|
391
|
-
// no errors
|
|
392
|
-
void 0
|
|
393
|
-
// no state
|
|
387
|
+
}
|
|
394
388
|
)
|
|
395
389
|
)
|
|
396
390
|
}
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import { clsx as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const u = ({
|
|
3
|
+
import { clsx as d } from "clsx";
|
|
4
|
+
import a from "./DisplayModeRenderer.module.css.js";
|
|
5
|
+
import { renderComponentDisplayValue as m } from "../../../utils/componentDisplayValue.js";
|
|
6
|
+
const y = ({
|
|
8
7
|
component: e,
|
|
9
8
|
fieldValue: s
|
|
10
9
|
}) => {
|
|
11
|
-
const l =
|
|
10
|
+
const l = m(e, s), i = e.properties?.description, o = /* @__PURE__ */ p("div", { className: "form-field-display", children: [
|
|
12
11
|
/* @__PURE__ */ r("div", { className: "rhc-form-field-label", children: e.properties?.label }),
|
|
13
12
|
l,
|
|
14
13
|
i && /* @__PURE__ */ r("p", { className: "rhc-form-field-description", children: i })
|
|
15
14
|
] });
|
|
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
|
-
);
|
|
15
|
+
return /* @__PURE__ */ r("div", { className: d("form-field-wrapper form-field-display-mode", a.displayWrapper), children: o });
|
|
25
16
|
};
|
|
26
17
|
export {
|
|
27
|
-
|
|
18
|
+
y as DisplayModeRenderer
|
|
28
19
|
};
|
|
@@ -1,56 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { shouldShowValidationError as E, getDisplayErrorMessage as F, markFieldAsUserInteracted as w } from "../../../utils/validationUX.js";
|
|
8
|
-
const O = ({
|
|
2
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import h from "./InteractiveFieldRenderer.module.css.js";
|
|
4
|
+
import { adaptComponentForRegistry as u } from "../../../ComponentAdapterComplete/ComponentAdapterComplete.js";
|
|
5
|
+
import { shouldShowValidationError as v, getDisplayErrorMessage as g, markFieldAsUserInteracted as E } from "../../../utils/validationUX.js";
|
|
6
|
+
const w = ({
|
|
9
7
|
component: e,
|
|
10
8
|
field: r,
|
|
11
|
-
readOnly:
|
|
12
|
-
needsFormFieldWrapper: d,
|
|
9
|
+
readOnly: a,
|
|
13
10
|
isSubmitAttempted: t,
|
|
14
|
-
onChange:
|
|
15
|
-
onBlur:
|
|
11
|
+
onChange: n,
|
|
12
|
+
onBlur: i
|
|
16
13
|
}) => {
|
|
17
|
-
const
|
|
14
|
+
const d = r.state.value, l = r.state.meta.errors || [], c = !r.state.meta.isValid && l.length > 0, s = v(
|
|
18
15
|
r.state.meta,
|
|
19
16
|
t,
|
|
20
17
|
e.id
|
|
21
18
|
// Pass component ID for validation cache
|
|
22
|
-
),
|
|
19
|
+
), o = g(
|
|
23
20
|
r.state.meta,
|
|
24
21
|
t
|
|
25
|
-
),
|
|
22
|
+
), m = u(
|
|
26
23
|
e,
|
|
27
|
-
|
|
28
|
-
l,
|
|
24
|
+
d,
|
|
29
25
|
n,
|
|
26
|
+
a,
|
|
30
27
|
() => {
|
|
31
|
-
|
|
28
|
+
E(e.id), i();
|
|
32
29
|
},
|
|
33
30
|
void 0,
|
|
34
31
|
// errors parameter
|
|
35
|
-
void 0
|
|
32
|
+
void 0,
|
|
36
33
|
// state parameter
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
children: h
|
|
42
|
-
}
|
|
34
|
+
!!(s && c),
|
|
35
|
+
// invalid
|
|
36
|
+
s && o ? o : void 0
|
|
37
|
+
// errorMessage
|
|
43
38
|
);
|
|
44
|
-
return
|
|
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 });
|
|
39
|
+
return /* @__PURE__ */ p("div", { className: h.fieldWrapper, children: m });
|
|
53
40
|
};
|
|
54
41
|
export {
|
|
55
|
-
|
|
42
|
+
w as InteractiveFieldRenderer
|
|
56
43
|
};
|
|
@@ -1,117 +1,160 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r
|
|
3
|
-
import { SelectOption as
|
|
4
|
-
import { wizardFieldTypeMap as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { SelectOption as b, FormFieldRadio as f, FormFieldCheckboxGroup as g, FormFieldCheckboxOption as h } from "@rijkshuisstijl-community/components-react";
|
|
4
|
+
import { wizardFieldTypeMap as v } from "./rhc-field-type-map.js";
|
|
5
|
+
const m = v, x = {
|
|
6
|
+
digits: "[0-9]*",
|
|
7
|
+
letters: "[a-zA-Z]*",
|
|
8
|
+
alphanumeric: "[a-zA-Z0-9]*"
|
|
9
|
+
}, O = ({
|
|
10
|
+
component: u,
|
|
11
|
+
value: i,
|
|
12
|
+
onChange: s,
|
|
13
|
+
isFormView: c,
|
|
14
|
+
invalid: d,
|
|
15
|
+
errorMessage: p
|
|
10
16
|
}) => {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
return console.warn(`[RHCRenderer] No RHC component registered for type: ${
|
|
14
|
-
const e =
|
|
15
|
-
for (const t of
|
|
16
|
-
t in e && (
|
|
17
|
-
const
|
|
18
|
-
switch (
|
|
17
|
+
const y = m[u.type];
|
|
18
|
+
if (!y)
|
|
19
|
+
return console.warn(`[RHCRenderer] No RHC component registered for type: ${u.type}`), null;
|
|
20
|
+
const e = u.properties ?? {}, l = {};
|
|
21
|
+
for (const t of y.included)
|
|
22
|
+
t in e && (l[t] = e[t]);
|
|
23
|
+
const o = y.component;
|
|
24
|
+
switch (u.type) {
|
|
19
25
|
case "text":
|
|
20
26
|
case "email":
|
|
21
27
|
case "tel":
|
|
22
28
|
case "number":
|
|
23
29
|
case "date":
|
|
24
30
|
return /* @__PURE__ */ r(
|
|
25
|
-
|
|
31
|
+
o,
|
|
26
32
|
{
|
|
27
|
-
type:
|
|
28
|
-
value: typeof
|
|
29
|
-
...
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
type: u.type,
|
|
34
|
+
value: typeof i == "string" ? i : "",
|
|
35
|
+
...l,
|
|
36
|
+
invalid: d,
|
|
37
|
+
errorMessage: p,
|
|
38
|
+
readOnly: !!l.readOnly || !c,
|
|
39
|
+
onChange: c ? (t) => s(t.target.value) : void 0
|
|
32
40
|
}
|
|
33
41
|
);
|
|
34
42
|
case "textarea":
|
|
35
43
|
return /* @__PURE__ */ r(
|
|
36
|
-
|
|
44
|
+
o,
|
|
37
45
|
{
|
|
38
|
-
value: typeof
|
|
39
|
-
...
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
value: typeof i == "string" ? i : "",
|
|
47
|
+
...l,
|
|
48
|
+
invalid: d,
|
|
49
|
+
errorMessage: p,
|
|
50
|
+
readOnly: !!l.readOnly || !c,
|
|
51
|
+
onChange: c ? (t) => s(t.target.value) : void 0
|
|
42
52
|
}
|
|
43
53
|
);
|
|
44
|
-
case "checkbox":
|
|
54
|
+
case "checkbox": {
|
|
55
|
+
const t = typeof e.label == "string" ? e.label : "", n = typeof e.description == "string" ? e.description : void 0;
|
|
45
56
|
return /* @__PURE__ */ r(
|
|
46
|
-
|
|
57
|
+
g,
|
|
47
58
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
label: t,
|
|
60
|
+
description: n,
|
|
61
|
+
invalid: d,
|
|
62
|
+
errorMessage: p,
|
|
63
|
+
children: /* @__PURE__ */ r(
|
|
64
|
+
h,
|
|
65
|
+
{
|
|
66
|
+
label: t,
|
|
67
|
+
checked: !!i,
|
|
68
|
+
disabled: !!e.disabled,
|
|
69
|
+
onChange: c ? (a) => s(a.target.checked) : void 0
|
|
70
|
+
}
|
|
71
|
+
)
|
|
51
72
|
}
|
|
52
73
|
);
|
|
74
|
+
}
|
|
53
75
|
case "radioGroup": {
|
|
54
76
|
const t = Array.isArray(e.options) ? e.options : [];
|
|
55
|
-
return /* @__PURE__ */ r(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
77
|
+
return /* @__PURE__ */ r(
|
|
78
|
+
o,
|
|
79
|
+
{
|
|
80
|
+
...l,
|
|
81
|
+
invalid: d,
|
|
82
|
+
errorMessage: p,
|
|
83
|
+
children: t.map((n) => /* @__PURE__ */ r(
|
|
60
84
|
f,
|
|
61
85
|
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
86
|
+
label: n.label,
|
|
87
|
+
value: n.value,
|
|
88
|
+
checked: i === n.value,
|
|
89
|
+
onChange: c ? () => s(n.value) : void 0
|
|
90
|
+
},
|
|
91
|
+
n.value
|
|
92
|
+
))
|
|
93
|
+
}
|
|
94
|
+
);
|
|
70
95
|
}
|
|
71
96
|
case "dropdown": {
|
|
72
|
-
const t = Array.isArray(e.options) ? e.options : [],
|
|
97
|
+
const t = Array.isArray(e.options) ? e.options : [], n = typeof e.label == "string" ? e.label : "";
|
|
73
98
|
return /* @__PURE__ */ r(
|
|
74
|
-
|
|
99
|
+
o,
|
|
75
100
|
{
|
|
76
|
-
label:
|
|
77
|
-
value: typeof
|
|
78
|
-
...
|
|
79
|
-
|
|
80
|
-
|
|
101
|
+
label: n,
|
|
102
|
+
value: typeof i == "string" ? i : "",
|
|
103
|
+
...l,
|
|
104
|
+
invalid: d,
|
|
105
|
+
errorMessage: p,
|
|
106
|
+
onChange: c ? (a) => s(a.target.value) : void 0,
|
|
107
|
+
children: t.map((a) => /* @__PURE__ */ r(b, { value: a.value, children: a.label }, a.value))
|
|
81
108
|
}
|
|
82
109
|
);
|
|
83
110
|
}
|
|
84
111
|
case "button":
|
|
85
112
|
return /* @__PURE__ */ r(
|
|
86
|
-
|
|
113
|
+
o,
|
|
87
114
|
{
|
|
88
115
|
type: "button",
|
|
89
|
-
...
|
|
90
|
-
onClick:
|
|
116
|
+
...l,
|
|
117
|
+
onClick: c ? () => s(null) : void 0,
|
|
91
118
|
children: typeof e.label == "string" ? e.label : "Submit"
|
|
92
119
|
}
|
|
93
120
|
);
|
|
94
121
|
case "heading": {
|
|
95
|
-
const t = typeof e.level == "number" ? e.level : 2,
|
|
96
|
-
return /* @__PURE__ */ r(
|
|
122
|
+
const t = typeof e.level == "number" ? e.level : 2, n = Math.min(6, Math.max(1, t)), a = typeof e.text == "string" ? e.text : "";
|
|
123
|
+
return /* @__PURE__ */ r(o, { level: n, children: a });
|
|
97
124
|
}
|
|
98
125
|
case "paragraph":
|
|
99
|
-
return /* @__PURE__ */ r(
|
|
126
|
+
return /* @__PURE__ */ r(o, { children: typeof e.text == "string" ? e.text : "" });
|
|
100
127
|
case "alert":
|
|
101
|
-
return /* @__PURE__ */ r(
|
|
128
|
+
return /* @__PURE__ */ r(o, { role: "alert", children: typeof e.message == "string" ? e.message : "" });
|
|
102
129
|
case "progress-loader":
|
|
103
130
|
return /* @__PURE__ */ r(
|
|
104
|
-
|
|
131
|
+
o,
|
|
105
132
|
{
|
|
106
133
|
mode: typeof e.mode == "string" ? e.mode : "indeterminate",
|
|
107
134
|
status: "loading",
|
|
108
135
|
label: typeof e.label == "string" ? e.label : void 0
|
|
109
136
|
}
|
|
110
137
|
);
|
|
138
|
+
case "code-input": {
|
|
139
|
+
const t = typeof e.pattern == "string" ? e.pattern : void 0, n = t && t !== "none" ? x[t] : void 0;
|
|
140
|
+
return /* @__PURE__ */ r(
|
|
141
|
+
o,
|
|
142
|
+
{
|
|
143
|
+
codeLength: Number(e.codeLength ?? 6) || 6,
|
|
144
|
+
label: typeof e.label == "string" ? e.label : void 0,
|
|
145
|
+
invalid: d,
|
|
146
|
+
errorMessage: p,
|
|
147
|
+
capitalize: !!e.capitalize,
|
|
148
|
+
pattern: n,
|
|
149
|
+
disabled: !!e.disabled,
|
|
150
|
+
onChange: (a) => s(a)
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
111
154
|
default:
|
|
112
|
-
return /* @__PURE__ */ r(
|
|
155
|
+
return /* @__PURE__ */ r(o, { ...l });
|
|
113
156
|
}
|
|
114
157
|
};
|
|
115
158
|
export {
|
|
116
|
-
|
|
159
|
+
O as rhcRenderer
|
|
117
160
|
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { CodeInputGroup as d, Alert as l, Paragraph as o, Heading as n, Button as a, FormFieldSelect as i, FormFieldRadioGroup as r, FormFieldCheckboxGroup as c, FormFieldTextarea as t, FormFieldTextInput as e } from "@rijkshuisstijl-community/components-react";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { ProgressLoaderBar as
|
|
4
|
+
import { ProgressLoaderBar as p } from "../../../ui/src/components/ProgressLoaderBar/ProgressLoaderBar.js";
|
|
5
5
|
const s = {
|
|
6
|
-
text: { component: e, included: ["value", "placeholder", "disabled", "readOnly"] },
|
|
7
|
-
email: { component: e, included: ["value", "placeholder", "disabled", "readOnly"] },
|
|
8
|
-
tel: { component: e, included: ["value", "placeholder", "disabled", "readOnly"] },
|
|
9
|
-
number: { component: e, included: ["value", "placeholder", "disabled", "readOnly"] },
|
|
10
|
-
date: { component: e, included: ["value", "placeholder", "disabled", "readOnly"] },
|
|
11
|
-
textarea: { component: t, included: ["value", "placeholder", "disabled", "readOnly"] },
|
|
12
|
-
checkbox:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
text: { component: e, included: ["label", "description", "value", "placeholder", "disabled", "readOnly"] },
|
|
7
|
+
email: { component: e, included: ["label", "description", "value", "placeholder", "disabled", "readOnly"] },
|
|
8
|
+
tel: { component: e, included: ["label", "description", "value", "placeholder", "disabled", "readOnly"] },
|
|
9
|
+
number: { component: e, included: ["label", "description", "value", "placeholder", "disabled", "readOnly"] },
|
|
10
|
+
date: { component: e, included: ["label", "description", "value", "placeholder", "disabled", "readOnly"] },
|
|
11
|
+
textarea: { component: t, included: ["label", "description", "value", "placeholder", "disabled", "readOnly"] },
|
|
12
|
+
// checkbox: handled entirely in RHCRenderer switch case via FormFieldCheckboxGroup + FormFieldCheckboxOption
|
|
13
|
+
checkbox: { component: c, included: [] },
|
|
14
|
+
radioGroup: { component: r, included: ["label", "description"] },
|
|
15
|
+
dropdown: { component: i, included: ["label", "description", "disabled"] },
|
|
16
|
+
button: { component: a, included: ["disabled"] },
|
|
16
17
|
heading: { component: n, included: ["level"] },
|
|
17
|
-
paragraph: { component:
|
|
18
|
-
alert: { component:
|
|
19
|
-
"progress-loader": { component:
|
|
18
|
+
paragraph: { component: o, included: [] },
|
|
19
|
+
alert: { component: l, included: [] },
|
|
20
|
+
"progress-loader": { component: p, included: ["mode", "label"] },
|
|
21
|
+
"code-input": { component: d, included: ["label", "codeLength", "capitalize", "pattern", "disabled"] }
|
|
20
22
|
};
|
|
21
23
|
export {
|
|
22
24
|
s as wizardFieldTypeMap
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs as m, jsx as d } from "react/jsx-runtime";
|
|
3
|
-
function o({
|
|
4
|
-
invalid: e,
|
|
5
|
-
errorMessage: r,
|
|
6
|
-
className: i = "",
|
|
7
|
-
input: t
|
|
8
|
-
}) {
|
|
9
|
-
return /* @__PURE__ */ m("div", { className: `form-field-wrapper ${i}`, children: [
|
|
10
|
-
t,
|
|
11
|
-
e && r && /* @__PURE__ */ d("div", { className: "form-field-error mt-2 text-sm text-red-600", children: r })
|
|
12
|
-
] });
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
o as FormFieldWrapper
|
|
16
|
-
};
|