@vritti/quantum-ui 0.5.8 → 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActiveShapeUtils.js +1 -1
- package/dist/AreaChart.js +1 -1
- package/dist/Avatar.js +5 -5
- package/dist/BarChart.js +1 -1
- package/dist/Breadcrumb.js +3 -1
- package/dist/Breadcrumb.js.map +1 -1
- package/dist/Button.js +1 -1
- package/dist/CartesianChart.js +40 -2
- package/dist/CartesianChart.js.map +1 -1
- package/dist/Chart.js +7 -3
- package/dist/Chart.js.map +1 -1
- package/dist/Checkbox.js +30 -6
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox2.js +2 -2
- package/dist/CheckboxGroup.js +20 -3
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/CurrencyField.js +17 -5
- package/dist/CurrencyField.js.map +1 -1
- package/dist/DangerZoneSkeleton.js +1 -1
- package/dist/DatePicker.js +144 -126
- package/dist/DatePicker.js.map +1 -1
- package/dist/DateRangePicker.js +138 -122
- package/dist/DateRangePicker.js.map +1 -1
- package/dist/DateTimePicker.js +181 -163
- package/dist/DateTimePicker.js.map +1 -1
- package/dist/DateTimeRangePicker.js +189 -173
- package/dist/DateTimeRangePicker.js.map +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/DropdownMenu.js +1 -1
- package/dist/Form.js +2 -0
- package/dist/Form.js.map +1 -1
- package/dist/FormSection.js +22 -0
- package/dist/FormSection.js.map +1 -1
- package/dist/IconSelect.js +4 -2
- package/dist/IconSelect.js.map +1 -1
- package/dist/Label.js +1 -1
- package/dist/LineChart.js +390 -9
- package/dist/LineChart.js.map +1 -1
- package/dist/OTPField.js +39 -24
- package/dist/OTPField.js.map +1 -1
- package/dist/PermissionGate.js +25 -3
- package/dist/PermissionGate.js.map +1 -1
- package/dist/PhoneField.js +47 -30
- package/dist/PhoneField.js.map +1 -1
- package/dist/PieChart.js +1 -1
- package/dist/Progress.js +2 -2
- package/dist/RadarChart.js +1 -1
- package/dist/RadialChart.js +1 -1
- package/dist/RadioGroup.js +35 -18
- package/dist/RadioGroup.js.map +1 -1
- package/dist/Select.js +53 -33
- package/dist/Select.js.map +1 -1
- package/dist/SelectFilter.js +13 -6
- package/dist/SelectFilter.js.map +1 -1
- package/dist/Sidebar.js +1 -1
- package/dist/SingleSelect.js +50 -24
- package/dist/SingleSelect.js.map +1 -1
- package/dist/Switch.js +3 -3
- package/dist/TabsSkeleton.js +2 -2
- package/dist/TextArea.js +28 -12
- package/dist/TextArea.js.map +1 -1
- package/dist/TextField.js +70 -53
- package/dist/TextField.js.map +1 -1
- package/dist/Toggle.js +1 -1
- package/dist/UploadFile.js +22 -4
- package/dist/UploadFile.js.map +1 -1
- package/dist/assets/quantum-ui.css +76 -1
- package/dist/calendar2.js +1 -1
- package/dist/calendar2.js.map +1 -1
- package/dist/components/DateFilter.js +158 -0
- package/dist/components/DateFilter.js.map +1 -0
- package/dist/components/PermissionGate.js +1 -1
- package/dist/components/RichTextEditor.js +1 -1
- package/dist/components/TokenInput.js +96 -66
- package/dist/components/TokenInput.js.map +1 -1
- package/dist/contextAnchor.js +11 -0
- package/dist/contextAnchor.js.map +1 -0
- package/dist/disabledTip.js +3 -2
- package/dist/disabledTip.js.map +1 -1
- package/dist/dropdown-menu.js +5 -5
- package/dist/getZIndexFromUnknown.js +1 -1
- package/dist/image-component.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index13.js +34 -5
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +22 -281
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +212 -1072
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +1139 -14
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +14 -20
- package/dist/index17.js.map +1 -1
- package/dist/index20.js +2 -2
- package/dist/index21.js +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.js +1 -1
- package/dist/index25.js +4 -232
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +35 -2534
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +223 -23
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +1124 -3
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +2481 -1035
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +308 -36
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +7 -307
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +30 -8
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +59 -29
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +10 -59
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +35347 -9
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +79 -36
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +184 -35340
- package/dist/index37.js.map +1 -1
- package/dist/index5.js +1 -1
- package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -1
- package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/lib/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts +1 -0
- package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
- package/dist/lib/components/CurrencyField/CurrencyField.d.ts +1 -0
- package/dist/lib/components/CurrencyField/CurrencyField.d.ts.map +1 -1
- package/dist/lib/components/DataTable/DataTable.d.ts +1 -1
- package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/RowActions.d.ts +1 -0
- package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -1
- package/dist/lib/components/DataTable/store/store.d.ts.map +1 -1
- package/dist/lib/components/DataTable/types.d.ts +1 -0
- package/dist/lib/components/DataTable/types.d.ts.map +1 -1
- package/dist/lib/components/DateFilter/DateFilter.d.ts +17 -0
- package/dist/lib/components/DateFilter/DateFilter.d.ts.map +1 -0
- package/dist/lib/components/DateFilter/index.d.ts +3 -0
- package/dist/lib/components/DateFilter/index.d.ts.map +1 -0
- package/dist/lib/components/DatePicker/DatePicker.d.ts +1 -0
- package/dist/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/lib/components/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/lib/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/lib/components/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/dist/lib/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/lib/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -0
- package/dist/lib/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/lib/components/Form/Form.d.ts.map +1 -1
- package/dist/lib/components/Form/FormSection.d.ts +1 -1
- package/dist/lib/components/Form/FormSection.d.ts.map +1 -1
- package/dist/lib/components/Form/fieldPermissions.d.ts +6 -0
- package/dist/lib/components/Form/fieldPermissions.d.ts.map +1 -0
- package/dist/lib/components/LineChart/LineChart.d.ts +18 -4
- package/dist/lib/components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/lib/components/LineChart/index.d.ts +1 -1
- package/dist/lib/components/LineChart/index.d.ts.map +1 -1
- package/dist/lib/components/OTPField/OTPField.d.ts +1 -0
- package/dist/lib/components/OTPField/OTPField.d.ts.map +1 -1
- package/dist/lib/components/PermissionGate/PermissionGate.d.ts +1 -0
- package/dist/lib/components/PermissionGate/PermissionGate.d.ts.map +1 -1
- package/dist/lib/components/PermissionGate/index.d.ts +1 -1
- package/dist/lib/components/PermissionGate/index.d.ts.map +1 -1
- package/dist/lib/components/PhoneField/PhoneField.d.ts +1 -0
- package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
- package/dist/lib/components/RadioGroup/RadioGroup.d.ts +1 -0
- package/dist/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/lib/components/Select/Select.d.ts.map +1 -1
- package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts +1 -0
- package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts +1 -0
- package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts +3 -0
- package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/contextAnchor.d.ts +11 -0
- package/dist/lib/components/Select/contextAnchor.d.ts.map +1 -0
- package/dist/lib/components/TextArea/TextArea.d.ts +1 -0
- package/dist/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/lib/components/TextField/TextField.d.ts +1 -0
- package/dist/lib/components/TextField/TextField.d.ts.map +1 -1
- package/dist/lib/components/TokenInput/TokenInput.d.ts +1 -0
- package/dist/lib/components/TokenInput/TokenInput.d.ts.map +1 -1
- package/dist/lib/components/UploadFile/UploadFile.d.ts +1 -0
- package/dist/lib/components/UploadFile/UploadFile.d.ts.map +1 -1
- package/dist/lib/selects/icon/IconSelect.d.ts +1 -0
- package/dist/lib/selects/icon/IconSelect.d.ts.map +1 -1
- package/dist/lib/utils/disabledTip.d.ts +1 -1
- package/dist/lib/utils/disabledTip.d.ts.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/select2.js +1 -1
- package/dist/separator2.js +1 -1
- package/dist/shadcn/shadcnChart/Chart.d.ts +2 -1
- package/dist/shadcn/shadcnChart/Chart.d.ts.map +1 -1
- package/dist/useDataTable.js +25 -9
- package/dist/useDataTable.js.map +1 -1
- package/dist/utils/motion.js +2 -2
- package/dist/value.js +1 -1
- package/package.json +5 -1
- package/dist/index38.js +0 -84
- package/dist/index38.js.map +0 -1
- package/dist/index39.js +0 -199
- package/dist/index39.js.map +0 -1
- package/dist/lock-keyhole.js +0 -19
- package/dist/lock-keyhole.js.map +0 -1
package/dist/Label.js
CHANGED
package/dist/LineChart.js
CHANGED
|
@@ -1,14 +1,319 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { $ as resolveDefaultProps, u as useAppDispatch, bb as addLine, bc as removeLine, D as DefaultZIndexes, ah as useIsPanorama, bd as useClipPathId, A as useAppSelector, be as selectXAxisSettings, bf as selectYAxisSettings, bg as selectAxisScale, bh as useViewBox, aA as svgPropertiesAndEvents, Z as ZIndexLayer, L as Layer, bi as CartesianLabelContextProvider, bj as CartesianLabelFromLabelProp, aC as isWellBehavedNumber, bk as isNumOrStr, c as createSelector, e as selectChartLayout, bl as selectChartDataWithIndexesIfNotInPanoramaPosition4, a9 as selectAxisWithScale, aa as selectTicksOfGraphicalItem, ae as selectUnfilteredCartesianItems, ac as isCategoricalAxis, ad as getBandSizeOfAxis, ag as propsAreEqual, ai as RegisterGraphicalItemId, aj as SetLegendPayload, ak as SetCartesianGraphicalItem, am as getTooltipNameProp, an as SetTooltipEntrySettings, ao as noop, ar as usePlotArea, ap as useChartLayout, y as isClipDot, Y as getValueByDataKey, as as getCateCoordinateOfLine, E as isNullish, at as useAnimationId, av as JavascriptAnimate, aw as interpolate, ay as LabelListFromLabelProp, az as CartesianLabelListContextProvider, x as svgPropertiesNoEvents, aD as arrayTooltipSearcher, aE as ChartContainer, aF as ChartTooltip, aG as ChartTooltipContent, aH as ChartLegend, aI as ChartLegendContent } from './Chart.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { Component, useRef, useState, useCallback, useMemo, forwardRef } from 'react';
|
|
5
|
-
import { u as useNeedsClip, G as GraphicalItemClipPath, C as CartesianChart, a as CartesianGrid, X as XAxis, Y as YAxis } from './CartesianChart.js';
|
|
4
|
+
import { useEffect, Component, useRef, useState, useCallback, useMemo, forwardRef } from 'react';
|
|
5
|
+
import { r as rectWithCoords, u as useNeedsClip, G as GraphicalItemClipPath, C as CartesianChart, a as CartesianGrid, X as XAxis, Y as YAxis } from './CartesianChart.js';
|
|
6
6
|
import { a as clsx } from './utils.js';
|
|
7
7
|
import { A as ActivePoints, D as Dots } from './ActivePoints.js';
|
|
8
8
|
import { S as SetErrorBarContext } from './ErrorBarContext.js';
|
|
9
9
|
import { g as getRadiusAndStrokeWidthFromDot } from './getRadiusAndStrokeWidthFromDot.js';
|
|
10
10
|
import { S as Shape } from './ActiveShapeUtils.js';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Groups X and Y scale functions together and provides helper methods.
|
|
14
|
+
*/
|
|
15
|
+
class CartesianScaleHelperImpl {
|
|
16
|
+
constructor(_ref) {
|
|
17
|
+
var {
|
|
18
|
+
x,
|
|
19
|
+
y
|
|
20
|
+
} = _ref;
|
|
21
|
+
this.xAxisScale = x;
|
|
22
|
+
this.yAxisScale = y;
|
|
23
|
+
}
|
|
24
|
+
map(value, _ref2) {
|
|
25
|
+
var _this$xAxisScale$map, _this$yAxisScale$map;
|
|
26
|
+
var {
|
|
27
|
+
position
|
|
28
|
+
} = _ref2;
|
|
29
|
+
return {
|
|
30
|
+
x: (_this$xAxisScale$map = this.xAxisScale.map(value.x, {
|
|
31
|
+
position
|
|
32
|
+
})) !== null && _this$xAxisScale$map !== void 0 ? _this$xAxisScale$map : 0,
|
|
33
|
+
y: (_this$yAxisScale$map = this.yAxisScale.map(value.y, {
|
|
34
|
+
position
|
|
35
|
+
})) !== null && _this$yAxisScale$map !== void 0 ? _this$yAxisScale$map : 0
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
mapWithFallback(value, _ref3) {
|
|
39
|
+
var _this$xAxisScale$map2, _this$yAxisScale$map2;
|
|
40
|
+
var {
|
|
41
|
+
position,
|
|
42
|
+
fallback
|
|
43
|
+
} = _ref3;
|
|
44
|
+
var fallbackY, fallbackX;
|
|
45
|
+
if (fallback === 'rangeMin') {
|
|
46
|
+
fallbackY = this.yAxisScale.rangeMin();
|
|
47
|
+
} else if (fallback === 'rangeMax') {
|
|
48
|
+
fallbackY = this.yAxisScale.rangeMax();
|
|
49
|
+
} else {
|
|
50
|
+
fallbackY = 0;
|
|
51
|
+
}
|
|
52
|
+
if (fallback === 'rangeMin') {
|
|
53
|
+
fallbackX = this.xAxisScale.rangeMin();
|
|
54
|
+
} else if (fallback === 'rangeMax') {
|
|
55
|
+
fallbackX = this.xAxisScale.rangeMax();
|
|
56
|
+
} else {
|
|
57
|
+
fallbackX = 0;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
x: (_this$xAxisScale$map2 = this.xAxisScale.map(value.x, {
|
|
61
|
+
position
|
|
62
|
+
})) !== null && _this$xAxisScale$map2 !== void 0 ? _this$xAxisScale$map2 : fallbackX,
|
|
63
|
+
y: (_this$yAxisScale$map2 = this.yAxisScale.map(value.y, {
|
|
64
|
+
position
|
|
65
|
+
})) !== null && _this$yAxisScale$map2 !== void 0 ? _this$yAxisScale$map2 : fallbackY
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
isInRange(_ref4) {
|
|
69
|
+
var {
|
|
70
|
+
x,
|
|
71
|
+
y
|
|
72
|
+
} = _ref4;
|
|
73
|
+
var xInRange = x == null || this.xAxisScale.isInRange(x);
|
|
74
|
+
var yInRange = y == null || this.yAxisScale.isInRange(y);
|
|
75
|
+
return xInRange && yInRange;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
80
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
81
|
+
function _defineProperty$1(e, r, t) { return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
|
|
82
|
+
function _toPropertyKey$1(t) { var i = _toPrimitive$1(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
83
|
+
function _toPrimitive$1(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
84
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Single point that defines one end of a segment.
|
|
88
|
+
* These coordinates are in data space, meaning that you should provide
|
|
89
|
+
* values that correspond to the data domain of the axes.
|
|
90
|
+
* So you would provide a value of `Page A` to indicate the data value `Page A`
|
|
91
|
+
* and then recharts will convert that to pixels.
|
|
92
|
+
*
|
|
93
|
+
* Likewise for numbers. If your x-axis goes from 0 to 100,
|
|
94
|
+
* and you want the line to end at 50, you would provide `50` here.
|
|
95
|
+
*
|
|
96
|
+
* @inline
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* This excludes `viewBox` prop from svg for two reasons:
|
|
101
|
+
* 1. The components wants viewBox of object type, and svg wants string
|
|
102
|
+
* - so there's a conflict, and the component will throw if it gets string
|
|
103
|
+
* 2. Internally the component calls `svgPropertiesNoEvents` which filters the viewBox away anyway
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
var renderLine = (option, props) => {
|
|
107
|
+
var line;
|
|
108
|
+
if (/*#__PURE__*/React.isValidElement(option)) {
|
|
109
|
+
// @ts-expect-error element cloning is not typed
|
|
110
|
+
line = /*#__PURE__*/React.cloneElement(option, props);
|
|
111
|
+
} else if (typeof option === 'function') {
|
|
112
|
+
line = option(props);
|
|
113
|
+
} else {
|
|
114
|
+
if (!isWellBehavedNumber(props.x1) || !isWellBehavedNumber(props.y1) || !isWellBehavedNumber(props.x2) || !isWellBehavedNumber(props.y2)) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
line = /*#__PURE__*/React.createElement("line", _extends$1({}, props, {
|
|
118
|
+
className: "recharts-reference-line-line"
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
return line;
|
|
122
|
+
};
|
|
123
|
+
var getHorizontalLineEndPoints = (yCoord, ifOverflow, position, yAxisOrientation, yAxisScale, viewBox) => {
|
|
124
|
+
var {
|
|
125
|
+
x,
|
|
126
|
+
width
|
|
127
|
+
} = viewBox;
|
|
128
|
+
var coord = yAxisScale.map(yCoord, {
|
|
129
|
+
position
|
|
130
|
+
});
|
|
131
|
+
// don't render the line if the scale can't compute a result that makes sense
|
|
132
|
+
if (!isWellBehavedNumber(coord)) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
if (ifOverflow === 'discard' && !yAxisScale.isInRange(coord)) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
var points = [{
|
|
139
|
+
x: x + width,
|
|
140
|
+
y: coord
|
|
141
|
+
}, {
|
|
142
|
+
x,
|
|
143
|
+
y: coord
|
|
144
|
+
}];
|
|
145
|
+
return yAxisOrientation === 'left' ? points.reverse() : points;
|
|
146
|
+
};
|
|
147
|
+
var getVerticalLineEndPoints = (xCoord, ifOverflow, position, xAxisOrientation, xAxisScale, viewBox) => {
|
|
148
|
+
var {
|
|
149
|
+
y,
|
|
150
|
+
height
|
|
151
|
+
} = viewBox;
|
|
152
|
+
var coord = xAxisScale.map(xCoord, {
|
|
153
|
+
position
|
|
154
|
+
});
|
|
155
|
+
// don't render the line if the scale can't compute a result that makes sense
|
|
156
|
+
if (!isWellBehavedNumber(coord)) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
if (ifOverflow === 'discard' && !xAxisScale.isInRange(coord)) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
var points = [{
|
|
163
|
+
x: coord,
|
|
164
|
+
y: y + height
|
|
165
|
+
}, {
|
|
166
|
+
x: coord,
|
|
167
|
+
y
|
|
168
|
+
}];
|
|
169
|
+
return xAxisOrientation === 'top' ? points.reverse() : points;
|
|
170
|
+
};
|
|
171
|
+
var getSegmentLineEndPoints = (segment, ifOverflow, position, scales) => {
|
|
172
|
+
var points = [scales.mapWithFallback(segment[0], {
|
|
173
|
+
position,
|
|
174
|
+
fallback: 'rangeMin'
|
|
175
|
+
}), scales.mapWithFallback(segment[1], {
|
|
176
|
+
position,
|
|
177
|
+
fallback: 'rangeMax'
|
|
178
|
+
})];
|
|
179
|
+
if (ifOverflow === 'discard' && points.some(p => !scales.isInRange(p))) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
return points;
|
|
183
|
+
};
|
|
184
|
+
var getEndPoints = (xAxisScale, yAxisScale, viewBox, position, xAxisOrientation, yAxisOrientation, props) => {
|
|
185
|
+
var {
|
|
186
|
+
x: xCoord,
|
|
187
|
+
y: yCoord,
|
|
188
|
+
segment,
|
|
189
|
+
ifOverflow
|
|
190
|
+
} = props;
|
|
191
|
+
var isFixedX = isNumOrStr(xCoord);
|
|
192
|
+
var isFixedY = isNumOrStr(yCoord);
|
|
193
|
+
if (isFixedY) {
|
|
194
|
+
return getHorizontalLineEndPoints(yCoord, ifOverflow, position, yAxisOrientation, yAxisScale, viewBox);
|
|
195
|
+
}
|
|
196
|
+
if (isFixedX) {
|
|
197
|
+
return getVerticalLineEndPoints(xCoord, ifOverflow, position, xAxisOrientation, xAxisScale, viewBox);
|
|
198
|
+
}
|
|
199
|
+
if (segment != null && segment.length === 2) {
|
|
200
|
+
return getSegmentLineEndPoints(segment, ifOverflow, position, new CartesianScaleHelperImpl({
|
|
201
|
+
x: xAxisScale,
|
|
202
|
+
y: yAxisScale
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
};
|
|
207
|
+
function ReportReferenceLine(props) {
|
|
208
|
+
var dispatch = useAppDispatch();
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
dispatch(addLine(props));
|
|
211
|
+
return () => {
|
|
212
|
+
dispatch(removeLine(props));
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
function ReferenceLineImpl(props) {
|
|
218
|
+
var {
|
|
219
|
+
xAxisId,
|
|
220
|
+
yAxisId,
|
|
221
|
+
shape,
|
|
222
|
+
className,
|
|
223
|
+
ifOverflow
|
|
224
|
+
} = props;
|
|
225
|
+
var isPanorama = useIsPanorama();
|
|
226
|
+
var clipPathId = useClipPathId();
|
|
227
|
+
var xAxis = useAppSelector(state => selectXAxisSettings(state, xAxisId));
|
|
228
|
+
var yAxis = useAppSelector(state => selectYAxisSettings(state, yAxisId));
|
|
229
|
+
var xAxisScale = useAppSelector(state => selectAxisScale(state, 'xAxis', xAxisId, isPanorama));
|
|
230
|
+
var yAxisScale = useAppSelector(state => selectAxisScale(state, 'yAxis', yAxisId, isPanorama));
|
|
231
|
+
var viewBox = useViewBox();
|
|
232
|
+
if (!clipPathId || !viewBox || xAxis == null || yAxis == null || xAxisScale == null || yAxisScale == null) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
var endPoints = getEndPoints(xAxisScale, yAxisScale, viewBox, props.position, xAxis.orientation, yAxis.orientation, props);
|
|
236
|
+
if (!endPoints) {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
var point1 = endPoints[0];
|
|
240
|
+
var point2 = endPoints[1];
|
|
241
|
+
if (point1 == null || point2 == null) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
var {
|
|
245
|
+
x: x1,
|
|
246
|
+
y: y1
|
|
247
|
+
} = point1;
|
|
248
|
+
var {
|
|
249
|
+
x: x2,
|
|
250
|
+
y: y2
|
|
251
|
+
} = point2;
|
|
252
|
+
var clipPath = ifOverflow === 'hidden' ? "url(#".concat(clipPathId, ")") : undefined;
|
|
253
|
+
var lineProps = _objectSpread$1(_objectSpread$1({
|
|
254
|
+
clipPath
|
|
255
|
+
}, svgPropertiesAndEvents(props)), {}, {
|
|
256
|
+
x1,
|
|
257
|
+
y1,
|
|
258
|
+
x2,
|
|
259
|
+
y2
|
|
260
|
+
});
|
|
261
|
+
var rect = rectWithCoords({
|
|
262
|
+
x1,
|
|
263
|
+
y1,
|
|
264
|
+
x2,
|
|
265
|
+
y2
|
|
266
|
+
});
|
|
267
|
+
return /*#__PURE__*/React.createElement(ZIndexLayer, {
|
|
268
|
+
zIndex: props.zIndex
|
|
269
|
+
}, /*#__PURE__*/React.createElement(Layer, {
|
|
270
|
+
className: clsx('recharts-reference-line', className)
|
|
271
|
+
}, renderLine(shape, lineProps), /*#__PURE__*/React.createElement(CartesianLabelContextProvider, _extends$1({}, rect, {
|
|
272
|
+
lowerWidth: rect.width,
|
|
273
|
+
upperWidth: rect.width
|
|
274
|
+
}), /*#__PURE__*/React.createElement(CartesianLabelFromLabelProp, {
|
|
275
|
+
label: props.label
|
|
276
|
+
}), props.children)));
|
|
277
|
+
}
|
|
278
|
+
var referenceLineDefaultProps = {
|
|
279
|
+
ifOverflow: 'discard',
|
|
280
|
+
xAxisId: 0,
|
|
281
|
+
yAxisId: 0,
|
|
282
|
+
fill: 'none',
|
|
283
|
+
label: false,
|
|
284
|
+
stroke: '#ccc',
|
|
285
|
+
fillOpacity: 1,
|
|
286
|
+
strokeWidth: 1,
|
|
287
|
+
position: 'middle',
|
|
288
|
+
zIndex: DefaultZIndexes.line
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Draws a line on the chart connecting two points.
|
|
292
|
+
*
|
|
293
|
+
* This component, unlike {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/line line}, is aware of the cartesian coordinate system,
|
|
294
|
+
* so you specify the dimensions by using data coordinates instead of pixels.
|
|
295
|
+
*
|
|
296
|
+
* ReferenceLine will calculate the pixels based on the provided data coordinates.
|
|
297
|
+
*
|
|
298
|
+
* If you prefer to render using pixels rather than data coordinates,
|
|
299
|
+
* consider using the {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/line line SVG element} instead.
|
|
300
|
+
*
|
|
301
|
+
* @provides CartesianLabelContext
|
|
302
|
+
* @consumes CartesianChartContext
|
|
303
|
+
*/
|
|
304
|
+
function ReferenceLine(outsideProps) {
|
|
305
|
+
var props = resolveDefaultProps(outsideProps, referenceLineDefaultProps);
|
|
306
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReportReferenceLine, {
|
|
307
|
+
yAxisId: props.yAxisId,
|
|
308
|
+
xAxisId: props.xAxisId,
|
|
309
|
+
ifOverflow: props.ifOverflow,
|
|
310
|
+
x: props.x,
|
|
311
|
+
y: props.y,
|
|
312
|
+
segment: props.segment
|
|
313
|
+
}), /*#__PURE__*/React.createElement(ReferenceLineImpl, props));
|
|
314
|
+
}
|
|
315
|
+
ReferenceLine.displayName = 'ReferenceLine';
|
|
316
|
+
|
|
12
317
|
var selectXAxisWithScale = (state, xAxisId, _yAxisId, isPanorama) => selectAxisWithScale(state, 'xAxis', xAxisId, isPanorama);
|
|
13
318
|
var selectXAxisTicks = (state, xAxisId, _yAxisId, isPanorama) => selectTicksOfGraphicalItem(state, 'xAxis', xAxisId, isPanorama);
|
|
14
319
|
var selectYAxisWithScale = (state, _xAxisId, yAxisId, isPanorama) => selectAxisWithScale(state, 'yAxis', yAxisId, isPanorama);
|
|
@@ -783,12 +1088,86 @@ var LineChart$1 = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
783
1088
|
});
|
|
784
1089
|
});
|
|
785
1090
|
|
|
786
|
-
const LineChart = ({
|
|
1091
|
+
const LineChart = ({
|
|
1092
|
+
data,
|
|
1093
|
+
config,
|
|
1094
|
+
xAxisKey,
|
|
1095
|
+
lines,
|
|
1096
|
+
className,
|
|
1097
|
+
valueFormatter,
|
|
1098
|
+
xAxisFormatter,
|
|
1099
|
+
connectNulls = false,
|
|
1100
|
+
xAxisType = "category",
|
|
1101
|
+
showLegend = true,
|
|
1102
|
+
yDomain,
|
|
1103
|
+
markers
|
|
1104
|
+
}) => /* @__PURE__ */ jsx(ChartContainer, { config, className: className ?? "min-h-75 w-full", children: /* @__PURE__ */ jsxs(LineChart$1, { data, children: [
|
|
787
1105
|
/* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
|
|
788
|
-
/* @__PURE__ */ jsx(
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
1106
|
+
xAxisType === "time" ? /* @__PURE__ */ jsx(
|
|
1107
|
+
XAxis,
|
|
1108
|
+
{
|
|
1109
|
+
dataKey: xAxisKey,
|
|
1110
|
+
type: "number",
|
|
1111
|
+
scale: "time",
|
|
1112
|
+
domain: ["dataMin", "dataMax"],
|
|
1113
|
+
padding: { left: 44, right: 44 },
|
|
1114
|
+
tickLine: false,
|
|
1115
|
+
axisLine: false,
|
|
1116
|
+
tickMargin: 10,
|
|
1117
|
+
minTickGap: 24,
|
|
1118
|
+
tickFormatter: xAxisFormatter
|
|
1119
|
+
}
|
|
1120
|
+
) : /* @__PURE__ */ jsx(
|
|
1121
|
+
XAxis,
|
|
1122
|
+
{
|
|
1123
|
+
dataKey: xAxisKey,
|
|
1124
|
+
tickLine: false,
|
|
1125
|
+
axisLine: false,
|
|
1126
|
+
tickMargin: 10,
|
|
1127
|
+
minTickGap: 24,
|
|
1128
|
+
tickFormatter: xAxisFormatter
|
|
1129
|
+
}
|
|
1130
|
+
),
|
|
1131
|
+
/* @__PURE__ */ jsx(
|
|
1132
|
+
YAxis,
|
|
1133
|
+
{
|
|
1134
|
+
tickLine: false,
|
|
1135
|
+
axisLine: false,
|
|
1136
|
+
tickMargin: 8,
|
|
1137
|
+
padding: { top: 8, bottom: 16 },
|
|
1138
|
+
tickFormatter: valueFormatter,
|
|
1139
|
+
width: valueFormatter ? "auto" : void 0,
|
|
1140
|
+
domain: yDomain,
|
|
1141
|
+
allowDataOverflow: false
|
|
1142
|
+
}
|
|
1143
|
+
),
|
|
1144
|
+
/* @__PURE__ */ jsx(
|
|
1145
|
+
ChartTooltip,
|
|
1146
|
+
{
|
|
1147
|
+
content: /* @__PURE__ */ jsx(
|
|
1148
|
+
ChartTooltipContent,
|
|
1149
|
+
{
|
|
1150
|
+
valueFormatter,
|
|
1151
|
+
labelFormatter: xAxisFormatter ? (label, payload) => {
|
|
1152
|
+
const xValue = payload?.[0]?.payload?.[xAxisKey] ?? label;
|
|
1153
|
+
return typeof xValue === "string" || typeof xValue === "number" ? xAxisFormatter(xValue) : null;
|
|
1154
|
+
} : void 0
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1157
|
+
}
|
|
1158
|
+
),
|
|
1159
|
+
showLegend && /* @__PURE__ */ jsx(ChartLegend, { content: /* @__PURE__ */ jsx(ChartLegendContent, {}) }),
|
|
1160
|
+
markers?.map((marker) => /* @__PURE__ */ jsx(
|
|
1161
|
+
ReferenceLine,
|
|
1162
|
+
{
|
|
1163
|
+
x: marker.x,
|
|
1164
|
+
stroke: "var(--muted-foreground)",
|
|
1165
|
+
strokeDasharray: "4 4",
|
|
1166
|
+
ifOverflow: "extendDomain",
|
|
1167
|
+
label: marker.label ? { value: marker.label, position: "insideTopLeft", fill: "var(--muted-foreground)", fontSize: 12 } : void 0
|
|
1168
|
+
},
|
|
1169
|
+
String(marker.x)
|
|
1170
|
+
)),
|
|
792
1171
|
lines.map((line) => /* @__PURE__ */ jsx(
|
|
793
1172
|
Line,
|
|
794
1173
|
{
|
|
@@ -796,7 +1175,9 @@ const LineChart = ({ data, config, xAxisKey, lines, className }) => /* @__PURE__
|
|
|
796
1175
|
dataKey: line.dataKey,
|
|
797
1176
|
stroke: `var(--color-${line.dataKey})`,
|
|
798
1177
|
strokeWidth: 2,
|
|
799
|
-
|
|
1178
|
+
strokeDasharray: line.strokeDasharray,
|
|
1179
|
+
dot: line.dot ? { r: 4 } : false,
|
|
1180
|
+
connectNulls: line.connectNulls ?? connectNulls
|
|
800
1181
|
},
|
|
801
1182
|
line.dataKey
|
|
802
1183
|
))
|