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.
@@ -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 };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ "use client";
3
+
4
+ import GraficContributieUnitlinked from './GraficContributieUnitlinked.js';
5
+
6
+
7
+
8
+ 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 };