sag_components 2.0.0-beta75 → 2.0.0-beta77
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/dist/index.esm.js +190 -169
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +190 -169
- package/dist/index.js.map +1 -1
- package/dist/types/components/BubbleChart/BubbleChart.stories.d.ts +1 -0
- package/dist/types/components/TabMenu/TabMenu.d.ts +1 -1
- package/dist/types/components/TabMenu/TabMenu.stories.d.ts +27 -37
- package/dist/types/components/TabMenu/TabMenu.style.d.ts +2 -34
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3472,154 +3472,6 @@ const LinnerDataBox = props => {
|
|
|
3472
3472
|
}))));
|
|
3473
3473
|
};
|
|
3474
3474
|
|
|
3475
|
-
const SagIconButtonWrapper = styled.button`
|
|
3476
|
-
height: ${props => props.height};
|
|
3477
|
-
font-size: 14px;
|
|
3478
|
-
font-weight: 400;
|
|
3479
|
-
display: flex;
|
|
3480
|
-
gap: 8px;
|
|
3481
|
-
align-items: center;
|
|
3482
|
-
justify-content: center;
|
|
3483
|
-
padding: 8px 18px;
|
|
3484
|
-
white-space: nowrap;
|
|
3485
|
-
color: ${props => props.color};
|
|
3486
|
-
border-radius: 8px;
|
|
3487
|
-
border: 1px solid ${props => props.color};
|
|
3488
|
-
background: ${props => props.backgroundColor ? props.backgroundColor : 'transparent'};
|
|
3489
|
-
transition: box-shadow 0.3s ease;
|
|
3490
|
-
&:hover, &:focus {
|
|
3491
|
-
cursor: pointer;
|
|
3492
|
-
box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.1);
|
|
3493
|
-
}
|
|
3494
|
-
`;
|
|
3495
|
-
const SpanText$1 = styled.span`
|
|
3496
|
-
`;
|
|
3497
|
-
|
|
3498
|
-
const SagIconButton = props => {
|
|
3499
|
-
const {
|
|
3500
|
-
iconName,
|
|
3501
|
-
color,
|
|
3502
|
-
backgroundColor,
|
|
3503
|
-
activeColor,
|
|
3504
|
-
height,
|
|
3505
|
-
buttonText,
|
|
3506
|
-
iconWidth,
|
|
3507
|
-
iconHeight,
|
|
3508
|
-
disabled,
|
|
3509
|
-
openState,
|
|
3510
|
-
onButtonClick,
|
|
3511
|
-
className
|
|
3512
|
-
} = props;
|
|
3513
|
-
const [activeState, setActiveState] = useState(openState);
|
|
3514
|
-
const onClickHandler = event => {
|
|
3515
|
-
onButtonClick(event);
|
|
3516
|
-
setActiveState(prevState => !prevState);
|
|
3517
|
-
};
|
|
3518
|
-
const getIcon = icon => {
|
|
3519
|
-
switch (icon.toLowerCase()) {
|
|
3520
|
-
case 'filter':
|
|
3521
|
-
return /*#__PURE__*/React$1.createElement(FilterIcon, {
|
|
3522
|
-
height: iconHeight,
|
|
3523
|
-
width: iconWidth,
|
|
3524
|
-
color: activeState ? activeColor : color
|
|
3525
|
-
});
|
|
3526
|
-
case 'options':
|
|
3527
|
-
return /*#__PURE__*/React$1.createElement(OptionsIcon, {
|
|
3528
|
-
height: iconHeight,
|
|
3529
|
-
width: iconWidth,
|
|
3530
|
-
color: activeState ? activeColor : color
|
|
3531
|
-
});
|
|
3532
|
-
case 'download':
|
|
3533
|
-
return /*#__PURE__*/React$1.createElement(DownloadIcon, {
|
|
3534
|
-
height: iconHeight,
|
|
3535
|
-
width: iconWidth,
|
|
3536
|
-
color: activeState ? activeColor : color
|
|
3537
|
-
});
|
|
3538
|
-
case 'document':
|
|
3539
|
-
return /*#__PURE__*/React$1.createElement(DocumentIcon, {
|
|
3540
|
-
height: iconHeight,
|
|
3541
|
-
width: iconWidth,
|
|
3542
|
-
color: activeState ? activeColor : color
|
|
3543
|
-
});
|
|
3544
|
-
case 'fly':
|
|
3545
|
-
return /*#__PURE__*/React$1.createElement(FlyIcon, {
|
|
3546
|
-
height: iconHeight,
|
|
3547
|
-
width: iconWidth,
|
|
3548
|
-
color: activeState ? activeColor : color
|
|
3549
|
-
});
|
|
3550
|
-
case 'bell':
|
|
3551
|
-
return /*#__PURE__*/React$1.createElement(BellIcon, {
|
|
3552
|
-
height: iconHeight,
|
|
3553
|
-
width: iconWidth,
|
|
3554
|
-
color: activeState ? activeColor : color
|
|
3555
|
-
});
|
|
3556
|
-
case 'maintenance':
|
|
3557
|
-
return /*#__PURE__*/React$1.createElement(MaintenanceIcon, {
|
|
3558
|
-
height: iconHeight,
|
|
3559
|
-
width: iconWidth,
|
|
3560
|
-
color: activeState ? activeColor : color
|
|
3561
|
-
});
|
|
3562
|
-
case 'exit':
|
|
3563
|
-
return /*#__PURE__*/React$1.createElement(ExitIcon, {
|
|
3564
|
-
height: iconHeight,
|
|
3565
|
-
width: iconWidth,
|
|
3566
|
-
color: activeState ? activeColor : color
|
|
3567
|
-
});
|
|
3568
|
-
case 'eye':
|
|
3569
|
-
return /*#__PURE__*/React$1.createElement(EyeIcon, {
|
|
3570
|
-
height: iconHeight,
|
|
3571
|
-
width: iconWidth,
|
|
3572
|
-
color: activeState ? activeColor : color
|
|
3573
|
-
});
|
|
3574
|
-
default:
|
|
3575
|
-
return /*#__PURE__*/React$1.createElement(EyeIcon, {
|
|
3576
|
-
height: iconHeight,
|
|
3577
|
-
width: iconWidth,
|
|
3578
|
-
color: activeState ? activeColor : color
|
|
3579
|
-
});
|
|
3580
|
-
}
|
|
3581
|
-
};
|
|
3582
|
-
return /*#__PURE__*/React$1.createElement(SagIconButtonWrapper, {
|
|
3583
|
-
className: className,
|
|
3584
|
-
height: height,
|
|
3585
|
-
color: activeState ? activeColor : color,
|
|
3586
|
-
backgroundColor: backgroundColor,
|
|
3587
|
-
disabled: disabled,
|
|
3588
|
-
onClick: event => {
|
|
3589
|
-
onClickHandler(event);
|
|
3590
|
-
}
|
|
3591
|
-
}, getIcon(iconName), buttonText && /*#__PURE__*/React$1.createElement(SpanText$1, null, buttonText));
|
|
3592
|
-
};
|
|
3593
|
-
SagIconButton.propTypes = {
|
|
3594
|
-
className: PropTypes.string,
|
|
3595
|
-
iconName: PropTypes.string,
|
|
3596
|
-
buttonText: PropTypes.string,
|
|
3597
|
-
height: PropTypes.string,
|
|
3598
|
-
color: PropTypes.string,
|
|
3599
|
-
backgroundColor: PropTypes.string,
|
|
3600
|
-
activeColor: PropTypes.string,
|
|
3601
|
-
iconHeight: PropTypes.number,
|
|
3602
|
-
iconWidth: PropTypes.number,
|
|
3603
|
-
openState: PropTypes.bool,
|
|
3604
|
-
disabled: PropTypes.bool,
|
|
3605
|
-
onButtonClick: PropTypes.func
|
|
3606
|
-
};
|
|
3607
|
-
SagIconButton.defaultProps = {
|
|
3608
|
-
className: '',
|
|
3609
|
-
iconName: 'filter',
|
|
3610
|
-
buttonText: 'Filter',
|
|
3611
|
-
height: '40px',
|
|
3612
|
-
color: '#212121',
|
|
3613
|
-
activeColor: '#229E38',
|
|
3614
|
-
backgroundColor: 'transparent',
|
|
3615
|
-
// '#E8F5EB',
|
|
3616
|
-
iconHeight: 12,
|
|
3617
|
-
iconWidth: 12,
|
|
3618
|
-
openState: false,
|
|
3619
|
-
disabled: false,
|
|
3620
|
-
onButtonClick: () => {}
|
|
3621
|
-
};
|
|
3622
|
-
|
|
3623
3475
|
const TextFieldContainer = styled.div`
|
|
3624
3476
|
position: relative;
|
|
3625
3477
|
width: ${props => props.width};
|
|
@@ -3728,16 +3580,6 @@ const TopRow = styled.div`
|
|
|
3728
3580
|
display: flex;
|
|
3729
3581
|
align-items: center;
|
|
3730
3582
|
gap: 20px;
|
|
3731
|
-
`;
|
|
3732
|
-
const Headline$1 = styled.span`
|
|
3733
|
-
font-size: 18px;
|
|
3734
|
-
font-weight: 500;
|
|
3735
|
-
margin-right: auto;
|
|
3736
|
-
`;
|
|
3737
|
-
const Nav = styled.nav`
|
|
3738
|
-
display: flex;
|
|
3739
|
-
flex-direction: row;
|
|
3740
|
-
|
|
3741
3583
|
`;
|
|
3742
3584
|
const TabActionLine = styled.div`
|
|
3743
3585
|
margin-left: auto;
|
|
@@ -3745,20 +3587,28 @@ const TabActionLine = styled.div`
|
|
|
3745
3587
|
align-items: center;
|
|
3746
3588
|
height: 100%;
|
|
3747
3589
|
`;
|
|
3590
|
+
const Headline$1 = styled.span`
|
|
3591
|
+
font-size: 18px;
|
|
3592
|
+
font-weight: 500;
|
|
3593
|
+
margin-right: auto;
|
|
3594
|
+
`;
|
|
3748
3595
|
const Tabs = styled.div`
|
|
3749
3596
|
position: relative;
|
|
3750
3597
|
display: flex;
|
|
3751
3598
|
align-items: center;
|
|
3752
3599
|
width: 100%;
|
|
3753
3600
|
`;
|
|
3754
|
-
const Tab = styled.
|
|
3601
|
+
const Tab = styled.button`
|
|
3755
3602
|
cursor: pointer;
|
|
3756
3603
|
position: relative;
|
|
3757
3604
|
text-align: center;
|
|
3758
3605
|
padding: 8px 12px;
|
|
3759
3606
|
font-size: 16px;
|
|
3760
3607
|
color: #000000;
|
|
3608
|
+
border: none;
|
|
3761
3609
|
border-bottom: 2px solid #D0D0D0;
|
|
3610
|
+
background: transparent;
|
|
3611
|
+
z-index: 2;
|
|
3762
3612
|
&.active {
|
|
3763
3613
|
font-weight: 600;
|
|
3764
3614
|
color: ${props => props.color};
|
|
@@ -3816,12 +3666,158 @@ const ActionsWrapper = styled.div`
|
|
|
3816
3666
|
gap: 10px;
|
|
3817
3667
|
width: 100%;
|
|
3818
3668
|
`;
|
|
3819
|
-
const SagIconButtonWrap = styled(SagIconButton)`
|
|
3820
|
-
`;
|
|
3821
3669
|
const SearchInputWrap = styled(SearchInput)`
|
|
3822
3670
|
margin-left: auto;
|
|
3823
3671
|
`;
|
|
3824
3672
|
|
|
3673
|
+
const SagIconButtonWrapper = styled.button`
|
|
3674
|
+
height: ${props => props.height};
|
|
3675
|
+
font-size: 14px;
|
|
3676
|
+
font-weight: 400;
|
|
3677
|
+
display: flex;
|
|
3678
|
+
gap: 8px;
|
|
3679
|
+
align-items: center;
|
|
3680
|
+
justify-content: center;
|
|
3681
|
+
padding: 8px 18px;
|
|
3682
|
+
white-space: nowrap;
|
|
3683
|
+
color: ${props => props.color};
|
|
3684
|
+
border-radius: 8px;
|
|
3685
|
+
border: 1px solid ${props => props.color};
|
|
3686
|
+
background: ${props => props.backgroundColor ? props.backgroundColor : 'transparent'};
|
|
3687
|
+
transition: box-shadow 0.3s ease;
|
|
3688
|
+
&:hover, &:focus {
|
|
3689
|
+
cursor: pointer;
|
|
3690
|
+
box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.1);
|
|
3691
|
+
}
|
|
3692
|
+
`;
|
|
3693
|
+
const SpanText$1 = styled.span`
|
|
3694
|
+
`;
|
|
3695
|
+
|
|
3696
|
+
const SagIconButton = props => {
|
|
3697
|
+
const {
|
|
3698
|
+
iconName,
|
|
3699
|
+
color,
|
|
3700
|
+
backgroundColor,
|
|
3701
|
+
activeColor,
|
|
3702
|
+
height,
|
|
3703
|
+
buttonText,
|
|
3704
|
+
iconWidth,
|
|
3705
|
+
iconHeight,
|
|
3706
|
+
disabled,
|
|
3707
|
+
openState,
|
|
3708
|
+
onButtonClick,
|
|
3709
|
+
className
|
|
3710
|
+
} = props;
|
|
3711
|
+
const [activeState, setActiveState] = useState(openState);
|
|
3712
|
+
const onClickHandler = event => {
|
|
3713
|
+
onButtonClick(event);
|
|
3714
|
+
setActiveState(prevState => !prevState);
|
|
3715
|
+
};
|
|
3716
|
+
const getIcon = icon => {
|
|
3717
|
+
switch (icon.toLowerCase()) {
|
|
3718
|
+
case 'filter':
|
|
3719
|
+
return /*#__PURE__*/React$1.createElement(FilterIcon, {
|
|
3720
|
+
height: iconHeight,
|
|
3721
|
+
width: iconWidth,
|
|
3722
|
+
color: activeState ? activeColor : color
|
|
3723
|
+
});
|
|
3724
|
+
case 'options':
|
|
3725
|
+
return /*#__PURE__*/React$1.createElement(OptionsIcon, {
|
|
3726
|
+
height: iconHeight,
|
|
3727
|
+
width: iconWidth,
|
|
3728
|
+
color: activeState ? activeColor : color
|
|
3729
|
+
});
|
|
3730
|
+
case 'download':
|
|
3731
|
+
return /*#__PURE__*/React$1.createElement(DownloadIcon, {
|
|
3732
|
+
height: iconHeight,
|
|
3733
|
+
width: iconWidth,
|
|
3734
|
+
color: activeState ? activeColor : color
|
|
3735
|
+
});
|
|
3736
|
+
case 'document':
|
|
3737
|
+
return /*#__PURE__*/React$1.createElement(DocumentIcon, {
|
|
3738
|
+
height: iconHeight,
|
|
3739
|
+
width: iconWidth,
|
|
3740
|
+
color: activeState ? activeColor : color
|
|
3741
|
+
});
|
|
3742
|
+
case 'fly':
|
|
3743
|
+
return /*#__PURE__*/React$1.createElement(FlyIcon, {
|
|
3744
|
+
height: iconHeight,
|
|
3745
|
+
width: iconWidth,
|
|
3746
|
+
color: activeState ? activeColor : color
|
|
3747
|
+
});
|
|
3748
|
+
case 'bell':
|
|
3749
|
+
return /*#__PURE__*/React$1.createElement(BellIcon, {
|
|
3750
|
+
height: iconHeight,
|
|
3751
|
+
width: iconWidth,
|
|
3752
|
+
color: activeState ? activeColor : color
|
|
3753
|
+
});
|
|
3754
|
+
case 'maintenance':
|
|
3755
|
+
return /*#__PURE__*/React$1.createElement(MaintenanceIcon, {
|
|
3756
|
+
height: iconHeight,
|
|
3757
|
+
width: iconWidth,
|
|
3758
|
+
color: activeState ? activeColor : color
|
|
3759
|
+
});
|
|
3760
|
+
case 'exit':
|
|
3761
|
+
return /*#__PURE__*/React$1.createElement(ExitIcon, {
|
|
3762
|
+
height: iconHeight,
|
|
3763
|
+
width: iconWidth,
|
|
3764
|
+
color: activeState ? activeColor : color
|
|
3765
|
+
});
|
|
3766
|
+
case 'eye':
|
|
3767
|
+
return /*#__PURE__*/React$1.createElement(EyeIcon, {
|
|
3768
|
+
height: iconHeight,
|
|
3769
|
+
width: iconWidth,
|
|
3770
|
+
color: activeState ? activeColor : color
|
|
3771
|
+
});
|
|
3772
|
+
default:
|
|
3773
|
+
return /*#__PURE__*/React$1.createElement(EyeIcon, {
|
|
3774
|
+
height: iconHeight,
|
|
3775
|
+
width: iconWidth,
|
|
3776
|
+
color: activeState ? activeColor : color
|
|
3777
|
+
});
|
|
3778
|
+
}
|
|
3779
|
+
};
|
|
3780
|
+
return /*#__PURE__*/React$1.createElement(SagIconButtonWrapper, {
|
|
3781
|
+
className: className,
|
|
3782
|
+
height: height,
|
|
3783
|
+
color: activeState ? activeColor : color,
|
|
3784
|
+
backgroundColor: backgroundColor,
|
|
3785
|
+
disabled: disabled,
|
|
3786
|
+
onClick: event => {
|
|
3787
|
+
onClickHandler(event);
|
|
3788
|
+
}
|
|
3789
|
+
}, getIcon(iconName), buttonText && /*#__PURE__*/React$1.createElement(SpanText$1, null, buttonText));
|
|
3790
|
+
};
|
|
3791
|
+
SagIconButton.propTypes = {
|
|
3792
|
+
className: PropTypes.string,
|
|
3793
|
+
iconName: PropTypes.string,
|
|
3794
|
+
buttonText: PropTypes.string,
|
|
3795
|
+
height: PropTypes.string,
|
|
3796
|
+
color: PropTypes.string,
|
|
3797
|
+
backgroundColor: PropTypes.string,
|
|
3798
|
+
activeColor: PropTypes.string,
|
|
3799
|
+
iconHeight: PropTypes.number,
|
|
3800
|
+
iconWidth: PropTypes.number,
|
|
3801
|
+
openState: PropTypes.bool,
|
|
3802
|
+
disabled: PropTypes.bool,
|
|
3803
|
+
onButtonClick: PropTypes.func
|
|
3804
|
+
};
|
|
3805
|
+
SagIconButton.defaultProps = {
|
|
3806
|
+
className: '',
|
|
3807
|
+
iconName: 'filter',
|
|
3808
|
+
buttonText: 'Filter',
|
|
3809
|
+
height: '40px',
|
|
3810
|
+
color: '#212121',
|
|
3811
|
+
activeColor: '#229E38',
|
|
3812
|
+
backgroundColor: 'transparent',
|
|
3813
|
+
// '#E8F5EB',
|
|
3814
|
+
iconHeight: 12,
|
|
3815
|
+
iconWidth: 12,
|
|
3816
|
+
openState: false,
|
|
3817
|
+
disabled: false,
|
|
3818
|
+
onButtonClick: () => {}
|
|
3819
|
+
};
|
|
3820
|
+
|
|
3825
3821
|
const TabMenu = props => {
|
|
3826
3822
|
const {
|
|
3827
3823
|
activeColor,
|
|
@@ -3829,7 +3825,6 @@ const TabMenu = props => {
|
|
|
3829
3825
|
className,
|
|
3830
3826
|
color,
|
|
3831
3827
|
currentTab,
|
|
3832
|
-
headlineInsteadTabs,
|
|
3833
3828
|
headlineText,
|
|
3834
3829
|
inputWidth,
|
|
3835
3830
|
onFilterButtonClick,
|
|
@@ -3861,14 +3856,14 @@ const TabMenu = props => {
|
|
|
3861
3856
|
}, [currentTab]);
|
|
3862
3857
|
return /*#__PURE__*/React$1.createElement(TabMenuContainer, {
|
|
3863
3858
|
className: className
|
|
3864
|
-
}, /*#__PURE__*/React$1.createElement(TopRow, null, showFilterButton && /*#__PURE__*/React$1.createElement(
|
|
3859
|
+
}, /*#__PURE__*/React$1.createElement(TopRow, null, showFilterButton && /*#__PURE__*/React$1.createElement(SagIconButton, {
|
|
3865
3860
|
id: "filterButton",
|
|
3866
3861
|
iconName: "Filter",
|
|
3867
3862
|
buttonText: "",
|
|
3868
3863
|
openState: panelIsOpen,
|
|
3869
3864
|
activeColor: activeColor,
|
|
3870
3865
|
onButtonClick: onFilterButtonClick
|
|
3871
|
-
}),
|
|
3866
|
+
}), headlineText && headlineText !== '' ? /*#__PURE__*/React$1.createElement(Headline$1, null, headlineText) : /*#__PURE__*/React$1.createElement("nav", {
|
|
3872
3867
|
className: "Nav"
|
|
3873
3868
|
}, /*#__PURE__*/React$1.createElement(Tabs, {
|
|
3874
3869
|
className: "Tabs"
|
|
@@ -30354,6 +30349,13 @@ const BubbleChart = _ref => {
|
|
|
30354
30349
|
const distance = Math.max(Math.abs(max - median), Math.abs(min - median));
|
|
30355
30350
|
return [median - distance, median + distance];
|
|
30356
30351
|
};
|
|
30352
|
+
|
|
30353
|
+
// const calculateDomainBasedOnMedian = (min, max, median) => {
|
|
30354
|
+
// // Always include all data points, and add a small padding
|
|
30355
|
+
// const padding = (max - min) * 0.1 || 1; // fallback to 1 if min==max
|
|
30356
|
+
// return [min - padding, max + padding];
|
|
30357
|
+
// };
|
|
30358
|
+
|
|
30357
30359
|
const xDom = calculateDomainBasedOnMedian(minX, maxX, medianX);
|
|
30358
30360
|
const yDom = calculateDomainBasedOnMedian(minY, maxY, medianY);
|
|
30359
30361
|
|
|
@@ -30795,10 +30797,10 @@ const BubbleChart = _ref => {
|
|
|
30795
30797
|
onMouseMove: handleChartMouseMove,
|
|
30796
30798
|
cursor: curosrMouse,
|
|
30797
30799
|
margin: {
|
|
30798
|
-
top:
|
|
30800
|
+
top: 80,
|
|
30799
30801
|
right: 190,
|
|
30800
|
-
bottom:
|
|
30801
|
-
left:
|
|
30802
|
+
bottom: 80,
|
|
30803
|
+
left: 190
|
|
30802
30804
|
},
|
|
30803
30805
|
"data-testid": "scatter-chart"
|
|
30804
30806
|
}, renderGradients(), /*#__PURE__*/React$1.createElement(XAxis, {
|
|
@@ -30854,7 +30856,7 @@ const BubbleChart = _ref => {
|
|
|
30854
30856
|
label: xMedian >= viewDomain.x[0] && xMedian <= viewDomain.x[1] ? {
|
|
30855
30857
|
value: topHeader,
|
|
30856
30858
|
position: "top",
|
|
30857
|
-
offset:
|
|
30859
|
+
offset: 60,
|
|
30858
30860
|
fill: '#484A4C',
|
|
30859
30861
|
fontSize: 16,
|
|
30860
30862
|
fontWeight: 500
|
|
@@ -30880,7 +30882,7 @@ const BubbleChart = _ref => {
|
|
|
30880
30882
|
label: xMedian >= viewDomain.x[0] && xMedian <= viewDomain.x[1] ? {
|
|
30881
30883
|
value: bottomHeader,
|
|
30882
30884
|
position: "bottom",
|
|
30883
|
-
offset:
|
|
30885
|
+
offset: 60,
|
|
30884
30886
|
fill: '#484A4C',
|
|
30885
30887
|
fontSize: 16,
|
|
30886
30888
|
fontWeight: 500
|
|
@@ -30993,6 +30995,25 @@ const BubbleChart = _ref => {
|
|
|
30993
30995
|
// Calculate the exact position of the median point in the SVG
|
|
30994
30996
|
const xPos = viewBox.x + (xMedian - viewDomain.x[0]) / (viewDomain.x[1] - viewDomain.x[0]) * viewBox.width;
|
|
30995
30997
|
const yPos = viewBox.y + (1 - (yMedian - viewDomain.y[0]) / (viewDomain.y[1] - viewDomain.y[0])) * viewBox.height;
|
|
30998
|
+
|
|
30999
|
+
// Calculate normalized position of median in domain
|
|
31000
|
+
// const xNorm = (xMedian - viewDomain.x[0]) / (viewDomain.x[1] - viewDomain.x[0]);
|
|
31001
|
+
// const yNorm = (yMedian - viewDomain.y[0]) / (viewDomain.y[1] - viewDomain.y[0]);
|
|
31002
|
+
|
|
31003
|
+
// // If median is within 2% of the edge, center the label
|
|
31004
|
+
// const isXEdge = xNorm < 0.02 || xNorm > 0.98;
|
|
31005
|
+
// const isYEdge = yNorm < 0.02 || yNorm > 0.98;
|
|
31006
|
+
|
|
31007
|
+
// let xPos, yPos;
|
|
31008
|
+
// if (isXEdge || isYEdge) {
|
|
31009
|
+
// // Center of SVG
|
|
31010
|
+
// xPos = viewBox.x + viewBox.width / 2;
|
|
31011
|
+
// yPos = viewBox.y + viewBox.height / 2;
|
|
31012
|
+
// } else {
|
|
31013
|
+
// // Median's data position
|
|
31014
|
+
// xPos = viewBox.x + xNorm * viewBox.width;
|
|
31015
|
+
// yPos = viewBox.y + (1 - yNorm) * viewBox.height;
|
|
31016
|
+
// }
|
|
30996
31017
|
return /*#__PURE__*/React$1.createElement("text", {
|
|
30997
31018
|
x: xPos,
|
|
30998
31019
|
y: yPos,
|