@hmcts/opal-frontend-common 0.0.105 → 0.0.106

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.
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { EventEmitter, Output, HostBinding, Component, Input, inject, ElementRef, Renderer2, Directive } from '@angular/core';
3
+ import { CustomDeferredLiveRegionAnnouncement } from '@hmcts/opal-frontend-common/components/custom/custom-deferred-live-region-announcement';
3
4
 
4
5
  class MojAlertDismissComponent {
5
6
  hostClass = 'moj-alert__action';
@@ -39,16 +40,13 @@ class MojAlertComponent {
39
40
  get hostClass() {
40
41
  return this.isVisible ? `moj-alert moj-alert--${this.type}` : '';
41
42
  }
42
- get computedAriaLabel() {
43
+ dataModule = 'moj-alert';
44
+ get announcementMessage() {
43
45
  return `${this.type} : ${this.ariaLabel}`;
44
46
  }
45
- get computedRole() {
46
- if (!this.isVisible) {
47
- return null;
48
- }
47
+ get announcementRole() {
49
48
  return this.type === 'error' || this.type === 'warning' ? 'alert' : 'status';
50
49
  }
51
- dataModule = 'moj-alert';
52
50
  /**
53
51
  * Dismisses the alert component.
54
52
  *
@@ -61,11 +59,11 @@ class MojAlertComponent {
61
59
  this.dismissed.emit();
62
60
  }
63
61
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: MojAlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
64
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.21", type: MojAlertComponent, isStandalone: true, selector: "opal-lib-moj-alert, [opal-lib-moj-alert]", inputs: { ariaLabel: "ariaLabel", type: "type", showDismiss: "showDismiss" }, outputs: { dismissed: "dismissed" }, host: { properties: { "class": "this.hostClass", "attr.aria-label": "this.computedAriaLabel", "attr.role": "this.computedRole", "attr.data-module": "this.dataModule" } }, ngImport: i0, template: "@if (isVisible) {\n <ng-content select=\"[icon]\"></ng-content>\n <ng-content select=\"[content]\"></ng-content>\n\n @if (showDismiss) {\n <opal-lib-moj-alert-dismiss (dismiss)=\"dismiss()\"></opal-lib-moj-alert-dismiss>\n }\n}\n", dependencies: [{ kind: "component", type: MojAlertDismissComponent, selector: "opal-lib-moj-alert-dismiss", outputs: ["dismiss"] }] });
62
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.21", type: MojAlertComponent, isStandalone: true, selector: "opal-lib-moj-alert, [opal-lib-moj-alert]", inputs: { ariaLabel: "ariaLabel", type: "type", showDismiss: "showDismiss" }, outputs: { dismissed: "dismissed" }, host: { properties: { "class": "this.hostClass", "attr.data-module": "this.dataModule" } }, ngImport: i0, template: "@if (isVisible) {\n <opal-lib-custom-deferred-live-region-announcement\n [message]=\"announcementMessage\"\n [role]=\"announcementRole\"\n [announcementDelayMs]=\"200\"\n ></opal-lib-custom-deferred-live-region-announcement>\n <ng-content select=\"[icon]\"></ng-content>\n <ng-content select=\"[content]\"></ng-content>\n\n @if (showDismiss) {\n <opal-lib-moj-alert-dismiss (dismiss)=\"dismiss()\"></opal-lib-moj-alert-dismiss>\n }\n}\n", dependencies: [{ kind: "component", type: MojAlertDismissComponent, selector: "opal-lib-moj-alert-dismiss", outputs: ["dismiss"] }, { kind: "component", type: CustomDeferredLiveRegionAnnouncement, selector: "opal-lib-custom-deferred-live-region-announcement", inputs: ["message", "role", "announcementDelayMs"] }] });
65
63
  }
66
64
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: MojAlertComponent, decorators: [{
67
65
  type: Component,
68
- args: [{ selector: 'opal-lib-moj-alert, [opal-lib-moj-alert]', imports: [MojAlertDismissComponent], template: "@if (isVisible) {\n <ng-content select=\"[icon]\"></ng-content>\n <ng-content select=\"[content]\"></ng-content>\n\n @if (showDismiss) {\n <opal-lib-moj-alert-dismiss (dismiss)=\"dismiss()\"></opal-lib-moj-alert-dismiss>\n }\n}\n" }]
66
+ args: [{ selector: 'opal-lib-moj-alert, [opal-lib-moj-alert]', imports: [MojAlertDismissComponent, CustomDeferredLiveRegionAnnouncement], template: "@if (isVisible) {\n <opal-lib-custom-deferred-live-region-announcement\n [message]=\"announcementMessage\"\n [role]=\"announcementRole\"\n [announcementDelayMs]=\"200\"\n ></opal-lib-custom-deferred-live-region-announcement>\n <ng-content select=\"[icon]\"></ng-content>\n <ng-content select=\"[content]\"></ng-content>\n\n @if (showDismiss) {\n <opal-lib-moj-alert-dismiss (dismiss)=\"dismiss()\"></opal-lib-moj-alert-dismiss>\n }\n}\n" }]
69
67
  }], propDecorators: { ariaLabel: [{
70
68
  type: Input,
71
69
  args: [{ required: true }]
@@ -80,12 +78,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.21", ngImpo
80
78
  }], hostClass: [{
81
79
  type: HostBinding,
82
80
  args: ['class']
83
- }], computedAriaLabel: [{
84
- type: HostBinding,
85
- args: ['attr.aria-label']
86
- }], computedRole: [{
87
- type: HostBinding,
88
- args: ['attr.role']
89
81
  }], dataModule: [{
90
82
  type: HostBinding,
91
83
  args: ['attr.data-module']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmcts/opal-frontend-common",
3
- "version": "0.0.105",
3
+ "version": "0.0.106",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,9 +10,9 @@ declare class MojAlertComponent {
10
10
  dismissed: EventEmitter<void>;
11
11
  isVisible: boolean;
12
12
  get hostClass(): string;
13
- get computedAriaLabel(): string;
14
- get computedRole(): 'alert' | 'status' | null;
15
13
  dataModule: string;
14
+ get announcementMessage(): string;
15
+ get announcementRole(): 'alert' | 'status';
16
16
  /**
17
17
  * Dismisses the alert component.
18
18
  *