@cuby-ui/cdk 0.0.167 → 0.0.168

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 (109) hide show
  1. package/README.md +24 -24
  2. package/constants/index.d.ts +1 -1
  3. package/constants/svg-node-filter.d.ts +1 -1
  4. package/date-time/index.d.ts +1 -1
  5. package/date-time/time.d.ts +14 -14
  6. package/directives/auto-resizing.directive.d.ts +18 -18
  7. package/directives/click-outside.directive.d.ts +9 -9
  8. package/directives/content-editable-value-accessor.directive.d.ts +17 -17
  9. package/directives/dimensions-observer.directive.d.ts +13 -13
  10. package/directives/element.directive.d.ts +8 -8
  11. package/directives/focus-trap.directive.d.ts +14 -14
  12. package/directives/index.d.ts +10 -10
  13. package/directives/item.directive.d.ts +5 -5
  14. package/directives/let.context.d.ts +7 -7
  15. package/directives/let.directive.d.ts +9 -9
  16. package/directives/target.directive.d.ts +14 -14
  17. package/esm2020/constants/index.mjs +1 -1
  18. package/esm2020/constants/svg-node-filter.mjs +8 -8
  19. package/esm2020/cuby-ui-cdk.mjs +4 -4
  20. package/esm2020/date-time/index.mjs +2 -2
  21. package/esm2020/date-time/time.mjs +72 -72
  22. package/esm2020/directives/auto-resizing.directive.mjs +68 -68
  23. package/esm2020/directives/click-outside.directive.mjs +29 -29
  24. package/esm2020/directives/content-editable-value-accessor.directive.mjs +44 -44
  25. package/esm2020/directives/dimensions-observer.directive.mjs +32 -32
  26. package/esm2020/directives/element.directive.mjs +19 -19
  27. package/esm2020/directives/focus-trap.directive.mjs +50 -50
  28. package/esm2020/directives/index.mjs +11 -11
  29. package/esm2020/directives/item.directive.mjs +14 -14
  30. package/esm2020/directives/let.context.mjs +12 -12
  31. package/esm2020/directives/let.directive.mjs +23 -23
  32. package/esm2020/directives/target.directive.mjs +35 -35
  33. package/esm2020/index.mjs +10 -10
  34. package/esm2020/interfaces/dimensions.mjs +2 -2
  35. package/esm2020/interfaces/index.mjs +4 -4
  36. package/esm2020/interfaces/on-change.mjs +2 -2
  37. package/esm2020/interfaces/on-touched.mjs +2 -2
  38. package/esm2020/pipes/filter.pipe.mjs +17 -17
  39. package/esm2020/pipes/index.mjs +2 -2
  40. package/esm2020/services/destroy.service.mjs +15 -15
  41. package/esm2020/services/id.service.mjs +18 -18
  42. package/esm2020/services/index.mjs +4 -4
  43. package/esm2020/services/popover.service.mjs +38 -38
  44. package/esm2020/tokens/history.mjs +5 -5
  45. package/esm2020/tokens/index.mjs +5 -5
  46. package/esm2020/tokens/local-storage.mjs +5 -5
  47. package/esm2020/tokens/session-storage.mjs +5 -5
  48. package/esm2020/tokens/window.mjs +11 -11
  49. package/esm2020/types/date-time.mjs +2 -2
  50. package/esm2020/types/index.mjs +7 -7
  51. package/esm2020/types/input-type.mjs +2 -2
  52. package/esm2020/types/mapper.mjs +2 -2
  53. package/esm2020/types/matcher.mjs +2 -2
  54. package/esm2020/types/nullable.mjs +2 -2
  55. package/esm2020/types/value-of.mjs +1 -1
  56. package/esm2020/utils/dom/contains-or-after.mjs +10 -10
  57. package/esm2020/utils/dom/index.mjs +3 -3
  58. package/esm2020/utils/dom/is-html-element.mjs +4 -4
  59. package/esm2020/utils/focus/blur-native-focused.mjs +9 -9
  60. package/esm2020/utils/focus/get-closest-focusable.mjs +22 -22
  61. package/esm2020/utils/focus/get-native-focused.mjs +11 -11
  62. package/esm2020/utils/focus/index.mjs +6 -6
  63. package/esm2020/utils/focus/is-native-keyboard-focusable.mjs +27 -27
  64. package/esm2020/utils/focus/is-native-mouse-focusable.mjs +7 -7
  65. package/esm2020/utils/index.mjs +4 -4
  66. package/esm2020/utils/token/create-token.mjs +8 -8
  67. package/esm2020/utils/token/index.mjs +3 -3
  68. package/esm2020/utils/token/provide.mjs +4 -4
  69. package/fesm2015/cuby-ui-cdk.mjs +501 -501
  70. package/fesm2015/cuby-ui-cdk.mjs.map +1 -1
  71. package/fesm2020/cuby-ui-cdk.mjs +508 -508
  72. package/fesm2020/cuby-ui-cdk.mjs.map +1 -1
  73. package/index.d.ts +9 -9
  74. package/interfaces/dimensions.d.ts +4 -4
  75. package/interfaces/index.d.ts +3 -3
  76. package/interfaces/on-change.d.ts +3 -3
  77. package/interfaces/on-touched.d.ts +3 -3
  78. package/package.json +1 -1
  79. package/pipes/filter.pipe.d.ts +8 -8
  80. package/pipes/index.d.ts +1 -1
  81. package/services/destroy.service.d.ts +8 -8
  82. package/services/id.service.d.ts +7 -7
  83. package/services/index.d.ts +3 -3
  84. package/services/popover.service.d.ts +22 -22
  85. package/tokens/history.d.ts +1 -1
  86. package/tokens/index.d.ts +4 -4
  87. package/tokens/local-storage.d.ts +1 -1
  88. package/tokens/session-storage.d.ts +1 -1
  89. package/tokens/window.d.ts +1 -1
  90. package/types/date-time.d.ts +1 -1
  91. package/types/index.d.ts +6 -6
  92. package/types/input-type.d.ts +1 -1
  93. package/types/mapper.d.ts +1 -1
  94. package/types/matcher.d.ts +2 -2
  95. package/types/nullable.d.ts +1 -1
  96. package/types/value-of.d.ts +1 -1
  97. package/utils/dom/contains-or-after.d.ts +1 -1
  98. package/utils/dom/index.d.ts +2 -2
  99. package/utils/dom/is-html-element.d.ts +1 -1
  100. package/utils/focus/blur-native-focused.d.ts +1 -1
  101. package/utils/focus/get-closest-focusable.d.ts +7 -7
  102. package/utils/focus/get-native-focused.d.ts +1 -1
  103. package/utils/focus/index.d.ts +5 -5
  104. package/utils/focus/is-native-keyboard-focusable.d.ts +1 -1
  105. package/utils/focus/is-native-mouse-focusable.d.ts +1 -1
  106. package/utils/index.d.ts +3 -3
  107. package/utils/token/create-token.d.ts +3 -3
  108. package/utils/token/index.d.ts +2 -2
  109. package/utils/token/provide.d.ts +3 -3
@@ -4,103 +4,103 @@ import { NgControl, NgModel, NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
  import { Subject, Observable, takeUntil } from 'rxjs';
5
5
  import { DOCUMENT } from '@angular/common';
6
6
 
7
- const svgNodeFilter = {
8
- acceptNode(node) {
9
- return 'ownerSVGElement' in node
10
- ? NodeFilter.FILTER_REJECT
11
- : NodeFilter.FILTER_ACCEPT;
12
- },
7
+ const svgNodeFilter = {
8
+ acceptNode(node) {
9
+ return 'ownerSVGElement' in node
10
+ ? NodeFilter.FILTER_REJECT
11
+ : NodeFilter.FILTER_ACCEPT;
12
+ },
13
13
  };
14
14
 
15
- class CuiTime {
16
- constructor(hours, minutes, seconds = 0, ms = 0) {
17
- this.hours = hours;
18
- this.minutes = minutes;
19
- this.seconds = seconds;
20
- this.ms = ms;
21
- }
22
- static fromString(time) {
23
- const hours = this.parseHours(time);
24
- const minutes = Number(time.slice(3, 5)) || 0;
25
- const seconds = Number(time.slice(6, 8)) || 0;
26
- const ms = Number(time.slice(9, 12)) || 0;
27
- return new CuiTime(hours, minutes, seconds, ms);
28
- }
29
- static fromPT(time) {
30
- let duration = time.trim().toUpperCase();
31
- if (!duration.startsWith('P')) {
32
- throw new Error('Invalid PT format: does not start with P');
33
- }
34
- duration = duration.substring(1);
35
- if (duration.startsWith('T')) {
36
- duration = duration.substring(1);
37
- }
38
- const regex = /(\d+(\.\d+)?)([HMS])/g;
39
- let match;
40
- let hours = 0, minutes = 0, seconds = 0, ms = 0;
41
- while ((match = regex.exec(duration)) !== null) {
42
- const value = parseFloat(match[1]);
43
- const unit = match[3];
44
- if (unit === 'H') {
45
- hours = value;
46
- }
47
- else if (unit === 'M') {
48
- minutes = value;
49
- }
50
- else if (unit === 'S') {
51
- seconds = Math.floor(value);
52
- ms = Math.round((value - seconds) * 1000);
53
- }
54
- }
55
- return new CuiTime(hours, minutes, seconds, ms);
56
- }
57
- static parseHours(time) {
58
- return Number(time.slice(0, 2));
59
- }
60
- toString(mode) {
61
- const needAddMs = (mode === null || mode === void 0 ? void 0 : mode.startsWith('HH:MM:SS.MSS')) || (!mode && this.ms > 0);
62
- const needAddSeconds = needAddMs || (mode === null || mode === void 0 ? void 0 : mode.startsWith('HH:MM:SS')) || (!mode && this.seconds > 0);
63
- const hhMm = `${this.formatTime(this.hours)}:${this.formatTime(this.minutes)}`;
64
- const ss = needAddSeconds ? `:${this.formatTime(this.seconds)}` : '';
65
- const mss = needAddMs ? `.${this.formatTime(this.ms, 3)}` : '';
66
- return `${hhMm}${ss}${mss}`;
67
- }
68
- toPT(mode) {
69
- let duration = 'PT';
70
- if (this.hours !== 0) {
71
- duration += `${this.hours}H`;
72
- }
73
- if (this.minutes !== 0) {
74
- duration += `${this.minutes}M`;
75
- }
76
- const totalSeconds = this.seconds + this.ms / 1000;
77
- if (totalSeconds !== 0 || duration === 'PT') {
78
- duration += `${parseFloat(totalSeconds.toFixed(3))}S`;
79
- }
80
- return duration;
81
- }
82
- formatTime(time, digits = 2) {
83
- return String(time).padStart(digits, '0');
84
- }
15
+ class CuiTime {
16
+ constructor(hours, minutes, seconds = 0, ms = 0) {
17
+ this.hours = hours;
18
+ this.minutes = minutes;
19
+ this.seconds = seconds;
20
+ this.ms = ms;
21
+ }
22
+ static fromString(time) {
23
+ const hours = this.parseHours(time);
24
+ const minutes = Number(time.slice(3, 5)) || 0;
25
+ const seconds = Number(time.slice(6, 8)) || 0;
26
+ const ms = Number(time.slice(9, 12)) || 0;
27
+ return new CuiTime(hours, minutes, seconds, ms);
28
+ }
29
+ static fromPT(time) {
30
+ let duration = time.trim().toUpperCase();
31
+ if (!duration.startsWith('P')) {
32
+ throw new Error('Invalid PT format: does not start with P');
33
+ }
34
+ duration = duration.substring(1);
35
+ if (duration.startsWith('T')) {
36
+ duration = duration.substring(1);
37
+ }
38
+ const regex = /(\d+(\.\d+)?)([HMS])/g;
39
+ let match;
40
+ let hours = 0, minutes = 0, seconds = 0, ms = 0;
41
+ while ((match = regex.exec(duration)) !== null) {
42
+ const value = parseFloat(match[1]);
43
+ const unit = match[3];
44
+ if (unit === 'H') {
45
+ hours = value;
46
+ }
47
+ else if (unit === 'M') {
48
+ minutes = value;
49
+ }
50
+ else if (unit === 'S') {
51
+ seconds = Math.floor(value);
52
+ ms = Math.round((value - seconds) * 1000);
53
+ }
54
+ }
55
+ return new CuiTime(hours, minutes, seconds, ms);
56
+ }
57
+ static parseHours(time) {
58
+ return Number(time.slice(0, 2));
59
+ }
60
+ toString(mode) {
61
+ const needAddMs = (mode === null || mode === void 0 ? void 0 : mode.startsWith('HH:MM:SS.MSS')) || (!mode && this.ms > 0);
62
+ const needAddSeconds = needAddMs || (mode === null || mode === void 0 ? void 0 : mode.startsWith('HH:MM:SS')) || (!mode && this.seconds > 0);
63
+ const hhMm = `${this.formatTime(this.hours)}:${this.formatTime(this.minutes)}`;
64
+ const ss = needAddSeconds ? `:${this.formatTime(this.seconds)}` : '';
65
+ const mss = needAddMs ? `.${this.formatTime(this.ms, 3)}` : '';
66
+ return `${hhMm}${ss}${mss}`;
67
+ }
68
+ toPT(mode) {
69
+ let duration = 'PT';
70
+ if (this.hours !== 0) {
71
+ duration += `${this.hours}H`;
72
+ }
73
+ if (this.minutes !== 0) {
74
+ duration += `${this.minutes}M`;
75
+ }
76
+ const totalSeconds = this.seconds + this.ms / 1000;
77
+ if (totalSeconds !== 0 || duration === 'PT') {
78
+ duration += `${parseFloat(totalSeconds.toFixed(3))}S`;
79
+ }
80
+ return duration;
81
+ }
82
+ formatTime(time, digits = 2) {
83
+ return String(time).padStart(digits, '0');
84
+ }
85
85
  }
86
86
 
87
- function cuiCreateToken(defaults) {
88
- return cuiCreateTokenFromFactory(() => defaults);
89
- }
90
- function cuiCreateTokenFromFactory(factory) {
91
- return new InjectionToken('', { factory });
87
+ function cuiCreateToken(defaults) {
88
+ return cuiCreateTokenFromFactory(() => defaults);
89
+ }
90
+ function cuiCreateTokenFromFactory(factory) {
91
+ return new InjectionToken('', { factory });
92
92
  }
93
93
 
94
- function cuiProvide(provide, useExisting, multi = false) {
95
- return { provide, useExisting, multi };
94
+ function cuiProvide(provide, useExisting, multi = false) {
95
+ return { provide, useExisting, multi };
96
96
  }
97
97
 
98
- const CUI_WINDOW = cuiCreateTokenFromFactory(() => {
99
- const { defaultView } = inject(DOCUMENT);
100
- if (!defaultView) {
101
- throw new Error('Window is not available');
102
- }
103
- return defaultView;
98
+ const CUI_WINDOW = cuiCreateTokenFromFactory(() => {
99
+ const { defaultView } = inject(DOCUMENT);
100
+ if (!defaultView) {
101
+ throw new Error('Window is not available');
102
+ }
103
+ return defaultView;
104
104
  });
105
105
 
106
106
  const CUI_HISTORY = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).history);
@@ -109,460 +109,460 @@ const CUI_LOCAL_STORAGE = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).loc
109
109
 
110
110
  const CUI_SESSION_STORAGE = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).sessionStorage);
111
111
 
112
- class CuiDestroyService extends Subject {
113
- ngOnDestroy() {
114
- this.next();
115
- this.complete();
116
- }
117
- }
118
- CuiDestroyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
119
- CuiDestroyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService });
120
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService, decorators: [{
121
- type: Injectable
112
+ class CuiDestroyService extends Subject {
113
+ ngOnDestroy() {
114
+ this.next();
115
+ this.complete();
116
+ }
117
+ }
118
+ CuiDestroyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
119
+ CuiDestroyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService });
120
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService, decorators: [{
121
+ type: Injectable
122
122
  }] });
123
123
 
124
- const CUI = 'cui_';
125
- class CuiIdService {
126
- generate() {
127
- return `${CUI}${CuiIdService.autoId++}${Date.now()}`;
128
- }
129
- }
130
- CuiIdService.autoId = 0;
131
- CuiIdService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
132
- CuiIdService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, providedIn: 'root' });
133
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, decorators: [{
134
- type: Injectable,
135
- args: [{
136
- providedIn: 'root'
137
- }]
124
+ const CUI = 'cui_';
125
+ class CuiIdService {
126
+ generate() {
127
+ return `${CUI}${CuiIdService.autoId++}${Date.now()}`;
128
+ }
129
+ }
130
+ CuiIdService.autoId = 0;
131
+ CuiIdService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
132
+ CuiIdService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, providedIn: 'root' });
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, decorators: [{
134
+ type: Injectable,
135
+ args: [{
136
+ providedIn: 'root'
137
+ }]
138
138
  }] });
139
139
 
140
- class CuiPopoverService {
141
- constructor(items, component, options = {}) {
142
- this.options = options;
143
- this.cuiIdService = inject(CuiIdService);
144
- this.items$ = inject(items);
145
- this.component = component;
146
- }
147
- open(content, options = {}) {
148
- return new Observable(observer => {
149
- const item = Object.assign(Object.assign(Object.assign({}, this.options), options), { $implicit: observer, id: this.cuiIdService.generate(), component: this.component, content: content, completeWith: (result) => {
150
- observer.next(result);
151
- observer.complete();
152
- } });
153
- this.items$.next([...this.items$.value, item]);
154
- return () => {
155
- this.items$.next(this.items$.value.filter(value => value !== item));
156
- };
157
- });
158
- }
159
- }
160
- CuiPopoverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
161
- CuiPopoverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService });
162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, decorators: [{
163
- type: Injectable
140
+ class CuiPopoverService {
141
+ constructor(items, component, options = {}) {
142
+ this.options = options;
143
+ this.cuiIdService = inject(CuiIdService);
144
+ this.items$ = inject(items);
145
+ this.component = component;
146
+ }
147
+ open(content, options = {}) {
148
+ return new Observable(observer => {
149
+ const item = Object.assign(Object.assign(Object.assign({}, this.options), options), { $implicit: observer, id: this.cuiIdService.generate(), component: this.component, content: content, completeWith: (result) => {
150
+ observer.next(result);
151
+ observer.complete();
152
+ } });
153
+ this.items$.next([...this.items$.value, item]);
154
+ return () => {
155
+ this.items$.next(this.items$.value.filter(value => value !== item));
156
+ };
157
+ });
158
+ }
159
+ }
160
+ CuiPopoverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
161
+ CuiPopoverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService });
162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, decorators: [{
163
+ type: Injectable
164
164
  }], ctorParameters: function () { return [{ type: undefined }, { type: undefined }, { type: undefined }]; } });
165
165
 
166
- class CuiAutoResizingDirective {
167
- constructor() {
168
- this.window = inject(CUI_WINDOW);
169
- this.element = inject(ElementRef).nativeElement;
170
- this.ngControl = inject(NgControl, { self: true, optional: true });
171
- this.ngModel = inject(NgModel, { self: true, optional: true });
172
- this.destroy$ = inject(CuiDestroyService, { self: true });
173
- this.elementStyles = this.element.style;
174
- }
175
- ngOnInit() {
176
- this.initNgControlValueChangeSubscription();
177
- this.initNgModelValueChangeSubscription();
178
- }
179
- ngAfterViewChecked() {
180
- this.resize();
181
- }
182
- onInput() {
183
- this.resize();
184
- }
185
- initNgControlValueChangeSubscription() {
186
- if (!this.ngControl) {
187
- return;
188
- }
189
- this.ngControl.valueChanges
190
- .pipe(takeUntil(this.destroy$))
191
- .subscribe(this.resize.bind(this));
192
- }
193
- initNgModelValueChangeSubscription() {
194
- if (!this.ngModel) {
195
- return;
196
- }
197
- this.ngModel.valueChanges
198
- .pipe(takeUntil(this.destroy$))
199
- .subscribe(this.resize.bind(this));
200
- }
201
- resize() {
202
- const { maxHeight: computedMaxHeight, borderTopWidth, borderBottomWidth } = this.window.getComputedStyle(this.element);
203
- this.elementStyles.height = 'auto';
204
- this.elementStyles.height =
205
- this.element.scrollHeight + parseFloat(borderTopWidth) + parseFloat(borderBottomWidth) + 'px';
206
- if (parseFloat(this.element.style.height) < parseFloat(computedMaxHeight)) {
207
- this.elementStyles.overflow = 'hidden';
208
- return;
209
- }
210
- this.elementStyles.overflowY = 'scroll';
211
- this.elementStyles.height = computedMaxHeight;
212
- }
213
- }
214
- CuiAutoResizingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
215
- CuiAutoResizingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiAutoResizingDirective, isStandalone: true, selector: "textarea[cuiAutoResizing]", host: { listeners: { "input": "onInput()" } }, providers: [CuiDestroyService], ngImport: i0 });
216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, decorators: [{
217
- type: Directive,
218
- args: [{
219
- standalone: true,
220
- selector: 'textarea[cuiAutoResizing]',
221
- providers: [CuiDestroyService]
222
- }]
223
- }], propDecorators: { onInput: [{
224
- type: HostListener,
225
- args: ['input']
166
+ class CuiAutoResizingDirective {
167
+ constructor() {
168
+ this.window = inject(CUI_WINDOW);
169
+ this.element = inject(ElementRef).nativeElement;
170
+ this.ngControl = inject(NgControl, { self: true, optional: true });
171
+ this.ngModel = inject(NgModel, { self: true, optional: true });
172
+ this.destroy$ = inject(CuiDestroyService, { self: true });
173
+ this.elementStyles = this.element.style;
174
+ }
175
+ ngOnInit() {
176
+ this.initNgControlValueChangeSubscription();
177
+ this.initNgModelValueChangeSubscription();
178
+ }
179
+ ngAfterViewChecked() {
180
+ this.resize();
181
+ }
182
+ onInput() {
183
+ this.resize();
184
+ }
185
+ initNgControlValueChangeSubscription() {
186
+ if (!this.ngControl) {
187
+ return;
188
+ }
189
+ this.ngControl.valueChanges
190
+ .pipe(takeUntil(this.destroy$))
191
+ .subscribe(this.resize.bind(this));
192
+ }
193
+ initNgModelValueChangeSubscription() {
194
+ if (!this.ngModel) {
195
+ return;
196
+ }
197
+ this.ngModel.valueChanges
198
+ .pipe(takeUntil(this.destroy$))
199
+ .subscribe(this.resize.bind(this));
200
+ }
201
+ resize() {
202
+ const { maxHeight: computedMaxHeight, borderTopWidth, borderBottomWidth } = this.window.getComputedStyle(this.element);
203
+ this.elementStyles.height = 'auto';
204
+ this.elementStyles.height =
205
+ this.element.scrollHeight + parseFloat(borderTopWidth) + parseFloat(borderBottomWidth) + 'px';
206
+ if (parseFloat(this.element.style.height) < parseFloat(computedMaxHeight)) {
207
+ this.elementStyles.overflow = 'hidden';
208
+ return;
209
+ }
210
+ this.elementStyles.overflowY = 'scroll';
211
+ this.elementStyles.height = computedMaxHeight;
212
+ }
213
+ }
214
+ CuiAutoResizingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
215
+ CuiAutoResizingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiAutoResizingDirective, isStandalone: true, selector: "textarea[cuiAutoResizing]", host: { listeners: { "input": "onInput()" } }, providers: [CuiDestroyService], ngImport: i0 });
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, decorators: [{
217
+ type: Directive,
218
+ args: [{
219
+ standalone: true,
220
+ selector: 'textarea[cuiAutoResizing]',
221
+ providers: [CuiDestroyService]
222
+ }]
223
+ }], propDecorators: { onInput: [{
224
+ type: HostListener,
225
+ args: ['input']
226
226
  }] } });
227
227
 
228
- class CuiClickOutsideDirective {
229
- constructor() {
230
- this.element = inject(ElementRef).nativeElement;
231
- this.cuiClickOutside = new EventEmitter();
232
- }
233
- onClickOutside(target) {
234
- if (this.element.contains(target)) {
235
- return;
236
- }
237
- this.cuiClickOutside.emit(target);
238
- }
239
- }
240
- CuiClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
241
- CuiClickOutsideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiClickOutsideDirective, isStandalone: true, selector: "(cuiClickOutside)", outputs: { cuiClickOutside: "cuiClickOutside" }, host: { listeners: { "document:click": "onClickOutside($event.target)" } }, ngImport: i0 });
242
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, decorators: [{
243
- type: Directive,
244
- args: [{
245
- standalone: true,
246
- selector: '(cuiClickOutside)'
247
- }]
248
- }], propDecorators: { cuiClickOutside: [{
249
- type: Output
250
- }], onClickOutside: [{
251
- type: HostListener,
252
- args: ['document:click', ['$event.target']]
228
+ class CuiClickOutsideDirective {
229
+ constructor() {
230
+ this.element = inject(ElementRef).nativeElement;
231
+ this.cuiClickOutside = new EventEmitter();
232
+ }
233
+ onClickOutside(target) {
234
+ if (this.element.contains(target)) {
235
+ return;
236
+ }
237
+ this.cuiClickOutside.emit(target);
238
+ }
239
+ }
240
+ CuiClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
241
+ CuiClickOutsideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiClickOutsideDirective, isStandalone: true, selector: "(cuiClickOutside)", outputs: { cuiClickOutside: "cuiClickOutside" }, host: { listeners: { "document:click": "onClickOutside($event.target)" } }, ngImport: i0 });
242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, decorators: [{
243
+ type: Directive,
244
+ args: [{
245
+ standalone: true,
246
+ selector: '(cuiClickOutside)'
247
+ }]
248
+ }], propDecorators: { cuiClickOutside: [{
249
+ type: Output
250
+ }], onClickOutside: [{
251
+ type: HostListener,
252
+ args: ['document:click', ['$event.target']]
253
253
  }] } });
254
254
 
255
- class CuiDimensionsObserverDirective {
256
- constructor() {
257
- this.element = inject(ElementRef).nativeElement;
258
- this.observer = new ResizeObserver((entries) => {
259
- entries.forEach(() => this.cuiResizeObserver.emit({
260
- width: this.element.offsetWidth,
261
- height: this.element.offsetHeight
262
- }));
263
- });
264
- this.cuiResizeObserver = new EventEmitter();
265
- }
266
- ngOnInit() {
267
- this.observer.observe(this.element);
268
- }
269
- ngOnDestroy() {
270
- this.observer.disconnect();
271
- }
272
- }
273
- CuiDimensionsObserverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
274
- CuiDimensionsObserverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiDimensionsObserverDirective, isStandalone: true, selector: "[cuiResizeObserver]", outputs: { cuiResizeObserver: "cuiResizeObserver" }, ngImport: i0 });
275
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, decorators: [{
276
- type: Directive,
277
- args: [{
278
- standalone: true,
279
- selector: '[cuiResizeObserver]'
280
- }]
281
- }], propDecorators: { cuiResizeObserver: [{
282
- type: Output
255
+ class CuiDimensionsObserverDirective {
256
+ constructor() {
257
+ this.element = inject(ElementRef).nativeElement;
258
+ this.observer = new ResizeObserver((entries) => {
259
+ entries.forEach(() => this.cuiResizeObserver.emit({
260
+ width: this.element.offsetWidth,
261
+ height: this.element.offsetHeight
262
+ }));
263
+ });
264
+ this.cuiResizeObserver = new EventEmitter();
265
+ }
266
+ ngOnInit() {
267
+ this.observer.observe(this.element);
268
+ }
269
+ ngOnDestroy() {
270
+ this.observer.disconnect();
271
+ }
272
+ }
273
+ CuiDimensionsObserverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
274
+ CuiDimensionsObserverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiDimensionsObserverDirective, isStandalone: true, selector: "[cuiResizeObserver]", outputs: { cuiResizeObserver: "cuiResizeObserver" }, ngImport: i0 });
275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, decorators: [{
276
+ type: Directive,
277
+ args: [{
278
+ standalone: true,
279
+ selector: '[cuiResizeObserver]'
280
+ }]
281
+ }], propDecorators: { cuiResizeObserver: [{
282
+ type: Output
283
283
  }] } });
284
284
 
285
- class CuiContentEditableValueAccessorDirective {
286
- constructor() {
287
- this.element = inject(ElementRef).nativeElement;
288
- }
289
- writeValue(value) {
290
- this.element.innerText = value !== null && value !== void 0 ? value : '';
291
- }
292
- registerOnChange(fn) {
293
- this.onChange = fn;
294
- }
295
- registerOnTouched(fn) {
296
- this.onTouched = fn;
297
- }
298
- setDisabledState(isDisabled) {
299
- this.element.contentEditable = String(!isDisabled);
300
- }
301
- onInput() {
302
- this.onChange(this.element.innerHTML === '<br>' ? '' : this.element.innerText);
303
- }
304
- onBlur() {
305
- this.onTouched();
306
- }
307
- }
308
- CuiContentEditableValueAccessorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
309
- CuiContentEditableValueAccessorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiContentEditableValueAccessorDirective, isStandalone: true, selector: "[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]", host: { listeners: { "input": "onInput()", "blur": "onBlur()" } }, providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)], ngImport: i0 });
310
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, decorators: [{
311
- type: Directive,
312
- args: [{
313
- standalone: true,
314
- selector: '[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]',
315
- providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)]
316
- }]
317
- }], propDecorators: { onInput: [{
318
- type: HostListener,
319
- args: ['input']
320
- }], onBlur: [{
321
- type: HostListener,
322
- args: ['blur']
285
+ class CuiContentEditableValueAccessorDirective {
286
+ constructor() {
287
+ this.element = inject(ElementRef).nativeElement;
288
+ }
289
+ writeValue(value) {
290
+ this.element.innerText = value !== null && value !== void 0 ? value : '';
291
+ }
292
+ registerOnChange(fn) {
293
+ this.onChange = fn;
294
+ }
295
+ registerOnTouched(fn) {
296
+ this.onTouched = fn;
297
+ }
298
+ setDisabledState(isDisabled) {
299
+ this.element.contentEditable = String(!isDisabled);
300
+ }
301
+ onInput() {
302
+ this.onChange(this.element.innerHTML === '<br>' ? '' : this.element.innerText);
303
+ }
304
+ onBlur() {
305
+ this.onTouched();
306
+ }
307
+ }
308
+ CuiContentEditableValueAccessorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
309
+ CuiContentEditableValueAccessorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiContentEditableValueAccessorDirective, isStandalone: true, selector: "[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]", host: { listeners: { "input": "onInput()", "blur": "onBlur()" } }, providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)], ngImport: i0 });
310
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, decorators: [{
311
+ type: Directive,
312
+ args: [{
313
+ standalone: true,
314
+ selector: '[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]',
315
+ providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)]
316
+ }]
317
+ }], propDecorators: { onInput: [{
318
+ type: HostListener,
319
+ args: ['input']
320
+ }], onBlur: [{
321
+ type: HostListener,
322
+ args: ['blur']
323
323
  }] } });
324
324
 
325
- class CuiElementDirective {
326
- constructor() {
327
- this.nativeElement = inject((ElementRef)).nativeElement;
328
- return new ElementRef(this.nativeElement);
329
- }
330
- }
331
- CuiElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
332
- CuiElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiElementDirective, isStandalone: true, selector: "[cuiElement]", exportAs: ["elementRef"], ngImport: i0 });
333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, decorators: [{
334
- type: Directive,
335
- args: [{
336
- standalone: true,
337
- selector: '[cuiElement]',
338
- exportAs: 'elementRef',
339
- }]
325
+ class CuiElementDirective {
326
+ constructor() {
327
+ this.nativeElement = inject((ElementRef)).nativeElement;
328
+ return new ElementRef(this.nativeElement);
329
+ }
330
+ }
331
+ CuiElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
332
+ CuiElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiElementDirective, isStandalone: true, selector: "[cuiElement]", exportAs: ["elementRef"], ngImport: i0 });
333
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, decorators: [{
334
+ type: Directive,
335
+ args: [{
336
+ standalone: true,
337
+ selector: '[cuiElement]',
338
+ exportAs: 'elementRef',
339
+ }]
340
340
  }], ctorParameters: function () { return []; } });
341
341
 
342
- function cuiContainsOrAfter(current, node) {
343
- try {
344
- return (current.contains(node) ||
345
- !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING));
346
- }
347
- catch (_a) {
348
- return false;
349
- }
342
+ function cuiContainsOrAfter(current, node) {
343
+ try {
344
+ return (current.contains(node) ||
345
+ !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING));
346
+ }
347
+ catch (_a) {
348
+ return false;
349
+ }
350
350
  }
351
351
 
352
- function cuiIsHTMLElement(node) {
353
- return !!node && node instanceof node.ownerDocument.defaultView.HTMLElement;
352
+ function cuiIsHTMLElement(node) {
353
+ return !!node && node instanceof node.ownerDocument.defaultView.HTMLElement;
354
354
  }
355
355
 
356
- function cuiGetNativeFocused({ activeElement }) {
357
- if (!(activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot)) {
358
- return activeElement;
359
- }
360
- let element = activeElement.shadowRoot.activeElement;
361
- while (element === null || element === void 0 ? void 0 : element.shadowRoot) {
362
- element = element.shadowRoot.activeElement;
363
- }
364
- return element;
356
+ function cuiGetNativeFocused({ activeElement }) {
357
+ if (!(activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot)) {
358
+ return activeElement;
359
+ }
360
+ let element = activeElement.shadowRoot.activeElement;
361
+ while (element === null || element === void 0 ? void 0 : element.shadowRoot) {
362
+ element = element.shadowRoot.activeElement;
363
+ }
364
+ return element;
365
365
  }
366
366
 
367
- function cuiBlurNativeFocused(document) {
368
- const activeElement = cuiGetNativeFocused(document);
369
- if (cuiIsHTMLElement(activeElement)) {
370
- activeElement.blur();
371
- }
367
+ function cuiBlurNativeFocused(document) {
368
+ const activeElement = cuiGetNativeFocused(document);
369
+ if (cuiIsHTMLElement(activeElement)) {
370
+ activeElement.blur();
371
+ }
372
372
  }
373
373
 
374
- function cuiIsNativeKeyboardFocusable(element) {
375
- if (element.hasAttribute('disabled') || element.getAttribute('tabIndex') === '-1') {
376
- return false;
377
- }
378
- if ((cuiIsHTMLElement(element) && element.isContentEditable) ||
379
- element.getAttribute('tabIndex') === '0') {
380
- return true;
381
- }
382
- switch (element.tagName) {
383
- case 'BUTTON':
384
- case 'SELECT':
385
- case 'TEXTAREA':
386
- return true;
387
- case 'VIDEO':
388
- case 'AUDIO':
389
- return element.hasAttribute('controls');
390
- case 'INPUT':
391
- return element.getAttribute('type') !== 'hidden';
392
- case 'A':
393
- case 'LINK':
394
- return element.hasAttribute('href');
395
- default:
396
- return false;
397
- }
374
+ function cuiIsNativeKeyboardFocusable(element) {
375
+ if (element.hasAttribute('disabled') || element.getAttribute('tabIndex') === '-1') {
376
+ return false;
377
+ }
378
+ if ((cuiIsHTMLElement(element) && element.isContentEditable) ||
379
+ element.getAttribute('tabIndex') === '0') {
380
+ return true;
381
+ }
382
+ switch (element.tagName) {
383
+ case 'BUTTON':
384
+ case 'SELECT':
385
+ case 'TEXTAREA':
386
+ return true;
387
+ case 'VIDEO':
388
+ case 'AUDIO':
389
+ return element.hasAttribute('controls');
390
+ case 'INPUT':
391
+ return element.getAttribute('type') !== 'hidden';
392
+ case 'A':
393
+ case 'LINK':
394
+ return element.hasAttribute('href');
395
+ default:
396
+ return false;
397
+ }
398
398
  }
399
399
 
400
- function cuiIsNativeMouseFocusable(element) {
401
- return (!element.hasAttribute('disabled') &&
402
- (element.getAttribute('tabIndex') === '-1' ||
403
- cuiIsNativeKeyboardFocusable(element)));
400
+ function cuiIsNativeMouseFocusable(element) {
401
+ return (!element.hasAttribute('disabled') &&
402
+ (element.getAttribute('tabIndex') === '-1' ||
403
+ cuiIsNativeKeyboardFocusable(element)));
404
404
  }
405
405
 
406
- function cuiGetClosestFocusable({ initial, root, previous = false, keyboard = true, }) {
407
- if (!root.ownerDocument) {
408
- return null;
409
- }
410
- const check = keyboard ? cuiIsNativeKeyboardFocusable : cuiIsNativeMouseFocusable;
411
- const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
412
- treeWalker.currentNode = initial;
413
- while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {
414
- if (cuiIsHTMLElement(treeWalker.currentNode)) {
415
- initial = treeWalker.currentNode;
416
- }
417
- if (cuiIsHTMLElement(initial) && check(initial)) {
418
- return initial;
419
- }
420
- }
421
- return null;
406
+ function cuiGetClosestFocusable({ initial, root, previous = false, keyboard = true, }) {
407
+ if (!root.ownerDocument) {
408
+ return null;
409
+ }
410
+ const check = keyboard ? cuiIsNativeKeyboardFocusable : cuiIsNativeMouseFocusable;
411
+ const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
412
+ treeWalker.currentNode = initial;
413
+ while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {
414
+ if (cuiIsHTMLElement(treeWalker.currentNode)) {
415
+ initial = treeWalker.currentNode;
416
+ }
417
+ if (cuiIsHTMLElement(initial) && check(initial)) {
418
+ return initial;
419
+ }
420
+ }
421
+ return null;
422
422
  }
423
423
 
424
- class CuiFocusTrapDirective {
425
- constructor() {
426
- this.document = inject(DOCUMENT);
427
- this.element = inject(ElementRef).nativeElement;
428
- this.activeElement = cuiGetNativeFocused(this.document);
429
- this.tabIndex = 0;
430
- this.initElementFocus();
431
- }
432
- ngOnDestroy() {
433
- cuiBlurNativeFocused(this.document);
434
- Promise.resolve().then(() => {
435
- if (!cuiIsHTMLElement(this.activeElement)) {
436
- return;
437
- }
438
- this.activeElement.focus();
439
- });
440
- }
441
- onFocusIn(node) {
442
- var _a;
443
- if (cuiContainsOrAfter(this.element, node)) {
444
- return;
445
- }
446
- (_a = cuiGetClosestFocusable({
447
- initial: this.element,
448
- root: this.element,
449
- })) === null || _a === void 0 ? void 0 : _a.focus();
450
- }
451
- initElementFocus() {
452
- Promise.resolve().then(() => this.element.focus());
453
- }
454
- }
455
- CuiFocusTrapDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
456
- CuiFocusTrapDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiFocusTrapDirective, isStandalone: true, selector: "[cuiFocusTrap]", host: { listeners: { "window:focusin": "onFocusIn($event.target)" }, properties: { "tabIndex": "this.tabIndex" } }, ngImport: i0 });
457
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, decorators: [{
458
- type: Directive,
459
- args: [{
460
- standalone: true,
461
- selector: '[cuiFocusTrap]',
462
- }]
463
- }], ctorParameters: function () { return []; }, propDecorators: { tabIndex: [{
464
- type: HostBinding,
465
- args: ['tabIndex']
466
- }], onFocusIn: [{
467
- type: HostListener,
468
- args: ['window:focusin', ['$event.target']]
424
+ class CuiFocusTrapDirective {
425
+ constructor() {
426
+ this.document = inject(DOCUMENT);
427
+ this.element = inject(ElementRef).nativeElement;
428
+ this.activeElement = cuiGetNativeFocused(this.document);
429
+ this.tabIndex = 0;
430
+ this.initElementFocus();
431
+ }
432
+ ngOnDestroy() {
433
+ cuiBlurNativeFocused(this.document);
434
+ Promise.resolve().then(() => {
435
+ if (!cuiIsHTMLElement(this.activeElement)) {
436
+ return;
437
+ }
438
+ this.activeElement.focus();
439
+ });
440
+ }
441
+ onFocusIn(node) {
442
+ var _a;
443
+ if (cuiContainsOrAfter(this.element, node)) {
444
+ return;
445
+ }
446
+ (_a = cuiGetClosestFocusable({
447
+ initial: this.element,
448
+ root: this.element,
449
+ })) === null || _a === void 0 ? void 0 : _a.focus();
450
+ }
451
+ initElementFocus() {
452
+ Promise.resolve().then(() => this.element.focus());
453
+ }
454
+ }
455
+ CuiFocusTrapDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
456
+ CuiFocusTrapDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiFocusTrapDirective, isStandalone: true, selector: "[cuiFocusTrap]", host: { listeners: { "window:focusin": "onFocusIn($event.target)" }, properties: { "tabIndex": "this.tabIndex" } }, ngImport: i0 });
457
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, decorators: [{
458
+ type: Directive,
459
+ args: [{
460
+ standalone: true,
461
+ selector: '[cuiFocusTrap]',
462
+ }]
463
+ }], ctorParameters: function () { return []; }, propDecorators: { tabIndex: [{
464
+ type: HostBinding,
465
+ args: ['tabIndex']
466
+ }], onFocusIn: [{
467
+ type: HostListener,
468
+ args: ['window:focusin', ['$event.target']]
469
469
  }] } });
470
470
 
471
- class CuiItemDirective {
472
- }
473
- CuiItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
474
- CuiItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiItemDirective, isStandalone: true, selector: "[cuiItem]", ngImport: i0 });
475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, decorators: [{
476
- type: Directive,
477
- args: [{
478
- standalone: true,
479
- selector: '[cuiItem]'
480
- }]
471
+ class CuiItemDirective {
472
+ }
473
+ CuiItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
474
+ CuiItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiItemDirective, isStandalone: true, selector: "[cuiItem]", ngImport: i0 });
475
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, decorators: [{
476
+ type: Directive,
477
+ args: [{
478
+ standalone: true,
479
+ selector: '[cuiItem]'
480
+ }]
481
481
  }] });
482
482
 
483
- class CuiLetContext {
484
- constructor(internalDirectiveInstance) {
485
- this.internalDirectiveInstance = internalDirectiveInstance;
486
- }
487
- get $implicit() {
488
- return this.internalDirectiveInstance.cuiLet;
489
- }
490
- get cuiLet() {
491
- return this.internalDirectiveInstance.cuiLet;
492
- }
483
+ class CuiLetContext {
484
+ constructor(internalDirectiveInstance) {
485
+ this.internalDirectiveInstance = internalDirectiveInstance;
486
+ }
487
+ get $implicit() {
488
+ return this.internalDirectiveInstance.cuiLet;
489
+ }
490
+ get cuiLet() {
491
+ return this.internalDirectiveInstance.cuiLet;
492
+ }
493
493
  }
494
494
 
495
- class CuiLetDirective {
496
- constructor() {
497
- inject(ViewContainerRef).createEmbeddedView(inject((TemplateRef)), new CuiLetContext(this));
498
- }
499
- static ngTemplateContextGuard(_dir, _ctx) {
500
- return true;
501
- }
502
- }
503
- CuiLetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
504
- CuiLetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiLetDirective, isStandalone: true, selector: "[cuiLet]", inputs: { cuiLet: "cuiLet" }, ngImport: i0 });
505
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, decorators: [{
506
- type: Directive,
507
- args: [{
508
- standalone: true,
509
- selector: '[cuiLet]'
510
- }]
511
- }], ctorParameters: function () { return []; }, propDecorators: { cuiLet: [{
512
- type: Input
495
+ class CuiLetDirective {
496
+ constructor() {
497
+ inject(ViewContainerRef).createEmbeddedView(inject((TemplateRef)), new CuiLetContext(this));
498
+ }
499
+ static ngTemplateContextGuard(_dir, _ctx) {
500
+ return true;
501
+ }
502
+ }
503
+ CuiLetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
504
+ CuiLetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiLetDirective, isStandalone: true, selector: "[cuiLet]", inputs: { cuiLet: "cuiLet" }, ngImport: i0 });
505
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, decorators: [{
506
+ type: Directive,
507
+ args: [{
508
+ standalone: true,
509
+ selector: '[cuiLet]'
510
+ }]
511
+ }], ctorParameters: function () { return []; }, propDecorators: { cuiLet: [{
512
+ type: Input
513
513
  }] } });
514
514
 
515
- class CuiTargetDirective {
516
- constructor() {
517
- this.clickListener = (event) => {
518
- this.clicked.emit(event);
519
- };
520
- this.clicked = new EventEmitter();
521
- }
522
- ngOnInit() {
523
- this.initClickListener();
524
- }
525
- ngOnDestroy() {
526
- this.destroyClickListener();
527
- }
528
- initClickListener() {
529
- this.ccTarget.addEventListener('click', this.clickListener);
530
- }
531
- destroyClickListener() {
532
- this.ccTarget.removeEventListener('click', this.clickListener);
533
- }
534
- }
535
- CuiTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
536
- CuiTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiTargetDirective, isStandalone: true, selector: "[ccTarget]", inputs: { ccTarget: "ccTarget" }, outputs: { clicked: "clicked" }, ngImport: i0 });
537
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, decorators: [{
538
- type: Directive,
539
- args: [{
540
- standalone: true,
541
- selector: '[ccTarget]',
542
- }]
543
- }], propDecorators: { ccTarget: [{
544
- type: Input
545
- }], clicked: [{
546
- type: Output
515
+ class CuiTargetDirective {
516
+ constructor() {
517
+ this.clickListener = (event) => {
518
+ this.clicked.emit(event);
519
+ };
520
+ this.clicked = new EventEmitter();
521
+ }
522
+ ngOnInit() {
523
+ this.initClickListener();
524
+ }
525
+ ngOnDestroy() {
526
+ this.destroyClickListener();
527
+ }
528
+ initClickListener() {
529
+ this.ccTarget.addEventListener('click', this.clickListener);
530
+ }
531
+ destroyClickListener() {
532
+ this.ccTarget.removeEventListener('click', this.clickListener);
533
+ }
534
+ }
535
+ CuiTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
536
+ CuiTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiTargetDirective, isStandalone: true, selector: "[ccTarget]", inputs: { ccTarget: "ccTarget" }, outputs: { clicked: "clicked" }, ngImport: i0 });
537
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, decorators: [{
538
+ type: Directive,
539
+ args: [{
540
+ standalone: true,
541
+ selector: '[ccTarget]',
542
+ }]
543
+ }], propDecorators: { ccTarget: [{
544
+ type: Input
545
+ }], clicked: [{
546
+ type: Output
547
547
  }] } });
548
548
 
549
- class CuiFilterPipe {
550
- transform(items, matcher, ...args) {
551
- return items.filter(item => matcher(item, ...args));
552
- }
553
- }
554
- CuiFilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
555
- CuiFilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, isStandalone: true, name: "cuiFilter" });
556
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, decorators: [{
557
- type: Pipe,
558
- args: [{
559
- standalone: true,
560
- name: 'cuiFilter'
561
- }]
549
+ class CuiFilterPipe {
550
+ transform(items, matcher, ...args) {
551
+ return items.filter(item => matcher(item, ...args));
552
+ }
553
+ }
554
+ CuiFilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
555
+ CuiFilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, isStandalone: true, name: "cuiFilter" });
556
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, decorators: [{
557
+ type: Pipe,
558
+ args: [{
559
+ standalone: true,
560
+ name: 'cuiFilter'
561
+ }]
562
562
  }] });
563
563
 
564
- /**
565
- * Generated bundle index. Do not edit.
564
+ /**
565
+ * Generated bundle index. Do not edit.
566
566
  */
567
567
 
568
568
  export { CUI_HISTORY, CUI_LOCAL_STORAGE, CUI_SESSION_STORAGE, CUI_WINDOW, CuiAutoResizingDirective, CuiClickOutsideDirective, CuiContentEditableValueAccessorDirective, CuiDestroyService, CuiDimensionsObserverDirective, CuiElementDirective, CuiFilterPipe, CuiFocusTrapDirective, CuiIdService, CuiItemDirective, CuiLetContext, CuiLetDirective, CuiPopoverService, CuiTargetDirective, CuiTime, cuiBlurNativeFocused, cuiContainsOrAfter, cuiCreateToken, cuiCreateTokenFromFactory, cuiGetClosestFocusable, cuiGetNativeFocused, cuiIsHTMLElement, cuiIsNativeKeyboardFocusable, cuiIsNativeMouseFocusable, cuiProvide, svgNodeFilter };