@rio-cloud/rio-uikit 1.2.2 → 1.4.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/.DS_Store +0 -0
- package/ChartLabel.d.ts +2 -0
- package/ChartLabel.js +2 -0
- package/ComposedChart.d.ts +2 -0
- package/ComposedChart.js +2 -0
- package/DateRangePicker.d.ts +6 -7
- package/DateRangePicker.js +7 -3
- package/GroupedItemList.d.ts +2 -0
- package/GroupedItemList.js +2 -0
- package/LicensePlate.d.ts +2 -0
- package/LicensePlate.js +2 -0
- package/README.md +3 -3
- package/ReferenceLine.d.ts +2 -0
- package/ReferenceLine.js +2 -0
- package/components/actionBarItem/ActionBarItem.js +5 -1
- package/components/actionBarItem/ActionBarItemIcon.d.ts +6 -8
- package/components/actionBarItem/ActionBarItemIcon.js +4 -4
- package/components/actionBarItem/ActionBarOverlay.d.ts +3 -2
- package/components/actionBarItem/ActionBarOverlay.js +7 -7
- package/components/applicationLayout/ApplicationLayout.js +1 -0
- package/components/applicationLayout/ApplicationLayoutHeader.js +0 -4
- package/components/assetTree/TreeOptions.js +8 -4
- package/components/assetTree/treeUtils.js +1 -1
- package/components/calendarStripe/CalendarStripe.d.ts +8 -0
- package/components/calendarStripe/CalendarStripe.js +7 -4
- package/components/charts/Area.d.ts +5 -0
- package/components/charts/Area.js +1 -9
- package/components/charts/AreaChart.d.ts +2 -0
- package/components/charts/AreaChart.js +9 -6
- package/components/charts/BarChart.js +4 -4
- package/components/charts/ChartLabel.d.ts +5 -0
- package/components/charts/ChartLabel.js +2 -0
- package/components/charts/ComposedChart.d.ts +34 -0
- package/components/charts/ComposedChart.js +30 -0
- package/components/charts/Legend.d.ts +8 -10
- package/components/charts/Legend.js +3 -12
- package/components/charts/Line.d.ts +5 -0
- package/components/charts/Line.js +1 -9
- package/components/charts/LineChart.d.ts +2 -0
- package/components/charts/LineChart.js +8 -5
- package/components/charts/PieChart.js +5 -5
- package/components/charts/RadialBarChart.js +5 -5
- package/components/charts/ReferenceLine.d.ts +7 -0
- package/components/charts/ReferenceLine.js +2 -0
- package/components/dataTabs/DataTab.js +2 -1
- package/components/dialog/Dialog.d.ts +12 -4
- package/components/dialog/SimpleDialog.d.ts +2 -2
- package/components/dialog/SplitDialog.d.ts +6 -0
- package/components/expander/ExpanderList.js +2 -1
- package/components/groupedItemList/GroupedItemList.d.ts +79 -0
- package/components/groupedItemList/GroupedItemList.js +77 -0
- package/components/licensePlate/LicensePlate.d.ts +19 -0
- package/components/licensePlate/LicensePlate.js +14 -0
- package/components/listMenu/ListMenu.js +1 -1
- package/components/onboarding/OnboardingTip.d.ts +2 -2
- package/components/onboarding/OnboardingTip.js +2 -0
- package/components/overlay/OverlayTrigger.d.ts +92 -3
- package/components/overlay/OverlayTrigger.js +140 -8
- package/components/popover/Popover.d.ts +27 -9
- package/components/popover/Popover.js +18 -5
- package/components/selects/BaseSelectDropdown.d.ts +1 -0
- package/components/selects/BaseSelectDropdown.js +16 -14
- package/components/selects/Multiselect.d.ts +5 -0
- package/components/selects/Multiselect.js +2 -2
- package/components/selects/Select.d.ts +5 -0
- package/components/selects/Select.js +2 -2
- package/components/slider/RangeSlider.d.ts +7 -0
- package/components/slider/RangeSlider.js +10 -4
- package/components/slider/Slider.d.ts +7 -0
- package/components/slider/Slider.js +5 -3
- package/components/states/CustomState.js +4 -5
- package/components/switch/Switch.d.ts +7 -0
- package/components/switch/Switch.js +4 -3
- package/components/tooltip/SimpleTooltip.d.ts +2 -2
- package/components/tooltip/Tooltip.d.ts +2 -2
- package/components/tooltip/Tooltip.js +6 -2
- package/hooks/useClickOutside.d.ts +1 -0
- package/hooks/useClickOutside.js +9 -3
- package/hooks/useElapsedTime.d.ts +26 -0
- package/hooks/useElapsedTime.js +36 -0
- package/hooks/useEvent.d.ts +1 -1
- package/hooks/useKey.d.ts +7 -4
- package/hooks/useKey.js +36 -8
- package/hooks/useTimeout.d.ts +5 -0
- package/hooks/useTimeout.js +39 -1
- package/hooks/useUncontrollable.d.ts +13 -0
- package/hooks/useUncontrollable.js +41 -0
- package/lib/es/ChartLabel.d.ts +2 -0
- package/lib/es/ChartLabel.js +7 -0
- package/lib/es/ComposedChart.d.ts +2 -0
- package/lib/es/ComposedChart.js +7 -0
- package/lib/es/DateRangePicker.d.ts +6 -7
- package/lib/es/DateRangePicker.js +5 -1
- package/lib/es/GroupedItemList.d.ts +2 -0
- package/lib/es/GroupedItemList.js +7 -0
- package/lib/es/LicensePlate.d.ts +2 -0
- package/lib/es/LicensePlate.js +7 -0
- package/lib/es/ReferenceLine.d.ts +2 -0
- package/lib/es/ReferenceLine.js +7 -0
- package/lib/es/components/actionBarItem/ActionBarItem.js +5 -1
- package/lib/es/components/actionBarItem/ActionBarItemIcon.d.ts +6 -8
- package/lib/es/components/actionBarItem/ActionBarItemIcon.js +4 -4
- package/lib/es/components/actionBarItem/ActionBarOverlay.d.ts +3 -2
- package/lib/es/components/actionBarItem/ActionBarOverlay.js +7 -7
- package/lib/es/components/applicationLayout/ApplicationLayout.js +1 -0
- package/lib/es/components/applicationLayout/ApplicationLayoutHeader.js +0 -4
- package/lib/es/components/assetTree/TreeOptions.js +8 -4
- package/lib/es/components/assetTree/treeUtils.js +1 -1
- package/lib/es/components/calendarStripe/CalendarStripe.d.ts +8 -0
- package/lib/es/components/calendarStripe/CalendarStripe.js +7 -4
- package/lib/es/components/charts/Area.d.ts +5 -0
- package/lib/es/components/charts/Area.js +1 -9
- package/lib/es/components/charts/AreaChart.d.ts +2 -0
- package/lib/es/components/charts/AreaChart.js +7 -4
- package/lib/es/components/charts/BarChart.js +3 -3
- package/lib/es/components/charts/ChartLabel.d.ts +5 -0
- package/lib/es/components/charts/ChartLabel.js +4 -0
- package/lib/es/components/charts/ComposedChart.d.ts +34 -0
- package/lib/es/components/charts/ComposedChart.js +32 -0
- package/lib/es/components/charts/Legend.d.ts +8 -10
- package/lib/es/components/charts/Legend.js +5 -12
- package/lib/es/components/charts/Line.d.ts +5 -0
- package/lib/es/components/charts/Line.js +1 -9
- package/lib/es/components/charts/LineChart.d.ts +2 -0
- package/lib/es/components/charts/LineChart.js +7 -4
- package/lib/es/components/charts/PieChart.js +4 -4
- package/lib/es/components/charts/RadialBarChart.js +4 -4
- package/lib/es/components/charts/ReferenceLine.d.ts +7 -0
- package/lib/es/components/charts/ReferenceLine.js +4 -0
- package/lib/es/components/dataTabs/DataTab.js +2 -1
- package/lib/es/components/dialog/Dialog.d.ts +12 -4
- package/lib/es/components/dialog/SimpleDialog.d.ts +2 -2
- package/lib/es/components/dialog/SplitDialog.d.ts +6 -0
- package/lib/es/components/expander/ExpanderList.js +2 -1
- package/lib/es/components/groupedItemList/GroupedItemList.d.ts +79 -0
- package/lib/es/components/groupedItemList/GroupedItemList.js +80 -0
- package/lib/es/components/licensePlate/LicensePlate.d.ts +19 -0
- package/lib/es/components/licensePlate/LicensePlate.js +16 -0
- package/lib/es/components/listMenu/ListMenu.js +1 -1
- package/lib/es/components/onboarding/OnboardingTip.d.ts +2 -2
- package/lib/es/components/onboarding/OnboardingTip.js +2 -0
- package/lib/es/components/overlay/OverlayTrigger.d.ts +92 -3
- package/lib/es/components/overlay/OverlayTrigger.js +139 -7
- package/lib/es/components/popover/Popover.d.ts +27 -9
- package/lib/es/components/popover/Popover.js +20 -6
- package/lib/es/components/selects/BaseSelectDropdown.d.ts +1 -0
- package/lib/es/components/selects/BaseSelectDropdown.js +16 -14
- package/lib/es/components/selects/Multiselect.d.ts +5 -0
- package/lib/es/components/selects/Multiselect.js +2 -2
- package/lib/es/components/selects/Select.d.ts +5 -0
- package/lib/es/components/selects/Select.js +2 -2
- package/lib/es/components/slider/RangeSlider.d.ts +7 -0
- package/lib/es/components/slider/RangeSlider.js +10 -4
- package/lib/es/components/slider/Slider.d.ts +7 -0
- package/lib/es/components/slider/Slider.js +5 -3
- package/lib/es/components/states/CustomState.js +4 -5
- package/lib/es/components/switch/Switch.d.ts +7 -0
- package/lib/es/components/switch/Switch.js +4 -3
- package/lib/es/components/tooltip/SimpleTooltip.d.ts +2 -2
- package/lib/es/components/tooltip/Tooltip.d.ts +2 -2
- package/lib/es/components/tooltip/Tooltip.js +5 -1
- package/lib/es/hooks/useClickOutside.d.ts +1 -0
- package/lib/es/hooks/useClickOutside.js +11 -3
- package/lib/es/hooks/useElapsedTime.d.ts +26 -0
- package/lib/es/hooks/useElapsedTime.js +38 -0
- package/lib/es/hooks/useEvent.d.ts +1 -1
- package/lib/es/hooks/useKey.d.ts +7 -4
- package/lib/es/hooks/useKey.js +35 -7
- package/lib/es/hooks/useTimeout.d.ts +5 -0
- package/lib/es/hooks/useTimeout.js +40 -0
- package/lib/es/hooks/useUncontrollable.d.ts +13 -0
- package/lib/es/hooks/useUncontrollable.js +46 -0
- package/lib/es/styles/variables/colors/colors.json +3 -3
- package/lib/es/useElapsedTime.d.ts +2 -0
- package/lib/es/useElapsedTime.js +7 -0
- package/lib/es/utils/colorScheme.js +10 -8
- package/lib/es/utils/currentColors.d.ts +3 -0
- package/lib/es/utils/currentColors.js +14 -0
- package/lib/es/utils/hasUtilityClass.d.ts +30 -0
- package/lib/es/utils/hasUtilityClass.js +71 -0
- package/lib/es/utils/init/initCSS.js +12 -0
- package/lib/es/utils/mergeRefs.d.ts +1 -1
- package/lib/es/values/Trigger.d.ts +1 -2
- package/lib/es/version.json +1 -1
- package/package.json +26 -20
- package/styles/variables/colors/colors.json +3 -3
- package/useElapsedTime.d.ts +2 -0
- package/useElapsedTime.js +2 -0
- package/utils/colorScheme.js +10 -8
- package/utils/currentColors.d.ts +3 -0
- package/utils/currentColors.js +10 -0
- package/utils/hasUtilityClass.d.ts +30 -0
- package/utils/hasUtilityClass.js +40 -0
- package/utils/init/initCSS.js +12 -0
- package/utils/mergeRefs.d.ts +1 -1
- package/values/Trigger.d.ts +1 -2
- package/version.json +1 -1
- package/components/.DS_Store +0 -0
- package/components/feedback/Feedback.d.ts +0 -2
- package/components/feedback/Feedback.js +0 -5
- package/components/map/.DS_Store +0 -0
- package/components/map/components/.DS_Store +0 -0
- package/lib/.DS_Store +0 -0
- package/lib/es/.DS_Store +0 -0
- package/lib/es/components/.DS_Store +0 -0
- package/lib/es/components/feedback/Feedback.d.ts +0 -2
- package/lib/es/components/feedback/Feedback.js +0 -7
|
@@ -62,6 +62,14 @@ export type CalendarStripeProps = {
|
|
|
62
62
|
* Additional classes set to the calendar element.
|
|
63
63
|
*/
|
|
64
64
|
className?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Additional classes set to the days wrapper element.
|
|
67
|
+
*/
|
|
68
|
+
daysWrapperClassName?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Additional classes set to the days wrapper element.
|
|
71
|
+
*/
|
|
72
|
+
dayWrapperClassName?: string;
|
|
65
73
|
};
|
|
66
74
|
declare const CalendarStripe: React.ForwardRefExoticComponent<CalendarStripeProps & React.RefAttributes<HTMLDivElement>>;
|
|
67
75
|
export default CalendarStripe;
|
|
@@ -9,6 +9,7 @@ const noop_1 = tslib_1.__importDefault(require("lodash/noop"));
|
|
|
9
9
|
const useAfterMount_1 = tslib_1.__importDefault(require("../../hooks/useAfterMount"));
|
|
10
10
|
const useElementSize_1 = tslib_1.__importDefault(require("../../hooks/useElementSize"));
|
|
11
11
|
const usePrevious_1 = tslib_1.__importDefault(require("../../hooks/usePrevious"));
|
|
12
|
+
const hasUtilityClass_1 = require("../../utils/hasUtilityClass");
|
|
12
13
|
const DEFAULT_MIN_WITH = 200;
|
|
13
14
|
const DEFAULT_MIN_DAYS = 1;
|
|
14
15
|
const DEFAULT_MAX_DAYS = 7;
|
|
@@ -31,7 +32,7 @@ const getFirstColumnItem = (node) => {
|
|
|
31
32
|
return getFirstColumnItem(node.children[0]);
|
|
32
33
|
};
|
|
33
34
|
const CalendarStripe = (0, react_1.forwardRef)((props, ref) => {
|
|
34
|
-
const { minDayWith = DEFAULT_MIN_WITH, minDays = DEFAULT_MIN_DAYS, maxDays = DEFAULT_MAX_DAYS, render, renderDay, skipWeekends = false, startDate = new Date(), onNextClick = noop_1.default, onPreviousClick = noop_1.default, buttonClassName = '', className = '', } = props;
|
|
35
|
+
const { minDayWith = DEFAULT_MIN_WITH, minDays = DEFAULT_MIN_DAYS, maxDays = DEFAULT_MAX_DAYS, render, renderDay, skipWeekends = false, startDate = new Date(), onNextClick = noop_1.default, onPreviousClick = noop_1.default, buttonClassName = '', className = '', daysWrapperClassName = '', dayWrapperClassName = '', } = props;
|
|
35
36
|
if (render) {
|
|
36
37
|
console.warn('CalendarStripe has set the "render" prop deprecated. This will be removed in the upcoming releases,' +
|
|
37
38
|
' Please use the "renderDay" prop instead.');
|
|
@@ -117,8 +118,10 @@ const CalendarStripe = (0, react_1.forwardRef)((props, ref) => {
|
|
|
117
118
|
addDays = false;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
|
|
121
|
+
const wrapperClassNames = (0, classnames_1.default)('CalenderStripe', !(0, hasUtilityClass_1.hasDisplayClass)(className) && 'display-flex', !(0, hasUtilityClass_1.hasAlignItemsClass)(className) && 'align-items-center', !(0, hasUtilityClass_1.hasOverflowClass)(className) && 'overflow-hidden', !(0, hasUtilityClass_1.hasBgClass)(className) && 'bg-white', !(0, hasUtilityClass_1.hasBorderClass)(className) && 'border', !(0, hasUtilityClass_1.hasRoundedClass)(className) && 'rounded', className);
|
|
122
|
+
const baseButtonClassNames = (0, classnames_1.default)(!(0, hasUtilityClass_1.hasAlignItemsClass)(buttonClassName) && 'align-items-center', !(0, hasUtilityClass_1.hasDisplayClass)(buttonClassName) && 'display-flex', !(0, hasUtilityClass_1.hasHoverScaleClass)(buttonClassName) && 'hover-scale-105', !(0, hasUtilityClass_1.hasHoverTextColorClass)(buttonClassName) && 'hover-text-color-darkest', !(0, hasUtilityClass_1.hasPaddingClass)(buttonClassName) && 'padding-10', !(0, hasUtilityClass_1.hasCursorClass)(buttonClassName) && 'cursor-pointer', !(0, hasUtilityClass_1.hasTextColorClass)(buttonClassName) && 'text-color-darker', !(0, hasUtilityClass_1.hasTextSizeClass)(buttonClassName) && 'text-size-12', !(0, hasUtilityClass_1.hasAlignSelfClass)(buttonClassName) && 'align-self-stretch', buttonClassName);
|
|
123
|
+
const daysWrapperClassNames = (0, classnames_1.default)(!(0, hasUtilityClass_1.hasDisplayClass)(daysWrapperClassName) && 'display-flex', !(0, hasUtilityClass_1.hasSpaceClass)(daysWrapperClassName) && 'space-x--1', !(0, hasUtilityClass_1.hasUserSelectClass)(daysWrapperClassName) && 'user-select-none', daysWrapperClassName);
|
|
124
|
+
const dayWrapperClassNames = (0, classnames_1.default)(ITEM_NAME, !(0, hasUtilityClass_1.hasFlexClass)(dayWrapperClassName) && 'flex-1-1-0', !(0, hasUtilityClass_1.hasSpaceClass)(dayWrapperClassName) && 'space-x--1', !(0, hasUtilityClass_1.hasUserSelectClass)(dayWrapperClassName) && 'user-select-none', dayWrapperClassName);
|
|
125
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: wrapperClassNames }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: baseButtonClassNames, onClick: handlePrev }, { children: (0, jsx_runtime_1.jsx)("span", { className: 'rioglyph rioglyph-chevron-left' }) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'flex-1-1 overflow-hidden', ref: columnWrapperRef }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, Object.assign({ exitBeforeEnter: true, custom: animationDirection }, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, Object.assign({ variants: variants, initial: enableInitialAnimation ? 'pageEnter' : false, animate: 'pageCenter', custom: animationDirection, transition: { duration: ANIMATION_DURATION } }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: daysWrapperClassNames }, { children: dates.map(date => ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: dayWrapperClassNames }, { children: [renderDay ? renderDay(date) : null, render && react_1.default.cloneElement((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: render }), { date })] }), `${getDateString(date)}`))) })) }), getDateString(firstDate)) })) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: baseButtonClassNames, onClick: handleNext }, { children: (0, jsx_runtime_1.jsx)("span", { className: 'rioglyph rioglyph-chevron-right' }) }))] })));
|
|
123
126
|
});
|
|
124
127
|
exports.default = CalendarStripe;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import type { AreaProps as RechartsAreaProps } from 'recharts';
|
|
3
3
|
export type AreaProps = Omit<RechartsAreaProps, 'ref'> & {
|
|
4
4
|
strokeColor?: string;
|
|
5
|
+
dataKey?: string;
|
|
6
|
+
unit?: string;
|
|
7
|
+
legendType?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
isAnimationActive?: boolean;
|
|
5
10
|
};
|
|
6
11
|
declare const Area: React.FC<AreaProps>;
|
|
7
12
|
export default Area;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Area = () => null;
|
|
4
|
-
Area.defaultProps = {
|
|
5
|
-
dataKey: 'value',
|
|
6
|
-
unit: '',
|
|
7
|
-
strokeColor: 'color-coldplay-fountain',
|
|
8
|
-
legendType: 'square',
|
|
9
|
-
type: 'monotone',
|
|
10
|
-
isAnimationActive: true,
|
|
11
|
-
};
|
|
3
|
+
const Area = ({ dataKey = 'value', unit = '', strokeColor = 'color-coldplay-fountain', legendType = 'square', type = 'monotone', isAnimationActive = true, }) => null;
|
|
12
4
|
exports.default = Area;
|
|
@@ -6,6 +6,7 @@ import { type LegendProps } from './Legend';
|
|
|
6
6
|
import type { AreaProps } from './Area';
|
|
7
7
|
import type { GridProps } from './ChartGrid';
|
|
8
8
|
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
9
|
+
import type { ReferenceLineProps } from './ReferenceLine';
|
|
9
10
|
type RechartsAreaChartProps = React.ComponentProps<typeof RechartsAreaChart>;
|
|
10
11
|
export type AreaChartProps<T extends object> = Omit<RechartsAreaChartProps, 'data'> & {
|
|
11
12
|
width?: number;
|
|
@@ -15,6 +16,7 @@ export type AreaChartProps<T extends object> = Omit<RechartsAreaChartProps, 'dat
|
|
|
15
16
|
dataKey?: string | number | ((obj: T) => any);
|
|
16
17
|
gradients?: React.ReactElement<AreaGradientProps>[];
|
|
17
18
|
areas: React.ReactElement<AreaProps>[];
|
|
19
|
+
referenceLines?: React.ReactElement<ReferenceLineProps>[];
|
|
18
20
|
xAxisOptions?: XAxisProps;
|
|
19
21
|
yAxisOptions?: YAxisProps;
|
|
20
22
|
gridOptions?: GridProps;
|
|
@@ -10,9 +10,9 @@ const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
11
|
const AreaGradient_1 = tslib_1.__importStar(require("./AreaGradient"));
|
|
12
12
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
13
|
-
const Legend_1 =
|
|
13
|
+
const Legend_1 = require("./Legend");
|
|
14
14
|
const AreaChart = (props) => {
|
|
15
|
-
const { width, height, data = [], dataUnit = '', dataKey = 'value', gradients = [], areas = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "gradients", "areas", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
15
|
+
const { width, height, data = [], dataUnit = '', dataKey = 'value', gradients = [], areas = [], referenceLines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "gradients", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
16
16
|
const areasWithGradient = areas.map(area => {
|
|
17
17
|
const _a = area.props, { strokeColor } = _a, remainingAreaProps = tslib_1.__rest(_a, ["strokeColor"]);
|
|
18
18
|
const gradientId = area.key;
|
|
@@ -23,7 +23,10 @@ const AreaChart = (props) => {
|
|
|
23
23
|
};
|
|
24
24
|
});
|
|
25
25
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
26
|
-
const legendProps = (0, isObject_1.default)(legend) ? legend.props : {};
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.AreaChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [(0, jsx_runtime_1.jsxs)("defs", { children: [gradients, areasWithGradient.map(areaWithGradient => areaWithGradient.gradient)] }), showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(
|
|
26
|
+
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.AreaChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [(0, jsx_runtime_1.jsxs)("defs", { children: [gradients, areasWithGradient.map(areaWithGradient => areaWithGradient.gradient)] }), showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && legendProps && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ wrapperStyle: legendProps.verticalAlign === 'bottom' ? { bottom: 0 } : legendProps.wrapperStyle }, legendProps)) })), areasWithGradient.map(areaWithGradient => areaWithGradient.area), referenceLines.map(referenceLine => {
|
|
28
|
+
const _a = referenceLine.props, { stroke } = _a, remainingReferenceLineProps = tslib_1.__rest(_a, ["stroke"]);
|
|
29
|
+
return ((0, react_1.createElement)(recharts_1.ReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: (0, chartHelper_1.getColor)(stroke) })));
|
|
30
|
+
}), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
28
31
|
};
|
|
29
32
|
exports.default = AreaChart;
|
|
@@ -9,11 +9,11 @@ const isFunction_1 = tslib_1.__importDefault(require("lodash/fp/isFunction"));
|
|
|
9
9
|
const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
11
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
12
|
-
const Legend_1 =
|
|
12
|
+
const Legend_1 = require("./Legend");
|
|
13
13
|
const BarChart = (props) => {
|
|
14
14
|
const { width, height, data = [], dataUnit, dataKey = 'value', layout = 'horizontal', legend = false, bars = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showGrid = false, showXAxis = true, showYAxis = true, useDataColors = false, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "layout", "legend", "bars", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showGrid", "showXAxis", "showYAxis", "useDataColors", "brush", "tooltip"]);
|
|
15
15
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
16
|
-
const legendProps = (0, isObject_1.default)(legend) ? legend.props : {};
|
|
16
|
+
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
17
17
|
let legendPayload;
|
|
18
18
|
if (useDataColors) {
|
|
19
19
|
legendPayload = data.map((entry, index) => {
|
|
@@ -21,7 +21,7 @@ const BarChart = (props) => {
|
|
|
21
21
|
return Object.assign(Object.assign({}, entry), { value: (0, isFunction_1.default)(dataKey) ? dataKey(entry) : entry[dataKey], color: legendColor });
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, Object.assign({ layout: layout, width: width, height: height, data: data }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)),
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, Object.assign({ layout: layout, width: width, height: height, data: data }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({ cursor: { fill: chartHelper_1.CURSOR_BACKGROUND_COLOR } }, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ payload: useDataColors ? legendPayload : undefined }, legendProps)), bars.map(bar => {
|
|
25
25
|
const _a = bar.props, { color } = _a, remainingBarProps = tslib_1.__rest(_a, ["color"]);
|
|
26
26
|
const cellColor = color && (0, chartHelper_1.getColor)(color);
|
|
27
27
|
return ((0, jsx_runtime_1.jsx)(recharts_1.Bar, Object.assign({ unit: dataUnit }, remainingBarProps, { fill: cellColor }, { children: useDataColors &&
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComposedChart as RechartsComposedChart, type XAxisProps, type YAxisProps } from 'recharts';
|
|
3
|
+
import { ChartTooltipProps } from './ChartTooltip';
|
|
4
|
+
import { type LegendProps } from './Legend';
|
|
5
|
+
import type { LineProps } from './Line';
|
|
6
|
+
import type { BarProps } from './Bar';
|
|
7
|
+
import type { ReferenceLineProps } from './ReferenceLine';
|
|
8
|
+
import type { GridProps } from './ChartGrid';
|
|
9
|
+
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
10
|
+
import type { AreaProps } from './Area';
|
|
11
|
+
type RechartsComposedChartProps = React.ComponentProps<typeof RechartsComposedChart>;
|
|
12
|
+
export type ComposedChartProps<T extends object> = Omit<RechartsComposedChartProps, 'data'> & {
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
data: T[];
|
|
16
|
+
dataUnit?: string;
|
|
17
|
+
dataKey?: string | number | ((obj: T) => any);
|
|
18
|
+
lines?: React.ReactElement<LineProps>[];
|
|
19
|
+
bars?: React.ReactElement<BarProps>[];
|
|
20
|
+
areas?: React.ReactElement<AreaProps>[];
|
|
21
|
+
referenceLines?: React.ReactElement<ReferenceLineProps>[];
|
|
22
|
+
xAxisOptions?: XAxisProps;
|
|
23
|
+
yAxisOptions?: YAxisProps;
|
|
24
|
+
gridOptions?: GridProps;
|
|
25
|
+
containerOptions?: ResponsiveContainerProps;
|
|
26
|
+
showXAxis?: boolean;
|
|
27
|
+
showYAxis?: boolean;
|
|
28
|
+
showGrid?: boolean;
|
|
29
|
+
legend?: React.ReactElement<LegendProps> | boolean;
|
|
30
|
+
tooltip?: React.ReactElement<ChartTooltipProps> | boolean;
|
|
31
|
+
brush?: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare const ComposedChart: <T extends object>(props: ComposedChartProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export default ComposedChart;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
7
|
+
require("react");
|
|
8
|
+
const recharts_1 = require("recharts");
|
|
9
|
+
const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
10
|
+
const chartHelper_1 = require("./chartHelper");
|
|
11
|
+
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
12
|
+
const Legend_1 = require("./Legend");
|
|
13
|
+
const ComposedChart = (props) => {
|
|
14
|
+
const { width, height, data = [], dataUnit = '', dataKey = 'value', lines = [], bars = [], areas = [], referenceLines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "bars", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
15
|
+
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
16
|
+
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.ComposedChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({}, legendProps)), areas.map(area => {
|
|
18
|
+
const _a = area.props, { strokeColor, fill } = _a, remainingAreaProps = tslib_1.__rest(_a, ["strokeColor", "fill"]);
|
|
19
|
+
return ((0, react_1.createElement)(recharts_1.Area, Object.assign({}, remainingAreaProps, { key: area.key, stroke: (0, chartHelper_1.getColor)(strokeColor), fill: (0, chartHelper_1.getColor)(fill) })));
|
|
20
|
+
}), bars.map(bar => {
|
|
21
|
+
const _a = bar.props, { color } = _a, remainingBarProps = tslib_1.__rest(_a, ["color"]);
|
|
22
|
+
const cellColor = color && (0, chartHelper_1.getColor)(color);
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(recharts_1.Bar, Object.assign({ unit: dataUnit }, remainingBarProps, { fill: cellColor }), bar.key);
|
|
24
|
+
}), lines.map(line => {
|
|
25
|
+
const _a = line.props, { strokeColor } = _a, remainingLineProps = tslib_1.__rest(_a, ["strokeColor"]);
|
|
26
|
+
return (0, react_1.createElement)(recharts_1.Line, Object.assign({}, remainingLineProps, { key: line.key, stroke: (0, chartHelper_1.getColor)(strokeColor) }));
|
|
27
|
+
}), referenceLines.map(referenceLine => {
|
|
28
|
+
const _a = referenceLine.props, { stroke } = _a, remainingReferenceLineProps = tslib_1.__rest(_a, ["stroke"]);
|
|
29
|
+
return ((0, react_1.createElement)(recharts_1.ReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: (0, chartHelper_1.getColor)(stroke) })));
|
|
30
|
+
}), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
31
|
+
};
|
|
32
|
+
exports.default = ComposedChart;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LegendProps as RechartsLegendProps } from 'recharts';
|
|
2
2
|
import type { Formatter, Payload } from 'recharts/types/component/DefaultLegendContent';
|
|
3
3
|
export type LegendFormatter = Formatter;
|
|
4
4
|
export type LegendPayload = Payload;
|
|
5
5
|
export type LegendProps = Omit<RechartsLegendProps, 'ref' | 'formatter'> & {
|
|
6
6
|
formatter?: (value: any, entry: any, index: number) => void;
|
|
7
7
|
};
|
|
8
|
-
declare const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
align: string;
|
|
15
|
-
verticalAlign: string;
|
|
16
|
-
};
|
|
8
|
+
export declare const getLegendDefaultProps: () => {
|
|
9
|
+
iconType: string;
|
|
10
|
+
iconSize: number;
|
|
11
|
+
layout: string;
|
|
12
|
+
align: string;
|
|
13
|
+
verticalAlign: string;
|
|
17
14
|
};
|
|
15
|
+
declare const Legend: (props: LegendProps) => null;
|
|
18
16
|
export default Legend;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.getLegendDefaultProps = void 0;
|
|
4
4
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
5
|
require("react");
|
|
6
|
-
const
|
|
7
|
-
const Legend = (props) => {
|
|
8
|
-
const { verticalAlign, wrapperStyle } = props;
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.Legend
|
|
10
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
11
|
-
, Object.assign({
|
|
12
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
13
|
-
formatter: props.formatter, wrapperStyle: verticalAlign === 'bottom' ? { bottom: 0 } : wrapperStyle }, props)));
|
|
14
|
-
};
|
|
15
|
-
Legend.defaultProps = {
|
|
6
|
+
const getLegendDefaultProps = () => ({
|
|
16
7
|
iconType: 'circle',
|
|
17
8
|
iconSize: 12,
|
|
18
9
|
layout: 'vertical',
|
|
19
10
|
align: 'right',
|
|
20
11
|
verticalAlign: 'top',
|
|
21
|
-
};
|
|
12
|
+
});
|
|
13
|
+
exports.getLegendDefaultProps = getLegendDefaultProps;
|
|
14
|
+
const Legend = (props) => null;
|
|
22
15
|
exports.default = Legend;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import type { LineProps as RechartsLineProps } from 'recharts';
|
|
3
3
|
export type LineProps = Omit<RechartsLineProps, 'ref'> & {
|
|
4
4
|
strokeColor?: string;
|
|
5
|
+
dataKey?: string;
|
|
6
|
+
unit?: string;
|
|
7
|
+
legendType?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
isAnimationActive?: boolean;
|
|
5
10
|
};
|
|
6
11
|
declare const Line: React.FC<LineProps>;
|
|
7
12
|
export default Line;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Line = () => null;
|
|
4
|
-
Line.defaultProps = {
|
|
5
|
-
dataKey: 'value',
|
|
6
|
-
unit: '',
|
|
7
|
-
strokeColor: 'color-coldplay-fountain',
|
|
8
|
-
legendType: 'square',
|
|
9
|
-
type: 'monotone',
|
|
10
|
-
isAnimationActive: true,
|
|
11
|
-
};
|
|
3
|
+
const Line = ({ dataKey = 'value', unit = '', strokeColor = 'color-coldplay-fountain', legendType = 'square', type = 'monotone', isAnimationActive = true, }) => null;
|
|
12
4
|
exports.default = Line;
|
|
@@ -3,6 +3,7 @@ import { LineChart as RechartsLineChart, type XAxisProps, type YAxisProps } from
|
|
|
3
3
|
import { ChartTooltipProps } from './ChartTooltip';
|
|
4
4
|
import { type LegendProps } from './Legend';
|
|
5
5
|
import type { LineProps } from './Line';
|
|
6
|
+
import type { ReferenceLineProps } from './ReferenceLine';
|
|
6
7
|
import type { GridProps } from './ChartGrid';
|
|
7
8
|
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
8
9
|
type RechartsLineChartProps = React.ComponentProps<typeof RechartsLineChart>;
|
|
@@ -13,6 +14,7 @@ export type LineChartProps<T extends object> = Omit<RechartsLineChartProps, 'dat
|
|
|
13
14
|
dataUnit?: string;
|
|
14
15
|
dataKey?: string | number | ((obj: T) => any);
|
|
15
16
|
lines: React.ReactElement<LineProps>[];
|
|
17
|
+
referenceLines?: React.ReactElement<ReferenceLineProps>[];
|
|
16
18
|
xAxisOptions?: XAxisProps;
|
|
17
19
|
yAxisOptions?: YAxisProps;
|
|
18
20
|
gridOptions?: GridProps;
|
|
@@ -9,14 +9,17 @@ const recharts_1 = require("recharts");
|
|
|
9
9
|
const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
11
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
12
|
-
const Legend_1 =
|
|
12
|
+
const Legend_1 = require("./Legend");
|
|
13
13
|
const LineChart = (props) => {
|
|
14
|
-
const { width, height, data = [], dataUnit = '', dataKey = 'value', lines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
14
|
+
const { width, height, data = [], dataUnit = '', dataKey = 'value', lines = [], referenceLines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
15
15
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
16
|
-
const legendProps = (0, isObject_1.default)(legend) ? legend.props : {};
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.LineChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(
|
|
16
|
+
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.LineChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({}, legendProps)), lines.map(line => {
|
|
18
18
|
const _a = line.props, { strokeColor } = _a, remainingLineProps = tslib_1.__rest(_a, ["strokeColor"]);
|
|
19
19
|
return (0, react_1.createElement)(recharts_1.Line, Object.assign({}, remainingLineProps, { key: line.key, stroke: (0, chartHelper_1.getColor)(strokeColor) }));
|
|
20
|
+
}), referenceLines.map(referenceLine => {
|
|
21
|
+
const _a = referenceLine.props, { stroke } = _a, remainingReferenceLineProps = tslib_1.__rest(_a, ["stroke"]);
|
|
22
|
+
return ((0, react_1.createElement)(recharts_1.ReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: (0, chartHelper_1.getColor)(stroke) })));
|
|
20
23
|
}), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
21
24
|
};
|
|
22
25
|
exports.default = LineChart;
|
|
@@ -8,7 +8,7 @@ const recharts_1 = require("recharts");
|
|
|
8
8
|
const isFunction_1 = tslib_1.__importDefault(require("lodash/fp/isFunction"));
|
|
9
9
|
const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
|
-
const Legend_1 =
|
|
11
|
+
const Legend_1 = require("./Legend");
|
|
12
12
|
const ChartTooltip_1 = tslib_1.__importStar(require("./ChartTooltip"));
|
|
13
13
|
const RADIAN = Math.PI / 180;
|
|
14
14
|
const renderCustomInnerLabel = (dataUnit) => ({ cx, cy, midAngle, innerRadius, outerRadius, value }) => {
|
|
@@ -18,13 +18,13 @@ const renderCustomInnerLabel = (dataUnit) => ({ cx, cy, midAngle, innerRadius, o
|
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)("text", Object.assign({ x: x, y: y, fill: 'white', textAnchor: x > cx ? 'start' : 'end', dominantBaseline: 'central' }, { children: `${value} ${dataUnit}` })));
|
|
19
19
|
};
|
|
20
20
|
const PieChart = (props) => {
|
|
21
|
-
const { width, height, innerRadius, outerRadius, data = [], dataKey = 'value', dataUnit = '', nameKey = 'name', color, filled = false, labels = true, innerLabels = false, paddingAngle = 3, legend = (0, jsx_runtime_1.jsx)(
|
|
21
|
+
const { width, height, innerRadius, outerRadius, data = [], dataKey = 'value', dataUnit = '', nameKey = 'name', color, filled = false, labels = true, innerLabels = false, paddingAngle = 3, legend = (0, jsx_runtime_1.jsx)(recharts_1.Legend, {}), tooltip = true, pieOptions, containerOptions } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "innerRadius", "outerRadius", "data", "dataKey", "dataUnit", "nameKey", "color", "filled", "labels", "innerLabels", "paddingAngle", "legend", "tooltip", "pieOptions", "containerOptions"]);
|
|
22
22
|
// biome-ignore lint/suspicious/noExplicitAny:
|
|
23
23
|
const renderLabels = (entry) => `${(0, isFunction_1.default)(dataKey) ? dataKey(entry) : entry[dataKey]} ${dataUnit}`;
|
|
24
24
|
const pieLabel = labels && (innerLabels ? renderCustomInnerLabel(dataUnit) : renderLabels);
|
|
25
25
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
26
|
-
const legendProps = (0, isObject_1.default)(legend) ? legend.props : {};
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, Object.assign({ width: width, height: height }, remainingProps, { children: [legend && ((0, jsx_runtime_1.jsx)(
|
|
26
|
+
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, Object.assign({ width: width, height: height }, remainingProps, { children: [legend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ formatter: (value, entry) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'text-color-darker' }, { children: value }))) }, legendProps))), (0, jsx_runtime_1.jsx)(recharts_1.Pie, Object.assign({ data: data, isAnimationActive: true, nameKey: nameKey, dataKey: dataKey, label: pieLabel,
|
|
28
28
|
// cx={Math.max(outerRadius, width / 3)}
|
|
29
29
|
// cy={height / 2}
|
|
30
30
|
innerRadius: filled ? 0 : innerRadius, outerRadius: outerRadius, paddingAngle: filled ? 0 : paddingAngle, labelLine: !innerLabels }, pieOptions, { children: data.map((entry, index) => {
|
|
@@ -8,10 +8,10 @@ const recharts_1 = require("recharts");
|
|
|
8
8
|
const isFunction_1 = tslib_1.__importDefault(require("lodash/fp/isFunction"));
|
|
9
9
|
const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
|
-
const Legend_1 =
|
|
11
|
+
const Legend_1 = require("./Legend");
|
|
12
12
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
13
13
|
const RadialBarChart = (props) => {
|
|
14
|
-
const { width, height, data = [], dataKey = 'value', startAngle = 180, endAngle = 0, innerRadius = '30%', outerRadius = '100%', legend = (0, jsx_runtime_1.jsx)(
|
|
14
|
+
const { width, height, data = [], dataKey = 'value', startAngle = 180, endAngle = 0, innerRadius = '30%', outerRadius = '100%', legend = (0, jsx_runtime_1.jsx)(recharts_1.Legend, {}), textOptions, radialBarOptions, containerOptions, showBarLabel = false, cornerRadius = 30, background = true, range, tooltip = false } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataKey", "startAngle", "endAngle", "innerRadius", "outerRadius", "legend", "textOptions", "radialBarOptions", "containerOptions", "showBarLabel", "cornerRadius", "background", "range", "tooltip"]);
|
|
15
15
|
const _a = textOptions || {}, { text, size = '500%', weight = 'normal', color = 'gray-darkest' } = _a, remainingTextOptions = tslib_1.__rest(_a, ["text", "size", "weight", "color"]);
|
|
16
16
|
const textStyle = {
|
|
17
17
|
fontSize: size,
|
|
@@ -19,10 +19,10 @@ const RadialBarChart = (props) => {
|
|
|
19
19
|
fill: color && (0, chartHelper_1.getColor)(color),
|
|
20
20
|
};
|
|
21
21
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
22
|
-
const legendProps = (0, isObject_1.default)(legend) ? legend.props : {};
|
|
22
|
+
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
23
23
|
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.RadialBarChart, Object.assign({ width: width, height: height, data: data, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle }, remainingProps, { children: [(0, jsx_runtime_1.jsx)(recharts_1.RadialBar, Object.assign({ label: showBarLabel && { fill: '#666', position: 'insideStart' }, background: background, dataKey: dataKey, cornerRadius: cornerRadius }, radialBarOptions, { children: data.map((entry, index) => {
|
|
24
24
|
const cellColor = (0, chartHelper_1.getColor)(entry.color) || (0, chartHelper_1.getFromDefaultColors)(index);
|
|
25
25
|
return ((0, jsx_runtime_1.jsx)(recharts_1.Cell, { fill: (0, isFunction_1.default)(color) ? color(entry, index) : cellColor }, `cell-${index}`));
|
|
26
|
-
}) })), range && (0, jsx_runtime_1.jsx)(recharts_1.PolarAngleAxis, { type: 'number', domain: range, angleAxisId: 0, tick: false }), textOptions && ((0, jsx_runtime_1.jsx)("text", Object.assign({ x: width ? width / 2 : '50%', y: height ? height / 2 : '50%', textAnchor: 'middle', dominantBaseline: 'middle', className: 'radialbarchart-text', style: textStyle }, remainingTextOptions, { children: text }))), legend && ((0, jsx_runtime_1.jsx)(
|
|
26
|
+
}) })), range && (0, jsx_runtime_1.jsx)(recharts_1.PolarAngleAxis, { type: 'number', domain: range, angleAxisId: 0, tick: false }), textOptions && ((0, jsx_runtime_1.jsx)("text", Object.assign({ x: width ? width / 2 : '50%', y: height ? height / 2 : '50%', textAnchor: 'middle', dominantBaseline: 'middle', className: 'radialbarchart-text', style: textStyle }, remainingTextOptions, { children: text }))), legend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ formatter: (value, entry) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'text-color-darker' }, { children: value }))) }, legendProps))), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({ cursor: { fill: chartHelper_1.CURSOR_BACKGROUND_COLOR } }, tooltipProps))] })) })));
|
|
27
27
|
};
|
|
28
28
|
exports.default = RadialBarChart;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ReferenceLineProps as RechartsReferenceLineProps } from 'recharts';
|
|
3
|
+
export type ReferenceLineProps = Omit<RechartsReferenceLineProps, 'ref'> & {
|
|
4
|
+
stroke?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const Line: React.FC<ReferenceLineProps>;
|
|
7
|
+
export default Line;
|
|
@@ -7,7 +7,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
require("react");
|
|
8
8
|
const framer_motion_1 = require("framer-motion");
|
|
9
9
|
const DataTab = (props) => {
|
|
10
|
-
const { active = false,
|
|
10
|
+
const { active = false, title, // exclude from remainingProps to avoid being set to the div element
|
|
11
|
+
tabKey, disableTransition = false, className = '', children } = props, remainingProps = tslib_1.__rest(props, ["active", "title", "tabKey", "disableTransition", "className", "children"]);
|
|
11
12
|
if (disableTransition) {
|
|
12
13
|
return (0, jsx_runtime_1.jsx)("div", { children: active && children });
|
|
13
14
|
}
|
|
@@ -3,6 +3,7 @@ export type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'fullwidth'
|
|
|
3
3
|
export type BaseDialogProps = {
|
|
4
4
|
/**
|
|
5
5
|
* Opens the dialog when set to `true`.
|
|
6
|
+
*
|
|
6
7
|
* @default false
|
|
7
8
|
*/
|
|
8
9
|
show: boolean;
|
|
@@ -16,6 +17,7 @@ export type BaseDialogProps = {
|
|
|
16
17
|
subtitle?: React.ReactNode;
|
|
17
18
|
/**
|
|
18
19
|
* Shows a close button when set to `true`.
|
|
20
|
+
*
|
|
19
21
|
* @default true
|
|
20
22
|
*/
|
|
21
23
|
showCloseButton?: boolean;
|
|
@@ -25,24 +27,29 @@ export type BaseDialogProps = {
|
|
|
25
27
|
onClose?: () => void;
|
|
26
28
|
/**
|
|
27
29
|
* Defined how large the dialog will be rendered.
|
|
28
|
-
*
|
|
30
|
+
*
|
|
31
|
+
* By default, the dialog has a medium size, and thus it can be omitted.
|
|
29
32
|
*
|
|
30
33
|
* Possible values are: `xs`, `sm`, `lg` `xl` `fullwidth` `fullheight` `fullscreen`
|
|
34
|
+
*
|
|
31
35
|
* @default 'md'
|
|
32
36
|
*/
|
|
33
37
|
bsSize?: DialogSize;
|
|
34
38
|
/**
|
|
35
39
|
* Enables or disabled closing the dialog via esc key.
|
|
40
|
+
*
|
|
36
41
|
* @default false
|
|
37
42
|
*/
|
|
38
43
|
disableEsc?: boolean;
|
|
39
44
|
/**
|
|
40
45
|
* Enables the modal body to overflow and use inline scrolling if needed.
|
|
46
|
+
*
|
|
41
47
|
* @default false
|
|
42
48
|
*/
|
|
43
49
|
useOverflow?: boolean;
|
|
44
50
|
/**
|
|
45
51
|
* Show Header and Footer Borders for the "xs" dialog
|
|
52
|
+
*
|
|
46
53
|
* @default false
|
|
47
54
|
*/
|
|
48
55
|
showXsDialogBorders?: boolean;
|
|
@@ -74,6 +81,7 @@ export type DialogProps = BaseDialogProps & {
|
|
|
74
81
|
headerButtons?: React.ReactNode;
|
|
75
82
|
/**
|
|
76
83
|
* Deprecate to align with other dialog callbacks.
|
|
84
|
+
*
|
|
77
85
|
* @deprecated please use `onClose`
|
|
78
86
|
*/
|
|
79
87
|
onHide?: VoidFunction;
|
|
@@ -82,9 +90,9 @@ export type DialogProps = BaseDialogProps & {
|
|
|
82
90
|
*/
|
|
83
91
|
onEsc?: VoidFunction;
|
|
84
92
|
/**
|
|
85
|
-
* A callback function to be executed before closing the dialog.
|
|
86
|
-
*
|
|
87
|
-
*
|
|
93
|
+
* A callback function to be executed before closing the dialog.
|
|
94
|
+
*
|
|
95
|
+
* If the function returns `false`, the dialog will not be closed
|
|
88
96
|
*/
|
|
89
97
|
onCloseValidation?: () => boolean;
|
|
90
98
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
export type SimpleDialogProps =
|
|
2
|
+
import { type DialogProps } from './Dialog';
|
|
3
|
+
export type SimpleDialogProps = Omit<DialogProps, 'body'> & {
|
|
4
4
|
/**
|
|
5
5
|
* The content of the dialog body itself.
|
|
6
6
|
*/
|
|
@@ -25,6 +25,12 @@ export type SplitDialogProps = BaseDialogProps & {
|
|
|
25
25
|
* Additional classes for the modal-footer element.
|
|
26
26
|
*/
|
|
27
27
|
footerClassName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* A callback function to be executed before closing the dialog.
|
|
30
|
+
*
|
|
31
|
+
* If the function returns `false`, the dialog will not be closed
|
|
32
|
+
*/
|
|
33
|
+
onCloseValidation?: () => boolean;
|
|
28
34
|
};
|
|
29
35
|
declare const SplitDialog: (props: SplitDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
36
|
export default SplitDialog;
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const isEqual_1 = tslib_1.__importDefault(require("lodash/fp/isEqual"));
|
|
7
7
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
8
8
|
const Collapse_1 = tslib_1.__importDefault(require("../collapse/Collapse"));
|
|
9
|
+
const hasUtilityClass_1 = require("../../utils/hasUtilityClass");
|
|
9
10
|
const getRandomString = () => (Math.random() + 1).toString(36).toUpperCase().substring(2);
|
|
10
11
|
// Generate a unique id (if not present) instead of using the index for the key as it will create
|
|
11
12
|
// side effects when removing items from the list and re-render the ExpanderList.
|
|
@@ -41,7 +42,7 @@ const ExpanderList = (props) => {
|
|
|
41
42
|
});
|
|
42
43
|
setListItems(updatedListItems);
|
|
43
44
|
};
|
|
44
|
-
const listClassNames = (0, classnames_1.default)('expander-list list-group', rounded && 'rounded', bordered && 'border', className);
|
|
45
|
+
const listClassNames = (0, classnames_1.default)('expander-list list-group', rounded && !(0, hasUtilityClass_1.hasRoundedClass)(className) && 'rounded', bordered && !(0, hasUtilityClass_1.hasBorderClass)(className) && 'border', className);
|
|
45
46
|
return ((0, jsx_runtime_1.jsx)("ul", Object.assign({ className: listClassNames }, { children: listItems.map(item => {
|
|
46
47
|
const isOpen = item.open;
|
|
47
48
|
const itemClassNames = (0, classnames_1.default)('list-group-item', item.className && item.className, item.body && 'expandable', isOpen && 'open');
|