@caribeng/ui 22.1.1 → 22.4.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 (305) hide show
  1. package/README.md +134 -12
  2. package/fesm2022/caribeng-ui-accordion.mjs +4 -4
  3. package/fesm2022/caribeng-ui-anchor.mjs +169 -0
  4. package/fesm2022/caribeng-ui-autocomplete.mjs +10 -8
  5. package/fesm2022/caribeng-ui-avatar.mjs +2 -2
  6. package/fesm2022/caribeng-ui-avatargroup.mjs +9 -3
  7. package/fesm2022/caribeng-ui-badge.mjs +8 -2
  8. package/fesm2022/caribeng-ui-blockui.mjs +12 -4
  9. package/fesm2022/caribeng-ui-breadcrumb.mjs +17 -7
  10. package/fesm2022/caribeng-ui-button.mjs +22 -2
  11. package/fesm2022/caribeng-ui-caribe-alert.mjs +5 -2
  12. package/fesm2022/caribeng-ui-caribe-animation-lottie.mjs +6 -3
  13. package/fesm2022/caribeng-ui-caribe-button-group.mjs +6 -3
  14. package/fesm2022/caribeng-ui-caribe-calendar.mjs +11 -6
  15. package/fesm2022/caribeng-ui-caribe-card-content.mjs +6 -3
  16. package/fesm2022/caribeng-ui-caribe-card-move.mjs +29 -7
  17. package/fesm2022/caribeng-ui-caribe-card-select.mjs +56 -14
  18. package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +10 -7
  19. package/fesm2022/caribeng-ui-caribe-coachmark.mjs +42 -19
  20. package/fesm2022/caribeng-ui-caribe-data-table.mjs +15 -9
  21. package/fesm2022/caribeng-ui-caribe-dots-indicator.mjs +38 -5
  22. package/fesm2022/caribeng-ui-caribe-expansion-panel.mjs +16 -5
  23. package/fesm2022/caribeng-ui-caribe-fab-menu.mjs +56 -7
  24. package/fesm2022/caribeng-ui-caribe-file-download.mjs +68 -27
  25. package/fesm2022/caribeng-ui-caribe-file-select.mjs +22 -17
  26. package/fesm2022/caribeng-ui-caribe-float-menu.mjs +6 -3
  27. package/fesm2022/caribeng-ui-caribe-footer.mjs +8 -4
  28. package/fesm2022/caribeng-ui-caribe-header.mjs +6 -3
  29. package/fesm2022/caribeng-ui-caribe-icon-button.mjs +6 -3
  30. package/fesm2022/caribeng-ui-caribe-illustration.mjs +6 -3
  31. package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +5 -2
  32. package/fesm2022/caribeng-ui-caribe-input-search.mjs +14 -10
  33. package/fesm2022/caribeng-ui-caribe-input-select.mjs +12 -10
  34. package/fesm2022/caribeng-ui-caribe-input-token.mjs +61 -11
  35. package/fesm2022/caribeng-ui-caribe-link.mjs +7 -2
  36. package/fesm2022/caribeng-ui-caribe-loader.mjs +8 -5
  37. package/fesm2022/caribeng-ui-caribe-modal.mjs +32 -16
  38. package/fesm2022/caribeng-ui-caribe-off-canvas.mjs +26 -12
  39. package/fesm2022/caribeng-ui-caribe-onboarding.mjs +44 -19
  40. package/fesm2022/caribeng-ui-caribe-pictogram.mjs +6 -3
  41. package/fesm2022/caribeng-ui-caribe-pop-over.mjs +34 -10
  42. package/fesm2022/caribeng-ui-caribe-preloader.mjs +9 -6
  43. package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +5 -2
  44. package/fesm2022/caribeng-ui-caribe-shortcut.mjs +8 -3
  45. package/fesm2022/caribeng-ui-caribe-step-indicator.mjs +12 -5
  46. package/fesm2022/caribeng-ui-caribe-stroke.mjs +6 -3
  47. package/fesm2022/caribeng-ui-caribe-switch.mjs +5 -3
  48. package/fesm2022/caribeng-ui-caribe-tag-button.mjs +1 -1
  49. package/fesm2022/caribeng-ui-caribe-tracker.mjs +5 -2
  50. package/fesm2022/caribeng-ui-caribe-transaction-status.mjs +1 -1
  51. package/fesm2022/caribeng-ui-caribe-voucher.mjs +11 -8
  52. package/fesm2022/caribeng-ui-carousel.mjs +49 -14
  53. package/fesm2022/caribeng-ui-cascadeselect.mjs +22 -8
  54. package/fesm2022/caribeng-ui-chart.mjs +2601 -303
  55. package/fesm2022/caribeng-ui-chat.mjs +1303 -0
  56. package/fesm2022/caribeng-ui-chip.mjs +9 -4
  57. package/fesm2022/caribeng-ui-chips.mjs +9 -5
  58. package/fesm2022/caribeng-ui-code-block.mjs +332 -0
  59. package/fesm2022/caribeng-ui-colorpicker.mjs +107 -11
  60. package/fesm2022/caribeng-ui-command-palette.mjs +476 -0
  61. package/fesm2022/caribeng-ui-confirmdialog.mjs +140 -10
  62. package/fesm2022/caribeng-ui-confirmpopup.mjs +209 -9
  63. package/fesm2022/caribeng-ui-contextmenu.mjs +13 -6
  64. package/fesm2022/caribeng-ui-copy-button.mjs +230 -0
  65. package/fesm2022/caribeng-ui-dataview.mjs +214 -6
  66. package/fesm2022/caribeng-ui-datepicker.mjs +1630 -393
  67. package/fesm2022/caribeng-ui-descriptions.mjs +124 -0
  68. package/fesm2022/caribeng-ui-dialog.mjs +10 -7
  69. package/fesm2022/caribeng-ui-dock.mjs +58 -15
  70. package/fesm2022/caribeng-ui-drawer.mjs +17 -9
  71. package/fesm2022/caribeng-ui-dynamicdialog.mjs +210 -6
  72. package/fesm2022/caribeng-ui-editor.mjs +4413 -243
  73. package/fesm2022/caribeng-ui-empty.mjs +80 -0
  74. package/fesm2022/caribeng-ui-fieldset.mjs +2 -2
  75. package/fesm2022/caribeng-ui-file-card.mjs +136 -19
  76. package/fesm2022/caribeng-ui-fileupload.mjs +96 -19
  77. package/fesm2022/caribeng-ui-floatlabel.mjs +4 -2
  78. package/fesm2022/caribeng-ui-folder-card.mjs +132 -15
  79. package/fesm2022/caribeng-ui-galleria.mjs +76 -45
  80. package/fesm2022/caribeng-ui-image.mjs +52 -29
  81. package/fesm2022/caribeng-ui-inlinemessage.mjs +2 -2
  82. package/fesm2022/caribeng-ui-inplace.mjs +22 -6
  83. package/fesm2022/caribeng-ui-input-number.mjs +9 -7
  84. package/fesm2022/caribeng-ui-inputgroup.mjs +2 -2
  85. package/fesm2022/caribeng-ui-inputmask.mjs +22 -13
  86. package/fesm2022/caribeng-ui-inputotp.mjs +12 -6
  87. package/fesm2022/caribeng-ui-kanban.mjs +4612 -0
  88. package/fesm2022/caribeng-ui-kbd.mjs +122 -0
  89. package/fesm2022/caribeng-ui-keyfilter.mjs +72 -0
  90. package/fesm2022/caribeng-ui-listbox.mjs +13 -11
  91. package/fesm2022/caribeng-ui-megamenu.mjs +228 -32
  92. package/fesm2022/caribeng-ui-mentions.mjs +495 -0
  93. package/fesm2022/caribeng-ui-menu.mjs +18 -8
  94. package/fesm2022/caribeng-ui-menubar.mjs +17 -8
  95. package/fesm2022/caribeng-ui-message.mjs +13 -7
  96. package/fesm2022/caribeng-ui-metergroup.mjs +29 -11
  97. package/fesm2022/caribeng-ui-multiselect.mjs +399 -97
  98. package/fesm2022/caribeng-ui-orderlist.mjs +230 -11
  99. package/fesm2022/caribeng-ui-organizationchart.mjs +16 -15
  100. package/fesm2022/caribeng-ui-paginator.mjs +18 -15
  101. package/fesm2022/caribeng-ui-panel.mjs +11 -8
  102. package/fesm2022/caribeng-ui-panelmenu.mjs +14 -8
  103. package/fesm2022/caribeng-ui-password.mjs +8 -6
  104. package/fesm2022/caribeng-ui-pdfviewer.mjs +1553 -0
  105. package/fesm2022/caribeng-ui-phone-input.mjs +688 -0
  106. package/fesm2022/caribeng-ui-picklist.mjs +251 -14
  107. package/fesm2022/caribeng-ui-pricing.mjs +272 -75
  108. package/fesm2022/caribeng-ui-qrcode.mjs +564 -0
  109. package/fesm2022/caribeng-ui-rating.mjs +7 -3
  110. package/fesm2022/caribeng-ui-repeater.mjs +223 -0
  111. package/fesm2022/caribeng-ui-result.mjs +91 -0
  112. package/fesm2022/caribeng-ui-ripple.mjs +2 -0
  113. package/fesm2022/caribeng-ui-scrollpanel.mjs +6 -3
  114. package/fesm2022/caribeng-ui-scrolltop.mjs +9 -4
  115. package/fesm2022/caribeng-ui-select.mjs +379 -87
  116. package/fesm2022/caribeng-ui-selectbutton.mjs +2 -2
  117. package/fesm2022/caribeng-ui-sidebar.mjs +573 -0
  118. package/fesm2022/caribeng-ui-slider.mjs +171 -75
  119. package/fesm2022/caribeng-ui-speeddial.mjs +7 -4
  120. package/fesm2022/caribeng-ui-spinner.mjs +5 -2
  121. package/fesm2022/caribeng-ui-splitbutton.mjs +163 -0
  122. package/fesm2022/caribeng-ui-splitter.mjs +5 -2
  123. package/fesm2022/caribeng-ui-statistic.mjs +183 -0
  124. package/fesm2022/caribeng-ui-stepper.mjs +17 -7
  125. package/fesm2022/caribeng-ui-steps.mjs +6 -3
  126. package/fesm2022/caribeng-ui-table.mjs +716 -84
  127. package/fesm2022/caribeng-ui-tabmenu.mjs +13 -6
  128. package/fesm2022/caribeng-ui-tag.mjs +2 -2
  129. package/fesm2022/caribeng-ui-terminal.mjs +45 -9
  130. package/fesm2022/caribeng-ui-themetoggle.mjs +82 -0
  131. package/fesm2022/caribeng-ui-tieredmenu.mjs +113 -20
  132. package/fesm2022/caribeng-ui-timeline.mjs +175 -6
  133. package/fesm2022/caribeng-ui-toast.mjs +7 -4
  134. package/fesm2022/caribeng-ui-togglebutton.mjs +8 -6
  135. package/fesm2022/caribeng-ui-toolbar.mjs +6 -3
  136. package/fesm2022/caribeng-ui-tree.mjs +302 -6
  137. package/fesm2022/caribeng-ui-treeselect.mjs +26 -10
  138. package/fesm2022/caribeng-ui-treetable.mjs +269 -6
  139. package/fesm2022/caribeng-ui-virtualscroller.mjs +123 -10
  140. package/fesm2022/caribeng-ui.mjs +1216 -6
  141. package/package.json +93 -3
  142. package/schematics/collection.json +15 -0
  143. package/schematics/migrate-from-primeng/core-icons.json +1 -0
  144. package/schematics/migrate-from-primeng/icons.js +269 -0
  145. package/schematics/migrate-from-primeng/index.js +290 -0
  146. package/schematics/migrate-from-primeng/mappings/button.js +93 -0
  147. package/schematics/migrate-from-primeng/mappings/card.js +33 -0
  148. package/schematics/migrate-from-primeng/mappings/checkbox.js +44 -0
  149. package/schematics/migrate-from-primeng/mappings/confirm.js +221 -0
  150. package/schematics/migrate-from-primeng/mappings/datepicker.js +121 -0
  151. package/schematics/migrate-from-primeng/mappings/dialog.js +84 -0
  152. package/schematics/migrate-from-primeng/mappings/index.js +88 -0
  153. package/schematics/migrate-from-primeng/mappings/inputnumber.js +62 -0
  154. package/schematics/migrate-from-primeng/mappings/inputtext.js +60 -0
  155. package/schematics/migrate-from-primeng/mappings/menu.js +468 -0
  156. package/schematics/migrate-from-primeng/mappings/multiselect.js +49 -0
  157. package/schematics/migrate-from-primeng/mappings/radiobutton.js +22 -0
  158. package/schematics/migrate-from-primeng/mappings/rules.js +206 -0
  159. package/schematics/migrate-from-primeng/mappings/select.js +97 -0
  160. package/schematics/migrate-from-primeng/mappings/service-calls.js +100 -0
  161. package/schematics/migrate-from-primeng/mappings/table.js +613 -0
  162. package/schematics/migrate-from-primeng/mappings/tabs.js +225 -0
  163. package/schematics/migrate-from-primeng/mappings/tag.js +29 -0
  164. package/schematics/migrate-from-primeng/mappings/textarea.js +44 -0
  165. package/schematics/migrate-from-primeng/mappings/toast.js +173 -0
  166. package/schematics/migrate-from-primeng/mappings/toggleswitch.js +37 -0
  167. package/schematics/migrate-from-primeng/mappings/tooltip.js +44 -0
  168. package/schematics/migrate-from-primeng/mappings/types.js +10 -0
  169. package/schematics/migrate-from-primeng/report.js +79 -0
  170. package/schematics/migrate-from-primeng/schema.js +2 -0
  171. package/schematics/migrate-from-primeng/schema.json +34 -0
  172. package/schematics/migrate-from-primeng/template.js +387 -0
  173. package/schematics/migrate-from-primeng/todo.js +5 -0
  174. package/schematics/migrate-from-primeng/typescript.js +442 -0
  175. package/schematics/migrate-from-primeng/workspace.js +117 -0
  176. package/schematics/ng-add/index.js +140 -0
  177. package/schematics/ng-add/schema.js +2 -0
  178. package/schematics/ng-add/schema.json +66 -0
  179. package/types/caribeng-ui-anchor.d.ts +50 -0
  180. package/types/caribeng-ui-autocomplete.d.ts +4 -2
  181. package/types/caribeng-ui-avatargroup.d.ts +3 -1
  182. package/types/caribeng-ui-badge.d.ts +3 -1
  183. package/types/caribeng-ui-blockui.d.ts +9 -4
  184. package/types/caribeng-ui-breadcrumb.d.ts +11 -0
  185. package/types/caribeng-ui-button.d.ts +9 -1
  186. package/types/caribeng-ui-caribe-alert.d.ts +3 -0
  187. package/types/caribeng-ui-caribe-animation-lottie.d.ts +4 -1
  188. package/types/caribeng-ui-caribe-button-group.d.ts +4 -1
  189. package/types/caribeng-ui-caribe-calendar.d.ts +5 -1
  190. package/types/caribeng-ui-caribe-card-content.d.ts +4 -1
  191. package/types/caribeng-ui-caribe-card-move.d.ts +13 -13
  192. package/types/caribeng-ui-caribe-card-select.d.ts +10 -1
  193. package/types/caribeng-ui-caribe-circle-loading.d.ts +4 -1
  194. package/types/caribeng-ui-caribe-coachmark.d.ts +6 -0
  195. package/types/caribeng-ui-caribe-data-table.d.ts +7 -2
  196. package/types/caribeng-ui-caribe-dots-indicator.d.ts +9 -0
  197. package/types/caribeng-ui-caribe-expansion-panel.d.ts +7 -10
  198. package/types/caribeng-ui-caribe-fab-menu.d.ts +10 -1
  199. package/types/caribeng-ui-caribe-file-download.d.ts +8 -10
  200. package/types/caribeng-ui-caribe-file-select.d.ts +7 -1
  201. package/types/caribeng-ui-caribe-float-menu.d.ts +4 -1
  202. package/types/caribeng-ui-caribe-header.d.ts +3 -0
  203. package/types/caribeng-ui-caribe-icon-button.d.ts +4 -1
  204. package/types/caribeng-ui-caribe-illustration.d.ts +4 -1
  205. package/types/caribeng-ui-caribe-inline-alert.d.ts +3 -0
  206. package/types/caribeng-ui-caribe-input-search.d.ts +4 -2
  207. package/types/caribeng-ui-caribe-input-select.d.ts +4 -2
  208. package/types/caribeng-ui-caribe-input-token.d.ts +16 -1
  209. package/types/caribeng-ui-caribe-link.d.ts +3 -0
  210. package/types/caribeng-ui-caribe-loader.d.ts +4 -1
  211. package/types/caribeng-ui-caribe-modal.d.ts +7 -10
  212. package/types/caribeng-ui-caribe-off-canvas.d.ts +6 -1
  213. package/types/caribeng-ui-caribe-onboarding.d.ts +6 -0
  214. package/types/caribeng-ui-caribe-pictogram.d.ts +4 -1
  215. package/types/caribeng-ui-caribe-pop-over.d.ts +7 -10
  216. package/types/caribeng-ui-caribe-preloader.d.ts +4 -1
  217. package/types/caribeng-ui-caribe-progress-bar.d.ts +3 -0
  218. package/types/caribeng-ui-caribe-shortcut.d.ts +3 -1
  219. package/types/caribeng-ui-caribe-step-indicator.d.ts +6 -0
  220. package/types/caribeng-ui-caribe-stroke.d.ts +4 -1
  221. package/types/caribeng-ui-caribe-switch.d.ts +3 -1
  222. package/types/caribeng-ui-caribe-tracker.d.ts +3 -0
  223. package/types/caribeng-ui-caribe-voucher.d.ts +5 -2
  224. package/types/caribeng-ui-carousel.d.ts +10 -1
  225. package/types/caribeng-ui-cascadeselect.d.ts +7 -2
  226. package/types/caribeng-ui-chart.d.ts +471 -44
  227. package/types/caribeng-ui-chat.d.ts +299 -0
  228. package/types/caribeng-ui-chip.d.ts +6 -0
  229. package/types/caribeng-ui-chips.d.ts +6 -2
  230. package/types/caribeng-ui-code-block.d.ts +65 -0
  231. package/types/caribeng-ui-colorpicker.d.ts +8 -2
  232. package/types/caribeng-ui-command-palette.d.ts +133 -0
  233. package/types/caribeng-ui-confirmdialog.d.ts +57 -6
  234. package/types/caribeng-ui-confirmpopup.d.ts +74 -5
  235. package/types/caribeng-ui-contextmenu.d.ts +11 -1
  236. package/types/caribeng-ui-copy-button.d.ts +90 -0
  237. package/types/caribeng-ui-dataview.d.ts +65 -5
  238. package/types/caribeng-ui-datepicker.d.ts +186 -21
  239. package/types/caribeng-ui-descriptions.d.ts +63 -0
  240. package/types/caribeng-ui-dialog.d.ts +4 -1
  241. package/types/caribeng-ui-dock.d.ts +17 -2
  242. package/types/caribeng-ui-drawer.d.ts +7 -2
  243. package/types/caribeng-ui-dynamicdialog.d.ts +93 -3
  244. package/types/caribeng-ui-editor.d.ts +486 -13
  245. package/types/caribeng-ui-empty.d.ts +34 -0
  246. package/types/caribeng-ui-file-card.d.ts +28 -3
  247. package/types/caribeng-ui-fileupload.d.ts +27 -4
  248. package/types/caribeng-ui-folder-card.d.ts +31 -6
  249. package/types/caribeng-ui-galleria.d.ts +9 -0
  250. package/types/caribeng-ui-image.d.ts +10 -0
  251. package/types/caribeng-ui-inplace.d.ts +8 -0
  252. package/types/caribeng-ui-input-number.d.ts +3 -1
  253. package/types/caribeng-ui-inputmask.d.ts +8 -1
  254. package/types/caribeng-ui-inputotp.d.ts +7 -2
  255. package/types/caribeng-ui-kanban.d.ts +783 -0
  256. package/types/caribeng-ui-kbd.d.ts +36 -0
  257. package/types/caribeng-ui-keyfilter.d.ts +30 -0
  258. package/types/caribeng-ui-listbox.d.ts +5 -3
  259. package/types/caribeng-ui-megamenu.d.ts +37 -2
  260. package/types/caribeng-ui-mentions.d.ts +127 -0
  261. package/types/caribeng-ui-menu.d.ts +14 -2
  262. package/types/caribeng-ui-menubar.d.ts +12 -1
  263. package/types/caribeng-ui-message.d.ts +5 -0
  264. package/types/caribeng-ui-metergroup.d.ts +9 -1
  265. package/types/caribeng-ui-multiselect.d.ts +71 -10
  266. package/types/caribeng-ui-orderlist.d.ts +58 -6
  267. package/types/caribeng-ui-organizationchart.d.ts +7 -1
  268. package/types/caribeng-ui-paginator.d.ts +3 -0
  269. package/types/caribeng-ui-panel.d.ts +3 -0
  270. package/types/caribeng-ui-panelmenu.d.ts +11 -1
  271. package/types/caribeng-ui-password.d.ts +4 -2
  272. package/types/caribeng-ui-pdfviewer.d.ts +258 -0
  273. package/types/caribeng-ui-phone-input.d.ts +168 -0
  274. package/types/caribeng-ui-picklist.d.ts +67 -7
  275. package/types/caribeng-ui-pricing.d.ts +49 -9
  276. package/types/caribeng-ui-qrcode.d.ts +88 -0
  277. package/types/caribeng-ui-rating.d.ts +6 -2
  278. package/types/caribeng-ui-repeater.d.ts +79 -0
  279. package/types/caribeng-ui-result.d.ts +35 -0
  280. package/types/caribeng-ui-scrollpanel.d.ts +4 -1
  281. package/types/caribeng-ui-scrolltop.d.ts +4 -1
  282. package/types/caribeng-ui-select.d.ts +73 -9
  283. package/types/caribeng-ui-sidebar.d.ts +167 -0
  284. package/types/caribeng-ui-slider.d.ts +63 -10
  285. package/types/caribeng-ui-speeddial.d.ts +5 -2
  286. package/types/caribeng-ui-spinner.d.ts +3 -0
  287. package/types/caribeng-ui-splitbutton.d.ts +49 -0
  288. package/types/caribeng-ui-splitter.d.ts +3 -0
  289. package/types/caribeng-ui-statistic.d.ts +65 -0
  290. package/types/caribeng-ui-stepper.d.ts +5 -0
  291. package/types/caribeng-ui-steps.d.ts +4 -1
  292. package/types/caribeng-ui-table.d.ts +185 -17
  293. package/types/caribeng-ui-tabmenu.d.ts +11 -1
  294. package/types/caribeng-ui-terminal.d.ts +10 -0
  295. package/types/caribeng-ui-themetoggle.d.ts +32 -0
  296. package/types/caribeng-ui-tieredmenu.d.ts +22 -3
  297. package/types/caribeng-ui-timeline.d.ts +63 -4
  298. package/types/caribeng-ui-toast.d.ts +3 -0
  299. package/types/caribeng-ui-togglebutton.d.ts +5 -3
  300. package/types/caribeng-ui-toolbar.d.ts +7 -4
  301. package/types/caribeng-ui-tree.d.ts +76 -4
  302. package/types/caribeng-ui-treeselect.d.ts +10 -2
  303. package/types/caribeng-ui-treetable.d.ts +68 -4
  304. package/types/caribeng-ui-virtualscroller.d.ts +45 -5
  305. package/types/caribeng-ui.d.ts +775 -12
@@ -0,0 +1,230 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Injectable, input, booleanAttribute, output, signal, computed, DestroyRef, ViewEncapsulation, ChangeDetectionStrategy, Component, Directive } from '@angular/core';
3
+ import { injectCbTranslation } from '@caribeng/ui';
4
+ import { CbButton } from '@caribeng/ui/button';
5
+ import { CbIcon } from '@caribeng/ui/icon';
6
+ import { DOCUMENT } from '@angular/common';
7
+
8
+ /**
9
+ * Portapapeles de CaribeNG. Usa la API asíncrona del navegador y, si no está
10
+ * disponible (HTTP sin contexto seguro, navegadores antiguos), un textarea
11
+ * temporal con `execCommand('copy')`.
12
+ */
13
+ class CbClipboard {
14
+ constructor() {
15
+ this.doc = inject(DOCUMENT);
16
+ }
17
+ /** Copia `text`. Resuelve `true` si se copió y `false` si el navegador lo impidió. */
18
+ async copy(text) {
19
+ const clipboard = this.doc.defaultView?.navigator?.clipboard;
20
+ if (clipboard?.writeText) {
21
+ try {
22
+ await clipboard.writeText(text);
23
+ return true;
24
+ }
25
+ catch {
26
+ // Sin permiso o sin foco: se intenta el método clásico.
27
+ }
28
+ }
29
+ return this.copyWithTextarea(text);
30
+ }
31
+ copyWithTextarea(text) {
32
+ const doc = this.doc;
33
+ if (!doc.body || typeof doc.execCommand !== 'function')
34
+ return false;
35
+ const active = doc.activeElement;
36
+ const area = doc.createElement('textarea');
37
+ area.value = text;
38
+ area.setAttribute('readonly', '');
39
+ area.style.position = 'fixed';
40
+ area.style.opacity = '0';
41
+ area.style.pointerEvents = 'none';
42
+ doc.body.appendChild(area);
43
+ area.select();
44
+ let ok = false;
45
+ try {
46
+ ok = doc.execCommand('copy');
47
+ }
48
+ catch {
49
+ ok = false;
50
+ }
51
+ area.remove();
52
+ active?.focus?.();
53
+ return ok;
54
+ }
55
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbClipboard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
56
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbClipboard, providedIn: 'root' }); }
57
+ }
58
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbClipboard, decorators: [{
59
+ type: Injectable,
60
+ args: [{ providedIn: 'root' }]
61
+ }] });
62
+
63
+ /**
64
+ * Botón que copia un texto al portapapeles y confirma con un ✓ durante unos
65
+ * segundos. El resultado se anuncia a los lectores de pantalla.
66
+ *
67
+ * @example
68
+ * ```html
69
+ * <span>0012 3456 7890</span> <cb-copy-button value="001234567890" />
70
+ * <cb-copy-button [value]="apiKey" showLabel variant="outlined" />
71
+ * ```
72
+ */
73
+ class CbCopyButton {
74
+ constructor() {
75
+ /** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
76
+ this.t = injectCbTranslation();
77
+ this.clipboard = inject(CbClipboard);
78
+ this.timer = null;
79
+ /** Texto que se copia. */
80
+ this.value = input('', /* @ts-ignore */
81
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
82
+ /** Muestra el texto ("Copiar" / "Copiado") junto al icono. */
83
+ this.showLabel = input(false, { ...(ngDevMode ? { debugName: "showLabel" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
84
+ /** Texto del botón y nombre accesible. Por defecto, "Copiar" del idioma activo. */
85
+ this.label = input(undefined, /* @ts-ignore */
86
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
87
+ /** Texto tras copiar. Por defecto, "Copiado". */
88
+ this.copiedLabel = input(undefined, /* @ts-ignore */
89
+ ...(ngDevMode ? [{ debugName: "copiedLabel" }] : /* istanbul ignore next */ []));
90
+ /** Milisegundos que dura la confirmación. */
91
+ this.timeout = input(2000, /* @ts-ignore */
92
+ ...(ngDevMode ? [{ debugName: "timeout" }] : /* istanbul ignore next */ []));
93
+ this.variant = input('text', /* @ts-ignore */
94
+ ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
95
+ this.severity = input('secondary', /* @ts-ignore */
96
+ ...(ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []));
97
+ this.size = input('sm', /* @ts-ignore */
98
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
99
+ this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
100
+ /** Texto copiado. */
101
+ this.copied = output();
102
+ /** El navegador no permitió copiar. */
103
+ this.copyError = output();
104
+ this.state = signal('idle', /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
106
+ this.buttonLabel = computed(() => this.label() ?? this.t().copy, /* @ts-ignore */
107
+ ...(ngDevMode ? [{ debugName: "buttonLabel" }] : /* istanbul ignore next */ []));
108
+ this.visibleLabel = computed(() => this.state() === 'copied' ? (this.copiedLabel() ?? this.t().copied) : this.buttonLabel(), /* @ts-ignore */
109
+ ...(ngDevMode ? [{ debugName: "visibleLabel" }] : /* istanbul ignore next */ []));
110
+ this.announcement = computed(() => {
111
+ const state = this.state();
112
+ if (state === 'copied')
113
+ return this.copiedLabel() ?? this.t().copied;
114
+ if (state === 'error')
115
+ return this.t().copyFailed;
116
+ return '';
117
+ }, /* @ts-ignore */
118
+ ...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
119
+ this.iconSize = computed(() => (this.size() === 'lg' ? 18 : this.size() === 'sm' ? 14 : 16), /* @ts-ignore */
120
+ ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
121
+ inject(DestroyRef).onDestroy(() => this.clearTimer());
122
+ }
123
+ /** Copia el valor y muestra la confirmación. Resuelve `true` si lo consiguió. */
124
+ async copy() {
125
+ if (this.disabled())
126
+ return false;
127
+ const text = String(this.value() ?? '');
128
+ const ok = await this.clipboard.copy(text);
129
+ this.state.set(ok ? 'copied' : 'error');
130
+ if (ok)
131
+ this.copied.emit(text);
132
+ else
133
+ this.copyError.emit(text);
134
+ this.clearTimer();
135
+ this.timer = setTimeout(() => this.state.set('idle'), Math.max(0, this.timeout()));
136
+ return ok;
137
+ }
138
+ clearTimer() {
139
+ if (this.timer !== null)
140
+ clearTimeout(this.timer);
141
+ this.timer = null;
142
+ }
143
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbCopyButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
144
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbCopyButton, isStandalone: true, selector: "cb-copy-button", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, showLabel: { classPropertyName: "showLabel", publicName: "showLabel", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, copiedLabel: { classPropertyName: "copiedLabel", publicName: "copiedLabel", isSignal: true, isRequired: false, transformFunction: null }, timeout: { classPropertyName: "timeout", publicName: "timeout", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { copied: "copied", copyError: "copyError" }, host: { classAttribute: "cb-copy-button" }, ngImport: i0, template: `
145
+ <cb-button
146
+ [variant]="variant()"
147
+ [severity]="state() === 'copied' ? 'success' : severity()"
148
+ [size]="size()"
149
+ [disabled]="disabled()"
150
+ [ariaLabel]="showLabel() ? undefined : buttonLabel()"
151
+ (click)="copy()"
152
+ >
153
+ <cb-icon [name]="state() === 'copied' ? 'check' : 'copy'" [size]="iconSize()" aria-hidden="true" />
154
+ @if (showLabel()) {
155
+ <span>{{ visibleLabel() }}</span>
156
+ }
157
+ </cb-button>
158
+ <span class="cb-copy-button__status" role="status">{{ announcement() }}</span>
159
+ `, isInline: true, styles: [":host{display:inline-flex;vertical-align:middle}.cb-copy-button__status{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"], dependencies: [{ kind: "component", type: CbButton, selector: "cb-button", inputs: ["severity", "variant", "size", "disabled", "loading", "fullWidth", "type", "ariaLabel", "ariaHaspopup", "ariaExpanded", "ariaControls"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
160
+ }
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbCopyButton, decorators: [{
162
+ type: Component,
163
+ args: [{ selector: 'cb-copy-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbButton, CbIcon], host: { class: 'cb-copy-button' }, template: `
164
+ <cb-button
165
+ [variant]="variant()"
166
+ [severity]="state() === 'copied' ? 'success' : severity()"
167
+ [size]="size()"
168
+ [disabled]="disabled()"
169
+ [ariaLabel]="showLabel() ? undefined : buttonLabel()"
170
+ (click)="copy()"
171
+ >
172
+ <cb-icon [name]="state() === 'copied' ? 'check' : 'copy'" [size]="iconSize()" aria-hidden="true" />
173
+ @if (showLabel()) {
174
+ <span>{{ visibleLabel() }}</span>
175
+ }
176
+ </cb-button>
177
+ <span class="cb-copy-button__status" role="status">{{ announcement() }}</span>
178
+ `, styles: [":host{display:inline-flex;vertical-align:middle}.cb-copy-button__status{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"] }]
179
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], showLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLabel", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], copiedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "copiedLabel", required: false }] }], timeout: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeout", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "severity", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], copied: [{ type: i0.Output, args: ["copied"] }], copyError: [{ type: i0.Output, args: ["copyError"] }] } });
180
+
181
+ /**
182
+ * Copia un texto al portapapeles al pulsar el elemento (botón, enlace, icono…).
183
+ * Para el aviso visual usa `cb-copy-button`, o reacciona a `copied`.
184
+ *
185
+ * @example
186
+ * ```html
187
+ * <button type="button" [cbCopy]="cuenta" (copied)="toast.add({ summary: 'Copiado' })">Copiar</button>
188
+ * ```
189
+ */
190
+ class CbCopy {
191
+ constructor() {
192
+ this.clipboard = inject(CbClipboard);
193
+ /** Texto que se copia. */
194
+ this.cbCopy = input('', /* @ts-ignore */
195
+ ...(ngDevMode ? [{ debugName: "cbCopy" }] : /* istanbul ignore next */ []));
196
+ /** Texto copiado. */
197
+ this.copied = output();
198
+ /** El navegador no permitió copiar. */
199
+ this.copyError = output();
200
+ }
201
+ /** Copia el texto. Resuelve `true` si lo consiguió. */
202
+ async copy() {
203
+ const text = String(this.cbCopy() ?? '');
204
+ const ok = await this.clipboard.copy(text);
205
+ if (ok)
206
+ this.copied.emit(text);
207
+ else
208
+ this.copyError.emit(text);
209
+ return ok;
210
+ }
211
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbCopy, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
212
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: CbCopy, isStandalone: true, selector: "[cbCopy]", inputs: { cbCopy: { classPropertyName: "cbCopy", publicName: "cbCopy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { copied: "copied", copyError: "copyError" }, host: { listeners: { "click": "copy()" } }, ngImport: i0 }); }
213
+ }
214
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbCopy, decorators: [{
215
+ type: Directive,
216
+ args: [{
217
+ selector: '[cbCopy]',
218
+ host: { '(click)': 'copy()' },
219
+ }]
220
+ }], propDecorators: { cbCopy: [{ type: i0.Input, args: [{ isSignal: true, alias: "cbCopy", required: false }] }], copied: [{ type: i0.Output, args: ["copied"] }], copyError: [{ type: i0.Output, args: ["copyError"] }] } });
221
+
222
+ /*
223
+ * Public API Surface de @caribeng/ui/copy-button
224
+ */
225
+
226
+ /**
227
+ * Generated bundle index. Do not edit.
228
+ */
229
+
230
+ export { CbClipboard, CbCopy, CbCopyButton };
@@ -1,27 +1,235 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
1
2
  import * as i0 from '@angular/core';
2
- import { input, model, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { inject, TemplateRef, Directive, input, model, contentChild, linkedSignal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { injectCbTranslation, cbFormat } from '@caribeng/ui';
5
+ import { CbPaginator } from '@caribeng/ui/paginator';
3
6
 
7
+ /** Plantilla de cada elemento de un `<cb-dataview>`. */
8
+ class CbDataViewItemTemplate {
9
+ constructor() {
10
+ this.template = inject(TemplateRef);
11
+ }
12
+ static ngTemplateContextGuard(_dir, ctx) {
13
+ return true;
14
+ }
15
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDataViewItemTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
16
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: CbDataViewItemTemplate, isStandalone: true, selector: "ng-template[cbDataViewItem]", ngImport: i0 }); }
17
+ }
18
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDataViewItemTemplate, decorators: [{
19
+ type: Directive,
20
+ args: [{ selector: 'ng-template[cbDataViewItem]' }]
21
+ }] });
22
+ /** Contenido de la cabecera de un `<cb-dataview>` (título, filtros, acciones…). */
23
+ class CbDataViewHeader {
24
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDataViewHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
25
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: CbDataViewHeader, isStandalone: true, selector: "[cbDataViewHeader]", ngImport: i0 }); }
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDataViewHeader, decorators: [{
28
+ type: Directive,
29
+ args: [{ selector: '[cbDataViewHeader]' }]
30
+ }] });
31
+ /**
32
+ * DataView de CaribeNG: muestra una colección en lista o cuadrícula con la
33
+ * plantilla que definas, paginación opcional y botones para cambiar la vista.
34
+ * Sin plantilla, usa una tarjeta con título, categoría, descripción y botón
35
+ * de selección.
36
+ *
37
+ * @example
38
+ * ```html
39
+ * <cb-dataview [value]="productos" [(layout)]="vista" [rows]="6" showLayoutToggle>
40
+ * <h3 cbDataViewHeader>Productos</h3>
41
+ * <ng-template cbDataViewItem let-producto let-layout="layout">
42
+ * <app-producto [producto]="producto" [compacto]="layout === 'list'" />
43
+ * </ng-template>
44
+ * </cb-dataview>
45
+ * ```
46
+ */
4
47
  class CbDataView {
5
48
  constructor() {
49
+ this.t = injectCbTranslation();
50
+ this.fmt = cbFormat;
51
+ /** Colección a mostrar. */
6
52
  this.value = input([], /* @ts-ignore */
7
53
  ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
54
+ /** Vista: cuadrícula o lista (two-way). */
8
55
  this.layout = model('grid', /* @ts-ignore */
9
56
  ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
57
+ /** Muestra los botones para cambiar entre lista y cuadrícula. */
58
+ this.showLayoutToggle = input(false, { ...(ngDevMode ? { debugName: "showLayoutToggle" } : /* istanbul ignore next */ {}), transform: toBoolean });
59
+ /** Elementos por página; 0 (por defecto) muestra todos sin paginador. */
60
+ this.rows = input(0, /* @ts-ignore */
61
+ ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
62
+ /** Propiedad que identifica cada elemento (para el seguimiento y la selección). */
63
+ this.dataKey = input('id', /* @ts-ignore */
64
+ ...(ngDevMode ? [{ debugName: "dataKey" }] : /* istanbul ignore next */ []));
65
+ /** Elemento seleccionado con la presentación por defecto (two-way). */
10
66
  this.selection = model(null, /* @ts-ignore */
11
67
  ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
12
- this.emptyMessage = input('Sin resultados', /* @ts-ignore */
68
+ /** Mensaje cuando no hay elementos. Por defecto, el del idioma activo. */
69
+ this.emptyMessage = input(undefined, /* @ts-ignore */
13
70
  ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
71
+ this.itemTemplate = contentChild(CbDataViewItemTemplate, /* @ts-ignore */
72
+ ...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
73
+ this.header = contentChild(CbDataViewHeader, /* @ts-ignore */
74
+ ...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
75
+ /** Índice del primer elemento de la página actual; vuelve a 0 si cambia la colección. */
76
+ this.first = linkedSignal({ ...(ngDevMode ? { debugName: "first" } : /* istanbul ignore next */ {}), source: this.value, computation: () => 0 });
77
+ this.page = computed(() => {
78
+ const rows = this.rows();
79
+ return rows > 0 ? this.value().slice(this.first(), this.first() + rows) : this.value();
80
+ }, /* @ts-ignore */
81
+ ...(ngDevMode ? [{ debugName: "page" }] : /* istanbul ignore next */ []));
82
+ }
83
+ trackKey(item, index) {
84
+ const key = item?.[this.dataKey()];
85
+ return key ?? index;
86
+ }
87
+ isSelected(item) {
88
+ const sel = this.selection();
89
+ return !!sel && this.trackKey(sel, -1) === this.trackKey(item, -2);
90
+ }
91
+ asItem(item) {
92
+ return item;
14
93
  }
15
94
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDataView, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
16
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDataView, isStandalone: true, selector: "cb-dataview", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { layout: "layoutChange", selection: "selectionChange" }, ngImport: i0, template: `<div class="cb-dataview" [attr.data-layout]="layout()" role="list">@for (item of value(); track item.id) {<article role="listitem" class="cb-dataview__item"><strong>{{item.title}}</strong>@if(item.category){<small>{{item.category}}</small>}@if(item.description){<p>{{item.description}}</p>}<button type="button" (click)="selection.set(item)" [attr.aria-pressed]="selection()?.id===item.id">Seleccionar</button></article>} @empty {<p>{{emptyMessage()}}</p>}</div>`, isInline: true, styles: [":host{display:block}.cb-dataview{display:grid;gap:1rem}.cb-dataview[data-layout=grid]{grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))}.cb-dataview__item{padding:1rem;border:1px solid var(--cb-color-border,#d1d5db);border-radius:var(--cb-border-radius,.5rem);background:var(--cb-color-surface,#fff);color:var(--cb-color-text,#111827)}small{display:block;color:var(--cb-color-text-muted,#6b7280)}p{margin:.5rem 0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
95
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbDataView, isStandalone: true, selector: "cb-dataview", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, showLayoutToggle: { classPropertyName: "showLayoutToggle", publicName: "showLayoutToggle", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { layout: "layoutChange", selection: "selectionChange" }, host: { classAttribute: "cb-dataview-host" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: CbDataViewItemTemplate, descendants: true, isSignal: true }, { propertyName: "header", first: true, predicate: CbDataViewHeader, descendants: true, isSignal: true }], ngImport: i0, template: `
96
+ @if (showLayoutToggle() || header()) {
97
+ <div class="cb-dataview__header">
98
+ <div class="cb-dataview__title"><ng-content select="[cbDataViewHeader]" /></div>
99
+ @if (showLayoutToggle()) {
100
+ <div class="cb-dataview__layouts" role="group" [attr.aria-label]="t().changeLayout">
101
+ <button
102
+ type="button"
103
+ class="cb-dataview__layout-btn"
104
+ [attr.aria-pressed]="layout() === 'list'"
105
+ [attr.aria-label]="t().listView"
106
+ (click)="layout.set('list')"
107
+ >
108
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6" /><line x1="8" y1="12" x2="21" y2="12" /><line x1="8" y1="18" x2="21" y2="18" /><line x1="3" y1="6" x2="3.01" y2="6" /><line x1="3" y1="12" x2="3.01" y2="12" /><line x1="3" y1="18" x2="3.01" y2="18" /></svg>
109
+ </button>
110
+ <button
111
+ type="button"
112
+ class="cb-dataview__layout-btn"
113
+ [attr.aria-pressed]="layout() === 'grid'"
114
+ [attr.aria-label]="t().gridView"
115
+ (click)="layout.set('grid')"
116
+ >
117
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" /><rect x="14" y="3" width="7" height="7" /><rect x="3" y="14" width="7" height="7" /><rect x="14" y="14" width="7" height="7" /></svg>
118
+ </button>
119
+ </div>
120
+ }
121
+ </div>
122
+ }
123
+
124
+ <div class="cb-dataview" [attr.data-layout]="layout()" role="list">
125
+ @for (item of page(); track trackKey(item, $index); let i = $index) {
126
+ <div class="cb-dataview__cell" role="listitem">
127
+ @if (itemTemplate(); as tpl) {
128
+ <ng-container *ngTemplateOutlet="tpl.template; context: { $implicit: item, layout: layout(), index: first() + i }" />
129
+ } @else {
130
+ <article class="cb-dataview__item">
131
+ <strong class="cb-dataview__item-title">{{ asItem(item).title }}</strong>
132
+ @if (asItem(item).category) {
133
+ <small>{{ asItem(item).category }}</small>
134
+ }
135
+ @if (asItem(item).description) {
136
+ <p>{{ asItem(item).description }}</p>
137
+ }
138
+ <button
139
+ type="button"
140
+ class="cb-dataview__select"
141
+ [attr.aria-pressed]="isSelected(item)"
142
+ [attr.aria-label]="fmt(t().selectItem, asItem(item).title)"
143
+ (click)="selection.set(asItem(item))"
144
+ >
145
+ {{ t().select }}
146
+ </button>
147
+ </article>
148
+ }
149
+ </div>
150
+ } @empty {
151
+ <p class="cb-dataview__empty">{{ emptyMessage() ?? t().noResults }}</p>
152
+ }
153
+ </div>
154
+
155
+ @if (rows() > 0 && value().length > rows()) {
156
+ <cb-paginator class="cb-dataview__paginator" [totalRecords]="value().length" [rows]="rows()" [(first)]="first" />
157
+ }
158
+ `, isInline: true, styles: [":host{display:block;color:var(--cb-color-text)}.cb-dataview__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-3, .75rem);margin-bottom:var(--cb-space-3, .75rem)}.cb-dataview__title{min-width:0}.cb-dataview__layouts{display:inline-flex;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem);overflow:hidden}.cb-dataview__layout-btn{display:inline-flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;padding:0;border:0;background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-dataview__layout-btn+.cb-dataview__layout-btn{border-inline-start:1px solid var(--cb-color-border)}.cb-dataview__layout-btn[aria-pressed=true]{color:var(--cb-color-primary-600);background:color-mix(in srgb,var(--cb-color-primary-500) 12%,transparent)}.cb-dataview__layout-btn:focus-visible{outline:2px solid var(--cb-color-focus-ring, var(--cb-color-primary-500));outline-offset:-2px}.cb-dataview{display:grid;gap:var(--cb-space-3, .75rem)}.cb-dataview[data-layout=grid]{grid-template-columns:repeat(auto-fill,minmax(min(14rem,100%),1fr))}.cb-dataview__item{height:100%;box-sizing:border-box;display:flex;flex-direction:column;gap:var(--cb-space-1, .25rem);padding:var(--cb-space-4, 1rem);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);background:var(--cb-color-surface-raised)}.cb-dataview[data-layout=list] .cb-dataview__item{flex-direction:row;flex-wrap:wrap;align-items:center;column-gap:var(--cb-space-3, .75rem)}.cb-dataview__item-title{color:var(--cb-color-text-strong)}.cb-dataview__item small{color:var(--cb-color-text-muted)}.cb-dataview__item p{margin:0;color:var(--cb-color-text-muted);font-size:var(--cb-text-sm, .875rem)}.cb-dataview[data-layout=list] .cb-dataview__item p{flex:1 1 12rem}.cb-dataview__select{align-self:flex-start;margin-top:auto;padding:.35rem .75rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem);background:transparent;color:var(--cb-color-text);font:inherit;font-size:var(--cb-text-sm, .875rem);cursor:pointer}.cb-dataview[data-layout=list] .cb-dataview__select{margin-top:0;margin-inline-start:auto}.cb-dataview__select[aria-pressed=true]{border-color:var(--cb-color-primary-500);color:var(--cb-color-primary-700);background:color-mix(in srgb,var(--cb-color-primary-500) 12%,transparent)}.cb-dataview__empty{grid-column:1 / -1;margin:0;padding:var(--cb-space-6, 1.5rem);text-align:center;color:var(--cb-color-text-muted)}.cb-dataview__paginator{margin-top:var(--cb-space-3, .75rem)}:host-context([data-theme=\"dark\"]) .cb-dataview__select[aria-pressed=true]{color:var(--cb-color-primary-300)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CbPaginator, selector: "cb-paginator", inputs: ["totalRecords", "rows", "first", "rowsPerPageOptions", "showReport", "maxPageLinks"], outputs: ["rowsChange", "firstChange", "pageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
17
159
  }
18
160
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbDataView, decorators: [{
19
161
  type: Component,
20
- args: [{ selector: 'cb-dataview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `<div class="cb-dataview" [attr.data-layout]="layout()" role="list">@for (item of value(); track item.id) {<article role="listitem" class="cb-dataview__item"><strong>{{item.title}}</strong>@if(item.category){<small>{{item.category}}</small>}@if(item.description){<p>{{item.description}}</p>}<button type="button" (click)="selection.set(item)" [attr.aria-pressed]="selection()?.id===item.id">Seleccionar</button></article>} @empty {<p>{{emptyMessage()}}</p>}</div>`, styles: [":host{display:block}.cb-dataview{display:grid;gap:1rem}.cb-dataview[data-layout=grid]{grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))}.cb-dataview__item{padding:1rem;border:1px solid var(--cb-color-border,#d1d5db);border-radius:var(--cb-border-radius,.5rem);background:var(--cb-color-surface,#fff);color:var(--cb-color-text,#111827)}small{display:block;color:var(--cb-color-text-muted,#6b7280)}p{margin:.5rem 0}\n"] }]
21
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }, { type: i0.Output, args: ["layoutChange"] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }] } });
162
+ args: [{ selector: 'cb-dataview', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [NgTemplateOutlet, CbPaginator], host: { class: 'cb-dataview-host' }, template: `
163
+ @if (showLayoutToggle() || header()) {
164
+ <div class="cb-dataview__header">
165
+ <div class="cb-dataview__title"><ng-content select="[cbDataViewHeader]" /></div>
166
+ @if (showLayoutToggle()) {
167
+ <div class="cb-dataview__layouts" role="group" [attr.aria-label]="t().changeLayout">
168
+ <button
169
+ type="button"
170
+ class="cb-dataview__layout-btn"
171
+ [attr.aria-pressed]="layout() === 'list'"
172
+ [attr.aria-label]="t().listView"
173
+ (click)="layout.set('list')"
174
+ >
175
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6" /><line x1="8" y1="12" x2="21" y2="12" /><line x1="8" y1="18" x2="21" y2="18" /><line x1="3" y1="6" x2="3.01" y2="6" /><line x1="3" y1="12" x2="3.01" y2="12" /><line x1="3" y1="18" x2="3.01" y2="18" /></svg>
176
+ </button>
177
+ <button
178
+ type="button"
179
+ class="cb-dataview__layout-btn"
180
+ [attr.aria-pressed]="layout() === 'grid'"
181
+ [attr.aria-label]="t().gridView"
182
+ (click)="layout.set('grid')"
183
+ >
184
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" /><rect x="14" y="3" width="7" height="7" /><rect x="3" y="14" width="7" height="7" /><rect x="14" y="14" width="7" height="7" /></svg>
185
+ </button>
186
+ </div>
187
+ }
188
+ </div>
189
+ }
190
+
191
+ <div class="cb-dataview" [attr.data-layout]="layout()" role="list">
192
+ @for (item of page(); track trackKey(item, $index); let i = $index) {
193
+ <div class="cb-dataview__cell" role="listitem">
194
+ @if (itemTemplate(); as tpl) {
195
+ <ng-container *ngTemplateOutlet="tpl.template; context: { $implicit: item, layout: layout(), index: first() + i }" />
196
+ } @else {
197
+ <article class="cb-dataview__item">
198
+ <strong class="cb-dataview__item-title">{{ asItem(item).title }}</strong>
199
+ @if (asItem(item).category) {
200
+ <small>{{ asItem(item).category }}</small>
201
+ }
202
+ @if (asItem(item).description) {
203
+ <p>{{ asItem(item).description }}</p>
204
+ }
205
+ <button
206
+ type="button"
207
+ class="cb-dataview__select"
208
+ [attr.aria-pressed]="isSelected(item)"
209
+ [attr.aria-label]="fmt(t().selectItem, asItem(item).title)"
210
+ (click)="selection.set(asItem(item))"
211
+ >
212
+ {{ t().select }}
213
+ </button>
214
+ </article>
215
+ }
216
+ </div>
217
+ } @empty {
218
+ <p class="cb-dataview__empty">{{ emptyMessage() ?? t().noResults }}</p>
219
+ }
220
+ </div>
221
+
222
+ @if (rows() > 0 && value().length > rows()) {
223
+ <cb-paginator class="cb-dataview__paginator" [totalRecords]="value().length" [rows]="rows()" [(first)]="first" />
224
+ }
225
+ `, styles: [":host{display:block;color:var(--cb-color-text)}.cb-dataview__header{display:flex;align-items:center;justify-content:space-between;gap:var(--cb-space-3, .75rem);margin-bottom:var(--cb-space-3, .75rem)}.cb-dataview__title{min-width:0}.cb-dataview__layouts{display:inline-flex;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem);overflow:hidden}.cb-dataview__layout-btn{display:inline-flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;padding:0;border:0;background:transparent;color:var(--cb-color-text-muted);cursor:pointer}.cb-dataview__layout-btn+.cb-dataview__layout-btn{border-inline-start:1px solid var(--cb-color-border)}.cb-dataview__layout-btn[aria-pressed=true]{color:var(--cb-color-primary-600);background:color-mix(in srgb,var(--cb-color-primary-500) 12%,transparent)}.cb-dataview__layout-btn:focus-visible{outline:2px solid var(--cb-color-focus-ring, var(--cb-color-primary-500));outline-offset:-2px}.cb-dataview{display:grid;gap:var(--cb-space-3, .75rem)}.cb-dataview[data-layout=grid]{grid-template-columns:repeat(auto-fill,minmax(min(14rem,100%),1fr))}.cb-dataview__item{height:100%;box-sizing:border-box;display:flex;flex-direction:column;gap:var(--cb-space-1, .25rem);padding:var(--cb-space-4, 1rem);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);background:var(--cb-color-surface-raised)}.cb-dataview[data-layout=list] .cb-dataview__item{flex-direction:row;flex-wrap:wrap;align-items:center;column-gap:var(--cb-space-3, .75rem)}.cb-dataview__item-title{color:var(--cb-color-text-strong)}.cb-dataview__item small{color:var(--cb-color-text-muted)}.cb-dataview__item p{margin:0;color:var(--cb-color-text-muted);font-size:var(--cb-text-sm, .875rem)}.cb-dataview[data-layout=list] .cb-dataview__item p{flex:1 1 12rem}.cb-dataview__select{align-self:flex-start;margin-top:auto;padding:.35rem .75rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem);background:transparent;color:var(--cb-color-text);font:inherit;font-size:var(--cb-text-sm, .875rem);cursor:pointer}.cb-dataview[data-layout=list] .cb-dataview__select{margin-top:0;margin-inline-start:auto}.cb-dataview__select[aria-pressed=true]{border-color:var(--cb-color-primary-500);color:var(--cb-color-primary-700);background:color-mix(in srgb,var(--cb-color-primary-500) 12%,transparent)}.cb-dataview__empty{grid-column:1 / -1;margin:0;padding:var(--cb-space-6, 1.5rem);text-align:center;color:var(--cb-color-text-muted)}.cb-dataview__paginator{margin-top:var(--cb-space-3, .75rem)}:host-context([data-theme=\"dark\"]) .cb-dataview__select[aria-pressed=true]{color:var(--cb-color-primary-300)}\n"] }]
226
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }, { type: i0.Output, args: ["layoutChange"] }], showLayoutToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLayoutToggle", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CbDataViewItemTemplate), { isSignal: true }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CbDataViewHeader), { isSignal: true }] }] } });
227
+ function toBoolean(value) {
228
+ return value !== false && value != null && `${value}` !== 'false';
229
+ }
22
230
 
23
231
  /**
24
232
  * Generated bundle index. Do not edit.
25
233
  */
26
234
 
27
- export { CbDataView };
235
+ export { CbDataView, CbDataViewHeader, CbDataViewItemTemplate };