@vsn-ux/ngx-gaia 0.2.0 → 0.2.1

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,16 +1,21 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, input, numberAttribute, Component, ViewEncapsulation, Attribute, NgModule, ChangeDetectionStrategy, Injectable, makeEnvironmentProviders, booleanAttribute, output, computed, contentChild, forwardRef, Injector, signal, linkedSignal, Directive, model, HostListener, InjectionToken, effect, TemplateRef, NgZone, Input } from '@angular/core';
2
+ import { inject, ElementRef, input, numberAttribute, Component, ViewEncapsulation, Attribute, NgModule, ChangeDetectionStrategy, Injectable, makeEnvironmentProviders, booleanAttribute, output, computed, contentChild, forwardRef, Injector, signal, linkedSignal, Directive, model, HostListener, InjectionToken, effect, TemplateRef, NgZone, Input, viewChild, contentChildren, isDevMode, afterNextRender } from '@angular/core';
3
3
  import * as i1 from 'lucide-angular';
4
4
  import { LucideAngularModule, X, CircleCheck, TriangleAlert, OctagonAlert, Info, Minus, Check, ChevronUp, ChevronDown } from 'lucide-angular';
5
- import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, CheckboxRequiredValidator } from '@angular/forms';
5
+ import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, CheckboxRequiredValidator, RequiredValidator } from '@angular/forms';
6
6
  import * as i1$1 from '@angular/cdk/menu';
7
7
  import { CdkMenu, CdkMenuItem, CdkMenuTrigger } from '@angular/cdk/menu';
8
- import { toSignal } from '@angular/core/rxjs-interop';
9
- import { merge, map, Subject, takeUntil } from 'rxjs';
10
- import { Overlay } from '@angular/cdk/overlay';
8
+ import { toSignal, outputToObservable } from '@angular/core/rxjs-interop';
9
+ import { merge, map, Subject, takeUntil, firstValueFrom } from 'rxjs';
10
+ import * as i1$3 from '@angular/cdk/overlay';
11
+ import { Overlay, OverlayModule } from '@angular/cdk/overlay';
11
12
  import { ComponentPortal } from '@angular/cdk/portal';
12
13
  import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
13
14
  import { NgTemplateOutlet } from '@angular/common';
15
+ import * as i1$2 from '@angular/cdk/listbox';
16
+ import { CdkOption, CdkListbox } from '@angular/cdk/listbox';
17
+ import * as i2 from '@angular/cdk/observers';
18
+ import { ObserversModule } from '@angular/cdk/observers';
14
19
 
15
20
  class GaIconComponent {
16
21
  elementRef = inject(ElementRef);
@@ -592,7 +597,10 @@ class GaInputDirective {
592
597
  hasWrapper = inject(GaInputComponent, { optional: true });
593
598
  implicitInvalid = signal(false);
594
599
  implicitErrors = signal(null);
595
- invalidInput = input(null, { transform: booleanAttribute });
600
+ invalidInput = input(null, {
601
+ alias: 'invalid',
602
+ transform: booleanAttribute,
603
+ });
596
604
  idInput = input(undefined, { alias: 'id' });
597
605
  invalid = computed(() => {
598
606
  return this.invalidInput() ?? this.implicitInvalid();
@@ -612,7 +620,7 @@ class GaInputDirective {
612
620
  }
613
621
  }
614
622
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Component });
615
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaInputDirective, isStandalone: true, selector: "[gaInput]", inputs: { invalidInput: { classPropertyName: "invalidInput", publicName: "invalidInput", isSignal: true, isRequired: false, transformFunction: null }, idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "class.ga-input": "!hasWrapper", "class.ga-input--invalid": "!hasWrapper && invalid()" } }, providers: [{ provide: GA_FORM_CONTROL, useExisting: GaInputDirective }], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
623
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaInputDirective, isStandalone: true, selector: "[gaInput]", inputs: { invalidInput: { classPropertyName: "invalidInput", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "class.ga-input": "!hasWrapper", "class.ga-input--invalid": "!hasWrapper && invalid()" } }, providers: [{ provide: GA_FORM_CONTROL, useExisting: GaInputDirective }], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
616
624
  }
617
625
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaInputDirective, decorators: [{
618
626
  type: Component,
@@ -1245,90 +1253,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1245
1253
  }]
1246
1254
  }] });
1247
1255
 
1248
- class GaSpinnerComponent {
1249
- size = input(32, { transform: numberAttribute });
1250
- strokeWidth = computed(() => this.size() / 5);
1251
- center = computed(() => this.size() / 2);
1252
- radius = computed(() => (this.size() - this.strokeWidth()) / 2);
1253
- circumference = computed(() => 2 * Math.PI * this.radius());
1254
- arcCircumference = computed(() => this.circumference() * 0.25);
1255
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1256
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaSpinnerComponent, isStandalone: true, selector: "ga-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-spinner" }, ngImport: i0, template: `
1257
- <svg
1258
- [attr.width]="size()"
1259
- [attr.height]="size()"
1260
- [attr.viewBox]="'0 0 ' + size() + ' ' + size()"
1261
- xmlns="http://www.w3.org/2000/svg"
1262
- >
1263
- <circle
1264
- [attr.cx]="center()"
1265
- [attr.cy]="center()"
1266
- [attr.r]="radius()"
1267
- stroke="var(--ga-color-secondary)"
1268
- [attr.stroke-width]="strokeWidth()"
1269
- fill="none"
1270
- ></circle>
1271
- <circle
1272
- [attr.cx]="center()"
1273
- [attr.cy]="center()"
1274
- [attr.r]="radius()"
1275
- stroke="var(--ga-color-primary-70)"
1276
- [attr.stroke-width]="strokeWidth()"
1277
- stroke-linecap="round"
1278
- fill="none"
1279
- [attr.stroke-dasharray]="arcCircumference() + ' ' + circumference()"
1280
- style="transform-origin: center; animation: ga-spinner__animation 1100ms linear infinite;"
1281
- ></circle>
1282
- </svg>
1283
- `, isInline: true, styles: [".ga-spinner{display:inline-block}@keyframes ga-spinner__animation{0%{transform:rotate(0)}31.82%{transform:rotate(90deg)}63.64%{transform:rotate(180deg)}81.82%{transform:rotate(270deg)}to{transform:rotate(360deg)}}\n"], encapsulation: i0.ViewEncapsulation.None });
1284
- }
1285
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerComponent, decorators: [{
1286
- type: Component,
1287
- args: [{ selector: 'ga-spinner', template: `
1288
- <svg
1289
- [attr.width]="size()"
1290
- [attr.height]="size()"
1291
- [attr.viewBox]="'0 0 ' + size() + ' ' + size()"
1292
- xmlns="http://www.w3.org/2000/svg"
1293
- >
1294
- <circle
1295
- [attr.cx]="center()"
1296
- [attr.cy]="center()"
1297
- [attr.r]="radius()"
1298
- stroke="var(--ga-color-secondary)"
1299
- [attr.stroke-width]="strokeWidth()"
1300
- fill="none"
1301
- ></circle>
1302
- <circle
1303
- [attr.cx]="center()"
1304
- [attr.cy]="center()"
1305
- [attr.r]="radius()"
1306
- stroke="var(--ga-color-primary-70)"
1307
- [attr.stroke-width]="strokeWidth()"
1308
- stroke-linecap="round"
1309
- fill="none"
1310
- [attr.stroke-dasharray]="arcCircumference() + ' ' + circumference()"
1311
- style="transform-origin: center; animation: ga-spinner__animation 1100ms linear infinite;"
1312
- ></circle>
1313
- </svg>
1314
- `, encapsulation: ViewEncapsulation.None, host: {
1315
- class: 'ga-spinner',
1316
- }, styles: [".ga-spinner{display:inline-block}@keyframes ga-spinner__animation{0%{transform:rotate(0)}31.82%{transform:rotate(90deg)}63.64%{transform:rotate(180deg)}81.82%{transform:rotate(270deg)}to{transform:rotate(360deg)}}\n"] }]
1317
- }] });
1318
-
1319
- class GaSpinnerModule {
1320
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1321
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, imports: [GaSpinnerComponent], exports: [GaSpinnerComponent] });
1322
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule });
1323
- }
1324
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, decorators: [{
1325
- type: NgModule,
1326
- args: [{
1327
- imports: [GaSpinnerComponent],
1328
- exports: [GaSpinnerComponent],
1329
- }]
1330
- }] });
1331
-
1332
1256
  /**
1333
1257
  * Provider Expression that allows ga-radio-group to register as a ControlValueAccessor.
1334
1258
  * This allows it to support [(ngModel)] and ngControl.
@@ -1490,6 +1414,697 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1490
1414
  }]
1491
1415
  }] });
1492
1416
 
1417
+ class GaOptionComponent {
1418
+ _isSelected = signal(false);
1419
+ _isActive = signal(false);
1420
+ selectComponent = inject(GaSelectComponent);
1421
+ cdkOption = inject(CdkOption, { self: true });
1422
+ value = input(null);
1423
+ disabled = input(false, { transform: booleanAttribute });
1424
+ withInput = input(false, { transform: booleanAttribute });
1425
+ selected = computed(() => this._isSelected() &&
1426
+ this.cdkOption.value !== undefined &&
1427
+ this.cdkOption.value !== null &&
1428
+ this.cdkOption.value !== '');
1429
+ active = this._isActive.asReadonly();
1430
+ ngDoCheck() {
1431
+ // NOTE: currently there is no other reliable way to track the selected state,
1432
+ // refactor once cdk will be based on signals or more appropriate events introduced
1433
+ this._isSelected.set(this.cdkOption.isSelected());
1434
+ this._isActive.set(this.cdkOption.isActive());
1435
+ }
1436
+ onClick() {
1437
+ if (!this.cdkOption.disabled) {
1438
+ this.selectComponent.autoClose();
1439
+ }
1440
+ }
1441
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1442
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaOptionComponent, isStandalone: true, selector: "ga-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, withInput: { classPropertyName: "withInput", publicName: "withInput", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick()" }, properties: { "class.ga-dropdown__item--selected": "selected()", "class.ga-dropdown__item--disabled": "cdkOption.disabled", "class.ga-dropdown__item--active": "active() && !cdkOption.disabled" }, classAttribute: "ga-dropdown__item" }, hostDirectives: [{ directive: i1$2.CdkOption, inputs: ["cdkOption", "value", "cdkOptionDisabled", "disabled", "cdkOptionTypeaheadLabel", "typeaheadLabel"] }], ngImport: i0, template: "@if (withInput()) {\n @if (selectComponent.multiple()) {\n <ga-checkbox\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n } @else {\n <ga-radio-button\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n }\n}\n<ng-content />\n", dependencies: [{ kind: "ngmodule", type: GaCheckboxModule }, { kind: "component", type: GaCheckboxComponent, selector: "ga-checkbox", inputs: ["value", "disabled", "checked", "name", "id", "indeterminate", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "aria-errormessage", "required"], outputs: ["change", "indeterminateChange"] }, { kind: "ngmodule", type: GaRadioModule }, { kind: "component", type: GaRadioButtonComponent, selector: "ga-radio-button", inputs: ["value", "id", "name", "checked", "disabled", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "aria-errormessage"], outputs: ["change"] }] });
1443
+ }
1444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaOptionComponent, decorators: [{
1445
+ type: Component,
1446
+ args: [{ selector: 'ga-option', imports: [GaCheckboxModule, GaRadioModule], hostDirectives: [
1447
+ {
1448
+ directive: CdkOption,
1449
+ inputs: [
1450
+ 'cdkOption: value',
1451
+ 'cdkOptionDisabled: disabled',
1452
+ 'cdkOptionTypeaheadLabel: typeaheadLabel',
1453
+ ],
1454
+ },
1455
+ ], host: {
1456
+ class: 'ga-dropdown__item',
1457
+ '[class.ga-dropdown__item--selected]': 'selected()',
1458
+ '[class.ga-dropdown__item--disabled]': 'cdkOption.disabled',
1459
+ '[class.ga-dropdown__item--active]': 'active() && !cdkOption.disabled',
1460
+ '(click)': 'onClick()',
1461
+ }, template: "@if (withInput()) {\n @if (selectComponent.multiple()) {\n <ga-checkbox\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n } @else {\n <ga-radio-button\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n }\n}\n<ng-content />\n" }]
1462
+ }] });
1463
+
1464
+ class GaSelectValueComponent {
1465
+ selectComponent = inject(GaSelectComponent);
1466
+ optionViewValue = computed(() => {
1467
+ const options = this.selectComponent.selectedOptions();
1468
+ if (!options.length) {
1469
+ return null;
1470
+ }
1471
+ return options
1472
+ .map((option) => option.cdkOption.element.textContent?.trim() ?? '')
1473
+ .join(', ');
1474
+ });
1475
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1476
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectValueComponent, isStandalone: true, selector: "ga-select-value", ngImport: i0, template: `{{ optionViewValue() }}`, isInline: true });
1477
+ }
1478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectValueComponent, decorators: [{
1479
+ type: Component,
1480
+ args: [{
1481
+ selector: 'ga-select-value',
1482
+ template: `{{ optionViewValue() }}`,
1483
+ }]
1484
+ }] });
1485
+
1486
+ const GA_SELECT_TRIGGER = new InjectionToken('gaSelectTrigger');
1487
+
1488
+ class GaSelectTriggerComponent {
1489
+ selectComponent = inject(GaSelectComponent);
1490
+ content = viewChild('ngContent', { read: ElementRef });
1491
+ hasCustomLabel = signal(false);
1492
+ menuStatusIcon = computed(() => {
1493
+ return this.selectComponent.isOpen() ? ChevronUp : ChevronDown;
1494
+ });
1495
+ leftIcon = input();
1496
+ ngAfterViewInit() {
1497
+ this.checkIfHasCustomLabel();
1498
+ }
1499
+ checkIfHasCustomLabel() {
1500
+ this.hasCustomLabel.set(!!this.content()?.nativeElement.children.length);
1501
+ }
1502
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1503
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectTriggerComponent, isStandalone: true, selector: "ga-select-trigger", inputs: { leftIcon: { classPropertyName: "leftIcon", publicName: "leftIcon", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "combobox", "aria-haspopup": "listbox" }, listeners: { "click": "selectComponent.toggle()", "keydown.arrowdown": "selectComponent.open(); $event.preventDefault()", "keydown.space": "selectComponent.open(); $event.preventDefault()", "keydown.enter": "selectComponent.open(); $event.preventDefault()" }, properties: { "class.ga-select--expanded": "selectComponent.isOpen()", "class.ga-select--disabled": "selectComponent.disabled()", "class.ga-select--invalid": "selectComponent.invalid()", "class.ga-select--empty": "!selectComponent.hasValue()", "attr.aria-expanded": "selectComponent.isOpen()", "attr.aria-controls": "selectComponent.listboxId()", "attr.aria-invalid": "selectComponent.invalid()", "attr.aria-disabled": "selectComponent.disabled()", "attr.aria-activedescendant": "selectComponent.activeDescendantId()", "attr.tabindex": "selectComponent.disabled() ? -1 : 0" }, classAttribute: "ga-select" }, providers: [
1504
+ {
1505
+ provide: GA_SELECT_TRIGGER,
1506
+ useExisting: forwardRef(() => GaSelectTriggerComponent),
1507
+ },
1508
+ ], viewQueries: [{ propertyName: "content", first: true, predicate: ["ngContent"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (selectComponent.hasValue()) {\n <div class=\"ga-select__value\">\n <span #ngContent (cdkObserveContent)=\"checkIfHasCustomLabel()\">\n <ng-content />\n </span>\n @if (!hasCustomLabel()) {\n <ga-select-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ selectComponent.placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n", dependencies: [{ kind: "ngmodule", type: GaInputModule }, { kind: "ngmodule", type: GaIconModule }, { kind: "component", type: GaIconComponent, selector: "ga-icon", inputs: ["icon", "size", "color", "strokeWidth"] }, { kind: "component", type: GaSelectValueComponent, selector: "ga-select-value" }, { kind: "ngmodule", type: ObserversModule }, { kind: "directive", type: i2.CdkObserveContent, selector: "[cdkObserveContent]", inputs: ["cdkObserveContentDisabled", "debounce"], outputs: ["cdkObserveContent"], exportAs: ["cdkObserveContent"] }] });
1509
+ }
1510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectTriggerComponent, decorators: [{
1511
+ type: Component,
1512
+ args: [{ selector: 'ga-select-trigger', imports: [
1513
+ GaInputModule,
1514
+ GaIconModule,
1515
+ GaSelectValueComponent,
1516
+ ObserversModule,
1517
+ ], providers: [
1518
+ {
1519
+ provide: GA_SELECT_TRIGGER,
1520
+ useExisting: forwardRef(() => GaSelectTriggerComponent),
1521
+ },
1522
+ ], host: {
1523
+ role: 'combobox',
1524
+ class: 'ga-select',
1525
+ '[class.ga-select--expanded]': 'selectComponent.isOpen()',
1526
+ '[class.ga-select--disabled]': 'selectComponent.disabled()',
1527
+ '[class.ga-select--invalid]': 'selectComponent.invalid()',
1528
+ '[class.ga-select--empty]': '!selectComponent.hasValue()',
1529
+ 'aria-haspopup': 'listbox',
1530
+ '[attr.aria-expanded]': 'selectComponent.isOpen()',
1531
+ '[attr.aria-controls]': 'selectComponent.listboxId()',
1532
+ '[attr.aria-invalid]': 'selectComponent.invalid()',
1533
+ '[attr.aria-disabled]': 'selectComponent.disabled()',
1534
+ '[attr.aria-activedescendant]': 'selectComponent.activeDescendantId()',
1535
+ '[attr.tabindex]': 'selectComponent.disabled() ? -1 : 0',
1536
+ '(click)': 'selectComponent.toggle()',
1537
+ '(keydown.arrowdown)': 'selectComponent.open(); $event.preventDefault()',
1538
+ '(keydown.space)': 'selectComponent.open(); $event.preventDefault()',
1539
+ '(keydown.enter)': 'selectComponent.open(); $event.preventDefault()',
1540
+ }, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (selectComponent.hasValue()) {\n <div class=\"ga-select__value\">\n <span #ngContent (cdkObserveContent)=\"checkIfHasCustomLabel()\">\n <ng-content />\n </span>\n @if (!hasCustomLabel()) {\n <ga-select-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ selectComponent.placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n" }]
1541
+ }] });
1542
+
1543
+ class GaSelectCustomTriggerComponent {
1544
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectCustomTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1545
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectCustomTriggerComponent, isStandalone: true, selector: "ga-select-custom-trigger", providers: [
1546
+ {
1547
+ provide: GA_SELECT_TRIGGER,
1548
+ useExisting: forwardRef(() => GaSelectCustomTriggerComponent),
1549
+ },
1550
+ ], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
1551
+ }
1552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectCustomTriggerComponent, decorators: [{
1553
+ type: Component,
1554
+ args: [{
1555
+ selector: 'ga-select-custom-trigger',
1556
+ template: `<ng-content></ng-content>`,
1557
+ providers: [
1558
+ {
1559
+ provide: GA_SELECT_TRIGGER,
1560
+ useExisting: forwardRef(() => GaSelectCustomTriggerComponent),
1561
+ },
1562
+ ],
1563
+ }]
1564
+ }] });
1565
+
1566
+ class GaSelectComponent {
1567
+ focusedTriggerElement = null;
1568
+ _onTouched;
1569
+ _onModelChanged;
1570
+ positions = [
1571
+ {
1572
+ originX: 'end',
1573
+ originY: 'bottom',
1574
+ overlayX: 'end',
1575
+ overlayY: 'top',
1576
+ offsetY: 8,
1577
+ },
1578
+ {
1579
+ originX: 'end',
1580
+ originY: 'top',
1581
+ overlayX: 'end',
1582
+ overlayY: 'bottom',
1583
+ offsetY: -8,
1584
+ },
1585
+ ];
1586
+ injector = inject(Injector);
1587
+ implicitInvalid = signal(false);
1588
+ _isOpen = signal(false);
1589
+ value = model(null);
1590
+ placeholder = input('');
1591
+ disabledInput = input(false, {
1592
+ alias: 'disabled',
1593
+ transform: booleanAttribute,
1594
+ });
1595
+ invalidInput = input(null, {
1596
+ alias: 'invalid',
1597
+ transform: booleanAttribute,
1598
+ });
1599
+ multiple = input(false, { transform: booleanAttribute });
1600
+ compareWith = input();
1601
+ withoutAutoFocus = signal(false);
1602
+ opened = output();
1603
+ closed = output();
1604
+ // TODO: if we rename this to options, it breaks, why?
1605
+ gaOptions = contentChildren(GaOptionComponent, {
1606
+ descendants: true,
1607
+ read: GaOptionComponent,
1608
+ });
1609
+ cdkListbox = contentChild.required(CdkListbox);
1610
+ explicitTrigger = contentChild(GA_SELECT_TRIGGER);
1611
+ isOpen = this._isOpen.asReadonly();
1612
+ disabled = linkedSignal(() => this.disabledInput());
1613
+ icon = computed(() => {
1614
+ return this._isOpen() ? ChevronUp : ChevronDown;
1615
+ });
1616
+ selectedOptions = computed(() => {
1617
+ return this.gaOptions().filter((option) => option.selected());
1618
+ });
1619
+ activeDescendantId = computed(() => {
1620
+ const activeOption = this.gaOptions().find((option) => option.active());
1621
+ return activeOption?.cdkOption.id;
1622
+ });
1623
+ hasValue = computed(() => {
1624
+ const value = this.value();
1625
+ if (this.multiple()) {
1626
+ return Array.isArray(value) && value.length > 0;
1627
+ }
1628
+ return value !== null && value !== undefined && value !== '';
1629
+ });
1630
+ invalid = computed(() => {
1631
+ return this.invalidInput() ?? this.implicitInvalid();
1632
+ });
1633
+ listboxId = computed(() => this.cdkListbox().id);
1634
+ constructor() {
1635
+ effect(() => {
1636
+ // if the select became disabled while open, close it
1637
+ if (this.disabled() && this._isOpen()) {
1638
+ this.close();
1639
+ }
1640
+ });
1641
+ }
1642
+ ngAfterContentInit() {
1643
+ effect(() => {
1644
+ this.cdkListbox().multiple = this.multiple();
1645
+ this.cdkListbox().useActiveDescendant = this.withoutAutoFocus();
1646
+ this.cdkListbox().compareWith = this.compareWith();
1647
+ this.cdkListbox().value = this.multiple()
1648
+ ? this.value()
1649
+ : [this.value()];
1650
+ }, { injector: this.injector });
1651
+ // track value changes (pull)
1652
+ this.cdkListbox().valueChange.subscribe(({ value }) => {
1653
+ if (!this.multiple()) {
1654
+ [value] = value;
1655
+ }
1656
+ this.value.set(value);
1657
+ this._onModelChanged?.(value);
1658
+ // this is needed because value could be also changed via keyboard
1659
+ this.autoClose();
1660
+ });
1661
+ if (isDevMode() &&
1662
+ this.explicitTrigger() instanceof GaSelectCustomTriggerComponent) {
1663
+ if (this.multiple()) {
1664
+ console.warn('<ga-select>: The `multiple` property requires custom handling when using a custom trigger component. If you have implemented the multiple selection logic in your custom trigger, you can ignore this warning. [This message is visible in dev mode only]');
1665
+ }
1666
+ }
1667
+ }
1668
+ ngDoCheck() {
1669
+ const implicitNgControl = this.injector.get(NgControl, null);
1670
+ // we can rely on computed because `ivalid` of NgControl is not a signal, yet
1671
+ if (implicitNgControl) {
1672
+ this.implicitInvalid.set(!!implicitNgControl.invalid && !!implicitNgControl.dirty);
1673
+ }
1674
+ }
1675
+ writeValue(value) {
1676
+ this.value.set(value);
1677
+ }
1678
+ registerOnChange(fn) {
1679
+ this._onModelChanged = fn;
1680
+ }
1681
+ registerOnTouched(fn) {
1682
+ this._onTouched = fn;
1683
+ }
1684
+ setDisabledState(disabled) {
1685
+ this.disabled.set(disabled);
1686
+ }
1687
+ toggle() {
1688
+ if (this._isOpen()) {
1689
+ this.close();
1690
+ }
1691
+ else {
1692
+ this.open();
1693
+ }
1694
+ }
1695
+ open() {
1696
+ if (this.disabled() || this._isOpen()) {
1697
+ return Promise.resolve();
1698
+ }
1699
+ this._isOpen.set(true);
1700
+ return firstValueFrom(outputToObservable(this.opened));
1701
+ }
1702
+ close() {
1703
+ if (!this._isOpen()) {
1704
+ return Promise.resolve();
1705
+ }
1706
+ this._isOpen.set(false);
1707
+ return firstValueFrom(outputToObservable(this.closed));
1708
+ }
1709
+ autoClose() {
1710
+ // close that was initiated by clicking the option
1711
+ if (!this.multiple()) {
1712
+ this.close();
1713
+ }
1714
+ }
1715
+ focusListbox() {
1716
+ this.cdkListbox().focus();
1717
+ }
1718
+ setPreviousItemActive() {
1719
+ this.setItemActive(-1);
1720
+ }
1721
+ setNextItemActive() {
1722
+ this.setItemActive(1);
1723
+ }
1724
+ setActiveItemAsSelected() {
1725
+ const options = this.gaOptions();
1726
+ let activeOption = options.find((option) => option.cdkOption.isActive());
1727
+ if (!activeOption && options.length > 0) {
1728
+ activeOption = options[0];
1729
+ }
1730
+ if (activeOption) {
1731
+ const { cdkOption } = activeOption;
1732
+ this.cdkListbox().toggle(cdkOption);
1733
+ let { value } = this.cdkListbox();
1734
+ if (!this.multiple()) {
1735
+ [value] = value;
1736
+ }
1737
+ this.value.set(value);
1738
+ }
1739
+ }
1740
+ onOverlayAttach() {
1741
+ this._isOpen.set(true);
1742
+ this.focusedTriggerElement = document.activeElement;
1743
+ this.opened.emit();
1744
+ if (!this.withoutAutoFocus()) {
1745
+ this.focusListbox();
1746
+ }
1747
+ }
1748
+ onOverlayDetach() {
1749
+ this._isOpen.set(false);
1750
+ this.focusedTriggerElement?.focus();
1751
+ this._onTouched?.();
1752
+ this.closed.emit();
1753
+ }
1754
+ setItemActive(direction) {
1755
+ const options = this.gaOptions();
1756
+ const currentIndex = options.findIndex(({ cdkOption }) => cdkOption.isActive());
1757
+ const findNextEnabled = (startIndex) => {
1758
+ let index = startIndex;
1759
+ for (let i = 0; i < options.length; i++) {
1760
+ // calculate next index with wrapping (using modulo)
1761
+ index = (index + direction + options.length) % options.length;
1762
+ if (!options[index].cdkOption.disabled) {
1763
+ return index;
1764
+ }
1765
+ }
1766
+ return -1; // no enabled options found
1767
+ };
1768
+ const nextIndex = findNextEnabled(currentIndex);
1769
+ if (nextIndex !== -1) {
1770
+ this.cdkListbox()._setActiveOption(options[nextIndex].cdkOption);
1771
+ }
1772
+ }
1773
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1774
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectComponent, isStandalone: true, selector: "ga-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalidInput: { classPropertyName: "invalidInput", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", opened: "opened", closed: "closed" }, providers: [
1775
+ {
1776
+ provide: NG_VALUE_ACCESSOR,
1777
+ useExisting: forwardRef(() => GaSelectComponent),
1778
+ multi: true,
1779
+ },
1780
+ ], queries: [{ propertyName: "gaOptions", predicate: GaOptionComponent, descendants: true, read: GaOptionComponent, isSignal: true }, { propertyName: "cdkListbox", first: true, predicate: CdkListbox, descendants: true, isSignal: true }, { propertyName: "explicitTrigger", first: true, predicate: GA_SELECT_TRIGGER, descendants: true, isSignal: true }], ngImport: i0, template: "<div cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\">\n @if (explicitTrigger()) {\n <ng-content\n select=\"ga-select-custom-trigger, ga-select-trigger, ga-select-searchable-trigger\"\n />\n } @else {\n <ga-select-trigger />\n }\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayLockPosition\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n>\n <ng-content select=\"ga-select-content\" />\n</ng-template>\n", styles: ["ga-select{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: GaIconModule }, { kind: "ngmodule", type: GaButtonModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$3.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1$3.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: GaSelectTriggerComponent, selector: "ga-select-trigger", inputs: ["leftIcon"] }], encapsulation: i0.ViewEncapsulation.None });
1781
+ }
1782
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComponent, decorators: [{
1783
+ type: Component,
1784
+ args: [{ selector: 'ga-select', imports: [
1785
+ GaIconModule,
1786
+ GaButtonModule,
1787
+ OverlayModule,
1788
+ GaSelectTriggerComponent,
1789
+ ], providers: [
1790
+ {
1791
+ provide: NG_VALUE_ACCESSOR,
1792
+ useExisting: forwardRef(() => GaSelectComponent),
1793
+ multi: true,
1794
+ },
1795
+ ], encapsulation: ViewEncapsulation.None, template: "<div cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\">\n @if (explicitTrigger()) {\n <ng-content\n select=\"ga-select-custom-trigger, ga-select-trigger, ga-select-searchable-trigger\"\n />\n } @else {\n <ga-select-trigger />\n }\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayLockPosition\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n>\n <ng-content select=\"ga-select-content\" />\n</ng-template>\n", styles: ["ga-select{display:inline-block}\n"] }]
1796
+ }], ctorParameters: () => [] });
1797
+
1798
+ class GaOptgroupComponent {
1799
+ label = input();
1800
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaOptgroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1801
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaOptgroupComponent, isStandalone: true, selector: "ga-optgroup", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" } }, ngImport: i0, template: `
1802
+ @if (label()) {
1803
+ <div class="ga-dropdown__caption">{{ label() }}</div>
1804
+ }
1805
+ <ng-content />
1806
+ `, isInline: true });
1807
+ }
1808
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaOptgroupComponent, decorators: [{
1809
+ type: Component,
1810
+ args: [{
1811
+ selector: 'ga-optgroup',
1812
+ template: `
1813
+ @if (label()) {
1814
+ <div class="ga-dropdown__caption">{{ label() }}</div>
1815
+ }
1816
+ <ng-content />
1817
+ `,
1818
+ host: {
1819
+ role: 'group',
1820
+ },
1821
+ }]
1822
+ }] });
1823
+
1824
+ class GaSpinnerComponent {
1825
+ size = input(32, { transform: numberAttribute });
1826
+ strokeWidth = computed(() => this.size() / 5);
1827
+ center = computed(() => this.size() / 2);
1828
+ radius = computed(() => (this.size() - this.strokeWidth()) / 2);
1829
+ circumference = computed(() => 2 * Math.PI * this.radius());
1830
+ arcCircumference = computed(() => this.circumference() * 0.25);
1831
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1832
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaSpinnerComponent, isStandalone: true, selector: "ga-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-spinner" }, ngImport: i0, template: `
1833
+ <svg
1834
+ [attr.width]="size()"
1835
+ [attr.height]="size()"
1836
+ [attr.viewBox]="'0 0 ' + size() + ' ' + size()"
1837
+ xmlns="http://www.w3.org/2000/svg"
1838
+ >
1839
+ <circle
1840
+ [attr.cx]="center()"
1841
+ [attr.cy]="center()"
1842
+ [attr.r]="radius()"
1843
+ stroke="var(--ga-color-secondary)"
1844
+ [attr.stroke-width]="strokeWidth()"
1845
+ fill="none"
1846
+ ></circle>
1847
+ <circle
1848
+ [attr.cx]="center()"
1849
+ [attr.cy]="center()"
1850
+ [attr.r]="radius()"
1851
+ stroke="var(--ga-color-primary-70)"
1852
+ [attr.stroke-width]="strokeWidth()"
1853
+ stroke-linecap="round"
1854
+ fill="none"
1855
+ [attr.stroke-dasharray]="arcCircumference() + ' ' + circumference()"
1856
+ style="transform-origin: center; animation: ga-spinner__animation 1100ms linear infinite;"
1857
+ ></circle>
1858
+ </svg>
1859
+ `, isInline: true, styles: [".ga-spinner{display:inline-block}@keyframes ga-spinner__animation{0%{transform:rotate(0)}31.82%{transform:rotate(90deg)}63.64%{transform:rotate(180deg)}81.82%{transform:rotate(270deg)}to{transform:rotate(360deg)}}\n"], encapsulation: i0.ViewEncapsulation.None });
1860
+ }
1861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerComponent, decorators: [{
1862
+ type: Component,
1863
+ args: [{ selector: 'ga-spinner', template: `
1864
+ <svg
1865
+ [attr.width]="size()"
1866
+ [attr.height]="size()"
1867
+ [attr.viewBox]="'0 0 ' + size() + ' ' + size()"
1868
+ xmlns="http://www.w3.org/2000/svg"
1869
+ >
1870
+ <circle
1871
+ [attr.cx]="center()"
1872
+ [attr.cy]="center()"
1873
+ [attr.r]="radius()"
1874
+ stroke="var(--ga-color-secondary)"
1875
+ [attr.stroke-width]="strokeWidth()"
1876
+ fill="none"
1877
+ ></circle>
1878
+ <circle
1879
+ [attr.cx]="center()"
1880
+ [attr.cy]="center()"
1881
+ [attr.r]="radius()"
1882
+ stroke="var(--ga-color-primary-70)"
1883
+ [attr.stroke-width]="strokeWidth()"
1884
+ stroke-linecap="round"
1885
+ fill="none"
1886
+ [attr.stroke-dasharray]="arcCircumference() + ' ' + circumference()"
1887
+ style="transform-origin: center; animation: ga-spinner__animation 1100ms linear infinite;"
1888
+ ></circle>
1889
+ </svg>
1890
+ `, encapsulation: ViewEncapsulation.None, host: {
1891
+ class: 'ga-spinner',
1892
+ }, styles: [".ga-spinner{display:inline-block}@keyframes ga-spinner__animation{0%{transform:rotate(0)}31.82%{transform:rotate(90deg)}63.64%{transform:rotate(180deg)}81.82%{transform:rotate(270deg)}to{transform:rotate(360deg)}}\n"] }]
1893
+ }] });
1894
+
1895
+ class GaSpinnerModule {
1896
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1897
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, imports: [GaSpinnerComponent], exports: [GaSpinnerComponent] });
1898
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule });
1899
+ }
1900
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, decorators: [{
1901
+ type: NgModule,
1902
+ args: [{
1903
+ imports: [GaSpinnerComponent],
1904
+ exports: [GaSpinnerComponent],
1905
+ }]
1906
+ }] });
1907
+
1908
+ class GaSelectContentLoadingComponent {
1909
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1910
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectContentLoadingComponent, isStandalone: true, selector: "ga-select-content-loading", host: { classAttribute: "ga-dropdown__content-spinner" }, ngImport: i0, template: `<ga-spinner size="16" />`, isInline: true, dependencies: [{ kind: "ngmodule", type: GaSpinnerModule }, { kind: "component", type: GaSpinnerComponent, selector: "ga-spinner", inputs: ["size"] }] });
1911
+ }
1912
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentLoadingComponent, decorators: [{
1913
+ type: Component,
1914
+ args: [{
1915
+ selector: 'ga-select-content-loading',
1916
+ template: `<ga-spinner size="16" />`,
1917
+ imports: [GaSpinnerModule],
1918
+ host: {
1919
+ class: 'ga-dropdown__content-spinner',
1920
+ },
1921
+ }]
1922
+ }] });
1923
+
1924
+ class GaSelectContentComponent {
1925
+ loading = input(false, { transform: booleanAttribute });
1926
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1927
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectContentComponent, isStandalone: true, selector: "ga-select-content", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-dropdown ga-dropdown__content" }, hostDirectives: [{ directive: i1$2.CdkListbox }], ngImport: i0, template: "@if (loading()) {\n <ga-select-content-loading />\n} @else {\n <ng-content />\n}\n", dependencies: [{ kind: "component", type: GaSelectContentLoadingComponent, selector: "ga-select-content-loading" }] });
1928
+ }
1929
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentComponent, decorators: [{
1930
+ type: Component,
1931
+ args: [{ selector: 'ga-select-content', imports: [GaSelectContentLoadingComponent], hostDirectives: [CdkListbox], host: {
1932
+ class: 'ga-dropdown ga-dropdown__content',
1933
+ }, template: "@if (loading()) {\n <ga-select-content-loading />\n} @else {\n <ng-content />\n}\n" }]
1934
+ }] });
1935
+
1936
+ class GaSelectComboboxTriggerComponent {
1937
+ injector = inject(Injector);
1938
+ selectComponent = inject(GaSelectComponent);
1939
+ content = viewChild('ngContent', { read: ElementRef });
1940
+ inputSearch = viewChild('inputSearch');
1941
+ hasCustomLabel = signal(false);
1942
+ menuStatusIcon = computed(() => {
1943
+ return this.selectComponent.isOpen() ? ChevronUp : ChevronDown;
1944
+ });
1945
+ textValue = model('');
1946
+ leftIcon = input();
1947
+ constructor() {
1948
+ this.selectComponent.withoutAutoFocus.set(true);
1949
+ this.selectComponent.opened.subscribe(() => {
1950
+ afterNextRender(() => {
1951
+ this.inputSearch().nativeElement.focus();
1952
+ }, { injector: this.injector });
1953
+ });
1954
+ this.selectComponent.closed.subscribe(() => this.textValue.set(''));
1955
+ }
1956
+ ngAfterViewInit() {
1957
+ this.checkIfHasCustomLabel();
1958
+ }
1959
+ checkIfHasCustomLabel() {
1960
+ this.hasCustomLabel.set(!!this.content()?.nativeElement.children.length);
1961
+ }
1962
+ toggle() {
1963
+ if (this.selectComponent.disabled()) {
1964
+ return;
1965
+ }
1966
+ if (!this.selectComponent.isOpen()) {
1967
+ this.open();
1968
+ }
1969
+ else {
1970
+ this.selectComponent.close();
1971
+ }
1972
+ }
1973
+ open() {
1974
+ this.selectComponent.open();
1975
+ }
1976
+ onInputKeyDown(event) {
1977
+ switch (event.code) {
1978
+ case 'ArrowDown':
1979
+ this.selectComponent.setNextItemActive();
1980
+ event.preventDefault();
1981
+ event.stopPropagation();
1982
+ break;
1983
+ case 'ArrowUp':
1984
+ this.selectComponent.setPreviousItemActive();
1985
+ event.preventDefault();
1986
+ event.stopPropagation();
1987
+ break;
1988
+ case 'Space':
1989
+ event.stopPropagation();
1990
+ break;
1991
+ case 'Enter':
1992
+ this.selectComponent.setActiveItemAsSelected();
1993
+ this.selectComponent.autoClose();
1994
+ event.preventDefault();
1995
+ event.stopPropagation();
1996
+ break;
1997
+ }
1998
+ }
1999
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComboboxTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2000
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectComboboxTriggerComponent, isStandalone: true, selector: "ga-select-searchable-trigger", inputs: { textValue: { classPropertyName: "textValue", publicName: "textValue", isSignal: true, isRequired: false, transformFunction: null }, leftIcon: { classPropertyName: "leftIcon", publicName: "leftIcon", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { textValue: "textValueChange" }, host: { attributes: { "role": "combobox", "aria-haspopup": "listbox" }, listeners: { "click": "toggle()", "keydown.arrowdown": "open(); $event.preventDefault()", "keydown.space": "open(); $event.preventDefault()", "keydown.enter": "open(); $event.preventDefault()" }, properties: { "class.ga-select--expanded": "selectComponent.isOpen()", "class.ga-select--disabled": "selectComponent.disabled()", "class.ga-select--invalid": "selectComponent.invalid()", "class.ga-select--empty": "!selectComponent.hasValue()", "attr.aria-expanded": "selectComponent.isOpen()", "attr.aria-owns": "selectComponent.listboxId()", "attr.aria-invalid": "selectComponent.invalid()", "attr.aria-disabled": "selectComponent.disabled()", "attr.tabindex": "selectComponent.disabled() ? -1 : 0" }, classAttribute: "ga-select" }, providers: [
2001
+ {
2002
+ provide: GA_SELECT_TRIGGER,
2003
+ useExisting: forwardRef(() => GaSelectComboboxTriggerComponent),
2004
+ },
2005
+ ], viewQueries: [{ propertyName: "content", first: true, predicate: ["ngContent"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "inputSearch", first: true, predicate: ["inputSearch"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (selectComponent.isOpen()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"textValue()\"\n (input)=\"textValue.set(inputSearch.value)\"\n (click)=\"$event.stopPropagation()\"\n [attr.aria-expanded]=\"selectComponent.isOpen()\"\n [attr.aria-controls]=\"selectComponent.listboxId()\"\n [attr.aria-activedescendant]=\"selectComponent.activeDescendantId()\"\n [placeholder]=\"selectComponent.placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n />\n} @else if (selectComponent.hasValue()) {\n <div class=\"ga-select__value\">\n <span #ngContent (cdkObserveContent)=\"checkIfHasCustomLabel()\">\n <ng-content />\n </span>\n @if (!hasCustomLabel()) {\n <ga-select-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ selectComponent.placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n", dependencies: [{ kind: "ngmodule", type: GaInputModule }, { kind: "ngmodule", type: GaIconModule }, { kind: "component", type: GaIconComponent, selector: "ga-icon", inputs: ["icon", "size", "color", "strokeWidth"] }, { kind: "component", type: GaSelectValueComponent, selector: "ga-select-value" }, { kind: "ngmodule", type: ObserversModule }, { kind: "directive", type: i2.CdkObserveContent, selector: "[cdkObserveContent]", inputs: ["cdkObserveContentDisabled", "debounce"], outputs: ["cdkObserveContent"], exportAs: ["cdkObserveContent"] }] });
2006
+ }
2007
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComboboxTriggerComponent, decorators: [{
2008
+ type: Component,
2009
+ args: [{ selector: 'ga-select-searchable-trigger', imports: [
2010
+ GaInputModule,
2011
+ GaIconModule,
2012
+ GaSelectValueComponent,
2013
+ ObserversModule,
2014
+ ], providers: [
2015
+ {
2016
+ provide: GA_SELECT_TRIGGER,
2017
+ useExisting: forwardRef(() => GaSelectComboboxTriggerComponent),
2018
+ },
2019
+ ], host: {
2020
+ role: 'combobox',
2021
+ class: 'ga-select',
2022
+ '[class.ga-select--expanded]': 'selectComponent.isOpen()',
2023
+ '[class.ga-select--disabled]': 'selectComponent.disabled()',
2024
+ '[class.ga-select--invalid]': 'selectComponent.invalid()',
2025
+ '[class.ga-select--empty]': '!selectComponent.hasValue()',
2026
+ 'aria-haspopup': 'listbox',
2027
+ '[attr.aria-expanded]': 'selectComponent.isOpen()',
2028
+ '[attr.aria-owns]': 'selectComponent.listboxId()',
2029
+ '[attr.aria-invalid]': 'selectComponent.invalid()',
2030
+ '[attr.aria-disabled]': 'selectComponent.disabled()',
2031
+ '[attr.tabindex]': 'selectComponent.disabled() ? -1 : 0',
2032
+ '(click)': 'toggle()',
2033
+ '(keydown.arrowdown)': 'open(); $event.preventDefault()',
2034
+ '(keydown.space)': 'open(); $event.preventDefault()',
2035
+ '(keydown.enter)': 'open(); $event.preventDefault()',
2036
+ }, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (selectComponent.isOpen()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"textValue()\"\n (input)=\"textValue.set(inputSearch.value)\"\n (click)=\"$event.stopPropagation()\"\n [attr.aria-expanded]=\"selectComponent.isOpen()\"\n [attr.aria-controls]=\"selectComponent.listboxId()\"\n [attr.aria-activedescendant]=\"selectComponent.activeDescendantId()\"\n [placeholder]=\"selectComponent.placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n />\n} @else if (selectComponent.hasValue()) {\n <div class=\"ga-select__value\">\n <span #ngContent (cdkObserveContent)=\"checkIfHasCustomLabel()\">\n <ng-content />\n </span>\n @if (!hasCustomLabel()) {\n <ga-select-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ selectComponent.placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n" }]
2037
+ }], ctorParameters: () => [] });
2038
+
2039
+ const GA_SELECT_REQUIRED_VALIDATOR = {
2040
+ provide: NG_VALIDATORS,
2041
+ useExisting: forwardRef(() => GaSelectRequiredValidator),
2042
+ multi: true,
2043
+ };
2044
+ class GaSelectRequiredValidator extends RequiredValidator {
2045
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectRequiredValidator, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2046
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectRequiredValidator, isStandalone: true, selector: "ga-select[required][formControlName], ga-select[required][formControl], ga-select[required][ngModel]", providers: [GA_SELECT_REQUIRED_VALIDATOR], usesInheritance: true, ngImport: i0 });
2047
+ }
2048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectRequiredValidator, decorators: [{
2049
+ type: Directive,
2050
+ args: [{
2051
+ selector: `ga-select[required][formControlName], ga-select[required][formControl], ga-select[required][ngModel]`,
2052
+ providers: [GA_SELECT_REQUIRED_VALIDATOR],
2053
+ }]
2054
+ }] });
2055
+
2056
+ class GaSelectModule {
2057
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2058
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, imports: [GaSelectComponent,
2059
+ GaOptionComponent,
2060
+ GaOptgroupComponent,
2061
+ GaSelectContentComponent,
2062
+ GaSelectCustomTriggerComponent,
2063
+ GaSelectTriggerComponent,
2064
+ GaSelectComboboxTriggerComponent,
2065
+ GaSelectContentLoadingComponent,
2066
+ GaSelectRequiredValidator], exports: [GaSelectComponent,
2067
+ GaOptionComponent,
2068
+ GaOptgroupComponent,
2069
+ GaSelectContentComponent,
2070
+ GaSelectCustomTriggerComponent,
2071
+ GaSelectComboboxTriggerComponent,
2072
+ GaSelectTriggerComponent,
2073
+ GaSelectContentLoadingComponent,
2074
+ GaSelectRequiredValidator] });
2075
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, imports: [GaSelectComponent,
2076
+ GaOptionComponent,
2077
+ GaSelectTriggerComponent,
2078
+ GaSelectComboboxTriggerComponent] });
2079
+ }
2080
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, decorators: [{
2081
+ type: NgModule,
2082
+ args: [{
2083
+ imports: [
2084
+ GaSelectComponent,
2085
+ GaOptionComponent,
2086
+ GaOptgroupComponent,
2087
+ GaSelectContentComponent,
2088
+ GaSelectCustomTriggerComponent,
2089
+ GaSelectTriggerComponent,
2090
+ GaSelectComboboxTriggerComponent,
2091
+ GaSelectContentLoadingComponent,
2092
+ GaSelectRequiredValidator,
2093
+ ],
2094
+ exports: [
2095
+ GaSelectComponent,
2096
+ GaOptionComponent,
2097
+ GaOptgroupComponent,
2098
+ GaSelectContentComponent,
2099
+ GaSelectCustomTriggerComponent,
2100
+ GaSelectComboboxTriggerComponent,
2101
+ GaSelectTriggerComponent,
2102
+ GaSelectContentLoadingComponent,
2103
+ GaSelectRequiredValidator,
2104
+ ],
2105
+ }]
2106
+ }] });
2107
+
1493
2108
  /*
1494
2109
  * Public API Surface of ngx-gaia
1495
2110
  */
@@ -1498,5 +2113,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1498
2113
  * Generated bundle index. Do not edit.
1499
2114
  */
1500
2115
 
1501
- export { CHECKBOX_CONTROL_VALUE_ACCESSOR, GA_ALERT_I18N_FACTORY, GA_CHECKBOX_REQUIRED_VALIDATOR, GA_FORM_CONTROL, GA_TOOLTIP_DEFAULT_OFFSET, GaAlertComponent, GaAlertI18n, GaAlertI18nDefault, GaAlertModule, GaAlertTitleActionsComponent, GaAlertTitleComponent, GaBadgeComponent, GaBadgeModule, GaButtonDirective, GaButtonModule, GaCardComponent, GaCardModule, GaCheckboxComponent, GaCheckboxModule, GaCheckboxRequiredValidator, GaFieldInfoComponent, GaFieldLabelComponent, GaFormControlDirective, GaFormFieldComponent, GaFormFieldModule, GaIconButtonDirective, GaIconComponent, GaIconModule, GaInputComponent, GaInputDirective, GaInputModule, GaMenuComponent, GaMenuItemComponent, GaMenuModule, GaMenuSeparatorComponent, GaMenuTitleComponent, GaMenuTriggerDirective, GaMenuTriggerIconComponent, GaRadioButtonComponent, GaRadioGroupComponent, GaRadioModule, GaSegmentedControlButtonDirective, GaSegmentedControlComponent, GaSegmentedControlModule, GaSpinnerComponent, GaSpinnerModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, provideGaAlertI18n };
2116
+ export { CHECKBOX_CONTROL_VALUE_ACCESSOR, GA_ALERT_I18N_FACTORY, GA_CHECKBOX_REQUIRED_VALIDATOR, GA_FORM_CONTROL, GA_SELECT_REQUIRED_VALIDATOR, GA_TOOLTIP_DEFAULT_OFFSET, GaAlertComponent, GaAlertI18n, GaAlertI18nDefault, GaAlertModule, GaAlertTitleActionsComponent, GaAlertTitleComponent, GaBadgeComponent, GaBadgeModule, GaButtonDirective, GaButtonModule, GaCardComponent, GaCardModule, GaCheckboxComponent, GaCheckboxModule, GaCheckboxRequiredValidator, GaFieldInfoComponent, GaFieldLabelComponent, GaFormControlDirective, GaFormFieldComponent, GaFormFieldModule, GaIconButtonDirective, GaIconComponent, GaIconModule, GaInputComponent, GaInputDirective, GaInputModule, GaMenuComponent, GaMenuItemComponent, GaMenuModule, GaMenuSeparatorComponent, GaMenuTitleComponent, GaMenuTriggerDirective, GaMenuTriggerIconComponent, GaOptgroupComponent, GaOptionComponent, GaRadioButtonComponent, GaRadioGroupComponent, GaRadioModule, GaSegmentedControlButtonDirective, GaSegmentedControlComponent, GaSegmentedControlModule, GaSelectComboboxTriggerComponent, GaSelectComponent, GaSelectContentComponent, GaSelectContentLoadingComponent, GaSelectCustomTriggerComponent, GaSelectModule, GaSelectRequiredValidator, GaSelectTriggerComponent, GaSpinnerComponent, GaSpinnerModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, provideGaAlertI18n };
1502
2117
  //# sourceMappingURL=vsn-ux-ngx-gaia.mjs.map