@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.
@@ -14,5 +14,5 @@ export declare const adaptComponentForRegistry: (component: FormWizardComponentC
14
14
  error?: string;
15
15
  }>;
16
16
  };
17
- }) => React.ReactNode;
17
+ }, invalid?: boolean, errorMessage?: string) => React.ReactNode;
18
18
  export default adaptComponentForRegistry;
@@ -3,7 +3,6 @@ interface InteractiveFieldRendererProps {
3
3
  component: ComponentConfig;
4
4
  field: FormFieldApi;
5
5
  readOnly: boolean;
6
- needsFormFieldWrapper: boolean;
7
6
  isSubmitAttempted: boolean;
8
7
  onChange: (value: ComponentValue) => void;
9
8
  onBlur: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digiform/wizard",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "React component for rendering configurable multi-step forms from a JSON config",
5
5
  "author": "VladAfanasev",
6
6
  "license": "MIT",
@@ -1,8 +1,7 @@
1
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
- 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
- }, F = (e) => a[e] ? a[e] : (console.warn(
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"), O = (e) => e.map((r) => ({
35
- id: r.id,
36
- field: r.field || r.targetComponentId || "",
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: r.targetStepId || "",
37
+ targetStepId: t.targetStepId || "",
39
38
  // Default empty as form wizard doesn't have this concept
40
- targetComponentId: r.field || r.targetComponentId,
39
+ targetComponentId: t.field || t.targetComponentId,
41
40
  // Map field to targetComponentId
42
- operator: w(r.operator),
43
- value: r.value,
44
- logicalOperator: r.logicalOperator
45
- })), v = {
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
- }, w = (e) => v[e] || "equals", I = [
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 t = F(e.type), h = {
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: t,
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: g ?? e.properties?.readOnly ?? !1,
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 ? O(e.conditions) : void 0
78
- }, s = C({
79
- component: h,
80
- value: r,
81
- onChange: u,
82
- isFormView: !0
83
- }), 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;
84
- return E ? /* @__PURE__ */ l(
85
- x,
86
- {
87
- invalid: b,
88
- errorMessage: typeof d == "string" ? d : void 0,
89
- className: "form-field-wrapper",
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__ */ l("p", { className: c.errorDetail, children: t instanceof Error ? t.message : String(t) })
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
- T as adaptComponentForRegistry,
105
- T as default
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 p } from "react/jsx-runtime";
3
- import { ComponentAlerts as F } from "../../trigger-action-system/components/ComponentAlert/ComponentAlert.js";
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 C } from "../utils/validationUX.js";
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 [D, ai, g] = Q(), c = O(), { isVisible: T } = B({
23
+ const [C, ai, g] = Q(), c = O(), { isVisible: T } = B({
24
24
  visibilityConditions: i.visibilityConditions,
25
- formData: D.context.data
26
- }), { forceShowValidation: A, resetValidationState: $ } = G({
25
+ formData: C.context.data
26
+ }), { forceShowValidation: D, resetValidationState: A } = G({
27
27
  componentId: i.id
28
- }), y = z(i), { originalValueFromMachine: b, initializeField: R, getEnhancedIsDirty: S } = U({
28
+ }), y = z(i), { originalValueFromMachine: $, initializeField: b, getEnhancedIsDirty: S } = U({
29
29
  componentId: i.id,
30
30
  hasIsDirtyTriggers: y
31
- }), { handleChange: L, handleBlur: k } = H({
31
+ }), { handleChange: R, handleBlur: L } = H({
32
32
  componentId: i.id,
33
33
  hasIsDirtyTriggers: y,
34
- originalValueFromMachine: b,
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
- ), C(i.id, !0);
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
- C(i.id, u);
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
- R(), e.lifecycle(`Component MOUNTED for ${i.id}:`, {
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 w = P(i);
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 I = !!(i.validation || i.required !== void 0);
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: w ? /* @__PURE__ */ n(
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
- A
325
+ D
326
326
  ), o = J(
327
327
  y,
328
328
  l,
329
329
  f.alerts.length
330
330
  );
331
- return d && I ? /* @__PURE__ */ p("div", { children: [
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(F, { alerts: f.alerts })
340
- ] }) : /* @__PURE__ */ p("div", { children: [
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
- }), L(a)(v);
359
+ }), R(a)(v);
361
360
  },
362
- onBlur: k(a)
361
+ onBlur: L(a)
363
362
  }
364
363
  ),
365
- o && f.alerts.length > 0 && /* @__PURE__ */ n(F, { alerts: f.alerts })
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 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 = ({
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 = t(e, s), i = e.properties?.description, o = /* @__PURE__ */ p("div", { className: "form-field-display", children: [
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
- u as DisplayModeRenderer
18
+ y as DisplayModeRenderer
28
19
  };
@@ -1,56 +1,43 @@
1
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 = ({
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: n,
12
- needsFormFieldWrapper: d,
9
+ readOnly: a,
13
10
  isSubmitAttempted: t,
14
- onChange: l,
15
- onBlur: m
11
+ onChange: n,
12
+ onBlur: i
16
13
  }) => {
17
- const p = r.state.value, c = r.state.meta.errors || [], f = !r.state.meta.isValid && c.length > 0, s = E(
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
- ), a = F(
19
+ ), o = g(
23
20
  r.state.meta,
24
21
  t
25
- ), h = y(
22
+ ), m = u(
26
23
  e,
27
- p,
28
- l,
24
+ d,
29
25
  n,
26
+ a,
30
27
  () => {
31
- w(e.id), m();
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
- ), i = /* @__PURE__ */ o(
38
- "div",
39
- {
40
- style: { display: "contents" },
41
- children: h
42
- }
34
+ !!(s && c),
35
+ // invalid
36
+ s && o ? o : void 0
37
+ // errorMessage
43
38
  );
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 });
39
+ return /* @__PURE__ */ p("div", { className: h.fieldWrapper, children: m });
53
40
  };
54
41
  export {
55
- O as InteractiveFieldRenderer
42
+ w as InteractiveFieldRenderer
56
43
  };
@@ -1,117 +1,160 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as u } from "react/jsx-runtime";
3
- import { SelectOption as y, Radio as f } from "@rijkshuisstijl-community/components-react";
4
- import { wizardFieldTypeMap as g } from "./rhc-field-type-map.js";
5
- const b = g, x = ({
6
- component: i,
7
- value: o,
8
- onChange: d,
9
- isFormView: s
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 p = b[i.type];
12
- if (!p)
13
- return console.warn(`[RHCRenderer] No RHC component registered for type: ${i.type}`), null;
14
- const e = i.properties ?? {}, n = {};
15
- for (const t of p.included)
16
- t in e && (n[t] = e[t]);
17
- const a = p.component;
18
- switch (i.type) {
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
- a,
31
+ o,
26
32
  {
27
- type: i.type,
28
- value: typeof o == "string" ? o : "",
29
- ...n,
30
- readOnly: !!n.readOnly || !s,
31
- onChange: s ? (t) => d(t.target.value) : void 0
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
- a,
44
+ o,
37
45
  {
38
- value: typeof o == "string" ? o : "",
39
- ...n,
40
- readOnly: !!n.readOnly || !s,
41
- onChange: s ? (t) => d(t.target.value) : void 0
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
- a,
57
+ g,
47
58
  {
48
- checked: !!o,
49
- ...n,
50
- onChange: s ? (t) => d(t.target.checked) : void 0
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(a, { ...n, children: t.map((l) => (
56
- // RHC Radio is a void <input type="radio"> — it cannot have children.
57
- // Wrap in a <label> so the label text is associated with the input.
58
- /* @__PURE__ */ u("label", { children: [
59
- /* @__PURE__ */ r(
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
- value: l.value,
63
- checked: o === l.value,
64
- onChange: s ? () => d(l.value) : void 0
65
- }
66
- ),
67
- l.label
68
- ] }, l.value)
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 : [], l = typeof e.label == "string" ? e.label : "";
97
+ const t = Array.isArray(e.options) ? e.options : [], n = typeof e.label == "string" ? e.label : "";
73
98
  return /* @__PURE__ */ r(
74
- a,
99
+ o,
75
100
  {
76
- label: l,
77
- value: typeof o == "string" ? o : "",
78
- ...n,
79
- onChange: s ? (c) => d(c.target.value) : void 0,
80
- children: t.map((c) => /* @__PURE__ */ r(y, { value: c.value, children: c.label }, c.value))
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
- a,
113
+ o,
87
114
  {
88
115
  type: "button",
89
- ...n,
90
- onClick: s ? () => d(null) : void 0,
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, l = Math.min(6, Math.max(1, t)), c = typeof e.text == "string" ? e.text : "";
96
- return /* @__PURE__ */ r(a, { level: l, children: c });
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(a, { children: typeof e.text == "string" ? e.text : "" });
126
+ return /* @__PURE__ */ r(o, { children: typeof e.text == "string" ? e.text : "" });
100
127
  case "alert":
101
- return /* @__PURE__ */ r(a, { role: "alert", children: typeof e.message == "string" ? e.message : "" });
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
- a,
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(a, { ...n });
155
+ return /* @__PURE__ */ r(o, { ...l });
113
156
  }
114
157
  };
115
158
  export {
116
- x as rhcRenderer
159
+ O as rhcRenderer
117
160
  };
@@ -1,22 +1,24 @@
1
1
  "use client";
2
- import { Alert as d, Paragraph as l, Heading as n, Button as o, FormFieldSelect as a, RadioGroup as c, Checkbox as r, Textarea as t, TextInput as e } from "@rijkshuisstijl-community/components-react";
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 i } from "../../../ui/src/components/ProgressLoaderBar/ProgressLoaderBar.js";
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: { component: r, included: ["disabled"] },
13
- radioGroup: { component: c, included: [] },
14
- dropdown: { component: a, included: ["disabled"] },
15
- button: { component: o, included: ["disabled"] },
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: l, included: [] },
18
- alert: { component: d, included: [] },
19
- "progress-loader": { component: i, included: ["mode", "label"] }
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
- };