i-tech-shared-components 1.4.94 → 1.4.95
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/fesm2022/i-tech-shared-components.mjs +86 -2
- package/fesm2022/i-tech-shared-components.mjs.map +1 -1
- package/lib/components/announcement-modal/announcement-modal.component.d.ts +45 -0
- package/lib/interfaces/announcement.interface.d.ts +44 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, inject, Injectable, HostListener, Input, Directive, EventEmitter, Output, Component, ViewChild, InjectionToken, Optional, Inject } from '@angular/core';
|
|
2
|
+
import { Pipe, inject, Injectable, HostListener, Input, Directive, EventEmitter, Output, Component, ViewChild, InjectionToken, Optional, Inject, ViewEncapsulation } from '@angular/core';
|
|
3
3
|
import * as i1 from '@ngx-translate/core';
|
|
4
4
|
import { TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core';
|
|
5
5
|
import * as i3 from '@angular/forms';
|
|
@@ -3489,6 +3489,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3489
3489
|
args: ['document:click', ['$event']]
|
|
3490
3490
|
}] } });
|
|
3491
3491
|
|
|
3492
|
+
/**
|
|
3493
|
+
* Where an announcement button leads. The host app decides how to follow it.
|
|
3494
|
+
*/
|
|
3495
|
+
var AnnouncementLinkType;
|
|
3496
|
+
(function (AnnouncementLinkType) {
|
|
3497
|
+
/** An https URL, opened in a new tab. */
|
|
3498
|
+
AnnouncementLinkType["EXTERNAL_URL"] = "EXTERNAL_URL";
|
|
3499
|
+
/** A route inside the host app, e.g. `/loads`. */
|
|
3500
|
+
AnnouncementLinkType["IN_APP_PATH"] = "IN_APP_PATH";
|
|
3501
|
+
})(AnnouncementLinkType || (AnnouncementLinkType = {}));
|
|
3502
|
+
|
|
3503
|
+
/**
|
|
3504
|
+
* Renders an announcement: optional label, title, optional image, HTML body and its buttons.
|
|
3505
|
+
*
|
|
3506
|
+
* It does no navigation or HTTP; the host reacts to the emitted events.
|
|
3507
|
+
* Inside a MatDialog it renders as the dialog content; with `preview` it renders inline (admin portal live preview).
|
|
3508
|
+
*/
|
|
3509
|
+
class AnnouncementModalComponent {
|
|
3510
|
+
constructor() {
|
|
3511
|
+
/**
|
|
3512
|
+
* Renders inline with its own shadow instead of relying on a dialog container.
|
|
3513
|
+
*/
|
|
3514
|
+
this.preview = false;
|
|
3515
|
+
/**
|
|
3516
|
+
* Emits the primary button's link.
|
|
3517
|
+
*/
|
|
3518
|
+
this.primaryClick = new EventEmitter();
|
|
3519
|
+
/**
|
|
3520
|
+
* Emits the secondary button's link (target is null when it only closes).
|
|
3521
|
+
*/
|
|
3522
|
+
this.secondaryClick = new EventEmitter();
|
|
3523
|
+
/**
|
|
3524
|
+
* Emits when the close button is clicked.
|
|
3525
|
+
*/
|
|
3526
|
+
this.close = new EventEmitter();
|
|
3527
|
+
/**
|
|
3528
|
+
* Emits the snooze duration in hours when "Remind me later" is clicked.
|
|
3529
|
+
*/
|
|
3530
|
+
this.remindLater = new EventEmitter();
|
|
3531
|
+
this.ButtonType = ButtonType;
|
|
3532
|
+
this.data = null;
|
|
3533
|
+
this.labelColor = LabelTypeEnum.primary;
|
|
3534
|
+
this.primaryEvent = null;
|
|
3535
|
+
this.secondaryEvent = null;
|
|
3536
|
+
}
|
|
3537
|
+
/**
|
|
3538
|
+
* The announcement to render.
|
|
3539
|
+
*/
|
|
3540
|
+
set announcement(value) {
|
|
3541
|
+
this.data = value;
|
|
3542
|
+
this.labelColor = value?.labelColor || LabelTypeEnum.primary;
|
|
3543
|
+
this.primaryEvent = this.toEvent(value?.primaryButton);
|
|
3544
|
+
this.secondaryEvent = this.toEvent(value?.secondaryButton);
|
|
3545
|
+
}
|
|
3546
|
+
toEvent(button) {
|
|
3547
|
+
if (!button?.label) {
|
|
3548
|
+
return null;
|
|
3549
|
+
}
|
|
3550
|
+
const target = button.target?.trim() || null;
|
|
3551
|
+
return { linkType: target ? button.linkType ?? null : null, target };
|
|
3552
|
+
}
|
|
3553
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AnnouncementModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3554
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: AnnouncementModalComponent, isStandalone: true, selector: "i-tech-announcement-modal", inputs: { preview: "preview", announcement: "announcement" }, outputs: { primaryClick: "primaryClick", secondaryClick: "secondaryClick", close: "close", remindLater: "remindLater" }, ngImport: i0, template: "@if (data) {\n <div class=\"i-tech-announcement\" [class.i-tech-announcement--preview]=\"preview\" [attr.data-testId]=\"'global-announcement-dialog'\">\n <div class=\"i-tech-announcement__content\">\n @if (data.label) {\n <div class=\"i-tech-announcement__label\" [attr.data-testId]=\"'global-announcement-label'\">\n <i-tech-label [text]=\"data.label\" [color]=\"labelColor\" [disableRipple]=\"true\"></i-tech-label>\n </div>\n }\n\n <h2 class=\"i-tech-announcement__title\" [attr.data-testId]=\"'global-announcement-title'\">{{ data.title }}</h2>\n\n @if (data.imageUrl) {\n <img class=\"i-tech-announcement__image\"\n [src]=\"data.imageUrl\"\n [alt]=\"data.imageAlt || ''\"\n [attr.data-testId]=\"'global-announcement-image'\">\n }\n\n @if (data.body) {\n <div class=\"i-tech-announcement__body\" [attr.data-testId]=\"'global-announcement-body'\" [innerHTML]=\"data.body\"></div>\n }\n </div>\n\n <div class=\"i-tech-announcement__actions\">\n @if (data.remindLaterHours) {\n <i-tech-button\n [testId]=\"'global-announcement-remind-me-later'\"\n [text]=\"'Remind me later'\"\n [type]=\"ButtonType.TONAL\"\n (buttonClick)=\"remindLater.emit(data.remindLaterHours)\">\n </i-tech-button>\n }\n @if (data.closeButton?.label) {\n <i-tech-button\n [testId]=\"'global-announcement-close'\"\n [text]=\"data.closeButton!.label\"\n [type]=\"ButtonType.TONAL\"\n (buttonClick)=\"close.emit()\">\n </i-tech-button>\n }\n @if (secondaryEvent) {\n <i-tech-button\n [testId]=\"'global-announcement-secondary'\"\n [text]=\"data.secondaryButton!.label\"\n [type]=\"ButtonType.TONAL\"\n (buttonClick)=\"secondaryClick.emit(secondaryEvent)\">\n </i-tech-button>\n }\n @if (primaryEvent) {\n <i-tech-button\n [testId]=\"'global-announcement-primary'\"\n [text]=\"data.primaryButton!.label\"\n [type]=\"ButtonType.FILLED\"\n (buttonClick)=\"primaryClick.emit(primaryEvent)\">\n </i-tech-button>\n }\n </div>\n </div>\n}\n", styles: [".i-tech-announcement{width:100%;max-width:488px;box-sizing:border-box;display:flex;flex-direction:column;background:#fff;border-radius:28px;overflow:hidden;font-family:inherit}.i-tech-announcement--preview{margin:0 auto;box-shadow:0 1px 2px #14181e0f,0 24px 60px #14181e24}.i-tech-announcement__content{display:flex;flex-direction:column;gap:12px;padding:24px 24px 0;min-width:0}.i-tech-announcement__label{display:flex}.i-tech-announcement__title{color:var(--neutral30);font-family:inherit;font-size:22px;font-weight:700;line-height:28px;margin:0;overflow-wrap:anywhere}.i-tech-announcement__image{display:block;width:100%;max-height:280px;object-fit:contain;border-radius:12px}.i-tech-announcement__body{color:var(--neutral30);font-family:inherit;font-size:13px;font-weight:500;line-height:20px;letter-spacing:.2px;overflow-wrap:anywhere}.i-tech-announcement__body p,.i-tech-announcement__body ul{margin:0 0 8px}.i-tech-announcement__body>:last-child{margin-bottom:0}.i-tech-announcement__body ul{padding-left:20px}.i-tech-announcement__body li+li{margin-top:4px}.i-tech-announcement__body b{font-weight:700}.i-tech-announcement__body a{color:var(--primary40);text-decoration:underline}.i-tech-announcement__body code{font-family:monospace;padding:0 3px;border-radius:3px;background:var(--neutral90)}.i-tech-announcement__body img{display:none}.i-tech-announcement__actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end;padding:24px}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "i-tech-button", inputs: ["text", "testId", "fontIcon", "svgIcon", "type", "customClass", "submit", "disabled", "activated", "color"], outputs: ["buttonClick"] }, { kind: "component", type: LabelComponent, selector: "i-tech-label", inputs: ["color", "text", "innerHtml", "bordered", "selected", "dashed", "tooltip", "size", "iconName", "iconSvg", "prefixIconName", "disableRipple", "matChipAction", "forTable", "iconConfig", "customChipClass", "customBgColor", "customTextColor", "clearable"], outputs: ["cleared"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
3555
|
+
}
|
|
3556
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AnnouncementModalComponent, decorators: [{
|
|
3557
|
+
type: Component,
|
|
3558
|
+
args: [{ selector: 'i-tech-announcement-modal', standalone: true, imports: [
|
|
3559
|
+
ButtonComponent,
|
|
3560
|
+
LabelComponent
|
|
3561
|
+
], encapsulation: ViewEncapsulation.None, template: "@if (data) {\n <div class=\"i-tech-announcement\" [class.i-tech-announcement--preview]=\"preview\" [attr.data-testId]=\"'global-announcement-dialog'\">\n <div class=\"i-tech-announcement__content\">\n @if (data.label) {\n <div class=\"i-tech-announcement__label\" [attr.data-testId]=\"'global-announcement-label'\">\n <i-tech-label [text]=\"data.label\" [color]=\"labelColor\" [disableRipple]=\"true\"></i-tech-label>\n </div>\n }\n\n <h2 class=\"i-tech-announcement__title\" [attr.data-testId]=\"'global-announcement-title'\">{{ data.title }}</h2>\n\n @if (data.imageUrl) {\n <img class=\"i-tech-announcement__image\"\n [src]=\"data.imageUrl\"\n [alt]=\"data.imageAlt || ''\"\n [attr.data-testId]=\"'global-announcement-image'\">\n }\n\n @if (data.body) {\n <div class=\"i-tech-announcement__body\" [attr.data-testId]=\"'global-announcement-body'\" [innerHTML]=\"data.body\"></div>\n }\n </div>\n\n <div class=\"i-tech-announcement__actions\">\n @if (data.remindLaterHours) {\n <i-tech-button\n [testId]=\"'global-announcement-remind-me-later'\"\n [text]=\"'Remind me later'\"\n [type]=\"ButtonType.TONAL\"\n (buttonClick)=\"remindLater.emit(data.remindLaterHours)\">\n </i-tech-button>\n }\n @if (data.closeButton?.label) {\n <i-tech-button\n [testId]=\"'global-announcement-close'\"\n [text]=\"data.closeButton!.label\"\n [type]=\"ButtonType.TONAL\"\n (buttonClick)=\"close.emit()\">\n </i-tech-button>\n }\n @if (secondaryEvent) {\n <i-tech-button\n [testId]=\"'global-announcement-secondary'\"\n [text]=\"data.secondaryButton!.label\"\n [type]=\"ButtonType.TONAL\"\n (buttonClick)=\"secondaryClick.emit(secondaryEvent)\">\n </i-tech-button>\n }\n @if (primaryEvent) {\n <i-tech-button\n [testId]=\"'global-announcement-primary'\"\n [text]=\"data.primaryButton!.label\"\n [type]=\"ButtonType.FILLED\"\n (buttonClick)=\"primaryClick.emit(primaryEvent)\">\n </i-tech-button>\n }\n </div>\n </div>\n}\n", styles: [".i-tech-announcement{width:100%;max-width:488px;box-sizing:border-box;display:flex;flex-direction:column;background:#fff;border-radius:28px;overflow:hidden;font-family:inherit}.i-tech-announcement--preview{margin:0 auto;box-shadow:0 1px 2px #14181e0f,0 24px 60px #14181e24}.i-tech-announcement__content{display:flex;flex-direction:column;gap:12px;padding:24px 24px 0;min-width:0}.i-tech-announcement__label{display:flex}.i-tech-announcement__title{color:var(--neutral30);font-family:inherit;font-size:22px;font-weight:700;line-height:28px;margin:0;overflow-wrap:anywhere}.i-tech-announcement__image{display:block;width:100%;max-height:280px;object-fit:contain;border-radius:12px}.i-tech-announcement__body{color:var(--neutral30);font-family:inherit;font-size:13px;font-weight:500;line-height:20px;letter-spacing:.2px;overflow-wrap:anywhere}.i-tech-announcement__body p,.i-tech-announcement__body ul{margin:0 0 8px}.i-tech-announcement__body>:last-child{margin-bottom:0}.i-tech-announcement__body ul{padding-left:20px}.i-tech-announcement__body li+li{margin-top:4px}.i-tech-announcement__body b{font-weight:700}.i-tech-announcement__body a{color:var(--primary40);text-decoration:underline}.i-tech-announcement__body code{font-family:monospace;padding:0 3px;border-radius:3px;background:var(--neutral90)}.i-tech-announcement__body img{display:none}.i-tech-announcement__actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end;padding:24px}\n"] }]
|
|
3562
|
+
}], propDecorators: { preview: [{
|
|
3563
|
+
type: Input
|
|
3564
|
+
}], primaryClick: [{
|
|
3565
|
+
type: Output
|
|
3566
|
+
}], secondaryClick: [{
|
|
3567
|
+
type: Output
|
|
3568
|
+
}], close: [{
|
|
3569
|
+
type: Output
|
|
3570
|
+
}], remindLater: [{
|
|
3571
|
+
type: Output
|
|
3572
|
+
}], announcement: [{
|
|
3573
|
+
type: Input
|
|
3574
|
+
}] } });
|
|
3575
|
+
|
|
3492
3576
|
/*
|
|
3493
3577
|
* Public API Surface of shared-components
|
|
3494
3578
|
*/
|
|
@@ -3497,5 +3581,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3497
3581
|
* Generated bundle index. Do not edit.
|
|
3498
3582
|
*/
|
|
3499
3583
|
|
|
3500
|
-
export { AgGridButtonCellComponent, AgGridFunctionsService, ArrayToStringPipe, AutocompleteSelectComponent, ButtonComponent, ButtonType, ClearValueComponent, CompaniesEnum, DATA_ENDPOINT, DatePickerComponent, DateRangeDatepickerComponent, DateRangeSelectionComponent, DateTimePickerComponent, DriverCategories, DriverCategoryEnum, DriverStatus, GenerateErrorMessagesPipe, GetValueByKeyFromObjectPipe, IconButtonComponent, InputMaskDirective, InputService, LabelComponent, LabelTypeEnum, MenuComponent, NewSidebarComponent, ParseDateService, PhoneNumberInputComponent, ProcessedStatusCellRendererComponent, RoleEnum, SegmentedButtonComponent, SelectWithSearchComponent, TextInputComponent, TimeInputComponent, TooltipCellRendererComponent, formatPhoneNumber, internationalPhoneValidator };
|
|
3584
|
+
export { AgGridButtonCellComponent, AgGridFunctionsService, AnnouncementLinkType, AnnouncementModalComponent, ArrayToStringPipe, AutocompleteSelectComponent, ButtonComponent, ButtonType, ClearValueComponent, CompaniesEnum, DATA_ENDPOINT, DatePickerComponent, DateRangeDatepickerComponent, DateRangeSelectionComponent, DateTimePickerComponent, DriverCategories, DriverCategoryEnum, DriverStatus, GenerateErrorMessagesPipe, GetValueByKeyFromObjectPipe, IconButtonComponent, InputMaskDirective, InputService, LabelComponent, LabelTypeEnum, MenuComponent, NewSidebarComponent, ParseDateService, PhoneNumberInputComponent, ProcessedStatusCellRendererComponent, RoleEnum, SegmentedButtonComponent, SelectWithSearchComponent, TextInputComponent, TimeInputComponent, TooltipCellRendererComponent, formatPhoneNumber, internationalPhoneValidator };
|
|
3501
3585
|
//# sourceMappingURL=i-tech-shared-components.mjs.map
|