@caribeng/ui 22.1.1 → 22.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -8
- package/fesm2022/caribeng-ui-accordion.mjs +2 -2
- package/fesm2022/caribeng-ui-anchor.mjs +169 -0
- package/fesm2022/caribeng-ui-autocomplete.mjs +10 -8
- package/fesm2022/caribeng-ui-avatargroup.mjs +9 -3
- package/fesm2022/caribeng-ui-blockui.mjs +12 -4
- package/fesm2022/caribeng-ui-breadcrumb.mjs +5 -2
- package/fesm2022/caribeng-ui-button.mjs +22 -2
- package/fesm2022/caribeng-ui-caribe-alert.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-animation-lottie.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-button-group.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-calendar.mjs +11 -6
- package/fesm2022/caribeng-ui-caribe-card-content.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-card-move.mjs +29 -7
- package/fesm2022/caribeng-ui-caribe-card-select.mjs +56 -14
- package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +10 -7
- package/fesm2022/caribeng-ui-caribe-coachmark.mjs +42 -19
- package/fesm2022/caribeng-ui-caribe-data-table.mjs +15 -9
- package/fesm2022/caribeng-ui-caribe-dots-indicator.mjs +38 -5
- package/fesm2022/caribeng-ui-caribe-expansion-panel.mjs +16 -5
- package/fesm2022/caribeng-ui-caribe-fab-menu.mjs +56 -7
- package/fesm2022/caribeng-ui-caribe-file-download.mjs +68 -27
- package/fesm2022/caribeng-ui-caribe-file-select.mjs +22 -17
- package/fesm2022/caribeng-ui-caribe-float-menu.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-footer.mjs +8 -4
- package/fesm2022/caribeng-ui-caribe-header.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-icon-button.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-illustration.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-input-search.mjs +14 -10
- package/fesm2022/caribeng-ui-caribe-input-select.mjs +12 -10
- package/fesm2022/caribeng-ui-caribe-input-token.mjs +61 -11
- package/fesm2022/caribeng-ui-caribe-link.mjs +7 -2
- package/fesm2022/caribeng-ui-caribe-loader.mjs +8 -5
- package/fesm2022/caribeng-ui-caribe-modal.mjs +32 -16
- package/fesm2022/caribeng-ui-caribe-off-canvas.mjs +26 -12
- package/fesm2022/caribeng-ui-caribe-onboarding.mjs +44 -19
- package/fesm2022/caribeng-ui-caribe-pictogram.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-pop-over.mjs +34 -10
- package/fesm2022/caribeng-ui-caribe-preloader.mjs +9 -6
- package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-shortcut.mjs +8 -3
- package/fesm2022/caribeng-ui-caribe-step-indicator.mjs +12 -5
- package/fesm2022/caribeng-ui-caribe-stroke.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-switch.mjs +5 -3
- package/fesm2022/caribeng-ui-caribe-tag-button.mjs +1 -1
- package/fesm2022/caribeng-ui-caribe-tracker.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-transaction-status.mjs +1 -1
- package/fesm2022/caribeng-ui-caribe-voucher.mjs +11 -8
- package/fesm2022/caribeng-ui-carousel.mjs +49 -14
- package/fesm2022/caribeng-ui-cascadeselect.mjs +22 -8
- package/fesm2022/caribeng-ui-chart.mjs +2598 -303
- package/fesm2022/caribeng-ui-chip.mjs +9 -4
- package/fesm2022/caribeng-ui-chips.mjs +9 -5
- package/fesm2022/caribeng-ui-colorpicker.mjs +9 -7
- package/fesm2022/caribeng-ui-confirmdialog.mjs +74 -9
- package/fesm2022/caribeng-ui-confirmpopup.mjs +134 -9
- package/fesm2022/caribeng-ui-contextmenu.mjs +6 -3
- package/fesm2022/caribeng-ui-dataview.mjs +211 -6
- package/fesm2022/caribeng-ui-datepicker.mjs +1630 -393
- package/fesm2022/caribeng-ui-descriptions.mjs +124 -0
- package/fesm2022/caribeng-ui-dialog.mjs +10 -7
- package/fesm2022/caribeng-ui-dock.mjs +6 -3
- package/fesm2022/caribeng-ui-drawer.mjs +10 -7
- package/fesm2022/caribeng-ui-dynamicdialog.mjs +210 -6
- package/fesm2022/caribeng-ui-editor.mjs +4392 -243
- package/fesm2022/caribeng-ui-empty.mjs +80 -0
- package/fesm2022/caribeng-ui-file-card.mjs +2 -2
- package/fesm2022/caribeng-ui-fileupload.mjs +96 -19
- package/fesm2022/caribeng-ui-floatlabel.mjs +4 -2
- package/fesm2022/caribeng-ui-folder-card.mjs +10 -3
- package/fesm2022/caribeng-ui-galleria.mjs +76 -45
- package/fesm2022/caribeng-ui-image.mjs +52 -29
- package/fesm2022/caribeng-ui-inplace.mjs +22 -6
- package/fesm2022/caribeng-ui-input-number.mjs +9 -7
- package/fesm2022/caribeng-ui-inputgroup.mjs +2 -2
- package/fesm2022/caribeng-ui-inputmask.mjs +14 -11
- package/fesm2022/caribeng-ui-inputotp.mjs +12 -6
- package/fesm2022/caribeng-ui-keyfilter.mjs +72 -0
- package/fesm2022/caribeng-ui-listbox.mjs +13 -11
- package/fesm2022/caribeng-ui-megamenu.mjs +222 -30
- package/fesm2022/caribeng-ui-menu.mjs +11 -5
- package/fesm2022/caribeng-ui-menubar.mjs +10 -5
- package/fesm2022/caribeng-ui-message.mjs +7 -4
- package/fesm2022/caribeng-ui-metergroup.mjs +29 -11
- package/fesm2022/caribeng-ui-multiselect.mjs +399 -97
- package/fesm2022/caribeng-ui-orderlist.mjs +230 -11
- package/fesm2022/caribeng-ui-organizationchart.mjs +12 -7
- package/fesm2022/caribeng-ui-paginator.mjs +18 -15
- package/fesm2022/caribeng-ui-panel.mjs +5 -2
- package/fesm2022/caribeng-ui-panelmenu.mjs +6 -3
- package/fesm2022/caribeng-ui-password.mjs +8 -6
- package/fesm2022/caribeng-ui-pdfviewer.mjs +1553 -0
- package/fesm2022/caribeng-ui-picklist.mjs +251 -14
- package/fesm2022/caribeng-ui-pricing.mjs +17 -14
- package/fesm2022/caribeng-ui-rating.mjs +7 -3
- package/fesm2022/caribeng-ui-repeater.mjs +223 -0
- package/fesm2022/caribeng-ui-result.mjs +91 -0
- package/fesm2022/caribeng-ui-scrollpanel.mjs +6 -3
- package/fesm2022/caribeng-ui-scrolltop.mjs +6 -3
- package/fesm2022/caribeng-ui-select.mjs +379 -87
- package/fesm2022/caribeng-ui-selectbutton.mjs +2 -2
- package/fesm2022/caribeng-ui-slider.mjs +171 -75
- package/fesm2022/caribeng-ui-speeddial.mjs +7 -4
- package/fesm2022/caribeng-ui-spinner.mjs +5 -2
- package/fesm2022/caribeng-ui-splitbutton.mjs +163 -0
- package/fesm2022/caribeng-ui-splitter.mjs +5 -2
- package/fesm2022/caribeng-ui-statistic.mjs +183 -0
- package/fesm2022/caribeng-ui-stepper.mjs +8 -5
- package/fesm2022/caribeng-ui-steps.mjs +6 -3
- package/fesm2022/caribeng-ui-table.mjs +708 -82
- package/fesm2022/caribeng-ui-tabmenu.mjs +6 -3
- package/fesm2022/caribeng-ui-tag.mjs +2 -2
- package/fesm2022/caribeng-ui-terminal.mjs +45 -9
- package/fesm2022/caribeng-ui-themetoggle.mjs +82 -0
- package/fesm2022/caribeng-ui-tieredmenu.mjs +9 -6
- package/fesm2022/caribeng-ui-timeline.mjs +175 -6
- package/fesm2022/caribeng-ui-toast.mjs +7 -4
- package/fesm2022/caribeng-ui-togglebutton.mjs +8 -6
- package/fesm2022/caribeng-ui-toolbar.mjs +6 -3
- package/fesm2022/caribeng-ui-tree.mjs +302 -6
- package/fesm2022/caribeng-ui-treeselect.mjs +26 -10
- package/fesm2022/caribeng-ui-treetable.mjs +269 -6
- package/fesm2022/caribeng-ui-virtualscroller.mjs +123 -10
- package/fesm2022/caribeng-ui.mjs +829 -6
- package/package.json +53 -3
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.js +125 -0
- package/schematics/ng-add/schema.js +2 -0
- package/schematics/ng-add/schema.json +66 -0
- package/styles/caribeng.css +380 -0
- package/styles/scss/_mixins.scss +46 -0
- package/styles/scss/_overlay.scss +15 -0
- package/styles/scss/_tokens.scss +267 -0
- package/styles/scss/_utilities.scss +73 -0
- package/styles/scss/_variables.scss +33 -0
- package/styles/scss/index.scss +16 -0
- package/types/caribeng-ui-anchor.d.ts +50 -0
- package/types/caribeng-ui-autocomplete.d.ts +4 -2
- package/types/caribeng-ui-avatargroup.d.ts +3 -1
- package/types/caribeng-ui-blockui.d.ts +9 -4
- package/types/caribeng-ui-breadcrumb.d.ts +3 -0
- package/types/caribeng-ui-button.d.ts +9 -1
- package/types/caribeng-ui-caribe-alert.d.ts +3 -0
- package/types/caribeng-ui-caribe-animation-lottie.d.ts +4 -1
- package/types/caribeng-ui-caribe-button-group.d.ts +4 -1
- package/types/caribeng-ui-caribe-calendar.d.ts +5 -1
- package/types/caribeng-ui-caribe-card-content.d.ts +4 -1
- package/types/caribeng-ui-caribe-card-move.d.ts +13 -13
- package/types/caribeng-ui-caribe-card-select.d.ts +10 -1
- package/types/caribeng-ui-caribe-circle-loading.d.ts +4 -1
- package/types/caribeng-ui-caribe-coachmark.d.ts +6 -0
- package/types/caribeng-ui-caribe-data-table.d.ts +7 -2
- package/types/caribeng-ui-caribe-dots-indicator.d.ts +9 -0
- package/types/caribeng-ui-caribe-expansion-panel.d.ts +7 -10
- package/types/caribeng-ui-caribe-fab-menu.d.ts +10 -1
- package/types/caribeng-ui-caribe-file-download.d.ts +8 -10
- package/types/caribeng-ui-caribe-file-select.d.ts +7 -1
- package/types/caribeng-ui-caribe-float-menu.d.ts +4 -1
- package/types/caribeng-ui-caribe-header.d.ts +3 -0
- package/types/caribeng-ui-caribe-icon-button.d.ts +4 -1
- package/types/caribeng-ui-caribe-illustration.d.ts +4 -1
- package/types/caribeng-ui-caribe-inline-alert.d.ts +3 -0
- package/types/caribeng-ui-caribe-input-search.d.ts +4 -2
- package/types/caribeng-ui-caribe-input-select.d.ts +4 -2
- package/types/caribeng-ui-caribe-input-token.d.ts +16 -1
- package/types/caribeng-ui-caribe-link.d.ts +3 -0
- package/types/caribeng-ui-caribe-loader.d.ts +4 -1
- package/types/caribeng-ui-caribe-modal.d.ts +7 -10
- package/types/caribeng-ui-caribe-off-canvas.d.ts +6 -1
- package/types/caribeng-ui-caribe-onboarding.d.ts +6 -0
- package/types/caribeng-ui-caribe-pictogram.d.ts +4 -1
- package/types/caribeng-ui-caribe-pop-over.d.ts +7 -10
- package/types/caribeng-ui-caribe-preloader.d.ts +4 -1
- package/types/caribeng-ui-caribe-progress-bar.d.ts +3 -0
- package/types/caribeng-ui-caribe-shortcut.d.ts +3 -1
- package/types/caribeng-ui-caribe-step-indicator.d.ts +6 -0
- package/types/caribeng-ui-caribe-stroke.d.ts +4 -1
- package/types/caribeng-ui-caribe-switch.d.ts +3 -1
- package/types/caribeng-ui-caribe-tracker.d.ts +3 -0
- package/types/caribeng-ui-caribe-voucher.d.ts +5 -2
- package/types/caribeng-ui-carousel.d.ts +10 -1
- package/types/caribeng-ui-cascadeselect.d.ts +7 -2
- package/types/caribeng-ui-chart.d.ts +469 -44
- package/types/caribeng-ui-chip.d.ts +6 -0
- package/types/caribeng-ui-chips.d.ts +6 -2
- package/types/caribeng-ui-colorpicker.d.ts +3 -1
- package/types/caribeng-ui-confirmdialog.d.ts +25 -6
- package/types/caribeng-ui-confirmpopup.d.ts +37 -5
- package/types/caribeng-ui-contextmenu.d.ts +4 -1
- package/types/caribeng-ui-dataview.d.ts +63 -5
- package/types/caribeng-ui-datepicker.d.ts +186 -21
- package/types/caribeng-ui-descriptions.d.ts +63 -0
- package/types/caribeng-ui-dialog.d.ts +4 -1
- package/types/caribeng-ui-dock.d.ts +4 -1
- package/types/caribeng-ui-drawer.d.ts +4 -1
- package/types/caribeng-ui-dynamicdialog.d.ts +93 -3
- package/types/caribeng-ui-editor.d.ts +486 -13
- package/types/caribeng-ui-empty.d.ts +34 -0
- package/types/caribeng-ui-file-card.d.ts +1 -1
- package/types/caribeng-ui-fileupload.d.ts +27 -4
- package/types/caribeng-ui-folder-card.d.ts +4 -1
- package/types/caribeng-ui-galleria.d.ts +9 -0
- package/types/caribeng-ui-image.d.ts +10 -0
- package/types/caribeng-ui-inplace.d.ts +8 -0
- package/types/caribeng-ui-input-number.d.ts +3 -1
- package/types/caribeng-ui-inputmask.d.ts +5 -0
- package/types/caribeng-ui-inputotp.d.ts +7 -2
- package/types/caribeng-ui-keyfilter.d.ts +30 -0
- package/types/caribeng-ui-listbox.d.ts +5 -3
- package/types/caribeng-ui-megamenu.d.ts +26 -2
- package/types/caribeng-ui-menu.d.ts +7 -2
- package/types/caribeng-ui-menubar.d.ts +5 -1
- package/types/caribeng-ui-message.d.ts +3 -0
- package/types/caribeng-ui-metergroup.d.ts +9 -1
- package/types/caribeng-ui-multiselect.d.ts +71 -10
- package/types/caribeng-ui-orderlist.d.ts +58 -6
- package/types/caribeng-ui-organizationchart.d.ts +7 -1
- package/types/caribeng-ui-paginator.d.ts +3 -0
- package/types/caribeng-ui-panel.d.ts +3 -0
- package/types/caribeng-ui-panelmenu.d.ts +4 -1
- package/types/caribeng-ui-password.d.ts +4 -2
- package/types/caribeng-ui-pdfviewer.d.ts +258 -0
- package/types/caribeng-ui-picklist.d.ts +67 -7
- package/types/caribeng-ui-pricing.d.ts +8 -5
- package/types/caribeng-ui-rating.d.ts +6 -2
- package/types/caribeng-ui-repeater.d.ts +79 -0
- package/types/caribeng-ui-result.d.ts +35 -0
- package/types/caribeng-ui-scrollpanel.d.ts +4 -1
- package/types/caribeng-ui-scrolltop.d.ts +4 -1
- package/types/caribeng-ui-select.d.ts +73 -9
- package/types/caribeng-ui-slider.d.ts +63 -10
- package/types/caribeng-ui-speeddial.d.ts +5 -2
- package/types/caribeng-ui-spinner.d.ts +3 -0
- package/types/caribeng-ui-splitbutton.d.ts +49 -0
- package/types/caribeng-ui-splitter.d.ts +3 -0
- package/types/caribeng-ui-statistic.d.ts +65 -0
- package/types/caribeng-ui-stepper.d.ts +3 -0
- package/types/caribeng-ui-steps.d.ts +4 -1
- package/types/caribeng-ui-table.d.ts +184 -16
- package/types/caribeng-ui-tabmenu.d.ts +4 -1
- package/types/caribeng-ui-terminal.d.ts +10 -0
- package/types/caribeng-ui-themetoggle.d.ts +32 -0
- package/types/caribeng-ui-tieredmenu.d.ts +5 -2
- package/types/caribeng-ui-timeline.d.ts +63 -4
- package/types/caribeng-ui-toast.d.ts +3 -0
- package/types/caribeng-ui-togglebutton.d.ts +5 -3
- package/types/caribeng-ui-toolbar.d.ts +7 -4
- package/types/caribeng-ui-tree.d.ts +76 -4
- package/types/caribeng-ui-treeselect.d.ts +10 -2
- package/types/caribeng-ui-treetable.d.ts +68 -4
- package/types/caribeng-ui-virtualscroller.d.ts +45 -5
- package/types/caribeng-ui.d.ts +501 -12
|
@@ -128,7 +128,7 @@ class CbSelectButton {
|
|
|
128
128
|
{{ labelOf(opt) }}
|
|
129
129
|
</button>
|
|
130
130
|
}
|
|
131
|
-
`, isInline: true, styles: [":host{display:inline-flex;border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);overflow:hidden;font-family:var(--cb-font-sans)}.cb-selectbutton__btn{padding:0 var(--cb-space-4);height:2.5rem;border:none;border-left:var(--cb-border-width) solid var(--cb-color-border);background-color:var(--cb-color-bg);color:var(--cb-color-text);font:inherit;font-weight:var(--cb-font-weight-medium);cursor:pointer;transition:background-color var(--cb-duration-fast) var(--cb-ease),color var(--cb-duration-fast) var(--cb-ease)}.cb-selectbutton__btn:first-child{border-left:none}.cb-selectbutton__btn--sm{height:2.125rem;padding:0 var(--cb-space-3);font-size:var(--cb-text-sm)}.cb-selectbutton__btn--lg{height:2.875rem;padding:0 var(--cb-space-5);font-size:var(--cb-text-lg)}.cb-selectbutton__btn:hover:not(:disabled):not(.cb-is-selected){background-color:var(--cb-color-surface-
|
|
131
|
+
`, isInline: true, styles: [":host{display:inline-flex;border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);overflow:hidden;font-family:var(--cb-font-sans)}.cb-selectbutton__btn{padding:0 var(--cb-space-4);height:2.5rem;border:none;border-left:var(--cb-border-width) solid var(--cb-color-border);background-color:var(--cb-color-bg);color:var(--cb-color-text);font:inherit;font-weight:var(--cb-font-weight-medium);cursor:pointer;transition:background-color var(--cb-duration-fast) var(--cb-ease),color var(--cb-duration-fast) var(--cb-ease)}.cb-selectbutton__btn:first-child{border-left:none}.cb-selectbutton__btn--sm{height:2.125rem;padding:0 var(--cb-space-3);font-size:var(--cb-text-sm)}.cb-selectbutton__btn--lg{height:2.875rem;padding:0 var(--cb-space-5);font-size:var(--cb-text-lg)}.cb-selectbutton__btn:hover:not(:disabled):not(.cb-is-selected){background-color:var(--cb-color-surface-hover)}.cb-selectbutton__btn:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:-2px;z-index:1}.cb-selectbutton__btn.cb-is-selected{background-color:var(--cb-color-primary-500);color:var(--cb-color-primary-contrast)}.cb-selectbutton__btn:disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default}:host(.cb-is-invalid) .cb-selectbutton__btn{border-color:var(--cb-color-danger)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
132
132
|
}
|
|
133
133
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSelectButton, decorators: [{
|
|
134
134
|
type: Component,
|
|
@@ -158,7 +158,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
158
158
|
{{ labelOf(opt) }}
|
|
159
159
|
</button>
|
|
160
160
|
}
|
|
161
|
-
`, styles: [":host{display:inline-flex;border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);overflow:hidden;font-family:var(--cb-font-sans)}.cb-selectbutton__btn{padding:0 var(--cb-space-4);height:2.5rem;border:none;border-left:var(--cb-border-width) solid var(--cb-color-border);background-color:var(--cb-color-bg);color:var(--cb-color-text);font:inherit;font-weight:var(--cb-font-weight-medium);cursor:pointer;transition:background-color var(--cb-duration-fast) var(--cb-ease),color var(--cb-duration-fast) var(--cb-ease)}.cb-selectbutton__btn:first-child{border-left:none}.cb-selectbutton__btn--sm{height:2.125rem;padding:0 var(--cb-space-3);font-size:var(--cb-text-sm)}.cb-selectbutton__btn--lg{height:2.875rem;padding:0 var(--cb-space-5);font-size:var(--cb-text-lg)}.cb-selectbutton__btn:hover:not(:disabled):not(.cb-is-selected){background-color:var(--cb-color-surface-
|
|
161
|
+
`, styles: [":host{display:inline-flex;border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);overflow:hidden;font-family:var(--cb-font-sans)}.cb-selectbutton__btn{padding:0 var(--cb-space-4);height:2.5rem;border:none;border-left:var(--cb-border-width) solid var(--cb-color-border);background-color:var(--cb-color-bg);color:var(--cb-color-text);font:inherit;font-weight:var(--cb-font-weight-medium);cursor:pointer;transition:background-color var(--cb-duration-fast) var(--cb-ease),color var(--cb-duration-fast) var(--cb-ease)}.cb-selectbutton__btn:first-child{border-left:none}.cb-selectbutton__btn--sm{height:2.125rem;padding:0 var(--cb-space-3);font-size:var(--cb-text-sm)}.cb-selectbutton__btn--lg{height:2.875rem;padding:0 var(--cb-space-5);font-size:var(--cb-text-lg)}.cb-selectbutton__btn:hover:not(:disabled):not(.cb-is-selected){background-color:var(--cb-color-surface-hover)}.cb-selectbutton__btn:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:-2px;z-index:1}.cb-selectbutton__btn.cb-is-selected{background-color:var(--cb-color-primary-500);color:var(--cb-color-primary-contrast)}.cb-selectbutton__btn:disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default}:host(.cb-is-invalid) .cb-selectbutton__btn{border-color:var(--cb-color-danger)}\n"] }]
|
|
162
162
|
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], changed: [{ type: i0.Output, args: ["changed"] }] } });
|
|
163
163
|
function toBoolean(value) {
|
|
164
164
|
return value !== false && value != null && `${value}` !== 'false';
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { model, input, output, viewChild, signal, computed, forwardRef, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { model, input, booleanAttribute, output, viewChild, signal, computed, forwardRef, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
-
import { cbFieldState } from '@caribeng/ui';
|
|
4
|
+
import { injectCbTranslation, cbFieldState } from '@caribeng/ui';
|
|
5
5
|
|
|
6
6
|
let nextUid = 0;
|
|
7
7
|
/**
|
|
8
8
|
* Control deslizante (slider) de CaribeNG, integrado con Angular Forms vía
|
|
9
|
-
* `ControlValueAccessor`. Soporta arrastre con puntero y
|
|
9
|
+
* `ControlValueAccessor`. Soporta arrastre con puntero, teclado y un modo de
|
|
10
|
+
* rango con dos tiradores (patrón WAI-ARIA *multi-thumb slider*).
|
|
11
|
+
*
|
|
12
|
+
* - Un valor: `[(value)]` (número).
|
|
13
|
+
* - Rango: `range` + `[(rangeValue)]` (`[mínimo, máximo]`). Con Angular Forms,
|
|
14
|
+
* el control recibe el número o el par según el modo.
|
|
10
15
|
*
|
|
11
16
|
* @example
|
|
12
17
|
* ```html
|
|
13
|
-
* <cb-slider formControlName="volumen" [min]="0" [max]="100" [step]="5" />
|
|
18
|
+
* <cb-slider formControlName="volumen" [min]="0" [max]="100" [step]="5" ariaLabel="Volumen" />
|
|
19
|
+
* <cb-slider range [(rangeValue)]="precio" [min]="0" [max]="2000000" [step]="50000"
|
|
20
|
+
* [valueFormat]="{ style: 'currency', currency: 'COP', maximumFractionDigits: 0 }" showValue ariaLabel="Precio" />
|
|
14
21
|
* ```
|
|
15
22
|
*/
|
|
16
23
|
class CbSlider {
|
|
17
24
|
constructor() {
|
|
25
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
26
|
+
this.t = injectCbTranslation();
|
|
27
|
+
/** Valor en modo de un tirador. */
|
|
18
28
|
this.value = model(0, /* @ts-ignore */
|
|
19
29
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
30
|
+
/** Valor en modo `range`: `[mínimo, máximo]`. */
|
|
31
|
+
this.rangeValue = model([0, 100], /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "rangeValue" }] : /* istanbul ignore next */ []));
|
|
20
33
|
this.min = input(0, /* @ts-ignore */
|
|
21
34
|
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
22
35
|
this.max = input(100, /* @ts-ignore */
|
|
@@ -25,35 +38,74 @@ class CbSlider {
|
|
|
25
38
|
...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
26
39
|
this.size = input('md', /* @ts-ignore */
|
|
27
40
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Dos tiradores para elegir un rango (`[(rangeValue)]`). */
|
|
42
|
+
this.range = input(false, { ...(ngDevMode ? { debugName: "range" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
43
|
+
/** Muestra el valor encima de cada tirador. */
|
|
44
|
+
this.showValue = input(false, { ...(ngDevMode ? { debugName: "showValue" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
45
|
+
/** Formato del valor (texto visible y `aria-valuetext`). */
|
|
46
|
+
this.valueFormat = input(undefined, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
48
|
+
/** Locale BCP 47 del formato (por defecto, el del navegador). */
|
|
49
|
+
this.locale = input(undefined, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
28
51
|
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: toBoolean });
|
|
29
52
|
/** Marca visual y ARIA de estado inválido (también se activa con Angular Forms). */
|
|
30
53
|
this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: toBoolean });
|
|
31
54
|
/** Estado de validación: inputs manuales + estado de Angular Forms. */
|
|
32
55
|
this.fieldState = cbFieldState({ invalid: () => this.invalid() });
|
|
56
|
+
/** Nombre accesible; en modo rango se completa con "Mínimo" / "Máximo". */
|
|
33
57
|
this.ariaLabel = input('', /* @ts-ignore */
|
|
34
58
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
35
59
|
this.inputId = input(`cb-slider-${++nextUid}`, /* @ts-ignore */
|
|
36
60
|
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
61
|
+
/** Valor nuevo (número o rango) cada vez que cambia. */
|
|
37
62
|
this.changed = output();
|
|
63
|
+
this.rangeChanged = output();
|
|
38
64
|
this.track = viewChild.required('track');
|
|
39
|
-
|
|
65
|
+
/** Tirador que se arrastra o se movió por última vez (0 = mínimo, 1 = máximo). */
|
|
66
|
+
this.activeThumb = signal(0, /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "activeThumb" }] : /* istanbul ignore next */ []));
|
|
40
68
|
this.cvaDisabled = signal(false, /* @ts-ignore */
|
|
41
69
|
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
42
70
|
this.isDisabled = computed(() => this.disabled() || this.cvaDisabled(), /* @ts-ignore */
|
|
43
71
|
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
44
|
-
this.
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
72
|
+
this.formatter = computed(() => {
|
|
73
|
+
const vf = this.valueFormat();
|
|
74
|
+
return typeof vf === 'function' ? vf : new Intl.NumberFormat(this.locale(), vf).format;
|
|
75
|
+
}, /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "formatter" }] : /* istanbul ignore next */ []));
|
|
77
|
+
this.lowPercent = computed(() => this.percentOf(this.range() ? this.rangeValue()[0] : this.min()), /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "lowPercent" }] : /* istanbul ignore next */ []));
|
|
79
|
+
this.highPercent = computed(() => this.percentOf(this.range() ? this.rangeValue()[1] : this.value()), /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "highPercent" }] : /* istanbul ignore next */ []));
|
|
81
|
+
/** Datos de cada tirador: en rango, los límites de uno dependen del otro (no se cruzan). */
|
|
82
|
+
this.thumbs = computed(() => {
|
|
83
|
+
const fmt = this.formatter();
|
|
84
|
+
const label = this.ariaLabel();
|
|
85
|
+
if (!this.range()) {
|
|
86
|
+
const v = this.value();
|
|
87
|
+
return [{ index: 0, value: v, min: this.min(), max: this.max(), percent: this.percentOf(v), text: fmt(v), label }];
|
|
88
|
+
}
|
|
89
|
+
const [lo, hi] = this.rangeValue();
|
|
90
|
+
return [
|
|
91
|
+
{ index: 0, value: lo, min: this.min(), max: hi, percent: this.percentOf(lo), text: fmt(lo), label: joinLabel(label, this.t().minimum) },
|
|
92
|
+
{ index: 1, value: hi, min: lo, max: this.max(), percent: this.percentOf(hi), text: fmt(hi), label: joinLabel(label, this.t().maximum) },
|
|
93
|
+
];
|
|
49
94
|
}, /* @ts-ignore */
|
|
50
|
-
...(ngDevMode ? [{ debugName: "
|
|
95
|
+
...(ngDevMode ? [{ debugName: "thumbs" }] : /* istanbul ignore next */ []));
|
|
51
96
|
this.onChange = () => { };
|
|
52
97
|
this.onTouched = () => { };
|
|
53
98
|
}
|
|
54
99
|
// --- ControlValueAccessor --------------------------------------------------
|
|
55
100
|
writeValue(value) {
|
|
56
|
-
|
|
101
|
+
if (Array.isArray(value)) {
|
|
102
|
+
const lo = this.clampSnap(value[0] ?? this.min());
|
|
103
|
+
const hi = this.clampSnap(value[1] ?? this.max());
|
|
104
|
+
this.rangeValue.set([Math.min(lo, hi), Math.max(lo, hi)]);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.value.set(this.clampSnap(typeof value === 'number' ? value : this.min()));
|
|
108
|
+
}
|
|
57
109
|
}
|
|
58
110
|
registerOnChange(fn) {
|
|
59
111
|
this.onChange = fn;
|
|
@@ -69,15 +121,13 @@ class CbSlider {
|
|
|
69
121
|
if (this.isDisabled())
|
|
70
122
|
return;
|
|
71
123
|
event.preventDefault();
|
|
72
|
-
this.dragging = true;
|
|
73
124
|
event.target.setPointerCapture?.(event.pointerId);
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
125
|
+
// En rango se arrastra el tirador más cercano al punto pulsado.
|
|
126
|
+
const thumb = this.range() ? this.nearestThumb(event.clientX) : 0;
|
|
127
|
+
this.activeThumb.set(thumb);
|
|
128
|
+
this.updateFromClientX(event.clientX, thumb);
|
|
129
|
+
const move = (e) => this.updateFromClientX(e.clientX, thumb);
|
|
79
130
|
const up = () => {
|
|
80
|
-
this.dragging = false;
|
|
81
131
|
this.onTouched();
|
|
82
132
|
window.removeEventListener('pointermove', move);
|
|
83
133
|
window.removeEventListener('pointerup', up);
|
|
@@ -85,20 +135,34 @@ class CbSlider {
|
|
|
85
135
|
window.addEventListener('pointermove', move);
|
|
86
136
|
window.addEventListener('pointerup', up);
|
|
87
137
|
}
|
|
88
|
-
|
|
138
|
+
valueAtClientX(clientX) {
|
|
89
139
|
const rect = this.track().nativeElement.getBoundingClientRect();
|
|
90
140
|
if (rect.width <= 0)
|
|
91
|
-
return;
|
|
141
|
+
return null;
|
|
92
142
|
const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
|
|
93
|
-
|
|
94
|
-
|
|
143
|
+
return this.min() + ratio * (this.max() - this.min());
|
|
144
|
+
}
|
|
145
|
+
nearestThumb(clientX) {
|
|
146
|
+
const v = this.valueAtClientX(clientX);
|
|
147
|
+
if (v === null)
|
|
148
|
+
return this.activeThumb();
|
|
149
|
+
const [lo, hi] = this.rangeValue();
|
|
150
|
+
if (lo === hi)
|
|
151
|
+
return v > hi ? 1 : 0;
|
|
152
|
+
return Math.abs(v - lo) <= Math.abs(v - hi) ? 0 : 1;
|
|
153
|
+
}
|
|
154
|
+
updateFromClientX(clientX, thumb) {
|
|
155
|
+
const v = this.valueAtClientX(clientX);
|
|
156
|
+
if (v !== null)
|
|
157
|
+
this.setThumb(thumb, this.clampSnap(v));
|
|
95
158
|
}
|
|
96
159
|
// --- Teclado ---------------------------------------------------------------
|
|
97
|
-
onKeydown(event) {
|
|
160
|
+
onKeydown(event, thumb) {
|
|
98
161
|
if (this.isDisabled())
|
|
99
162
|
return;
|
|
100
163
|
const step = this.step();
|
|
101
|
-
|
|
164
|
+
const current = this.range() ? this.rangeValue()[thumb] : this.value();
|
|
165
|
+
let next = current;
|
|
102
166
|
switch (event.key) {
|
|
103
167
|
case 'ArrowRight':
|
|
104
168
|
case 'ArrowUp':
|
|
@@ -124,9 +188,16 @@ class CbSlider {
|
|
|
124
188
|
return;
|
|
125
189
|
}
|
|
126
190
|
event.preventDefault();
|
|
127
|
-
this.
|
|
191
|
+
this.activeThumb.set(thumb);
|
|
192
|
+
this.setThumb(thumb, this.clampSnap(next));
|
|
128
193
|
}
|
|
129
194
|
// --- Helpers ---------------------------------------------------------------
|
|
195
|
+
percentOf(v) {
|
|
196
|
+
const span = this.max() - this.min();
|
|
197
|
+
if (span <= 0)
|
|
198
|
+
return 0;
|
|
199
|
+
return Math.min(100, Math.max(0, ((v - this.min()) / span) * 100));
|
|
200
|
+
}
|
|
130
201
|
clampSnap(n) {
|
|
131
202
|
const min = this.min();
|
|
132
203
|
const max = this.max();
|
|
@@ -134,43 +205,59 @@ class CbSlider {
|
|
|
134
205
|
const snapped = Math.round((n - min) / step) * step + min;
|
|
135
206
|
return Math.min(max, Math.max(min, Number(snapped.toFixed(10))));
|
|
136
207
|
}
|
|
137
|
-
|
|
138
|
-
|
|
208
|
+
/** Mueve un tirador sin cruzar el otro y avisa del cambio. */
|
|
209
|
+
setThumb(thumb, next) {
|
|
210
|
+
if (!this.range()) {
|
|
211
|
+
if (next === this.value())
|
|
212
|
+
return;
|
|
213
|
+
this.value.set(next);
|
|
214
|
+
this.onChange(next);
|
|
215
|
+
this.changed.emit(next);
|
|
139
216
|
return;
|
|
140
|
-
|
|
141
|
-
this.
|
|
142
|
-
|
|
217
|
+
}
|
|
218
|
+
const [lo, hi] = this.rangeValue();
|
|
219
|
+
const updated = thumb === 0 ? [Math.min(next, hi), hi] : [lo, Math.max(next, lo)];
|
|
220
|
+
if (updated[0] === lo && updated[1] === hi)
|
|
221
|
+
return;
|
|
222
|
+
this.rangeValue.set(updated);
|
|
223
|
+
this.onChange(updated);
|
|
224
|
+
this.rangeChanged.emit(updated);
|
|
143
225
|
}
|
|
144
226
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSlider, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
145
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
227
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbSlider, isStandalone: true, selector: "cb-slider", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, rangeValue: { classPropertyName: "rangeValue", publicName: "rangeValue", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, valueFormat: { classPropertyName: "valueFormat", publicName: "valueFormat", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", rangeValue: "rangeValueChange", changed: "changed", rangeChanged: "rangeChanged" }, host: { properties: { "class.cb-is-invalid": "fieldState.invalid()", "class": "'cb-slider--' + size()", "class.cb-is-disabled": "isDisabled()", "class.cb-slider--with-value": "showValue()" }, classAttribute: "cb-slider" }, providers: [
|
|
146
228
|
{
|
|
147
229
|
provide: NG_VALUE_ACCESSOR,
|
|
148
230
|
useExisting: forwardRef(() => CbSlider),
|
|
149
231
|
multi: true,
|
|
150
232
|
},
|
|
151
233
|
], viewQueries: [{ propertyName: "track", first: true, predicate: ["track"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
152
|
-
<div
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
234
|
+
<div #track class="cb-slider__track" (pointerdown)="onPointerDown($event)">
|
|
235
|
+
<div class="cb-slider__range" [style.left.%]="range() ? lowPercent() : 0" [style.width.%]="range() ? highPercent() - lowPercent() : highPercent()"></div>
|
|
236
|
+
@for (thumb of thumbs(); track thumb.index) {
|
|
237
|
+
<div
|
|
238
|
+
class="cb-slider__thumb"
|
|
239
|
+
[class.cb-is-active]="activeThumb() === thumb.index"
|
|
240
|
+
[style.left.%]="thumb.percent"
|
|
241
|
+
role="slider"
|
|
242
|
+
[attr.aria-invalid]="fieldState.invalid() ? 'true' : null"
|
|
243
|
+
[attr.tabindex]="isDisabled() ? -1 : 0"
|
|
244
|
+
[attr.aria-valuemin]="thumb.min"
|
|
245
|
+
[attr.aria-valuemax]="thumb.max"
|
|
246
|
+
[attr.aria-valuenow]="thumb.value"
|
|
247
|
+
[attr.aria-valuetext]="valueFormat() ? thumb.text : null"
|
|
248
|
+
[attr.aria-label]="thumb.label || null"
|
|
249
|
+
[attr.aria-disabled]="isDisabled() ? 'true' : null"
|
|
250
|
+
(keydown)="onKeydown($event, thumb.index)"
|
|
251
|
+
(focus)="activeThumb.set(thumb.index)"
|
|
252
|
+
(blur)="onTouched()"
|
|
253
|
+
>
|
|
254
|
+
@if (showValue()) {
|
|
255
|
+
<span class="cb-slider__value" aria-hidden="true">{{ thumb.text }}</span>
|
|
256
|
+
}
|
|
257
|
+
</div>
|
|
258
|
+
}
|
|
172
259
|
</div>
|
|
173
|
-
`, isInline: true, styles: [":host{display:block;width:100%;padding:var(--cb-space-2) 0;--_thumb: 1.1rem;--_track-h: .375rem}:host(.cb-slider--sm){--_thumb: .9rem;--_track-h: .3rem}:host(.cb-slider--lg){--_thumb: 1.3rem;--_track-h: .45rem}.cb-slider__track{position:relative;height:var(--_track-h);border-radius:var(--cb-radius-full);background-color:var(--cb-color-
|
|
260
|
+
`, isInline: true, styles: [":host{display:block;width:100%;padding:var(--cb-space-2) 0;--_thumb: 1.1rem;--_track-h: .375rem}:host(.cb-slider--sm){--_thumb: .9rem;--_track-h: .3rem}:host(.cb-slider--lg){--_thumb: 1.3rem;--_track-h: .45rem}.cb-slider__track{position:relative;height:var(--_track-h);border-radius:var(--cb-radius-full);background-color:var(--cb-color-border);cursor:pointer;touch-action:none}.cb-slider__range{position:absolute;left:0;top:0;height:100%;border-radius:var(--cb-radius-full);background-color:var(--cb-color-primary-500)}.cb-slider__thumb{position:absolute;top:50%;width:var(--_thumb);height:var(--_thumb);transform:translate(-50%,-50%);border-radius:var(--cb-radius-full);background-color:var(--cb-color-primary-500);border:2px solid var(--cb-color-bg);box-shadow:var(--cb-shadow-sm);cursor:grab;outline:none;transition:box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-slider__thumb:active{cursor:grabbing}.cb-slider__thumb:focus-visible{box-shadow:0 0 0 4px var(--cb-color-focus-ring)}.cb-slider__thumb.cb-is-active{z-index:1}:host(.cb-slider--with-value){padding-top:2rem}.cb-slider__value{position:absolute;bottom:calc(100% + .4rem);left:50%;padding:.1rem .4rem;font-family:var(--cb-font-sans);font-size:var(--cb-text-xs);font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--cb-color-text);background-color:var(--cb-color-surface-raised);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-sm);transform:translate(-50%);pointer-events:none}:host(.cb-is-disabled){opacity:var(--cb-opacity-disabled, .55)}:host(.cb-is-disabled) .cb-slider__track,:host(.cb-is-disabled) .cb-slider__thumb{cursor:default}:host(.cb-is-invalid) .cb-slider__track{box-shadow:0 0 0 2px var(--cb-color-danger)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
174
261
|
}
|
|
175
262
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSlider, decorators: [{
|
|
176
263
|
type: Component,
|
|
@@ -179,27 +266,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
179
266
|
'[class.cb-is-invalid]': 'fieldState.invalid()',
|
|
180
267
|
'[class]': "'cb-slider--' + size()",
|
|
181
268
|
'[class.cb-is-disabled]': 'isDisabled()',
|
|
269
|
+
'[class.cb-slider--with-value]': 'showValue()',
|
|
182
270
|
}, template: `
|
|
183
|
-
<div
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
271
|
+
<div #track class="cb-slider__track" (pointerdown)="onPointerDown($event)">
|
|
272
|
+
<div class="cb-slider__range" [style.left.%]="range() ? lowPercent() : 0" [style.width.%]="range() ? highPercent() - lowPercent() : highPercent()"></div>
|
|
273
|
+
@for (thumb of thumbs(); track thumb.index) {
|
|
274
|
+
<div
|
|
275
|
+
class="cb-slider__thumb"
|
|
276
|
+
[class.cb-is-active]="activeThumb() === thumb.index"
|
|
277
|
+
[style.left.%]="thumb.percent"
|
|
278
|
+
role="slider"
|
|
279
|
+
[attr.aria-invalid]="fieldState.invalid() ? 'true' : null"
|
|
280
|
+
[attr.tabindex]="isDisabled() ? -1 : 0"
|
|
281
|
+
[attr.aria-valuemin]="thumb.min"
|
|
282
|
+
[attr.aria-valuemax]="thumb.max"
|
|
283
|
+
[attr.aria-valuenow]="thumb.value"
|
|
284
|
+
[attr.aria-valuetext]="valueFormat() ? thumb.text : null"
|
|
285
|
+
[attr.aria-label]="thumb.label || null"
|
|
286
|
+
[attr.aria-disabled]="isDisabled() ? 'true' : null"
|
|
287
|
+
(keydown)="onKeydown($event, thumb.index)"
|
|
288
|
+
(focus)="activeThumb.set(thumb.index)"
|
|
289
|
+
(blur)="onTouched()"
|
|
290
|
+
>
|
|
291
|
+
@if (showValue()) {
|
|
292
|
+
<span class="cb-slider__value" aria-hidden="true">{{ thumb.text }}</span>
|
|
293
|
+
}
|
|
294
|
+
</div>
|
|
295
|
+
}
|
|
203
296
|
</div>
|
|
204
297
|
`, providers: [
|
|
205
298
|
{
|
|
@@ -207,11 +300,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
207
300
|
useExisting: forwardRef(() => CbSlider),
|
|
208
301
|
multi: true,
|
|
209
302
|
},
|
|
210
|
-
], styles: [":host{display:block;width:100%;padding:var(--cb-space-2) 0;--_thumb: 1.1rem;--_track-h: .375rem}:host(.cb-slider--sm){--_thumb: .9rem;--_track-h: .3rem}:host(.cb-slider--lg){--_thumb: 1.3rem;--_track-h: .45rem}.cb-slider__track{position:relative;height:var(--_track-h);border-radius:var(--cb-radius-full);background-color:var(--cb-color-
|
|
211
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], changed: [{ type: i0.Output, args: ["changed"] }], track: [{ type: i0.ViewChild, args: ['track', { isSignal: true }] }] } });
|
|
303
|
+
], styles: [":host{display:block;width:100%;padding:var(--cb-space-2) 0;--_thumb: 1.1rem;--_track-h: .375rem}:host(.cb-slider--sm){--_thumb: .9rem;--_track-h: .3rem}:host(.cb-slider--lg){--_thumb: 1.3rem;--_track-h: .45rem}.cb-slider__track{position:relative;height:var(--_track-h);border-radius:var(--cb-radius-full);background-color:var(--cb-color-border);cursor:pointer;touch-action:none}.cb-slider__range{position:absolute;left:0;top:0;height:100%;border-radius:var(--cb-radius-full);background-color:var(--cb-color-primary-500)}.cb-slider__thumb{position:absolute;top:50%;width:var(--_thumb);height:var(--_thumb);transform:translate(-50%,-50%);border-radius:var(--cb-radius-full);background-color:var(--cb-color-primary-500);border:2px solid var(--cb-color-bg);box-shadow:var(--cb-shadow-sm);cursor:grab;outline:none;transition:box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-slider__thumb:active{cursor:grabbing}.cb-slider__thumb:focus-visible{box-shadow:0 0 0 4px var(--cb-color-focus-ring)}.cb-slider__thumb.cb-is-active{z-index:1}:host(.cb-slider--with-value){padding-top:2rem}.cb-slider__value{position:absolute;bottom:calc(100% + .4rem);left:50%;padding:.1rem .4rem;font-family:var(--cb-font-sans);font-size:var(--cb-text-xs);font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--cb-color-text);background-color:var(--cb-color-surface-raised);border:1px solid var(--cb-color-border);border-radius:var(--cb-radius-sm);transform:translate(-50%);pointer-events:none}:host(.cb-is-disabled){opacity:var(--cb-opacity-disabled, .55)}:host(.cb-is-disabled) .cb-slider__track,:host(.cb-is-disabled) .cb-slider__thumb{cursor:default}:host(.cb-is-invalid) .cb-slider__track{box-shadow:0 0 0 2px var(--cb-color-danger)}\n"] }]
|
|
304
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], rangeValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "rangeValue", required: false }] }, { type: i0.Output, args: ["rangeValueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], range: [{ type: i0.Input, args: [{ isSignal: true, alias: "range", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], valueFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueFormat", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], changed: [{ type: i0.Output, args: ["changed"] }], rangeChanged: [{ type: i0.Output, args: ["rangeChanged"] }], track: [{ type: i0.ViewChild, args: ['track', { isSignal: true }] }] } });
|
|
212
305
|
function toBoolean(value) {
|
|
213
306
|
return value !== false && value != null && `${value}` !== 'false';
|
|
214
307
|
}
|
|
308
|
+
function joinLabel(label, suffix) {
|
|
309
|
+
return label ? `${label} ${suffix.toLocaleLowerCase()}` : suffix;
|
|
310
|
+
}
|
|
215
311
|
|
|
216
312
|
/*
|
|
217
313
|
* Public API Surface de @caribeng/ui/slider
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, model, output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { CbIcon } from '@caribeng/ui/icon';
|
|
4
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
4
5
|
|
|
5
6
|
class CbSpeedDial {
|
|
6
7
|
constructor() {
|
|
8
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
9
|
+
this.t = injectCbTranslation();
|
|
7
10
|
this.items = input([], /* @ts-ignore */
|
|
8
11
|
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
9
12
|
this.direction = input('up', /* @ts-ignore */
|
|
@@ -12,9 +15,9 @@ class CbSpeedDial {
|
|
|
12
15
|
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
13
16
|
this.closeIcon = input('x', /* @ts-ignore */
|
|
14
17
|
...(ngDevMode ? [{ debugName: "closeIcon" }] : /* istanbul ignore next */ []));
|
|
15
|
-
this.openLabel = input(
|
|
18
|
+
this.openLabel = input(undefined, /* @ts-ignore */
|
|
16
19
|
...(ngDevMode ? [{ debugName: "openLabel" }] : /* istanbul ignore next */ []));
|
|
17
|
-
this.closeLabel = input(
|
|
20
|
+
this.closeLabel = input(undefined, /* @ts-ignore */
|
|
18
21
|
...(ngDevMode ? [{ debugName: "closeLabel" }] : /* istanbul ignore next */ []));
|
|
19
22
|
this.open = model(false, /* @ts-ignore */
|
|
20
23
|
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
@@ -46,7 +49,7 @@ class CbSpeedDial {
|
|
|
46
49
|
class="cb-speed-dial__trigger"
|
|
47
50
|
type="button"
|
|
48
51
|
[attr.aria-expanded]="open()"
|
|
49
|
-
[attr.aria-label]="open() ? closeLabel() : openLabel()"
|
|
52
|
+
[attr.aria-label]="open() ? (closeLabel() ?? t().closeActions) : (openLabel() ?? t().openActions)"
|
|
50
53
|
(click)="open.set(!open())"
|
|
51
54
|
><cb-icon [name]="open() ? closeIcon() : icon()" [size]="20" aria-hidden="true" /></button>
|
|
52
55
|
`, isInline: true, styles: [":host{display:inline-flex;position:relative;align-items:center;justify-content:center;color:var(--cb-color-text)}.cb-speed-dial__trigger,.cb-speed-dial__action{display:grid;place-items:center;border:0;border-radius:50%;color:var(--cb-color-primary-contrast, #fff);background:var(--cb-color-primary);box-shadow:var(--cb-shadow-md);cursor:pointer;transition:transform var(--cb-duration-fast, .12s) ease,opacity var(--cb-duration-fast, .12s) ease}.cb-speed-dial__trigger{z-index:1;width:3rem;height:3rem}.cb-speed-dial__actions{position:absolute;display:flex;align-items:center;gap:.5rem}.cb-speed-dial__action{width:2.5rem;height:2.5rem;background:var(--cb-color-surface-raised);color:var(--cb-color-text);border:1px solid var(--cb-color-border)}.cb-speed-dial__action:disabled{opacity:.5;cursor:default}.cb-speed-dial__trigger:hover,.cb-speed-dial__action:hover:not(:disabled),.cb-speed-dial__trigger:focus-visible,.cb-speed-dial__action:focus-visible{outline:2px solid var(--cb-color-primary);outline-offset:2px;transform:scale(1.06)}:host(.cb-speed-dial--up) .cb-speed-dial__actions{bottom:calc(100% + .5rem);flex-direction:column-reverse}:host(.cb-speed-dial--down) .cb-speed-dial__actions{top:calc(100% + .5rem);flex-direction:column}:host(.cb-speed-dial--left) .cb-speed-dial__actions{right:calc(100% + .5rem);flex-direction:row-reverse}:host(.cb-speed-dial--right) .cb-speed-dial__actions{left:calc(100% + .5rem);flex-direction:row}@media(prefers-reduced-motion:reduce){.cb-speed-dial__trigger,.cb-speed-dial__action{transition:none}}:host-context([data-theme=\"dark\"]) .cb-speed-dial__action{color:var(--cb-color-text)}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
@@ -79,7 +82,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
79
82
|
class="cb-speed-dial__trigger"
|
|
80
83
|
type="button"
|
|
81
84
|
[attr.aria-expanded]="open()"
|
|
82
|
-
[attr.aria-label]="open() ? closeLabel() : openLabel()"
|
|
85
|
+
[attr.aria-label]="open() ? (closeLabel() ?? t().closeActions) : (openLabel() ?? t().openActions)"
|
|
83
86
|
(click)="open.set(!open())"
|
|
84
87
|
><cb-icon [name]="open() ? closeIcon() : icon()" [size]="20" aria-hidden="true" /></button>
|
|
85
88
|
`, styles: [":host{display:inline-flex;position:relative;align-items:center;justify-content:center;color:var(--cb-color-text)}.cb-speed-dial__trigger,.cb-speed-dial__action{display:grid;place-items:center;border:0;border-radius:50%;color:var(--cb-color-primary-contrast, #fff);background:var(--cb-color-primary);box-shadow:var(--cb-shadow-md);cursor:pointer;transition:transform var(--cb-duration-fast, .12s) ease,opacity var(--cb-duration-fast, .12s) ease}.cb-speed-dial__trigger{z-index:1;width:3rem;height:3rem}.cb-speed-dial__actions{position:absolute;display:flex;align-items:center;gap:.5rem}.cb-speed-dial__action{width:2.5rem;height:2.5rem;background:var(--cb-color-surface-raised);color:var(--cb-color-text);border:1px solid var(--cb-color-border)}.cb-speed-dial__action:disabled{opacity:.5;cursor:default}.cb-speed-dial__trigger:hover,.cb-speed-dial__action:hover:not(:disabled),.cb-speed-dial__trigger:focus-visible,.cb-speed-dial__action:focus-visible{outline:2px solid var(--cb-color-primary);outline-offset:2px;transform:scale(1.06)}:host(.cb-speed-dial--up) .cb-speed-dial__actions{bottom:calc(100% + .5rem);flex-direction:column-reverse}:host(.cb-speed-dial--down) .cb-speed-dial__actions{top:calc(100% + .5rem);flex-direction:column}:host(.cb-speed-dial--left) .cb-speed-dial__actions{right:calc(100% + .5rem);flex-direction:row-reverse}:host(.cb-speed-dial--right) .cb-speed-dial__actions{left:calc(100% + .5rem);flex-direction:row}@media(prefers-reduced-motion:reduce){.cb-speed-dial__trigger,.cb-speed-dial__action{transition:none}}:host-context([data-theme=\"dark\"]) .cb-speed-dial__action{color:var(--cb-color-text)}\n"] }]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Spinner de CaribeNG: indicador de carga circular.
|
|
@@ -12,6 +13,8 @@ import { input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@a
|
|
|
12
13
|
*/
|
|
13
14
|
class CbSpinner {
|
|
14
15
|
constructor() {
|
|
16
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
17
|
+
this.t = injectCbTranslation();
|
|
15
18
|
/** Tamaño en píxeles. */
|
|
16
19
|
this.size = input(32, /* @ts-ignore */
|
|
17
20
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
@@ -24,7 +27,7 @@ class CbSpinner {
|
|
|
24
27
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
25
28
|
}
|
|
26
29
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSpinner, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
27
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: CbSpinner, isStandalone: true, selector: "cb-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "class": "'cb-spinner cb-spinner--' + severity()", "attr.aria-label": "ariaLabel() ||
|
|
30
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: CbSpinner, isStandalone: true, selector: "cb-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "class": "'cb-spinner cb-spinner--' + severity()", "attr.aria-label": "ariaLabel() || t().loading" }, classAttribute: "cb-spinner" }, ngImport: i0, template: `
|
|
28
31
|
<svg
|
|
29
32
|
class="cb-spinner__svg"
|
|
30
33
|
[attr.width]="size()"
|
|
@@ -43,7 +46,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
43
46
|
class: 'cb-spinner',
|
|
44
47
|
'[class]': "'cb-spinner cb-spinner--' + severity()",
|
|
45
48
|
role: 'status',
|
|
46
|
-
'[attr.aria-label]':
|
|
49
|
+
'[attr.aria-label]': 'ariaLabel() || t().loading',
|
|
47
50
|
}, template: `
|
|
48
51
|
<svg
|
|
49
52
|
class="cb-spinner__svg"
|