Skip to content

Commit 271320e

Browse files
committed
Rename globals charts things for consistency
1 parent d4fd53f commit 271320e

21 files changed

+108
-108
lines changed

projects/js-packages/charts/src/components/bar-chart/bar-chart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
GlobalChartsProvider,
1515
useChartId,
1616
useChartRegistration,
17-
useGlobalChartContext,
17+
useGlobalChartsContext,
1818
} from '../../providers/chart-context';
1919
import { GlobalChartsContext } from '../../providers/chart-context/global-charts-provider';
2020
import { attachSubComponents } from '../../utils';
@@ -125,7 +125,7 @@ const BarChartInternal: FC< BarChartProps > = ( {
125125
totalPoints,
126126
} );
127127

128-
const { resolveGroupColor } = useGlobalChartContext();
128+
const { resolveGroupColor } = useGlobalChartsContext();
129129

130130
const getColor = useCallback(
131131
( seriesData: SeriesData, index: number ) =>

projects/js-packages/charts/src/components/conversion-funnel-chart/conversion-funnel-chart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { __experimentalText as Text } from '@wordpress/components'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
22
import clsx from 'clsx';
33
import { type FC, useRef, useMemo, useEffect, useCallback } from 'react';
4-
import { useGlobalChartTheme } from '../../providers/chart-context';
4+
import { useGlobalChartsTheme } from '../../providers/chart-context';
55
import styles from './conversion-funnel-chart.module.scss';
66
import { useFunnelSelection } from './hooks/use-funnel-selection';
77
import { hexToRgba } from './utils/color-utils';
@@ -68,7 +68,7 @@ export const ConversionFunnelChart: FC< ConversionFunnelChartProps > = ( {
6868
className,
6969
style,
7070
} ) => {
71-
const theme = useGlobalChartTheme();
71+
const theme = useGlobalChartsTheme();
7272
const chartRef = useRef< HTMLDivElement >( null );
7373
const selectedBarRef = useRef< HTMLDivElement | null >( null );
7474

projects/js-packages/charts/src/components/leaderboard-chart/leaderboard-chart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { Fragment } from '@wordpress/element';
99
import clsx from 'clsx';
1010
import { type FC } from 'react';
11-
import { useGlobalChartTheme } from '../../providers/chart-context';
11+
import { useGlobalChartsTheme } from '../../providers/chart-context';
1212
import { formatMetricValue } from '../../utils';
1313
import styles from './leaderboard-chart.module.scss';
1414

@@ -214,7 +214,7 @@ export const LeaderboardChart: FC< LeaderboardChartProps > = ( {
214214
className,
215215
style,
216216
} ) => {
217-
const theme = useGlobalChartTheme();
217+
const theme = useGlobalChartsTheme();
218218

219219
// Get component settings from theme with fallbacks
220220
const leaderboardSettings = theme.leaderboardChart;

projects/js-packages/charts/src/components/legend/base-legend.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from '@visx/legen
33
import { scaleOrdinal } from '@visx/scale';
44
import clsx from 'clsx';
55
import { forwardRef, useCallback, useMemo, useContext } from 'react';
6-
import { useGlobalChartTheme, GlobalChartsContext } from '../../providers/chart-context';
6+
import { useGlobalChartsTheme, GlobalChartsContext } from '../../providers/chart-context';
77
import styles from './legend.module.scss';
88
import { valueOrIdentity, valueOrIdentityString, labelTransformFactory } from './utils';
99
import type { BaseLegendProps } from './types';
@@ -43,7 +43,7 @@ export const BaseLegend = forwardRef< HTMLDivElement, BaseLegendProps >(
4343
},
4444
ref
4545
) => {
46-
const theme = useGlobalChartTheme();
46+
const theme = useGlobalChartsTheme();
4747
const context = useContext( GlobalChartsContext );
4848
const resolveGroupColor = context?.resolveGroupColor;
4949

projects/js-packages/charts/src/components/legend/use-chart-legend-items.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo } from 'react';
2-
import { useGlobalChartTheme } from '../../providers/chart-context';
2+
import { useGlobalChartsTheme } from '../../providers/chart-context';
33
import { getItemShapeStyles, getSeriesStroke } from '../../utils';
44
import type { BaseLegendItem } from './types';
55
import type { ChartTheme, SeriesData, DataPointDate, DataPointPercentage } from '../../types';
@@ -142,7 +142,7 @@ export function useChartLegendItems<
142142
legendShape?: LegendShape< SeriesData[], number >
143143
): BaseLegendItem[] {
144144
const { showValues = false, withGlyph = false, glyphSize = 8, renderGlyph } = options;
145-
const theme = useGlobalChartTheme();
145+
const theme = useGlobalChartsTheme();
146146

147147
return useMemo( () => {
148148
if ( ! data || ! Array.isArray( data ) || data.length === 0 ) {

projects/js-packages/charts/src/components/line-chart/line-chart-annotation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { DataContext } from '@visx/xychart';
1010
import merge from 'deepmerge';
1111
import { useContext, useRef, useEffect, useState, useMemo } from 'react';
12-
import { useGlobalChartTheme } from '../../providers/chart-context';
12+
import { useGlobalChartsTheme } from '../../providers/chart-context';
1313
import { isSafari } from '../../utils';
1414
import LineChartAnnotationLabelWithPopover, {
1515
POPOVER_BUTTON_SIZE,
@@ -175,7 +175,7 @@ const LineChartAnnotation: FC< LineChartAnnotationProps > = ( {
175175
renderLabel,
176176
renderLabelPopover,
177177
} ) => {
178-
const providerTheme = useGlobalChartTheme();
178+
const providerTheme = useGlobalChartsTheme();
179179
const { xScale, yScale } = useContext( DataContext ) || {};
180180
const labelRef = useRef< SVGGElement >( null );
181181
const [ height, setHeight ] = useState< number | null >( null );

projects/js-packages/charts/src/components/line-chart/line-chart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {
1616
GlobalChartsContext,
1717
useChartId,
1818
useChartRegistration,
19-
useGlobalChartContext,
20-
useGlobalChartTheme,
19+
useGlobalChartsContext,
20+
useGlobalChartsTheme,
2121
} from '../../providers/chart-context';
2222
import { attachSubComponents, getSeriesLineStyles } from '../../utils';
2323
import { DefaultGlyph } from '../default-glyph';
@@ -257,7 +257,7 @@ const LineChartInternal = forwardRef< SingleChartRef, LineChartProps >(
257257
},
258258
ref
259259
) => {
260-
const providerTheme = useGlobalChartTheme();
260+
const providerTheme = useGlobalChartsTheme();
261261
const theme = useXYChartTheme( data );
262262
const chartId = useChartId( providedChartId );
263263
const [ legendRef, legendHeight ] = useElementHeight< HTMLDivElement >();
@@ -278,7 +278,7 @@ const LineChartInternal = forwardRef< SingleChartRef, LineChartProps >(
278278
);
279279

280280
const dataSorted = useChartDataTransform( data );
281-
const { resolveGroupColor } = useGlobalChartContext();
281+
const { resolveGroupColor } = useGlobalChartsContext();
282282

283283
// Use the keyboard navigation hook
284284
const { tooltipRef, onChartFocus, onChartBlur, onChartKeyDown } = useKeyboardNavigation( {

projects/js-packages/charts/src/components/line-chart/stories/glyph.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { GlyphStar } from '@visx/glyph';
2-
import { useGlobalChartTheme } from '../../../providers/chart-context';
2+
import { useGlobalChartsTheme } from '../../../providers/chart-context';
33
import { GlobalChartsProvider } from '../../../providers/chart-context/global-charts-provider';
44
import { CHART_THEME_MAP, themeArgTypes } from '../../../stories/theme-config';
55
import LineChart from '../line-chart';
@@ -118,7 +118,7 @@ CustomSvg.args = {
118118
};
119119

120120
const ToolTipWithGlyph = ( { tooltipData }: RenderTooltipParams< DataPointDate > ) => {
121-
const providerTheme = useGlobalChartTheme();
121+
const providerTheme = useGlobalChartsTheme();
122122

123123
return (
124124
<div>

projects/js-packages/charts/src/components/pie-chart/pie-chart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
GlobalChartsProvider,
88
useChartId,
99
useChartRegistration,
10-
useGlobalChartContext,
11-
useGlobalChartTheme,
10+
useGlobalChartsContext,
11+
useGlobalChartsTheme,
1212
} from '../../providers/chart-context';
1313
import { GlobalChartsContext } from '../../providers/chart-context/global-charts-provider';
1414
import { attachSubComponents } from '../../utils';
@@ -118,7 +118,7 @@ const PieChartInternal = ( {
118118
cornerScale = 0,
119119
children = null,
120120
}: PieChartProps ) => {
121-
const providerTheme = useGlobalChartTheme();
121+
const providerTheme = useGlobalChartsTheme();
122122
const chartId = useChartId( providedChartId );
123123
const [ legendRef, legendHeight ] = useElementHeight< HTMLDivElement >();
124124
const { onMouseMove, onMouseLeave, tooltipOpen, tooltipData, tooltipLeft, tooltipTop } =
@@ -156,7 +156,7 @@ const PieChartInternal = ( {
156156
metadata: chartMetadata,
157157
} );
158158

159-
const { resolveGroupColor } = useGlobalChartContext();
159+
const { resolveGroupColor } = useGlobalChartsContext();
160160

161161
if ( ! isValid ) {
162162
return (

projects/js-packages/charts/src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
GlobalChartsProvider,
1111
useChartId,
1212
useChartRegistration,
13-
useGlobalChartContext,
13+
useGlobalChartsContext,
1414
GlobalChartsContext,
1515
} from '../../providers/chart-context';
1616
import { attachSubComponents } from '../../utils';
@@ -148,7 +148,7 @@ const PieSemiCircleChartInternal: FC< PieSemiCircleChartProps > = ( {
148148
// Validate data first to get validation result
149149
const { isValid, message } = validateData( data );
150150

151-
const { resolveGroupColor } = useGlobalChartContext();
151+
const { resolveGroupColor } = useGlobalChartsContext();
152152

153153
// Define accessors with useMemo to avoid changing dependencies
154154
const accessors = useMemo(

0 commit comments

Comments
 (0)