@coinbase/cds-mobile-visualization 0.0.0 → 3.3.0
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/README.md +3 -0
- package/dts/index.d.ts +2 -0
- package/dts/index.d.ts.map +1 -0
- package/dts/sparkline/Counter.d.ts +3 -0
- package/dts/sparkline/Counter.d.ts.map +1 -0
- package/dts/sparkline/Sparkline.d.ts +22 -0
- package/dts/sparkline/Sparkline.d.ts.map +1 -0
- package/dts/sparkline/SparklineArea.d.ts +8 -0
- package/dts/sparkline/SparklineArea.d.ts.map +1 -0
- package/dts/sparkline/SparklineAreaPattern.d.ts +6 -0
- package/dts/sparkline/SparklineAreaPattern.d.ts.map +1 -0
- package/dts/sparkline/SparklineGradient.d.ts +12 -0
- package/dts/sparkline/SparklineGradient.d.ts.map +1 -0
- package/dts/sparkline/__figma__/Sparkline.figma.d.ts +2 -0
- package/dts/sparkline/__figma__/Sparkline.figma.d.ts.map +1 -0
- package/dts/sparkline/__stories__/Sparkline.stories.d.ts +3 -0
- package/dts/sparkline/__stories__/Sparkline.stories.d.ts.map +1 -0
- package/dts/sparkline/__stories__/SparklineGradient.stories.d.ts +3 -0
- package/dts/sparkline/__stories__/SparklineGradient.stories.d.ts.map +1 -0
- package/dts/sparkline/generateSparklineWithId.d.ts +5 -0
- package/dts/sparkline/generateSparklineWithId.d.ts.map +1 -0
- package/dts/sparkline/index.d.ts +6 -0
- package/dts/sparkline/index.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts +18 -0
- package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +162 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts +12 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts +17 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +8 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +12 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts +9 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts +14 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts +11 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts +20 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts +33 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts +23 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts +3 -0
- package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractive.test.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractive.test.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractiveHoverDate.test.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractiveHoverDate.test.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePanGestureHandler.test.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePanGestureHandler.test.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractiveTimeseriesPaths.test.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractiveTimeseriesPaths.test.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/__tests__/useMinMaxTransform.test.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive/__tests__/useMinMaxTransform.test.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts +9 -0
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts +11 -0
- package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts +3 -0
- package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +22 -0
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts +31 -0
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +110 -0
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts +4 -0
- package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive-header/__tests__/useSparklineInteractiveHeaderStyles.test.d.ts +2 -0
- package/dts/sparkline/sparkline-interactive-header/__tests__/useSparklineInteractiveHeaderStyles.test.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts +26 -0
- package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts.map +1 -0
- package/esm/index.js +1 -0
- package/esm/sparkline/Counter.js +45 -0
- package/esm/sparkline/Sparkline.js +51 -0
- package/esm/sparkline/SparklineArea.js +14 -0
- package/esm/sparkline/SparklineAreaPattern.js +36 -0
- package/esm/sparkline/SparklineGradient.js +72 -0
- package/esm/sparkline/__figma__/Sparkline.figma.js +22 -0
- package/esm/sparkline/__stories__/Sparkline.stories.js +120 -0
- package/esm/sparkline/__stories__/SparklineGradient.stories.js +123 -0
- package/esm/sparkline/generateSparklineWithId.js +6 -0
- package/esm/sparkline/index.js +5 -0
- package/esm/sparkline/sparkline-interactive/SparklineAccessibleView.js +75 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +303 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.js +113 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.js +131 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.js +99 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +82 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMinMax.js +103 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.js +104 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePaths.js +53 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.js +124 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveProvider.js +80 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.js +109 -0
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +85 -0
- package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +474 -0
- package/esm/sparkline/sparkline-interactive/useInterruptiblePathAnimation.js +58 -0
- package/esm/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.js +37 -0
- package/esm/sparkline/sparkline-interactive/useMinMaxTransform.js +56 -0
- package/esm/sparkline/sparkline-interactive/useOpacityAnimation.js +23 -0
- package/esm/sparkline/sparkline-interactive/useSparklineInteractiveConstants.js +47 -0
- package/esm/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.js +34 -0
- package/esm/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.js +233 -0
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +104 -0
- package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +555 -0
- package/esm/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.js +117 -0
- package/package.json +64 -5
- package/index.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparklineInteractiveTimeseriesPaths.test.d.ts","sourceRoot":"","sources":["../../../../src/sparkline/sparkline-interactive/__tests__/SparklineInteractiveTimeseriesPaths.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMinMaxTransform.test.d.ts","sourceRoot":"","sources":["../../../../src/sparkline/sparkline-interactive/__tests__/useMinMaxTransform.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
type Params = {
|
|
3
|
+
animationListener: Animated.ValueListenerCallback;
|
|
4
|
+
onInterrupt: () => void;
|
|
5
|
+
ignoreMinMax?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const useInterruptiblePathAnimation: ({ animationListener, onInterrupt, ignoreMinMax, }: Params) => () => void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=useInterruptiblePathAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInterruptiblePathAnimation.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/useInterruptiblePathAnimation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAWxC,KAAK,MAAM,GAAG;IACZ,iBAAiB,EAAE,QAAQ,CAAC,qBAAqB,CAAC;IAClD,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAI,mDAI3C,MAAM,eA4CR,CAAC"}
|
package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInterruptiblePathAnimation.test.disable.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
import type { LayoutRectangle } from 'react-native';
|
|
3
|
+
type MinMaxTransformParams = {
|
|
4
|
+
minMaxLayout: LayoutRectangle;
|
|
5
|
+
x: number;
|
|
6
|
+
transform: Animated.ValueXY;
|
|
7
|
+
opacity: Animated.Value;
|
|
8
|
+
};
|
|
9
|
+
export declare function useMinMaxTransform({ minMaxLayout, x, transform, opacity }: MinMaxTransformParams): void;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=useMinMaxTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMinMaxTransform.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/useMinMaxTransform.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAOpD,KAAK,qBAAqB,GAAG;IAC3B,YAAY,EAAE,eAAe,CAAC;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC5B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;CACzB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,qBAAqB,QAiDhG"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
export declare function useOpacityAnimation(initialValue?: number | undefined, duration?: number | undefined): [Animated.Value, Animated.CompositeAnimation, Animated.CompositeAnimation];
|
|
3
|
+
//# sourceMappingURL=useOpacityAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOpacityAnimation.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/useOpacityAnimation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,mBAAmB,CACjC,YAAY,GAAE,MAAM,GAAG,SAAa,EACpC,QAAQ,GAAE,MAAM,GAAG,SAAwB,GAC1C,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAwB5E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
compact?: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare function useSparklineInteractiveConstants({ compact }: Props): {
|
|
5
|
+
chartHorizontalGutter: number;
|
|
6
|
+
chartWidth: number;
|
|
7
|
+
chartHeight: number;
|
|
8
|
+
chartDimensionStyles: {
|
|
9
|
+
height: number;
|
|
10
|
+
width: number;
|
|
11
|
+
};
|
|
12
|
+
chartMarkerSize: number;
|
|
13
|
+
SparklineInteractiveMinMaxLabelHeight: number;
|
|
14
|
+
SparklineInteractiveMinMaxVerticalGutter: number;
|
|
15
|
+
chartVerticalLineWidth: number;
|
|
16
|
+
xRange: number[];
|
|
17
|
+
yRange: number[];
|
|
18
|
+
startX: number;
|
|
19
|
+
endX: number;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=useSparklineInteractiveConstants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSparklineInteractiveConstants.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/useSparklineInteractiveConstants.ts"],"names":[],"mappings":"AAWA,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,EAAE,OAAe,EAAE,EAAE,KAAK;;;;;;;;;;;;;;;;EAoC1E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare function useSparklineInteractiveLineStyles(): {
|
|
2
|
+
dotStyle: ({
|
|
3
|
+
backgroundColor: string;
|
|
4
|
+
position?: undefined;
|
|
5
|
+
top?: undefined;
|
|
6
|
+
left?: undefined;
|
|
7
|
+
height?: undefined;
|
|
8
|
+
width?: undefined;
|
|
9
|
+
borderRadius?: undefined;
|
|
10
|
+
opacity?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
position: string;
|
|
13
|
+
top: number;
|
|
14
|
+
left: number;
|
|
15
|
+
height: number;
|
|
16
|
+
width: number;
|
|
17
|
+
borderRadius: number;
|
|
18
|
+
opacity: number;
|
|
19
|
+
backgroundColor?: undefined;
|
|
20
|
+
})[];
|
|
21
|
+
lineProps: {
|
|
22
|
+
strokeWidth: number;
|
|
23
|
+
stroke: string;
|
|
24
|
+
x1: number;
|
|
25
|
+
x2: number;
|
|
26
|
+
y1: number;
|
|
27
|
+
y2: number;
|
|
28
|
+
strokeDasharray: number[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=useSparklineInteractiveLineStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSparklineInteractiveLineStyles.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.ts"],"names":[],"mappings":"AAYA,wBAAgB,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BhD"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { SharedProps, SparklineInteractiveHeaderSignVariant, SparklineInteractiveHeaderVariant } from '@coinbase/cds-common/types';
|
|
4
|
+
export * from '@coinbase/cds-common/types/SparklineInteractiveHeaderBaseProps';
|
|
5
|
+
export type SparklineInteractiveSubHead = {
|
|
6
|
+
/**
|
|
7
|
+
* Free form percentage change
|
|
8
|
+
*/
|
|
9
|
+
percent: string;
|
|
10
|
+
/**
|
|
11
|
+
* Sign to denote the change in price
|
|
12
|
+
*/
|
|
13
|
+
sign: SparklineInteractiveHeaderSignVariant;
|
|
14
|
+
/**
|
|
15
|
+
* The variant to use for the price and percentage change
|
|
16
|
+
*/
|
|
17
|
+
variant: SparklineInteractiveHeaderVariant;
|
|
18
|
+
/**
|
|
19
|
+
* Show the dollar amount of price change
|
|
20
|
+
*/
|
|
21
|
+
priceChange?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The accessoryText to show after the price and / or percentage change. An example is "All time"
|
|
24
|
+
*/
|
|
25
|
+
accessoryText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The accessibilityLabel to show for the price and / or percentage change. This should be localized
|
|
28
|
+
* @example
|
|
29
|
+
* // First, configure your i18n strings
|
|
30
|
+
* const messages = defineMessages({
|
|
31
|
+
* subHeadPrefix: {
|
|
32
|
+
* id: `${i18nKey}.subHeadPrefix`,
|
|
33
|
+
* defaultMessage: 'Price increase in the amount of',
|
|
34
|
+
* description: 'A prefix to make it clear which direction the price action was moving',
|
|
35
|
+
* }
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* // then provide the translated string the accessibilityLabel prop
|
|
39
|
+
* messages.subHeadPrefix
|
|
40
|
+
*/
|
|
41
|
+
accessibilityLabel?: string;
|
|
42
|
+
};
|
|
43
|
+
export type SparklineInteractiveHeaderValues = {
|
|
44
|
+
/**
|
|
45
|
+
* Describes what the Header represents e.g. Bitcoin Price
|
|
46
|
+
*/
|
|
47
|
+
label?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Main content of header, this is usually the price
|
|
50
|
+
*/
|
|
51
|
+
title?: React.ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Provides additional information about the title, such as a price change
|
|
54
|
+
*/
|
|
55
|
+
subHead?: SparklineInteractiveSubHead;
|
|
56
|
+
};
|
|
57
|
+
export type SparklineInteractiveHeaderRef = {
|
|
58
|
+
update: (params: SparklineInteractiveHeaderValues) => void;
|
|
59
|
+
};
|
|
60
|
+
export type SparklineInteractiveHeaderProps = SharedProps & {
|
|
61
|
+
/**
|
|
62
|
+
* 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.
|
|
63
|
+
*/
|
|
64
|
+
defaultTitle: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Default label, changing this prop has no effect once the default is rendered.
|
|
67
|
+
*/
|
|
68
|
+
defaultLabel?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Default SubHead, changing this prop has no effect once the default is rendered.
|
|
71
|
+
*/
|
|
72
|
+
defaultSubHead?: SparklineInteractiveSubHead;
|
|
73
|
+
/**
|
|
74
|
+
* Adds a label node that allows React components. If you use this node then you cannot use the text based label that supports updates.
|
|
75
|
+
*/
|
|
76
|
+
labelNode?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* Reduce the font size used for the header itself.
|
|
79
|
+
*/
|
|
80
|
+
compact?: boolean;
|
|
81
|
+
};
|
|
82
|
+
export declare const interpolateSubHeadText: (subHead: SparklineInteractiveSubHead) => string;
|
|
83
|
+
export declare const SparklineInteractiveHeader: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
84
|
+
/**
|
|
85
|
+
* Adds content next to the header. This is useful for interactive buttons
|
|
86
|
+
*/
|
|
87
|
+
trailing?: ReactNode;
|
|
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
|
+
//# sourceMappingURL=SparklineInteractiveHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparklineInteractiveHeader.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqE,MAAM,OAAO,CAAC;AAE1F,OAAO,KAAK,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,EACV,WAAW,EACX,qCAAqC,EACrC,iCAAiC,EAClC,MAAM,4BAA4B,CAAC;AAKpC,cAAc,gEAAgE,CAAC;AAE/E,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE,qCAAqC,CAAC;IAC5C;;OAEG;IACH,OAAO,EAAE,iCAAiC,CAAC;IAC3C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;;;OAcG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,2BAA2B,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,CAAC,MAAM,EAAE,gCAAgC,KAAK,IAAI,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,WAAW,GAAG;IAC1D;;OAEG;IACH,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,2BAA2B,CAAC;IAC7C;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,SAAS,2BAA2B,WAQ1E,CAAC;AAwNF,eAAO,MAAM,0BAA0B;IANrC;;OAEG;eACQ,SAAS;;IAnPpB;;OAEG;kBACW,KAAK,CAAC,SAAS;IAC7B;;OAEG;mBACY,MAAM;IACrB;;OAEG;qBACc,2BAA2B;IAC5C;;OAEG;gBACS,KAAK,CAAC,SAAS;IAC3B;;OAEG;cACO,OAAO;wDAuPlB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparklineInteractiveHeader.figma.d.ts","sourceRoot":"","sources":["../../../../src/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const SparklineInteractiveHeaderWithCustomTitle: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const SparklineInteractiveHeaderScreen: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default SparklineInteractiveHeaderScreen;
|
|
4
|
+
//# sourceMappingURL=SparklineInteractiveHeader.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparklineInteractiveHeader.stories.d.ts","sourceRoot":"","sources":["../../../../src/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.tsx"],"names":[],"mappings":"AA8aA,eAAO,MAAM,yCAAyC,+CAuFrD,CAAC;AAEF,QAAA,MAAM,gCAAgC,+CA2FrC,CAAC;AAEF,eAAe,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparklineInteractiveHeader.test.d.ts","sourceRoot":"","sources":["../../../../src/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSparklineInteractiveHeaderStyles.test.d.ts","sourceRoot":"","sources":["../../../../src/sparkline/sparkline-interactive-header/__tests__/useSparklineInteractiveHeaderStyles.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { StyleProp, TextStyle } from 'react-native';
|
|
2
|
+
import type { SparklineInteractiveSubHead } from './SparklineInteractiveHeader';
|
|
3
|
+
export type SparklineInteractiveSubHeadIconColor = SparklineInteractiveSubHead['variant'];
|
|
4
|
+
export declare const styles: {
|
|
5
|
+
inputReset: {
|
|
6
|
+
padding: number;
|
|
7
|
+
margin: number;
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
overflow: "visible";
|
|
10
|
+
lineHeight: undefined;
|
|
11
|
+
};
|
|
12
|
+
fullWidth: {
|
|
13
|
+
width: "100%";
|
|
14
|
+
};
|
|
15
|
+
tabularNumbers: {
|
|
16
|
+
fontVariant: "tabular-nums"[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function useSparklineInteractiveHeaderStyles(): {
|
|
20
|
+
readonly title: (text: string) => StyleProp<TextStyle>;
|
|
21
|
+
readonly label: StyleProp<TextStyle>;
|
|
22
|
+
readonly subHeadIcon: (color: SparklineInteractiveSubHeadIconColor) => StyleProp<TextStyle>;
|
|
23
|
+
readonly subHead: (color: SparklineInteractiveSubHeadIconColor, useFullWidth?: boolean) => StyleProp<TextStyle>;
|
|
24
|
+
readonly subHeadAccessory: () => StyleProp<TextStyle>;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useSparklineInteractiveHeaderStyles.d.ts.map
|
package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSparklineInteractiveHeaderStyles.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAEhF,MAAM,MAAM,oCAAoC,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;AA0B1F,eAAO,MAAM,MAAM;;;;;;;;;;;;;;CAejB,CAAC;AAEH,wBAAgB,mCAAmC;2BA+B/B,MAAM,KAAG,SAAS,CAAC,SAAS,CAAC;oBA+BtC,SAAS,CAAC,SAAS,CAAC;kCAEJ,oCAAoC,KAAG,SAAS,CAAC,SAAS,CAAC;8BAYvE,oCAAoC,6BAE1C,SAAS,CAAC,SAAS,CAAC;qCAUD,SAAS,CAAC,SAAS,CAAC;EAqB/C"}
|
package/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sparkline';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import { useCounter } from '@coinbase/cds-common/visualizations/useCounter';
|
|
4
|
+
import { Box } from '@coinbase/cds-mobile/layout';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
hidden: {
|
|
8
|
+
opacity: 0
|
|
9
|
+
},
|
|
10
|
+
visible: {
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
top: 0,
|
|
13
|
+
left: 0,
|
|
14
|
+
display: 'flex'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export const Counter = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
startNum,
|
|
20
|
+
endNum,
|
|
21
|
+
renderNum,
|
|
22
|
+
durationInMillis
|
|
23
|
+
} = _ref;
|
|
24
|
+
const count = useCounter({
|
|
25
|
+
startNum,
|
|
26
|
+
endNum,
|
|
27
|
+
durationInMillis
|
|
28
|
+
});
|
|
29
|
+
const renderFunction = useMemo(() => {
|
|
30
|
+
return num => {
|
|
31
|
+
return renderNum ? renderNum(num) : num;
|
|
32
|
+
};
|
|
33
|
+
}, [renderNum]);
|
|
34
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
35
|
+
alignSelf: "flex-start",
|
|
36
|
+
justifyContent: "center",
|
|
37
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
38
|
+
style: styles.hidden,
|
|
39
|
+
children: renderFunction(endNum)
|
|
40
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
41
|
+
style: styles.visible,
|
|
42
|
+
children: renderFunction(count)
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { memo, useRef } from 'react';
|
|
3
|
+
import { Defs, G, Path, Svg } from 'react-native-svg';
|
|
4
|
+
import { borderWidth } from '@coinbase/cds-common/tokens/sparkline';
|
|
5
|
+
import { getAccessibleColor } from '@coinbase/cds-common/utils/getAccessibleColor';
|
|
6
|
+
import { getSparklineTransform } from '@coinbase/cds-common/visualizations/getSparklineTransform';
|
|
7
|
+
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
8
|
+
import { generateRandomId } from '@coinbase/cds-utils';
|
|
9
|
+
import { generateSparklineAreaWithId } from './generateSparklineWithId';
|
|
10
|
+
import { SparklineAreaPattern } from './SparklineAreaPattern';
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
export const Sparkline = /*#__PURE__*/memo(_ref => {
|
|
13
|
+
let {
|
|
14
|
+
background,
|
|
15
|
+
color,
|
|
16
|
+
height,
|
|
17
|
+
path,
|
|
18
|
+
width,
|
|
19
|
+
yAxisScalingFactor,
|
|
20
|
+
children
|
|
21
|
+
} = _ref;
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const patternId = useRef(generateRandomId());
|
|
24
|
+
const stroke = color !== 'auto' ? color : getAccessibleColor({
|
|
25
|
+
background: background != null ? background : theme.color.bg,
|
|
26
|
+
foreground: 'auto',
|
|
27
|
+
usage: 'graphic'
|
|
28
|
+
});
|
|
29
|
+
const translateProps = getSparklineTransform(width, height, yAxisScalingFactor);
|
|
30
|
+
const defs = children ? /*#__PURE__*/_jsx(Defs, {
|
|
31
|
+
children: /*#__PURE__*/_jsx(SparklineAreaPattern, {
|
|
32
|
+
color: stroke,
|
|
33
|
+
id: patternId.current
|
|
34
|
+
})
|
|
35
|
+
}) : null;
|
|
36
|
+
return /*#__PURE__*/_jsxs(Svg, {
|
|
37
|
+
fill: "none",
|
|
38
|
+
height: height,
|
|
39
|
+
width: width,
|
|
40
|
+
children: [defs, /*#__PURE__*/_jsxs(G, _extends({}, translateProps, {
|
|
41
|
+
children: [/*#__PURE__*/_jsx(Path, {
|
|
42
|
+
d: path,
|
|
43
|
+
stroke: stroke,
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeLinejoin: "round",
|
|
46
|
+
strokeWidth: borderWidth
|
|
47
|
+
}), generateSparklineAreaWithId(patternId.current, children)]
|
|
48
|
+
}))]
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
Sparkline.displayName = 'Sparkline';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { forwardRef, memo } from 'react';
|
|
2
|
+
import { Path } from 'react-native-svg';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export const SparklineArea = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
5
|
+
let {
|
|
6
|
+
area,
|
|
7
|
+
patternId
|
|
8
|
+
} = _ref;
|
|
9
|
+
return /*#__PURE__*/_jsx(Path, {
|
|
10
|
+
ref: ref,
|
|
11
|
+
d: area,
|
|
12
|
+
fill: "url(#" + patternId + ")"
|
|
13
|
+
});
|
|
14
|
+
}));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Circle, G, Pattern, Rect } from 'react-native-svg';
|
|
3
|
+
import { useSparklineAreaOpacity } from '@coinbase/cds-common/visualizations/useSparklineAreaOpacity';
|
|
4
|
+
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export const SparklineAreaPattern = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
color,
|
|
9
|
+
id
|
|
10
|
+
} = _ref;
|
|
11
|
+
const {
|
|
12
|
+
activeColorScheme
|
|
13
|
+
} = useTheme();
|
|
14
|
+
const fillOpacity = useSparklineAreaOpacity(activeColorScheme);
|
|
15
|
+
return /*#__PURE__*/_jsx(Pattern, {
|
|
16
|
+
height: "4",
|
|
17
|
+
id: id,
|
|
18
|
+
patternUnits: "userSpaceOnUse",
|
|
19
|
+
width: "4",
|
|
20
|
+
x: "0",
|
|
21
|
+
y: "0",
|
|
22
|
+
children: /*#__PURE__*/_jsxs(G, {
|
|
23
|
+
children: [/*#__PURE__*/_jsx(Rect, {
|
|
24
|
+
fill: "transparent",
|
|
25
|
+
height: "4",
|
|
26
|
+
width: "4"
|
|
27
|
+
}), /*#__PURE__*/_jsx(Circle, {
|
|
28
|
+
cx: "1",
|
|
29
|
+
cy: "1",
|
|
30
|
+
fill: color,
|
|
31
|
+
fillOpacity: fillOpacity,
|
|
32
|
+
r: "1"
|
|
33
|
+
})]
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { forwardRef, memo, useMemo, useRef } from 'react';
|
|
3
|
+
import { Defs, G, LinearGradient, Path, Stop, Svg } from 'react-native-svg';
|
|
4
|
+
import { getAccessibleForegroundGradient } from '@coinbase/cds-common/color/getAccessibleForegroundGradient';
|
|
5
|
+
import { borderWidth } from '@coinbase/cds-common/tokens/sparkline';
|
|
6
|
+
import { getAccessibleColor } from '@coinbase/cds-common/utils/getAccessibleColor';
|
|
7
|
+
import { getSparklineTransform } from '@coinbase/cds-common/visualizations/getSparklineTransform';
|
|
8
|
+
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
9
|
+
import { generateRandomId } from '@coinbase/cds-utils';
|
|
10
|
+
import { generateSparklineAreaWithId } from './generateSparklineWithId';
|
|
11
|
+
import { SparklineAreaPattern } from './SparklineAreaPattern';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export const SparklineGradient = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
14
|
+
let {
|
|
15
|
+
background,
|
|
16
|
+
color,
|
|
17
|
+
path,
|
|
18
|
+
height,
|
|
19
|
+
width,
|
|
20
|
+
yAxisScalingFactor,
|
|
21
|
+
children
|
|
22
|
+
} = _ref;
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const patternId = useRef(generateRandomId());
|
|
25
|
+
const translateProps = getSparklineTransform(width, height, yAxisScalingFactor);
|
|
26
|
+
const gradient = getAccessibleForegroundGradient({
|
|
27
|
+
background: background != null ? background : theme.color.bg,
|
|
28
|
+
color,
|
|
29
|
+
colorScheme: theme.activeColorScheme,
|
|
30
|
+
usage: 'graphic'
|
|
31
|
+
});
|
|
32
|
+
const areaColor = color !== 'auto' ? color : getAccessibleColor({
|
|
33
|
+
background: background != null ? background : theme.color.bg,
|
|
34
|
+
foreground: 'auto',
|
|
35
|
+
usage: 'graphic'
|
|
36
|
+
});
|
|
37
|
+
const hasChildren = !!children;
|
|
38
|
+
const linearGradient = useMemo(() => {
|
|
39
|
+
return /*#__PURE__*/_jsxs(Defs, {
|
|
40
|
+
children: [/*#__PURE__*/_jsx(LinearGradient, {
|
|
41
|
+
id: "gradient",
|
|
42
|
+
x1: "0%",
|
|
43
|
+
x2: "100%",
|
|
44
|
+
y1: "0%",
|
|
45
|
+
y2: "0%",
|
|
46
|
+
children: gradient.map((item, i) => /*#__PURE__*/_jsx(Stop, {
|
|
47
|
+
offset: item.offset,
|
|
48
|
+
stopColor: item.color
|
|
49
|
+
}, i + "_" + item))
|
|
50
|
+
}), hasChildren && /*#__PURE__*/_jsx(SparklineAreaPattern, {
|
|
51
|
+
color: areaColor,
|
|
52
|
+
id: patternId.current
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}, [areaColor, hasChildren, gradient]);
|
|
56
|
+
return /*#__PURE__*/_jsxs(Svg, {
|
|
57
|
+
fill: "none",
|
|
58
|
+
height: height,
|
|
59
|
+
width: width,
|
|
60
|
+
children: [linearGradient, /*#__PURE__*/_jsxs(G, _extends({}, translateProps, {
|
|
61
|
+
children: [/*#__PURE__*/_jsx(Path, {
|
|
62
|
+
ref: ref,
|
|
63
|
+
d: path,
|
|
64
|
+
stroke: "url(#gradient)",
|
|
65
|
+
strokeLinecap: "round",
|
|
66
|
+
strokeLinejoin: "round",
|
|
67
|
+
strokeWidth: borderWidth
|
|
68
|
+
}), generateSparklineAreaWithId(patternId.current, children)]
|
|
69
|
+
}))]
|
|
70
|
+
});
|
|
71
|
+
}));
|
|
72
|
+
SparklineGradient.displayName = 'SparklineGradient';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath';
|
|
3
|
+
import { figma } from '@figma/code-connect';
|
|
4
|
+
import { Sparkline } from '../Sparkline';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
figma.connect(Sparkline, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/%E2%9C%A8-CDS-Components?node-id=320%3A15040', {
|
|
7
|
+
imports: ["import { Sparkline } from '@coinbase/cds-mobile-visualization';", "import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath';"],
|
|
8
|
+
example: function Example() {
|
|
9
|
+
const data = [20, 30, 5, 45, 0];
|
|
10
|
+
const path = useSparklinePath({
|
|
11
|
+
height: 200,
|
|
12
|
+
width: 200,
|
|
13
|
+
data
|
|
14
|
+
});
|
|
15
|
+
return /*#__PURE__*/_jsx(Sparkline, {
|
|
16
|
+
color: "auto",
|
|
17
|
+
height: 200,
|
|
18
|
+
path: path,
|
|
19
|
+
width: 400
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|