@octanejs/recharts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +53 -0
- package/src/animation/AnimatedItems.tsrx +82 -0
- package/src/animation/AnimationControllerImpl.js +33 -0
- package/src/animation/AnimationHandle.js +291 -0
- package/src/animation/JavascriptAnimate.tsrx +81 -0
- package/src/animation/easing.js +193 -0
- package/src/animation/matchBy.js +279 -0
- package/src/animation/timeoutController.js +49 -0
- package/src/animation/useAnimationController.ts +22 -0
- package/src/animation/useAnimationStartSnapshot.ts +43 -0
- package/src/animation/util.js +11 -0
- package/src/cartesian/Bar.ts +4 -0
- package/src/cartesian/Bar.tsrx +716 -0
- package/src/cartesian/Bar.tsrx.d.ts +4 -0
- package/src/cartesian/BarStack.tsrx +97 -0
- package/src/cartesian/BarStack.tsrx.d.ts +6 -0
- package/src/cartesian/CartesianAxis.tsrx +413 -0
- package/src/cartesian/CartesianAxis.tsrx.d.ts +3 -0
- package/src/cartesian/GraphicalItemClipPath.tsrx +44 -0
- package/src/cartesian/Line.ts +4 -0
- package/src/cartesian/Line.tsrx +544 -0
- package/src/cartesian/Line.tsrx.d.ts +4 -0
- package/src/cartesian/LineDrawShape.tsrx +106 -0
- package/src/cartesian/LineDrawShape.tsrx.d.ts +2 -0
- package/src/cartesian/XAxis.tsrx +156 -0
- package/src/cartesian/XAxis.tsrx.d.ts +3 -0
- package/src/cartesian/YAxis.tsrx +183 -0
- package/src/cartesian/YAxis.tsrx.d.ts +3 -0
- package/src/cartesian/getCartesianPosition.js +277 -0
- package/src/cartesian/getEquidistantTicks.js +133 -0
- package/src/cartesian/getTicks.js +280 -0
- package/src/cartesian/useAnimatedLineLength.ts +33 -0
- package/src/chart/BarChart.tsrx +22 -0
- package/src/chart/BarChart.tsrx.d.ts +2 -0
- package/src/chart/CartesianChart.tsrx +76 -0
- package/src/chart/CartesianChart.tsrx.d.ts +10 -0
- package/src/chart/CategoricalChart.tsrx +54 -0
- package/src/chart/LineChart.tsrx +22 -0
- package/src/chart/LineChart.tsrx.d.ts +2 -0
- package/src/chart/RechartsWrapper.tsrx +294 -0
- package/src/component/ActivePoints.tsrx +76 -0
- package/src/component/Cell.ts +37 -0
- package/src/component/Dots.tsrx +74 -0
- package/src/component/Label.tsrx +309 -0
- package/src/component/Label.tsrx.d.ts +12 -0
- package/src/component/LabelList.tsrx +83 -0
- package/src/component/LabelList.tsrx.d.ts +8 -0
- package/src/component/ResponsiveContainer.ts +22 -0
- package/src/component/Text.tsrx +281 -0
- package/src/component/Text.tsrx.d.ts +9 -0
- package/src/component/responsiveContainerUtils.js +111 -0
- package/src/container/ClipPathProvider.tsrx +29 -0
- package/src/container/Layer.tsrx +9 -0
- package/src/container/Layer.tsrx.d.ts +6 -0
- package/src/container/RootSurface.tsrx +76 -0
- package/src/container/Surface.tsrx +23 -0
- package/src/container/Surface.tsrx.d.ts +12 -0
- package/src/context/CellsContext.ts +80 -0
- package/src/context/ErrorBarContext.tsrx +53 -0
- package/src/context/PanoramaContext.ts +10 -0
- package/src/context/RegisterGraphicalItemId.tsrx +19 -0
- package/src/context/accessibilityContext.js +10 -0
- package/src/context/chartDataContext.ts +57 -0
- package/src/context/chartLayoutContext.ts +171 -0
- package/src/context/legendPortalContext.ts +5 -0
- package/src/context/tooltipContext.js +55 -0
- package/src/context/tooltipPortalContext.ts +5 -0
- package/src/hooks.js +509 -0
- package/src/index.ts +64 -0
- package/src/internal.ts +37 -0
- package/src/polar/defaultPolarAngleAxisProps.js +27 -0
- package/src/polar/defaultPolarRadiusAxisProps.js +24 -0
- package/src/shape/Cross.tsrx +25 -0
- package/src/shape/Cross.tsrx.d.ts +12 -0
- package/src/shape/Curve.tsrx +132 -0
- package/src/shape/Curve.tsrx.d.ts +42 -0
- package/src/shape/Dot.tsrx +21 -0
- package/src/shape/Dot.tsrx.d.ts +9 -0
- package/src/shape/Polygon.tsrx +95 -0
- package/src/shape/Polygon.tsrx.d.ts +13 -0
- package/src/shape/Rectangle.tsrx +162 -0
- package/src/shape/Rectangle.tsrx.d.ts +31 -0
- package/src/shape/Sector.tsrx +219 -0
- package/src/shape/Sector.tsrx.d.ts +29 -0
- package/src/shape/Symbols.tsrx +95 -0
- package/src/shape/Symbols.tsrx.d.ts +15 -0
- package/src/shape/Trapezoid.tsrx +56 -0
- package/src/shape/Trapezoid.tsrx.d.ts +29 -0
- package/src/state/RechartsReduxContext.ts +7 -0
- package/src/state/RechartsStoreProvider.tsrx +24 -0
- package/src/state/ReportChartProps.ts +13 -0
- package/src/state/ReportEventSettings.ts +15 -0
- package/src/state/ReportMainChartProps.ts +22 -0
- package/src/state/SetGraphicalItem.ts +61 -0
- package/src/state/SetLegendPayload.ts +61 -0
- package/src/state/SetTooltipEntrySettings.ts +40 -0
- package/src/state/brushSlice.js +36 -0
- package/src/state/cartesianAxisSlice.js +256 -0
- package/src/state/chartDataSlice.js +67 -0
- package/src/state/errorBarSlice.js +53 -0
- package/src/state/eventSettingsSlice.js +25 -0
- package/src/state/externalEventsMiddleware.js +127 -0
- package/src/state/graphicalItemsSlice.js +91 -0
- package/src/state/hooks.ts +46 -0
- package/src/state/keyboardEventsMiddleware.js +226 -0
- package/src/state/layoutSlice.js +57 -0
- package/src/state/legendSlice.js +83 -0
- package/src/state/mouseEventsMiddleware.js +130 -0
- package/src/state/optionsSlice.js +45 -0
- package/src/state/polarAxisSlice.js +33 -0
- package/src/state/polarOptionsSlice.js +26 -0
- package/src/state/reduxDevtoolsJsonStringifyReplacer.js +14 -0
- package/src/state/referenceElementsSlice.js +51 -0
- package/src/state/renderedTicksSlice.js +41 -0
- package/src/state/rootPropsSlice.js +48 -0
- package/src/state/selectors/arrayEqualityCheck.js +32 -0
- package/src/state/selectors/axisSelectors.js +2113 -0
- package/src/state/selectors/barSelectors.js +263 -0
- package/src/state/selectors/barStackSelectors.js +65 -0
- package/src/state/selectors/brushSelectors.js +21 -0
- package/src/state/selectors/combiners/combineActiveLabel.js +18 -0
- package/src/state/selectors/combiners/combineActiveTooltipIndex.js +75 -0
- package/src/state/selectors/combiners/combineAllBarPositions.js +169 -0
- package/src/state/selectors/combiners/combineAxisRangeWithReverse.js +11 -0
- package/src/state/selectors/combiners/combineBarPosition.js +17 -0
- package/src/state/selectors/combiners/combineBarSizeList.js +115 -0
- package/src/state/selectors/combiners/combineCheckedDomain.js +44 -0
- package/src/state/selectors/combiners/combineConfiguredScale.js +46 -0
- package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.js +48 -0
- package/src/state/selectors/combiners/combineDisplayedStackedData.js +54 -0
- package/src/state/selectors/combiners/combineInverseScaleFunction.js +12 -0
- package/src/state/selectors/combiners/combineRealScaleType.js +36 -0
- package/src/state/selectors/combiners/combineStackedData.js +22 -0
- package/src/state/selectors/combiners/combineTooltipInteractionState.js +121 -0
- package/src/state/selectors/combiners/combineTooltipPayload.js +248 -0
- package/src/state/selectors/combiners/combineTooltipPayloadConfigurations.js +59 -0
- package/src/state/selectors/containerSelectors.js +6 -0
- package/src/state/selectors/dataSelectors.js +97 -0
- package/src/state/selectors/graphicalItemSelectors.js +25 -0
- package/src/state/selectors/legendSelectors.js +18 -0
- package/src/state/selectors/lineSelectors.js +106 -0
- package/src/state/selectors/numberDomainEqualityCheck.js +11 -0
- package/src/state/selectors/pickAxisId.js +3 -0
- package/src/state/selectors/pickAxisType.js +3 -0
- package/src/state/selectors/polarAxisSelectors.js +237 -0
- package/src/state/selectors/rootPropsSelectors.js +13 -0
- package/src/state/selectors/selectActivePropsFromChartPointer.js +23 -0
- package/src/state/selectors/selectAllAxes.js +15 -0
- package/src/state/selectors/selectChartOffset.js +12 -0
- package/src/state/selectors/selectChartOffsetInternal.js +174 -0
- package/src/state/selectors/selectPlotArea.js +19 -0
- package/src/state/selectors/selectTooltipAxisId.js +3 -0
- package/src/state/selectors/selectTooltipAxisType.js +25 -0
- package/src/state/selectors/selectTooltipEventType.js +27 -0
- package/src/state/selectors/selectTooltipPayloadSearcher.js +3 -0
- package/src/state/selectors/selectTooltipSettings.js +3 -0
- package/src/state/selectors/selectTooltipState.js +3 -0
- package/src/state/selectors/selectors.js +222 -0
- package/src/state/selectors/tooltipSelectors.js +471 -0
- package/src/state/selectors/touchSelectors.js +31 -0
- package/src/state/store.js +101 -0
- package/src/state/tooltipSlice.js +237 -0
- package/src/state/touchEventsMiddleware.js +140 -0
- package/src/state/types/StackedGraphicalItem.js +18 -0
- package/src/state/zIndexSlice.js +167 -0
- package/src/synchronisation/syncSelectors.js +5 -0
- package/src/synchronisation/useChartSynchronisation.tsrx +285 -0
- package/src/util/ActiveShapeUtils.tsrx +62 -0
- package/src/util/BarUtils.tsrx +35 -0
- package/src/util/CartesianUtils.js +66 -0
- package/src/util/ChartUtils.js +630 -0
- package/src/util/Constants.js +42 -0
- package/src/util/DOMUtils.js +180 -0
- package/src/util/DataUtils.js +199 -0
- package/src/util/Events.js +7 -0
- package/src/util/Global.js +13 -0
- package/src/util/LRUCache.js +58 -0
- package/src/util/LogUtils.js +29 -0
- package/src/util/PolarUtils.js +190 -0
- package/src/util/ReactUtils.ts +94 -0
- package/src/util/ReduceCSSCalc.js +260 -0
- package/src/util/TickUtils.js +43 -0
- package/src/util/YAxisUtils.js +43 -0
- package/src/util/axisPropsAreEqual.js +63 -0
- package/src/util/createEventProxy.js +18 -0
- package/src/util/excludeEventProps.js +172 -0
- package/src/util/getActiveCoordinate.js +253 -0
- package/src/util/getAxisTypeBasedOnLayout.js +17 -0
- package/src/util/getClassNameFromUnknown.js +8 -0
- package/src/util/getEveryNth.js +29 -0
- package/src/util/getRadiusAndStrokeWidthFromDot.js +28 -0
- package/src/util/getRelativeCoordinate.js +96 -0
- package/src/util/getSliced.js +11 -0
- package/src/util/isDomainSpecifiedByUser.js +255 -0
- package/src/util/isWellBehavedNumber.js +8 -0
- package/src/util/propsAreEqual.js +96 -0
- package/src/util/resolveDefaultProps.js +131 -0
- package/src/util/round.js +39 -0
- package/src/util/scale/RechartsScale.js +68 -0
- package/src/util/scale/createCategoricalInverse.js +77 -0
- package/src/util/scale/getNiceTickValues.js +354 -0
- package/src/util/scale/index.js +3 -0
- package/src/util/scale/util/arithmetic.js +51 -0
- package/src/util/stacks/getStackSeriesIdentifier.js +10 -0
- package/src/util/svgPropertiesAndEvents.ts +29 -0
- package/src/util/svgPropertiesNoEvents.js +383 -0
- package/src/util/types.ts +59 -0
- package/src/util/useAnimationId.ts +14 -0
- package/src/util/useId.ts +13 -0
- package/src/util/usePrefersReducedMotion.ts +30 -0
- package/src/util/useReportScale.ts +26 -0
- package/src/util/useUniqueId.js +34 -0
- package/src/zIndex/DefaultZIndexes.js +75 -0
- package/src/zIndex/ZIndexLayer.tsrx +80 -0
- package/src/zIndex/ZIndexLayer.tsrx.d.ts +2 -0
- package/src/zIndex/ZIndexPortal.tsrx +43 -0
- package/src/zIndex/getZIndexFromUnknown.js +15 -0
- package/src/zIndex/zIndexSelectors.js +45 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
// Vendored from recharts@3.9.2 es6/util/svgPropertiesNoEvents.js with ONE
|
|
2
|
+
// adaptation: `isValidElement` comes from octane (this file inspects OCTANE
|
|
3
|
+
// element descriptors at runtime, not React elements). Everything else is
|
|
4
|
+
// verbatim — update by re-vendoring when the recharts devDependency moves.
|
|
5
|
+
import { isValidElement } from 'octane';
|
|
6
|
+
var SVGElementPropKeys = [
|
|
7
|
+
'aria-activedescendant',
|
|
8
|
+
'aria-atomic',
|
|
9
|
+
'aria-autocomplete',
|
|
10
|
+
'aria-busy',
|
|
11
|
+
'aria-checked',
|
|
12
|
+
'aria-colcount',
|
|
13
|
+
'aria-colindex',
|
|
14
|
+
'aria-colspan',
|
|
15
|
+
'aria-controls',
|
|
16
|
+
'aria-current',
|
|
17
|
+
'aria-describedby',
|
|
18
|
+
'aria-details',
|
|
19
|
+
'aria-disabled',
|
|
20
|
+
'aria-errormessage',
|
|
21
|
+
'aria-expanded',
|
|
22
|
+
'aria-flowto',
|
|
23
|
+
'aria-haspopup',
|
|
24
|
+
'aria-hidden',
|
|
25
|
+
'aria-invalid',
|
|
26
|
+
'aria-keyshortcuts',
|
|
27
|
+
'aria-label',
|
|
28
|
+
'aria-labelledby',
|
|
29
|
+
'aria-level',
|
|
30
|
+
'aria-live',
|
|
31
|
+
'aria-modal',
|
|
32
|
+
'aria-multiline',
|
|
33
|
+
'aria-multiselectable',
|
|
34
|
+
'aria-orientation',
|
|
35
|
+
'aria-owns',
|
|
36
|
+
'aria-placeholder',
|
|
37
|
+
'aria-posinset',
|
|
38
|
+
'aria-pressed',
|
|
39
|
+
'aria-readonly',
|
|
40
|
+
'aria-relevant',
|
|
41
|
+
'aria-required',
|
|
42
|
+
'aria-roledescription',
|
|
43
|
+
'aria-rowcount',
|
|
44
|
+
'aria-rowindex',
|
|
45
|
+
'aria-rowspan',
|
|
46
|
+
'aria-selected',
|
|
47
|
+
'aria-setsize',
|
|
48
|
+
'aria-sort',
|
|
49
|
+
'aria-valuemax',
|
|
50
|
+
'aria-valuemin',
|
|
51
|
+
'aria-valuenow',
|
|
52
|
+
'aria-valuetext',
|
|
53
|
+
'className',
|
|
54
|
+
'color',
|
|
55
|
+
'height',
|
|
56
|
+
'id',
|
|
57
|
+
'lang',
|
|
58
|
+
'max',
|
|
59
|
+
'media',
|
|
60
|
+
'method',
|
|
61
|
+
'min',
|
|
62
|
+
'name',
|
|
63
|
+
'style',
|
|
64
|
+
/*
|
|
65
|
+
* removed 'type' SVGElementPropKey because we do not currently use any SVG elements
|
|
66
|
+
* that can use it, and it conflicts with the recharts prop 'type'
|
|
67
|
+
* https://github.com/recharts/recharts/pull/3327
|
|
68
|
+
* https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type
|
|
69
|
+
*/
|
|
70
|
+
// 'type',
|
|
71
|
+
'target',
|
|
72
|
+
'width',
|
|
73
|
+
'role',
|
|
74
|
+
'tabIndex',
|
|
75
|
+
'accentHeight',
|
|
76
|
+
'accumulate',
|
|
77
|
+
'additive',
|
|
78
|
+
'alignmentBaseline',
|
|
79
|
+
'allowReorder',
|
|
80
|
+
'alphabetic',
|
|
81
|
+
'amplitude',
|
|
82
|
+
'arabicForm',
|
|
83
|
+
'ascent',
|
|
84
|
+
'attributeName',
|
|
85
|
+
'attributeType',
|
|
86
|
+
'autoReverse',
|
|
87
|
+
'azimuth',
|
|
88
|
+
'baseFrequency',
|
|
89
|
+
'baselineShift',
|
|
90
|
+
'baseProfile',
|
|
91
|
+
'bbox',
|
|
92
|
+
'begin',
|
|
93
|
+
'bias',
|
|
94
|
+
'by',
|
|
95
|
+
'calcMode',
|
|
96
|
+
'capHeight',
|
|
97
|
+
'clip',
|
|
98
|
+
'clipPath',
|
|
99
|
+
'clipPathUnits',
|
|
100
|
+
'clipRule',
|
|
101
|
+
'colorInterpolation',
|
|
102
|
+
'colorInterpolationFilters',
|
|
103
|
+
'colorProfile',
|
|
104
|
+
'colorRendering',
|
|
105
|
+
'contentScriptType',
|
|
106
|
+
'contentStyleType',
|
|
107
|
+
'cursor',
|
|
108
|
+
'cx',
|
|
109
|
+
'cy',
|
|
110
|
+
'd',
|
|
111
|
+
'decelerate',
|
|
112
|
+
'descent',
|
|
113
|
+
'diffuseConstant',
|
|
114
|
+
'direction',
|
|
115
|
+
'display',
|
|
116
|
+
'divisor',
|
|
117
|
+
'dominantBaseline',
|
|
118
|
+
'dur',
|
|
119
|
+
'dx',
|
|
120
|
+
'dy',
|
|
121
|
+
'edgeMode',
|
|
122
|
+
'elevation',
|
|
123
|
+
'enableBackground',
|
|
124
|
+
'end',
|
|
125
|
+
'exponent',
|
|
126
|
+
'externalResourcesRequired',
|
|
127
|
+
'fill',
|
|
128
|
+
'fillOpacity',
|
|
129
|
+
'fillRule',
|
|
130
|
+
'filter',
|
|
131
|
+
'filterRes',
|
|
132
|
+
'filterUnits',
|
|
133
|
+
'floodColor',
|
|
134
|
+
'floodOpacity',
|
|
135
|
+
'focusable',
|
|
136
|
+
'fontFamily',
|
|
137
|
+
'fontSize',
|
|
138
|
+
'fontSizeAdjust',
|
|
139
|
+
'fontStretch',
|
|
140
|
+
'fontStyle',
|
|
141
|
+
'fontVariant',
|
|
142
|
+
'fontWeight',
|
|
143
|
+
'format',
|
|
144
|
+
'from',
|
|
145
|
+
'fx',
|
|
146
|
+
'fy',
|
|
147
|
+
'g1',
|
|
148
|
+
'g2',
|
|
149
|
+
'glyphName',
|
|
150
|
+
'glyphOrientationHorizontal',
|
|
151
|
+
'glyphOrientationVertical',
|
|
152
|
+
'glyphRef',
|
|
153
|
+
'gradientTransform',
|
|
154
|
+
'gradientUnits',
|
|
155
|
+
'hanging',
|
|
156
|
+
'horizAdvX',
|
|
157
|
+
'horizOriginX',
|
|
158
|
+
'href',
|
|
159
|
+
'ideographic',
|
|
160
|
+
'imageRendering',
|
|
161
|
+
'in2',
|
|
162
|
+
'in',
|
|
163
|
+
'intercept',
|
|
164
|
+
'k1',
|
|
165
|
+
'k2',
|
|
166
|
+
'k3',
|
|
167
|
+
'k4',
|
|
168
|
+
'k',
|
|
169
|
+
'kernelMatrix',
|
|
170
|
+
'kernelUnitLength',
|
|
171
|
+
'kerning',
|
|
172
|
+
'keyPoints',
|
|
173
|
+
'keySplines',
|
|
174
|
+
'keyTimes',
|
|
175
|
+
'lengthAdjust',
|
|
176
|
+
'letterSpacing',
|
|
177
|
+
'lightingColor',
|
|
178
|
+
'limitingConeAngle',
|
|
179
|
+
'local',
|
|
180
|
+
'markerEnd',
|
|
181
|
+
'markerHeight',
|
|
182
|
+
'markerMid',
|
|
183
|
+
'markerStart',
|
|
184
|
+
'markerUnits',
|
|
185
|
+
'markerWidth',
|
|
186
|
+
'mask',
|
|
187
|
+
'maskContentUnits',
|
|
188
|
+
'maskUnits',
|
|
189
|
+
'mathematical',
|
|
190
|
+
'mode',
|
|
191
|
+
'numOctaves',
|
|
192
|
+
'offset',
|
|
193
|
+
'opacity',
|
|
194
|
+
'operator',
|
|
195
|
+
'order',
|
|
196
|
+
'orient',
|
|
197
|
+
'orientation',
|
|
198
|
+
'origin',
|
|
199
|
+
'overflow',
|
|
200
|
+
'overlinePosition',
|
|
201
|
+
'overlineThickness',
|
|
202
|
+
'paintOrder',
|
|
203
|
+
'panose1',
|
|
204
|
+
'pathLength',
|
|
205
|
+
'patternContentUnits',
|
|
206
|
+
'patternTransform',
|
|
207
|
+
'patternUnits',
|
|
208
|
+
'pointerEvents',
|
|
209
|
+
'pointsAtX',
|
|
210
|
+
'pointsAtY',
|
|
211
|
+
'pointsAtZ',
|
|
212
|
+
'preserveAlpha',
|
|
213
|
+
'preserveAspectRatio',
|
|
214
|
+
'primitiveUnits',
|
|
215
|
+
'r',
|
|
216
|
+
'radius',
|
|
217
|
+
'refX',
|
|
218
|
+
'refY',
|
|
219
|
+
'renderingIntent',
|
|
220
|
+
'repeatCount',
|
|
221
|
+
'repeatDur',
|
|
222
|
+
'requiredExtensions',
|
|
223
|
+
'requiredFeatures',
|
|
224
|
+
'restart',
|
|
225
|
+
'result',
|
|
226
|
+
'rotate',
|
|
227
|
+
'rx',
|
|
228
|
+
'ry',
|
|
229
|
+
'seed',
|
|
230
|
+
'shapeRendering',
|
|
231
|
+
'slope',
|
|
232
|
+
'spacing',
|
|
233
|
+
'specularConstant',
|
|
234
|
+
'specularExponent',
|
|
235
|
+
'speed',
|
|
236
|
+
'spreadMethod',
|
|
237
|
+
'startOffset',
|
|
238
|
+
'stdDeviation',
|
|
239
|
+
'stemh',
|
|
240
|
+
'stemv',
|
|
241
|
+
'stitchTiles',
|
|
242
|
+
'stopColor',
|
|
243
|
+
'stopOpacity',
|
|
244
|
+
'strikethroughPosition',
|
|
245
|
+
'strikethroughThickness',
|
|
246
|
+
'string',
|
|
247
|
+
'stroke',
|
|
248
|
+
'strokeDasharray',
|
|
249
|
+
'strokeDashoffset',
|
|
250
|
+
'strokeLinecap',
|
|
251
|
+
'strokeLinejoin',
|
|
252
|
+
'strokeMiterlimit',
|
|
253
|
+
'strokeOpacity',
|
|
254
|
+
'strokeWidth',
|
|
255
|
+
'surfaceScale',
|
|
256
|
+
'systemLanguage',
|
|
257
|
+
'tableValues',
|
|
258
|
+
'targetX',
|
|
259
|
+
'targetY',
|
|
260
|
+
'textAnchor',
|
|
261
|
+
'textDecoration',
|
|
262
|
+
'textLength',
|
|
263
|
+
'textRendering',
|
|
264
|
+
'to',
|
|
265
|
+
'transform',
|
|
266
|
+
'u1',
|
|
267
|
+
'u2',
|
|
268
|
+
'underlinePosition',
|
|
269
|
+
'underlineThickness',
|
|
270
|
+
'unicode',
|
|
271
|
+
'unicodeBidi',
|
|
272
|
+
'unicodeRange',
|
|
273
|
+
'unitsPerEm',
|
|
274
|
+
'vAlphabetic',
|
|
275
|
+
'values',
|
|
276
|
+
'vectorEffect',
|
|
277
|
+
'version',
|
|
278
|
+
'vertAdvY',
|
|
279
|
+
'vertOriginX',
|
|
280
|
+
'vertOriginY',
|
|
281
|
+
'vHanging',
|
|
282
|
+
'vIdeographic',
|
|
283
|
+
'viewTarget',
|
|
284
|
+
'visibility',
|
|
285
|
+
'vMathematical',
|
|
286
|
+
'widths',
|
|
287
|
+
'wordSpacing',
|
|
288
|
+
'writingMode',
|
|
289
|
+
'x1',
|
|
290
|
+
'x2',
|
|
291
|
+
'x',
|
|
292
|
+
'xChannelSelector',
|
|
293
|
+
'xHeight',
|
|
294
|
+
'xlinkActuate',
|
|
295
|
+
'xlinkArcrole',
|
|
296
|
+
'xlinkHref',
|
|
297
|
+
'xlinkRole',
|
|
298
|
+
'xlinkShow',
|
|
299
|
+
'xlinkTitle',
|
|
300
|
+
'xlinkType',
|
|
301
|
+
'xmlBase',
|
|
302
|
+
'xmlLang',
|
|
303
|
+
'xmlns',
|
|
304
|
+
'xmlnsXlink',
|
|
305
|
+
'xmlSpace',
|
|
306
|
+
'y1',
|
|
307
|
+
'y2',
|
|
308
|
+
'y',
|
|
309
|
+
'yChannelSelector',
|
|
310
|
+
'z',
|
|
311
|
+
'zoomAndPan',
|
|
312
|
+
'ref',
|
|
313
|
+
'key',
|
|
314
|
+
'angle',
|
|
315
|
+
];
|
|
316
|
+
var SVGElementPropKeySet = new Set(SVGElementPropKeys);
|
|
317
|
+
export function isSvgElementPropKey(key) {
|
|
318
|
+
if (typeof key !== 'string') {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
return SVGElementPropKeySet.has(key);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Checks if the property is a data attribute.
|
|
325
|
+
* @param key The property key.
|
|
326
|
+
* @returns True if the key starts with 'data-', false otherwise.
|
|
327
|
+
*/
|
|
328
|
+
export function isDataAttribute(key) {
|
|
329
|
+
return typeof key === 'string' && key.startsWith('data-');
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Filters an object to only include SVG properties. Removes all event handlers too.
|
|
334
|
+
* @param obj - The object to filter
|
|
335
|
+
* @returns A new object containing only valid SVG properties, excluding event handlers.
|
|
336
|
+
*/
|
|
337
|
+
export function svgPropertiesNoEvents(obj) {
|
|
338
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
339
|
+
return {};
|
|
340
|
+
}
|
|
341
|
+
var result = {};
|
|
342
|
+
for (var key in obj) {
|
|
343
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
344
|
+
if (isSvgElementPropKey(key) || isDataAttribute(key)) {
|
|
345
|
+
result[key] = obj[key];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return result;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Function to filter SVG properties from various input types.
|
|
354
|
+
* The input types can be:
|
|
355
|
+
* - A record of string keys to any values, in which case it returns a record of only SVG properties
|
|
356
|
+
* - A React element, in which case it returns the props of the element filtered to only SVG properties
|
|
357
|
+
* - Anything else, in which case it returns null
|
|
358
|
+
*
|
|
359
|
+
* This function has a wide-open return type, because it will read and filter the props of an arbitrary React element.
|
|
360
|
+
* This can be SVG, HTML, whatnot, with arbitrary values, so we can't type it more specifically.
|
|
361
|
+
*
|
|
362
|
+
* If you wish to have a type-safe version, use svgPropertiesNoEvents directly with a typed object.
|
|
363
|
+
*
|
|
364
|
+
* @param input - The input to filter, which can be a record, a React element, or other types.
|
|
365
|
+
* @returns A record of SVG properties if the input is a record or React element, otherwise null.
|
|
366
|
+
*/
|
|
367
|
+
export function svgPropertiesNoEventsFromUnknown(input) {
|
|
368
|
+
if (input == null) {
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
if (
|
|
372
|
+
/*#__PURE__*/ isValidElement(input) &&
|
|
373
|
+
typeof input.props === 'object' &&
|
|
374
|
+
input.props !== null
|
|
375
|
+
) {
|
|
376
|
+
var p = input.props;
|
|
377
|
+
return svgPropertiesNoEvents(p);
|
|
378
|
+
}
|
|
379
|
+
if (typeof input === 'object' && !Array.isArray(input)) {
|
|
380
|
+
return svgPropertiesNoEvents(input);
|
|
381
|
+
}
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Port of the runtime helpers from recharts' util/types.ts (the file is mostly
|
|
2
|
+
// type definitions; these are the two runtime exports the components use).
|
|
3
|
+
// octane events are NATIVE delegated DOM events — handlers receive the real
|
|
4
|
+
// event, matching the platform (never a synthetic wrapper).
|
|
5
|
+
import { isValidElement } from 'octane';
|
|
6
|
+
import { isEventKey } from '../util/excludeEventProps';
|
|
7
|
+
|
|
8
|
+
// Collect the event handlers off a props bag (or element), rebinding each to
|
|
9
|
+
// `(e) => handler(props, e)` — recharts item components pass their own props as
|
|
10
|
+
// the first argument of chart-level handlers.
|
|
11
|
+
export function adaptEventHandlers(
|
|
12
|
+
props: unknown,
|
|
13
|
+
newHandler?: (e: Event) => void,
|
|
14
|
+
): Record<string, (e: Event) => void> | null {
|
|
15
|
+
if (!props || typeof props === 'function' || typeof props === 'boolean') {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
let inputProps: any = props;
|
|
19
|
+
if (isValidElement(props)) {
|
|
20
|
+
inputProps = (props as any).props;
|
|
21
|
+
}
|
|
22
|
+
if (typeof inputProps !== 'object' && typeof inputProps !== 'function') {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const out: Record<string, (e: Event) => void> = {};
|
|
26
|
+
Object.keys(inputProps).forEach((key) => {
|
|
27
|
+
if (isEventKey(key) && typeof inputProps[key] === 'function') {
|
|
28
|
+
out[key] = newHandler || ((e: Event) => inputProps[key](inputProps, e));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const getEventHandlerOfChild =
|
|
35
|
+
(originalHandler: (data: any, index: number, e: Event) => void, data: any, index: number) =>
|
|
36
|
+
(e: Event): null => {
|
|
37
|
+
originalHandler(data, index, e);
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Rebind the event handlers off a child's props to `(e) => handler(data, index, e)`.
|
|
42
|
+
export function adaptEventsOfChild(
|
|
43
|
+
props: Record<string, any>,
|
|
44
|
+
data: any,
|
|
45
|
+
index: number,
|
|
46
|
+
): Record<string, (e: Event) => void> | null {
|
|
47
|
+
if (props === null || typeof props !== 'object') {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
let out: Record<string, (e: Event) => void> | null = null;
|
|
51
|
+
Object.keys(props).forEach((key) => {
|
|
52
|
+
const item = props[key];
|
|
53
|
+
if (isEventKey(key) && typeof item === 'function') {
|
|
54
|
+
if (!out) out = {};
|
|
55
|
+
out[key] = getEventHandlerOfChild(item, data, index);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Port of util/useAnimationId.ts — a unique id that regenerates whenever the
|
|
2
|
+
// input's reference identity changes (drives re-animation on data change).
|
|
3
|
+
import { useRef } from 'octane';
|
|
4
|
+
import { uniqueId } from './DataUtils';
|
|
5
|
+
|
|
6
|
+
export function useAnimationId(input: unknown, prefix = 'animation-'): string {
|
|
7
|
+
const animationId = useRef(uniqueId(prefix));
|
|
8
|
+
const prevProps = useRef(input);
|
|
9
|
+
if (prevProps.current !== input) {
|
|
10
|
+
animationId.current = uniqueId(prefix);
|
|
11
|
+
prevProps.current = input;
|
|
12
|
+
}
|
|
13
|
+
return animationId.current;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Port of util/useId.ts — octane always provides useId (React-18 semantics,
|
|
2
|
+
// SSR/hydration-stable), so the pre-18 fallback collapses to a forwarder. The
|
|
3
|
+
// slot forwarding keeps the hook usable from compiled AND uncompiled callers.
|
|
4
|
+
import { useId as octaneUseId } from 'octane';
|
|
5
|
+
import { splitSlot } from '../internal';
|
|
6
|
+
|
|
7
|
+
export function useId(...rest: any[]): string {
|
|
8
|
+
const [, slot] = splitSlot(rest);
|
|
9
|
+
return octaneUseId(slot);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Upstream's pre-React-18 fallback — same implementation here. */
|
|
13
|
+
export const useIdFallback = useId;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Port of util/usePrefersReducedMotion.ts — subscribes to the system
|
|
2
|
+
// `prefers-reduced-motion` preference; SSR-safe (false on the server).
|
|
3
|
+
import { useEffect, useState } from 'octane';
|
|
4
|
+
import { Global } from './Global';
|
|
5
|
+
|
|
6
|
+
export function usePrefersReducedMotion(): boolean {
|
|
7
|
+
const [prefersReducedMotion, setPrefersReducedMotion] = useState(() => {
|
|
8
|
+
if (Global.isSsr) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (!window.matchMedia) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
15
|
+
});
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!window.matchMedia) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
21
|
+
const handleChange = () => {
|
|
22
|
+
setPrefersReducedMotion(mediaQuery.matches);
|
|
23
|
+
};
|
|
24
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
25
|
+
return () => {
|
|
26
|
+
mediaQuery.removeEventListener('change', handleChange);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
return prefersReducedMotion;
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Port of util/useReportScale.ts — measures the wrapper's CSS transform scale
|
|
2
|
+
// (getBoundingClientRect width vs offsetWidth) and reports it to the store.
|
|
3
|
+
import { useEffect, useState } from 'octane';
|
|
4
|
+
import { useAppDispatch, useAppSelector } from '../state/hooks';
|
|
5
|
+
import { selectContainerScale } from '../state/selectors/containerSelectors';
|
|
6
|
+
import { setScale } from '../state/layoutSlice';
|
|
7
|
+
import { isWellBehavedNumber } from './isWellBehavedNumber';
|
|
8
|
+
import { splitSlot, subSlot } from '../internal';
|
|
9
|
+
|
|
10
|
+
export function useReportScale(...rest: any[]) {
|
|
11
|
+
const [, slot] = splitSlot(rest);
|
|
12
|
+
const dispatch = useAppDispatch();
|
|
13
|
+
const [ref, setRef] = useState<HTMLElement | null>(null);
|
|
14
|
+
const scale = useAppSelector(selectContainerScale, subSlot(slot, 'urs:scale'));
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (ref == null) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const rect = ref.getBoundingClientRect();
|
|
20
|
+
const newScale = rect.width / ref.offsetWidth;
|
|
21
|
+
if (isWellBehavedNumber(newScale) && newScale !== scale) {
|
|
22
|
+
dispatch(setScale(newScale));
|
|
23
|
+
}
|
|
24
|
+
}, [ref, dispatch, scale]);
|
|
25
|
+
return setRef;
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/useUniqueId.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { useId } from './useId';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A hook that generates a unique ID. It uses React.useId() in React 18+ for SSR safety
|
|
7
|
+
* and falls back to a client-side-only unique ID generator for older versions.
|
|
8
|
+
*
|
|
9
|
+
* The ID will stay the same across renders, and you can optionally provide a prefix.
|
|
10
|
+
*
|
|
11
|
+
* @param [prefix] - An optional prefix for the generated ID.
|
|
12
|
+
* @param [customId] - An optional custom ID to override the generated one.
|
|
13
|
+
* @returns The unique ID.
|
|
14
|
+
*/
|
|
15
|
+
export function useUniqueId(prefix, customId) {
|
|
16
|
+
/*
|
|
17
|
+
* We have to call this hook here even if we don't use the result because
|
|
18
|
+
* rules of hooks demand that hooks are never called conditionally.
|
|
19
|
+
*/
|
|
20
|
+
var generatedId = useId();
|
|
21
|
+
|
|
22
|
+
// If a custom ID is provided, it always takes precedence.
|
|
23
|
+
if (customId) {
|
|
24
|
+
return customId;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Apply the prefix if one was provided.
|
|
28
|
+
return prefix ? ''.concat(prefix, '-').concat(generatedId) : generatedId;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The useUniqueId hook returns a unique ID that is either reused from external props or generated internally.
|
|
33
|
+
* Either way the ID is now guaranteed to be present so no more nulls or undefined.
|
|
34
|
+
*/
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/zIndex/DefaultZIndexes.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
/**
|
|
4
|
+
* A collection of all default zIndex values used by Recharts.
|
|
5
|
+
*
|
|
6
|
+
* You can reuse these, or you can define your own.
|
|
7
|
+
*/
|
|
8
|
+
export var DefaultZIndexes = {
|
|
9
|
+
/**
|
|
10
|
+
* CartesianGrid and PolarGrid
|
|
11
|
+
*/
|
|
12
|
+
grid: -100,
|
|
13
|
+
/**
|
|
14
|
+
* Background of Bar and RadialBar.
|
|
15
|
+
* This is not visible by default but can be enabled by setting background={true} on Bar or RadialBar.
|
|
16
|
+
*/
|
|
17
|
+
barBackground: -50,
|
|
18
|
+
/*
|
|
19
|
+
* other chart elements or custom elements without specific zIndex
|
|
20
|
+
* render in here, at zIndex 0
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Area, Pie, Radar, and ReferenceArea
|
|
25
|
+
*/
|
|
26
|
+
area: 100,
|
|
27
|
+
/**
|
|
28
|
+
* Cursor is embedded inside Tooltip and controlled by it.
|
|
29
|
+
* The Tooltip itself has a separate portal and is not included in the zIndex system;
|
|
30
|
+
* Cursor is the decoration inside the chart area. CursorRectangle is a rectangle box.
|
|
31
|
+
* It renders below bar so that in a stacked bar chart the cursor rectangle does not hide the other bars.
|
|
32
|
+
*/
|
|
33
|
+
cursorRectangle: 200,
|
|
34
|
+
/**
|
|
35
|
+
* Bar and RadialBar
|
|
36
|
+
*/
|
|
37
|
+
bar: 300,
|
|
38
|
+
/**
|
|
39
|
+
* Line and ReferenceLine, and ErrorBor
|
|
40
|
+
*/
|
|
41
|
+
line: 400,
|
|
42
|
+
/**
|
|
43
|
+
* XAxis and YAxis and PolarAngleAxis and PolarRadiusAxis ticks and lines and children
|
|
44
|
+
*/
|
|
45
|
+
axis: 500,
|
|
46
|
+
/**
|
|
47
|
+
* Scatter and ReferenceDot,
|
|
48
|
+
* and Dots of Line and Area and Radar if they have dot=true
|
|
49
|
+
*/
|
|
50
|
+
scatter: 600,
|
|
51
|
+
/**
|
|
52
|
+
* Hovering over a Bar or RadialBar renders a highlight rectangle
|
|
53
|
+
*/
|
|
54
|
+
activeBar: 1000,
|
|
55
|
+
/**
|
|
56
|
+
* Cursor is embedded inside Tooltip and controlled by it.
|
|
57
|
+
* The Tooltip itself has a separate portal and is not included in the zIndex system;
|
|
58
|
+
* Cursor is the decoration inside the chart area, usually a cross or a box.
|
|
59
|
+
* CursorLine is a line cursor rendered in Line, Area, Scatter, Radar charts.
|
|
60
|
+
* It renders above the Line and Scatter so that it is always visible.
|
|
61
|
+
* It renders below active dot so that the dot is always visible and shows the current point.
|
|
62
|
+
* We're also assuming that the active dot is small enough that it does not fully cover the cursor line.
|
|
63
|
+
*
|
|
64
|
+
* This also applies to the radial cursor in RadialBarChart.
|
|
65
|
+
*/
|
|
66
|
+
cursorLine: 1100,
|
|
67
|
+
/**
|
|
68
|
+
* Hovering over a Point in Line, Area, Scatter, Radar renders a highlight dot
|
|
69
|
+
*/
|
|
70
|
+
activeDot: 1200,
|
|
71
|
+
/**
|
|
72
|
+
* LabelList and Label, including Axis labels
|
|
73
|
+
*/
|
|
74
|
+
label: 2000,
|
|
75
|
+
};
|