@caribeng/ui 22.2.0 → 22.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/README.md +311 -231
  2. package/fesm2022/caribeng-ui-accordion.mjs +2 -2
  3. package/fesm2022/caribeng-ui-account-picker.mjs +533 -0
  4. package/fesm2022/caribeng-ui-aging.mjs +488 -0
  5. package/fesm2022/{caribeng-ui-caribe-alert.mjs → caribeng-ui-alert.mjs} +45 -45
  6. package/fesm2022/caribeng-ui-amount.mjs +249 -0
  7. package/fesm2022/caribeng-ui-anchor.mjs +2 -2
  8. package/fesm2022/{caribeng-ui-caribe-animation-lottie.mjs → caribeng-ui-animation-lottie.mjs} +41 -41
  9. package/fesm2022/caribeng-ui-audit-log.mjs +323 -0
  10. package/fesm2022/caribeng-ui-avatar.mjs +4 -4
  11. package/fesm2022/caribeng-ui-badge.mjs +8 -2
  12. package/fesm2022/caribeng-ui-breadcrumb.mjs +26 -9
  13. package/fesm2022/{caribeng-ui-caribe-button-group.mjs → caribeng-ui-button-group.mjs} +15 -15
  14. package/fesm2022/caribeng-ui-button.mjs +2 -2
  15. package/fesm2022/{caribeng-ui-caribe-card-content.mjs → caribeng-ui-card-content.mjs} +39 -39
  16. package/fesm2022/{caribeng-ui-caribe-card-move.mjs → caribeng-ui-card-move.mjs} +65 -65
  17. package/fesm2022/{caribeng-ui-caribe-card-primary.mjs → caribeng-ui-card-primary.mjs} +31 -31
  18. package/fesm2022/{caribeng-ui-caribe-card-select.mjs → caribeng-ui-card-select.mjs} +67 -67
  19. package/fesm2022/caribeng-ui-carousel.mjs +2 -2
  20. package/fesm2022/caribeng-ui-cascadeselect.mjs +45 -9
  21. package/fesm2022/caribeng-ui-chart.mjs +8 -5
  22. package/fesm2022/caribeng-ui-chat.mjs +1303 -0
  23. package/fesm2022/{caribeng-ui-caribe-coachmark.mjs → caribeng-ui-coachmark.mjs} +85 -85
  24. package/fesm2022/caribeng-ui-code-block.mjs +332 -0
  25. package/fesm2022/caribeng-ui-colorpicker.mjs +99 -5
  26. package/fesm2022/caribeng-ui-command-palette.mjs +476 -0
  27. package/fesm2022/caribeng-ui-comments.mjs +864 -0
  28. package/fesm2022/caribeng-ui-confirmdialog.mjs +78 -13
  29. package/fesm2022/caribeng-ui-confirmpopup.mjs +91 -16
  30. package/fesm2022/caribeng-ui-contextmenu.mjs +8 -4
  31. package/fesm2022/caribeng-ui-copy-button.mjs +230 -0
  32. package/fesm2022/caribeng-ui-datagrid.mjs +1635 -0
  33. package/fesm2022/caribeng-ui-dataview.mjs +6 -3
  34. package/fesm2022/caribeng-ui-datepicker.mjs +2 -2
  35. package/fesm2022/caribeng-ui-dock.mjs +52 -12
  36. package/fesm2022/caribeng-ui-document.mjs +495 -0
  37. package/fesm2022/{caribeng-ui-caribe-dots-indicator.mjs → caribeng-ui-dots-indicator.mjs} +41 -41
  38. package/fesm2022/caribeng-ui-drawer.mjs +9 -4
  39. package/fesm2022/caribeng-ui-dynamic-form.mjs +1581 -0
  40. package/fesm2022/caribeng-ui-editor.mjs +2324 -1311
  41. package/fesm2022/{caribeng-ui-caribe-expansion-panel.mjs → caribeng-ui-expansion-panel.mjs} +39 -39
  42. package/fesm2022/{caribeng-ui-caribe-fab-menu.mjs → caribeng-ui-fab-menu.mjs} +75 -75
  43. package/fesm2022/caribeng-ui-fieldset.mjs +2 -2
  44. package/fesm2022/caribeng-ui-file-card.mjs +134 -17
  45. package/fesm2022/{caribeng-ui-caribe-file-download.mjs → caribeng-ui-file-download.mjs} +63 -63
  46. package/fesm2022/caribeng-ui-financial-report.mjs +380 -0
  47. package/fesm2022/{caribeng-ui-caribe-float-menu.mjs → caribeng-ui-float-menu.mjs} +31 -31
  48. package/fesm2022/caribeng-ui-floatlabel.mjs +2 -2
  49. package/fesm2022/caribeng-ui-flow.mjs +1508 -0
  50. package/fesm2022/caribeng-ui-folder-card.mjs +122 -12
  51. package/fesm2022/{caribeng-ui-caribe-footer.mjs → caribeng-ui-footer.mjs} +19 -19
  52. package/fesm2022/caribeng-ui-gantt.mjs +1094 -0
  53. package/fesm2022/{caribeng-ui-caribe-header.mjs → caribeng-ui-header.mjs} +49 -49
  54. package/fesm2022/{caribeng-ui-caribe-icon-button.mjs → caribeng-ui-icon-button.mjs} +23 -23
  55. package/fesm2022/caribeng-ui-image-cropper.mjs +671 -0
  56. package/fesm2022/caribeng-ui-import-wizard.mjs +746 -0
  57. package/fesm2022/caribeng-ui-infinite-scroll.mjs +226 -0
  58. package/fesm2022/caribeng-ui-inlinemessage.mjs +2 -2
  59. package/fesm2022/caribeng-ui-input-number.mjs +22 -6
  60. package/fesm2022/{caribeng-ui-caribe-input-search.mjs → caribeng-ui-input-search.mjs} +65 -65
  61. package/fesm2022/{caribeng-ui-caribe-input-token.mjs → caribeng-ui-input-token.mjs} +59 -59
  62. package/fesm2022/caribeng-ui-inputmask.mjs +8 -2
  63. package/fesm2022/caribeng-ui-inputotp.mjs +2 -2
  64. package/fesm2022/caribeng-ui-journal-entry.mjs +340 -0
  65. package/fesm2022/caribeng-ui-kanban.mjs +4612 -0
  66. package/fesm2022/caribeng-ui-kbd.mjs +122 -0
  67. package/fesm2022/caribeng-ui-kpi.mjs +189 -0
  68. package/fesm2022/{caribeng-ui-caribe-link.mjs → caribeng-ui-link.mjs} +37 -37
  69. package/fesm2022/caribeng-ui-masonry.mjs +93 -0
  70. package/fesm2022/caribeng-ui-media-player.mjs +821 -0
  71. package/fesm2022/caribeng-ui-megamenu.mjs +13 -9
  72. package/fesm2022/caribeng-ui-mentions.mjs +495 -0
  73. package/fesm2022/caribeng-ui-menu.mjs +8 -4
  74. package/fesm2022/caribeng-ui-menubar.mjs +9 -5
  75. package/fesm2022/caribeng-ui-message.mjs +6 -3
  76. package/fesm2022/caribeng-ui-notification-center.mjs +636 -0
  77. package/fesm2022/{caribeng-ui-caribe-off-canvas.mjs → caribeng-ui-off-canvas.mjs} +55 -55
  78. package/fesm2022/{caribeng-ui-caribe-onboarding.mjs → caribeng-ui-onboarding.mjs} +105 -105
  79. package/fesm2022/caribeng-ui-orderlist.mjs +2 -2
  80. package/fesm2022/caribeng-ui-organizationchart.mjs +6 -10
  81. package/fesm2022/caribeng-ui-panel.mjs +6 -6
  82. package/fesm2022/caribeng-ui-panelmenu.mjs +9 -6
  83. package/fesm2022/caribeng-ui-pdfviewer.mjs +1755 -25
  84. package/fesm2022/caribeng-ui-period-picker.mjs +637 -0
  85. package/fesm2022/caribeng-ui-phone-input.mjs +688 -0
  86. package/fesm2022/caribeng-ui-picklist.mjs +2 -2
  87. package/fesm2022/caribeng-ui-pivot.mjs +419 -0
  88. package/fesm2022/caribeng-ui-pricing.mjs +263 -69
  89. package/fesm2022/caribeng-ui-qrcode.mjs +564 -0
  90. package/fesm2022/caribeng-ui-rating.mjs +14 -17
  91. package/fesm2022/caribeng-ui-reconciliation.mjs +386 -0
  92. package/fesm2022/caribeng-ui-ripple.mjs +2 -0
  93. package/fesm2022/caribeng-ui-scheduler.mjs +1027 -0
  94. package/fesm2022/caribeng-ui-scrolltop.mjs +3 -1
  95. package/fesm2022/caribeng-ui-select.mjs +2 -2
  96. package/fesm2022/{caribeng-ui-caribe-shortcut.mjs → caribeng-ui-shortcut.mjs} +29 -29
  97. package/fesm2022/caribeng-ui-sidebar.mjs +573 -0
  98. package/fesm2022/caribeng-ui-signature-pad.mjs +654 -0
  99. package/fesm2022/{caribeng-ui-caribe-status.mjs → caribeng-ui-status.mjs} +11 -11
  100. package/fesm2022/{caribeng-ui-caribe-step-indicator.mjs → caribeng-ui-step-indicator.mjs} +53 -53
  101. package/fesm2022/caribeng-ui-stepper.mjs +12 -5
  102. package/fesm2022/caribeng-ui-steps.mjs +2 -2
  103. package/fesm2022/caribeng-ui-table.mjs +333 -19
  104. package/fesm2022/caribeng-ui-tabmenu.mjs +10 -6
  105. package/fesm2022/caribeng-ui-tabs.mjs +2 -2
  106. package/fesm2022/{caribeng-ui-caribe-tag-button.mjs → caribeng-ui-tag-button.mjs} +25 -25
  107. package/fesm2022/caribeng-ui-tag.mjs +2 -2
  108. package/fesm2022/caribeng-ui-tieredmenu.mjs +111 -21
  109. package/fesm2022/{caribeng-ui-caribe-tracker.mjs → caribeng-ui-tracker.mjs} +29 -29
  110. package/fesm2022/{caribeng-ui-caribe-transaction-status.mjs → caribeng-ui-transaction-status.mjs} +11 -11
  111. package/fesm2022/caribeng-ui-treeselect.mjs +44 -9
  112. package/fesm2022/caribeng-ui-treetable.mjs +236 -17
  113. package/fesm2022/{caribeng-ui-caribe-voucher.mjs → caribeng-ui-voucher.mjs} +45 -45
  114. package/fesm2022/caribeng-ui-xlsx.mjs +486 -0
  115. package/fesm2022/caribeng-ui.mjs +1568 -1
  116. package/package.json +258 -178
  117. package/schematics/collection.json +5 -0
  118. package/schematics/migrate-from-primeng/core-icons.json +1 -0
  119. package/schematics/migrate-from-primeng/icons.js +269 -0
  120. package/schematics/migrate-from-primeng/index.js +290 -0
  121. package/schematics/migrate-from-primeng/mappings/button.js +93 -0
  122. package/schematics/migrate-from-primeng/mappings/card.js +33 -0
  123. package/schematics/migrate-from-primeng/mappings/checkbox.js +44 -0
  124. package/schematics/migrate-from-primeng/mappings/confirm.js +221 -0
  125. package/schematics/migrate-from-primeng/mappings/datepicker.js +121 -0
  126. package/schematics/migrate-from-primeng/mappings/dialog.js +84 -0
  127. package/schematics/migrate-from-primeng/mappings/index.js +88 -0
  128. package/schematics/migrate-from-primeng/mappings/inputnumber.js +62 -0
  129. package/schematics/migrate-from-primeng/mappings/inputtext.js +60 -0
  130. package/schematics/migrate-from-primeng/mappings/menu.js +468 -0
  131. package/schematics/migrate-from-primeng/mappings/multiselect.js +49 -0
  132. package/schematics/migrate-from-primeng/mappings/radiobutton.js +22 -0
  133. package/schematics/migrate-from-primeng/mappings/rules.js +206 -0
  134. package/schematics/migrate-from-primeng/mappings/select.js +97 -0
  135. package/schematics/migrate-from-primeng/mappings/service-calls.js +100 -0
  136. package/schematics/migrate-from-primeng/mappings/table.js +613 -0
  137. package/schematics/migrate-from-primeng/mappings/tabs.js +225 -0
  138. package/schematics/migrate-from-primeng/mappings/tag.js +29 -0
  139. package/schematics/migrate-from-primeng/mappings/textarea.js +44 -0
  140. package/schematics/migrate-from-primeng/mappings/toast.js +173 -0
  141. package/schematics/migrate-from-primeng/mappings/toggleswitch.js +37 -0
  142. package/schematics/migrate-from-primeng/mappings/tooltip.js +44 -0
  143. package/schematics/migrate-from-primeng/mappings/types.js +10 -0
  144. package/schematics/migrate-from-primeng/report.js +79 -0
  145. package/schematics/migrate-from-primeng/schema.js +2 -0
  146. package/schematics/migrate-from-primeng/schema.json +34 -0
  147. package/schematics/migrate-from-primeng/template.js +387 -0
  148. package/schematics/migrate-from-primeng/todo.js +5 -0
  149. package/schematics/migrate-from-primeng/typescript.js +442 -0
  150. package/schematics/migrate-from-primeng/workspace.js +117 -0
  151. package/schematics/ng-add/index.js +16 -1
  152. package/types/caribeng-ui-account-picker.d.ts +142 -0
  153. package/types/caribeng-ui-aging.d.ts +123 -0
  154. package/types/{caribeng-ui-caribe-alert.d.ts → caribeng-ui-alert.d.ts} +2 -2
  155. package/types/caribeng-ui-amount.d.ts +82 -0
  156. package/types/{caribeng-ui-caribe-animation-lottie.d.ts → caribeng-ui-animation-lottie.d.ts} +2 -2
  157. package/types/caribeng-ui-audit-log.d.ts +86 -0
  158. package/types/caribeng-ui-badge.d.ts +3 -1
  159. package/types/caribeng-ui-breadcrumb.d.ts +9 -1
  160. package/types/{caribeng-ui-caribe-button-group.d.ts → caribeng-ui-button-group.d.ts} +2 -2
  161. package/types/{caribeng-ui-caribe-card-content.d.ts → caribeng-ui-card-content.d.ts} +2 -2
  162. package/types/{caribeng-ui-caribe-card-move.d.ts → caribeng-ui-card-move.d.ts} +1 -1
  163. package/types/{caribeng-ui-caribe-card-primary.d.ts → caribeng-ui-card-primary.d.ts} +2 -2
  164. package/types/{caribeng-ui-caribe-card-select.d.ts → caribeng-ui-card-select.d.ts} +2 -2
  165. package/types/caribeng-ui-cascadeselect.d.ts +6 -0
  166. package/types/caribeng-ui-chart.d.ts +3 -1
  167. package/types/caribeng-ui-chat.d.ts +299 -0
  168. package/types/{caribeng-ui-caribe-coachmark.d.ts → caribeng-ui-coachmark.d.ts} +2 -2
  169. package/types/caribeng-ui-code-block.d.ts +65 -0
  170. package/types/caribeng-ui-colorpicker.d.ts +5 -1
  171. package/types/caribeng-ui-command-palette.d.ts +133 -0
  172. package/types/caribeng-ui-comments.d.ts +214 -0
  173. package/types/caribeng-ui-confirmdialog.d.ts +34 -2
  174. package/types/caribeng-ui-confirmpopup.d.ts +39 -2
  175. package/types/caribeng-ui-contextmenu.d.ts +7 -0
  176. package/types/caribeng-ui-copy-button.d.ts +90 -0
  177. package/types/caribeng-ui-datagrid.d.ts +269 -0
  178. package/types/caribeng-ui-dataview.d.ts +2 -0
  179. package/types/caribeng-ui-dock.d.ts +13 -1
  180. package/types/caribeng-ui-document.d.ts +138 -0
  181. package/types/{caribeng-ui-caribe-dots-indicator.d.ts → caribeng-ui-dots-indicator.d.ts} +2 -2
  182. package/types/caribeng-ui-drawer.d.ts +3 -1
  183. package/types/caribeng-ui-dynamic-form.d.ts +409 -0
  184. package/types/caribeng-ui-editor.d.ts +110 -12
  185. package/types/{caribeng-ui-caribe-expansion-panel.d.ts → caribeng-ui-expansion-panel.d.ts} +1 -1
  186. package/types/{caribeng-ui-caribe-fab-menu.d.ts → caribeng-ui-fab-menu.d.ts} +2 -2
  187. package/types/caribeng-ui-file-card.d.ts +27 -2
  188. package/types/{caribeng-ui-caribe-file-download.d.ts → caribeng-ui-file-download.d.ts} +1 -1
  189. package/types/caribeng-ui-financial-report.d.ts +102 -0
  190. package/types/{caribeng-ui-caribe-float-menu.d.ts → caribeng-ui-float-menu.d.ts} +2 -2
  191. package/types/caribeng-ui-flow.d.ts +228 -0
  192. package/types/caribeng-ui-folder-card.d.ts +27 -5
  193. package/types/{caribeng-ui-caribe-footer.d.ts → caribeng-ui-footer.d.ts} +2 -2
  194. package/types/caribeng-ui-gantt.d.ts +244 -0
  195. package/types/{caribeng-ui-caribe-header.d.ts → caribeng-ui-header.d.ts} +2 -2
  196. package/types/{caribeng-ui-caribe-icon-button.d.ts → caribeng-ui-icon-button.d.ts} +2 -2
  197. package/types/{caribeng-ui-caribe-illustration.d.ts → caribeng-ui-illustration.d.ts} +1 -1
  198. package/types/caribeng-ui-image-cropper.d.ts +169 -0
  199. package/types/caribeng-ui-import-wizard.d.ts +149 -0
  200. package/types/caribeng-ui-infinite-scroll.d.ts +75 -0
  201. package/types/caribeng-ui-input-number.d.ts +1 -1
  202. package/types/{caribeng-ui-caribe-input-search.d.ts → caribeng-ui-input-search.d.ts} +2 -2
  203. package/types/{caribeng-ui-caribe-input-token.d.ts → caribeng-ui-input-token.d.ts} +2 -2
  204. package/types/caribeng-ui-inputmask.d.ts +3 -1
  205. package/types/caribeng-ui-journal-entry.d.ts +110 -0
  206. package/types/caribeng-ui-kanban.d.ts +783 -0
  207. package/types/caribeng-ui-kbd.d.ts +36 -0
  208. package/types/caribeng-ui-kpi.d.ts +64 -0
  209. package/types/{caribeng-ui-caribe-link.d.ts → caribeng-ui-link.d.ts} +2 -2
  210. package/types/{caribeng-ui-caribe-logo.d.ts → caribeng-ui-logo.d.ts} +1 -1
  211. package/types/caribeng-ui-masonry.d.ts +32 -0
  212. package/types/caribeng-ui-media-player.d.ts +140 -0
  213. package/types/caribeng-ui-megamenu.d.ts +11 -0
  214. package/types/caribeng-ui-mentions.d.ts +127 -0
  215. package/types/caribeng-ui-menu.d.ts +7 -0
  216. package/types/caribeng-ui-menubar.d.ts +7 -0
  217. package/types/caribeng-ui-message.d.ts +2 -0
  218. package/types/caribeng-ui-notification-center.d.ts +153 -0
  219. package/types/{caribeng-ui-caribe-off-canvas.d.ts → caribeng-ui-off-canvas.d.ts} +2 -2
  220. package/types/{caribeng-ui-caribe-onboarding.d.ts → caribeng-ui-onboarding.d.ts} +2 -2
  221. package/types/caribeng-ui-panelmenu.d.ts +7 -0
  222. package/types/caribeng-ui-pdfviewer.d.ts +245 -5
  223. package/types/caribeng-ui-period-picker.d.ts +148 -0
  224. package/types/caribeng-ui-phone-input.d.ts +168 -0
  225. package/types/caribeng-ui-pivot.d.ts +116 -0
  226. package/types/caribeng-ui-pricing.d.ts +41 -4
  227. package/types/caribeng-ui-qrcode.d.ts +88 -0
  228. package/types/caribeng-ui-reconciliation.d.ts +109 -0
  229. package/types/caribeng-ui-scheduler.d.ts +188 -0
  230. package/types/{caribeng-ui-caribe-shortcut.d.ts → caribeng-ui-shortcut.d.ts} +2 -2
  231. package/types/caribeng-ui-sidebar.d.ts +167 -0
  232. package/types/caribeng-ui-signature-pad.d.ts +151 -0
  233. package/types/{caribeng-ui-caribe-status.d.ts → caribeng-ui-status.d.ts} +2 -2
  234. package/types/{caribeng-ui-caribe-step-indicator.d.ts → caribeng-ui-step-indicator.d.ts} +2 -2
  235. package/types/caribeng-ui-stepper.d.ts +2 -0
  236. package/types/caribeng-ui-table.d.ts +67 -3
  237. package/types/caribeng-ui-tabmenu.d.ts +7 -0
  238. package/types/{caribeng-ui-caribe-tag-button.d.ts → caribeng-ui-tag-button.d.ts} +2 -2
  239. package/types/caribeng-ui-tieredmenu.d.ts +17 -1
  240. package/types/{caribeng-ui-caribe-tracker.d.ts → caribeng-ui-tracker.d.ts} +2 -2
  241. package/types/{caribeng-ui-caribe-transaction-status.d.ts → caribeng-ui-transaction-status.d.ts} +2 -2
  242. package/types/caribeng-ui-treeselect.d.ts +6 -0
  243. package/types/caribeng-ui-treetable.d.ts +67 -2
  244. package/types/{caribeng-ui-caribe-voucher.d.ts → caribeng-ui-voucher.d.ts} +2 -2
  245. package/types/caribeng-ui-xlsx.d.ts +79 -0
  246. package/types/caribeng-ui.d.ts +985 -2
  247. package/fesm2022/caribeng-ui-caribe-calendar.mjs +0 -92
  248. package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +0 -130
  249. package/fesm2022/caribeng-ui-caribe-data-table.mjs +0 -94
  250. package/fesm2022/caribeng-ui-caribe-file-select.mjs +0 -88
  251. package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +0 -100
  252. package/fesm2022/caribeng-ui-caribe-input-date.mjs +0 -138
  253. package/fesm2022/caribeng-ui-caribe-input-select.mjs +0 -154
  254. package/fesm2022/caribeng-ui-caribe-loader.mjs +0 -48
  255. package/fesm2022/caribeng-ui-caribe-modal.mjs +0 -119
  256. package/fesm2022/caribeng-ui-caribe-pictogram.mjs +0 -52
  257. package/fesm2022/caribeng-ui-caribe-pop-over.mjs +0 -104
  258. package/fesm2022/caribeng-ui-caribe-preloader.mjs +0 -57
  259. package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +0 -84
  260. package/fesm2022/caribeng-ui-caribe-stroke.mjs +0 -69
  261. package/fesm2022/caribeng-ui-caribe-switch.mjs +0 -182
  262. package/styles/caribeng.css +0 -380
  263. package/styles/scss/_mixins.scss +0 -46
  264. package/styles/scss/_overlay.scss +0 -15
  265. package/styles/scss/_tokens.scss +0 -267
  266. package/styles/scss/_utilities.scss +0 -73
  267. package/styles/scss/_variables.scss +0 -33
  268. package/styles/scss/index.scss +0 -16
  269. package/types/caribeng-ui-caribe-calendar.d.ts +0 -27
  270. package/types/caribeng-ui-caribe-circle-loading.d.ts +0 -28
  271. package/types/caribeng-ui-caribe-data-table.d.ts +0 -26
  272. package/types/caribeng-ui-caribe-file-select.d.ts +0 -31
  273. package/types/caribeng-ui-caribe-inline-alert.d.ts +0 -28
  274. package/types/caribeng-ui-caribe-input-date.d.ts +0 -40
  275. package/types/caribeng-ui-caribe-input-select.d.ts +0 -47
  276. package/types/caribeng-ui-caribe-loader.d.ts +0 -22
  277. package/types/caribeng-ui-caribe-modal.d.ts +0 -21
  278. package/types/caribeng-ui-caribe-pictogram.d.ts +0 -15
  279. package/types/caribeng-ui-caribe-pop-over.d.ts +0 -17
  280. package/types/caribeng-ui-caribe-preloader.d.ts +0 -24
  281. package/types/caribeng-ui-caribe-progress-bar.d.ts +0 -28
  282. package/types/caribeng-ui-caribe-stroke.d.ts +0 -17
  283. package/types/caribeng-ui-caribe-switch.d.ts +0 -55
  284. /package/fesm2022/{caribeng-ui-caribe-illustration.mjs → caribeng-ui-illustration.mjs} +0 -0
  285. /package/fesm2022/{caribeng-ui-caribe-logo.mjs → caribeng-ui-logo.mjs} +0 -0
@@ -0,0 +1,864 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, Injector, model, input, booleanAttribute, output, computed, signal, DestroyRef, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { NgTemplateOutlet } from '@angular/common';
4
+ import { DomSanitizer } from '@angular/platform-browser';
5
+ import { injectCbTranslation, cbFormat, cbRelativeTime } from '@caribeng/ui';
6
+ import { CbAvatar } from '@caribeng/ui/avatar';
7
+ import { cbSanitizeHtml, cbHtmlToText, CbEditor } from '@caribeng/ui/editor';
8
+ import { CbIconRegistry, CbIcon } from '@caribeng/ui/icon';
9
+ import { messageSquare, reply } from '@caribeng/ui/icons';
10
+
11
+ function toTime(date) {
12
+ if (!date)
13
+ return 0;
14
+ const t = (date instanceof Date ? date : new Date(date)).getTime();
15
+ return Number.isNaN(t) ? 0 : t;
16
+ }
17
+ /**
18
+ * Hilo ordenado por fecha: comentarios raíz (con sus respuestas, siempre de la más antigua a la
19
+ * más reciente) y actividad. Una respuesta cuyo padre no existe se muestra como comentario raíz.
20
+ */
21
+ function buildFeed(comments, activity, filter, order) {
22
+ const ids = new Set(comments.map((c) => c.id));
23
+ const replies = new Map();
24
+ for (const c of comments) {
25
+ if (c.parentId && ids.has(c.parentId)) {
26
+ const list = replies.get(c.parentId) ?? [];
27
+ list.push(c);
28
+ replies.set(c.parentId, list);
29
+ }
30
+ }
31
+ const items = [];
32
+ if (filter !== 'activity') {
33
+ for (const c of comments) {
34
+ if (c.parentId && ids.has(c.parentId))
35
+ continue;
36
+ const own = (replies.get(c.id) ?? []).sort((a, b) => toTime(a.date) - toTime(b.date));
37
+ // Un comentario eliminado sin respuestas no aporta nada.
38
+ if (c.deleted && !own.length)
39
+ continue;
40
+ items.push({ kind: 'comment', comment: c, replies: own, time: toTime(c.date) });
41
+ }
42
+ }
43
+ if (filter !== 'comments') {
44
+ for (const a of activity)
45
+ items.push({ kind: 'activity', activity: a, time: toTime(a.date) });
46
+ }
47
+ items.sort((a, b) => (order === 'oldest' ? a.time - b.time : b.time - a.time));
48
+ return items;
49
+ }
50
+ /** Ids de las personas mencionadas en un HTML (`data-mention`), sin repetir y en orden. */
51
+ function mentionIds(html) {
52
+ const found = [];
53
+ for (const m of html.matchAll(/data-mention="([^"]+)"/g)) {
54
+ if (!found.includes(m[1]))
55
+ found.push(m[1]);
56
+ }
57
+ return found;
58
+ }
59
+ /** Pone o quita la reacción `emoji` de `userId`; las reacciones que se quedan sin nadie desaparecen. */
60
+ function toggleReaction(reactions, emoji, userId) {
61
+ const list = [...(reactions ?? [])];
62
+ const i = list.findIndex((r) => r.emoji === emoji);
63
+ if (i < 0)
64
+ return { reactions: [...list, { emoji, by: [userId] }], added: true };
65
+ const had = list[i].by.includes(userId);
66
+ const by = had ? list[i].by.filter((id) => id !== userId) : [...list[i].by, userId];
67
+ if (by.length)
68
+ list[i] = { emoji, by };
69
+ else
70
+ list.splice(i, 1);
71
+ return { reactions: list, added: !had };
72
+ }
73
+ /**
74
+ * Elimina un comentario. Si tiene respuestas se conserva como "eliminado" para no romper el hilo;
75
+ * si era la última respuesta de un comentario ya eliminado, también desaparece el padre.
76
+ */
77
+ function removeComment(comments, id) {
78
+ const target = comments.find((c) => c.id === id);
79
+ if (!target)
80
+ return [...comments];
81
+ const hasReplies = comments.some((c) => c.parentId === id);
82
+ let next = hasReplies
83
+ ? comments.map((c) => (c.id === id ? { ...c, html: '', deleted: true, reactions: [] } : c))
84
+ : comments.filter((c) => c.id !== id);
85
+ const parent = target.parentId ? next.find((c) => c.id === target.parentId) : undefined;
86
+ if (parent?.deleted && !next.some((c) => c.parentId === parent.id))
87
+ next = next.filter((c) => c.id !== parent.id);
88
+ return next;
89
+ }
90
+ /** Id nuevo (UUID si el entorno lo permite). */
91
+ function newCommentId() {
92
+ const c = globalThis.crypto;
93
+ return c?.randomUUID ? c.randomUUID() : `cb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
94
+ }
95
+ /** Iniciales de un nombre ("Ana López" → "AL"). */
96
+ function initialsOf(name) {
97
+ const parts = name.trim().split(/\s+/).filter(Boolean);
98
+ return ((parts[0]?.[0] ?? '') + (parts.length > 1 ? parts[parts.length - 1][0] : '')).toUpperCase();
99
+ }
100
+
101
+ /** Lucide `smile-plus` (no está en el catálogo). */
102
+ const SMILE_PLUS = '<path d="M22 11v1a10 10 0 1 1-9-10" /><path d="M8 14s1.5 2 4 2 4-2 4-2" /><line x1="9" x2="9.01" y1="9" y2="9" /><line x1="15" x2="15.01" y1="9" y2="9" /><path d="M16 5h6" /><path d="M19 2v6" />';
103
+ /** Barra del editor por defecto: lo justo para un comentario. */
104
+ const CB_COMMENTS_TOOLBAR = ['bold', 'italic', 'strike', '|', 'bulletList', 'orderedList', '|', 'link', 'code'];
105
+ let nextUid = 0;
106
+ /**
107
+ * Hilo de comentarios y actividad de CaribeNG: comentarios con formato y @menciones
108
+ * (sobre `cb-editor`), respuestas de un nivel, reacciones con emoji, edición y borrado de los
109
+ * propios y, mezclado por fecha, el historial de cambios (`activity`).
110
+ *
111
+ * @example
112
+ * ```html
113
+ * <cb-comments [(comments)]="comentarios" [activity]="historial" [currentUser]="yo" [people]="equipo" />
114
+ * ```
115
+ */
116
+ class CbComments {
117
+ constructor() {
118
+ this.t = injectCbTranslation();
119
+ this.fmt = cbFormat;
120
+ this.host = inject(ElementRef);
121
+ this.injector = inject(Injector);
122
+ this.sanitizer = inject(DomSanitizer);
123
+ this.uid = `cb-comments-${++nextUid}`;
124
+ /** Comentarios (raíces y respuestas, en una lista plana). Se actualiza al publicar, editar, borrar o reaccionar. */
125
+ this.comments = model([], /* @ts-ignore */
126
+ ...(ngDevMode ? [{ debugName: "comments" }] : /* istanbul ignore next */ []));
127
+ /** Historial de cambios, que se intercala por fecha con los comentarios. */
128
+ this.activity = input([], /* @ts-ignore */
129
+ ...(ngDevMode ? [{ debugName: "activity" }] : /* istanbul ignore next */ []));
130
+ /** Quién escribe. Sin él, el hilo es de solo lectura. */
131
+ this.currentUser = input(null, /* @ts-ignore */
132
+ ...(ngDevMode ? [{ debugName: "currentUser" }] : /* istanbul ignore next */ []));
133
+ /** Personas que se pueden mencionar con `@` y cuyos nombres aparecen en las reacciones. */
134
+ this.people = input([], /* @ts-ignore */
135
+ ...(ngDevMode ? [{ debugName: "people" }] : /* istanbul ignore next */ []));
136
+ /** Fuente propia de menciones (lista o función, también asíncrona); sustituye a `people` para `@`. */
137
+ this.mentions = input(null, /* @ts-ignore */
138
+ ...(ngDevMode ? [{ debugName: "mentions" }] : /* istanbul ignore next */ []));
139
+ /** Qué se muestra: todo, solo comentarios o solo actividad. */
140
+ this.filter = model('all', /* @ts-ignore */
141
+ ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
142
+ /** Orden del hilo. Con `oldest` la caja para comentar va al final; con `newest`, arriba. */
143
+ this.order = input('oldest', /* @ts-ignore */
144
+ ...(ngDevMode ? [{ debugName: "order" }] : /* istanbul ignore next */ []));
145
+ /** Emojis para reaccionar (vacío para quitar las reacciones). */
146
+ this.reactions = input(['👍', '❤️', '🎉', '😄', '👀', '🙏'], /* @ts-ignore */
147
+ ...(ngDevMode ? [{ debugName: "reactions" }] : /* istanbul ignore next */ []));
148
+ /** Permite responder a un comentario. */
149
+ this.replies = input(true, { ...(ngDevMode ? { debugName: "replies" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
150
+ /** Permite editar y eliminar los comentarios propios. */
151
+ this.editable = input(true, { ...(ngDevMode ? { debugName: "editable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
152
+ /** Muestra la caja para comentar (con `false` solo se responde, edita y reacciona). */
153
+ this.composer = input(true, { ...(ngDevMode ? { debugName: "composer" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
154
+ this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
155
+ /** Herramientas del editor. */
156
+ this.toolbar = input(CB_COMMENTS_TOOLBAR, /* @ts-ignore */
157
+ ...(ngDevMode ? [{ debugName: "toolbar" }] : /* istanbul ignore next */ []));
158
+ /** Alto del área de escritura (crece hasta 16rem). */
159
+ this.editorHeight = input('4.5rem', /* @ts-ignore */
160
+ ...(ngDevMode ? [{ debugName: "editorHeight" }] : /* istanbul ignore next */ []));
161
+ this.placeholder = input(undefined, /* @ts-ignore */
162
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
163
+ this.emptyMessage = input(undefined, /* @ts-ignore */
164
+ ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
165
+ /** Nombre del hilo para lectores de pantalla (por defecto, "Comentarios y actividad"). */
166
+ this.ariaLabel = input('', /* @ts-ignore */
167
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
168
+ /** Comentario publicado (raíz o respuesta). */
169
+ this.commentAdd = output();
170
+ this.commentEdit = output();
171
+ this.commentDelete = output();
172
+ this.reactionToggle = output();
173
+ this.filters = ['all', 'comments', 'activity'];
174
+ this.feed = computed(() => buildFeed(this.comments(), this.activity(), this.filter(), this.order()), /* @ts-ignore */
175
+ ...(ngDevMode ? [{ debugName: "feed" }] : /* istanbul ignore next */ []));
176
+ this.showFilter = computed(() => this.activity().length > 0, /* @ts-ignore */
177
+ ...(ngDevMode ? [{ debugName: "showFilter" }] : /* istanbul ignore next */ []));
178
+ this.canAct = computed(() => !!this.currentUser() && !this.readonly(), /* @ts-ignore */
179
+ ...(ngDevMode ? [{ debugName: "canAct" }] : /* istanbul ignore next */ []));
180
+ this.mentionSource = computed(() => {
181
+ const own = this.mentions();
182
+ if (own)
183
+ return own;
184
+ const me = this.currentUser()?.id;
185
+ const list = this.people()
186
+ .filter((p) => p.id !== me)
187
+ .map((p) => ({ id: p.id, label: p.name, description: p.description }));
188
+ return list.length ? list : null;
189
+ }, /* @ts-ignore */
190
+ ...(ngDevMode ? [{ debugName: "mentionSource" }] : /* istanbul ignore next */ []));
191
+ this.names = computed(() => new Map(this.people().map((p) => [p.id, p.name])), /* @ts-ignore */
192
+ ...(ngDevMode ? [{ debugName: "names" }] : /* istanbul ignore next */ []));
193
+ /** Borradores abiertos, por clave (`new`, `reply:<id>`, `edit:<id>`). */
194
+ this.drafts = signal({}, /* @ts-ignore */
195
+ ...(ngDevMode ? [{ debugName: "drafts" }] : /* istanbul ignore next */ []));
196
+ /** Hilo al que se está respondiendo y comentario en edición. */
197
+ this.replyTo = signal(null, /* @ts-ignore */
198
+ ...(ngDevMode ? [{ debugName: "replyTo" }] : /* istanbul ignore next */ []));
199
+ this.editing = signal(null, /* @ts-ignore */
200
+ ...(ngDevMode ? [{ debugName: "editing" }] : /* istanbul ignore next */ []));
201
+ this.picker = signal(null, /* @ts-ignore */
202
+ ...(ngDevMode ? [{ debugName: "picker" }] : /* istanbul ignore next */ []));
203
+ this.confirming = signal(null, /* @ts-ignore */
204
+ ...(ngDevMode ? [{ debugName: "confirming" }] : /* istanbul ignore next */ []));
205
+ this.announcement = signal('', /* @ts-ignore */
206
+ ...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
207
+ /** Hora de referencia de las fechas relativas (se refresca cada minuto). */
208
+ this.now = signal(Date.now(), /* @ts-ignore */
209
+ ...(ngDevMode ? [{ debugName: "now" }] : /* istanbul ignore next */ []));
210
+ this.safeCache = new Map();
211
+ this.announceFlip = false;
212
+ const registry = inject(CbIconRegistry);
213
+ for (const [name, body] of Object.entries({ 'cb-smile-plus': SMILE_PLUS, reply, 'message-square': messageSquare })) {
214
+ if (!registry.has(name))
215
+ registry.register({ [name]: body });
216
+ }
217
+ const destroyRef = inject(DestroyRef);
218
+ afterNextRender(() => {
219
+ const timer = setInterval(() => this.now.set(Date.now()), 60_000);
220
+ destroyRef.onDestroy(() => clearInterval(timer));
221
+ });
222
+ }
223
+ // --- Plantilla ---
224
+ itemKey(item) {
225
+ return item.kind === 'comment' ? `c:${item.comment.id}` : `a:${item.activity.id}`;
226
+ }
227
+ domId(id) {
228
+ return `${this.uid}-${id.replace(/[^\w-]/g, '_')}`;
229
+ }
230
+ filterLabel(f) {
231
+ const t = this.t();
232
+ return f === 'all' ? t.commentsAll : f === 'comments' ? t.commentsOnly : t.commentsActivity;
233
+ }
234
+ initials(name) {
235
+ return initialsOf(name);
236
+ }
237
+ iso(date) {
238
+ const time = toTime(date);
239
+ return time ? new Date(time).toISOString() : '';
240
+ }
241
+ full(date) {
242
+ const time = toTime(date);
243
+ return time ? new Intl.DateTimeFormat(this.t().intlLocale, { dateStyle: 'full', timeStyle: 'short' }).format(time) : '';
244
+ }
245
+ rel(date) {
246
+ const time = toTime(date);
247
+ return time ? cbRelativeTime(time, this.now(), this.t().intlLocale, this.t().commentsJustNow) : '';
248
+ }
249
+ /** HTML del comentario, saneado (lista blanca del editor) y marcado como seguro una sola vez. */
250
+ safe(html) {
251
+ const me = this.currentUser()?.id;
252
+ const key = `${me ?? ''}\u0000${html}`;
253
+ let value = this.safeCache.get(key);
254
+ if (!value) {
255
+ let clean = cbSanitizeHtml(html);
256
+ // Las menciones a quien lee se resaltan.
257
+ if (me)
258
+ clean = clean.split(`data-mention="${me}"`).join(`data-mention="${me}" data-self=""`);
259
+ value = this.sanitizer.bypassSecurityTrustHtml(clean);
260
+ if (this.safeCache.size > 500)
261
+ this.safeCache.clear();
262
+ this.safeCache.set(key, value);
263
+ }
264
+ return value;
265
+ }
266
+ mine(r) {
267
+ const me = this.currentUser()?.id;
268
+ return !!me && r.by.includes(me);
269
+ }
270
+ mineEmoji(c, emoji) {
271
+ const r = c.reactions?.find((x) => x.emoji === emoji);
272
+ return !!r && this.mine(r);
273
+ }
274
+ /** "👍, 2: Ana López y tú". */
275
+ reactionLabel(r) {
276
+ const me = this.currentUser()?.id;
277
+ const who = r.by.map((id) => (id === me ? this.t().commentsYou : (this.names().get(id) ?? id)));
278
+ const list = new Intl.ListFormat(this.t().intlLocale, { type: 'conjunction' }).format(who);
279
+ return cbFormat(this.t().commentsReactionLabel, r.emoji, r.by.length, list);
280
+ }
281
+ canManage(c) {
282
+ return this.editable() && c.author.id === this.currentUser()?.id;
283
+ }
284
+ isReplying(id) {
285
+ return this.replyTo() === id;
286
+ }
287
+ isEditing(id) {
288
+ return this.editing() === id;
289
+ }
290
+ isEdit(d) {
291
+ return typeof d === 'object' && 'edit' in d;
292
+ }
293
+ draftKey(d) {
294
+ return d === 'new' ? 'new' : 'reply' in d ? `reply:${d.reply}` : `edit:${d.edit}`;
295
+ }
296
+ draftOf(d) {
297
+ return this.drafts()[this.draftKey(d)] ?? '';
298
+ }
299
+ setDraft(d, html) {
300
+ const key = this.draftKey(d);
301
+ this.drafts.update((all) => ({ ...all, [key]: html }));
302
+ }
303
+ isEmpty(html) {
304
+ return !cbHtmlToText(html).trim();
305
+ }
306
+ placeholderOf(d) {
307
+ if (d === 'new')
308
+ return this.placeholder() ?? this.t().commentsWrite;
309
+ return 'reply' in d ? this.t().commentsWriteReply : '';
310
+ }
311
+ editorLabel(d) {
312
+ if (d === 'new')
313
+ return this.t().commentsNew;
314
+ if ('reply' in d)
315
+ return cbFormat(this.t().commentsReplyTo, this.find(d.reply)?.author.name ?? '');
316
+ return this.t().commentsEditing;
317
+ }
318
+ // --- Acciones ---
319
+ /** Ctrl / ⌘ + Enter envía; Escape cancela la respuesta o la edición (salvo que lo use el editor). */
320
+ onEditorKeydown(event, d) {
321
+ if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
322
+ event.preventDefault();
323
+ this.submit(d);
324
+ }
325
+ else if (event.key === 'Escape' && d !== 'new' && !event.defaultPrevented) {
326
+ event.preventDefault();
327
+ this.cancelDraft(d);
328
+ }
329
+ }
330
+ submit(d) {
331
+ const html = cbSanitizeHtml(this.draftOf(d));
332
+ const me = this.currentUser();
333
+ if (!me || this.isEmpty(html))
334
+ return;
335
+ const now = new Date().toISOString();
336
+ if (this.isEdit(d)) {
337
+ const old = this.find(d.edit);
338
+ if (!old)
339
+ return;
340
+ const comment = { ...old, html, edited: now };
341
+ this.comments.update((list) => list.map((c) => (c.id === old.id ? comment : c)));
342
+ this.commentEdit.emit({ comment, mentions: mentionIds(html) });
343
+ this.editing.set(null);
344
+ this.announce(this.t().commentsSaved);
345
+ this.focusLater(`#${this.domId(old.id)}`);
346
+ }
347
+ else {
348
+ const parentId = d === 'new' ? undefined : d.reply;
349
+ const comment = { id: newCommentId(), author: me, html, date: now, ...(parentId ? { parentId } : {}) };
350
+ this.comments.update((list) => [...list, comment]);
351
+ this.commentAdd.emit({ comment, mentions: mentionIds(html) });
352
+ this.announce(this.t().commentsPosted);
353
+ if (parentId) {
354
+ this.replyTo.set(null);
355
+ this.focusLater(`#${this.domId(comment.id)}`);
356
+ }
357
+ }
358
+ this.clearDraft(d);
359
+ }
360
+ cancelDraft(d) {
361
+ this.clearDraft(d);
362
+ if (this.isEdit(d)) {
363
+ this.editing.set(null);
364
+ this.focusLater(`#${this.domId(d.edit)}-edit`);
365
+ }
366
+ else if (d !== 'new') {
367
+ this.replyTo.set(null);
368
+ this.focusLater(`#${this.domId(d.reply)}-reply`);
369
+ }
370
+ }
371
+ startReply(root) {
372
+ this.replyTo.set(root.id);
373
+ this.focusLater(`[data-draft="reply:${root.id}"] .cb-editor__surface`);
374
+ }
375
+ startEdit(c) {
376
+ this.setDraft({ edit: c.id }, c.html);
377
+ this.editing.set(c.id);
378
+ this.confirming.set(null);
379
+ this.focusLater(`[data-draft="edit:${c.id}"] .cb-editor__surface`);
380
+ }
381
+ askDelete(id) {
382
+ this.confirming.set(this.confirming() === id ? null : id);
383
+ if (this.confirming())
384
+ this.focusLater(`#${this.domId(id)}-confirm`);
385
+ }
386
+ cancelDelete(id) {
387
+ this.confirming.set(null);
388
+ this.focusLater(`#${this.domId(id)}-delete`);
389
+ }
390
+ confirmDelete(c) {
391
+ // Foco al comentario siguiente (o al anterior); si no queda ninguno, a la caja para comentar.
392
+ const articles = Array.from(this.host.nativeElement.querySelectorAll('.cb-comment'));
393
+ const i = articles.findIndex((a) => a.id === this.domId(c.id));
394
+ const next = articles[i + 1] ?? articles[i - 1];
395
+ this.confirming.set(null);
396
+ this.comments.update((list) => removeComment(list, c.id));
397
+ this.commentDelete.emit(c);
398
+ this.announce(this.t().commentsDeleted);
399
+ this.focusLater(next ? `#${next.id}` : '[data-draft="new"] .cb-editor__surface');
400
+ }
401
+ togglePicker(id) {
402
+ const open = this.picker() !== id;
403
+ this.picker.set(open ? id : null);
404
+ if (open)
405
+ this.focusLater(`#${this.domId(id)}-react + .cb-comment__picker .cb-comment__emoji`);
406
+ }
407
+ closePicker(id, event) {
408
+ event?.stopPropagation();
409
+ this.picker.set(null);
410
+ this.focusLater(`#${this.domId(id)}-react`);
411
+ }
412
+ /** El selector se cierra al salir de él con el teclado o el ratón. */
413
+ onPickerFocusOut(id, event) {
414
+ const wrap = event.currentTarget.parentElement;
415
+ const next = event.relatedTarget;
416
+ if (next && wrap?.contains(next))
417
+ return;
418
+ if (this.picker() === id)
419
+ this.picker.set(null);
420
+ }
421
+ react(c, emoji, fromPicker = false) {
422
+ const me = this.currentUser();
423
+ if (!me || this.readonly())
424
+ return;
425
+ const { reactions, added } = toggleReaction(c.reactions, emoji, me.id);
426
+ const comment = { ...c, reactions };
427
+ this.comments.update((list) => list.map((x) => (x.id === c.id ? comment : x)));
428
+ this.reactionToggle.emit({ comment, emoji, added });
429
+ if (fromPicker)
430
+ this.closePicker(c.id);
431
+ }
432
+ find(id) {
433
+ return this.comments().find((c) => c.id === id);
434
+ }
435
+ clearDraft(d) {
436
+ const key = this.draftKey(d);
437
+ this.drafts.update((all) => {
438
+ const { [key]: _, ...rest } = all;
439
+ return d === 'new' ? { ...rest, new: '' } : rest;
440
+ });
441
+ }
442
+ /** Un espacio duro alterno hace que el mismo texto cuente como cambio y se vuelva a anunciar. */
443
+ announce(text) {
444
+ this.announceFlip = !this.announceFlip;
445
+ this.announcement.set(this.announceFlip ? text : `${text} `);
446
+ }
447
+ focusLater(selector) {
448
+ afterNextRender(() => this.host.nativeElement.querySelector(selector)?.focus(), { injector: this.injector });
449
+ }
450
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbComments, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
451
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbComments, isStandalone: true, selector: "cb-comments", inputs: { comments: { classPropertyName: "comments", publicName: "comments", isSignal: true, isRequired: false, transformFunction: null }, activity: { classPropertyName: "activity", publicName: "activity", isSignal: true, isRequired: false, transformFunction: null }, currentUser: { classPropertyName: "currentUser", publicName: "currentUser", isSignal: true, isRequired: false, transformFunction: null }, people: { classPropertyName: "people", publicName: "people", isSignal: true, isRequired: false, transformFunction: null }, mentions: { classPropertyName: "mentions", publicName: "mentions", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, order: { classPropertyName: "order", publicName: "order", isSignal: true, isRequired: false, transformFunction: null }, reactions: { classPropertyName: "reactions", publicName: "reactions", isSignal: true, isRequired: false, transformFunction: null }, replies: { classPropertyName: "replies", publicName: "replies", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, composer: { classPropertyName: "composer", publicName: "composer", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, editorHeight: { classPropertyName: "editorHeight", publicName: "editorHeight", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { comments: "commentsChange", filter: "filterChange", commentAdd: "commentAdd", commentEdit: "commentEdit", commentDelete: "commentDelete", reactionToggle: "reactionToggle" }, host: { classAttribute: "cb-comments" }, ngImport: i0, template: `
452
+ <section class="cb-comments__box" [attr.aria-label]="ariaLabel() || t().commentsFeed">
453
+ @if (showFilter()) {
454
+ <div class="cb-comments__filter" role="group" [attr.aria-label]="t().commentsShow">
455
+ @for (f of filters; track f) {
456
+ <button type="button" class="cb-comments__filter-btn" [attr.aria-pressed]="filter() === f" (click)="filter.set(f)">
457
+ {{ filterLabel(f) }}
458
+ </button>
459
+ }
460
+ </div>
461
+ }
462
+
463
+ @if (order() === 'newest') {
464
+ <ng-container [ngTemplateOutlet]="composerTpl" />
465
+ }
466
+
467
+ @if (feed().length) {
468
+ <ol class="cb-comments__feed">
469
+ @for (item of feed(); track itemKey(item)) {
470
+ @if (item.kind === 'activity') {
471
+ <li class="cb-comments__activity">
472
+ <cb-icon class="cb-comments__activity-icon" [name]="item.activity.icon || 'clock'" [size]="14" aria-hidden="true" />
473
+ <span class="cb-comments__activity-text">
474
+ @if (item.activity.author; as who) {
475
+ <strong>{{ who.name }}</strong>
476
+ }
477
+ {{ item.activity.text }}
478
+ </span>
479
+ <time class="cb-comments__time" [attr.datetime]="iso(item.activity.date)" [attr.title]="full(item.activity.date)">{{ rel(item.activity.date) }}</time>
480
+ </li>
481
+ } @else {
482
+ <li class="cb-comments__thread">
483
+ <ng-container [ngTemplateOutlet]="commentTpl" [ngTemplateOutletContext]="{ $implicit: item.comment, root: true }" />
484
+ @if (item.replies.length) {
485
+ <ol class="cb-comments__replies" [attr.aria-label]="fmt(t().commentsRepliesTo, item.comment.author.name)">
486
+ @for (r of item.replies; track r.id) {
487
+ <li><ng-container [ngTemplateOutlet]="commentTpl" [ngTemplateOutletContext]="{ $implicit: r, root: false, parent: item.comment }" /></li>
488
+ }
489
+ </ol>
490
+ }
491
+ @if (isReplying(item.comment.id)) {
492
+ <div class="cb-comments__reply-composer">
493
+ <ng-container [ngTemplateOutlet]="editorTpl" [ngTemplateOutletContext]="{ $implicit: { reply: item.comment.id } }" />
494
+ </div>
495
+ }
496
+ </li>
497
+ }
498
+ }
499
+ </ol>
500
+ } @else {
501
+ <p class="cb-comments__empty">{{ emptyMessage() ?? t().commentsEmpty }}</p>
502
+ }
503
+
504
+ @if (order() === 'oldest') {
505
+ <ng-container [ngTemplateOutlet]="composerTpl" />
506
+ }
507
+
508
+ <div class="cb-comments__sr" aria-live="polite">{{ announcement() }}</div>
509
+ </section>
510
+
511
+ <!-- Comentario (raíz o respuesta). -->
512
+ <ng-template #commentTpl let-c let-root="root" let-parent="parent">
513
+ <article class="cb-comment" [class.cb-comment--deleted]="c.deleted" [id]="domId(c.id)" tabindex="-1" [attr.aria-labelledby]="domId(c.id) + '-h'">
514
+ <cb-avatar class="cb-comment__avatar" [image]="c.author.image ?? ''" [label]="initials(c.author.name)" [size]="root ? 32 : 26" aria-hidden="true" />
515
+ <div class="cb-comment__main">
516
+ <div class="cb-comment__head" [id]="domId(c.id) + '-h'">
517
+ @if (!c.deleted) {
518
+ <span class="cb-comment__author">{{ c.author.name }}</span>
519
+ }
520
+ <time class="cb-comments__time" [attr.datetime]="iso(c.date)" [attr.title]="full(c.date)">{{ rel(c.date) }}</time>
521
+ @if (c.edited && !c.deleted) {
522
+ <span class="cb-comment__edited">({{ t().commentsEdited }})</span>
523
+ }
524
+ </div>
525
+
526
+ @if (c.deleted) {
527
+ <p class="cb-comment__deleted">{{ t().commentsDeleted }}</p>
528
+ } @else if (isEditing(c.id)) {
529
+ <ng-container [ngTemplateOutlet]="editorTpl" [ngTemplateOutletContext]="{ $implicit: { edit: c.id } }" />
530
+ } @else {
531
+ <div class="cb-comment__body" [innerHTML]="safe(c.html)"></div>
532
+
533
+ @if (c.reactions?.length || canAct()) {
534
+ <div class="cb-comment__footer">
535
+ @for (r of c.reactions ?? []; track r.emoji) {
536
+ <button
537
+ type="button"
538
+ class="cb-comment__reaction"
539
+ [attr.aria-pressed]="mine(r)"
540
+ [attr.aria-label]="reactionLabel(r)"
541
+ [attr.title]="reactionLabel(r)"
542
+ [disabled]="!canAct()"
543
+ (click)="react(c, r.emoji)"
544
+ >
545
+ <span aria-hidden="true">{{ r.emoji }}</span>
546
+ <span aria-hidden="true">{{ r.by.length }}</span>
547
+ </button>
548
+ }
549
+ @if (canAct()) {
550
+ @if (reactions().length) {
551
+ <span class="cb-comment__picker-wrap">
552
+ <button
553
+ type="button"
554
+ class="cb-comment__action cb-comment__action--icon"
555
+ [id]="domId(c.id) + '-react'"
556
+ [attr.aria-label]="t().commentsAddReaction"
557
+ [attr.title]="t().commentsAddReaction"
558
+ [attr.aria-expanded]="picker() === c.id"
559
+ (click)="togglePicker(c.id)"
560
+ >
561
+ <cb-icon name="cb-smile-plus" [size]="15" aria-hidden="true" />
562
+ </button>
563
+ @if (picker() === c.id) {
564
+ <span
565
+ class="cb-comment__picker"
566
+ role="group"
567
+ [attr.aria-label]="t().commentsReactions"
568
+ (keydown.escape)="closePicker(c.id, $event)"
569
+ (focusout)="onPickerFocusOut(c.id, $event)"
570
+ >
571
+ @for (e of reactions(); track e) {
572
+ <button type="button" class="cb-comment__emoji" [attr.aria-pressed]="mineEmoji(c, e)" (click)="react(c, e, true)">{{ e }}</button>
573
+ }
574
+ </span>
575
+ }
576
+ </span>
577
+ }
578
+ @if (replies()) {
579
+ <button type="button" class="cb-comment__action" [id]="domId(c.id) + '-reply'" (click)="startReply(root ? c : parent)">
580
+ <cb-icon name="reply" [size]="14" aria-hidden="true" />
581
+ {{ t().commentsReply }}
582
+ </button>
583
+ }
584
+ @if (canManage(c)) {
585
+ <button type="button" class="cb-comment__action" [id]="domId(c.id) + '-edit'" (click)="startEdit(c)">
586
+ <cb-icon name="pencil" [size]="14" aria-hidden="true" />
587
+ {{ t().commentsEdit }}
588
+ </button>
589
+ <button type="button" class="cb-comment__action" [id]="domId(c.id) + '-delete'" [attr.aria-expanded]="confirming() === c.id" (click)="askDelete(c.id)">
590
+ <cb-icon name="trash" [size]="14" aria-hidden="true" />
591
+ {{ t().commentsDelete }}
592
+ </button>
593
+ }
594
+ }
595
+ </div>
596
+ }
597
+
598
+ @if (confirming() === c.id) {
599
+ <div class="cb-comment__confirm" role="group" [attr.aria-label]="t().commentsDeleteConfirm" (keydown.escape)="cancelDelete(c.id)">
600
+ <span>{{ t().commentsDeleteConfirm }}</span>
601
+ <button type="button" class="cb-comments__btn cb-comments__btn--danger" [id]="domId(c.id) + '-confirm'" (click)="confirmDelete(c)">
602
+ {{ t().commentsDelete }}
603
+ </button>
604
+ <button type="button" class="cb-comments__btn" (click)="cancelDelete(c.id)">{{ t().cancel }}</button>
605
+ </div>
606
+ }
607
+ }
608
+ </div>
609
+ </article>
610
+ </ng-template>
611
+
612
+ <!-- Caja para escribir: comentario nuevo, respuesta o edición. -->
613
+ <ng-template #editorTpl let-d>
614
+ <div class="cb-comments__editor" [attr.data-draft]="draftKey(d)" (keydown)="onEditorKeydown($event, d)">
615
+ <cb-editor
616
+ [value]="draftOf(d)"
617
+ (valueChange)="setDraft(d, $event)"
618
+ [toolbar]="toolbar()"
619
+ [mentions]="mentionSource()"
620
+ [placeholder]="placeholderOf(d)"
621
+ [ariaLabel]="editorLabel(d)"
622
+ [height]="editorHeight()"
623
+ maxHeight="16rem"
624
+ [wordCount]="false"
625
+ [images]="false"
626
+ [slashCommands]="false"
627
+ [bubbleMenu]="false"
628
+ fontsHref=""
629
+ />
630
+ <div class="cb-comments__editor-bar">
631
+ <span class="cb-comments__hint">{{ t().commentsShortcut }}</span>
632
+ @if (d !== 'new') {
633
+ <button type="button" class="cb-comments__btn" (click)="cancelDraft(d)">{{ t().cancel }}</button>
634
+ }
635
+ <button type="button" class="cb-comments__btn cb-comments__btn--primary" [disabled]="isEmpty(draftOf(d))" (click)="submit(d)">
636
+ {{ isEdit(d) ? t().save : d === 'new' ? t().commentsSend : t().commentsReply }}
637
+ </button>
638
+ </div>
639
+ </div>
640
+ </ng-template>
641
+
642
+ <ng-template #composerTpl>
643
+ @if (canAct() && composer()) {
644
+ <div class="cb-comments__composer">
645
+ <cb-avatar class="cb-comment__avatar" [image]="currentUser()!.image ?? ''" [label]="initials(currentUser()!.name)" [size]="32" aria-hidden="true" />
646
+ <ng-container [ngTemplateOutlet]="editorTpl" [ngTemplateOutletContext]="{ $implicit: 'new' }" />
647
+ </div>
648
+ }
649
+ </ng-template>
650
+ `, isInline: true, styles: [".cb-comments{display:block;color:var(--cb-color-text);font-family:var(--cb-font-sans);font-size:var(--cb-text-sm, .875rem)}.cb-comments__box{display:flex;flex-direction:column;gap:1rem}.cb-comments__filter{display:inline-flex;align-self:flex-start;padding:2px;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-full, 999px)}.cb-comments__filter-btn{padding:.25rem .75rem;border:0;border-radius:var(--cb-radius-full, 999px);background:transparent;color:var(--cb-color-text-muted);font:inherit;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-medium, 500);cursor:pointer}.cb-comments__filter-btn:hover{color:var(--cb-color-text)}.cb-comments__filter-btn[aria-pressed=true]{background:var(--cb-color-surface-active, var(--cb-color-surface-hover));color:var(--cb-color-text)}.cb-comments__feed,.cb-comments__replies{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}.cb-comments__feed{gap:1rem}.cb-comments__replies{gap:.75rem;margin:.75rem 0 0 2.75rem;padding-left:.75rem;border-left:2px solid var(--cb-color-border)}.cb-comments__reply-composer{margin:.75rem 0 0 2.75rem}.cb-comments__empty{margin:0;color:var(--cb-color-text-muted)}.cb-comments__time{color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem);white-space:nowrap}.cb-comments__activity{display:flex;flex-wrap:wrap;align-items:baseline;gap:.25rem .5rem;padding-left:.5rem;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-comments__activity-icon{align-self:center;flex:none}.cb-comments__activity-text strong{color:var(--cb-color-text);font-weight:var(--cb-font-weight-medium, 500)}.cb-comment{display:flex;gap:.75rem;border-radius:var(--cb-radius-md, 6px)}.cb-comment:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:4px}.cb-comment__avatar{flex:none}.cb-comment__main{display:flex;flex:1;flex-direction:column;gap:.25rem;min-width:0}.cb-comment__head{display:flex;flex-wrap:wrap;align-items:baseline;gap:.25rem .5rem}.cb-comment__author{font-weight:var(--cb-font-weight-semibold, 600)}.cb-comment__edited{color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-comment__deleted{margin:0;color:var(--cb-color-text-muted);font-style:italic}.cb-comment__body{line-height:1.5;overflow-wrap:anywhere}.cb-comment__body>:first-child{margin-top:0}.cb-comment__body>:last-child{margin-bottom:0}.cb-comment__body p,.cb-comment__body ul,.cb-comment__body ol{margin:0 0 .5rem}.cb-comment__body ul,.cb-comment__body ol{padding-left:1.25rem}.cb-comment__body a{color:var(--cb-color-primary)}.cb-comment__body code{padding:.0625rem .25rem;border-radius:var(--cb-radius-sm, 4px);background:var(--cb-color-surface-hover);font-size:.85em}.cb-comment__body [data-mention]{padding:0 .1875rem;border-radius:var(--cb-radius-sm, 4px);background:color-mix(in srgb,var(--cb-color-primary) 16%,transparent);color:var(--cb-color-text-strong, var(--cb-color-text));font-weight:var(--cb-font-weight-medium, 500)}.cb-comment__body [data-mention][data-self]{background:var(--cb-color-primary);color:var(--cb-color-primary-contrast, #fff)}.cb-comment__footer{display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;margin-top:.125rem}.cb-comment__reaction{display:inline-flex;align-items:center;gap:.25rem;min-height:1.75rem;padding:0 .5rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-full, 999px);background:transparent;color:var(--cb-color-text);font:inherit;font-size:var(--cb-text-xs, .75rem);cursor:pointer}.cb-comment__reaction:hover:not(:disabled){background:var(--cb-color-surface-hover)}.cb-comment__reaction[aria-pressed=true]{border-color:var(--cb-color-primary);background:color-mix(in srgb,var(--cb-color-primary) 14%,transparent)}.cb-comment__reaction:disabled{cursor:default}.cb-comment__action{display:inline-flex;align-items:center;gap:.25rem;min-height:1.75rem;padding:0 .375rem;border:0;border-radius:var(--cb-radius-sm, 4px);background:transparent;color:var(--cb-color-text-muted);font:inherit;font-size:var(--cb-text-xs, .75rem);cursor:pointer}.cb-comment__action:hover{background:var(--cb-color-surface-hover);color:var(--cb-color-text)}.cb-comment__action--icon{justify-content:center;width:1.75rem;padding:0}.cb-comment__picker-wrap{position:relative;display:inline-flex}.cb-comment__picker{position:absolute;bottom:calc(100% + 4px);left:0;z-index:5;display:flex;gap:2px;padding:.25rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-full, 999px);background:var(--cb-color-surface, #fff);box-shadow:var(--cb-shadow-md, 0 4px 12px rgba(0, 0, 0, .12))}.cb-comment__emoji{width:2rem;height:2rem;border:0;border-radius:var(--cb-radius-full, 999px);background:transparent;font-size:1.125rem;line-height:1;cursor:pointer}.cb-comment__emoji:hover,.cb-comment__emoji[aria-pressed=true]{background:var(--cb-color-surface-hover)}.cb-comment__confirm{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;padding:.5rem .75rem;border:1px solid var(--cb-color-danger);border-radius:var(--cb-radius-md, 6px)}.cb-comments__composer{display:flex;gap:.75rem}.cb-comments__editor{display:flex;flex:1;flex-direction:column;gap:.5rem;min-width:0}.cb-comments .cb-comments__editor .cb-editor{overflow:visible}.cb-comments .cb-comments__editor .cb-editor__toolbar{border-top-left-radius:inherit;border-top-right-radius:inherit}.cb-comments__editor-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.5rem}.cb-comments__hint{margin-right:auto;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-comments__btn{min-height:2rem;padding:0 .875rem;border:1px solid var(--cb-color-border-strong, var(--cb-color-border));border-radius:var(--cb-radius-md, 6px);background:transparent;color:var(--cb-color-text);font:inherit;font-weight:var(--cb-font-weight-medium, 500);cursor:pointer}.cb-comments__btn:hover:not(:disabled){background:var(--cb-color-surface-hover)}.cb-comments__btn:disabled{opacity:.5;cursor:not-allowed}.cb-comments__btn--primary{border-color:var(--cb-color-primary);background:var(--cb-color-primary);color:var(--cb-color-primary-contrast, #fff)}.cb-comments__btn--primary:hover:not(:disabled){background:var(--cb-color-primary-700, var(--cb-color-primary))}.cb-comments__btn--danger{border-color:var(--cb-color-danger);background:var(--cb-color-danger);color:var(--cb-color-danger-contrast, #fff)}.cb-comments__btn--danger:hover:not(:disabled){background:var(--cb-color-danger-700, var(--cb-color-danger))}.cb-comments__filter-btn:focus-visible,.cb-comment__reaction:focus-visible,.cb-comment__action:focus-visible,.cb-comment__emoji:focus-visible,.cb-comments__btn:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:1px}.cb-comments__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@media(max-width:30rem){.cb-comments__replies,.cb-comments__reply-composer{margin-left:1rem}.cb-comments__hint{display:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CbAvatar, selector: "cb-avatar", inputs: ["image", "label", "icon", "size", "shape", "severity", "ariaLabel"] }, { kind: "component", type: CbEditor, selector: "cb-editor", inputs: ["placeholder", "ariaLabel", "height", "maxHeight", "wordCount", "disabled", "readonly", "invalid", "required", "toolbar", "maxLength", "images", "imageUpload", "maxImageSize", "pastePlainText", "fonts", "fontsHref", "bubbleMenu", "slashCommands", "autolink", "typography", "mentions", "autosaveKey", "autosaveDelay", "value"], outputs: ["valueChange", "mentionAdd", "imageError"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
651
+ }
652
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbComments, decorators: [{
653
+ type: Component,
654
+ args: [{ selector: 'cb-comments', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [NgTemplateOutlet, CbAvatar, CbEditor, CbIcon], host: { class: 'cb-comments' }, template: `
655
+ <section class="cb-comments__box" [attr.aria-label]="ariaLabel() || t().commentsFeed">
656
+ @if (showFilter()) {
657
+ <div class="cb-comments__filter" role="group" [attr.aria-label]="t().commentsShow">
658
+ @for (f of filters; track f) {
659
+ <button type="button" class="cb-comments__filter-btn" [attr.aria-pressed]="filter() === f" (click)="filter.set(f)">
660
+ {{ filterLabel(f) }}
661
+ </button>
662
+ }
663
+ </div>
664
+ }
665
+
666
+ @if (order() === 'newest') {
667
+ <ng-container [ngTemplateOutlet]="composerTpl" />
668
+ }
669
+
670
+ @if (feed().length) {
671
+ <ol class="cb-comments__feed">
672
+ @for (item of feed(); track itemKey(item)) {
673
+ @if (item.kind === 'activity') {
674
+ <li class="cb-comments__activity">
675
+ <cb-icon class="cb-comments__activity-icon" [name]="item.activity.icon || 'clock'" [size]="14" aria-hidden="true" />
676
+ <span class="cb-comments__activity-text">
677
+ @if (item.activity.author; as who) {
678
+ <strong>{{ who.name }}</strong>
679
+ }
680
+ {{ item.activity.text }}
681
+ </span>
682
+ <time class="cb-comments__time" [attr.datetime]="iso(item.activity.date)" [attr.title]="full(item.activity.date)">{{ rel(item.activity.date) }}</time>
683
+ </li>
684
+ } @else {
685
+ <li class="cb-comments__thread">
686
+ <ng-container [ngTemplateOutlet]="commentTpl" [ngTemplateOutletContext]="{ $implicit: item.comment, root: true }" />
687
+ @if (item.replies.length) {
688
+ <ol class="cb-comments__replies" [attr.aria-label]="fmt(t().commentsRepliesTo, item.comment.author.name)">
689
+ @for (r of item.replies; track r.id) {
690
+ <li><ng-container [ngTemplateOutlet]="commentTpl" [ngTemplateOutletContext]="{ $implicit: r, root: false, parent: item.comment }" /></li>
691
+ }
692
+ </ol>
693
+ }
694
+ @if (isReplying(item.comment.id)) {
695
+ <div class="cb-comments__reply-composer">
696
+ <ng-container [ngTemplateOutlet]="editorTpl" [ngTemplateOutletContext]="{ $implicit: { reply: item.comment.id } }" />
697
+ </div>
698
+ }
699
+ </li>
700
+ }
701
+ }
702
+ </ol>
703
+ } @else {
704
+ <p class="cb-comments__empty">{{ emptyMessage() ?? t().commentsEmpty }}</p>
705
+ }
706
+
707
+ @if (order() === 'oldest') {
708
+ <ng-container [ngTemplateOutlet]="composerTpl" />
709
+ }
710
+
711
+ <div class="cb-comments__sr" aria-live="polite">{{ announcement() }}</div>
712
+ </section>
713
+
714
+ <!-- Comentario (raíz o respuesta). -->
715
+ <ng-template #commentTpl let-c let-root="root" let-parent="parent">
716
+ <article class="cb-comment" [class.cb-comment--deleted]="c.deleted" [id]="domId(c.id)" tabindex="-1" [attr.aria-labelledby]="domId(c.id) + '-h'">
717
+ <cb-avatar class="cb-comment__avatar" [image]="c.author.image ?? ''" [label]="initials(c.author.name)" [size]="root ? 32 : 26" aria-hidden="true" />
718
+ <div class="cb-comment__main">
719
+ <div class="cb-comment__head" [id]="domId(c.id) + '-h'">
720
+ @if (!c.deleted) {
721
+ <span class="cb-comment__author">{{ c.author.name }}</span>
722
+ }
723
+ <time class="cb-comments__time" [attr.datetime]="iso(c.date)" [attr.title]="full(c.date)">{{ rel(c.date) }}</time>
724
+ @if (c.edited && !c.deleted) {
725
+ <span class="cb-comment__edited">({{ t().commentsEdited }})</span>
726
+ }
727
+ </div>
728
+
729
+ @if (c.deleted) {
730
+ <p class="cb-comment__deleted">{{ t().commentsDeleted }}</p>
731
+ } @else if (isEditing(c.id)) {
732
+ <ng-container [ngTemplateOutlet]="editorTpl" [ngTemplateOutletContext]="{ $implicit: { edit: c.id } }" />
733
+ } @else {
734
+ <div class="cb-comment__body" [innerHTML]="safe(c.html)"></div>
735
+
736
+ @if (c.reactions?.length || canAct()) {
737
+ <div class="cb-comment__footer">
738
+ @for (r of c.reactions ?? []; track r.emoji) {
739
+ <button
740
+ type="button"
741
+ class="cb-comment__reaction"
742
+ [attr.aria-pressed]="mine(r)"
743
+ [attr.aria-label]="reactionLabel(r)"
744
+ [attr.title]="reactionLabel(r)"
745
+ [disabled]="!canAct()"
746
+ (click)="react(c, r.emoji)"
747
+ >
748
+ <span aria-hidden="true">{{ r.emoji }}</span>
749
+ <span aria-hidden="true">{{ r.by.length }}</span>
750
+ </button>
751
+ }
752
+ @if (canAct()) {
753
+ @if (reactions().length) {
754
+ <span class="cb-comment__picker-wrap">
755
+ <button
756
+ type="button"
757
+ class="cb-comment__action cb-comment__action--icon"
758
+ [id]="domId(c.id) + '-react'"
759
+ [attr.aria-label]="t().commentsAddReaction"
760
+ [attr.title]="t().commentsAddReaction"
761
+ [attr.aria-expanded]="picker() === c.id"
762
+ (click)="togglePicker(c.id)"
763
+ >
764
+ <cb-icon name="cb-smile-plus" [size]="15" aria-hidden="true" />
765
+ </button>
766
+ @if (picker() === c.id) {
767
+ <span
768
+ class="cb-comment__picker"
769
+ role="group"
770
+ [attr.aria-label]="t().commentsReactions"
771
+ (keydown.escape)="closePicker(c.id, $event)"
772
+ (focusout)="onPickerFocusOut(c.id, $event)"
773
+ >
774
+ @for (e of reactions(); track e) {
775
+ <button type="button" class="cb-comment__emoji" [attr.aria-pressed]="mineEmoji(c, e)" (click)="react(c, e, true)">{{ e }}</button>
776
+ }
777
+ </span>
778
+ }
779
+ </span>
780
+ }
781
+ @if (replies()) {
782
+ <button type="button" class="cb-comment__action" [id]="domId(c.id) + '-reply'" (click)="startReply(root ? c : parent)">
783
+ <cb-icon name="reply" [size]="14" aria-hidden="true" />
784
+ {{ t().commentsReply }}
785
+ </button>
786
+ }
787
+ @if (canManage(c)) {
788
+ <button type="button" class="cb-comment__action" [id]="domId(c.id) + '-edit'" (click)="startEdit(c)">
789
+ <cb-icon name="pencil" [size]="14" aria-hidden="true" />
790
+ {{ t().commentsEdit }}
791
+ </button>
792
+ <button type="button" class="cb-comment__action" [id]="domId(c.id) + '-delete'" [attr.aria-expanded]="confirming() === c.id" (click)="askDelete(c.id)">
793
+ <cb-icon name="trash" [size]="14" aria-hidden="true" />
794
+ {{ t().commentsDelete }}
795
+ </button>
796
+ }
797
+ }
798
+ </div>
799
+ }
800
+
801
+ @if (confirming() === c.id) {
802
+ <div class="cb-comment__confirm" role="group" [attr.aria-label]="t().commentsDeleteConfirm" (keydown.escape)="cancelDelete(c.id)">
803
+ <span>{{ t().commentsDeleteConfirm }}</span>
804
+ <button type="button" class="cb-comments__btn cb-comments__btn--danger" [id]="domId(c.id) + '-confirm'" (click)="confirmDelete(c)">
805
+ {{ t().commentsDelete }}
806
+ </button>
807
+ <button type="button" class="cb-comments__btn" (click)="cancelDelete(c.id)">{{ t().cancel }}</button>
808
+ </div>
809
+ }
810
+ }
811
+ </div>
812
+ </article>
813
+ </ng-template>
814
+
815
+ <!-- Caja para escribir: comentario nuevo, respuesta o edición. -->
816
+ <ng-template #editorTpl let-d>
817
+ <div class="cb-comments__editor" [attr.data-draft]="draftKey(d)" (keydown)="onEditorKeydown($event, d)">
818
+ <cb-editor
819
+ [value]="draftOf(d)"
820
+ (valueChange)="setDraft(d, $event)"
821
+ [toolbar]="toolbar()"
822
+ [mentions]="mentionSource()"
823
+ [placeholder]="placeholderOf(d)"
824
+ [ariaLabel]="editorLabel(d)"
825
+ [height]="editorHeight()"
826
+ maxHeight="16rem"
827
+ [wordCount]="false"
828
+ [images]="false"
829
+ [slashCommands]="false"
830
+ [bubbleMenu]="false"
831
+ fontsHref=""
832
+ />
833
+ <div class="cb-comments__editor-bar">
834
+ <span class="cb-comments__hint">{{ t().commentsShortcut }}</span>
835
+ @if (d !== 'new') {
836
+ <button type="button" class="cb-comments__btn" (click)="cancelDraft(d)">{{ t().cancel }}</button>
837
+ }
838
+ <button type="button" class="cb-comments__btn cb-comments__btn--primary" [disabled]="isEmpty(draftOf(d))" (click)="submit(d)">
839
+ {{ isEdit(d) ? t().save : d === 'new' ? t().commentsSend : t().commentsReply }}
840
+ </button>
841
+ </div>
842
+ </div>
843
+ </ng-template>
844
+
845
+ <ng-template #composerTpl>
846
+ @if (canAct() && composer()) {
847
+ <div class="cb-comments__composer">
848
+ <cb-avatar class="cb-comment__avatar" [image]="currentUser()!.image ?? ''" [label]="initials(currentUser()!.name)" [size]="32" aria-hidden="true" />
849
+ <ng-container [ngTemplateOutlet]="editorTpl" [ngTemplateOutletContext]="{ $implicit: 'new' }" />
850
+ </div>
851
+ }
852
+ </ng-template>
853
+ `, styles: [".cb-comments{display:block;color:var(--cb-color-text);font-family:var(--cb-font-sans);font-size:var(--cb-text-sm, .875rem)}.cb-comments__box{display:flex;flex-direction:column;gap:1rem}.cb-comments__filter{display:inline-flex;align-self:flex-start;padding:2px;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-full, 999px)}.cb-comments__filter-btn{padding:.25rem .75rem;border:0;border-radius:var(--cb-radius-full, 999px);background:transparent;color:var(--cb-color-text-muted);font:inherit;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-medium, 500);cursor:pointer}.cb-comments__filter-btn:hover{color:var(--cb-color-text)}.cb-comments__filter-btn[aria-pressed=true]{background:var(--cb-color-surface-active, var(--cb-color-surface-hover));color:var(--cb-color-text)}.cb-comments__feed,.cb-comments__replies{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}.cb-comments__feed{gap:1rem}.cb-comments__replies{gap:.75rem;margin:.75rem 0 0 2.75rem;padding-left:.75rem;border-left:2px solid var(--cb-color-border)}.cb-comments__reply-composer{margin:.75rem 0 0 2.75rem}.cb-comments__empty{margin:0;color:var(--cb-color-text-muted)}.cb-comments__time{color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem);white-space:nowrap}.cb-comments__activity{display:flex;flex-wrap:wrap;align-items:baseline;gap:.25rem .5rem;padding-left:.5rem;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-comments__activity-icon{align-self:center;flex:none}.cb-comments__activity-text strong{color:var(--cb-color-text);font-weight:var(--cb-font-weight-medium, 500)}.cb-comment{display:flex;gap:.75rem;border-radius:var(--cb-radius-md, 6px)}.cb-comment:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:4px}.cb-comment__avatar{flex:none}.cb-comment__main{display:flex;flex:1;flex-direction:column;gap:.25rem;min-width:0}.cb-comment__head{display:flex;flex-wrap:wrap;align-items:baseline;gap:.25rem .5rem}.cb-comment__author{font-weight:var(--cb-font-weight-semibold, 600)}.cb-comment__edited{color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-comment__deleted{margin:0;color:var(--cb-color-text-muted);font-style:italic}.cb-comment__body{line-height:1.5;overflow-wrap:anywhere}.cb-comment__body>:first-child{margin-top:0}.cb-comment__body>:last-child{margin-bottom:0}.cb-comment__body p,.cb-comment__body ul,.cb-comment__body ol{margin:0 0 .5rem}.cb-comment__body ul,.cb-comment__body ol{padding-left:1.25rem}.cb-comment__body a{color:var(--cb-color-primary)}.cb-comment__body code{padding:.0625rem .25rem;border-radius:var(--cb-radius-sm, 4px);background:var(--cb-color-surface-hover);font-size:.85em}.cb-comment__body [data-mention]{padding:0 .1875rem;border-radius:var(--cb-radius-sm, 4px);background:color-mix(in srgb,var(--cb-color-primary) 16%,transparent);color:var(--cb-color-text-strong, var(--cb-color-text));font-weight:var(--cb-font-weight-medium, 500)}.cb-comment__body [data-mention][data-self]{background:var(--cb-color-primary);color:var(--cb-color-primary-contrast, #fff)}.cb-comment__footer{display:flex;flex-wrap:wrap;align-items:center;gap:.375rem;margin-top:.125rem}.cb-comment__reaction{display:inline-flex;align-items:center;gap:.25rem;min-height:1.75rem;padding:0 .5rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-full, 999px);background:transparent;color:var(--cb-color-text);font:inherit;font-size:var(--cb-text-xs, .75rem);cursor:pointer}.cb-comment__reaction:hover:not(:disabled){background:var(--cb-color-surface-hover)}.cb-comment__reaction[aria-pressed=true]{border-color:var(--cb-color-primary);background:color-mix(in srgb,var(--cb-color-primary) 14%,transparent)}.cb-comment__reaction:disabled{cursor:default}.cb-comment__action{display:inline-flex;align-items:center;gap:.25rem;min-height:1.75rem;padding:0 .375rem;border:0;border-radius:var(--cb-radius-sm, 4px);background:transparent;color:var(--cb-color-text-muted);font:inherit;font-size:var(--cb-text-xs, .75rem);cursor:pointer}.cb-comment__action:hover{background:var(--cb-color-surface-hover);color:var(--cb-color-text)}.cb-comment__action--icon{justify-content:center;width:1.75rem;padding:0}.cb-comment__picker-wrap{position:relative;display:inline-flex}.cb-comment__picker{position:absolute;bottom:calc(100% + 4px);left:0;z-index:5;display:flex;gap:2px;padding:.25rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-full, 999px);background:var(--cb-color-surface, #fff);box-shadow:var(--cb-shadow-md, 0 4px 12px rgba(0, 0, 0, .12))}.cb-comment__emoji{width:2rem;height:2rem;border:0;border-radius:var(--cb-radius-full, 999px);background:transparent;font-size:1.125rem;line-height:1;cursor:pointer}.cb-comment__emoji:hover,.cb-comment__emoji[aria-pressed=true]{background:var(--cb-color-surface-hover)}.cb-comment__confirm{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;padding:.5rem .75rem;border:1px solid var(--cb-color-danger);border-radius:var(--cb-radius-md, 6px)}.cb-comments__composer{display:flex;gap:.75rem}.cb-comments__editor{display:flex;flex:1;flex-direction:column;gap:.5rem;min-width:0}.cb-comments .cb-comments__editor .cb-editor{overflow:visible}.cb-comments .cb-comments__editor .cb-editor__toolbar{border-top-left-radius:inherit;border-top-right-radius:inherit}.cb-comments__editor-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.5rem}.cb-comments__hint{margin-right:auto;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem)}.cb-comments__btn{min-height:2rem;padding:0 .875rem;border:1px solid var(--cb-color-border-strong, var(--cb-color-border));border-radius:var(--cb-radius-md, 6px);background:transparent;color:var(--cb-color-text);font:inherit;font-weight:var(--cb-font-weight-medium, 500);cursor:pointer}.cb-comments__btn:hover:not(:disabled){background:var(--cb-color-surface-hover)}.cb-comments__btn:disabled{opacity:.5;cursor:not-allowed}.cb-comments__btn--primary{border-color:var(--cb-color-primary);background:var(--cb-color-primary);color:var(--cb-color-primary-contrast, #fff)}.cb-comments__btn--primary:hover:not(:disabled){background:var(--cb-color-primary-700, var(--cb-color-primary))}.cb-comments__btn--danger{border-color:var(--cb-color-danger);background:var(--cb-color-danger);color:var(--cb-color-danger-contrast, #fff)}.cb-comments__btn--danger:hover:not(:disabled){background:var(--cb-color-danger-700, var(--cb-color-danger))}.cb-comments__filter-btn:focus-visible,.cb-comment__reaction:focus-visible,.cb-comment__action:focus-visible,.cb-comment__emoji:focus-visible,.cb-comments__btn:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:1px}.cb-comments__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@media(max-width:30rem){.cb-comments__replies,.cb-comments__reply-composer{margin-left:1rem}.cb-comments__hint{display:none}}\n"] }]
854
+ }], ctorParameters: () => [], propDecorators: { comments: [{ type: i0.Input, args: [{ isSignal: true, alias: "comments", required: false }] }, { type: i0.Output, args: ["commentsChange"] }], activity: [{ type: i0.Input, args: [{ isSignal: true, alias: "activity", required: false }] }], currentUser: [{ type: i0.Input, args: [{ isSignal: true, alias: "currentUser", required: false }] }], people: [{ type: i0.Input, args: [{ isSignal: true, alias: "people", required: false }] }], mentions: [{ type: i0.Input, args: [{ isSignal: true, alias: "mentions", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }, { type: i0.Output, args: ["filterChange"] }], order: [{ type: i0.Input, args: [{ isSignal: true, alias: "order", required: false }] }], reactions: [{ type: i0.Input, args: [{ isSignal: true, alias: "reactions", required: false }] }], replies: [{ type: i0.Input, args: [{ isSignal: true, alias: "replies", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], composer: [{ type: i0.Input, args: [{ isSignal: true, alias: "composer", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], toolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbar", required: false }] }], editorHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "editorHeight", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], commentAdd: [{ type: i0.Output, args: ["commentAdd"] }], commentEdit: [{ type: i0.Output, args: ["commentEdit"] }], commentDelete: [{ type: i0.Output, args: ["commentDelete"] }], reactionToggle: [{ type: i0.Output, args: ["reactionToggle"] }] } });
855
+
856
+ /*
857
+ * Public API Surface de @caribeng/ui/comments
858
+ */
859
+
860
+ /**
861
+ * Generated bundle index. Do not edit.
862
+ */
863
+
864
+ export { CB_COMMENTS_TOOLBAR, CbComments, mentionIds as cbCommentMentions, removeComment as cbRemoveComment, toggleReaction as cbToggleReaction };