@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
package/.DS_Store
CHANGED
|
Binary file
|
package/ChartLabel.d.ts
ADDED
package/ChartLabel.js
ADDED
package/ComposedChart.js
ADDED
package/DateRangePicker.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { JSX, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import type { Moment } from 'moment/moment';
|
|
3
|
-
export
|
|
3
|
+
export type DateRangePickerCustomPresets = {
|
|
4
4
|
startValue: Moment;
|
|
5
5
|
endValue: Moment;
|
|
6
6
|
text: string | JSX.Element;
|
|
7
7
|
onSelect?: Function;
|
|
8
|
-
}
|
|
9
|
-
export
|
|
8
|
+
};
|
|
9
|
+
export type DateRangePickerProps = {
|
|
10
10
|
startValue?: Moment;
|
|
11
11
|
endValue?: Moment;
|
|
12
12
|
defaultStartValue?: Moment;
|
|
@@ -34,11 +34,10 @@ export interface DateRangePickerProps {
|
|
|
34
34
|
dropup?: boolean;
|
|
35
35
|
pullRight?: boolean;
|
|
36
36
|
autoDropDirection?: boolean;
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
/**
|
|
39
39
|
* Wrapper component for React-Datetime.
|
|
40
40
|
*
|
|
41
41
|
* @deprecated This will be removed from the UIKIT at some time.
|
|
42
42
|
*/
|
|
43
|
-
declare const DateRangePicker:
|
|
44
|
-
export { DateRangePicker };
|
|
43
|
+
export declare const DateRangePicker: (props: PropsWithChildren<DateRangePickerProps>) => import("react/jsx-runtime").JSX.Element;
|
package/DateRangePicker.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import DeprecatedDateRangePicker from './components/datepicker/DateRangePicker';
|
|
2
4
|
/**
|
|
3
5
|
* Wrapper component for React-Datetime.
|
|
4
6
|
*
|
|
5
7
|
* @deprecated This will be removed from the UIKIT at some time.
|
|
6
8
|
*/
|
|
7
|
-
const DateRangePicker =
|
|
8
|
-
|
|
9
|
+
export const DateRangePicker = (props) => {
|
|
10
|
+
const { children } = props, remainingProps = __rest(props, ["children"]);
|
|
11
|
+
return _jsx(DeprecatedDateRangePicker, Object.assign({}, remainingProps, { children: children }));
|
|
12
|
+
};
|
package/LicensePlate.js
ADDED
package/README.md
CHANGED
|
@@ -19,9 +19,9 @@ When releasing a new version:
|
|
|
19
19
|
|
|
20
20
|
Create a new development beta version:
|
|
21
21
|
|
|
22
|
-
1. Update the `package.json`. Example `
|
|
23
|
-
2. Update the `src/version.json`. Example `
|
|
24
|
-
3. run `npm i` or update `package-lock.json`. Example `
|
|
22
|
+
1. Update the `package.json`. Example `1.2.4-beta.1`
|
|
23
|
+
2. Update the `src/version.json`. Example `1.2.4-beta.1`
|
|
24
|
+
3. run `npm i` or update `package-lock.json`. Example `1.2.4-beta.1`
|
|
25
25
|
|
|
26
26
|
## Development
|
|
27
27
|
|
package/ReferenceLine.js
ADDED
|
@@ -97,7 +97,7 @@ const ActionBarItemBase = (props) => {
|
|
|
97
97
|
return (_jsxs("div", Object.assign({}, remainingProps, { className: classes, ref: clickOutsideRef }, { children: [React.cloneElement(itemIcon, { onClick: onToggle }), _jsx("div", Object.assign({ onClick: () => setIsShown(false) }, { children: _jsx(Dialog, { show: isShown, onClose: () => setIsShown(false), body: itemPopover, bodyClassName: mobileDialogBodyClassName, title: title }) })), childrenWithoutPopoverAndIcon] })));
|
|
98
98
|
}
|
|
99
99
|
const overlay = (_jsx(ActionBarOverlay, Object.assign({ id: id, title: title, width: popoverWidth, preRender: useOffscreen, show: isShown }, { children: itemPopover }), 'child'));
|
|
100
|
-
return (_jsxs("div", Object.assign({}, remainingProps, { className: classes, ref: clickOutsideRef }, { children: [_jsx(OverlayTrigger, Object.assign({ onToggle: onToggle, show: isShown || useOffscreen, placement: OverlayTrigger.BOTTOM_END, overlay: overlay, trigger: 'click',
|
|
100
|
+
return (_jsxs("div", Object.assign({}, remainingProps, { className: classes, ref: clickOutsideRef }, { children: [_jsx(OverlayTrigger, Object.assign({ onToggle: onToggle, show: isShown || useOffscreen, placement: OverlayTrigger.BOTTOM_END, overlay: overlay, rootClose: false, trigger: 'click', popperConfig: {
|
|
101
101
|
modifiers: [
|
|
102
102
|
{
|
|
103
103
|
name: 'offset',
|
|
@@ -105,6 +105,10 @@ const ActionBarItemBase = (props) => {
|
|
|
105
105
|
offset: [0, 5],
|
|
106
106
|
},
|
|
107
107
|
},
|
|
108
|
+
{
|
|
109
|
+
name: 'arrow',
|
|
110
|
+
options: {},
|
|
111
|
+
},
|
|
108
112
|
],
|
|
109
113
|
} }, { children: itemIcon })), childrenWithoutPopoverAndIcon] })));
|
|
110
114
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
className?: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
displayName: string;
|
|
8
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const ActionBarItemIcon: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
className?: string | undefined;
|
|
4
|
+
} & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
9
7
|
export default ActionBarItemIcon;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
4
|
-
import 'react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
const ActionBarItemIcon = (props) => {
|
|
6
|
+
const ActionBarItemIcon = forwardRef((props, ref) => {
|
|
7
7
|
const { className, children } = props, remainingProps = __rest(props, ["className", "children"]);
|
|
8
8
|
const classes = classNames('ActionBarItemIcon', className);
|
|
9
|
-
return (_jsx("div", Object.assign({}, remainingProps, { className: classes }, { children: children })));
|
|
10
|
-
};
|
|
9
|
+
return (_jsx("div", Object.assign({}, remainingProps, { className: classes, ref: ref }, { children: children })));
|
|
10
|
+
});
|
|
11
11
|
// The displayName is used in ActionBarItem for checking the component "isActionBarItemIcon"
|
|
12
12
|
ActionBarItemIcon.displayName = 'ActionBarItemIcon';
|
|
13
13
|
export default ActionBarItemIcon;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PLACEMENT_MAP } from '../popover/Popover';
|
|
3
|
+
import type { ObjectValues } from '../../utils/ObjectValues';
|
|
3
4
|
export type ActionBarOverlayWidth = 100 | 150 | 200 | 250 | 300 | 350 | 400 | 450 | 500;
|
|
4
5
|
export type ActionBarOverlayProps = {
|
|
5
6
|
id: string;
|
|
@@ -9,7 +10,7 @@ export type ActionBarOverlayProps = {
|
|
|
9
10
|
width?: ActionBarOverlayWidth;
|
|
10
11
|
onClick?: () => void;
|
|
11
12
|
style?: object;
|
|
12
|
-
placement?:
|
|
13
|
+
placement?: ObjectValues<typeof PLACEMENT_MAP>;
|
|
13
14
|
className?: string;
|
|
14
15
|
};
|
|
15
16
|
declare const ActionBarOverlay: React.ForwardRefExoticComponent<ActionBarOverlayProps & {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
4
|
import { forwardRef } from 'react';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
|
-
import Popover from 'react-bootstrap/Popover';
|
|
6
6
|
import noop from 'lodash/fp/noop';
|
|
7
|
-
import {
|
|
8
|
-
const DEFAULT_PLACEMENT =
|
|
7
|
+
import Popover, { PLACEMENT_MAP } from '../popover/Popover';
|
|
8
|
+
const DEFAULT_PLACEMENT = PLACEMENT_MAP.BOTTOM;
|
|
9
9
|
const DEFAULT_WIDTH = 250;
|
|
10
10
|
const ActionBarOverlay = forwardRef((props, ref) => {
|
|
11
|
-
const { children, show, preRender, id, title, onClick = noop, width = DEFAULT_WIDTH, style = {}, className, placement = DEFAULT_PLACEMENT } = props,
|
|
11
|
+
const { children, show, preRender, id, title, onClick = noop, width = DEFAULT_WIDTH, style = {}, className, placement = DEFAULT_PLACEMENT } = props, remainingProps = __rest(props, ["children", "show", "preRender", "id", "title", "onClick", "width", "style", "className", "placement"]);
|
|
12
12
|
const adjustedStyles = Object.assign(Object.assign({}, style), { width });
|
|
13
13
|
const adjustedClassName = preRender && !show ? classNames(className, 'position-offscreen') : className;
|
|
14
|
-
const popoverTitleClasses = classNames('ActionBarItemPopover
|
|
15
|
-
const popoverContentClasses = classNames('ActionBarItemPopover
|
|
16
|
-
return (_jsxs(Popover, Object.assign({ ref: ref, id: id, onClick: onClick, placement: placement },
|
|
14
|
+
const popoverTitleClasses = classNames('ActionBarItemPopover text-color-dark', className);
|
|
15
|
+
const popoverContentClasses = classNames('ActionBarItemPopover', className);
|
|
16
|
+
return (_jsxs(Popover, Object.assign({ ref: ref, id: id, onClick: onClick, placement: placement }, remainingProps, { style: adjustedStyles, className: adjustedClassName }, { children: [title && _jsx(Popover.Title, Object.assign({ className: popoverTitleClasses }, { children: title })), _jsx(Popover.Content, Object.assign({ className: popoverContentClasses }, { children: children }))] })));
|
|
17
17
|
});
|
|
18
18
|
export default ActionBarOverlay;
|
|
@@ -7,6 +7,7 @@ import ApplicationLayoutHeader from './ApplicationLayoutHeader';
|
|
|
7
7
|
import ApplicationLayoutSidebar from './ApplicationLayoutSidebar';
|
|
8
8
|
import ApplicationLayoutBody from './ApplicationLayoutBody';
|
|
9
9
|
import { initDocumentBootstrapping } from '../../utils/init/initDocumentBootstrapping';
|
|
10
|
+
import '../../utils/init/initConfig';
|
|
10
11
|
// initializes document bootstrapping - keep the import to avoid being tree-shaken
|
|
11
12
|
// noinspection JSIgnoredPromiseFromCall
|
|
12
13
|
initDocumentBootstrapping();
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
const ApplicationLayoutHeader = forwardRef((props, ref) => {
|
|
7
6
|
const { className, children } = props, remainingProps = __rest(props, ["className", "children"]);
|
|
8
7
|
const classes = classNames('ApplicationLayoutHeader', className);
|
|
9
8
|
return (_jsx("div", Object.assign({ ref: ref }, remainingProps, { className: classes, id: 'ApplicationLayoutHeader' }, { children: children })));
|
|
10
9
|
});
|
|
11
|
-
ApplicationLayoutHeader.propTypes = {
|
|
12
|
-
className: PropTypes.string,
|
|
13
|
-
};
|
|
14
10
|
export default ApplicationLayoutHeader;
|
|
@@ -12,18 +12,22 @@ const TreeOptions = (props) => {
|
|
|
12
12
|
}
|
|
13
13
|
const dropdownClasses = classNames('display-flex flex-column gap-10', 'width-250', 'padding-15', className);
|
|
14
14
|
const customDropdown = _jsx("div", Object.assign({ className: dropdownClasses }, { children: treeOptions }));
|
|
15
|
-
const dropdown = (_jsx(ButtonDropdown, { title: _jsx("span", { className: 'rioglyph rioglyph-option-vertical', "aria-hidden": 'true' }), bsStyle: 'default', bsSize: 'sm', customDropdown: customDropdown, toggleClassName: 'hover-bg-white border-none text-color-gray hover-text-color-dark', className: 'TreeHeaderOptions', pullRight: true, iconOnly: true }));
|
|
15
|
+
const dropdown = (_jsx(ButtonDropdown, { title: _jsx("span", { className: 'rioglyph rioglyph-option-vertical', "aria-hidden": 'true' }), bsStyle: 'default', bsSize: 'sm', customDropdown: customDropdown, toggleClassName: 'hover-bg-white border-none text-color-gray hover-text-color-dark', className: 'TreeHeaderOptions height-20', pullRight: true, iconOnly: true }));
|
|
16
16
|
if (treeOptionsTooltip) {
|
|
17
|
-
return (_jsx(SimpleTooltip, Object.assign({ content: treeOptionsTooltip, placement: 'bottom', delay: { show: 1000, hide: 0 }, popperConfig: {
|
|
17
|
+
return (_jsx(SimpleTooltip, Object.assign({ content: treeOptionsTooltip, placement: 'bottom-end', delay: { show: 1000, hide: 0 }, popperConfig: {
|
|
18
18
|
modifiers: [
|
|
19
19
|
{
|
|
20
20
|
name: 'offset',
|
|
21
21
|
options: {
|
|
22
|
-
offset: [
|
|
22
|
+
offset: [10, 5],
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
|
+
{
|
|
26
|
+
name: 'arrow',
|
|
27
|
+
options: {},
|
|
28
|
+
},
|
|
25
29
|
],
|
|
26
|
-
} }, { children: dropdown })));
|
|
30
|
+
} }, { children: _jsx("div", { children: dropdown }) })));
|
|
27
31
|
}
|
|
28
32
|
return dropdown;
|
|
29
33
|
};
|
|
@@ -27,7 +27,7 @@ const orderByName = orderBy([
|
|
|
27
27
|
var _a;
|
|
28
28
|
return isNameObject(item)
|
|
29
29
|
? item.name.lastName.toLowerCase()
|
|
30
|
-
: (_a = item.name.toLowerCase()) !== null && _a !== void 0 ? _a : '';
|
|
30
|
+
: ((_a = item.name.toLowerCase()) !== null && _a !== void 0 ? _a : '');
|
|
31
31
|
},
|
|
32
32
|
], ['asc']);
|
|
33
33
|
// TODO: extend to use provided external search function instead?
|
|
@@ -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;
|
|
@@ -6,6 +6,7 @@ import noop from 'lodash/noop';
|
|
|
6
6
|
import useAfterMount from '../../hooks/useAfterMount';
|
|
7
7
|
import useElementSize from '../../hooks/useElementSize';
|
|
8
8
|
import usePrevious from '../../hooks/usePrevious';
|
|
9
|
+
import { hasAlignItemsClass, hasAlignSelfClass, hasBgClass, hasBorderClass, hasCursorClass, hasDisplayClass, hasFlexClass, hasHoverScaleClass, hasHoverTextColorClass, hasOverflowClass, hasPaddingClass, hasRoundedClass, hasSpaceClass, hasTextColorClass, hasTextSizeClass, hasUserSelectClass, } from '../../utils/hasUtilityClass';
|
|
9
10
|
const DEFAULT_MIN_WITH = 200;
|
|
10
11
|
const DEFAULT_MIN_DAYS = 1;
|
|
11
12
|
const DEFAULT_MAX_DAYS = 7;
|
|
@@ -28,7 +29,7 @@ const getFirstColumnItem = (node) => {
|
|
|
28
29
|
return getFirstColumnItem(node.children[0]);
|
|
29
30
|
};
|
|
30
31
|
const CalendarStripe = forwardRef((props, ref) => {
|
|
31
|
-
const { minDayWith = DEFAULT_MIN_WITH, minDays = DEFAULT_MIN_DAYS, maxDays = DEFAULT_MAX_DAYS, render, renderDay, skipWeekends = false, startDate = new Date(), onNextClick = noop, onPreviousClick = noop, buttonClassName = '', className = '', } = props;
|
|
32
|
+
const { minDayWith = DEFAULT_MIN_WITH, minDays = DEFAULT_MIN_DAYS, maxDays = DEFAULT_MAX_DAYS, render, renderDay, skipWeekends = false, startDate = new Date(), onNextClick = noop, onPreviousClick = noop, buttonClassName = '', className = '', daysWrapperClassName = '', dayWrapperClassName = '', } = props;
|
|
32
33
|
if (render) {
|
|
33
34
|
console.warn('CalendarStripe has set the "render" prop deprecated. This will be removed in the upcoming releases,' +
|
|
34
35
|
' Please use the "renderDay" prop instead.');
|
|
@@ -114,8 +115,10 @@ const CalendarStripe = forwardRef((props, ref) => {
|
|
|
114
115
|
addDays = false;
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const wrapperClassNames = classNames('CalenderStripe', !hasDisplayClass(className) && 'display-flex', !hasAlignItemsClass(className) && 'align-items-center', !hasOverflowClass(className) && 'overflow-hidden', !hasBgClass(className) && 'bg-white', !hasBorderClass(className) && 'border', !hasRoundedClass(className) && 'rounded', className);
|
|
119
|
+
const baseButtonClassNames = classNames(!hasAlignItemsClass(buttonClassName) && 'align-items-center', !hasDisplayClass(buttonClassName) && 'display-flex', !hasHoverScaleClass(buttonClassName) && 'hover-scale-105', !hasHoverTextColorClass(buttonClassName) && 'hover-text-color-darkest', !hasPaddingClass(buttonClassName) && 'padding-10', !hasCursorClass(buttonClassName) && 'cursor-pointer', !hasTextColorClass(buttonClassName) && 'text-color-darker', !hasTextSizeClass(buttonClassName) && 'text-size-12', !hasAlignSelfClass(buttonClassName) && 'align-self-stretch', buttonClassName);
|
|
120
|
+
const daysWrapperClassNames = classNames(!hasDisplayClass(daysWrapperClassName) && 'display-flex', !hasSpaceClass(daysWrapperClassName) && 'space-x--1', !hasUserSelectClass(daysWrapperClassName) && 'user-select-none', daysWrapperClassName);
|
|
121
|
+
const dayWrapperClassNames = classNames(ITEM_NAME, !hasFlexClass(dayWrapperClassName) && 'flex-1-1-0', !hasSpaceClass(dayWrapperClassName) && 'space-x--1', !hasUserSelectClass(dayWrapperClassName) && 'user-select-none', dayWrapperClassName);
|
|
122
|
+
return (_jsxs("div", Object.assign({ ref: ref, className: wrapperClassNames }, { children: [_jsx("div", Object.assign({ className: baseButtonClassNames, onClick: handlePrev }, { children: _jsx("span", { className: 'rioglyph rioglyph-chevron-left' }) })), _jsx("div", Object.assign({ className: 'flex-1-1 overflow-hidden', ref: columnWrapperRef }, { children: _jsx(AnimatePresence, Object.assign({ exitBeforeEnter: true, custom: animationDirection }, { children: _jsx(motion.div, Object.assign({ variants: variants, initial: enableInitialAnimation ? 'pageEnter' : false, animate: 'pageCenter', custom: animationDirection, transition: { duration: ANIMATION_DURATION } }, { children: _jsx("div", Object.assign({ className: daysWrapperClassNames }, { children: dates.map(date => (_jsxs("div", Object.assign({ className: dayWrapperClassNames }, { children: [renderDay ? renderDay(date) : null, render && React.cloneElement(_jsx(_Fragment, { children: render }), { date })] }), `${getDateString(date)}`))) })) }), getDateString(firstDate)) })) })), _jsx("div", Object.assign({ className: baseButtonClassNames, onClick: handleNext }, { children: _jsx("span", { className: 'rioglyph rioglyph-chevron-right' }) }))] })));
|
|
120
123
|
});
|
|
121
124
|
export 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,10 +1,2 @@
|
|
|
1
|
-
const Area = () => null;
|
|
2
|
-
Area.defaultProps = {
|
|
3
|
-
dataKey: 'value',
|
|
4
|
-
unit: '',
|
|
5
|
-
strokeColor: 'color-coldplay-fountain',
|
|
6
|
-
legendType: 'square',
|
|
7
|
-
type: 'monotone',
|
|
8
|
-
isAnimationActive: true,
|
|
9
|
-
};
|
|
1
|
+
const Area = ({ dataKey = 'value', unit = '', strokeColor = 'color-coldplay-fountain', legendType = 'square', type = 'monotone', isAnimationActive = true, }) => null;
|
|
10
2
|
export 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;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { createElement as _createElement } from "react";
|
|
4
4
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
5
|
import 'react';
|
|
6
|
-
import { AreaChart as RechartsAreaChart, Area as RechartsArea, XAxis, YAxis, Brush, CartesianGrid, ResponsiveContainer, } from 'recharts';
|
|
6
|
+
import { AreaChart as RechartsAreaChart, Area as RechartsArea, ReferenceLine as RechartsReferenceLine, Legend as RechartsLegend, XAxis, YAxis, Brush, CartesianGrid, ResponsiveContainer, } from 'recharts';
|
|
7
7
|
import isObject from 'lodash/fp/isObject';
|
|
8
8
|
import { getColor, mapGridOptions } from './chartHelper';
|
|
9
9
|
import AreaGradient, { DEFAULT_ARIA_GRADIENT_ID } from './AreaGradient';
|
|
10
10
|
import ChartTooltip from './ChartTooltip';
|
|
11
|
-
import
|
|
11
|
+
import { getLegendDefaultProps } from './Legend';
|
|
12
12
|
const AreaChart = (props) => {
|
|
13
|
-
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "gradients", "areas", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
13
|
+
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "gradients", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
14
14
|
const areasWithGradient = areas.map(area => {
|
|
15
15
|
const _a = area.props, { strokeColor } = _a, remainingAreaProps = __rest(_a, ["strokeColor"]);
|
|
16
16
|
const gradientId = area.key;
|
|
@@ -21,7 +21,10 @@ const AreaChart = (props) => {
|
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
23
|
const tooltipProps = isObject(tooltip) ? tooltip.props : {};
|
|
24
|
-
const legendProps = isObject(legend) ? legend.props : {};
|
|
25
|
-
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsAreaChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [_jsxs("defs", { children: [gradients, areasWithGradient.map(areaWithGradient => areaWithGradient.gradient)] }), showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && _jsx(ChartTooltip, Object.assign({}, tooltipProps)), legend && _jsx(
|
|
24
|
+
const legendProps = isObject(legend) ? Object.assign(Object.assign({}, getLegendDefaultProps()), legend.props) : {};
|
|
25
|
+
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsAreaChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [_jsxs("defs", { children: [gradients, areasWithGradient.map(areaWithGradient => areaWithGradient.gradient)] }), showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && _jsx(ChartTooltip, Object.assign({}, tooltipProps)), legend && legendProps && (_jsx(_Fragment, { children: _jsx(RechartsLegend, Object.assign({ wrapperStyle: legendProps.verticalAlign === 'bottom' ? { bottom: 0 } : legendProps.wrapperStyle }, legendProps)) })), areasWithGradient.map(areaWithGradient => areaWithGradient.area), referenceLines.map(referenceLine => {
|
|
26
|
+
const _a = referenceLine.props, { stroke } = _a, remainingReferenceLineProps = __rest(_a, ["stroke"]);
|
|
27
|
+
return (_createElement(RechartsReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: getColor(stroke) })));
|
|
28
|
+
}), brush && _jsx(Brush, { stroke: getColor('gray') })] })) })));
|
|
26
29
|
};
|
|
27
30
|
export default AreaChart;
|
|
@@ -2,16 +2,16 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
4
4
|
import 'react';
|
|
5
|
-
import { BarChart as RechartsBarChart, Bar as RechartsBar, XAxis, YAxis, Brush, Cell, CartesianGrid, ResponsiveContainer, } from 'recharts';
|
|
5
|
+
import { BarChart as RechartsBarChart, Bar as RechartsBar, Legend as RechartsLegend, XAxis, YAxis, Brush, Cell, CartesianGrid, ResponsiveContainer, } from 'recharts';
|
|
6
6
|
import isFunction from 'lodash/fp/isFunction';
|
|
7
7
|
import isObject from 'lodash/fp/isObject';
|
|
8
8
|
import { getFromDefaultColors, getColor, mapGridOptions, CURSOR_BACKGROUND_COLOR } from './chartHelper';
|
|
9
9
|
import ChartTooltip from './ChartTooltip';
|
|
10
|
-
import
|
|
10
|
+
import { getLegendDefaultProps } from './Legend';
|
|
11
11
|
const BarChart = (props) => {
|
|
12
12
|
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "layout", "legend", "bars", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showGrid", "showXAxis", "showYAxis", "useDataColors", "brush", "tooltip"]);
|
|
13
13
|
const tooltipProps = isObject(tooltip) ? tooltip.props : {};
|
|
14
|
-
const legendProps = isObject(legend) ? legend.props : {};
|
|
14
|
+
const legendProps = isObject(legend) ? Object.assign(Object.assign({}, getLegendDefaultProps()), legend.props) : {};
|
|
15
15
|
let legendPayload;
|
|
16
16
|
if (useDataColors) {
|
|
17
17
|
legendPayload = data.map((entry, index) => {
|
|
@@ -19,7 +19,7 @@ const BarChart = (props) => {
|
|
|
19
19
|
return Object.assign(Object.assign({}, entry), { value: isFunction(dataKey) ? dataKey(entry) : entry[dataKey], color: legendColor });
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsBarChart, Object.assign({ layout: layout, width: width, height: height, data: data }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)),
|
|
22
|
+
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsBarChart, Object.assign({ layout: layout, width: width, height: height, data: data }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && _jsx(ChartTooltip, Object.assign({ cursor: { fill: CURSOR_BACKGROUND_COLOR } }, tooltipProps)), legend && _jsx(RechartsLegend, Object.assign({ payload: useDataColors ? legendPayload : undefined }, legendProps)), bars.map(bar => {
|
|
23
23
|
const _a = bar.props, { color } = _a, remainingBarProps = __rest(_a, ["color"]);
|
|
24
24
|
const cellColor = color && getColor(color);
|
|
25
25
|
return (_jsx(RechartsBar, 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,30 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
|
+
import 'react';
|
|
6
|
+
import { ComposedChart as RechartsComposedChart, Line as RechartsLine, Bar as RechartsBar, Area as RechartsArea, ReferenceLine as RechartsReferenceLine, Legend as RechartsLegend, XAxis, YAxis, Brush, CartesianGrid, ResponsiveContainer, } from 'recharts';
|
|
7
|
+
import isObject from 'lodash/fp/isObject';
|
|
8
|
+
import { getColor, mapGridOptions } from './chartHelper';
|
|
9
|
+
import ChartTooltip from './ChartTooltip';
|
|
10
|
+
import { getLegendDefaultProps } from './Legend';
|
|
11
|
+
const ComposedChart = (props) => {
|
|
12
|
+
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "bars", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
13
|
+
const tooltipProps = isObject(tooltip) ? tooltip.props : {};
|
|
14
|
+
const legendProps = isObject(legend) ? Object.assign(Object.assign({}, getLegendDefaultProps()), legend.props) : {};
|
|
15
|
+
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsComposedChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && _jsx(ChartTooltip, Object.assign({}, tooltipProps)), legend && _jsx(RechartsLegend, Object.assign({}, legendProps)), areas.map(area => {
|
|
16
|
+
const _a = area.props, { strokeColor, fill } = _a, remainingAreaProps = __rest(_a, ["strokeColor", "fill"]);
|
|
17
|
+
return (_createElement(RechartsArea, Object.assign({}, remainingAreaProps, { key: area.key, stroke: getColor(strokeColor), fill: getColor(fill) })));
|
|
18
|
+
}), bars.map(bar => {
|
|
19
|
+
const _a = bar.props, { color } = _a, remainingBarProps = __rest(_a, ["color"]);
|
|
20
|
+
const cellColor = color && getColor(color);
|
|
21
|
+
return _jsx(RechartsBar, Object.assign({ unit: dataUnit }, remainingBarProps, { fill: cellColor }), bar.key);
|
|
22
|
+
}), lines.map(line => {
|
|
23
|
+
const _a = line.props, { strokeColor } = _a, remainingLineProps = __rest(_a, ["strokeColor"]);
|
|
24
|
+
return _createElement(RechartsLine, Object.assign({}, remainingLineProps, { key: line.key, stroke: getColor(strokeColor) }));
|
|
25
|
+
}), referenceLines.map(referenceLine => {
|
|
26
|
+
const _a = referenceLine.props, { stroke } = _a, remainingReferenceLineProps = __rest(_a, ["stroke"]);
|
|
27
|
+
return (_createElement(RechartsReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: getColor(stroke) })));
|
|
28
|
+
}), brush && _jsx(Brush, { stroke: getColor('gray') })] })) })));
|
|
29
|
+
};
|
|
30
|
+
export 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,20 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
3
2
|
import 'react';
|
|
4
|
-
|
|
5
|
-
const Legend = (props) => {
|
|
6
|
-
const { verticalAlign, wrapperStyle } = props;
|
|
7
|
-
return (_jsx(RechartsLegend
|
|
8
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
9
|
-
, Object.assign({
|
|
10
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
11
|
-
formatter: props.formatter, wrapperStyle: verticalAlign === 'bottom' ? { bottom: 0 } : wrapperStyle }, props)));
|
|
12
|
-
};
|
|
13
|
-
Legend.defaultProps = {
|
|
3
|
+
export const getLegendDefaultProps = () => ({
|
|
14
4
|
iconType: 'circle',
|
|
15
5
|
iconSize: 12,
|
|
16
6
|
layout: 'vertical',
|
|
17
7
|
align: 'right',
|
|
18
8
|
verticalAlign: 'top',
|
|
19
|
-
};
|
|
9
|
+
});
|
|
10
|
+
const Legend = (props) => null;
|
|
20
11
|
export 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,10 +1,2 @@
|
|
|
1
|
-
const Line = () => null;
|
|
2
|
-
Line.defaultProps = {
|
|
3
|
-
dataKey: 'value',
|
|
4
|
-
unit: '',
|
|
5
|
-
strokeColor: 'color-coldplay-fountain',
|
|
6
|
-
legendType: 'square',
|
|
7
|
-
type: 'monotone',
|
|
8
|
-
isAnimationActive: true,
|
|
9
|
-
};
|
|
1
|
+
const Line = ({ dataKey = 'value', unit = '', strokeColor = 'color-coldplay-fountain', legendType = 'square', type = 'monotone', isAnimationActive = true, }) => null;
|
|
10
2
|
export default Line;
|