@cuby-ui/cdk 0.0.167 → 0.0.169

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