@skyux/lookup 8.7.2 → 9.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/documentation.json +244 -244
  2. package/esm2022/lib/modules/autocomplete/autocomplete-adapter.service.mjs +61 -0
  3. package/esm2022/lib/modules/autocomplete/autocomplete-input.directive.mjs +237 -0
  4. package/{esm2020 → esm2022}/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.mjs +4 -4
  5. package/esm2022/lib/modules/autocomplete/autocomplete.component.mjs +817 -0
  6. package/{esm2020 → esm2022}/lib/modules/autocomplete/autocomplete.module.mjs +27 -27
  7. package/esm2022/lib/modules/country-field/country-field.component.mjs +444 -0
  8. package/{esm2020 → esm2022}/lib/modules/country-field/country-field.module.mjs +19 -19
  9. package/{esm2020 → esm2022}/lib/modules/lookup/lookup-adapter.service.mjs +4 -4
  10. package/esm2022/lib/modules/lookup/lookup-autocomplete-adapter.mjs +114 -0
  11. package/esm2022/lib/modules/lookup/lookup-show-more-modal.component.mjs +270 -0
  12. package/{esm2020 → esm2022}/lib/modules/lookup/lookup.component.mjs +299 -280
  13. package/{esm2020 → esm2022}/lib/modules/lookup/lookup.module.mjs +37 -37
  14. package/esm2022/lib/modules/search/search-adapter.service.mjs +46 -0
  15. package/esm2022/lib/modules/search/search.component.mjs +285 -0
  16. package/{esm2020 → esm2022}/lib/modules/search/search.module.mjs +17 -17
  17. package/{esm2020 → esm2022}/lib/modules/selection-modal/selection-modal-item-selected.pipe.mjs +4 -4
  18. package/esm2022/lib/modules/selection-modal/selection-modal.component.mjs +201 -0
  19. package/{esm2020 → esm2022}/lib/modules/selection-modal/selection-modal.module.mjs +27 -27
  20. package/esm2022/lib/modules/selection-modal/selection-modal.service.mjs +89 -0
  21. package/esm2022/lib/modules/selection-modal/types/selection-modal-instance.mjs +45 -0
  22. package/esm2022/lib/modules/shared/sky-lookup-resources.module.mjs +71 -0
  23. package/esm2022/testing/autocomplete/autocomplete-harness.mjs +155 -0
  24. package/esm2022/testing/autocomplete/autocomplete-input-harness.mjs +63 -0
  25. package/esm2022/testing/autocomplete/autocomplete-search-result-harness.mjs +44 -0
  26. package/esm2022/testing/country-field/country-field-fixture.mjs +118 -0
  27. package/{esm2020 → esm2022}/testing/country-field/country-field-testing.module.mjs +5 -5
  28. package/esm2022/testing/lookup/lookup-harness.mjs +76 -0
  29. package/{esm2020 → esm2022}/testing/search/search-fixture.mjs +18 -19
  30. package/esm2022/testing/search/search-harness.mjs +80 -0
  31. package/{esm2020 → esm2022}/testing/search/search-testing.module.mjs +5 -5
  32. package/esm2022/testing/selection-modal/selection-modal-harness.mjs +122 -0
  33. package/{fesm2020 → fesm2022}/skyux-lookup-testing.mjs +171 -187
  34. package/{fesm2020 → fesm2022}/skyux-lookup-testing.mjs.map +1 -1
  35. package/fesm2022/skyux-lookup.mjs +3707 -0
  36. package/{fesm2015 → fesm2022}/skyux-lookup.mjs.map +1 -1
  37. package/lib/modules/autocomplete/autocomplete-input.directive.d.ts +1 -1
  38. package/lib/modules/autocomplete/autocomplete.component.d.ts +1 -1
  39. package/lib/modules/country-field/country-field.component.d.ts +1 -1
  40. package/lib/modules/lookup/lookup-autocomplete-adapter.d.ts +1 -1
  41. package/lib/modules/lookup/lookup.component.d.ts +1 -1
  42. package/lib/modules/search/search.component.d.ts +1 -1
  43. package/package.json +23 -31
  44. package/esm2020/lib/modules/autocomplete/autocomplete-adapter.service.mjs +0 -64
  45. package/esm2020/lib/modules/autocomplete/autocomplete-input.directive.mjs +0 -235
  46. package/esm2020/lib/modules/autocomplete/autocomplete.component.mjs +0 -775
  47. package/esm2020/lib/modules/country-field/country-field.component.mjs +0 -433
  48. package/esm2020/lib/modules/lookup/lookup-autocomplete-adapter.mjs +0 -115
  49. package/esm2020/lib/modules/lookup/lookup-show-more-modal.component.mjs +0 -271
  50. package/esm2020/lib/modules/search/search-adapter.service.mjs +0 -46
  51. package/esm2020/lib/modules/search/search.component.mjs +0 -279
  52. package/esm2020/lib/modules/selection-modal/selection-modal.component.mjs +0 -199
  53. package/esm2020/lib/modules/selection-modal/selection-modal.service.mjs +0 -92
  54. package/esm2020/lib/modules/selection-modal/types/selection-modal-instance.mjs +0 -48
  55. package/esm2020/lib/modules/shared/sky-lookup-resources.module.mjs +0 -71
  56. package/esm2020/testing/autocomplete/autocomplete-harness.mjs +0 -161
  57. package/esm2020/testing/autocomplete/autocomplete-input-harness.mjs +0 -63
  58. package/esm2020/testing/autocomplete/autocomplete-search-result-harness.mjs +0 -44
  59. package/esm2020/testing/country-field/country-field-fixture.mjs +0 -114
  60. package/esm2020/testing/lookup/lookup-harness.mjs +0 -82
  61. package/esm2020/testing/search/search-harness.mjs +0 -86
  62. package/esm2020/testing/selection-modal/selection-modal-harness.mjs +0 -128
  63. package/fesm2015/skyux-lookup-testing.mjs +0 -980
  64. package/fesm2015/skyux-lookup-testing.mjs.map +0 -1
  65. package/fesm2015/skyux-lookup.mjs +0 -3642
  66. package/fesm2020/skyux-lookup.mjs +0 -3625
  67. package/fesm2020/skyux-lookup.mjs.map +0 -1
  68. /package/{esm2020 → esm2022}/index.mjs +0 -0
  69. /package/{esm2020 → esm2022}/lib/modules/autocomplete/autocomplete-default-search-function.mjs +0 -0
  70. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-default-search-function-options.mjs +0 -0
  71. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-input-text-change.mjs +0 -0
  72. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-message-type.mjs +0 -0
  73. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-message.mjs +0 -0
  74. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-args.mjs +0 -0
  75. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-async-args.mjs +0 -0
  76. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-async-function.mjs +0 -0
  77. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-async-result-display-type.mjs +0 -0
  78. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-async-result.mjs +0 -0
  79. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-context.mjs +0 -0
  80. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-function-filter.mjs +0 -0
  81. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-function-response.mjs +0 -0
  82. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-search-function.mjs +0 -0
  83. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-selection-change.mjs +0 -0
  84. /package/{esm2020 → esm2022}/lib/modules/autocomplete/types/autocomplete-show-more-args.mjs +0 -0
  85. /package/{esm2020 → esm2022}/lib/modules/country-field/types/country-field-context-token.mjs +0 -0
  86. /package/{esm2020 → esm2022}/lib/modules/country-field/types/country-field-context.mjs +0 -0
  87. /package/{esm2020 → esm2022}/lib/modules/country-field/types/country.mjs +0 -0
  88. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-add-click-callback-args.mjs +0 -0
  89. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-add-click-event-args.mjs +0 -0
  90. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-select-mode-type.mjs +0 -0
  91. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-select-mode.mjs +0 -0
  92. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-config.mjs +0 -0
  93. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-custom-picker-context.mjs +0 -0
  94. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-custom-picker.mjs +0 -0
  95. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-native-picker-config.mjs +0 -0
  96. /package/{esm2020 → esm2022}/lib/modules/lookup/types/lookup-show-more-native-picker-context.mjs +0 -0
  97. /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-add-click-callback-args.mjs +0 -0
  98. /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-add-click-event-args.mjs +0 -0
  99. /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-close-args.mjs +0 -0
  100. /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-context.mjs +0 -0
  101. /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-open-args.mjs +0 -0
  102. /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-result.mjs +0 -0
  103. /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-search-args.mjs +0 -0
  104. /package/{esm2020 → esm2022}/lib/modules/selection-modal/types/selection-modal-search-result.mjs +0 -0
  105. /package/{esm2020 → esm2022}/lib/modules/shared/sky-lookup-string-utils.mjs +0 -0
  106. /package/{esm2020 → esm2022}/skyux-lookup.mjs +0 -0
  107. /package/{esm2020 → esm2022}/testing/autocomplete/autocomplete-harness-filters.mjs +0 -0
  108. /package/{esm2020 → esm2022}/testing/autocomplete/autocomplete-search-result-harness-filters.mjs +0 -0
  109. /package/{esm2020 → esm2022}/testing/lookup/lookup-harness-filters.mjs +0 -0
  110. /package/{esm2020 → esm2022}/testing/lookup/lookup-selection-harness-filters.mjs +0 -0
  111. /package/{esm2020 → esm2022}/testing/lookup/lookup-selection-harness.mjs +0 -0
  112. /package/{esm2020 → esm2022}/testing/lookup/lookup-selections-list-harness.mjs +0 -0
  113. /package/{esm2020 → esm2022}/testing/lookup/lookup-show-more-picker-harness-filters.mjs +0 -0
  114. /package/{esm2020 → esm2022}/testing/lookup/lookup-show-more-picker-harness.mjs +0 -0
  115. /package/{esm2020 → esm2022}/testing/lookup/lookup-show-more-picker-search-result-harness-filters.mjs +0 -0
  116. /package/{esm2020 → esm2022}/testing/lookup/lookup-show-more-picker-search-result-harness.mjs +0 -0
  117. /package/{esm2020 → esm2022}/testing/public-api.mjs +0 -0
  118. /package/{esm2020 → esm2022}/testing/search/search-harness-filters.mjs +0 -0
  119. /package/{esm2020 → esm2022}/testing/selection-modal/selection-modal-search-result-harness-filters.mjs +0 -0
  120. /package/{esm2020 → esm2022}/testing/selection-modal/selection-modal-search-result-harness.mjs +0 -0
  121. /package/{esm2020 → esm2022}/testing/skyux-lookup-testing.mjs +0 -0
@@ -0,0 +1,3707 @@
1
+ import * as i4 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { NgModule, forwardRef, Directive, Input, Pipe, Injectable, EventEmitter, TemplateRef, ElementRef, Component, ChangeDetectionStrategy, Optional, Inject, Output, ContentChild, ViewChild, InjectionToken, inject, ViewEncapsulation, Self } from '@angular/core';
5
+ import * as i5$1 from '@angular/forms';
6
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule, NgModel, UntypedFormControl, NgControl, ReactiveFormsModule } from '@angular/forms';
7
+ import * as i1 from '@skyux/core';
8
+ import { SkyAffixAutoFitContext, SKY_STACKING_CONTEXT, SkyAffixModule, SkyIdModule, SkyNumericModule, SkyOverlayModule, SkyMediaBreakpoints, SkyViewkeeperModule } from '@skyux/core';
9
+ import * as i6 from '@skyux/indicators';
10
+ import { SkyTextHighlightModule, SkyIconModule, SkyWaitModule, SkyTokensMessageType, SkyTokensModule } from '@skyux/indicators';
11
+ import * as i8 from '@skyux/theme';
12
+ import { SkyThemeModule } from '@skyux/theme';
13
+ import * as i4$1 from '@skyux/i18n';
14
+ import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
15
+ import { Subject, fromEvent, of, from } from 'rxjs';
16
+ import { takeUntil, debounceTime, switchMap, delay, take, map, distinctUntilChanged } from 'rxjs/operators';
17
+ import * as i5 from '@skyux/forms';
18
+ import { SkyInputBoxModule, SkyCheckboxModule } from '@skyux/forms';
19
+ import 'intl-tel-input';
20
+ import * as i10 from '@skyux/layout';
21
+ import { SkyToolbarModule } from '@skyux/layout';
22
+ import * as i7 from '@skyux/lists';
23
+ import { SkyInfiniteScrollModule, SkyRepeaterModule } from '@skyux/lists';
24
+ import * as i1$1 from '@skyux/modals';
25
+ import { SkyModalModule } from '@skyux/modals';
26
+ import { trigger, state, style, transition, animate } from '@angular/animations';
27
+
28
+ /**
29
+ * NOTICE: DO NOT MODIFY THIS FILE!
30
+ * The contents of this file were automatically generated by
31
+ * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-lookup' schematic.
32
+ * To update this file, simply rerun the command.
33
+ */
34
+ const RESOURCES = {
35
+ 'EN-US': {
36
+ skyux_autocomplete_add: { message: 'New' },
37
+ skyux_autocomplete_no_results: { message: 'No matches found' },
38
+ skyux_autocomplete_show_all: { message: 'Show all' },
39
+ skyux_autocomplete_show_all_count: { message: 'Show all {0}' },
40
+ skyux_autocomplete_show_matches_count: { message: 'Show matches ({0})' },
41
+ skyux_country_field_search_placeholder: { message: 'Search for a country' },
42
+ skyux_lookup_search_button_show_more: {
43
+ message: 'Show all search results',
44
+ },
45
+ skyux_lookup_show_more_add: { message: 'New' },
46
+ skyux_lookup_show_more_select_all_button_title: { message: 'Select all' },
47
+ skyux_lookup_show_more_clear_all_button_title: { message: 'Clear all' },
48
+ skyux_lookup_show_more_show_selected_option_title: {
49
+ message: 'Show only selected items',
50
+ },
51
+ skyux_lookup_show_more_cancel: { message: 'Cancel' },
52
+ skyux_lookup_show_more_modal_title_single: { message: 'Select an option' },
53
+ skyux_lookup_show_more_modal_title_multiple: { message: 'Select options' },
54
+ skyux_lookup_show_more_no_results: { message: 'No matches found' },
55
+ skyux_lookup_show_more_select: { message: 'Select' },
56
+ skyux_lookup_tokens_summary: { message: '{0} items selected' },
57
+ skyux_search_dismiss: { message: 'Dismiss search' },
58
+ skyux_search_label: { message: 'Search items' },
59
+ skyux_search_open: { message: 'Open search' },
60
+ skyux_search_placeholder: { message: 'Find in this list' },
61
+ },
62
+ };
63
+ class SkyLookupResourcesProvider {
64
+ getString(localeInfo, name) {
65
+ return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
66
+ }
67
+ }
68
+ /**
69
+ * Import into any component library module that needs to use resource strings.
70
+ */
71
+ class SkyLookupResourcesModule {
72
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
73
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupResourcesModule, exports: [SkyI18nModule] }); }
74
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupResourcesModule, providers: [
75
+ {
76
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
77
+ useClass: SkyLookupResourcesProvider,
78
+ multi: true,
79
+ },
80
+ ], imports: [SkyI18nModule] }); }
81
+ }
82
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupResourcesModule, decorators: [{
83
+ type: NgModule,
84
+ args: [{
85
+ exports: [SkyI18nModule],
86
+ providers: [
87
+ {
88
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
89
+ useClass: SkyLookupResourcesProvider,
90
+ multi: true,
91
+ },
92
+ ],
93
+ }]
94
+ }] });
95
+
96
+ const SKY_AUTOCOMPLETE_VALUE_ACCESSOR = {
97
+ provide: NG_VALUE_ACCESSOR,
98
+ useExisting: forwardRef(() => SkyAutocompleteInputDirective),
99
+ multi: true,
100
+ };
101
+ const SKY_AUTOCOMPLETE_VALIDATOR = {
102
+ provide: NG_VALIDATORS,
103
+ useExisting: forwardRef(() => SkyAutocompleteInputDirective),
104
+ multi: true,
105
+ };
106
+ class SkyAutocompleteInputDirective {
107
+ /**
108
+ * The value for the `autocomplete` attribute on the form input.
109
+ * @default "off"
110
+ */
111
+ set autocompleteAttribute(value) {
112
+ if (!value) {
113
+ this.#_autocompleteAttribute = 'off';
114
+ }
115
+ else {
116
+ this.#_autocompleteAttribute = value;
117
+ }
118
+ this.#renderer.setAttribute(this.#elementRef.nativeElement, 'autocomplete', this.#_autocompleteAttribute);
119
+ }
120
+ get autocompleteAttribute() {
121
+ return this.#_autocompleteAttribute || 'off';
122
+ }
123
+ /**
124
+ * Whether to disable the autocomplete field on template-driven forms. Don't use this input on reactive forms because they may overwrite the input or leave the control out of sync.
125
+ * To set the disabled state on reactive forms, use the `FormControl` instead.
126
+ * @default false
127
+ */
128
+ set disabled(value) {
129
+ this.#_disabled = value ?? false;
130
+ this.#renderer.setProperty(this.#elementRef.nativeElement, 'disabled', value);
131
+ }
132
+ get disabled() {
133
+ return this.#_disabled;
134
+ }
135
+ get blur() {
136
+ return this.#blurObs;
137
+ }
138
+ get displayWith() {
139
+ return this.#_displayWith;
140
+ }
141
+ set displayWith(value) {
142
+ this.#_displayWith = value;
143
+ this.inputTextValue = this.#getValueByKey();
144
+ }
145
+ get focus() {
146
+ return this.#focusObs;
147
+ }
148
+ get inputTextValue() {
149
+ return this.#elementRef.nativeElement.value;
150
+ }
151
+ set inputTextValue(value) {
152
+ this.#elementRef.nativeElement.value = value || '';
153
+ }
154
+ get textChanges() {
155
+ return this.#textChangesObs;
156
+ }
157
+ get value() {
158
+ return this.#_value;
159
+ }
160
+ set value(value) {
161
+ const isNewValue = value !== this.#_value;
162
+ /* istanbul ignore else */
163
+ if (isNewValue) {
164
+ this.#_value = value;
165
+ this.inputTextValue = this.#getValueByKey();
166
+ this.onChange(this.#_value);
167
+ // Do not mark the field as "dirty"
168
+ // if the field has been initialized with a value.
169
+ if (this.#isFirstChange && this.#control) {
170
+ this.#control.markAsPristine();
171
+ }
172
+ if (this.#isFirstChange && this.#_value) {
173
+ this.#isFirstChange = false;
174
+ }
175
+ }
176
+ }
177
+ #blur;
178
+ #blurObs;
179
+ #control;
180
+ #elementRef;
181
+ #focus;
182
+ #focusObs;
183
+ #isFirstChange;
184
+ #ngUnsubscribe;
185
+ #renderer;
186
+ #textChanges;
187
+ #textChangesObs;
188
+ #_autocompleteAttribute;
189
+ #_disabled;
190
+ #_displayWith;
191
+ #_value;
192
+ constructor(elementRef, renderer) {
193
+ this.#isFirstChange = true;
194
+ this.#ngUnsubscribe = new Subject();
195
+ this.#_disabled = false;
196
+ this.#_displayWith = '';
197
+ // istanbul ignore next
198
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
199
+ this.onValidatorChange = () => { };
200
+ this.#elementRef = elementRef;
201
+ this.#renderer = renderer;
202
+ this.#blur = new Subject();
203
+ this.#focus = new Subject();
204
+ this.#textChanges = new Subject();
205
+ this.#blurObs = this.#blur.asObservable();
206
+ this.#focusObs = this.#focus.asObservable();
207
+ this.#textChangesObs = this.#textChanges.asObservable();
208
+ }
209
+ ngOnInit() {
210
+ const element = this.#elementRef.nativeElement;
211
+ this.#setAttributes(this.#elementRef);
212
+ fromEvent(element, 'input')
213
+ .pipe(takeUntil(this.#ngUnsubscribe))
214
+ .subscribe(() => {
215
+ if (!this.disabled) {
216
+ this.#textChanges.next({
217
+ value: this.#elementRef.nativeElement.value,
218
+ });
219
+ }
220
+ });
221
+ fromEvent(element, 'blur')
222
+ .pipe(takeUntil(this.#ngUnsubscribe))
223
+ .subscribe(() => {
224
+ if (!this.disabled) {
225
+ this.#blur.next();
226
+ }
227
+ });
228
+ fromEvent(element, 'focus')
229
+ .pipe(takeUntil(this.#ngUnsubscribe))
230
+ .subscribe(() => {
231
+ if (!this.disabled) {
232
+ this.#focus.next();
233
+ }
234
+ });
235
+ fromEvent(element, 'change')
236
+ .pipe(takeUntil(this.#ngUnsubscribe))
237
+ .subscribe(() => {
238
+ /* istanbul ignore else */
239
+ if (!this.disabled) {
240
+ this.#isFirstChange = false;
241
+ }
242
+ });
243
+ }
244
+ ngOnDestroy() {
245
+ this.#blur.complete();
246
+ this.#textChanges.complete();
247
+ this.#ngUnsubscribe.next();
248
+ this.#ngUnsubscribe.complete();
249
+ }
250
+ writeValue(value) {
251
+ this.value = value;
252
+ }
253
+ registerOnChange(fn) {
254
+ this.onChange = fn;
255
+ }
256
+ registerOnTouched(fn) {
257
+ this.onTouched = fn;
258
+ }
259
+ registerOnValidatorChange(fn) {
260
+ this.onValidatorChange = fn;
261
+ }
262
+ restoreInputTextValueToPreviousState() {
263
+ const modelValue = this.#getValueByKey();
264
+ // If the search field contains text, make sure that the value
265
+ // matches the selected descriptor key.
266
+ if (this.inputTextValue !== modelValue) {
267
+ this.inputTextValue = modelValue;
268
+ }
269
+ this.onTouched();
270
+ }
271
+ setDisabledState(disabled) {
272
+ this.disabled = disabled;
273
+ }
274
+ validate(control) {
275
+ if (!this.#control) {
276
+ this.#control = control;
277
+ }
278
+ return null;
279
+ }
280
+ // See: https://www.w3.org/TR/wai-aria-practices/#kbd_focus_activedescendant
281
+ setActiveDescendant(descendantId) {
282
+ if (descendantId) {
283
+ this.#renderer.setAttribute(this.#elementRef.nativeElement, 'aria-activedescendant', descendantId);
284
+ }
285
+ else {
286
+ this.#renderer.removeAttribute(this.#elementRef.nativeElement, 'aria-activedescendant');
287
+ }
288
+ }
289
+ setAriaOwns(overlayId) {
290
+ if (overlayId) {
291
+ this.#renderer.setAttribute(this.#elementRef.nativeElement, 'aria-owns', overlayId);
292
+ }
293
+ else {
294
+ this.#renderer.removeAttribute(this.#elementRef.nativeElement, 'aria-owns');
295
+ }
296
+ }
297
+ // Angular automatically constructs these methods.
298
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
299
+ onChange(value) { }
300
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
301
+ onTouched() { }
302
+ #setAttributes(elementRef) {
303
+ const element = elementRef.nativeElement;
304
+ this.#renderer.setAttribute(element, 'autocomplete', this.autocompleteAttribute);
305
+ this.#renderer.setAttribute(element, 'autocapitalize', 'none');
306
+ this.#renderer.setAttribute(element, 'autocorrect', 'off');
307
+ this.#renderer.setAttribute(element, 'spellcheck', 'false');
308
+ this.#renderer.addClass(element, 'sky-form-control');
309
+ }
310
+ #getValueByKey() {
311
+ return this.value ? this.value[this.displayWith] : undefined;
312
+ }
313
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteInputDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
314
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.7", type: SkyAutocompleteInputDirective, selector: "input[skyAutocomplete], textarea[skyAutocomplete]", inputs: { autocompleteAttribute: "autocompleteAttribute", disabled: "disabled" }, providers: [SKY_AUTOCOMPLETE_VALUE_ACCESSOR, SKY_AUTOCOMPLETE_VALIDATOR], ngImport: i0 }); }
315
+ }
316
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteInputDirective, decorators: [{
317
+ type: Directive,
318
+ args: [{
319
+ selector: 'input[skyAutocomplete], textarea[skyAutocomplete]',
320
+ providers: [SKY_AUTOCOMPLETE_VALUE_ACCESSOR, SKY_AUTOCOMPLETE_VALIDATOR],
321
+ }]
322
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { autocompleteAttribute: [{
323
+ type: Input
324
+ }], disabled: [{
325
+ type: Input
326
+ }] } });
327
+
328
+ /**
329
+ * @internal
330
+ */
331
+ class SkyAutocompleteSearchAsyncDisabledPipe {
332
+ transform(searchAsync, searchAsyncDisabled) {
333
+ return searchAsyncDisabled || searchAsync.observers.length === 0;
334
+ }
335
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteSearchAsyncDisabledPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
336
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteSearchAsyncDisabledPipe, name: "skyAutocompleteSearchAsyncDisabled" }); }
337
+ }
338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteSearchAsyncDisabledPipe, decorators: [{
339
+ type: Pipe,
340
+ args: [{
341
+ name: 'skyAutocompleteSearchAsyncDisabled',
342
+ }]
343
+ }] });
344
+
345
+ /**
346
+ * Removes diacritical characters from strings and replaces them with their normalized equivalent.
347
+ * For example: è becomes e, Å becomes A.
348
+ */
349
+ function normalizeDiacritics(value) {
350
+ return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
351
+ }
352
+
353
+ /**
354
+ * @internal
355
+ */
356
+ class SkyAutocompleteAdapterService {
357
+ #coreAdapterService;
358
+ #renderer;
359
+ constructor(coreAdapterService, rendererFactory) {
360
+ this.#coreAdapterService = coreAdapterService;
361
+ this.#renderer = rendererFactory.createRenderer(undefined, null);
362
+ }
363
+ /**
364
+ * Adds the className for the provided element.
365
+ */
366
+ addCSSClass(element, className) {
367
+ /* Sanity check */
368
+ /* istanbul ignore else */
369
+ if (element) {
370
+ this.#renderer.addClass(element, className);
371
+ }
372
+ }
373
+ getOverlayFocusableElements(overlay) {
374
+ return this.#coreAdapterService.getFocusableChildren(
375
+ /* Sanity check - calling function also has null check */
376
+ /* istanbul ignore next */
377
+ overlay?.componentRef.location.nativeElement, { ignoreTabIndex: true });
378
+ }
379
+ /**
380
+ * Removes the className for the provided element.
381
+ */
382
+ removeCSSClass(element, className) {
383
+ /* Sanity check */
384
+ /* istanbul ignore else */
385
+ if (element) {
386
+ this.#renderer.removeClass(element, className);
387
+ }
388
+ }
389
+ setDropdownWidth(elementRef, dropdownRef, isInputBox) {
390
+ const parentElement = isInputBox
391
+ ? elementRef.nativeElement.closest('.sky-input-box')
392
+ : elementRef.nativeElement;
393
+ if (parentElement) {
394
+ const width = parentElement.getBoundingClientRect().width;
395
+ this.#renderer.setStyle(dropdownRef.nativeElement, 'width', `${width}px`);
396
+ }
397
+ }
398
+ /**
399
+ * Sets the `tabIndex` of the `element` to the provided `tabIndex`.
400
+ */
401
+ setTabIndex(element, tabIndex) {
402
+ element.tabIndex = tabIndex;
403
+ }
404
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteAdapterService, deps: [{ token: i1.SkyCoreAdapterService }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable }); }
405
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteAdapterService }); }
406
+ }
407
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteAdapterService, decorators: [{
408
+ type: Injectable
409
+ }], ctorParameters: function () { return [{ type: i1.SkyCoreAdapterService }, { type: i0.RendererFactory2 }]; } });
410
+
411
+ function skyAutocompleteDefaultSearchFunction(options) {
412
+ const filterData = function (searchText, data, args) {
413
+ return data.filter((item) => {
414
+ if (!options.searchFilters || !options.searchFilters.length) {
415
+ return true;
416
+ }
417
+ // Find the first failing filter (we can skip the others if one fails).
418
+ const failedFilter = options.searchFilters.find((filter) => {
419
+ return !filter.call({}, searchText, item, args);
420
+ });
421
+ return failedFilter === undefined;
422
+ });
423
+ };
424
+ const search = function (searchText, data, args) {
425
+ const results = [];
426
+ /* Sanity check - autocomplete will not call search with empty search text */
427
+ /* istanbul ignore if */
428
+ if (!searchText) {
429
+ return results;
430
+ }
431
+ const searchTextNormalized = normalizeDiacritics(searchText).toUpperCase();
432
+ const filteredData = filterData(searchText, data, args);
433
+ for (let i = 0, n = filteredData.length; i < n; i++) {
434
+ const result = filteredData[i];
435
+ const isMatch = options.propertiesToSearch.find((property) => {
436
+ let value = (result[property] || '').toString();
437
+ value = normalizeDiacritics(value).toUpperCase();
438
+ return value.indexOf(searchTextNormalized) > -1;
439
+ });
440
+ if (isMatch) {
441
+ results.push(result);
442
+ }
443
+ }
444
+ return results;
445
+ };
446
+ return search;
447
+ }
448
+
449
+ /**
450
+ * @internal
451
+ */
452
+ var SkyAutocompleteMessageType;
453
+ (function (SkyAutocompleteMessageType) {
454
+ /**
455
+ * Closes the dropdown.
456
+ */
457
+ SkyAutocompleteMessageType[SkyAutocompleteMessageType["CloseDropdown"] = 0] = "CloseDropdown";
458
+ /**
459
+ * Repositions the dropdown.
460
+ */
461
+ SkyAutocompleteMessageType[SkyAutocompleteMessageType["RepositionDropdown"] = 1] = "RepositionDropdown";
462
+ })(SkyAutocompleteMessageType || (SkyAutocompleteMessageType = {}));
463
+
464
+ let uniqueId$1 = 0;
465
+ class SkyAutocompleteComponent {
466
+ /**
467
+ * The static data source for the autocomplete component to search
468
+ * when users enter text. For a dynamic data source such as an array that
469
+ * changes due to server calls, use `search` or `searchAsync` instead.
470
+ */
471
+ set data(value) {
472
+ this.#_data = value ?? [];
473
+ }
474
+ get data() {
475
+ return this.#_data;
476
+ }
477
+ /**
478
+ * How many milliseconds to wait before searching while users
479
+ * enter text in the autocomplete field.
480
+ * @default 0
481
+ */
482
+ set debounceTime(value) {
483
+ this.#_debounceTime = value ?? 0;
484
+ }
485
+ get debounceTime() {
486
+ return this.#_debounceTime;
487
+ }
488
+ /**
489
+ * The object property to display in the text input after users
490
+ * select an item in the dropdown list.
491
+ * @default "name"
492
+ */
493
+ set descriptorProperty(value) {
494
+ this.#_descriptorProperty = value || 'name';
495
+ }
496
+ get descriptorProperty() {
497
+ return this.#_descriptorProperty;
498
+ }
499
+ /**
500
+ * The observable of `SkyAutocompleteMessage` that can close the dropdown.
501
+ * @internal
502
+ */
503
+ set messageStream(value) {
504
+ this.#_messageStream = value ?? new Subject();
505
+ this.#initMessageStream();
506
+ }
507
+ get messageStream() {
508
+ return this.#_messageStream;
509
+ }
510
+ /**
511
+ * The object properties to search.
512
+ * @default ["name"]
513
+ * @deprecated We recommend against using this property. To search specific properties, use the `searchAsync` event instead.
514
+ */
515
+ set propertiesToSearch(value) {
516
+ this.#_propertiesToSearch = value ?? ['name'];
517
+ this.#updateDefaultSearchOptions();
518
+ }
519
+ get propertiesToSearch() {
520
+ return this.#_propertiesToSearch;
521
+ }
522
+ /**
523
+ * The function that dynamically manages the data source when users
524
+ * change the text in the autocomplete field. The search function must return
525
+ * an array or a promise of an array. The `search` property is particularly
526
+ * useful when the data source does not live in the source code.
527
+ * @deprecated We recommend against using this property. To call a remote data source, use the `searchAsync` event instead.
528
+ */
529
+ set search(value) {
530
+ this.#_search = value;
531
+ this.searchOrDefault =
532
+ value ||
533
+ skyAutocompleteDefaultSearchFunction({
534
+ propertiesToSearch: this.propertiesToSearch,
535
+ searchFilters: this.searchFilters,
536
+ });
537
+ }
538
+ get search() {
539
+ return this.#_search;
540
+ }
541
+ /**
542
+ * The minimum number of characters that users must enter before
543
+ * the autocomplete component searches the data source and displays search
544
+ * results in the dropdown list.
545
+ * @default 1
546
+ */
547
+ set searchTextMinimumCharacters(value) {
548
+ this.#_searchTextMinimumCharacters = value && value > 0 ? value : 1;
549
+ }
550
+ get searchTextMinimumCharacters() {
551
+ return this.#_searchTextMinimumCharacters;
552
+ }
553
+ /**
554
+ * The array of functions to call against each search result in order
555
+ * to filter the search results when using the default search function. When
556
+ * using the `search` property to specify a custom search function, you must
557
+ * manually apply filters inside that function. The function must return `true`
558
+ * or `false` for each result to indicate whether to display it in the dropdown list.
559
+ * @deprecated We recommend against using this property. To filter results, use the `searchAsync` event instead.
560
+ */
561
+ set searchFilters(value) {
562
+ this.#_searchFilters = value;
563
+ this.#updateDefaultSearchOptions();
564
+ }
565
+ get searchFilters() {
566
+ return this.#_searchFilters;
567
+ }
568
+ /**
569
+ * The maximum number of search results to display in the dropdown list.
570
+ * By default, the component displays all matching results.
571
+ */
572
+ set searchResultsLimit(value) {
573
+ this.#_searchResultsLimit = value || 0;
574
+ }
575
+ get searchResultsLimit() {
576
+ return this.#_searchResultsLimit;
577
+ }
578
+ //#endregion
579
+ //#region template_properties
580
+ get searchResults() {
581
+ return this.#_searchResults || [];
582
+ }
583
+ set searchResults(value) {
584
+ this.#_searchResults = value;
585
+ }
586
+ get highlightText() {
587
+ return this.#_highlightText || [];
588
+ }
589
+ set highlightText(value) {
590
+ this.#_highlightText = value;
591
+ }
592
+ get showActionsArea() {
593
+ return !!this.showAddButton || !!this.enableShowMore;
594
+ }
595
+ //#endregion
596
+ set inputDirective(directive) {
597
+ if (!directive) {
598
+ throw Error([
599
+ 'The SkyAutocompleteComponent requires a ContentChild input or',
600
+ 'textarea bound with the SkyAutocomplete directive. For example:',
601
+ '`<input type="text" skyAutocomplete>`.',
602
+ ].join(' '));
603
+ }
604
+ if (this.#_inputDirective !== directive) {
605
+ // Unsubscribe from old subscriptions on any previous input directive
606
+ this.#inputDirectiveUnsubscribe.next();
607
+ this.#_inputDirective = directive;
608
+ this.#_inputDirective.displayWith = this.descriptorProperty;
609
+ this.#_inputDirective.textChanges
610
+ .pipe(takeUntil(this.#inputDirectiveUnsubscribe), debounceTime(this.debounceTime), switchMap((change) => {
611
+ this.isSearchingAsync = true;
612
+ return of(change);
613
+ }))
614
+ .subscribe((change) => {
615
+ this.#searchTextChanged(change.value);
616
+ });
617
+ // We delay this listener by 25ms to give things watching the value time to respond (such as the search button).
618
+ this.#_inputDirective.blur
619
+ .pipe(delay(25), takeUntil(this.#inputDirectiveUnsubscribe))
620
+ .subscribe(() => {
621
+ directive.restoreInputTextValueToPreviousState();
622
+ this.#closeDropdown();
623
+ this.#cancelCurrentSearch();
624
+ directive.onTouched();
625
+ this.#hasFocus = false;
626
+ });
627
+ this.#_inputDirective.focus
628
+ .pipe(takeUntil(this.#inputDirectiveUnsubscribe))
629
+ .subscribe(() => {
630
+ this.#hasFocus = true;
631
+ if (this.showActionsArea) {
632
+ this.#openDropdown();
633
+ }
634
+ });
635
+ }
636
+ }
637
+ get inputDirective() {
638
+ return this.#_inputDirective;
639
+ }
640
+ set resultsRef(value) {
641
+ if (value) {
642
+ this.#_resultsRef = value;
643
+ this.#destroyAffixer();
644
+ this.#createAffixer();
645
+ }
646
+ }
647
+ get resultsRef() {
648
+ return this.#_resultsRef;
649
+ }
650
+ /**
651
+ * Index that indicates which descendant of the overlay currently has focus.
652
+ */
653
+ #activeElementIndex;
654
+ #adapterService;
655
+ #affixer;
656
+ #affixService;
657
+ #changeDetector;
658
+ #elementRef;
659
+ #hasFocus;
660
+ #inputBoxHostSvc;
661
+ #inputDirectiveUnsubscribe;
662
+ #messageStreamSub;
663
+ #ngUnsubscribe;
664
+ #overlay;
665
+ #overlayService;
666
+ /**
667
+ * Elements within the autocomplete dropdown that are focusable.
668
+ * These are typically the search results and action buttons, but could also be
669
+ * elements provided in the consumer's own template.
670
+ */
671
+ #overlayFocusableElements;
672
+ #currentSearchSub;
673
+ #zIndex;
674
+ #_data;
675
+ #_debounceTime;
676
+ #_descriptorProperty;
677
+ #_highlightText;
678
+ #_inputDirective;
679
+ #_messageStream;
680
+ #_propertiesToSearch;
681
+ #_resultsRef;
682
+ #_search;
683
+ #_searchFilters;
684
+ #_searchResults;
685
+ #_searchResultsLimit;
686
+ #_searchTextMinimumCharacters;
687
+ constructor(changeDetector, elementRef, affixService, adapterService, overlayService, inputBoxHostSvc, stackingContext) {
688
+ /**
689
+ * @internal
690
+ * Whether to display a button in the dropdown that opens a picker where users can view all options.
691
+ */
692
+ this.enableShowMore = false;
693
+ /**
694
+ * @internal
695
+ * Whether to display a button that lets users add options to the data source.
696
+ * @default false
697
+ */
698
+ this.showAddButton = false;
699
+ /**
700
+ * @internal
701
+ * Allows async search to be disabled even when a listener is specified for
702
+ * the `searchAsync` output.
703
+ * @default false
704
+ */
705
+ this.searchAsyncDisabled = false;
706
+ /**
707
+ * @internal
708
+ * Fires when users select the button to add options to the data source.
709
+ */
710
+ this.addClick = new EventEmitter();
711
+ /**
712
+ * @internal
713
+ * Fires when users select the button to view all options.
714
+ */
715
+ this.showMoreClick = new EventEmitter();
716
+ /**
717
+ * Fires when users select items in the dropdown list.
718
+ */
719
+ this.selectionChange = new EventEmitter();
720
+ /**
721
+ * Fires when users enter new search information and allows results to be
722
+ * returned via an observable.
723
+ */
724
+ this.searchAsync = new EventEmitter();
725
+ this.isOpen = false;
726
+ this.searchText = '';
727
+ this.isSearchingAsync = false;
728
+ /**
729
+ * Index that indicates which descendant of the overlay currently has focus.
730
+ */
731
+ this.#activeElementIndex = -1;
732
+ this.#hasFocus = false;
733
+ this.#inputDirectiveUnsubscribe = new Subject();
734
+ this.#ngUnsubscribe = new Subject();
735
+ /**
736
+ * Elements within the autocomplete dropdown that are focusable.
737
+ * These are typically the search results and action buttons, but could also be
738
+ * elements provided in the consumer's own template.
739
+ */
740
+ this.#overlayFocusableElements = [];
741
+ this.#_data = [];
742
+ this.#_debounceTime = 0;
743
+ this.#_descriptorProperty = 'name';
744
+ this.#_messageStream = new Subject();
745
+ this.#_propertiesToSearch = ['name'];
746
+ this.#_searchResultsLimit = 0;
747
+ this.#_searchTextMinimumCharacters = 1;
748
+ this.#changeDetector = changeDetector;
749
+ this.#elementRef = elementRef;
750
+ this.#affixService = affixService;
751
+ this.#adapterService = adapterService;
752
+ this.#overlayService = overlayService;
753
+ this.#inputBoxHostSvc = inputBoxHostSvc;
754
+ this.#zIndex = stackingContext?.zIndex;
755
+ this.searchOrDefault = skyAutocompleteDefaultSearchFunction({
756
+ propertiesToSearch: ['name'],
757
+ searchFilters: undefined,
758
+ });
759
+ const id = ++uniqueId$1;
760
+ this.resultsListId = `sky-autocomplete-list-${id}`;
761
+ this.resultsWrapperId = `sky-autocomplete-wrapper-${id}`;
762
+ }
763
+ ngAfterViewInit() {
764
+ this.#addInputEventListeners();
765
+ }
766
+ ngOnDestroy() {
767
+ this.#cancelCurrentSearch();
768
+ this.#inputDirectiveUnsubscribe.next();
769
+ this.#inputDirectiveUnsubscribe.complete();
770
+ this.#ngUnsubscribe.next();
771
+ this.#ngUnsubscribe.complete();
772
+ this.#destroyAffixer();
773
+ this.#destroyOverlay();
774
+ }
775
+ addButtonClicked() {
776
+ this.addClick.emit();
777
+ if (this.inputDirective) {
778
+ this.inputDirective.restoreInputTextValueToPreviousState();
779
+ }
780
+ this.#closeDropdown();
781
+ }
782
+ handleKeydown(event) {
783
+ /* Sanity check */
784
+ /* istanbul ignore else */
785
+ if (event.key) {
786
+ const key = event.key.toLowerCase();
787
+ const activeElement = this.#getActiveElement();
788
+ const activeElementId = activeElement?.id;
789
+ const targetIsSearchResult = this.searchResults.find((r) => r.elementId === activeElementId);
790
+ switch (key) {
791
+ case 'enter':
792
+ if (targetIsSearchResult) {
793
+ this.#selectSearchResultById(activeElementId);
794
+ if (!this.showActionsArea) {
795
+ this.#closeDropdown();
796
+ }
797
+ else {
798
+ this.#resetSearch();
799
+ }
800
+ }
801
+ else {
802
+ if (activeElement) {
803
+ activeElement.dispatchEvent(new MouseEvent('mousedown'));
804
+ }
805
+ }
806
+ event.preventDefault();
807
+ event.stopPropagation();
808
+ break;
809
+ case 'tab':
810
+ if (targetIsSearchResult) {
811
+ this.#selectSearchResultById(activeElementId);
812
+ }
813
+ else {
814
+ if (this.inputDirective) {
815
+ this.inputDirective.restoreInputTextValueToPreviousState();
816
+ }
817
+ }
818
+ this.#closeDropdown();
819
+ break;
820
+ case 'escape':
821
+ this.#closeDropdown();
822
+ break;
823
+ case 'arrowdown':
824
+ case 'down':
825
+ this.#removeFocusedClass();
826
+ if (this.#activeElementIndex ===
827
+ this.#overlayFocusableElements.length - 1 ||
828
+ this.#activeElementIndex === -1) {
829
+ this.#activeElementIndex = 0;
830
+ }
831
+ else {
832
+ this.#activeElementIndex = this.#activeElementIndex + 1;
833
+ }
834
+ this.#addFocusedClass();
835
+ this.#changeDetector.markForCheck();
836
+ event.preventDefault();
837
+ event.stopPropagation();
838
+ break;
839
+ case 'arrowup':
840
+ case 'up':
841
+ this.#removeFocusedClass();
842
+ if (this.#activeElementIndex <= 0) {
843
+ this.#activeElementIndex =
844
+ this.#overlayFocusableElements.length - 1;
845
+ }
846
+ else {
847
+ this.#activeElementIndex = this.#activeElementIndex - 1;
848
+ }
849
+ this.#addFocusedClass();
850
+ this.#changeDetector.markForCheck();
851
+ event.preventDefault();
852
+ event.stopPropagation();
853
+ break;
854
+ }
855
+ }
856
+ }
857
+ moreButtonClicked() {
858
+ this.showMoreClick.emit({ inputValue: this.searchText });
859
+ if (this.inputDirective) {
860
+ this.inputDirective.restoreInputTextValueToPreviousState();
861
+ }
862
+ this.#closeDropdown();
863
+ }
864
+ onResultMouseDown(id, event) {
865
+ this.#selectSearchResultById(id);
866
+ if (!this.showActionsArea) {
867
+ this.#closeDropdown();
868
+ }
869
+ else {
870
+ this.#resetSearch();
871
+ }
872
+ event.preventDefault();
873
+ event.stopPropagation();
874
+ }
875
+ onResultMouseMove(id) {
876
+ if (id !== this.#activeElementIndex) {
877
+ this.#removeFocusedClass();
878
+ this.#activeElementIndex = id;
879
+ this.#addFocusedClass();
880
+ this.#changeDetector.markForCheck();
881
+ }
882
+ }
883
+ isElementFocused(ref) {
884
+ return ref === this.#overlayFocusableElements[this.#activeElementIndex];
885
+ }
886
+ #searchTextChanged(searchText) {
887
+ if (this.#hasFocus) {
888
+ const isEmpty = !searchText || !searchText.trim() || searchText.match(/^\s+$/);
889
+ if (isEmpty) {
890
+ // Emit selectionChange if value has been cleared.
891
+ /* istanbul ignore else */
892
+ if (this.inputDirective && this.inputDirective.value) {
893
+ this.inputDirective.value = undefined;
894
+ this.selectionChange.emit({
895
+ selectedItem: undefined,
896
+ });
897
+ }
898
+ if (!this.showActionsArea) {
899
+ this.#closeDropdown();
900
+ }
901
+ else {
902
+ this.#resetSearch();
903
+ }
904
+ this.isSearchingAsync = false;
905
+ this.#changeDetector.markForCheck();
906
+ return;
907
+ }
908
+ const isLongEnough = searchText.length >= this.searchTextMinimumCharacters;
909
+ const isDifferent = searchText !== this.searchText;
910
+ this.searchText = searchText.trim();
911
+ if (isLongEnough && isDifferent) {
912
+ this.#cancelCurrentSearch();
913
+ this.#currentSearchSub = this.#performSearch()
914
+ .pipe(take(1))
915
+ .subscribe((result) => {
916
+ const items = result?.items.filter((item) => {
917
+ return item && this.descriptorProperty in item;
918
+ });
919
+ this.isSearchingAsync = false;
920
+ this.searchResults =
921
+ items?.map((r, i) => {
922
+ const result = {
923
+ elementId: `${this.resultsListId}-item-${i}`,
924
+ data: r,
925
+ };
926
+ return result;
927
+ }) || [];
928
+ this.searchResultsCount = result?.totalCount || 0;
929
+ this.highlightText = this.#getHighlightText(this.searchText);
930
+ this.#removeFocusedClass();
931
+ this.#removeActiveDescendant();
932
+ if (this.searchResults.length > 0) {
933
+ this.#activeElementIndex = 0;
934
+ }
935
+ else {
936
+ this.#activeElementIndex = -1;
937
+ }
938
+ this.#changeDetector.markForCheck();
939
+ if (this.isOpen) {
940
+ // Let the results populate in the DOM before recalculating placement.
941
+ setTimeout(() => {
942
+ if (this.#affixer) {
943
+ this.#affixer.reaffix();
944
+ this.#changeDetector.detectChanges();
945
+ this.#initOverlayFocusableElements();
946
+ }
947
+ });
948
+ }
949
+ else {
950
+ this.#openDropdown();
951
+ this.#changeDetector.markForCheck();
952
+ }
953
+ });
954
+ }
955
+ else {
956
+ this.isSearchingAsync = false;
957
+ this.#changeDetector.markForCheck();
958
+ }
959
+ }
960
+ else {
961
+ this.isSearchingAsync = false;
962
+ }
963
+ }
964
+ #performSearch() {
965
+ if (!this.searchAsyncDisabled && this.searchAsync.observers.length > 0) {
966
+ const searchAsyncArgs = {
967
+ displayType: 'popover',
968
+ offset: 0,
969
+ searchText: this.searchText,
970
+ };
971
+ this.searchAsync.emit(searchAsyncArgs);
972
+ return searchAsyncArgs.result || of(undefined);
973
+ }
974
+ const result = this.searchOrDefault(this.searchText, this.data, {
975
+ context: 'popover',
976
+ });
977
+ if (result instanceof Array) {
978
+ return of({
979
+ items: result,
980
+ totalCount: result.length,
981
+ });
982
+ }
983
+ return from(result).pipe(map((items) => {
984
+ return {
985
+ items,
986
+ totalCount: items.length,
987
+ };
988
+ }));
989
+ }
990
+ #cancelCurrentSearch() {
991
+ if (this.#currentSearchSub) {
992
+ this.#currentSearchSub.unsubscribe();
993
+ this.#currentSearchSub = undefined;
994
+ }
995
+ }
996
+ /**
997
+ * Returns the text to highlight based on exact matches, case-insensitive matches, and matches for corresponding diacritical characters (a will match à).
998
+ */
999
+ #getHighlightText(searchText) {
1000
+ const normalizedSearchText = normalizeDiacritics(searchText)
1001
+ .toLocaleUpperCase()
1002
+ .trim();
1003
+ if (!normalizedSearchText) {
1004
+ return [];
1005
+ }
1006
+ let matchesToHighlight = [];
1007
+ for (let i = 0, n = this.searchResults.length; i < n; i++) {
1008
+ const value = this.searchResults[i].data[this.descriptorProperty]
1009
+ .toString()
1010
+ .toLocaleUpperCase();
1011
+ const normalizedDataValue = normalizeDiacritics(value);
1012
+ let offset = 0;
1013
+ let index;
1014
+ while ((index = normalizedDataValue.indexOf(normalizedSearchText, offset)) > -1) {
1015
+ const matchedString = value.slice(index, index + searchText.length);
1016
+ offset = index + searchText.length;
1017
+ matchesToHighlight = matchesToHighlight.concat(matchedString);
1018
+ }
1019
+ }
1020
+ // Remove any duplicates from the array.
1021
+ return [...new Set(matchesToHighlight)];
1022
+ }
1023
+ #selectSearchResultById(id) {
1024
+ const result = this.searchResults.find((r) => r.elementId === id);
1025
+ /* istanbul ignore else */
1026
+ if (result) {
1027
+ const data = result.data;
1028
+ this.searchText = data[this.descriptorProperty];
1029
+ if (this.inputDirective) {
1030
+ this.inputDirective.value = data;
1031
+ }
1032
+ this.selectionChange.emit({
1033
+ selectedItem: data,
1034
+ });
1035
+ }
1036
+ }
1037
+ #openDropdown() {
1038
+ if (!this.#overlay && this.resultsTemplateRef) {
1039
+ const overlay = this.#overlayService.create({
1040
+ enableClose: false,
1041
+ enablePointerEvents: true,
1042
+ wrapperClass: this.wrapperClass,
1043
+ });
1044
+ if (this.#zIndex) {
1045
+ this.#zIndex.pipe(takeUntil(overlay.closed)).subscribe((zIndex) => {
1046
+ overlay.componentRef.instance.zIndex = zIndex.toString(10);
1047
+ });
1048
+ }
1049
+ overlay.attachTemplate(this.resultsTemplateRef);
1050
+ this.#overlay = overlay;
1051
+ this.isOpen = true;
1052
+ this.#changeDetector.markForCheck();
1053
+ this.#updateAriaOwns();
1054
+ this.#initOverlayFocusableElements();
1055
+ }
1056
+ }
1057
+ #closeDropdown() {
1058
+ this.#resetSearch();
1059
+ this.isOpen = false;
1060
+ this.#destroyOverlay();
1061
+ this.#removeActiveDescendant();
1062
+ this.#updateAriaOwns();
1063
+ this.#changeDetector.markForCheck();
1064
+ }
1065
+ #setActiveDescendant() {
1066
+ const activeElement = this.#overlayFocusableElements[this.#activeElementIndex];
1067
+ /* Sanity check */
1068
+ /* istanbul ignore else */
1069
+ if (activeElement && this.inputDirective) {
1070
+ this.inputDirective.setActiveDescendant(activeElement.id);
1071
+ }
1072
+ }
1073
+ #removeActiveDescendant() {
1074
+ if (this.inputDirective) {
1075
+ this.inputDirective.setActiveDescendant(null);
1076
+ }
1077
+ }
1078
+ #updateAriaOwns() {
1079
+ if (this.inputDirective) {
1080
+ this.inputDirective.setAriaOwns(this.#overlay?.id || null);
1081
+ }
1082
+ }
1083
+ #resetSearch() {
1084
+ this.searchResults = [];
1085
+ this.searchText = '';
1086
+ this.highlightText = [];
1087
+ this.#activeElementIndex = -1;
1088
+ this.searchResultsCount = undefined;
1089
+ this.#removeActiveDescendant();
1090
+ this.#initOverlayFocusableElements();
1091
+ this.#changeDetector.markForCheck();
1092
+ }
1093
+ #addInputEventListeners() {
1094
+ const element = this.#elementRef.nativeElement;
1095
+ fromEvent(element, 'keydown')
1096
+ .pipe(takeUntil(this.#ngUnsubscribe))
1097
+ .subscribe((event) => {
1098
+ this.handleKeydown(event);
1099
+ });
1100
+ fromEvent(window, 'resize')
1101
+ .pipe(takeUntil(this.#ngUnsubscribe))
1102
+ .subscribe(() => {
1103
+ /* istanbul ignore else */
1104
+ if (this.isOpen && this.resultsRef) {
1105
+ this.#adapterService.setDropdownWidth(this.#elementRef, this.resultsRef, !!this.#inputBoxHostSvc);
1106
+ }
1107
+ });
1108
+ }
1109
+ #destroyOverlay() {
1110
+ if (this.#overlay) {
1111
+ this.#overlayService.close(this.#overlay);
1112
+ this.#overlay = undefined;
1113
+ }
1114
+ }
1115
+ #createAffixer() {
1116
+ /* Sanity check */
1117
+ /* istanbul ignore else */
1118
+ if (!this.#affixer && this.resultsRef) {
1119
+ const affixer = this.#affixService.createAffixer(this.resultsRef);
1120
+ this.#adapterService.setDropdownWidth(this.#elementRef, this.resultsRef, !!this.#inputBoxHostSvc);
1121
+ affixer.affixTo(this.#elementRef.nativeElement, {
1122
+ autoFitContext: SkyAffixAutoFitContext.Viewport,
1123
+ enableAutoFit: true,
1124
+ isSticky: true,
1125
+ placement: 'below',
1126
+ horizontalAlignment: 'left',
1127
+ });
1128
+ this.#affixer = affixer;
1129
+ }
1130
+ }
1131
+ #destroyAffixer() {
1132
+ if (this.#affixer) {
1133
+ this.#affixer.destroy();
1134
+ this.#affixer = undefined;
1135
+ }
1136
+ }
1137
+ #initMessageStream() {
1138
+ if (this.#messageStreamSub) {
1139
+ this.#messageStreamSub.unsubscribe();
1140
+ this.#messageStreamSub = undefined;
1141
+ }
1142
+ this.#messageStreamSub = this.messageStream.subscribe((message) => {
1143
+ switch (message.type) {
1144
+ case SkyAutocompleteMessageType.CloseDropdown:
1145
+ this.#closeDropdown();
1146
+ break;
1147
+ case SkyAutocompleteMessageType.RepositionDropdown:
1148
+ // Settimeout waits for changes in DOM (e.g., tokens being removed)
1149
+ setTimeout(() => {
1150
+ /* istanbul ignore else */
1151
+ if (this.#affixer) {
1152
+ this.#affixer.reaffix();
1153
+ }
1154
+ });
1155
+ break;
1156
+ }
1157
+ });
1158
+ }
1159
+ #initOverlayFocusableElements() {
1160
+ // Wait for dropdown elements to render.
1161
+ setTimeout(() => {
1162
+ if (this.#overlay) {
1163
+ this.#overlayFocusableElements =
1164
+ this.#adapterService.getOverlayFocusableElements(this.#overlay);
1165
+ this.#overlayFocusableElements.forEach((el) => {
1166
+ this.#adapterService.setTabIndex(el, -1);
1167
+ });
1168
+ this.#addFocusedClass();
1169
+ }
1170
+ });
1171
+ }
1172
+ #getActiveElement() {
1173
+ return this.#overlayFocusableElements[this.#activeElementIndex];
1174
+ }
1175
+ #removeFocusedClass() {
1176
+ if (this.#activeElementIndex > -1) {
1177
+ this.#adapterService.removeCSSClass(this.#overlayFocusableElements[this.#activeElementIndex], 'sky-autocomplete-descendant-focus');
1178
+ }
1179
+ }
1180
+ #addFocusedClass() {
1181
+ if (this.#activeElementIndex > -1) {
1182
+ this.#adapterService.addCSSClass(this.#overlayFocusableElements[this.#activeElementIndex], 'sky-autocomplete-descendant-focus');
1183
+ this.#setActiveDescendant();
1184
+ }
1185
+ }
1186
+ #updateDefaultSearchOptions() {
1187
+ // Reset default search if it is what is being used.
1188
+ if (this.search !== this.searchOrDefault) {
1189
+ this.searchOrDefault = skyAutocompleteDefaultSearchFunction({
1190
+ propertiesToSearch: this.propertiesToSearch,
1191
+ searchFilters: this.searchFilters,
1192
+ });
1193
+ }
1194
+ }
1195
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.SkyAffixService }, { token: SkyAutocompleteAdapterService }, { token: i1.SkyOverlayService }, { token: i5.SkyInputBoxHostService, optional: true }, { token: SKY_STACKING_CONTEXT, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
1196
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyAutocompleteComponent, selector: "sky-autocomplete", inputs: { ariaLabelledBy: "ariaLabelledBy", data: "data", debounceTime: "debounceTime", descriptorProperty: "descriptorProperty", enableShowMore: "enableShowMore", messageStream: "messageStream", wrapperClass: "wrapperClass", propertiesToSearch: "propertiesToSearch", search: "search", searchResultTemplate: "searchResultTemplate", searchTextMinimumCharacters: "searchTextMinimumCharacters", searchFilters: "searchFilters", searchResultsLimit: "searchResultsLimit", showAddButton: "showAddButton", noResultsFoundText: "noResultsFoundText", searchAsyncDisabled: "searchAsyncDisabled" }, outputs: { addClick: "addClick", showMoreClick: "showMoreClick", selectionChange: "selectionChange", searchAsync: "searchAsync" }, providers: [SkyAutocompleteAdapterService], queries: [{ propertyName: "inputDirective", first: true, predicate: SkyAutocompleteInputDirective, descendants: true }], viewQueries: [{ propertyName: "resultsTemplateRef", first: true, predicate: ["resultsTemplateRef"], descendants: true, read: TemplateRef }, { propertyName: "resultsRef", first: true, predicate: ["resultsRef"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n class=\"sky-autocomplete\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.aria-owns]=\"isOpen ? resultsListId : null\"\n [attr.id]=\"resultsWrapperId\"\n>\n <ng-content></ng-content>\n</div>\n\n<ng-template #resultsTemplateRef>\n <div\n class=\"sky-autocomplete-results-container\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-elevation-4': 'modern'\n }\"\n (keydown)=\"handleKeydown($event)\"\n #resultsRef\n >\n <div\n *ngIf=\"isSearchingAsync; else resultControlsTemplateRef\"\n class=\"sky-autocomplete-results-waiting\"\n >\n <sky-wait [isWaiting]=\"true\"></sky-wait>\n </div>\n </div>\n</ng-template>\n\n<ng-template #resultControlsTemplateRef>\n <div\n *ngIf=\"searchText && (!showActionsArea || searchResults.length > 0)\"\n class=\"sky-autocomplete-results\"\n role=\"listbox\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.id]=\"resultsListId\"\n >\n <ng-container *ngFor=\"let result of searchResults; let i = index\">\n <div\n *ngIf=\"\n (!searchResultsLimit || i < searchResultsLimit) &&\n !(enableShowMore && i >= 5)\n \"\n class=\"sky-autocomplete-result\"\n role=\"option\"\n tabindex=\"0\"\n [attr.aria-selected]=\"isElementFocused(searchResultEl)\"\n [attr.data-descriptor-value]=\"result.data[descriptorProperty]\"\n [attr.id]=\"result.elementId\"\n [skyHighlight]=\"highlightText\"\n (mousedown)=\"onResultMouseDown(result.elementId, $event)\"\n (mousemove)=\"onResultMouseMove(i)\"\n #searchResultEl\n >\n <ng-container\n *ngTemplateOutlet=\"\n searchResultTemplate || defaultSearchResultTemplate;\n context: { item: result.data }\n \"\n >\n </ng-container>\n </div>\n </ng-container>\n <div\n *ngIf=\"searchResults.length === 0\"\n class=\"sky-deemphasized sky-padding-squish-default\"\n >\n {{\n noResultsFoundText ||\n ('skyux_autocomplete_no_results' | skyLibResources)\n }}\n </div>\n </div>\n <div *ngIf=\"showActionsArea\" class=\"sky-autocomplete-actions\">\n <button\n *ngIf=\"enableShowMore && (!searchText || searchResults.length > 0)\"\n class=\"sky-autocomplete-action sky-autocomplete-action-more sky-btn sky-btn-link\"\n type=\"button\"\n (mousedown)=\"moreButtonClicked()\"\n >\n <ng-container\n *ngIf=\"\n !(\n searchAsync\n | skyAutocompleteSearchAsyncDisabled : searchAsyncDisabled\n ) &&\n searchResults.length === 0 &&\n !searchText\n \"\n >\n {{ 'skyux_autocomplete_show_all' | skyLibResources }}\n </ng-container>\n <ng-container\n *ngIf=\"\n (searchAsync\n | skyAutocompleteSearchAsyncDisabled : searchAsyncDisabled) &&\n !searchText\n \"\n >\n {{\n 'skyux_autocomplete_show_all_count'\n | skyLibResources : (data.length | skyNumeric : { truncate: false })\n }}\n </ng-container>\n <ng-container *ngIf=\"searchText\">\n {{\n 'skyux_autocomplete_show_matches_count'\n | skyLibResources\n : (searchResultsCount === undefined\n ? data.length\n : (searchResultsCount | skyNumeric : { truncate: false }))\n }}\n </ng-container>\n </button>\n <div\n *ngIf=\"searchText && searchResults.length === 0\"\n class=\"sky-font-deemphasized sky-autocomplete-actions-no-results\"\n >\n {{\n noResultsFoundText ||\n ('skyux_autocomplete_no_results' | skyLibResources)\n }}\n </div>\n <button\n *ngIf=\"showAddButton\"\n class=\"sky-autocomplete-action sky-autocomplete-action-add sky-btn sky-btn-link\"\n tabindex=\"0\"\n type=\"button\"\n [class.focused]=\"isElementFocused(addButtonEl)\"\n (mousedown)=\"addButtonClicked()\"\n #addButtonEl\n >\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"add\" iconType=\"skyux\"></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_autocomplete_add' | skyLibResources }}\n </button>\n </div>\n</ng-template>\n\n<ng-template let-item=\"item\" #defaultSearchResultTemplate>\n {{ item[descriptorProperty] }}\n</ng-template>\n", styles: [".sky-autocomplete-results-container{position:fixed;background-color:#fff}.sky-autocomplete-results-waiting{height:70px}.sky-autocomplete-results{display:flex;flex-direction:column;padding:4px;overflow-y:auto;overflow-x:hidden;min-height:35px;max-height:calc(50vh - 50px)}.sky-autocomplete-result{color:#212327;margin-bottom:4px;padding:3px 20px;cursor:pointer}.sky-autocomplete-result:last-child{margin-bottom:0}.sky-autocomplete-actions{border-top:1px solid #cdcfd2}.sky-autocomplete-actions .sky-autocomplete-action{border:none}.sky-autocomplete-actions .sky-autocomplete-actions-no-results{display:inline-block;padding:7px 13px}.sky-autocomplete-action-add{float:right}.sky-autocomplete-action-add sky-icon{padding-right:5px}.sky-autocomplete-descendant-focus:not(.sky-autocomplete-action){background-color:#eeeeef}.sky-autocomplete-descendant-focus.sky-autocomplete-action{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px}::ng-deep .sky-theme-modern .sky-autocomplete-results-container{border-radius:6px}::ng-deep .sky-theme-modern .sky-autocomplete-results{padding:10px 0}::ng-deep .sky-theme-modern .sky-autocomplete-result{margin-bottom:0;padding:10px 0 10px 15px}::ng-deep .sky-theme-modern .sky-autocomplete-descendant-focus:not(.sky-autocomplete-action){background-color:inherit}::ng-deep .sky-theme-modern .sky-autocomplete-descendant-focus{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 8px #0000004d}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i6.λ11, selector: "[skyHighlight]", inputs: ["skyHighlight"] }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i8.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { kind: "directive", type: i8.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "component", type: i6.λ14, selector: "sky-wait", inputs: ["ariaLabel", "isWaiting", "isFullPage", "isNonBlocking", "screenReaderCompletedText"] }, { kind: "pipe", type: i4$1.SkyLibResourcesPipe, name: "skyLibResources" }, { kind: "pipe", type: i1.SkyNumericPipe, name: "skyNumeric" }, { kind: "pipe", type: SkyAutocompleteSearchAsyncDisabledPipe, name: "skyAutocompleteSearchAsyncDisabled" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1197
+ }
1198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteComponent, decorators: [{
1199
+ type: Component,
1200
+ args: [{ selector: 'sky-autocomplete', providers: [SkyAutocompleteAdapterService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n class=\"sky-autocomplete\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.aria-owns]=\"isOpen ? resultsListId : null\"\n [attr.id]=\"resultsWrapperId\"\n>\n <ng-content></ng-content>\n</div>\n\n<ng-template #resultsTemplateRef>\n <div\n class=\"sky-autocomplete-results-container\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-elevation-4': 'modern'\n }\"\n (keydown)=\"handleKeydown($event)\"\n #resultsRef\n >\n <div\n *ngIf=\"isSearchingAsync; else resultControlsTemplateRef\"\n class=\"sky-autocomplete-results-waiting\"\n >\n <sky-wait [isWaiting]=\"true\"></sky-wait>\n </div>\n </div>\n</ng-template>\n\n<ng-template #resultControlsTemplateRef>\n <div\n *ngIf=\"searchText && (!showActionsArea || searchResults.length > 0)\"\n class=\"sky-autocomplete-results\"\n role=\"listbox\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.id]=\"resultsListId\"\n >\n <ng-container *ngFor=\"let result of searchResults; let i = index\">\n <div\n *ngIf=\"\n (!searchResultsLimit || i < searchResultsLimit) &&\n !(enableShowMore && i >= 5)\n \"\n class=\"sky-autocomplete-result\"\n role=\"option\"\n tabindex=\"0\"\n [attr.aria-selected]=\"isElementFocused(searchResultEl)\"\n [attr.data-descriptor-value]=\"result.data[descriptorProperty]\"\n [attr.id]=\"result.elementId\"\n [skyHighlight]=\"highlightText\"\n (mousedown)=\"onResultMouseDown(result.elementId, $event)\"\n (mousemove)=\"onResultMouseMove(i)\"\n #searchResultEl\n >\n <ng-container\n *ngTemplateOutlet=\"\n searchResultTemplate || defaultSearchResultTemplate;\n context: { item: result.data }\n \"\n >\n </ng-container>\n </div>\n </ng-container>\n <div\n *ngIf=\"searchResults.length === 0\"\n class=\"sky-deemphasized sky-padding-squish-default\"\n >\n {{\n noResultsFoundText ||\n ('skyux_autocomplete_no_results' | skyLibResources)\n }}\n </div>\n </div>\n <div *ngIf=\"showActionsArea\" class=\"sky-autocomplete-actions\">\n <button\n *ngIf=\"enableShowMore && (!searchText || searchResults.length > 0)\"\n class=\"sky-autocomplete-action sky-autocomplete-action-more sky-btn sky-btn-link\"\n type=\"button\"\n (mousedown)=\"moreButtonClicked()\"\n >\n <ng-container\n *ngIf=\"\n !(\n searchAsync\n | skyAutocompleteSearchAsyncDisabled : searchAsyncDisabled\n ) &&\n searchResults.length === 0 &&\n !searchText\n \"\n >\n {{ 'skyux_autocomplete_show_all' | skyLibResources }}\n </ng-container>\n <ng-container\n *ngIf=\"\n (searchAsync\n | skyAutocompleteSearchAsyncDisabled : searchAsyncDisabled) &&\n !searchText\n \"\n >\n {{\n 'skyux_autocomplete_show_all_count'\n | skyLibResources : (data.length | skyNumeric : { truncate: false })\n }}\n </ng-container>\n <ng-container *ngIf=\"searchText\">\n {{\n 'skyux_autocomplete_show_matches_count'\n | skyLibResources\n : (searchResultsCount === undefined\n ? data.length\n : (searchResultsCount | skyNumeric : { truncate: false }))\n }}\n </ng-container>\n </button>\n <div\n *ngIf=\"searchText && searchResults.length === 0\"\n class=\"sky-font-deemphasized sky-autocomplete-actions-no-results\"\n >\n {{\n noResultsFoundText ||\n ('skyux_autocomplete_no_results' | skyLibResources)\n }}\n </div>\n <button\n *ngIf=\"showAddButton\"\n class=\"sky-autocomplete-action sky-autocomplete-action-add sky-btn sky-btn-link\"\n tabindex=\"0\"\n type=\"button\"\n [class.focused]=\"isElementFocused(addButtonEl)\"\n (mousedown)=\"addButtonClicked()\"\n #addButtonEl\n >\n <sky-icon *skyThemeIf=\"'modern'\" icon=\"add\" iconType=\"skyux\"></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_autocomplete_add' | skyLibResources }}\n </button>\n </div>\n</ng-template>\n\n<ng-template let-item=\"item\" #defaultSearchResultTemplate>\n {{ item[descriptorProperty] }}\n</ng-template>\n", styles: [".sky-autocomplete-results-container{position:fixed;background-color:#fff}.sky-autocomplete-results-waiting{height:70px}.sky-autocomplete-results{display:flex;flex-direction:column;padding:4px;overflow-y:auto;overflow-x:hidden;min-height:35px;max-height:calc(50vh - 50px)}.sky-autocomplete-result{color:#212327;margin-bottom:4px;padding:3px 20px;cursor:pointer}.sky-autocomplete-result:last-child{margin-bottom:0}.sky-autocomplete-actions{border-top:1px solid #cdcfd2}.sky-autocomplete-actions .sky-autocomplete-action{border:none}.sky-autocomplete-actions .sky-autocomplete-actions-no-results{display:inline-block;padding:7px 13px}.sky-autocomplete-action-add{float:right}.sky-autocomplete-action-add sky-icon{padding-right:5px}.sky-autocomplete-descendant-focus:not(.sky-autocomplete-action){background-color:#eeeeef}.sky-autocomplete-descendant-focus.sky-autocomplete-action{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px}::ng-deep .sky-theme-modern .sky-autocomplete-results-container{border-radius:6px}::ng-deep .sky-theme-modern .sky-autocomplete-results{padding:10px 0}::ng-deep .sky-theme-modern .sky-autocomplete-result{margin-bottom:0;padding:10px 0 10px 15px}::ng-deep .sky-theme-modern .sky-autocomplete-descendant-focus:not(.sky-autocomplete-action){background-color:inherit}::ng-deep .sky-theme-modern .sky-autocomplete-descendant-focus{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 8px #0000004d}\n"] }]
1201
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.SkyAffixService }, { type: SkyAutocompleteAdapterService }, { type: i1.SkyOverlayService }, { type: i5.SkyInputBoxHostService, decorators: [{
1202
+ type: Optional
1203
+ }] }, { type: undefined, decorators: [{
1204
+ type: Optional
1205
+ }, {
1206
+ type: Inject,
1207
+ args: [SKY_STACKING_CONTEXT]
1208
+ }] }]; }, propDecorators: { ariaLabelledBy: [{
1209
+ type: Input
1210
+ }], data: [{
1211
+ type: Input
1212
+ }], debounceTime: [{
1213
+ type: Input
1214
+ }], descriptorProperty: [{
1215
+ type: Input
1216
+ }], enableShowMore: [{
1217
+ type: Input
1218
+ }], messageStream: [{
1219
+ type: Input
1220
+ }], wrapperClass: [{
1221
+ type: Input
1222
+ }], propertiesToSearch: [{
1223
+ type: Input
1224
+ }], search: [{
1225
+ type: Input
1226
+ }], searchResultTemplate: [{
1227
+ type: Input
1228
+ }], searchTextMinimumCharacters: [{
1229
+ type: Input
1230
+ }], searchFilters: [{
1231
+ type: Input
1232
+ }], searchResultsLimit: [{
1233
+ type: Input
1234
+ }], showAddButton: [{
1235
+ type: Input
1236
+ }], noResultsFoundText: [{
1237
+ type: Input
1238
+ }], searchAsyncDisabled: [{
1239
+ type: Input
1240
+ }], addClick: [{
1241
+ type: Output
1242
+ }], showMoreClick: [{
1243
+ type: Output
1244
+ }], selectionChange: [{
1245
+ type: Output
1246
+ }], searchAsync: [{
1247
+ type: Output
1248
+ }], inputDirective: [{
1249
+ type: ContentChild,
1250
+ args: [SkyAutocompleteInputDirective]
1251
+ }], resultsTemplateRef: [{
1252
+ type: ViewChild,
1253
+ args: ['resultsTemplateRef', {
1254
+ read: TemplateRef,
1255
+ }]
1256
+ }], resultsRef: [{
1257
+ type: ViewChild,
1258
+ args: ['resultsRef', {
1259
+ read: ElementRef,
1260
+ }]
1261
+ }] } });
1262
+
1263
+ class SkyAutocompleteModule {
1264
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1265
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteModule, declarations: [SkyAutocompleteComponent,
1266
+ SkyAutocompleteInputDirective,
1267
+ SkyAutocompleteSearchAsyncDisabledPipe], imports: [CommonModule,
1268
+ FormsModule,
1269
+ SkyAffixModule,
1270
+ SkyTextHighlightModule,
1271
+ SkyIconModule,
1272
+ SkyIdModule,
1273
+ SkyLookupResourcesModule,
1274
+ SkyNumericModule,
1275
+ SkyOverlayModule,
1276
+ SkyThemeModule,
1277
+ SkyWaitModule], exports: [SkyAutocompleteComponent, SkyAutocompleteInputDirective] }); }
1278
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteModule, imports: [CommonModule,
1279
+ FormsModule,
1280
+ SkyAffixModule,
1281
+ SkyTextHighlightModule,
1282
+ SkyIconModule,
1283
+ SkyIdModule,
1284
+ SkyLookupResourcesModule,
1285
+ SkyNumericModule,
1286
+ SkyOverlayModule,
1287
+ SkyThemeModule,
1288
+ SkyWaitModule] }); }
1289
+ }
1290
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyAutocompleteModule, decorators: [{
1291
+ type: NgModule,
1292
+ args: [{
1293
+ declarations: [
1294
+ SkyAutocompleteComponent,
1295
+ SkyAutocompleteInputDirective,
1296
+ SkyAutocompleteSearchAsyncDisabledPipe,
1297
+ ],
1298
+ imports: [
1299
+ CommonModule,
1300
+ FormsModule,
1301
+ SkyAffixModule,
1302
+ SkyTextHighlightModule,
1303
+ SkyIconModule,
1304
+ SkyIdModule,
1305
+ SkyLookupResourcesModule,
1306
+ SkyNumericModule,
1307
+ SkyOverlayModule,
1308
+ SkyThemeModule,
1309
+ SkyWaitModule,
1310
+ ],
1311
+ exports: [SkyAutocompleteComponent, SkyAutocompleteInputDirective],
1312
+ }]
1313
+ }] });
1314
+
1315
+ /**
1316
+ * @internal
1317
+ */
1318
+ const SKY_COUNTRY_FIELD_CONTEXT = new InjectionToken('SkyCountryFieldContext');
1319
+
1320
+ const DEFAULT_COUNTRY_CODE = 'us';
1321
+ const SKY_COUNTRY_FIELD_VALIDATOR = {
1322
+ provide: NG_VALIDATORS,
1323
+ useExisting: forwardRef(() => SkyCountryFieldComponent),
1324
+ multi: true,
1325
+ };
1326
+ let uniqueId = 0;
1327
+ class SkyCountryFieldComponent {
1328
+ /**
1329
+ * The [International Organization for Standardization Alpha 2](https://www.nationsonline.org/oneworld/country_code_list.htm)
1330
+ * country code for the default country.
1331
+ * When search results include the default country, it appears at the top of the list.
1332
+ * @default "us"
1333
+ */
1334
+ set defaultCountry(value) {
1335
+ if (!value) {
1336
+ value = DEFAULT_COUNTRY_CODE;
1337
+ }
1338
+ if (value !== this.#_defaultCountry) {
1339
+ this.#_defaultCountry = value.toLowerCase();
1340
+ this.#defaultCountryData = this.countries.find((country) => country.iso2 === this.#_defaultCountry);
1341
+ this.#sortCountriesWithSelectedAndDefault(this.selectedCountry);
1342
+ }
1343
+ }
1344
+ get defaultCountry() {
1345
+ return this.#_defaultCountry;
1346
+ }
1347
+ /**
1348
+ * Whether to disable the country field on template-driven forms. Don't use this input on reactive forms because they may overwrite the input or leave the control out of sync.
1349
+ * To set the disabled state on reactive forms, use the `FormControl` instead.
1350
+ * @default false
1351
+ */
1352
+ set disabled(isDisabled) {
1353
+ this.#removeEventListeners();
1354
+ if (!isDisabled) {
1355
+ this.#addEventListeners();
1356
+ }
1357
+ this.#_disabled = isDisabled ?? false;
1358
+ if (isDisabled) {
1359
+ this.countrySearchFormControl.disable();
1360
+ }
1361
+ else {
1362
+ this.countrySearchFormControl.enable();
1363
+ }
1364
+ this.#changeDetector.markForCheck();
1365
+ }
1366
+ get disabled() {
1367
+ return this.#_disabled;
1368
+ }
1369
+ /**
1370
+ * Whether to hide the flag in the input element.
1371
+ * @default false
1372
+ */
1373
+ set hideSelectedCountryFlag(value) {
1374
+ this.#_hideSelectedCountryFlag = value ?? false;
1375
+ }
1376
+ get hideSelectedCountryFlag() {
1377
+ return this.#_hideSelectedCountryFlag;
1378
+ }
1379
+ /**
1380
+ * Whether to include phone information in the selected country and country dropdown.
1381
+ * @default false
1382
+ * @internal
1383
+ */
1384
+ set includePhoneInfo(value) {
1385
+ this.#_includePhoneInfo = value ?? false;
1386
+ this.#setupCountries();
1387
+ }
1388
+ get includePhoneInfo() {
1389
+ return this.#_includePhoneInfo;
1390
+ }
1391
+ /**
1392
+ * The [International Organization for Standardization Alpha 2](https://www.nationsonline.org/oneworld/country_code_list.htm)
1393
+ * country codes for the countries that users can select. By default, all countries are available.
1394
+ */
1395
+ set supportedCountryISOs(value) {
1396
+ // Ensure all values are the same case.
1397
+ if (Array.isArray(value)) {
1398
+ value = value.map((v) => v.toLowerCase());
1399
+ }
1400
+ this.#_supportedCountryISOs = value;
1401
+ this.#setupCountries();
1402
+ }
1403
+ get supportedCountryISOs() {
1404
+ return this.#_supportedCountryISOs || [];
1405
+ }
1406
+ set selectedCountry(newCountry) {
1407
+ if (!this.#countriesAreEqual(this.selectedCountry, newCountry)) {
1408
+ const newCountryIso = newCountry && newCountry.iso2;
1409
+ if (newCountryIso) {
1410
+ const isoCountry = this.countries.find((country) => country.iso2 === newCountryIso);
1411
+ if (isoCountry) {
1412
+ newCountry = isoCountry;
1413
+ }
1414
+ }
1415
+ this.#_selectedCountry = newCountry;
1416
+ this.#sortCountriesWithSelectedAndDefault(newCountry);
1417
+ this.#internalFormChange = true;
1418
+ this.countrySearchFormControl.setValue(this.selectedCountry);
1419
+ if (!this.#isInitialChange) {
1420
+ this.onChange(newCountry);
1421
+ this.onTouched();
1422
+ this.selectedCountryChange.emit(newCountry);
1423
+ }
1424
+ // Do not mark the field as "dirty"
1425
+ // if the field has been initialized with a value.
1426
+ if (this.#isInitialChange && this.#ngControl && this.#ngControl.control) {
1427
+ this.#ngControl.control.markAsPristine();
1428
+ }
1429
+ this.#isInitialChange = false;
1430
+ /**
1431
+ * The second portion of this if statement is complex. The control type check ensures that
1432
+ * we only watch for the initial time through this function on reactive forms. However,
1433
+ * template forms will send through `null` and then `undefined` on empty initialization
1434
+ * so we have to check for when the non-null pass through happens.
1435
+ */
1436
+ }
1437
+ else if (this.#isInitialChange &&
1438
+ (!(this.#ngControl instanceof NgModel) || newCountry !== null)) {
1439
+ this.#isInitialChange = false;
1440
+ }
1441
+ }
1442
+ get selectedCountry() {
1443
+ return this.#_selectedCountry;
1444
+ }
1445
+ #changeDetector;
1446
+ #defaultCountryData;
1447
+ #elRef;
1448
+ #idle;
1449
+ #injector;
1450
+ #internalFormChange;
1451
+ #isInitialChange;
1452
+ #ngControl;
1453
+ #ngUnsubscribe;
1454
+ #themeSvc;
1455
+ #windowRef;
1456
+ #_defaultCountry;
1457
+ #_disabled;
1458
+ #_hideSelectedCountryFlag;
1459
+ #_includePhoneInfo;
1460
+ #_selectedCountry;
1461
+ #_supportedCountryISOs;
1462
+ constructor(changeDetector, elRef, windowRef, injector, inputBoxHostSvc, themeSvc) {
1463
+ this.inputBoxHostSvc = inputBoxHostSvc;
1464
+ /**
1465
+ * Fires when the selected country changes.
1466
+ */
1467
+ this.selectedCountryChange = new EventEmitter();
1468
+ this.countries = [];
1469
+ this.isInputFocused = false;
1470
+ this.searchTextMinimumCharacters = 2;
1471
+ this.context = inject(SKY_COUNTRY_FIELD_CONTEXT, {
1472
+ optional: true,
1473
+ });
1474
+ this.currentTheme = 'default';
1475
+ this.#idle = new Subject();
1476
+ this.#internalFormChange = false;
1477
+ this.#isInitialChange = true;
1478
+ this.#ngControl = null;
1479
+ this.#ngUnsubscribe = new Subject();
1480
+ this.#_disabled = false;
1481
+ this.#_hideSelectedCountryFlag = false;
1482
+ this.#_includePhoneInfo = false;
1483
+ // Angular automatically constructs these methods.
1484
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1485
+ this.onChange = (value) => { };
1486
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
1487
+ this.onTouched = () => { };
1488
+ this.#changeDetector = changeDetector;
1489
+ this.#elRef = elRef;
1490
+ this.#windowRef = windowRef;
1491
+ this.#injector = injector;
1492
+ this.#themeSvc = themeSvc;
1493
+ this.inputId = `sky-country-field-input-${uniqueId++}`;
1494
+ this.#setupCountries();
1495
+ this.countrySearchFormControl = new UntypedFormControl();
1496
+ }
1497
+ /**
1498
+ * Angular lifecycle hook for when the component is initialized
1499
+ * @internal
1500
+ */
1501
+ ngOnInit() {
1502
+ this.#updateInputBox();
1503
+ this.#ngControl = this.#injector.get(NgControl, null);
1504
+ if (this.#ngControl) {
1505
+ this.#ngControl.valueAccessor = this;
1506
+ }
1507
+ else {
1508
+ /**
1509
+ * The initial change boolean is to determine if the form is setting the value. When no form
1510
+ * is present we don't want to ignore the first change.
1511
+ */
1512
+ this.#isInitialChange = false;
1513
+ }
1514
+ if (!this.defaultCountry) {
1515
+ this.defaultCountry = DEFAULT_COUNTRY_CODE;
1516
+ }
1517
+ this.countrySearchFormControl.valueChanges
1518
+ .pipe(takeUntil(this.#ngUnsubscribe))
1519
+ .subscribe((newValue) => {
1520
+ if (newValue && !this.#internalFormChange) {
1521
+ this.selectedCountry = newValue;
1522
+ }
1523
+ });
1524
+ if (!this.disabled) {
1525
+ this.#addEventListeners();
1526
+ }
1527
+ }
1528
+ ngAfterViewInit() {
1529
+ /* istanbul ignore else */
1530
+ if (this.#themeSvc) {
1531
+ this.#themeSvc.settingsChange.subscribe((change) => {
1532
+ this.currentTheme = change.currentSettings.theme.name;
1533
+ this.#updateInputBox();
1534
+ this.#changeDetector.markForCheck();
1535
+ });
1536
+ }
1537
+ }
1538
+ /**
1539
+ * Angular lifecycle hook for when the component is destructed.
1540
+ * @internal
1541
+ */
1542
+ ngOnDestroy() {
1543
+ this.selectedCountryChange.complete();
1544
+ this.#removeEventListeners();
1545
+ this.#ngUnsubscribe.next();
1546
+ this.#ngUnsubscribe.complete();
1547
+ }
1548
+ /**
1549
+ * Sets the component's touched value when the autocomplete is blurred
1550
+ * @internal
1551
+ */
1552
+ onAutocompleteBlur() {
1553
+ this.onTouched();
1554
+ }
1555
+ /**
1556
+ * Sets the country to validate against based on the county's iso2 code.
1557
+ * @param newCountry The International Organization for Standardization's two-letter code
1558
+ * for the default country.
1559
+ * @internal
1560
+ */
1561
+ onCountrySelected(newCountry) {
1562
+ if (newCountry.selectedItem) {
1563
+ this.writeValue(this.countries.find((countryInfo) => countryInfo.iso2 === newCountry.selectedItem.iso2));
1564
+ }
1565
+ else {
1566
+ this.writeValue(undefined);
1567
+ }
1568
+ }
1569
+ registerOnChange(fn) {
1570
+ this.onChange = fn;
1571
+ }
1572
+ registerOnTouched(fn) {
1573
+ this.onTouched = fn;
1574
+ }
1575
+ // Allows Angular to disable the input.
1576
+ setDisabledState(disabled) {
1577
+ this.disabled = disabled;
1578
+ }
1579
+ validate(control) {
1580
+ if (control.value) {
1581
+ if ((this.supportedCountryISOs &&
1582
+ this.supportedCountryISOs.length > 0 &&
1583
+ this.supportedCountryISOs.indexOf(control.value.iso2) < 0) ||
1584
+ !this.countries.find((country) => country.iso2 === control.value.iso2)) {
1585
+ return { unsupportedCountry: true };
1586
+ }
1587
+ }
1588
+ return null;
1589
+ }
1590
+ writeValue(value) {
1591
+ this.selectedCountry = value;
1592
+ this.#changeDetector.markForCheck();
1593
+ }
1594
+ #addEventListeners() {
1595
+ this.#removeEventListeners();
1596
+ this.#idle = new Subject();
1597
+ const documentObj = this.#windowRef.nativeWindow.document;
1598
+ fromEvent(documentObj, 'mousedown')
1599
+ .pipe(takeUntil(this.#idle))
1600
+ .subscribe((event) => {
1601
+ this.isInputFocused = this.#elRef.nativeElement.contains(event.target);
1602
+ this.#changeDetector.markForCheck();
1603
+ });
1604
+ fromEvent(documentObj, 'focusin')
1605
+ .pipe(takeUntil(this.#idle))
1606
+ .subscribe((event) => {
1607
+ this.isInputFocused = this.#elRef.nativeElement.contains(event.target);
1608
+ this.#changeDetector.markForCheck();
1609
+ });
1610
+ }
1611
+ #countriesAreEqual(country1, country2) {
1612
+ if (country1 && country2) {
1613
+ return country1.iso2 === country2.iso2;
1614
+ }
1615
+ // NOTE: We are doing this in this way because template forms will send through `null`
1616
+ // and then `undefined` on empty initialization. These are functionally equivalent but will
1617
+ // not pass a standard triple equals check.
1618
+ return !country1 && !country2;
1619
+ }
1620
+ #countriesEqual(a, b) {
1621
+ return a.iso2 === b.iso2 && a.name === b.name;
1622
+ }
1623
+ #removeEventListeners() {
1624
+ this.#idle.next();
1625
+ this.#idle.complete();
1626
+ }
1627
+ #setupCountries() {
1628
+ /**
1629
+ * The json functions here ensures that we get a copy of the array and not the global original.
1630
+ * This ensures that multiple instances of the component don't overwrite the original data.
1631
+ *
1632
+ * We must type the window object as any here as the intl-tel-input library adds its object
1633
+ * to the main window object.
1634
+ */
1635
+ this.countries = JSON.parse(
1636
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1637
+ JSON.stringify(window.intlTelInputGlobals.getCountryData()));
1638
+ // Ignoring coverage here as this will be removed in the next release.
1639
+ // istanbul ignore next
1640
+ if (!this.includePhoneInfo && !this.hideSelectedCountryFlag) {
1641
+ if (this.#elRef.nativeElement.parentElement?.classList?.contains('sky-phone-field-country-search')) {
1642
+ this.includePhoneInfo = true;
1643
+ this.hideSelectedCountryFlag = true;
1644
+ }
1645
+ }
1646
+ /* istanbul ignore else */
1647
+ if (!this.includePhoneInfo) {
1648
+ /**
1649
+ * The library we get the country data from includes extra phone properties.
1650
+ * We want to remove these unless we are in a phone field
1651
+ */
1652
+ this.countries.forEach((country) => {
1653
+ delete country.dialCode;
1654
+ delete country.areaCodes;
1655
+ delete country.priority;
1656
+ });
1657
+ }
1658
+ this.#sortCountriesWithSelectedAndDefault(this.selectedCountry);
1659
+ if (this.supportedCountryISOs && this.supportedCountryISOs.length > 0) {
1660
+ this.countries = this.countries.filter((country) => {
1661
+ return this.supportedCountryISOs.indexOf(country.iso2) >= 0;
1662
+ });
1663
+ }
1664
+ }
1665
+ #sortCountriesWithSelectedAndDefault(selectedCountry) {
1666
+ let selectedCountryIndex;
1667
+ let selectedCountryData;
1668
+ const sortedNewCountries = this.countries.sort((a, b) => {
1669
+ if (((this.#defaultCountryData &&
1670
+ this.#countriesEqual(a, this.#defaultCountryData)) ||
1671
+ (a.name && b.name && a.name < b.name)) &&
1672
+ (!this.#defaultCountryData ||
1673
+ !this.#countriesEqual(this.#defaultCountryData, b))) {
1674
+ return -1;
1675
+ }
1676
+ else {
1677
+ return 1;
1678
+ }
1679
+ });
1680
+ if (selectedCountry) {
1681
+ // Note: We are looking up this data here to ensure we are using the official data from the
1682
+ // library and not the data provided by the user on initialization of the component
1683
+ const foundCountry = this.countries.find((country) => country.iso2 === selectedCountry.iso2.toLocaleLowerCase());
1684
+ if (foundCountry) {
1685
+ selectedCountryData = foundCountry;
1686
+ selectedCountryIndex = this.countries.indexOf(selectedCountryData);
1687
+ if (selectedCountryIndex >= 0) {
1688
+ this.countries.splice(selectedCountryIndex, 1);
1689
+ sortedNewCountries.splice(0, 0, selectedCountryData);
1690
+ }
1691
+ }
1692
+ }
1693
+ this.countries = sortedNewCountries;
1694
+ }
1695
+ #updateInputBox() {
1696
+ if (this.inputBoxHostSvc && this.inputTemplateRef) {
1697
+ this.inputId = this.inputBoxHostSvc.controlId;
1698
+ this.inputBoxHostSvc.populate({
1699
+ inputTemplate: this.inputTemplateRef,
1700
+ iconsInsetTemplate: this.currentTheme === 'modern'
1701
+ ? this.searchIconTemplateRef
1702
+ : undefined,
1703
+ });
1704
+ }
1705
+ }
1706
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.SkyAppWindowRef }, { token: i0.Injector }, { token: i5.SkyInputBoxHostService, optional: true }, { token: i8.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
1707
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyCountryFieldComponent, selector: "sky-country-field", inputs: { autocompleteAttribute: "autocompleteAttribute", defaultCountry: "defaultCountry", disabled: "disabled", hideSelectedCountryFlag: "hideSelectedCountryFlag", includePhoneInfo: "includePhoneInfo", supportedCountryISOs: "supportedCountryISOs" }, outputs: { selectedCountryChange: "selectedCountryChange" }, providers: [SKY_COUNTRY_FIELD_VALIDATOR], viewQueries: [{ propertyName: "countrySearchAutocompleteDirective", first: true, predicate: SkyAutocompleteInputDirective, descendants: true }, { propertyName: "inputTemplateRef", first: true, predicate: ["inputTemplateRef"], descendants: true, read: TemplateRef, static: true }, { propertyName: "searchIconTemplateRef", first: true, predicate: ["searchIconTemplateRef"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<ng-container *ngIf=\"!inputBoxHostSvc\">\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n</ng-container>\n\n<ng-template #inputTemplateRef>\n <span\n class=\"sky-country-field-container\"\n [ngClass]=\"{\n 'sky-country-field-disabled': disabled\n }\"\n >\n <sky-autocomplete\n [ariaLabelledBy]=\"inputId\"\n [data]=\"countries\"\n [propertiesToSearch]=\"['name', 'iso2']\"\n [searchResultTemplate]=\"countrySearchResultTemplate\"\n [searchTextMinimumCharacters]=\"searchTextMinimumCharacters\"\n (selectionChange)=\"onCountrySelected($event)\"\n >\n <div\n class=\"sky-country-field-input\"\n [ngClass]=\"{\n 'sky-country-field-input-with-flag':\n selectedCountry && selectedCountry.iso2 && !hideSelectedCountryFlag\n }\"\n >\n <div\n *ngIf=\"\n selectedCountry && selectedCountry.iso2 && !hideSelectedCountryFlag\n \"\n class=\"sky-country-field-flag\"\n >\n <div\n class=\"iti__flag\"\n [ngClass]=\"'iti__' + selectedCountry.iso2.toLowerCase()\"\n ></div>\n </div>\n <textarea\n class=\"sky-form-control\"\n name=\"selectedCountry\"\n rows=\"1\"\n skyAutocomplete\n [attr.aria-label]=\"\n 'skyux_country_field_search_placeholder' | skyLibResources\n \"\n [attr.id]=\"inputId\"\n [autocompleteAttribute]=\"autocompleteAttribute\"\n [formControl]=\"countrySearchFormControl\"\n [placeholder]=\"\n context?.showPlaceholderText || currentTheme === 'default'\n ? ('skyux_country_field_search_placeholder' | skyLibResources)\n : ''\n \"\n (blur)=\"onAutocompleteBlur()\"\n ></textarea>\n </div>\n </sky-autocomplete>\n </span>\n</ng-template>\n\n<ng-template let-item=\"item\" #countrySearchResultTemplate>\n <div\n class=\"sky-country-field-search-result-flag\"\n [ngClass]=\"'iti__flag iti__' + item.iso2.toLowerCase()\"\n ></div>\n {{ item.name }}\n <span *ngIf=\"includePhoneInfo\" class=\"sky-deemphasized\">\n {{ item.dialCode }}\n </span>\n</ng-template>\n\n<!-- This template should only be used in modern theme input boxes. -->\n<ng-template #searchIconTemplateRef>\n <div class=\"sky-input-group-icon sky-input-box-icon-inset\">\n <sky-icon iconType=\"skyux\" icon=\"search\"></sky-icon>\n </div>\n</ng-template>\n", styles: [".iti{position:relative;display:inline-block}.iti *{box-sizing:border-box;-moz-box-sizing:border-box}.iti__hide{display:none}.iti__v-hide{visibility:hidden}.iti input,.iti input[type=text],.iti input[type=tel]{position:relative;z-index:0;margin-top:0!important;margin-bottom:0!important;padding-right:36px;margin-right:0}.iti__flag-container{position:absolute;top:0;bottom:0;right:0;padding:1px}.iti__selected-flag{z-index:1;position:relative;display:flex;align-items:center;height:100%;padding:0 6px 0 8px}.iti__arrow{margin-left:6px;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid #555}.iti__arrow--up{border-top:none;border-bottom:4px solid #555}.iti__country-list{position:absolute;z-index:2;list-style:none;text-align:left;padding:0;margin:0 0 0 -1px;box-shadow:1px 1px 4px #0003;background-color:#fff;border:1px solid #CCC;white-space:nowrap;max-height:200px;overflow-y:scroll;-webkit-overflow-scrolling:touch}.iti__country-list--dropup{bottom:100%;margin-bottom:-1px}@media (max-width: 500px){.iti__country-list{white-space:normal}}.iti__flag-box{display:inline-block;width:20px}.iti__divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #CCC}.iti__country{padding:5px 10px;outline:none}.iti__dial-code{color:#999}.iti__country.iti__highlight{background-color:#0000000d}.iti__flag-box,.iti__country-name,.iti__dial-code{vertical-align:middle}.iti__flag-box,.iti__country-name{margin-right:6px}.iti--allow-dropdown input,.iti--allow-dropdown input[type=text],.iti--allow-dropdown input[type=tel],.iti--separate-dial-code input,.iti--separate-dial-code input[type=text],.iti--separate-dial-code input[type=tel]{padding-right:6px;padding-left:52px;margin-left:0}.iti--allow-dropdown .iti__flag-container,.iti--separate-dial-code .iti__flag-container{right:auto;left:0}.iti--allow-dropdown .iti__flag-container:hover{cursor:pointer}.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag{background-color:#0000000d}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover{cursor:default}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover .iti__selected-flag,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover .iti__selected-flag{background-color:transparent}.iti--separate-dial-code .iti__selected-flag{background-color:#0000000d}.iti--separate-dial-code .iti__selected-dial-code{margin-left:6px}.iti--container{position:absolute;top:-1000px;left:-1000px;z-index:1060;padding:1px}.iti--container:hover{cursor:pointer}.iti-mobile .iti--container{inset:30px;position:fixed}.iti-mobile .iti__country-list{max-height:100%;width:100%}.iti-mobile .iti__country{padding:10px;line-height:1.5em}.iti__flag{width:20px}.iti__flag.iti__be{width:18px}.iti__flag.iti__ch{width:15px}.iti__flag.iti__mc{width:19px}.iti__flag.iti__ne{width:18px}.iti__flag.iti__np{width:13px}.iti__flag.iti__va{width:15px}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.iti__flag{background-size:5652px 15px}}.iti__flag.iti__ac{height:10px;background-position:0px 0px}.iti__flag.iti__ad{height:14px;background-position:-22px 0px}.iti__flag.iti__ae{height:10px;background-position:-44px 0px}.iti__flag.iti__af{height:14px;background-position:-66px 0px}.iti__flag.iti__ag{height:14px;background-position:-88px 0px}.iti__flag.iti__ai{height:10px;background-position:-110px 0px}.iti__flag.iti__al{height:15px;background-position:-132px 0px}.iti__flag.iti__am{height:10px;background-position:-154px 0px}.iti__flag.iti__ao{height:14px;background-position:-176px 0px}.iti__flag.iti__aq{height:14px;background-position:-198px 0px}.iti__flag.iti__ar{height:13px;background-position:-220px 0px}.iti__flag.iti__as{height:10px;background-position:-242px 0px}.iti__flag.iti__at{height:14px;background-position:-264px 0px}.iti__flag.iti__au{height:10px;background-position:-286px 0px}.iti__flag.iti__aw{height:14px;background-position:-308px 0px}.iti__flag.iti__ax{height:13px;background-position:-330px 0px}.iti__flag.iti__az{height:10px;background-position:-352px 0px}.iti__flag.iti__ba{height:10px;background-position:-374px 0px}.iti__flag.iti__bb{height:14px;background-position:-396px 0px}.iti__flag.iti__bd{height:12px;background-position:-418px 0px}.iti__flag.iti__be{height:15px;background-position:-440px 0px}.iti__flag.iti__bf{height:14px;background-position:-460px 0px}.iti__flag.iti__bg{height:12px;background-position:-482px 0px}.iti__flag.iti__bh{height:12px;background-position:-504px 0px}.iti__flag.iti__bi{height:12px;background-position:-526px 0px}.iti__flag.iti__bj{height:14px;background-position:-548px 0px}.iti__flag.iti__bl{height:14px;background-position:-570px 0px}.iti__flag.iti__bm{height:10px;background-position:-592px 0px}.iti__flag.iti__bn{height:10px;background-position:-614px 0px}.iti__flag.iti__bo{height:14px;background-position:-636px 0px}.iti__flag.iti__bq{height:14px;background-position:-658px 0px}.iti__flag.iti__br{height:14px;background-position:-680px 0px}.iti__flag.iti__bs{height:10px;background-position:-702px 0px}.iti__flag.iti__bt{height:14px;background-position:-724px 0px}.iti__flag.iti__bv{height:15px;background-position:-746px 0px}.iti__flag.iti__bw{height:14px;background-position:-768px 0px}.iti__flag.iti__by{height:10px;background-position:-790px 0px}.iti__flag.iti__bz{height:14px;background-position:-812px 0px}.iti__flag.iti__ca{height:10px;background-position:-834px 0px}.iti__flag.iti__cc{height:10px;background-position:-856px 0px}.iti__flag.iti__cd{height:15px;background-position:-878px 0px}.iti__flag.iti__cf{height:14px;background-position:-900px 0px}.iti__flag.iti__cg{height:14px;background-position:-922px 0px}.iti__flag.iti__ch{height:15px;background-position:-944px 0px}.iti__flag.iti__ci{height:14px;background-position:-961px 0px}.iti__flag.iti__ck{height:10px;background-position:-983px 0px}.iti__flag.iti__cl{height:14px;background-position:-1005px 0px}.iti__flag.iti__cm{height:14px;background-position:-1027px 0px}.iti__flag.iti__cn{height:14px;background-position:-1049px 0px}.iti__flag.iti__co{height:14px;background-position:-1071px 0px}.iti__flag.iti__cp{height:14px;background-position:-1093px 0px}.iti__flag.iti__cr{height:12px;background-position:-1115px 0px}.iti__flag.iti__cu{height:10px;background-position:-1137px 0px}.iti__flag.iti__cv{height:12px;background-position:-1159px 0px}.iti__flag.iti__cw{height:14px;background-position:-1181px 0px}.iti__flag.iti__cx{height:10px;background-position:-1203px 0px}.iti__flag.iti__cy{height:14px;background-position:-1225px 0px}.iti__flag.iti__cz{height:14px;background-position:-1247px 0px}.iti__flag.iti__de{height:12px;background-position:-1269px 0px}.iti__flag.iti__dg{height:10px;background-position:-1291px 0px}.iti__flag.iti__dj{height:14px;background-position:-1313px 0px}.iti__flag.iti__dk{height:15px;background-position:-1335px 0px}.iti__flag.iti__dm{height:10px;background-position:-1357px 0px}.iti__flag.iti__do{height:14px;background-position:-1379px 0px}.iti__flag.iti__dz{height:14px;background-position:-1401px 0px}.iti__flag.iti__ea{height:14px;background-position:-1423px 0px}.iti__flag.iti__ec{height:14px;background-position:-1445px 0px}.iti__flag.iti__ee{height:13px;background-position:-1467px 0px}.iti__flag.iti__eg{height:14px;background-position:-1489px 0px}.iti__flag.iti__eh{height:10px;background-position:-1511px 0px}.iti__flag.iti__er{height:10px;background-position:-1533px 0px}.iti__flag.iti__es{height:14px;background-position:-1555px 0px}.iti__flag.iti__et{height:10px;background-position:-1577px 0px}.iti__flag.iti__eu{height:14px;background-position:-1599px 0px}.iti__flag.iti__fi{height:12px;background-position:-1621px 0px}.iti__flag.iti__fj{height:10px;background-position:-1643px 0px}.iti__flag.iti__fk{height:10px;background-position:-1665px 0px}.iti__flag.iti__fm{height:11px;background-position:-1687px 0px}.iti__flag.iti__fo{height:15px;background-position:-1709px 0px}.iti__flag.iti__fr{height:14px;background-position:-1731px 0px}.iti__flag.iti__ga{height:15px;background-position:-1753px 0px}.iti__flag.iti__gb{height:10px;background-position:-1775px 0px}.iti__flag.iti__gd{height:12px;background-position:-1797px 0px}.iti__flag.iti__ge{height:14px;background-position:-1819px 0px}.iti__flag.iti__gf{height:14px;background-position:-1841px 0px}.iti__flag.iti__gg{height:14px;background-position:-1863px 0px}.iti__flag.iti__gh{height:14px;background-position:-1885px 0px}.iti__flag.iti__gi{height:10px;background-position:-1907px 0px}.iti__flag.iti__gl{height:14px;background-position:-1929px 0px}.iti__flag.iti__gm{height:14px;background-position:-1951px 0px}.iti__flag.iti__gn{height:14px;background-position:-1973px 0px}.iti__flag.iti__gp{height:14px;background-position:-1995px 0px}.iti__flag.iti__gq{height:14px;background-position:-2017px 0px}.iti__flag.iti__gr{height:14px;background-position:-2039px 0px}.iti__flag.iti__gs{height:10px;background-position:-2061px 0px}.iti__flag.iti__gt{height:13px;background-position:-2083px 0px}.iti__flag.iti__gu{height:11px;background-position:-2105px 0px}.iti__flag.iti__gw{height:10px;background-position:-2127px 0px}.iti__flag.iti__gy{height:12px;background-position:-2149px 0px}.iti__flag.iti__hk{height:14px;background-position:-2171px 0px}.iti__flag.iti__hm{height:10px;background-position:-2193px 0px}.iti__flag.iti__hn{height:10px;background-position:-2215px 0px}.iti__flag.iti__hr{height:10px;background-position:-2237px 0px}.iti__flag.iti__ht{height:12px;background-position:-2259px 0px}.iti__flag.iti__hu{height:10px;background-position:-2281px 0px}.iti__flag.iti__ic{height:14px;background-position:-2303px 0px}.iti__flag.iti__id{height:14px;background-position:-2325px 0px}.iti__flag.iti__ie{height:10px;background-position:-2347px 0px}.iti__flag.iti__il{height:15px;background-position:-2369px 0px}.iti__flag.iti__im{height:10px;background-position:-2391px 0px}.iti__flag.iti__in{height:14px;background-position:-2413px 0px}.iti__flag.iti__io{height:10px;background-position:-2435px 0px}.iti__flag.iti__iq{height:14px;background-position:-2457px 0px}.iti__flag.iti__ir{height:12px;background-position:-2479px 0px}.iti__flag.iti__is{height:15px;background-position:-2501px 0px}.iti__flag.iti__it{height:14px;background-position:-2523px 0px}.iti__flag.iti__je{height:12px;background-position:-2545px 0px}.iti__flag.iti__jm{height:10px;background-position:-2567px 0px}.iti__flag.iti__jo{height:10px;background-position:-2589px 0px}.iti__flag.iti__jp{height:14px;background-position:-2611px 0px}.iti__flag.iti__ke{height:14px;background-position:-2633px 0px}.iti__flag.iti__kg{height:12px;background-position:-2655px 0px}.iti__flag.iti__kh{height:13px;background-position:-2677px 0px}.iti__flag.iti__ki{height:10px;background-position:-2699px 0px}.iti__flag.iti__km{height:12px;background-position:-2721px 0px}.iti__flag.iti__kn{height:14px;background-position:-2743px 0px}.iti__flag.iti__kp{height:10px;background-position:-2765px 0px}.iti__flag.iti__kr{height:14px;background-position:-2787px 0px}.iti__flag.iti__kw{height:10px;background-position:-2809px 0px}.iti__flag.iti__ky{height:10px;background-position:-2831px 0px}.iti__flag.iti__kz{height:10px;background-position:-2853px 0px}.iti__flag.iti__la{height:14px;background-position:-2875px 0px}.iti__flag.iti__lb{height:14px;background-position:-2897px 0px}.iti__flag.iti__lc{height:10px;background-position:-2919px 0px}.iti__flag.iti__li{height:12px;background-position:-2941px 0px}.iti__flag.iti__lk{height:10px;background-position:-2963px 0px}.iti__flag.iti__lr{height:11px;background-position:-2985px 0px}.iti__flag.iti__ls{height:14px;background-position:-3007px 0px}.iti__flag.iti__lt{height:12px;background-position:-3029px 0px}.iti__flag.iti__lu{height:12px;background-position:-3051px 0px}.iti__flag.iti__lv{height:10px;background-position:-3073px 0px}.iti__flag.iti__ly{height:10px;background-position:-3095px 0px}.iti__flag.iti__ma{height:14px;background-position:-3117px 0px}.iti__flag.iti__mc{height:15px;background-position:-3139px 0px}.iti__flag.iti__md{height:10px;background-position:-3160px 0px}.iti__flag.iti__me{height:10px;background-position:-3182px 0px}.iti__flag.iti__mf{height:14px;background-position:-3204px 0px}.iti__flag.iti__mg{height:14px;background-position:-3226px 0px}.iti__flag.iti__mh{height:11px;background-position:-3248px 0px}.iti__flag.iti__mk{height:10px;background-position:-3270px 0px}.iti__flag.iti__ml{height:14px;background-position:-3292px 0px}.iti__flag.iti__mm{height:14px;background-position:-3314px 0px}.iti__flag.iti__mn{height:10px;background-position:-3336px 0px}.iti__flag.iti__mo{height:14px;background-position:-3358px 0px}.iti__flag.iti__mp{height:10px;background-position:-3380px 0px}.iti__flag.iti__mq{height:14px;background-position:-3402px 0px}.iti__flag.iti__mr{height:14px;background-position:-3424px 0px}.iti__flag.iti__ms{height:10px;background-position:-3446px 0px}.iti__flag.iti__mt{height:14px;background-position:-3468px 0px}.iti__flag.iti__mu{height:14px;background-position:-3490px 0px}.iti__flag.iti__mv{height:14px;background-position:-3512px 0px}.iti__flag.iti__mw{height:14px;background-position:-3534px 0px}.iti__flag.iti__mx{height:12px;background-position:-3556px 0px}.iti__flag.iti__my{height:10px;background-position:-3578px 0px}.iti__flag.iti__mz{height:14px;background-position:-3600px 0px}.iti__flag.iti__na{height:14px;background-position:-3622px 0px}.iti__flag.iti__nc{height:10px;background-position:-3644px 0px}.iti__flag.iti__ne{height:15px;background-position:-3666px 0px}.iti__flag.iti__nf{height:10px;background-position:-3686px 0px}.iti__flag.iti__ng{height:10px;background-position:-3708px 0px}.iti__flag.iti__ni{height:12px;background-position:-3730px 0px}.iti__flag.iti__nl{height:14px;background-position:-3752px 0px}.iti__flag.iti__no{height:15px;background-position:-3774px 0px}.iti__flag.iti__np{height:15px;background-position:-3796px 0px}.iti__flag.iti__nr{height:10px;background-position:-3811px 0px}.iti__flag.iti__nu{height:10px;background-position:-3833px 0px}.iti__flag.iti__nz{height:10px;background-position:-3855px 0px}.iti__flag.iti__om{height:10px;background-position:-3877px 0px}.iti__flag.iti__pa{height:14px;background-position:-3899px 0px}.iti__flag.iti__pe{height:14px;background-position:-3921px 0px}.iti__flag.iti__pf{height:14px;background-position:-3943px 0px}.iti__flag.iti__pg{height:15px;background-position:-3965px 0px}.iti__flag.iti__ph{height:10px;background-position:-3987px 0px}.iti__flag.iti__pk{height:14px;background-position:-4009px 0px}.iti__flag.iti__pl{height:13px;background-position:-4031px 0px}.iti__flag.iti__pm{height:14px;background-position:-4053px 0px}.iti__flag.iti__pn{height:10px;background-position:-4075px 0px}.iti__flag.iti__pr{height:14px;background-position:-4097px 0px}.iti__flag.iti__ps{height:10px;background-position:-4119px 0px}.iti__flag.iti__pt{height:14px;background-position:-4141px 0px}.iti__flag.iti__pw{height:13px;background-position:-4163px 0px}.iti__flag.iti__py{height:11px;background-position:-4185px 0px}.iti__flag.iti__qa{height:8px;background-position:-4207px 0px}.iti__flag.iti__re{height:14px;background-position:-4229px 0px}.iti__flag.iti__ro{height:14px;background-position:-4251px 0px}.iti__flag.iti__rs{height:14px;background-position:-4273px 0px}.iti__flag.iti__ru{height:14px;background-position:-4295px 0px}.iti__flag.iti__rw{height:14px;background-position:-4317px 0px}.iti__flag.iti__sa{height:14px;background-position:-4339px 0px}.iti__flag.iti__sb{height:10px;background-position:-4361px 0px}.iti__flag.iti__sc{height:10px;background-position:-4383px 0px}.iti__flag.iti__sd{height:10px;background-position:-4405px 0px}.iti__flag.iti__se{height:13px;background-position:-4427px 0px}.iti__flag.iti__sg{height:14px;background-position:-4449px 0px}.iti__flag.iti__sh{height:10px;background-position:-4471px 0px}.iti__flag.iti__si{height:10px;background-position:-4493px 0px}.iti__flag.iti__sj{height:15px;background-position:-4515px 0px}.iti__flag.iti__sk{height:14px;background-position:-4537px 0px}.iti__flag.iti__sl{height:14px;background-position:-4559px 0px}.iti__flag.iti__sm{height:15px;background-position:-4581px 0px}.iti__flag.iti__sn{height:14px;background-position:-4603px 0px}.iti__flag.iti__so{height:14px;background-position:-4625px 0px}.iti__flag.iti__sr{height:14px;background-position:-4647px 0px}.iti__flag.iti__ss{height:10px;background-position:-4669px 0px}.iti__flag.iti__st{height:10px;background-position:-4691px 0px}.iti__flag.iti__sv{height:12px;background-position:-4713px 0px}.iti__flag.iti__sx{height:14px;background-position:-4735px 0px}.iti__flag.iti__sy{height:14px;background-position:-4757px 0px}.iti__flag.iti__sz{height:14px;background-position:-4779px 0px}.iti__flag.iti__ta{height:10px;background-position:-4801px 0px}.iti__flag.iti__tc{height:10px;background-position:-4823px 0px}.iti__flag.iti__td{height:14px;background-position:-4845px 0px}.iti__flag.iti__tf{height:14px;background-position:-4867px 0px}.iti__flag.iti__tg{height:13px;background-position:-4889px 0px}.iti__flag.iti__th{height:14px;background-position:-4911px 0px}.iti__flag.iti__tj{height:10px;background-position:-4933px 0px}.iti__flag.iti__tk{height:10px;background-position:-4955px 0px}.iti__flag.iti__tl{height:10px;background-position:-4977px 0px}.iti__flag.iti__tm{height:14px;background-position:-4999px 0px}.iti__flag.iti__tn{height:14px;background-position:-5021px 0px}.iti__flag.iti__to{height:10px;background-position:-5043px 0px}.iti__flag.iti__tr{height:14px;background-position:-5065px 0px}.iti__flag.iti__tt{height:12px;background-position:-5087px 0px}.iti__flag.iti__tv{height:10px;background-position:-5109px 0px}.iti__flag.iti__tw{height:14px;background-position:-5131px 0px}.iti__flag.iti__tz{height:14px;background-position:-5153px 0px}.iti__flag.iti__ua{height:14px;background-position:-5175px 0px}.iti__flag.iti__ug{height:14px;background-position:-5197px 0px}.iti__flag.iti__um{height:11px;background-position:-5219px 0px}.iti__flag.iti__un{height:14px;background-position:-5241px 0px}.iti__flag.iti__us{height:11px;background-position:-5263px 0px}.iti__flag.iti__uy{height:14px;background-position:-5285px 0px}.iti__flag.iti__uz{height:10px;background-position:-5307px 0px}.iti__flag.iti__va{height:15px;background-position:-5329px 0px}.iti__flag.iti__vc{height:14px;background-position:-5346px 0px}.iti__flag.iti__ve{height:14px;background-position:-5368px 0px}.iti__flag.iti__vg{height:10px;background-position:-5390px 0px}.iti__flag.iti__vi{height:14px;background-position:-5412px 0px}.iti__flag.iti__vn{height:14px;background-position:-5434px 0px}.iti__flag.iti__vu{height:12px;background-position:-5456px 0px}.iti__flag.iti__wf{height:14px;background-position:-5478px 0px}.iti__flag.iti__ws{height:10px;background-position:-5500px 0px}.iti__flag.iti__xk{height:15px;background-position:-5522px 0px}.iti__flag.iti__ye{height:14px;background-position:-5544px 0px}.iti__flag.iti__yt{height:14px;background-position:-5566px 0px}.iti__flag.iti__za{height:14px;background-position:-5588px 0px}.iti__flag.iti__zm{height:14px;background-position:-5610px 0px}.iti__flag.iti__zw{height:10px;background-position:-5632px 0px}.iti__flag{height:15px;box-shadow:0 0 1px #888;background-image:url(../img/flags.png);background-repeat:no-repeat;background-color:#dbdbdb;background-position:20px 0}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.iti__flag{background-image:url(../img/flags@2x.png)}}.iti__flag.iti__np{background-color:transparent}.sky-country-field-country-btn+::ng-deep .sky-form-control{border-left:none}.sky-country-field-container{width:100%}.sky-country-field-search-result-flag{display:inline-block;margin-right:5px}.sky-country-field-flag{display:none}.sky-country-field-disabled .sky-country-field-input{cursor:default;background-color:#cdcfd2}.sky-country-field-disabled .sky-country-field-flag{opacity:.65}.sky-country-field-input{cursor:text;display:flex;position:relative}.sky-country-field-input .sky-country-field-flag{align-items:center;margin-bottom:auto;margin-top:auto;position:absolute;left:13px;height:35px;bottom:0}.sky-country-field-input textarea{overflow:hidden;resize:none;white-space:nowrap}.sky-country-field-input-with-flag .sky-country-field-flag{display:flex}.sky-country-field-input-with-flag .sky-form-control{padding-left:40px}.sky-country-field-country-selected,.sky-country-field-country-default{border-bottom:1px solid #e2e3e4}:host(.ng-invalid.ng-touched) .sky-country-field-input textarea{box-shadow:0 0 8px #ef404499;border:1px solid var(--sky-highlight-color-danger);outline:none}::ng-deep .sky-theme-modern .sky-country-field-disabled .sky-country-field-flag{filter:grayscale(100%)}::ng-deep .sky-theme-modern .sky-input-box .sky-form-group .sky-country-field-input{background-color:transparent;border-radius:6px}::ng-deep .sky-theme-modern .sky-input-box .sky-form-group .sky-country-field-input textarea.sky-form-control{overflow:hidden;resize:none;white-space:nowrap}::ng-deep .sky-theme-modern .sky-input-box .sky-form-group .sky-country-field-input-with-flag .sky-country-field-flag{height:40px;left:15px;opacity:1}::ng-deep .sky-theme-modern .sky-input-box .sky-form-group .sky-country-field-input-with-flag .sky-form-control{padding-left:45px}.iti__flag{max-width:25px;max-height:13px;background-image:url(https://sky.blackbaudcdn.net/static/skyux-public-assets/1.0.0-beta.2/assets/images/intl-tel-input/flags.webp)!important}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.iti__flag .iti__flag{background-image:url(https://sky.blackbaudcdn.net/static/skyux-public-assets/1.0.0-beta.2/assets/images/intl-tel-input/flags@2x.webp)!important}}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: SkyAutocompleteComponent, selector: "sky-autocomplete", inputs: ["ariaLabelledBy", "data", "debounceTime", "descriptorProperty", "enableShowMore", "messageStream", "wrapperClass", "propertiesToSearch", "search", "searchResultTemplate", "searchTextMinimumCharacters", "searchFilters", "searchResultsLimit", "showAddButton", "noResultsFoundText", "searchAsyncDisabled"], outputs: ["addClick", "showMoreClick", "selectionChange", "searchAsync"] }, { kind: "directive", type: SkyAutocompleteInputDirective, selector: "input[skyAutocomplete], textarea[skyAutocomplete]", inputs: ["autocompleteAttribute", "disabled"] }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "pipe", type: i4$1.SkyLibResourcesPipe, name: "skyLibResources" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1708
+ }
1709
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldComponent, decorators: [{
1710
+ type: Component,
1711
+ args: [{ selector: 'sky-country-field', providers: [SKY_COUNTRY_FIELD_VALIDATOR], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"!inputBoxHostSvc\">\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n</ng-container>\n\n<ng-template #inputTemplateRef>\n <span\n class=\"sky-country-field-container\"\n [ngClass]=\"{\n 'sky-country-field-disabled': disabled\n }\"\n >\n <sky-autocomplete\n [ariaLabelledBy]=\"inputId\"\n [data]=\"countries\"\n [propertiesToSearch]=\"['name', 'iso2']\"\n [searchResultTemplate]=\"countrySearchResultTemplate\"\n [searchTextMinimumCharacters]=\"searchTextMinimumCharacters\"\n (selectionChange)=\"onCountrySelected($event)\"\n >\n <div\n class=\"sky-country-field-input\"\n [ngClass]=\"{\n 'sky-country-field-input-with-flag':\n selectedCountry && selectedCountry.iso2 && !hideSelectedCountryFlag\n }\"\n >\n <div\n *ngIf=\"\n selectedCountry && selectedCountry.iso2 && !hideSelectedCountryFlag\n \"\n class=\"sky-country-field-flag\"\n >\n <div\n class=\"iti__flag\"\n [ngClass]=\"'iti__' + selectedCountry.iso2.toLowerCase()\"\n ></div>\n </div>\n <textarea\n class=\"sky-form-control\"\n name=\"selectedCountry\"\n rows=\"1\"\n skyAutocomplete\n [attr.aria-label]=\"\n 'skyux_country_field_search_placeholder' | skyLibResources\n \"\n [attr.id]=\"inputId\"\n [autocompleteAttribute]=\"autocompleteAttribute\"\n [formControl]=\"countrySearchFormControl\"\n [placeholder]=\"\n context?.showPlaceholderText || currentTheme === 'default'\n ? ('skyux_country_field_search_placeholder' | skyLibResources)\n : ''\n \"\n (blur)=\"onAutocompleteBlur()\"\n ></textarea>\n </div>\n </sky-autocomplete>\n </span>\n</ng-template>\n\n<ng-template let-item=\"item\" #countrySearchResultTemplate>\n <div\n class=\"sky-country-field-search-result-flag\"\n [ngClass]=\"'iti__flag iti__' + item.iso2.toLowerCase()\"\n ></div>\n {{ item.name }}\n <span *ngIf=\"includePhoneInfo\" class=\"sky-deemphasized\">\n {{ item.dialCode }}\n </span>\n</ng-template>\n\n<!-- This template should only be used in modern theme input boxes. -->\n<ng-template #searchIconTemplateRef>\n <div class=\"sky-input-group-icon sky-input-box-icon-inset\">\n <sky-icon iconType=\"skyux\" icon=\"search\"></sky-icon>\n </div>\n</ng-template>\n", styles: [".iti{position:relative;display:inline-block}.iti *{box-sizing:border-box;-moz-box-sizing:border-box}.iti__hide{display:none}.iti__v-hide{visibility:hidden}.iti input,.iti input[type=text],.iti input[type=tel]{position:relative;z-index:0;margin-top:0!important;margin-bottom:0!important;padding-right:36px;margin-right:0}.iti__flag-container{position:absolute;top:0;bottom:0;right:0;padding:1px}.iti__selected-flag{z-index:1;position:relative;display:flex;align-items:center;height:100%;padding:0 6px 0 8px}.iti__arrow{margin-left:6px;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid #555}.iti__arrow--up{border-top:none;border-bottom:4px solid #555}.iti__country-list{position:absolute;z-index:2;list-style:none;text-align:left;padding:0;margin:0 0 0 -1px;box-shadow:1px 1px 4px #0003;background-color:#fff;border:1px solid #CCC;white-space:nowrap;max-height:200px;overflow-y:scroll;-webkit-overflow-scrolling:touch}.iti__country-list--dropup{bottom:100%;margin-bottom:-1px}@media (max-width: 500px){.iti__country-list{white-space:normal}}.iti__flag-box{display:inline-block;width:20px}.iti__divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #CCC}.iti__country{padding:5px 10px;outline:none}.iti__dial-code{color:#999}.iti__country.iti__highlight{background-color:#0000000d}.iti__flag-box,.iti__country-name,.iti__dial-code{vertical-align:middle}.iti__flag-box,.iti__country-name{margin-right:6px}.iti--allow-dropdown input,.iti--allow-dropdown input[type=text],.iti--allow-dropdown input[type=tel],.iti--separate-dial-code input,.iti--separate-dial-code input[type=text],.iti--separate-dial-code input[type=tel]{padding-right:6px;padding-left:52px;margin-left:0}.iti--allow-dropdown .iti__flag-container,.iti--separate-dial-code .iti__flag-container{right:auto;left:0}.iti--allow-dropdown .iti__flag-container:hover{cursor:pointer}.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag{background-color:#0000000d}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover{cursor:default}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover .iti__selected-flag,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover .iti__selected-flag{background-color:transparent}.iti--separate-dial-code .iti__selected-flag{background-color:#0000000d}.iti--separate-dial-code .iti__selected-dial-code{margin-left:6px}.iti--container{position:absolute;top:-1000px;left:-1000px;z-index:1060;padding:1px}.iti--container:hover{cursor:pointer}.iti-mobile .iti--container{inset:30px;position:fixed}.iti-mobile .iti__country-list{max-height:100%;width:100%}.iti-mobile .iti__country{padding:10px;line-height:1.5em}.iti__flag{width:20px}.iti__flag.iti__be{width:18px}.iti__flag.iti__ch{width:15px}.iti__flag.iti__mc{width:19px}.iti__flag.iti__ne{width:18px}.iti__flag.iti__np{width:13px}.iti__flag.iti__va{width:15px}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.iti__flag{background-size:5652px 15px}}.iti__flag.iti__ac{height:10px;background-position:0px 0px}.iti__flag.iti__ad{height:14px;background-position:-22px 0px}.iti__flag.iti__ae{height:10px;background-position:-44px 0px}.iti__flag.iti__af{height:14px;background-position:-66px 0px}.iti__flag.iti__ag{height:14px;background-position:-88px 0px}.iti__flag.iti__ai{height:10px;background-position:-110px 0px}.iti__flag.iti__al{height:15px;background-position:-132px 0px}.iti__flag.iti__am{height:10px;background-position:-154px 0px}.iti__flag.iti__ao{height:14px;background-position:-176px 0px}.iti__flag.iti__aq{height:14px;background-position:-198px 0px}.iti__flag.iti__ar{height:13px;background-position:-220px 0px}.iti__flag.iti__as{height:10px;background-position:-242px 0px}.iti__flag.iti__at{height:14px;background-position:-264px 0px}.iti__flag.iti__au{height:10px;background-position:-286px 0px}.iti__flag.iti__aw{height:14px;background-position:-308px 0px}.iti__flag.iti__ax{height:13px;background-position:-330px 0px}.iti__flag.iti__az{height:10px;background-position:-352px 0px}.iti__flag.iti__ba{height:10px;background-position:-374px 0px}.iti__flag.iti__bb{height:14px;background-position:-396px 0px}.iti__flag.iti__bd{height:12px;background-position:-418px 0px}.iti__flag.iti__be{height:15px;background-position:-440px 0px}.iti__flag.iti__bf{height:14px;background-position:-460px 0px}.iti__flag.iti__bg{height:12px;background-position:-482px 0px}.iti__flag.iti__bh{height:12px;background-position:-504px 0px}.iti__flag.iti__bi{height:12px;background-position:-526px 0px}.iti__flag.iti__bj{height:14px;background-position:-548px 0px}.iti__flag.iti__bl{height:14px;background-position:-570px 0px}.iti__flag.iti__bm{height:10px;background-position:-592px 0px}.iti__flag.iti__bn{height:10px;background-position:-614px 0px}.iti__flag.iti__bo{height:14px;background-position:-636px 0px}.iti__flag.iti__bq{height:14px;background-position:-658px 0px}.iti__flag.iti__br{height:14px;background-position:-680px 0px}.iti__flag.iti__bs{height:10px;background-position:-702px 0px}.iti__flag.iti__bt{height:14px;background-position:-724px 0px}.iti__flag.iti__bv{height:15px;background-position:-746px 0px}.iti__flag.iti__bw{height:14px;background-position:-768px 0px}.iti__flag.iti__by{height:10px;background-position:-790px 0px}.iti__flag.iti__bz{height:14px;background-position:-812px 0px}.iti__flag.iti__ca{height:10px;background-position:-834px 0px}.iti__flag.iti__cc{height:10px;background-position:-856px 0px}.iti__flag.iti__cd{height:15px;background-position:-878px 0px}.iti__flag.iti__cf{height:14px;background-position:-900px 0px}.iti__flag.iti__cg{height:14px;background-position:-922px 0px}.iti__flag.iti__ch{height:15px;background-position:-944px 0px}.iti__flag.iti__ci{height:14px;background-position:-961px 0px}.iti__flag.iti__ck{height:10px;background-position:-983px 0px}.iti__flag.iti__cl{height:14px;background-position:-1005px 0px}.iti__flag.iti__cm{height:14px;background-position:-1027px 0px}.iti__flag.iti__cn{height:14px;background-position:-1049px 0px}.iti__flag.iti__co{height:14px;background-position:-1071px 0px}.iti__flag.iti__cp{height:14px;background-position:-1093px 0px}.iti__flag.iti__cr{height:12px;background-position:-1115px 0px}.iti__flag.iti__cu{height:10px;background-position:-1137px 0px}.iti__flag.iti__cv{height:12px;background-position:-1159px 0px}.iti__flag.iti__cw{height:14px;background-position:-1181px 0px}.iti__flag.iti__cx{height:10px;background-position:-1203px 0px}.iti__flag.iti__cy{height:14px;background-position:-1225px 0px}.iti__flag.iti__cz{height:14px;background-position:-1247px 0px}.iti__flag.iti__de{height:12px;background-position:-1269px 0px}.iti__flag.iti__dg{height:10px;background-position:-1291px 0px}.iti__flag.iti__dj{height:14px;background-position:-1313px 0px}.iti__flag.iti__dk{height:15px;background-position:-1335px 0px}.iti__flag.iti__dm{height:10px;background-position:-1357px 0px}.iti__flag.iti__do{height:14px;background-position:-1379px 0px}.iti__flag.iti__dz{height:14px;background-position:-1401px 0px}.iti__flag.iti__ea{height:14px;background-position:-1423px 0px}.iti__flag.iti__ec{height:14px;background-position:-1445px 0px}.iti__flag.iti__ee{height:13px;background-position:-1467px 0px}.iti__flag.iti__eg{height:14px;background-position:-1489px 0px}.iti__flag.iti__eh{height:10px;background-position:-1511px 0px}.iti__flag.iti__er{height:10px;background-position:-1533px 0px}.iti__flag.iti__es{height:14px;background-position:-1555px 0px}.iti__flag.iti__et{height:10px;background-position:-1577px 0px}.iti__flag.iti__eu{height:14px;background-position:-1599px 0px}.iti__flag.iti__fi{height:12px;background-position:-1621px 0px}.iti__flag.iti__fj{height:10px;background-position:-1643px 0px}.iti__flag.iti__fk{height:10px;background-position:-1665px 0px}.iti__flag.iti__fm{height:11px;background-position:-1687px 0px}.iti__flag.iti__fo{height:15px;background-position:-1709px 0px}.iti__flag.iti__fr{height:14px;background-position:-1731px 0px}.iti__flag.iti__ga{height:15px;background-position:-1753px 0px}.iti__flag.iti__gb{height:10px;background-position:-1775px 0px}.iti__flag.iti__gd{height:12px;background-position:-1797px 0px}.iti__flag.iti__ge{height:14px;background-position:-1819px 0px}.iti__flag.iti__gf{height:14px;background-position:-1841px 0px}.iti__flag.iti__gg{height:14px;background-position:-1863px 0px}.iti__flag.iti__gh{height:14px;background-position:-1885px 0px}.iti__flag.iti__gi{height:10px;background-position:-1907px 0px}.iti__flag.iti__gl{height:14px;background-position:-1929px 0px}.iti__flag.iti__gm{height:14px;background-position:-1951px 0px}.iti__flag.iti__gn{height:14px;background-position:-1973px 0px}.iti__flag.iti__gp{height:14px;background-position:-1995px 0px}.iti__flag.iti__gq{height:14px;background-position:-2017px 0px}.iti__flag.iti__gr{height:14px;background-position:-2039px 0px}.iti__flag.iti__gs{height:10px;background-position:-2061px 0px}.iti__flag.iti__gt{height:13px;background-position:-2083px 0px}.iti__flag.iti__gu{height:11px;background-position:-2105px 0px}.iti__flag.iti__gw{height:10px;background-position:-2127px 0px}.iti__flag.iti__gy{height:12px;background-position:-2149px 0px}.iti__flag.iti__hk{height:14px;background-position:-2171px 0px}.iti__flag.iti__hm{height:10px;background-position:-2193px 0px}.iti__flag.iti__hn{height:10px;background-position:-2215px 0px}.iti__flag.iti__hr{height:10px;background-position:-2237px 0px}.iti__flag.iti__ht{height:12px;background-position:-2259px 0px}.iti__flag.iti__hu{height:10px;background-position:-2281px 0px}.iti__flag.iti__ic{height:14px;background-position:-2303px 0px}.iti__flag.iti__id{height:14px;background-position:-2325px 0px}.iti__flag.iti__ie{height:10px;background-position:-2347px 0px}.iti__flag.iti__il{height:15px;background-position:-2369px 0px}.iti__flag.iti__im{height:10px;background-position:-2391px 0px}.iti__flag.iti__in{height:14px;background-position:-2413px 0px}.iti__flag.iti__io{height:10px;background-position:-2435px 0px}.iti__flag.iti__iq{height:14px;background-position:-2457px 0px}.iti__flag.iti__ir{height:12px;background-position:-2479px 0px}.iti__flag.iti__is{height:15px;background-position:-2501px 0px}.iti__flag.iti__it{height:14px;background-position:-2523px 0px}.iti__flag.iti__je{height:12px;background-position:-2545px 0px}.iti__flag.iti__jm{height:10px;background-position:-2567px 0px}.iti__flag.iti__jo{height:10px;background-position:-2589px 0px}.iti__flag.iti__jp{height:14px;background-position:-2611px 0px}.iti__flag.iti__ke{height:14px;background-position:-2633px 0px}.iti__flag.iti__kg{height:12px;background-position:-2655px 0px}.iti__flag.iti__kh{height:13px;background-position:-2677px 0px}.iti__flag.iti__ki{height:10px;background-position:-2699px 0px}.iti__flag.iti__km{height:12px;background-position:-2721px 0px}.iti__flag.iti__kn{height:14px;background-position:-2743px 0px}.iti__flag.iti__kp{height:10px;background-position:-2765px 0px}.iti__flag.iti__kr{height:14px;background-position:-2787px 0px}.iti__flag.iti__kw{height:10px;background-position:-2809px 0px}.iti__flag.iti__ky{height:10px;background-position:-2831px 0px}.iti__flag.iti__kz{height:10px;background-position:-2853px 0px}.iti__flag.iti__la{height:14px;background-position:-2875px 0px}.iti__flag.iti__lb{height:14px;background-position:-2897px 0px}.iti__flag.iti__lc{height:10px;background-position:-2919px 0px}.iti__flag.iti__li{height:12px;background-position:-2941px 0px}.iti__flag.iti__lk{height:10px;background-position:-2963px 0px}.iti__flag.iti__lr{height:11px;background-position:-2985px 0px}.iti__flag.iti__ls{height:14px;background-position:-3007px 0px}.iti__flag.iti__lt{height:12px;background-position:-3029px 0px}.iti__flag.iti__lu{height:12px;background-position:-3051px 0px}.iti__flag.iti__lv{height:10px;background-position:-3073px 0px}.iti__flag.iti__ly{height:10px;background-position:-3095px 0px}.iti__flag.iti__ma{height:14px;background-position:-3117px 0px}.iti__flag.iti__mc{height:15px;background-position:-3139px 0px}.iti__flag.iti__md{height:10px;background-position:-3160px 0px}.iti__flag.iti__me{height:10px;background-position:-3182px 0px}.iti__flag.iti__mf{height:14px;background-position:-3204px 0px}.iti__flag.iti__mg{height:14px;background-position:-3226px 0px}.iti__flag.iti__mh{height:11px;background-position:-3248px 0px}.iti__flag.iti__mk{height:10px;background-position:-3270px 0px}.iti__flag.iti__ml{height:14px;background-position:-3292px 0px}.iti__flag.iti__mm{height:14px;background-position:-3314px 0px}.iti__flag.iti__mn{height:10px;background-position:-3336px 0px}.iti__flag.iti__mo{height:14px;background-position:-3358px 0px}.iti__flag.iti__mp{height:10px;background-position:-3380px 0px}.iti__flag.iti__mq{height:14px;background-position:-3402px 0px}.iti__flag.iti__mr{height:14px;background-position:-3424px 0px}.iti__flag.iti__ms{height:10px;background-position:-3446px 0px}.iti__flag.iti__mt{height:14px;background-position:-3468px 0px}.iti__flag.iti__mu{height:14px;background-position:-3490px 0px}.iti__flag.iti__mv{height:14px;background-position:-3512px 0px}.iti__flag.iti__mw{height:14px;background-position:-3534px 0px}.iti__flag.iti__mx{height:12px;background-position:-3556px 0px}.iti__flag.iti__my{height:10px;background-position:-3578px 0px}.iti__flag.iti__mz{height:14px;background-position:-3600px 0px}.iti__flag.iti__na{height:14px;background-position:-3622px 0px}.iti__flag.iti__nc{height:10px;background-position:-3644px 0px}.iti__flag.iti__ne{height:15px;background-position:-3666px 0px}.iti__flag.iti__nf{height:10px;background-position:-3686px 0px}.iti__flag.iti__ng{height:10px;background-position:-3708px 0px}.iti__flag.iti__ni{height:12px;background-position:-3730px 0px}.iti__flag.iti__nl{height:14px;background-position:-3752px 0px}.iti__flag.iti__no{height:15px;background-position:-3774px 0px}.iti__flag.iti__np{height:15px;background-position:-3796px 0px}.iti__flag.iti__nr{height:10px;background-position:-3811px 0px}.iti__flag.iti__nu{height:10px;background-position:-3833px 0px}.iti__flag.iti__nz{height:10px;background-position:-3855px 0px}.iti__flag.iti__om{height:10px;background-position:-3877px 0px}.iti__flag.iti__pa{height:14px;background-position:-3899px 0px}.iti__flag.iti__pe{height:14px;background-position:-3921px 0px}.iti__flag.iti__pf{height:14px;background-position:-3943px 0px}.iti__flag.iti__pg{height:15px;background-position:-3965px 0px}.iti__flag.iti__ph{height:10px;background-position:-3987px 0px}.iti__flag.iti__pk{height:14px;background-position:-4009px 0px}.iti__flag.iti__pl{height:13px;background-position:-4031px 0px}.iti__flag.iti__pm{height:14px;background-position:-4053px 0px}.iti__flag.iti__pn{height:10px;background-position:-4075px 0px}.iti__flag.iti__pr{height:14px;background-position:-4097px 0px}.iti__flag.iti__ps{height:10px;background-position:-4119px 0px}.iti__flag.iti__pt{height:14px;background-position:-4141px 0px}.iti__flag.iti__pw{height:13px;background-position:-4163px 0px}.iti__flag.iti__py{height:11px;background-position:-4185px 0px}.iti__flag.iti__qa{height:8px;background-position:-4207px 0px}.iti__flag.iti__re{height:14px;background-position:-4229px 0px}.iti__flag.iti__ro{height:14px;background-position:-4251px 0px}.iti__flag.iti__rs{height:14px;background-position:-4273px 0px}.iti__flag.iti__ru{height:14px;background-position:-4295px 0px}.iti__flag.iti__rw{height:14px;background-position:-4317px 0px}.iti__flag.iti__sa{height:14px;background-position:-4339px 0px}.iti__flag.iti__sb{height:10px;background-position:-4361px 0px}.iti__flag.iti__sc{height:10px;background-position:-4383px 0px}.iti__flag.iti__sd{height:10px;background-position:-4405px 0px}.iti__flag.iti__se{height:13px;background-position:-4427px 0px}.iti__flag.iti__sg{height:14px;background-position:-4449px 0px}.iti__flag.iti__sh{height:10px;background-position:-4471px 0px}.iti__flag.iti__si{height:10px;background-position:-4493px 0px}.iti__flag.iti__sj{height:15px;background-position:-4515px 0px}.iti__flag.iti__sk{height:14px;background-position:-4537px 0px}.iti__flag.iti__sl{height:14px;background-position:-4559px 0px}.iti__flag.iti__sm{height:15px;background-position:-4581px 0px}.iti__flag.iti__sn{height:14px;background-position:-4603px 0px}.iti__flag.iti__so{height:14px;background-position:-4625px 0px}.iti__flag.iti__sr{height:14px;background-position:-4647px 0px}.iti__flag.iti__ss{height:10px;background-position:-4669px 0px}.iti__flag.iti__st{height:10px;background-position:-4691px 0px}.iti__flag.iti__sv{height:12px;background-position:-4713px 0px}.iti__flag.iti__sx{height:14px;background-position:-4735px 0px}.iti__flag.iti__sy{height:14px;background-position:-4757px 0px}.iti__flag.iti__sz{height:14px;background-position:-4779px 0px}.iti__flag.iti__ta{height:10px;background-position:-4801px 0px}.iti__flag.iti__tc{height:10px;background-position:-4823px 0px}.iti__flag.iti__td{height:14px;background-position:-4845px 0px}.iti__flag.iti__tf{height:14px;background-position:-4867px 0px}.iti__flag.iti__tg{height:13px;background-position:-4889px 0px}.iti__flag.iti__th{height:14px;background-position:-4911px 0px}.iti__flag.iti__tj{height:10px;background-position:-4933px 0px}.iti__flag.iti__tk{height:10px;background-position:-4955px 0px}.iti__flag.iti__tl{height:10px;background-position:-4977px 0px}.iti__flag.iti__tm{height:14px;background-position:-4999px 0px}.iti__flag.iti__tn{height:14px;background-position:-5021px 0px}.iti__flag.iti__to{height:10px;background-position:-5043px 0px}.iti__flag.iti__tr{height:14px;background-position:-5065px 0px}.iti__flag.iti__tt{height:12px;background-position:-5087px 0px}.iti__flag.iti__tv{height:10px;background-position:-5109px 0px}.iti__flag.iti__tw{height:14px;background-position:-5131px 0px}.iti__flag.iti__tz{height:14px;background-position:-5153px 0px}.iti__flag.iti__ua{height:14px;background-position:-5175px 0px}.iti__flag.iti__ug{height:14px;background-position:-5197px 0px}.iti__flag.iti__um{height:11px;background-position:-5219px 0px}.iti__flag.iti__un{height:14px;background-position:-5241px 0px}.iti__flag.iti__us{height:11px;background-position:-5263px 0px}.iti__flag.iti__uy{height:14px;background-position:-5285px 0px}.iti__flag.iti__uz{height:10px;background-position:-5307px 0px}.iti__flag.iti__va{height:15px;background-position:-5329px 0px}.iti__flag.iti__vc{height:14px;background-position:-5346px 0px}.iti__flag.iti__ve{height:14px;background-position:-5368px 0px}.iti__flag.iti__vg{height:10px;background-position:-5390px 0px}.iti__flag.iti__vi{height:14px;background-position:-5412px 0px}.iti__flag.iti__vn{height:14px;background-position:-5434px 0px}.iti__flag.iti__vu{height:12px;background-position:-5456px 0px}.iti__flag.iti__wf{height:14px;background-position:-5478px 0px}.iti__flag.iti__ws{height:10px;background-position:-5500px 0px}.iti__flag.iti__xk{height:15px;background-position:-5522px 0px}.iti__flag.iti__ye{height:14px;background-position:-5544px 0px}.iti__flag.iti__yt{height:14px;background-position:-5566px 0px}.iti__flag.iti__za{height:14px;background-position:-5588px 0px}.iti__flag.iti__zm{height:14px;background-position:-5610px 0px}.iti__flag.iti__zw{height:10px;background-position:-5632px 0px}.iti__flag{height:15px;box-shadow:0 0 1px #888;background-image:url(../img/flags.png);background-repeat:no-repeat;background-color:#dbdbdb;background-position:20px 0}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.iti__flag{background-image:url(../img/flags@2x.png)}}.iti__flag.iti__np{background-color:transparent}.sky-country-field-country-btn+::ng-deep .sky-form-control{border-left:none}.sky-country-field-container{width:100%}.sky-country-field-search-result-flag{display:inline-block;margin-right:5px}.sky-country-field-flag{display:none}.sky-country-field-disabled .sky-country-field-input{cursor:default;background-color:#cdcfd2}.sky-country-field-disabled .sky-country-field-flag{opacity:.65}.sky-country-field-input{cursor:text;display:flex;position:relative}.sky-country-field-input .sky-country-field-flag{align-items:center;margin-bottom:auto;margin-top:auto;position:absolute;left:13px;height:35px;bottom:0}.sky-country-field-input textarea{overflow:hidden;resize:none;white-space:nowrap}.sky-country-field-input-with-flag .sky-country-field-flag{display:flex}.sky-country-field-input-with-flag .sky-form-control{padding-left:40px}.sky-country-field-country-selected,.sky-country-field-country-default{border-bottom:1px solid #e2e3e4}:host(.ng-invalid.ng-touched) .sky-country-field-input textarea{box-shadow:0 0 8px #ef404499;border:1px solid var(--sky-highlight-color-danger);outline:none}::ng-deep .sky-theme-modern .sky-country-field-disabled .sky-country-field-flag{filter:grayscale(100%)}::ng-deep .sky-theme-modern .sky-input-box .sky-form-group .sky-country-field-input{background-color:transparent;border-radius:6px}::ng-deep .sky-theme-modern .sky-input-box .sky-form-group .sky-country-field-input textarea.sky-form-control{overflow:hidden;resize:none;white-space:nowrap}::ng-deep .sky-theme-modern .sky-input-box .sky-form-group .sky-country-field-input-with-flag .sky-country-field-flag{height:40px;left:15px;opacity:1}::ng-deep .sky-theme-modern .sky-input-box .sky-form-group .sky-country-field-input-with-flag .sky-form-control{padding-left:45px}.iti__flag{max-width:25px;max-height:13px;background-image:url(https://sky.blackbaudcdn.net/static/skyux-public-assets/1.0.0-beta.2/assets/images/intl-tel-input/flags.webp)!important}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.iti__flag .iti__flag{background-image:url(https://sky.blackbaudcdn.net/static/skyux-public-assets/1.0.0-beta.2/assets/images/intl-tel-input/flags@2x.webp)!important}}\n"] }]
1712
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.SkyAppWindowRef }, { type: i0.Injector }, { type: i5.SkyInputBoxHostService, decorators: [{
1713
+ type: Optional
1714
+ }] }, { type: i8.SkyThemeService, decorators: [{
1715
+ type: Optional
1716
+ }] }]; }, propDecorators: { autocompleteAttribute: [{
1717
+ type: Input
1718
+ }], defaultCountry: [{
1719
+ type: Input
1720
+ }], disabled: [{
1721
+ type: Input
1722
+ }], hideSelectedCountryFlag: [{
1723
+ type: Input
1724
+ }], includePhoneInfo: [{
1725
+ type: Input
1726
+ }], supportedCountryISOs: [{
1727
+ type: Input
1728
+ }], selectedCountryChange: [{
1729
+ type: Output
1730
+ }], countrySearchAutocompleteDirective: [{
1731
+ type: ViewChild,
1732
+ args: [SkyAutocompleteInputDirective]
1733
+ }], inputTemplateRef: [{
1734
+ type: ViewChild,
1735
+ args: ['inputTemplateRef', {
1736
+ read: TemplateRef,
1737
+ static: true,
1738
+ }]
1739
+ }], searchIconTemplateRef: [{
1740
+ type: ViewChild,
1741
+ args: ['searchIconTemplateRef', {
1742
+ read: TemplateRef,
1743
+ static: true,
1744
+ }]
1745
+ }] } });
1746
+
1747
+ class SkyCountryFieldModule {
1748
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1749
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldModule, declarations: [SkyCountryFieldComponent], imports: [CommonModule,
1750
+ FormsModule,
1751
+ ReactiveFormsModule,
1752
+ SkyAutocompleteModule,
1753
+ SkyIconModule,
1754
+ SkyI18nModule,
1755
+ SkyLookupResourcesModule,
1756
+ SkyThemeModule], exports: [SkyCountryFieldComponent] }); }
1757
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldModule, imports: [CommonModule,
1758
+ FormsModule,
1759
+ ReactiveFormsModule,
1760
+ SkyAutocompleteModule,
1761
+ SkyIconModule,
1762
+ SkyI18nModule,
1763
+ SkyLookupResourcesModule,
1764
+ SkyThemeModule] }); }
1765
+ }
1766
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyCountryFieldModule, decorators: [{
1767
+ type: NgModule,
1768
+ args: [{
1769
+ declarations: [SkyCountryFieldComponent],
1770
+ imports: [
1771
+ CommonModule,
1772
+ FormsModule,
1773
+ ReactiveFormsModule,
1774
+ SkyAutocompleteModule,
1775
+ SkyIconModule,
1776
+ SkyI18nModule,
1777
+ SkyLookupResourcesModule,
1778
+ SkyThemeModule,
1779
+ ],
1780
+ exports: [SkyCountryFieldComponent],
1781
+ }]
1782
+ }] });
1783
+
1784
+ /**
1785
+ * @internal
1786
+ */
1787
+ class SkySearchAdapterService {
1788
+ #renderer;
1789
+ constructor(renderer) {
1790
+ this.#renderer = renderer;
1791
+ }
1792
+ selectInput(searchEl) {
1793
+ this.#getInputEl(searchEl).select();
1794
+ }
1795
+ focusInput(searchEl) {
1796
+ this.#getInputEl(searchEl).focus();
1797
+ }
1798
+ startInputAnimation(searchEl) {
1799
+ const buttonWidth = this.#getSearchOpenButtonEl(searchEl).clientWidth;
1800
+ const offsetWidth = this.#getSearchContainerEl(searchEl).offsetLeft;
1801
+ const minWidth = buttonWidth + offsetWidth;
1802
+ this.#getInputContainerEl(searchEl).style.minWidth =
1803
+ minWidth.toString() + 'px';
1804
+ this.#renderer.setStyle(this.#getInputContainerEl(searchEl), 'min-width', minWidth.toString() + 'px');
1805
+ }
1806
+ endInputAnimation(searchEl) {
1807
+ this.#renderer.setStyle(this.#getInputContainerEl(searchEl), 'min-width', '');
1808
+ }
1809
+ #getInputContainerEl(searchEl) {
1810
+ return searchEl.nativeElement.querySelector('.sky-search-input-container');
1811
+ }
1812
+ #getSearchOpenButtonEl(searchEl) {
1813
+ return searchEl.nativeElement.querySelector('.sky-search-btn-open');
1814
+ }
1815
+ #getSearchContainerEl(searchEl) {
1816
+ return searchEl.nativeElement.querySelector('.sky-search-container');
1817
+ }
1818
+ #getInputEl(searchEl) {
1819
+ return searchEl.nativeElement.querySelector('input');
1820
+ }
1821
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchAdapterService, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Injectable }); }
1822
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchAdapterService }); }
1823
+ }
1824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchAdapterService, decorators: [{
1825
+ type: Injectable
1826
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; } });
1827
+
1828
+ const INPUT_SHOWN_STATE = 'inputShown';
1829
+ const INPUT_HIDDEN_STATE = 'inputHidden';
1830
+ const EXPAND_MODE_RESPONSIVE = 'responsive';
1831
+ const EXPAND_MODE_FIT = 'fit';
1832
+ const EXPAND_MODE_NONE = 'none';
1833
+ class SkySearchComponent {
1834
+ /**
1835
+ * The expand mode for the search input. The valid options
1836
+ * include `"responsive"` to collapse the search input into a button on
1837
+ * mobile devices, `"none"` to *not* collapse the search input on mobile
1838
+ * devices, and `"fit"` to extend the search input to fit the width of its container.
1839
+ * @default "responsive"
1840
+ */
1841
+ set expandMode(value) {
1842
+ this.#_expandMode = value ?? EXPAND_MODE_RESPONSIVE;
1843
+ }
1844
+ get expandMode() {
1845
+ return this.#_expandMode;
1846
+ }
1847
+ /**
1848
+ * How many milliseconds to wait before searching after users enter text in the search input.
1849
+ * @default 0
1850
+ */
1851
+ set debounceTime(value) {
1852
+ this.#_debounceTime = value ?? 0;
1853
+ this.#setupSearchChangedEvent();
1854
+ }
1855
+ get debounceTime() {
1856
+ return this.#_debounceTime;
1857
+ }
1858
+ /**
1859
+ * Whether to disable the filter button.
1860
+ * @default false
1861
+ */
1862
+ set disabled(value) {
1863
+ this.#_disabled = value ?? false;
1864
+ }
1865
+ get disabled() {
1866
+ return this.#_disabled;
1867
+ }
1868
+ #changeRef;
1869
+ #elRef;
1870
+ #mediaQueryService;
1871
+ #searchAdapter;
1872
+ #searchUpdated;
1873
+ #searchUpdatedSub;
1874
+ #_debounceTime;
1875
+ #_disabled;
1876
+ #_expandMode;
1877
+ constructor(mediaQueryService, elRef, searchAdapter, changeRef) {
1878
+ /**
1879
+ * Fires when the search text is applied.
1880
+ */
1881
+ this.searchApply = new EventEmitter();
1882
+ /**
1883
+ * Fires when the search text is changed.
1884
+ */
1885
+ this.searchChange = new EventEmitter();
1886
+ /**
1887
+ * Fires when the search text is cleared.
1888
+ */
1889
+ this.searchClear = new EventEmitter();
1890
+ this.clearButtonShown = false;
1891
+ this.dismissButtonShown = false;
1892
+ this.inputAnimate = INPUT_SHOWN_STATE;
1893
+ this.isCollapsible = true;
1894
+ this.isFullWidth = false;
1895
+ this.mobileSearchShown = false;
1896
+ this.searchButtonShown = false;
1897
+ this.#searchUpdated = new Subject();
1898
+ this.#_debounceTime = 0;
1899
+ this.#_disabled = false;
1900
+ this.#_expandMode = EXPAND_MODE_RESPONSIVE;
1901
+ this.#mediaQueryService = mediaQueryService;
1902
+ this.#elRef = elRef;
1903
+ this.#searchAdapter = searchAdapter;
1904
+ this.#changeRef = changeRef;
1905
+ }
1906
+ ngOnInit() {
1907
+ if (this.#searchShouldCollapse()) {
1908
+ this.breakpointSubscription = this.#mediaQueryService.subscribe((args) => {
1909
+ this.#mediaQueryCallback(args);
1910
+ this.#changeRef.detectChanges();
1911
+ });
1912
+ }
1913
+ this.#setupSearchChangedEvent();
1914
+ }
1915
+ ngOnChanges(changes) {
1916
+ if (this.#expandModeBindingChanged(changes)) {
1917
+ switch (this.expandMode) {
1918
+ case EXPAND_MODE_NONE:
1919
+ this.isCollapsible = false;
1920
+ this.isFullWidth = false;
1921
+ break;
1922
+ case EXPAND_MODE_FIT:
1923
+ this.isCollapsible = false;
1924
+ this.isFullWidth = true;
1925
+ break;
1926
+ default:
1927
+ this.isCollapsible = true;
1928
+ this.isFullWidth = false;
1929
+ break;
1930
+ }
1931
+ }
1932
+ if (this.#searchBindingChanged(changes)) {
1933
+ this.clearButtonShown = !!(this.searchText && this.searchText !== '');
1934
+ if (this.#shouldOpenInput()) {
1935
+ this.inputAnimate = INPUT_SHOWN_STATE;
1936
+ }
1937
+ }
1938
+ this.#changeRef.detectChanges();
1939
+ }
1940
+ clearSearchText() {
1941
+ this.searchText = '';
1942
+ this.clearButtonShown = false;
1943
+ this.#searchAdapter.focusInput(this.#elRef);
1944
+ this.searchChange.emit(this.searchText);
1945
+ this.searchApply.emit(this.searchText);
1946
+ this.searchClear.emit();
1947
+ }
1948
+ enterPress(event, searchText) {
1949
+ if (event.code === 'Enter' || event.code === 'NumpadEnter') {
1950
+ this.applySearchText(searchText);
1951
+ }
1952
+ }
1953
+ applySearchText(searchText) {
1954
+ // Double check that search text is defined before attempting to trim off whitespace
1955
+ if (searchText) {
1956
+ searchText = searchText.trim();
1957
+ }
1958
+ if (searchText !== this.searchText) {
1959
+ this.searchText = searchText;
1960
+ }
1961
+ this.clearButtonShown = !!(searchText && searchText !== '');
1962
+ if (searchText && searchText !== '') {
1963
+ this.#searchAdapter.selectInput(this.#elRef);
1964
+ }
1965
+ this.searchApply.emit(searchText);
1966
+ }
1967
+ searchTextChanged(searchText) {
1968
+ this.searchText = searchText;
1969
+ this.#searchUpdated.next(searchText);
1970
+ }
1971
+ toggleSearchInput(showInput) {
1972
+ if (this.#searchShouldCollapse()) {
1973
+ if (showInput) {
1974
+ this.inputAnimate = INPUT_SHOWN_STATE;
1975
+ }
1976
+ else {
1977
+ this.inputAnimate = INPUT_HIDDEN_STATE;
1978
+ }
1979
+ }
1980
+ }
1981
+ inputAnimationStart(event) {
1982
+ if (this.#searchShouldCollapse()) {
1983
+ this.#searchAdapter.startInputAnimation(this.#elRef);
1984
+ if (event.toState === INPUT_SHOWN_STATE &&
1985
+ this.#mediaQueryService.current === SkyMediaBreakpoints.xs) {
1986
+ this.mobileSearchShown = true;
1987
+ this.searchButtonShown = false;
1988
+ }
1989
+ }
1990
+ }
1991
+ inputAnimationEnd(event) {
1992
+ if (this.#searchShouldCollapse()) {
1993
+ this.#searchAdapter.endInputAnimation(this.#elRef);
1994
+ this.searchButtonShown =
1995
+ event.toState === INPUT_HIDDEN_STATE &&
1996
+ this.#mediaQueryService.current === SkyMediaBreakpoints.xs;
1997
+ if ((event.toState === INPUT_HIDDEN_STATE &&
1998
+ this.#mediaQueryService.current === SkyMediaBreakpoints.xs) ||
1999
+ this.#mediaQueryService.current !== SkyMediaBreakpoints.xs) {
2000
+ this.mobileSearchShown = false;
2001
+ }
2002
+ }
2003
+ }
2004
+ ngOnDestroy() {
2005
+ if (this.breakpointSubscription) {
2006
+ this.breakpointSubscription.unsubscribe();
2007
+ }
2008
+ this.#searchUpdated.complete();
2009
+ this.#searchUpdatedSub?.unsubscribe();
2010
+ }
2011
+ #searchBindingChanged(changes) {
2012
+ return (changes['searchText'] &&
2013
+ changes['searchText'].previousValue !== changes['searchText'].currentValue);
2014
+ }
2015
+ #expandModeBindingChanged(changes) {
2016
+ return (changes['expandMode'] &&
2017
+ changes['expandMode'].previousValue !== changes['expandMode'].currentValue);
2018
+ }
2019
+ #shouldOpenInput() {
2020
+ return (this.searchText !== '' &&
2021
+ this.#mediaQueryService.current === SkyMediaBreakpoints.xs &&
2022
+ this.#searchShouldCollapse());
2023
+ }
2024
+ #mediaQueryCallback(args) {
2025
+ if (this.#searchShouldCollapse()) {
2026
+ if (args === SkyMediaBreakpoints.xs) {
2027
+ this.inputAnimate = INPUT_HIDDEN_STATE;
2028
+ }
2029
+ else if (this.inputAnimate !== INPUT_SHOWN_STATE) {
2030
+ this.inputAnimate = INPUT_SHOWN_STATE;
2031
+ }
2032
+ else {
2033
+ this.mobileSearchShown = false;
2034
+ }
2035
+ }
2036
+ this.#changeRef.markForCheck();
2037
+ }
2038
+ #searchShouldCollapse() {
2039
+ return ((this.isCollapsible || this.isCollapsible === undefined) &&
2040
+ this.isFullWidth !== true);
2041
+ }
2042
+ #setupSearchChangedEvent() {
2043
+ this.#searchUpdatedSub?.unsubscribe();
2044
+ this.#searchUpdatedSub = this.#searchUpdated
2045
+ .pipe(debounceTime(this.debounceTime), distinctUntilChanged())
2046
+ .subscribe((value) => {
2047
+ this.searchChange.emit(value);
2048
+ });
2049
+ }
2050
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchComponent, deps: [{ token: i1.SkyMediaQueryService }, { token: i0.ElementRef }, { token: SkySearchAdapterService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
2051
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkySearchComponent, selector: "sky-search", inputs: { searchText: "searchText", expandMode: "expandMode", debounceTime: "debounceTime", disabled: "disabled", placeholderText: "placeholderText" }, outputs: { searchApply: "searchApply", searchChange: "searchChange", searchClear: "searchClear" }, providers: [SkySearchAdapterService], usesOnChanges: true, ngImport: i0, template: "<div class=\"sky-search-container\">\n <div class=\"sky-search-button-container\">\n <button\n class=\"sky-btn sky-btn-default sky-btn-icon sky-search-btn-open\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_search_open' | skyLibResources\"\n [hidden]=\"!searchButtonShown\"\n [ngClass]=\"{ 'sky-search-btn-open-applied': clearButtonShown }\"\n (click)=\"toggleSearchInput(true)\"\n >\n <ng-container *ngTemplateOutlet=\"searchIconTemplate\"></ng-container>\n </button>\n </div>\n <div\n class=\"sky-search-dismiss-container\"\n [hidden]=\"searchButtonShown\"\n [ngClass]=\"{\n 'sky-search-dismiss-absolute': mobileSearchShown || isFullWidth\n }\"\n >\n <div class=\"sky-search-item-input\">\n <div\n class=\"sky-search-input-container\"\n [@inputState]=\"inputAnimate\"\n (@inputState.start)=\"inputAnimationStart($event)\"\n (@inputState.done)=\"inputAnimationEnd($event)\"\n [ngClass]=\"{\n 'sky-search-input-container-has-value': searchText?.trim()\n }\"\n >\n <sky-input-box [disabled]=\"disabled\">\n <input\n class=\"sky-form-control sky-search-input sky-rounded-corners\"\n type=\"text\"\n [attr.aria-label]=\"'skyux_search_label' | skyLibResources\"\n [attr.placeholder]=\"\n placeholderText || ('skyux_search_placeholder' | skyLibResources)\n \"\n [disabled]=\"disabled\"\n [ngModel]=\"searchText\"\n (keyup)=\"enterPress($event, searchText)\"\n (ngModelChange)=\"searchTextChanged($event)\"\n skyId\n #searchInput=\"skyId\"\n />\n <span\n class=\"sky-input-group-btn sky-input-group-clear sky-input-box-btn-inset\"\n [hidden]=\"!clearButtonShown\"\n >\n <button\n aria-hidden=\"true\"\n class=\"sky-btn sky-btn-default sky-search-btn sky-search-btn-clear\"\n tabindex=\"-1\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"clearSearchText()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"times\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"close\"\n iconType=\"skyux\"\n size=\"sm\"\n ></sky-icon>\n </button>\n </span>\n <span\n *skyThemeIf=\"'default'\"\n class=\"sky-input-group-btn sky-input-box-btn-inset\"\n >\n <button\n class=\"sky-btn sky-btn-default sky-search-btn sky-search-btn-apply\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_search_label' | skyLibResources\"\n [disabled]=\"disabled\"\n (click)=\"applySearchText(searchText)\"\n >\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplate\"\n ></ng-container>\n </button>\n </span>\n <div\n *skyThemeIf=\"'modern'\"\n aria-hidden=\"true\"\n class=\"sky-input-group-icon sky-input-box-icon-inset-left\"\n >\n <ng-container *ngTemplateOutlet=\"searchIconTemplate\"></ng-container>\n </div>\n </sky-input-box>\n </div>\n </div>\n <div class=\"sky-search-item-dismiss\">\n <button\n *ngIf=\"mobileSearchShown\"\n class=\"sky-btn sky-btn-secondary sky-search-btn-dismiss\"\n type=\"button\"\n [attr.title]=\"'skyux_search_dismiss' | skyLibResources\"\n (click)=\"toggleSearchInput(false)\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-circle-left\" size=\"lg\">\n </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"double-chevron-left\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n </div>\n </div>\n</div>\n\n<ng-template #searchIconTemplate>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\" size=\"lg\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"search\"\n iconType=\"skyux\"\n size=\"lg\"\n ></sky-icon>\n</ng-template>\n", styles: ["sky-search .sky-search-container .sky-form-group{margin-bottom:0}sky-search .sky-search-input{border-top-right-radius:0;border-bottom-right-radius:0;border-right:0 none}sky-search .sky-search-input:focus{border:0 none;box-shadow:none;outline:none}sky-search .sky-search-input::-ms-clear{display:none}sky-search .sky-search-btn{border-left:0 none}sky-search .sky-search-btn:hover,sky-search .sky-search-btn:focus{background-color:#fff}sky-search .sky-search-btn-apply{padding-left:6px;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-right:1px solid #cdcfd2}sky-search .sky-search-btn-clear{border-right:0 none;padding-right:6px;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2}sky-search .sky-search-input-focused .sky-search-btn{border-color:transparent;border-top:0 none;border-bottom:0 none}sky-search .sky-search-input-focused .sky-search-btn-apply{border-right:0 none}sky-search .sky-search-input-container .sky-input-group-btn>button:focus{z-index:3}sky-search .sky-search-input-container{min-width:auto}sky-search .sky-responsive-container-xs .sky-search-input-container,sky-search .sky-responsive-container-sm .sky-search-input-container,sky-search .sky-responsive-container-md .sky-search-input-container,sky-search .sky-responsive-container-lg .sky-search-input-container{min-width:auto}@media (min-width: 768px){sky-search .sky-search-input-container{min-width:300px}}sky-search .sky-responsive-container-sm .sky-search-input-container,sky-search .sky-responsive-container-md .sky-search-input-container,sky-search .sky-responsive-container-lg .sky-search-input-container{min-width:300px}@media (max-width: 767px){sky-search .sky-search-input,sky-search .sky-search-btn-apply,sky-search .sky-search-btn-clear{font-size:15px}}sky-search .sky-search-btn-open-applied.sky-search-btn-open,sky-search .sky-search-btn-open-applied.sky-search-btn-open:hover{color:#72bf44;border:2px solid #72bf44;padding:5px 11px}sky-search .sky-search-dismiss-container{display:flex}sky-search .sky-search-item-dismiss{flex-shrink:0;display:flex}sky-search .sky-search-item-dismiss>.sky-btn{border-color:transparent}sky-search .sky-search-item-input{flex-grow:1;display:flex}sky-search .sky-search-dismiss-absolute{align-items:center;position:absolute;background-color:#fff;inset:0;padding:5px}.sky-theme-modern sky-search .sky-input-box{--sky-background-color-input-box-group: transparent}.sky-theme-modern sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn{width:40px}.sky-theme-modern sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn .sky-icon.sky-i-close{color:#1c1d1f;font-size:inherit}.sky-theme-modern sky-search .sky-search-btn-open-applied.sky-search-btn-open,.sky-theme-modern sky-search .sky-search-btn-open-applied.sky-search-btn-open:hover{border:none;box-shadow:inset 0 0 0 2px #72bf44;padding:8px 14px}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container.sky-search-input-container-has-value .sky-input-box-group-form-control:not(.sky-input-box-group-form-control-focus,:hover) .sky-form-group{border:none;border-radius:unset;box-shadow:inset 0 -1px #1870b8}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 10px}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-group-icon .sky-icon{font-size:17.3333px;color:#1c1d1f}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group{box-shadow:none}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input{width:auto;padding:10px 10px 10px 0;margin:0}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input::placeholder{font-style:normal;color:inherit;font-weight:400}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input:focus::placeholder{color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-search-dismiss-absolute{background-color:#121212}.sky-theme-modern.sky-theme-mode-dark .sky-search-btn-open-applied.sky-search-btn-open,.sky-theme-modern.sky-theme-mode-dark .sky-search-btn-open-applied.sky-search-btn-open:hover{color:#72bf44}.sky-theme-modern.sky-theme-mode-dark sky-search .sky-input-box{--sky-background-color-input-box-group: transparent}.sky-theme-modern.sky-theme-mode-dark sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn .sky-icon.sky-i-close{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark sky-search .sky-input-group-icon .sky-icon{font-size:17.333px;color:#fbfcfe}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i5.λ10, selector: "sky-input-box", inputs: ["hasErrors", "disabled", "labelText", "characterLimit", "stacked", "helpPopoverTitle", "helpPopoverContent"] }, { kind: "directive", type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i8.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "directive", type: i1.λ2, selector: "[skyId]", exportAs: ["skyId"] }, { kind: "pipe", type: i4$1.SkyLibResourcesPipe, name: "skyLibResources" }], animations: [
2052
+ trigger('inputState', [
2053
+ state(INPUT_HIDDEN_STATE, style({
2054
+ opacity: 0,
2055
+ width: 0,
2056
+ })),
2057
+ state(INPUT_SHOWN_STATE, style({
2058
+ opacity: 1,
2059
+ width: '100%',
2060
+ })),
2061
+ transition('* <=> *', animate('150ms')),
2062
+ ]),
2063
+ ], encapsulation: i0.ViewEncapsulation.None }); }
2064
+ }
2065
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchComponent, decorators: [{
2066
+ type: Component,
2067
+ args: [{ selector: 'sky-search', encapsulation: ViewEncapsulation.None, animations: [
2068
+ trigger('inputState', [
2069
+ state(INPUT_HIDDEN_STATE, style({
2070
+ opacity: 0,
2071
+ width: 0,
2072
+ })),
2073
+ state(INPUT_SHOWN_STATE, style({
2074
+ opacity: 1,
2075
+ width: '100%',
2076
+ })),
2077
+ transition('* <=> *', animate('150ms')),
2078
+ ]),
2079
+ ], providers: [SkySearchAdapterService], template: "<div class=\"sky-search-container\">\n <div class=\"sky-search-button-container\">\n <button\n class=\"sky-btn sky-btn-default sky-btn-icon sky-search-btn-open\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_search_open' | skyLibResources\"\n [hidden]=\"!searchButtonShown\"\n [ngClass]=\"{ 'sky-search-btn-open-applied': clearButtonShown }\"\n (click)=\"toggleSearchInput(true)\"\n >\n <ng-container *ngTemplateOutlet=\"searchIconTemplate\"></ng-container>\n </button>\n </div>\n <div\n class=\"sky-search-dismiss-container\"\n [hidden]=\"searchButtonShown\"\n [ngClass]=\"{\n 'sky-search-dismiss-absolute': mobileSearchShown || isFullWidth\n }\"\n >\n <div class=\"sky-search-item-input\">\n <div\n class=\"sky-search-input-container\"\n [@inputState]=\"inputAnimate\"\n (@inputState.start)=\"inputAnimationStart($event)\"\n (@inputState.done)=\"inputAnimationEnd($event)\"\n [ngClass]=\"{\n 'sky-search-input-container-has-value': searchText?.trim()\n }\"\n >\n <sky-input-box [disabled]=\"disabled\">\n <input\n class=\"sky-form-control sky-search-input sky-rounded-corners\"\n type=\"text\"\n [attr.aria-label]=\"'skyux_search_label' | skyLibResources\"\n [attr.placeholder]=\"\n placeholderText || ('skyux_search_placeholder' | skyLibResources)\n \"\n [disabled]=\"disabled\"\n [ngModel]=\"searchText\"\n (keyup)=\"enterPress($event, searchText)\"\n (ngModelChange)=\"searchTextChanged($event)\"\n skyId\n #searchInput=\"skyId\"\n />\n <span\n class=\"sky-input-group-btn sky-input-group-clear sky-input-box-btn-inset\"\n [hidden]=\"!clearButtonShown\"\n >\n <button\n aria-hidden=\"true\"\n class=\"sky-btn sky-btn-default sky-search-btn sky-search-btn-clear\"\n tabindex=\"-1\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"clearSearchText()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"times\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"close\"\n iconType=\"skyux\"\n size=\"sm\"\n ></sky-icon>\n </button>\n </span>\n <span\n *skyThemeIf=\"'default'\"\n class=\"sky-input-group-btn sky-input-box-btn-inset\"\n >\n <button\n class=\"sky-btn sky-btn-default sky-search-btn sky-search-btn-apply\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_search_label' | skyLibResources\"\n [disabled]=\"disabled\"\n (click)=\"applySearchText(searchText)\"\n >\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplate\"\n ></ng-container>\n </button>\n </span>\n <div\n *skyThemeIf=\"'modern'\"\n aria-hidden=\"true\"\n class=\"sky-input-group-icon sky-input-box-icon-inset-left\"\n >\n <ng-container *ngTemplateOutlet=\"searchIconTemplate\"></ng-container>\n </div>\n </sky-input-box>\n </div>\n </div>\n <div class=\"sky-search-item-dismiss\">\n <button\n *ngIf=\"mobileSearchShown\"\n class=\"sky-btn sky-btn-secondary sky-search-btn-dismiss\"\n type=\"button\"\n [attr.title]=\"'skyux_search_dismiss' | skyLibResources\"\n (click)=\"toggleSearchInput(false)\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-circle-left\" size=\"lg\">\n </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"double-chevron-left\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n </div>\n </div>\n</div>\n\n<ng-template #searchIconTemplate>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\" size=\"lg\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"search\"\n iconType=\"skyux\"\n size=\"lg\"\n ></sky-icon>\n</ng-template>\n", styles: ["sky-search .sky-search-container .sky-form-group{margin-bottom:0}sky-search .sky-search-input{border-top-right-radius:0;border-bottom-right-radius:0;border-right:0 none}sky-search .sky-search-input:focus{border:0 none;box-shadow:none;outline:none}sky-search .sky-search-input::-ms-clear{display:none}sky-search .sky-search-btn{border-left:0 none}sky-search .sky-search-btn:hover,sky-search .sky-search-btn:focus{background-color:#fff}sky-search .sky-search-btn-apply{padding-left:6px;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-right:1px solid #cdcfd2}sky-search .sky-search-btn-clear{border-right:0 none;padding-right:6px;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2}sky-search .sky-search-input-focused .sky-search-btn{border-color:transparent;border-top:0 none;border-bottom:0 none}sky-search .sky-search-input-focused .sky-search-btn-apply{border-right:0 none}sky-search .sky-search-input-container .sky-input-group-btn>button:focus{z-index:3}sky-search .sky-search-input-container{min-width:auto}sky-search .sky-responsive-container-xs .sky-search-input-container,sky-search .sky-responsive-container-sm .sky-search-input-container,sky-search .sky-responsive-container-md .sky-search-input-container,sky-search .sky-responsive-container-lg .sky-search-input-container{min-width:auto}@media (min-width: 768px){sky-search .sky-search-input-container{min-width:300px}}sky-search .sky-responsive-container-sm .sky-search-input-container,sky-search .sky-responsive-container-md .sky-search-input-container,sky-search .sky-responsive-container-lg .sky-search-input-container{min-width:300px}@media (max-width: 767px){sky-search .sky-search-input,sky-search .sky-search-btn-apply,sky-search .sky-search-btn-clear{font-size:15px}}sky-search .sky-search-btn-open-applied.sky-search-btn-open,sky-search .sky-search-btn-open-applied.sky-search-btn-open:hover{color:#72bf44;border:2px solid #72bf44;padding:5px 11px}sky-search .sky-search-dismiss-container{display:flex}sky-search .sky-search-item-dismiss{flex-shrink:0;display:flex}sky-search .sky-search-item-dismiss>.sky-btn{border-color:transparent}sky-search .sky-search-item-input{flex-grow:1;display:flex}sky-search .sky-search-dismiss-absolute{align-items:center;position:absolute;background-color:#fff;inset:0;padding:5px}.sky-theme-modern sky-search .sky-input-box{--sky-background-color-input-box-group: transparent}.sky-theme-modern sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn{width:40px}.sky-theme-modern sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn .sky-icon.sky-i-close{color:#1c1d1f;font-size:inherit}.sky-theme-modern sky-search .sky-search-btn-open-applied.sky-search-btn-open,.sky-theme-modern sky-search .sky-search-btn-open-applied.sky-search-btn-open:hover{border:none;box-shadow:inset 0 0 0 2px #72bf44;padding:8px 14px}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container.sky-search-input-container-has-value .sky-input-box-group-form-control:not(.sky-input-box-group-form-control-focus,:hover) .sky-form-group{border:none;border-radius:unset;box-shadow:inset 0 -1px #1870b8}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 10px}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-group-icon .sky-icon{font-size:17.3333px;color:#1c1d1f}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group{box-shadow:none}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input{width:auto;padding:10px 10px 10px 0;margin:0}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input::placeholder{font-style:normal;color:inherit;font-weight:400}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input:focus::placeholder{color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-search-dismiss-absolute{background-color:#121212}.sky-theme-modern.sky-theme-mode-dark .sky-search-btn-open-applied.sky-search-btn-open,.sky-theme-modern.sky-theme-mode-dark .sky-search-btn-open-applied.sky-search-btn-open:hover{color:#72bf44}.sky-theme-modern.sky-theme-mode-dark sky-search .sky-input-box{--sky-background-color-input-box-group: transparent}.sky-theme-modern.sky-theme-mode-dark sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn .sky-icon.sky-i-close{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark sky-search .sky-input-group-icon .sky-icon{font-size:17.333px;color:#fbfcfe}\n"] }]
2080
+ }], ctorParameters: function () { return [{ type: i1.SkyMediaQueryService }, { type: i0.ElementRef }, { type: SkySearchAdapterService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { searchApply: [{
2081
+ type: Output
2082
+ }], searchChange: [{
2083
+ type: Output
2084
+ }], searchClear: [{
2085
+ type: Output
2086
+ }], searchText: [{
2087
+ type: Input
2088
+ }], expandMode: [{
2089
+ type: Input
2090
+ }], debounceTime: [{
2091
+ type: Input
2092
+ }], disabled: [{
2093
+ type: Input
2094
+ }], placeholderText: [{
2095
+ type: Input
2096
+ }] } });
2097
+
2098
+ class SkySearchModule {
2099
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2100
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkySearchModule, declarations: [SkySearchComponent], imports: [CommonModule,
2101
+ SkyInputBoxModule,
2102
+ SkyLookupResourcesModule,
2103
+ FormsModule,
2104
+ SkyIconModule,
2105
+ SkyThemeModule,
2106
+ SkyIdModule], exports: [SkySearchComponent] }); }
2107
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchModule, imports: [CommonModule,
2108
+ SkyInputBoxModule,
2109
+ SkyLookupResourcesModule,
2110
+ FormsModule,
2111
+ SkyIconModule,
2112
+ SkyThemeModule,
2113
+ SkyIdModule] }); }
2114
+ }
2115
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySearchModule, decorators: [{
2116
+ type: NgModule,
2117
+ args: [{
2118
+ declarations: [SkySearchComponent],
2119
+ imports: [
2120
+ CommonModule,
2121
+ SkyInputBoxModule,
2122
+ SkyLookupResourcesModule,
2123
+ FormsModule,
2124
+ SkyIconModule,
2125
+ SkyThemeModule,
2126
+ SkyIdModule,
2127
+ ],
2128
+ exports: [SkySearchComponent],
2129
+ }]
2130
+ }] });
2131
+
2132
+ /**
2133
+ * @internal
2134
+ */
2135
+ class SkySelectionModalItemSelectedPipe {
2136
+ transform(id, selectedIdMap) {
2137
+ return selectedIdMap.has(id);
2138
+ }
2139
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalItemSelectedPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
2140
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalItemSelectedPipe, name: "skySelectionModalItemSelected" }); }
2141
+ }
2142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalItemSelectedPipe, decorators: [{
2143
+ type: Pipe,
2144
+ args: [{
2145
+ name: 'skySelectionModalItemSelected',
2146
+ }]
2147
+ }] });
2148
+
2149
+ /**
2150
+ * @internal
2151
+ * Context for the selection modal. These values are provided by the selection modal service.
2152
+ */
2153
+ class SkySelectionModalContext {
2154
+ constructor(descriptorProperty, idProperty, initialSearch, initialValue, searchAsync, selectMode, showAddButton, userConfig) {
2155
+ this.descriptorProperty = descriptorProperty;
2156
+ this.idProperty = idProperty;
2157
+ this.initialSearch = initialSearch;
2158
+ this.initialValue = initialValue;
2159
+ this.searchAsync = searchAsync;
2160
+ this.selectMode = selectMode;
2161
+ this.showAddButton = showAddButton;
2162
+ this.userConfig = userConfig;
2163
+ }
2164
+ }
2165
+
2166
+ /**
2167
+ * @internal
2168
+ */
2169
+ class SkySelectionModalComponent {
2170
+ #changeDetector;
2171
+ #continuationData;
2172
+ #currentSearchSub;
2173
+ #ngUnsubscribe;
2174
+ #offset;
2175
+ constructor(modalInstance, context, changeDetector, idSvc) {
2176
+ this.modalInstance = modalInstance;
2177
+ this.context = context;
2178
+ /**
2179
+ * @internal
2180
+ * Fires when users select the button to add new options to the list.
2181
+ */
2182
+ this.addClick = new Subject();
2183
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2184
+ this.displayedItems = [];
2185
+ this.hasMoreItems = false;
2186
+ this.isLoadingMore = false;
2187
+ this.isSearching = false;
2188
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2189
+ this.items = [];
2190
+ this.onlyShowSelected = false;
2191
+ this.repeaterItemTemplate = null;
2192
+ this.selectedIdMap = new Map();
2193
+ this.#ngUnsubscribe = new Subject();
2194
+ this.#offset = 0;
2195
+ this.#changeDetector = changeDetector;
2196
+ this.id = idSvc.generateId();
2197
+ }
2198
+ ngOnInit() {
2199
+ this.repeaterItemTemplate = this.context.userConfig.itemTemplate || null;
2200
+ this.searchText = this.context.initialSearch;
2201
+ this.#createInitialSelectedItemsMap();
2202
+ this.#loadSearchResults();
2203
+ }
2204
+ ngOnDestroy() {
2205
+ this.#cancelCurrentSearch();
2206
+ this.#ngUnsubscribe.next();
2207
+ this.#ngUnsubscribe.complete();
2208
+ }
2209
+ addButtonClicked() {
2210
+ this.addClick.next();
2211
+ }
2212
+ clearAll() {
2213
+ this.selectedIdMap = new Map(this.selectedIdMap);
2214
+ // Only deselect items that have been loaded; items that would be loaded
2215
+ // after an infinite scroll event should remain selected.
2216
+ for (const item of this.items) {
2217
+ this.selectedIdMap.delete(item[this.context.idProperty]);
2218
+ }
2219
+ this.updateDisplayedItems();
2220
+ this.#changeDetector.markForCheck();
2221
+ }
2222
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2223
+ itemClick(selectedItem) {
2224
+ if (this.context.selectMode === 'single') {
2225
+ this.onItemSelect(!selectedItem.selected, selectedItem);
2226
+ }
2227
+ }
2228
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2229
+ addItem(itemToAdd) {
2230
+ // Add the selected item, then perform the search again in case the
2231
+ // newly-added item should be displayed as a search results.
2232
+ this.#offset = 0;
2233
+ this.onItemSelect(true, itemToAdd);
2234
+ this.#loadSearchResults();
2235
+ }
2236
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2237
+ onItemSelect(newSelectState, itemToSelect) {
2238
+ const itemId = itemToSelect[this.context.idProperty];
2239
+ // Create a new Map so the pipe transform will execute on the next
2240
+ // change detection cycle.
2241
+ this.selectedIdMap = new Map(this.selectedIdMap);
2242
+ if (this.context.selectMode === 'single') {
2243
+ if (newSelectState) {
2244
+ this.selectedIdMap.clear();
2245
+ this.selectedIdMap.set(itemId, itemToSelect);
2246
+ }
2247
+ }
2248
+ else {
2249
+ if (newSelectState) {
2250
+ this.selectedIdMap.set(itemId, itemToSelect);
2251
+ }
2252
+ else {
2253
+ this.selectedIdMap.delete(itemId);
2254
+ }
2255
+ }
2256
+ this.updateDisplayedItems();
2257
+ }
2258
+ searchApplied(searchText) {
2259
+ this.#offset = 0;
2260
+ this.searchText = searchText;
2261
+ this.#loadSearchResults();
2262
+ }
2263
+ selectAll() {
2264
+ this.selectedIdMap = new Map();
2265
+ for (const item of this.items) {
2266
+ this.selectedIdMap.set(item[this.context.idProperty], item);
2267
+ }
2268
+ this.updateDisplayedItems();
2269
+ }
2270
+ infiniteScrollEnd() {
2271
+ this.#cancelCurrentSearch();
2272
+ /* Sanity check - else case would only happen if this was called directly */
2273
+ /* istanbul ignore else */
2274
+ if (this.hasMoreItems) {
2275
+ this.isLoadingMore = true;
2276
+ this.#performSearch((result) => {
2277
+ this.items = this.items.concat(result.items);
2278
+ this.updateDisplayedItems();
2279
+ this.isLoadingMore = false;
2280
+ });
2281
+ }
2282
+ }
2283
+ save() {
2284
+ const selectedItems = Array.from(this.selectedIdMap.values(), (itemData, index) => ({
2285
+ index,
2286
+ itemData,
2287
+ })).sort((a, b) => {
2288
+ return this.items.indexOf(a.itemData) < this.items.indexOf(b.itemData)
2289
+ ? -1
2290
+ : 1;
2291
+ });
2292
+ this.modalInstance.save(selectedItems);
2293
+ }
2294
+ updateDisplayedItems() {
2295
+ if (this.onlyShowSelected) {
2296
+ this.displayedItems = this.items.filter((item) => this.selectedIdMap.has(item[this.context.idProperty]));
2297
+ }
2298
+ else {
2299
+ this.displayedItems = this.items;
2300
+ }
2301
+ }
2302
+ #loadSearchResults() {
2303
+ this.#cancelCurrentSearch();
2304
+ this.isSearching = true;
2305
+ this.#performSearch((result) => {
2306
+ this.isSearching = false;
2307
+ this.items = result.items;
2308
+ });
2309
+ this.#changeDetector.markForCheck();
2310
+ }
2311
+ #createInitialSelectedItemsMap() {
2312
+ this.selectedIdMap = new Map(this.context.initialValue.map((item) => [
2313
+ item[this.context.idProperty],
2314
+ item,
2315
+ ]));
2316
+ }
2317
+ #performSearch(processResults) {
2318
+ this.#currentSearchSub = this.context
2319
+ .searchAsync({
2320
+ displayType: 'modal',
2321
+ offset: this.#offset,
2322
+ searchText: this.searchText || '',
2323
+ continuationData: this.#continuationData,
2324
+ })
2325
+ .pipe(take(1))
2326
+ .subscribe((result) => {
2327
+ processResults(result);
2328
+ this.#continuationData = result.continuationData;
2329
+ this.hasMoreItems = result.hasMore || false;
2330
+ this.#offset = this.items.length;
2331
+ this.updateDisplayedItems();
2332
+ this.#changeDetector.markForCheck();
2333
+ });
2334
+ }
2335
+ #cancelCurrentSearch() {
2336
+ if (this.#currentSearchSub) {
2337
+ this.#currentSearchSub.unsubscribe();
2338
+ this.#currentSearchSub = undefined;
2339
+ this.isLoadingMore = false;
2340
+ this.isSearching = false;
2341
+ }
2342
+ }
2343
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalComponent, deps: [{ token: i1$1.SkyModalInstance }, { token: SkySelectionModalContext }, { token: i0.ChangeDetectorRef }, { token: i1.SkyIdService }], target: i0.ɵɵFactoryTarget.Component }); }
2344
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkySelectionModalComponent, selector: "sky-selection-modal", ngImport: i0, template: "<sky-modal\n class=\"sky-lookup-show-more-modal\"\n [attr.id]=\"id\"\n [ngClass]=\"'sky-lookup-show-more-modal-' + context.selectMode\"\n>\n <sky-modal-header>\n <ng-container *ngIf=\"context.userConfig?.title; else defaultTitle\">\n {{ context.userConfig.title }}\n </ng-container>\n </sky-modal-header>\n <sky-modal-content\n [skyViewkeeper]=\"['.sky-lookup-show-more-toolbar-wrapper']\"\n >\n <sky-wait [isWaiting]=\"isSearching\"></sky-wait>\n <div class=\"sky-lookup-show-more-toolbar-wrapper\">\n <sky-toolbar class=\"sky-lookup-show-more-modal-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-search\n [debounceTime]=\"250\"\n [searchText]=\"searchText\"\n (searchApply)=\"searchApplied($event)\"\n >\n </sky-search>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <button\n *ngIf=\"context.showAddButton\"\n type=\"button\"\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-add\"\n (click)=\"addButtonClicked()\"\n >\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"add\"\n iconType=\"skyux\"\n ></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_lookup_show_more_add' | skyLibResources }}\n </button>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n <sky-toolbar\n *ngIf=\"context.selectMode === 'multiple'\"\n class=\"sky-lookup-show-more-modal-multiselect-toolbar\"\n >\n <sky-toolbar-section>\n <sky-toolbar-item>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-select-all-btn\"\n type=\"button\"\n (click)=\"selectAll()\"\n >\n {{\n 'skyux_lookup_show_more_select_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-clear-all-btn\"\n type=\"button\"\n (click)=\"clearAll()\"\n >\n {{\n 'skyux_lookup_show_more_clear_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <sky-checkbox\n [(checked)]=\"onlyShowSelected\"\n (change)=\"updateDisplayedItems()\"\n >\n <sky-checkbox-label>\n {{\n 'skyux_lookup_show_more_show_selected_option_title'\n | skyLibResources\n }}\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n </div>\n <div\n *ngIf=\"!isSearching && displayedItems.length === 0\"\n class=\"sky-font-deemphasized sky-lookup-show-more-no-results\"\n >\n {{ 'skyux_lookup_show_more_no_results' | skyLibResources }}\n </div>\n <sky-repeater class=\"sky-lookup-show-more-repeater\" expandMode=\"none\">\n <sky-repeater-item\n *ngFor=\"let item of displayedItems\"\n [isSelected]=\"\n item[context.idProperty]\n | skySelectionModalItemSelected : selectedIdMap\n \"\n [selectable]=\"context.selectMode === 'multiple'\"\n (click)=\"itemClick(item)\"\n (keyup.enter)=\"itemClick(item)\"\n (isSelectedChange)=\"onItemSelect($event, item)\"\n >\n <sky-repeater-item-content>\n <ng-container\n *ngTemplateOutlet=\"\n repeaterItemTemplate ?? defaultItemTemplate;\n context: { item: item }\n \"\n >\n </ng-container>\n </sky-repeater-item-content>\n </sky-repeater-item>\n </sky-repeater>\n <sky-infinite-scroll\n [enabled]=\"hasMoreItems\"\n [loading]=\"isLoadingMore\"\n (scrollEnd)=\"infiniteScrollEnd()\"\n >\n </sky-infinite-scroll>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n class=\"sky-btn sky-btn-primary sky-margin-inline-compact sky-lookup-show-more-modal-save\"\n type=\"button\"\n [disabled]=\"isSearching\"\n (click)=\"save()\"\n >\n {{ 'skyux_lookup_show_more_select' | skyLibResources }}\n </button>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-close\"\n type=\"button\"\n (click)=\"modalInstance.close()\"\n >\n {{ 'skyux_lookup_show_more_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n\n<ng-template let-item=\"item\" #defaultItemTemplate>\n {{ item[context.descriptorProperty] }}\n</ng-template>\n\n<ng-template #defaultTitle>\n <ng-container *ngIf=\"context.selectMode === 'single'\">\n {{ 'skyux_lookup_show_more_modal_title_single' | skyLibResources }}\n </ng-container>\n <ng-container *ngIf=\"context.selectMode === 'multiple'\">\n {{ 'skyux_lookup_show_more_modal_title_multiple' | skyLibResources }}\n </ng-container>\n</ng-template>\n", styles: [".sky-lookup-show-more-no-results{padding:20px 0}:host-context(.sky-theme-modern) .sky-lookup-show-more-no-results{padding:30px 0}.sky-theme-modern .sky-lookup-show-more-no-results{padding:30px 0}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i5.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "indeterminate", "required"], outputs: ["change", "checkedChange", "disabledChange", "indeterminateChange"] }, { kind: "component", type: i5.λ4, selector: "sky-checkbox-label" }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "component", type: i7.λ6, selector: "sky-infinite-scroll", inputs: ["enabled", "loading"], outputs: ["scrollEnd"] }, { kind: "component", type: i1$1.λ5, selector: "sky-modal", inputs: ["formErrors", "ariaRole", "tiledBody", "ariaDescribedBy", "ariaLabelledBy"] }, { kind: "component", type: i1$1.λ2, selector: "sky-modal-content" }, { kind: "component", type: i1$1.λ3, selector: "sky-modal-footer" }, { kind: "component", type: i1$1.λ4, selector: "sky-modal-header" }, { kind: "component", type: i7.λ11, selector: "sky-repeater", inputs: ["activeIndex", "ariaLabel", "reorderable", "expandMode"], outputs: ["activeIndexChange", "orderChange"] }, { kind: "component", type: i7.λ10, selector: "sky-repeater-item", inputs: ["disabled", "itemName", "inlineFormConfig", "inlineFormTemplate", "isExpanded", "isSelected", "reorderable", "selectable", "showInlineForm", "tag"], outputs: ["collapse", "expand", "inlineFormClose", "isSelectedChange"] }, { kind: "component", type: i7.λ8, selector: "sky-repeater-item-content" }, { kind: "component", type: SkySearchComponent, selector: "sky-search", inputs: ["searchText", "expandMode", "debounceTime", "disabled", "placeholderText"], outputs: ["searchApply", "searchChange", "searchClear"] }, { kind: "directive", type: i8.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "component", type: i10.λ37, selector: "sky-toolbar" }, { kind: "component", type: i10.λ39, selector: "sky-toolbar-item" }, { kind: "component", type: i10.λ38, selector: "sky-toolbar-section" }, { kind: "component", type: i10.λ40, selector: "sky-toolbar-view-actions" }, { kind: "directive", type: i1.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }, { kind: "component", type: i6.λ14, selector: "sky-wait", inputs: ["ariaLabel", "isWaiting", "isFullPage", "isNonBlocking", "screenReaderCompletedText"] }, { kind: "pipe", type: i4$1.SkyLibResourcesPipe, name: "skyLibResources" }, { kind: "pipe", type: SkySelectionModalItemSelectedPipe, name: "skySelectionModalItemSelected" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2345
+ }
2346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalComponent, decorators: [{
2347
+ type: Component,
2348
+ args: [{ selector: 'sky-selection-modal', changeDetection: ChangeDetectionStrategy.OnPush, template: "<sky-modal\n class=\"sky-lookup-show-more-modal\"\n [attr.id]=\"id\"\n [ngClass]=\"'sky-lookup-show-more-modal-' + context.selectMode\"\n>\n <sky-modal-header>\n <ng-container *ngIf=\"context.userConfig?.title; else defaultTitle\">\n {{ context.userConfig.title }}\n </ng-container>\n </sky-modal-header>\n <sky-modal-content\n [skyViewkeeper]=\"['.sky-lookup-show-more-toolbar-wrapper']\"\n >\n <sky-wait [isWaiting]=\"isSearching\"></sky-wait>\n <div class=\"sky-lookup-show-more-toolbar-wrapper\">\n <sky-toolbar class=\"sky-lookup-show-more-modal-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-search\n [debounceTime]=\"250\"\n [searchText]=\"searchText\"\n (searchApply)=\"searchApplied($event)\"\n >\n </sky-search>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <button\n *ngIf=\"context.showAddButton\"\n type=\"button\"\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-add\"\n (click)=\"addButtonClicked()\"\n >\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"add\"\n iconType=\"skyux\"\n ></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_lookup_show_more_add' | skyLibResources }}\n </button>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n <sky-toolbar\n *ngIf=\"context.selectMode === 'multiple'\"\n class=\"sky-lookup-show-more-modal-multiselect-toolbar\"\n >\n <sky-toolbar-section>\n <sky-toolbar-item>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-select-all-btn\"\n type=\"button\"\n (click)=\"selectAll()\"\n >\n {{\n 'skyux_lookup_show_more_select_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-clear-all-btn\"\n type=\"button\"\n (click)=\"clearAll()\"\n >\n {{\n 'skyux_lookup_show_more_clear_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <sky-checkbox\n [(checked)]=\"onlyShowSelected\"\n (change)=\"updateDisplayedItems()\"\n >\n <sky-checkbox-label>\n {{\n 'skyux_lookup_show_more_show_selected_option_title'\n | skyLibResources\n }}\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n </div>\n <div\n *ngIf=\"!isSearching && displayedItems.length === 0\"\n class=\"sky-font-deemphasized sky-lookup-show-more-no-results\"\n >\n {{ 'skyux_lookup_show_more_no_results' | skyLibResources }}\n </div>\n <sky-repeater class=\"sky-lookup-show-more-repeater\" expandMode=\"none\">\n <sky-repeater-item\n *ngFor=\"let item of displayedItems\"\n [isSelected]=\"\n item[context.idProperty]\n | skySelectionModalItemSelected : selectedIdMap\n \"\n [selectable]=\"context.selectMode === 'multiple'\"\n (click)=\"itemClick(item)\"\n (keyup.enter)=\"itemClick(item)\"\n (isSelectedChange)=\"onItemSelect($event, item)\"\n >\n <sky-repeater-item-content>\n <ng-container\n *ngTemplateOutlet=\"\n repeaterItemTemplate ?? defaultItemTemplate;\n context: { item: item }\n \"\n >\n </ng-container>\n </sky-repeater-item-content>\n </sky-repeater-item>\n </sky-repeater>\n <sky-infinite-scroll\n [enabled]=\"hasMoreItems\"\n [loading]=\"isLoadingMore\"\n (scrollEnd)=\"infiniteScrollEnd()\"\n >\n </sky-infinite-scroll>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n class=\"sky-btn sky-btn-primary sky-margin-inline-compact sky-lookup-show-more-modal-save\"\n type=\"button\"\n [disabled]=\"isSearching\"\n (click)=\"save()\"\n >\n {{ 'skyux_lookup_show_more_select' | skyLibResources }}\n </button>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-close\"\n type=\"button\"\n (click)=\"modalInstance.close()\"\n >\n {{ 'skyux_lookup_show_more_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n\n<ng-template let-item=\"item\" #defaultItemTemplate>\n {{ item[context.descriptorProperty] }}\n</ng-template>\n\n<ng-template #defaultTitle>\n <ng-container *ngIf=\"context.selectMode === 'single'\">\n {{ 'skyux_lookup_show_more_modal_title_single' | skyLibResources }}\n </ng-container>\n <ng-container *ngIf=\"context.selectMode === 'multiple'\">\n {{ 'skyux_lookup_show_more_modal_title_multiple' | skyLibResources }}\n </ng-container>\n</ng-template>\n", styles: [".sky-lookup-show-more-no-results{padding:20px 0}:host-context(.sky-theme-modern) .sky-lookup-show-more-no-results{padding:30px 0}.sky-theme-modern .sky-lookup-show-more-no-results{padding:30px 0}\n"] }]
2349
+ }], ctorParameters: function () { return [{ type: i1$1.SkyModalInstance }, { type: SkySelectionModalContext }, { type: i0.ChangeDetectorRef }, { type: i1.SkyIdService }]; } });
2350
+
2351
+ class SkySelectionModalModule {
2352
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2353
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalModule, declarations: [SkySelectionModalComponent, SkySelectionModalItemSelectedPipe], imports: [CommonModule,
2354
+ SkyCheckboxModule,
2355
+ SkyI18nModule,
2356
+ SkyIconModule,
2357
+ SkyInfiniteScrollModule,
2358
+ SkyModalModule,
2359
+ SkyRepeaterModule,
2360
+ SkySearchModule,
2361
+ SkyThemeModule,
2362
+ SkyToolbarModule,
2363
+ SkyViewkeeperModule,
2364
+ SkyWaitModule] }); }
2365
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalModule, imports: [CommonModule,
2366
+ SkyCheckboxModule,
2367
+ SkyI18nModule,
2368
+ SkyIconModule,
2369
+ SkyInfiniteScrollModule,
2370
+ SkyModalModule,
2371
+ SkyRepeaterModule,
2372
+ SkySearchModule,
2373
+ SkyThemeModule,
2374
+ SkyToolbarModule,
2375
+ SkyViewkeeperModule,
2376
+ SkyWaitModule] }); }
2377
+ }
2378
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalModule, decorators: [{
2379
+ type: NgModule,
2380
+ args: [{
2381
+ declarations: [SkySelectionModalComponent, SkySelectionModalItemSelectedPipe],
2382
+ imports: [
2383
+ CommonModule,
2384
+ SkyCheckboxModule,
2385
+ SkyI18nModule,
2386
+ SkyIconModule,
2387
+ SkyInfiniteScrollModule,
2388
+ SkyModalModule,
2389
+ SkyRepeaterModule,
2390
+ SkySearchModule,
2391
+ SkyThemeModule,
2392
+ SkyToolbarModule,
2393
+ SkyViewkeeperModule,
2394
+ SkyWaitModule,
2395
+ ],
2396
+ }]
2397
+ }] });
2398
+
2399
+ /**
2400
+ * @internal
2401
+ * Context for the show more native picker. These values are provided by the lookup component.
2402
+ */
2403
+ class SkyLookupShowMoreNativePickerContext {
2404
+ constructor(descriptorProperty, initialSearch, initialValue, items, search, selectMode, showAddButton, userConfig) {
2405
+ this.descriptorProperty = descriptorProperty;
2406
+ this.initialSearch = initialSearch;
2407
+ this.initialValue = initialValue;
2408
+ this.items = items;
2409
+ this.search = search;
2410
+ this.selectMode = selectMode;
2411
+ this.showAddButton = showAddButton;
2412
+ this.userConfig = userConfig;
2413
+ }
2414
+ }
2415
+
2416
+ /**
2417
+ * @internal
2418
+ * Internal component to implement the native picker.
2419
+ */
2420
+ class SkyLookupShowMoreModalComponent {
2421
+ #changeDetector;
2422
+ #itemIndex;
2423
+ #ngUnsubscribe;
2424
+ constructor(modalInstance, context, changeDetector, idSvc) {
2425
+ this.modalInstance = modalInstance;
2426
+ this.context = context;
2427
+ /**
2428
+ * @internal
2429
+ * Fires when users select the button to add new options to the list.
2430
+ */
2431
+ this.addClick = new Subject();
2432
+ this.items = [];
2433
+ this.itemsLoading = false;
2434
+ this.dataManagerConfig = {
2435
+ sortOptions: [
2436
+ {
2437
+ id: 'az',
2438
+ label: 'Alphabetical (A - Z)',
2439
+ descending: false,
2440
+ propertyName: 'name',
2441
+ },
2442
+ {
2443
+ id: 'za',
2444
+ label: 'Alphabetical (Z - A)',
2445
+ descending: true,
2446
+ propertyName: 'name',
2447
+ },
2448
+ ],
2449
+ };
2450
+ this.displayedItems = [];
2451
+ this.itemsHaveMore = false;
2452
+ this.onlyShowSelected = false;
2453
+ this.repeaterItemTemplate = null;
2454
+ this.searchText = '';
2455
+ this.selectedItems = [];
2456
+ this.#itemIndex = 0;
2457
+ this.#ngUnsubscribe = new Subject();
2458
+ this.#changeDetector = changeDetector;
2459
+ this.id = idSvc.generateId();
2460
+ }
2461
+ ngAfterViewInit() {
2462
+ this.repeaterItemTemplate = this.context.userConfig.itemTemplate || null;
2463
+ this.searchText = this.context.initialSearch;
2464
+ this.addItems();
2465
+ }
2466
+ ngOnDestroy() {
2467
+ this.#ngUnsubscribe.next();
2468
+ this.#ngUnsubscribe.complete();
2469
+ }
2470
+ addButtonClicked() {
2471
+ this.addClick.next();
2472
+ }
2473
+ addItems() {
2474
+ this.itemsLoading = true;
2475
+ if (!this.items || this.items.length === 0) {
2476
+ const selectedItems = this.selectedItems.slice();
2477
+ this.items = this.context.items.map((item) => {
2478
+ return {
2479
+ value: item,
2480
+ selected: false,
2481
+ };
2482
+ });
2483
+ this.items.forEach((item) => {
2484
+ const isInitialValue = this.context.initialValue === item.value;
2485
+ const initialIsArray = Array.isArray(this.context.initialValue);
2486
+ const initialValueContainsItem = this.context.initialValue.findIndex((initialItem) => initialItem === item.value) >= 0;
2487
+ if (isInitialValue || (initialIsArray && initialValueContainsItem)) {
2488
+ item.selected = true;
2489
+ const itemIndex = this.items.indexOf(item);
2490
+ if (selectedItems.findIndex((selectedItem) => selectedItem.index === itemIndex) < 0) {
2491
+ selectedItems.push({ index: itemIndex, itemData: item.value });
2492
+ }
2493
+ }
2494
+ });
2495
+ this.selectedItems = selectedItems;
2496
+ this.updateDataState();
2497
+ this.#changeDetector.markForCheck();
2498
+ }
2499
+ // if onlyShowSelected is checked, then only iterate through the initial selection
2500
+ const items = this.onlyShowSelected
2501
+ ? this.items.filter((item) => item.selected)
2502
+ : this.items;
2503
+ this.#itemIndex = this.#itemIndex + 10;
2504
+ this.searchItems(items).then((searchedItems) => {
2505
+ this.displayedItems = searchedItems.slice(0, this.#itemIndex);
2506
+ if (this.#itemIndex > searchedItems.length) {
2507
+ this.itemsHaveMore = false;
2508
+ }
2509
+ else {
2510
+ this.itemsHaveMore = true;
2511
+ }
2512
+ this.itemsLoading = false;
2513
+ this.#changeDetector.markForCheck();
2514
+ });
2515
+ }
2516
+ clearAll() {
2517
+ this.displayedItems.forEach((item) => {
2518
+ if (item.selected) {
2519
+ item.selected = false;
2520
+ }
2521
+ });
2522
+ this.selectedItems = [];
2523
+ this.updateDataState();
2524
+ this.#changeDetector.markForCheck();
2525
+ }
2526
+ itemClick(selectedItem) {
2527
+ if (this.context.selectMode === 'single') {
2528
+ this.onItemSelect(!selectedItem.selected, selectedItem);
2529
+ }
2530
+ }
2531
+ onItemSelect(newSelectState, itemToSelect) {
2532
+ const items = this.items;
2533
+ if (this.context.selectMode === 'single') {
2534
+ /* Sanity check - single select mode should only alow for a `true` select state */
2535
+ /* istanbul ignore else */
2536
+ if (newSelectState) {
2537
+ itemToSelect.selected = true;
2538
+ items.forEach((item) => {
2539
+ if (item.value !== itemToSelect.value) {
2540
+ item.selected = false;
2541
+ }
2542
+ });
2543
+ this.displayedItems.forEach((item) => {
2544
+ if (item.value !== itemToSelect.value) {
2545
+ item.selected = false;
2546
+ }
2547
+ });
2548
+ const itemIndex = items.findIndex((item) => item.value === itemToSelect.value);
2549
+ this.selectedItems = [
2550
+ { index: itemIndex, itemData: items[itemIndex].value },
2551
+ ];
2552
+ }
2553
+ }
2554
+ else {
2555
+ const selectedItems = this.selectedItems;
2556
+ const allItemsIndex = items.findIndex((item) => item.value === itemToSelect.value);
2557
+ const selectedItemsIndex = selectedItems.findIndex((selectedItem) => selectedItem.index === allItemsIndex);
2558
+ if (newSelectState && selectedItemsIndex === -1) {
2559
+ selectedItems.push({
2560
+ index: allItemsIndex,
2561
+ itemData: items[allItemsIndex].value,
2562
+ });
2563
+ }
2564
+ else if (!newSelectState && selectedItemsIndex !== -1) {
2565
+ selectedItems.splice(selectedItemsIndex, 1);
2566
+ }
2567
+ this.selectedItems = selectedItems;
2568
+ }
2569
+ this.updateDataState();
2570
+ this.#changeDetector.markForCheck();
2571
+ }
2572
+ searchApplied(searchText) {
2573
+ /* istanbul ignore else */
2574
+ if (this.searchText !== searchText) {
2575
+ this.#itemIndex = 10;
2576
+ this.modalInstance.scrollContentToTop();
2577
+ }
2578
+ this.searchText = searchText;
2579
+ this.itemsLoading = true;
2580
+ this.#changeDetector.detectChanges();
2581
+ // We need to ensure that the scroll event makes it all the way through the infinite scroll workflow before updating the data state.
2582
+ // Without this, the infinite scroll can add items improperly because it can see the above scroll after the items finish searching.
2583
+ setTimeout(() => {
2584
+ this.updateDataState();
2585
+ }, 100);
2586
+ }
2587
+ searchItems(items) {
2588
+ const searchText = this.searchText;
2589
+ if (searchText) {
2590
+ const resultValues = this.context.search(searchText, items.map((item) => {
2591
+ return item.value;
2592
+ }), { context: 'modal' });
2593
+ if (resultValues instanceof Array) {
2594
+ const result = items.filter((item) => resultValues.indexOf(item.value) >= 0);
2595
+ return Promise.resolve(result);
2596
+ }
2597
+ else {
2598
+ return resultValues.then((values) => {
2599
+ const result = items.filter((item) => values.indexOf(item.value) >= 0);
2600
+ return Promise.resolve(result);
2601
+ });
2602
+ }
2603
+ }
2604
+ else {
2605
+ return Promise.resolve(items);
2606
+ }
2607
+ }
2608
+ selectAll() {
2609
+ const items = this.items;
2610
+ const selectedItems = this.selectedItems;
2611
+ this.displayedItems.forEach((item) => {
2612
+ if (!item.selected) {
2613
+ item.selected = true;
2614
+ const index = items.indexOf(item);
2615
+ /* istanbul ignore else */
2616
+ if (selectedItems.findIndex((selectedItem) => selectedItem.index === index) < 0) {
2617
+ selectedItems.push({
2618
+ index: index,
2619
+ itemData: items[index].value,
2620
+ });
2621
+ }
2622
+ }
2623
+ });
2624
+ this.selectedItems = selectedItems;
2625
+ this.updateDataState();
2626
+ this.#changeDetector.markForCheck();
2627
+ }
2628
+ updateDataState() {
2629
+ const items = this.items;
2630
+ const selectedItems = this.selectedItems;
2631
+ items?.forEach((item, index) => {
2632
+ item.selected =
2633
+ selectedItems.findIndex((selectedItem) => selectedItem.index === index) !== -1;
2634
+ });
2635
+ this.searchItems(items).then((searchedItems) => {
2636
+ if (this.onlyShowSelected) {
2637
+ searchedItems = searchedItems.filter((item) => item.selected);
2638
+ }
2639
+ this.displayedItems = searchedItems.slice(0, this.#itemIndex);
2640
+ if (this.#itemIndex > searchedItems.length) {
2641
+ this.itemsHaveMore = false;
2642
+ }
2643
+ else {
2644
+ this.itemsHaveMore = true;
2645
+ }
2646
+ this.itemsLoading = false;
2647
+ this.#changeDetector.markForCheck();
2648
+ });
2649
+ }
2650
+ updateItemData(data) {
2651
+ this.context.items = data;
2652
+ this.items = [];
2653
+ this.#itemIndex = 10;
2654
+ this.selectedItems.forEach((selectedItem) => {
2655
+ this.context.items.forEach((item, index) => {
2656
+ if (selectedItem.itemData === item) {
2657
+ selectedItem.index = index;
2658
+ }
2659
+ });
2660
+ });
2661
+ this.addItems();
2662
+ this.#changeDetector.markForCheck();
2663
+ }
2664
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupShowMoreModalComponent, deps: [{ token: i1$1.SkyModalInstance }, { token: SkyLookupShowMoreNativePickerContext }, { token: i0.ChangeDetectorRef }, { token: i1.SkyIdService }], target: i0.ɵɵFactoryTarget.Component }); }
2665
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyLookupShowMoreModalComponent, selector: "skyux-lookup-show-more-modal", ngImport: i0, template: "<sky-modal\n class=\"sky-lookup-show-more-modal\"\n [attr.id]=\"id\"\n [ngClass]=\"'sky-lookup-show-more-modal-' + context.selectMode\"\n>\n <sky-modal-header>\n <ng-container *ngIf=\"context.userConfig?.title; else defaultTitle\">\n {{ context.userConfig.title }}\n </ng-container>\n </sky-modal-header>\n <sky-modal-content\n [skyViewkeeper]=\"['.sky-lookup-show-more-toolbar-wrapper']\"\n >\n <div class=\"sky-lookup-show-more-toolbar-wrapper\">\n <sky-toolbar class=\"sky-lookup-show-more-modal-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-search\n [debounceTime]=\"250\"\n [searchText]=\"searchText\"\n (searchApply)=\"searchApplied($event)\"\n >\n </sky-search>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <button\n *ngIf=\"context.showAddButton\"\n type=\"button\"\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-add\"\n (click)=\"addButtonClicked()\"\n >\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"add\"\n iconType=\"skyux\"\n ></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_lookup_show_more_add' | skyLibResources }}\n </button>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n <sky-toolbar\n *ngIf=\"context.selectMode === 'multiple'\"\n class=\"sky-lookup-show-more-modal-multiselect-toolbar\"\n >\n <sky-toolbar-section>\n <sky-toolbar-item>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-select-all-btn\"\n type=\"button\"\n (click)=\"selectAll()\"\n >\n {{\n 'skyux_lookup_show_more_select_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-clear-all-btn\"\n type=\"button\"\n (click)=\"clearAll()\"\n >\n {{\n 'skyux_lookup_show_more_clear_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <sky-checkbox\n [(checked)]=\"onlyShowSelected\"\n (change)=\"updateDataState()\"\n >\n <sky-checkbox-label>\n {{\n 'skyux_lookup_show_more_show_selected_option_title'\n | skyLibResources\n }}\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n </div>\n <div\n *ngIf=\"displayedItems.length === 0\"\n class=\"sky-font-deemphasized sky-lookup-show-more-no-results\"\n >\n {{ 'skyux_lookup_show_more_no_results' | skyLibResources }}\n </div>\n <sky-repeater class=\"sky-lookup-show-more-repeater\" expandMode=\"none\">\n <sky-repeater-item\n *ngFor=\"let item of displayedItems\"\n [selectable]=\"context.selectMode === 'multiple'\"\n [(isSelected)]=\"item.selected\"\n (click)=\"itemClick(item)\"\n (keyup.enter)=\"itemClick(item)\"\n (isSelectedChange)=\"onItemSelect($event, item)\"\n >\n <sky-repeater-item-content>\n <ng-container\n *ngTemplateOutlet=\"\n repeaterItemTemplate ?? defaultItemTemplate;\n context: { item: item.value }\n \"\n >\n </ng-container>\n </sky-repeater-item-content>\n </sky-repeater-item>\n </sky-repeater>\n <sky-infinite-scroll\n [enabled]=\"itemsHaveMore\"\n [loading]=\"itemsLoading\"\n (scrollEnd)=\"addItems()\"\n >\n </sky-infinite-scroll>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n class=\"sky-btn sky-btn-primary sky-margin-inline-compact sky-lookup-show-more-modal-save\"\n type=\"button\"\n (click)=\"modalInstance.save(selectedItems)\"\n >\n {{ 'skyux_lookup_show_more_select' | skyLibResources }}\n </button>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-close\"\n type=\"button\"\n (click)=\"modalInstance.close()\"\n >\n {{ 'skyux_lookup_show_more_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n\n<ng-template let-item=\"item\" #defaultItemTemplate>\n {{ item[context.descriptorProperty] }}\n</ng-template>\n\n<ng-template #defaultTitle>\n <ng-container *ngIf=\"context.selectMode === 'single'\">\n {{ 'skyux_lookup_show_more_modal_title_single' | skyLibResources }}\n </ng-container>\n <ng-container *ngIf=\"context.selectMode === 'multiple'\">\n {{ 'skyux_lookup_show_more_modal_title_multiple' | skyLibResources }}\n </ng-container>\n</ng-template>\n", styles: [".sky-lookup-show-more-no-results{padding:20px 0}:host-context(.sky-theme-modern) .sky-lookup-show-more-no-results{padding:30px 0}.sky-theme-modern .sky-lookup-show-more-no-results{padding:30px 0}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i5.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "indeterminate", "required"], outputs: ["change", "checkedChange", "disabledChange", "indeterminateChange"] }, { kind: "component", type: i5.λ4, selector: "sky-checkbox-label" }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "component", type: i7.λ6, selector: "sky-infinite-scroll", inputs: ["enabled", "loading"], outputs: ["scrollEnd"] }, { kind: "component", type: i1$1.λ5, selector: "sky-modal", inputs: ["formErrors", "ariaRole", "tiledBody", "ariaDescribedBy", "ariaLabelledBy"] }, { kind: "component", type: i1$1.λ2, selector: "sky-modal-content" }, { kind: "component", type: i1$1.λ3, selector: "sky-modal-footer" }, { kind: "component", type: i1$1.λ4, selector: "sky-modal-header" }, { kind: "component", type: i7.λ11, selector: "sky-repeater", inputs: ["activeIndex", "ariaLabel", "reorderable", "expandMode"], outputs: ["activeIndexChange", "orderChange"] }, { kind: "component", type: i7.λ10, selector: "sky-repeater-item", inputs: ["disabled", "itemName", "inlineFormConfig", "inlineFormTemplate", "isExpanded", "isSelected", "reorderable", "selectable", "showInlineForm", "tag"], outputs: ["collapse", "expand", "inlineFormClose", "isSelectedChange"] }, { kind: "component", type: i7.λ8, selector: "sky-repeater-item-content" }, { kind: "component", type: SkySearchComponent, selector: "sky-search", inputs: ["searchText", "expandMode", "debounceTime", "disabled", "placeholderText"], outputs: ["searchApply", "searchChange", "searchClear"] }, { kind: "directive", type: i8.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "component", type: i10.λ37, selector: "sky-toolbar" }, { kind: "component", type: i10.λ39, selector: "sky-toolbar-item" }, { kind: "component", type: i10.λ38, selector: "sky-toolbar-section" }, { kind: "component", type: i10.λ40, selector: "sky-toolbar-view-actions" }, { kind: "directive", type: i1.λ3, selector: "[skyViewkeeper]", inputs: ["skyViewkeeper"] }, { kind: "pipe", type: i4$1.SkyLibResourcesPipe, name: "skyLibResources" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2666
+ }
2667
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupShowMoreModalComponent, decorators: [{
2668
+ type: Component,
2669
+ args: [{ selector: 'skyux-lookup-show-more-modal', changeDetection: ChangeDetectionStrategy.OnPush, template: "<sky-modal\n class=\"sky-lookup-show-more-modal\"\n [attr.id]=\"id\"\n [ngClass]=\"'sky-lookup-show-more-modal-' + context.selectMode\"\n>\n <sky-modal-header>\n <ng-container *ngIf=\"context.userConfig?.title; else defaultTitle\">\n {{ context.userConfig.title }}\n </ng-container>\n </sky-modal-header>\n <sky-modal-content\n [skyViewkeeper]=\"['.sky-lookup-show-more-toolbar-wrapper']\"\n >\n <div class=\"sky-lookup-show-more-toolbar-wrapper\">\n <sky-toolbar class=\"sky-lookup-show-more-modal-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-search\n [debounceTime]=\"250\"\n [searchText]=\"searchText\"\n (searchApply)=\"searchApplied($event)\"\n >\n </sky-search>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <button\n *ngIf=\"context.showAddButton\"\n type=\"button\"\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-add\"\n (click)=\"addButtonClicked()\"\n >\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"add\"\n iconType=\"skyux\"\n ></sky-icon>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"plus-circle\"></sky-icon>\n {{ 'skyux_lookup_show_more_add' | skyLibResources }}\n </button>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n <sky-toolbar\n *ngIf=\"context.selectMode === 'multiple'\"\n class=\"sky-lookup-show-more-modal-multiselect-toolbar\"\n >\n <sky-toolbar-section>\n <sky-toolbar-item>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-select-all-btn\"\n type=\"button\"\n (click)=\"selectAll()\"\n >\n {{\n 'skyux_lookup_show_more_select_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-clear-all-btn\"\n type=\"button\"\n (click)=\"clearAll()\"\n >\n {{\n 'skyux_lookup_show_more_clear_all_button_title'\n | skyLibResources\n }}\n </button>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <sky-checkbox\n [(checked)]=\"onlyShowSelected\"\n (change)=\"updateDataState()\"\n >\n <sky-checkbox-label>\n {{\n 'skyux_lookup_show_more_show_selected_option_title'\n | skyLibResources\n }}\n </sky-checkbox-label>\n </sky-checkbox>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n </sky-toolbar>\n </div>\n <div\n *ngIf=\"displayedItems.length === 0\"\n class=\"sky-font-deemphasized sky-lookup-show-more-no-results\"\n >\n {{ 'skyux_lookup_show_more_no_results' | skyLibResources }}\n </div>\n <sky-repeater class=\"sky-lookup-show-more-repeater\" expandMode=\"none\">\n <sky-repeater-item\n *ngFor=\"let item of displayedItems\"\n [selectable]=\"context.selectMode === 'multiple'\"\n [(isSelected)]=\"item.selected\"\n (click)=\"itemClick(item)\"\n (keyup.enter)=\"itemClick(item)\"\n (isSelectedChange)=\"onItemSelect($event, item)\"\n >\n <sky-repeater-item-content>\n <ng-container\n *ngTemplateOutlet=\"\n repeaterItemTemplate ?? defaultItemTemplate;\n context: { item: item.value }\n \"\n >\n </ng-container>\n </sky-repeater-item-content>\n </sky-repeater-item>\n </sky-repeater>\n <sky-infinite-scroll\n [enabled]=\"itemsHaveMore\"\n [loading]=\"itemsLoading\"\n (scrollEnd)=\"addItems()\"\n >\n </sky-infinite-scroll>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n class=\"sky-btn sky-btn-primary sky-margin-inline-compact sky-lookup-show-more-modal-save\"\n type=\"button\"\n (click)=\"modalInstance.save(selectedItems)\"\n >\n {{ 'skyux_lookup_show_more_select' | skyLibResources }}\n </button>\n <button\n class=\"sky-btn sky-btn-link sky-lookup-show-more-modal-close\"\n type=\"button\"\n (click)=\"modalInstance.close()\"\n >\n {{ 'skyux_lookup_show_more_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n\n<ng-template let-item=\"item\" #defaultItemTemplate>\n {{ item[context.descriptorProperty] }}\n</ng-template>\n\n<ng-template #defaultTitle>\n <ng-container *ngIf=\"context.selectMode === 'single'\">\n {{ 'skyux_lookup_show_more_modal_title_single' | skyLibResources }}\n </ng-container>\n <ng-container *ngIf=\"context.selectMode === 'multiple'\">\n {{ 'skyux_lookup_show_more_modal_title_multiple' | skyLibResources }}\n </ng-container>\n</ng-template>\n", styles: [".sky-lookup-show-more-no-results{padding:20px 0}:host-context(.sky-theme-modern) .sky-lookup-show-more-no-results{padding:30px 0}.sky-theme-modern .sky-lookup-show-more-no-results{padding:30px 0}\n"] }]
2670
+ }], ctorParameters: function () { return [{ type: i1$1.SkyModalInstance }, { type: SkyLookupShowMoreNativePickerContext }, { type: i0.ChangeDetectorRef }, { type: i1.SkyIdService }]; } });
2671
+
2672
+ /**
2673
+ * @internal
2674
+ */
2675
+ class SkyLookupAdapterService {
2676
+ focusInput(elRef) {
2677
+ const inputEl = elRef.nativeElement.querySelector('.sky-lookup-input');
2678
+ /* Sanity check */
2679
+ /* istanbul ignore else */
2680
+ if (inputEl) {
2681
+ inputEl.focus();
2682
+ }
2683
+ }
2684
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2685
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupAdapterService }); }
2686
+ }
2687
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupAdapterService, decorators: [{
2688
+ type: Injectable
2689
+ }] });
2690
+
2691
+ /**
2692
+ * @internal
2693
+ */
2694
+ class SkyLookupAutocompleteAdapter {
2695
+ constructor() {
2696
+ /**
2697
+ * Fires when users enter new search information and allows results to be
2698
+ * returned via an observable.
2699
+ */
2700
+ this.searchAsync = new EventEmitter();
2701
+ this.searchOrDefault = skyAutocompleteDefaultSearchFunction({
2702
+ propertiesToSearch: ['name'],
2703
+ searchFilters: undefined,
2704
+ });
2705
+ this.#_descriptorProperty = 'name';
2706
+ this.#_propertiesToSearch = ['name'];
2707
+ }
2708
+ /**
2709
+ * The object property to display in the text input after users
2710
+ * select an item in the dropdown list.
2711
+ * @default "name"
2712
+ */
2713
+ set descriptorProperty(value) {
2714
+ this.#_descriptorProperty = value || 'name';
2715
+ }
2716
+ get descriptorProperty() {
2717
+ return this.#_descriptorProperty;
2718
+ }
2719
+ /**
2720
+ * The array of object properties to search.
2721
+ * @default ["name"]
2722
+ */
2723
+ set propertiesToSearch(value) {
2724
+ this.#_propertiesToSearch = value ?? ['name'];
2725
+ this.#updateDefaultSearchOptions();
2726
+ }
2727
+ get propertiesToSearch() {
2728
+ return this.#_propertiesToSearch;
2729
+ }
2730
+ /**
2731
+ * The function to dynamically manage the data source when users
2732
+ * change the text in the lookup field. The search function must return
2733
+ * an array or a promise of an array. The `search` property is particularly
2734
+ * useful when the data source does not live in the source code. If the
2735
+ * search requires calling a remote data source, use `searchAsync` instead of
2736
+ * `search`.
2737
+ */
2738
+ set search(value) {
2739
+ this.#_search = value;
2740
+ this.searchOrDefault =
2741
+ value ||
2742
+ skyAutocompleteDefaultSearchFunction({
2743
+ propertiesToSearch: this.propertiesToSearch,
2744
+ searchFilters: this.searchFilters,
2745
+ });
2746
+ }
2747
+ get search() {
2748
+ return this.#_search;
2749
+ }
2750
+ /**
2751
+ * The array of functions to call against each search result in order
2752
+ * to filter the search results when using the default search function. When
2753
+ * using a custom search function via the `search` property filters must be
2754
+ * applied manually inside that function. The function must return `true` or
2755
+ * `false` for each result to indicate whether to display it in the dropdown list.
2756
+ */
2757
+ set searchFilters(value) {
2758
+ this.#_searchFilters = value;
2759
+ this.#updateDefaultSearchOptions();
2760
+ }
2761
+ get searchFilters() {
2762
+ return this.#_searchFilters;
2763
+ }
2764
+ #_descriptorProperty;
2765
+ #_propertiesToSearch;
2766
+ #_search;
2767
+ #_searchFilters;
2768
+ #updateDefaultSearchOptions() {
2769
+ // Reset default search if it is what is being used.
2770
+ if (this.search !== this.searchOrDefault) {
2771
+ this.searchOrDefault = skyAutocompleteDefaultSearchFunction({
2772
+ propertiesToSearch: this.propertiesToSearch,
2773
+ searchFilters: this.searchFilters,
2774
+ });
2775
+ }
2776
+ }
2777
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupAutocompleteAdapter, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2778
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.7", type: SkyLookupAutocompleteAdapter, inputs: { debounceTime: "debounceTime", descriptorProperty: "descriptorProperty", propertiesToSearch: "propertiesToSearch", search: "search", searchResultTemplate: "searchResultTemplate", searchTextMinimumCharacters: "searchTextMinimumCharacters", searchFilters: "searchFilters", searchResultsLimit: "searchResultsLimit" }, outputs: { searchAsync: "searchAsync" }, ngImport: i0 }); }
2779
+ }
2780
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupAutocompleteAdapter, decorators: [{
2781
+ type: Directive
2782
+ }], propDecorators: { debounceTime: [{
2783
+ type: Input
2784
+ }], descriptorProperty: [{
2785
+ type: Input
2786
+ }], propertiesToSearch: [{
2787
+ type: Input
2788
+ }], search: [{
2789
+ type: Input
2790
+ }], searchResultTemplate: [{
2791
+ type: Input
2792
+ }], searchTextMinimumCharacters: [{
2793
+ type: Input
2794
+ }], searchFilters: [{
2795
+ type: Input
2796
+ }], searchResultsLimit: [{
2797
+ type: Input
2798
+ }], searchAsync: [{
2799
+ type: Output
2800
+ }] } });
2801
+
2802
+ /**
2803
+ * Represents an instance of a selection modal.
2804
+ */
2805
+ class SkySelectionModalInstance {
2806
+ /**
2807
+ * An event that the selection modal instance emits when it closes.
2808
+ * It emits a `SkySelectionModalCloseArgs` object with a `selectedItems` property that includes
2809
+ * items selected by users on close or save and a `reason` property that indicates
2810
+ * whether the selection modal was saved or closed without saving.
2811
+ * The `reason` property accepts `"cancel"`, `"close"`, and `"save"`.
2812
+ */
2813
+ get closed() {
2814
+ return this.#closedObs;
2815
+ }
2816
+ /**
2817
+ * @internal
2818
+ */
2819
+ get itemAdded() {
2820
+ return this.#itemAddedObs;
2821
+ }
2822
+ #closed = new Subject();
2823
+ #closedObs;
2824
+ #itemAdded = new Subject();
2825
+ #itemAddedObs;
2826
+ constructor(id) {
2827
+ this.id = id;
2828
+ this.#closedObs = this.#closed.asObservable();
2829
+ this.#itemAddedObs = this.#itemAdded.asObservable();
2830
+ }
2831
+ /**
2832
+ * @internal
2833
+ */
2834
+ close(args) {
2835
+ this.#closed.next(args);
2836
+ this.#closed.complete();
2837
+ }
2838
+ /**
2839
+ * @internal
2840
+ */
2841
+ addItem(itemToAdd) {
2842
+ this.#itemAdded.next(itemToAdd);
2843
+ }
2844
+ }
2845
+
2846
+ /**
2847
+ * Displays a modal for selecting one or more values.
2848
+ */
2849
+ class SkySelectionModalService {
2850
+ #modalSvc;
2851
+ constructor(modalSvc) {
2852
+ this.#modalSvc = modalSvc;
2853
+ }
2854
+ /**
2855
+ * Opens the selection modal.
2856
+ * @param args Parameters for the selection modal.
2857
+ */
2858
+ open(args) {
2859
+ const initialValue = args.value;
2860
+ const context = new SkySelectionModalContext(args.descriptorProperty, args.idProperty, args.initialSearch || '', initialValue || [], (searchArgs) => {
2861
+ return args.searchAsync({
2862
+ offset: searchArgs.offset,
2863
+ searchText: searchArgs.searchText,
2864
+ continuationData: searchArgs.continuationData,
2865
+ });
2866
+ }, args.selectMode, args.showAddButton || false, {
2867
+ itemTemplate: args.itemTemplate,
2868
+ title: args.title,
2869
+ });
2870
+ const modalInstance = this.#modalSvc.open(SkySelectionModalComponent, {
2871
+ providers: [
2872
+ {
2873
+ provide: SkySelectionModalContext,
2874
+ useValue: context,
2875
+ },
2876
+ ],
2877
+ size: 'large',
2878
+ wrapperClass: args.wrapperClass,
2879
+ });
2880
+ const instance = new SkySelectionModalInstance(modalInstance.componentInstance.id);
2881
+ instance.itemAdded
2882
+ .pipe(takeUntil(modalInstance.closed))
2883
+ .subscribe((item) => {
2884
+ modalInstance.componentInstance.addItem(item);
2885
+ });
2886
+ modalInstance.closed.subscribe((modalCloseArgs) => {
2887
+ let closeArgs;
2888
+ switch (modalCloseArgs.reason) {
2889
+ case 'save':
2890
+ closeArgs = {
2891
+ reason: 'save',
2892
+ selectedItems: modalCloseArgs.data.map((item) => item.itemData),
2893
+ };
2894
+ break;
2895
+ case 'cancel':
2896
+ closeArgs = { reason: 'cancel' };
2897
+ break;
2898
+ default:
2899
+ closeArgs = { reason: 'close' };
2900
+ }
2901
+ instance.close(closeArgs);
2902
+ });
2903
+ const selectionModal = modalInstance.componentInstance;
2904
+ selectionModal.addClick
2905
+ .pipe(takeUntil(modalInstance.closed))
2906
+ .subscribe(() => {
2907
+ if (args.addClick) {
2908
+ const addArgs = {
2909
+ itemAdded(args) {
2910
+ selectionModal.addItem(args.item);
2911
+ },
2912
+ };
2913
+ args.addClick(addArgs);
2914
+ }
2915
+ });
2916
+ return instance;
2917
+ }
2918
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalService, deps: [{ token: i1$1.SkyModalService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2919
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalService, providedIn: 'any' }); }
2920
+ }
2921
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkySelectionModalService, decorators: [{
2922
+ type: Injectable,
2923
+ args: [{
2924
+ providedIn: 'any',
2925
+ }]
2926
+ }], ctorParameters: function () { return [{ type: i1$1.SkyModalService }]; } });
2927
+
2928
+ class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
2929
+ /**
2930
+ * The data source for the lookup component to search when users
2931
+ * enter text. You can specify static data such as an array of objects, or
2932
+ * you can pull data from a database.
2933
+ * @default []
2934
+ */
2935
+ set data(value) {
2936
+ this.#_data = value;
2937
+ if (this.#openNativePicker && !this.#hasSearchAsync()) {
2938
+ this.#openNativePicker.componentInstance.updateItemData(value);
2939
+ }
2940
+ }
2941
+ get data() {
2942
+ return this.#_data || [];
2943
+ }
2944
+ /**
2945
+ * Whether to disable the lookup field on template-driven forms. Don't use this input on reactive forms because they may overwrite the input or leave the control out of sync.
2946
+ * To set the disabled state on reactive forms, use the `FormControl` instead.
2947
+ * @default false
2948
+ */
2949
+ set disabled(value) {
2950
+ this.#_disabled = value ?? false;
2951
+ }
2952
+ get disabled() {
2953
+ return this.#_disabled;
2954
+ }
2955
+ /**
2956
+ * Whether to enable users to open a picker where they can view all options.
2957
+ * @default false
2958
+ */
2959
+ set enableShowMore(value) {
2960
+ this.#_enableShowMore = value ?? false;
2961
+ }
2962
+ get enableShowMore() {
2963
+ return this.#_enableShowMore;
2964
+ }
2965
+ /**
2966
+ * Whether to display a button that lets users add options to the list.
2967
+ * @default false
2968
+ */
2969
+ set showAddButton(value) {
2970
+ this.#_showAddButton = value ?? false;
2971
+ }
2972
+ get showAddButton() {
2973
+ return this.#_showAddButton;
2974
+ }
2975
+ /**
2976
+ * The ability for users to select one option or multiple options.
2977
+ * @default "multiple"
2978
+ */
2979
+ set selectMode(value) {
2980
+ const multipleToSingle = value === 'single' && this.selectMode === 'multiple';
2981
+ this.#_selectMode = value;
2982
+ this.#updateForSelectMode();
2983
+ if (multipleToSingle) {
2984
+ if (this.value && this.value.length > 1) {
2985
+ // The `setTimeout` is needed to avoid a `ExpressionChangedAfterItHasBeenCheckedError` error in template forms.
2986
+ setTimeout(() => {
2987
+ this.writeValue([this.value[0]]);
2988
+ this.#changeDetector.detectChanges();
2989
+ });
2990
+ }
2991
+ }
2992
+ }
2993
+ get selectMode() {
2994
+ return this.#_selectMode || 'multiple';
2995
+ }
2996
+ get tokens() {
2997
+ return this.#_tokens;
2998
+ }
2999
+ set tokens(value) {
3000
+ // Collapse the tokens into a single token if the user has selected many options.
3001
+ if (this.enableShowMore && this.value.length > 5) {
3002
+ this.#resourcesService
3003
+ .getString('skyux_lookup_tokens_summary', this.value.length.toString())
3004
+ .pipe(take(1))
3005
+ .subscribe((label) => {
3006
+ this.#_tokens = [
3007
+ {
3008
+ value: { [this.descriptorProperty]: label },
3009
+ },
3010
+ ];
3011
+ this.#changeDetector.markForCheck();
3012
+ });
3013
+ }
3014
+ else {
3015
+ this.#_tokens = value;
3016
+ this.#changeDetector.markForCheck();
3017
+ }
3018
+ }
3019
+ get value() {
3020
+ return this.#_value ? this.#_value : [];
3021
+ }
3022
+ set value(newValue) {
3023
+ this.#_value = newValue;
3024
+ if (!this.#pickerModalOpen()) {
3025
+ this.tokens = this.#parseTokens(newValue);
3026
+ }
3027
+ this.onChange(this.#_value);
3028
+ this.onTouched();
3029
+ }
3030
+ set autocompleteInputDirective(value) {
3031
+ this.#_autocompleteInputDirective = value;
3032
+ this.#updateForSelectMode();
3033
+ }
3034
+ get autocompleteInputDirective() {
3035
+ return this.#_autocompleteInputDirective;
3036
+ }
3037
+ #adapter;
3038
+ #elementRef;
3039
+ #changeDetector;
3040
+ #idle;
3041
+ #markForTokenFocusOnKeyUp;
3042
+ #modalService;
3043
+ #ngUnsubscribe;
3044
+ #openNativePicker;
3045
+ #openSelectionModal;
3046
+ #resourcesService;
3047
+ #selectionModalSvc;
3048
+ #windowRef;
3049
+ #logSvc;
3050
+ #_autocompleteInputDirective;
3051
+ #_data;
3052
+ #_disabled;
3053
+ #_enableShowMore;
3054
+ #_selectMode;
3055
+ #_showAddButton;
3056
+ #_tokens;
3057
+ #_value;
3058
+ constructor(changeDetector, elementRef, windowRef, adapter, modalService, resourcesService, selectionModalSvc, logSvc, ngControl, inputBoxHostSvc, themeSvc) {
3059
+ super();
3060
+ this.inputBoxHostSvc = inputBoxHostSvc;
3061
+ this.themeSvc = themeSvc;
3062
+ /**
3063
+ * Fires when users select the button to add options to the list.
3064
+ */
3065
+ this.addClick = new EventEmitter();
3066
+ this.autocompleteController = new Subject();
3067
+ this.isInputFocused = false;
3068
+ this.tokensController = new Subject();
3069
+ this.#idle = new Subject();
3070
+ this.#markForTokenFocusOnKeyUp = false;
3071
+ this.#ngUnsubscribe = new Subject();
3072
+ this.#_disabled = false;
3073
+ this.#_enableShowMore = false;
3074
+ this.#_showAddButton = false;
3075
+ // Angular automatically constructs these methods.
3076
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3077
+ this.onChange = (value) => { };
3078
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3079
+ this.onTouched = () => { };
3080
+ this.#changeDetector = changeDetector;
3081
+ this.#elementRef = elementRef;
3082
+ this.#windowRef = windowRef;
3083
+ this.#adapter = adapter;
3084
+ this.#modalService = modalService;
3085
+ this.#resourcesService = resourcesService;
3086
+ this.#selectionModalSvc = selectionModalSvc;
3087
+ this.#logSvc = logSvc;
3088
+ if (ngControl) {
3089
+ ngControl.valueAccessor = this;
3090
+ }
3091
+ }
3092
+ ngOnInit() {
3093
+ if (this.inputBoxHostSvc && this.inputTemplateRef) {
3094
+ this.controlId = this.inputBoxHostSvc.controlId;
3095
+ this.inputBoxHostSvc.populate({
3096
+ inputTemplate: this.inputTemplateRef,
3097
+ buttonsTemplate: this.enableShowMore
3098
+ ? this.showMoreButtonTemplateRef
3099
+ : undefined,
3100
+ iconsInsetTemplate: this.enableShowMore
3101
+ ? undefined
3102
+ : this.searchIconTemplateRef,
3103
+ });
3104
+ }
3105
+ /* istanbul ignore else */
3106
+ if (this.themeSvc) {
3107
+ // This is required for the autocomplete directive to be set after elements
3108
+ // are rearranged when switching themes.
3109
+ this.themeSvc.settingsChange
3110
+ .pipe(takeUntil(this.#ngUnsubscribe))
3111
+ .subscribe(() => {
3112
+ this.#changeDetector.markForCheck();
3113
+ });
3114
+ }
3115
+ }
3116
+ ngAfterViewInit() {
3117
+ if (!this.disabled) {
3118
+ this.#addEventListeners();
3119
+ }
3120
+ }
3121
+ ngOnDestroy() {
3122
+ this.#removeEventListeners();
3123
+ this.#ngUnsubscribe.next();
3124
+ this.#ngUnsubscribe.complete();
3125
+ this.tokensController.complete();
3126
+ }
3127
+ addButtonClicked() {
3128
+ this.addClick.emit({
3129
+ itemAdded: (args) => this.#onAddButtonComplete(args),
3130
+ });
3131
+ }
3132
+ onAutocompleteSelectionChange(change) {
3133
+ /* istanbul ignore else */
3134
+ if (change.selectedItem) {
3135
+ this.#addToSelected(change.selectedItem);
3136
+ }
3137
+ else if (this.selectMode === 'single') {
3138
+ this.writeValue([]);
3139
+ }
3140
+ }
3141
+ onAutocompleteBlur() {
3142
+ this.onTouched();
3143
+ }
3144
+ onTokensChange(change) {
3145
+ if (!change) {
3146
+ return;
3147
+ }
3148
+ if (this.tokens !== change) {
3149
+ if (change.length === 0) {
3150
+ this.#focusInput();
3151
+ }
3152
+ // NOTE: We do this here instead of just using the `value` setter because we need to use the
3153
+ // set of tokens returned here for the purposes of setting focus (see `onTokensKeyUp`).
3154
+ this.#_value = change.map((token) => {
3155
+ return token.value;
3156
+ });
3157
+ this.tokens = change;
3158
+ this.onChange(this.#_value);
3159
+ this.onTouched();
3160
+ }
3161
+ }
3162
+ onTokensFocusIndexOverRange() {
3163
+ this.#windowRef.nativeWindow.setTimeout(() => {
3164
+ this.#focusInput();
3165
+ });
3166
+ }
3167
+ onTokensKeyUp(event) {
3168
+ /* istanbul ignore else */
3169
+ if (this.selectMode !== 'single') {
3170
+ switch (event.key) {
3171
+ case 'Backspace':
3172
+ this.#sendTokensMessage(SkyTokensMessageType.RemoveActiveToken);
3173
+ this.#sendTokensMessage(SkyTokensMessageType.FocusPreviousToken);
3174
+ event.preventDefault();
3175
+ break;
3176
+ case 'Del':
3177
+ case 'Delete':
3178
+ this.#sendTokensMessage(SkyTokensMessageType.RemoveActiveToken);
3179
+ this.#windowRef.nativeWindow.setTimeout(() => {
3180
+ this.#sendTokensMessage(SkyTokensMessageType.FocusActiveToken);
3181
+ });
3182
+ event.preventDefault();
3183
+ break;
3184
+ }
3185
+ }
3186
+ }
3187
+ onTokensRendered() {
3188
+ this.#sendAutocompleteMessage(SkyAutocompleteMessageType.RepositionDropdown);
3189
+ }
3190
+ writeValue(value) {
3191
+ // Since we are dealing with arrays - clone the array being sent in to ensure we aren't modifying a consumers outer array
3192
+ this.value = value ? value.slice() : [];
3193
+ this.#updateForSelectMode();
3194
+ }
3195
+ registerOnChange(fn) {
3196
+ this.onChange = fn;
3197
+ }
3198
+ registerOnTouched(fn) {
3199
+ this.onTouched = fn;
3200
+ }
3201
+ // Allows Angular to disable the input.
3202
+ setDisabledState(disabled) {
3203
+ this.#removeEventListeners();
3204
+ if (!disabled) {
3205
+ this.#addEventListeners();
3206
+ }
3207
+ this.disabled = disabled;
3208
+ this.#changeDetector.markForCheck();
3209
+ }
3210
+ clearSearchText() {
3211
+ if (this.autocompleteInputDirective) {
3212
+ this.autocompleteInputDirective.value = undefined;
3213
+ this.autocompleteInputDirective.inputTextValue = '';
3214
+ }
3215
+ }
3216
+ // Handles when to focus on the tokens.
3217
+ // Check for empty search text on keydown, before the escape key is fully pressed.
3218
+ // (Otherwise, a single character being escaped would register as empty on keyup.)
3219
+ // If empty on keydown, set a flag so that the appropriate action can be taken on keyup.
3220
+ inputKeydown(event) {
3221
+ const value = event.target.value;
3222
+ /* Sanity check as this should only be called when in multiple select mode */
3223
+ /* istanbul ignore else */
3224
+ if (this.selectMode !== 'single') {
3225
+ switch (event.key) {
3226
+ case 'Enter':
3227
+ event.preventDefault();
3228
+ break;
3229
+ case 'ArrowLeft':
3230
+ case 'Backspace':
3231
+ case 'Left':
3232
+ if (value) {
3233
+ this.#markForTokenFocusOnKeyUp = false;
3234
+ }
3235
+ else {
3236
+ this.#markForTokenFocusOnKeyUp = true;
3237
+ }
3238
+ break;
3239
+ default:
3240
+ }
3241
+ }
3242
+ }
3243
+ inputKeyup(event) {
3244
+ /* Sanity check as this should only be called when in multiple select mode */
3245
+ /* istanbul ignore else */
3246
+ if (this.selectMode !== 'single') {
3247
+ switch (event.key) {
3248
+ case 'Esc':
3249
+ case 'Escape':
3250
+ this.clearSearchText();
3251
+ event.preventDefault();
3252
+ break;
3253
+ case 'ArrowLeft':
3254
+ case 'Backspace':
3255
+ case 'Left':
3256
+ /* istanbul ignore else */
3257
+ if (this.#markForTokenFocusOnKeyUp) {
3258
+ this.#sendTokensMessage(SkyTokensMessageType.FocusLastToken);
3259
+ event.preventDefault();
3260
+ }
3261
+ break;
3262
+ default:
3263
+ }
3264
+ event.stopPropagation();
3265
+ }
3266
+ }
3267
+ onSearchButtonClick() {
3268
+ /*istanbul ignore next*/
3269
+ if (this.disabled) {
3270
+ return;
3271
+ }
3272
+ this.#sendAutocompleteMessage(SkyAutocompleteMessageType.CloseDropdown);
3273
+ let isValueInTextBox = false;
3274
+ if (this.selectMode === 'single') {
3275
+ isValueInTextBox =
3276
+ this.autocompleteInputDirective?.value &&
3277
+ this.autocompleteInputDirective.inputTextValue ===
3278
+ this.autocompleteInputDirective.value[this.descriptorProperty];
3279
+ }
3280
+ let searchValue = '';
3281
+ if (!isValueInTextBox && this.autocompleteInputDirective) {
3282
+ searchValue = this.autocompleteInputDirective.inputTextValue;
3283
+ }
3284
+ this.openPicker(searchValue);
3285
+ this.autocompleteInputDirective?.restoreInputTextValueToPreviousState();
3286
+ }
3287
+ onShowMoreClick(event) {
3288
+ /* Sanity check */
3289
+ /* istanbul ignore else*/
3290
+ if (event) {
3291
+ this.openPicker(event.inputValue);
3292
+ }
3293
+ }
3294
+ openPicker(initialSearch) {
3295
+ if (this.showMoreConfig?.customPicker) {
3296
+ this.showMorePickerId = undefined;
3297
+ this.showMoreConfig.customPicker.open({
3298
+ items: this.data,
3299
+ initialSearch,
3300
+ initialValue: this.value,
3301
+ });
3302
+ }
3303
+ else {
3304
+ const initialValue = this.value;
3305
+ if (this.#hasSearchAsync()) {
3306
+ this.#openSelectionModal =
3307
+ this.#createSelectionModalInstance(initialSearch);
3308
+ this.showMorePickerId = this.#openSelectionModal.id;
3309
+ this.#openSelectionModal.closed.subscribe((closeArgs) => {
3310
+ this.#processPickerResult(closeArgs.reason === 'save' ? closeArgs.selectedItems : initialValue);
3311
+ });
3312
+ }
3313
+ else {
3314
+ this.#openNativePicker =
3315
+ this.#createNativePickerInstance(initialSearch);
3316
+ this.showMorePickerId = this.#openNativePicker.componentInstance.id;
3317
+ this.#openNativePicker.componentInstance.addClick.subscribe(() => {
3318
+ this.addButtonClicked();
3319
+ });
3320
+ this.#openNativePicker.closed.subscribe((closeArgs) => {
3321
+ let selectedItems;
3322
+ if (closeArgs.reason === 'save') {
3323
+ selectedItems = [];
3324
+ this.data.forEach((item, dataIndex) => {
3325
+ if (closeArgs.data.some((savedItem) => {
3326
+ return savedItem.index === dataIndex;
3327
+ })) {
3328
+ selectedItems.push(item);
3329
+ }
3330
+ });
3331
+ }
3332
+ else {
3333
+ selectedItems = initialValue;
3334
+ }
3335
+ this.#processPickerResult(selectedItems);
3336
+ });
3337
+ this.#changeDetector.markForCheck();
3338
+ }
3339
+ }
3340
+ }
3341
+ #createSelectionModalInstance(initialSearch) {
3342
+ const initialValue = this.value;
3343
+ const modalConfig = this.showMoreConfig?.nativePickerConfig || {};
3344
+ if (!modalConfig.itemTemplate) {
3345
+ modalConfig.itemTemplate = this.searchResultTemplate;
3346
+ }
3347
+ if (this.idProperty === undefined) {
3348
+ this.#logSvc.error("The lookup component's 'idProperty' input is required when `enableShowMore` and 'searchAsync' are used together.");
3349
+ }
3350
+ return this.#selectionModalSvc.open({
3351
+ descriptorProperty: this.descriptorProperty,
3352
+ idProperty: this.idProperty,
3353
+ searchAsync: (args) => {
3354
+ const searchAsyncArgs = {
3355
+ displayType: 'modal',
3356
+ offset: args.offset,
3357
+ searchText: args.searchText,
3358
+ continuationData: args.continuationData,
3359
+ };
3360
+ this.searchAsync.emit(searchAsyncArgs);
3361
+ return searchAsyncArgs.result;
3362
+ },
3363
+ selectMode: this.selectMode,
3364
+ addClick: () => {
3365
+ this.addButtonClicked();
3366
+ },
3367
+ initialSearch,
3368
+ itemTemplate: modalConfig.itemTemplate,
3369
+ showAddButton: this.showAddButton,
3370
+ title: modalConfig.title,
3371
+ value: initialValue,
3372
+ wrapperClass: this.wrapperClass,
3373
+ });
3374
+ }
3375
+ #createNativePickerInstance(initialSearch) {
3376
+ const initialValue = this.value;
3377
+ const modalConfig = this.showMoreConfig?.nativePickerConfig || {};
3378
+ if (!modalConfig.itemTemplate) {
3379
+ modalConfig.itemTemplate = this.searchResultTemplate;
3380
+ }
3381
+ const contextProviderValue = new SkyLookupShowMoreNativePickerContext(this.descriptorProperty, initialSearch, initialValue, this.data, this.searchOrDefault, this.selectMode, this.showAddButton, modalConfig);
3382
+ return this.#modalService.open(SkyLookupShowMoreModalComponent, {
3383
+ providers: [
3384
+ {
3385
+ provide: SkyLookupShowMoreNativePickerContext,
3386
+ useValue: contextProviderValue,
3387
+ },
3388
+ {
3389
+ provide: SkyLookupAdapterService,
3390
+ useValue: this.#adapter,
3391
+ },
3392
+ ],
3393
+ size: 'large',
3394
+ wrapperClass: this.wrapperClass,
3395
+ });
3396
+ }
3397
+ #processPickerResult(selectedItems) {
3398
+ this.#openSelectionModal = undefined;
3399
+ this.#openNativePicker = undefined;
3400
+ this.showMorePickerId = undefined;
3401
+ /* istanbul ignore next */
3402
+ selectedItems = selectedItems || [];
3403
+ this.writeValue(selectedItems);
3404
+ this.#focusInput();
3405
+ this.#changeDetector.markForCheck();
3406
+ }
3407
+ onSearchAsync(args) {
3408
+ this.searchAsync.emit(args);
3409
+ }
3410
+ #addToSelected(item) {
3411
+ let selectedItems;
3412
+ if (this.selectMode === 'single') {
3413
+ selectedItems = [item];
3414
+ }
3415
+ else {
3416
+ selectedItems = this.value;
3417
+ const idProperty = this.idProperty || '';
3418
+ // If items have a unique identifier, don't allow the same item to be added twice.
3419
+ if (!this.idProperty ||
3420
+ !this.value.some((existingItem) => existingItem[idProperty] === item[idProperty])) {
3421
+ selectedItems.push(item);
3422
+ }
3423
+ this.clearSearchText();
3424
+ }
3425
+ this.writeValue(selectedItems);
3426
+ }
3427
+ #addEventListeners() {
3428
+ this.#idle = new Subject();
3429
+ this.#focusInputOnHostClick();
3430
+ }
3431
+ #removeEventListeners() {
3432
+ this.#idle.next();
3433
+ this.#idle.complete();
3434
+ }
3435
+ #focusInputOnHostClick() {
3436
+ let hostElement = !this.inputBoxHostSvc
3437
+ ? this.#elementRef.nativeElement
3438
+ : this.lookupWrapperRef?.nativeElement;
3439
+ const documentObj = this.#windowRef.nativeWindow.document;
3440
+ // Handles focusing the input when the host is clicked.
3441
+ // The input should NOT be focused if other elements (tokens, etc.)
3442
+ // are currently focused or being tabbed through.
3443
+ fromEvent(documentObj, 'mousedown')
3444
+ .pipe(takeUntil(this.#idle))
3445
+ .subscribe((event) => {
3446
+ hostElement = !this.inputBoxHostSvc
3447
+ ? this.#elementRef.nativeElement
3448
+ : this.lookupWrapperRef?.nativeElement;
3449
+ this.isInputFocused = hostElement.contains(event.target);
3450
+ this.#changeDetector.markForCheck();
3451
+ });
3452
+ fromEvent(documentObj, 'focusin')
3453
+ .pipe(takeUntil(this.#idle))
3454
+ .subscribe((event) => {
3455
+ hostElement = !this.inputBoxHostSvc
3456
+ ? this.#elementRef.nativeElement
3457
+ : this.lookupWrapperRef?.nativeElement;
3458
+ this.isInputFocused = hostElement.contains(event.target);
3459
+ this.#changeDetector.markForCheck();
3460
+ });
3461
+ if (hostElement) {
3462
+ fromEvent(hostElement, 'mouseup')
3463
+ .pipe(takeUntil(this.#idle))
3464
+ .subscribe(() => {
3465
+ const classList = documentObj.activeElement.classList;
3466
+ if (!classList || !classList.contains('sky-token')) {
3467
+ this.#focusInput();
3468
+ }
3469
+ });
3470
+ }
3471
+ }
3472
+ #focusInput() {
3473
+ if (this.lookupWrapperRef) {
3474
+ this.#adapter.focusInput(this.lookupWrapperRef);
3475
+ }
3476
+ }
3477
+ #onAddButtonComplete(args) {
3478
+ if (this.#openSelectionModal) {
3479
+ // Notify the selection modal of the new item. The selection
3480
+ // modal will decide whether the new item should be added
3481
+ // to the value when the user confirms or cancels the
3482
+ // selection modal.
3483
+ this.#openSelectionModal.addItem(args.item);
3484
+ }
3485
+ else {
3486
+ let addItemToValue;
3487
+ if (this.#hasSearchAsync()) {
3488
+ addItemToValue = true;
3489
+ }
3490
+ else {
3491
+ if (args.data) {
3492
+ this.data = args.data;
3493
+ }
3494
+ if (this.data.indexOf(args.item) >= 0) {
3495
+ if (this.#openNativePicker) {
3496
+ // Notify the picker of the new item. The picker will
3497
+ // decide whether the new item should be added to the
3498
+ // value when the user confirms or cancels the picker.
3499
+ this.#openNativePicker
3500
+ .componentInstance.onItemSelect(true, { value: args.item, selected: false });
3501
+ }
3502
+ else {
3503
+ addItemToValue = true;
3504
+ }
3505
+ }
3506
+ }
3507
+ if (addItemToValue) {
3508
+ const newValue = this.selectMode === 'multiple'
3509
+ ? this.value.concat(args.item)
3510
+ : [args.item];
3511
+ this.writeValue(newValue);
3512
+ }
3513
+ }
3514
+ }
3515
+ #parseTokens(data) {
3516
+ return data.map((item) => {
3517
+ return {
3518
+ value: item,
3519
+ };
3520
+ });
3521
+ }
3522
+ #sendAutocompleteMessage(type) {
3523
+ this.autocompleteController.next({ type });
3524
+ }
3525
+ #sendTokensMessage(type) {
3526
+ this.tokensController.next({ type });
3527
+ }
3528
+ #updateForSelectMode() {
3529
+ if (this.autocompleteInputDirective) {
3530
+ if (this.selectMode === 'single') {
3531
+ this.autocompleteInputDirective.value = this.value && this.value[0];
3532
+ }
3533
+ else {
3534
+ this.clearSearchText();
3535
+ }
3536
+ }
3537
+ }
3538
+ #hasSearchAsync() {
3539
+ return this.searchAsync.observers.length > 0;
3540
+ }
3541
+ #pickerModalOpen() {
3542
+ return !!(this.#openNativePicker || this.#openSelectionModal);
3543
+ }
3544
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.SkyAppWindowRef }, { token: SkyLookupAdapterService }, { token: i1$1.SkyModalService }, { token: i4$1.SkyLibResourcesService }, { token: SkySelectionModalService }, { token: i1.SkyLogService }, { token: i5$1.NgControl, optional: true, self: true }, { token: i5.SkyInputBoxHostService, optional: true }, { token: i8.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
3545
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyLookupComponent, selector: "sky-lookup", inputs: { ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", autocompleteAttribute: "autocompleteAttribute", data: "data", disabled: "disabled", enableShowMore: "enableShowMore", placeholderText: "placeholderText", idProperty: "idProperty", showAddButton: "showAddButton", showMoreConfig: "showMoreConfig", selectMode: "selectMode", wrapperClass: "wrapperClass" }, outputs: { addClick: "addClick" }, providers: [SkyLookupAdapterService], viewQueries: [{ propertyName: "autocompleteInputDirective", first: true, predicate: SkyAutocompleteInputDirective, descendants: true, read: SkyAutocompleteInputDirective }, { propertyName: "showMoreButtonTemplateRef", first: true, predicate: ["showMoreButtonTemplateRef"], descendants: true, read: TemplateRef, static: true }, { propertyName: "inputTemplateRef", first: true, predicate: ["inputTemplateRef"], descendants: true, read: TemplateRef, static: true }, { propertyName: "lookupWrapperRef", first: true, predicate: ["lookupWrapper"], descendants: true, read: ElementRef }, { propertyName: "searchIconTemplateRef", first: true, predicate: ["searchIconTemplateRef"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"!inputBoxHostSvc\">\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n</ng-container>\n\n<ng-template #inputTemplateRef>\n <div\n class=\"sky-lookup\"\n [ngClass]=\"{\n 'sky-lookup-focused': isInputFocused,\n 'sky-lookup-disabled': disabled,\n 'sky-lookup-single': selectMode === 'single'\n }\"\n #lookupWrapper\n >\n <sky-autocomplete\n [ariaLabelledBy]=\"ariaLabelledBy\"\n [attr.data-sky-lookup-show-more-picker-id]=\"showMorePickerId\"\n [data]=\"data\"\n [debounceTime]=\"debounceTime\"\n [descriptorProperty]=\"descriptorProperty\"\n [enableShowMore]=\"enableShowMore\"\n [messageStream]=\"autocompleteController\"\n [propertiesToSearch]=\"propertiesToSearch\"\n [search]=\"searchOrDefault\"\n [searchAsyncDisabled]=\"searchAsync.observers.length === 0\"\n [searchFilters]=\"searchFilters\"\n [searchResultsLimit]=\"searchResultsLimit\"\n [searchResultTemplate]=\"searchResultTemplate\"\n [searchTextMinimumCharacters]=\"searchTextMinimumCharacters\"\n [showAddButton]=\"showAddButton\"\n [wrapperClass]=\"wrapperClass\"\n (addClick)=\"addButtonClicked()\"\n (searchAsync)=\"onSearchAsync($event)\"\n (selectionChange)=\"onAutocompleteSelectionChange($event)\"\n (showMoreClick)=\"onShowMoreClick($event)\"\n >\n <div class=\"sky-lookup-search-flex-wrapper\">\n <div\n class=\"sky-lookup-search\"\n [ngClass]=\"{\n 'sky-field-status-active': isInputFocused && !disabled\n }\"\n >\n <sky-tokens\n *ngIf=\"selectMode === 'multiple'\"\n class=\"sky-lookup-tokens\"\n [disabled]=\"disabled\"\n [displayWith]=\"descriptorProperty\"\n [focusable]=\"false\"\n [messageStream]=\"tokensController\"\n [trackWith]=\"idProperty\"\n [tokens]=\"tokens\"\n (keyup)=\"onTokensKeyUp($event)\"\n (tokensChange)=\"onTokensChange($event)\"\n (tokensRendered)=\"onTokensRendered()\"\n (tokenSelected)=\"enableShowMore ? openPicker('') : undefined\"\n (focusIndexOverRange)=\"onTokensFocusIndexOverRange()\"\n >\n <textarea\n class=\"sky-form-control sky-lookup-input\"\n rows=\"1\"\n skyAutocomplete\n wrap=\"off\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.id]=\"controlId\"\n [attr.placeholder]=\"placeholderText\"\n [autocompleteAttribute]=\"autocompleteAttribute\"\n [disabled]=\"disabled\"\n (blur)=\"onAutocompleteBlur()\"\n (keydown)=\"inputKeydown($event)\"\n (keyup)=\"inputKeyup($event)\"\n ></textarea>\n <ng-container *ngIf=\"!inputBoxHostSvc && !enableShowMore\">\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplateRef\"\n ></ng-container>\n </ng-container>\n </sky-tokens>\n <div\n *ngIf=\"selectMode === 'single'\"\n class=\"sky-lookup-single-control\"\n >\n <textarea\n class=\"sky-form-control sky-lookup-input\"\n rows=\"1\"\n skyAutocomplete\n wrap=\"off\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.id]=\"controlId\"\n [attr.placeholder]=\"placeholderText\"\n [autocompleteAttribute]=\"autocompleteAttribute\"\n [disabled]=\"disabled\"\n (blur)=\"onAutocompleteBlur()\"\n ></textarea>\n <ng-container *ngIf=\"!inputBoxHostSvc && !enableShowMore\">\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplateRef\"\n ></ng-container>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"!inputBoxHostSvc && enableShowMore\">\n <ng-container\n *ngTemplateOutlet=\"showMoreButtonTemplateRef\"\n ></ng-container>\n </ng-container>\n </div>\n </sky-autocomplete>\n </div>\n</ng-template>\n\n<ng-template #showMoreButtonTemplateRef>\n <div class=\"sky-input-group-btn\">\n <button\n class=\"sky-btn sky-btn-default\"\n [disabled]=\"disabled\"\n [ngClass]=\"{ 'sky-btn-disabled': disabled }\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_lookup_search_button_show_more' | skyLibResources\n \"\n (click)=\"onSearchButtonClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n iconType=\"skyux\"\n icon=\"search\"\n ></sky-icon>\n </button>\n </div>\n</ng-template>\n\n<ng-template #searchIconTemplateRef>\n <div\n class=\"sky-input-group-icon sky-input-box-icon-inset\"\n [ngClass]=\"{ 'sky-lookup-disabled': disabled }\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\"></sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" iconType=\"skyux\" icon=\"search\"></sky-icon>\n </div>\n</ng-template>\n", styles: [".sky-lookup .sky-lookup-input.sky-form-control{resize:none;border:0;box-sizing:content-box;height:1.428571429em;overflow:hidden;padding:0;background-color:transparent}.sky-lookup .sky-lookup-input.sky-form-control:focus{outline:none;box-shadow:none}.sky-lookup .sky-lookup-search-flex-wrapper{display:flex}.sky-lookup.sky-lookup-disabled .sky-lookup-search{background-color:#cdcfd2}.sky-lookup sky-tokens.sky-lookup-tokens:focus{outline:none}.sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-5px;margin-bottom:-5px}.sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-top:5px;padding-bottom:5px;padding-left:10px;flex-basis:100px}.sky-lookup .sky-lookup-single-control{display:inline-flex;padding-left:7px;width:100%}.sky-lookup-search{cursor:text;background-color:#fff;line-height:1.428571429em;padding:6px 12px 6px 3px;flex-grow:1}.sky-lookup-search:not(.sky-field-status-active){border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2}.sky-lookup-disabled .sky-lookup-search{cursor:default}.sky-lookup-focused .sky-tokens-content{flex-basis:100px}.sky-lookup-single sky-tokens.sky-lookup-tokens sky-token{display:none}sky-lookup.ng-invalid.ng-touched .sky-lookup-search{box-shadow:0 0 8px #ef404499;border:1px solid var(--sky-highlight-color-danger);outline:none}sky-input-box .sky-lookup{width:100%}sky-input-box .sky-lookup .sky-lookup-search{border:none;padding-bottom:5px;width:100%}:host-context(.sky-theme-modern) sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-6px}:host-context(.sky-theme-modern) sky-input-box .sky-lookup{margin-top:-26px;padding-top:26px}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens sky-token{z-index:1}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:0;margin-bottom:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens sky-token{padding-bottom:0;padding-top:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-bottom:0;padding-top:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content:first-child{padding-left:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup.sky-lookup-single sky-tokens.sky-lookup-tokens .sky-tokens-content{padding-left:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-search{background-color:transparent;padding:0 0 0 15px}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-search.sky-field-status-active{box-shadow:none}:host-context(.sky-theme-modern) sky-input-box .sky-lookup textarea.sky-lookup-input.sky-form-control{padding-left:0;resize:none}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-single-control{padding-left:0}.sky-theme-modern sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-6px}.sky-theme-modern sky-input-box .sky-lookup{margin-top:-26px;padding-top:26px}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens sky-token{z-index:1}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:0;margin-bottom:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens sky-token{padding-bottom:0;padding-top:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-bottom:0;padding-top:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content:first-child{padding-left:0}.sky-theme-modern sky-input-box .sky-lookup.sky-lookup-single sky-tokens.sky-lookup-tokens .sky-tokens-content{padding-left:0}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-search{background-color:transparent;padding:0 0 0 15px}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-search.sky-field-status-active{box-shadow:none}.sky-theme-modern sky-input-box .sky-lookup textarea.sky-lookup-input.sky-form-control{padding-left:0;resize:none}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-single-control{padding-left:0}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SkyAutocompleteComponent, selector: "sky-autocomplete", inputs: ["ariaLabelledBy", "data", "debounceTime", "descriptorProperty", "enableShowMore", "messageStream", "wrapperClass", "propertiesToSearch", "search", "searchResultTemplate", "searchTextMinimumCharacters", "searchFilters", "searchResultsLimit", "showAddButton", "noResultsFoundText", "searchAsyncDisabled"], outputs: ["addClick", "showMoreClick", "selectionChange", "searchAsync"] }, { kind: "directive", type: SkyAutocompleteInputDirective, selector: "input[skyAutocomplete], textarea[skyAutocomplete]", inputs: ["autocompleteAttribute", "disabled"] }, { kind: "component", type: i6.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i8.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "component", type: i6.λ13, selector: "sky-tokens", inputs: ["disabled", "dismissible", "displayWith", "trackWith", "focusable", "tokens", "messageStream"], outputs: ["focusIndexOverRange", "focusIndexUnderRange", "tokenSelected", "tokensChange", "tokensRendered"] }, { kind: "pipe", type: i4$1.SkyLibResourcesPipe, name: "skyLibResources" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
3546
+ }
3547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupComponent, decorators: [{
3548
+ type: Component,
3549
+ args: [{ selector: 'sky-lookup', providers: [SkyLookupAdapterService], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"!inputBoxHostSvc\">\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n</ng-container>\n\n<ng-template #inputTemplateRef>\n <div\n class=\"sky-lookup\"\n [ngClass]=\"{\n 'sky-lookup-focused': isInputFocused,\n 'sky-lookup-disabled': disabled,\n 'sky-lookup-single': selectMode === 'single'\n }\"\n #lookupWrapper\n >\n <sky-autocomplete\n [ariaLabelledBy]=\"ariaLabelledBy\"\n [attr.data-sky-lookup-show-more-picker-id]=\"showMorePickerId\"\n [data]=\"data\"\n [debounceTime]=\"debounceTime\"\n [descriptorProperty]=\"descriptorProperty\"\n [enableShowMore]=\"enableShowMore\"\n [messageStream]=\"autocompleteController\"\n [propertiesToSearch]=\"propertiesToSearch\"\n [search]=\"searchOrDefault\"\n [searchAsyncDisabled]=\"searchAsync.observers.length === 0\"\n [searchFilters]=\"searchFilters\"\n [searchResultsLimit]=\"searchResultsLimit\"\n [searchResultTemplate]=\"searchResultTemplate\"\n [searchTextMinimumCharacters]=\"searchTextMinimumCharacters\"\n [showAddButton]=\"showAddButton\"\n [wrapperClass]=\"wrapperClass\"\n (addClick)=\"addButtonClicked()\"\n (searchAsync)=\"onSearchAsync($event)\"\n (selectionChange)=\"onAutocompleteSelectionChange($event)\"\n (showMoreClick)=\"onShowMoreClick($event)\"\n >\n <div class=\"sky-lookup-search-flex-wrapper\">\n <div\n class=\"sky-lookup-search\"\n [ngClass]=\"{\n 'sky-field-status-active': isInputFocused && !disabled\n }\"\n >\n <sky-tokens\n *ngIf=\"selectMode === 'multiple'\"\n class=\"sky-lookup-tokens\"\n [disabled]=\"disabled\"\n [displayWith]=\"descriptorProperty\"\n [focusable]=\"false\"\n [messageStream]=\"tokensController\"\n [trackWith]=\"idProperty\"\n [tokens]=\"tokens\"\n (keyup)=\"onTokensKeyUp($event)\"\n (tokensChange)=\"onTokensChange($event)\"\n (tokensRendered)=\"onTokensRendered()\"\n (tokenSelected)=\"enableShowMore ? openPicker('') : undefined\"\n (focusIndexOverRange)=\"onTokensFocusIndexOverRange()\"\n >\n <textarea\n class=\"sky-form-control sky-lookup-input\"\n rows=\"1\"\n skyAutocomplete\n wrap=\"off\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.id]=\"controlId\"\n [attr.placeholder]=\"placeholderText\"\n [autocompleteAttribute]=\"autocompleteAttribute\"\n [disabled]=\"disabled\"\n (blur)=\"onAutocompleteBlur()\"\n (keydown)=\"inputKeydown($event)\"\n (keyup)=\"inputKeyup($event)\"\n ></textarea>\n <ng-container *ngIf=\"!inputBoxHostSvc && !enableShowMore\">\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplateRef\"\n ></ng-container>\n </ng-container>\n </sky-tokens>\n <div\n *ngIf=\"selectMode === 'single'\"\n class=\"sky-lookup-single-control\"\n >\n <textarea\n class=\"sky-form-control sky-lookup-input\"\n rows=\"1\"\n skyAutocomplete\n wrap=\"off\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.id]=\"controlId\"\n [attr.placeholder]=\"placeholderText\"\n [autocompleteAttribute]=\"autocompleteAttribute\"\n [disabled]=\"disabled\"\n (blur)=\"onAutocompleteBlur()\"\n ></textarea>\n <ng-container *ngIf=\"!inputBoxHostSvc && !enableShowMore\">\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplateRef\"\n ></ng-container>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"!inputBoxHostSvc && enableShowMore\">\n <ng-container\n *ngTemplateOutlet=\"showMoreButtonTemplateRef\"\n ></ng-container>\n </ng-container>\n </div>\n </sky-autocomplete>\n </div>\n</ng-template>\n\n<ng-template #showMoreButtonTemplateRef>\n <div class=\"sky-input-group-btn\">\n <button\n class=\"sky-btn sky-btn-default\"\n [disabled]=\"disabled\"\n [ngClass]=\"{ 'sky-btn-disabled': disabled }\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_lookup_search_button_show_more' | skyLibResources\n \"\n (click)=\"onSearchButtonClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n iconType=\"skyux\"\n icon=\"search\"\n ></sky-icon>\n </button>\n </div>\n</ng-template>\n\n<ng-template #searchIconTemplateRef>\n <div\n class=\"sky-input-group-icon sky-input-box-icon-inset\"\n [ngClass]=\"{ 'sky-lookup-disabled': disabled }\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\"></sky-icon>\n <sky-icon *skyThemeIf=\"'modern'\" iconType=\"skyux\" icon=\"search\"></sky-icon>\n </div>\n</ng-template>\n", styles: [".sky-lookup .sky-lookup-input.sky-form-control{resize:none;border:0;box-sizing:content-box;height:1.428571429em;overflow:hidden;padding:0;background-color:transparent}.sky-lookup .sky-lookup-input.sky-form-control:focus{outline:none;box-shadow:none}.sky-lookup .sky-lookup-search-flex-wrapper{display:flex}.sky-lookup.sky-lookup-disabled .sky-lookup-search{background-color:#cdcfd2}.sky-lookup sky-tokens.sky-lookup-tokens:focus{outline:none}.sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-5px;margin-bottom:-5px}.sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-top:5px;padding-bottom:5px;padding-left:10px;flex-basis:100px}.sky-lookup .sky-lookup-single-control{display:inline-flex;padding-left:7px;width:100%}.sky-lookup-search{cursor:text;background-color:#fff;line-height:1.428571429em;padding:6px 12px 6px 3px;flex-grow:1}.sky-lookup-search:not(.sky-field-status-active){border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2}.sky-lookup-disabled .sky-lookup-search{cursor:default}.sky-lookup-focused .sky-tokens-content{flex-basis:100px}.sky-lookup-single sky-tokens.sky-lookup-tokens sky-token{display:none}sky-lookup.ng-invalid.ng-touched .sky-lookup-search{box-shadow:0 0 8px #ef404499;border:1px solid var(--sky-highlight-color-danger);outline:none}sky-input-box .sky-lookup{width:100%}sky-input-box .sky-lookup .sky-lookup-search{border:none;padding-bottom:5px;width:100%}:host-context(.sky-theme-modern) sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-6px}:host-context(.sky-theme-modern) sky-input-box .sky-lookup{margin-top:-26px;padding-top:26px}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens sky-token{z-index:1}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:0;margin-bottom:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens sky-token{padding-bottom:0;padding-top:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-bottom:0;padding-top:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content:first-child{padding-left:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup.sky-lookup-single sky-tokens.sky-lookup-tokens .sky-tokens-content{padding-left:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-search{background-color:transparent;padding:0 0 0 15px}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-search.sky-field-status-active{box-shadow:none}:host-context(.sky-theme-modern) sky-input-box .sky-lookup textarea.sky-lookup-input.sky-form-control{padding-left:0;resize:none}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-single-control{padding-left:0}.sky-theme-modern sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-6px}.sky-theme-modern sky-input-box .sky-lookup{margin-top:-26px;padding-top:26px}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens sky-token{z-index:1}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:0;margin-bottom:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens sky-token{padding-bottom:0;padding-top:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-bottom:0;padding-top:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content:first-child{padding-left:0}.sky-theme-modern sky-input-box .sky-lookup.sky-lookup-single sky-tokens.sky-lookup-tokens .sky-tokens-content{padding-left:0}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-search{background-color:transparent;padding:0 0 0 15px}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-search.sky-field-status-active{box-shadow:none}.sky-theme-modern sky-input-box .sky-lookup textarea.sky-lookup-input.sky-form-control{padding-left:0;resize:none}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-single-control{padding-left:0}\n"] }]
3550
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.SkyAppWindowRef }, { type: SkyLookupAdapterService }, { type: i1$1.SkyModalService }, { type: i4$1.SkyLibResourcesService }, { type: SkySelectionModalService }, { type: i1.SkyLogService }, { type: i5$1.NgControl, decorators: [{
3551
+ type: Self
3552
+ }, {
3553
+ type: Optional
3554
+ }] }, { type: i5.SkyInputBoxHostService, decorators: [{
3555
+ type: Optional
3556
+ }] }, { type: i8.SkyThemeService, decorators: [{
3557
+ type: Optional
3558
+ }] }]; }, propDecorators: { ariaLabel: [{
3559
+ type: Input
3560
+ }], ariaLabelledBy: [{
3561
+ type: Input
3562
+ }], autocompleteAttribute: [{
3563
+ type: Input
3564
+ }], data: [{
3565
+ type: Input
3566
+ }], disabled: [{
3567
+ type: Input
3568
+ }], enableShowMore: [{
3569
+ type: Input
3570
+ }], placeholderText: [{
3571
+ type: Input
3572
+ }], idProperty: [{
3573
+ type: Input
3574
+ }], showAddButton: [{
3575
+ type: Input
3576
+ }], showMoreConfig: [{
3577
+ type: Input
3578
+ }], selectMode: [{
3579
+ type: Input
3580
+ }], wrapperClass: [{
3581
+ type: Input
3582
+ }], addClick: [{
3583
+ type: Output
3584
+ }], autocompleteInputDirective: [{
3585
+ type: ViewChild,
3586
+ args: [SkyAutocompleteInputDirective, {
3587
+ read: SkyAutocompleteInputDirective,
3588
+ static: false,
3589
+ }]
3590
+ }], showMoreButtonTemplateRef: [{
3591
+ type: ViewChild,
3592
+ args: ['showMoreButtonTemplateRef', {
3593
+ read: TemplateRef,
3594
+ static: true,
3595
+ }]
3596
+ }], inputTemplateRef: [{
3597
+ type: ViewChild,
3598
+ args: ['inputTemplateRef', {
3599
+ read: TemplateRef,
3600
+ static: true,
3601
+ }]
3602
+ }], lookupWrapperRef: [{
3603
+ type: ViewChild,
3604
+ args: ['lookupWrapper', {
3605
+ read: ElementRef,
3606
+ }]
3607
+ }], searchIconTemplateRef: [{
3608
+ type: ViewChild,
3609
+ args: ['searchIconTemplateRef', {
3610
+ read: TemplateRef,
3611
+ static: true,
3612
+ }]
3613
+ }] } });
3614
+
3615
+ class SkyLookupModule {
3616
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3617
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupModule, declarations: [SkyLookupComponent, SkyLookupShowMoreModalComponent], imports: [CommonModule,
3618
+ FormsModule,
3619
+ SkyAutocompleteModule,
3620
+ SkyCheckboxModule,
3621
+ SkyIconModule,
3622
+ SkyInfiniteScrollModule,
3623
+ SkyI18nModule,
3624
+ SkyLookupResourcesModule,
3625
+ SkyModalModule,
3626
+ SkyRepeaterModule,
3627
+ SkySearchModule,
3628
+ SkySelectionModalModule,
3629
+ SkyThemeModule,
3630
+ SkyTokensModule,
3631
+ SkyToolbarModule,
3632
+ SkyViewkeeperModule,
3633
+ SkyWaitModule], exports: [SkyLookupComponent] }); }
3634
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupModule, imports: [CommonModule,
3635
+ FormsModule,
3636
+ SkyAutocompleteModule,
3637
+ SkyCheckboxModule,
3638
+ SkyIconModule,
3639
+ SkyInfiniteScrollModule,
3640
+ SkyI18nModule,
3641
+ SkyLookupResourcesModule,
3642
+ SkyModalModule,
3643
+ SkyRepeaterModule,
3644
+ SkySearchModule,
3645
+ SkySelectionModalModule,
3646
+ SkyThemeModule,
3647
+ SkyTokensModule,
3648
+ SkyToolbarModule,
3649
+ SkyViewkeeperModule,
3650
+ SkyWaitModule] }); }
3651
+ }
3652
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyLookupModule, decorators: [{
3653
+ type: NgModule,
3654
+ args: [{
3655
+ declarations: [SkyLookupComponent, SkyLookupShowMoreModalComponent],
3656
+ imports: [
3657
+ CommonModule,
3658
+ FormsModule,
3659
+ SkyAutocompleteModule,
3660
+ SkyCheckboxModule,
3661
+ SkyIconModule,
3662
+ SkyInfiniteScrollModule,
3663
+ SkyI18nModule,
3664
+ SkyLookupResourcesModule,
3665
+ SkyModalModule,
3666
+ SkyRepeaterModule,
3667
+ SkySearchModule,
3668
+ SkySelectionModalModule,
3669
+ SkyThemeModule,
3670
+ SkyTokensModule,
3671
+ SkyToolbarModule,
3672
+ SkyViewkeeperModule,
3673
+ SkyWaitModule,
3674
+ ],
3675
+ exports: [SkyLookupComponent],
3676
+ }]
3677
+ }] });
3678
+
3679
+ /**
3680
+ * @deprecated Use `SkyLookupSelectModeType` instead.
3681
+ * @internal
3682
+ */
3683
+ var SkyLookupSelectMode;
3684
+ (function (SkyLookupSelectMode) {
3685
+ /**
3686
+ * Restricts users to a single selection.
3687
+ */
3688
+ SkyLookupSelectMode["single"] = "single";
3689
+ /**
3690
+ * Allows users to select multiple items.
3691
+ */
3692
+ SkyLookupSelectMode["multiple"] = "multiple";
3693
+ })(SkyLookupSelectMode || (SkyLookupSelectMode = {}));
3694
+
3695
+ /**
3696
+ * Specifies configuration options to launch a custom picker when users select
3697
+ * the button to view all options.
3698
+ */
3699
+ class SkyLookupShowMoreCustomPickerContext {
3700
+ }
3701
+
3702
+ /**
3703
+ * Generated bundle index. Do not edit.
3704
+ */
3705
+
3706
+ export { SKY_COUNTRY_FIELD_CONTEXT, SkyAutocompleteModule, SkyCountryFieldModule, SkyLookupModule, SkyLookupSelectMode, SkyLookupShowMoreCustomPickerContext, SkySearchComponent, SkySearchModule, SkySelectionModalModule, SkySelectionModalService, SkyAutocompleteInputDirective as λ1, SkyAutocompleteComponent as λ2, SkyCountryFieldComponent as λ3, SkyLookupComponent as λ4 };
3707
+ //# sourceMappingURL=skyux-lookup.mjs.map