@patter/ngx-components 0.5.7 → 0.5.9

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,22 +1,21 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Input, signal, EventEmitter, computed, HostBinding, Output, inject, ChangeDetectorRef, DestroyRef, ElementRef, ViewContainerRef, Renderer2, Directive, Injectable, ViewChild, createComponent } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, Input, signal, EventEmitter, computed, HostBinding, Output, ViewChild, forwardRef, HostListener, inject, ChangeDetectorRef, DestroyRef, ElementRef, ViewContainerRef, Renderer2, Directive, Injectable, createComponent } from '@angular/core';
3
3
  import * as i1 from '@angular/router';
4
4
  import { RouterModule, RouterLink, Router, ActivatedRoute, TitleStrategy, NavigationEnd } from '@angular/router';
5
5
  import * as i1$1 from '@angular/common';
6
6
  import { CommonModule } from '@angular/common';
7
- import * as i2 from '@angular/forms';
8
- import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
9
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
10
- import { Observable, filter, map, Subject } from 'rxjs';
7
+ import * as i1$2 from '@angular/forms';
8
+ import { FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule, FormBuilder } from '@angular/forms';
9
+ import { Subject, debounceTime, distinctUntilChanged, switchMap, of, filter, map } from 'rxjs';
11
10
 
12
11
  class PtrMenuComponent {
13
12
  menuItems = [];
14
13
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrMenuComponent, isStandalone: true, selector: "ptr-menu", inputs: { menuItems: "menuItems" }, ngImport: i0, template: "<nav class=\"ptr-menu\">\n <ul class=\"menu\">\n @for (item of menuItems; track item) {\n <li class=\"menu-item\" routerLinkActive=\"current_page_item\"\n [routerLinkActiveOptions]=\"{exact: true}\">\n <a [routerLink]=\"item.link || '#'\">{{item.label}}</a>\n </li>\n }\n </ul>\n</nav>\n", styles: [".menu{display:flex;flex-direction:row;gap:var(--wp--custom--content--gap, 40px);align-items:center}.menu>ul{display:flex;flex-direction:row;gap:var(--wp--custom--content--gap, 40px);align-items:center}.menu--vertical{flex-direction:column;align-items:flex-start;gap:calc(var(--wp--custom--content--gap, 40px) / 2)}.menu--vertical>ul{flex-direction:column;align-items:flex-start;gap:calc(var(--wp--custom--content--gap, 40px) / 2)}.menu li.current-menu-item>a,.menu li.current_page_item>a,.menu li.current-menu-parent>a{opacity:1;font-weight:700}.menu a{transition:color .33s}.menu a:hover,.menu a:focus{text-decoration:none}.menu a{position:relative;text-decoration:none;padding:8px 0;font-family:var(--wp--preset--font-family--heading-font);letter-spacing:-.72px;color:var(--ptr-menu-color, var(--wp--preset--color--black))}.menu a:before,.menu a:after{content:\"\";position:absolute;bottom:2px;left:0;right:0;height:2px;background-color:var(--wp--preset--color--primary)}.menu a:before{opacity:0;transform:translateY(-8px);transition:transform 0s cubic-bezier(.175,.885,.32,1.275),opacity 0s}.menu a:after{opacity:0;transform:translateY(4px);transition:transform .2s cubic-bezier(.175,.885,.32,1.275),opacity .2s}.menu a:hover:before,.menu a:hover:after,.menu a:focus:before,.menu a:focus:after{opacity:1;transform:translateY(0)}.menu a:hover:before,.menu a:focus:before{transition:transform .2s cubic-bezier(.175,.885,.32,1.275),opacity .2s}.menu a:hover:after,.menu a:focus:after{transition:transform 0s .2s cubic-bezier(.175,.885,.32,1.275),opacity 0s .2s}\n"], dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
14
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrMenuComponent, isStandalone: true, selector: "ptr-menu", inputs: { menuItems: "menuItems" }, ngImport: i0, template: "<nav class=\"ptr-menu\">\n <ul class=\"menu\">\n @for (item of menuItems; track item.label) {\n <li class=\"menu-item\" routerLinkActive=\"current_page_item\" [routerLinkActiveOptions]=\"{exact: true}\">\n <a [routerLink]=\"item.link || '#'\">{{item.label}}</a>\n </li>\n }\n </ul>\n</nav>\n", styles: [".menu{display:flex;flex-direction:row;gap:var(--wp--custom--content--gap, 40px);align-items:center}.menu>ul{display:flex;flex-direction:row;gap:var(--wp--custom--content--gap, 40px);align-items:center}.menu--vertical{flex-direction:column;align-items:flex-start;gap:calc(var(--wp--custom--content--gap, 40px) / 2)}.menu--vertical>ul{flex-direction:column;align-items:flex-start;gap:calc(var(--wp--custom--content--gap, 40px) / 2)}.menu li.current-menu-item>a,.menu li.current_page_item>a,.menu li.current-menu-parent>a{opacity:1;font-weight:700}.menu a{transition:color .33s}.menu a:hover,.menu a:focus{text-decoration:none}.menu a{position:relative;text-decoration:none;padding:8px 0;font-family:var(--wp--preset--font-family--heading-font);letter-spacing:-.72px;color:var(--ptr-menu-color, var(--wp--preset--color--black))}.menu a:before,.menu a:after{content:\"\";position:absolute;bottom:2px;left:0;right:0;height:2px;background-color:var(--wp--preset--color--primary)}.menu a:before{opacity:0;transform:translateY(-8px);transition:transform 0s cubic-bezier(.175,.885,.32,1.275),opacity 0s}.menu a:after{opacity:0;transform:translateY(4px);transition:transform .2s cubic-bezier(.175,.885,.32,1.275),opacity .2s}.menu a:hover:before,.menu a:hover:after,.menu a:focus:before,.menu a:focus:after{opacity:1;transform:translateY(0)}.menu a:hover:before,.menu a:focus:before{transition:transform .2s cubic-bezier(.175,.885,.32,1.275),opacity .2s}.menu a:hover:after,.menu a:focus:after{transition:transform 0s .2s cubic-bezier(.175,.885,.32,1.275),opacity 0s .2s}\n"], dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
16
15
  }
17
16
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrMenuComponent, decorators: [{
18
17
  type: Component,
19
- args: [{ selector: 'ptr-menu', standalone: true, imports: [RouterModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nav class=\"ptr-menu\">\n <ul class=\"menu\">\n @for (item of menuItems; track item) {\n <li class=\"menu-item\" routerLinkActive=\"current_page_item\"\n [routerLinkActiveOptions]=\"{exact: true}\">\n <a [routerLink]=\"item.link || '#'\">{{item.label}}</a>\n </li>\n }\n </ul>\n</nav>\n", styles: [".menu{display:flex;flex-direction:row;gap:var(--wp--custom--content--gap, 40px);align-items:center}.menu>ul{display:flex;flex-direction:row;gap:var(--wp--custom--content--gap, 40px);align-items:center}.menu--vertical{flex-direction:column;align-items:flex-start;gap:calc(var(--wp--custom--content--gap, 40px) / 2)}.menu--vertical>ul{flex-direction:column;align-items:flex-start;gap:calc(var(--wp--custom--content--gap, 40px) / 2)}.menu li.current-menu-item>a,.menu li.current_page_item>a,.menu li.current-menu-parent>a{opacity:1;font-weight:700}.menu a{transition:color .33s}.menu a:hover,.menu a:focus{text-decoration:none}.menu a{position:relative;text-decoration:none;padding:8px 0;font-family:var(--wp--preset--font-family--heading-font);letter-spacing:-.72px;color:var(--ptr-menu-color, var(--wp--preset--color--black))}.menu a:before,.menu a:after{content:\"\";position:absolute;bottom:2px;left:0;right:0;height:2px;background-color:var(--wp--preset--color--primary)}.menu a:before{opacity:0;transform:translateY(-8px);transition:transform 0s cubic-bezier(.175,.885,.32,1.275),opacity 0s}.menu a:after{opacity:0;transform:translateY(4px);transition:transform .2s cubic-bezier(.175,.885,.32,1.275),opacity .2s}.menu a:hover:before,.menu a:hover:after,.menu a:focus:before,.menu a:focus:after{opacity:1;transform:translateY(0)}.menu a:hover:before,.menu a:focus:before{transition:transform .2s cubic-bezier(.175,.885,.32,1.275),opacity .2s}.menu a:hover:after,.menu a:focus:after{transition:transform 0s .2s cubic-bezier(.175,.885,.32,1.275),opacity 0s .2s}\n"] }]
18
+ args: [{ selector: 'ptr-menu', standalone: true, imports: [RouterModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nav class=\"ptr-menu\">\n <ul class=\"menu\">\n @for (item of menuItems; track item.label) {\n <li class=\"menu-item\" routerLinkActive=\"current_page_item\" [routerLinkActiveOptions]=\"{exact: true}\">\n <a [routerLink]=\"item.link || '#'\">{{item.label}}</a>\n </li>\n }\n </ul>\n</nav>\n", styles: [".menu{display:flex;flex-direction:row;gap:var(--wp--custom--content--gap, 40px);align-items:center}.menu>ul{display:flex;flex-direction:row;gap:var(--wp--custom--content--gap, 40px);align-items:center}.menu--vertical{flex-direction:column;align-items:flex-start;gap:calc(var(--wp--custom--content--gap, 40px) / 2)}.menu--vertical>ul{flex-direction:column;align-items:flex-start;gap:calc(var(--wp--custom--content--gap, 40px) / 2)}.menu li.current-menu-item>a,.menu li.current_page_item>a,.menu li.current-menu-parent>a{opacity:1;font-weight:700}.menu a{transition:color .33s}.menu a:hover,.menu a:focus{text-decoration:none}.menu a{position:relative;text-decoration:none;padding:8px 0;font-family:var(--wp--preset--font-family--heading-font);letter-spacing:-.72px;color:var(--ptr-menu-color, var(--wp--preset--color--black))}.menu a:before,.menu a:after{content:\"\";position:absolute;bottom:2px;left:0;right:0;height:2px;background-color:var(--wp--preset--color--primary)}.menu a:before{opacity:0;transform:translateY(-8px);transition:transform 0s cubic-bezier(.175,.885,.32,1.275),opacity 0s}.menu a:after{opacity:0;transform:translateY(4px);transition:transform .2s cubic-bezier(.175,.885,.32,1.275),opacity .2s}.menu a:hover:before,.menu a:hover:after,.menu a:focus:before,.menu a:focus:after{opacity:1;transform:translateY(0)}.menu a:hover:before,.menu a:focus:before{transition:transform .2s cubic-bezier(.175,.885,.32,1.275),opacity .2s}.menu a:hover:after,.menu a:focus:after{transition:transform 0s .2s cubic-bezier(.175,.885,.32,1.275),opacity 0s .2s}\n"] }]
20
19
  }], propDecorators: { menuItems: [{
21
20
  type: Input
22
21
  }] } });
@@ -124,34 +123,457 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
124
123
  type: Output
125
124
  }] } });
126
125
 
126
+ class PtrDialogListComponent {
127
+ set options(value) {
128
+ this._options.set(this.processOptions(value));
129
+ }
130
+ showSearch = false;
131
+ searchPlaceholder = 'Search...';
132
+ dialogTitle = '';
133
+ selectionChange = new EventEmitter();
134
+ dialogClosed = new EventEmitter();
135
+ searchTermChanged = new EventEmitter();
136
+ dialog;
137
+ _options = signal([]);
138
+ value = signal(null);
139
+ searchTerm = signal('');
140
+ highlightedIndex = signal(-1);
141
+ isOpen = signal(false);
142
+ componentId = Math.random().toString(36).substring(2);
143
+ listId = `${this.componentId}-list`;
144
+ filteredOptions = computed(() => {
145
+ const term = this.searchTerm().toLowerCase();
146
+ return this._options().flatMap(item => {
147
+ if (item.type === 'group') {
148
+ const filteredOptions = item.options.filter(option => option.label.toLowerCase().includes(term));
149
+ return filteredOptions.length > 0 ? [{ ...item, options: filteredOptions }] : [];
150
+ }
151
+ else {
152
+ return item.label.toLowerCase().includes(term) ? [item] : [];
153
+ }
154
+ });
155
+ });
156
+ openDialog() {
157
+ this.dialog.nativeElement.show();
158
+ this.adjustDialogPosition();
159
+ this.isOpen.set(true);
160
+ }
161
+ openDialogSilent() {
162
+ this.dialog.nativeElement.setAttribute('open', 'true');
163
+ this.adjustDialogPosition();
164
+ this.isOpen.set(true);
165
+ }
166
+ closeDialog() {
167
+ this.dialog.nativeElement.close();
168
+ this.isOpen.set(false);
169
+ this.searchTerm.set('');
170
+ this.highlightedIndex.set(-1);
171
+ this.dialogClosed.emit();
172
+ this.resetDialogPosition();
173
+ }
174
+ updateSearchTerm(term) {
175
+ this.searchTerm.set(term);
176
+ this.highlightedIndex.set(-1);
177
+ this.searchTermChanged.emit(term);
178
+ }
179
+ onDialogKeyDown(event) {
180
+ if (event.key === 'Escape') {
181
+ this.closeDialog();
182
+ event.preventDefault();
183
+ }
184
+ // When there is no search input and there are options, move input into the first option
185
+ if (!this.showSearch && this.filteredOptions().length > 0 && this.highlightedIndex() === -1) {
186
+ if (event.key === 'Tab' || event.key === 'ArrowDown') {
187
+ this.highlightedIndex.update(i => Math.min(i + 1, this.getTotalOptionsCount() - 1));
188
+ this.focusOption();
189
+ event.preventDefault();
190
+ }
191
+ }
192
+ }
193
+ onInputKeyDown(event) {
194
+ switch (event.key) {
195
+ case 'ArrowDown':
196
+ this.highlightedIndex.update(i => Math.min(i + 1, this.getTotalOptionsCount() - 1));
197
+ this.focusOption();
198
+ event.preventDefault();
199
+ break;
200
+ case 'Escape':
201
+ this.closeDialog();
202
+ event.preventDefault();
203
+ break;
204
+ }
205
+ }
206
+ onOptionKeyDown(event, optionValue) {
207
+ switch (event.key) {
208
+ case 'ArrowDown':
209
+ this.highlightedIndex.update(i => Math.min(i + 1, this.getTotalOptionsCount() - 1));
210
+ this.focusOption();
211
+ event.preventDefault();
212
+ break;
213
+ case 'ArrowUp':
214
+ this.highlightedIndex.update(i => Math.max(i - 1, -1));
215
+ this.focusOption();
216
+ event.preventDefault();
217
+ break;
218
+ case 'Enter':
219
+ case ' ':
220
+ this.selectOption(optionValue);
221
+ event.preventDefault();
222
+ break;
223
+ }
224
+ }
225
+ focusOption() {
226
+ if (this.highlightedIndex() >= 0) {
227
+ const options = this.dialog.nativeElement.querySelectorAll('li[role="option"]');
228
+ options[this.highlightedIndex()].focus();
229
+ }
230
+ }
231
+ selectOption(optionValue) {
232
+ this.value.set(optionValue);
233
+ this.selectionChange.emit(optionValue);
234
+ this.closeDialog();
235
+ }
236
+ getTotalOptionsCount() {
237
+ return this.filteredOptions().reduce((count, item) => {
238
+ if (item.type === 'group') {
239
+ return count + item.options.length;
240
+ }
241
+ return count + 1;
242
+ }, 0);
243
+ }
244
+ processOptions(options) {
245
+ if (!options)
246
+ return [];
247
+ return options.map(option => {
248
+ if (typeof option === 'string') {
249
+ return {
250
+ type: 'option',
251
+ label: option,
252
+ value: option
253
+ };
254
+ }
255
+ else if ('groupLabel' in option) {
256
+ return {
257
+ type: 'group',
258
+ label: option.groupLabel,
259
+ options: option.options.map(subOption => ({
260
+ type: 'option',
261
+ label: typeof subOption === 'string' ? subOption : subOption.label,
262
+ value: typeof subOption === 'string' ? subOption : subOption.value
263
+ }))
264
+ };
265
+ }
266
+ else {
267
+ return {
268
+ type: 'option',
269
+ label: option.label,
270
+ value: option.value
271
+ };
272
+ }
273
+ });
274
+ }
275
+ adjustDialogPosition() {
276
+ const dialogRect = this.dialog.nativeElement.getBoundingClientRect();
277
+ const viewportHeight = window.innerHeight;
278
+ const spaceBelow = viewportHeight - dialogRect.bottom;
279
+ if (spaceBelow > 0) {
280
+ this.dialog.nativeElement.style.top = '100%';
281
+ }
282
+ else {
283
+ this.dialog.nativeElement.style.bottom = '100%';
284
+ }
285
+ }
286
+ resetDialogPosition() {
287
+ this.dialog.nativeElement.style.top = '';
288
+ this.dialog.nativeElement.style.bottom = '';
289
+ }
290
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrDialogListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
291
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrDialogListComponent, isStandalone: true, selector: "ptr-dialog-list", inputs: { options: "options", showSearch: "showSearch", searchPlaceholder: "searchPlaceholder", dialogTitle: "dialogTitle" }, outputs: { selectionChange: "selectionChange", dialogClosed: "dialogClosed", searchTermChanged: "searchTermChanged" }, viewQueries: [{ propertyName: "dialog", first: true, predicate: ["dialog"], descendants: true }], ngImport: i0, template: "<dialog #dialog class=\"ptr-dialog-list\" (keydown)=\"onDialogKeyDown($event)\" [attr.aria-label]=\"'Options'\">\r\n\r\n @if(dialogTitle) {\r\n <p class=\"dialog-title\">{{dialogTitle}}</p>\r\n }\r\n\r\n @if (showSearch) {\r\n <div>\r\n <input #searchInput [ngModel]=\"searchTerm()\" (ngModelChange)=\"updateSearchTerm($event)\"\r\n [attr.aria-expanded]=\"isOpen()\" [attr.aria-owns]=\"listId\" (keydown)=\"onInputKeyDown($event)\"\r\n [attr.aria-autocomplete]=\"'list'\" role=\"combobox\" [attr.aria-controls]=\"listId\" [placeholder]=\"searchPlaceholder\"\r\n class=\"search-input\">\r\n </div>\r\n }\r\n\r\n <ul [attr.id]=\"listId\" role=\"listbox\" class=\"option-list\">\r\n @for (item of filteredOptions(); track item.label) {\r\n @if (item.type === 'option') {\r\n <li role=\"option\" [attr.id]=\"item.value\" [attr.aria-selected]=\"item.value === value()\"\r\n [class.selected]=\"item.value === value()\" [class.highlighted]=\"item === filteredOptions()[highlightedIndex()]\"\r\n (click)=\"selectOption(item.value!)\" (keydown)=\"onOptionKeyDown($event, item.value!)\"\r\n [attr.tabindex]=\"item === filteredOptions()[highlightedIndex()] ? 0 : -1\">\r\n {{ item.label }}\r\n </li>\r\n } @else {\r\n <li role=\"group\" [attr.aria-label]=\"item.label\">\r\n {{ item.label }}\r\n </li>\r\n @for (option of item.options!; track option.value) {\r\n <li role=\"option\" [attr.id]=\"option.value\" [attr.aria-selected]=\"option.value === value()\"\r\n [class.selected]=\"option.value === value()\" [class.highlighted]=\"option === filteredOptions()[highlightedIndex()]\"\r\n (click)=\"selectOption(option.value!)\" (keydown)=\"onOptionKeyDown($event, option.value!)\"\r\n [attr.tabindex]=\"option === filteredOptions()[highlightedIndex()] ? 0 : -1\">\r\n {{ option.label }}\r\n </li>\r\n }\r\n }\r\n }\r\n </ul>\r\n\r\n</dialog>\r\n", styles: [".ptr-dialog-list{margin:0;padding:0;border:1px solid var(--wp--custom--color--border);width:100%;max-height:350px;overflow-y:auto;z-index:5;border-radius:calc(var(--wp--custom--default-border-radius) / 2);border-top-left-radius:0;border-top-right-radius:0;scrollbar-width:thin}.ptr-dialog-list:focus{outline:none}input.search-input{padding:calc(var(--wp--custom--content--button-input-padding-y, 12px) / 1.5) var(--wp--custom--content--button-input-padding-x, 16px)!important;border:none!important;border-bottom:1px solid var(--wp--custom--color--border)!important;outline:0;font-size:var(--wp--preset--font-size--small, inherit);border-radius:0!important}.dialog-title{padding:5px 10px;border:none!important;border-bottom:1px solid var(--wp--custom--color--border)!important;font-size:var(--wp--preset--font-size--small, inherit);font-weight:500;margin:0}.option-list{list-style-type:none;padding:0;margin:0}li[role=option],li[role=group]{padding:5px 10px}li[role=group]{font-weight:700;margin-top:6px}li[role=option]{cursor:pointer;font-size:var(--wp--preset--font-size--small, inherit)}li[role=option]:hover,li[role=option].selected,li[role=option].highlighted{background-color:#f0f0f0}li[role=option]:focus-within{outline:2px solid var(--wp--custom--color--border)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
292
+ }
293
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrDialogListComponent, decorators: [{
294
+ type: Component,
295
+ args: [{ selector: 'ptr-dialog-list', standalone: true, imports: [
296
+ FormsModule
297
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<dialog #dialog class=\"ptr-dialog-list\" (keydown)=\"onDialogKeyDown($event)\" [attr.aria-label]=\"'Options'\">\r\n\r\n @if(dialogTitle) {\r\n <p class=\"dialog-title\">{{dialogTitle}}</p>\r\n }\r\n\r\n @if (showSearch) {\r\n <div>\r\n <input #searchInput [ngModel]=\"searchTerm()\" (ngModelChange)=\"updateSearchTerm($event)\"\r\n [attr.aria-expanded]=\"isOpen()\" [attr.aria-owns]=\"listId\" (keydown)=\"onInputKeyDown($event)\"\r\n [attr.aria-autocomplete]=\"'list'\" role=\"combobox\" [attr.aria-controls]=\"listId\" [placeholder]=\"searchPlaceholder\"\r\n class=\"search-input\">\r\n </div>\r\n }\r\n\r\n <ul [attr.id]=\"listId\" role=\"listbox\" class=\"option-list\">\r\n @for (item of filteredOptions(); track item.label) {\r\n @if (item.type === 'option') {\r\n <li role=\"option\" [attr.id]=\"item.value\" [attr.aria-selected]=\"item.value === value()\"\r\n [class.selected]=\"item.value === value()\" [class.highlighted]=\"item === filteredOptions()[highlightedIndex()]\"\r\n (click)=\"selectOption(item.value!)\" (keydown)=\"onOptionKeyDown($event, item.value!)\"\r\n [attr.tabindex]=\"item === filteredOptions()[highlightedIndex()] ? 0 : -1\">\r\n {{ item.label }}\r\n </li>\r\n } @else {\r\n <li role=\"group\" [attr.aria-label]=\"item.label\">\r\n {{ item.label }}\r\n </li>\r\n @for (option of item.options!; track option.value) {\r\n <li role=\"option\" [attr.id]=\"option.value\" [attr.aria-selected]=\"option.value === value()\"\r\n [class.selected]=\"option.value === value()\" [class.highlighted]=\"option === filteredOptions()[highlightedIndex()]\"\r\n (click)=\"selectOption(option.value!)\" (keydown)=\"onOptionKeyDown($event, option.value!)\"\r\n [attr.tabindex]=\"option === filteredOptions()[highlightedIndex()] ? 0 : -1\">\r\n {{ option.label }}\r\n </li>\r\n }\r\n }\r\n }\r\n </ul>\r\n\r\n</dialog>\r\n", styles: [".ptr-dialog-list{margin:0;padding:0;border:1px solid var(--wp--custom--color--border);width:100%;max-height:350px;overflow-y:auto;z-index:5;border-radius:calc(var(--wp--custom--default-border-radius) / 2);border-top-left-radius:0;border-top-right-radius:0;scrollbar-width:thin}.ptr-dialog-list:focus{outline:none}input.search-input{padding:calc(var(--wp--custom--content--button-input-padding-y, 12px) / 1.5) var(--wp--custom--content--button-input-padding-x, 16px)!important;border:none!important;border-bottom:1px solid var(--wp--custom--color--border)!important;outline:0;font-size:var(--wp--preset--font-size--small, inherit);border-radius:0!important}.dialog-title{padding:5px 10px;border:none!important;border-bottom:1px solid var(--wp--custom--color--border)!important;font-size:var(--wp--preset--font-size--small, inherit);font-weight:500;margin:0}.option-list{list-style-type:none;padding:0;margin:0}li[role=option],li[role=group]{padding:5px 10px}li[role=group]{font-weight:700;margin-top:6px}li[role=option]{cursor:pointer;font-size:var(--wp--preset--font-size--small, inherit)}li[role=option]:hover,li[role=option].selected,li[role=option].highlighted{background-color:#f0f0f0}li[role=option]:focus-within{outline:2px solid var(--wp--custom--color--border)}\n"] }]
298
+ }], propDecorators: { options: [{
299
+ type: Input
300
+ }], showSearch: [{
301
+ type: Input
302
+ }], searchPlaceholder: [{
303
+ type: Input
304
+ }], dialogTitle: [{
305
+ type: Input
306
+ }], selectionChange: [{
307
+ type: Output
308
+ }], dialogClosed: [{
309
+ type: Output
310
+ }], searchTermChanged: [{
311
+ type: Output
312
+ }], dialog: [{
313
+ type: ViewChild,
314
+ args: ['dialog']
315
+ }] } });
316
+
317
+ /* eslint-disable @typescript-eslint/no-empty-function */
318
+ class PtrSelectComponent {
319
+ options;
320
+ showSearch = true;
321
+ placeholder = 'Select an option';
322
+ label = '';
323
+ description = '';
324
+ selectionChange = new EventEmitter();
325
+ selectButton;
326
+ dialogList;
327
+ value = signal(null);
328
+ displayValue = computed(() => {
329
+ const currentValue = this.value();
330
+ if (currentValue === null)
331
+ return null;
332
+ const allOptions = this.flattenOptions(this.options);
333
+ const selectedOption = allOptions?.find(option => option.value === currentValue);
334
+ return selectedOption ? selectedOption.label : null;
335
+ });
336
+ componentId = Math.random().toString(36).substring(2);
337
+ labelId = `${this.componentId}-label`;
338
+ inputId = `${this.componentId}-input`;
339
+ onChange = () => { };
340
+ onTouched = () => { };
341
+ onDocumentClick(event) {
342
+ if (!this.dialogList.dialog.nativeElement.contains(event.target) &&
343
+ !event.target.closest('.select-button') &&
344
+ this.dialogList.isOpen()) {
345
+ this.dialogList.closeDialog();
346
+ }
347
+ }
348
+ toggleDialog() {
349
+ if (this.dialogList.isOpen()) {
350
+ this.dialogList.closeDialog();
351
+ }
352
+ else {
353
+ this.dialogList.openDialog();
354
+ }
355
+ }
356
+ onOptionSelected(optionValue) {
357
+ this.value.set(optionValue);
358
+ this.onChange(optionValue);
359
+ this.onTouched();
360
+ this.selectionChange.emit(optionValue);
361
+ }
362
+ writeValue(value) {
363
+ this.value.set(value);
364
+ }
365
+ registerOnChange(fn) {
366
+ this.onChange = fn;
367
+ }
368
+ registerOnTouched(fn) {
369
+ this.onTouched = fn;
370
+ }
371
+ setDisabledState(isDisabled) {
372
+ if (this.selectButton?.nativeElement) {
373
+ this.selectButton.nativeElement.disabled = isDisabled;
374
+ }
375
+ }
376
+ flattenOptions(options) {
377
+ if (!options)
378
+ return [];
379
+ return options.flatMap(option => {
380
+ if (typeof option === 'string') {
381
+ return { value: option, label: option };
382
+ }
383
+ else if ('groupLabel' in option) {
384
+ return option.options;
385
+ }
386
+ else {
387
+ return option;
388
+ }
389
+ });
390
+ }
391
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
392
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrSelectComponent, isStandalone: true, selector: "ptr-select", inputs: { options: "options", showSearch: "showSearch", placeholder: "placeholder", label: "label", description: "description" }, outputs: { selectionChange: "selectionChange" }, host: { listeners: { "document:click": "onDocumentClick($event)" } }, providers: [
393
+ {
394
+ provide: NG_VALUE_ACCESSOR,
395
+ useExisting: forwardRef(() => PtrSelectComponent),
396
+ multi: true
397
+ }
398
+ ], viewQueries: [{ propertyName: "selectButton", first: true, predicate: ["selectButton"], descendants: true }, { propertyName: "dialogList", first: true, predicate: ["dialogList"], descendants: true }], ngImport: i0, template: "<label class=\"gfield_label gform-field-label\" [attr.for]=\"inputId\">{{ label }}</label>\r\n@if(description){\r\n <div class=\"gfield_description\">{{description}}</div>\r\n}\r\n<div class=\"gfield--input-wrapper ginput_container\">\r\n\r\n <button #selectButton type=\"button\" class=\"select-button\" [attr.id]=\"inputId\" [attr.aria-haspopup]=\"'listbox'\"\r\n [attr.aria-expanded]=\"dialogList.isOpen()\" [attr.aria-labelledby]=\"labelId\" (click)=\"toggleDialog()\">\r\n <span [attr.id]=\"labelId\">@if (displayValue(); as dValue) { {{dValue}} } @else { {{placeholder}} }</span>\r\n </button>\r\n\r\n <ptr-dialog-list #dialogList [options]=\"options\" (selectionChange)=\"onOptionSelected($event)\"\r\n [showSearch]=\"showSearch\" />\r\n\r\n</div>\r\n", styles: [".select-button{appearance:none;background-color:#fff;text-align:left;cursor:pointer;border:1px solid var(--wp--custom--color--border);width:100%;padding:var(--wp--custom--content--button-input-padding-y, 12px) var(--wp--custom--content--button-input-padding-x, 16px);margin:0;font-size:var(--wp--preset--font-size--small, inherit);font-family:Arial,Helvetica,sans-serif;z-index:5;color:#000;border-radius:calc(var(--wp--custom--default-border-radius) / 2);transition:border-color .3s,color .3s,background-color .3s;transition-timing-function:cubic-bezier(.2,1,.3,1);background-position:calc(100% - 4px) 50%;background-repeat:no-repeat;background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T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAKRJREFUeNrs1TEKwkAQheEvIoI2nsk7qFdIq1hoJ3gCC5sUVpY23sDKXnvrYOUBbGITG0kQjQriPlgYhmF/3ryFjbIs82nVfEEBEiAB8k+Q+q1IkqSDNVq4lMy3scIkjuP0FSdbjNHMLys6OwyQVlnXEsOS2QP6OL8jkzlmd70jus86eBT8FIu8PqGXg6oFX6ARGthgX+V1ReFnDJAACZAfhFwHAJI7HF2lZGQaAAAAAElFTkSuQmCC)}.select-button[aria-expanded=true]{border-bottom-left-radius:0;border-bottom-right-radius:0}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: PtrDialogListComponent, selector: "ptr-dialog-list", inputs: ["options", "showSearch", "searchPlaceholder", "dialogTitle"], outputs: ["selectionChange", "dialogClosed", "searchTermChanged"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
399
+ }
400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrSelectComponent, decorators: [{
401
+ type: Component,
402
+ args: [{ selector: 'ptr-select', standalone: true, imports: [
403
+ FormsModule,
404
+ ReactiveFormsModule,
405
+ PtrDialogListComponent
406
+ ], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
407
+ {
408
+ provide: NG_VALUE_ACCESSOR,
409
+ useExisting: forwardRef(() => PtrSelectComponent),
410
+ multi: true
411
+ }
412
+ ], template: "<label class=\"gfield_label gform-field-label\" [attr.for]=\"inputId\">{{ label }}</label>\r\n@if(description){\r\n <div class=\"gfield_description\">{{description}}</div>\r\n}\r\n<div class=\"gfield--input-wrapper ginput_container\">\r\n\r\n <button #selectButton type=\"button\" class=\"select-button\" [attr.id]=\"inputId\" [attr.aria-haspopup]=\"'listbox'\"\r\n [attr.aria-expanded]=\"dialogList.isOpen()\" [attr.aria-labelledby]=\"labelId\" (click)=\"toggleDialog()\">\r\n <span [attr.id]=\"labelId\">@if (displayValue(); as dValue) { {{dValue}} } @else { {{placeholder}} }</span>\r\n </button>\r\n\r\n <ptr-dialog-list #dialogList [options]=\"options\" (selectionChange)=\"onOptionSelected($event)\"\r\n [showSearch]=\"showSearch\" />\r\n\r\n</div>\r\n", styles: [".select-button{appearance:none;background-color:#fff;text-align:left;cursor:pointer;border:1px solid var(--wp--custom--color--border);width:100%;padding:var(--wp--custom--content--button-input-padding-y, 12px) var(--wp--custom--content--button-input-padding-x, 16px);margin:0;font-size:var(--wp--preset--font-size--small, inherit);font-family:Arial,Helvetica,sans-serif;z-index:5;color:#000;border-radius:calc(var(--wp--custom--default-border-radius) / 2);transition:border-color .3s,color .3s,background-color .3s;transition-timing-function:cubic-bezier(.2,1,.3,1);background-position:calc(100% - 4px) 50%;background-repeat:no-repeat;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAeCAYAAADZ7LXbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2A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3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAKRJREFUeNrs1TEKwkAQheEvIoI2nsk7qFdIq1hoJ3gCC5sUVpY23sDKXnvrYOUBbGITG0kQjQriPlgYhmF/3ryFjbIs82nVfEEBEiAB8k+Q+q1IkqSDNVq4lMy3scIkjuP0FSdbjNHMLys6OwyQVlnXEsOS2QP6OL8jkzlmd70jus86eBT8FIu8PqGXg6oFX6ARGthgX+V1ReFnDJAACZAfhFwHAJI7HF2lZGQaAAAAAElFTkSuQmCC)}.select-button[aria-expanded=true]{border-bottom-left-radius:0;border-bottom-right-radius:0}\n"] }]
413
+ }], propDecorators: { options: [{
414
+ type: Input
415
+ }], showSearch: [{
416
+ type: Input
417
+ }], placeholder: [{
418
+ type: Input
419
+ }], label: [{
420
+ type: Input
421
+ }], description: [{
422
+ type: Input
423
+ }], selectionChange: [{
424
+ type: Output
425
+ }], selectButton: [{
426
+ type: ViewChild,
427
+ args: ['selectButton']
428
+ }], dialogList: [{
429
+ type: ViewChild,
430
+ args: ['dialogList']
431
+ }], onDocumentClick: [{
432
+ type: HostListener,
433
+ args: ['document:click', ['$event']]
434
+ }] } });
435
+
436
+ /* eslint-disable @typescript-eslint/no-empty-function */
437
+ class PtrInputComponent {
438
+ type = 'text';
439
+ label = '';
440
+ placeholder = '';
441
+ autocomplete = '';
442
+ description = '';
443
+ dialogHelpText = '';
444
+ searchFn;
445
+ input;
446
+ dialogList;
447
+ componentId = Math.random().toString(36).substring(2);
448
+ minChars = 3;
449
+ searchTerms = new Subject();
450
+ hasSelectedOption = false;
451
+ inputId = `${this.componentId}-input`;
452
+ inputValue = signal('');
453
+ searchResultOptions = signal([]);
454
+ onChange = () => { };
455
+ onTouched = () => { };
456
+ onDocumentClick(event) {
457
+ if (!this.dialogList.dialog.nativeElement.contains(event.target) && this.dialogList.isOpen()) {
458
+ this.dialogList.closeDialog();
459
+ }
460
+ }
461
+ ngOnInit() {
462
+ this.setupSearch();
463
+ }
464
+ setupSearch() {
465
+ if (this.searchFn) {
466
+ this.searchTerms.pipe(debounceTime(300), distinctUntilChanged(), switchMap(term => term.length >= this.minChars ? this.searchFn(term) : of([]))).subscribe(results => {
467
+ this.searchResultOptions.set(results);
468
+ if (results.length > 0 && this.dialogList) {
469
+ this.dialogList.openDialogSilent();
470
+ }
471
+ else {
472
+ this.dialogList.closeDialog();
473
+ }
474
+ });
475
+ }
476
+ }
477
+ onInputChange(value) {
478
+ this.inputValue.set(value);
479
+ this.onChange(value);
480
+ if (!this.hasSelectedOption && this.searchFn && value.length >= this.minChars) {
481
+ this.searchTerms.next(value);
482
+ }
483
+ this.hasSelectedOption = false;
484
+ }
485
+ onOptionSelected(optionValue) {
486
+ this.hasSelectedOption = true;
487
+ this.inputValue.set(optionValue ?? '');
488
+ this.onChange(optionValue ?? '');
489
+ if (this.dialogList) {
490
+ this.dialogList.closeDialog();
491
+ }
492
+ }
493
+ onFocus() {
494
+ if (this.searchResultOptions().length > 0 && this.dialogList && !this.hasSelectedOption) {
495
+ this.dialogList.openDialogSilent();
496
+ }
497
+ }
498
+ onBlur() {
499
+ this.onTouched();
500
+ }
501
+ writeValue(value) {
502
+ this.inputValue.set(value ?? '');
503
+ }
504
+ registerOnChange(fn) {
505
+ this.onChange = fn;
506
+ }
507
+ registerOnTouched(fn) {
508
+ this.onTouched = fn;
509
+ }
510
+ setDisabledState(isDisabled) {
511
+ if (this.input?.nativeElement) {
512
+ this.input.nativeElement.disabled = isDisabled;
513
+ }
514
+ }
515
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
516
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrInputComponent, isStandalone: true, selector: "ptr-input", inputs: { type: "type", label: "label", placeholder: "placeholder", autocomplete: "autocomplete", description: "description", dialogHelpText: "dialogHelpText", searchFn: "searchFn" }, host: { listeners: { "document:click": "onDocumentClick($event)" } }, providers: [
517
+ {
518
+ provide: NG_VALUE_ACCESSOR,
519
+ useExisting: forwardRef(() => PtrInputComponent),
520
+ multi: true
521
+ }
522
+ ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }, { propertyName: "dialogList", first: true, predicate: ["dialogList"], descendants: true }], ngImport: i0, template: "<label class=\"gfield_label gform-field-label\" [attr.for]=\"inputId\">{{ label }}</label>\r\n@if(description){\r\n <div class=\"gfield_description\">{{description}}</div>\r\n}\r\n<div class=\"gfield--input-wrapper ginput_container\">\r\n\r\n <input #input [id]=\"inputId\" [type]=\"type\" [attr.autocomplete]=\"autocomplete || null\"\r\n [attr.placeholder]=\"placeholder || null\" [ngModel]=\"inputValue()\" (ngModelChange)=\"onInputChange($event)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n\r\n <ptr-dialog-list #dialogList [options]=\"searchResultOptions()\" (selectionChange)=\"onOptionSelected($event)\"\r\n [dialogTitle]=\"dialogHelpText\" />\r\n\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: PtrDialogListComponent, selector: "ptr-dialog-list", inputs: ["options", "showSearch", "searchPlaceholder", "dialogTitle"], outputs: ["selectionChange", "dialogClosed", "searchTermChanged"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
523
+ }
524
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrInputComponent, decorators: [{
525
+ type: Component,
526
+ args: [{ selector: 'ptr-input', standalone: true, imports: [
527
+ CommonModule,
528
+ FormsModule,
529
+ ReactiveFormsModule,
530
+ PtrDialogListComponent
531
+ ], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
532
+ {
533
+ provide: NG_VALUE_ACCESSOR,
534
+ useExisting: forwardRef(() => PtrInputComponent),
535
+ multi: true
536
+ }
537
+ ], template: "<label class=\"gfield_label gform-field-label\" [attr.for]=\"inputId\">{{ label }}</label>\r\n@if(description){\r\n <div class=\"gfield_description\">{{description}}</div>\r\n}\r\n<div class=\"gfield--input-wrapper ginput_container\">\r\n\r\n <input #input [id]=\"inputId\" [type]=\"type\" [attr.autocomplete]=\"autocomplete || null\"\r\n [attr.placeholder]=\"placeholder || null\" [ngModel]=\"inputValue()\" (ngModelChange)=\"onInputChange($event)\"\r\n (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\r\n\r\n <ptr-dialog-list #dialogList [options]=\"searchResultOptions()\" (selectionChange)=\"onOptionSelected($event)\"\r\n [dialogTitle]=\"dialogHelpText\" />\r\n\r\n</div>\r\n" }]
538
+ }], propDecorators: { type: [{
539
+ type: Input
540
+ }], label: [{
541
+ type: Input
542
+ }], placeholder: [{
543
+ type: Input
544
+ }], autocomplete: [{
545
+ type: Input
546
+ }], description: [{
547
+ type: Input
548
+ }], dialogHelpText: [{
549
+ type: Input
550
+ }], searchFn: [{
551
+ type: Input
552
+ }], input: [{
553
+ type: ViewChild,
554
+ args: ['input']
555
+ }], dialogList: [{
556
+ type: ViewChild,
557
+ args: ['dialogList']
558
+ }], onDocumentClick: [{
559
+ type: HostListener,
560
+ args: ['document:click', ['$event']]
561
+ }] } });
562
+
127
563
  class PtrFormComponent {
128
564
  config;
129
565
  loading = false;
130
566
  error = null;
567
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
131
568
  formSubmit = new EventEmitter();
132
569
  formGroupCreated = new EventEmitter();
133
570
  formGroup;
134
- flatOptions = {};
135
- groupedOptions = {};
136
571
  fb = inject(FormBuilder);
137
572
  cdr = inject(ChangeDetectorRef);
138
573
  destroyRef = inject(DestroyRef);
139
574
  ngOnInit() {
140
575
  this.buildForm();
141
576
  this.formGroupCreated.emit(this.formGroup);
142
- this.config.fields.forEach(field => {
143
- if (field.type === 'select' && field.options instanceof Observable) {
144
- field.options
145
- .pipe(takeUntilDestroyed(this.destroyRef))
146
- .subscribe(options => {
147
- this.processOptions(field.name, options);
148
- this.cdr.markForCheck(); // Trigger change detection after options are loaded
149
- });
150
- }
151
- else if (field.type === 'select' && Array.isArray(field.options)) {
152
- this.processOptions(field.name, field.options);
153
- }
154
- });
155
577
  }
156
578
  buildForm() {
157
579
  const group = {};
@@ -173,24 +595,18 @@ class PtrFormComponent {
173
595
  });
174
596
  this.cdr.markForCheck();
175
597
  }
176
- processOptions(fieldName, options) {
177
- if (options.length > 0 && 'options' in options[0]) {
178
- this.groupedOptions[fieldName] = options;
179
- }
180
- else {
181
- this.flatOptions[fieldName] = options;
182
- }
183
- }
184
598
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
185
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrFormComponent, isStandalone: true, selector: "ptr-form", inputs: { config: "config", loading: "loading", error: "error" }, outputs: { formSubmit: "formSubmit", formGroupCreated: "formGroupCreated" }, ngImport: i0, template: "<div [class]=\"'gform_wrapper ' + config.formClass\">\n\n @if (error) {\n <div class=\"gform_validation_errors\">\n <h2 class=\"gform_submission_error hide_summary\">{{error}}</h2>\n </div>\n }\n\n @if (config.title) {\n <div class=\"gform_heading\">\n <h2 class=\"gform_title\">{{ config.title }}</h2>\n </div>\n }\n\n <form [formGroup]=\"formGroup\" (ngSubmit)=\"onSubmit()\">\n\n <div class=\"gform_fields\">\n\n @for (field of config.fields; track field.name) {\n <div class=\"gfield gfield--width-{{field.size}}\" [class.gform_hidden]=\"field.type === 'hidden'\"\n [class.gfield_error]=\"formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched\">\n <label class=\"gfield_label gform-field-label\" [for]=\"field.name\">{{ field.label }}</label>\n @switch (field.type) {\n @case ('textarea') {\n <textarea [id]=\"field.name\" [formControlName]=\"field.name\"></textarea>\n }\n @case ('select') {\n <select [formControlName]=\"field.name\" [id]=\"field.name\">\n <!-- Render grouped options -->\n @for (group of groupedOptions[field.name]; track group) {\n <optgroup [label]=\"group.groupLabel\">\n @for (option of group.options; track option) {\n <option [value]=\"option.value\">\n {{ option.label }}\n </option>\n }\n </optgroup>\n }\n <!-- Render flat options -->\n @for (option of flatOptions[field.name]; track option) {\n <option [value]=\"option.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n @default {\n <input [formControlName]=\"field.name\" [id]=\"field.name\" [type]=\"field.type\"\n [autocomplete]=\"field.autocomplete ?? ''\" />\n }\n }\n @if (formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched) {\n <div class=\"gfield_description validation_message gfield_validation_message\"\n >\n @if (formGroup.get(field.name)?.errors?.['required']) {\n This field is required.\n }\n @if (formGroup.get(field.name)?.errors?.['email']) {\n Please enter a valid email\n address.\n }\n @if (formGroup.get(field.name)?.errors?.['minlength']) {\n Minimum length is {{ formGroup.get(field.name)?.errors?.['minlength'].requiredLength }} characters.\n }\n @if (formGroup.get(field.name)?.errors?.['maxlength']) {\n Maximum length is {{ formGroup.get(field.name)?.errors?.['maxlength'].requiredLength }} characters.\n }\n @if (formGroup.get(field.name)?.errors?.['pattern']) {\n Please match the required format.\n }\n </div>\n }\n @if (field.validationMessages && formGroup.invalid && !formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched) {\n @for (error of formGroup.errors | keyvalue; track error) {\n @if (field.validationMessages[error.key]) {\n <div\n class=\"gfield_description validation_message gfield_validation_message\">\n {{ field.validationMessages[error.key] }}\n </div>\n }\n }\n }\n </div>\n }\n </div>\n\n <div class=\"gform_footer\">\n <ptr-button buttonType=\"submit\" [isDisabled]=\"loading || !formGroup.valid\">{{config.submitText}}</ptr-button>\n </div>\n\n </form>\n </div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1$1.KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: PtrButtonComponent, selector: "ptr-button", inputs: ["buttonStyle", "buttonType", "isDisabled", "hrefLink", "routerLinkValue", "extraClasses", "isSmallSize", "isIconButton"], outputs: ["clicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
599
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrFormComponent, isStandalone: true, selector: "ptr-form", inputs: { config: "config", loading: "loading", error: "error" }, outputs: { formSubmit: "formSubmit", formGroupCreated: "formGroupCreated" }, ngImport: i0, template: "<div [class]=\"'gform_wrapper ' + config.formClass\">\r\n\r\n @if (error) {\r\n <div class=\"gform_validation_errors\">\r\n <h2 class=\"gform_submission_error hide_summary\">{{error}}</h2>\r\n </div>\r\n }\r\n\r\n @if (config.title) {\r\n <div class=\"gform_heading\">\r\n <h2 class=\"gform_title\">{{ config.title }}</h2>\r\n </div>\r\n }\r\n\r\n <form [formGroup]=\"formGroup\" (ngSubmit)=\"onSubmit()\">\r\n\r\n <div class=\"gform_fields\">\r\n\r\n @for (field of config.fields; track field.name) {\r\n <div class=\"gfield gfield--width-{{field.size}}\" [class.gform_hidden]=\"field.type === 'hidden'\"\r\n [class.gfield_error]=\"formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched\">\r\n\r\n @switch (field.type) {\r\n @case ('textarea') {\r\n <label class=\"gfield_label gform-field-label\" [for]=\"field.name\">{{ field.label }}</label>\r\n @if(field.description){\r\n <div class=\"gfield_description\">{{field.description}}</div>\r\n }\r\n <div class=\"gfield--input-wrapper ginput_container\">\r\n <textarea [id]=\"field.name\" [formControlName]=\"field.name\" [attr.placeholder]=\"field.placeholder || null\"></textarea>\r\n </div>\r\n }\r\n @case ('select') {\r\n <ptr-select [label]=\"field.label\" [formControlName]=\"field.name\" [options]=\"field.options\" [placeholder]=\"field.placeholder\"></ptr-select>\r\n }\r\n @default {\r\n <ptr-input [label]=\"field.label\" [formControlName]=\"field.name\" [type]=\"field.type\" [placeholder]=\"field.placeholder\"\r\n [autocomplete]=\"field.autocomplete\" [searchFn]=\"field.searchFn\" [dialogHelpText]=\"field.dialogHelpText\" />\r\n }\r\n }\r\n\r\n @if (formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched) {\r\n <div class=\"gfield_description validation_message gfield_validation_message\"\r\n >\r\n @if (formGroup.get(field.name)?.errors?.['required']) {\r\n This field is required.\r\n }\r\n @if (formGroup.get(field.name)?.errors?.['email']) {\r\n Please enter a valid email address.\r\n }\r\n @if (formGroup.get(field.name)?.errors?.['minlength']) {\r\n Minimum length is {{ formGroup.get(field.name)?.errors?.['minlength'].requiredLength }} characters.\r\n }\r\n @if (formGroup.get(field.name)?.errors?.['maxlength']) {\r\n Maximum length is {{ formGroup.get(field.name)?.errors?.['maxlength'].requiredLength }} characters.\r\n }\r\n @if (formGroup.get(field.name)?.errors?.['pattern']) {\r\n Please match the required format.\r\n }\r\n </div>\r\n }\r\n @if (field.validationMessages && formGroup.invalid && !formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched) {\r\n @for (error of formGroup.errors | keyvalue; track error) {\r\n @if (field.validationMessages[error.key]) {\r\n <div\r\n class=\"gfield_description validation_message gfield_validation_message\">\r\n {{ field.validationMessages[error.key] }}\r\n </div>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n @if(config.submitText){\r\n <div class=\"gform_footer\">\r\n <ptr-button buttonType=\"submit\" [isDisabled]=\"loading || !formGroup.valid\">{{config.submitText}}</ptr-button>\r\n </div>\r\n }\r\n\r\n </form>\r\n </div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1$1.KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: PtrButtonComponent, selector: "ptr-button", inputs: ["buttonStyle", "buttonType", "isDisabled", "hrefLink", "routerLinkValue", "extraClasses", "isSmallSize", "isIconButton"], outputs: ["clicked"] }, { kind: "component", type: PtrSelectComponent, selector: "ptr-select", inputs: ["options", "showSearch", "placeholder", "label", "description"], outputs: ["selectionChange"] }, { kind: "component", type: PtrInputComponent, selector: "ptr-input", inputs: ["type", "label", "placeholder", "autocomplete", "description", "dialogHelpText", "searchFn"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
186
600
  }
187
601
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrFormComponent, decorators: [{
188
602
  type: Component,
189
603
  args: [{ selector: 'ptr-form', standalone: true, imports: [
190
604
  CommonModule,
191
605
  ReactiveFormsModule,
192
- PtrButtonComponent
193
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"'gform_wrapper ' + config.formClass\">\n\n @if (error) {\n <div class=\"gform_validation_errors\">\n <h2 class=\"gform_submission_error hide_summary\">{{error}}</h2>\n </div>\n }\n\n @if (config.title) {\n <div class=\"gform_heading\">\n <h2 class=\"gform_title\">{{ config.title }}</h2>\n </div>\n }\n\n <form [formGroup]=\"formGroup\" (ngSubmit)=\"onSubmit()\">\n\n <div class=\"gform_fields\">\n\n @for (field of config.fields; track field.name) {\n <div class=\"gfield gfield--width-{{field.size}}\" [class.gform_hidden]=\"field.type === 'hidden'\"\n [class.gfield_error]=\"formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched\">\n <label class=\"gfield_label gform-field-label\" [for]=\"field.name\">{{ field.label }}</label>\n @switch (field.type) {\n @case ('textarea') {\n <textarea [id]=\"field.name\" [formControlName]=\"field.name\"></textarea>\n }\n @case ('select') {\n <select [formControlName]=\"field.name\" [id]=\"field.name\">\n <!-- Render grouped options -->\n @for (group of groupedOptions[field.name]; track group) {\n <optgroup [label]=\"group.groupLabel\">\n @for (option of group.options; track option) {\n <option [value]=\"option.value\">\n {{ option.label }}\n </option>\n }\n </optgroup>\n }\n <!-- Render flat options -->\n @for (option of flatOptions[field.name]; track option) {\n <option [value]=\"option.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n @default {\n <input [formControlName]=\"field.name\" [id]=\"field.name\" [type]=\"field.type\"\n [autocomplete]=\"field.autocomplete ?? ''\" />\n }\n }\n @if (formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched) {\n <div class=\"gfield_description validation_message gfield_validation_message\"\n >\n @if (formGroup.get(field.name)?.errors?.['required']) {\n This field is required.\n }\n @if (formGroup.get(field.name)?.errors?.['email']) {\n Please enter a valid email\n address.\n }\n @if (formGroup.get(field.name)?.errors?.['minlength']) {\n Minimum length is {{ formGroup.get(field.name)?.errors?.['minlength'].requiredLength }} characters.\n }\n @if (formGroup.get(field.name)?.errors?.['maxlength']) {\n Maximum length is {{ formGroup.get(field.name)?.errors?.['maxlength'].requiredLength }} characters.\n }\n @if (formGroup.get(field.name)?.errors?.['pattern']) {\n Please match the required format.\n }\n </div>\n }\n @if (field.validationMessages && formGroup.invalid && !formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched) {\n @for (error of formGroup.errors | keyvalue; track error) {\n @if (field.validationMessages[error.key]) {\n <div\n class=\"gfield_description validation_message gfield_validation_message\">\n {{ field.validationMessages[error.key] }}\n </div>\n }\n }\n }\n </div>\n }\n </div>\n\n <div class=\"gform_footer\">\n <ptr-button buttonType=\"submit\" [isDisabled]=\"loading || !formGroup.valid\">{{config.submitText}}</ptr-button>\n </div>\n\n </form>\n </div>\n" }]
606
+ PtrButtonComponent,
607
+ PtrSelectComponent,
608
+ PtrInputComponent
609
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"'gform_wrapper ' + config.formClass\">\r\n\r\n @if (error) {\r\n <div class=\"gform_validation_errors\">\r\n <h2 class=\"gform_submission_error hide_summary\">{{error}}</h2>\r\n </div>\r\n }\r\n\r\n @if (config.title) {\r\n <div class=\"gform_heading\">\r\n <h2 class=\"gform_title\">{{ config.title }}</h2>\r\n </div>\r\n }\r\n\r\n <form [formGroup]=\"formGroup\" (ngSubmit)=\"onSubmit()\">\r\n\r\n <div class=\"gform_fields\">\r\n\r\n @for (field of config.fields; track field.name) {\r\n <div class=\"gfield gfield--width-{{field.size}}\" [class.gform_hidden]=\"field.type === 'hidden'\"\r\n [class.gfield_error]=\"formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched\">\r\n\r\n @switch (field.type) {\r\n @case ('textarea') {\r\n <label class=\"gfield_label gform-field-label\" [for]=\"field.name\">{{ field.label }}</label>\r\n @if(field.description){\r\n <div class=\"gfield_description\">{{field.description}}</div>\r\n }\r\n <div class=\"gfield--input-wrapper ginput_container\">\r\n <textarea [id]=\"field.name\" [formControlName]=\"field.name\" [attr.placeholder]=\"field.placeholder || null\"></textarea>\r\n </div>\r\n }\r\n @case ('select') {\r\n <ptr-select [label]=\"field.label\" [formControlName]=\"field.name\" [options]=\"field.options\" [placeholder]=\"field.placeholder\"></ptr-select>\r\n }\r\n @default {\r\n <ptr-input [label]=\"field.label\" [formControlName]=\"field.name\" [type]=\"field.type\" [placeholder]=\"field.placeholder\"\r\n [autocomplete]=\"field.autocomplete\" [searchFn]=\"field.searchFn\" [dialogHelpText]=\"field.dialogHelpText\" />\r\n }\r\n }\r\n\r\n @if (formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched) {\r\n <div class=\"gfield_description validation_message gfield_validation_message\"\r\n >\r\n @if (formGroup.get(field.name)?.errors?.['required']) {\r\n This field is required.\r\n }\r\n @if (formGroup.get(field.name)?.errors?.['email']) {\r\n Please enter a valid email address.\r\n }\r\n @if (formGroup.get(field.name)?.errors?.['minlength']) {\r\n Minimum length is {{ formGroup.get(field.name)?.errors?.['minlength'].requiredLength }} characters.\r\n }\r\n @if (formGroup.get(field.name)?.errors?.['maxlength']) {\r\n Maximum length is {{ formGroup.get(field.name)?.errors?.['maxlength'].requiredLength }} characters.\r\n }\r\n @if (formGroup.get(field.name)?.errors?.['pattern']) {\r\n Please match the required format.\r\n }\r\n </div>\r\n }\r\n @if (field.validationMessages && formGroup.invalid && !formGroup.get(field.name)?.invalid && formGroup.get(field.name)?.touched) {\r\n @for (error of formGroup.errors | keyvalue; track error) {\r\n @if (field.validationMessages[error.key]) {\r\n <div\r\n class=\"gfield_description validation_message gfield_validation_message\">\r\n {{ field.validationMessages[error.key] }}\r\n </div>\r\n }\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n @if(config.submitText){\r\n <div class=\"gform_footer\">\r\n <ptr-button buttonType=\"submit\" [isDisabled]=\"loading || !formGroup.valid\">{{config.submitText}}</ptr-button>\r\n </div>\r\n }\r\n\r\n </form>\r\n </div>\r\n" }]
194
610
  }], propDecorators: { config: [{
195
611
  type: Input
196
612
  }], loading: [{
@@ -245,7 +661,7 @@ class PtrTitleComponent {
245
661
  return title.trim();
246
662
  }
247
663
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
248
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrTitleComponent, isStandalone: true, selector: "ptr-title", ngImport: i0, template: '@if (!(hideTitle$ | async)) {<header class="entry-header is-layout-constrained my-3"><h1 class="entry-title">{{ displayTitle$ | async }}</h1></header>}', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
664
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: PtrTitleComponent, isStandalone: true, selector: "ptr-title", ngImport: i0, template: '@if ((hideTitle$|async) === false) {<header class="entry-header is-layout-constrained my-3"><h1 class="entry-title">{{ displayTitle$ | async }}</h1></header>}', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
249
665
  }
250
666
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: PtrTitleComponent, decorators: [{
251
667
  type: Component,
@@ -253,7 +669,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
253
669
  selector: 'ptr-title',
254
670
  standalone: true,
255
671
  imports: [CommonModule],
256
- template: '@if (!(hideTitle$ | async)) {<header class="entry-header is-layout-constrained my-3"><h1 class="entry-title">{{ displayTitle$ | async }}</h1></header>}',
672
+ template: '@if ((hideTitle$|async) === false) {<header class="entry-header is-layout-constrained my-3"><h1 class="entry-title">{{ displayTitle$ | async }}</h1></header>}',
257
673
  changeDetection: ChangeDetectionStrategy.OnPush
258
674
  }]
259
675
  }] });
@@ -511,6 +927,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
511
927
  }]
512
928
  }], ctorParameters: () => [{ type: i0.ApplicationRef }, { type: i0.EnvironmentInjector }] });
513
929
 
930
+ /* eslint-disable @typescript-eslint/no-explicit-any */
514
931
  class PtrTooltipComponent {
515
932
  content = '';
516
933
  tooltipDialog;
@@ -548,5 +965,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
548
965
  * Generated bundle index. Do not edit.
549
966
  */
550
967
 
551
- export { PtrButtonComponent, PtrDialogComponent, PtrDialogService, PtrFormComponent, PtrLoadingService, PtrLoadingSpinnerComponent, PtrLoadingSpinnerDirective, PtrMenuComponent, PtrTitleComponent, PtrTooltipComponent };
968
+ export { PtrButtonComponent, PtrDialogComponent, PtrDialogService, PtrFormComponent, PtrInputComponent, PtrLoadingService, PtrLoadingSpinnerComponent, PtrLoadingSpinnerDirective, PtrMenuComponent, PtrSelectComponent, PtrTitleComponent, PtrTooltipComponent };
552
969
  //# sourceMappingURL=patter-ngx-components.mjs.map