@taiga-ui/core 4.52.0-canary.e444d19 → 4.52.0-canary.eb5ffe3

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 (175) hide show
  1. package/components/alert/alert.component.d.ts +5 -6
  2. package/components/alert/alert.directive.d.ts +4 -3
  3. package/components/alert/alert.interfaces.d.ts +3 -2
  4. package/components/alert/alert.service.d.ts +6 -2
  5. package/components/alert/alert.tokens.d.ts +1 -7
  6. package/components/alert/index.d.ts +0 -1
  7. package/components/button/button.directive.d.ts +2 -2
  8. package/components/button/button.options.d.ts +1 -1
  9. package/components/cell/cell.directive.d.ts +9 -0
  10. package/components/cell/cell.options.d.ts +6 -0
  11. package/components/cell/index.d.ts +2 -0
  12. package/components/data-list/data-list.component.d.ts +1 -1
  13. package/components/dialog/active-zone-adapter.directive.d.ts +11 -0
  14. package/components/dialog/dialog.component.d.ts +6 -11
  15. package/components/dialog/dialog.directive.d.ts +1 -1
  16. package/components/dialog/dialog.factory.d.ts +1 -1
  17. package/components/dialog/dialog.options.d.ts +26 -0
  18. package/components/dialog/{dialog-close.service.d.ts → dialog.providers.d.ts} +4 -1
  19. package/components/dialog/dialog.service.d.ts +1 -1
  20. package/components/dialog/index.d.ts +2 -3
  21. package/components/error/error.component.d.ts +6 -8
  22. package/components/error/error.d.ts +4 -0
  23. package/components/error/error.directive.d.ts +19 -0
  24. package/components/error/error.pipe.d.ts +10 -0
  25. package/components/error/index.d.ts +3 -0
  26. package/components/expand/expand.component.d.ts +9 -28
  27. package/components/expand/index.d.ts +0 -2
  28. package/components/header/header.directive.d.ts +17 -0
  29. package/components/header/index.d.ts +1 -0
  30. package/components/icon/icon.component.d.ts +1 -1
  31. package/components/index.d.ts +2 -1
  32. package/components/notification/notification.directive.d.ts +1 -1
  33. package/components/notification/notification.options.d.ts +1 -1
  34. package/components/root/root.component.d.ts +4 -6
  35. package/components/scrollbar/scrollbar.options.d.ts +1 -1
  36. package/components/spin-button/spin-button.component.d.ts +1 -1
  37. package/components/textfield/index.d.ts +1 -3
  38. package/components/textfield/textfield-content.directive.d.ts +3 -2
  39. package/components/textfield/textfield-icon.d.ts +3 -3
  40. package/components/textfield/textfield-multi/textfield-multi.component.d.ts +4 -5
  41. package/components/textfield/textfield.component.d.ts +2 -3
  42. package/components/textfield/textfield.d.ts +2 -3
  43. package/components/textfield/textfield.directive.d.ts +2 -2
  44. package/components/textfield/textfield.options.d.ts +8 -11
  45. package/directives/appearance/appearance.directive.d.ts +5 -13
  46. package/directives/appearance/appearance.options.d.ts +1 -1
  47. package/directives/dropdown/dropdown-content.directive.d.ts +9 -0
  48. package/directives/dropdown/dropdown.d.ts +2 -2
  49. package/directives/dropdown/dropdown.directive.d.ts +1 -2
  50. package/directives/dropdown/index.d.ts +1 -3
  51. package/directives/hint/hint-describe.directive.d.ts +4 -6
  52. package/directives/hint/hint-host.directive.d.ts +2 -2
  53. package/directives/hint/hint-hover.directive.d.ts +3 -4
  54. package/directives/hint/hint-manual.directive.d.ts +2 -2
  55. package/directives/hint/hint-options.directive.d.ts +3 -3
  56. package/directives/hint/hint-overflow.directive.d.ts +2 -2
  57. package/directives/hint/hint-position.directive.d.ts +4 -5
  58. package/directives/hint/hint-unstyled.component.d.ts +2 -7
  59. package/directives/hint/hint.component.d.ts +10 -11
  60. package/directives/hint/hint.directive.d.ts +9 -11
  61. package/directives/hint/index.d.ts +0 -2
  62. package/directives/icons/icons.bindings.d.ts +5 -0
  63. package/directives/icons/icons.directive.d.ts +6 -14
  64. package/directives/icons/index.d.ts +1 -0
  65. package/directives/index.d.ts +1 -1
  66. package/directives/notification/index.d.ts +2 -0
  67. package/directives/notification/notification.directive.d.ts +11 -0
  68. package/directives/notification/notification.service.d.ts +12 -0
  69. package/directives/popup/popup.directive.d.ts +6 -5
  70. package/directives/popup/popup.service.d.ts +1 -1
  71. package/directives/popup/popups.component.d.ts +2 -2
  72. package/directives/title/title.directive.d.ts +2 -3
  73. package/fesm2022/taiga-ui-core-components-alert.mjs +58 -97
  74. package/fesm2022/taiga-ui-core-components-alert.mjs.map +1 -1
  75. package/fesm2022/taiga-ui-core-components-button.mjs +11 -18
  76. package/fesm2022/taiga-ui-core-components-button.mjs.map +1 -1
  77. package/fesm2022/taiga-ui-core-components-calendar.mjs +4 -3
  78. package/fesm2022/taiga-ui-core-components-calendar.mjs.map +1 -1
  79. package/fesm2022/taiga-ui-core-components-cell.mjs +45 -0
  80. package/fesm2022/taiga-ui-core-components-cell.mjs.map +1 -0
  81. package/fesm2022/taiga-ui-core-components-data-list.mjs +7 -7
  82. package/fesm2022/taiga-ui-core-components-data-list.mjs.map +1 -1
  83. package/fesm2022/taiga-ui-core-components-dialog.mjs +89 -69
  84. package/fesm2022/taiga-ui-core-components-dialog.mjs.map +1 -1
  85. package/fesm2022/taiga-ui-core-components-error.mjs +108 -24
  86. package/fesm2022/taiga-ui-core-components-error.mjs.map +1 -1
  87. package/fesm2022/taiga-ui-core-components-expand.mjs +33 -131
  88. package/fesm2022/taiga-ui-core-components-expand.mjs.map +1 -1
  89. package/fesm2022/taiga-ui-core-components-header.mjs +42 -0
  90. package/fesm2022/taiga-ui-core-components-header.mjs.map +1 -0
  91. package/fesm2022/taiga-ui-core-components-icon.mjs +2 -2
  92. package/fesm2022/taiga-ui-core-components-icon.mjs.map +1 -1
  93. package/fesm2022/taiga-ui-core-components-label.mjs +6 -9
  94. package/fesm2022/taiga-ui-core-components-label.mjs.map +1 -1
  95. package/fesm2022/taiga-ui-core-components-link.mjs +6 -9
  96. package/fesm2022/taiga-ui-core-components-link.mjs.map +1 -1
  97. package/fesm2022/taiga-ui-core-components-loader.mjs +2 -2
  98. package/fesm2022/taiga-ui-core-components-loader.mjs.map +1 -1
  99. package/fesm2022/taiga-ui-core-components-notification.mjs +13 -27
  100. package/fesm2022/taiga-ui-core-components-notification.mjs.map +1 -1
  101. package/fesm2022/taiga-ui-core-components-root.mjs +17 -46
  102. package/fesm2022/taiga-ui-core-components-root.mjs.map +1 -1
  103. package/fesm2022/taiga-ui-core-components-scrollbar.mjs.map +1 -1
  104. package/fesm2022/taiga-ui-core-components-spin-button.mjs +4 -5
  105. package/fesm2022/taiga-ui-core-components-spin-button.mjs.map +1 -1
  106. package/fesm2022/taiga-ui-core-components-textfield.mjs +143 -248
  107. package/fesm2022/taiga-ui-core-components-textfield.mjs.map +1 -1
  108. package/fesm2022/taiga-ui-core-components.mjs +2 -1
  109. package/fesm2022/taiga-ui-core-components.mjs.map +1 -1
  110. package/fesm2022/taiga-ui-core-directives-appearance.mjs +21 -58
  111. package/fesm2022/taiga-ui-core-directives-appearance.mjs.map +1 -1
  112. package/fesm2022/taiga-ui-core-directives-dropdown.mjs +34 -71
  113. package/fesm2022/taiga-ui-core-directives-dropdown.mjs.map +1 -1
  114. package/fesm2022/taiga-ui-core-directives-group.mjs +6 -9
  115. package/fesm2022/taiga-ui-core-directives-group.mjs.map +1 -1
  116. package/fesm2022/taiga-ui-core-directives-hint.mjs +113 -211
  117. package/fesm2022/taiga-ui-core-directives-hint.mjs.map +1 -1
  118. package/fesm2022/taiga-ui-core-directives-icons.mjs +30 -40
  119. package/fesm2022/taiga-ui-core-directives-icons.mjs.map +1 -1
  120. package/fesm2022/taiga-ui-core-directives-items-handlers.mjs +2 -2
  121. package/fesm2022/taiga-ui-core-directives-items-handlers.mjs.map +1 -1
  122. package/fesm2022/taiga-ui-core-directives-notification.mjs +73 -0
  123. package/fesm2022/taiga-ui-core-directives-notification.mjs.map +1 -0
  124. package/fesm2022/taiga-ui-core-directives-popup.mjs +13 -20
  125. package/fesm2022/taiga-ui-core-directives-popup.mjs.map +1 -1
  126. package/fesm2022/taiga-ui-core-directives-title.mjs +11 -17
  127. package/fesm2022/taiga-ui-core-directives-title.mjs.map +1 -1
  128. package/fesm2022/taiga-ui-core-directives.mjs +1 -1
  129. package/fesm2022/taiga-ui-core-pipes-month.mjs +2 -1
  130. package/fesm2022/taiga-ui-core-pipes-month.mjs.map +1 -1
  131. package/fesm2022/taiga-ui-core-pipes.mjs +0 -1
  132. package/fesm2022/taiga-ui-core-pipes.mjs.map +1 -1
  133. package/fesm2022/taiga-ui-core-tokens.mjs +7 -6
  134. package/fesm2022/taiga-ui-core-tokens.mjs.map +1 -1
  135. package/fesm2022/taiga-ui-core-utils-miscellaneous.mjs +50 -4
  136. package/fesm2022/taiga-ui-core-utils-miscellaneous.mjs.map +1 -1
  137. package/package.json +14 -14
  138. package/pipes/index.d.ts +0 -1
  139. package/styles/components/button.less +0 -2
  140. package/styles/components/icons.less +4 -4
  141. package/styles/mixins/mixins.less +0 -1
  142. package/styles/mixins/mixins.scss +0 -1
  143. package/styles/mixins/slider.less +21 -16
  144. package/tokens/i18n.d.ts +7 -7
  145. package/tokens/icon-resolver.d.ts +0 -4
  146. package/tokens/index.d.ts +1 -0
  147. package/tokens/validation-errors.d.ts +4 -0
  148. package/types/index.d.ts +0 -1
  149. package/utils/miscellaneous/index.d.ts +1 -0
  150. package/utils/miscellaneous/provide-taiga.d.ts +13 -0
  151. package/components/alert/alerts.component.d.ts +0 -12
  152. package/components/dialog/dialog.interfaces.d.ts +0 -34
  153. package/components/dialog/dialog.tokens.d.ts +0 -15
  154. package/components/expand/expand-content.directive.d.ts +0 -8
  155. package/components/expand/expand.d.ts +0 -6
  156. package/components/fullscreen/fullscreen.component.d.ts +0 -14
  157. package/components/fullscreen/index.d.ts +0 -1
  158. package/components/textfield/select.directive.d.ts +0 -19
  159. package/components/textfield/textfield-dropdown.directive.d.ts +0 -16
  160. package/directives/dropdown/dropdown-portal.directive.d.ts +0 -14
  161. package/directives/dropdown/dropdown.service.d.ts +0 -6
  162. package/directives/dropdown/dropdowns.component.d.ts +0 -9
  163. package/directives/hint/hint.service.d.ts +0 -13
  164. package/directives/hint/hints.component.d.ts +0 -12
  165. package/directives/surface/index.d.ts +0 -1
  166. package/directives/surface/surface.directive.d.ts +0 -8
  167. package/fesm2022/taiga-ui-core-components-fullscreen.mjs +0 -66
  168. package/fesm2022/taiga-ui-core-components-fullscreen.mjs.map +0 -1
  169. package/fesm2022/taiga-ui-core-directives-surface.mjs +0 -50
  170. package/fesm2022/taiga-ui-core-directives-surface.mjs.map +0 -1
  171. package/fesm2022/taiga-ui-core-pipes-fallback-src.mjs +0 -29
  172. package/fesm2022/taiga-ui-core-pipes-fallback-src.mjs.map +0 -1
  173. package/pipes/fallback-src/fallback-src.pipe.d.ts +0 -9
  174. package/pipes/fallback-src/index.d.ts +0 -1
  175. package/types/portal-item.d.ts +0 -9
@@ -1,57 +1,37 @@
1
- import { DOCUMENT, AsyncPipe } from '@angular/common';
2
1
  import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, Injectable, computed, ChangeDetectionStrategy, Component, Directive, assertInInjectionContext, INJECTOR } from '@angular/core';
4
- import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
2
+ import { InjectionToken, inject, Injectable, ChangeDetectionStrategy, ViewEncapsulation, Component, Directive, assertInInjectionContext, INJECTOR } from '@angular/core';
3
+ import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
5
4
  import { TUI_TRUE_HANDLER } from '@taiga-ui/cdk/constants';
6
5
  import * as i1 from '@taiga-ui/cdk/directives/animated';
7
6
  import { TuiAnimated, TuiAnimatedParent } from '@taiga-ui/cdk/directives/animated';
8
7
  import { TuiAutoFocus } from '@taiga-ui/cdk/directives/auto-focus';
9
8
  import { TuiButton } from '@taiga-ui/core/components/button';
10
- import { TuiBreakpointService } from '@taiga-ui/core/services';
9
+ import { TuiHeader, tuiHeaderOptionsProvider } from '@taiga-ui/core/components/header';
10
+ import { TuiTitle } from '@taiga-ui/core/directives/title';
11
11
  import { TUI_CLOSE_WORD, TUI_COMMON_ICONS } from '@taiga-ui/core/tokens';
12
12
  import { injectContext, PolymorpheusOutlet, PolymorpheusComponent } from '@taiga-ui/polymorpheus';
13
- import { BehaviorSubject, EMPTY, Observable, merge, filter, switchMap, take, map, of, isObservable, Subject, exhaustMap } from 'rxjs';
14
- import { tuiProvideOptions } from '@taiga-ui/cdk/utils/miscellaneous';
13
+ import { BehaviorSubject, filter, Observable, merge, switchMap, take, map, of, isObservable, Subject, exhaustMap } from 'rxjs';
14
+ import { DOCUMENT } from '@angular/common';
15
+ import { Router, ActivationStart } from '@angular/router';
15
16
  import { WA_WINDOW } from '@ng-web-apis/common';
16
17
  import { tuiCloseWatcher, tuiZonefull, tuiTypedFromEvent } from '@taiga-ui/cdk/observables';
17
18
  import { tuiInjectElement, tuiGetActualTarget, tuiIsElement, tuiContainsOrAfter } from '@taiga-ui/cdk/utils/dom';
18
19
  import { tuiGetViewportWidth } from '@taiga-ui/core/utils';
19
20
  import { TuiPopoverDirective } from '@taiga-ui/cdk/directives/popover';
20
21
  import { TuiPopoverService, tuiAsPopover } from '@taiga-ui/cdk/services';
22
+ import { tuiCreateOptions } from '@taiga-ui/cdk/utils/di';
21
23
  import { TuiFocusTrap } from '@taiga-ui/cdk/directives/focus-trap';
22
24
  import { TuiScrollControls, TuiScrollRef } from '@taiga-ui/core/components/scrollbar';
25
+ import * as i1$1 from '@taiga-ui/cdk/directives/active-zone';
26
+ import { TuiActiveZone } from '@taiga-ui/cdk/directives/active-zone';
27
+ import { tuiGetFocused } from '@taiga-ui/cdk/utils/focus';
23
28
 
24
29
  const TUI_DIALOGS = new InjectionToken(ngDevMode ? 'TUI_DIALOGS' : '', {
25
30
  factory: () => new BehaviorSubject([]),
26
31
  });
27
- const TUI_DIALOG_DEFAULT_OPTIONS = {
28
- appearance: '',
29
- size: 'm',
30
- required: false,
31
- closeable: true,
32
- dismissible: true,
33
- label: '',
34
- header: '',
35
- data: undefined,
36
- };
37
- /**
38
- * A stream to close dialogs
39
- * TODO: use router.events in v5
40
- */
41
32
  const TUI_DIALOGS_CLOSE = new InjectionToken(ngDevMode ? 'TUI_DIALOGS_CLOSE' : '', {
42
- factory: () => EMPTY,
33
+ factory: () => inject(Router).events.pipe(filter((e) => e instanceof ActivationStart)),
43
34
  });
44
- /**
45
- * Default parameters for dialog component
46
- */
47
- const TUI_DIALOG_OPTIONS = new InjectionToken(ngDevMode ? 'TUI_DIALOG_OPTIONS' : '', {
48
- factory: () => TUI_DIALOG_DEFAULT_OPTIONS,
49
- });
50
- function tuiDialogOptionsProvider(options) {
51
- return tuiProvideOptions(TUI_DIALOG_OPTIONS, options, TUI_DIALOG_DEFAULT_OPTIONS);
52
- }
53
-
54
- const SCROLLBAR_PLACEHOLDER = 17;
55
35
  class TuiDialogCloseService extends Observable {
56
36
  constructor() {
57
37
  super((subscriber) => merge(this.esc$, this.mousedown$, tuiCloseWatcher().pipe(tuiZonefull())).subscribe(subscriber));
@@ -67,14 +47,13 @@ class TuiDialogCloseService extends Observable {
67
47
  !event.defaultPrevented &&
68
48
  (this.el.contains(target) || this.isOutside(target)));
69
49
  }));
70
- this.mousedown$ = tuiTypedFromEvent(this.doc, 'mousedown').pipe(filter((event) => tuiGetViewportWidth(this.win) - event.clientX > SCROLLBAR_PLACEHOLDER &&
50
+ this.mousedown$ = tuiTypedFromEvent(this.doc, 'mousedown').pipe(filter((event) =>
51
+ // Scrollbars
52
+ tuiGetViewportWidth(this.win) - event.clientX > 17 &&
71
53
  this.isOutside(tuiGetActualTarget(event))), switchMap(() => tuiTypedFromEvent(this.doc, 'mouseup').pipe(take(1), map(tuiGetActualTarget), filter((target) => this.isOutside(target)))));
72
54
  }
73
55
  isOutside(target) {
74
- return (tuiIsElement(target) &&
75
- (!tuiContainsOrAfter(this.el, target) ||
76
- // TODO: Drop 'new' attribute in v5
77
- (target === this.el && !this.el.hasAttribute('new'))));
56
+ return tuiIsElement(target) && !tuiContainsOrAfter(this.el, target);
78
57
  }
79
58
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDialogCloseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
80
59
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDialogCloseService }); }
@@ -90,45 +69,55 @@ function toObservable(valueOrStream) {
90
69
  class TuiDialogComponent {
91
70
  constructor() {
92
71
  this.close$ = new Subject();
93
- this.context = injectContext();
94
- this.closeWord$ = inject(TUI_CLOSE_WORD);
72
+ this.close = inject(TUI_CLOSE_WORD);
95
73
  this.icons = inject(TUI_COMMON_ICONS);
96
- this.from = computed(() => this.size === 'fullscreen' || this.size === 'page' || this.isMobile()
97
- ? 'translateY(100vh)'
98
- : 'translateY(2.5rem)');
99
- this.isMobile = toSignal(inject(TuiBreakpointService).pipe(map((breakpoint) => breakpoint === 'mobile')));
100
- merge(this.close$.pipe(switchMap(() => toObservable(this.context.closeable))), inject(TuiDialogCloseService).pipe(exhaustMap(() => toObservable(this.context.dismissible).pipe(take(1)))), inject(TUI_DIALOGS_CLOSE).pipe(map(TUI_TRUE_HANDLER)))
74
+ this.context = injectContext();
75
+ this.primitive = typeof this.context.content === 'function' ||
76
+ Object(this.context.content) !== this.context.content;
77
+ this.sub = merge(this.close$.pipe(switchMap(() => toObservable(this.context.closable))), inject(TuiDialogCloseService).pipe(exhaustMap(() => toObservable(this.context.dismissible).pipe(take(1)))), inject(TUI_DIALOGS_CLOSE).pipe(map(TUI_TRUE_HANDLER)))
101
78
  .pipe(filter(Boolean), takeUntilDestroyed())
102
79
  .subscribe(() => {
103
- this.close();
80
+ if (this.context.required) {
81
+ this.context.$implicit.error(REQUIRED_ERROR);
82
+ }
83
+ else {
84
+ this.context.$implicit.complete();
85
+ }
104
86
  });
105
87
  }
106
- get size() {
107
- return this.context.size;
108
- }
109
- get header() {
110
- return this.context.header;
111
- }
112
- close() {
113
- if (this.context.required) {
114
- this.context.$implicit.error(REQUIRED_ERROR);
115
- }
116
- else {
117
- this.context.$implicit.complete();
118
- }
119
- }
120
88
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
121
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TuiDialogComponent, isStandalone: true, selector: "tui-dialog", host: { properties: { "attr.data-appearance": "context.appearance", "attr.data-size": "size", "class._centered": "header", "style.--tui-from": "from()" } }, providers: [TuiDialogCloseService], hostDirectives: [{ directive: i1.TuiAnimated }], ngImport: i0, template: "@if (header) {\n <header class=\"t-header\">\n <ng-container *polymorpheusOutlet=\"header as text; context: context\">\n {{ text }}\n </ng-container>\n </header>\n}\n<div class=\"t-content\">\n <h2\n class=\"t-heading\"\n [class.t-heading_closable]=\"context.closeable && !header\"\n [id]=\"context.id\"\n [textContent]=\"context.label\"\n ></h2>\n <section>\n <ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n <div [innerHTML]=\"text\"></div>\n @if (context.closeable || context.dismissible) {\n <div class=\"t-buttons\">\n <button\n size=\"m\"\n tuiAutoFocus\n tuiButton\n type=\"button\"\n (click)=\"context.$implicit.complete()\"\n >\n {{ context.data?.button || 'OK' }}\n </button>\n </div>\n }\n </ng-container>\n </section>\n</div>\n<div class=\"t-filler\"></div>\n\n<!-- Close button is insensitive to `context.closeable === Observable<false>` by design -->\n@if (context.closeable) {\n <button\n automation-id=\"tui-dialog__close\"\n tuiIconButton\n type=\"button\"\n class=\"t-close\"\n [appearance]=\"isMobile() ? 'icon' : 'neutral'\"\n [iconStart]=\"icons.close\"\n [size]=\"isMobile() ? 'xs' : 's'\"\n [style.border-radius.%]=\"100\"\n (click)=\"close$.next()\"\n (mousedown.prevent.zoneless)=\"(0)\"\n >\n {{ closeWord$ | async }}\n </button>\n}\n", styles: [":host{position:relative;display:flex;font:var(--tui-font-text-m);flex-direction:column;box-sizing:border-box;margin:auto;border-radius:1.5rem;border:2.5rem solid transparent}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:\"\";border-radius:inherit;pointer-events:none;box-shadow:var(--tui-shadow-popup)}:host[data-size=auto]{inline-size:auto}:host[data-size=s]{inline-size:30rem}:host[data-size=s] .t-content{padding:1.5rem}:host[data-size=s] .t-heading{font:var(--tui-font-heading-5)}:host[data-size=m]{inline-size:42.5rem}:host[data-size=l]{inline-size:55rem}:host[data-size=fullscreen],:host[data-size=page]{min-inline-size:100vw;min-block-size:100%;border-radius:0;border:none;background:var(--tui-background-elevation-1);box-shadow:0 4rem var(--tui-background-elevation-1)}:host[data-size=fullscreen] .t-content,:host[data-size=page] .t-content{padding:3rem calc(50vw - 22.5rem)}:host[data-size=fullscreen] .t-heading,:host[data-size=page] .t-heading{font:var(--tui-font-heading-3)}:host._centered{text-align:center}:host :host-context(tui-root._mobile)[data-size]{min-inline-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0;border:none;margin:auto 0 0;background:var(--tui-background-elevation-1);padding-block-end:env(safe-area-inset-bottom)}:host :host-context(tui-root._mobile)[data-size] .t-content{padding:1rem}:host :host-context(tui-root._mobile)[data-size] .t-heading{font:var(--tui-font-heading-5)}:host :host-context(tui-root._mobile)[data-size=fullscreen],:host :host-context(tui-root._mobile)[data-size=page]{padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}:host :host-context(tui-root._mobile)[data-size=fullscreen] .t-close,:host :host-context(tui-root._mobile)[data-size=page] .t-close{top:max(1rem,env(safe-area-inset-top))}:host[data-size=page] .t-content,:host-context(tui-root._mobile) :host[data-size=page] .t-content{padding:0}.t-heading{margin:0 0 .5rem;overflow-wrap:break-word;font:var(--tui-font-heading-4)}.t-heading_closable{padding-inline-end:2rem}.t-heading:empty{display:none}.t-header{display:flex;border-top-left-radius:inherit;border-top-right-radius:inherit;overflow:hidden}:host[data-size=fullscreen] :host-context(tui-root._mobile) .t-header{flex:1}.t-content{border-radius:inherit;padding:1.75rem;background:var(--tui-background-elevation-1)}.t-content:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.t-content>section{border-radius:inherit}.t-filler{flex-grow:1}.t-close{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:1rem;right:1rem}@supports (inset-inline-end: 0){.t-close{right:unset;inset-inline-end:1rem}}.t-buttons{margin-block-start:1.25rem;text-align:end}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiAutoFocus, selector: "[tuiAutoFocus]", inputs: ["tuiAutoFocus"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
89
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TuiDialogComponent, isStandalone: true, selector: "tui-dialog", host: { properties: { "attr.data-appearance": "context.appearance", "attr.data-size": "context.size", "class._closable": "context.closable" } }, providers: [
90
+ TuiDialogCloseService,
91
+ tuiHeaderOptionsProvider(() => ({ size: getSize(injectContext()) })),
92
+ ], hostDirectives: [{ directive: i1.TuiAnimated }], ngImport: i0, template: "@if (context.closable) {\n <button\n size=\"s\"\n tuiIconButton\n type=\"button\"\n class=\"t-close\"\n [appearance]=\"context.appearance === 'fullscreen' ? 'action' : 'neutral'\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"close$.next()\"\n (mousedown.prevent.zoneless)=\"(0)\"\n >\n {{ close() }}\n </button>\n}\n\n@if (!primitive && context.label) {\n <header tuiHeader>\n <hgroup tuiTitle>\n <h2\n [id]=\"context.id\"\n [innerHTML]=\"context.label\"\n ></h2>\n </hgroup>\n </header>\n}\n\n<ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n <header tuiHeader>\n <hgroup tuiTitle>\n <h2\n [id]=\"context.id\"\n [innerHTML]=\"context.label\"\n ></h2>\n <p [innerHTML]=\"text\"></p>\n </hgroup>\n </header>\n @if (context.closable || context.dismissible) {\n <footer>\n <button\n size=\"m\"\n tuiAutoFocus\n tuiButton\n type=\"button\"\n (click)=\"context.$implicit.complete()\"\n >\n {{ context.data || 'OK' }}\n </button>\n </footer>\n }\n</ng-container>\n", styles: ["tui-dialog{position:relative;box-sizing:border-box;font:var(--tui-font-text-m);background:var(--tui-background-elevation-1);box-shadow:var(--tui-shadow-popup)}tui-dialog:not([data-appearance~=fullscreen])._closable>header,tui-dialog:not([data-appearance~=fullscreen])._closable>ng-component>header{padding-inline-end:2.5rem}tui-dialog>.t-close{position:absolute;top:1rem;z-index:1;inset-inline-end:1rem}tui-dialog[data-appearance~=taiga]{max-inline-size:calc(100vw - 5rem);margin:2.5rem;padding:1.75rem;border-radius:1.5rem;--tui-from: translateY(2.5rem)}tui-dialog[data-appearance~=taiga].tui-enter,tui-dialog[data-appearance~=taiga].tui-leave{animation-name:tuiFade,tuiSlide}tui-dialog[data-appearance~=taiga][data-size=s]{inline-size:25rem;padding:1.5rem}tui-dialog[data-appearance~=taiga][data-size=s]>header:not(:last-child),tui-dialog[data-appearance~=taiga][data-size=s]>ng-component>header:not(:last-child){margin-block-end:1.25rem}tui-dialog[data-appearance~=taiga][data-size=s]>footer,tui-dialog[data-appearance~=taiga][data-size=s]>ng-component>footer,tui-dialog[data-appearance~=taiga][data-size=s]>tui-confirm>footer{margin-block-start:1.25rem}tui-dialog[data-appearance~=taiga][data-size=m]{inline-size:37.5rem}tui-dialog[data-appearance~=taiga][data-size=l]{inline-size:50rem}tui-dialog[data-appearance~=taiga]>header:not(:last-child),tui-dialog[data-appearance~=taiga]>ng-component>header:not(:last-child){margin-block-end:1.5rem}tui-dialog[data-appearance~=taiga]>footer,tui-dialog[data-appearance~=taiga]>ng-component>footer,tui-dialog[data-appearance~=taiga]>tui-confirm>footer{display:flex;justify-content:flex-end;flex-wrap:wrap-reverse;gap:.75rem;margin-block-start:2rem}tui-dialog[data-appearance~=fullscreen]{display:flex;flex-direction:column;block-size:100%;inline-size:100%;padding:env(safe-area-inset-top) max(calc(50vw - var(--tui-width) / 2),1rem) max(2rem,env(safe-area-inset-bottom));background:var(--tui-background-base);box-shadow:none;--tui-width: 45rem;--tui-from: translateY(2rem)}tui-dialog[data-appearance~=fullscreen].tui-enter,tui-dialog[data-appearance~=fullscreen].tui-leave{animation-name:tuiFade,tuiSlide}tui-dialog[data-appearance~=fullscreen]>.t-close{position:sticky;top:env(safe-area-inset-top);block-size:4rem;inline-size:auto;align-self:flex-end;margin-block-end:2rem;border-radius:0!important;font:var(--tui-font-text-m)!important;border-image:conic-gradient(var(--tui-background-base) 0 0) fill 0 / 0 / env(safe-area-inset-top) 100vw 0}tui-dialog[data-appearance~=fullscreen]>.t-close:before{display:none}tui-dialog[data-appearance~=fullscreen].tui-app-bar .t-close{display:none}tui-dialog[data-appearance~=fullscreen]:not(._closable):not(.tui-app-bar):before{content:\"\";block-size:1.5rem}tui-dialog[data-appearance~=fullscreen]>tui-app-bar,tui-dialog[data-appearance~=fullscreen]>ng-component>tui-app-bar{position:sticky;top:0;z-index:1;order:-1;border-inline-end:calc(50vw - var(--tui-width) / 2) solid transparent;border-inline-start:calc(50vw - var(--tui-width) / 2) solid transparent;margin:0 calc(var(--tui-width) / 2 - 50vw) 2rem}tui-dialog[data-appearance~=fullscreen]>header,tui-dialog[data-appearance~=fullscreen]>[tuiSlides]>*>header,tui-dialog[data-appearance~=fullscreen]>ng-component>header,tui-dialog[data-appearance~=fullscreen]>ng-component>[tuiSlides]>*>header{margin-block-end:2rem}tui-dialog[data-appearance~=fullscreen]>footer,tui-dialog[data-appearance~=fullscreen]>ng-component>footer{display:flex;gap:.5rem .75rem;padding:2rem calc(50vw - var(--tui-width) / 2);margin:0 calc(var(--tui-width) / 2 - 50vw) calc(-2rem - env(safe-area-inset-top))}tui-dialog[data-appearance~=fullscreen]>footer:before,tui-dialog[data-appearance~=fullscreen]>ng-component>footer:before{left:0;right:0}tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>footer,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>ng-component>footer{flex-direction:row;background:color-mix(in hsl,var(--tui-background-base) 80%,transparent);-webkit-backdrop-filter:blur(2rem);backdrop-filter:blur(2rem)}tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>footer:before,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>ng-component>footer:before{display:none}tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>footer>button,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>ng-component>footer>button,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>footer>a,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>ng-component>footer>a{inline-size:auto}tui-root._mobile tui-dialog[data-appearance~=fullscreen]{padding-block-end:max(1rem,env(safe-area-inset-bottom));--tui-from: translateY(4rem)}tui-root._mobile tui-dialog[data-appearance~=fullscreen] .t-close{align-self:flex-start;block-size:3.5rem;margin-block-end:1rem}tui-root._mobile tui-dialog[data-appearance~=fullscreen]>tui-app-bar,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>ng-component>tui-app-bar{margin:calc(-1*env(safe-area-inset-top)) -1rem 1rem;padding-block-start:env(safe-area-inset-top);box-sizing:content-box}tui-root._mobile tui-dialog[data-appearance~=fullscreen]>header,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>[tuiSlides]>*>header,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>ng-component>header,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>ng-component>[tuiSlides]>*>header{margin:-.25rem 0 1.5rem}tui-root._mobile tui-dialog[data-appearance~=fullscreen]>footer,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>ng-component>footer{padding:0 1rem max(1rem,env(safe-area-inset-bottom));margin:1.5rem -1rem calc(-1*max(1rem,env(safe-area-inset-bottom)))}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiAutoFocus, selector: "[tuiAutoFocus]", inputs: ["tuiAutoFocus"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }, { kind: "directive", type: TuiHeader, selector: "[tuiHeader]", inputs: ["tuiHeader"] }, { kind: "directive", type: TuiTitle, selector: "[tuiTitle]", inputs: ["tuiTitle"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
122
93
  }
123
94
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDialogComponent, decorators: [{
124
95
  type: Component,
125
- args: [{ selector: 'tui-dialog', imports: [AsyncPipe, PolymorpheusOutlet, TuiAutoFocus, TuiButton], changeDetection: ChangeDetectionStrategy.Default, providers: [TuiDialogCloseService], hostDirectives: [TuiAnimated], host: {
96
+ args: [{ selector: 'tui-dialog', imports: [PolymorpheusOutlet, TuiAutoFocus, TuiButton, TuiHeader, TuiTitle], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, providers: [
97
+ TuiDialogCloseService,
98
+ tuiHeaderOptionsProvider(() => ({ size: getSize(injectContext()) })),
99
+ ], hostDirectives: [TuiAnimated], host: {
126
100
  '[attr.data-appearance]': 'context.appearance',
127
- '[attr.data-size]': 'size',
128
- '[class._centered]': 'header',
129
- '[style.--tui-from]': 'from()',
130
- }, template: "@if (header) {\n <header class=\"t-header\">\n <ng-container *polymorpheusOutlet=\"header as text; context: context\">\n {{ text }}\n </ng-container>\n </header>\n}\n<div class=\"t-content\">\n <h2\n class=\"t-heading\"\n [class.t-heading_closable]=\"context.closeable && !header\"\n [id]=\"context.id\"\n [textContent]=\"context.label\"\n ></h2>\n <section>\n <ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n <div [innerHTML]=\"text\"></div>\n @if (context.closeable || context.dismissible) {\n <div class=\"t-buttons\">\n <button\n size=\"m\"\n tuiAutoFocus\n tuiButton\n type=\"button\"\n (click)=\"context.$implicit.complete()\"\n >\n {{ context.data?.button || 'OK' }}\n </button>\n </div>\n }\n </ng-container>\n </section>\n</div>\n<div class=\"t-filler\"></div>\n\n<!-- Close button is insensitive to `context.closeable === Observable<false>` by design -->\n@if (context.closeable) {\n <button\n automation-id=\"tui-dialog__close\"\n tuiIconButton\n type=\"button\"\n class=\"t-close\"\n [appearance]=\"isMobile() ? 'icon' : 'neutral'\"\n [iconStart]=\"icons.close\"\n [size]=\"isMobile() ? 'xs' : 's'\"\n [style.border-radius.%]=\"100\"\n (click)=\"close$.next()\"\n (mousedown.prevent.zoneless)=\"(0)\"\n >\n {{ closeWord$ | async }}\n </button>\n}\n", styles: [":host{position:relative;display:flex;font:var(--tui-font-text-m);flex-direction:column;box-sizing:border-box;margin:auto;border-radius:1.5rem;border:2.5rem solid transparent}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:\"\";border-radius:inherit;pointer-events:none;box-shadow:var(--tui-shadow-popup)}:host[data-size=auto]{inline-size:auto}:host[data-size=s]{inline-size:30rem}:host[data-size=s] .t-content{padding:1.5rem}:host[data-size=s] .t-heading{font:var(--tui-font-heading-5)}:host[data-size=m]{inline-size:42.5rem}:host[data-size=l]{inline-size:55rem}:host[data-size=fullscreen],:host[data-size=page]{min-inline-size:100vw;min-block-size:100%;border-radius:0;border:none;background:var(--tui-background-elevation-1);box-shadow:0 4rem var(--tui-background-elevation-1)}:host[data-size=fullscreen] .t-content,:host[data-size=page] .t-content{padding:3rem calc(50vw - 22.5rem)}:host[data-size=fullscreen] .t-heading,:host[data-size=page] .t-heading{font:var(--tui-font-heading-3)}:host._centered{text-align:center}:host :host-context(tui-root._mobile)[data-size]{min-inline-size:100%;inline-size:100%;max-inline-size:100%;border-radius:0;border:none;margin:auto 0 0;background:var(--tui-background-elevation-1);padding-block-end:env(safe-area-inset-bottom)}:host :host-context(tui-root._mobile)[data-size] .t-content{padding:1rem}:host :host-context(tui-root._mobile)[data-size] .t-heading{font:var(--tui-font-heading-5)}:host :host-context(tui-root._mobile)[data-size=fullscreen],:host :host-context(tui-root._mobile)[data-size=page]{padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}:host :host-context(tui-root._mobile)[data-size=fullscreen] .t-close,:host :host-context(tui-root._mobile)[data-size=page] .t-close{top:max(1rem,env(safe-area-inset-top))}:host[data-size=page] .t-content,:host-context(tui-root._mobile) :host[data-size=page] .t-content{padding:0}.t-heading{margin:0 0 .5rem;overflow-wrap:break-word;font:var(--tui-font-heading-4)}.t-heading_closable{padding-inline-end:2rem}.t-heading:empty{display:none}.t-header{display:flex;border-top-left-radius:inherit;border-top-right-radius:inherit;overflow:hidden}:host[data-size=fullscreen] :host-context(tui-root._mobile) .t-header{flex:1}.t-content{border-radius:inherit;padding:1.75rem;background:var(--tui-background-elevation-1)}.t-content:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.t-content>section{border-radius:inherit}.t-filler{flex-grow:1}.t-close{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:1rem;right:1rem}@supports (inset-inline-end: 0){.t-close{right:unset;inset-inline-end:1rem}}.t-buttons{margin-block-start:1.25rem;text-align:end}\n"] }]
131
- }], ctorParameters: () => [] });
101
+ '[attr.data-size]': 'context.size',
102
+ '[class._closable]': 'context.closable',
103
+ }, template: "@if (context.closable) {\n <button\n size=\"s\"\n tuiIconButton\n type=\"button\"\n class=\"t-close\"\n [appearance]=\"context.appearance === 'fullscreen' ? 'action' : 'neutral'\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"close$.next()\"\n (mousedown.prevent.zoneless)=\"(0)\"\n >\n {{ close() }}\n </button>\n}\n\n@if (!primitive && context.label) {\n <header tuiHeader>\n <hgroup tuiTitle>\n <h2\n [id]=\"context.id\"\n [innerHTML]=\"context.label\"\n ></h2>\n </hgroup>\n </header>\n}\n\n<ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n <header tuiHeader>\n <hgroup tuiTitle>\n <h2\n [id]=\"context.id\"\n [innerHTML]=\"context.label\"\n ></h2>\n <p [innerHTML]=\"text\"></p>\n </hgroup>\n </header>\n @if (context.closable || context.dismissible) {\n <footer>\n <button\n size=\"m\"\n tuiAutoFocus\n tuiButton\n type=\"button\"\n (click)=\"context.$implicit.complete()\"\n >\n {{ context.data || 'OK' }}\n </button>\n </footer>\n }\n</ng-container>\n", styles: ["tui-dialog{position:relative;box-sizing:border-box;font:var(--tui-font-text-m);background:var(--tui-background-elevation-1);box-shadow:var(--tui-shadow-popup)}tui-dialog:not([data-appearance~=fullscreen])._closable>header,tui-dialog:not([data-appearance~=fullscreen])._closable>ng-component>header{padding-inline-end:2.5rem}tui-dialog>.t-close{position:absolute;top:1rem;z-index:1;inset-inline-end:1rem}tui-dialog[data-appearance~=taiga]{max-inline-size:calc(100vw - 5rem);margin:2.5rem;padding:1.75rem;border-radius:1.5rem;--tui-from: translateY(2.5rem)}tui-dialog[data-appearance~=taiga].tui-enter,tui-dialog[data-appearance~=taiga].tui-leave{animation-name:tuiFade,tuiSlide}tui-dialog[data-appearance~=taiga][data-size=s]{inline-size:25rem;padding:1.5rem}tui-dialog[data-appearance~=taiga][data-size=s]>header:not(:last-child),tui-dialog[data-appearance~=taiga][data-size=s]>ng-component>header:not(:last-child){margin-block-end:1.25rem}tui-dialog[data-appearance~=taiga][data-size=s]>footer,tui-dialog[data-appearance~=taiga][data-size=s]>ng-component>footer,tui-dialog[data-appearance~=taiga][data-size=s]>tui-confirm>footer{margin-block-start:1.25rem}tui-dialog[data-appearance~=taiga][data-size=m]{inline-size:37.5rem}tui-dialog[data-appearance~=taiga][data-size=l]{inline-size:50rem}tui-dialog[data-appearance~=taiga]>header:not(:last-child),tui-dialog[data-appearance~=taiga]>ng-component>header:not(:last-child){margin-block-end:1.5rem}tui-dialog[data-appearance~=taiga]>footer,tui-dialog[data-appearance~=taiga]>ng-component>footer,tui-dialog[data-appearance~=taiga]>tui-confirm>footer{display:flex;justify-content:flex-end;flex-wrap:wrap-reverse;gap:.75rem;margin-block-start:2rem}tui-dialog[data-appearance~=fullscreen]{display:flex;flex-direction:column;block-size:100%;inline-size:100%;padding:env(safe-area-inset-top) max(calc(50vw - var(--tui-width) / 2),1rem) max(2rem,env(safe-area-inset-bottom));background:var(--tui-background-base);box-shadow:none;--tui-width: 45rem;--tui-from: translateY(2rem)}tui-dialog[data-appearance~=fullscreen].tui-enter,tui-dialog[data-appearance~=fullscreen].tui-leave{animation-name:tuiFade,tuiSlide}tui-dialog[data-appearance~=fullscreen]>.t-close{position:sticky;top:env(safe-area-inset-top);block-size:4rem;inline-size:auto;align-self:flex-end;margin-block-end:2rem;border-radius:0!important;font:var(--tui-font-text-m)!important;border-image:conic-gradient(var(--tui-background-base) 0 0) fill 0 / 0 / env(safe-area-inset-top) 100vw 0}tui-dialog[data-appearance~=fullscreen]>.t-close:before{display:none}tui-dialog[data-appearance~=fullscreen].tui-app-bar .t-close{display:none}tui-dialog[data-appearance~=fullscreen]:not(._closable):not(.tui-app-bar):before{content:\"\";block-size:1.5rem}tui-dialog[data-appearance~=fullscreen]>tui-app-bar,tui-dialog[data-appearance~=fullscreen]>ng-component>tui-app-bar{position:sticky;top:0;z-index:1;order:-1;border-inline-end:calc(50vw - var(--tui-width) / 2) solid transparent;border-inline-start:calc(50vw - var(--tui-width) / 2) solid transparent;margin:0 calc(var(--tui-width) / 2 - 50vw) 2rem}tui-dialog[data-appearance~=fullscreen]>header,tui-dialog[data-appearance~=fullscreen]>[tuiSlides]>*>header,tui-dialog[data-appearance~=fullscreen]>ng-component>header,tui-dialog[data-appearance~=fullscreen]>ng-component>[tuiSlides]>*>header{margin-block-end:2rem}tui-dialog[data-appearance~=fullscreen]>footer,tui-dialog[data-appearance~=fullscreen]>ng-component>footer{display:flex;gap:.5rem .75rem;padding:2rem calc(50vw - var(--tui-width) / 2);margin:0 calc(var(--tui-width) / 2 - 50vw) calc(-2rem - env(safe-area-inset-top))}tui-dialog[data-appearance~=fullscreen]>footer:before,tui-dialog[data-appearance~=fullscreen]>ng-component>footer:before{left:0;right:0}tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>footer,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>ng-component>footer{flex-direction:row;background:color-mix(in hsl,var(--tui-background-base) 80%,transparent);-webkit-backdrop-filter:blur(2rem);backdrop-filter:blur(2rem)}tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>footer:before,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>ng-component>footer:before{display:none}tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>footer>button,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>ng-component>footer>button,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>footer>a,tui-root:not(._mobile) tui-dialog[data-appearance~=fullscreen]>ng-component>footer>a{inline-size:auto}tui-root._mobile tui-dialog[data-appearance~=fullscreen]{padding-block-end:max(1rem,env(safe-area-inset-bottom));--tui-from: translateY(4rem)}tui-root._mobile tui-dialog[data-appearance~=fullscreen] .t-close{align-self:flex-start;block-size:3.5rem;margin-block-end:1rem}tui-root._mobile tui-dialog[data-appearance~=fullscreen]>tui-app-bar,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>ng-component>tui-app-bar{margin:calc(-1*env(safe-area-inset-top)) -1rem 1rem;padding-block-start:env(safe-area-inset-top);box-sizing:content-box}tui-root._mobile tui-dialog[data-appearance~=fullscreen]>header,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>[tuiSlides]>*>header,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>ng-component>header,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>ng-component>[tuiSlides]>*>header{margin:-.25rem 0 1.5rem}tui-root._mobile tui-dialog[data-appearance~=fullscreen]>footer,tui-root._mobile tui-dialog[data-appearance~=fullscreen]>ng-component>footer{padding:0 1rem max(1rem,env(safe-area-inset-bottom));margin:1.5rem -1rem calc(-1*max(1rem,env(safe-area-inset-bottom)))}\n"] }]
104
+ }] });
105
+ function getSize({ appearance, size }) {
106
+ if (appearance.includes('fullscreen')) {
107
+ return 'h3';
108
+ }
109
+ return size === 's' ? 'h5' : 'h4';
110
+ }
111
+
112
+ const [TUI_DIALOG_OPTIONS, tuiDialogOptionsProvider] = tuiCreateOptions({
113
+ appearance: 'taiga',
114
+ size: 'm',
115
+ required: false,
116
+ closable: true,
117
+ dismissible: true,
118
+ label: '',
119
+ data: undefined,
120
+ });
132
121
 
133
122
  class TuiDialogService extends TuiPopoverService {
134
123
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDialogService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -169,27 +158,58 @@ function tuiDialog(component, { injector, ...options } = {}) {
169
158
  });
170
159
  }
171
160
 
161
+ class TuiActiveZoneAdapter {
162
+ constructor() {
163
+ this.current = inject(TuiActiveZone);
164
+ this.parent = findActive(inject(TuiActiveZone, { skipSelf: true }), tuiGetFocused(inject(DOCUMENT)));
165
+ }
166
+ ngOnInit() {
167
+ this.current.tuiActiveZoneParentSetter = this.parent;
168
+ }
169
+ ngOnDestroy() {
170
+ this.current.tuiActiveZoneParentSetter = null;
171
+ }
172
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiActiveZoneAdapter, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
173
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiActiveZoneAdapter, isStandalone: true, selector: "[tuiActiveZoneAdapter]", hostDirectives: [{ directive: i1$1.TuiActiveZone }], ngImport: i0 }); }
174
+ }
175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiActiveZoneAdapter, decorators: [{
176
+ type: Directive,
177
+ args: [{
178
+ standalone: true,
179
+ selector: '[tuiActiveZoneAdapter]',
180
+ hostDirectives: [TuiActiveZone],
181
+ }]
182
+ }] });
183
+ function findActive(zone, el) {
184
+ if (!el || !zone.contains(el)) {
185
+ return null;
186
+ }
187
+ const active = zone.children.find((child) => !child['el'].matches('[tuiActiveZoneAdapter]') && child.contains(el));
188
+ return active ? findActive(active, el) : zone;
189
+ }
190
+
172
191
  class TuiDialogs {
173
192
  constructor() {
174
193
  this.dialogs = toSignal(inject(TUI_DIALOGS), { initialValue: [] });
175
194
  }
176
195
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDialogs, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
177
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TuiDialogs, isStandalone: true, selector: "tui-dialogs", ngImport: i0, template: "<div\n class=\"t-overlay\"\n [class.t-overlay_visible]=\"dialogs().length\"\n></div>\n<!--TODO: Rename to <article> in v5-->\n@for (item of dialogs(); track item) {\n <section\n aria-modal=\"true\"\n role=\"dialog\"\n tuiAnimatedParent\n tuiFocusTrap\n tuiScrollRef\n class=\"t-dialog\"\n [attr.aria-labelledby]=\"item.id\"\n >\n <ng-container *polymorpheusOutlet=\"item.component; context: item\" />\n <tui-scroll-controls class=\"t-scrollbars\" />\n </section>\n}\n", styles: [":host{position:fixed;top:0;left:0;inline-size:100%;block-size:100%;scrollbar-width:none;-ms-overflow-style:none;pointer-events:none;overflow:hidden;overscroll-behavior:none;overflow-wrap:break-word;margin-block-start:var(--t-root-top)}:host::-webkit-scrollbar,:host::-webkit-scrollbar-thumb{display:none}:host:has(section){pointer-events:auto;overflow:auto}:host:has(section:only-of-type ::ng-deep tui-dialog[new][data-appearance~=fullscreen])>.t-overlay,:host:has(section:only-of-type ::ng-deep tui-notification-middle)>.t-overlay{opacity:0}:host:before{content:\"\";display:block;block-size:200%}.t-overlay,.t-dialog{transition-property:filter;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;scrollbar-width:none;-ms-overflow-style:none;position:fixed;top:0;left:0;bottom:0;right:0;display:flex;block-size:100%;align-items:flex-start;outline:none;overflow:auto}.t-overlay::-webkit-scrollbar,.t-dialog::-webkit-scrollbar,.t-overlay::-webkit-scrollbar-thumb,.t-dialog::-webkit-scrollbar-thumb{display:none}.t-dialog{position:sticky;overscroll-behavior:none;filter:brightness(.25)}.t-dialog:has(tui-dialog[new]){display:grid;place-items:center}.t-dialog ::ng-deep>.tui-enter+.t-scrollbars .t-bar_vertical,.t-dialog ::ng-deep>.tui-leave+.t-scrollbars .t-bar_vertical{display:none}.t-overlay{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;background:var(--tui-service-backdrop);-webkit-backdrop-filter:var(--tui-backdrop, none);backdrop-filter:var(--tui-backdrop, none);opacity:0;transition-timing-function:ease-in}.t-overlay_visible{opacity:1;transition-timing-function:ease-out}.t-dialog:last-child{pointer-events:auto;filter:none}:host-context(tui-root:has(tui-dropdown-mobile._sheet)) .t-dialog:last-child{filter:brightness(.5)}.t-scrollbars{position:fixed;top:0;left:0;bottom:0;right:0;margin:0;color:#747474}.t-scrollbars ::ng-deep .t-bar_horizontal,.t-scrollbars ::ng-deep .t-bar_vertical .t-thumb[style*=\"height: 100%\"]{display:none}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiAnimatedParent, selector: "[tuiAnimatedParent]" }, { kind: "directive", type: TuiFocusTrap, selector: "[tuiFocusTrap]" }, { kind: "component", type: TuiScrollControls, selector: "tui-scroll-controls" }, { kind: "directive", type: TuiScrollRef, selector: "[tuiScrollRef]" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
196
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TuiDialogs, isStandalone: true, selector: "tui-dialogs", ngImport: i0, template: "<div\n class=\"t-overlay\"\n [class.t-overlay_visible]=\"dialogs().length\"\n></div>\n<!--TODO: Rename to <article> in v5-->\n@for (item of dialogs(); track item) {\n <section\n aria-modal=\"true\"\n role=\"dialog\"\n tuiActiveZoneAdapter\n tuiAnimatedParent\n tuiFocusTrap\n tuiScrollRef\n class=\"t-dialog\"\n [attr.aria-labelledby]=\"item.id\"\n >\n <ng-container *polymorpheusOutlet=\"item.component; context: item\" />\n <tui-scroll-controls class=\"t-scrollbars\" />\n </section>\n}\n", styles: [":host{position:fixed;top:0;left:0;inline-size:100%;block-size:100%;scrollbar-width:none;-ms-overflow-style:none;pointer-events:none;overflow:hidden;overscroll-behavior:none;overflow-wrap:break-word;margin-block-start:var(--t-root-top)}:host::-webkit-scrollbar,:host::-webkit-scrollbar-thumb{display:none}:host:has(section){pointer-events:auto;overflow:auto}:host:has(section:only-of-type ::ng-deep tui-dialog[data-appearance~=fullscreen])>.t-overlay,:host:has(section:only-of-type ::ng-deep tui-notification-middle)>.t-overlay{opacity:0}:host:before{content:\"\";display:block;block-size:200%}.t-overlay,.t-dialog{transition-property:filter;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;scrollbar-width:none;-ms-overflow-style:none;position:fixed;top:0;left:0;bottom:0;right:0;display:flex;block-size:100%;align-items:flex-start;outline:none;overflow:auto}.t-overlay::-webkit-scrollbar,.t-dialog::-webkit-scrollbar,.t-overlay::-webkit-scrollbar-thumb,.t-dialog::-webkit-scrollbar-thumb{display:none}.t-dialog{position:sticky;display:grid;place-items:center;overscroll-behavior:none;filter:brightness(.25)}.t-dialog ::ng-deep>.tui-enter+.t-scrollbars .t-bar_vertical,.t-dialog ::ng-deep>.tui-leave+.t-scrollbars .t-bar_vertical{display:none}.t-overlay{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;background:var(--tui-service-backdrop);-webkit-backdrop-filter:var(--tui-backdrop, none);backdrop-filter:var(--tui-backdrop, none);opacity:0;transition-timing-function:ease-in}.t-overlay_visible{opacity:1;transition-timing-function:ease-out}.t-dialog:last-child{pointer-events:auto;filter:none}.t-scrollbars{position:fixed;top:0;left:0;bottom:0;right:0;margin:0;color:#747474}.t-scrollbars ::ng-deep .t-bar_horizontal,.t-scrollbars ::ng-deep .t-bar_vertical .t-thumb[style*=\"height: 100%\"]{display:none}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiActiveZoneAdapter, selector: "[tuiActiveZoneAdapter]" }, { kind: "directive", type: TuiAnimatedParent, selector: "[tuiAnimatedParent]" }, { kind: "directive", type: TuiFocusTrap, selector: "[tuiFocusTrap]" }, { kind: "component", type: TuiScrollControls, selector: "tui-scroll-controls" }, { kind: "directive", type: TuiScrollRef, selector: "[tuiScrollRef]" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
178
197
  }
179
198
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiDialogs, decorators: [{
180
199
  type: Component,
181
200
  args: [{ selector: 'tui-dialogs', imports: [
182
201
  PolymorpheusOutlet,
202
+ TuiActiveZoneAdapter,
183
203
  TuiAnimatedParent,
184
204
  TuiFocusTrap,
185
205
  TuiScrollControls,
186
206
  TuiScrollRef,
187
- ], changeDetection: ChangeDetectionStrategy.Default, template: "<div\n class=\"t-overlay\"\n [class.t-overlay_visible]=\"dialogs().length\"\n></div>\n<!--TODO: Rename to <article> in v5-->\n@for (item of dialogs(); track item) {\n <section\n aria-modal=\"true\"\n role=\"dialog\"\n tuiAnimatedParent\n tuiFocusTrap\n tuiScrollRef\n class=\"t-dialog\"\n [attr.aria-labelledby]=\"item.id\"\n >\n <ng-container *polymorpheusOutlet=\"item.component; context: item\" />\n <tui-scroll-controls class=\"t-scrollbars\" />\n </section>\n}\n", styles: [":host{position:fixed;top:0;left:0;inline-size:100%;block-size:100%;scrollbar-width:none;-ms-overflow-style:none;pointer-events:none;overflow:hidden;overscroll-behavior:none;overflow-wrap:break-word;margin-block-start:var(--t-root-top)}:host::-webkit-scrollbar,:host::-webkit-scrollbar-thumb{display:none}:host:has(section){pointer-events:auto;overflow:auto}:host:has(section:only-of-type ::ng-deep tui-dialog[new][data-appearance~=fullscreen])>.t-overlay,:host:has(section:only-of-type ::ng-deep tui-notification-middle)>.t-overlay{opacity:0}:host:before{content:\"\";display:block;block-size:200%}.t-overlay,.t-dialog{transition-property:filter;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;scrollbar-width:none;-ms-overflow-style:none;position:fixed;top:0;left:0;bottom:0;right:0;display:flex;block-size:100%;align-items:flex-start;outline:none;overflow:auto}.t-overlay::-webkit-scrollbar,.t-dialog::-webkit-scrollbar,.t-overlay::-webkit-scrollbar-thumb,.t-dialog::-webkit-scrollbar-thumb{display:none}.t-dialog{position:sticky;overscroll-behavior:none;filter:brightness(.25)}.t-dialog:has(tui-dialog[new]){display:grid;place-items:center}.t-dialog ::ng-deep>.tui-enter+.t-scrollbars .t-bar_vertical,.t-dialog ::ng-deep>.tui-leave+.t-scrollbars .t-bar_vertical{display:none}.t-overlay{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;background:var(--tui-service-backdrop);-webkit-backdrop-filter:var(--tui-backdrop, none);backdrop-filter:var(--tui-backdrop, none);opacity:0;transition-timing-function:ease-in}.t-overlay_visible{opacity:1;transition-timing-function:ease-out}.t-dialog:last-child{pointer-events:auto;filter:none}:host-context(tui-root:has(tui-dropdown-mobile._sheet)) .t-dialog:last-child{filter:brightness(.5)}.t-scrollbars{position:fixed;top:0;left:0;bottom:0;right:0;margin:0;color:#747474}.t-scrollbars ::ng-deep .t-bar_horizontal,.t-scrollbars ::ng-deep .t-bar_vertical .t-thumb[style*=\"height: 100%\"]{display:none}\n"] }]
207
+ ], changeDetection: ChangeDetectionStrategy.Default, template: "<div\n class=\"t-overlay\"\n [class.t-overlay_visible]=\"dialogs().length\"\n></div>\n<!--TODO: Rename to <article> in v5-->\n@for (item of dialogs(); track item) {\n <section\n aria-modal=\"true\"\n role=\"dialog\"\n tuiActiveZoneAdapter\n tuiAnimatedParent\n tuiFocusTrap\n tuiScrollRef\n class=\"t-dialog\"\n [attr.aria-labelledby]=\"item.id\"\n >\n <ng-container *polymorpheusOutlet=\"item.component; context: item\" />\n <tui-scroll-controls class=\"t-scrollbars\" />\n </section>\n}\n", styles: [":host{position:fixed;top:0;left:0;inline-size:100%;block-size:100%;scrollbar-width:none;-ms-overflow-style:none;pointer-events:none;overflow:hidden;overscroll-behavior:none;overflow-wrap:break-word;margin-block-start:var(--t-root-top)}:host::-webkit-scrollbar,:host::-webkit-scrollbar-thumb{display:none}:host:has(section){pointer-events:auto;overflow:auto}:host:has(section:only-of-type ::ng-deep tui-dialog[data-appearance~=fullscreen])>.t-overlay,:host:has(section:only-of-type ::ng-deep tui-notification-middle)>.t-overlay{opacity:0}:host:before{content:\"\";display:block;block-size:200%}.t-overlay,.t-dialog{transition-property:filter;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;scrollbar-width:none;-ms-overflow-style:none;position:fixed;top:0;left:0;bottom:0;right:0;display:flex;block-size:100%;align-items:flex-start;outline:none;overflow:auto}.t-overlay::-webkit-scrollbar,.t-dialog::-webkit-scrollbar,.t-overlay::-webkit-scrollbar-thumb,.t-dialog::-webkit-scrollbar-thumb{display:none}.t-dialog{position:sticky;display:grid;place-items:center;overscroll-behavior:none;filter:brightness(.25)}.t-dialog ::ng-deep>.tui-enter+.t-scrollbars .t-bar_vertical,.t-dialog ::ng-deep>.tui-leave+.t-scrollbars .t-bar_vertical{display:none}.t-overlay{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;background:var(--tui-service-backdrop);-webkit-backdrop-filter:var(--tui-backdrop, none);backdrop-filter:var(--tui-backdrop, none);opacity:0;transition-timing-function:ease-in}.t-overlay_visible{opacity:1;transition-timing-function:ease-out}.t-dialog:last-child{pointer-events:auto;filter:none}.t-scrollbars{position:fixed;top:0;left:0;bottom:0;right:0;margin:0;color:#747474}.t-scrollbars ::ng-deep .t-bar_horizontal,.t-scrollbars ::ng-deep .t-bar_vertical .t-thumb[style*=\"height: 100%\"]{display:none}\n"] }]
188
208
  }] });
189
209
 
190
210
  /**
191
211
  * Generated bundle index. Do not edit.
192
212
  */
193
213
 
194
- export { TUI_DIALOGS, TUI_DIALOGS_CLOSE, TUI_DIALOG_DEFAULT_OPTIONS, TUI_DIALOG_OPTIONS, TuiDialog, TuiDialogCloseService, TuiDialogComponent, TuiDialogService, TuiDialogs, tuiDialog, tuiDialogOptionsProvider };
214
+ export { TUI_DIALOGS, TUI_DIALOGS_CLOSE, TUI_DIALOG_OPTIONS, TuiDialog, TuiDialogCloseService, TuiDialogComponent, TuiDialogService, TuiDialogs, tuiDialog, tuiDialogOptionsProvider };
195
215
  //# sourceMappingURL=taiga-ui-core-components-dialog.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-core-components-dialog.mjs","sources":["../../../projects/core/components/dialog/dialog.tokens.ts","../../../projects/core/components/dialog/dialog-close.service.ts","../../../projects/core/components/dialog/dialog.component.ts","../../../projects/core/components/dialog/dialog.template.html","../../../projects/core/components/dialog/dialog.service.ts","../../../projects/core/components/dialog/dialog.directive.ts","../../../projects/core/components/dialog/dialog.factory.ts","../../../projects/core/components/dialog/dialogs.component.ts","../../../projects/core/components/dialog/dialogs.template.html","../../../projects/core/components/dialog/taiga-ui-core-components-dialog.ts"],"sourcesContent":["import {InjectionToken, type Provider} from '@angular/core';\nimport {type TuiPopover} from '@taiga-ui/cdk/services';\nimport {tuiProvideOptions} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {BehaviorSubject, EMPTY, type Observable} from 'rxjs';\n\nimport {type TuiDialogOptions} from './dialog.interfaces';\n\nexport const TUI_DIALOGS = new InjectionToken(ngDevMode ? 'TUI_DIALOGS' : '', {\n factory: () => new BehaviorSubject<ReadonlyArray<TuiPopover<any, any>>>([]),\n});\n\nexport const TUI_DIALOG_DEFAULT_OPTIONS: TuiDialogOptions<void> = {\n appearance: '',\n size: 'm',\n required: false,\n closeable: true,\n dismissible: true,\n label: '',\n header: '',\n data: undefined,\n};\n\n/**\n * A stream to close dialogs\n * TODO: use router.events in v5\n */\nexport const TUI_DIALOGS_CLOSE = new InjectionToken<Observable<unknown>>(\n ngDevMode ? 'TUI_DIALOGS_CLOSE' : '',\n {\n factory: () => EMPTY,\n },\n);\n\n/**\n * Default parameters for dialog component\n */\nexport const TUI_DIALOG_OPTIONS = new InjectionToken(\n ngDevMode ? 'TUI_DIALOG_OPTIONS' : '',\n {\n factory: () => TUI_DIALOG_DEFAULT_OPTIONS,\n },\n);\n\nexport function tuiDialogOptionsProvider(\n options: Partial<TuiDialogOptions<unknown>>,\n): Provider {\n return tuiProvideOptions(TUI_DIALOG_OPTIONS, options, TUI_DIALOG_DEFAULT_OPTIONS);\n}\n","import {DOCUMENT} from '@angular/common';\nimport {inject, Injectable} from '@angular/core';\nimport {WA_WINDOW} from '@ng-web-apis/common';\nimport {tuiCloseWatcher, tuiTypedFromEvent, tuiZonefull} from '@taiga-ui/cdk/observables';\nimport {\n tuiContainsOrAfter,\n tuiGetActualTarget,\n tuiInjectElement,\n tuiIsElement,\n} from '@taiga-ui/cdk/utils/dom';\nimport {tuiGetViewportWidth} from '@taiga-ui/core/utils';\nimport {filter, map, merge, Observable, switchMap, take} from 'rxjs';\n\nconst SCROLLBAR_PLACEHOLDER = 17;\n\n@Injectable()\nexport class TuiDialogCloseService extends Observable<unknown> {\n private readonly win = inject(WA_WINDOW);\n private readonly doc = inject(DOCUMENT);\n private readonly el = tuiInjectElement();\n\n private readonly esc$ = tuiTypedFromEvent(this.doc, 'keydown').pipe(\n filter((event) => {\n const target = tuiGetActualTarget(event);\n\n return (\n // @ts-ignore\n typeof CloseWatcher === 'undefined' &&\n event.key?.toLowerCase() === 'escape' &&\n !event.defaultPrevented &&\n (this.el.contains(target) || this.isOutside(target))\n );\n }),\n );\n\n private readonly mousedown$ = tuiTypedFromEvent(this.doc, 'mousedown').pipe(\n filter(\n (event) =>\n tuiGetViewportWidth(this.win) - event.clientX > SCROLLBAR_PLACEHOLDER &&\n this.isOutside(tuiGetActualTarget(event)),\n ),\n switchMap(() =>\n tuiTypedFromEvent(this.doc, 'mouseup').pipe(\n take(1),\n map(tuiGetActualTarget),\n filter((target) => this.isOutside(target)),\n ),\n ),\n );\n\n constructor() {\n super((subscriber) =>\n merge(\n this.esc$,\n this.mousedown$,\n tuiCloseWatcher().pipe(tuiZonefull()),\n ).subscribe(subscriber),\n );\n }\n\n private isOutside(target: EventTarget): boolean {\n return (\n tuiIsElement(target) &&\n (!tuiContainsOrAfter(this.el, target) ||\n // TODO: Drop 'new' attribute in v5\n (target === this.el && !this.el.hasAttribute('new')))\n );\n }\n}\n","import {AsyncPipe} from '@angular/common';\nimport {ChangeDetectionStrategy, Component, computed, inject} from '@angular/core';\nimport {takeUntilDestroyed, toSignal} from '@angular/core/rxjs-interop';\nimport {TUI_TRUE_HANDLER} from '@taiga-ui/cdk/constants';\nimport {TuiAnimated} from '@taiga-ui/cdk/directives/animated';\nimport {TuiAutoFocus} from '@taiga-ui/cdk/directives/auto-focus';\nimport {type TuiPopover} from '@taiga-ui/cdk/services';\nimport {TuiButton} from '@taiga-ui/core/components/button';\nimport {TuiBreakpointService} from '@taiga-ui/core/services';\nimport {TUI_CLOSE_WORD, TUI_COMMON_ICONS} from '@taiga-ui/core/tokens';\nimport {\n injectContext,\n type PolymorpheusContent,\n PolymorpheusOutlet,\n} from '@taiga-ui/polymorpheus';\nimport {\n exhaustMap,\n filter,\n isObservable,\n map,\n merge,\n type Observable,\n of,\n Subject,\n switchMap,\n take,\n} from 'rxjs';\n\nimport {type TuiDialogOptions, type TuiDialogSize} from './dialog.interfaces';\nimport {TUI_DIALOGS_CLOSE} from './dialog.tokens';\nimport {TuiDialogCloseService} from './dialog-close.service';\n\nconst REQUIRED_ERROR = new Error('Required dialog was dismissed');\n\nfunction toObservable<T>(valueOrStream: Observable<T> | T): Observable<T> {\n return isObservable(valueOrStream) ? valueOrStream : of(valueOrStream);\n}\n\n@Component({\n selector: 'tui-dialog',\n imports: [AsyncPipe, PolymorpheusOutlet, TuiAutoFocus, TuiButton],\n templateUrl: './dialog.template.html',\n styleUrls: ['./dialog.style.less'],\n // So we don't force OnPush on dialog content\n // eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection\n changeDetection: ChangeDetectionStrategy.Default,\n providers: [TuiDialogCloseService],\n hostDirectives: [TuiAnimated],\n host: {\n '[attr.data-appearance]': 'context.appearance',\n '[attr.data-size]': 'size',\n '[class._centered]': 'header',\n '[style.--tui-from]': 'from()',\n },\n})\nexport class TuiDialogComponent<O, I> {\n protected readonly close$ = new Subject<void>();\n protected readonly context = injectContext<TuiPopover<TuiDialogOptions<I>, O>>();\n protected readonly closeWord$ = inject(TUI_CLOSE_WORD);\n protected readonly icons = inject(TUI_COMMON_ICONS);\n protected readonly from = computed(() =>\n this.size === 'fullscreen' || this.size === 'page' || this.isMobile()\n ? 'translateY(100vh)'\n : 'translateY(2.5rem)',\n );\n\n protected readonly isMobile = toSignal(\n inject(TuiBreakpointService).pipe(map((breakpoint) => breakpoint === 'mobile')),\n );\n\n constructor() {\n merge(\n this.close$.pipe(switchMap(() => toObservable(this.context.closeable))),\n inject(TuiDialogCloseService).pipe(\n exhaustMap(() => toObservable(this.context.dismissible).pipe(take(1))),\n ),\n inject(TUI_DIALOGS_CLOSE).pipe(map(TUI_TRUE_HANDLER)),\n )\n .pipe(filter(Boolean), takeUntilDestroyed())\n .subscribe(() => {\n this.close();\n });\n }\n\n protected get size(): TuiDialogSize {\n return this.context.size;\n }\n\n protected get header(): PolymorpheusContent<TuiPopover<TuiDialogOptions<I>, O>> {\n return this.context.header;\n }\n\n private close(): void {\n if (this.context.required) {\n this.context.$implicit.error(REQUIRED_ERROR);\n } else {\n this.context.$implicit.complete();\n }\n }\n}\n","@if (header) {\n <header class=\"t-header\">\n <ng-container *polymorpheusOutlet=\"header as text; context: context\">\n {{ text }}\n </ng-container>\n </header>\n}\n<div class=\"t-content\">\n <h2\n class=\"t-heading\"\n [class.t-heading_closable]=\"context.closeable && !header\"\n [id]=\"context.id\"\n [textContent]=\"context.label\"\n ></h2>\n <section>\n <ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n <div [innerHTML]=\"text\"></div>\n @if (context.closeable || context.dismissible) {\n <div class=\"t-buttons\">\n <button\n size=\"m\"\n tuiAutoFocus\n tuiButton\n type=\"button\"\n (click)=\"context.$implicit.complete()\"\n >\n {{ context.data?.button || 'OK' }}\n </button>\n </div>\n }\n </ng-container>\n </section>\n</div>\n<div class=\"t-filler\"></div>\n\n<!-- Close button is insensitive to `context.closeable === Observable<false>` by design -->\n@if (context.closeable) {\n <button\n automation-id=\"tui-dialog__close\"\n tuiIconButton\n type=\"button\"\n class=\"t-close\"\n [appearance]=\"isMobile() ? 'icon' : 'neutral'\"\n [iconStart]=\"icons.close\"\n [size]=\"isMobile() ? 'xs' : 's'\"\n [style.border-radius.%]=\"100\"\n (click)=\"close$.next()\"\n (mousedown.prevent.zoneless)=\"(0)\"\n >\n {{ closeWord$ | async }}\n </button>\n}\n","import {inject, Injectable} from '@angular/core';\nimport {TuiPopoverService} from '@taiga-ui/cdk/services';\n\nimport {TuiDialogComponent} from './dialog.component';\nimport {type TuiDialogOptions} from './dialog.interfaces';\nimport {TUI_DIALOG_OPTIONS, TUI_DIALOGS} from './dialog.tokens';\n\n@Injectable({\n providedIn: 'root',\n useFactory: () =>\n new TuiDialogService(TUI_DIALOGS, TuiDialogComponent, inject(TUI_DIALOG_OPTIONS)),\n})\nexport class TuiDialogService extends TuiPopoverService<TuiDialogOptions<any>> {}\n","import {Directive} from '@angular/core';\nimport {TuiPopoverDirective} from '@taiga-ui/cdk/directives/popover';\nimport {tuiAsPopover} from '@taiga-ui/cdk/services';\n\nimport {type TuiDialogOptions} from './dialog.interfaces';\nimport {TuiDialogService} from './dialog.service';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[tuiDialog]',\n inputs: ['options: tuiDialogOptions', 'open: tuiDialog'],\n outputs: ['openChange: tuiDialogChange'],\n providers: [tuiAsPopover(TuiDialogService)],\n})\nexport class TuiDialog<T> extends TuiPopoverDirective<TuiDialogOptions<T>> {}\n","import {assertInInjectionContext, inject, INJECTOR, type Injector} from '@angular/core';\nimport {PolymorpheusComponent} from '@taiga-ui/polymorpheus';\nimport {type Observable} from 'rxjs';\n\nimport {type TuiDialogContext, type TuiDialogOptions} from './dialog.interfaces';\nimport {TuiDialogService} from './dialog.service';\n\ntype SingleUnionOrNever<T, U = T> = [T] extends [never]\n ? never\n : T extends U\n ? [U] extends [T]\n ? T\n : never\n : never;\n\ntype ReplaceAny<T> = 0 extends T & 1 ? void : T;\n\ntype ContextKeys<T> = {\n [K in keyof T]: ReplaceAny<T[K]> extends TuiDialogContext<any, any> | null\n ? K\n : never;\n}[keyof T];\n\ntype AssertNotMultipleContexts<T, K extends keyof T> = [K] extends [never]\n ? new (...args: any[]) => T\n : [SingleUnionOrNever<K>] extends [never]\n ? 'Component has multiple context. Cannot determine the type...'\n : new (...args: any[]) => T;\n\ntype ExtractDialogData<T, K extends keyof T = ContextKeys<T>> = [K] extends [never]\n ? void\n : [SingleUnionOrNever<K>] extends [never]\n ? never\n : T[K] extends TuiDialogContext<any, infer D> | null\n ? D\n : void;\n\ntype ExtractDialogResult<T, K extends keyof T = ContextKeys<T>> = [K] extends [never]\n ? void\n : [SingleUnionOrNever<K>] extends [never]\n ? never\n : T[K] extends TuiDialogContext<infer R, any> | null\n ? R\n : void;\n\ntype Options<T> = Omit<TuiDialogOptions<T>, 'data'> & {injector: Injector};\n\nexport function tuiDialog<\n T,\n K extends ContextKeys<T>,\n D extends ExtractDialogData<T, K>,\n R extends ExtractDialogResult<T, K>,\n>(\n component: AssertNotMultipleContexts<T, K>,\n {injector, ...options}: Partial<Options<D>> = {},\n): (data: D) => Observable<R> {\n if (!injector) {\n assertInInjectionContext(tuiDialog);\n injector = inject(INJECTOR);\n }\n\n const dialogService = injector.get(TuiDialogService);\n\n return (data) =>\n dialogService.open(\n new PolymorpheusComponent(component as new () => T, injector),\n {\n ...options,\n data,\n },\n );\n}\n","import {ChangeDetectionStrategy, Component, inject, type Signal} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {TuiAnimatedParent} from '@taiga-ui/cdk/directives/animated';\nimport {TuiFocusTrap} from '@taiga-ui/cdk/directives/focus-trap';\nimport {type TuiPopover} from '@taiga-ui/cdk/services';\nimport {TuiScrollControls, TuiScrollRef} from '@taiga-ui/core/components/scrollbar';\nimport {PolymorpheusOutlet} from '@taiga-ui/polymorpheus';\n\nimport {TUI_DIALOGS} from './dialog.tokens';\n\n@Component({\n selector: 'tui-dialogs',\n imports: [\n PolymorpheusOutlet,\n TuiAnimatedParent,\n TuiFocusTrap,\n TuiScrollControls,\n TuiScrollRef,\n ],\n templateUrl: './dialogs.template.html',\n styleUrls: ['./dialogs.style.less'],\n // So that we do not force OnPush on custom dialogs\n // eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection\n changeDetection: ChangeDetectionStrategy.Default,\n})\nexport class TuiDialogs {\n protected readonly dialogs: Signal<ReadonlyArray<TuiPopover<any, any>>> = toSignal(\n inject(TUI_DIALOGS),\n {initialValue: []},\n );\n}\n","<div\n class=\"t-overlay\"\n [class.t-overlay_visible]=\"dialogs().length\"\n></div>\n<!--TODO: Rename to <article> in v5-->\n@for (item of dialogs(); track item) {\n <section\n aria-modal=\"true\"\n role=\"dialog\"\n tuiAnimatedParent\n tuiFocusTrap\n tuiScrollRef\n class=\"t-dialog\"\n [attr.aria-labelledby]=\"item.id\"\n >\n <ng-container *polymorpheusOutlet=\"item.component; context: item\" />\n <tui-scroll-controls class=\"t-scrollbars\" />\n </section>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOa,MAAA,WAAW,GAAG,IAAI,cAAc,CAAC,SAAS,GAAG,aAAa,GAAG,EAAE,EAAE;IAC1E,OAAO,EAAE,MAAM,IAAI,eAAe,CAAsC,EAAE,CAAC;AAC9E,CAAA;AAEY,MAAA,0BAA0B,GAA2B;AAC9D,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,IAAI,EAAE,SAAS;;AAGnB;;;AAGG;AACU,MAAA,iBAAiB,GAAG,IAAI,cAAc,CAC/C,SAAS,GAAG,mBAAmB,GAAG,EAAE,EACpC;AACI,IAAA,OAAO,EAAE,MAAM,KAAK;AACvB,CAAA;AAGL;;AAEG;AACU,MAAA,kBAAkB,GAAG,IAAI,cAAc,CAChD,SAAS,GAAG,oBAAoB,GAAG,EAAE,EACrC;AACI,IAAA,OAAO,EAAE,MAAM,0BAA0B;AAC5C,CAAA;AAGC,SAAU,wBAAwB,CACpC,OAA2C,EAAA;IAE3C,OAAO,iBAAiB,CAAC,kBAAkB,EAAE,OAAO,EAAE,0BAA0B,CAAC;AACrF;;AClCA,MAAM,qBAAqB,GAAG,EAAE;AAG1B,MAAO,qBAAsB,SAAQ,UAAmB,CAAA;AAkC1D,IAAA,WAAA,GAAA;AACI,QAAA,KAAK,CAAC,CAAC,UAAU,KACb,KAAK,CACD,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,UAAU,EACf,eAAe,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC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,EAAA,WAAA,EAAA,IAAA,EAClB,iBAAiB,EAAA,QAAA,EAAA,qBAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACjB,YAAY,EAAA,QAAA,EAAA,gBAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACZ,iBAAiB,EAAA,QAAA,EAAA,qBAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACjB,YAAY,EAAA,QAAA,EAAA,gBAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,OAAA,EAAA,CAAA,CAAA;;4FAQP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAftB,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,EACd,OAAA,EAAA;wBACL,kBAAkB;wBAClB,iBAAiB;wBACjB,YAAY;wBACZ,iBAAiB;wBACjB,YAAY;qBACf,EAKgB,eAAA,EAAA,uBAAuB,CAAC,OAAO,EAAA,QAAA,EAAA,miBAAA,EAAA,MAAA,EAAA,CAAA,6/DAAA,CAAA,EAAA;;;AEvBpD;;AAEG;;;;"}
1
+ {"version":3,"file":"taiga-ui-core-components-dialog.mjs","sources":["../../../projects/core/components/dialog/dialog.providers.ts","../../../projects/core/components/dialog/dialog.component.ts","../../../projects/core/components/dialog/dialog.template.html","../../../projects/core/components/dialog/dialog.options.ts","../../../projects/core/components/dialog/dialog.service.ts","../../../projects/core/components/dialog/dialog.directive.ts","../../../projects/core/components/dialog/dialog.factory.ts","../../../projects/core/components/dialog/active-zone-adapter.directive.ts","../../../projects/core/components/dialog/dialogs.component.ts","../../../projects/core/components/dialog/dialogs.template.html","../../../projects/core/components/dialog/taiga-ui-core-components-dialog.ts"],"sourcesContent":["import {DOCUMENT} from '@angular/common';\nimport {inject, Injectable, InjectionToken} from '@angular/core';\nimport {ActivationStart, Router} from '@angular/router';\nimport {WA_WINDOW} from '@ng-web-apis/common';\nimport {tuiCloseWatcher, tuiTypedFromEvent, tuiZonefull} from '@taiga-ui/cdk/observables';\nimport {type TuiPopover} from '@taiga-ui/cdk/services';\nimport {\n tuiContainsOrAfter,\n tuiGetActualTarget,\n tuiInjectElement,\n tuiIsElement,\n} from '@taiga-ui/cdk/utils/dom';\nimport {tuiGetViewportWidth} from '@taiga-ui/core/utils';\nimport {BehaviorSubject, filter, map, merge, Observable, switchMap, take} from 'rxjs';\n\nexport const TUI_DIALOGS = new InjectionToken(ngDevMode ? 'TUI_DIALOGS' : '', {\n factory: () => new BehaviorSubject<ReadonlyArray<TuiPopover<any, any>>>([]),\n});\n\nexport const TUI_DIALOGS_CLOSE = new InjectionToken<Observable<unknown>>(\n ngDevMode ? 'TUI_DIALOGS_CLOSE' : '',\n {\n factory: () =>\n inject(Router).events.pipe(filter((e) => e instanceof ActivationStart)),\n },\n);\n\n@Injectable()\nexport class TuiDialogCloseService extends Observable<unknown> {\n private readonly win = inject(WA_WINDOW);\n private readonly doc = inject(DOCUMENT);\n private readonly el = tuiInjectElement();\n private readonly esc$ = tuiTypedFromEvent(this.doc, 'keydown').pipe(\n filter((event) => {\n const target = tuiGetActualTarget(event);\n\n return (\n // @ts-ignore\n typeof CloseWatcher === 'undefined' &&\n event.key?.toLowerCase() === 'escape' &&\n !event.defaultPrevented &&\n (this.el.contains(target) || this.isOutside(target))\n );\n }),\n );\n\n private readonly mousedown$ = tuiTypedFromEvent(this.doc, 'mousedown').pipe(\n filter(\n (event) =>\n // Scrollbars\n tuiGetViewportWidth(this.win) - event.clientX > 17 &&\n this.isOutside(tuiGetActualTarget(event)),\n ),\n switchMap(() =>\n tuiTypedFromEvent(this.doc, 'mouseup').pipe(\n take(1),\n map(tuiGetActualTarget),\n filter((target) => this.isOutside(target)),\n ),\n ),\n );\n\n constructor() {\n super((subscriber) =>\n merge(\n this.esc$,\n this.mousedown$,\n tuiCloseWatcher().pipe(tuiZonefull()),\n ).subscribe(subscriber),\n );\n }\n\n private isOutside(target: EventTarget): boolean {\n return tuiIsElement(target) && !tuiContainsOrAfter(this.el, target);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {TUI_TRUE_HANDLER} from '@taiga-ui/cdk/constants';\nimport {TuiAnimated} from '@taiga-ui/cdk/directives/animated';\nimport {TuiAutoFocus} from '@taiga-ui/cdk/directives/auto-focus';\nimport {type TuiPopover} from '@taiga-ui/cdk/services';\nimport {TuiButton} from '@taiga-ui/core/components/button';\nimport {TuiHeader, tuiHeaderOptionsProvider} from '@taiga-ui/core/components/header';\nimport {TuiTitle} from '@taiga-ui/core/directives/title';\nimport {TUI_CLOSE_WORD, TUI_COMMON_ICONS} from '@taiga-ui/core/tokens';\nimport {injectContext, PolymorpheusOutlet} from '@taiga-ui/polymorpheus';\nimport {\n exhaustMap,\n filter,\n isObservable,\n map,\n merge,\n type Observable,\n of,\n Subject,\n switchMap,\n take,\n} from 'rxjs';\n\nimport {type TuiDialogOptions} from './dialog.options';\nimport {TUI_DIALOGS_CLOSE, TuiDialogCloseService} from './dialog.providers';\n\nconst REQUIRED_ERROR = new Error('Required dialog was dismissed');\n\nfunction toObservable<T>(valueOrStream: Observable<T> | T): Observable<T> {\n return isObservable(valueOrStream) ? valueOrStream : of(valueOrStream);\n}\n\n@Component({\n selector: 'tui-dialog',\n imports: [PolymorpheusOutlet, TuiAutoFocus, TuiButton, TuiHeader, TuiTitle],\n templateUrl: './dialog.template.html',\n styleUrl: './dialog.style.less',\n encapsulation: ViewEncapsulation.None,\n // So we don't force OnPush on dialog content\n // eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection\n changeDetection: ChangeDetectionStrategy.Default,\n providers: [\n TuiDialogCloseService,\n tuiHeaderOptionsProvider(() => ({size: getSize(injectContext())})),\n ],\n hostDirectives: [TuiAnimated],\n host: {\n '[attr.data-appearance]': 'context.appearance',\n '[attr.data-size]': 'context.size',\n '[class._closable]': 'context.closable',\n },\n})\nexport class TuiDialogComponent<O, I> {\n protected readonly close$ = new Subject<void>();\n protected readonly close = inject(TUI_CLOSE_WORD);\n protected readonly icons = inject(TUI_COMMON_ICONS);\n protected readonly context = injectContext<TuiPopover<TuiDialogOptions<I>, O>>();\n protected readonly primitive =\n typeof this.context.content === 'function' ||\n Object(this.context.content) !== this.context.content;\n\n protected readonly sub = merge(\n this.close$.pipe(switchMap(() => toObservable(this.context.closable))),\n inject(TuiDialogCloseService).pipe(\n exhaustMap(() => toObservable(this.context.dismissible).pipe(take(1))),\n ),\n inject(TUI_DIALOGS_CLOSE).pipe(map(TUI_TRUE_HANDLER)),\n )\n .pipe(filter(Boolean), takeUntilDestroyed())\n .subscribe(() => {\n if (this.context.required) {\n this.context.$implicit.error(REQUIRED_ERROR);\n } else {\n this.context.$implicit.complete();\n }\n });\n}\n\nfunction getSize({appearance, size}: TuiDialogOptions<unknown>): 'h3' | 'h4' | 'h5' {\n if (appearance.includes('fullscreen')) {\n return 'h3';\n }\n\n return size === 's' ? 'h5' : 'h4';\n}\n","@if (context.closable) {\n <button\n size=\"s\"\n tuiIconButton\n type=\"button\"\n class=\"t-close\"\n [appearance]=\"context.appearance === 'fullscreen' ? 'action' : 'neutral'\"\n [iconStart]=\"icons.close\"\n [style.border-radius.%]=\"100\"\n (click)=\"close$.next()\"\n (mousedown.prevent.zoneless)=\"(0)\"\n >\n {{ close() }}\n </button>\n}\n\n@if (!primitive && context.label) {\n <header tuiHeader>\n <hgroup tuiTitle>\n <h2\n [id]=\"context.id\"\n [innerHTML]=\"context.label\"\n ></h2>\n </hgroup>\n </header>\n}\n\n<ng-container *polymorpheusOutlet=\"context.content as text; context: context\">\n <header tuiHeader>\n <hgroup tuiTitle>\n <h2\n [id]=\"context.id\"\n [innerHTML]=\"context.label\"\n ></h2>\n <p [innerHTML]=\"text\"></p>\n </hgroup>\n </header>\n @if (context.closable || context.dismissible) {\n <footer>\n <button\n size=\"m\"\n tuiAutoFocus\n tuiButton\n type=\"button\"\n (click)=\"context.$implicit.complete()\"\n >\n {{ context.data || 'OK' }}\n </button>\n </footer>\n }\n</ng-container>\n","import {type TuiPopoverContext} from '@taiga-ui/cdk/services';\nimport {tuiCreateOptions} from '@taiga-ui/cdk/utils/di';\nimport {type TuiSizeL, type TuiSizeS} from '@taiga-ui/core/types';\nimport {type Observable} from 'rxjs';\n\n/**\n * Options for a dialog\n *\n * appearance - data-appearance attribute of the dialog ('taiga' by default)\n * closable - show close button (true by default)\n * data - arbitrary data for dialog\n * dismissible - close dialog by Esc button or click on overlay (true by default)\n * label - string title for the dialog ('' by default)\n * required - dismissing or closing dialog by X button throws (false by default)\n * size - size of the dialog ('m' by default)\n */\nexport interface TuiDialogOptions<I> {\n readonly appearance: string;\n readonly closable: Observable<boolean> | boolean;\n readonly data: I extends void ? undefined : I;\n readonly dismissible: Observable<boolean> | boolean;\n readonly label: string;\n readonly required: boolean;\n readonly size: TuiSizeL | TuiSizeS;\n}\n\nexport interface TuiDialogContext<O = void, I = undefined>\n extends TuiPopoverContext<O>,\n TuiDialogOptions<I> {}\n\nexport const [TUI_DIALOG_OPTIONS, tuiDialogOptionsProvider] = tuiCreateOptions<\n TuiDialogOptions<void>\n>({\n appearance: 'taiga',\n size: 'm',\n required: false,\n closable: true,\n dismissible: true,\n label: '',\n data: undefined,\n});\n","import {inject, Injectable} from '@angular/core';\nimport {TuiPopoverService} from '@taiga-ui/cdk/services';\n\nimport {TuiDialogComponent} from './dialog.component';\nimport {TUI_DIALOG_OPTIONS, type TuiDialogOptions} from './dialog.options';\nimport {TUI_DIALOGS} from './dialog.providers';\n\n@Injectable({\n providedIn: 'root',\n useFactory: () =>\n new TuiDialogService(TUI_DIALOGS, TuiDialogComponent, inject(TUI_DIALOG_OPTIONS)),\n})\nexport class TuiDialogService extends TuiPopoverService<TuiDialogOptions<any>> {}\n","import {Directive} from '@angular/core';\nimport {TuiPopoverDirective} from '@taiga-ui/cdk/directives/popover';\nimport {tuiAsPopover} from '@taiga-ui/cdk/services';\n\nimport {type TuiDialogOptions} from './dialog.options';\nimport {TuiDialogService} from './dialog.service';\n\n@Directive({\n standalone: true,\n selector: 'ng-template[tuiDialog]',\n inputs: ['options: tuiDialogOptions', 'open: tuiDialog'],\n outputs: ['openChange: tuiDialogChange'],\n providers: [tuiAsPopover(TuiDialogService)],\n})\nexport class TuiDialog<T> extends TuiPopoverDirective<TuiDialogOptions<T>> {}\n","import {assertInInjectionContext, inject, INJECTOR, type Injector} from '@angular/core';\nimport {PolymorpheusComponent} from '@taiga-ui/polymorpheus';\nimport {type Observable} from 'rxjs';\n\nimport {type TuiDialogContext, type TuiDialogOptions} from './dialog.options';\nimport {TuiDialogService} from './dialog.service';\n\ntype SingleUnionOrNever<T, U = T> = [T] extends [never]\n ? never\n : T extends U\n ? [U] extends [T]\n ? T\n : never\n : never;\n\ntype ReplaceAny<T> = 0 extends T & 1 ? void : T;\n\ntype ContextKeys<T> = {\n [K in keyof T]: ReplaceAny<T[K]> extends TuiDialogContext<any, any> | null\n ? K\n : never;\n}[keyof T];\n\ntype AssertNotMultipleContexts<T, K extends keyof T> = [K] extends [never]\n ? new (...args: any[]) => T\n : [SingleUnionOrNever<K>] extends [never]\n ? 'Component has multiple context. Cannot determine the type...'\n : new (...args: any[]) => T;\n\ntype ExtractDialogData<T, K extends keyof T = ContextKeys<T>> = [K] extends [never]\n ? void\n : [SingleUnionOrNever<K>] extends [never]\n ? never\n : T[K] extends TuiDialogContext<any, infer D> | null\n ? D\n : void;\n\ntype ExtractDialogResult<T, K extends keyof T = ContextKeys<T>> = [K] extends [never]\n ? void\n : [SingleUnionOrNever<K>] extends [never]\n ? never\n : T[K] extends TuiDialogContext<infer R, any> | null\n ? R\n : void;\n\ntype Options<T> = Omit<TuiDialogOptions<T>, 'data'> & {injector: Injector};\n\nexport function tuiDialog<\n T,\n K extends ContextKeys<T>,\n D extends ExtractDialogData<T, K>,\n R extends ExtractDialogResult<T, K>,\n>(\n component: AssertNotMultipleContexts<T, K>,\n {injector, ...options}: Partial<Options<D>> = {},\n): (data: D) => Observable<R> {\n if (!injector) {\n assertInInjectionContext(tuiDialog);\n injector = inject(INJECTOR);\n }\n\n const dialogService = injector.get(TuiDialogService);\n\n return (data) =>\n dialogService.open(\n new PolymorpheusComponent(component as new () => T, injector),\n {\n ...options,\n data,\n },\n );\n}\n","import {DOCUMENT} from '@angular/common';\nimport {Directive, inject, type OnDestroy, type OnInit} from '@angular/core';\nimport {TuiActiveZone} from '@taiga-ui/cdk/directives/active-zone';\nimport {tuiGetFocused} from '@taiga-ui/cdk/utils/focus';\n\n@Directive({\n standalone: true,\n selector: '[tuiActiveZoneAdapter]',\n hostDirectives: [TuiActiveZone],\n})\nexport class TuiActiveZoneAdapter implements OnDestroy, OnInit {\n private readonly current = inject(TuiActiveZone);\n private readonly parent = findActive(\n inject(TuiActiveZone, {skipSelf: true}),\n tuiGetFocused(inject(DOCUMENT)),\n );\n\n public ngOnInit(): void {\n this.current.tuiActiveZoneParentSetter = this.parent;\n }\n\n public ngOnDestroy(): void {\n this.current.tuiActiveZoneParentSetter = null;\n }\n}\n\nfunction findActive(zone: TuiActiveZone, el: Element | null): TuiActiveZone | null {\n if (!el || !zone.contains(el)) {\n return null;\n }\n\n const active = zone.children.find(\n (child) => !child['el'].matches('[tuiActiveZoneAdapter]') && child.contains(el),\n );\n\n return active ? findActive(active, el) : zone;\n}\n","import {ChangeDetectionStrategy, Component, inject, type Signal} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {TuiAnimatedParent} from '@taiga-ui/cdk/directives/animated';\nimport {TuiFocusTrap} from '@taiga-ui/cdk/directives/focus-trap';\nimport {type TuiPopover} from '@taiga-ui/cdk/services';\nimport {TuiScrollControls, TuiScrollRef} from '@taiga-ui/core/components/scrollbar';\nimport {PolymorpheusOutlet} from '@taiga-ui/polymorpheus';\n\nimport {TuiActiveZoneAdapter} from './active-zone-adapter.directive';\nimport {TUI_DIALOGS} from './dialog.providers';\n\n@Component({\n selector: 'tui-dialogs',\n imports: [\n PolymorpheusOutlet,\n TuiActiveZoneAdapter,\n TuiAnimatedParent,\n TuiFocusTrap,\n TuiScrollControls,\n TuiScrollRef,\n ],\n templateUrl: './dialogs.template.html',\n styleUrl: './dialogs.style.less',\n // So that we do not force OnPush on custom dialogs\n // eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection\n changeDetection: ChangeDetectionStrategy.Default,\n})\nexport class TuiDialogs {\n protected readonly dialogs: Signal<ReadonlyArray<TuiPopover<any, any>>> = toSignal(\n inject(TUI_DIALOGS),\n {initialValue: []},\n );\n}\n","<div\n class=\"t-overlay\"\n [class.t-overlay_visible]=\"dialogs().length\"\n></div>\n<!--TODO: Rename to <article> in v5-->\n@for (item of dialogs(); track item) {\n <section\n aria-modal=\"true\"\n role=\"dialog\"\n tuiActiveZoneAdapter\n tuiAnimatedParent\n tuiFocusTrap\n tuiScrollRef\n class=\"t-dialog\"\n [attr.aria-labelledby]=\"item.id\"\n >\n <ng-container *polymorpheusOutlet=\"item.component; context: item\" />\n <tui-scroll-controls class=\"t-scrollbars\" />\n </section>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAea,MAAA,WAAW,GAAG,IAAI,cAAc,CAAC,SAAS,GAAG,aAAa,GAAG,EAAE,EAAE;IAC1E,OAAO,EAAE,MAAM,IAAI,eAAe,CAAsC,EAAE,CAAC;AAC9E,CAAA;AAEY,MAAA,iBAAiB,GAAG,IAAI,cAAc,CAC/C,SAAS,GAAG,mBAAmB,GAAG,EAAE,EACpC;IACI,OAAO,EAAE,MACL,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,eAAe,CAAC,CAAC;AAC9E,CAAA;AAIC,MAAO,qBAAsB,SAAQ,UAAmB,CA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AA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,OAAA,EAAA,CAAA,CAAA;;4FAQP,UAAU,EAAA,UAAA,EAAA,CAAA;kBAhBtB,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,EACd,OAAA,EAAA;wBACL,kBAAkB;wBAClB,oBAAoB;wBACpB,iBAAiB;wBACjB,YAAY;wBACZ,iBAAiB;wBACjB,YAAY;qBACf,EAKgB,eAAA,EAAA,uBAAuB,CAAC,OAAO,EAAA,QAAA,EAAA,ikBAAA,EAAA,MAAA,EAAA,CAAA,s3DAAA,CAAA,EAAA;;;AEzBpD;;AAEG;;;;"}
@@ -1,39 +1,123 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Input, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { toSignal } from '@angular/core/rxjs-interop';
2
+ import { inject, computed, input, ChangeDetectionStrategy, Component, isSignal, Directive, TemplateRef, untracked, Pipe } from '@angular/core';
4
3
  import { TuiValidationError } from '@taiga-ui/cdk/classes';
5
4
  import { TuiAnimated } from '@taiga-ui/cdk/directives/animated';
6
- import { tuiIsString } from '@taiga-ui/cdk/utils/miscellaneous';
7
- import { TUI_ANIMATIONS_SPEED, TUI_DEFAULT_ERROR_MESSAGE } from '@taiga-ui/core/tokens';
8
- import { tuiToAnimationOptions } from '@taiga-ui/core/utils';
9
- import { PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
5
+ import { tuiIsString, tuiDirectiveBinding, tuiProvide, tuiSetSignal } from '@taiga-ui/cdk/utils/miscellaneous';
6
+ import { TUI_DEFAULT_ERROR_MESSAGE, TUI_VALIDATION_ERRORS } from '@taiga-ui/core/tokens';
7
+ import { PolymorpheusOutlet, PolymorpheusTemplate, PolymorpheusComponent } from '@taiga-ui/polymorpheus';
8
+ import { toSignal } from '@angular/core/rxjs-interop';
9
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, NgControl } from '@angular/forms';
10
+ import { Subject, distinctUntilChanged, switchMap, startWith, map } from 'rxjs';
10
11
 
11
- class TuiError {
12
+ class TuiErrorComponent {
12
13
  constructor() {
13
- this.options = tuiToAnimationOptions(inject(TUI_ANIMATIONS_SPEED));
14
- this.error = null;
15
- this.visible = true;
16
- this.default = toSignal(inject(TUI_DEFAULT_ERROR_MESSAGE));
17
- }
18
- set errorSetter(error) {
19
- this.error = tuiIsString(error) ? new TuiValidationError(error) : error;
14
+ this.default = inject(TUI_DEFAULT_ERROR_MESSAGE);
15
+ this.content = computed((error = this.error()) => tuiIsString(error) ? new TuiValidationError(error) : error);
16
+ this.error = input(null);
20
17
  }
21
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiError, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
22
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TuiError, isStandalone: true, selector: "tui-error", inputs: { errorSetter: ["error", "errorSetter"] }, host: { properties: { "class._error": "error" } }, ngImport: i0, template: "@if (error) {\n <div\n automation-id=\"tui-error__text\"\n tuiAnimated\n class=\"t-message-text\"\n >\n <ng-container *polymorpheusOutlet=\"error.message || default() as text; context: error.context || {}\">\n {{ text }}\n </ng-container>\n </div>\n}\n", styles: [":host{transition-property:grid-template-rows;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:grid;font:var(--tui-font-text-s);color:var(--tui-text-negative);overflow-wrap:break-word;grid-template-rows:0fr}:host._error{grid-template-rows:1fr}.t-message-text{white-space:pre-line;grid-row:1 / span 2;overflow:hidden}.t-message-text.tui-enter,.t-message-text.tui-leave{animation-name:tuiFade}.t-message-text:before{content:\"\";line-height:1.5rem;vertical-align:bottom}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiAnimated, selector: "[tuiAnimated]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
18
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
19
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TuiErrorComponent, isStandalone: true, selector: "tui-error", inputs: { error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class._error": "content()" } }, ngImport: i0, template: "@if (content(); as error) {\n <span\n tuiAnimated\n class=\"t-message-text\"\n >\n <span\n *polymorpheusOutlet=\"error.message || default() as text; context: error.context || {}\"\n [innerHTML]=\"text\"\n ></span>\n </span>\n}\n", styles: [":host{transition-property:grid-template-rows;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:grid;font:var(--tui-font-text-s);color:var(--tui-text-negative);overflow-wrap:break-word;grid-template-rows:0fr}:host._error{grid-template-rows:1fr}.t-message-text{white-space:pre-line;grid-area:1 / 1 / span 2;overflow:hidden}.t-message-text.tui-enter,.t-message-text.tui-leave{animation-name:tuiFade}.t-message-text:before{content:\"\";line-height:1.5rem;vertical-align:bottom}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiAnimated, selector: "[tuiAnimated]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
23
20
  }
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiError, decorators: [{
21
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiErrorComponent, decorators: [{
25
22
  type: Component,
26
23
  args: [{ selector: 'tui-error', imports: [PolymorpheusOutlet, TuiAnimated], changeDetection: ChangeDetectionStrategy.OnPush, host: {
27
- '[class._error]': 'error',
28
- }, template: "@if (error) {\n <div\n automation-id=\"tui-error__text\"\n tuiAnimated\n class=\"t-message-text\"\n >\n <ng-container *polymorpheusOutlet=\"error.message || default() as text; context: error.context || {}\">\n {{ text }}\n </ng-container>\n </div>\n}\n", styles: [":host{transition-property:grid-template-rows;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:grid;font:var(--tui-font-text-s);color:var(--tui-text-negative);overflow-wrap:break-word;grid-template-rows:0fr}:host._error{grid-template-rows:1fr}.t-message-text{white-space:pre-line;grid-row:1 / span 2;overflow:hidden}.t-message-text.tui-enter,.t-message-text.tui-leave{animation-name:tuiFade}.t-message-text:before{content:\"\";line-height:1.5rem;vertical-align:bottom}\n"] }]
29
- }], propDecorators: { errorSetter: [{
30
- type: Input,
31
- args: ['error']
32
- }] } });
24
+ '[class._error]': 'content()',
25
+ }, template: "@if (content(); as error) {\n <span\n tuiAnimated\n class=\"t-message-text\"\n >\n <span\n *polymorpheusOutlet=\"error.message || default() as text; context: error.context || {}\"\n [innerHTML]=\"text\"\n ></span>\n </span>\n}\n", styles: [":host{transition-property:grid-template-rows;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:grid;font:var(--tui-font-text-s);color:var(--tui-text-negative);overflow-wrap:break-word;grid-template-rows:0fr}:host._error{grid-template-rows:1fr}.t-message-text{white-space:pre-line;grid-area:1 / 1 / span 2;overflow:hidden}.t-message-text.tui-enter,.t-message-text.tui-leave{animation-name:tuiFade}.t-message-text:before{content:\"\";line-height:1.5rem;vertical-align:bottom}\n"] }]
26
+ }] });
27
+
28
+ class TuiErrorDirective {
29
+ constructor() {
30
+ this.content = inject(TUI_VALIDATION_ERRORS);
31
+ this.control = new Subject();
32
+ this.errors = toSignal(this.control.pipe(distinctUntilChanged(), switchMap((control) => control.events.pipe(startWith(null), map(() => control.invalid && control.touched && control.errors)))));
33
+ this.key = computed((errors = this.errors() || {}) => this.order().find((id) => errors[id]) || Object.keys(errors)[0] || '');
34
+ this.order = input([]);
35
+ this.error = tuiDirectiveBinding(TuiErrorComponent, 'error', computed((errors = this.errors() || null) => errors && this.getError(errors[this.key()], this.content[this.key()])), { self: true, optional: true });
36
+ }
37
+ registerOnChange() { }
38
+ registerOnTouched() { }
39
+ writeValue() { }
40
+ validate(control) {
41
+ this.control.next(control);
42
+ return null;
43
+ }
44
+ getError(context, content) {
45
+ context = isSignal(context) ? context() : context;
46
+ if (context instanceof TuiValidationError) {
47
+ return context;
48
+ }
49
+ if (content === undefined && isContent(context)) {
50
+ return getError(context);
51
+ }
52
+ if (isSignal(content)) {
53
+ return getError(content(), context);
54
+ }
55
+ if (content instanceof Function) {
56
+ const message = content(context);
57
+ return getError(isSignal(message) ? message() : message, context);
58
+ }
59
+ return getError(content, context);
60
+ }
61
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiErrorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
62
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.15", type: TuiErrorDirective, isStandalone: true, selector: "tui-error[ngModel], tui-error[formControlName], tui-error[formControl], tui-error[formGroup], tui-error[formGroupName], tui-error[formArrayName]", inputs: { order: { classPropertyName: "order", publicName: "order", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
63
+ tuiProvide(NG_VALUE_ACCESSOR, TuiErrorDirective, true),
64
+ tuiProvide(NG_VALIDATORS, TuiErrorDirective, true),
65
+ ], ngImport: i0 }); }
66
+ }
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiErrorDirective, decorators: [{
68
+ type: Directive,
69
+ args: [{
70
+ selector: 'tui-error[ngModel], tui-error[formControlName], tui-error[formControl], tui-error[formGroup], tui-error[formGroupName], tui-error[formArrayName]',
71
+ providers: [
72
+ tuiProvide(NG_VALUE_ACCESSOR, TuiErrorDirective, true),
73
+ tuiProvide(NG_VALIDATORS, TuiErrorDirective, true),
74
+ ],
75
+ }]
76
+ }] });
77
+ function getError(content = '', context) {
78
+ return new TuiValidationError(content, context);
79
+ }
80
+ function isContent(value) {
81
+ return (tuiIsString(value) ||
82
+ value instanceof TemplateRef ||
83
+ value instanceof PolymorpheusTemplate ||
84
+ value instanceof PolymorpheusComponent);
85
+ }
86
+
87
+ class TuiErrorPipe {
88
+ constructor() {
89
+ this.control = inject(NgControl);
90
+ this.directive = new TuiErrorDirective();
91
+ }
92
+ transform(order) {
93
+ untracked(() => {
94
+ this.directive.validate(this.control.control);
95
+ tuiSetSignal(this.directive.order, order);
96
+ });
97
+ const error = this.directive.error();
98
+ if (!error) {
99
+ return '';
100
+ }
101
+ return typeof error.message === 'function'
102
+ ? error.message(error.context)
103
+ : error.message;
104
+ }
105
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiErrorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
106
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TuiErrorPipe, isStandalone: true, name: "tuiError", pure: false }); }
107
+ }
108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiErrorPipe, decorators: [{
109
+ type: Pipe,
110
+ args: [{
111
+ name: 'tuiError',
112
+ pure: false,
113
+ }]
114
+ }] });
115
+
116
+ const TuiError = [TuiErrorComponent, TuiErrorDirective, TuiErrorPipe];
33
117
 
34
118
  /**
35
119
  * Generated bundle index. Do not edit.
36
120
  */
37
121
 
38
- export { TuiError };
122
+ export { TuiError, TuiErrorComponent, TuiErrorDirective, TuiErrorPipe };
39
123
  //# sourceMappingURL=taiga-ui-core-components-error.mjs.map