@skyux/indicators 8.0.0-alpha.13 → 8.0.0-alpha.15

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.
@@ -8,7 +8,7 @@ import * as i1 from '@skyux/theme';
8
8
  import { SkyThemeModule } from '@skyux/theme';
9
9
  import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib';
10
10
  import * as i2 from '@skyux/core';
11
- import { SkyTrimModule, SkyMutationObserverService, SkyAppWindowRef, SkyDynamicComponentService, SkyDynamicComponentLocation } from '@skyux/core';
11
+ import { SkyTrimModule, SkyLogService, SkyMutationObserverService, SkyAppWindowRef, SkyDynamicComponentService, SkyDynamicComponentLocation } from '@skyux/core';
12
12
  import { trigger, transition, style, animate } from '@angular/animations';
13
13
  import { Subject, BehaviorSubject, defer } from 'rxjs';
14
14
  import { takeUntil, take, finalize } from 'rxjs/operators';
@@ -647,7 +647,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
647
647
  }]
648
648
  }] });
649
649
 
650
- var _SkyLabelComponent_instances, _SkyLabelComponent__descriptionType, _SkyLabelComponent__customDescription, _SkyLabelComponent_descriptionTypeResourceSubscription, _SkyLabelComponent_changeDetector, _SkyLabelComponent_resources, _SkyLabelComponent_updateIcon, _SkyLabelComponent_updateDescriptionComputed, _SkyLabelComponent_unsubscribe;
650
+ var _SkyLabelComponent_instances, _SkyLabelComponent__descriptionType, _SkyLabelComponent__customDescription, _SkyLabelComponent_descriptionTypeResourceSubscription, _SkyLabelComponent_descriptionTypeWarned, _SkyLabelComponent_changeDetector, _SkyLabelComponent_resources, _SkyLabelComponent_logSvc, _SkyLabelComponent_updateIcon, _SkyLabelComponent_updateDescriptionComputed, _SkyLabelComponent_unsubscribe;
651
651
  const LABEL_TYPE_DEFAULT = 'info';
652
652
  class SkyLabelComponent {
653
653
  constructor() {
@@ -656,8 +656,10 @@ class SkyLabelComponent {
656
656
  _SkyLabelComponent__descriptionType.set(this, void 0);
657
657
  _SkyLabelComponent__customDescription.set(this, void 0);
658
658
  _SkyLabelComponent_descriptionTypeResourceSubscription.set(this, void 0);
659
+ _SkyLabelComponent_descriptionTypeWarned.set(this, void 0);
659
660
  _SkyLabelComponent_changeDetector.set(this, inject(ChangeDetectorRef));
660
661
  _SkyLabelComponent_resources.set(this, inject(SkyLibResourcesService));
662
+ _SkyLabelComponent_logSvc.set(this, inject(SkyLogService));
661
663
  }
662
664
  /**
663
665
  * The type of label to display.
@@ -675,6 +677,9 @@ class SkyLabelComponent {
675
677
  __classPrivateFieldSet(this, _SkyLabelComponent__descriptionType, value, "f");
676
678
  __classPrivateFieldGet(this, _SkyLabelComponent_instances, "m", _SkyLabelComponent_updateDescriptionComputed).call(this);
677
679
  }
680
+ get descriptionType() {
681
+ return __classPrivateFieldGet(this, _SkyLabelComponent__descriptionType, "f");
682
+ }
678
683
  /**
679
684
  * The text to be read by screen readers for users who cannot see
680
685
  * the indicator icon when `descriptionType` is `custom`.
@@ -683,31 +688,43 @@ class SkyLabelComponent {
683
688
  __classPrivateFieldSet(this, _SkyLabelComponent__customDescription, value, "f");
684
689
  __classPrivateFieldGet(this, _SkyLabelComponent_instances, "m", _SkyLabelComponent_updateDescriptionComputed).call(this);
685
690
  }
691
+ get customDescription() {
692
+ return __classPrivateFieldGet(this, _SkyLabelComponent__customDescription, "f");
693
+ }
686
694
  ngOnInit() {
687
695
  __classPrivateFieldGet(this, _SkyLabelComponent_instances, "m", _SkyLabelComponent_updateIcon).call(this);
688
696
  }
697
+ ngAfterViewChecked() {
698
+ if (!this.descriptionType && !__classPrivateFieldGet(this, _SkyLabelComponent_descriptionTypeWarned, "f")) {
699
+ __classPrivateFieldGet(this, _SkyLabelComponent_logSvc, "f").deprecated('SkyLabelComponent without `descriptionType`', {
700
+ deprecationMajorVersion: 8,
701
+ replacementRecommendation: 'Always specify a `descriptionType` property.',
702
+ });
703
+ __classPrivateFieldSet(this, _SkyLabelComponent_descriptionTypeWarned, true, "f");
704
+ }
705
+ }
689
706
  ngOnDestroy() {
690
707
  __classPrivateFieldGet(this, _SkyLabelComponent_instances, "m", _SkyLabelComponent_unsubscribe).call(this);
691
708
  }
692
709
  }
693
- _SkyLabelComponent__descriptionType = new WeakMap(), _SkyLabelComponent__customDescription = new WeakMap(), _SkyLabelComponent_descriptionTypeResourceSubscription = new WeakMap(), _SkyLabelComponent_changeDetector = new WeakMap(), _SkyLabelComponent_resources = new WeakMap(), _SkyLabelComponent_instances = new WeakSet(), _SkyLabelComponent_updateIcon = function _SkyLabelComponent_updateIcon() {
710
+ _SkyLabelComponent__descriptionType = new WeakMap(), _SkyLabelComponent__customDescription = new WeakMap(), _SkyLabelComponent_descriptionTypeResourceSubscription = new WeakMap(), _SkyLabelComponent_descriptionTypeWarned = new WeakMap(), _SkyLabelComponent_changeDetector = new WeakMap(), _SkyLabelComponent_resources = new WeakMap(), _SkyLabelComponent_logSvc = new WeakMap(), _SkyLabelComponent_instances = new WeakSet(), _SkyLabelComponent_updateIcon = function _SkyLabelComponent_updateIcon() {
694
711
  const indicatorIcon = SkyIndicatorIconUtility.getIconsForType(this.labelTypeOrDefault);
695
712
  this.icon = indicatorIcon.defaultThemeIcon;
696
713
  this.baseIcon = indicatorIcon.modernThemeBaseIcon;
697
714
  this.topIcon = indicatorIcon.modernThemeTopIcon;
698
715
  }, _SkyLabelComponent_updateDescriptionComputed = function _SkyLabelComponent_updateDescriptionComputed() {
699
716
  __classPrivateFieldGet(this, _SkyLabelComponent_instances, "m", _SkyLabelComponent_unsubscribe).call(this);
700
- if (__classPrivateFieldGet(this, _SkyLabelComponent__descriptionType, "f")) {
701
- switch (__classPrivateFieldGet(this, _SkyLabelComponent__descriptionType, "f")) {
717
+ if (this.descriptionType) {
718
+ switch (this.descriptionType) {
702
719
  case 'none':
703
720
  this.descriptionComputed = undefined;
704
721
  break;
705
722
  case 'custom':
706
- this.descriptionComputed = __classPrivateFieldGet(this, _SkyLabelComponent__customDescription, "f");
723
+ this.descriptionComputed = this.customDescription;
707
724
  break;
708
725
  default:
709
726
  __classPrivateFieldSet(this, _SkyLabelComponent_descriptionTypeResourceSubscription, __classPrivateFieldGet(this, _SkyLabelComponent_resources, "f")
710
- .getString('skyux_label_sr_' + __classPrivateFieldGet(this, _SkyLabelComponent__descriptionType, "f").replace(/-/g, '_'))
727
+ .getString('skyux_label_sr_' + this.descriptionType.replace(/-/g, '_'))
711
728
  .subscribe((value) => {
712
729
  this.descriptionComputed = value;
713
730
  __classPrivateFieldGet(this, _SkyLabelComponent_changeDetector, "f").markForCheck();