@ethlete/cdk 3.20.0 → 3.21.0

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/esm2022/lib/components/forms/components/select/components/combobox/directives/combobox/combobox.directive.mjs +1 -1
  3. package/esm2022/lib/components/forms/components/select/components/combobox/partials/combobox-option/combobox-option.component.mjs +6 -2
  4. package/esm2022/lib/components/forms/components/select/components/select/directives/select/select.directive.mjs +1 -1
  5. package/esm2022/lib/components/forms/components/select/components/select/directives/select-option/select-option.directive.mjs +6 -2
  6. package/esm2022/lib/components/picture/picture-data.directive.mjs +1 -1
  7. package/esm2022/lib/components/picture/picture.component.mjs +6 -8
  8. package/esm2022/lib/components/picture/picture.component.types.mjs +1 -1
  9. package/esm2022/lib/components/picture/pipes/index.mjs +2 -0
  10. package/esm2022/lib/components/picture/pipes/normalize-source/index.mjs +2 -0
  11. package/esm2022/lib/components/picture/pipes/normalize-source/normalize-source.pipe.mjs +18 -0
  12. package/esm2022/lib/components/picture/pipes/normalize-source/normalize-source.util.mjs +11 -0
  13. package/fesm2022/ethlete-cdk.mjs +40 -10
  14. package/fesm2022/ethlete-cdk.mjs.map +1 -1
  15. package/lib/components/forms/components/select/components/combobox/directives/combobox/combobox.directive.d.ts +2 -2
  16. package/lib/components/forms/components/select/components/combobox/partials/combobox-option/combobox-option.component.d.ts +1 -0
  17. package/lib/components/forms/components/select/components/select/directives/select/select.directive.d.ts +1 -1
  18. package/lib/components/forms/components/select/components/select/directives/select-option/select-option.directive.d.ts +1 -0
  19. package/lib/components/picture/picture-data.directive.d.ts +1 -1
  20. package/lib/components/picture/picture.component.d.ts +1 -1
  21. package/lib/components/picture/picture.component.types.d.ts +1 -1
  22. package/lib/components/picture/pipes/index.d.ts +1 -0
  23. package/lib/components/picture/pipes/normalize-source/index.d.ts +1 -0
  24. package/lib/components/picture/pipes/normalize-source/normalize-source.pipe.d.ts +7 -0
  25. package/lib/components/picture/pipes/normalize-source/normalize-source.util.d.ts +2 -0
  26. package/package.json +2 -2
@@ -2,9 +2,9 @@ import * as i1 from '@angular/cdk/portal';
2
2
  import { CdkPortal, PortalModule, ComponentPortal, TemplatePortal, CdkPortalOutlet } from '@angular/cdk/portal';
3
3
  import { AsyncPipe, NgIf, NgClass, NgTemplateOutlet, NgForOf, NgFor, NgComponentOutlet, DOCUMENT, JsonPipe, formatDate } from '@angular/common';
4
4
  import * as i0 from '@angular/core';
5
- import { Component, ViewEncapsulation, ChangeDetectionStrategy, Directive, InjectionToken, booleanAttribute, Input, ContentChild, ContentChildren, inject, ElementRef, Injector, HostBinding, computed, signal, Optional, Inject, Injectable, SkipSelf, HostListener, ViewContainerRef, EventEmitter, NgZone, isDevMode, Output, NgModule, ChangeDetectorRef, ViewChild, runInInjectionContext, TemplateRef, forwardRef, LOCALE_ID, numberAttribute, ViewChildren, Renderer2, Attribute } from '@angular/core';
5
+ import { Component, ViewEncapsulation, ChangeDetectionStrategy, Directive, InjectionToken, booleanAttribute, Input, ContentChild, ContentChildren, inject, ElementRef, Injector, HostBinding, computed, signal, Optional, Inject, Injectable, SkipSelf, HostListener, ViewContainerRef, EventEmitter, NgZone, isDevMode, Output, NgModule, ChangeDetectorRef, ViewChild, runInInjectionContext, TemplateRef, forwardRef, LOCALE_ID, numberAttribute, ViewChildren, Pipe, Renderer2, Attribute } from '@angular/core';
6
6
  import * as i1$2 from '@ethlete/core';
7
- import { LetDirective, createDestroy, ScrollObserverFirstElementDirective, ScrollObserverLastElementDirective, Memo, signalHostAttributes, signalHostClasses, AnimatedIfDirective, AnimatedLifecycleDirective, SmartBlockScrollStrategy, RouterStateService, ANIMATED_LIFECYCLE_TOKEN, nextFrame, elementCanScroll, equal, ViewportService, AnimatedOverlayDirective, ClickObserverService, FocusVisibleService, cloneFormGroup, getFormGroupValue, ObserveVisibilityDirective, signalVisibilityChangeClasses, IS_EMAIL, MUST_MATCH, IS_ARRAY_NOT_EMPTY, AT_LEAST_ONE_REQUIRED, switchQueryListChanges, signalAttributes, ResizeObserverService, createFlipAnimation, RuntimeError, SelectionModel, ActiveSelectionModel, KeyPressManager, signalClasses, scrollToElement, isEmptyArray, isObjectArray, isPrimitiveArray, ClickOutsideDirective, ObserveContentDirective, clamp, DELAYABLE_TOKEN, ObserveResizeDirective, getElementVisibleStates, IS_ACTIVE_ELEMENT, IS_ELEMENT, CursorDragScrollDirective, ObserveScrollStateDirective, IsElementDirective, IsActiveElementDirective, ScrollObserverIgnoreTargetDirective, TypedQueryList } from '@ethlete/core';
7
+ import { LetDirective, createDestroy, ScrollObserverFirstElementDirective, ScrollObserverLastElementDirective, Memo, signalHostAttributes, signalHostClasses, AnimatedIfDirective, AnimatedLifecycleDirective, SmartBlockScrollStrategy, RouterStateService, ANIMATED_LIFECYCLE_TOKEN, nextFrame, elementCanScroll, equal, ViewportService, AnimatedOverlayDirective, ClickObserverService, FocusVisibleService, cloneFormGroup, getFormGroupValue, ObserveVisibilityDirective, signalVisibilityChangeClasses, IS_EMAIL, MUST_MATCH, IS_ARRAY_NOT_EMPTY, AT_LEAST_ONE_REQUIRED, switchQueryListChanges, signalAttributes, ResizeObserverService, createFlipAnimation, RuntimeError, SelectionModel, ActiveSelectionModel, KeyPressManager, signalClasses, scrollToElement, isEmptyArray, isObjectArray, isPrimitiveArray, ClickOutsideDirective, ObserveContentDirective, clamp, DELAYABLE_TOKEN, ObserveResizeDirective, inferMimeType, getElementVisibleStates, IS_ACTIVE_ELEMENT, IS_ELEMENT, CursorDragScrollDirective, ObserveScrollStateDirective, IsElementDirective, IsActiveElementDirective, ScrollObserverIgnoreTargetDirective, TypedQueryList } from '@ethlete/core';
8
8
  import { BehaviorSubject, startWith, map, switchMap, combineLatest, pairwise, tap, takeUntil, skip, of, Subject, filter, take, merge, skipUntil, defer, fromEvent, partition, debounceTime as debounceTime$1, Observable, distinctUntilChanged as distinctUntilChanged$1, withLatestFrom, skipWhile, catchError, throwError, firstValueFrom, timer, Subscription } from 'rxjs';
9
9
  import { trigger, state, style, transition, animate } from '@angular/animations';
10
10
  import { __decorate, __metadata } from 'tslib';
@@ -9068,8 +9068,11 @@ class ComboboxOptionComponent {
9068
9068
  ignoreBlur() {
9069
9069
  this.combobox._ignoreNextBlurEvent();
9070
9070
  }
9071
+ setActiveByHover() {
9072
+ this.combobox._activeSelectionModel.setActiveOption(this.option);
9073
+ }
9071
9074
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: ComboboxOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9072
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.5", type: ComboboxOptionComponent, isStandalone: true, selector: "et-combobox-option", inputs: { option: "option" }, host: { attributes: { "role": "option" }, listeners: { "mousedown": "ignoreBlur()", "click": "selectOption()" }, properties: { "attr.id": "id" }, classAttribute: "et-combobox-option" }, providers: [
9075
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.5", type: ComboboxOptionComponent, isStandalone: true, selector: "et-combobox-option", inputs: { option: "option" }, host: { attributes: { "role": "option" }, listeners: { "mousedown": "ignoreBlur()", "click": "selectOption()", "mouseenter": "setActiveByHover()" }, properties: { "attr.id": "id" }, classAttribute: "et-combobox-option" }, providers: [
9073
9076
  {
9074
9077
  provide: COMBOBOX_OPTION_TOKEN,
9075
9078
  useExisting: ComboboxOptionComponent,
@@ -9082,6 +9085,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
9082
9085
  class: 'et-combobox-option',
9083
9086
  '(mousedown)': 'ignoreBlur()',
9084
9087
  '(click)': 'selectOption()',
9088
+ '(mouseenter)': 'setActiveByHover()',
9085
9089
  '[attr.id]': 'id',
9086
9090
  role: 'option',
9087
9091
  }, imports: [AsyncPipe, NgIf, NgTemplateOutlet, NgComponentOutlet], hostDirectives: [], providers: [
@@ -9471,8 +9475,11 @@ class SelectOptionDirective {
9471
9475
  _setActive(isActive) {
9472
9476
  this._isActive$.next(isActive);
9473
9477
  }
9478
+ setActiveByHover() {
9479
+ this._select._setActiveOption(this);
9480
+ }
9474
9481
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: SelectOptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
9475
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.5", type: SelectOptionDirective, isStandalone: true, inputs: { value: "value", disabled: "disabled" }, host: { attributes: { "role": "option" }, listeners: { "click": "setSelectValue()", "etObserveContent": "_updateViewValue()" }, properties: { "attr.id": "id", "attr.aria-disabled": "disabled", "class.et-select-option--disabled": "disabled" } }, providers: [
9482
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.5", type: SelectOptionDirective, isStandalone: true, inputs: { value: "value", disabled: "disabled" }, host: { attributes: { "role": "option" }, listeners: { "click": "setSelectValue()", "mouseenter": "setActiveByHover()", "etObserveContent": "_updateViewValue()" }, properties: { "attr.id": "id", "attr.aria-disabled": "disabled", "class.et-select-option--disabled": "disabled" } }, providers: [
9476
9483
  {
9477
9484
  provide: SELECT_OPTION_TOKEN,
9478
9485
  useExisting: SelectOptionDirective,
@@ -9494,6 +9501,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
9494
9501
  '[attr.aria-disabled]': 'disabled',
9495
9502
  '[class.et-select-option--disabled]': 'disabled',
9496
9503
  '(click)': 'setSelectValue()',
9504
+ '(mouseenter)': 'setActiveByHover()',
9497
9505
  '(etObserveContent)': '_updateViewValue()',
9498
9506
  role: 'option',
9499
9507
  },
@@ -11449,6 +11457,31 @@ const provideImageConfig = (config = {}) => {
11449
11457
  };
11450
11458
  };
11451
11459
 
11460
+ const normalizeSource = (source) => {
11461
+ if (typeof source === 'string') {
11462
+ return { type: inferMimeType(source), srcset: source };
11463
+ }
11464
+ else {
11465
+ const mimeType = source.type && source.type !== '' ? source.type : inferMimeType(source.srcset);
11466
+ return { type: mimeType, srcset: source.srcset };
11467
+ }
11468
+ };
11469
+
11470
+ class NormalizeSourcePipe {
11471
+ constructor() {
11472
+ this.transform = normalizeSource;
11473
+ }
11474
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: NormalizeSourcePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
11475
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.5", ngImport: i0, type: NormalizeSourcePipe, isStandalone: true, name: "normalizeSource" }); }
11476
+ }
11477
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: NormalizeSourcePipe, decorators: [{
11478
+ type: Pipe,
11479
+ args: [{
11480
+ name: 'normalizeSource',
11481
+ standalone: true,
11482
+ }]
11483
+ }] });
11484
+
11452
11485
  class PictureComponent {
11453
11486
  constructor() {
11454
11487
  this.pictureData = inject(PictureDataDirective);
@@ -11457,9 +11490,6 @@ class PictureComponent {
11457
11490
  this.trackBySrc = (_, item) => item.srcset;
11458
11491
  }
11459
11492
  combineWithConfig(src) {
11460
- if (isDevMode() && src.type === '') {
11461
- console.warn(`The type attribute is missing for the following source`, src.srcset, this);
11462
- }
11463
11493
  if (!this.config?.baseUrl || src.srcset.startsWith('http')) {
11464
11494
  return src;
11465
11495
  }
@@ -11470,11 +11500,11 @@ class PictureComponent {
11470
11500
  };
11471
11501
  }
11472
11502
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: PictureComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11473
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.5", type: PictureComponent, isStandalone: true, selector: "et-picture", inputs: { sources: "sources" }, host: { classAttribute: "et-picture" }, hostDirectives: [{ directive: PictureDataDirective, inputs: ["imgClass", "imgClass", "hasPriority", "hasPriority", "figureClass", "figureClass", "pictureClass", "pictureClass", "figcaptionClass", "figcaptionClass", "defaultSrc", "defaultSrc", "alt", "alt", "figcaption", "figcaption", "width", "width", "height", "height", "sizes", "sizes"] }], ngImport: i0, template: "<figure [ngClass]=\"pictureData.figureClass\" class=\"et-picture-figure\">\n <picture [ngClass]=\"pictureData.pictureClass\" class=\"et-picture-picture\">\n <ng-container *ngFor=\"let source of sources; trackBy: trackBySrc\">\n <source\n *etLet=\"combineWithConfig(source) as s\"\n [type]=\"s.type\"\n [attr.srcset]=\"s.srcset\"\n [attr.sizes]=\"pictureData.sizes\"\n />\n </ng-container>\n\n <ng-container *ngIf=\"pictureData.defaultSrc as source\">\n <img\n *etLet=\"combineWithConfig(source) as s\"\n [attr.loading]=\"pictureData.hasPriority ? 'eager' : 'lazy'\"\n [attr.fetchpriority]=\"pictureData.hasPriority ? 'high' : 'auto'\"\n [ngClass]=\"pictureData.imgClass\"\n [attr.srcset]=\"s.srcset\"\n [attr.type]=\"s.type\"\n [attr.alt]=\"pictureData.alt\"\n [attr.width]=\"pictureData.width\"\n [attr.height]=\"pictureData.height\"\n [attr.sizes]=\"pictureData.sizes\"\n class=\"et-picture-img\"\n />\n </ng-container>\n </picture>\n\n <figcaption *ngIf=\"pictureData.figcaption\" [ngClass]=\"pictureData.figcaptionClass\" class=\"et-picture-figcaption\">\n {{ pictureData.figcaption }}\n </figcaption>\n</figure>\n", dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: LetDirective, selector: "[etLet]", inputs: ["etLet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
11503
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.5", type: PictureComponent, isStandalone: true, selector: "et-picture", inputs: { sources: "sources" }, host: { classAttribute: "et-picture" }, hostDirectives: [{ directive: PictureDataDirective, inputs: ["imgClass", "imgClass", "hasPriority", "hasPriority", "figureClass", "figureClass", "pictureClass", "pictureClass", "figcaptionClass", "figcaptionClass", "defaultSrc", "defaultSrc", "alt", "alt", "figcaption", "figcaption", "width", "width", "height", "height", "sizes", "sizes"] }], ngImport: i0, template: "<figure [ngClass]=\"pictureData.figureClass\" class=\"et-picture-figure\">\n <picture [ngClass]=\"pictureData.pictureClass\" class=\"et-picture-picture\">\n <ng-container *ngFor=\"let source of sources; trackBy: trackBySrc\">\n <source\n *etLet=\"combineWithConfig(source | normalizeSource) as s\"\n [type]=\"s.type\"\n [attr.srcset]=\"s.srcset\"\n [attr.sizes]=\"pictureData.sizes\"\n />\n </ng-container>\n\n <ng-container *ngIf=\"pictureData.defaultSrc as source\">\n <img\n *etLet=\"combineWithConfig(source | normalizeSource) as s\"\n [attr.loading]=\"pictureData.hasPriority ? 'eager' : 'lazy'\"\n [attr.fetchpriority]=\"pictureData.hasPriority ? 'high' : 'auto'\"\n [ngClass]=\"pictureData.imgClass\"\n [attr.srcset]=\"s.srcset\"\n [attr.type]=\"s.type\"\n [attr.alt]=\"pictureData.alt\"\n [attr.width]=\"pictureData.width\"\n [attr.height]=\"pictureData.height\"\n [attr.sizes]=\"pictureData.sizes\"\n class=\"et-picture-img\"\n />\n </ng-container>\n </picture>\n\n <figcaption *ngIf=\"pictureData.figcaption\" [ngClass]=\"pictureData.figcaptionClass\" class=\"et-picture-figcaption\">\n {{ pictureData.figcaption }}\n </figcaption>\n</figure>\n", dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: LetDirective, selector: "[etLet]", inputs: ["etLet"] }, { kind: "pipe", type: NormalizeSourcePipe, name: "normalizeSource" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
11474
11504
  }
11475
11505
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: PictureComponent, decorators: [{
11476
11506
  type: Component,
11477
- args: [{ selector: 'et-picture', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [NgForOf, NgClass, NgIf, LetDirective], host: {
11507
+ args: [{ selector: 'et-picture', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [NgForOf, NgClass, NgIf, LetDirective, NormalizeSourcePipe], host: {
11478
11508
  class: 'et-picture',
11479
11509
  }, hostDirectives: [
11480
11510
  {
@@ -11493,7 +11523,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
11493
11523
  'sizes',
11494
11524
  ],
11495
11525
  },
11496
- ], template: "<figure [ngClass]=\"pictureData.figureClass\" class=\"et-picture-figure\">\n <picture [ngClass]=\"pictureData.pictureClass\" class=\"et-picture-picture\">\n <ng-container *ngFor=\"let source of sources; trackBy: trackBySrc\">\n <source\n *etLet=\"combineWithConfig(source) as s\"\n [type]=\"s.type\"\n [attr.srcset]=\"s.srcset\"\n [attr.sizes]=\"pictureData.sizes\"\n />\n </ng-container>\n\n <ng-container *ngIf=\"pictureData.defaultSrc as source\">\n <img\n *etLet=\"combineWithConfig(source) as s\"\n [attr.loading]=\"pictureData.hasPriority ? 'eager' : 'lazy'\"\n [attr.fetchpriority]=\"pictureData.hasPriority ? 'high' : 'auto'\"\n [ngClass]=\"pictureData.imgClass\"\n [attr.srcset]=\"s.srcset\"\n [attr.type]=\"s.type\"\n [attr.alt]=\"pictureData.alt\"\n [attr.width]=\"pictureData.width\"\n [attr.height]=\"pictureData.height\"\n [attr.sizes]=\"pictureData.sizes\"\n class=\"et-picture-img\"\n />\n </ng-container>\n </picture>\n\n <figcaption *ngIf=\"pictureData.figcaption\" [ngClass]=\"pictureData.figcaptionClass\" class=\"et-picture-figcaption\">\n {{ pictureData.figcaption }}\n </figcaption>\n</figure>\n" }]
11526
+ ], template: "<figure [ngClass]=\"pictureData.figureClass\" class=\"et-picture-figure\">\n <picture [ngClass]=\"pictureData.pictureClass\" class=\"et-picture-picture\">\n <ng-container *ngFor=\"let source of sources; trackBy: trackBySrc\">\n <source\n *etLet=\"combineWithConfig(source | normalizeSource) as s\"\n [type]=\"s.type\"\n [attr.srcset]=\"s.srcset\"\n [attr.sizes]=\"pictureData.sizes\"\n />\n </ng-container>\n\n <ng-container *ngIf=\"pictureData.defaultSrc as source\">\n <img\n *etLet=\"combineWithConfig(source | normalizeSource) as s\"\n [attr.loading]=\"pictureData.hasPriority ? 'eager' : 'lazy'\"\n [attr.fetchpriority]=\"pictureData.hasPriority ? 'high' : 'auto'\"\n [ngClass]=\"pictureData.imgClass\"\n [attr.srcset]=\"s.srcset\"\n [attr.type]=\"s.type\"\n [attr.alt]=\"pictureData.alt\"\n [attr.width]=\"pictureData.width\"\n [attr.height]=\"pictureData.height\"\n [attr.sizes]=\"pictureData.sizes\"\n class=\"et-picture-img\"\n />\n </ng-container>\n </picture>\n\n <figcaption *ngIf=\"pictureData.figcaption\" [ngClass]=\"pictureData.figcaptionClass\" class=\"et-picture-figcaption\">\n {{ pictureData.figcaption }}\n </figcaption>\n</figure>\n" }]
11497
11527
  }], propDecorators: { sources: [{
11498
11528
  type: Input
11499
11529
  }] } });