@shival99/z-ui 1.0.1 → 1.0.3

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 (115) hide show
  1. package/README.md +50 -77
  2. package/assets/css/animations.css +207 -0
  3. package/assets/css/base.css +76 -0
  4. package/assets/css/tailwind.css +53 -0
  5. package/assets/css/themes/gray.css +73 -0
  6. package/assets/css/themes/green.css +75 -0
  7. package/assets/css/themes/hospital.css +79 -0
  8. package/assets/css/themes/neutral.css +73 -0
  9. package/assets/css/themes/orange.css +73 -0
  10. package/assets/css/themes/slate.css +73 -0
  11. package/assets/css/themes/stone.css +73 -0
  12. package/assets/css/themes/violet.css +73 -0
  13. package/assets/css/themes/zinc.css +73 -0
  14. package/assets/images/avatar.svg +6 -0
  15. package/assets/images/logo.svg +6 -0
  16. package/fesm2022/shival99-z-ui-components-z-accordion.mjs +148 -0
  17. package/fesm2022/shival99-z-ui-components-z-accordion.mjs.map +1 -0
  18. package/fesm2022/shival99-z-ui-components-z-breadcrumb.mjs +74 -0
  19. package/fesm2022/shival99-z-ui-components-z-breadcrumb.mjs.map +1 -0
  20. package/fesm2022/shival99-z-ui-components-z-button.mjs +155 -0
  21. package/fesm2022/shival99-z-ui-components-z-button.mjs.map +1 -0
  22. package/fesm2022/shival99-z-ui-components-z-calendar.mjs +2335 -0
  23. package/fesm2022/shival99-z-ui-components-z-calendar.mjs.map +1 -0
  24. package/fesm2022/shival99-z-ui-components-z-checkbox.mjs +240 -0
  25. package/fesm2022/shival99-z-ui-components-z-checkbox.mjs.map +1 -0
  26. package/fesm2022/shival99-z-ui-components-z-code.mjs +139 -0
  27. package/fesm2022/shival99-z-ui-components-z-code.mjs.map +1 -0
  28. package/fesm2022/shival99-z-ui-components-z-drawer.mjs +664 -0
  29. package/fesm2022/shival99-z-ui-components-z-drawer.mjs.map +1 -0
  30. package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs +55 -0
  31. package/fesm2022/shival99-z-ui-components-z-dropdown-menu.mjs.map +1 -0
  32. package/fesm2022/shival99-z-ui-components-z-editor.mjs +411 -0
  33. package/fesm2022/shival99-z-ui-components-z-editor.mjs.map +1 -0
  34. package/fesm2022/shival99-z-ui-components-z-filter.mjs +794 -0
  35. package/fesm2022/shival99-z-ui-components-z-filter.mjs.map +1 -0
  36. package/fesm2022/shival99-z-ui-components-z-icon.mjs +451 -0
  37. package/fesm2022/shival99-z-ui-components-z-icon.mjs.map +1 -0
  38. package/fesm2022/shival99-z-ui-components-z-input.mjs +804 -0
  39. package/fesm2022/shival99-z-ui-components-z-input.mjs.map +1 -0
  40. package/fesm2022/shival99-z-ui-components-z-loading.mjs +105 -0
  41. package/fesm2022/shival99-z-ui-components-z-loading.mjs.map +1 -0
  42. package/fesm2022/shival99-z-ui-components-z-menu.mjs +351 -0
  43. package/fesm2022/shival99-z-ui-components-z-menu.mjs.map +1 -0
  44. package/fesm2022/shival99-z-ui-components-z-modal.mjs +722 -0
  45. package/fesm2022/shival99-z-ui-components-z-modal.mjs.map +1 -0
  46. package/fesm2022/shival99-z-ui-components-z-pagination.mjs +131 -0
  47. package/fesm2022/shival99-z-ui-components-z-pagination.mjs.map +1 -0
  48. package/fesm2022/shival99-z-ui-components-z-popover.mjs +917 -0
  49. package/fesm2022/shival99-z-ui-components-z-popover.mjs.map +1 -0
  50. package/fesm2022/shival99-z-ui-components-z-radio.mjs +154 -0
  51. package/fesm2022/shival99-z-ui-components-z-radio.mjs.map +1 -0
  52. package/fesm2022/shival99-z-ui-components-z-select.mjs +998 -0
  53. package/fesm2022/shival99-z-ui-components-z-select.mjs.map +1 -0
  54. package/fesm2022/shival99-z-ui-components-z-skeleton.mjs +139 -0
  55. package/fesm2022/shival99-z-ui-components-z-skeleton.mjs.map +1 -0
  56. package/fesm2022/shival99-z-ui-components-z-switch.mjs +127 -0
  57. package/fesm2022/shival99-z-ui-components-z-switch.mjs.map +1 -0
  58. package/fesm2022/shival99-z-ui-components-z-table.mjs +2628 -0
  59. package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -0
  60. package/fesm2022/shival99-z-ui-components-z-tabs.mjs +259 -0
  61. package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +1 -0
  62. package/fesm2022/shival99-z-ui-components-z-timeline.mjs +335 -0
  63. package/fesm2022/shival99-z-ui-components-z-timeline.mjs.map +1 -0
  64. package/fesm2022/shival99-z-ui-components-z-toast.mjs +93 -0
  65. package/fesm2022/shival99-z-ui-components-z-toast.mjs.map +1 -0
  66. package/fesm2022/shival99-z-ui-components-z-tooltip.mjs +660 -0
  67. package/fesm2022/shival99-z-ui-components-z-tooltip.mjs.map +1 -0
  68. package/fesm2022/shival99-z-ui-components-z-upload.mjs +504 -0
  69. package/fesm2022/shival99-z-ui-components-z-upload.mjs.map +1 -0
  70. package/fesm2022/shival99-z-ui-i18n.mjs +258 -0
  71. package/fesm2022/shival99-z-ui-i18n.mjs.map +1 -0
  72. package/fesm2022/shival99-z-ui-pipes.mjs +116 -0
  73. package/fesm2022/shival99-z-ui-pipes.mjs.map +1 -0
  74. package/fesm2022/shival99-z-ui-providers.mjs +203 -0
  75. package/fesm2022/shival99-z-ui-providers.mjs.map +1 -0
  76. package/fesm2022/shival99-z-ui-services.mjs +919 -0
  77. package/fesm2022/shival99-z-ui-services.mjs.map +1 -0
  78. package/fesm2022/shival99-z-ui-utils.mjs +591 -0
  79. package/fesm2022/shival99-z-ui-utils.mjs.map +1 -0
  80. package/fesm2022/z-ui.mjs +3 -19924
  81. package/fesm2022/z-ui.mjs.map +1 -1
  82. package/package.json +132 -4
  83. package/types/shival99-z-ui-components-z-accordion.d.ts +55 -0
  84. package/types/shival99-z-ui-components-z-breadcrumb.d.ts +36 -0
  85. package/types/shival99-z-ui-components-z-button.d.ts +41 -0
  86. package/types/shival99-z-ui-components-z-calendar.d.ts +300 -0
  87. package/types/shival99-z-ui-components-z-checkbox.d.ts +84 -0
  88. package/types/shival99-z-ui-components-z-code.d.ts +35 -0
  89. package/types/shival99-z-ui-components-z-drawer.d.ts +232 -0
  90. package/types/shival99-z-ui-components-z-dropdown-menu.d.ts +50 -0
  91. package/types/shival99-z-ui-components-z-editor.d.ts +115 -0
  92. package/types/shival99-z-ui-components-z-filter.d.ts +268 -0
  93. package/types/shival99-z-ui-components-z-icon.d.ts +291 -0
  94. package/types/shival99-z-ui-components-z-input.d.ts +188 -0
  95. package/types/shival99-z-ui-components-z-loading.d.ts +46 -0
  96. package/types/shival99-z-ui-components-z-menu.d.ts +116 -0
  97. package/types/shival99-z-ui-components-z-modal.d.ts +270 -0
  98. package/types/shival99-z-ui-components-z-pagination.d.ts +52 -0
  99. package/types/shival99-z-ui-components-z-popover.d.ts +134 -0
  100. package/types/shival99-z-ui-components-z-radio.d.ts +63 -0
  101. package/types/shival99-z-ui-components-z-select.d.ts +268 -0
  102. package/types/shival99-z-ui-components-z-skeleton.d.ts +55 -0
  103. package/types/shival99-z-ui-components-z-switch.d.ts +48 -0
  104. package/types/shival99-z-ui-components-z-table.d.ts +482 -0
  105. package/types/shival99-z-ui-components-z-tabs.d.ts +75 -0
  106. package/types/shival99-z-ui-components-z-timeline.d.ts +98 -0
  107. package/types/shival99-z-ui-components-z-toast.d.ts +61 -0
  108. package/types/shival99-z-ui-components-z-tooltip.d.ts +85 -0
  109. package/types/shival99-z-ui-components-z-upload.d.ts +136 -0
  110. package/types/shival99-z-ui-i18n.d.ts +50 -0
  111. package/types/shival99-z-ui-pipes.d.ts +36 -0
  112. package/types/shival99-z-ui-providers.d.ts +132 -0
  113. package/types/shival99-z-ui-services.d.ts +364 -0
  114. package/types/shival99-z-ui-utils.d.ts +145 -0
  115. package/types/z-ui.d.ts +3 -4977
@@ -0,0 +1,917 @@
1
+ import { Overlay, OverlayPositionBuilder } from '@angular/cdk/overlay';
2
+ import { ComponentPortal } from '@angular/cdk/portal';
3
+ import { NgTemplateOutlet, DOCUMENT, isPlatformBrowser } from '@angular/common';
4
+ import * as i0 from '@angular/core';
5
+ import { signal, computed, ChangeDetectionStrategy, Component, input, output, viewChild, inject, Renderer2, DestroyRef, PLATFORM_ID, ElementRef, Directive } from '@angular/core';
6
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
7
+ import { zMergeClasses, zTransform } from '@shival99/z-ui/utils';
8
+ import { Subject, switchMap, of, timer, map, filter } from 'rxjs';
9
+ import { cva } from 'class-variance-authority';
10
+
11
+ const zPopoverVariants = cva([
12
+ 'z-popover relative z-[9999] rounded-[6px] shadow-md',
13
+ 'bg-popover text-popover-foreground border border-border',
14
+ 'z-animate-in z-fade-in z-duration-200',
15
+ ], {
16
+ variants: {
17
+ zPosition: {
18
+ top: 'z-slide-in-from-bottom-4',
19
+ 'top-left': 'z-slide-in-from-bottom-4',
20
+ 'top-right': 'z-slide-in-from-bottom-4',
21
+ bottom: 'z-slide-in-from-top-4',
22
+ 'bottom-left': 'z-slide-in-from-top-4',
23
+ 'bottom-right': 'z-slide-in-from-top-4',
24
+ left: 'z-slide-in-from-right-4',
25
+ 'left-top': 'z-slide-in-from-right-4',
26
+ 'left-bottom': 'z-slide-in-from-right-4',
27
+ right: 'z-slide-in-from-left-4',
28
+ 'right-top': 'z-slide-in-from-left-4',
29
+ 'right-bottom': 'z-slide-in-from-left-4',
30
+ },
31
+ },
32
+ defaultVariants: {
33
+ zPosition: 'bottom',
34
+ },
35
+ });
36
+ const zPopoverExitVariants = cva('z-animate-out z-fade-out z-duration-200', {
37
+ variants: {
38
+ zPosition: {
39
+ top: 'z-slide-out-to-bottom-4',
40
+ 'top-left': 'z-slide-out-to-bottom-4',
41
+ 'top-right': 'z-slide-out-to-bottom-4',
42
+ bottom: 'z-slide-out-to-top-4',
43
+ 'bottom-left': 'z-slide-out-to-top-4',
44
+ 'bottom-right': 'z-slide-out-to-top-4',
45
+ left: 'z-slide-out-to-right-4',
46
+ 'left-top': 'z-slide-out-to-right-4',
47
+ 'left-bottom': 'z-slide-out-to-right-4',
48
+ right: 'z-slide-out-to-left-4',
49
+ 'right-top': 'z-slide-out-to-left-4',
50
+ 'right-bottom': 'z-slide-out-to-left-4',
51
+ },
52
+ },
53
+ defaultVariants: {
54
+ zPosition: 'bottom',
55
+ },
56
+ });
57
+ const zPopoverContentVariants = cva('relative z-10 rounded-[6px] bg-popover', {
58
+ variants: {},
59
+ defaultVariants: {},
60
+ });
61
+ const zPopoverArrowVariants = cva('absolute z-0 size-2.5 rotate-45 rounded-[2px] bg-popover', {
62
+ variants: {
63
+ position: {
64
+ top: '-bottom-1 left-1/2 -translate-x-1/2 border-r border-b border-border',
65
+ 'top-left': '-bottom-1 left-3 border-r border-b border-border',
66
+ 'top-right': '-bottom-1 right-3 border-r border-b border-border',
67
+ bottom: '-top-1 left-1/2 -translate-x-1/2 border-l border-t border-border',
68
+ 'bottom-left': '-top-1 left-3 border-l border-t border-border',
69
+ 'bottom-right': '-top-1 right-3 border-l border-t border-border',
70
+ left: 'top-1/2 -translate-y-1/2 -right-1 border-t border-r border-border',
71
+ 'left-top': 'top-2 -right-1 border-t border-r border-border',
72
+ 'left-bottom': 'bottom-2 -right-1 border-t border-r border-border',
73
+ right: 'top-1/2 -translate-y-1/2 -left-1 border-b border-l border-border',
74
+ 'right-top': 'top-2 -left-1 border-b border-l border-border',
75
+ 'right-bottom': 'bottom-2 -left-1 border-b border-l border-border',
76
+ },
77
+ },
78
+ defaultVariants: {
79
+ position: 'bottom',
80
+ },
81
+ });
82
+
83
+ class ZPopoverContentComponent {
84
+ content = signal(null, ...(ngDevMode ? [{ debugName: "content" }] : []));
85
+ position = signal('bottom', ...(ngDevMode ? [{ debugName: "position" }] : []));
86
+ popoverClass = signal('', ...(ngDevMode ? [{ debugName: "popoverClass" }] : []));
87
+ state = signal('open', ...(ngDevMode ? [{ debugName: "state" }] : []));
88
+ closeHandler = signal(() => { }, ...(ngDevMode ? [{ debugName: "closeHandler" }] : []));
89
+ showArrow = signal(false, ...(ngDevMode ? [{ debugName: "showArrow" }] : []));
90
+ arrowOffset = signal(0, ...(ngDevMode ? [{ debugName: "arrowOffset" }] : []));
91
+ context = computed(() => ({
92
+ close: this.closeHandler(),
93
+ }), ...(ngDevMode ? [{ debugName: "context" }] : []));
94
+ classes = computed(() => {
95
+ const baseClasses = zPopoverVariants({
96
+ zPosition: this.position(),
97
+ });
98
+ const exitClasses = this.state() === 'closed' ? zPopoverExitVariants({ zPosition: this.position() }) : '';
99
+ return zMergeClasses(baseClasses, exitClasses, this.popoverClass());
100
+ }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
101
+ contentClasses = computed(() => zMergeClasses(zPopoverContentVariants({})), ...(ngDevMode ? [{ debugName: "contentClasses" }] : []));
102
+ arrowClasses = computed(() => zMergeClasses(zPopoverArrowVariants({
103
+ position: this.position(),
104
+ })), ...(ngDevMode ? [{ debugName: "arrowClasses" }] : []));
105
+ arrowStyle = computed(() => {
106
+ const pos = this.position();
107
+ const offset = this.arrowOffset();
108
+ const isCornerPosition = pos.includes('-');
109
+ if (isCornerPosition) {
110
+ return {};
111
+ }
112
+ if (offset === 0) {
113
+ return {};
114
+ }
115
+ if (pos === 'top' || pos === 'bottom') {
116
+ return {
117
+ left: `calc(50% + ${offset}px)`,
118
+ };
119
+ }
120
+ if (pos === 'left' || pos === 'right') {
121
+ return {
122
+ top: `calc(50% + ${offset}px)`,
123
+ };
124
+ }
125
+ return {};
126
+ }, ...(ngDevMode ? [{ debugName: "arrowStyle" }] : []));
127
+ setProps(config) {
128
+ this.content.set(config.content);
129
+ this.position.set(config.position);
130
+ if (config.customClass) {
131
+ this.popoverClass.set(config.customClass);
132
+ }
133
+ if (config.onClose) {
134
+ this.closeHandler.set(config.onClose);
135
+ }
136
+ if (config.showArrow !== undefined) {
137
+ this.showArrow.set(config.showArrow);
138
+ }
139
+ }
140
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZPopoverContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
141
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ZPopoverContentComponent, isStandalone: true, selector: "z-popover-content", host: { properties: { "class": "classes()", "attr.data-state": "state()", "attr.data-position": "position()" } }, ngImport: i0, template: `
142
+ <!-- Arrow layer - rotated square, partial border -->
143
+ @if (showArrow()) {
144
+ <div [class]="arrowClasses()" [style]="arrowStyle()"></div>
145
+ }
146
+
147
+ <!-- Content -->
148
+ <div [class]="contentClasses()">
149
+ <ng-container
150
+ [ngTemplateOutlet]="content()"
151
+ [ngTemplateOutletContext]="{ $implicit: context(), close: context().close }"
152
+ />
153
+ </div>
154
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
155
+ }
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZPopoverContentComponent, decorators: [{
157
+ type: Component,
158
+ args: [{
159
+ selector: 'z-popover-content',
160
+ imports: [NgTemplateOutlet],
161
+ standalone: true,
162
+ template: `
163
+ <!-- Arrow layer - rotated square, partial border -->
164
+ @if (showArrow()) {
165
+ <div [class]="arrowClasses()" [style]="arrowStyle()"></div>
166
+ }
167
+
168
+ <!-- Content -->
169
+ <div [class]="contentClasses()">
170
+ <ng-container
171
+ [ngTemplateOutlet]="content()"
172
+ [ngTemplateOutletContext]="{ $implicit: context(), close: context().close }"
173
+ />
174
+ </div>
175
+ `,
176
+ changeDetection: ChangeDetectionStrategy.OnPush,
177
+ host: {
178
+ '[class]': 'classes()',
179
+ '[attr.data-state]': 'state()',
180
+ '[attr.data-position]': 'position()',
181
+ },
182
+ }]
183
+ }] });
184
+
185
+ function createPopoverPosition(position, offset) {
186
+ const positions = {
187
+ top: {
188
+ originX: 'center',
189
+ originY: 'top',
190
+ overlayX: 'center',
191
+ overlayY: 'bottom',
192
+ offsetY: -offset,
193
+ },
194
+ 'top-left': {
195
+ originX: 'start',
196
+ originY: 'top',
197
+ overlayX: 'start',
198
+ overlayY: 'bottom',
199
+ offsetY: -offset,
200
+ },
201
+ 'top-right': {
202
+ originX: 'end',
203
+ originY: 'top',
204
+ overlayX: 'end',
205
+ overlayY: 'bottom',
206
+ offsetY: -offset,
207
+ },
208
+ bottom: {
209
+ originX: 'center',
210
+ originY: 'bottom',
211
+ overlayX: 'center',
212
+ overlayY: 'top',
213
+ offsetY: offset,
214
+ },
215
+ 'bottom-left': {
216
+ originX: 'start',
217
+ originY: 'bottom',
218
+ overlayX: 'start',
219
+ overlayY: 'top',
220
+ offsetY: offset,
221
+ },
222
+ 'bottom-right': {
223
+ originX: 'end',
224
+ originY: 'bottom',
225
+ overlayX: 'end',
226
+ overlayY: 'top',
227
+ offsetY: offset,
228
+ },
229
+ left: {
230
+ originX: 'start',
231
+ originY: 'center',
232
+ overlayX: 'end',
233
+ overlayY: 'center',
234
+ offsetX: -offset,
235
+ },
236
+ 'left-top': {
237
+ originX: 'start',
238
+ originY: 'top',
239
+ overlayX: 'end',
240
+ overlayY: 'top',
241
+ offsetX: -offset,
242
+ },
243
+ 'left-bottom': {
244
+ originX: 'start',
245
+ originY: 'bottom',
246
+ overlayX: 'end',
247
+ overlayY: 'bottom',
248
+ offsetX: -offset,
249
+ },
250
+ right: {
251
+ originX: 'end',
252
+ originY: 'center',
253
+ overlayX: 'start',
254
+ overlayY: 'center',
255
+ offsetX: offset,
256
+ },
257
+ 'right-top': {
258
+ originX: 'end',
259
+ originY: 'top',
260
+ overlayX: 'start',
261
+ overlayY: 'top',
262
+ offsetX: offset,
263
+ },
264
+ 'right-bottom': {
265
+ originX: 'end',
266
+ originY: 'bottom',
267
+ overlayX: 'start',
268
+ overlayY: 'bottom',
269
+ offsetX: offset,
270
+ },
271
+ };
272
+ return positions[position];
273
+ }
274
+ function getPopoverFallbackPositions(position, offset) {
275
+ const fallbackOrder = {
276
+ top: ['top', 'bottom', 'top-left', 'top-right', 'bottom-left', 'bottom-right'],
277
+ 'top-left': ['top-left', 'bottom-left', 'top', 'bottom', 'top-right', 'bottom-right'],
278
+ 'top-right': ['top-right', 'bottom-right', 'top', 'bottom', 'top-left', 'bottom-left'],
279
+ bottom: ['bottom', 'top', 'bottom-left', 'bottom-right', 'top-left', 'top-right'],
280
+ 'bottom-left': ['bottom-left', 'top-left', 'bottom', 'top', 'bottom-right', 'top-right'],
281
+ 'bottom-right': ['bottom-right', 'top-right', 'bottom', 'top', 'bottom-left', 'top-left'],
282
+ left: ['left', 'right', 'left-top', 'left-bottom', 'right-top', 'right-bottom'],
283
+ 'left-top': ['left-top', 'right-top', 'left', 'right', 'left-bottom', 'right-bottom'],
284
+ 'left-bottom': ['left-bottom', 'right-bottom', 'left', 'right', 'left-top', 'right-top'],
285
+ right: ['right', 'left', 'right-top', 'right-bottom', 'left-top', 'left-bottom'],
286
+ 'right-top': ['right-top', 'left-top', 'right', 'left', 'right-bottom', 'left-bottom'],
287
+ 'right-bottom': ['right-bottom', 'left-bottom', 'right', 'left', 'right-top', 'left-top'],
288
+ };
289
+ const orderedPositions = fallbackOrder[position] ?? [position];
290
+ return orderedPositions.map(pos => createPopoverPosition(pos, offset));
291
+ }
292
+ function getActualPopoverPosition(change) {
293
+ const { originX, originY, overlayX, overlayY } = change.connectionPair;
294
+ if (overlayY === 'bottom' && originY === 'top') {
295
+ if (originX === 'start' && overlayX === 'start') {
296
+ return 'top-left';
297
+ }
298
+ if (originX === 'end' && overlayX === 'end') {
299
+ return 'top-right';
300
+ }
301
+ return 'top';
302
+ }
303
+ if (overlayY === 'top' && originY === 'bottom') {
304
+ if (originX === 'start' && overlayX === 'start') {
305
+ return 'bottom-left';
306
+ }
307
+ if (originX === 'end' && overlayX === 'end') {
308
+ return 'bottom-right';
309
+ }
310
+ return 'bottom';
311
+ }
312
+ if (overlayX === 'end' && originX === 'start') {
313
+ if (originY === 'top' && overlayY === 'top') {
314
+ return 'left-top';
315
+ }
316
+ if (originY === 'bottom' && overlayY === 'bottom') {
317
+ return 'left-bottom';
318
+ }
319
+ return 'left';
320
+ }
321
+ if (overlayX === 'start' && originX === 'end') {
322
+ if (originY === 'top' && overlayY === 'top') {
323
+ return 'right-top';
324
+ }
325
+ if (originY === 'bottom' && overlayY === 'bottom') {
326
+ return 'right-bottom';
327
+ }
328
+ return 'right';
329
+ }
330
+ return 'top';
331
+ }
332
+
333
+ const Z_POPOVER_ANIMATION_DURATION = 200;
334
+
335
+ class ZPopoverComponent {
336
+ zContent = input(null, ...(ngDevMode ? [{ debugName: "zContent" }] : []));
337
+ zPosition = input('bottom', ...(ngDevMode ? [{ debugName: "zPosition" }] : []));
338
+ zTrigger = input('click', ...(ngDevMode ? [{ debugName: "zTrigger" }] : []));
339
+ zClass = input('', ...(ngDevMode ? [{ debugName: "zClass" }] : []));
340
+ zShowDelay = input(0, ...(ngDevMode ? [{ debugName: "zShowDelay" }] : []));
341
+ zHideDelay = input(0, ...(ngDevMode ? [{ debugName: "zHideDelay" }] : []));
342
+ zDisabled = input(false, { ...(ngDevMode ? { debugName: "zDisabled" } : {}), transform: zTransform });
343
+ zOffset = input(8, ...(ngDevMode ? [{ debugName: "zOffset" }] : []));
344
+ zManualClose = input(false, { ...(ngDevMode ? { debugName: "zManualClose" } : {}), transform: zTransform });
345
+ zScrollClose = input(false, { ...(ngDevMode ? { debugName: "zScrollClose" } : {}), transform: zTransform });
346
+ zShowArrow = input(false, { ...(ngDevMode ? { debugName: "zShowArrow" } : {}), transform: zTransform });
347
+ zShow = output();
348
+ zHide = output();
349
+ zControl = output();
350
+ _trigger = viewChild.required('trigger');
351
+ _overlay = inject(Overlay);
352
+ _overlayPositionBuilder = inject(OverlayPositionBuilder);
353
+ _renderer = inject(Renderer2);
354
+ _destroyRef = inject(DestroyRef);
355
+ _platformId = inject(PLATFORM_ID);
356
+ _document = inject(DOCUMENT);
357
+ _overlayRef = null;
358
+ _componentRef = null;
359
+ _delaySubject = new Subject();
360
+ _listenerCleanups = [];
361
+ _positionSubscription = null;
362
+ _scrollSubscription = null;
363
+ _resizeObserver = null;
364
+ _isVisible = signal(false, ...(ngDevMode ? [{ debugName: "_isVisible" }] : []));
365
+ ngOnInit() {
366
+ if (!isPlatformBrowser(this._platformId)) {
367
+ return;
368
+ }
369
+ this._setupDelayMechanism();
370
+ this._setupTriggers();
371
+ this._emitControl();
372
+ }
373
+ _emitControl() {
374
+ this.zControl.emit({
375
+ close: () => this.hide(),
376
+ closeImmediate: () => this.hideImmediate(),
377
+ show: () => this.show(),
378
+ toggle: () => this.toggle(),
379
+ isVisible: () => this._isVisible(),
380
+ });
381
+ }
382
+ ngOnDestroy() {
383
+ this._delaySubject.complete();
384
+ this._cleanupListeners();
385
+ this._disposeOverlay();
386
+ }
387
+ show() {
388
+ if (this.zDisabled() || !this.zContent()) {
389
+ return;
390
+ }
391
+ if (this._isVisible()) {
392
+ this._delay(true, 0);
393
+ return;
394
+ }
395
+ this._delay(true, this.zShowDelay());
396
+ }
397
+ hide() {
398
+ this._delay(false, this.zHideDelay());
399
+ }
400
+ hideImmediate() {
401
+ this._disposeOverlay();
402
+ this._isVisible.set(false);
403
+ this.zHide.emit();
404
+ }
405
+ toggle() {
406
+ if (this._isVisible()) {
407
+ this.hide();
408
+ return;
409
+ }
410
+ this.show();
411
+ }
412
+ isOpen() {
413
+ return this._isVisible();
414
+ }
415
+ _createOverlay() {
416
+ const positionStrategy = this._overlayPositionBuilder
417
+ .flexibleConnectedTo(this._trigger())
418
+ .withPositions(getPopoverFallbackPositions(this.zPosition(), this.zOffset()))
419
+ .withFlexibleDimensions(false)
420
+ .withPush(this.zScrollClose())
421
+ .withViewportMargin(8);
422
+ const scrollStrategy = this.zScrollClose()
423
+ ? this._overlay.scrollStrategies.close()
424
+ : this._overlay.scrollStrategies.reposition({ scrollThrottle: 10, autoClose: false });
425
+ return this._overlay.create({
426
+ positionStrategy,
427
+ scrollStrategy,
428
+ hasBackdrop: false,
429
+ });
430
+ }
431
+ _disposeOverlay() {
432
+ this._positionSubscription?.unsubscribe();
433
+ this._positionSubscription = null;
434
+ this._scrollSubscription?.unsubscribe();
435
+ this._scrollSubscription = null;
436
+ this._resizeObserver?.disconnect();
437
+ this._resizeObserver = null;
438
+ this._overlayRef?.dispose();
439
+ this._overlayRef = null;
440
+ this._componentRef = null;
441
+ }
442
+ _setupDelayMechanism() {
443
+ this._delaySubject
444
+ .pipe(switchMap(config => (config.delay <= 0 ? of(config) : timer(config.delay).pipe(map(() => config)))), takeUntilDestroyed(this._destroyRef))
445
+ .subscribe(config => {
446
+ if (config.show) {
447
+ this._showPopover();
448
+ return;
449
+ }
450
+ this._hidePopover();
451
+ });
452
+ }
453
+ _setupTriggers() {
454
+ this._cleanupListeners();
455
+ const trigger = this.zTrigger();
456
+ const triggerEl = this._trigger().nativeElement;
457
+ if (trigger === 'hover') {
458
+ this._listenerCleanups.push(this._renderer.listen(triggerEl, 'mouseenter', () => this.show()), this._renderer.listen(triggerEl, 'focus', () => this.show()));
459
+ if (!this.zManualClose()) {
460
+ this._listenerCleanups.push(this._renderer.listen(triggerEl, 'mouseleave', () => this.hide()), this._renderer.listen(triggerEl, 'blur', () => this.hide()));
461
+ }
462
+ return;
463
+ }
464
+ if (trigger === 'click') {
465
+ this._listenerCleanups.push(this._renderer.listen(triggerEl, 'click', (event) => {
466
+ event.stopPropagation();
467
+ this.toggle();
468
+ }));
469
+ }
470
+ }
471
+ _setupOutsideClick() {
472
+ if (!this._overlayRef) {
473
+ return;
474
+ }
475
+ this._overlayRef
476
+ .outsidePointerEvents()
477
+ .pipe(filter(() => !this.zManualClose()), takeUntilDestroyed(this._destroyRef))
478
+ .subscribe(event => {
479
+ const triggerEl = this._trigger().nativeElement;
480
+ if (!triggerEl.contains(event.target)) {
481
+ this._delay(false, 0);
482
+ }
483
+ });
484
+ }
485
+ _delay(show, delay) {
486
+ this._delaySubject.next({ show, delay });
487
+ }
488
+ _setupScrollClose() {
489
+ if (this.zManualClose()) {
490
+ return;
491
+ }
492
+ this._scrollSubscription?.unsubscribe();
493
+ let ticking = false;
494
+ const onScroll = (event) => {
495
+ if (!this._isVisible() || !this._overlayRef) {
496
+ return;
497
+ }
498
+ const { target } = event;
499
+ const { overlayElement } = this._overlayRef;
500
+ if (overlayElement && overlayElement.contains(target)) {
501
+ return;
502
+ }
503
+ if (this.zScrollClose()) {
504
+ this.hideImmediate();
505
+ return;
506
+ }
507
+ if (ticking) {
508
+ return;
509
+ }
510
+ ticking = true;
511
+ requestAnimationFrame(() => {
512
+ this._overlayRef?.updatePosition();
513
+ ticking = false;
514
+ });
515
+ };
516
+ this._document.addEventListener('scroll', onScroll, true);
517
+ this._scrollSubscription = {
518
+ unsubscribe: () => {
519
+ this._document.removeEventListener('scroll', onScroll, true);
520
+ },
521
+ };
522
+ }
523
+ _showPopover() {
524
+ const content = this.zContent();
525
+ if (!content || this._componentRef) {
526
+ return;
527
+ }
528
+ if (!this._overlayRef) {
529
+ this._overlayRef = this._createOverlay();
530
+ this._setupOutsideClick();
531
+ }
532
+ this._setupScrollClose();
533
+ const positionStrategy = this._overlayPositionBuilder
534
+ .flexibleConnectedTo(this._trigger())
535
+ .withPositions(getPopoverFallbackPositions(this.zPosition(), this.zOffset()))
536
+ .withFlexibleDimensions(false)
537
+ .withPush(this.zScrollClose())
538
+ .withViewportMargin(8);
539
+ this._overlayRef.updatePositionStrategy(positionStrategy);
540
+ const portal = new ComponentPortal(ZPopoverContentComponent);
541
+ this._componentRef = this._overlayRef.attach(portal);
542
+ this._componentRef.instance.setProps({
543
+ content,
544
+ position: this.zPosition(),
545
+ customClass: this.zClass(),
546
+ onClose: () => this.hide(),
547
+ showArrow: this.zShowArrow(),
548
+ });
549
+ this._positionSubscription = positionStrategy.positionChanges.subscribe(change => {
550
+ const actualPosition = getActualPopoverPosition(change);
551
+ this._componentRef?.instance.position.set(actualPosition);
552
+ });
553
+ if (this.zTrigger() === 'hover') {
554
+ this._setupPopoverHover();
555
+ }
556
+ this._setupResizeObserver();
557
+ this._isVisible.set(true);
558
+ this.zShow.emit();
559
+ }
560
+ _setupResizeObserver() {
561
+ this._resizeObserver?.disconnect();
562
+ this._resizeObserver = new ResizeObserver(() => {
563
+ if (this._overlayRef && this._isVisible()) {
564
+ this._overlayRef.updatePosition();
565
+ }
566
+ });
567
+ this._resizeObserver.observe(this._trigger().nativeElement);
568
+ }
569
+ _setupPopoverHover() {
570
+ const overlayElement = this._overlayRef?.overlayElement;
571
+ if (!overlayElement) {
572
+ return;
573
+ }
574
+ this._listenerCleanups.push(this._renderer.listen(overlayElement, 'mouseenter', () => {
575
+ this._delay(true, 0);
576
+ }));
577
+ if (!this.zManualClose()) {
578
+ this._listenerCleanups.push(this._renderer.listen(overlayElement, 'mouseleave', () => {
579
+ this._delay(false, this.zHideDelay());
580
+ }));
581
+ }
582
+ }
583
+ _hidePopover() {
584
+ if (!this._componentRef) {
585
+ return;
586
+ }
587
+ this._componentRef.instance.state.set('closed');
588
+ setTimeout(() => {
589
+ this._disposeOverlay();
590
+ this._isVisible.set(false);
591
+ this.zHide.emit();
592
+ }, Z_POPOVER_ANIMATION_DURATION);
593
+ }
594
+ _cleanupListeners() {
595
+ this._listenerCleanups.forEach(cleanup => cleanup());
596
+ this._listenerCleanups = [];
597
+ }
598
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZPopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
599
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.6", type: ZPopoverComponent, isStandalone: true, selector: "z-popover", inputs: { zContent: { classPropertyName: "zContent", publicName: "zContent", isSignal: true, isRequired: false, transformFunction: null }, zPosition: { classPropertyName: "zPosition", publicName: "zPosition", isSignal: true, isRequired: false, transformFunction: null }, zTrigger: { classPropertyName: "zTrigger", publicName: "zTrigger", isSignal: true, isRequired: false, transformFunction: null }, zClass: { classPropertyName: "zClass", publicName: "zClass", isSignal: true, isRequired: false, transformFunction: null }, zShowDelay: { classPropertyName: "zShowDelay", publicName: "zShowDelay", isSignal: true, isRequired: false, transformFunction: null }, zHideDelay: { classPropertyName: "zHideDelay", publicName: "zHideDelay", isSignal: true, isRequired: false, transformFunction: null }, zDisabled: { classPropertyName: "zDisabled", publicName: "zDisabled", isSignal: true, isRequired: false, transformFunction: null }, zOffset: { classPropertyName: "zOffset", publicName: "zOffset", isSignal: true, isRequired: false, transformFunction: null }, zManualClose: { classPropertyName: "zManualClose", publicName: "zManualClose", isSignal: true, isRequired: false, transformFunction: null }, zScrollClose: { classPropertyName: "zScrollClose", publicName: "zScrollClose", isSignal: true, isRequired: false, transformFunction: null }, zShowArrow: { classPropertyName: "zShowArrow", publicName: "zShowArrow", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zShow: "zShow", zHide: "zHide", zControl: "zControl" }, host: { classAttribute: "inline-block" }, viewQueries: [{ propertyName: "_trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }], ngImport: i0, template: `
600
+ <span #trigger class="z-popover-trigger inline-block">
601
+ <ng-content />
602
+ </span>
603
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
604
+ }
605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZPopoverComponent, decorators: [{
606
+ type: Component,
607
+ args: [{
608
+ selector: 'z-popover',
609
+ standalone: true,
610
+ template: `
611
+ <span #trigger class="z-popover-trigger inline-block">
612
+ <ng-content />
613
+ </span>
614
+ `,
615
+ changeDetection: ChangeDetectionStrategy.OnPush,
616
+ host: {
617
+ class: 'inline-block',
618
+ },
619
+ }]
620
+ }], propDecorators: { zContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "zContent", required: false }] }], zPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPosition", required: false }] }], zTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "zTrigger", required: false }] }], zClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "zClass", required: false }] }], zShowDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "zShowDelay", required: false }] }], zHideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "zHideDelay", required: false }] }], zDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDisabled", required: false }] }], zOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOffset", required: false }] }], zManualClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "zManualClose", required: false }] }], zScrollClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "zScrollClose", required: false }] }], zShowArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "zShowArrow", required: false }] }], zShow: [{ type: i0.Output, args: ["zShow"] }], zHide: [{ type: i0.Output, args: ["zHide"] }], zControl: [{ type: i0.Output, args: ["zControl"] }], _trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }] } });
621
+
622
+ class ZPopoverDirective {
623
+ zContent = input(null, { ...(ngDevMode ? { debugName: "zContent" } : {}), alias: 'zPopoverContent' });
624
+ zPosition = input('bottom', ...(ngDevMode ? [{ debugName: "zPosition" }] : []));
625
+ zTrigger = input('click', ...(ngDevMode ? [{ debugName: "zTrigger" }] : []));
626
+ zClass = input('', ...(ngDevMode ? [{ debugName: "zClass" }] : []));
627
+ zShowDelay = input(0, ...(ngDevMode ? [{ debugName: "zShowDelay" }] : []));
628
+ zHideDelay = input(0, ...(ngDevMode ? [{ debugName: "zHideDelay" }] : []));
629
+ zDisabled = input(false, { ...(ngDevMode ? { debugName: "zDisabled" } : {}), transform: zTransform });
630
+ zOffset = input(8, ...(ngDevMode ? [{ debugName: "zOffset" }] : []));
631
+ zPopoverWidth = input('auto', ...(ngDevMode ? [{ debugName: "zPopoverWidth" }] : []));
632
+ zManualClose = input(false, { ...(ngDevMode ? { debugName: "zManualClose" } : {}), transform: zTransform });
633
+ zScrollClose = input(false, { ...(ngDevMode ? { debugName: "zScrollClose" } : {}), transform: zTransform });
634
+ zShowArrow = input(false, { ...(ngDevMode ? { debugName: "zShowArrow" } : {}), transform: zTransform });
635
+ zShow = output();
636
+ zHide = output();
637
+ zHideStart = output();
638
+ zControl = output();
639
+ _overlay = inject(Overlay);
640
+ _overlayPositionBuilder = inject(OverlayPositionBuilder);
641
+ _elementRef = inject((ElementRef));
642
+ _renderer = inject(Renderer2);
643
+ _destroyRef = inject(DestroyRef);
644
+ _platformId = inject(PLATFORM_ID);
645
+ _document = inject(DOCUMENT);
646
+ _overlayRef = null;
647
+ _componentRef = null;
648
+ _delaySubject = new Subject();
649
+ _listenerCleanups = [];
650
+ _positionSubscription = null;
651
+ _scrollSubscription = null;
652
+ _resizeObserver = null;
653
+ _isVisible = signal(false, ...(ngDevMode ? [{ debugName: "_isVisible" }] : []));
654
+ ngOnInit() {
655
+ if (!isPlatformBrowser(this._platformId)) {
656
+ return;
657
+ }
658
+ this._setupDelayMechanism();
659
+ this._setupTriggers();
660
+ this._emitControl();
661
+ }
662
+ _emitControl() {
663
+ this.zControl.emit({
664
+ close: () => this.hide(),
665
+ closeImmediate: () => this.hideImmediate(),
666
+ show: () => this.show(),
667
+ toggle: () => this.toggle(),
668
+ isVisible: () => this._isVisible(),
669
+ });
670
+ }
671
+ ngOnDestroy() {
672
+ this._delaySubject.complete();
673
+ this._cleanupListeners();
674
+ this._disposeOverlay();
675
+ }
676
+ show() {
677
+ if (this.zDisabled() || !this.zContent()) {
678
+ return;
679
+ }
680
+ if (this._isVisible()) {
681
+ this._delay(true, 0);
682
+ return;
683
+ }
684
+ this._delay(true, this.zShowDelay());
685
+ }
686
+ hide() {
687
+ this._delay(false, this.zHideDelay());
688
+ }
689
+ hideImmediate() {
690
+ this._disposeOverlay();
691
+ this._isVisible.set(false);
692
+ this.zHide.emit();
693
+ }
694
+ toggle() {
695
+ if (this._isVisible()) {
696
+ this.hide();
697
+ return;
698
+ }
699
+ this.show();
700
+ }
701
+ isOpen() {
702
+ return this._isVisible();
703
+ }
704
+ _createOverlay() {
705
+ const positionStrategy = this._overlayPositionBuilder
706
+ .flexibleConnectedTo(this._elementRef)
707
+ .withPositions(getPopoverFallbackPositions(this.zPosition(), this.zOffset()))
708
+ .withFlexibleDimensions(false)
709
+ .withPush(this.zScrollClose())
710
+ .withViewportMargin(8);
711
+ const widthConfig = this._getWidthConfig();
712
+ const scrollStrategy = this.zScrollClose()
713
+ ? this._overlay.scrollStrategies.close()
714
+ : this._overlay.scrollStrategies.reposition();
715
+ return this._overlay.create({
716
+ positionStrategy,
717
+ scrollStrategy,
718
+ hasBackdrop: false,
719
+ ...widthConfig,
720
+ });
721
+ }
722
+ _getWidthConfig() {
723
+ const width = this.zPopoverWidth();
724
+ if (width === 'auto') {
725
+ return {};
726
+ }
727
+ if (width === 'trigger') {
728
+ const triggerWidth = this._elementRef.nativeElement.getBoundingClientRect().width;
729
+ return { width: `${triggerWidth}px`, minWidth: `${triggerWidth}px` };
730
+ }
731
+ return { width, minWidth: width };
732
+ }
733
+ _disposeOverlay() {
734
+ this._positionSubscription?.unsubscribe();
735
+ this._positionSubscription = null;
736
+ this._scrollSubscription?.unsubscribe();
737
+ this._scrollSubscription = null;
738
+ this._resizeObserver?.disconnect();
739
+ this._resizeObserver = null;
740
+ this._overlayRef?.dispose();
741
+ this._overlayRef = null;
742
+ this._componentRef = null;
743
+ }
744
+ _setupDelayMechanism() {
745
+ this._delaySubject
746
+ .pipe(switchMap(config => (config.delay <= 0 ? of(config) : timer(config.delay).pipe(map(() => config)))), takeUntilDestroyed(this._destroyRef))
747
+ .subscribe(config => {
748
+ if (config.show) {
749
+ this._showPopover();
750
+ return;
751
+ }
752
+ this._hidePopover();
753
+ });
754
+ }
755
+ _setupTriggers() {
756
+ this._cleanupListeners();
757
+ const trigger = this.zTrigger();
758
+ if (trigger === 'hover') {
759
+ this._listenerCleanups.push(this._renderer.listen(this._elementRef.nativeElement, 'mouseenter', () => this.show()), this._renderer.listen(this._elementRef.nativeElement, 'focus', () => this.show()));
760
+ if (!this.zManualClose()) {
761
+ this._listenerCleanups.push(this._renderer.listen(this._elementRef.nativeElement, 'mouseleave', () => this.hide()), this._renderer.listen(this._elementRef.nativeElement, 'blur', () => this.hide()));
762
+ }
763
+ return;
764
+ }
765
+ if (trigger === 'click') {
766
+ this._listenerCleanups.push(this._renderer.listen(this._elementRef.nativeElement, 'click', (event) => {
767
+ event.stopPropagation();
768
+ this.toggle();
769
+ }));
770
+ }
771
+ }
772
+ _setupOutsideClick() {
773
+ if (!this._overlayRef) {
774
+ return;
775
+ }
776
+ this._overlayRef
777
+ .outsidePointerEvents()
778
+ .pipe(filter(() => !this.zManualClose()), filter(() => this.zTrigger() === 'click'), filter(event => !this._elementRef.nativeElement.contains(event.target)), takeUntilDestroyed(this._destroyRef))
779
+ .subscribe(() => this._delay(false, 0));
780
+ }
781
+ _setupScrollClose() {
782
+ this._scrollSubscription?.unsubscribe();
783
+ let ticking = false;
784
+ const onScroll = (event) => {
785
+ if (!this._isVisible() || !this._overlayRef) {
786
+ return;
787
+ }
788
+ const { target } = event;
789
+ const { overlayElement } = this._overlayRef;
790
+ if (overlayElement && overlayElement.contains(target)) {
791
+ return;
792
+ }
793
+ if (this.zScrollClose() && !this.zManualClose()) {
794
+ this.hideImmediate();
795
+ return;
796
+ }
797
+ if (ticking) {
798
+ return;
799
+ }
800
+ ticking = true;
801
+ requestAnimationFrame(() => {
802
+ this._overlayRef?.updatePosition();
803
+ ticking = false;
804
+ });
805
+ };
806
+ this._document.addEventListener('scroll', onScroll, true);
807
+ this._scrollSubscription = {
808
+ unsubscribe: () => {
809
+ this._document.removeEventListener('scroll', onScroll, true);
810
+ },
811
+ };
812
+ }
813
+ _delay(show, delay) {
814
+ this._delaySubject.next({ show, delay });
815
+ }
816
+ _showPopover() {
817
+ const content = this.zContent();
818
+ if (!content || this._componentRef) {
819
+ return;
820
+ }
821
+ if (!this._overlayRef) {
822
+ this._overlayRef = this._createOverlay();
823
+ this._setupOutsideClick();
824
+ }
825
+ this._setupScrollClose();
826
+ const positionStrategy = this._overlayPositionBuilder
827
+ .flexibleConnectedTo(this._elementRef)
828
+ .withPositions(getPopoverFallbackPositions(this.zPosition(), this.zOffset()))
829
+ .withFlexibleDimensions(false)
830
+ .withPush(this.zScrollClose())
831
+ .withViewportMargin(8);
832
+ this._overlayRef.updatePositionStrategy(positionStrategy);
833
+ const widthConfig = this._getWidthConfig();
834
+ if (widthConfig.width) {
835
+ this._overlayRef.updateSize({ width: widthConfig.width, minWidth: widthConfig.minWidth });
836
+ }
837
+ const portal = new ComponentPortal(ZPopoverContentComponent);
838
+ this._componentRef = this._overlayRef.attach(portal);
839
+ this._componentRef.instance.setProps({
840
+ content,
841
+ position: this.zPosition(),
842
+ customClass: this.zClass(),
843
+ onClose: () => this.hide(),
844
+ showArrow: this.zShowArrow(),
845
+ });
846
+ this._positionSubscription = positionStrategy.positionChanges.subscribe(change => {
847
+ const actualPosition = getActualPopoverPosition(change);
848
+ this._componentRef?.instance.position.set(actualPosition);
849
+ });
850
+ if (this.zTrigger() === 'hover') {
851
+ this._setupPopoverHover();
852
+ }
853
+ this._setupResizeObserver();
854
+ this._isVisible.set(true);
855
+ this.zShow.emit();
856
+ }
857
+ _setupResizeObserver() {
858
+ this._resizeObserver?.disconnect();
859
+ this._resizeObserver = new ResizeObserver(() => {
860
+ if (this._overlayRef && this._isVisible()) {
861
+ this._overlayRef.updatePosition();
862
+ const widthConfig = this._getWidthConfig();
863
+ if (widthConfig.width) {
864
+ this._overlayRef.updateSize({ width: widthConfig.width, minWidth: widthConfig.minWidth });
865
+ }
866
+ }
867
+ });
868
+ this._resizeObserver.observe(this._elementRef.nativeElement);
869
+ }
870
+ _setupPopoverHover() {
871
+ const overlayElement = this._overlayRef?.overlayElement;
872
+ if (!overlayElement) {
873
+ return;
874
+ }
875
+ this._listenerCleanups.push(this._renderer.listen(overlayElement, 'mouseenter', () => {
876
+ this._delay(true, 0);
877
+ }));
878
+ if (!this.zManualClose()) {
879
+ this._listenerCleanups.push(this._renderer.listen(overlayElement, 'mouseleave', () => {
880
+ this._delay(false, this.zHideDelay());
881
+ }));
882
+ }
883
+ }
884
+ _hidePopover() {
885
+ if (!this._componentRef) {
886
+ return;
887
+ }
888
+ this._isVisible.set(false);
889
+ this.zHideStart.emit();
890
+ this._componentRef.instance.state.set('closed');
891
+ setTimeout(() => {
892
+ this._disposeOverlay();
893
+ this.zHide.emit();
894
+ }, Z_POPOVER_ANIMATION_DURATION);
895
+ }
896
+ _cleanupListeners() {
897
+ this._listenerCleanups.forEach(cleanup => cleanup());
898
+ this._listenerCleanups = [];
899
+ }
900
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZPopoverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
901
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: ZPopoverDirective, isStandalone: true, selector: "[z-popover]", inputs: { zContent: { classPropertyName: "zContent", publicName: "zPopoverContent", isSignal: true, isRequired: false, transformFunction: null }, zPosition: { classPropertyName: "zPosition", publicName: "zPosition", isSignal: true, isRequired: false, transformFunction: null }, zTrigger: { classPropertyName: "zTrigger", publicName: "zTrigger", isSignal: true, isRequired: false, transformFunction: null }, zClass: { classPropertyName: "zClass", publicName: "zClass", isSignal: true, isRequired: false, transformFunction: null }, zShowDelay: { classPropertyName: "zShowDelay", publicName: "zShowDelay", isSignal: true, isRequired: false, transformFunction: null }, zHideDelay: { classPropertyName: "zHideDelay", publicName: "zHideDelay", isSignal: true, isRequired: false, transformFunction: null }, zDisabled: { classPropertyName: "zDisabled", publicName: "zDisabled", isSignal: true, isRequired: false, transformFunction: null }, zOffset: { classPropertyName: "zOffset", publicName: "zOffset", isSignal: true, isRequired: false, transformFunction: null }, zPopoverWidth: { classPropertyName: "zPopoverWidth", publicName: "zPopoverWidth", isSignal: true, isRequired: false, transformFunction: null }, zManualClose: { classPropertyName: "zManualClose", publicName: "zManualClose", isSignal: true, isRequired: false, transformFunction: null }, zScrollClose: { classPropertyName: "zScrollClose", publicName: "zScrollClose", isSignal: true, isRequired: false, transformFunction: null }, zShowArrow: { classPropertyName: "zShowArrow", publicName: "zShowArrow", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { zShow: "zShow", zHide: "zHide", zHideStart: "zHideStart", zControl: "zControl" }, exportAs: ["zPopover"], ngImport: i0 });
902
+ }
903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ZPopoverDirective, decorators: [{
904
+ type: Directive,
905
+ args: [{
906
+ selector: '[z-popover]',
907
+ standalone: true,
908
+ exportAs: 'zPopover',
909
+ }]
910
+ }], propDecorators: { zContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPopoverContent", required: false }] }], zPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPosition", required: false }] }], zTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "zTrigger", required: false }] }], zClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "zClass", required: false }] }], zShowDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "zShowDelay", required: false }] }], zHideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "zHideDelay", required: false }] }], zDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDisabled", required: false }] }], zOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "zOffset", required: false }] }], zPopoverWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "zPopoverWidth", required: false }] }], zManualClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "zManualClose", required: false }] }], zScrollClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "zScrollClose", required: false }] }], zShowArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "zShowArrow", required: false }] }], zShow: [{ type: i0.Output, args: ["zShow"] }], zHide: [{ type: i0.Output, args: ["zHide"] }], zHideStart: [{ type: i0.Output, args: ["zHideStart"] }], zControl: [{ type: i0.Output, args: ["zControl"] }] } });
911
+
912
+ /**
913
+ * Generated bundle index. Do not edit.
914
+ */
915
+
916
+ export { ZPopoverComponent, ZPopoverDirective, zPopoverVariants };
917
+ //# sourceMappingURL=shival99-z-ui-components-z-popover.mjs.map