@caribeng/ui 22.1.1 → 22.2.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 +48 -8
- package/fesm2022/caribeng-ui-accordion.mjs +2 -2
- package/fesm2022/caribeng-ui-anchor.mjs +169 -0
- package/fesm2022/caribeng-ui-autocomplete.mjs +10 -8
- package/fesm2022/caribeng-ui-avatargroup.mjs +9 -3
- package/fesm2022/caribeng-ui-blockui.mjs +12 -4
- package/fesm2022/caribeng-ui-breadcrumb.mjs +5 -2
- 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 +2598 -303
- package/fesm2022/caribeng-ui-chip.mjs +9 -4
- package/fesm2022/caribeng-ui-chips.mjs +9 -5
- package/fesm2022/caribeng-ui-colorpicker.mjs +9 -7
- package/fesm2022/caribeng-ui-confirmdialog.mjs +74 -9
- package/fesm2022/caribeng-ui-confirmpopup.mjs +134 -9
- package/fesm2022/caribeng-ui-contextmenu.mjs +6 -3
- package/fesm2022/caribeng-ui-dataview.mjs +211 -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 +6 -3
- package/fesm2022/caribeng-ui-drawer.mjs +10 -7
- package/fesm2022/caribeng-ui-dynamicdialog.mjs +210 -6
- package/fesm2022/caribeng-ui-editor.mjs +4392 -243
- package/fesm2022/caribeng-ui-empty.mjs +80 -0
- package/fesm2022/caribeng-ui-file-card.mjs +2 -2
- package/fesm2022/caribeng-ui-fileupload.mjs +96 -19
- package/fesm2022/caribeng-ui-floatlabel.mjs +4 -2
- package/fesm2022/caribeng-ui-folder-card.mjs +10 -3
- package/fesm2022/caribeng-ui-galleria.mjs +76 -45
- package/fesm2022/caribeng-ui-image.mjs +52 -29
- 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 +14 -11
- package/fesm2022/caribeng-ui-inputotp.mjs +12 -6
- package/fesm2022/caribeng-ui-keyfilter.mjs +72 -0
- package/fesm2022/caribeng-ui-listbox.mjs +13 -11
- package/fesm2022/caribeng-ui-megamenu.mjs +222 -30
- package/fesm2022/caribeng-ui-menu.mjs +11 -5
- package/fesm2022/caribeng-ui-menubar.mjs +10 -5
- package/fesm2022/caribeng-ui-message.mjs +7 -4
- 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 +12 -7
- package/fesm2022/caribeng-ui-paginator.mjs +18 -15
- package/fesm2022/caribeng-ui-panel.mjs +5 -2
- package/fesm2022/caribeng-ui-panelmenu.mjs +6 -3
- package/fesm2022/caribeng-ui-password.mjs +8 -6
- package/fesm2022/caribeng-ui-pdfviewer.mjs +1553 -0
- package/fesm2022/caribeng-ui-picklist.mjs +251 -14
- package/fesm2022/caribeng-ui-pricing.mjs +17 -14
- 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-scrollpanel.mjs +6 -3
- package/fesm2022/caribeng-ui-scrolltop.mjs +6 -3
- package/fesm2022/caribeng-ui-select.mjs +379 -87
- package/fesm2022/caribeng-ui-selectbutton.mjs +2 -2
- 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 +8 -5
- package/fesm2022/caribeng-ui-steps.mjs +6 -3
- package/fesm2022/caribeng-ui-table.mjs +708 -82
- package/fesm2022/caribeng-ui-tabmenu.mjs +6 -3
- 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 +9 -6
- 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 +829 -6
- package/package.json +53 -3
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.js +125 -0
- package/schematics/ng-add/schema.js +2 -0
- package/schematics/ng-add/schema.json +66 -0
- package/styles/caribeng.css +380 -0
- package/styles/scss/_mixins.scss +46 -0
- package/styles/scss/_overlay.scss +15 -0
- package/styles/scss/_tokens.scss +267 -0
- package/styles/scss/_utilities.scss +73 -0
- package/styles/scss/_variables.scss +33 -0
- package/styles/scss/index.scss +16 -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-blockui.d.ts +9 -4
- package/types/caribeng-ui-breadcrumb.d.ts +3 -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 +469 -44
- package/types/caribeng-ui-chip.d.ts +6 -0
- package/types/caribeng-ui-chips.d.ts +6 -2
- package/types/caribeng-ui-colorpicker.d.ts +3 -1
- package/types/caribeng-ui-confirmdialog.d.ts +25 -6
- package/types/caribeng-ui-confirmpopup.d.ts +37 -5
- package/types/caribeng-ui-contextmenu.d.ts +4 -1
- package/types/caribeng-ui-dataview.d.ts +63 -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 +4 -1
- package/types/caribeng-ui-drawer.d.ts +4 -1
- 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 +1 -1
- package/types/caribeng-ui-fileupload.d.ts +27 -4
- package/types/caribeng-ui-folder-card.d.ts +4 -1
- 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 +5 -0
- package/types/caribeng-ui-inputotp.d.ts +7 -2
- 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 +26 -2
- package/types/caribeng-ui-menu.d.ts +7 -2
- package/types/caribeng-ui-menubar.d.ts +5 -1
- package/types/caribeng-ui-message.d.ts +3 -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 +4 -1
- package/types/caribeng-ui-password.d.ts +4 -2
- package/types/caribeng-ui-pdfviewer.d.ts +258 -0
- package/types/caribeng-ui-picklist.d.ts +67 -7
- package/types/caribeng-ui-pricing.d.ts +8 -5
- 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-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 +3 -0
- package/types/caribeng-ui-steps.d.ts +4 -1
- package/types/caribeng-ui-table.d.ts +184 -16
- package/types/caribeng-ui-tabmenu.d.ts +4 -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 +5 -2
- 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 +501 -12
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, viewChild, input, booleanAttribute, output, signal, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
4
|
+
import { CbButton } from '@caribeng/ui/button';
|
|
5
|
+
import { CbIcon } from '@caribeng/ui/icon';
|
|
6
|
+
import { CbMenu } from '@caribeng/ui/menu';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* SplitButton de CaribeNG: una acción principal y un menú con acciones
|
|
10
|
+
* secundarias ("Guardar ▾"). La flecha abre el menú (también con Flecha abajo)
|
|
11
|
+
* y anuncia `aria-haspopup="menu"` / `aria-expanded`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <cb-split-button label="Guardar" icon="check" [items]="masOpciones"
|
|
16
|
+
* (primaryClick)="guardar()" (itemSelect)="onOpcion($event)" />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
class CbSplitButton {
|
|
20
|
+
constructor() {
|
|
21
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
22
|
+
this.t = injectCbTranslation();
|
|
23
|
+
this.host = inject(ElementRef);
|
|
24
|
+
this.menu = viewChild.required('menu');
|
|
25
|
+
/** Texto de la acción principal (también nombra el grupo). */
|
|
26
|
+
this.label = input('', /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
28
|
+
/** Icono de la acción principal. */
|
|
29
|
+
this.icon = input(undefined, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/** Acciones secundarias del menú. */
|
|
32
|
+
this.items = input([], /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
34
|
+
this.severity = input('primary', /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []));
|
|
36
|
+
this.variant = input('solid', /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
38
|
+
this.size = input('md', /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
40
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
41
|
+
this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
42
|
+
/** Nombre del botón de la flecha y del menú. Por defecto, "Más acciones" del idioma activo. */
|
|
43
|
+
this.menuAriaLabel = input(undefined, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "menuAriaLabel" }] : /* istanbul ignore next */ []));
|
|
45
|
+
/** Clic en la acción principal. */
|
|
46
|
+
this.primaryClick = output();
|
|
47
|
+
/** Acción secundaria elegida en el menú. */
|
|
48
|
+
this.itemSelect = output();
|
|
49
|
+
this.open = signal(false, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
51
|
+
}
|
|
52
|
+
/** Abre o cierra el menú anclado (y devuelve el foco) al botón real de la flecha. */
|
|
53
|
+
toggleMenu() {
|
|
54
|
+
const menu = this.menu();
|
|
55
|
+
if (menu.isOpen) {
|
|
56
|
+
menu.hide();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const trigger = this.host.nativeElement.querySelector('.cb-split-button__toggle button');
|
|
60
|
+
if (!trigger)
|
|
61
|
+
return;
|
|
62
|
+
menu.show(trigger);
|
|
63
|
+
this.open.set(true);
|
|
64
|
+
}
|
|
65
|
+
openFromKeyboard(event) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
if (!this.menu().isOpen)
|
|
68
|
+
this.toggleMenu();
|
|
69
|
+
}
|
|
70
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSplitButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
71
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbSplitButton, isStandalone: true, selector: "cb-split-button", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, menuAriaLabel: { classPropertyName: "menuAriaLabel", publicName: "menuAriaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { primaryClick: "primaryClick", itemSelect: "itemSelect" }, host: { attributes: { "role": "group" }, properties: { "attr.aria-label": "label() || null", "class.cb-split-button--outlined": "variant() === 'outlined'" }, classAttribute: "cb-split-button" }, viewQueries: [{ propertyName: "menu", first: true, predicate: ["menu"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
72
|
+
<cb-button
|
|
73
|
+
class="cb-split-button__main"
|
|
74
|
+
[severity]="severity()"
|
|
75
|
+
[variant]="variant()"
|
|
76
|
+
[size]="size()"
|
|
77
|
+
[disabled]="disabled()"
|
|
78
|
+
[loading]="loading()"
|
|
79
|
+
(click)="primaryClick.emit($event)"
|
|
80
|
+
>
|
|
81
|
+
@if (icon()) {
|
|
82
|
+
<cb-icon [name]="icon()!" [size]="16" aria-hidden="true" />
|
|
83
|
+
}
|
|
84
|
+
{{ label() }}<ng-content />
|
|
85
|
+
</cb-button>
|
|
86
|
+
<cb-button
|
|
87
|
+
class="cb-split-button__toggle"
|
|
88
|
+
[severity]="severity()"
|
|
89
|
+
[variant]="variant()"
|
|
90
|
+
[size]="size()"
|
|
91
|
+
[disabled]="disabled()"
|
|
92
|
+
[ariaLabel]="menuAriaLabel() ?? t().moreActions"
|
|
93
|
+
ariaHaspopup="menu"
|
|
94
|
+
[ariaExpanded]="open()"
|
|
95
|
+
(click)="toggleMenu()"
|
|
96
|
+
(keydown.arrowdown)="openFromKeyboard($event)"
|
|
97
|
+
>
|
|
98
|
+
<cb-icon name="chevron-down" [size]="16" aria-hidden="true" />
|
|
99
|
+
</cb-button>
|
|
100
|
+
<cb-menu
|
|
101
|
+
#menu
|
|
102
|
+
[items]="items()"
|
|
103
|
+
[ariaLabel]="menuAriaLabel() ?? t().moreActions"
|
|
104
|
+
(itemSelect)="itemSelect.emit($event)"
|
|
105
|
+
(hidden)="open.set(false)"
|
|
106
|
+
/>
|
|
107
|
+
`, isInline: true, styles: [".cb-split-button{display:inline-flex;align-items:stretch}.cb-split-button .cb-split-button__main .cb-button{border-top-right-radius:0;border-bottom-right-radius:0}.cb-split-button .cb-split-button__toggle .cb-button{padding-inline:var(--cb-space-2);border-top-left-radius:0;border-bottom-left-radius:0}.cb-split-button .cb-split-button__toggle{margin-left:1px}.cb-split-button.cb-split-button--outlined .cb-split-button__toggle{margin-left:-1px}\n"], dependencies: [{ kind: "component", type: CbButton, selector: "cb-button", inputs: ["severity", "variant", "size", "disabled", "loading", "fullWidth", "type", "ariaLabel", "ariaHaspopup", "ariaExpanded", "ariaControls"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }, { kind: "component", type: CbMenu, selector: "cb-menu", inputs: ["items", "ariaLabel"], outputs: ["itemSelect", "hidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
108
|
+
}
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSplitButton, decorators: [{
|
|
110
|
+
type: Component,
|
|
111
|
+
args: [{ selector: 'cb-split-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CbButton, CbIcon, CbMenu], host: {
|
|
112
|
+
class: 'cb-split-button',
|
|
113
|
+
role: 'group',
|
|
114
|
+
'[attr.aria-label]': 'label() || null',
|
|
115
|
+
'[class.cb-split-button--outlined]': "variant() === 'outlined'",
|
|
116
|
+
}, template: `
|
|
117
|
+
<cb-button
|
|
118
|
+
class="cb-split-button__main"
|
|
119
|
+
[severity]="severity()"
|
|
120
|
+
[variant]="variant()"
|
|
121
|
+
[size]="size()"
|
|
122
|
+
[disabled]="disabled()"
|
|
123
|
+
[loading]="loading()"
|
|
124
|
+
(click)="primaryClick.emit($event)"
|
|
125
|
+
>
|
|
126
|
+
@if (icon()) {
|
|
127
|
+
<cb-icon [name]="icon()!" [size]="16" aria-hidden="true" />
|
|
128
|
+
}
|
|
129
|
+
{{ label() }}<ng-content />
|
|
130
|
+
</cb-button>
|
|
131
|
+
<cb-button
|
|
132
|
+
class="cb-split-button__toggle"
|
|
133
|
+
[severity]="severity()"
|
|
134
|
+
[variant]="variant()"
|
|
135
|
+
[size]="size()"
|
|
136
|
+
[disabled]="disabled()"
|
|
137
|
+
[ariaLabel]="menuAriaLabel() ?? t().moreActions"
|
|
138
|
+
ariaHaspopup="menu"
|
|
139
|
+
[ariaExpanded]="open()"
|
|
140
|
+
(click)="toggleMenu()"
|
|
141
|
+
(keydown.arrowdown)="openFromKeyboard($event)"
|
|
142
|
+
>
|
|
143
|
+
<cb-icon name="chevron-down" [size]="16" aria-hidden="true" />
|
|
144
|
+
</cb-button>
|
|
145
|
+
<cb-menu
|
|
146
|
+
#menu
|
|
147
|
+
[items]="items()"
|
|
148
|
+
[ariaLabel]="menuAriaLabel() ?? t().moreActions"
|
|
149
|
+
(itemSelect)="itemSelect.emit($event)"
|
|
150
|
+
(hidden)="open.set(false)"
|
|
151
|
+
/>
|
|
152
|
+
`, styles: [".cb-split-button{display:inline-flex;align-items:stretch}.cb-split-button .cb-split-button__main .cb-button{border-top-right-radius:0;border-bottom-right-radius:0}.cb-split-button .cb-split-button__toggle .cb-button{padding-inline:var(--cb-space-2);border-top-left-radius:0;border-bottom-left-radius:0}.cb-split-button .cb-split-button__toggle{margin-left:1px}.cb-split-button.cb-split-button--outlined .cb-split-button__toggle{margin-left:-1px}\n"] }]
|
|
153
|
+
}], propDecorators: { menu: [{ type: i0.ViewChild, args: ['menu', { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "severity", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], menuAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuAriaLabel", required: false }] }], primaryClick: [{ type: i0.Output, args: ["primaryClick"] }], itemSelect: [{ type: i0.Output, args: ["itemSelect"] }] } });
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
* Public API Surface de @caribeng/ui/splitbutton
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Generated bundle index. Do not edit.
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
export { CbSplitButton };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, ElementRef, input, output, contentChildren, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
3
4
|
|
|
4
5
|
let nextSplitterPanelUid = 0;
|
|
5
6
|
/**
|
|
@@ -16,6 +17,8 @@ let nextSplitterPanelUid = 0;
|
|
|
16
17
|
*/
|
|
17
18
|
class CbSplitter {
|
|
18
19
|
constructor() {
|
|
20
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
21
|
+
this.t = injectCbTranslation();
|
|
19
22
|
this.Math = Math;
|
|
20
23
|
this.hostRef = inject(ElementRef);
|
|
21
24
|
/** Orientación de la división: `'horizontal'` (lado a lado) o `'vertical'` (apilados). */
|
|
@@ -144,7 +147,7 @@ class CbSplitter {
|
|
|
144
147
|
[attr.aria-valuenow]="Math.round(effectiveSizes()[idx])"
|
|
145
148
|
[attr.aria-valuemin]="panelMinSize(idx)"
|
|
146
149
|
[attr.aria-valuemax]="100 - panelMinSize(idx + 1)"
|
|
147
|
-
aria-label="
|
|
150
|
+
[attr.aria-label]="t().resizePanels"
|
|
148
151
|
(pointerdown)="onGutterPointerDown($event, idx)"
|
|
149
152
|
(keydown)="onGutterKeydown($event, idx)"
|
|
150
153
|
>
|
|
@@ -172,7 +175,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
172
175
|
[attr.aria-valuenow]="Math.round(effectiveSizes()[idx])"
|
|
173
176
|
[attr.aria-valuemin]="panelMinSize(idx)"
|
|
174
177
|
[attr.aria-valuemax]="100 - panelMinSize(idx + 1)"
|
|
175
|
-
aria-label="
|
|
178
|
+
[attr.aria-label]="t().resizePanels"
|
|
176
179
|
(pointerdown)="onGutterPointerDown($event, idx)"
|
|
177
180
|
(keydown)="onGutterKeydown($event, idx)"
|
|
178
181
|
>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, output, signal, inject, DestroyRef, effect } from '@angular/core';
|
|
3
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
4
|
+
import { CbIcon } from '@caribeng/ui/icon';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Statistic de CaribeNG: cifra destacada para dashboards, con título, prefijo,
|
|
8
|
+
* sufijo, formato con `Intl.NumberFormat` y tendencia opcional.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```html
|
|
12
|
+
* <cb-statistic title="Saldo disponible" [value]="12450000" locale="es-CO"
|
|
13
|
+
* [format]="{ style: 'currency', currency: 'COP', maximumFractionDigits: 0 }" />
|
|
14
|
+
* <cb-statistic title="Gastos del mes" [value]="8.4" suffix="%" trend="down" trendLabel="vs. septiembre" />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
class CbStatistic {
|
|
18
|
+
constructor() {
|
|
19
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
20
|
+
this.t = injectCbTranslation();
|
|
21
|
+
this.title = input('', /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
23
|
+
this.value = input(null, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
25
|
+
this.prefix = input('', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "prefix" }] : /* istanbul ignore next */ []));
|
|
27
|
+
this.suffix = input('', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "suffix" }] : /* istanbul ignore next */ []));
|
|
29
|
+
/** Opciones de `Intl.NumberFormat` (moneda, porcentaje, decimales…). */
|
|
30
|
+
this.format = input(undefined, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
32
|
+
/** Locale BCP 47 del formato (por defecto, el del navegador). */
|
|
33
|
+
this.locale = input(undefined, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
35
|
+
/** Tendencia: añade flecha, color y el texto "aumenta" / "disminuye". */
|
|
36
|
+
this.trend = input(null, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "trend" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/** Texto junto a la tendencia (p. ej. "+12 % vs. septiembre"). */
|
|
39
|
+
this.trendLabel = input('', /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "trendLabel" }] : /* istanbul ignore next */ []));
|
|
41
|
+
this.formatted = computed(() => {
|
|
42
|
+
const v = this.value();
|
|
43
|
+
if (v === null || v === '')
|
|
44
|
+
return '—';
|
|
45
|
+
return typeof v === 'number' ? new Intl.NumberFormat(this.locale(), this.format()).format(v) : v;
|
|
46
|
+
}, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "formatted" }] : /* istanbul ignore next */ []));
|
|
48
|
+
}
|
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbStatistic, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
50
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbStatistic, isStandalone: true, selector: "cb-statistic", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, suffix: { classPropertyName: "suffix", publicName: "suffix", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, trend: { classPropertyName: "trend", publicName: "trend", isSignal: true, isRequired: false, transformFunction: null }, trendLabel: { classPropertyName: "trendLabel", publicName: "trendLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cb-statistic" }, ngImport: i0, template: `
|
|
51
|
+
@if (title()) {
|
|
52
|
+
<span class="cb-statistic__title">{{ title() }}</span>
|
|
53
|
+
}
|
|
54
|
+
<span class="cb-statistic__value">
|
|
55
|
+
@if (prefix()) {
|
|
56
|
+
<span class="cb-statistic__affix">{{ prefix() }}</span>
|
|
57
|
+
}
|
|
58
|
+
<span class="cb-statistic__number">{{ formatted() }}</span>
|
|
59
|
+
@if (suffix()) {
|
|
60
|
+
<span class="cb-statistic__affix">{{ suffix() }}</span>
|
|
61
|
+
}
|
|
62
|
+
</span>
|
|
63
|
+
@if (trend()) {
|
|
64
|
+
<span class="cb-statistic__trend" [class.cb-statistic__trend--up]="trend() === 'up'" [class.cb-statistic__trend--down]="trend() === 'down'">
|
|
65
|
+
<cb-icon [name]="trend() === 'up' ? 'trending-up' : 'trending-down'" [size]="14" aria-hidden="true" />
|
|
66
|
+
<!-- El color y la flecha no bastan: el sentido también se dice con texto. -->
|
|
67
|
+
<span class="cb-statistic__sr">{{ trend() === 'up' ? t().trendUp : t().trendDown }}</span>
|
|
68
|
+
@if (trendLabel()) {
|
|
69
|
+
<span>{{ trendLabel() }}</span>
|
|
70
|
+
}
|
|
71
|
+
</span>
|
|
72
|
+
}
|
|
73
|
+
`, isInline: true, styles: [":host{display:inline-flex;flex-direction:column;gap:.2rem;font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text)}.cb-statistic__title{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted)}.cb-statistic__value{display:inline-flex;align-items:baseline;gap:.25rem;color:var(--cb-color-text-strong)}.cb-statistic__number{font-size:var(--cb-text-2xl, 1.5rem);font-weight:var(--cb-font-weight-semibold, 600);font-variant-numeric:tabular-nums;line-height:1.2}.cb-statistic__affix{font-size:var(--cb-text-base, 1rem);color:var(--cb-color-text-muted)}.cb-statistic__trend{display:inline-flex;align-items:center;gap:.25rem;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-medium, 500)}.cb-statistic__trend--up{color:var(--cb-color-success-600, #059669)}.cb-statistic__trend--down{color:var(--cb-color-danger-600, #dc2626)}.cb-statistic__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
74
|
+
}
|
|
75
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbStatistic, decorators: [{
|
|
76
|
+
type: Component,
|
|
77
|
+
args: [{ selector: 'cb-statistic', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbIcon], host: { class: 'cb-statistic' }, template: `
|
|
78
|
+
@if (title()) {
|
|
79
|
+
<span class="cb-statistic__title">{{ title() }}</span>
|
|
80
|
+
}
|
|
81
|
+
<span class="cb-statistic__value">
|
|
82
|
+
@if (prefix()) {
|
|
83
|
+
<span class="cb-statistic__affix">{{ prefix() }}</span>
|
|
84
|
+
}
|
|
85
|
+
<span class="cb-statistic__number">{{ formatted() }}</span>
|
|
86
|
+
@if (suffix()) {
|
|
87
|
+
<span class="cb-statistic__affix">{{ suffix() }}</span>
|
|
88
|
+
}
|
|
89
|
+
</span>
|
|
90
|
+
@if (trend()) {
|
|
91
|
+
<span class="cb-statistic__trend" [class.cb-statistic__trend--up]="trend() === 'up'" [class.cb-statistic__trend--down]="trend() === 'down'">
|
|
92
|
+
<cb-icon [name]="trend() === 'up' ? 'trending-up' : 'trending-down'" [size]="14" aria-hidden="true" />
|
|
93
|
+
<!-- El color y la flecha no bastan: el sentido también se dice con texto. -->
|
|
94
|
+
<span class="cb-statistic__sr">{{ trend() === 'up' ? t().trendUp : t().trendDown }}</span>
|
|
95
|
+
@if (trendLabel()) {
|
|
96
|
+
<span>{{ trendLabel() }}</span>
|
|
97
|
+
}
|
|
98
|
+
</span>
|
|
99
|
+
}
|
|
100
|
+
`, styles: [":host{display:inline-flex;flex-direction:column;gap:.2rem;font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text)}.cb-statistic__title{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted)}.cb-statistic__value{display:inline-flex;align-items:baseline;gap:.25rem;color:var(--cb-color-text-strong)}.cb-statistic__number{font-size:var(--cb-text-2xl, 1.5rem);font-weight:var(--cb-font-weight-semibold, 600);font-variant-numeric:tabular-nums;line-height:1.2}.cb-statistic__affix{font-size:var(--cb-text-base, 1rem);color:var(--cb-color-text-muted)}.cb-statistic__trend{display:inline-flex;align-items:center;gap:.25rem;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-medium, 500)}.cb-statistic__trend--up{color:var(--cb-color-success-600, #059669)}.cb-statistic__trend--down{color:var(--cb-color-danger-600, #dc2626)}.cb-statistic__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n"] }]
|
|
101
|
+
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], prefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "prefix", required: false }] }], suffix: [{ type: i0.Input, args: [{ isSignal: true, alias: "suffix", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], trend: [{ type: i0.Input, args: [{ isSignal: true, alias: "trend", required: false }] }], trendLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "trendLabel", required: false }] }] } });
|
|
102
|
+
/**
|
|
103
|
+
* Countdown de CaribeNG: cuenta regresiva hasta una fecha (vencimientos,
|
|
104
|
+
* códigos OTP, ofertas). Emite `finished` al llegar a cero.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```html
|
|
108
|
+
* <cb-countdown title="Tu código vence en" [target]="vence" (finished)="pedirOtro()" />
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
class CbCountdown {
|
|
112
|
+
constructor() {
|
|
113
|
+
this.title = input('', /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
115
|
+
/** Momento final (fecha o milisegundos desde 1970). */
|
|
116
|
+
this.target = input.required(/* @ts-ignore */
|
|
117
|
+
...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
|
|
118
|
+
/** Mostrar los días aunque sean 0. Por defecto solo cuando quedan días. */
|
|
119
|
+
this.showDays = input(false, /* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [{ debugName: "showDays" }] : /* istanbul ignore next */ []));
|
|
121
|
+
/** Se emite una vez al llegar a cero. */
|
|
122
|
+
this.finished = output();
|
|
123
|
+
this.now = signal(Date.now(), /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "now" }] : /* istanbul ignore next */ []));
|
|
125
|
+
this.finishedFor = null;
|
|
126
|
+
/** Milisegundos restantes (nunca negativos). */
|
|
127
|
+
this.remaining = computed(() => Math.max(0, +this.target() - this.now()), /* @ts-ignore */
|
|
128
|
+
...(ngDevMode ? [{ debugName: "remaining" }] : /* istanbul ignore next */ []));
|
|
129
|
+
this.display = computed(() => {
|
|
130
|
+
const total = Math.floor(this.remaining() / 1000);
|
|
131
|
+
const days = Math.floor(total / 86400);
|
|
132
|
+
const hh = pad(Math.floor((total % 86400) / 3600));
|
|
133
|
+
const mm = pad(Math.floor((total % 3600) / 60));
|
|
134
|
+
const ss = pad(total % 60);
|
|
135
|
+
return days > 0 || this.showDays() ? `${days}d ${hh}:${mm}:${ss}` : `${hh}:${mm}:${ss}`;
|
|
136
|
+
}, /* @ts-ignore */
|
|
137
|
+
...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
138
|
+
const timer = setInterval(() => this.now.set(Date.now()), 1000);
|
|
139
|
+
inject(DestroyRef).onDestroy(() => clearInterval(timer));
|
|
140
|
+
effect(() => {
|
|
141
|
+
const target = +this.target();
|
|
142
|
+
if (this.remaining() === 0 && this.finishedFor !== target) {
|
|
143
|
+
this.finishedFor = target;
|
|
144
|
+
this.finished.emit();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbCountdown, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
149
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbCountdown, isStandalone: true, selector: "cb-countdown", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: true, transformFunction: null }, showDays: { classPropertyName: "showDays", publicName: "showDays", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { finished: "finished" }, host: { classAttribute: "cb-statistic cb-countdown" }, ngImport: i0, template: `
|
|
150
|
+
@if (title()) {
|
|
151
|
+
<span class="cb-statistic__title">{{ title() }}</span>
|
|
152
|
+
}
|
|
153
|
+
<!-- role="timer": los lectores no anuncian cada segundo, pero el valor se puede consultar. -->
|
|
154
|
+
<span class="cb-statistic__value" role="timer" [attr.aria-label]="title() || null">
|
|
155
|
+
<span class="cb-statistic__number">{{ display() }}</span>
|
|
156
|
+
</span>
|
|
157
|
+
`, isInline: true, styles: [":host{display:inline-flex;flex-direction:column;gap:.2rem;font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text)}.cb-statistic__title{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted)}.cb-statistic__value{display:inline-flex;align-items:baseline;gap:.25rem;color:var(--cb-color-text-strong)}.cb-statistic__number{font-size:var(--cb-text-2xl, 1.5rem);font-weight:var(--cb-font-weight-semibold, 600);font-variant-numeric:tabular-nums;line-height:1.2}.cb-statistic__affix{font-size:var(--cb-text-base, 1rem);color:var(--cb-color-text-muted)}.cb-statistic__trend{display:inline-flex;align-items:center;gap:.25rem;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-medium, 500)}.cb-statistic__trend--up{color:var(--cb-color-success-600, #059669)}.cb-statistic__trend--down{color:var(--cb-color-danger-600, #dc2626)}.cb-statistic__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
158
|
+
}
|
|
159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbCountdown, decorators: [{
|
|
160
|
+
type: Component,
|
|
161
|
+
args: [{ selector: 'cb-countdown', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: { class: 'cb-statistic cb-countdown' }, template: `
|
|
162
|
+
@if (title()) {
|
|
163
|
+
<span class="cb-statistic__title">{{ title() }}</span>
|
|
164
|
+
}
|
|
165
|
+
<!-- role="timer": los lectores no anuncian cada segundo, pero el valor se puede consultar. -->
|
|
166
|
+
<span class="cb-statistic__value" role="timer" [attr.aria-label]="title() || null">
|
|
167
|
+
<span class="cb-statistic__number">{{ display() }}</span>
|
|
168
|
+
</span>
|
|
169
|
+
`, styles: [":host{display:inline-flex;flex-direction:column;gap:.2rem;font-family:var(--cb-font-sans, inherit);color:var(--cb-color-text)}.cb-statistic__title{font-size:var(--cb-text-sm, .875rem);color:var(--cb-color-text-muted)}.cb-statistic__value{display:inline-flex;align-items:baseline;gap:.25rem;color:var(--cb-color-text-strong)}.cb-statistic__number{font-size:var(--cb-text-2xl, 1.5rem);font-weight:var(--cb-font-weight-semibold, 600);font-variant-numeric:tabular-nums;line-height:1.2}.cb-statistic__affix{font-size:var(--cb-text-base, 1rem);color:var(--cb-color-text-muted)}.cb-statistic__trend{display:inline-flex;align-items:center;gap:.25rem;font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-medium, 500)}.cb-statistic__trend--up{color:var(--cb-color-success-600, #059669)}.cb-statistic__trend--down{color:var(--cb-color-danger-600, #dc2626)}.cb-statistic__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n"] }]
|
|
170
|
+
}], ctorParameters: () => [], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: true }] }], showDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDays", required: false }] }], finished: [{ type: i0.Output, args: ["finished"] }] } });
|
|
171
|
+
function pad(n) {
|
|
172
|
+
return String(n).padStart(2, '0');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/*
|
|
176
|
+
* Public API Surface de @caribeng/ui/statistic
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Generated bundle index. Do not edit.
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
export { CbCountdown, CbStatistic };
|
|
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { contentChildren, input, signal, ViewEncapsulation, ChangeDetectionStrategy, Component, inject, computed } from '@angular/core';
|
|
3
3
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
4
4
|
import { CbButton } from '@caribeng/ui/button';
|
|
5
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
5
6
|
|
|
6
7
|
let nextUid = 0;
|
|
7
8
|
/**
|
|
@@ -19,6 +20,8 @@ let nextUid = 0;
|
|
|
19
20
|
*/
|
|
20
21
|
class CbStepper {
|
|
21
22
|
constructor() {
|
|
23
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
24
|
+
this.t = injectCbTranslation();
|
|
22
25
|
this.steps = contentChildren(CbStep, /* @ts-ignore */
|
|
23
26
|
...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
24
27
|
/** Muestra los botones Atrás/Siguiente integrados. */
|
|
@@ -79,14 +82,14 @@ class CbStepper {
|
|
|
79
82
|
@if (showNav()) {
|
|
80
83
|
<div class="cb-stepper__nav">
|
|
81
84
|
<cb-button variant="text" severity="secondary" [disabled]="activeIndex() === 0" (click)="prev()">
|
|
82
|
-
|
|
85
|
+
{{ t().back }}
|
|
83
86
|
</cb-button>
|
|
84
87
|
<cb-button [disabled]="activeIndex() >= steps().length - 1" (click)="next()">
|
|
85
|
-
|
|
88
|
+
{{ t().next }}
|
|
86
89
|
</cb-button>
|
|
87
90
|
</div>
|
|
88
91
|
}
|
|
89
|
-
`, isInline: true, styles: [":host{display:block;font-family:var(--cb-font-sans);color:var(--cb-color-text)}.cb-stepper__header{display:flex;align-items:center;list-style:none;margin:0;padding:0}.cb-stepper__item{display:flex;align-items:center;gap:var(--cb-space-2);flex:1 1 auto}.cb-stepper__item:last-child{flex:0 0 auto}.cb-stepper__indicator{display:inline-flex;align-items:center;justify-content:center;flex:none;width:2rem;height:2rem;border-radius:var(--cb-radius-full);border:2px solid var(--cb-color-border-strong);background-color:var(--cb-color-bg);color:var(--cb-color-text-muted);font-size:var(--cb-text-sm);font-weight:var(--cb-font-weight-bold);cursor:pointer;transition:all var(--cb-duration-fast) var(--cb-ease)}.cb-stepper__indicator:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:2px}.cb-stepper__indicator:disabled{cursor:default}.cb-is-active .cb-stepper__indicator{border-color:var(--cb-color-primary-500);color:var(--cb-color-primary-500)}.cb-is-complete .cb-stepper__indicator{border-color:var(--cb-color-primary-500);background-color:var(--cb-color-primary-500);color:var(--cb-color-primary-contrast)}.cb-stepper__label{font-size:var(--cb-text-sm);font-weight:var(--cb-font-weight-medium);color:var(--cb-color-text-muted);white-space:nowrap}.cb-is-active .cb-stepper__label{color:var(--cb-color-text)}.cb-stepper__connector{flex:1 1 auto;height:2px;min-width:var(--cb-space-4);margin:0 var(--cb-space-2);background-color:var(--cb-color-border)}.cb-is-complete .cb-stepper__connector{background-color:var(--cb-color-primary-500)}.cb-stepper__content{padding:var(--cb-space-5) 0;font-size:var(--cb-text-sm);line-height:var(--cb-line-height-normal)}.cb-stepper__nav{display:flex;justify-content:space-between;gap:var(--cb-space-3)}@media(max-width:480px){.cb-stepper__label{display:none}}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }, { kind: "component", type: CbButton, selector: "cb-button", inputs: ["severity", "variant", "size", "disabled", "loading", "fullWidth", "type"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
92
|
+
`, isInline: true, styles: [":host{display:block;font-family:var(--cb-font-sans);color:var(--cb-color-text)}.cb-stepper__header{display:flex;align-items:center;list-style:none;margin:0;padding:0}.cb-stepper__item{display:flex;align-items:center;gap:var(--cb-space-2);flex:1 1 auto}.cb-stepper__item:last-child{flex:0 0 auto}.cb-stepper__indicator{display:inline-flex;align-items:center;justify-content:center;flex:none;width:2rem;height:2rem;border-radius:var(--cb-radius-full);border:2px solid var(--cb-color-border-strong);background-color:var(--cb-color-bg);color:var(--cb-color-text-muted);font-size:var(--cb-text-sm);font-weight:var(--cb-font-weight-bold);cursor:pointer;transition:all var(--cb-duration-fast) var(--cb-ease)}.cb-stepper__indicator:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:2px}.cb-stepper__indicator:disabled{cursor:default}.cb-is-active .cb-stepper__indicator{border-color:var(--cb-color-primary-500);color:var(--cb-color-primary-500)}.cb-is-complete .cb-stepper__indicator{border-color:var(--cb-color-primary-500);background-color:var(--cb-color-primary-500);color:var(--cb-color-primary-contrast)}.cb-stepper__label{font-size:var(--cb-text-sm);font-weight:var(--cb-font-weight-medium);color:var(--cb-color-text-muted);white-space:nowrap}.cb-is-active .cb-stepper__label{color:var(--cb-color-text)}.cb-stepper__connector{flex:1 1 auto;height:2px;min-width:var(--cb-space-4);margin:0 var(--cb-space-2);background-color:var(--cb-color-border)}.cb-is-complete .cb-stepper__connector{background-color:var(--cb-color-primary-500)}.cb-stepper__content{padding:var(--cb-space-5) 0;font-size:var(--cb-text-sm);line-height:var(--cb-line-height-normal)}.cb-stepper__nav{display:flex;justify-content:space-between;gap:var(--cb-space-3)}@media(max-width:480px){.cb-stepper__label{display:none}}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }, { kind: "component", type: CbButton, selector: "cb-button", inputs: ["severity", "variant", "size", "disabled", "loading", "fullWidth", "type", "ariaLabel", "ariaHaspopup", "ariaExpanded", "ariaControls"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
90
93
|
}
|
|
91
94
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbStepper, decorators: [{
|
|
92
95
|
type: Component,
|
|
@@ -126,10 +129,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
126
129
|
@if (showNav()) {
|
|
127
130
|
<div class="cb-stepper__nav">
|
|
128
131
|
<cb-button variant="text" severity="secondary" [disabled]="activeIndex() === 0" (click)="prev()">
|
|
129
|
-
|
|
132
|
+
{{ t().back }}
|
|
130
133
|
</cb-button>
|
|
131
134
|
<cb-button [disabled]="activeIndex() >= steps().length - 1" (click)="next()">
|
|
132
|
-
|
|
135
|
+
{{ t().next }}
|
|
133
136
|
</cb-button>
|
|
134
137
|
</div>
|
|
135
138
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, model, output, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
4
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
4
5
|
|
|
5
6
|
/** Clickable progress navigation for a multi-step flow. */
|
|
6
7
|
class CbSteps {
|
|
7
8
|
constructor() {
|
|
9
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
10
|
+
this.t = injectCbTranslation();
|
|
8
11
|
this.steps = input([], /* @ts-ignore */
|
|
9
12
|
...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
10
13
|
this.activeIndex = model(0, /* @ts-ignore */
|
|
11
14
|
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
12
|
-
this.ariaLabel = input(
|
|
15
|
+
this.ariaLabel = input(undefined, /* @ts-ignore */
|
|
13
16
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
14
17
|
this.activeChange = output();
|
|
15
18
|
}
|
|
@@ -21,7 +24,7 @@ class CbSteps {
|
|
|
21
24
|
}
|
|
22
25
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSteps, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
23
26
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbSteps, isStandalone: true, selector: "cb-steps", inputs: { steps: { classPropertyName: "steps", publicName: "steps", 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", activeChange: "activeChange" }, host: { classAttribute: "cb-steps" }, ngImport: i0, template: `
|
|
24
|
-
<nav [attr.aria-label]="ariaLabel()">
|
|
27
|
+
<nav [attr.aria-label]="(ariaLabel() ?? t().steps)">
|
|
25
28
|
<ol class="cb-steps__list">
|
|
26
29
|
@for (step of steps(); track $index; let i = $index; let last = $last) {
|
|
27
30
|
<li class="cb-steps__entry" [class.cb-steps__entry--complete]="i < activeIndex()" [class.cb-steps__entry--current]="i === activeIndex()">
|
|
@@ -39,7 +42,7 @@ class CbSteps {
|
|
|
39
42
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSteps, decorators: [{
|
|
40
43
|
type: Component,
|
|
41
44
|
args: [{ selector: 'cb-steps', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbIcon], host: { class: 'cb-steps' }, template: `
|
|
42
|
-
<nav [attr.aria-label]="ariaLabel()">
|
|
45
|
+
<nav [attr.aria-label]="(ariaLabel() ?? t().steps)">
|
|
43
46
|
<ol class="cb-steps__list">
|
|
44
47
|
@for (step of steps(); track $index; let i = $index; let last = $last) {
|
|
45
48
|
<li class="cb-steps__entry" [class.cb-steps__entry--complete]="i < activeIndex()" [class.cb-steps__entry--current]="i === activeIndex()">
|