@automattic/charts 0.56.5 → 0.56.7
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/AGENTS.md +135 -0
- package/CHANGELOG.md +17 -0
- package/README.md +2 -1
- package/dist/charts/bar-chart/index.cjs +6 -6
- package/dist/charts/bar-chart/index.css +1 -4
- package/dist/charts/bar-chart/index.css.map +1 -1
- package/dist/charts/bar-chart/index.d.cts +2 -8
- package/dist/charts/bar-chart/index.d.ts +2 -8
- package/dist/charts/bar-chart/index.js +5 -5
- package/dist/charts/bar-list-chart/index.cjs +7 -7
- package/dist/charts/bar-list-chart/index.css +1 -4
- package/dist/charts/bar-list-chart/index.css.map +1 -1
- package/dist/charts/bar-list-chart/index.d.cts +2 -2
- package/dist/charts/bar-list-chart/index.d.ts +2 -2
- package/dist/charts/bar-list-chart/index.js +6 -6
- package/dist/charts/conversion-funnel-chart/index.cjs +5 -5
- package/dist/charts/conversion-funnel-chart/index.css +1 -4
- package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
- package/dist/charts/conversion-funnel-chart/index.d.cts +2 -1
- package/dist/charts/conversion-funnel-chart/index.d.ts +2 -1
- package/dist/charts/conversion-funnel-chart/index.js +4 -4
- package/dist/charts/geo-chart/index.cjs +4 -4
- package/dist/charts/geo-chart/index.css +1 -4
- package/dist/charts/geo-chart/index.css.map +1 -1
- package/dist/charts/geo-chart/index.d.cts +2 -1
- package/dist/charts/geo-chart/index.d.ts +2 -1
- package/dist/charts/geo-chart/index.js +3 -3
- package/dist/charts/leaderboard-chart/index.cjs +5 -5
- package/dist/charts/leaderboard-chart/index.css +1 -4
- package/dist/charts/leaderboard-chart/index.css.map +1 -1
- package/dist/charts/leaderboard-chart/index.d.cts +3 -2
- package/dist/charts/leaderboard-chart/index.d.ts +3 -2
- package/dist/charts/leaderboard-chart/index.js +4 -4
- package/dist/charts/line-chart/index.cjs +6 -6
- package/dist/charts/line-chart/index.css +1 -4
- package/dist/charts/line-chart/index.css.map +1 -1
- package/dist/charts/line-chart/index.d.cts +2 -8
- package/dist/charts/line-chart/index.d.ts +2 -8
- package/dist/charts/line-chart/index.js +5 -5
- package/dist/charts/pie-chart/index.cjs +6 -4
- package/dist/charts/pie-chart/index.cjs.map +1 -1
- package/dist/charts/pie-chart/index.css +13 -7
- package/dist/charts/pie-chart/index.css.map +1 -1
- package/dist/charts/pie-chart/index.d.cts +2 -1
- package/dist/charts/pie-chart/index.d.ts +2 -1
- package/dist/charts/pie-chart/index.js +5 -3
- package/dist/charts/pie-semi-circle-chart/index.cjs +6 -4
- package/dist/charts/pie-semi-circle-chart/index.cjs.map +1 -1
- package/dist/charts/pie-semi-circle-chart/index.css +12 -13
- package/dist/charts/pie-semi-circle-chart/index.css.map +1 -1
- package/dist/charts/pie-semi-circle-chart/index.d.cts +5 -2
- package/dist/charts/pie-semi-circle-chart/index.d.ts +5 -2
- package/dist/charts/pie-semi-circle-chart/index.js +5 -3
- package/dist/charts/sparkline/index.cjs +7 -7
- package/dist/charts/sparkline/index.css +1 -4
- package/dist/charts/sparkline/index.css.map +1 -1
- package/dist/charts/sparkline/index.js +6 -6
- package/dist/{chunk-NGHXTIUE.cjs → chunk-3EXJP67N.cjs} +7 -7
- package/dist/{chunk-NGHXTIUE.cjs.map → chunk-3EXJP67N.cjs.map} +1 -1
- package/dist/{chunk-FIFSYVN6.cjs → chunk-55ZCOYDF.cjs} +117 -132
- package/dist/chunk-55ZCOYDF.cjs.map +1 -0
- package/dist/{chunk-LT4YOIMM.js → chunk-7FDQGBY7.js} +145 -119
- package/dist/chunk-7FDQGBY7.js.map +1 -0
- package/dist/{chunk-7QDEU3KN.cjs → chunk-ASLARV7L.cjs} +6 -6
- package/dist/chunk-ASLARV7L.cjs.map +1 -0
- package/dist/chunk-BXFD7JIG.cjs +401 -0
- package/dist/chunk-BXFD7JIG.cjs.map +1 -0
- package/dist/{chunk-XCXAWMJQ.cjs → chunk-CAFJRZPZ.cjs} +12 -12
- package/dist/{chunk-XCXAWMJQ.cjs.map → chunk-CAFJRZPZ.cjs.map} +1 -1
- package/dist/{chunk-KHRPRH4V.js → chunk-E62LCBGD.js} +4 -4
- package/dist/{chunk-PCOI2GT5.js → chunk-GWBS65VC.js} +3 -3
- package/dist/{chunk-MEIVKY4K.js → chunk-IS5YYLTV.js} +18 -18
- package/dist/{chunk-MEIVKY4K.js.map → chunk-IS5YYLTV.js.map} +1 -1
- package/dist/{chunk-Q6G3BGCL.cjs → chunk-K6TGILHX.cjs} +8 -8
- package/dist/{chunk-Q6G3BGCL.cjs.map → chunk-K6TGILHX.cjs.map} +1 -1
- package/dist/{chunk-X6GX4QUJ.js → chunk-KHQPN77E.js} +3 -3
- package/dist/{chunk-SEKPIG5K.js → chunk-KNIMXN6Z.js} +2 -2
- package/dist/{chunk-SEKPIG5K.js.map → chunk-KNIMXN6Z.js.map} +1 -1
- package/dist/{chunk-AFWQR3SM.js → chunk-MDRCAGKZ.js} +4 -4
- package/dist/{chunk-TKPK4RFS.cjs → chunk-NQJE2CC7.cjs} +120 -98
- package/dist/chunk-NQJE2CC7.cjs.map +1 -0
- package/dist/{chunk-FY325WQ4.cjs → chunk-O2JIANHK.cjs} +25 -25
- package/dist/chunk-O2JIANHK.cjs.map +1 -0
- package/dist/{chunk-DLSUC7RN.js → chunk-OMS5QIJN.js} +6 -6
- package/dist/chunk-OMS5QIJN.js.map +1 -0
- package/dist/{chunk-TYIH5LMV.js → chunk-OP6PHB2U.js} +6 -6
- package/dist/chunk-OP6PHB2U.js.map +1 -0
- package/dist/{chunk-32ESS4MV.js → chunk-RFSHE3HL.js} +17 -7
- package/dist/chunk-RFSHE3HL.js.map +1 -0
- package/dist/{chunk-KXSLMOW5.js → chunk-SSFFCBCF.js} +6 -6
- package/dist/chunk-SSFFCBCF.js.map +1 -0
- package/dist/{chunk-I5467ZJ5.cjs → chunk-SUDERBUA.cjs} +2 -2
- package/dist/{chunk-I5467ZJ5.cjs.map → chunk-SUDERBUA.cjs.map} +1 -1
- package/dist/{chunk-SH32YSZO.cjs → chunk-UFRBUT2D.cjs} +19 -19
- package/dist/{chunk-SH32YSZO.cjs.map → chunk-UFRBUT2D.cjs.map} +1 -1
- package/dist/{chunk-7TQSPLIN.js → chunk-VPAEBI2F.js} +109 -87
- package/dist/chunk-VPAEBI2F.js.map +1 -0
- package/dist/{chunk-IHESL7H5.cjs → chunk-X7JL2NYJ.cjs} +24 -24
- package/dist/chunk-X7JL2NYJ.cjs.map +1 -0
- package/dist/{chunk-DBY6C4O2.js → chunk-XD2HV7M5.js} +77 -92
- package/dist/chunk-XD2HV7M5.js.map +1 -0
- package/dist/{chunk-LTPJPIDP.cjs → chunk-YAXY5L7I.cjs} +7 -7
- package/dist/{chunk-LTPJPIDP.cjs.map → chunk-YAXY5L7I.cjs.map} +1 -1
- package/dist/{chunk-EJJO2QNB.cjs → chunk-YDVHT7GS.cjs} +17 -7
- package/dist/chunk-YDVHT7GS.cjs.map +1 -0
- package/dist/components/legend/index.cjs +2 -2
- package/dist/components/legend/index.css +1 -4
- package/dist/components/legend/index.css.map +1 -1
- package/dist/components/legend/index.d.cts +2 -1
- package/dist/components/legend/index.d.ts +2 -1
- package/dist/components/legend/index.js +1 -1
- package/dist/components/tooltip/index.d.cts +2 -1
- package/dist/components/tooltip/index.d.ts +2 -1
- package/dist/hooks/index.cjs +2 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.css +1 -4
- package/dist/hooks/index.css.map +1 -1
- package/dist/hooks/index.d.cts +10 -7
- package/dist/hooks/index.d.ts +10 -7
- package/dist/hooks/index.js +3 -3
- package/dist/index.cjs +14 -14
- package/dist/index.css +24 -16
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +13 -13
- package/dist/{leaderboard-chart-B5gWcqe7.d.ts → leaderboard-chart-BSgEw_Um.d.ts} +1 -1
- package/dist/{leaderboard-chart-C_6QDcqj.d.cts → leaderboard-chart-COtgamhe.d.cts} +1 -1
- package/dist/providers/index.cjs +2 -2
- package/dist/providers/index.css +1 -4
- package/dist/providers/index.css.map +1 -1
- package/dist/providers/index.d.cts +3 -2
- package/dist/providers/index.d.ts +3 -2
- package/dist/providers/index.js +1 -1
- package/dist/{themes-BDVaIfBz.d.cts → themes-CVR5rmIs.d.cts} +1 -1
- package/dist/{themes-mcS8QNkQ.d.ts → themes-DQzmaSze.d.ts} +1 -1
- package/dist/{types-BCFQlzTM.d.ts → types-CzdN7rUe.d.cts} +12 -3
- package/dist/{types-BCFQlzTM.d.cts → types-CzdN7rUe.d.ts} +12 -3
- package/dist/utils/index.d.cts +2 -1
- package/dist/utils/index.d.ts +2 -1
- package/package.json +9 -9
- package/src/charts/bar-chart/bar-chart.tsx +2 -9
- package/src/charts/bar-chart/test/bar-chart.test.tsx +3 -3
- package/src/charts/line-chart/line-chart.tsx +2 -2
- package/src/charts/line-chart/test/line-chart.test.tsx +3 -3
- package/src/charts/line-chart/types.ts +0 -7
- package/src/charts/pie-chart/pie-chart.module.scss +14 -3
- package/src/charts/pie-chart/pie-chart.tsx +172 -148
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss +17 -11
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +147 -119
- package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +46 -6
- package/src/charts/private/with-responsive/test/with-responsive.test.tsx +5 -5
- package/src/charts/private/with-responsive/with-responsive.tsx +8 -7
- package/src/hooks/index.ts +1 -1
- package/src/hooks/test/{use-element-height.test.tsx → use-element-size.test.tsx} +45 -36
- package/src/hooks/use-element-size.ts +43 -0
- package/src/hooks/use-tooltip-portal-relocator.module.scss +1 -4
- package/src/hooks/use-tooltip-portal-relocator.ts +11 -0
- package/src/types.ts +13 -3
- package/dist/chunk-32ESS4MV.js.map +0 -1
- package/dist/chunk-7QDEU3KN.cjs.map +0 -1
- package/dist/chunk-7TQSPLIN.js.map +0 -1
- package/dist/chunk-DBY6C4O2.js.map +0 -1
- package/dist/chunk-DLSUC7RN.js.map +0 -1
- package/dist/chunk-EJJO2QNB.cjs.map +0 -1
- package/dist/chunk-FIFSYVN6.cjs.map +0 -1
- package/dist/chunk-FY325WQ4.cjs.map +0 -1
- package/dist/chunk-IHESL7H5.cjs.map +0 -1
- package/dist/chunk-JL4ZKKZU.cjs +0 -375
- package/dist/chunk-JL4ZKKZU.cjs.map +0 -1
- package/dist/chunk-KXSLMOW5.js.map +0 -1
- package/dist/chunk-LT4YOIMM.js.map +0 -1
- package/dist/chunk-TKPK4RFS.cjs.map +0 -1
- package/dist/chunk-TYIH5LMV.js.map +0 -1
- package/src/hooks/use-element-height.ts +0 -37
- /package/dist/{chunk-KHRPRH4V.js.map → chunk-E62LCBGD.js.map} +0 -0
- /package/dist/{chunk-PCOI2GT5.js.map → chunk-GWBS65VC.js.map} +0 -0
- /package/dist/{chunk-X6GX4QUJ.js.map → chunk-KHQPN77E.js.map} +0 -0
- /package/dist/{chunk-AFWQR3SM.js.map → chunk-MDRCAGKZ.js.map} +0 -0
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
var _chunkY3NNQMAXcjs = require('./chunk-Y3NNQMAX.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkUFRBUT2Dcjs = require('./chunk-UFRBUT2D.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkASLARV7Lcjs = require('./chunk-ASLARV7L.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ var _chunk7QDEU3KNcjs = require('./chunk-7QDEU3KN.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunkYDVHT7GScjs = require('./chunk-YDVHT7GS.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -182,7 +182,7 @@ var LineChartAnnotationsOverlay = ({
|
|
|
182
182
|
chartRef,
|
|
183
183
|
chartWidth,
|
|
184
184
|
chartHeight
|
|
185
|
-
} =
|
|
185
|
+
} = _chunkYDVHT7GScjs.useSingleChartContext.call(void 0, );
|
|
186
186
|
const [scales, setScales] = _react.useState.call(void 0, null);
|
|
187
187
|
const [scalesStable, setScalesStable] = _react.useState.call(void 0, false);
|
|
188
188
|
const createScaleSignature = _react.useCallback.call(void 0, (scaleData) => {
|
|
@@ -361,7 +361,7 @@ var LineChartAnnotation = ({
|
|
|
361
361
|
renderLabel,
|
|
362
362
|
renderLabelPopover
|
|
363
363
|
}) => {
|
|
364
|
-
const providerTheme =
|
|
364
|
+
const providerTheme = _chunkYDVHT7GScjs.useGlobalChartsTheme.call(void 0, );
|
|
365
365
|
const {
|
|
366
366
|
xScale,
|
|
367
367
|
yScale
|
|
@@ -734,15 +734,15 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
734
734
|
gridVisibility,
|
|
735
735
|
gap = "md"
|
|
736
736
|
}, ref) => {
|
|
737
|
-
const providerTheme =
|
|
738
|
-
const theme =
|
|
739
|
-
const chartId =
|
|
740
|
-
const [svgWrapperRef, svgWrapperHeight] =
|
|
737
|
+
const providerTheme = _chunkYDVHT7GScjs.useGlobalChartsTheme.call(void 0, );
|
|
738
|
+
const theme = _chunkYDVHT7GScjs.useXYChartTheme.call(void 0, data);
|
|
739
|
+
const chartId = _chunkYDVHT7GScjs.useChartId.call(void 0, providedChartId);
|
|
740
|
+
const [svgWrapperRef, , svgWrapperHeight] = _chunkYDVHT7GScjs.useElementSize.call(void 0, );
|
|
741
741
|
const chartRef = _react.useRef.call(void 0, null);
|
|
742
742
|
const [selectedIndex, setSelectedIndex] = _react.useState.call(void 0, void 0);
|
|
743
743
|
const [isNavigating, setIsNavigating] = _react.useState.call(void 0, false);
|
|
744
744
|
const internalChartRef = _react.useRef.call(void 0, null);
|
|
745
|
-
const hasLegendChild =
|
|
745
|
+
const hasLegendChild = _chunkYDVHT7GScjs.useHasLegendChild.call(void 0, children);
|
|
746
746
|
const chartHeight = svgWrapperHeight > 0 ? svgWrapperHeight : height;
|
|
747
747
|
const hasLegend = showLegend || hasLegendChild;
|
|
748
748
|
const isWaitingForMeasurement = hasLegend ? svgWrapperHeight === 0 : !chartHeight;
|
|
@@ -754,11 +754,11 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
754
754
|
margin: {}
|
|
755
755
|
}
|
|
756
756
|
}), [internalChartRef]);
|
|
757
|
-
const dataSorted =
|
|
757
|
+
const dataSorted = _chunkYDVHT7GScjs.useChartDataTransform.call(void 0, data);
|
|
758
758
|
const {
|
|
759
759
|
getElementStyles,
|
|
760
760
|
isSeriesVisible
|
|
761
|
-
} =
|
|
761
|
+
} = _chunkYDVHT7GScjs.useGlobalChartsContext.call(void 0, );
|
|
762
762
|
const seriesWithVisibility = _react.useMemo.call(void 0, () => {
|
|
763
763
|
if (!chartId || !legendInteractive) {
|
|
764
764
|
return dataSorted.map((series, index) => ({
|
|
@@ -840,7 +840,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
840
840
|
return themeGlyph ? themeGlyph(propsWithResolvedColor) : renderGlyph(propsWithResolvedColor);
|
|
841
841
|
};
|
|
842
842
|
}, [dataSorted, renderGlyph, getElementStyles]);
|
|
843
|
-
const defaultMargin =
|
|
843
|
+
const defaultMargin = _chunkYDVHT7GScjs.useChartMargin.call(void 0, height, chartOptions, dataSorted, theme);
|
|
844
844
|
const error = validateData(dataSorted);
|
|
845
845
|
const isDataValid = !error;
|
|
846
846
|
const legendOptions = _react.useMemo.call(void 0, () => ({
|
|
@@ -848,7 +848,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
848
848
|
glyphSize: Math.max(0, _nullishCoalesce(toNumber2(_optionalChain([glyphStyle, 'optionalAccess', _66 => _66.radius])), () => ( 4))),
|
|
849
849
|
renderGlyph
|
|
850
850
|
}), [withLegendGlyph, _optionalChain([glyphStyle, 'optionalAccess', _67 => _67.radius]), renderGlyph]);
|
|
851
|
-
const legendItems =
|
|
851
|
+
const legendItems = _chunkYDVHT7GScjs.useChartLegendItems.call(void 0, dataSorted, legendOptions, legendShape);
|
|
852
852
|
const chartMetadata = _react.useMemo.call(void 0, () => ({
|
|
853
853
|
withGradientFill,
|
|
854
854
|
smoothing,
|
|
@@ -857,14 +857,14 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
857
857
|
withEndGlyphs,
|
|
858
858
|
withLegendGlyph
|
|
859
859
|
}), [withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph]);
|
|
860
|
-
|
|
860
|
+
_chunkYDVHT7GScjs.useChartRegistration.call(void 0, {
|
|
861
861
|
chartId,
|
|
862
862
|
legendItems,
|
|
863
863
|
chartType: "line",
|
|
864
864
|
isDataValid,
|
|
865
865
|
metadata: chartMetadata
|
|
866
866
|
});
|
|
867
|
-
const prefersReducedMotion =
|
|
867
|
+
const prefersReducedMotion = _chunkYDVHT7GScjs.usePrefersReducedMotion.call(void 0, );
|
|
868
868
|
const accessors = {
|
|
869
869
|
xAccessor: (d) => _optionalChain([d, 'optionalAccess', _68 => _68.date]),
|
|
870
870
|
yAccessor: (d) => _optionalChain([d, 'optionalAccess', _69 => _69.value])
|
|
@@ -875,7 +875,7 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
875
875
|
children: error
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
|
-
const legendElement = showLegend && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
878
|
+
const legendElement = showLegend && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYDVHT7GScjs.Legend, {
|
|
879
879
|
orientation: legendOrientation,
|
|
880
880
|
alignment: legendAlignment,
|
|
881
881
|
position: legendPosition,
|
|
@@ -887,14 +887,14 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
887
887
|
chartId,
|
|
888
888
|
interactive: legendInteractive
|
|
889
889
|
});
|
|
890
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
890
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYDVHT7GScjs.SingleChartContext.Provider, {
|
|
891
891
|
value: {
|
|
892
892
|
chartId,
|
|
893
893
|
chartRef: internalChartRef,
|
|
894
894
|
chartWidth: width,
|
|
895
895
|
chartHeight
|
|
896
896
|
},
|
|
897
|
-
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
897
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUFRBUT2Dcjs.Stack, {
|
|
898
898
|
direction: "column",
|
|
899
899
|
gap,
|
|
900
900
|
className: _clsx2.default.call(void 0, "line-chart", line_chart_module_default["line-chart"], {
|
|
@@ -1032,14 +1032,14 @@ var LineChartInternal = /* @__PURE__ */ _react.forwardRef.call(void 0, ({
|
|
|
1032
1032
|
});
|
|
1033
1033
|
});
|
|
1034
1034
|
var LineChartWithProvider = /* @__PURE__ */ _react.forwardRef.call(void 0, (props, ref) => {
|
|
1035
|
-
const existingContext = _react.useContext.call(void 0,
|
|
1035
|
+
const existingContext = _react.useContext.call(void 0, _chunkYDVHT7GScjs.GlobalChartsContext);
|
|
1036
1036
|
if (existingContext) {
|
|
1037
1037
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LineChartInternal, {
|
|
1038
1038
|
...props,
|
|
1039
1039
|
ref
|
|
1040
1040
|
});
|
|
1041
1041
|
}
|
|
1042
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1042
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYDVHT7GScjs.GlobalChartsProvider, {
|
|
1043
1043
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LineChartInternal, {
|
|
1044
1044
|
...props,
|
|
1045
1045
|
ref
|
|
@@ -1048,12 +1048,12 @@ var LineChartWithProvider = /* @__PURE__ */ _react.forwardRef.call(void 0, (prop
|
|
|
1048
1048
|
});
|
|
1049
1049
|
LineChartWithProvider.displayName = "LineChart";
|
|
1050
1050
|
var LineChart = _chunkZVGEDXDPcjs.attachSubComponents.call(void 0, LineChartWithProvider, {
|
|
1051
|
-
Legend:
|
|
1051
|
+
Legend: _chunkYDVHT7GScjs.Legend,
|
|
1052
1052
|
AnnotationsOverlay: line_chart_annotations_overlay_default,
|
|
1053
1053
|
Annotation: line_chart_annotation_default
|
|
1054
1054
|
});
|
|
1055
|
-
var LineChartResponsive = _chunkZVGEDXDPcjs.attachSubComponents.call(void 0,
|
|
1056
|
-
Legend:
|
|
1055
|
+
var LineChartResponsive = _chunkZVGEDXDPcjs.attachSubComponents.call(void 0, _chunkASLARV7Lcjs.withResponsive.call(void 0, LineChartWithProvider), {
|
|
1056
|
+
Legend: _chunkYDVHT7GScjs.Legend,
|
|
1057
1057
|
AnnotationsOverlay: line_chart_annotations_overlay_default,
|
|
1058
1058
|
Annotation: line_chart_annotation_default
|
|
1059
1059
|
});
|
|
@@ -1062,4 +1062,4 @@ var LineChartResponsive = _chunkZVGEDXDPcjs.attachSubComponents.call(void 0, _ch
|
|
|
1062
1062
|
|
|
1063
1063
|
|
|
1064
1064
|
exports.LineChart = LineChart; exports.LineChartResponsive = LineChartResponsive;
|
|
1065
|
-
//# sourceMappingURL=chunk-
|
|
1065
|
+
//# sourceMappingURL=chunk-O2JIANHK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-O2JIANHK.cjs","../src/charts/line-chart/line-chart.tsx","../src/charts/private/default-glyph/default-glyph.tsx","../src/charts/line-chart/line-chart.module.scss","../src/charts/line-chart/private/line-chart-annotation-label-popover.tsx","../src/charts/line-chart/private/line-chart-annotations-overlay.tsx","../src/charts/line-chart/private/line-chart-annotation.tsx","../src/charts/line-chart/private/line-chart-glyph.tsx"],"names":["_jsx","DataContext","useEffect","useState","useContext","x","y","yMin","yMax","xMin","xMax","_jsxs","useRef","useMemo","toNumber"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACjCA,iEAAkD;AAClD,oCAA6D;AAC7D,0CAA+B;AAC/B,oCAA0B;AAC1B,wCAA6D;AAC7D,uCAAmB;AAEnB,wEAAiB;AACjB,mCAAqD;AACrD,8BAAwH;ADkCxH;AACA;AE5CA;AACA;AACA,+CAA4B;AACrB,IAAM,aAAA,EAAe,CAAA,KAAA,EAAA,GAAS;AACnC,EAAA,MAAM;AAAA,IACJ;AAAA,EACF,EAAA,EAAI,+BAAA,oBAAsB,EAAA,GAAK,CAAC,CAAA;AAChC,EAAA,MAAM,SAAA,EAAW,KAAA,CAAM,SAAA,GAAY,OAAA;AACnC,EAAA,uBAAoB,6BAAA,QAAK,EAAU;AAAA,IACjC,EAAA,EAAI,KAAA,CAAM,CAAA;AAAA,IACV,EAAA,EAAI,KAAA,CAAM,CAAA;AAAA,IACV,CAAA,EAAG,KAAA,CAAM,IAAA;AAAA,IACT,IAAA,EAAM,KAAA,CAAM,KAAA;AAAA,IACZ,MAAA,kBAAQ,KAAA,2BAAO,iBAAA;AAAA,IACf,WAAA,EAAa,GAAA;AAAA,IACb,UAAA,EAAY,MAAA;AAAA,IACZ,GAAG,KAAA,CAAM;AAAA,EACX,CAAC,CAAA;AACH,CAAA;AF8CA;AACA;AGjEgE,IAAO,0BAAA,EAAQ;AAAA,EAC7E,YAAA,EAAc,kBAAA;AAAA,EACd,yBAAA,EAA2B,kBAAA;AAAA,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ACwB,EAAA;AACC,IAAA;AACC,IAAA;AACF,IAAA;AACf,IAAA;AACT,EAAA;AACsB,EAAA;AACP,IAAA;AACA,IAAA;AACf,EAAA;AAIM,EAAA;AACe,IAAA;AACC,IAAA;AACA,IAAA;AACM,MAAA;AACjB,MAAA;AACC,MAAA;AACN,IAAA;AACN,EAAA;AACoBV,EAAAA;AACKW,IAAAA;AACrB,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACwB,MAAA;AACX,QAAA;AACO,MAAA;AACP,QAAA;AACO,MAAA;AACb,QAAA;AACA,QAAA;AACM,QAAA;AACE,QAAA;AACK,MAAA;AACb,QAAA;AACA,QAAA;AACM,QAAA;AACE,QAAA;AACgB,MAAA;AAClB,QAAA;AACR,QAAA;AACoB,QAAA;AACd,UAAA;AACG,UAAA;AACR,YAAA;AACA,YAAA;AACA,YAAA;AACA,YAAA;AACe,UAAA;AACf,YAAA;AACA,YAAA;AACD,UAAA;AACF,QAAA;AACeX,MAAAA;AACX,QAAA;AACkB,QAAA;AACrB,UAAA;AACA,UAAA;AACW,UAAA;AACR,UAAA;AACe,UAAA;AACF,UAAA;AACjB,QAAA;AACD,MAAA;AACH,IAAA;AACF,EAAA;AACH;AACO;ANuPuB;AACA;AO3frBC;AACAG;AACe;AACK,EAAA;AACP,EAAA;AACtB;AACwB;AACtB,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACI;AACE,EAAA;AACJ,IAAA;AACA,IAAA;AACwB,EAAA;AACF,EAAA;AACI,EAAA;AACD,EAAA;AACA,EAAA;AACA,EAAA;AACV,EAAA;AACQ,EAAA;AACN,EAAA;AACS,IAAA;AAC1B,IAAA;AACO,IAAA;AACP,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACD,EAAA;AACH;AACO;AP6fuB;AACA;AChhBR;AACD;AACM;AACL,EAAA;AACf,IAAA;AACQ,IAAA;AACZ,EAA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ACA,kBAAA;AACU,kBAAA;AACV,gBAAA;AACW,cAAA;AACb,YAAA;AACY,cAAA;AACd,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACa,cAAA;AACb,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACA,cAAA;AACQ,cAAA;AACO,YAAA;AACL,cAAA;AACV,cAAA;AACA,cAAA;AACA,cAAA;AACA,YAAA;AACH,UAAA;AACF,QAAA;AACoB,MAAA;AACxB,IAAA;AACF,EAAA;AACF;AAI0C;AACjBP,EAAAA;AAGH,EAAA;AACCJ,IAAAA;AACf,MAAA;AACH,MAAA;AACD,IAAA;AACH,EAAA;AAGoBA,EAAAA;AACKA,IAAAA;AAClB,MAAA;AACH,MAAA;AACD,IAAA;AACF,EAAA;AACF;AACqB;AACJ;AAChB,EAAA;AACoB,EAAA;AACR,EAAA;AACb;AAC2B;AAC1B,EAAA;AACoB,EAAA;AACR,EAAA;AACb;AD4d6B;AACA;AACA;AACA;AACA","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-O2JIANHK.cjs","sourcesContent":[null,"import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\nimport { curveCatmullRom, curveLinear, curveMonotoneX } from '@visx/curve';\nimport { LinearGradient } from '@visx/gradient';\nimport { scaleTime } from '@visx/scale';\nimport { XYChart, AreaSeries, Grid, Axis, DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { differenceInHours, differenceInYears } from 'date-fns';\nimport { useMemo, useContext, forwardRef, useImperativeHandle, useState, useRef, createElement as _createElement } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport { useXYChartTheme, useChartDataTransform, useChartMargin, useElementSize, useHasLegendChild, usePrefersReducedMotion } from '../../hooks';\nimport { GlobalChartsProvider, GlobalChartsContext, useChartId, useChartRegistration, useGlobalChartsContext, useGlobalChartsTheme } from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { DefaultGlyph } from '../private/default-glyph';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './line-chart.module.scss';\nimport { LineChartAnnotation, LineChartAnnotationsOverlay, LineChartGlyph } from './private';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst X_TICK_WIDTH = 60;\nconst defaultRenderGlyph = props => {\n return /*#__PURE__*/_createElement(DefaultGlyph, {\n ...props,\n key: props.key\n });\n};\nconst toNumber = val => {\n const num = typeof val === 'number' ? val : parseFloat(val);\n return isNaN(num) ? undefined : num;\n};\n\n/**\n * Determines the curve type for the line chart based on the provided type and smoothing parameters\n *\n * @param {CurveType} type - The explicit curve type to use\n * @param {boolean} smoothing - Legacy smoothing parameter\n * @return The curve function to use for the line\n */\nconst getCurveType = (type, smoothing) => {\n // If no type specified, use legacy smoothing behavior\n if (!type) {\n return smoothing ? curveCatmullRom : curveLinear;\n }\n\n // Handle explicit curve types\n switch (type) {\n case 'smooth':\n return curveCatmullRom;\n case 'monotone':\n return curveMonotoneX;\n case 'linear':\n return curveLinear;\n default:\n return curveLinear;\n }\n};\nconst renderDefaultTooltip = params => {\n const {\n tooltipData\n } = params;\n const nearestDatum = tooltipData?.nearestDatum?.datum;\n if (!nearestDatum) return null;\n const tooltipPoints = Object.entries(tooltipData?.datumByKey || {}).map(([key, {\n datum\n }]) => ({\n key,\n value: datum.value\n })).sort((a, b) => b.value - a.value);\n return /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__tooltip'],\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__tooltip-date'],\n children: nearestDatum.date?.toLocaleDateString()\n }), tooltipPoints.map(point => /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__tooltip-row'],\n children: [/*#__PURE__*/_jsxs(\"span\", {\n className: styles['line-chart__tooltip-label'],\n children: [point.key, \":\"]\n }), /*#__PURE__*/_jsx(\"span\", {\n className: styles['line-chart__tooltip-value'],\n children: formatNumber(point.value)\n })]\n }, point.key))]\n });\n};\nconst formatYearTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleDateString(undefined, {\n year: 'numeric'\n });\n};\nconst formatDateTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleDateString(undefined, {\n month: 'short',\n day: 'numeric'\n });\n};\nconst formatHourTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleTimeString(undefined, {\n hour: 'numeric',\n hour12: true\n });\n};\nconst getFormatter = sortedData => {\n const minX = Math.min(...sortedData.map(datom => datom.data.at(0)?.date));\n const maxX = Math.max(...sortedData.map(datom => datom.data.at(-1)?.date));\n const diffInHours = Math.abs(differenceInHours(maxX, minX));\n if (diffInHours <= 24) {\n return formatHourTick;\n }\n const diffInYears = Math.abs(differenceInYears(maxX, minX));\n if (diffInYears <= 1) {\n return formatDateTick;\n }\n return formatYearTick;\n};\nconst guessOptimalNumTicks = (data, chartWidth, tickFormatter) => {\n const minX = Math.min(...data.map(datom => datom.data.at(0)?.date));\n const maxX = Math.max(...data.map(datom => datom.data.at(-1)?.date));\n const xScale = scaleTime({\n domain: [minX, maxX]\n });\n\n // Calculate upper bound of tick numbers based on data points and chart width\n const upperBound = Math.min(data[0]?.data.length || 3,\n // A sane fallback to avoid NaN when no data is present\n Math.ceil(chartWidth / X_TICK_WIDTH));\n let secondBestGuess = 1; // a tick number that's no greater than upperBound\n\n for (let numTicks = upperBound; numTicks > 1; --numTicks) {\n const ticks = xScale.ticks(numTicks).map(d => tickFormatter(d.getTime()));\n\n // The .ticks() function doesn't properly respect the requested number of ticks, so we need to check the length\n if (ticks.length > upperBound) {\n continue;\n }\n secondBestGuess = Math.max(secondBestGuess, ticks.length);\n const uniqueTicks = Array.from(new Set(ticks));\n if (uniqueTicks.length === 1) {\n // All ticks are the same, so skip further processing\n return 1;\n }\n\n // Example: OCT 1 JAN 1 APR 1 JUL 1 OCT 1\n // Here, the two OCTs are not duplicates as they represent October of two different years.\n const hasConsecutiveDuplicate = ticks.some((tick, idx) => idx > 0 && tick === ticks[idx - 1]);\n if (hasConsecutiveDuplicate) {\n continue;\n }\n return ticks.length;\n }\n return secondBestGuess;\n};\nconst validateData = data => {\n if (!data?.length) return 'No data available';\n const hasInvalidData = data.some(series => series.data.some(point => isNaN(point.value) || point.value === null || point.value === undefined || 'date' in point && point.date && isNaN(point.date.getTime())));\n if (hasInvalidData) return 'Invalid data';\n return null;\n};\n\n// Inner component to access DataContext and provide scale data to ref\nconst LineChartScalesRef = ({\n chartRef,\n width,\n height,\n margin\n}) => {\n const context = useContext(DataContext);\n useImperativeHandle(chartRef, () => ({\n getScales: () => {\n if (!context?.xScale || !context?.yScale) {\n return null;\n }\n return {\n xScale: context.xScale,\n yScale: context.yScale\n };\n },\n getChartDimensions: () => ({\n width,\n height,\n margin: margin || {}\n })\n }), [context, width, height, margin]);\n return null; // This component only provides the ref interface\n};\nconst LineChartInternal = /*#__PURE__*/forwardRef(({\n data,\n chartId: providedChartId,\n width,\n height,\n className,\n margin,\n withTooltips = true,\n withTooltipCrosshairs,\n showLegend = false,\n legendOrientation = 'horizontal',\n legendAlignment = 'center',\n legendPosition = 'bottom',\n legendMaxWidth,\n legendTextOverflow = 'wrap',\n legendItemClassName,\n renderGlyph = defaultRenderGlyph,\n glyphStyle = {},\n legendShape = 'line',\n withLegendGlyph = false,\n withGradientFill = false,\n smoothing = true,\n curveType,\n renderTooltip = renderDefaultTooltip,\n withStartGlyphs = false,\n withEndGlyphs = false,\n legendInteractive = false,\n animation,\n options = {},\n onPointerDown = undefined,\n onPointerUp = undefined,\n onPointerMove = undefined,\n onPointerOut = undefined,\n children,\n gridVisibility,\n gap = 'md'\n}, ref) => {\n const providerTheme = useGlobalChartsTheme();\n const theme = useXYChartTheme(data);\n const chartId = useChartId(providedChartId);\n const [svgWrapperRef,, svgWrapperHeight] = useElementSize();\n const chartRef = useRef(null);\n const [selectedIndex, setSelectedIndex] = useState(undefined);\n const [isNavigating, setIsNavigating] = useState(false);\n const internalChartRef = useRef(null);\n\n // Check if children contain a Legend component (composition pattern)\n const hasLegendChild = useHasLegendChild(children);\n\n // Use the measured SVG wrapper height, falling back to the passed height if provided.\n // When there's a legend (via prop or composition), we must wait for measurement because\n // the legend takes space and the svg-wrapper height will be less than the total height.\n const chartHeight = svgWrapperHeight > 0 ? svgWrapperHeight : height;\n const hasLegend = showLegend || hasLegendChild;\n const isWaitingForMeasurement = hasLegend ? svgWrapperHeight === 0 : !chartHeight;\n\n // Forward the external ref to the internal ref\n useImperativeHandle(ref, () => ({\n getScales: () => internalChartRef.current?.getScales() || null,\n getChartDimensions: () => internalChartRef.current?.getChartDimensions() || {\n width: 0,\n height: 0,\n margin: {}\n }\n }), [internalChartRef]);\n const dataSorted = useChartDataTransform(data);\n const {\n getElementStyles,\n isSeriesVisible\n } = useGlobalChartsContext();\n\n // Add visibility information to series when using interactive legends\n const seriesWithVisibility = useMemo(() => {\n if (!chartId || !legendInteractive) {\n return dataSorted.map((series, index) => ({\n series,\n index,\n isVisible: true\n }));\n }\n return dataSorted.map((series, index) => ({\n series,\n index,\n isVisible: isSeriesVisible(chartId, series.label)\n }));\n }, [dataSorted, chartId, isSeriesVisible, legendInteractive]);\n\n // Check if all series are hidden\n const allSeriesHidden = useMemo(() => {\n return seriesWithVisibility.every(({\n isVisible\n }) => !isVisible);\n }, [seriesWithVisibility]);\n\n // Use the keyboard navigation hook\n const {\n tooltipRef,\n onChartFocus,\n onChartBlur,\n onChartKeyDown\n } = useKeyboardNavigation({\n selectedIndex,\n setSelectedIndex,\n isNavigating,\n setIsNavigating,\n chartRef,\n totalPoints: dataSorted[0]?.data.length || 0\n });\n const chartOptions = useMemo(() => {\n const formatter = options?.axis?.x?.tickFormat || getFormatter(dataSorted);\n return {\n axis: {\n x: {\n orientation: 'bottom',\n numTicks: guessOptimalNumTicks(dataSorted, width, formatter),\n tickFormat: formatter,\n display: true,\n ...options?.axis?.x\n },\n y: {\n orientation: 'left',\n numTicks: 4,\n tickFormat: formatNumberCompact,\n display: true,\n ...options?.axis?.y\n }\n },\n xScale: {\n type: 'time',\n ...options?.xScale\n },\n yScale: {\n type: 'linear',\n nice: true,\n zero: false,\n ...options?.yScale\n }\n };\n }, [options, dataSorted, width]);\n const tooltipRenderGlyph = useMemo(() => {\n return props => {\n const seriesIndex = dataSorted.findIndex(series => series.label === props.key || series.data.includes(props.datum));\n const seriesData = dataSorted[seriesIndex];\n const {\n color,\n glyph: themeGlyph\n } = getElementStyles({\n data: seriesData,\n index: seriesIndex\n });\n const propsWithResolvedColor = {\n ...props,\n color\n };\n return themeGlyph ? themeGlyph(propsWithResolvedColor) : renderGlyph(propsWithResolvedColor);\n };\n }, [dataSorted, renderGlyph, getElementStyles]);\n const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme);\n const error = validateData(dataSorted);\n const isDataValid = !error;\n\n // Memoize legend options to prevent unnecessary re-calculations\n const legendOptions = useMemo(() => ({\n withGlyph: withLegendGlyph,\n glyphSize: Math.max(0, toNumber(glyphStyle?.radius) ?? 4),\n renderGlyph\n }), [withLegendGlyph, glyphStyle?.radius, renderGlyph]);\n\n // Create legend items using the reusable hook\n const legendItems = useChartLegendItems(dataSorted, legendOptions, legendShape);\n\n // Memoize metadata to prevent unnecessary re-registration\n const chartMetadata = useMemo(() => ({\n withGradientFill,\n smoothing,\n curveType,\n withStartGlyphs,\n withEndGlyphs,\n withLegendGlyph\n }), [withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph]);\n\n // Register chart with context only if data is valid\n useChartRegistration({\n chartId,\n legendItems,\n chartType: 'line',\n isDataValid,\n metadata: chartMetadata\n });\n const prefersReducedMotion = usePrefersReducedMotion();\n const accessors = {\n xAccessor: d => d?.date,\n yAccessor: d => d?.value\n };\n\n // Create a custom renderTooltip that includes focus capability\n if (error) {\n return /*#__PURE__*/_jsx(\"div\", {\n className: clsx('line-chart', styles['line-chart']),\n children: error\n });\n }\n const legendElement = showLegend && /*#__PURE__*/_jsx(Legend, {\n orientation: legendOrientation,\n alignment: legendAlignment,\n position: legendPosition,\n maxWidth: legendMaxWidth,\n textOverflow: legendTextOverflow,\n legendItemClassName: legendItemClassName,\n className: styles['line-chart__legend'],\n shape: legendShape,\n chartId: chartId,\n interactive: legendInteractive\n });\n return /*#__PURE__*/_jsx(SingleChartContext.Provider, {\n value: {\n chartId,\n chartRef: internalChartRef,\n chartWidth: width,\n chartHeight\n },\n children: /*#__PURE__*/_jsxs(Stack, {\n direction: \"column\",\n gap: gap,\n className: clsx('line-chart', styles['line-chart'], {\n [styles['line-chart--animated']]: animation && !prefersReducedMotion\n }, className),\n style: {\n width,\n height,\n visibility: isWaitingForMeasurement ? 'hidden' : 'visible'\n },\n children: [legendPosition === 'top' && legendElement, /*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__svg-wrapper'],\n ref: svgWrapperRef,\n role: \"grid\",\n \"aria-label\": __('Line chart', 'jetpack-charts'),\n tabIndex: 0,\n onKeyDown: onChartKeyDown,\n onFocus: onChartFocus,\n onBlur: onChartBlur,\n children: !isWaitingForMeasurement && /*#__PURE__*/_jsx(\"div\", {\n ref: chartRef,\n children: /*#__PURE__*/_jsxs(XYChart, {\n theme: theme,\n width: width,\n height: chartHeight,\n margin: {\n ...defaultMargin,\n ...margin\n }\n // xScale and yScale could be set in Axis as well, but they are `scale` props there.\n ,\n xScale: chartOptions.xScale,\n yScale: chartOptions.yScale,\n onPointerDown: onPointerDown,\n onPointerUp: onPointerUp,\n onPointerMove: onPointerMove,\n onPointerOut: onPointerOut,\n pointerEventsDataKey: \"nearest\",\n children: [gridVisibility !== 'none' && /*#__PURE__*/_jsx(Grid, {\n columns: false,\n numTicks: 4\n }), chartOptions.axis.x.display && /*#__PURE__*/_jsx(Axis, {\n ...chartOptions.axis.x\n }), chartOptions.axis.y.display && /*#__PURE__*/_jsx(Axis, {\n ...chartOptions.axis.y\n }), allSeriesHidden ? /*#__PURE__*/_jsx(\"text\", {\n x: width / 2,\n y: chartHeight / 2,\n textAnchor: \"middle\",\n fill: providerTheme.gridStyles?.stroke || '#ccc',\n fontSize: \"14\",\n fontFamily: \"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif\",\n children: __('All series are hidden. Click legend items to show data.', 'jetpack-charts')\n }) : null, seriesWithVisibility.map(({\n series: seriesData,\n index,\n isVisible\n }) => {\n // Skip rendering invisible series\n if (!isVisible) {\n return null;\n }\n const {\n color,\n lineStyles,\n glyph\n } = getElementStyles({\n data: seriesData,\n index\n });\n const lineProps = {\n stroke: color,\n ...lineStyles\n };\n return /*#__PURE__*/_jsxs(\"g\", {\n children: [withGradientFill && /*#__PURE__*/_jsx(LinearGradient, {\n id: `area-gradient-${chartId}-${index + 1}`,\n from: color,\n fromOpacity: 0.4,\n toOpacity: 0.1,\n to: providerTheme.backgroundColor,\n ...seriesData.options?.gradient,\n children: seriesData.options?.gradient?.stops?.map((stop, stopIndex) => /*#__PURE__*/_jsx(\"stop\", {\n offset: stop.offset,\n stopColor: stop.color || color,\n stopOpacity: stop.opacity ?? 1\n }, `${stop.offset}-${stop.color || color}`))\n }), /*#__PURE__*/_jsx(AreaSeries, {\n dataKey: seriesData?.label,\n data: seriesData.data,\n ...accessors,\n fill: withGradientFill ? `url(#area-gradient-${chartId}-${index + 1})` : 'transparent',\n renderLine: true,\n curve: getCurveType(curveType, smoothing),\n lineProps: lineProps\n }, seriesData?.label), withStartGlyphs && /*#__PURE__*/_jsx(LineChartGlyph, {\n index: index,\n data: seriesData,\n color: color,\n renderGlyph: glyph ?? renderGlyph,\n accessors: accessors,\n glyphStyle: glyphStyle,\n position: \"start\"\n }), withEndGlyphs && /*#__PURE__*/_jsx(LineChartGlyph, {\n index: index,\n data: seriesData,\n color: color,\n renderGlyph: glyph ?? renderGlyph,\n accessors: accessors,\n glyphStyle: glyphStyle,\n position: \"end\"\n })]\n }, seriesData?.label || index);\n }), withTooltips && /*#__PURE__*/_jsx(AccessibleTooltip, {\n detectBounds: true,\n snapTooltipToDatumX: true,\n snapTooltipToDatumY: true,\n showSeriesGlyphs: true,\n renderTooltip: renderTooltip,\n renderGlyph: tooltipRenderGlyph,\n glyphStyle: glyphStyle,\n showVerticalCrosshair: withTooltipCrosshairs?.showVertical,\n showHorizontalCrosshair: withTooltipCrosshairs?.showHorizontal,\n selectedIndex: selectedIndex,\n tooltipRef: tooltipRef,\n keyboardFocusedClassName: styles['line-chart__tooltip--keyboard-focused'],\n series: dataSorted\n }), /*#__PURE__*/_jsx(LineChartScalesRef, {\n chartRef: internalChartRef,\n width: width,\n height: height,\n margin: margin\n })]\n })\n })\n }), legendPosition === 'bottom' && legendElement, children]\n })\n });\n});\n\n// Component type definitions for composition API\n\nconst LineChartWithProvider = /*#__PURE__*/forwardRef((props, ref) => {\n const existingContext = useContext(GlobalChartsContext);\n\n // If we're already in a GlobalChartsProvider context, render the core component directly\n if (existingContext) {\n return /*#__PURE__*/_jsx(LineChartInternal, {\n ...props,\n ref: ref\n });\n }\n\n // Otherwise, wrap with our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(LineChartInternal, {\n ...props,\n ref: ref\n })\n });\n});\nLineChartWithProvider.displayName = 'LineChart';\nconst LineChart = attachSubComponents(LineChartWithProvider, {\n Legend: Legend,\n AnnotationsOverlay: LineChartAnnotationsOverlay,\n Annotation: LineChartAnnotation\n});\nconst LineChartResponsive = attachSubComponents(withResponsive(LineChartWithProvider), {\n Legend: Legend,\n AnnotationsOverlay: LineChartAnnotationsOverlay,\n Annotation: LineChartAnnotation\n});\nexport { LineChartResponsive as default, LineChart as LineChartUnresponsive };","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const DefaultGlyph = props => {\n const {\n theme\n } = useContext(DataContext) || {};\n const position = props.position || 'start';\n return /*#__PURE__*/_jsx(\"circle\", {\n cx: props.x,\n cy: props.y,\n r: props.size,\n fill: props.color,\n stroke: theme?.backgroundColor,\n strokeWidth: 1.5,\n paintOrder: \"fill\",\n ...props.glyphStyle\n });\n};","import 'css-chunk:src/charts/line-chart/line-chart.module.scss';export default {\n \"line-chart\": \"a8ccharts-v-oO8E\",\n \"line-chart__svg-wrapper\": \"a8ccharts-cpMNjj\",\n \"line-chart--animated\": \"a8ccharts-QrkuTW\",\n \"rise\": \"a8ccharts--rxDU3\",\n \"line-chart__tooltip\": \"a8ccharts-Tu0rR-\",\n \"line-chart__annotation-label-popover\": \"a8ccharts--RSWXi\",\n \"line-chart__tooltip-date\": \"a8ccharts-Q-b5A1\",\n \"line-chart__tooltip-row\": \"a8ccharts-19N7T9\",\n \"line-chart__tooltip-label\": \"a8ccharts-HOAXrD\",\n \"line-chart__annotations-overlay\": \"a8ccharts-rQiY8O\",\n \"line-chart__annotation-label\": \"a8ccharts-8AKWOe\",\n \"line-chart__annotation-label-trigger-button\": \"a8ccharts-7mh3Cl\",\n \"line-chart__annotation-label-popover--visible\": \"a8ccharts-VAeVuJ\",\n \"line-chart__annotation-label-popover--safari\": \"a8ccharts-TEe-iV\",\n \"line-chart__annotation-label-popover-header\": \"a8ccharts-LAUpx7\",\n \"line-chart__annotation-label-popover-content\": \"a8ccharts-b76gEu\",\n \"line-chart__annotation-label-popover-close-button\": \"a8ccharts-LIpFoS\"\n};","import { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport Gridicon from 'gridicons';\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { isSafari } from '../../../utils';\nimport styles from '../line-chart.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const POPOVER_BUTTON_SIZE = 44;\nconst LineChartAnnotationLabelWithPopover = ({\n title,\n subtitle,\n renderLabel,\n renderLabelPopover\n}) => {\n const popoverId = useId();\n const buttonRef = useRef(null);\n const popoverRef = useRef(null);\n const [isPositioned, setIsPositioned] = useState(false);\n const isBrowserSafari = isSafari();\n useEffect(() => {\n const button = buttonRef.current;\n const popover = popoverRef.current;\n if (!button || !popover) return;\n const positionPopover = () => {\n // Popover positioning in Safari is complicated due to issues with SVG foreign objects (https://bugs.webkit.org/show_bug.cgi?id=23113), so let it be positioned in the centre of the viewport.\n if (!isBrowserSafari) {\n const buttonRect = button.getBoundingClientRect();\n popover.style.left = `${buttonRect.right}px`;\n popover.style.top = `${buttonRect.top}px`;\n }\n setIsPositioned(true);\n };\n\n // Position when popover shows\n popover.addEventListener('toggle', e => {\n if (e.newState === 'open') {\n positionPopover();\n }\n });\n\n // Initial positioning if already open\n try {\n if (popover.matches(':popover-open')) {\n positionPopover();\n }\n } catch {\n // Ignore errors in test environments (e.g., JSDOM does not support :popover-open)\n }\n }, [isBrowserSafari]);\n return /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__annotation-label'],\n children: [/*#__PURE__*/_jsx(\"button\", {\n ref: buttonRef,\n popovertarget: popoverId,\n className: styles['line-chart__annotation-label-trigger-button'],\n style: {\n width: `${POPOVER_BUTTON_SIZE}px`,\n height: `${POPOVER_BUTTON_SIZE}px`,\n transform: `translate(${POPOVER_BUTTON_SIZE / 2}px, 0)`\n },\n \"aria-label\": title || __('View details', 'jetpack-charts'),\n children: renderLabel({\n title,\n subtitle\n })\n }), /*#__PURE__*/_jsx(\"div\", {\n ref: popoverRef,\n id: popoverId,\n popover: 'auto',\n className: clsx(styles['line-chart__annotation-label-popover'], isPositioned && styles['line-chart__annotation-label-popover--visible'], isBrowserSafari && styles['line-chart__annotation-label-popover--safari']),\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__annotation-label-popover-header'],\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__annotation-label-popover-content'],\n children: renderLabelPopover({\n title,\n subtitle\n })\n }), /*#__PURE__*/_jsx(\"button\", {\n popovertarget: popoverId,\n popovertargetaction: 'hide',\n className: styles['line-chart__annotation-label-popover-close-button'],\n \"aria-label\": __('Close', 'jetpack-charts'),\n children: /*#__PURE__*/_jsx(Gridicon, {\n icon: \"cross\",\n size: 16\n })\n })]\n })\n })]\n });\n};\nexport default LineChartAnnotationLabelWithPopover;","import { DataContext } from '@visx/xychart';\nimport { useEffect, useState, useCallback } from 'react';\nimport { useSingleChartContext } from '../../private/single-chart-context';\nimport styles from '../line-chart.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst LineChartAnnotationsOverlay = ({\n children\n}) => {\n const {\n chartRef,\n chartWidth,\n chartHeight\n } = useSingleChartContext();\n const [scales, setScales] = useState(null);\n const [scalesStable, setScalesStable] = useState(false);\n\n // Create a signature for scale data to enable easy comparison\n const createScaleSignature = useCallback(scaleData => {\n const xDomain = scaleData.xScale.domain();\n const yDomain = scaleData.yScale.domain();\n const xRange = scaleData.xScale.range();\n const yRange = scaleData.yScale.range();\n return `${xDomain.join(',')}-${yDomain.join(',')}-${xRange.join(',')}-${yRange.join(',')}`;\n }, []);\n\n // Get scales from chart ref and return them with signature for comparison\n const getScalesData = useCallback(() => {\n if (chartRef?.current) {\n const scaleData = chartRef.current.getScales();\n if (scaleData) {\n const scaleInfo = {\n xScale: scaleData.xScale,\n yScale: scaleData.yScale\n };\n return {\n scales: scaleInfo,\n signature: createScaleSignature(scaleInfo)\n };\n }\n }\n return null;\n }, [chartRef, createScaleSignature]);\n\n // The chart resizes on render so we need to monitor the scales until they stabilize\n useEffect(() => {\n let timeoutId = null;\n let lastSignature = null;\n let retryCount = 0;\n const maxRetries = 20; // 20 * 50ms = 1 second max\n const checkInterval = 50; // Check every 50ms\n\n // Reset stability state when monitoring starts\n setScalesStable(false);\n const monitorScales = () => {\n const currentScaleData = getScalesData();\n\n // If we got scales, compare signatures\n if (currentScaleData) {\n // Check if scales have settled by comparing signatures\n const scalesSettled = lastSignature && currentScaleData.signature === lastSignature;\n if (scalesSettled) {\n // Scales have stabilized, mark as stable\n setScalesStable(true);\n return;\n }\n\n // Update scales and remember signature for next comparison\n setScales(currentScaleData.scales);\n lastSignature = currentScaleData.signature;\n }\n\n // Continue monitoring if we haven't exceeded max retries\n if (retryCount < maxRetries) {\n retryCount++;\n timeoutId = setTimeout(monitorScales, checkInterval);\n }\n };\n monitorScales();\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [getScalesData, chartWidth, chartHeight]);\n\n // Early return if no chart data available\n if (!chartRef || !children) {\n return null;\n }\n if (!scales || !scalesStable) {\n return null;\n }\n\n // Create a DataContext value that mimics what visx provides\n // We're intentionally providing minimal context for annotations to work\n const dataContextValue = {\n xScale: scales.xScale,\n yScale: scales.yScale,\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n width: chartWidth,\n height: chartHeight\n };\n return /*#__PURE__*/_jsx(DataContext.Provider, {\n value: dataContextValue,\n children: /*#__PURE__*/_jsx(\"svg\", {\n width: chartWidth,\n height: chartHeight,\n className: styles['line-chart__annotations-overlay'],\n children: children\n })\n });\n};\nexport default LineChartAnnotationsOverlay;","import { Annotation, CircleSubject, Connector, HtmlLabel, Label, LineSubject } from '@visx/annotation';\nimport { DataContext } from '@visx/xychart';\nimport merge from 'deepmerge';\nimport { useContext, useRef, useEffect, useState, useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../../../providers';\nimport { isSafari } from '../../../utils';\nimport LineChartAnnotationLabelWithPopover, { POPOVER_BUTTON_SIZE } from './line-chart-annotation-label-popover';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst ANNOTATION_MAX_WIDTH = 125; // visx default\nconst ANNOTATION_INIT_HEIGHT = 100;\nexport const getLabelPosition = ({\n subjectType,\n x,\n xMax,\n y,\n yMin,\n yMax,\n maxWidth,\n height\n}) => {\n const annotationMaxWidth = maxWidth ?? ANNOTATION_MAX_WIDTH;\n const annotationHeight = height ?? ANNOTATION_INIT_HEIGHT;\n let dx = 15;\n let dy = 15;\n let isFlippedHorizontally = false;\n let isFlippedVertically = false;\n if (subjectType === 'line-horizontal') {\n dx = 0;\n dy = 20;\n }\n if (subjectType === 'line-vertical') {\n dx = 20;\n dy = 0;\n }\n\n // Smart horizontal positioning: if annotation would extend beyond right edge, position it to the left\n // Account for the connector offset (dx) in boundary calculations\n const effectiveX = x + dx;\n if (effectiveX + annotationMaxWidth > xMax) {\n isFlippedHorizontally = true;\n if (subjectType === 'circle') {\n dx = -dx; // Just flip to the left side with same offset\n } else if (subjectType === 'line-vertical') {\n dx = -20; // Position to the left of the line\n }\n }\n\n // Smart vertical positioning: check both top and bottom edges\n // For circle annotations, they are positioned below by default (dy > 0)\n // Only flip when close to bottom edge to position above\n if (subjectType === 'circle') {\n // Check if positioning below would extend beyond bottom edge\n if (y + dy + annotationHeight > yMin) {\n // Too close to bottom edge, position above\n isFlippedVertically = true;\n dy = -Math.abs(dy); // Ensure negative value to position above the point\n }\n // When close to top edge, keep default below positioning (no flip needed)\n } else if (y - annotationHeight < yMax) {\n // Too close to top edge, position below\n if (subjectType === 'line-horizontal') {\n isFlippedVertically = true;\n dy = Math.abs(dy); // Ensure positive value to position below the point\n } else if (subjectType === 'line-vertical') {\n isFlippedVertically = true; // For anchor adjustment only\n }\n } else if (y + annotationHeight > yMin) {\n // Too close to bottom edge, position above\n if (subjectType === 'line-horizontal') {\n isFlippedVertically = true;\n dy = -Math.abs(dy); // Ensure negative value to position above the point\n } else if (subjectType === 'line-vertical') {\n isFlippedVertically = true; // For anchor adjustment only\n }\n }\n return {\n dx,\n dy,\n isFlippedHorizontally,\n isFlippedVertically\n };\n};\nconst getHorizontalAnchor = (subjectType, isFlippedHorizontally) => {\n if (subjectType === 'line-horizontal') {\n return isFlippedHorizontally ? 'end' : 'start';\n }\n return undefined;\n};\nconst getVerticalAnchor = (subjectType, isFlippedVertically, y, yMax, height) => {\n if (subjectType === 'line-vertical') {\n if (isFlippedVertically) {\n // If flipped due to top edge, anchor to top; if flipped due to bottom edge, anchor to bottom\n return y - height < yMax ? 'start' : 'end';\n }\n return 'start';\n }\n return undefined;\n};\nconst LineChartAnnotation = ({\n datum,\n title,\n subtitle,\n subjectType = 'circle',\n styles: datumStyles,\n testId,\n renderLabel,\n renderLabelPopover\n}) => {\n const providerTheme = useGlobalChartsTheme();\n const {\n xScale,\n yScale\n } = useContext(DataContext) || {};\n const labelRef = useRef(null);\n const [height, setHeight] = useState(null);\n\n // Deep merge styles to preserve nested object properties\n const styles = merge(providerTheme.annotationStyles ?? {}, datumStyles ?? {});\n\n // Measure the label height once after initial render\n useEffect(() => {\n if (labelRef.current?.getBBox) {\n const bbox = labelRef.current.getBBox();\n setHeight(bbox.height);\n }\n }, []);\n const positionData = useMemo(() => {\n if (!datum || !datum.date || datum.value == null || !xScale || !yScale) return null;\n const x = xScale(datum.date);\n const y = yScale(datum.value);\n if (typeof x !== 'number' || typeof y !== 'number') return null;\n const [yMin, yMax] = yScale.range().map(Number);\n const [xMin, xMax] = xScale.range().map(Number);\n\n // If a custom label is provided, use the provided position\n if (renderLabel) {\n return {\n x,\n dx: 0,\n y,\n dy: 0,\n yMin,\n yMax,\n xMin,\n xMax,\n isFlippedHorizontally: false,\n isFlippedVertically: false\n };\n }\n const position = getLabelPosition({\n subjectType,\n x,\n xMax,\n y,\n yMin,\n yMax,\n maxWidth: styles?.label?.maxWidth,\n height\n });\n return {\n x,\n y,\n yMin,\n yMax,\n xMin,\n xMax,\n ...position\n };\n }, [datum, xScale, yScale, subjectType, styles?.label?.maxWidth, height, renderLabel]);\n if (!positionData) return null;\n const {\n x,\n y,\n yMin,\n yMax,\n xMin,\n xMax,\n dx,\n dy,\n isFlippedHorizontally,\n isFlippedVertically\n } = positionData;\n const getLabelY = () => {\n const labelY = styles?.label?.y;\n if (labelY === 'start') return yMax;\n if (labelY === 'end') return yMin;\n return labelY;\n };\n const getLabelX = () => {\n const labelX = styles?.label?.x;\n if (labelX === 'start') return xMin;\n if (labelX === 'end') return xMax;\n return labelX;\n };\n const labelPosition = {\n x: getLabelX(),\n y: getLabelY()\n };\n\n // Safari has a bug where children of an SVG foreignObject are not positioned correctly https://bugs.webkit.org/show_bug.cgi?id=23113\n // This is a workaround to position the label correctly\n const getSafariHTMLLabelPosition = () => {\n const labelWidth = POPOVER_BUTTON_SIZE;\n const labelHeight = POPOVER_BUTTON_SIZE;\n return isSafari() ? {\n transform: `translate(${x + (dx || 0) + (typeof labelPosition.x === 'number' ? labelPosition.x - x : 0) - labelWidth}px, ${y + (dy || 0) + (typeof labelPosition.y === 'number' ? labelPosition.y - y : 0) - labelHeight}px)`,\n width: labelWidth,\n height: labelHeight\n } : undefined;\n };\n return /*#__PURE__*/_jsx(\"g\", {\n children: /*#__PURE__*/_jsxs(Annotation, {\n x: x,\n y: y,\n dx: dx,\n dy: dy,\n children: [/*#__PURE__*/_jsx(Connector, {\n ...styles?.connector\n }), subjectType === 'circle' && /*#__PURE__*/_jsx(CircleSubject, {\n ...styles?.circleSubject\n }), subjectType === 'line-vertical' && /*#__PURE__*/_jsx(LineSubject, {\n min: yMax,\n max: yMin,\n ...styles?.lineSubject,\n orientation: 'vertical'\n }), subjectType === 'line-horizontal' && /*#__PURE__*/_jsx(LineSubject, {\n min: xMin,\n max: xMax,\n ...styles?.lineSubject,\n orientation: 'horizontal'\n }), renderLabel ? /*#__PURE__*/_jsx(HtmlLabel, {\n ...styles?.label,\n ...labelPosition,\n children: /*#__PURE__*/_jsx(\"div\", {\n style: getSafariHTMLLabelPosition(),\n children: renderLabelPopover ? /*#__PURE__*/_jsx(LineChartAnnotationLabelWithPopover, {\n title: title,\n subtitle: subtitle,\n renderLabel: renderLabel,\n renderLabelPopover: renderLabelPopover\n }) : renderLabel({\n title,\n subtitle\n })\n })\n }) : /*#__PURE__*/_jsx(\"g\", {\n ref: labelRef,\n children: /*#__PURE__*/_jsx(Label, {\n title: title,\n subtitle: subtitle,\n ...styles?.label,\n ...labelPosition,\n horizontalAnchor: getHorizontalAnchor(subjectType, isFlippedHorizontally),\n verticalAnchor: getVerticalAnchor(subjectType, isFlippedVertically, y, yMax, height ?? ANNOTATION_INIT_HEIGHT)\n })\n })]\n })\n });\n};\nexport default LineChartAnnotation;","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nconst toNumber = val => {\n const num = typeof val === 'number' ? val : parseFloat(val);\n return isNaN(num) ? undefined : num;\n};\nconst LineChartGlyph = ({\n data,\n index,\n color,\n glyphStyle,\n renderGlyph,\n accessors,\n position\n}) => {\n const {\n xScale,\n yScale\n } = useContext(DataContext) || {};\n if (!xScale || !yScale) return null;\n if (data.data.length === 0) return null;\n const point = position === 'start' ? data.data[0] : data.data[data.data.length - 1];\n const x = xScale(accessors.xAccessor(point));\n const y = yScale(accessors.yAccessor(point));\n if (typeof x !== 'number' || typeof y !== 'number') return null;\n const size = Math.max(0, toNumber(glyphStyle?.radius) ?? 4);\n return renderGlyph({\n key: `${position}-glyph-${data.label}`,\n index,\n datum: point,\n color,\n size,\n x,\n y,\n glyphStyle,\n position\n });\n};\nexport default LineChartGlyph;"]}
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-BPYKWMI7.js";
|
|
5
5
|
import {
|
|
6
6
|
Stack
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IS5YYLTV.js";
|
|
8
8
|
import {
|
|
9
9
|
withResponsive
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OP6PHB2U.js";
|
|
11
11
|
import {
|
|
12
12
|
GlobalChartsContext,
|
|
13
13
|
GlobalChartsProvider,
|
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
useChartLegendItems,
|
|
19
19
|
useChartMargin,
|
|
20
20
|
useChartRegistration,
|
|
21
|
-
|
|
21
|
+
useElementSize,
|
|
22
22
|
useGlobalChartsContext,
|
|
23
23
|
useGlobalChartsTheme,
|
|
24
24
|
useHasLegendChild,
|
|
25
25
|
usePrefersReducedMotion,
|
|
26
26
|
useSingleChartContext,
|
|
27
27
|
useXYChartTheme
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-RFSHE3HL.js";
|
|
29
29
|
import {
|
|
30
30
|
attachSubComponents,
|
|
31
31
|
isSafari
|
|
@@ -737,7 +737,7 @@ var LineChartInternal = /* @__PURE__ */ forwardRef(({
|
|
|
737
737
|
const providerTheme = useGlobalChartsTheme();
|
|
738
738
|
const theme = useXYChartTheme(data);
|
|
739
739
|
const chartId = useChartId(providedChartId);
|
|
740
|
-
const [svgWrapperRef, svgWrapperHeight] =
|
|
740
|
+
const [svgWrapperRef, , svgWrapperHeight] = useElementSize();
|
|
741
741
|
const chartRef = useRef3(null);
|
|
742
742
|
const [selectedIndex, setSelectedIndex] = useState4(void 0);
|
|
743
743
|
const [isNavigating, setIsNavigating] = useState4(false);
|
|
@@ -1062,4 +1062,4 @@ export {
|
|
|
1062
1062
|
LineChart,
|
|
1063
1063
|
LineChartResponsive
|
|
1064
1064
|
};
|
|
1065
|
-
//# sourceMappingURL=chunk-
|
|
1065
|
+
//# sourceMappingURL=chunk-OMS5QIJN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/charts/line-chart/line-chart.tsx","../src/charts/private/default-glyph/default-glyph.tsx","../src/charts/line-chart/line-chart.module.scss","../src/charts/line-chart/private/line-chart-annotation-label-popover.tsx","../src/charts/line-chart/private/line-chart-annotations-overlay.tsx","../src/charts/line-chart/private/line-chart-annotation.tsx","../src/charts/line-chart/private/line-chart-glyph.tsx"],"sourcesContent":["import { formatNumberCompact, formatNumber } from '@automattic/number-formatters';\nimport { curveCatmullRom, curveLinear, curveMonotoneX } from '@visx/curve';\nimport { LinearGradient } from '@visx/gradient';\nimport { scaleTime } from '@visx/scale';\nimport { XYChart, AreaSeries, Grid, Axis, DataContext } from '@visx/xychart';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport clsx from 'clsx';\nimport { differenceInHours, differenceInYears } from 'date-fns';\nimport { useMemo, useContext, forwardRef, useImperativeHandle, useState, useRef, createElement as _createElement } from 'react';\nimport { Legend, useChartLegendItems } from '../../components/legend';\nimport { AccessibleTooltip, useKeyboardNavigation } from '../../components/tooltip';\nimport { useXYChartTheme, useChartDataTransform, useChartMargin, useElementSize, useHasLegendChild, usePrefersReducedMotion } from '../../hooks';\nimport { GlobalChartsProvider, GlobalChartsContext, useChartId, useChartRegistration, useGlobalChartsContext, useGlobalChartsTheme } from '../../providers';\nimport { attachSubComponents } from '../../utils';\nimport { DefaultGlyph } from '../private/default-glyph';\nimport { SingleChartContext } from '../private/single-chart-context';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './line-chart.module.scss';\nimport { LineChartAnnotation, LineChartAnnotationsOverlay, LineChartGlyph } from './private';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst X_TICK_WIDTH = 60;\nconst defaultRenderGlyph = props => {\n return /*#__PURE__*/_createElement(DefaultGlyph, {\n ...props,\n key: props.key\n });\n};\nconst toNumber = val => {\n const num = typeof val === 'number' ? val : parseFloat(val);\n return isNaN(num) ? undefined : num;\n};\n\n/**\n * Determines the curve type for the line chart based on the provided type and smoothing parameters\n *\n * @param {CurveType} type - The explicit curve type to use\n * @param {boolean} smoothing - Legacy smoothing parameter\n * @return The curve function to use for the line\n */\nconst getCurveType = (type, smoothing) => {\n // If no type specified, use legacy smoothing behavior\n if (!type) {\n return smoothing ? curveCatmullRom : curveLinear;\n }\n\n // Handle explicit curve types\n switch (type) {\n case 'smooth':\n return curveCatmullRom;\n case 'monotone':\n return curveMonotoneX;\n case 'linear':\n return curveLinear;\n default:\n return curveLinear;\n }\n};\nconst renderDefaultTooltip = params => {\n const {\n tooltipData\n } = params;\n const nearestDatum = tooltipData?.nearestDatum?.datum;\n if (!nearestDatum) return null;\n const tooltipPoints = Object.entries(tooltipData?.datumByKey || {}).map(([key, {\n datum\n }]) => ({\n key,\n value: datum.value\n })).sort((a, b) => b.value - a.value);\n return /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__tooltip'],\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__tooltip-date'],\n children: nearestDatum.date?.toLocaleDateString()\n }), tooltipPoints.map(point => /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__tooltip-row'],\n children: [/*#__PURE__*/_jsxs(\"span\", {\n className: styles['line-chart__tooltip-label'],\n children: [point.key, \":\"]\n }), /*#__PURE__*/_jsx(\"span\", {\n className: styles['line-chart__tooltip-value'],\n children: formatNumber(point.value)\n })]\n }, point.key))]\n });\n};\nconst formatYearTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleDateString(undefined, {\n year: 'numeric'\n });\n};\nconst formatDateTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleDateString(undefined, {\n month: 'short',\n day: 'numeric'\n });\n};\nconst formatHourTick = timestamp => {\n const date = new Date(timestamp);\n return date.toLocaleTimeString(undefined, {\n hour: 'numeric',\n hour12: true\n });\n};\nconst getFormatter = sortedData => {\n const minX = Math.min(...sortedData.map(datom => datom.data.at(0)?.date));\n const maxX = Math.max(...sortedData.map(datom => datom.data.at(-1)?.date));\n const diffInHours = Math.abs(differenceInHours(maxX, minX));\n if (diffInHours <= 24) {\n return formatHourTick;\n }\n const diffInYears = Math.abs(differenceInYears(maxX, minX));\n if (diffInYears <= 1) {\n return formatDateTick;\n }\n return formatYearTick;\n};\nconst guessOptimalNumTicks = (data, chartWidth, tickFormatter) => {\n const minX = Math.min(...data.map(datom => datom.data.at(0)?.date));\n const maxX = Math.max(...data.map(datom => datom.data.at(-1)?.date));\n const xScale = scaleTime({\n domain: [minX, maxX]\n });\n\n // Calculate upper bound of tick numbers based on data points and chart width\n const upperBound = Math.min(data[0]?.data.length || 3,\n // A sane fallback to avoid NaN when no data is present\n Math.ceil(chartWidth / X_TICK_WIDTH));\n let secondBestGuess = 1; // a tick number that's no greater than upperBound\n\n for (let numTicks = upperBound; numTicks > 1; --numTicks) {\n const ticks = xScale.ticks(numTicks).map(d => tickFormatter(d.getTime()));\n\n // The .ticks() function doesn't properly respect the requested number of ticks, so we need to check the length\n if (ticks.length > upperBound) {\n continue;\n }\n secondBestGuess = Math.max(secondBestGuess, ticks.length);\n const uniqueTicks = Array.from(new Set(ticks));\n if (uniqueTicks.length === 1) {\n // All ticks are the same, so skip further processing\n return 1;\n }\n\n // Example: OCT 1 JAN 1 APR 1 JUL 1 OCT 1\n // Here, the two OCTs are not duplicates as they represent October of two different years.\n const hasConsecutiveDuplicate = ticks.some((tick, idx) => idx > 0 && tick === ticks[idx - 1]);\n if (hasConsecutiveDuplicate) {\n continue;\n }\n return ticks.length;\n }\n return secondBestGuess;\n};\nconst validateData = data => {\n if (!data?.length) return 'No data available';\n const hasInvalidData = data.some(series => series.data.some(point => isNaN(point.value) || point.value === null || point.value === undefined || 'date' in point && point.date && isNaN(point.date.getTime())));\n if (hasInvalidData) return 'Invalid data';\n return null;\n};\n\n// Inner component to access DataContext and provide scale data to ref\nconst LineChartScalesRef = ({\n chartRef,\n width,\n height,\n margin\n}) => {\n const context = useContext(DataContext);\n useImperativeHandle(chartRef, () => ({\n getScales: () => {\n if (!context?.xScale || !context?.yScale) {\n return null;\n }\n return {\n xScale: context.xScale,\n yScale: context.yScale\n };\n },\n getChartDimensions: () => ({\n width,\n height,\n margin: margin || {}\n })\n }), [context, width, height, margin]);\n return null; // This component only provides the ref interface\n};\nconst LineChartInternal = /*#__PURE__*/forwardRef(({\n data,\n chartId: providedChartId,\n width,\n height,\n className,\n margin,\n withTooltips = true,\n withTooltipCrosshairs,\n showLegend = false,\n legendOrientation = 'horizontal',\n legendAlignment = 'center',\n legendPosition = 'bottom',\n legendMaxWidth,\n legendTextOverflow = 'wrap',\n legendItemClassName,\n renderGlyph = defaultRenderGlyph,\n glyphStyle = {},\n legendShape = 'line',\n withLegendGlyph = false,\n withGradientFill = false,\n smoothing = true,\n curveType,\n renderTooltip = renderDefaultTooltip,\n withStartGlyphs = false,\n withEndGlyphs = false,\n legendInteractive = false,\n animation,\n options = {},\n onPointerDown = undefined,\n onPointerUp = undefined,\n onPointerMove = undefined,\n onPointerOut = undefined,\n children,\n gridVisibility,\n gap = 'md'\n}, ref) => {\n const providerTheme = useGlobalChartsTheme();\n const theme = useXYChartTheme(data);\n const chartId = useChartId(providedChartId);\n const [svgWrapperRef,, svgWrapperHeight] = useElementSize();\n const chartRef = useRef(null);\n const [selectedIndex, setSelectedIndex] = useState(undefined);\n const [isNavigating, setIsNavigating] = useState(false);\n const internalChartRef = useRef(null);\n\n // Check if children contain a Legend component (composition pattern)\n const hasLegendChild = useHasLegendChild(children);\n\n // Use the measured SVG wrapper height, falling back to the passed height if provided.\n // When there's a legend (via prop or composition), we must wait for measurement because\n // the legend takes space and the svg-wrapper height will be less than the total height.\n const chartHeight = svgWrapperHeight > 0 ? svgWrapperHeight : height;\n const hasLegend = showLegend || hasLegendChild;\n const isWaitingForMeasurement = hasLegend ? svgWrapperHeight === 0 : !chartHeight;\n\n // Forward the external ref to the internal ref\n useImperativeHandle(ref, () => ({\n getScales: () => internalChartRef.current?.getScales() || null,\n getChartDimensions: () => internalChartRef.current?.getChartDimensions() || {\n width: 0,\n height: 0,\n margin: {}\n }\n }), [internalChartRef]);\n const dataSorted = useChartDataTransform(data);\n const {\n getElementStyles,\n isSeriesVisible\n } = useGlobalChartsContext();\n\n // Add visibility information to series when using interactive legends\n const seriesWithVisibility = useMemo(() => {\n if (!chartId || !legendInteractive) {\n return dataSorted.map((series, index) => ({\n series,\n index,\n isVisible: true\n }));\n }\n return dataSorted.map((series, index) => ({\n series,\n index,\n isVisible: isSeriesVisible(chartId, series.label)\n }));\n }, [dataSorted, chartId, isSeriesVisible, legendInteractive]);\n\n // Check if all series are hidden\n const allSeriesHidden = useMemo(() => {\n return seriesWithVisibility.every(({\n isVisible\n }) => !isVisible);\n }, [seriesWithVisibility]);\n\n // Use the keyboard navigation hook\n const {\n tooltipRef,\n onChartFocus,\n onChartBlur,\n onChartKeyDown\n } = useKeyboardNavigation({\n selectedIndex,\n setSelectedIndex,\n isNavigating,\n setIsNavigating,\n chartRef,\n totalPoints: dataSorted[0]?.data.length || 0\n });\n const chartOptions = useMemo(() => {\n const formatter = options?.axis?.x?.tickFormat || getFormatter(dataSorted);\n return {\n axis: {\n x: {\n orientation: 'bottom',\n numTicks: guessOptimalNumTicks(dataSorted, width, formatter),\n tickFormat: formatter,\n display: true,\n ...options?.axis?.x\n },\n y: {\n orientation: 'left',\n numTicks: 4,\n tickFormat: formatNumberCompact,\n display: true,\n ...options?.axis?.y\n }\n },\n xScale: {\n type: 'time',\n ...options?.xScale\n },\n yScale: {\n type: 'linear',\n nice: true,\n zero: false,\n ...options?.yScale\n }\n };\n }, [options, dataSorted, width]);\n const tooltipRenderGlyph = useMemo(() => {\n return props => {\n const seriesIndex = dataSorted.findIndex(series => series.label === props.key || series.data.includes(props.datum));\n const seriesData = dataSorted[seriesIndex];\n const {\n color,\n glyph: themeGlyph\n } = getElementStyles({\n data: seriesData,\n index: seriesIndex\n });\n const propsWithResolvedColor = {\n ...props,\n color\n };\n return themeGlyph ? themeGlyph(propsWithResolvedColor) : renderGlyph(propsWithResolvedColor);\n };\n }, [dataSorted, renderGlyph, getElementStyles]);\n const defaultMargin = useChartMargin(height, chartOptions, dataSorted, theme);\n const error = validateData(dataSorted);\n const isDataValid = !error;\n\n // Memoize legend options to prevent unnecessary re-calculations\n const legendOptions = useMemo(() => ({\n withGlyph: withLegendGlyph,\n glyphSize: Math.max(0, toNumber(glyphStyle?.radius) ?? 4),\n renderGlyph\n }), [withLegendGlyph, glyphStyle?.radius, renderGlyph]);\n\n // Create legend items using the reusable hook\n const legendItems = useChartLegendItems(dataSorted, legendOptions, legendShape);\n\n // Memoize metadata to prevent unnecessary re-registration\n const chartMetadata = useMemo(() => ({\n withGradientFill,\n smoothing,\n curveType,\n withStartGlyphs,\n withEndGlyphs,\n withLegendGlyph\n }), [withGradientFill, smoothing, curveType, withStartGlyphs, withEndGlyphs, withLegendGlyph]);\n\n // Register chart with context only if data is valid\n useChartRegistration({\n chartId,\n legendItems,\n chartType: 'line',\n isDataValid,\n metadata: chartMetadata\n });\n const prefersReducedMotion = usePrefersReducedMotion();\n const accessors = {\n xAccessor: d => d?.date,\n yAccessor: d => d?.value\n };\n\n // Create a custom renderTooltip that includes focus capability\n if (error) {\n return /*#__PURE__*/_jsx(\"div\", {\n className: clsx('line-chart', styles['line-chart']),\n children: error\n });\n }\n const legendElement = showLegend && /*#__PURE__*/_jsx(Legend, {\n orientation: legendOrientation,\n alignment: legendAlignment,\n position: legendPosition,\n maxWidth: legendMaxWidth,\n textOverflow: legendTextOverflow,\n legendItemClassName: legendItemClassName,\n className: styles['line-chart__legend'],\n shape: legendShape,\n chartId: chartId,\n interactive: legendInteractive\n });\n return /*#__PURE__*/_jsx(SingleChartContext.Provider, {\n value: {\n chartId,\n chartRef: internalChartRef,\n chartWidth: width,\n chartHeight\n },\n children: /*#__PURE__*/_jsxs(Stack, {\n direction: \"column\",\n gap: gap,\n className: clsx('line-chart', styles['line-chart'], {\n [styles['line-chart--animated']]: animation && !prefersReducedMotion\n }, className),\n style: {\n width,\n height,\n visibility: isWaitingForMeasurement ? 'hidden' : 'visible'\n },\n children: [legendPosition === 'top' && legendElement, /*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__svg-wrapper'],\n ref: svgWrapperRef,\n role: \"grid\",\n \"aria-label\": __('Line chart', 'jetpack-charts'),\n tabIndex: 0,\n onKeyDown: onChartKeyDown,\n onFocus: onChartFocus,\n onBlur: onChartBlur,\n children: !isWaitingForMeasurement && /*#__PURE__*/_jsx(\"div\", {\n ref: chartRef,\n children: /*#__PURE__*/_jsxs(XYChart, {\n theme: theme,\n width: width,\n height: chartHeight,\n margin: {\n ...defaultMargin,\n ...margin\n }\n // xScale and yScale could be set in Axis as well, but they are `scale` props there.\n ,\n xScale: chartOptions.xScale,\n yScale: chartOptions.yScale,\n onPointerDown: onPointerDown,\n onPointerUp: onPointerUp,\n onPointerMove: onPointerMove,\n onPointerOut: onPointerOut,\n pointerEventsDataKey: \"nearest\",\n children: [gridVisibility !== 'none' && /*#__PURE__*/_jsx(Grid, {\n columns: false,\n numTicks: 4\n }), chartOptions.axis.x.display && /*#__PURE__*/_jsx(Axis, {\n ...chartOptions.axis.x\n }), chartOptions.axis.y.display && /*#__PURE__*/_jsx(Axis, {\n ...chartOptions.axis.y\n }), allSeriesHidden ? /*#__PURE__*/_jsx(\"text\", {\n x: width / 2,\n y: chartHeight / 2,\n textAnchor: \"middle\",\n fill: providerTheme.gridStyles?.stroke || '#ccc',\n fontSize: \"14\",\n fontFamily: \"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif\",\n children: __('All series are hidden. Click legend items to show data.', 'jetpack-charts')\n }) : null, seriesWithVisibility.map(({\n series: seriesData,\n index,\n isVisible\n }) => {\n // Skip rendering invisible series\n if (!isVisible) {\n return null;\n }\n const {\n color,\n lineStyles,\n glyph\n } = getElementStyles({\n data: seriesData,\n index\n });\n const lineProps = {\n stroke: color,\n ...lineStyles\n };\n return /*#__PURE__*/_jsxs(\"g\", {\n children: [withGradientFill && /*#__PURE__*/_jsx(LinearGradient, {\n id: `area-gradient-${chartId}-${index + 1}`,\n from: color,\n fromOpacity: 0.4,\n toOpacity: 0.1,\n to: providerTheme.backgroundColor,\n ...seriesData.options?.gradient,\n children: seriesData.options?.gradient?.stops?.map((stop, stopIndex) => /*#__PURE__*/_jsx(\"stop\", {\n offset: stop.offset,\n stopColor: stop.color || color,\n stopOpacity: stop.opacity ?? 1\n }, `${stop.offset}-${stop.color || color}`))\n }), /*#__PURE__*/_jsx(AreaSeries, {\n dataKey: seriesData?.label,\n data: seriesData.data,\n ...accessors,\n fill: withGradientFill ? `url(#area-gradient-${chartId}-${index + 1})` : 'transparent',\n renderLine: true,\n curve: getCurveType(curveType, smoothing),\n lineProps: lineProps\n }, seriesData?.label), withStartGlyphs && /*#__PURE__*/_jsx(LineChartGlyph, {\n index: index,\n data: seriesData,\n color: color,\n renderGlyph: glyph ?? renderGlyph,\n accessors: accessors,\n glyphStyle: glyphStyle,\n position: \"start\"\n }), withEndGlyphs && /*#__PURE__*/_jsx(LineChartGlyph, {\n index: index,\n data: seriesData,\n color: color,\n renderGlyph: glyph ?? renderGlyph,\n accessors: accessors,\n glyphStyle: glyphStyle,\n position: \"end\"\n })]\n }, seriesData?.label || index);\n }), withTooltips && /*#__PURE__*/_jsx(AccessibleTooltip, {\n detectBounds: true,\n snapTooltipToDatumX: true,\n snapTooltipToDatumY: true,\n showSeriesGlyphs: true,\n renderTooltip: renderTooltip,\n renderGlyph: tooltipRenderGlyph,\n glyphStyle: glyphStyle,\n showVerticalCrosshair: withTooltipCrosshairs?.showVertical,\n showHorizontalCrosshair: withTooltipCrosshairs?.showHorizontal,\n selectedIndex: selectedIndex,\n tooltipRef: tooltipRef,\n keyboardFocusedClassName: styles['line-chart__tooltip--keyboard-focused'],\n series: dataSorted\n }), /*#__PURE__*/_jsx(LineChartScalesRef, {\n chartRef: internalChartRef,\n width: width,\n height: height,\n margin: margin\n })]\n })\n })\n }), legendPosition === 'bottom' && legendElement, children]\n })\n });\n});\n\n// Component type definitions for composition API\n\nconst LineChartWithProvider = /*#__PURE__*/forwardRef((props, ref) => {\n const existingContext = useContext(GlobalChartsContext);\n\n // If we're already in a GlobalChartsProvider context, render the core component directly\n if (existingContext) {\n return /*#__PURE__*/_jsx(LineChartInternal, {\n ...props,\n ref: ref\n });\n }\n\n // Otherwise, wrap with our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(LineChartInternal, {\n ...props,\n ref: ref\n })\n });\n});\nLineChartWithProvider.displayName = 'LineChart';\nconst LineChart = attachSubComponents(LineChartWithProvider, {\n Legend: Legend,\n AnnotationsOverlay: LineChartAnnotationsOverlay,\n Annotation: LineChartAnnotation\n});\nconst LineChartResponsive = attachSubComponents(withResponsive(LineChartWithProvider), {\n Legend: Legend,\n AnnotationsOverlay: LineChartAnnotationsOverlay,\n Annotation: LineChartAnnotation\n});\nexport { LineChartResponsive as default, LineChart as LineChartUnresponsive };","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const DefaultGlyph = props => {\n const {\n theme\n } = useContext(DataContext) || {};\n const position = props.position || 'start';\n return /*#__PURE__*/_jsx(\"circle\", {\n cx: props.x,\n cy: props.y,\n r: props.size,\n fill: props.color,\n stroke: theme?.backgroundColor,\n strokeWidth: 1.5,\n paintOrder: \"fill\",\n ...props.glyphStyle\n });\n};","import 'css-chunk:src/charts/line-chart/line-chart.module.scss';export default {\n \"line-chart\": \"a8ccharts-v-oO8E\",\n \"line-chart__svg-wrapper\": \"a8ccharts-cpMNjj\",\n \"line-chart--animated\": \"a8ccharts-QrkuTW\",\n \"rise\": \"a8ccharts--rxDU3\",\n \"line-chart__tooltip\": \"a8ccharts-Tu0rR-\",\n \"line-chart__annotation-label-popover\": \"a8ccharts--RSWXi\",\n \"line-chart__tooltip-date\": \"a8ccharts-Q-b5A1\",\n \"line-chart__tooltip-row\": \"a8ccharts-19N7T9\",\n \"line-chart__tooltip-label\": \"a8ccharts-HOAXrD\",\n \"line-chart__annotations-overlay\": \"a8ccharts-rQiY8O\",\n \"line-chart__annotation-label\": \"a8ccharts-8AKWOe\",\n \"line-chart__annotation-label-trigger-button\": \"a8ccharts-7mh3Cl\",\n \"line-chart__annotation-label-popover--visible\": \"a8ccharts-VAeVuJ\",\n \"line-chart__annotation-label-popover--safari\": \"a8ccharts-TEe-iV\",\n \"line-chart__annotation-label-popover-header\": \"a8ccharts-LAUpx7\",\n \"line-chart__annotation-label-popover-content\": \"a8ccharts-b76gEu\",\n \"line-chart__annotation-label-popover-close-button\": \"a8ccharts-LIpFoS\"\n};","import { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport Gridicon from 'gridicons';\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { isSafari } from '../../../utils';\nimport styles from '../line-chart.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const POPOVER_BUTTON_SIZE = 44;\nconst LineChartAnnotationLabelWithPopover = ({\n title,\n subtitle,\n renderLabel,\n renderLabelPopover\n}) => {\n const popoverId = useId();\n const buttonRef = useRef(null);\n const popoverRef = useRef(null);\n const [isPositioned, setIsPositioned] = useState(false);\n const isBrowserSafari = isSafari();\n useEffect(() => {\n const button = buttonRef.current;\n const popover = popoverRef.current;\n if (!button || !popover) return;\n const positionPopover = () => {\n // Popover positioning in Safari is complicated due to issues with SVG foreign objects (https://bugs.webkit.org/show_bug.cgi?id=23113), so let it be positioned in the centre of the viewport.\n if (!isBrowserSafari) {\n const buttonRect = button.getBoundingClientRect();\n popover.style.left = `${buttonRect.right}px`;\n popover.style.top = `${buttonRect.top}px`;\n }\n setIsPositioned(true);\n };\n\n // Position when popover shows\n popover.addEventListener('toggle', e => {\n if (e.newState === 'open') {\n positionPopover();\n }\n });\n\n // Initial positioning if already open\n try {\n if (popover.matches(':popover-open')) {\n positionPopover();\n }\n } catch {\n // Ignore errors in test environments (e.g., JSDOM does not support :popover-open)\n }\n }, [isBrowserSafari]);\n return /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__annotation-label'],\n children: [/*#__PURE__*/_jsx(\"button\", {\n ref: buttonRef,\n popovertarget: popoverId,\n className: styles['line-chart__annotation-label-trigger-button'],\n style: {\n width: `${POPOVER_BUTTON_SIZE}px`,\n height: `${POPOVER_BUTTON_SIZE}px`,\n transform: `translate(${POPOVER_BUTTON_SIZE / 2}px, 0)`\n },\n \"aria-label\": title || __('View details', 'jetpack-charts'),\n children: renderLabel({\n title,\n subtitle\n })\n }), /*#__PURE__*/_jsx(\"div\", {\n ref: popoverRef,\n id: popoverId,\n popover: 'auto',\n className: clsx(styles['line-chart__annotation-label-popover'], isPositioned && styles['line-chart__annotation-label-popover--visible'], isBrowserSafari && styles['line-chart__annotation-label-popover--safari']),\n children: /*#__PURE__*/_jsxs(\"div\", {\n className: styles['line-chart__annotation-label-popover-header'],\n children: [/*#__PURE__*/_jsx(\"div\", {\n className: styles['line-chart__annotation-label-popover-content'],\n children: renderLabelPopover({\n title,\n subtitle\n })\n }), /*#__PURE__*/_jsx(\"button\", {\n popovertarget: popoverId,\n popovertargetaction: 'hide',\n className: styles['line-chart__annotation-label-popover-close-button'],\n \"aria-label\": __('Close', 'jetpack-charts'),\n children: /*#__PURE__*/_jsx(Gridicon, {\n icon: \"cross\",\n size: 16\n })\n })]\n })\n })]\n });\n};\nexport default LineChartAnnotationLabelWithPopover;","import { DataContext } from '@visx/xychart';\nimport { useEffect, useState, useCallback } from 'react';\nimport { useSingleChartContext } from '../../private/single-chart-context';\nimport styles from '../line-chart.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst LineChartAnnotationsOverlay = ({\n children\n}) => {\n const {\n chartRef,\n chartWidth,\n chartHeight\n } = useSingleChartContext();\n const [scales, setScales] = useState(null);\n const [scalesStable, setScalesStable] = useState(false);\n\n // Create a signature for scale data to enable easy comparison\n const createScaleSignature = useCallback(scaleData => {\n const xDomain = scaleData.xScale.domain();\n const yDomain = scaleData.yScale.domain();\n const xRange = scaleData.xScale.range();\n const yRange = scaleData.yScale.range();\n return `${xDomain.join(',')}-${yDomain.join(',')}-${xRange.join(',')}-${yRange.join(',')}`;\n }, []);\n\n // Get scales from chart ref and return them with signature for comparison\n const getScalesData = useCallback(() => {\n if (chartRef?.current) {\n const scaleData = chartRef.current.getScales();\n if (scaleData) {\n const scaleInfo = {\n xScale: scaleData.xScale,\n yScale: scaleData.yScale\n };\n return {\n scales: scaleInfo,\n signature: createScaleSignature(scaleInfo)\n };\n }\n }\n return null;\n }, [chartRef, createScaleSignature]);\n\n // The chart resizes on render so we need to monitor the scales until they stabilize\n useEffect(() => {\n let timeoutId = null;\n let lastSignature = null;\n let retryCount = 0;\n const maxRetries = 20; // 20 * 50ms = 1 second max\n const checkInterval = 50; // Check every 50ms\n\n // Reset stability state when monitoring starts\n setScalesStable(false);\n const monitorScales = () => {\n const currentScaleData = getScalesData();\n\n // If we got scales, compare signatures\n if (currentScaleData) {\n // Check if scales have settled by comparing signatures\n const scalesSettled = lastSignature && currentScaleData.signature === lastSignature;\n if (scalesSettled) {\n // Scales have stabilized, mark as stable\n setScalesStable(true);\n return;\n }\n\n // Update scales and remember signature for next comparison\n setScales(currentScaleData.scales);\n lastSignature = currentScaleData.signature;\n }\n\n // Continue monitoring if we haven't exceeded max retries\n if (retryCount < maxRetries) {\n retryCount++;\n timeoutId = setTimeout(monitorScales, checkInterval);\n }\n };\n monitorScales();\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [getScalesData, chartWidth, chartHeight]);\n\n // Early return if no chart data available\n if (!chartRef || !children) {\n return null;\n }\n if (!scales || !scalesStable) {\n return null;\n }\n\n // Create a DataContext value that mimics what visx provides\n // We're intentionally providing minimal context for annotations to work\n const dataContextValue = {\n xScale: scales.xScale,\n yScale: scales.yScale,\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n width: chartWidth,\n height: chartHeight\n };\n return /*#__PURE__*/_jsx(DataContext.Provider, {\n value: dataContextValue,\n children: /*#__PURE__*/_jsx(\"svg\", {\n width: chartWidth,\n height: chartHeight,\n className: styles['line-chart__annotations-overlay'],\n children: children\n })\n });\n};\nexport default LineChartAnnotationsOverlay;","import { Annotation, CircleSubject, Connector, HtmlLabel, Label, LineSubject } from '@visx/annotation';\nimport { DataContext } from '@visx/xychart';\nimport merge from 'deepmerge';\nimport { useContext, useRef, useEffect, useState, useMemo } from 'react';\nimport { useGlobalChartsTheme } from '../../../providers';\nimport { isSafari } from '../../../utils';\nimport LineChartAnnotationLabelWithPopover, { POPOVER_BUTTON_SIZE } from './line-chart-annotation-label-popover';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst ANNOTATION_MAX_WIDTH = 125; // visx default\nconst ANNOTATION_INIT_HEIGHT = 100;\nexport const getLabelPosition = ({\n subjectType,\n x,\n xMax,\n y,\n yMin,\n yMax,\n maxWidth,\n height\n}) => {\n const annotationMaxWidth = maxWidth ?? ANNOTATION_MAX_WIDTH;\n const annotationHeight = height ?? ANNOTATION_INIT_HEIGHT;\n let dx = 15;\n let dy = 15;\n let isFlippedHorizontally = false;\n let isFlippedVertically = false;\n if (subjectType === 'line-horizontal') {\n dx = 0;\n dy = 20;\n }\n if (subjectType === 'line-vertical') {\n dx = 20;\n dy = 0;\n }\n\n // Smart horizontal positioning: if annotation would extend beyond right edge, position it to the left\n // Account for the connector offset (dx) in boundary calculations\n const effectiveX = x + dx;\n if (effectiveX + annotationMaxWidth > xMax) {\n isFlippedHorizontally = true;\n if (subjectType === 'circle') {\n dx = -dx; // Just flip to the left side with same offset\n } else if (subjectType === 'line-vertical') {\n dx = -20; // Position to the left of the line\n }\n }\n\n // Smart vertical positioning: check both top and bottom edges\n // For circle annotations, they are positioned below by default (dy > 0)\n // Only flip when close to bottom edge to position above\n if (subjectType === 'circle') {\n // Check if positioning below would extend beyond bottom edge\n if (y + dy + annotationHeight > yMin) {\n // Too close to bottom edge, position above\n isFlippedVertically = true;\n dy = -Math.abs(dy); // Ensure negative value to position above the point\n }\n // When close to top edge, keep default below positioning (no flip needed)\n } else if (y - annotationHeight < yMax) {\n // Too close to top edge, position below\n if (subjectType === 'line-horizontal') {\n isFlippedVertically = true;\n dy = Math.abs(dy); // Ensure positive value to position below the point\n } else if (subjectType === 'line-vertical') {\n isFlippedVertically = true; // For anchor adjustment only\n }\n } else if (y + annotationHeight > yMin) {\n // Too close to bottom edge, position above\n if (subjectType === 'line-horizontal') {\n isFlippedVertically = true;\n dy = -Math.abs(dy); // Ensure negative value to position above the point\n } else if (subjectType === 'line-vertical') {\n isFlippedVertically = true; // For anchor adjustment only\n }\n }\n return {\n dx,\n dy,\n isFlippedHorizontally,\n isFlippedVertically\n };\n};\nconst getHorizontalAnchor = (subjectType, isFlippedHorizontally) => {\n if (subjectType === 'line-horizontal') {\n return isFlippedHorizontally ? 'end' : 'start';\n }\n return undefined;\n};\nconst getVerticalAnchor = (subjectType, isFlippedVertically, y, yMax, height) => {\n if (subjectType === 'line-vertical') {\n if (isFlippedVertically) {\n // If flipped due to top edge, anchor to top; if flipped due to bottom edge, anchor to bottom\n return y - height < yMax ? 'start' : 'end';\n }\n return 'start';\n }\n return undefined;\n};\nconst LineChartAnnotation = ({\n datum,\n title,\n subtitle,\n subjectType = 'circle',\n styles: datumStyles,\n testId,\n renderLabel,\n renderLabelPopover\n}) => {\n const providerTheme = useGlobalChartsTheme();\n const {\n xScale,\n yScale\n } = useContext(DataContext) || {};\n const labelRef = useRef(null);\n const [height, setHeight] = useState(null);\n\n // Deep merge styles to preserve nested object properties\n const styles = merge(providerTheme.annotationStyles ?? {}, datumStyles ?? {});\n\n // Measure the label height once after initial render\n useEffect(() => {\n if (labelRef.current?.getBBox) {\n const bbox = labelRef.current.getBBox();\n setHeight(bbox.height);\n }\n }, []);\n const positionData = useMemo(() => {\n if (!datum || !datum.date || datum.value == null || !xScale || !yScale) return null;\n const x = xScale(datum.date);\n const y = yScale(datum.value);\n if (typeof x !== 'number' || typeof y !== 'number') return null;\n const [yMin, yMax] = yScale.range().map(Number);\n const [xMin, xMax] = xScale.range().map(Number);\n\n // If a custom label is provided, use the provided position\n if (renderLabel) {\n return {\n x,\n dx: 0,\n y,\n dy: 0,\n yMin,\n yMax,\n xMin,\n xMax,\n isFlippedHorizontally: false,\n isFlippedVertically: false\n };\n }\n const position = getLabelPosition({\n subjectType,\n x,\n xMax,\n y,\n yMin,\n yMax,\n maxWidth: styles?.label?.maxWidth,\n height\n });\n return {\n x,\n y,\n yMin,\n yMax,\n xMin,\n xMax,\n ...position\n };\n }, [datum, xScale, yScale, subjectType, styles?.label?.maxWidth, height, renderLabel]);\n if (!positionData) return null;\n const {\n x,\n y,\n yMin,\n yMax,\n xMin,\n xMax,\n dx,\n dy,\n isFlippedHorizontally,\n isFlippedVertically\n } = positionData;\n const getLabelY = () => {\n const labelY = styles?.label?.y;\n if (labelY === 'start') return yMax;\n if (labelY === 'end') return yMin;\n return labelY;\n };\n const getLabelX = () => {\n const labelX = styles?.label?.x;\n if (labelX === 'start') return xMin;\n if (labelX === 'end') return xMax;\n return labelX;\n };\n const labelPosition = {\n x: getLabelX(),\n y: getLabelY()\n };\n\n // Safari has a bug where children of an SVG foreignObject are not positioned correctly https://bugs.webkit.org/show_bug.cgi?id=23113\n // This is a workaround to position the label correctly\n const getSafariHTMLLabelPosition = () => {\n const labelWidth = POPOVER_BUTTON_SIZE;\n const labelHeight = POPOVER_BUTTON_SIZE;\n return isSafari() ? {\n transform: `translate(${x + (dx || 0) + (typeof labelPosition.x === 'number' ? labelPosition.x - x : 0) - labelWidth}px, ${y + (dy || 0) + (typeof labelPosition.y === 'number' ? labelPosition.y - y : 0) - labelHeight}px)`,\n width: labelWidth,\n height: labelHeight\n } : undefined;\n };\n return /*#__PURE__*/_jsx(\"g\", {\n children: /*#__PURE__*/_jsxs(Annotation, {\n x: x,\n y: y,\n dx: dx,\n dy: dy,\n children: [/*#__PURE__*/_jsx(Connector, {\n ...styles?.connector\n }), subjectType === 'circle' && /*#__PURE__*/_jsx(CircleSubject, {\n ...styles?.circleSubject\n }), subjectType === 'line-vertical' && /*#__PURE__*/_jsx(LineSubject, {\n min: yMax,\n max: yMin,\n ...styles?.lineSubject,\n orientation: 'vertical'\n }), subjectType === 'line-horizontal' && /*#__PURE__*/_jsx(LineSubject, {\n min: xMin,\n max: xMax,\n ...styles?.lineSubject,\n orientation: 'horizontal'\n }), renderLabel ? /*#__PURE__*/_jsx(HtmlLabel, {\n ...styles?.label,\n ...labelPosition,\n children: /*#__PURE__*/_jsx(\"div\", {\n style: getSafariHTMLLabelPosition(),\n children: renderLabelPopover ? /*#__PURE__*/_jsx(LineChartAnnotationLabelWithPopover, {\n title: title,\n subtitle: subtitle,\n renderLabel: renderLabel,\n renderLabelPopover: renderLabelPopover\n }) : renderLabel({\n title,\n subtitle\n })\n })\n }) : /*#__PURE__*/_jsx(\"g\", {\n ref: labelRef,\n children: /*#__PURE__*/_jsx(Label, {\n title: title,\n subtitle: subtitle,\n ...styles?.label,\n ...labelPosition,\n horizontalAnchor: getHorizontalAnchor(subjectType, isFlippedHorizontally),\n verticalAnchor: getVerticalAnchor(subjectType, isFlippedVertically, y, yMax, height ?? ANNOTATION_INIT_HEIGHT)\n })\n })]\n })\n });\n};\nexport default LineChartAnnotation;","import { DataContext } from '@visx/xychart';\nimport { useContext } from 'react';\nconst toNumber = val => {\n const num = typeof val === 'number' ? val : parseFloat(val);\n return isNaN(num) ? undefined : num;\n};\nconst LineChartGlyph = ({\n data,\n index,\n color,\n glyphStyle,\n renderGlyph,\n accessors,\n position\n}) => {\n const {\n xScale,\n yScale\n } = useContext(DataContext) || {};\n if (!xScale || !yScale) return null;\n if (data.data.length === 0) return null;\n const point = position === 'start' ? data.data[0] : data.data[data.data.length - 1];\n const x = xScale(accessors.xAccessor(point));\n const y = yScale(accessors.yAccessor(point));\n if (typeof x !== 'number' || typeof y !== 'number') return null;\n const size = Math.max(0, toNumber(glyphStyle?.radius) ?? 4);\n return renderGlyph({\n key: `${position}-glyph-${data.label}`,\n index,\n datum: point,\n color,\n size,\n x,\n y,\n glyphStyle,\n position\n });\n};\nexport default LineChartGlyph;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB,oBAAoB;AAClD,SAAS,iBAAiB,aAAa,sBAAsB;AAC7D,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,YAAY,MAAM,MAAM,eAAAA,oBAAmB;AAC7D,SAAS,MAAAC,WAAU;AAEnB,OAAOC,WAAU;AACjB,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,WAAAC,UAAS,cAAAC,aAAY,YAAY,qBAAqB,YAAAC,WAAU,UAAAC,SAAQ,iBAAiB,sBAAsB;;;ACTxH,SAAS,mB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cACxE,QAAQ;AAAA,YACV,CAAC,GAAgB,gBAAAA,MAAK,oBAAoB;AAAA,cACxC,UAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA;AAAA,YACF,CAAC,CAAC;AAAA,UACJ,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC,GAAG,mBAAmB,YAAY,eAAe,QAAQ;AAAA,IAC5D,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAID,IAAM,wBAAqC,2BAAW,CAAC,OAAO,QAAQ;AACpE,QAAM,kBAAkBG,YAAW,mBAAmB;AAGtD,MAAI,iBAAiB;AACnB,WAAoB,gBAAAH,MAAK,mBAAmB;AAAA,MAC1C,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAGA,SAAoB,gBAAAA,MAAK,sBAAsB;AAAA,IAC7C,UAAuB,gBAAAA,MAAK,mBAAmB;AAAA,MAC7C,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AACD,sBAAsB,cAAc;AACpC,IAAM,YAAY,oBAAoB,uBAAuB;AAAA,EAC3D;AAAA,EACA,oBAAoB;AAAA,EACpB,YAAY;AACd,CAAC;AACD,IAAM,sBAAsB,oBAAoB,eAAe,qBAAqB,GAAG;AAAA,EACrF;AAAA,EACA,oBAAoB;AAAA,EACpB,YAAY;AACd,CAAC;","names":["DataContext","__","clsx","useMemo","useContext","useState","useRef","_jsx","DataContext","useEffect","useState","_jsx","useState","useEffect","DataContext","DataContext","useContext","useRef","useEffect","useState","_jsx","_jsxs","useContext","DataContext","useRef","useState","useEffect","x","y","yMin","yMax","xMin","xMax","DataContext","useContext","_jsx","_jsxs","toNumber","useContext","DataContext","useRef","useState","useMemo","clsx","__"]}
|
|
@@ -55,20 +55,20 @@ function withResponsive(WrappedComponent) {
|
|
|
55
55
|
maxWidth,
|
|
56
56
|
aspectRatio
|
|
57
57
|
});
|
|
58
|
-
const effectiveWidth = measuredWidth ||
|
|
59
|
-
const effectiveHeight = measuredHeight ||
|
|
58
|
+
const effectiveWidth = measuredWidth || width || 0;
|
|
59
|
+
const effectiveHeight = measuredHeight || height || 0;
|
|
60
60
|
const defaultHeight = hasAspectRatio ? "auto" : "100%";
|
|
61
61
|
return /* @__PURE__ */ _jsx("div", {
|
|
62
62
|
ref: parentRef,
|
|
63
63
|
className: with_responsive_module_default.container,
|
|
64
64
|
style: {
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
65
|
+
width: width ?? "100%",
|
|
66
|
+
height: height ?? defaultHeight
|
|
67
67
|
},
|
|
68
68
|
children: /* @__PURE__ */ _jsx(WrappedComponent, {
|
|
69
69
|
width: effectiveWidth,
|
|
70
70
|
height: effectiveHeight,
|
|
71
|
-
size
|
|
71
|
+
size,
|
|
72
72
|
...chartProps
|
|
73
73
|
})
|
|
74
74
|
});
|
|
@@ -78,4 +78,4 @@ function withResponsive(WrappedComponent) {
|
|
|
78
78
|
export {
|
|
79
79
|
withResponsive
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-OP6PHB2U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/charts/private/with-responsive/with-responsive.tsx","../src/charts/private/with-responsive/with-responsive.module.scss"],"sourcesContent":["import { useParentSize } from '@visx/responsive';\nimport styles from './with-responsive.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useResponsiveDimensions = ({\n resizeDebounceTime = 300,\n maxWidth = 1200,\n aspectRatio\n}) => {\n const {\n parentRef,\n width: parentWidth,\n height: parentHeight\n } = useParentSize({\n debounceTime: resizeDebounceTime,\n enableDebounceLeadingCall: true\n });\n const containerWidth = parentWidth > 0 ? Math.min(parentWidth, maxWidth) : 0;\n const containerHeight = aspectRatio !== undefined ? containerWidth * aspectRatio : parentHeight;\n return {\n parentRef,\n width: containerWidth,\n height: containerHeight,\n /**\n * Whether an aspectRatio was provided. Used to determine container\n * height styling: 'auto' when true (height derived from width),\n * '100%' when false (fill parent container).\n */\n hasAspectRatio: aspectRatio !== undefined\n };\n};\n\n/**\n * A higher-order component that provides responsive dimensions\n * to the wrapped chart component using useParentSize from `@visx/responsive`.\n *\n * @param WrappedComponent - The chart component to be wrapped.\n * @return A functional component that renders the wrapped component with responsive dimensions.\n */\nexport function withResponsive(\n// 'options' is excluded so that each chart can define its own options type\nWrappedComponent) {\n return function ResponsiveChart({\n resizeDebounceTime = 300,\n maxWidth = 1200,\n aspectRatio,\n size,\n width,\n height,\n ...chartProps\n }) {\n const {\n parentRef,\n width: measuredWidth,\n height: measuredHeight,\n hasAspectRatio\n } = useResponsiveDimensions({\n resizeDebounceTime,\n maxWidth,\n aspectRatio\n });\n\n // Use measured dimensions, but fall back to explicit width/height props if measurement returns 0\n // (e.g., during initial render or in test environments without DOM measurement).\n // Do not use size here — size controls chart element dimensions (e.g. pie diameter), not container dimensions.\n const effectiveWidth = measuredWidth || width || 0;\n const effectiveHeight = measuredHeight || height || 0;\n const defaultHeight = hasAspectRatio ? 'auto' : '100%';\n return /*#__PURE__*/_jsx(\"div\", {\n ref: parentRef,\n className: styles.container,\n style: {\n width: width ?? '100%',\n height: height ?? defaultHeight\n },\n children: /*#__PURE__*/_jsx(WrappedComponent, {\n width: effectiveWidth,\n height: effectiveHeight,\n size: size,\n ...chartProps\n })\n });\n };\n}","import 'css-chunk:src/charts/private/with-responsive/with-responsive.module.scss';export default {\n \"container\": \"a8ccharts-GSKfBD\"\n};"],"mappings":";AAAA,SAAS,qBAAqB;;;ACAoD,IAAO,iCAAQ;AAAA,EAC/F,aAAa;AACf;;;ADAA,SAAS,OAAO,YAAY;AAC5B,IAAM,0BAA0B,CAAC;AAAA,EAC/B,qBAAqB;AAAA,EACrB,WAAW;AAAA,EACX;AACF,MAAM;AACJ,QAAM;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,EACV,IAAI,cAAc;AAAA,IAChB,cAAc;AAAA,IACd,2BAA2B;AAAA,EAC7B,CAAC;AACD,QAAM,iBAAiB,cAAc,IAAI,KAAK,IAAI,aAAa,QAAQ,IAAI;AAC3E,QAAM,kBAAkB,gBAAgB,SAAY,iBAAiB,cAAc;AACnF,SAAO;AAAA,IACL;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMR,gBAAgB,gBAAgB;AAAA,EAClC;AACF;AASO,SAAS,eAEhB,kBAAkB;AAChB,SAAO,SAAS,gBAAgB;AAAA,IAC9B,qBAAqB;AAAA,IACrB,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAAG;AACD,UAAM;AAAA,MACJ;AAAA,MACA,OAAO;AAAA,MACP,QAAQ;AAAA,MACR;AAAA,IACF,IAAI,wBAAwB;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAKD,UAAM,iBAAiB,iBAAiB,SAAS;AACjD,UAAM,kBAAkB,kBAAkB,UAAU;AACpD,UAAM,gBAAgB,iBAAiB,SAAS;AAChD,WAAoB,qBAAK,OAAO;AAAA,MAC9B,KAAK;AAAA,MACL,WAAW,+BAAO;AAAA,MAClB,OAAO;AAAA,QACL,OAAO,SAAS;AAAA,QAChB,QAAQ,UAAU;AAAA,MACpB;AAAA,MACA,UAAuB,qBAAK,kBAAkB;AAAA,QAC5C,OAAO;AAAA,QACP,QAAQ;AAAA,QACR;AAAA,QACA,GAAG;AAAA,MACL,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -124,6 +124,7 @@ function useTooltipPortalRelocator(containerRef) {
|
|
|
124
124
|
if (!isVisxPortalNode(node)) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
+
node.style.opacity = "0";
|
|
127
128
|
node.classList.add(use_tooltip_portal_relocator_module_default.relocatedPortal);
|
|
128
129
|
const { activeElement } = node.ownerDocument;
|
|
129
130
|
const focusedElement = activeElement instanceof HTMLElement && node.contains(activeElement) ? activeElement : null;
|
|
@@ -133,6 +134,11 @@ function useTooltipPortalRelocator(containerRef) {
|
|
|
133
134
|
if (focusedElement) {
|
|
134
135
|
focusedElement.focus();
|
|
135
136
|
}
|
|
137
|
+
requestAnimationFrame(() => {
|
|
138
|
+
requestAnimationFrame(() => {
|
|
139
|
+
node.style.opacity = "";
|
|
140
|
+
});
|
|
141
|
+
});
|
|
136
142
|
};
|
|
137
143
|
installRemoveChildPatch();
|
|
138
144
|
for (const child of Array.from(document.body.children)) {
|
|
@@ -658,11 +664,13 @@ var useChartMargin = (height, options, data, theme, horizontal = false) => {
|
|
|
658
664
|
}, [options, theme, yTicks]);
|
|
659
665
|
};
|
|
660
666
|
|
|
661
|
-
// src/hooks/use-element-
|
|
667
|
+
// src/hooks/use-element-size.ts
|
|
662
668
|
import { useState as useState2, useCallback as useCallback3, useRef as useRef3 } from "react";
|
|
663
|
-
function
|
|
669
|
+
function useElementSize({
|
|
670
|
+
initialWidth = 0,
|
|
664
671
|
initialHeight = 0
|
|
665
672
|
} = {}) {
|
|
673
|
+
const [width, setWidth] = useState2(initialWidth);
|
|
666
674
|
const [height, setHeight] = useState2(initialHeight);
|
|
667
675
|
const observerRef = useRef3(null);
|
|
668
676
|
const refCallback = useCallback3((node) => {
|
|
@@ -672,15 +680,17 @@ function useElementHeight({
|
|
|
672
680
|
}
|
|
673
681
|
if (node) {
|
|
674
682
|
const handleResize = () => {
|
|
675
|
-
|
|
683
|
+
const rect = node.getBoundingClientRect();
|
|
684
|
+
setWidth(rect.width || 0);
|
|
685
|
+
setHeight(rect.height || 0);
|
|
676
686
|
};
|
|
677
687
|
handleResize();
|
|
678
|
-
const resizeObserver = new
|
|
688
|
+
const resizeObserver = new ResizeObserver(handleResize);
|
|
679
689
|
resizeObserver.observe(node);
|
|
680
690
|
observerRef.current = resizeObserver;
|
|
681
691
|
}
|
|
682
692
|
}, []);
|
|
683
|
-
return [refCallback, height];
|
|
693
|
+
return [refCallback, width, height];
|
|
684
694
|
}
|
|
685
695
|
|
|
686
696
|
// src/hooks/use-has-legend-child.ts
|
|
@@ -1218,7 +1228,7 @@ export {
|
|
|
1218
1228
|
useXYChartTheme,
|
|
1219
1229
|
useChartDataTransform,
|
|
1220
1230
|
useChartMargin,
|
|
1221
|
-
|
|
1231
|
+
useElementSize,
|
|
1222
1232
|
useHasLegendChild,
|
|
1223
1233
|
useTextTruncation,
|
|
1224
1234
|
useZeroValueDisplay,
|
|
@@ -1229,4 +1239,4 @@ export {
|
|
|
1229
1239
|
Legend,
|
|
1230
1240
|
useChartLegendItems
|
|
1231
1241
|
};
|
|
1232
|
-
//# sourceMappingURL=chunk-
|
|
1242
|
+
//# sourceMappingURL=chunk-RFSHE3HL.js.map
|