@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,34 +1,271 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { model, signal, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { inject, TemplateRef, Directive, ElementRef, model, input, output, contentChild, signal, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
5
|
+
import { CbIcon } from '@caribeng/ui/icon';
|
|
3
6
|
|
|
7
|
+
/** Plantilla de cada elemento de un `<cb-picklist>`. */
|
|
8
|
+
class CbPickListItemTemplate {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.template = inject(TemplateRef);
|
|
11
|
+
}
|
|
12
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbPickListItemTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
16
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: CbPickListItemTemplate, isStandalone: true, selector: "ng-template[cbPickListItem]", ngImport: i0 }); }
|
|
17
|
+
}
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbPickListItemTemplate, decorators: [{
|
|
19
|
+
type: Directive,
|
|
20
|
+
args: [{ selector: 'ng-template[cbPickListItem]' }]
|
|
21
|
+
}] });
|
|
22
|
+
let nextUid = 0;
|
|
23
|
+
/**
|
|
24
|
+
* PickList de CaribeNG: transfiere elementos entre una lista de disponibles y
|
|
25
|
+
* otra de seleccionados, con botones, doble clic o teclado (Espacio marca,
|
|
26
|
+
* Enter transfiere).
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```html
|
|
30
|
+
* <cb-picklist [(source)]="disponibles" [(target)]="asignados" sourceHeader="Permisos" targetHeader="Asignados">
|
|
31
|
+
* <ng-template cbPickListItem let-permiso>{{ permiso.nombre }}</ng-template>
|
|
32
|
+
* </cb-picklist>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
4
35
|
class CbPickList {
|
|
5
36
|
constructor() {
|
|
37
|
+
this.t = injectCbTranslation();
|
|
38
|
+
this.host = inject(ElementRef);
|
|
39
|
+
this.uid = `cb-picklist-${++nextUid}`;
|
|
40
|
+
/** Elementos disponibles (two-way). */
|
|
6
41
|
this.source = model([], /* @ts-ignore */
|
|
7
42
|
...(ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []));
|
|
43
|
+
/** Elementos seleccionados (two-way). */
|
|
8
44
|
this.target = model([], /* @ts-ignore */
|
|
9
45
|
...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
|
|
10
|
-
|
|
46
|
+
/** Título de la lista de origen. Por defecto, "Disponibles" del idioma activo. */
|
|
47
|
+
this.sourceHeader = input(undefined, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "sourceHeader" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/** Título de la lista de destino. Por defecto, "Seleccionados" del idioma activo. */
|
|
50
|
+
this.targetHeader = input(undefined, /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "targetHeader" }] : /* istanbul ignore next */ []));
|
|
52
|
+
/** Se emite tras transferir elementos. */
|
|
53
|
+
this.moved = output();
|
|
54
|
+
this.itemTemplate = contentChild(CbPickListItemTemplate, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
56
|
+
/** Posiciones marcadas en cada lista. */
|
|
57
|
+
this.selected = signal({ source: new Set(), target: new Set() }, /* @ts-ignore */
|
|
11
58
|
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
59
|
+
this.focused = signal({ source: 0, target: 0 }, /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []));
|
|
61
|
+
}
|
|
62
|
+
headerId(side) {
|
|
63
|
+
return `${this.uid}-${side}`;
|
|
64
|
+
}
|
|
65
|
+
isSelected(side, index) {
|
|
66
|
+
return this.selected()[side].has(index);
|
|
67
|
+
}
|
|
68
|
+
tabbable(side) {
|
|
69
|
+
const max = this.list(side).length - 1;
|
|
70
|
+
return Math.max(0, Math.min(this.focused()[side], max));
|
|
71
|
+
}
|
|
72
|
+
setFocused(side, index) {
|
|
73
|
+
this.focused.update((f) => ({ ...f, [side]: index }));
|
|
74
|
+
}
|
|
75
|
+
toggle(side, index) {
|
|
76
|
+
const next = new Set(this.selected()[side]);
|
|
77
|
+
if (next.has(index))
|
|
78
|
+
next.delete(index);
|
|
79
|
+
else
|
|
80
|
+
next.add(index);
|
|
81
|
+
this.selected.update((s) => ({ ...s, [side]: next }));
|
|
82
|
+
this.setFocused(side, index);
|
|
12
83
|
}
|
|
13
|
-
|
|
14
|
-
move(
|
|
15
|
-
|
|
16
|
-
this.
|
|
84
|
+
/** Transfiere los elementos marcados al lado indicado. */
|
|
85
|
+
move(to) {
|
|
86
|
+
const from = to === 'target' ? 'source' : 'target';
|
|
87
|
+
this.transfer(from, [...this.selected()[from]].sort((a, b) => a - b));
|
|
88
|
+
}
|
|
89
|
+
/** Transfiere todos los elementos al lado indicado. */
|
|
90
|
+
moveAll(to) {
|
|
91
|
+
const from = to === 'target' ? 'source' : 'target';
|
|
92
|
+
this.transfer(from, this.list(from).map((_, i) => i));
|
|
93
|
+
}
|
|
94
|
+
/** Transfiere un único elemento al otro lado (doble clic). */
|
|
95
|
+
moveOne(from, index) {
|
|
96
|
+
this.transfer(from, [index]);
|
|
97
|
+
}
|
|
98
|
+
onKeydown(event, side) {
|
|
99
|
+
const count = this.list(side).length;
|
|
100
|
+
if (!count)
|
|
101
|
+
return;
|
|
102
|
+
const current = this.tabbable(side);
|
|
103
|
+
let target = -1;
|
|
104
|
+
switch (event.key) {
|
|
105
|
+
case 'ArrowDown':
|
|
106
|
+
target = Math.min(count - 1, current + 1);
|
|
107
|
+
break;
|
|
108
|
+
case 'ArrowUp':
|
|
109
|
+
target = Math.max(0, current - 1);
|
|
110
|
+
break;
|
|
111
|
+
case 'Home':
|
|
112
|
+
target = 0;
|
|
113
|
+
break;
|
|
114
|
+
case 'End':
|
|
115
|
+
target = count - 1;
|
|
116
|
+
break;
|
|
117
|
+
case ' ':
|
|
118
|
+
this.toggle(side, current);
|
|
119
|
+
break;
|
|
120
|
+
case 'Enter':
|
|
121
|
+
// Transfiere los marcados; si no hay ninguno, el enfocado.
|
|
122
|
+
if (this.selected()[side].size)
|
|
123
|
+
this.move(side === 'source' ? 'target' : 'source');
|
|
124
|
+
else
|
|
125
|
+
this.moveOne(side, current);
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
if (target >= 0) {
|
|
132
|
+
this.setFocused(side, target);
|
|
133
|
+
this.host.nativeElement
|
|
134
|
+
.querySelectorAll(`[data-side="${side}"] [role="option"]`)[target]?.focus();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
list(side) {
|
|
138
|
+
return side === 'source' ? this.source() : this.target();
|
|
139
|
+
}
|
|
140
|
+
transfer(from, indices) {
|
|
141
|
+
if (!indices.length)
|
|
142
|
+
return;
|
|
143
|
+
const to = from === 'source' ? 'target' : 'source';
|
|
144
|
+
const picked = new Set(indices);
|
|
145
|
+
const items = this.list(from).filter((_, i) => picked.has(i));
|
|
146
|
+
const remaining = this.list(from).filter((_, i) => !picked.has(i));
|
|
147
|
+
const destination = [...this.list(to), ...items];
|
|
148
|
+
(from === 'source' ? this.source : this.target).set(remaining);
|
|
149
|
+
(to === 'source' ? this.source : this.target).set(destination);
|
|
150
|
+
this.selected.set({ source: new Set(), target: new Set() });
|
|
151
|
+
this.moved.emit({ to, items });
|
|
17
152
|
}
|
|
18
|
-
else {
|
|
19
|
-
this.target.set(this.target().filter(x => !this.selected().has(x)));
|
|
20
|
-
this.source.set([...this.source(), ...moving]);
|
|
21
|
-
} this.selected.set(new Set()); }
|
|
22
153
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbPickList, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
23
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbPickList, isStandalone: true, selector: "cb-picklist", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }
|
|
154
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbPickList, isStandalone: true, selector: "cb-picklist", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, sourceHeader: { classPropertyName: "sourceHeader", publicName: "sourceHeader", isSignal: true, isRequired: false, transformFunction: null }, targetHeader: { classPropertyName: "targetHeader", publicName: "targetHeader", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { source: "sourceChange", target: "targetChange", moved: "moved" }, host: { classAttribute: "cb-picklist-host" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: CbPickListItemTemplate, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
155
|
+
<div class="cb-picklist">
|
|
156
|
+
<ng-container *ngTemplateOutlet="listTpl; context: { side: 'source', items: source(), header: sourceHeader() ?? t().available }" />
|
|
157
|
+
|
|
158
|
+
<div class="cb-picklist__controls">
|
|
159
|
+
<button type="button" class="cb-picklist__btn" [attr.aria-label]="t().moveToTarget" [disabled]="!selected().source.size" (click)="move('target')">
|
|
160
|
+
<cb-icon name="chevron-right" [size]="16" aria-hidden="true" />
|
|
161
|
+
</button>
|
|
162
|
+
<button type="button" class="cb-picklist__btn" [attr.aria-label]="t().moveAllToTarget" [disabled]="!source().length" (click)="moveAll('target')">
|
|
163
|
+
<cb-icon name="chevrons-right" [size]="16" aria-hidden="true" />
|
|
164
|
+
</button>
|
|
165
|
+
<button type="button" class="cb-picklist__btn" [attr.aria-label]="t().moveToSource" [disabled]="!selected().target.size" (click)="move('source')">
|
|
166
|
+
<cb-icon name="chevron-left" [size]="16" aria-hidden="true" />
|
|
167
|
+
</button>
|
|
168
|
+
<button type="button" class="cb-picklist__btn" [attr.aria-label]="t().moveAllToSource" [disabled]="!target().length" (click)="moveAll('source')">
|
|
169
|
+
<cb-icon name="chevrons-left" [size]="16" aria-hidden="true" />
|
|
170
|
+
</button>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<ng-container *ngTemplateOutlet="listTpl; context: { side: 'target', items: target(), header: targetHeader() ?? t().selected }" />
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<ng-template #listTpl let-side="side" let-items="items" let-header="header">
|
|
177
|
+
<section class="cb-picklist__panel">
|
|
178
|
+
<div class="cb-picklist__header" [id]="headerId(side)">{{ header }}</div>
|
|
179
|
+
<ul
|
|
180
|
+
class="cb-picklist__list"
|
|
181
|
+
role="listbox"
|
|
182
|
+
aria-multiselectable="true"
|
|
183
|
+
[attr.aria-labelledby]="headerId(side)"
|
|
184
|
+
[attr.data-side]="side"
|
|
185
|
+
(keydown)="onKeydown($event, side)"
|
|
186
|
+
>
|
|
187
|
+
@for (item of items; track $index; let i = $index) {
|
|
188
|
+
<li
|
|
189
|
+
class="cb-picklist__item"
|
|
190
|
+
role="option"
|
|
191
|
+
[attr.aria-selected]="isSelected(side, i)"
|
|
192
|
+
[attr.tabindex]="i === tabbable(side) ? 0 : -1"
|
|
193
|
+
(focus)="setFocused(side, i)"
|
|
194
|
+
(click)="toggle(side, i)"
|
|
195
|
+
(dblclick)="moveOne(side, i)"
|
|
196
|
+
>
|
|
197
|
+
@if (itemTemplate(); as tpl) {
|
|
198
|
+
<ng-container *ngTemplateOutlet="tpl.template; context: { $implicit: item, index: i, list: side }" />
|
|
199
|
+
} @else {
|
|
200
|
+
{{ item }}
|
|
201
|
+
}
|
|
202
|
+
</li>
|
|
203
|
+
}
|
|
204
|
+
</ul>
|
|
205
|
+
</section>
|
|
206
|
+
</ng-template>
|
|
207
|
+
`, isInline: true, styles: [":host{display:block;color:var(--cb-color-text)}.cb-picklist{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:var(--cb-space-3, .75rem);align-items:stretch}.cb-picklist__controls{display:flex;flex-direction:column;justify-content:center;gap:var(--cb-space-2, .5rem)}.cb-picklist__btn{display:inline-flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;padding:0;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem);background:var(--cb-color-surface-raised);color:var(--cb-color-text);cursor:pointer}.cb-picklist__btn:hover:not(:disabled){border-color:var(--cb-color-primary-500);color:var(--cb-color-primary-600)}.cb-picklist__btn:disabled{opacity:.45;cursor:not-allowed}.cb-picklist__btn:focus-visible{outline:2px solid var(--cb-color-focus-ring, var(--cb-color-primary-500));outline-offset:2px}.cb-picklist__panel{display:flex;flex-direction:column;min-width:0;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);background:var(--cb-color-surface-raised);overflow:hidden}.cb-picklist__header{padding:.65rem .85rem;font-weight:var(--cb-font-weight-semibold, 600);border-bottom:1px solid var(--cb-color-border)}.cb-picklist__list{flex:1;height:14rem;margin:0;padding:var(--cb-space-1, .25rem);list-style:none;overflow-y:auto}.cb-picklist__item{padding:.6rem .75rem;border-radius:var(--cb-radius-md, .5rem);cursor:pointer;outline:none;font-size:var(--cb-text-sm, .875rem);-webkit-user-select:none;user-select:none}.cb-picklist__item:hover{background:color-mix(in srgb,var(--cb-color-text) 6%,transparent)}.cb-picklist__item[aria-selected=true]{color:var(--cb-color-primary-700);background:color-mix(in srgb,var(--cb-color-primary-500) 14%,transparent);font-weight:var(--cb-font-weight-medium, 500)}.cb-picklist__item:focus-visible{box-shadow:inset 0 0 0 2px var(--cb-color-focus-ring, var(--cb-color-primary-500))}@media(max-width:640px){.cb-picklist{grid-template-columns:minmax(0,1fr)}.cb-picklist__controls{flex-direction:row;justify-content:center}.cb-picklist__controls cb-icon{transform:rotate(90deg)}}:host-context([data-theme=\"dark\"]) .cb-picklist__item[aria-selected=true]{color:var(--cb-color-primary-300)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
24
208
|
}
|
|
25
209
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbPickList, decorators: [{
|
|
26
210
|
type: Component,
|
|
27
|
-
args: [{ selector: 'cb-picklist',
|
|
28
|
-
|
|
211
|
+
args: [{ selector: 'cb-picklist', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [NgTemplateOutlet, CbIcon], host: { class: 'cb-picklist-host' }, template: `
|
|
212
|
+
<div class="cb-picklist">
|
|
213
|
+
<ng-container *ngTemplateOutlet="listTpl; context: { side: 'source', items: source(), header: sourceHeader() ?? t().available }" />
|
|
214
|
+
|
|
215
|
+
<div class="cb-picklist__controls">
|
|
216
|
+
<button type="button" class="cb-picklist__btn" [attr.aria-label]="t().moveToTarget" [disabled]="!selected().source.size" (click)="move('target')">
|
|
217
|
+
<cb-icon name="chevron-right" [size]="16" aria-hidden="true" />
|
|
218
|
+
</button>
|
|
219
|
+
<button type="button" class="cb-picklist__btn" [attr.aria-label]="t().moveAllToTarget" [disabled]="!source().length" (click)="moveAll('target')">
|
|
220
|
+
<cb-icon name="chevrons-right" [size]="16" aria-hidden="true" />
|
|
221
|
+
</button>
|
|
222
|
+
<button type="button" class="cb-picklist__btn" [attr.aria-label]="t().moveToSource" [disabled]="!selected().target.size" (click)="move('source')">
|
|
223
|
+
<cb-icon name="chevron-left" [size]="16" aria-hidden="true" />
|
|
224
|
+
</button>
|
|
225
|
+
<button type="button" class="cb-picklist__btn" [attr.aria-label]="t().moveAllToSource" [disabled]="!target().length" (click)="moveAll('source')">
|
|
226
|
+
<cb-icon name="chevrons-left" [size]="16" aria-hidden="true" />
|
|
227
|
+
</button>
|
|
228
|
+
</div>
|
|
229
|
+
|
|
230
|
+
<ng-container *ngTemplateOutlet="listTpl; context: { side: 'target', items: target(), header: targetHeader() ?? t().selected }" />
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<ng-template #listTpl let-side="side" let-items="items" let-header="header">
|
|
234
|
+
<section class="cb-picklist__panel">
|
|
235
|
+
<div class="cb-picklist__header" [id]="headerId(side)">{{ header }}</div>
|
|
236
|
+
<ul
|
|
237
|
+
class="cb-picklist__list"
|
|
238
|
+
role="listbox"
|
|
239
|
+
aria-multiselectable="true"
|
|
240
|
+
[attr.aria-labelledby]="headerId(side)"
|
|
241
|
+
[attr.data-side]="side"
|
|
242
|
+
(keydown)="onKeydown($event, side)"
|
|
243
|
+
>
|
|
244
|
+
@for (item of items; track $index; let i = $index) {
|
|
245
|
+
<li
|
|
246
|
+
class="cb-picklist__item"
|
|
247
|
+
role="option"
|
|
248
|
+
[attr.aria-selected]="isSelected(side, i)"
|
|
249
|
+
[attr.tabindex]="i === tabbable(side) ? 0 : -1"
|
|
250
|
+
(focus)="setFocused(side, i)"
|
|
251
|
+
(click)="toggle(side, i)"
|
|
252
|
+
(dblclick)="moveOne(side, i)"
|
|
253
|
+
>
|
|
254
|
+
@if (itemTemplate(); as tpl) {
|
|
255
|
+
<ng-container *ngTemplateOutlet="tpl.template; context: { $implicit: item, index: i, list: side }" />
|
|
256
|
+
} @else {
|
|
257
|
+
{{ item }}
|
|
258
|
+
}
|
|
259
|
+
</li>
|
|
260
|
+
}
|
|
261
|
+
</ul>
|
|
262
|
+
</section>
|
|
263
|
+
</ng-template>
|
|
264
|
+
`, styles: [":host{display:block;color:var(--cb-color-text)}.cb-picklist{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:var(--cb-space-3, .75rem);align-items:stretch}.cb-picklist__controls{display:flex;flex-direction:column;justify-content:center;gap:var(--cb-space-2, .5rem)}.cb-picklist__btn{display:inline-flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;padding:0;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-md, .5rem);background:var(--cb-color-surface-raised);color:var(--cb-color-text);cursor:pointer}.cb-picklist__btn:hover:not(:disabled){border-color:var(--cb-color-primary-500);color:var(--cb-color-primary-600)}.cb-picklist__btn:disabled{opacity:.45;cursor:not-allowed}.cb-picklist__btn:focus-visible{outline:2px solid var(--cb-color-focus-ring, var(--cb-color-primary-500));outline-offset:2px}.cb-picklist__panel{display:flex;flex-direction:column;min-width:0;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, .75rem);background:var(--cb-color-surface-raised);overflow:hidden}.cb-picklist__header{padding:.65rem .85rem;font-weight:var(--cb-font-weight-semibold, 600);border-bottom:1px solid var(--cb-color-border)}.cb-picklist__list{flex:1;height:14rem;margin:0;padding:var(--cb-space-1, .25rem);list-style:none;overflow-y:auto}.cb-picklist__item{padding:.6rem .75rem;border-radius:var(--cb-radius-md, .5rem);cursor:pointer;outline:none;font-size:var(--cb-text-sm, .875rem);-webkit-user-select:none;user-select:none}.cb-picklist__item:hover{background:color-mix(in srgb,var(--cb-color-text) 6%,transparent)}.cb-picklist__item[aria-selected=true]{color:var(--cb-color-primary-700);background:color-mix(in srgb,var(--cb-color-primary-500) 14%,transparent);font-weight:var(--cb-font-weight-medium, 500)}.cb-picklist__item:focus-visible{box-shadow:inset 0 0 0 2px var(--cb-color-focus-ring, var(--cb-color-primary-500))}@media(max-width:640px){.cb-picklist{grid-template-columns:minmax(0,1fr)}.cb-picklist__controls{flex-direction:row;justify-content:center}.cb-picklist__controls cb-icon{transform:rotate(90deg)}}:host-context([data-theme=\"dark\"]) .cb-picklist__item[aria-selected=true]{color:var(--cb-color-primary-300)}\n"] }]
|
|
265
|
+
}], propDecorators: { source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: false }] }, { type: i0.Output, args: ["sourceChange"] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }, { type: i0.Output, args: ["targetChange"] }], sourceHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "sourceHeader", required: false }] }], targetHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "targetHeader", required: false }] }], moved: [{ type: i0.Output, args: ["moved"] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CbPickListItemTemplate), { isSignal: true }] }] } });
|
|
29
266
|
|
|
30
267
|
/**
|
|
31
268
|
* Generated bundle index. Do not edit.
|
|
32
269
|
*/
|
|
33
270
|
|
|
34
|
-
export { CbPickList };
|
|
271
|
+
export { CbPickList, CbPickListItemTemplate };
|
|
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, model, output, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } 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
|
/**
|
|
7
8
|
* Tabla de precios de CaribeNG: selector Mensual/Anual opcional y planes
|
|
@@ -15,6 +16,8 @@ import { CbButton } from '@caribeng/ui/button';
|
|
|
15
16
|
*/
|
|
16
17
|
class CbPricing {
|
|
17
18
|
constructor() {
|
|
19
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
20
|
+
this.t = injectCbTranslation();
|
|
18
21
|
/** Planes a mostrar. */
|
|
19
22
|
this.plans = input([], /* @ts-ignore */
|
|
20
23
|
...(ngDevMode ? [{ debugName: "plans" }] : /* istanbul ignore next */ []));
|
|
@@ -34,16 +37,16 @@ class CbPricing {
|
|
|
34
37
|
this.currency = input('$', /* @ts-ignore */
|
|
35
38
|
...(ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []));
|
|
36
39
|
/** Etiquetas configurables. */
|
|
37
|
-
this.monthlyLabel = input(
|
|
40
|
+
this.monthlyLabel = input(undefined, /* @ts-ignore */
|
|
38
41
|
...(ngDevMode ? [{ debugName: "monthlyLabel" }] : /* istanbul ignore next */ []));
|
|
39
|
-
this.annualLabel = input(
|
|
42
|
+
this.annualLabel = input(undefined, /* @ts-ignore */
|
|
40
43
|
...(ngDevMode ? [{ debugName: "annualLabel" }] : /* istanbul ignore next */ []));
|
|
41
|
-
this.perMonthLabel = input(
|
|
44
|
+
this.perMonthLabel = input(undefined, /* @ts-ignore */
|
|
42
45
|
...(ngDevMode ? [{ debugName: "perMonthLabel" }] : /* istanbul ignore next */ []));
|
|
43
|
-
this.perYearLabel = input(
|
|
46
|
+
this.perYearLabel = input(undefined, /* @ts-ignore */
|
|
44
47
|
...(ngDevMode ? [{ debugName: "perYearLabel" }] : /* istanbul ignore next */ []));
|
|
45
48
|
/** Prefijo del CTA cuando el plan no define `ctaLabel`. */
|
|
46
|
-
this.ctaLabel = input(
|
|
49
|
+
this.ctaLabel = input(undefined, /* @ts-ignore */
|
|
47
50
|
...(ngDevMode ? [{ debugName: "ctaLabel" }] : /* istanbul ignore next */ []));
|
|
48
51
|
/** Emite el plan elegido. */
|
|
49
52
|
this.planSelect = output();
|
|
@@ -78,7 +81,7 @@ class CbPricing {
|
|
|
78
81
|
[class.cb-pricing__toggle-btn--on]="billing() === 'monthly'"
|
|
79
82
|
(click)="billing.set('monthly')"
|
|
80
83
|
>
|
|
81
|
-
{{ monthlyLabel() }}
|
|
84
|
+
{{ (monthlyLabel() ?? t().monthly) }}
|
|
82
85
|
</button>
|
|
83
86
|
<button
|
|
84
87
|
type="button"
|
|
@@ -86,7 +89,7 @@ class CbPricing {
|
|
|
86
89
|
[class.cb-pricing__toggle-btn--on]="billing() === 'annual'"
|
|
87
90
|
(click)="billing.set('annual')"
|
|
88
91
|
>
|
|
89
|
-
{{ annualLabel() }}
|
|
92
|
+
{{ (annualLabel() ?? t().yearly) }}
|
|
90
93
|
</button>
|
|
91
94
|
</div>
|
|
92
95
|
</div>
|
|
@@ -100,7 +103,7 @@ class CbPricing {
|
|
|
100
103
|
<div class="cb-pricing__price-row">
|
|
101
104
|
<div class="cb-pricing__price">
|
|
102
105
|
<strong>{{ currency() }}{{ priceOf(p) }}</strong>
|
|
103
|
-
<span class="cb-pricing__per">{{ billing() === 'annual' ? perYearLabel() : perMonthLabel() }}</span>
|
|
106
|
+
<span class="cb-pricing__per">{{ billing() === 'annual' ? (perYearLabel() ?? t().perYear) : (perMonthLabel() ?? t().perMonth) }}</span>
|
|
104
107
|
</div>
|
|
105
108
|
@if (oldPriceOf(p); as old) {
|
|
106
109
|
<span class="cb-pricing__old">{{ currency() }}{{ old }}</span>
|
|
@@ -128,12 +131,12 @@ class CbPricing {
|
|
|
128
131
|
[variant]="p.featured ? 'solid' : 'outlined'"
|
|
129
132
|
(click)="planSelect.emit(p)"
|
|
130
133
|
>
|
|
131
|
-
{{ p.ctaLabel || ctaLabel() + ' ' + p.name }}
|
|
134
|
+
{{ p.ctaLabel || (ctaLabel() ?? t().choose) + ' ' + p.name }}
|
|
132
135
|
</cb-button>
|
|
133
136
|
</div>
|
|
134
137
|
}
|
|
135
138
|
</div>
|
|
136
|
-
`, isInline: true, styles: [":host{display:block;font-family:var(--cb-font-sans);color:var(--cb-color-text)}.cb-pricing__title{max-width:30rem;margin:0 auto 1.75rem;text-align:center;font-size:1.4rem;line-height:1.3}.cb-pricing__toggle-wrap{display:flex;justify-content:center;margin-bottom:2rem}.cb-pricing__toggle{position:relative;display:inline-flex;padding:4px;border-radius:999px;background:var(--cb-color-surface-hover, rgba(0, 0, 0, .06))}.cb-pricing__toggle-thumb{position:absolute;top:4px;left:4px;width:110px;height:calc(100% - 8px);border-radius:999px;background:var(--cb-color-surface-raised, #fff);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .1));transition:transform .2s ease}.cb-pricing__toggle--annual .cb-pricing__toggle-thumb{transform:translate(110px)}.cb-pricing__toggle-btn{position:relative;z-index:1;width:110px;height:40px;border:0;background:transparent;color:var(--cb-color-text-muted);font:inherit;font-weight:500;cursor:pointer}.cb-pricing__toggle-btn--on{color:var(--cb-color-text)}.cb-pricing__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:var(--cb-space-4, 1rem);align-items:start}.cb-pricing__plan{display:flex;flex-direction:column;padding:1.5rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, 16px);background:var(--cb-color-surface)}.cb-pricing__plan--featured{background:var(--cb-color-primary-600, #059669);border-color:var(--cb-color-primary-600, #059669);color:#fff}.cb-pricing__plan-name{font-weight:600;font-size:1.1rem;margin-bottom:.75rem}.cb-pricing__price-row{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.cb-pricing__price{display:flex;align-items:flex-end;gap:.25rem}.cb-pricing__price strong{font-size:1.9rem;line-height:1}.cb-pricing__per{font-size:.85rem;opacity:.7;margin-bottom:.2rem}.cb-pricing__old{font-size:1.1rem;font-weight:600;text-decoration:line-through;opacity:.45}.cb-pricing__desc{margin:.5rem 0 0;font-size:.85rem;opacity:.8}.cb-pricing__divider{height:1px;margin:1.25rem 0;background:currentColor;opacity:.15}.cb-pricing__features{flex:1;margin:0 0 1.5rem;padding:0;list-style:none;display:flex;flex-direction:column;gap:.65rem}.cb-pricing__features li{display:flex;align-items:center;gap:.6rem;font-size:.875rem}.cb-pricing__feature--off{opacity:.5}.cb-pricing__check{color:var(--cb-color-success-500, #22c55e);flex:none}.cb-pricing__feature--off .cb-pricing__check{color:var(--cb-color-text-muted)}.cb-pricing__plan--featured .cb-pricing__check{color:#fff}:host(.cb-pricing--horizontal) .cb-pricing__grid{grid-template-columns:1fr}:host(.cb-pricing--horizontal) .cb-pricing__plan{flex-direction:row;align-items:center;gap:1.75rem}:host(.cb-pricing--horizontal) .cb-pricing__head{flex:0 0 210px}:host(.cb-pricing--horizontal) .cb-pricing__plan-name{margin-bottom:.5rem}:host(.cb-pricing--horizontal) .cb-pricing__divider{display:none}:host(.cb-pricing--horizontal) .cb-pricing__features{flex:1;margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem 1.25rem}:host(.cb-pricing--horizontal) .cb-pricing__cta{flex:0 0 170px;align-self:center}@media(max-width:720px){:host(.cb-pricing--horizontal) .cb-pricing__plan{flex-direction:column;align-items:stretch;gap:1rem}:host(.cb-pricing--horizontal) .cb-pricing__head{flex:none}:host(.cb-pricing--horizontal) .cb-pricing__features{grid-template-columns:1fr}:host(.cb-pricing--horizontal) .cb-pricing__cta{flex: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 }); }
|
|
139
|
+
`, isInline: true, styles: [":host{display:block;font-family:var(--cb-font-sans);color:var(--cb-color-text)}.cb-pricing__title{max-width:30rem;margin:0 auto 1.75rem;text-align:center;font-size:1.4rem;line-height:1.3}.cb-pricing__toggle-wrap{display:flex;justify-content:center;margin-bottom:2rem}.cb-pricing__toggle{position:relative;display:inline-flex;padding:4px;border-radius:999px;background:var(--cb-color-surface-hover, rgba(0, 0, 0, .06))}.cb-pricing__toggle-thumb{position:absolute;top:4px;left:4px;width:110px;height:calc(100% - 8px);border-radius:999px;background:var(--cb-color-surface-raised, #fff);box-shadow:var(--cb-shadow-sm, 0 1px 3px rgba(0, 0, 0, .1));transition:transform .2s ease}.cb-pricing__toggle--annual .cb-pricing__toggle-thumb{transform:translate(110px)}.cb-pricing__toggle-btn{position:relative;z-index:1;width:110px;height:40px;border:0;background:transparent;color:var(--cb-color-text-muted);font:inherit;font-weight:500;cursor:pointer}.cb-pricing__toggle-btn--on{color:var(--cb-color-text)}.cb-pricing__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:var(--cb-space-4, 1rem);align-items:start}.cb-pricing__plan{display:flex;flex-direction:column;padding:1.5rem;border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-lg, 16px);background:var(--cb-color-surface)}.cb-pricing__plan--featured{background:var(--cb-color-primary-600, #059669);border-color:var(--cb-color-primary-600, #059669);color:#fff}.cb-pricing__plan-name{font-weight:600;font-size:1.1rem;margin-bottom:.75rem}.cb-pricing__price-row{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.cb-pricing__price{display:flex;align-items:flex-end;gap:.25rem}.cb-pricing__price strong{font-size:1.9rem;line-height:1}.cb-pricing__per{font-size:.85rem;opacity:.7;margin-bottom:.2rem}.cb-pricing__old{font-size:1.1rem;font-weight:600;text-decoration:line-through;opacity:.45}.cb-pricing__desc{margin:.5rem 0 0;font-size:.85rem;opacity:.8}.cb-pricing__divider{height:1px;margin:1.25rem 0;background:currentColor;opacity:.15}.cb-pricing__features{flex:1;margin:0 0 1.5rem;padding:0;list-style:none;display:flex;flex-direction:column;gap:.65rem}.cb-pricing__features li{display:flex;align-items:center;gap:.6rem;font-size:.875rem}.cb-pricing__feature--off{opacity:.5}.cb-pricing__check{color:var(--cb-color-success-500, #22c55e);flex:none}.cb-pricing__feature--off .cb-pricing__check{color:var(--cb-color-text-muted)}.cb-pricing__plan--featured .cb-pricing__check{color:#fff}:host(.cb-pricing--horizontal) .cb-pricing__grid{grid-template-columns:1fr}:host(.cb-pricing--horizontal) .cb-pricing__plan{flex-direction:row;align-items:center;gap:1.75rem}:host(.cb-pricing--horizontal) .cb-pricing__head{flex:0 0 210px}:host(.cb-pricing--horizontal) .cb-pricing__plan-name{margin-bottom:.5rem}:host(.cb-pricing--horizontal) .cb-pricing__divider{display:none}:host(.cb-pricing--horizontal) .cb-pricing__features{flex:1;margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem 1.25rem}:host(.cb-pricing--horizontal) .cb-pricing__cta{flex:0 0 170px;align-self:center}@media(max-width:720px){:host(.cb-pricing--horizontal) .cb-pricing__plan{flex-direction:column;align-items:stretch;gap:1rem}:host(.cb-pricing--horizontal) .cb-pricing__head{flex:none}:host(.cb-pricing--horizontal) .cb-pricing__features{grid-template-columns:1fr}:host(.cb-pricing--horizontal) .cb-pricing__cta{flex: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 }); }
|
|
137
140
|
}
|
|
138
141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbPricing, decorators: [{
|
|
139
142
|
type: Component,
|
|
@@ -155,7 +158,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
155
158
|
[class.cb-pricing__toggle-btn--on]="billing() === 'monthly'"
|
|
156
159
|
(click)="billing.set('monthly')"
|
|
157
160
|
>
|
|
158
|
-
{{ monthlyLabel() }}
|
|
161
|
+
{{ (monthlyLabel() ?? t().monthly) }}
|
|
159
162
|
</button>
|
|
160
163
|
<button
|
|
161
164
|
type="button"
|
|
@@ -163,7 +166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
163
166
|
[class.cb-pricing__toggle-btn--on]="billing() === 'annual'"
|
|
164
167
|
(click)="billing.set('annual')"
|
|
165
168
|
>
|
|
166
|
-
{{ annualLabel() }}
|
|
169
|
+
{{ (annualLabel() ?? t().yearly) }}
|
|
167
170
|
</button>
|
|
168
171
|
</div>
|
|
169
172
|
</div>
|
|
@@ -177,7 +180,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
177
180
|
<div class="cb-pricing__price-row">
|
|
178
181
|
<div class="cb-pricing__price">
|
|
179
182
|
<strong>{{ currency() }}{{ priceOf(p) }}</strong>
|
|
180
|
-
<span class="cb-pricing__per">{{ billing() === 'annual' ? perYearLabel() : perMonthLabel() }}</span>
|
|
183
|
+
<span class="cb-pricing__per">{{ billing() === 'annual' ? (perYearLabel() ?? t().perYear) : (perMonthLabel() ?? t().perMonth) }}</span>
|
|
181
184
|
</div>
|
|
182
185
|
@if (oldPriceOf(p); as old) {
|
|
183
186
|
<span class="cb-pricing__old">{{ currency() }}{{ old }}</span>
|
|
@@ -205,7 +208,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
205
208
|
[variant]="p.featured ? 'solid' : 'outlined'"
|
|
206
209
|
(click)="planSelect.emit(p)"
|
|
207
210
|
>
|
|
208
|
-
{{ p.ctaLabel || ctaLabel() + ' ' + p.name }}
|
|
211
|
+
{{ p.ctaLabel || (ctaLabel() ?? t().choose) + ' ' + p.name }}
|
|
209
212
|
</cb-button>
|
|
210
213
|
</div>
|
|
211
214
|
}
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { model, input, output, 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 CbRating {
|
|
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
|
/** Valor seleccionado (two-way opcional fuera de Angular Forms). */
|
|
20
24
|
this.value = model(0, /* @ts-ignore */
|
|
21
25
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
@@ -126,7 +130,7 @@ class CbRating {
|
|
|
126
130
|
class="cb-rating__star"
|
|
127
131
|
[class]="'cb-rating__star--' + size()"
|
|
128
132
|
[class.cb-rating__star--on]="i <= display()"
|
|
129
|
-
[attr.aria-label]="i
|
|
133
|
+
[attr.aria-label]="fmt(t().ratingOf, i, stars())"
|
|
130
134
|
tabindex="-1"
|
|
131
135
|
[disabled]="isDisabled() || readonly()"
|
|
132
136
|
(click)="pick(i)"
|
|
@@ -162,7 +166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
162
166
|
class="cb-rating__star"
|
|
163
167
|
[class]="'cb-rating__star--' + size()"
|
|
164
168
|
[class.cb-rating__star--on]="i <= display()"
|
|
165
|
-
[attr.aria-label]="i
|
|
169
|
+
[attr.aria-label]="fmt(t().ratingOf, i, stars())"
|
|
166
170
|
tabindex="-1"
|
|
167
171
|
[disabled]="isDisabled() || readonly()"
|
|
168
172
|
(click)="pick(i)"
|