@ledgerhq/react-ui 0.14.18 → 0.15.0-nightly.1
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/lib/cjs/components/asorted/Text/Text.stories.js.map +2 -2
- package/lib/cjs/components/cta/Button/index.js +1 -1
- package/lib/cjs/components/cta/Button/index.js.map +2 -2
- package/lib/cjs/components/form/Radio/RadioListElement.js.map +2 -2
- package/lib/cjs/components/index.js +0 -2
- package/lib/cjs/components/index.js.map +2 -2
- package/lib/cjs/components/layout/List/VerticalTimeline/TimelineItem.js.map +2 -2
- package/lib/components/Table/index.js.map +1 -1
- package/lib/components/Tag/index.js.map +1 -1
- package/lib/components/animations/GlitchText/index.js.map +1 -1
- package/lib/components/asorted/Icon/CryptoIcon.js.map +1 -1
- package/lib/components/asorted/Icon/Icon.js.map +1 -1
- package/lib/components/cta/Button/index.js +1 -1
- package/lib/components/cta/Button/index.js.map +1 -1
- package/lib/components/cta/Link/index.d.ts +1 -39
- package/lib/components/form/BaseInput/index.d.ts +2 -36
- package/lib/components/form/BaseInput/index.js.map +1 -1
- package/lib/components/form/DropdownGeneric/index.js.map +1 -1
- package/lib/components/form/NumberInput/index.js.map +1 -1
- package/lib/components/form/Radio/RadioListElement.js.map +1 -1
- package/lib/components/form/SelectInput/Option.js.map +1 -1
- package/lib/components/form/SelectInput/VirtualMenuList.js.map +1 -1
- package/lib/components/form/SplitInput/index.js.map +1 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/layout/Box/index.d.ts +1 -5
- package/lib/components/layout/Carousel/Footer/Pagination/utils.js.map +1 -1
- package/lib/components/layout/Drawer/index.js.map +1 -1
- package/lib/components/layout/List/VerticalTimeline/TimelineIndicator.js.map +1 -1
- package/lib/components/layout/List/VerticalTimeline/TimelineItem.js.map +1 -1
- package/lib/components/layout/Popin/index.js.map +1 -1
- package/lib/components/layout/Side/index.js.map +1 -1
- package/lib/components/message/Alert/index.js.map +1 -1
- package/lib/components/message/Tip/index.js.map +1 -1
- package/lib/components/message/Tooltip/index.js.map +1 -1
- package/lib/components/navigation/FlowStepper/index.js.map +1 -1
- package/lib/components/navigation/progress/Stepper/index.js.map +1 -1
- package/lib/components/styled.js.map +1 -1
- package/lib/components/tabs/Tabs/index.js.map +1 -1
- package/lib/styles/helpers.js.map +1 -1
- package/lib/styles/styled/fontFamily.js.map +1 -1
- package/package.json +3 -7
- package/lib/cjs/components/Chart/Chart.stories.js +0 -116
- package/lib/cjs/components/Chart/Chart.stories.js.map +0 -7
- package/lib/cjs/components/Chart/index.js +0 -150
- package/lib/cjs/components/Chart/index.js.map +0 -7
- package/lib/cjs/components/Chart/types.js +0 -17
- package/lib/cjs/components/Chart/types.js.map +0 -7
- package/lib/cjs/components/Chart/utils.js +0 -42
- package/lib/cjs/components/Chart/utils.js.map +0 -7
- package/lib/components/Chart/index.d.ts +0 -17
- package/lib/components/Chart/index.js +0 -125
- package/lib/components/Chart/index.js.map +0 -1
- package/lib/components/Chart/types.d.ts +0 -14
- package/lib/components/Chart/types.js +0 -2
- package/lib/components/Chart/types.js.map +0 -1
- package/lib/components/Chart/utils.d.ts +0 -19
- package/lib/components/Chart/utils.js +0 -30
- package/lib/components/Chart/utils.js.map +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
17
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/components/Chart/types.ts"],
|
|
4
|
-
"sourcesContent": ["export type Item = {\n date: Date;\n value?: number | string;\n} & { [key: string]: number | string };\n\ntype Unit =\n | \"millisecond\"\n | \"second\"\n | \"minute\"\n | \"hour\"\n | \"day\"\n | \"week\"\n | \"month\"\n | \"quarter\"\n | \"year\";\n\nexport type timeOptions = {\n unit?: Unit;\n displayFormats?: { [unit in Unit]?: string };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var utils_exports = {};
|
|
20
|
-
__export(utils_exports, {
|
|
21
|
-
fontConfig: () => fontConfig,
|
|
22
|
-
valueFormatter: () => valueFormatter
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(utils_exports);
|
|
25
|
-
const valueFormatter = (value) => {
|
|
26
|
-
const breakpoints = [
|
|
27
|
-
{ value: 1e6, unit: "M" },
|
|
28
|
-
{ value: 1e3, unit: "K" },
|
|
29
|
-
{ value: 1, unit: "" }
|
|
30
|
-
];
|
|
31
|
-
const formattedValue = typeof value === "number" ? value : parseFloat(value);
|
|
32
|
-
const item = breakpoints.find((item2) => formattedValue >= item2.value);
|
|
33
|
-
return item ? `${(formattedValue / item.value).toFixed(1).replace(".0", "")} ${item.unit}` : "0";
|
|
34
|
-
};
|
|
35
|
-
const fontConfig = {
|
|
36
|
-
family: "Inter, Arial",
|
|
37
|
-
size: 11,
|
|
38
|
-
weight: "600",
|
|
39
|
-
lineHeight: 1.21,
|
|
40
|
-
style: "normal"
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/components/Chart/utils.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Returns the value fixed to 1 decimals when needed with his associated unit (e.g. \"1.5K\" or \"1.5M\")\n * @param value - Value displayed on the y-axis as a tick\n * @example\n * ```\n * valueFormatter(1500) // \"1.5K\"\n * valueFormatter(1567) // \"1.5K\"\n * valueFormatter(1567657) // \"1.5M\"\n * valueFormatter(156) // \"156\"\n * ```\n */\nexport const valueFormatter = (value: string | number): string => {\n const breakpoints = [\n { value: 1e6, unit: \"M\" },\n { value: 1e3, unit: \"K\" },\n { value: 1, unit: \"\" },\n ];\n const formattedValue = typeof value === \"number\" ? value : parseFloat(value);\n const item = breakpoints.find(item => formattedValue >= item.value);\n return item ? `${(formattedValue / item.value).toFixed(1).replace(\".0\", \"\")} ${item.unit}` : \"0\";\n};\n\n// set default font configuration for the chart - I used ll-text_subTitle class from our theme\nexport const fontConfig: {\n family: string;\n size: number;\n weight: string;\n lineHeight: number;\n style: \"normal\" | \"italic\";\n} = {\n family: \"Inter, Arial\",\n size: 11,\n weight: \"600\",\n lineHeight: 1.21,\n style: \"normal\",\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,MAAM,iBAAiB,CAAC,UAAmC;AAChE,QAAM,cAAc;AAAA,IAClB,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,IACxB,EAAE,OAAO,KAAK,MAAM,IAAI;AAAA,IACxB,EAAE,OAAO,GAAG,MAAM,GAAG;AAAA,EACvB;AACA,QAAM,iBAAiB,OAAO,UAAU,WAAW,QAAQ,WAAW,KAAK;AAC3E,QAAM,OAAO,YAAY,KAAK,CAAAA,UAAQ,kBAAkBA,MAAK,KAAK;AAClE,SAAO,OAAO,IAAI,iBAAiB,KAAK,OAAO,QAAQ,CAAC,EAAE,QAAQ,MAAM,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK;AAC/F;AAGO,MAAM,aAMT;AAAA,EACF,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,OAAO;AACT;",
|
|
6
|
-
"names": ["item"]
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ChartProps } from "react-chartjs-2";
|
|
3
|
-
import "chartjs-adapter-moment";
|
|
4
|
-
import type { Item, timeOptions } from "./types";
|
|
5
|
-
export type Props = Omit<ChartProps, "type" | "data" | "options"> & {
|
|
6
|
-
data: Array<Item>;
|
|
7
|
-
color: string;
|
|
8
|
-
variant?: "default" | "small";
|
|
9
|
-
valueKey?: string;
|
|
10
|
-
timeOptions?: timeOptions;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* @remarks This component must have a parent that has only it as a child and it must be in relative position!
|
|
14
|
-
* @privateRemarks Don't name this component "Chart", that will conflict with the Chart.js library cuz of the adapter
|
|
15
|
-
*/
|
|
16
|
-
declare const _default: ({ data, color, variant, valueKey, timeOptions, ...chartProps }: Props) => JSX.Element;
|
|
17
|
-
export default _default;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React, { useEffect, useMemo } from "react";
|
|
13
|
-
import { Line, defaults } from "react-chartjs-2";
|
|
14
|
-
import Color from "color";
|
|
15
|
-
import { useTheme } from "styled-components";
|
|
16
|
-
import "chartjs-adapter-moment";
|
|
17
|
-
import { fontConfig, valueFormatter } from "./utils";
|
|
18
|
-
/*
|
|
19
|
-
** Returns the correct config based on the variant
|
|
20
|
-
*/
|
|
21
|
-
const getConfig = (variant, options) => {
|
|
22
|
-
const config = {
|
|
23
|
-
small: {
|
|
24
|
-
gradient: { alpha: 0.3 },
|
|
25
|
-
scales: { y: { display: false }, x: { display: false, type: "time" } },
|
|
26
|
-
},
|
|
27
|
-
default: {
|
|
28
|
-
gradient: { alpha: 0.1 },
|
|
29
|
-
scales: {
|
|
30
|
-
y: {
|
|
31
|
-
display: true,
|
|
32
|
-
grid: {
|
|
33
|
-
color: options.gridColor,
|
|
34
|
-
borderDash: [4, 4],
|
|
35
|
-
tickWidth: 0,
|
|
36
|
-
tickLength: 18,
|
|
37
|
-
// This is an hack to don't render a duplicate axis
|
|
38
|
-
borderWidth: 0,
|
|
39
|
-
},
|
|
40
|
-
ticks: { callback: valueFormatter, labelOffset: -3 },
|
|
41
|
-
},
|
|
42
|
-
x: {
|
|
43
|
-
display: true,
|
|
44
|
-
grid: {
|
|
45
|
-
color: options.gridColor,
|
|
46
|
-
borderDash: [4, 4],
|
|
47
|
-
tickWidth: 0,
|
|
48
|
-
tickLength: 15,
|
|
49
|
-
// Don't render a duplicate axis
|
|
50
|
-
borderWidth: 0,
|
|
51
|
-
},
|
|
52
|
-
// always display first/last ticks
|
|
53
|
-
bounds: "ticks",
|
|
54
|
-
type: "time",
|
|
55
|
-
// control how the tickers on the x-axis are formatted
|
|
56
|
-
time: options.timeOptions,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
return config[variant];
|
|
62
|
-
};
|
|
63
|
-
const defaultValue = {
|
|
64
|
-
variant: "default",
|
|
65
|
-
valueKey: "value",
|
|
66
|
-
timeOptions: { unit: "month", displayFormats: { month: "MMM." } },
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* @remarks This component must have a parent that has only it as a child and it must be in relative position!
|
|
70
|
-
* @privateRemarks Don't name this component "Chart", that will conflict with the Chart.js library cuz of the adapter
|
|
71
|
-
*/
|
|
72
|
-
export default (_a) => {
|
|
73
|
-
var { data, color, variant = defaultValue.variant, valueKey = defaultValue.valueKey, timeOptions = defaultValue.timeOptions } = _a, chartProps = __rest(_a, ["data", "color", "variant", "valueKey", "timeOptions"]);
|
|
74
|
-
const theme = useTheme();
|
|
75
|
-
const config = useMemo(() => getConfig(variant, { gridColor: theme.colors.neutral.c40, timeOptions }), [variant, theme.colors.neutral.c40, timeOptions]);
|
|
76
|
-
// inject default font configuration at mount
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
defaults.font = fontConfig;
|
|
79
|
-
}, []);
|
|
80
|
-
const chartData = useMemo(() => ({
|
|
81
|
-
datasets: [
|
|
82
|
-
{
|
|
83
|
-
borderColor: color,
|
|
84
|
-
borderWidth: 2,
|
|
85
|
-
fill: "start",
|
|
86
|
-
backgroundColor: (context) => {
|
|
87
|
-
const chart = context.chart;
|
|
88
|
-
const { ctx, chartArea } = chart;
|
|
89
|
-
// This case happens on initial chart load
|
|
90
|
-
if (!chartArea)
|
|
91
|
-
return null;
|
|
92
|
-
// Create gradient based on the props color
|
|
93
|
-
const gradient = ctx.createLinearGradient(0, 0, 0, chartArea.height / 1.2);
|
|
94
|
-
gradient.addColorStop(0, Color(color).alpha(config.gradient.alpha).string());
|
|
95
|
-
gradient.addColorStop(1, Color(color).alpha(0.0).string());
|
|
96
|
-
return gradient;
|
|
97
|
-
},
|
|
98
|
-
// prevent points rendering
|
|
99
|
-
pointRadius: 0,
|
|
100
|
-
pointHitRadius: 0,
|
|
101
|
-
data: data.map(({ date: x, [`${valueKey}`]: y }) => ({ x, y })),
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
}),
|
|
105
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
106
|
-
[color, data, valueKey, variant]);
|
|
107
|
-
const options = useMemo(() => ({
|
|
108
|
-
// Responsive options use the parent element to create the canvas
|
|
109
|
-
responsive: true,
|
|
110
|
-
maintainAspectRatio: false,
|
|
111
|
-
plugins: { tooltips: { enabled: false }, legend: { display: false } },
|
|
112
|
-
animation: false,
|
|
113
|
-
elements: {
|
|
114
|
-
points: { radius: 0 },
|
|
115
|
-
line: {
|
|
116
|
-
// Bezier curve tension of the line. Set to 0 to draw straightlines.
|
|
117
|
-
tension: 0.2,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
scales: config.scales,
|
|
121
|
-
}), [config.scales]);
|
|
122
|
-
// The redraw is needed to allow the chart to be updated with new value
|
|
123
|
-
return React.createElement(Line, Object.assign({ data: chartData, options: options }, chartProps, { redraw: true }));
|
|
124
|
-
};
|
|
125
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Chart/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAc,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,wBAAwB,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsBrD;;GAEG;AACH,MAAM,SAAS,GAAG,CAChB,OAAsC,EACtC,OAAwE,EACvD,EAAE;IACnB,MAAM,MAAM,GAAyD;QACnE,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;YACxB,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;SACvE;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;YACxB,MAAM,EAAE;gBACN,CAAC,EAAE;oBACD,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE;wBACJ,KAAK,EAAE,OAAO,CAAC,SAAS;wBACxB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;wBAClB,SAAS,EAAE,CAAC;wBACZ,UAAU,EAAE,EAAE;wBAEd,mDAAmD;wBACnD,WAAW,EAAE,CAAC;qBACf;oBACD,KAAK,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,W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AuD;IACvD,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CACD,CAAC;IAElC,MAAM,OAAO,GAA0B,OAAO,CAC5C,GAAG,EAAE,CAAC,CAAC;QACL,iEAAiE;QACjE,UAAU,EAAE,IAAI;QAChB,mBAAmB,EAAE,KAAK;QAE1B,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QACrE,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE;YACR,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;YACrB,IAAI,EAAE;gBACJ,oEAAoE;gBACpE,OAAO,EAAE,GAAG;aACb;SACF;QACD,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,EACF,CAAC,MAAM,CAAC,MAAM,CAAC,CACmB,CAAC;IAErC,uEAAuE;IACvE,OAAO,oBAAC,IAAI,kBAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,IAAM,UAAU,IAAE,MAAM,UAAG,CAAC;AAC5E,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type Item = {
|
|
2
|
-
date: Date;
|
|
3
|
-
value?: number | string;
|
|
4
|
-
} & {
|
|
5
|
-
[key: string]: number | string;
|
|
6
|
-
};
|
|
7
|
-
type Unit = "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
|
|
8
|
-
export type timeOptions = {
|
|
9
|
-
unit?: Unit;
|
|
10
|
-
displayFormats?: {
|
|
11
|
-
[unit in Unit]?: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Chart/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the value fixed to 1 decimals when needed with his associated unit (e.g. "1.5K" or "1.5M")
|
|
3
|
-
* @param value - Value displayed on the y-axis as a tick
|
|
4
|
-
* @example
|
|
5
|
-
* ```
|
|
6
|
-
* valueFormatter(1500) // "1.5K"
|
|
7
|
-
* valueFormatter(1567) // "1.5K"
|
|
8
|
-
* valueFormatter(1567657) // "1.5M"
|
|
9
|
-
* valueFormatter(156) // "156"
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export declare const valueFormatter: (value: string | number) => string;
|
|
13
|
-
export declare const fontConfig: {
|
|
14
|
-
family: string;
|
|
15
|
-
size: number;
|
|
16
|
-
weight: string;
|
|
17
|
-
lineHeight: number;
|
|
18
|
-
style: "normal" | "italic";
|
|
19
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the value fixed to 1 decimals when needed with his associated unit (e.g. "1.5K" or "1.5M")
|
|
3
|
-
* @param value - Value displayed on the y-axis as a tick
|
|
4
|
-
* @example
|
|
5
|
-
* ```
|
|
6
|
-
* valueFormatter(1500) // "1.5K"
|
|
7
|
-
* valueFormatter(1567) // "1.5K"
|
|
8
|
-
* valueFormatter(1567657) // "1.5M"
|
|
9
|
-
* valueFormatter(156) // "156"
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export const valueFormatter = (value) => {
|
|
13
|
-
const breakpoints = [
|
|
14
|
-
{ value: 1e6, unit: "M" },
|
|
15
|
-
{ value: 1e3, unit: "K" },
|
|
16
|
-
{ value: 1, unit: "" },
|
|
17
|
-
];
|
|
18
|
-
const formattedValue = typeof value === "number" ? value : parseFloat(value);
|
|
19
|
-
const item = breakpoints.find(item => formattedValue >= item.value);
|
|
20
|
-
return item ? `${(formattedValue / item.value).toFixed(1).replace(".0", "")} ${item.unit}` : "0";
|
|
21
|
-
};
|
|
22
|
-
// set default font configuration for the chart - I used ll-text_subTitle class from our theme
|
|
23
|
-
export const fontConfig = {
|
|
24
|
-
family: "Inter, Arial",
|
|
25
|
-
size: 11,
|
|
26
|
-
weight: "600",
|
|
27
|
-
lineHeight: 1.21,
|
|
28
|
-
style: "normal",
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Chart/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAsB,EAAU,EAAE;IAC/D,MAAM,WAAW,GAAG;QAClB,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE;QACzB,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE;QACzB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;KACvB,CAAC;IACF,MAAM,cAAc,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC7E,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AACnG,CAAC,CAAC;AAEF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,UAAU,GAMnB;IACF,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,QAAQ;CAChB,CAAC"}
|