@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.
- package/README.md +134 -12
- package/fesm2022/caribeng-ui-accordion.mjs +4 -4
- package/fesm2022/caribeng-ui-anchor.mjs +169 -0
- package/fesm2022/caribeng-ui-autocomplete.mjs +10 -8
- package/fesm2022/caribeng-ui-avatar.mjs +2 -2
- package/fesm2022/caribeng-ui-avatargroup.mjs +9 -3
- package/fesm2022/caribeng-ui-badge.mjs +8 -2
- package/fesm2022/caribeng-ui-blockui.mjs +12 -4
- package/fesm2022/caribeng-ui-breadcrumb.mjs +17 -7
- package/fesm2022/caribeng-ui-button.mjs +22 -2
- package/fesm2022/caribeng-ui-caribe-alert.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-animation-lottie.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-button-group.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-calendar.mjs +11 -6
- package/fesm2022/caribeng-ui-caribe-card-content.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-card-move.mjs +29 -7
- package/fesm2022/caribeng-ui-caribe-card-select.mjs +56 -14
- package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +10 -7
- package/fesm2022/caribeng-ui-caribe-coachmark.mjs +42 -19
- package/fesm2022/caribeng-ui-caribe-data-table.mjs +15 -9
- package/fesm2022/caribeng-ui-caribe-dots-indicator.mjs +38 -5
- package/fesm2022/caribeng-ui-caribe-expansion-panel.mjs +16 -5
- package/fesm2022/caribeng-ui-caribe-fab-menu.mjs +56 -7
- package/fesm2022/caribeng-ui-caribe-file-download.mjs +68 -27
- package/fesm2022/caribeng-ui-caribe-file-select.mjs +22 -17
- package/fesm2022/caribeng-ui-caribe-float-menu.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-footer.mjs +8 -4
- package/fesm2022/caribeng-ui-caribe-header.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-icon-button.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-illustration.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-input-search.mjs +14 -10
- package/fesm2022/caribeng-ui-caribe-input-select.mjs +12 -10
- package/fesm2022/caribeng-ui-caribe-input-token.mjs +61 -11
- package/fesm2022/caribeng-ui-caribe-link.mjs +7 -2
- package/fesm2022/caribeng-ui-caribe-loader.mjs +8 -5
- package/fesm2022/caribeng-ui-caribe-modal.mjs +32 -16
- package/fesm2022/caribeng-ui-caribe-off-canvas.mjs +26 -12
- package/fesm2022/caribeng-ui-caribe-onboarding.mjs +44 -19
- package/fesm2022/caribeng-ui-caribe-pictogram.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-pop-over.mjs +34 -10
- package/fesm2022/caribeng-ui-caribe-preloader.mjs +9 -6
- package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-shortcut.mjs +8 -3
- package/fesm2022/caribeng-ui-caribe-step-indicator.mjs +12 -5
- package/fesm2022/caribeng-ui-caribe-stroke.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-switch.mjs +5 -3
- package/fesm2022/caribeng-ui-caribe-tag-button.mjs +1 -1
- package/fesm2022/caribeng-ui-caribe-tracker.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-transaction-status.mjs +1 -1
- package/fesm2022/caribeng-ui-caribe-voucher.mjs +11 -8
- package/fesm2022/caribeng-ui-carousel.mjs +49 -14
- package/fesm2022/caribeng-ui-cascadeselect.mjs +22 -8
- package/fesm2022/caribeng-ui-chart.mjs +2601 -303
- package/fesm2022/caribeng-ui-chat.mjs +1303 -0
- package/fesm2022/caribeng-ui-chip.mjs +9 -4
- package/fesm2022/caribeng-ui-chips.mjs +9 -5
- package/fesm2022/caribeng-ui-code-block.mjs +332 -0
- package/fesm2022/caribeng-ui-colorpicker.mjs +107 -11
- package/fesm2022/caribeng-ui-command-palette.mjs +476 -0
- package/fesm2022/caribeng-ui-confirmdialog.mjs +140 -10
- package/fesm2022/caribeng-ui-confirmpopup.mjs +209 -9
- package/fesm2022/caribeng-ui-contextmenu.mjs +13 -6
- package/fesm2022/caribeng-ui-copy-button.mjs +230 -0
- package/fesm2022/caribeng-ui-dataview.mjs +214 -6
- package/fesm2022/caribeng-ui-datepicker.mjs +1630 -393
- package/fesm2022/caribeng-ui-descriptions.mjs +124 -0
- package/fesm2022/caribeng-ui-dialog.mjs +10 -7
- package/fesm2022/caribeng-ui-dock.mjs +58 -15
- package/fesm2022/caribeng-ui-drawer.mjs +17 -9
- package/fesm2022/caribeng-ui-dynamicdialog.mjs +210 -6
- package/fesm2022/caribeng-ui-editor.mjs +4413 -243
- package/fesm2022/caribeng-ui-empty.mjs +80 -0
- package/fesm2022/caribeng-ui-fieldset.mjs +2 -2
- package/fesm2022/caribeng-ui-file-card.mjs +136 -19
- package/fesm2022/caribeng-ui-fileupload.mjs +96 -19
- package/fesm2022/caribeng-ui-floatlabel.mjs +4 -2
- package/fesm2022/caribeng-ui-folder-card.mjs +132 -15
- package/fesm2022/caribeng-ui-galleria.mjs +76 -45
- package/fesm2022/caribeng-ui-image.mjs +52 -29
- package/fesm2022/caribeng-ui-inlinemessage.mjs +2 -2
- package/fesm2022/caribeng-ui-inplace.mjs +22 -6
- package/fesm2022/caribeng-ui-input-number.mjs +9 -7
- package/fesm2022/caribeng-ui-inputgroup.mjs +2 -2
- package/fesm2022/caribeng-ui-inputmask.mjs +22 -13
- package/fesm2022/caribeng-ui-inputotp.mjs +12 -6
- package/fesm2022/caribeng-ui-kanban.mjs +4612 -0
- package/fesm2022/caribeng-ui-kbd.mjs +122 -0
- package/fesm2022/caribeng-ui-keyfilter.mjs +72 -0
- package/fesm2022/caribeng-ui-listbox.mjs +13 -11
- package/fesm2022/caribeng-ui-megamenu.mjs +228 -32
- package/fesm2022/caribeng-ui-mentions.mjs +495 -0
- package/fesm2022/caribeng-ui-menu.mjs +18 -8
- package/fesm2022/caribeng-ui-menubar.mjs +17 -8
- package/fesm2022/caribeng-ui-message.mjs +13 -7
- package/fesm2022/caribeng-ui-metergroup.mjs +29 -11
- package/fesm2022/caribeng-ui-multiselect.mjs +399 -97
- package/fesm2022/caribeng-ui-orderlist.mjs +230 -11
- package/fesm2022/caribeng-ui-organizationchart.mjs +16 -15
- package/fesm2022/caribeng-ui-paginator.mjs +18 -15
- package/fesm2022/caribeng-ui-panel.mjs +11 -8
- package/fesm2022/caribeng-ui-panelmenu.mjs +14 -8
- package/fesm2022/caribeng-ui-password.mjs +8 -6
- package/fesm2022/caribeng-ui-pdfviewer.mjs +1553 -0
- package/fesm2022/caribeng-ui-phone-input.mjs +688 -0
- package/fesm2022/caribeng-ui-picklist.mjs +251 -14
- package/fesm2022/caribeng-ui-pricing.mjs +272 -75
- package/fesm2022/caribeng-ui-qrcode.mjs +564 -0
- package/fesm2022/caribeng-ui-rating.mjs +7 -3
- package/fesm2022/caribeng-ui-repeater.mjs +223 -0
- package/fesm2022/caribeng-ui-result.mjs +91 -0
- package/fesm2022/caribeng-ui-ripple.mjs +2 -0
- package/fesm2022/caribeng-ui-scrollpanel.mjs +6 -3
- package/fesm2022/caribeng-ui-scrolltop.mjs +9 -4
- package/fesm2022/caribeng-ui-select.mjs +379 -87
- package/fesm2022/caribeng-ui-selectbutton.mjs +2 -2
- package/fesm2022/caribeng-ui-sidebar.mjs +573 -0
- package/fesm2022/caribeng-ui-slider.mjs +171 -75
- package/fesm2022/caribeng-ui-speeddial.mjs +7 -4
- package/fesm2022/caribeng-ui-spinner.mjs +5 -2
- package/fesm2022/caribeng-ui-splitbutton.mjs +163 -0
- package/fesm2022/caribeng-ui-splitter.mjs +5 -2
- package/fesm2022/caribeng-ui-statistic.mjs +183 -0
- package/fesm2022/caribeng-ui-stepper.mjs +17 -7
- package/fesm2022/caribeng-ui-steps.mjs +6 -3
- package/fesm2022/caribeng-ui-table.mjs +716 -84
- package/fesm2022/caribeng-ui-tabmenu.mjs +13 -6
- package/fesm2022/caribeng-ui-tag.mjs +2 -2
- package/fesm2022/caribeng-ui-terminal.mjs +45 -9
- package/fesm2022/caribeng-ui-themetoggle.mjs +82 -0
- package/fesm2022/caribeng-ui-tieredmenu.mjs +113 -20
- package/fesm2022/caribeng-ui-timeline.mjs +175 -6
- package/fesm2022/caribeng-ui-toast.mjs +7 -4
- package/fesm2022/caribeng-ui-togglebutton.mjs +8 -6
- package/fesm2022/caribeng-ui-toolbar.mjs +6 -3
- package/fesm2022/caribeng-ui-tree.mjs +302 -6
- package/fesm2022/caribeng-ui-treeselect.mjs +26 -10
- package/fesm2022/caribeng-ui-treetable.mjs +269 -6
- package/fesm2022/caribeng-ui-virtualscroller.mjs +123 -10
- package/fesm2022/caribeng-ui.mjs +1216 -6
- package/package.json +93 -3
- package/schematics/collection.json +15 -0
- package/schematics/migrate-from-primeng/core-icons.json +1 -0
- package/schematics/migrate-from-primeng/icons.js +269 -0
- package/schematics/migrate-from-primeng/index.js +290 -0
- package/schematics/migrate-from-primeng/mappings/button.js +93 -0
- package/schematics/migrate-from-primeng/mappings/card.js +33 -0
- package/schematics/migrate-from-primeng/mappings/checkbox.js +44 -0
- package/schematics/migrate-from-primeng/mappings/confirm.js +221 -0
- package/schematics/migrate-from-primeng/mappings/datepicker.js +121 -0
- package/schematics/migrate-from-primeng/mappings/dialog.js +84 -0
- package/schematics/migrate-from-primeng/mappings/index.js +88 -0
- package/schematics/migrate-from-primeng/mappings/inputnumber.js +62 -0
- package/schematics/migrate-from-primeng/mappings/inputtext.js +60 -0
- package/schematics/migrate-from-primeng/mappings/menu.js +468 -0
- package/schematics/migrate-from-primeng/mappings/multiselect.js +49 -0
- package/schematics/migrate-from-primeng/mappings/radiobutton.js +22 -0
- package/schematics/migrate-from-primeng/mappings/rules.js +206 -0
- package/schematics/migrate-from-primeng/mappings/select.js +97 -0
- package/schematics/migrate-from-primeng/mappings/service-calls.js +100 -0
- package/schematics/migrate-from-primeng/mappings/table.js +613 -0
- package/schematics/migrate-from-primeng/mappings/tabs.js +225 -0
- package/schematics/migrate-from-primeng/mappings/tag.js +29 -0
- package/schematics/migrate-from-primeng/mappings/textarea.js +44 -0
- package/schematics/migrate-from-primeng/mappings/toast.js +173 -0
- package/schematics/migrate-from-primeng/mappings/toggleswitch.js +37 -0
- package/schematics/migrate-from-primeng/mappings/tooltip.js +44 -0
- package/schematics/migrate-from-primeng/mappings/types.js +10 -0
- package/schematics/migrate-from-primeng/report.js +79 -0
- package/schematics/migrate-from-primeng/schema.js +2 -0
- package/schematics/migrate-from-primeng/schema.json +34 -0
- package/schematics/migrate-from-primeng/template.js +387 -0
- package/schematics/migrate-from-primeng/todo.js +5 -0
- package/schematics/migrate-from-primeng/typescript.js +442 -0
- package/schematics/migrate-from-primeng/workspace.js +117 -0
- package/schematics/ng-add/index.js +140 -0
- package/schematics/ng-add/schema.js +2 -0
- package/schematics/ng-add/schema.json +66 -0
- package/types/caribeng-ui-anchor.d.ts +50 -0
- package/types/caribeng-ui-autocomplete.d.ts +4 -2
- package/types/caribeng-ui-avatargroup.d.ts +3 -1
- package/types/caribeng-ui-badge.d.ts +3 -1
- package/types/caribeng-ui-blockui.d.ts +9 -4
- package/types/caribeng-ui-breadcrumb.d.ts +11 -0
- package/types/caribeng-ui-button.d.ts +9 -1
- package/types/caribeng-ui-caribe-alert.d.ts +3 -0
- package/types/caribeng-ui-caribe-animation-lottie.d.ts +4 -1
- package/types/caribeng-ui-caribe-button-group.d.ts +4 -1
- package/types/caribeng-ui-caribe-calendar.d.ts +5 -1
- package/types/caribeng-ui-caribe-card-content.d.ts +4 -1
- package/types/caribeng-ui-caribe-card-move.d.ts +13 -13
- package/types/caribeng-ui-caribe-card-select.d.ts +10 -1
- package/types/caribeng-ui-caribe-circle-loading.d.ts +4 -1
- package/types/caribeng-ui-caribe-coachmark.d.ts +6 -0
- package/types/caribeng-ui-caribe-data-table.d.ts +7 -2
- package/types/caribeng-ui-caribe-dots-indicator.d.ts +9 -0
- package/types/caribeng-ui-caribe-expansion-panel.d.ts +7 -10
- package/types/caribeng-ui-caribe-fab-menu.d.ts +10 -1
- package/types/caribeng-ui-caribe-file-download.d.ts +8 -10
- package/types/caribeng-ui-caribe-file-select.d.ts +7 -1
- package/types/caribeng-ui-caribe-float-menu.d.ts +4 -1
- package/types/caribeng-ui-caribe-header.d.ts +3 -0
- package/types/caribeng-ui-caribe-icon-button.d.ts +4 -1
- package/types/caribeng-ui-caribe-illustration.d.ts +4 -1
- package/types/caribeng-ui-caribe-inline-alert.d.ts +3 -0
- package/types/caribeng-ui-caribe-input-search.d.ts +4 -2
- package/types/caribeng-ui-caribe-input-select.d.ts +4 -2
- package/types/caribeng-ui-caribe-input-token.d.ts +16 -1
- package/types/caribeng-ui-caribe-link.d.ts +3 -0
- package/types/caribeng-ui-caribe-loader.d.ts +4 -1
- package/types/caribeng-ui-caribe-modal.d.ts +7 -10
- package/types/caribeng-ui-caribe-off-canvas.d.ts +6 -1
- package/types/caribeng-ui-caribe-onboarding.d.ts +6 -0
- package/types/caribeng-ui-caribe-pictogram.d.ts +4 -1
- package/types/caribeng-ui-caribe-pop-over.d.ts +7 -10
- package/types/caribeng-ui-caribe-preloader.d.ts +4 -1
- package/types/caribeng-ui-caribe-progress-bar.d.ts +3 -0
- package/types/caribeng-ui-caribe-shortcut.d.ts +3 -1
- package/types/caribeng-ui-caribe-step-indicator.d.ts +6 -0
- package/types/caribeng-ui-caribe-stroke.d.ts +4 -1
- package/types/caribeng-ui-caribe-switch.d.ts +3 -1
- package/types/caribeng-ui-caribe-tracker.d.ts +3 -0
- package/types/caribeng-ui-caribe-voucher.d.ts +5 -2
- package/types/caribeng-ui-carousel.d.ts +10 -1
- package/types/caribeng-ui-cascadeselect.d.ts +7 -2
- package/types/caribeng-ui-chart.d.ts +471 -44
- package/types/caribeng-ui-chat.d.ts +299 -0
- package/types/caribeng-ui-chip.d.ts +6 -0
- package/types/caribeng-ui-chips.d.ts +6 -2
- package/types/caribeng-ui-code-block.d.ts +65 -0
- package/types/caribeng-ui-colorpicker.d.ts +8 -2
- package/types/caribeng-ui-command-palette.d.ts +133 -0
- package/types/caribeng-ui-confirmdialog.d.ts +57 -6
- package/types/caribeng-ui-confirmpopup.d.ts +74 -5
- package/types/caribeng-ui-contextmenu.d.ts +11 -1
- package/types/caribeng-ui-copy-button.d.ts +90 -0
- package/types/caribeng-ui-dataview.d.ts +65 -5
- package/types/caribeng-ui-datepicker.d.ts +186 -21
- package/types/caribeng-ui-descriptions.d.ts +63 -0
- package/types/caribeng-ui-dialog.d.ts +4 -1
- package/types/caribeng-ui-dock.d.ts +17 -2
- package/types/caribeng-ui-drawer.d.ts +7 -2
- package/types/caribeng-ui-dynamicdialog.d.ts +93 -3
- package/types/caribeng-ui-editor.d.ts +486 -13
- package/types/caribeng-ui-empty.d.ts +34 -0
- package/types/caribeng-ui-file-card.d.ts +28 -3
- package/types/caribeng-ui-fileupload.d.ts +27 -4
- package/types/caribeng-ui-folder-card.d.ts +31 -6
- package/types/caribeng-ui-galleria.d.ts +9 -0
- package/types/caribeng-ui-image.d.ts +10 -0
- package/types/caribeng-ui-inplace.d.ts +8 -0
- package/types/caribeng-ui-input-number.d.ts +3 -1
- package/types/caribeng-ui-inputmask.d.ts +8 -1
- package/types/caribeng-ui-inputotp.d.ts +7 -2
- package/types/caribeng-ui-kanban.d.ts +783 -0
- package/types/caribeng-ui-kbd.d.ts +36 -0
- package/types/caribeng-ui-keyfilter.d.ts +30 -0
- package/types/caribeng-ui-listbox.d.ts +5 -3
- package/types/caribeng-ui-megamenu.d.ts +37 -2
- package/types/caribeng-ui-mentions.d.ts +127 -0
- package/types/caribeng-ui-menu.d.ts +14 -2
- package/types/caribeng-ui-menubar.d.ts +12 -1
- package/types/caribeng-ui-message.d.ts +5 -0
- package/types/caribeng-ui-metergroup.d.ts +9 -1
- package/types/caribeng-ui-multiselect.d.ts +71 -10
- package/types/caribeng-ui-orderlist.d.ts +58 -6
- package/types/caribeng-ui-organizationchart.d.ts +7 -1
- package/types/caribeng-ui-paginator.d.ts +3 -0
- package/types/caribeng-ui-panel.d.ts +3 -0
- package/types/caribeng-ui-panelmenu.d.ts +11 -1
- package/types/caribeng-ui-password.d.ts +4 -2
- package/types/caribeng-ui-pdfviewer.d.ts +258 -0
- package/types/caribeng-ui-phone-input.d.ts +168 -0
- package/types/caribeng-ui-picklist.d.ts +67 -7
- package/types/caribeng-ui-pricing.d.ts +49 -9
- package/types/caribeng-ui-qrcode.d.ts +88 -0
- package/types/caribeng-ui-rating.d.ts +6 -2
- package/types/caribeng-ui-repeater.d.ts +79 -0
- package/types/caribeng-ui-result.d.ts +35 -0
- package/types/caribeng-ui-scrollpanel.d.ts +4 -1
- package/types/caribeng-ui-scrolltop.d.ts +4 -1
- package/types/caribeng-ui-select.d.ts +73 -9
- package/types/caribeng-ui-sidebar.d.ts +167 -0
- package/types/caribeng-ui-slider.d.ts +63 -10
- package/types/caribeng-ui-speeddial.d.ts +5 -2
- package/types/caribeng-ui-spinner.d.ts +3 -0
- package/types/caribeng-ui-splitbutton.d.ts +49 -0
- package/types/caribeng-ui-splitter.d.ts +3 -0
- package/types/caribeng-ui-statistic.d.ts +65 -0
- package/types/caribeng-ui-stepper.d.ts +5 -0
- package/types/caribeng-ui-steps.d.ts +4 -1
- package/types/caribeng-ui-table.d.ts +185 -17
- package/types/caribeng-ui-tabmenu.d.ts +11 -1
- package/types/caribeng-ui-terminal.d.ts +10 -0
- package/types/caribeng-ui-themetoggle.d.ts +32 -0
- package/types/caribeng-ui-tieredmenu.d.ts +22 -3
- package/types/caribeng-ui-timeline.d.ts +63 -4
- package/types/caribeng-ui-toast.d.ts +3 -0
- package/types/caribeng-ui-togglebutton.d.ts +5 -3
- package/types/caribeng-ui-toolbar.d.ts +7 -4
- package/types/caribeng-ui-tree.d.ts +76 -4
- package/types/caribeng-ui-treeselect.d.ts +10 -2
- package/types/caribeng-ui-treetable.d.ts +68 -4
- package/types/caribeng-ui-virtualscroller.d.ts +45 -5
- 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(
|
|
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
|
|
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
|
|
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-
|
|
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-
|
|
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.
|
|
42
|
+
this.setCommand('');
|
|
29
43
|
return;
|
|
30
44
|
}
|
|
31
45
|
this.entries.update((list) => [...list, { command: cmd }]);
|
|
32
|
-
this.
|
|
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() ||
|
|
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() ||
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
|
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
|
|
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.
|