@caribeng/ui 22.1.0 → 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 +52 -12
- 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 +70 -11
- 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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, output, signal, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
4
|
+
import { injectCbTranslation, cbFormat } from '@caribeng/ui';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Chip de CaribeNG: píldora compacta para representar entidades, filtros o etiquetas
|
|
@@ -8,6 +9,10 @@ import { CbIcon } from '@caribeng/ui/icon';
|
|
|
8
9
|
*/
|
|
9
10
|
class CbChip {
|
|
10
11
|
constructor() {
|
|
12
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
13
|
+
this.t = injectCbTranslation();
|
|
14
|
+
/** Rellena `{0}`, `{1}`… de un texto traducido. */
|
|
15
|
+
this.fmt = cbFormat;
|
|
11
16
|
this.label = input('', /* @ts-ignore */
|
|
12
17
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
13
18
|
this.icon = input('', /* @ts-ignore */
|
|
@@ -27,7 +32,7 @@ class CbChip {
|
|
|
27
32
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbChip, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
28
33
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbChip, isStandalone: true, selector: "cb-chip", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { removed: "removed" }, host: { properties: { "style.display": "visible() ? \"inline-flex\" : \"none\"" }, classAttribute: "cb-chip" }, ngImport: i0, template: `
|
|
29
34
|
@if (image()) {
|
|
30
|
-
<img class="cb-chip__img" [src]="image()"
|
|
35
|
+
<img class="cb-chip__img" [src]="image()" alt="" />
|
|
31
36
|
} @else if (icon()) {
|
|
32
37
|
<cb-icon class="cb-chip__icon" [name]="icon()" [size]="14" aria-hidden="true" />
|
|
33
38
|
}
|
|
@@ -36,7 +41,7 @@ class CbChip {
|
|
|
36
41
|
<button
|
|
37
42
|
type="button"
|
|
38
43
|
class="cb-chip__remove"
|
|
39
|
-
[attr.aria-label]="
|
|
44
|
+
[attr.aria-label]="fmt(t().removeItem, label())"
|
|
40
45
|
(click)="onRemove($event)"
|
|
41
46
|
>
|
|
42
47
|
<cb-icon name="x" [size]="13" aria-hidden="true" />
|
|
@@ -51,7 +56,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
51
56
|
'[style.display]': 'visible() ? "inline-flex" : "none"',
|
|
52
57
|
}, template: `
|
|
53
58
|
@if (image()) {
|
|
54
|
-
<img class="cb-chip__img" [src]="image()"
|
|
59
|
+
<img class="cb-chip__img" [src]="image()" alt="" />
|
|
55
60
|
} @else if (icon()) {
|
|
56
61
|
<cb-icon class="cb-chip__icon" [name]="icon()" [size]="14" aria-hidden="true" />
|
|
57
62
|
}
|
|
@@ -60,7 +65,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
60
65
|
<button
|
|
61
66
|
type="button"
|
|
62
67
|
class="cb-chip__remove"
|
|
63
|
-
[attr.aria-label]="
|
|
68
|
+
[attr.aria-label]="fmt(t().removeItem, label())"
|
|
64
69
|
(click)="onRemove($event)"
|
|
65
70
|
>
|
|
66
71
|
<cb-icon name="x" [size]="13" aria-hidden="true" />
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { model, input, output, viewChild, signal, computed, forwardRef, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
4
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
5
|
-
import { cbFieldState } from '@caribeng/ui';
|
|
5
|
+
import { injectCbTranslation, cbFormat, cbFieldState } from '@caribeng/ui';
|
|
6
6
|
|
|
7
7
|
let nextUid = 0;
|
|
8
8
|
/**
|
|
@@ -16,6 +16,10 @@ let nextUid = 0;
|
|
|
16
16
|
*/
|
|
17
17
|
class CbChips {
|
|
18
18
|
constructor() {
|
|
19
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
20
|
+
this.t = injectCbTranslation();
|
|
21
|
+
/** Rellena `{0}`, `{1}`… de un texto traducido. */
|
|
22
|
+
this.fmt = cbFormat;
|
|
19
23
|
this.value = model([], /* @ts-ignore */
|
|
20
24
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
21
25
|
this.placeholder = input('', /* @ts-ignore */
|
|
@@ -127,7 +131,7 @@ class CbChips {
|
|
|
127
131
|
<button
|
|
128
132
|
type="button"
|
|
129
133
|
class="cb-chips__remove"
|
|
130
|
-
[attr.aria-label]="
|
|
134
|
+
[attr.aria-label]="fmt(t().removeItem, chip)"
|
|
131
135
|
(click)="remove($index); $event.stopPropagation()"
|
|
132
136
|
>
|
|
133
137
|
<cb-icon name="x" [size]="14" aria-hidden="true" />
|
|
@@ -151,7 +155,7 @@ class CbChips {
|
|
|
151
155
|
(blur)="onBlur()"
|
|
152
156
|
/>
|
|
153
157
|
</div>
|
|
154
|
-
`, isInline: true, styles: [":host{display:block}.cb-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cb-space-2);width:100%;min-height:2.5rem;padding:var(--cb-space-1) var(--cb-space-2);background-color:var(--cb-color-bg);border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);cursor:text;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-chips:focus-within{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px var(--cb-color-focus-ring)}.cb-chips--sm{min-height:2.125rem;font-size:var(--cb-text-sm)}.cb-chips--lg{min-height:2.875rem;font-size:var(--cb-text-lg)}.cb-chips__chip{display:inline-flex;align-items:center;gap:var(--cb-space-1);padding:.125rem .25rem .125rem .5rem;background-color:var(--cb-color-primary-50);color:var(--cb-color-primary-700);border-radius:var(--cb-radius-sm);font-size:.875em}.cb-chips__remove{display:inline-flex;padding:1px;border:none;background:transparent;color:inherit;border-radius:var(--cb-radius-full);cursor:pointer;opacity:.7}.cb-chips__remove:hover{opacity:1;background-color:color-mix(in srgb,var(--cb-color-primary-500) 20%,transparent)}.cb-chips__input{flex:1 1 60px;min-width:60px;border:none;outline:none;background:transparent;color:var(--cb-color-text);font:inherit;padding:var(--cb-space-1) 0}.cb-chips.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-chips.cb-is-disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default;background-color:var(--cb-color-surface
|
|
158
|
+
`, isInline: true, styles: [":host{display:block}.cb-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cb-space-2);width:100%;min-height:2.5rem;padding:var(--cb-space-1) var(--cb-space-2);background-color:var(--cb-color-bg);border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);cursor:text;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-chips:focus-within{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px var(--cb-color-focus-ring)}.cb-chips--sm{min-height:2.125rem;font-size:var(--cb-text-sm)}.cb-chips--lg{min-height:2.875rem;font-size:var(--cb-text-lg)}.cb-chips__chip{display:inline-flex;align-items:center;gap:var(--cb-space-1);padding:.125rem .25rem .125rem .5rem;background-color:var(--cb-color-primary-50);color:var(--cb-color-primary-700);border-radius:var(--cb-radius-sm);font-size:.875em}.cb-chips__remove{display:inline-flex;padding:1px;border:none;background:transparent;color:inherit;border-radius:var(--cb-radius-full);cursor:pointer;opacity:.7}.cb-chips__remove:hover{opacity:1;background-color:color-mix(in srgb,var(--cb-color-primary-500) 20%,transparent)}.cb-chips__input{flex:1 1 60px;min-width:60px;border:none;outline:none;background:transparent;color:var(--cb-color-text);font:inherit;padding:var(--cb-space-1) 0}.cb-chips.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-chips.cb-is-disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default;background-color:var(--cb-color-surface)}:host-context([data-theme=\"dark\"]) .cb-chips__chip{background-color:color-mix(in srgb,var(--cb-color-primary-500) 22%,transparent);color:var(--cb-color-primary-200)}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
155
159
|
}
|
|
156
160
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbChips, decorators: [{
|
|
157
161
|
type: Component,
|
|
@@ -170,7 +174,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
170
174
|
<button
|
|
171
175
|
type="button"
|
|
172
176
|
class="cb-chips__remove"
|
|
173
|
-
[attr.aria-label]="
|
|
177
|
+
[attr.aria-label]="fmt(t().removeItem, chip)"
|
|
174
178
|
(click)="remove($index); $event.stopPropagation()"
|
|
175
179
|
>
|
|
176
180
|
<cb-icon name="x" [size]="14" aria-hidden="true" />
|
|
@@ -200,7 +204,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
200
204
|
useExisting: forwardRef(() => CbChips),
|
|
201
205
|
multi: true,
|
|
202
206
|
},
|
|
203
|
-
], styles: [":host{display:block}.cb-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cb-space-2);width:100%;min-height:2.5rem;padding:var(--cb-space-1) var(--cb-space-2);background-color:var(--cb-color-bg);border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);cursor:text;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-chips:focus-within{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px var(--cb-color-focus-ring)}.cb-chips--sm{min-height:2.125rem;font-size:var(--cb-text-sm)}.cb-chips--lg{min-height:2.875rem;font-size:var(--cb-text-lg)}.cb-chips__chip{display:inline-flex;align-items:center;gap:var(--cb-space-1);padding:.125rem .25rem .125rem .5rem;background-color:var(--cb-color-primary-50);color:var(--cb-color-primary-700);border-radius:var(--cb-radius-sm);font-size:.875em}.cb-chips__remove{display:inline-flex;padding:1px;border:none;background:transparent;color:inherit;border-radius:var(--cb-radius-full);cursor:pointer;opacity:.7}.cb-chips__remove:hover{opacity:1;background-color:color-mix(in srgb,var(--cb-color-primary-500) 20%,transparent)}.cb-chips__input{flex:1 1 60px;min-width:60px;border:none;outline:none;background:transparent;color:var(--cb-color-text);font:inherit;padding:var(--cb-space-1) 0}.cb-chips.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-chips.cb-is-disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default;background-color:var(--cb-color-surface
|
|
207
|
+
], styles: [":host{display:block}.cb-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cb-space-2);width:100%;min-height:2.5rem;padding:var(--cb-space-1) var(--cb-space-2);background-color:var(--cb-color-bg);border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);cursor:text;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-chips:focus-within{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px var(--cb-color-focus-ring)}.cb-chips--sm{min-height:2.125rem;font-size:var(--cb-text-sm)}.cb-chips--lg{min-height:2.875rem;font-size:var(--cb-text-lg)}.cb-chips__chip{display:inline-flex;align-items:center;gap:var(--cb-space-1);padding:.125rem .25rem .125rem .5rem;background-color:var(--cb-color-primary-50);color:var(--cb-color-primary-700);border-radius:var(--cb-radius-sm);font-size:.875em}.cb-chips__remove{display:inline-flex;padding:1px;border:none;background:transparent;color:inherit;border-radius:var(--cb-radius-full);cursor:pointer;opacity:.7}.cb-chips__remove:hover{opacity:1;background-color:color-mix(in srgb,var(--cb-color-primary-500) 20%,transparent)}.cb-chips__input{flex:1 1 60px;min-width:60px;border:none;outline:none;background:transparent;color:var(--cb-color-text);font:inherit;padding:var(--cb-space-1) 0}.cb-chips.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-chips.cb-is-disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default;background-color:var(--cb-color-surface)}:host-context([data-theme=\"dark\"]) .cb-chips__chip{background-color:color-mix(in srgb,var(--cb-color-primary-500) 22%,transparent);color:var(--cb-color-primary-200)}\n"] }]
|
|
204
208
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], allowDuplicate: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowDuplicate", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], added: [{ type: i0.Output, args: ["added"] }], removed: [{ type: i0.Output, args: ["removed"] }], field: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }] } });
|
|
205
209
|
function toBoolean(value) {
|
|
206
210
|
return value !== false && value != null && `${value}` !== 'false';
|
|
@@ -3,7 +3,7 @@ import { model, input, signal, viewChild, computed, forwardRef, ViewEncapsulatio
|
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
4
|
import * as i1 from '@angular/cdk/overlay';
|
|
5
5
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
6
|
-
import { cbFieldState } from '@caribeng/ui';
|
|
6
|
+
import { injectCbTranslation, cbFieldState } from '@caribeng/ui';
|
|
7
7
|
|
|
8
8
|
let nextUid = 0;
|
|
9
9
|
const DEFAULT_PRESETS = [
|
|
@@ -23,6 +23,8 @@ const DEFAULT_PRESETS = [
|
|
|
23
23
|
*/
|
|
24
24
|
class CbColorPicker {
|
|
25
25
|
constructor() {
|
|
26
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
27
|
+
this.t = injectCbTranslation();
|
|
26
28
|
/** Color seleccionado (hex `#rrggbb`). Two-way opcional fuera de Forms. */
|
|
27
29
|
this.value = model('#10b981', /* @ts-ignore */
|
|
28
30
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
@@ -191,7 +193,7 @@ class CbColorPicker {
|
|
|
191
193
|
[disabled]="isDisabled()"
|
|
192
194
|
[attr.aria-haspopup]="'dialog'"
|
|
193
195
|
[attr.aria-expanded]="open()"
|
|
194
|
-
[attr.aria-label]="(ariaLabel() ||
|
|
196
|
+
[attr.aria-label]="(ariaLabel() || t().color) + ': ' + value()"
|
|
195
197
|
(click)="toggle()"
|
|
196
198
|
>
|
|
197
199
|
<span class="cb-colorpicker__swatch" [style.background-color]="value()"></span>
|
|
@@ -210,7 +212,7 @@ class CbColorPicker {
|
|
|
210
212
|
(overlayKeydown)="onOverlayKeydown($event)"
|
|
211
213
|
(detach)="close()"
|
|
212
214
|
>
|
|
213
|
-
<div class="cb-colorpicker__panel" role="dialog" [attr.aria-label]="ariaLabel() ||
|
|
215
|
+
<div class="cb-colorpicker__panel" role="dialog" [attr.aria-label]="ariaLabel() || t().colorPicker">
|
|
214
216
|
<div
|
|
215
217
|
#sv
|
|
216
218
|
class="cb-colorpicker__sv"
|
|
@@ -244,7 +246,7 @@ class CbColorPicker {
|
|
|
244
246
|
type="text"
|
|
245
247
|
spellcheck="false"
|
|
246
248
|
autocomplete="off"
|
|
247
|
-
aria-label="
|
|
249
|
+
[attr.aria-label]="t().hexColor"
|
|
248
250
|
[value]="value()"
|
|
249
251
|
(change)="onHexInput($event)"
|
|
250
252
|
/>
|
|
@@ -288,7 +290,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
288
290
|
[disabled]="isDisabled()"
|
|
289
291
|
[attr.aria-haspopup]="'dialog'"
|
|
290
292
|
[attr.aria-expanded]="open()"
|
|
291
|
-
[attr.aria-label]="(ariaLabel() ||
|
|
293
|
+
[attr.aria-label]="(ariaLabel() || t().color) + ': ' + value()"
|
|
292
294
|
(click)="toggle()"
|
|
293
295
|
>
|
|
294
296
|
<span class="cb-colorpicker__swatch" [style.background-color]="value()"></span>
|
|
@@ -307,7 +309,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
307
309
|
(overlayKeydown)="onOverlayKeydown($event)"
|
|
308
310
|
(detach)="close()"
|
|
309
311
|
>
|
|
310
|
-
<div class="cb-colorpicker__panel" role="dialog" [attr.aria-label]="ariaLabel() ||
|
|
312
|
+
<div class="cb-colorpicker__panel" role="dialog" [attr.aria-label]="ariaLabel() || t().colorPicker">
|
|
311
313
|
<div
|
|
312
314
|
#sv
|
|
313
315
|
class="cb-colorpicker__sv"
|
|
@@ -341,7 +343,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
341
343
|
type="text"
|
|
342
344
|
spellcheck="false"
|
|
343
345
|
autocomplete="off"
|
|
344
|
-
aria-label="
|
|
346
|
+
[attr.aria-label]="t().hexColor"
|
|
345
347
|
[value]="value()"
|
|
346
348
|
(change)="onHexInput($event)"
|
|
347
349
|
/>
|
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
import { DOCUMENT } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, model, input, output, effect, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { inject, model, input, output, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/cdk/a11y';
|
|
5
5
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
6
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
7
|
+
import { CbButton } from '@caribeng/ui/button';
|
|
6
8
|
|
|
7
9
|
let nextUid = 0;
|
|
8
10
|
/**
|
|
9
11
|
* Diálogo de confirmación (`role="alertdialog"`) con trampa de foco, cierre con
|
|
10
|
-
* Escape (equivale a cancelar) y restauración del foco al cerrarse.
|
|
12
|
+
* Escape (equivale a cancelar) y restauración del foco al cerrarse. Al abrirse,
|
|
13
|
+
* el foco va al botón de cancelar (la opción segura).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <cb-confirm-dialog
|
|
18
|
+
* [(visible)]="confirmar"
|
|
19
|
+
* header="Eliminar cuenta"
|
|
20
|
+
* message="Esta acción no se puede deshacer."
|
|
21
|
+
* acceptSeverity="danger"
|
|
22
|
+
* (accepted)="eliminar()"
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
11
25
|
*/
|
|
12
26
|
class CbConfirmDialog {
|
|
13
27
|
constructor() {
|
|
28
|
+
this.t = injectCbTranslation();
|
|
14
29
|
this.document = inject(DOCUMENT);
|
|
30
|
+
/** Visibilidad (two-way). */
|
|
15
31
|
this.visible = model(false, /* @ts-ignore */
|
|
16
32
|
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
17
|
-
|
|
33
|
+
/** Título. Por defecto, "Confirmar" del idioma activo. */
|
|
34
|
+
this.header = input(undefined, /* @ts-ignore */
|
|
18
35
|
...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
|
|
19
|
-
|
|
36
|
+
/** Mensaje. Por defecto, "¿Deseas continuar?" del idioma activo. */
|
|
37
|
+
this.message = input(undefined, /* @ts-ignore */
|
|
20
38
|
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
21
|
-
this.acceptLabel = input(
|
|
39
|
+
this.acceptLabel = input(undefined, /* @ts-ignore */
|
|
22
40
|
...(ngDevMode ? [{ debugName: "acceptLabel" }] : /* istanbul ignore next */ []));
|
|
23
|
-
this.rejectLabel = input(
|
|
41
|
+
this.rejectLabel = input(undefined, /* @ts-ignore */
|
|
24
42
|
...(ngDevMode ? [{ debugName: "rejectLabel" }] : /* istanbul ignore next */ []));
|
|
43
|
+
/** Severidad del botón de aceptar (p. ej. `danger` para acciones destructivas). */
|
|
44
|
+
this.acceptSeverity = input('primary', /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "acceptSeverity" }] : /* istanbul ignore next */ []));
|
|
25
46
|
this.accepted = output();
|
|
26
47
|
this.rejected = output();
|
|
27
48
|
this.titleId = `cb-confirm-dialog-${++nextUid}-title`;
|
|
@@ -52,12 +73,56 @@ class CbConfirmDialog {
|
|
|
52
73
|
this.visible.set(false);
|
|
53
74
|
}
|
|
54
75
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbConfirmDialog, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
55
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbConfirmDialog, isStandalone: true, selector: "cb-confirm-dialog", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, acceptLabel: { classPropertyName: "acceptLabel", publicName: "acceptLabel", isSignal: true, isRequired: false, transformFunction: null }, rejectLabel: { classPropertyName: "rejectLabel", publicName: "rejectLabel", isSignal: true, isRequired: false, transformFunction: null }
|
|
76
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbConfirmDialog, isStandalone: true, selector: "cb-confirm-dialog", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, acceptLabel: { classPropertyName: "acceptLabel", publicName: "acceptLabel", isSignal: true, isRequired: false, transformFunction: null }, rejectLabel: { classPropertyName: "rejectLabel", publicName: "rejectLabel", isSignal: true, isRequired: false, transformFunction: null }, acceptSeverity: { classPropertyName: "acceptSeverity", publicName: "acceptSeverity", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", accepted: "accepted", rejected: "rejected" }, host: { listeners: { "document:keydown.escape": "onEscape()" } }, ngImport: i0, template: `
|
|
77
|
+
@if (visible()) {
|
|
78
|
+
<div class="cb-confirm-dialog__mask" (click)="reject()">
|
|
79
|
+
<section
|
|
80
|
+
class="cb-confirm-dialog"
|
|
81
|
+
role="alertdialog"
|
|
82
|
+
aria-modal="true"
|
|
83
|
+
[attr.aria-labelledby]="titleId"
|
|
84
|
+
[attr.aria-describedby]="messageId"
|
|
85
|
+
cdkTrapFocus
|
|
86
|
+
cdkTrapFocusAutoCapture
|
|
87
|
+
(click)="$event.stopPropagation()"
|
|
88
|
+
>
|
|
89
|
+
<h2 class="cb-confirm-dialog__title" [id]="titleId">{{ header() ?? t().confirm }}</h2>
|
|
90
|
+
<p class="cb-confirm-dialog__message" [id]="messageId">{{ message() ?? t().confirmMessage }}</p>
|
|
91
|
+
<footer class="cb-confirm-dialog__actions">
|
|
92
|
+
<cb-button variant="text" severity="secondary" (click)="reject()">{{ rejectLabel() ?? t().cancel }}</cb-button>
|
|
93
|
+
<cb-button [severity]="acceptSeverity()" (click)="confirm()">{{ acceptLabel() ?? t().accept }}</cb-button>
|
|
94
|
+
</footer>
|
|
95
|
+
</section>
|
|
96
|
+
</div>
|
|
97
|
+
}
|
|
98
|
+
`, isInline: true, styles: [":host{display:contents}.cb-confirm-dialog__mask{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:var(--cb-space-4, 1rem);background:color-mix(in srgb,#000 40%,transparent)}.cb-confirm-dialog{box-sizing:border-box;width:min(28rem,100%);padding:var(--cb-space-6, 1.5rem);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);background:var(--cb-color-surface-raised);color:var(--cb-color-text);box-shadow:var(--cb-shadow-lg, 0 1rem 3rem rgb(0 0 0 / 20%))}.cb-confirm-dialog__title{margin:0 0 var(--cb-space-2, .5rem);font-size:var(--cb-text-lg, 1.125rem);font-weight:var(--cb-font-weight-semibold, 600);color:var(--cb-color-text-strong)}.cb-confirm-dialog__message{margin:0;color:var(--cb-color-text-muted);line-height:1.55}.cb-confirm-dialog__actions{display:flex;justify-content:flex-end;gap:var(--cb-space-2, .5rem);margin-top:var(--cb-space-6, 1.5rem)}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: CbButton, selector: "cb-button", inputs: ["severity", "variant", "size", "disabled", "loading", "fullWidth", "type", "ariaLabel", "ariaHaspopup", "ariaExpanded", "ariaControls"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
56
99
|
}
|
|
57
100
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbConfirmDialog, decorators: [{
|
|
58
101
|
type: Component,
|
|
59
|
-
args: [{ selector: 'cb-confirm-dialog',
|
|
60
|
-
|
|
102
|
+
args: [{ selector: 'cb-confirm-dialog', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [A11yModule, CbButton], host: { '(document:keydown.escape)': 'onEscape()' }, template: `
|
|
103
|
+
@if (visible()) {
|
|
104
|
+
<div class="cb-confirm-dialog__mask" (click)="reject()">
|
|
105
|
+
<section
|
|
106
|
+
class="cb-confirm-dialog"
|
|
107
|
+
role="alertdialog"
|
|
108
|
+
aria-modal="true"
|
|
109
|
+
[attr.aria-labelledby]="titleId"
|
|
110
|
+
[attr.aria-describedby]="messageId"
|
|
111
|
+
cdkTrapFocus
|
|
112
|
+
cdkTrapFocusAutoCapture
|
|
113
|
+
(click)="$event.stopPropagation()"
|
|
114
|
+
>
|
|
115
|
+
<h2 class="cb-confirm-dialog__title" [id]="titleId">{{ header() ?? t().confirm }}</h2>
|
|
116
|
+
<p class="cb-confirm-dialog__message" [id]="messageId">{{ message() ?? t().confirmMessage }}</p>
|
|
117
|
+
<footer class="cb-confirm-dialog__actions">
|
|
118
|
+
<cb-button variant="text" severity="secondary" (click)="reject()">{{ rejectLabel() ?? t().cancel }}</cb-button>
|
|
119
|
+
<cb-button [severity]="acceptSeverity()" (click)="confirm()">{{ acceptLabel() ?? t().accept }}</cb-button>
|
|
120
|
+
</footer>
|
|
121
|
+
</section>
|
|
122
|
+
</div>
|
|
123
|
+
}
|
|
124
|
+
`, styles: [":host{display:contents}.cb-confirm-dialog__mask{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:var(--cb-space-4, 1rem);background:color-mix(in srgb,#000 40%,transparent)}.cb-confirm-dialog{box-sizing:border-box;width:min(28rem,100%);padding:var(--cb-space-6, 1.5rem);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);background:var(--cb-color-surface-raised);color:var(--cb-color-text);box-shadow:var(--cb-shadow-lg, 0 1rem 3rem rgb(0 0 0 / 20%))}.cb-confirm-dialog__title{margin:0 0 var(--cb-space-2, .5rem);font-size:var(--cb-text-lg, 1.125rem);font-weight:var(--cb-font-weight-semibold, 600);color:var(--cb-color-text-strong)}.cb-confirm-dialog__message{margin:0;color:var(--cb-color-text-muted);line-height:1.55}.cb-confirm-dialog__actions{display:flex;justify-content:flex-end;gap:var(--cb-space-2, .5rem);margin-top:var(--cb-space-6, 1.5rem)}\n"] }]
|
|
125
|
+
}], ctorParameters: () => [], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], acceptLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "acceptLabel", required: false }] }], rejectLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "rejectLabel", required: false }] }], acceptSeverity: [{ type: i0.Input, args: [{ isSignal: true, alias: "acceptSeverity", required: false }] }], accepted: [{ type: i0.Output, args: ["accepted"] }], rejected: [{ type: i0.Output, args: ["rejected"] }] } });
|
|
61
126
|
|
|
62
127
|
/**
|
|
63
128
|
* Generated bundle index. Do not edit.
|
|
@@ -1,28 +1,153 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { model, input, output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { inject, ViewContainerRef, Injector, model, input, output, viewChild, signal, afterNextRender, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
5
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
6
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
7
|
+
import { CbButton } from '@caribeng/ui/button';
|
|
3
8
|
|
|
9
|
+
let nextUid = 0;
|
|
10
|
+
/**
|
|
11
|
+
* Confirmación breve de CaribeNG. Ábrela anclada al botón que la dispara con
|
|
12
|
+
* `confirm($event)` (como PrimeNG), o en línea con `[(visible)]`. Escape o un
|
|
13
|
+
* clic fuera la cancelan; el foco vuelve al disparador al cerrarse.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <cb-button severity="danger" (click)="borrar.confirm($event)">Eliminar</cb-button>
|
|
18
|
+
* <cb-confirm-popup #borrar message="¿Eliminar este archivo?" (accepted)="eliminar()" />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
4
21
|
class CbConfirmPopup {
|
|
5
22
|
constructor() {
|
|
23
|
+
this.t = injectCbTranslation();
|
|
24
|
+
this.overlay = inject(Overlay);
|
|
25
|
+
this.vcr = inject(ViewContainerRef);
|
|
26
|
+
this.injector = inject(Injector);
|
|
27
|
+
this.messageId = `cb-confirm-popup-${++nextUid}-message`;
|
|
28
|
+
/** Visibilidad (two-way). Con `[(visible)]` se muestra en línea. */
|
|
6
29
|
this.visible = model(false, /* @ts-ignore */
|
|
7
30
|
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
8
|
-
|
|
31
|
+
/** Pregunta a confirmar. Por defecto, la del idioma activo. */
|
|
32
|
+
this.message = input(undefined, /* @ts-ignore */
|
|
9
33
|
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
10
|
-
this.acceptLabel = input(
|
|
34
|
+
this.acceptLabel = input(undefined, /* @ts-ignore */
|
|
11
35
|
...(ngDevMode ? [{ debugName: "acceptLabel" }] : /* istanbul ignore next */ []));
|
|
12
|
-
this.rejectLabel = input(
|
|
36
|
+
this.rejectLabel = input(undefined, /* @ts-ignore */
|
|
13
37
|
...(ngDevMode ? [{ debugName: "rejectLabel" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/** Severidad del botón de aceptar (p. ej. `danger` para acciones destructivas). */
|
|
39
|
+
this.acceptSeverity = input('primary', /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "acceptSeverity" }] : /* istanbul ignore next */ []));
|
|
14
41
|
this.accepted = output();
|
|
15
42
|
this.rejected = output();
|
|
43
|
+
this.panel = viewChild.required('panel');
|
|
44
|
+
/** Abierta como overlay anclado a un disparador. */
|
|
45
|
+
this.anchored = signal(false, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "anchored" }] : /* istanbul ignore next */ []));
|
|
47
|
+
this.overlayRef = null;
|
|
48
|
+
this.trigger = null;
|
|
49
|
+
this.positions = [
|
|
50
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 8 },
|
|
51
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -8 },
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
/** Abre la confirmación anclada al elemento que recibió el evento. */
|
|
55
|
+
confirm(event) {
|
|
56
|
+
this.show(event.currentTarget);
|
|
57
|
+
}
|
|
58
|
+
/** Abre la confirmación anclada a `target`. */
|
|
59
|
+
show(target) {
|
|
60
|
+
if (this.overlayRef)
|
|
61
|
+
return;
|
|
62
|
+
this.trigger = target;
|
|
63
|
+
this.overlayRef = this.overlay.create({
|
|
64
|
+
positionStrategy: this.overlay.position().flexibleConnectedTo(target).withPositions(this.positions).withPush(true),
|
|
65
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
66
|
+
hasBackdrop: true,
|
|
67
|
+
backdropClass: 'cdk-overlay-transparent-backdrop',
|
|
68
|
+
});
|
|
69
|
+
this.overlayRef.attach(new TemplatePortal(this.panel(), this.vcr));
|
|
70
|
+
this.overlayRef.backdropClick().subscribe(() => this.reject());
|
|
71
|
+
this.anchored.set(true);
|
|
72
|
+
this.visible.set(true);
|
|
73
|
+
// Foco en la opción segura (cancelar), como en ConfirmDialog.
|
|
74
|
+
afterNextRender(() => this.overlayRef?.overlayElement.querySelector('button')?.focus(), {
|
|
75
|
+
injector: this.injector,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
accept() {
|
|
79
|
+
this.accepted.emit();
|
|
80
|
+
this.close();
|
|
81
|
+
}
|
|
82
|
+
reject() {
|
|
83
|
+
this.rejected.emit();
|
|
84
|
+
this.close();
|
|
85
|
+
}
|
|
86
|
+
close() {
|
|
87
|
+
this.visible.set(false);
|
|
88
|
+
if (this.overlayRef) {
|
|
89
|
+
this.overlayRef.dispose();
|
|
90
|
+
this.overlayRef = null;
|
|
91
|
+
this.anchored.set(false);
|
|
92
|
+
this.trigger?.focus();
|
|
93
|
+
this.trigger = null;
|
|
94
|
+
}
|
|
16
95
|
}
|
|
17
|
-
confirm() { this.accepted.emit(); this.visible.set(false); }
|
|
18
|
-
reject() { this.rejected.emit(); this.visible.set(false); }
|
|
19
96
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbConfirmPopup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
20
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbConfirmPopup, isStandalone: true, selector: "cb-confirm-popup", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, acceptLabel: { classPropertyName: "acceptLabel", publicName: "acceptLabel", isSignal: true, isRequired: false, transformFunction: null }, rejectLabel: { classPropertyName: "rejectLabel", publicName: "rejectLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", accepted: "accepted", rejected: "rejected" },
|
|
97
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbConfirmPopup, isStandalone: true, selector: "cb-confirm-popup", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, acceptLabel: { classPropertyName: "acceptLabel", publicName: "acceptLabel", isSignal: true, isRequired: false, transformFunction: null }, rejectLabel: { classPropertyName: "rejectLabel", publicName: "rejectLabel", isSignal: true, isRequired: false, transformFunction: null }, acceptSeverity: { classPropertyName: "acceptSeverity", publicName: "acceptSeverity", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", accepted: "accepted", rejected: "rejected" }, host: { classAttribute: "cb-confirm-popup-host" }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
98
|
+
@if (visible() && !anchored()) {
|
|
99
|
+
<ng-container *ngTemplateOutlet="panel" />
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
<ng-template #panel>
|
|
103
|
+
<section
|
|
104
|
+
class="cb-confirm-popup"
|
|
105
|
+
role="alertdialog"
|
|
106
|
+
aria-modal="false"
|
|
107
|
+
[attr.aria-describedby]="messageId"
|
|
108
|
+
(keydown.escape)="reject()"
|
|
109
|
+
>
|
|
110
|
+
<p class="cb-confirm-popup__message" [id]="messageId">{{ message() ?? t().confirmMessage }}</p>
|
|
111
|
+
<div class="cb-confirm-popup__actions">
|
|
112
|
+
<cb-button size="sm" variant="text" severity="secondary" (click)="reject()">
|
|
113
|
+
{{ rejectLabel() ?? t().cancel }}
|
|
114
|
+
</cb-button>
|
|
115
|
+
<cb-button size="sm" [severity]="acceptSeverity()" (click)="accept()">
|
|
116
|
+
{{ acceptLabel() ?? t().accept }}
|
|
117
|
+
</cb-button>
|
|
118
|
+
</div>
|
|
119
|
+
</section>
|
|
120
|
+
</ng-template>
|
|
121
|
+
`, isInline: true, styles: [":host{display:inline-block}.cb-confirm-popup{min-width:15rem;max-width:22rem;padding:var(--cb-space-4, 1rem);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);background:var(--cb-color-surface-raised);color:var(--cb-color-text);box-shadow:0 .75rem 2rem color-mix(in srgb,#000 18%,transparent)}.cb-confirm-popup__message{margin:0 0 var(--cb-space-3, .75rem);font-size:var(--cb-text-sm, .875rem);line-height:1.5}.cb-confirm-popup__actions{display:flex;justify-content:flex-end;gap:var(--cb-space-2, .5rem)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CbButton, selector: "cb-button", inputs: ["severity", "variant", "size", "disabled", "loading", "fullWidth", "type", "ariaLabel", "ariaHaspopup", "ariaExpanded", "ariaControls"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
21
122
|
}
|
|
22
123
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbConfirmPopup, decorators: [{
|
|
23
124
|
type: Component,
|
|
24
|
-
args: [{ selector: 'cb-confirm-popup',
|
|
25
|
-
|
|
125
|
+
args: [{ selector: 'cb-confirm-popup', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [NgTemplateOutlet, CbButton], host: { class: 'cb-confirm-popup-host' }, template: `
|
|
126
|
+
@if (visible() && !anchored()) {
|
|
127
|
+
<ng-container *ngTemplateOutlet="panel" />
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
<ng-template #panel>
|
|
131
|
+
<section
|
|
132
|
+
class="cb-confirm-popup"
|
|
133
|
+
role="alertdialog"
|
|
134
|
+
aria-modal="false"
|
|
135
|
+
[attr.aria-describedby]="messageId"
|
|
136
|
+
(keydown.escape)="reject()"
|
|
137
|
+
>
|
|
138
|
+
<p class="cb-confirm-popup__message" [id]="messageId">{{ message() ?? t().confirmMessage }}</p>
|
|
139
|
+
<div class="cb-confirm-popup__actions">
|
|
140
|
+
<cb-button size="sm" variant="text" severity="secondary" (click)="reject()">
|
|
141
|
+
{{ rejectLabel() ?? t().cancel }}
|
|
142
|
+
</cb-button>
|
|
143
|
+
<cb-button size="sm" [severity]="acceptSeverity()" (click)="accept()">
|
|
144
|
+
{{ acceptLabel() ?? t().accept }}
|
|
145
|
+
</cb-button>
|
|
146
|
+
</div>
|
|
147
|
+
</section>
|
|
148
|
+
</ng-template>
|
|
149
|
+
`, styles: [":host{display:inline-block}.cb-confirm-popup{min-width:15rem;max-width:22rem;padding:var(--cb-space-4, 1rem);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);background:var(--cb-color-surface-raised);color:var(--cb-color-text);box-shadow:0 .75rem 2rem color-mix(in srgb,#000 18%,transparent)}.cb-confirm-popup__message{margin:0 0 var(--cb-space-3, .75rem);font-size:var(--cb-text-sm, .875rem);line-height:1.5}.cb-confirm-popup__actions{display:flex;justify-content:flex-end;gap:var(--cb-space-2, .5rem)}\n"] }]
|
|
150
|
+
}], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: false }] }], acceptLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "acceptLabel", required: false }] }], rejectLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "rejectLabel", required: false }] }], acceptSeverity: [{ type: i0.Input, args: [{ isSignal: true, alias: "acceptSeverity", required: false }] }], accepted: [{ type: i0.Output, args: ["accepted"] }], rejected: [{ type: i0.Output, args: ["rejected"] }], panel: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }] } });
|
|
26
151
|
|
|
27
152
|
/**
|
|
28
153
|
* Generated bundle index. Do not edit.
|
|
@@ -3,16 +3,19 @@ import { inject, ViewContainerRef, DestroyRef, input, output, viewChild, ViewEnc
|
|
|
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 } from '@caribeng/ui';
|
|
6
7
|
|
|
7
8
|
/** Context menu that opens at the pointer position on right click. */
|
|
8
9
|
class CbContextMenu {
|
|
9
10
|
constructor() {
|
|
11
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
12
|
+
this.t = injectCbTranslation();
|
|
10
13
|
this.overlay = inject(Overlay);
|
|
11
14
|
this.vcr = inject(ViewContainerRef);
|
|
12
15
|
this.destroyRef = inject(DestroyRef);
|
|
13
16
|
this.items = input([], /* @ts-ignore */
|
|
14
17
|
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
15
|
-
this.ariaLabel = input(
|
|
18
|
+
this.ariaLabel = input(undefined, /* @ts-ignore */
|
|
16
19
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
17
20
|
this.itemSelect = output();
|
|
18
21
|
this.content = viewChild.required('content');
|
|
@@ -66,7 +69,7 @@ class CbContextMenu {
|
|
|
66
69
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbContextMenu, isStandalone: true, selector: "cb-contextmenu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, host: { listeners: { "contextmenu": "open($event)" }, classAttribute: "cb-contextmenu" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
67
70
|
<ng-content />
|
|
68
71
|
<ng-template #content>
|
|
69
|
-
<div class="cb-contextmenu__panel" role="menu" [attr.aria-label]="ariaLabel()">
|
|
72
|
+
<div class="cb-contextmenu__panel" role="menu" [attr.aria-label]="(ariaLabel() ?? t().contextMenu)">
|
|
70
73
|
@for (item of items(); track $index) {
|
|
71
74
|
@if (item.separator) { <div class="cb-contextmenu__separator" role="separator"></div> }
|
|
72
75
|
@else {
|
|
@@ -85,7 +88,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
85
88
|
args: [{ selector: 'cb-contextmenu', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbIcon], host: { class: 'cb-contextmenu', '(contextmenu)': 'open($event)' }, template: `
|
|
86
89
|
<ng-content />
|
|
87
90
|
<ng-template #content>
|
|
88
|
-
<div class="cb-contextmenu__panel" role="menu" [attr.aria-label]="ariaLabel()">
|
|
91
|
+
<div class="cb-contextmenu__panel" role="menu" [attr.aria-label]="(ariaLabel() ?? t().contextMenu)">
|
|
89
92
|
@for (item of items(); track $index) {
|
|
90
93
|
@if (item.separator) { <div class="cb-contextmenu__separator" role="separator"></div> }
|
|
91
94
|
@else {
|