pdm-ui-kit 0.1.32 → 0.1.34

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.
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, HostListener, ViewChildren, ViewChild, NgModule } from '@angular/core';
4
+ import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, HostListener, ViewChild, ViewChildren, NgModule } from '@angular/core';
5
5
  import { icons } from 'lucide';
6
6
  import * as i1$1 from '@angular/platform-browser';
7
7
  import { format } from 'date-fns';
@@ -315,7 +315,6 @@ class PdmButtonGroupComponent {
315
315
  '[&>pdm-button>button]:!rounded-none',
316
316
  '[&>pdm-button:first-child>button]:!rounded-l-md',
317
317
  '[&>pdm-button:last-child>button]:!rounded-r-md',
318
- '[&>pdm-button:not(:first-child)>button]:!border-l-0',
319
318
  '[&>pdm-input>div>input]:!rounded-none',
320
319
  '[&>pdm-input:first-child>div>input]:!rounded-l-md',
321
320
  '[&>pdm-input:last-child>div>input]:!rounded-r-md',
@@ -333,12 +332,10 @@ class PdmButtonGroupComponent {
333
332
  '[&>pdm-tooltip>span>pdm-button>button]:!rounded-none',
334
333
  '[&>pdm-tooltip:first-child>span>pdm-button>button]:!rounded-l-md',
335
334
  '[&>pdm-tooltip:last-child>span>pdm-button>button]:!rounded-r-md',
336
- '[&>pdm-tooltip:not(:first-child)>span>pdm-button>button]:!border-l-0',
337
335
  '[&>pdm-tooltip>span>pdm-button>button]:shadow-none',
338
336
  '[&>pdm-tooltip>span>button]:!rounded-none',
339
337
  '[&>pdm-tooltip:first-child>span>button]:!rounded-l-md',
340
338
  '[&>pdm-tooltip:last-child>span>button]:!rounded-r-md',
341
- '[&>pdm-tooltip:not(:first-child)>span>button]:!border-l-0',
342
339
  '[&>pdm-tooltip>span>button]:shadow-none',
343
340
  '[&>pdm-tooltip>span>pdm-input>div>input]:!rounded-none',
344
341
  '[&>pdm-tooltip:first-child>span>pdm-input>div>input]:!rounded-l-md',
@@ -398,7 +395,6 @@ class PdmButtonGroupComponent {
398
395
  '[&>pdm-input>div>input]:bg-background',
399
396
  '[&>pdm-input>div>input]:shadow-none',
400
397
  '[&>pdm-button>button]:shadow-none',
401
- '[&>pdm-button:not(:first-child)>button]:!border-t-0',
402
398
  '[&>pdm-tooltip>span>*]:rounded-none',
403
399
  '[&>pdm-tooltip:first-child>span>*]:rounded-t-md',
404
400
  '[&>pdm-tooltip:last-child>span>*]:rounded-b-md',
@@ -406,12 +402,10 @@ class PdmButtonGroupComponent {
406
402
  '[&>pdm-tooltip>span>pdm-button>button]:!rounded-none',
407
403
  '[&>pdm-tooltip:first-child>span>pdm-button>button]:!rounded-t-md',
408
404
  '[&>pdm-tooltip:last-child>span>pdm-button>button]:!rounded-b-md',
409
- '[&>pdm-tooltip:not(:first-child)>span>pdm-button>button]:!border-t-0',
410
405
  '[&>pdm-tooltip>span>pdm-button>button]:shadow-none',
411
406
  '[&>pdm-tooltip>span>button]:!rounded-none',
412
407
  '[&>pdm-tooltip:first-child>span>button]:!rounded-t-md',
413
408
  '[&>pdm-tooltip:last-child>span>button]:!rounded-b-md',
414
- '[&>pdm-tooltip:not(:first-child)>span>button]:!border-t-0',
415
409
  '[&>pdm-tooltip>span>button]:shadow-none',
416
410
  '[&>pdm-tooltip>span>pdm-input>div>input]:!rounded-none',
417
411
  '[&>pdm-tooltip:first-child>span>pdm-input>div>input]:!rounded-t-md',
@@ -800,8 +794,12 @@ class PdmCalendarComponent {
800
794
  }
801
795
  dayButtonClasses(cell) {
802
796
  return [
803
- 'relative z-10 flex h-8 w-8 appearance-none items-center justify-center rounded-md border-0 bg-transparent p-0 text-sm leading-5',
804
- cell.selected ? 'bg-primary text-primary-foreground' : cell.rangeFill ? 'text-accent-foreground' : 'text-foreground',
797
+ 'relative z-10 flex h-8 w-8 appearance-none items-center justify-center rounded-md border-0 p-0 text-sm leading-5',
798
+ cell.selected
799
+ ? 'bg-primary text-primary-foreground'
800
+ : cell.rangeFill
801
+ ? 'bg-transparent text-accent-foreground'
802
+ : 'bg-transparent text-foreground',
805
803
  cell.muted && !cell.rangeFill ? 'opacity-50' : '',
806
804
  cell.disabled ? 'cursor-not-allowed opacity-40' : '',
807
805
  !cell.disabled && !this.readonly && !cell.selected ? 'hover:bg-accent/70' : ''
@@ -1972,6 +1970,7 @@ class PdmDatePickerComponent {
1972
1970
  this._open = false;
1973
1971
  this.instanceId = `pdm-date-picker-${++nextDatePickerId}`;
1974
1972
  this.triggerFocused = false;
1973
+ this.panelPlacement = 'bottom';
1975
1974
  this.id = '';
1976
1975
  this.variant = 'single';
1977
1976
  this.label = '';
@@ -2001,6 +2000,12 @@ class PdmDatePickerComponent {
2001
2000
  }
2002
2001
  set open(value) {
2003
2002
  this._open = !!value;
2003
+ if (this._open) {
2004
+ this.schedulePanelPlacementUpdate();
2005
+ }
2006
+ else {
2007
+ this.panelPlacement = 'bottom';
2008
+ }
2004
2009
  this.cdr.markForCheck();
2005
2010
  }
2006
2011
  get open() {
@@ -2084,7 +2089,9 @@ class PdmDatePickerComponent {
2084
2089
  }
2085
2090
  get panelClasses() {
2086
2091
  return [
2087
- 'absolute left-0 top-full z-30 mt-2',
2092
+ this.panelPlacement === 'top'
2093
+ ? 'absolute bottom-full left-0 z-30 mb-2'
2094
+ : 'absolute left-0 top-full z-30 mt-2',
2088
2095
  this.panelClassName
2089
2096
  ];
2090
2097
  }
@@ -2149,14 +2156,48 @@ class PdmDatePickerComponent {
2149
2156
  this.setOpen(false);
2150
2157
  }
2151
2158
  }
2159
+ onViewportChange() {
2160
+ this.updatePanelPlacement();
2161
+ }
2152
2162
  setOpen(nextOpen) {
2153
2163
  if (this._open === nextOpen) {
2154
2164
  return;
2155
2165
  }
2156
2166
  this._open = nextOpen;
2157
2167
  this.openChange.emit(this._open);
2168
+ if (this._open) {
2169
+ this.schedulePanelPlacementUpdate();
2170
+ }
2171
+ else {
2172
+ this.panelPlacement = 'bottom';
2173
+ }
2158
2174
  this.cdr.markForCheck();
2159
2175
  }
2176
+ schedulePanelPlacementUpdate() {
2177
+ setTimeout(() => this.updatePanelPlacement());
2178
+ }
2179
+ updatePanelPlacement() {
2180
+ var _a, _b;
2181
+ if (!this._open) {
2182
+ return;
2183
+ }
2184
+ const triggerEl = (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
2185
+ const panelEl = (_b = this.panelRef) === null || _b === void 0 ? void 0 : _b.nativeElement;
2186
+ if (!triggerEl || !panelEl || typeof window === 'undefined') {
2187
+ return;
2188
+ }
2189
+ const viewportHeight = window.innerHeight;
2190
+ const gap = 8;
2191
+ const triggerRect = triggerEl.getBoundingClientRect();
2192
+ const panelHeight = panelEl.offsetHeight;
2193
+ const spaceBelow = Math.max(0, viewportHeight - triggerRect.bottom - gap);
2194
+ const spaceAbove = Math.max(0, triggerRect.top - gap);
2195
+ const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
2196
+ if (this.panelPlacement !== nextPlacement) {
2197
+ this.panelPlacement = nextPlacement;
2198
+ this.cdr.markForCheck();
2199
+ }
2200
+ }
2160
2201
  formatDate(date) {
2161
2202
  try {
2162
2203
  return format(date, this.format || 'MMM d, yyyy');
@@ -2176,11 +2217,17 @@ class PdmDatePickerComponent {
2176
2217
  }
2177
2218
  }
2178
2219
  PdmDatePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmDatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2179
- PdmDatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmDatePickerComponent, selector: "pdm-date-picker", inputs: { id: "id", variant: "variant", label: "label", labelClassName: "labelClassName", className: "className", triggerClassName: "triggerClassName", panelClassName: "panelClassName", placeholder: "placeholder", rangePlaceholder: "rangePlaceholder", format: "format", disabled: "disabled", readonly: "readonly", required: "required", invalid: "invalid", allowSameDayRange: "allowSameDayRange", closeOnSelect: "closeOnSelect", minDate: "minDate", maxDate: "maxDate", minYear: "minYear", maxYear: "maxYear", disabledDates: "disabledDates", isDateDisabled: "isDateDisabled", open: "open", value: "value", rangeValue: "rangeValue" }, outputs: { valueChange: "valueChange", rangeValueChange: "rangeValueChange", openChange: "openChange", monthChange: "monthChange" }, host: { listeners: { "document:keydown.escape": "onEscape()", "document:click": "onDocumentClick($event)" } }, ngImport: i0, template: "<div [ngClass]=\"rootClasses\">\n <pdm-label *ngIf=\"label\" [forId]=\"triggerId\" [required]=\"required\" [className]=\"labelClassName\">\n {{ label }}\n </pdm-label>\n\n <div class=\"relative inline-block w-full\">\n <button\n type=\"button\"\n [id]=\"triggerId\"\n [disabled]=\"disabled\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-invalid]=\"invalid\"\n [ngClass]=\"triggerClasses\"\n [attr.title]=\"displayText\"\n (click)=\"toggleOpen()\"\n (focus)=\"onTriggerFocus()\"\n (blur)=\"onTriggerBlur()\"\n >\n <span class=\"flex h-5 w-5 shrink-0 items-center justify-center p-0.5 text-muted-foreground\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\">\n <path d=\"M8 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M16 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"16.5\" rx=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></rect>\n <path d=\"M3 9.5h18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </span>\n\n <span [ngClass]=\"textClasses\">{{ displayText }}</span>\n </button>\n\n <div *ngIf=\"open\" [id]=\"panelId\" [ngClass]=\"panelClasses\" role=\"dialog\" [attr.aria-labelledby]=\"label ? triggerId : null\">\n <pdm-calendar\n [variant]=\"resolvedVariant\"\n [value]=\"value\"\n [rangeValue]=\"rangeValue\"\n [readonly]=\"readonly\"\n [allowSameDayRange]=\"allowSameDayRange\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minYear]=\"minYear\"\n [maxYear]=\"maxYear\"\n [disabledDates]=\"disabledDates\"\n [isDateDisabled]=\"isDateDisabled\"\n (valueChange)=\"onCalendarValueChange($event)\"\n (rangeValueChange)=\"onCalendarRangeValueChange($event)\"\n (monthChange)=\"onCalendarMonthChange($event)\"\n ></pdm-calendar>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PdmCalendarComponent, selector: "pdm-calendar", inputs: ["variant", "className", "disabledDates", "minDate", "maxDate", "minYear", "maxYear", "isDateDisabled", "allowSameDayRange", "readonly", "value", "rangeValue", "month"], outputs: ["valueChange", "rangeValueChange", "monthChange", "dateClick", "disabledDateClick"] }, { kind: "component", type: PdmLabelComponent, selector: "pdm-label", inputs: ["forId", "required", "className"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2220
+ PdmDatePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmDatePickerComponent, selector: "pdm-date-picker", inputs: { id: "id", variant: "variant", label: "label", labelClassName: "labelClassName", className: "className", triggerClassName: "triggerClassName", panelClassName: "panelClassName", placeholder: "placeholder", rangePlaceholder: "rangePlaceholder", format: "format", disabled: "disabled", readonly: "readonly", required: "required", invalid: "invalid", allowSameDayRange: "allowSameDayRange", closeOnSelect: "closeOnSelect", minDate: "minDate", maxDate: "maxDate", minYear: "minYear", maxYear: "maxYear", disabledDates: "disabledDates", isDateDisabled: "isDateDisabled", open: "open", value: "value", rangeValue: "rangeValue" }, outputs: { valueChange: "valueChange", rangeValueChange: "rangeValueChange", openChange: "openChange", monthChange: "monthChange" }, host: { listeners: { "document:keydown.escape": "onEscape()", "document:click": "onDocumentClick($event)", "window:resize": "onViewportChange()", "window:scroll": "onViewportChange()" } }, viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelRef", first: true, predicate: ["panelEl"], descendants: true }], ngImport: i0, template: "<div [ngClass]=\"rootClasses\">\n <pdm-label *ngIf=\"label\" [forId]=\"triggerId\" [required]=\"required\" [className]=\"labelClassName\">\n {{ label }}\n </pdm-label>\n\n <div class=\"relative inline-block w-full\">\n <button\n #triggerEl\n type=\"button\"\n [id]=\"triggerId\"\n [disabled]=\"disabled\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-invalid]=\"invalid\"\n [ngClass]=\"triggerClasses\"\n [attr.title]=\"displayText\"\n (click)=\"toggleOpen()\"\n (focus)=\"onTriggerFocus()\"\n (blur)=\"onTriggerBlur()\"\n >\n <span class=\"flex h-5 w-5 shrink-0 items-center justify-center p-0.5 text-muted-foreground\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\">\n <path d=\"M8 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M16 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"16.5\" rx=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></rect>\n <path d=\"M3 9.5h18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </span>\n\n <span [ngClass]=\"textClasses\">{{ displayText }}</span>\n </button>\n\n <div *ngIf=\"open\" #panelEl [id]=\"panelId\" [ngClass]=\"panelClasses\" role=\"dialog\" [attr.aria-labelledby]=\"label ? triggerId : null\">\n <pdm-calendar\n [variant]=\"resolvedVariant\"\n [value]=\"value\"\n [rangeValue]=\"rangeValue\"\n [readonly]=\"readonly\"\n [allowSameDayRange]=\"allowSameDayRange\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minYear]=\"minYear\"\n [maxYear]=\"maxYear\"\n [disabledDates]=\"disabledDates\"\n [isDateDisabled]=\"isDateDisabled\"\n (valueChange)=\"onCalendarValueChange($event)\"\n (rangeValueChange)=\"onCalendarRangeValueChange($event)\"\n (monthChange)=\"onCalendarMonthChange($event)\"\n ></pdm-calendar>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PdmCalendarComponent, selector: "pdm-calendar", inputs: ["variant", "className", "disabledDates", "minDate", "maxDate", "minYear", "maxYear", "isDateDisabled", "allowSameDayRange", "readonly", "value", "rangeValue", "month"], outputs: ["valueChange", "rangeValueChange", "monthChange", "dateClick", "disabledDateClick"] }, { kind: "component", type: PdmLabelComponent, selector: "pdm-label", inputs: ["forId", "required", "className"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2180
2221
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmDatePickerComponent, decorators: [{
2181
2222
  type: Component,
2182
- args: [{ selector: 'pdm-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"rootClasses\">\n <pdm-label *ngIf=\"label\" [forId]=\"triggerId\" [required]=\"required\" [className]=\"labelClassName\">\n {{ label }}\n </pdm-label>\n\n <div class=\"relative inline-block w-full\">\n <button\n type=\"button\"\n [id]=\"triggerId\"\n [disabled]=\"disabled\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-invalid]=\"invalid\"\n [ngClass]=\"triggerClasses\"\n [attr.title]=\"displayText\"\n (click)=\"toggleOpen()\"\n (focus)=\"onTriggerFocus()\"\n (blur)=\"onTriggerBlur()\"\n >\n <span class=\"flex h-5 w-5 shrink-0 items-center justify-center p-0.5 text-muted-foreground\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\">\n <path d=\"M8 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M16 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"16.5\" rx=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></rect>\n <path d=\"M3 9.5h18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </span>\n\n <span [ngClass]=\"textClasses\">{{ displayText }}</span>\n </button>\n\n <div *ngIf=\"open\" [id]=\"panelId\" [ngClass]=\"panelClasses\" role=\"dialog\" [attr.aria-labelledby]=\"label ? triggerId : null\">\n <pdm-calendar\n [variant]=\"resolvedVariant\"\n [value]=\"value\"\n [rangeValue]=\"rangeValue\"\n [readonly]=\"readonly\"\n [allowSameDayRange]=\"allowSameDayRange\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minYear]=\"minYear\"\n [maxYear]=\"maxYear\"\n [disabledDates]=\"disabledDates\"\n [isDateDisabled]=\"isDateDisabled\"\n (valueChange)=\"onCalendarValueChange($event)\"\n (rangeValueChange)=\"onCalendarRangeValueChange($event)\"\n (monthChange)=\"onCalendarMonthChange($event)\"\n ></pdm-calendar>\n </div>\n </div>\n</div>\n" }]
2183
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
2223
+ args: [{ selector: 'pdm-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"rootClasses\">\n <pdm-label *ngIf=\"label\" [forId]=\"triggerId\" [required]=\"required\" [className]=\"labelClassName\">\n {{ label }}\n </pdm-label>\n\n <div class=\"relative inline-block w-full\">\n <button\n #triggerEl\n type=\"button\"\n [id]=\"triggerId\"\n [disabled]=\"disabled\"\n [attr.aria-expanded]=\"open\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-invalid]=\"invalid\"\n [ngClass]=\"triggerClasses\"\n [attr.title]=\"displayText\"\n (click)=\"toggleOpen()\"\n (focus)=\"onTriggerFocus()\"\n (blur)=\"onTriggerBlur()\"\n >\n <span class=\"flex h-5 w-5 shrink-0 items-center justify-center p-0.5 text-muted-foreground\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" class=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\">\n <path d=\"M8 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M16 2v4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <rect x=\"3\" y=\"4.5\" width=\"18\" height=\"16.5\" rx=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></rect>\n <path d=\"M3 9.5h18\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n </svg>\n </span>\n\n <span [ngClass]=\"textClasses\">{{ displayText }}</span>\n </button>\n\n <div *ngIf=\"open\" #panelEl [id]=\"panelId\" [ngClass]=\"panelClasses\" role=\"dialog\" [attr.aria-labelledby]=\"label ? triggerId : null\">\n <pdm-calendar\n [variant]=\"resolvedVariant\"\n [value]=\"value\"\n [rangeValue]=\"rangeValue\"\n [readonly]=\"readonly\"\n [allowSameDayRange]=\"allowSameDayRange\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minYear]=\"minYear\"\n [maxYear]=\"maxYear\"\n [disabledDates]=\"disabledDates\"\n [isDateDisabled]=\"isDateDisabled\"\n (valueChange)=\"onCalendarValueChange($event)\"\n (rangeValueChange)=\"onCalendarRangeValueChange($event)\"\n (monthChange)=\"onCalendarMonthChange($event)\"\n ></pdm-calendar>\n </div>\n </div>\n</div>\n" }]
2224
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { triggerRef: [{
2225
+ type: ViewChild,
2226
+ args: ['triggerEl']
2227
+ }], panelRef: [{
2228
+ type: ViewChild,
2229
+ args: ['panelEl']
2230
+ }], id: [{
2184
2231
  type: Input
2185
2232
  }], variant: [{
2186
2233
  type: Input
@@ -2244,6 +2291,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2244
2291
  }], onDocumentClick: [{
2245
2292
  type: HostListener,
2246
2293
  args: ['document:click', ['$event']]
2294
+ }], onViewportChange: [{
2295
+ type: HostListener,
2296
+ args: ['window:resize']
2297
+ }, {
2298
+ type: HostListener,
2299
+ args: ['window:scroll']
2247
2300
  }] } });
2248
2301
 
2249
2302
  class PdmDialogComponent {
@@ -3155,8 +3208,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3155
3208
  }] } });
3156
3209
 
3157
3210
  class PdmSelectComponent {
3158
- constructor(elementRef) {
3211
+ constructor(elementRef, cdr) {
3159
3212
  this.elementRef = elementRef;
3213
+ this.cdr = cdr;
3160
3214
  this.id = '';
3161
3215
  this.value = '';
3162
3216
  this.options = [];
@@ -3165,6 +3219,8 @@ class PdmSelectComponent {
3165
3219
  this.className = '';
3166
3220
  this.placeholder = 'Select an option';
3167
3221
  this.open = false;
3222
+ this.panelPlacement = 'bottom';
3223
+ this.panelMaxHeightPx = null;
3168
3224
  this.valueChange = new EventEmitter();
3169
3225
  }
3170
3226
  get selectedOption() {
@@ -3174,10 +3230,22 @@ class PdmSelectComponent {
3174
3230
  var _a;
3175
3231
  return ((_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.label) || this.placeholder;
3176
3232
  }
3233
+ get panelClasses() {
3234
+ return [
3235
+ 'absolute left-0 z-50 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md',
3236
+ this.panelPlacement === 'top' ? 'bottom-[calc(100%+4px)]' : 'top-[calc(100%+4px)]'
3237
+ ];
3238
+ }
3177
3239
  toggle() {
3178
3240
  if (this.disabled)
3179
3241
  return;
3180
3242
  this.open = !this.open;
3243
+ if (this.open) {
3244
+ this.schedulePanelPlacementUpdate();
3245
+ return;
3246
+ }
3247
+ this.panelPlacement = 'bottom';
3248
+ this.panelMaxHeightPx = null;
3181
3249
  }
3182
3250
  onChange(event) {
3183
3251
  this.valueChange.emit(event.target.value);
@@ -3198,13 +3266,40 @@ class PdmSelectComponent {
3198
3266
  onEscape() {
3199
3267
  this.open = false;
3200
3268
  }
3269
+ onViewportChange() {
3270
+ this.updatePanelPlacement();
3271
+ }
3272
+ schedulePanelPlacementUpdate() {
3273
+ setTimeout(() => this.updatePanelPlacement());
3274
+ }
3275
+ updatePanelPlacement() {
3276
+ var _a, _b;
3277
+ if (!this.open)
3278
+ return;
3279
+ const triggerEl = (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.nativeElement;
3280
+ const panelEl = (_b = this.panelRef) === null || _b === void 0 ? void 0 : _b.nativeElement;
3281
+ if (!triggerEl || !panelEl || typeof window === 'undefined') {
3282
+ return;
3283
+ }
3284
+ const viewportHeight = window.innerHeight;
3285
+ const gap = 4;
3286
+ const triggerRect = triggerEl.getBoundingClientRect();
3287
+ const panelHeight = panelEl.offsetHeight;
3288
+ const spaceBelow = Math.max(0, viewportHeight - triggerRect.bottom - gap);
3289
+ const spaceAbove = Math.max(0, triggerRect.top - gap);
3290
+ const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
3291
+ const availableHeight = nextPlacement === 'top' ? spaceAbove : spaceBelow;
3292
+ this.panelPlacement = nextPlacement;
3293
+ this.panelMaxHeightPx = Math.max(120, Math.min(384, Math.floor(availableHeight)));
3294
+ this.cdr.markForCheck();
3295
+ }
3201
3296
  }
3202
- PdmSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3203
- PdmSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmSelectComponent, selector: "pdm-select", inputs: { id: "id", value: "value", options: "options", disabled: "disabled", invalid: "invalid", className: "className", placeholder: "placeholder" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)", "document:keydown.escape": "onEscape()" } }, ngImport: i0, template: "<div [ngClass]=\"['relative', className || 'w-full']\">\n <button\n type=\"button\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [attr.aria-invalid]=\"invalid\"\n [attr.aria-expanded]=\"open\"\n [attr.data-state]=\"open ? 'open' : 'closed'\"\n aria-haspopup=\"listbox\"\n (click)=\"toggle()\"\n [ngClass]=\"[\n 'border-input focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:ring-2 aria-invalid:ring-destructive aria-invalid:border-destructive flex h-9 w-full appearance-none items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',\n ]\"\n >\n <span\n [ngClass]=\"[\n 'min-w-0 flex-1 truncate text-left leading-5',\n selectedOption\n ? 'font-medium text-foreground'\n : 'font-normal text-muted-foreground',\n ]\"\n >\n {{ selectedLabel }}\n </span>\n <pdm-icon\n name=\"chevron-down\"\n [size]=\"16\"\n className=\"shrink-0 text-muted-foreground\"\n ></pdm-icon>\n </button>\n\n <div\n *ngIf=\"open\"\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"absolute left-0 top-[calc(100%+4px)] z-50 max-h-96 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md\"\n >\n <button\n *ngFor=\"let option of options\"\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"option.value === value\"\n [disabled]=\"option.disabled\"\n (click)=\"selectOption(option)\"\n [ngClass]=\"[\n 'flex w-full appearance-none items-center justify-between rounded-sm border-0 bg-transparent px-2 py-1.5 text-left text-sm outline-none transition-colors',\n option.disabled\n ? 'cursor-not-allowed opacity-50'\n : 'hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground',\n option.value === value ? 'text-foreground' : '',\n ]\"\n >\n <span class=\"min-w-0 flex-1 truncate leading-5\">{{ option.label }}</span>\n <span\n *ngIf=\"option.value === value\"\n class=\"ml-2 flex shrink-0 items-center justify-end\"\n >\n <pdm-icon\n name=\"check\"\n [size]=\"16\"\n className=\"shrink-0 text-current\"\n ></pdm-icon>\n </span>\n </button>\n </div>\n\n <select\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"value\"\n (change)=\"onChange($event)\"\n >\n <option\n *ngFor=\"let option of options\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PdmIconComponent, selector: "pdm-icon", inputs: ["name", "library", "assetUrl", "size", "strokeWidth", "className", "ariaLabel", "decorative"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3297
+ PdmSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3298
+ PdmSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmSelectComponent, selector: "pdm-select", inputs: { id: "id", value: "value", options: "options", disabled: "disabled", invalid: "invalid", className: "className", placeholder: "placeholder" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)", "document:keydown.escape": "onEscape()", "window:resize": "onViewportChange()", "window:scroll": "onViewportChange()" } }, viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelRef", first: true, predicate: ["panelEl"], descendants: true }], ngImport: i0, template: "<div [ngClass]=\"['relative', className || 'w-full']\">\n <button\n #triggerEl\n type=\"button\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [attr.aria-invalid]=\"invalid\"\n [attr.aria-expanded]=\"open\"\n [attr.data-state]=\"open ? 'open' : 'closed'\"\n aria-haspopup=\"listbox\"\n (click)=\"toggle()\"\n [ngClass]=\"[\n 'border-input focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:ring-2 aria-invalid:ring-destructive aria-invalid:border-destructive flex h-9 w-full appearance-none items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',\n ]\"\n >\n <span\n [ngClass]=\"[\n 'min-w-0 flex-1 truncate text-left leading-5',\n selectedOption\n ? 'font-medium text-foreground'\n : 'font-normal text-muted-foreground',\n ]\"\n >\n {{ selectedLabel }}\n </span>\n <pdm-icon\n name=\"chevron-down\"\n [size]=\"16\"\n className=\"shrink-0 text-muted-foreground\"\n ></pdm-icon>\n </button>\n\n <div\n *ngIf=\"open\"\n #panelEl\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n [ngClass]=\"panelClasses\"\n [style.max-height.px]=\"panelMaxHeightPx\"\n >\n <button\n *ngFor=\"let option of options\"\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"option.value === value\"\n [disabled]=\"option.disabled\"\n (click)=\"selectOption(option)\"\n [ngClass]=\"[\n 'flex w-full appearance-none items-center justify-between rounded-sm border-0 bg-transparent px-2 py-1.5 text-left text-sm outline-none transition-colors',\n option.disabled\n ? 'cursor-not-allowed opacity-50'\n : 'hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground',\n option.value === value ? 'text-foreground' : '',\n ]\"\n >\n <span class=\"min-w-0 flex-1 truncate leading-5\">{{ option.label }}</span>\n <span\n *ngIf=\"option.value === value\"\n class=\"ml-2 flex shrink-0 items-center justify-end\"\n >\n <pdm-icon\n name=\"check\"\n [size]=\"16\"\n className=\"shrink-0 text-current\"\n ></pdm-icon>\n </span>\n </button>\n </div>\n\n <select\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"value\"\n (change)=\"onChange($event)\"\n >\n <option\n *ngFor=\"let option of options\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PdmIconComponent, selector: "pdm-icon", inputs: ["name", "library", "assetUrl", "size", "strokeWidth", "className", "ariaLabel", "decorative"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3204
3299
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSelectComponent, decorators: [{
3205
3300
  type: Component,
3206
- args: [{ selector: 'pdm-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"['relative', className || 'w-full']\">\n <button\n type=\"button\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [attr.aria-invalid]=\"invalid\"\n [attr.aria-expanded]=\"open\"\n [attr.data-state]=\"open ? 'open' : 'closed'\"\n aria-haspopup=\"listbox\"\n (click)=\"toggle()\"\n [ngClass]=\"[\n 'border-input focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:ring-2 aria-invalid:ring-destructive aria-invalid:border-destructive flex h-9 w-full appearance-none items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',\n ]\"\n >\n <span\n [ngClass]=\"[\n 'min-w-0 flex-1 truncate text-left leading-5',\n selectedOption\n ? 'font-medium text-foreground'\n : 'font-normal text-muted-foreground',\n ]\"\n >\n {{ selectedLabel }}\n </span>\n <pdm-icon\n name=\"chevron-down\"\n [size]=\"16\"\n className=\"shrink-0 text-muted-foreground\"\n ></pdm-icon>\n </button>\n\n <div\n *ngIf=\"open\"\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n class=\"absolute left-0 top-[calc(100%+4px)] z-50 max-h-96 w-full overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md\"\n >\n <button\n *ngFor=\"let option of options\"\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"option.value === value\"\n [disabled]=\"option.disabled\"\n (click)=\"selectOption(option)\"\n [ngClass]=\"[\n 'flex w-full appearance-none items-center justify-between rounded-sm border-0 bg-transparent px-2 py-1.5 text-left text-sm outline-none transition-colors',\n option.disabled\n ? 'cursor-not-allowed opacity-50'\n : 'hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground',\n option.value === value ? 'text-foreground' : '',\n ]\"\n >\n <span class=\"min-w-0 flex-1 truncate leading-5\">{{ option.label }}</span>\n <span\n *ngIf=\"option.value === value\"\n class=\"ml-2 flex shrink-0 items-center justify-end\"\n >\n <pdm-icon\n name=\"check\"\n [size]=\"16\"\n className=\"shrink-0 text-current\"\n ></pdm-icon>\n </span>\n </button>\n </div>\n\n <select\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"value\"\n (change)=\"onChange($event)\"\n >\n <option\n *ngFor=\"let option of options\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n</div>\n" }]
3207
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { id: [{
3301
+ args: [{ selector: 'pdm-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"['relative', className || 'w-full']\">\n <button\n #triggerEl\n type=\"button\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [attr.aria-invalid]=\"invalid\"\n [attr.aria-expanded]=\"open\"\n [attr.data-state]=\"open ? 'open' : 'closed'\"\n aria-haspopup=\"listbox\"\n (click)=\"toggle()\"\n [ngClass]=\"[\n 'border-input focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 aria-invalid:ring-2 aria-invalid:ring-destructive aria-invalid:border-destructive flex h-9 w-full appearance-none items-center justify-between rounded-md border bg-background px-3 py-2 text-sm shadow-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',\n ]\"\n >\n <span\n [ngClass]=\"[\n 'min-w-0 flex-1 truncate text-left leading-5',\n selectedOption\n ? 'font-medium text-foreground'\n : 'font-normal text-muted-foreground',\n ]\"\n >\n {{ selectedLabel }}\n </span>\n <pdm-icon\n name=\"chevron-down\"\n [size]=\"16\"\n className=\"shrink-0 text-muted-foreground\"\n ></pdm-icon>\n </button>\n\n <div\n *ngIf=\"open\"\n #panelEl\n role=\"listbox\"\n [attr.aria-labelledby]=\"id || null\"\n [ngClass]=\"panelClasses\"\n [style.max-height.px]=\"panelMaxHeightPx\"\n >\n <button\n *ngFor=\"let option of options\"\n type=\"button\"\n role=\"option\"\n [attr.aria-selected]=\"option.value === value\"\n [disabled]=\"option.disabled\"\n (click)=\"selectOption(option)\"\n [ngClass]=\"[\n 'flex w-full appearance-none items-center justify-between rounded-sm border-0 bg-transparent px-2 py-1.5 text-left text-sm outline-none transition-colors',\n option.disabled\n ? 'cursor-not-allowed opacity-50'\n : 'hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground',\n option.value === value ? 'text-foreground' : '',\n ]\"\n >\n <span class=\"min-w-0 flex-1 truncate leading-5\">{{ option.label }}</span>\n <span\n *ngIf=\"option.value === value\"\n class=\"ml-2 flex shrink-0 items-center justify-end\"\n >\n <pdm-icon\n name=\"check\"\n [size]=\"16\"\n className=\"shrink-0 text-current\"\n ></pdm-icon>\n </span>\n </button>\n </div>\n\n <select\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"value\"\n (change)=\"onChange($event)\"\n >\n <option\n *ngFor=\"let option of options\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n</div>\n" }]
3302
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
3208
3303
  type: Input
3209
3304
  }], value: [{
3210
3305
  type: Input
@@ -3220,12 +3315,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3220
3315
  type: Input
3221
3316
  }], valueChange: [{
3222
3317
  type: Output
3318
+ }], triggerRef: [{
3319
+ type: ViewChild,
3320
+ args: ['triggerEl']
3321
+ }], panelRef: [{
3322
+ type: ViewChild,
3323
+ args: ['panelEl']
3223
3324
  }], onDocumentClick: [{
3224
3325
  type: HostListener,
3225
3326
  args: ['document:click', ['$event']]
3226
3327
  }], onEscape: [{
3227
3328
  type: HostListener,
3228
3329
  args: ['document:keydown.escape']
3330
+ }], onViewportChange: [{
3331
+ type: HostListener,
3332
+ args: ['window:resize']
3333
+ }, {
3334
+ type: HostListener,
3335
+ args: ['window:scroll']
3229
3336
  }] } });
3230
3337
 
3231
3338
  class PdmPaginationComponent {
@@ -3296,14 +3403,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3296
3403
  }] } });
3297
3404
 
3298
3405
  class PdmPopoverComponent {
3299
- constructor(elementRef) {
3406
+ constructor(elementRef, cdr) {
3300
3407
  this.elementRef = elementRef;
3301
- this.open = false;
3408
+ this.cdr = cdr;
3409
+ this._open = false;
3302
3410
  this.triggerText = 'Open';
3303
3411
  this.className = '';
3304
3412
  this.panelClassName = '';
3305
3413
  this.showTrigger = true;
3306
3414
  this.openChange = new EventEmitter();
3415
+ this.panelPlacement = 'bottom';
3416
+ }
3417
+ set open(value) {
3418
+ this._open = !!value;
3419
+ if (this._open) {
3420
+ this.schedulePanelPlacementUpdate();
3421
+ }
3422
+ else {
3423
+ this.panelPlacement = 'bottom';
3424
+ }
3425
+ this.cdr.markForCheck();
3426
+ }
3427
+ get open() {
3428
+ return this._open;
3429
+ }
3430
+ get panelClasses() {
3431
+ return [
3432
+ this.panelPlacement === 'top'
3433
+ ? 'absolute bottom-full left-0 z-30 mb-2 min-w-80 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md'
3434
+ : 'absolute left-0 top-full z-30 mt-2 min-w-80 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md',
3435
+ this.panelClassName
3436
+ ];
3307
3437
  }
3308
3438
  toggle() {
3309
3439
  this.open = !this.open;
@@ -3324,15 +3454,40 @@ class PdmPopoverComponent {
3324
3454
  this.openChange.emit(false);
3325
3455
  }
3326
3456
  }
3457
+ onViewportChange() {
3458
+ this.updatePanelPlacement();
3459
+ }
3460
+ schedulePanelPlacementUpdate() {
3461
+ setTimeout(() => this.updatePanelPlacement());
3462
+ }
3463
+ updatePanelPlacement() {
3464
+ var _a, _b, _c;
3465
+ if (!this.open)
3466
+ return;
3467
+ const anchorEl = ((_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.nativeElement) || ((_b = this.anchorRef) === null || _b === void 0 ? void 0 : _b.nativeElement);
3468
+ const panelEl = (_c = this.panelRef) === null || _c === void 0 ? void 0 : _c.nativeElement;
3469
+ if (!anchorEl || !panelEl || typeof window === 'undefined') {
3470
+ return;
3471
+ }
3472
+ const viewportHeight = window.innerHeight;
3473
+ const gap = 8;
3474
+ const anchorRect = anchorEl.getBoundingClientRect();
3475
+ const panelHeight = panelEl.offsetHeight;
3476
+ const spaceBelow = Math.max(0, viewportHeight - anchorRect.bottom - gap);
3477
+ const spaceAbove = Math.max(0, anchorRect.top - gap);
3478
+ const nextPlacement = spaceBelow < panelHeight && spaceAbove > spaceBelow ? 'top' : 'bottom';
3479
+ if (this.panelPlacement !== nextPlacement) {
3480
+ this.panelPlacement = nextPlacement;
3481
+ this.cdr.markForCheck();
3482
+ }
3483
+ }
3327
3484
  }
3328
- PdmPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmPopoverComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3329
- PdmPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmPopoverComponent, selector: "pdm-popover", inputs: { open: "open", triggerText: "triggerText", className: "className", panelClassName: "panelClassName", showTrigger: "showTrigger" }, outputs: { openChange: "openChange" }, host: { listeners: { "document:keydown.escape": "onEsc()", "document:click": "onDocumentClick($event)" } }, ngImport: i0, template: "<div class=\"relative inline-block\" [ngClass]=\"className\">\n <button *ngIf=\"showTrigger\" type=\"button\" class=\"inline-flex h-9 appearance-none items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground shadow-sm\" [attr.aria-expanded]=\"open\" (click)=\"toggle()\">{{ triggerText }}</button>\n <div *ngIf=\"open || !showTrigger\" [ngClass]=\"['absolute left-0 top-full z-30 mt-2 min-w-80 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md', panelClassName]\">\n <ng-content></ng-content>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3485
+ PdmPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmPopoverComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3486
+ PdmPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmPopoverComponent, selector: "pdm-popover", inputs: { triggerText: "triggerText", className: "className", panelClassName: "panelClassName", showTrigger: "showTrigger", open: "open" }, outputs: { openChange: "openChange" }, host: { listeners: { "document:keydown.escape": "onEsc()", "document:click": "onDocumentClick($event)", "window:resize": "onViewportChange()", "window:scroll": "onViewportChange()" } }, viewQueries: [{ propertyName: "anchorRef", first: true, predicate: ["anchorEl"], descendants: true }, { propertyName: "triggerRef", first: true, predicate: ["triggerEl"], descendants: true }, { propertyName: "panelRef", first: true, predicate: ["panelEl"], descendants: true }], ngImport: i0, template: "<div #anchorEl class=\"relative inline-block\" [ngClass]=\"className\">\n <button #triggerEl *ngIf=\"showTrigger\" type=\"button\" class=\"inline-flex h-9 appearance-none items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground shadow-sm\" [attr.aria-expanded]=\"open\" (click)=\"toggle()\">{{ triggerText }}</button>\n <div #panelEl *ngIf=\"open || !showTrigger\" [ngClass]=\"panelClasses\">\n <ng-content></ng-content>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3330
3487
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmPopoverComponent, decorators: [{
3331
3488
  type: Component,
3332
- args: [{ selector: 'pdm-popover', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative inline-block\" [ngClass]=\"className\">\n <button *ngIf=\"showTrigger\" type=\"button\" class=\"inline-flex h-9 appearance-none items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground shadow-sm\" [attr.aria-expanded]=\"open\" (click)=\"toggle()\">{{ triggerText }}</button>\n <div *ngIf=\"open || !showTrigger\" [ngClass]=\"['absolute left-0 top-full z-30 mt-2 min-w-80 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md', panelClassName]\">\n <ng-content></ng-content>\n </div>\n</div>\n" }]
3333
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { open: [{
3334
- type: Input
3335
- }], triggerText: [{
3489
+ args: [{ selector: 'pdm-popover', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #anchorEl class=\"relative inline-block\" [ngClass]=\"className\">\n <button #triggerEl *ngIf=\"showTrigger\" type=\"button\" class=\"inline-flex h-9 appearance-none items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground shadow-sm\" [attr.aria-expanded]=\"open\" (click)=\"toggle()\">{{ triggerText }}</button>\n <div #panelEl *ngIf=\"open || !showTrigger\" [ngClass]=\"panelClasses\">\n <ng-content></ng-content>\n </div>\n</div>\n" }]
3490
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { triggerText: [{
3336
3491
  type: Input
3337
3492
  }], className: [{
3338
3493
  type: Input
@@ -3342,12 +3497,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3342
3497
  type: Input
3343
3498
  }], openChange: [{
3344
3499
  type: Output
3500
+ }], anchorRef: [{
3501
+ type: ViewChild,
3502
+ args: ['anchorEl']
3503
+ }], triggerRef: [{
3504
+ type: ViewChild,
3505
+ args: ['triggerEl']
3506
+ }], panelRef: [{
3507
+ type: ViewChild,
3508
+ args: ['panelEl']
3509
+ }], open: [{
3510
+ type: Input
3345
3511
  }], onEsc: [{
3346
3512
  type: HostListener,
3347
3513
  args: ['document:keydown.escape']
3348
3514
  }], onDocumentClick: [{
3349
3515
  type: HostListener,
3350
3516
  args: ['document:click', ['$event']]
3517
+ }], onViewportChange: [{
3518
+ type: HostListener,
3519
+ args: ['window:resize']
3520
+ }, {
3521
+ type: HostListener,
3522
+ args: ['window:scroll']
3351
3523
  }] } });
3352
3524
 
3353
3525
  class PdmProgressComponent {