@coinbase/cds-mcp-server 8.41.0 → 8.42.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.
@@ -714,6 +714,145 @@ By default, Scrubber will show an overlay to de-emphasize future data. You can h
714
714
  </LineChart>
715
715
  ```
716
716
 
717
+ ### Composed Examples
718
+
719
+ #### Percentage Beacon Labels
720
+
721
+ You can use `BeaconLabelComponent` to display a label with the percentage value of the data at the scrubber position.
722
+
723
+ ```jsx
724
+ function PercentageBeaconLabels() {
725
+ const theme = useTheme();
726
+
727
+ const PercentageScrubberBeaconLabel = memo(
728
+ ({ seriesId, color, label, ...props }: ScrubberBeaconLabelProps) => {
729
+ const { getSeriesData, series, fontProvider } = useCartesianChartContext();
730
+ const { scrubberPosition } = useScrubberContext();
731
+
732
+ const seriesData = useMemo(
733
+ () => getLineData(getSeriesData(seriesId)),
734
+ [getSeriesData, seriesId],
735
+ );
736
+
737
+ const dataLength = useMemo(
738
+ () =>
739
+ series?.reduce((max, s) => {
740
+ const data = getSeriesData(s.id);
741
+ return Math.max(max, data?.length ?? 0);
742
+ }, 0) ?? 0,
743
+ [series, getSeriesData],
744
+ );
745
+
746
+ const dataIndex = useDerivedValue(() => {
747
+ return scrubberPosition.value ?? Math.max(0, dataLength - 1);
748
+ }, [scrubberPosition, dataLength]);
749
+
750
+ const labelColor = `rgb(${theme.spectrum.gray0})`;
751
+
752
+ const regularStyle: SkTextStyle = useMemo(
753
+ () => ({
754
+ fontFamilies: ['Inter'],
755
+ fontSize: 14,
756
+ fontStyle: {
757
+ weight: FontWeight.Normal,
758
+ },
759
+ color: Skia.Color(labelColor),
760
+ }),
761
+ [labelColor],
762
+ );
763
+
764
+ const boldStyle: SkTextStyle = useMemo(
765
+ () => ({
766
+ ...regularStyle,
767
+ fontStyle: {
768
+ weight: FontWeight.Bold,
769
+ },
770
+ }),
771
+ [regularStyle],
772
+ );
773
+
774
+ const percentageLabel = useDerivedValue(() => {
775
+ const labelValue = unwrapAnimatedValue(label);
776
+
777
+ if (seriesData !== undefined) {
778
+ const dataAtPosition = seriesData[dataIndex.value];
779
+
780
+ const builder = Skia.ParagraphBuilder.Make(
781
+ { textAlign: TextAlign.Left },
782
+ fontProvider,
783
+ );
784
+
785
+ builder.pushStyle(boldStyle);
786
+ builder.addText(`${dataAtPosition}%`);
787
+ builder.pushStyle(regularStyle);
788
+ builder.addText(` ${labelValue}`);
789
+
790
+ const para = builder.build();
791
+ para.layout(512);
792
+ return para;
793
+ }
794
+
795
+ return labelValue;
796
+ }, [label, seriesData, dataIndex, fontProvider, boldStyle, regularStyle]);
797
+
798
+ return (
799
+ <DefaultScrubberBeaconLabel
800
+ {...props}
801
+ background={color}
802
+ label={percentageLabel}
803
+ seriesId={seriesId}
804
+ />
805
+ );
806
+ },
807
+ );
808
+
809
+ const isLightTheme = theme.activeColorScheme === 'light';
810
+ const background = isLightTheme
811
+ ? `rgb(${theme.spectrum.gray90})`
812
+ : `rgb(${theme.spectrum.gray0})`;
813
+ const scrubberLineStroke = isLightTheme
814
+ ? `rgb(${theme.spectrum.gray0})`
815
+ : `rgb(${theme.spectrum.gray90})`;
816
+
817
+ return (
818
+ <Box borderRadius={300} padding={2} style={{ backgroundColor: background }}>
819
+ <LineChart
820
+ enableScrubbing
821
+ showArea
822
+ areaType="dotted"
823
+ height={200}
824
+ inset={{ bottom: 8, left: 8, top: 8, right: 0 }}
825
+ series={[
826
+ {
827
+ id: 'prices2',
828
+ data: [90, 78, 71, 55, 2, 55, 78, 48, 79, 96, 32, 80, 79, 42],
829
+ color: `rgb(${theme.spectrum.blue40})`,
830
+ label: 'ATL',
831
+ },
832
+ {
833
+ id: 'prices',
834
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
835
+ color: `rgb(${theme.spectrum.chartreuse40})`,
836
+ label: 'NYC',
837
+ },
838
+ ]}
839
+ xAxis={{
840
+ range: ({ min, max }) => ({ min, max: max - 92 }),
841
+ }}
842
+ >
843
+ <Scrubber
844
+ hideOverlay
845
+ idlePulse
846
+ BeaconLabelComponent={PercentageScrubberBeaconLabel}
847
+ beaconStroke={background}
848
+ lineStroke={scrubberLineStroke}
849
+ />
850
+ </LineChart>
851
+ </Box>
852
+ );
853
+ }
854
+ ```
855
+
717
856
  ## Props
718
857
 
719
858
  | Prop | Type | Required | Default | Description |
@@ -725,6 +864,7 @@ By default, Scrubber will show an overlay to de-emphasize future data. You can h
725
864
  | `beaconLabelFont` | `display1 \| display2 \| display3 \| title1 \| title2 \| title3 \| title4 \| headline \| body \| label1 \| label2 \| caption \| legal` | No | `-` | Font style for the beacon labels. |
726
865
  | `beaconLabelHorizontalOffset` | `number` | No | `-` | Horizontal offset for beacon labels from their beacon position. Measured in pixels. |
727
866
  | `beaconLabelMinGap` | `number` | No | `-` | Minimum gap between beacon labels to prevent overlap. Measured in pixels. |
867
+ | `beaconLabelPreferredSide` | `left \| right` | No | `'right'` | Preferred side for beacon labels. |
728
868
  | `beaconStroke` | `string` | No | `theme.color.bg` | Stroke color of the scrubber beacon circle. |
729
869
  | `beaconTransitions` | `{ update?: Transition; pulse?: Transition \| undefined; pulseRepeatDelay?: number \| undefined; } \| undefined` | No | `-` | Transition configuration for the scrubber beacon. |
730
870
  | `hideBeaconLabels` | `boolean` | No | `-` | Hides the beacon labels while keeping the line label visible (if provided). |
@@ -126,12 +126,15 @@
126
126
  - [ContentCell](mobile/components/ContentCell.txt): A versatile cell component for displaying content with optional metadata.
127
127
  - [UpsellCard](mobile/components/UpsellCard.txt): Upsell Cards are used to promote new features, products, or actions within the app. They are part of the upsell framework and aim to drive user engagement and revenue.
128
128
  - [NudgeCard](mobile/components/NudgeCard.txt): A card component designed to encourage users to take essential actions.
129
- - [FloatingAssetCard](mobile/components/FloatingAssetCard.txt): Asset Cards display current and potential future assets, offering a straightforward method to view and manage a customer's holdings. They provide a clear visual and informative overview, simplifying asset management and investment considerations.
129
+ - [MessagingCard](mobile/components/MessagingCard.txt): MessagingCard displays promotional or informational content with two variants: 'upsell' for promoting features with a primary background, and 'nudge' for encouraging actions with an alternate background. It replaces the deprecated NudgeCard and UpsellCard components.
130
+ - [MediaCard](mobile/components/MediaCard.txt): MediaCard displays content with optional media in a contained card layout. Use it to showcase assets, products, or content with a thumbnail, title, subtitle, description, and optional media placement. MediaCard replaces the deprecated FloatingAssetCard and ContainedAssetCard components.
131
+ - [FloatingAssetCard](mobile/components/FloatingAssetCard.txt): Asset Cards display current and potential future assets, offering a straightforward method to view and manage a customer's holdings.
132
+ - [DataCard](mobile/components/DataCard.txt): A flexible card component for displaying data with visualizations like progress bars and circles. It supports horizontal and vertical layouts with customizable thumbnails and title accessories.
130
133
  - [ContentCardHeader](mobile/components/ContentCardHeader.txt): ContentCardHeader is a subcomponent of ContentCard that provides the header section of the card, typically used for the title and subtitle.
131
134
  - [ContentCardFooter](mobile/components/ContentCardFooter.txt): ContentCardFooter is a subcomponent of ContentCard that provides the footer section of the card, typically used for actions or additional information.
132
135
  - [ContentCardBody](mobile/components/ContentCardBody.txt): ContentCardBody is a subcomponent of ContentCard that provides the main content area of the card.
133
- - [ContentCard](mobile/components/ContentCard.txt): A flexible card component for displaying content with header, body, and footer sections.
134
- - [ContainedAssetCard](mobile/components/ContainedAssetCard.txt): Asset Cards display current and potential future assets, offering a straightforward method to view and manage a customer's holdings. They provide a clear visual and informative overview, simplifying asset management and investment considerations.
136
+ - [ContentCard](mobile/components/ContentCard.txt): A flexible, composable card component for displaying rich content with customizable header, body, and footer sections. Use with ContentCardHeader, ContentCardBody, and ContentCardFooter sub-components.
137
+ - [ContainedAssetCard](mobile/components/ContainedAssetCard.txt): Asset Cards display current and potential future assets, offering a straightforward method to view and manage a customer's holdings.
135
138
  - [LottieStatusAnimation](mobile/components/LottieStatusAnimation.txt): A specialized component for displaying trade status animations.
136
139
  - [Lottie](mobile/components/Lottie.txt): Renders After Effects animations as vectors.
137
140