@rivet-health/design-system 2.3.0 → 2.4.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,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Input, HostBinding, Injectable, EventEmitter, ViewChild, Output, Directive, NgModule } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, Input, HostBinding, Pipe, Injectable, EventEmitter, ViewChild, Output, Directive, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
- import { DecimalPipe, CommonModule } from '@angular/common';
5
- import { BehaviorSubject, map, shareReplay, combineLatest } from 'rxjs';
6
- import { pie, arc, line, stack } from 'd3-shape';
7
- import { scaleLinear, scaleBand } from 'd3-scale';
8
- import { timeYear, timeMonth, timeWeek, timeDay } from 'd3-time';
9
- import { timeFormat } from 'd3-time-format';
4
+ import { DecimalPipe, PercentPipe, CurrencyPipe, CommonModule } from '@angular/common';
5
+ import { BehaviorSubject, combineLatest, map, shareReplay } from 'rxjs';
6
+ import { pie, arc, stack, line } from 'd3-shape';
10
7
  import { index } from 'd3-array';
8
+ import { scaleBand, scaleLinear } from 'd3-scale';
9
+ import { timeMonth, timeYear, timeWeek, timeDay } from 'd3-time';
10
+ import { timeFormat } from 'd3-time-format';
11
11
 
12
12
  /**
13
13
  * DOM cache that clones existing elements if available.
@@ -362,6 +362,87 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
362
362
  type: Input
363
363
  }] } });
364
364
 
365
+ class DaysPipe {
366
+ constructor() {
367
+ this.inner = new DecimalPipe('en-us');
368
+ }
369
+ transform(value, digitsInfo) {
370
+ const ret = this.inner.transform(value, digitsInfo !== null && digitsInfo !== void 0 ? digitsInfo : '1.0-2');
371
+ return ret ? ret + (value === 1 ? ' day' : ' days') : '-';
372
+ }
373
+ }
374
+ DaysPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DaysPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
375
+ DaysPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: DaysPipe, name: "rivDays" });
376
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DaysPipe, decorators: [{
377
+ type: Pipe,
378
+ args: [{ name: 'rivDays' }]
379
+ }] });
380
+
381
+ class NumberPipe {
382
+ constructor() {
383
+ this.inner = new DecimalPipe('en-us');
384
+ }
385
+ transform(value, digitsInfo) {
386
+ var _a;
387
+ return (_a = this.inner.transform(value, digitsInfo !== null && digitsInfo !== void 0 ? digitsInfo : '1.0-0')) !== null && _a !== void 0 ? _a : '-';
388
+ }
389
+ }
390
+ NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
391
+ NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: NumberPipe, name: "rivNumber" });
392
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: NumberPipe, decorators: [{
393
+ type: Pipe,
394
+ args: [{ name: 'rivNumber' }]
395
+ }] });
396
+
397
+ class PercentagePipe {
398
+ constructor() {
399
+ this.inner = new PercentPipe('en-us');
400
+ }
401
+ transform(value, digitsInfo) {
402
+ var _a;
403
+ return (_a = this.inner.transform(value, digitsInfo !== null && digitsInfo !== void 0 ? digitsInfo : '1.1-1')) !== null && _a !== void 0 ? _a : '-';
404
+ }
405
+ }
406
+ PercentagePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentagePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
407
+ PercentagePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: PercentagePipe, name: "rivPercentage" });
408
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentagePipe, decorators: [{
409
+ type: Pipe,
410
+ args: [{ name: 'rivPercentage' }]
411
+ }] });
412
+
413
+ class SmallCurrencyPipe {
414
+ constructor() {
415
+ this.inner = new CurrencyPipe('en-us');
416
+ }
417
+ transform(value, digitsInfo) {
418
+ var _a, _b, _c, _d, _e;
419
+ if (value === null) {
420
+ return '-';
421
+ }
422
+ const num = typeof value == 'string' ? Number.parseFloat(value) : value;
423
+ const magnitude = Math.log10(Math.abs(num));
424
+ if (num === 0) {
425
+ return ((_a = this.inner.transform(num, undefined, undefined, digitsInfo !== null && digitsInfo !== void 0 ? digitsInfo : '1.0-0')) !== null && _a !== void 0 ? _a : '-');
426
+ }
427
+ if (magnitude >= 9) {
428
+ return (((_b = this.inner.transform(num / 1000000000, undefined, undefined, (digitsInfo !== null && digitsInfo !== void 0 ? digitsInfo : num / 1000000000 >= 100) ? '1.0-0' : '1.0-2')) !== null && _b !== void 0 ? _b : '-') + 'B');
429
+ }
430
+ if (magnitude >= 6) {
431
+ return (((_c = this.inner.transform(num / 1000000, undefined, undefined, (digitsInfo !== null && digitsInfo !== void 0 ? digitsInfo : num / 1000000 >= 100) ? '1.0-0' : '1.0-2')) !== null && _c !== void 0 ? _c : '-') + 'M');
432
+ }
433
+ if (magnitude >= 3) {
434
+ return (((_d = this.inner.transform(num / 1000, undefined, undefined, (digitsInfo !== null && digitsInfo !== void 0 ? digitsInfo : num / 1000 >= 100) ? '1.0-0' : '1.0-2')) !== null && _d !== void 0 ? _d : '-') + 'K');
435
+ }
436
+ return ((_e = this.inner.transform(num, undefined, undefined, (digitsInfo !== null && digitsInfo !== void 0 ? digitsInfo : num >= 100) ? '1.0-0' : '1.0-2')) !== null && _e !== void 0 ? _e : '-');
437
+ }
438
+ }
439
+ SmallCurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmallCurrencyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
440
+ SmallCurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: SmallCurrencyPipe, name: "rivSmallCurrency" });
441
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: SmallCurrencyPipe, decorators: [{
442
+ type: Pipe,
443
+ args: [{ name: 'rivSmallCurrency' }]
444
+ }] });
445
+
365
446
  class CalloutService {
366
447
  constructor() {
367
448
  this.calloutStack$ = new BehaviorSubject([]);
@@ -594,6 +675,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
594
675
  }]
595
676
  }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: CalloutService }]; } });
596
677
 
678
+ class DataTableRowComponent {
679
+ constructor() {
680
+ this.subRow = false;
681
+ }
682
+ }
683
+ DataTableRowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
684
+ DataTableRowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DataTableRowComponent, selector: "[riv-data-table-row]", inputs: { subRow: "subRow" }, host: { properties: { "class.sub-row": "this.subRow" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host:not(.sub-row){border-top:var(--border-width) solid var(--border-light)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
685
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableRowComponent, decorators: [{
686
+ type: Component,
687
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: '[riv-data-table-row]', template: '<ng-content></ng-content>', styles: [":host:not(.sub-row){border-top:var(--border-width) solid var(--border-light)}\n"] }]
688
+ }], propDecorators: { subRow: [{
689
+ type: Input
690
+ }, {
691
+ type: HostBinding,
692
+ args: ['class.sub-row']
693
+ }] } });
694
+
695
+ class DataTableCellComponent {
696
+ constructor(row) {
697
+ this.row = row;
698
+ this.subCell = false;
699
+ }
700
+ ngOnInit() {
701
+ this.subCell = this.row.subRow;
702
+ }
703
+ }
704
+ DataTableCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableCellComponent, deps: [{ token: DataTableRowComponent }], target: i0.ɵɵFactoryTarget.Component });
705
+ DataTableCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DataTableCellComponent, selector: "[riv-data-table-cell]", host: { properties: { "class.sub-cell": "this.subCell" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{padding:var(--size-large) 0;text-align:right}:host.sub-cell{padding-top:0;padding-left:var(--size-xlarge)}:host:first-child{position:sticky;left:0;z-index:1;background-color:var(--surface-light-0);text-align:left}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
706
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableCellComponent, decorators: [{
707
+ type: Component,
708
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: '[riv-data-table-cell]', template: '<ng-content></ng-content>', styles: [":host{padding:var(--size-large) 0;text-align:right}:host.sub-cell{padding-top:0;padding-left:var(--size-xlarge)}:host:first-child{position:sticky;left:0;z-index:1;background-color:var(--surface-light-0);text-align:left}\n"] }]
709
+ }], ctorParameters: function () { return [{ type: DataTableRowComponent }]; }, propDecorators: { subCell: [{
710
+ type: HostBinding,
711
+ args: ['class.sub-cell']
712
+ }] } });
713
+
714
+ class DataTableComponent {
715
+ }
716
+ DataTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
717
+ DataTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DataTableComponent, selector: "riv-data-table", ngImport: i0, template: '<table><ng-content></ng-content></table>', isInline: true, styles: [":host{display:block;overflow-x:auto}table{table-layout:fixed;min-width:100%;border-collapse:collapse}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
718
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableComponent, decorators: [{
719
+ type: Component,
720
+ args: [{ selector: 'riv-data-table', template: '<table><ng-content></ng-content></table>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;overflow-x:auto}table{table-layout:fixed;min-width:100%;border-collapse:collapse}\n"] }]
721
+ }] });
722
+
723
+ class DataTableHeaderCellComponent {
724
+ }
725
+ DataTableHeaderCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableHeaderCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
726
+ DataTableHeaderCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DataTableHeaderCellComponent, selector: "[riv-data-table-header-cell]", ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{padding:var(--size-large) 0;font-weight:var(--font-weight-heavy);text-align:right}:host:first-child{position:sticky;left:0;z-index:1;background-color:var(--surface-light-0);text-align:left}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
727
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableHeaderCellComponent, decorators: [{
728
+ type: Component,
729
+ args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: '[riv-data-table-header-cell]', template: '<ng-content></ng-content>', styles: [":host{padding:var(--size-large) 0;font-weight:var(--font-weight-heavy);text-align:right}:host:first-child{position:sticky;left:0;z-index:1;background-color:var(--surface-light-0);text-align:left}\n"] }]
730
+ }] });
731
+
597
732
  class ZeroStateComponent {
598
733
  constructor() {
599
734
  this.message = 'No data to display.';
@@ -697,6 +832,181 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
697
832
  type: Input
698
833
  }] } });
699
834
 
835
+ function getDateRange$1(stacks) {
836
+ let min = Infinity;
837
+ let max = -Infinity;
838
+ for (const stack of stacks) {
839
+ for (const series of stack) {
840
+ for (const { date } of series.data) {
841
+ const value = date.valueOf();
842
+ min = Math.min(min, value);
843
+ max = Math.max(max, value);
844
+ }
845
+ }
846
+ }
847
+ return [new Date(min), new Date(max)];
848
+ }
849
+ // TODO: once we upgrade to Angular 16, this component can be cleaned up with
850
+ // signals instead of RxJS.
851
+ class StackedColumnComponent {
852
+ constructor() {
853
+ this.input$ = new BehaviorSubject([]);
854
+ this.width$ = new BehaviorSubject(960);
855
+ this.height$ = new BehaviorSubject(256);
856
+ this.valueFormatter = v => v.toString();
857
+ this.drawData$ = combineLatest([
858
+ this.input$,
859
+ this.width$,
860
+ this.height$,
861
+ ]).pipe(map(([input, width, height]) => {
862
+ const viewBox = `0 0 ${width} ${height}`;
863
+ const padding = 8;
864
+ const [minDate, maxDate] = getDateRange$1(input);
865
+ const xSteps = timeMonth.range(timeMonth.floor(minDate), timeMonth.floor(timeMonth.offset(maxDate, 1)));
866
+ const xFormatter = timeFormat('%b');
867
+ const xOuterScale = scaleBand()
868
+ .domain(xSteps.map(date => xFormatter(date)))
869
+ .range([0, width]);
870
+ const columnWidth = 6;
871
+ const columnPadding = 4;
872
+ const outerPadding = (xOuterScale.bandwidth() -
873
+ (columnPadding * (input.length - 1) + columnWidth * input.length)) /
874
+ 2;
875
+ const renderInformation = input.map(stackData => {
876
+ const stackedTable = stackData.reduce((table, s) => [
877
+ ...table,
878
+ ...s.data.map(point => (Object.assign(Object.assign({}, point), { series: s }))),
879
+ ], []);
880
+ const indexedTable = index(stackedTable, d => d.date, d => d.series.label);
881
+ const stacked = stack()
882
+ .keys(stackData.map(v => v.label))
883
+ .value(([_, group], key) => {
884
+ return group.get(key).value;
885
+ })(indexedTable);
886
+ return { indexedTable, stacked };
887
+ });
888
+ let domainMax = 0;
889
+ renderInformation.forEach(({ stacked, indexedTable }) => {
890
+ [...indexedTable.values()].forEach((pointMap, i) => {
891
+ [...pointMap.values()].forEach((_, j) => {
892
+ domainMax = Math.max(domainMax, ...stacked[j][i]);
893
+ });
894
+ });
895
+ });
896
+ const yScale = scaleLinear()
897
+ .domain([0, domainMax])
898
+ .range([height - padding * 2, padding]);
899
+ const rects = [];
900
+ renderInformation.forEach(({ stacked, indexedTable }, index) => {
901
+ [...indexedTable.entries()].forEach(([date, pointMap], i) => {
902
+ [...pointMap.entries()].forEach(([_, seriesPoint], j) => {
903
+ var _a;
904
+ const [baseline, topline] = stacked[j][i];
905
+ const width = columnWidth;
906
+ const height = yScale(baseline) - yScale(topline);
907
+ const x = ((_a = xOuterScale(xFormatter(date))) !== null && _a !== void 0 ? _a : 0) +
908
+ outerPadding +
909
+ columnWidth * index +
910
+ columnPadding * index;
911
+ const y = yScale(baseline) - height;
912
+ const fill = `var(${seriesPoint.series.colorToken})`;
913
+ rects.push({
914
+ dateValue: date.valueOf(),
915
+ x,
916
+ y,
917
+ width,
918
+ height,
919
+ fill,
920
+ striped: seriesPoint.series.style === 'striped',
921
+ seriesPoint,
922
+ });
923
+ });
924
+ });
925
+ });
926
+ const xTicks = xSteps.map(date => {
927
+ var _a;
928
+ return ({
929
+ dateValue: date.valueOf(),
930
+ label: xFormatter(date),
931
+ x: ((_a = xOuterScale(xFormatter(date))) !== null && _a !== void 0 ? _a : 0) + xOuterScale.bandwidth() / 2,
932
+ });
933
+ });
934
+ const yTicks = yScale.ticks(5);
935
+ const hoverBandWidth = renderInformation.length * columnWidth +
936
+ (renderInformation.length + 1) * columnPadding;
937
+ const hoverBands = xSteps.map(date => {
938
+ var _a;
939
+ return ({
940
+ dateValue: date.valueOf(),
941
+ x: ((_a = xOuterScale(xFormatter(date))) !== null && _a !== void 0 ? _a : 0) +
942
+ (xOuterScale.bandwidth() - hoverBandWidth) / 2,
943
+ y: yScale(domainMax),
944
+ width: hoverBandWidth,
945
+ height: yScale(0) - yScale(domainMax),
946
+ });
947
+ });
948
+ return {
949
+ columnWidth,
950
+ hoverBands,
951
+ rects,
952
+ viewBox,
953
+ xTicks,
954
+ yScale,
955
+ yTicks,
956
+ };
957
+ }), shareReplay({ refCount: true, bufferSize: 1 }));
958
+ this.empty$ = this.input$.pipe(map(input => input.every(stack => stack.every(series => series.data.length === 0))), shareReplay({ refCount: true, bufferSize: 1 }));
959
+ this.hoveredBand$ = new BehaviorSubject(null);
960
+ this.callout$ = combineLatest([this.hoveredBand$, this.drawData$]).pipe(map(([hoveredBand, drawData]) => {
961
+ if (!hoveredBand)
962
+ return null;
963
+ const { target } = hoveredBand.event;
964
+ if (!target)
965
+ return null;
966
+ const anchor = target.getBoundingClientRect();
967
+ const metrics = drawData.rects
968
+ .filter(rect => rect.dateValue === hoveredBand.dateValue)
969
+ .map(rect => ({
970
+ label: rect.seriesPoint.series.label,
971
+ value: this.valueFormatter(rect.seriesPoint.value),
972
+ }));
973
+ return { anchor, metrics };
974
+ }), shareReplay({ refCount: true, bufferSize: 1 }));
975
+ }
976
+ set input(v) {
977
+ this.input$.next(v);
978
+ }
979
+ get input() {
980
+ return this.input$.getValue();
981
+ }
982
+ set width(v) {
983
+ this.width$.next(v);
984
+ }
985
+ get width() {
986
+ return this.width$.getValue();
987
+ }
988
+ set height(v) {
989
+ this.height$.next(v);
990
+ }
991
+ get height() {
992
+ return this.height$.getValue();
993
+ }
994
+ }
995
+ StackedColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: StackedColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
996
+ StackedColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: StackedColumnComponent, selector: "riv-stacked-column", inputs: { input: "input", width: "width", height: "height", valueFormatter: "valueFormatter" }, ngImport: i0, template: "<div *ngIf=\"!(empty$ | async); else zeroState\" class=\"container\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n *ngIf=\"drawData$ | async; let d\"\n [attr.viewBox]=\"d.viewBox\"\n >\n <defs>\n <pattern\n id=\"stripes\"\n x=\"0\"\n y=\"0\"\n [attr.width]=\"d.columnWidth\"\n [attr.height]=\"d.columnWidth\"\n patternUnits=\"userSpaceOnUse\"\n >\n <line\n x1=\"0\"\n [attr.y1]=\"d.columnWidth\"\n [attr.x2]=\"d.columnWidth\"\n y2=\"0\"\n stroke=\"var(--white-100)\"\n stroke-width=\"1\"\n ></line>\n </pattern>\n </defs>\n <g *ngFor=\"let tick of d.xTicks\">\n <rect\n class=\"tick-background\"\n [class.focused]=\"(hoveredBand$ | async)?.dateValue === tick.dateValue\"\n [attr.x]=\"tick.x - 20\"\n [attr.y]=\"d.yScale(0) + 3\"\n width=\"40\"\n height=\"12\"\n rx=\"2\"\n ></rect>\n <text\n class=\"tick-label\"\n [attr.x]=\"tick.x\"\n [attr.y]=\"d.yScale(0) + 12\"\n text-anchor=\"middle\"\n >\n {{ tick.label }}\n </text>\n </g>\n <g *ngFor=\"let tick of d.yTicks\">\n <rect\n class=\"tick\"\n x=\"0\"\n [attr.y]=\"d.yScale(tick)\"\n width=\"100%\"\n height=\"1\"\n ></rect>\n <text class=\"tick-label\" x=\"0\" [attr.y]=\"d.yScale(tick)\" dy=\"-4\">\n {{ valueFormatter(tick) }}\n </text>\n </g>\n <g *ngFor=\"let rect of d.rects\">\n <rect\n class=\"column\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n [attr.fill]=\"rect.fill\"\n [class.blurred]=\"\n (hoveredBand$ | async) !== null &&\n (hoveredBand$ | async)?.dateValue !== rect.dateValue\n \"\n ></rect>\n <rect\n *ngIf=\"rect.striped\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n fill=\"url(#stripes)\"\n ></rect>\n </g>\n <rect\n *ngFor=\"let rect of d.hoverBands\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n fill=\"transparent\"\n (mouseenter)=\"\n hoveredBand$.next({ dateValue: rect.dateValue, event: $event })\n \"\n (mouseleave)=\"hoveredBand$.next(null)\"\n ></rect>\n </svg>\n</div>\n\n<ng-container *ngIf=\"callout$ | async; let callout\">\n <riv-callout\n *riv-callout\n [anchor]=\"callout.anchor\"\n [isModal]=\"false\"\n [preferredPosition]=\"'center-right'\"\n [allowedPositions]=\"[\n 'center-right',\n 'center-left',\n 'top-center',\n 'bottom-center'\n ]\"\n >\n <div class=\"callout-content\">\n <div class=\"callout-metric\" *ngFor=\"let metric of callout.metrics\">\n <div>{{ metric.label }}</div>\n <div class=\"callout-metric-value\">{{ metric.value }}</div>\n </div>\n </div>\n </riv-callout>\n</ng-container>\n\n<ng-template #zeroState>\n <riv-zero-state></riv-zero-state>\n</ng-template>\n", styles: [".tick{fill:var(--gray-20)}.tick-label{font-size:var(--type-0-font-size);line-height:var(--type-0-line-height-0);fill:var(--type-light-low-contrast)}.tick-background{transition:fill var(--short-transition);fill:transparent}.tick-background.focused{fill:var(--baloo-10)}.column{transition:opacity var(--short-transition)}.column.blurred{opacity:.4}.callout-content{padding:var(--size-large);display:grid;gap:var(--size-medium);grid-template-columns:1fr 1fr}.callout-metric{display:flex;flex-direction:column;gap:var(--size-xsmall);font-size:var(--type-1-font-size);line-height:var(--type-1-line-height-0)}.callout-metric-value{font-weight:var(--font-weight-heavy)}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CalloutComponent, selector: "riv-callout", inputs: ["anchor", "isModal", "preferredPosition", "allowedPositions", "fallbackDirection", "showCaret", "theme"], outputs: ["close"] }, { kind: "directive", type: CalloutDirective, selector: "[riv-callout]" }, { kind: "component", type: ZeroStateComponent, selector: "riv-zero-state", inputs: ["message"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
997
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: StackedColumnComponent, decorators: [{
998
+ type: Component,
999
+ args: [{ selector: 'riv-stacked-column', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"!(empty$ | async); else zeroState\" class=\"container\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n *ngIf=\"drawData$ | async; let d\"\n [attr.viewBox]=\"d.viewBox\"\n >\n <defs>\n <pattern\n id=\"stripes\"\n x=\"0\"\n y=\"0\"\n [attr.width]=\"d.columnWidth\"\n [attr.height]=\"d.columnWidth\"\n patternUnits=\"userSpaceOnUse\"\n >\n <line\n x1=\"0\"\n [attr.y1]=\"d.columnWidth\"\n [attr.x2]=\"d.columnWidth\"\n y2=\"0\"\n stroke=\"var(--white-100)\"\n stroke-width=\"1\"\n ></line>\n </pattern>\n </defs>\n <g *ngFor=\"let tick of d.xTicks\">\n <rect\n class=\"tick-background\"\n [class.focused]=\"(hoveredBand$ | async)?.dateValue === tick.dateValue\"\n [attr.x]=\"tick.x - 20\"\n [attr.y]=\"d.yScale(0) + 3\"\n width=\"40\"\n height=\"12\"\n rx=\"2\"\n ></rect>\n <text\n class=\"tick-label\"\n [attr.x]=\"tick.x\"\n [attr.y]=\"d.yScale(0) + 12\"\n text-anchor=\"middle\"\n >\n {{ tick.label }}\n </text>\n </g>\n <g *ngFor=\"let tick of d.yTicks\">\n <rect\n class=\"tick\"\n x=\"0\"\n [attr.y]=\"d.yScale(tick)\"\n width=\"100%\"\n height=\"1\"\n ></rect>\n <text class=\"tick-label\" x=\"0\" [attr.y]=\"d.yScale(tick)\" dy=\"-4\">\n {{ valueFormatter(tick) }}\n </text>\n </g>\n <g *ngFor=\"let rect of d.rects\">\n <rect\n class=\"column\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n [attr.fill]=\"rect.fill\"\n [class.blurred]=\"\n (hoveredBand$ | async) !== null &&\n (hoveredBand$ | async)?.dateValue !== rect.dateValue\n \"\n ></rect>\n <rect\n *ngIf=\"rect.striped\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n fill=\"url(#stripes)\"\n ></rect>\n </g>\n <rect\n *ngFor=\"let rect of d.hoverBands\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n fill=\"transparent\"\n (mouseenter)=\"\n hoveredBand$.next({ dateValue: rect.dateValue, event: $event })\n \"\n (mouseleave)=\"hoveredBand$.next(null)\"\n ></rect>\n </svg>\n</div>\n\n<ng-container *ngIf=\"callout$ | async; let callout\">\n <riv-callout\n *riv-callout\n [anchor]=\"callout.anchor\"\n [isModal]=\"false\"\n [preferredPosition]=\"'center-right'\"\n [allowedPositions]=\"[\n 'center-right',\n 'center-left',\n 'top-center',\n 'bottom-center'\n ]\"\n >\n <div class=\"callout-content\">\n <div class=\"callout-metric\" *ngFor=\"let metric of callout.metrics\">\n <div>{{ metric.label }}</div>\n <div class=\"callout-metric-value\">{{ metric.value }}</div>\n </div>\n </div>\n </riv-callout>\n</ng-container>\n\n<ng-template #zeroState>\n <riv-zero-state></riv-zero-state>\n</ng-template>\n", styles: [".tick{fill:var(--gray-20)}.tick-label{font-size:var(--type-0-font-size);line-height:var(--type-0-line-height-0);fill:var(--type-light-low-contrast)}.tick-background{transition:fill var(--short-transition);fill:transparent}.tick-background.focused{fill:var(--baloo-10)}.column{transition:opacity var(--short-transition)}.column.blurred{opacity:.4}.callout-content{padding:var(--size-large);display:grid;gap:var(--size-medium);grid-template-columns:1fr 1fr}.callout-metric{display:flex;flex-direction:column;gap:var(--size-xsmall);font-size:var(--type-1-font-size);line-height:var(--type-1-line-height-0)}.callout-metric-value{font-weight:var(--font-weight-heavy)}\n"] }]
1000
+ }], propDecorators: { input: [{
1001
+ type: Input
1002
+ }], width: [{
1003
+ type: Input
1004
+ }], height: [{
1005
+ type: Input
1006
+ }], valueFormatter: [{
1007
+ type: Input
1008
+ }] } });
1009
+
700
1010
  var Interval;
701
1011
  (function (Interval) {
702
1012
  Interval["DAY"] = "day";
@@ -716,7 +1026,7 @@ function getTimeInterval(interval) {
716
1026
  return timeYear;
717
1027
  }
718
1028
  }
719
- function getDateRange$1(configs) {
1029
+ function getDateRange(configs) {
720
1030
  let min = Infinity;
721
1031
  let max = -Infinity;
722
1032
  for (const config of configs) {
@@ -780,7 +1090,7 @@ class TimeSeriesComponent {
780
1090
  this.BOTTOM_PADDING = 8;
781
1091
  this.Y_TICK_COUNT = 5;
782
1092
  this.X_MINOR_TICK_LIMIT = 15;
783
- this.dateRange$ = this.input$.pipe(map(getDateRange$1), shareReplay({ refCount: true, bufferSize: 1 }));
1093
+ this.dateRange$ = this.input$.pipe(map(getDateRange), shareReplay({ refCount: true, bufferSize: 1 }));
784
1094
  this.binInterval$ = this.dateRange$.pipe(map(([minDate, maxDate]) => {
785
1095
  const diff = timeDay.count(new Date(minDate), new Date(maxDate));
786
1096
  if (diff >= 365 * 3) {
@@ -814,7 +1124,7 @@ class TimeSeriesComponent {
814
1124
  })) });
815
1125
  }) });
816
1126
  })), shareReplay({ refCount: true, bufferSize: 1 }));
817
- this.binnedDateRange$ = this.binnedData$.pipe(map(getDateRange$1), shareReplay({ refCount: true, bufferSize: 1 }));
1127
+ this.binnedDateRange$ = this.binnedData$.pipe(map(getDateRange), shareReplay({ refCount: true, bufferSize: 1 }));
818
1128
  this.drawData$ = combineLatest([
819
1129
  this.binnedData$,
820
1130
  this.binnedDateRange$,
@@ -963,235 +1273,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
963
1273
  type: Input
964
1274
  }] } });
965
1275
 
966
- class DataTableComponent {
967
- }
968
- DataTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
969
- DataTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DataTableComponent, selector: "riv-data-table", ngImport: i0, template: '<table><ng-content></ng-content></table>', isInline: true, styles: [":host{display:block;overflow-x:scroll}table{table-layout:fixed;min-width:100%;border-collapse:collapse}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
970
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableComponent, decorators: [{
971
- type: Component,
972
- args: [{ selector: 'riv-data-table', template: '<table><ng-content></ng-content></table>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;overflow-x:scroll}table{table-layout:fixed;min-width:100%;border-collapse:collapse}\n"] }]
973
- }] });
974
-
975
- class DataTableRowComponent {
976
- constructor() {
977
- this.subRow = false;
978
- }
979
- }
980
- DataTableRowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
981
- DataTableRowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DataTableRowComponent, selector: "[riv-data-table-row]", inputs: { subRow: "subRow" }, host: { properties: { "class.sub-row": "this.subRow" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host:not(.sub-row){border-top:var(--border-width) solid var(--border-light)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
982
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableRowComponent, decorators: [{
983
- type: Component,
984
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: '[riv-data-table-row]', template: '<ng-content></ng-content>', styles: [":host:not(.sub-row){border-top:var(--border-width) solid var(--border-light)}\n"] }]
985
- }], propDecorators: { subRow: [{
986
- type: Input
987
- }, {
988
- type: HostBinding,
989
- args: ['class.sub-row']
990
- }] } });
991
-
992
- class DataTableCellComponent {
993
- constructor(row) {
994
- this.row = row;
995
- this.subCell = false;
996
- }
997
- ngOnInit() {
998
- this.subCell = this.row.subRow;
999
- }
1000
- }
1001
- DataTableCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableCellComponent, deps: [{ token: DataTableRowComponent }], target: i0.ɵɵFactoryTarget.Component });
1002
- DataTableCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DataTableCellComponent, selector: "[riv-data-table-cell]", host: { properties: { "class.sub-cell": "this.subCell" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{padding:var(--size-large) 0;text-align:right}:host.sub-cell{padding-top:0;padding-left:var(--size-xlarge)}:host:first-child{position:sticky;left:0;z-index:1;background-color:var(--surface-light-0);text-align:left}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1003
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableCellComponent, decorators: [{
1004
- type: Component,
1005
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: '[riv-data-table-cell]', template: '<ng-content></ng-content>', styles: [":host{padding:var(--size-large) 0;text-align:right}:host.sub-cell{padding-top:0;padding-left:var(--size-xlarge)}:host:first-child{position:sticky;left:0;z-index:1;background-color:var(--surface-light-0);text-align:left}\n"] }]
1006
- }], ctorParameters: function () { return [{ type: DataTableRowComponent }]; }, propDecorators: { subCell: [{
1007
- type: HostBinding,
1008
- args: ['class.sub-cell']
1009
- }] } });
1010
-
1011
- class DataTableHeaderCellComponent {
1012
- }
1013
- DataTableHeaderCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableHeaderCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1014
- DataTableHeaderCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: DataTableHeaderCellComponent, selector: "[riv-data-table-header-cell]", ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{padding:var(--size-large) 0;font-weight:var(--font-weight-heavy);text-align:right}:host:first-child{position:sticky;left:0;z-index:1;background-color:var(--surface-light-0);text-align:left}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1015
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DataTableHeaderCellComponent, decorators: [{
1016
- type: Component,
1017
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: '[riv-data-table-header-cell]', template: '<ng-content></ng-content>', styles: [":host{padding:var(--size-large) 0;font-weight:var(--font-weight-heavy);text-align:right}:host:first-child{position:sticky;left:0;z-index:1;background-color:var(--surface-light-0);text-align:left}\n"] }]
1018
- }] });
1019
-
1020
- function getDateRange(stacks) {
1021
- let min = Infinity;
1022
- let max = -Infinity;
1023
- for (const stack of stacks) {
1024
- for (const series of stack) {
1025
- for (const { date } of series.data) {
1026
- const value = date.valueOf();
1027
- min = Math.min(min, value);
1028
- max = Math.max(max, value);
1029
- }
1030
- }
1031
- }
1032
- return [new Date(min), new Date(max)];
1033
- }
1034
- // TODO: once we upgrade to Angular 16, this component can be cleaned up with
1035
- // signals instead of RxJS.
1036
- class StackedColumnComponent {
1037
- constructor() {
1038
- this.input$ = new BehaviorSubject([]);
1039
- this.width$ = new BehaviorSubject(960);
1040
- this.height$ = new BehaviorSubject(256);
1041
- this.valueFormatter = v => v.toString();
1042
- this.drawData$ = combineLatest([
1043
- this.input$,
1044
- this.width$,
1045
- this.height$,
1046
- ]).pipe(map(([input, width, height]) => {
1047
- const viewBox = `0 0 ${width} ${height}`;
1048
- const padding = 8;
1049
- const [minDate, maxDate] = getDateRange(input);
1050
- const xSteps = timeMonth.range(timeMonth.floor(minDate), timeMonth.floor(timeMonth.offset(maxDate, 1)));
1051
- const xFormatter = timeFormat('%b');
1052
- const xOuterScale = scaleBand()
1053
- .domain(xSteps.map(date => xFormatter(date)))
1054
- .range([0, width]);
1055
- const columnWidth = 6;
1056
- const columnPadding = 4;
1057
- const outerPadding = (xOuterScale.bandwidth() -
1058
- (columnPadding * (input.length - 1) + columnWidth * input.length)) /
1059
- 2;
1060
- const renderInformation = input.map(stackData => {
1061
- const stackedTable = stackData.reduce((table, s) => [
1062
- ...table,
1063
- ...s.data.map(point => (Object.assign(Object.assign({}, point), { series: s }))),
1064
- ], []);
1065
- const indexedTable = index(stackedTable, d => d.date, d => d.series.label);
1066
- const stacked = stack()
1067
- .keys(stackData.map(v => v.label))
1068
- .value(([_, group], key) => {
1069
- return group.get(key).value;
1070
- })(indexedTable);
1071
- return { indexedTable, stacked };
1072
- });
1073
- let domainMax = 0;
1074
- renderInformation.forEach(({ stacked, indexedTable }) => {
1075
- [...indexedTable.values()].forEach((pointMap, i) => {
1076
- [...pointMap.values()].forEach((_, j) => {
1077
- domainMax = Math.max(domainMax, ...stacked[j][i]);
1078
- });
1079
- });
1080
- });
1081
- const yScale = scaleLinear()
1082
- .domain([0, domainMax])
1083
- .range([height - padding * 2, padding]);
1084
- const rects = [];
1085
- renderInformation.forEach(({ stacked, indexedTable }, index) => {
1086
- [...indexedTable.entries()].forEach(([date, pointMap], i) => {
1087
- [...pointMap.entries()].forEach(([_, seriesPoint], j) => {
1088
- var _a;
1089
- const [baseline, topline] = stacked[j][i];
1090
- const width = columnWidth;
1091
- const height = yScale(baseline) - yScale(topline);
1092
- const x = ((_a = xOuterScale(xFormatter(date))) !== null && _a !== void 0 ? _a : 0) +
1093
- outerPadding +
1094
- columnWidth * index +
1095
- columnPadding * index;
1096
- const y = yScale(baseline) - height;
1097
- const fill = `var(${seriesPoint.series.colorToken})`;
1098
- rects.push({
1099
- dateValue: date.valueOf(),
1100
- x,
1101
- y,
1102
- width,
1103
- height,
1104
- fill,
1105
- striped: seriesPoint.series.style === 'striped',
1106
- seriesPoint,
1107
- });
1108
- });
1109
- });
1110
- });
1111
- const xTicks = xSteps.map(date => {
1112
- var _a;
1113
- return ({
1114
- dateValue: date.valueOf(),
1115
- label: xFormatter(date),
1116
- x: ((_a = xOuterScale(xFormatter(date))) !== null && _a !== void 0 ? _a : 0) + xOuterScale.bandwidth() / 2,
1117
- });
1118
- });
1119
- const yTicks = yScale.ticks(5);
1120
- const hoverBandWidth = renderInformation.length * columnWidth +
1121
- (renderInformation.length + 1) * columnPadding;
1122
- const hoverBands = xSteps.map(date => {
1123
- var _a;
1124
- return ({
1125
- dateValue: date.valueOf(),
1126
- x: ((_a = xOuterScale(xFormatter(date))) !== null && _a !== void 0 ? _a : 0) +
1127
- (xOuterScale.bandwidth() - hoverBandWidth) / 2,
1128
- y: yScale(domainMax),
1129
- width: hoverBandWidth,
1130
- height: yScale(0) - yScale(domainMax),
1131
- });
1132
- });
1133
- return {
1134
- columnWidth,
1135
- hoverBands,
1136
- rects,
1137
- viewBox,
1138
- xTicks,
1139
- yScale,
1140
- yTicks,
1141
- };
1142
- }), shareReplay({ refCount: true, bufferSize: 1 }));
1143
- this.empty$ = this.input$.pipe(map(input => input.every(stack => stack.every(series => series.data.length === 0))), shareReplay({ refCount: true, bufferSize: 1 }));
1144
- this.hoveredBand$ = new BehaviorSubject(null);
1145
- this.callout$ = combineLatest([this.hoveredBand$, this.drawData$]).pipe(map(([hoveredBand, drawData]) => {
1146
- if (!hoveredBand)
1147
- return null;
1148
- const { target } = hoveredBand.event;
1149
- if (!target)
1150
- return null;
1151
- const anchor = target.getBoundingClientRect();
1152
- const metrics = drawData.rects
1153
- .filter(rect => rect.dateValue === hoveredBand.dateValue)
1154
- .map(rect => ({
1155
- label: rect.seriesPoint.series.label,
1156
- value: this.valueFormatter(rect.seriesPoint.value),
1157
- }));
1158
- return { anchor, metrics };
1159
- }), shareReplay({ refCount: true, bufferSize: 1 }));
1160
- }
1161
- set input(v) {
1162
- this.input$.next(v);
1163
- }
1164
- get input() {
1165
- return this.input$.getValue();
1166
- }
1167
- set width(v) {
1168
- this.width$.next(v);
1169
- }
1170
- get width() {
1171
- return this.width$.getValue();
1172
- }
1173
- set height(v) {
1174
- this.height$.next(v);
1175
- }
1176
- get height() {
1177
- return this.height$.getValue();
1178
- }
1179
- }
1180
- StackedColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: StackedColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1181
- StackedColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: StackedColumnComponent, selector: "riv-stacked-column", inputs: { input: "input", width: "width", height: "height", valueFormatter: "valueFormatter" }, ngImport: i0, template: "<div *ngIf=\"!(empty$ | async); else zeroState\" class=\"container\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n *ngIf=\"drawData$ | async; let d\"\n [attr.viewBox]=\"d.viewBox\"\n >\n <defs>\n <pattern\n id=\"stripes\"\n x=\"0\"\n y=\"0\"\n [attr.width]=\"d.columnWidth\"\n [attr.height]=\"d.columnWidth\"\n patternUnits=\"userSpaceOnUse\"\n >\n <line\n x1=\"0\"\n [attr.y1]=\"d.columnWidth\"\n [attr.x2]=\"d.columnWidth\"\n y2=\"0\"\n stroke=\"var(--white-100)\"\n stroke-width=\"1\"\n ></line>\n </pattern>\n </defs>\n <g *ngFor=\"let tick of d.xTicks\">\n <rect\n class=\"tick-background\"\n [class.focused]=\"(hoveredBand$ | async)?.dateValue === tick.dateValue\"\n [attr.x]=\"tick.x - 20\"\n [attr.y]=\"d.yScale(0) + 3\"\n width=\"40\"\n height=\"12\"\n rx=\"2\"\n ></rect>\n <text\n class=\"tick-label\"\n [attr.x]=\"tick.x\"\n [attr.y]=\"d.yScale(0) + 12\"\n text-anchor=\"middle\"\n >\n {{ tick.label }}\n </text>\n </g>\n <g *ngFor=\"let tick of d.yTicks\">\n <rect\n class=\"tick\"\n x=\"0\"\n [attr.y]=\"d.yScale(tick)\"\n width=\"100%\"\n height=\"1\"\n ></rect>\n <text class=\"tick-label\" x=\"0\" [attr.y]=\"d.yScale(tick)\" dy=\"-4\">\n {{ valueFormatter(tick) }}\n </text>\n </g>\n <g *ngFor=\"let rect of d.rects\">\n <rect\n class=\"column\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n [attr.fill]=\"rect.fill\"\n [class.blurred]=\"\n (hoveredBand$ | async) !== null &&\n (hoveredBand$ | async)?.dateValue !== rect.dateValue\n \"\n ></rect>\n <rect\n *ngIf=\"rect.striped\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n fill=\"url(#stripes)\"\n ></rect>\n </g>\n <rect\n *ngFor=\"let rect of d.hoverBands\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n fill=\"transparent\"\n (mouseenter)=\"\n hoveredBand$.next({ dateValue: rect.dateValue, event: $event })\n \"\n (mouseleave)=\"hoveredBand$.next(null)\"\n ></rect>\n </svg>\n</div>\n\n<ng-container *ngIf=\"callout$ | async; let callout\">\n <riv-callout\n *riv-callout\n [anchor]=\"callout.anchor\"\n [isModal]=\"false\"\n [preferredPosition]=\"'center-right'\"\n [allowedPositions]=\"[\n 'center-right',\n 'center-left',\n 'top-center',\n 'bottom-center'\n ]\"\n >\n <div class=\"callout-content\">\n <div class=\"callout-metric\" *ngFor=\"let metric of callout.metrics\">\n <div>{{ metric.label }}</div>\n <div class=\"callout-metric-value\">{{ metric.value }}</div>\n </div>\n </div>\n </riv-callout>\n</ng-container>\n\n<ng-template #zeroState>\n <riv-zero-state></riv-zero-state>\n</ng-template>\n", styles: [".tick{fill:var(--gray-20)}.tick-label{font-size:var(--type-0-font-size);line-height:var(--type-0-line-height-0);fill:var(--type-light-low-contrast)}.tick-background{transition:fill var(--short-transition);fill:transparent}.tick-background.focused{fill:var(--baloo-10)}.column{transition:opacity var(--short-transition)}.column.blurred{opacity:.4}.callout-content{padding:var(--size-large);display:grid;gap:var(--size-medium);grid-template-columns:1fr 1fr}.callout-metric{display:flex;flex-direction:column;gap:var(--size-xsmall);font-size:var(--type-1-font-size);line-height:var(--type-1-line-height-0)}.callout-metric-value{font-weight:var(--font-weight-heavy)}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CalloutComponent, selector: "riv-callout", inputs: ["anchor", "isModal", "preferredPosition", "allowedPositions", "fallbackDirection", "showCaret", "theme"], outputs: ["close"] }, { kind: "directive", type: CalloutDirective, selector: "[riv-callout]" }, { kind: "component", type: ZeroStateComponent, selector: "riv-zero-state", inputs: ["message"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: StackedColumnComponent, decorators: [{
1183
- type: Component,
1184
- args: [{ selector: 'riv-stacked-column', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"!(empty$ | async); else zeroState\" class=\"container\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n *ngIf=\"drawData$ | async; let d\"\n [attr.viewBox]=\"d.viewBox\"\n >\n <defs>\n <pattern\n id=\"stripes\"\n x=\"0\"\n y=\"0\"\n [attr.width]=\"d.columnWidth\"\n [attr.height]=\"d.columnWidth\"\n patternUnits=\"userSpaceOnUse\"\n >\n <line\n x1=\"0\"\n [attr.y1]=\"d.columnWidth\"\n [attr.x2]=\"d.columnWidth\"\n y2=\"0\"\n stroke=\"var(--white-100)\"\n stroke-width=\"1\"\n ></line>\n </pattern>\n </defs>\n <g *ngFor=\"let tick of d.xTicks\">\n <rect\n class=\"tick-background\"\n [class.focused]=\"(hoveredBand$ | async)?.dateValue === tick.dateValue\"\n [attr.x]=\"tick.x - 20\"\n [attr.y]=\"d.yScale(0) + 3\"\n width=\"40\"\n height=\"12\"\n rx=\"2\"\n ></rect>\n <text\n class=\"tick-label\"\n [attr.x]=\"tick.x\"\n [attr.y]=\"d.yScale(0) + 12\"\n text-anchor=\"middle\"\n >\n {{ tick.label }}\n </text>\n </g>\n <g *ngFor=\"let tick of d.yTicks\">\n <rect\n class=\"tick\"\n x=\"0\"\n [attr.y]=\"d.yScale(tick)\"\n width=\"100%\"\n height=\"1\"\n ></rect>\n <text class=\"tick-label\" x=\"0\" [attr.y]=\"d.yScale(tick)\" dy=\"-4\">\n {{ valueFormatter(tick) }}\n </text>\n </g>\n <g *ngFor=\"let rect of d.rects\">\n <rect\n class=\"column\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n [attr.fill]=\"rect.fill\"\n [class.blurred]=\"\n (hoveredBand$ | async) !== null &&\n (hoveredBand$ | async)?.dateValue !== rect.dateValue\n \"\n ></rect>\n <rect\n *ngIf=\"rect.striped\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n fill=\"url(#stripes)\"\n ></rect>\n </g>\n <rect\n *ngFor=\"let rect of d.hoverBands\"\n [attr.x]=\"rect.x\"\n [attr.y]=\"rect.y\"\n [attr.width]=\"rect.width\"\n [attr.height]=\"rect.height\"\n fill=\"transparent\"\n (mouseenter)=\"\n hoveredBand$.next({ dateValue: rect.dateValue, event: $event })\n \"\n (mouseleave)=\"hoveredBand$.next(null)\"\n ></rect>\n </svg>\n</div>\n\n<ng-container *ngIf=\"callout$ | async; let callout\">\n <riv-callout\n *riv-callout\n [anchor]=\"callout.anchor\"\n [isModal]=\"false\"\n [preferredPosition]=\"'center-right'\"\n [allowedPositions]=\"[\n 'center-right',\n 'center-left',\n 'top-center',\n 'bottom-center'\n ]\"\n >\n <div class=\"callout-content\">\n <div class=\"callout-metric\" *ngFor=\"let metric of callout.metrics\">\n <div>{{ metric.label }}</div>\n <div class=\"callout-metric-value\">{{ metric.value }}</div>\n </div>\n </div>\n </riv-callout>\n</ng-container>\n\n<ng-template #zeroState>\n <riv-zero-state></riv-zero-state>\n</ng-template>\n", styles: [".tick{fill:var(--gray-20)}.tick-label{font-size:var(--type-0-font-size);line-height:var(--type-0-line-height-0);fill:var(--type-light-low-contrast)}.tick-background{transition:fill var(--short-transition);fill:transparent}.tick-background.focused{fill:var(--baloo-10)}.column{transition:opacity var(--short-transition)}.column.blurred{opacity:.4}.callout-content{padding:var(--size-large);display:grid;gap:var(--size-medium);grid-template-columns:1fr 1fr}.callout-metric{display:flex;flex-direction:column;gap:var(--size-xsmall);font-size:var(--type-1-font-size);line-height:var(--type-1-line-height-0)}.callout-metric-value{font-weight:var(--font-weight-heavy)}\n"] }]
1185
- }], propDecorators: { input: [{
1186
- type: Input
1187
- }], width: [{
1188
- type: Input
1189
- }], height: [{
1190
- type: Input
1191
- }], valueFormatter: [{
1192
- type: Input
1193
- }] } });
1194
-
1195
1276
  class RivModule {
1196
1277
  }
1197
1278
  RivModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: RivModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -1202,10 +1283,14 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
1202
1283
  DataTableComponent,
1203
1284
  DataTableHeaderCellComponent,
1204
1285
  DataTableRowComponent,
1286
+ DaysPipe,
1205
1287
  DonutComponent,
1206
1288
  IconComponent,
1207
1289
  LegendItemComponent,
1208
1290
  MetricComponent,
1291
+ NumberPipe,
1292
+ PercentagePipe,
1293
+ SmallCurrencyPipe,
1209
1294
  StackedColumnComponent,
1210
1295
  TextToggleComponent,
1211
1296
  TimeSeriesComponent,
@@ -1216,10 +1301,14 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
1216
1301
  DataTableComponent,
1217
1302
  DataTableHeaderCellComponent,
1218
1303
  DataTableRowComponent,
1304
+ DaysPipe,
1219
1305
  DonutComponent,
1220
1306
  IconComponent,
1221
1307
  LegendItemComponent,
1222
1308
  MetricComponent,
1309
+ NumberPipe,
1310
+ PercentagePipe,
1311
+ SmallCurrencyPipe,
1223
1312
  StackedColumnComponent,
1224
1313
  TextToggleComponent,
1225
1314
  TimeSeriesComponent,
@@ -1236,10 +1325,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1236
1325
  DataTableComponent,
1237
1326
  DataTableHeaderCellComponent,
1238
1327
  DataTableRowComponent,
1328
+ DaysPipe,
1239
1329
  DonutComponent,
1240
1330
  IconComponent,
1241
1331
  LegendItemComponent,
1242
1332
  MetricComponent,
1333
+ NumberPipe,
1334
+ PercentagePipe,
1335
+ SmallCurrencyPipe,
1243
1336
  StackedColumnComponent,
1244
1337
  TextToggleComponent,
1245
1338
  TimeSeriesComponent,
@@ -1253,10 +1346,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1253
1346
  DataTableComponent,
1254
1347
  DataTableHeaderCellComponent,
1255
1348
  DataTableRowComponent,
1349
+ DaysPipe,
1256
1350
  DonutComponent,
1257
1351
  IconComponent,
1258
1352
  LegendItemComponent,
1259
1353
  MetricComponent,
1354
+ NumberPipe,
1355
+ PercentagePipe,
1356
+ SmallCurrencyPipe,
1260
1357
  StackedColumnComponent,
1261
1358
  TextToggleComponent,
1262
1359
  TimeSeriesComponent,
@@ -1270,5 +1367,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
1270
1367
  * Generated bundle index. Do not edit.
1271
1368
  */
1272
1369
 
1273
- export { CalloutComponent, CalloutDirective, CalloutOutletComponent, DataTableCellComponent, DataTableComponent, DataTableHeaderCellComponent, DataTableRowComponent, DonutComponent, IconComponent, LegendItemComponent, MetricComponent, RivModule, StackedColumnComponent, TextToggleComponent, TimeSeriesComponent, ZeroStateComponent };
1370
+ export { CalloutComponent, CalloutDirective, CalloutOutletComponent, DataTableCellComponent, DataTableComponent, DataTableHeaderCellComponent, DataTableRowComponent, DaysPipe, DonutComponent, IconComponent, LegendItemComponent, MetricComponent, NumberPipe, PercentagePipe, RivModule, SmallCurrencyPipe, StackedColumnComponent, TextToggleComponent, TimeSeriesComponent, ZeroStateComponent };
1274
1371
  //# sourceMappingURL=rivet-health-design-system.mjs.map