@caribeng/ui 22.2.0 → 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 (121) hide show
  1. package/README.md +93 -11
  2. package/fesm2022/caribeng-ui-accordion.mjs +2 -2
  3. package/fesm2022/caribeng-ui-avatar.mjs +2 -2
  4. package/fesm2022/caribeng-ui-badge.mjs +8 -2
  5. package/fesm2022/caribeng-ui-breadcrumb.mjs +13 -6
  6. package/fesm2022/caribeng-ui-chart.mjs +8 -5
  7. package/fesm2022/caribeng-ui-chat.mjs +1303 -0
  8. package/fesm2022/caribeng-ui-code-block.mjs +332 -0
  9. package/fesm2022/caribeng-ui-colorpicker.mjs +99 -5
  10. package/fesm2022/caribeng-ui-command-palette.mjs +476 -0
  11. package/fesm2022/caribeng-ui-confirmdialog.mjs +78 -13
  12. package/fesm2022/caribeng-ui-confirmpopup.mjs +91 -16
  13. package/fesm2022/caribeng-ui-contextmenu.mjs +8 -4
  14. package/fesm2022/caribeng-ui-copy-button.mjs +230 -0
  15. package/fesm2022/caribeng-ui-dataview.mjs +4 -1
  16. package/fesm2022/caribeng-ui-dock.mjs +52 -12
  17. package/fesm2022/caribeng-ui-drawer.mjs +9 -4
  18. package/fesm2022/caribeng-ui-editor.mjs +21 -0
  19. package/fesm2022/caribeng-ui-fieldset.mjs +2 -2
  20. package/fesm2022/caribeng-ui-file-card.mjs +134 -17
  21. package/fesm2022/caribeng-ui-folder-card.mjs +122 -12
  22. package/fesm2022/caribeng-ui-inlinemessage.mjs +2 -2
  23. package/fesm2022/caribeng-ui-inputmask.mjs +8 -2
  24. package/fesm2022/caribeng-ui-kanban.mjs +4612 -0
  25. package/fesm2022/caribeng-ui-kbd.mjs +122 -0
  26. package/fesm2022/caribeng-ui-megamenu.mjs +13 -9
  27. package/fesm2022/caribeng-ui-mentions.mjs +495 -0
  28. package/fesm2022/caribeng-ui-menu.mjs +8 -4
  29. package/fesm2022/caribeng-ui-menubar.mjs +9 -5
  30. package/fesm2022/caribeng-ui-message.mjs +6 -3
  31. package/fesm2022/caribeng-ui-organizationchart.mjs +6 -10
  32. package/fesm2022/caribeng-ui-panel.mjs +6 -6
  33. package/fesm2022/caribeng-ui-panelmenu.mjs +9 -6
  34. package/fesm2022/caribeng-ui-phone-input.mjs +688 -0
  35. package/fesm2022/caribeng-ui-pricing.mjs +263 -69
  36. package/fesm2022/caribeng-ui-qrcode.mjs +564 -0
  37. package/fesm2022/caribeng-ui-ripple.mjs +2 -0
  38. package/fesm2022/caribeng-ui-scrolltop.mjs +3 -1
  39. package/fesm2022/caribeng-ui-sidebar.mjs +573 -0
  40. package/fesm2022/caribeng-ui-stepper.mjs +10 -3
  41. package/fesm2022/caribeng-ui-table.mjs +10 -4
  42. package/fesm2022/caribeng-ui-tabmenu.mjs +8 -4
  43. package/fesm2022/caribeng-ui-tieredmenu.mjs +109 -19
  44. package/fesm2022/caribeng-ui.mjs +388 -1
  45. package/package.json +42 -2
  46. package/schematics/collection.json +5 -0
  47. package/schematics/migrate-from-primeng/core-icons.json +1 -0
  48. package/schematics/migrate-from-primeng/icons.js +269 -0
  49. package/schematics/migrate-from-primeng/index.js +290 -0
  50. package/schematics/migrate-from-primeng/mappings/button.js +93 -0
  51. package/schematics/migrate-from-primeng/mappings/card.js +33 -0
  52. package/schematics/migrate-from-primeng/mappings/checkbox.js +44 -0
  53. package/schematics/migrate-from-primeng/mappings/confirm.js +221 -0
  54. package/schematics/migrate-from-primeng/mappings/datepicker.js +121 -0
  55. package/schematics/migrate-from-primeng/mappings/dialog.js +84 -0
  56. package/schematics/migrate-from-primeng/mappings/index.js +88 -0
  57. package/schematics/migrate-from-primeng/mappings/inputnumber.js +62 -0
  58. package/schematics/migrate-from-primeng/mappings/inputtext.js +60 -0
  59. package/schematics/migrate-from-primeng/mappings/menu.js +468 -0
  60. package/schematics/migrate-from-primeng/mappings/multiselect.js +49 -0
  61. package/schematics/migrate-from-primeng/mappings/radiobutton.js +22 -0
  62. package/schematics/migrate-from-primeng/mappings/rules.js +206 -0
  63. package/schematics/migrate-from-primeng/mappings/select.js +97 -0
  64. package/schematics/migrate-from-primeng/mappings/service-calls.js +100 -0
  65. package/schematics/migrate-from-primeng/mappings/table.js +613 -0
  66. package/schematics/migrate-from-primeng/mappings/tabs.js +225 -0
  67. package/schematics/migrate-from-primeng/mappings/tag.js +29 -0
  68. package/schematics/migrate-from-primeng/mappings/textarea.js +44 -0
  69. package/schematics/migrate-from-primeng/mappings/toast.js +173 -0
  70. package/schematics/migrate-from-primeng/mappings/toggleswitch.js +37 -0
  71. package/schematics/migrate-from-primeng/mappings/tooltip.js +44 -0
  72. package/schematics/migrate-from-primeng/mappings/types.js +10 -0
  73. package/schematics/migrate-from-primeng/report.js +79 -0
  74. package/schematics/migrate-from-primeng/schema.js +2 -0
  75. package/schematics/migrate-from-primeng/schema.json +34 -0
  76. package/schematics/migrate-from-primeng/template.js +387 -0
  77. package/schematics/migrate-from-primeng/todo.js +5 -0
  78. package/schematics/migrate-from-primeng/typescript.js +442 -0
  79. package/schematics/migrate-from-primeng/workspace.js +117 -0
  80. package/schematics/ng-add/index.js +16 -1
  81. package/types/caribeng-ui-badge.d.ts +3 -1
  82. package/types/caribeng-ui-breadcrumb.d.ts +8 -0
  83. package/types/caribeng-ui-chart.d.ts +3 -1
  84. package/types/caribeng-ui-chat.d.ts +299 -0
  85. package/types/caribeng-ui-code-block.d.ts +65 -0
  86. package/types/caribeng-ui-colorpicker.d.ts +5 -1
  87. package/types/caribeng-ui-command-palette.d.ts +133 -0
  88. package/types/caribeng-ui-confirmdialog.d.ts +34 -2
  89. package/types/caribeng-ui-confirmpopup.d.ts +39 -2
  90. package/types/caribeng-ui-contextmenu.d.ts +7 -0
  91. package/types/caribeng-ui-copy-button.d.ts +90 -0
  92. package/types/caribeng-ui-dataview.d.ts +2 -0
  93. package/types/caribeng-ui-dock.d.ts +13 -1
  94. package/types/caribeng-ui-drawer.d.ts +3 -1
  95. package/types/caribeng-ui-file-card.d.ts +27 -2
  96. package/types/caribeng-ui-folder-card.d.ts +27 -5
  97. package/types/caribeng-ui-inputmask.d.ts +3 -1
  98. package/types/caribeng-ui-kanban.d.ts +783 -0
  99. package/types/caribeng-ui-kbd.d.ts +36 -0
  100. package/types/caribeng-ui-megamenu.d.ts +11 -0
  101. package/types/caribeng-ui-mentions.d.ts +127 -0
  102. package/types/caribeng-ui-menu.d.ts +7 -0
  103. package/types/caribeng-ui-menubar.d.ts +7 -0
  104. package/types/caribeng-ui-message.d.ts +2 -0
  105. package/types/caribeng-ui-panelmenu.d.ts +7 -0
  106. package/types/caribeng-ui-phone-input.d.ts +168 -0
  107. package/types/caribeng-ui-pricing.d.ts +41 -4
  108. package/types/caribeng-ui-qrcode.d.ts +88 -0
  109. package/types/caribeng-ui-sidebar.d.ts +167 -0
  110. package/types/caribeng-ui-stepper.d.ts +2 -0
  111. package/types/caribeng-ui-table.d.ts +1 -1
  112. package/types/caribeng-ui-tabmenu.d.ts +7 -0
  113. package/types/caribeng-ui-tieredmenu.d.ts +17 -1
  114. package/types/caribeng-ui.d.ts +276 -2
  115. package/styles/caribeng.css +0 -380
  116. package/styles/scss/_mixins.scss +0 -46
  117. package/styles/scss/_overlay.scss +0 -15
  118. package/styles/scss/_tokens.scss +0 -267
  119. package/styles/scss/_utilities.scss +0 -73
  120. package/styles/scss/_variables.scss +0 -33
  121. package/styles/scss/index.scss +0 -16
@@ -0,0 +1,122 @@
1
+ import { DOCUMENT } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
4
+
5
+ /** Teclas con nombre: `mod` es ⌘ en Mac y Ctrl en el resto. */
6
+ const NAMED_KEYS = {
7
+ mod: { mac: { text: '⌘', spoken: 'Command' }, other: { text: 'Ctrl' } },
8
+ cmd: { mac: { text: '⌘', spoken: 'Command' }, other: { text: 'Win' } },
9
+ ctrl: { mac: { text: '⌃', spoken: 'Control' }, other: { text: 'Ctrl' } },
10
+ alt: { mac: { text: '⌥', spoken: 'Option' }, other: { text: 'Alt' } },
11
+ shift: { mac: { text: '⇧', spoken: 'Shift' }, other: { text: 'Shift' } },
12
+ enter: { mac: { text: '↵', spoken: 'Enter' }, other: { text: 'Enter' } },
13
+ backspace: { mac: { text: '⌫', spoken: 'Delete' }, other: { text: 'Backspace' } },
14
+ tab: { mac: { text: 'Tab' }, other: { text: 'Tab' } },
15
+ esc: { mac: { text: 'Esc' }, other: { text: 'Esc' } },
16
+ space: { mac: { text: 'Space' }, other: { text: 'Space' } },
17
+ up: { mac: { text: '↑', spoken: 'Up' }, other: { text: '↑', spoken: 'Up' } },
18
+ down: { mac: { text: '↓', spoken: 'Down' }, other: { text: '↓', spoken: 'Down' } },
19
+ left: { mac: { text: '←', spoken: 'Left' }, other: { text: '←', spoken: 'Left' } },
20
+ right: { mac: { text: '→', spoken: 'Right' }, other: { text: '→', spoken: 'Right' } },
21
+ };
22
+ /** Detecta macOS/iOS en el navegador (en SSR devuelve `false`). */
23
+ function isApplePlatform(doc) {
24
+ const nav = doc.defaultView?.navigator;
25
+ const platform = nav?.userAgentData?.platform ?? nav?.platform ?? '';
26
+ return /mac|iphone|ipad|ipod/i.test(platform);
27
+ }
28
+ /**
29
+ * Tecla o atajo de teclado de CaribeNG. Con contenido muestra una tecla; con
30
+ * `keys` muestra la combinación (⌘ K en Mac, Ctrl + K en el resto).
31
+ *
32
+ * @example
33
+ * ```html
34
+ * <cb-kbd>Esc</cb-kbd>
35
+ * <cb-kbd [keys]="['mod', 'K']" />
36
+ * ```
37
+ */
38
+ class CbKbd {
39
+ constructor() {
40
+ this.doc = inject(DOCUMENT);
41
+ /** Teclas de la combinación: nombres (`mod`, `shift`, `alt`, `enter`, `up`…) o texto libre (`K`, `F2`). */
42
+ this.keys = input([], /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "keys" }] : /* istanbul ignore next */ []));
44
+ /** Plataforma a mostrar. `auto` la detecta (⌘ en Mac). */
45
+ this.platform = input('auto', /* @ts-ignore */
46
+ ...(ngDevMode ? [{ debugName: "platform" }] : /* istanbul ignore next */ []));
47
+ this.size = input('md', /* @ts-ignore */
48
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
49
+ this.isMac = computed(() => {
50
+ const platform = this.platform();
51
+ return platform === 'auto' ? isApplePlatform(this.doc) : platform === 'mac';
52
+ }, /* @ts-ignore */
53
+ ...(ngDevMode ? [{ debugName: "isMac" }] : /* istanbul ignore next */ []));
54
+ this.labels = computed(() => {
55
+ const mac = this.isMac();
56
+ return this.keys().map((key) => {
57
+ const named = NAMED_KEYS[key.toLowerCase()];
58
+ if (named)
59
+ return mac ? named.mac : named.other;
60
+ return { text: key.length === 1 ? key.toUpperCase() : key };
61
+ });
62
+ }, /* @ts-ignore */
63
+ ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
64
+ }
65
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbKbd, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
66
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbKbd, isStandalone: true, selector: "cb-kbd", inputs: { keys: { classPropertyName: "keys", publicName: "keys", isSignal: true, isRequired: false, transformFunction: null }, platform: { classPropertyName: "platform", publicName: "platform", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cb-kbd--sm": "size() === 'sm'" }, classAttribute: "cb-kbd" }, ngImport: i0, template: `
67
+ @if (labels().length) {
68
+ <kbd class="cb-kbd__combo">
69
+ @for (key of labels(); track $index) {
70
+ @if (!$first && !isMac()) {
71
+ <span class="cb-kbd__plus" aria-hidden="true">+</span>
72
+ }
73
+ <kbd class="cb-kbd__key">
74
+ @if (key.spoken) {
75
+ <span aria-hidden="true">{{ key.text }}</span><span class="cb-kbd__sr">{{ key.spoken }}</span>
76
+ } @else {
77
+ {{ key.text }}
78
+ }
79
+ </kbd>
80
+ }
81
+ </kbd>
82
+ } @else {
83
+ <kbd class="cb-kbd__key"><ng-content /></kbd>
84
+ }
85
+ `, isInline: true, styles: [":host{display:inline-flex;vertical-align:middle;font-size:var(--cb-text-xs, .75rem)}.cb-kbd__combo{display:inline-flex;align-items:center;gap:.25em;font:inherit}.cb-kbd__key{display:inline-flex;align-items:center;justify-content:center;min-width:1.75em;height:1.75em;padding:0 .4em;border:1px solid var(--cb-color-border-strong);border-bottom-width:2px;border-radius:var(--cb-radius-sm, 4px);background:var(--cb-color-surface-raised);color:var(--cb-color-text);font-family:var(--cb-font-sans);font-size:inherit;font-weight:var(--cb-font-weight-medium, 500);line-height:1;white-space:nowrap}.cb-kbd__plus{color:var(--cb-color-text-muted)}:host(.cb-kbd--sm){font-size:.6875rem}.cb-kbd__sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
86
+ }
87
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbKbd, decorators: [{
88
+ type: Component,
89
+ args: [{ selector: 'cb-kbd', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
90
+ class: 'cb-kbd',
91
+ '[class.cb-kbd--sm]': "size() === 'sm'",
92
+ }, template: `
93
+ @if (labels().length) {
94
+ <kbd class="cb-kbd__combo">
95
+ @for (key of labels(); track $index) {
96
+ @if (!$first && !isMac()) {
97
+ <span class="cb-kbd__plus" aria-hidden="true">+</span>
98
+ }
99
+ <kbd class="cb-kbd__key">
100
+ @if (key.spoken) {
101
+ <span aria-hidden="true">{{ key.text }}</span><span class="cb-kbd__sr">{{ key.spoken }}</span>
102
+ } @else {
103
+ {{ key.text }}
104
+ }
105
+ </kbd>
106
+ }
107
+ </kbd>
108
+ } @else {
109
+ <kbd class="cb-kbd__key"><ng-content /></kbd>
110
+ }
111
+ `, styles: [":host{display:inline-flex;vertical-align:middle;font-size:var(--cb-text-xs, .75rem)}.cb-kbd__combo{display:inline-flex;align-items:center;gap:.25em;font:inherit}.cb-kbd__key{display:inline-flex;align-items:center;justify-content:center;min-width:1.75em;height:1.75em;padding:0 .4em;border:1px solid var(--cb-color-border-strong);border-bottom-width:2px;border-radius:var(--cb-radius-sm, 4px);background:var(--cb-color-surface-raised);color:var(--cb-color-text);font-family:var(--cb-font-sans);font-size:inherit;font-weight:var(--cb-font-weight-medium, 500);line-height:1;white-space:nowrap}.cb-kbd__plus{color:var(--cb-color-text-muted)}:host(.cb-kbd--sm){font-size:.6875rem}.cb-kbd__sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}\n"] }]
112
+ }], propDecorators: { keys: [{ type: i0.Input, args: [{ isSignal: true, alias: "keys", required: false }] }], platform: [{ type: i0.Input, args: [{ isSignal: true, alias: "platform", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
113
+
114
+ /*
115
+ * Public API Surface de @caribeng/ui/kbd
116
+ */
117
+
118
+ /**
119
+ * Generated bundle index. Do not edit.
120
+ */
121
+
122
+ export { CbKbd };
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Injector, input, output, signal, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { injectCbTranslation } from '@caribeng/ui';
2
+ import { inject, ElementRef, Injector, input, computed, output, signal, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { injectCbTranslation, cbVisibleItems, cbRunCommand } from '@caribeng/ui';
4
4
  import { CbIcon } from '@caribeng/ui/icon';
5
5
 
6
6
  let nextUid = 0;
@@ -24,6 +24,9 @@ class CbMegaMenu {
24
24
  /** Categorías con sus grupos de enlaces. */
25
25
  this.items = input([], /* @ts-ignore */
26
26
  ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
27
+ /** Items sin los de `visible: false`. */
28
+ this.visibleItems = computed(() => cbVisibleItems(this.items()), /* @ts-ignore */
29
+ ...(ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []));
27
30
  /** Nombre accesible de la navegación. Por defecto, "Categorías" del idioma activo. */
28
31
  this.ariaLabel = input(undefined, /* @ts-ignore */
29
32
  ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
@@ -38,6 +41,7 @@ class CbMegaMenu {
38
41
  select(link) {
39
42
  if (link.disabled)
40
43
  return;
44
+ cbRunCommand(link);
41
45
  this.itemSelect.emit(link);
42
46
  this.close();
43
47
  }
@@ -55,7 +59,7 @@ class CbMegaMenu {
55
59
  this.close();
56
60
  }
57
61
  onTriggerKeydown(event, index) {
58
- const count = this.items().length;
62
+ const count = this.visibleItems().length;
59
63
  switch (event.key) {
60
64
  case 'ArrowRight':
61
65
  this.focusTrigger((index + 1) % count);
@@ -122,7 +126,7 @@ class CbMegaMenu {
122
126
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbMegaMenu, isStandalone: true, selector: "cb-megamenu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, host: { listeners: { "document:click": "onDocumentClick($event)", "focusout": "onFocusOut($event)" }, classAttribute: "cb-megamenu" }, ngImport: i0, template: `
123
127
  <nav [attr.aria-label]="ariaLabel() ?? t().categories">
124
128
  <ul class="cb-megamenu__bar">
125
- @for (item of items(); track $index; let i = $index) {
129
+ @for (item of visibleItems(); track $index; let i = $index) {
126
130
  <li>
127
131
  <button
128
132
  class="cb-megamenu__trigger"
@@ -152,10 +156,10 @@ class CbMegaMenu {
152
156
  class="cb-megamenu__panel"
153
157
  [id]="panelId"
154
158
  role="region"
155
- [attr.aria-label]="items()[openIndex()!].label"
159
+ [attr.aria-label]="visibleItems()[openIndex()!].label"
156
160
  (keydown)="onPanelKeydown($event)"
157
161
  >
158
- @for (group of items()[openIndex()!].groups; track $index) {
162
+ @for (group of visibleItems()[openIndex()!].groups; track $index) {
159
163
  <div class="cb-megamenu__group">
160
164
  <h3>{{ group.label }}</h3>
161
165
  <ul>
@@ -195,7 +199,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
195
199
  }, template: `
196
200
  <nav [attr.aria-label]="ariaLabel() ?? t().categories">
197
201
  <ul class="cb-megamenu__bar">
198
- @for (item of items(); track $index; let i = $index) {
202
+ @for (item of visibleItems(); track $index; let i = $index) {
199
203
  <li>
200
204
  <button
201
205
  class="cb-megamenu__trigger"
@@ -225,10 +229,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
225
229
  class="cb-megamenu__panel"
226
230
  [id]="panelId"
227
231
  role="region"
228
- [attr.aria-label]="items()[openIndex()!].label"
232
+ [attr.aria-label]="visibleItems()[openIndex()!].label"
229
233
  (keydown)="onPanelKeydown($event)"
230
234
  >
231
- @for (group of items()[openIndex()!].groups; track $index) {
235
+ @for (group of visibleItems()[openIndex()!].groups; track $index) {
232
236
  <div class="cb-megamenu__group">
233
237
  <h3>{{ group.label }}</h3>
234
238
  <ul>