@vsn-ux/ngx-gaia 0.9.12 → 0.9.14

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, makeEnvironmentProviders, inject, ElementRef, HostAttributeToken, input, numberAttribute, computed, ViewEncapsulation, Component, NgModule, Injectable, booleanAttribute, ChangeDetectionStrategy, output, contentChild, Directive, linkedSignal, signal, Injector, DestroyRef, effect, isSignal, forwardRef, LOCALE_ID, model, Renderer2, Attribute, untracked, HostListener, viewChild, TemplateRef, contentChildren, NgZone, HostBinding, Input, DOCUMENT, afterNextRender, afterEveryRender } from '@angular/core';
2
+ import { InjectionToken, makeEnvironmentProviders, inject, ElementRef, HostAttributeToken, input, numberAttribute, computed, ViewEncapsulation, Component, NgModule, Injectable, booleanAttribute, ChangeDetectionStrategy, output, contentChild, Directive, linkedSignal, signal, Injector, DestroyRef, effect, isSignal, forwardRef, LOCALE_ID, model, Renderer2, Attribute, untracked, HostListener, viewChild, TemplateRef, contentChildren, NgZone, HostBinding, Input, DOCUMENT, afterNextRender, afterEveryRender, viewChildren, isDevMode } from '@angular/core';
3
3
  import * as i1 from 'lucide-angular';
4
4
  import { LucideAngularModule, X, CircleCheck, TriangleAlert, OctagonAlert, Info, Check, Minus, ChevronDown, ChevronUp, ChevronRight, ChevronLeft, CalendarDays, CircleX } from 'lucide-angular';
5
5
  import { NgForm, ControlContainer, NgControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, CheckboxRequiredValidator, RequiredValidator } from '@angular/forms';
@@ -368,7 +368,7 @@ function provideGaAlertI18n(value) {
368
368
  ]);
369
369
  }
370
370
 
371
- let nextUniqueId$9 = 0;
371
+ let nextUniqueId$a = 0;
372
372
  class GaAlertComponent {
373
373
  i18n = inject(GaAlertI18n);
374
374
  dismissIcon = X;
@@ -396,7 +396,7 @@ class GaAlertComponent {
396
396
  return null;
397
397
  });
398
398
  title = contentChild(GaAlertTitleComponent);
399
- progressId = `ga-alert-progress-${++nextUniqueId$9}`;
399
+ progressId = `ga-alert-progress-${++nextUniqueId$a}`;
400
400
  variantClass = computed(() => {
401
401
  return `ga-notification ga-notification--${this.variant()}`;
402
402
  });
@@ -657,10 +657,10 @@ const CHECKBOX_CONTROL_VALUE_ACCESSOR = {
657
657
  };
658
658
  // Increasing integer for generating unique ids for checkbox components.
659
659
  // Inspired by @angular/components
660
- let nextUniqueId$8 = 0;
660
+ let nextUniqueId$9 = 0;
661
661
  class GaCheckboxComponent {
662
662
  /** @ignore */
663
- _uniqueId = `ga-checkbox-${++nextUniqueId$8}`;
663
+ _uniqueId = `ga-checkbox-${++nextUniqueId$9}`;
664
664
  /** @ignore */
665
665
  implicitNgControlState = injectNgControlState();
666
666
  /** @ignore */
@@ -1262,9 +1262,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
1262
1262
  type: Injectable
1263
1263
  }] });
1264
1264
 
1265
- let nextUniqueId$7 = 0;
1265
+ let nextUniqueId$8 = 0;
1266
1266
  class GaInputDirective {
1267
- uniqueId = `ga-input-${++nextUniqueId$7}`;
1267
+ uniqueId = `ga-input-${++nextUniqueId$8}`;
1268
1268
  formFieldConnector = inject(GaFormFieldConnector, {
1269
1269
  optional: true,
1270
1270
  });
@@ -1729,6 +1729,7 @@ class GaDatepickerInputDirective {
1729
1729
  updateValue(value, { updateView, emitToNgModel, } = {}) {
1730
1730
  this.value.set(value);
1731
1731
  this.lastValueValid.set(true);
1732
+ this.lastDateChangeEmittedValue.set(this.dateStruct());
1732
1733
  if (updateView) {
1733
1734
  this.formatValue();
1734
1735
  }
@@ -1742,7 +1743,6 @@ class GaDatepickerInputDirective {
1742
1743
  // ControlValueAccessor implementation
1743
1744
  writeValue(value) {
1744
1745
  this.updateValue(value, { updateView: true });
1745
- this.lastDateChangeEmittedValue.set(this.dateStruct());
1746
1746
  }
1747
1747
  registerOnChange(fn) {
1748
1748
  this.onNgChangeFn = fn;
@@ -2185,7 +2185,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
2185
2185
 
2186
2186
  const GA_FORM_FIELD_ID = new InjectionToken('ga-form-field-id');
2187
2187
 
2188
- let nextUniqueId$6 = 0;
2188
+ let nextUniqueId$7 = 0;
2189
2189
  class GaFormFieldComponent {
2190
2190
  uniqueId = inject(GA_FORM_FIELD_ID);
2191
2191
  formFieldConnector = inject(GaFormFieldConnector);
@@ -2203,7 +2203,7 @@ class GaFormFieldComponent {
2203
2203
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.0.4", type: GaFormFieldComponent, isStandalone: true, selector: "ga-form-field", inputs: { disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-form-field" }, providers: [
2204
2204
  {
2205
2205
  provide: GA_FORM_FIELD_ID,
2206
- useFactory: () => `ga-form-field-${++nextUniqueId$6}`,
2206
+ useFactory: () => `ga-form-field-${++nextUniqueId$7}`,
2207
2207
  },
2208
2208
  GaFormFieldConnector,
2209
2209
  ], queries: [{ propertyName: "fieldInfo", first: true, predicate: GaFieldInfoComponent, descendants: true, isSignal: true }, { propertyName: "fieldErrors", predicate: GaFieldErrorDirective, isSignal: true }], exportAs: ["gaFormField"], ngImport: i0, template: "<ng-content select=\"ga-label\" />\n<ng-content />\n<ga-field-callout />\n", dependencies: [{ kind: "component", type: GaFieldCalloutComponent, selector: "ga-field-callout" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -2215,13 +2215,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
2215
2215
  }, providers: [
2216
2216
  {
2217
2217
  provide: GA_FORM_FIELD_ID,
2218
- useFactory: () => `ga-form-field-${++nextUniqueId$6}`,
2218
+ useFactory: () => `ga-form-field-${++nextUniqueId$7}`,
2219
2219
  },
2220
2220
  GaFormFieldConnector,
2221
2221
  ], template: "<ng-content select=\"ga-label\" />\n<ng-content />\n<ga-field-callout />\n" }]
2222
2222
  }] });
2223
2223
 
2224
- let nextUniqueId$5 = 0;
2224
+ let nextUniqueId$6 = 0;
2225
2225
  /**
2226
2226
  * Internal tooltip component used by the gaTooltip directive.
2227
2227
  * This component is not intended for direct use in templates.
@@ -2229,7 +2229,7 @@ let nextUniqueId$5 = 0;
2229
2229
  * @internal
2230
2230
  */
2231
2231
  class GaTooltipComponent {
2232
- uniqueId = `ga-tooltip-${++nextUniqueId$5}`;
2232
+ uniqueId = `ga-tooltip-${++nextUniqueId$6}`;
2233
2233
  mouseLeaveSubject = new Subject();
2234
2234
  afterMouseLeave = () => this.mouseLeaveSubject.asObservable();
2235
2235
  mouseOver = signal(false);
@@ -3529,10 +3529,10 @@ const RADIO_CONTROL_VALUE_ACCESSOR = {
3529
3529
  multi: true,
3530
3530
  };
3531
3531
  // Increasing integer for generating unique ids for radio components.
3532
- let nextUniqueId$4 = 0;
3532
+ let nextUniqueId$5 = 0;
3533
3533
  class GaRadioGroupComponent {
3534
3534
  /** Name of the radio button group. All radio buttons inside this group will use this name. */
3535
- name = input(`ga-radio-group-${nextUniqueId$4++}`);
3535
+ name = input(`ga-radio-group-${nextUniqueId$5++}`);
3536
3536
  /**
3537
3537
  * Value for the radio-group. Should equal the value of the selected radio button if there is
3538
3538
  * a corresponding radio button with a matching value. If there is not such a corresponding
@@ -3591,7 +3591,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
3591
3591
  }] });
3592
3592
 
3593
3593
  // Increasing integer for generating unique ids for radio button components.
3594
- let nextUniqueId$3 = 0;
3594
+ let nextUniqueId$4 = 0;
3595
3595
  class GaRadioButtonComponent {
3596
3596
  radioGroup = inject(GaRadioGroupComponent, {
3597
3597
  optional: true,
@@ -3600,7 +3600,7 @@ class GaRadioButtonComponent {
3600
3600
  optional: true,
3601
3601
  });
3602
3602
  implicitNgControlState = injectNgControlState();
3603
- _uniqueId = `ga-radio-button-${++nextUniqueId$3}`;
3603
+ _uniqueId = `ga-radio-button-${++nextUniqueId$4}`;
3604
3604
  /** The value attribute of the native input element */
3605
3605
  value = input(null);
3606
3606
  inputId = input(null, { alias: 'id' });
@@ -3805,7 +3805,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
3805
3805
  class GaSelectI18nDefault extends GaSelectI18n {
3806
3806
  /** A label for the clear button */
3807
3807
  clearLabel = 'Clear';
3808
- /** A default label for the search input, unless placeholder is set */
3808
+ /** A default label for the search input */
3809
3809
  defaultSearchInputLabel = 'Search';
3810
3810
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaSelectI18nDefault, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
3811
3811
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaSelectI18nDefault });
@@ -3866,9 +3866,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
3866
3866
  }, template: "@if (loading()) {\n <ga-select-dropdown-spinner />\n} @else {\n <ng-content />\n}\n" }]
3867
3867
  }] });
3868
3868
 
3869
- let nextUniqueId$2 = 0;
3869
+ let nextUniqueId$3 = 0;
3870
3870
  class GaSelectComponent {
3871
- _uniqueId = `ga-select-${++nextUniqueId$2}`;
3871
+ _uniqueId = `ga-select-${++nextUniqueId$3}`;
3872
3872
  icons = { CircleX };
3873
3873
  _onTouched;
3874
3874
  _onModelChanged;
@@ -3915,6 +3915,7 @@ class GaSelectComponent {
3915
3915
  shouldRecoverFocus = false;
3916
3916
  value = model(null);
3917
3917
  placeholder = input('');
3918
+ searchInputLabel = input(null);
3918
3919
  disabledInput = input(false, {
3919
3920
  alias: 'disabled',
3920
3921
  transform: booleanAttribute,
@@ -4009,6 +4010,17 @@ class GaSelectComponent {
4009
4010
  this.connectedOverlay()?.overlayRef?.updatePosition();
4010
4011
  });
4011
4012
  });
4013
+ effect(() => {
4014
+ // update the overlayPosition since it may change size when selecting/deselecting options
4015
+ this.value();
4016
+ untracked(() => {
4017
+ if (this.multiple()) {
4018
+ setTimeout(() => {
4019
+ this.connectedOverlay()?.overlayRef?.updatePosition();
4020
+ });
4021
+ }
4022
+ });
4023
+ });
4012
4024
  }
4013
4025
  ngAfterContentInit() {
4014
4026
  effect(() => {
@@ -4110,8 +4122,9 @@ class GaSelectComponent {
4110
4122
  this.inputSearch()?.nativeElement !== document.activeElement) {
4111
4123
  this._onTouched?.();
4112
4124
  }
4113
- this.value.set(null);
4114
- this._onModelChanged?.(null);
4125
+ const value = this.multiple() ? [] : null;
4126
+ this.value.set(value);
4127
+ this._onModelChanged?.(value);
4115
4128
  this.autoClose();
4116
4129
  }
4117
4130
  onInputKeyDown(event) {
@@ -4228,13 +4241,13 @@ class GaSelectComponent {
4228
4241
  }, { injector: this.injector });
4229
4242
  }
4230
4243
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4231
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", 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 }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, clearableLabel: { classPropertyName: "clearableLabel", publicName: "clearableLabel", isSignal: true, isRequired: false, transformFunction: null }, canSelectNullable: { classPropertyName: "canSelectNullable", publicName: "canSelectNullable", 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", opened: "opened", closed: "closed" }, 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()", "keydown.backspace": "clearValue(); $event.preventDefault()" }, properties: { "attr.id": "id()", "class.ga-select--multi": "multiple()", "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": "isOpen() ? cdkListbox().id : null", "attr.aria-invalid": "invalid()", "attr.aria-disabled": "disabled()", "attr.aria-owns": "isOpen() && searchable() ? cdkListbox().id : null", "attr.aria-activedescendant": "isOpen() && !searchable() ? activeDescendantId() : null", "attr.tabindex": "disabled() ? -1 : 0" }, classAttribute: "ga-select" }, providers: [
4244
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", 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 }, searchInputLabel: { classPropertyName: "searchInputLabel", publicName: "searchInputLabel", 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 }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, clearableLabel: { classPropertyName: "clearableLabel", publicName: "clearableLabel", isSignal: true, isRequired: false, transformFunction: null }, canSelectNullable: { classPropertyName: "canSelectNullable", publicName: "canSelectNullable", 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", opened: "opened", closed: "closed" }, 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()", "keydown.backspace": "clearValue(); $event.preventDefault()" }, properties: { "attr.id": "id()", "class.ga-select--multi": "multiple()", "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": "isOpen() ? cdkListbox().id : null", "attr.aria-invalid": "invalid()", "attr.aria-disabled": "disabled()", "attr.aria-owns": "isOpen() && searchable() ? cdkListbox().id : null", "attr.aria-activedescendant": "isOpen() && !searchable() ? activeDescendantId() : null", "attr.tabindex": "disabled() ? -1 : 0" }, classAttribute: "ga-select" }, providers: [
4232
4245
  {
4233
4246
  provide: NG_VALUE_ACCESSOR,
4234
4247
  useExisting: forwardRef(() => GaSelectComponent),
4235
4248
  multi: true,
4236
4249
  },
4237
- ], queries: [{ propertyName: "gaOptions", predicate: GaOptionComponent, descendants: true, read: GaOptionComponent, isSignal: true }, { propertyName: "cdkListbox", first: true, predicate: CdkListbox, descendants: true, isSignal: true }, { propertyName: "gaDropdown", first: true, predicate: GaSelectDropdownComponent, 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 }, { propertyName: "connectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.CdkOverlayOrigin }, { directive: GaLabelledByFormFieldDirective, inputs: ["aria-labelledby", "aria-labelledby"] }], ngImport: i0, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()!\" />\n}\n\n<div class=\"ga-select__main-area\">\n @if (hasValue() && (!textValue() || multiple())) {\n @if (customSelectValue()) {\n <div class=\"ga-select__value\">\n <ng-content select=\"ga-select-value\" />\n </div>\n } @else {\n <ga-select-default-value />\n }\n } @else if (!searchable()) {\n <div class=\"ga-select__placeholder\">\n {{ placeholder() }}\n </div>\n }\n\n @if (searchable()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"textValue()\"\n (input)=\"open(); textValue.set(inputSearch.value)\"\n (click)=\"open(); $event.stopPropagation()\"\n [attr.aria-controls]=\"isOpen() ? cdkListbox().id : null\"\n [attr.aria-activedescendant]=\"isOpen() ? activeDescendantId() : null\"\n [attr.aria-label]=\"placeholder() || i18n.defaultSearchInputLabel\"\n [placeholder]=\"hasValue() ? '' : placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n [disabled]=\"disabled()\"\n />\n }\n</div>\n\n<div class=\"ga-select__suffix\">\n @if (clearable() && hasValue()) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n (click)=\"clearValue(); $event.stopPropagation()\"\n [attr.aria-label]=\"clearableLabel() ?? i18n.clearLabel\"\n style=\"font-size: 0\"\n >\n <ga-icon [icon]=\"icons.CircleX\" size=\"16\" />\n </button>\n }\n\n <ga-icon [icon]=\"menuStatusIcon()\" class=\"ga-select__action-icon\" />\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayScrollStrategy]=\"repositionScrollStrategy\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\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$1.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" }] });
4250
+ ], queries: [{ propertyName: "gaOptions", predicate: GaOptionComponent, descendants: true, read: GaOptionComponent, isSignal: true }, { propertyName: "cdkListbox", first: true, predicate: CdkListbox, descendants: true, isSignal: true }, { propertyName: "gaDropdown", first: true, predicate: GaSelectDropdownComponent, 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 }, { propertyName: "connectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.CdkOverlayOrigin }, { directive: GaLabelledByFormFieldDirective, inputs: ["aria-labelledby", "aria-labelledby"] }], ngImport: i0, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()!\" />\n}\n\n<div class=\"ga-select__main-area\">\n @if (hasValue() && (!textValue() || multiple())) {\n @if (customSelectValue()) {\n <div class=\"ga-select__value\">\n <ng-content select=\"ga-select-value\" />\n </div>\n } @else {\n <ga-select-default-value />\n }\n } @else if (!searchable()) {\n <div class=\"ga-select__placeholder\">\n {{ placeholder() }}\n </div>\n }\n\n @if (searchable()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"textValue()\"\n (input)=\"open(); textValue.set(inputSearch.value)\"\n (click)=\"open(); $event.stopPropagation()\"\n [attr.aria-controls]=\"isOpen() ? cdkListbox().id : null\"\n [attr.aria-activedescendant]=\"isOpen() ? activeDescendantId() : null\"\n [attr.aria-label]=\"searchInputLabel() ?? i18n.defaultSearchInputLabel\"\n [placeholder]=\"hasValue() ? '' : placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n [disabled]=\"disabled()\"\n />\n }\n</div>\n\n<div class=\"ga-select__suffix\">\n @if (clearable() && hasValue()) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n (click)=\"clearValue(); $event.stopPropagation()\"\n [attr.aria-label]=\"clearableLabel() ?? i18n.clearLabel\"\n style=\"font-size: 0\"\n >\n <ga-icon [icon]=\"icons.CircleX\" size=\"16\" />\n </button>\n }\n\n <ga-icon [icon]=\"menuStatusIcon()\" class=\"ga-select__action-icon\" />\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayScrollStrategy]=\"repositionScrollStrategy\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\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$1.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" }] });
4238
4251
  }
4239
4252
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaSelectComponent, decorators: [{
4240
4253
  type: Component,
@@ -4277,7 +4290,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
4277
4290
  '(keydown.space)': 'open(); $event.preventDefault()',
4278
4291
  '(keydown.enter)': 'open(); $event.preventDefault()',
4279
4292
  '(keydown.backspace)': 'clearValue(); $event.preventDefault()',
4280
- }, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()!\" />\n}\n\n<div class=\"ga-select__main-area\">\n @if (hasValue() && (!textValue() || multiple())) {\n @if (customSelectValue()) {\n <div class=\"ga-select__value\">\n <ng-content select=\"ga-select-value\" />\n </div>\n } @else {\n <ga-select-default-value />\n }\n } @else if (!searchable()) {\n <div class=\"ga-select__placeholder\">\n {{ placeholder() }}\n </div>\n }\n\n @if (searchable()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"textValue()\"\n (input)=\"open(); textValue.set(inputSearch.value)\"\n (click)=\"open(); $event.stopPropagation()\"\n [attr.aria-controls]=\"isOpen() ? cdkListbox().id : null\"\n [attr.aria-activedescendant]=\"isOpen() ? activeDescendantId() : null\"\n [attr.aria-label]=\"placeholder() || i18n.defaultSearchInputLabel\"\n [placeholder]=\"hasValue() ? '' : placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n [disabled]=\"disabled()\"\n />\n }\n</div>\n\n<div class=\"ga-select__suffix\">\n @if (clearable() && hasValue()) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n (click)=\"clearValue(); $event.stopPropagation()\"\n [attr.aria-label]=\"clearableLabel() ?? i18n.clearLabel\"\n style=\"font-size: 0\"\n >\n <ga-icon [icon]=\"icons.CircleX\" size=\"16\" />\n </button>\n }\n\n <ga-icon [icon]=\"menuStatusIcon()\" class=\"ga-select__action-icon\" />\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayScrollStrategy]=\"repositionScrollStrategy\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n>\n <ng-content select=\"ga-select-dropdown\" />\n</ng-template>\n" }]
4293
+ }, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()!\" />\n}\n\n<div class=\"ga-select__main-area\">\n @if (hasValue() && (!textValue() || multiple())) {\n @if (customSelectValue()) {\n <div class=\"ga-select__value\">\n <ng-content select=\"ga-select-value\" />\n </div>\n } @else {\n <ga-select-default-value />\n }\n } @else if (!searchable()) {\n <div class=\"ga-select__placeholder\">\n {{ placeholder() }}\n </div>\n }\n\n @if (searchable()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"textValue()\"\n (input)=\"open(); textValue.set(inputSearch.value)\"\n (click)=\"open(); $event.stopPropagation()\"\n [attr.aria-controls]=\"isOpen() ? cdkListbox().id : null\"\n [attr.aria-activedescendant]=\"isOpen() ? activeDescendantId() : null\"\n [attr.aria-label]=\"searchInputLabel() ?? i18n.defaultSearchInputLabel\"\n [placeholder]=\"hasValue() ? '' : placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n [disabled]=\"disabled()\"\n />\n }\n</div>\n\n<div class=\"ga-select__suffix\">\n @if (clearable() && hasValue()) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n (click)=\"clearValue(); $event.stopPropagation()\"\n [attr.aria-label]=\"clearableLabel() ?? i18n.clearLabel\"\n style=\"font-size: 0\"\n >\n <ga-icon [icon]=\"icons.CircleX\" size=\"16\" />\n </button>\n }\n\n <ga-icon [icon]=\"menuStatusIcon()\" class=\"ga-select__action-icon\" />\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayScrollStrategy]=\"repositionScrollStrategy\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n>\n <ng-content select=\"ga-select-dropdown\" />\n</ng-template>\n" }]
4281
4294
  }], ctorParameters: () => [] });
4282
4295
 
4283
4296
  class GaOptgroupComponent {
@@ -4372,6 +4385,933 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
4372
4385
  }]
4373
4386
  }] });
4374
4387
 
4388
+ class GaDataOptionComponent {
4389
+ _isSelected = signal(false);
4390
+ _isActive = signal(false);
4391
+ selectComponent = inject(GaDataSelectComponent);
4392
+ cdkOption = inject(CdkOption, { self: true });
4393
+ value = input(null);
4394
+ disabled = input(false, { transform: booleanAttribute });
4395
+ withInput = input(this.selectComponent.multiple(), {
4396
+ transform: booleanAttribute,
4397
+ });
4398
+ selected = computed(() => {
4399
+ if (!this._isSelected()) {
4400
+ return false;
4401
+ }
4402
+ if (this.cdkOption.value !== undefined &&
4403
+ this.cdkOption.value !== null &&
4404
+ this.cdkOption.value !== '') {
4405
+ return true;
4406
+ }
4407
+ return this.selectComponent.canSelectNullable();
4408
+ });
4409
+ active = this._isActive.asReadonly();
4410
+ constructor() {
4411
+ // NOTE: this is a workaround to set the default empty value (null) for cdkOption
4412
+ if (this.value() !== this.cdkOption.value &&
4413
+ this.cdkOption.value === undefined) {
4414
+ this.cdkOption.value = this.value();
4415
+ }
4416
+ afterEveryRender({
4417
+ read: () => {
4418
+ // NOTE: currently there is no other reliable way to track the selected state,
4419
+ // refactor once cdk will be based on signals or more appropriate events introduced
4420
+ this._isSelected.set(this.cdkOption.isSelected());
4421
+ this._isActive.set(this.cdkOption.isActive());
4422
+ },
4423
+ });
4424
+ }
4425
+ autoClose(event) {
4426
+ if (this.cdkOption.isSelected()) {
4427
+ // if already selected, auto close
4428
+ this.selectComponent.autoClose();
4429
+ event?.preventDefault();
4430
+ }
4431
+ }
4432
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4433
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: GaDataOptionComponent, isStandalone: true, selector: "ga-data-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: { "keydown.enter": "autoClose($event);", "keydown.space": "autoClose($event);", "click": "autoClose();" }, 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$5.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<div class=\"ga-dropdown__item-label\"><ng-content /></div>\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"] }] });
4434
+ }
4435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataOptionComponent, decorators: [{
4436
+ type: Component,
4437
+ args: [{ selector: 'ga-data-option', imports: [GaCheckboxModule, GaRadioModule], hostDirectives: [
4438
+ {
4439
+ directive: CdkOption,
4440
+ inputs: [
4441
+ 'cdkOption: value',
4442
+ 'cdkOptionDisabled: disabled',
4443
+ 'cdkOptionTypeaheadLabel: typeaheadLabel',
4444
+ ],
4445
+ },
4446
+ ], host: {
4447
+ class: 'ga-dropdown__item',
4448
+ '[class.ga-dropdown__item--selected]': 'selected()',
4449
+ '[class.ga-dropdown__item--disabled]': 'cdkOption.disabled',
4450
+ '[class.ga-dropdown__item--active]': 'active() && !cdkOption.disabled',
4451
+ '(keydown.enter)': 'autoClose($event);',
4452
+ '(keydown.space)': 'autoClose($event);',
4453
+ '(click)': 'autoClose();',
4454
+ }, 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<div class=\"ga-dropdown__item-label\"><ng-content /></div>\n" }]
4455
+ }], ctorParameters: () => [] });
4456
+
4457
+ class GaDataSelectValueComponent {
4458
+ selectComponent = inject(GaDataSelectComponent);
4459
+ icons = { X };
4460
+ customValueTemplate = input();
4461
+ customValueTemplateContext = (item) => {
4462
+ if (!item) {
4463
+ return { $implicit: '', value: null, item: null };
4464
+ }
4465
+ return {
4466
+ $implicit: this.selectComponent.getItemLabel(item),
4467
+ value: this.selectComponent.getItemValue(item),
4468
+ item,
4469
+ };
4470
+ };
4471
+ singleViewValue = computed(() => {
4472
+ if (!this.selectComponent.hasValue()) {
4473
+ return '';
4474
+ }
4475
+ const selectValue = this.selectComponent.value();
4476
+ if (!this.selectComponent.bindValue()) {
4477
+ return this.selectComponent.getItemLabel(selectValue);
4478
+ }
4479
+ const item = this.selectComponent
4480
+ .items()
4481
+ .find((item) => this.selectComponent.compareFn()(this.selectComponent.getItemValue(item), selectValue));
4482
+ return this.selectComponent.getItemLabel(item);
4483
+ });
4484
+ selectedItems = computed(() => {
4485
+ const value = this.selectComponent.value();
4486
+ if (!this.selectComponent.hasValue() || !Array.isArray(value)) {
4487
+ return [];
4488
+ }
4489
+ if (!this.selectComponent.bindValue()) {
4490
+ return value;
4491
+ }
4492
+ return this.selectComponent
4493
+ .items()
4494
+ .filter((item) => value.some((v) => this.selectComponent.compareFn()(this.selectComponent.getItemValue(item), v)));
4495
+ });
4496
+ deselectOption(value) {
4497
+ this.selectComponent.deselectValue(value);
4498
+ }
4499
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4500
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: GaDataSelectValueComponent, isStandalone: true, selector: "ga-data-select-value", inputs: { customValueTemplate: { classPropertyName: "customValueTemplate", publicName: "customValueTemplate", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-select__value" }, ngImport: i0, template: "@if (selectComponent.multiple()) {\n @for (\n selectedItem of selectedItems();\n track selectComponent.getItemValue(selectedItem)\n ) {\n <div\n class=\"ga-tag\"\n [class.ga-tag--interactive-selected]=\"!selectComponent.disabled()\"\n [class.ga-tag--interactive-selected-disabled]=\"selectComponent.disabled()\"\n >\n <span class=\"ga-tag__label\">\n @if (customValueTemplate(); as templateRef) {\n <ng-container\n [ngTemplateOutlet]=\"templateRef\"\n [ngTemplateOutletContext]=\"customValueTemplateContext(selectedItem)\"\n />\n } @else {\n {{ selectComponent.getItemLabel(selectedItem) }}\n }\n </span>\n @if (!selectComponent.disabled()) {\n <div class=\"ga-tag__separator\"></div>\n <ga-icon\n [icon]=\"icons.X\"\n size=\"16\"\n class=\"ga-tag__icon\"\n (click)=\"\n deselectOption(selectComponent.getItemValue(selectedItem));\n $event.stopPropagation()\n \"\n />\n }\n </div>\n }\n} @else {\n @if (customValueTemplate(); as templateRef) {\n <ng-container\n [ngTemplateOutlet]=\"templateRef\"\n [ngTemplateOutletContext]=\"\n customValueTemplateContext(selectComponent.selectedItem())\n \"\n />\n } @else {\n {{ singleViewValue() }}\n }\n}\n", dependencies: [{ kind: "ngmodule", type: GaIconModule }, { kind: "component", type: GaIconComponent, selector: "ga-icon", inputs: ["icon", "size", "color", "strokeWidth"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
4501
+ }
4502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectValueComponent, decorators: [{
4503
+ type: Component,
4504
+ args: [{ selector: 'ga-data-select-value', imports: [GaIconModule, NgTemplateOutlet], host: {
4505
+ class: 'ga-select__value',
4506
+ }, template: "@if (selectComponent.multiple()) {\n @for (\n selectedItem of selectedItems();\n track selectComponent.getItemValue(selectedItem)\n ) {\n <div\n class=\"ga-tag\"\n [class.ga-tag--interactive-selected]=\"!selectComponent.disabled()\"\n [class.ga-tag--interactive-selected-disabled]=\"selectComponent.disabled()\"\n >\n <span class=\"ga-tag__label\">\n @if (customValueTemplate(); as templateRef) {\n <ng-container\n [ngTemplateOutlet]=\"templateRef\"\n [ngTemplateOutletContext]=\"customValueTemplateContext(selectedItem)\"\n />\n } @else {\n {{ selectComponent.getItemLabel(selectedItem) }}\n }\n </span>\n @if (!selectComponent.disabled()) {\n <div class=\"ga-tag__separator\"></div>\n <ga-icon\n [icon]=\"icons.X\"\n size=\"16\"\n class=\"ga-tag__icon\"\n (click)=\"\n deselectOption(selectComponent.getItemValue(selectedItem));\n $event.stopPropagation()\n \"\n />\n }\n </div>\n }\n} @else {\n @if (customValueTemplate(); as templateRef) {\n <ng-container\n [ngTemplateOutlet]=\"templateRef\"\n [ngTemplateOutletContext]=\"\n customValueTemplateContext(selectComponent.selectedItem())\n \"\n />\n } @else {\n {{ singleViewValue() }}\n }\n}\n" }]
4507
+ }] });
4508
+
4509
+ function GA_DATA_SELECT_I18N_FACTORY() {
4510
+ return new GaDataSelectI18nDefault();
4511
+ }
4512
+ class GaDataSelectI18n {
4513
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectI18n, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4514
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectI18n, providedIn: 'root', useFactory: GA_DATA_SELECT_I18N_FACTORY });
4515
+ }
4516
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectI18n, decorators: [{
4517
+ type: Injectable,
4518
+ args: [{
4519
+ providedIn: 'root',
4520
+ useFactory: GA_DATA_SELECT_I18N_FACTORY,
4521
+ }]
4522
+ }] });
4523
+ class GaDataSelectI18nDefault extends GaDataSelectI18n {
4524
+ /** A label for the clear button */
4525
+ clearLabel = 'Clear';
4526
+ /** A label for the search input */
4527
+ searchInputLabel = 'Search';
4528
+ /** A label shown when there are no options to display */
4529
+ noOptionsLabel = 'No options';
4530
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectI18nDefault, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4531
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectI18nDefault });
4532
+ }
4533
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectI18nDefault, decorators: [{
4534
+ type: Injectable
4535
+ }] });
4536
+ function provideGaDataSelectI18n(value) {
4537
+ return makeEnvironmentProviders([
4538
+ typeof value === 'function'
4539
+ ? { provide: GaDataSelectI18n, useFactory: value }
4540
+ : { provide: GaDataSelectI18n, useValue: value },
4541
+ ]);
4542
+ }
4543
+
4544
+ class GaDataSelectDropdownSpinnerComponent {
4545
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectDropdownSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4546
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.4", type: GaDataSelectDropdownSpinnerComponent, isStandalone: true, selector: "ga-data-select-dropdown-spinner", host: { classAttribute: "ga-dropdown__spinner" }, ngImport: i0, template: `<ga-spinner size="16" />`, isInline: true, dependencies: [{ kind: "ngmodule", type: GaSpinnerModule }, { kind: "component", type: GaSpinnerComponent, selector: "ga-spinner", inputs: ["size"] }] });
4547
+ }
4548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectDropdownSpinnerComponent, decorators: [{
4549
+ type: Component,
4550
+ args: [{
4551
+ selector: 'ga-data-select-dropdown-spinner',
4552
+ template: `<ga-spinner size="16" />`,
4553
+ imports: [GaSpinnerModule],
4554
+ host: {
4555
+ class: 'ga-dropdown__spinner',
4556
+ },
4557
+ }]
4558
+ }] });
4559
+
4560
+ class GaDataSelectDropdownComponent {
4561
+ elementRef = inject(ElementRef);
4562
+ cdkListbox = inject(CdkListbox, { self: true });
4563
+ loading = input(false, { transform: booleanAttribute });
4564
+ resetScroll() {
4565
+ this.elementRef.nativeElement.scrollTo(0, 0);
4566
+ }
4567
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4568
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: GaDataSelectDropdownComponent, isStandalone: true, selector: "ga-data-select-dropdown", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-dropdown ga-dropdown__content" }, hostDirectives: [{ directive: i1$5.CdkListbox, inputs: ["cdkListboxMultiple", "multiple", "cdkListboxUseActiveDescendant", "useActiveDescendant", "cdkListboxNavigationWrapDisabled", "navigationWrapDisabled", "cdkListboxCompareWith", "compareWith"] }], ngImport: i0, template: "<ng-content />\n\n@if (loading()) {\n <ga-data-select-dropdown-spinner />\n}\n", dependencies: [{ kind: "component", type: GaDataSelectDropdownSpinnerComponent, selector: "ga-data-select-dropdown-spinner" }] });
4569
+ }
4570
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectDropdownComponent, decorators: [{
4571
+ type: Component,
4572
+ args: [{ selector: 'ga-data-select-dropdown', imports: [GaDataSelectDropdownSpinnerComponent], hostDirectives: [
4573
+ {
4574
+ directive: CdkListbox,
4575
+ inputs: [
4576
+ 'cdkListboxMultiple: multiple',
4577
+ 'cdkListboxUseActiveDescendant: useActiveDescendant',
4578
+ 'cdkListboxNavigationWrapDisabled: navigationWrapDisabled',
4579
+ 'cdkListboxCompareWith: compareWith',
4580
+ ],
4581
+ },
4582
+ ], host: {
4583
+ class: 'ga-dropdown ga-dropdown__content',
4584
+ }, template: "<ng-content />\n\n@if (loading()) {\n <ga-data-select-dropdown-spinner />\n}\n" }]
4585
+ }] });
4586
+
4587
+ class GaDataOptgroupComponent {
4588
+ label = input();
4589
+ customLabelTemplate = input();
4590
+ customLabelContext = input();
4591
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataOptgroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4592
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: GaDataOptgroupComponent, isStandalone: true, selector: "ga-data-optgroup", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, customLabelTemplate: { classPropertyName: "customLabelTemplate", publicName: "customLabelTemplate", isSignal: true, isRequired: false, transformFunction: null }, customLabelContext: { classPropertyName: "customLabelContext", publicName: "customLabelContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" } }, ngImport: i0, template: `
4593
+ @if (customLabelTemplate(); as templateRef) {
4594
+ <div class="ga-dropdown__caption">
4595
+ <ng-container
4596
+ [ngTemplateOutlet]="templateRef"
4597
+ [ngTemplateOutletContext]="customLabelContext()"
4598
+ />
4599
+ </div>
4600
+ } @else if (label()) {
4601
+ <div class="ga-dropdown__caption">{{ label() }}</div>
4602
+ }
4603
+ <ng-content />
4604
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
4605
+ }
4606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataOptgroupComponent, decorators: [{
4607
+ type: Component,
4608
+ args: [{
4609
+ selector: 'ga-data-optgroup',
4610
+ imports: [NgTemplateOutlet],
4611
+ template: `
4612
+ @if (customLabelTemplate(); as templateRef) {
4613
+ <div class="ga-dropdown__caption">
4614
+ <ng-container
4615
+ [ngTemplateOutlet]="templateRef"
4616
+ [ngTemplateOutletContext]="customLabelContext()"
4617
+ />
4618
+ </div>
4619
+ } @else if (label()) {
4620
+ <div class="ga-dropdown__caption">{{ label() }}</div>
4621
+ }
4622
+ <ng-content />
4623
+ `,
4624
+ host: {
4625
+ role: 'group',
4626
+ },
4627
+ }]
4628
+ }] });
4629
+
4630
+ class GaDataSelectValueDirective {
4631
+ templateRef = inject(TemplateRef, { self: true });
4632
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectValueDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4633
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.4", type: GaDataSelectValueDirective, isStandalone: true, selector: "[gaDataSelectValueTpl]", ngImport: i0 });
4634
+ }
4635
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectValueDirective, decorators: [{
4636
+ type: Directive,
4637
+ args: [{
4638
+ selector: '[gaDataSelectValueTpl]',
4639
+ }]
4640
+ }] });
4641
+
4642
+ class GaDataSelectOptionLabelDirective {
4643
+ templateRef = inject(TemplateRef, { self: true });
4644
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectOptionLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4645
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.4", type: GaDataSelectOptionLabelDirective, isStandalone: true, selector: "[gaDataSelectOptionTpl]", ngImport: i0 });
4646
+ }
4647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectOptionLabelDirective, decorators: [{
4648
+ type: Directive,
4649
+ args: [{
4650
+ selector: '[gaDataSelectOptionTpl]',
4651
+ }]
4652
+ }] });
4653
+
4654
+ class GaDataSelectOptgroupLabelDirective {
4655
+ templateRef = inject(TemplateRef, { self: true });
4656
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectOptgroupLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4657
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.4", type: GaDataSelectOptgroupLabelDirective, isStandalone: true, selector: "[gaDataSelectOptgroupLabelTpl]", ngImport: i0 });
4658
+ }
4659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectOptgroupLabelDirective, decorators: [{
4660
+ type: Directive,
4661
+ args: [{
4662
+ selector: '[gaDataSelectOptgroupLabelTpl]',
4663
+ }]
4664
+ }] });
4665
+
4666
+ class GaIntersectionTriggerComponent {
4667
+ observer;
4668
+ anchor = inject(ElementRef);
4669
+ rootElement = input();
4670
+ rootMargin = input('0px');
4671
+ parentAsRoot = input(false, { transform: booleanAttribute });
4672
+ trigger = output();
4673
+ root = computed(() => {
4674
+ return this.parentAsRoot()
4675
+ ? this.anchor.nativeElement.parentElement
4676
+ : this.rootElement()?.nativeElement;
4677
+ });
4678
+ constructor() {
4679
+ afterNextRender(() => {
4680
+ this.observer = new IntersectionObserver(([entry]) => {
4681
+ if (entry.isIntersecting) {
4682
+ this.trigger.emit();
4683
+ }
4684
+ }, {
4685
+ root: this.root(),
4686
+ rootMargin: this.rootMargin(),
4687
+ threshold: 0,
4688
+ });
4689
+ this.observer.observe(this.anchor.nativeElement);
4690
+ });
4691
+ }
4692
+ ngOnDestroy() {
4693
+ this.observer?.disconnect();
4694
+ }
4695
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaIntersectionTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4696
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.4", type: GaIntersectionTriggerComponent, isStandalone: true, selector: "ga-intersection-trigger", inputs: { rootElement: { classPropertyName: "rootElement", publicName: "rootElement", isSignal: true, isRequired: false, transformFunction: null }, rootMargin: { classPropertyName: "rootMargin", publicName: "rootMargin", isSignal: true, isRequired: false, transformFunction: null }, parentAsRoot: { classPropertyName: "parentAsRoot", publicName: "parentAsRoot", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { trigger: "trigger" }, ngImport: i0, template: ``, isInline: true, styles: [":host{height:0px;display:block;flex-shrink:0}\n"] });
4697
+ }
4698
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaIntersectionTriggerComponent, decorators: [{
4699
+ type: Component,
4700
+ args: [{ selector: 'ga-intersection-trigger', template: ``, styles: [":host{height:0px;display:block;flex-shrink:0}\n"] }]
4701
+ }], ctorParameters: () => [] });
4702
+
4703
+ let nextUniqueId$2 = 0;
4704
+ class GaDataSelectComponent {
4705
+ _uniqueId = `ga-data-select-${++nextUniqueId$2}`;
4706
+ icons = { CircleX };
4707
+ _onTouched;
4708
+ _onModelChanged;
4709
+ positions = [
4710
+ {
4711
+ originX: 'end',
4712
+ originY: 'bottom',
4713
+ overlayX: 'end',
4714
+ overlayY: 'top',
4715
+ offsetY: 8,
4716
+ },
4717
+ {
4718
+ originX: 'end',
4719
+ originY: 'top',
4720
+ overlayX: 'end',
4721
+ overlayY: 'bottom',
4722
+ offsetY: -8,
4723
+ },
4724
+ {
4725
+ originX: 'start',
4726
+ originY: 'bottom',
4727
+ overlayX: 'start',
4728
+ overlayY: 'top',
4729
+ offsetY: 8,
4730
+ },
4731
+ {
4732
+ originX: 'start',
4733
+ originY: 'top',
4734
+ overlayX: 'start',
4735
+ overlayY: 'bottom',
4736
+ offsetY: -8,
4737
+ },
4738
+ ];
4739
+ injector = inject(Injector);
4740
+ elementRef = inject((ElementRef));
4741
+ formFieldConnector = inject(GaFormFieldConnector, {
4742
+ optional: true,
4743
+ });
4744
+ i18n = inject(GaDataSelectI18n);
4745
+ overlayOrigin = inject(CdkOverlayOrigin);
4746
+ repositionScrollStrategy = createRepositionScrollStrategy(this.injector);
4747
+ implicitNgControlState = injectNgControlState();
4748
+ _isOpen = signal(false);
4749
+ shouldRecoverFocus = false;
4750
+ searchValue = signal(null);
4751
+ multiple = input(false, { transform: booleanAttribute });
4752
+ value = model(null);
4753
+ placeholder = input('');
4754
+ disabledInput = input(false, {
4755
+ alias: 'disabled',
4756
+ transform: booleanAttribute,
4757
+ });
4758
+ invalidInput = input(null, {
4759
+ alias: 'invalid',
4760
+ transform: booleanAttribute,
4761
+ });
4762
+ compareFn = input((a, b) => a === b);
4763
+ searchable = input(false, { transform: booleanAttribute });
4764
+ customFilter = input(false, { transform: booleanAttribute });
4765
+ clearable = input(false, { transform: booleanAttribute });
4766
+ clearableLabel = input();
4767
+ noOptionsLabel = input();
4768
+ canSelectNullable = input(false, {
4769
+ transform: booleanAttribute,
4770
+ });
4771
+ leftIcon = input();
4772
+ idInput = input(null, { alias: 'id' });
4773
+ items = input([]);
4774
+ bindValue = input();
4775
+ bindLabel = input();
4776
+ groupBy = input();
4777
+ loading = input(false, { transform: booleanAttribute });
4778
+ withOptionInput = input(null, { transform: booleanAttribute });
4779
+ searchValueChange = output();
4780
+ opened = output();
4781
+ closed = output();
4782
+ optionsEndReached = output();
4783
+ dropdownElRef = viewChild('selectDropdown', {
4784
+ read: ElementRef,
4785
+ });
4786
+ gaOptions = viewChildren(GaDataOptionComponent);
4787
+ cdkListbox = viewChild(CdkListbox);
4788
+ gaDropdown = viewChild(GaDataSelectDropdownComponent);
4789
+ customValueTemplate = contentChild(GaDataSelectValueDirective);
4790
+ customOptionLabelTemplate = contentChild(GaDataSelectOptionLabelDirective);
4791
+ customOptgroupLabelTemplate = contentChild(GaDataSelectOptgroupLabelDirective);
4792
+ inputSearch = viewChild('inputSearch');
4793
+ connectedOverlay = viewChild(CdkConnectedOverlay);
4794
+ id = computed(() => {
4795
+ return this.idInput() ?? this._uniqueId;
4796
+ });
4797
+ isOpen = this._isOpen.asReadonly();
4798
+ disabled = linkedSignal(() => this.disabledInput());
4799
+ menuStatusIcon = computed(() => {
4800
+ return this._isOpen() ? ChevronUp : ChevronDown;
4801
+ });
4802
+ selectedItem = computed(() => {
4803
+ if (!this.bindValue()) {
4804
+ return this.value();
4805
+ }
4806
+ return this.items().find((item) => this.compareFn()(this.getItemValue(item), this.value()));
4807
+ });
4808
+ // Selected items for multi-select
4809
+ selectedItems = computed(() => {
4810
+ const value = this.value();
4811
+ if (!this.hasValue() || !Array.isArray(value)) {
4812
+ return [];
4813
+ }
4814
+ return this.items().filter((item) => value.some((v) => this.compareFn()(this.getItemValue(item), v)));
4815
+ });
4816
+ // Template context factory for option labels
4817
+ getOptionLabelTemplateContext(item) {
4818
+ return {
4819
+ $implicit: this.getItemLabel(item),
4820
+ value: this.getItemValue(item),
4821
+ item: item,
4822
+ };
4823
+ }
4824
+ // Template context factory for optgroup labels
4825
+ getOptgroupLabelTemplateContext(group) {
4826
+ return {
4827
+ $implicit: group.label,
4828
+ label: group.label,
4829
+ items: group.items,
4830
+ };
4831
+ }
4832
+ filteredItems = computed(() => {
4833
+ const searchText = this.searchValue()?.toLowerCase() ?? '';
4834
+ if (!searchText || !this.searchable() || this.customFilter()) {
4835
+ return this.items();
4836
+ }
4837
+ return this.items().filter((item) => {
4838
+ const label = this.getItemLabel(item);
4839
+ return label.toLowerCase().includes(searchText);
4840
+ });
4841
+ });
4842
+ // Returns selected values not in filtered items, ensuring cdkListbox maintains state during filtering
4843
+ virtualItems = computed(() => {
4844
+ const value = this.value();
4845
+ if (this.bindValue() || !Array.isArray(value)) {
4846
+ return [];
4847
+ }
4848
+ return value.filter((val) => {
4849
+ return !this.filteredItems().some((item) => this.compareFn()(this.getItemValue(item), val));
4850
+ });
4851
+ });
4852
+ groupedItems = computed(() => {
4853
+ const items = this.filteredItems();
4854
+ const groupByKey = this.groupBy();
4855
+ if (!groupByKey) {
4856
+ return [{ label: null, items }];
4857
+ }
4858
+ const groups = new Map();
4859
+ items.forEach((item) => {
4860
+ const groupLabel = typeof groupByKey === 'function'
4861
+ ? groupByKey(item)
4862
+ : this.getNestedValue(item, groupByKey);
4863
+ if (!groups.has(groupLabel)) {
4864
+ groups.set(groupLabel, []);
4865
+ }
4866
+ groups.get(groupLabel).push(item);
4867
+ });
4868
+ return Array.from(groups.entries()).map(([label, items]) => ({
4869
+ label,
4870
+ items,
4871
+ }));
4872
+ });
4873
+ hasNoOptions = computed(() => {
4874
+ return this.filteredItems().length === 0;
4875
+ });
4876
+ activeDescendantId = computed(() => {
4877
+ const activeOption = this.gaOptions().find((option) => option.active());
4878
+ return activeOption?.cdkOption.id;
4879
+ });
4880
+ hasValue = computed(() => {
4881
+ const value = this.value();
4882
+ if (!this.multiple() && (value === null || value === undefined)) {
4883
+ return this.canSelectNullable();
4884
+ }
4885
+ if (Array.isArray(value)) {
4886
+ return value.length > 0;
4887
+ }
4888
+ return true;
4889
+ });
4890
+ invalid = computed(() => {
4891
+ return this.invalidInput() ?? this.implicitNgControlState.inError();
4892
+ });
4893
+ listboxCompareWith = computed(() => {
4894
+ return (o1, o2) => {
4895
+ if (o1 === null || o1 === undefined || o2 === null || o2 === undefined) {
4896
+ // for some reason cdkListbox compareWith is sometimes called with null/undefined values
4897
+ // in that case, use strict equality to avoid null reference issues
4898
+ return o1 === o2;
4899
+ }
4900
+ return this.compareFn()(o1, o2);
4901
+ };
4902
+ });
4903
+ // Helper method to get the label for an item
4904
+ getItemLabel(item) {
4905
+ const bindLabel = this.bindLabel();
4906
+ if (!bindLabel) {
4907
+ return String(item);
4908
+ }
4909
+ return String(this.getNestedValue(item, bindLabel));
4910
+ }
4911
+ // Helper method to get the value for an item
4912
+ getItemValue(item) {
4913
+ const bindValue = this.bindValue();
4914
+ if (!bindValue) {
4915
+ return item;
4916
+ }
4917
+ if (this.searchable()) {
4918
+ return item;
4919
+ }
4920
+ return this.getNestedValue(item, bindValue);
4921
+ }
4922
+ // Helper method to check if an item is disabled
4923
+ getItemDisabled(item) {
4924
+ return item?.$disabled === true;
4925
+ }
4926
+ // Helper method to get the typeahead label for an item
4927
+ getItemTypeaheadLabel(item) {
4928
+ return item?.$typeaheadLabel;
4929
+ }
4930
+ // Helper method to get nested property value
4931
+ getNestedValue(obj, path) {
4932
+ return path.split('.').reduce((current, prop) => current?.[prop], obj);
4933
+ }
4934
+ constructor() {
4935
+ effect(() => {
4936
+ // if the select became disabled while open, close it
4937
+ if (this.disabled() && this._isOpen()) {
4938
+ this.close();
4939
+ }
4940
+ });
4941
+ if (isDevMode()) {
4942
+ effect(() => {
4943
+ if (this.bindValue() && this.searchable()) {
4944
+ console.warn('GaDataSelectComponent: `bindValue` is ignored with `searchable` mode, value and item must be of the same type. See docs for more details.');
4945
+ }
4946
+ });
4947
+ }
4948
+ const formFieldConnector = this.formFieldConnector;
4949
+ if (formFieldConnector) {
4950
+ effect(() => formFieldConnector.controlDisabled.set(this.disabled()));
4951
+ }
4952
+ effect(() => {
4953
+ // emit search value changes
4954
+ this.searchValueChange.emit(this.searchValue());
4955
+ });
4956
+ effect(() => {
4957
+ // update the overlayPosition since it may change size when selecting/deselecting options
4958
+ this.value();
4959
+ untracked(() => {
4960
+ if (this.multiple()) {
4961
+ setTimeout(() => {
4962
+ this.connectedOverlay()?.overlayRef?.updatePosition();
4963
+ });
4964
+ }
4965
+ });
4966
+ });
4967
+ effect(() => {
4968
+ // sync cdkListbox inputs & value (push)
4969
+ const cdkListbox = this.cdkListbox();
4970
+ if (cdkListbox) {
4971
+ cdkListbox.value = this.multiple()
4972
+ ? this.value()
4973
+ : [this.value()];
4974
+ }
4975
+ });
4976
+ effect(() => {
4977
+ // when options change, ensure there is an active option selected and correct overlay position
4978
+ const options = this.gaOptions();
4979
+ untracked(() => {
4980
+ if (!this.isOpen()) {
4981
+ return;
4982
+ }
4983
+ if (!options.some((option) => option.cdkOption.isActive())) {
4984
+ const firstOption = options.find((option) => !option.cdkOption.disabled);
4985
+ const selectedOption = options.find((option) => option.cdkOption.isSelected());
4986
+ if (selectedOption && !this.searchValue()) {
4987
+ this.cdkListbox()?._setActiveOption(selectedOption.cdkOption);
4988
+ }
4989
+ else if (firstOption) {
4990
+ // if no active option, set the first enabled as active
4991
+ this.cdkListbox()?._setActiveOption(firstOption.cdkOption);
4992
+ }
4993
+ }
4994
+ this.connectedOverlay()?.overlayRef?.updatePosition();
4995
+ });
4996
+ });
4997
+ effect(() => {
4998
+ // sync cdkListbox value changes (pull)
4999
+ const cdkListbox = this.cdkListbox();
5000
+ if (cdkListbox) {
5001
+ untracked(() => {
5002
+ cdkListbox.valueChange.subscribe(({ value }) => {
5003
+ if (!this.multiple()) {
5004
+ [value] = value;
5005
+ }
5006
+ this.value.set(value);
5007
+ this._onModelChanged?.(value);
5008
+ this.autoClose();
5009
+ });
5010
+ });
5011
+ }
5012
+ });
5013
+ }
5014
+ ngOnInit() {
5015
+ // initialize proper default value for multiple select
5016
+ if (this.multiple() && this.value() === null) {
5017
+ this.value.set([]);
5018
+ }
5019
+ }
5020
+ writeValue(value) {
5021
+ this.value.set(value);
5022
+ }
5023
+ registerOnChange(fn) {
5024
+ this._onModelChanged = fn;
5025
+ }
5026
+ registerOnTouched(fn) {
5027
+ this._onTouched = fn;
5028
+ }
5029
+ setDisabledState(disabled) {
5030
+ this.disabled.set(disabled);
5031
+ }
5032
+ toggle() {
5033
+ if (this._isOpen()) {
5034
+ this.close();
5035
+ }
5036
+ else {
5037
+ this.open();
5038
+ }
5039
+ }
5040
+ open() {
5041
+ if (this.disabled() || this._isOpen()) {
5042
+ return;
5043
+ }
5044
+ this._isOpen.set(true);
5045
+ }
5046
+ close() {
5047
+ if (!this._isOpen()) {
5048
+ return;
5049
+ }
5050
+ this._isOpen.set(false);
5051
+ }
5052
+ autoClose() {
5053
+ // close that was initiated by clicking the option
5054
+ if (!this.multiple()) {
5055
+ this.shouldRecoverFocus = true;
5056
+ this.close();
5057
+ }
5058
+ }
5059
+ focusListbox() {
5060
+ this.cdkListbox().focus();
5061
+ }
5062
+ setActiveItemAsSelected() {
5063
+ const options = this.gaOptions();
5064
+ let activeOption = options.find((option) => option.cdkOption.isActive());
5065
+ if (!activeOption && options.length > 0) {
5066
+ activeOption = options[0];
5067
+ }
5068
+ if (activeOption) {
5069
+ const { cdkOption } = activeOption;
5070
+ if (!this.multiple() && cdkOption.isSelected()) {
5071
+ // if single select and the active option is already selected, do nothing
5072
+ return;
5073
+ }
5074
+ this.cdkListbox().toggle(cdkOption);
5075
+ this.syncValue();
5076
+ }
5077
+ }
5078
+ onOverlayKeydown(event) {
5079
+ if (event.code === 'Escape') {
5080
+ this.shouldRecoverFocus = true;
5081
+ }
5082
+ else if (event.code === 'Tab') {
5083
+ this.close();
5084
+ }
5085
+ }
5086
+ clearValue() {
5087
+ if (!this.clearable()) {
5088
+ return;
5089
+ }
5090
+ if (this.elementRef.nativeElement !== document.activeElement &&
5091
+ this.inputSearch()?.nativeElement !== document.activeElement) {
5092
+ this._onTouched?.();
5093
+ }
5094
+ const value = this.multiple() ? [] : null;
5095
+ this.value.set(value);
5096
+ this._onModelChanged?.(value);
5097
+ this.autoClose();
5098
+ }
5099
+ onInputKeyDown(event) {
5100
+ switch (event.code) {
5101
+ case 'ArrowDown':
5102
+ case 'ArrowUp':
5103
+ case 'Enter': {
5104
+ // redirect the event to the cdkListbox
5105
+ event.preventDefault();
5106
+ event.stopPropagation();
5107
+ const eventClone = new KeyboardEvent(event.type, event);
5108
+ this.dropdownElRef()?.nativeElement.dispatchEvent(eventClone);
5109
+ if (event.code === 'Enter' && this.isOpen()) {
5110
+ // if the value wasn't changed via cdkListbox valueChange, close the dropdown manually
5111
+ this.autoClose();
5112
+ }
5113
+ break;
5114
+ }
5115
+ case 'Space':
5116
+ event.stopPropagation();
5117
+ break;
5118
+ case 'Tab':
5119
+ this.close();
5120
+ break;
5121
+ case 'Backspace':
5122
+ if (this.searchValue() === '') {
5123
+ this.clearValue();
5124
+ }
5125
+ event.stopPropagation();
5126
+ break;
5127
+ }
5128
+ }
5129
+ onOverlayAttach() {
5130
+ this.shouldRecoverFocus = false;
5131
+ this._isOpen.set(true);
5132
+ if (this.searchable()) {
5133
+ this.inputSearch().nativeElement.focus();
5134
+ }
5135
+ else {
5136
+ this.focusListbox();
5137
+ }
5138
+ this.searchValue.set('');
5139
+ afterNextRender({
5140
+ mixedReadWrite: () => {
5141
+ if (!this.multiple()) {
5142
+ this.markSelectedOptionAsActive();
5143
+ }
5144
+ this.scrollActiveOptionIntoView();
5145
+ },
5146
+ }, { injector: this.injector });
5147
+ this.opened.emit();
5148
+ }
5149
+ onOverlayDetach() {
5150
+ this._isOpen.set(false);
5151
+ if (this.inputSearch()?.nativeElement === document.activeElement ||
5152
+ this.shouldRecoverFocus) {
5153
+ this.elementRef.nativeElement.focus();
5154
+ }
5155
+ this.searchValue.set(null);
5156
+ this._onTouched?.();
5157
+ this.closed.emit();
5158
+ }
5159
+ deselectValue(value) {
5160
+ const comboboxValue = this.value();
5161
+ if (Array.isArray(comboboxValue)) {
5162
+ this.value.update((v) => v.filter((item) => !this.compareFn()(item, value)));
5163
+ }
5164
+ else {
5165
+ this.value.set(null);
5166
+ }
5167
+ this._onModelChanged?.(this.value());
5168
+ }
5169
+ endReached() {
5170
+ const dropdownEl = this.dropdownElRef()?.nativeElement;
5171
+ if (!dropdownEl) {
5172
+ return;
5173
+ }
5174
+ if (dropdownEl.scrollHeight > dropdownEl.clientHeight) {
5175
+ this.optionsEndReached.emit();
5176
+ }
5177
+ }
5178
+ syncValue() {
5179
+ let { value } = this.cdkListbox();
5180
+ if (!this.multiple()) {
5181
+ [value] = value;
5182
+ }
5183
+ this.value.set(value);
5184
+ }
5185
+ markSelectedOptionAsActive() {
5186
+ const selectedOption = this.gaOptions().find((option) => option.cdkOption.isSelected());
5187
+ if (selectedOption) {
5188
+ this.cdkListbox()?._setActiveOption(selectedOption.cdkOption);
5189
+ }
5190
+ }
5191
+ scrollActiveOptionIntoView() {
5192
+ const activeOption = this.gaOptions().find((option) => option.cdkOption.isActive());
5193
+ if (activeOption) {
5194
+ activeOption.cdkOption.element.scrollIntoView({
5195
+ block: 'center',
5196
+ inline: 'nearest',
5197
+ });
5198
+ }
5199
+ }
5200
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5201
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: GaDataSelectComponent, isStandalone: true, selector: "ga-data-select", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, 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 }, compareFn: { classPropertyName: "compareFn", publicName: "compareFn", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, customFilter: { classPropertyName: "customFilter", publicName: "customFilter", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, clearableLabel: { classPropertyName: "clearableLabel", publicName: "clearableLabel", isSignal: true, isRequired: false, transformFunction: null }, noOptionsLabel: { classPropertyName: "noOptionsLabel", publicName: "noOptionsLabel", isSignal: true, isRequired: false, transformFunction: null }, canSelectNullable: { classPropertyName: "canSelectNullable", publicName: "canSelectNullable", 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 }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, bindValue: { classPropertyName: "bindValue", publicName: "bindValue", isSignal: true, isRequired: false, transformFunction: null }, bindLabel: { classPropertyName: "bindLabel", publicName: "bindLabel", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, withOptionInput: { classPropertyName: "withOptionInput", publicName: "withOptionInput", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", searchValueChange: "searchValueChange", opened: "opened", closed: "closed", optionsEndReached: "optionsEndReached" }, 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()", "keydown.backspace": "clearValue(); $event.preventDefault()" }, properties: { "attr.id": "id()", "class.ga-select--multi": "multiple()", "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": "isOpen() ? cdkListbox()?.id : null", "attr.aria-invalid": "invalid()", "attr.aria-disabled": "disabled()", "attr.aria-owns": "isOpen() && searchable() ? cdkListbox()?.id : null", "attr.aria-activedescendant": "isOpen() && !searchable() ? activeDescendantId() : null", "attr.tabindex": "disabled() ? -1 : 0" }, classAttribute: "ga-select" }, providers: [
5202
+ {
5203
+ provide: NG_VALUE_ACCESSOR,
5204
+ useExisting: forwardRef(() => GaDataSelectComponent),
5205
+ multi: true,
5206
+ },
5207
+ ], queries: [{ propertyName: "customValueTemplate", first: true, predicate: GaDataSelectValueDirective, descendants: true, isSignal: true }, { propertyName: "customOptionLabelTemplate", first: true, predicate: GaDataSelectOptionLabelDirective, descendants: true, isSignal: true }, { propertyName: "customOptgroupLabelTemplate", first: true, predicate: GaDataSelectOptgroupLabelDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "dropdownElRef", first: true, predicate: ["selectDropdown"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "gaOptions", predicate: GaDataOptionComponent, descendants: true, isSignal: true }, { propertyName: "cdkListbox", first: true, predicate: CdkListbox, descendants: true, isSignal: true }, { propertyName: "gaDropdown", first: true, predicate: GaDataSelectDropdownComponent, descendants: true, isSignal: true }, { propertyName: "inputSearch", first: true, predicate: ["inputSearch"], descendants: true, isSignal: true }, { propertyName: "connectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.CdkOverlayOrigin }, { directive: GaLabelledByFormFieldDirective, inputs: ["aria-labelledby", "aria-labelledby"] }], ngImport: i0, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()!\" />\n}\n\n<div class=\"ga-select__main-area\">\n @if (hasValue() && (!searchValue() || multiple())) {\n <ga-data-select-value\n [customValueTemplate]=\"customValueTemplate()?.templateRef\"\n />\n } @else if (!searchable()) {\n <div class=\"ga-select__placeholder\">\n {{ placeholder() }}\n </div>\n }\n\n @if (searchable()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"searchValue() ?? ''\"\n (input)=\"open(); searchValue.set(inputSearch.value)\"\n (click)=\"open(); $event.stopPropagation()\"\n [attr.aria-controls]=\"isOpen() ? cdkListbox()?.id : null\"\n [attr.aria-activedescendant]=\"isOpen() ? activeDescendantId() : null\"\n [attr.aria-label]=\"i18n.searchInputLabel\"\n [placeholder]=\"hasValue() ? '' : placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n [disabled]=\"disabled()\"\n />\n }\n</div>\n\n<div class=\"ga-select__suffix\">\n @if (clearable() && hasValue()) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n (click)=\"clearValue(); $event.stopPropagation()\"\n [attr.aria-label]=\"clearableLabel() ?? i18n.clearLabel\"\n style=\"font-size: 0\"\n >\n <ga-icon [icon]=\"icons.CircleX\" size=\"16\" />\n </button>\n }\n\n <ga-icon [icon]=\"menuStatusIcon()\" class=\"ga-select__action-icon\" />\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayScrollStrategy]=\"repositionScrollStrategy\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n>\n <ga-data-select-dropdown\n [multiple]=\"multiple()\"\n [useActiveDescendant]=\"searchable()\"\n [navigationWrapDisabled]=\"loading()\"\n [compareWith]=\"listboxCompareWith()\"\n [loading]=\"loading()\"\n #selectDropdown\n >\n @if (hasNoOptions() && !loading()) {\n <div class=\"ga-dropdown__caption\">\n {{ noOptionsLabel() ?? i18n.noOptionsLabel }}\n </div>\n }\n\n @for (group of groupedItems(); track group.label) {\n @if (group.label) {\n <ga-data-optgroup\n [label]=\"group.label\"\n [customLabelTemplate]=\"customOptgroupLabelTemplate()?.templateRef\"\n [customLabelContext]=\"getOptgroupLabelTemplateContext(group)\"\n >\n @for (item of group.items; track getItemValue(item)) {\n <ga-data-option\n [value]=\"getItemValue(item)\"\n [withInput]=\"withOptionInput()\"\n [disabled]=\"getItemDisabled(item)\"\n [typeaheadLabel]=\"getItemTypeaheadLabel(item)\"\n >\n @if (customOptionLabelTemplate(); as labelTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate.templateRef\"\n [ngTemplateOutletContext]=\"\n getOptionLabelTemplateContext(item)\n \"\n />\n } @else {\n {{ getItemLabel(item) }}\n }\n </ga-data-option>\n }\n </ga-data-optgroup>\n } @else {\n @for (item of group.items; track getItemValue(item)) {\n <ga-data-option\n [value]=\"getItemValue(item)\"\n [withInput]=\"withOptionInput() ?? multiple()\"\n [disabled]=\"getItemDisabled(item)\"\n [typeaheadLabel]=\"getItemTypeaheadLabel(item)\"\n >\n @if (customOptionLabelTemplate(); as labelTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate.templateRef\"\n [ngTemplateOutletContext]=\"getOptionLabelTemplateContext(item)\"\n />\n } @else {\n {{ getItemLabel(item) }}\n }\n </ga-data-option>\n }\n }\n }\n\n <!--\n Virtual items: Render hidden disabled options for all selected values.\n This ensures cdkListbox maintains state when filtering occurs - even when\n selected values don't match the currently visible filtered options, they\n remain valid options in the listbox, preventing state loss.\n -->\n @for (item of virtualItems(); track getItemValue(item)) {\n <ga-data-option\n [value]=\"getItemValue(item)\"\n [withInput]=\"withOptionInput() ?? multiple()\"\n disabled\n hidden\n >\n @if (customOptionLabelTemplate(); as labelTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate.templateRef\"\n [ngTemplateOutletContext]=\"getOptionLabelTemplateContext(item)\"\n />\n } @else {\n {{ getItemLabel(item) }}\n }\n </ga-data-option>\n }\n\n <ga-intersection-trigger\n parentAsRoot\n rootMargin=\"0% 0% 20px 0%\"\n (trigger)=\"endReached()\"\n />\n </ga-data-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$1.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: GaDataSelectValueComponent, selector: "ga-data-select-value", inputs: ["customValueTemplate"] }, { kind: "component", type: GaDataSelectDropdownComponent, selector: "ga-data-select-dropdown", inputs: ["loading"] }, { kind: "component", type: GaDataOptionComponent, selector: "ga-data-option", inputs: ["value", "disabled", "withInput"] }, { kind: "component", type: GaDataOptgroupComponent, selector: "ga-data-optgroup", inputs: ["label", "customLabelTemplate", "customLabelContext"] }, { kind: "component", type: GaIntersectionTriggerComponent, selector: "ga-intersection-trigger", inputs: ["rootElement", "rootMargin", "parentAsRoot"], outputs: ["trigger"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
5208
+ }
5209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectComponent, decorators: [{
5210
+ type: Component,
5211
+ args: [{ selector: 'ga-data-select', imports: [
5212
+ GaIconModule,
5213
+ GaButtonModule,
5214
+ OverlayModule,
5215
+ GaDataSelectValueComponent,
5216
+ GaDataSelectDropdownComponent,
5217
+ GaDataOptionComponent,
5218
+ GaDataOptgroupComponent,
5219
+ GaIntersectionTriggerComponent,
5220
+ NgTemplateOutlet,
5221
+ ], hostDirectives: [
5222
+ CdkOverlayOrigin,
5223
+ {
5224
+ directive: GaLabelledByFormFieldDirective,
5225
+ inputs: ['aria-labelledby'],
5226
+ },
5227
+ ], providers: [
5228
+ {
5229
+ provide: NG_VALUE_ACCESSOR,
5230
+ useExisting: forwardRef(() => GaDataSelectComponent),
5231
+ multi: true,
5232
+ },
5233
+ ], host: {
5234
+ role: 'combobox',
5235
+ '[attr.id]': 'id()',
5236
+ class: 'ga-select',
5237
+ '[class.ga-select--multi]': 'multiple()',
5238
+ '[class.ga-select--expanded]': 'isOpen()',
5239
+ '[class.ga-select--disabled]': 'disabled()',
5240
+ '[class.ga-select--invalid]': 'invalid()',
5241
+ '[class.ga-select--empty]': '!hasValue()',
5242
+ 'aria-haspopup': 'listbox',
5243
+ '[attr.aria-expanded]': 'isOpen()',
5244
+ '[attr.aria-controls]': 'isOpen() ? cdkListbox()?.id : null',
5245
+ '[attr.aria-invalid]': 'invalid()',
5246
+ '[attr.aria-disabled]': 'disabled()',
5247
+ '[attr.aria-owns]': 'isOpen() && searchable() ? cdkListbox()?.id : null',
5248
+ '[attr.aria-activedescendant]': 'isOpen() && !searchable() ? activeDescendantId() : null',
5249
+ '[attr.tabindex]': 'disabled() ? -1 : 0',
5250
+ '(click)': 'toggle()',
5251
+ '(keydown.arrowdown)': 'open(); $event.preventDefault()',
5252
+ '(keydown.space)': 'open(); $event.preventDefault()',
5253
+ '(keydown.enter)': 'open(); $event.preventDefault()',
5254
+ '(keydown.backspace)': 'clearValue(); $event.preventDefault()',
5255
+ }, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()!\" />\n}\n\n<div class=\"ga-select__main-area\">\n @if (hasValue() && (!searchValue() || multiple())) {\n <ga-data-select-value\n [customValueTemplate]=\"customValueTemplate()?.templateRef\"\n />\n } @else if (!searchable()) {\n <div class=\"ga-select__placeholder\">\n {{ placeholder() }}\n </div>\n }\n\n @if (searchable()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"searchValue() ?? ''\"\n (input)=\"open(); searchValue.set(inputSearch.value)\"\n (click)=\"open(); $event.stopPropagation()\"\n [attr.aria-controls]=\"isOpen() ? cdkListbox()?.id : null\"\n [attr.aria-activedescendant]=\"isOpen() ? activeDescendantId() : null\"\n [attr.aria-label]=\"i18n.searchInputLabel\"\n [placeholder]=\"hasValue() ? '' : placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n [disabled]=\"disabled()\"\n />\n }\n</div>\n\n<div class=\"ga-select__suffix\">\n @if (clearable() && hasValue()) {\n <button\n type=\"button\"\n tabindex=\"-1\"\n (click)=\"clearValue(); $event.stopPropagation()\"\n [attr.aria-label]=\"clearableLabel() ?? i18n.clearLabel\"\n style=\"font-size: 0\"\n >\n <ga-icon [icon]=\"icons.CircleX\" size=\"16\" />\n </button>\n }\n\n <ga-icon [icon]=\"menuStatusIcon()\" class=\"ga-select__action-icon\" />\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayScrollStrategy]=\"repositionScrollStrategy\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n>\n <ga-data-select-dropdown\n [multiple]=\"multiple()\"\n [useActiveDescendant]=\"searchable()\"\n [navigationWrapDisabled]=\"loading()\"\n [compareWith]=\"listboxCompareWith()\"\n [loading]=\"loading()\"\n #selectDropdown\n >\n @if (hasNoOptions() && !loading()) {\n <div class=\"ga-dropdown__caption\">\n {{ noOptionsLabel() ?? i18n.noOptionsLabel }}\n </div>\n }\n\n @for (group of groupedItems(); track group.label) {\n @if (group.label) {\n <ga-data-optgroup\n [label]=\"group.label\"\n [customLabelTemplate]=\"customOptgroupLabelTemplate()?.templateRef\"\n [customLabelContext]=\"getOptgroupLabelTemplateContext(group)\"\n >\n @for (item of group.items; track getItemValue(item)) {\n <ga-data-option\n [value]=\"getItemValue(item)\"\n [withInput]=\"withOptionInput()\"\n [disabled]=\"getItemDisabled(item)\"\n [typeaheadLabel]=\"getItemTypeaheadLabel(item)\"\n >\n @if (customOptionLabelTemplate(); as labelTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate.templateRef\"\n [ngTemplateOutletContext]=\"\n getOptionLabelTemplateContext(item)\n \"\n />\n } @else {\n {{ getItemLabel(item) }}\n }\n </ga-data-option>\n }\n </ga-data-optgroup>\n } @else {\n @for (item of group.items; track getItemValue(item)) {\n <ga-data-option\n [value]=\"getItemValue(item)\"\n [withInput]=\"withOptionInput() ?? multiple()\"\n [disabled]=\"getItemDisabled(item)\"\n [typeaheadLabel]=\"getItemTypeaheadLabel(item)\"\n >\n @if (customOptionLabelTemplate(); as labelTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate.templateRef\"\n [ngTemplateOutletContext]=\"getOptionLabelTemplateContext(item)\"\n />\n } @else {\n {{ getItemLabel(item) }}\n }\n </ga-data-option>\n }\n }\n }\n\n <!--\n Virtual items: Render hidden disabled options for all selected values.\n This ensures cdkListbox maintains state when filtering occurs - even when\n selected values don't match the currently visible filtered options, they\n remain valid options in the listbox, preventing state loss.\n -->\n @for (item of virtualItems(); track getItemValue(item)) {\n <ga-data-option\n [value]=\"getItemValue(item)\"\n [withInput]=\"withOptionInput() ?? multiple()\"\n disabled\n hidden\n >\n @if (customOptionLabelTemplate(); as labelTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate.templateRef\"\n [ngTemplateOutletContext]=\"getOptionLabelTemplateContext(item)\"\n />\n } @else {\n {{ getItemLabel(item) }}\n }\n </ga-data-option>\n }\n\n <ga-intersection-trigger\n parentAsRoot\n rootMargin=\"0% 0% 20px 0%\"\n (trigger)=\"endReached()\"\n />\n </ga-data-select-dropdown>\n</ng-template>\n" }]
5256
+ }], ctorParameters: () => [] });
5257
+
5258
+ /**
5259
+ * @internal - Internal validator provider for ga-data-select required validation
5260
+ */
5261
+ const GA_DATA_SELECT_REQUIRED_VALIDATOR = {
5262
+ provide: NG_VALIDATORS,
5263
+ useExisting: forwardRef(() => GaDataSelectRequiredValidator),
5264
+ multi: true,
5265
+ };
5266
+ /**
5267
+ * @internal - Internal directive for ga-data-select required validation
5268
+ */
5269
+ class GaDataSelectRequiredValidator extends RequiredValidator {
5270
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectRequiredValidator, deps: null, target: i0.ɵɵFactoryTarget.Directive });
5271
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.4", type: GaDataSelectRequiredValidator, isStandalone: true, selector: "ga-data-select[required][formControlName], ga-data-select[required][formControl], ga-data-select[required][ngModel]", providers: [GA_DATA_SELECT_REQUIRED_VALIDATOR], usesInheritance: true, ngImport: i0 });
5272
+ }
5273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectRequiredValidator, decorators: [{
5274
+ type: Directive,
5275
+ args: [{
5276
+ // eslint-disable-next-line @angular-eslint/directive-selector
5277
+ selector: `ga-data-select[required][formControlName], ga-data-select[required][formControl], ga-data-select[required][ngModel]`,
5278
+ providers: [GA_DATA_SELECT_REQUIRED_VALIDATOR],
5279
+ }]
5280
+ }] });
5281
+
5282
+ class GaDataSelectModule {
5283
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5284
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectModule, imports: [GaDataSelectComponent,
5285
+ GaDataSelectRequiredValidator,
5286
+ GaDataSelectValueDirective,
5287
+ GaDataSelectOptionLabelDirective,
5288
+ GaDataSelectOptgroupLabelDirective], exports: [GaDataSelectComponent,
5289
+ GaDataSelectRequiredValidator,
5290
+ GaDataSelectValueDirective,
5291
+ GaDataSelectOptionLabelDirective,
5292
+ GaDataSelectOptgroupLabelDirective] });
5293
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectModule, imports: [GaDataSelectComponent] });
5294
+ }
5295
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaDataSelectModule, decorators: [{
5296
+ type: NgModule,
5297
+ args: [{
5298
+ imports: [
5299
+ GaDataSelectComponent,
5300
+ GaDataSelectRequiredValidator,
5301
+ GaDataSelectValueDirective,
5302
+ GaDataSelectOptionLabelDirective,
5303
+ GaDataSelectOptgroupLabelDirective,
5304
+ ],
5305
+ exports: [
5306
+ GaDataSelectComponent,
5307
+ GaDataSelectRequiredValidator,
5308
+ GaDataSelectValueDirective,
5309
+ GaDataSelectOptionLabelDirective,
5310
+ GaDataSelectOptgroupLabelDirective,
5311
+ ],
5312
+ }]
5313
+ }] });
5314
+
4375
5315
  const SWITCH_CONTROL_VALUE_ACCESSOR = {
4376
5316
  provide: NG_VALUE_ACCESSOR,
4377
5317
  useExisting: forwardRef(() => GaSwitchComponent),
@@ -4735,5 +5675,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
4735
5675
  * Generated bundle index. Do not edit.
4736
5676
  */
4737
5677
 
4738
- export { CHECKBOX_CONTROL_VALUE_ACCESSOR, DEFAULT_MODAL_OPTIONS, GA_ALERT_I18N_FACTORY, GA_BASE_FONT_SIZE, GA_BUTTON_I18N_FACTORY, GA_CHECKBOX_REQUIRED_VALIDATOR, GA_DATEPICKER_I18N_FACTORY, GA_DATEPICKER_PARSER_FORMATTER_FACTORY, GA_DATEPICKER_VALUE_ADAPTER_FACTORY, GA_DATE_PARSER_FORMATTER_CONFIG, GA_DEFAULT_DATEPICKER_FORMATS, GA_FORM_CONTROL_ADAPTER, GA_FORM_ERRORS, GA_ICON_DEFAULT_SIZE, GA_MODAL_DATA, GA_MODAL_I18N_FACTORY, GA_SELECT_I18N_FACTORY, GA_SELECT_REQUIRED_VALIDATOR, GA_TOOLTIP_DEFAULT_OFFSET, GaAlertComponent, GaAlertI18n, GaAlertI18nDefault, GaAlertModule, GaAlertTitleActionsComponent, GaAlertTitleComponent, GaBadgeComponent, GaBadgeModule, GaButtonDirective, GaButtonI18n, GaButtonI18nDefault, GaButtonModule, GaCardComponent, GaCardModule, GaCheckboxComponent, GaCheckboxModule, GaCheckboxRequiredValidator, GaChipComponent, GaChipListboxComponent, GaChipModule, GaDatepickerComponent, GaDatepickerI18n, GaDatepickerI18nDefault, GaDatepickerInputDirective, GaDatepickerModule, GaDatepickerNativeUtcIsoValueAdapter, GaDatepickerNativeUtcValueAdapter, GaDatepickerParserFormatter, GaDatepickerParserFormatterDefault, GaDatepickerStructValueAdapter, GaDatepickerToggleComponent, GaDatepickerValueAdapter, GaFieldErrorDirective, GaFieldInfoComponent, GaFieldLabelComponent, GaFormControlDirective, GaFormControlErrorsDirective, GaFormFieldComponent, GaFormFieldConnector, GaFormFieldModule, GaIconButtonDirective, GaIconComponent, GaIconModule, GaInputComponent, GaInputDirective, GaInputModule, GaLabelledByFormFieldDirective, GaLinkDirective, GaLinkModule, GaMenuComponent, GaMenuItemComponent, GaMenuModule, GaMenuSeparatorComponent, GaMenuTitleComponent, GaMenuTriggerDirective, GaMenuTriggerIconComponent, GaModalActionsComponent, GaModalCloseDirective, GaModalComponent, GaModalContentComponent, GaModalDescriptionComponent, GaModalDescriptionDirective, GaModalHeaderComponent, GaModalI18n, GaModalI18nDefault, GaModalLabelDirective, GaModalModule, GaModalOptions, GaModalRef, GaModalService, GaModalTitleDirective, GaOptgroupComponent, GaOptionComponent, GaRadioButtonComponent, GaRadioGroupComponent, GaRadioModule, GaSegmentedControlButtonDirective, GaSegmentedControlComponent, GaSegmentedControlIconButtonComponent, GaSegmentedControlModule, GaSegmentedControlTextButtonComponent, GaSelectComponent, GaSelectDropdownComponent, GaSelectDropdownSpinnerComponent, GaSelectI18n, GaSelectI18nDefault, GaSelectModule, GaSelectRequiredValidator, GaSelectValueComponent, GaSpinnerComponent, GaSpinnerModule, GaSwitchComponent, GaSwitchModule, GaTextAreaDirective, GaTextAreaModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, SWITCH_CONTROL_VALUE_ACCESSOR, compareStructs, extendGaDateParserFormatter, injectNgControlState, provideGaAlertI18n, provideGaBaseFontSize, provideGaButtonI18n, provideGaDatepickerI18n, provideGaDatepickerParserFormatter, provideGaDatepickerValueAdapter, provideGaFormErrors, provideGaModalI18n, provideGaModalOptions, provideGaSelectI18n };
5678
+ export { CHECKBOX_CONTROL_VALUE_ACCESSOR, DEFAULT_MODAL_OPTIONS, GA_ALERT_I18N_FACTORY, GA_BASE_FONT_SIZE, GA_BUTTON_I18N_FACTORY, GA_CHECKBOX_REQUIRED_VALIDATOR, GA_DATA_SELECT_I18N_FACTORY, GA_DATA_SELECT_REQUIRED_VALIDATOR, GA_DATEPICKER_I18N_FACTORY, GA_DATEPICKER_PARSER_FORMATTER_FACTORY, GA_DATEPICKER_VALUE_ADAPTER_FACTORY, GA_DATE_PARSER_FORMATTER_CONFIG, GA_DEFAULT_DATEPICKER_FORMATS, GA_FORM_CONTROL_ADAPTER, GA_FORM_ERRORS, GA_ICON_DEFAULT_SIZE, GA_MODAL_DATA, GA_MODAL_I18N_FACTORY, GA_SELECT_I18N_FACTORY, GA_SELECT_REQUIRED_VALIDATOR, GA_TOOLTIP_DEFAULT_OFFSET, GaAlertComponent, GaAlertI18n, GaAlertI18nDefault, GaAlertModule, GaAlertTitleActionsComponent, GaAlertTitleComponent, GaBadgeComponent, GaBadgeModule, GaButtonDirective, GaButtonI18n, GaButtonI18nDefault, GaButtonModule, GaCardComponent, GaCardModule, GaCheckboxComponent, GaCheckboxModule, GaCheckboxRequiredValidator, GaChipComponent, GaChipListboxComponent, GaChipModule, GaDataSelectComponent, GaDataSelectI18n, GaDataSelectI18nDefault, GaDataSelectModule, GaDataSelectOptgroupLabelDirective, GaDataSelectOptionLabelDirective, GaDataSelectRequiredValidator, GaDataSelectValueDirective, GaDatepickerComponent, GaDatepickerI18n, GaDatepickerI18nDefault, GaDatepickerInputDirective, GaDatepickerModule, GaDatepickerNativeUtcIsoValueAdapter, GaDatepickerNativeUtcValueAdapter, GaDatepickerParserFormatter, GaDatepickerParserFormatterDefault, GaDatepickerStructValueAdapter, GaDatepickerToggleComponent, GaDatepickerValueAdapter, GaFieldErrorDirective, GaFieldInfoComponent, GaFieldLabelComponent, GaFormControlDirective, GaFormControlErrorsDirective, GaFormFieldComponent, GaFormFieldConnector, GaFormFieldModule, GaIconButtonDirective, GaIconComponent, GaIconModule, GaInputComponent, GaInputDirective, GaInputModule, GaLabelledByFormFieldDirective, GaLinkDirective, GaLinkModule, GaMenuComponent, GaMenuItemComponent, GaMenuModule, GaMenuSeparatorComponent, GaMenuTitleComponent, GaMenuTriggerDirective, GaMenuTriggerIconComponent, GaModalActionsComponent, GaModalCloseDirective, GaModalComponent, GaModalContentComponent, GaModalDescriptionComponent, GaModalDescriptionDirective, GaModalHeaderComponent, GaModalI18n, GaModalI18nDefault, GaModalLabelDirective, GaModalModule, GaModalOptions, GaModalRef, GaModalService, GaModalTitleDirective, GaOptgroupComponent, GaOptionComponent, GaRadioButtonComponent, GaRadioGroupComponent, GaRadioModule, GaSegmentedControlButtonDirective, GaSegmentedControlComponent, GaSegmentedControlIconButtonComponent, GaSegmentedControlModule, GaSegmentedControlTextButtonComponent, GaSelectComponent, GaSelectDropdownComponent, GaSelectDropdownSpinnerComponent, GaSelectI18n, GaSelectI18nDefault, GaSelectModule, GaSelectRequiredValidator, GaSelectValueComponent, GaSpinnerComponent, GaSpinnerModule, GaSwitchComponent, GaSwitchModule, GaTextAreaDirective, GaTextAreaModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, SWITCH_CONTROL_VALUE_ACCESSOR, compareStructs, extendGaDateParserFormatter, injectNgControlState, provideGaAlertI18n, provideGaBaseFontSize, provideGaButtonI18n, provideGaDataSelectI18n, provideGaDatepickerI18n, provideGaDatepickerParserFormatter, provideGaDatepickerValueAdapter, provideGaFormErrors, provideGaModalI18n, provideGaModalOptions, provideGaSelectI18n };
4739
5679
  //# sourceMappingURL=vsn-ux-ngx-gaia.mjs.map