@cuby-ui/cdk 0.0.157 → 0.0.158

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 +67 -67
  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 +500 -500
  70. package/fesm2015/cuby-ui-cdk.mjs.map +1 -1
  71. package/fesm2020/cuby-ui-cdk.mjs +507 -507
  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?.startsWith('HH:MM:SS.MSS') || (!mode && this.ms > 0);
62
- const needAddSeconds = needAddMs || 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?.startsWith('HH:MM:SS.MSS') || (!mode && this.ms > 0);
62
+ const needAddSeconds = needAddMs || 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,466 +109,466 @@ 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 = {
150
- ...this.options,
151
- ...options,
152
- $implicit: observer,
153
- id: this.cuiIdService.generate(),
154
- component: this.component,
155
- content: content,
156
- completeWith: (result) => {
157
- observer.next(result);
158
- observer.complete();
159
- },
160
- };
161
- this.items$.next([...this.items$.value, item]);
162
- return () => {
163
- this.items$.next(this.items$.value.filter(value => value !== item));
164
- };
165
- });
166
- }
167
- }
168
- CuiPopoverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
169
- CuiPopoverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService });
170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, decorators: [{
171
- 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 = {
150
+ ...this.options,
151
+ ...options,
152
+ $implicit: observer,
153
+ id: this.cuiIdService.generate(),
154
+ component: this.component,
155
+ content: content,
156
+ completeWith: (result) => {
157
+ observer.next(result);
158
+ observer.complete();
159
+ },
160
+ };
161
+ this.items$.next([...this.items$.value, item]);
162
+ return () => {
163
+ this.items$.next(this.items$.value.filter(value => value !== item));
164
+ };
165
+ });
166
+ }
167
+ }
168
+ CuiPopoverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
169
+ CuiPopoverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService });
170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, decorators: [{
171
+ type: Injectable
172
172
  }], ctorParameters: function () { return [{ type: undefined }, { type: undefined }, { type: undefined }]; } });
173
173
 
174
- class CuiAutoResizingDirective {
175
- constructor() {
176
- this.window = inject(CUI_WINDOW);
177
- this.element = inject(ElementRef).nativeElement;
178
- this.ngControl = inject(NgControl, { self: true, optional: true });
179
- this.ngModel = inject(NgModel, { self: true, optional: true });
180
- this.destroy$ = inject(CuiDestroyService, { self: true });
181
- this.elementStyles = this.element.style;
182
- }
183
- ngOnInit() {
184
- this.initNgControlValueChangeSubscription();
185
- this.initNgModelValueChangeSubscription();
186
- }
187
- ngAfterViewInit() {
188
- this.resize();
189
- }
190
- onInput() {
191
- this.resize();
192
- }
193
- initNgControlValueChangeSubscription() {
194
- if (!this.ngControl) {
195
- return;
196
- }
197
- this.ngControl.valueChanges
198
- .pipe(takeUntil(this.destroy$))
199
- .subscribe(this.resize.bind(this));
200
- }
201
- initNgModelValueChangeSubscription() {
202
- if (!this.ngModel) {
203
- return;
204
- }
205
- this.ngModel.valueChanges
206
- .pipe(takeUntil(this.destroy$))
207
- .subscribe(this.resize.bind(this));
208
- }
209
- resize() {
210
- const computedMaxHeight = this.window.getComputedStyle(this.element).maxHeight;
211
- this.elementStyles.height = 'auto';
212
- this.elementStyles.height = this.element.scrollHeight + 'px';
213
- if (parseFloat(this.element.style.height) < parseFloat(computedMaxHeight)) {
214
- this.elementStyles.overflow = 'hidden';
215
- return;
216
- }
217
- this.elementStyles.overflowY = 'scroll';
218
- this.elementStyles.height = computedMaxHeight;
219
- }
220
- }
221
- CuiAutoResizingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
222
- 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 });
223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, decorators: [{
224
- type: Directive,
225
- args: [{
226
- standalone: true,
227
- selector: 'textarea[cuiAutoResizing]',
228
- providers: [CuiDestroyService]
229
- }]
230
- }], propDecorators: { onInput: [{
231
- type: HostListener,
232
- args: ['input']
174
+ class CuiAutoResizingDirective {
175
+ constructor() {
176
+ this.window = inject(CUI_WINDOW);
177
+ this.element = inject(ElementRef).nativeElement;
178
+ this.ngControl = inject(NgControl, { self: true, optional: true });
179
+ this.ngModel = inject(NgModel, { self: true, optional: true });
180
+ this.destroy$ = inject(CuiDestroyService, { self: true });
181
+ this.elementStyles = this.element.style;
182
+ }
183
+ ngOnInit() {
184
+ this.initNgControlValueChangeSubscription();
185
+ this.initNgModelValueChangeSubscription();
186
+ }
187
+ ngAfterViewInit() {
188
+ this.resize();
189
+ }
190
+ onInput() {
191
+ this.resize();
192
+ }
193
+ initNgControlValueChangeSubscription() {
194
+ if (!this.ngControl) {
195
+ return;
196
+ }
197
+ this.ngControl.valueChanges
198
+ .pipe(takeUntil(this.destroy$))
199
+ .subscribe(this.resize.bind(this));
200
+ }
201
+ initNgModelValueChangeSubscription() {
202
+ if (!this.ngModel) {
203
+ return;
204
+ }
205
+ this.ngModel.valueChanges
206
+ .pipe(takeUntil(this.destroy$))
207
+ .subscribe(this.resize.bind(this));
208
+ }
209
+ resize() {
210
+ const computedMaxHeight = this.window.getComputedStyle(this.element).maxHeight;
211
+ this.elementStyles.height = 'auto';
212
+ this.elementStyles.height = this.element.scrollHeight + 'px';
213
+ if (parseFloat(this.element.style.height) < parseFloat(computedMaxHeight)) {
214
+ this.elementStyles.overflow = 'hidden';
215
+ return;
216
+ }
217
+ this.elementStyles.overflowY = 'scroll';
218
+ this.elementStyles.height = computedMaxHeight;
219
+ }
220
+ }
221
+ CuiAutoResizingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
222
+ 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 });
223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, decorators: [{
224
+ type: Directive,
225
+ args: [{
226
+ standalone: true,
227
+ selector: 'textarea[cuiAutoResizing]',
228
+ providers: [CuiDestroyService]
229
+ }]
230
+ }], propDecorators: { onInput: [{
231
+ type: HostListener,
232
+ args: ['input']
233
233
  }] } });
234
234
 
235
- class CuiClickOutsideDirective {
236
- constructor() {
237
- this.element = inject(ElementRef).nativeElement;
238
- this.cuiClickOutside = new EventEmitter();
239
- }
240
- onClickOutside(target) {
241
- if (this.element.contains(target)) {
242
- return;
243
- }
244
- this.cuiClickOutside.emit(target);
245
- }
246
- }
247
- CuiClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
248
- 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 });
249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, decorators: [{
250
- type: Directive,
251
- args: [{
252
- standalone: true,
253
- selector: '(cuiClickOutside)'
254
- }]
255
- }], propDecorators: { cuiClickOutside: [{
256
- type: Output
257
- }], onClickOutside: [{
258
- type: HostListener,
259
- args: ['document:click', ['$event.target']]
235
+ class CuiClickOutsideDirective {
236
+ constructor() {
237
+ this.element = inject(ElementRef).nativeElement;
238
+ this.cuiClickOutside = new EventEmitter();
239
+ }
240
+ onClickOutside(target) {
241
+ if (this.element.contains(target)) {
242
+ return;
243
+ }
244
+ this.cuiClickOutside.emit(target);
245
+ }
246
+ }
247
+ CuiClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
248
+ 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 });
249
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, decorators: [{
250
+ type: Directive,
251
+ args: [{
252
+ standalone: true,
253
+ selector: '(cuiClickOutside)'
254
+ }]
255
+ }], propDecorators: { cuiClickOutside: [{
256
+ type: Output
257
+ }], onClickOutside: [{
258
+ type: HostListener,
259
+ args: ['document:click', ['$event.target']]
260
260
  }] } });
261
261
 
262
- class CuiDimensionsObserverDirective {
263
- constructor() {
264
- this.element = inject(ElementRef).nativeElement;
265
- this.observer = new ResizeObserver((entries) => {
266
- entries.forEach(() => this.cuiResizeObserver.emit({
267
- width: this.element.offsetWidth,
268
- height: this.element.offsetHeight
269
- }));
270
- });
271
- this.cuiResizeObserver = new EventEmitter();
272
- }
273
- ngOnInit() {
274
- this.observer.observe(this.element);
275
- }
276
- ngOnDestroy() {
277
- this.observer.disconnect();
278
- }
279
- }
280
- CuiDimensionsObserverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
281
- CuiDimensionsObserverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiDimensionsObserverDirective, isStandalone: true, selector: "[cuiResizeObserver]", outputs: { cuiResizeObserver: "cuiResizeObserver" }, ngImport: i0 });
282
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, decorators: [{
283
- type: Directive,
284
- args: [{
285
- standalone: true,
286
- selector: '[cuiResizeObserver]'
287
- }]
288
- }], propDecorators: { cuiResizeObserver: [{
289
- type: Output
262
+ class CuiDimensionsObserverDirective {
263
+ constructor() {
264
+ this.element = inject(ElementRef).nativeElement;
265
+ this.observer = new ResizeObserver((entries) => {
266
+ entries.forEach(() => this.cuiResizeObserver.emit({
267
+ width: this.element.offsetWidth,
268
+ height: this.element.offsetHeight
269
+ }));
270
+ });
271
+ this.cuiResizeObserver = new EventEmitter();
272
+ }
273
+ ngOnInit() {
274
+ this.observer.observe(this.element);
275
+ }
276
+ ngOnDestroy() {
277
+ this.observer.disconnect();
278
+ }
279
+ }
280
+ CuiDimensionsObserverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
281
+ CuiDimensionsObserverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiDimensionsObserverDirective, isStandalone: true, selector: "[cuiResizeObserver]", outputs: { cuiResizeObserver: "cuiResizeObserver" }, ngImport: i0 });
282
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, decorators: [{
283
+ type: Directive,
284
+ args: [{
285
+ standalone: true,
286
+ selector: '[cuiResizeObserver]'
287
+ }]
288
+ }], propDecorators: { cuiResizeObserver: [{
289
+ type: Output
290
290
  }] } });
291
291
 
292
- class CuiContentEditableValueAccessorDirective {
293
- constructor() {
294
- this.element = inject(ElementRef).nativeElement;
295
- }
296
- writeValue(value) {
297
- this.element.innerText = value ?? '';
298
- }
299
- registerOnChange(fn) {
300
- this.onChange = fn;
301
- }
302
- registerOnTouched(fn) {
303
- this.onTouched = fn;
304
- }
305
- setDisabledState(isDisabled) {
306
- this.element.contentEditable = String(!isDisabled);
307
- }
308
- onInput() {
309
- this.onChange(this.element.innerHTML === '<br>' ? '' : this.element.innerText);
310
- }
311
- onBlur() {
312
- this.onTouched();
313
- }
314
- }
315
- CuiContentEditableValueAccessorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
316
- 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 });
317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, decorators: [{
318
- type: Directive,
319
- args: [{
320
- standalone: true,
321
- selector: '[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]',
322
- providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)]
323
- }]
324
- }], propDecorators: { onInput: [{
325
- type: HostListener,
326
- args: ['input']
327
- }], onBlur: [{
328
- type: HostListener,
329
- args: ['blur']
292
+ class CuiContentEditableValueAccessorDirective {
293
+ constructor() {
294
+ this.element = inject(ElementRef).nativeElement;
295
+ }
296
+ writeValue(value) {
297
+ this.element.innerText = value ?? '';
298
+ }
299
+ registerOnChange(fn) {
300
+ this.onChange = fn;
301
+ }
302
+ registerOnTouched(fn) {
303
+ this.onTouched = fn;
304
+ }
305
+ setDisabledState(isDisabled) {
306
+ this.element.contentEditable = String(!isDisabled);
307
+ }
308
+ onInput() {
309
+ this.onChange(this.element.innerHTML === '<br>' ? '' : this.element.innerText);
310
+ }
311
+ onBlur() {
312
+ this.onTouched();
313
+ }
314
+ }
315
+ CuiContentEditableValueAccessorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
316
+ 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 });
317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, decorators: [{
318
+ type: Directive,
319
+ args: [{
320
+ standalone: true,
321
+ selector: '[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]',
322
+ providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)]
323
+ }]
324
+ }], propDecorators: { onInput: [{
325
+ type: HostListener,
326
+ args: ['input']
327
+ }], onBlur: [{
328
+ type: HostListener,
329
+ args: ['blur']
330
330
  }] } });
331
331
 
332
- class CuiElementDirective {
333
- constructor() {
334
- this.nativeElement = inject((ElementRef)).nativeElement;
335
- return new ElementRef(this.nativeElement);
336
- }
337
- }
338
- CuiElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
339
- CuiElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiElementDirective, isStandalone: true, selector: "[cuiElement]", exportAs: ["elementRef"], ngImport: i0 });
340
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, decorators: [{
341
- type: Directive,
342
- args: [{
343
- standalone: true,
344
- selector: '[cuiElement]',
345
- exportAs: 'elementRef',
346
- }]
332
+ class CuiElementDirective {
333
+ constructor() {
334
+ this.nativeElement = inject((ElementRef)).nativeElement;
335
+ return new ElementRef(this.nativeElement);
336
+ }
337
+ }
338
+ CuiElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
339
+ CuiElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiElementDirective, isStandalone: true, selector: "[cuiElement]", exportAs: ["elementRef"], ngImport: i0 });
340
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, decorators: [{
341
+ type: Directive,
342
+ args: [{
343
+ standalone: true,
344
+ selector: '[cuiElement]',
345
+ exportAs: 'elementRef',
346
+ }]
347
347
  }], ctorParameters: function () { return []; } });
348
348
 
349
- function cuiContainsOrAfter(current, node) {
350
- try {
351
- return (current.contains(node) ||
352
- !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING));
353
- }
354
- catch {
355
- return false;
356
- }
349
+ function cuiContainsOrAfter(current, node) {
350
+ try {
351
+ return (current.contains(node) ||
352
+ !!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING));
353
+ }
354
+ catch {
355
+ return false;
356
+ }
357
357
  }
358
358
 
359
- function cuiIsHTMLElement(node) {
360
- return !!node && node instanceof node.ownerDocument.defaultView.HTMLElement;
359
+ function cuiIsHTMLElement(node) {
360
+ return !!node && node instanceof node.ownerDocument.defaultView.HTMLElement;
361
361
  }
362
362
 
363
- function cuiGetNativeFocused({ activeElement }) {
364
- if (!activeElement?.shadowRoot) {
365
- return activeElement;
366
- }
367
- let element = activeElement.shadowRoot.activeElement;
368
- while (element?.shadowRoot) {
369
- element = element.shadowRoot.activeElement;
370
- }
371
- return element;
363
+ function cuiGetNativeFocused({ activeElement }) {
364
+ if (!activeElement?.shadowRoot) {
365
+ return activeElement;
366
+ }
367
+ let element = activeElement.shadowRoot.activeElement;
368
+ while (element?.shadowRoot) {
369
+ element = element.shadowRoot.activeElement;
370
+ }
371
+ return element;
372
372
  }
373
373
 
374
- function cuiBlurNativeFocused(document) {
375
- const activeElement = cuiGetNativeFocused(document);
376
- if (cuiIsHTMLElement(activeElement)) {
377
- activeElement.blur();
378
- }
374
+ function cuiBlurNativeFocused(document) {
375
+ const activeElement = cuiGetNativeFocused(document);
376
+ if (cuiIsHTMLElement(activeElement)) {
377
+ activeElement.blur();
378
+ }
379
379
  }
380
380
 
381
- function cuiIsNativeKeyboardFocusable(element) {
382
- if (element.hasAttribute('disabled') || element.getAttribute('tabIndex') === '-1') {
383
- return false;
384
- }
385
- if ((cuiIsHTMLElement(element) && element.isContentEditable) ||
386
- element.getAttribute('tabIndex') === '0') {
387
- return true;
388
- }
389
- switch (element.tagName) {
390
- case 'BUTTON':
391
- case 'SELECT':
392
- case 'TEXTAREA':
393
- return true;
394
- case 'VIDEO':
395
- case 'AUDIO':
396
- return element.hasAttribute('controls');
397
- case 'INPUT':
398
- return element.getAttribute('type') !== 'hidden';
399
- case 'A':
400
- case 'LINK':
401
- return element.hasAttribute('href');
402
- default:
403
- return false;
404
- }
381
+ function cuiIsNativeKeyboardFocusable(element) {
382
+ if (element.hasAttribute('disabled') || element.getAttribute('tabIndex') === '-1') {
383
+ return false;
384
+ }
385
+ if ((cuiIsHTMLElement(element) && element.isContentEditable) ||
386
+ element.getAttribute('tabIndex') === '0') {
387
+ return true;
388
+ }
389
+ switch (element.tagName) {
390
+ case 'BUTTON':
391
+ case 'SELECT':
392
+ case 'TEXTAREA':
393
+ return true;
394
+ case 'VIDEO':
395
+ case 'AUDIO':
396
+ return element.hasAttribute('controls');
397
+ case 'INPUT':
398
+ return element.getAttribute('type') !== 'hidden';
399
+ case 'A':
400
+ case 'LINK':
401
+ return element.hasAttribute('href');
402
+ default:
403
+ return false;
404
+ }
405
405
  }
406
406
 
407
- function cuiIsNativeMouseFocusable(element) {
408
- return (!element.hasAttribute('disabled') &&
409
- (element.getAttribute('tabIndex') === '-1' ||
410
- cuiIsNativeKeyboardFocusable(element)));
407
+ function cuiIsNativeMouseFocusable(element) {
408
+ return (!element.hasAttribute('disabled') &&
409
+ (element.getAttribute('tabIndex') === '-1' ||
410
+ cuiIsNativeKeyboardFocusable(element)));
411
411
  }
412
412
 
413
- function cuiGetClosestFocusable({ initial, root, previous = false, keyboard = true, }) {
414
- if (!root.ownerDocument) {
415
- return null;
416
- }
417
- const check = keyboard ? cuiIsNativeKeyboardFocusable : cuiIsNativeMouseFocusable;
418
- const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
419
- treeWalker.currentNode = initial;
420
- while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {
421
- if (cuiIsHTMLElement(treeWalker.currentNode)) {
422
- initial = treeWalker.currentNode;
423
- }
424
- if (cuiIsHTMLElement(initial) && check(initial)) {
425
- return initial;
426
- }
427
- }
428
- return null;
413
+ function cuiGetClosestFocusable({ initial, root, previous = false, keyboard = true, }) {
414
+ if (!root.ownerDocument) {
415
+ return null;
416
+ }
417
+ const check = keyboard ? cuiIsNativeKeyboardFocusable : cuiIsNativeMouseFocusable;
418
+ const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
419
+ treeWalker.currentNode = initial;
420
+ while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {
421
+ if (cuiIsHTMLElement(treeWalker.currentNode)) {
422
+ initial = treeWalker.currentNode;
423
+ }
424
+ if (cuiIsHTMLElement(initial) && check(initial)) {
425
+ return initial;
426
+ }
427
+ }
428
+ return null;
429
429
  }
430
430
 
431
- class CuiFocusTrapDirective {
432
- constructor() {
433
- this.document = inject(DOCUMENT);
434
- this.element = inject(ElementRef).nativeElement;
435
- this.activeElement = cuiGetNativeFocused(this.document);
436
- this.tabIndex = 0;
437
- this.initElementFocus();
438
- }
439
- ngOnDestroy() {
440
- cuiBlurNativeFocused(this.document);
441
- Promise.resolve().then(() => {
442
- if (!cuiIsHTMLElement(this.activeElement)) {
443
- return;
444
- }
445
- this.activeElement.focus();
446
- });
447
- }
448
- onFocusIn(node) {
449
- if (cuiContainsOrAfter(this.element, node)) {
450
- return;
451
- }
452
- cuiGetClosestFocusable({
453
- initial: this.element,
454
- root: this.element,
455
- })?.focus();
456
- }
457
- initElementFocus() {
458
- Promise.resolve().then(() => this.element.focus());
459
- }
460
- }
461
- CuiFocusTrapDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
462
- 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 });
463
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, decorators: [{
464
- type: Directive,
465
- args: [{
466
- standalone: true,
467
- selector: '[cuiFocusTrap]',
468
- }]
469
- }], ctorParameters: function () { return []; }, propDecorators: { tabIndex: [{
470
- type: HostBinding,
471
- args: ['tabIndex']
472
- }], onFocusIn: [{
473
- type: HostListener,
474
- args: ['window:focusin', ['$event.target']]
431
+ class CuiFocusTrapDirective {
432
+ constructor() {
433
+ this.document = inject(DOCUMENT);
434
+ this.element = inject(ElementRef).nativeElement;
435
+ this.activeElement = cuiGetNativeFocused(this.document);
436
+ this.tabIndex = 0;
437
+ this.initElementFocus();
438
+ }
439
+ ngOnDestroy() {
440
+ cuiBlurNativeFocused(this.document);
441
+ Promise.resolve().then(() => {
442
+ if (!cuiIsHTMLElement(this.activeElement)) {
443
+ return;
444
+ }
445
+ this.activeElement.focus();
446
+ });
447
+ }
448
+ onFocusIn(node) {
449
+ if (cuiContainsOrAfter(this.element, node)) {
450
+ return;
451
+ }
452
+ cuiGetClosestFocusable({
453
+ initial: this.element,
454
+ root: this.element,
455
+ })?.focus();
456
+ }
457
+ initElementFocus() {
458
+ Promise.resolve().then(() => this.element.focus());
459
+ }
460
+ }
461
+ CuiFocusTrapDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
462
+ 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 });
463
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, decorators: [{
464
+ type: Directive,
465
+ args: [{
466
+ standalone: true,
467
+ selector: '[cuiFocusTrap]',
468
+ }]
469
+ }], ctorParameters: function () { return []; }, propDecorators: { tabIndex: [{
470
+ type: HostBinding,
471
+ args: ['tabIndex']
472
+ }], onFocusIn: [{
473
+ type: HostListener,
474
+ args: ['window:focusin', ['$event.target']]
475
475
  }] } });
476
476
 
477
- class CuiItemDirective {
478
- }
479
- CuiItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
480
- CuiItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiItemDirective, isStandalone: true, selector: "[cuiItem]", ngImport: i0 });
481
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, decorators: [{
482
- type: Directive,
483
- args: [{
484
- standalone: true,
485
- selector: '[cuiItem]'
486
- }]
477
+ class CuiItemDirective {
478
+ }
479
+ CuiItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
480
+ CuiItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiItemDirective, isStandalone: true, selector: "[cuiItem]", ngImport: i0 });
481
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, decorators: [{
482
+ type: Directive,
483
+ args: [{
484
+ standalone: true,
485
+ selector: '[cuiItem]'
486
+ }]
487
487
  }] });
488
488
 
489
- class CuiLetContext {
490
- constructor(internalDirectiveInstance) {
491
- this.internalDirectiveInstance = internalDirectiveInstance;
492
- }
493
- get $implicit() {
494
- return this.internalDirectiveInstance.cuiLet;
495
- }
496
- get cuiLet() {
497
- return this.internalDirectiveInstance.cuiLet;
498
- }
489
+ class CuiLetContext {
490
+ constructor(internalDirectiveInstance) {
491
+ this.internalDirectiveInstance = internalDirectiveInstance;
492
+ }
493
+ get $implicit() {
494
+ return this.internalDirectiveInstance.cuiLet;
495
+ }
496
+ get cuiLet() {
497
+ return this.internalDirectiveInstance.cuiLet;
498
+ }
499
499
  }
500
500
 
501
- class CuiLetDirective {
502
- constructor() {
503
- inject(ViewContainerRef).createEmbeddedView(inject((TemplateRef)), new CuiLetContext(this));
504
- }
505
- static ngTemplateContextGuard(_dir, _ctx) {
506
- return true;
507
- }
508
- }
509
- CuiLetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
510
- CuiLetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiLetDirective, isStandalone: true, selector: "[cuiLet]", inputs: { cuiLet: "cuiLet" }, ngImport: i0 });
511
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, decorators: [{
512
- type: Directive,
513
- args: [{
514
- standalone: true,
515
- selector: '[cuiLet]'
516
- }]
517
- }], ctorParameters: function () { return []; }, propDecorators: { cuiLet: [{
518
- type: Input
501
+ class CuiLetDirective {
502
+ constructor() {
503
+ inject(ViewContainerRef).createEmbeddedView(inject((TemplateRef)), new CuiLetContext(this));
504
+ }
505
+ static ngTemplateContextGuard(_dir, _ctx) {
506
+ return true;
507
+ }
508
+ }
509
+ CuiLetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
510
+ CuiLetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiLetDirective, isStandalone: true, selector: "[cuiLet]", inputs: { cuiLet: "cuiLet" }, ngImport: i0 });
511
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, decorators: [{
512
+ type: Directive,
513
+ args: [{
514
+ standalone: true,
515
+ selector: '[cuiLet]'
516
+ }]
517
+ }], ctorParameters: function () { return []; }, propDecorators: { cuiLet: [{
518
+ type: Input
519
519
  }] } });
520
520
 
521
- class CuiTargetDirective {
522
- constructor() {
523
- this.clickListener = (event) => {
524
- this.clicked.emit(event);
525
- };
526
- this.clicked = new EventEmitter();
527
- }
528
- ngOnInit() {
529
- this.initClickListener();
530
- }
531
- ngOnDestroy() {
532
- this.destroyClickListener();
533
- }
534
- initClickListener() {
535
- this.ccTarget.addEventListener('click', this.clickListener);
536
- }
537
- destroyClickListener() {
538
- this.ccTarget.removeEventListener('click', this.clickListener);
539
- }
540
- }
541
- CuiTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
542
- 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 });
543
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, decorators: [{
544
- type: Directive,
545
- args: [{
546
- standalone: true,
547
- selector: '[ccTarget]',
548
- }]
549
- }], propDecorators: { ccTarget: [{
550
- type: Input
551
- }], clicked: [{
552
- type: Output
521
+ class CuiTargetDirective {
522
+ constructor() {
523
+ this.clickListener = (event) => {
524
+ this.clicked.emit(event);
525
+ };
526
+ this.clicked = new EventEmitter();
527
+ }
528
+ ngOnInit() {
529
+ this.initClickListener();
530
+ }
531
+ ngOnDestroy() {
532
+ this.destroyClickListener();
533
+ }
534
+ initClickListener() {
535
+ this.ccTarget.addEventListener('click', this.clickListener);
536
+ }
537
+ destroyClickListener() {
538
+ this.ccTarget.removeEventListener('click', this.clickListener);
539
+ }
540
+ }
541
+ CuiTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
542
+ 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 });
543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, decorators: [{
544
+ type: Directive,
545
+ args: [{
546
+ standalone: true,
547
+ selector: '[ccTarget]',
548
+ }]
549
+ }], propDecorators: { ccTarget: [{
550
+ type: Input
551
+ }], clicked: [{
552
+ type: Output
553
553
  }] } });
554
554
 
555
- class CuiFilterPipe {
556
- transform(items, matcher, ...args) {
557
- return items.filter(item => matcher(item, ...args));
558
- }
559
- }
560
- CuiFilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
561
- CuiFilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, isStandalone: true, name: "cuiFilter" });
562
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, decorators: [{
563
- type: Pipe,
564
- args: [{
565
- standalone: true,
566
- name: 'cuiFilter'
567
- }]
555
+ class CuiFilterPipe {
556
+ transform(items, matcher, ...args) {
557
+ return items.filter(item => matcher(item, ...args));
558
+ }
559
+ }
560
+ CuiFilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
561
+ CuiFilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, isStandalone: true, name: "cuiFilter" });
562
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, decorators: [{
563
+ type: Pipe,
564
+ args: [{
565
+ standalone: true,
566
+ name: 'cuiFilter'
567
+ }]
568
568
  }] });
569
569
 
570
- /**
571
- * Generated bundle index. Do not edit.
570
+ /**
571
+ * Generated bundle index. Do not edit.
572
572
  */
573
573
 
574
574
  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 };