@vsn-ux/ngx-gaia 0.12.2 → 0.12.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.
@@ -1720,7 +1720,7 @@ class GaDatepickerInputDirective {
1720
1720
  this.valueInput(); // explicit call to track value input changes
1721
1721
  this.lastValueValid.set(true);
1722
1722
  untracked(() => {
1723
- this.lastDateChangeEmittedValue.set(this.dateStruct());
1723
+ this.lastDateChangeEmittedValue.set(this.value());
1724
1724
  this.formatValue();
1725
1725
  });
1726
1726
  });
@@ -1752,12 +1752,15 @@ class GaDatepickerInputDirective {
1752
1752
  }
1753
1753
  onBlur() {
1754
1754
  this.focused = false;
1755
- if (this.dateStruct()) {
1755
+ if (this.lastValueValid() && this.dateStruct()) {
1756
1756
  this.formatValue();
1757
1757
  }
1758
- if (compareStructs(this.dateStruct(), this.lastDateChangeEmittedValue()) !== 0) {
1758
+ const changed = this.preserveRawValue() && !this.lastValueValid()
1759
+ ? this.value() !== this.lastDateChangeEmittedValue()
1760
+ : compareStructs(this.dateStruct(), this.valueAdapter.toStruct(this.lastDateChangeEmittedValue())) !== 0;
1761
+ if (changed) {
1759
1762
  this.dateChange.emit(this.value());
1760
- this.lastDateChangeEmittedValue.set(this.dateStruct());
1763
+ this.lastDateChangeEmittedValue.set(this.value());
1761
1764
  }
1762
1765
  this.onNgTouchedFn?.();
1763
1766
  }
@@ -1776,7 +1779,7 @@ class GaDatepickerInputDirective {
1776
1779
  updateValue(value, { updateView, emitToNgModel, } = {}) {
1777
1780
  this.value.set(value);
1778
1781
  this.lastValueValid.set(true);
1779
- this.lastDateChangeEmittedValue.set(this.dateStruct());
1782
+ this.lastDateChangeEmittedValue.set(value);
1780
1783
  if (updateView) {
1781
1784
  this.formatValue();
1782
1785
  }
@@ -1928,8 +1931,9 @@ class GaDatepickerNativeUtcIsoValueAdapter extends GaDatepickerValueAdapter {
1928
1931
  * Converts ISO Date to internal struct representation
1929
1932
  * Uses UTC to avoid timezone issues and normalizes to midnight
1930
1933
  */
1934
+ isoDatePattern = /^\d{4}-\d{2}-\d{2}/;
1931
1935
  toStruct(value) {
1932
- if (!value)
1936
+ if (!value || !this.isoDatePattern.test(value))
1933
1937
  return null;
1934
1938
  const date = new Date(value);
1935
1939
  if (isNaN(date.getTime())) {
@@ -2368,6 +2372,7 @@ class GaTooltipDirective {
2368
2372
  _placement = 'right-center';
2369
2373
  _offset = GA_TOOLTIP_DEFAULT_OFFSET;
2370
2374
  mouseOver = false;
2375
+ focused = false;
2371
2376
  ariaDescribedBy = signal(null, ...(ngDevMode ? [{ debugName: "ariaDescribedBy" }] : []));
2372
2377
  _showControlMode = null;
2373
2378
  _hideControlMode = null;
@@ -2505,31 +2510,47 @@ class GaTooltipDirective {
2505
2510
  this.toggle();
2506
2511
  }
2507
2512
  handleMouseEnter() {
2513
+ this.scheduleShow(() => (this.mouseOver = true));
2514
+ }
2515
+ handleMouseLeave() {
2516
+ this.scheduleHide(() => (this.mouseOver = false));
2517
+ }
2518
+ handleFocusIn() {
2519
+ this.scheduleShow(() => (this.focused = true));
2520
+ }
2521
+ handleFocusOut() {
2522
+ this.scheduleHide(() => (this.focused = false));
2523
+ }
2524
+ scheduleShow(setFlag) {
2508
2525
  if (this.showControlMode !== 'hover' || this.disabled || !this._content) {
2509
2526
  return;
2510
2527
  }
2511
- this.mouseOver = true;
2528
+ setFlag();
2512
2529
  this.clearShowTimeout();
2513
- if (this.showDelay() > 0) {
2514
- this.showTimeoutId = setTimeout(() => this.show(), this.showDelay());
2530
+ const delay = this.showDelay();
2531
+ if (delay > 0) {
2532
+ this.showTimeoutId = setTimeout(() => this.show(), delay);
2515
2533
  }
2516
2534
  else {
2517
2535
  this.show();
2518
2536
  }
2519
2537
  }
2520
- handleMouseLeave() {
2538
+ scheduleHide(clearFlag) {
2521
2539
  this.clearShowTimeout();
2522
2540
  if (this.hideControlMode !== 'hover' || this.disabled) {
2523
2541
  return;
2524
2542
  }
2525
- this.mouseOver = false;
2543
+ clearFlag();
2526
2544
  setTimeout(() => this.softHide());
2527
2545
  }
2528
2546
  /**
2529
- * hides only if mouse is not over the host element nor the tooltip itself
2547
+ * Hides only if mouse is not over the host element, element is not focused,
2548
+ * and mouse is not over the tooltip itself.
2530
2549
  */
2531
2550
  softHide() {
2532
- if (!this.mouseOver && !this.tooltipInstance?.mouseOver()) {
2551
+ if (!this.mouseOver &&
2552
+ !this.focused &&
2553
+ !this.tooltipInstance?.mouseOver()) {
2533
2554
  this.hide();
2534
2555
  }
2535
2556
  }
@@ -2648,7 +2669,7 @@ class GaTooltipDirective {
2648
2669
  }
2649
2670
  }
2650
2671
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: GaTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2651
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: GaTooltipDirective, isStandalone: true, selector: "[gaTooltip]", inputs: { content: { classPropertyName: "content", publicName: "gaTooltip", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "gaTooltipDisabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, controlMode: { classPropertyName: "controlMode", publicName: "gaTooltipControlMode", isSignal: false, isRequired: false, transformFunction: null }, showControlMode: { classPropertyName: "showControlMode", publicName: "gaTooltipShowControlMode", isSignal: false, isRequired: false, transformFunction: null }, hideControlMode: { classPropertyName: "hideControlMode", publicName: "gaTooltipHideControlMode", isSignal: false, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "gaTooltipOffsetSize", isSignal: false, isRequired: false, transformFunction: numberAttribute }, showDelay: { classPropertyName: "showDelay", publicName: "gaTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "gaTooltipPlacement", isSignal: false, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "handleMouseClick()", "mouseenter": "handleMouseEnter()", "mouseleave": "handleMouseLeave()" }, properties: { "attr.aria-describedby": "ariaDescribedBy()" } }, exportAs: ["gaTooltip"], ngImport: i0 });
2672
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: GaTooltipDirective, isStandalone: true, selector: "[gaTooltip]", inputs: { content: { classPropertyName: "content", publicName: "gaTooltip", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "gaTooltipDisabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, controlMode: { classPropertyName: "controlMode", publicName: "gaTooltipControlMode", isSignal: false, isRequired: false, transformFunction: null }, showControlMode: { classPropertyName: "showControlMode", publicName: "gaTooltipShowControlMode", isSignal: false, isRequired: false, transformFunction: null }, hideControlMode: { classPropertyName: "hideControlMode", publicName: "gaTooltipHideControlMode", isSignal: false, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "gaTooltipOffsetSize", isSignal: false, isRequired: false, transformFunction: numberAttribute }, showDelay: { classPropertyName: "showDelay", publicName: "gaTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "gaTooltipPlacement", isSignal: false, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "handleMouseClick()", "mouseenter": "handleMouseEnter()", "mouseleave": "handleMouseLeave()", "focusin": "handleFocusIn()", "focusout": "handleFocusOut()" }, properties: { "attr.aria-describedby": "ariaDescribedBy()" } }, exportAs: ["gaTooltip"], ngImport: i0 });
2652
2673
  }
2653
2674
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: GaTooltipDirective, decorators: [{
2654
2675
  type: Directive,
@@ -2657,6 +2678,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
2657
2678
  exportAs: 'gaTooltip',
2658
2679
  host: {
2659
2680
  '[attr.aria-describedby]': 'ariaDescribedBy()',
2681
+ '(click)': 'handleMouseClick()',
2682
+ '(mouseenter)': 'handleMouseEnter()',
2683
+ '(mouseleave)': 'handleMouseLeave()',
2684
+ '(focusin)': 'handleFocusIn()',
2685
+ '(focusout)': 'handleFocusOut()',
2660
2686
  },
2661
2687
  }]
2662
2688
  }], propDecorators: { content: [{
@@ -2680,15 +2706,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
2680
2706
  }], showDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "gaTooltipShowDelay", required: false }] }], placement: [{
2681
2707
  type: Input,
2682
2708
  args: [{ alias: 'gaTooltipPlacement' }]
2683
- }], handleMouseClick: [{
2684
- type: HostListener,
2685
- args: ['click']
2686
- }], handleMouseEnter: [{
2687
- type: HostListener,
2688
- args: ['mouseenter']
2689
- }], handleMouseLeave: [{
2690
- type: HostListener,
2691
- args: ['mouseleave']
2692
2709
  }] } });
2693
2710
 
2694
2711
  class GaTooltipTitleComponent {
@@ -2756,13 +2773,13 @@ class GaFieldLabelComponent {
2756
2773
  }
2757
2774
  }
2758
2775
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: GaFieldLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2759
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: GaFieldLabelComponent, isStandalone: true, selector: "ga-label", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null }, definition: { classPropertyName: "definition", publicName: "definition", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "null" } }, ngImport: i0, template: "<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n<label\n [attr.id]=\"id()\"\n [attr.for]=\"controlId()\"\n class=\"ga-form-field__label\"\n [class.ga-form-field__label--defined]=\"!!definition()\"\n [class.ga-form-field__label--disabled]=\"formField.disabled()\"\n (click)=\"focusControl()\"\n [attr.tabindex]=\"definition() ? 0 : -1\"\n>\n <span\n class=\"ga-form-field__label-text\"\n [gaTooltip]=\"definition()\"\n gaTooltipPlacement=\"top-start\"\n gaTooltipShowDelay=\"200\"\n ><ng-content\n /></span>\n @if (state()) {\n <span class=\"ga-form-field__label-state\">{{ state() }}</span>\n }\n</label>\n", dependencies: [{ kind: "ngmodule", type: GaTooltipModule }, { kind: "directive", type: GaTooltipDirective, selector: "[gaTooltip]", inputs: ["gaTooltip", "gaTooltipDisabled", "gaTooltipControlMode", "gaTooltipShowControlMode", "gaTooltipHideControlMode", "gaTooltipOffsetSize", "gaTooltipShowDelay", "gaTooltipPlacement"], exportAs: ["gaTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2776
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: GaFieldLabelComponent, isStandalone: true, selector: "ga-label", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: false, transformFunction: null }, definition: { classPropertyName: "definition", publicName: "definition", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "null" } }, ngImport: i0, template: "<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n<label\n [attr.id]=\"id()\"\n [attr.for]=\"controlId()\"\n class=\"ga-form-field__label\"\n [class.ga-form-field__label--defined]=\"!!definition()\"\n [class.ga-form-field__label--disabled]=\"formField.disabled()\"\n [gaTooltip]=\"definition()\"\n [attr.tabindex]=\"definition() ? 0 : -1\"\n gaTooltipPlacement=\"top-start\"\n gaTooltipShowDelay=\"200\"\n (click)=\"focusControl()\"\n>\n <span class=\"ga-form-field__label-text\"><ng-content /></span>\n @if (state()) {\n <span class=\"ga-form-field__label-state\">{{ state() }}</span>\n }\n</label>\n", dependencies: [{ kind: "ngmodule", type: GaTooltipModule }, { kind: "directive", type: GaTooltipDirective, selector: "[gaTooltip]", inputs: ["gaTooltip", "gaTooltipDisabled", "gaTooltipControlMode", "gaTooltipShowControlMode", "gaTooltipHideControlMode", "gaTooltipOffsetSize", "gaTooltipShowDelay", "gaTooltipPlacement"], exportAs: ["gaTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2760
2777
  }
2761
2778
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: GaFieldLabelComponent, decorators: [{
2762
2779
  type: Component,
2763
2780
  args: [{ selector: 'ga-label', imports: [GaTooltipModule], changeDetection: ChangeDetectionStrategy.OnPush, host: {
2764
2781
  '[attr.id]': 'null',
2765
- }, template: "<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n<label\n [attr.id]=\"id()\"\n [attr.for]=\"controlId()\"\n class=\"ga-form-field__label\"\n [class.ga-form-field__label--defined]=\"!!definition()\"\n [class.ga-form-field__label--disabled]=\"formField.disabled()\"\n (click)=\"focusControl()\"\n [attr.tabindex]=\"definition() ? 0 : -1\"\n>\n <span\n class=\"ga-form-field__label-text\"\n [gaTooltip]=\"definition()\"\n gaTooltipPlacement=\"top-start\"\n gaTooltipShowDelay=\"200\"\n ><ng-content\n /></span>\n @if (state()) {\n <span class=\"ga-form-field__label-state\">{{ state() }}</span>\n }\n</label>\n" }]
2782
+ }, template: "<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -->\n<label\n [attr.id]=\"id()\"\n [attr.for]=\"controlId()\"\n class=\"ga-form-field__label\"\n [class.ga-form-field__label--defined]=\"!!definition()\"\n [class.ga-form-field__label--disabled]=\"formField.disabled()\"\n [gaTooltip]=\"definition()\"\n [attr.tabindex]=\"definition() ? 0 : -1\"\n gaTooltipPlacement=\"top-start\"\n gaTooltipShowDelay=\"200\"\n (click)=\"focusControl()\"\n>\n <span class=\"ga-form-field__label-text\"><ng-content /></span>\n @if (state()) {\n <span class=\"ga-form-field__label-state\">{{ state() }}</span>\n }\n</label>\n" }]
2766
2783
  }], ctorParameters: () => [], propDecorators: { for: [{ type: i0.Input, args: [{ isSignal: true, alias: "for", required: false }] }], definition: [{ type: i0.Input, args: [{ isSignal: true, alias: "definition", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], idInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
2767
2784
 
2768
2785
  class GaFormControlDirective {