@overmap-ai/forms 1.0.32-react-flow-david-fixes.40 → 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 (97) 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 +5 -5
  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/hooks.d.ts +1 -371
  81. package/dist/form/fields/index.d.ts +2 -0
  82. package/dist/form/fields/typings.d.ts +14 -16
  83. package/dist/form/fields/utils.d.ts +6 -1
  84. package/dist/form/index.d.ts +3 -0
  85. package/dist/form/modifiers/file.d.ts +3 -2
  86. package/dist/form/modifiers/index.d.ts +1 -0
  87. package/dist/form/modifiers/passFailStatus.d.ts +6 -0
  88. package/dist/form/modifiers/utils.d.ts +1 -1
  89. package/dist/form/schema/FieldSchema.d.ts +6 -5
  90. package/dist/form/typings.d.ts +6 -2
  91. package/dist/form/utils.d.ts +5 -11
  92. package/dist/forms.js +2121 -684
  93. package/dist/forms.umd.cjs +2119 -682
  94. package/package.json +3 -5
  95. package/dist/form/builder/components/FieldWithActions.d.ts +0 -10
  96. /package/dist/form/{observable → Observable}/Observable.d.ts +0 -0
  97. /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
  ),
@@ -314,12 +908,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
314
908
  ];
315
909
  };
316
910
  const MultiStringInput = React.memo((props) => {
317
- const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, rest] = useFormikInput(props);
911
+ const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
318
912
  const computedHelpText = showInputOnly ? null : helpText;
319
913
  const computedLabel = showInputOnly ? "" : label;
320
914
  const { value, name, onChange, onBlur } = fieldProps;
321
915
  const droppableId = `${inputId}-droppable`;
322
- const { disabled } = rest;
323
916
  const [intermediateValue, setIntermediateValue] = React.useState("");
324
917
  const [internalError, setInternalError] = React.useState("");
325
918
  const updatedHelpText = internalError || computedHelpText;
@@ -406,7 +999,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
406
999
  placeholder: field.placeholder,
407
1000
  onBlur: handleInputBlur,
408
1001
  name,
409
- ...rest
1002
+ disabled
410
1003
  }
411
1004
  ) }),
412
1005
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -419,7 +1012,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
419
1012
  "aria-label": "Add option",
420
1013
  disabled: !!internalError || disabled,
421
1014
  onClick: addOption,
422
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" })
1015
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus })
423
1016
  }
424
1017
  )
425
1018
  ] })
@@ -466,7 +1059,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
466
1059
  onClick: () => {
467
1060
  handleDeleteOption(index);
468
1061
  },
469
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" })
1062
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X })
470
1063
  }
471
1064
  )
472
1065
  ]
@@ -618,7 +1211,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
618
1211
  }
619
1212
  }
620
1213
  const BooleanInput = React.memo((props) => {
621
- const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, rest] = useFormikInput(props);
1214
+ const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
622
1215
  const { name, onBlur, onChange, value } = fieldProps;
623
1216
  const computedHelpText = showInputOnly ? null : helpText;
624
1217
  const computedLabel = showInputOnly ? "" : label;
@@ -653,8 +1246,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
653
1246
  size: "sm",
654
1247
  accentColor: "primary",
655
1248
  variant: "surface",
656
- ...rest,
657
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
1249
+ disabled,
1250
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }) })
658
1251
  }
659
1252
  )
660
1253
  }
@@ -683,7 +1276,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
683
1276
  });
684
1277
  }
685
1278
  static deserialize(data) {
686
- if (data.type !== "boolean") throw new Error("Type mismatch.");
687
1279
  return new _BooleanField(data);
688
1280
  }
689
1281
  serializeValue(value) {
@@ -714,7 +1306,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
714
1306
  const NumberInput = React.memo((props) => {
715
1307
  const [
716
1308
  { inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
717
- rest
1309
+ { disabled }
718
1310
  ] = useFormikInput(props);
719
1311
  const { name, onBlur, onChange, value } = fieldProps;
720
1312
  const computedHelpText = showInputOnly ? null : helpText;
@@ -760,7 +1352,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
760
1352
  max: field.maximum,
761
1353
  step: field.integers ? 1 : 0.1,
762
1354
  placeholder: field.placeholder ?? "Enter a number",
763
- ...rest
1355
+ disabled
764
1356
  }
765
1357
  ) })
766
1358
  }
@@ -796,8 +1388,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
796
1388
  description: "Minimum value",
797
1389
  integers: true,
798
1390
  required: false,
799
- identifier: `${path}minimum`,
800
- fieldValidators: []
1391
+ identifier: `${path}minimum`
801
1392
  }),
802
1393
  showDirectly: false
803
1394
  },
@@ -807,8 +1398,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
807
1398
  description: "Maximum value",
808
1399
  integers: true,
809
1400
  required: false,
810
- identifier: `${path}maximum`,
811
- fieldValidators: []
1401
+ identifier: `${path}maximum`
812
1402
  }),
813
1403
  showDirectly: false
814
1404
  },
@@ -933,7 +1523,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
933
1523
  identifier: `${path}minimum_length`,
934
1524
  minimum: 0,
935
1525
  maximum: 100,
936
- fieldValidators: [],
937
1526
  integers: true
938
1527
  }),
939
1528
  showDirectly: false
@@ -947,7 +1536,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
947
1536
  minimum: 1,
948
1537
  maximum: LONG_TEXT_FIELD_MAX_LENGTH,
949
1538
  // TODO: depends on short vs long text
950
- fieldValidators: [],
951
1539
  // TODO: default: 500 (see: "Short text fields can hold up to 500 characters on a single line.")
952
1540
  integers: true
953
1541
  }),
@@ -1017,7 +1605,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1017
1605
  }
1018
1606
  }
1019
1607
  const CheckboxListInput = React.memo((props) => {
1020
- const [{ inputId, labelId, size, severity, field, showInputOnly, helpText, label, fieldProps }, rest] = useFormikInput(props);
1608
+ const [{ inputId, labelId, size, severity, field, showInputOnly, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
1021
1609
  const { value, name, onChange, onBlur } = fieldProps;
1022
1610
  const computedHelpText = showInputOnly ? null : helpText;
1023
1611
  const computedLabel = showInputOnly ? "" : label;
@@ -1048,9 +1636,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1048
1636
  size: "sm",
1049
1637
  values: value,
1050
1638
  onValuesChange: handleChange,
1051
- ...rest,
1639
+ disabled,
1052
1640
  children: field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
1053
- /* @__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 }) }) }),
1054
1642
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
1055
1643
  ] }, `${inputId}-${option.value}-${index}`))
1056
1644
  }
@@ -1106,7 +1694,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1106
1694
  __publicField(_CheckboxListField, "fieldTypeDescription", "Allows the user to select a multiple options from a list.");
1107
1695
  let CheckboxListField = _CheckboxListField;
1108
1696
  const DateInput = React.memo((props) => {
1109
- const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, rest] = useFormikInput(props);
1697
+ const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
1110
1698
  const { value, name, onChange, onBlur } = fieldProps;
1111
1699
  const [popoverOpen, setPopoverOpen] = React.useState(false);
1112
1700
  const computedHelpText = showInputOnly ? null : helpText;
@@ -1145,14 +1733,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1145
1733
  accentColor: "base",
1146
1734
  variant: "surface",
1147
1735
  size: "sm",
1148
- ...rest,
1736
+ disabled,
1149
1737
  children: [
1150
1738
  value ? value.toLocaleString(void 0, {
1151
1739
  year: "numeric",
1152
1740
  month: "2-digit",
1153
1741
  day: "2-digit"
1154
1742
  }) : "yyyy-mm-dd",
1155
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
1743
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: ChevronDown })
1156
1744
  ]
1157
1745
  }
1158
1746
  ) }),
@@ -1223,7 +1811,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1223
1811
  __publicField(_DateField, "fieldTypeDescription", "Allows specifying a date.");
1224
1812
  let DateField = _DateField;
1225
1813
  const MultiSelectInput = React.memo((props) => {
1226
- const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, rest] = useFormikInput(props);
1814
+ const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
1227
1815
  const { value, name, onChange, onBlur } = fieldProps;
1228
1816
  const computedHelpText = showInputOnly ? null : helpText;
1229
1817
  const computedLabel = showInputOnly ? "" : label;
@@ -1260,16 +1848,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1260
1848
  type: "button",
1261
1849
  size: "sm",
1262
1850
  accentColor: "base",
1263
- ...rest,
1851
+ disabled,
1264
1852
  children: [
1265
1853
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: value && value.length > 0 ? value.join(", ") : field.placeholder ?? "Select one or more..." }),
1266
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
1854
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: ChevronDown })
1267
1855
  ]
1268
1856
  }
1269
1857
  ) }),
1270
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: [
1271
1859
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.SelectAllItem, { children: [
1272
- /* @__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 }) }),
1273
1861
  "Select all"
1274
1862
  ] }),
1275
1863
  field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1277,7 +1865,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1277
1865
  {
1278
1866
  value: option.value,
1279
1867
  children: [
1280
- /* @__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 }) }),
1281
1869
  option.label
1282
1870
  ]
1283
1871
  },
@@ -1346,7 +1934,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1346
1934
  __publicField(_MultiSelectField, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options.");
1347
1935
  let MultiSelectField = _MultiSelectField;
1348
1936
  const SelectInput = React.memo((props) => {
1349
- const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, rest] = useFormikInput(props);
1937
+ const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
1350
1938
  const { name, onChange, onBlur, value } = fieldProps;
1351
1939
  const computedHelpText = showInputOnly ? null : helpText;
1352
1940
  const computedLabel = showInputOnly ? "" : label;
@@ -1380,15 +1968,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1380
1968
  variant: "surface",
1381
1969
  type: "button",
1382
1970
  size: "sm",
1383
- ...rest,
1971
+ disabled,
1384
1972
  children: [
1385
1973
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: currentOption ? currentOption.label : field.placeholder ?? "Select one..." }),
1386
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
1974
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: ChevronDown })
1387
1975
  ]
1388
1976
  }
1389
1977
  ) }),
1390
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: [
1391
- /* @__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 }) }),
1392
1980
  option.label
1393
1981
  ] }, `${inputId}-${option.value}-${index}`)) }) }) })
1394
1982
  ] })
@@ -1455,7 +2043,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1455
2043
  const OTPInput = React.memo((props) => {
1456
2044
  const [
1457
2045
  { inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
1458
- { formId: formId2, autoComplete: _autoComplete, ...rest }
2046
+ { formId: formId2, disabled }
1459
2047
  ] = useFormikInput(props);
1460
2048
  const { name, onBlur, onChange, value } = fieldProps;
1461
2049
  const computedHelpText = showInputOnly ? null : helpText;
@@ -1474,17 +2062,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1474
2062
  },
1475
2063
  [field, helpers, touched]
1476
2064
  );
1477
- const handleBlur = React.useCallback(
1478
- (e) => {
1479
- const { relatedTarget } = e;
1480
- if (relatedTarget instanceof Element && inputUuids.includes(relatedTarget.id)) {
1481
- return;
1482
- }
1483
- onChange(internalValue);
1484
- onBlur(internalValue);
1485
- },
1486
- [inputUuids, internalValue, onBlur, onChange]
1487
- );
2065
+ const handleBlur = React.useCallback(() => {
2066
+ onChange(internalValue);
2067
+ onBlur(internalValue);
2068
+ }, [internalValue, onBlur, onChange]);
1488
2069
  return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
1489
2070
  InputWithLabel,
1490
2071
  {
@@ -1503,6 +2084,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1503
2084
  onValueChange: handleChange,
1504
2085
  validationType: field.validationType,
1505
2086
  form: formId2,
2087
+ disabled,
1506
2088
  orientation: "horizontal",
1507
2089
  dir: "ltr",
1508
2090
  type: "text",
@@ -1513,9 +2095,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1513
2095
  accentColor: "base",
1514
2096
  variant: "surface",
1515
2097
  size: "sm",
1516
- ...rest,
2098
+ onBlur: handleBlur,
1517
2099
  children: [
1518
- 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)),
1519
2101
  /* @__PURE__ */ jsxRuntime.jsx(blocks.OneTimePasswordField.HiddenInput, {})
1520
2102
  ]
1521
2103
  }
@@ -1545,8 +2127,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1545
2127
  required: false,
1546
2128
  minimum: 1,
1547
2129
  maximum: 16,
1548
- identifier: `${path}length`,
1549
- fieldValidators: []
2130
+ identifier: `${path}length`
1550
2131
  }),
1551
2132
  showDirectly: false
1552
2133
  },
@@ -1642,8 +2223,566 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1642
2223
  __publicField(_OTPField, "fieldTypeName", "OTP");
1643
2224
  __publicField(_OTPField, "fieldTypeDescription", "Allows specifying a number within a given range.");
1644
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;
1645
2784
  const RadioInput = React.memo((props) => {
1646
- const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, rest] = useFormikInput(props);
2785
+ const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
1647
2786
  const { name, onChange, onBlur, value } = fieldProps;
1648
2787
  const computedHelpText = showInputOnly ? null : helpText;
1649
2788
  const computedLabel = showInputOnly ? "" : label;
@@ -1678,10 +2817,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1678
2817
  size: "sm",
1679
2818
  value: value ?? "",
1680
2819
  onValueChange: handleChange,
1681
- ...rest,
2820
+ disabled,
1682
2821
  children: [
1683
2822
  field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
1684
- /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down", className: "fill-current" }) }) }),
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" }) }) }),
1685
2824
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
1686
2825
  ] }, `${inputId}-${option.value}-${index}`)),
1687
2826
  !!value && /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1694,7 +2833,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1694
2833
  accentColor: "base",
1695
2834
  size: "sm",
1696
2835
  children: [
1697
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }),
2836
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X }),
1698
2837
  "Clear"
1699
2838
  ]
1700
2839
  }
@@ -1755,6 +2894,149 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1755
2894
  __publicField(_RadioField, "fieldTypeName", "Option list");
1756
2895
  __publicField(_RadioField, "fieldTypeDescription", "Allows the user to select a single option from a list of options.");
1757
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,
2935
+ {
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
+ ] })
2946
+ }
2947
+ ) });
2948
+ });
2949
+ RatingInput.displayName = "RatingInput";
2950
+ const _RatingField = class _RatingField extends BaseField {
2951
+ constructor(options) {
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;
2984
+ }
2985
+ serialize() {
2986
+ return {
2987
+ ...super.serialize(),
2988
+ maxRating: this.maxRating
2989
+ };
2990
+ }
2991
+ getOptions() {
2992
+ return {
2993
+ ...super.getOptions(),
2994
+ maxRating: this.maxRating
2995
+ };
2996
+ }
2997
+ duplicate(identifier) {
2998
+ return new _RatingField({
2999
+ ...this.getOptions(),
3000
+ identifier
3001
+ });
3002
+ }
3003
+ setOptions(options) {
3004
+ const { maxRating, ...rest } = options;
3005
+ this.maxRating = maxRating ?? this.maxRating;
3006
+ super.setOptions(rest);
3007
+ }
3008
+ static deserialize(data) {
3009
+ return new _RatingField(data);
3010
+ }
3011
+ serializeValue(value) {
3012
+ return value;
3013
+ }
3014
+ deserializeValue(value) {
3015
+ return value;
3016
+ }
3017
+ render(props) {
3018
+ return /* @__PURE__ */ jsxRuntime.jsx(RatingInput, { field: this, ...props });
3019
+ }
3020
+ isSerializedValueValid(value) {
3021
+ return typeof value === "number" || value === null;
3022
+ }
3023
+ isValueValid(value) {
3024
+ return typeof value === "number" || value === null;
3025
+ }
3026
+ areValuesEqual(value1, value2) {
3027
+ return value1 === value2;
3028
+ }
3029
+ blankValue() {
3030
+ return null;
3031
+ }
3032
+ };
3033
+ __publicField(_RatingField, "fieldTypeName", "Rating");
3034
+ __publicField(_RatingField, "fieldTypeDescription", "Allows users to select a rating value.");
3035
+ let RatingField = _RatingField;
3036
+ const ScannerContext = React.createContext(() => {
3037
+ throw new Error("No ScannerProvider found");
3038
+ });
3039
+ const useScanner = () => React.use(ScannerContext);
1758
3040
  function fixProto(target, prototype) {
1759
3041
  var setPrototypeOf = Object.setPrototypeOf;
1760
3042
  setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
@@ -29889,15 +31171,38 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
29889
31171
  hints: SCANNER_HINTS
29890
31172
  });
29891
31173
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-full flex-col justify-center overflow-hidden bg-(--color-background)", children: [
29892
- /* @__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 }) }) }) }),
29893
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 }) })
29894
31176
  ] });
29895
31177
  });
29896
31178
  ScannerInternal.displayName = "ScannerInternal";
31179
+ const ScannerProvider = React.memo((props) => {
31180
+ const { children } = props;
31181
+ const [config, setConfig] = React.useState(null);
31182
+ const closeFileViewer = React.useCallback(() => {
31183
+ setConfig(null);
31184
+ }, []);
31185
+ const openFileViewer = React.useCallback(
31186
+ (func) => {
31187
+ setConfig(func(closeFileViewer));
31188
+ },
31189
+ [closeFileViewer]
31190
+ );
31191
+ const handleClose = React.useCallback(() => {
31192
+ if (!config) return;
31193
+ if (config.onClose) config.onClose();
31194
+ closeFileViewer();
31195
+ }, [closeFileViewer, config]);
31196
+ return /* @__PURE__ */ jsxRuntime.jsxs(ScannerContext.Provider, { value: openFileViewer, children: [
31197
+ children,
31198
+ config && /* @__PURE__ */ jsxRuntime.jsx(Scanner, { open: true, onOpenChange: handleClose, ...config })
31199
+ ] });
31200
+ });
31201
+ ScannerProvider.displayName = "FileViewerProvider";
29897
31202
  const ScanInput = React.memo((props) => {
29898
31203
  const [
29899
31204
  { inputId, labelId, label, helpText, size, severity, showInputOnly, field, fieldProps, helpers, touched },
29900
- rest
31205
+ { disabled }
29901
31206
  ] = useFormikInput(props);
29902
31207
  const { name, onBlur, onChange, value } = fieldProps;
29903
31208
  const [showScanner, setShowScanner] = React.useState(false);
@@ -29959,7 +31264,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
29959
31264
  placeholder: "Enter a qr or barcode",
29960
31265
  onChange: handleChange,
29961
31266
  onBlur: handleBlur,
29962
- ...rest
31267
+ disabled
29963
31268
  }
29964
31269
  ),
29965
31270
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -29971,8 +31276,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
29971
31276
  variant: "soft",
29972
31277
  size: "sm",
29973
31278
  accentColor: "base",
31279
+ disabled,
29974
31280
  children: [
29975
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "maximize" }),
31281
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Maximize }),
29976
31282
  "Scan"
29977
31283
  ]
29978
31284
  }
@@ -30036,7 +31342,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30036
31342
  const StringInput = React.memo((props) => {
30037
31343
  const [
30038
31344
  { inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
30039
- rest
31345
+ { disabled }
30040
31346
  ] = useFormikInput(props);
30041
31347
  const { name, onBlur, onChange, value } = fieldProps;
30042
31348
  const computedHelpText = showInputOnly ? null : helpText;
@@ -30079,7 +31385,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30079
31385
  placeholder: field.placeholder,
30080
31386
  onChange: handleChange,
30081
31387
  onBlur: handleBlur,
30082
- ...rest
31388
+ disabled
30083
31389
  }
30084
31390
  ) })
30085
31391
  }
@@ -30110,7 +31416,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30110
31416
  super.setOptions(options);
30111
31417
  }
30112
31418
  static deserialize(data) {
30113
- if (data.type !== "string") throw new Error("Type mismatch.");
30114
31419
  const { maximum_length, minimum_length, ...rest } = data;
30115
31420
  return new _StringField({
30116
31421
  ...rest,
@@ -30129,7 +31434,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30129
31434
  const TextInput = React.memo((props) => {
30130
31435
  const [
30131
31436
  { inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
30132
- rest
31437
+ { disabled }
30133
31438
  ] = useFormikInput(props);
30134
31439
  const { name, onBlur, onChange, value } = fieldProps;
30135
31440
  const computedHelpText = showInputOnly ? null : helpText;
@@ -30175,7 +31480,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30175
31480
  accentColor: "base",
30176
31481
  variant: "surface",
30177
31482
  size: "sm",
30178
- ...rest
31483
+ disabled
30179
31484
  }
30180
31485
  )
30181
31486
  }
@@ -30220,110 +31525,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30220
31525
  __publicField(_TextField, "fieldTypeName", "Paragraph");
30221
31526
  __publicField(_TextField, "fieldTypeDescription", `Paragraph fields can hold up to ${LONG_TEXT_FIELD_MAX_LENGTH} characters and can have multiple lines.`);
30222
31527
  let TextField = _TextField;
30223
- const ImageCard = React.memo(
30224
- React.forwardRef((props, forwardedRef) => {
30225
- const { file, alt, error, rightSlot, className, ...rest } = props;
30226
- return /* @__PURE__ */ jsxRuntime.jsxs(
30227
- blocks.Card,
30228
- {
30229
- className: classVarianceAuthority.cx(className, "relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),
30230
- ref: forwardedRef,
30231
- ...rest,
30232
- children: [
30233
- !file && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 grow flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Spinner, {}) }),
30234
- !!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(
30235
- "img",
30236
- {
30237
- className: "max-w-full object-cover",
30238
- src: URL.createObjectURL(file),
30239
- alt: alt ?? file.name
30240
- }
30241
- ) }),
30242
- (!!file || !!error) && /* @__PURE__ */ jsxRuntime.jsxs(
30243
- "div",
30244
- {
30245
- className: classVarianceAuthority.cx("flex w-full items-center gap-2 self-end", {
30246
- "bg-transparent": !file
30247
- }),
30248
- children: [
30249
- error ? /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "file-warning" }) : file && /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "file" }),
30250
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: "truncate", size: "sm", children: error ?? (file == null ? void 0 : file.name) }),
30251
- rightSlot
30252
- ]
30253
- }
30254
- )
30255
- ]
30256
- }
30257
- );
30258
- })
30259
- );
30260
- class UUIDPromise extends Promise {
30261
- constructor(executor, uuid2) {
30262
- super(executor);
30263
- __publicField(this, "_uuid");
30264
- this._uuid = uuid2;
30265
- }
30266
- get uuid() {
30267
- return this._uuid;
30268
- }
30269
- set uuid(uuid2) {
30270
- this._uuid = uuid2;
30271
- }
30272
- static from(promise, uuid2) {
30273
- return new UUIDPromise((resolve, reject) => {
30274
- Promise.resolve(promise).then(resolve).catch(reject);
30275
- }, uuid2);
30276
- }
30277
- then(onFulfilled, onRejected) {
30278
- const promise = super.then(onFulfilled, onRejected);
30279
- promise.uuid = this.uuid;
30280
- return promise;
30281
- }
30282
- catch(onRejected) {
30283
- const promise = super.catch(onRejected);
30284
- promise.uuid = this.uuid;
30285
- return promise;
30286
- }
30287
- finally(onFinally) {
30288
- const promise = super.finally(onFinally);
30289
- promise.uuid = this.uuid;
30290
- return promise;
30291
- }
30292
- }
30293
- const convertBytesToLargestUnit = (bytes) => {
30294
- const units = ["byte", "kilobyte", "megabyte"];
30295
- let sizeInUnit = bytes;
30296
- let unitIndex = 0;
30297
- while (sizeInUnit > 1e3 && unitIndex < units.length - 1) {
30298
- sizeInUnit /= 1e3;
30299
- unitIndex++;
30300
- }
30301
- const formatter = new Intl.NumberFormat([], {
30302
- // 0 for bytes and kilobytes, 1 for megabytes
30303
- maximumFractionDigits: Math.max(0, unitIndex - 1),
30304
- style: "unit",
30305
- unit: units[unitIndex]
30306
- });
30307
- return formatter.format(sizeInUnit);
30308
- };
30309
- function areFilesEqual(file1, file2) {
30310
- return file1.name === file2.name && file1.size === file2.size && file1.type === file2.type;
30311
- }
30312
- function separateFilesFromPromises(filesOrPromises) {
30313
- const files = [];
30314
- const promises = [];
30315
- for (const fileOrPromise of filesOrPromises) {
30316
- if (fileOrPromise instanceof UUIDPromise) {
30317
- promises.push(fileOrPromise);
30318
- } else {
30319
- files.push(fileOrPromise);
30320
- }
30321
- }
30322
- return [files, promises];
30323
- }
30324
31528
  const UploadInput = React.memo((props) => {
30325
31529
  var _a2;
30326
- const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
31530
+ const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps }, { disabled }] = useFormikInput(props);
30327
31531
  const { value, name, onChange, onBlur } = fieldProps;
30328
31532
  const input = React.useRef(null);
30329
31533
  const updatedHelpText = React.useMemo(() => {
@@ -30345,7 +31549,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30345
31549
  onBlur([]);
30346
31550
  return;
30347
31551
  }
30348
- const fileArray = Array.from(files);
31552
+ const fileArray = Array.from(files).map((file) => UUIDFile.from(uuid.v4(), file));
30349
31553
  const newValue = [...value, ...fileArray];
30350
31554
  onChange(newValue);
30351
31555
  onBlur(newValue);
@@ -30397,11 +31601,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30397
31601
  variant: "soft",
30398
31602
  accentColor: "base",
30399
31603
  onClick: handleClick,
30400
- id: "upload-input-upload-button",
30401
31604
  type: "button",
30402
- ...rest,
31605
+ disabled,
30403
31606
  children: [
30404
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "upload" }),
31607
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Upload }),
30405
31608
  buttonText
30406
31609
  ]
30407
31610
  }
@@ -30426,105 +31629,17 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30426
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(
30427
31630
  DisplayFile,
30428
31631
  {
30429
- field,
30430
31632
  file,
30431
31633
  onRemove: () => {
30432
31634
  handleRemove(index);
30433
31635
  },
30434
- disabled: rest.disabled
31636
+ disabled
30435
31637
  },
30436
31638
  index
30437
31639
  )) })
30438
31640
  ] });
30439
31641
  });
30440
31642
  UploadInput.displayName = "UploadInput";
30441
- const DisplayFile = React.memo((props) => {
30442
- const { file, field, onRemove, disabled } = props;
30443
- const [resolvedFile, setResolvedFile] = React.useState(null);
30444
- const openImageViewer = useImageViewer();
30445
- const error = React.useMemo(() => resolvedFile && field.getError([resolvedFile]), [field, resolvedFile]);
30446
- const { url, name } = React.useMemo(() => {
30447
- let url2 = null;
30448
- let name2;
30449
- let size;
30450
- if (resolvedFile == null ? void 0 : resolvedFile.type.startsWith("image/")) {
30451
- url2 = URL.createObjectURL(resolvedFile);
30452
- }
30453
- if (resolvedFile) {
30454
- name2 = resolvedFile.name;
30455
- size = convertBytesToLargestUnit(resolvedFile.size);
30456
- } else {
30457
- name2 = "Downloading...";
30458
- size = "...";
30459
- }
30460
- return { url: url2, name: name2, size };
30461
- }, [resolvedFile]);
30462
- React.useEffect(() => {
30463
- if (file instanceof UUIDPromise) {
30464
- file.then((file2) => {
30465
- console.debug("file", file2);
30466
- setResolvedFile(file2);
30467
- }).catch(console.error);
30468
- } else {
30469
- setResolvedFile(file);
30470
- }
30471
- }, [file]);
30472
- const handleDownload = React.useCallback(
30473
- (event) => {
30474
- event.stopPropagation();
30475
- if (!resolvedFile) {
30476
- throw new Error("Cannot download a file that is not resolved.");
30477
- }
30478
- const blob = new Blob([resolvedFile]);
30479
- fileSaver.saveAs(blob, name);
30480
- },
30481
- [name, resolvedFile]
30482
- );
30483
- const handleDelete = React.useCallback(
30484
- (e) => {
30485
- e.stopPropagation();
30486
- onRemove();
30487
- },
30488
- [onRemove]
30489
- );
30490
- const handleImageCardClick = React.useCallback(() => {
30491
- if (!resolvedFile) return;
30492
- openImageViewer((closeFileViewer) => ({
30493
- file: resolvedFile,
30494
- onDelete: !disabled ? () => {
30495
- onRemove();
30496
- closeFileViewer();
30497
- } : void 0
30498
- }));
30499
- }, [disabled, onRemove, openImageViewer, resolvedFile]);
30500
- const rightSlotContent = React.useMemo(
30501
- () => /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
30502
- /* @__PURE__ */ jsxRuntime.jsx(
30503
- blocks.IconButton,
30504
- {
30505
- "aria-label": `Download ${name}`,
30506
- type: "button",
30507
- onClick: handleDownload,
30508
- disabled: !resolvedFile,
30509
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "download" })
30510
- }
30511
- ),
30512
- !disabled && /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" }) })
30513
- ] }),
30514
- [disabled, handleDelete, handleDownload, name, resolvedFile]
30515
- );
30516
- return url ? /* @__PURE__ */ jsxRuntime.jsx(
30517
- ImageCard,
30518
- {
30519
- className: "cursor-pointer",
30520
- onClick: handleImageCardClick,
30521
- file: resolvedFile,
30522
- error: error ?? void 0,
30523
- rightSlot: rightSlotContent
30524
- }
30525
- ) : /* @__PURE__ */ jsxRuntime.jsx(FileCard, { file: resolvedFile, error: error ?? void 0, rightSlot: rightSlotContent });
30526
- });
30527
- DisplayFile.displayName = "DisplayFile";
30528
31643
  const _UploadField = class _UploadField extends BaseField {
30529
31644
  constructor(options) {
30530
31645
  const { extensions, maximum_files, maximum_size, ...base } = options;
@@ -30604,7 +31719,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30604
31719
  const maxFileSizeInB = maxFileSizeInMB * 1e3 * 1e3;
30605
31720
  const maxFiles = this.maxFiles || 1;
30606
31721
  validators.push((value) => {
30607
- if (value && value.some((file) => file instanceof File && file.size > maxFileSizeInB)) {
31722
+ if (value && value.some((file) => file instanceof UUIDFile && file.size > maxFileSizeInB)) {
30608
31723
  return `Files must be at most ${maxFileSizeInMB}MB.`;
30609
31724
  }
30610
31725
  });
@@ -30661,16 +31776,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30661
31776
  }
30662
31777
  isValueValid(value) {
30663
31778
  if (!Array.isArray(value)) return false;
30664
- return value.every((item) => item instanceof UUIDPromise || item instanceof File);
31779
+ return value.every((item) => item instanceof UUIDPromise || item instanceof UUIDFile);
30665
31780
  }
30666
31781
  areValuesEqual(value1, value2) {
30667
- const [files1, promises1] = separateFilesFromPromises(value1);
30668
- const [files2, promises2] = separateFilesFromPromises(value2);
30669
- if (!files1.every((file1) => files2.some((file2) => areFilesEqual(file1, file2)))) return false;
30670
- if (!files2.every((file2) => files1.some((file1) => areFilesEqual(file1, file2)))) return false;
30671
- if (!promises1.every((promise1) => promises2.some((promise2) => promise1.uuid === promise2.uuid))) return false;
30672
- if (!promises2.every((promise2) => promises1.some((promise1) => promise1.uuid === promise2.uuid))) return false;
30673
- return true;
31782
+ return areFileAndPromiseArraysEqual(value1, value2);
30674
31783
  }
30675
31784
  blankValue() {
30676
31785
  return [];
@@ -30692,23 +31801,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30692
31801
  "multi-select": MultiSelectField,
30693
31802
  radio: RadioField,
30694
31803
  "checkbox-list": CheckboxListField,
30695
- otp: OTPField
31804
+ "pass-fail": PassFailField,
31805
+ otp: OTPField,
31806
+ rating: RatingField
30696
31807
  };
30697
31808
  const fieldIcons = {
30698
- boolean: "square-check",
30699
- date: "calendar",
30700
- "multi-string": "list",
30701
- number: "hash",
30702
- qr: "scan",
30703
- "multi-select": "list-checks",
30704
- select: "list-todo",
30705
- string: "text-cursor-input",
30706
- text: "align-justify",
30707
- upload: "upload",
30708
- section: "layout-panel-top",
30709
- radio: "circle-dot",
30710
- "checkbox-list": "copy-check",
30711
- 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
30712
31825
  };
30713
31826
  const maxFileSizeMB = 50;
30714
31827
  const maxFileSizeKB = maxFileSizeMB * 1e3;
@@ -30915,6 +32028,42 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
30915
32028
  serialize: (filterValue) => filterValue,
30916
32029
  deserialize: (filterValue) => filterValue
30917
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
+ });
30918
32067
  const StringEqualsConditionModifier = ConditionModifier.create({
30919
32068
  id: "nullable-string-equals",
30920
32069
  modifierFn: (value, filterValue) => {
@@ -31054,9 +32203,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31054
32203
  __publicField(this, "apply", (value) => {
31055
32204
  const modifier = this.modifiers[this.conditionModifier];
31056
32205
  const conditionValue = this.getConditionValue();
31057
- if (conditionValue === void 0 || !modifier.isConditionValueValid(conditionValue)) return true;
31058
- if (!modifier.isValueValid(value)) return false;
31059
- 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);
31060
32211
  });
31061
32212
  this.id = id;
31062
32213
  this.field = field;
@@ -31072,6 +32223,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31072
32223
  conditionModifier: this.conditionModifier
31073
32224
  };
31074
32225
  }
32226
+ transformValue(value) {
32227
+ return value;
32228
+ }
31075
32229
  }
31076
32230
  const formId = "form-builder";
31077
32231
  const UNLABELLED_FIELD_LABEL = "Unlabelled";
@@ -31084,12 +32238,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31084
32238
  if (typeof children === "function") {
31085
32239
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31086
32240
  children(meta),
31087
- /* @__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 }) })
31088
32242
  ] });
31089
32243
  } else {
31090
32244
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31091
32245
  children,
31092
- /* @__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 }) })
31093
32247
  ] });
31094
32248
  }
31095
32249
  },
@@ -31104,12 +32258,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31104
32258
  if (typeof children === "function") {
31105
32259
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31106
32260
  children(meta),
31107
- /* @__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 }) })
31108
32262
  ] });
31109
32263
  } else {
31110
32264
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31111
32265
  children,
31112
- /* @__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 }) })
31113
32267
  ] });
31114
32268
  }
31115
32269
  },
@@ -31124,12 +32278,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31124
32278
  if (typeof children === "function") {
31125
32279
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31126
32280
  children(meta),
31127
- /* @__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 }) })
31128
32282
  ] });
31129
32283
  } else {
31130
32284
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
31131
32285
  children,
31132
- /* @__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 }) })
31133
32287
  ] });
31134
32288
  }
31135
32289
  },
@@ -31223,7 +32377,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31223
32377
  variant: "soft",
31224
32378
  type: "button",
31225
32379
  onClick: handleAddValueClick,
31226
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" })
32380
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus })
31227
32381
  }
31228
32382
  )
31229
32383
  ] }),
@@ -31246,7 +32400,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31246
32400
  onClick: () => {
31247
32401
  handleRemoveValueClick(index);
31248
32402
  },
31249
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" })
32403
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X })
31250
32404
  }
31251
32405
  )
31252
32406
  ]
@@ -31306,7 +32460,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31306
32460
  const handleRemoveFilter = React.useCallback(() => {
31307
32461
  onClick(condition);
31308
32462
  }, [condition, onClick]);
31309
- 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 }) });
31310
32464
  };
31311
32465
  RemoveConditionButton.displayName = "RemoveConditionButton";
31312
32466
  const SelectFieldOptionMultiSelectGroup = React.memo((props) => {
@@ -31421,7 +32575,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31421
32575
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31422
32576
  ] });
31423
32577
  };
31424
- const modifiers$c = {
32578
+ const modifiers$e = {
31425
32579
  equals: createConditionModifierConfig({
31426
32580
  modifier: BooleanEqualsConditionModifier,
31427
32581
  isValueValid: (_value) => true,
@@ -31438,13 +32592,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31438
32592
  class BooleanFieldCondition extends BaseCondition {
31439
32593
  constructor(options) {
31440
32594
  super(options);
31441
- __publicField(this, "defaultConditionModifier", "equals");
31442
- __publicField(this, "defaultConditionValue");
31443
- __publicField(this, "modifiers", modifiers$c);
32595
+ __publicField(this, "modifiers", modifiers$e);
31444
32596
  }
31445
32597
  static deserialize(serializedCondition, field) {
31446
32598
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31447
- const modifierConfig = modifiers$c[conditionModifier];
32599
+ const modifierConfig = modifiers$e[conditionModifier];
31448
32600
  let deserializedValue = void 0;
31449
32601
  if (conditionValue !== void 0) {
31450
32602
  deserializedValue = modifierConfig.modifier.deserialize(conditionValue);
@@ -31500,7 +32652,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31500
32652
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31501
32653
  ] });
31502
32654
  };
31503
- const modifiers$b = {
32655
+ const modifiers$d = {
31504
32656
  equals: createConditionModifierConfig({
31505
32657
  modifier: StringArrayEqualsConditionModifier,
31506
32658
  isValueValid: (_value) => true,
@@ -31535,13 +32687,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31535
32687
  class CheckboxListFieldCondition extends BaseCondition {
31536
32688
  constructor(options) {
31537
32689
  super(options);
31538
- __publicField(this, "defaultConditionModifier", "equals");
31539
- __publicField(this, "defaultConditionValue");
31540
- __publicField(this, "modifiers", modifiers$b);
32690
+ __publicField(this, "modifiers", modifiers$d);
31541
32691
  }
31542
32692
  static deserialize(serializedCondition, field) {
31543
32693
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31544
- const modifierConfig = modifiers$b[conditionModifier];
32694
+ const modifierConfig = modifiers$d[conditionModifier];
31545
32695
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
31546
32696
  return new CheckboxListFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
31547
32697
  }
@@ -31616,7 +32766,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31616
32766
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31617
32767
  ] });
31618
32768
  };
31619
- const modifiers$a = {
32769
+ const modifiers$c = {
31620
32770
  equals: createConditionModifierConfig({
31621
32771
  modifier: DateEqualsConditionModifier,
31622
32772
  isValueValid: (value) => value instanceof Date,
@@ -31657,13 +32807,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31657
32807
  class DateFieldCondition extends BaseCondition {
31658
32808
  constructor(options) {
31659
32809
  super(options);
31660
- __publicField(this, "defaultConditionModifier", "equals");
31661
- __publicField(this, "defaultConditionValue");
31662
- __publicField(this, "modifiers", modifiers$a);
32810
+ __publicField(this, "modifiers", modifiers$c);
31663
32811
  }
31664
32812
  static deserialize(serializedCondition, field) {
31665
32813
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31666
- const modifierConfig = modifiers$a[conditionModifier];
32814
+ const modifierConfig = modifiers$c[conditionModifier];
31667
32815
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
31668
32816
  // @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
31669
32817
  modifierConfig.modifier.deserialize(conditionValue)
@@ -31719,7 +32867,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31719
32867
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31720
32868
  ] });
31721
32869
  };
31722
- const modifiers$9 = {
32870
+ const modifiers$b = {
31723
32871
  equals: createConditionModifierConfig({
31724
32872
  modifier: StringArrayEqualsConditionModifier,
31725
32873
  isValueValid: (_value) => true,
@@ -31754,13 +32902,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31754
32902
  class MultiSelectFieldCondition extends BaseCondition {
31755
32903
  constructor(options) {
31756
32904
  super(options);
31757
- __publicField(this, "defaultConditionValue");
31758
- __publicField(this, "defaultConditionModifier", "equals");
31759
- __publicField(this, "modifiers", modifiers$9);
32905
+ __publicField(this, "modifiers", modifiers$b);
31760
32906
  }
31761
32907
  static deserialize(serializedCondition, field) {
31762
32908
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31763
- const modifierConfig = modifiers$9[conditionModifier];
32909
+ const modifierConfig = modifiers$b[conditionModifier];
31764
32910
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
31765
32911
  return new MultiSelectFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
31766
32912
  }
@@ -31804,7 +32950,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31804
32950
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31805
32951
  ] });
31806
32952
  };
31807
- const modifiers$8 = {
32953
+ const modifiers$a = {
31808
32954
  equals: createConditionModifierConfig({
31809
32955
  modifier: StringArrayEqualsConditionModifier,
31810
32956
  isValueValid: (_value) => true,
@@ -31839,13 +32985,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31839
32985
  class MultiStringFieldCondition extends BaseCondition {
31840
32986
  constructor(options) {
31841
32987
  super(options);
31842
- __publicField(this, "defaultConditionValue");
31843
- __publicField(this, "defaultConditionModifier", "equals");
31844
- __publicField(this, "modifiers", modifiers$8);
32988
+ __publicField(this, "modifiers", modifiers$a);
31845
32989
  }
31846
32990
  static deserialize(serializedCondition, field) {
31847
32991
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31848
- const modifierConfig = modifiers$8[conditionModifier];
32992
+ const modifierConfig = modifiers$a[conditionModifier];
31849
32993
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
31850
32994
  return new MultiStringFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
31851
32995
  }
@@ -31924,7 +33068,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31924
33068
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
31925
33069
  ] });
31926
33070
  };
31927
- const modifiers$7 = {
33071
+ const modifiers$9 = {
31928
33072
  equals: createConditionModifierConfig({
31929
33073
  modifier: NumberEqualsConditionModifier,
31930
33074
  isValueValid: (value) => typeof value === "number",
@@ -31977,13 +33121,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
31977
33121
  class NumberFieldCondition extends BaseCondition {
31978
33122
  constructor(options) {
31979
33123
  super(options);
31980
- __publicField(this, "defaultConditionValue");
31981
- __publicField(this, "defaultConditionModifier", "equals");
31982
- __publicField(this, "modifiers", modifiers$7);
33124
+ __publicField(this, "modifiers", modifiers$9);
31983
33125
  }
31984
33126
  static deserialize(serializedCondition, field) {
31985
33127
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
31986
- const modifierConfig = modifiers$7[conditionModifier];
33128
+ const modifierConfig = modifiers$9[conditionModifier];
31987
33129
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
31988
33130
  // @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
31989
33131
  modifierConfig.modifier.deserialize(conditionValue)
@@ -32027,7 +33169,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32027
33169
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
32028
33170
  ] });
32029
33171
  };
32030
- const modifiers$6 = {
33172
+ const modifiers$8 = {
32031
33173
  equals: createConditionModifierConfig({
32032
33174
  modifier: StringEqualsConditionModifier,
32033
33175
  isValueValid: (_value) => true,
@@ -32056,13 +33198,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32056
33198
  class OTPFieldCondition extends BaseCondition {
32057
33199
  constructor(options) {
32058
33200
  super(options);
32059
- __publicField(this, "defaultConditionValue");
32060
- __publicField(this, "defaultConditionModifier", "equals");
32061
- __publicField(this, "modifiers", modifiers$6);
33201
+ __publicField(this, "modifiers", modifiers$8);
32062
33202
  }
32063
33203
  static deserialize(serializedCondition, field) {
32064
33204
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
32065
- const modifierConfig = modifiers$6[conditionModifier];
33205
+ const modifierConfig = modifiers$8[conditionModifier];
32066
33206
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
32067
33207
  return new OTPFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
32068
33208
  }
@@ -32070,6 +33210,117 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32070
33210
  return /* @__PURE__ */ jsxRuntime.jsx(OTPFieldConditionCell, { condition: this, ...props }, this.id);
32071
33211
  }
32072
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
+ }
32073
33324
  const RadioFieldConditionCell = (props) => {
32074
33325
  const { condition, onRemove } = props;
32075
33326
  const field = condition.field;
@@ -32090,16 +33341,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32090
33341
  }
32091
33342
  return mapping;
32092
33343
  }, [normalizedOptions]);
32093
- const handleValuesChange = React.useCallback(
32094
- (values) => {
32095
- if (values.length > 0) {
32096
- condition.setConditionValue(values);
32097
- } else {
32098
- condition.setConditionValue([]);
32099
- }
32100
- },
32101
- [condition]
32102
- );
32103
33344
  const getFilterValueUi = () => {
32104
33345
  switch (conditionModifier) {
32105
33346
  case "equals":
@@ -32129,8 +33370,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32129
33370
  SelectFieldOptionMultiSelectGroup,
32130
33371
  {
32131
33372
  selectFieldOptions: field.options,
32132
- values: includesModifierFilterValue ?? [],
32133
- onValuesChange: handleValuesChange
33373
+ values: includesModifierFilterValue ?? EMPTY_ARRAY,
33374
+ onValuesChange: condition.setConditionValue
32134
33375
  }
32135
33376
  ) })
32136
33377
  ] });
@@ -32147,7 +33388,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32147
33388
  /* @__PURE__ */ jsxRuntime.jsx(RemoveConditionButton, { condition, onClick: onRemove })
32148
33389
  ] });
32149
33390
  };
32150
- const modifiers$5 = {
33391
+ const modifiers$6 = {
32151
33392
  equals: createConditionModifierConfig({
32152
33393
  modifier: StringEqualsConditionModifier,
32153
33394
  isValueValid: (value) => typeof value === "string",
@@ -32176,13 +33417,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32176
33417
  class RadioFieldCondition extends BaseCondition {
32177
33418
  constructor(options) {
32178
33419
  super(options);
32179
- __publicField(this, "defaultConditionValue");
32180
- __publicField(this, "defaultConditionModifier", "equals");
32181
- __publicField(this, "modifiers", modifiers$5);
33420
+ __publicField(this, "modifiers", modifiers$6);
32182
33421
  }
32183
33422
  static deserialize(serializedCondition, field) {
32184
33423
  const { conditionValue, conditionModifier, ...rest } = serializedCondition;
32185
- const modifierConfig = modifiers$5[conditionModifier];
33424
+ const modifierConfig = modifiers$6[conditionModifier];
32186
33425
  const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
32187
33426
  // @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
32188
33427
  modifierConfig.modifier.deserialize(conditionValue)
@@ -32193,6 +33432,146 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32193
33432
  return /* @__PURE__ */ jsxRuntime.jsx(RadioFieldConditionCell, { condition: this, ...props }, this.id);
32194
33433
  }
32195
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
+ }
32196
33575
  const ScanFieldConditionCell = (props) => {
32197
33576
  const { condition, onRemove } = props;
32198
33577
  const field = condition.field;
@@ -32255,8 +33634,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32255
33634
  class ScanFieldCondition extends BaseCondition {
32256
33635
  constructor(options) {
32257
33636
  super(options);
32258
- __publicField(this, "defaultConditionValue");
32259
- __publicField(this, "defaultConditionModifier", "equals");
32260
33637
  __publicField(this, "modifiers", modifiers$4);
32261
33638
  }
32262
33639
  static deserialize(serializedCondition, field) {
@@ -32375,8 +33752,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32375
33752
  class SelectFieldCondition extends BaseCondition {
32376
33753
  constructor(options) {
32377
33754
  super(options);
32378
- __publicField(this, "defaultConditionValue");
32379
- __publicField(this, "defaultConditionModifier", "equals");
32380
33755
  __publicField(this, "modifiers", modifiers$3);
32381
33756
  }
32382
33757
  static deserialize(serializedCondition, field) {
@@ -32454,8 +33829,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32454
33829
  class StringFieldCondition extends BaseCondition {
32455
33830
  constructor(options) {
32456
33831
  super(options);
32457
- __publicField(this, "defaultConditionValue");
32458
- __publicField(this, "defaultConditionModifier", "equals");
32459
33832
  __publicField(this, "modifiers", modifiers$2);
32460
33833
  }
32461
33834
  static deserialize(serializedCondition, field) {
@@ -32530,8 +33903,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32530
33903
  class TextFieldCondition extends BaseCondition {
32531
33904
  constructor(options) {
32532
33905
  super(options);
32533
- __publicField(this, "defaultConditionValue");
32534
- __publicField(this, "defaultConditionModifier", "equals");
32535
33906
  __publicField(this, "modifiers", modifiers$1);
32536
33907
  }
32537
33908
  static deserialize(serializedCondition, field) {
@@ -32602,8 +33973,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32602
33973
  class UploadFieldCondition extends BaseCondition {
32603
33974
  constructor(options) {
32604
33975
  super(options);
32605
- __publicField(this, "defaultConditionValue");
32606
- __publicField(this, "defaultConditionModifier", "equals");
32607
33976
  __publicField(this, "modifiers", modifiers);
32608
33977
  }
32609
33978
  static deserialize(serializedCondition, field) {
@@ -32616,43 +33985,35 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32616
33985
  return /* @__PURE__ */ jsxRuntime.jsx(UploadFieldConditionCell, { condition: this, ...props }, this.id);
32617
33986
  }
32618
33987
  }
32619
- const deserializeCondition = (serializedCondition, field) => {
32620
- switch (serializedCondition.type) {
32621
- case "text":
32622
- return TextFieldCondition.deserialize(serializedCondition, field);
32623
- case "boolean":
32624
- return BooleanFieldCondition.deserialize(serializedCondition, field);
32625
- case "number":
32626
- return NumberFieldCondition.deserialize(serializedCondition, field);
32627
- case "date":
32628
- return DateFieldCondition.deserialize(serializedCondition, field);
32629
- case "string":
32630
- return StringFieldCondition.deserialize(serializedCondition, field);
32631
- case "select":
32632
- return SelectFieldCondition.deserialize(serializedCondition, field);
32633
- case "multi-string":
32634
- return MultiStringFieldCondition.deserialize(serializedCondition, field);
32635
- case "multi-select":
32636
- return MultiSelectFieldCondition.deserialize(serializedCondition, field);
32637
- case "upload":
32638
- return UploadFieldCondition.deserialize(serializedCondition, field);
32639
- case "qr":
32640
- return ScanFieldCondition.deserialize(serializedCondition, field);
32641
- case "radio":
32642
- return RadioFieldCondition.deserialize(serializedCondition, field);
32643
- case "checkbox-list":
32644
- return CheckboxListFieldCondition.deserialize(serializedCondition, field);
32645
- case "otp":
32646
- return OTPFieldCondition.deserialize(serializedCondition, field);
32647
- }
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
32648
34004
  };
32649
- 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) => {
32650
34011
  const fieldsMapping = {};
32651
34012
  for (const field of fields) {
32652
34013
  fieldsMapping[field.identifier] = field;
32653
34014
  }
32654
34015
  return serializedConditions.map(
32655
- (serializedCondition) => deserializeCondition(serializedCondition, fieldsMapping[serializedCondition.fieldId])
34016
+ (serializedCondition) => deserializeCondition(fieldsMapping[serializedCondition.fieldId], serializedCondition)
32656
34017
  );
32657
34018
  };
32658
34019
  const applyConditions = (conditions, values) => {
@@ -32660,35 +34021,53 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32660
34021
  return condition.apply(values[condition.field.identifier]);
32661
34022
  }) : true;
32662
34023
  };
32663
- const deserializeField = (serializedField) => {
32664
- switch (serializedField.type) {
32665
- case "boolean":
32666
- return BooleanField.deserialize(serializedField);
32667
- case "text":
32668
- return TextField.deserialize(serializedField);
32669
- case "number":
32670
- return NumberField.deserialize(serializedField);
32671
- case "date":
32672
- return DateField.deserialize(serializedField);
32673
- case "select":
32674
- return SelectField.deserialize(serializedField);
32675
- case "multi-string":
32676
- return MultiStringField.deserialize(serializedField);
32677
- case "multi-select":
32678
- return MultiSelectField.deserialize(serializedField);
32679
- case "upload":
32680
- return UploadField.deserialize(serializedField);
32681
- case "qr":
32682
- return ScanField.deserialize(serializedField);
32683
- case "radio":
32684
- return RadioField.deserialize(serializedField);
32685
- case "checkbox-list":
32686
- return CheckboxListField.deserialize(serializedField);
32687
- case "string":
32688
- return StringField.deserialize(serializedField);
32689
- case "otp":
32690
- 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);
32691
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);
32692
34071
  };
32693
34072
  function deserializeFields(fields) {
32694
34073
  return fields.map(deserialize);
@@ -32763,6 +34142,85 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32763
34142
  }
32764
34143
  return ret;
32765
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
+ };
32766
34224
  const RendererContext = React.createContext({});
32767
34225
  const FieldSectionLayout = React.memo((props) => {
32768
34226
  const { fieldSection: section, ...rest } = props;
@@ -32843,7 +34301,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32843
34301
  const fields = data.fields.map(deserializeField);
32844
34302
  const conditions = {};
32845
34303
  for (const [sectionId, serializedConditions] of Object.entries(data.conditions)) {
32846
- conditions[sectionId] = deserializeConditions(serializedConditions, fields);
34304
+ conditions[sectionId] = deserializeConditions(fields, serializedConditions);
32847
34305
  }
32848
34306
  return new _FieldSection({ ...data, fields, conditions });
32849
34307
  }
@@ -32884,12 +34342,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32884
34342
  getFields() {
32885
34343
  return this.fields;
32886
34344
  }
32887
- addField(field) {
32888
- this.fields = this.initFields([...this.fields, field]);
32889
- this.notify(this);
32890
- }
32891
- addFields(fields) {
32892
- 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);
32893
34349
  this.notify(this);
32894
34350
  }
32895
34351
  moveField(sourceIndex, targetIndex) {
@@ -32908,16 +34364,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32908
34364
  this.conditions = newConditions;
32909
34365
  this.notify(this);
32910
34366
  }
32911
- removeFields(fields) {
32912
- const fieldIdentifiers = new Set(fields.map(({ identifier }) => identifier));
32913
- this.fields = this.initFields(this.fields.filter(({ identifier }) => !fieldIdentifiers.has(identifier)));
32914
- const newConditions = {};
32915
- for (const [sectionId, conditions] of Object.entries(this.conditions)) {
32916
- newConditions[sectionId] = conditions.filter(({ field }) => !fieldIdentifiers.has(field.identifier));
32917
- }
32918
- this.conditions = newConditions;
32919
- this.notify(this);
32920
- }
32921
34367
  getConditions(identifier) {
32922
34368
  return this.conditions[identifier];
32923
34369
  }
@@ -32997,27 +34443,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
32997
34443
  getFieldSections() {
32998
34444
  return this.fieldSections;
32999
34445
  }
33000
- addFieldSection(field) {
33001
- this.fieldSections = this.initFields([...this.fieldSections, field]);
33002
- this.notify(this);
33003
- }
33004
- addFieldSections(fields) {
33005
- this.fieldSections = this.initFields([...this.fieldSections, ...fields]);
34446
+ addFieldSection(fieldSection, index) {
34447
+ const copy = [...this.fieldSections];
34448
+ copy.splice(index ?? this.fieldSections.length, 0, fieldSection);
34449
+ this.fieldSections = this.initFields(copy);
33006
34450
  this.notify(this);
33007
34451
  }
33008
- removeFieldSection(field) {
33009
- const newFields = this.fieldSections.filter((f) => f.identifier !== field.identifier);
33010
- for (const field2 of newFields) {
33011
- 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);
33012
34456
  }
33013
34457
  this.fieldSections = this.initFields(newFields);
33014
34458
  this.notify(this);
33015
34459
  }
33016
- removeFieldSections(fields) {
33017
- const fieldsIds = new Set(fields.map((f) => f.identifier));
33018
- this.fieldSections = this.initFields(this.fieldSections.filter((f) => !fieldsIds.has(f.identifier)));
33019
- this.notify(this);
33020
- }
33021
34460
  moveFieldSection(sourceIndex, targetIndex) {
33022
34461
  const newFields = [...this.fieldSections];
33023
34462
  const [removedElement] = newFields.splice(sourceIndex, 1);
@@ -33031,44 +34470,70 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33031
34470
  serializeValues(values) {
33032
34471
  return serializeFieldValues(this.getFields(), values);
33033
34472
  }
34473
+ deserializeConditions(conditions) {
34474
+ return deserializeConditions(this.getFields(), conditions);
34475
+ }
34476
+ initializeValues(values) {
34477
+ return initializeFieldValues(this.getFields(), values);
34478
+ }
33034
34479
  }
33035
34480
  const FieldSchemaContext = React.createContext(new FieldSchema([]));
33036
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";
33037
34507
  const createField = (type) => {
33038
34508
  switch (type) {
33039
34509
  case "text":
33040
- return new TextField({ fieldValidators: [], label: "", required: false, identifier: uuid.v4() });
34510
+ return new TextField({ label: "", required: false, identifier: uuid.v4() });
33041
34511
  case "boolean":
33042
34512
  return new BooleanField({
33043
- fieldValidators: [],
33044
34513
  label: "",
33045
34514
  required: false,
33046
34515
  identifier: uuid.v4()
33047
34516
  });
33048
34517
  case "number":
33049
34518
  return new NumberField({
33050
- fieldValidators: [],
33051
34519
  label: "",
33052
34520
  required: false,
33053
34521
  identifier: uuid.v4()
33054
34522
  });
33055
34523
  case "date":
33056
34524
  return new DateField({
33057
- fieldValidators: [],
33058
34525
  label: "",
33059
34526
  required: false,
33060
34527
  identifier: uuid.v4()
33061
34528
  });
33062
34529
  case "string":
33063
34530
  return new StringField({
33064
- fieldValidators: [],
33065
34531
  label: "",
33066
34532
  required: false,
33067
34533
  identifier: uuid.v4()
33068
34534
  });
33069
34535
  case "select":
33070
34536
  return new SelectField({
33071
- fieldValidators: [],
33072
34537
  label: "",
33073
34538
  options: [],
33074
34539
  required: false,
@@ -33076,14 +34541,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33076
34541
  });
33077
34542
  case "multi-string":
33078
34543
  return new MultiStringField({
33079
- fieldValidators: [],
33080
34544
  label: "",
33081
34545
  required: false,
33082
34546
  identifier: uuid.v4()
33083
34547
  });
33084
34548
  case "multi-select":
33085
34549
  return new MultiSelectField({
33086
- fieldValidators: [],
33087
34550
  label: "",
33088
34551
  options: [],
33089
34552
  required: false,
@@ -33091,21 +34554,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33091
34554
  });
33092
34555
  case "upload":
33093
34556
  return new UploadField({
33094
- fieldValidators: [],
33095
34557
  label: "",
33096
34558
  required: false,
33097
- identifier: uuid.v4()
34559
+ identifier: uuid.v4(),
34560
+ maximum_files: 6,
34561
+ maximum_size: maxFileSizeMB
33098
34562
  });
33099
34563
  case "qr":
33100
34564
  return new ScanField({
33101
- fieldValidators: [],
33102
34565
  label: "",
33103
34566
  required: false,
33104
34567
  identifier: uuid.v4()
33105
34568
  });
33106
34569
  case "radio":
33107
34570
  return new RadioField({
33108
- fieldValidators: [],
33109
34571
  label: "",
33110
34572
  options: [],
33111
34573
  required: false,
@@ -33113,21 +34575,34 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33113
34575
  });
33114
34576
  case "checkbox-list":
33115
34577
  return new CheckboxListField({
33116
- fieldValidators: [],
33117
34578
  label: "",
33118
34579
  options: [],
33119
34580
  required: false,
33120
34581
  identifier: uuid.v4()
33121
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
+ });
33122
34591
  case "otp":
33123
34592
  return new OTPField({
33124
- fieldValidators: [],
33125
34593
  label: "",
33126
34594
  validationType: "none",
33127
34595
  required: false,
33128
34596
  identifier: uuid.v4(),
33129
34597
  length: 6
33130
34598
  });
34599
+ case "rating":
34600
+ return new RatingField({
34601
+ label: "",
34602
+ required: false,
34603
+ identifier: uuid.v4(),
34604
+ maxRating: 5
34605
+ });
33131
34606
  }
33132
34607
  };
33133
34608
  const createCondition = (field) => {
@@ -33211,6 +34686,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33211
34686
  conditionModifier: "equals",
33212
34687
  field
33213
34688
  });
34689
+ case "pass-fail":
34690
+ return new PassFailFieldCondition({
34691
+ id: uuid.v4(),
34692
+ conditionValue: void 0,
34693
+ conditionModifier: "equals",
34694
+ field
34695
+ });
33214
34696
  case "otp":
33215
34697
  return new OTPFieldCondition({
33216
34698
  id: uuid.v4(),
@@ -33218,6 +34700,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33218
34700
  conditionModifier: "equals",
33219
34701
  field
33220
34702
  });
34703
+ case "rating":
34704
+ return new RatingFieldCondition({
34705
+ id: uuid.v4(),
34706
+ conditionValue: void 0,
34707
+ conditionModifier: "equals",
34708
+ field
34709
+ });
33221
34710
  }
33222
34711
  };
33223
34712
  const getFieldCreationSchema = (type, path) => {
@@ -33238,8 +34727,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33238
34727
  return TextField.getFieldCreationSchema(path);
33239
34728
  case "upload":
33240
34729
  return UploadField.getFieldCreationSchema(path);
34730
+ case "pass-fail":
34731
+ return PassFailField.getFieldCreationSchema(path);
33241
34732
  case "otp":
33242
34733
  return OTPField.getFieldCreationSchema(path);
34734
+ case "rating":
34735
+ return RatingField.getFieldCreationSchema(path);
33243
34736
  default:
33244
34737
  return;
33245
34738
  }
@@ -33257,7 +34750,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33257
34750
  accentColor: "base",
33258
34751
  ...hasError && { color: SEVERITY_COLOR_MAPPING.danger },
33259
34752
  children: [
33260
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "settings" }),
34753
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Settings }),
33261
34754
  "Settings"
33262
34755
  ]
33263
34756
  },
@@ -33268,7 +34761,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33268
34761
  });
33269
34762
  FieldSettingsPopover.displayName = "FieldSettingsPopover";
33270
34763
  const FieldBuilder = React.memo((props) => {
33271
- const { parentPath, index, field } = props;
34764
+ const { parentPath, fieldIndex, field } = props;
33272
34765
  const { errors } = formik.useFormikContext();
33273
34766
  const openImageViewer = useImageViewer();
33274
34767
  const { disableRequiredFields } = React.use(FormBuilderContext);
@@ -33284,17 +34777,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33284
34777
  const handleImageDelete = React.useCallback(() => {
33285
34778
  field.setOptions({ image: void 0 });
33286
34779
  }, [field]);
33287
- const type = field.type;
33288
34780
  const [directlyShownFields, popoverFields] = React.useMemo(() => {
33289
34781
  const directlyShownFields2 = [];
33290
34782
  const popoverFields2 = [];
33291
- const fieldObject = getFieldCreationSchema(field.type, `${parentPath}.${index}`) ?? [];
34783
+ const fieldObject = getFieldCreationSchema(field.type, `${parentPath}.${fieldIndex}`) ?? [];
33292
34784
  for (const item of fieldObject) {
33293
34785
  if (item.showDirectly) directlyShownFields2.push(item.field);
33294
34786
  else popoverFields2.push(item.field);
33295
34787
  }
33296
34788
  return [directlyShownFields2, popoverFields2];
33297
- }, [field, parentPath, index]);
34789
+ }, [field, parentPath, fieldIndex]);
33298
34790
  const directlyShownInputs = useFieldInputs(directlyShownFields, {
33299
34791
  formId,
33300
34792
  disabled: false
@@ -33319,7 +34811,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33319
34811
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 w-full justify-between", children: [
33320
34812
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 items-center", children: [
33321
34813
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Badge, { accentColor: "base", variant: "soft", size: "sm", children: [
33322
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[type] }),
34814
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[field.type] }),
33323
34815
  fieldTypeName
33324
34816
  ] }),
33325
34817
  !disableRequiredFields && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -33329,7 +34821,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33329
34821
  checked: field.required,
33330
34822
  onCheckedChange: (required) => field.setOptions({ required: !!required }),
33331
34823
  size: "sm",
33332
- 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 }) })
33333
34825
  }
33334
34826
  ),
33335
34827
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", children: "Required" })
@@ -33357,7 +34849,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33357
34849
  "aria-label": "delete",
33358
34850
  onClick: handleImageDelete,
33359
34851
  size: "sm",
33360
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" })
34852
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash })
33361
34853
  }
33362
34854
  )
33363
34855
  ] }),
@@ -33388,46 +34880,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33388
34880
  ] });
33389
34881
  });
33390
34882
  FieldBuilder.displayName = "FieldBuilder";
33391
- const FieldDropdownMenu = React.memo((props) => {
33392
- const { children, variant, size, accentColor, fields, onSelectField, ...rest } = props;
33393
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { ...rest, children: [
33394
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children }),
33395
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { variant, size, accentColor, children: fields.map((field) => {
33396
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: () => onSelectField(field), children: [
33397
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[field.type] }),
33398
- field.label || UNLABELLED_FIELD_LABEL
33399
- ] }, field.identifier);
33400
- }) })
33401
- ] });
33402
- });
33403
- FieldDropdownMenu.displayName = "IssueDataFilterMenu";
33404
- const FieldSectionDropdownMenu = React.memo((props) => {
33405
- const { children, variant, size, accentColor, fieldSections, onSelectFieldCondition, ...rest } = props;
33406
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { ...rest, children: [
33407
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children }),
33408
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.Content, { variant, size, accentColor, children: fieldSections.map((fieldSection) => {
33409
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Item, { onSelect: () => onSelectFieldCondition(fieldSection), children: [
33410
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[fieldSection.type] }),
33411
- fieldSection.label || UNLABELLED_SECTION_LABEL
33412
- ] }, fieldSection.identifier);
33413
- }) })
33414
- ] });
33415
- });
33416
- FieldSectionDropdownMenu.displayName = "IssueDataFilterMenu";
33417
- const FieldWithActions = React.memo((props) => {
33418
- const { field, fieldSection, index, sectionIndex, remove } = props;
34883
+ const FieldBuilderWithActions = React.memo((props) => {
34884
+ const { field, fieldSection, fieldIndex, sectionIndex } = props;
33419
34885
  const { showError } = blocks.useToast();
33420
34886
  const fileInputRef = React.useRef(null);
33421
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
+ );
33422
34894
  const duplicateField = React.useCallback(() => {
33423
34895
  fieldSection.addField(field.duplicate(uuid.v4()));
33424
34896
  }, [field, fieldSection]);
33425
34897
  const moveField = React.useCallback(
33426
34898
  (direction) => {
33427
34899
  const targetIndex = direction === "up" ? sectionIndex - 1 : sectionIndex + 1;
33428
- fieldSection.moveField(index, targetIndex);
34900
+ fieldSection.moveField(fieldIndex, targetIndex);
33429
34901
  },
33430
- [fieldSection, index, sectionIndex]
34902
+ [fieldSection, fieldIndex, sectionIndex]
33431
34903
  );
33432
34904
  const uploadImage = React.useCallback(
33433
34905
  (event) => {
@@ -33459,21 +34931,48 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33459
34931
  (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
33460
34932
  }, []);
33461
34933
  const handleRemove = React.useCallback(() => {
33462
- remove(field);
33463
- }, [field, remove]);
34934
+ fieldSection.removeField(field);
34935
+ }, [field, fieldSection]);
33464
34936
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Card, { className: "flex items-center justify-between gap-4 w-full", children: [
33465
- /* @__PURE__ */ jsxRuntime.jsx(FieldBuilder, { index, field, parentPath }),
34937
+ /* @__PURE__ */ jsxRuntime.jsx(FieldBuilder, { fieldIndex, field, parentPath }),
33466
34938
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex-col gap-0.5 flex", variant: "ghost", accentColor: "base", size: "sm", children: [
33467
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "move-up" }) }),
33468
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "move-down" }) }),
33469
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: duplicateField, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "copy" }) }),
33470
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleUploadImage, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "image" }) }),
33471
- /* @__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 }) })
33472
34945
  ] }),
33473
34946
  /* @__PURE__ */ jsxRuntime.jsx("input", { className: "hidden", ref: fileInputRef, type: "file", accept: "image/*", onChange: uploadImage })
33474
34947
  ] });
33475
34948
  });
33476
- 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";
33477
34976
  const FieldSectionConditionEdgeComponent = React.memo((props) => {
33478
34977
  const { id, sourceX, sourceY, targetX, targetY, style, markerEnd, data } = props;
33479
34978
  const { targetSection, sourceSection, layoutDirection } = data;
@@ -33527,7 +35026,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33527
35026
  variant: "surface",
33528
35027
  size: "xs",
33529
35028
  accentColor: "base",
33530
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" })
35029
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus })
33531
35030
  }
33532
35031
  ) }),
33533
35032
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Tooltip.Root, { children: [
@@ -33541,7 +35040,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33541
35040
  accentColor: "base",
33542
35041
  color: "danger",
33543
35042
  onClick: handleDelete,
33544
- children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "trash" })
35043
+ children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Trash })
33545
35044
  }
33546
35045
  ) }),
33547
35046
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Tooltip.Content, { size: "sm", children: "Remove conditional logic" })
@@ -33557,27 +35056,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33557
35056
  ] });
33558
35057
  });
33559
35058
  FieldSectionConditionEdgeComponent.displayName = "FieldSectionConditionEdgeComponent";
33560
- const useFieldTypeItems = (onSelect = () => null) => {
33561
- return React.useMemo(() => {
33562
- const entries = Object.entries(FieldTypeToClsMapping);
33563
- return entries.map(([type, fieldClass]) => ({
33564
- children: fieldClass.fieldTypeName,
33565
- icon: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons[type] }),
33566
- value: type,
33567
- onSelect: () => {
33568
- onSelect(type);
33569
- }
33570
- }));
33571
- }, [onSelect]);
33572
- };
33573
35059
  const FieldSectionNodeComponent = React.memo((props) => {
33574
35060
  const { data, selected } = props;
33575
35061
  const { fieldSection, index: sectionIndex, layoutDirection } = data;
33576
35062
  const fieldSchema = React.use(FieldSchemaContext);
33577
- const removeSection = React.useCallback(() => {
35063
+ const handleRemoveSection = React.useCallback(() => {
33578
35064
  fieldSchema.removeFieldSection(fieldSection);
33579
35065
  }, [fieldSchema, fieldSection]);
33580
- const addField = React.useCallback(
35066
+ const handleAddField = React.useCallback(
33581
35067
  (type) => {
33582
35068
  fieldSection.addField(createField(type));
33583
35069
  },
@@ -33591,13 +35077,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33591
35077
  const handleDuplicate = React.useCallback(() => {
33592
35078
  fieldSchema.addFieldSection(fieldSection.duplicate(uuid.v4()));
33593
35079
  }, [fieldSchema, fieldSection]);
33594
- const fieldTypeItems = useFieldTypeItems(addField);
33595
- const removeField = React.useCallback(
33596
- (field) => {
33597
- fieldSection.removeField(field);
33598
- },
33599
- [fieldSection]
33600
- );
33601
35080
  return /* @__PURE__ */ jsxRuntime.jsxs(
33602
35081
  blocks.Card,
33603
35082
  {
@@ -33631,25 +35110,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33631
35110
  ] }),
33632
35111
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
33633
35112
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { weight: "bold", children: "Fields" }),
33634
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { children: [
33635
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
33636
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
33637
- " Add field"
33638
- ] }) }),
33639
- /* @__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: [
33640
- item.icon,
33641
- item.children
33642
- ] }, item.value)) }) })
33643
- ] })
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
+ ] }) })
33644
35117
  ] }),
33645
35118
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: fieldSection.fields.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(
33646
- FieldWithActions,
35119
+ FieldBuilderWithActions,
33647
35120
  {
33648
35121
  field: child,
33649
35122
  fieldSection,
33650
- index,
33651
- sectionIndex,
33652
- remove: removeField
35123
+ fieldIndex: index,
35124
+ sectionIndex
33653
35125
  },
33654
35126
  child.identifier
33655
35127
  )) })
@@ -33670,9 +35142,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33670
35142
  size: "xs",
33671
35143
  onClick: (e) => e.stopPropagation(),
33672
35144
  children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex flex-col gap-2", variant: "surface", size: "xs", accentColor: "base", children: [
33673
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleAddBranch, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "git-branch" }) }),
33674
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleDuplicate, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "copy" }) }),
33675
- /* @__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 }) })
33676
35148
  ] })
33677
35149
  }
33678
35150
  )
@@ -33889,7 +35361,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33889
35361
  }
33890
35362
  ),
33891
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: [
33892
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
35364
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }),
33893
35365
  " Add section"
33894
35366
  ] }) }) }),
33895
35367
  /* @__PURE__ */ jsxRuntime.jsxs(react.Panel, { position: "top-right", className: "flex flex-col items-center gap-2", children: [
@@ -33903,16 +35375,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33903
35375
  value: layoutDirection,
33904
35376
  onValueChange: setLayoutDirection,
33905
35377
  children: [
33906
- /* @__PURE__ */ jsxRuntime.jsx(blocks.ToggleGroup.IconItem, { className: "rounded-b-none", value: "LR", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "arrow-right-left" }) }),
33907
- /* @__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 }) })
33908
35380
  ]
33909
35381
  }
33910
35382
  ),
33911
35383
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Separator, { size: "sm" }),
33912
35384
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex flex-col ", size: "sm", accentColor: "base", variant: "soft", children: [
33913
- /* @__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" }) }),
33914
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { onClick: () => reactFlow == null ? void 0 : reactFlow.zoomOut(), radius: "none", type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "minus" }) }),
33915
- /* @__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 }) })
33916
35388
  ] })
33917
35389
  ] }),
33918
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: [
@@ -33950,7 +35422,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33950
35422
  /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: fieldIcons.section }),
33951
35423
  sourceFieldSection.label ?? UNLABELLED_SECTION_LABEL
33952
35424
  ] }),
33953
- /* @__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 }) })
33954
35426
  ] }),
33955
35427
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-max w-full flex-wrap gap-2", children: [
33956
35428
  conditions.map((condition) => {
@@ -33958,7 +35430,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
33958
35430
  onRemove: handleDeleteCondition
33959
35431
  });
33960
35432
  }),
33961
- /* @__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 }) }) })
33962
35434
  ] })
33963
35435
  ] });
33964
35436
  });
@@ -34020,7 +35492,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34020
35492
  fieldSections: validFieldSections,
34021
35493
  onSelectFieldCondition: handleAddConditional,
34022
35494
  children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", size: "sm", className: "w-max", children: [
34023
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
35495
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }),
34024
35496
  "Add condition"
34025
35497
  ] })
34026
35498
  }
@@ -34040,15 +35512,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34040
35512
  });
34041
35513
  FieldSectionBuilder.displayName = "FieldSectionBuilder";
34042
35514
  const FieldSectionWithActions = React.memo((props) => {
34043
- const { fieldSection, index: sectionIndex } = props;
35515
+ const { fieldSection, sectionIndex } = props;
34044
35516
  const fieldSchema = React.use(FieldSchemaContext);
34045
- const removeField = React.useCallback(
34046
- (field) => {
34047
- fieldSection.removeField(field);
34048
- },
34049
- [fieldSection]
34050
- );
34051
- const removeSection = React.useCallback(() => {
35517
+ const handleRemoveSection = React.useCallback(() => {
34052
35518
  fieldSchema.removeFieldSection(fieldSection);
34053
35519
  }, [fieldSchema, fieldSection]);
34054
35520
  const moveSection = React.useCallback(
@@ -34061,7 +35527,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34061
35527
  const duplicateSection = React.useCallback(() => {
34062
35528
  fieldSchema.addFieldSection(fieldSection.duplicate(uuid.v4()));
34063
35529
  }, [fieldSchema, fieldSection]);
34064
- const handleCreateField = React.useCallback(
35530
+ const handleAddField = React.useCallback(
34065
35531
  (type) => {
34066
35532
  fieldSection.addField(createField(type));
34067
35533
  },
@@ -34073,42 +35539,34 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34073
35539
  const handleMoveDown = React.useCallback(() => {
34074
35540
  moveSection("down");
34075
35541
  }, [moveSection]);
34076
- const fieldTypeItems = useFieldTypeItems(handleCreateField);
34077
35542
  return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Card, { variant: "outline", className: "flex items-center justify-between gap-4 w-full", children: [
34078
35543
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-4 w-full", children: [
34079
35544
  /* @__PURE__ */ jsxRuntime.jsx(FieldSectionBuilder, { fieldSection }),
34080
35545
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 w-full", children: [
34081
35546
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 justify-between", children: [
34082
35547
  /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { accentColor: "base", size: "md", children: "Fields" }),
34083
- /* @__PURE__ */ jsxRuntime.jsxs(blocks.Menu.Root, { children: [
34084
- /* @__PURE__ */ jsxRuntime.jsx(blocks.Menu.ClickTrigger, { children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", size: "sm", children: [
34085
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
34086
- " Add field"
34087
- ] }) }),
34088
- /* @__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: [
34089
- item.icon,
34090
- item.children
34091
- ] }, item.value)) }) })
34092
- ] })
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
+ ] }) })
34093
35552
  ] }),
34094
35553
  fieldSection.fields.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(
34095
- FieldWithActions,
35554
+ FieldBuilderWithActions,
34096
35555
  {
34097
35556
  field: child,
34098
35557
  fieldSection,
34099
- index,
34100
- sectionIndex,
34101
- remove: removeField
35558
+ fieldIndex: index,
35559
+ sectionIndex
34102
35560
  },
34103
35561
  child.identifier
34104
35562
  ))
34105
35563
  ] })
34106
35564
  ] }),
34107
35565
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.ButtonGroup, { className: "flex-col gap-0.5 flex", variant: "ghost", accentColor: "base", size: "sm", children: [
34108
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "move-up" }) }),
34109
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "move-down" }) }),
34110
- /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { type: "button", onClick: duplicateSection, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "copy" }) }),
34111
- /* @__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 }) })
34112
35570
  ] })
34113
35571
  ] });
34114
35572
  });
@@ -34157,7 +35615,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34157
35615
  }
34158
35616
  ),
34159
35617
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
34160
- 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
+ )),
34161
35626
  /* @__PURE__ */ jsxRuntime.jsxs(
34162
35627
  blocks.Button,
34163
35628
  {
@@ -34168,7 +35633,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34168
35633
  size: "sm",
34169
35634
  onClick: handleCreateEmptySection,
34170
35635
  children: [
34171
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "plus" }),
35636
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Plus }),
34172
35637
  " Add section"
34173
35638
  ]
34174
35639
  }
@@ -34204,53 +35669,28 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34204
35669
  }
34205
35670
  if (Object.keys(errors).length > 0) return errors;
34206
35671
  };
34207
- const initializeFieldValues = (fields, values) => {
34208
- const ret = {};
34209
- for (const field of fields) {
34210
- const value = values[field.identifier];
34211
- ret[field.identifier] = value !== void 0 ? value : field.blankValue();
34212
- }
34213
- return ret;
34214
- };
34215
- const changedFieldValues = (fields, values1, values2) => {
34216
- const ret = {};
34217
- for (const field of fields) {
34218
- const value1 = values1[field.identifier];
34219
- const value2 = values2[field.identifier];
34220
- if (field.areValuesEqual(value1, value2)) continue;
34221
- ret[field.identifier] = value2;
34222
- }
34223
- return ret;
34224
- };
34225
- const unchangedFieldValues = (fields, values1, values2) => {
34226
- const ret = {};
35672
+ const cleanFields = (fields, values) => {
35673
+ const errors = {};
35674
+ const sectionElements = fields.filter((f) => f instanceof FieldSection);
34227
35675
  for (const field of fields) {
34228
- const value1 = values1[field.identifier];
34229
- const value2 = values2[field.identifier];
34230
- if (!field.areValuesEqual(value1, value2)) continue;
34231
- 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
+ }
34232
35690
  }
34233
- return ret;
34234
- };
34235
- const isArrayOfFiles = (value) => {
34236
- return Array.isArray(value) && value[0] instanceof File;
34237
- };
34238
- const separateFilesFromFieldValues = (values) => {
34239
- const files = {};
34240
- const newValues = {};
34241
- for (const key in values) {
34242
- const value = values[key];
34243
- if (value instanceof File) {
34244
- files[key] = [value];
34245
- } else if (isArrayOfFiles(value)) {
34246
- files[key] = value;
34247
- } else if (value !== void 0) {
34248
- newValues[key] = value;
34249
- }
34250
- }
34251
- return { values: newValues, files };
35691
+ if (Object.keys(errors).length > 0) return errors;
34252
35692
  };
34253
- const separateFilesFromFields = async (fields) => {
35693
+ const separateImagesFromFields = async (fields) => {
34254
35694
  const images = {};
34255
35695
  const newFields = [];
34256
35696
  for (const section of fields) {
@@ -34278,16 +35718,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34278
35718
  }
34279
35719
  return { fields: newFields, images };
34280
35720
  };
34281
- async function awaitPromisesFromFieldValues(values) {
34282
- const valuesWithoutFiles = {};
35721
+ async function awaitFilesAndPromises(values) {
35722
+ const ret = {};
34283
35723
  for (const [key, value] of Object.entries(values)) {
34284
- if (Array.isArray(value) && value.some((item) => item instanceof UUIDPromise)) {
34285
- valuesWithoutFiles[key] = await Promise.all(value);
34286
- } else {
34287
- valuesWithoutFiles[key] = value;
34288
- }
35724
+ ret[key] = await Promise.all(value);
34289
35725
  }
34290
- return valuesWithoutFiles;
35726
+ return ret;
34291
35727
  }
34292
35728
  const FormRenderer = React.memo(
34293
35729
  React.forwardRef((props, ref) => {
@@ -34383,13 +35819,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34383
35819
  variant: "soft",
34384
35820
  onClick: onCancel,
34385
35821
  children: [
34386
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }),
35822
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: X }),
34387
35823
  cancelText
34388
35824
  ]
34389
35825
  }
34390
35826
  ),
34391
35827
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { ...buttonProps, type: "submit", accentColor: "primary", variant: "surface", children: [
34392
- /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }),
35828
+ /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: Check }),
34393
35829
  submitText
34394
35830
  ] })
34395
35831
  ] })
@@ -34509,33 +35945,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34509
35945
  ListBuilder: FormBuilderListBuilder,
34510
35946
  Preview: FormBuilderPreview
34511
35947
  };
34512
- const ScannerContext = React.createContext(() => {
34513
- throw new Error("No ScannerProvider found");
34514
- });
34515
- const useScanner = () => React.use(ScannerContext);
34516
- const ScannerProvider = React.memo((props) => {
34517
- const { children } = props;
34518
- const [config, setConfig] = React.useState(null);
34519
- const closeFileViewer = React.useCallback(() => {
34520
- setConfig(null);
34521
- }, []);
34522
- const openFileViewer = React.useCallback(
34523
- (func) => {
34524
- setConfig(func(closeFileViewer));
34525
- },
34526
- [closeFileViewer]
34527
- );
34528
- const handleClose = React.useCallback(() => {
34529
- if (!config) return;
34530
- if (config.onClose) config.onClose();
34531
- closeFileViewer();
34532
- }, [closeFileViewer, config]);
34533
- return /* @__PURE__ */ jsxRuntime.jsxs(ScannerContext.Provider, { value: openFileViewer, children: [
34534
- children,
34535
- config && /* @__PURE__ */ jsxRuntime.jsx(Scanner, { open: true, onOpenChange: handleClose, ...config })
34536
- ] });
34537
- });
34538
- ScannerProvider.displayName = "FileViewerProvider";
34539
35948
  exports2.BaseCondition = BaseCondition;
34540
35949
  exports2.BaseField = BaseField;
34541
35950
  exports2.BaseFormElement = BaseFormElement;
@@ -34551,6 +35960,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34551
35960
  exports2.CheckboxListFieldCondition = CheckboxListFieldCondition;
34552
35961
  exports2.CheckboxListFieldConditionCell = CheckboxListFieldConditionCell;
34553
35962
  exports2.CheckboxListInput = CheckboxListInput;
35963
+ exports2.ConditionManager = ConditionManager;
34554
35964
  exports2.DateAfterConditionModifier = DateAfterConditionModifier;
34555
35965
  exports2.DateBeforeConditionModifier = DateBeforeConditionModifier;
34556
35966
  exports2.DateEqualsConditionModifier = DateEqualsConditionModifier;
@@ -34601,10 +36011,23 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34601
36011
  exports2.OTPFieldCondition = OTPFieldCondition;
34602
36012
  exports2.OTPFieldConditionCell = OTPFieldConditionCell;
34603
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;
34604
36023
  exports2.RadioField = RadioField;
34605
36024
  exports2.RadioFieldCondition = RadioFieldCondition;
34606
36025
  exports2.RadioFieldConditionCell = RadioFieldConditionCell;
34607
36026
  exports2.RadioInput = RadioInput;
36027
+ exports2.RatingField = RatingField;
36028
+ exports2.RatingFieldCondition = RatingFieldCondition;
36029
+ exports2.RatingFieldConditionCell = RatingFieldConditionCell;
36030
+ exports2.RatingInput = RatingInput;
34608
36031
  exports2.SEVERITY_COLOR_MAPPING = SEVERITY_COLOR_MAPPING;
34609
36032
  exports2.SHORT_TEXT_FIELD_MAX_LENGTH = SHORT_TEXT_FIELD_MAX_LENGTH;
34610
36033
  exports2.ScanField = ScanField;
@@ -34636,15 +36059,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34636
36059
  exports2.TextFieldCondition = TextFieldCondition;
34637
36060
  exports2.TextFieldConditionCell = TextFieldConditionCell;
34638
36061
  exports2.TextInput = TextInput;
36062
+ exports2.UUIDFile = UUIDFile;
34639
36063
  exports2.UUIDPromise = UUIDPromise;
34640
36064
  exports2.UploadField = UploadField;
34641
36065
  exports2.UploadFieldCondition = UploadFieldCondition;
34642
36066
  exports2.UploadFieldConditionCell = UploadFieldConditionCell;
34643
36067
  exports2.UploadInput = UploadInput;
34644
36068
  exports2.applyConditions = applyConditions;
34645
- exports2.awaitPromisesFromFieldValues = awaitPromisesFromFieldValues;
36069
+ exports2.areFileAndPromiseArraysEqual = areFileAndPromiseArraysEqual;
36070
+ exports2.arePassFieldValuesEqual = arePassFieldValuesEqual;
36071
+ exports2.awaitFilesAndPromises = awaitFilesAndPromises;
34646
36072
  exports2.changedFieldValues = changedFieldValues;
34647
36073
  exports2.cleanFieldValues = cleanFieldValues;
36074
+ exports2.cleanFields = cleanFields;
34648
36075
  exports2.cleanSerializedFieldValues = cleanSerializedFieldValues;
34649
36076
  exports2.createCondition = createCondition;
34650
36077
  exports2.createConditionModifierConfig = createConditionModifierConfig;
@@ -34656,18 +36083,28 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
34656
36083
  exports2.deserializeFieldValues = deserializeFieldValues;
34657
36084
  exports2.deserializeFields = deserializeFields;
34658
36085
  exports2.deserializeOnlyFields = deserializeOnlyFields;
36086
+ exports2.deserializePassFailFieldValue = deserializePassFailFieldValue;
36087
+ exports2.extractFilesAndPromisesFromFieldValues = extractFilesAndPromisesFromFieldValues;
34659
36088
  exports2.fieldIcons = fieldIcons;
34660
36089
  exports2.flattenFields = flattenFields;
34661
36090
  exports2.getFieldsMapping = getFieldsMapping;
34662
36091
  exports2.initializeFieldValues = initializeFieldValues;
36092
+ exports2.insertFilesAndPromisesToFieldValues = insertFilesAndPromisesToFieldValues;
36093
+ exports2.isFileAndPromiseArray = isFileAndPromiseArray;
36094
+ exports2.isPassFailFieldStatus = isPassFailFieldStatus;
36095
+ exports2.isPassFailFieldValue = isPassFailFieldValue;
36096
+ exports2.isSerializedPassFailFieldValue = isSerializedPassFailFieldValue;
34663
36097
  exports2.isStringArray = isStringArray;
34664
36098
  exports2.maxFileSizeB = maxFileSizeB;
34665
36099
  exports2.maxFileSizeKB = maxFileSizeKB;
34666
36100
  exports2.maxFileSizeMB = maxFileSizeMB;
34667
- exports2.separateFilesFromFieldValues = separateFilesFromFieldValues;
34668
- exports2.separateFilesFromFields = separateFilesFromFields;
36101
+ exports2.passFailFieldStatusMapping = passFailFieldStatusMapping;
36102
+ exports2.passFailFieldStatuses = passFailFieldStatuses;
36103
+ exports2.separateImagesFromFields = separateImagesFromFields;
34669
36104
  exports2.serializeFieldValues = serializeFieldValues;
36105
+ exports2.serializePassFailFieldValue = serializePassFailFieldValue;
34670
36106
  exports2.unchangedFieldValues = unchangedFieldValues;
36107
+ exports2.useConditionManager = useConditionManager;
34671
36108
  exports2.useFieldInput = useFieldInput;
34672
36109
  exports2.useFieldInputs = useFieldInputs;
34673
36110
  exports2.useFormikInput = useFormikInput;