rbro-tat-uds 2.0.0 → 2.1.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.
- package/build/cjs/components/Bar/Bar.cjs +22 -18
- package/build/cjs/components/UnitlinkGraph/UnitlinkGraph.cjs +76 -56
- package/build/cjs/index.cjs +98 -74
- package/build/esm/components/Bar/Bar.js +22 -18
- package/build/esm/components/UnitlinkGraph/UnitlinkGraph.js +77 -57
- package/build/esm/index.js +98 -74
- package/build/types/components/Bar/Bar.d.ts +6 -3
- package/build/types/components/UnitlinkGraph/UnitlinkGraph.d.ts +6 -0
- package/package.json +10 -2
@@ -16,37 +16,41 @@ const StyledBar = styled.div`
|
|
16
16
|
width: 100%;
|
17
17
|
position: relative;
|
18
18
|
overflow: hidden;
|
19
|
+
display: flex;
|
19
20
|
height: ${(props) => props.$height && _constraint_height.includes(props.$height) ? props.$height + "px" : "24px"};
|
20
|
-
background-color: ${(props) => props.$
|
21
|
+
background-color: ${(props) => props.$backgroundColor && Object.keys(utils.colors).includes(props.$backgroundColor) ? utils.colors[props.$backgroundColor] : utils.colors.gray_60};
|
21
22
|
border-radius: ${(props) => props.$radius && _constraint_radius.includes(props.$radius) ? props.$radius + "px" : "4px"};
|
22
|
-
|
23
|
-
&:after {
|
24
|
-
content: "";
|
25
|
-
width: ${(props) => typeof props.$value === "number" ? props.$value * 100 + "%" : "50%"};
|
26
|
-
height: 100%;
|
27
|
-
position: absolute;
|
28
|
-
top: 0;
|
29
|
-
left: 0;
|
30
|
-
background-color: ${(props) => props.$leftColor && Object.keys(utils.colors).includes(props.$leftColor) ? utils.colors[props.$leftColor] : utils.colors.gray_950};
|
31
|
-
}
|
32
23
|
`;
|
33
24
|
const Bar = ({
|
34
|
-
value = 0,
|
35
|
-
leftColor = "gray_950",
|
36
|
-
rightColor = "gray_60",
|
37
25
|
height = 24,
|
38
26
|
radius = 4,
|
27
|
+
backgroundColor = "gray_60",
|
28
|
+
max = 100,
|
29
|
+
items = [],
|
39
30
|
...rest
|
40
31
|
}) => {
|
41
32
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
42
33
|
StyledBar,
|
43
34
|
{
|
44
|
-
$
|
45
|
-
$leftColor: leftColor,
|
46
|
-
$rightColor: rightColor,
|
35
|
+
$backgroundColor: backgroundColor,
|
47
36
|
$height: height,
|
48
37
|
$radius: radius,
|
49
|
-
...rest
|
38
|
+
...rest,
|
39
|
+
children: items.length > 0 && items.map((item, index) => {
|
40
|
+
const thisColor = utils.colors[item.color] || utils.colors.gray_950;
|
41
|
+
const percentage = item.value / max * 100;
|
42
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
43
|
+
"div",
|
44
|
+
{
|
45
|
+
style: {
|
46
|
+
width: `${percentage}%`,
|
47
|
+
height: "100%",
|
48
|
+
backgroundColor: thisColor
|
49
|
+
}
|
50
|
+
},
|
51
|
+
index
|
52
|
+
);
|
53
|
+
})
|
50
54
|
}
|
51
55
|
);
|
52
56
|
};
|
@@ -61,6 +61,7 @@ const UnitLinkGraphStyled = styled.svg`
|
|
61
61
|
const UnitLinkGraph = ({
|
62
62
|
height = 0,
|
63
63
|
barMainConfiguration = {
|
64
|
+
followSlider: false,
|
64
65
|
header: "Placeholder",
|
65
66
|
color_primary: utils.colors.purple_600,
|
66
67
|
color_secondary: utils.colors.purple_50,
|
@@ -73,9 +74,16 @@ const UnitLinkGraph = ({
|
|
73
74
|
}
|
74
75
|
]
|
75
76
|
},
|
77
|
+
setBarMainActionsActive = () => {
|
78
|
+
},
|
79
|
+
barMainActionsActive = 0,
|
76
80
|
barSecondaryConfiguration,
|
81
|
+
setBarSecondaryActionsActive = () => {
|
82
|
+
},
|
83
|
+
barSecondaryActionsActive = 0,
|
77
84
|
initialSliderValue = 0,
|
78
85
|
maximum_ani = 7,
|
86
|
+
limit_ani = 7,
|
79
87
|
timeline_texts = {
|
80
88
|
left: "Placeholder"
|
81
89
|
},
|
@@ -90,6 +98,13 @@ const UnitLinkGraph = ({
|
|
90
98
|
const [mainWidth, setMainWidth] = React.useState(0);
|
91
99
|
const [mainStart, setMainStart] = React.useState(0);
|
92
100
|
const [sliderValue, setSliderValue] = React.useState(initialSliderValue);
|
101
|
+
const place_at_ani = React.useMemo(() => {
|
102
|
+
if (barMainConfiguration.followSlider) {
|
103
|
+
return sliderValue;
|
104
|
+
} else {
|
105
|
+
return barMainConfiguration.place_at_ani;
|
106
|
+
}
|
107
|
+
}, [barMainConfiguration, sliderValue]);
|
93
108
|
const configurations = React.useMemo(() => {
|
94
109
|
return {
|
95
110
|
mainGap: 16,
|
@@ -332,7 +347,7 @@ const UnitLinkGraph = ({
|
|
332
347
|
({ mainHeight }) => {
|
333
348
|
const MANY_SEGMENTS_PER_YEAR = 2;
|
334
349
|
const segments_count = (configurations.area.indicators.count - 1) * MANY_SEGMENTS_PER_YEAR;
|
335
|
-
const segments_render =
|
350
|
+
const segments_render = place_at_ani * 2;
|
336
351
|
const segments_padding_y = 4.5;
|
337
352
|
const segments_y = floorToHalf(
|
338
353
|
totalHeight - mainHeight + segments_padding_y + configurations.mainGap
|
@@ -370,13 +385,7 @@ const UnitLinkGraph = ({
|
|
370
385
|
}
|
371
386
|
};
|
372
387
|
},
|
373
|
-
[
|
374
|
-
mainWidth,
|
375
|
-
mainStart,
|
376
|
-
configurations,
|
377
|
-
totalHeight,
|
378
|
-
barMainConfiguration.place_at_ani
|
379
|
-
]
|
388
|
+
[mainWidth, mainStart, configurations, totalHeight, place_at_ani]
|
380
389
|
);
|
381
390
|
const computeAction = React.useCallback(
|
382
391
|
({
|
@@ -430,7 +439,7 @@ const UnitLinkGraph = ({
|
|
430
439
|
mainHeightGraph,
|
431
440
|
config: barMainConfiguration,
|
432
441
|
getPointsPositionIndicatorX,
|
433
|
-
place_at:
|
442
|
+
place_at: place_at_ani,
|
434
443
|
main: true
|
435
444
|
});
|
436
445
|
let bar_secondary;
|
@@ -493,62 +502,68 @@ const UnitLinkGraph = ({
|
|
493
502
|
},
|
494
503
|
...rest,
|
495
504
|
children: [
|
496
|
-
/* @__PURE__ */ jsxRuntime.
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
505
|
+
place_at_ani > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
506
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
507
|
+
"line",
|
508
|
+
{
|
509
|
+
x1: graph.main.area.part_1.x1,
|
510
|
+
x2: graph.main.area.part_1.x2,
|
511
|
+
y1: graph.main.area.part_1.y1,
|
512
|
+
y2: graph.main.area.part_1.y2,
|
513
|
+
strokeWidth: graph.main.area.part_1.strokeWidth,
|
514
|
+
stroke: graph.main.bars.main.colorPrimary
|
515
|
+
}
|
516
|
+
),
|
517
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
518
|
+
"line",
|
519
|
+
{
|
520
|
+
x1: graph.main.area.part_2.x1,
|
521
|
+
x2: graph.main.area.part_2.x2,
|
522
|
+
y1: graph.main.area.part_2.y1,
|
523
|
+
y2: graph.main.area.part_2.y2,
|
524
|
+
strokeWidth: graph.main.area.part_2.strokeWidth,
|
525
|
+
stroke: graph.main.bars.main.colorPrimary
|
526
|
+
}
|
527
|
+
),
|
528
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
529
|
+
"line",
|
530
|
+
{
|
531
|
+
x1: graph.main.area.part_3.x1,
|
532
|
+
x2: graph.main.area.part_3.x2,
|
533
|
+
y1: graph.main.area.part_3.y1,
|
534
|
+
y2: graph.main.area.part_3.y2,
|
535
|
+
strokeWidth: graph.main.area.part_3.strokeWidth,
|
536
|
+
stroke: graph.main.bars.main.colorPrimary
|
537
|
+
}
|
538
|
+
),
|
539
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
540
|
+
"polygon",
|
541
|
+
{
|
542
|
+
points: `
|
533
543
|
${graph.main.area.part_2.x2},${graph.main.bars.main.filled_y + 1.5}
|
534
544
|
${graph.main.area.part_3.x2},${graph.main.bars.main.filled_y + 1.5}
|
535
545
|
${graph.main.area.part_3.x2},${graph.mainHeightGraph}
|
536
546
|
${graph.main.area.part_2.x1},${graph.mainHeightGraph}`,
|
537
|
-
|
538
|
-
|
539
|
-
|
547
|
+
fill: graph.main.bars.main.colorSecondary
|
548
|
+
}
|
549
|
+
)
|
550
|
+
] }),
|
540
551
|
/* @__PURE__ */ jsxRuntime.jsx(
|
541
552
|
RenderBar,
|
542
553
|
{
|
543
554
|
bar: graph.main.bars.main,
|
544
|
-
textLineHeight: configurations.bars.actionsTextLineHeight
|
555
|
+
textLineHeight: configurations.bars.actionsTextLineHeight,
|
556
|
+
activeAction: barMainActionsActive,
|
557
|
+
setActiveAction: (value) => setBarMainActionsActive(value)
|
545
558
|
}
|
546
559
|
),
|
547
560
|
graph.main.bars.secondary && /* @__PURE__ */ jsxRuntime.jsx(
|
548
561
|
RenderBar,
|
549
562
|
{
|
550
563
|
bar: graph.main.bars.secondary,
|
551
|
-
textLineHeight: configurations.bars.actionsTextLineHeight
|
564
|
+
textLineHeight: configurations.bars.actionsTextLineHeight,
|
565
|
+
activeAction: barSecondaryActionsActive,
|
566
|
+
setActiveAction: (value) => setBarSecondaryActionsActive(value)
|
552
567
|
}
|
553
568
|
),
|
554
569
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -658,15 +673,20 @@ const UnitLinkGraph = ({
|
|
658
673
|
max: configurations.area.indicators.count - 1,
|
659
674
|
value: sliderValue,
|
660
675
|
onChange: setSliderValue,
|
661
|
-
limit:
|
676
|
+
limit: limit_ani
|
662
677
|
}
|
663
678
|
)
|
664
679
|
]
|
665
680
|
}
|
666
681
|
);
|
667
682
|
};
|
668
|
-
const RenderBar = ({
|
669
|
-
|
683
|
+
const RenderBar = ({
|
684
|
+
bar,
|
685
|
+
textLineHeight,
|
686
|
+
activeAction = 0,
|
687
|
+
setActiveAction = () => {
|
688
|
+
}
|
689
|
+
}) => {
|
670
690
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
671
691
|
/* @__PURE__ */ jsxRuntime.jsx(
|
672
692
|
"rect",
|
@@ -702,12 +722,12 @@ const RenderBar = ({ bar, textLineHeight }) => {
|
|
702
722
|
}
|
703
723
|
),
|
704
724
|
bar.barActions.actions.map((action, index) => {
|
705
|
-
const isActive =
|
725
|
+
const isActive = activeAction === index;
|
706
726
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
707
727
|
"g",
|
708
728
|
{
|
709
729
|
className: "bar-actions-group",
|
710
|
-
onClick: () =>
|
730
|
+
onClick: () => setActiveAction(index),
|
711
731
|
children: [
|
712
732
|
/* @__PURE__ */ jsxRuntime.jsx(
|
713
733
|
"rect",
|
package/build/cjs/index.cjs
CHANGED
@@ -2769,37 +2769,41 @@ const StyledBar = styled__default.default.div`
|
|
2769
2769
|
width: 100%;
|
2770
2770
|
position: relative;
|
2771
2771
|
overflow: hidden;
|
2772
|
+
display: flex;
|
2772
2773
|
height: ${(props) => props.$height && _constraint_height$1.includes(props.$height) ? props.$height + "px" : "24px"};
|
2773
|
-
background-color: ${(props) => props.$
|
2774
|
+
background-color: ${(props) => props.$backgroundColor && Object.keys(utils.colors).includes(props.$backgroundColor) ? utils.colors[props.$backgroundColor] : utils.colors.gray_60};
|
2774
2775
|
border-radius: ${(props) => props.$radius && _constraint_radius.includes(props.$radius) ? props.$radius + "px" : "4px"};
|
2775
|
-
|
2776
|
-
&:after {
|
2777
|
-
content: "";
|
2778
|
-
width: ${(props) => typeof props.$value === "number" ? props.$value * 100 + "%" : "50%"};
|
2779
|
-
height: 100%;
|
2780
|
-
position: absolute;
|
2781
|
-
top: 0;
|
2782
|
-
left: 0;
|
2783
|
-
background-color: ${(props) => props.$leftColor && Object.keys(utils.colors).includes(props.$leftColor) ? utils.colors[props.$leftColor] : utils.colors.gray_950};
|
2784
|
-
}
|
2785
2776
|
`;
|
2786
2777
|
const Bar = ({
|
2787
|
-
value = 0,
|
2788
|
-
leftColor = "gray_950",
|
2789
|
-
rightColor = "gray_60",
|
2790
2778
|
height = 24,
|
2791
2779
|
radius = 4,
|
2780
|
+
backgroundColor = "gray_60",
|
2781
|
+
max = 100,
|
2782
|
+
items = [],
|
2792
2783
|
...rest
|
2793
2784
|
}) => {
|
2794
2785
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
2795
2786
|
StyledBar,
|
2796
2787
|
{
|
2797
|
-
$
|
2798
|
-
$leftColor: leftColor,
|
2799
|
-
$rightColor: rightColor,
|
2788
|
+
$backgroundColor: backgroundColor,
|
2800
2789
|
$height: height,
|
2801
2790
|
$radius: radius,
|
2802
|
-
...rest
|
2791
|
+
...rest,
|
2792
|
+
children: items.length > 0 && items.map((item, index) => {
|
2793
|
+
const thisColor = utils.colors[item.color] || utils.colors.gray_950;
|
2794
|
+
const percentage = item.value / max * 100;
|
2795
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
2796
|
+
"div",
|
2797
|
+
{
|
2798
|
+
style: {
|
2799
|
+
width: `${percentage}%`,
|
2800
|
+
height: "100%",
|
2801
|
+
backgroundColor: thisColor
|
2802
|
+
}
|
2803
|
+
},
|
2804
|
+
index
|
2805
|
+
);
|
2806
|
+
})
|
2803
2807
|
}
|
2804
2808
|
);
|
2805
2809
|
};
|
@@ -24437,6 +24441,7 @@ const UnitLinkGraphStyled = styled__default.default.svg`
|
|
24437
24441
|
const UnitLinkGraph = ({
|
24438
24442
|
height = 0,
|
24439
24443
|
barMainConfiguration = {
|
24444
|
+
followSlider: false,
|
24440
24445
|
header: "Placeholder",
|
24441
24446
|
color_primary: utils.colors.purple_600,
|
24442
24447
|
color_secondary: utils.colors.purple_50,
|
@@ -24449,9 +24454,16 @@ const UnitLinkGraph = ({
|
|
24449
24454
|
}
|
24450
24455
|
]
|
24451
24456
|
},
|
24457
|
+
setBarMainActionsActive = () => {
|
24458
|
+
},
|
24459
|
+
barMainActionsActive = 0,
|
24452
24460
|
barSecondaryConfiguration,
|
24461
|
+
setBarSecondaryActionsActive = () => {
|
24462
|
+
},
|
24463
|
+
barSecondaryActionsActive = 0,
|
24453
24464
|
initialSliderValue = 0,
|
24454
24465
|
maximum_ani = 7,
|
24466
|
+
limit_ani = 7,
|
24455
24467
|
timeline_texts = {
|
24456
24468
|
left: "Placeholder"
|
24457
24469
|
},
|
@@ -24466,6 +24478,13 @@ const UnitLinkGraph = ({
|
|
24466
24478
|
const [mainWidth, setMainWidth] = React.useState(0);
|
24467
24479
|
const [mainStart, setMainStart] = React.useState(0);
|
24468
24480
|
const [sliderValue, setSliderValue] = React.useState(initialSliderValue);
|
24481
|
+
const place_at_ani = React.useMemo(() => {
|
24482
|
+
if (barMainConfiguration.followSlider) {
|
24483
|
+
return sliderValue;
|
24484
|
+
} else {
|
24485
|
+
return barMainConfiguration.place_at_ani;
|
24486
|
+
}
|
24487
|
+
}, [barMainConfiguration, sliderValue]);
|
24469
24488
|
const configurations = React.useMemo(() => {
|
24470
24489
|
return {
|
24471
24490
|
mainGap: 16,
|
@@ -24708,7 +24727,7 @@ const UnitLinkGraph = ({
|
|
24708
24727
|
({ mainHeight }) => {
|
24709
24728
|
const MANY_SEGMENTS_PER_YEAR = 2;
|
24710
24729
|
const segments_count = (configurations.area.indicators.count - 1) * MANY_SEGMENTS_PER_YEAR;
|
24711
|
-
const segments_render =
|
24730
|
+
const segments_render = place_at_ani * 2;
|
24712
24731
|
const segments_padding_y = 4.5;
|
24713
24732
|
const segments_y = floorToHalf(
|
24714
24733
|
totalHeight - mainHeight + segments_padding_y + configurations.mainGap
|
@@ -24746,13 +24765,7 @@ const UnitLinkGraph = ({
|
|
24746
24765
|
}
|
24747
24766
|
};
|
24748
24767
|
},
|
24749
|
-
[
|
24750
|
-
mainWidth,
|
24751
|
-
mainStart,
|
24752
|
-
configurations,
|
24753
|
-
totalHeight,
|
24754
|
-
barMainConfiguration.place_at_ani
|
24755
|
-
]
|
24768
|
+
[mainWidth, mainStart, configurations, totalHeight, place_at_ani]
|
24756
24769
|
);
|
24757
24770
|
const computeAction = React.useCallback(
|
24758
24771
|
({
|
@@ -24806,7 +24819,7 @@ const UnitLinkGraph = ({
|
|
24806
24819
|
mainHeightGraph,
|
24807
24820
|
config: barMainConfiguration,
|
24808
24821
|
getPointsPositionIndicatorX,
|
24809
|
-
place_at:
|
24822
|
+
place_at: place_at_ani,
|
24810
24823
|
main: true
|
24811
24824
|
});
|
24812
24825
|
let bar_secondary;
|
@@ -24869,62 +24882,68 @@ const UnitLinkGraph = ({
|
|
24869
24882
|
},
|
24870
24883
|
...rest,
|
24871
24884
|
children: [
|
24872
|
-
/* @__PURE__ */ jsxRuntime.
|
24873
|
-
|
24874
|
-
|
24875
|
-
|
24876
|
-
|
24877
|
-
|
24878
|
-
|
24879
|
-
|
24880
|
-
|
24881
|
-
|
24882
|
-
|
24883
|
-
|
24884
|
-
|
24885
|
-
|
24886
|
-
|
24887
|
-
|
24888
|
-
|
24889
|
-
|
24890
|
-
|
24891
|
-
|
24892
|
-
|
24893
|
-
|
24894
|
-
|
24895
|
-
|
24896
|
-
|
24897
|
-
|
24898
|
-
|
24899
|
-
|
24900
|
-
|
24901
|
-
|
24902
|
-
|
24903
|
-
|
24904
|
-
|
24905
|
-
|
24906
|
-
|
24907
|
-
|
24908
|
-
|
24885
|
+
place_at_ani > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
24886
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
24887
|
+
"line",
|
24888
|
+
{
|
24889
|
+
x1: graph.main.area.part_1.x1,
|
24890
|
+
x2: graph.main.area.part_1.x2,
|
24891
|
+
y1: graph.main.area.part_1.y1,
|
24892
|
+
y2: graph.main.area.part_1.y2,
|
24893
|
+
strokeWidth: graph.main.area.part_1.strokeWidth,
|
24894
|
+
stroke: graph.main.bars.main.colorPrimary
|
24895
|
+
}
|
24896
|
+
),
|
24897
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
24898
|
+
"line",
|
24899
|
+
{
|
24900
|
+
x1: graph.main.area.part_2.x1,
|
24901
|
+
x2: graph.main.area.part_2.x2,
|
24902
|
+
y1: graph.main.area.part_2.y1,
|
24903
|
+
y2: graph.main.area.part_2.y2,
|
24904
|
+
strokeWidth: graph.main.area.part_2.strokeWidth,
|
24905
|
+
stroke: graph.main.bars.main.colorPrimary
|
24906
|
+
}
|
24907
|
+
),
|
24908
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
24909
|
+
"line",
|
24910
|
+
{
|
24911
|
+
x1: graph.main.area.part_3.x1,
|
24912
|
+
x2: graph.main.area.part_3.x2,
|
24913
|
+
y1: graph.main.area.part_3.y1,
|
24914
|
+
y2: graph.main.area.part_3.y2,
|
24915
|
+
strokeWidth: graph.main.area.part_3.strokeWidth,
|
24916
|
+
stroke: graph.main.bars.main.colorPrimary
|
24917
|
+
}
|
24918
|
+
),
|
24919
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
24920
|
+
"polygon",
|
24921
|
+
{
|
24922
|
+
points: `
|
24909
24923
|
${graph.main.area.part_2.x2},${graph.main.bars.main.filled_y + 1.5}
|
24910
24924
|
${graph.main.area.part_3.x2},${graph.main.bars.main.filled_y + 1.5}
|
24911
24925
|
${graph.main.area.part_3.x2},${graph.mainHeightGraph}
|
24912
24926
|
${graph.main.area.part_2.x1},${graph.mainHeightGraph}`,
|
24913
|
-
|
24914
|
-
|
24915
|
-
|
24927
|
+
fill: graph.main.bars.main.colorSecondary
|
24928
|
+
}
|
24929
|
+
)
|
24930
|
+
] }),
|
24916
24931
|
/* @__PURE__ */ jsxRuntime.jsx(
|
24917
24932
|
RenderBar,
|
24918
24933
|
{
|
24919
24934
|
bar: graph.main.bars.main,
|
24920
|
-
textLineHeight: configurations.bars.actionsTextLineHeight
|
24935
|
+
textLineHeight: configurations.bars.actionsTextLineHeight,
|
24936
|
+
activeAction: barMainActionsActive,
|
24937
|
+
setActiveAction: (value) => setBarMainActionsActive(value)
|
24921
24938
|
}
|
24922
24939
|
),
|
24923
24940
|
graph.main.bars.secondary && /* @__PURE__ */ jsxRuntime.jsx(
|
24924
24941
|
RenderBar,
|
24925
24942
|
{
|
24926
24943
|
bar: graph.main.bars.secondary,
|
24927
|
-
textLineHeight: configurations.bars.actionsTextLineHeight
|
24944
|
+
textLineHeight: configurations.bars.actionsTextLineHeight,
|
24945
|
+
activeAction: barSecondaryActionsActive,
|
24946
|
+
setActiveAction: (value) => setBarSecondaryActionsActive(value)
|
24928
24947
|
}
|
24929
24948
|
),
|
24930
24949
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -25034,15 +25053,20 @@ const UnitLinkGraph = ({
|
|
25034
25053
|
max: configurations.area.indicators.count - 1,
|
25035
25054
|
value: sliderValue,
|
25036
25055
|
onChange: setSliderValue,
|
25037
|
-
limit:
|
25056
|
+
limit: limit_ani
|
25038
25057
|
}
|
25039
25058
|
)
|
25040
25059
|
]
|
25041
25060
|
}
|
25042
25061
|
);
|
25043
25062
|
};
|
25044
|
-
const RenderBar = ({
|
25045
|
-
|
25063
|
+
const RenderBar = ({
|
25064
|
+
bar,
|
25065
|
+
textLineHeight,
|
25066
|
+
activeAction = 0,
|
25067
|
+
setActiveAction = () => {
|
25068
|
+
}
|
25069
|
+
}) => {
|
25046
25070
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
25047
25071
|
/* @__PURE__ */ jsxRuntime.jsx(
|
25048
25072
|
"rect",
|
@@ -25078,12 +25102,12 @@ const RenderBar = ({ bar, textLineHeight }) => {
|
|
25078
25102
|
}
|
25079
25103
|
),
|
25080
25104
|
bar.barActions.actions.map((action, index) => {
|
25081
|
-
const isActive =
|
25105
|
+
const isActive = activeAction === index;
|
25082
25106
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
25083
25107
|
"g",
|
25084
25108
|
{
|
25085
25109
|
className: "bar-actions-group",
|
25086
|
-
onClick: () =>
|
25110
|
+
onClick: () => setActiveAction(index),
|
25087
25111
|
children: [
|
25088
25112
|
/* @__PURE__ */ jsxRuntime.jsx(
|
25089
25113
|
"rect",
|
@@ -12,37 +12,41 @@ const StyledBar = styled.div`
|
|
12
12
|
width: 100%;
|
13
13
|
position: relative;
|
14
14
|
overflow: hidden;
|
15
|
+
display: flex;
|
15
16
|
height: ${(props) => props.$height && _constraint_height.includes(props.$height) ? props.$height + "px" : "24px"};
|
16
|
-
background-color: ${(props) => props.$
|
17
|
+
background-color: ${(props) => props.$backgroundColor && Object.keys(colors).includes(props.$backgroundColor) ? colors[props.$backgroundColor] : colors.gray_60};
|
17
18
|
border-radius: ${(props) => props.$radius && _constraint_radius.includes(props.$radius) ? props.$radius + "px" : "4px"};
|
18
|
-
|
19
|
-
&:after {
|
20
|
-
content: "";
|
21
|
-
width: ${(props) => typeof props.$value === "number" ? props.$value * 100 + "%" : "50%"};
|
22
|
-
height: 100%;
|
23
|
-
position: absolute;
|
24
|
-
top: 0;
|
25
|
-
left: 0;
|
26
|
-
background-color: ${(props) => props.$leftColor && Object.keys(colors).includes(props.$leftColor) ? colors[props.$leftColor] : colors.gray_950};
|
27
|
-
}
|
28
19
|
`;
|
29
20
|
const Bar = ({
|
30
|
-
value = 0,
|
31
|
-
leftColor = "gray_950",
|
32
|
-
rightColor = "gray_60",
|
33
21
|
height = 24,
|
34
22
|
radius = 4,
|
23
|
+
backgroundColor = "gray_60",
|
24
|
+
max = 100,
|
25
|
+
items = [],
|
35
26
|
...rest
|
36
27
|
}) => {
|
37
28
|
return /* @__PURE__ */ jsx(
|
38
29
|
StyledBar,
|
39
30
|
{
|
40
|
-
$
|
41
|
-
$leftColor: leftColor,
|
42
|
-
$rightColor: rightColor,
|
31
|
+
$backgroundColor: backgroundColor,
|
43
32
|
$height: height,
|
44
33
|
$radius: radius,
|
45
|
-
...rest
|
34
|
+
...rest,
|
35
|
+
children: items.length > 0 && items.map((item, index) => {
|
36
|
+
const thisColor = colors[item.color] || colors.gray_950;
|
37
|
+
const percentage = item.value / max * 100;
|
38
|
+
return /* @__PURE__ */ jsx(
|
39
|
+
"div",
|
40
|
+
{
|
41
|
+
style: {
|
42
|
+
width: `${percentage}%`,
|
43
|
+
height: "100%",
|
44
|
+
backgroundColor: thisColor
|
45
|
+
}
|
46
|
+
},
|
47
|
+
index
|
48
|
+
);
|
49
|
+
})
|
46
50
|
}
|
47
51
|
);
|
48
52
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
"use client";
|
3
3
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
4
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
5
5
|
import { useMemo, useRef, useState, useEffect, useCallback } from 'react';
|
6
6
|
import styled from 'styled-components';
|
7
7
|
import { colors } from '../../utils';
|
@@ -57,6 +57,7 @@ const UnitLinkGraphStyled = styled.svg`
|
|
57
57
|
const UnitLinkGraph = ({
|
58
58
|
height = 0,
|
59
59
|
barMainConfiguration = {
|
60
|
+
followSlider: false,
|
60
61
|
header: "Placeholder",
|
61
62
|
color_primary: colors.purple_600,
|
62
63
|
color_secondary: colors.purple_50,
|
@@ -69,9 +70,16 @@ const UnitLinkGraph = ({
|
|
69
70
|
}
|
70
71
|
]
|
71
72
|
},
|
73
|
+
setBarMainActionsActive = () => {
|
74
|
+
},
|
75
|
+
barMainActionsActive = 0,
|
72
76
|
barSecondaryConfiguration,
|
77
|
+
setBarSecondaryActionsActive = () => {
|
78
|
+
},
|
79
|
+
barSecondaryActionsActive = 0,
|
73
80
|
initialSliderValue = 0,
|
74
81
|
maximum_ani = 7,
|
82
|
+
limit_ani = 7,
|
75
83
|
timeline_texts = {
|
76
84
|
left: "Placeholder"
|
77
85
|
},
|
@@ -86,6 +94,13 @@ const UnitLinkGraph = ({
|
|
86
94
|
const [mainWidth, setMainWidth] = useState(0);
|
87
95
|
const [mainStart, setMainStart] = useState(0);
|
88
96
|
const [sliderValue, setSliderValue] = useState(initialSliderValue);
|
97
|
+
const place_at_ani = useMemo(() => {
|
98
|
+
if (barMainConfiguration.followSlider) {
|
99
|
+
return sliderValue;
|
100
|
+
} else {
|
101
|
+
return barMainConfiguration.place_at_ani;
|
102
|
+
}
|
103
|
+
}, [barMainConfiguration, sliderValue]);
|
89
104
|
const configurations = useMemo(() => {
|
90
105
|
return {
|
91
106
|
mainGap: 16,
|
@@ -328,7 +343,7 @@ const UnitLinkGraph = ({
|
|
328
343
|
({ mainHeight }) => {
|
329
344
|
const MANY_SEGMENTS_PER_YEAR = 2;
|
330
345
|
const segments_count = (configurations.area.indicators.count - 1) * MANY_SEGMENTS_PER_YEAR;
|
331
|
-
const segments_render =
|
346
|
+
const segments_render = place_at_ani * 2;
|
332
347
|
const segments_padding_y = 4.5;
|
333
348
|
const segments_y = floorToHalf(
|
334
349
|
totalHeight - mainHeight + segments_padding_y + configurations.mainGap
|
@@ -366,13 +381,7 @@ const UnitLinkGraph = ({
|
|
366
381
|
}
|
367
382
|
};
|
368
383
|
},
|
369
|
-
[
|
370
|
-
mainWidth,
|
371
|
-
mainStart,
|
372
|
-
configurations,
|
373
|
-
totalHeight,
|
374
|
-
barMainConfiguration.place_at_ani
|
375
|
-
]
|
384
|
+
[mainWidth, mainStart, configurations, totalHeight, place_at_ani]
|
376
385
|
);
|
377
386
|
const computeAction = useCallback(
|
378
387
|
({
|
@@ -426,7 +435,7 @@ const UnitLinkGraph = ({
|
|
426
435
|
mainHeightGraph,
|
427
436
|
config: barMainConfiguration,
|
428
437
|
getPointsPositionIndicatorX,
|
429
|
-
place_at:
|
438
|
+
place_at: place_at_ani,
|
430
439
|
main: true
|
431
440
|
});
|
432
441
|
let bar_secondary;
|
@@ -489,62 +498,68 @@ const UnitLinkGraph = ({
|
|
489
498
|
},
|
490
499
|
...rest,
|
491
500
|
children: [
|
492
|
-
/* @__PURE__ */
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
501
|
+
place_at_ani > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
502
|
+
/* @__PURE__ */ jsx(
|
503
|
+
"line",
|
504
|
+
{
|
505
|
+
x1: graph.main.area.part_1.x1,
|
506
|
+
x2: graph.main.area.part_1.x2,
|
507
|
+
y1: graph.main.area.part_1.y1,
|
508
|
+
y2: graph.main.area.part_1.y2,
|
509
|
+
strokeWidth: graph.main.area.part_1.strokeWidth,
|
510
|
+
stroke: graph.main.bars.main.colorPrimary
|
511
|
+
}
|
512
|
+
),
|
513
|
+
/* @__PURE__ */ jsx(
|
514
|
+
"line",
|
515
|
+
{
|
516
|
+
x1: graph.main.area.part_2.x1,
|
517
|
+
x2: graph.main.area.part_2.x2,
|
518
|
+
y1: graph.main.area.part_2.y1,
|
519
|
+
y2: graph.main.area.part_2.y2,
|
520
|
+
strokeWidth: graph.main.area.part_2.strokeWidth,
|
521
|
+
stroke: graph.main.bars.main.colorPrimary
|
522
|
+
}
|
523
|
+
),
|
524
|
+
/* @__PURE__ */ jsx(
|
525
|
+
"line",
|
526
|
+
{
|
527
|
+
x1: graph.main.area.part_3.x1,
|
528
|
+
x2: graph.main.area.part_3.x2,
|
529
|
+
y1: graph.main.area.part_3.y1,
|
530
|
+
y2: graph.main.area.part_3.y2,
|
531
|
+
strokeWidth: graph.main.area.part_3.strokeWidth,
|
532
|
+
stroke: graph.main.bars.main.colorPrimary
|
533
|
+
}
|
534
|
+
),
|
535
|
+
/* @__PURE__ */ jsx(
|
536
|
+
"polygon",
|
537
|
+
{
|
538
|
+
points: `
|
529
539
|
${graph.main.area.part_2.x2},${graph.main.bars.main.filled_y + 1.5}
|
530
540
|
${graph.main.area.part_3.x2},${graph.main.bars.main.filled_y + 1.5}
|
531
541
|
${graph.main.area.part_3.x2},${graph.mainHeightGraph}
|
532
542
|
${graph.main.area.part_2.x1},${graph.mainHeightGraph}`,
|
533
|
-
|
534
|
-
|
535
|
-
|
543
|
+
fill: graph.main.bars.main.colorSecondary
|
544
|
+
}
|
545
|
+
)
|
546
|
+
] }),
|
536
547
|
/* @__PURE__ */ jsx(
|
537
548
|
RenderBar,
|
538
549
|
{
|
539
550
|
bar: graph.main.bars.main,
|
540
|
-
textLineHeight: configurations.bars.actionsTextLineHeight
|
551
|
+
textLineHeight: configurations.bars.actionsTextLineHeight,
|
552
|
+
activeAction: barMainActionsActive,
|
553
|
+
setActiveAction: (value) => setBarMainActionsActive(value)
|
541
554
|
}
|
542
555
|
),
|
543
556
|
graph.main.bars.secondary && /* @__PURE__ */ jsx(
|
544
557
|
RenderBar,
|
545
558
|
{
|
546
559
|
bar: graph.main.bars.secondary,
|
547
|
-
textLineHeight: configurations.bars.actionsTextLineHeight
|
560
|
+
textLineHeight: configurations.bars.actionsTextLineHeight,
|
561
|
+
activeAction: barSecondaryActionsActive,
|
562
|
+
setActiveAction: (value) => setBarSecondaryActionsActive(value)
|
548
563
|
}
|
549
564
|
),
|
550
565
|
/* @__PURE__ */ jsx(
|
@@ -654,15 +669,20 @@ const UnitLinkGraph = ({
|
|
654
669
|
max: configurations.area.indicators.count - 1,
|
655
670
|
value: sliderValue,
|
656
671
|
onChange: setSliderValue,
|
657
|
-
limit:
|
672
|
+
limit: limit_ani
|
658
673
|
}
|
659
674
|
)
|
660
675
|
]
|
661
676
|
}
|
662
677
|
);
|
663
678
|
};
|
664
|
-
const RenderBar = ({
|
665
|
-
|
679
|
+
const RenderBar = ({
|
680
|
+
bar,
|
681
|
+
textLineHeight,
|
682
|
+
activeAction = 0,
|
683
|
+
setActiveAction = () => {
|
684
|
+
}
|
685
|
+
}) => {
|
666
686
|
return /* @__PURE__ */ jsxs("g", { children: [
|
667
687
|
/* @__PURE__ */ jsx(
|
668
688
|
"rect",
|
@@ -698,12 +718,12 @@ const RenderBar = ({ bar, textLineHeight }) => {
|
|
698
718
|
}
|
699
719
|
),
|
700
720
|
bar.barActions.actions.map((action, index) => {
|
701
|
-
const isActive =
|
721
|
+
const isActive = activeAction === index;
|
702
722
|
return /* @__PURE__ */ jsxs(
|
703
723
|
"g",
|
704
724
|
{
|
705
725
|
className: "bar-actions-group",
|
706
|
-
onClick: () =>
|
726
|
+
onClick: () => setActiveAction(index),
|
707
727
|
children: [
|
708
728
|
/* @__PURE__ */ jsx(
|
709
729
|
"rect",
|
package/build/esm/index.js
CHANGED
@@ -2746,37 +2746,41 @@ const StyledBar = styled.div`
|
|
2746
2746
|
width: 100%;
|
2747
2747
|
position: relative;
|
2748
2748
|
overflow: hidden;
|
2749
|
+
display: flex;
|
2749
2750
|
height: ${(props) => props.$height && _constraint_height$1.includes(props.$height) ? props.$height + "px" : "24px"};
|
2750
|
-
background-color: ${(props) => props.$
|
2751
|
+
background-color: ${(props) => props.$backgroundColor && Object.keys(colors).includes(props.$backgroundColor) ? colors[props.$backgroundColor] : colors.gray_60};
|
2751
2752
|
border-radius: ${(props) => props.$radius && _constraint_radius.includes(props.$radius) ? props.$radius + "px" : "4px"};
|
2752
|
-
|
2753
|
-
&:after {
|
2754
|
-
content: "";
|
2755
|
-
width: ${(props) => typeof props.$value === "number" ? props.$value * 100 + "%" : "50%"};
|
2756
|
-
height: 100%;
|
2757
|
-
position: absolute;
|
2758
|
-
top: 0;
|
2759
|
-
left: 0;
|
2760
|
-
background-color: ${(props) => props.$leftColor && Object.keys(colors).includes(props.$leftColor) ? colors[props.$leftColor] : colors.gray_950};
|
2761
|
-
}
|
2762
2753
|
`;
|
2763
2754
|
const Bar = ({
|
2764
|
-
value = 0,
|
2765
|
-
leftColor = "gray_950",
|
2766
|
-
rightColor = "gray_60",
|
2767
2755
|
height = 24,
|
2768
2756
|
radius = 4,
|
2757
|
+
backgroundColor = "gray_60",
|
2758
|
+
max = 100,
|
2759
|
+
items = [],
|
2769
2760
|
...rest
|
2770
2761
|
}) => {
|
2771
2762
|
return /* @__PURE__ */ jsx(
|
2772
2763
|
StyledBar,
|
2773
2764
|
{
|
2774
|
-
$
|
2775
|
-
$leftColor: leftColor,
|
2776
|
-
$rightColor: rightColor,
|
2765
|
+
$backgroundColor: backgroundColor,
|
2777
2766
|
$height: height,
|
2778
2767
|
$radius: radius,
|
2779
|
-
...rest
|
2768
|
+
...rest,
|
2769
|
+
children: items.length > 0 && items.map((item, index) => {
|
2770
|
+
const thisColor = colors[item.color] || colors.gray_950;
|
2771
|
+
const percentage = item.value / max * 100;
|
2772
|
+
return /* @__PURE__ */ jsx(
|
2773
|
+
"div",
|
2774
|
+
{
|
2775
|
+
style: {
|
2776
|
+
width: `${percentage}%`,
|
2777
|
+
height: "100%",
|
2778
|
+
backgroundColor: thisColor
|
2779
|
+
}
|
2780
|
+
},
|
2781
|
+
index
|
2782
|
+
);
|
2783
|
+
})
|
2780
2784
|
}
|
2781
2785
|
);
|
2782
2786
|
};
|
@@ -24414,6 +24418,7 @@ const UnitLinkGraphStyled = styled.svg`
|
|
24414
24418
|
const UnitLinkGraph = ({
|
24415
24419
|
height = 0,
|
24416
24420
|
barMainConfiguration = {
|
24421
|
+
followSlider: false,
|
24417
24422
|
header: "Placeholder",
|
24418
24423
|
color_primary: colors.purple_600,
|
24419
24424
|
color_secondary: colors.purple_50,
|
@@ -24426,9 +24431,16 @@ const UnitLinkGraph = ({
|
|
24426
24431
|
}
|
24427
24432
|
]
|
24428
24433
|
},
|
24434
|
+
setBarMainActionsActive = () => {
|
24435
|
+
},
|
24436
|
+
barMainActionsActive = 0,
|
24429
24437
|
barSecondaryConfiguration,
|
24438
|
+
setBarSecondaryActionsActive = () => {
|
24439
|
+
},
|
24440
|
+
barSecondaryActionsActive = 0,
|
24430
24441
|
initialSliderValue = 0,
|
24431
24442
|
maximum_ani = 7,
|
24443
|
+
limit_ani = 7,
|
24432
24444
|
timeline_texts = {
|
24433
24445
|
left: "Placeholder"
|
24434
24446
|
},
|
@@ -24443,6 +24455,13 @@ const UnitLinkGraph = ({
|
|
24443
24455
|
const [mainWidth, setMainWidth] = useState(0);
|
24444
24456
|
const [mainStart, setMainStart] = useState(0);
|
24445
24457
|
const [sliderValue, setSliderValue] = useState(initialSliderValue);
|
24458
|
+
const place_at_ani = useMemo(() => {
|
24459
|
+
if (barMainConfiguration.followSlider) {
|
24460
|
+
return sliderValue;
|
24461
|
+
} else {
|
24462
|
+
return barMainConfiguration.place_at_ani;
|
24463
|
+
}
|
24464
|
+
}, [barMainConfiguration, sliderValue]);
|
24446
24465
|
const configurations = useMemo(() => {
|
24447
24466
|
return {
|
24448
24467
|
mainGap: 16,
|
@@ -24685,7 +24704,7 @@ const UnitLinkGraph = ({
|
|
24685
24704
|
({ mainHeight }) => {
|
24686
24705
|
const MANY_SEGMENTS_PER_YEAR = 2;
|
24687
24706
|
const segments_count = (configurations.area.indicators.count - 1) * MANY_SEGMENTS_PER_YEAR;
|
24688
|
-
const segments_render =
|
24707
|
+
const segments_render = place_at_ani * 2;
|
24689
24708
|
const segments_padding_y = 4.5;
|
24690
24709
|
const segments_y = floorToHalf(
|
24691
24710
|
totalHeight - mainHeight + segments_padding_y + configurations.mainGap
|
@@ -24723,13 +24742,7 @@ const UnitLinkGraph = ({
|
|
24723
24742
|
}
|
24724
24743
|
};
|
24725
24744
|
},
|
24726
|
-
[
|
24727
|
-
mainWidth,
|
24728
|
-
mainStart,
|
24729
|
-
configurations,
|
24730
|
-
totalHeight,
|
24731
|
-
barMainConfiguration.place_at_ani
|
24732
|
-
]
|
24745
|
+
[mainWidth, mainStart, configurations, totalHeight, place_at_ani]
|
24733
24746
|
);
|
24734
24747
|
const computeAction = useCallback(
|
24735
24748
|
({
|
@@ -24783,7 +24796,7 @@ const UnitLinkGraph = ({
|
|
24783
24796
|
mainHeightGraph,
|
24784
24797
|
config: barMainConfiguration,
|
24785
24798
|
getPointsPositionIndicatorX,
|
24786
|
-
place_at:
|
24799
|
+
place_at: place_at_ani,
|
24787
24800
|
main: true
|
24788
24801
|
});
|
24789
24802
|
let bar_secondary;
|
@@ -24846,62 +24859,68 @@ const UnitLinkGraph = ({
|
|
24846
24859
|
},
|
24847
24860
|
...rest,
|
24848
24861
|
children: [
|
24849
|
-
/* @__PURE__ */
|
24850
|
-
|
24851
|
-
|
24852
|
-
|
24853
|
-
|
24854
|
-
|
24855
|
-
|
24856
|
-
|
24857
|
-
|
24858
|
-
|
24859
|
-
|
24860
|
-
|
24861
|
-
|
24862
|
-
|
24863
|
-
|
24864
|
-
|
24865
|
-
|
24866
|
-
|
24867
|
-
|
24868
|
-
|
24869
|
-
|
24870
|
-
|
24871
|
-
|
24872
|
-
|
24873
|
-
|
24874
|
-
|
24875
|
-
|
24876
|
-
|
24877
|
-
|
24878
|
-
|
24879
|
-
|
24880
|
-
|
24881
|
-
|
24882
|
-
|
24883
|
-
|
24884
|
-
|
24885
|
-
|
24862
|
+
place_at_ani > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
24863
|
+
/* @__PURE__ */ jsx(
|
24864
|
+
"line",
|
24865
|
+
{
|
24866
|
+
x1: graph.main.area.part_1.x1,
|
24867
|
+
x2: graph.main.area.part_1.x2,
|
24868
|
+
y1: graph.main.area.part_1.y1,
|
24869
|
+
y2: graph.main.area.part_1.y2,
|
24870
|
+
strokeWidth: graph.main.area.part_1.strokeWidth,
|
24871
|
+
stroke: graph.main.bars.main.colorPrimary
|
24872
|
+
}
|
24873
|
+
),
|
24874
|
+
/* @__PURE__ */ jsx(
|
24875
|
+
"line",
|
24876
|
+
{
|
24877
|
+
x1: graph.main.area.part_2.x1,
|
24878
|
+
x2: graph.main.area.part_2.x2,
|
24879
|
+
y1: graph.main.area.part_2.y1,
|
24880
|
+
y2: graph.main.area.part_2.y2,
|
24881
|
+
strokeWidth: graph.main.area.part_2.strokeWidth,
|
24882
|
+
stroke: graph.main.bars.main.colorPrimary
|
24883
|
+
}
|
24884
|
+
),
|
24885
|
+
/* @__PURE__ */ jsx(
|
24886
|
+
"line",
|
24887
|
+
{
|
24888
|
+
x1: graph.main.area.part_3.x1,
|
24889
|
+
x2: graph.main.area.part_3.x2,
|
24890
|
+
y1: graph.main.area.part_3.y1,
|
24891
|
+
y2: graph.main.area.part_3.y2,
|
24892
|
+
strokeWidth: graph.main.area.part_3.strokeWidth,
|
24893
|
+
stroke: graph.main.bars.main.colorPrimary
|
24894
|
+
}
|
24895
|
+
),
|
24896
|
+
/* @__PURE__ */ jsx(
|
24897
|
+
"polygon",
|
24898
|
+
{
|
24899
|
+
points: `
|
24886
24900
|
${graph.main.area.part_2.x2},${graph.main.bars.main.filled_y + 1.5}
|
24887
24901
|
${graph.main.area.part_3.x2},${graph.main.bars.main.filled_y + 1.5}
|
24888
24902
|
${graph.main.area.part_3.x2},${graph.mainHeightGraph}
|
24889
24903
|
${graph.main.area.part_2.x1},${graph.mainHeightGraph}`,
|
24890
|
-
|
24891
|
-
|
24892
|
-
|
24904
|
+
fill: graph.main.bars.main.colorSecondary
|
24905
|
+
}
|
24906
|
+
)
|
24907
|
+
] }),
|
24893
24908
|
/* @__PURE__ */ jsx(
|
24894
24909
|
RenderBar,
|
24895
24910
|
{
|
24896
24911
|
bar: graph.main.bars.main,
|
24897
|
-
textLineHeight: configurations.bars.actionsTextLineHeight
|
24912
|
+
textLineHeight: configurations.bars.actionsTextLineHeight,
|
24913
|
+
activeAction: barMainActionsActive,
|
24914
|
+
setActiveAction: (value) => setBarMainActionsActive(value)
|
24898
24915
|
}
|
24899
24916
|
),
|
24900
24917
|
graph.main.bars.secondary && /* @__PURE__ */ jsx(
|
24901
24918
|
RenderBar,
|
24902
24919
|
{
|
24903
24920
|
bar: graph.main.bars.secondary,
|
24904
|
-
textLineHeight: configurations.bars.actionsTextLineHeight
|
24921
|
+
textLineHeight: configurations.bars.actionsTextLineHeight,
|
24922
|
+
activeAction: barSecondaryActionsActive,
|
24923
|
+
setActiveAction: (value) => setBarSecondaryActionsActive(value)
|
24905
24924
|
}
|
24906
24925
|
),
|
24907
24926
|
/* @__PURE__ */ jsx(
|
@@ -25011,15 +25030,20 @@ const UnitLinkGraph = ({
|
|
25011
25030
|
max: configurations.area.indicators.count - 1,
|
25012
25031
|
value: sliderValue,
|
25013
25032
|
onChange: setSliderValue,
|
25014
|
-
limit:
|
25033
|
+
limit: limit_ani
|
25015
25034
|
}
|
25016
25035
|
)
|
25017
25036
|
]
|
25018
25037
|
}
|
25019
25038
|
);
|
25020
25039
|
};
|
25021
|
-
const RenderBar = ({
|
25022
|
-
|
25040
|
+
const RenderBar = ({
|
25041
|
+
bar,
|
25042
|
+
textLineHeight,
|
25043
|
+
activeAction = 0,
|
25044
|
+
setActiveAction = () => {
|
25045
|
+
}
|
25046
|
+
}) => {
|
25023
25047
|
return /* @__PURE__ */ jsxs("g", { children: [
|
25024
25048
|
/* @__PURE__ */ jsx(
|
25025
25049
|
"rect",
|
@@ -25055,12 +25079,12 @@ const RenderBar = ({ bar, textLineHeight }) => {
|
|
25055
25079
|
}
|
25056
25080
|
),
|
25057
25081
|
bar.barActions.actions.map((action, index) => {
|
25058
|
-
const isActive =
|
25082
|
+
const isActive = activeAction === index;
|
25059
25083
|
return /* @__PURE__ */ jsxs(
|
25060
25084
|
"g",
|
25061
25085
|
{
|
25062
25086
|
className: "bar-actions-group",
|
25063
|
-
onClick: () =>
|
25087
|
+
onClick: () => setActiveAction(index),
|
25064
25088
|
children: [
|
25065
25089
|
/* @__PURE__ */ jsx(
|
25066
25090
|
"rect",
|
@@ -2,11 +2,14 @@ import React, { HTMLAttributes } from 'react';
|
|
2
2
|
import { colors } from '../../utils/colors.js';
|
3
3
|
|
4
4
|
interface BarProps extends HTMLAttributes<HTMLDivElement> {
|
5
|
-
value?: number;
|
6
|
-
leftColor?: keyof typeof colors;
|
7
|
-
rightColor?: keyof typeof colors;
|
8
5
|
height?: 8 | 12 | 16 | 24 | 32 | 40;
|
9
6
|
radius?: 2 | 4 | 8 | 12 | 16;
|
7
|
+
backgroundColor?: keyof typeof colors;
|
8
|
+
max?: number;
|
9
|
+
items?: {
|
10
|
+
value: number;
|
11
|
+
color: keyof typeof colors;
|
12
|
+
}[];
|
10
13
|
}
|
11
14
|
declare const Bar: React.FC<BarProps>;
|
12
15
|
|
@@ -14,9 +14,15 @@ interface UnitLinkGraphProps extends HTMLAttributes<SVGSVGElement> {
|
|
14
14
|
height?: number;
|
15
15
|
barMainConfiguration: BarConfiguration & {
|
16
16
|
place_at_ani: number;
|
17
|
+
followSlider?: boolean;
|
17
18
|
};
|
19
|
+
setBarMainActionsActive?: (value: number) => void;
|
20
|
+
barMainActionsActive?: number;
|
18
21
|
barSecondaryConfiguration?: BarConfiguration;
|
22
|
+
setBarSecondaryActionsActive?: (value: number) => void;
|
23
|
+
barSecondaryActionsActive?: number;
|
19
24
|
maximum_ani?: number;
|
25
|
+
limit_ani?: number;
|
20
26
|
timeline_texts?: {
|
21
27
|
left: string;
|
22
28
|
right?: string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rbro-tat-uds",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.1.0",
|
4
4
|
"type": "module",
|
5
5
|
"main": "build/cjs/index.cjs",
|
6
6
|
"module": "build/esm/index.js",
|
@@ -12,7 +12,7 @@
|
|
12
12
|
"sideEffects": false,
|
13
13
|
"scripts": {
|
14
14
|
"publish:local-raw": "npm publish --registry http://localhost:4873",
|
15
|
-
"publish:local-clear": "npm unpublish rbro-tat-uds
|
15
|
+
"publish:local-clear": "npm unpublish rbro-tat-uds@2.0.0 --registry http://localhost:4873 --force",
|
16
16
|
"publish:local": "npm run publish:local-clear && npm run publish:local-raw"
|
17
17
|
},
|
18
18
|
"peerDependencies": {
|
@@ -66,6 +66,14 @@
|
|
66
66
|
"default": "./build/cjs/utils/colors.cjs"
|
67
67
|
}
|
68
68
|
},
|
69
|
+
"./types/*": {
|
70
|
+
"import": {
|
71
|
+
"types": "./build/types/components/*"
|
72
|
+
},
|
73
|
+
"require": {
|
74
|
+
"types": "./build/types/components/*"
|
75
|
+
}
|
76
|
+
},
|
69
77
|
"./esm": null,
|
70
78
|
"./modern": null
|
71
79
|
}
|