@ukic/web-components 3.1.0 → 3.3.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 +28 -0
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/{helpers-a0a128bd.js → helpers-fc4016d2.js} +36 -73
- package/dist/cjs/helpers-fc4016d2.js.map +1 -0
- package/dist/cjs/ic-accordion-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-accordion-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ic-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-alert.cjs.entry.js +63 -36
- package/dist/cjs/ic-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-back-to-top.cjs.entry.js +4 -4
- package/dist/cjs/ic-badge.cjs.entry.js +41 -17
- package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +56 -76
- package/dist/cjs/ic-breadcrumb-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-breadcrumb.cjs.entry.js +32 -51
- package/dist/cjs/ic-breadcrumb.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js +135 -131
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-card-vertical.cjs.entry.js +6 -6
- package/dist/cjs/ic-card-vertical.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-checkbox-group.cjs.entry.js +9 -10
- package/dist/cjs/ic-checkbox-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-checkbox.cjs.entry.js +35 -34
- package/dist/cjs/ic-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-chip.cjs.entry.js +26 -38
- package/dist/cjs/ic-chip.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-classification-banner.cjs.entry.js +2 -2
- package/dist/cjs/ic-data-list.cjs.entry.js +2 -2
- package/dist/cjs/ic-data-row.cjs.entry.js +3 -3
- package/dist/cjs/ic-dialog.cjs.entry.js +3 -3
- package/dist/cjs/ic-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-divider.cjs.entry.js +2 -2
- package/dist/cjs/ic-divider.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-empty-state.cjs.entry.js +3 -3
- package/dist/cjs/ic-footer-link-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-footer-link-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-footer-link.cjs.entry.js +3 -3
- package/dist/cjs/ic-footer.cjs.entry.js +4 -4
- package/dist/cjs/ic-hero.cjs.entry.js +5 -5
- package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +6 -6
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js +9 -9
- package/dist/cjs/ic-input-label_2.cjs.entry.js +8 -8
- package/dist/cjs/ic-link.cjs.entry.js +21 -3
- package/dist/cjs/ic-link.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-menu-group.cjs.entry.js +2 -2
- package/dist/cjs/ic-menu-item.cjs.entry.js +5 -5
- package/dist/cjs/ic-menu-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-button.cjs.entry.js +3 -3
- package/dist/cjs/ic-navigation-group.cjs.entry.js +3 -3
- package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js +12 -7
- package/dist/cjs/ic-navigation-item.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-navigation-menu.cjs.entry.js +5 -5
- package/dist/cjs/ic-page-header.cjs.entry.js +7 -7
- package/dist/cjs/ic-pagination-item.cjs.entry.js +2 -2
- package/dist/cjs/ic-pagination.cjs.entry.js +5 -5
- package/dist/cjs/ic-popover-menu.cjs.entry.js +8 -7
- package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-radio-group.cjs.entry.js +5 -5
- package/dist/cjs/ic-radio-option.cjs.entry.js +6 -6
- package/dist/cjs/ic-radio-option.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-search-bar.cjs.entry.js +112 -135
- package/dist/cjs/ic-search-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-section-container.cjs.entry.js +2 -2
- package/dist/cjs/ic-select.cjs.entry.js +47 -50
- package/dist/cjs/ic-select.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-side-navigation.cjs.entry.js +6 -6
- package/dist/cjs/ic-side-navigation.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/ic-skip-link.cjs.entry.js +10 -3
- package/dist/cjs/ic-skip-link.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-status-tag.cjs.entry.js +3 -3
- package/dist/cjs/ic-status-tag.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-step.cjs.entry.js +15 -15
- package/dist/cjs/ic-step.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-stepper.cjs.entry.js +3 -3
- package/dist/cjs/ic-switch.cjs.entry.js +6 -6
- package/dist/cjs/ic-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-tab-context.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-group.cjs.entry.js +3 -3
- package/dist/cjs/ic-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/ic-tab.cjs.entry.js +3 -3
- package/dist/cjs/ic-text-field.cjs.entry.js +32 -29
- package/dist/cjs/ic-text-field.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-theme.cjs.entry.js +4 -2
- package/dist/cjs/ic-theme.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-toast-region.cjs.entry.js +1 -1
- package/dist/cjs/ic-toast.cjs.entry.js +4 -4
- package/dist/cjs/ic-toggle-button-group.cjs.entry.js +3 -3
- package/dist/cjs/ic-toggle-button.cjs.entry.js +4 -4
- package/dist/cjs/ic-toggle-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-top-navigation.cjs.entry.js +5 -5
- package/dist/cjs/ic-top-navigation.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-typography.cjs.entry.js +4 -4
- package/dist/cjs/ic-typography.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ic-accordion/ic-accordion.css +3 -0
- package/dist/collection/components/ic-accordion-group/ic-accordion-group.css +1 -0
- package/dist/collection/components/ic-alert/ic-alert.css +3 -1
- package/dist/collection/components/ic-alert/ic-alert.js +85 -50
- package/dist/collection/components/ic-alert/ic-alert.js.map +1 -1
- package/dist/collection/components/ic-back-to-top/ic-back-to-top.js +3 -3
- package/dist/collection/components/ic-badge/ic-badge.css +1 -1
- package/dist/collection/components/ic-badge/ic-badge.js +39 -15
- package/dist/collection/components/ic-badge/ic-badge.js.map +1 -1
- package/dist/collection/components/ic-breadcrumb/ic-breadcrumb.js +40 -59
- package/dist/collection/components/ic-breadcrumb/ic-breadcrumb.js.map +1 -1
- package/dist/collection/components/ic-breadcrumb-group/ic-breadcrumb-group.js +65 -86
- package/dist/collection/components/ic-breadcrumb-group/ic-breadcrumb-group.js.map +1 -1
- package/dist/collection/components/ic-button/ic-button.css +123 -59
- package/dist/collection/components/ic-button/ic-button.js +141 -162
- package/dist/collection/components/ic-button/ic-button.js.map +1 -1
- package/dist/collection/components/ic-button/ic-button.stories.js +39 -54
- package/dist/collection/components/ic-card-vertical/ic-card-vertical.css +20 -4
- package/dist/collection/components/ic-card-vertical/ic-card-vertical.js +4 -4
- package/dist/collection/components/ic-checkbox/ic-checkbox.css +3 -1
- package/dist/collection/components/ic-checkbox/ic-checkbox.js +71 -73
- package/dist/collection/components/ic-checkbox/ic-checkbox.js.map +1 -1
- package/dist/collection/components/ic-checkbox-group/ic-checkbox-group.js +24 -25
- package/dist/collection/components/ic-checkbox-group/ic-checkbox-group.js.map +1 -1
- package/dist/collection/components/ic-chip/ic-chip.css +9 -0
- package/dist/collection/components/ic-chip/ic-chip.js +66 -72
- package/dist/collection/components/ic-chip/ic-chip.js.map +1 -1
- package/dist/collection/components/ic-chip/ic-chip.stories.js +2 -1
- package/dist/collection/components/ic-classification-banner/ic-classification-banner.js +2 -2
- package/dist/collection/components/ic-data-list/ic-data-list.js +2 -2
- package/dist/collection/components/ic-data-row/ic-data-row.js +2 -2
- package/dist/collection/components/ic-dialog/ic-dialog.css +2 -1
- package/dist/collection/components/ic-dialog/ic-dialog.js +1 -1
- package/dist/collection/components/ic-divider/ic-divider.css +7 -4
- package/dist/collection/components/ic-empty-state/ic-empty-state.js +2 -2
- package/dist/collection/components/ic-footer/ic-footer.js +3 -3
- package/dist/collection/components/ic-footer-link/ic-footer-link.js +2 -2
- package/dist/collection/components/ic-footer-link-group/ic-footer-link-group.css +0 -3
- package/dist/collection/components/ic-hero/ic-hero.js +4 -4
- package/dist/collection/components/ic-horizontal-scroll/ic-horizontal-scroll.js +5 -5
- package/dist/collection/components/ic-input-component-container/ic-input-component-container.js +3 -3
- package/dist/collection/components/ic-input-container/ic-input-container.js +2 -2
- package/dist/collection/components/ic-input-label/ic-input-label.js +4 -4
- package/dist/collection/components/ic-input-validation/ic-input-validation.js +3 -3
- package/dist/collection/components/ic-link/ic-link.js +23 -2
- package/dist/collection/components/ic-link/ic-link.js.map +1 -1
- package/dist/collection/components/ic-link/ic-link.stories.js +28 -5
- package/dist/collection/components/ic-loading-indicator/ic-loading-indicator.js +3 -3
- package/dist/collection/components/ic-menu/ic-menu.js +3 -3
- package/dist/collection/components/ic-menu-group/ic-menu-group.js +1 -1
- package/dist/collection/components/ic-menu-item/ic-menu-item.css +2 -5
- package/dist/collection/components/ic-menu-item/ic-menu-item.js +3 -3
- package/dist/collection/components/ic-menu-item/ic-menu-item.js.map +1 -1
- package/dist/collection/components/ic-navigation-button/ic-navigation-button.js +2 -2
- package/dist/collection/components/ic-navigation-group/ic-navigation-group.css +0 -4
- package/dist/collection/components/ic-navigation-group/ic-navigation-group.js +1 -1
- package/dist/collection/components/ic-navigation-item/ic-navigation-item.css +20 -1
- package/dist/collection/components/ic-navigation-item/ic-navigation-item.js +11 -6
- package/dist/collection/components/ic-navigation-item/ic-navigation-item.js.map +1 -1
- package/dist/collection/components/ic-navigation-menu/ic-navigation-menu.js +4 -4
- package/dist/collection/components/ic-page-header/ic-page-header.js +6 -6
- package/dist/collection/components/ic-pagination/ic-pagination.js +4 -4
- package/dist/collection/components/ic-pagination-item/ic-pagination-item.js +1 -1
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.css +0 -5
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.js +6 -5
- package/dist/collection/components/ic-popover-menu/ic-popover-menu.js.map +1 -1
- package/dist/collection/components/ic-radio-group/ic-radio-group.js +4 -4
- package/dist/collection/components/ic-radio-option/ic-radio-option.css +2 -1
- package/dist/collection/components/ic-radio-option/ic-radio-option.js +4 -4
- package/dist/collection/components/ic-search-bar/ic-search-bar.js +169 -192
- package/dist/collection/components/ic-search-bar/ic-search-bar.js.map +1 -1
- package/dist/collection/components/ic-section-container/ic-section-container.js +2 -2
- package/dist/collection/components/ic-select/ic-select.js +46 -49
- package/dist/collection/components/ic-select/ic-select.js.map +1 -1
- package/dist/collection/components/ic-side-navigation/ic-side-navigation.css +3 -2
- package/dist/collection/components/ic-side-navigation/ic-side-navigation.js +4 -4
- package/dist/collection/components/ic-side-navigation/ic-side-navigation.js.map +1 -1
- package/dist/collection/components/ic-skeleton/ic-skeleton.js +2 -2
- package/dist/collection/components/ic-skip-link/ic-skip-link.js +31 -3
- package/dist/collection/components/ic-skip-link/ic-skip-link.js.map +1 -1
- package/dist/collection/components/ic-status-tag/ic-status-tag.css +6 -0
- package/dist/collection/components/ic-status-tag/ic-status-tag.js +2 -2
- package/dist/collection/components/ic-step/ic-step.css +0 -3
- package/dist/collection/components/ic-step/ic-step.js +13 -13
- package/dist/collection/components/ic-stepper/ic-stepper.js +2 -2
- package/dist/collection/components/ic-switch/ic-switch.js +5 -5
- package/dist/collection/components/ic-switch/ic-switch.js.map +1 -1
- package/dist/collection/components/ic-tab/ic-tab.js +2 -2
- package/dist/collection/components/ic-tab-context/ic-tab-context.js +1 -1
- package/dist/collection/components/ic-tab-group/ic-tab-group.js +2 -2
- package/dist/collection/components/ic-tab-panel/ic-tab-panel.js +2 -2
- package/dist/collection/components/ic-text-field/ic-text-field.js +112 -95
- package/dist/collection/components/ic-text-field/ic-text-field.js.map +1 -1
- package/dist/collection/components/ic-theme/ic-theme.js +31 -3
- package/dist/collection/components/ic-theme/ic-theme.js.map +1 -1
- package/dist/collection/components/ic-toast/ic-toast.js +3 -3
- package/dist/collection/components/ic-toast-region/ic-toast-region.js +1 -1
- package/dist/collection/components/ic-toggle-button/ic-toggle-button.css +6 -8
- package/dist/collection/components/ic-toggle-button/ic-toggle-button.js +2 -2
- package/dist/collection/components/ic-toggle-button-group/ic-toggle-button-group.js +2 -2
- package/dist/collection/components/ic-tooltip/ic-tooltip.js +32 -2
- package/dist/collection/components/ic-tooltip/ic-tooltip.js.map +1 -1
- package/dist/collection/components/ic-top-navigation/ic-top-navigation.css +3 -1
- package/dist/collection/components/ic-top-navigation/ic-top-navigation.js +4 -4
- package/dist/collection/components/ic-top-navigation/ic-top-navigation.js.map +1 -1
- package/dist/collection/components/ic-typography/ic-typography.css +2 -2
- package/dist/collection/components/ic-typography/ic-typography.js +2 -2
- package/dist/collection/utils/helpers.js +35 -72
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/collection/utils/types.js.map +1 -1
- package/dist/components/helpers.js +36 -73
- package/dist/components/helpers.js.map +1 -1
- package/dist/components/ic-accordion-group.js.map +1 -1
- package/dist/components/ic-accordion.js.map +1 -1
- package/dist/components/ic-alert.js +66 -37
- package/dist/components/ic-alert.js.map +1 -1
- package/dist/components/ic-back-to-top.js +3 -3
- package/dist/components/ic-badge.js +40 -16
- package/dist/components/ic-badge.js.map +1 -1
- package/dist/components/ic-breadcrumb-group.js +57 -78
- package/dist/components/ic-breadcrumb-group.js.map +1 -1
- package/dist/components/ic-breadcrumb2.js +32 -51
- package/dist/components/ic-breadcrumb2.js.map +1 -1
- package/dist/components/ic-button2.js +105 -126
- package/dist/components/ic-button2.js.map +1 -1
- package/dist/components/ic-card-vertical.js +5 -5
- package/dist/components/ic-card-vertical.js.map +1 -1
- package/dist/components/ic-checkbox-group.js +9 -10
- package/dist/components/ic-checkbox-group.js.map +1 -1
- package/dist/components/ic-checkbox.js +37 -36
- package/dist/components/ic-checkbox.js.map +1 -1
- package/dist/components/ic-chip.js +28 -40
- package/dist/components/ic-chip.js.map +1 -1
- package/dist/components/ic-classification-banner.js +2 -2
- package/dist/components/ic-data-list.js +2 -2
- package/dist/components/ic-data-row.js +3 -3
- package/dist/components/ic-dialog.js +2 -2
- package/dist/components/ic-dialog.js.map +1 -1
- package/dist/components/ic-divider2.js +2 -2
- package/dist/components/ic-divider2.js.map +1 -1
- package/dist/components/ic-empty-state.js +2 -2
- package/dist/components/ic-footer-link-group.js +1 -1
- package/dist/components/ic-footer-link-group.js.map +1 -1
- package/dist/components/ic-footer-link.js +2 -2
- package/dist/components/ic-footer.js +4 -4
- package/dist/components/ic-hero.js +5 -5
- package/dist/components/ic-horizontal-scroll2.js +6 -6
- package/dist/components/ic-input-component-container2.js +4 -4
- package/dist/components/ic-input-container2.js +2 -2
- package/dist/components/ic-input-label2.js +5 -5
- package/dist/components/ic-input-validation2.js +4 -4
- package/dist/components/ic-link2.js +23 -3
- package/dist/components/ic-link2.js.map +1 -1
- package/dist/components/ic-loading-indicator2.js +3 -3
- package/dist/components/ic-menu-group.js +1 -1
- package/dist/components/ic-menu-item2.js +4 -4
- package/dist/components/ic-menu-item2.js.map +1 -1
- package/dist/components/ic-menu2.js +4 -4
- package/dist/components/ic-navigation-button.js +2 -2
- package/dist/components/ic-navigation-group.js +3 -3
- package/dist/components/ic-navigation-group.js.map +1 -1
- package/dist/components/ic-navigation-item.js +12 -7
- package/dist/components/ic-navigation-item.js.map +1 -1
- package/dist/components/ic-navigation-menu2.js +5 -5
- package/dist/components/ic-page-header.js +6 -6
- package/dist/components/ic-pagination-item2.js +2 -2
- package/dist/components/ic-pagination.js +4 -4
- package/dist/components/ic-popover-menu.js +7 -6
- package/dist/components/ic-popover-menu.js.map +1 -1
- package/dist/components/ic-radio-group.js +5 -5
- package/dist/components/ic-radio-option.js +6 -6
- package/dist/components/ic-radio-option.js.map +1 -1
- package/dist/components/ic-search-bar.js +112 -135
- package/dist/components/ic-search-bar.js.map +1 -1
- package/dist/components/ic-section-container2.js +2 -2
- package/dist/components/ic-select.js +47 -50
- package/dist/components/ic-select.js.map +1 -1
- package/dist/components/ic-side-navigation.js +6 -6
- package/dist/components/ic-side-navigation.js.map +1 -1
- package/dist/components/ic-skeleton.js +2 -2
- package/dist/components/ic-skip-link.js +12 -4
- package/dist/components/ic-skip-link.js.map +1 -1
- package/dist/components/ic-status-tag.js +2 -2
- package/dist/components/ic-status-tag.js.map +1 -1
- package/dist/components/ic-step.js +14 -14
- package/dist/components/ic-step.js.map +1 -1
- package/dist/components/ic-stepper.js +3 -3
- package/dist/components/ic-switch.js +6 -6
- package/dist/components/ic-switch.js.map +1 -1
- package/dist/components/ic-tab-context.js +1 -1
- package/dist/components/ic-tab-group.js +2 -2
- package/dist/components/ic-tab-panel.js +2 -2
- package/dist/components/ic-tab.js +2 -2
- package/dist/components/ic-text-field.js +32 -29
- package/dist/components/ic-text-field.js.map +1 -1
- package/dist/components/ic-theme.js +3 -1
- package/dist/components/ic-theme.js.map +1 -1
- package/dist/components/ic-toast-region.js +1 -1
- package/dist/components/ic-toast.js +4 -4
- package/dist/components/ic-toggle-button-group.js +2 -2
- package/dist/components/ic-toggle-button.js +3 -3
- package/dist/components/ic-toggle-button.js.map +1 -1
- package/dist/components/ic-tooltip2.js +30 -2
- package/dist/components/ic-tooltip2.js.map +1 -1
- package/dist/components/ic-top-navigation.js +5 -5
- package/dist/components/ic-top-navigation.js.map +1 -1
- package/dist/components/ic-typography2.js +3 -3
- package/dist/components/ic-typography2.js.map +1 -1
- package/dist/core/core.css +160 -110
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/p-00bc353b.entry.js +2 -0
- package/dist/core/p-00bc353b.entry.js.map +1 -0
- package/dist/core/{p-45595f98.entry.js → p-0a436c47.entry.js} +2 -2
- package/dist/core/p-0a436c47.entry.js.map +1 -0
- package/dist/core/{p-a55e7988.entry.js → p-10e1e227.entry.js} +2 -2
- package/dist/core/p-1440847f.entry.js +2 -0
- package/dist/core/p-1440847f.entry.js.map +1 -0
- package/dist/core/{p-729745d3.entry.js → p-15b7adaf.entry.js} +2 -2
- package/dist/core/p-16f55230.entry.js +2 -0
- package/dist/core/p-16f55230.entry.js.map +1 -0
- package/dist/core/{p-5c349c9d.entry.js → p-1838d1e9.entry.js} +2 -2
- package/dist/core/p-1838d1e9.entry.js.map +1 -0
- package/dist/core/{p-972671ea.entry.js → p-18714198.entry.js} +2 -2
- package/dist/core/{p-a20a7cd3.entry.js → p-1b2690b4.entry.js} +2 -2
- package/dist/core/p-1b2690b4.entry.js.map +1 -0
- package/dist/core/{p-37df68fe.entry.js → p-1be17f22.entry.js} +2 -2
- package/dist/core/p-206c2a26.entry.js +2 -0
- package/dist/core/p-206c2a26.entry.js.map +1 -0
- package/dist/core/{p-17cf7b50.entry.js → p-267a19d4.entry.js} +2 -2
- package/dist/core/p-26dfc4db.entry.js +2 -0
- package/dist/core/p-26dfc4db.entry.js.map +1 -0
- package/dist/core/p-2c17cc67.entry.js +2 -0
- package/dist/core/p-2c17cc67.entry.js.map +1 -0
- package/dist/core/{p-8b268274.entry.js → p-2c371198.entry.js} +2 -2
- package/dist/core/p-2e44cf53.entry.js +2 -0
- package/dist/core/p-2e44cf53.entry.js.map +1 -0
- package/dist/core/p-42a7d0b6.entry.js +2 -0
- package/dist/core/{p-fa02a267.entry.js → p-4b6818d9.entry.js} +2 -2
- package/dist/core/p-513628ef.entry.js +2 -0
- package/dist/core/p-513628ef.entry.js.map +1 -0
- package/dist/core/{p-1ac08e6d.entry.js → p-628c32b8.entry.js} +2 -2
- package/dist/core/p-70a6cff1.entry.js +2 -0
- package/dist/core/p-70a6cff1.entry.js.map +1 -0
- package/dist/core/{p-8856dff4.entry.js → p-72c117b6.entry.js} +2 -2
- package/dist/core/p-730d2f6e.entry.js +2 -0
- package/dist/core/p-730d2f6e.entry.js.map +1 -0
- package/dist/core/{p-0d016565.entry.js → p-788c96ac.entry.js} +2 -2
- package/dist/core/{p-78e7a859.entry.js → p-7fb79e87.entry.js} +2 -2
- package/dist/core/p-8242c24f.js +2 -0
- package/dist/core/p-8242c24f.js.map +1 -0
- package/dist/core/{p-7e79bd0e.entry.js → p-83764268.entry.js} +2 -2
- package/dist/core/p-8b5022bc.entry.js +2 -0
- package/dist/core/p-8b5022bc.entry.js.map +1 -0
- package/dist/core/{p-f34efc17.entry.js → p-8c4f7c63.entry.js} +2 -2
- package/dist/core/{p-1f455336.entry.js → p-910f5f14.entry.js} +2 -2
- package/dist/core/{p-10cd26dc.entry.js → p-9479f272.entry.js} +2 -2
- package/dist/core/{p-10cd26dc.entry.js.map → p-9479f272.entry.js.map} +1 -1
- package/dist/core/p-9c47521d.entry.js +2 -0
- package/dist/core/p-9c47521d.entry.js.map +1 -0
- package/dist/core/{p-110486f0.entry.js → p-9ca147f3.entry.js} +2 -2
- package/dist/core/{p-d9aec0dd.entry.js → p-9cfc2bac.entry.js} +2 -2
- package/dist/core/{p-74600ed8.entry.js → p-a0161990.entry.js} +2 -2
- package/dist/core/p-a17499ff.entry.js +2 -0
- package/dist/core/p-a17499ff.entry.js.map +1 -0
- package/dist/core/{p-4f2a1950.entry.js → p-a4f9b5bf.entry.js} +2 -2
- package/dist/core/{p-c9726fbd.entry.js → p-aad10013.entry.js} +2 -2
- package/dist/core/p-aad10013.entry.js.map +1 -0
- package/dist/core/{p-44e32417.entry.js → p-b371a498.entry.js} +2 -2
- package/dist/core/{p-44e32417.entry.js.map → p-b371a498.entry.js.map} +1 -1
- package/dist/core/p-b7568944.entry.js +2 -0
- package/dist/core/p-b7568944.entry.js.map +1 -0
- package/dist/core/p-b8da5c07.entry.js +2 -0
- package/dist/core/p-b8da5c07.entry.js.map +1 -0
- package/dist/core/{p-701696aa.entry.js → p-b9459ba2.entry.js} +2 -2
- package/dist/core/{p-2537f33e.entry.js → p-ba600947.entry.js} +2 -2
- package/dist/core/p-ba600947.entry.js.map +1 -0
- package/dist/core/{p-50f4d151.entry.js → p-bc2ca778.entry.js} +2 -2
- package/dist/core/{p-69e4daec.entry.js → p-bdc72446.entry.js} +2 -2
- package/dist/core/p-c45023b7.entry.js +2 -0
- package/dist/core/p-c45023b7.entry.js.map +1 -0
- package/dist/core/p-c4663e1a.entry.js +2 -0
- package/dist/core/p-c4663e1a.entry.js.map +1 -0
- package/dist/core/{p-a103068b.entry.js → p-c8cf1ad5.entry.js} +2 -2
- package/dist/core/p-c9a4fe37.entry.js +2 -0
- package/dist/core/p-c9a4fe37.entry.js.map +1 -0
- package/dist/core/p-cdf56a5d.entry.js +2 -0
- package/dist/core/p-cdf56a5d.entry.js.map +1 -0
- package/dist/core/{p-a71055c9.entry.js → p-d45d66c0.entry.js} +2 -2
- package/dist/core/p-d6c50565.entry.js +2 -0
- package/dist/core/p-d6c50565.entry.js.map +1 -0
- package/dist/core/{p-85734ebf.entry.js → p-d975bf2f.entry.js} +2 -2
- package/dist/core/p-d975bf2f.entry.js.map +1 -0
- package/dist/core/p-dede4974.entry.js +2 -0
- package/dist/core/p-dede4974.entry.js.map +1 -0
- package/dist/core/{p-071f4748.entry.js → p-df88ff5b.entry.js} +2 -2
- package/dist/core/p-e86a6d2d.entry.js +2 -0
- package/dist/core/{p-20c4d90b.entry.js → p-ebab7a9e.entry.js} +2 -2
- package/dist/core/p-eeab3a2e.entry.js +2 -0
- package/dist/core/p-eeab3a2e.entry.js.map +1 -0
- package/dist/core/{p-264ce7a0.entry.js → p-ef36181d.entry.js} +2 -2
- package/dist/core/p-ef36181d.entry.js.map +1 -0
- package/dist/core/p-f0388d68.entry.js +2 -0
- package/dist/core/p-f0388d68.entry.js.map +1 -0
- package/dist/core/{p-2b1a331b.entry.js → p-fbf57f0a.entry.js} +2 -2
- package/dist/esm/core.js +1 -1
- package/dist/esm/{helpers-dd035d0d.js → helpers-f2ffaa7c.js} +37 -74
- package/dist/esm/helpers-f2ffaa7c.js.map +1 -0
- package/dist/esm/ic-accordion-group.entry.js +1 -1
- package/dist/esm/ic-accordion-group.entry.js.map +1 -1
- package/dist/esm/ic-accordion.entry.js +1 -1
- package/dist/esm/ic-accordion.entry.js.map +1 -1
- package/dist/esm/ic-alert.entry.js +63 -36
- package/dist/esm/ic-alert.entry.js.map +1 -1
- package/dist/esm/ic-back-to-top.entry.js +4 -4
- package/dist/esm/ic-badge.entry.js +41 -17
- package/dist/esm/ic-badge.entry.js.map +1 -1
- package/dist/esm/ic-breadcrumb-group.entry.js +56 -76
- package/dist/esm/ic-breadcrumb-group.entry.js.map +1 -1
- package/dist/esm/ic-breadcrumb.entry.js +32 -51
- package/dist/esm/ic-breadcrumb.entry.js.map +1 -1
- package/dist/esm/ic-button_3.entry.js +136 -132
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-card-vertical.entry.js +6 -6
- package/dist/esm/ic-card-vertical.entry.js.map +1 -1
- package/dist/esm/ic-checkbox-group.entry.js +9 -10
- package/dist/esm/ic-checkbox-group.entry.js.map +1 -1
- package/dist/esm/ic-checkbox.entry.js +35 -34
- package/dist/esm/ic-checkbox.entry.js.map +1 -1
- package/dist/esm/ic-chip.entry.js +26 -38
- package/dist/esm/ic-chip.entry.js.map +1 -1
- package/dist/esm/ic-classification-banner.entry.js +2 -2
- package/dist/esm/ic-data-list.entry.js +2 -2
- package/dist/esm/ic-data-row.entry.js +3 -3
- package/dist/esm/ic-dialog.entry.js +3 -3
- package/dist/esm/ic-dialog.entry.js.map +1 -1
- package/dist/esm/ic-divider.entry.js +2 -2
- package/dist/esm/ic-divider.entry.js.map +1 -1
- package/dist/esm/ic-empty-state.entry.js +3 -3
- package/dist/esm/ic-footer-link-group.entry.js +2 -2
- package/dist/esm/ic-footer-link-group.entry.js.map +1 -1
- package/dist/esm/ic-footer-link.entry.js +3 -3
- package/dist/esm/ic-footer.entry.js +4 -4
- package/dist/esm/ic-hero.entry.js +5 -5
- package/dist/esm/ic-horizontal-scroll.entry.js +6 -6
- package/dist/esm/ic-input-component-container_3.entry.js +9 -9
- package/dist/esm/ic-input-label_2.entry.js +8 -8
- package/dist/esm/ic-link.entry.js +21 -3
- package/dist/esm/ic-link.entry.js.map +1 -1
- package/dist/esm/ic-menu-group.entry.js +2 -2
- package/dist/esm/ic-menu-item.entry.js +5 -5
- package/dist/esm/ic-menu-item.entry.js.map +1 -1
- package/dist/esm/ic-navigation-button.entry.js +3 -3
- package/dist/esm/ic-navigation-group.entry.js +3 -3
- package/dist/esm/ic-navigation-group.entry.js.map +1 -1
- package/dist/esm/ic-navigation-item.entry.js +12 -7
- package/dist/esm/ic-navigation-item.entry.js.map +1 -1
- package/dist/esm/ic-navigation-menu.entry.js +5 -5
- package/dist/esm/ic-page-header.entry.js +7 -7
- package/dist/esm/ic-pagination-item.entry.js +2 -2
- package/dist/esm/ic-pagination.entry.js +5 -5
- package/dist/esm/ic-popover-menu.entry.js +8 -7
- package/dist/esm/ic-popover-menu.entry.js.map +1 -1
- package/dist/esm/ic-radio-group.entry.js +5 -5
- package/dist/esm/ic-radio-option.entry.js +6 -6
- package/dist/esm/ic-radio-option.entry.js.map +1 -1
- package/dist/esm/ic-search-bar.entry.js +112 -135
- package/dist/esm/ic-search-bar.entry.js.map +1 -1
- package/dist/esm/ic-section-container.entry.js +2 -2
- package/dist/esm/ic-select.entry.js +47 -50
- package/dist/esm/ic-select.entry.js.map +1 -1
- package/dist/esm/ic-side-navigation.entry.js +6 -6
- package/dist/esm/ic-side-navigation.entry.js.map +1 -1
- package/dist/esm/ic-skeleton.entry.js +2 -2
- package/dist/esm/ic-skip-link.entry.js +10 -3
- package/dist/esm/ic-skip-link.entry.js.map +1 -1
- package/dist/esm/ic-status-tag.entry.js +3 -3
- package/dist/esm/ic-status-tag.entry.js.map +1 -1
- package/dist/esm/ic-step.entry.js +15 -15
- package/dist/esm/ic-step.entry.js.map +1 -1
- package/dist/esm/ic-stepper.entry.js +3 -3
- package/dist/esm/ic-switch.entry.js +6 -6
- package/dist/esm/ic-switch.entry.js.map +1 -1
- package/dist/esm/ic-tab-context.entry.js +1 -1
- package/dist/esm/ic-tab-group.entry.js +3 -3
- package/dist/esm/ic-tab-panel.entry.js +2 -2
- package/dist/esm/ic-tab.entry.js +3 -3
- package/dist/esm/ic-text-field.entry.js +32 -29
- package/dist/esm/ic-text-field.entry.js.map +1 -1
- package/dist/esm/ic-theme.entry.js +4 -2
- package/dist/esm/ic-theme.entry.js.map +1 -1
- package/dist/esm/ic-toast-region.entry.js +1 -1
- package/dist/esm/ic-toast.entry.js +4 -4
- package/dist/esm/ic-toggle-button-group.entry.js +3 -3
- package/dist/esm/ic-toggle-button.entry.js +4 -4
- package/dist/esm/ic-toggle-button.entry.js.map +1 -1
- package/dist/esm/ic-top-navigation.entry.js +5 -5
- package/dist/esm/ic-top-navigation.entry.js.map +1 -1
- package/dist/esm/ic-typography.entry.js +4 -4
- package/dist/esm/ic-typography.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-alert/ic-alert.d.ts +17 -9
- package/dist/types/components/ic-badge/ic-badge.d.ts +4 -0
- package/dist/types/components/ic-breadcrumb/ic-breadcrumb.d.ts +4 -6
- package/dist/types/components/ic-breadcrumb-group/ic-breadcrumb-group.d.ts +9 -15
- package/dist/types/components/ic-button/ic-button.d.ts +29 -22
- package/dist/types/components/ic-checkbox/ic-checkbox.d.ts +14 -13
- package/dist/types/components/ic-checkbox-group/ic-checkbox-group.d.ts +8 -9
- package/dist/types/components/ic-chip/ic-chip.d.ts +13 -15
- package/dist/types/components/ic-link/ic-link.d.ts +2 -0
- package/dist/types/components/ic-search-bar/ic-search-bar.d.ts +38 -40
- package/dist/types/components/ic-select/ic-select.d.ts +1 -0
- package/dist/types/components/ic-skip-link/ic-skip-link.d.ts +5 -0
- package/dist/types/components/ic-text-field/ic-text-field.d.ts +37 -32
- package/dist/types/components/ic-theme/ic-theme.d.ts +6 -2
- package/dist/types/components/ic-tooltip/ic-tooltip.d.ts +3 -0
- package/dist/types/components.d.ts +147 -133
- package/dist/types/utils/helpers.d.ts +13 -9
- package/dist/types/utils/types.d.ts +1 -0
- package/hydrate/index.js +809 -832
- package/hydrate/index.mjs +809 -832
- package/package.json +3 -3
- package/vscode-data.json +167 -3
- package/dist/cjs/helpers-a0a128bd.js.map +0 -1
- package/dist/collection/components/ic-breadcrumb/ic-breadcrumb.types.js +0 -2
- package/dist/collection/components/ic-breadcrumb/ic-breadcrumb.types.js.map +0 -1
- package/dist/core/p-06d97789.entry.js +0 -2
- package/dist/core/p-06d97789.entry.js.map +0 -1
- package/dist/core/p-09070f61.entry.js +0 -2
- package/dist/core/p-0c0ac69d.entry.js +0 -2
- package/dist/core/p-0c0ac69d.entry.js.map +0 -1
- package/dist/core/p-0e96d4d8.entry.js +0 -2
- package/dist/core/p-0e96d4d8.entry.js.map +0 -1
- package/dist/core/p-116ad73d.entry.js +0 -2
- package/dist/core/p-116ad73d.entry.js.map +0 -1
- package/dist/core/p-1171a945.entry.js +0 -2
- package/dist/core/p-1171a945.entry.js.map +0 -1
- package/dist/core/p-2537f33e.entry.js.map +0 -1
- package/dist/core/p-264ce7a0.entry.js.map +0 -1
- package/dist/core/p-28656111.entry.js +0 -2
- package/dist/core/p-28656111.entry.js.map +0 -1
- package/dist/core/p-33243fff.entry.js +0 -2
- package/dist/core/p-33243fff.entry.js.map +0 -1
- package/dist/core/p-45595f98.entry.js.map +0 -1
- package/dist/core/p-49768069.entry.js +0 -2
- package/dist/core/p-49768069.entry.js.map +0 -1
- package/dist/core/p-4c68494c.entry.js +0 -2
- package/dist/core/p-4c68494c.entry.js.map +0 -1
- package/dist/core/p-55a37101.entry.js +0 -2
- package/dist/core/p-55a37101.entry.js.map +0 -1
- package/dist/core/p-5c349c9d.entry.js.map +0 -1
- package/dist/core/p-5e1fd097.entry.js +0 -2
- package/dist/core/p-5e1fd097.entry.js.map +0 -1
- package/dist/core/p-73fc198f.entry.js +0 -2
- package/dist/core/p-73fc198f.entry.js.map +0 -1
- package/dist/core/p-7eaf8da8.entry.js +0 -2
- package/dist/core/p-811d447b.entry.js +0 -2
- package/dist/core/p-811d447b.entry.js.map +0 -1
- package/dist/core/p-85734ebf.entry.js.map +0 -1
- package/dist/core/p-85b7d931.entry.js +0 -2
- package/dist/core/p-85b7d931.entry.js.map +0 -1
- package/dist/core/p-98328cb9.entry.js +0 -2
- package/dist/core/p-98328cb9.entry.js.map +0 -1
- package/dist/core/p-a20a7cd3.entry.js.map +0 -1
- package/dist/core/p-a22658fb.entry.js +0 -2
- package/dist/core/p-a22658fb.entry.js.map +0 -1
- package/dist/core/p-a794b724.entry.js +0 -2
- package/dist/core/p-a794b724.entry.js.map +0 -1
- package/dist/core/p-b21b4fea.entry.js +0 -2
- package/dist/core/p-b21b4fea.entry.js.map +0 -1
- package/dist/core/p-b953b22f.entry.js +0 -2
- package/dist/core/p-b953b22f.entry.js.map +0 -1
- package/dist/core/p-c9726fbd.entry.js.map +0 -1
- package/dist/core/p-d981598e.entry.js +0 -2
- package/dist/core/p-d981598e.entry.js.map +0 -1
- package/dist/core/p-ed8957da.js +0 -2
- package/dist/core/p-ed8957da.js.map +0 -1
- package/dist/core/p-f3315216.entry.js +0 -2
- package/dist/core/p-f3315216.entry.js.map +0 -1
- package/dist/core/p-f43f411a.entry.js +0 -2
- package/dist/core/p-f43f411a.entry.js.map +0 -1
- package/dist/core/p-ff995eb8.entry.js +0 -2
- package/dist/core/p-ff995eb8.entry.js.map +0 -1
- package/dist/esm/helpers-dd035d0d.js.map +0 -1
- package/dist/types/components/ic-breadcrumb/ic-breadcrumb.types.d.ts +0 -1
- /package/dist/core/{p-a55e7988.entry.js.map → p-10e1e227.entry.js.map} +0 -0
- /package/dist/core/{p-729745d3.entry.js.map → p-15b7adaf.entry.js.map} +0 -0
- /package/dist/core/{p-972671ea.entry.js.map → p-18714198.entry.js.map} +0 -0
- /package/dist/core/{p-37df68fe.entry.js.map → p-1be17f22.entry.js.map} +0 -0
- /package/dist/core/{p-17cf7b50.entry.js.map → p-267a19d4.entry.js.map} +0 -0
- /package/dist/core/{p-8b268274.entry.js.map → p-2c371198.entry.js.map} +0 -0
- /package/dist/core/{p-09070f61.entry.js.map → p-42a7d0b6.entry.js.map} +0 -0
- /package/dist/core/{p-fa02a267.entry.js.map → p-4b6818d9.entry.js.map} +0 -0
- /package/dist/core/{p-1ac08e6d.entry.js.map → p-628c32b8.entry.js.map} +0 -0
- /package/dist/core/{p-8856dff4.entry.js.map → p-72c117b6.entry.js.map} +0 -0
- /package/dist/core/{p-0d016565.entry.js.map → p-788c96ac.entry.js.map} +0 -0
- /package/dist/core/{p-78e7a859.entry.js.map → p-7fb79e87.entry.js.map} +0 -0
- /package/dist/core/{p-7e79bd0e.entry.js.map → p-83764268.entry.js.map} +0 -0
- /package/dist/core/{p-f34efc17.entry.js.map → p-8c4f7c63.entry.js.map} +0 -0
- /package/dist/core/{p-1f455336.entry.js.map → p-910f5f14.entry.js.map} +0 -0
- /package/dist/core/{p-110486f0.entry.js.map → p-9ca147f3.entry.js.map} +0 -0
- /package/dist/core/{p-d9aec0dd.entry.js.map → p-9cfc2bac.entry.js.map} +0 -0
- /package/dist/core/{p-74600ed8.entry.js.map → p-a0161990.entry.js.map} +0 -0
- /package/dist/core/{p-4f2a1950.entry.js.map → p-a4f9b5bf.entry.js.map} +0 -0
- /package/dist/core/{p-701696aa.entry.js.map → p-b9459ba2.entry.js.map} +0 -0
- /package/dist/core/{p-50f4d151.entry.js.map → p-bc2ca778.entry.js.map} +0 -0
- /package/dist/core/{p-69e4daec.entry.js.map → p-bdc72446.entry.js.map} +0 -0
- /package/dist/core/{p-a103068b.entry.js.map → p-c8cf1ad5.entry.js.map} +0 -0
- /package/dist/core/{p-a71055c9.entry.js.map → p-d45d66c0.entry.js.map} +0 -0
- /package/dist/core/{p-071f4748.entry.js.map → p-df88ff5b.entry.js.map} +0 -0
- /package/dist/core/{p-7eaf8da8.entry.js.map → p-e86a6d2d.entry.js.map} +0 -0
- /package/dist/core/{p-20c4d90b.entry.js.map → p-ebab7a9e.entry.js.map} +0 -0
- /package/dist/core/{p-2b1a331b.entry.js.map → p-fbf57f0a.entry.js.map} +0 -0
@@ -1,13 +1,15 @@
|
|
1
1
|
import { Host, h, } from "@stencil/core";
|
2
2
|
import { convertToRGBA, getBrandForegroundAppearance, isPropDefined, onComponentRequiredPropUndefined, } from "../../utils/helpers";
|
3
|
-
const NAVIGATION_BUTTON = "IC-NAVIGATION-BUTTON";
|
4
3
|
const TOP_NAVIGATION = "IC-TOP-NAVIGATION";
|
4
|
+
const SIDE_NAVIGATION = "IC-SIDE-NAVIGATION";
|
5
5
|
/**
|
6
6
|
* @slot badge-icon - Icon will be rendered inside the badge if type is set to icon.
|
7
7
|
*/
|
8
8
|
export class Badge {
|
9
9
|
constructor() {
|
10
|
+
var _a;
|
10
11
|
this.ariaLabel = null;
|
12
|
+
this.initialPosition = (_a = this.position) !== null && _a !== void 0 ? _a : "far";
|
11
13
|
/**
|
12
14
|
* The positioning of the badge in reference to the parent element.
|
13
15
|
*/
|
@@ -67,20 +69,41 @@ export class Badge {
|
|
67
69
|
}
|
68
70
|
};
|
69
71
|
this.setPositionInTopNavigation = () => {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
: (this.position = "near");
|
72
|
+
this.position = this.isInMobileMode() ? "inline" : this.initialPosition;
|
73
|
+
};
|
74
|
+
this.setPositionInSideNavigation = () => {
|
75
|
+
this.position = "near";
|
75
76
|
};
|
76
77
|
this.isInTopNav = () => {
|
77
78
|
const parentEl = this.el.parentElement;
|
78
|
-
if (parentEl)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
if (!parentEl)
|
80
|
+
return false;
|
81
|
+
const grandparentEl = parentEl.parentElement;
|
82
|
+
const greatGrandparentEl = grandparentEl === null || grandparentEl === void 0 ? void 0 : grandparentEl.parentElement;
|
83
|
+
return ((grandparentEl === null || grandparentEl === void 0 ? void 0 : grandparentEl.tagName) === TOP_NAVIGATION ||
|
84
|
+
(greatGrandparentEl === null || greatGrandparentEl === void 0 ? void 0 : greatGrandparentEl.tagName) === TOP_NAVIGATION);
|
85
|
+
};
|
86
|
+
this.isInSideNav = () => {
|
87
|
+
const parentEl = this.el.parentElement;
|
88
|
+
if (!parentEl)
|
89
|
+
return false;
|
90
|
+
const grandparentEl = parentEl.parentElement;
|
91
|
+
const greatGrandparentEl = grandparentEl === null || grandparentEl === void 0 ? void 0 : grandparentEl.parentElement;
|
92
|
+
return ((grandparentEl === null || grandparentEl === void 0 ? void 0 : grandparentEl.tagName) === SIDE_NAVIGATION ||
|
93
|
+
(greatGrandparentEl === null || greatGrandparentEl === void 0 ? void 0 : greatGrandparentEl.tagName) === SIDE_NAVIGATION);
|
94
|
+
};
|
95
|
+
this.isInMobileMode = () => {
|
96
|
+
const parentEl = this.el.parentElement;
|
97
|
+
if (!parentEl)
|
98
|
+
return false;
|
99
|
+
const grandparentEl = parentEl.parentElement;
|
100
|
+
const greatGrandparentEl = grandparentEl === null || grandparentEl === void 0 ? void 0 : grandparentEl.parentElement;
|
101
|
+
return ((((grandparentEl === null || grandparentEl === void 0 ? void 0 : grandparentEl.tagName) === TOP_NAVIGATION ||
|
102
|
+
(grandparentEl === null || grandparentEl === void 0 ? void 0 : grandparentEl.tagName) === SIDE_NAVIGATION) &&
|
103
|
+
grandparentEl.classList.contains("mobile-mode")) ||
|
104
|
+
(((greatGrandparentEl === null || greatGrandparentEl === void 0 ? void 0 : greatGrandparentEl.tagName) === TOP_NAVIGATION ||
|
105
|
+
(greatGrandparentEl === null || greatGrandparentEl === void 0 ? void 0 : greatGrandparentEl.tagName) === SIDE_NAVIGATION) &&
|
106
|
+
greatGrandparentEl.classList.contains("mobile-mode")));
|
84
107
|
};
|
85
108
|
this.isAccessibleLabelDefined = () => isPropDefined(this.accessibleLabel) && this.accessibleLabel !== null;
|
86
109
|
}
|
@@ -112,16 +135,17 @@ export class Badge {
|
|
112
135
|
}
|
113
136
|
componentWillRender() {
|
114
137
|
this.isInTopNav() && this.setPositionInTopNavigation();
|
138
|
+
this.isInSideNav() && this.setPositionInSideNavigation();
|
115
139
|
}
|
116
140
|
navBarMenuOpenHandler() {
|
117
141
|
this.isInTopNav() && (this.position = "inline");
|
118
142
|
}
|
119
143
|
navBarMenuCloseHandler() {
|
120
|
-
this.isInTopNav() && (this.position =
|
144
|
+
this.isInTopNav() && (this.position = this.initialPosition);
|
121
145
|
}
|
122
146
|
render() {
|
123
147
|
const { ariaLabel, el, foregroundColour, getLabel, position, size, label, type, variant, visible, theme, } = this;
|
124
|
-
return (h(Host, { key: '
|
148
|
+
return (h(Host, { key: '720f5c35c4d16cc484ea53a0f277befdbb087883', class: {
|
125
149
|
[`ic-badge-${position}`]: true,
|
126
150
|
[`ic-badge-${size}`]: true,
|
127
151
|
[`ic-badge-${variant}`]: true,
|
@@ -129,7 +153,7 @@ export class Badge {
|
|
129
153
|
[`ic-badge-foreground-${foregroundColour}`]: foregroundColour !== null && variant === "custom",
|
130
154
|
[`${visible ? "ic-badge-show" : "ic-badge-hide"}`]: true,
|
131
155
|
[`ic-theme-${theme}`]: theme !== "inherit",
|
132
|
-
}, id: el.id || null, "aria-label": ariaLabel, role: "status" }, type === "icon" && h("slot", { key: '
|
156
|
+
}, id: el.id || null, "aria-label": ariaLabel, role: "status" }, type === "icon" && h("slot", { key: '611a931cbdbfd72a7031adaec19d9cd5f83b097a', name: "badge-icon" }), type === "text" && label && (h("ic-typography", { key: '57620b02829df5547546474ad337f3cc23bb19c4', variant: size === "small" ? "badge-small" : "badge" }, getLabel())), type === "dot" && h("span", { key: '6f583cc04572a1818afc11e43cb5b41f95afe630', class: "sr-only" }, "badge")));
|
133
157
|
}
|
134
158
|
static get is() { return "ic-badge"; }
|
135
159
|
static get encapsulation() { return "shadow"; }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ic-badge.js","sourceRoot":"","sources":["../../../src/components/ic-badge/ic-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,CAAC,EACD,MAAM,GACP,MAAM,eAAe,CAAC;AAYvB,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,aAAa,EACb,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAE7B,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACjD,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAE3C;;GAEG;AAQH,MAAM,OAAO,KAAK;IAPlB;QAQU,cAAS,GAAkB,IAAI,CAAC;QAiCxC;;WAEG;QACsB,aAAQ,GAAsB,KAAK,CAAC;QAE7D;;WAEG;QACK,SAAI,GAAa,QAAQ,CAAC;QAOlC;;WAEG;QACK,UAAK,GAAiB,SAAS,CAAC;QAExC;;WAEG;QACK,SAAI,GAAkB,MAAM,CAAC;QAErC;;WAEG;QACK,YAAO,GAAqB,SAAS,CAAC;QAS9C;;WAEG;QACK,YAAO,GAAa,IAAI,CAAC;QAqCzB,mBAAc,GAAG,GAAG,EAAE;YAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAE5E,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC;gBACjC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CA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AI;gBAC7B,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE,IAAI;gBAC1B,CAAC,uBAAuB,gBAAgB,EAAE,CAAC,EACzC,gBAAgB,KAAK,IAAI,IAAI,OAAO,KAAK,QAAQ;gBACnD,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,EAAE,IAAI;gBACxD,CAAC,YAAY,KAAK,EAAE,CAAC,EAAE,KAAK,KAAK,SAAS;aAC3C,EACD,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,IAAI,gBACL,SAAS,EACrB,IAAI,EAAC,QAAQ;YAEZ,IAAI,KAAK,MAAM,IAAI,6DAAM,IAAI,EAAC,YAAY,GAAQ;YAClD,IAAI,KAAK,MAAM,IAAI,KAAK,IAAI,CAC3B,sEAAe,OAAO,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,IAC/D,QAAQ,EAAE,CACG,CACjB;YACA,IAAI,KAAK,KAAK,IAAI,6DAAM,KAAK,EAAC,SAAS,YAAa,CAChD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Host,\n Prop,\n Watch,\n h,\n Listen,\n} from \"@stencil/core\";\nimport {\n IcBadgePositions,\n IcBadgeTypes,\n IcBadgeVariants,\n} from \"./ic-badge.types\";\nimport {\n IcSizes,\n IcBrandForeground,\n IcColor,\n IcThemeMode,\n} from \"../../utils/types\";\nimport {\n convertToRGBA,\n getBrandForegroundAppearance,\n isPropDefined,\n onComponentRequiredPropUndefined,\n} from \"../../utils/helpers\";\n\nconst NAVIGATION_BUTTON = \"IC-NAVIGATION-BUTTON\";\nconst TOP_NAVIGATION = \"IC-TOP-NAVIGATION\";\n\n/**\n * @slot badge-icon - Icon will be rendered inside the badge if type is set to icon.\n */\n@Component({\n tag: \"ic-badge\",\n styleUrl: \"ic-badge.css\",\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class Badge {\n private ariaLabel: string | null = null;\n private foregroundColour: IcBrandForeground;\n private parentAriaLabel: string;\n\n @Element() el: HTMLIcBadgeElement;\n\n /**\n * The accessible label of the badge component to provide context for screen reader users.\n */\n @Prop() accessibleLabel?: string;\n\n @Watch(\"accessibleLabel\")\n accessibleLabelHandler(): void {\n this.setAccessibleLabel();\n }\n\n /**\n * The custom badge colour. This will only style the badge component if variant=\"custom\".\n * Can be a hex value e.g. \"#ff0000\", RGB e.g. \"rgb(255, 0, 0)\", or RGBA e.g. \"rgba(255, 0, 0, 1)\".\n */\n @Prop() customColor?: IcColor;\n\n @Watch(\"customColor\")\n customColorHandler(): void {\n this.variant === \"custom\" && this.setBadgeColour();\n }\n\n /**\n * The maximum number shown on the badge appended with a +.\n * This will only be displayed if type=\"text\" and label is not empty.\n */\n @Prop() maxNumber?: number;\n\n /**\n * The positioning of the badge in reference to the parent element.\n */\n @Prop({ mutable: true }) position?: IcBadgePositions = \"far\";\n\n /**\n * The size of the badge to be displayed.\n */\n @Prop() size?: IcSizes = \"medium\";\n\n /**\n * The text displayed in the badge. This will only be displayed if type=\"text\".\n */\n @Prop() label?: string;\n\n /**\n * Sets the theme color to the dark or light theme color. \"inherit\" will set the color based on the system settings or ic-theme component.\n */\n @Prop() theme?: IcThemeMode = \"inherit\";\n\n /**\n * The type of badge to be displayed.\n */\n @Prop() type?: IcBadgeTypes = \"text\";\n\n /**\n * The variant of the badge to be displayed.\n */\n @Prop() variant?: IcBadgeVariants = \"neutral\";\n\n @Watch(\"variant\")\n variantHandler(): void {\n if (this.variant === \"custom\") {\n this.setBadgeColour();\n }\n }\n\n /**\n * If `true`, the badge will be displayed.\n */\n @Prop() visible?: boolean = true;\n\n @Watch(\"visible\")\n visibleHandler(): void {\n this.setAccessibleLabel();\n }\n\n componentWillLoad(): void {\n this.variant === \"custom\" && this.setBadgeColour();\n\n const ariaLabel = this.el.parentElement?.ariaLabel;\n if (ariaLabel) this.parentAriaLabel = ariaLabel;\n this.setAccessibleLabel();\n }\n\n componentDidLoad(): void {\n this.type === \"text\" &&\n onComponentRequiredPropUndefined(\n [{ prop: this.label, propName: \"label\" }],\n \"Badge\"\n );\n }\n\n componentWillRender(): void {\n this.isInTopNav() && this.setPositionInTopNavigation();\n }\n\n @Listen(\"icNavigationMenuOpened\", { target: \"document\" })\n navBarMenuOpenHandler(): void {\n this.isInTopNav() && (this.position = \"inline\");\n }\n\n @Listen(\"icNavigationMenuClosed\", { target: \"document\" })\n navBarMenuCloseHandler(): void {\n this.isInTopNav() && (this.position = \"near\");\n }\n\n private setBadgeColour = () => {\n const colorRGBA = this.customColor ? convertToRGBA(this.customColor) : null;\n\n if (colorRGBA) {\n const { r, g, b, a } = colorRGBA;\n this.el.style.backgroundColor = `rgba(${r}, ${g}, ${b}, ${a})`;\n this.foregroundColour = getBrandForegroundAppearance(\n (r * 299 + g * 587 + b * 114) / 1000\n );\n }\n };\n\n private getLabel = () =>\n this.maxNumber && Number(this.label) > this.maxNumber\n ? `${this.maxNumber}+`\n : this.label;\n\n // Set aria-label on badge and / or parent element\n // Aria-describedby seems to not work, probably due to shadow DOM\n private setAccessibleLabel = () => {\n const parentEl = this.el.parentElement;\n const defaultAriaLabel = this.isAccessibleLabelDefined()\n ? this.accessibleLabel\n : this.label || \"with badge being displayed\";\n\n if (parentEl) {\n const { tagName } = parentEl;\n if (\n tagName !== \"IC-CARD\" &&\n (tagName !== \"IC-TAB\" || (tagName === \"IC-TAB\" && this.parentAriaLabel))\n ) {\n const ariaLabelPrefix = this.parentAriaLabel\n ? `${this.parentAriaLabel} ,`\n : \"\";\n parentEl.ariaLabel = this.visible\n ? `${ariaLabelPrefix} ${defaultAriaLabel}`\n : null;\n } else {\n this.ariaLabel = `, ${defaultAriaLabel}`;\n }\n }\n };\n\n private setPositionInTopNavigation = () => {\n const parentTopNavEl = this.el.parentElement?.parentElement;\n parentTopNavEl?.classList.contains(\"mobile-mode\")\n ? (this.position = \"inline\")\n : (this.position = \"near\");\n };\n\n private isInTopNav = (): boolean => {\n const parentEl = this.el.parentElement;\n if (parentEl) {\n const grandparentEl = parentEl?.parentElement;\n return (\n parentEl?.tagName === NAVIGATION_BUTTON &&\n grandparentEl?.tagName === TOP_NAVIGATION\n );\n }\n return false;\n };\n\n private isAccessibleLabelDefined = () =>\n isPropDefined(this.accessibleLabel) && this.accessibleLabel !== null;\n\n render() {\n const {\n ariaLabel,\n el,\n foregroundColour,\n getLabel,\n position,\n size,\n label,\n type,\n variant,\n visible,\n theme,\n } = this;\n\n return (\n <Host\n class={{\n [`ic-badge-${position}`]: true,\n [`ic-badge-${size}`]: true,\n [`ic-badge-${variant}`]: true,\n [`ic-badge-${type}`]: true,\n [`ic-badge-foreground-${foregroundColour}`]:\n foregroundColour !== null && variant === \"custom\",\n [`${visible ? \"ic-badge-show\" : \"ic-badge-hide\"}`]: true,\n [`ic-theme-${theme}`]: theme !== \"inherit\",\n }}\n id={el.id || null}\n aria-label={ariaLabel}\n role=\"status\"\n >\n {type === \"icon\" && <slot name=\"badge-icon\"></slot>}\n {type === \"text\" && label && (\n <ic-typography variant={size === \"small\" ? \"badge-small\" : \"badge\"}>\n {getLabel()}\n </ic-typography>\n )}\n {type === \"dot\" && <span class=\"sr-only\">badge</span>}\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ic-badge.js","sourceRoot":"","sources":["../../../src/components/ic-badge/ic-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SA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;gBACnD,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,EAAE,IAAI;gBACxD,CAAC,YAAY,KAAK,EAAE,CAAC,EAAE,KAAK,KAAK,SAAS;aAC3C,EACD,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,IAAI,gBACL,SAAS,EACrB,IAAI,EAAC,QAAQ;YAEZ,IAAI,KAAK,MAAM,IAAI,6DAAM,IAAI,EAAC,YAAY,GAAQ;YAClD,IAAI,KAAK,MAAM,IAAI,KAAK,IAAI,CAC3B,sEAAe,OAAO,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,IAC/D,QAAQ,EAAE,CACG,CACjB;YACA,IAAI,KAAK,KAAK,IAAI,6DAAM,KAAK,EAAC,SAAS,YAAa,CAChD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Host,\n Prop,\n Watch,\n h,\n Listen,\n} from \"@stencil/core\";\nimport {\n IcBadgePositions,\n IcBadgeTypes,\n IcBadgeVariants,\n} from \"./ic-badge.types\";\nimport {\n IcSizes,\n IcBrandForeground,\n IcColor,\n IcThemeMode,\n} from \"../../utils/types\";\nimport {\n convertToRGBA,\n getBrandForegroundAppearance,\n isPropDefined,\n onComponentRequiredPropUndefined,\n} from \"../../utils/helpers\";\n\nconst TOP_NAVIGATION = \"IC-TOP-NAVIGATION\";\nconst SIDE_NAVIGATION = \"IC-SIDE-NAVIGATION\";\n\n/**\n * @slot badge-icon - Icon will be rendered inside the badge if type is set to icon.\n */\n@Component({\n tag: \"ic-badge\",\n styleUrl: \"ic-badge.css\",\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class Badge {\n private ariaLabel: string | null = null;\n private foregroundColour: IcBrandForeground;\n private parentAriaLabel: string;\n private initialPosition: IcBadgePositions = this.position ?? \"far\";\n\n @Element() el: HTMLIcBadgeElement;\n\n /**\n * The accessible label of the badge component to provide context for screen reader users.\n */\n @Prop() accessibleLabel?: string;\n\n @Watch(\"accessibleLabel\")\n accessibleLabelHandler(): void {\n this.setAccessibleLabel();\n }\n\n /**\n * The custom badge colour. This will only style the badge component if variant=\"custom\".\n * Can be a hex value e.g. \"#ff0000\", RGB e.g. \"rgb(255, 0, 0)\", or RGBA e.g. \"rgba(255, 0, 0, 1)\".\n */\n @Prop() customColor?: IcColor;\n\n @Watch(\"customColor\")\n customColorHandler(): void {\n this.variant === \"custom\" && this.setBadgeColour();\n }\n\n /**\n * The maximum number shown on the badge appended with a +.\n * This will only be displayed if type=\"text\" and label is not empty.\n */\n @Prop() maxNumber?: number;\n\n /**\n * The positioning of the badge in reference to the parent element.\n */\n @Prop({ mutable: true }) position?: IcBadgePositions = \"far\";\n\n /**\n * The size of the badge to be displayed.\n */\n @Prop() size?: IcSizes = \"medium\";\n\n /**\n * The text displayed in the badge. This will only be displayed if type=\"text\".\n */\n @Prop() label?: string;\n\n /**\n * Sets the theme color to the dark or light theme color. \"inherit\" will set the color based on the system settings or ic-theme component.\n */\n @Prop() theme?: IcThemeMode = \"inherit\";\n\n /**\n * The type of badge to be displayed.\n */\n @Prop() type?: IcBadgeTypes = \"text\";\n\n /**\n * The variant of the badge to be displayed.\n */\n @Prop() variant?: IcBadgeVariants = \"neutral\";\n\n @Watch(\"variant\")\n variantHandler(): void {\n if (this.variant === \"custom\") {\n this.setBadgeColour();\n }\n }\n\n /**\n * If `true`, the badge will be displayed.\n */\n @Prop() visible?: boolean = true;\n\n @Watch(\"visible\")\n visibleHandler(): void {\n this.setAccessibleLabel();\n }\n\n componentWillLoad(): void {\n this.variant === \"custom\" && this.setBadgeColour();\n\n const ariaLabel = this.el.parentElement?.ariaLabel;\n if (ariaLabel) this.parentAriaLabel = ariaLabel;\n this.setAccessibleLabel();\n }\n\n componentDidLoad(): void {\n this.type === \"text\" &&\n onComponentRequiredPropUndefined(\n [{ prop: this.label, propName: \"label\" }],\n \"Badge\"\n );\n }\n\n componentWillRender(): void {\n this.isInTopNav() && this.setPositionInTopNavigation();\n this.isInSideNav() && this.setPositionInSideNavigation();\n }\n\n @Listen(\"icNavigationMenuOpened\", { target: \"document\" })\n navBarMenuOpenHandler(): void {\n this.isInTopNav() && (this.position = \"inline\");\n }\n\n @Listen(\"icNavigationMenuClosed\", { target: \"document\" })\n navBarMenuCloseHandler(): void {\n this.isInTopNav() && (this.position = this.initialPosition);\n }\n\n private setBadgeColour = () => {\n const colorRGBA = this.customColor ? convertToRGBA(this.customColor) : null;\n\n if (colorRGBA) {\n const { r, g, b, a } = colorRGBA;\n this.el.style.backgroundColor = `rgba(${r}, ${g}, ${b}, ${a})`;\n this.foregroundColour = getBrandForegroundAppearance(\n (r * 299 + g * 587 + b * 114) / 1000\n );\n }\n };\n\n private getLabel = () =>\n this.maxNumber && Number(this.label) > this.maxNumber\n ? `${this.maxNumber}+`\n : this.label;\n\n // Set aria-label on badge and / or parent element\n // Aria-describedby seems to not work, probably due to shadow DOM\n private setAccessibleLabel = () => {\n const parentEl = this.el.parentElement;\n const defaultAriaLabel = this.isAccessibleLabelDefined()\n ? this.accessibleLabel\n : this.label || \"with badge being displayed\";\n\n if (parentEl) {\n const { tagName } = parentEl;\n if (\n tagName !== \"IC-CARD\" &&\n (tagName !== \"IC-TAB\" || (tagName === \"IC-TAB\" && this.parentAriaLabel))\n ) {\n const ariaLabelPrefix = this.parentAriaLabel\n ? `${this.parentAriaLabel} ,`\n : \"\";\n parentEl.ariaLabel = this.visible\n ? `${ariaLabelPrefix} ${defaultAriaLabel}`\n : null;\n } else {\n this.ariaLabel = `, ${defaultAriaLabel}`;\n }\n }\n };\n\n private setPositionInTopNavigation = () => {\n this.position = this.isInMobileMode() ? \"inline\" : this.initialPosition;\n };\n\n private setPositionInSideNavigation = () => {\n this.position = \"near\";\n };\n\n private isInTopNav = (): boolean => {\n const parentEl = this.el.parentElement;\n if (!parentEl) return false;\n const grandparentEl = parentEl.parentElement;\n const greatGrandparentEl = grandparentEl?.parentElement;\n return (\n grandparentEl?.tagName === TOP_NAVIGATION ||\n greatGrandparentEl?.tagName === TOP_NAVIGATION\n );\n };\n\n private isInSideNav = (): boolean => {\n const parentEl = this.el.parentElement;\n if (!parentEl) return false;\n const grandparentEl = parentEl.parentElement;\n const greatGrandparentEl = grandparentEl?.parentElement;\n return (\n grandparentEl?.tagName === SIDE_NAVIGATION ||\n greatGrandparentEl?.tagName === SIDE_NAVIGATION\n );\n };\n\n private isInMobileMode = (): boolean => {\n const parentEl = this.el.parentElement;\n if (!parentEl) return false;\n const grandparentEl = parentEl.parentElement;\n const greatGrandparentEl = grandparentEl?.parentElement;\n return (\n ((grandparentEl?.tagName === TOP_NAVIGATION ||\n grandparentEl?.tagName === SIDE_NAVIGATION) &&\n grandparentEl.classList.contains(\"mobile-mode\")) ||\n ((greatGrandparentEl?.tagName === TOP_NAVIGATION ||\n greatGrandparentEl?.tagName === SIDE_NAVIGATION) &&\n greatGrandparentEl.classList.contains(\"mobile-mode\"))\n );\n };\n\n private isAccessibleLabelDefined = () =>\n isPropDefined(this.accessibleLabel) && this.accessibleLabel !== null;\n\n render() {\n const {\n ariaLabel,\n el,\n foregroundColour,\n getLabel,\n position,\n size,\n label,\n type,\n variant,\n visible,\n theme,\n } = this;\n\n return (\n <Host\n class={{\n [`ic-badge-${position}`]: true,\n [`ic-badge-${size}`]: true,\n [`ic-badge-${variant}`]: true,\n [`ic-badge-${type}`]: true,\n [`ic-badge-foreground-${foregroundColour}`]:\n foregroundColour !== null && variant === \"custom\",\n [`${visible ? \"ic-badge-show\" : \"ic-badge-hide\"}`]: true,\n [`ic-theme-${theme}`]: theme !== \"inherit\",\n }}\n id={el.id || null}\n aria-label={ariaLabel}\n role=\"status\"\n >\n {type === \"icon\" && <slot name=\"badge-icon\"></slot>}\n {type === \"text\" && label && (\n <ic-typography variant={size === \"small\" ? \"badge-small\" : \"badge\"}>\n {getLabel()}\n </ic-typography>\n )}\n {type === \"dot\" && <span class=\"sr-only\">badge</span>}\n </Host>\n );\n }\n}\n"]}
|
@@ -1,13 +1,16 @@
|
|
1
1
|
import { Host, h, } from "@stencil/core";
|
2
2
|
import chevronIcon from "../../assets/chevron-icon.svg";
|
3
3
|
import backIcon from "../../assets/back-icon.svg";
|
4
|
-
import { getSlotElements,
|
4
|
+
import { getSlotElements, isSlotUsed } from "../../utils/helpers";
|
5
5
|
/**
|
6
6
|
* @slot icon - Content will be rendered to the left of the breadcrumb page title.
|
7
7
|
*/
|
8
8
|
export class Breadcrumb {
|
9
9
|
constructor() {
|
10
10
|
this.HREF_ATTR = "href";
|
11
|
+
this.linkSlotContent = null;
|
12
|
+
this.slottedLinkEl = null;
|
13
|
+
this.slottedLinkHref = null;
|
11
14
|
/**
|
12
15
|
* If `true`, aria-current will be set on the breadcrumb.
|
13
16
|
*/
|
@@ -26,54 +29,27 @@ export class Breadcrumb {
|
|
26
29
|
this.theme = "inherit";
|
27
30
|
// Prevent focus on breadcrumb if current page and contains slotted link
|
28
31
|
this.updatedSlottedLinkFocus = () => {
|
32
|
+
var _a, _b;
|
29
33
|
// Sets tabindex on wrong element in unit test snapshots
|
30
34
|
// - related to known Jest issue: https://github.com/ionic-team/stencil/issues/2830
|
31
35
|
if (this.linkSlotContent) {
|
32
36
|
this.linkSlotContent.tabIndex = this.current ? -1 : 0; // Prevent focus
|
33
37
|
}
|
34
|
-
if (this.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
this.slottedLinkHref &&
|
40
|
-
this.slottedLinkEl.setAttribute(this.HREF_ATTR, this.slottedLinkHref);
|
41
|
-
}
|
38
|
+
if (this.current) {
|
39
|
+
(_a = this.slottedLinkEl) === null || _a === void 0 ? void 0 : _a.removeAttribute(this.HREF_ATTR); // Prevent screen reader announcing breadcrumb as a link
|
40
|
+
}
|
41
|
+
else if (this.slottedLinkHref) {
|
42
|
+
(_b = this.slottedLinkEl) === null || _b === void 0 ? void 0 : _b.setAttribute(this.HREF_ATTR, this.slottedLinkHref);
|
42
43
|
}
|
43
44
|
};
|
44
45
|
this.getSlottedLinkEl = () => {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
return elWithHref;
|
51
|
-
}
|
52
|
-
return null;
|
46
|
+
if (!this.linkSlotContent)
|
47
|
+
return null;
|
48
|
+
return this.linkSlotContent.hasAttribute(this.HREF_ATTR)
|
49
|
+
? this.linkSlotContent
|
50
|
+
: this.linkSlotContent.querySelector("[href]");
|
53
51
|
};
|
54
52
|
this.renderBackIcon = () => (h("div", { class: "back-icon", innerHTML: backIcon }));
|
55
|
-
this.renderDefaultBreadcrumb = (current, pageTitle, describedById, href) => {
|
56
|
-
const hasPageTitle = pageTitle !== null && isPropDefined(pageTitle) && pageTitle !== "";
|
57
|
-
if (current && hasPageTitle) {
|
58
|
-
return (h("span", { class: {
|
59
|
-
"current-page-container": current,
|
60
|
-
} }, isSlotUsed(this.el, "icon") && h("slot", { name: "icon" }), pageTitle));
|
61
|
-
}
|
62
|
-
return (h("ic-link", { theme: this.theme, monochrome: this.monochrome, href: href, class: "breadcrumb-link", "aria-describedby": this.showBackIcon && describedById && describedById }, this.showBackIcon && this.renderBackIcon(), isSlotUsed(this.el, "icon") && h("slot", { name: "icon" }), pageTitle));
|
63
|
-
};
|
64
|
-
this.setSlottedCurrentPageClass = () => {
|
65
|
-
const icLink = this.el.querySelector("ic-link");
|
66
|
-
const currentPage = "current-page";
|
67
|
-
if (icLink) {
|
68
|
-
icLink.classList.remove(currentPage);
|
69
|
-
if (this.current) {
|
70
|
-
const hasCurrentPageClass = icLink.classList.contains(currentPage);
|
71
|
-
if (!hasCurrentPageClass) {
|
72
|
-
icLink.classList.add("breadcrumb-link", currentPage);
|
73
|
-
}
|
74
|
-
}
|
75
|
-
}
|
76
|
-
};
|
77
53
|
}
|
78
54
|
watchCurrentHandler() {
|
79
55
|
this.updatedSlottedLinkFocus();
|
@@ -86,14 +62,21 @@ export class Breadcrumb {
|
|
86
62
|
const slotEls = getSlotElements(slottedLinkWrapper);
|
87
63
|
if (slotEls) {
|
88
64
|
this.linkSlotContent = slotEls[0];
|
65
|
+
this.slottedLinkEl = this.getSlottedLinkEl();
|
66
|
+
this.slottedLinkHref = ((_b = this.slottedLinkEl) === null || _b === void 0 ? void 0 : _b.getAttribute("href")) || null;
|
89
67
|
}
|
90
|
-
this.slottedLinkEl = this.getSlottedLinkEl();
|
91
|
-
this.slottedLinkHref = (_b = this.slottedLinkEl) === null || _b === void 0 ? void 0 : _b.getAttribute("href");
|
92
68
|
this.updatedSlottedLinkFocus();
|
93
69
|
}
|
94
70
|
}
|
95
71
|
componentWillRender() {
|
96
|
-
this.
|
72
|
+
const icLink = this.el.querySelector("ic-link");
|
73
|
+
if (icLink) {
|
74
|
+
const CURRENT_PAGE = "current-page";
|
75
|
+
icLink.classList.remove(CURRENT_PAGE);
|
76
|
+
if (this.current && !icLink.classList.contains(CURRENT_PAGE)) {
|
77
|
+
icLink.classList.add("breadcrumb-link", CURRENT_PAGE);
|
78
|
+
}
|
79
|
+
}
|
97
80
|
}
|
98
81
|
/**
|
99
82
|
* Sets focus on the breadcrumb.
|
@@ -103,15 +86,13 @@ export class Breadcrumb {
|
|
103
86
|
(_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("ic-link")) === null || _b === void 0 ? void 0 : _b.focus();
|
104
87
|
}
|
105
88
|
render() {
|
106
|
-
const { current, href, pageTitle } = this;
|
107
|
-
const describedById = `${pageTitle
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
"ic-breadcrumb-monochrome": !!this.monochrome,
|
114
|
-
}, "aria-current": current && "page", role: "listitem" }, h("div", { key: 'e3bc601db155acfd4e14102b0599416007152fb1', class: "breadcrumb" }, h("span", { key: 'fa88e451ad018ab3af5da63f3f9072b1a5d61856', innerHTML: chevronIcon, class: "chevron", "aria-hidden": "true" }), this.showBackIcon && describedById && (h("span", { key: '30c614b37073b3f6f9d371c0760047924962cacc', id: describedById, class: "hide" }, `Back to ${pageTitle}`)), hasPageTitle && hasHref ? (this.renderDefaultBreadcrumb(!!current, pageTitle, describedById, href)) : (h("div", { class: "slotted-link-container" }, this.showBackIcon && this.renderBackIcon(), h("span", { class: "link-wrapper" }, h("slot", null)))))));
|
89
|
+
const { current, href, monochrome, pageTitle, showBackIcon, theme } = this;
|
90
|
+
const describedById = `${pageTitle === null || pageTitle === void 0 ? void 0 : pageTitle.toLowerCase().replace(" ", "-")}-describedby`;
|
91
|
+
return (h(Host, { key: '0a6d1443010427dbc75347c9c69b7c40680be25f', class: {
|
92
|
+
"ic-breadcrumb-back": showBackIcon,
|
93
|
+
"ic-breadcrumb-monochrome": monochrome,
|
94
|
+
[`ic-theme-${theme}`]: theme !== "inherit",
|
95
|
+
}, "aria-current": current && "page", role: "listitem" }, h("div", { key: 'bd351348bd835963705c29c5aa4e857c3752d645', class: "breadcrumb" }, h("span", { key: '9a4e28f31aa1c8cf2e111a0ce64902abba338461', innerHTML: chevronIcon, class: "chevron", "aria-hidden": "true" }), showBackIcon && (h("span", { key: '289414d58963cea6e68b782ba36df782690db04a', id: describedById, class: "hide" }, `Back to ${pageTitle}`)), !href ? (h("div", { class: "slotted-link-container" }, showBackIcon && this.renderBackIcon(), h("span", { class: "link-wrapper" }, h("slot", null)))) : current ? (h("span", { class: "current-page-container" }, isSlotUsed(this.el, "icon") && h("slot", { name: "icon" }), pageTitle)) : (h("ic-link", { theme: theme, monochrome: monochrome, href: href, class: "breadcrumb-link", "aria-describedby": showBackIcon && describedById }, showBackIcon && this.renderBackIcon(), isSlotUsed(this.el, "icon") && h("slot", { name: "icon" }), pageTitle)))));
|
115
96
|
}
|
116
97
|
static get is() { return "ic-breadcrumb"; }
|
117
98
|
static get encapsulation() { return "shadow"; }
|
@@ -133,11 +114,11 @@ export class Breadcrumb {
|
|
133
114
|
"mutable": false,
|
134
115
|
"complexType": {
|
135
116
|
"original": "boolean",
|
136
|
-
"resolved": "boolean
|
117
|
+
"resolved": "boolean",
|
137
118
|
"references": {}
|
138
119
|
},
|
139
120
|
"required": false,
|
140
|
-
"optional":
|
121
|
+
"optional": false,
|
141
122
|
"docs": {
|
142
123
|
"tags": [],
|
143
124
|
"text": "If `true`, aria-current will be set on the breadcrumb."
|
@@ -172,11 +153,11 @@ export class Breadcrumb {
|
|
172
153
|
"mutable": false,
|
173
154
|
"complexType": {
|
174
155
|
"original": "boolean",
|
175
|
-
"resolved": "boolean
|
156
|
+
"resolved": "boolean",
|
176
157
|
"references": {}
|
177
158
|
},
|
178
159
|
"required": false,
|
179
|
-
"optional":
|
160
|
+
"optional": false,
|
180
161
|
"docs": {
|
181
162
|
"tags": [{
|
182
163
|
"name": "internal",
|
@@ -214,11 +195,11 @@ export class Breadcrumb {
|
|
214
195
|
"mutable": false,
|
215
196
|
"complexType": {
|
216
197
|
"original": "boolean",
|
217
|
-
"resolved": "boolean
|
198
|
+
"resolved": "boolean",
|
218
199
|
"references": {}
|
219
200
|
},
|
220
201
|
"required": false,
|
221
|
-
"optional":
|
202
|
+
"optional": false,
|
222
203
|
"docs": {
|
223
204
|
"tags": [{
|
224
205
|
"name": "internal",
|
@@ -237,7 +218,7 @@ export class Breadcrumb {
|
|
237
218
|
"mutable": false,
|
238
219
|
"complexType": {
|
239
220
|
"original": "IcThemeMode",
|
240
|
-
"resolved": "\"dark\" | \"inherit\" | \"light\"
|
221
|
+
"resolved": "\"dark\" | \"inherit\" | \"light\"",
|
241
222
|
"references": {
|
242
223
|
"IcThemeMode": {
|
243
224
|
"location": "import",
|
@@ -247,7 +228,7 @@ export class Breadcrumb {
|
|
247
228
|
}
|
248
229
|
},
|
249
230
|
"required": false,
|
250
|
-
"optional":
|
231
|
+
"optional": false,
|
251
232
|
"docs": {
|
252
233
|
"tags": [{
|
253
234
|
"name": "internal",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ic-breadcrumb.js","sourceRoot":"","sources":["../../../src/components/ic-breadcrumb/ic-breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,OAAO,EACP,MAAM,EACN,KAAK,GACN,MAAM,eAAe,CAAC;AAGvB,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,QAAQ,MAAM,4BAA4B,CAAC;AAClD,OAAO,EACL,eAAe,EACf,aAAa,EACb,UAAU,GACX,MAAM,qBAAqB,CAAC;AAG7B;;GAEG;AAQH,MAAM,OAAO,UAAU;IAPvB;QAQU,cAAS,GAAG,MAAM,CAAC;QAO3B;;WAEG;QACK,YAAO,GAAa,KAAK,CAAC;QAYlC;;WAEG;QACK,eAAU,GAAa,KAAK,CAAC;QAOrC;;WAEG;QACsB,iBAAY,GAAa,KAAK,CAAC;QAExD;;WAEG;QACK,UAAK,GAAiB,SAAS,CAAC;QAExC,wEAAwE;QAChE,4BAAuB,GAAG,GAAS,EAAE;YAC3C,wDAAwD;YACxD,mFAAmF;YACnF,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACzB,IAAI,CAAC,eAAe,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB;YACzE,CAAC;YAED,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjB,IAAI,CAAC,aAAa,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AU;YAEf,4DAAK,KAAK,EAAC,YAAY;gBACrB,6DAAM,SAAS,EAAE,WAAW,EAAE,KAAK,EAAC,SAAS,iBAAa,MAAM,GAAG;gBAClE,IAAI,CAAC,YAAY,IAAI,aAAa,IAAI,CACrC,6DACE,EAAE,EAAE,aAAa,EACjB,KAAK,EAAC,MAAM,IACZ,WAAW,SAAS,EAAE,CAAQ,CACjC;gBACA,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,CACzB,IAAI,CAAC,uBAAuB,CAC1B,CAAC,CAAC,OAAO,EACT,SAAS,EACT,aAAa,EACb,IAAI,CACL,CACF,CAAC,CAAC,CAAC,CACF,WAAK,KAAK,EAAC,wBAAwB;oBAChC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,cAAc,EAAE;oBAC3C,YAAM,KAAK,EAAC,cAAc;wBACxB,eAAQ,CACH,CACH,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Prop,\n h,\n Element,\n Method,\n Watch,\n} from \"@stencil/core\";\nimport { IcBreadcrumbDefault } from \"./ic-breadcrumb.types\";\n\nimport chevronIcon from \"../../assets/chevron-icon.svg\";\nimport backIcon from \"../../assets/back-icon.svg\";\nimport {\n getSlotElements,\n isPropDefined,\n isSlotUsed,\n} from \"../../utils/helpers\";\nimport { IcThemeMode } from \"../../utils/types\";\n\n/**\n * @slot icon - Content will be rendered to the left of the breadcrumb page title.\n */\n@Component({\n tag: \"ic-breadcrumb\",\n styleUrl: \"ic-breadcrumb.css\",\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class Breadcrumb {\n private HREF_ATTR = \"href\";\n private linkSlotContent: HTMLElement;\n private slottedLinkEl: HTMLElement | null;\n private slottedLinkHref: string | null | undefined;\n\n @Element() el: HTMLIcBreadcrumbElement;\n\n /**\n * If `true`, aria-current will be set on the breadcrumb.\n */\n @Prop() current?: boolean = false;\n @Watch(\"current\")\n watchCurrentHandler(): void {\n this.updatedSlottedLinkFocus();\n this.el.ariaCurrent = this.current ? \"page\" : null;\n }\n\n /**\n * The URL that the breadcrumb link points to.\n */\n @Prop() href?: string;\n\n /**\n * @internal If `true`, the breadcrumb will display as black in the light theme, and white in the dark theme.\n */\n @Prop() monochrome?: boolean = false;\n\n /**\n * The title of the breadcrumb.\n */\n @Prop() pageTitle!: string;\n\n /**\n * @internal If `true`, back icon will be displayed.\n */\n @Prop({ reflect: true }) showBackIcon?: boolean = false;\n\n /**\n * @internal Sets the theme color to the dark or light theme color. \"inherit\" will set the color based on the system settings or ic-theme component.\n */\n @Prop() theme?: IcThemeMode = \"inherit\";\n\n // Prevent focus on breadcrumb if current page and contains slotted link\n private updatedSlottedLinkFocus = (): void => {\n // Sets tabindex on wrong element in unit test snapshots\n // - related to known Jest issue: https://github.com/ionic-team/stencil/issues/2830\n if (this.linkSlotContent) {\n this.linkSlotContent.tabIndex = this.current ? -1 : 0; // Prevent focus\n }\n\n if (this.slottedLinkEl) {\n if (this.current) {\n this.slottedLinkEl.removeAttribute(this.HREF_ATTR); // Prevent screen reader announcing breadcrumb as a link\n } else {\n this.slottedLinkHref &&\n this.slottedLinkEl.setAttribute(this.HREF_ATTR, this.slottedLinkHref);\n }\n }\n };\n\n private getSlottedLinkEl = (): HTMLElement | null => {\n const link = this.linkSlotContent;\n if (link) {\n const elWithHref = link.hasAttribute(this.HREF_ATTR)\n ? link\n : link.querySelector(\"[href]\");\n return elWithHref as HTMLElement;\n }\n return null;\n };\n\n componentDidLoad(): void {\n const slottedLinkWrapper =\n this.el.shadowRoot?.querySelector(\".link-wrapper\");\n\n if (slottedLinkWrapper) {\n const slotEls = getSlotElements(slottedLinkWrapper);\n if (slotEls) {\n this.linkSlotContent = slotEls[0] as HTMLElement;\n }\n this.slottedLinkEl = this.getSlottedLinkEl();\n this.slottedLinkHref = this.slottedLinkEl?.getAttribute(\"href\");\n this.updatedSlottedLinkFocus();\n }\n }\n\n componentWillRender(): void {\n this.setSlottedCurrentPageClass();\n }\n\n /**\n * Sets focus on the breadcrumb.\n */\n @Method()\n async setFocus(): Promise<void> {\n this.el.shadowRoot?.querySelector(\"ic-link\")?.focus();\n }\n\n private renderBackIcon = () => (\n <div class=\"back-icon\" innerHTML={backIcon}></div>\n );\n\n private renderDefaultBreadcrumb = (\n current: boolean,\n pageTitle: string,\n describedById: string,\n href: string | undefined\n ): IcBreadcrumbDefault => {\n const hasPageTitle =\n pageTitle !== null && isPropDefined(pageTitle) && pageTitle !== \"\";\n\n if (current && hasPageTitle) {\n return (\n <span\n class={{\n \"current-page-container\": current,\n }}\n >\n {isSlotUsed(this.el, \"icon\") && <slot name=\"icon\"></slot>}\n {pageTitle}\n </span>\n );\n }\n\n return (\n <ic-link\n theme={this.theme}\n monochrome={this.monochrome}\n href={href}\n class=\"breadcrumb-link\"\n aria-describedby={this.showBackIcon && describedById && describedById}\n >\n {this.showBackIcon && this.renderBackIcon()}\n {isSlotUsed(this.el, \"icon\") && <slot name=\"icon\"></slot>}\n {pageTitle}\n </ic-link>\n );\n };\n\n private setSlottedCurrentPageClass = () => {\n const icLink = this.el.querySelector(\"ic-link\");\n const currentPage = \"current-page\";\n if (icLink) {\n icLink.classList.remove(currentPage);\n if (this.current) {\n const hasCurrentPageClass = icLink.classList.contains(currentPage);\n if (!hasCurrentPageClass) {\n icLink.classList.add(\"breadcrumb-link\", currentPage);\n }\n }\n }\n };\n\n render() {\n const { current, href, pageTitle } = this;\n const describedById = `${\n pageTitle && pageTitle.toLowerCase().replace(\" \", \"-\")\n }-describedby`;\n\n const hasPageTitle =\n pageTitle !== null && isPropDefined(pageTitle) && pageTitle !== \"\";\n const hasHref = href !== null && isPropDefined(href) && href !== \"\";\n\n return (\n <Host\n class={{\n \"ic-breadcrumb-back\": !!this.showBackIcon,\n [`ic-theme-${this.theme}`]: this.theme !== \"inherit\",\n \"ic-breadcrumb-monochrome\": !!this.monochrome,\n }}\n aria-current={current && \"page\"}\n role=\"listitem\"\n >\n <div class=\"breadcrumb\">\n <span innerHTML={chevronIcon} class=\"chevron\" aria-hidden=\"true\" />\n {this.showBackIcon && describedById && (\n <span\n id={describedById}\n class=\"hide\"\n >{`Back to ${pageTitle}`}</span>\n )}\n {hasPageTitle && hasHref ? (\n this.renderDefaultBreadcrumb(\n !!current,\n pageTitle,\n describedById,\n href\n )\n ) : (\n <div class=\"slotted-link-container\">\n {this.showBackIcon && this.renderBackIcon()}\n <span class=\"link-wrapper\">\n <slot />\n </span>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ic-breadcrumb.js","sourceRoot":"","sources":["../../../src/components/ic-breadcrumb/ic-breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,OAAO,EACP,MAAM,EACN,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,QAAQ,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGlE;;GAEG;AAQH,MAAM,OAAO,UAAU;IAPvB;QAQU,cAAS,GAAG,MAAM,CAAC;QACnB,oBAAe,GAAuB,IAAI,CAAC;QAC3C,kBAAa,GAAuB,IAAI,CAAC;QACzC,oBAAe,GAAkB,IAAI,CAAC;QAI9C;;WAEG;QACK,YAAO,GAAG,KAAK,CAAC;QAYxB;;WAEG;QACK,eAAU,GAAG,KAAK,CAAC;QAO3B;;WAEG;QACsB,iBAAY,GAAG,KAAK,CAAC;QAE9C;;WAEG;QACK,UAAK,GAAgB,SAAS,CAAC;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CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Prop,\n h,\n Element,\n Method,\n Watch,\n} from \"@stencil/core\";\n\nimport chevronIcon from \"../../assets/chevron-icon.svg\";\nimport backIcon from \"../../assets/back-icon.svg\";\nimport { getSlotElements, isSlotUsed } from \"../../utils/helpers\";\nimport { IcThemeMode } from \"../../utils/types\";\n\n/**\n * @slot icon - Content will be rendered to the left of the breadcrumb page title.\n */\n@Component({\n tag: \"ic-breadcrumb\",\n styleUrl: \"ic-breadcrumb.css\",\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class Breadcrumb {\n private HREF_ATTR = \"href\";\n private linkSlotContent: HTMLElement | null = null;\n private slottedLinkEl: HTMLElement | null = null;\n private slottedLinkHref: string | null = null;\n\n @Element() el: HTMLIcBreadcrumbElement;\n\n /**\n * If `true`, aria-current will be set on the breadcrumb.\n */\n @Prop() current = false;\n @Watch(\"current\")\n watchCurrentHandler(): void {\n this.updatedSlottedLinkFocus();\n this.el.ariaCurrent = this.current ? \"page\" : null;\n }\n\n /**\n * The URL that the breadcrumb link points to.\n */\n @Prop() href?: string;\n\n /**\n * @internal If `true`, the breadcrumb will display as black in the light theme, and white in the dark theme.\n */\n @Prop() monochrome = false;\n\n /**\n * The title of the breadcrumb.\n */\n @Prop() pageTitle!: string;\n\n /**\n * @internal If `true`, back icon will be displayed.\n */\n @Prop({ reflect: true }) showBackIcon = false;\n\n /**\n * @internal Sets the theme color to the dark or light theme color. \"inherit\" will set the color based on the system settings or ic-theme component.\n */\n @Prop() theme: IcThemeMode = \"inherit\";\n\n // Prevent focus on breadcrumb if current page and contains slotted link\n private updatedSlottedLinkFocus = () => {\n // Sets tabindex on wrong element in unit test snapshots\n // - related to known Jest issue: https://github.com/ionic-team/stencil/issues/2830\n if (this.linkSlotContent) {\n this.linkSlotContent.tabIndex = this.current ? -1 : 0; // Prevent focus\n }\n\n if (this.current) {\n this.slottedLinkEl?.removeAttribute(this.HREF_ATTR); // Prevent screen reader announcing breadcrumb as a link\n } else if (this.slottedLinkHref) {\n this.slottedLinkEl?.setAttribute(this.HREF_ATTR, this.slottedLinkHref);\n }\n };\n\n private getSlottedLinkEl = () => {\n if (!this.linkSlotContent) return null;\n\n return this.linkSlotContent.hasAttribute(this.HREF_ATTR)\n ? this.linkSlotContent\n : this.linkSlotContent.querySelector<HTMLElement>(\"[href]\");\n };\n\n componentDidLoad(): void {\n const slottedLinkWrapper =\n this.el.shadowRoot?.querySelector(\".link-wrapper\");\n\n if (slottedLinkWrapper) {\n const slotEls = getSlotElements(slottedLinkWrapper);\n if (slotEls) {\n this.linkSlotContent = slotEls[0] as HTMLElement;\n this.slottedLinkEl = this.getSlottedLinkEl();\n this.slottedLinkHref = this.slottedLinkEl?.getAttribute(\"href\") || null;\n }\n this.updatedSlottedLinkFocus();\n }\n }\n\n componentWillRender(): void {\n const icLink = this.el.querySelector(\"ic-link\");\n if (icLink) {\n const CURRENT_PAGE = \"current-page\";\n icLink.classList.remove(CURRENT_PAGE);\n\n if (this.current && !icLink.classList.contains(CURRENT_PAGE)) {\n icLink.classList.add(\"breadcrumb-link\", CURRENT_PAGE);\n }\n }\n }\n\n /**\n * Sets focus on the breadcrumb.\n */\n @Method()\n async setFocus(): Promise<void> {\n this.el.shadowRoot?.querySelector(\"ic-link\")?.focus();\n }\n\n private renderBackIcon = () => (\n <div class=\"back-icon\" innerHTML={backIcon}></div>\n );\n\n render() {\n const { current, href, monochrome, pageTitle, showBackIcon, theme } = this;\n const describedById = `${pageTitle\n ?.toLowerCase()\n .replace(\" \", \"-\")}-describedby`;\n\n return (\n <Host\n class={{\n \"ic-breadcrumb-back\": showBackIcon,\n \"ic-breadcrumb-monochrome\": monochrome,\n [`ic-theme-${theme}`]: theme !== \"inherit\",\n }}\n aria-current={current && \"page\"}\n role=\"listitem\"\n >\n <div class=\"breadcrumb\">\n <span innerHTML={chevronIcon} class=\"chevron\" aria-hidden=\"true\" />\n {showBackIcon && (\n <span\n id={describedById}\n class=\"hide\"\n >{`Back to ${pageTitle}`}</span>\n )}\n {!href ? (\n <div class=\"slotted-link-container\">\n {showBackIcon && this.renderBackIcon()}\n <span class=\"link-wrapper\">\n <slot />\n </span>\n </div>\n ) : current ? (\n <span class=\"current-page-container\">\n {isSlotUsed(this.el, \"icon\") && <slot name=\"icon\"></slot>}\n {pageTitle}\n </span>\n ) : (\n <ic-link\n theme={theme}\n monochrome={monochrome}\n href={href}\n class=\"breadcrumb-link\"\n aria-describedby={showBackIcon && describedById}\n >\n {showBackIcon && this.renderBackIcon()}\n {isSlotUsed(this.el, \"icon\") && <slot name=\"icon\"></slot>}\n {pageTitle}\n </ic-link>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|