hazo_collab_forms 1.9.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (394) hide show
  1. package/CHANGE_LOG.md +49 -0
  2. package/README.md +416 -0
  3. package/dist/components/_internal_form_set.d.ts +41 -0
  4. package/dist/components/_internal_form_set.d.ts.map +1 -1
  5. package/dist/components/_internal_form_set.js +81 -3
  6. package/dist/components/_internal_form_set.js.map +1 -1
  7. package/dist/components/clarification/clarification_badge.d.ts +16 -0
  8. package/dist/components/clarification/clarification_badge.d.ts.map +1 -0
  9. package/dist/components/clarification/clarification_badge.js +15 -0
  10. package/dist/components/clarification/clarification_badge.js.map +1 -0
  11. package/dist/components/clarification/clarification_card.d.ts +48 -0
  12. package/dist/components/clarification/clarification_card.d.ts.map +1 -0
  13. package/dist/components/clarification/clarification_card.js +46 -0
  14. package/dist/components/clarification/clarification_card.js.map +1 -0
  15. package/dist/components/clarification/clarification_dialog.d.ts +32 -0
  16. package/dist/components/clarification/clarification_dialog.d.ts.map +1 -0
  17. package/dist/components/clarification/clarification_dialog.js +63 -0
  18. package/dist/components/clarification/clarification_dialog.js.map +1 -0
  19. package/dist/components/clarification/clarification_doc_reference.d.ts +18 -0
  20. package/dist/components/clarification/clarification_doc_reference.d.ts.map +1 -0
  21. package/dist/components/clarification/clarification_doc_reference.js +22 -0
  22. package/dist/components/clarification/clarification_doc_reference.js.map +1 -0
  23. package/dist/components/clarification/clarification_response_form.d.ts +32 -0
  24. package/dist/components/clarification/clarification_response_form.d.ts.map +1 -0
  25. package/dist/components/clarification/clarification_response_form.js +38 -0
  26. package/dist/components/clarification/clarification_response_form.js.map +1 -0
  27. package/dist/components/clarification/clarification_section.d.ts +26 -0
  28. package/dist/components/clarification/clarification_section.d.ts.map +1 -0
  29. package/dist/components/clarification/clarification_section.js +46 -0
  30. package/dist/components/clarification/clarification_section.js.map +1 -0
  31. package/dist/components/clarification/index.d.ts +18 -0
  32. package/dist/components/clarification/index.d.ts.map +1 -0
  33. package/dist/components/clarification/index.js +13 -0
  34. package/dist/components/clarification/index.js.map +1 -0
  35. package/dist/components/clarification/use_clarifications.d.ts +49 -0
  36. package/dist/components/clarification/use_clarifications.d.ts.map +1 -0
  37. package/dist/components/clarification/use_clarifications.js +160 -0
  38. package/dist/components/clarification/use_clarifications.js.map +1 -0
  39. package/dist/components/collab_form_file_upload.d.ts +16 -1
  40. package/dist/components/collab_form_file_upload.d.ts.map +1 -1
  41. package/dist/components/collab_form_file_upload.js +44 -10
  42. package/dist/components/collab_form_file_upload.js.map +1 -1
  43. package/dist/components/hazo_add_field_dialog/types.d.ts.map +1 -1
  44. package/dist/components/hazo_add_field_dialog/types.js +28 -0
  45. package/dist/components/hazo_add_field_dialog/types.js.map +1 -1
  46. package/dist/components/hazo_collab_form_base.d.ts +32 -2
  47. package/dist/components/hazo_collab_form_base.d.ts.map +1 -1
  48. package/dist/components/hazo_collab_form_base.js +11 -5
  49. package/dist/components/hazo_collab_form_base.js.map +1 -1
  50. package/dist/components/hazo_collab_form_computed.d.ts +33 -0
  51. package/dist/components/hazo_collab_form_computed.d.ts.map +1 -0
  52. package/dist/components/hazo_collab_form_computed.js +42 -0
  53. package/dist/components/hazo_collab_form_computed.js.map +1 -0
  54. package/dist/components/hazo_collab_form_currency.d.ts +29 -0
  55. package/dist/components/hazo_collab_form_currency.d.ts.map +1 -0
  56. package/dist/components/hazo_collab_form_currency.js +42 -0
  57. package/dist/components/hazo_collab_form_currency.js.map +1 -0
  58. package/dist/components/hazo_collab_form_data_table.d.ts +1 -1
  59. package/dist/components/hazo_collab_form_data_table.d.ts.map +1 -1
  60. package/dist/components/hazo_collab_form_data_table.js +7 -3
  61. package/dist/components/hazo_collab_form_data_table.js.map +1 -1
  62. package/dist/components/hazo_collab_form_group.d.ts +12 -0
  63. package/dist/components/hazo_collab_form_group.d.ts.map +1 -1
  64. package/dist/components/hazo_collab_form_group.js +27 -4
  65. package/dist/components/hazo_collab_form_group.js.map +1 -1
  66. package/dist/components/hazo_collab_form_masked.d.ts +32 -0
  67. package/dist/components/hazo_collab_form_masked.d.ts.map +1 -0
  68. package/dist/components/hazo_collab_form_masked.js +55 -0
  69. package/dist/components/hazo_collab_form_masked.js.map +1 -0
  70. package/dist/components/hazo_collab_form_percentage.d.ts +27 -0
  71. package/dist/components/hazo_collab_form_percentage.d.ts.map +1 -0
  72. package/dist/components/hazo_collab_form_percentage.js +41 -0
  73. package/dist/components/hazo_collab_form_percentage.js.map +1 -0
  74. package/dist/components/hazo_collab_form_static_text.d.ts +26 -0
  75. package/dist/components/hazo_collab_form_static_text.d.ts.map +1 -0
  76. package/dist/components/hazo_collab_form_static_text.js +24 -0
  77. package/dist/components/hazo_collab_form_static_text.js.map +1 -0
  78. package/dist/components/hazo_collab_form_summary_row.d.ts +41 -0
  79. package/dist/components/hazo_collab_form_summary_row.d.ts.map +1 -0
  80. package/dist/components/hazo_collab_form_summary_row.js +35 -0
  81. package/dist/components/hazo_collab_form_summary_row.js.map +1 -0
  82. package/dist/components/hazo_collab_form_view/context.d.ts.map +1 -1
  83. package/dist/components/hazo_collab_form_view/context.js +25 -1
  84. package/dist/components/hazo_collab_form_view/context.js.map +1 -1
  85. package/dist/components/hazo_collab_form_view/index.d.ts +1 -1
  86. package/dist/components/hazo_collab_form_view/index.d.ts.map +1 -1
  87. package/dist/components/hazo_collab_form_view/index.js +8 -0
  88. package/dist/components/hazo_collab_form_view/index.js.map +1 -1
  89. package/dist/components/hazo_collab_form_view/types.d.ts +167 -2
  90. package/dist/components/hazo_collab_form_view/types.d.ts.map +1 -1
  91. package/dist/components/hazo_collab_form_view/views/edit_view.d.ts.map +1 -1
  92. package/dist/components/hazo_collab_form_view/views/edit_view.js +76 -8
  93. package/dist/components/hazo_collab_form_view/views/edit_view.js.map +1 -1
  94. package/dist/components/hazo_collab_form_view/views/summary_view.d.ts.map +1 -1
  95. package/dist/components/hazo_collab_form_view/views/summary_view.js +237 -14
  96. package/dist/components/hazo_collab_form_view/views/summary_view.js.map +1 -1
  97. package/dist/components/hazo_data_form/field_renderers/boolean_field.d.ts +6 -0
  98. package/dist/components/hazo_data_form/field_renderers/boolean_field.d.ts.map +1 -0
  99. package/dist/components/hazo_data_form/field_renderers/boolean_field.js +9 -0
  100. package/dist/components/hazo_data_form/field_renderers/boolean_field.js.map +1 -0
  101. package/dist/components/hazo_data_form/field_renderers/computed_field.d.ts +7 -0
  102. package/dist/components/hazo_data_form/field_renderers/computed_field.d.ts.map +1 -0
  103. package/dist/components/hazo_data_form/field_renderers/computed_field.js +34 -0
  104. package/dist/components/hazo_data_form/field_renderers/computed_field.js.map +1 -0
  105. package/dist/components/hazo_data_form/field_renderers/currency_field.d.ts +7 -0
  106. package/dist/components/hazo_data_form/field_renderers/currency_field.d.ts.map +1 -0
  107. package/dist/components/hazo_data_form/field_renderers/currency_field.js +30 -0
  108. package/dist/components/hazo_data_form/field_renderers/currency_field.js.map +1 -0
  109. package/dist/components/hazo_data_form/field_renderers/date_field.d.ts +7 -0
  110. package/dist/components/hazo_data_form/field_renderers/date_field.d.ts.map +1 -0
  111. package/dist/components/hazo_data_form/field_renderers/date_field.js +17 -0
  112. package/dist/components/hazo_data_form/field_renderers/date_field.js.map +1 -0
  113. package/dist/components/hazo_data_form/field_renderers/email_field.d.ts +6 -0
  114. package/dist/components/hazo_data_form/field_renderers/email_field.d.ts.map +1 -0
  115. package/dist/components/hazo_data_form/field_renderers/email_field.js +12 -0
  116. package/dist/components/hazo_data_form/field_renderers/email_field.js.map +1 -0
  117. package/dist/components/hazo_data_form/field_renderers/index.d.ts +50 -0
  118. package/dist/components/hazo_data_form/field_renderers/index.d.ts.map +1 -0
  119. package/dist/components/hazo_data_form/field_renderers/index.js +95 -0
  120. package/dist/components/hazo_data_form/field_renderers/index.js.map +1 -0
  121. package/dist/components/hazo_data_form/field_renderers/masked_field.d.ts +7 -0
  122. package/dist/components/hazo_data_form/field_renderers/masked_field.d.ts.map +1 -0
  123. package/dist/components/hazo_data_form/field_renderers/masked_field.js +56 -0
  124. package/dist/components/hazo_data_form/field_renderers/masked_field.js.map +1 -0
  125. package/dist/components/hazo_data_form/field_renderers/number_field.d.ts +6 -0
  126. package/dist/components/hazo_data_form/field_renderers/number_field.d.ts.map +1 -0
  127. package/dist/components/hazo_data_form/field_renderers/number_field.js +15 -0
  128. package/dist/components/hazo_data_form/field_renderers/number_field.js.map +1 -0
  129. package/dist/components/hazo_data_form/field_renderers/option_field.d.ts +6 -0
  130. package/dist/components/hazo_data_form/field_renderers/option_field.d.ts.map +1 -0
  131. package/dist/components/hazo_data_form/field_renderers/option_field.js +15 -0
  132. package/dist/components/hazo_data_form/field_renderers/option_field.js.map +1 -0
  133. package/dist/components/hazo_data_form/field_renderers/percentage_field.d.ts +7 -0
  134. package/dist/components/hazo_data_form/field_renderers/percentage_field.d.ts.map +1 -0
  135. package/dist/components/hazo_data_form/field_renderers/percentage_field.js +22 -0
  136. package/dist/components/hazo_data_form/field_renderers/percentage_field.js.map +1 -0
  137. package/dist/components/hazo_data_form/field_renderers/static_text_field.d.ts +7 -0
  138. package/dist/components/hazo_data_form/field_renderers/static_text_field.d.ts.map +1 -0
  139. package/dist/components/hazo_data_form/field_renderers/static_text_field.js +11 -0
  140. package/dist/components/hazo_data_form/field_renderers/static_text_field.js.map +1 -0
  141. package/dist/components/hazo_data_form/field_renderers/summary_row_field.d.ts +7 -0
  142. package/dist/components/hazo_data_form/field_renderers/summary_row_field.d.ts.map +1 -0
  143. package/dist/components/hazo_data_form/field_renderers/summary_row_field.js +20 -0
  144. package/dist/components/hazo_data_form/field_renderers/summary_row_field.js.map +1 -0
  145. package/dist/components/hazo_data_form/field_renderers/table_field.d.ts +7 -0
  146. package/dist/components/hazo_data_form/field_renderers/table_field.d.ts.map +1 -0
  147. package/dist/components/hazo_data_form/field_renderers/table_field.js +179 -0
  148. package/dist/components/hazo_data_form/field_renderers/table_field.js.map +1 -0
  149. package/dist/components/hazo_data_form/field_renderers/tel_field.d.ts +6 -0
  150. package/dist/components/hazo_data_form/field_renderers/tel_field.d.ts.map +1 -0
  151. package/dist/components/hazo_data_form/field_renderers/tel_field.js +12 -0
  152. package/dist/components/hazo_data_form/field_renderers/tel_field.js.map +1 -0
  153. package/dist/components/hazo_data_form/field_renderers/text_field.d.ts +6 -0
  154. package/dist/components/hazo_data_form/field_renderers/text_field.d.ts.map +1 -0
  155. package/dist/components/hazo_data_form/field_renderers/text_field.js +12 -0
  156. package/dist/components/hazo_data_form/field_renderers/text_field.js.map +1 -0
  157. package/dist/components/hazo_data_form/field_renderers/textarea_field.d.ts +6 -0
  158. package/dist/components/hazo_data_form/field_renderers/textarea_field.d.ts.map +1 -0
  159. package/dist/components/hazo_data_form/field_renderers/textarea_field.js +12 -0
  160. package/dist/components/hazo_data_form/field_renderers/textarea_field.js.map +1 -0
  161. package/dist/components/hazo_data_form/file_manager_button.d.ts +12 -0
  162. package/dist/components/hazo_data_form/file_manager_button.d.ts.map +1 -0
  163. package/dist/components/hazo_data_form/file_manager_button.js +9 -0
  164. package/dist/components/hazo_data_form/file_manager_button.js.map +1 -0
  165. package/dist/components/hazo_data_form/group_renderer.d.ts +20 -0
  166. package/dist/components/hazo_data_form/group_renderer.d.ts.map +1 -0
  167. package/dist/components/hazo_data_form/group_renderer.js +74 -0
  168. package/dist/components/hazo_data_form/group_renderer.js.map +1 -0
  169. package/dist/components/hazo_data_form/hazo_data_form.d.ts +10 -0
  170. package/dist/components/hazo_data_form/hazo_data_form.d.ts.map +1 -0
  171. package/dist/components/hazo_data_form/hazo_data_form.js +100 -0
  172. package/dist/components/hazo_data_form/hazo_data_form.js.map +1 -0
  173. package/dist/components/hazo_data_form/index.d.ts +15 -0
  174. package/dist/components/hazo_data_form/index.d.ts.map +1 -0
  175. package/dist/components/hazo_data_form/index.js +14 -0
  176. package/dist/components/hazo_data_form/index.js.map +1 -0
  177. package/dist/components/hazo_data_form/section_renderer.d.ts +24 -0
  178. package/dist/components/hazo_data_form/section_renderer.d.ts.map +1 -0
  179. package/dist/components/hazo_data_form/section_renderer.js +34 -0
  180. package/dist/components/hazo_data_form/section_renderer.js.map +1 -0
  181. package/dist/components/hazo_data_form/shared/data_form_badge.d.ts +13 -0
  182. package/dist/components/hazo_data_form/shared/data_form_badge.d.ts.map +1 -0
  183. package/dist/components/hazo_data_form/shared/data_form_badge.js +13 -0
  184. package/dist/components/hazo_data_form/shared/data_form_badge.js.map +1 -0
  185. package/dist/components/hazo_data_form/shared/data_form_field_layout.d.ts +17 -0
  186. package/dist/components/hazo_data_form/shared/data_form_field_layout.d.ts.map +1 -0
  187. package/dist/components/hazo_data_form/shared/data_form_field_layout.js +31 -0
  188. package/dist/components/hazo_data_form/shared/data_form_field_layout.js.map +1 -0
  189. package/dist/components/hazo_data_form/shared/data_form_file_column.d.ts +17 -0
  190. package/dist/components/hazo_data_form/shared/data_form_file_column.d.ts.map +1 -0
  191. package/dist/components/hazo_data_form/shared/data_form_file_column.js +46 -0
  192. package/dist/components/hazo_data_form/shared/data_form_file_column.js.map +1 -0
  193. package/dist/components/hazo_data_form/shared/data_form_help_tooltip.d.ts +15 -0
  194. package/dist/components/hazo_data_form/shared/data_form_help_tooltip.d.ts.map +1 -0
  195. package/dist/components/hazo_data_form/shared/data_form_help_tooltip.js +25 -0
  196. package/dist/components/hazo_data_form/shared/data_form_help_tooltip.js.map +1 -0
  197. package/dist/components/hazo_data_form/shared/data_form_label.d.ts +12 -0
  198. package/dist/components/hazo_data_form/shared/data_form_label.d.ts.map +1 -0
  199. package/dist/components/hazo_data_form/shared/data_form_label.js +18 -0
  200. package/dist/components/hazo_data_form/shared/data_form_label.js.map +1 -0
  201. package/dist/components/hazo_data_form/shared/data_form_reference_value.d.ts +10 -0
  202. package/dist/components/hazo_data_form/shared/data_form_reference_value.d.ts.map +1 -0
  203. package/dist/components/hazo_data_form/shared/data_form_reference_value.js +10 -0
  204. package/dist/components/hazo_data_form/shared/data_form_reference_value.js.map +1 -0
  205. package/dist/components/hazo_data_form/shared/index.d.ts +16 -0
  206. package/dist/components/hazo_data_form/shared/index.d.ts.map +1 -0
  207. package/dist/components/hazo_data_form/shared/index.js +10 -0
  208. package/dist/components/hazo_data_form/shared/index.js.map +1 -0
  209. package/dist/components/hazo_data_form/shared/types.d.ts +6 -0
  210. package/dist/components/hazo_data_form/shared/types.d.ts.map +1 -0
  211. package/dist/components/hazo_data_form/shared/types.js +5 -0
  212. package/dist/components/hazo_data_form/shared/types.js.map +1 -0
  213. package/dist/components/hazo_data_form/types.d.ts +110 -0
  214. package/dist/components/hazo_data_form/types.d.ts.map +1 -0
  215. package/dist/components/hazo_data_form/types.js +6 -0
  216. package/dist/components/hazo_data_form/types.js.map +1 -0
  217. package/dist/components/hazo_template_generator/components/type_editors/data_table_editor.d.ts.map +1 -1
  218. package/dist/components/hazo_template_generator/components/type_editors/data_table_editor.js +2 -0
  219. package/dist/components/hazo_template_generator/components/type_editors/data_table_editor.js.map +1 -1
  220. package/dist/components/hazo_template_generator/types.d.ts +2 -2
  221. package/dist/components/hazo_template_generator/types.d.ts.map +1 -1
  222. package/dist/components/hazo_template_generator/types.js +62 -0
  223. package/dist/components/hazo_template_generator/types.js.map +1 -1
  224. package/dist/components/hazo_validation_rule_editor/components/clarification_settings.d.ts +10 -0
  225. package/dist/components/hazo_validation_rule_editor/components/clarification_settings.d.ts.map +1 -0
  226. package/dist/components/hazo_validation_rule_editor/components/clarification_settings.js +57 -0
  227. package/dist/components/hazo_validation_rule_editor/components/clarification_settings.js.map +1 -0
  228. package/dist/components/hazo_validation_rule_editor/components/prompt_editor.d.ts +11 -0
  229. package/dist/components/hazo_validation_rule_editor/components/prompt_editor.d.ts.map +1 -0
  230. package/dist/components/hazo_validation_rule_editor/components/prompt_editor.js +145 -0
  231. package/dist/components/hazo_validation_rule_editor/components/prompt_editor.js.map +1 -0
  232. package/dist/components/hazo_validation_rule_editor/components/rule_editor.d.ts +6 -0
  233. package/dist/components/hazo_validation_rule_editor/components/rule_editor.d.ts.map +1 -0
  234. package/dist/components/hazo_validation_rule_editor/components/rule_editor.js +149 -0
  235. package/dist/components/hazo_validation_rule_editor/components/rule_editor.js.map +1 -0
  236. package/dist/components/hazo_validation_rule_editor/components/rule_list.d.ts +6 -0
  237. package/dist/components/hazo_validation_rule_editor/components/rule_list.d.ts.map +1 -0
  238. package/dist/components/hazo_validation_rule_editor/components/rule_list.js +57 -0
  239. package/dist/components/hazo_validation_rule_editor/components/rule_list.js.map +1 -0
  240. package/dist/components/hazo_validation_rule_editor/context.d.ts +19 -0
  241. package/dist/components/hazo_validation_rule_editor/context.d.ts.map +1 -0
  242. package/dist/components/hazo_validation_rule_editor/context.js +95 -0
  243. package/dist/components/hazo_validation_rule_editor/context.js.map +1 -0
  244. package/dist/components/hazo_validation_rule_editor/hooks/use_file_validation.d.ts +20 -0
  245. package/dist/components/hazo_validation_rule_editor/hooks/use_file_validation.d.ts.map +1 -0
  246. package/dist/components/hazo_validation_rule_editor/hooks/use_file_validation.js +127 -0
  247. package/dist/components/hazo_validation_rule_editor/hooks/use_file_validation.js.map +1 -0
  248. package/dist/components/hazo_validation_rule_editor/hooks/use_validation_rules.d.ts +30 -0
  249. package/dist/components/hazo_validation_rule_editor/hooks/use_validation_rules.d.ts.map +1 -0
  250. package/dist/components/hazo_validation_rule_editor/hooks/use_validation_rules.js +216 -0
  251. package/dist/components/hazo_validation_rule_editor/hooks/use_validation_rules.js.map +1 -0
  252. package/dist/components/hazo_validation_rule_editor/index.d.ts +14 -0
  253. package/dist/components/hazo_validation_rule_editor/index.d.ts.map +1 -0
  254. package/dist/components/hazo_validation_rule_editor/index.js +12 -0
  255. package/dist/components/hazo_validation_rule_editor/index.js.map +1 -0
  256. package/dist/components/hazo_validation_rule_editor/types.d.ts +53 -0
  257. package/dist/components/hazo_validation_rule_editor/types.d.ts.map +1 -0
  258. package/dist/components/hazo_validation_rule_editor/types.js +5 -0
  259. package/dist/components/hazo_validation_rule_editor/types.js.map +1 -0
  260. package/dist/components/hazo_validation_rule_editor/validation_rule_editor.d.ts +3 -0
  261. package/dist/components/hazo_validation_rule_editor/validation_rule_editor.d.ts.map +1 -0
  262. package/dist/components/hazo_validation_rule_editor/validation_rule_editor.js +14 -0
  263. package/dist/components/hazo_validation_rule_editor/validation_rule_editor.js.map +1 -0
  264. package/dist/components/index.d.ts +30 -2
  265. package/dist/components/index.d.ts.map +1 -1
  266. package/dist/components/index.js +22 -1
  267. package/dist/components/index.js.map +1 -1
  268. package/dist/components/shared/field_state/normalize.d.ts.map +1 -1
  269. package/dist/components/shared/field_state/normalize.js +1 -0
  270. package/dist/components/shared/field_state/normalize.js.map +1 -1
  271. package/dist/components/shared/field_state/types.d.ts +6 -0
  272. package/dist/components/shared/field_state/types.d.ts.map +1 -1
  273. package/dist/components/shared/field_utils/types.d.ts +1 -1
  274. package/dist/components/shared/field_utils/types.d.ts.map +1 -1
  275. package/dist/components/shared/strip_base_props.d.ts.map +1 -1
  276. package/dist/components/shared/strip_base_props.js +2 -0
  277. package/dist/components/shared/strip_base_props.js.map +1 -1
  278. package/dist/components/shared/summary_files/summary_files.d.ts +9 -1
  279. package/dist/components/shared/summary_files/summary_files.d.ts.map +1 -1
  280. package/dist/components/shared/summary_files/summary_files.js +11 -5
  281. package/dist/components/shared/summary_files/summary_files.js.map +1 -1
  282. package/dist/components/shared/unified_field_controls/types.d.ts +8 -0
  283. package/dist/components/shared/unified_field_controls/types.d.ts.map +1 -1
  284. package/dist/components/shared/unified_field_controls/unified_field_controls.d.ts +1 -1
  285. package/dist/components/shared/unified_field_controls/unified_field_controls.d.ts.map +1 -1
  286. package/dist/components/shared/unified_field_controls/unified_field_controls.js +3 -2
  287. package/dist/components/shared/unified_field_controls/unified_field_controls.js.map +1 -1
  288. package/dist/components/shared/use_base_form_field.d.ts +14 -0
  289. package/dist/components/shared/use_base_form_field.d.ts.map +1 -1
  290. package/dist/components/shared/use_base_form_field.js +41 -2
  291. package/dist/components/shared/use_base_form_field.js.map +1 -1
  292. package/dist/components/status_badges.d.ts +33 -0
  293. package/dist/components/status_badges.d.ts.map +1 -1
  294. package/dist/components/status_badges.js +27 -2
  295. package/dist/components/status_badges.js.map +1 -1
  296. package/dist/config/clarification_templates.d.ts +24 -0
  297. package/dist/config/clarification_templates.d.ts.map +1 -0
  298. package/dist/config/clarification_templates.js +66 -0
  299. package/dist/config/clarification_templates.js.map +1 -0
  300. package/dist/config/defaults.d.ts +4 -0
  301. package/dist/config/defaults.d.ts.map +1 -1
  302. package/dist/config/defaults.js +4 -0
  303. package/dist/config/defaults.js.map +1 -1
  304. package/dist/config/index.d.ts +3 -1
  305. package/dist/config/index.d.ts.map +1 -1
  306. package/dist/config/index.js +3 -1
  307. package/dist/config/index.js.map +1 -1
  308. package/dist/config/validation_rule_commands.d.ts +12 -0
  309. package/dist/config/validation_rule_commands.d.ts.map +1 -0
  310. package/dist/config/validation_rule_commands.js +106 -0
  311. package/dist/config/validation_rule_commands.js.map +1 -0
  312. package/dist/index.client.d.ts +1 -0
  313. package/dist/index.client.d.ts.map +1 -1
  314. package/dist/index.client.js +1 -0
  315. package/dist/index.client.js.map +1 -1
  316. package/dist/lib/autofill_handler.d.ts +34 -0
  317. package/dist/lib/autofill_handler.d.ts.map +1 -0
  318. package/dist/lib/autofill_handler.js +330 -0
  319. package/dist/lib/autofill_handler.js.map +1 -0
  320. package/dist/lib/index.d.ts +9 -0
  321. package/dist/lib/index.d.ts.map +1 -1
  322. package/dist/lib/index.js +5 -0
  323. package/dist/lib/index.js.map +1 -1
  324. package/dist/lib/validation_handler.d.ts +27 -0
  325. package/dist/lib/validation_handler.d.ts.map +1 -0
  326. package/dist/lib/validation_handler.js +341 -0
  327. package/dist/lib/validation_handler.js.map +1 -0
  328. package/dist/types/clarification.d.ts +126 -0
  329. package/dist/types/clarification.d.ts.map +1 -0
  330. package/dist/types/clarification.js +8 -0
  331. package/dist/types/clarification.js.map +1 -0
  332. package/dist/types/doc_link.d.ts +42 -0
  333. package/dist/types/doc_link.d.ts.map +1 -0
  334. package/dist/types/doc_link.js +5 -0
  335. package/dist/types/doc_link.js.map +1 -0
  336. package/dist/types/field_type_definition.d.ts +67 -0
  337. package/dist/types/field_type_definition.d.ts.map +1 -0
  338. package/dist/types/field_type_definition.js +41 -0
  339. package/dist/types/field_type_definition.js.map +1 -0
  340. package/dist/types/file_attachment.d.ts +2 -0
  341. package/dist/types/file_attachment.d.ts.map +1 -1
  342. package/dist/types/file_attachment.js.map +1 -1
  343. package/dist/types/file_manager.d.ts +36 -0
  344. package/dist/types/file_manager.d.ts.map +1 -1
  345. package/dist/types/index.d.ts +8 -1
  346. package/dist/types/index.d.ts.map +1 -1
  347. package/dist/types/index.js +2 -0
  348. package/dist/types/index.js.map +1 -1
  349. package/dist/types/style_variant.d.ts +93 -0
  350. package/dist/types/style_variant.d.ts.map +1 -0
  351. package/dist/types/style_variant.js +248 -0
  352. package/dist/types/style_variant.js.map +1 -0
  353. package/dist/types/validation.d.ts +192 -0
  354. package/dist/types/validation.d.ts.map +1 -0
  355. package/dist/types/validation.js +9 -0
  356. package/dist/types/validation.js.map +1 -0
  357. package/dist/utils/build_rule_field_map.d.ts +31 -0
  358. package/dist/utils/build_rule_field_map.d.ts.map +1 -0
  359. package/dist/utils/build_rule_field_map.js +53 -0
  360. package/dist/utils/build_rule_field_map.js.map +1 -0
  361. package/dist/utils/data_form_uploads.d.ts +25 -0
  362. package/dist/utils/data_form_uploads.d.ts.map +1 -0
  363. package/dist/utils/data_form_uploads.js +36 -0
  364. package/dist/utils/data_form_uploads.js.map +1 -0
  365. package/dist/utils/financial_format.d.ts +12 -0
  366. package/dist/utils/financial_format.d.ts.map +1 -0
  367. package/dist/utils/financial_format.js +19 -0
  368. package/dist/utils/financial_format.js.map +1 -0
  369. package/dist/utils/formula.d.ts +13 -0
  370. package/dist/utils/formula.d.ts.map +1 -0
  371. package/dist/utils/formula.js +104 -0
  372. package/dist/utils/formula.js.map +1 -0
  373. package/dist/utils/index.d.ts +11 -0
  374. package/dist/utils/index.d.ts.map +1 -1
  375. package/dist/utils/index.js +16 -0
  376. package/dist/utils/index.js.map +1 -1
  377. package/dist/utils/mask_format.d.ts +20 -0
  378. package/dist/utils/mask_format.d.ts.map +1 -0
  379. package/dist/utils/mask_format.js +41 -0
  380. package/dist/utils/mask_format.js.map +1 -0
  381. package/dist/utils/slugify.d.ts +10 -0
  382. package/dist/utils/slugify.d.ts.map +1 -0
  383. package/dist/utils/slugify.js +17 -0
  384. package/dist/utils/slugify.js.map +1 -0
  385. package/dist/utils/style_resolver.d.ts +36 -0
  386. package/dist/utils/style_resolver.d.ts.map +1 -0
  387. package/dist/utils/style_resolver.js +160 -0
  388. package/dist/utils/style_resolver.js.map +1 -0
  389. package/dist/utils/use_computed_fields.d.ts +14 -0
  390. package/dist/utils/use_computed_fields.d.ts.map +1 -0
  391. package/dist/utils/use_computed_fields.js +24 -0
  392. package/dist/utils/use_computed_fields.js.map +1 -0
  393. package/package.json +15 -3
  394. package/templates/config/hazo_collab_forms_config.ini +7 -0
@@ -6,17 +6,19 @@
6
6
  */
7
7
  'use client';
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
- import React, { useCallback, useMemo } from 'react';
9
+ import React, { useCallback, useEffect, useMemo, useRef } from 'react';
10
10
  import { useFormViewContext } from '../context.js';
11
11
  import { HazoCollabFormSet } from '../../_internal_form_set.js';
12
12
  import { cn } from '../../../utils/cn.js';
13
13
  import { get_row_color_for_data_ok } from '../../shared/row_color_utils.js';
14
14
  import { use_view_callbacks } from '../hooks/use_view_callbacks.js';
15
+ import { ClarificationSection } from '../../clarification/index.js';
16
+ import { use_clarifications } from '../../clarification/use_clarifications.js';
15
17
  /**
16
18
  * EditSection - Renders a single section with the internal form set
17
19
  */
18
- const EditSection = React.memo(function EditSection({ section, section_index }) {
19
- const { form_data, field_metadata, reference_data, icons_behaviour, chat_config, current_user, can_access_private_files, file_manager, autofill_api_endpoint, settings, callbacks, render_icon, dialog_components, combobox_components, enable_library, library_api_base_url, library_table_name, library_scope_id, } = useFormViewContext();
20
+ const EditSection = React.memo(function EditSection({ section, section_index, file_manager_override }) {
21
+ const { form_data, field_metadata, reference_data, icons_behaviour, chat_config, current_user, can_access_private_files, file_manager, autofill_api_endpoint, settings, callbacks, render_icon, dialog_components, combobox_components, enable_library, library_api_base_url, library_table_name, library_scope_id, styles_config, field_types_config, clarification_callbacks, } = useFormViewContext();
20
22
  // All callback wrappers via shared hook
21
23
  const { handle_field_change, handle_form_data_change, handle_metadata_change, handle_data_ok_change, handle_notes_change, handle_visibility_change, handle_lock_change, handle_delete, handle_skip_change, handle_add_field_config, handle_add_group_config, handle_edit_field_config, handle_delete_field, handle_files_change, handle_private_files_change, } = use_view_callbacks(callbacks);
22
24
  // Calculate row color based on data_ok state
@@ -45,8 +47,8 @@ const EditSection = React.memo(function EditSection({ section, section_index })
45
47
  include_chat_in_dropdown: settings.include_chat_in_dropdown, include_notes_in_dropdown: settings.include_notes_in_dropdown, extract_active_chat: settings.extract_active_chat, extract_active_notes: settings.extract_active_notes, action_buttons_borderless: settings.action_buttons_borderless,
46
48
  // Callbacks
47
49
  on_field_change: handle_field_change, on_form_data_change: handle_form_data_change, on_field_metadata_change: handle_metadata_change, on_data_ok_change: handle_data_ok_change, on_notes_change: handle_notes_change, on_visibility_change: handle_visibility_change, on_lock_change: handle_lock_change, on_delete: handle_delete, on_skip_change: handle_skip_change, on_add_field_config: handle_add_field_config, on_add_group_config: handle_add_group_config, on_edit_field_config: handle_edit_field_config, on_delete_field: handle_delete_field,
48
- // File manager
49
- file_manager: file_manager,
50
+ // File manager (with error data merged if available)
51
+ file_manager: file_manager_override || file_manager,
50
52
  // Autofill
51
53
  autofill_api_endpoint: autofill_api_endpoint,
52
54
  // File callbacks
@@ -58,7 +60,11 @@ const EditSection = React.memo(function EditSection({ section, section_index })
58
60
  // UI components for add field dialog
59
61
  dialog_components: dialog_components, combobox_components: combobox_components,
60
62
  // Field library integration
61
- enable_library: enable_library, library_api_base_url: library_api_base_url, library_table_name: library_table_name, library_scope_id: library_scope_id }) })] }));
63
+ enable_library: enable_library, library_api_base_url: library_api_base_url, library_table_name: library_table_name, library_scope_id: library_scope_id,
64
+ // Style & field type configuration
65
+ styles_config: styles_config, field_types_config: field_types_config,
66
+ // Clarifications
67
+ clarification_callbacks: clarification_callbacks }) })] }));
62
68
  });
63
69
  /**
64
70
  * EditView component
@@ -67,10 +73,72 @@ const EditSection = React.memo(function EditSection({ section, section_index })
67
73
  * Each section is rendered as an internal form set instance.
68
74
  */
69
75
  export function EditView() {
70
- const { sections, form_data } = useFormViewContext();
76
+ const { sections, form_data, field_metadata, enable_clarifications, clarification_callbacks, callbacks, file_manager } = useFormViewContext();
77
+ // Clarification state
78
+ const { items: clarification_items, counts: clarification_counts, remove_doc_reference } = use_clarifications(form_data, callbacks.on_form_data_change);
79
+ // Auto-sync has_clarification flag to field metadata
80
+ // Tracks which fields have active clarifications and emits metadata changes
81
+ const prev_clarification_map_ref = useRef({});
82
+ useEffect(() => {
83
+ if (!enable_clarifications || !callbacks.on_metadata_change)
84
+ return;
85
+ // Build current map: field_id → has active (pending/responded) clarifications
86
+ const current_map = {};
87
+ for (const item of clarification_items) {
88
+ if (item.status === 'pending' || item.status === 'responded') {
89
+ current_map[item.target_field_id] = true;
90
+ }
91
+ }
92
+ // Compare with previous state and emit changes
93
+ const prev_map = prev_clarification_map_ref.current;
94
+ const all_field_ids = new Set([...Object.keys(current_map), ...Object.keys(prev_map)]);
95
+ for (const field_id of all_field_ids) {
96
+ const has_now = !!current_map[field_id];
97
+ const had_before = !!prev_map[field_id];
98
+ const persisted = field_metadata[field_id]?.has_clarification;
99
+ // Only emit if the live status differs from what's persisted
100
+ if (has_now !== had_before && has_now !== persisted) {
101
+ callbacks.on_metadata_change({
102
+ field_id,
103
+ changes: { has_clarification: has_now },
104
+ });
105
+ }
106
+ }
107
+ prev_clarification_map_ref.current = current_map;
108
+ }, [clarification_items, enable_clarifications, callbacks.on_metadata_change, field_metadata]);
109
+ // Merge remove_doc_reference into clarification_callbacks
110
+ const merged_clarification_callbacks = useMemo(() => {
111
+ if (!clarification_callbacks && !remove_doc_reference)
112
+ return undefined;
113
+ return {
114
+ ...clarification_callbacks,
115
+ on_doc_delete: remove_doc_reference,
116
+ };
117
+ }, [clarification_callbacks, remove_doc_reference]);
118
+ // Compute file error data from active clarifications
119
+ const file_manager_with_errors = useMemo(() => {
120
+ if (!file_manager || !clarification_items.length)
121
+ return file_manager;
122
+ const error_ids = new Set();
123
+ const error_details = {};
124
+ for (const item of clarification_items) {
125
+ if (item.status === 'pending' || item.status === 'responded') {
126
+ for (const ref of item.doc_references) {
127
+ error_ids.add(ref.file_id);
128
+ if (!error_details[ref.file_id])
129
+ error_details[ref.file_id] = [];
130
+ error_details[ref.file_id].push(item.issue_description);
131
+ }
132
+ }
133
+ }
134
+ if (error_ids.size === 0) {
135
+ return { ...file_manager, clarification_items, clarification_callbacks: merged_clarification_callbacks };
136
+ }
137
+ return { ...file_manager, error_file_ids: error_ids, error_file_details: error_details, clarification_items, clarification_callbacks: merged_clarification_callbacks };
138
+ }, [file_manager, clarification_items, merged_clarification_callbacks]);
71
139
  // Memoize section keys to ensure stable rendering
72
140
  // Always include index to handle duplicate section names
73
141
  const section_keys = useMemo(() => sections.map((section, index) => `${index}_${section.section_name || 'section'}`), [sections]);
74
- return (_jsxs("div", { className: cn('cls_form_view_edit space-y-6'), children: [sections.map((section, index) => (_jsx(EditSection, { section: section, section_index: index }, section_keys[index]))), sections.length === 0 && (_jsx("div", { className: "p-8 text-center text-muted-foreground", children: _jsx("p", { children: "No sections to display." }) }))] }));
142
+ return (_jsxs("div", { className: cn('cls_form_view_edit space-y-6'), children: [sections.map((section, index) => (_jsx(EditSection, { section: section, section_index: index, file_manager_override: file_manager_with_errors }, section_keys[index]))), enable_clarifications && clarification_items.length > 0 && (_jsx(ClarificationSection, { items: clarification_items, counts: clarification_counts, callbacks: merged_clarification_callbacks })), sections.length === 0 && (_jsx("div", { className: "p-8 text-center text-muted-foreground", children: _jsx("p", { children: "No sections to display." }) }))] }));
75
143
  }
76
144
  //# sourceMappingURL=edit_view.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"edit_view.js","sourceRoot":"","sources":["../../../../src/components/hazo_collab_form_view/views/edit_view.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAgB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAWpE;;GAEG;AACH,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,WAAW,CAAC,EAAE,OAAO,EAAE,aAAa,EAAoB;IAC9F,MAAM,EACJ,SAAS,EACT,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,YAAY,EACZ,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,GACjB,GAAG,kBAAkB,EAAE,CAAC;IAEzB,wCAAwC;IACxC,MAAM,EACJ,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,GAC5B,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAElC,6CAA6C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WAAW,IAEV,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,KAAK,IAFf,YAAY,CAAC,KAAK,CAAC,CAGxB,CACH,CAAC,EAGD,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,CACxB,cAAK,SAAS,EAAC,uCAAuC,YACpD,kDAA8B,GAC1B,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"edit_view.js","sourceRoot":"","sources":["../../../../src/components/hazo_collab_form_view/views/edit_view.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAgB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAc/E;;GAEG;AACH,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,WAAW,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAoB;IACrH,MAAM,EACJ,SAAS,EACT,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,YAAY,EACZ,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GAC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8B,GACzC,CACH,EAGA,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,CACxB,cAAK,SAAS,EAAC,uCAAuC,YACpD,kDAA8B,GAC1B,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"summary_view.d.ts","sourceRoot":"","sources":["../../../../src/components/hazo_collab_form_view/views/summary_view.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqcH;;GAEG;AACH,wBAAgB,WAAW,4CAyE1B"}
1
+ {"version":3,"file":"summary_view.d.ts","sourceRoot":"","sources":["../../../../src/components/hazo_collab_form_view/views/summary_view.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6wBH;;GAEG;AACH,wBAAgB,WAAW,4CA4K1B"}
@@ -15,28 +15,80 @@ import { format_date_value, get_field_attachments, get_field_private_attachments
15
15
  import { UnifiedFieldControls, use_field_control_props } from '../../shared/unified_field_controls/index.js';
16
16
  import { SummaryFiles } from '../../shared/summary_files/index.js';
17
17
  import { SummaryDataTable } from './summary_data_table.js';
18
- import { HiddenBadge, ProtectedBadge } from '../../status_badges.js';
18
+ import { HiddenBadge, ProtectedBadge, ClarificationLabelBadge, FileErrorLabelBadge } from '../../status_badges.js';
19
19
  import { CollabFormFieldReferenceTag } from '../../hazo_collab_form_base.js';
20
- import { IoCheckmarkCircle, IoCloseCircle } from 'react-icons/io5';
20
+ import { IoCheckmarkCircle, IoCloseCircle, IoAlertCircle } from 'react-icons/io5';
21
21
  import { get_row_color_for_data_ok } from '../../shared/row_color_utils.js';
22
+ import { format_currency, format_percentage } from '../../../utils/financial_format.js';
23
+ import { format_masked_value } from '../../../utils/mask_format.js';
24
+ import { HazoCollabFormSummaryRow } from '../../hazo_collab_form_summary_row.js';
25
+ import { ClarificationSection, ClarificationDialog } from '../../clarification/index.js';
26
+ import { use_clarifications } from '../../clarification/use_clarifications.js';
27
+ /**
28
+ * Local context for file preview callback — avoids threading props through every component
29
+ */
30
+ const FilePreviewContext = React.createContext(undefined);
31
+ function useFilePreview() {
32
+ return React.useContext(FilePreviewContext);
33
+ }
34
+ /**
35
+ * PDF Preview Dialog - wraps hazo_pdf PdfViewer in a full-screen Radix Dialog.
36
+ */
37
+ function PdfPreviewDialog({ PdfViewerComponent, open, on_close, url, file_name, }) {
38
+ const [DialogPrimitive, set_dialog_primitive] = React.useState(null);
39
+ React.useEffect(() => {
40
+ import('@radix-ui/react-dialog').then((mod) => {
41
+ set_dialog_primitive(mod);
42
+ }).catch(() => { });
43
+ }, []);
44
+ if (!DialogPrimitive)
45
+ return null;
46
+ const fullScreenStyles = {
47
+ position: 'fixed',
48
+ top: '16px',
49
+ left: '16px',
50
+ right: '16px',
51
+ bottom: '16px',
52
+ width: 'calc(100vw - 32px)',
53
+ height: 'calc(100vh - 32px)',
54
+ maxWidth: 'none',
55
+ maxHeight: 'none',
56
+ transform: 'none',
57
+ display: 'flex',
58
+ flexDirection: 'column',
59
+ zIndex: 50,
60
+ backgroundColor: 'hsl(var(--background, 0 0% 100%))',
61
+ borderRadius: '8px',
62
+ overflow: 'hidden',
63
+ };
64
+ return (_jsx(DialogPrimitive.Root, { open: open, onOpenChange: (o) => { if (!o)
65
+ on_close(); }, children: _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { style: { position: 'fixed', inset: 0, zIndex: 50, backgroundColor: 'rgba(0,0,0,0.5)' } }), _jsxs(DialogPrimitive.Content, { style: fullScreenStyles, "aria-describedby": undefined, children: [_jsx(DialogPrimitive.Title, { className: "sr-only", children: file_name }), _jsx("div", { style: { width: '100%', height: '100%' }, children: _jsx(PdfViewerComponent, { url: url, fit_to_width: true, toolbar_enabled: true, on_close: on_close, className: "h-full w-full" }) })] })] }) }));
66
+ }
22
67
  /**
23
68
  * SummarySection - Renders a single section
24
69
  */
25
70
  const SummarySection = React.memo(function SummarySection({ section, section_index, }) {
26
71
  const { settings, render_icon, form_data, render_files, file_manager } = useFormViewContext();
72
+ const { error_file_ids } = use_clarifications(form_data);
73
+ const on_file_preview = useFilePreview();
27
74
  // Get section-level files (use section_name or index as key)
28
75
  const section_key = section.section_name?.replace(/\s+/g, '_') || `section_${section_index}`;
29
76
  const section_files = section.accept_files_public ? get_field_attachments(form_data, section_key) : [];
30
77
  const section_private_files = section.accept_files_private ? get_field_private_attachments(form_data, section_key) : [];
31
78
  const has_section_files = section_files.length > 0 || section_private_files.length > 0;
32
- return (_jsxs("div", { className: "cls_summary_section border rounded-lg bg-card shadow-sm overflow-hidden", children: [_jsxs("div", { className: "flex items-center gap-3 p-4 border-b bg-muted/30", children: [section.icon && render_icon && (_jsx("div", { className: "flex items-center justify-center w-10 h-10 rounded-full bg-orange-100 text-orange-600", children: render_icon(section.icon) })), _jsx("h3", { className: "font-semibold text-lg text-foreground", children: section.section_name || `Section ${section_index + 1}` })] }), _jsxs("div", { className: "p-4 space-y-2", children: [section.groups && section.groups.length > 0 ? (section.groups.map((group, idx) => (_jsx(SummaryGroup, { field: group }, group.id)))) : (_jsx("p", { className: "text-muted-foreground text-sm italic", children: settings.empty_section_text })), (section.accept_files_public || section.accept_files_private) && has_section_files && (render_files ? (render_files(section_files, section_key)) : (_jsx(SummaryFiles, { files: section_files, private_files: section_private_files, field_id: section_key, class_name: "mt-4 pt-4 border-t", get_download_url: file_manager?.callbacks.get_download_url, show_file_status: file_manager?.show_file_status })))] })] }));
79
+ return (_jsxs("div", { className: "cls_summary_section border rounded-lg bg-card shadow-sm overflow-hidden", children: [_jsxs("div", { className: "flex items-center gap-3 p-4 border-b bg-muted/30", children: [section.icon && render_icon && (_jsx("div", { className: "flex items-center justify-center w-10 h-10 rounded-full bg-orange-100 text-orange-600", children: render_icon(section.icon) })), _jsx("h3", { className: "font-semibold text-lg text-foreground", children: section.section_name || `Section ${section_index + 1}` })] }), _jsxs("div", { className: "p-4 space-y-2", children: [section.groups && section.groups.length > 0 ? (section.groups.map((group, idx) => (_jsx(SummaryGroup, { field: group }, group.id)))) : (_jsx("p", { className: "text-muted-foreground text-sm italic", children: settings.empty_section_text })), (section.accept_files_public || section.accept_files_private) && has_section_files && (render_files ? (render_files(section_files, section_key)) : (_jsx(SummaryFiles, { files: section_files, private_files: section_private_files, field_id: section_key, class_name: "mt-4 pt-4 border-t", get_download_url: file_manager?.callbacks.get_download_url, show_file_status: file_manager?.show_file_status, error_file_ids: error_file_ids, passed_file_ids: file_manager?.passed_file_ids, on_file_click: on_file_preview })))] })] }));
33
80
  });
34
81
  /**
35
82
  * SummaryGroup - Renders a group of fields
36
83
  */
37
84
  const SummaryGroup = React.memo(function SummaryGroup({ field }) {
38
- const { field_metadata, icons_behaviour, settings, callbacks, chat_config, current_user, form_data, render_files, file_manager } = useFormViewContext();
85
+ const { field_metadata, icons_behaviour, settings, callbacks, chat_config, current_user, form_data, render_files, file_manager, enable_clarifications, clarification_callbacks } = useFormViewContext();
39
86
  const should_render = useShouldRenderField();
87
+ const { items: all_clarification_items, get_pending_count, get_field_clarifications, error_file_ids } = use_clarifications(form_data);
88
+ const on_file_preview = useFilePreview();
89
+ const [clarification_dialog_field, set_clarification_dialog_field] = React.useState(null);
90
+ // Track which file_id triggered the issue dialog (null = opened from field label badge)
91
+ const [issues_dialog_file_id, set_issues_dialog_file_id] = React.useState(null);
40
92
  if (!should_render(field)) {
41
93
  return null;
42
94
  }
@@ -69,11 +121,41 @@ const SummaryGroup = React.memo(function SummaryGroup({ field }) {
69
121
  const group_files = get_field_attachments(form_data, field.id);
70
122
  const group_private_files = get_field_private_attachments(form_data, field.id);
71
123
  const has_group_files = group_files.length > 0 || group_private_files.length > 0;
124
+ // Count group-level file errors
125
+ const group_file_error_count = useMemo(() => {
126
+ if (!error_file_ids || error_file_ids.size === 0)
127
+ return 0;
128
+ let count = 0;
129
+ for (const f of group_files) {
130
+ if (error_file_ids.has(f.file_id))
131
+ count++;
132
+ }
133
+ for (const f of group_private_files) {
134
+ if (error_file_ids.has(f.file_id))
135
+ count++;
136
+ }
137
+ return count;
138
+ }, [error_file_ids, group_files, group_private_files]);
72
139
  // Check if group is locked or hidden
73
140
  const is_locked = metadata?.locked === true;
74
141
  const is_hidden = metadata?.visibility === 'hidden';
75
142
  if (is_group && field.fields) {
76
- return (_jsxs("div", { className: cn('cls_summary_group space-y-2', group_row_color && 'px-3 -mx-3 rounded-sm', group_row_color), children: [field.label && (_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h4", { className: "font-medium text-sm text-muted-foreground uppercase tracking-wide", children: field.label }), is_locked && _jsx(ProtectedBadge, {}), is_hidden && _jsx(HiddenBadge, {})] }), role_controls && (_jsx(UnifiedFieldControls, { field_id: field.id, icons_behaviour: icons_behaviour, active_role: settings.active_role, metadata: control_metadata, callbacks: control_callbacks, config: control_config, fallback_visibility: fallback_visibility, fallback_enabled: fallback_enabled }))] })), !field.label && (is_locked || is_hidden) && (_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [is_locked && _jsx(ProtectedBadge, {}), is_hidden && _jsx(HiddenBadge, {})] })), _jsx("div", { className: "pl-2 border-l-2 border-muted space-y-2", children: field.fields.map((child) => (_jsx(SummaryField, { field: child, parent_metadata: metadata }, child.id))) }), has_group_files && (render_files ? (render_files(group_files, field.id)) : (_jsx(SummaryFiles, { files: group_files, private_files: group_private_files, field_id: field.id, class_name: "mt-2", get_download_url: file_manager?.callbacks.get_download_url, show_file_status: file_manager?.show_file_status })))] }));
143
+ return (_jsxs("div", { className: cn('cls_summary_group space-y-2', group_row_color && 'px-3 -mx-3 rounded-sm', group_row_color), children: [field.label && (_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [enable_clarifications && get_pending_count(field.id) > 0 ? (_jsx(ClarificationLabelBadge, { count: get_pending_count(field.id) })) : (metadata?.has_clarification && (_jsx(ClarificationLabelBadge, { indicator_only: true }))), _jsx("h4", { className: "font-medium text-sm text-muted-foreground uppercase tracking-wide", children: field.label }), group_file_error_count > 0 && (_jsx(FileErrorLabelBadge, { count: group_file_error_count, on_click: () => set_issues_dialog_file_id('__all_group__') })), is_locked && _jsx(ProtectedBadge, {}), is_hidden && _jsx(HiddenBadge, {})] }), role_controls && (_jsx(UnifiedFieldControls, { field_id: field.id, icons_behaviour: icons_behaviour, active_role: settings.active_role, metadata: control_metadata, callbacks: control_callbacks, config: control_config, fallback_visibility: fallback_visibility, fallback_enabled: fallback_enabled, clarification_count: enable_clarifications ? get_pending_count(field.id) : undefined, on_clarification_click: enable_clarifications ? () => set_clarification_dialog_field(field.id) : undefined }))] })), !field.label && (is_locked || is_hidden) && (_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [is_locked && _jsx(ProtectedBadge, {}), is_hidden && _jsx(HiddenBadge, {})] })), _jsx("div", { className: "pl-2 border-l-2 border-muted space-y-2", children: field.fields.map((child) => (_jsx(SummaryField, { field: child, parent_metadata: metadata }, child.id))) }), has_group_files && (render_files ? (render_files(group_files, field.id)) : (_jsx(SummaryFiles, { files: group_files, private_files: group_private_files, field_id: field.id, class_name: "mt-2", get_download_url: file_manager?.callbacks.get_download_url, show_file_status: file_manager?.show_file_status, error_file_ids: error_file_ids, passed_file_ids: file_manager?.passed_file_ids, on_file_issue_click: enable_clarifications ? (file_id) => set_issues_dialog_file_id(file_id) : undefined, on_file_click: on_file_preview }))), enable_clarifications && clarification_dialog_field && (_jsx(ClarificationDialog, { open: clarification_dialog_field === field.id, on_open_change: (open) => { if (!open)
144
+ set_clarification_dialog_field(null); }, field_label: field.label || field.id, items: get_field_clarifications(field.id), callbacks: clarification_callbacks, get_download_url: file_manager?.callbacks.get_download_url })), enable_clarifications && issues_dialog_file_id && (() => {
145
+ // If opened from field-label badge, show all file errors for the group
146
+ const all_group_file_ids = [...group_files, ...group_private_files].map(f => f.file_id);
147
+ const target_file_ids = issues_dialog_file_id === '__all_group__'
148
+ ? new Set(all_group_file_ids.filter(fid => error_file_ids.has(fid)))
149
+ : new Set([issues_dialog_file_id]);
150
+ const file_clarifications = all_clarification_items.filter(item => (item.status === 'pending' || item.status === 'responded') &&
151
+ item.doc_references.some(ref => target_file_ids.has(ref.file_id)));
152
+ const file_attachment = [...group_files, ...group_private_files].find(f => f.file_id === issues_dialog_file_id);
153
+ const dialog_label = issues_dialog_file_id === '__all_group__'
154
+ ? (field.label || field.id)
155
+ : (file_attachment?.file_name ?? 'File');
156
+ return (_jsx(ClarificationDialog, { open: true, on_open_change: (open) => { if (!open)
157
+ set_issues_dialog_file_id(null); }, field_label: dialog_label, items: file_clarifications, callbacks: clarification_callbacks, get_download_url: file_manager?.callbacks.get_download_url }));
158
+ })()] }));
77
159
  }
78
160
  return _jsx(SummaryField, { field: field });
79
161
  });
@@ -81,8 +163,13 @@ const SummaryGroup = React.memo(function SummaryGroup({ field }) {
81
163
  * SummaryField - Renders a single field
82
164
  */
83
165
  const SummaryField = React.memo(function SummaryField({ field, parent_metadata }) {
84
- const { form_data, field_metadata, reference_data, settings, icons_behaviour, callbacks, chat_config, current_user, render_files, file_manager } = useFormViewContext();
166
+ const { form_data, field_metadata, reference_data, settings, icons_behaviour, callbacks, chat_config, current_user, render_files, file_manager, styles_config, enable_clarifications, clarification_callbacks } = useFormViewContext();
85
167
  const should_render = useShouldRenderField();
168
+ const { items: all_clarification_items, get_pending_count, get_field_clarifications, error_file_ids } = use_clarifications(form_data);
169
+ const on_file_preview = useFilePreview();
170
+ const [clarification_dialog_open, set_clarification_dialog_open] = React.useState(false);
171
+ // Track which file_id triggered the issue dialog (null = not open)
172
+ const [issues_dialog_file_id, set_issues_dialog_file_id] = React.useState(null);
86
173
  if (!should_render(field)) {
87
174
  return null;
88
175
  }
@@ -91,14 +178,22 @@ const SummaryField = React.memo(function SummaryField({ field, parent_metadata }
91
178
  const metadata = field_metadata[field.id];
92
179
  // Check if this is a data table field
93
180
  const is_data_table = field.component_type === 'HazoCollabFormDataTable';
181
+ // Check if this is a summary row
182
+ const is_summary_row = field.component_type === 'HazoCollabFormSummaryRow';
183
+ // Check if this is a static text field
184
+ const is_static_text = field.component_type === 'HazoCollabFormStaticText';
94
185
  // Skip empty fields if configured (data tables with no rows are also empty)
95
- if (is_empty && !settings.show_empty_fields) {
186
+ // Static text and summary rows always render (they don't depend on form_data value)
187
+ if (is_empty && !settings.show_empty_fields && !is_static_text && !is_summary_row) {
96
188
  return null;
97
189
  }
98
- // Format value based on field type (skip for data tables)
190
+ // Format value based on field type (skip for data tables and summary rows)
99
191
  let display_value = '';
100
- if (!is_data_table) {
101
- if (is_empty) {
192
+ if (!is_data_table && !is_summary_row) {
193
+ if (is_static_text) {
194
+ display_value = field.static_content || field.label || '';
195
+ }
196
+ else if (is_empty) {
102
197
  display_value = settings.empty_field_text;
103
198
  }
104
199
  else if (field.component_type === 'HazoCollabFormCheckbox') {
@@ -111,6 +206,37 @@ const SummaryField = React.memo(function SummaryField({ field, parent_metadata }
111
206
  const option = field.input_options?.find(opt => opt.value === String(value));
112
207
  display_value = option?.label ?? String(value);
113
208
  }
209
+ else if (field.component_type === 'HazoCollabFormCurrency') {
210
+ const num = typeof value === 'number' ? value : parseFloat(String(value));
211
+ display_value = !isNaN(num)
212
+ ? format_currency(num, field.currency_symbol || '$', field.decimal_places ?? 2)
213
+ : String(value);
214
+ }
215
+ else if (field.component_type === 'HazoCollabFormPercentage') {
216
+ const num = typeof value === 'number' ? value : parseFloat(String(value));
217
+ display_value = !isNaN(num)
218
+ ? format_percentage(num, field.decimal_places ?? 2)
219
+ : String(value);
220
+ }
221
+ else if (field.component_type === 'HazoCollabFormComputed') {
222
+ const num = typeof value === 'number' ? value : parseFloat(String(value));
223
+ if (!isNaN(num)) {
224
+ if (field.is_percentage) {
225
+ display_value = format_percentage(num, field.decimal_places ?? 2);
226
+ }
227
+ else {
228
+ display_value = format_currency(num, field.currency_symbol || '$', field.decimal_places ?? 2);
229
+ }
230
+ }
231
+ else {
232
+ display_value = String(value);
233
+ }
234
+ }
235
+ else if (field.component_type === 'HazoCollabFormMasked') {
236
+ display_value = field.display_format
237
+ ? format_masked_value(String(value), field.display_format)
238
+ : String(value);
239
+ }
114
240
  else {
115
241
  display_value = String(value);
116
242
  }
@@ -143,6 +269,21 @@ const SummaryField = React.memo(function SummaryField({ field, parent_metadata }
143
269
  const field_files = field.accept_files_public ? get_field_attachments(form_data, field.id) : [];
144
270
  const field_private_files = field.accept_files_private ? get_field_private_attachments(form_data, field.id) : [];
145
271
  const has_field_files = field_files.length > 0 || field_private_files.length > 0;
272
+ // Count field-level file errors
273
+ const field_file_error_count = useMemo(() => {
274
+ if (!error_file_ids || error_file_ids.size === 0)
275
+ return 0;
276
+ let count = 0;
277
+ for (const f of field_files) {
278
+ if (error_file_ids.has(f.file_id))
279
+ count++;
280
+ }
281
+ for (const f of field_private_files) {
282
+ if (error_file_ids.has(f.file_id))
283
+ count++;
284
+ }
285
+ return count;
286
+ }, [error_file_ids, field_files, field_private_files]);
146
287
  // Check if field is locked or hidden
147
288
  const is_locked = metadata?.locked === true;
148
289
  const is_hidden = metadata?.visibility === 'hidden';
@@ -151,9 +292,39 @@ const SummaryField = React.memo(function SummaryField({ field, parent_metadata }
151
292
  // Data table rendering
152
293
  if (is_data_table && field.table_config) {
153
294
  const rows = (Array.isArray(value) ? value : []);
154
- return (_jsxs("div", { className: "cls_summary_field_wrapper", children: [_jsxs("div", { className: cn('cls_summary_field py-2 px-3 rounded', row_color), children: [_jsxs("div", { className: "flex justify-between items-start mb-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-foreground", children: field.label || field.id }), is_locked && _jsx(ProtectedBadge, {}), is_hidden && _jsx(HiddenBadge, {})] }), role_controls && (_jsx("div", { className: "flex-shrink-0", children: _jsx(UnifiedFieldControls, { field_id: field.id, icons_behaviour: icons_behaviour, active_role: settings.active_role, metadata: control_metadata, callbacks: control_callbacks, config: control_config, fallback_visibility: fallback_visibility, fallback_enabled: fallback_enabled }) }))] }), _jsx(SummaryDataTable, { table_config: field.table_config, rows: rows, date_format: settings.date_format, empty_message: settings.empty_table_text }), reference_info && (_jsx("div", { className: "mt-1", children: _jsx(CollabFormFieldReferenceTag, { reference_value: reference_info.value, reference_label: reference_info.label, reference_tag_background_color: reference_info.background_color }) }))] }), has_field_files && (render_files ? (render_files(field_files, field.id)) : (_jsx(SummaryFiles, { files: field_files, private_files: field_private_files, field_id: field.id, class_name: "mt-2 ml-3", get_download_url: file_manager?.callbacks.get_download_url, show_file_status: file_manager?.show_file_status })))] }));
295
+ return (_jsxs("div", { className: "cls_summary_field_wrapper", "data-field-id": field.id, children: [_jsxs("div", { className: cn('cls_summary_field py-2 px-3 rounded', row_color), children: [_jsxs("div", { className: "flex justify-between items-start mb-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [enable_clarifications && get_pending_count(field.id) > 0 ? (_jsx(ClarificationLabelBadge, { count: get_pending_count(field.id) })) : (metadata?.has_clarification && (_jsx(ClarificationLabelBadge, { indicator_only: true }))), _jsx("span", { className: "text-sm font-medium text-foreground", children: field.label || field.id }), field_file_error_count > 0 && (_jsx(FileErrorLabelBadge, { count: field_file_error_count, on_click: () => set_issues_dialog_file_id('__all_field__') })), is_locked && _jsx(ProtectedBadge, {}), is_hidden && _jsx(HiddenBadge, {})] }), role_controls && (_jsx("div", { className: "flex-shrink-0", children: _jsx(UnifiedFieldControls, { field_id: field.id, icons_behaviour: icons_behaviour, active_role: settings.active_role, metadata: control_metadata, callbacks: control_callbacks, config: control_config, fallback_visibility: fallback_visibility, fallback_enabled: fallback_enabled, clarification_count: enable_clarifications ? get_pending_count(field.id) : undefined, on_clarification_click: enable_clarifications ? () => set_clarification_dialog_open(true) : undefined }) }))] }), _jsx(SummaryDataTable, { table_config: field.table_config, rows: rows, date_format: settings.date_format, empty_message: settings.empty_table_text }), reference_info && (_jsx("div", { className: "mt-1", children: _jsx(CollabFormFieldReferenceTag, { reference_value: reference_info.value, reference_label: reference_info.label, reference_tag_background_color: reference_info.background_color }) }))] }), has_field_files && (render_files ? (render_files(field_files, field.id)) : (_jsx(SummaryFiles, { files: field_files, private_files: field_private_files, field_id: field.id, class_name: "mt-2 ml-3", get_download_url: file_manager?.callbacks.get_download_url, show_file_status: file_manager?.show_file_status, error_file_ids: error_file_ids, passed_file_ids: file_manager?.passed_file_ids, on_file_issue_click: enable_clarifications ? (fid) => set_issues_dialog_file_id(fid) : undefined, on_file_click: on_file_preview }))), enable_clarifications && clarification_dialog_open && (_jsx(ClarificationDialog, { open: clarification_dialog_open, on_open_change: set_clarification_dialog_open, field_label: field.label || field.id, items: get_field_clarifications(field.id), callbacks: clarification_callbacks, get_download_url: file_manager?.callbacks.get_download_url })), enable_clarifications && issues_dialog_file_id && (() => {
296
+ const all_file_ids = [...field_files, ...field_private_files].map(f => f.file_id);
297
+ const target_file_ids = issues_dialog_file_id === '__all_field__'
298
+ ? new Set(all_file_ids.filter(fid => error_file_ids.has(fid)))
299
+ : new Set([issues_dialog_file_id]);
300
+ const file_clarifications = all_clarification_items.filter(item => (item.status === 'pending' || item.status === 'responded') &&
301
+ item.doc_references.some(ref => target_file_ids.has(ref.file_id)));
302
+ const file_attachment = [...field_files, ...field_private_files].find(f => f.file_id === issues_dialog_file_id);
303
+ const dialog_label = issues_dialog_file_id === '__all_field__'
304
+ ? (field.label || field.id)
305
+ : (file_attachment?.file_name ?? 'File');
306
+ return (_jsx(ClarificationDialog, { open: true, on_open_change: (open) => { if (!open)
307
+ set_issues_dialog_file_id(null); }, field_label: dialog_label, items: file_clarifications, callbacks: clarification_callbacks, get_download_url: file_manager?.callbacks.get_download_url }));
308
+ })()] }));
155
309
  }
156
- return (_jsxs("div", { className: "cls_summary_field_wrapper", children: [_jsxs("div", { className: cn('cls_summary_field flex justify-between items-start py-2 px-3 rounded', row_color), children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("span", { className: "text-sm font-medium text-foreground", children: field.label || field.id }), is_locked && _jsx(ProtectedBadge, { className: "ml-2" }), is_hidden && _jsx(HiddenBadge, { className: "ml-2" }), _jsx("span", { className: cn('text-sm ml-2', is_empty ? 'text-muted-foreground italic' : 'text-foreground'), children: display_value }), reference_info && (_jsx("div", { className: "mt-1", children: _jsx(CollabFormFieldReferenceTag, { reference_value: reference_info.value, reference_label: reference_info.label, reference_tag_background_color: reference_info.background_color }) }))] }), role_controls && (_jsx("div", { className: "flex-shrink-0", children: _jsx(UnifiedFieldControls, { field_id: field.id, icons_behaviour: icons_behaviour, active_role: settings.active_role, metadata: control_metadata, callbacks: control_callbacks, config: control_config, fallback_visibility: fallback_visibility, fallback_enabled: fallback_enabled }) }))] }), has_field_files && (render_files ? (render_files(field_files, field.id)) : (_jsx(SummaryFiles, { files: field_files, private_files: field_private_files, field_id: field.id, class_name: "mt-2 ml-3", get_download_url: file_manager?.callbacks.get_download_url, show_file_status: file_manager?.show_file_status })))] }));
310
+ // Summary row rendering - full-width styled row with label + value
311
+ if (is_summary_row) {
312
+ return (_jsx(HazoCollabFormSummaryRow, { field_id: field.id, label: field.label || field.id, value: value ?? '', currency_symbol: field.currency_symbol, decimal_places: field.decimal_places, style_variant: field.style_variant, styles_config: styles_config, item_code: field.item_code, badge: field.badge, summary_note: field.summary_note }));
313
+ }
314
+ return (_jsxs("div", { className: "cls_summary_field_wrapper", "data-field-id": field.id, children: [_jsxs("div", { className: cn('cls_summary_field flex justify-between items-start py-2 px-3 rounded', row_color), children: [_jsxs("div", { className: "flex-1 min-w-0", children: [enable_clarifications && get_pending_count(field.id) > 0 ? (_jsx(ClarificationLabelBadge, { count: get_pending_count(field.id), className: "mr-1" })) : (metadata?.has_clarification && (_jsx(ClarificationLabelBadge, { indicator_only: true, className: "mr-1" }))), _jsx("span", { className: "text-sm font-medium text-foreground", children: field.label || field.id }), field_file_error_count > 0 && (_jsx(FileErrorLabelBadge, { count: field_file_error_count, on_click: () => set_issues_dialog_file_id('__all_field__'), className: "ml-1" })), is_locked && _jsx(ProtectedBadge, { className: "ml-2" }), is_hidden && _jsx(HiddenBadge, { className: "ml-2" }), _jsx("span", { className: cn('text-sm ml-2', is_empty ? 'text-muted-foreground italic' : 'text-foreground'), children: display_value }), reference_info && (_jsx("div", { className: "mt-1", children: _jsx(CollabFormFieldReferenceTag, { reference_value: reference_info.value, reference_label: reference_info.label, reference_tag_background_color: reference_info.background_color }) }))] }), role_controls && (_jsx("div", { className: "flex-shrink-0", children: _jsx(UnifiedFieldControls, { field_id: field.id, icons_behaviour: icons_behaviour, active_role: settings.active_role, metadata: control_metadata, callbacks: control_callbacks, config: control_config, fallback_visibility: fallback_visibility, fallback_enabled: fallback_enabled, clarification_count: enable_clarifications ? get_pending_count(field.id) : undefined, on_clarification_click: enable_clarifications ? () => set_clarification_dialog_open(true) : undefined }) }))] }), has_field_files && (render_files ? (render_files(field_files, field.id)) : (_jsx(SummaryFiles, { files: field_files, private_files: field_private_files, field_id: field.id, class_name: "mt-2 ml-3", get_download_url: file_manager?.callbacks.get_download_url, show_file_status: file_manager?.show_file_status, error_file_ids: error_file_ids, passed_file_ids: file_manager?.passed_file_ids, on_file_issue_click: enable_clarifications ? (fid) => set_issues_dialog_file_id(fid) : undefined, on_file_click: on_file_preview }))), enable_clarifications && clarification_dialog_open && (_jsx(ClarificationDialog, { open: clarification_dialog_open, on_open_change: set_clarification_dialog_open, field_label: field.label || field.id, items: get_field_clarifications(field.id), callbacks: clarification_callbacks, get_download_url: file_manager?.callbacks.get_download_url })), enable_clarifications && issues_dialog_file_id && (() => {
315
+ const all_file_ids = [...field_files, ...field_private_files].map(f => f.file_id);
316
+ const target_file_ids = issues_dialog_file_id === '__all_field__'
317
+ ? new Set(all_file_ids.filter(fid => error_file_ids.has(fid)))
318
+ : new Set([issues_dialog_file_id]);
319
+ const file_clarifications = all_clarification_items.filter(item => (item.status === 'pending' || item.status === 'responded') &&
320
+ item.doc_references.some(ref => target_file_ids.has(ref.file_id)));
321
+ const file_attachment = [...field_files, ...field_private_files].find(f => f.file_id === issues_dialog_file_id);
322
+ const dialog_label = issues_dialog_file_id === '__all_field__'
323
+ ? (field.label || field.id)
324
+ : (file_attachment?.file_name ?? 'File');
325
+ return (_jsx(ClarificationDialog, { open: true, on_open_change: (open) => { if (!open)
326
+ set_issues_dialog_file_id(null); }, field_label: dialog_label, items: file_clarifications, callbacks: clarification_callbacks, get_download_url: file_manager?.callbacks.get_download_url }));
327
+ })()] }));
157
328
  });
158
329
  /**
159
330
  * Collect all field IDs from sections (including groups and fields)
@@ -175,8 +346,60 @@ function collect_all_field_ids(sections) {
175
346
  * SummaryView component
176
347
  */
177
348
  export function SummaryView() {
178
- const { sections, field_metadata, callbacks } = useFormViewContext();
349
+ const { sections, field_metadata, callbacks, form_data, file_manager, enable_clarifications, clarification_callbacks } = useFormViewContext();
179
350
  const original_metadata_ref = useRef({});
351
+ const clarification_section_ref = useRef(null);
352
+ // PDF preview state
353
+ const [preview_file, set_preview_file] = React.useState(null);
354
+ const [PdfViewer, set_pdf_viewer] = React.useState(null);
355
+ const [is_mounted, set_is_mounted] = React.useState(false);
356
+ React.useEffect(() => { set_is_mounted(true); }, []);
357
+ // Try to load PdfViewer from hazo_pdf (optional peer dependency)
358
+ React.useEffect(() => {
359
+ if (!is_mounted)
360
+ return;
361
+ import('hazo_pdf').then((mod) => {
362
+ set_pdf_viewer(() => mod.PdfViewer || mod.default?.PdfViewer);
363
+ }).catch(() => {
364
+ // hazo_pdf not installed — PDF preview disabled
365
+ });
366
+ }, [is_mounted]);
367
+ // File preview handler — opens PDF in preview dialog, falls back to download URL
368
+ const handle_file_preview = useCallback((attachment) => {
369
+ if (PdfViewer && file_manager?.callbacks.get_download_url) {
370
+ set_preview_file(attachment);
371
+ }
372
+ else if (file_manager?.callbacks.get_download_url) {
373
+ // Fallback: open download URL in new tab
374
+ const url = file_manager.callbacks.get_download_url(attachment.file_id, attachment.visibility);
375
+ window.open(url, '_blank');
376
+ }
377
+ }, [PdfViewer, file_manager]);
378
+ // Clarification state
379
+ const { items: clarification_items, counts: clarification_counts, remove_doc_reference } = use_clarifications(form_data, callbacks.on_form_data_change);
380
+ // Merge remove_doc_reference into clarification_callbacks
381
+ const merged_clarification_callbacks = useMemo(() => {
382
+ if (!clarification_callbacks && !remove_doc_reference)
383
+ return undefined;
384
+ return {
385
+ ...clarification_callbacks,
386
+ on_doc_delete: remove_doc_reference,
387
+ };
388
+ }, [clarification_callbacks, remove_doc_reference]);
389
+ // Scroll to clarification section
390
+ const handle_scroll_to_clarifications = useCallback(() => {
391
+ clarification_section_ref.current?.scrollIntoView({ behavior: 'smooth' });
392
+ }, []);
393
+ // Scroll to a field by ID (used by clarification card field linking)
394
+ const handle_field_click = useCallback((field_id) => {
395
+ const el = document.querySelector(`[data-field-id="${field_id}"]`);
396
+ if (el) {
397
+ el.scrollIntoView({ behavior: 'smooth', block: 'center' });
398
+ // Brief highlight
399
+ el.classList.add('ring-2', 'ring-amber-400', 'ring-offset-2');
400
+ setTimeout(() => el.classList.remove('ring-2', 'ring-amber-400', 'ring-offset-2'), 2000);
401
+ }
402
+ }, []);
180
403
  // Store original metadata on mount
181
404
  useEffect(() => {
182
405
  if (Object.keys(original_metadata_ref.current).length === 0) {
@@ -203,6 +426,6 @@ export function SummaryView() {
203
426
  callbacks.on_data_ok_change?.(field_id, original_data_ok ?? 'not_ok');
204
427
  });
205
428
  }, [all_field_ids, callbacks]);
206
- return (_jsxs("div", { className: "cls_form_view_summary space-y-4", children: [_jsx("div", { className: "border rounded-lg bg-card shadow-sm p-4", children: _jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsxs("button", { onClick: handle_all_ok, className: "flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50 transition-colors", children: ["All", _jsx(IoCheckmarkCircle, { className: "w-4 h-4" })] }), _jsxs("button", { onClick: handle_all_not_ok, className: "flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-red-100 text-red-700 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 dark:hover:bg-red-900/50 transition-colors", children: ["All", _jsx(IoCloseCircle, { className: "w-4 h-4" })] }), _jsx("button", { onClick: handle_clear, className: "px-3 py-1.5 text-sm font-medium rounded-md bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 transition-colors", children: "Clear" })] }) }), sections.map((section, index) => (_jsx(SummarySection, { section: section, section_index: index }, `${section.section_name || 'section'}_${index}`)))] }));
429
+ return (_jsxs(FilePreviewContext.Provider, { value: handle_file_preview, children: [_jsxs("div", { className: "cls_form_view_summary space-y-4", children: [_jsx("div", { className: "border rounded-lg bg-card shadow-sm p-4", children: _jsxs("div", { className: "flex items-center justify-between gap-2", children: [enable_clarifications && clarification_counts.pending > 0 && (_jsxs("button", { onClick: handle_scroll_to_clarifications, className: "flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50 transition-colors", children: [_jsx(IoAlertCircle, { className: "w-4 h-4" }), "Clarifications (", clarification_counts.pending, " pending)"] })), !(enable_clarifications && clarification_counts.pending > 0) && _jsx("div", {}), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("button", { onClick: handle_all_ok, className: "flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50 transition-colors", children: ["All", _jsx(IoCheckmarkCircle, { className: "w-4 h-4" })] }), _jsxs("button", { onClick: handle_all_not_ok, className: "flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-red-100 text-red-700 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 dark:hover:bg-red-900/50 transition-colors", children: ["All", _jsx(IoCloseCircle, { className: "w-4 h-4" })] }), _jsx("button", { onClick: handle_clear, className: "px-3 py-1.5 text-sm font-medium rounded-md bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 transition-colors", children: "Clear" })] })] }) }), sections.map((section, index) => (_jsx(SummarySection, { section: section, section_index: index }, `${section.section_name || 'section'}_${index}`))), enable_clarifications && clarification_items.length > 0 && (_jsx("div", { ref: clarification_section_ref, children: _jsx(ClarificationSection, { items: clarification_items, counts: clarification_counts, callbacks: merged_clarification_callbacks, on_field_click: handle_field_click }) }))] }), PdfViewer && preview_file && file_manager?.callbacks.get_download_url && (_jsx(PdfPreviewDialog, { PdfViewerComponent: PdfViewer, open: !!preview_file, on_close: () => set_preview_file(null), url: file_manager.callbacks.get_download_url(preview_file.file_id, preview_file.visibility), file_name: preview_file.file_name }))] }));
207
430
  }
208
431
  //# sourceMappingURL=summary_view.js.map