@overmap-ai/forms 1.0.32-react-flow-david-fixes.41 → 1.0.32

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 (96) hide show
  1. package/dist/form/Observable/index.d.ts +1 -0
  2. package/dist/form/UUIDFile/UUIDFile.d.ts +5 -0
  3. package/dist/form/UUIDFile/index.d.ts +1 -0
  4. package/dist/form/UUIDPromise/index.d.ts +2 -0
  5. package/dist/form/UUIDPromise/utils.d.ts +4 -0
  6. package/dist/form/builder/components/CreateFieldDropdownMenu.d.ts +8 -0
  7. package/dist/form/builder/components/FieldBuilder.d.ts +1 -1
  8. package/dist/form/builder/components/FieldBuilderWithActions.d.ts +9 -0
  9. package/dist/form/builder/components/index.d.ts +2 -1
  10. package/dist/form/builder/hooks.d.ts +1 -1
  11. package/dist/form/builder/list/FieldSectionWithActions.d.ts +1 -1
  12. package/dist/form/builder/utils.d.ts +2 -2
  13. package/dist/form/components/DisplayFile.d.ts +9 -0
  14. package/dist/form/components/index.d.ts +1 -0
  15. package/dist/form/conditions/BaseCondition/BaseCondition.d.ts +6 -7
  16. package/dist/form/conditions/BaseCondition/typings.d.ts +4 -4
  17. package/dist/form/conditions/BooleanFieldCondition/BooleanFieldCondition.d.ts +4 -6
  18. package/dist/form/conditions/CheckboxListFieldCondition/CheckboxListFieldCondition.d.ts +4 -6
  19. package/dist/form/conditions/ConditionManager/ConditionManager.d.ts +15 -0
  20. package/dist/form/conditions/ConditionManager/hooks.d.ts +4 -0
  21. package/dist/form/conditions/ConditionManager/index.d.ts +3 -0
  22. package/dist/form/conditions/ConditionManager/typings.d.ts +2 -0
  23. package/dist/form/conditions/DateFieldCondition/DateFieldCondition.d.ts +4 -6
  24. package/dist/form/conditions/MultiSelectFieldCondition/MultiSelectFieldCondition.d.ts +4 -14
  25. package/dist/form/conditions/MultiStringFieldCondition/MultiStringFieldCondition.d.ts +4 -6
  26. package/dist/form/conditions/NumberFieldCondition/NumberFieldCondition.d.ts +4 -17
  27. package/dist/form/conditions/OTPFieldCondition/OTPFieldCondition.d.ts +4 -6
  28. package/dist/form/conditions/PassFailFieldCondition/PassFailFieldCondition.d.ts +18 -0
  29. package/dist/form/conditions/PassFailFieldCondition/PassFailFieldConditionCell.d.ts +6 -0
  30. package/dist/form/conditions/PassFailFieldCondition/index.d.ts +3 -0
  31. package/dist/form/conditions/PassFailFieldCondition/typings.d.ts +4 -0
  32. package/dist/form/conditions/RadioFieldCondition/RadioFieldCondition.d.ts +4 -6
  33. package/dist/form/conditions/RatingFieldCondition/RatingFieldCondition.d.ts +21 -0
  34. package/dist/form/conditions/RatingFieldCondition/RatingFieldConditionCell.d.ts +6 -0
  35. package/dist/form/conditions/RatingFieldCondition/index.d.ts +3 -0
  36. package/dist/form/conditions/RatingFieldCondition/typings.d.ts +4 -0
  37. package/dist/form/conditions/ScanFieldCondition/ScanFieldCondition.d.ts +4 -6
  38. package/dist/form/conditions/SelectFieldCondition/SelectFieldCondition.d.ts +4 -6
  39. package/dist/form/conditions/StringFieldCondition/StringFieldCondition.d.ts +4 -6
  40. package/dist/form/conditions/TextFieldCondition/TextFieldCondition.d.ts +4 -6
  41. package/dist/form/conditions/UploadFieldCondition/UploadFieldCondition.d.ts +8 -8
  42. package/dist/form/conditions/constants.d.ts +32 -0
  43. package/dist/form/conditions/index.d.ts +3 -0
  44. package/dist/form/conditions/typings.d.ts +6 -3
  45. package/dist/form/conditions/utils.d.ts +3 -4
  46. package/dist/form/fields/BaseField/BaseField.d.ts +5 -6
  47. package/dist/form/fields/BaseField/typings.d.ts +3 -4
  48. package/dist/form/fields/BaseFormElement/BaseFormElement.d.ts +9 -9
  49. package/dist/form/fields/BaseFormElement/typings.d.ts +3 -3
  50. package/dist/form/fields/BaseOptionsField/BaseOptionsField.d.ts +6 -6
  51. package/dist/form/fields/BaseOptionsField/typings.d.ts +2 -2
  52. package/dist/form/fields/BaseStringField/BaseStringField.d.ts +3 -3
  53. package/dist/form/fields/BaseStringField/typings.d.ts +1 -1
  54. package/dist/form/fields/BooleanField/BooleanField.d.ts +2 -3
  55. package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +1 -1
  56. package/dist/form/fields/DateField/DateField.d.ts +1 -1
  57. package/dist/form/fields/FieldSection/FieldSection.d.ts +5 -7
  58. package/dist/form/fields/FieldSection/typings.d.ts +2 -2
  59. package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +1 -1
  60. package/dist/form/fields/MultiStringField/MultiStringField.d.ts +1 -1
  61. package/dist/form/fields/NumberField/NumberField.d.ts +1 -1
  62. package/dist/form/fields/OneTimePasswordField/OTPField.d.ts +1 -1
  63. package/dist/form/fields/PassFailField/PassFailField.d.ts +30 -0
  64. package/dist/form/fields/PassFailField/PassFailInput.d.ts +7 -0
  65. package/dist/form/fields/PassFailField/constants.d.ts +7 -0
  66. package/dist/form/fields/PassFailField/index.d.ts +5 -0
  67. package/dist/form/fields/PassFailField/typings.d.ts +17 -0
  68. package/dist/form/fields/PassFailField/utils.d.ts +7 -0
  69. package/dist/form/fields/RadioField/RadioField.d.ts +1 -1
  70. package/dist/form/fields/RatingField/RatingField.d.ts +32 -0
  71. package/dist/form/fields/RatingField/RatingInput.d.ts +7 -0
  72. package/dist/form/fields/RatingField/index.d.ts +3 -0
  73. package/dist/form/fields/RatingField/typings.d.ts +4 -0
  74. package/dist/form/fields/ScanField/ScanField.d.ts +1 -1
  75. package/dist/form/fields/SelectField/SelectField.d.ts +1 -1
  76. package/dist/form/fields/UploadField/UploadField.d.ts +10 -9
  77. package/dist/form/fields/UploadField/index.d.ts +0 -1
  78. package/dist/form/fields/UploadField/utils.d.ts +0 -3
  79. package/dist/form/fields/constants.d.ts +6 -2
  80. package/dist/form/fields/index.d.ts +2 -0
  81. package/dist/form/fields/typings.d.ts +14 -16
  82. package/dist/form/fields/utils.d.ts +6 -1
  83. package/dist/form/index.d.ts +3 -0
  84. package/dist/form/modifiers/file.d.ts +3 -2
  85. package/dist/form/modifiers/index.d.ts +1 -0
  86. package/dist/form/modifiers/passFailStatus.d.ts +6 -0
  87. package/dist/form/modifiers/utils.d.ts +1 -1
  88. package/dist/form/schema/FieldSchema.d.ts +6 -5
  89. package/dist/form/typings.d.ts +6 -2
  90. package/dist/form/utils.d.ts +5 -11
  91. package/dist/forms.js +2117 -678
  92. package/dist/forms.umd.cjs +2115 -676
  93. package/package.json +3 -5
  94. package/dist/form/builder/components/FieldWithActions.d.ts +0 -10
  95. /package/dist/form/{observable → Observable}/Observable.d.ts +0 -0
  96. /package/dist/form/{fields/UploadField → UUIDPromise}/UUIDPromise.d.ts +0 -0
@@ -5,11 +5,609 @@
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
7
 
8
+ /**
9
+ * @license lucide-react v0.542.0 - ISC
10
+ *
11
+ * This source code is licensed under the ISC license.
12
+ * See the LICENSE file in the root directory of this source tree.
13
+ */
14
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
15
+ const toCamelCase = (string) => string.replace(
16
+ /^([A-Z])|[\s-_]+(\w)/g,
17
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
18
+ );
19
+ const toPascalCase = (string) => {
20
+ const camelCase = toCamelCase(string);
21
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
22
+ };
23
+ const mergeClasses = (...classes) => classes.filter((className, index, array) => {
24
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
25
+ }).join(" ").trim();
26
+ const hasA11yProp = (props) => {
27
+ for (const prop in props) {
28
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
29
+ return true;
30
+ }
31
+ }
32
+ };
33
+ /**
34
+ * @license lucide-react v0.542.0 - ISC
35
+ *
36
+ * This source code is licensed under the ISC license.
37
+ * See the LICENSE file in the root directory of this source tree.
38
+ */
39
+ var defaultAttributes = {
40
+ xmlns: "http://www.w3.org/2000/svg",
41
+ width: 24,
42
+ height: 24,
43
+ viewBox: "0 0 24 24",
44
+ fill: "none",
45
+ stroke: "currentColor",
46
+ strokeWidth: 2,
47
+ strokeLinecap: "round",
48
+ strokeLinejoin: "round"
49
+ };
50
+ /**
51
+ * @license lucide-react v0.542.0 - ISC
52
+ *
53
+ * This source code is licensed under the ISC license.
54
+ * See the LICENSE file in the root directory of this source tree.
55
+ */
56
+ const Icon = React.forwardRef(
57
+ ({
58
+ color = "currentColor",
59
+ size = 24,
60
+ strokeWidth = 2,
61
+ absoluteStrokeWidth,
62
+ className = "",
63
+ children,
64
+ iconNode,
65
+ ...rest
66
+ }, ref) => React.createElement(
67
+ "svg",
68
+ {
69
+ ref,
70
+ ...defaultAttributes,
71
+ width: size,
72
+ height: size,
73
+ stroke: color,
74
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
75
+ className: mergeClasses("lucide", className),
76
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
77
+ ...rest
78
+ },
79
+ [
80
+ ...iconNode.map(([tag, attrs]) => React.createElement(tag, attrs)),
81
+ ...Array.isArray(children) ? children : [children]
82
+ ]
83
+ )
84
+ );
85
+ /**
86
+ * @license lucide-react v0.542.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */
91
+ const createLucideIcon = (iconName, iconNode) => {
92
+ const Component = React.forwardRef(
93
+ ({ className, ...props }, ref) => React.createElement(Icon, {
94
+ ref,
95
+ iconNode,
96
+ className: mergeClasses(
97
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
98
+ `lucide-${iconName}`,
99
+ className
100
+ ),
101
+ ...props
102
+ })
103
+ );
104
+ Component.displayName = toPascalCase(iconName);
105
+ return Component;
106
+ };
107
+ /**
108
+ * @license lucide-react v0.542.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */
113
+ const __iconNode$D = [
114
+ ["path", { d: "M3 12h18", key: "1i2n21" }],
115
+ ["path", { d: "M3 18h18", key: "1h113x" }],
116
+ ["path", { d: "M3 6h18", key: "d0wm0j" }]
117
+ ];
118
+ const AlignJustify = createLucideIcon("align-justify", __iconNode$D);
119
+ /**
120
+ * @license lucide-react v0.542.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */
125
+ const __iconNode$C = [
126
+ ["path", { d: "m3 16 4 4 4-4", key: "1co6wj" }],
127
+ ["path", { d: "M7 20V4", key: "1yoxec" }],
128
+ ["path", { d: "m21 8-4-4-4 4", key: "1c9v7m" }],
129
+ ["path", { d: "M17 4v16", key: "7dpous" }]
130
+ ];
131
+ const ArrowDownUp = createLucideIcon("arrow-down-up", __iconNode$C);
132
+ /**
133
+ * @license lucide-react v0.542.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */
138
+ const __iconNode$B = [
139
+ ["path", { d: "M8 3 4 7l4 4", key: "9rb6wj" }],
140
+ ["path", { d: "M4 7h16", key: "6tx8e3" }],
141
+ ["path", { d: "m16 21 4-4-4-4", key: "siv7j2" }],
142
+ ["path", { d: "M20 17H4", key: "h6l3hr" }]
143
+ ];
144
+ const ArrowLeftRight = createLucideIcon("arrow-left-right", __iconNode$B);
145
+ /**
146
+ * @license lucide-react v0.542.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */
151
+ const __iconNode$A = [
152
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
153
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
154
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
155
+ ["path", { d: "M3 10h18", key: "8toen8" }]
156
+ ];
157
+ const Calendar = createLucideIcon("calendar", __iconNode$A);
158
+ /**
159
+ * @license lucide-react v0.542.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */
164
+ const __iconNode$z = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
165
+ const Check = createLucideIcon("check", __iconNode$z);
166
+ /**
167
+ * @license lucide-react v0.542.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */
172
+ const __iconNode$y = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
173
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$y);
174
+ /**
175
+ * @license lucide-react v0.542.0 - ISC
176
+ *
177
+ * This source code is licensed under the ISC license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */
180
+ const __iconNode$x = [
181
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
182
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
183
+ ];
184
+ const CircleCheck = createLucideIcon("circle-check", __iconNode$x);
185
+ /**
186
+ * @license lucide-react v0.542.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */
191
+ const __iconNode$w = [
192
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
193
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }]
194
+ ];
195
+ const CircleDot = createLucideIcon("circle-dot", __iconNode$w);
196
+ /**
197
+ * @license lucide-react v0.542.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */
202
+ const __iconNode$v = [
203
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
204
+ ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
205
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
206
+ ];
207
+ const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$v);
208
+ /**
209
+ * @license lucide-react v0.542.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */
214
+ const __iconNode$u = [
215
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
216
+ ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
217
+ ["path", { d: "m9 9 6 6", key: "z0biqf" }]
218
+ ];
219
+ const CircleX = createLucideIcon("circle-x", __iconNode$u);
220
+ /**
221
+ * @license lucide-react v0.542.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */
226
+ const __iconNode$t = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
227
+ const Circle = createLucideIcon("circle", __iconNode$t);
228
+ /**
229
+ * @license lucide-react v0.542.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */
234
+ const __iconNode$s = [
235
+ ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
236
+ [
237
+ "path",
238
+ {
239
+ d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
240
+ key: "116196"
241
+ }
242
+ ],
243
+ ["path", { d: "M12 11h4", key: "1jrz19" }],
244
+ ["path", { d: "M12 16h4", key: "n85exb" }],
245
+ ["path", { d: "M8 11h.01", key: "1dfujw" }],
246
+ ["path", { d: "M8 16h.01", key: "18s6g9" }]
247
+ ];
248
+ const ClipboardList = createLucideIcon("clipboard-list", __iconNode$s);
249
+ /**
250
+ * @license lucide-react v0.542.0 - ISC
251
+ *
252
+ * This source code is licensed under the ISC license.
253
+ * See the LICENSE file in the root directory of this source tree.
254
+ */
255
+ const __iconNode$r = [
256
+ ["path", { d: "m12 15 2 2 4-4", key: "2c609p" }],
257
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
258
+ ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
259
+ ];
260
+ const CopyCheck = createLucideIcon("copy-check", __iconNode$r);
261
+ /**
262
+ * @license lucide-react v0.542.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */
267
+ const __iconNode$q = [
268
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
269
+ ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
270
+ ];
271
+ const Copy = createLucideIcon("copy", __iconNode$q);
272
+ /**
273
+ * @license lucide-react v0.542.0 - ISC
274
+ *
275
+ * This source code is licensed under the ISC license.
276
+ * See the LICENSE file in the root directory of this source tree.
277
+ */
278
+ const __iconNode$p = [
279
+ ["path", { d: "M12 15V3", key: "m9g1x1" }],
280
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
281
+ ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
282
+ ];
283
+ const Download = createLucideIcon("download", __iconNode$p);
284
+ /**
285
+ * @license lucide-react v0.542.0 - ISC
286
+ *
287
+ * This source code is licensed under the ISC license.
288
+ * See the LICENSE file in the root directory of this source tree.
289
+ */
290
+ const __iconNode$o = [
291
+ ["path", { d: "M12 17h.01", key: "p32p05" }],
292
+ ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z", key: "1mlx9k" }],
293
+ ["path", { d: "M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3", key: "mhlwft" }]
294
+ ];
295
+ const FileQuestionMark = createLucideIcon("file-question-mark", __iconNode$o);
296
+ /**
297
+ * @license lucide-react v0.542.0 - ISC
298
+ *
299
+ * This source code is licensed under the ISC license.
300
+ * See the LICENSE file in the root directory of this source tree.
301
+ */
302
+ const __iconNode$n = [
303
+ ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
304
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
305
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
306
+ ];
307
+ const FileWarning = createLucideIcon("file-warning", __iconNode$n);
308
+ /**
309
+ * @license lucide-react v0.542.0 - ISC
310
+ *
311
+ * This source code is licensed under the ISC license.
312
+ * See the LICENSE file in the root directory of this source tree.
313
+ */
314
+ const __iconNode$m = [
315
+ ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
316
+ ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }]
317
+ ];
318
+ const File$1 = createLucideIcon("file", __iconNode$m);
319
+ /**
320
+ * @license lucide-react v0.542.0 - ISC
321
+ *
322
+ * This source code is licensed under the ISC license.
323
+ * See the LICENSE file in the root directory of this source tree.
324
+ */
325
+ const __iconNode$l = [
326
+ ["line", { x1: "6", x2: "6", y1: "3", y2: "15", key: "17qcm7" }],
327
+ ["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }],
328
+ ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
329
+ ["path", { d: "M18 9a9 9 0 0 1-9 9", key: "n2h4wq" }]
330
+ ];
331
+ const GitBranch = createLucideIcon("git-branch", __iconNode$l);
332
+ /**
333
+ * @license lucide-react v0.542.0 - ISC
334
+ *
335
+ * This source code is licensed under the ISC license.
336
+ * See the LICENSE file in the root directory of this source tree.
337
+ */
338
+ const __iconNode$k = [
339
+ ["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
340
+ ["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
341
+ ["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
342
+ ["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
343
+ ];
344
+ const Hash = createLucideIcon("hash", __iconNode$k);
345
+ /**
346
+ * @license lucide-react v0.542.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */
351
+ const __iconNode$j = [
352
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
353
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
354
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
355
+ ];
356
+ const Image = createLucideIcon("image", __iconNode$j);
357
+ /**
358
+ * @license lucide-react v0.542.0 - ISC
359
+ *
360
+ * This source code is licensed under the ISC license.
361
+ * See the LICENSE file in the root directory of this source tree.
362
+ */
363
+ const __iconNode$i = [
364
+ ["rect", { width: "18", height: "7", x: "3", y: "3", rx: "1", key: "f1a2em" }],
365
+ ["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }],
366
+ ["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }]
367
+ ];
368
+ const LayoutPanelTop = createLucideIcon("layout-panel-top", __iconNode$i);
369
+ /**
370
+ * @license lucide-react v0.542.0 - ISC
371
+ *
372
+ * This source code is licensed under the ISC license.
373
+ * See the LICENSE file in the root directory of this source tree.
374
+ */
375
+ const __iconNode$h = [
376
+ ["path", { d: "m3 17 2 2 4-4", key: "1jhpwq" }],
377
+ ["path", { d: "m3 7 2 2 4-4", key: "1obspn" }],
378
+ ["path", { d: "M13 6h8", key: "15sg57" }],
379
+ ["path", { d: "M13 12h8", key: "h98zly" }],
380
+ ["path", { d: "M13 18h8", key: "oe0vm4" }]
381
+ ];
382
+ const ListChecks = createLucideIcon("list-checks", __iconNode$h);
383
+ /**
384
+ * @license lucide-react v0.542.0 - ISC
385
+ *
386
+ * This source code is licensed under the ISC license.
387
+ * See the LICENSE file in the root directory of this source tree.
388
+ */
389
+ const __iconNode$g = [
390
+ ["rect", { x: "3", y: "5", width: "6", height: "6", rx: "1", key: "1defrl" }],
391
+ ["path", { d: "m3 17 2 2 4-4", key: "1jhpwq" }],
392
+ ["path", { d: "M13 6h8", key: "15sg57" }],
393
+ ["path", { d: "M13 12h8", key: "h98zly" }],
394
+ ["path", { d: "M13 18h8", key: "oe0vm4" }]
395
+ ];
396
+ const ListTodo = createLucideIcon("list-todo", __iconNode$g);
397
+ /**
398
+ * @license lucide-react v0.542.0 - ISC
399
+ *
400
+ * This source code is licensed under the ISC license.
401
+ * See the LICENSE file in the root directory of this source tree.
402
+ */
403
+ const __iconNode$f = [
404
+ ["path", { d: "M3 12h.01", key: "nlz23k" }],
405
+ ["path", { d: "M3 18h.01", key: "1tta3j" }],
406
+ ["path", { d: "M3 6h.01", key: "1rqtza" }],
407
+ ["path", { d: "M8 12h13", key: "1za7za" }],
408
+ ["path", { d: "M8 18h13", key: "1lx6n3" }],
409
+ ["path", { d: "M8 6h13", key: "ik3vkj" }]
410
+ ];
411
+ const List = createLucideIcon("list", __iconNode$f);
412
+ /**
413
+ * @license lucide-react v0.542.0 - ISC
414
+ *
415
+ * This source code is licensed under the ISC license.
416
+ * See the LICENSE file in the root directory of this source tree.
417
+ */
418
+ const __iconNode$e = [
419
+ ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
420
+ ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
421
+ ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
422
+ ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
423
+ ];
424
+ const Maximize = createLucideIcon("maximize", __iconNode$e);
425
+ /**
426
+ * @license lucide-react v0.542.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */
431
+ const __iconNode$d = [["path", { d: "M5 12h14", key: "1ays0h" }]];
432
+ const Minus = createLucideIcon("minus", __iconNode$d);
433
+ /**
434
+ * @license lucide-react v0.542.0 - ISC
435
+ *
436
+ * This source code is licensed under the ISC license.
437
+ * See the LICENSE file in the root directory of this source tree.
438
+ */
439
+ const __iconNode$c = [
440
+ ["path", { d: "M8 18L12 22L16 18", key: "cskvfv" }],
441
+ ["path", { d: "M12 2V22", key: "r89rzk" }]
442
+ ];
443
+ const MoveDown = createLucideIcon("move-down", __iconNode$c);
444
+ /**
445
+ * @license lucide-react v0.542.0 - ISC
446
+ *
447
+ * This source code is licensed under the ISC license.
448
+ * See the LICENSE file in the root directory of this source tree.
449
+ */
450
+ const __iconNode$b = [
451
+ ["path", { d: "M8 6L12 2L16 6", key: "1yvkyx" }],
452
+ ["path", { d: "M12 2V22", key: "r89rzk" }]
453
+ ];
454
+ const MoveUp = createLucideIcon("move-up", __iconNode$b);
455
+ /**
456
+ * @license lucide-react v0.542.0 - ISC
457
+ *
458
+ * This source code is licensed under the ISC license.
459
+ * See the LICENSE file in the root directory of this source tree.
460
+ */
461
+ const __iconNode$a = [
462
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
463
+ ["path", { d: "M12 5v14", key: "s699le" }]
464
+ ];
465
+ const Plus = createLucideIcon("plus", __iconNode$a);
466
+ /**
467
+ * @license lucide-react v0.542.0 - ISC
468
+ *
469
+ * This source code is licensed under the ISC license.
470
+ * See the LICENSE file in the root directory of this source tree.
471
+ */
472
+ const __iconNode$9 = [
473
+ ["rect", { width: "20", height: "12", x: "2", y: "6", rx: "2", key: "9lu3g6" }],
474
+ ["path", { d: "M12 12h.01", key: "1mp3jc" }],
475
+ ["path", { d: "M17 12h.01", key: "1m0b6t" }],
476
+ ["path", { d: "M7 12h.01", key: "eqddd0" }]
477
+ ];
478
+ const RectangleEllipsis = createLucideIcon("rectangle-ellipsis", __iconNode$9);
479
+ /**
480
+ * @license lucide-react v0.542.0 - ISC
481
+ *
482
+ * This source code is licensed under the ISC license.
483
+ * See the LICENSE file in the root directory of this source tree.
484
+ */
485
+ const __iconNode$8 = [
486
+ ["path", { d: "M3 7V5a2 2 0 0 1 2-2h2", key: "aa7l1z" }],
487
+ ["path", { d: "M17 3h2a2 2 0 0 1 2 2v2", key: "4qcy5o" }],
488
+ ["path", { d: "M21 17v2a2 2 0 0 1-2 2h-2", key: "6vwrx8" }],
489
+ ["path", { d: "M7 21H5a2 2 0 0 1-2-2v-2", key: "ioqczr" }]
490
+ ];
491
+ const Scan = createLucideIcon("scan", __iconNode$8);
492
+ /**
493
+ * @license lucide-react v0.542.0 - ISC
494
+ *
495
+ * This source code is licensed under the ISC license.
496
+ * See the LICENSE file in the root directory of this source tree.
497
+ */
498
+ const __iconNode$7 = [
499
+ [
500
+ "path",
501
+ {
502
+ d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
503
+ key: "1i5ecw"
504
+ }
505
+ ],
506
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
507
+ ];
508
+ const Settings = createLucideIcon("settings", __iconNode$7);
509
+ /**
510
+ * @license lucide-react v0.542.0 - ISC
511
+ *
512
+ * This source code is licensed under the ISC license.
513
+ * See the LICENSE file in the root directory of this source tree.
514
+ */
515
+ const __iconNode$6 = [
516
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
517
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
518
+ ];
519
+ const SquareCheck = createLucideIcon("square-check", __iconNode$6);
520
+ /**
521
+ * @license lucide-react v0.542.0 - ISC
522
+ *
523
+ * This source code is licensed under the ISC license.
524
+ * See the LICENSE file in the root directory of this source tree.
525
+ */
526
+ const __iconNode$5 = [
527
+ ["path", { d: "M5 3a2 2 0 0 0-2 2", key: "y57alp" }],
528
+ ["path", { d: "M19 3a2 2 0 0 1 2 2", key: "18rm91" }],
529
+ ["path", { d: "M21 19a2 2 0 0 1-2 2", key: "1j7049" }],
530
+ ["path", { d: "M5 21a2 2 0 0 1-2-2", key: "sbafld" }],
531
+ ["path", { d: "M9 3h1", key: "1yesri" }],
532
+ ["path", { d: "M9 21h1", key: "15o7lz" }],
533
+ ["path", { d: "M14 3h1", key: "1ec4yj" }],
534
+ ["path", { d: "M14 21h1", key: "v9vybs" }],
535
+ ["path", { d: "M3 9v1", key: "1r0deq" }],
536
+ ["path", { d: "M21 9v1", key: "mxsmne" }],
537
+ ["path", { d: "M3 14v1", key: "vnatye" }],
538
+ ["path", { d: "M21 14v1", key: "169vum" }]
539
+ ];
540
+ const SquareDashed = createLucideIcon("square-dashed", __iconNode$5);
541
+ /**
542
+ * @license lucide-react v0.542.0 - ISC
543
+ *
544
+ * This source code is licensed under the ISC license.
545
+ * See the LICENSE file in the root directory of this source tree.
546
+ */
547
+ const __iconNode$4 = [
548
+ [
549
+ "path",
550
+ {
551
+ d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
552
+ key: "r04s7s"
553
+ }
554
+ ]
555
+ ];
556
+ const Star = createLucideIcon("star", __iconNode$4);
557
+ /**
558
+ * @license lucide-react v0.542.0 - ISC
559
+ *
560
+ * This source code is licensed under the ISC license.
561
+ * See the LICENSE file in the root directory of this source tree.
562
+ */
563
+ const __iconNode$3 = [
564
+ ["path", { d: "M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6", key: "1528k5" }],
565
+ ["path", { d: "M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7", key: "13ksps" }],
566
+ ["path", { d: "M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1", key: "1n9rhb" }],
567
+ ["path", { d: "M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1", key: "1mj8rg" }],
568
+ ["path", { d: "M9 6v12", key: "velyjx" }]
569
+ ];
570
+ const TextCursorInput = createLucideIcon("text-cursor-input", __iconNode$3);
571
+ /**
572
+ * @license lucide-react v0.542.0 - ISC
573
+ *
574
+ * This source code is licensed under the ISC license.
575
+ * See the LICENSE file in the root directory of this source tree.
576
+ */
577
+ const __iconNode$2 = [
578
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
579
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
580
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
581
+ ];
582
+ const Trash = createLucideIcon("trash", __iconNode$2);
583
+ /**
584
+ * @license lucide-react v0.542.0 - ISC
585
+ *
586
+ * This source code is licensed under the ISC license.
587
+ * See the LICENSE file in the root directory of this source tree.
588
+ */
589
+ const __iconNode$1 = [
590
+ ["path", { d: "M12 3v12", key: "1x0j5s" }],
591
+ ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
592
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
593
+ ];
594
+ const Upload = createLucideIcon("upload", __iconNode$1);
595
+ /**
596
+ * @license lucide-react v0.542.0 - ISC
597
+ *
598
+ * This source code is licensed under the ISC license.
599
+ * See the LICENSE file in the root directory of this source tree.
600
+ */
601
+ const __iconNode = [
602
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
603
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
604
+ ];
605
+ const X = createLucideIcon("x", __iconNode);
8
606
  const FileCard = React.memo(
9
607
  React.forwardRef((props, ref) => {
10
608
  const { file, className, error, rightSlot, ...rest } = props;
11
609
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Card, { className: classVarianceAuthority.cx(className, "flex w-full items-center gap-2 text-sm"), ref, ...rest, children: [
12
- error ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "file-question-mark" }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "file", color: "var(--base-a11)" }),
610
+ error ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: FileQuestionMark }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: File$1, color: "var(--base-a11)" }),
13
611
  !error ? file ? /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: "truncate", children: file.name }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Spinner, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { accentColor: "danger", className: "truncate", children: error }),
14
612
  rightSlot
15
613
  ] });
@@ -67,12 +665,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
67
665
  }
68
666
  class BaseField extends BaseFormElement {
69
667
  constructor(options) {
70
- const { label, description = null, required, image, fieldValidators = [], ...base } = options;
668
+ const { label, description = null, required, image, ...base } = options;
71
669
  super(base);
72
670
  __publicField(this, "label");
73
671
  __publicField(this, "description");
74
672
  __publicField(this, "required");
75
- __publicField(this, "fieldValidators");
76
673
  __publicField(this, "image");
77
674
  /**
78
675
  * By default, validation doesn't execute on `onChange` events when editing fields
@@ -85,7 +682,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
85
682
  this.description = description;
86
683
  this.required = required;
87
684
  this.image = image;
88
- this.fieldValidators = fieldValidators;
89
685
  }
90
686
  getError(value) {
91
687
  if (this.required && this.isValueBlank(value)) {
@@ -111,24 +707,22 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
111
707
  label: this.label,
112
708
  description: this.description,
113
709
  required: this.required,
114
- image: this.image,
115
- fieldValidators: this.fieldValidators
710
+ image: this.image
116
711
  };
117
712
  }
118
713
  setOptions(options) {
119
- const { label, description = null, required, image, fieldValidators, ...base } = options;
714
+ const { label, description = null, required, image, ...base } = options;
120
715
  this.label = label ?? this.label;
121
716
  this.description = description ?? this.description;
122
717
  this.required = required ?? this.required;
123
718
  this.image = image ?? this.image;
124
- this.fieldValidators = fieldValidators ?? this.fieldValidators;
125
719
  super.setOptions(base);
126
720
  }
127
721
  isValueBlank(value) {
128
722
  return this.areValuesEqual(value, this.blankValue());
129
723
  }
130
724
  getFieldValidators() {
131
- return [...this.fieldValidators];
725
+ return [];
132
726
  }
133
727
  }
134
728
  __publicField(BaseField, "fieldTypeName");
@@ -172,15 +766,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
172
766
  variant: "ghost",
173
767
  children: [
174
768
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Tooltip.Root, { children: [
175
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleCopy, "aria-label": "copy to clipboard", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "copy" }) }) }),
769
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleCopy, "aria-label": "copy to clipboard", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Copy }) }) }),
176
770
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Content, { size: "sm", children: "Copy" })
177
771
  ] }),
178
772
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Tooltip.Root, { children: [
179
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleDownload, "aria-label": "download", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "download" }) }) }),
773
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleDownload, "aria-label": "download", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Download }) }) }),
180
774
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Content, { size: "sm", children: "Download" })
181
775
  ] }),
182
776
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Separator, { orientation: "vertical", size: "sm" }),
183
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: onClose, "aria-label": "close", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }) }) })
777
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: onClose, "aria-label": "close", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X }) }) })
184
778
  ]
185
779
  }
186
780
  ),
@@ -418,7 +1012,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
418
1012
  "aria-label": "Add option",
419
1013
  disabled: !!internalError || disabled,
420
1014
  onClick: addOption,
421
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" })
1015
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus })
422
1016
  }
423
1017
  )
424
1018
  ] })
@@ -465,7 +1059,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
465
1059
  onClick: () => {
466
1060
  handleDeleteOption(index);
467
1061
  },
468
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" })
1062
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X })
469
1063
  }
470
1064
  )
471
1065
  ]
@@ -653,7 +1247,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
653
1247
  accentColor: "primary",
654
1248
  variant: "surface",
655
1249
  disabled,
656
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
1250
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
657
1251
  }
658
1252
  )
659
1253
  }
@@ -682,7 +1276,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
682
1276
  });
683
1277
  }
684
1278
  static deserialize(data) {
685
- if (data.type !== "boolean") throw new Error("Type mismatch.");
686
1279
  return new _BooleanField(data);
687
1280
  }
688
1281
  serializeValue(value) {
@@ -795,8 +1388,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
795
1388
  description: "Minimum value",
796
1389
  integers: true,
797
1390
  required: false,
798
- identifier: `${path}minimum`,
799
- fieldValidators: []
1391
+ identifier: `${path}minimum`
800
1392
  }),
801
1393
  showDirectly: false
802
1394
  },
@@ -806,8 +1398,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
806
1398
  description: "Maximum value",
807
1399
  integers: true,
808
1400
  required: false,
809
- identifier: `${path}maximum`,
810
- fieldValidators: []
1401
+ identifier: `${path}maximum`
811
1402
  }),
812
1403
  showDirectly: false
813
1404
  },
@@ -932,7 +1523,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
932
1523
  identifier: `${path}minimum_length`,
933
1524
  minimum: 0,
934
1525
  maximum: 100,
935
- fieldValidators: [],
936
1526
  integers: true
937
1527
  }),
938
1528
  showDirectly: false
@@ -946,7 +1536,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
946
1536
  minimum: 1,
947
1537
  maximum: LONG_TEXT_FIELD_MAX_LENGTH,
948
1538
  // TODO: depends on short vs long text
949
- fieldValidators: [],
950
1539
  // TODO: default: 500 (see: "Short text fields can hold up to 500 characters on a single line.")
951
1540
  integers: true
952
1541
  }),
@@ -1049,7 +1638,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1049
1638
  onValuesChange: handleChange,
1050
1639
  disabled,
1051
1640
  children: field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
1052
- /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) }) }),
1641
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) }) }),
1053
1642
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
1054
1643
  ] }, `${inputId}-${option.value}-${index}`))
1055
1644
  }
@@ -1151,7 +1740,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1151
1740
  month: "2-digit",
1152
1741
  day: "2-digit"
1153
1742
  }) : "yyyy-mm-dd",
1154
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
1743
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: ChevronDown })
1155
1744
  ]
1156
1745
  }
1157
1746
  ) }),
@@ -1262,13 +1851,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1262
1851
  disabled,
1263
1852
  children: [
1264
1853
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: value && value.length > 0 ? value.join(", ") : field.placeholder ?? "Select one or more..." }),
1265
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
1854
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: ChevronDown })
1266
1855
  ]
1267
1856
  }
1268
1857
  ) }),
1269
1858
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Scroll, { children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.MultiSelectGroup, { values: value, onValuesChange: handleChange, children: [
1270
1859
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.SelectAllItem, { children: [
1271
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "minus" }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) }),
1860
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Minus }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) }),
1272
1861
  "Select all"
1273
1862
  ] }),
1274
1863
  field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1276,7 +1865,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1276
1865
  {
1277
1866
  value: option.value,
1278
1867
  children: [
1279
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) }),
1868
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) }),
1280
1869
  option.label
1281
1870
  ]
1282
1871
  },
@@ -1382,12 +1971,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1382
1971
  disabled,
1383
1972
  children: [
1384
1973
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: currentOption ? currentOption.label : field.placeholder ?? "Select one..." }),
1385
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
1974
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: ChevronDown })
1386
1975
  ]
1387
1976
  }
1388
1977
  ) }),
1389
1978
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Scroll, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectGroup, { required: false, value: value ?? void 0, onValueChange: handleChange, children: field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.SelectItem, { value: option.value, children: [
1390
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) }),
1979
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) }),
1391
1980
  option.label
1392
1981
  ] }, `${inputId}-${option.value}-${index}`)) }) }) })
1393
1982
  ] })
@@ -1473,17 +2062,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1473
2062
  },
1474
2063
  [field, helpers, touched]
1475
2064
  );
1476
- const handleBlur = React.useCallback(
1477
- (e) => {
1478
- const { relatedTarget } = e;
1479
- if (relatedTarget instanceof Element && inputUuids.includes(relatedTarget.id)) {
1480
- return;
1481
- }
1482
- onChange(internalValue);
1483
- onBlur(internalValue);
1484
- },
1485
- [inputUuids, internalValue, onBlur, onChange]
1486
- );
2065
+ const handleBlur = React.useCallback(() => {
2066
+ onChange(internalValue);
2067
+ onBlur(internalValue);
2068
+ }, [internalValue, onBlur, onChange]);
1487
2069
  return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
1488
2070
  InputWithLabel,
1489
2071
  {
@@ -1513,8 +2095,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1513
2095
  accentColor: "base",
1514
2096
  variant: "surface",
1515
2097
  size: "sm",
2098
+ onBlur: handleBlur,
1516
2099
  children: [
1517
- inputUuids.map((inputUuid) => /* @__PURE__ */ jsxRuntime.jsx(blocks.OneTimePasswordField.Input, { id: inputUuid, onBlur: handleBlur }, inputUuid)),
2100
+ inputUuids.map((inputUuid) => /* @__PURE__ */ jsxRuntime.jsx(blocks.OneTimePasswordField.Input, { id: inputUuid }, inputUuid)),
1518
2101
  /* @__PURE__ */ jsxRuntime.jsx(blocks.OneTimePasswordField.HiddenInput, {})
1519
2102
  ]
1520
2103
  }
@@ -1544,8 +2127,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1544
2127
  required: false,
1545
2128
  minimum: 1,
1546
2129
  maximum: 16,
1547
- identifier: `${path}length`,
1548
- fieldValidators: []
2130
+ identifier: `${path}length`
1549
2131
  }),
1550
2132
  showDirectly: false
1551
2133
  },
@@ -1641,6 +2223,564 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1641
2223
  __publicField(_OTPField, "fieldTypeName", "OTP");
1642
2224
  __publicField(_OTPField, "fieldTypeDescription", "Allows specifying a number within a given range.");
1643
2225
  let OTPField = _OTPField;
2226
+ const passFailFieldStatusMapping = {
2227
+ pass: {
2228
+ label: "Pass",
2229
+ icon: CircleCheck
2230
+ },
2231
+ fail: {
2232
+ label: "Fail",
2233
+ icon: CircleX
2234
+ },
2235
+ na: {
2236
+ label: "N/A",
2237
+ icon: CircleQuestionMark
2238
+ }
2239
+ };
2240
+ const passFailFieldStatuses = Object.keys(passFailFieldStatusMapping);
2241
+ class UUIDFile extends File {
2242
+ constructor(uuid2, ...args) {
2243
+ super(...args);
2244
+ __publicField(this, "uuid");
2245
+ this.uuid = uuid2;
2246
+ }
2247
+ static from(uuid2, file) {
2248
+ return new UUIDFile(uuid2, [file], file.name, {
2249
+ lastModified: file.lastModified,
2250
+ type: file.type
2251
+ });
2252
+ }
2253
+ }
2254
+ class UUIDPromise extends Promise {
2255
+ constructor(executor, uuid2) {
2256
+ super(executor);
2257
+ __publicField(this, "_uuid");
2258
+ this._uuid = uuid2;
2259
+ }
2260
+ get uuid() {
2261
+ return this._uuid;
2262
+ }
2263
+ set uuid(uuid2) {
2264
+ this._uuid = uuid2;
2265
+ }
2266
+ static from(promise, uuid2) {
2267
+ return new UUIDPromise((resolve, reject) => {
2268
+ Promise.resolve(promise).then(resolve).catch(reject);
2269
+ }, uuid2);
2270
+ }
2271
+ then(onFulfilled, onRejected) {
2272
+ const promise = super.then(onFulfilled, onRejected);
2273
+ promise.uuid = this.uuid;
2274
+ return promise;
2275
+ }
2276
+ catch(onRejected) {
2277
+ const promise = super.catch(onRejected);
2278
+ promise.uuid = this.uuid;
2279
+ return promise;
2280
+ }
2281
+ finally(onFinally) {
2282
+ const promise = super.finally(onFinally);
2283
+ promise.uuid = this.uuid;
2284
+ return promise;
2285
+ }
2286
+ }
2287
+ function isFileAndPromiseArray(value) {
2288
+ if (!Array.isArray(value)) return false;
2289
+ return value.every((item) => item instanceof UUIDPromise || item instanceof UUIDFile);
2290
+ }
2291
+ function areFileAndPromiseArraysEqual(value1, value2) {
2292
+ if (!value1.every((promise1) => value2.some((promise2) => promise1.uuid === promise2.uuid))) return false;
2293
+ if (!value2.every((promise2) => value1.some((promise1) => promise1.uuid === promise2.uuid))) return false;
2294
+ return true;
2295
+ }
2296
+ const ImageCard = React.memo(
2297
+ React.forwardRef((props, forwardedRef) => {
2298
+ const { file, alt, error, rightSlot, className, ...rest } = props;
2299
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2300
+ blocks.Card,
2301
+ {
2302
+ className: classVarianceAuthority.cx(className, "relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),
2303
+ ref: forwardedRef,
2304
+ ...rest,
2305
+ children: [
2306
+ !file && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grow flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Spinner, {}) }),
2307
+ !!file && !error && /* @__PURE__ */ jsxRuntime.jsx(blocks.Card, { className: "flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding", children: /* @__PURE__ */ jsxRuntime.jsx(
2308
+ "img",
2309
+ {
2310
+ className: "max-w-full object-cover",
2311
+ src: URL.createObjectURL(file),
2312
+ alt: alt ?? file.name
2313
+ }
2314
+ ) }),
2315
+ (!!file || !!error) && /* @__PURE__ */ jsxRuntime.jsxs(
2316
+ "div",
2317
+ {
2318
+ className: classVarianceAuthority.cx("flex w-full items-center gap-2 self-end", {
2319
+ "bg-transparent": !file
2320
+ }),
2321
+ children: [
2322
+ error ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: FileWarning }) : file && /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: File$1 }),
2323
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: "truncate", size: "sm", children: error ?? (file == null ? void 0 : file.name) }),
2324
+ rightSlot
2325
+ ]
2326
+ }
2327
+ )
2328
+ ]
2329
+ }
2330
+ );
2331
+ })
2332
+ );
2333
+ const convertBytesToLargestUnit = (bytes) => {
2334
+ const units = ["byte", "kilobyte", "megabyte"];
2335
+ let sizeInUnit = bytes;
2336
+ let unitIndex = 0;
2337
+ while (sizeInUnit > 1e3 && unitIndex < units.length - 1) {
2338
+ sizeInUnit /= 1e3;
2339
+ unitIndex++;
2340
+ }
2341
+ const formatter = new Intl.NumberFormat([], {
2342
+ // 0 for bytes and kilobytes, 1 for megabytes
2343
+ maximumFractionDigits: Math.max(0, unitIndex - 1),
2344
+ style: "unit",
2345
+ unit: units[unitIndex]
2346
+ });
2347
+ return formatter.format(sizeInUnit);
2348
+ };
2349
+ const DisplayFile = React.memo((props) => {
2350
+ const { file, onRemove, disabled } = props;
2351
+ const [resolvedFile, setResolvedFile] = React.useState(null);
2352
+ const [error, setError] = React.useState(null);
2353
+ const openImageViewer = useImageViewer();
2354
+ const { url, name } = React.useMemo(() => {
2355
+ let url2 = null;
2356
+ let name2;
2357
+ let size;
2358
+ if (resolvedFile == null ? void 0 : resolvedFile.type.startsWith("image/")) {
2359
+ url2 = URL.createObjectURL(resolvedFile);
2360
+ }
2361
+ if (resolvedFile) {
2362
+ name2 = resolvedFile.name;
2363
+ size = convertBytesToLargestUnit(resolvedFile.size);
2364
+ } else {
2365
+ name2 = "Downloading...";
2366
+ size = "...";
2367
+ }
2368
+ return { url: url2, name: name2, size };
2369
+ }, [resolvedFile]);
2370
+ React.useEffect(() => {
2371
+ if (file instanceof UUIDPromise) {
2372
+ file.then((file2) => {
2373
+ setResolvedFile(file2);
2374
+ }).catch((err) => {
2375
+ setError(err instanceof Error ? err.message : "Unknown error");
2376
+ });
2377
+ } else {
2378
+ setResolvedFile(file);
2379
+ }
2380
+ }, [file]);
2381
+ const handleDownload = React.useCallback(
2382
+ (event) => {
2383
+ event.stopPropagation();
2384
+ if (!resolvedFile) {
2385
+ throw new Error("Cannot download a file that is not resolved.");
2386
+ }
2387
+ const blob = new Blob([resolvedFile]);
2388
+ fileSaver.saveAs(blob, name);
2389
+ },
2390
+ [name, resolvedFile]
2391
+ );
2392
+ const handleDelete = React.useCallback(
2393
+ (e) => {
2394
+ e.stopPropagation();
2395
+ onRemove();
2396
+ },
2397
+ [onRemove]
2398
+ );
2399
+ const handleImageCardClick = React.useCallback(() => {
2400
+ if (!resolvedFile) return;
2401
+ openImageViewer((closeFileViewer) => ({
2402
+ file: resolvedFile,
2403
+ onDelete: !disabled ? () => {
2404
+ onRemove();
2405
+ closeFileViewer();
2406
+ } : void 0
2407
+ }));
2408
+ }, [disabled, onRemove, openImageViewer, resolvedFile]);
2409
+ const rightSlotContent = React.useMemo(
2410
+ () => /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
2411
+ /* @__PURE__ */ jsxRuntime.jsx(
2412
+ blocks.IconButton,
2413
+ {
2414
+ "aria-label": `Download ${name}`,
2415
+ type: "button",
2416
+ onClick: handleDownload,
2417
+ disabled: !resolvedFile,
2418
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Download })
2419
+ }
2420
+ ),
2421
+ !disabled && /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash }) })
2422
+ ] }),
2423
+ [disabled, handleDelete, handleDownload, name, resolvedFile]
2424
+ );
2425
+ return url ? /* @__PURE__ */ jsxRuntime.jsx(
2426
+ ImageCard,
2427
+ {
2428
+ className: "cursor-pointer",
2429
+ onClick: handleImageCardClick,
2430
+ file: resolvedFile,
2431
+ error: error ?? void 0,
2432
+ rightSlot: rightSlotContent
2433
+ }
2434
+ ) : /* @__PURE__ */ jsxRuntime.jsx(FileCard, { file: resolvedFile, error: error ?? void 0, rightSlot: rightSlotContent });
2435
+ });
2436
+ DisplayFile.displayName = "DisplayFile";
2437
+ const PassFailInput = React.memo((props) => {
2438
+ const [
2439
+ { inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
2440
+ { disabled }
2441
+ ] = useFormikInput(props);
2442
+ const { value, onChange, onBlur, name } = fieldProps;
2443
+ const [internalNotes, setInternalNotes] = React.useState("");
2444
+ const input = React.useRef(null);
2445
+ const computedHelpText = showInputOnly ? null : helpText;
2446
+ const computedLabel = showInputOnly ? "" : label;
2447
+ const showNotesAndFiles = value.status && field.showNotesAndFilesOn.includes(value.status);
2448
+ const handleStatusChange = React.useCallback(
2449
+ (status) => {
2450
+ const newValue = field.cleanValue({
2451
+ ...value,
2452
+ status
2453
+ });
2454
+ onChange(newValue);
2455
+ onBlur(newValue);
2456
+ },
2457
+ [field, onBlur, onChange, value]
2458
+ );
2459
+ React.useEffect(() => {
2460
+ setInternalNotes(value.notes);
2461
+ }, [value]);
2462
+ const handleNotesChange = React.useCallback(
2463
+ (e) => {
2464
+ const notes = e.target.value;
2465
+ setInternalNotes(notes);
2466
+ if (touched || !field.onlyValidateAfterTouched) {
2467
+ helpers.setError(
2468
+ field.getError({
2469
+ ...value,
2470
+ notes: internalNotes
2471
+ })
2472
+ );
2473
+ }
2474
+ },
2475
+ [field, helpers, internalNotes, touched, value]
2476
+ );
2477
+ const handleNotesBlur = React.useCallback(() => {
2478
+ const newValue = {
2479
+ ...value,
2480
+ notes: internalNotes
2481
+ };
2482
+ onChange(newValue);
2483
+ onBlur(newValue);
2484
+ }, [internalNotes, onBlur, onChange, value]);
2485
+ const handleRemoveFile = React.useCallback(
2486
+ (index) => {
2487
+ const files = [...value.files];
2488
+ files.splice(index, 1);
2489
+ onChange({
2490
+ ...value,
2491
+ files
2492
+ });
2493
+ },
2494
+ [onChange, value]
2495
+ );
2496
+ const handleFileButtonClick = React.useCallback(() => {
2497
+ var _a2;
2498
+ (_a2 = input.current) == null ? void 0 : _a2.click();
2499
+ }, []);
2500
+ const handleFilesChange = React.useCallback(
2501
+ (e) => {
2502
+ const files = Array.from(e.target.files ?? []).map((file) => UUIDFile.from(uuid.v4(), file));
2503
+ const newValue = {
2504
+ ...value,
2505
+ files: [...value.files, ...files]
2506
+ };
2507
+ onChange(newValue);
2508
+ onBlur(newValue);
2509
+ },
2510
+ [onBlur, onChange, value]
2511
+ );
2512
+ React.useEffect(() => {
2513
+ if (!input.current) return;
2514
+ const abortController = new AbortController();
2515
+ input.current.addEventListener(
2516
+ "cancel",
2517
+ () => {
2518
+ onBlur(value);
2519
+ },
2520
+ {
2521
+ signal: abortController.signal
2522
+ }
2523
+ );
2524
+ return () => {
2525
+ abortController.abort();
2526
+ };
2527
+ }, [onBlur, value]);
2528
+ const statusInputId = `${inputId}-status`;
2529
+ const notesInputId = `${inputId}-notes`;
2530
+ const filesInputId = `${inputId}-files`;
2531
+ return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
2532
+ InputWithLabel,
2533
+ {
2534
+ size,
2535
+ severity,
2536
+ inputId,
2537
+ labelId,
2538
+ label: computedLabel,
2539
+ image: showInputOnly ? void 0 : field.image,
2540
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
2541
+ /* @__PURE__ */ jsxRuntime.jsx(
2542
+ blocks.RadioGroup.Root,
2543
+ {
2544
+ id: statusInputId,
2545
+ className: "flex gap-2",
2546
+ name,
2547
+ value: value.status,
2548
+ disabled,
2549
+ accentColor: "base",
2550
+ variant: "surface",
2551
+ size: "sm",
2552
+ onValueChange: handleStatusChange,
2553
+ children: passFailFieldStatuses.map((status) => {
2554
+ const { label: label2 } = passFailFieldStatusMapping[status];
2555
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
2556
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Item, { value: status, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Circle, className: "fill-current" }) }) }),
2557
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: label2 })
2558
+ ] }, `${inputId}-${status}`);
2559
+ })
2560
+ }
2561
+ ),
2562
+ showNotesAndFiles && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2563
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
2564
+ blocks.TextArea,
2565
+ {
2566
+ id: notesInputId,
2567
+ value: internalNotes,
2568
+ name,
2569
+ onChange: handleNotesChange,
2570
+ onBlur: handleNotesBlur,
2571
+ className: "field-sizing-content w-full min-h-12",
2572
+ placeholder: "Notes",
2573
+ resize: "vertical",
2574
+ accentColor: "base",
2575
+ variant: "surface",
2576
+ size: "sm",
2577
+ disabled
2578
+ }
2579
+ ) }),
2580
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
2581
+ /* @__PURE__ */ jsxRuntime.jsxs(
2582
+ blocks.Button,
2583
+ {
2584
+ className: "w-max",
2585
+ size: "sm",
2586
+ variant: "soft",
2587
+ accentColor: "base",
2588
+ onClick: handleFileButtonClick,
2589
+ type: "button",
2590
+ disabled,
2591
+ children: [
2592
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Upload }),
2593
+ "Select files"
2594
+ ]
2595
+ }
2596
+ ),
2597
+ /* @__PURE__ */ jsxRuntime.jsx(
2598
+ "input",
2599
+ {
2600
+ id: filesInputId,
2601
+ name,
2602
+ type: "file",
2603
+ ref: input,
2604
+ multiple: true,
2605
+ className: "hidden",
2606
+ onChange: handleFilesChange,
2607
+ value: ""
2608
+ }
2609
+ ),
2610
+ value.files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-max flex-col gap-2", children: value.files.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(
2611
+ DisplayFile,
2612
+ {
2613
+ file,
2614
+ onRemove: () => {
2615
+ handleRemoveFile(index);
2616
+ },
2617
+ disabled
2618
+ },
2619
+ index
2620
+ )) })
2621
+ ] })
2622
+ ] })
2623
+ ] })
2624
+ }
2625
+ ) });
2626
+ });
2627
+ PassFailInput.displayName = "PassFailInput";
2628
+ const isPassFailFieldStatus = (value) => {
2629
+ return typeof value === "string" && passFailFieldStatuses.includes(value);
2630
+ };
2631
+ const isSerializedPassFailFieldValue = (value) => {
2632
+ if (value === null || typeof value !== "object") return false;
2633
+ if (!("status" in value) || !isPassFailFieldStatus(value.status)) return false;
2634
+ if (!("notes" in value) || !(typeof value.notes === "string")) return false;
2635
+ if (!("files" in value) || !(Array.isArray(value.files) && value.files.length === 0)) return false;
2636
+ return true;
2637
+ };
2638
+ const isPassFailFieldValue = (value) => {
2639
+ if (value === null || typeof value !== "object") return false;
2640
+ if (!("status" in value) || !isPassFailFieldStatus(value.status)) return false;
2641
+ if (!("notes" in value) || !(typeof value.notes === "string")) return false;
2642
+ if (!("files" in value) || !isFileAndPromiseArray(value.files)) return false;
2643
+ return true;
2644
+ };
2645
+ const serializePassFailFieldValue = (value) => {
2646
+ return {
2647
+ status: value.status,
2648
+ notes: value.notes,
2649
+ files: []
2650
+ };
2651
+ };
2652
+ const deserializePassFailFieldValue = (value) => {
2653
+ return {
2654
+ status: value.status,
2655
+ notes: value.notes,
2656
+ files: []
2657
+ };
2658
+ };
2659
+ const arePassFieldValuesEqual = (value1, value2) => {
2660
+ if (value1.status !== value2.status) return false;
2661
+ if (value1.notes !== value2.notes) return false;
2662
+ if (!areFileAndPromiseArraysEqual(value1.files, value2.files)) return false;
2663
+ return true;
2664
+ };
2665
+ const _PassFailField = class _PassFailField extends BaseField {
2666
+ constructor(options) {
2667
+ const { showNotesAndFilesOn, ...rest } = options;
2668
+ super(rest);
2669
+ __publicField(this, "type", "pass-fail");
2670
+ __publicField(this, "onlyValidateAfterTouched", false);
2671
+ __publicField(this, "showNotesAndFilesOn");
2672
+ this.showNotesAndFilesOn = showNotesAndFilesOn;
2673
+ }
2674
+ static getFieldCreationSchema(parentPath = "") {
2675
+ const path = parentPath && `${parentPath}.`;
2676
+ return [
2677
+ {
2678
+ field: new MultiSelectField({
2679
+ identifier: `${path}showNotesAndFilesOn`,
2680
+ label: "Show notes and files on",
2681
+ description: "Show the notes and files on desired statuses.",
2682
+ options: passFailFieldStatuses.map((status) => {
2683
+ const { label } = passFailFieldStatusMapping[status];
2684
+ return {
2685
+ value: status,
2686
+ label
2687
+ };
2688
+ }),
2689
+ required: false
2690
+ }),
2691
+ showDirectly: false
2692
+ }
2693
+ ];
2694
+ }
2695
+ serialize() {
2696
+ return {
2697
+ ...super.serialize(),
2698
+ showNotesAndFilesOn: this.showNotesAndFilesOn
2699
+ };
2700
+ }
2701
+ getOptions() {
2702
+ return {
2703
+ ...super.getOptions(),
2704
+ showNotesAndFilesOn: this.showNotesAndFilesOn
2705
+ };
2706
+ }
2707
+ duplicate(identifier) {
2708
+ return new _PassFailField({
2709
+ ...this.getOptions(),
2710
+ identifier
2711
+ });
2712
+ }
2713
+ setOptions(options) {
2714
+ const { showNotesAndFilesOn, ...rest } = options;
2715
+ this.showNotesAndFilesOn = showNotesAndFilesOn ?? this.showNotesAndFilesOn;
2716
+ super.setOptions(rest);
2717
+ }
2718
+ getFieldValidators() {
2719
+ const validators = super.getFieldValidators();
2720
+ const showNotesAndFileOn = this.showNotesAndFilesOn;
2721
+ const blankValue = this.blankValue();
2722
+ if (showNotesAndFileOn.length > 0) {
2723
+ validators.push((value) => {
2724
+ if (!value.status || !showNotesAndFileOn.includes(value.status)) return;
2725
+ if (blankValue.notes === value.notes) {
2726
+ return "Notes is required.";
2727
+ }
2728
+ });
2729
+ validators.push((value) => {
2730
+ if (!value.status || !showNotesAndFileOn.includes(value.status)) return;
2731
+ if (areFileAndPromiseArraysEqual(blankValue.files, value.files)) {
2732
+ return "Files is required.";
2733
+ }
2734
+ });
2735
+ }
2736
+ return validators;
2737
+ }
2738
+ static deserialize(data) {
2739
+ return new _PassFailField({
2740
+ ...data,
2741
+ showNotesAndFilesOn: data.showNotesAndFilesOn ?? false
2742
+ });
2743
+ }
2744
+ serializeValue(value) {
2745
+ return serializePassFailFieldValue(value);
2746
+ }
2747
+ deserializeValue(value) {
2748
+ return deserializePassFailFieldValue(value);
2749
+ }
2750
+ render(props) {
2751
+ return /* @__PURE__ */ jsxRuntime.jsx(PassFailInput, { field: this, ...props });
2752
+ }
2753
+ isSerializedValueValid(value) {
2754
+ return isSerializedPassFailFieldValue(value);
2755
+ }
2756
+ isValueValid(value) {
2757
+ return isPassFailFieldValue(value);
2758
+ }
2759
+ areValuesEqual(value1, value2) {
2760
+ return arePassFieldValuesEqual(value1, value2);
2761
+ }
2762
+ blankValue() {
2763
+ return {
2764
+ status: null,
2765
+ notes: "",
2766
+ files: []
2767
+ };
2768
+ }
2769
+ cleanValue(value) {
2770
+ if (value.status && this.showNotesAndFilesOn.includes(value.status)) {
2771
+ return value;
2772
+ } else {
2773
+ return {
2774
+ status: value.status,
2775
+ notes: "",
2776
+ files: []
2777
+ };
2778
+ }
2779
+ }
2780
+ };
2781
+ __publicField(_PassFailField, "fieldTypeName", "Pass - Fail");
2782
+ __publicField(_PassFailField, "fieldTypeDescription", "Track pass, fail, or N/A outcome.");
2783
+ let PassFailField = _PassFailField;
1644
2784
  const RadioInput = React.memo((props) => {
1645
2785
  const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
1646
2786
  const { name, onChange, onBlur, value } = fieldProps;
@@ -1666,68 +2806,207 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1666
2806
  labelId,
1667
2807
  label: computedLabel,
1668
2808
  image: showInputOnly ? void 0 : field.image,
1669
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1670
- blocks.RadioGroup.Root,
1671
- {
1672
- id: inputId,
1673
- name,
1674
- className: "flex flex-col gap-1",
1675
- accentColor: "base",
1676
- variant: "surface",
1677
- size: "sm",
1678
- value: value ?? "",
1679
- onValueChange: handleChange,
1680
- disabled,
1681
- children: [
1682
- field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
1683
- /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "circle", className: "fill-current" }) }) }),
1684
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
1685
- ] }, `${inputId}-${option.value}-${index}`)),
1686
- !!value && /* @__PURE__ */ jsxRuntime.jsxs(
1687
- blocks.Button,
2809
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
2810
+ blocks.RadioGroup.Root,
2811
+ {
2812
+ id: inputId,
2813
+ name,
2814
+ className: "flex flex-col gap-1",
2815
+ accentColor: "base",
2816
+ variant: "surface",
2817
+ size: "sm",
2818
+ value: value ?? "",
2819
+ onValueChange: handleChange,
2820
+ disabled,
2821
+ children: [
2822
+ field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
2823
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Circle, className: "fill-current" }) }) }),
2824
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
2825
+ ] }, `${inputId}-${option.value}-${index}`)),
2826
+ !!value && /* @__PURE__ */ jsxRuntime.jsxs(
2827
+ blocks.Button,
2828
+ {
2829
+ onClick: handleClear,
2830
+ className: "w-max -mx-2",
2831
+ type: "button",
2832
+ variant: "ghost",
2833
+ accentColor: "base",
2834
+ size: "sm",
2835
+ children: [
2836
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X }),
2837
+ "Clear"
2838
+ ]
2839
+ }
2840
+ )
2841
+ ]
2842
+ }
2843
+ )
2844
+ }
2845
+ ) });
2846
+ });
2847
+ RadioInput.displayName = "SelectInput";
2848
+ const _RadioField = class _RadioField extends BaseOptionsField {
2849
+ constructor(options) {
2850
+ super(options);
2851
+ __publicField(this, "type", "radio");
2852
+ __publicField(this, "onlyValidateAfterTouched", false);
2853
+ }
2854
+ serialize() {
2855
+ return super.serialize();
2856
+ }
2857
+ getOptions() {
2858
+ return super.getOptions();
2859
+ }
2860
+ duplicate(identifier) {
2861
+ return new _RadioField({
2862
+ ...this.getOptions(),
2863
+ identifier
2864
+ });
2865
+ }
2866
+ setOptions(options) {
2867
+ super.setOptions(options);
2868
+ }
2869
+ static deserialize(data) {
2870
+ return new _RadioField(data);
2871
+ }
2872
+ serializeValue(value) {
2873
+ return value;
2874
+ }
2875
+ deserializeValue(value) {
2876
+ return value;
2877
+ }
2878
+ render(props) {
2879
+ return /* @__PURE__ */ jsxRuntime.jsx(RadioInput, { field: this, ...props });
2880
+ }
2881
+ isSerializedValueValid(value) {
2882
+ return typeof value === "string" || value === "null";
2883
+ }
2884
+ isValueValid(value) {
2885
+ return typeof value === "string" || value === "null";
2886
+ }
2887
+ blankValue() {
2888
+ return null;
2889
+ }
2890
+ areValuesEqual(value1, value2) {
2891
+ return value1 === value2;
2892
+ }
2893
+ };
2894
+ __publicField(_RadioField, "fieldTypeName", "Option list");
2895
+ __publicField(_RadioField, "fieldTypeDescription", "Allows the user to select a single option from a list of options.");
2896
+ let RadioField = _RadioField;
2897
+ const RatingInput = React.memo((props) => {
2898
+ const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
2899
+ const { name, onChange, onBlur, value } = fieldProps;
2900
+ const computedHelpText = showInputOnly ? null : helpText;
2901
+ const computedLabel = showInputOnly ? "" : label;
2902
+ const handleChange = React.useCallback(
2903
+ (value2) => {
2904
+ onChange(value2);
2905
+ onBlur(value2);
2906
+ },
2907
+ [onBlur, onChange]
2908
+ );
2909
+ const handleClear = React.useCallback(() => {
2910
+ onChange(null);
2911
+ onBlur(null);
2912
+ }, [onBlur, onChange]);
2913
+ const ratingOptions = Array.from({ length: field.maxRating }, (_, i) => i + 1);
2914
+ return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
2915
+ InputWithLabel,
2916
+ {
2917
+ size,
2918
+ severity,
2919
+ inputId,
2920
+ labelId,
2921
+ label: computedLabel,
2922
+ image: showInputOnly ? void 0 : field.image,
2923
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-1 items-center", children: [
2924
+ /* @__PURE__ */ jsxRuntime.jsx(
2925
+ blocks.Rating.Root,
2926
+ {
2927
+ id: inputId,
2928
+ name,
2929
+ className: "flex items-center gap-0.5",
2930
+ value,
2931
+ onValueChange: handleChange,
2932
+ disabled,
2933
+ children: ratingOptions.map((rating) => /* @__PURE__ */ jsxRuntime.jsx(
2934
+ blocks.Rating.Item,
1688
2935
  {
1689
- onClick: handleClear,
1690
- className: "w-max -mx-2",
1691
- type: "button",
1692
- variant: "ghost",
1693
- accentColor: "base",
1694
- size: "sm",
1695
- children: [
1696
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }),
1697
- "Clear"
1698
- ]
1699
- }
1700
- )
1701
- ]
1702
- }
1703
- )
2936
+ value: rating,
2937
+ className: "group size-7 flex cursor-pointer disabled:opacity-50 disabled:pointer-events-none items-center justify-center text-yellow-500 transition-colors",
2938
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Star, className: "group-data-[active=true]:fill-current size-full" })
2939
+ },
2940
+ `${inputId}-${rating}`
2941
+ ))
2942
+ }
2943
+ ),
2944
+ !disabled && value !== null && /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleClear, type: "button", variant: "ghost", accentColor: "base", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X }) })
2945
+ ] })
1704
2946
  }
1705
2947
  ) });
1706
2948
  });
1707
- RadioInput.displayName = "SelectInput";
1708
- const _RadioField = class _RadioField extends BaseOptionsField {
2949
+ RatingInput.displayName = "RatingInput";
2950
+ const _RatingField = class _RatingField extends BaseField {
1709
2951
  constructor(options) {
1710
- super(options);
1711
- __publicField(this, "type", "radio");
1712
- __publicField(this, "onlyValidateAfterTouched", false);
2952
+ const { maxRating, ...rest } = options;
2953
+ super(rest);
2954
+ __publicField(this, "type", "rating");
2955
+ __publicField(this, "maxRating");
2956
+ this.maxRating = maxRating;
2957
+ }
2958
+ static getFieldCreationSchema(parentPath = "") {
2959
+ const path = parentPath && `${parentPath}.`;
2960
+ return [
2961
+ {
2962
+ field: new NumberField({
2963
+ label: "Max Rating",
2964
+ description: "Maximum rating value",
2965
+ integers: true,
2966
+ required: false,
2967
+ minimum: 1,
2968
+ maximum: 10,
2969
+ identifier: `${path}maxRating`
2970
+ }),
2971
+ showDirectly: false
2972
+ }
2973
+ ];
2974
+ }
2975
+ getFieldValidators() {
2976
+ const validators = super.getFieldValidators();
2977
+ const max = this.maxRating;
2978
+ validators.push((value) => {
2979
+ if (typeof value === "number" && (value < 1 || value > max)) {
2980
+ return `Rating must be between 1 and ${max}.`;
2981
+ }
2982
+ });
2983
+ return validators;
1713
2984
  }
1714
2985
  serialize() {
1715
- return super.serialize();
2986
+ return {
2987
+ ...super.serialize(),
2988
+ maxRating: this.maxRating
2989
+ };
1716
2990
  }
1717
2991
  getOptions() {
1718
- return super.getOptions();
2992
+ return {
2993
+ ...super.getOptions(),
2994
+ maxRating: this.maxRating
2995
+ };
1719
2996
  }
1720
2997
  duplicate(identifier) {
1721
- return new _RadioField({
2998
+ return new _RatingField({
1722
2999
  ...this.getOptions(),
1723
3000
  identifier
1724
3001
  });
1725
3002
  }
1726
3003
  setOptions(options) {
1727
- super.setOptions(options);
3004
+ const { maxRating, ...rest } = options;
3005
+ this.maxRating = maxRating ?? this.maxRating;
3006
+ super.setOptions(rest);
1728
3007
  }
1729
3008
  static deserialize(data) {
1730
- return new _RadioField(data);
3009
+ return new _RatingField(data);
1731
3010
  }
1732
3011
  serializeValue(value) {
1733
3012
  return value;
@@ -1736,24 +3015,24 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1736
3015
  return value;
1737
3016
  }
1738
3017
  render(props) {
1739
- return /* @__PURE__ */ jsxRuntime.jsx(RadioInput, { field: this, ...props });
3018
+ return /* @__PURE__ */ jsxRuntime.jsx(RatingInput, { field: this, ...props });
1740
3019
  }
1741
3020
  isSerializedValueValid(value) {
1742
- return typeof value === "string" || value === "null";
3021
+ return typeof value === "number" || value === null;
1743
3022
  }
1744
3023
  isValueValid(value) {
1745
- return typeof value === "string" || value === "null";
1746
- }
1747
- blankValue() {
1748
- return null;
3024
+ return typeof value === "number" || value === null;
1749
3025
  }
1750
3026
  areValuesEqual(value1, value2) {
1751
3027
  return value1 === value2;
1752
3028
  }
3029
+ blankValue() {
3030
+ return null;
3031
+ }
1753
3032
  };
1754
- __publicField(_RadioField, "fieldTypeName", "Option list");
1755
- __publicField(_RadioField, "fieldTypeDescription", "Allows the user to select a single option from a list of options.");
1756
- let RadioField = _RadioField;
3033
+ __publicField(_RatingField, "fieldTypeName", "Rating");
3034
+ __publicField(_RatingField, "fieldTypeDescription", "Allows users to select a rating value.");
3035
+ let RatingField = _RatingField;
1757
3036
  const ScannerContext = React.createContext(() => {
1758
3037
  throw new Error("No ScannerProvider found");
1759
3038
  });
@@ -29892,7 +31171,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
29892
31171
  hints: SCANNER_HINTS
29893
31172
  });
29894
31173
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-full flex-col justify-center overflow-hidden bg-(--color-background)", children: [
29895
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }) }) }) }),
31174
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X }) }) }) }),
29896
31175
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grow w-full max-h-full overflow-hidden p-4", children: /* @__PURE__ */ jsxRuntime.jsx("video", { className: "size-full", ref }) })
29897
31176
  ] });
29898
31177
  });
@@ -29999,7 +31278,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
29999
31278
  accentColor: "base",
30000
31279
  disabled,
30001
31280
  children: [
30002
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "maximize" }),
31281
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Maximize }),
30003
31282
  "Scan"
30004
31283
  ]
30005
31284
  }
@@ -30137,7 +31416,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30137
31416
  super.setOptions(options);
30138
31417
  }
30139
31418
  static deserialize(data) {
30140
- if (data.type !== "string") throw new Error("Type mismatch.");
30141
31419
  const { maximum_length, minimum_length, ...rest } = data;
30142
31420
  return new _StringField({
30143
31421
  ...rest,
@@ -30247,107 +31525,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30247
31525
  __publicField(_TextField, "fieldTypeName", "Paragraph");
30248
31526
  __publicField(_TextField, "fieldTypeDescription", `Paragraph fields can hold up to ${LONG_TEXT_FIELD_MAX_LENGTH} characters and can have multiple lines.`);
30249
31527
  let TextField = _TextField;
30250
- const ImageCard = React.memo(
30251
- React.forwardRef((props, forwardedRef) => {
30252
- const { file, alt, error, rightSlot, className, ...rest } = props;
30253
- return /* @__PURE__ */ jsxRuntime.jsxs(
30254
- blocks.Card,
30255
- {
30256
- className: classVarianceAuthority.cx(className, "relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),
30257
- ref: forwardedRef,
30258
- ...rest,
30259
- children: [
30260
- !file && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grow flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Spinner, {}) }),
30261
- !!file && !error && /* @__PURE__ */ jsxRuntime.jsx(blocks.Card, { className: "flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding", children: /* @__PURE__ */ jsxRuntime.jsx(
30262
- "img",
30263
- {
30264
- className: "max-w-full object-cover",
30265
- src: URL.createObjectURL(file),
30266
- alt: alt ?? file.name
30267
- }
30268
- ) }),
30269
- (!!file || !!error) && /* @__PURE__ */ jsxRuntime.jsxs(
30270
- "div",
30271
- {
30272
- className: classVarianceAuthority.cx("flex w-full items-center gap-2 self-end", {
30273
- "bg-transparent": !file
30274
- }),
30275
- children: [
30276
- error ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "file-warning" }) : file && /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "file" }),
30277
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: "truncate", size: "sm", children: error ?? (file == null ? void 0 : file.name) }),
30278
- rightSlot
30279
- ]
30280
- }
30281
- )
30282
- ]
30283
- }
30284
- );
30285
- })
30286
- );
30287
- class UUIDPromise extends Promise {
30288
- constructor(executor, uuid2) {
30289
- super(executor);
30290
- __publicField(this, "_uuid");
30291
- this._uuid = uuid2;
30292
- }
30293
- get uuid() {
30294
- return this._uuid;
30295
- }
30296
- set uuid(uuid2) {
30297
- this._uuid = uuid2;
30298
- }
30299
- static from(promise, uuid2) {
30300
- return new UUIDPromise((resolve, reject) => {
30301
- Promise.resolve(promise).then(resolve).catch(reject);
30302
- }, uuid2);
30303
- }
30304
- then(onFulfilled, onRejected) {
30305
- const promise = super.then(onFulfilled, onRejected);
30306
- promise.uuid = this.uuid;
30307
- return promise;
30308
- }
30309
- catch(onRejected) {
30310
- const promise = super.catch(onRejected);
30311
- promise.uuid = this.uuid;
30312
- return promise;
30313
- }
30314
- finally(onFinally) {
30315
- const promise = super.finally(onFinally);
30316
- promise.uuid = this.uuid;
30317
- return promise;
30318
- }
30319
- }
30320
- const convertBytesToLargestUnit = (bytes) => {
30321
- const units = ["byte", "kilobyte", "megabyte"];
30322
- let sizeInUnit = bytes;
30323
- let unitIndex = 0;
30324
- while (sizeInUnit > 1e3 && unitIndex < units.length - 1) {
30325
- sizeInUnit /= 1e3;
30326
- unitIndex++;
30327
- }
30328
- const formatter = new Intl.NumberFormat([], {
30329
- // 0 for bytes and kilobytes, 1 for megabytes
30330
- maximumFractionDigits: Math.max(0, unitIndex - 1),
30331
- style: "unit",
30332
- unit: units[unitIndex]
30333
- });
30334
- return formatter.format(sizeInUnit);
30335
- };
30336
- function areFilesEqual(file1, file2) {
30337
- return file1.name === file2.name && file1.size === file2.size && file1.type === file2.type;
30338
- }
30339
- function separateFilesFromPromises(filesOrPromises) {
30340
- const files = [];
30341
- const promises = [];
30342
- for (const fileOrPromise of filesOrPromises) {
30343
- if (fileOrPromise instanceof UUIDPromise) {
30344
- promises.push(fileOrPromise);
30345
- } else {
30346
- files.push(fileOrPromise);
30347
- }
30348
- }
30349
- return [files, promises];
30350
- }
30351
31528
  const UploadInput = React.memo((props) => {
30352
31529
  var _a2;
30353
31530
  const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps }, { disabled }] = useFormikInput(props);
@@ -30372,7 +31549,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30372
31549
  onBlur([]);
30373
31550
  return;
30374
31551
  }
30375
- const fileArray = Array.from(files);
31552
+ const fileArray = Array.from(files).map((file) => UUIDFile.from(uuid.v4(), file));
30376
31553
  const newValue = [...value, ...fileArray];
30377
31554
  onChange(newValue);
30378
31555
  onBlur(newValue);
@@ -30427,7 +31604,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30427
31604
  type: "button",
30428
31605
  disabled,
30429
31606
  children: [
30430
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "upload" }),
31607
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Upload }),
30431
31608
  buttonText
30432
31609
  ]
30433
31610
  }
@@ -30452,7 +31629,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30452
31629
  Array.isArray(value) && value.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-max flex-col gap-2", children: value.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(
30453
31630
  DisplayFile,
30454
31631
  {
30455
- field,
30456
31632
  file,
30457
31633
  onRemove: () => {
30458
31634
  handleRemove(index);
@@ -30464,92 +31640,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30464
31640
  ] });
30465
31641
  });
30466
31642
  UploadInput.displayName = "UploadInput";
30467
- const DisplayFile = React.memo((props) => {
30468
- const { file, field, onRemove, disabled } = props;
30469
- const [resolvedFile, setResolvedFile] = React.useState(null);
30470
- const openImageViewer = useImageViewer();
30471
- const error = React.useMemo(() => resolvedFile && field.getError([resolvedFile]), [field, resolvedFile]);
30472
- const { url, name } = React.useMemo(() => {
30473
- let url2 = null;
30474
- let name2;
30475
- let size;
30476
- if (resolvedFile == null ? void 0 : resolvedFile.type.startsWith("image/")) {
30477
- url2 = URL.createObjectURL(resolvedFile);
30478
- }
30479
- if (resolvedFile) {
30480
- name2 = resolvedFile.name;
30481
- size = convertBytesToLargestUnit(resolvedFile.size);
30482
- } else {
30483
- name2 = "Downloading...";
30484
- size = "...";
30485
- }
30486
- return { url: url2, name: name2, size };
30487
- }, [resolvedFile]);
30488
- React.useEffect(() => {
30489
- if (file instanceof UUIDPromise) {
30490
- file.then((file2) => {
30491
- setResolvedFile(file2);
30492
- }).catch(console.error);
30493
- } else {
30494
- setResolvedFile(file);
30495
- }
30496
- }, [file]);
30497
- const handleDownload = React.useCallback(
30498
- (event) => {
30499
- event.stopPropagation();
30500
- if (!resolvedFile) {
30501
- throw new Error("Cannot download a file that is not resolved.");
30502
- }
30503
- const blob = new Blob([resolvedFile]);
30504
- fileSaver.saveAs(blob, name);
30505
- },
30506
- [name, resolvedFile]
30507
- );
30508
- const handleDelete = React.useCallback(
30509
- (e) => {
30510
- e.stopPropagation();
30511
- onRemove();
30512
- },
30513
- [onRemove]
30514
- );
30515
- const handleImageCardClick = React.useCallback(() => {
30516
- if (!resolvedFile) return;
30517
- openImageViewer((closeFileViewer) => ({
30518
- file: resolvedFile,
30519
- onDelete: !disabled ? () => {
30520
- onRemove();
30521
- closeFileViewer();
30522
- } : void 0
30523
- }));
30524
- }, [disabled, onRemove, openImageViewer, resolvedFile]);
30525
- const rightSlotContent = React.useMemo(
30526
- () => /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
30527
- /* @__PURE__ */ jsxRuntime.jsx(
30528
- blocks.IconButton,
30529
- {
30530
- "aria-label": `Download ${name}`,
30531
- type: "button",
30532
- onClick: handleDownload,
30533
- disabled: !resolvedFile,
30534
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "download" })
30535
- }
30536
- ),
30537
- !disabled && /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" }) })
30538
- ] }),
30539
- [disabled, handleDelete, handleDownload, name, resolvedFile]
30540
- );
30541
- return url ? /* @__PURE__ */ jsxRuntime.jsx(
30542
- ImageCard,
30543
- {
30544
- className: "cursor-pointer",
30545
- onClick: handleImageCardClick,
30546
- file: resolvedFile,
30547
- error: error ?? void 0,
30548
- rightSlot: rightSlotContent
30549
- }
30550
- ) : /* @__PURE__ */ jsxRuntime.jsx(FileCard, { file: resolvedFile, error: error ?? void 0, rightSlot: rightSlotContent });
30551
- });
30552
- DisplayFile.displayName = "DisplayFile";
30553
31643
  const _UploadField = class _UploadField extends BaseField {
30554
31644
  constructor(options) {
30555
31645
  const { extensions, maximum_files, maximum_size, ...base } = options;
@@ -30629,7 +31719,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30629
31719
  const maxFileSizeInB = maxFileSizeInMB * 1e3 * 1e3;
30630
31720
  const maxFiles = this.maxFiles || 1;
30631
31721
  validators.push((value) => {
30632
- if (value && value.some((file) => file instanceof File && file.size > maxFileSizeInB)) {
31722
+ if (value && value.some((file) => file instanceof UUIDFile && file.size > maxFileSizeInB)) {
30633
31723
  return `Files must be at most ${maxFileSizeInMB}MB.`;
30634
31724
  }
30635
31725
  });
@@ -30686,16 +31776,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30686
31776
  }
30687
31777
  isValueValid(value) {
30688
31778
  if (!Array.isArray(value)) return false;
30689
- return value.every((item) => item instanceof UUIDPromise || item instanceof File);
31779
+ return value.every((item) => item instanceof UUIDPromise || item instanceof UUIDFile);
30690
31780
  }
30691
31781
  areValuesEqual(value1, value2) {
30692
- const [files1, promises1] = separateFilesFromPromises(value1);
30693
- const [files2, promises2] = separateFilesFromPromises(value2);
30694
- if (!files1.every((file1) => files2.some((file2) => areFilesEqual(file1, file2)))) return false;
30695
- if (!files2.every((file2) => files1.some((file1) => areFilesEqual(file1, file2)))) return false;
30696
- if (!promises1.every((promise1) => promises2.some((promise2) => promise1.uuid === promise2.uuid))) return false;
30697
- if (!promises2.every((promise2) => promises1.some((promise1) => promise1.uuid === promise2.uuid))) return false;
30698
- return true;
31782
+ return areFileAndPromiseArraysEqual(value1, value2);
30699
31783
  }
30700
31784
  blankValue() {
30701
31785
  return [];
@@ -30717,23 +31801,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30717
31801
  "multi-select": MultiSelectField,
30718
31802
  radio: RadioField,
30719
31803
  "checkbox-list": CheckboxListField,
30720
- otp: OTPField
31804
+ "pass-fail": PassFailField,
31805
+ otp: OTPField,
31806
+ rating: RatingField
30721
31807
  };
30722
31808
  const fieldIcons = {
30723
- boolean: "square-check",
30724
- date: "calendar",
30725
- "multi-string": "list",
30726
- number: "hash",
30727
- qr: "scan",
30728
- "multi-select": "list-checks",
30729
- select: "list-todo",
30730
- string: "text-cursor-input",
30731
- text: "align-justify",
30732
- upload: "upload",
30733
- section: "layout-panel-top",
30734
- radio: "circle-dot",
30735
- "checkbox-list": "copy-check",
30736
- otp: "rectangle-ellipsis"
31809
+ boolean: SquareCheck,
31810
+ date: Calendar,
31811
+ "multi-string": List,
31812
+ number: Hash,
31813
+ qr: Scan,
31814
+ "multi-select": ListChecks,
31815
+ select: ListTodo,
31816
+ string: TextCursorInput,
31817
+ text: AlignJustify,
31818
+ upload: Upload,
31819
+ section: LayoutPanelTop,
31820
+ radio: CircleDot,
31821
+ "checkbox-list": CopyCheck,
31822
+ "pass-fail": ClipboardList,
31823
+ otp: RectangleEllipsis,
31824
+ rating: Star
30737
31825
  };
30738
31826
  const maxFileSizeMB = 50;
30739
31827
  const maxFileSizeKB = maxFileSizeMB * 1e3;
@@ -30940,6 +32028,42 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30940
32028
  serialize: (filterValue) => filterValue,
30941
32029
  deserialize: (filterValue) => filterValue
30942
32030
  });
32031
+ const PassFailEqualsConditionModifier = ConditionModifier.create({
32032
+ id: "pass-fail-equals",
32033
+ modifierFn: (value, filterValue) => {
32034
+ return value === filterValue;
32035
+ },
32036
+ label: "is",
32037
+ serialize: (filterValue) => filterValue,
32038
+ deserialize: (filterValue) => filterValue
32039
+ });
32040
+ const PassFailNotEqualsConditionModifier = ConditionModifier.create({
32041
+ id: "pass-fail-not-equals",
32042
+ modifierFn: (value, filterValue) => {
32043
+ return value !== filterValue;
32044
+ },
32045
+ label: "is not",
32046
+ serialize: (filterValue) => filterValue,
32047
+ deserialize: (filterValue) => filterValue
32048
+ });
32049
+ const PassFailArrayIncludesConditionModifier = ConditionModifier.create({
32050
+ id: "pass-fail-array-includes",
32051
+ modifierFn: (value, filterValue) => {
32052
+ return filterValue.includes(value);
32053
+ },
32054
+ label: "is any of",
32055
+ serialize: (filterValue) => filterValue,
32056
+ deserialize: (filterValue) => filterValue
32057
+ });
32058
+ const PassFailArrayExcludesConditionModifier = ConditionModifier.create({
32059
+ id: "pass-fail-array-excludes",
32060
+ modifierFn: (value, filterValue) => {
32061
+ return !filterValue.includes(value);
32062
+ },
32063
+ label: "is none of",
32064
+ serialize: (filterValue) => filterValue,
32065
+ deserialize: (filterValue) => filterValue
32066
+ });
30943
32067
  const StringEqualsConditionModifier = ConditionModifier.create({
30944
32068
  id: "nullable-string-equals",
30945
32069
  modifierFn: (value, filterValue) => {
@@ -31079,9 +32203,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31079
32203
  __publicField(this, "apply", (value) => {
31080
32204
  const modifier = this.modifiers[this.conditionModifier];
31081
32205
  const conditionValue = this.getConditionValue();
31082
- if (conditionValue === void 0 || !modifier.isConditionValueValid(conditionValue)) return true;
31083
- if (!modifier.isValueValid(value)) return false;
31084
- return modifier.modifier.modifierFn(value, conditionValue);
32206
+ if (conditionValue == void 0) return true;
32207
+ if (!modifier.isConditionValueValid(conditionValue)) return true;
32208
+ const transformedValue = this.transformValue(value);
32209
+ if (!modifier.isValueValid(transformedValue)) return false;
32210
+ return modifier.modifier.modifierFn(transformedValue, conditionValue);
31085
32211
  });
31086
32212
  this.id = id;
31087
32213
  this.field = field;
@@ -31097,6 +32223,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31097
32223
  conditionModifier: this.conditionModifier
31098
32224
  };
31099
32225
  }
32226
+ transformValue(value) {
32227
+ return value;
32228
+ }
31100
32229
  }
31101
32230
  const formId = "form-builder";
31102
32231
  const UNLABELLED_FIELD_LABEL = "Unlabelled";
@@ -31109,12 +32238,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31109
32238
  if (typeof children === "function") {
31110
32239
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31111
32240
  children(meta),
31112
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
32241
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
31113
32242
  ] });
31114
32243
  } else {
31115
32244
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31116
32245
  children,
31117
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
32246
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
31118
32247
  ] });
31119
32248
  }
31120
32249
  },
@@ -31129,12 +32258,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31129
32258
  if (typeof children === "function") {
31130
32259
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31131
32260
  children(meta),
31132
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
32261
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
31133
32262
  ] });
31134
32263
  } else {
31135
32264
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31136
32265
  children,
31137
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
32266
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
31138
32267
  ] });
31139
32268
  }
31140
32269
  },
@@ -31149,12 +32278,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31149
32278
  if (typeof children === "function") {
31150
32279
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31151
32280
  children(meta),
31152
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "minus" }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
32281
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Minus }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
31153
32282
  ] });
31154
32283
  } else {
31155
32284
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31156
32285
  children,
31157
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "minus" }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
32286
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Minus }) : /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
31158
32287
  ] });
31159
32288
  }
31160
32289
  },
@@ -31248,7 +32377,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31248
32377
  variant: "soft",
31249
32378
  type: "button",
31250
32379
  onClick: handleAddValueClick,
31251
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" })
32380
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus })
31252
32381
  }
31253
32382
  )
31254
32383
  ] }),
@@ -31271,7 +32400,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31271
32400
  onClick: () => {
31272
32401
  handleRemoveValueClick(index);
31273
32402
  },
31274
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" })
32403
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X })
31275
32404
  }
31276
32405
  )
31277
32406
  ]
@@ -31331,7 +32460,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31331
32460
  const handleRemoveFilter = React.useCallback(() => {
31332
32461
  onClick(condition);
31333
32462
  }, [condition, onClick]);
31334
- return /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleRemoveFilter, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }) });
32463
+ return /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: handleRemoveFilter, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X }) });
31335
32464
  };
31336
32465
  RemoveConditionButton.displayName = "RemoveConditionButton";
31337
32466
  const SelectFieldOptionMultiSelectGroup = React.memo((props) => {
@@ -31446,7 +32575,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31446
32575
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31447
32576
  ] });
31448
32577
  };
31449
- const modifiers$c = {
32578
+ const modifiers$e = {
31450
32579
  equals: createConditionModifierConfig({
31451
32580
  modifier: BooleanEqualsConditionModifier,
31452
32581
  isValueValid: (_value) => true,
@@ -31463,13 +32592,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31463
32592
  class BooleanFieldCondition extends BaseCondition {
31464
32593
  constructor(options) {
31465
32594
  super(options);
31466
- __publicField(this, "defaultConditionModifier", "equals");
31467
- __publicField(this, "defaultConditionValue");
31468
- __publicField(this, "modifiers", modifiers$c);
32595
+ __publicField(this, "modifiers", modifiers$e);
31469
32596
  }
31470
32597
  static deserialize(serializedCondition, field) {
31471
32598
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31472
- const modifierConfig = modifiers$c[conditionModifier];
32599
+ const modifierConfig = modifiers$e[conditionModifier];
31473
32600
  let deserializedValue = void 0;
31474
32601
  if (conditionValue !== void 0) {
31475
32602
  deserializedValue = modifierConfig.modifier.deserialize(conditionValue);
@@ -31525,7 +32652,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31525
32652
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31526
32653
  ] });
31527
32654
  };
31528
- const modifiers$b = {
32655
+ const modifiers$d = {
31529
32656
  equals: createConditionModifierConfig({
31530
32657
  modifier: StringArrayEqualsConditionModifier,
31531
32658
  isValueValid: (_value) => true,
@@ -31560,13 +32687,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31560
32687
  class CheckboxListFieldCondition extends BaseCondition {
31561
32688
  constructor(options) {
31562
32689
  super(options);
31563
- __publicField(this, "defaultConditionModifier", "equals");
31564
- __publicField(this, "defaultConditionValue");
31565
- __publicField(this, "modifiers", modifiers$b);
32690
+ __publicField(this, "modifiers", modifiers$d);
31566
32691
  }
31567
32692
  static deserialize(serializedCondition, field) {
31568
32693
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31569
- const modifierConfig = modifiers$b[conditionModifier];
32694
+ const modifierConfig = modifiers$d[conditionModifier];
31570
32695
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
31571
32696
  return new CheckboxListFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
31572
32697
  }
@@ -31641,7 +32766,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31641
32766
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31642
32767
  ] });
31643
32768
  };
31644
- const modifiers$a = {
32769
+ const modifiers$c = {
31645
32770
  equals: createConditionModifierConfig({
31646
32771
  modifier: DateEqualsConditionModifier,
31647
32772
  isValueValid: (value) => value instanceof Date,
@@ -31682,13 +32807,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31682
32807
  class DateFieldCondition extends BaseCondition {
31683
32808
  constructor(options) {
31684
32809
  super(options);
31685
- __publicField(this, "defaultConditionModifier", "equals");
31686
- __publicField(this, "defaultConditionValue");
31687
- __publicField(this, "modifiers", modifiers$a);
32810
+ __publicField(this, "modifiers", modifiers$c);
31688
32811
  }
31689
32812
  static deserialize(serializedCondition, field) {
31690
32813
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31691
- const modifierConfig = modifiers$a[conditionModifier];
32814
+ const modifierConfig = modifiers$c[conditionModifier];
31692
32815
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
31693
32816
  // @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
31694
32817
  modifierConfig.modifier.deserialize(conditionValue)
@@ -31744,7 +32867,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31744
32867
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31745
32868
  ] });
31746
32869
  };
31747
- const modifiers$9 = {
32870
+ const modifiers$b = {
31748
32871
  equals: createConditionModifierConfig({
31749
32872
  modifier: StringArrayEqualsConditionModifier,
31750
32873
  isValueValid: (_value) => true,
@@ -31779,13 +32902,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31779
32902
  class MultiSelectFieldCondition extends BaseCondition {
31780
32903
  constructor(options) {
31781
32904
  super(options);
31782
- __publicField(this, "defaultConditionValue");
31783
- __publicField(this, "defaultConditionModifier", "equals");
31784
- __publicField(this, "modifiers", modifiers$9);
32905
+ __publicField(this, "modifiers", modifiers$b);
31785
32906
  }
31786
32907
  static deserialize(serializedCondition, field) {
31787
32908
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31788
- const modifierConfig = modifiers$9[conditionModifier];
32909
+ const modifierConfig = modifiers$b[conditionModifier];
31789
32910
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
31790
32911
  return new MultiSelectFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
31791
32912
  }
@@ -31829,7 +32950,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31829
32950
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31830
32951
  ] });
31831
32952
  };
31832
- const modifiers$8 = {
32953
+ const modifiers$a = {
31833
32954
  equals: createConditionModifierConfig({
31834
32955
  modifier: StringArrayEqualsConditionModifier,
31835
32956
  isValueValid: (_value) => true,
@@ -31864,13 +32985,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31864
32985
  class MultiStringFieldCondition extends BaseCondition {
31865
32986
  constructor(options) {
31866
32987
  super(options);
31867
- __publicField(this, "defaultConditionValue");
31868
- __publicField(this, "defaultConditionModifier", "equals");
31869
- __publicField(this, "modifiers", modifiers$8);
32988
+ __publicField(this, "modifiers", modifiers$a);
31870
32989
  }
31871
32990
  static deserialize(serializedCondition, field) {
31872
32991
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31873
- const modifierConfig = modifiers$8[conditionModifier];
32992
+ const modifierConfig = modifiers$a[conditionModifier];
31874
32993
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
31875
32994
  return new MultiStringFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
31876
32995
  }
@@ -31949,7 +33068,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31949
33068
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31950
33069
  ] });
31951
33070
  };
31952
- const modifiers$7 = {
33071
+ const modifiers$9 = {
31953
33072
  equals: createConditionModifierConfig({
31954
33073
  modifier: NumberEqualsConditionModifier,
31955
33074
  isValueValid: (value) => typeof value === "number",
@@ -32002,13 +33121,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32002
33121
  class NumberFieldCondition extends BaseCondition {
32003
33122
  constructor(options) {
32004
33123
  super(options);
32005
- __publicField(this, "defaultConditionValue");
32006
- __publicField(this, "defaultConditionModifier", "equals");
32007
- __publicField(this, "modifiers", modifiers$7);
33124
+ __publicField(this, "modifiers", modifiers$9);
32008
33125
  }
32009
33126
  static deserialize(serializedCondition, field) {
32010
33127
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
32011
- const modifierConfig = modifiers$7[conditionModifier];
33128
+ const modifierConfig = modifiers$9[conditionModifier];
32012
33129
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
32013
33130
  // @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
32014
33131
  modifierConfig.modifier.deserialize(conditionValue)
@@ -32052,7 +33169,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32052
33169
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
32053
33170
  ] });
32054
33171
  };
32055
- const modifiers$6 = {
33172
+ const modifiers$8 = {
32056
33173
  equals: createConditionModifierConfig({
32057
33174
  modifier: StringEqualsConditionModifier,
32058
33175
  isValueValid: (_value) => true,
@@ -32081,13 +33198,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32081
33198
  class OTPFieldCondition extends BaseCondition {
32082
33199
  constructor(options) {
32083
33200
  super(options);
32084
- __publicField(this, "defaultConditionValue");
32085
- __publicField(this, "defaultConditionModifier", "equals");
32086
- __publicField(this, "modifiers", modifiers$6);
33201
+ __publicField(this, "modifiers", modifiers$8);
32087
33202
  }
32088
33203
  static deserialize(serializedCondition, field) {
32089
33204
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
32090
- const modifierConfig = modifiers$6[conditionModifier];
33205
+ const modifierConfig = modifiers$8[conditionModifier];
32091
33206
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
32092
33207
  return new OTPFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
32093
33208
  }
@@ -32095,6 +33210,117 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32095
33210
  return /* @__PURE__ */ jsxRuntime.jsx(OTPFieldConditionCell, { condition: this, ...props }, this.id);
32096
33211
  }
32097
33212
  }
33213
+ const PassFailFieldConditionCell = (props) => {
33214
+ const { condition, onRemove } = props;
33215
+ const field = condition.field;
33216
+ const conditionValue = condition.getConditionValue();
33217
+ const conditionModifier = condition.getConditionModifier();
33218
+ const getFilterValueUi = () => {
33219
+ switch (conditionModifier) {
33220
+ case "equals":
33221
+ case "notEquals": {
33222
+ const equalsModifier = condition.modifiers.equals;
33223
+ const equalsFilterValue = conditionValue !== void 0 && equalsModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
33224
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { children: [
33225
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "button", className: "min-w-0 shrink-1 grow", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: equalsFilterValue !== void 0 ? equalsFilterValue ? passFailFieldStatusMapping[equalsFilterValue].label : "empty" : "..." }) }) }),
33226
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(
33227
+ blocks.Menu.SelectGroup,
33228
+ {
33229
+ required: false,
33230
+ value: equalsFilterValue,
33231
+ onValueChange: condition.setConditionValue,
33232
+ children: passFailFieldStatuses.map((status) => {
33233
+ const { label } = passFailFieldStatusMapping[status];
33234
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectItemTemplate, { value: status, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: label }) }, status);
33235
+ })
33236
+ }
33237
+ ) })
33238
+ ] });
33239
+ }
33240
+ case "includes":
33241
+ case "excludes": {
33242
+ const includesModifier = condition.modifiers.includes;
33243
+ const includesModifierFilterValue = conditionValue !== void 0 && includesModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
33244
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { children: [
33245
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "button", children: includesModifierFilterValue ? `${includesModifierFilterValue.length} statuses` : "..." }) }),
33246
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { size: "sm", children: /* @__PURE__ */ jsxRuntime.jsxs(
33247
+ blocks.Menu.MultiSelectGroup,
33248
+ {
33249
+ values: includesModifierFilterValue ?? EMPTY_ARRAY,
33250
+ onValuesChange: condition.setConditionValue,
33251
+ children: [
33252
+ /* @__PURE__ */ jsxRuntime.jsx(SelectAllItemTemplate, { children: "Select all" }),
33253
+ passFailFieldStatuses.map((status) => {
33254
+ const { label, icon } = passFailFieldStatusMapping[status];
33255
+ return /* @__PURE__ */ jsxRuntime.jsxs(MultiSelectItemTemplate, { value: status, children: [
33256
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon }),
33257
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: label })
33258
+ ] }, status);
33259
+ })
33260
+ ]
33261
+ }
33262
+ ) })
33263
+ ] });
33264
+ }
33265
+ }
33266
+ };
33267
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex w-max max-w-full min-w-0 gap-0.5", size: "sm", variant: "fill", accentColor: "base", children: [
33268
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Badge, { className: "min-w-0 shrink-1", size: "sm", variant: "fill", accentColor: "base", children: [
33269
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[field.type] }),
33270
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: field.label || UNLABELLED_FIELD_LABEL })
33271
+ ] }),
33272
+ /* @__PURE__ */ jsxRuntime.jsx(ConditionModifierDropdown, { condition, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "button", children: condition.modifiers[conditionModifier].modifier.label }) }),
33273
+ getFilterValueUi(),
33274
+ /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
33275
+ ] });
33276
+ };
33277
+ const modifiers$7 = {
33278
+ equals: createConditionModifierConfig({
33279
+ modifier: PassFailEqualsConditionModifier,
33280
+ isValueValid: (value) => value !== null,
33281
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "string",
33282
+ isSerializedValueValid: (serializedConditionValue) => typeof serializedConditionValue === "string"
33283
+ }),
33284
+ notEquals: createConditionModifierConfig({
33285
+ modifier: PassFailNotEqualsConditionModifier,
33286
+ isValueValid: (value) => value !== null,
33287
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "string",
33288
+ isSerializedValueValid: (serializedConditionValue) => typeof serializedConditionValue === "string"
33289
+ }),
33290
+ includes: createConditionModifierConfig({
33291
+ modifier: PassFailArrayIncludesConditionModifier,
33292
+ isValueValid: (value) => value !== null,
33293
+ isConditionValueValid: (conditionValue) => Array.isArray(conditionValue),
33294
+ isSerializedValueValid: (serializedConditionValue) => Array.isArray(serializedConditionValue)
33295
+ }),
33296
+ excludes: createConditionModifierConfig({
33297
+ modifier: PassFailArrayExcludesConditionModifier,
33298
+ isValueValid: (value) => value !== null,
33299
+ isConditionValueValid: (conditionValue) => Array.isArray(conditionValue),
33300
+ isSerializedValueValid: (serializedConditionValue) => Array.isArray(serializedConditionValue)
33301
+ })
33302
+ };
33303
+ class PassFailFieldCondition extends BaseCondition {
33304
+ constructor(options) {
33305
+ super(options);
33306
+ __publicField(this, "modifiers", modifiers$7);
33307
+ }
33308
+ static deserialize(serializedCondition, field) {
33309
+ const { conditionValue, conditionModifier, ...rest } = serializedCondition;
33310
+ const modifierConfig = modifiers$7[conditionModifier];
33311
+ const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
33312
+ // @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
33313
+ modifierConfig.modifier.deserialize(conditionValue)
33314
+ ) : void 0;
33315
+ return new PassFailFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
33316
+ }
33317
+ transformValue(value) {
33318
+ return value.status;
33319
+ }
33320
+ render(props) {
33321
+ return /* @__PURE__ */ jsxRuntime.jsx(PassFailFieldConditionCell, { condition: this, ...props }, this.id);
33322
+ }
33323
+ }
32098
33324
  const RadioFieldConditionCell = (props) => {
32099
33325
  const { condition, onRemove } = props;
32100
33326
  const field = condition.field;
@@ -32115,16 +33341,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32115
33341
  }
32116
33342
  return mapping;
32117
33343
  }, [normalizedOptions]);
32118
- const handleValuesChange = React.useCallback(
32119
- (values) => {
32120
- if (values.length > 0) {
32121
- condition.setConditionValue(values);
32122
- } else {
32123
- condition.setConditionValue([]);
32124
- }
32125
- },
32126
- [condition]
32127
- );
32128
33344
  const getFilterValueUi = () => {
32129
33345
  switch (conditionModifier) {
32130
33346
  case "equals":
@@ -32154,8 +33370,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32154
33370
  SelectFieldOptionMultiSelectGroup,
32155
33371
  {
32156
33372
  selectFieldOptions: field.options,
32157
- values: includesModifierFilterValue ?? [],
32158
- onValuesChange: handleValuesChange
33373
+ values: includesModifierFilterValue ?? EMPTY_ARRAY,
33374
+ onValuesChange: condition.setConditionValue
32159
33375
  }
32160
33376
  ) })
32161
33377
  ] });
@@ -32172,7 +33388,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32172
33388
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
32173
33389
  ] });
32174
33390
  };
32175
- const modifiers$5 = {
33391
+ const modifiers$6 = {
32176
33392
  equals: createConditionModifierConfig({
32177
33393
  modifier: StringEqualsConditionModifier,
32178
33394
  isValueValid: (value) => typeof value === "string",
@@ -32201,13 +33417,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32201
33417
  class RadioFieldCondition extends BaseCondition {
32202
33418
  constructor(options) {
32203
33419
  super(options);
32204
- __publicField(this, "defaultConditionValue");
32205
- __publicField(this, "defaultConditionModifier", "equals");
32206
- __publicField(this, "modifiers", modifiers$5);
33420
+ __publicField(this, "modifiers", modifiers$6);
32207
33421
  }
32208
33422
  static deserialize(serializedCondition, field) {
32209
33423
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
32210
- const modifierConfig = modifiers$5[conditionModifier];
33424
+ const modifierConfig = modifiers$6[conditionModifier];
32211
33425
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
32212
33426
  // @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
32213
33427
  modifierConfig.modifier.deserialize(conditionValue)
@@ -32218,6 +33432,146 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32218
33432
  return /* @__PURE__ */ jsxRuntime.jsx(RadioFieldConditionCell, { condition: this, ...props }, this.id);
32219
33433
  }
32220
33434
  }
33435
+ const RatingFieldConditionCell = (props) => {
33436
+ const { condition, onRemove } = props;
33437
+ const field = condition.field;
33438
+ const conditionValue = condition.getConditionValue();
33439
+ const conditionModifier = condition.getConditionModifier();
33440
+ const getFilterValueUi = () => {
33441
+ switch (conditionModifier) {
33442
+ case "equals":
33443
+ case "notEquals":
33444
+ case "greaterThanOrEquals":
33445
+ case "lessThanOrEquals":
33446
+ case "greaterThan":
33447
+ case "lessThan": {
33448
+ const modifier = condition.modifiers[conditionModifier];
33449
+ const filterValue = conditionValue !== void 0 && modifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
33450
+ return /* @__PURE__ */ jsxRuntime.jsx(
33451
+ NumberInputPopover,
33452
+ {
33453
+ value: filterValue ?? null,
33454
+ onValueChange: (value) => condition.setConditionValue(value ?? void 0),
33455
+ size: "sm",
33456
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "button", className: "truncate", children: filterValue !== void 0 ? filterValue : "..." })
33457
+ }
33458
+ );
33459
+ }
33460
+ case "inRange":
33461
+ case "notInRange": {
33462
+ const inRangeModifier = condition.modifiers.inRange;
33463
+ const rangeFilterValue = conditionValue !== void 0 && inRangeModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
33464
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
33465
+ /* @__PURE__ */ jsxRuntime.jsx(
33466
+ NumberInputPopover,
33467
+ {
33468
+ value: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? null,
33469
+ onValueChange: (value) => {
33470
+ condition.setConditionValue({
33471
+ from: value,
33472
+ to: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? null
33473
+ });
33474
+ },
33475
+ size: "sm",
33476
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { className: "truncate", children: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? "..." })
33477
+ }
33478
+ ),
33479
+ /* @__PURE__ */ jsxRuntime.jsx(
33480
+ NumberInputPopover,
33481
+ {
33482
+ value: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? null,
33483
+ onValueChange: (value) => {
33484
+ condition.setConditionValue({
33485
+ from: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? null,
33486
+ to: value
33487
+ });
33488
+ },
33489
+ size: "sm",
33490
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { className: "truncate", children: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? "..." })
33491
+ }
33492
+ )
33493
+ ] });
33494
+ }
33495
+ }
33496
+ };
33497
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex w-max max-w-full min-w-0 gap-0.5", size: "sm", variant: "fill", accentColor: "base", children: [
33498
+ /* @__PURE__ */ jsxRuntime.jsxs(blocks.Badge, { className: "min-w-0 shrink-1", size: "sm", variant: "fill", accentColor: "base", children: [
33499
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[field.type] }),
33500
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: field.label || UNLABELLED_FIELD_LABEL })
33501
+ ] }),
33502
+ /* @__PURE__ */ jsxRuntime.jsx(ConditionModifierDropdown, { condition, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Button, { type: "button", children: condition.modifiers[conditionModifier].modifier.label }) }),
33503
+ getFilterValueUi(),
33504
+ /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
33505
+ ] });
33506
+ };
33507
+ const modifiers$5 = {
33508
+ equals: createConditionModifierConfig({
33509
+ modifier: NumberEqualsConditionModifier,
33510
+ isValueValid: (value) => typeof value === "number",
33511
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
33512
+ isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
33513
+ }),
33514
+ notEquals: createConditionModifierConfig({
33515
+ modifier: NumberNotEqualsConditionModifier,
33516
+ isValueValid: (value) => typeof value === "number",
33517
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
33518
+ isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
33519
+ }),
33520
+ lessThan: createConditionModifierConfig({
33521
+ modifier: NumberLessThanConditionModifier,
33522
+ isValueValid: (value) => typeof value === "number",
33523
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
33524
+ isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
33525
+ }),
33526
+ lessThanOrEquals: createConditionModifierConfig({
33527
+ modifier: NumberLessThanOrEqualsConditionModifier,
33528
+ isValueValid: (value) => typeof value === "number",
33529
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
33530
+ isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
33531
+ }),
33532
+ greaterThan: createConditionModifierConfig({
33533
+ modifier: NumberGreaterThanConditionModifier,
33534
+ isValueValid: (value) => typeof value === "number",
33535
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
33536
+ isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
33537
+ }),
33538
+ greaterThanOrEquals: createConditionModifierConfig({
33539
+ modifier: NumberGreaterThanOrEqualsConditionModifier,
33540
+ isValueValid: (value) => typeof value === "number",
33541
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
33542
+ isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
33543
+ }),
33544
+ inRange: createConditionModifierConfig({
33545
+ modifier: NumberRangeInConditionModifier,
33546
+ isValueValid: (value) => typeof value === "number",
33547
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "object",
33548
+ isSerializedValueValid: (conditionValue) => typeof conditionValue === "object"
33549
+ }),
33550
+ notInRange: createConditionModifierConfig({
33551
+ modifier: NumberRangeNotInConditionModifier,
33552
+ isValueValid: (value) => typeof value === "number",
33553
+ isConditionValueValid: (conditionValue) => typeof conditionValue === "object",
33554
+ isSerializedValueValid: (conditionValue) => typeof conditionValue === "object"
33555
+ })
33556
+ };
33557
+ class RatingFieldCondition extends BaseCondition {
33558
+ constructor(options) {
33559
+ super(options);
33560
+ __publicField(this, "modifiers", modifiers$5);
33561
+ }
33562
+ static deserialize(serializedCondition, field) {
33563
+ const { conditionValue, conditionModifier, ...rest } = serializedCondition;
33564
+ const modifierConfig = modifiers$5[conditionModifier];
33565
+ const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
33566
+ // @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
33567
+ modifierConfig.modifier.deserialize(conditionValue)
33568
+ ) : void 0;
33569
+ return new RatingFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
33570
+ }
33571
+ render(props) {
33572
+ return /* @__PURE__ */ jsxRuntime.jsx(RatingFieldConditionCell, { condition: this, ...props }, this.id);
33573
+ }
33574
+ }
32221
33575
  const ScanFieldConditionCell = (props) => {
32222
33576
  const { condition, onRemove } = props;
32223
33577
  const field = condition.field;
@@ -32280,8 +33634,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32280
33634
  class ScanFieldCondition extends BaseCondition {
32281
33635
  constructor(options) {
32282
33636
  super(options);
32283
- __publicField(this, "defaultConditionValue");
32284
- __publicField(this, "defaultConditionModifier", "equals");
32285
33637
  __publicField(this, "modifiers", modifiers$4);
32286
33638
  }
32287
33639
  static deserialize(serializedCondition, field) {
@@ -32400,8 +33752,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32400
33752
  class SelectFieldCondition extends BaseCondition {
32401
33753
  constructor(options) {
32402
33754
  super(options);
32403
- __publicField(this, "defaultConditionValue");
32404
- __publicField(this, "defaultConditionModifier", "equals");
32405
33755
  __publicField(this, "modifiers", modifiers$3);
32406
33756
  }
32407
33757
  static deserialize(serializedCondition, field) {
@@ -32479,8 +33829,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32479
33829
  class StringFieldCondition extends BaseCondition {
32480
33830
  constructor(options) {
32481
33831
  super(options);
32482
- __publicField(this, "defaultConditionValue");
32483
- __publicField(this, "defaultConditionModifier", "equals");
32484
33832
  __publicField(this, "modifiers", modifiers$2);
32485
33833
  }
32486
33834
  static deserialize(serializedCondition, field) {
@@ -32555,8 +33903,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32555
33903
  class TextFieldCondition extends BaseCondition {
32556
33904
  constructor(options) {
32557
33905
  super(options);
32558
- __publicField(this, "defaultConditionValue");
32559
- __publicField(this, "defaultConditionModifier", "equals");
32560
33906
  __publicField(this, "modifiers", modifiers$1);
32561
33907
  }
32562
33908
  static deserialize(serializedCondition, field) {
@@ -32627,8 +33973,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32627
33973
  class UploadFieldCondition extends BaseCondition {
32628
33974
  constructor(options) {
32629
33975
  super(options);
32630
- __publicField(this, "defaultConditionValue");
32631
- __publicField(this, "defaultConditionModifier", "equals");
32632
33976
  __publicField(this, "modifiers", modifiers);
32633
33977
  }
32634
33978
  static deserialize(serializedCondition, field) {
@@ -32641,43 +33985,35 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32641
33985
  return /* @__PURE__ */ jsxRuntime.jsx(UploadFieldConditionCell, { condition: this, ...props }, this.id);
32642
33986
  }
32643
33987
  }
32644
- const deserializeCondition = (serializedCondition, field) => {
32645
- switch (serializedCondition.type) {
32646
- case "text":
32647
- return TextFieldCondition.deserialize(serializedCondition, field);
32648
- case "boolean":
32649
- return BooleanFieldCondition.deserialize(serializedCondition, field);
32650
- case "number":
32651
- return NumberFieldCondition.deserialize(serializedCondition, field);
32652
- case "date":
32653
- return DateFieldCondition.deserialize(serializedCondition, field);
32654
- case "string":
32655
- return StringFieldCondition.deserialize(serializedCondition, field);
32656
- case "select":
32657
- return SelectFieldCondition.deserialize(serializedCondition, field);
32658
- case "multi-string":
32659
- return MultiStringFieldCondition.deserialize(serializedCondition, field);
32660
- case "multi-select":
32661
- return MultiSelectFieldCondition.deserialize(serializedCondition, field);
32662
- case "upload":
32663
- return UploadFieldCondition.deserialize(serializedCondition, field);
32664
- case "qr":
32665
- return ScanFieldCondition.deserialize(serializedCondition, field);
32666
- case "radio":
32667
- return RadioFieldCondition.deserialize(serializedCondition, field);
32668
- case "checkbox-list":
32669
- return CheckboxListFieldCondition.deserialize(serializedCondition, field);
32670
- case "otp":
32671
- return OTPFieldCondition.deserialize(serializedCondition, field);
32672
- }
33988
+ const ConditionTypeToClsMapping = {
33989
+ date: DateFieldCondition,
33990
+ number: NumberFieldCondition,
33991
+ boolean: BooleanFieldCondition,
33992
+ select: SelectFieldCondition,
33993
+ string: StringFieldCondition,
33994
+ text: TextFieldCondition,
33995
+ upload: UploadFieldCondition,
33996
+ qr: ScanFieldCondition,
33997
+ "multi-string": MultiStringFieldCondition,
33998
+ "multi-select": MultiSelectFieldCondition,
33999
+ radio: RadioFieldCondition,
34000
+ "checkbox-list": CheckboxListFieldCondition,
34001
+ "pass-fail": PassFailFieldCondition,
34002
+ otp: OTPFieldCondition,
34003
+ rating: RatingFieldCondition
32673
34004
  };
32674
- const deserializeConditions = (serializedConditions, fields) => {
34005
+ const deserializeCondition = (field, serializedCondition) => {
34006
+ if (field.type !== serializedCondition.type)
34007
+ throw new Error(`field and condition type mismatch ${field.type} !== ${serializedCondition.type}`);
34008
+ return ConditionTypeToClsMapping[serializedCondition.type].deserialize(serializedCondition, field);
34009
+ };
34010
+ const deserializeConditions = (fields, serializedConditions) => {
32675
34011
  const fieldsMapping = {};
32676
34012
  for (const field of fields) {
32677
34013
  fieldsMapping[field.identifier] = field;
32678
34014
  }
32679
34015
  return serializedConditions.map(
32680
- (serializedCondition) => deserializeCondition(serializedCondition, fieldsMapping[serializedCondition.fieldId])
34016
+ (serializedCondition) => deserializeCondition(fieldsMapping[serializedCondition.fieldId], serializedCondition)
32681
34017
  );
32682
34018
  };
32683
34019
  const applyConditions = (conditions, values) => {
@@ -32685,35 +34021,53 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32685
34021
  return condition.apply(values[condition.field.identifier]);
32686
34022
  }) : true;
32687
34023
  };
32688
- const deserializeField = (serializedField) => {
32689
- switch (serializedField.type) {
32690
- case "boolean":
32691
- return BooleanField.deserialize(serializedField);
32692
- case "text":
32693
- return TextField.deserialize(serializedField);
32694
- case "number":
32695
- return NumberField.deserialize(serializedField);
32696
- case "date":
32697
- return DateField.deserialize(serializedField);
32698
- case "select":
32699
- return SelectField.deserialize(serializedField);
32700
- case "multi-string":
32701
- return MultiStringField.deserialize(serializedField);
32702
- case "multi-select":
32703
- return MultiSelectField.deserialize(serializedField);
32704
- case "upload":
32705
- return UploadField.deserialize(serializedField);
32706
- case "qr":
32707
- return ScanField.deserialize(serializedField);
32708
- case "radio":
32709
- return RadioField.deserialize(serializedField);
32710
- case "checkbox-list":
32711
- return CheckboxListField.deserialize(serializedField);
32712
- case "string":
32713
- return StringField.deserialize(serializedField);
32714
- case "otp":
32715
- return OTPField.deserialize(serializedField);
34024
+ class ConditionManager extends Observable {
34025
+ constructor(conditions) {
34026
+ super();
34027
+ __publicField(this, "conditions");
34028
+ __publicField(this, "conditionObserver", () => {
34029
+ this.conditions = [...this.conditions];
34030
+ this.notify(this);
34031
+ });
34032
+ __publicField(this, "initConditions", (conditions) => {
34033
+ for (const c of conditions) c.observe(this.conditionObserver);
34034
+ return conditions;
34035
+ });
34036
+ this.conditions = this.initConditions(conditions);
34037
+ }
34038
+ getConditions() {
34039
+ return this.conditions;
34040
+ }
34041
+ addCondition(condition) {
34042
+ this.conditions = this.initConditions([...this.conditions, condition]);
34043
+ this.notify(this);
34044
+ }
34045
+ addConditions(conditions) {
34046
+ this.conditions = this.initConditions([...this.conditions, ...conditions]);
34047
+ this.notify(this);
34048
+ }
34049
+ removeCondition(condition) {
34050
+ this.conditions = this.initConditions(this.conditions.filter((c) => c.id !== condition.id));
34051
+ this.notify(this);
32716
34052
  }
34053
+ removeConditions(conditions) {
34054
+ const conditionIds = new Set(conditions.map((c) => c.id));
34055
+ this.conditions = this.initConditions(this.conditions.filter((c) => !conditionIds.has(c.id)));
34056
+ this.notify(this);
34057
+ }
34058
+ applyConditions(values) {
34059
+ return applyConditions(this.conditions, values);
34060
+ }
34061
+ }
34062
+ const useConditionManager = (conditions, onConditionsChange) => {
34063
+ return React.useMemo(() => {
34064
+ const ret = new ConditionManager(conditions);
34065
+ ret.observe((conditionManager) => onConditionsChange(conditionManager.getConditions()));
34066
+ return ret;
34067
+ }, [conditions, onConditionsChange]);
34068
+ };
34069
+ const deserializeField = (serializedField) => {
34070
+ return FieldTypeToClsMapping[serializedField.type].deserialize(serializedField);
32717
34071
  };
32718
34072
  function deserializeFields(fields) {
32719
34073
  return fields.map(deserialize);
@@ -32788,6 +34142,85 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32788
34142
  }
32789
34143
  return ret;
32790
34144
  }
34145
+ function extractFilesAndPromisesFromFieldValues(fields, values) {
34146
+ const cleanValues = cleanFieldValues(fields, values);
34147
+ const valuesRet = {};
34148
+ const filesRet = {};
34149
+ for (const field of fields) {
34150
+ if (!(field.identifier in cleanValues)) continue;
34151
+ const value = cleanValues[field.identifier];
34152
+ switch (field.type) {
34153
+ case "upload":
34154
+ if (!field.isValueValid(value)) break;
34155
+ filesRet[field.identifier] = value;
34156
+ valuesRet[field.identifier] = [];
34157
+ break;
34158
+ case "pass-fail":
34159
+ if (!field.isValueValid(value)) break;
34160
+ filesRet[field.identifier] = value.files;
34161
+ valuesRet[field.identifier] = {
34162
+ ...value,
34163
+ files: []
34164
+ };
34165
+ break;
34166
+ default:
34167
+ valuesRet[field.identifier] = values[field.identifier];
34168
+ }
34169
+ }
34170
+ return [valuesRet, filesRet];
34171
+ }
34172
+ function insertFilesAndPromisesToFieldValues(fields, values, filesAndPromises) {
34173
+ const ret = {};
34174
+ for (const field of fields) {
34175
+ if (!(field.identifier in values)) continue;
34176
+ const value = values[field.identifier];
34177
+ switch (field.type) {
34178
+ case "upload":
34179
+ if (!field.isValueValid(value)) break;
34180
+ ret[field.identifier] = filesAndPromises[field.identifier] ?? [];
34181
+ break;
34182
+ case "pass-fail":
34183
+ if (!field.isValueValid(value)) break;
34184
+ ret[field.identifier] = {
34185
+ ...value,
34186
+ files: filesAndPromises[field.identifier] ?? []
34187
+ };
34188
+ break;
34189
+ default:
34190
+ if (!field.isValueValid(value)) break;
34191
+ ret[field.identifier] = value;
34192
+ }
34193
+ }
34194
+ return ret;
34195
+ }
34196
+ const initializeFieldValues = (fields, values) => {
34197
+ const ret = {};
34198
+ for (const field of fields) {
34199
+ const value = values[field.identifier];
34200
+ ret[field.identifier] = value !== void 0 ? value : field.blankValue();
34201
+ }
34202
+ return ret;
34203
+ };
34204
+ const changedFieldValues = (fields, values1, values2) => {
34205
+ const ret = {};
34206
+ for (const field of fields) {
34207
+ const value1 = values1[field.identifier];
34208
+ const value2 = values2[field.identifier];
34209
+ if (field.areValuesEqual(value1, value2)) continue;
34210
+ ret[field.identifier] = value2;
34211
+ }
34212
+ return ret;
34213
+ };
34214
+ const unchangedFieldValues = (fields, values1, values2) => {
34215
+ const ret = {};
34216
+ for (const field of fields) {
34217
+ const value1 = values1[field.identifier];
34218
+ const value2 = values2[field.identifier];
34219
+ if (!field.areValuesEqual(value1, value2)) continue;
34220
+ ret[field.identifier] = value2;
34221
+ }
34222
+ return ret;
34223
+ };
32791
34224
  const RendererContext = React.createContext({});
32792
34225
  const FieldSectionLayout = React.memo((props) => {
32793
34226
  const { fieldSection: section, ...rest } = props;
@@ -32868,7 +34301,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32868
34301
  const fields = data.fields.map(deserializeField);
32869
34302
  const conditions = {};
32870
34303
  for (const [sectionId, serializedConditions] of Object.entries(data.conditions)) {
32871
- conditions[sectionId] = deserializeConditions(serializedConditions, fields);
34304
+ conditions[sectionId] = deserializeConditions(fields, serializedConditions);
32872
34305
  }
32873
34306
  return new _FieldSection({ ...data, fields, conditions });
32874
34307
  }
@@ -32909,12 +34342,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32909
34342
  getFields() {
32910
34343
  return this.fields;
32911
34344
  }
32912
- addField(field) {
32913
- this.fields = this.initFields([...this.fields, field]);
32914
- this.notify(this);
32915
- }
32916
- addFields(fields) {
32917
- this.fields = this.initFields([...this.fields, ...fields]);
34345
+ addField(field, index) {
34346
+ const copy = [...this.fields];
34347
+ copy.splice(index ?? this.fields.length, 0, field);
34348
+ this.fields = this.initFields(copy);
32918
34349
  this.notify(this);
32919
34350
  }
32920
34351
  moveField(sourceIndex, targetIndex) {
@@ -32933,16 +34364,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32933
34364
  this.conditions = newConditions;
32934
34365
  this.notify(this);
32935
34366
  }
32936
- removeFields(fields) {
32937
- const fieldIdentifiers = new Set(fields.map(({ identifier }) => identifier));
32938
- this.fields = this.initFields(this.fields.filter(({ identifier }) => !fieldIdentifiers.has(identifier)));
32939
- const newConditions = {};
32940
- for (const [sectionId, conditions] of Object.entries(this.conditions)) {
32941
- newConditions[sectionId] = conditions.filter(({ field }) => !fieldIdentifiers.has(field.identifier));
32942
- }
32943
- this.conditions = newConditions;
32944
- this.notify(this);
32945
- }
32946
34367
  getConditions(identifier) {
32947
34368
  return this.conditions[identifier];
32948
34369
  }
@@ -33022,27 +34443,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33022
34443
  getFieldSections() {
33023
34444
  return this.fieldSections;
33024
34445
  }
33025
- addFieldSection(field) {
33026
- this.fieldSections = this.initFields([...this.fieldSections, field]);
34446
+ addFieldSection(fieldSection, index) {
34447
+ const copy = [...this.fieldSections];
34448
+ copy.splice(index ?? this.fieldSections.length, 0, fieldSection);
34449
+ this.fieldSections = this.initFields(copy);
33027
34450
  this.notify(this);
33028
34451
  }
33029
- addFieldSections(fields) {
33030
- this.fieldSections = this.initFields([...this.fieldSections, ...fields]);
33031
- this.notify(this);
33032
- }
33033
- removeFieldSection(field) {
33034
- const newFields = this.fieldSections.filter((f) => f.identifier !== field.identifier);
33035
- for (const field2 of newFields) {
33036
- field2.removeConditional(field2.identifier);
34452
+ removeFieldSection(fieldSection) {
34453
+ const newFields = this.fieldSections.filter((f) => f.identifier !== fieldSection.identifier);
34454
+ for (const field of newFields) {
34455
+ field.removeConditional(field.identifier);
33037
34456
  }
33038
34457
  this.fieldSections = this.initFields(newFields);
33039
34458
  this.notify(this);
33040
34459
  }
33041
- removeFieldSections(fields) {
33042
- const fieldsIds = new Set(fields.map((f) => f.identifier));
33043
- this.fieldSections = this.initFields(this.fieldSections.filter((f) => !fieldsIds.has(f.identifier)));
33044
- this.notify(this);
33045
- }
33046
34460
  moveFieldSection(sourceIndex, targetIndex) {
33047
34461
  const newFields = [...this.fieldSections];
33048
34462
  const [removedElement] = newFields.splice(sourceIndex, 1);
@@ -33056,44 +34470,70 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33056
34470
  serializeValues(values) {
33057
34471
  return serializeFieldValues(this.getFields(), values);
33058
34472
  }
34473
+ deserializeConditions(conditions) {
34474
+ return deserializeConditions(this.getFields(), conditions);
34475
+ }
34476
+ initializeValues(values) {
34477
+ return initializeFieldValues(this.getFields(), values);
34478
+ }
33059
34479
  }
33060
34480
  const FieldSchemaContext = React.createContext(new FieldSchema([]));
33061
34481
  const FormBuilderContext = React.createContext({});
34482
+ const useFieldTypeItems = (onSelect = () => null) => {
34483
+ return React.useMemo(() => {
34484
+ const entries = Object.entries(FieldTypeToClsMapping);
34485
+ return entries.map(([type, fieldClass]) => ({
34486
+ children: fieldClass.fieldTypeName,
34487
+ icon: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[type] }),
34488
+ value: type,
34489
+ onSelect: () => {
34490
+ onSelect(type);
34491
+ }
34492
+ }));
34493
+ }, [onSelect]);
34494
+ };
34495
+ const CreateFieldDropdownMenu = React.memo((props) => {
34496
+ const { children, variant, size, accentColor, onSelectFieldType, ...rest } = props;
34497
+ const fieldTypeItems = useFieldTypeItems(onSelectFieldType);
34498
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { ...rest, children: [
34499
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children }),
34500
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { variant, size, accentColor, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Scroll, { children: fieldTypeItems.flat().map((item) => /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: item.onSelect, children: [
34501
+ item.icon,
34502
+ item.children
34503
+ ] }, item.value)) }) })
34504
+ ] });
34505
+ });
34506
+ CreateFieldDropdownMenu.displayName = "CreateFieldDropdownMenu";
33062
34507
  const createField = (type) => {
33063
34508
  switch (type) {
33064
34509
  case "text":
33065
- return new TextField({ fieldValidators: [], label: "", required: false, identifier: uuid.v4() });
34510
+ return new TextField({ label: "", required: false, identifier: uuid.v4() });
33066
34511
  case "boolean":
33067
34512
  return new BooleanField({
33068
- fieldValidators: [],
33069
34513
  label: "",
33070
34514
  required: false,
33071
34515
  identifier: uuid.v4()
33072
34516
  });
33073
34517
  case "number":
33074
34518
  return new NumberField({
33075
- fieldValidators: [],
33076
34519
  label: "",
33077
34520
  required: false,
33078
34521
  identifier: uuid.v4()
33079
34522
  });
33080
34523
  case "date":
33081
34524
  return new DateField({
33082
- fieldValidators: [],
33083
34525
  label: "",
33084
34526
  required: false,
33085
34527
  identifier: uuid.v4()
33086
34528
  });
33087
34529
  case "string":
33088
34530
  return new StringField({
33089
- fieldValidators: [],
33090
34531
  label: "",
33091
34532
  required: false,
33092
34533
  identifier: uuid.v4()
33093
34534
  });
33094
34535
  case "select":
33095
34536
  return new SelectField({
33096
- fieldValidators: [],
33097
34537
  label: "",
33098
34538
  options: [],
33099
34539
  required: false,
@@ -33101,14 +34541,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33101
34541
  });
33102
34542
  case "multi-string":
33103
34543
  return new MultiStringField({
33104
- fieldValidators: [],
33105
34544
  label: "",
33106
34545
  required: false,
33107
34546
  identifier: uuid.v4()
33108
34547
  });
33109
34548
  case "multi-select":
33110
34549
  return new MultiSelectField({
33111
- fieldValidators: [],
33112
34550
  label: "",
33113
34551
  options: [],
33114
34552
  required: false,
@@ -33116,21 +34554,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33116
34554
  });
33117
34555
  case "upload":
33118
34556
  return new UploadField({
33119
- fieldValidators: [],
33120
34557
  label: "",
33121
34558
  required: false,
33122
- identifier: uuid.v4()
34559
+ identifier: uuid.v4(),
34560
+ maximum_files: 6,
34561
+ maximum_size: maxFileSizeMB
33123
34562
  });
33124
34563
  case "qr":
33125
34564
  return new ScanField({
33126
- fieldValidators: [],
33127
34565
  label: "",
33128
34566
  required: false,
33129
34567
  identifier: uuid.v4()
33130
34568
  });
33131
34569
  case "radio":
33132
34570
  return new RadioField({
33133
- fieldValidators: [],
33134
34571
  label: "",
33135
34572
  options: [],
33136
34573
  required: false,
@@ -33138,21 +34575,34 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33138
34575
  });
33139
34576
  case "checkbox-list":
33140
34577
  return new CheckboxListField({
33141
- fieldValidators: [],
33142
34578
  label: "",
33143
34579
  options: [],
33144
34580
  required: false,
33145
34581
  identifier: uuid.v4()
33146
34582
  });
34583
+ case "pass-fail":
34584
+ return new PassFailField({
34585
+ label: "",
34586
+ required: false,
34587
+ identifier: uuid.v4(),
34588
+ showNotesAndFilesOn: ["fail"]
34589
+ // TODO: what defaults
34590
+ });
33147
34591
  case "otp":
33148
34592
  return new OTPField({
33149
- fieldValidators: [],
33150
34593
  label: "",
33151
34594
  validationType: "none",
33152
34595
  required: false,
33153
34596
  identifier: uuid.v4(),
33154
34597
  length: 6
33155
34598
  });
34599
+ case "rating":
34600
+ return new RatingField({
34601
+ label: "",
34602
+ required: false,
34603
+ identifier: uuid.v4(),
34604
+ maxRating: 5
34605
+ });
33156
34606
  }
33157
34607
  };
33158
34608
  const createCondition = (field) => {
@@ -33236,6 +34686,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33236
34686
  conditionModifier: "equals",
33237
34687
  field
33238
34688
  });
34689
+ case "pass-fail":
34690
+ return new PassFailFieldCondition({
34691
+ id: uuid.v4(),
34692
+ conditionValue: void 0,
34693
+ conditionModifier: "equals",
34694
+ field
34695
+ });
33239
34696
  case "otp":
33240
34697
  return new OTPFieldCondition({
33241
34698
  id: uuid.v4(),
@@ -33243,6 +34700,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33243
34700
  conditionModifier: "equals",
33244
34701
  field
33245
34702
  });
34703
+ case "rating":
34704
+ return new RatingFieldCondition({
34705
+ id: uuid.v4(),
34706
+ conditionValue: void 0,
34707
+ conditionModifier: "equals",
34708
+ field
34709
+ });
33246
34710
  }
33247
34711
  };
33248
34712
  const getFieldCreationSchema = (type, path) => {
@@ -33263,8 +34727,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33263
34727
  return TextField.getFieldCreationSchema(path);
33264
34728
  case "upload":
33265
34729
  return UploadField.getFieldCreationSchema(path);
34730
+ case "pass-fail":
34731
+ return PassFailField.getFieldCreationSchema(path);
33266
34732
  case "otp":
33267
34733
  return OTPField.getFieldCreationSchema(path);
34734
+ case "rating":
34735
+ return RatingField.getFieldCreationSchema(path);
33268
34736
  default:
33269
34737
  return;
33270
34738
  }
@@ -33282,7 +34750,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33282
34750
  accentColor: "base",
33283
34751
  ...hasError && { color: SEVERITY_COLOR_MAPPING.danger },
33284
34752
  children: [
33285
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "settings" }),
34753
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Settings }),
33286
34754
  "Settings"
33287
34755
  ]
33288
34756
  },
@@ -33293,7 +34761,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33293
34761
  });
33294
34762
  FieldSettingsPopover.displayName = "FieldSettingsPopover";
33295
34763
  const FieldBuilder = React.memo((props) => {
33296
- const { parentPath, index, field } = props;
34764
+ const { parentPath, fieldIndex, field } = props;
33297
34765
  const { errors } = formik.useFormikContext();
33298
34766
  const openImageViewer = useImageViewer();
33299
34767
  const { disableRequiredFields } = React.use(FormBuilderContext);
@@ -33309,17 +34777,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33309
34777
  const handleImageDelete = React.useCallback(() => {
33310
34778
  field.setOptions({ image: void 0 });
33311
34779
  }, [field]);
33312
- const type = field.type;
33313
34780
  const [directlyShownFields, popoverFields] = React.useMemo(() => {
33314
34781
  const directlyShownFields2 = [];
33315
34782
  const popoverFields2 = [];
33316
- const fieldObject = getFieldCreationSchema(field.type, `${parentPath}.${index}`) ?? [];
34783
+ const fieldObject = getFieldCreationSchema(field.type, `${parentPath}.${fieldIndex}`) ?? [];
33317
34784
  for (const item of fieldObject) {
33318
34785
  if (item.showDirectly) directlyShownFields2.push(item.field);
33319
34786
  else popoverFields2.push(item.field);
33320
34787
  }
33321
34788
  return [directlyShownFields2, popoverFields2];
33322
- }, [field, parentPath, index]);
34789
+ }, [field, parentPath, fieldIndex]);
33323
34790
  const directlyShownInputs = useFieldInputs(directlyShownFields, {
33324
34791
  formId,
33325
34792
  disabled: false
@@ -33344,7 +34811,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33344
34811
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 w-full justify-between", children: [
33345
34812
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 items-center", children: [
33346
34813
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Badge, { accentColor: "base", variant: "soft", size: "sm", children: [
33347
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[type] }),
34814
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[field.type] }),
33348
34815
  fieldTypeName
33349
34816
  ] }),
33350
34817
  !disableRequiredFields && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -33354,7 +34821,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33354
34821
  checked: field.required,
33355
34822
  onCheckedChange: (required) => field.setOptions({ required: !!required }),
33356
34823
  size: "sm",
33357
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
34824
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
33358
34825
  }
33359
34826
  ),
33360
34827
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", children: "Required" })
@@ -33382,7 +34849,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33382
34849
  "aria-label": "delete",
33383
34850
  onClick: handleImageDelete,
33384
34851
  size: "sm",
33385
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" })
34852
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash })
33386
34853
  }
33387
34854
  )
33388
34855
  ] }),
@@ -33413,46 +34880,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33413
34880
  ] });
33414
34881
  });
33415
34882
  FieldBuilder.displayName = "FieldBuilder";
33416
- const FieldDropdownMenu = React.memo((props) => {
33417
- const { children, variant, size, accentColor, fields, onSelectField, ...rest } = props;
33418
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { ...rest, children: [
33419
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children }),
33420
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { variant, size, accentColor, children: fields.map((field) => {
33421
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: () => onSelectField(field), children: [
33422
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[field.type] }),
33423
- field.label || UNLABELLED_FIELD_LABEL
33424
- ] }, field.identifier);
33425
- }) })
33426
- ] });
33427
- });
33428
- FieldDropdownMenu.displayName = "IssueDataFilterMenu";
33429
- const FieldSectionDropdownMenu = React.memo((props) => {
33430
- const { children, variant, size, accentColor, fieldSections, onSelectFieldCondition, ...rest } = props;
33431
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { ...rest, children: [
33432
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children }),
33433
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { variant, size, accentColor, children: fieldSections.map((fieldSection) => {
33434
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: () => onSelectFieldCondition(fieldSection), children: [
33435
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[fieldSection.type] }),
33436
- fieldSection.label || UNLABELLED_SECTION_LABEL
33437
- ] }, fieldSection.identifier);
33438
- }) })
33439
- ] });
33440
- });
33441
- FieldSectionDropdownMenu.displayName = "IssueDataFilterMenu";
33442
- const FieldWithActions = React.memo((props) => {
33443
- const { field, fieldSection, index, sectionIndex, remove } = props;
34883
+ const FieldBuilderWithActions = React.memo((props) => {
34884
+ const { field, fieldSection, fieldIndex, sectionIndex } = props;
33444
34885
  const { showError } = blocks.useToast();
33445
34886
  const fileInputRef = React.useRef(null);
33446
34887
  const parentPath = `fields.${sectionIndex}.fields`;
34888
+ const handleAddField = React.useCallback(
34889
+ (type) => {
34890
+ fieldSection.addField(createField(type), fieldIndex + 1);
34891
+ },
34892
+ [fieldIndex, fieldSection]
34893
+ );
33447
34894
  const duplicateField = React.useCallback(() => {
33448
34895
  fieldSection.addField(field.duplicate(uuid.v4()));
33449
34896
  }, [field, fieldSection]);
33450
34897
  const moveField = React.useCallback(
33451
34898
  (direction) => {
33452
34899
  const targetIndex = direction === "up" ? sectionIndex - 1 : sectionIndex + 1;
33453
- fieldSection.moveField(index, targetIndex);
34900
+ fieldSection.moveField(fieldIndex, targetIndex);
33454
34901
  },
33455
- [fieldSection, index, sectionIndex]
34902
+ [fieldSection, fieldIndex, sectionIndex]
33456
34903
  );
33457
34904
  const uploadImage = React.useCallback(
33458
34905
  (event) => {
@@ -33484,21 +34931,48 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33484
34931
  (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
33485
34932
  }, []);
33486
34933
  const handleRemove = React.useCallback(() => {
33487
- remove(field);
33488
- }, [field, remove]);
34934
+ fieldSection.removeField(field);
34935
+ }, [field, fieldSection]);
33489
34936
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Card, { className: "flex items-center justify-between gap-4 w-full", children: [
33490
- /* @__PURE__ */ jsxRuntime.jsx(FieldBuilder, { index, field, parentPath }),
34937
+ /* @__PURE__ */ jsxRuntime.jsx(FieldBuilder, { fieldIndex, field, parentPath }),
33491
34938
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex-col gap-0.5 flex", variant: "ghost", accentColor: "base", size: "sm", children: [
33492
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "move-up" }) }),
33493
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "move-down" }) }),
33494
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: duplicateField, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "copy" }) }),
33495
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleUploadImage, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "image" }) }),
33496
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleRemove, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" }) })
34939
+ /* @__PURE__ */ jsxRuntime.jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }) }) }),
34940
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: MoveUp }) }),
34941
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: MoveDown }) }),
34942
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: duplicateField, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Copy }) }),
34943
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleUploadImage, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Image }) }),
34944
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleRemove, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash }) })
33497
34945
  ] }),
33498
34946
  /* @__PURE__ */ jsxRuntime.jsx("input", { className: "hidden", ref: fileInputRef, type: "file", accept: "image/*", onChange: uploadImage })
33499
34947
  ] });
33500
34948
  });
33501
- FieldWithActions.displayName = "FieldWithActions";
34949
+ FieldBuilderWithActions.displayName = "FieldBuilderWithActions";
34950
+ const FieldDropdownMenu = React.memo((props) => {
34951
+ const { children, variant, size, accentColor, fields, onSelectField, ...rest } = props;
34952
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { ...rest, children: [
34953
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children }),
34954
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { variant, size, accentColor, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Scroll, { children: fields.map((field) => {
34955
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: () => onSelectField(field), children: [
34956
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[field.type] }),
34957
+ field.label || UNLABELLED_FIELD_LABEL
34958
+ ] }, field.identifier);
34959
+ }) }) })
34960
+ ] });
34961
+ });
34962
+ FieldDropdownMenu.displayName = "IssueDataFilterMenu";
34963
+ const FieldSectionDropdownMenu = React.memo((props) => {
34964
+ const { children, variant, size, accentColor, fieldSections, onSelectFieldCondition, ...rest } = props;
34965
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { ...rest, children: [
34966
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children }),
34967
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { variant, size, accentColor, children: fieldSections.map((fieldSection) => {
34968
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: () => onSelectFieldCondition(fieldSection), children: [
34969
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[fieldSection.type] }),
34970
+ fieldSection.label || UNLABELLED_SECTION_LABEL
34971
+ ] }, fieldSection.identifier);
34972
+ }) })
34973
+ ] });
34974
+ });
34975
+ FieldSectionDropdownMenu.displayName = "IssueDataFilterMenu";
33502
34976
  const FieldSectionConditionEdgeComponent = React.memo((props) => {
33503
34977
  const { id, sourceX, sourceY, targetX, targetY, style, markerEnd, data } = props;
33504
34978
  const { targetSection, sourceSection, layoutDirection } = data;
@@ -33552,7 +35026,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33552
35026
  variant: "surface",
33553
35027
  size: "xs",
33554
35028
  accentColor: "base",
33555
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" })
35029
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus })
33556
35030
  }
33557
35031
  ) }),
33558
35032
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Tooltip.Root, { children: [
@@ -33566,7 +35040,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33566
35040
  accentColor: "base",
33567
35041
  color: "danger",
33568
35042
  onClick: handleDelete,
33569
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" })
35043
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash })
33570
35044
  }
33571
35045
  ) }),
33572
35046
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Content, { size: "sm", children: "Remove conditional logic" })
@@ -33582,27 +35056,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33582
35056
  ] });
33583
35057
  });
33584
35058
  FieldSectionConditionEdgeComponent.displayName = "FieldSectionConditionEdgeComponent";
33585
- const useFieldTypeItems = (onSelect = () => null) => {
33586
- return React.useMemo(() => {
33587
- const entries = Object.entries(FieldTypeToClsMapping);
33588
- return entries.map(([type, fieldClass]) => ({
33589
- children: fieldClass.fieldTypeName,
33590
- icon: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[type] }),
33591
- value: type,
33592
- onSelect: () => {
33593
- onSelect(type);
33594
- }
33595
- }));
33596
- }, [onSelect]);
33597
- };
33598
35059
  const FieldSectionNodeComponent = React.memo((props) => {
33599
35060
  const { data, selected } = props;
33600
35061
  const { fieldSection, index: sectionIndex, layoutDirection } = data;
33601
35062
  const fieldSchema = React.use(FieldSchemaContext);
33602
- const removeSection = React.useCallback(() => {
35063
+ const handleRemoveSection = React.useCallback(() => {
33603
35064
  fieldSchema.removeFieldSection(fieldSection);
33604
35065
  }, [fieldSchema, fieldSection]);
33605
- const addField = React.useCallback(
35066
+ const handleAddField = React.useCallback(
33606
35067
  (type) => {
33607
35068
  fieldSection.addField(createField(type));
33608
35069
  },
@@ -33616,13 +35077,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33616
35077
  const handleDuplicate = React.useCallback(() => {
33617
35078
  fieldSchema.addFieldSection(fieldSection.duplicate(uuid.v4()));
33618
35079
  }, [fieldSchema, fieldSection]);
33619
- const fieldTypeItems = useFieldTypeItems(addField);
33620
- const removeField = React.useCallback(
33621
- (field) => {
33622
- fieldSection.removeField(field);
33623
- },
33624
- [fieldSection]
33625
- );
33626
35080
  return /* @__PURE__ */ jsxRuntime.jsxs(
33627
35081
  blocks.Card,
33628
35082
  {
@@ -33656,25 +35110,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33656
35110
  ] }),
33657
35111
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
33658
35112
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { weight: "bold", children: "Fields" }),
33659
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { children: [
33660
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
33661
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
33662
- " Add field"
33663
- ] }) }),
33664
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Scroll, { children: fieldTypeItems.flat().map((item) => /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: item.onSelect, children: [
33665
- item.icon,
33666
- item.children
33667
- ] }, item.value)) }) })
33668
- ] })
35113
+ /* @__PURE__ */ jsxRuntime.jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
35114
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }),
35115
+ " Add field"
35116
+ ] }) })
33669
35117
  ] }),
33670
35118
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: fieldSection.fields.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(
33671
- FieldWithActions,
35119
+ FieldBuilderWithActions,
33672
35120
  {
33673
35121
  field: child,
33674
35122
  fieldSection,
33675
- index,
33676
- sectionIndex,
33677
- remove: removeField
35123
+ fieldIndex: index,
35124
+ sectionIndex
33678
35125
  },
33679
35126
  child.identifier
33680
35127
  )) })
@@ -33695,9 +35142,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33695
35142
  size: "xs",
33696
35143
  onClick: (e) => e.stopPropagation(),
33697
35144
  children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex flex-col gap-2", variant: "surface", size: "xs", accentColor: "base", children: [
33698
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleAddBranch, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "git-branch" }) }),
33699
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleDuplicate, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "copy" }) }),
33700
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: removeSection, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" }) })
35145
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleAddBranch, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: GitBranch }) }),
35146
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleDuplicate, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Copy }) }),
35147
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleRemoveSection, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash }) })
33701
35148
  ] })
33702
35149
  }
33703
35150
  )
@@ -33914,7 +35361,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33914
35361
  }
33915
35362
  ),
33916
35363
  /* @__PURE__ */ jsxRuntime.jsx(react.Panel, { position: "top-left", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.ButtonGroup, { className: "flex items-center justify-end gap-2", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "surface", onClick: handleAddSection, children: [
33917
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
35364
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }),
33918
35365
  " Add section"
33919
35366
  ] }) }) }),
33920
35367
  /* @__PURE__ */ jsxRuntime.jsxs(react.Panel, { position: "top-right", className: "flex flex-col items-center gap-2", children: [
@@ -33928,16 +35375,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33928
35375
  value: layoutDirection,
33929
35376
  onValueChange: setLayoutDirection,
33930
35377
  children: [
33931
- /* @__PURE__ */ jsxRuntime.jsx(blocks.ToggleGroup.IconItem, { className: "rounded-b-none", value: "LR", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "arrow-right-left" }) }),
33932
- /* @__PURE__ */ jsxRuntime.jsx(blocks.ToggleGroup.IconItem, { className: "rounded-t-none", value: "TB", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "arrow-down-up" }) })
35378
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.ToggleGroup.IconItem, { className: "rounded-b-none", value: "LR", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: ArrowLeftRight }) }),
35379
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.ToggleGroup.IconItem, { className: "rounded-t-none", value: "TB", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: ArrowDownUp }) })
33933
35380
  ]
33934
35381
  }
33935
35382
  ),
33936
35383
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Separator, { size: "sm" }),
33937
35384
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex flex-col ", size: "sm", accentColor: "base", variant: "soft", children: [
33938
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { className: "rounded-b-none", onClick: () => reactFlow == null ? void 0 : reactFlow.zoomIn(), type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }) }),
33939
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: () => reactFlow == null ? void 0 : reactFlow.zoomOut(), radius: "none", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "minus" }) }),
33940
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { className: "rounded-t-none", onClick: () => reactFlow == null ? void 0 : reactFlow.fitView(), type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "square-dashed" }) })
35385
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { className: "rounded-b-none", onClick: () => reactFlow == null ? void 0 : reactFlow.zoomIn(), type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }) }),
35386
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: () => reactFlow == null ? void 0 : reactFlow.zoomOut(), radius: "none", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Minus }) }),
35387
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { className: "rounded-t-none", onClick: () => reactFlow == null ? void 0 : reactFlow.fitView(), type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: SquareDashed }) })
33941
35388
  ] })
33942
35389
  ] }),
33943
35390
  /* @__PURE__ */ jsxRuntime.jsx(react.Panel, { position: "bottom-right", children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex items-center justify-end gap-2", size: "sm", children: [
@@ -33975,7 +35422,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33975
35422
  /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons.section }),
33976
35423
  sourceFieldSection.label ?? UNLABELLED_SECTION_LABEL
33977
35424
  ] }),
33978
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleDelete, variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" }) })
35425
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleDelete, variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash }) })
33979
35426
  ] }),
33980
35427
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-max w-full flex-wrap gap-2", children: [
33981
35428
  conditions.map((condition) => {
@@ -33983,7 +35430,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33983
35430
  onRemove: handleDeleteCondition
33984
35431
  });
33985
35432
  }),
33986
- /* @__PURE__ */ jsxRuntime.jsx(FieldDropdownMenu, { fields: sourceFieldSection.fields, onSelectField: handleSelectField, align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", size: "sm", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }) }) })
35433
+ /* @__PURE__ */ jsxRuntime.jsx(FieldDropdownMenu, { fields: sourceFieldSection.fields, onSelectField: handleSelectField, align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", size: "sm", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }) }) })
33987
35434
  ] })
33988
35435
  ] });
33989
35436
  });
@@ -34045,7 +35492,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34045
35492
  fieldSections: validFieldSections,
34046
35493
  onSelectFieldCondition: handleAddConditional,
34047
35494
  children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", size: "sm", className: "w-max", children: [
34048
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
35495
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }),
34049
35496
  "Add condition"
34050
35497
  ] })
34051
35498
  }
@@ -34065,15 +35512,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34065
35512
  });
34066
35513
  FieldSectionBuilder.displayName = "FieldSectionBuilder";
34067
35514
  const FieldSectionWithActions = React.memo((props) => {
34068
- const { fieldSection, index: sectionIndex } = props;
35515
+ const { fieldSection, sectionIndex } = props;
34069
35516
  const fieldSchema = React.use(FieldSchemaContext);
34070
- const removeField = React.useCallback(
34071
- (field) => {
34072
- fieldSection.removeField(field);
34073
- },
34074
- [fieldSection]
34075
- );
34076
- const removeSection = React.useCallback(() => {
35517
+ const handleRemoveSection = React.useCallback(() => {
34077
35518
  fieldSchema.removeFieldSection(fieldSection);
34078
35519
  }, [fieldSchema, fieldSection]);
34079
35520
  const moveSection = React.useCallback(
@@ -34086,7 +35527,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34086
35527
  const duplicateSection = React.useCallback(() => {
34087
35528
  fieldSchema.addFieldSection(fieldSection.duplicate(uuid.v4()));
34088
35529
  }, [fieldSchema, fieldSection]);
34089
- const handleCreateField = React.useCallback(
35530
+ const handleAddField = React.useCallback(
34090
35531
  (type) => {
34091
35532
  fieldSection.addField(createField(type));
34092
35533
  },
@@ -34098,42 +35539,34 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34098
35539
  const handleMoveDown = React.useCallback(() => {
34099
35540
  moveSection("down");
34100
35541
  }, [moveSection]);
34101
- const fieldTypeItems = useFieldTypeItems(handleCreateField);
34102
35542
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Card, { variant: "outline", className: "flex items-center justify-between gap-4 w-full", children: [
34103
35543
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-4 w-full", children: [
34104
35544
  /* @__PURE__ */ jsxRuntime.jsx(FieldSectionBuilder, { fieldSection }),
34105
35545
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 w-full", children: [
34106
35546
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 justify-between", children: [
34107
35547
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { accentColor: "base", size: "md", children: "Fields" }),
34108
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { children: [
34109
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", size: "sm", children: [
34110
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
34111
- " Add field"
34112
- ] }) }),
34113
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Scroll, { children: fieldTypeItems.flat().map((item) => /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: item.onSelect, children: [
34114
- item.icon,
34115
- item.children
34116
- ] }, item.value)) }) })
34117
- ] })
35548
+ /* @__PURE__ */ jsxRuntime.jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", size: "sm", children: [
35549
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }),
35550
+ " Add field"
35551
+ ] }) })
34118
35552
  ] }),
34119
35553
  fieldSection.fields.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(
34120
- FieldWithActions,
35554
+ FieldBuilderWithActions,
34121
35555
  {
34122
35556
  field: child,
34123
35557
  fieldSection,
34124
- index,
34125
- sectionIndex,
34126
- remove: removeField
35558
+ fieldIndex: index,
35559
+ sectionIndex
34127
35560
  },
34128
35561
  child.identifier
34129
35562
  ))
34130
35563
  ] })
34131
35564
  ] }),
34132
35565
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex-col gap-0.5 flex", variant: "ghost", accentColor: "base", size: "sm", children: [
34133
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "move-up" }) }),
34134
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "move-down" }) }),
34135
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: duplicateSection, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "copy" }) }),
34136
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: removeSection, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" }) })
35566
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: MoveUp }) }),
35567
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: MoveDown }) }),
35568
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: duplicateSection, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Copy }) }),
35569
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleRemoveSection, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash }) })
34137
35570
  ] })
34138
35571
  ] });
34139
35572
  });
@@ -34182,7 +35615,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34182
35615
  }
34183
35616
  ),
34184
35617
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
34185
- fieldSchema.fieldSections.map((fieldSection, index) => /* @__PURE__ */ jsxRuntime.jsx(FieldSectionWithActions, { fieldSection, index }, fieldSection.identifier)),
35618
+ fieldSchema.fieldSections.map((fieldSection, index) => /* @__PURE__ */ jsxRuntime.jsx(
35619
+ FieldSectionWithActions,
35620
+ {
35621
+ fieldSection,
35622
+ sectionIndex: index
35623
+ },
35624
+ fieldSection.identifier
35625
+ )),
34186
35626
  /* @__PURE__ */ jsxRuntime.jsxs(
34187
35627
  blocks.Button,
34188
35628
  {
@@ -34193,7 +35633,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34193
35633
  size: "sm",
34194
35634
  onClick: handleCreateEmptySection,
34195
35635
  children: [
34196
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
35636
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }),
34197
35637
  " Add section"
34198
35638
  ]
34199
35639
  }
@@ -34229,53 +35669,28 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34229
35669
  }
34230
35670
  if (Object.keys(errors).length > 0) return errors;
34231
35671
  };
34232
- const initializeFieldValues = (fields, values) => {
34233
- const ret = {};
34234
- for (const field of fields) {
34235
- const value = values[field.identifier];
34236
- ret[field.identifier] = value !== void 0 ? value : field.blankValue();
34237
- }
34238
- return ret;
34239
- };
34240
- const changedFieldValues = (fields, values1, values2) => {
34241
- const ret = {};
34242
- for (const field of fields) {
34243
- const value1 = values1[field.identifier];
34244
- const value2 = values2[field.identifier];
34245
- if (field.areValuesEqual(value1, value2)) continue;
34246
- ret[field.identifier] = value2;
34247
- }
34248
- return ret;
34249
- };
34250
- const unchangedFieldValues = (fields, values1, values2) => {
34251
- const ret = {};
35672
+ const cleanFields = (fields, values) => {
35673
+ const errors = {};
35674
+ const sectionElements = fields.filter((f) => f instanceof FieldSection);
34252
35675
  for (const field of fields) {
34253
- const value1 = values1[field.identifier];
34254
- const value2 = values2[field.identifier];
34255
- if (!field.areValuesEqual(value1, value2)) continue;
34256
- ret[field.identifier] = value2;
35676
+ if (field instanceof FieldSection) {
35677
+ const conditionalSections = sectionElements.filter((section) => field.identifier in section.conditions);
35678
+ const conditionMet = conditionalSections.length > 0 ? conditionalSections.some(
35679
+ (conditionalSection) => applyConditions(conditionalSection.getConditions(field.identifier), values)
35680
+ ) : true;
35681
+ if (conditionMet) continue;
35682
+ } else {
35683
+ if (!(field instanceof BaseField)) {
35684
+ throw new Error("Invalid field type");
35685
+ }
35686
+ const id = field.identifier;
35687
+ const error = field.getError(get(values, id));
35688
+ if (error) set(errors, id, error);
35689
+ }
34257
35690
  }
34258
- return ret;
34259
- };
34260
- const isArrayOfFiles = (value) => {
34261
- return Array.isArray(value) && value[0] instanceof File;
34262
- };
34263
- const separateFilesFromFieldValues = (values) => {
34264
- const files = {};
34265
- const newValues = {};
34266
- for (const key in values) {
34267
- const value = values[key];
34268
- if (value instanceof File) {
34269
- files[key] = [value];
34270
- } else if (isArrayOfFiles(value)) {
34271
- files[key] = value;
34272
- } else if (value !== void 0) {
34273
- newValues[key] = value;
34274
- }
34275
- }
34276
- return { values: newValues, files };
35691
+ if (Object.keys(errors).length > 0) return errors;
34277
35692
  };
34278
- const separateFilesFromFields = async (fields) => {
35693
+ const separateImagesFromFields = async (fields) => {
34279
35694
  const images = {};
34280
35695
  const newFields = [];
34281
35696
  for (const section of fields) {
@@ -34303,16 +35718,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34303
35718
  }
34304
35719
  return { fields: newFields, images };
34305
35720
  };
34306
- async function awaitPromisesFromFieldValues(values) {
34307
- const valuesWithoutFiles = {};
35721
+ async function awaitFilesAndPromises(values) {
35722
+ const ret = {};
34308
35723
  for (const [key, value] of Object.entries(values)) {
34309
- if (Array.isArray(value) && value.some((item) => item instanceof UUIDPromise)) {
34310
- valuesWithoutFiles[key] = await Promise.all(value);
34311
- } else {
34312
- valuesWithoutFiles[key] = value;
34313
- }
35724
+ ret[key] = await Promise.all(value);
34314
35725
  }
34315
- return valuesWithoutFiles;
35726
+ return ret;
34316
35727
  }
34317
35728
  const FormRenderer = React.memo(
34318
35729
  React.forwardRef((props, ref) => {
@@ -34408,13 +35819,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34408
35819
  variant: "soft",
34409
35820
  onClick: onCancel,
34410
35821
  children: [
34411
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }),
35822
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X }),
34412
35823
  cancelText
34413
35824
  ]
34414
35825
  }
34415
35826
  ),
34416
35827
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { ...buttonProps, type: "submit", accentColor: "primary", variant: "surface", children: [
34417
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }),
35828
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }),
34418
35829
  submitText
34419
35830
  ] })
34420
35831
  ] })
@@ -34549,6 +35960,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34549
35960
  exports2.CheckboxListFieldCondition = CheckboxListFieldCondition;
34550
35961
  exports2.CheckboxListFieldConditionCell = CheckboxListFieldConditionCell;
34551
35962
  exports2.CheckboxListInput = CheckboxListInput;
35963
+ exports2.ConditionManager = ConditionManager;
34552
35964
  exports2.DateAfterConditionModifier = DateAfterConditionModifier;
34553
35965
  exports2.DateBeforeConditionModifier = DateBeforeConditionModifier;
34554
35966
  exports2.DateEqualsConditionModifier = DateEqualsConditionModifier;
@@ -34599,10 +36011,23 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34599
36011
  exports2.OTPFieldCondition = OTPFieldCondition;
34600
36012
  exports2.OTPFieldConditionCell = OTPFieldConditionCell;
34601
36013
  exports2.OTPInput = OTPInput;
36014
+ exports2.Observable = Observable;
36015
+ exports2.PassFailArrayExcludesConditionModifier = PassFailArrayExcludesConditionModifier;
36016
+ exports2.PassFailArrayIncludesConditionModifier = PassFailArrayIncludesConditionModifier;
36017
+ exports2.PassFailEqualsConditionModifier = PassFailEqualsConditionModifier;
36018
+ exports2.PassFailField = PassFailField;
36019
+ exports2.PassFailFieldCondition = PassFailFieldCondition;
36020
+ exports2.PassFailFieldConditionCell = PassFailFieldConditionCell;
36021
+ exports2.PassFailInput = PassFailInput;
36022
+ exports2.PassFailNotEqualsConditionModifier = PassFailNotEqualsConditionModifier;
34602
36023
  exports2.RadioField = RadioField;
34603
36024
  exports2.RadioFieldCondition = RadioFieldCondition;
34604
36025
  exports2.RadioFieldConditionCell = RadioFieldConditionCell;
34605
36026
  exports2.RadioInput = RadioInput;
36027
+ exports2.RatingField = RatingField;
36028
+ exports2.RatingFieldCondition = RatingFieldCondition;
36029
+ exports2.RatingFieldConditionCell = RatingFieldConditionCell;
36030
+ exports2.RatingInput = RatingInput;
34606
36031
  exports2.SEVERITY_COLOR_MAPPING = SEVERITY_COLOR_MAPPING;
34607
36032
  exports2.SHORT_TEXT_FIELD_MAX_LENGTH = SHORT_TEXT_FIELD_MAX_LENGTH;
34608
36033
  exports2.ScanField = ScanField;
@@ -34634,15 +36059,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34634
36059
  exports2.TextFieldCondition = TextFieldCondition;
34635
36060
  exports2.TextFieldConditionCell = TextFieldConditionCell;
34636
36061
  exports2.TextInput = TextInput;
36062
+ exports2.UUIDFile = UUIDFile;
34637
36063
  exports2.UUIDPromise = UUIDPromise;
34638
36064
  exports2.UploadField = UploadField;
34639
36065
  exports2.UploadFieldCondition = UploadFieldCondition;
34640
36066
  exports2.UploadFieldConditionCell = UploadFieldConditionCell;
34641
36067
  exports2.UploadInput = UploadInput;
34642
36068
  exports2.applyConditions = applyConditions;
34643
- exports2.awaitPromisesFromFieldValues = awaitPromisesFromFieldValues;
36069
+ exports2.areFileAndPromiseArraysEqual = areFileAndPromiseArraysEqual;
36070
+ exports2.arePassFieldValuesEqual = arePassFieldValuesEqual;
36071
+ exports2.awaitFilesAndPromises = awaitFilesAndPromises;
34644
36072
  exports2.changedFieldValues = changedFieldValues;
34645
36073
  exports2.cleanFieldValues = cleanFieldValues;
36074
+ exports2.cleanFields = cleanFields;
34646
36075
  exports2.cleanSerializedFieldValues = cleanSerializedFieldValues;
34647
36076
  exports2.createCondition = createCondition;
34648
36077
  exports2.createConditionModifierConfig = createConditionModifierConfig;
@@ -34654,18 +36083,28 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34654
36083
  exports2.deserializeFieldValues = deserializeFieldValues;
34655
36084
  exports2.deserializeFields = deserializeFields;
34656
36085
  exports2.deserializeOnlyFields = deserializeOnlyFields;
36086
+ exports2.deserializePassFailFieldValue = deserializePassFailFieldValue;
36087
+ exports2.extractFilesAndPromisesFromFieldValues = extractFilesAndPromisesFromFieldValues;
34657
36088
  exports2.fieldIcons = fieldIcons;
34658
36089
  exports2.flattenFields = flattenFields;
34659
36090
  exports2.getFieldsMapping = getFieldsMapping;
34660
36091
  exports2.initializeFieldValues = initializeFieldValues;
36092
+ exports2.insertFilesAndPromisesToFieldValues = insertFilesAndPromisesToFieldValues;
36093
+ exports2.isFileAndPromiseArray = isFileAndPromiseArray;
36094
+ exports2.isPassFailFieldStatus = isPassFailFieldStatus;
36095
+ exports2.isPassFailFieldValue = isPassFailFieldValue;
36096
+ exports2.isSerializedPassFailFieldValue = isSerializedPassFailFieldValue;
34661
36097
  exports2.isStringArray = isStringArray;
34662
36098
  exports2.maxFileSizeB = maxFileSizeB;
34663
36099
  exports2.maxFileSizeKB = maxFileSizeKB;
34664
36100
  exports2.maxFileSizeMB = maxFileSizeMB;
34665
- exports2.separateFilesFromFieldValues = separateFilesFromFieldValues;
34666
- exports2.separateFilesFromFields = separateFilesFromFields;
36101
+ exports2.passFailFieldStatusMapping = passFailFieldStatusMapping;
36102
+ exports2.passFailFieldStatuses = passFailFieldStatuses;
36103
+ exports2.separateImagesFromFields = separateImagesFromFields;
34667
36104
  exports2.serializeFieldValues = serializeFieldValues;
36105
+ exports2.serializePassFailFieldValue = serializePassFailFieldValue;
34668
36106
  exports2.unchangedFieldValues = unchangedFieldValues;
36107
+ exports2.useConditionManager = useConditionManager;
34669
36108
  exports2.useFieldInput = useFieldInput;
34670
36109
  exports2.useFieldInputs = useFieldInputs;
34671
36110
  exports2.useFormikInput = useFormikInput;