@automattic/charts 0.56.2 → 0.56.4
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/CHANGELOG.md +14 -0
- package/dist/charts/bar-chart/index.cjs +5 -5
- package/dist/charts/bar-chart/index.css +12 -0
- package/dist/charts/bar-chart/index.css.map +1 -1
- package/dist/charts/bar-chart/index.js +4 -4
- package/dist/charts/bar-list-chart/index.cjs +6 -6
- package/dist/charts/bar-list-chart/index.css +12 -0
- package/dist/charts/bar-list-chart/index.css.map +1 -1
- package/dist/charts/bar-list-chart/index.js +5 -5
- package/dist/charts/conversion-funnel-chart/index.cjs +5 -3
- package/dist/charts/conversion-funnel-chart/index.cjs.map +1 -1
- package/dist/charts/conversion-funnel-chart/index.css +14 -1
- package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
- package/dist/charts/conversion-funnel-chart/index.d.cts +2 -0
- package/dist/charts/conversion-funnel-chart/index.d.ts +2 -0
- package/dist/charts/conversion-funnel-chart/index.js +4 -2
- package/dist/charts/geo-chart/index.cjs +4 -4
- package/dist/charts/geo-chart/index.css +12 -0
- package/dist/charts/geo-chart/index.css.map +1 -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 +12 -0
- package/dist/charts/leaderboard-chart/index.css.map +1 -1
- package/dist/charts/leaderboard-chart/index.js +4 -4
- package/dist/charts/line-chart/index.cjs +5 -5
- package/dist/charts/line-chart/index.css +12 -0
- package/dist/charts/line-chart/index.css.map +1 -1
- package/dist/charts/line-chart/index.js +4 -4
- package/dist/charts/pie-chart/index.cjs +7 -7
- package/dist/charts/pie-chart/index.css +12 -0
- package/dist/charts/pie-chart/index.css.map +1 -1
- package/dist/charts/pie-chart/index.js +6 -6
- package/dist/charts/pie-semi-circle-chart/index.cjs +7 -7
- package/dist/charts/pie-semi-circle-chart/index.css +12 -0
- package/dist/charts/pie-semi-circle-chart/index.css.map +1 -1
- package/dist/charts/pie-semi-circle-chart/index.js +6 -6
- package/dist/charts/sparkline/index.cjs +6 -6
- package/dist/charts/sparkline/index.css +12 -0
- package/dist/charts/sparkline/index.css.map +1 -1
- package/dist/charts/sparkline/index.js +5 -5
- package/dist/{chunk-OTZT3MC2.cjs → chunk-2A34OA5O.cjs} +19 -20
- package/dist/chunk-2A34OA5O.cjs.map +1 -0
- package/dist/chunk-4YYROZDJ.cjs +375 -0
- package/dist/chunk-4YYROZDJ.cjs.map +1 -0
- package/dist/{chunk-YYQ4IK5V.cjs → chunk-5N77S5N3.cjs} +103 -80
- package/dist/chunk-5N77S5N3.cjs.map +1 -0
- package/dist/chunk-66BXSWMW.cjs +1065 -0
- package/dist/chunk-66BXSWMW.cjs.map +1 -0
- package/dist/{chunk-CEZGL6YP.js → chunk-6CCZL2JJ.js} +15 -7
- package/dist/chunk-6CCZL2JJ.js.map +1 -0
- package/dist/{chunk-NW3RUYK2.cjs → chunk-7QDEU3KN.cjs} +15 -22
- package/dist/chunk-7QDEU3KN.cjs.map +1 -0
- package/dist/{chunk-H34CJSR6.js → chunk-AWNCAKZY.js} +367 -358
- package/dist/chunk-AWNCAKZY.js.map +1 -0
- package/dist/{chunk-5XI443YP.js → chunk-BPYKWMI7.js} +72 -64
- package/dist/chunk-BPYKWMI7.js.map +1 -0
- package/dist/{chunk-7UJPVCMB.cjs → chunk-CERFRCXD.cjs} +265 -262
- package/dist/chunk-CERFRCXD.cjs.map +1 -0
- package/dist/chunk-CMHPXSCI.js +351 -0
- package/dist/chunk-CMHPXSCI.js.map +1 -0
- package/dist/chunk-EBDUXL5K.js +421 -0
- package/dist/chunk-EBDUXL5K.js.map +1 -0
- package/dist/{chunk-2VPPTJS2.js → chunk-FZYJM5PN.js} +256 -253
- package/dist/chunk-FZYJM5PN.js.map +1 -0
- package/dist/chunk-GBDFC74U.cjs +165 -0
- package/dist/chunk-GBDFC74U.cjs.map +1 -0
- package/dist/{chunk-ODF5O5PV.cjs → chunk-HNEG3EFJ.cjs} +154 -170
- package/dist/chunk-HNEG3EFJ.cjs.map +1 -0
- package/dist/{chunk-SRXJLAKG.cjs → chunk-I2276W3I.cjs} +28 -37
- package/dist/chunk-I2276W3I.cjs.map +1 -0
- package/dist/chunk-KKPZ4MVF.js +375 -0
- package/dist/chunk-KKPZ4MVF.js.map +1 -0
- package/dist/chunk-KMYJJTSR.cjs +421 -0
- package/dist/chunk-KMYJJTSR.cjs.map +1 -0
- package/dist/{chunk-A3AEEGKR.js → chunk-KXRWNFQJ.js} +20 -21
- package/dist/chunk-KXRWNFQJ.js.map +1 -0
- package/dist/{chunk-TVV7ZI7C.cjs → chunk-LSV7F26B.cjs} +362 -353
- package/dist/chunk-LSV7F26B.cjs.map +1 -0
- package/dist/{chunk-T4J6TI55.js → chunk-M7PRGJFE.js} +102 -79
- package/dist/chunk-M7PRGJFE.js.map +1 -0
- package/dist/{chunk-TNRKEBTA.js → chunk-PGJAZN2H.js} +148 -164
- package/dist/{chunk-TNRKEBTA.js.map → chunk-PGJAZN2H.js.map} +1 -1
- package/dist/chunk-R23BFDIW.js +1065 -0
- package/dist/chunk-R23BFDIW.js.map +1 -0
- package/dist/{chunk-HIWNB5PK.cjs → chunk-RCY6XLGU.cjs} +13 -5
- package/dist/chunk-RCY6XLGU.cjs.map +1 -0
- package/dist/chunk-RSYD434G.cjs +351 -0
- package/dist/chunk-RSYD434G.cjs.map +1 -0
- package/dist/{chunk-C33AQZEC.js → chunk-TYIH5LMV.js} +16 -23
- package/dist/chunk-TYIH5LMV.js.map +1 -0
- package/dist/chunk-WMWAUOQ4.js +165 -0
- package/dist/chunk-WMWAUOQ4.js.map +1 -0
- package/dist/chunk-XWYZIFZW.js +66 -0
- package/dist/chunk-XWYZIFZW.js.map +1 -0
- package/dist/{chunk-7HROSZRS.cjs → chunk-Y3NNQMAX.cjs} +70 -62
- package/dist/chunk-Y3NNQMAX.cjs.map +1 -0
- package/dist/chunk-ZXEFMKVP.cjs +120 -0
- package/dist/chunk-ZXEFMKVP.cjs.map +1 -0
- package/dist/chunk-ZY4FXLMM.js +120 -0
- package/dist/chunk-ZY4FXLMM.js.map +1 -0
- package/dist/components/legend/index.cjs +2 -2
- package/dist/components/legend/index.css +12 -0
- package/dist/components/legend/index.css.map +1 -1
- package/dist/components/legend/index.js +1 -1
- package/dist/components/tooltip/index.cjs +2 -2
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/trend-indicator/index.cjs +2 -2
- package/dist/components/trend-indicator/index.js +1 -1
- package/dist/hooks/index.cjs +4 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.css +12 -0
- package/dist/hooks/index.css.map +1 -1
- package/dist/hooks/index.d.cts +28 -2
- package/dist/hooks/index.d.ts +28 -2
- package/dist/hooks/index.js +3 -1
- package/dist/index.cjs +18 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +14 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -17
- package/dist/providers/index.cjs +2 -2
- package/dist/providers/index.css +12 -0
- package/dist/providers/index.css.map +1 -1
- package/dist/providers/index.d.cts +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/{themes-DQs9rbN5.d.cts → themes-BDVaIfBz.d.cts} +9 -0
- package/dist/{themes-CRV5fVzJ.d.ts → themes-mcS8QNkQ.d.ts} +9 -0
- package/package.json +7 -4
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +2 -1
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +16 -6
- package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +34 -0
- package/src/charts/conversion-funnel-chart/types.ts +2 -0
- package/src/charts/pie-chart/pie-chart.tsx +2 -3
- package/src/hooks/index.ts +1 -0
- package/src/hooks/test/use-tooltip-portal-relocator.test.ts +216 -0
- package/src/hooks/use-tooltip-portal-relocator.module.scss +10 -0
- package/src/hooks/use-tooltip-portal-relocator.ts +177 -0
- package/src/providers/chart-context/global-charts-provider.tsx +18 -1
- package/tsup.config.ts +11 -0
- package/dist/chunk-2VPPTJS2.js.map +0 -1
- package/dist/chunk-5XI443YP.js.map +0 -1
- package/dist/chunk-7HROSZRS.cjs.map +0 -1
- package/dist/chunk-7UJPVCMB.cjs.map +0 -1
- package/dist/chunk-A3AEEGKR.js.map +0 -1
- package/dist/chunk-C33AQZEC.js.map +0 -1
- package/dist/chunk-CEZGL6YP.js.map +0 -1
- package/dist/chunk-COOC2TVQ.js +0 -167
- package/dist/chunk-COOC2TVQ.js.map +0 -1
- package/dist/chunk-EJHLLXBV.js +0 -362
- package/dist/chunk-EJHLLXBV.js.map +0 -1
- package/dist/chunk-FWMJ2FR2.js +0 -121
- package/dist/chunk-FWMJ2FR2.js.map +0 -1
- package/dist/chunk-GRYNIPWH.cjs +0 -385
- package/dist/chunk-GRYNIPWH.cjs.map +0 -1
- package/dist/chunk-H34CJSR6.js.map +0 -1
- package/dist/chunk-HIWNB5PK.cjs.map +0 -1
- package/dist/chunk-IZWC33YN.cjs +0 -357
- package/dist/chunk-IZWC33YN.cjs.map +0 -1
- package/dist/chunk-KOF32DBL.cjs +0 -1058
- package/dist/chunk-KOF32DBL.cjs.map +0 -1
- package/dist/chunk-LHWRZMF7.cjs +0 -362
- package/dist/chunk-LHWRZMF7.cjs.map +0 -1
- package/dist/chunk-MFRS2PEY.cjs +0 -121
- package/dist/chunk-MFRS2PEY.cjs.map +0 -1
- package/dist/chunk-MMDLXS6O.js +0 -75
- package/dist/chunk-MMDLXS6O.js.map +0 -1
- package/dist/chunk-NW3RUYK2.cjs.map +0 -1
- package/dist/chunk-ODF5O5PV.cjs.map +0 -1
- package/dist/chunk-OTZT3MC2.cjs.map +0 -1
- package/dist/chunk-SBRMWDWM.js +0 -357
- package/dist/chunk-SBRMWDWM.js.map +0 -1
- package/dist/chunk-SRXJLAKG.cjs.map +0 -1
- package/dist/chunk-T4J6TI55.js.map +0 -1
- package/dist/chunk-TVV7ZI7C.cjs.map +0 -1
- package/dist/chunk-XVMXWV3C.cjs +0 -167
- package/dist/chunk-XVMXWV3C.cjs.map +0 -1
- package/dist/chunk-YYQ4IK5V.cjs.map +0 -1
- package/dist/chunk-ZDNCF642.js +0 -1058
- package/dist/chunk-ZDNCF642.js.map +0 -1
- package/dist/chunk-ZWBUEHKF.js +0 -385
- package/dist/chunk-ZWBUEHKF.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-ZXEFMKVP.cjs","../src/charts/geo-chart/geo-chart.tsx","../src/charts/geo-chart/geo-chart.module.scss"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACXA,uCAAmB;AACnB,wEAAiB;AACjB,8BAAoC;AACpC,wDAAsB;ADatB;AACA;AEpB8D,IAAO,yBAAA,EAAQ;AAAA,EAC3E,WAAA,EAAa;AACf,CAAA;AFsBA;AACA;ACVA,+CAA4B;AAC5B,IAAM,2BAAA,EAA6B,SAAA;AACnC,IAAM,yBAAA,EAA2B,SAAA;AAqBjC,IAAM,iBAAA,EAAmB,CAAC;AAAA,EACxB,SAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,WAAA;AAAA,EACb;AACF,CAAA,EAAA,GAAM;AACJ,EAAA,MAAM;AAAA,IACJ,gBAAA;AAAA,IACA,KAAA,EAAO;AAAA,MACL,QAAA,EAAU;AAAA,QACR;AAAA,MACF,CAAA;AAAA,MACA;AAAA,IACF;AAAA,EACF,EAAA,EAAI,sDAAA,CAAuB;AAG3B,EAAA,MAAM,mBAAA,kBAAkC,6BAAA,KAAK,EAAO;AAAA,IAClD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BAAA,sCAAK,EAAsB;AAAA,IAC7C,QAAA,kBAAuB,6BAAA,gBAAK,EAAkB;AAAA,MAC5C,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC,CAAA;AACH,CAAA;AACA,oBAAA,CAAqB,YAAA,EAAc,UAAA;AACnC,IAAM,mBAAA,EAAqB,8CAAA,oBAAmC,CAAA;ADnB9D;AACA;AACE;AACA;AACF,qGAAC","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-ZXEFMKVP.cjs","sourcesContent":[null,"/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useContext, useMemo } from 'react';\nimport { Chart } from 'react-google-charts';\n/**\n * Internal dependencies\n */\nimport { GlobalChartsContext, GlobalChartsProvider, useGlobalChartsContext } from '../../providers';\nimport { lightenHexColor, normalizeColorToHex } from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './geo-chart.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst DEFAULT_FEATURE_FILL_COLOR = '#ffffff';\nconst DEFAULT_BACKGROUND_COLOR = '#ffffff';\n\n/**\n * Renders a geographical chart using Google Charts GeoChart to visualize data.\n *\n * Supports the full Google Charts data format including custom tooltips, formatted values,\n * and multiple data columns for maximum flexibility.\n *\n * Locations can be identified by full name (e.g., 'United States', 'California') or codes\n * (e.g., 'US', 'US-CA'). Full names are recommended for better readability in tooltips.\n *\n * @param props - The props for the GeoChart component\n * @param props.data - Data in Google Charts format (array of arrays with headers)\n * @param props.width - Width of the chart in pixels\n * @param props.height - Height of the chart in pixels\n * @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)\n * @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')\n * @param props.className - Additional CSS class name for the chart container\n * @param props.renderPlaceholder - Optional render function for the loading placeholder\n * @return A React component displaying an interactive map with data visualization\n */\nconst GeoChartInternal = ({\n className,\n data,\n width,\n height,\n region = 'world',\n resolution = 'countries',\n renderPlaceholder\n}) => {\n const {\n getElementStyles,\n theme: {\n geoChart: {\n featureFillColor\n },\n backgroundColor\n }\n } = useGlobalChartsContext();\n\n // Render loading placeholder\n const loadingPlaceholder = /*#__PURE__*/_jsx(\"div\", {\n className: clsx('geo-chart', styles.container, className),\n style: {\n width,\n height\n },\n children: renderPlaceholder ? renderPlaceholder() : __('Loading map', 'jetpack-charts')\n });\n\n // Google charts doesn't accept CSS variables, so we need to convert them to hex colors\n const fullColorHex = getElementStyles({\n index: 0\n }).color;\n const lightColorHex = lightenHexColor(fullColorHex, 0.8);\n // Use normalizeColorToHex to ensure HSL/RGB values from CSS variables are converted to hex\n const backgroundColorHex = normalizeColorToHex(backgroundColor, null, resolveCssVariable) || DEFAULT_BACKGROUND_COLOR;\n const defaultFillColorHex = normalizeColorToHex(featureFillColor, null, resolveCssVariable) || DEFAULT_FEATURE_FILL_COLOR;\n\n // Check if data has HTML tooltips (column with role: 'tooltip' and p.html: true)\n const hasHtmlTooltips = useMemo(() => data.length > 0 && data[0].some(col => typeof col === 'object' && col !== null && 'role' in col && col.role === 'tooltip' && 'p' in col && typeof col.p === 'object' && col.p !== null && 'html' in col.p && col.p.html === true), [data]);\n const options = useMemo(() => ({\n ...(region !== 'world' && {\n region\n }),\n ...(resolution !== 'countries' && {\n resolution\n }),\n colorAxis: {\n colors: [lightColorHex, fullColorHex]\n },\n backgroundColor: backgroundColorHex,\n datalessRegionColor: defaultFillColorHex,\n defaultColor: defaultFillColorHex,\n tooltip: {\n trigger: 'focus',\n isHtml: hasHtmlTooltips\n },\n legend: 'none',\n keepAspectRatio: true\n }), [region, resolution, lightColorHex, fullColorHex, backgroundColorHex, defaultFillColorHex, hasHtmlTooltips]);\n return /*#__PURE__*/_jsx(\"div\", {\n className: clsx('geo-chart', styles.container, className),\n style: {\n width,\n height,\n backgroundColor\n },\n children: /*#__PURE__*/_jsx(Chart, {\n chartType: \"GeoChart\",\n width: width,\n height: height,\n data: data,\n options: options,\n loader: loadingPlaceholder\n })\n });\n};\nconst GeoChartWithProvider = props => {\n const existingContext = useContext(GlobalChartsContext);\n\n // If we're already in a GlobalChartsProvider context, don't create a new one\n if (existingContext) {\n return /*#__PURE__*/_jsx(GeoChartInternal, {\n ...props\n });\n }\n\n // Otherwise, create our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(GeoChartInternal, {\n ...props\n })\n });\n};\nGeoChartWithProvider.displayName = 'GeoChart';\nconst GeoChartResponsive = withResponsive(GeoChartWithProvider);\nexport { GeoChartResponsive as default, GeoChartWithProvider as GeoChartUnresponsive };","import 'css-chunk:src/charts/geo-chart/geo-chart.module.scss';export default {\n \"container\": \"a8ccharts-JvcqOz\"\n};"]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
withResponsive
|
|
3
|
+
} from "./chunk-TYIH5LMV.js";
|
|
4
|
+
import {
|
|
5
|
+
GlobalChartsContext,
|
|
6
|
+
GlobalChartsProvider,
|
|
7
|
+
useGlobalChartsContext
|
|
8
|
+
} from "./chunk-AWNCAKZY.js";
|
|
9
|
+
import {
|
|
10
|
+
lightenHexColor,
|
|
11
|
+
normalizeColorToHex,
|
|
12
|
+
resolveCssVariable
|
|
13
|
+
} from "./chunk-TE63Y5PX.js";
|
|
14
|
+
|
|
15
|
+
// src/charts/geo-chart/geo-chart.tsx
|
|
16
|
+
import { __ } from "@wordpress/i18n";
|
|
17
|
+
import clsx from "clsx";
|
|
18
|
+
import { useContext, useMemo } from "react";
|
|
19
|
+
import { Chart } from "react-google-charts";
|
|
20
|
+
|
|
21
|
+
// src/charts/geo-chart/geo-chart.module.scss
|
|
22
|
+
var geo_chart_module_default = {
|
|
23
|
+
"container": "a8ccharts-JvcqOz"
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/charts/geo-chart/geo-chart.tsx
|
|
27
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
var DEFAULT_FEATURE_FILL_COLOR = "#ffffff";
|
|
29
|
+
var DEFAULT_BACKGROUND_COLOR = "#ffffff";
|
|
30
|
+
var GeoChartInternal = ({
|
|
31
|
+
className,
|
|
32
|
+
data,
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
region = "world",
|
|
36
|
+
resolution = "countries",
|
|
37
|
+
renderPlaceholder
|
|
38
|
+
}) => {
|
|
39
|
+
const {
|
|
40
|
+
getElementStyles,
|
|
41
|
+
theme: {
|
|
42
|
+
geoChart: {
|
|
43
|
+
featureFillColor
|
|
44
|
+
},
|
|
45
|
+
backgroundColor
|
|
46
|
+
}
|
|
47
|
+
} = useGlobalChartsContext();
|
|
48
|
+
const loadingPlaceholder = /* @__PURE__ */ _jsx("div", {
|
|
49
|
+
className: clsx("geo-chart", geo_chart_module_default.container, className),
|
|
50
|
+
style: {
|
|
51
|
+
width,
|
|
52
|
+
height
|
|
53
|
+
},
|
|
54
|
+
children: renderPlaceholder ? renderPlaceholder() : __("Loading map", "jetpack-charts")
|
|
55
|
+
});
|
|
56
|
+
const fullColorHex = getElementStyles({
|
|
57
|
+
index: 0
|
|
58
|
+
}).color;
|
|
59
|
+
const lightColorHex = lightenHexColor(fullColorHex, 0.8);
|
|
60
|
+
const backgroundColorHex = normalizeColorToHex(backgroundColor, null, resolveCssVariable) || DEFAULT_BACKGROUND_COLOR;
|
|
61
|
+
const defaultFillColorHex = normalizeColorToHex(featureFillColor, null, resolveCssVariable) || DEFAULT_FEATURE_FILL_COLOR;
|
|
62
|
+
const hasHtmlTooltips = useMemo(() => data.length > 0 && data[0].some((col) => typeof col === "object" && col !== null && "role" in col && col.role === "tooltip" && "p" in col && typeof col.p === "object" && col.p !== null && "html" in col.p && col.p.html === true), [data]);
|
|
63
|
+
const options = useMemo(() => ({
|
|
64
|
+
...region !== "world" && {
|
|
65
|
+
region
|
|
66
|
+
},
|
|
67
|
+
...resolution !== "countries" && {
|
|
68
|
+
resolution
|
|
69
|
+
},
|
|
70
|
+
colorAxis: {
|
|
71
|
+
colors: [lightColorHex, fullColorHex]
|
|
72
|
+
},
|
|
73
|
+
backgroundColor: backgroundColorHex,
|
|
74
|
+
datalessRegionColor: defaultFillColorHex,
|
|
75
|
+
defaultColor: defaultFillColorHex,
|
|
76
|
+
tooltip: {
|
|
77
|
+
trigger: "focus",
|
|
78
|
+
isHtml: hasHtmlTooltips
|
|
79
|
+
},
|
|
80
|
+
legend: "none",
|
|
81
|
+
keepAspectRatio: true
|
|
82
|
+
}), [region, resolution, lightColorHex, fullColorHex, backgroundColorHex, defaultFillColorHex, hasHtmlTooltips]);
|
|
83
|
+
return /* @__PURE__ */ _jsx("div", {
|
|
84
|
+
className: clsx("geo-chart", geo_chart_module_default.container, className),
|
|
85
|
+
style: {
|
|
86
|
+
width,
|
|
87
|
+
height,
|
|
88
|
+
backgroundColor
|
|
89
|
+
},
|
|
90
|
+
children: /* @__PURE__ */ _jsx(Chart, {
|
|
91
|
+
chartType: "GeoChart",
|
|
92
|
+
width,
|
|
93
|
+
height,
|
|
94
|
+
data,
|
|
95
|
+
options,
|
|
96
|
+
loader: loadingPlaceholder
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
var GeoChartWithProvider = (props) => {
|
|
101
|
+
const existingContext = useContext(GlobalChartsContext);
|
|
102
|
+
if (existingContext) {
|
|
103
|
+
return /* @__PURE__ */ _jsx(GeoChartInternal, {
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return /* @__PURE__ */ _jsx(GlobalChartsProvider, {
|
|
108
|
+
children: /* @__PURE__ */ _jsx(GeoChartInternal, {
|
|
109
|
+
...props
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
GeoChartWithProvider.displayName = "GeoChart";
|
|
114
|
+
var GeoChartResponsive = withResponsive(GeoChartWithProvider);
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
GeoChartWithProvider,
|
|
118
|
+
GeoChartResponsive
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=chunk-ZY4FXLMM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/charts/geo-chart/geo-chart.tsx","../src/charts/geo-chart/geo-chart.module.scss"],"sourcesContent":["/**\n * External dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport clsx from 'clsx';\nimport { useContext, useMemo } from 'react';\nimport { Chart } from 'react-google-charts';\n/**\n * Internal dependencies\n */\nimport { GlobalChartsContext, GlobalChartsProvider, useGlobalChartsContext } from '../../providers';\nimport { lightenHexColor, normalizeColorToHex } from '../../utils/color-utils';\nimport { resolveCssVariable } from '../../utils/resolve-css-var';\nimport { withResponsive } from '../private/with-responsive';\nimport styles from './geo-chart.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst DEFAULT_FEATURE_FILL_COLOR = '#ffffff';\nconst DEFAULT_BACKGROUND_COLOR = '#ffffff';\n\n/**\n * Renders a geographical chart using Google Charts GeoChart to visualize data.\n *\n * Supports the full Google Charts data format including custom tooltips, formatted values,\n * and multiple data columns for maximum flexibility.\n *\n * Locations can be identified by full name (e.g., 'United States', 'California') or codes\n * (e.g., 'US', 'US-CA'). Full names are recommended for better readability in tooltips.\n *\n * @param props - The props for the GeoChart component\n * @param props.data - Data in Google Charts format (array of arrays with headers)\n * @param props.width - Width of the chart in pixels\n * @param props.height - Height of the chart in pixels\n * @param props.region - Region to display ('world', 'US', or ISO 3166-1 alpha-2 code)\n * @param props.resolution - Resolution level ('countries', 'provinces', or 'metros')\n * @param props.className - Additional CSS class name for the chart container\n * @param props.renderPlaceholder - Optional render function for the loading placeholder\n * @return A React component displaying an interactive map with data visualization\n */\nconst GeoChartInternal = ({\n className,\n data,\n width,\n height,\n region = 'world',\n resolution = 'countries',\n renderPlaceholder\n}) => {\n const {\n getElementStyles,\n theme: {\n geoChart: {\n featureFillColor\n },\n backgroundColor\n }\n } = useGlobalChartsContext();\n\n // Render loading placeholder\n const loadingPlaceholder = /*#__PURE__*/_jsx(\"div\", {\n className: clsx('geo-chart', styles.container, className),\n style: {\n width,\n height\n },\n children: renderPlaceholder ? renderPlaceholder() : __('Loading map', 'jetpack-charts')\n });\n\n // Google charts doesn't accept CSS variables, so we need to convert them to hex colors\n const fullColorHex = getElementStyles({\n index: 0\n }).color;\n const lightColorHex = lightenHexColor(fullColorHex, 0.8);\n // Use normalizeColorToHex to ensure HSL/RGB values from CSS variables are converted to hex\n const backgroundColorHex = normalizeColorToHex(backgroundColor, null, resolveCssVariable) || DEFAULT_BACKGROUND_COLOR;\n const defaultFillColorHex = normalizeColorToHex(featureFillColor, null, resolveCssVariable) || DEFAULT_FEATURE_FILL_COLOR;\n\n // Check if data has HTML tooltips (column with role: 'tooltip' and p.html: true)\n const hasHtmlTooltips = useMemo(() => data.length > 0 && data[0].some(col => typeof col === 'object' && col !== null && 'role' in col && col.role === 'tooltip' && 'p' in col && typeof col.p === 'object' && col.p !== null && 'html' in col.p && col.p.html === true), [data]);\n const options = useMemo(() => ({\n ...(region !== 'world' && {\n region\n }),\n ...(resolution !== 'countries' && {\n resolution\n }),\n colorAxis: {\n colors: [lightColorHex, fullColorHex]\n },\n backgroundColor: backgroundColorHex,\n datalessRegionColor: defaultFillColorHex,\n defaultColor: defaultFillColorHex,\n tooltip: {\n trigger: 'focus',\n isHtml: hasHtmlTooltips\n },\n legend: 'none',\n keepAspectRatio: true\n }), [region, resolution, lightColorHex, fullColorHex, backgroundColorHex, defaultFillColorHex, hasHtmlTooltips]);\n return /*#__PURE__*/_jsx(\"div\", {\n className: clsx('geo-chart', styles.container, className),\n style: {\n width,\n height,\n backgroundColor\n },\n children: /*#__PURE__*/_jsx(Chart, {\n chartType: \"GeoChart\",\n width: width,\n height: height,\n data: data,\n options: options,\n loader: loadingPlaceholder\n })\n });\n};\nconst GeoChartWithProvider = props => {\n const existingContext = useContext(GlobalChartsContext);\n\n // If we're already in a GlobalChartsProvider context, don't create a new one\n if (existingContext) {\n return /*#__PURE__*/_jsx(GeoChartInternal, {\n ...props\n });\n }\n\n // Otherwise, create our own GlobalChartsProvider\n return /*#__PURE__*/_jsx(GlobalChartsProvider, {\n children: /*#__PURE__*/_jsx(GeoChartInternal, {\n ...props\n })\n });\n};\nGeoChartWithProvider.displayName = 'GeoChart';\nconst GeoChartResponsive = withResponsive(GeoChartWithProvider);\nexport { GeoChartResponsive as default, GeoChartWithProvider as GeoChartUnresponsive };","import 'css-chunk:src/charts/geo-chart/geo-chart.module.scss';export default {\n \"container\": \"a8ccharts-JvcqOz\"\n};"],"mappings":";;;;;;;;;;;;;;;AAGA,SAAS,UAAU;AACnB,OAAO,UAAU;AACjB,SAAS,YAAY,eAAe;AACpC,SAAS,aAAa;;;ACNwC,IAAO,2BAAQ;AAAA,EAC3E,aAAa;AACf;;;ADaA,SAAS,OAAO,YAAY;AAC5B,IAAM,6BAA6B;AACnC,IAAM,2BAA2B;AAqBjC,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AAAA,EACb;AACF,MAAM;AACJ,QAAM;AAAA,IACJ;AAAA,IACA,OAAO;AAAA,MACL,UAAU;AAAA,QACR;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,IAAI,uBAAuB;AAG3B,QAAM,qBAAkC,qBAAK,OAAO;AAAA,IAClD,WAAW,KAAK,aAAa,yBAAO,WAAW,SAAS;AAAA,IACxD,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACA,UAAU,oBAAoB,kBAAkB,IAAI,GAAG,eAAe,gBAAgB;AAAA,EACxF,CAAC;AAGD,QAAM,eAAe,iBAAiB;AAAA,IACpC,OAAO;AAAA,EACT,CAAC,EAAE;AACH,QAAM,gBAAgB,gBAAgB,cAAc,GAAG;AAEvD,QAAM,qBAAqB,oBAAoB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AAAA,EACH;AAGA,SAAoB,qBAAK,sBAAsB;AAAA,IAC7C,UAAuB,qBAAK,kBAAkB;AAAA,MAC5C,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;AACA,qBAAqB,cAAc;AACnC,IAAM,qBAAqB,eAAe,oBAAoB;","names":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkLSV7F26Bcjs = require('../../chunk-LSV7F26B.cjs');
|
|
5
5
|
require('../../chunk-ZVGEDXDP.cjs');
|
|
6
6
|
require('../../chunk-EMMSS5I5.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.Legend =
|
|
10
|
+
exports.Legend = _chunkLSV7F26Bcjs.Legend; exports.useChartLegendItems = _chunkLSV7F26Bcjs.useChartLegendItems;
|
|
11
11
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/* esbuild-sass-plugin:css-chunk:src/hooks/use-tooltip-portal-relocator.module.scss */
|
|
2
|
+
.a8ccharts-jCw5dQ {
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0;
|
|
5
|
+
left: 0;
|
|
6
|
+
width: 0;
|
|
7
|
+
height: 0;
|
|
8
|
+
overflow: visible;
|
|
9
|
+
z-index: 1;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
1
13
|
/* esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss */
|
|
2
14
|
.a8ccharts-AELBvX {
|
|
3
15
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss"],"sourcesContent":[".a8ccharts-AELBvX {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n}\n.a8ccharts-fX8uQe {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.a8ccharts-fX8uQe.a8ccharts-DEe0wg {\n align-items: flex-start;\n}\n.a8ccharts-fX8uQe.a8ccharts-WBKF9I {\n align-items: center;\n}\n.a8ccharts-fX8uQe.a8ccharts-JfwMng {\n align-items: flex-end;\n}\n.a8ccharts-8Y73Kh {\n position: relative;\n}\n.a8ccharts-8Y73Kh.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-8Y73Kh.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-8Y73Kh.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n.a8ccharts-TVM-IY {\n position: relative;\n}\n.a8ccharts-TVM-IY.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-TVM-IY.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-TVM-IY.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n\n.a8ccharts-Vflwq8 {\n display: flex;\n align-items: center;\n font-size: 0.875rem;\n}\n.a8ccharts-qGsavM {\n cursor: pointer;\n user-select: none;\n transition: opacity 0.2s ease;\n}\n.a8ccharts-qGsavM:hover {\n opacity: 0.8;\n}\n.a8ccharts-qGsavM:focus {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n border-radius: 4px;\n}\n.a8ccharts-qGsavM:focus:not(:focus-visible) {\n outline: none;\n}\n.a8ccharts-ZtDY-Q {\n opacity: 0.4;\n}\n.a8ccharts-ZtDY-Q .a8ccharts-2H65Kr {\n text-decoration: line-through;\n}\n\n.a8ccharts-2H65Kr {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n /* Text wrapping is handled at the text level, not the label container */\n}\n\n.a8ccharts-faSDBI {\n overflow-wrap: break-word;\n white-space: normal;\n hyphens: auto;\n}\n.a8ccharts-FISUIO {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 1;\n min-width: 0;\n}\n\n.a8ccharts-DTZlT- {\n font-weight: 500;\n flex-shrink: 0;\n}"],"mappings":";AAAA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,aAAW;AACX,OAAK;AACP;AACA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,OAAK;AACP;AACA,CALC,gBAKgB,CAAC;AAChB,eAAa;AACf;AACA,CARC,gBAQgB,CAAC;AAChB,eAAa;AACf;AACA,CAXC,gBAWgB,CAAC;AAChB,eAAa;AACf;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,gBAGgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CANC,gBAMgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CATC,gBASgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,gBAGgB,CAxBC;AAyBhB,mBAAiB;AACnB;AACA,CANC,gBAMgB,CAxBC;AAyBhB,mBAAiB;AACnB;AACA,CATC,gBASgB,CAxBC;AAyBhB,mBAAiB;AACnB;AAEA,CAAC;AACC,WAAS;AACT,eAAa;AACb,aAAW;AACb;AACA,CAAC;AACC,UAAQ;AACR,eAAa;AACb,cAAY,QAAQ,KAAK;AAC3B;AACA,CALC,gBAKgB;AACf,WAAS;AACX;AACA,CARC,gBAQgB;AACf,WAAS,IAAI,MAAM;AACnB,kBAAgB;AAChB,iBAAe;AACjB;AACA,CAbC,gBAagB,MAAM,KAAK;AAC1B,WAAS;AACX;AACA,CAAC;AACC,WAAS;AACX;AACA,CAHC,iBAGiB,CAAC;AACjB,mBAAiB;AACnB;AAEA,CAJmB;AAKjB,WAAS;AACT,eAAa;AACb,OAAK;AAEP;AAEA,CAAC;AACC,iBAAe;AACf,eAAa;AACb,WAAS;AACX;AACA,CAAC;AACC,eAAa;AACb,YAAU;AACV,iBAAe;AACf,eAAa;AACb,aAAW;AACb;AAEA,CAAC;AACC,eAAa;AACb,eAAa;AACf;","names":[]}
|
|
1
|
+
{"version":3,"sources":["esbuild-sass-plugin:css-chunk:src/hooks/use-tooltip-portal-relocator.module.scss","esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss"],"sourcesContent":[".a8ccharts-jCw5dQ {\n position: fixed;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n overflow: visible;\n z-index: 1;\n pointer-events: none;\n}",".a8ccharts-AELBvX {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n}\n.a8ccharts-fX8uQe {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.a8ccharts-fX8uQe.a8ccharts-DEe0wg {\n align-items: flex-start;\n}\n.a8ccharts-fX8uQe.a8ccharts-WBKF9I {\n align-items: center;\n}\n.a8ccharts-fX8uQe.a8ccharts-JfwMng {\n align-items: flex-end;\n}\n.a8ccharts-8Y73Kh {\n position: relative;\n}\n.a8ccharts-8Y73Kh.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-8Y73Kh.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-8Y73Kh.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n.a8ccharts-TVM-IY {\n position: relative;\n}\n.a8ccharts-TVM-IY.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-TVM-IY.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-TVM-IY.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n\n.a8ccharts-Vflwq8 {\n display: flex;\n align-items: center;\n font-size: 0.875rem;\n}\n.a8ccharts-qGsavM {\n cursor: pointer;\n user-select: none;\n transition: opacity 0.2s ease;\n}\n.a8ccharts-qGsavM:hover {\n opacity: 0.8;\n}\n.a8ccharts-qGsavM:focus {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n border-radius: 4px;\n}\n.a8ccharts-qGsavM:focus:not(:focus-visible) {\n outline: none;\n}\n.a8ccharts-ZtDY-Q {\n opacity: 0.4;\n}\n.a8ccharts-ZtDY-Q .a8ccharts-2H65Kr {\n text-decoration: line-through;\n}\n\n.a8ccharts-2H65Kr {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n /* Text wrapping is handled at the text level, not the label container */\n}\n\n.a8ccharts-faSDBI {\n overflow-wrap: break-word;\n white-space: normal;\n hyphens: auto;\n}\n.a8ccharts-FISUIO {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 1;\n min-width: 0;\n}\n\n.a8ccharts-DTZlT- {\n font-weight: 500;\n flex-shrink: 0;\n}"],"mappings":";AAAA,CAAC;AACC,YAAU;AACV,OAAK;AACL,QAAM;AACN,SAAO;AACP,UAAQ;AACR,YAAU;AACV,WAAS;AACT,kBAAgB;AAClB;;;ACTA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,aAAW;AACX,OAAK;AACP;AACA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,OAAK;AACP;AACA,CALC,gBAKgB,CAAC;AAChB,eAAa;AACf;AACA,CARC,gBAQgB,CAAC;AAChB,eAAa;AACf;AACA,CAXC,gBAWgB,CAAC;AAChB,eAAa;AACf;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,gBAGgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CANC,gBAMgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CATC,gBASgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,gBAGgB,CAxBC;AAyBhB,mBAAiB;AACnB;AACA,CANC,gBAMgB,CAxBC;AAyBhB,mBAAiB;AACnB;AACA,CATC,gBASgB,CAxBC;AAyBhB,mBAAiB;AACnB;AAEA,CAAC;AACC,WAAS;AACT,eAAa;AACb,aAAW;AACb;AACA,CAAC;AACC,UAAQ;AACR,eAAa;AACb,cAAY,QAAQ,KAAK;AAC3B;AACA,CALC,gBAKgB;AACf,WAAS;AACX;AACA,CARC,gBAQgB;AACf,WAAS,IAAI,MAAM;AACnB,kBAAgB;AAChB,iBAAe;AACjB;AACA,CAbC,gBAagB,MAAM,KAAK;AAC1B,WAAS;AACX;AACA,CAAC;AACC,WAAS;AACX;AACA,CAHC,iBAGiB,CAAC;AACjB,mBAAiB;AACnB;AAEA,CAJmB;AAKjB,WAAS;AACT,eAAa;AACb,OAAK;AAEP;AAEA,CAAC;AACC,iBAAe;AACf,eAAa;AACb,WAAS;AACX;AACA,CAAC;AACC,eAAa;AACb,YAAU;AACV,iBAAe;AACf,eAAa;AACb,aAAW;AACb;AAEA,CAAC;AACC,eAAa;AACb,eAAa;AACf;","names":[]}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkY3NNQMAXcjs = require('../../chunk-Y3NNQMAX.cjs');
|
|
6
6
|
require('../../chunk-EMMSS5I5.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.AccessibleTooltip =
|
|
11
|
+
exports.AccessibleTooltip = _chunkY3NNQMAXcjs.AccessibleTooltip; exports.BaseTooltip = _chunkY3NNQMAXcjs.BaseTooltip; exports.useKeyboardNavigation = _chunkY3NNQMAXcjs.useKeyboardNavigation;
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkI2276W3Icjs = require('../../chunk-I2276W3I.cjs');
|
|
4
4
|
require('../../chunk-EMMSS5I5.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
exports.TrendIndicator =
|
|
7
|
+
exports.TrendIndicator = _chunkI2276W3Icjs.TrendIndicator;
|
|
8
8
|
//# sourceMappingURL=index.cjs.map
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
var _chunkLSV7F26Bcjs = require('../chunk-LSV7F26B.cjs');
|
|
14
15
|
require('../chunk-ZVGEDXDP.cjs');
|
|
15
16
|
require('../chunk-EMMSS5I5.cjs');
|
|
16
17
|
|
|
@@ -25,5 +26,6 @@ require('../chunk-EMMSS5I5.cjs');
|
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
exports.useChartDataTransform = _chunkLSV7F26Bcjs.useChartDataTransform; exports.useChartMargin = _chunkLSV7F26Bcjs.useChartMargin; exports.useChartMouseHandler = _chunkLSV7F26Bcjs.useChartMouseHandler; exports.useDeepMemo = _chunkLSV7F26Bcjs.useDeepMemo; exports.useElementHeight = _chunkLSV7F26Bcjs.useElementHeight; exports.useHasLegendChild = _chunkLSV7F26Bcjs.useHasLegendChild; exports.useInteractiveLegendData = _chunkLSV7F26Bcjs.useInteractiveLegendData; exports.usePrefersReducedMotion = _chunkLSV7F26Bcjs.usePrefersReducedMotion; exports.useTextTruncation = _chunkLSV7F26Bcjs.useTextTruncation; exports.useTooltipPortalRelocator = _chunkLSV7F26Bcjs.useTooltipPortalRelocator; exports.useXYChartTheme = _chunkLSV7F26Bcjs.useXYChartTheme; exports.useZeroValueDisplay = _chunkLSV7F26Bcjs.useZeroValueDisplay;
|
|
29
31
|
//# sourceMappingURL=index.cjs.map
|
package/dist/hooks/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/hooks/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/hooks/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,+yBAAC","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/hooks/index.cjs"}
|
package/dist/hooks/index.css
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/* esbuild-sass-plugin:css-chunk:src/hooks/use-tooltip-portal-relocator.module.scss */
|
|
2
|
+
.a8ccharts-jCw5dQ {
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0;
|
|
5
|
+
left: 0;
|
|
6
|
+
width: 0;
|
|
7
|
+
height: 0;
|
|
8
|
+
overflow: visible;
|
|
9
|
+
z-index: 1;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
1
13
|
/* esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss */
|
|
2
14
|
.a8ccharts-AELBvX {
|
|
3
15
|
display: flex;
|
package/dist/hooks/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss"],"sourcesContent":[".a8ccharts-AELBvX {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n}\n.a8ccharts-fX8uQe {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.a8ccharts-fX8uQe.a8ccharts-DEe0wg {\n align-items: flex-start;\n}\n.a8ccharts-fX8uQe.a8ccharts-WBKF9I {\n align-items: center;\n}\n.a8ccharts-fX8uQe.a8ccharts-JfwMng {\n align-items: flex-end;\n}\n.a8ccharts-8Y73Kh {\n position: relative;\n}\n.a8ccharts-8Y73Kh.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-8Y73Kh.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-8Y73Kh.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n.a8ccharts-TVM-IY {\n position: relative;\n}\n.a8ccharts-TVM-IY.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-TVM-IY.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-TVM-IY.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n\n.a8ccharts-Vflwq8 {\n display: flex;\n align-items: center;\n font-size: 0.875rem;\n}\n.a8ccharts-qGsavM {\n cursor: pointer;\n user-select: none;\n transition: opacity 0.2s ease;\n}\n.a8ccharts-qGsavM:hover {\n opacity: 0.8;\n}\n.a8ccharts-qGsavM:focus {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n border-radius: 4px;\n}\n.a8ccharts-qGsavM:focus:not(:focus-visible) {\n outline: none;\n}\n.a8ccharts-ZtDY-Q {\n opacity: 0.4;\n}\n.a8ccharts-ZtDY-Q .a8ccharts-2H65Kr {\n text-decoration: line-through;\n}\n\n.a8ccharts-2H65Kr {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n /* Text wrapping is handled at the text level, not the label container */\n}\n\n.a8ccharts-faSDBI {\n overflow-wrap: break-word;\n white-space: normal;\n hyphens: auto;\n}\n.a8ccharts-FISUIO {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 1;\n min-width: 0;\n}\n\n.a8ccharts-DTZlT- {\n font-weight: 500;\n flex-shrink: 0;\n}"],"mappings":";AAAA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,aAAW;AACX,OAAK;AACP;AACA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,OAAK;AACP;AACA,CALC,gBAKgB,CAAC;AAChB,eAAa;AACf;AACA,CARC,gBAQgB,CAAC;AAChB,eAAa;AACf;AACA,CAXC,gBAWgB,CAAC;AAChB,eAAa;AACf;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,gBAGgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CANC,gBAMgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CATC,gBASgB,CAZC;AAahB,mBAAiB;AACnB;AACA,CAAC;AACC,YAAU;AACZ;AACA,CAHC,gBAGgB,CAxBC;AAyBhB,mBAAiB;AACnB;AACA,CANC,gBAMgB,CAxBC;AAyBhB,mBAAiB;AACnB;AACA,CATC,gBASgB,CAxBC;AAyBhB,mBAAiB;AACnB;AAEA,CAAC;AACC,WAAS;AACT,eAAa;AACb,aAAW;AACb;AACA,CAAC;AACC,UAAQ;AACR,eAAa;AACb,cAAY,QAAQ,KAAK;AAC3B;AACA,CALC,gBAKgB;AACf,WAAS;AACX;AACA,CARC,gBAQgB;AACf,WAAS,IAAI,MAAM;AACnB,kBAAgB;AAChB,iBAAe;AACjB;AACA,CAbC,gBAagB,MAAM,KAAK;AAC1B,WAAS;AACX;AACA,CAAC;AACC,WAAS;AACX;AACA,CAHC,iBAGiB,CAAC;AACjB,mBAAiB;AACnB;AAEA,CAJmB;AAKjB,WAAS;AACT,eAAa;AACb,OAAK;AAEP;AAEA,CAAC;AACC,iBAAe;AACf,eAAa;AACb,WAAS;AACX;AACA,CAAC;AACC,eAAa;AACb,YAAU;AACV,iBAAe;AACf,eAAa;AACb,aAAW;AACb;AAEA,CAAC;AACC,eAAa;AACb,eAAa;AACf;","names":[]}
|
|
1
|
+
{"version":3,"sources":["esbuild-sass-plugin:css-chunk:src/hooks/use-tooltip-portal-relocator.module.scss","esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss"],"sourcesContent":[".a8ccharts-jCw5dQ {\n position: fixed;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n overflow: visible;\n z-index: 1;\n pointer-events: none;\n}",".a8ccharts-AELBvX {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 16px;\n}\n.a8ccharts-fX8uQe {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.a8ccharts-fX8uQe.a8ccharts-DEe0wg {\n align-items: flex-start;\n}\n.a8ccharts-fX8uQe.a8ccharts-WBKF9I {\n align-items: center;\n}\n.a8ccharts-fX8uQe.a8ccharts-JfwMng {\n align-items: flex-end;\n}\n.a8ccharts-8Y73Kh {\n position: relative;\n}\n.a8ccharts-8Y73Kh.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-8Y73Kh.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-8Y73Kh.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n.a8ccharts-TVM-IY {\n position: relative;\n}\n.a8ccharts-TVM-IY.a8ccharts-DEe0wg {\n justify-content: flex-start;\n}\n.a8ccharts-TVM-IY.a8ccharts-WBKF9I {\n justify-content: center;\n}\n.a8ccharts-TVM-IY.a8ccharts-JfwMng {\n justify-content: flex-end;\n}\n\n.a8ccharts-Vflwq8 {\n display: flex;\n align-items: center;\n font-size: 0.875rem;\n}\n.a8ccharts-qGsavM {\n cursor: pointer;\n user-select: none;\n transition: opacity 0.2s ease;\n}\n.a8ccharts-qGsavM:hover {\n opacity: 0.8;\n}\n.a8ccharts-qGsavM:focus {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n border-radius: 4px;\n}\n.a8ccharts-qGsavM:focus:not(:focus-visible) {\n outline: none;\n}\n.a8ccharts-ZtDY-Q {\n opacity: 0.4;\n}\n.a8ccharts-ZtDY-Q .a8ccharts-2H65Kr {\n text-decoration: line-through;\n}\n\n.a8ccharts-2H65Kr {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n /* Text wrapping is handled at the text level, not the label container */\n}\n\n.a8ccharts-faSDBI {\n overflow-wrap: break-word;\n white-space: normal;\n hyphens: auto;\n}\n.a8ccharts-FISUIO {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex-shrink: 1;\n min-width: 0;\n}\n\n.a8ccharts-DTZlT- {\n font-weight: 500;\n flex-shrink: 0;\n}"],"mappings":";AAAA,CAAC;AAC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}
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent, ReactNode } from 'react';
|
|
1
|
+
import { MouseEvent, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { D as DataPoint, j as SeriesData, k as SeriesDataOptions, B as BaseChartProps, c as DataPointDate } from '../types-BCFQlzTM.cjs';
|
|
3
3
|
import * as _visx_xychart from '@visx/xychart';
|
|
4
4
|
import { XYChartTheme } from '@visx/xychart';
|
|
@@ -236,4 +236,30 @@ declare const useInteractiveLegendData: <T extends DataPointWithPercentage>({ da
|
|
|
236
236
|
*/
|
|
237
237
|
declare function usePrefersReducedMotion(): boolean;
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Relocates visx chart tooltip portals from `document.body` into a target
|
|
241
|
+
* container element. This allows the tooltips to participate in the same CSS
|
|
242
|
+
* stacking context as other elements in the container (e.g. a sticky header),
|
|
243
|
+
* so z-index ordering works correctly between them.
|
|
244
|
+
*
|
|
245
|
+
* The relocated portal divs use `position: fixed` at the viewport origin to
|
|
246
|
+
* preserve the tooltip coordinate system (visx calculates positions relative
|
|
247
|
+
* to the viewport).
|
|
248
|
+
*
|
|
249
|
+
* Because the visx Portal class calls `document.body.removeChild(node)` during
|
|
250
|
+
* unmount, we patch `document.body.removeChild` to gracefully handle nodes that
|
|
251
|
+
* were moved out of body. Without this, React throws a "not a child of this
|
|
252
|
+
* node" error when tooltips unmount.
|
|
253
|
+
*
|
|
254
|
+
* **Important:** The container and its ancestors must not have CSS `transform`,
|
|
255
|
+
* `perspective`, or `filter` properties set, as these create a new containing
|
|
256
|
+
* block for `position: fixed` children, breaking viewport-relative positioning.
|
|
257
|
+
*
|
|
258
|
+
* @param containerRef - Ref to the element that portals should be relocated into.
|
|
259
|
+
* The element referenced here, or one of its ancestors,
|
|
260
|
+
* should establish the desired stacking context (for example
|
|
261
|
+
* by using position and z-index).
|
|
262
|
+
*/
|
|
263
|
+
declare function useTooltipPortalRelocator(containerRef: RefObject<HTMLElement | null> | undefined): void;
|
|
264
|
+
|
|
265
|
+
export { useChartDataTransform, useChartMargin, useChartMouseHandler, useDeepMemo, useElementHeight, useHasLegendChild, useInteractiveLegendData, usePrefersReducedMotion, useTextTruncation, useTooltipPortalRelocator, useXYChartTheme, useZeroValueDisplay };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent, ReactNode } from 'react';
|
|
1
|
+
import { MouseEvent, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { D as DataPoint, j as SeriesData, k as SeriesDataOptions, B as BaseChartProps, c as DataPointDate } from '../types-BCFQlzTM.js';
|
|
3
3
|
import * as _visx_xychart from '@visx/xychart';
|
|
4
4
|
import { XYChartTheme } from '@visx/xychart';
|
|
@@ -236,4 +236,30 @@ declare const useInteractiveLegendData: <T extends DataPointWithPercentage>({ da
|
|
|
236
236
|
*/
|
|
237
237
|
declare function usePrefersReducedMotion(): boolean;
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Relocates visx chart tooltip portals from `document.body` into a target
|
|
241
|
+
* container element. This allows the tooltips to participate in the same CSS
|
|
242
|
+
* stacking context as other elements in the container (e.g. a sticky header),
|
|
243
|
+
* so z-index ordering works correctly between them.
|
|
244
|
+
*
|
|
245
|
+
* The relocated portal divs use `position: fixed` at the viewport origin to
|
|
246
|
+
* preserve the tooltip coordinate system (visx calculates positions relative
|
|
247
|
+
* to the viewport).
|
|
248
|
+
*
|
|
249
|
+
* Because the visx Portal class calls `document.body.removeChild(node)` during
|
|
250
|
+
* unmount, we patch `document.body.removeChild` to gracefully handle nodes that
|
|
251
|
+
* were moved out of body. Without this, React throws a "not a child of this
|
|
252
|
+
* node" error when tooltips unmount.
|
|
253
|
+
*
|
|
254
|
+
* **Important:** The container and its ancestors must not have CSS `transform`,
|
|
255
|
+
* `perspective`, or `filter` properties set, as these create a new containing
|
|
256
|
+
* block for `position: fixed` children, breaking viewport-relative positioning.
|
|
257
|
+
*
|
|
258
|
+
* @param containerRef - Ref to the element that portals should be relocated into.
|
|
259
|
+
* The element referenced here, or one of its ancestors,
|
|
260
|
+
* should establish the desired stacking context (for example
|
|
261
|
+
* by using position and z-index).
|
|
262
|
+
*/
|
|
263
|
+
declare function useTooltipPortalRelocator(containerRef: RefObject<HTMLElement | null> | undefined): void;
|
|
264
|
+
|
|
265
|
+
export { useChartDataTransform, useChartMargin, useChartMouseHandler, useDeepMemo, useElementHeight, useHasLegendChild, useInteractiveLegendData, usePrefersReducedMotion, useTextTruncation, useTooltipPortalRelocator, useXYChartTheme, useZeroValueDisplay };
|
package/dist/hooks/index.js
CHANGED
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
useInteractiveLegendData,
|
|
9
9
|
usePrefersReducedMotion,
|
|
10
10
|
useTextTruncation,
|
|
11
|
+
useTooltipPortalRelocator,
|
|
11
12
|
useXYChartTheme,
|
|
12
13
|
useZeroValueDisplay
|
|
13
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-AWNCAKZY.js";
|
|
14
15
|
import "../chunk-TE63Y5PX.js";
|
|
15
16
|
import "../chunk-G3PMV62Z.js";
|
|
16
17
|
export {
|
|
@@ -23,6 +24,7 @@ export {
|
|
|
23
24
|
useInteractiveLegendData,
|
|
24
25
|
usePrefersReducedMotion,
|
|
25
26
|
useTextTruncation,
|
|
27
|
+
useTooltipPortalRelocator,
|
|
26
28
|
useXYChartTheme,
|
|
27
29
|
useZeroValueDisplay
|
|
28
30
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkHNEG3EFJcjs = require('./chunk-HNEG3EFJ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk4YYROZDJcjs = require('./chunk-4YYROZDJ.cjs');
|
|
9
9
|
require('./chunk-7OZEQ5HE.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
require('./chunk-
|
|
15
|
-
require('./chunk-
|
|
13
|
+
var _chunkRSYD434Gcjs = require('./chunk-RSYD434G.cjs');
|
|
14
|
+
require('./chunk-2A34OA5O.cjs');
|
|
15
|
+
require('./chunk-RCY6XLGU.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkGBDFC74Ucjs = require('./chunk-GBDFC74U.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunk66BXSWMWcjs = require('./chunk-66BXSWMW.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunkI2276W3Icjs = require('./chunk-I2276W3I.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _chunk5N77S5N3cjs = require('./chunk-5N77S5N3.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
35
|
-
require('./chunk-SH32YSZO.cjs');
|
|
36
|
-
require('./chunk-I5467ZJ5.cjs');
|
|
34
|
+
var _chunkCERFRCXDcjs = require('./chunk-CERFRCXD.cjs');
|
|
37
35
|
|
|
38
36
|
|
|
39
|
-
var
|
|
37
|
+
var _chunkY3NNQMAXcjs = require('./chunk-Y3NNQMAX.cjs');
|
|
40
38
|
|
|
41
39
|
|
|
42
|
-
var
|
|
40
|
+
var _chunkKMYJJTSRcjs = require('./chunk-KMYJJTSR.cjs');
|
|
41
|
+
require('./chunk-SH32YSZO.cjs');
|
|
42
|
+
require('./chunk-I5467ZJ5.cjs');
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var
|
|
47
|
-
require('./chunk-
|
|
46
|
+
var _chunkZXEFMKVPcjs = require('./chunk-ZXEFMKVP.cjs');
|
|
47
|
+
require('./chunk-7QDEU3KN.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
@@ -53,7 +53,7 @@ require('./chunk-NW3RUYK2.cjs');
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
var
|
|
56
|
+
var _chunkLSV7F26Bcjs = require('./chunk-LSV7F26B.cjs');
|
|
57
57
|
require('./chunk-ZVGEDXDP.cjs');
|
|
58
58
|
require('./chunk-EMMSS5I5.cjs');
|
|
59
59
|
|
|
@@ -84,5 +84,5 @@ require('./chunk-EMMSS5I5.cjs');
|
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
exports.BarChart =
|
|
87
|
+
exports.BarChart = _chunkCERFRCXDcjs.BarChartResponsive; exports.BarChartUnresponsive = _chunkCERFRCXDcjs.BarChart; exports.BarListChart = _chunk5N77S5N3cjs.BarListChartResponsive; exports.BarListChartUnresponsive = _chunk5N77S5N3cjs.BarListChart; exports.BaseTooltip = _chunkY3NNQMAXcjs.BaseTooltip; exports.ConversionFunnelChart = _chunkKMYJJTSRcjs.ConversionFunnelChartWithProvider; exports.GeoChart = _chunkZXEFMKVPcjs.GeoChartResponsive; exports.GeoChartUnresponsive = _chunkZXEFMKVPcjs.GeoChartWithProvider; exports.GlobalChartsContext = _chunkLSV7F26Bcjs.GlobalChartsContext; exports.GlobalChartsProvider = _chunkLSV7F26Bcjs.GlobalChartsProvider; exports.LeaderboardChart = _chunkHNEG3EFJcjs.LeaderboardChartResponsive; exports.LeaderboardChartUnresponsive = _chunkHNEG3EFJcjs.LeaderboardChart; exports.Legend = _chunkLSV7F26Bcjs.Legend; exports.LineChart = _chunk66BXSWMWcjs.LineChartResponsive; exports.LineChartUnresponsive = _chunk66BXSWMWcjs.LineChart; exports.PieChart = _chunk4YYROZDJcjs.PieChartResponsive; exports.PieChartUnresponsive = _chunk4YYROZDJcjs.PieChart; exports.PieSemiCircleChart = _chunkRSYD434Gcjs.PieSemiCircleChartResponsive; exports.PieSemiCircleChartUnresponsive = _chunkRSYD434Gcjs.PieSemiCircleChart; exports.Sparkline = _chunkGBDFC74Ucjs.Sparkline; exports.SparklineUnresponsive = _chunkGBDFC74Ucjs.SparklineUnresponsive; exports.ThemeProvider = _chunkLSV7F26Bcjs.GlobalChartsProvider; exports.TrendIndicator = _chunkI2276W3Icjs.TrendIndicator; exports.defaultTheme = _chunkLSV7F26Bcjs.defaultTheme; exports.useChartLegendItems = _chunkLSV7F26Bcjs.useChartLegendItems; exports.useGlobalChartsContext = _chunkLSV7F26Bcjs.useGlobalChartsContext; exports.useGlobalChartsTheme = _chunkLSV7F26Bcjs.useGlobalChartsTheme;
|
|
88
88
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,utDAAC","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/index.cjs"}
|
package/dist/index.css
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/* esbuild-sass-plugin:css-chunk:src/hooks/use-tooltip-portal-relocator.module.scss */
|
|
2
|
+
.a8ccharts-jCw5dQ {
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0;
|
|
5
|
+
left: 0;
|
|
6
|
+
width: 0;
|
|
7
|
+
height: 0;
|
|
8
|
+
overflow: visible;
|
|
9
|
+
z-index: 1;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
1
13
|
/* esbuild-sass-plugin:css-chunk:src/components/legend/private/base-legend.module.scss */
|
|
2
14
|
.a8ccharts-AELBvX {
|
|
3
15
|
display: flex;
|
|
@@ -182,7 +194,8 @@
|
|
|
182
194
|
display: flex;
|
|
183
195
|
gap: 16px;
|
|
184
196
|
align-items: flex-end;
|
|
185
|
-
|
|
197
|
+
flex: 1;
|
|
198
|
+
min-height: 200px;
|
|
186
199
|
width: 100%;
|
|
187
200
|
}
|
|
188
201
|
.a8ccharts-VqFY0l {
|