@coinbase/cds-web-visualization 3.3.0 → 3.3.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 +25 -0
- package/dts/index.d.ts +1 -1
- package/dts/sparkline/Counter.d.ts +7 -2
- package/dts/sparkline/Sparkline.d.ts +26 -16
- package/dts/sparkline/SparklineArea.d.ts +8 -4
- package/dts/sparkline/SparklineAreaPattern.d.ts +7 -4
- package/dts/sparkline/SparklineGradient.d.ts +16 -10
- package/dts/sparkline/SparklinePath.d.ts +8 -6
- package/dts/sparkline/__figma__/Sparkline.figma.d.ts +1 -1
- package/dts/sparkline/generateSparklineWithId.d.ts +7 -2
- package/dts/sparkline/index.d.ts +1 -1
- package/dts/sparkline/sparkline-interactive/InnerSparklineInteractiveProvider.d.ts +9 -5
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +159 -118
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts +19 -9
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts +4 -2
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverPrice.d.ts +4 -2
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +5 -3
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +11 -6
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts +20 -7
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts +21 -16
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts +17 -12
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveScrubHandler.d.ts +23 -10
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveScrubProvider.d.ts +12 -12
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts +22 -14
- package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts +1 -1
- package/dts/sparkline/sparkline-interactive/fade.d.ts +1 -1
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +11 -11
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +101 -93
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +1 -1
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +8 -4
- package/package.json +11 -11
- package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts +0 -374
- package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractive.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractive.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts +0 -87
- package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.d.ts.map +0 -1
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import type { SparklineInteractiveBaseProps } from './SparklineInteractive';
|
|
2
|
-
export type SparklineInteractivePathsProps<Period extends string> = Pick<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export type SparklineInteractivePathsProps<Period extends string> = Pick<
|
|
3
|
+
SparklineInteractiveBaseProps<Period>,
|
|
4
|
+
'fill' | 'yAxisScalingFactor' | 'strokeColor' | 'hoverData' | 'compact'
|
|
5
|
+
> & {
|
|
6
|
+
showHoverData: boolean;
|
|
7
|
+
path: string;
|
|
8
|
+
area: string;
|
|
9
|
+
selectedPeriod: Period;
|
|
7
10
|
};
|
|
8
|
-
declare function SparklineInteractivePathsWithGeneric<Period extends string>({
|
|
11
|
+
declare function SparklineInteractivePathsWithGeneric<Period extends string>({
|
|
12
|
+
showHoverData,
|
|
13
|
+
fill,
|
|
14
|
+
path,
|
|
15
|
+
area,
|
|
16
|
+
selectedPeriod,
|
|
17
|
+
yAxisScalingFactor,
|
|
18
|
+
strokeColor,
|
|
19
|
+
hoverData,
|
|
20
|
+
compact,
|
|
21
|
+
}: SparklineInteractivePathsProps<Period>): import('react/jsx-runtime').JSX.Element;
|
|
9
22
|
export declare const SparklineInteractivePaths: typeof SparklineInteractivePathsWithGeneric;
|
|
10
23
|
export {};
|
|
11
|
-
//# sourceMappingURL=SparklineInteractivePaths.d.ts.map
|
|
24
|
+
//# sourceMappingURL=SparklineInteractivePaths.d.ts.map
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
export type SparklineInteractivePeriodSelectorProps<Period extends string> = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
selectedPeriod: Period;
|
|
3
|
+
setSelectedPeriod: (period: Period) => void;
|
|
4
|
+
periods: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: Period;
|
|
7
|
+
}[];
|
|
8
|
+
color: string;
|
|
9
9
|
};
|
|
10
10
|
export type SparklineInteractivePeriodProps<Period extends string> = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
period: {
|
|
12
|
+
label: string;
|
|
13
|
+
value: Period;
|
|
14
|
+
};
|
|
15
|
+
selectedPeriod: Period;
|
|
16
|
+
setSelectedPeriod: SparklineInteractivePeriodSelectorProps<Period>['setSelectedPeriod'];
|
|
17
|
+
color: string;
|
|
18
18
|
};
|
|
19
|
-
export declare const SparklineInteractivePeriodSelector: <Period extends string>({
|
|
20
|
-
|
|
19
|
+
export declare const SparklineInteractivePeriodSelector: <Period extends string>({
|
|
20
|
+
selectedPeriod,
|
|
21
|
+
setSelectedPeriod,
|
|
22
|
+
periods,
|
|
23
|
+
color,
|
|
24
|
+
}: SparklineInteractivePeriodSelectorProps<Period>) => import('react/jsx-runtime').JSX.Element;
|
|
25
|
+
//# sourceMappingURL=SparklineInteractivePeriodSelector.d.ts.map
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch, SetStateAction } from 'react';
|
|
3
3
|
type SparklineInteractiveProviderProps = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
compact?: boolean;
|
|
6
6
|
};
|
|
7
7
|
type SparklineInteractiveContextInterface = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
isFallbackVisible: boolean;
|
|
9
|
+
compact: boolean;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
showFallback: () => void;
|
|
13
|
+
hideFallback: () => void;
|
|
14
|
+
setWidth: Dispatch<SetStateAction<number>>;
|
|
15
|
+
setHeight: Dispatch<SetStateAction<number>>;
|
|
16
16
|
};
|
|
17
|
-
export declare const SparklineInteractiveProvider: React.MemoExoticComponent<
|
|
17
|
+
export declare const SparklineInteractiveProvider: React.MemoExoticComponent<
|
|
18
|
+
({
|
|
19
|
+
children,
|
|
20
|
+
compact,
|
|
21
|
+
}: SparklineInteractiveProviderProps) => import('react/jsx-runtime').JSX.Element
|
|
22
|
+
>;
|
|
18
23
|
export declare function useSparklineInteractiveContext(): SparklineInteractiveContextInterface;
|
|
19
24
|
export {};
|
|
20
|
-
//# sourceMappingURL=SparklineInteractiveProvider.d.ts.map
|
|
25
|
+
//# sourceMappingURL=SparklineInteractiveProvider.d.ts.map
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChartGetMarker } from '@coinbase/cds-common';
|
|
3
3
|
import type { SparklineInteractiveBaseProps } from './SparklineInteractive';
|
|
4
|
-
export declare const scrubHandlerStaticClassName =
|
|
4
|
+
export declare const scrubHandlerStaticClassName = 'cds-sparkline--scrubhandler';
|
|
5
5
|
export declare function fadeInMask(domNode?: HTMLElement | null): void;
|
|
6
|
-
type SparklineInteractiveScrubHandlerWebProps<Period extends string> = Pick<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
type SparklineInteractiveScrubHandlerWebProps<Period extends string> = Pick<
|
|
7
|
+
SparklineInteractiveBaseProps<Period>,
|
|
8
|
+
'onScrub' | 'formatHoverDate' | 'formatHoverPrice'
|
|
9
|
+
> & {
|
|
10
|
+
getMarker: ChartGetMarker;
|
|
11
|
+
selectedPeriod: Period;
|
|
12
|
+
onScrubEnd?: () => void;
|
|
13
|
+
onScrubStart?: () => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
children: React.ReactNode;
|
|
13
16
|
};
|
|
14
|
-
declare const SparklineInteractiveScrubHandlerWithGeneric: <Period extends string>({
|
|
17
|
+
declare const SparklineInteractiveScrubHandlerWithGeneric: <Period extends string>({
|
|
18
|
+
onScrubEnd,
|
|
19
|
+
onScrubStart,
|
|
20
|
+
children,
|
|
21
|
+
disabled,
|
|
22
|
+
onScrub,
|
|
23
|
+
getMarker,
|
|
24
|
+
selectedPeriod,
|
|
25
|
+
formatHoverDate,
|
|
26
|
+
formatHoverPrice,
|
|
27
|
+
}: SparklineInteractiveScrubHandlerWebProps<Period>) => import('react/jsx-runtime').JSX.Element;
|
|
15
28
|
export declare const SparklineInteractiveScrubHandler: typeof SparklineInteractiveScrubHandlerWithGeneric;
|
|
16
29
|
export {};
|
|
17
|
-
//# sourceMappingURL=SparklineInteractiveScrubHandler.d.ts.map
|
|
30
|
+
//# sourceMappingURL=SparklineInteractiveScrubHandler.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch, SetStateAction } from 'react';
|
|
3
3
|
type SparklineInteractiveScrubContextInterface = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
setLineDOMNode: Dispatch<SetStateAction<HTMLDivElement | null>>;
|
|
5
|
+
setMaskDOMNode: Dispatch<SetStateAction<HTMLDivElement | null>>;
|
|
6
|
+
setHoverDateDOMNode: Dispatch<SetStateAction<HTMLSpanElement | null>>;
|
|
7
|
+
setHoverPriceDOMNode: Dispatch<SetStateAction<HTMLSpanElement | null>>;
|
|
8
|
+
lineDOMNode: HTMLDivElement | null;
|
|
9
|
+
maskDOMNode: HTMLDivElement | null;
|
|
10
|
+
hoverDateDOMNode: HTMLSpanElement | null;
|
|
11
|
+
hoverPriceDOMNode: HTMLSpanElement | null;
|
|
12
12
|
};
|
|
13
|
-
export declare const SparklineInteractiveScrubProvider: React.MemoExoticComponent<
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export declare const SparklineInteractiveScrubProvider: React.MemoExoticComponent<
|
|
14
|
+
({ children }: { children: React.ReactNode }) => import('react/jsx-runtime').JSX.Element
|
|
15
|
+
>;
|
|
16
16
|
export declare function useSparklineInteractiveScrubContext(): SparklineInteractiveScrubContextInterface;
|
|
17
17
|
export {};
|
|
18
|
-
//# sourceMappingURL=SparklineInteractiveScrubProvider.d.ts.map
|
|
18
|
+
//# sourceMappingURL=SparklineInteractiveScrubProvider.d.ts.map
|
|
@@ -2,22 +2,30 @@ import React from 'react';
|
|
|
2
2
|
import type { ChartDataPoint, ChartTimeseries } from '@coinbase/cds-common/types';
|
|
3
3
|
import type { Area, Line } from 'd3-shape';
|
|
4
4
|
export type TimeseriesPathOnRenderParams = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
path: string;
|
|
6
|
+
area: string;
|
|
7
7
|
};
|
|
8
8
|
export type TimeseriesPathProps = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
lineFn: Line<ChartDataPoint>;
|
|
10
|
+
areaFn: Area<ChartDataPoint>;
|
|
11
|
+
timeseries: ChartTimeseries;
|
|
12
|
+
initialPath: string;
|
|
13
|
+
onRender?: ({ path, area }: TimeseriesPathOnRenderParams) => void;
|
|
14
14
|
};
|
|
15
15
|
export type SparklineInteractiveTimeseriesPathsProps = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
initialPath: string;
|
|
17
|
+
data: ChartTimeseries[];
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
onRender: ({ path, area }: TimeseriesPathOnRenderParams) => void;
|
|
21
21
|
};
|
|
22
|
-
export declare const SparklineInteractiveTimeseriesPaths: React.MemoExoticComponent<
|
|
23
|
-
|
|
22
|
+
export declare const SparklineInteractiveTimeseriesPaths: React.MemoExoticComponent<
|
|
23
|
+
({
|
|
24
|
+
data,
|
|
25
|
+
width,
|
|
26
|
+
height,
|
|
27
|
+
initialPath,
|
|
28
|
+
onRender,
|
|
29
|
+
}: SparklineInteractiveTimeseriesPathsProps) => import('react/jsx-runtime').JSX.Element
|
|
30
|
+
>;
|
|
31
|
+
//# sourceMappingURL=SparklineInteractiveTimeseriesPaths.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=SparklineInteractive.figma.d.ts.map
|
|
2
|
+
//# sourceMappingURL=SparklineInteractive.figma.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export declare function useSparklineInteractiveConstants(): {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
chartWidth: number;
|
|
3
|
+
chartHeight: number;
|
|
4
|
+
chartDimensionStyles: {
|
|
5
|
+
height: number;
|
|
6
|
+
width: number;
|
|
7
|
+
};
|
|
8
|
+
xRange: number[];
|
|
9
|
+
yRange: number[];
|
|
10
|
+
startX: number;
|
|
11
|
+
endX: number;
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=useSparklineInteractiveConstants.d.ts.map
|
|
13
|
+
//# sourceMappingURL=useSparklineInteractiveConstants.d.ts.map
|
|
@@ -1,104 +1,112 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
SharedProps,
|
|
4
|
+
SparklineInteractiveHeaderSignVariant,
|
|
5
|
+
SparklineInteractiveHeaderVariant,
|
|
6
|
+
} from '@coinbase/cds-common/types';
|
|
3
7
|
export * from '@coinbase/cds-common/types/SparklineInteractiveHeaderBaseProps';
|
|
4
8
|
export type SparklineInteractiveSubHead = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Free form percentage change
|
|
11
|
+
*/
|
|
12
|
+
percent: string;
|
|
13
|
+
/**
|
|
14
|
+
* Sign to denote the change in price
|
|
15
|
+
*/
|
|
16
|
+
sign: SparklineInteractiveHeaderSignVariant;
|
|
17
|
+
/**
|
|
18
|
+
* The variant to use for the price and percentage change
|
|
19
|
+
*/
|
|
20
|
+
variant: SparklineInteractiveHeaderVariant;
|
|
21
|
+
/**
|
|
22
|
+
* Show the dollar amount of price change
|
|
23
|
+
*/
|
|
24
|
+
priceChange?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The accessoryText to show after the price and / or percentage change. An example is "All time"
|
|
27
|
+
*/
|
|
28
|
+
accessoryText?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The accessibilityLabel to show for the price and / or percentage change. This should be localized
|
|
31
|
+
* @example
|
|
32
|
+
* // First, configure your i18n strings
|
|
33
|
+
* const messages = defineMessages({
|
|
34
|
+
* subHeadPrefix: {
|
|
35
|
+
* id: `${i18nKey}.subHeadPrefix`,
|
|
36
|
+
* defaultMessage: 'Price increase in the amount of',
|
|
37
|
+
* description: 'A prefix to make it clear which direction the price action was moving',
|
|
38
|
+
* }
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // then provide the translated string the accessibilityLabel prop
|
|
42
|
+
* messages.subHeadPrefix
|
|
43
|
+
*/
|
|
44
|
+
accessibilityLabel?: string;
|
|
41
45
|
};
|
|
42
46
|
export type SparklineInteractiveHeaderValues = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Describes what the Header represents e.g. Bitcoin Price
|
|
49
|
+
*/
|
|
50
|
+
label?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Main content of header, this is usually the price
|
|
53
|
+
*/
|
|
54
|
+
title?: React.ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* Provides additional information about the title, such as a price change
|
|
57
|
+
*/
|
|
58
|
+
subHead?: SparklineInteractiveSubHead;
|
|
55
59
|
};
|
|
56
60
|
export type SparklineInteractiveHeaderRef = {
|
|
57
|
-
|
|
61
|
+
update: (params: SparklineInteractiveHeaderValues) => void;
|
|
58
62
|
};
|
|
59
63
|
export type SparklineInteractiveHeaderProps = SharedProps & {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Default title, changing this prop has no effect once the default is rendered. If you use a ReactNode that is not a string, then you cannot use the text based label that supports updates.
|
|
66
|
+
*/
|
|
67
|
+
defaultTitle: React.ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Default label, changing this prop has no effect once the default is rendered.
|
|
70
|
+
*/
|
|
71
|
+
defaultLabel?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Default SubHead, changing this prop has no effect once the default is rendered.
|
|
74
|
+
*/
|
|
75
|
+
defaultSubHead?: SparklineInteractiveSubHead;
|
|
76
|
+
/**
|
|
77
|
+
* Adds a label node that allows React components. If you use this node then you cannot use the text based label that supports updates.
|
|
78
|
+
*/
|
|
79
|
+
labelNode?: React.ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* Reduce the font size used for the header itself.
|
|
82
|
+
*/
|
|
83
|
+
compact?: boolean;
|
|
80
84
|
};
|
|
81
85
|
export declare const interpolateSubHeadText: (subHead: SparklineInteractiveSubHead) => string;
|
|
82
|
-
export declare const SparklineInteractiveHeader: React.MemoExoticComponent<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
86
|
+
export declare const SparklineInteractiveHeader: React.MemoExoticComponent<
|
|
87
|
+
React.ForwardRefExoticComponent<
|
|
88
|
+
SharedProps & {
|
|
89
|
+
/**
|
|
90
|
+
* Default title, changing this prop has no effect once the default is rendered. If you use a ReactNode that is not a string, then you cannot use the text based label that supports updates.
|
|
91
|
+
*/
|
|
92
|
+
defaultTitle: React.ReactNode;
|
|
93
|
+
/**
|
|
94
|
+
* Default label, changing this prop has no effect once the default is rendered.
|
|
95
|
+
*/
|
|
96
|
+
defaultLabel?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Default SubHead, changing this prop has no effect once the default is rendered.
|
|
99
|
+
*/
|
|
100
|
+
defaultSubHead?: SparklineInteractiveSubHead;
|
|
101
|
+
/**
|
|
102
|
+
* Adds a label node that allows React components. If you use this node then you cannot use the text based label that supports updates.
|
|
103
|
+
*/
|
|
104
|
+
labelNode?: React.ReactNode;
|
|
105
|
+
/**
|
|
106
|
+
* Reduce the font size used for the header itself.
|
|
107
|
+
*/
|
|
108
|
+
compact?: boolean;
|
|
109
|
+
} & React.RefAttributes<SparklineInteractiveHeaderRef>
|
|
110
|
+
>
|
|
111
|
+
>;
|
|
112
|
+
//# sourceMappingURL=SparklineInteractiveHeader.d.ts.map
|
package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=SparklineInteractiveHeader.figma.d.ts.map
|
|
2
|
+
//# sourceMappingURL=SparklineInteractiveHeader.figma.d.ts.map
|
|
@@ -13,14 +13,15 @@ const noPointerEvents = {
|
|
|
13
13
|
};
|
|
14
14
|
const SparklineInteractiveMarkerDate = /*#__PURE__*/memo(_ref => {
|
|
15
15
|
let {
|
|
16
|
-
getFormattedDate
|
|
16
|
+
getFormattedDate,
|
|
17
|
+
containerOffsetLeft
|
|
17
18
|
} = _ref;
|
|
18
19
|
const [xPos, setXPos] = useState(0);
|
|
19
20
|
const setupRef = useCallback(ref => {
|
|
20
21
|
if (ref) {
|
|
21
|
-
setXPos(ref.offsetLeft + ref.offsetWidth / 2);
|
|
22
|
+
setXPos(ref.offsetLeft + ref.offsetWidth / 2 - containerOffsetLeft);
|
|
22
23
|
}
|
|
23
|
-
}, []);
|
|
24
|
+
}, [containerOffsetLeft]);
|
|
24
25
|
const dateStr = getFormattedDate(xPos);
|
|
25
26
|
|
|
26
27
|
// take up space while loading so when it finishes loading there is no jump
|
|
@@ -48,6 +49,7 @@ function SparklineInteractiveMarkerDatesWithGeneric(_ref2) {
|
|
|
48
49
|
timePeriodGutter = 2
|
|
49
50
|
} = _ref2;
|
|
50
51
|
const [numberOfLabels, setNumberOfLabels] = useState(0);
|
|
52
|
+
const [containerOffsetLeft, setContainerOffsetLeft] = useState(0);
|
|
51
53
|
const getFormattedDate = useDateLookup({
|
|
52
54
|
getMarker,
|
|
53
55
|
formatDate,
|
|
@@ -57,15 +59,17 @@ function SparklineInteractiveMarkerDatesWithGeneric(_ref2) {
|
|
|
57
59
|
if (ref) {
|
|
58
60
|
const numberOfLabelsFromWidth = Math.floor(ref.offsetWidth / labelWidth);
|
|
59
61
|
setNumberOfLabels(Math.max(numberOfLabelsFromWidth, 4));
|
|
62
|
+
setContainerOffsetLeft(ref.offsetLeft);
|
|
60
63
|
}
|
|
61
64
|
}, []);
|
|
62
65
|
const markers = useMemo(() => {
|
|
63
66
|
return times(numberOfLabels).map((_, i) => {
|
|
64
67
|
return /*#__PURE__*/_jsx(SparklineInteractiveMarkerDate, {
|
|
68
|
+
containerOffsetLeft: containerOffsetLeft,
|
|
65
69
|
getFormattedDate: getFormattedDate
|
|
66
70
|
}, i);
|
|
67
71
|
});
|
|
68
|
-
}, [getFormattedDate, numberOfLabels]);
|
|
72
|
+
}, [getFormattedDate, numberOfLabels, containerOffsetLeft]);
|
|
69
73
|
return /*#__PURE__*/_jsx(HStack, {
|
|
70
74
|
ref: setupRef,
|
|
71
75
|
className: fadeInCss,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-web-visualization",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Coinbase Design System - Web Sparkline",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git@github.com:coinbase/cds
|
|
7
|
+
"url": "git@github.com:coinbase/cds.git",
|
|
8
8
|
"directory": "packages/web-visualization"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"CHANGELOG"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@coinbase/cds-common": "
|
|
38
|
-
"@coinbase/cds-lottie-files": "
|
|
39
|
-
"@coinbase/cds-utils": "
|
|
40
|
-
"@coinbase/cds-web": "
|
|
37
|
+
"@coinbase/cds-common": "^8.13.5",
|
|
38
|
+
"@coinbase/cds-lottie-files": "^3.3.1",
|
|
39
|
+
"@coinbase/cds-utils": "^2.3.2",
|
|
40
|
+
"@coinbase/cds-web": "^8.13.5",
|
|
41
41
|
"react": "^18.3.1",
|
|
42
42
|
"react-dom": "^18.3.1"
|
|
43
43
|
},
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"@babel/preset-env": "^7.28.0",
|
|
55
55
|
"@babel/preset-react": "^7.27.1",
|
|
56
56
|
"@babel/preset-typescript": "^7.27.1",
|
|
57
|
-
"@coinbase/cds-common": "
|
|
58
|
-
"@coinbase/cds-lottie-files": "
|
|
59
|
-
"@coinbase/cds-utils": "
|
|
60
|
-
"@coinbase/cds-web": "
|
|
57
|
+
"@coinbase/cds-common": "^8.13.5",
|
|
58
|
+
"@coinbase/cds-lottie-files": "^3.3.1",
|
|
59
|
+
"@coinbase/cds-utils": "^2.3.2",
|
|
60
|
+
"@coinbase/cds-web": "^8.13.5",
|
|
61
61
|
"@figma/code-connect": "^1.3.4",
|
|
62
62
|
"@linaria/core": "^3.0.0-beta.22",
|
|
63
63
|
"@types/react": "^18.3.12",
|
|
64
64
|
"@types/react-dom": "^18.3.1"
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}
|