@skyux/flyout 8.7.0 → 9.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/esm2022/lib/modules/flyout/flyout-adapter.service.mjs +69 -0
  2. package/esm2022/lib/modules/flyout/flyout-instance.mjs +122 -0
  3. package/esm2022/lib/modules/flyout/flyout-iterator.component.mjs +51 -0
  4. package/esm2022/lib/modules/flyout/flyout-media-query.service.mjs +68 -0
  5. package/esm2022/lib/modules/flyout/flyout.component.mjs +526 -0
  6. package/{esm2020 → esm2022}/lib/modules/flyout/flyout.module.mjs +21 -21
  7. package/esm2022/lib/modules/flyout/flyout.service.mjs +168 -0
  8. package/esm2022/lib/modules/shared/sky-flyout-resources.module.mjs +54 -0
  9. package/fesm2022/skyux-flyout.mjs +1098 -0
  10. package/{fesm2020 → fesm2022}/skyux-flyout.mjs.map +1 -1
  11. package/lib/modules/flyout/flyout-iterator.component.d.ts +1 -1
  12. package/package.json +16 -22
  13. package/esm2020/lib/modules/flyout/flyout-adapter.service.mjs +0 -72
  14. package/esm2020/lib/modules/flyout/flyout-instance.mjs +0 -119
  15. package/esm2020/lib/modules/flyout/flyout-iterator.component.mjs +0 -56
  16. package/esm2020/lib/modules/flyout/flyout-media-query.service.mjs +0 -71
  17. package/esm2020/lib/modules/flyout/flyout.component.mjs +0 -513
  18. package/esm2020/lib/modules/flyout/flyout.service.mjs +0 -167
  19. package/esm2020/lib/modules/shared/sky-flyout-resources.module.mjs +0 -54
  20. package/fesm2015/skyux-flyout.mjs +0 -1091
  21. package/fesm2015/skyux-flyout.mjs.map +0 -1
  22. package/fesm2020/skyux-flyout.mjs +0 -1087
  23. /package/{esm2020 → esm2022}/index.mjs +0 -0
  24. /package/{esm2020 → esm2022}/lib/modules/flyout/types/flyout-action.mjs +0 -0
  25. /package/{esm2020 → esm2022}/lib/modules/flyout/types/flyout-before-close-handler.mjs +0 -0
  26. /package/{esm2020 → esm2022}/lib/modules/flyout/types/flyout-close-args.mjs +0 -0
  27. /package/{esm2020 → esm2022}/lib/modules/flyout/types/flyout-config-internal.mjs +0 -0
  28. /package/{esm2020 → esm2022}/lib/modules/flyout/types/flyout-config.mjs +0 -0
  29. /package/{esm2020 → esm2022}/lib/modules/flyout/types/flyout-message-type.mjs +0 -0
  30. /package/{esm2020 → esm2022}/lib/modules/flyout/types/flyout-message.mjs +0 -0
  31. /package/{esm2020 → esm2022}/lib/modules/flyout/types/flyout-permalink.mjs +0 -0
  32. /package/{esm2020 → esm2022}/skyux-flyout.mjs +0 -0
@@ -0,0 +1,1098 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, NgModule, Component, Input, Output, Injectable, Injector, ElementRef, ViewContainerRef, ChangeDetectionStrategy, ViewChild, HostListener } from '@angular/core';
3
+ import { Subject, ReplaySubject, BehaviorSubject, fromEvent } from 'rxjs';
4
+ import * as i5 from '@angular/cdk/a11y';
5
+ import { A11yModule } from '@angular/cdk/a11y';
6
+ import * as i6 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+ import { FormsModule } from '@angular/forms';
9
+ import * as i2$2 from '@angular/router';
10
+ import { RouterModule, NavigationStart } from '@angular/router';
11
+ import * as i2$1 from '@skyux/i18n';
12
+ import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
13
+ import * as i1 from '@skyux/indicators';
14
+ import { SkyIconModule } from '@skyux/indicators';
15
+ import * as i10 from '@skyux/router';
16
+ import { SkyHrefModule } from '@skyux/router';
17
+ import * as i2 from '@skyux/theme';
18
+ import { SkyThemeModule } from '@skyux/theme';
19
+ import { trigger, state, style, transition, animate } from '@angular/animations';
20
+ import * as i1$1 from '@skyux/core';
21
+ import { SkyMediaBreakpoints, SKY_STACKING_CONTEXT, SkyMediaQueryService } from '@skyux/core';
22
+ import { takeUntil, take, takeWhile } from 'rxjs/operators';
23
+
24
+ /**
25
+ * @internal
26
+ */
27
+ var SkyFlyoutMessageType;
28
+ (function (SkyFlyoutMessageType) {
29
+ SkyFlyoutMessageType[SkyFlyoutMessageType["Open"] = 0] = "Open";
30
+ SkyFlyoutMessageType[SkyFlyoutMessageType["Close"] = 1] = "Close";
31
+ SkyFlyoutMessageType[SkyFlyoutMessageType["EnableIteratorNextButton"] = 2] = "EnableIteratorNextButton";
32
+ SkyFlyoutMessageType[SkyFlyoutMessageType["EnableIteratorPreviousButton"] = 3] = "EnableIteratorPreviousButton";
33
+ SkyFlyoutMessageType[SkyFlyoutMessageType["DisableIteratorNextButton"] = 4] = "DisableIteratorNextButton";
34
+ SkyFlyoutMessageType[SkyFlyoutMessageType["DisableIteratorPreviousButton"] = 5] = "DisableIteratorPreviousButton";
35
+ })(SkyFlyoutMessageType || (SkyFlyoutMessageType = {}));
36
+
37
+ /**
38
+ * Represents a single displayed flyout.
39
+ */
40
+ class SkyFlyoutInstance {
41
+ /**
42
+ * An event that the modal instance emits when it is about to close.
43
+ * If a subscription exists for this event,
44
+ * the modal does not close until the subscriber calls the handler's `closeModal` method.
45
+ */
46
+ get beforeClose() {
47
+ return this.#_beforeClose;
48
+ }
49
+ /**
50
+ * Used to communicate with the host component.
51
+ * @internal
52
+ */
53
+ get hostController() {
54
+ return this.#_hostController;
55
+ }
56
+ /**
57
+ * An event that the flyout instance emits when users click the next iterator button.
58
+ */
59
+ get iteratorNextButtonClick() {
60
+ return this.#_iteratorNextButtonClick;
61
+ }
62
+ /**
63
+ * An event that the flyout instance emits when users click the previous iterator button.
64
+ */
65
+ get iteratorPreviousButtonClick() {
66
+ return this.#_iteratorPreviousButtonClick;
67
+ }
68
+ /**
69
+ * Disables the next iterator button.
70
+ * @default false
71
+ */
72
+ set iteratorNextButtonDisabled(newValue) {
73
+ this.#_iteratorNextButtonDisabled = newValue;
74
+ if (newValue) {
75
+ this.hostController.next({
76
+ type: SkyFlyoutMessageType.DisableIteratorNextButton,
77
+ });
78
+ }
79
+ else {
80
+ this.hostController.next({
81
+ type: SkyFlyoutMessageType.EnableIteratorNextButton,
82
+ });
83
+ }
84
+ }
85
+ get iteratorNextButtonDisabled() {
86
+ return this.#_iteratorNextButtonDisabled;
87
+ }
88
+ /**
89
+ * Disables the previous iterator button.
90
+ * @default false
91
+ */
92
+ set iteratorPreviousButtonDisabled(newValue) {
93
+ this.#_iteratorPreviousButtonDisabled = newValue;
94
+ if (newValue) {
95
+ this.hostController.next({
96
+ type: SkyFlyoutMessageType.DisableIteratorPreviousButton,
97
+ });
98
+ }
99
+ else {
100
+ this.hostController.next({
101
+ type: SkyFlyoutMessageType.EnableIteratorPreviousButton,
102
+ });
103
+ }
104
+ }
105
+ get iteratorPreviousButtonDisabled() {
106
+ return this.#_iteratorPreviousButtonDisabled;
107
+ }
108
+ #_beforeClose;
109
+ #_iteratorNextButtonClick;
110
+ #_iteratorPreviousButtonClick;
111
+ #_iteratorNextButtonDisabled;
112
+ #_iteratorPreviousButtonDisabled;
113
+ #_hostController;
114
+ // TODO: Remove this being optional in a future breaking change.
115
+ constructor(componentInstance) {
116
+ /**
117
+ * An event that the flyout instance emits when it closes.
118
+ */
119
+ this.closed = new EventEmitter();
120
+ /**
121
+ * A `boolean` value that returns `true` if the flyout is open.
122
+ * @default true
123
+ */
124
+ this.isOpen = true;
125
+ this.#_beforeClose = new Subject();
126
+ this.#_iteratorNextButtonClick = new EventEmitter();
127
+ this.#_iteratorPreviousButtonClick = new EventEmitter();
128
+ this.#_iteratorNextButtonDisabled = false;
129
+ this.#_iteratorPreviousButtonDisabled = false;
130
+ this.#_hostController = new Subject();
131
+ if (!componentInstance) {
132
+ console.warn(`The SkyFlyoutInstance was created without a reference to the flyout's child component instance.
133
+ The instance will not have a reference ot this child component.
134
+ Support for creating an instance without this reference will be removed in a future breaking change.`);
135
+ }
136
+ this.componentInstance = componentInstance;
137
+ this.closed.subscribe(() => {
138
+ this.isOpen = false;
139
+ });
140
+ }
141
+ /**
142
+ * Closes the flyout instance and emits its `closed` event.
143
+ * @param args Arguments used when closing the flyout.
144
+ */
145
+ close(args) {
146
+ this.hostController.next({
147
+ type: SkyFlyoutMessageType.Close,
148
+ data: { ignoreBeforeClose: args ? args.ignoreBeforeClose : false },
149
+ });
150
+ this.#_iteratorPreviousButtonClick.complete();
151
+ this.#_iteratorNextButtonClick.complete();
152
+ this.hostController.complete();
153
+ }
154
+ }
155
+
156
+ /**
157
+ * NOTICE: DO NOT MODIFY THIS FILE!
158
+ * The contents of this file were automatically generated by
159
+ * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-flyout' schematic.
160
+ * To update this file, simply rerun the command.
161
+ */
162
+ const RESOURCES = {
163
+ 'EN-US': {
164
+ skyux_flyout_close: { message: 'Close flyout' },
165
+ skyux_flyout_iterator_previous_button: { message: 'Previous' },
166
+ skyux_flyout_iterator_next_button: { message: 'Next' },
167
+ skyux_flyout_permalink_button: { message: 'View record' },
168
+ skyux_flyout_primary_action_button: { message: 'Create list' },
169
+ skyux_flyout_resize_handle: {
170
+ message: 'Resize the flyout window. Press the enter or space key to activate, then use left arrow key to expand the flyout window and right arrow key to shrink the flyout window. Press the enter, space, or tab key to deactivate.',
171
+ },
172
+ },
173
+ };
174
+ class SkyFlyoutResourcesProvider {
175
+ getString(localeInfo, name) {
176
+ return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
177
+ }
178
+ }
179
+ /**
180
+ * Import into any component library module that needs to use resource strings.
181
+ */
182
+ class SkyFlyoutResourcesModule {
183
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
184
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutResourcesModule, exports: [SkyI18nModule] }); }
185
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutResourcesModule, providers: [
186
+ {
187
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
188
+ useClass: SkyFlyoutResourcesProvider,
189
+ multi: true,
190
+ },
191
+ ], imports: [SkyI18nModule] }); }
192
+ }
193
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutResourcesModule, decorators: [{
194
+ type: NgModule,
195
+ args: [{
196
+ exports: [SkyI18nModule],
197
+ providers: [
198
+ {
199
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
200
+ useClass: SkyFlyoutResourcesProvider,
201
+ multi: true,
202
+ },
203
+ ],
204
+ }]
205
+ }] });
206
+
207
+ /**
208
+ * @internal
209
+ */
210
+ class SkyFlyoutIteratorComponent {
211
+ get previousButtonClick() {
212
+ return this.#_previousButtonClick;
213
+ }
214
+ get nextButtonClick() {
215
+ return this.#_nextButtonClick;
216
+ }
217
+ #ngUnsubscribe = new Subject();
218
+ #_nextButtonClick = new EventEmitter();
219
+ #_previousButtonClick = new EventEmitter();
220
+ ngOnDestroy() {
221
+ this.#ngUnsubscribe.next();
222
+ this.#ngUnsubscribe.complete();
223
+ }
224
+ onIteratorPreviousClick() {
225
+ /* istanbul ignore else */
226
+ if (!this.previousButtonDisabled) {
227
+ this.#_previousButtonClick.emit();
228
+ }
229
+ }
230
+ onIteratorNextClick() {
231
+ /* istanbul ignore else */
232
+ if (!this.nextButtonDisabled) {
233
+ this.#_nextButtonClick.emit();
234
+ }
235
+ }
236
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutIteratorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
237
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyFlyoutIteratorComponent, selector: "sky-flyout-iterator", inputs: { nextButtonDisabled: "nextButtonDisabled", previousButtonDisabled: "previousButtonDisabled" }, outputs: { previousButtonClick: "previousButtonClick", nextButtonClick: "nextButtonClick" }, ngImport: i0, template: "<div id=\"iterators\" class=\"sky-flyout-iterators\">\n <button\n class=\"sky-btn\"\n [attr.aria-label]=\"\n 'skyux_flyout_iterator_previous_button' | skyLibResources\n \"\n [disabled]=\"previousButtonDisabled\"\n [skyThemeClass]=\"{\n 'sky-btn-default sky-margin-inline-compact': 'default',\n 'sky-btn-icon-borderless sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onIteratorPreviousClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-up\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"chevron-up\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n <button\n class=\"sky-btn\"\n [attr.aria-label]=\"'skyux_flyout_iterator_next_button' | skyLibResources\"\n [disabled]=\"nextButtonDisabled\"\n [skyThemeClass]=\"{\n 'sky-btn-default sky-margin-inline-compact': 'default',\n 'sky-btn-icon-borderless sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onIteratorNextClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-down\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"chevron-down\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n</div>\n", styles: [":host-context(.sky-theme-modern) .sky-flyout-iterators{display:inline}.sky-theme-modern .sky-flyout-iterators{display:inline}\n"], dependencies: [{ kind: "component", type: i1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i2.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { kind: "directive", type: i2.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "pipe", type: i2$1.SkyLibResourcesPipe, name: "skyLibResources" }] }); }
238
+ }
239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutIteratorComponent, decorators: [{
240
+ type: Component,
241
+ args: [{ selector: 'sky-flyout-iterator', template: "<div id=\"iterators\" class=\"sky-flyout-iterators\">\n <button\n class=\"sky-btn\"\n [attr.aria-label]=\"\n 'skyux_flyout_iterator_previous_button' | skyLibResources\n \"\n [disabled]=\"previousButtonDisabled\"\n [skyThemeClass]=\"{\n 'sky-btn-default sky-margin-inline-compact': 'default',\n 'sky-btn-icon-borderless sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onIteratorPreviousClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-up\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"chevron-up\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n <button\n class=\"sky-btn\"\n [attr.aria-label]=\"'skyux_flyout_iterator_next_button' | skyLibResources\"\n [disabled]=\"nextButtonDisabled\"\n [skyThemeClass]=\"{\n 'sky-btn-default sky-margin-inline-compact': 'default',\n 'sky-btn-icon-borderless sky-margin-inline-sm': 'modern'\n }\"\n (click)=\"onIteratorNextClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-down\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"chevron-down\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n</div>\n", styles: [":host-context(.sky-theme-modern) .sky-flyout-iterators{display:inline}.sky-theme-modern .sky-flyout-iterators{display:inline}\n"] }]
242
+ }], propDecorators: { nextButtonDisabled: [{
243
+ type: Input
244
+ }], previousButtonDisabled: [{
245
+ type: Input
246
+ }], previousButtonClick: [{
247
+ type: Output
248
+ }], nextButtonClick: [{
249
+ type: Output
250
+ }] } });
251
+
252
+ /**
253
+ * @internal
254
+ */
255
+ class SkyFlyoutAdapterService {
256
+ #renderer;
257
+ #windowRef;
258
+ constructor(rendererFactory, windowRef) {
259
+ this.#windowRef = windowRef;
260
+ this.#renderer = rendererFactory.createRenderer(undefined, null);
261
+ }
262
+ adjustHeaderForHelp(header) {
263
+ const windowObj = this.#windowRef.nativeWindow;
264
+ const helpWidget = windowObj.document.getElementById('bb-help-invoker');
265
+ if (helpWidget) {
266
+ this.#renderer.addClass(header.nativeElement, 'sky-flyout-help-shim');
267
+ }
268
+ }
269
+ setResponsiveClass(element, breakpoint) {
270
+ /* istanbul ignore if */
271
+ if (!breakpoint) {
272
+ return;
273
+ }
274
+ const nativeEl = element.nativeElement;
275
+ this.#renderer.removeClass(nativeEl, 'sky-responsive-container-xs');
276
+ this.#renderer.removeClass(nativeEl, 'sky-responsive-container-sm');
277
+ this.#renderer.removeClass(nativeEl, 'sky-responsive-container-md');
278
+ this.#renderer.removeClass(nativeEl, 'sky-responsive-container-lg');
279
+ let newClass;
280
+ switch (breakpoint) {
281
+ case SkyMediaBreakpoints.xs: {
282
+ newClass = 'sky-responsive-container-xs';
283
+ break;
284
+ }
285
+ case SkyMediaBreakpoints.sm: {
286
+ newClass = 'sky-responsive-container-sm';
287
+ break;
288
+ }
289
+ case SkyMediaBreakpoints.md: {
290
+ newClass = 'sky-responsive-container-md';
291
+ break;
292
+ }
293
+ default: {
294
+ newClass = 'sky-responsive-container-lg';
295
+ break;
296
+ }
297
+ }
298
+ this.#renderer.addClass(nativeEl, newClass);
299
+ }
300
+ toggleIframePointerEvents(enable) {
301
+ // When iframes are present on the page, they may interfere with dragging
302
+ // temporarily disable pointer events in iframes when dragging starts.
303
+ // When re-enabling we set to the empty string as it will remove the element styling
304
+ // and fall back to any css originally given to iframe
305
+ const iframes = document.querySelectorAll('iframe');
306
+ for (let i = 0; i < iframes.length; i++) {
307
+ iframes[i].style.pointerEvents = enable ? '' : 'none';
308
+ }
309
+ }
310
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutAdapterService, deps: [{ token: i0.RendererFactory2 }, { token: i1$1.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
311
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutAdapterService }); }
312
+ }
313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutAdapterService, decorators: [{
314
+ type: Injectable
315
+ }], ctorParameters: function () { return [{ type: i0.RendererFactory2 }, { type: i1$1.SkyAppWindowRef }]; } });
316
+
317
+ /**
318
+ * @internal
319
+ */
320
+ class SkyFlyoutMediaQueryService {
321
+ #currentSubject;
322
+ constructor() {
323
+ this.#currentSubject = new ReplaySubject(1);
324
+ }
325
+ subscribe(listener) {
326
+ return this.#currentSubject.subscribe({
327
+ next: (breakpoints) => {
328
+ listener(breakpoints);
329
+ },
330
+ });
331
+ }
332
+ setBreakpointForWidth(width) {
333
+ let breakpoint;
334
+ if (this.isWidthWithinBreakpoint(width, SkyMediaBreakpoints.xs)) {
335
+ breakpoint = SkyMediaBreakpoints.xs;
336
+ }
337
+ else if (this.isWidthWithinBreakpoint(width, SkyMediaBreakpoints.sm)) {
338
+ breakpoint = SkyMediaBreakpoints.sm;
339
+ }
340
+ else if (this.isWidthWithinBreakpoint(width, SkyMediaBreakpoints.md)) {
341
+ breakpoint = SkyMediaBreakpoints.md;
342
+ }
343
+ else {
344
+ breakpoint = SkyMediaBreakpoints.lg;
345
+ }
346
+ this.current = breakpoint;
347
+ this.#currentSubject.next(this.current);
348
+ }
349
+ isWidthWithinBreakpoint(width, breakpoint) {
350
+ const xsBreakpointMaxPixels = 767;
351
+ const smBreakpointMinPixels = 768;
352
+ const smBreakpointMaxPixels = 991;
353
+ const mdBreakpointMinPixels = 992;
354
+ const mdBreakpointMaxPixels = 1199;
355
+ const lgBreakpointMinPixels = 1200;
356
+ switch (breakpoint) {
357
+ case SkyMediaBreakpoints.xs: {
358
+ return width <= xsBreakpointMaxPixels;
359
+ }
360
+ case SkyMediaBreakpoints.sm: {
361
+ return width >= smBreakpointMinPixels && width <= smBreakpointMaxPixels;
362
+ }
363
+ case SkyMediaBreakpoints.md: {
364
+ return width >= mdBreakpointMinPixels && width <= mdBreakpointMaxPixels;
365
+ }
366
+ default: {
367
+ return width >= lgBreakpointMinPixels;
368
+ }
369
+ }
370
+ }
371
+ destroy() {
372
+ this.#currentSubject.complete();
373
+ }
374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutMediaQueryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
375
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutMediaQueryService }); }
376
+ }
377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutMediaQueryService, decorators: [{
378
+ type: Injectable
379
+ }], ctorParameters: function () { return []; } });
380
+
381
+ /**
382
+ * Handler for notifying the flyout when it is appropriate to close the flyout. This will be returned from the flyout instance's `beforeClose` observable.
383
+ */
384
+ class SkyFlyoutBeforeCloseHandler {
385
+ constructor(closeFlyoutFunction) {
386
+ this.closeFlyout = closeFlyoutFunction;
387
+ }
388
+ }
389
+
390
+ const FLYOUT_OPEN_STATE = 'flyoutOpen';
391
+ const FLYOUT_CLOSED_STATE = 'flyoutClosed';
392
+ let nextId = 0;
393
+ /**
394
+ * @internal
395
+ */
396
+ class SkyFlyoutComponent {
397
+ #xCoord;
398
+ #windowBufferSize;
399
+ get messageStream() {
400
+ return this.#_messageStream;
401
+ }
402
+ #flyoutInstance;
403
+ #ngUnsubscribe;
404
+ #_messageStream;
405
+ #adapter;
406
+ #changeDetector;
407
+ #injector;
408
+ #resolver;
409
+ #resourcesService;
410
+ #flyoutMediaQueryService;
411
+ #elementRef;
412
+ #uiConfigService;
413
+ #ngZone;
414
+ constructor(adapter, changeDetector, injector, resolver, resourcesService, flyoutMediaQueryService, elementRef, uiConfigService, ngZone) {
415
+ this.config = {
416
+ defaultWidth: window.innerWidth / 2,
417
+ minWidth: 320,
418
+ maxWidth: window.innerWidth / 2,
419
+ providers: [],
420
+ };
421
+ this.enableTrapFocus = false;
422
+ this.enableTrapFocusAutoCapture = false;
423
+ this.flyoutId = `sky-flyout-${++nextId}`;
424
+ this.flyoutState = FLYOUT_CLOSED_STATE;
425
+ this.isOpen = false;
426
+ this.isOpening = false;
427
+ this.flyoutWidth = 0;
428
+ this.instanceReady = false;
429
+ this.isDragging = false;
430
+ this.isFullscreen = false;
431
+ this.resizeKeyControlActive = false;
432
+ this.#xCoord = 0;
433
+ this.#windowBufferSize = 20;
434
+ this.permalink = {};
435
+ this.permalinkLabel = '';
436
+ this.primaryAction = {};
437
+ this.primaryActionLabel = '';
438
+ /**
439
+ * @internal
440
+ */
441
+ this.widthStep = 10;
442
+ this.zIndex$ = new BehaviorSubject(1001);
443
+ this.#ngUnsubscribe = new Subject();
444
+ this.#_messageStream = new Subject();
445
+ this.#adapter = adapter;
446
+ this.#changeDetector = changeDetector;
447
+ this.#injector = injector;
448
+ this.#resolver = resolver;
449
+ this.#resourcesService = resourcesService;
450
+ this.#flyoutMediaQueryService = flyoutMediaQueryService;
451
+ this.#elementRef = elementRef;
452
+ this.#uiConfigService = uiConfigService;
453
+ this.#ngZone = ngZone;
454
+ // All commands flow through the message stream.
455
+ this.messageStream
456
+ .pipe(takeUntil(this.#ngUnsubscribe))
457
+ .subscribe((message) => {
458
+ this.#handleIncomingMessages(message);
459
+ });
460
+ }
461
+ ngOnInit() {
462
+ /* istanbul ignore else */
463
+ if (this.flyoutHeader) {
464
+ this.#adapter.adjustHeaderForHelp(this.flyoutHeader);
465
+ }
466
+ }
467
+ ngOnDestroy() {
468
+ this.#ngUnsubscribe.next();
469
+ this.#ngUnsubscribe.complete();
470
+ }
471
+ onWindowResize(event) {
472
+ if (this.#flyoutMediaQueryService.isWidthWithinBreakpoint(event.target.innerWidth, SkyMediaBreakpoints.xs)) {
473
+ this.#updateBreakpointAndResponsiveClass(event.target.innerWidth);
474
+ }
475
+ else {
476
+ this.#updateBreakpointAndResponsiveClass(this.flyoutWidth);
477
+ }
478
+ this.#setFullscreen();
479
+ if (event.target.innerWidth - this.flyoutWidth < this.#windowBufferSize) {
480
+ this.flyoutWidth = event.target.innerWidth - this.#windowBufferSize;
481
+ this.#xCoord = this.#windowBufferSize;
482
+ this.#setUserData();
483
+ }
484
+ }
485
+ attach(component, config) {
486
+ this.#cleanTemplate();
487
+ // Emit the closed event on any previously opened flyout instance
488
+ if (this.#flyoutInstance) {
489
+ this.#notifyClosed();
490
+ }
491
+ this.config = Object.assign({
492
+ defaultWidth: window.innerWidth / 2,
493
+ minWidth: 320,
494
+ maxWidth: window.innerWidth / 2,
495
+ providers: [
496
+ {
497
+ provide: SKY_STACKING_CONTEXT,
498
+ useValue: {
499
+ zIndex: this.zIndex$
500
+ .asObservable()
501
+ .pipe(takeUntil(this.#ngUnsubscribe)),
502
+ },
503
+ },
504
+ ],
505
+ }, config);
506
+ if (config?.defaultWidth && !config?.maxWidth) {
507
+ this.config.maxWidth = config?.defaultWidth;
508
+ }
509
+ this.config.showIterator = this.config.showIterator || false;
510
+ this.config.iteratorNextButtonDisabled =
511
+ this.config.iteratorNextButtonDisabled || false;
512
+ this.config.iteratorPreviousButtonDisabled =
513
+ this.config.iteratorPreviousButtonDisabled || false;
514
+ this.permalink = this.config.permalink ?? {};
515
+ this.permalinkLabel =
516
+ this.config.permalink && this.config.permalink.label
517
+ ? this.config.permalink.label
518
+ : this.#getString('skyux_flyout_permalink_button');
519
+ this.primaryAction = this.config.primaryAction ?? {};
520
+ this.primaryActionLabel =
521
+ this.config.primaryAction && this.config.primaryAction.label
522
+ ? this.config.primaryAction.label
523
+ : this.#getString('skyux_flyout_primary_action_button');
524
+ const factory = this.#resolver.resolveComponentFactory(component);
525
+ const injector = Injector.create({
526
+ parent: this.#injector,
527
+ providers: this.config.providers,
528
+ });
529
+ const componentRef = this.target?.createComponent(factory, undefined, injector);
530
+ /* safety check */
531
+ /* istanbul ignore if */
532
+ if (!componentRef) {
533
+ throw new Error("Flyout's internal component could not be created");
534
+ }
535
+ this.#flyoutInstance = this.#createFlyoutInstance(componentRef.instance);
536
+ // This is used to ensure we do not render the flyout until we have attached the component.
537
+ // This allows the aria-labelledby to function correctly.
538
+ this.instanceReady = true;
539
+ this.#changeDetector.markForCheck();
540
+ // Open the flyout immediately.
541
+ this.messageStream.next({
542
+ type: SkyFlyoutMessageType.Open,
543
+ });
544
+ if (this.config.settingsKey) {
545
+ this.#uiConfigService
546
+ .getConfig(this.config.settingsKey)
547
+ .pipe(take(1))
548
+ .subscribe((value) => {
549
+ if (value && value.flyoutWidth) {
550
+ this.flyoutWidth = value.flyoutWidth;
551
+ }
552
+ else {
553
+ // Bad data, or config is the default config.
554
+ this.flyoutWidth = this.config.defaultWidth;
555
+ }
556
+ this.#checkInitialSize();
557
+ });
558
+ }
559
+ else {
560
+ this.flyoutWidth = this.config.defaultWidth;
561
+ this.#checkInitialSize();
562
+ }
563
+ return this.#flyoutInstance;
564
+ }
565
+ close() {
566
+ this.messageStream.next({
567
+ type: SkyFlyoutMessageType.Close,
568
+ });
569
+ }
570
+ invokePrimaryAction() {
571
+ if (this.primaryAction.callback) {
572
+ this.primaryAction.callback();
573
+ if (this.primaryAction.closeAfterInvoking) {
574
+ this.close();
575
+ }
576
+ return false;
577
+ }
578
+ /* istanbul ignore next */
579
+ return true;
580
+ }
581
+ getAnimationState() {
582
+ return this.instanceReady && this.isOpening
583
+ ? FLYOUT_OPEN_STATE
584
+ : FLYOUT_CLOSED_STATE;
585
+ }
586
+ animationDone(event) {
587
+ if (event.toState === FLYOUT_OPEN_STATE) {
588
+ this.isOpen = true;
589
+ }
590
+ if (event.toState === FLYOUT_CLOSED_STATE) {
591
+ this.isOpen = false;
592
+ this.#notifyClosed();
593
+ this.#cleanTemplate();
594
+ }
595
+ }
596
+ onHeaderGrabHandleMouseDown(event) {
597
+ this.onResizeHandleMouseDown(event);
598
+ }
599
+ onHeaderGrabHandleKeyDown(event) {
600
+ this.#handleResizeKeyDown(event);
601
+ }
602
+ onResizeHandleKeyDown(event) {
603
+ this.#handleResizeKeyDown(event);
604
+ }
605
+ onResizeHandleMouseDown(event) {
606
+ event.preventDefault();
607
+ event.stopPropagation();
608
+ if (this.isFullscreen) {
609
+ return;
610
+ }
611
+ this.isDragging = true;
612
+ this.#xCoord = event.clientX;
613
+ this.#adapter.toggleIframePointerEvents(false);
614
+ fromEvent(document, 'mousemove')
615
+ .pipe(takeWhile(() => {
616
+ return this.isDragging;
617
+ }))
618
+ .subscribe((moveEvent) => {
619
+ this.onMouseMove(moveEvent);
620
+ });
621
+ fromEvent(document, 'mouseup')
622
+ .pipe(takeWhile(() => {
623
+ return this.isDragging;
624
+ }))
625
+ .subscribe((mouseUpEvent) => {
626
+ this.onHandleRelease(mouseUpEvent);
627
+ });
628
+ }
629
+ onMouseMove(event) {
630
+ /* Sanity check */
631
+ /* istanbul ignore if */
632
+ if (!this.isDragging) {
633
+ return;
634
+ }
635
+ const offsetX = event.clientX - this.#xCoord;
636
+ let width = this.flyoutWidth;
637
+ width -= offsetX;
638
+ if (width < this.config.minWidth || width > this.config.maxWidth) {
639
+ return;
640
+ }
641
+ if (window.innerWidth - width < this.#windowBufferSize) {
642
+ width = window.innerWidth - this.#windowBufferSize;
643
+ this.#xCoord = this.#windowBufferSize;
644
+ }
645
+ else {
646
+ this.#xCoord = event.clientX;
647
+ }
648
+ this.flyoutWidth = width;
649
+ this.#updateBreakpointAndResponsiveClass(this.flyoutWidth);
650
+ this.#changeDetector.markForCheck();
651
+ }
652
+ onHandleRelease(event) {
653
+ fromEvent(document, 'click')
654
+ .pipe(take(1))
655
+ .subscribe(() => {
656
+ this.isDragging = false;
657
+ this.#adapter.toggleIframePointerEvents(true);
658
+ this.#setUserData();
659
+ });
660
+ }
661
+ onIteratorPreviousButtonClick() {
662
+ /* istanbul ignore else */
663
+ if (this.#flyoutInstance) {
664
+ this.#flyoutInstance.iteratorPreviousButtonClick.emit();
665
+ }
666
+ }
667
+ onIteratorNextButtonClick() {
668
+ /* istanbul ignore else */
669
+ if (this.#flyoutInstance) {
670
+ this.#flyoutInstance.iteratorNextButtonClick.emit();
671
+ }
672
+ }
673
+ #createFlyoutInstance(component) {
674
+ const instance = new SkyFlyoutInstance(component);
675
+ instance.hostController
676
+ .pipe(takeUntil(this.#ngUnsubscribe))
677
+ .subscribe((message) => {
678
+ this.messageStream.next(message);
679
+ });
680
+ return instance;
681
+ }
682
+ #handleIncomingMessages(message) {
683
+ switch (message.type) {
684
+ case SkyFlyoutMessageType.Open:
685
+ if (!this.isOpen) {
686
+ this.isOpen = false;
687
+ this.isOpening = true;
688
+ }
689
+ this.#initFocusTrap();
690
+ break;
691
+ case SkyFlyoutMessageType.Close:
692
+ if (this.#flyoutInstance?.beforeClose?.observers
693
+ .length === 0 ||
694
+ message.data?.ignoreBeforeClose) {
695
+ this.isOpen = true;
696
+ this.isOpening = false;
697
+ }
698
+ else {
699
+ this.#flyoutInstance?.beforeClose?.next(new SkyFlyoutBeforeCloseHandler(() => {
700
+ this.isOpen = true;
701
+ this.isOpening = false;
702
+ }));
703
+ }
704
+ break;
705
+ case SkyFlyoutMessageType.EnableIteratorNextButton:
706
+ this.config.iteratorNextButtonDisabled = false;
707
+ break;
708
+ case SkyFlyoutMessageType.EnableIteratorPreviousButton:
709
+ this.config.iteratorPreviousButtonDisabled = false;
710
+ break;
711
+ case SkyFlyoutMessageType.DisableIteratorNextButton:
712
+ this.config.iteratorNextButtonDisabled = true;
713
+ break;
714
+ case SkyFlyoutMessageType.DisableIteratorPreviousButton:
715
+ this.config.iteratorPreviousButtonDisabled = true;
716
+ break;
717
+ }
718
+ this.#changeDetector.markForCheck();
719
+ }
720
+ #notifyClosed() {
721
+ this.#flyoutInstance?.closed.emit();
722
+ this.#flyoutInstance?.closed.complete();
723
+ }
724
+ #cleanTemplate() {
725
+ this.target?.clear();
726
+ }
727
+ #updateBreakpointAndResponsiveClass(width) {
728
+ this.#flyoutMediaQueryService.setBreakpointForWidth(width);
729
+ const newBreakpoint = this.#flyoutMediaQueryService.current;
730
+ this.#adapter.setResponsiveClass(this.#elementRef, newBreakpoint);
731
+ }
732
+ #setFullscreen() {
733
+ if (window.innerWidth - this.#windowBufferSize < this.config.minWidth) {
734
+ this.isFullscreen = true;
735
+ }
736
+ else {
737
+ this.isFullscreen = false;
738
+ }
739
+ }
740
+ #setUserData() {
741
+ if (this.config.settingsKey) {
742
+ this.#uiConfigService
743
+ .setConfig(this.config.settingsKey, {
744
+ flyoutWidth: this.flyoutWidth,
745
+ })
746
+ .pipe(take(1))
747
+ .subscribe(
748
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
749
+ () => { }, (err) => {
750
+ console.warn('Could not save flyout data.');
751
+ console.warn(err);
752
+ });
753
+ }
754
+ }
755
+ #checkInitialSize() {
756
+ if (this.flyoutWidth < this.config.minWidth) {
757
+ this.flyoutWidth = this.config.minWidth;
758
+ this.#setUserData();
759
+ }
760
+ else if (this.flyoutWidth > this.config.maxWidth) {
761
+ this.flyoutWidth = this.config.maxWidth;
762
+ this.#setUserData();
763
+ }
764
+ // Ensure flyout does not load larger than the window and its buffer
765
+ if (window.innerWidth - this.flyoutWidth < this.#windowBufferSize) {
766
+ this.flyoutWidth = window.innerWidth - this.#windowBufferSize;
767
+ this.#xCoord = this.#windowBufferSize;
768
+ this.#setUserData();
769
+ }
770
+ if (this.#flyoutMediaQueryService.isWidthWithinBreakpoint(window.innerWidth, SkyMediaBreakpoints.xs)) {
771
+ this.#updateBreakpointAndResponsiveClass(window.innerWidth);
772
+ }
773
+ else {
774
+ this.#updateBreakpointAndResponsiveClass(this.flyoutWidth);
775
+ }
776
+ this.#setFullscreen();
777
+ }
778
+ #getString(key) {
779
+ // TODO: Need to implement the async `getString` method in a breaking change.
780
+ return this.#resourcesService.getStringForLocale({ locale: 'en-US' }, key);
781
+ }
782
+ #handleResizeKeyDown(event) {
783
+ /* istanbul ignore else */
784
+ if (event.key) {
785
+ const keyPressed = event.key.toLowerCase().replace('arrow', '');
786
+ switch (keyPressed) {
787
+ case 'enter':
788
+ case ' ':
789
+ this.resizeKeyControlActive = !this.resizeKeyControlActive;
790
+ break;
791
+ case 'tab':
792
+ /* istanbul ignore else */
793
+ if (this.resizeKeyControlActive) {
794
+ this.resizeKeyControlActive = false;
795
+ }
796
+ break;
797
+ case 'left':
798
+ if (this.resizeKeyControlActive) {
799
+ /* istanbul ignore else */
800
+ if (this.flyoutWidth < this.config.maxWidth) {
801
+ this.flyoutWidth = Math.min(this.flyoutWidth + this.widthStep, this.config.maxWidth);
802
+ }
803
+ }
804
+ break;
805
+ case 'right':
806
+ if (this.resizeKeyControlActive) {
807
+ /* istanbul ignore else */
808
+ if (this.flyoutWidth > this.config.minWidth) {
809
+ this.flyoutWidth = Math.max(this.flyoutWidth - this.widthStep, this.config.minWidth);
810
+ }
811
+ }
812
+ break;
813
+ /* istanbul ignore next */
814
+ default:
815
+ break;
816
+ }
817
+ }
818
+ }
819
+ /** Executes a function when the zone is stable. */
820
+ #executeOnStable(fn) {
821
+ if (this.#ngZone.isStable) {
822
+ fn();
823
+ }
824
+ else {
825
+ this.#ngZone.onStable.pipe(take(1)).subscribe(fn);
826
+ }
827
+ }
828
+ #initFocusTrap() {
829
+ this.enableTrapFocusAutoCapture = false;
830
+ this.enableTrapFocus = false;
831
+ // Waiting for zone to be stable will avoid ExpressionChangeAfterCheckedError.
832
+ this.#executeOnStable(() => {
833
+ this.enableTrapFocusAutoCapture = true;
834
+ this.enableTrapFocus = true;
835
+ });
836
+ }
837
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutComponent, deps: [{ token: SkyFlyoutAdapterService }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }, { token: i2$1.SkyLibResourcesService }, { token: SkyFlyoutMediaQueryService }, { token: i0.ElementRef }, { token: i1$1.SkyUIConfigService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
838
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SkyFlyoutComponent, selector: "sky-flyout", host: { listeners: { "window:resize": "onWindowResize($event)" } }, providers: [
839
+ SkyFlyoutAdapterService,
840
+ SkyFlyoutMediaQueryService,
841
+ { provide: SkyMediaQueryService, useExisting: SkyFlyoutMediaQueryService },
842
+ ], viewQueries: [{ propertyName: "flyoutRef", first: true, predicate: ["flyoutRef"], descendants: true, read: ElementRef, static: true }, { propertyName: "target", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "flyoutHeader", first: true, predicate: ["flyoutHeader"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div\n class=\"sky-flyout\"\n tabindex=\"-1\"\n [attr.role]=\"config.ariaRole ? config.ariaRole : 'dialog'\"\n [attr.aria-describedby]=\"config.ariaDescribedBy\"\n [attr.aria-label]=\"config.ariaLabel\"\n [attr.aria-labelledby]=\"config.ariaLabelledBy\"\n [attr.aria-modal]=\"\n config.ariaRole === 'dialog' || !config.ariaRole ? true : false\n \"\n [attr.hidden]=\"!instanceReady ? true : undefined\"\n [id]=\"flyoutId\"\n [ngClass]=\"{\n 'sky-flyout-hidden': !isOpen && !isOpening,\n 'sky-flyout-fullscreen': isFullscreen\n }\"\n [style.z-index]=\"zIndex$ | async\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-elevation-8': 'modern'\n }\"\n (@flyoutState.done)=\"animationDone($event)\"\n [@flyoutState]=\"getAnimationState()\"\n [style.width.px]=\"flyoutWidth\"\n #flyoutRef\n [cdkTrapFocus]=\"enableTrapFocus\"\n [cdkTrapFocusAutoCapture]=\"enableTrapFocusAutoCapture\"\n>\n <div\n class=\"sky-flyout-header\"\n [skyThemeClass]=\"{\n 'sky-padding-squish-large': 'default'\n }\"\n [style.z-index]=\"zIndex$ | async\"\n #flyoutHeader\n >\n <div class=\"sky-flyout-header-content\">\n <button\n *skyThemeIf=\"'modern'\"\n class=\"sky-btn sky-btn-icon-borderless sky-margin-inline-sm sky-flyout-header-grab-handle\"\n [attr.aria-label]=\"'skyux_flyout_resize_handle' | skyLibResources\"\n (keydown)=\"onHeaderGrabHandleKeyDown($event)\"\n (mousedown)=\"onHeaderGrabHandleMouseDown($event)\"\n >\n <sky-icon icon=\"tile-drag\" iconType=\"skyux\" size=\"lg\"> </sky-icon>\n </button>\n\n <sky-flyout-iterator\n *ngIf=\"config.showIterator\"\n [nextButtonDisabled]=\"config.iteratorNextButtonDisabled\"\n [previousButtonDisabled]=\"config.iteratorPreviousButtonDisabled\"\n (nextButtonClick)=\"onIteratorNextButtonClick()\"\n (previousButtonClick)=\"onIteratorPreviousButtonClick()\"\n >\n </sky-flyout-iterator>\n </div>\n <div class=\"sky-flyout-header-buttons\">\n <ng-container *ngTemplateOutlet=\"permalinkTemplate\"> </ng-container>\n <ng-container *ngTemplateOutlet=\"primaryActionTemplate\"> </ng-container>\n <button\n class=\"sky-btn sky-flyout-btn-close sky-label-icon-theme-default\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_flyout_close' | skyLibResources\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"close()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"close\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"close\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n </div>\n </div>\n <div class=\"sky-flyout-content\">\n <div #target></div>\n </div>\n <div\n class=\"sky-flyout-resize-handle\"\n role=\"separator\"\n tabindex=\"0\"\n type=\"range\"\n [attr.aria-controls]=\"flyoutId\"\n [attr.aria-label]=\"'skyux_flyout_resize_handle' | skyLibResources\"\n [attr.aria-valuemax]=\"config.maxWidth\"\n [attr.aria-valuemin]=\"config.minWidth\"\n [attr.aria-valuenow]=\"flyoutWidth\"\n (keydown)=\"onResizeHandleKeyDown($event)\"\n (mousedown)=\"onResizeHandleMouseDown($event)\"\n ></div>\n</div>\n\n<ng-template #permalinkTemplate>\n <ng-template [ngIf]=\"permalink\">\n <ng-template [ngIf]=\"permalink.url\">\n <a\n class=\"sky-btn sky-flyout-btn-permalink sky-margin-inline-default\"\n [skyHref]=\"permalink.url\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-borderless': 'modern'\n }\"\n (click)=\"close()\"\n >\n {{ permalinkLabel }}\n </a>\n </ng-template>\n <ng-template [ngIf]=\"permalink.route\">\n <a\n class=\"sky-btn sky-flyout-btn-permalink sky-margin-inline-default\"\n [routerLink]=\"permalink.route.commands\"\n [fragment]=\"permalink.route.extras?.fragment\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-borderless': 'modern'\n }\"\n [queryParams]=\"permalink.route.extras?.queryParams\"\n [queryParamsHandling]=\"permalink.route.extras?.queryParamsHandling\"\n [state]=\"permalink.route.extras?.state\"\n (click)=\"close()\"\n >\n {{ permalinkLabel }}\n </a>\n </ng-template>\n </ng-template>\n</ng-template>\n\n<ng-template #primaryActionTemplate>\n <ng-template [ngIf]=\"primaryAction && primaryAction.callback\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-flyout-btn-primary-action sky-margin-inline-default\"\n (click)=\"invokePrimaryAction()\"\n >\n {{ primaryActionLabel }}\n </button>\n </ng-template>\n</ng-template>\n", styles: [".sky-flyout{position:fixed;right:0;top:0;bottom:0;height:100%;background-color:#fff;--sky-background-color-page-default: #fff;border-left:6px solid #0974a1}.sky-flyout:focus{outline:none}.sky-flyout.sky-flyout-fullscreen{min-width:100%;max-width:100%}.sky-flyout.sky-flyout-fullscreen .sky-flyout-resize-handle{cursor:initial}.sky-flyout.sky-flyout-hidden{visibility:hidden}.sky-flyout .sky-flyout-input-aria-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0 0 0 0);outline:none}.sky-flyout-resize-handle{-webkit-appearance:none;-moz-appearance:none;height:100%;width:14px;position:absolute;left:-10px;cursor:ew-resize;padding:0;border:0;background:transparent;display:block;top:0;bottom:0;direction:rtl}.sky-flyout-resize-handle::-moz-range-thumb,.sky-flyout-resize-handle::-moz-range-track{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-resize-handle::-ms-thumb,.sky-flyout-resize-handle::-ms-track{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-resize-handle::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-header{border-bottom:1px solid #cdcfd2;width:inherit;background:#eeeeef;height:50px;display:flex;position:fixed;align-items:flex-start}.sky-flyout-header-content{flex-grow:1}.sky-flyout-btn-permalink:hover{text-decoration:none}.sky-flyout-help-shim{padding-right:8px}@media (min-width: 768px){.sky-flyout-help-shim{padding-right:50px}}.sky-flyout-content{overflow-y:auto;margin-top:50px;height:calc(100% - 50px)}:host-context(.sky-theme-modern) .sky-flyout{border-left:0}:host-context(.sky-theme-modern) .sky-flyout-header{border-bottom:none;background:#fff;padding:15px 10px}:host-context(.sky-theme-modern) .sky-flyout-header-grab-handle{cursor:move;cursor:-moz-grab}.sky-theme-modern .sky-flyout{border-left:0}.sky-theme-modern .sky-flyout-header{border-bottom:none;background:#fff;padding:15px 10px}.sky-theme-modern .sky-flyout-header-grab-handle{cursor:move;cursor:-moz-grab}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-flyout{background:#000;--sky-background-color-page-default: #000}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-flyout-header{background:#000}.sky-theme-modern.sky-theme-mode-dark .sky-flyout{background:#000;--sky-background-color-page-default: #000}.sky-theme-modern.sky-theme-mode-dark .sky-flyout-header{background:#000}\n"], dependencies: [{ kind: "directive", type: i5.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }, { kind: "directive", type: i2.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { kind: "directive", type: i2.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { kind: "directive", type: i10.λ1, selector: "[skyHref]", inputs: ["skyHref", "skyHrefElse"], outputs: ["skyHrefChange"] }, { kind: "component", type: SkyFlyoutIteratorComponent, selector: "sky-flyout-iterator", inputs: ["nextButtonDisabled", "previousButtonDisabled"], outputs: ["previousButtonClick", "nextButtonClick"] }, { kind: "pipe", type: i6.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.SkyLibResourcesPipe, name: "skyLibResources" }], animations: [
843
+ trigger('flyoutState', [
844
+ state(FLYOUT_OPEN_STATE, style({ transform: 'initial' })),
845
+ state(FLYOUT_CLOSED_STATE, style({ transform: 'translateX(100%)' })),
846
+ transition('void => *', [
847
+ style({ transform: 'translateX(100%)' }),
848
+ animate(250),
849
+ ]),
850
+ transition(`* <=> *`, animate('250ms ease-in')),
851
+ ]),
852
+ ], changeDetection: i0.ChangeDetectionStrategy.Default }); }
853
+ }
854
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutComponent, decorators: [{
855
+ type: Component,
856
+ args: [{ selector: 'sky-flyout', providers: [
857
+ SkyFlyoutAdapterService,
858
+ SkyFlyoutMediaQueryService,
859
+ { provide: SkyMediaQueryService, useExisting: SkyFlyoutMediaQueryService },
860
+ ], animations: [
861
+ trigger('flyoutState', [
862
+ state(FLYOUT_OPEN_STATE, style({ transform: 'initial' })),
863
+ state(FLYOUT_CLOSED_STATE, style({ transform: 'translateX(100%)' })),
864
+ transition('void => *', [
865
+ style({ transform: 'translateX(100%)' }),
866
+ animate(250),
867
+ ]),
868
+ transition(`* <=> *`, animate('250ms ease-in')),
869
+ ]),
870
+ ], changeDetection: ChangeDetectionStrategy.Default, template: "<div\n class=\"sky-flyout\"\n tabindex=\"-1\"\n [attr.role]=\"config.ariaRole ? config.ariaRole : 'dialog'\"\n [attr.aria-describedby]=\"config.ariaDescribedBy\"\n [attr.aria-label]=\"config.ariaLabel\"\n [attr.aria-labelledby]=\"config.ariaLabelledBy\"\n [attr.aria-modal]=\"\n config.ariaRole === 'dialog' || !config.ariaRole ? true : false\n \"\n [attr.hidden]=\"!instanceReady ? true : undefined\"\n [id]=\"flyoutId\"\n [ngClass]=\"{\n 'sky-flyout-hidden': !isOpen && !isOpening,\n 'sky-flyout-fullscreen': isFullscreen\n }\"\n [style.z-index]=\"zIndex$ | async\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-elevation-8': 'modern'\n }\"\n (@flyoutState.done)=\"animationDone($event)\"\n [@flyoutState]=\"getAnimationState()\"\n [style.width.px]=\"flyoutWidth\"\n #flyoutRef\n [cdkTrapFocus]=\"enableTrapFocus\"\n [cdkTrapFocusAutoCapture]=\"enableTrapFocusAutoCapture\"\n>\n <div\n class=\"sky-flyout-header\"\n [skyThemeClass]=\"{\n 'sky-padding-squish-large': 'default'\n }\"\n [style.z-index]=\"zIndex$ | async\"\n #flyoutHeader\n >\n <div class=\"sky-flyout-header-content\">\n <button\n *skyThemeIf=\"'modern'\"\n class=\"sky-btn sky-btn-icon-borderless sky-margin-inline-sm sky-flyout-header-grab-handle\"\n [attr.aria-label]=\"'skyux_flyout_resize_handle' | skyLibResources\"\n (keydown)=\"onHeaderGrabHandleKeyDown($event)\"\n (mousedown)=\"onHeaderGrabHandleMouseDown($event)\"\n >\n <sky-icon icon=\"tile-drag\" iconType=\"skyux\" size=\"lg\"> </sky-icon>\n </button>\n\n <sky-flyout-iterator\n *ngIf=\"config.showIterator\"\n [nextButtonDisabled]=\"config.iteratorNextButtonDisabled\"\n [previousButtonDisabled]=\"config.iteratorPreviousButtonDisabled\"\n (nextButtonClick)=\"onIteratorNextButtonClick()\"\n (previousButtonClick)=\"onIteratorPreviousButtonClick()\"\n >\n </sky-flyout-iterator>\n </div>\n <div class=\"sky-flyout-header-buttons\">\n <ng-container *ngTemplateOutlet=\"permalinkTemplate\"> </ng-container>\n <ng-container *ngTemplateOutlet=\"primaryActionTemplate\"> </ng-container>\n <button\n class=\"sky-btn sky-flyout-btn-close sky-label-icon-theme-default\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_flyout_close' | skyLibResources\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"close()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"close\"> </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"close\"\n iconType=\"skyux\"\n size=\"lg\"\n >\n </sky-icon>\n </button>\n </div>\n </div>\n <div class=\"sky-flyout-content\">\n <div #target></div>\n </div>\n <div\n class=\"sky-flyout-resize-handle\"\n role=\"separator\"\n tabindex=\"0\"\n type=\"range\"\n [attr.aria-controls]=\"flyoutId\"\n [attr.aria-label]=\"'skyux_flyout_resize_handle' | skyLibResources\"\n [attr.aria-valuemax]=\"config.maxWidth\"\n [attr.aria-valuemin]=\"config.minWidth\"\n [attr.aria-valuenow]=\"flyoutWidth\"\n (keydown)=\"onResizeHandleKeyDown($event)\"\n (mousedown)=\"onResizeHandleMouseDown($event)\"\n ></div>\n</div>\n\n<ng-template #permalinkTemplate>\n <ng-template [ngIf]=\"permalink\">\n <ng-template [ngIf]=\"permalink.url\">\n <a\n class=\"sky-btn sky-flyout-btn-permalink sky-margin-inline-default\"\n [skyHref]=\"permalink.url\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-borderless': 'modern'\n }\"\n (click)=\"close()\"\n >\n {{ permalinkLabel }}\n </a>\n </ng-template>\n <ng-template [ngIf]=\"permalink.route\">\n <a\n class=\"sky-btn sky-flyout-btn-permalink sky-margin-inline-default\"\n [routerLink]=\"permalink.route.commands\"\n [fragment]=\"permalink.route.extras?.fragment\"\n [skyThemeClass]=\"{\n 'sky-btn-default': 'default',\n 'sky-btn-borderless': 'modern'\n }\"\n [queryParams]=\"permalink.route.extras?.queryParams\"\n [queryParamsHandling]=\"permalink.route.extras?.queryParamsHandling\"\n [state]=\"permalink.route.extras?.state\"\n (click)=\"close()\"\n >\n {{ permalinkLabel }}\n </a>\n </ng-template>\n </ng-template>\n</ng-template>\n\n<ng-template #primaryActionTemplate>\n <ng-template [ngIf]=\"primaryAction && primaryAction.callback\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-flyout-btn-primary-action sky-margin-inline-default\"\n (click)=\"invokePrimaryAction()\"\n >\n {{ primaryActionLabel }}\n </button>\n </ng-template>\n</ng-template>\n", styles: [".sky-flyout{position:fixed;right:0;top:0;bottom:0;height:100%;background-color:#fff;--sky-background-color-page-default: #fff;border-left:6px solid #0974a1}.sky-flyout:focus{outline:none}.sky-flyout.sky-flyout-fullscreen{min-width:100%;max-width:100%}.sky-flyout.sky-flyout-fullscreen .sky-flyout-resize-handle{cursor:initial}.sky-flyout.sky-flyout-hidden{visibility:hidden}.sky-flyout .sky-flyout-input-aria-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0 0 0 0);outline:none}.sky-flyout-resize-handle{-webkit-appearance:none;-moz-appearance:none;height:100%;width:14px;position:absolute;left:-10px;cursor:ew-resize;padding:0;border:0;background:transparent;display:block;top:0;bottom:0;direction:rtl}.sky-flyout-resize-handle::-moz-range-thumb,.sky-flyout-resize-handle::-moz-range-track{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-resize-handle::-ms-thumb,.sky-flyout-resize-handle::-ms-track{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-resize-handle::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0 none;background:none;display:none}.sky-flyout-header{border-bottom:1px solid #cdcfd2;width:inherit;background:#eeeeef;height:50px;display:flex;position:fixed;align-items:flex-start}.sky-flyout-header-content{flex-grow:1}.sky-flyout-btn-permalink:hover{text-decoration:none}.sky-flyout-help-shim{padding-right:8px}@media (min-width: 768px){.sky-flyout-help-shim{padding-right:50px}}.sky-flyout-content{overflow-y:auto;margin-top:50px;height:calc(100% - 50px)}:host-context(.sky-theme-modern) .sky-flyout{border-left:0}:host-context(.sky-theme-modern) .sky-flyout-header{border-bottom:none;background:#fff;padding:15px 10px}:host-context(.sky-theme-modern) .sky-flyout-header-grab-handle{cursor:move;cursor:-moz-grab}.sky-theme-modern .sky-flyout{border-left:0}.sky-theme-modern .sky-flyout-header{border-bottom:none;background:#fff;padding:15px 10px}.sky-theme-modern .sky-flyout-header-grab-handle{cursor:move;cursor:-moz-grab}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-flyout{background:#000;--sky-background-color-page-default: #000}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-flyout-header{background:#000}.sky-theme-modern.sky-theme-mode-dark .sky-flyout{background:#000;--sky-background-color-page-default: #000}.sky-theme-modern.sky-theme-mode-dark .sky-flyout-header{background:#000}\n"] }]
871
+ }], ctorParameters: function () { return [{ type: SkyFlyoutAdapterService }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }, { type: i2$1.SkyLibResourcesService }, { type: SkyFlyoutMediaQueryService }, { type: i0.ElementRef }, { type: i1$1.SkyUIConfigService }, { type: i0.NgZone }]; }, propDecorators: { flyoutRef: [{
872
+ type: ViewChild,
873
+ args: ['flyoutRef', {
874
+ read: ElementRef,
875
+ static: true,
876
+ }]
877
+ }], target: [{
878
+ type: ViewChild,
879
+ args: ['target', {
880
+ read: ViewContainerRef,
881
+ static: true,
882
+ }]
883
+ }], flyoutHeader: [{
884
+ type: ViewChild,
885
+ args: ['flyoutHeader', {
886
+ read: ElementRef,
887
+ static: true,
888
+ }]
889
+ }], onWindowResize: [{
890
+ type: HostListener,
891
+ args: ['window:resize', ['$event']]
892
+ }] } });
893
+
894
+ class SkyFlyoutModule {
895
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
896
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutModule, declarations: [SkyFlyoutComponent, SkyFlyoutIteratorComponent], imports: [A11yModule,
897
+ CommonModule,
898
+ FormsModule,
899
+ RouterModule,
900
+ SkyI18nModule,
901
+ SkyIconModule,
902
+ SkyFlyoutResourcesModule,
903
+ SkyThemeModule,
904
+ SkyHrefModule], exports: [SkyFlyoutComponent] }); }
905
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutModule, imports: [A11yModule,
906
+ CommonModule,
907
+ FormsModule,
908
+ RouterModule,
909
+ SkyI18nModule,
910
+ SkyIconModule,
911
+ SkyFlyoutResourcesModule,
912
+ SkyThemeModule,
913
+ SkyHrefModule] }); }
914
+ }
915
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutModule, decorators: [{
916
+ type: NgModule,
917
+ args: [{
918
+ declarations: [SkyFlyoutComponent, SkyFlyoutIteratorComponent],
919
+ imports: [
920
+ A11yModule,
921
+ CommonModule,
922
+ FormsModule,
923
+ RouterModule,
924
+ SkyI18nModule,
925
+ SkyIconModule,
926
+ SkyFlyoutResourcesModule,
927
+ SkyThemeModule,
928
+ SkyHrefModule,
929
+ ],
930
+ exports: [SkyFlyoutComponent],
931
+ }]
932
+ }] });
933
+
934
+ /**
935
+ * Launches flyouts and provides a common look and feel.
936
+ * This service dynamically generates the flyout component and appends it directly to the
937
+ * document's `body` element. The `SkyFlyoutInstance` class watches for and triggers flyout events.
938
+ */
939
+ class SkyFlyoutService {
940
+ #host;
941
+ #removeAfterClosed = false;
942
+ #isOpening = false;
943
+ #ngUnsubscribe = new Subject();
944
+ #coreAdapter;
945
+ #windowRef;
946
+ #dynamicComponentService;
947
+ #router;
948
+ #ngZone;
949
+ constructor(coreAdapter, windowRef, dynamicComponentService, router, ngZone) {
950
+ this.#coreAdapter = coreAdapter;
951
+ this.#windowRef = windowRef;
952
+ this.#dynamicComponentService = dynamicComponentService;
953
+ this.#router = router;
954
+ this.#ngZone = ngZone;
955
+ }
956
+ ngOnDestroy() {
957
+ this.#removeListeners();
958
+ if (this.#host) {
959
+ this.#removeHostComponent();
960
+ }
961
+ }
962
+ /**
963
+ * Closes the flyout. This method also removes the flyout's HTML elements from the DOM.
964
+ * @param args Arguments used when closing the flyout.
965
+ */
966
+ close(args) {
967
+ if (this.#host && !this.#isOpening) {
968
+ this.#host.instance.messageStream.next({
969
+ type: SkyFlyoutMessageType.Close,
970
+ data: {
971
+ ignoreBeforeClose: args ? args.ignoreBeforeClose : false,
972
+ },
973
+ });
974
+ }
975
+ }
976
+ /**
977
+ * Opens a flyout and displays the specified component.
978
+ * @param component Specifies the component to render.
979
+ * @param config Specifies the flyout configuration passed to the specified component's constructor.
980
+ */
981
+ open(component, config) {
982
+ // isOpening flag will prevent close() from firing when open() is also fired.
983
+ this.#isOpening = true;
984
+ this.#windowRef.nativeWindow.setTimeout(() => {
985
+ this.#isOpening = false;
986
+ });
987
+ if (!this.#host) {
988
+ this.#host = this.#createHostComponent();
989
+ this.#router.events
990
+ .pipe(takeWhile(() => this.#host !== undefined))
991
+ .subscribe((event) => {
992
+ if (event instanceof NavigationStart) {
993
+ this.close();
994
+ // Sanity check - if the host still exists after animations should have completed - remove host
995
+ this.#ngZone.onStable.pipe(take(1)).subscribe(() => {
996
+ if (this.#host) {
997
+ this.#removeHostComponent();
998
+ }
999
+ });
1000
+ }
1001
+ });
1002
+ }
1003
+ const flyout = this.#host.instance.attach(component, config);
1004
+ this.#addListeners(flyout);
1005
+ return flyout;
1006
+ }
1007
+ #createHostComponent() {
1008
+ this.#host =
1009
+ this.#dynamicComponentService.createComponent(SkyFlyoutComponent);
1010
+ return this.#host;
1011
+ }
1012
+ #removeHostComponent() {
1013
+ if (this.#host) {
1014
+ this.#dynamicComponentService.removeComponent(this.#host);
1015
+ this.#host = undefined;
1016
+ }
1017
+ }
1018
+ #addListeners(flyout) {
1019
+ /* istanbul ignore else */
1020
+ if (this.#host) {
1021
+ const flyoutInstance = this.#host.instance;
1022
+ let doClose = false;
1023
+ /**
1024
+ * Handles when to close a flyout.
1025
+ * Note: We're using `mouseup` in order to capture the parent of certain targets that will be
1026
+ * deleted immediately after being clicked. If we use `click`, the event is fired after the
1027
+ * element is removed from the DOM making it impossible to check the parent's z-index
1028
+ * relative to the flyout's container.
1029
+ */
1030
+ fromEvent(document, 'mouseup')
1031
+ .pipe(takeUntil(this.#ngUnsubscribe))
1032
+ .subscribe((event) => {
1033
+ doClose = false;
1034
+ if (this.#host?.instance.isDragging) {
1035
+ return;
1036
+ }
1037
+ if (flyoutInstance.flyoutRef?.nativeElement.contains(event.target)) {
1038
+ return;
1039
+ }
1040
+ const isAbove = event.target === document || !event.target
1041
+ ? false
1042
+ : this.#coreAdapter.isTargetAboveElement(event.target, flyoutInstance.flyoutRef?.nativeElement);
1043
+ /* istanbul ignore else */
1044
+ if (!isAbove) {
1045
+ doClose = true;
1046
+ }
1047
+ });
1048
+ /**
1049
+ * Check if we should close the flyout specifically on a `click` event so that we can keep
1050
+ * it open when consumers fire another `click` event on a trigger button. Since the consumer
1051
+ * will likely use a `click` event to open the flyout, we want to wait for that event to fire
1052
+ * before determining if the flyout should be closed.
1053
+ */
1054
+ fromEvent(document, 'click')
1055
+ .pipe(takeUntil(this.#ngUnsubscribe))
1056
+ .subscribe(() => {
1057
+ if (doClose) {
1058
+ this.close();
1059
+ }
1060
+ });
1061
+ this.#removeAfterClosed = false;
1062
+ flyoutInstance.messageStream
1063
+ .pipe(takeUntil(this.#ngUnsubscribe))
1064
+ .subscribe((message) => {
1065
+ if (message.type === SkyFlyoutMessageType.Close) {
1066
+ this.#removeAfterClosed = true;
1067
+ this.#isOpening = false;
1068
+ }
1069
+ });
1070
+ flyout.closed.pipe(take(1)).subscribe(() => {
1071
+ this.#removeListeners();
1072
+ if (this.#removeAfterClosed) {
1073
+ this.#removeHostComponent();
1074
+ }
1075
+ });
1076
+ }
1077
+ }
1078
+ #removeListeners() {
1079
+ this.#ngUnsubscribe.next(true);
1080
+ this.#ngUnsubscribe.unsubscribe();
1081
+ this.#ngUnsubscribe = new Subject();
1082
+ }
1083
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutService, deps: [{ token: i1$1.SkyCoreAdapterService }, { token: i1$1.SkyAppWindowRef }, { token: i1$1.SkyDynamicComponentService }, { token: i2$2.Router }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
1084
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutService, providedIn: 'any' }); }
1085
+ }
1086
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SkyFlyoutService, decorators: [{
1087
+ type: Injectable,
1088
+ args: [{
1089
+ providedIn: 'any',
1090
+ }]
1091
+ }], ctorParameters: function () { return [{ type: i1$1.SkyCoreAdapterService }, { type: i1$1.SkyAppWindowRef }, { type: i1$1.SkyDynamicComponentService }, { type: i2$2.Router }, { type: i0.NgZone }]; } });
1092
+
1093
+ /**
1094
+ * Generated bundle index. Do not edit.
1095
+ */
1096
+
1097
+ export { SkyFlyoutBeforeCloseHandler, SkyFlyoutInstance, SkyFlyoutMessageType, SkyFlyoutModule, SkyFlyoutService, SkyFlyoutComponent as λ1 };
1098
+ //# sourceMappingURL=skyux-flyout.mjs.map