@skyux/modals 6.13.0 → 6.16.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.
Files changed (44) hide show
  1. package/documentation.json +340 -529
  2. package/esm2020/lib/modules/confirm/confirm-config-token.mjs +6 -0
  3. package/esm2020/lib/modules/confirm/confirm.component.mjs +103 -97
  4. package/esm2020/lib/modules/confirm/confirm.service.mjs +9 -5
  5. package/esm2020/lib/modules/modal/modal-adapter.service.mjs +20 -15
  6. package/esm2020/lib/modules/modal/modal-close-args.mjs +1 -1
  7. package/esm2020/lib/modules/modal/modal-component-adapter.service.mjs +17 -13
  8. package/esm2020/lib/modules/modal/modal-host-context-args.mjs +2 -0
  9. package/esm2020/lib/modules/modal/modal-host-context.mjs +9 -6
  10. package/esm2020/lib/modules/modal/modal-host.component.mjs +41 -14
  11. package/esm2020/lib/modules/modal/modal-host.service.mjs +21 -15
  12. package/esm2020/lib/modules/modal/modal-instance.mjs +31 -29
  13. package/esm2020/lib/modules/modal/modal-scroll-shadow.directive.mjs +71 -65
  14. package/esm2020/lib/modules/modal/modal.component.mjs +59 -74
  15. package/esm2020/lib/modules/modal/modal.service.mjs +50 -42
  16. package/esm2020/testing/modal-fixture.mjs +60 -84
  17. package/fesm2015/skyux-modals-testing.mjs +60 -83
  18. package/fesm2015/skyux-modals-testing.mjs.map +1 -1
  19. package/fesm2015/skyux-modals.mjs +412 -368
  20. package/fesm2015/skyux-modals.mjs.map +1 -1
  21. package/fesm2020/skyux-modals-testing.mjs +60 -83
  22. package/fesm2020/skyux-modals-testing.mjs.map +1 -1
  23. package/fesm2020/skyux-modals.mjs +409 -368
  24. package/fesm2020/skyux-modals.mjs.map +1 -1
  25. package/lib/modules/confirm/confirm-config-token.d.ts +6 -0
  26. package/lib/modules/confirm/confirm.component.d.ts +6 -12
  27. package/lib/modules/confirm/confirm.service.d.ts +1 -1
  28. package/lib/modules/modal/modal-adapter.service.d.ts +1 -5
  29. package/lib/modules/modal/modal-close-args.d.ts +1 -1
  30. package/lib/modules/modal/modal-component-adapter.service.d.ts +1 -2
  31. package/lib/modules/modal/modal-host-context-args.d.ts +7 -0
  32. package/lib/modules/modal/modal-host-context.d.ts +3 -2
  33. package/lib/modules/modal/modal-host.component.d.ts +1 -6
  34. package/lib/modules/modal/modal-host.service.d.ts +2 -2
  35. package/lib/modules/modal/modal-instance.d.ts +1 -5
  36. package/lib/modules/modal/modal-scroll-shadow.directive.d.ts +1 -13
  37. package/lib/modules/modal/modal.component.d.ts +12 -23
  38. package/lib/modules/modal/modal.service.d.ts +1 -3
  39. package/package.json +5 -6
  40. package/testing/modal-fixture.d.ts +6 -8
  41. package/esm2020/lib/modules/confirm/confirm-modal-context.mjs +0 -6
  42. package/esm2020/lib/modules/modal/modal-state-animation.mjs +0 -8
  43. package/lib/modules/confirm/confirm-modal-context.d.ts +0 -13
  44. package/lib/modules/modal/modal-state-animation.d.ts +0 -1
@@ -1,99 +1,90 @@
1
+ import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
2
+
3
+ var _SkyModalFixture_instances, _SkyModalFixture_modalElement, _SkyModalFixture_fixture, _SkyModalFixture_checkModalElement, _SkyModalFixture_getModalDiaglogElement;
1
4
  /**
2
5
  * Allows interaction with a SKY UX modal component.
3
6
  */
4
7
  class SkyModalFixture {
5
8
  constructor(fixture, skyTestId) {
6
- this.fixture = fixture;
7
- this.modalElement = document.querySelector('sky-modal[data-sky-id="' + skyTestId + '"]');
8
- if (!this.modalElement) {
9
+ _SkyModalFixture_instances.add(this);
10
+ _SkyModalFixture_modalElement.set(this, void 0);
11
+ _SkyModalFixture_fixture.set(this, void 0);
12
+ __classPrivateFieldSet(this, _SkyModalFixture_fixture, fixture, "f");
13
+ const modalElement = document.querySelector('sky-modal[data-sky-id="' + skyTestId + '"]');
14
+ if (!modalElement) {
9
15
  throw new Error(`No element was found with a \`data-sky-id\` value of "${skyTestId}".`);
10
16
  }
17
+ __classPrivateFieldSet(this, _SkyModalFixture_modalElement, modalElement, "f");
11
18
  }
12
19
  /**
13
20
  * The modal component's ARIA describedby attribute.
14
21
  */
15
22
  get ariaDescribedBy() {
16
- const modalDialogElement = this.getModalDiaglogElement();
17
- if (modalDialogElement) {
18
- return modalDialogElement.getAttribute('aria-describedby') || undefined;
19
- }
20
- else {
21
- throw new Error(`No modal exists.`);
22
- }
23
+ const modalDialogElement = __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_getModalDiaglogElement).call(this);
24
+ /* Non-null assertion as our component has a default for if the user does not provide this attribute or if they provide "undefined" */
25
+ const describedByAttribute =
26
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
27
+ modalDialogElement.getAttribute('aria-describedby');
28
+ return describedByAttribute;
23
29
  }
24
30
  /**
25
31
  * The modal component's ARIA labelledby attribute.
26
32
  */
27
33
  get ariaLabelledBy() {
28
- const modalDialogElement = this.getModalDiaglogElement();
29
- if (modalDialogElement) {
30
- return modalDialogElement.getAttribute('aria-labelledby') || undefined;
31
- }
32
- else {
33
- throw new Error(`No modal exists.`);
34
- }
34
+ const modalDialogElement = __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_getModalDiaglogElement).call(this);
35
+ /* Non-null assertion as our component has a default for if the user does not provide this attribute or if they provide "undefined" */
36
+ const labelledByAttribute =
37
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
38
+ modalDialogElement.getAttribute('aria-labelledby');
39
+ return labelledByAttribute;
35
40
  }
36
41
  /**
37
42
  * The modal component's role attribute.
38
43
  */
39
44
  get ariaRole() {
40
- const modalDialogElement = this.getModalDiaglogElement();
41
- if (modalDialogElement) {
42
- return modalDialogElement.getAttribute('role') || undefined;
43
- }
44
- else {
45
- throw new Error(`No modal exists.`);
46
- }
45
+ const modalDialogElement = __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_getModalDiaglogElement).call(this);
46
+ /* Non-null assertion as our component has a default for if the user does not provide this attribute or if they provide "undefined" */
47
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
48
+ const roleAttribute = modalDialogElement.getAttribute('role');
49
+ return roleAttribute;
47
50
  }
48
51
  /**
49
52
  * Whether or not the modal is a full page modal.
50
53
  */
51
54
  get fullPage() {
52
55
  const modalDivElement = this.getModalDiv();
53
- if (modalDivElement) {
54
- return modalDivElement.classList.contains('sky-modal-full-page');
55
- }
56
- else {
57
- throw new Error(`No modal exists.`);
58
- }
56
+ return modalDivElement.classList.contains('sky-modal-full-page');
59
57
  }
60
58
  /**
61
59
  * The size of the modal.
62
60
  */
63
61
  get size() {
64
62
  const modalDivElement = this.getModalDiv();
65
- if (modalDivElement) {
66
- const possibleSizes = ['small', 'medium', 'large'];
67
- for (let size of possibleSizes) {
68
- if (modalDivElement.classList.contains('sky-modal-' + size)) {
69
- return size;
70
- }
63
+ const possibleSizes = ['small', 'medium', 'large'];
64
+ for (const size of possibleSizes) {
65
+ if (modalDivElement.classList.contains('sky-modal-' + size)) {
66
+ return size;
71
67
  }
72
68
  }
73
- else {
74
- throw new Error(`No modal exists.`);
75
- }
69
+ return;
76
70
  }
77
71
  /**
78
72
  * Whether or not the modal is set up for tiled content.
79
73
  */
80
74
  get tiledBody() {
81
75
  const modalDivElement = this.getModalDiv();
82
- if (modalDivElement) {
83
- return modalDivElement.classList.contains('sky-modal-tiled');
84
- }
85
- else {
86
- throw new Error(`No modal exists.`);
87
- }
76
+ return modalDivElement.classList.contains('sky-modal-tiled');
88
77
  }
89
78
  /**
90
79
  * Clicks the modal header's "close" button.
91
80
  */
92
81
  clickHeaderCloseButton() {
93
- const closeButton = this.modalElement.querySelector('.sky-modal .sky-modal-btn-close');
94
- if (closeButton) {
82
+ __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_checkModalElement).call(this);
83
+ const closeButton = __classPrivateFieldGet(this, _SkyModalFixture_modalElement, "f").querySelector('.sky-modal .sky-modal-btn-close');
84
+ if (closeButton &&
85
+ window.getComputedStyle(closeButton).display !== 'none') {
95
86
  closeButton.click();
96
- this.fixture.detectChanges();
87
+ __classPrivateFieldGet(this, _SkyModalFixture_fixture, "f").detectChanges();
97
88
  }
98
89
  else {
99
90
  throw new Error(`No header close button exists.`);
@@ -103,10 +94,11 @@ class SkyModalFixture {
103
94
  * Clicks the modal header's "help" button.
104
95
  */
105
96
  clickHelpButton() {
106
- const helpButton = this.modalElement.querySelector('.sky-modal .sky-modal-header-buttons button[name="help-button"]');
107
- if (helpButton) {
97
+ __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_checkModalElement).call(this);
98
+ const helpButton = __classPrivateFieldGet(this, _SkyModalFixture_modalElement, "f").querySelector('.sky-modal .sky-modal-header-buttons button[name="help-button"]');
99
+ if (helpButton && window.getComputedStyle(helpButton).display !== 'none') {
108
100
  helpButton.click();
109
- this.fixture.detectChanges();
101
+ __classPrivateFieldGet(this, _SkyModalFixture_fixture, "f").detectChanges();
110
102
  }
111
103
  else {
112
104
  throw new Error(`No help button exists.`);
@@ -116,55 +108,40 @@ class SkyModalFixture {
116
108
  * Returns the main modal element.
117
109
  */
118
110
  getModalDiv() {
119
- if (this.modalElement) {
120
- return this.modalElement.querySelector('.sky-modal');
121
- }
122
- else {
123
- throw new Error(`No modal exists.`);
124
- }
111
+ __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_checkModalElement).call(this);
112
+ return __classPrivateFieldGet(this, _SkyModalFixture_modalElement, "f").querySelector('.sky-modal');
125
113
  }
126
114
  /**
127
115
  * Returns the modal's content element.
128
116
  */
129
117
  getModalContentEl() {
130
- if (this.modalElement) {
131
- return this.modalElement.querySelector('.sky-modal-content');
132
- }
133
- else {
134
- throw new Error(`No modal exists.`);
135
- }
118
+ __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_checkModalElement).call(this);
119
+ return __classPrivateFieldGet(this, _SkyModalFixture_modalElement, "f").querySelector('.sky-modal-content');
136
120
  }
137
121
  /**
138
122
  * Returns the modal's footer element.
139
123
  */
140
124
  getModalFooterEl() {
141
- if (this.modalElement) {
142
- return this.modalElement.querySelector('.sky-modal-footer');
143
- }
144
- else {
145
- throw new Error(`No modal exists.`);
146
- }
125
+ __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_checkModalElement).call(this);
126
+ return __classPrivateFieldGet(this, _SkyModalFixture_modalElement, "f").querySelector('.sky-modal-footer');
147
127
  }
148
128
  /**
149
129
  * Returns the modal's header element.
150
130
  */
151
131
  getModalHeaderEl() {
152
- if (this.modalElement) {
153
- return this.modalElement.querySelector('.sky-modal-header');
154
- }
155
- else {
156
- throw new Error(`No modal exists.`);
157
- }
158
- }
159
- getModalDiaglogElement() {
160
- if (this.modalElement) {
161
- return this.modalElement.querySelector('.sky-modal-dialog');
162
- }
163
- else {
164
- throw new Error(`No modal exists.`);
165
- }
132
+ __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_checkModalElement).call(this);
133
+ return __classPrivateFieldGet(this, _SkyModalFixture_modalElement, "f").querySelector('.sky-modal-header');
166
134
  }
167
135
  }
136
+ _SkyModalFixture_modalElement = new WeakMap(), _SkyModalFixture_fixture = new WeakMap(), _SkyModalFixture_instances = new WeakSet(), _SkyModalFixture_checkModalElement = function _SkyModalFixture_checkModalElement() {
137
+ if (!document.contains(__classPrivateFieldGet(this, _SkyModalFixture_modalElement, "f"))) {
138
+ throw new Error('Modal element no longer exists. Was the modal closed?');
139
+ }
140
+ }, _SkyModalFixture_getModalDiaglogElement = function _SkyModalFixture_getModalDiaglogElement() {
141
+ __classPrivateFieldGet(this, _SkyModalFixture_instances, "m", _SkyModalFixture_checkModalElement).call(this);
142
+ // We can always know that the dialog element will exist if the modal is open and exists.
143
+ return __classPrivateFieldGet(this, _SkyModalFixture_modalElement, "f").querySelector('.sky-modal-dialog');
144
+ };
168
145
 
169
146
  /**
170
147
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"skyux-modals-testing.mjs","sources":["../../../../../libs/components/modals/testing/src/modal-fixture.ts","../../../../../libs/components/modals/testing/src/skyux-modals-testing.ts"],"sourcesContent":["import { ComponentFixture } from '@angular/core/testing';\n\n/**\n * Allows interaction with a SKY UX modal component.\n */\nexport class SkyModalFixture {\n private modalElement: HTMLElement;\n\n constructor(private fixture: ComponentFixture<any>, skyTestId: string) {\n this.modalElement = document.querySelector(\n 'sky-modal[data-sky-id=\"' + skyTestId + '\"]'\n );\n\n if (!this.modalElement) {\n throw new Error(\n `No element was found with a \\`data-sky-id\\` value of \"${skyTestId}\".`\n );\n }\n }\n\n /**\n * The modal component's ARIA describedby attribute.\n */\n public get ariaDescribedBy(): string {\n const modalDialogElement = this.getModalDiaglogElement();\n if (modalDialogElement) {\n return modalDialogElement.getAttribute('aria-describedby') || undefined;\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * The modal component's ARIA labelledby attribute.\n */\n public get ariaLabelledBy(): string {\n const modalDialogElement = this.getModalDiaglogElement();\n if (modalDialogElement) {\n return modalDialogElement.getAttribute('aria-labelledby') || undefined;\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * The modal component's role attribute.\n */\n public get ariaRole(): string {\n const modalDialogElement = this.getModalDiaglogElement();\n if (modalDialogElement) {\n return modalDialogElement.getAttribute('role') || undefined;\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * Whether or not the modal is a full page modal.\n */\n public get fullPage(): boolean {\n const modalDivElement = this.getModalDiv();\n if (modalDivElement) {\n return modalDivElement.classList.contains('sky-modal-full-page');\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * The size of the modal.\n */\n public get size(): string {\n const modalDivElement = this.getModalDiv();\n\n if (modalDivElement) {\n const possibleSizes = ['small', 'medium', 'large'];\n\n for (let size of possibleSizes) {\n if (modalDivElement.classList.contains('sky-modal-' + size)) {\n return size;\n }\n }\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * Whether or not the modal is set up for tiled content.\n */\n public get tiledBody(): boolean {\n const modalDivElement = this.getModalDiv();\n if (modalDivElement) {\n return modalDivElement.classList.contains('sky-modal-tiled');\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * Clicks the modal header's \"close\" button.\n */\n public clickHeaderCloseButton(): void {\n const closeButton: HTMLElement = this.modalElement.querySelector(\n '.sky-modal .sky-modal-btn-close'\n );\n\n if (closeButton) {\n closeButton.click();\n this.fixture.detectChanges();\n } else {\n throw new Error(`No header close button exists.`);\n }\n }\n\n /**\n * Clicks the modal header's \"help\" button.\n */\n public clickHelpButton(): void {\n const helpButton: HTMLElement = this.modalElement.querySelector(\n '.sky-modal .sky-modal-header-buttons button[name=\"help-button\"]'\n );\n\n if (helpButton) {\n helpButton.click();\n this.fixture.detectChanges();\n } else {\n throw new Error(`No help button exists.`);\n }\n }\n\n /**\n * Returns the main modal element.\n */\n public getModalDiv(): any {\n if (this.modalElement) {\n return this.modalElement.querySelector('.sky-modal');\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * Returns the modal's content element.\n */\n public getModalContentEl(): any {\n if (this.modalElement) {\n return this.modalElement.querySelector('.sky-modal-content');\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * Returns the modal's footer element.\n */\n public getModalFooterEl(): any {\n if (this.modalElement) {\n return this.modalElement.querySelector('.sky-modal-footer');\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n /**\n * Returns the modal's header element.\n */\n public getModalHeaderEl(): any {\n if (this.modalElement) {\n return this.modalElement.querySelector('.sky-modal-header');\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n\n private getModalDiaglogElement(): HTMLElement {\n if (this.modalElement) {\n return this.modalElement.querySelector('.sky-modal-dialog');\n } else {\n throw new Error(`No modal exists.`);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAEA;;AAEG;MACU,eAAe,CAAA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,CAAC,mBAAmB,CAAC,CAAC;AAC7D,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,gBAAA,CAAkB,CAAC,CAAC;AACrC,SAAA;KACF;AAED;;AAEG;IACI,gBAAgB,GAAA;QACrB,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;AAC7D,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,gBAAA,CAAkB,CAAC,CAAC;AACrC,SAAA;KACF;IAEO,sBAAsB,GAAA;QAC5B,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;AAC7D,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,gBAAA,CAAkB,CAAC,CAAC;AACrC,SAAA;KACF;AACF;;ACtLD;;AAEG;;;;"}
1
+ {"version":3,"file":"skyux-modals-testing.mjs","sources":["../../../../../libs/components/modals/testing/src/modal-fixture.ts","../../../../../libs/components/modals/testing/src/skyux-modals-testing.ts"],"sourcesContent":["import { ComponentFixture } from '@angular/core/testing';\n\n/**\n * Allows interaction with a SKY UX modal component.\n */\nexport class SkyModalFixture {\n #modalElement: HTMLElement;\n\n #fixture: ComponentFixture<unknown>;\n\n constructor(fixture: ComponentFixture<unknown>, skyTestId: string) {\n this.#fixture = fixture;\n const modalElement = document.querySelector(\n 'sky-modal[data-sky-id=\"' + skyTestId + '\"]'\n ) as HTMLElement;\n\n if (!modalElement) {\n throw new Error(\n `No element was found with a \\`data-sky-id\\` value of \"${skyTestId}\".`\n );\n }\n\n this.#modalElement = modalElement;\n }\n\n /**\n * The modal component's ARIA describedby attribute.\n */\n public get ariaDescribedBy(): string | undefined {\n const modalDialogElement = this.#getModalDiaglogElement();\n /* Non-null assertion as our component has a default for if the user does not provide this attribute or if they provide \"undefined\" */\n const describedByAttribute =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n modalDialogElement.getAttribute('aria-describedby')!;\n return describedByAttribute;\n }\n\n /**\n * The modal component's ARIA labelledby attribute.\n */\n public get ariaLabelledBy(): string | undefined {\n const modalDialogElement = this.#getModalDiaglogElement();\n /* Non-null assertion as our component has a default for if the user does not provide this attribute or if they provide \"undefined\" */\n const labelledByAttribute =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n modalDialogElement.getAttribute('aria-labelledby')!;\n\n return labelledByAttribute;\n }\n\n /**\n * The modal component's role attribute.\n */\n public get ariaRole(): string | undefined {\n const modalDialogElement = this.#getModalDiaglogElement();\n /* Non-null assertion as our component has a default for if the user does not provide this attribute or if they provide \"undefined\" */\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const roleAttribute = modalDialogElement.getAttribute('role')!;\n return roleAttribute;\n }\n\n /**\n * Whether or not the modal is a full page modal.\n */\n public get fullPage(): boolean {\n const modalDivElement = this.getModalDiv();\n return modalDivElement.classList.contains('sky-modal-full-page');\n }\n\n /**\n * The size of the modal.\n */\n public get size(): string | undefined {\n const modalDivElement = this.getModalDiv();\n const possibleSizes = ['small', 'medium', 'large'];\n\n for (const size of possibleSizes) {\n if (modalDivElement.classList.contains('sky-modal-' + size)) {\n return size;\n }\n }\n\n return;\n }\n\n /**\n * Whether or not the modal is set up for tiled content.\n */\n public get tiledBody(): boolean {\n const modalDivElement = this.getModalDiv();\n return modalDivElement.classList.contains('sky-modal-tiled');\n }\n\n /**\n * Clicks the modal header's \"close\" button.\n */\n public clickHeaderCloseButton(): void {\n this.#checkModalElement();\n const closeButton: HTMLElement | null = this.#modalElement.querySelector(\n '.sky-modal .sky-modal-btn-close'\n );\n\n if (\n closeButton &&\n window.getComputedStyle(closeButton).display !== 'none'\n ) {\n closeButton.click();\n this.#fixture.detectChanges();\n } else {\n throw new Error(`No header close button exists.`);\n }\n }\n\n /**\n * Clicks the modal header's \"help\" button.\n */\n public clickHelpButton(): void {\n this.#checkModalElement();\n const helpButton: HTMLElement | null = this.#modalElement.querySelector(\n '.sky-modal .sky-modal-header-buttons button[name=\"help-button\"]'\n );\n\n if (helpButton && window.getComputedStyle(helpButton).display !== 'none') {\n helpButton.click();\n this.#fixture.detectChanges();\n } else {\n throw new Error(`No help button exists.`);\n }\n }\n\n /**\n * Returns the main modal element.\n */\n public getModalDiv(): any {\n this.#checkModalElement();\n return this.#modalElement.querySelector('.sky-modal');\n }\n\n /**\n * Returns the modal's content element.\n */\n public getModalContentEl(): any {\n this.#checkModalElement();\n return this.#modalElement.querySelector('.sky-modal-content');\n }\n\n /**\n * Returns the modal's footer element.\n */\n public getModalFooterEl(): any {\n this.#checkModalElement();\n return this.#modalElement.querySelector('.sky-modal-footer');\n }\n\n /**\n * Returns the modal's header element.\n */\n public getModalHeaderEl(): any {\n this.#checkModalElement();\n return this.#modalElement.querySelector('.sky-modal-header');\n }\n\n #checkModalElement(): void {\n if (!document.contains(this.#modalElement)) {\n throw new Error('Modal element no longer exists. Was the modal closed?');\n }\n }\n\n #getModalDiaglogElement(): HTMLElement {\n this.#checkModalElement();\n // We can always know that the dialog element will exist if the modal is open and exists.\n return this.#modalElement.querySelector('.sky-modal-dialog')!;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;AAEG;MACU,eAAe,CAAA;IAK1B,WAAY,CAAA,OAAkC,EAAE,SAAiB,EAAA;;QAJjE,6BAA2B,CAAA,GAAA,CAAA,IAAA,EAAA,KAAA,CAAA,CAAA,CAAA;QAE3B,wBAAoC,CAAA,GAAA,CAAA,IAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGlC,QAAA,sBAAA,CAAA,IAAI,EAAA,wBAAA,EAAY,OAAO,EAAA,GAAA,CAAA,CAAC;AACxB,QAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CACzC,yBAAyB,GAAG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