@vsn-ux/ngx-gaia 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DOCS.md CHANGED
@@ -1497,6 +1497,7 @@ Tooltip directive for contextual information overlays.
1497
1497
  - `gaTooltipControlMode: 'hover' | 'click' | 'none'` - Control mode (default: 'hover')
1498
1498
  - `gaTooltipShowControlMode: 'hover' | 'click' | 'none'` - Show control mode
1499
1499
  - `gaTooltipHideControlMode: 'hover' | 'click' | 'none'` - Hide control mode
1500
+ - `gaTooltipShowDelay: number` - Delay in milliseconds before tooltip appears on hover (default: 0)
1500
1501
  - `gaTooltipOffsetSize: number` - Offset from target (default: 5)
1501
1502
  - `gaTooltipPlacement: GaTooltipPlacement` - Preferred placement (default: 'right-center')
1502
1503
 
@@ -1518,6 +1519,9 @@ Tooltip component for rendering tooltip content.
1518
1519
  >Top tooltip</span
1519
1520
  >
1520
1521
  <button gaTooltip="Click tooltip" gaTooltipControlMode="click">Click me</button>
1522
+ <span gaTooltip="Delayed tooltip" gaTooltipShowDelay="500"
1523
+ >Hover me (500ms delay)</span
1524
+ >
1521
1525
  ```
1522
1526
 
1523
1527
  ## Utils
@@ -2275,6 +2275,7 @@ class GaTooltipDirective {
2275
2275
  mouseOver = false;
2276
2276
  _showControlMode = null;
2277
2277
  _hideControlMode = null;
2278
+ showTimeoutId = null;
2278
2279
  set content(value) {
2279
2280
  if (value === this._content) {
2280
2281
  return;
@@ -2323,6 +2324,8 @@ class GaTooltipDirective {
2323
2324
  get offset() {
2324
2325
  return this._offset;
2325
2326
  }
2327
+ showDelay = input(0, { ...(ngDevMode ? { debugName: "showDelay" } : {}), alias: 'gaTooltipShowDelay',
2328
+ transform: numberAttribute });
2326
2329
  set placement(value) {
2327
2330
  if (this._placement === value) {
2328
2331
  return;
@@ -2337,6 +2340,7 @@ class GaTooltipDirective {
2337
2340
  return this.tooltipInstance?.uniqueId ?? null;
2338
2341
  }
2339
2342
  ngOnDestroy() {
2343
+ this.clearShowTimeout();
2340
2344
  this.destroyed$.next();
2341
2345
  this.destroyed$.complete();
2342
2346
  this.overlayRef?.detach();
@@ -2410,9 +2414,16 @@ class GaTooltipDirective {
2410
2414
  return;
2411
2415
  }
2412
2416
  this.mouseOver = true;
2413
- this.show();
2417
+ this.clearShowTimeout();
2418
+ if (this.showDelay() > 0) {
2419
+ this.showTimeoutId = setTimeout(() => this.show(), this.showDelay());
2420
+ }
2421
+ else {
2422
+ this.show();
2423
+ }
2414
2424
  }
2415
2425
  handleMouseLeave() {
2426
+ this.clearShowTimeout();
2416
2427
  if (this.hideControlMode !== 'hover' || this.disabled) {
2417
2428
  return;
2418
2429
  }
@@ -2427,6 +2438,12 @@ class GaTooltipDirective {
2427
2438
  this.hide();
2428
2439
  }
2429
2440
  }
2441
+ clearShowTimeout() {
2442
+ if (this.showTimeoutId !== null) {
2443
+ clearTimeout(this.showTimeoutId);
2444
+ this.showTimeoutId = null;
2445
+ }
2446
+ }
2430
2447
  createOverlay() {
2431
2448
  if (this.overlayRef) {
2432
2449
  return this.overlayRef;
@@ -2536,7 +2553,7 @@ class GaTooltipDirective {
2536
2553
  }
2537
2554
  }
2538
2555
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2539
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "21.0.4", type: GaTooltipDirective, isStandalone: true, selector: "[gaTooltip]", inputs: { content: ["gaTooltip", "content"], disabled: ["gaTooltipDisabled", "disabled", booleanAttribute], controlMode: ["gaTooltipControlMode", "controlMode"], showControlMode: ["gaTooltipShowControlMode", "showControlMode"], hideControlMode: ["gaTooltipHideControlMode", "hideControlMode"], offset: ["gaTooltipOffsetSize", "offset", numberAttribute], placement: ["gaTooltipPlacement", "placement"] }, host: { listeners: { "click": "handleMouseClick()", "mouseenter": "handleMouseEnter()", "mouseleave": "handleMouseLeave()" }, properties: { "attr.aria-describedby": "this.ariaDescribedBy" } }, exportAs: ["gaTooltip"], ngImport: i0 });
2556
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.4", 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": "this.ariaDescribedBy" } }, exportAs: ["gaTooltip"], ngImport: i0 });
2540
2557
  }
2541
2558
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaTooltipDirective, decorators: [{
2542
2559
  type: Directive,
@@ -2562,7 +2579,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImpor
2562
2579
  }], offset: [{
2563
2580
  type: Input,
2564
2581
  args: [{ alias: 'gaTooltipOffsetSize', transform: numberAttribute }]
2565
- }], placement: [{
2582
+ }], showDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "gaTooltipShowDelay", required: false }] }], placement: [{
2566
2583
  type: Input,
2567
2584
  args: [{ alias: 'gaTooltipPlacement' }]
2568
2585
  }], ariaDescribedBy: [{
@@ -2635,7 +2652,7 @@ class GaFieldLabelComponent {
2635
2652
  }
2636
2653
  }
2637
2654
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaFieldLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2638
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.4", 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 ><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", "gaTooltipPlacement"], exportAs: ["gaTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2655
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.4", 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 ><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 });
2639
2656
  }
2640
2657
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaFieldLabelComponent, decorators: [{
2641
2658
  type: Component,
@@ -3077,63 +3094,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImpor
3077
3094
  }] });
3078
3095
 
3079
3096
  class GaModalComponent {
3080
- closeSubject = new Subject();
3081
- overlayRef = inject(OverlayRef);
3082
- destroyRef = inject(DestroyRef);
3083
- router = inject(Router, { optional: true });
3084
- globalOptions = inject(GaModalOptions, { optional: true });
3097
+ #closeSubject = new Subject();
3098
+ #overlayRef = inject(OverlayRef);
3099
+ #destroyRef = inject(DestroyRef);
3100
+ #router = inject(Router, { optional: true });
3101
+ #globalOptions = inject(GaModalOptions, { optional: true });
3085
3102
  options = this.createOptions();
3086
- trapfocus = inject(CdkTrapFocus);
3103
+ #trapfocus = inject(CdkTrapFocus);
3087
3104
  data = inject(GA_MODAL_DATA);
3088
3105
  labelledBy = signal(null, ...(ngDevMode ? [{ debugName: "labelledBy" }] : []));
3089
3106
  describedBy = signal(null, ...(ngDevMode ? [{ debugName: "describedBy" }] : []));
3090
3107
  constructor() {
3091
- this.trapfocus.enabled = true;
3092
- this.trapfocus.autoCapture = true;
3108
+ this.#trapfocus.enabled = true;
3109
+ this.#trapfocus.autoCapture = true;
3093
3110
  // Using next render to delay the initialization, so that there is more time
3094
3111
  // to set the modal options
3095
3112
  afterNextRender({
3096
3113
  read: () => {
3097
3114
  if (this.options.closeOnNavigation) {
3098
- this.router?.events
3115
+ this.#router?.events
3099
3116
  .pipe(
3100
3117
  /**
3101
3118
  * Listen for `ResolveStart` to be friendly with route-guards.
3102
3119
  * i.e. don't close the modal in case a guard prevents the route change,
3103
3120
  * beneficial for pending changes check.
3104
3121
  */
3105
- filter((event) => event instanceof ResolveStart), takeUntilDestroyed(this.destroyRef))
3122
+ filter((event) => event instanceof ResolveStart), takeUntilDestroyed(this.#destroyRef))
3106
3123
  .subscribe(() => this.close());
3107
3124
  }
3108
3125
  if (this.options.closeOnEscape) {
3109
- this.overlayRef
3126
+ this.#overlayRef
3110
3127
  .keydownEvents()
3111
- .pipe(filter((event) => event.key === 'Escape' && !hasModifierKey(event)), takeUntilDestroyed(this.destroyRef))
3128
+ .pipe(filter((event) => event.key === 'Escape' && !hasModifierKey(event)), takeUntilDestroyed(this.#destroyRef))
3112
3129
  .subscribe((event) => {
3113
3130
  event.preventDefault();
3114
- this.softClose();
3131
+ this.#softClose();
3115
3132
  });
3116
3133
  }
3117
3134
  if (this.options.closeOnOutsideClick) {
3118
- this.overlayRef
3135
+ this.#overlayRef
3119
3136
  .backdropClick()
3120
- .pipe(takeUntilDestroyed(this.destroyRef))
3121
- .subscribe(() => this.softClose());
3137
+ .pipe(takeUntilDestroyed(this.#destroyRef))
3138
+ .subscribe(() => this.#softClose());
3122
3139
  }
3123
3140
  },
3124
3141
  });
3125
3142
  }
3126
3143
  close(result) {
3127
- if (!this.overlayRef.hasAttached()) {
3144
+ if (!this.#overlayRef.hasAttached()) {
3128
3145
  return;
3129
3146
  }
3130
- this.overlayRef.dispose();
3131
- this.closeSubject.next(result);
3132
- this.closeSubject.complete();
3147
+ this.#overlayRef.dispose();
3148
+ this.#closeSubject.next(result);
3149
+ this.#closeSubject.complete();
3133
3150
  }
3134
3151
  afterClosed({ closeOnUnsubscribe } = { closeOnUnsubscribe: true }) {
3135
3152
  return new Observable((observer) => {
3136
- this.closeSubject.subscribe(observer);
3153
+ this.#closeSubject.subscribe(observer);
3137
3154
  return () => closeOnUnsubscribe && this.close();
3138
3155
  });
3139
3156
  }
@@ -3145,21 +3162,21 @@ class GaModalComponent {
3145
3162
  onSoftClose() {
3146
3163
  return true;
3147
3164
  }
3148
- softClose() {
3165
+ #softClose() {
3149
3166
  const shouldClose = this.onSoftClose();
3150
3167
  if (typeof shouldClose === 'boolean' && shouldClose) {
3151
3168
  this.close();
3152
3169
  }
3153
3170
  if (isObservable(shouldClose)) {
3154
3171
  shouldClose
3155
- .pipe(takeUntilDestroyed(this.destroyRef))
3172
+ .pipe(takeUntilDestroyed(this.#destroyRef))
3156
3173
  .subscribe((result) => result && this.close());
3157
3174
  }
3158
3175
  }
3159
3176
  createOptions(options) {
3160
3177
  return {
3161
3178
  ...DEFAULT_MODAL_OPTIONS,
3162
- ...this.globalOptions,
3179
+ ...this.#globalOptions,
3163
3180
  ...options,
3164
3181
  };
3165
3182
  }