@tectra-ng/charts 0.1.9 → 0.2.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 (122) hide show
  1. package/README.md +21 -1
  2. package/bar-list/README.md +30 -0
  3. package/boxplot/README.md +62 -0
  4. package/bullet/README.md +53 -0
  5. package/candlestick/README.md +57 -0
  6. package/column/README.md +4 -2
  7. package/combo/README.md +83 -0
  8. package/core/README.md +3 -1
  9. package/fesm2022/tectra-ng-charts-bar-list.mjs +299 -0
  10. package/fesm2022/tectra-ng-charts-bar-list.mjs.map +1 -0
  11. package/fesm2022/tectra-ng-charts-boxplot.mjs +887 -0
  12. package/fesm2022/tectra-ng-charts-boxplot.mjs.map +1 -0
  13. package/fesm2022/tectra-ng-charts-bullet.mjs +666 -0
  14. package/fesm2022/tectra-ng-charts-bullet.mjs.map +1 -0
  15. package/fesm2022/tectra-ng-charts-candlestick.mjs +778 -0
  16. package/fesm2022/tectra-ng-charts-candlestick.mjs.map +1 -0
  17. package/fesm2022/tectra-ng-charts-column.mjs +149 -66
  18. package/fesm2022/tectra-ng-charts-column.mjs.map +1 -1
  19. package/fesm2022/tectra-ng-charts-combo.mjs +1218 -0
  20. package/fesm2022/tectra-ng-charts-combo.mjs.map +1 -0
  21. package/fesm2022/tectra-ng-charts-core.mjs +1334 -49
  22. package/fesm2022/tectra-ng-charts-core.mjs.map +1 -1
  23. package/fesm2022/tectra-ng-charts-funnel.mjs +694 -0
  24. package/fesm2022/tectra-ng-charts-funnel.mjs.map +1 -0
  25. package/fesm2022/tectra-ng-charts-gantt.mjs +947 -0
  26. package/fesm2022/tectra-ng-charts-gantt.mjs.map +1 -0
  27. package/fesm2022/tectra-ng-charts-gauge.mjs +693 -0
  28. package/fesm2022/tectra-ng-charts-gauge.mjs.map +1 -0
  29. package/fesm2022/tectra-ng-charts-heatmap.mjs +935 -0
  30. package/fesm2022/tectra-ng-charts-heatmap.mjs.map +1 -0
  31. package/fesm2022/tectra-ng-charts-line.mjs +527 -67
  32. package/fesm2022/tectra-ng-charts-line.mjs.map +1 -1
  33. package/fesm2022/tectra-ng-charts-org-chart.mjs +2341 -0
  34. package/fesm2022/tectra-ng-charts-org-chart.mjs.map +1 -0
  35. package/fesm2022/tectra-ng-charts-pie.mjs +47 -86
  36. package/fesm2022/tectra-ng-charts-pie.mjs.map +1 -1
  37. package/fesm2022/tectra-ng-charts-radar.mjs +924 -0
  38. package/fesm2022/tectra-ng-charts-radar.mjs.map +1 -0
  39. package/fesm2022/tectra-ng-charts-radial-bar.mjs +802 -0
  40. package/fesm2022/tectra-ng-charts-radial-bar.mjs.map +1 -0
  41. package/fesm2022/tectra-ng-charts-range-area.mjs +933 -0
  42. package/fesm2022/tectra-ng-charts-range-area.mjs.map +1 -0
  43. package/fesm2022/tectra-ng-charts-rank-line.mjs +660 -0
  44. package/fesm2022/tectra-ng-charts-rank-line.mjs.map +1 -0
  45. package/fesm2022/tectra-ng-charts-sankey.mjs +837 -0
  46. package/fesm2022/tectra-ng-charts-sankey.mjs.map +1 -0
  47. package/fesm2022/tectra-ng-charts-scatter.mjs +1174 -0
  48. package/fesm2022/tectra-ng-charts-scatter.mjs.map +1 -0
  49. package/fesm2022/tectra-ng-charts-segmented-bar.mjs +328 -0
  50. package/fesm2022/tectra-ng-charts-segmented-bar.mjs.map +1 -0
  51. package/fesm2022/tectra-ng-charts-sunburst.mjs +733 -0
  52. package/fesm2022/tectra-ng-charts-sunburst.mjs.map +1 -0
  53. package/fesm2022/tectra-ng-charts-treemap.mjs +674 -0
  54. package/fesm2022/tectra-ng-charts-treemap.mjs.map +1 -0
  55. package/fesm2022/tectra-ng-charts-waterfall.mjs +809 -0
  56. package/fesm2022/tectra-ng-charts-waterfall.mjs.map +1 -0
  57. package/funnel/README.md +53 -0
  58. package/gantt/README.md +53 -0
  59. package/gauge/README.md +41 -0
  60. package/heatmap/README.md +47 -0
  61. package/line/README.md +13 -2
  62. package/org-chart/README.md +57 -0
  63. package/package.json +114 -6
  64. package/pie/README.md +1 -0
  65. package/radar/README.md +64 -0
  66. package/radial-bar/README.md +62 -0
  67. package/range-area/README.md +66 -0
  68. package/rank-line/README.md +51 -0
  69. package/sankey/README.md +52 -0
  70. package/scatter/README.md +71 -0
  71. package/segmented-bar/README.md +35 -0
  72. package/sunburst/README.md +55 -0
  73. package/treemap/README.md +47 -0
  74. package/types/tectra-ng-charts-bar-list.d.ts +724 -0
  75. package/types/tectra-ng-charts-bar-list.d.ts.map +1 -0
  76. package/types/tectra-ng-charts-boxplot.d.ts +882 -0
  77. package/types/tectra-ng-charts-boxplot.d.ts.map +1 -0
  78. package/types/tectra-ng-charts-bullet.d.ts +833 -0
  79. package/types/tectra-ng-charts-bullet.d.ts.map +1 -0
  80. package/types/tectra-ng-charts-candlestick.d.ts +854 -0
  81. package/types/tectra-ng-charts-candlestick.d.ts.map +1 -0
  82. package/types/tectra-ng-charts-column.d.ts +486 -3
  83. package/types/tectra-ng-charts-column.d.ts.map +1 -1
  84. package/types/tectra-ng-charts-combo.d.ts +987 -0
  85. package/types/tectra-ng-charts-combo.d.ts.map +1 -0
  86. package/types/tectra-ng-charts-core.d.ts +266 -5
  87. package/types/tectra-ng-charts-core.d.ts.map +1 -1
  88. package/types/tectra-ng-charts-funnel.d.ts +857 -0
  89. package/types/tectra-ng-charts-funnel.d.ts.map +1 -0
  90. package/types/tectra-ng-charts-gantt.d.ts +884 -0
  91. package/types/tectra-ng-charts-gantt.d.ts.map +1 -0
  92. package/types/tectra-ng-charts-gauge.d.ts +859 -0
  93. package/types/tectra-ng-charts-gauge.d.ts.map +1 -0
  94. package/types/tectra-ng-charts-heatmap.d.ts +914 -0
  95. package/types/tectra-ng-charts-heatmap.d.ts.map +1 -0
  96. package/types/tectra-ng-charts-line.d.ts +556 -2
  97. package/types/tectra-ng-charts-line.d.ts.map +1 -1
  98. package/types/tectra-ng-charts-org-chart.d.ts +1017 -0
  99. package/types/tectra-ng-charts-org-chart.d.ts.map +1 -0
  100. package/types/tectra-ng-charts-pie.d.ts +477 -14
  101. package/types/tectra-ng-charts-pie.d.ts.map +1 -1
  102. package/types/tectra-ng-charts-radar.d.ts +903 -0
  103. package/types/tectra-ng-charts-radar.d.ts.map +1 -0
  104. package/types/tectra-ng-charts-radial-bar.d.ts +886 -0
  105. package/types/tectra-ng-charts-radial-bar.d.ts.map +1 -0
  106. package/types/tectra-ng-charts-range-area.d.ts +897 -0
  107. package/types/tectra-ng-charts-range-area.d.ts.map +1 -0
  108. package/types/tectra-ng-charts-rank-line.d.ts +839 -0
  109. package/types/tectra-ng-charts-rank-line.d.ts.map +1 -0
  110. package/types/tectra-ng-charts-sankey.d.ts +866 -0
  111. package/types/tectra-ng-charts-sankey.d.ts.map +1 -0
  112. package/types/tectra-ng-charts-scatter.d.ts +987 -0
  113. package/types/tectra-ng-charts-scatter.d.ts.map +1 -0
  114. package/types/tectra-ng-charts-segmented-bar.d.ts +751 -0
  115. package/types/tectra-ng-charts-segmented-bar.d.ts.map +1 -0
  116. package/types/tectra-ng-charts-sunburst.d.ts +864 -0
  117. package/types/tectra-ng-charts-sunburst.d.ts.map +1 -0
  118. package/types/tectra-ng-charts-treemap.d.ts +847 -0
  119. package/types/tectra-ng-charts-treemap.d.ts.map +1 -0
  120. package/types/tectra-ng-charts-waterfall.d.ts +869 -0
  121. package/types/tectra-ng-charts-waterfall.d.ts.map +1 -0
  122. package/waterfall/README.md +60 -0
@@ -0,0 +1,299 @@
1
+ import { NgTemplateOutlet } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input } from "@angular/core";
4
+ import { RouterLink } from "@angular/router";
5
+ import { chartNumberFormatter } from "@tectra-ng/charts/core";
6
+ import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
7
+ import { TxLocaleService, injectTranslations } from "@tectra-ng/core/i18n";
8
+ import { optionalBoolean } from "@tectra-ng/core/utils";
9
+ import { toStyleObject } from "@tectra-ng/themes";
10
+ import { TxSkeleton } from "@tectra-ng/ui/skeleton";
11
+ function barListRows(items, limit, format, percentFormat = format) {
12
+ const sorted = (items ?? []).filter((item) => Number.isFinite(item.value) && item.value > 0).sort((a, b) => b.value - a.value);
13
+ const total = sorted.reduce((sum, item) => sum + item.value, 0);
14
+ const max = sorted[0]?.value ?? 0;
15
+ return sorted.slice(0, Math.max(0, limit)).map((item) => ({
16
+ label: item.label,
17
+ raw: item.value,
18
+ value: format(item.value),
19
+ share: max ? item.value / max * 100 : 0,
20
+ percent: `${percentFormat(Math.round(item.value / total * 1e3) / 10)}%`,
21
+ link: item.link,
22
+ queryParams: item.queryParams
23
+ }));
24
+ }
25
+ const SKELETON_ROWS = 5;
26
+ var TxBarList = class TxBarList {
27
+ locale = inject(TxLocaleService);
28
+ translations = injectTranslations();
29
+ items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
30
+ limit = input(10, ...ngDevMode ? [{ debugName: "limit" }] : /* istanbul ignore next */ []);
31
+ valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
32
+ loading = input(false, {
33
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
34
+ transform: booleanAttribute
35
+ });
36
+ ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
37
+ dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
38
+ pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
39
+ ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
40
+ unstyled = input(void 0, {
41
+ ...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
42
+ transform: optionalBoolean
43
+ });
44
+ isUnstyled = injectUnstyled(this.unstyled);
45
+ passThrough = injectPassThrough("barList", this, this.pt, this.ptOptions);
46
+ hostStyle = computed(() => ({
47
+ ...toStyleObject(this.dt(), "--tx-chart"),
48
+ ...this.passThrough().root?.style
49
+ }), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
50
+ intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
51
+ rows = computed(() => barListRows(this.items(), this.limit(), chartNumberFormatter(this.intl(), this.valueFormat()), chartNumberFormatter(this.intl())), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
52
+ skeletonRows = computed(() => Array.from({ length: Math.min(SKELETON_ROWS, Math.max(1, this.limit())) }, (_, index) => index), ...ngDevMode ? [{ debugName: "skeletonRows" }] : /* istanbul ignore next */ []);
53
+ static ɵfac = i0.ɵɵngDeclareFactory({
54
+ minVersion: "12.0.0",
55
+ version: "22.2.3",
56
+ ngImport: i0,
57
+ type: TxBarList,
58
+ deps: [],
59
+ target: i0.ɵɵFactoryTarget.Component
60
+ });
61
+ static ɵcmp = i0.ɵɵngDeclareComponent({
62
+ minVersion: "17.0.0",
63
+ version: "22.2.3",
64
+ type: TxBarList,
65
+ isStandalone: true,
66
+ selector: "tx-bar-list",
67
+ inputs: {
68
+ items: {
69
+ classPropertyName: "items",
70
+ publicName: "items",
71
+ isSignal: true,
72
+ isRequired: false,
73
+ transformFunction: null
74
+ },
75
+ limit: {
76
+ classPropertyName: "limit",
77
+ publicName: "limit",
78
+ isSignal: true,
79
+ isRequired: false,
80
+ transformFunction: null
81
+ },
82
+ valueFormat: {
83
+ classPropertyName: "valueFormat",
84
+ publicName: "valueFormat",
85
+ isSignal: true,
86
+ isRequired: false,
87
+ transformFunction: null
88
+ },
89
+ loading: {
90
+ classPropertyName: "loading",
91
+ publicName: "loading",
92
+ isSignal: true,
93
+ isRequired: false,
94
+ transformFunction: null
95
+ },
96
+ ariaLabel: {
97
+ classPropertyName: "ariaLabel",
98
+ publicName: "ariaLabel",
99
+ isSignal: true,
100
+ isRequired: false,
101
+ transformFunction: null
102
+ },
103
+ dt: {
104
+ classPropertyName: "dt",
105
+ publicName: "dt",
106
+ isSignal: true,
107
+ isRequired: false,
108
+ transformFunction: null
109
+ },
110
+ pt: {
111
+ classPropertyName: "pt",
112
+ publicName: "pt",
113
+ isSignal: true,
114
+ isRequired: false,
115
+ transformFunction: null
116
+ },
117
+ ptOptions: {
118
+ classPropertyName: "ptOptions",
119
+ publicName: "ptOptions",
120
+ isSignal: true,
121
+ isRequired: false,
122
+ transformFunction: null
123
+ },
124
+ unstyled: {
125
+ classPropertyName: "unstyled",
126
+ publicName: "unstyled",
127
+ isSignal: true,
128
+ isRequired: false,
129
+ transformFunction: null
130
+ }
131
+ },
132
+ host: {
133
+ properties: {
134
+ "class": "passThrough().root?.class",
135
+ "style": "hostStyle()",
136
+ "attr.data-styled": "!isUnstyled() || null",
137
+ "attr.aria-busy": "loading() || null"
138
+ },
139
+ classAttribute: "tx-bar-list"
140
+ },
141
+ ngImport: i0,
142
+ template: "@let parts = passThrough();\n@if (loading()) {\n <ul class=\"tx-bar-list__list\" [class]=\"parts.list?.class\" [style]=\"parts.list?.style\" [attr.aria-label]=\"translations().chartLoading\">\n @for (index of skeletonRows(); track index) {\n <li class=\"tx-bar-list__item\" [class]=\"parts.item?.class\" [style]=\"parts.item?.style\">\n <div class=\"tx-bar-list__row\">\n <tx-skeleton class=\"tx-bar-list__skeleton\" [class]=\"parts.skeleton?.class\" [style]=\"parts.skeleton?.style\" height=\"var(--tx-chart-bar-list-row-height)\" />\n </div>\n </li>\n }\n </ul>\n} @else if (rows().length) {\n <ul class=\"tx-bar-list__list\" [class]=\"parts.list?.class\" [style]=\"parts.list?.style\" [attr.aria-label]=\"ariaLabel() || null\">\n @for (row of rows(); track $index) {\n <li class=\"tx-bar-list__item\" [class]=\"parts.item?.class\" [style]=\"parts.item?.style\">\n @if (row.link) {\n <a\n class=\"tx-bar-list__row tx-bar-list__row--link\"\n [class]=\"parts.row?.class\"\n [style]=\"parts.row?.style\"\n [routerLink]=\"row.link\"\n [queryParams]=\"row.queryParams\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </a>\n } @else {\n <div class=\"tx-bar-list__row\" [class]=\"parts.row?.class\" [style]=\"parts.row?.style\">\n <ng-container [ngTemplateOutlet]=\"content\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </div>\n }\n </li>\n }\n </ul>\n} @else {\n <p class=\"tx-bar-list__empty\" [class]=\"parts.empty?.class\" [style]=\"parts.empty?.style\">{{ translations().chartNoData }}</p>\n}\n\n<ng-template #content let-row>\n <span class=\"tx-bar-list__track\" [class]=\"parts.track?.class\" [style]=\"parts.track?.style\">\n <span class=\"tx-bar-list__bar\" [class]=\"parts.bar?.class\" [style]=\"parts.bar?.style\" [style.width.%]=\"row.share\" aria-hidden=\"true\"></span>\n <span class=\"tx-bar-list__label\" [class]=\"parts.label?.class\" [style]=\"parts.label?.style\" [title]=\"row.label\">{{ row.label }}</span>\n </span>\n <span class=\"tx-bar-list__value\" [class]=\"parts.value?.class\" [style]=\"parts.value?.style\">{{ row.value }}</span>\n <span class=\"tx-bar-list__percent\" [class]=\"parts.percent?.class\" [style]=\"parts.percent?.style\">{{ row.percent }}</span>\n</ng-template>\n",
143
+ styles: [":host{display:block;min-width:0}.tx-bar-list__list{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}.tx-bar-list__item{display:block}.tx-bar-list__row{display:flex;align-items:center}.tx-bar-list__track{position:relative;display:flex;flex:1;align-items:center;min-width:0}.tx-bar-list__bar{position:absolute;inset-block:0;inset-inline-start:0}.tx-bar-list__label{position:relative;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tx-bar-list__value,.tx-bar-list__percent{flex-shrink:0}.tx-bar-list__skeleton{flex:1}:host([data-styled]){font-size:var(--tx-chart-bar-list-font-size)}:host([data-styled]) .tx-bar-list__list{gap:var(--tx-chart-bar-list-gap)}:host([data-styled]) .tx-bar-list__row{gap:var(--tx-chart-bar-list-column-gap);min-height:var(--tx-chart-bar-list-row-height);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-bar-list__row--link{margin-inline:calc(var(--tx-chart-bar-list-row-padding-x) * -1);padding-inline:var(--tx-chart-bar-list-row-padding-x);border-radius:var(--tx-chart-bar-list-row-radius);color:inherit;text-decoration:none;outline:none;transition:background-color var(--tx-chart-bar-list-duration) ease}:host([data-styled]) .tx-bar-list__row--link:hover{background:var(--tx-chart-bar-list-row-hover-background)}:host([data-styled]) .tx-bar-list__row--link:focus-visible{box-shadow:0 0 0 var(--tx-chart-focus-ring-width) var(--tx-chart-focus-ring-color)}:host([data-styled]) .tx-bar-list__track{height:var(--tx-chart-bar-list-row-height)}:host([data-styled]) .tx-bar-list__bar{border-radius:var(--tx-chart-bar-list-bar-radius);background:var(--tx-chart-bar-list-bar-background);transition:width var(--tx-chart-bar-list-duration) ease}:host([data-styled]) .tx-bar-list__label{padding-inline:var(--tx-chart-bar-list-label-padding-x);color:var(--tx-chart-bar-list-label-color)}:host([data-styled]) .tx-bar-list__value{color:var(--tx-chart-bar-list-value-color);font-weight:var(--tx-chart-bar-list-value-font-weight)}:host([data-styled]) .tx-bar-list__percent{width:var(--tx-chart-bar-list-percent-width);color:var(--tx-chart-bar-list-percent-color);text-align:end}:host([data-styled]) .tx-bar-list__empty{margin:0;padding-block:var(--tx-chart-bar-list-empty-padding-y);color:var(--tx-chart-bar-list-empty-color);text-align:center}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-bar-list__bar,:host([data-styled]) .tx-bar-list__row--link{transition:none}}\n"],
144
+ dependencies: [
145
+ {
146
+ kind: "directive",
147
+ type: NgTemplateOutlet,
148
+ selector: "[ngTemplateOutlet]",
149
+ inputs: [
150
+ "ngTemplateOutletContext",
151
+ "ngTemplateOutlet",
152
+ "ngTemplateOutletInjector"
153
+ ]
154
+ },
155
+ {
156
+ kind: "directive",
157
+ type: RouterLink,
158
+ selector: "[routerLink]",
159
+ inputs: [
160
+ "target",
161
+ "queryParams",
162
+ "fragment",
163
+ "queryParamsHandling",
164
+ "state",
165
+ "info",
166
+ "relativeTo",
167
+ "preserveFragment",
168
+ "skipLocationChange",
169
+ "replaceUrl",
170
+ "browserUrl",
171
+ "routerLink"
172
+ ]
173
+ },
174
+ {
175
+ kind: "component",
176
+ type: TxSkeleton,
177
+ selector: "tx-skeleton",
178
+ inputs: [
179
+ "shape",
180
+ "size",
181
+ "width",
182
+ "height",
183
+ "borderRadius",
184
+ "lines",
185
+ "animation",
186
+ "dt",
187
+ "pt",
188
+ "ptOptions",
189
+ "unstyled"
190
+ ]
191
+ }
192
+ ],
193
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
194
+ });
195
+ };
196
+ i0.ɵɵngDeclareClassMetadata({
197
+ minVersion: "12.0.0",
198
+ version: "22.2.3",
199
+ ngImport: i0,
200
+ type: TxBarList,
201
+ decorators: [{
202
+ type: Component,
203
+ args: [{
204
+ selector: "tx-bar-list",
205
+ imports: [
206
+ NgTemplateOutlet,
207
+ RouterLink,
208
+ TxSkeleton
209
+ ],
210
+ changeDetection: ChangeDetectionStrategy.OnPush,
211
+ host: {
212
+ class: "tx-bar-list",
213
+ "[class]": "passThrough().root?.class",
214
+ "[style]": "hostStyle()",
215
+ "[attr.data-styled]": "!isUnstyled() || null",
216
+ "[attr.aria-busy]": "loading() || null"
217
+ },
218
+ template: "@let parts = passThrough();\n@if (loading()) {\n <ul class=\"tx-bar-list__list\" [class]=\"parts.list?.class\" [style]=\"parts.list?.style\" [attr.aria-label]=\"translations().chartLoading\">\n @for (index of skeletonRows(); track index) {\n <li class=\"tx-bar-list__item\" [class]=\"parts.item?.class\" [style]=\"parts.item?.style\">\n <div class=\"tx-bar-list__row\">\n <tx-skeleton class=\"tx-bar-list__skeleton\" [class]=\"parts.skeleton?.class\" [style]=\"parts.skeleton?.style\" height=\"var(--tx-chart-bar-list-row-height)\" />\n </div>\n </li>\n }\n </ul>\n} @else if (rows().length) {\n <ul class=\"tx-bar-list__list\" [class]=\"parts.list?.class\" [style]=\"parts.list?.style\" [attr.aria-label]=\"ariaLabel() || null\">\n @for (row of rows(); track $index) {\n <li class=\"tx-bar-list__item\" [class]=\"parts.item?.class\" [style]=\"parts.item?.style\">\n @if (row.link) {\n <a\n class=\"tx-bar-list__row tx-bar-list__row--link\"\n [class]=\"parts.row?.class\"\n [style]=\"parts.row?.style\"\n [routerLink]=\"row.link\"\n [queryParams]=\"row.queryParams\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </a>\n } @else {\n <div class=\"tx-bar-list__row\" [class]=\"parts.row?.class\" [style]=\"parts.row?.style\">\n <ng-container [ngTemplateOutlet]=\"content\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </div>\n }\n </li>\n }\n </ul>\n} @else {\n <p class=\"tx-bar-list__empty\" [class]=\"parts.empty?.class\" [style]=\"parts.empty?.style\">{{ translations().chartNoData }}</p>\n}\n\n<ng-template #content let-row>\n <span class=\"tx-bar-list__track\" [class]=\"parts.track?.class\" [style]=\"parts.track?.style\">\n <span class=\"tx-bar-list__bar\" [class]=\"parts.bar?.class\" [style]=\"parts.bar?.style\" [style.width.%]=\"row.share\" aria-hidden=\"true\"></span>\n <span class=\"tx-bar-list__label\" [class]=\"parts.label?.class\" [style]=\"parts.label?.style\" [title]=\"row.label\">{{ row.label }}</span>\n </span>\n <span class=\"tx-bar-list__value\" [class]=\"parts.value?.class\" [style]=\"parts.value?.style\">{{ row.value }}</span>\n <span class=\"tx-bar-list__percent\" [class]=\"parts.percent?.class\" [style]=\"parts.percent?.style\">{{ row.percent }}</span>\n</ng-template>\n",
219
+ styles: [":host{display:block;min-width:0}.tx-bar-list__list{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}.tx-bar-list__item{display:block}.tx-bar-list__row{display:flex;align-items:center}.tx-bar-list__track{position:relative;display:flex;flex:1;align-items:center;min-width:0}.tx-bar-list__bar{position:absolute;inset-block:0;inset-inline-start:0}.tx-bar-list__label{position:relative;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tx-bar-list__value,.tx-bar-list__percent{flex-shrink:0}.tx-bar-list__skeleton{flex:1}:host([data-styled]){font-size:var(--tx-chart-bar-list-font-size)}:host([data-styled]) .tx-bar-list__list{gap:var(--tx-chart-bar-list-gap)}:host([data-styled]) .tx-bar-list__row{gap:var(--tx-chart-bar-list-column-gap);min-height:var(--tx-chart-bar-list-row-height);font-variant-numeric:tabular-nums}:host([data-styled]) .tx-bar-list__row--link{margin-inline:calc(var(--tx-chart-bar-list-row-padding-x) * -1);padding-inline:var(--tx-chart-bar-list-row-padding-x);border-radius:var(--tx-chart-bar-list-row-radius);color:inherit;text-decoration:none;outline:none;transition:background-color var(--tx-chart-bar-list-duration) ease}:host([data-styled]) .tx-bar-list__row--link:hover{background:var(--tx-chart-bar-list-row-hover-background)}:host([data-styled]) .tx-bar-list__row--link:focus-visible{box-shadow:0 0 0 var(--tx-chart-focus-ring-width) var(--tx-chart-focus-ring-color)}:host([data-styled]) .tx-bar-list__track{height:var(--tx-chart-bar-list-row-height)}:host([data-styled]) .tx-bar-list__bar{border-radius:var(--tx-chart-bar-list-bar-radius);background:var(--tx-chart-bar-list-bar-background);transition:width var(--tx-chart-bar-list-duration) ease}:host([data-styled]) .tx-bar-list__label{padding-inline:var(--tx-chart-bar-list-label-padding-x);color:var(--tx-chart-bar-list-label-color)}:host([data-styled]) .tx-bar-list__value{color:var(--tx-chart-bar-list-value-color);font-weight:var(--tx-chart-bar-list-value-font-weight)}:host([data-styled]) .tx-bar-list__percent{width:var(--tx-chart-bar-list-percent-width);color:var(--tx-chart-bar-list-percent-color);text-align:end}:host([data-styled]) .tx-bar-list__empty{margin:0;padding-block:var(--tx-chart-bar-list-empty-padding-y);color:var(--tx-chart-bar-list-empty-color);text-align:center}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-bar-list__bar,:host([data-styled]) .tx-bar-list__row--link{transition:none}}\n"]
220
+ }]
221
+ }],
222
+ propDecorators: {
223
+ items: [{
224
+ type: i0.Input,
225
+ args: [{
226
+ isSignal: true,
227
+ alias: "items",
228
+ required: false
229
+ }]
230
+ }],
231
+ limit: [{
232
+ type: i0.Input,
233
+ args: [{
234
+ isSignal: true,
235
+ alias: "limit",
236
+ required: false
237
+ }]
238
+ }],
239
+ valueFormat: [{
240
+ type: i0.Input,
241
+ args: [{
242
+ isSignal: true,
243
+ alias: "valueFormat",
244
+ required: false
245
+ }]
246
+ }],
247
+ loading: [{
248
+ type: i0.Input,
249
+ args: [{
250
+ isSignal: true,
251
+ alias: "loading",
252
+ required: false
253
+ }]
254
+ }],
255
+ ariaLabel: [{
256
+ type: i0.Input,
257
+ args: [{
258
+ isSignal: true,
259
+ alias: "ariaLabel",
260
+ required: false
261
+ }]
262
+ }],
263
+ dt: [{
264
+ type: i0.Input,
265
+ args: [{
266
+ isSignal: true,
267
+ alias: "dt",
268
+ required: false
269
+ }]
270
+ }],
271
+ pt: [{
272
+ type: i0.Input,
273
+ args: [{
274
+ isSignal: true,
275
+ alias: "pt",
276
+ required: false
277
+ }]
278
+ }],
279
+ ptOptions: [{
280
+ type: i0.Input,
281
+ args: [{
282
+ isSignal: true,
283
+ alias: "ptOptions",
284
+ required: false
285
+ }]
286
+ }],
287
+ unstyled: [{
288
+ type: i0.Input,
289
+ args: [{
290
+ isSignal: true,
291
+ alias: "unstyled",
292
+ required: false
293
+ }]
294
+ }]
295
+ }
296
+ });
297
+ export { TxBarList, barListRows };
298
+
299
+ //# sourceMappingURL=tectra-ng-charts-bar-list.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tectra-ng-charts-bar-list.mjs","names":[],"sources":["../../../../packages/charts/bar-list/src/bar-list-rows.ts","../../../../packages/charts/bar-list/src/bar-list.component.ts","../../../../packages/charts/bar-list/src/bar-list.component.html"],"sourcesContent":["import { TxChartValueFormatter } from '@tectra-ng/charts/core';\nimport { TxBarListItem, TxBarListRow } from './bar-list.types';\n\nexport function barListRows(\n items: readonly TxBarListItem[] | null | undefined,\n limit: number,\n format: TxChartValueFormatter,\n percentFormat: TxChartValueFormatter = format,\n): TxBarListRow[] {\n const sorted = (items ?? []).filter((item) => Number.isFinite(item.value) && item.value > 0).sort((a, b) => b.value - a.value);\n const total = sorted.reduce((sum, item) => sum + item.value, 0);\n const max = sorted[0]?.value ?? 0;\n return sorted.slice(0, Math.max(0, limit)).map((item) => ({\n label: item.label,\n raw: item.value,\n value: format(item.value),\n share: max ? (item.value / max) * 100 : 0,\n percent: `${percentFormat(Math.round((item.value / total) * 1000) / 10)}%`,\n link: item.link,\n queryParams: item.queryParams,\n }));\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input } from '@angular/core';\nimport { RouterLink } from '@angular/router';\nimport { TxChartValueFormat, chartNumberFormatter } from '@tectra-ng/charts/core';\nimport { TxPassThrough, TxPassThroughOptions, injectPassThrough, injectUnstyled } from '@tectra-ng/core/config';\nimport { TxLocaleService, injectTranslations } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraChartTokens, TectraDeepPartial, toStyleObject } from '@tectra-ng/themes';\nimport { TxSkeleton } from '@tectra-ng/ui/skeleton';\nimport { barListRows } from './bar-list-rows';\nimport { TxBarListItem, TxBarListPart } from './bar-list.types';\n\nconst SKELETON_ROWS = 5;\n\n@Component({\n selector: 'tx-bar-list',\n imports: [NgTemplateOutlet, RouterLink, TxSkeleton],\n templateUrl: './bar-list.component.html',\n styleUrl: './bar-list.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-bar-list',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.aria-busy]': 'loading() || null',\n },\n})\nexport class TxBarList {\n private locale = inject(TxLocaleService);\n readonly translations = injectTranslations();\n\n readonly items = input<readonly TxBarListItem[] | null | undefined>([]);\n readonly limit = input(10);\n readonly valueFormat = input<TxChartValueFormat>('number');\n readonly loading = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly ariaLabel = input('');\n readonly dt = input<TectraDeepPartial<TectraChartTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxBarListPart, TxBarList> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('barList', this, this.pt, this.ptOptions);\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-chart'), ...this.passThrough().root?.style }));\n\n private readonly intl = computed(() => this.locale.locale().intl);\n readonly rows = computed(() =>\n barListRows(this.items(), this.limit(), chartNumberFormatter(this.intl(), this.valueFormat()), chartNumberFormatter(this.intl())),\n );\n readonly skeletonRows = computed(() => Array.from({ length: Math.min(SKELETON_ROWS, Math.max(1, this.limit())) }, (_, index) => index));\n}\n","@let parts = passThrough();\n@if (loading()) {\n <ul class=\"tx-bar-list__list\" [class]=\"parts.list?.class\" [style]=\"parts.list?.style\" [attr.aria-label]=\"translations().chartLoading\">\n @for (index of skeletonRows(); track index) {\n <li class=\"tx-bar-list__item\" [class]=\"parts.item?.class\" [style]=\"parts.item?.style\">\n <div class=\"tx-bar-list__row\">\n <tx-skeleton class=\"tx-bar-list__skeleton\" [class]=\"parts.skeleton?.class\" [style]=\"parts.skeleton?.style\" height=\"var(--tx-chart-bar-list-row-height)\" />\n </div>\n </li>\n }\n </ul>\n} @else if (rows().length) {\n <ul class=\"tx-bar-list__list\" [class]=\"parts.list?.class\" [style]=\"parts.list?.style\" [attr.aria-label]=\"ariaLabel() || null\">\n @for (row of rows(); track $index) {\n <li class=\"tx-bar-list__item\" [class]=\"parts.item?.class\" [style]=\"parts.item?.style\">\n @if (row.link) {\n <a\n class=\"tx-bar-list__row tx-bar-list__row--link\"\n [class]=\"parts.row?.class\"\n [style]=\"parts.row?.style\"\n [routerLink]=\"row.link\"\n [queryParams]=\"row.queryParams\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </a>\n } @else {\n <div class=\"tx-bar-list__row\" [class]=\"parts.row?.class\" [style]=\"parts.row?.style\">\n <ng-container [ngTemplateOutlet]=\"content\" [ngTemplateOutletContext]=\"{ $implicit: row }\" />\n </div>\n }\n </li>\n }\n </ul>\n} @else {\n <p class=\"tx-bar-list__empty\" [class]=\"parts.empty?.class\" [style]=\"parts.empty?.style\">{{ translations().chartNoData }}</p>\n}\n\n<ng-template #content let-row>\n <span class=\"tx-bar-list__track\" [class]=\"parts.track?.class\" [style]=\"parts.track?.style\">\n <span class=\"tx-bar-list__bar\" [class]=\"parts.bar?.class\" [style]=\"parts.bar?.style\" [style.width.%]=\"row.share\" aria-hidden=\"true\"></span>\n <span class=\"tx-bar-list__label\" [class]=\"parts.label?.class\" [style]=\"parts.label?.style\" [title]=\"row.label\">{{ row.label }}</span>\n </span>\n <span class=\"tx-bar-list__value\" [class]=\"parts.value?.class\" [style]=\"parts.value?.style\">{{ row.value }}</span>\n <span class=\"tx-bar-list__percent\" [class]=\"parts.percent?.class\" [style]=\"parts.percent?.style\">{{ row.percent }}</span>\n</ng-template>\n"],"mappings":";;;;;;;;;;AAGA,SAAgB,YACd,OACA,OACA,QACA,gBAAuC,QAAM;CAE7C,MAAM,UAAU,SAAS,CAAA,EAAA,CAAI,QAAQ,SAAS,OAAO,SAAS,KAAK,KAAK,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;CAC7H,MAAM,QAAQ,OAAO,QAAQ,KAAK,SAAS,MAAM,KAAK,OAAO,CAAC;CAC9D,MAAM,MAAM,OAAO,EAAE,EAAE,SAAS;CAChC,OAAO,OAAO,MAAM,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC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