@tectra-ng/ui 0.1.2 → 0.1.4
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.
- package/README.md +36 -19
- package/accordion/README.md +61 -0
- package/analog-clock/README.md +31 -0
- package/breadcrumb/README.md +57 -0
- package/countdown/README.md +45 -0
- package/datepicker/README.md +109 -0
- package/export/README.md +79 -0
- package/export-font/OFL.txt +93 -0
- package/export-font/README.md +7 -0
- package/fesm2022/tectra-ng-ui-accordion.mjs +980 -0
- package/fesm2022/tectra-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-analog-clock.mjs +386 -0
- package/fesm2022/tectra-ng-ui-analog-clock.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-autocomplete.mjs +2 -2
- package/fesm2022/tectra-ng-ui-autocomplete.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-breadcrumb.mjs +382 -0
- package/fesm2022/tectra-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-cascade-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-cascade-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-chips-input.mjs +2 -2
- package/fesm2022/tectra-ng-ui-chips-input.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-color-picker.mjs +2 -2
- package/fesm2022/tectra-ng-ui-color-picker.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-countdown.mjs +513 -0
- package/fesm2022/tectra-ng-ui-countdown.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-datepicker.mjs +2640 -0
- package/fesm2022/tectra-ng-ui-datepicker.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-export-font.mjs +7 -0
- package/fesm2022/tectra-ng-ui-export-font.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-export.mjs +2574 -0
- package/fesm2022/tectra-ng-ui-export.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-field.mjs +1 -1
- package/fesm2022/tectra-ng-ui-field.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-file-upload.mjs +1452 -0
- package/fesm2022/tectra-ng-ui-file-upload.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-group.mjs +2 -2
- package/fesm2022/tectra-ng-ui-input-group.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-input.mjs +2 -2
- package/fesm2022/tectra-ng-ui-input.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-label.mjs +4 -4
- package/fesm2022/tectra-ng-ui-label.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-listbox.mjs +2 -2
- package/fesm2022/tectra-ng-ui-listbox.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-menubar.mjs +742 -0
- package/fesm2022/tectra-ng-ui-menubar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-month-calendar.mjs +601 -0
- package/fesm2022/tectra-ng-ui-month-calendar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-multiselect.mjs +2 -2
- package/fesm2022/tectra-ng-ui-multiselect.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-panel-menu.mjs +610 -0
- package/fesm2022/tectra-ng-ui-panel-menu.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-scroll-panel.mjs +319 -0
- package/fesm2022/tectra-ng-ui-scroll-panel.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-sparkline.mjs +240 -0
- package/fesm2022/tectra-ng-ui-sparkline.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-splitter.mjs +750 -0
- package/fesm2022/tectra-ng-ui-splitter.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-stat-tiles.mjs +661 -0
- package/fesm2022/tectra-ng-ui-stat-tiles.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-stepper.mjs +1166 -0
- package/fesm2022/tectra-ng-ui-stepper.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-table.mjs +195 -71
- package/fesm2022/tectra-ng-ui-table.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tabs.mjs +1218 -0
- package/fesm2022/tectra-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-textarea.mjs +4 -1
- package/fesm2022/tectra-ng-ui-textarea.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-timeline.mjs +407 -0
- package/fesm2022/tectra-ng-ui-timeline.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toolbar.mjs +348 -0
- package/fesm2022/tectra-ng-ui-toolbar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tree-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-tree-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tree-table.mjs +80 -2
- package/fesm2022/tectra-ng-ui-tree-table.mjs.map +1 -1
- package/field/README.md +1 -1
- package/file-upload/README.md +85 -0
- package/menubar/README.md +51 -0
- package/month-calendar/README.md +46 -0
- package/package.json +80 -4
- package/panel-menu/README.md +45 -0
- package/scroll-panel/README.md +35 -0
- package/sparkline/README.md +27 -0
- package/splitter/README.md +62 -0
- package/stat-tiles/README.md +53 -0
- package/stepper/README.md +66 -0
- package/table/README.md +1 -1
- package/tabs/README.md +69 -0
- package/timeline/README.md +42 -0
- package/toolbar/README.md +35 -0
- package/types/tectra-ng-ui-accordion.d.ts +304 -0
- package/types/tectra-ng-ui-accordion.d.ts.map +1 -0
- package/types/tectra-ng-ui-analog-clock.d.ts +127 -0
- package/types/tectra-ng-ui-analog-clock.d.ts.map +1 -0
- package/types/tectra-ng-ui-breadcrumb.d.ts +157 -0
- package/types/tectra-ng-ui-breadcrumb.d.ts.map +1 -0
- package/types/tectra-ng-ui-countdown.d.ts +150 -0
- package/types/tectra-ng-ui-countdown.d.ts.map +1 -0
- package/types/tectra-ng-ui-datepicker.d.ts +801 -0
- package/types/tectra-ng-ui-datepicker.d.ts.map +1 -0
- package/types/tectra-ng-ui-export-font.d.ts +5 -0
- package/types/tectra-ng-ui-export-font.d.ts.map +1 -0
- package/types/tectra-ng-ui-export.d.ts +427 -0
- package/types/tectra-ng-ui-export.d.ts.map +1 -0
- package/types/tectra-ng-ui-file-upload.d.ts +527 -0
- package/types/tectra-ng-ui-file-upload.d.ts.map +1 -0
- package/types/tectra-ng-ui-menubar.d.ts +201 -0
- package/types/tectra-ng-ui-menubar.d.ts.map +1 -0
- package/types/tectra-ng-ui-month-calendar.d.ts +287 -0
- package/types/tectra-ng-ui-month-calendar.d.ts.map +1 -0
- package/types/tectra-ng-ui-panel-menu.d.ts +244 -0
- package/types/tectra-ng-ui-panel-menu.d.ts.map +1 -0
- package/types/tectra-ng-ui-scroll-panel.d.ts +94 -0
- package/types/tectra-ng-ui-scroll-panel.d.ts.map +1 -0
- package/types/tectra-ng-ui-sparkline.d.ts +80 -0
- package/types/tectra-ng-ui-sparkline.d.ts.map +1 -0
- package/types/tectra-ng-ui-splitter.d.ts +226 -0
- package/types/tectra-ng-ui-splitter.d.ts.map +1 -0
- package/types/tectra-ng-ui-stat-tiles.d.ts +287 -0
- package/types/tectra-ng-ui-stat-tiles.d.ts.map +1 -0
- package/types/tectra-ng-ui-stepper.d.ts +446 -0
- package/types/tectra-ng-ui-stepper.d.ts.map +1 -0
- package/types/tectra-ng-ui-table.d.ts +2 -4
- package/types/tectra-ng-ui-table.d.ts.map +1 -1
- package/types/tectra-ng-ui-tabs.d.ts +420 -0
- package/types/tectra-ng-ui-tabs.d.ts.map +1 -0
- package/types/tectra-ng-ui-textarea.d.ts +1 -0
- package/types/tectra-ng-ui-textarea.d.ts.map +1 -1
- package/types/tectra-ng-ui-timeline.d.ts +129 -0
- package/types/tectra-ng-ui-timeline.d.ts.map +1 -0
- package/types/tectra-ng-ui-toolbar.d.ts +85 -0
- package/types/tectra-ng-ui-toolbar.d.ts.map +1 -0
- package/types/tectra-ng-ui-tree-table.d.ts.map +1 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from "@angular/core";
|
|
3
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
4
|
+
import { optionalBoolean } from "@tectra-ng/core/utils";
|
|
5
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
6
|
+
const WIDTH = 120;
|
|
7
|
+
const HEIGHT = 36;
|
|
8
|
+
function sparklinePoints(values) {
|
|
9
|
+
const numbers = values.filter((value) => Number.isFinite(value));
|
|
10
|
+
if (numbers.length < 2) return [];
|
|
11
|
+
const min = Math.min(...numbers);
|
|
12
|
+
const range = Math.max(...numbers) - min || 1;
|
|
13
|
+
const step = WIDTH / (numbers.length - 1);
|
|
14
|
+
const usable = 30;
|
|
15
|
+
return numbers.map((value, index) => ({
|
|
16
|
+
x: index * step,
|
|
17
|
+
y: 33 - (value - min) / range * usable
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
var TxSparkline = class TxSparkline {
|
|
21
|
+
values = input([], ...ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []);
|
|
22
|
+
tone = input("primary", ...ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []);
|
|
23
|
+
ariaLabel = input(void 0, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
24
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
25
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
26
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
27
|
+
unstyled = input(void 0, {
|
|
28
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
29
|
+
transform: optionalBoolean
|
|
30
|
+
});
|
|
31
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
32
|
+
passThrough = injectPassThrough("sparkline", this, this.pt, this.ptOptions);
|
|
33
|
+
hostStyle = computed(() => ({
|
|
34
|
+
...toStyleObject(this.dt(), "--tx-sparkline"),
|
|
35
|
+
...this.passThrough().root?.style
|
|
36
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
37
|
+
viewBox = `0 0 ${WIDTH} ${HEIGHT}`;
|
|
38
|
+
points = computed(() => sparklinePoints(this.values() ?? []), ...ngDevMode ? [{ debugName: "points" }] : /* istanbul ignore next */ []);
|
|
39
|
+
line = computed(() => this.points().map((point, index) => `${index ? "L" : "M"}${point.x},${point.y}`).join(" "), ...ngDevMode ? [{ debugName: "line" }] : /* istanbul ignore next */ []);
|
|
40
|
+
area = computed(() => this.line() ? `${this.line()} L${WIDTH},${HEIGHT} L0,${HEIGHT} Z` : "", ...ngDevMode ? [{ debugName: "area" }] : /* istanbul ignore next */ []);
|
|
41
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
42
|
+
minVersion: "12.0.0",
|
|
43
|
+
version: "22.2.3",
|
|
44
|
+
ngImport: i0,
|
|
45
|
+
type: TxSparkline,
|
|
46
|
+
deps: [],
|
|
47
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
48
|
+
});
|
|
49
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
50
|
+
minVersion: "17.0.0",
|
|
51
|
+
version: "22.2.3",
|
|
52
|
+
type: TxSparkline,
|
|
53
|
+
isStandalone: true,
|
|
54
|
+
selector: "tx-sparkline",
|
|
55
|
+
inputs: {
|
|
56
|
+
values: {
|
|
57
|
+
classPropertyName: "values",
|
|
58
|
+
publicName: "values",
|
|
59
|
+
isSignal: true,
|
|
60
|
+
isRequired: false,
|
|
61
|
+
transformFunction: null
|
|
62
|
+
},
|
|
63
|
+
tone: {
|
|
64
|
+
classPropertyName: "tone",
|
|
65
|
+
publicName: "tone",
|
|
66
|
+
isSignal: true,
|
|
67
|
+
isRequired: false,
|
|
68
|
+
transformFunction: null
|
|
69
|
+
},
|
|
70
|
+
ariaLabel: {
|
|
71
|
+
classPropertyName: "ariaLabel",
|
|
72
|
+
publicName: "ariaLabel",
|
|
73
|
+
isSignal: true,
|
|
74
|
+
isRequired: false,
|
|
75
|
+
transformFunction: null
|
|
76
|
+
},
|
|
77
|
+
dt: {
|
|
78
|
+
classPropertyName: "dt",
|
|
79
|
+
publicName: "dt",
|
|
80
|
+
isSignal: true,
|
|
81
|
+
isRequired: false,
|
|
82
|
+
transformFunction: null
|
|
83
|
+
},
|
|
84
|
+
pt: {
|
|
85
|
+
classPropertyName: "pt",
|
|
86
|
+
publicName: "pt",
|
|
87
|
+
isSignal: true,
|
|
88
|
+
isRequired: false,
|
|
89
|
+
transformFunction: null
|
|
90
|
+
},
|
|
91
|
+
ptOptions: {
|
|
92
|
+
classPropertyName: "ptOptions",
|
|
93
|
+
publicName: "ptOptions",
|
|
94
|
+
isSignal: true,
|
|
95
|
+
isRequired: false,
|
|
96
|
+
transformFunction: null
|
|
97
|
+
},
|
|
98
|
+
unstyled: {
|
|
99
|
+
classPropertyName: "unstyled",
|
|
100
|
+
publicName: "unstyled",
|
|
101
|
+
isSignal: true,
|
|
102
|
+
isRequired: false,
|
|
103
|
+
transformFunction: null
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
host: {
|
|
107
|
+
properties: {
|
|
108
|
+
"class": "passThrough().root?.class",
|
|
109
|
+
"style": "hostStyle()",
|
|
110
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
111
|
+
"attr.data-tone": "tone()",
|
|
112
|
+
"attr.role": "ariaLabel() ? \"img\" : null",
|
|
113
|
+
"attr.aria-label": "ariaLabel() || null",
|
|
114
|
+
"attr.aria-hidden": "ariaLabel() ? null : \"true\""
|
|
115
|
+
},
|
|
116
|
+
classAttribute: "tx-sparkline"
|
|
117
|
+
},
|
|
118
|
+
ngImport: i0,
|
|
119
|
+
template: `
|
|
120
|
+
@if (line(); as path) {
|
|
121
|
+
<svg
|
|
122
|
+
class="tx-sparkline__svg"
|
|
123
|
+
preserveAspectRatio="none"
|
|
124
|
+
focusable="false"
|
|
125
|
+
aria-hidden="true"
|
|
126
|
+
[attr.viewBox]="viewBox"
|
|
127
|
+
[class]="passThrough().svg?.class"
|
|
128
|
+
[style]="passThrough().svg?.style"
|
|
129
|
+
>
|
|
130
|
+
<path class="tx-sparkline__area" [attr.d]="area()" [class]="passThrough().area?.class" [style]="passThrough().area?.style" />
|
|
131
|
+
<path class="tx-sparkline__line" [attr.d]="path" [class]="passThrough().line?.class" [style]="passThrough().line?.style" />
|
|
132
|
+
</svg>
|
|
133
|
+
}
|
|
134
|
+
`,
|
|
135
|
+
isInline: true,
|
|
136
|
+
styles: [":host{display:block;width:100%}.tx-sparkline__svg{display:block;width:100%;height:100%;overflow:visible}:host([data-styled]){height:var(--tx-sparkline-height);color:var(--tx-sparkline-tone-primary)}:host([data-styled]) .tx-sparkline__area{fill:currentColor;opacity:var(--tx-sparkline-area-opacity)}:host([data-styled]) .tx-sparkline__line{fill:none;stroke:currentColor;stroke-width:var(--tx-sparkline-stroke-width);stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}:host([data-styled][data-tone=info]){color:var(--tx-sparkline-tone-info)}:host([data-styled][data-tone=success]){color:var(--tx-sparkline-tone-success)}:host([data-styled][data-tone=warn]){color:var(--tx-sparkline-tone-warn)}:host([data-styled][data-tone=danger]){color:var(--tx-sparkline-tone-danger)}\n"],
|
|
137
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
141
|
+
minVersion: "12.0.0",
|
|
142
|
+
version: "22.2.3",
|
|
143
|
+
ngImport: i0,
|
|
144
|
+
type: TxSparkline,
|
|
145
|
+
decorators: [{
|
|
146
|
+
type: Component,
|
|
147
|
+
args: [{
|
|
148
|
+
selector: "tx-sparkline",
|
|
149
|
+
template: `
|
|
150
|
+
@if (line(); as path) {
|
|
151
|
+
<svg
|
|
152
|
+
class="tx-sparkline__svg"
|
|
153
|
+
preserveAspectRatio="none"
|
|
154
|
+
focusable="false"
|
|
155
|
+
aria-hidden="true"
|
|
156
|
+
[attr.viewBox]="viewBox"
|
|
157
|
+
[class]="passThrough().svg?.class"
|
|
158
|
+
[style]="passThrough().svg?.style"
|
|
159
|
+
>
|
|
160
|
+
<path class="tx-sparkline__area" [attr.d]="area()" [class]="passThrough().area?.class" [style]="passThrough().area?.style" />
|
|
161
|
+
<path class="tx-sparkline__line" [attr.d]="path" [class]="passThrough().line?.class" [style]="passThrough().line?.style" />
|
|
162
|
+
</svg>
|
|
163
|
+
}
|
|
164
|
+
`,
|
|
165
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
166
|
+
host: {
|
|
167
|
+
class: "tx-sparkline",
|
|
168
|
+
"[class]": "passThrough().root?.class",
|
|
169
|
+
"[style]": "hostStyle()",
|
|
170
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
171
|
+
"[attr.data-tone]": "tone()",
|
|
172
|
+
"[attr.role]": "ariaLabel() ? \"img\" : null",
|
|
173
|
+
"[attr.aria-label]": "ariaLabel() || null",
|
|
174
|
+
"[attr.aria-hidden]": "ariaLabel() ? null : \"true\""
|
|
175
|
+
},
|
|
176
|
+
styles: [":host{display:block;width:100%}.tx-sparkline__svg{display:block;width:100%;height:100%;overflow:visible}:host([data-styled]){height:var(--tx-sparkline-height);color:var(--tx-sparkline-tone-primary)}:host([data-styled]) .tx-sparkline__area{fill:currentColor;opacity:var(--tx-sparkline-area-opacity)}:host([data-styled]) .tx-sparkline__line{fill:none;stroke:currentColor;stroke-width:var(--tx-sparkline-stroke-width);stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}:host([data-styled][data-tone=info]){color:var(--tx-sparkline-tone-info)}:host([data-styled][data-tone=success]){color:var(--tx-sparkline-tone-success)}:host([data-styled][data-tone=warn]){color:var(--tx-sparkline-tone-warn)}:host([data-styled][data-tone=danger]){color:var(--tx-sparkline-tone-danger)}\n"]
|
|
177
|
+
}]
|
|
178
|
+
}],
|
|
179
|
+
propDecorators: {
|
|
180
|
+
values: [{
|
|
181
|
+
type: i0.Input,
|
|
182
|
+
args: [{
|
|
183
|
+
isSignal: true,
|
|
184
|
+
alias: "values",
|
|
185
|
+
required: false
|
|
186
|
+
}]
|
|
187
|
+
}],
|
|
188
|
+
tone: [{
|
|
189
|
+
type: i0.Input,
|
|
190
|
+
args: [{
|
|
191
|
+
isSignal: true,
|
|
192
|
+
alias: "tone",
|
|
193
|
+
required: false
|
|
194
|
+
}]
|
|
195
|
+
}],
|
|
196
|
+
ariaLabel: [{
|
|
197
|
+
type: i0.Input,
|
|
198
|
+
args: [{
|
|
199
|
+
isSignal: true,
|
|
200
|
+
alias: "ariaLabel",
|
|
201
|
+
required: false
|
|
202
|
+
}]
|
|
203
|
+
}],
|
|
204
|
+
dt: [{
|
|
205
|
+
type: i0.Input,
|
|
206
|
+
args: [{
|
|
207
|
+
isSignal: true,
|
|
208
|
+
alias: "dt",
|
|
209
|
+
required: false
|
|
210
|
+
}]
|
|
211
|
+
}],
|
|
212
|
+
pt: [{
|
|
213
|
+
type: i0.Input,
|
|
214
|
+
args: [{
|
|
215
|
+
isSignal: true,
|
|
216
|
+
alias: "pt",
|
|
217
|
+
required: false
|
|
218
|
+
}]
|
|
219
|
+
}],
|
|
220
|
+
ptOptions: [{
|
|
221
|
+
type: i0.Input,
|
|
222
|
+
args: [{
|
|
223
|
+
isSignal: true,
|
|
224
|
+
alias: "ptOptions",
|
|
225
|
+
required: false
|
|
226
|
+
}]
|
|
227
|
+
}],
|
|
228
|
+
unstyled: [{
|
|
229
|
+
type: i0.Input,
|
|
230
|
+
args: [{
|
|
231
|
+
isSignal: true,
|
|
232
|
+
alias: "unstyled",
|
|
233
|
+
required: false
|
|
234
|
+
}]
|
|
235
|
+
}]
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
export { TxSparkline, sparklinePoints };
|
|
239
|
+
|
|
240
|
+
//# sourceMappingURL=tectra-ng-ui-sparkline.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tectra-ng-ui-sparkline.mjs","names":[],"sources":["../../../../packages/ui/sparkline/src/sparkline.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { TxPassThrough, TxPassThroughOptions, injectPassThrough, injectUnstyled } from '@tectra-ng/core/config';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraDeepPartial, TectraSparklineTokens, toStyleObject } from '@tectra-ng/themes';\nimport { TxSparklinePart, TxSparklinePoint, TxSparklineTone } from './sparkline.types';\n\nconst WIDTH = 120;\nconst HEIGHT = 36;\nconst PADDING = 3;\n\nexport function sparklinePoints(values: readonly number[]): TxSparklinePoint[] {\n const numbers = values.filter((value) => Number.isFinite(value));\n if (numbers.length < 2) {\n return [];\n }\n const min = Math.min(...numbers);\n const range = Math.max(...numbers) - min || 1;\n const step = WIDTH / (numbers.length - 1);\n const usable = HEIGHT - PADDING * 2;\n return numbers.map((value, index) => ({ x: index * step, y: PADDING + usable - ((value - min) / range) * usable }));\n}\n\n@Component({\n selector: 'tx-sparkline',\n template: `\n @if (line(); as path) {\n <svg\n class=\"tx-sparkline__svg\"\n preserveAspectRatio=\"none\"\n focusable=\"false\"\n aria-hidden=\"true\"\n [attr.viewBox]=\"viewBox\"\n [class]=\"passThrough().svg?.class\"\n [style]=\"passThrough().svg?.style\"\n >\n <path class=\"tx-sparkline__area\" [attr.d]=\"area()\" [class]=\"passThrough().area?.class\" [style]=\"passThrough().area?.style\" />\n <path class=\"tx-sparkline__line\" [attr.d]=\"path\" [class]=\"passThrough().line?.class\" [style]=\"passThrough().line?.style\" />\n </svg>\n }\n `,\n styleUrl: './sparkline.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-sparkline',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.data-tone]': 'tone()',\n '[attr.role]': 'ariaLabel() ? \"img\" : null',\n '[attr.aria-label]': 'ariaLabel() || null',\n '[attr.aria-hidden]': 'ariaLabel() ? null : \"true\"',\n },\n})\nexport class TxSparkline {\n readonly values = input<readonly number[] | null | undefined>([]);\n readonly tone = input<TxSparklineTone>('primary');\n readonly ariaLabel = input<string | undefined>(undefined);\n readonly dt = input<TectraDeepPartial<TectraSparklineTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxSparklinePart, TxSparkline> | 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('sparkline', this, this.pt, this.ptOptions);\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-sparkline'), ...this.passThrough().root?.style }));\n\n protected readonly viewBox = `0 0 ${WIDTH} ${HEIGHT}`;\n readonly points = computed(() => sparklinePoints(this.values() ?? []));\n readonly line = computed(() =>\n this.points()\n .map((point, index) => `${index ? 'L' : 'M'}${point.x},${point.y}`)\n .join(' '),\n );\n readonly area = computed(() => (this.line() ? `${this.line()} L${WIDTH},${HEIGHT} L0,${HEIGHT} Z` : ''));\n}\n"],"mappings":";;;;;AAMA,MAAM,QAAQ;AACd,MAAM,SAAS;AAGf,SAAgB,gBAAgB,QAAyB;CACvD,MAAM,UAAU,OAAO,QAAQ,UAAU,OAAO,SAAS,KAAK,CAAC;CAC/D,IAAI,QAAQ,SAAS,GACnB,OAAO,CAAA;CAET,MAAM,MAAM,KAAK,IAAI,GAAG,OAAO;CAC/B,MAAM,QAAQ,KAAK,IAAI,GAAG,OAAO,IAAI,OAAO;CAC5C,MAAM,OAAO,SAAS,QAAQ,SAAS;CACvC,MAA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