@vsn-ux/ngx-gaia 0.9.2 → 0.9.4

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.
@@ -5,7 +5,7 @@ import { LucideAngularModule, X, CircleCheck, TriangleAlert, OctagonAlert, Info,
5
5
  import { NgForm, ControlContainer, NgControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, CheckboxRequiredValidator, RequiredValidator } from '@angular/forms';
6
6
  import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
7
7
  import * as i1$1 from '@angular/cdk/overlay';
8
- import { CdkOverlayOrigin, createRepositionScrollStrategy, OverlayModule, Overlay, OverlayRef } from '@angular/cdk/overlay';
8
+ import { CdkOverlayOrigin, createRepositionScrollStrategy, OverlayModule, Overlay, OverlayRef, CdkConnectedOverlay } from '@angular/cdk/overlay';
9
9
  import { NgTemplateOutlet } from '@angular/common';
10
10
  import { ComponentPortal } from '@angular/cdk/portal';
11
11
  import { Subject, takeUntil, map, merge, filter, Observable, isObservable } from 'rxjs';
@@ -561,6 +561,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
561
561
  }] });
562
562
 
563
563
  const GA_FORM_CONTROL_ADAPTER = new InjectionToken('ga-form-control-adapter');
564
+ /**
565
+ * @internal - This function is for internal library use only
566
+ */
564
567
  function injectNgControlState({ implicitChildNgControl, explicitNgControl, explicitNgForm, } = {}) {
565
568
  const gaFormControlAdapter = inject(GA_FORM_CONTROL_ADAPTER, {
566
569
  optional: true,
@@ -1244,6 +1247,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
1244
1247
  }, template: "<div class=\"ga-calendar__header\">\n <div class=\"ga-calendar__month-year\">\n <button\n type=\"button\"\n class=\"ga-calendar__month-year-button\"\n (click)=\"toggleMonthView()\"\n [attr.aria-label]=\"i18n.selectMonthLabel\"\n >\n {{ getMonthName(viewDate().month) }}\n <ga-icon\n [icon]=\"viewMode() === 'month' ? icons.ChevronUp : icons.ChevronDown\"\n size=\"16\"\n />\n </button>\n <button\n type=\"button\"\n class=\"ga-calendar__month-year-button\"\n (click)=\"toggleYearView()\"\n [attr.aria-label]=\"i18n.selectYearLabel\"\n >\n {{ viewDate().year }}\n <ga-icon\n [icon]=\"viewMode() === 'year' ? icons.ChevronUp : icons.ChevronDown\"\n size=\"16\"\n />\n </button>\n </div>\n @if (viewMode() !== 'month') {\n <div class=\"ga-calendar__navigation\">\n <button\n type=\"button\"\n class=\"ga-calendar__navigation-button\"\n (click)=\"navigatePrevious()\"\n [attr.aria-label]=\"i18n.previousLabel\"\n >\n <ga-icon [icon]=\"icons.ChevronLeft\" size=\"24\" />\n </button>\n <button\n type=\"button\"\n class=\"ga-calendar__navigation-button\"\n (click)=\"navigateNext()\"\n [attr.aria-label]=\"i18n.nextLabel\"\n >\n <ga-icon [icon]=\"icons.ChevronRight\" size=\"24\" />\n </button>\n </div>\n }\n</div>\n\n@switch (viewMode()) {\n @case ('day') {\n <div class=\"ga-calendar__weekdays\">\n @for (day of weekDays(); track day) {\n <div class=\"ga-calendar__weekday\">{{ day }}</div>\n }\n </div>\n <div class=\"ga-calendar__selection ga-calendar__selection--day\">\n @for (\n dateStruct of calendarDays();\n track dateStruct.year + '-' + dateStruct.month + '-' + dateStruct.day\n ) {\n <button\n type=\"button\"\n class=\"ga-calendar__day\"\n [class.ga-calendar__day--selected]=\"isSelected(dateStruct)\"\n [class.ga-calendar__day--current]=\"isToday(dateStruct)\"\n [class.ga-calendar__day--disabled]=\"isDateDisabled(dateStruct)\"\n [class.ga-calendar__day--weekend]=\"isWeekend(dateStruct)\"\n [disabled]=\"isDateDisabled(dateStruct)\"\n (click)=\"selectDate(dateStruct)\"\n >\n {{ dateStruct.day }}\n </button>\n }\n </div>\n }\n @case ('month') {\n <div class=\"ga-calendar__selection ga-calendar__selection--month\">\n @for (month of months(); track month.index) {\n <button\n type=\"button\"\n class=\"ga-calendar__month\"\n [class.ga-calendar__month--selected]=\"isSelectedMonth(month.index)\"\n [class.ga-calendar__month--disabled]=\"isMonthDisabled(month.index)\"\n [disabled]=\"isMonthDisabled(month.index)\"\n (click)=\"selectMonth(month.index)\"\n >\n {{ month.shortName }}\n </button>\n }\n </div>\n }\n @case ('year') {\n <div class=\"ga-calendar__selection ga-calendar__selection--year\">\n @for (year of years(); track year) {\n <button\n type=\"button\"\n class=\"ga-calendar__year\"\n [class.ga-calendar__year--selected]=\"isSelectedYear(year)\"\n [class.ga-calendar__year--disabled]=\"isYearDisabled(year)\"\n [disabled]=\"isYearDisabled(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n }\n}\n", styles: [":host{display:block}\n"] }]
1245
1248
  }] });
1246
1249
 
1250
+ /**
1251
+ * @internal - Internal service for form field coordination
1252
+ */
1247
1253
  class GaFormFieldConnector {
1248
1254
  controlDisabled = signal(false);
1249
1255
  controlId = signal(null);
@@ -1698,10 +1704,10 @@ class GaDatepickerInputDirective {
1698
1704
  this.onNgChangeFn?.(newValue);
1699
1705
  }
1700
1706
  onBlur() {
1707
+ if (this.dateStruct()) {
1708
+ this.formatValue();
1709
+ }
1701
1710
  if (compareStructs(this.dateStruct(), this.lastEmittedStruct()) !== 0) {
1702
- if (this.dateStruct()) {
1703
- this.formatValue();
1704
- }
1705
1711
  this.dateChange.emit(this.value());
1706
1712
  this.lastEmittedStruct.set(this.dateStruct());
1707
1713
  }
@@ -1721,6 +1727,8 @@ class GaDatepickerInputDirective {
1721
1727
  if (emitToNgModel) {
1722
1728
  this.onNgTouchedFn?.();
1723
1729
  this.onNgChangeFn?.(value);
1730
+ this.dateInput.emit(value);
1731
+ this.dateChange.emit(value);
1724
1732
  }
1725
1733
  }
1726
1734
  // ControlValueAccessor implementation
@@ -2184,6 +2192,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
2184
2192
  }] });
2185
2193
 
2186
2194
  let nextUniqueId$5 = 0;
2195
+ /**
2196
+ * Internal tooltip component used by the gaTooltip directive.
2197
+ * This component is not intended for direct use in templates.
2198
+ * Use the [gaTooltip] directive instead.
2199
+ * @internal
2200
+ */
2187
2201
  class GaTooltipComponent {
2188
2202
  uniqueId = `ga-tooltip-${++nextUniqueId$5}`;
2189
2203
  mouseLeaveSubject = new Subject();
@@ -3807,6 +3821,7 @@ class GaSelectComponent {
3807
3821
  customSelectValue = contentChild(GaSelectValueComponent);
3808
3822
  inputSearch = viewChild('inputSearch');
3809
3823
  content = viewChild('ngContent', { read: ElementRef });
3824
+ connectedOverlay = viewChild(CdkConnectedOverlay);
3810
3825
  id = computed(() => {
3811
3826
  return this.idInput() ?? this._uniqueId;
3812
3827
  });
@@ -3846,6 +3861,10 @@ class GaSelectComponent {
3846
3861
  if (formFieldConnector) {
3847
3862
  effect(() => formFieldConnector.controlDisabled.set(this.disabled()));
3848
3863
  }
3864
+ effect(() => {
3865
+ this.gaOptions(); // explicit call to track the option changes
3866
+ untracked(() => this.connectedOverlay()?.overlayRef?.updatePosition());
3867
+ });
3849
3868
  }
3850
3869
  ngAfterContentInit() {
3851
3870
  effect(() => {
@@ -4037,7 +4056,7 @@ class GaSelectComponent {
4037
4056
  useExisting: forwardRef(() => GaSelectComponent),
4038
4057
  multi: true,
4039
4058
  },
4040
- ], queries: [{ propertyName: "gaOptions", predicate: GaOptionComponent, descendants: true, read: GaOptionComponent, isSignal: true }, { propertyName: "cdkListbox", first: true, predicate: CdkListbox, descendants: true, isSignal: true }, { propertyName: "customSelectValue", first: true, predicate: GaSelectValueComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputSearch", first: true, predicate: ["inputSearch"], descendants: true, isSignal: true }, { propertyName: "content", first: true, predicate: ["ngContent"], descendants: true, read: ElementRef, isSignal: true }], hostDirectives: [{ directive: i1$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-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"cdkListbox().id\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\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" }] });
4059
+ ], queries: [{ propertyName: "gaOptions", predicate: GaOptionComponent, descendants: true, read: GaOptionComponent, isSignal: true }, { propertyName: "cdkListbox", first: true, predicate: CdkListbox, descendants: true, isSignal: true }, { propertyName: "customSelectValue", first: true, predicate: GaSelectValueComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputSearch", first: true, predicate: ["inputSearch"], descendants: true, isSignal: true }, { propertyName: "content", first: true, predicate: ["ngContent"], descendants: true, read: ElementRef, isSignal: true }, { 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-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"cdkListbox().id\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\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" }] });
4041
4060
  }
4042
4061
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaSelectComponent, decorators: [{
4043
4062
  type: Component,
@@ -4150,11 +4169,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
4150
4169
  }, template: "@if (loading()) {\n <ga-select-dropdown-spinner />\n} @else {\n <ng-content />\n}\n" }]
4151
4170
  }] });
4152
4171
 
4172
+ /**
4173
+ * @internal - Internal validator provider for ga-select required validation
4174
+ */
4153
4175
  const GA_SELECT_REQUIRED_VALIDATOR = {
4154
4176
  provide: NG_VALIDATORS,
4155
4177
  useExisting: forwardRef(() => GaSelectRequiredValidator),
4156
4178
  multi: true,
4157
4179
  };
4180
+ /**
4181
+ * @internal - Internal directive for ga-select required validation
4182
+ */
4158
4183
  class GaSelectRequiredValidator extends RequiredValidator {
4159
4184
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaSelectRequiredValidator, deps: null, target: i0.ɵɵFactoryTarget.Directive });
4160
4185
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.0.4", type: GaSelectRequiredValidator, isStandalone: true, selector: "ga-select[required][formControlName], ga-select[required][formControl], ga-select[required][ngModel]", providers: [GA_SELECT_REQUIRED_VALIDATOR], usesInheritance: true, ngImport: i0 });