@digiform/wizard 0.3.1 → 0.3.3

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 (54) hide show
  1. package/features/form-runtime/components/FormFooter.d.ts +5 -0
  2. package/features/form-runtime/hooks/useValidationEvents.d.ts +0 -1
  3. package/features/form-runtime/index.d.ts +0 -1
  4. package/features/state-management/machines/formMachine.d.ts +3 -0
  5. package/features/state-management/machines/types.d.ts +4 -0
  6. package/features/state-management/machines/useFormMachine.d.ts +24 -6
  7. package/package.json +31 -15
  8. package/styles.css +1 -1
  9. package/ui/src/lib/types/guards.js +1 -5
  10. package/wizard/src/features/api-integration/services/ApiCallService.js +65 -74
  11. package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +39 -43
  12. package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +37 -41
  13. package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +44 -45
  14. package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +48 -95
  15. package/wizard/src/features/form-runtime/FormWizard/FormWizard.module.css.js +4 -12
  16. package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
  17. package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +150 -194
  18. package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +92 -108
  19. package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
  20. package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +44 -63
  21. package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +26 -40
  22. package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
  23. package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +26 -37
  24. package/wizard/src/features/form-runtime/utils/logger.js +12 -12
  25. package/wizard/src/features/state-management/machines/actions/navigationActions.js +13 -8
  26. package/wizard/src/features/state-management/machines/componentTriggerEngine.js +167 -432
  27. package/wizard/src/features/state-management/machines/formMachine.js +558 -677
  28. package/wizard/src/features/state-management/machines/useFormMachine.js +173 -191
  29. package/wizard/src/features/trigger-action-system/components/ActionManager.js +35 -86
  30. package/wizard/src/features/validation-system/validation/SchemaBuilder.js +28 -82
  31. package/wizard/src/features/validation-system/validation/ValidationCache.js +11 -27
  32. package/wizard/src/features/validation-system/validation/ValidationExecutor.js +47 -87
  33. package/core/src/types/guards.js +0 -7
  34. package/features/form-runtime/config/configResolver.d.ts +0 -14
  35. package/features/form-runtime/config/index.d.ts +0 -9
  36. package/features/form-runtime/config/templateConfig.d.ts +0 -148
  37. package/features/form-runtime/config/templateLoader.d.ts +0 -25
  38. package/features/form-runtime/config/templateUtils.d.ts +0 -12
  39. package/features/form-runtime/utils/formSaver.d.ts +0 -22
  40. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +0 -9
  41. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  42. package/features/state-management/machines/__tests__/vitest.config.d.ts +0 -2
  43. package/features/state-management/machines/actions/validationActions.d.ts +0 -68
  44. package/features/state-management/machines/lazyLoading.d.ts +0 -34
  45. package/features/state-management/machines/validation/index.d.ts +0 -5
  46. package/features/state-management/machines/validation/validateField.d.ts +0 -2
  47. package/features/state-management/machines/validation/validateForm.d.ts +0 -2
  48. package/features/state-management/machines/validation/validateSection.d.ts +0 -2
  49. package/features/state-management/machines/validation/validateStep.d.ts +0 -2
  50. package/features/state-management/machines/validation/validationTypes.d.ts +0 -1
  51. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
  52. package/ui/src/lib/utils/templateUtils.js +0 -20
  53. package/wizard/src/features/form-runtime/config/configResolver.js +0 -34
  54. package/wizard/src/features/form-runtime/config/templateLoader.js +0 -235
@@ -2,11 +2,11 @@
2
2
  import { compileApiRequestBody as h } from "../../../../../core/src/utils/apiBodyUtils.js";
3
3
  import { ActionValidationError as c } from "../../validation-system/validation/ActionValidation.js";
4
4
  import "@tanstack/react-query";
5
- function y(l) {
6
- return l !== null && typeof l == "object" && !Array.isArray(l);
5
+ function y(n) {
6
+ return n !== null && typeof n == "object" && !Array.isArray(n);
7
7
  }
8
- function d(l) {
9
- return typeof l == "object" && l !== null && "message" in l && typeof l.message == "string";
8
+ function d(n) {
9
+ return typeof n == "object" && n !== null && "message" in n && typeof n.message == "string";
10
10
  }
11
11
  class C {
12
12
  options;
@@ -18,15 +18,15 @@ class C {
18
18
  if (e.cacheKey)
19
19
  return this.interpolateTemplate(e.cacheKey, r);
20
20
  const t = this.interpolateTemplate(e.url, r), i = e.method;
21
- let s = "";
21
+ let o = "";
22
22
  if (i === "POST" || i === "PUT")
23
23
  try {
24
- const n = h(e, r);
25
- s = n ? `:${JSON.stringify(n)}` : "";
24
+ const a = h(e, r);
25
+ o = a ? `:${JSON.stringify(a)}` : "";
26
26
  } catch {
27
- s = "";
27
+ o = "";
28
28
  }
29
- return `api-call:${i}:${t}${s}`;
29
+ return `api-call:${i}:${t}${o}`;
30
30
  }
31
31
  // Create query options for React Query
32
32
  createQueryOptions(e, r) {
@@ -62,12 +62,12 @@ class C {
62
62
  let t = this.interpolateTemplate(e.url, r);
63
63
  const i = this.buildQueryParams(e, r);
64
64
  if (i.size > 0) {
65
- const o = new URL(t, window.location.origin);
65
+ const s = new URL(t, window.location.origin);
66
66
  i.forEach((p, m) => {
67
- o.searchParams.set(m, p);
68
- }), t = o.toString();
67
+ s.searchParams.set(m, p);
68
+ }), t = s.toString();
69
69
  }
70
- const s = this.buildHeaders(e, r);
70
+ const o = this.buildHeaders(e, r);
71
71
  try {
72
72
  new URL(t, window.location.origin);
73
73
  } catch {
@@ -78,63 +78,63 @@ class C {
78
78
  { url: t, originalUrl: e.url }
79
79
  );
80
80
  }
81
- const n = {
81
+ const a = {
82
82
  method: e.method,
83
- headers: s
83
+ headers: o
84
84
  };
85
85
  if (e.method === "POST" || e.method === "PUT")
86
86
  try {
87
- const o = h(e, r);
88
- o && (n.body = o, s["Content-Type"] = s["Content-Type"] || "application/json");
89
- } catch (o) {
87
+ const s = h(e, r);
88
+ s && (a.body = s, o["Content-Type"] = o["Content-Type"] || "application/json");
89
+ } catch (s) {
90
90
  throw new c(
91
91
  "api-call-error",
92
92
  "apiCall",
93
- `Failed to compile request body: ${o.message}`,
93
+ `Failed to compile request body: ${s.message}`,
94
94
  { config: e, formData: r }
95
95
  );
96
96
  }
97
- const a = new AbortController(), u = setTimeout(
98
- () => a.abort(),
97
+ const l = new AbortController(), u = setTimeout(
98
+ () => l.abort(),
99
99
  e.timeout || 1e4
100
100
  );
101
101
  try {
102
- const o = await fetch(t, {
103
- ...n,
104
- signal: a.signal
102
+ const s = await fetch(t, {
103
+ ...a,
104
+ signal: l.signal
105
105
  });
106
- if (clearTimeout(u), !o.ok) {
107
- const p = await o.text().catch(() => "Unknown error");
106
+ if (clearTimeout(u), !s.ok) {
107
+ const p = await s.text().catch(() => "Unknown error");
108
108
  throw new c(
109
109
  "api-call-error",
110
110
  "apiCall",
111
- `API call failed: ${o.status} ${o.statusText}`,
111
+ `API call failed: ${s.status} ${s.statusText}`,
112
112
  {
113
- status: o.status,
114
- statusText: o.statusText,
113
+ status: s.status,
114
+ statusText: s.statusText,
115
115
  errorText: p,
116
116
  url: t
117
117
  }
118
118
  );
119
119
  }
120
120
  try {
121
- return await o.json();
121
+ return await s.json();
122
122
  } catch {
123
- return await o.text();
123
+ return await s.text();
124
124
  }
125
- } catch (o) {
126
- throw clearTimeout(u), o instanceof c ? o : o instanceof DOMException && o.name === "AbortError" ? new c(
125
+ } catch (s) {
126
+ throw clearTimeout(u), s instanceof c ? s : s instanceof DOMException && s.name === "AbortError" ? new c(
127
127
  "api-call-error",
128
128
  "apiCall",
129
129
  `API call timed out after ${e.timeout || 1e4}ms`,
130
130
  { url: t, timeout: e.timeout || 1e4 }
131
- ) : this.isCorsError(o, t) ? new c(
131
+ ) : this.isCorsError(s, t) ? new c(
132
132
  "api-cors-error",
133
133
  "apiCall",
134
134
  "Unable to connect to the external service due to security restrictions. This typically happens when the target server doesn't allow cross-origin requests from this website.",
135
135
  {
136
136
  url: t,
137
- originalError: o.message,
137
+ originalError: s.message,
138
138
  errorType: "CORS",
139
139
  userFriendlyMessage: "The external service is not accessible from this application due to security policies.",
140
140
  suggestedActions: [
@@ -143,13 +143,13 @@ class C {
143
143
  "Check if the API endpoint URL is correct"
144
144
  ]
145
145
  }
146
- ) : this.isNetworkError(o) ? new c(
146
+ ) : this.isNetworkError(s) ? new c(
147
147
  "api-network-error",
148
148
  "apiCall",
149
149
  "Failed to connect to the external service. Please check your internet connection or try again later.",
150
150
  {
151
151
  url: t,
152
- originalError: o.message,
152
+ originalError: s.message,
153
153
  errorType: "NETWORK",
154
154
  userFriendlyMessage: "Unable to connect to the external service. This could be due to network issues or the service being unavailable.",
155
155
  suggestedActions: [
@@ -161,10 +161,10 @@ class C {
161
161
  ) : new c(
162
162
  "api-call-error",
163
163
  "apiCall",
164
- `Network error: ${o.message}`,
164
+ `Network error: ${s.message}`,
165
165
  {
166
166
  url: t,
167
- originalError: o.message,
167
+ originalError: s.message,
168
168
  userFriendlyMessage: "An unexpected error occurred while calling the external service."
169
169
  }
170
170
  );
@@ -174,7 +174,7 @@ class C {
174
174
  * Detects if an error is likely a CORS error
175
175
  */
176
176
  isCorsError(e, r) {
177
- const t = d(e) ? e.message.toLowerCase() : "", s = [
177
+ const t = d(e) ? e.message.toLowerCase() : "", o = [
178
178
  "cors",
179
179
  "cross-origin",
180
180
  "access to fetch",
@@ -184,8 +184,8 @@ class C {
184
184
  "cors error"
185
185
  ].some(
186
186
  (u) => t.includes(u)
187
- ), n = r.startsWith("http") && !r.includes(window.location.hostname), a = e instanceof TypeError && t.includes("failed to fetch") && n;
188
- return s || a;
187
+ ), a = r.startsWith("http") && !r.includes(window.location.hostname), l = e instanceof TypeError && t.includes("failed to fetch") && a;
188
+ return o || l;
189
189
  }
190
190
  /**
191
191
  * Detects if an error is a network-related error (but not CORS)
@@ -202,21 +202,12 @@ class C {
202
202
  "unreachable",
203
203
  "connection failed"
204
204
  ], i = e instanceof TypeError && r.includes("failed to fetch");
205
- return t.some((s) => r.includes(s)) || i;
205
+ return t.some((o) => r.includes(o)) || i;
206
206
  }
207
207
  applyFlattenedResponseMappings(e, r, t) {
208
- console.log("🔄 Applying response mappings:", {
209
- response: e,
210
- mappings: r
211
- });
212
- for (const [i, s] of Object.entries(r)) {
213
- const n = this.getValueFromPath(e, i), a = this.extractFieldNameFromTemplate(s);
214
- console.log("📝 Field mapping:", {
215
- apiField: i,
216
- formFieldTemplate: s,
217
- actualFieldName: a,
218
- rawValue: n
219
- }), t(a, n);
208
+ for (const [i, o] of Object.entries(r)) {
209
+ const a = this.getValueFromPath(e, i), l = this.extractFieldNameFromTemplate(o);
210
+ t(l, a);
220
211
  }
221
212
  }
222
213
  /**
@@ -262,44 +253,44 @@ class C {
262
253
  // }
263
254
  buildHeaders(e, r) {
264
255
  const t = {}, i = e.headers || e.headersConfig || [];
265
- for (const s of i)
266
- if (s.key.trim() && s.value.trim()) {
267
- const n = this.interpolateTemplate(
268
- s.value,
256
+ for (const o of i)
257
+ if (o.key.trim() && o.value.trim()) {
258
+ const a = this.interpolateTemplate(
259
+ o.value,
269
260
  r
270
261
  );
271
- t[s.key] = n;
262
+ t[o.key] = a;
272
263
  }
273
264
  return t;
274
265
  }
275
266
  buildQueryParams(e, r) {
276
267
  const t = new URLSearchParams(), i = e.params || e.paramsConfig || [];
277
- for (const s of i)
278
- if (s.key.trim() && s.value.trim()) {
279
- const n = this.interpolateTemplate(
280
- s.value,
268
+ for (const o of i)
269
+ if (o.key.trim() && o.value.trim()) {
270
+ const a = this.interpolateTemplate(
271
+ o.value,
281
272
  r
282
273
  );
283
- t.set(s.key, n);
274
+ t.set(o.key, a);
284
275
  }
285
276
  return t;
286
277
  }
287
278
  interpolateTemplate(e, r) {
288
279
  let t = e.replace(
289
280
  /\$\{data\.([^}]+)\}/g,
290
- (i, s) => {
291
- const n = this.getValueFromPath(r, s);
292
- return n != null ? String(n) : i;
281
+ (i, o) => {
282
+ const a = this.getValueFromPath(r, o);
283
+ return a != null ? String(a) : i;
293
284
  }
294
285
  );
295
- return t = t.replace(/\$\{([^}]+)\}/g, (i, s) => {
286
+ return t = t.replace(/\$\{([^}]+)\}/g, (i, o) => {
296
287
  if (i.includes("data.")) return i;
297
- if (s.includes(".")) {
298
- const a = s.split("."), u = a[a.length - 1], o = r[u];
299
- return o != null ? String(o) : i;
288
+ if (o.includes(".")) {
289
+ const l = o.split("."), u = l[l.length - 1], s = r[u];
290
+ return s != null ? String(s) : i;
300
291
  }
301
- const n = this.getValueFromPath(r, s);
302
- return n != null ? String(n) : i;
292
+ const a = this.getValueFromPath(r, o);
293
+ return a != null ? String(a) : i;
303
294
  }), t;
304
295
  }
305
296
  }
@@ -1,54 +1,50 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as r } from "react/jsx-runtime";
2
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
3
3
  /* empty css */
4
4
  import { Button as N } from "../../../../../../ui/src/components/button/button.js";
5
- import { Dialog as g, DialogContent as D, DialogHeader as S, DialogTitle as f, DialogDescription as I } from "../../../../../../ui/src/components/dialog/dialog.js";
6
- import { Sheet as T, SheetContent as M, SheetHeader as _, SheetTitle as B } from "../../../../../../ui/src/components/sheet/sheet.js";
7
- import { memo as H, useState as x } from "react";
5
+ import { Dialog as f, DialogContent as g, DialogHeader as D, DialogTitle as S, DialogDescription as T } from "../../../../../../ui/src/components/dialog/dialog.js";
6
+ import { Sheet as I, SheetContent as _, SheetHeader as B, SheetTitle as H } from "../../../../../../ui/src/components/sheet/sheet.js";
7
+ import { memo as M, useState as x } from "react";
8
8
  import { ConfirmationDialog as $ } from "../ConfirmationDialog/ConfirmationDialog.js";
9
9
  import { EmailVerificationDialog as b } from "../EmailVerificationDialog/EmailVerificationDialog.js";
10
- import l from "./ActionDialog.module.css.js";
11
- const w = H(
12
- ({ config: t, formData: n, onButtonClick: s, onClose: o, isOpen: i }) => {
10
+ import r from "./ActionDialog.module.css.js";
11
+ const w = M(
12
+ ({ config: a, formData: n, onButtonClick: s, onClose: o, isOpen: i }) => {
13
13
  const [c, h] = x(!1);
14
- if (!t) return null;
15
- if (console.log("🔍 ActionDialog config:", {
16
- config: t,
17
- typeId: t.templateMetadata?.typeId,
18
- title: t.title
19
- }), t.templateMetadata?.typeId === "verify-dialog")
14
+ if (!a) return null;
15
+ if (a.templateMetadata?.typeId === "verify-dialog")
20
16
  return /* @__PURE__ */ e(
21
17
  b,
22
18
  {
23
- config: t,
19
+ config: a,
24
20
  formData: n,
25
21
  onButtonClick: s,
26
22
  onClose: o,
27
23
  isOpen: i
28
24
  }
29
25
  );
30
- if (t.templateMetadata?.typeId === "confirmation-dialog")
26
+ if (a.templateMetadata?.typeId === "confirmation-dialog")
31
27
  return /* @__PURE__ */ e(
32
28
  $,
33
29
  {
34
- config: t,
30
+ config: a,
35
31
  formData: n,
36
32
  onButtonClick: s,
37
33
  onClose: o,
38
34
  isOpen: i
39
35
  }
40
36
  );
41
- const y = async (a) => {
37
+ const y = async (t) => {
42
38
  h(!0);
43
39
  try {
44
- s(a.action);
40
+ s(t.action);
45
41
  } finally {
46
42
  h(!1);
47
43
  }
48
44
  }, u = () => {
49
- t.dismissible !== !1 && !c && o();
50
- }, v = (a) => {
51
- switch (a) {
45
+ a.dismissible !== !1 && !c && o();
46
+ }, v = (t) => {
47
+ switch (t) {
52
48
  case "primary":
53
49
  return "default";
54
50
  case "secondary":
@@ -58,53 +54,53 @@ const w = H(
58
54
  default:
59
55
  return "secondary";
60
56
  }
61
- }, d = t.content.replace(
57
+ }, d = a.content.replace(
62
58
  /\$\{data\.([^}]+)\}/g,
63
- (a, C) => {
59
+ (t, C) => {
64
60
  const p = n[C];
65
- return p != null ? String(p) : a;
61
+ return p != null ? String(p) : t;
66
62
  }
67
- ), m = () => /* @__PURE__ */ e("div", { className: l.buttonRow, children: t.buttons.map((a) => /* @__PURE__ */ e(
63
+ ), m = () => /* @__PURE__ */ e("div", { className: r.buttonRow, children: a.buttons.map((t) => /* @__PURE__ */ e(
68
64
  N,
69
65
  {
70
- variant: v(a.variant),
71
- onClick: () => y(a),
66
+ variant: v(t.variant),
67
+ onClick: () => y(t),
72
68
  disabled: c,
73
- className: l.minWidthButton,
74
- children: a.label
69
+ className: r.minWidthButton,
70
+ children: t.label
75
71
  },
76
- `${a.label}-${a.action}`
72
+ `${t.label}-${t.action}`
77
73
  )) });
78
- return t.type === "toast" ? i ? /* @__PURE__ */ e("div", { className: l.toastContainer, children: /* @__PURE__ */ r("div", { className: l.toastCard, children: [
79
- /* @__PURE__ */ r("div", { children: [
80
- /* @__PURE__ */ e("h3", { className: l.toastTitle, children: t.title }),
74
+ return a.type === "toast" ? i ? /* @__PURE__ */ e("div", { className: r.toastContainer, children: /* @__PURE__ */ l("div", { className: r.toastCard, children: [
75
+ /* @__PURE__ */ l("div", { children: [
76
+ /* @__PURE__ */ e("h3", { className: r.toastTitle, children: a.title }),
81
77
  /* @__PURE__ */ e(
82
78
  "div",
83
79
  {
84
- className: l.toastContent,
80
+ className: r.toastContent,
85
81
  dangerouslySetInnerHTML: { __html: d }
86
82
  }
87
83
  )
88
84
  ] }),
89
85
  /* @__PURE__ */ e(m, {})
90
- ] }) }) : null : t.type === "sidebar" ? /* @__PURE__ */ e(T, { open: i, onOpenChange: (a) => !a && u(), children: /* @__PURE__ */ r(M, { className: l.sheetContent, children: [
91
- /* @__PURE__ */ e(_, { children: /* @__PURE__ */ e(B, { children: t.title }) }),
92
- /* @__PURE__ */ r("div", { className: l.sheetBody, children: [
86
+ ] }) }) : null : a.type === "sidebar" ? /* @__PURE__ */ e(I, { open: i, onOpenChange: (t) => !t && u(), children: /* @__PURE__ */ l(_, { className: r.sheetContent, children: [
87
+ /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(H, { children: a.title }) }),
88
+ /* @__PURE__ */ l("div", { className: r.sheetBody, children: [
93
89
  /* @__PURE__ */ e(
94
90
  "div",
95
91
  {
96
- className: l.sheetText,
92
+ className: r.sheetText,
97
93
  dangerouslySetInnerHTML: { __html: d }
98
94
  }
99
95
  ),
100
96
  /* @__PURE__ */ e(m, {})
101
97
  ] })
102
- ] }) }) : /* @__PURE__ */ e(g, { open: i, onOpenChange: (a) => !a && u(), children: /* @__PURE__ */ r(D, { className: l[`size-${t.size || "medium"}`], children: [
103
- /* @__PURE__ */ r(S, { children: [
104
- /* @__PURE__ */ e(f, { children: t.title }),
105
- /* @__PURE__ */ e(I, { asChild: !0, children: /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: d } }) })
98
+ ] }) }) : /* @__PURE__ */ e(f, { open: i, onOpenChange: (t) => !t && u(), children: /* @__PURE__ */ l(g, { className: r[`size-${a.size || "medium"}`], children: [
99
+ /* @__PURE__ */ l(D, { children: [
100
+ /* @__PURE__ */ e(S, { children: a.title }),
101
+ /* @__PURE__ */ e(T, { asChild: !0, children: /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: d } }) })
106
102
  ] }),
107
- /* @__PURE__ */ e("div", { className: l.modalButtonRow, children: /* @__PURE__ */ e(m, {}) })
103
+ /* @__PURE__ */ e("div", { className: r.modalButtonRow, children: /* @__PURE__ */ e(m, {}) })
108
104
  ] }) });
109
105
  }
110
106
  );
@@ -1,64 +1,60 @@
1
1
  "use client";
2
- import { jsx as o, jsxs as a, Fragment as f } from "react/jsx-runtime";
2
+ import { jsx as e, jsxs as t, Fragment as h } from "react/jsx-runtime";
3
3
  /* empty css */
4
- import { Button as p } from "../../../../../../ui/src/components/button/button.js";
5
- import { Dialog as h, DialogContent as u, DialogHeader as C, DialogTitle as c, DialogDescription as s } from "../../../../../../ui/src/components/dialog/dialog.js";
6
- import { HelpCircle as m, Info as D, AlertTriangle as N } from "lucide-react";
4
+ import { Button as f } from "../../../../../../ui/src/components/button/button.js";
5
+ import { Dialog as u, DialogContent as g, DialogHeader as C, DialogTitle as l, DialogDescription as c } from "../../../../../../ui/src/components/dialog/dialog.js";
6
+ import { HelpCircle as s, Info as N, AlertTriangle as D } from "lucide-react";
7
7
  import { memo as v } from "react";
8
- import e from "./ConfirmationDialog.module.css.js";
9
- const y = v(
8
+ import n from "./ConfirmationDialog.module.css.js";
9
+ const I = v(
10
10
  ({
11
11
  config: i,
12
- formData: I,
13
- onButtonClick: d,
14
- onClose: w,
15
- isOpen: t
12
+ formData: w,
13
+ onButtonClick: m,
14
+ onClose: y,
15
+ isOpen: d
16
16
  }) => {
17
- console.log("🔍 ConfirmationDialog rendering!", { isOpen: t, config: i });
18
- const l = i.templateMetadata, g = (n) => {
19
- console.log("🔥 ConfirmationDialog: Button clicked with action:", n), console.log("🔥 ConfirmationDialog: Action type:", n.type), console.log(
20
- "🔥 ConfirmationDialog: Action details:",
21
- JSON.stringify(n, null, 2)
22
- ), d(n), console.log("🔥 ConfirmationDialog: onButtonClick called");
17
+ const o = i.templateMetadata, p = (a) => {
18
+ m(a);
23
19
  }, r = (() => {
24
- if (!l?.showIcon) return null;
25
- switch (l?.iconType) {
20
+ if (!o?.showIcon) return null;
21
+ switch (o?.iconType) {
26
22
  case "warning":
27
- return /* @__PURE__ */ o(N, { className: e.iconWarning });
23
+ return /* @__PURE__ */ e(D, { className: n.iconWarning });
28
24
  case "question":
29
- return /* @__PURE__ */ o(m, { className: e.iconInfo });
25
+ return /* @__PURE__ */ e(s, { className: n.iconInfo });
30
26
  case "info":
31
- return /* @__PURE__ */ o(D, { className: e.iconInfo });
27
+ return /* @__PURE__ */ e(N, { className: n.iconInfo });
32
28
  default:
33
- return /* @__PURE__ */ o(m, { className: e.iconInfo });
29
+ return /* @__PURE__ */ e(s, { className: n.iconInfo });
34
30
  }
35
31
  })();
36
- return /* @__PURE__ */ o(h, { open: t, onOpenChange: () => !1, children: /* @__PURE__ */ a(u, { className: e.dialogContent, children: [
37
- /* @__PURE__ */ o(C, { children: r ? /* @__PURE__ */ a("div", { className: e.iconRow, children: [
38
- /* @__PURE__ */ o("div", { className: e.iconCircle, children: r }),
39
- /* @__PURE__ */ a("div", { children: [
40
- /* @__PURE__ */ o(c, { children: i.title }),
41
- /* @__PURE__ */ o(s, { className: e.descriptionSpaced, children: i.content })
32
+ return /* @__PURE__ */ e(u, { open: d, onOpenChange: () => !1, children: /* @__PURE__ */ t(g, { className: n.dialogContent, children: [
33
+ /* @__PURE__ */ e(C, { children: r ? /* @__PURE__ */ t("div", { className: n.iconRow, children: [
34
+ /* @__PURE__ */ e("div", { className: n.iconCircle, children: r }),
35
+ /* @__PURE__ */ t("div", { children: [
36
+ /* @__PURE__ */ e(l, { children: i.title }),
37
+ /* @__PURE__ */ e(c, { className: n.descriptionSpaced, children: i.content })
42
38
  ] })
43
- ] }) : /* @__PURE__ */ a(f, { children: [
44
- /* @__PURE__ */ o(c, { children: i.title }),
45
- /* @__PURE__ */ o(s, { children: i.content })
39
+ ] }) : /* @__PURE__ */ t(h, { children: [
40
+ /* @__PURE__ */ e(l, { children: i.title }),
41
+ /* @__PURE__ */ e(c, { children: i.content })
46
42
  ] }) }),
47
- /* @__PURE__ */ o("div", { className: e.buttonRow, children: i.buttons.map((n) => /* @__PURE__ */ o(
48
- p,
43
+ /* @__PURE__ */ e("div", { className: n.buttonRow, children: i.buttons.map((a) => /* @__PURE__ */ e(
44
+ f,
49
45
  {
50
- variant: n.variant === "danger" ? "destructive" : n.variant === "secondary" ? "outline" : "default",
51
- onClick: () => g(n.action),
52
- className: e.minWidthButton,
53
- children: n.label
46
+ variant: a.variant === "danger" ? "destructive" : a.variant === "secondary" ? "outline" : "default",
47
+ onClick: () => p(a.action),
48
+ className: n.minWidthButton,
49
+ children: a.label
54
50
  },
55
- n.id
51
+ a.id
56
52
  )) })
57
53
  ] }) });
58
54
  }
59
55
  );
60
- y.displayName = "ConfirmationDialog";
56
+ I.displayName = "ConfirmationDialog";
61
57
  export {
62
- y as ConfirmationDialog,
63
- y as default
58
+ I as ConfirmationDialog,
59
+ I as default
64
60
  };