rbro-tat-uds 2.2.1 → 2.2.3
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/build/cjs/components/GraficContributieUnitlinked/GraficContributieUnitlinked.cjs +157 -0
- package/build/cjs/components/GraficContributieUnitlinked/index.cjs +12 -0
- package/build/cjs/components/Illustration/Illustrations.cjs +3 -1
- package/build/cjs/components/Illustration/illustrations/s-regular-investment.svg.cjs +757 -0
- package/build/cjs/components/index.cjs +2 -0
- package/build/cjs/index.cjs +1650 -775
- package/build/esm/components/GraficContributieUnitlinked/GraficContributieUnitlinked.js +153 -0
- package/build/esm/components/GraficContributieUnitlinked/index.js +8 -0
- package/build/esm/components/Illustration/Illustrations.js +3 -1
- package/build/esm/components/Illustration/illustrations/s-regular-investment.svg.js +734 -0
- package/build/esm/components/index.js +1 -0
- package/build/esm/index.js +1650 -776
- package/build/types/components/GraficContributieUnitlinked/GraficContributieUnitlinked.d.ts +16 -0
- package/build/types/components/GraficContributieUnitlinked/index.d.ts +6 -0
- package/build/types/components/Illustration/Illustrations.d.ts +1 -0
- package/build/types/index.d.ts +1 -0
- package/package.json +1 -1
@@ -0,0 +1,153 @@
|
|
1
|
+
"use strict";
|
2
|
+
"use client";
|
3
|
+
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
5
|
+
import { colors } from '../../utils';
|
6
|
+
import { useRef, useState, useMemo, useEffect } from 'react';
|
7
|
+
import styled from 'styled-components';
|
8
|
+
|
9
|
+
const GraficContributieUnitlinkedStyled = styled.svg`
|
10
|
+
& > .limit_label_main {
|
11
|
+
font-size: 14px;
|
12
|
+
font-weight: 400;
|
13
|
+
fill: ${colors.gray_950};
|
14
|
+
}
|
15
|
+
& > .limit_label_secondary {
|
16
|
+
font-size: 16px;
|
17
|
+
font-weight: 700;
|
18
|
+
fill: ${colors.gray_950};
|
19
|
+
}
|
20
|
+
`;
|
21
|
+
const GraficContributieUnitlinked = ({
|
22
|
+
limitTop = 50,
|
23
|
+
limitBottom = 100,
|
24
|
+
limitTopLabel = "Top Label",
|
25
|
+
limitBottomLabel = "Bottom Label",
|
26
|
+
currency = "RON",
|
27
|
+
height = 142,
|
28
|
+
colorBar = colors.danger_100,
|
29
|
+
colorFilledBar = colors.success_400
|
30
|
+
}) => {
|
31
|
+
const RO = new Intl.NumberFormat("RO");
|
32
|
+
const svg_ref = useRef(null);
|
33
|
+
const [w, setW] = useState(0);
|
34
|
+
const BAR_HEIGHT = 24;
|
35
|
+
const configuration = useMemo(() => {
|
36
|
+
const barY = height / 2 - BAR_HEIGHT / 2;
|
37
|
+
const barYStop = barY + BAR_HEIGHT;
|
38
|
+
const limitTopHeight = height - barYStop + BAR_HEIGHT;
|
39
|
+
const limitTopX = Math.min(Math.max(0, limitTop / limitBottom * w), w - 2);
|
40
|
+
const limitTopLabelsAnchor = limitTopX > w * 0.75 ? "end" : "start";
|
41
|
+
const limitBottomX = w - 2;
|
42
|
+
const limitBottomY = barY;
|
43
|
+
const limitBottomHeight = limitTopHeight;
|
44
|
+
return {
|
45
|
+
barY,
|
46
|
+
barYStop,
|
47
|
+
limitTopHeight,
|
48
|
+
limitTopX,
|
49
|
+
limitTopLabelsAnchor,
|
50
|
+
limitBottomY,
|
51
|
+
limitBottomHeight,
|
52
|
+
limitBottomX
|
53
|
+
};
|
54
|
+
}, [limitTop, limitBottom, height, w]);
|
55
|
+
useEffect(() => {
|
56
|
+
if (svg_ref.current) {
|
57
|
+
setW(svg_ref.current.clientWidth);
|
58
|
+
}
|
59
|
+
}, [svg_ref]);
|
60
|
+
return /* @__PURE__ */ jsxs(
|
61
|
+
GraficContributieUnitlinkedStyled,
|
62
|
+
{
|
63
|
+
ref: svg_ref,
|
64
|
+
width: "100%",
|
65
|
+
height,
|
66
|
+
xmlns: "http://www.w3.org/2000/svg",
|
67
|
+
children: [
|
68
|
+
/* @__PURE__ */ jsx(
|
69
|
+
"rect",
|
70
|
+
{
|
71
|
+
x: 0,
|
72
|
+
y: configuration.barY,
|
73
|
+
width: "100%",
|
74
|
+
height: BAR_HEIGHT,
|
75
|
+
fill: colorBar
|
76
|
+
}
|
77
|
+
),
|
78
|
+
/* @__PURE__ */ jsx(
|
79
|
+
"rect",
|
80
|
+
{
|
81
|
+
x: 0,
|
82
|
+
y: configuration.barY,
|
83
|
+
width: configuration.limitTopX,
|
84
|
+
height: BAR_HEIGHT,
|
85
|
+
fill: colorFilledBar
|
86
|
+
}
|
87
|
+
),
|
88
|
+
/* @__PURE__ */ jsx(
|
89
|
+
"rect",
|
90
|
+
{
|
91
|
+
x: configuration.limitTopX,
|
92
|
+
y: 0,
|
93
|
+
height: configuration.limitTopHeight,
|
94
|
+
fill: "black",
|
95
|
+
width: 2
|
96
|
+
}
|
97
|
+
),
|
98
|
+
/* @__PURE__ */ jsx(
|
99
|
+
"text",
|
100
|
+
{
|
101
|
+
className: "limit_label_main",
|
102
|
+
textAnchor: configuration.limitTopLabelsAnchor,
|
103
|
+
x: configuration.limitTopX + (configuration.limitTopLabelsAnchor === "start" ? 12 : -12),
|
104
|
+
y: 12,
|
105
|
+
children: limitTopLabel
|
106
|
+
}
|
107
|
+
),
|
108
|
+
/* @__PURE__ */ jsx(
|
109
|
+
"text",
|
110
|
+
{
|
111
|
+
className: "limit_label_secondary",
|
112
|
+
textAnchor: configuration.limitTopLabelsAnchor,
|
113
|
+
x: configuration.limitTopX + (configuration.limitTopLabelsAnchor === "start" ? 12 : -12),
|
114
|
+
y: 12 + 20,
|
115
|
+
children: RO.format(limitTop) + " " + currency
|
116
|
+
}
|
117
|
+
),
|
118
|
+
/* @__PURE__ */ jsx(
|
119
|
+
"rect",
|
120
|
+
{
|
121
|
+
x: configuration.limitBottomX,
|
122
|
+
y: configuration.limitBottomY,
|
123
|
+
height: configuration.limitBottomHeight,
|
124
|
+
fill: "black",
|
125
|
+
width: 2
|
126
|
+
}
|
127
|
+
),
|
128
|
+
/* @__PURE__ */ jsx(
|
129
|
+
"text",
|
130
|
+
{
|
131
|
+
className: "limit_label_main",
|
132
|
+
textAnchor: "end",
|
133
|
+
x: configuration.limitBottomX - 12,
|
134
|
+
y: height - 20,
|
135
|
+
children: limitBottomLabel
|
136
|
+
}
|
137
|
+
),
|
138
|
+
/* @__PURE__ */ jsx(
|
139
|
+
"text",
|
140
|
+
{
|
141
|
+
className: "limit_label_secondary",
|
142
|
+
textAnchor: "end",
|
143
|
+
x: configuration.limitBottomX - 12,
|
144
|
+
y: height,
|
145
|
+
children: RO.format(limitBottom) + " " + currency
|
146
|
+
}
|
147
|
+
)
|
148
|
+
]
|
149
|
+
}
|
150
|
+
);
|
151
|
+
};
|
152
|
+
|
153
|
+
export { GraficContributieUnitlinked as default };
|
@@ -11,6 +11,7 @@ import SvgMNoFees from './illustrations/m-no-fees.svg.js';
|
|
11
11
|
import SvgMQuickMoney from './illustrations/m-quick-money.svg.js';
|
12
12
|
import SvgMCelebrationRaiffeisen from './illustrations/m-celebration-raiffeisen.svg.js';
|
13
13
|
import SvgSHousingLoan from './illustrations/s-housing-loan.svg.js';
|
14
|
+
import SvgSRegularInvestment from './illustrations/s-regular-investment.svg.js';
|
14
15
|
|
15
16
|
const illustrations = {
|
16
17
|
"m-investing-money": SvgMInvestingMoney,
|
@@ -22,7 +23,8 @@ const illustrations = {
|
|
22
23
|
"m-no-fees": SvgMNoFees,
|
23
24
|
"m-quick-money": SvgMQuickMoney,
|
24
25
|
"m-celebration-raiffeisen": SvgMCelebrationRaiffeisen,
|
25
|
-
"s-housing-loan": SvgSHousingLoan
|
26
|
+
"s-housing-loan": SvgSHousingLoan,
|
27
|
+
"s-regular-investment": SvgSRegularInvestment
|
26
28
|
};
|
27
29
|
|
28
30
|
export { illustrations };
|