@automattic/charts 1.0.0 → 1.0.2
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 +22 -0
- package/dist/index.cjs +174 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +9 -13
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +174 -63
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +7 -16
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.tsx +18 -5
- package/src/charts/conversion-funnel-chart/test/conversion-funnel-chart.test.tsx +11 -0
- package/src/charts/geo-chart/geo-chart.tsx +48 -21
- package/src/charts/geo-chart/test/geo-chart.test.tsx +48 -10
- package/src/charts/private/chart-layout/chart-layout.module.scss +8 -0
- package/src/providers/chart-context/global-charts-provider.tsx +26 -19
- package/src/providers/chart-context/test/chart-context.test.tsx +175 -3
- package/src/providers/chart-context/types.ts +1 -0
- package/src/utils/color-utils.ts +23 -12
- package/src/utils/sanitize-html.ts +49 -0
- package/src/utils/test/color-utils.test.ts +110 -0
- package/src/utils/test/sanitize-html.test.ts +101 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.2] - 2026-04-06
|
|
9
|
+
### Changed
|
|
10
|
+
- Conversion Funnel Chart: Rename non-BEM classnames to BEM modifiers. [#47854]
|
|
11
|
+
- Update package dependencies. [#47870] [#47886]
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- Fix conversion funnel chart color flicker on initial render by deferring CSS transitions until the color palette is resolved. [#47851]
|
|
15
|
+
|
|
16
|
+
## [1.0.1] - 2026-03-30
|
|
17
|
+
### Security
|
|
18
|
+
- Sanitize GeoChart HTML tooltip content with DOMPurify. [#47789]
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Bump minimum Node version to 20.11. [#47770]
|
|
22
|
+
- Support all CSS color formats (HSL, HSLA, RGB, RGBA, named colors) in theme colors. [#46349]
|
|
23
|
+
- Update package dependencies. [#47799]
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- ChartLayout: Display SVG as block to avoid unexpected resizing in certain browser environments. [#47802]
|
|
27
|
+
|
|
8
28
|
## [1.0.0] - 2026-03-24
|
|
9
29
|
### Changed
|
|
10
30
|
- Internal updates. [#43811]
|
|
@@ -764,6 +784,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
764
784
|
- Fixed lints following ESLint rule changes for TS [#40584]
|
|
765
785
|
- Fixing a bug in Chart storybook data. [#40640]
|
|
766
786
|
|
|
787
|
+
[1.0.2]: https://github.com/Automattic/charts/compare/v1.0.1...v1.0.2
|
|
788
|
+
[1.0.1]: https://github.com/Automattic/charts/compare/v1.0.0...v1.0.1
|
|
767
789
|
[1.0.0]: https://github.com/Automattic/charts/compare/v0.59.0...v1.0.0
|
|
768
790
|
[0.59.0]: https://github.com/Automattic/charts/compare/v0.58.0...v0.59.0
|
|
769
791
|
[0.58.0]: https://github.com/Automattic/charts/compare/v0.57.0...v0.58.0
|
package/dist/index.cjs
CHANGED
|
@@ -993,7 +993,7 @@ var parseRgbString = (rgbString) => {
|
|
|
993
993
|
}
|
|
994
994
|
return parsed.formatHex();
|
|
995
995
|
};
|
|
996
|
-
var normalizeColorToHex = (color, element, resolveCss) => {
|
|
996
|
+
var normalizeColorToHex = (color, element, resolveCss, _depth = 0) => {
|
|
997
997
|
if (!color || typeof color !== "string") {
|
|
998
998
|
return "";
|
|
999
999
|
}
|
|
@@ -1010,22 +1010,23 @@ var normalizeColorToHex = (color, element, resolveCss) => {
|
|
|
1010
1010
|
if (trimmed.startsWith("--") || trimmed.startsWith("var(")) {
|
|
1011
1011
|
if (resolveCss) {
|
|
1012
1012
|
const resolved = resolveCss(color, element);
|
|
1013
|
-
if (resolved) {
|
|
1014
|
-
return normalizeColorToHex(resolved, element, resolveCss);
|
|
1013
|
+
if (resolved && resolved !== color && _depth < 10) {
|
|
1014
|
+
return normalizeColorToHex(resolved, element, resolveCss, _depth + 1);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
1017
|
return color;
|
|
1018
1018
|
}
|
|
1019
|
-
if (trimmed.startsWith("hsl(") || trimmed.startsWith("rgb(")) {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
const parsed = _d3color.color.call(void 0, trimmed);
|
|
1024
|
-
if (parsed) {
|
|
1025
|
-
return parsed.formatHex();
|
|
1019
|
+
if (trimmed.startsWith("hsl(") || trimmed.startsWith("hsla(") || trimmed.startsWith("rgb(") || trimmed.startsWith("rgba(")) {
|
|
1020
|
+
const parsed2 = _d3color.color.call(void 0, trimmed);
|
|
1021
|
+
if (parsed2) {
|
|
1022
|
+
return parsed2.formatHex();
|
|
1026
1023
|
}
|
|
1027
1024
|
return color;
|
|
1028
1025
|
}
|
|
1026
|
+
const parsed = _d3color.color.call(void 0, trimmed);
|
|
1027
|
+
if (parsed) {
|
|
1028
|
+
return parsed.formatHex();
|
|
1029
|
+
}
|
|
1029
1030
|
return color;
|
|
1030
1031
|
};
|
|
1031
1032
|
var lightenHexColor = (hex, blend) => {
|
|
@@ -1262,7 +1263,9 @@ var GlobalChartsProvider = ({
|
|
|
1262
1263
|
minHue: 360,
|
|
1263
1264
|
maxHue: 0
|
|
1264
1265
|
}));
|
|
1266
|
+
const [isColorPaletteResolved, setIsColorPaletteResolved] = _react.useState.call(void 0, false);
|
|
1265
1267
|
_react.useLayoutEffect.call(void 0, () => {
|
|
1268
|
+
setIsColorPaletteResolved(false);
|
|
1266
1269
|
const {
|
|
1267
1270
|
colors
|
|
1268
1271
|
} = providerTheme;
|
|
@@ -1274,17 +1277,10 @@ var GlobalChartsProvider = ({
|
|
|
1274
1277
|
if (Array.isArray(colors)) {
|
|
1275
1278
|
for (const color of colors) {
|
|
1276
1279
|
if (color && typeof color === "string") {
|
|
1277
|
-
|
|
1278
|
-
if (
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
continue;
|
|
1282
|
-
}
|
|
1283
|
-
colorValue = resolved;
|
|
1284
|
-
}
|
|
1285
|
-
if (colorValue.startsWith("#")) {
|
|
1286
|
-
resolvedColors.push(colorValue);
|
|
1287
|
-
const hslColor = _d3color.hsl.call(void 0, colorValue);
|
|
1280
|
+
const normalizedColor = normalizeColorToHex(color, wrapperRef.current, resolveCssVariable);
|
|
1281
|
+
if (normalizedColor.startsWith("#")) {
|
|
1282
|
+
resolvedColors.push(normalizedColor);
|
|
1283
|
+
const hslColor = _d3color.hsl.call(void 0, normalizedColor);
|
|
1288
1284
|
if (!isNaN(hslColor.h)) {
|
|
1289
1285
|
const hslTuple = [hslColor.h, hslColor.s * 100, hslColor.l * 100];
|
|
1290
1286
|
hues.push(hslTuple[0]);
|
|
@@ -1304,6 +1300,11 @@ var GlobalChartsProvider = ({
|
|
|
1304
1300
|
maxHue
|
|
1305
1301
|
});
|
|
1306
1302
|
}, [providerTheme]);
|
|
1303
|
+
_react.useEffect.call(void 0, () => {
|
|
1304
|
+
if (colorCache.colors.length > 0) {
|
|
1305
|
+
setIsColorPaletteResolved(true);
|
|
1306
|
+
}
|
|
1307
|
+
}, [colorCache]);
|
|
1307
1308
|
const [groupToColorMap, setGroupToColorMap] = _react.useState.call(void 0, () => /* @__PURE__ */ new Map());
|
|
1308
1309
|
_react.useEffect.call(void 0, () => {
|
|
1309
1310
|
setGroupToColorMap(/* @__PURE__ */ new Map());
|
|
@@ -1383,8 +1384,8 @@ var GlobalChartsProvider = ({
|
|
|
1383
1384
|
return !chartHidden || !chartHidden.has(seriesLabel);
|
|
1384
1385
|
}, [hiddenSeries]);
|
|
1385
1386
|
const getHiddenSeries = _react.useCallback.call(void 0, (chartId) => {
|
|
1386
|
-
const
|
|
1387
|
-
return
|
|
1387
|
+
const set2 = hiddenSeries.get(chartId);
|
|
1388
|
+
return set2 ? new Set(set2) : /* @__PURE__ */ new Set();
|
|
1388
1389
|
}, [hiddenSeries]);
|
|
1389
1390
|
const value = _react.useMemo.call(void 0, () => ({
|
|
1390
1391
|
charts,
|
|
@@ -1395,8 +1396,9 @@ var GlobalChartsProvider = ({
|
|
|
1395
1396
|
getElementStyles,
|
|
1396
1397
|
toggleSeriesVisibility,
|
|
1397
1398
|
isSeriesVisible,
|
|
1398
|
-
getHiddenSeries
|
|
1399
|
-
|
|
1399
|
+
getHiddenSeries,
|
|
1400
|
+
isColorPaletteResolved
|
|
1401
|
+
}), [charts, registerChart, unregisterChart, getChartData, providerTheme, getElementStyles, toggleSeriesVisibility, isSeriesVisible, getHiddenSeries, isColorPaletteResolved]);
|
|
1400
1402
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GlobalChartsContext.Provider, {
|
|
1401
1403
|
value,
|
|
1402
1404
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
@@ -2422,7 +2424,7 @@ function useChartChildren(children, chartType) {
|
|
|
2422
2424
|
}, [children, chartType]);
|
|
2423
2425
|
}
|
|
2424
2426
|
|
|
2425
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
2427
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useRefWithInit.js
|
|
2426
2428
|
|
|
2427
2429
|
var UNINITIALIZED = {};
|
|
2428
2430
|
function useRefWithInit(init, initArg) {
|
|
@@ -2433,18 +2435,37 @@ function useRefWithInit(init, initArg) {
|
|
|
2433
2435
|
return ref;
|
|
2434
2436
|
}
|
|
2435
2437
|
|
|
2436
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2438
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/warn.js
|
|
2439
|
+
var set;
|
|
2440
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2441
|
+
set = /* @__PURE__ */ new Set();
|
|
2442
|
+
}
|
|
2443
|
+
function warn(...messages) {
|
|
2444
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2445
|
+
const messageKey = messages.join(" ");
|
|
2446
|
+
if (!set.has(messageKey)) {
|
|
2447
|
+
set.add(messageKey);
|
|
2448
|
+
console.warn(`Base UI: ${messageKey}`);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/formatErrorMessage.js
|
|
2454
|
+
function createFormatErrorMessage(baseUrl, prefix2) {
|
|
2455
|
+
return function formatErrorMessage2(code, ...args) {
|
|
2456
|
+
const url = new URL(baseUrl);
|
|
2457
|
+
url.searchParams.set("code", code.toString());
|
|
2458
|
+
args.forEach((arg) => url.searchParams.append("args[]", arg));
|
|
2459
|
+
return `${prefix2} error #${code}; visit ${url} for the full message.`;
|
|
2460
|
+
};
|
|
2442
2461
|
}
|
|
2462
|
+
var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
|
|
2463
|
+
var formatErrorMessage_default = formatErrorMessage;
|
|
2443
2464
|
|
|
2444
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
2465
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/useRenderElement.js
|
|
2445
2466
|
|
|
2446
2467
|
|
|
2447
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
2468
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/useMergedRefs.js
|
|
2448
2469
|
function useMergedRefs(a2, b2, c2, d2) {
|
|
2449
2470
|
const forkRef = useRefWithInit(createForkRef).current;
|
|
2450
2471
|
if (didChange(forkRef, a2, b2, c2, d2)) {
|
|
@@ -2533,17 +2554,17 @@ function update(forkRef, refs) {
|
|
|
2533
2554
|
};
|
|
2534
2555
|
}
|
|
2535
2556
|
|
|
2536
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
2557
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/getReactElementRef.js
|
|
2537
2558
|
|
|
2538
2559
|
|
|
2539
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
2560
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/reactVersion.js
|
|
2540
2561
|
|
|
2541
2562
|
var majorVersion = parseInt(React2.version, 10);
|
|
2542
2563
|
function isReactVersionAtLeast(reactVersionToCheck) {
|
|
2543
2564
|
return majorVersion >= reactVersionToCheck;
|
|
2544
2565
|
}
|
|
2545
2566
|
|
|
2546
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
2567
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/getReactElementRef.js
|
|
2547
2568
|
function getReactElementRef(element) {
|
|
2548
2569
|
if (!/* @__PURE__ */ React3.isValidElement(element)) {
|
|
2549
2570
|
return null;
|
|
@@ -2553,7 +2574,7 @@ function getReactElementRef(element) {
|
|
|
2553
2574
|
return _nullishCoalesce((isReactVersionAtLeast(19) ? _optionalChain([propsWithRef, 'optionalAccess', _114 => _114.ref]) : reactElement.ref), () => ( null));
|
|
2554
2575
|
}
|
|
2555
2576
|
|
|
2556
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
2577
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/mergeObjects.js
|
|
2557
2578
|
function mergeObjects(a2, b2) {
|
|
2558
2579
|
if (a2 && !b2) {
|
|
2559
2580
|
return a2;
|
|
@@ -2570,7 +2591,7 @@ function mergeObjects(a2, b2) {
|
|
|
2570
2591
|
return void 0;
|
|
2571
2592
|
}
|
|
2572
2593
|
|
|
2573
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
2594
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/getStateAttributesProps.js
|
|
2574
2595
|
function getStateAttributesProps(state, customMapping) {
|
|
2575
2596
|
const props = {};
|
|
2576
2597
|
for (const key in state) {
|
|
@@ -2591,17 +2612,17 @@ function getStateAttributesProps(state, customMapping) {
|
|
|
2591
2612
|
return props;
|
|
2592
2613
|
}
|
|
2593
2614
|
|
|
2594
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
2615
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveClassName.js
|
|
2595
2616
|
function resolveClassName(className, state) {
|
|
2596
2617
|
return typeof className === "function" ? className(state) : className;
|
|
2597
2618
|
}
|
|
2598
2619
|
|
|
2599
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
2620
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/resolveStyle.js
|
|
2600
2621
|
function resolveStyle(style, state) {
|
|
2601
2622
|
return typeof style === "function" ? style(state) : style;
|
|
2602
2623
|
}
|
|
2603
2624
|
|
|
2604
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
2625
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/merge-props/mergeProps.js
|
|
2605
2626
|
var EMPTY_PROPS = {};
|
|
2606
2627
|
function mergeProps(a2, b2, c2, d2, e2) {
|
|
2607
2628
|
let merged = {
|
|
@@ -2724,11 +2745,17 @@ function isSyntheticEvent(event) {
|
|
|
2724
2745
|
return event != null && typeof event === "object" && "nativeEvent" in event;
|
|
2725
2746
|
}
|
|
2726
2747
|
|
|
2727
|
-
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.
|
|
2748
|
+
// ../../../node_modules/.pnpm/@base-ui+utils@0.2.6_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/utils/esm/empty.js
|
|
2728
2749
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
2729
2750
|
var EMPTY_OBJECT = Object.freeze({});
|
|
2730
2751
|
|
|
2731
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
2752
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/constants.js
|
|
2753
|
+
var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
|
|
2754
|
+
var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
|
|
2755
|
+
var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
|
|
2756
|
+
var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
|
|
2757
|
+
|
|
2758
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/utils/useRenderElement.js
|
|
2732
2759
|
|
|
2733
2760
|
function useRenderElement(element, componentProps, params = {}) {
|
|
2734
2761
|
const renderProp = componentProps.render;
|
|
@@ -2780,6 +2807,9 @@ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
|
2780
2807
|
function evaluateRenderProp(element, render, props, state) {
|
|
2781
2808
|
if (render) {
|
|
2782
2809
|
if (typeof render === "function") {
|
|
2810
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2811
|
+
warnIfRenderPropLooksLikeComponent(render);
|
|
2812
|
+
}
|
|
2783
2813
|
return render(props, state);
|
|
2784
2814
|
}
|
|
2785
2815
|
const mergedProps = mergeProps(props, render.props);
|
|
@@ -2801,7 +2831,18 @@ function evaluateRenderProp(element, render, props, state) {
|
|
|
2801
2831
|
return renderTag(element, props);
|
|
2802
2832
|
}
|
|
2803
2833
|
}
|
|
2804
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." :
|
|
2834
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
|
|
2835
|
+
}
|
|
2836
|
+
function warnIfRenderPropLooksLikeComponent(renderFn) {
|
|
2837
|
+
const functionName = renderFn.name;
|
|
2838
|
+
if (functionName.length === 0) {
|
|
2839
|
+
return;
|
|
2840
|
+
}
|
|
2841
|
+
const firstCharacterCode = functionName.charCodeAt(0);
|
|
2842
|
+
if (firstCharacterCode < 65 || firstCharacterCode > 90) {
|
|
2843
|
+
return;
|
|
2844
|
+
}
|
|
2845
|
+
warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
|
|
2805
2846
|
}
|
|
2806
2847
|
function renderTag(Tag, props) {
|
|
2807
2848
|
if (Tag === "button") {
|
|
@@ -2821,7 +2862,7 @@ function renderTag(Tag, props) {
|
|
|
2821
2862
|
return /* @__PURE__ */ React4.createElement(Tag, props);
|
|
2822
2863
|
}
|
|
2823
2864
|
|
|
2824
|
-
// ../../../node_modules/.pnpm/@base-ui+react@1.
|
|
2865
|
+
// ../../../node_modules/.pnpm/@base-ui+react@1.3.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/use-render/useRender.js
|
|
2825
2866
|
function useRender(params) {
|
|
2826
2867
|
return useRenderElement(_nullishCoalesce(params.defaultTagName, () => ( "div")), params, params);
|
|
2827
2868
|
}
|
|
@@ -2925,7 +2966,7 @@ function paramCase(input, options) {
|
|
|
2925
2966
|
return dotCase(input, _tslib.__assign.call(void 0, { delimiter: "-" }, options));
|
|
2926
2967
|
}
|
|
2927
2968
|
|
|
2928
|
-
// ../../../node_modules/.pnpm/@wordpress+ui@0.9.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1_stylelint@
|
|
2969
|
+
// ../../../node_modules/.pnpm/@wordpress+ui@0.9.0_@types+react@18.3.28_react-dom@18.3.1_react@18.3.1__react@18.3.1_stylelint@17.5.0/node_modules/@wordpress/ui/build-module/stack/stack.mjs
|
|
2929
2970
|
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='71d20935c2']")) {
|
|
2930
2971
|
const style = document.createElement("style");
|
|
2931
2972
|
style.setAttribute("data-wp-hash", "71d20935c2");
|
|
@@ -3897,21 +3938,20 @@ var _tooltip = require('@visx/tooltip');
|
|
|
3897
3938
|
|
|
3898
3939
|
// src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss
|
|
3899
3940
|
var conversion_funnel_chart_module_default = {
|
|
3900
|
-
"
|
|
3901
|
-
"loading": "a8ccharts-
|
|
3941
|
+
"conversion-funnel-chart": "a8ccharts-B0ct23",
|
|
3942
|
+
"conversion-funnel-chart--loading": "a8ccharts-Qicx1p",
|
|
3902
3943
|
"main-metric": "a8ccharts-61WPYr",
|
|
3903
3944
|
"main-rate": "a8ccharts-RRRI6x",
|
|
3904
3945
|
"change-indicator": "a8ccharts-661iwx",
|
|
3905
3946
|
"funnel-container": "a8ccharts-Z7EGnW",
|
|
3906
3947
|
"funnel-step": "a8ccharts-VqFY0l",
|
|
3907
|
-
"
|
|
3948
|
+
"funnel-step--animated": "a8ccharts-fk-hCl",
|
|
3949
|
+
"funnel-step--blurred": "a8ccharts-1zOc9c",
|
|
3908
3950
|
"step-header": "a8ccharts-2JsQiV",
|
|
3909
3951
|
"step-label": "a8ccharts-6OabC4",
|
|
3910
3952
|
"step-rate": "a8ccharts-9wSZ6n",
|
|
3911
3953
|
"bar-container": "a8ccharts-sSmCTi",
|
|
3912
|
-
"disabled": "a8ccharts-PLWVAW",
|
|
3913
3954
|
"funnel-bar": "a8ccharts-EzczI-",
|
|
3914
|
-
"selected": "a8ccharts-wNpZEu",
|
|
3915
3955
|
"funnel-bar--animated": "a8ccharts-68HQJl",
|
|
3916
3956
|
"stretch": "a8ccharts-CmtieZ",
|
|
3917
3957
|
"tooltip-wrapper": "a8ccharts-2TeoCn",
|
|
@@ -3995,7 +4035,8 @@ var ConversionFunnelChartInternal = ({
|
|
|
3995
4035
|
conversionFunnelChart: conversionFunnelChartSettings
|
|
3996
4036
|
} = useGlobalChartsTheme();
|
|
3997
4037
|
const {
|
|
3998
|
-
getElementStyles
|
|
4038
|
+
getElementStyles,
|
|
4039
|
+
isColorPaletteResolved
|
|
3999
4040
|
} = useGlobalChartsContext();
|
|
4000
4041
|
const chartRef = _react.useRef.call(void 0, null);
|
|
4001
4042
|
const selectedBarRef = _react.useRef.call(void 0, null);
|
|
@@ -4172,7 +4213,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
4172
4213
|
if (!isDataValid) {
|
|
4173
4214
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Stack, {
|
|
4174
4215
|
direction: "column",
|
|
4175
|
-
className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default
|
|
4216
|
+
className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["conversion-funnel-chart"], loading && conversion_funnel_chart_module_default["conversion-funnel-chart--loading"], className),
|
|
4176
4217
|
style: {
|
|
4177
4218
|
...style,
|
|
4178
4219
|
height: resolvedHeight
|
|
@@ -4191,7 +4232,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
4191
4232
|
portalContainerRef(node2);
|
|
4192
4233
|
chartRef.current = node2;
|
|
4193
4234
|
},
|
|
4194
|
-
className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default
|
|
4235
|
+
className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["conversion-funnel-chart"], loading && conversion_funnel_chart_module_default["conversion-funnel-chart--loading"], className),
|
|
4195
4236
|
style: {
|
|
4196
4237
|
...style,
|
|
4197
4238
|
height: resolvedHeight
|
|
@@ -4212,7 +4253,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
4212
4253
|
isBlurred
|
|
4213
4254
|
} = getStepState(step.id);
|
|
4214
4255
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
4215
|
-
className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["funnel-step"], isBlurred && conversion_funnel_chart_module_default
|
|
4256
|
+
className: _clsx2.default.call(void 0, conversion_funnel_chart_module_default["funnel-step"], isColorPaletteResolved && conversion_funnel_chart_module_default["funnel-step--animated"], isBlurred && conversion_funnel_chart_module_default["funnel-step--blurred"]),
|
|
4216
4257
|
children: [/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", {
|
|
4217
4258
|
className: conversion_funnel_chart_module_default["step-header"],
|
|
4218
4259
|
children: [renderStepLabel ? renderStepLabel({
|
|
@@ -4231,7 +4272,7 @@ var ConversionFunnelChartInternal = ({
|
|
|
4231
4272
|
children: formatPercentage(step.rate)
|
|
4232
4273
|
})]
|
|
4233
4274
|
}), /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
4234
|
-
className:
|
|
4275
|
+
className: conversion_funnel_chart_module_default["bar-container"],
|
|
4235
4276
|
onClick: _optionalChain([stepHandlers, 'access', _160 => _160.get, 'call', _161 => _161(step.id), 'optionalAccess', _162 => _162.onClick]),
|
|
4236
4277
|
onKeyDown: _optionalChain([stepHandlers, 'access', _163 => _163.get, 'call', _164 => _164(step.id), 'optionalAccess', _165 => _165.onKeyDown]),
|
|
4237
4278
|
role: "button",
|
|
@@ -4296,6 +4337,43 @@ ConversionFunnelChartWithProvider.displayName = "ConversionFunnelChart";
|
|
|
4296
4337
|
|
|
4297
4338
|
var _reactgooglecharts = require('react-google-charts');
|
|
4298
4339
|
|
|
4340
|
+
// src/utils/sanitize-html.ts
|
|
4341
|
+
var _dompurify = require('dompurify'); var _dompurify2 = _interopRequireDefault(_dompurify);
|
|
4342
|
+
_dompurify2.default.addHook("afterSanitizeAttributes", (node2) => {
|
|
4343
|
+
if (node2.tagName === "A" && node2.getAttribute("target") === "_blank") {
|
|
4344
|
+
node2.setAttribute("rel", "noopener noreferrer");
|
|
4345
|
+
}
|
|
4346
|
+
});
|
|
4347
|
+
function sanitizeHtml(html) {
|
|
4348
|
+
return _dompurify2.default.sanitize(html, {
|
|
4349
|
+
ALLOWED_TAGS: [
|
|
4350
|
+
"a",
|
|
4351
|
+
"b",
|
|
4352
|
+
"br",
|
|
4353
|
+
"div",
|
|
4354
|
+
"em",
|
|
4355
|
+
"i",
|
|
4356
|
+
"li",
|
|
4357
|
+
"ol",
|
|
4358
|
+
"p",
|
|
4359
|
+
"small",
|
|
4360
|
+
"span",
|
|
4361
|
+
"strong",
|
|
4362
|
+
"sub",
|
|
4363
|
+
"sup",
|
|
4364
|
+
"table",
|
|
4365
|
+
"tbody",
|
|
4366
|
+
"td",
|
|
4367
|
+
"th",
|
|
4368
|
+
"thead",
|
|
4369
|
+
"tr",
|
|
4370
|
+
"u",
|
|
4371
|
+
"ul"
|
|
4372
|
+
],
|
|
4373
|
+
ALLOWED_ATTR: ["class", "href", "target", "rel"]
|
|
4374
|
+
});
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4299
4377
|
// src/charts/geo-chart/geo-chart.module.scss
|
|
4300
4378
|
var geo_chart_module_default = {
|
|
4301
4379
|
"container": "a8ccharts-JvcqOz"
|
|
@@ -4337,7 +4415,40 @@ var GeoChartInternal = ({
|
|
|
4337
4415
|
const lightColorHex = lightenHexColor(fullColorHex, 0.8);
|
|
4338
4416
|
const backgroundColorHex = normalizeColorToHex(backgroundColor, null, resolveCssVariable) || DEFAULT_BACKGROUND_COLOR;
|
|
4339
4417
|
const defaultFillColorHex = normalizeColorToHex(featureFillColor, null, resolveCssVariable) || DEFAULT_FEATURE_FILL_COLOR;
|
|
4340
|
-
const
|
|
4418
|
+
const sanitizedData = _react.useMemo.call(void 0, () => {
|
|
4419
|
+
if (data.length === 0) {
|
|
4420
|
+
return {
|
|
4421
|
+
data,
|
|
4422
|
+
hasHtmlTooltips: false
|
|
4423
|
+
};
|
|
4424
|
+
}
|
|
4425
|
+
const htmlTooltipIndices = [];
|
|
4426
|
+
for (let i2 = 0; i2 < data[0].length; i2++) {
|
|
4427
|
+
const col = data[0][i2];
|
|
4428
|
+
if (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) {
|
|
4429
|
+
htmlTooltipIndices.push(i2);
|
|
4430
|
+
}
|
|
4431
|
+
}
|
|
4432
|
+
if (htmlTooltipIndices.length === 0) {
|
|
4433
|
+
return {
|
|
4434
|
+
data,
|
|
4435
|
+
hasHtmlTooltips: false
|
|
4436
|
+
};
|
|
4437
|
+
}
|
|
4438
|
+
const sanitizedRows = data.slice(1).map((row) => {
|
|
4439
|
+
const newRow = [...row];
|
|
4440
|
+
for (const colIndex of htmlTooltipIndices) {
|
|
4441
|
+
if (typeof newRow[colIndex] === "string") {
|
|
4442
|
+
newRow[colIndex] = sanitizeHtml(newRow[colIndex]);
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
return newRow;
|
|
4446
|
+
});
|
|
4447
|
+
return {
|
|
4448
|
+
data: [data[0], ...sanitizedRows],
|
|
4449
|
+
hasHtmlTooltips: true
|
|
4450
|
+
};
|
|
4451
|
+
}, [data]);
|
|
4341
4452
|
const options = _react.useMemo.call(void 0, () => ({
|
|
4342
4453
|
...region !== "world" && {
|
|
4343
4454
|
region
|
|
@@ -4353,11 +4464,11 @@ var GeoChartInternal = ({
|
|
|
4353
4464
|
defaultColor: defaultFillColorHex,
|
|
4354
4465
|
tooltip: {
|
|
4355
4466
|
trigger: "focus",
|
|
4356
|
-
isHtml: hasHtmlTooltips
|
|
4467
|
+
isHtml: sanitizedData.hasHtmlTooltips
|
|
4357
4468
|
},
|
|
4358
4469
|
legend: "none",
|
|
4359
4470
|
keepAspectRatio: true
|
|
4360
|
-
}), [region, resolution, lightColorHex, fullColorHex, backgroundColorHex, defaultFillColorHex, hasHtmlTooltips]);
|
|
4471
|
+
}), [region, resolution, lightColorHex, fullColorHex, backgroundColorHex, defaultFillColorHex, sanitizedData.hasHtmlTooltips]);
|
|
4361
4472
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {
|
|
4362
4473
|
className: _clsx2.default.call(void 0, "geo-chart", geo_chart_module_default.container, className),
|
|
4363
4474
|
style: {
|
|
@@ -4369,7 +4480,7 @@ var GeoChartInternal = ({
|
|
|
4369
4480
|
chartType: "GeoChart",
|
|
4370
4481
|
width,
|
|
4371
4482
|
height,
|
|
4372
|
-
data,
|
|
4483
|
+
data: sanitizedData.data,
|
|
4373
4484
|
options,
|
|
4374
4485
|
loader: loadingPlaceholder
|
|
4375
4486
|
})
|
|
@@ -6333,10 +6444,10 @@ var config_values_default = Object.assign({}, CONTROL_PROPS, {
|
|
|
6333
6444
|
var import_es6 = _chunkEMMSS5I5cjs.__toESM.call(void 0, require_es6(), 1);
|
|
6334
6445
|
|
|
6335
6446
|
|
|
6336
|
-
// ../../../node_modules/.pnpm/@wordpress+warning@3.
|
|
6447
|
+
// ../../../node_modules/.pnpm/@wordpress+warning@3.43.0/node_modules/@wordpress/warning/build-module/utils.mjs
|
|
6337
6448
|
var logged = /* @__PURE__ */ new Set();
|
|
6338
6449
|
|
|
6339
|
-
// ../../../node_modules/.pnpm/@wordpress+warning@3.
|
|
6450
|
+
// ../../../node_modules/.pnpm/@wordpress+warning@3.43.0/node_modules/@wordpress/warning/build-module/index.mjs
|
|
6340
6451
|
function isDev() {
|
|
6341
6452
|
return globalThis.SCRIPT_DEBUG === true;
|
|
6342
6453
|
}
|