@vsn-ux/ngx-gaia 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,19 @@
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, viewChild, contentChildren, isDevMode, afterNextRender } 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, contentChildren, viewChild } 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
5
  import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, CheckboxRequiredValidator, RequiredValidator } from '@angular/forms';
6
+ import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
6
7
  import * as i1$1 from '@angular/cdk/menu';
7
8
  import { CdkMenu, CdkMenuItem, CdkMenuTrigger } from '@angular/cdk/menu';
8
- import { toSignal, outputToObservable } from '@angular/core/rxjs-interop';
9
- import { merge, map, Subject, takeUntil, firstValueFrom } from 'rxjs';
9
+ import { toSignal } from '@angular/core/rxjs-interop';
10
+ import { merge, map, Subject, takeUntil } from 'rxjs';
10
11
  import * as i1$3 from '@angular/cdk/overlay';
11
- import { Overlay, OverlayModule } from '@angular/cdk/overlay';
12
+ import { Overlay, CdkOverlayOrigin, OverlayModule } from '@angular/cdk/overlay';
12
13
  import { ComponentPortal } from '@angular/cdk/portal';
13
14
  import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
14
- import { NgTemplateOutlet } from '@angular/common';
15
15
  import * as i1$2 from '@angular/cdk/listbox';
16
16
  import { CdkOption, CdkListbox } from '@angular/cdk/listbox';
17
- import * as i2 from '@angular/cdk/observers';
18
- import { ObserversModule } from '@angular/cdk/observers';
19
17
 
20
18
  class GaIconComponent {
21
19
  elementRef = inject(ElementRef);
@@ -322,11 +320,11 @@ const CHECKBOX_CONTROL_VALUE_ACCESSOR = {
322
320
  };
323
321
  // Increasing integer for generating unique ids for checkbox components.
324
322
  // Inspired by @angular/components
325
- let nextUniqueId$4 = 0;
323
+ let nextUniqueId$5 = 0;
326
324
  class GaCheckboxComponent {
327
325
  tabindex;
328
326
  /** @ignore */
329
- _uniqueId = `ga-checkbox-${++nextUniqueId$4}`;
327
+ _uniqueId = `ga-checkbox-${++nextUniqueId$5}`;
330
328
  /** @ignore */
331
329
  injector = inject(Injector);
332
330
  icons = { Minus, Check };
@@ -572,8 +570,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
572
570
 
573
571
  const GA_FORM_CONTROL = new InjectionToken('ga-form-control');
574
572
  class GaFormControlDirective {
573
+ _formControlId = input(undefined, {
574
+ alias: 'gaFormControl',
575
+ });
575
576
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaFormControlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
576
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: GaFormControlDirective, isStandalone: true, selector: "[gaFormControl]", providers: [
577
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.5", type: GaFormControlDirective, isStandalone: true, selector: "[gaFormControl]", inputs: { _formControlId: { classPropertyName: "_formControlId", publicName: "gaFormControl", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
577
578
  { provide: GA_FORM_CONTROL, useExisting: GaFormControlDirective },
578
579
  ], ngImport: i0 });
579
580
  }
@@ -587,9 +588,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
587
588
  }]
588
589
  }] });
589
590
 
590
- let nextUniqueId$3 = 0;
591
+ let nextUniqueId$4 = 0;
591
592
  class GaInputDirective {
592
- uniqueId = `ga-input-${++nextUniqueId$3}`;
593
+ uniqueId = `ga-input-${++nextUniqueId$4}`;
593
594
  implicitNgControl = inject(NgControl, {
594
595
  optional: true,
595
596
  self: true,
@@ -609,6 +610,7 @@ class GaInputDirective {
609
610
  return this.idInput() ?? this.uniqueId;
610
611
  });
611
612
  errors = this.implicitErrors.asReadonly();
613
+ _formControlId = this.id;
612
614
  ngDoCheck() {
613
615
  if (this.hasWrapper)
614
616
  return;
@@ -650,12 +652,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
650
652
  }]
651
653
  }] });
652
654
 
653
- let nextUniqueId$2 = 0;
655
+ let nextUniqueId$3 = 0;
654
656
  class GaFormFieldComponent {
655
- uniqueId = `ga-form-field-${++nextUniqueId$2}`;
656
- formControl = contentChild(GA_FORM_CONTROL);
657
+ uniqueId = `ga-form-field-${++nextUniqueId$3}`;
658
+ formControl = contentChild(GA_FORM_CONTROL, { descendants: true });
657
659
  controlId = computed(() => {
658
- return this.formControl()?.id() ?? this.uniqueId;
660
+ return this.formControl()?._formControlId() ?? this.uniqueId;
659
661
  });
660
662
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
661
663
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.1.5", type: GaFormFieldComponent, isStandalone: true, selector: "ga-form-field", host: { classAttribute: "ga-form-field" }, queries: [{ propertyName: "formControl", first: true, predicate: GA_FORM_CONTROL, descendants: true, isSignal: true }], exportAs: ["gaFormField"], ngImport: i0, template: "<ng-content />\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -668,13 +670,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
668
670
  }] });
669
671
 
670
672
  class GaFieldLabelComponent {
673
+ document = inject(DOCUMENT);
671
674
  formField = inject(GaFormFieldComponent);
672
675
  for = input();
673
676
  controlId = computed(() => {
674
677
  return this.for() ?? this.formField.controlId();
675
678
  });
679
+ controlElement = computed(() => {
680
+ const control = this.document.querySelector(`#${this.controlId()}`);
681
+ if (control instanceof HTMLElement) {
682
+ return control;
683
+ }
684
+ return null;
685
+ });
686
+ focusControl() {
687
+ const control = this.controlElement();
688
+ // only focus custom elements as native elements already
689
+ // have support for connecting label and reacting to events
690
+ if (control?.tagName.includes('-')) {
691
+ control.focus();
692
+ }
693
+ }
676
694
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaFieldLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
677
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaFieldLabelComponent, isStandalone: true, selector: "ga-label", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<label [attr.for]="controlId()" class="ga-form-field__label"
695
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaFieldLabelComponent, isStandalone: true, selector: "ga-label", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<label
696
+ [attr.for]="controlId()"
697
+ class="ga-form-field__label"
698
+ (click)="focusControl()"
678
699
  ><ng-content
679
700
  /></label>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
680
701
  }
@@ -682,7 +703,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
682
703
  type: Component,
683
704
  args: [{
684
705
  selector: 'ga-label',
685
- template: `<label [attr.for]="controlId()" class="ga-form-field__label"
706
+ template: `<label
707
+ [attr.for]="controlId()"
708
+ class="ga-form-field__label"
709
+ (click)="focusControl()"
686
710
  ><ng-content
687
711
  /></label>`,
688
712
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -1260,10 +1284,10 @@ const RADIO_CONTROL_VALUE_ACCESSOR = {
1260
1284
  multi: true,
1261
1285
  };
1262
1286
  // Increasing integer for generating unique ids for radio components.
1263
- let nextUniqueId$1 = 0;
1287
+ let nextUniqueId$2 = 0;
1264
1288
  class GaRadioGroupComponent {
1265
1289
  /** Name of the radio button group. All radio buttons inside this group will use this name. */
1266
- name = input(`ga-radio-group-${nextUniqueId$1++}`);
1290
+ name = input(`ga-radio-group-${nextUniqueId$2++}`);
1267
1291
  /**
1268
1292
  * Value for the radio-group. Should equal the value of the selected radio button if there is
1269
1293
  * a corresponding radio button with a matching value. If there is not such a corresponding
@@ -1322,13 +1346,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1322
1346
  }] });
1323
1347
 
1324
1348
  // Increasing integer for generating unique ids for radio button components.
1325
- let nextUniqueId = 0;
1349
+ let nextUniqueId$1 = 0;
1326
1350
  class GaRadioButtonComponent {
1327
1351
  tabindex;
1328
1352
  radioGroup = inject(GaRadioGroupComponent, {
1329
1353
  optional: true,
1330
1354
  });
1331
- _uniqueId = `ga-radio-button-${++nextUniqueId}`;
1355
+ _uniqueId = `ga-radio-button-${++nextUniqueId$1}`;
1332
1356
  /** The value attribute of the native input element */
1333
1357
  value = input(null);
1334
1358
  inputId = input(null, { alias: 'id' });
@@ -1459,108 +1483,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1459
1483
  }] });
1460
1484
 
1461
1485
  class GaSelectValueComponent {
1462
- selectComponent = inject(GaSelectComponent);
1463
- optionViewValue = computed(() => {
1464
- const options = this.selectComponent.selectedOptions();
1465
- if (!options.length) {
1466
- return null;
1467
- }
1468
- return options
1469
- .map((option) => option.cdkOption.element.textContent?.trim() ?? '')
1470
- .join(', ');
1471
- });
1472
1486
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1473
- 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 });
1487
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectValueComponent, isStandalone: true, selector: "ga-select-value", ngImport: i0, template: `<ng-content />`, isInline: true });
1474
1488
  }
1475
1489
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectValueComponent, decorators: [{
1476
1490
  type: Component,
1477
1491
  args: [{
1478
1492
  selector: 'ga-select-value',
1479
- template: `{{ optionViewValue() }}`,
1493
+ template: `<ng-content />`,
1480
1494
  }]
1481
1495
  }] });
1482
1496
 
1483
- const GA_SELECT_TRIGGER = new InjectionToken('gaSelectTrigger');
1484
-
1485
- class GaSelectTriggerComponent {
1497
+ class GaSelectDefaultValueComponent {
1486
1498
  selectComponent = inject(GaSelectComponent);
1487
- content = viewChild('ngContent', { read: ElementRef });
1488
- hasCustomLabel = signal(false);
1489
- menuStatusIcon = computed(() => {
1490
- return this.selectComponent.isOpen() ? ChevronUp : ChevronDown;
1499
+ optionViewValue = computed(() => {
1500
+ const options = this.selectComponent.selectedOptions();
1501
+ if (!options.length) {
1502
+ return null;
1503
+ }
1504
+ return options
1505
+ .map((option) => option.cdkOption.element.textContent?.trim() ?? '')
1506
+ .join(', ');
1491
1507
  });
1492
- leftIcon = input();
1493
- ngAfterViewInit() {
1494
- this.checkIfHasCustomLabel();
1495
- }
1496
- checkIfHasCustomLabel() {
1497
- this.hasCustomLabel.set(!!this.content()?.nativeElement.children.length);
1498
- }
1499
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1500
- 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: [
1501
- {
1502
- provide: GA_SELECT_TRIGGER,
1503
- useExisting: forwardRef(() => GaSelectTriggerComponent),
1504
- },
1505
- ], 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"] }] });
1506
- }
1507
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectTriggerComponent, decorators: [{
1508
- type: Component,
1509
- args: [{ selector: 'ga-select-trigger', imports: [
1510
- GaInputModule,
1511
- GaIconModule,
1512
- GaSelectValueComponent,
1513
- ObserversModule,
1514
- ], providers: [
1515
- {
1516
- provide: GA_SELECT_TRIGGER,
1517
- useExisting: forwardRef(() => GaSelectTriggerComponent),
1518
- },
1519
- ], host: {
1520
- role: 'combobox',
1521
- class: 'ga-select',
1522
- '[class.ga-select--expanded]': 'selectComponent.isOpen()',
1523
- '[class.ga-select--disabled]': 'selectComponent.disabled()',
1524
- '[class.ga-select--invalid]': 'selectComponent.invalid()',
1525
- '[class.ga-select--empty]': '!selectComponent.hasValue()',
1526
- 'aria-haspopup': 'listbox',
1527
- '[attr.aria-expanded]': 'selectComponent.isOpen()',
1528
- '[attr.aria-controls]': 'selectComponent.listboxId()',
1529
- '[attr.aria-invalid]': 'selectComponent.invalid()',
1530
- '[attr.aria-disabled]': 'selectComponent.disabled()',
1531
- '[attr.aria-activedescendant]': 'selectComponent.activeDescendantId()',
1532
- '[attr.tabindex]': 'selectComponent.disabled() ? -1 : 0',
1533
- '(click)': 'selectComponent.toggle()',
1534
- '(keydown.arrowdown)': 'selectComponent.open(); $event.preventDefault()',
1535
- '(keydown.space)': 'selectComponent.open(); $event.preventDefault()',
1536
- '(keydown.enter)': 'selectComponent.open(); $event.preventDefault()',
1537
- }, 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" }]
1538
- }] });
1539
-
1540
- class GaSelectCustomTriggerComponent {
1541
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectCustomTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1542
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectCustomTriggerComponent, isStandalone: true, selector: "ga-select-custom-trigger", providers: [
1543
- {
1544
- provide: GA_SELECT_TRIGGER,
1545
- useExisting: forwardRef(() => GaSelectCustomTriggerComponent),
1546
- },
1547
- ], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
1508
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectDefaultValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1509
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectDefaultValueComponent, isStandalone: true, selector: "ga-select-default-value", ngImport: i0, template: `{{ optionViewValue() }}`, isInline: true });
1548
1510
  }
1549
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectCustomTriggerComponent, decorators: [{
1511
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectDefaultValueComponent, decorators: [{
1550
1512
  type: Component,
1551
1513
  args: [{
1552
- selector: 'ga-select-custom-trigger',
1553
- template: `<ng-content></ng-content>`,
1554
- providers: [
1555
- {
1556
- provide: GA_SELECT_TRIGGER,
1557
- useExisting: forwardRef(() => GaSelectCustomTriggerComponent),
1558
- },
1559
- ],
1514
+ selector: 'ga-select-default-value',
1515
+ template: `{{ optionViewValue() }}`,
1560
1516
  }]
1561
1517
  }] });
1562
1518
 
1519
+ let nextUniqueId = 0;
1563
1520
  class GaSelectComponent {
1521
+ _uniqueId = `ga-select-${++nextUniqueId}`;
1564
1522
  focusedTriggerElement = null;
1565
1523
  _onTouched;
1566
1524
  _onModelChanged;
@@ -1579,8 +1537,23 @@ class GaSelectComponent {
1579
1537
  overlayY: 'bottom',
1580
1538
  offsetY: -8,
1581
1539
  },
1540
+ {
1541
+ originX: 'start',
1542
+ originY: 'bottom',
1543
+ overlayX: 'start',
1544
+ overlayY: 'top',
1545
+ offsetY: 8,
1546
+ },
1547
+ {
1548
+ originX: 'start',
1549
+ originY: 'top',
1550
+ overlayX: 'start',
1551
+ overlayY: 'bottom',
1552
+ offsetY: -8,
1553
+ },
1582
1554
  ];
1583
1555
  injector = inject(Injector);
1556
+ overlayOrigin = inject(CdkOverlayOrigin);
1584
1557
  implicitInvalid = signal(false);
1585
1558
  _isOpen = signal(false);
1586
1559
  value = model(null);
@@ -1595,19 +1568,25 @@ class GaSelectComponent {
1595
1568
  });
1596
1569
  multiple = input(false, { transform: booleanAttribute });
1597
1570
  compareWith = input();
1598
- withoutAutoFocus = signal(false);
1599
- opened = output();
1600
- closed = output();
1571
+ searchable = input(false, { transform: booleanAttribute });
1572
+ textValue = model('');
1573
+ leftIcon = input();
1574
+ idInput = input(null, { alias: 'id' });
1601
1575
  // TODO: if we rename this to options, it breaks, why?
1602
1576
  gaOptions = contentChildren(GaOptionComponent, {
1603
1577
  descendants: true,
1604
1578
  read: GaOptionComponent,
1605
1579
  });
1606
1580
  cdkListbox = contentChild.required(CdkListbox);
1607
- explicitTrigger = contentChild(GA_SELECT_TRIGGER);
1581
+ customSelectValue = contentChild(GaSelectValueComponent);
1582
+ inputSearch = viewChild('inputSearch');
1583
+ content = viewChild('ngContent', { read: ElementRef });
1584
+ id = computed(() => {
1585
+ return this.idInput() ?? this._uniqueId;
1586
+ });
1608
1587
  isOpen = this._isOpen.asReadonly();
1609
1588
  disabled = linkedSignal(() => this.disabledInput());
1610
- icon = computed(() => {
1589
+ menuStatusIcon = computed(() => {
1611
1590
  return this._isOpen() ? ChevronUp : ChevronDown;
1612
1591
  });
1613
1592
  selectedOptions = computed(() => {
@@ -1627,7 +1606,7 @@ class GaSelectComponent {
1627
1606
  invalid = computed(() => {
1628
1607
  return this.invalidInput() ?? this.implicitInvalid();
1629
1608
  });
1630
- listboxId = computed(() => this.cdkListbox().id);
1609
+ _formControlId = computed(() => this.id());
1631
1610
  constructor() {
1632
1611
  effect(() => {
1633
1612
  // if the select became disabled while open, close it
@@ -1639,7 +1618,7 @@ class GaSelectComponent {
1639
1618
  ngAfterContentInit() {
1640
1619
  effect(() => {
1641
1620
  this.cdkListbox().multiple = this.multiple();
1642
- this.cdkListbox().useActiveDescendant = this.withoutAutoFocus();
1621
+ this.cdkListbox().useActiveDescendant = this.searchable();
1643
1622
  this.cdkListbox().compareWith = this.compareWith();
1644
1623
  this.cdkListbox().value = this.multiple()
1645
1624
  ? this.value()
@@ -1655,12 +1634,6 @@ class GaSelectComponent {
1655
1634
  // this is needed because value could be also changed via keyboard
1656
1635
  this.autoClose();
1657
1636
  });
1658
- if (isDevMode() &&
1659
- this.explicitTrigger() instanceof GaSelectCustomTriggerComponent) {
1660
- if (this.multiple()) {
1661
- 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]');
1662
- }
1663
- }
1664
1637
  }
1665
1638
  ngDoCheck() {
1666
1639
  const implicitNgControl = this.injector.get(NgControl, null);
@@ -1691,17 +1664,15 @@ class GaSelectComponent {
1691
1664
  }
1692
1665
  open() {
1693
1666
  if (this.disabled() || this._isOpen()) {
1694
- return Promise.resolve();
1667
+ return;
1695
1668
  }
1696
1669
  this._isOpen.set(true);
1697
- return firstValueFrom(outputToObservable(this.opened));
1698
1670
  }
1699
1671
  close() {
1700
1672
  if (!this._isOpen()) {
1701
- return Promise.resolve();
1673
+ return;
1702
1674
  }
1703
1675
  this._isOpen.set(false);
1704
- return firstValueFrom(outputToObservable(this.closed));
1705
1676
  }
1706
1677
  autoClose() {
1707
1678
  // close that was initiated by clicking the option
@@ -1734,19 +1705,44 @@ class GaSelectComponent {
1734
1705
  this.value.set(value);
1735
1706
  }
1736
1707
  }
1708
+ onInputKeyDown(event) {
1709
+ switch (event.code) {
1710
+ case 'ArrowDown':
1711
+ this.setNextItemActive();
1712
+ event.preventDefault();
1713
+ event.stopPropagation();
1714
+ break;
1715
+ case 'ArrowUp':
1716
+ this.setPreviousItemActive();
1717
+ event.preventDefault();
1718
+ event.stopPropagation();
1719
+ break;
1720
+ case 'Space':
1721
+ event.stopPropagation();
1722
+ break;
1723
+ case 'Enter':
1724
+ this.setActiveItemAsSelected();
1725
+ this.autoClose();
1726
+ event.preventDefault();
1727
+ event.stopPropagation();
1728
+ break;
1729
+ }
1730
+ }
1737
1731
  onOverlayAttach() {
1738
1732
  this._isOpen.set(true);
1739
1733
  this.focusedTriggerElement = document.activeElement;
1740
- this.opened.emit();
1741
- if (!this.withoutAutoFocus()) {
1734
+ if (this.searchable()) {
1735
+ this.inputSearch().nativeElement.focus();
1736
+ }
1737
+ else {
1742
1738
  this.focusListbox();
1743
1739
  }
1744
1740
  }
1745
1741
  onOverlayDetach() {
1746
1742
  this._isOpen.set(false);
1747
1743
  this.focusedTriggerElement?.focus();
1744
+ this.textValue.set('');
1748
1745
  this._onTouched?.();
1749
- this.closed.emit();
1750
1746
  }
1751
1747
  setItemActive(direction) {
1752
1748
  const options = this.gaOptions();
@@ -1768,13 +1764,17 @@ class GaSelectComponent {
1768
1764
  }
1769
1765
  }
1770
1766
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1771
- 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: [
1767
+ 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 }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, textValue: { classPropertyName: "textValue", publicName: "textValue", isSignal: true, isRequired: false, transformFunction: null }, leftIcon: { classPropertyName: "leftIcon", publicName: "leftIcon", isSignal: true, isRequired: false, transformFunction: null }, idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", 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: { "attr.id": "id()", "class.ga-select--expanded": "isOpen()", "class.ga-select--disabled": "disabled()", "class.ga-select--invalid": "invalid()", "class.ga-select--empty": "!hasValue()", "attr.aria-expanded": "isOpen()", "attr.aria-controls": "cdkListbox().id", "attr.aria-invalid": "invalid()", "attr.aria-disabled": "disabled()", "attr.aria-owns": "searchable() ? cdkListbox().id : null", "attr.aria-activedescendant": "!searchable() ? activeDescendantId() : null", "attr.tabindex": "disabled() ? -1 : 0" }, classAttribute: "ga-select" }, providers: [
1772
1768
  {
1773
1769
  provide: NG_VALUE_ACCESSOR,
1774
1770
  useExisting: forwardRef(() => GaSelectComponent),
1775
1771
  multi: true,
1776
1772
  },
1777
- ], 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 });
1773
+ {
1774
+ provide: GA_FORM_CONTROL,
1775
+ useExisting: forwardRef(() => GaSelectComponent),
1776
+ },
1777
+ ], queries: [{ propertyName: "gaOptions", predicate: GaOptionComponent, descendants: true, read: GaOptionComponent, isSignal: true }, { propertyName: "cdkListbox", first: true, predicate: CdkListbox, descendants: true, isSignal: true }, { propertyName: "customSelectValue", first: true, predicate: GaSelectValueComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputSearch", first: true, predicate: ["inputSearch"], descendants: true, isSignal: true }, { propertyName: "content", first: true, predicate: ["ngContent"], descendants: true, read: ElementRef, isSignal: true }], hostDirectives: [{ directive: i1$3.CdkOverlayOrigin }], ngImport: i0, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (searchable() && 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]=\"isOpen()\"\n [attr.aria-controls]=\"cdkListbox().id\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [placeholder]=\"placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n />\n} @else if (hasValue()) {\n <div class=\"ga-select__value\">\n @if (customSelectValue()) {\n <ng-content select=\"ga-select-value\" />\n } @else {\n <ga-select-default-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayLockPosition\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n>\n <ng-content select=\"ga-select-dropdown\" />\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: GaIconModule }, { kind: "component", type: GaIconComponent, selector: "ga-icon", inputs: ["icon", "size", "color", "strokeWidth"] }, { 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: "component", type: GaSelectDefaultValueComponent, selector: "ga-select-default-value" }] });
1778
1778
  }
1779
1779
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComponent, decorators: [{
1780
1780
  type: Component,
@@ -1782,14 +1782,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1782
1782
  GaIconModule,
1783
1783
  GaButtonModule,
1784
1784
  OverlayModule,
1785
- GaSelectTriggerComponent,
1786
- ], providers: [
1785
+ GaSelectDefaultValueComponent,
1786
+ ], hostDirectives: [CdkOverlayOrigin], providers: [
1787
1787
  {
1788
1788
  provide: NG_VALUE_ACCESSOR,
1789
1789
  useExisting: forwardRef(() => GaSelectComponent),
1790
1790
  multi: true,
1791
1791
  },
1792
- ], 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"] }]
1792
+ {
1793
+ provide: GA_FORM_CONTROL,
1794
+ useExisting: forwardRef(() => GaSelectComponent),
1795
+ },
1796
+ ], host: {
1797
+ role: 'combobox',
1798
+ '[attr.id]': 'id()',
1799
+ class: 'ga-select',
1800
+ '[class.ga-select--expanded]': 'isOpen()',
1801
+ '[class.ga-select--disabled]': 'disabled()',
1802
+ '[class.ga-select--invalid]': 'invalid()',
1803
+ '[class.ga-select--empty]': '!hasValue()',
1804
+ 'aria-haspopup': 'listbox',
1805
+ '[attr.aria-expanded]': 'isOpen()',
1806
+ '[attr.aria-controls]': 'cdkListbox().id',
1807
+ '[attr.aria-invalid]': 'invalid()',
1808
+ '[attr.aria-disabled]': 'disabled()',
1809
+ '[attr.aria-owns]': 'searchable() ? cdkListbox().id : null',
1810
+ '[attr.aria-activedescendant]': '!searchable() ? activeDescendantId() : null',
1811
+ '[attr.tabindex]': 'disabled() ? -1 : 0',
1812
+ '(click)': 'toggle()',
1813
+ '(keydown.arrowdown)': 'open(); $event.preventDefault()',
1814
+ '(keydown.space)': 'open(); $event.preventDefault()',
1815
+ '(keydown.enter)': 'open(); $event.preventDefault()',
1816
+ }, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (searchable() && 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]=\"isOpen()\"\n [attr.aria-controls]=\"cdkListbox().id\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [placeholder]=\"placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n />\n} @else if (hasValue()) {\n <div class=\"ga-select__value\">\n @if (customSelectValue()) {\n <ng-content select=\"ga-select-value\" />\n } @else {\n <ga-select-default-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayLockPosition\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n>\n <ng-content select=\"ga-select-dropdown\" />\n</ng-template>\n" }]
1793
1817
  }], ctorParameters: () => [] });
1794
1818
 
1795
1819
  class GaOptgroupComponent {
@@ -1902,14 +1926,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1902
1926
  }]
1903
1927
  }] });
1904
1928
 
1905
- class GaSelectContentLoadingComponent {
1906
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1907
- 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"] }] });
1929
+ class GaSelectDropdownLoadingComponent {
1930
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectDropdownLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1931
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectDropdownLoadingComponent, isStandalone: true, selector: "ga-select-dropdown-loader", 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"] }] });
1908
1932
  }
1909
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentLoadingComponent, decorators: [{
1933
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectDropdownLoadingComponent, decorators: [{
1910
1934
  type: Component,
1911
1935
  args: [{
1912
- selector: 'ga-select-content-loading',
1936
+ selector: 'ga-select-dropdown-loader',
1913
1937
  template: `<ga-spinner size="16" />`,
1914
1938
  imports: [GaSpinnerModule],
1915
1939
  host: {
@@ -1918,121 +1942,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
1918
1942
  }]
1919
1943
  }] });
1920
1944
 
1921
- class GaSelectContentComponent {
1945
+ class GaSelectDropdownComponent {
1922
1946
  loading = input(false, { transform: booleanAttribute });
1923
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1924
- 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" }] });
1947
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1948
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectDropdownComponent, isStandalone: true, selector: "ga-select-dropdown", 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-dropdown-loader />\n} @else {\n <ng-content />\n}\n", dependencies: [{ kind: "component", type: GaSelectDropdownLoadingComponent, selector: "ga-select-dropdown-loader" }] });
1925
1949
  }
1926
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentComponent, decorators: [{
1950
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectDropdownComponent, decorators: [{
1927
1951
  type: Component,
1928
- args: [{ selector: 'ga-select-content', imports: [GaSelectContentLoadingComponent], hostDirectives: [CdkListbox], host: {
1952
+ args: [{ selector: 'ga-select-dropdown', imports: [GaSelectDropdownLoadingComponent], hostDirectives: [CdkListbox], host: {
1929
1953
  class: 'ga-dropdown ga-dropdown__content',
1930
- }, template: "@if (loading()) {\n <ga-select-content-loading />\n} @else {\n <ng-content />\n}\n" }]
1954
+ }, template: "@if (loading()) {\n <ga-select-dropdown-loader />\n} @else {\n <ng-content />\n}\n" }]
1931
1955
  }] });
1932
1956
 
1933
- class GaSelectComboboxTriggerComponent {
1934
- injector = inject(Injector);
1935
- selectComponent = inject(GaSelectComponent);
1936
- content = viewChild('ngContent', { read: ElementRef });
1937
- inputSearch = viewChild('inputSearch');
1938
- hasCustomLabel = signal(false);
1939
- menuStatusIcon = computed(() => {
1940
- return this.selectComponent.isOpen() ? ChevronUp : ChevronDown;
1941
- });
1942
- textValue = model('');
1943
- leftIcon = input();
1944
- constructor() {
1945
- this.selectComponent.withoutAutoFocus.set(true);
1946
- this.selectComponent.opened.subscribe(() => {
1947
- afterNextRender(() => {
1948
- this.inputSearch().nativeElement.focus();
1949
- }, { injector: this.injector });
1950
- });
1951
- this.selectComponent.closed.subscribe(() => this.textValue.set(''));
1952
- }
1953
- ngAfterViewInit() {
1954
- this.checkIfHasCustomLabel();
1955
- }
1956
- checkIfHasCustomLabel() {
1957
- this.hasCustomLabel.set(!!this.content()?.nativeElement.children.length);
1958
- }
1959
- toggle() {
1960
- if (this.selectComponent.disabled()) {
1961
- return;
1962
- }
1963
- if (!this.selectComponent.isOpen()) {
1964
- this.open();
1965
- }
1966
- else {
1967
- this.selectComponent.close();
1968
- }
1969
- }
1970
- open() {
1971
- this.selectComponent.open();
1972
- }
1973
- onInputKeyDown(event) {
1974
- switch (event.code) {
1975
- case 'ArrowDown':
1976
- this.selectComponent.setNextItemActive();
1977
- event.preventDefault();
1978
- event.stopPropagation();
1979
- break;
1980
- case 'ArrowUp':
1981
- this.selectComponent.setPreviousItemActive();
1982
- event.preventDefault();
1983
- event.stopPropagation();
1984
- break;
1985
- case 'Space':
1986
- event.stopPropagation();
1987
- break;
1988
- case 'Enter':
1989
- this.selectComponent.setActiveItemAsSelected();
1990
- this.selectComponent.autoClose();
1991
- event.preventDefault();
1992
- event.stopPropagation();
1993
- break;
1994
- }
1995
- }
1996
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComboboxTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1997
- 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: [
1998
- {
1999
- provide: GA_SELECT_TRIGGER,
2000
- useExisting: forwardRef(() => GaSelectComboboxTriggerComponent),
2001
- },
2002
- ], 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"] }] });
2003
- }
2004
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComboboxTriggerComponent, decorators: [{
2005
- type: Component,
2006
- args: [{ selector: 'ga-select-searchable-trigger', imports: [
2007
- GaInputModule,
2008
- GaIconModule,
2009
- GaSelectValueComponent,
2010
- ObserversModule,
2011
- ], providers: [
2012
- {
2013
- provide: GA_SELECT_TRIGGER,
2014
- useExisting: forwardRef(() => GaSelectComboboxTriggerComponent),
2015
- },
2016
- ], host: {
2017
- role: 'combobox',
2018
- class: 'ga-select',
2019
- '[class.ga-select--expanded]': 'selectComponent.isOpen()',
2020
- '[class.ga-select--disabled]': 'selectComponent.disabled()',
2021
- '[class.ga-select--invalid]': 'selectComponent.invalid()',
2022
- '[class.ga-select--empty]': '!selectComponent.hasValue()',
2023
- 'aria-haspopup': 'listbox',
2024
- '[attr.aria-expanded]': 'selectComponent.isOpen()',
2025
- '[attr.aria-owns]': 'selectComponent.listboxId()',
2026
- '[attr.aria-invalid]': 'selectComponent.invalid()',
2027
- '[attr.aria-disabled]': 'selectComponent.disabled()',
2028
- '[attr.tabindex]': 'selectComponent.disabled() ? -1 : 0',
2029
- '(click)': 'toggle()',
2030
- '(keydown.arrowdown)': 'open(); $event.preventDefault()',
2031
- '(keydown.space)': 'open(); $event.preventDefault()',
2032
- '(keydown.enter)': 'open(); $event.preventDefault()',
2033
- }, 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" }]
2034
- }], ctorParameters: () => [] });
2035
-
2036
1957
  const GA_SELECT_REQUIRED_VALIDATOR = {
2037
1958
  provide: NG_VALIDATORS,
2038
1959
  useExisting: forwardRef(() => GaSelectRequiredValidator),
@@ -2055,24 +1976,18 @@ class GaSelectModule {
2055
1976
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, imports: [GaSelectComponent,
2056
1977
  GaOptionComponent,
2057
1978
  GaOptgroupComponent,
2058
- GaSelectContentComponent,
2059
- GaSelectCustomTriggerComponent,
2060
- GaSelectTriggerComponent,
2061
- GaSelectComboboxTriggerComponent,
2062
- GaSelectContentLoadingComponent,
1979
+ GaSelectDropdownComponent,
1980
+ GaSelectDropdownLoadingComponent,
1981
+ GaSelectValueComponent,
2063
1982
  GaSelectRequiredValidator], exports: [GaSelectComponent,
2064
1983
  GaOptionComponent,
2065
1984
  GaOptgroupComponent,
2066
- GaSelectContentComponent,
2067
- GaSelectCustomTriggerComponent,
2068
- GaSelectComboboxTriggerComponent,
2069
- GaSelectTriggerComponent,
2070
- GaSelectContentLoadingComponent,
1985
+ GaSelectDropdownComponent,
1986
+ GaSelectDropdownLoadingComponent,
1987
+ GaSelectValueComponent,
2071
1988
  GaSelectRequiredValidator] });
2072
1989
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, imports: [GaSelectComponent,
2073
- GaOptionComponent,
2074
- GaSelectTriggerComponent,
2075
- GaSelectComboboxTriggerComponent] });
1990
+ GaOptionComponent] });
2076
1991
  }
2077
1992
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, decorators: [{
2078
1993
  type: NgModule,
@@ -2081,22 +1996,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
2081
1996
  GaSelectComponent,
2082
1997
  GaOptionComponent,
2083
1998
  GaOptgroupComponent,
2084
- GaSelectContentComponent,
2085
- GaSelectCustomTriggerComponent,
2086
- GaSelectTriggerComponent,
2087
- GaSelectComboboxTriggerComponent,
2088
- GaSelectContentLoadingComponent,
1999
+ GaSelectDropdownComponent,
2000
+ GaSelectDropdownLoadingComponent,
2001
+ GaSelectValueComponent,
2089
2002
  GaSelectRequiredValidator,
2090
2003
  ],
2091
2004
  exports: [
2092
2005
  GaSelectComponent,
2093
2006
  GaOptionComponent,
2094
2007
  GaOptgroupComponent,
2095
- GaSelectContentComponent,
2096
- GaSelectCustomTriggerComponent,
2097
- GaSelectComboboxTriggerComponent,
2098
- GaSelectTriggerComponent,
2099
- GaSelectContentLoadingComponent,
2008
+ GaSelectDropdownComponent,
2009
+ GaSelectDropdownLoadingComponent,
2010
+ GaSelectValueComponent,
2100
2011
  GaSelectRequiredValidator,
2101
2012
  ],
2102
2013
  }]
@@ -2110,5 +2021,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
2110
2021
  * Generated bundle index. Do not edit.
2111
2022
  */
2112
2023
 
2113
- 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 };
2024
+ 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, GaSelectComponent, GaSelectDropdownComponent, GaSelectDropdownLoadingComponent, GaSelectModule, GaSelectRequiredValidator, GaSelectValueComponent, GaSpinnerComponent, GaSpinnerModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, provideGaAlertI18n };
2114
2025
  //# sourceMappingURL=vsn-ux-ngx-gaia.mjs.map