@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
@@ -1,15 +1,21 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, model, output, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { input, computed, model, output, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { CbIcon } from '@caribeng/ui/icon';
4
+ import { injectCbTranslation, cbVisibleItems, cbRunCommand } from '@caribeng/ui';
4
5
 
5
6
  /** Horizontal navigation menu with an active item. */
6
7
  class CbTabMenu {
7
8
  constructor() {
9
+ /** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
10
+ this.t = injectCbTranslation();
8
11
  this.items = input([], /* @ts-ignore */
9
12
  ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
13
+ /** Items sin los de `visible: false`. */
14
+ this.visibleItems = computed(() => cbVisibleItems(this.items()), /* @ts-ignore */
15
+ ...(ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []));
10
16
  this.activeIndex = model(0, /* @ts-ignore */
11
17
  ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
12
- this.ariaLabel = input('Section navigation', /* @ts-ignore */
18
+ this.ariaLabel = input(undefined, /* @ts-ignore */
13
19
  ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
14
20
  this.itemSelect = output();
15
21
  }
@@ -17,13 +23,14 @@ class CbTabMenu {
17
23
  if (item.disabled)
18
24
  return;
19
25
  this.activeIndex.set(index);
26
+ cbRunCommand(item);
20
27
  this.itemSelect.emit(item);
21
28
  }
22
29
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTabMenu, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
23
30
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbTabMenu, isStandalone: true, selector: "cb-tabmenu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, activeIndex: { classPropertyName: "activeIndex", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeIndex: "activeIndexChange", itemSelect: "itemSelect" }, host: { classAttribute: "cb-tabmenu" }, ngImport: i0, template: `
24
- <nav [attr.aria-label]="ariaLabel()">
31
+ <nav [attr.aria-label]="(ariaLabel() ?? t().sectionNavigation)">
25
32
  <ul class="cb-tabmenu__list">
26
- @for (item of items(); track $index; let i = $index) {
33
+ @for (item of visibleItems(); track $index; let i = $index) {
27
34
  <li class="cb-tabmenu__entry">
28
35
  @if (item.url && !item.disabled) {
29
36
  <a class="cb-tabmenu__link" [href]="item.url" [attr.aria-current]="activeIndex() === i ? 'page' : null" [attr.tabindex]="item.disabled ? -1 : 0" (click)="select(item, i)">
@@ -45,9 +52,9 @@ class CbTabMenu {
45
52
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTabMenu, decorators: [{
46
53
  type: Component,
47
54
  args: [{ selector: 'cb-tabmenu', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbIcon], host: { class: 'cb-tabmenu' }, template: `
48
- <nav [attr.aria-label]="ariaLabel()">
55
+ <nav [attr.aria-label]="(ariaLabel() ?? t().sectionNavigation)">
49
56
  <ul class="cb-tabmenu__list">
50
- @for (item of items(); track $index; let i = $index) {
57
+ @for (item of visibleItems(); track $index; let i = $index) {
51
58
  <li class="cb-tabmenu__entry">
52
59
  @if (item.url && !item.disabled) {
53
60
  <a class="cb-tabmenu__link" [href]="item.url" [attr.aria-current]="activeIndex() === i ? 'page' : null" [attr.tabindex]="item.disabled ? -1 : 0" (click)="select(item, i)">
@@ -31,7 +31,7 @@ class CbTag {
31
31
  <span class="cb-tag__label">{{ value() }}</span>
32
32
  }
33
33
  <ng-content />
34
- `, isInline: true, styles: [":host{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;border-radius:var(--cb-radius-sm);font-family:var(--cb-font-sans);font-size:var(--cb-text-xs);font-weight:var(--cb-font-weight-medium);line-height:1.4;color:var(--_fg);background-color:var(--_bg)}:host(.cb-tag--rounded){border-radius:var(--cb-radius-full);padding-inline:.625rem}:host(.cb-tag--primary){--_bg: var(--cb-color-primary-100);--_fg: var(--cb-color-primary-500)}:host(.cb-tag--secondary){--_bg: var(--cb-color-surface-100);--_fg: var(--cb-color-text-muted)}:host(.cb-tag--success){--_bg: var(--cb-color-success-100);--_fg: var(--cb-color-success-500)}:host(.cb-tag--info){--_bg: var(--cb-color-info-100);--_fg: var(--cb-color-info-500)}:host(.cb-tag--warning){--_bg: var(--cb-color-warning-100);--_fg: var(--cb-color-warning-500)}:host(.cb-tag--danger){--_bg: var(--cb-color-danger-100);--_fg: var(--cb-color-danger-500)}:host(.cb-tag--help){--_bg: var(--cb-color-help-100);--_fg: var(--cb-color-help-500)}:host(.cb-tag--contrast){--_bg: var(--cb-color-text);--_fg: var(--cb-color-bg)}:host-context([data-theme=\"dark\"]){--_bg: color-mix(in srgb, var(--_fg) 22%, transparent)}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
34
+ `, isInline: true, styles: [":host{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;border-radius:var(--cb-radius-sm);font-family:var(--cb-font-sans);font-size:var(--cb-text-xs);font-weight:var(--cb-font-weight-medium);line-height:1.4;color:var(--_fg);background-color:var(--_bg)}:host(.cb-tag--rounded){border-radius:var(--cb-radius-full);padding-inline:.625rem}:host(.cb-tag--primary){--_bg: var(--cb-color-primary-100);--_fg: var(--cb-color-primary-500)}:host(.cb-tag--secondary){--_bg: var(--cb-color-surface-hover);--_fg: var(--cb-color-text-muted)}:host(.cb-tag--success){--_bg: var(--cb-color-success-100);--_fg: var(--cb-color-success-500)}:host(.cb-tag--info){--_bg: var(--cb-color-info-100);--_fg: var(--cb-color-info-500)}:host(.cb-tag--warning){--_bg: var(--cb-color-warning-100);--_fg: var(--cb-color-warning-500)}:host(.cb-tag--danger){--_bg: var(--cb-color-danger-100);--_fg: var(--cb-color-danger-500)}:host(.cb-tag--help){--_bg: var(--cb-color-help-100);--_fg: var(--cb-color-help-500)}:host(.cb-tag--contrast){--_bg: var(--cb-color-text);--_fg: var(--cb-color-bg)}:host-context([data-theme=\"dark\"]){--_bg: color-mix(in srgb, var(--_fg) 22%, transparent)}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
35
35
  }
36
36
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTag, decorators: [{
37
37
  type: Component,
@@ -47,7 +47,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
47
47
  <span class="cb-tag__label">{{ value() }}</span>
48
48
  }
49
49
  <ng-content />
50
- `, styles: [":host{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;border-radius:var(--cb-radius-sm);font-family:var(--cb-font-sans);font-size:var(--cb-text-xs);font-weight:var(--cb-font-weight-medium);line-height:1.4;color:var(--_fg);background-color:var(--_bg)}:host(.cb-tag--rounded){border-radius:var(--cb-radius-full);padding-inline:.625rem}:host(.cb-tag--primary){--_bg: var(--cb-color-primary-100);--_fg: var(--cb-color-primary-500)}:host(.cb-tag--secondary){--_bg: var(--cb-color-surface-100);--_fg: var(--cb-color-text-muted)}:host(.cb-tag--success){--_bg: var(--cb-color-success-100);--_fg: var(--cb-color-success-500)}:host(.cb-tag--info){--_bg: var(--cb-color-info-100);--_fg: var(--cb-color-info-500)}:host(.cb-tag--warning){--_bg: var(--cb-color-warning-100);--_fg: var(--cb-color-warning-500)}:host(.cb-tag--danger){--_bg: var(--cb-color-danger-100);--_fg: var(--cb-color-danger-500)}:host(.cb-tag--help){--_bg: var(--cb-color-help-100);--_fg: var(--cb-color-help-500)}:host(.cb-tag--contrast){--_bg: var(--cb-color-text);--_fg: var(--cb-color-bg)}:host-context([data-theme=\"dark\"]){--_bg: color-mix(in srgb, var(--_fg) 22%, transparent)}\n"] }]
50
+ `, styles: [":host{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;border-radius:var(--cb-radius-sm);font-family:var(--cb-font-sans);font-size:var(--cb-text-xs);font-weight:var(--cb-font-weight-medium);line-height:1.4;color:var(--_fg);background-color:var(--_bg)}:host(.cb-tag--rounded){border-radius:var(--cb-radius-full);padding-inline:.625rem}:host(.cb-tag--primary){--_bg: var(--cb-color-primary-100);--_fg: var(--cb-color-primary-500)}:host(.cb-tag--secondary){--_bg: var(--cb-color-surface-hover);--_fg: var(--cb-color-text-muted)}:host(.cb-tag--success){--_bg: var(--cb-color-success-100);--_fg: var(--cb-color-success-500)}:host(.cb-tag--info){--_bg: var(--cb-color-info-100);--_fg: var(--cb-color-info-500)}:host(.cb-tag--warning){--_bg: var(--cb-color-warning-100);--_fg: var(--cb-color-warning-500)}:host(.cb-tag--danger){--_bg: var(--cb-color-danger-100);--_fg: var(--cb-color-danger-500)}:host(.cb-tag--help){--_bg: var(--cb-color-help-100);--_fg: var(--cb-color-help-500)}:host(.cb-tag--contrast){--_bg: var(--cb-color-text);--_fg: var(--cb-color-bg)}:host-context([data-theme=\"dark\"]){--_bg: color-mix(in srgb, var(--_fg) 22%, transparent)}\n"] }]
51
51
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "severity", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }] } });
52
52
  function toBoolean(value) {
53
53
  return value !== false && value != null && `${value}` !== 'false';
@@ -1,11 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, output, signal, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { input, output, signal, viewChild, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { injectCbTranslation } from '@caribeng/ui';
3
4
 
4
5
  /**
5
6
  * Terminal de CaribeNG: consola interactiva basada en señales con historial de comandos.
6
7
  */
7
8
  class CbTerminal {
8
9
  constructor() {
10
+ /** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
11
+ this.t = injectCbTranslation();
9
12
  this.welcomeMessage = input('', /* @ts-ignore */
10
13
  ...(ngDevMode ? [{ debugName: "welcomeMessage" }] : /* istanbul ignore next */ []));
11
14
  this.prompt = input('caribeng $', /* @ts-ignore */
@@ -15,6 +18,17 @@ class CbTerminal {
15
18
  ...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
16
19
  this.currentCommand = signal('', /* @ts-ignore */
17
20
  ...(ngDevMode ? [{ debugName: "currentCommand" }] : /* istanbul ignore next */ []));
21
+ /** Posición en el historial al recorrerlo con flechas (`null` = escribiendo uno nuevo). */
22
+ this.historyIndex = null;
23
+ this.commandInput = viewChild('commandInput', /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "commandInput" }] : /* istanbul ignore next */ []));
25
+ }
26
+ /** Fija el comando actual también en el DOM (el binding no detecta '' → '' si no hubo render entre medias). */
27
+ setCommand(value) {
28
+ this.currentCommand.set(value);
29
+ const input = this.commandInput()?.nativeElement;
30
+ if (input)
31
+ input.value = value;
18
32
  }
19
33
  onInput(event) {
20
34
  this.currentCommand.set(event.target.value);
@@ -25,13 +39,29 @@ class CbTerminal {
25
39
  return;
26
40
  if (cmd === 'clear') {
27
41
  this.entries.set([]);
28
- this.currentCommand.set('');
42
+ this.setCommand('');
29
43
  return;
30
44
  }
31
45
  this.entries.update((list) => [...list, { command: cmd }]);
32
- this.currentCommand.set('');
46
+ this.setCommand('');
47
+ this.historyIndex = null;
33
48
  this.commandEntered.emit(cmd);
34
49
  }
50
+ /** Flecha arriba / abajo recorren los comandos anteriores. */
51
+ recall(event, step) {
52
+ const commands = this.entries().map((e) => e.command);
53
+ if (!commands.length)
54
+ return;
55
+ event.preventDefault();
56
+ const next = (this.historyIndex ?? commands.length) + step;
57
+ if (next >= commands.length) {
58
+ this.historyIndex = null;
59
+ this.setCommand('');
60
+ return;
61
+ }
62
+ this.historyIndex = Math.max(0, next);
63
+ this.setCommand(commands[this.historyIndex]);
64
+ }
35
65
  sendResponse(response) {
36
66
  this.entries.update((list) => {
37
67
  if (list.length === 0)
@@ -42,11 +72,11 @@ class CbTerminal {
42
72
  });
43
73
  }
44
74
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTerminal, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
45
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbTerminal, isStandalone: true, selector: "cb-terminal", inputs: { welcomeMessage: { classPropertyName: "welcomeMessage", publicName: "welcomeMessage", isSignal: true, isRequired: false, transformFunction: null }, prompt: { classPropertyName: "prompt", publicName: "prompt", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { commandEntered: "commandEntered" }, host: { classAttribute: "cb-terminal" }, ngImport: i0, template: `
75
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbTerminal, isStandalone: true, selector: "cb-terminal", inputs: { welcomeMessage: { classPropertyName: "welcomeMessage", publicName: "welcomeMessage", isSignal: true, isRequired: false, transformFunction: null }, prompt: { classPropertyName: "prompt", publicName: "prompt", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { commandEntered: "commandEntered" }, host: { classAttribute: "cb-terminal" }, viewQueries: [{ propertyName: "commandInput", first: true, predicate: ["commandInput"], descendants: true, isSignal: true }], ngImport: i0, template: `
46
76
  @if (welcomeMessage()) {
47
77
  <div class="cb-terminal__welcome">{{ welcomeMessage() }}</div>
48
78
  }
49
- <div class="cb-terminal__history">
79
+ <div class="cb-terminal__history" role="log" aria-live="polite">
50
80
  @for (entry of entries(); track $index) {
51
81
  <div class="cb-terminal__entry">
52
82
  <div class="cb-terminal__line">
@@ -62,12 +92,15 @@ class CbTerminal {
62
92
  <div class="cb-terminal__input-row">
63
93
  <span class="cb-terminal__prompt">{{ prompt() }}</span>
64
94
  <input
95
+ #commandInput
65
96
  type="text"
66
97
  class="cb-terminal__input"
67
98
  [value]="currentCommand()"
68
- [attr.aria-label]="prompt() || 'Comando'"
99
+ [attr.aria-label]="prompt() || t().command"
69
100
  (input)="onInput($event)"
70
101
  (keydown.enter)="submitCommand()"
102
+ (keydown.arrowup)="recall($event, -1)"
103
+ (keydown.arrowdown)="recall($event, 1)"
71
104
  />
72
105
  </div>
73
106
  `, isInline: true, styles: [":host{display:block;width:100%;padding:var(--cb-space-4);border-radius:var(--cb-radius-lg);background:#0f172a;color:#e2e8f0;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.85rem;box-sizing:border-box}.cb-terminal__welcome{margin-bottom:var(--cb-space-2);color:#94a3b8}.cb-terminal__entry{margin-bottom:.375rem}.cb-terminal__line,.cb-terminal__input-row{display:flex;align-items:center;gap:.5rem}.cb-terminal__prompt{color:#10b981;font-weight:600;white-space:nowrap}.cb-terminal__response{margin-top:.125rem;color:#cbd5e1;white-space:pre-wrap}.cb-terminal__input{flex:1;border:none;background:transparent;color:#f8fafc;font-family:inherit;font-size:inherit;outline:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
@@ -78,7 +111,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
78
111
  @if (welcomeMessage()) {
79
112
  <div class="cb-terminal__welcome">{{ welcomeMessage() }}</div>
80
113
  }
81
- <div class="cb-terminal__history">
114
+ <div class="cb-terminal__history" role="log" aria-live="polite">
82
115
  @for (entry of entries(); track $index) {
83
116
  <div class="cb-terminal__entry">
84
117
  <div class="cb-terminal__line">
@@ -94,16 +127,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
94
127
  <div class="cb-terminal__input-row">
95
128
  <span class="cb-terminal__prompt">{{ prompt() }}</span>
96
129
  <input
130
+ #commandInput
97
131
  type="text"
98
132
  class="cb-terminal__input"
99
133
  [value]="currentCommand()"
100
- [attr.aria-label]="prompt() || 'Comando'"
134
+ [attr.aria-label]="prompt() || t().command"
101
135
  (input)="onInput($event)"
102
136
  (keydown.enter)="submitCommand()"
137
+ (keydown.arrowup)="recall($event, -1)"
138
+ (keydown.arrowdown)="recall($event, 1)"
103
139
  />
104
140
  </div>
105
141
  `, styles: [":host{display:block;width:100%;padding:var(--cb-space-4);border-radius:var(--cb-radius-lg);background:#0f172a;color:#e2e8f0;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.85rem;box-sizing:border-box}.cb-terminal__welcome{margin-bottom:var(--cb-space-2);color:#94a3b8}.cb-terminal__entry{margin-bottom:.375rem}.cb-terminal__line,.cb-terminal__input-row{display:flex;align-items:center;gap:.5rem}.cb-terminal__prompt{color:#10b981;font-weight:600;white-space:nowrap}.cb-terminal__response{margin-top:.125rem;color:#cbd5e1;white-space:pre-wrap}.cb-terminal__input{flex:1;border:none;background:transparent;color:#f8fafc;font-family:inherit;font-size:inherit;outline:none}\n"] }]
106
- }], propDecorators: { welcomeMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "welcomeMessage", required: false }] }], prompt: [{ type: i0.Input, args: [{ isSignal: true, alias: "prompt", required: false }] }], commandEntered: [{ type: i0.Output, args: ["commandEntered"] }] } });
142
+ }], propDecorators: { welcomeMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "welcomeMessage", required: false }] }], prompt: [{ type: i0.Input, args: [{ isSignal: true, alias: "prompt", required: false }] }], commandEntered: [{ type: i0.Output, args: ["commandEntered"] }], commandInput: [{ type: i0.ViewChild, args: ['commandInput', { isSignal: true }] }] } });
107
143
 
108
144
  /**
109
145
  * Generated bundle index. Do not edit.
@@ -0,0 +1,82 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, input, booleanAttribute, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { injectCbTranslation, CbThemeService } from '@caribeng/ui';
4
+ import { CbButton } from '@caribeng/ui/button';
5
+ import { CbIcon } from '@caribeng/ui/icon';
6
+
7
+ /**
8
+ * Botón de cambio de tema claro / oscuro sobre `CbThemeService` (con
9
+ * `provideCaribeNG({ persistTheme: true })` recuerda la elección).
10
+ *
11
+ * Su nombre accesible describe la acción ("Cambiar a tema oscuro"), por eso
12
+ * no usa `aria-pressed`.
13
+ *
14
+ * @example
15
+ * ```html
16
+ * <cb-theme-toggle />
17
+ * <cb-theme-toggle showLabel size="sm" />
18
+ * ```
19
+ */
20
+ class CbThemeToggle {
21
+ constructor() {
22
+ /** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
23
+ this.t = injectCbTranslation();
24
+ this.theme = inject(CbThemeService);
25
+ this.size = input('md', /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
27
+ /** Muestra el texto además del icono. */
28
+ this.showLabel = input(false, { ...(ngDevMode ? { debugName: "showLabel" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
29
+ /** Acción que hará el botón: cambiar al tema contrario al actual. */
30
+ this.label = computed(() => (this.theme.isDark() ? this.t().switchToLight : this.t().switchToDark), /* @ts-ignore */
31
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
32
+ }
33
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbThemeToggle, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
34
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbThemeToggle, isStandalone: true, selector: "cb-theme-toggle", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showLabel: { classPropertyName: "showLabel", publicName: "showLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cb-theme-toggle" }, ngImport: i0, template: `
35
+ <cb-button
36
+ variant="text"
37
+ severity="secondary"
38
+ [size]="size()"
39
+ [ariaLabel]="showLabel() ? undefined : label()"
40
+ (click)="theme.toggle()"
41
+ >
42
+ <cb-icon [name]="theme.isDark() ? 'sun' : 'moon'" [size]="18" aria-hidden="true" />
43
+ @if (showLabel()) {
44
+ {{ label() }}
45
+ }
46
+ </cb-button>
47
+ `, isInline: true, 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 }); }
48
+ }
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbThemeToggle, decorators: [{
50
+ type: Component,
51
+ args: [{
52
+ selector: 'cb-theme-toggle',
53
+ changeDetection: ChangeDetectionStrategy.OnPush,
54
+ encapsulation: ViewEncapsulation.Emulated,
55
+ imports: [CbButton, CbIcon],
56
+ host: { class: 'cb-theme-toggle' },
57
+ template: `
58
+ <cb-button
59
+ variant="text"
60
+ severity="secondary"
61
+ [size]="size()"
62
+ [ariaLabel]="showLabel() ? undefined : label()"
63
+ (click)="theme.toggle()"
64
+ >
65
+ <cb-icon [name]="theme.isDark() ? 'sun' : 'moon'" [size]="18" aria-hidden="true" />
66
+ @if (showLabel()) {
67
+ {{ label() }}
68
+ }
69
+ </cb-button>
70
+ `,
71
+ }]
72
+ }], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], showLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLabel", required: false }] }] } });
73
+
74
+ /*
75
+ * Public API Surface de @caribeng/ui/themetoggle
76
+ */
77
+
78
+ /**
79
+ * Generated bundle index. Do not edit.
80
+ */
81
+
82
+ export { CbThemeToggle };
@@ -1,20 +1,26 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ViewContainerRef, DestroyRef, input, output, signal, viewChild, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { inject, ViewContainerRef, DestroyRef, input, computed, output, signal, viewChild, Injector, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { Overlay } from '@angular/cdk/overlay';
4
4
  import { TemplatePortal } from '@angular/cdk/portal';
5
5
  import { CbIcon } from '@caribeng/ui/icon';
6
+ import { injectCbTranslation, cbVisibleItems, cbRunCommand } from '@caribeng/ui';
6
7
 
7
8
  /** Popup menu with cascading submenus. */
8
9
  class CbTieredMenu {
9
10
  constructor() {
11
+ /** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
12
+ this.t = injectCbTranslation();
10
13
  this.overlay = inject(Overlay);
11
14
  this.vcr = inject(ViewContainerRef);
12
15
  this.destroyRef = inject(DestroyRef);
13
16
  this.items = input([], /* @ts-ignore */
14
17
  ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
15
- this.ariaLabel = input('Menu', /* @ts-ignore */
18
+ /** Items sin los de `visible: false`. */
19
+ this.visibleItems = computed(() => cbVisibleItems(this.items()), /* @ts-ignore */
20
+ ...(ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []));
21
+ this.ariaLabel = input(undefined, /* @ts-ignore */
16
22
  ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
17
- this.triggerLabel = input('Menu', /* @ts-ignore */
23
+ this.triggerLabel = input(undefined, /* @ts-ignore */
18
24
  ...(ngDevMode ? [{ debugName: "triggerLabel" }] : /* istanbul ignore next */ []));
19
25
  this.itemSelect = output();
20
26
  this.isOpen = signal(false, /* @ts-ignore */
@@ -30,6 +36,8 @@ class CbTieredMenu {
30
36
  { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
31
37
  { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 4 },
32
38
  ];
39
+ this.injector = inject(Injector);
40
+ this.trigger = viewChild.required('trigger');
33
41
  this.destroyRef.onDestroy(() => this.overlayRef?.dispose());
34
42
  }
35
43
  toggle(event) { if (this.overlayRef)
@@ -43,26 +51,111 @@ class CbTieredMenu {
43
51
  this.overlayRef = ref;
44
52
  this.isOpen.set(true);
45
53
  ref.attach(new TemplatePortal(this.content(), this.vcr));
46
- ref.backdropClick().subscribe(() => this.hide());
54
+ ref.backdropClick().subscribe(() => this.hide(false));
47
55
  ref.keydownEvents().subscribe((event) => { if (event.key === 'Escape') {
48
56
  event.preventDefault();
49
57
  this.hide();
50
58
  } });
59
+ // Patrón WAI-ARIA menu: al abrir, el foco pasa al primer item.
60
+ afterNextRender(() => this.focusFirst(ref.overlayElement.querySelector('.cb-tieredmenu__list')), { injector: this.injector });
51
61
  }
52
62
  select(item) { if (item.disabled)
53
- return; this.itemSelect.emit(item); this.hide(); }
54
- hide() { this.overlayRef?.dispose(); this.overlayRef = null; this.isOpen.set(false); this.openIndex.set(null); this.openChildIndex.set(null); }
63
+ return; cbRunCommand(item); this.itemSelect.emit(item); this.hide(); }
64
+ /** Cierra el menú; con `restoreFocus` (por defecto) el foco vuelve al botón que lo abre. */
65
+ hide(restoreFocus = true) {
66
+ const wasOpen = !!this.overlayRef;
67
+ this.overlayRef?.dispose();
68
+ this.overlayRef = null;
69
+ this.isOpen.set(false);
70
+ this.openIndex.set(null);
71
+ this.openChildIndex.set(null);
72
+ if (wasOpen && restoreFocus)
73
+ this.trigger().nativeElement.focus();
74
+ }
75
+ onTriggerKeydown(event) {
76
+ if (event.key !== 'ArrowDown' || this.overlayRef)
77
+ return;
78
+ event.preventDefault();
79
+ this.show(event.currentTarget);
80
+ }
81
+ /** Flechas, Inicio y Fin dentro de cada nivel; derecha abre el submenú e izquierda vuelve al nivel anterior. */
82
+ onMenuKeydown(event) {
83
+ const item = event.target.closest('[role="menuitem"]');
84
+ const menu = item?.closest('[role="menu"]');
85
+ if (!item || !menu)
86
+ return;
87
+ const items = this.menuItems(menu);
88
+ const at = items.indexOf(item);
89
+ const opensSubmenu = item.getAttribute('aria-haspopup') === 'menu';
90
+ switch (event.key) {
91
+ case 'ArrowDown':
92
+ items[(at + 1) % items.length]?.focus();
93
+ break;
94
+ case 'ArrowUp':
95
+ items[(at - 1 + items.length) % items.length]?.focus();
96
+ break;
97
+ case 'Home':
98
+ items[0]?.focus();
99
+ break;
100
+ case 'End':
101
+ items[items.length - 1]?.focus();
102
+ break;
103
+ case 'ArrowRight':
104
+ case 'Enter':
105
+ case ' ':
106
+ if (!opensSubmenu)
107
+ return;
108
+ this.openSubmenu(item);
109
+ break;
110
+ case 'ArrowLeft': {
111
+ if (menu.classList.contains('cb-tieredmenu__list'))
112
+ break;
113
+ const parent = menu.parentElement?.querySelector(':scope > [role="menuitem"]');
114
+ if (parent?.dataset['level'] === '1') {
115
+ this.openIndex.set(null);
116
+ this.openChildIndex.set(null);
117
+ }
118
+ else
119
+ this.openChildIndex.set(null);
120
+ parent?.focus();
121
+ break;
122
+ }
123
+ case 'Tab':
124
+ this.hide();
125
+ break;
126
+ default: return;
127
+ }
128
+ event.preventDefault();
129
+ }
130
+ openSubmenu(item) {
131
+ const index = Number(item.dataset['index']);
132
+ if (item.dataset['level'] === '1') {
133
+ this.openIndex.set(index);
134
+ this.openChildIndex.set(null);
135
+ }
136
+ else
137
+ this.openChildIndex.set(index);
138
+ // El submenú se pinta en el siguiente render (zoneless): se enfoca después.
139
+ afterNextRender(() => this.focusFirst(item.parentElement?.querySelector(':scope > [role="menu"]') ?? null), { injector: this.injector });
140
+ }
141
+ menuItems(menu) {
142
+ return Array.from(menu.querySelectorAll(':scope > li > [role="menuitem"]')).filter((el) => !el.hasAttribute('disabled'));
143
+ }
144
+ focusFirst(menu) {
145
+ if (menu)
146
+ this.menuItems(menu)[0]?.focus();
147
+ }
55
148
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTieredMenu, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
56
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbTieredMenu, isStandalone: true, selector: "cb-tieredmenu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, triggerLabel: { classPropertyName: "triggerLabel", publicName: "triggerLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
57
- <button class="cb-tieredmenu__trigger" type="button" [attr.aria-expanded]="isOpen()" aria-haspopup="menu" (click)="toggle($event)">{{ triggerLabel() }}</button>
149
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbTieredMenu, isStandalone: true, selector: "cb-tieredmenu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, triggerLabel: { classPropertyName: "triggerLabel", publicName: "triggerLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }, { propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }], ngImport: i0, template: `
150
+ <button #trigger class="cb-tieredmenu__trigger" type="button" [attr.aria-expanded]="isOpen()" aria-haspopup="menu" (click)="toggle($event)" (keydown)="onTriggerKeydown($event)">{{ (triggerLabel() ?? t().menu) }}</button>
58
151
  <ng-template #content>
59
- <ul class="cb-tieredmenu__list" role="menu" [attr.aria-label]="ariaLabel()">
60
- @for (item of items(); track $index; let i = $index) {
152
+ <ul class="cb-tieredmenu__list" role="menu" [attr.aria-label]="(ariaLabel() ?? t().menu)" (keydown)="onMenuKeydown($event)">
153
+ @for (item of visibleItems(); track $index; let i = $index) {
61
154
  @if (item.separator) { <li class="cb-tieredmenu__separator" role="separator"></li> }
62
155
  @else {
63
- <li class="cb-tieredmenu__entry" [class.cb-tieredmenu__entry--open]="openIndex() === i">
156
+ <li class="cb-tieredmenu__entry" role="none" [class.cb-tieredmenu__entry--open]="openIndex() === i">
64
157
  @if (item.items?.length) {
65
- <button class="cb-tieredmenu__item" type="button" role="menuitem" aria-haspopup="menu" [attr.aria-expanded]="openIndex() === i" [disabled]="item.disabled" (mouseenter)="openIndex.set(i)" (click)="openIndex.set(openIndex() === i ? null : i)">
158
+ <button class="cb-tieredmenu__item" type="button" role="menuitem" aria-haspopup="menu" [attr.aria-expanded]="openIndex() === i" data-level="1" [attr.data-index]="i" [disabled]="item.disabled" (mouseenter)="openIndex.set(i)" (click)="openIndex.set(openIndex() === i ? null : i)">
66
159
  @if (item.icon) { <cb-icon [name]="item.icon" [size]="16" aria-hidden="true" /> }<span>{{ item.label }}</span><cb-icon name="chevron-right" [size]="15" aria-hidden="true" />
67
160
  </button>
68
161
  @if (openIndex() === i) {
@@ -70,7 +163,7 @@ class CbTieredMenu {
70
163
  @for (child of item.items; track $index; let j = $index) {
71
164
  <li role="none">
72
165
  @if (child.items?.length) {
73
- <button class="cb-tieredmenu__item" type="button" role="menuitem" aria-haspopup="menu" [attr.aria-expanded]="openChildIndex() === j" [disabled]="child.disabled" (mouseenter)="openChildIndex.set(j)" (click)="openChildIndex.set(openChildIndex() === j ? null : j)">
166
+ <button class="cb-tieredmenu__item" type="button" role="menuitem" aria-haspopup="menu" [attr.aria-expanded]="openChildIndex() === j" data-level="2" [attr.data-index]="j" [disabled]="child.disabled" (mouseenter)="openChildIndex.set(j)" (click)="openChildIndex.set(openChildIndex() === j ? null : j)">
74
167
  @if (child.icon) { <cb-icon [name]="child.icon" [size]="16" aria-hidden="true" /> }<span>{{ child.label }}</span><cb-icon name="chevron-right" [size]="15" aria-hidden="true" />
75
168
  </button>
76
169
  @if (openChildIndex() === j) {
@@ -102,15 +195,15 @@ class CbTieredMenu {
102
195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbTieredMenu, decorators: [{
103
196
  type: Component,
104
197
  args: [{ selector: 'cb-tieredmenu', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbIcon], template: `
105
- <button class="cb-tieredmenu__trigger" type="button" [attr.aria-expanded]="isOpen()" aria-haspopup="menu" (click)="toggle($event)">{{ triggerLabel() }}</button>
198
+ <button #trigger class="cb-tieredmenu__trigger" type="button" [attr.aria-expanded]="isOpen()" aria-haspopup="menu" (click)="toggle($event)" (keydown)="onTriggerKeydown($event)">{{ (triggerLabel() ?? t().menu) }}</button>
106
199
  <ng-template #content>
107
- <ul class="cb-tieredmenu__list" role="menu" [attr.aria-label]="ariaLabel()">
108
- @for (item of items(); track $index; let i = $index) {
200
+ <ul class="cb-tieredmenu__list" role="menu" [attr.aria-label]="(ariaLabel() ?? t().menu)" (keydown)="onMenuKeydown($event)">
201
+ @for (item of visibleItems(); track $index; let i = $index) {
109
202
  @if (item.separator) { <li class="cb-tieredmenu__separator" role="separator"></li> }
110
203
  @else {
111
- <li class="cb-tieredmenu__entry" [class.cb-tieredmenu__entry--open]="openIndex() === i">
204
+ <li class="cb-tieredmenu__entry" role="none" [class.cb-tieredmenu__entry--open]="openIndex() === i">
112
205
  @if (item.items?.length) {
113
- <button class="cb-tieredmenu__item" type="button" role="menuitem" aria-haspopup="menu" [attr.aria-expanded]="openIndex() === i" [disabled]="item.disabled" (mouseenter)="openIndex.set(i)" (click)="openIndex.set(openIndex() === i ? null : i)">
206
+ <button class="cb-tieredmenu__item" type="button" role="menuitem" aria-haspopup="menu" [attr.aria-expanded]="openIndex() === i" data-level="1" [attr.data-index]="i" [disabled]="item.disabled" (mouseenter)="openIndex.set(i)" (click)="openIndex.set(openIndex() === i ? null : i)">
114
207
  @if (item.icon) { <cb-icon [name]="item.icon" [size]="16" aria-hidden="true" /> }<span>{{ item.label }}</span><cb-icon name="chevron-right" [size]="15" aria-hidden="true" />
115
208
  </button>
116
209
  @if (openIndex() === i) {
@@ -118,7 +211,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
118
211
  @for (child of item.items; track $index; let j = $index) {
119
212
  <li role="none">
120
213
  @if (child.items?.length) {
121
- <button class="cb-tieredmenu__item" type="button" role="menuitem" aria-haspopup="menu" [attr.aria-expanded]="openChildIndex() === j" [disabled]="child.disabled" (mouseenter)="openChildIndex.set(j)" (click)="openChildIndex.set(openChildIndex() === j ? null : j)">
214
+ <button class="cb-tieredmenu__item" type="button" role="menuitem" aria-haspopup="menu" [attr.aria-expanded]="openChildIndex() === j" data-level="2" [attr.data-index]="j" [disabled]="child.disabled" (mouseenter)="openChildIndex.set(j)" (click)="openChildIndex.set(openChildIndex() === j ? null : j)">
122
215
  @if (child.icon) { <cb-icon [name]="child.icon" [size]="16" aria-hidden="true" /> }<span>{{ child.label }}</span><cb-icon name="chevron-right" [size]="15" aria-hidden="true" />
123
216
  </button>
124
217
  @if (openChildIndex() === j) {
@@ -146,7 +239,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
146
239
  </ul>
147
240
  </ng-template>
148
241
  `, styles: [":host{display:inline-block;color:var(--cb-color-text);font-family:var(--cb-font-sans)}.cb-tieredmenu__trigger{min-height:2.5rem;padding:.5rem .875rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);background:var(--cb-color-surface-raised);color:inherit;font:inherit;cursor:pointer}.cb-tieredmenu__trigger:hover,.cb-tieredmenu__trigger:focus-visible{outline:none;border-color:var(--cb-color-primary)}.cb-tieredmenu__list,.cb-tieredmenu__submenu{min-width:13rem;margin:0;padding:.375rem;list-style:none;background:var(--cb-color-surface-raised);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md);box-shadow:var(--cb-shadow-lg)}.cb-tieredmenu__entry{position:relative}.cb-tieredmenu__item{display:flex;align-items:center;gap:.625rem;width:100%;min-height:2.25rem;padding:.5rem .625rem;border:0;border-radius:var(--cb-radius-sm);background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}.cb-tieredmenu__item span{flex:1}.cb-tieredmenu__item:hover:not(:disabled),.cb-tieredmenu__item:focus-visible,.cb-tieredmenu__entry--open>.cb-tieredmenu__item{outline:none;background:var(--cb-color-surface)}.cb-tieredmenu__item:disabled{opacity:.5;cursor:default}.cb-tieredmenu__submenu{position:absolute;z-index:2;top:-.375rem;left:calc(100% + .25rem)}.cb-tieredmenu__submenu--third{z-index:3}.cb-tieredmenu__separator{height:1px;margin:.375rem .25rem;background:var(--cb-color-border)}\n"] }]
149
- }], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], triggerLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggerLabel", required: false }] }], itemSelect: [{ type: i0.Output, args: ["itemSelect"] }], content: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }] } });
242
+ }], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], triggerLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggerLabel", required: false }] }], itemSelect: [{ type: i0.Output, args: ["itemSelect"] }], content: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }] } });
150
243
 
151
244
  /**
152
245
  * Generated bundle index. Do not edit.