@rivet-health/design-system 2.7.0 → 2.8.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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Component, ChangeDetectionStrategy, Input, HostBinding, Pipe, Injectable, EventEmitter, ViewChild, Output, Directive, HostListener, ViewContainerRef, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
- import { DecimalPipe, PercentPipe, CurrencyPipe, CommonModule } from '@angular/common';
4
+ import { DecimalPipe, CurrencyPipe, PercentPipe, CommonModule } from '@angular/common';
5
5
  import { BehaviorSubject, combineLatest, map, shareReplay } from 'rxjs';
6
6
  import { pie, arc, stack, line } from 'd3-shape';
7
7
  import { index } from 'd3-array';
@@ -362,13 +362,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
362
362
  type: Input
363
363
  }] } });
364
364
 
365
+ const NO_DATA_FALLBACK = '-';
366
+
365
367
  class DaysPipe {
366
368
  constructor() {
367
369
  this.inner = new DecimalPipe('en-us');
368
370
  }
369
371
  transform(value, digitsInfo) {
370
372
  const ret = this.inner.transform(value, digitsInfo ?? '1.0-2');
371
- return ret ? ret + (value === 1 ? ' day' : ' days') : '-';
373
+ return ret ? ret + (value === 1 ? ' day' : ' days') : NO_DATA_FALLBACK;
372
374
  }
373
375
  }
374
376
  DaysPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DaysPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
@@ -378,12 +380,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
378
380
  args: [{ name: 'rivDays' }]
379
381
  }] });
380
382
 
383
+ class DollarsPipe {
384
+ constructor() {
385
+ this.inner = new CurrencyPipe('en-us');
386
+ }
387
+ transform(value, digitsInfo) {
388
+ return (this.inner.transform(value, undefined, undefined, digitsInfo ?? '1.2-2') ?? NO_DATA_FALLBACK);
389
+ }
390
+ }
391
+ DollarsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DollarsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
392
+ DollarsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: DollarsPipe, name: "rivDollars" });
393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DollarsPipe, decorators: [{
394
+ type: Pipe,
395
+ args: [{ name: 'rivDollars' }]
396
+ }] });
397
+
381
398
  class NumberPipe {
382
399
  constructor() {
383
400
  this.inner = new DecimalPipe('en-us');
384
401
  }
385
402
  transform(value, digitsInfo) {
386
- return this.inner.transform(value, digitsInfo ?? '1.0-0') ?? '-';
403
+ return (this.inner.transform(value, digitsInfo ?? '1.0-0') ?? NO_DATA_FALLBACK);
387
404
  }
388
405
  }
389
406
  NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
@@ -398,7 +415,7 @@ class PercentagePipe {
398
415
  this.inner = new PercentPipe('en-us');
399
416
  }
400
417
  transform(value, digitsInfo) {
401
- return this.inner.transform(value, digitsInfo ?? '1.1-1') ?? '-';
418
+ return (this.inner.transform(value, digitsInfo ?? '1.1-1') ?? NO_DATA_FALLBACK);
402
419
  }
403
420
  }
404
421
  PercentagePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
@@ -413,24 +430,24 @@ class SmallCurrencyPipe {
413
430
  this.inner = new CurrencyPipe('en-us');
414
431
  }
415
432
  transform(value, digitsInfo) {
416
- if (value === null) {
417
- return '-';
433
+ if (value === null || value === undefined) {
434
+ return NO_DATA_FALLBACK;
418
435
  }
419
436
  const num = typeof value == 'string' ? Number.parseFloat(value) : value;
420
437
  const magnitude = Math.log10(Math.abs(num));
421
438
  if (num === 0) {
422
- return (this.inner.transform(num, undefined, undefined, digitsInfo ?? '1.0-0') ?? '-');
439
+ return (this.inner.transform(num, undefined, undefined, digitsInfo ?? '1.0-0') ?? NO_DATA_FALLBACK);
423
440
  }
424
441
  if (magnitude >= 9) {
425
- return ((this.inner.transform(num / 1000000000, undefined, undefined, digitsInfo ?? num / 1000000000 >= 100 ? '1.0-0' : '1.0-2') ?? '-') + 'B');
442
+ return ((this.inner.transform(num / 1000000000, undefined, undefined, digitsInfo ?? num / 1000000000 >= 100 ? '1.0-0' : '1.0-2') ?? NO_DATA_FALLBACK) + 'B');
426
443
  }
427
444
  if (magnitude >= 6) {
428
- return ((this.inner.transform(num / 1000000, undefined, undefined, digitsInfo ?? num / 1000000 >= 100 ? '1.0-0' : '1.0-2') ?? '-') + 'M');
445
+ return ((this.inner.transform(num / 1000000, undefined, undefined, digitsInfo ?? num / 1000000 >= 100 ? '1.0-0' : '1.0-2') ?? NO_DATA_FALLBACK) + 'M');
429
446
  }
430
447
  if (magnitude >= 3) {
431
- return ((this.inner.transform(num / 1000, undefined, undefined, digitsInfo ?? num / 1000 >= 100 ? '1.0-0' : '1.0-2') ?? '-') + 'K');
448
+ return ((this.inner.transform(num / 1000, undefined, undefined, digitsInfo ?? num / 1000 >= 100 ? '1.0-0' : '1.0-2') ?? NO_DATA_FALLBACK) + 'K');
432
449
  }
433
- return (this.inner.transform(num, undefined, undefined, digitsInfo ?? num >= 100 ? '1.0-0' : '1.0-2') ?? '-');
450
+ return (this.inner.transform(num, undefined, undefined, digitsInfo ?? num >= 100 ? '1.0-0' : '1.0-2') ?? NO_DATA_FALLBACK);
434
451
  }
435
452
  }
436
453
  SmallCurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmallCurrencyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
@@ -757,6 +774,9 @@ class TooltipDirective {
757
774
  onMouseLeave() {
758
775
  this.initiateClose();
759
776
  }
777
+ ngOnDestroy() {
778
+ this.initiateClose();
779
+ }
760
780
  initiateClose() {
761
781
  this.closeTimeout = window.setTimeout(() => {
762
782
  this.tooltipRef?.destroy();
@@ -953,38 +973,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
953
973
  type: Input
954
974
  }] } });
955
975
 
956
- class TrendComponent {
957
- constructor() {
958
- this.label = '';
959
- this.value = 0;
960
- this.successCondition = 'positive';
961
- }
962
- getClasses() {
963
- const conditionalClass = this.value === 0
964
- ? ''
965
- : this.successCondition === 'positive'
966
- ? this.value > 0
967
- ? 'success'
968
- : 'danger'
969
- : this.value < 0
970
- ? 'success'
971
- : 'danger';
972
- return 'trend ' + conditionalClass;
973
- }
974
- }
975
- TrendComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TrendComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
976
- TrendComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TrendComponent, selector: "riv-trend", inputs: { label: "label", value: "value", successCondition: "successCondition" }, ngImport: i0, template: "<span [class]=\"getClasses()\">\n <riv-icon\n class=\"icon\"\n [name]=\"\n value === 0 ? 'ArrowRight' : value > 0 ? 'TrendingUp' : 'TrendingDown'\n \"\n [size]=\"16\"\n ></riv-icon>\n <span>{{ label }}</span>\n</span>\n", styles: [".success{color:var(--baja-blast-90)}.danger{color:var(--fyre-50)}.trend{display:flex;font-size:var(--type-1-font-size);line-height:var(--type-1-line-height-1);font-weight:var(--font-weight-normal)}.icon{margin-right:var(--size-small)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "riv-icon", inputs: ["name", "size", "customSize", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
977
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TrendComponent, decorators: [{
978
- type: Component,
979
- args: [{ selector: 'riv-trend', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span [class]=\"getClasses()\">\n <riv-icon\n class=\"icon\"\n [name]=\"\n value === 0 ? 'ArrowRight' : value > 0 ? 'TrendingUp' : 'TrendingDown'\n \"\n [size]=\"16\"\n ></riv-icon>\n <span>{{ label }}</span>\n</span>\n", styles: [".success{color:var(--baja-blast-90)}.danger{color:var(--fyre-50)}.trend{display:flex;font-size:var(--type-1-font-size);line-height:var(--type-1-line-height-1);font-weight:var(--font-weight-normal)}.icon{margin-right:var(--size-small)}\n"] }]
980
- }], propDecorators: { label: [{
981
- type: Input
982
- }], value: [{
983
- type: Input
984
- }], successCondition: [{
985
- type: Input
986
- }] } });
987
-
988
976
  function getDateRange$1(stacks) {
989
977
  let min = Infinity;
990
978
  let max = -Infinity;
@@ -1439,6 +1427,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1439
1427
  type: Input
1440
1428
  }] } });
1441
1429
 
1430
+ class TrendComponent {
1431
+ constructor() {
1432
+ this.label = '';
1433
+ this.value = 0;
1434
+ this.successCondition = 'positive';
1435
+ }
1436
+ getClasses() {
1437
+ const conditionalClass = this.value === 0
1438
+ ? ''
1439
+ : this.successCondition === 'positive'
1440
+ ? this.value > 0
1441
+ ? 'success'
1442
+ : 'danger'
1443
+ : this.value < 0
1444
+ ? 'success'
1445
+ : 'danger';
1446
+ return 'trend ' + conditionalClass;
1447
+ }
1448
+ }
1449
+ TrendComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TrendComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1450
+ TrendComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TrendComponent, selector: "riv-trend", inputs: { label: "label", value: "value", successCondition: "successCondition" }, ngImport: i0, template: "<span [class]=\"getClasses()\">\n <riv-icon\n class=\"icon\"\n [name]=\"\n value === 0 ? 'ArrowRight' : value > 0 ? 'TrendingUp' : 'TrendingDown'\n \"\n [size]=\"16\"\n ></riv-icon>\n <span>{{ label }}</span>\n</span>\n", styles: [".success{color:var(--baja-blast-90)}.danger{color:var(--fyre-50)}.trend{display:flex;font-size:var(--type-1-font-size);line-height:var(--type-1-line-height-1);font-weight:var(--font-weight-normal)}.icon{margin-right:var(--size-small)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "riv-icon", inputs: ["name", "size", "customSize", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1451
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TrendComponent, decorators: [{
1452
+ type: Component,
1453
+ args: [{ selector: 'riv-trend', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span [class]=\"getClasses()\">\n <riv-icon\n class=\"icon\"\n [name]=\"\n value === 0 ? 'ArrowRight' : value > 0 ? 'TrendingUp' : 'TrendingDown'\n \"\n [size]=\"16\"\n ></riv-icon>\n <span>{{ label }}</span>\n</span>\n", styles: [".success{color:var(--baja-blast-90)}.danger{color:var(--fyre-50)}.trend{display:flex;font-size:var(--type-1-font-size);line-height:var(--type-1-line-height-1);font-weight:var(--font-weight-normal)}.icon{margin-right:var(--size-small)}\n"] }]
1454
+ }], propDecorators: { label: [{
1455
+ type: Input
1456
+ }], value: [{
1457
+ type: Input
1458
+ }], successCondition: [{
1459
+ type: Input
1460
+ }] } });
1461
+
1442
1462
  class RivModule {
1443
1463
  }
1444
1464
  RivModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: RivModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -1450,6 +1470,7 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
1450
1470
  DataTableHeaderCellComponent,
1451
1471
  DataTableRowComponent,
1452
1472
  DaysPipe,
1473
+ DollarsPipe,
1453
1474
  DonutComponent,
1454
1475
  IconComponent,
1455
1476
  LegendItemComponent,
@@ -1471,6 +1492,7 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
1471
1492
  DataTableHeaderCellComponent,
1472
1493
  DataTableRowComponent,
1473
1494
  DaysPipe,
1495
+ DollarsPipe,
1474
1496
  DonutComponent,
1475
1497
  IconComponent,
1476
1498
  LegendItemComponent,
@@ -1498,6 +1520,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1498
1520
  DataTableHeaderCellComponent,
1499
1521
  DataTableRowComponent,
1500
1522
  DaysPipe,
1523
+ DollarsPipe,
1501
1524
  DonutComponent,
1502
1525
  IconComponent,
1503
1526
  LegendItemComponent,
@@ -1522,6 +1545,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1522
1545
  DataTableHeaderCellComponent,
1523
1546
  DataTableRowComponent,
1524
1547
  DaysPipe,
1548
+ DollarsPipe,
1525
1549
  DonutComponent,
1526
1550
  IconComponent,
1527
1551
  LegendItemComponent,
@@ -1545,5 +1569,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1545
1569
  * Generated bundle index. Do not edit.
1546
1570
  */
1547
1571
 
1548
- export { CalloutComponent, CalloutDirective, CalloutOutletComponent, DataTableCellComponent, DataTableComponent, DataTableHeaderCellComponent, DataTableRowComponent, DaysPipe, DonutComponent, IconComponent, LegendItemComponent, MetricComponent, NumberPipe, PercentagePipe, RivModule, SmallCurrencyPipe, StackedColumnComponent, TextToggleComponent, TimeSeriesComponent, TooltipAnchoredPositions, TooltipComponent, TooltipDirective, TrendComponent, ZeroStateComponent };
1572
+ export { CalloutComponent, CalloutDirective, CalloutOutletComponent, DataTableCellComponent, DataTableComponent, DataTableHeaderCellComponent, DataTableRowComponent, DaysPipe, DollarsPipe, DonutComponent, IconComponent, LegendItemComponent, MetricComponent, NumberPipe, PercentagePipe, RivModule, SmallCurrencyPipe, StackedColumnComponent, TextToggleComponent, TimeSeriesComponent, TooltipAnchoredPositions, TooltipComponent, TooltipDirective, TrendComponent, ZeroStateComponent };
1549
1573
  //# sourceMappingURL=rivet-health-design-system.mjs.map