@skyux/indicators 5.7.2 → 6.0.0-beta.2

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 (171) hide show
  1. package/documentation.json +2 -2
  2. package/esm2020/index.mjs +38 -0
  3. package/esm2020/lib/modules/alert/alert.component.mjs +56 -0
  4. package/esm2020/lib/modules/alert/alert.module.mjs +38 -0
  5. package/esm2020/lib/modules/chevron/chevron.component.mjs +62 -0
  6. package/esm2020/lib/modules/chevron/chevron.module.mjs +38 -0
  7. package/esm2020/lib/modules/expansion-indicator/expansion-indicator.component.mjs +31 -0
  8. package/esm2020/lib/modules/expansion-indicator/expansion-indicator.module.mjs +19 -0
  9. package/esm2020/lib/modules/help-inline/help-inline.component.mjs +26 -0
  10. package/esm2020/lib/modules/help-inline/help-inline.module.mjs +38 -0
  11. package/esm2020/lib/modules/icon/icon-class-list.pipe.mjs +38 -0
  12. package/esm2020/lib/modules/icon/icon-resolver.service.mjs +42 -0
  13. package/esm2020/lib/modules/icon/icon-stack-item.mjs +2 -0
  14. package/esm2020/lib/modules/icon/icon-stack.component.mjs +19 -0
  15. package/esm2020/lib/modules/icon/icon.component.mjs +32 -0
  16. package/esm2020/lib/modules/icon/icon.module.mjs +21 -0
  17. package/esm2020/lib/modules/icon/types/icon-type.mjs +2 -0
  18. package/esm2020/lib/modules/icon/types/icon-variant-type.mjs +2 -0
  19. package/esm2020/lib/modules/key-info/key-info-label.component.mjs +18 -0
  20. package/esm2020/lib/modules/key-info/key-info-value.component.mjs +18 -0
  21. package/esm2020/lib/modules/key-info/key-info.component.mjs +22 -0
  22. package/esm2020/lib/modules/key-info/key-info.module.mjs +32 -0
  23. package/esm2020/lib/modules/label/label-type.mjs +2 -0
  24. package/esm2020/lib/modules/label/label.component.mjs +34 -0
  25. package/esm2020/lib/modules/label/label.module.mjs +19 -0
  26. package/esm2020/lib/modules/shared/indicator-description-type.mjs +2 -0
  27. package/esm2020/lib/modules/shared/indicator-icon-type.mjs +2 -0
  28. package/esm2020/lib/modules/shared/indicator-icon-utility.mjs +41 -0
  29. package/esm2020/lib/modules/shared/indicator-icon.mjs +2 -0
  30. package/esm2020/lib/modules/shared/sky-indicators-resources.module.mjs +61 -0
  31. package/esm2020/lib/modules/status-indicator/status-indicator.component.mjs +94 -0
  32. package/esm2020/lib/modules/status-indicator/status-indicator.module.mjs +34 -0
  33. package/esm2020/lib/modules/text-highlight/text-highlight.directive.mjs +153 -0
  34. package/esm2020/lib/modules/text-highlight/text-highlight.module.mjs +18 -0
  35. package/esm2020/lib/modules/tokens/token.component.mjs +107 -0
  36. package/esm2020/lib/modules/tokens/tokens.component.mjs +298 -0
  37. package/esm2020/lib/modules/tokens/tokens.module.mjs +35 -0
  38. package/esm2020/lib/modules/tokens/types/token-selected-event-args.mjs +2 -0
  39. package/esm2020/lib/modules/tokens/types/token.mjs +2 -0
  40. package/esm2020/lib/modules/tokens/types/tokens-message-type.mjs +24 -0
  41. package/esm2020/lib/modules/tokens/types/tokens-message.mjs +2 -0
  42. package/esm2020/lib/modules/wait/wait-adapter.service.mjs +201 -0
  43. package/esm2020/lib/modules/wait/wait-page-adapter.service.mjs +25 -0
  44. package/esm2020/lib/modules/wait/wait-page.component.mjs +19 -0
  45. package/esm2020/lib/modules/wait/wait.component.mjs +89 -0
  46. package/esm2020/lib/modules/wait/wait.module.mjs +21 -0
  47. package/esm2020/lib/modules/wait/wait.service.mjs +164 -0
  48. package/esm2020/skyux-indicators.mjs +5 -0
  49. package/esm2020/testing/alert-fixture.mjs +67 -0
  50. package/esm2020/testing/label-fixture.mjs +40 -0
  51. package/esm2020/testing/public-api.mjs +4 -0
  52. package/esm2020/testing/skyux-indicators-testing.mjs +5 -0
  53. package/esm2020/testing/wait-fixture.mjs +24 -0
  54. package/fesm2015/{skyux-indicators-testing.js → skyux-indicators-testing.mjs} +1 -1
  55. package/fesm2015/skyux-indicators-testing.mjs.map +1 -0
  56. package/fesm2015/skyux-indicators.mjs +1830 -0
  57. package/fesm2015/skyux-indicators.mjs.map +1 -0
  58. package/fesm2020/skyux-indicators-testing.mjs +135 -0
  59. package/fesm2020/skyux-indicators-testing.mjs.map +1 -0
  60. package/{fesm2015/skyux-indicators.js → fesm2020/skyux-indicators.mjs} +126 -185
  61. package/fesm2020/skyux-indicators.mjs.map +1 -0
  62. package/package.json +39 -15
  63. package/testing/package.json +5 -5
  64. package/bundles/skyux-indicators-testing.umd.js +0 -187
  65. package/bundles/skyux-indicators.umd.js +0 -2463
  66. package/esm2015/index.js +0 -38
  67. package/esm2015/index.js.map +0 -1
  68. package/esm2015/lib/modules/alert/alert.component.js +0 -60
  69. package/esm2015/lib/modules/alert/alert.component.js.map +0 -1
  70. package/esm2015/lib/modules/alert/alert.module.js +0 -38
  71. package/esm2015/lib/modules/alert/alert.module.js.map +0 -1
  72. package/esm2015/lib/modules/chevron/chevron.component.js +0 -66
  73. package/esm2015/lib/modules/chevron/chevron.component.js.map +0 -1
  74. package/esm2015/lib/modules/chevron/chevron.module.js +0 -38
  75. package/esm2015/lib/modules/chevron/chevron.module.js.map +0 -1
  76. package/esm2015/lib/modules/expansion-indicator/expansion-indicator.component.js +0 -35
  77. package/esm2015/lib/modules/expansion-indicator/expansion-indicator.component.js.map +0 -1
  78. package/esm2015/lib/modules/expansion-indicator/expansion-indicator.module.js +0 -19
  79. package/esm2015/lib/modules/expansion-indicator/expansion-indicator.module.js.map +0 -1
  80. package/esm2015/lib/modules/help-inline/help-inline.component.js +0 -30
  81. package/esm2015/lib/modules/help-inline/help-inline.component.js.map +0 -1
  82. package/esm2015/lib/modules/help-inline/help-inline.module.js +0 -38
  83. package/esm2015/lib/modules/help-inline/help-inline.module.js.map +0 -1
  84. package/esm2015/lib/modules/icon/icon-class-list.pipe.js +0 -38
  85. package/esm2015/lib/modules/icon/icon-class-list.pipe.js.map +0 -1
  86. package/esm2015/lib/modules/icon/icon-resolver.service.js +0 -42
  87. package/esm2015/lib/modules/icon/icon-resolver.service.js.map +0 -1
  88. package/esm2015/lib/modules/icon/icon-stack-item.js +0 -2
  89. package/esm2015/lib/modules/icon/icon-stack-item.js.map +0 -1
  90. package/esm2015/lib/modules/icon/icon-stack.component.js +0 -23
  91. package/esm2015/lib/modules/icon/icon-stack.component.js.map +0 -1
  92. package/esm2015/lib/modules/icon/icon.component.js +0 -37
  93. package/esm2015/lib/modules/icon/icon.component.js.map +0 -1
  94. package/esm2015/lib/modules/icon/icon.module.js +0 -21
  95. package/esm2015/lib/modules/icon/icon.module.js.map +0 -1
  96. package/esm2015/lib/modules/icon/types/icon-type.js +0 -2
  97. package/esm2015/lib/modules/icon/types/icon-type.js.map +0 -1
  98. package/esm2015/lib/modules/icon/types/icon-variant-type.js +0 -2
  99. package/esm2015/lib/modules/icon/types/icon-variant-type.js.map +0 -1
  100. package/esm2015/lib/modules/key-info/key-info-label.component.js +0 -18
  101. package/esm2015/lib/modules/key-info/key-info-label.component.js.map +0 -1
  102. package/esm2015/lib/modules/key-info/key-info-value.component.js +0 -18
  103. package/esm2015/lib/modules/key-info/key-info-value.component.js.map +0 -1
  104. package/esm2015/lib/modules/key-info/key-info.component.js +0 -26
  105. package/esm2015/lib/modules/key-info/key-info.component.js.map +0 -1
  106. package/esm2015/lib/modules/key-info/key-info.module.js +0 -32
  107. package/esm2015/lib/modules/key-info/key-info.module.js.map +0 -1
  108. package/esm2015/lib/modules/label/label-type.js +0 -2
  109. package/esm2015/lib/modules/label/label-type.js.map +0 -1
  110. package/esm2015/lib/modules/label/label.component.js +0 -38
  111. package/esm2015/lib/modules/label/label.component.js.map +0 -1
  112. package/esm2015/lib/modules/label/label.module.js +0 -19
  113. package/esm2015/lib/modules/label/label.module.js.map +0 -1
  114. package/esm2015/lib/modules/shared/indicator-description-type.js +0 -2
  115. package/esm2015/lib/modules/shared/indicator-description-type.js.map +0 -1
  116. package/esm2015/lib/modules/shared/indicator-icon-type.js +0 -2
  117. package/esm2015/lib/modules/shared/indicator-icon-type.js.map +0 -1
  118. package/esm2015/lib/modules/shared/indicator-icon-utility.js +0 -41
  119. package/esm2015/lib/modules/shared/indicator-icon-utility.js.map +0 -1
  120. package/esm2015/lib/modules/shared/indicator-icon.js +0 -2
  121. package/esm2015/lib/modules/shared/indicator-icon.js.map +0 -1
  122. package/esm2015/lib/modules/shared/sky-indicators-resources.module.js +0 -61
  123. package/esm2015/lib/modules/shared/sky-indicators-resources.module.js.map +0 -1
  124. package/esm2015/lib/modules/status-indicator/status-indicator.component.js +0 -99
  125. package/esm2015/lib/modules/status-indicator/status-indicator.component.js.map +0 -1
  126. package/esm2015/lib/modules/status-indicator/status-indicator.module.js +0 -34
  127. package/esm2015/lib/modules/status-indicator/status-indicator.module.js.map +0 -1
  128. package/esm2015/lib/modules/text-highlight/text-highlight.directive.js +0 -153
  129. package/esm2015/lib/modules/text-highlight/text-highlight.directive.js.map +0 -1
  130. package/esm2015/lib/modules/text-highlight/text-highlight.module.js +0 -18
  131. package/esm2015/lib/modules/text-highlight/text-highlight.module.js.map +0 -1
  132. package/esm2015/lib/modules/tokens/token.component.js +0 -112
  133. package/esm2015/lib/modules/tokens/token.component.js.map +0 -1
  134. package/esm2015/lib/modules/tokens/tokens.component.js +0 -304
  135. package/esm2015/lib/modules/tokens/tokens.component.js.map +0 -1
  136. package/esm2015/lib/modules/tokens/tokens.module.js +0 -35
  137. package/esm2015/lib/modules/tokens/tokens.module.js.map +0 -1
  138. package/esm2015/lib/modules/tokens/types/token-selected-event-args.js +0 -2
  139. package/esm2015/lib/modules/tokens/types/token-selected-event-args.js.map +0 -1
  140. package/esm2015/lib/modules/tokens/types/token.js +0 -2
  141. package/esm2015/lib/modules/tokens/types/token.js.map +0 -1
  142. package/esm2015/lib/modules/tokens/types/tokens-message-type.js +0 -24
  143. package/esm2015/lib/modules/tokens/types/tokens-message-type.js.map +0 -1
  144. package/esm2015/lib/modules/tokens/types/tokens-message.js +0 -2
  145. package/esm2015/lib/modules/tokens/types/tokens-message.js.map +0 -1
  146. package/esm2015/lib/modules/wait/wait-adapter.service.js +0 -201
  147. package/esm2015/lib/modules/wait/wait-adapter.service.js.map +0 -1
  148. package/esm2015/lib/modules/wait/wait-page-adapter.service.js +0 -25
  149. package/esm2015/lib/modules/wait/wait-page-adapter.service.js.map +0 -1
  150. package/esm2015/lib/modules/wait/wait-page.component.js +0 -23
  151. package/esm2015/lib/modules/wait/wait-page.component.js.map +0 -1
  152. package/esm2015/lib/modules/wait/wait.component.js +0 -94
  153. package/esm2015/lib/modules/wait/wait.component.js.map +0 -1
  154. package/esm2015/lib/modules/wait/wait.module.js +0 -22
  155. package/esm2015/lib/modules/wait/wait.module.js.map +0 -1
  156. package/esm2015/lib/modules/wait/wait.service.js +0 -164
  157. package/esm2015/lib/modules/wait/wait.service.js.map +0 -1
  158. package/esm2015/skyux-indicators.js +0 -5
  159. package/esm2015/skyux-indicators.js.map +0 -1
  160. package/esm2015/testing/alert-fixture.js +0 -67
  161. package/esm2015/testing/alert-fixture.js.map +0 -1
  162. package/esm2015/testing/label-fixture.js +0 -40
  163. package/esm2015/testing/label-fixture.js.map +0 -1
  164. package/esm2015/testing/public-api.js +0 -4
  165. package/esm2015/testing/public-api.js.map +0 -1
  166. package/esm2015/testing/skyux-indicators-testing.js +0 -5
  167. package/esm2015/testing/skyux-indicators-testing.js.map +0 -1
  168. package/esm2015/testing/wait-fixture.js +0 -24
  169. package/esm2015/testing/wait-fixture.js.map +0 -1
  170. package/fesm2015/skyux-indicators-testing.js.map +0 -1
  171. package/fesm2015/skyux-indicators.js.map +0 -1
@@ -1,304 +0,0 @@
1
- import { animate, style, transition, trigger } from '@angular/animations';
2
- import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, QueryList, ViewChildren, } from '@angular/core';
3
- import { Subject } from 'rxjs';
4
- import { takeUntil } from 'rxjs/operators';
5
- import { SkyTokenComponent } from './token.component';
6
- import { SkyTokensMessageType } from './types/tokens-message-type';
7
- import * as i0 from "@angular/core";
8
- import * as i1 from "./token.component";
9
- import * as i2 from "@angular/common";
10
- export class SkyTokensComponent {
11
- constructor(changeDetector) {
12
- this.changeDetector = changeDetector;
13
- /**
14
- * Fires when users navigate through the tokens list with the `Tab` key
15
- * and attempt to move past the final token in the list.
16
- */
17
- this.focusIndexOverRange = new EventEmitter();
18
- /**
19
- * Fires when usersnavigate through the tokens list with the `Tab` key
20
- * and attempt to move before the first token in the list.
21
- */
22
- this.focusIndexUnderRange = new EventEmitter();
23
- /**
24
- * Fires when users select a token in the list. This event emits the selected token.
25
- */
26
- this.tokenSelected = new EventEmitter();
27
- /**
28
- * Fires when the tokens in the list change.
29
- * This event emits an array of the tokens in the updated list.
30
- */
31
- this.tokensChange = new EventEmitter();
32
- this.ngUnsubscribe = new Subject();
33
- // Angular calls the trackBy function without applying the component instance's scope.
34
- // Use a fat-arrow function so the current component instance's trackWith property can
35
- // be referenced.
36
- this.trackTokenFn = (_index, item) => {
37
- if (this.trackWith) {
38
- return item.value[this.trackWith];
39
- }
40
- return item;
41
- };
42
- }
43
- /**
44
- * Indicates whether to disable the tokens list to prevent users from selecting tokens,
45
- * dismissing tokens, or navigating through the list with the arrow keys. When the tokens list
46
- * is disabled, users can still place focus on items in the list using the `Tab` key.
47
- * @default false
48
- */
49
- set disabled(value) {
50
- this._disabled = value;
51
- }
52
- get disabled() {
53
- return !!this._disabled;
54
- }
55
- /**
56
- * Indicates whether users can remove tokens from the list by selecting their close buttons
57
- * or pressing the `Backspace` key.
58
- * @default true
59
- */
60
- set dismissible(value) {
61
- this._dismissible = value;
62
- }
63
- get dismissible() {
64
- return this._dismissible !== false;
65
- }
66
- /**
67
- * Specifies the token property to display for each item in the tokens list.
68
- * @default "name"
69
- */
70
- set displayWith(value) {
71
- this._displayWith = value;
72
- }
73
- get displayWith() {
74
- return this._displayWith || 'name';
75
- }
76
- /**
77
- * Indicates whether users can focus on items in the list using the `Tab` key.
78
- * This does not affect the ability of users to select tokens, dismiss tokens,
79
- * or navigate through the list with the arrow keys.
80
- * @default true
81
- */
82
- set focusable(value) {
83
- this._focusable = value;
84
- }
85
- get focusable() {
86
- return this._focusable !== false;
87
- }
88
- /**
89
- * Specifies an array of tokens to include in the list.
90
- */
91
- set tokens(value) {
92
- this._tokens = value;
93
- this.tokensChange.emit(this._tokens);
94
- }
95
- get tokens() {
96
- return this._tokens || [];
97
- }
98
- /**
99
- * Specifies an observable of `SkyTokensMessage` that can place focus on a
100
- * particular token or remove the active token from the list.
101
- */
102
- set messageStream(value) {
103
- this._messageStream = value;
104
- this.initMessageStream();
105
- }
106
- get messageStream() {
107
- return this._messageStream;
108
- }
109
- /**
110
- * @internal
111
- */
112
- get activeIndex() {
113
- return this._activeIndex || 0;
114
- }
115
- set activeIndex(value) {
116
- if (value >= this.tokens.length) {
117
- value = this.tokens.length - 1;
118
- this.focusIndexOverRange.emit();
119
- }
120
- if (value < 0) {
121
- value = 0;
122
- this.focusIndexUnderRange.emit();
123
- }
124
- this._activeIndex = value;
125
- }
126
- ngOnDestroy() {
127
- this.ngUnsubscribe.next();
128
- this.ngUnsubscribe.complete();
129
- }
130
- onTokenClick(token) {
131
- if (this.disabled) {
132
- return;
133
- }
134
- this.notifyTokenSelected(token);
135
- }
136
- onTokenKeyDown(event) {
137
- if (!this.disabled) {
138
- /* tslint:disable-next-line:switch-default */
139
- switch (event.key) {
140
- case 'Left':
141
- case 'ArrowLeft':
142
- this.messageStream.next({
143
- type: SkyTokensMessageType.FocusPreviousToken,
144
- });
145
- event.preventDefault();
146
- break;
147
- case 'Right':
148
- case 'ArrowRight':
149
- this.messageStream.next({
150
- type: SkyTokensMessageType.FocusNextToken,
151
- });
152
- event.preventDefault();
153
- break;
154
- }
155
- }
156
- }
157
- selectToken(token) {
158
- if (!this.disabled) {
159
- this.notifyTokenSelected(token);
160
- }
161
- }
162
- removeToken(token) {
163
- this.tokens = this.tokens.filter((t) => t !== token);
164
- this.changeDetector.detectChanges();
165
- }
166
- focusPreviousToken() {
167
- this.activeIndex--;
168
- this.focusActiveToken();
169
- }
170
- focusNextToken() {
171
- this.activeIndex++;
172
- this.focusActiveToken();
173
- }
174
- focusLastToken() {
175
- this.activeIndex = this.tokenComponents.length - 1;
176
- this.focusActiveToken();
177
- }
178
- focusActiveToken() {
179
- const tokenComponent = this.tokenComponents.find((_comp, i) => {
180
- return this.activeIndex === i;
181
- });
182
- if (tokenComponent) {
183
- tokenComponent.focusElement();
184
- }
185
- }
186
- removeActiveToken() {
187
- const token = this.tokens[this.activeIndex];
188
- if (token) {
189
- this.removeToken(token);
190
- }
191
- }
192
- initMessageStream() {
193
- if (this.messageStreamSub) {
194
- this.messageStreamSub.unsubscribe();
195
- }
196
- if (this.messageStream) {
197
- this.messageStreamSub = this.messageStream
198
- .pipe(takeUntil(this.ngUnsubscribe))
199
- .subscribe((message) => {
200
- /* tslint:disable-next-line:switch-default */
201
- switch (message.type) {
202
- case SkyTokensMessageType.FocusLastToken:
203
- this.focusLastToken();
204
- break;
205
- case SkyTokensMessageType.FocusActiveToken:
206
- this.focusActiveToken();
207
- break;
208
- case SkyTokensMessageType.FocusPreviousToken:
209
- this.focusPreviousToken();
210
- break;
211
- case SkyTokensMessageType.FocusNextToken:
212
- this.focusNextToken();
213
- break;
214
- case SkyTokensMessageType.RemoveActiveToken:
215
- this.removeActiveToken();
216
- break;
217
- }
218
- });
219
- }
220
- }
221
- notifyTokenSelected(token) {
222
- this.tokenSelected.emit({
223
- token,
224
- });
225
- }
226
- }
227
- SkyTokensComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTokensComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
228
- SkyTokensComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyTokensComponent, selector: "sky-tokens", inputs: { disabled: "disabled", dismissible: "dismissible", displayWith: "displayWith", trackWith: "trackWith", focusable: "focusable", tokens: "tokens", messageStream: "messageStream" }, outputs: { focusIndexOverRange: "focusIndexOverRange", focusIndexUnderRange: "focusIndexUnderRange", tokenSelected: "tokenSelected", tokensChange: "tokensChange" }, viewQueries: [{ propertyName: "tokenComponents", predicate: SkyTokenComponent, descendants: true }], ngImport: i0, template: "<div\n *ngIf=\"tokens\"\n class=\"sky-tokens\"\n [@blockAnimationOnLoad]\n [attr.role]=\"tokens && tokens.length ? 'list' : null\"\n>\n <sky-token\n *ngFor=\"let token of tokens; let i = index; trackBy: trackTokenFn\"\n role=\"listitem\"\n [@.disabled]=\"!trackWith\"\n [@dismiss]\n [disabled]=\"disabled\"\n [dismissible]=\"dismissible\"\n [focusable]=\"focusable\"\n (dismiss)=\"removeToken(token)\"\n (click)=\"onTokenClick(token)\"\n (keydown)=\"onTokenKeyDown($event)\"\n (keyup.enter)=\"selectToken(token); $event.preventDefault()\"\n (tokenFocus)=\"activeIndex = i\"\n >\n {{ token.value[displayWith] }}\n </sky-token>\n <div class=\"sky-tokens-content\">\n <ng-content></ng-content>\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";.sky-tokens{display:flex;flex-wrap:wrap;align-items:baseline;margin:-2px}.sky-tokens .sky-tokens-content,.sky-tokens ::ng-deep sky-token{flex:0 0 auto;display:inline-flex;padding:2px}.sky-tokens .sky-tokens-content{flex-grow:1;flex-basis:0px}.sky-tokens .sky-tokens-content:before{content:\"\\200b\"}\n"], components: [{ type: i1.SkyTokenComponent, selector: "sky-token", inputs: ["disabled", "ariaLabel", "dismissible", "focusable"], outputs: ["dismiss", "tokenFocus"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], animations: [
229
- trigger('blockAnimationOnLoad', [transition(':enter', [])]),
230
- trigger('dismiss', [
231
- transition(':enter', [
232
- style({
233
- opacity: 0,
234
- width: 0,
235
- }),
236
- animate('150ms ease-in', style({
237
- opacity: 1,
238
- width: '*',
239
- })),
240
- ]),
241
- transition(':leave', [
242
- animate('150ms ease-in', style({
243
- opacity: 0,
244
- width: 0,
245
- })),
246
- ]),
247
- ]),
248
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush });
249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTokensComponent, decorators: [{
250
- type: Component,
251
- args: [{
252
- selector: 'sky-tokens',
253
- templateUrl: './tokens.component.html',
254
- styleUrls: ['./tokens.component.scss'],
255
- changeDetection: ChangeDetectionStrategy.OnPush,
256
- animations: [
257
- trigger('blockAnimationOnLoad', [transition(':enter', [])]),
258
- trigger('dismiss', [
259
- transition(':enter', [
260
- style({
261
- opacity: 0,
262
- width: 0,
263
- }),
264
- animate('150ms ease-in', style({
265
- opacity: 1,
266
- width: '*',
267
- })),
268
- ]),
269
- transition(':leave', [
270
- animate('150ms ease-in', style({
271
- opacity: 0,
272
- width: 0,
273
- })),
274
- ]),
275
- ]),
276
- ],
277
- }]
278
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { disabled: [{
279
- type: Input
280
- }], dismissible: [{
281
- type: Input
282
- }], displayWith: [{
283
- type: Input
284
- }], trackWith: [{
285
- type: Input
286
- }], focusable: [{
287
- type: Input
288
- }], tokens: [{
289
- type: Input
290
- }], messageStream: [{
291
- type: Input
292
- }], focusIndexOverRange: [{
293
- type: Output
294
- }], focusIndexUnderRange: [{
295
- type: Output
296
- }], tokenSelected: [{
297
- type: Output
298
- }], tokensChange: [{
299
- type: Output
300
- }], tokenComponents: [{
301
- type: ViewChildren,
302
- args: [SkyTokenComponent]
303
- }] } });
304
- //# sourceMappingURL=tokens.component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/indicators/src/lib/modules/tokens/tokens.component.ts","../../../../../../../../libs/components/indicators/src/lib/modules/tokens/tokens.component.html"],"names":[],"mappings":"AA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KACH;4FAEU,kBAAkB;kBAjC9B,SAAS;mBAAC;oBACT,QAAQ,EAAE,YAAY;oBACtB,WAAW,EAAE,yBAAyB;oBACtC,SAAS,EAAE,CAAC,yBAAyB,CAAC;oBACtC,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,UAAU,EAAE;wBACV,OAAO,CAAC,sBAAsB,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;wBAC3D,OAAO,CAAC,SAAS,EAAE;4BACjB,UAAU,CAAC,QAAQ,EAAE;gCACnB,KAAK,CAAC;oCACJ,OAAO,EAAE,CAAC;oCACV,KAAK,EAAE,CAAC;iCACT,CAAC;gCACF,OAAO,CACL,eAAe,EACf,KAAK,CAAC;oCACJ,OAAO,EAAE,CAAC;oCACV,KAAK,EAAE,GAAG;iCACX,CAAC,CACH;6BACF,CAAC;4BACF,UAAU,CAAC,QAAQ,EAAE;gCACnB,OAAO,CACL,eAAe,EACf,KAAK,CAAC;oCACJ,OAAO,EAAE,CAAC;oCACV,KAAK,EAAE,CAAC;iCACT,CAAC,CACH;6BACF,CAAC;yBACH,CAAC;qBACH;iBACF;wGASY,QAAQ;sBADlB,KAAK;gBAeK,WAAW;sBADrB,KAAK;gBAcK,WAAW;sBADrB,KAAK;gBAcC,SAAS;sBADf,KAAK;gBAUK,SAAS;sBADnB,KAAK;gBAaK,MAAM;sBADhB,KAAK;gBAeK,aAAa;sBADvB,KAAK;gBAeC,mBAAmB;sBADzB,MAAM;gBAQA,oBAAoB;sBAD1B,MAAM;gBAOA,aAAa;sBADnB,MAAM;gBAQA,YAAY;sBADlB,MAAM;gBA6BC,eAAe;sBADtB,YAAY;uBAAC,iBAAiB","sourcesContent":["import { animate, style, transition, trigger } from '@angular/animations';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n QueryList,\n ViewChildren,\n} from '@angular/core';\n\nimport { Subject, Subscription } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyTokenComponent } from './token.component';\nimport { SkyToken } from './types/token';\nimport { SkyTokenSelectedEventArgs } from './types/token-selected-event-args';\nimport { SkyTokensMessage } from './types/tokens-message';\nimport { SkyTokensMessageType } from './types/tokens-message-type';\n\n@Component({\n selector: 'sky-tokens',\n templateUrl: './tokens.component.html',\n styleUrls: ['./tokens.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [\n trigger('blockAnimationOnLoad', [transition(':enter', [])]),\n trigger('dismiss', [\n transition(':enter', [\n style({\n opacity: 0,\n width: 0,\n }),\n animate(\n '150ms ease-in',\n style({\n opacity: 1,\n width: '*',\n })\n ),\n ]),\n transition(':leave', [\n animate(\n '150ms ease-in',\n style({\n opacity: 0,\n width: 0,\n })\n ),\n ]),\n ]),\n ],\n})\nexport class SkyTokensComponent implements OnDestroy {\n /**\n * Indicates whether to disable the tokens list to prevent users from selecting tokens,\n * dismissing tokens, or navigating through the list with the arrow keys. When the tokens list\n * is disabled, users can still place focus on items in the list using the `Tab` key.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n this._disabled = value;\n }\n\n public get disabled(): boolean {\n return !!this._disabled;\n }\n\n /**\n * Indicates whether users can remove tokens from the list by selecting their close buttons\n * or pressing the `Backspace` key.\n * @default true\n */\n @Input()\n public set dismissible(value: boolean) {\n this._dismissible = value;\n }\n\n public get dismissible(): boolean {\n return this._dismissible !== false;\n }\n\n /**\n * Specifies the token property to display for each item in the tokens list.\n * @default \"name\"\n */\n @Input()\n public set displayWith(value: string) {\n this._displayWith = value;\n }\n\n public get displayWith(): string {\n return this._displayWith || 'name';\n }\n\n /**\n * Specifies the token property that represents the token's unique identifier. When this property\n * is set, animations are enabled when dismissing tokens.\n */\n @Input()\n public trackWith: string;\n\n /**\n * Indicates whether users can focus on items in the list using the `Tab` key.\n * This does not affect the ability of users to select tokens, dismiss tokens,\n * or navigate through the list with the arrow keys.\n * @default true\n */\n @Input()\n public set focusable(value: boolean) {\n this._focusable = value;\n }\n\n public get focusable(): boolean {\n return this._focusable !== false;\n }\n\n /**\n * Specifies an array of tokens to include in the list.\n */\n @Input()\n public set tokens(value: SkyToken[]) {\n this._tokens = value;\n this.tokensChange.emit(this._tokens);\n }\n\n public get tokens(): SkyToken[] {\n return this._tokens || [];\n }\n\n /**\n * Specifies an observable of `SkyTokensMessage` that can place focus on a\n * particular token or remove the active token from the list.\n */\n @Input()\n public set messageStream(value: Subject<SkyTokensMessage>) {\n this._messageStream = value;\n this.initMessageStream();\n }\n\n public get messageStream(): Subject<SkyTokensMessage> {\n return this._messageStream;\n }\n\n /**\n * Fires when users navigate through the tokens list with the `Tab` key\n * and attempt to move past the final token in the list.\n */\n @Output()\n public focusIndexOverRange = new EventEmitter<void>();\n\n /**\n * Fires when usersnavigate through the tokens list with the `Tab` key\n * and attempt to move before the first token in the list.\n */\n @Output()\n public focusIndexUnderRange = new EventEmitter<void>();\n\n /**\n * Fires when users select a token in the list. This event emits the selected token.\n */\n @Output()\n public tokenSelected = new EventEmitter<SkyTokenSelectedEventArgs>();\n\n /**\n * Fires when the tokens in the list change.\n * This event emits an array of the tokens in the updated list.\n */\n @Output()\n public tokensChange = new EventEmitter<SkyToken[]>();\n\n /**\n * @internal\n */\n public get activeIndex(): number {\n return this._activeIndex || 0;\n }\n public set activeIndex(value: number) {\n if (value >= this.tokens.length) {\n value = this.tokens.length - 1;\n this.focusIndexOverRange.emit();\n }\n\n if (value < 0) {\n value = 0;\n this.focusIndexUnderRange.emit();\n }\n\n this._activeIndex = value;\n }\n\n /**\n * internal\n */\n public trackTokenFn: (index: number, item: SkyToken) => any;\n\n @ViewChildren(SkyTokenComponent)\n private tokenComponents: QueryList<SkyTokenComponent>;\n\n private messageStreamSub: Subscription;\n private ngUnsubscribe = new Subject();\n\n private _activeIndex: number;\n private _disabled: boolean;\n private _dismissible: boolean;\n private _focusable: boolean;\n private _tokens: SkyToken[];\n private _displayWith: string;\n private _messageStream: Subject<SkyTokensMessage>;\n\n constructor(private changeDetector: ChangeDetectorRef) {\n // Angular calls the trackBy function without applying the component instance's scope.\n // Use a fat-arrow function so the current component instance's trackWith property can\n // be referenced.\n this.trackTokenFn = (_index, item) => {\n if (this.trackWith) {\n return item.value[this.trackWith];\n }\n\n return item;\n };\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public onTokenClick(token: SkyToken): void {\n if (this.disabled) {\n return;\n }\n\n this.notifyTokenSelected(token);\n }\n\n public onTokenKeyDown(event: KeyboardEvent): void {\n if (!this.disabled) {\n /* tslint:disable-next-line:switch-default */\n switch (event.key) {\n case 'Left':\n case 'ArrowLeft':\n this.messageStream.next({\n type: SkyTokensMessageType.FocusPreviousToken,\n });\n event.preventDefault();\n break;\n\n case 'Right':\n case 'ArrowRight':\n this.messageStream.next({\n type: SkyTokensMessageType.FocusNextToken,\n });\n event.preventDefault();\n break;\n }\n }\n }\n\n public selectToken(token: SkyToken): void {\n if (!this.disabled) {\n this.notifyTokenSelected(token);\n }\n }\n\n public removeToken(token: SkyToken): void {\n this.tokens = this.tokens.filter((t) => t !== token);\n this.changeDetector.detectChanges();\n }\n\n private focusPreviousToken(): void {\n this.activeIndex--;\n this.focusActiveToken();\n }\n\n private focusNextToken(): void {\n this.activeIndex++;\n this.focusActiveToken();\n }\n\n private focusLastToken(): void {\n this.activeIndex = this.tokenComponents.length - 1;\n this.focusActiveToken();\n }\n\n private focusActiveToken(): void {\n const tokenComponent = this.tokenComponents.find(\n (_comp: SkyTokenComponent, i: number) => {\n return this.activeIndex === i;\n }\n );\n\n if (tokenComponent) {\n tokenComponent.focusElement();\n }\n }\n\n private removeActiveToken(): void {\n const token = this.tokens[this.activeIndex];\n if (token) {\n this.removeToken(token);\n }\n }\n\n private initMessageStream(): void {\n if (this.messageStreamSub) {\n this.messageStreamSub.unsubscribe();\n }\n\n if (this.messageStream) {\n this.messageStreamSub = this.messageStream\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((message: SkyTokensMessage) => {\n /* tslint:disable-next-line:switch-default */\n switch (message.type) {\n case SkyTokensMessageType.FocusLastToken:\n this.focusLastToken();\n break;\n\n case SkyTokensMessageType.FocusActiveToken:\n this.focusActiveToken();\n break;\n\n case SkyTokensMessageType.FocusPreviousToken:\n this.focusPreviousToken();\n break;\n\n case SkyTokensMessageType.FocusNextToken:\n this.focusNextToken();\n break;\n\n case SkyTokensMessageType.RemoveActiveToken:\n this.removeActiveToken();\n break;\n }\n });\n }\n }\n\n private notifyTokenSelected(token: SkyToken): void {\n this.tokenSelected.emit({\n token,\n });\n }\n}\n","<div\n *ngIf=\"tokens\"\n class=\"sky-tokens\"\n [@blockAnimationOnLoad]\n [attr.role]=\"tokens && tokens.length ? 'list' : null\"\n>\n <sky-token\n *ngFor=\"let token of tokens; let i = index; trackBy: trackTokenFn\"\n role=\"listitem\"\n [@.disabled]=\"!trackWith\"\n [@dismiss]\n [disabled]=\"disabled\"\n [dismissible]=\"dismissible\"\n [focusable]=\"focusable\"\n (dismiss)=\"removeToken(token)\"\n (click)=\"onTokenClick(token)\"\n (keydown)=\"onTokenKeyDown($event)\"\n (keyup.enter)=\"selectToken(token); $event.preventDefault()\"\n (tokenFocus)=\"activeIndex = i\"\n >\n {{ token.value[displayWith] }}\n </sky-token>\n <div class=\"sky-tokens-content\">\n <ng-content></ng-content>\n </div>\n</div>\n"]}
@@ -1,35 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { SkyI18nModule } from '@skyux/i18n';
4
- import { SkyIconModule } from '../icon/icon.module';
5
- import { SkyIndicatorsResourcesModule } from '../shared/sky-indicators-resources.module';
6
- import { SkyTokenComponent } from './token.component';
7
- import { SkyTokensComponent } from './tokens.component';
8
- import * as i0 from "@angular/core";
9
- export class SkyTokensModule {
10
- }
11
- SkyTokensModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTokensModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
12
- SkyTokensModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTokensModule, declarations: [SkyTokenComponent, SkyTokensComponent], imports: [CommonModule,
13
- SkyI18nModule,
14
- SkyIconModule,
15
- SkyIndicatorsResourcesModule], exports: [SkyTokenComponent, SkyTokensComponent] });
16
- SkyTokensModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTokensModule, imports: [[
17
- CommonModule,
18
- SkyI18nModule,
19
- SkyIconModule,
20
- SkyIndicatorsResourcesModule,
21
- ]] });
22
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTokensModule, decorators: [{
23
- type: NgModule,
24
- args: [{
25
- declarations: [SkyTokenComponent, SkyTokensComponent],
26
- imports: [
27
- CommonModule,
28
- SkyI18nModule,
29
- SkyIconModule,
30
- SkyIndicatorsResourcesModule,
31
- ],
32
- exports: [SkyTokenComponent, SkyTokensComponent],
33
- }]
34
- }] });
35
- //# sourceMappingURL=tokens.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/indicators/src/lib/modules/tokens/tokens.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAEzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;;AAYxD,MAAM,OAAO,eAAe;;6GAAf,eAAe;8GAAf,eAAe,iBATX,iBAAiB,EAAE,kBAAkB,aAElD,YAAY;QACZ,aAAa;QACb,aAAa;QACb,4BAA4B,aAEpB,iBAAiB,EAAE,kBAAkB;8GAEpC,eAAe,YARjB;YACP,YAAY;YACZ,aAAa;YACb,aAAa;YACb,4BAA4B;SAC7B;4FAGU,eAAe;kBAV3B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;oBACrD,OAAO,EAAE;wBACP,YAAY;wBACZ,aAAa;wBACb,aAAa;wBACb,4BAA4B;qBAC7B;oBACD,OAAO,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;iBACjD","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SkyI18nModule } from '@skyux/i18n';\n\nimport { SkyIconModule } from '../icon/icon.module';\nimport { SkyIndicatorsResourcesModule } from '../shared/sky-indicators-resources.module';\n\nimport { SkyTokenComponent } from './token.component';\nimport { SkyTokensComponent } from './tokens.component';\n\n@NgModule({\n declarations: [SkyTokenComponent, SkyTokensComponent],\n imports: [\n CommonModule,\n SkyI18nModule,\n SkyIconModule,\n SkyIndicatorsResourcesModule,\n ],\n exports: [SkyTokenComponent, SkyTokensComponent],\n})\nexport class SkyTokensModule {}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=token-selected-event-args.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-selected-event-args.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/indicators/src/lib/modules/tokens/types/token-selected-event-args.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyToken } from './token';\n\nexport interface SkyTokenSelectedEventArgs {\n /**\n * Indicates the currently selected token.\n */\n token?: SkyToken;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=token.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/indicators/src/lib/modules/tokens/types/token.ts"],"names":[],"mappings":"","sourcesContent":["export interface SkyToken {\n /**\n * Specifies the token's contents.\n */\n value: any;\n}\n"]}
@@ -1,24 +0,0 @@
1
- export var SkyTokensMessageType;
2
- (function (SkyTokensMessageType) {
3
- /**
4
- * Places focus on the last token in the list.
5
- */
6
- SkyTokensMessageType[SkyTokensMessageType["FocusLastToken"] = 0] = "FocusLastToken";
7
- /**
8
- * Places focus on the token that is currently selected.
9
- */
10
- SkyTokensMessageType[SkyTokensMessageType["FocusActiveToken"] = 1] = "FocusActiveToken";
11
- /**
12
- * Places focus on the token before the currently selected token.
13
- */
14
- SkyTokensMessageType[SkyTokensMessageType["FocusPreviousToken"] = 2] = "FocusPreviousToken";
15
- /**
16
- * Places focus on the token after the currently selected token.
17
- */
18
- SkyTokensMessageType[SkyTokensMessageType["FocusNextToken"] = 3] = "FocusNextToken";
19
- /**
20
- * Removes the token that is currently selected from the list of tokens.
21
- */
22
- SkyTokensMessageType[SkyTokensMessageType["RemoveActiveToken"] = 4] = "RemoveActiveToken";
23
- })(SkyTokensMessageType || (SkyTokensMessageType = {}));
24
- //# sourceMappingURL=tokens-message-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens-message-type.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/indicators/src/lib/modules/tokens/types/tokens-message-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,oBAyBX;AAzBD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,mFAAkB,CAAA;IAElB;;OAEG;IACH,uFAAoB,CAAA;IAEpB;;OAEG;IACH,2FAAsB,CAAA;IAEtB;;OAEG;IACH,mFAAkB,CAAA;IAElB;;OAEG;IACH,yFAAqB,CAAA;AACvB,CAAC,EAzBW,oBAAoB,KAApB,oBAAoB,QAyB/B","sourcesContent":["export enum SkyTokensMessageType {\n /**\n * Places focus on the last token in the list.\n */\n FocusLastToken = 0,\n\n /**\n * Places focus on the token that is currently selected.\n */\n FocusActiveToken = 1,\n\n /**\n * Places focus on the token before the currently selected token.\n */\n FocusPreviousToken = 2,\n\n /**\n * Places focus on the token after the currently selected token.\n */\n FocusNextToken = 3,\n\n /**\n * Removes the token that is currently selected from the list of tokens.\n */\n RemoveActiveToken = 4,\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=tokens-message.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokens-message.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/indicators/src/lib/modules/tokens/types/tokens-message.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyTokensMessageType } from './tokens-message-type';\n\nexport interface SkyTokensMessage {\n /**\n * Specifies the type of message.\n */\n type?: SkyTokensMessageType;\n}\n"]}
@@ -1,201 +0,0 @@
1
- import { Injectable, RendererFactory2, } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- // Need to add the following to classes which contain static methods.
4
- // See: https://github.com/ng-packagr/ng-packagr/issues/641
5
- /**
6
- * @internal
7
- * @dynamic
8
- */
9
- export class SkyWaitAdapterService {
10
- constructor(rendererFactory) {
11
- this.rendererFactory = rendererFactory;
12
- this.renderer = this.rendererFactory.createRenderer(undefined, undefined);
13
- }
14
- ngOnDestroy() {
15
- this.clearListeners();
16
- }
17
- setWaitBounds(waitEl) {
18
- this.renderer.setStyle(waitEl.nativeElement.parentElement, 'position', 'relative');
19
- }
20
- removeWaitBounds(waitEl) {
21
- this.renderer.removeStyle(waitEl.nativeElement.parentElement, 'position');
22
- }
23
- setBusyState(waitEl, isFullPage, isWaiting, isNonBlocking = false, waitComponentId) {
24
- const busyEl = isFullPage
25
- ? document.body
26
- : waitEl.nativeElement.parentElement;
27
- if (!isNonBlocking) {
28
- if (isWaiting) {
29
- this.renderer.setAttribute(busyEl, 'aria-busy', 'true');
30
- // Remove focus from page when full page blocking wait
31
- if (isFullPage || busyEl.contains(document.activeElement)) {
32
- this.clearDocumentFocus();
33
- }
34
- if (isFullPage) {
35
- SkyWaitAdapterService.isPageWaitActive = true;
36
- const endListenerFunc = this.renderer.listen(document.body, 'keydown', (event) => {
37
- /*istanbul ignore else */
38
- if (event.key) {
39
- /* istanbul ignore else */
40
- if (event.key.toLowerCase() === 'tab') {
41
- event.target.blur();
42
- event.preventDefault();
43
- event.stopPropagation();
44
- event.stopImmediatePropagation();
45
- this.clearDocumentFocus();
46
- }
47
- }
48
- });
49
- SkyWaitAdapterService.busyElements[waitComponentId] = {
50
- listener: endListenerFunc,
51
- busyEl: undefined,
52
- };
53
- }
54
- else {
55
- const endListenerFunc = this.renderer.listen(busyEl, 'focusin', (event) => {
56
- /* istanbul ignore else */
57
- if (!isNonBlocking) {
58
- event.preventDefault();
59
- event.stopPropagation();
60
- event.stopImmediatePropagation();
61
- if (SkyWaitAdapterService.isPageWaitActive) {
62
- this.clearDocumentFocus();
63
- }
64
- else {
65
- // Propagate tab navigation if attempted into waited element
66
- const target = event.target;
67
- target.blur();
68
- this.focusNextElement(target, this.isShift(event), busyEl);
69
- }
70
- }
71
- });
72
- SkyWaitAdapterService.busyElements[waitComponentId] = {
73
- listener: endListenerFunc,
74
- busyEl: busyEl,
75
- };
76
- }
77
- }
78
- else {
79
- this.renderer.removeAttribute(busyEl, 'aria-busy');
80
- if (isFullPage) {
81
- SkyWaitAdapterService.isPageWaitActive = false;
82
- }
83
- if (waitComponentId in SkyWaitAdapterService.busyElements) {
84
- SkyWaitAdapterService.busyElements[waitComponentId].listener();
85
- delete SkyWaitAdapterService.busyElements[waitComponentId];
86
- }
87
- }
88
- }
89
- }
90
- focusNextElement(targetElement, shiftKey, busyEl) {
91
- const focussable = this.getFocussableElements();
92
- // If shift tab, go in the other direction
93
- const modifier = shiftKey ? -1 : 1;
94
- // Find the next navigable element that isn't waiting
95
- const startingIndex = focussable.indexOf(targetElement);
96
- let curIndex = startingIndex + modifier;
97
- while (focussable[curIndex] &&
98
- this.isElementBusyOrHidden(focussable[curIndex])) {
99
- curIndex += modifier;
100
- }
101
- if (focussable[curIndex] &&
102
- !this.isElementBusyOrHidden(focussable[curIndex])) {
103
- focussable[curIndex].focus();
104
- }
105
- else {
106
- // Try wrapping the navigation
107
- /* istanbul ignore next */
108
- /* sanity check */
109
- curIndex = modifier > 0 ? 0 : focussable.length - 1;
110
- while (curIndex !== startingIndex &&
111
- focussable[curIndex] &&
112
- this.isElementBusyOrHidden(focussable[curIndex])) {
113
- /* istanbul ignore next */
114
- /* sanity check */
115
- curIndex += modifier;
116
- }
117
- /* istanbul ignore else */
118
- /* sanity check */
119
- if (focussable[curIndex] &&
120
- !this.isElementBusyOrHidden(focussable[curIndex])) {
121
- focussable[curIndex].focus();
122
- }
123
- else {
124
- // No valid target, wipe focus
125
- this.clearDocumentFocus();
126
- }
127
- }
128
- // clear focussableElements list
129
- this.focussableElements = undefined;
130
- }
131
- isShift(event) {
132
- // Determine if shift+tab was used based on element order
133
- const elements = this.getFocussableElements().filter((elem) => !this.isElementHidden(elem));
134
- const previousInd = elements.indexOf(event.relatedTarget);
135
- const currentInd = elements.indexOf(event.target);
136
- return (previousInd === currentInd + 1 ||
137
- (previousInd === 0 && currentInd === elements.length - 1) ||
138
- previousInd > currentInd ||
139
- !event.relatedTarget);
140
- }
141
- isElementHidden(element) {
142
- const style = window.getComputedStyle(element);
143
- return style.display === 'none' || style.visibility === 'hidden';
144
- }
145
- isElementBusyOrHidden(element) {
146
- if (this.isElementHidden(element)) {
147
- return true;
148
- }
149
- for (const key of Object.keys(SkyWaitAdapterService.busyElements)) {
150
- const parentElement = SkyWaitAdapterService.busyElements[key].busyEl;
151
- if (parentElement && parentElement.contains(element)) {
152
- return true;
153
- }
154
- }
155
- return false;
156
- }
157
- clearDocumentFocus() {
158
- /* istanbul ignore else */
159
- if (document.activeElement && document.activeElement.blur) {
160
- document.activeElement.blur();
161
- }
162
- document.body.focus();
163
- }
164
- getFocussableElements() {
165
- // Keep this cached so we can reduce querys
166
- if (this.focussableElements) {
167
- return this.focussableElements;
168
- }
169
- // Select all possible focussable elements
170
- const focussableElements = 'a[href], ' +
171
- 'area[href], ' +
172
- "input:not([disabled]):not([tabindex='-1']), " +
173
- "button:not([disabled]):not([tabindex='-1']), " +
174
- "select:not([disabled]):not([tabindex='-1']), " +
175
- "textarea:not([disabled]):not([tabindex='-1']), " +
176
- 'iframe, object, embed, ' +
177
- "*[tabindex]:not([tabindex='-1']), " +
178
- '*[contenteditable=true]';
179
- this.focussableElements = Array.prototype.filter.call(document.body.querySelectorAll(focussableElements), (element) => {
180
- return (element.offsetWidth > 0 ||
181
- element.offsetHeight > 0 ||
182
- element === document.activeElement);
183
- });
184
- return this.focussableElements;
185
- }
186
- clearListeners() {
187
- SkyWaitAdapterService.isPageWaitActive = false;
188
- for (const key of Object.keys(SkyWaitAdapterService.busyElements)) {
189
- SkyWaitAdapterService.busyElements[key].listener();
190
- delete SkyWaitAdapterService.busyElements[key];
191
- }
192
- }
193
- }
194
- SkyWaitAdapterService.isPageWaitActive = false;
195
- SkyWaitAdapterService.busyElements = {};
196
- SkyWaitAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyWaitAdapterService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
197
- SkyWaitAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyWaitAdapterService });
198
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyWaitAdapterService, decorators: [{
199
- type: Injectable
200
- }], ctorParameters: function () { return [{ type: i0.RendererFactory2 }]; } });
201
- //# sourceMappingURL=wait-adapter.service.js.map