@kirbydesign/extensions-angular 3.0.0 → 3.1.1

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.
@@ -53,6 +53,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
53
53
  class ImageBannerComponent {
54
54
  constructor(translations) {
55
55
  this.translations = translations;
56
+ /**
57
+ * Whether the button should be shown in narrow view or not.
58
+ */
59
+ this.showButtonInNarrowView = false;
60
+ /**
61
+ * The text of the button in the content area of the image banner. If left empty, will default to 'Read more' (or equivalent translation for [supported locales](https://cookbook.kirby.design/#/home/localization)).
62
+ */
63
+ this.actionButtonText = this.translations.get('readMore');
56
64
  /**
57
65
  * The blur-effect used for the background.
58
66
  */
@@ -84,17 +92,19 @@ class ImageBannerComponent {
84
92
  this.imageError.emit($event);
85
93
  }
86
94
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ImageBannerComponent, deps: [{ token: i1.TranslationService }], target: i0.ɵɵFactoryTarget.Component }); }
87
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.4", type: ImageBannerComponent, isStandalone: true, selector: "kirby-x-image-banner", inputs: { title: "title", imagePath: "imagePath", bodyText: "bodyText", actionButtonText: "actionButtonText", externalLink: "externalLink", backgroundBlur: "backgroundBlur" }, outputs: { bannerClick: "bannerClick", dismissClick: "dismissClick", imageError: "imageError" }, host: { properties: { "class": "this.backgroundBlur" } }, hostDirectives: [{ directive: ImageBannerHeightDirective }], ngImport: i0, template: "<kirby-card *ngIf=\"externalLink\" [themeColor]=\"backgroundBlur === 'none' ? 'white' : 'dark'\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n</kirby-card>\n\n<kirby-card\n *ngIf=\"!externalLink\"\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : 'dark'\"\n (click)=\"bannerClicked($event)\"\n>\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n</kirby-card>\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n <a *ngIf=\"externalLink\" class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold header-text\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <div class=\"main-content-body-text\">\n <span class=\"kirby-text-small body-text\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </span>\n </div>\n\n <ng-container *ngIf=\"externalLink\">\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"!actionButtonText\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n {{ actionButtonText }}\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n </ng-container>\n\n <button\n class=\"main-content-body-action-text\"\n kirby-button\n *ngIf=\"actionButtonText && !externalLink\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n {{ actionButtonText }}\n </button>\n </div>\n </div>\n </div>\n\n <div class=\"dismiss\" *ngIf=\"dismissClick.observed\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n</ng-template>\n", styles: [":host{display:block}:host(.none) .blur-image{display:none}@container banner (width < 600px){:host(.none) .dismiss{--kirby-inputs-background-color: var(--kirby-white);--kirby-inputs-background-color-hover: var(--kirby-dark-overlay-10);--kirby-inputs-background-color-active: var(--kirby-dark-overlay-20);--kirby-inputs-color: var(--kirby-black)}}:host(.none) .main-content-body-action-link{color:var(--kirby-semi-dark)}:host(.dark) .blur-image{filter:blur(60px) brightness(.8)}:host(.light) .blur-image{filter:blur(60px) brightness(1.3)}.blur-image-wrapper{position:absolute;inset:-180px;z-index:-1}.blur-image{display:block;width:100%;height:100%;object-fit:cover;object-position:center}kirby-card{container-name:banner;container-type:inline-size;height:100%}.main-content-wrapper{width:100%;padding:8px;box-sizing:border-box;display:flex;flex-direction:column}@container banner (width >= 600px){.main-content-wrapper{gap:16px;flex-direction:initial}}.main-content-image-wrapper{display:flex;overflow:hidden;border-radius:8px}@container banner (width >= 600px){.main-content-image-wrapper{flex:1}}.main-content{display:flex;min-height:var(--kirby-x-image-banner-min-height, 84px);box-sizing:border-box;flex-direction:column;padding:12px 0 8px 8px;overflow:hidden}.main-content .main-content-header{padding-inline-end:8px}@container banner (width >= 600px){.main-content .main-content-header{padding-inline-end:40px}}.main-content:has(.main-content-body-action-link) .main-content-header{padding-inline-end:40px}.main-content:has(.header-text:empty):has(.body-text:empty){padding-block-start:0}.main-content:has(.body-text:empty):has(.header-text:empty){padding-block-end:0}@container banner (width >= 600px){.main-content{flex:1;gap:12px;padding:8px 8px 8px 0}}.main-content-anchor{position:absolute;inset:0}.main-content-header p{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;margin-bottom:0}.main-content-image{width:100%;height:132px;object-fit:cover;object-position:center}@container banner (width >= 600px){.main-content-image{height:164px}}.main-content-body{display:flex;justify-content:space-between;gap:16px;height:100%}@container banner (width >= 600px){.main-content-body{flex-direction:column;max-width:324px}}@container banner (width >= 600px){.main-content-body .main-content-body-action-link{display:none}}.main-content-body-text{display:block;overflow:hidden;max-height:40px;padding-inline-end:8px}@container banner (width >= 600px){.main-content-body-text{padding-inline-end:48px;max-height:64px}}.main-content-body-action-text{display:none}@container banner (width >= 600px){.main-content-body-action-text{align-self:start;display:inline-flex;margin:0}}.dismiss{position:absolute;top:16px;right:16px;height:fit-content}.dismiss button{margin:0}\n"], dependencies: [{ kind: "ngmodule", type: CardModule }, { kind: "component", type: i3.CardComponent, selector: "kirby-card", inputs: ["title", "subtitle", "backgroundImageUrl", "hasPadding", "sizes", "variant"] }, { kind: "directive", type: i3.CardAsButtonDirective, selector: "kirby-card[click]" }, { kind: "directive", type: i1.ThemeColorDirective, selector: "kirby-avatar[themeColor], kirby-card[themeColor], kirby-icon[themeColor], kirby-progress-circle-ring[themeColor], kirby-modal-footer[themeColor], kirby-empty-state[themeColor]", inputs: ["themeColor"] }, { kind: "component", type: ButtonComponent, selector: "button[kirby-button],Button[kirby-button],a[kirby-button]", inputs: ["attentionLevel", "noDecoration", "themeColor", "expand", "isFloating", "size", "showIconOnly"] }, { kind: "ngmodule", type: IconModule }, { kind: "component", type: i4.IconComponent, selector: "kirby-icon", inputs: ["size", "name"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
95
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.4", type: ImageBannerComponent, isStandalone: true, selector: "kirby-x-image-banner", inputs: { title: "title", imagePath: "imagePath", bodyText: "bodyText", showButtonInNarrowView: "showButtonInNarrowView", actionButtonText: "actionButtonText", externalLink: "externalLink", backgroundBlur: "backgroundBlur" }, outputs: { bannerClick: "bannerClick", dismissClick: "dismissClick", imageError: "imageError" }, host: { properties: { "class": "this.backgroundBlur" } }, hostDirectives: [{ directive: ImageBannerHeightDirective }], ngImport: i0, template: "@if (externalLink) {\n <kirby-card [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n@if (!externalLink) {\n <kirby-card\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\"\n (click)=\"bannerClicked($event)\"\n >\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n @if (externalLink) {\n <a class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n }\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"text-content-layout\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <p class=\"main-content-body-text kirby-text-small\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </p>\n\n @if (!showButtonInNarrowView && externalLink) {\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n }\n </div>\n </div>\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n @if (externalLink) {\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [class.visible]=\"showButtonInNarrowView\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n }\n\n @if (!externalLink) {\n <button\n [class.visible]=\"showButtonInNarrowView\"\n class=\"main-content-body-action-text\"\n kirby-button\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n </button>\n }\n </div>\n </div>\n\n @if (dismissClick.observed) {\n <div class=\"dismiss\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n }\n</ng-template>\n", styles: [":host{display:block}:host(.none) .blur-image{display:none}@container banner (width < 600px){:host(.none) .dismiss{--kirby-inputs-background-color: var(--kirby-white);--kirby-inputs-background-color-hover: var(--kirby-dark-overlay-10);--kirby-inputs-background-color-active: var(--kirby-dark-overlay-20);--kirby-inputs-color: var(--kirby-black)}}:host(.none) .main-content-body-action-link{color:var(--kirby-semi-dark)}:host(.dark) .blur-image{filter:blur(110px)}:host(.light) .blur-image{filter:blur(110px)}:host(.dark) .blur-image-wrapper:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#00000052;z-index:1}:host(.light) .blur-image-wrapper:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff73;z-index:1}.blur-image-wrapper{position:absolute;inset:-330px;z-index:-1}.blur-image{display:block;width:100%;height:100%;object-fit:cover;object-position:center;transform:translateZ(0)}kirby-card{container-name:banner;container-type:inline-size;height:100%}.main-content-wrapper{width:100%;padding:8px;box-sizing:border-box;display:flex;flex-direction:column}@container banner (width >= 600px){.main-content-wrapper{gap:16px;flex-direction:initial}}.main-content-image-wrapper{display:flex;overflow:hidden;border-radius:8px}@container banner (width >= 600px){.main-content-image-wrapper{flex:1}}.main-content{display:flex;flex-direction:column;justify-content:space-between;min-height:var(--kirby-x-image-banner-min-height, 84px);box-sizing:border-box;padding:12px 0 8px 8px;overflow:hidden}@container banner (width < 600px){.main-content{flex-direction:row}}.main-content .main-content-header{padding-inline-end:8px}@container banner (width >= 600px){.main-content .main-content-header{padding-inline-end:40px}}.main-content:has(.main-content-body-action-link) .main-content-header{padding-inline-end:40px}@container banner (width >= 600px){.main-content{flex:1;gap:12px;padding:8px 8px 8px 0}}.main-content-anchor{position:absolute;inset:0}.main-content-header p{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;margin:0;padding:0}.main-content-image{width:100%;height:132px;object-fit:cover;object-position:center}@container banner (width >= 600px){.main-content-image{height:164px}}.main-content-body{display:flex;flex:1;justify-content:space-between;height:100%}.main-content-body p{text-wrap-mode:wrap;margin-bottom:0}@container banner (width >= 600px){.main-content-body{flex-direction:column;max-width:324px}}@container banner (width >= 600px){.main-content-body .main-content-body-action-link{display:none}}.main-content-body-text{display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;padding-inline-end:8px}@container banner (width >= 600px){.main-content-body-text{padding-inline-end:48px}}@container banner (width < 600px){.main-content-body-text{-webkit-line-clamp:2;line-clamp:2;max-height:3em}}.main-content-body-action-text{display:none}@container banner (width >= 600px){.main-content-body-action-text{align-self:start;display:inline-flex;margin:0}}.dismiss{position:absolute;top:16px;right:16px;height:fit-content}.dismiss button{margin:0}.visible{display:inline-flex}@container banner (width < 600px){button.visible,a.visible{align-self:center}}.text-content-layout{display:flex;flex:1;flex-direction:column;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@container banner (width >= 600px){.text-content-layout{gap:12px}}\n"], dependencies: [{ kind: "ngmodule", type: CardModule }, { kind: "component", type: i3.CardComponent, selector: "kirby-card", inputs: ["title", "subtitle", "backgroundImageUrl", "hasPadding", "sizes", "variant"] }, { kind: "directive", type: i3.CardAsButtonDirective, selector: "kirby-card[click]" }, { kind: "directive", type: i1.ThemeColorDirective, selector: "kirby-avatar[themeColor], kirby-card[themeColor], kirby-icon[themeColor], kirby-progress-circle-ring[themeColor], kirby-modal-footer[themeColor], kirby-empty-state[themeColor]", inputs: ["themeColor"] }, { kind: "component", type: ButtonComponent, selector: "button[kirby-button],Button[kirby-button],a[kirby-button]", inputs: ["attentionLevel", "noDecoration", "themeColor", "expand", "isFloating", "size", "showIconOnly"] }, { kind: "ngmodule", type: IconModule }, { kind: "component", type: i4.IconComponent, selector: "kirby-icon", inputs: ["size", "name"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
88
96
  }
89
97
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ImageBannerComponent, decorators: [{
90
98
  type: Component,
91
- args: [{ selector: 'kirby-x-image-banner', imports: [CardModule, ButtonComponent, IconModule, CommonModule], hostDirectives: [ImageBannerHeightDirective], template: "<kirby-card *ngIf=\"externalLink\" [themeColor]=\"backgroundBlur === 'none' ? 'white' : 'dark'\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n</kirby-card>\n\n<kirby-card\n *ngIf=\"!externalLink\"\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : 'dark'\"\n (click)=\"bannerClicked($event)\"\n>\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n</kirby-card>\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n <a *ngIf=\"externalLink\" class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold header-text\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <div class=\"main-content-body-text\">\n <span class=\"kirby-text-small body-text\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </span>\n </div>\n\n <ng-container *ngIf=\"externalLink\">\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"!actionButtonText\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n {{ actionButtonText }}\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n </ng-container>\n\n <button\n class=\"main-content-body-action-text\"\n kirby-button\n *ngIf=\"actionButtonText && !externalLink\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n {{ actionButtonText }}\n </button>\n </div>\n </div>\n </div>\n\n <div class=\"dismiss\" *ngIf=\"dismissClick.observed\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n</ng-template>\n", styles: [":host{display:block}:host(.none) .blur-image{display:none}@container banner (width < 600px){:host(.none) .dismiss{--kirby-inputs-background-color: var(--kirby-white);--kirby-inputs-background-color-hover: var(--kirby-dark-overlay-10);--kirby-inputs-background-color-active: var(--kirby-dark-overlay-20);--kirby-inputs-color: var(--kirby-black)}}:host(.none) .main-content-body-action-link{color:var(--kirby-semi-dark)}:host(.dark) .blur-image{filter:blur(60px) brightness(.8)}:host(.light) .blur-image{filter:blur(60px) brightness(1.3)}.blur-image-wrapper{position:absolute;inset:-180px;z-index:-1}.blur-image{display:block;width:100%;height:100%;object-fit:cover;object-position:center}kirby-card{container-name:banner;container-type:inline-size;height:100%}.main-content-wrapper{width:100%;padding:8px;box-sizing:border-box;display:flex;flex-direction:column}@container banner (width >= 600px){.main-content-wrapper{gap:16px;flex-direction:initial}}.main-content-image-wrapper{display:flex;overflow:hidden;border-radius:8px}@container banner (width >= 600px){.main-content-image-wrapper{flex:1}}.main-content{display:flex;min-height:var(--kirby-x-image-banner-min-height, 84px);box-sizing:border-box;flex-direction:column;padding:12px 0 8px 8px;overflow:hidden}.main-content .main-content-header{padding-inline-end:8px}@container banner (width >= 600px){.main-content .main-content-header{padding-inline-end:40px}}.main-content:has(.main-content-body-action-link) .main-content-header{padding-inline-end:40px}.main-content:has(.header-text:empty):has(.body-text:empty){padding-block-start:0}.main-content:has(.body-text:empty):has(.header-text:empty){padding-block-end:0}@container banner (width >= 600px){.main-content{flex:1;gap:12px;padding:8px 8px 8px 0}}.main-content-anchor{position:absolute;inset:0}.main-content-header p{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;margin-bottom:0}.main-content-image{width:100%;height:132px;object-fit:cover;object-position:center}@container banner (width >= 600px){.main-content-image{height:164px}}.main-content-body{display:flex;justify-content:space-between;gap:16px;height:100%}@container banner (width >= 600px){.main-content-body{flex-direction:column;max-width:324px}}@container banner (width >= 600px){.main-content-body .main-content-body-action-link{display:none}}.main-content-body-text{display:block;overflow:hidden;max-height:40px;padding-inline-end:8px}@container banner (width >= 600px){.main-content-body-text{padding-inline-end:48px;max-height:64px}}.main-content-body-action-text{display:none}@container banner (width >= 600px){.main-content-body-action-text{align-self:start;display:inline-flex;margin:0}}.dismiss{position:absolute;top:16px;right:16px;height:fit-content}.dismiss button{margin:0}\n"] }]
99
+ args: [{ selector: 'kirby-x-image-banner', imports: [CardModule, ButtonComponent, IconModule, CommonModule], hostDirectives: [ImageBannerHeightDirective], template: "@if (externalLink) {\n <kirby-card [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n@if (!externalLink) {\n <kirby-card\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\"\n (click)=\"bannerClicked($event)\"\n >\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n @if (externalLink) {\n <a class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n }\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"text-content-layout\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <p class=\"main-content-body-text kirby-text-small\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </p>\n\n @if (!showButtonInNarrowView && externalLink) {\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n }\n </div>\n </div>\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n @if (externalLink) {\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [class.visible]=\"showButtonInNarrowView\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n }\n\n @if (!externalLink) {\n <button\n [class.visible]=\"showButtonInNarrowView\"\n class=\"main-content-body-action-text\"\n kirby-button\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n </button>\n }\n </div>\n </div>\n\n @if (dismissClick.observed) {\n <div class=\"dismiss\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n }\n</ng-template>\n", styles: [":host{display:block}:host(.none) .blur-image{display:none}@container banner (width < 600px){:host(.none) .dismiss{--kirby-inputs-background-color: var(--kirby-white);--kirby-inputs-background-color-hover: var(--kirby-dark-overlay-10);--kirby-inputs-background-color-active: var(--kirby-dark-overlay-20);--kirby-inputs-color: var(--kirby-black)}}:host(.none) .main-content-body-action-link{color:var(--kirby-semi-dark)}:host(.dark) .blur-image{filter:blur(110px)}:host(.light) .blur-image{filter:blur(110px)}:host(.dark) .blur-image-wrapper:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#00000052;z-index:1}:host(.light) .blur-image-wrapper:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffff73;z-index:1}.blur-image-wrapper{position:absolute;inset:-330px;z-index:-1}.blur-image{display:block;width:100%;height:100%;object-fit:cover;object-position:center;transform:translateZ(0)}kirby-card{container-name:banner;container-type:inline-size;height:100%}.main-content-wrapper{width:100%;padding:8px;box-sizing:border-box;display:flex;flex-direction:column}@container banner (width >= 600px){.main-content-wrapper{gap:16px;flex-direction:initial}}.main-content-image-wrapper{display:flex;overflow:hidden;border-radius:8px}@container banner (width >= 600px){.main-content-image-wrapper{flex:1}}.main-content{display:flex;flex-direction:column;justify-content:space-between;min-height:var(--kirby-x-image-banner-min-height, 84px);box-sizing:border-box;padding:12px 0 8px 8px;overflow:hidden}@container banner (width < 600px){.main-content{flex-direction:row}}.main-content .main-content-header{padding-inline-end:8px}@container banner (width >= 600px){.main-content .main-content-header{padding-inline-end:40px}}.main-content:has(.main-content-body-action-link) .main-content-header{padding-inline-end:40px}@container banner (width >= 600px){.main-content{flex:1;gap:12px;padding:8px 8px 8px 0}}.main-content-anchor{position:absolute;inset:0}.main-content-header p{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;margin:0;padding:0}.main-content-image{width:100%;height:132px;object-fit:cover;object-position:center}@container banner (width >= 600px){.main-content-image{height:164px}}.main-content-body{display:flex;flex:1;justify-content:space-between;height:100%}.main-content-body p{text-wrap-mode:wrap;margin-bottom:0}@container banner (width >= 600px){.main-content-body{flex-direction:column;max-width:324px}}@container banner (width >= 600px){.main-content-body .main-content-body-action-link{display:none}}.main-content-body-text{display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;padding-inline-end:8px}@container banner (width >= 600px){.main-content-body-text{padding-inline-end:48px}}@container banner (width < 600px){.main-content-body-text{-webkit-line-clamp:2;line-clamp:2;max-height:3em}}.main-content-body-action-text{display:none}@container banner (width >= 600px){.main-content-body-action-text{align-self:start;display:inline-flex;margin:0}}.dismiss{position:absolute;top:16px;right:16px;height:fit-content}.dismiss button{margin:0}.visible{display:inline-flex}@container banner (width < 600px){button.visible,a.visible{align-self:center}}.text-content-layout{display:flex;flex:1;flex-direction:column;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@container banner (width >= 600px){.text-content-layout{gap:12px}}\n"] }]
92
100
  }], ctorParameters: () => [{ type: i1.TranslationService }], propDecorators: { title: [{
93
101
  type: Input
94
102
  }], imagePath: [{
95
103
  type: Input
96
104
  }], bodyText: [{
97
105
  type: Input
106
+ }], showButtonInNarrowView: [{
107
+ type: Input
98
108
  }], actionButtonText: [{
99
109
  type: Input
100
110
  }], externalLink: [{
@@ -1 +1 @@
1
- {"version":3,"file":"kirbydesign-extensions-angular-image-banner.mjs","sources":["../../image-banner/src/image-banner-height.directive.ts","../../image-banner/src/image-banner.component.ts","../../image-banner/src/image-banner.component.html","../../image-banner/src/kirbydesign-extensions-angular-image-banner.ts"],"sourcesContent":["import { Directive, ElementRef, inject, OnDestroy, OnInit, Renderer2 } from '@angular/core';\nimport { ResizeObserverService } from '@kirbydesign/designsystem/shared';\n\n/**\n * @Description Temporary directive to ensure correct scroll position behavior on Safari.\n *\n * When navigating between stacked pages, scroll position is not correctly restored on Safari,\n * when the nested kirby-card element uses containment and the host element does not have an explicit height.\n */\n@Directive({\n selector: `[kirbyImageBannerResize]`,\n})\nexport class ImageBannerHeightDirective implements OnInit, OnDestroy {\n private currentHeight: number = 0;\n private host = inject(ElementRef);\n private resizeObserverService = inject(ResizeObserverService);\n private renderer = inject(Renderer2);\n\n ngOnInit() {\n this.resizeObserverService.observe(this.host, (entry) => this.setCardHeightOnHost(entry));\n }\n\n ngOnDestroy() {\n this.resizeObserverService.unobserve(this.host);\n }\n\n private setCardHeightOnHost(entry: ResizeObserverEntry) {\n const hostElement = entry.target as HTMLElement;\n const card = hostElement.querySelector('kirby-card');\n const cardHeight = card?.getBoundingClientRect().height;\n\n if (!hostElement || !cardHeight) return;\n if (cardHeight === this.currentHeight) return;\n\n this.currentHeight = cardHeight;\n this.renderer.setStyle(hostElement, 'min-height', `${cardHeight}px`);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';\nimport { CardModule } from '@kirbydesign/designsystem/card';\nimport { ButtonComponent } from '@kirbydesign/designsystem/button';\nimport { IconModule } from '@kirbydesign/designsystem/icon';\nimport { TranslationService } from '@kirbydesign/designsystem/shared';\nimport { ImageBannerHeightDirective } from './image-banner-height.directive';\n\n@Component({\n selector: 'kirby-x-image-banner',\n imports: [CardModule, ButtonComponent, IconModule, CommonModule],\n hostDirectives: [ImageBannerHeightDirective],\n templateUrl: './image-banner.component.html',\n styleUrl: './image-banner.component.scss',\n})\nexport class ImageBannerComponent {\n /**\n * The title placed inside the image banners header.\n */\n @Input() title: string | undefined;\n\n /**\n * The image shown on the banner, and used for the background blur effect.\n */\n @Input() imagePath: string | undefined;\n\n /**\n * The body text placed below the title.\n */\n @Input() bodyText: string | undefined;\n\n /**\n * The text of the button in the content area of the image banner.\n */\n @Input() actionButtonText: string | undefined;\n\n /**\n * When an external link is supplied the entire banner will be an anchor-tag and navigate when activated.\n */\n @Input() externalLink: string | undefined;\n\n /**\n * The blur-effect used for the background.\n */\n @HostBinding('class')\n @Input()\n backgroundBlur: 'dark' | 'light' | 'none' = 'dark';\n\n /**\n * Emitted every time the banner is activated. The entire banner is interactive, and will be activated by click and keyboard interaction.\n */\n @Output() bannerClick = new EventEmitter<Event>();\n\n /**\n * If subscribed to, a dismiss button will be shown. Emitted every time the dismiss button is activated by click and keyboard interaction.\n */\n @Output() dismissClick = new EventEmitter<Event>();\n\n /**\n * If the input imagePath results in an error, it will be reflected in this output.\n */\n @Output()\n imageError = new EventEmitter<ErrorEvent>();\n\n constructor(public translations: TranslationService) {}\n\n public bannerClicked(event: Event) {\n const eventTarget = event.target as HTMLElement;\n const dismissButtonClicked = eventTarget.closest('.dismiss');\n if (dismissButtonClicked) return;\n this.bannerClick.emit(event);\n }\n\n public dismissClicked(event: Event) {\n this.dismissClick.emit(event);\n }\n\n public onImageError($event: ErrorEvent) {\n this.imageError.emit($event);\n }\n}\n","<kirby-card *ngIf=\"externalLink\" [themeColor]=\"backgroundBlur === 'none' ? 'white' : 'dark'\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n</kirby-card>\n\n<kirby-card\n *ngIf=\"!externalLink\"\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : 'dark'\"\n (click)=\"bannerClicked($event)\"\n>\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n</kirby-card>\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n <a *ngIf=\"externalLink\" class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold header-text\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <div class=\"main-content-body-text\">\n <span class=\"kirby-text-small body-text\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </span>\n </div>\n\n <ng-container *ngIf=\"externalLink\">\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"!actionButtonText\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n {{ actionButtonText }}\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n </ng-container>\n\n <button\n class=\"main-content-body-action-text\"\n kirby-button\n *ngIf=\"actionButtonText && !externalLink\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n {{ actionButtonText }}\n </button>\n </div>\n </div>\n </div>\n\n <div class=\"dismiss\" *ngIf=\"dismissClick.observed\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.ImageBannerHeightDirective"],"mappings":";;;;;;;;;;;;AAGA;;;;;AAKG;MAIU,0BAA0B,CAAA;AAHvC,IAAA,WAAA,GAAA;QAIU,IAAa,CAAA,aAAA,GAAW,CAAC;AACzB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,QAAA,IAAA,CAAA,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACrD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;AAqBrC;IAnBC,QAAQ,GAAA;QACN,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;;IAG3F,WAAW,GAAA;QACT,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;AAGzC,IAAA,mBAAmB,CAAC,KAA0B,EAAA;AACpD,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAqB;QAC/C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;sBAArB;gBAMD,UAAU,EAAA,CAAA;sBADT;;;AE7DH;;AAEG;;;;"}
1
+ {"version":3,"file":"kirbydesign-extensions-angular-image-banner.mjs","sources":["../../image-banner/src/image-banner-height.directive.ts","../../image-banner/src/image-banner.component.ts","../../image-banner/src/image-banner.component.html","../../image-banner/src/kirbydesign-extensions-angular-image-banner.ts"],"sourcesContent":["import { Directive, ElementRef, inject, OnDestroy, OnInit, Renderer2 } from '@angular/core';\nimport { ResizeObserverService } from '@kirbydesign/designsystem/shared';\n\n/**\n * @Description Temporary directive to ensure correct scroll position behavior on Safari.\n *\n * When navigating between stacked pages, scroll position is not correctly restored on Safari,\n * when the nested kirby-card element uses containment and the host element does not have an explicit height.\n */\n@Directive({\n selector: `[kirbyImageBannerResize]`,\n})\nexport class ImageBannerHeightDirective implements OnInit, OnDestroy {\n private currentHeight: number = 0;\n private host = inject(ElementRef);\n private resizeObserverService = inject(ResizeObserverService);\n private renderer = inject(Renderer2);\n\n ngOnInit() {\n this.resizeObserverService.observe(this.host, (entry) => this.setCardHeightOnHost(entry));\n }\n\n ngOnDestroy() {\n this.resizeObserverService.unobserve(this.host);\n }\n\n private setCardHeightOnHost(entry: ResizeObserverEntry) {\n const hostElement = entry.target as HTMLElement;\n const card = hostElement.querySelector('kirby-card');\n const cardHeight = card?.getBoundingClientRect().height;\n\n if (!hostElement || !cardHeight) return;\n if (cardHeight === this.currentHeight) return;\n\n this.currentHeight = cardHeight;\n this.renderer.setStyle(hostElement, 'min-height', `${cardHeight}px`);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';\nimport { CardModule } from '@kirbydesign/designsystem/card';\nimport { ButtonComponent } from '@kirbydesign/designsystem/button';\nimport { IconModule } from '@kirbydesign/designsystem/icon';\nimport { TranslationService } from '@kirbydesign/designsystem/shared';\nimport { ImageBannerHeightDirective } from './image-banner-height.directive';\n\n@Component({\n selector: 'kirby-x-image-banner',\n imports: [CardModule, ButtonComponent, IconModule, CommonModule],\n hostDirectives: [ImageBannerHeightDirective],\n templateUrl: './image-banner.component.html',\n styleUrl: './image-banner.component.scss',\n})\nexport class ImageBannerComponent {\n /**\n * The title placed inside the image banners header.\n */\n @Input() title: string | undefined;\n\n /**\n * The image shown on the banner, and used for the background blur effect.\n */\n @Input() imagePath: string | undefined;\n\n /**\n * The body text placed below the title.\n */\n @Input() bodyText: string | undefined;\n\n /**\n * Whether the button should be shown in narrow view or not.\n */\n @Input() showButtonInNarrowView: boolean = false;\n\n /**\n * The text of the button in the content area of the image banner. If left empty, will default to 'Read more' (or equivalent translation for [supported locales](https://cookbook.kirby.design/#/home/localization)).\n */\n @Input() actionButtonText: string | undefined = this.translations.get('readMore');\n\n /**\n * When an external link is supplied the entire banner will be an anchor-tag and navigate when activated.\n */\n @Input() externalLink: string | undefined;\n\n /**\n * The blur-effect used for the background.\n */\n @HostBinding('class')\n @Input()\n backgroundBlur: 'dark' | 'light' | 'none' = 'dark';\n\n /**\n * Emitted every time the banner is activated. The entire banner is interactive, and will be activated by click and keyboard interaction.\n */\n @Output() bannerClick = new EventEmitter<Event>();\n\n /**\n * If subscribed to, a dismiss button will be shown. Emitted every time the dismiss button is activated by click and keyboard interaction.\n */\n @Output() dismissClick = new EventEmitter<Event>();\n\n /**\n * If the input imagePath results in an error, it will be reflected in this output.\n */\n @Output()\n imageError = new EventEmitter<ErrorEvent>();\n\n constructor(public translations: TranslationService) {}\n\n public bannerClicked(event: Event) {\n const eventTarget = event.target as HTMLElement;\n const dismissButtonClicked = eventTarget.closest('.dismiss');\n if (dismissButtonClicked) return;\n this.bannerClick.emit(event);\n }\n\n public dismissClicked(event: Event) {\n this.dismissClick.emit(event);\n }\n\n public onImageError($event: ErrorEvent) {\n this.imageError.emit($event);\n }\n}\n","@if (externalLink) {\n <kirby-card [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\">\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n@if (!externalLink) {\n <kirby-card\n [themeColor]=\"backgroundBlur === 'none' ? 'white' : backgroundBlur\"\n (click)=\"bannerClicked($event)\"\n >\n <ng-container *ngTemplateOutlet=\"sharedCardContent\"></ng-container>\n </kirby-card>\n}\n\n<ng-template #sharedCardContent>\n <div class=\"blur-image-wrapper\">\n <img class=\"blur-image\" [src]=\"imagePath\" alt=\"\" />\n </div>\n\n <!-- When an external link is supplied, this anchor tag expands and fills the entire banner so users can click anywhere or focus the banner -->\n @if (externalLink) {\n <a class=\"main-content-anchor\" [href]=\"externalLink\" target=\"_blank\"></a>\n }\n\n <div class=\"main-content-wrapper\">\n <div class=\"main-content-image-wrapper\">\n <img class=\"main-content-image\" [src]=\"imagePath\" alt=\"\" (error)=\"onImageError($event)\" />\n </div>\n\n <div class=\"main-content\">\n <div class=\"text-content-layout\">\n <div class=\"main-content-header\">\n <p class=\"kirby-text-normal-bold\">\n @if (title) {\n {{ title }}\n } @else {\n <ng-content select=\"[title]\"></ng-content>\n }\n </p>\n </div>\n\n <div class=\"main-content-body\">\n <p class=\"main-content-body-text kirby-text-small\">\n @if (bodyText) {\n {{ bodyText }}\n } @else {\n <ng-content select=\"[bodyText]\"></ng-content>\n }\n </p>\n\n @if (!showButtonInNarrowView && externalLink) {\n <div class=\"main-content-body-action-link\">\n <kirby-icon name=\"link\"></kirby-icon>\n </div>\n }\n </div>\n </div>\n <!-- On large screens we also show a button-like anchor tag in addition to the entire banner anchor -->\n @if (externalLink) {\n <a\n kirby-button\n class=\"main-content-body-action-text\"\n [class.visible]=\"showButtonInNarrowView\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [href]=\"externalLink\"\n target=\"_blank\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n <kirby-icon name=\"link\"></kirby-icon>\n </a>\n }\n\n @if (!externalLink) {\n <button\n [class.visible]=\"showButtonInNarrowView\"\n class=\"main-content-body-action-text\"\n kirby-button\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n size=\"sm\"\n >\n @if (actionButtonText) {\n {{ actionButtonText }}\n } @else {\n {{ translations.get('readMore') }}\n }\n </button>\n }\n </div>\n </div>\n\n @if (dismissClick.observed) {\n <div class=\"dismiss\">\n <button\n kirby-button\n (click)=\"dismissClicked($event)\"\n [attentionLevel]=\"backgroundBlur === 'none' ? '3' : '2'\"\n [showIconOnly]=\"true\"\n size=\"xs\"\n [attr.aria-label]=\"translations.get('close') + ' ' + title\"\n >\n <kirby-icon name=\"close\"></kirby-icon>\n </button>\n </div>\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.ImageBannerHeightDirective"],"mappings":";;;;;;;;;;;;AAGA;;;;;AAKG;MAIU,0BAA0B,CAAA;AAHvC,IAAA,WAAA,GAAA;QAIU,IAAa,CAAA,aAAA,GAAW,CAAC;AACzB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AACzB,QAAA,IAAA,CAAA,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACrD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;AAqBrC;IAnBC,QAAQ,GAAA;QACN,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;;IAG3F,WAAW,GAAA;QACT,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;AAGzC,IAAA,mBAAmB,CAAC,KAA0B,EAAA;AACpD,QAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAqB;QAC/C,MAAM,IAAI,GAAG,WAAW,CAAC,aAAa,CAAC,YAAY,CAAC;QACpD,MAAM,UAAU,GAAG,IAAI,EAAE,qBAAqB,EAAE,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G;;;;"}
@@ -17,7 +17,11 @@ export declare class ImageBannerComponent {
17
17
  */
18
18
  bodyText: string | undefined;
19
19
  /**
20
- * The text of the button in the content area of the image banner.
20
+ * Whether the button should be shown in narrow view or not.
21
+ */
22
+ showButtonInNarrowView: boolean;
23
+ /**
24
+ * The text of the button in the content area of the image banner. If left empty, will default to 'Read more' (or equivalent translation for [supported locales](https://cookbook.kirby.design/#/home/localization)).
21
25
  */
22
26
  actionButtonText: string | undefined;
23
27
  /**
@@ -45,5 +49,5 @@ export declare class ImageBannerComponent {
45
49
  dismissClicked(event: Event): void;
46
50
  onImageError($event: ErrorEvent): void;
47
51
  static ɵfac: i0.ɵɵFactoryDeclaration<ImageBannerComponent, never>;
48
- static ɵcmp: i0.ɵɵComponentDeclaration<ImageBannerComponent, "kirby-x-image-banner", never, { "title": { "alias": "title"; "required": false; }; "imagePath": { "alias": "imagePath"; "required": false; }; "bodyText": { "alias": "bodyText"; "required": false; }; "actionButtonText": { "alias": "actionButtonText"; "required": false; }; "externalLink": { "alias": "externalLink"; "required": false; }; "backgroundBlur": { "alias": "backgroundBlur"; "required": false; }; }, { "bannerClick": "bannerClick"; "dismissClick": "dismissClick"; "imageError": "imageError"; }, never, ["[title]", "[bodyText]"], true, [{ directive: typeof i1.ImageBannerHeightDirective; inputs: {}; outputs: {}; }]>;
52
+ static ɵcmp: i0.ɵɵComponentDeclaration<ImageBannerComponent, "kirby-x-image-banner", never, { "title": { "alias": "title"; "required": false; }; "imagePath": { "alias": "imagePath"; "required": false; }; "bodyText": { "alias": "bodyText"; "required": false; }; "showButtonInNarrowView": { "alias": "showButtonInNarrowView"; "required": false; }; "actionButtonText": { "alias": "actionButtonText"; "required": false; }; "externalLink": { "alias": "externalLink"; "required": false; }; "backgroundBlur": { "alias": "backgroundBlur"; "required": false; }; }, { "bannerClick": "bannerClick"; "dismissClick": "dismissClick"; "imageError": "imageError"; }, never, ["[title]", "[bodyText]"], true, [{ directive: typeof i1.ImageBannerHeightDirective; inputs: {}; outputs: {}; }]>;
49
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirbydesign/extensions-angular",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^18.0.0 || ^19.0.0",
6
6
  "@angular/compiler": "^18.0.0 || ^19.0.0",
@@ -9,7 +9,7 @@
9
9
  "@angular/platform-browser": "^18.0.0 || ^19.0.0",
10
10
  "@angular/platform-browser-dynamic": "^18.0.0 || ^19.0.0",
11
11
  "@angular/router": "^18.0.0 || ^19.0.0",
12
- "@kirbydesign/designsystem": "^10.0.0",
12
+ "@kirbydesign/designsystem": "^10.0.0 || ^11.0.0",
13
13
  "rxjs": "~7.8.0",
14
14
  "zone.js": "^0.14.3 || ~0.15.0"
15
15
  },
@@ -27,14 +27,14 @@
27
27
  "types": "./index.d.ts",
28
28
  "default": "./fesm2022/kirbydesign-extensions-angular.mjs"
29
29
  },
30
- "./localization": {
31
- "types": "./localization/index.d.ts",
32
- "default": "./fesm2022/kirbydesign-extensions-angular-localization.mjs"
33
- },
34
30
  "./image-banner": {
35
31
  "types": "./image-banner/index.d.ts",
36
32
  "default": "./fesm2022/kirbydesign-extensions-angular-image-banner.mjs"
37
33
  },
34
+ "./localization": {
35
+ "types": "./localization/index.d.ts",
36
+ "default": "./fesm2022/kirbydesign-extensions-angular-localization.mjs"
37
+ },
38
38
  "./skeleton-loader": {
39
39
  "types": "./skeleton-loader/index.d.ts",
40
40
  "default": "./fesm2022/kirbydesign-extensions-angular-skeleton-loader.mjs"