@caribeng/ui 22.1.1 → 22.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -12
- package/fesm2022/caribeng-ui-accordion.mjs +4 -4
- package/fesm2022/caribeng-ui-anchor.mjs +169 -0
- package/fesm2022/caribeng-ui-autocomplete.mjs +10 -8
- package/fesm2022/caribeng-ui-avatar.mjs +2 -2
- package/fesm2022/caribeng-ui-avatargroup.mjs +9 -3
- package/fesm2022/caribeng-ui-badge.mjs +8 -2
- package/fesm2022/caribeng-ui-blockui.mjs +12 -4
- package/fesm2022/caribeng-ui-breadcrumb.mjs +17 -7
- package/fesm2022/caribeng-ui-button.mjs +22 -2
- package/fesm2022/caribeng-ui-caribe-alert.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-animation-lottie.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-button-group.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-calendar.mjs +11 -6
- package/fesm2022/caribeng-ui-caribe-card-content.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-card-move.mjs +29 -7
- package/fesm2022/caribeng-ui-caribe-card-select.mjs +56 -14
- package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +10 -7
- package/fesm2022/caribeng-ui-caribe-coachmark.mjs +42 -19
- package/fesm2022/caribeng-ui-caribe-data-table.mjs +15 -9
- package/fesm2022/caribeng-ui-caribe-dots-indicator.mjs +38 -5
- package/fesm2022/caribeng-ui-caribe-expansion-panel.mjs +16 -5
- package/fesm2022/caribeng-ui-caribe-fab-menu.mjs +56 -7
- package/fesm2022/caribeng-ui-caribe-file-download.mjs +68 -27
- package/fesm2022/caribeng-ui-caribe-file-select.mjs +22 -17
- package/fesm2022/caribeng-ui-caribe-float-menu.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-footer.mjs +8 -4
- package/fesm2022/caribeng-ui-caribe-header.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-icon-button.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-illustration.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-input-search.mjs +14 -10
- package/fesm2022/caribeng-ui-caribe-input-select.mjs +12 -10
- package/fesm2022/caribeng-ui-caribe-input-token.mjs +61 -11
- package/fesm2022/caribeng-ui-caribe-link.mjs +7 -2
- package/fesm2022/caribeng-ui-caribe-loader.mjs +8 -5
- package/fesm2022/caribeng-ui-caribe-modal.mjs +32 -16
- package/fesm2022/caribeng-ui-caribe-off-canvas.mjs +26 -12
- package/fesm2022/caribeng-ui-caribe-onboarding.mjs +44 -19
- package/fesm2022/caribeng-ui-caribe-pictogram.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-pop-over.mjs +34 -10
- package/fesm2022/caribeng-ui-caribe-preloader.mjs +9 -6
- package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-shortcut.mjs +8 -3
- package/fesm2022/caribeng-ui-caribe-step-indicator.mjs +12 -5
- package/fesm2022/caribeng-ui-caribe-stroke.mjs +6 -3
- package/fesm2022/caribeng-ui-caribe-switch.mjs +5 -3
- package/fesm2022/caribeng-ui-caribe-tag-button.mjs +1 -1
- package/fesm2022/caribeng-ui-caribe-tracker.mjs +5 -2
- package/fesm2022/caribeng-ui-caribe-transaction-status.mjs +1 -1
- package/fesm2022/caribeng-ui-caribe-voucher.mjs +11 -8
- package/fesm2022/caribeng-ui-carousel.mjs +49 -14
- package/fesm2022/caribeng-ui-cascadeselect.mjs +22 -8
- package/fesm2022/caribeng-ui-chart.mjs +2601 -303
- package/fesm2022/caribeng-ui-chat.mjs +1303 -0
- package/fesm2022/caribeng-ui-chip.mjs +9 -4
- package/fesm2022/caribeng-ui-chips.mjs +9 -5
- package/fesm2022/caribeng-ui-code-block.mjs +332 -0
- package/fesm2022/caribeng-ui-colorpicker.mjs +107 -11
- package/fesm2022/caribeng-ui-command-palette.mjs +476 -0
- package/fesm2022/caribeng-ui-confirmdialog.mjs +140 -10
- package/fesm2022/caribeng-ui-confirmpopup.mjs +209 -9
- package/fesm2022/caribeng-ui-contextmenu.mjs +13 -6
- package/fesm2022/caribeng-ui-copy-button.mjs +230 -0
- package/fesm2022/caribeng-ui-dataview.mjs +214 -6
- package/fesm2022/caribeng-ui-datepicker.mjs +1630 -393
- package/fesm2022/caribeng-ui-descriptions.mjs +124 -0
- package/fesm2022/caribeng-ui-dialog.mjs +10 -7
- package/fesm2022/caribeng-ui-dock.mjs +58 -15
- package/fesm2022/caribeng-ui-drawer.mjs +17 -9
- package/fesm2022/caribeng-ui-dynamicdialog.mjs +210 -6
- package/fesm2022/caribeng-ui-editor.mjs +4413 -243
- package/fesm2022/caribeng-ui-empty.mjs +80 -0
- package/fesm2022/caribeng-ui-fieldset.mjs +2 -2
- package/fesm2022/caribeng-ui-file-card.mjs +136 -19
- package/fesm2022/caribeng-ui-fileupload.mjs +96 -19
- package/fesm2022/caribeng-ui-floatlabel.mjs +4 -2
- package/fesm2022/caribeng-ui-folder-card.mjs +132 -15
- package/fesm2022/caribeng-ui-galleria.mjs +76 -45
- package/fesm2022/caribeng-ui-image.mjs +52 -29
- package/fesm2022/caribeng-ui-inlinemessage.mjs +2 -2
- package/fesm2022/caribeng-ui-inplace.mjs +22 -6
- package/fesm2022/caribeng-ui-input-number.mjs +9 -7
- package/fesm2022/caribeng-ui-inputgroup.mjs +2 -2
- package/fesm2022/caribeng-ui-inputmask.mjs +22 -13
- package/fesm2022/caribeng-ui-inputotp.mjs +12 -6
- package/fesm2022/caribeng-ui-kanban.mjs +4612 -0
- package/fesm2022/caribeng-ui-kbd.mjs +122 -0
- package/fesm2022/caribeng-ui-keyfilter.mjs +72 -0
- package/fesm2022/caribeng-ui-listbox.mjs +13 -11
- package/fesm2022/caribeng-ui-megamenu.mjs +228 -32
- package/fesm2022/caribeng-ui-mentions.mjs +495 -0
- package/fesm2022/caribeng-ui-menu.mjs +18 -8
- package/fesm2022/caribeng-ui-menubar.mjs +17 -8
- package/fesm2022/caribeng-ui-message.mjs +13 -7
- package/fesm2022/caribeng-ui-metergroup.mjs +29 -11
- package/fesm2022/caribeng-ui-multiselect.mjs +399 -97
- package/fesm2022/caribeng-ui-orderlist.mjs +230 -11
- package/fesm2022/caribeng-ui-organizationchart.mjs +16 -15
- package/fesm2022/caribeng-ui-paginator.mjs +18 -15
- package/fesm2022/caribeng-ui-panel.mjs +11 -8
- package/fesm2022/caribeng-ui-panelmenu.mjs +14 -8
- package/fesm2022/caribeng-ui-password.mjs +8 -6
- package/fesm2022/caribeng-ui-pdfviewer.mjs +1553 -0
- package/fesm2022/caribeng-ui-phone-input.mjs +688 -0
- package/fesm2022/caribeng-ui-picklist.mjs +251 -14
- package/fesm2022/caribeng-ui-pricing.mjs +272 -75
- package/fesm2022/caribeng-ui-qrcode.mjs +564 -0
- package/fesm2022/caribeng-ui-rating.mjs +7 -3
- package/fesm2022/caribeng-ui-repeater.mjs +223 -0
- package/fesm2022/caribeng-ui-result.mjs +91 -0
- package/fesm2022/caribeng-ui-ripple.mjs +2 -0
- package/fesm2022/caribeng-ui-scrollpanel.mjs +6 -3
- package/fesm2022/caribeng-ui-scrolltop.mjs +9 -4
- package/fesm2022/caribeng-ui-select.mjs +379 -87
- package/fesm2022/caribeng-ui-selectbutton.mjs +2 -2
- package/fesm2022/caribeng-ui-sidebar.mjs +573 -0
- package/fesm2022/caribeng-ui-slider.mjs +171 -75
- package/fesm2022/caribeng-ui-speeddial.mjs +7 -4
- package/fesm2022/caribeng-ui-spinner.mjs +5 -2
- package/fesm2022/caribeng-ui-splitbutton.mjs +163 -0
- package/fesm2022/caribeng-ui-splitter.mjs +5 -2
- package/fesm2022/caribeng-ui-statistic.mjs +183 -0
- package/fesm2022/caribeng-ui-stepper.mjs +17 -7
- package/fesm2022/caribeng-ui-steps.mjs +6 -3
- package/fesm2022/caribeng-ui-table.mjs +716 -84
- package/fesm2022/caribeng-ui-tabmenu.mjs +13 -6
- package/fesm2022/caribeng-ui-tag.mjs +2 -2
- package/fesm2022/caribeng-ui-terminal.mjs +45 -9
- package/fesm2022/caribeng-ui-themetoggle.mjs +82 -0
- package/fesm2022/caribeng-ui-tieredmenu.mjs +113 -20
- package/fesm2022/caribeng-ui-timeline.mjs +175 -6
- package/fesm2022/caribeng-ui-toast.mjs +7 -4
- package/fesm2022/caribeng-ui-togglebutton.mjs +8 -6
- package/fesm2022/caribeng-ui-toolbar.mjs +6 -3
- package/fesm2022/caribeng-ui-tree.mjs +302 -6
- package/fesm2022/caribeng-ui-treeselect.mjs +26 -10
- package/fesm2022/caribeng-ui-treetable.mjs +269 -6
- package/fesm2022/caribeng-ui-virtualscroller.mjs +123 -10
- package/fesm2022/caribeng-ui.mjs +1216 -6
- package/package.json +93 -3
- package/schematics/collection.json +15 -0
- package/schematics/migrate-from-primeng/core-icons.json +1 -0
- package/schematics/migrate-from-primeng/icons.js +269 -0
- package/schematics/migrate-from-primeng/index.js +290 -0
- package/schematics/migrate-from-primeng/mappings/button.js +93 -0
- package/schematics/migrate-from-primeng/mappings/card.js +33 -0
- package/schematics/migrate-from-primeng/mappings/checkbox.js +44 -0
- package/schematics/migrate-from-primeng/mappings/confirm.js +221 -0
- package/schematics/migrate-from-primeng/mappings/datepicker.js +121 -0
- package/schematics/migrate-from-primeng/mappings/dialog.js +84 -0
- package/schematics/migrate-from-primeng/mappings/index.js +88 -0
- package/schematics/migrate-from-primeng/mappings/inputnumber.js +62 -0
- package/schematics/migrate-from-primeng/mappings/inputtext.js +60 -0
- package/schematics/migrate-from-primeng/mappings/menu.js +468 -0
- package/schematics/migrate-from-primeng/mappings/multiselect.js +49 -0
- package/schematics/migrate-from-primeng/mappings/radiobutton.js +22 -0
- package/schematics/migrate-from-primeng/mappings/rules.js +206 -0
- package/schematics/migrate-from-primeng/mappings/select.js +97 -0
- package/schematics/migrate-from-primeng/mappings/service-calls.js +100 -0
- package/schematics/migrate-from-primeng/mappings/table.js +613 -0
- package/schematics/migrate-from-primeng/mappings/tabs.js +225 -0
- package/schematics/migrate-from-primeng/mappings/tag.js +29 -0
- package/schematics/migrate-from-primeng/mappings/textarea.js +44 -0
- package/schematics/migrate-from-primeng/mappings/toast.js +173 -0
- package/schematics/migrate-from-primeng/mappings/toggleswitch.js +37 -0
- package/schematics/migrate-from-primeng/mappings/tooltip.js +44 -0
- package/schematics/migrate-from-primeng/mappings/types.js +10 -0
- package/schematics/migrate-from-primeng/report.js +79 -0
- package/schematics/migrate-from-primeng/schema.js +2 -0
- package/schematics/migrate-from-primeng/schema.json +34 -0
- package/schematics/migrate-from-primeng/template.js +387 -0
- package/schematics/migrate-from-primeng/todo.js +5 -0
- package/schematics/migrate-from-primeng/typescript.js +442 -0
- package/schematics/migrate-from-primeng/workspace.js +117 -0
- package/schematics/ng-add/index.js +140 -0
- package/schematics/ng-add/schema.js +2 -0
- package/schematics/ng-add/schema.json +66 -0
- package/types/caribeng-ui-anchor.d.ts +50 -0
- package/types/caribeng-ui-autocomplete.d.ts +4 -2
- package/types/caribeng-ui-avatargroup.d.ts +3 -1
- package/types/caribeng-ui-badge.d.ts +3 -1
- package/types/caribeng-ui-blockui.d.ts +9 -4
- package/types/caribeng-ui-breadcrumb.d.ts +11 -0
- package/types/caribeng-ui-button.d.ts +9 -1
- package/types/caribeng-ui-caribe-alert.d.ts +3 -0
- package/types/caribeng-ui-caribe-animation-lottie.d.ts +4 -1
- package/types/caribeng-ui-caribe-button-group.d.ts +4 -1
- package/types/caribeng-ui-caribe-calendar.d.ts +5 -1
- package/types/caribeng-ui-caribe-card-content.d.ts +4 -1
- package/types/caribeng-ui-caribe-card-move.d.ts +13 -13
- package/types/caribeng-ui-caribe-card-select.d.ts +10 -1
- package/types/caribeng-ui-caribe-circle-loading.d.ts +4 -1
- package/types/caribeng-ui-caribe-coachmark.d.ts +6 -0
- package/types/caribeng-ui-caribe-data-table.d.ts +7 -2
- package/types/caribeng-ui-caribe-dots-indicator.d.ts +9 -0
- package/types/caribeng-ui-caribe-expansion-panel.d.ts +7 -10
- package/types/caribeng-ui-caribe-fab-menu.d.ts +10 -1
- package/types/caribeng-ui-caribe-file-download.d.ts +8 -10
- package/types/caribeng-ui-caribe-file-select.d.ts +7 -1
- package/types/caribeng-ui-caribe-float-menu.d.ts +4 -1
- package/types/caribeng-ui-caribe-header.d.ts +3 -0
- package/types/caribeng-ui-caribe-icon-button.d.ts +4 -1
- package/types/caribeng-ui-caribe-illustration.d.ts +4 -1
- package/types/caribeng-ui-caribe-inline-alert.d.ts +3 -0
- package/types/caribeng-ui-caribe-input-search.d.ts +4 -2
- package/types/caribeng-ui-caribe-input-select.d.ts +4 -2
- package/types/caribeng-ui-caribe-input-token.d.ts +16 -1
- package/types/caribeng-ui-caribe-link.d.ts +3 -0
- package/types/caribeng-ui-caribe-loader.d.ts +4 -1
- package/types/caribeng-ui-caribe-modal.d.ts +7 -10
- package/types/caribeng-ui-caribe-off-canvas.d.ts +6 -1
- package/types/caribeng-ui-caribe-onboarding.d.ts +6 -0
- package/types/caribeng-ui-caribe-pictogram.d.ts +4 -1
- package/types/caribeng-ui-caribe-pop-over.d.ts +7 -10
- package/types/caribeng-ui-caribe-preloader.d.ts +4 -1
- package/types/caribeng-ui-caribe-progress-bar.d.ts +3 -0
- package/types/caribeng-ui-caribe-shortcut.d.ts +3 -1
- package/types/caribeng-ui-caribe-step-indicator.d.ts +6 -0
- package/types/caribeng-ui-caribe-stroke.d.ts +4 -1
- package/types/caribeng-ui-caribe-switch.d.ts +3 -1
- package/types/caribeng-ui-caribe-tracker.d.ts +3 -0
- package/types/caribeng-ui-caribe-voucher.d.ts +5 -2
- package/types/caribeng-ui-carousel.d.ts +10 -1
- package/types/caribeng-ui-cascadeselect.d.ts +7 -2
- package/types/caribeng-ui-chart.d.ts +471 -44
- package/types/caribeng-ui-chat.d.ts +299 -0
- package/types/caribeng-ui-chip.d.ts +6 -0
- package/types/caribeng-ui-chips.d.ts +6 -2
- package/types/caribeng-ui-code-block.d.ts +65 -0
- package/types/caribeng-ui-colorpicker.d.ts +8 -2
- package/types/caribeng-ui-command-palette.d.ts +133 -0
- package/types/caribeng-ui-confirmdialog.d.ts +57 -6
- package/types/caribeng-ui-confirmpopup.d.ts +74 -5
- package/types/caribeng-ui-contextmenu.d.ts +11 -1
- package/types/caribeng-ui-copy-button.d.ts +90 -0
- package/types/caribeng-ui-dataview.d.ts +65 -5
- package/types/caribeng-ui-datepicker.d.ts +186 -21
- package/types/caribeng-ui-descriptions.d.ts +63 -0
- package/types/caribeng-ui-dialog.d.ts +4 -1
- package/types/caribeng-ui-dock.d.ts +17 -2
- package/types/caribeng-ui-drawer.d.ts +7 -2
- package/types/caribeng-ui-dynamicdialog.d.ts +93 -3
- package/types/caribeng-ui-editor.d.ts +486 -13
- package/types/caribeng-ui-empty.d.ts +34 -0
- package/types/caribeng-ui-file-card.d.ts +28 -3
- package/types/caribeng-ui-fileupload.d.ts +27 -4
- package/types/caribeng-ui-folder-card.d.ts +31 -6
- package/types/caribeng-ui-galleria.d.ts +9 -0
- package/types/caribeng-ui-image.d.ts +10 -0
- package/types/caribeng-ui-inplace.d.ts +8 -0
- package/types/caribeng-ui-input-number.d.ts +3 -1
- package/types/caribeng-ui-inputmask.d.ts +8 -1
- package/types/caribeng-ui-inputotp.d.ts +7 -2
- package/types/caribeng-ui-kanban.d.ts +783 -0
- package/types/caribeng-ui-kbd.d.ts +36 -0
- package/types/caribeng-ui-keyfilter.d.ts +30 -0
- package/types/caribeng-ui-listbox.d.ts +5 -3
- package/types/caribeng-ui-megamenu.d.ts +37 -2
- package/types/caribeng-ui-mentions.d.ts +127 -0
- package/types/caribeng-ui-menu.d.ts +14 -2
- package/types/caribeng-ui-menubar.d.ts +12 -1
- package/types/caribeng-ui-message.d.ts +5 -0
- package/types/caribeng-ui-metergroup.d.ts +9 -1
- package/types/caribeng-ui-multiselect.d.ts +71 -10
- package/types/caribeng-ui-orderlist.d.ts +58 -6
- package/types/caribeng-ui-organizationchart.d.ts +7 -1
- package/types/caribeng-ui-paginator.d.ts +3 -0
- package/types/caribeng-ui-panel.d.ts +3 -0
- package/types/caribeng-ui-panelmenu.d.ts +11 -1
- package/types/caribeng-ui-password.d.ts +4 -2
- package/types/caribeng-ui-pdfviewer.d.ts +258 -0
- package/types/caribeng-ui-phone-input.d.ts +168 -0
- package/types/caribeng-ui-picklist.d.ts +67 -7
- package/types/caribeng-ui-pricing.d.ts +49 -9
- package/types/caribeng-ui-qrcode.d.ts +88 -0
- package/types/caribeng-ui-rating.d.ts +6 -2
- package/types/caribeng-ui-repeater.d.ts +79 -0
- package/types/caribeng-ui-result.d.ts +35 -0
- package/types/caribeng-ui-scrollpanel.d.ts +4 -1
- package/types/caribeng-ui-scrolltop.d.ts +4 -1
- package/types/caribeng-ui-select.d.ts +73 -9
- package/types/caribeng-ui-sidebar.d.ts +167 -0
- package/types/caribeng-ui-slider.d.ts +63 -10
- package/types/caribeng-ui-speeddial.d.ts +5 -2
- package/types/caribeng-ui-spinner.d.ts +3 -0
- package/types/caribeng-ui-splitbutton.d.ts +49 -0
- package/types/caribeng-ui-splitter.d.ts +3 -0
- package/types/caribeng-ui-statistic.d.ts +65 -0
- package/types/caribeng-ui-stepper.d.ts +5 -0
- package/types/caribeng-ui-steps.d.ts +4 -1
- package/types/caribeng-ui-table.d.ts +185 -17
- package/types/caribeng-ui-tabmenu.d.ts +11 -1
- package/types/caribeng-ui-terminal.d.ts +10 -0
- package/types/caribeng-ui-themetoggle.d.ts +32 -0
- package/types/caribeng-ui-tieredmenu.d.ts +22 -3
- package/types/caribeng-ui-timeline.d.ts +63 -4
- package/types/caribeng-ui-toast.d.ts +3 -0
- package/types/caribeng-ui-togglebutton.d.ts +5 -3
- package/types/caribeng-ui-toolbar.d.ts +7 -4
- package/types/caribeng-ui-tree.d.ts +76 -4
- package/types/caribeng-ui-treeselect.d.ts +10 -2
- package/types/caribeng-ui-treetable.d.ts +68 -4
- package/types/caribeng-ui-virtualscroller.d.ts +45 -5
- package/types/caribeng-ui.d.ts +775 -12
|
@@ -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';
|
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import { NgTemplateOutlet, DOCUMENT } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InjectionToken, inject, input, model, booleanAttribute, output, signal, computed, effect, untracked, ViewEncapsulation, ChangeDetectionStrategy, Component, ElementRef, Injector, DestroyRef, afterNextRender, forwardRef, Directive } from '@angular/core';
|
|
4
|
+
import { injectCbTranslation } from '@caribeng/ui';
|
|
5
|
+
import { CbIcon } from '@caribeng/ui/icon';
|
|
6
|
+
import { CbTooltipDirective } from '@caribeng/ui/tooltip';
|
|
7
|
+
import * as i1 from '@angular/cdk/a11y';
|
|
8
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
9
|
+
|
|
10
|
+
/** Clave de un item para `active`. */
|
|
11
|
+
function cbSidebarKey(item) {
|
|
12
|
+
return item.id ?? item.url ?? item.label;
|
|
13
|
+
}
|
|
14
|
+
const CB_APP_SHELL = new InjectionToken('CB_APP_SHELL');
|
|
15
|
+
|
|
16
|
+
let nextUid$1 = 0;
|
|
17
|
+
/**
|
|
18
|
+
* Menú lateral de CaribeNG: secciones con título, enlaces con icono y badge,
|
|
19
|
+
* grupos desplegables de un nivel y modo contraído a iconos (con tooltip).
|
|
20
|
+
* Dentro de `cb-app-shell` se convierte en panel deslizante en móvil.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <cb-sidebar [groups]="menu" [(active)]="seccion" [navigate]="navigate">
|
|
25
|
+
* <img cb-sidebar-header src="logo.svg" alt="Mi banco" />
|
|
26
|
+
* </cb-sidebar>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
class CbSidebar {
|
|
30
|
+
constructor() {
|
|
31
|
+
/** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
|
|
32
|
+
this.t = injectCbTranslation();
|
|
33
|
+
/** `cb-app-shell` que lo contiene, si hay. */
|
|
34
|
+
this.shell = inject(CB_APP_SHELL, { optional: true });
|
|
35
|
+
this.uid = `cb-sidebar-${++nextUid$1}`;
|
|
36
|
+
this.groups = input([], /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/** Clave del item activo (`id`, `url` o `label`); se marca con `aria-current="page"`. */
|
|
39
|
+
this.active = model(null, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Contraído a iconos. Dentro de `cb-app-shell` lo controla el shell. */
|
|
42
|
+
this.collapsed = model(false, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
|
|
44
|
+
/** Muestra el botón de contraer/expandir en el pie. */
|
|
45
|
+
this.collapsible = input(true, { ...(ngDevMode ? { debugName: "collapsible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
46
|
+
/** Nombre de la navegación. Por defecto, "Navegación principal". */
|
|
47
|
+
this.ariaLabel = input(undefined, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/**
|
|
50
|
+
* Navegación SPA: si se indica, los enlaces internos (sin `target` ni teclas
|
|
51
|
+
* modificadoras) la llaman en lugar de recargar la página.
|
|
52
|
+
* Ej.: `navigate = (url: string) => this.router.navigateByUrl(url)`.
|
|
53
|
+
*/
|
|
54
|
+
this.navigate = input(null, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "navigate" }] : /* istanbul ignore next */ []));
|
|
56
|
+
/** Item elegido. */
|
|
57
|
+
this.itemSelect = output();
|
|
58
|
+
this.expanded = signal(new Set(), /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
60
|
+
this.isCollapsed = computed(() => {
|
|
61
|
+
const shell = this.shell;
|
|
62
|
+
if (!shell)
|
|
63
|
+
return this.collapsed();
|
|
64
|
+
return !shell.mobile() && shell.collapsed();
|
|
65
|
+
}, /* @ts-ignore */
|
|
66
|
+
...(ngDevMode ? [{ debugName: "isCollapsed" }] : /* istanbul ignore next */ []));
|
|
67
|
+
// Abre el grupo que contiene el item activo.
|
|
68
|
+
effect(() => {
|
|
69
|
+
const active = this.active();
|
|
70
|
+
const groups = this.groups();
|
|
71
|
+
untracked(() => {
|
|
72
|
+
for (const group of groups) {
|
|
73
|
+
for (const item of group.items) {
|
|
74
|
+
if (item.children?.some((c) => cbSidebarKey(c) === active) && !this.expanded().has(cbSidebarKey(item))) {
|
|
75
|
+
this.expanded.update((set) => new Set(set).add(cbSidebarKey(item)));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
key(item) {
|
|
83
|
+
return cbSidebarKey(item);
|
|
84
|
+
}
|
|
85
|
+
isActive(item) {
|
|
86
|
+
return this.active() === cbSidebarKey(item);
|
|
87
|
+
}
|
|
88
|
+
hasActiveChild(item) {
|
|
89
|
+
return !!item.children?.some((c) => this.isActive(c));
|
|
90
|
+
}
|
|
91
|
+
isExpanded(item) {
|
|
92
|
+
return this.expanded().has(cbSidebarKey(item));
|
|
93
|
+
}
|
|
94
|
+
toggleGroup(item) {
|
|
95
|
+
const key = cbSidebarKey(item);
|
|
96
|
+
if (this.isCollapsed()) {
|
|
97
|
+
// Contraído no caben los hijos: se expande el sidebar y se abre el grupo.
|
|
98
|
+
this.setCollapsed(false);
|
|
99
|
+
this.expanded.update((set) => new Set(set).add(key));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.expanded.update((set) => {
|
|
103
|
+
const next = new Set(set);
|
|
104
|
+
if (next.has(key))
|
|
105
|
+
next.delete(key);
|
|
106
|
+
else
|
|
107
|
+
next.add(key);
|
|
108
|
+
return next;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
toggleCollapsed() {
|
|
112
|
+
this.setCollapsed(!this.isCollapsed());
|
|
113
|
+
}
|
|
114
|
+
setCollapsed(collapsed) {
|
|
115
|
+
if (this.shell)
|
|
116
|
+
this.shell.setCollapsed(collapsed);
|
|
117
|
+
else
|
|
118
|
+
this.collapsed.set(collapsed);
|
|
119
|
+
}
|
|
120
|
+
/** Marca el item como activo, ejecuta su `command`, emite `itemSelect` y navega. */
|
|
121
|
+
select(item, event) {
|
|
122
|
+
if (item.disabled)
|
|
123
|
+
return;
|
|
124
|
+
this.active.set(cbSidebarKey(item));
|
|
125
|
+
item.command?.({ item, originalEvent: event });
|
|
126
|
+
this.itemSelect.emit({ item, originalEvent: event });
|
|
127
|
+
const navigate = this.navigate();
|
|
128
|
+
const mouse = event;
|
|
129
|
+
const modified = mouse.ctrlKey || mouse.metaKey || mouse.shiftKey || mouse.altKey || mouse.button > 0;
|
|
130
|
+
if (navigate && item.url && !item.target && !modified && !event.defaultPrevented && !/^[a-z][a-z\d+.-]*:/i.test(item.url)) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
navigate(item.url);
|
|
133
|
+
}
|
|
134
|
+
this.shell?.closeSidebar();
|
|
135
|
+
}
|
|
136
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSidebar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
137
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbSidebar, isStandalone: true, selector: "cb-sidebar", inputs: { groups: { classPropertyName: "groups", publicName: "groups", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, navigate: { classPropertyName: "navigate", publicName: "navigate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", collapsed: "collapsedChange", itemSelect: "itemSelect" }, host: { properties: { "class.cb-sidebar--collapsed": "isCollapsed()" }, classAttribute: "cb-sidebar" }, ngImport: i0, template: `
|
|
138
|
+
<nav class="cb-sidebar__nav" [attr.aria-label]="ariaLabel() ?? t().mainNavigation">
|
|
139
|
+
<div class="cb-sidebar__header"><ng-content select="[cb-sidebar-header]" /></div>
|
|
140
|
+
|
|
141
|
+
<div class="cb-sidebar__body">
|
|
142
|
+
@for (group of groups(); track $index; let g = $index) {
|
|
143
|
+
<div class="cb-sidebar__group">
|
|
144
|
+
@if (group.label) {
|
|
145
|
+
<div class="cb-sidebar__group-label" [id]="uid + '-g' + g">{{ group.label }}</div>
|
|
146
|
+
}
|
|
147
|
+
<ul class="cb-sidebar__list" role="list" [attr.aria-labelledby]="group.label ? uid + '-g' + g : null">
|
|
148
|
+
@for (item of group.items; track key(item)) {
|
|
149
|
+
<li>
|
|
150
|
+
@if (item.children?.length) {
|
|
151
|
+
<button
|
|
152
|
+
type="button"
|
|
153
|
+
class="cb-sidebar__item"
|
|
154
|
+
[class.cb-sidebar__item--has-active]="hasActiveChild(item)"
|
|
155
|
+
[disabled]="item.disabled"
|
|
156
|
+
[attr.aria-expanded]="isCollapsed() ? null : isExpanded(item)"
|
|
157
|
+
[attr.aria-controls]="isCollapsed() ? null : uid + '-' + key(item)"
|
|
158
|
+
[cbTooltip]="item.label"
|
|
159
|
+
cbTooltipPosition="right"
|
|
160
|
+
[cbTooltipDisabled]="!isCollapsed()"
|
|
161
|
+
(click)="toggleGroup(item)"
|
|
162
|
+
>
|
|
163
|
+
<ng-container *ngTemplateOutlet="content; context: { $implicit: item }" />
|
|
164
|
+
<cb-icon class="cb-sidebar__chevron" name="chevron-down" [size]="16" aria-hidden="true" />
|
|
165
|
+
</button>
|
|
166
|
+
@if (isExpanded(item) && !isCollapsed()) {
|
|
167
|
+
<ul class="cb-sidebar__sublist" role="list" [id]="uid + '-' + key(item)">
|
|
168
|
+
@for (child of item.children; track key(child)) {
|
|
169
|
+
<li>
|
|
170
|
+
<ng-container *ngTemplateOutlet="leaf; context: { $implicit: child }" />
|
|
171
|
+
</li>
|
|
172
|
+
}
|
|
173
|
+
</ul>
|
|
174
|
+
}
|
|
175
|
+
} @else {
|
|
176
|
+
<ng-container *ngTemplateOutlet="leaf; context: { $implicit: item }" />
|
|
177
|
+
}
|
|
178
|
+
</li>
|
|
179
|
+
}
|
|
180
|
+
</ul>
|
|
181
|
+
</div>
|
|
182
|
+
}
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div class="cb-sidebar__footer">
|
|
186
|
+
<ng-content select="[cb-sidebar-footer]" />
|
|
187
|
+
@if (collapsible() && !shell?.mobile()) {
|
|
188
|
+
<button
|
|
189
|
+
type="button"
|
|
190
|
+
class="cb-sidebar__collapse"
|
|
191
|
+
[attr.aria-label]="isCollapsed() ? t().expandSidebar : t().collapseSidebar"
|
|
192
|
+
[attr.aria-expanded]="!isCollapsed()"
|
|
193
|
+
[cbTooltip]="t().expandSidebar"
|
|
194
|
+
cbTooltipPosition="right"
|
|
195
|
+
[cbTooltipDisabled]="!isCollapsed()"
|
|
196
|
+
(click)="toggleCollapsed()"
|
|
197
|
+
>
|
|
198
|
+
<cb-icon [name]="isCollapsed() ? 'chevron-right' : 'chevron-left'" [size]="18" aria-hidden="true" />
|
|
199
|
+
</button>
|
|
200
|
+
}
|
|
201
|
+
</div>
|
|
202
|
+
</nav>
|
|
203
|
+
|
|
204
|
+
<ng-template #leaf let-item>
|
|
205
|
+
@if (item.url && !item.disabled) {
|
|
206
|
+
<a
|
|
207
|
+
class="cb-sidebar__item"
|
|
208
|
+
[class.cb-sidebar__item--active]="isActive(item)"
|
|
209
|
+
[href]="item.url"
|
|
210
|
+
[attr.target]="item.target || null"
|
|
211
|
+
[attr.aria-current]="isActive(item) ? 'page' : null"
|
|
212
|
+
[cbTooltip]="item.label"
|
|
213
|
+
cbTooltipPosition="right"
|
|
214
|
+
[cbTooltipDisabled]="!isCollapsed()"
|
|
215
|
+
(click)="select(item, $event)"
|
|
216
|
+
>
|
|
217
|
+
<ng-container *ngTemplateOutlet="content; context: { $implicit: item }" />
|
|
218
|
+
</a>
|
|
219
|
+
} @else {
|
|
220
|
+
<button
|
|
221
|
+
type="button"
|
|
222
|
+
class="cb-sidebar__item"
|
|
223
|
+
[class.cb-sidebar__item--active]="isActive(item)"
|
|
224
|
+
[disabled]="item.disabled"
|
|
225
|
+
[attr.aria-current]="isActive(item) ? 'page' : null"
|
|
226
|
+
[cbTooltip]="item.label"
|
|
227
|
+
cbTooltipPosition="right"
|
|
228
|
+
[cbTooltipDisabled]="!isCollapsed()"
|
|
229
|
+
(click)="select(item, $event)"
|
|
230
|
+
>
|
|
231
|
+
<ng-container *ngTemplateOutlet="content; context: { $implicit: item }" />
|
|
232
|
+
</button>
|
|
233
|
+
}
|
|
234
|
+
</ng-template>
|
|
235
|
+
|
|
236
|
+
<ng-template #content let-item>
|
|
237
|
+
@if (item.icon) {
|
|
238
|
+
<cb-icon class="cb-sidebar__icon" [name]="item.icon" [size]="20" aria-hidden="true" />
|
|
239
|
+
} @else {
|
|
240
|
+
<span class="cb-sidebar__icon cb-sidebar__initial" aria-hidden="true">{{ item.label.charAt(0) }}</span>
|
|
241
|
+
}
|
|
242
|
+
<span class="cb-sidebar__label">{{ item.label }}</span>
|
|
243
|
+
@if (item.badge !== undefined && item.badge !== '') {
|
|
244
|
+
<span class="cb-sidebar__badge">{{ item.badge }}</span>
|
|
245
|
+
}
|
|
246
|
+
</ng-template>
|
|
247
|
+
`, isInline: true, styles: [":host{display:block;width:var(--cb-sidebar-width, 16rem);height:100%;border-right:1px solid var(--cb-color-border);background:var(--cb-color-surface);color:var(--cb-color-text);font-family:var(--cb-font-sans);transition:width var(--cb-duration-normal, .2s) ease}:host(.cb-sidebar--collapsed){width:var(--cb-sidebar-collapsed-width, 4.5rem)}.cb-sidebar__nav{display:flex;flex-direction:column;height:100%}.cb-sidebar__header:not(:empty){display:flex;align-items:center;min-height:3.5rem;padding:.75rem 1rem;overflow:hidden}.cb-sidebar__body{flex:1;overflow-x:hidden;overflow-y:auto;padding:.5rem .75rem}.cb-sidebar__group+.cb-sidebar__group{margin-top:1rem}.cb-sidebar__group-label{padding:.25rem .75rem;overflow:hidden;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-semibold, 600);letter-spacing:.02em;text-transform:uppercase;white-space:nowrap}:host(.cb-sidebar--collapsed) .cb-sidebar__group-label{position:absolute;width:1px;height:1px;clip:rect(0,0,0,0)}.cb-sidebar__list,.cb-sidebar__sublist{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}.cb-sidebar__sublist{margin:2px 0 0 1.625rem;padding-left:.5rem;border-left:1px solid var(--cb-color-border)}.cb-sidebar__item{display:flex;align-items:center;gap:.75rem;width:100%;min-height:2.5rem;padding:.5rem .75rem;border:0;border-radius:var(--cb-radius-md, 8px);background:transparent;color:inherit;font:inherit;font-size:var(--cb-text-sm, .875rem);text-align:start;text-decoration:none;cursor:pointer}.cb-sidebar__item:hover:not(:disabled){background:var(--cb-color-surface-hover);color:var(--cb-color-text-strong)}.cb-sidebar__item:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:-2px}.cb-sidebar__item:disabled{cursor:not-allowed;opacity:.5}.cb-sidebar__item--active{background:color-mix(in srgb,var(--cb-color-primary) 12%,transparent);color:var(--cb-color-primary);font-weight:var(--cb-font-weight-semibold, 600)}.cb-sidebar__item--has-active{color:var(--cb-color-primary)}.cb-sidebar__icon{flex:none}.cb-sidebar__initial{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:var(--cb-radius-sm, 4px);background:var(--cb-color-surface-hover);font-size:.75rem;font-weight:var(--cb-font-weight-semibold, 600)}.cb-sidebar__label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cb-sidebar__badge{flex:none;min-width:1.25rem;padding:.0625rem .375rem;border-radius:var(--cb-radius-full, 999px);background:var(--cb-color-primary);color:var(--cb-color-primary-contrast);font-size:.6875rem;font-weight:var(--cb-font-weight-semibold, 600);text-align:center}.cb-sidebar__chevron{flex:none;transition:transform var(--cb-duration-fast, .15s) ease}.cb-sidebar__item[aria-expanded=true] .cb-sidebar__chevron{transform:rotate(180deg)}:host(.cb-sidebar--collapsed) .cb-sidebar__item{justify-content:center;padding-inline:0}:host(.cb-sidebar--collapsed) .cb-sidebar__label,:host(.cb-sidebar--collapsed) .cb-sidebar__chevron{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}:host(.cb-sidebar--collapsed) .cb-sidebar__badge{position:absolute;margin:-1.25rem -1.5rem 0 0;min-width:1rem;padding:0 .25rem;font-size:.625rem}.cb-sidebar__footer{display:flex;flex-direction:column;gap:.5rem;padding:.75rem;border-top:1px solid var(--cb-color-border)}.cb-sidebar__footer:empty{display:none}.cb-sidebar__collapse{display:inline-flex;align-items:center;justify-content:center;align-self:flex-end;width:2.25rem;height:2.25rem;border:0;border-radius:var(--cb-radius-md, 8px);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}:host(.cb-sidebar--collapsed) .cb-sidebar__collapse{align-self:center}.cb-sidebar__collapse:hover{background:var(--cb-color-surface-hover);color:var(--cb-color-text)}.cb-sidebar__collapse:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:2px}@media(prefers-reduced-motion:reduce){:host,.cb-sidebar__chevron{transition:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }, { kind: "directive", type: CbTooltipDirective, selector: "[cbTooltip]", inputs: ["cbTooltip", "cbTooltipPosition", "cbTooltipDisabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
248
|
+
}
|
|
249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSidebar, decorators: [{
|
|
250
|
+
type: Component,
|
|
251
|
+
args: [{ selector: 'cb-sidebar', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [NgTemplateOutlet, CbIcon, CbTooltipDirective], host: {
|
|
252
|
+
class: 'cb-sidebar',
|
|
253
|
+
'[class.cb-sidebar--collapsed]': 'isCollapsed()',
|
|
254
|
+
}, template: `
|
|
255
|
+
<nav class="cb-sidebar__nav" [attr.aria-label]="ariaLabel() ?? t().mainNavigation">
|
|
256
|
+
<div class="cb-sidebar__header"><ng-content select="[cb-sidebar-header]" /></div>
|
|
257
|
+
|
|
258
|
+
<div class="cb-sidebar__body">
|
|
259
|
+
@for (group of groups(); track $index; let g = $index) {
|
|
260
|
+
<div class="cb-sidebar__group">
|
|
261
|
+
@if (group.label) {
|
|
262
|
+
<div class="cb-sidebar__group-label" [id]="uid + '-g' + g">{{ group.label }}</div>
|
|
263
|
+
}
|
|
264
|
+
<ul class="cb-sidebar__list" role="list" [attr.aria-labelledby]="group.label ? uid + '-g' + g : null">
|
|
265
|
+
@for (item of group.items; track key(item)) {
|
|
266
|
+
<li>
|
|
267
|
+
@if (item.children?.length) {
|
|
268
|
+
<button
|
|
269
|
+
type="button"
|
|
270
|
+
class="cb-sidebar__item"
|
|
271
|
+
[class.cb-sidebar__item--has-active]="hasActiveChild(item)"
|
|
272
|
+
[disabled]="item.disabled"
|
|
273
|
+
[attr.aria-expanded]="isCollapsed() ? null : isExpanded(item)"
|
|
274
|
+
[attr.aria-controls]="isCollapsed() ? null : uid + '-' + key(item)"
|
|
275
|
+
[cbTooltip]="item.label"
|
|
276
|
+
cbTooltipPosition="right"
|
|
277
|
+
[cbTooltipDisabled]="!isCollapsed()"
|
|
278
|
+
(click)="toggleGroup(item)"
|
|
279
|
+
>
|
|
280
|
+
<ng-container *ngTemplateOutlet="content; context: { $implicit: item }" />
|
|
281
|
+
<cb-icon class="cb-sidebar__chevron" name="chevron-down" [size]="16" aria-hidden="true" />
|
|
282
|
+
</button>
|
|
283
|
+
@if (isExpanded(item) && !isCollapsed()) {
|
|
284
|
+
<ul class="cb-sidebar__sublist" role="list" [id]="uid + '-' + key(item)">
|
|
285
|
+
@for (child of item.children; track key(child)) {
|
|
286
|
+
<li>
|
|
287
|
+
<ng-container *ngTemplateOutlet="leaf; context: { $implicit: child }" />
|
|
288
|
+
</li>
|
|
289
|
+
}
|
|
290
|
+
</ul>
|
|
291
|
+
}
|
|
292
|
+
} @else {
|
|
293
|
+
<ng-container *ngTemplateOutlet="leaf; context: { $implicit: item }" />
|
|
294
|
+
}
|
|
295
|
+
</li>
|
|
296
|
+
}
|
|
297
|
+
</ul>
|
|
298
|
+
</div>
|
|
299
|
+
}
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
<div class="cb-sidebar__footer">
|
|
303
|
+
<ng-content select="[cb-sidebar-footer]" />
|
|
304
|
+
@if (collapsible() && !shell?.mobile()) {
|
|
305
|
+
<button
|
|
306
|
+
type="button"
|
|
307
|
+
class="cb-sidebar__collapse"
|
|
308
|
+
[attr.aria-label]="isCollapsed() ? t().expandSidebar : t().collapseSidebar"
|
|
309
|
+
[attr.aria-expanded]="!isCollapsed()"
|
|
310
|
+
[cbTooltip]="t().expandSidebar"
|
|
311
|
+
cbTooltipPosition="right"
|
|
312
|
+
[cbTooltipDisabled]="!isCollapsed()"
|
|
313
|
+
(click)="toggleCollapsed()"
|
|
314
|
+
>
|
|
315
|
+
<cb-icon [name]="isCollapsed() ? 'chevron-right' : 'chevron-left'" [size]="18" aria-hidden="true" />
|
|
316
|
+
</button>
|
|
317
|
+
}
|
|
318
|
+
</div>
|
|
319
|
+
</nav>
|
|
320
|
+
|
|
321
|
+
<ng-template #leaf let-item>
|
|
322
|
+
@if (item.url && !item.disabled) {
|
|
323
|
+
<a
|
|
324
|
+
class="cb-sidebar__item"
|
|
325
|
+
[class.cb-sidebar__item--active]="isActive(item)"
|
|
326
|
+
[href]="item.url"
|
|
327
|
+
[attr.target]="item.target || null"
|
|
328
|
+
[attr.aria-current]="isActive(item) ? 'page' : null"
|
|
329
|
+
[cbTooltip]="item.label"
|
|
330
|
+
cbTooltipPosition="right"
|
|
331
|
+
[cbTooltipDisabled]="!isCollapsed()"
|
|
332
|
+
(click)="select(item, $event)"
|
|
333
|
+
>
|
|
334
|
+
<ng-container *ngTemplateOutlet="content; context: { $implicit: item }" />
|
|
335
|
+
</a>
|
|
336
|
+
} @else {
|
|
337
|
+
<button
|
|
338
|
+
type="button"
|
|
339
|
+
class="cb-sidebar__item"
|
|
340
|
+
[class.cb-sidebar__item--active]="isActive(item)"
|
|
341
|
+
[disabled]="item.disabled"
|
|
342
|
+
[attr.aria-current]="isActive(item) ? 'page' : null"
|
|
343
|
+
[cbTooltip]="item.label"
|
|
344
|
+
cbTooltipPosition="right"
|
|
345
|
+
[cbTooltipDisabled]="!isCollapsed()"
|
|
346
|
+
(click)="select(item, $event)"
|
|
347
|
+
>
|
|
348
|
+
<ng-container *ngTemplateOutlet="content; context: { $implicit: item }" />
|
|
349
|
+
</button>
|
|
350
|
+
}
|
|
351
|
+
</ng-template>
|
|
352
|
+
|
|
353
|
+
<ng-template #content let-item>
|
|
354
|
+
@if (item.icon) {
|
|
355
|
+
<cb-icon class="cb-sidebar__icon" [name]="item.icon" [size]="20" aria-hidden="true" />
|
|
356
|
+
} @else {
|
|
357
|
+
<span class="cb-sidebar__icon cb-sidebar__initial" aria-hidden="true">{{ item.label.charAt(0) }}</span>
|
|
358
|
+
}
|
|
359
|
+
<span class="cb-sidebar__label">{{ item.label }}</span>
|
|
360
|
+
@if (item.badge !== undefined && item.badge !== '') {
|
|
361
|
+
<span class="cb-sidebar__badge">{{ item.badge }}</span>
|
|
362
|
+
}
|
|
363
|
+
</ng-template>
|
|
364
|
+
`, styles: [":host{display:block;width:var(--cb-sidebar-width, 16rem);height:100%;border-right:1px solid var(--cb-color-border);background:var(--cb-color-surface);color:var(--cb-color-text);font-family:var(--cb-font-sans);transition:width var(--cb-duration-normal, .2s) ease}:host(.cb-sidebar--collapsed){width:var(--cb-sidebar-collapsed-width, 4.5rem)}.cb-sidebar__nav{display:flex;flex-direction:column;height:100%}.cb-sidebar__header:not(:empty){display:flex;align-items:center;min-height:3.5rem;padding:.75rem 1rem;overflow:hidden}.cb-sidebar__body{flex:1;overflow-x:hidden;overflow-y:auto;padding:.5rem .75rem}.cb-sidebar__group+.cb-sidebar__group{margin-top:1rem}.cb-sidebar__group-label{padding:.25rem .75rem;overflow:hidden;color:var(--cb-color-text-muted);font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-semibold, 600);letter-spacing:.02em;text-transform:uppercase;white-space:nowrap}:host(.cb-sidebar--collapsed) .cb-sidebar__group-label{position:absolute;width:1px;height:1px;clip:rect(0,0,0,0)}.cb-sidebar__list,.cb-sidebar__sublist{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}.cb-sidebar__sublist{margin:2px 0 0 1.625rem;padding-left:.5rem;border-left:1px solid var(--cb-color-border)}.cb-sidebar__item{display:flex;align-items:center;gap:.75rem;width:100%;min-height:2.5rem;padding:.5rem .75rem;border:0;border-radius:var(--cb-radius-md, 8px);background:transparent;color:inherit;font:inherit;font-size:var(--cb-text-sm, .875rem);text-align:start;text-decoration:none;cursor:pointer}.cb-sidebar__item:hover:not(:disabled){background:var(--cb-color-surface-hover);color:var(--cb-color-text-strong)}.cb-sidebar__item:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:-2px}.cb-sidebar__item:disabled{cursor:not-allowed;opacity:.5}.cb-sidebar__item--active{background:color-mix(in srgb,var(--cb-color-primary) 12%,transparent);color:var(--cb-color-primary);font-weight:var(--cb-font-weight-semibold, 600)}.cb-sidebar__item--has-active{color:var(--cb-color-primary)}.cb-sidebar__icon{flex:none}.cb-sidebar__initial{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:var(--cb-radius-sm, 4px);background:var(--cb-color-surface-hover);font-size:.75rem;font-weight:var(--cb-font-weight-semibold, 600)}.cb-sidebar__label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cb-sidebar__badge{flex:none;min-width:1.25rem;padding:.0625rem .375rem;border-radius:var(--cb-radius-full, 999px);background:var(--cb-color-primary);color:var(--cb-color-primary-contrast);font-size:.6875rem;font-weight:var(--cb-font-weight-semibold, 600);text-align:center}.cb-sidebar__chevron{flex:none;transition:transform var(--cb-duration-fast, .15s) ease}.cb-sidebar__item[aria-expanded=true] .cb-sidebar__chevron{transform:rotate(180deg)}:host(.cb-sidebar--collapsed) .cb-sidebar__item{justify-content:center;padding-inline:0}:host(.cb-sidebar--collapsed) .cb-sidebar__label,:host(.cb-sidebar--collapsed) .cb-sidebar__chevron{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}:host(.cb-sidebar--collapsed) .cb-sidebar__badge{position:absolute;margin:-1.25rem -1.5rem 0 0;min-width:1rem;padding:0 .25rem;font-size:.625rem}.cb-sidebar__footer{display:flex;flex-direction:column;gap:.5rem;padding:.75rem;border-top:1px solid var(--cb-color-border)}.cb-sidebar__footer:empty{display:none}.cb-sidebar__collapse{display:inline-flex;align-items:center;justify-content:center;align-self:flex-end;width:2.25rem;height:2.25rem;border:0;border-radius:var(--cb-radius-md, 8px);background:transparent;color:var(--cb-color-text-muted);cursor:pointer}:host(.cb-sidebar--collapsed) .cb-sidebar__collapse{align-self:center}.cb-sidebar__collapse:hover{background:var(--cb-color-surface-hover);color:var(--cb-color-text)}.cb-sidebar__collapse:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:2px}@media(prefers-reduced-motion:reduce){:host,.cb-sidebar__chevron{transition:none}}\n"] }]
|
|
365
|
+
}], ctorParameters: () => [], propDecorators: { groups: [{ type: i0.Input, args: [{ isSignal: true, alias: "groups", required: false }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }, { type: i0.Output, args: ["activeChange"] }], collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], collapsible: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsible", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], navigate: [{ type: i0.Input, args: [{ isSignal: true, alias: "navigate", required: false }] }], itemSelect: [{ type: i0.Output, args: ["itemSelect"] }] } });
|
|
366
|
+
|
|
367
|
+
let nextUid = 0;
|
|
368
|
+
const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
369
|
+
/**
|
|
370
|
+
* Esqueleto de aplicación de CaribeNG: menú lateral, cabecera y contenido.
|
|
371
|
+
* En escritorio el sidebar es una columna que se puede contraer; por debajo de
|
|
372
|
+
* `breakpoint` (medido en el propio shell) pasa a ser un panel deslizante con
|
|
373
|
+
* fondo, cierre con Escape y foco atrapado mientras está abierto.
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```html
|
|
377
|
+
* <cb-app-shell style="height: 100vh">
|
|
378
|
+
* <cb-sidebar [groups]="menu" />
|
|
379
|
+
* <header cb-app-shell-header>
|
|
380
|
+
* <button type="button" cbSidebarToggle><cb-icon name="menu" /></button>
|
|
381
|
+
* </header>
|
|
382
|
+
* <router-outlet />
|
|
383
|
+
* </cb-app-shell>
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
class CbAppShell {
|
|
387
|
+
constructor() {
|
|
388
|
+
this.host = inject(ElementRef);
|
|
389
|
+
this.document = inject(DOCUMENT);
|
|
390
|
+
this.injector = inject(Injector);
|
|
391
|
+
this.destroyRef = inject(DestroyRef);
|
|
392
|
+
this.previouslyFocused = null;
|
|
393
|
+
this.sidebarId = `cb-app-shell-sidebar-${++nextUid}`;
|
|
394
|
+
/** Ancho (px) del shell por debajo del cual el sidebar es un panel deslizante. */
|
|
395
|
+
this.breakpoint = input(768, /* @ts-ignore */
|
|
396
|
+
...(ngDevMode ? [{ debugName: "breakpoint" }] : /* istanbul ignore next */ []));
|
|
397
|
+
/** Panel abierto en móvil. */
|
|
398
|
+
this.sidebarOpen = model(false, /* @ts-ignore */
|
|
399
|
+
...(ngDevMode ? [{ debugName: "sidebarOpen" }] : /* istanbul ignore next */ []));
|
|
400
|
+
/** Sidebar contraído a iconos en escritorio. */
|
|
401
|
+
this.collapsed = model(false, /* @ts-ignore */
|
|
402
|
+
...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
|
|
403
|
+
/** Fuerza el modo móvil (útil en pruebas o vistas embebidas). */
|
|
404
|
+
this.forceMobile = input(false, { ...(ngDevMode ? { debugName: "forceMobile" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
405
|
+
this.width = signal(null, /* @ts-ignore */
|
|
406
|
+
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
407
|
+
this.mobile = computed(() => {
|
|
408
|
+
if (this.forceMobile())
|
|
409
|
+
return true;
|
|
410
|
+
const width = this.width();
|
|
411
|
+
return width !== null && width < this.breakpoint();
|
|
412
|
+
}, /* @ts-ignore */
|
|
413
|
+
...(ngDevMode ? [{ debugName: "mobile" }] : /* istanbul ignore next */ []));
|
|
414
|
+
afterNextRender(() => {
|
|
415
|
+
const el = this.host.nativeElement;
|
|
416
|
+
this.width.set(el.getBoundingClientRect().width);
|
|
417
|
+
const view = this.document.defaultView;
|
|
418
|
+
if (!view?.ResizeObserver)
|
|
419
|
+
return;
|
|
420
|
+
const observer = new view.ResizeObserver((entries) => this.width.set(entries[0].contentRect.width));
|
|
421
|
+
observer.observe(el);
|
|
422
|
+
this.destroyRef.onDestroy(() => observer.disconnect());
|
|
423
|
+
});
|
|
424
|
+
// Al abrir el panel móvil se enfoca su primer control; al cerrarlo, vuelve el foco.
|
|
425
|
+
effect(() => {
|
|
426
|
+
const open = this.mobile() && this.sidebarOpen();
|
|
427
|
+
untracked(() => {
|
|
428
|
+
if (open) {
|
|
429
|
+
this.previouslyFocused = this.document.activeElement;
|
|
430
|
+
afterNextRender(() => this.host.nativeElement.querySelector(`#${this.sidebarId}`)?.querySelector(FOCUSABLE)?.focus(), { injector: this.injector });
|
|
431
|
+
}
|
|
432
|
+
else if (this.previouslyFocused) {
|
|
433
|
+
const target = this.previouslyFocused;
|
|
434
|
+
this.previouslyFocused = null;
|
|
435
|
+
if (target.isConnected)
|
|
436
|
+
afterNextRender(() => target.focus(), { injector: this.injector });
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
// Al pasar a escritorio no queda un panel "abierto" colgado.
|
|
441
|
+
effect(() => {
|
|
442
|
+
if (!this.mobile())
|
|
443
|
+
untracked(() => this.sidebarOpen.set(false));
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
toggle() {
|
|
447
|
+
if (this.mobile())
|
|
448
|
+
this.sidebarOpen.update((open) => !open);
|
|
449
|
+
else
|
|
450
|
+
this.collapsed.update((collapsed) => !collapsed);
|
|
451
|
+
}
|
|
452
|
+
setCollapsed(collapsed) {
|
|
453
|
+
this.collapsed.set(collapsed);
|
|
454
|
+
}
|
|
455
|
+
closeSidebar() {
|
|
456
|
+
if (this.mobile())
|
|
457
|
+
this.sidebarOpen.set(false);
|
|
458
|
+
}
|
|
459
|
+
onEscape(event) {
|
|
460
|
+
if (!this.mobile() || !this.sidebarOpen())
|
|
461
|
+
return;
|
|
462
|
+
event.preventDefault();
|
|
463
|
+
this.closeSidebar();
|
|
464
|
+
}
|
|
465
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbAppShell, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
466
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbAppShell, isStandalone: true, selector: "cb-app-shell", inputs: { breakpoint: { classPropertyName: "breakpoint", publicName: "breakpoint", isSignal: true, isRequired: false, transformFunction: null }, sidebarOpen: { classPropertyName: "sidebarOpen", publicName: "sidebarOpen", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, forceMobile: { classPropertyName: "forceMobile", publicName: "forceMobile", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sidebarOpen: "sidebarOpenChange", collapsed: "collapsedChange" }, host: { properties: { "class.cb-app-shell--mobile": "mobile()", "class.cb-app-shell--open": "mobile() && sidebarOpen()", "class.cb-app-shell--collapsed": "!mobile() && collapsed()" }, classAttribute: "cb-app-shell" }, providers: [{ provide: CB_APP_SHELL, useExisting: forwardRef(() => CbAppShell) }], ngImport: i0, template: `
|
|
467
|
+
<div
|
|
468
|
+
class="cb-app-shell__sidebar"
|
|
469
|
+
[id]="sidebarId"
|
|
470
|
+
[attr.inert]="mobile() && !sidebarOpen() ? '' : null"
|
|
471
|
+
[cdkTrapFocus]="mobile() && sidebarOpen()"
|
|
472
|
+
(keydown.escape)="onEscape($event)"
|
|
473
|
+
>
|
|
474
|
+
<ng-content select="cb-sidebar, [cb-app-shell-sidebar]" />
|
|
475
|
+
</div>
|
|
476
|
+
@if (mobile() && sidebarOpen()) {
|
|
477
|
+
<div class="cb-app-shell__backdrop" aria-hidden="true" (click)="closeSidebar()"></div>
|
|
478
|
+
}
|
|
479
|
+
<div class="cb-app-shell__main">
|
|
480
|
+
<ng-content select="[cb-app-shell-header]" />
|
|
481
|
+
<div class="cb-app-shell__content"><ng-content /></div>
|
|
482
|
+
</div>
|
|
483
|
+
`, isInline: true, styles: [":host{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr);height:100%;min-height:0;overflow:hidden;background:var(--cb-color-bg, var(--cb-color-surface-raised));color:var(--cb-color-text);font-family:var(--cb-font-sans)}.cb-app-shell__sidebar{height:100%;min-height:0}.cb-app-shell__main{display:flex;flex-direction:column;min-width:0;min-height:0}.cb-app-shell__content{flex:1;min-height:0;overflow:auto}:host(.cb-app-shell--mobile){grid-template-columns:minmax(0,1fr)}:host(.cb-app-shell--mobile) .cb-app-shell__sidebar{position:absolute;inset-block:0;left:0;z-index:20;max-width:calc(100% - 3rem);transform:translate(-100%);visibility:hidden;transition:transform var(--cb-duration-normal, .2s) ease,visibility 0s linear var(--cb-duration-normal, .2s)}:host(.cb-app-shell--open) .cb-app-shell__sidebar{transform:none;visibility:visible;box-shadow:var(--cb-shadow-lg);transition:transform var(--cb-duration-normal, .2s) ease}.cb-app-shell__backdrop{position:absolute;inset:0;z-index:15;background:var(--cb-color-overlay, rgb(2 6 23 / .5))}@media(prefers-reduced-motion:reduce){:host(.cb-app-shell--mobile) .cb-app-shell__sidebar{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
484
|
+
}
|
|
485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbAppShell, decorators: [{
|
|
486
|
+
type: Component,
|
|
487
|
+
args: [{ selector: 'cb-app-shell', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [A11yModule], providers: [{ provide: CB_APP_SHELL, useExisting: forwardRef(() => CbAppShell) }], host: {
|
|
488
|
+
class: 'cb-app-shell',
|
|
489
|
+
'[class.cb-app-shell--mobile]': 'mobile()',
|
|
490
|
+
'[class.cb-app-shell--open]': 'mobile() && sidebarOpen()',
|
|
491
|
+
'[class.cb-app-shell--collapsed]': '!mobile() && collapsed()',
|
|
492
|
+
}, template: `
|
|
493
|
+
<div
|
|
494
|
+
class="cb-app-shell__sidebar"
|
|
495
|
+
[id]="sidebarId"
|
|
496
|
+
[attr.inert]="mobile() && !sidebarOpen() ? '' : null"
|
|
497
|
+
[cdkTrapFocus]="mobile() && sidebarOpen()"
|
|
498
|
+
(keydown.escape)="onEscape($event)"
|
|
499
|
+
>
|
|
500
|
+
<ng-content select="cb-sidebar, [cb-app-shell-sidebar]" />
|
|
501
|
+
</div>
|
|
502
|
+
@if (mobile() && sidebarOpen()) {
|
|
503
|
+
<div class="cb-app-shell__backdrop" aria-hidden="true" (click)="closeSidebar()"></div>
|
|
504
|
+
}
|
|
505
|
+
<div class="cb-app-shell__main">
|
|
506
|
+
<ng-content select="[cb-app-shell-header]" />
|
|
507
|
+
<div class="cb-app-shell__content"><ng-content /></div>
|
|
508
|
+
</div>
|
|
509
|
+
`, styles: [":host{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr);height:100%;min-height:0;overflow:hidden;background:var(--cb-color-bg, var(--cb-color-surface-raised));color:var(--cb-color-text);font-family:var(--cb-font-sans)}.cb-app-shell__sidebar{height:100%;min-height:0}.cb-app-shell__main{display:flex;flex-direction:column;min-width:0;min-height:0}.cb-app-shell__content{flex:1;min-height:0;overflow:auto}:host(.cb-app-shell--mobile){grid-template-columns:minmax(0,1fr)}:host(.cb-app-shell--mobile) .cb-app-shell__sidebar{position:absolute;inset-block:0;left:0;z-index:20;max-width:calc(100% - 3rem);transform:translate(-100%);visibility:hidden;transition:transform var(--cb-duration-normal, .2s) ease,visibility 0s linear var(--cb-duration-normal, .2s)}:host(.cb-app-shell--open) .cb-app-shell__sidebar{transform:none;visibility:visible;box-shadow:var(--cb-shadow-lg);transition:transform var(--cb-duration-normal, .2s) ease}.cb-app-shell__backdrop{position:absolute;inset:0;z-index:15;background:var(--cb-color-overlay, rgb(2 6 23 / .5))}@media(prefers-reduced-motion:reduce){:host(.cb-app-shell--mobile) .cb-app-shell__sidebar{transition:none}}\n"] }]
|
|
510
|
+
}], ctorParameters: () => [], propDecorators: { breakpoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "breakpoint", required: false }] }], sidebarOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "sidebarOpen", required: false }] }, { type: i0.Output, args: ["sidebarOpenChange"] }], collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], forceMobile: [{ type: i0.Input, args: [{ isSignal: true, alias: "forceMobile", required: false }] }] } });
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Convierte cualquier botón en el control del sidebar de `cb-app-shell`: en
|
|
514
|
+
* móvil abre o cierra el panel; en escritorio contrae o expande. Gestiona
|
|
515
|
+
* `aria-controls`, `aria-expanded` y un nombre accesible por defecto.
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```html
|
|
519
|
+
* <button type="button" cbSidebarToggle><cb-icon name="menu" aria-hidden="true" /></button>
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
class CbSidebarToggle {
|
|
523
|
+
constructor() {
|
|
524
|
+
this.t = injectCbTranslation();
|
|
525
|
+
this.shell = inject(CB_APP_SHELL, { optional: true });
|
|
526
|
+
/** Nombre accesible. Por defecto, "Abrir menú" (móvil) o "Contraer/Expandir menú lateral". */
|
|
527
|
+
this.cbSidebarToggle = input('', /* @ts-ignore */
|
|
528
|
+
...(ngDevMode ? [{ debugName: "cbSidebarToggle" }] : /* istanbul ignore next */ []));
|
|
529
|
+
this.expanded = computed(() => {
|
|
530
|
+
const shell = this.shell;
|
|
531
|
+
if (!shell)
|
|
532
|
+
return null;
|
|
533
|
+
return shell.mobile() ? shell.sidebarOpen() : !shell.collapsed();
|
|
534
|
+
}, /* @ts-ignore */
|
|
535
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
536
|
+
this.label = computed(() => {
|
|
537
|
+
const custom = this.cbSidebarToggle();
|
|
538
|
+
if (custom)
|
|
539
|
+
return custom;
|
|
540
|
+
const shell = this.shell;
|
|
541
|
+
if (!shell)
|
|
542
|
+
return null;
|
|
543
|
+
if (shell.mobile())
|
|
544
|
+
return this.t().openMenu;
|
|
545
|
+
return shell.collapsed() ? this.t().expandSidebar : this.t().collapseSidebar;
|
|
546
|
+
}, /* @ts-ignore */
|
|
547
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
548
|
+
}
|
|
549
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSidebarToggle, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
550
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: CbSidebarToggle, isStandalone: true, selector: "[cbSidebarToggle]", inputs: { cbSidebarToggle: { classPropertyName: "cbSidebarToggle", publicName: "cbSidebarToggle", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "shell?.toggle()" }, properties: { "attr.aria-controls": "shell?.sidebarId ?? null", "attr.aria-expanded": "expanded()", "attr.aria-label": "label()" } }, ngImport: i0 }); }
|
|
551
|
+
}
|
|
552
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbSidebarToggle, decorators: [{
|
|
553
|
+
type: Directive,
|
|
554
|
+
args: [{
|
|
555
|
+
selector: '[cbSidebarToggle]',
|
|
556
|
+
host: {
|
|
557
|
+
'(click)': 'shell?.toggle()',
|
|
558
|
+
'[attr.aria-controls]': 'shell?.sidebarId ?? null',
|
|
559
|
+
'[attr.aria-expanded]': 'expanded()',
|
|
560
|
+
'[attr.aria-label]': 'label()',
|
|
561
|
+
},
|
|
562
|
+
}]
|
|
563
|
+
}], propDecorators: { cbSidebarToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "cbSidebarToggle", required: false }] }] } });
|
|
564
|
+
|
|
565
|
+
/*
|
|
566
|
+
* Public API Surface de @caribeng/ui/sidebar
|
|
567
|
+
*/
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Generated bundle index. Do not edit.
|
|
571
|
+
*/
|
|
572
|
+
|
|
573
|
+
export { CB_APP_SHELL, CbAppShell, CbSidebar, CbSidebarToggle, cbSidebarKey };
|