@coinbase/cds-mobile 8.66.2 → 9.0.0-rc.1
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 +6 -0
- package/README.md +2 -3
- package/dts/accordion/AccordionHeader.d.ts +16 -18
- package/dts/accordion/AccordionHeader.d.ts.map +1 -1
- package/dts/accordion/AccordionItem.d.ts +2 -2
- package/dts/accordion/AccordionItem.d.ts.map +1 -1
- package/dts/accordion/AccordionPanel.d.ts +10 -12
- package/dts/accordion/AccordionPanel.d.ts.map +1 -1
- package/dts/alpha/carousel/Carousel.d.ts +27 -29
- package/dts/alpha/carousel/Carousel.d.ts.map +1 -1
- package/dts/alpha/carousel/useCarousel.d.ts +1 -1
- package/dts/alpha/carousel/useCarousel.d.ts.map +1 -1
- package/dts/alpha/combobox/Combobox.d.ts +1 -1
- package/dts/alpha/combobox/Combobox.d.ts.map +1 -1
- package/dts/alpha/combobox/DefaultComboboxControl.d.ts +1 -0
- package/dts/alpha/combobox/DefaultComboboxControl.d.ts.map +1 -1
- package/dts/alpha/data-card/DataCard.d.ts +15 -17
- package/dts/alpha/data-card/DataCard.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectControl.d.ts +45 -49
- package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectDropdown.d.ts.map +1 -1
- package/dts/alpha/select/DefaultSelectOption.d.ts.map +1 -1
- package/dts/alpha/select/types.d.ts +5 -4
- package/dts/alpha/select/types.d.ts.map +1 -1
- package/dts/animation/Lottie.d.ts +36 -38
- package/dts/animation/Lottie.d.ts.map +1 -1
- package/dts/animation/LottieStatusAnimation.d.ts +1 -1
- package/dts/animation/LottieStatusAnimation.d.ts.map +1 -1
- package/dts/animation/createLottie.d.ts +1 -1
- package/dts/animation/createLottie.d.ts.map +1 -1
- package/dts/banner/Banner.d.ts +120 -51
- package/dts/banner/Banner.d.ts.map +1 -1
- package/dts/buttons/AvatarButton.d.ts +90 -3
- package/dts/buttons/AvatarButton.d.ts.map +1 -1
- package/dts/buttons/Button.d.ts +63 -66
- package/dts/buttons/Button.d.ts.map +1 -1
- package/dts/buttons/DefaultSlideButtonBackground.d.ts +17 -19
- package/dts/buttons/DefaultSlideButtonBackground.d.ts.map +1 -1
- package/dts/buttons/DefaultSlideButtonHandle.d.ts +36 -28
- package/dts/buttons/DefaultSlideButtonHandle.d.ts.map +1 -1
- package/dts/buttons/IconButton.d.ts +22 -24
- package/dts/buttons/IconButton.d.ts.map +1 -1
- package/dts/buttons/IconCounterButton.d.ts +37 -25
- package/dts/buttons/IconCounterButton.d.ts.map +1 -1
- package/dts/buttons/SlideButton.d.ts +110 -106
- package/dts/buttons/SlideButton.d.ts.map +1 -1
- package/dts/cards/AnnouncementCard.d.ts +2 -6
- package/dts/cards/AnnouncementCard.d.ts.map +1 -1
- package/dts/cards/Card.d.ts +4 -0
- package/dts/cards/Card.d.ts.map +1 -1
- package/dts/cards/CardGroup.d.ts +17 -19
- package/dts/cards/CardGroup.d.ts.map +1 -1
- package/dts/cards/CardMedia.d.ts.map +1 -1
- package/dts/cards/CardRoot.d.ts +5 -7
- package/dts/cards/CardRoot.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCard.d.ts +3 -5
- package/dts/cards/ContentCard/ContentCard.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCardBody.d.ts +62 -65
- package/dts/cards/ContentCard/ContentCardBody.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCardFooter.d.ts +21 -24
- package/dts/cards/ContentCard/ContentCardFooter.d.ts.map +1 -1
- package/dts/cards/ContentCard/ContentCardHeader.d.ts +50 -53
- package/dts/cards/ContentCard/ContentCardHeader.d.ts.map +1 -1
- package/dts/cards/DataCard.d.ts.map +1 -1
- package/dts/cards/FeatureEntryCard.d.ts +2 -6
- package/dts/cards/FeatureEntryCard.d.ts.map +1 -1
- package/dts/cards/FeedCard.d.ts +2 -10
- package/dts/cards/FeedCard.d.ts.map +1 -1
- package/dts/cards/LikeButton.d.ts +1 -1
- package/dts/cards/LikeButton.d.ts.map +1 -1
- package/dts/cards/MediaCard/index.d.ts +13 -15
- package/dts/cards/MediaCard/index.d.ts.map +1 -1
- package/dts/cards/MessagingCard/index.d.ts +8 -10
- package/dts/cards/MessagingCard/index.d.ts.map +1 -1
- package/dts/cards/NudgeCard.d.ts +5 -1
- package/dts/cards/NudgeCard.d.ts.map +1 -1
- package/dts/cards/UpsellCard.d.ts +6 -2
- package/dts/cards/UpsellCard.d.ts.map +1 -1
- package/dts/carousel/Carousel.d.ts +156 -167
- package/dts/carousel/Carousel.d.ts.map +1 -1
- package/dts/carousel/DefaultCarouselPagination.d.ts.map +1 -1
- package/dts/cells/Cell.d.ts +3 -2
- package/dts/cells/Cell.d.ts.map +1 -1
- package/dts/cells/ContentCellFallback.d.ts +4 -0
- package/dts/cells/ContentCellFallback.d.ts.map +1 -1
- package/dts/cells/ListCell.d.ts.map +1 -1
- package/dts/chips/Chip.d.ts +19 -21
- package/dts/chips/Chip.d.ts.map +1 -1
- package/dts/chips/ChipProps.d.ts +2 -6
- package/dts/chips/ChipProps.d.ts.map +1 -1
- package/dts/chips/InputChip.d.ts +21 -23
- package/dts/chips/InputChip.d.ts.map +1 -1
- package/dts/chips/MediaChip.d.ts +19 -21
- package/dts/chips/MediaChip.d.ts.map +1 -1
- package/dts/chips/SelectChip.d.ts +8 -10
- package/dts/chips/SelectChip.d.ts.map +1 -1
- package/dts/coachmark/Coachmark.d.ts +56 -59
- package/dts/coachmark/Coachmark.d.ts.map +1 -1
- package/dts/collapsible/Collapsible.d.ts +30 -32
- package/dts/collapsible/Collapsible.d.ts.map +1 -1
- package/dts/controls/CheckboxGroup.d.ts +2 -29
- package/dts/controls/CheckboxGroup.d.ts.map +1 -1
- package/dts/controls/HelperText.d.ts +7 -0
- package/dts/controls/HelperText.d.ts.map +1 -1
- package/dts/controls/InputIconButton.d.ts +18 -20
- package/dts/controls/InputIconButton.d.ts.map +1 -1
- package/dts/controls/InputStack.d.ts +10 -1
- package/dts/controls/InputStack.d.ts.map +1 -1
- package/dts/controls/NativeInput.d.ts +33 -35
- package/dts/controls/NativeInput.d.ts.map +1 -1
- package/dts/controls/RadioGroup.d.ts +2 -23
- package/dts/controls/RadioGroup.d.ts.map +1 -1
- package/dts/controls/SearchInput.d.ts +99 -101
- package/dts/controls/SearchInput.d.ts.map +1 -1
- package/dts/controls/Select.d.ts +23 -25
- package/dts/controls/Select.d.ts.map +1 -1
- package/dts/controls/SelectContext.d.ts +12 -0
- package/dts/controls/SelectContext.d.ts.map +1 -1
- package/dts/controls/SelectOption.d.ts +5 -2
- package/dts/controls/SelectOption.d.ts.map +1 -1
- package/dts/controls/Switch.d.ts +45 -5
- package/dts/controls/Switch.d.ts.map +1 -1
- package/dts/controls/TextInput.d.ts +82 -81
- package/dts/controls/TextInput.d.ts.map +1 -1
- package/dts/dates/Calendar.d.ts +63 -65
- package/dts/dates/Calendar.d.ts.map +1 -1
- package/dts/dates/DateInput.d.ts +8 -10
- package/dts/dates/DateInput.d.ts.map +1 -1
- package/dts/dates/DatePicker.d.ts +73 -75
- package/dts/dates/DatePicker.d.ts.map +1 -1
- package/dts/dots/DotCount.d.ts +12 -0
- package/dts/dots/DotCount.d.ts.map +1 -1
- package/dts/examples/ExampleScreen.d.ts +22 -22
- package/dts/examples/ExampleScreen.d.ts.map +1 -1
- package/dts/gradients/LinearGradient.d.ts +0 -8
- package/dts/gradients/LinearGradient.d.ts.map +1 -1
- package/dts/hooks/useA11y.d.ts +1 -1
- package/dts/hooks/useA11y.d.ts.map +1 -1
- package/dts/hooks/useAppState.d.ts.map +1 -1
- package/dts/hooks/useCellSpacing.d.ts +26 -26
- package/dts/hooks/useDimensions.d.ts +1 -1
- package/dts/hooks/useDimensions.d.ts.map +1 -1
- package/dts/hooks/useDotPinStyles.d.ts +24 -0
- package/dts/hooks/useDotPinStyles.d.ts.map +1 -1
- package/dts/hooks/useHasNotch.d.ts +4 -0
- package/dts/hooks/useHasNotch.d.ts.map +1 -1
- package/dts/hooks/useHorizontalScrollToTarget.d.ts +1 -1
- package/dts/hooks/useHorizontallyScrollingPressables.d.ts +1 -1
- package/dts/hooks/useStatusBarHeight.d.ts +2 -1
- package/dts/hooks/useStatusBarHeight.d.ts.map +1 -1
- package/dts/icons/Icon.d.ts +16 -1
- package/dts/icons/Icon.d.ts.map +1 -1
- package/dts/icons/TextIcon.d.ts.map +1 -1
- package/dts/layout/Box.d.ts +38 -36
- package/dts/layout/Box.d.ts.map +1 -1
- package/dts/layout/Fallback.d.ts +2 -1
- package/dts/layout/Fallback.d.ts.map +1 -1
- package/dts/layout/Group.d.ts +36 -38
- package/dts/layout/Group.d.ts.map +1 -1
- package/dts/layout/HStack.d.ts +3 -5
- package/dts/layout/HStack.d.ts.map +1 -1
- package/dts/layout/Spacer.d.ts.map +1 -1
- package/dts/layout/VStack.d.ts +3 -5
- package/dts/layout/VStack.d.ts.map +1 -1
- package/dts/media/Avatar.d.ts.map +1 -1
- package/dts/media/Carousel/Carousel.d.ts +12 -14
- package/dts/media/Carousel/Carousel.d.ts.map +1 -1
- package/dts/media/Carousel/useCarousel.d.ts +1 -1
- package/dts/media/Carousel/useCarousel.d.ts.map +1 -1
- package/dts/media/RemoteImage.d.ts +1 -1
- package/dts/media/RemoteImage.d.ts.map +1 -1
- package/dts/media/RemoteImageGroup.d.ts.map +1 -1
- package/dts/motion/ColorSurge.d.ts +8 -10
- package/dts/motion/ColorSurge.d.ts.map +1 -1
- package/dts/motion/Pulse.d.ts +21 -23
- package/dts/motion/Pulse.d.ts.map +1 -1
- package/dts/motion/Shake.d.ts +4 -6
- package/dts/motion/Shake.d.ts.map +1 -1
- package/dts/motion/convertMotionConfig.d.ts +8 -24
- package/dts/motion/convertMotionConfig.d.ts.map +1 -1
- package/dts/multi-content-module/MultiContentModule.d.ts +6 -8
- package/dts/multi-content-module/MultiContentModule.d.ts.map +1 -1
- package/dts/navigation/NavigationTitleSelect.d.ts.map +1 -1
- package/dts/numbers/RollingNumber/RollingNumber.d.ts +142 -144
- package/dts/numbers/RollingNumber/RollingNumber.d.ts.map +1 -1
- package/dts/numpad/Numpad.d.ts +10 -13
- package/dts/numpad/Numpad.d.ts.map +1 -1
- package/dts/overlays/Alert.d.ts +45 -47
- package/dts/overlays/Alert.d.ts.map +1 -1
- package/dts/overlays/PortalProvider.d.ts +20 -0
- package/dts/overlays/PortalProvider.d.ts.map +1 -1
- package/dts/overlays/Toast.d.ts +27 -30
- package/dts/overlays/Toast.d.ts.map +1 -1
- package/dts/overlays/drawer/Drawer.d.ts +83 -87
- package/dts/overlays/drawer/Drawer.d.ts.map +1 -1
- package/dts/overlays/drawer/DrawerStatusBar.d.ts +4 -0
- package/dts/overlays/drawer/DrawerStatusBar.d.ts.map +1 -1
- package/dts/overlays/modal/Modal.d.ts +20 -22
- package/dts/overlays/modal/Modal.d.ts.map +1 -1
- package/dts/overlays/modal/ModalFooter.d.ts.map +1 -1
- package/dts/overlays/overlay/Overlay.d.ts.map +1 -1
- package/dts/overlays/tooltip/useTooltipPosition.d.ts.map +1 -1
- package/dts/overlays/tray/Tray.d.ts +33 -37
- package/dts/overlays/tray/Tray.d.ts.map +1 -1
- package/dts/overlays/useModal.d.ts +1 -1
- package/dts/page/PageFooter.d.ts +31 -33
- package/dts/page/PageFooter.d.ts.map +1 -1
- package/dts/page/PageHeader.d.ts +50 -52
- package/dts/page/PageHeader.d.ts.map +1 -1
- package/dts/section-header/SectionHeader.d.ts +13 -15
- package/dts/section-header/SectionHeader.d.ts.map +1 -1
- package/dts/stepper/DefaultStepperHeaderHorizontal.d.ts.map +1 -1
- package/dts/stepper/DefaultStepperProgressHorizontal.d.ts.map +1 -1
- package/dts/stepper/DefaultStepperProgressVertical.d.ts.map +1 -1
- package/dts/stepper/Stepper.d.ts +22 -14
- package/dts/stepper/Stepper.d.ts.map +1 -1
- package/dts/sticky-footer/StickyFooter.d.ts +10 -12
- package/dts/sticky-footer/StickyFooter.d.ts.map +1 -1
- package/dts/styles/styleProps.d.ts +7 -3
- package/dts/styles/styleProps.d.ts.map +1 -1
- package/dts/system/AndroidNavigationBar.d.ts +17 -0
- package/dts/system/AndroidNavigationBar.d.ts.map +1 -1
- package/dts/system/Pressable.d.ts +35 -37
- package/dts/system/Pressable.d.ts.map +1 -1
- package/dts/system/ThemeProvider.d.ts +14 -8
- package/dts/system/ThemeProvider.d.ts.map +1 -1
- package/dts/tabs/DefaultTab.d.ts +15 -17
- package/dts/tabs/DefaultTab.d.ts.map +1 -1
- package/dts/tabs/TabIndicator.d.ts +11 -13
- package/dts/tabs/TabIndicator.d.ts.map +1 -1
- package/dts/tabs/Tabs.d.ts.map +1 -1
- package/dts/tabs/hooks/useDotAnimation.d.ts +30 -0
- package/dts/tabs/hooks/useDotAnimation.d.ts.map +1 -1
- package/dts/tag/Tag.d.ts +40 -42
- package/dts/tag/Tag.d.ts.map +1 -1
- package/dts/tour/DefaultTourMask.d.ts.map +1 -1
- package/dts/tour/DefaultTourStepArrow.d.ts +2 -2
- package/dts/tour/DefaultTourStepArrow.d.ts.map +1 -1
- package/dts/tour/Tour.d.ts.map +1 -1
- package/dts/tour/TourStep.d.ts.map +1 -1
- package/dts/typography/Text.d.ts +74 -64
- package/dts/typography/Text.d.ts.map +1 -1
- package/dts/typography/TextBody.d.ts +34 -24
- package/dts/typography/TextBody.d.ts.map +1 -1
- package/dts/typography/TextCaption.d.ts +34 -24
- package/dts/typography/TextCaption.d.ts.map +1 -1
- package/dts/typography/TextDisplay1.d.ts +34 -24
- package/dts/typography/TextDisplay1.d.ts.map +1 -1
- package/dts/typography/TextDisplay2.d.ts +34 -24
- package/dts/typography/TextDisplay2.d.ts.map +1 -1
- package/dts/typography/TextDisplay3.d.ts +34 -24
- package/dts/typography/TextDisplay3.d.ts.map +1 -1
- package/dts/typography/TextHeadline.d.ts +34 -24
- package/dts/typography/TextHeadline.d.ts.map +1 -1
- package/dts/typography/TextInherited.d.ts +34 -24
- package/dts/typography/TextInherited.d.ts.map +1 -1
- package/dts/typography/TextLabel1.d.ts +34 -24
- package/dts/typography/TextLabel1.d.ts.map +1 -1
- package/dts/typography/TextLabel2.d.ts +34 -24
- package/dts/typography/TextLabel2.d.ts.map +1 -1
- package/dts/typography/TextLegal.d.ts +34 -24
- package/dts/typography/TextLegal.d.ts.map +1 -1
- package/dts/typography/TextTitle1.d.ts +34 -24
- package/dts/typography/TextTitle1.d.ts.map +1 -1
- package/dts/typography/TextTitle2.d.ts +34 -24
- package/dts/typography/TextTitle2.d.ts.map +1 -1
- package/dts/typography/TextTitle3.d.ts +34 -24
- package/dts/typography/TextTitle3.d.ts.map +1 -1
- package/dts/typography/TextTitle4.d.ts +34 -24
- package/dts/typography/TextTitle4.d.ts.map +1 -1
- package/dts/utils/flattenAndJoinNodes.d.ts +13 -1
- package/dts/utils/flattenAndJoinNodes.d.ts.map +1 -1
- package/dts/utils/testHelpers.d.ts +5 -0
- package/dts/utils/testHelpers.d.ts.map +1 -1
- package/dts/visualizations/ProgressBar.d.ts +37 -39
- package/dts/visualizations/ProgressBar.d.ts.map +1 -1
- package/dts/visualizations/ProgressCircle.d.ts +54 -56
- package/dts/visualizations/ProgressCircle.d.ts.map +1 -1
- package/dts/visualizations/ProgressIndicator.d.ts +25 -28
- package/dts/visualizations/ProgressIndicator.d.ts.map +1 -1
- package/dts/visualizations/VisualizationContainer.d.ts +1 -1
- package/dts/visualizations/VisualizationContainer.d.ts.map +1 -1
- package/dts/visualizations/chart/CartesianChart.d.ts +204 -0
- package/dts/visualizations/chart/CartesianChart.d.ts.map +1 -0
- package/dts/visualizations/chart/ChartContextBridge.d.ts +28 -0
- package/dts/visualizations/chart/ChartContextBridge.d.ts.map +1 -0
- package/dts/visualizations/chart/ChartProvider.d.ts +9 -0
- package/dts/visualizations/chart/ChartProvider.d.ts.map +1 -0
- package/dts/visualizations/chart/Path.d.ts +122 -0
- package/dts/visualizations/chart/Path.d.ts.map +1 -0
- package/dts/visualizations/chart/PeriodSelector.d.ts +93 -0
- package/dts/visualizations/chart/PeriodSelector.d.ts.map +1 -0
- package/dts/visualizations/chart/area/Area.d.ts +83 -0
- package/dts/visualizations/chart/area/Area.d.ts.map +1 -0
- package/dts/visualizations/chart/area/AreaChart.d.ts +153 -0
- package/dts/visualizations/chart/area/AreaChart.d.ts.map +1 -0
- package/dts/visualizations/chart/area/DottedArea.d.ts +46 -0
- package/dts/visualizations/chart/area/DottedArea.d.ts.map +1 -0
- package/dts/visualizations/chart/area/GradientArea.d.ts +36 -0
- package/dts/visualizations/chart/area/GradientArea.d.ts.map +1 -0
- package/dts/visualizations/chart/area/SolidArea.d.ts +23 -0
- package/dts/visualizations/chart/area/SolidArea.d.ts.map +1 -0
- package/dts/visualizations/chart/area/index.d.ts +6 -0
- package/dts/visualizations/chart/area/index.d.ts.map +1 -0
- package/dts/visualizations/chart/axis/Axis.d.ts +174 -0
- package/dts/visualizations/chart/axis/Axis.d.ts.map +1 -0
- package/dts/visualizations/chart/axis/DefaultAxisTickLabel.d.ts +8 -0
- package/dts/visualizations/chart/axis/DefaultAxisTickLabel.d.ts.map +1 -0
- package/dts/visualizations/chart/axis/XAxis.d.ts +22 -0
- package/dts/visualizations/chart/axis/XAxis.d.ts.map +1 -0
- package/dts/visualizations/chart/axis/YAxis.d.ts +22 -0
- package/dts/visualizations/chart/axis/YAxis.d.ts.map +1 -0
- package/dts/visualizations/chart/axis/index.d.ts +5 -0
- package/dts/visualizations/chart/axis/index.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/Bar.d.ts +100 -0
- package/dts/visualizations/chart/bar/Bar.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/BarChart.d.ts +156 -0
- package/dts/visualizations/chart/bar/BarChart.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/BarPlot.d.ts +31 -0
- package/dts/visualizations/chart/bar/BarPlot.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/BarStack.d.ts +127 -0
- package/dts/visualizations/chart/bar/BarStack.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/BarStackGroup.d.ts +37 -0
- package/dts/visualizations/chart/bar/BarStackGroup.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/DefaultBar.d.ts +7 -0
- package/dts/visualizations/chart/bar/DefaultBar.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/DefaultBarStack.d.ts +7 -0
- package/dts/visualizations/chart/bar/DefaultBarStack.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/PercentageBarChart.d.ts +104 -0
- package/dts/visualizations/chart/bar/PercentageBarChart.d.ts.map +1 -0
- package/dts/visualizations/chart/bar/index.d.ts +9 -0
- package/dts/visualizations/chart/bar/index.d.ts.map +1 -0
- package/dts/visualizations/chart/gradient/Gradient.d.ts +41 -0
- package/dts/visualizations/chart/gradient/Gradient.d.ts.map +1 -0
- package/dts/visualizations/chart/gradient/index.d.ts +2 -0
- package/dts/visualizations/chart/gradient/index.d.ts.map +1 -0
- package/dts/visualizations/chart/index.d.ts +16 -0
- package/dts/visualizations/chart/index.d.ts.map +1 -0
- package/dts/visualizations/chart/legend/DefaultLegendEntry.d.ts +5 -0
- package/dts/visualizations/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
- package/dts/visualizations/chart/legend/DefaultLegendShape.d.ts +5 -0
- package/dts/visualizations/chart/legend/DefaultLegendShape.d.ts.map +1 -0
- package/dts/visualizations/chart/legend/Legend.d.ts +166 -0
- package/dts/visualizations/chart/legend/Legend.d.ts.map +1 -0
- package/dts/visualizations/chart/legend/index.d.ts +4 -0
- package/dts/visualizations/chart/legend/index.d.ts.map +1 -0
- package/dts/visualizations/chart/line/DefaultReferenceLineLabel.d.ts +9 -0
- package/dts/visualizations/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
- package/dts/visualizations/chart/line/DottedLine.d.ts +20 -0
- package/dts/visualizations/chart/line/DottedLine.d.ts.map +1 -0
- package/dts/visualizations/chart/line/Line.d.ts +122 -0
- package/dts/visualizations/chart/line/Line.d.ts.map +1 -0
- package/dts/visualizations/chart/line/LineChart.d.ts +133 -0
- package/dts/visualizations/chart/line/LineChart.d.ts.map +1 -0
- package/dts/visualizations/chart/line/ReferenceLine.d.ts +140 -0
- package/dts/visualizations/chart/line/ReferenceLine.d.ts.map +1 -0
- package/dts/visualizations/chart/line/SolidLine.d.ts +15 -0
- package/dts/visualizations/chart/line/SolidLine.d.ts.map +1 -0
- package/dts/visualizations/chart/line/index.d.ts +7 -0
- package/dts/visualizations/chart/line/index.d.ts.map +1 -0
- package/dts/visualizations/chart/point/DefaultPointLabel.d.ts +10 -0
- package/dts/visualizations/chart/point/DefaultPointLabel.d.ts.map +1 -0
- package/dts/visualizations/chart/point/Point.d.ts +144 -0
- package/dts/visualizations/chart/point/Point.d.ts.map +1 -0
- package/dts/visualizations/chart/point/index.d.ts +3 -0
- package/dts/visualizations/chart/point/index.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/DefaultScrubberBeacon.d.ts +36 -0
- package/dts/visualizations/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +12 -0
- package/dts/visualizations/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/DefaultScrubberLabel.d.ts +12 -0
- package/dts/visualizations/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/Scrubber.d.ts +300 -0
- package/dts/visualizations/chart/scrubber/Scrubber.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/ScrubberAccessibilityView.d.ts +12 -0
- package/dts/visualizations/chart/scrubber/ScrubberAccessibilityView.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/ScrubberBeaconGroup.d.ts +52 -0
- package/dts/visualizations/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +46 -0
- package/dts/visualizations/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/ScrubberProvider.d.ts +20 -0
- package/dts/visualizations/chart/scrubber/ScrubberProvider.d.ts.map +1 -0
- package/dts/visualizations/chart/scrubber/index.d.ts +5 -0
- package/dts/visualizations/chart/scrubber/index.d.ts.map +1 -0
- package/dts/visualizations/chart/text/ChartText.d.ts +164 -0
- package/dts/visualizations/chart/text/ChartText.d.ts.map +1 -0
- package/dts/visualizations/chart/text/ChartTextGroup.d.ts +61 -0
- package/dts/visualizations/chart/text/ChartTextGroup.d.ts.map +1 -0
- package/dts/visualizations/chart/text/index.d.ts +3 -0
- package/dts/visualizations/chart/text/index.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/axis.d.ts +387 -0
- package/dts/visualizations/chart/utils/axis.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/bar.d.ts +225 -0
- package/dts/visualizations/chart/utils/bar.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/chart.d.ts +165 -0
- package/dts/visualizations/chart/utils/chart.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/context.d.ts +131 -0
- package/dts/visualizations/chart/utils/context.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/gradient.d.ts +129 -0
- package/dts/visualizations/chart/utils/gradient.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/index.d.ts +11 -0
- package/dts/visualizations/chart/utils/index.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/path.d.ts +189 -0
- package/dts/visualizations/chart/utils/path.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/point.d.ts +146 -0
- package/dts/visualizations/chart/utils/point.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/scale.d.ts +145 -0
- package/dts/visualizations/chart/utils/scale.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/scrubber.d.ts +40 -0
- package/dts/visualizations/chart/utils/scrubber.d.ts.map +1 -0
- package/dts/visualizations/chart/utils/transition.d.ts +181 -0
- package/dts/visualizations/chart/utils/transition.d.ts.map +1 -0
- package/dts/visualizations/index.d.ts +2 -0
- package/dts/visualizations/index.d.ts.map +1 -1
- package/dts/visualizations/sparkline/Counter.d.ts +8 -0
- package/dts/visualizations/sparkline/Counter.d.ts.map +1 -0
- package/dts/visualizations/sparkline/Sparkline.d.ts +72 -0
- package/dts/visualizations/sparkline/Sparkline.d.ts.map +1 -0
- package/dts/visualizations/sparkline/SparklineArea.d.ts +15 -0
- package/dts/visualizations/sparkline/SparklineArea.d.ts.map +1 -0
- package/dts/visualizations/sparkline/SparklineAreaPattern.d.ts +14 -0
- package/dts/visualizations/sparkline/SparklineAreaPattern.d.ts.map +1 -0
- package/dts/visualizations/sparkline/SparklineGradient.d.ts +22 -0
- package/dts/visualizations/sparkline/SparklineGradient.d.ts.map +1 -0
- package/dts/visualizations/sparkline/__figma__/Sparkline.figma.d.ts +2 -0
- package/dts/visualizations/sparkline/__figma__/Sparkline.figma.d.ts.map +1 -0
- package/dts/visualizations/sparkline/generateSparklineWithId.d.ts +11 -0
- package/dts/visualizations/sparkline/generateSparklineWithId.d.ts.map +1 -0
- package/dts/visualizations/sparkline/index.d.ts +6 -0
- package/dts/visualizations/sparkline/index.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts +23 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractive.d.ts +185 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts +25 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts +28 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +13 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +17 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts +11 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts +26 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts +25 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts +25 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts +39 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts +31 -0
- package/dts/visualizations/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts +2 -0
- package/dts/visualizations/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts +13 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useMinMaxTransform.d.ts +16 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useMinMaxTransform.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useOpacityAnimation.d.ts +6 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useOpacityAnimation.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +22 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts +34 -0
- package/dts/visualizations/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +116 -0
- package/dts/visualizations/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +2 -0
- package/dts/visualizations/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts.map +1 -0
- package/dts/visualizations/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts +29 -0
- package/dts/visualizations/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts.map +1 -0
- package/esm/alpha/combobox/Combobox.js +5 -7
- package/esm/alpha/combobox/DefaultComboboxControl.js +24 -24
- package/esm/alpha/data-card/__stories__/DataCard.stories.js +12 -4
- package/esm/alpha/select/DefaultSelectControl.js +31 -21
- package/esm/alpha/select/DefaultSelectDropdown.js +1 -0
- package/esm/alpha/select/DefaultSelectOption.js +0 -2
- package/esm/alpha/select/__stories__/AlphaSelect.stories.js +1 -1
- package/esm/animation/Lottie.js +10 -6
- package/esm/animation/LottieStatusAnimation.js +2 -2
- package/esm/banner/Banner.js +106 -86
- package/esm/buttons/AvatarButton.js +3 -3
- package/esm/buttons/Button.js +11 -24
- package/esm/buttons/DefaultSlideButtonBackground.js +8 -7
- package/esm/buttons/DefaultSlideButtonHandle.js +44 -34
- package/esm/buttons/IconButton.js +20 -41
- package/esm/buttons/IconCounterButton.js +21 -7
- package/esm/buttons/SlideButton.js +25 -25
- package/esm/buttons/__stories__/AvatarButton.stories.js +2 -1
- package/esm/buttons/__stories__/Button.stories.js +5 -2
- package/esm/buttons/__stories__/IconButton.stories.js +10 -19
- package/esm/buttons/__stories__/IconCounterButton.stories.js +6 -2
- package/esm/cards/AnnouncementCard.js +0 -5
- package/esm/cards/Card.js +5 -0
- package/esm/cards/CardMedia.js +6 -10
- package/esm/cards/DataCard.js +6 -6
- package/esm/cards/FeatureEntryCard.js +0 -5
- package/esm/cards/FeedCard.js +0 -10
- package/esm/cards/LikeButton.js +11 -5
- package/esm/cards/NudgeCard.js +28 -21
- package/esm/cards/UpsellCard.js +3 -1
- package/esm/cards/__figma__/UpsellCard.figma.js +3 -1
- package/esm/cards/__stories__/ContainedAssetCard.stories.js +4 -2
- package/esm/cards/__stories__/ContentCard.stories.js +7 -7
- package/esm/cards/__stories__/MediaCard.stories.js +6 -4
- package/esm/cards/__stories__/UpsellCard.stories.js +39 -13
- package/esm/carousel/Carousel.js +5 -3
- package/esm/carousel/DefaultCarouselPagination.js +3 -1
- package/esm/carousel/__figma__/Carousel.figma.js +0 -1
- package/esm/carousel/__stories__/Carousel.stories.js +2 -16
- package/esm/cells/Cell.js +49 -9
- package/esm/cells/CellAccessory.js +3 -2
- package/esm/cells/ContentCellFallback.js +4 -0
- package/esm/cells/ListCell.js +5 -2
- package/esm/cells/MediaFallback.js +4 -4
- package/esm/cells/__stories__/ListCell.stories.js +65 -2
- package/esm/chips/Chip.js +1 -0
- package/esm/coachmark/Coachmark.js +3 -2
- package/esm/controls/CheckboxGroup.js +0 -25
- package/esm/controls/HelperText.js +13 -5
- package/esm/controls/InputIconButton.js +1 -1
- package/esm/controls/InputStack.js +14 -9
- package/esm/controls/NativeInput.js +1 -0
- package/esm/controls/Radio.js +4 -3
- package/esm/controls/RadioGroup.js +0 -24
- package/esm/controls/SelectContext.js +14 -0
- package/esm/controls/SelectOption.js +5 -1
- package/esm/controls/Switch.js +14 -8
- package/esm/controls/TextInput.js +2 -1
- package/esm/controls/__stories__/InputIconButton.stories.js +4 -4
- package/esm/dates/DateInput.js +2 -3
- package/esm/dates/DatePicker.js +2 -3
- package/esm/dates/__stories__/DatePicker.stories.js +4 -4
- package/esm/dots/DotCount.js +14 -14
- package/esm/dots/DotSymbol.js +3 -2
- package/esm/examples/ExampleScreen.js +1 -1
- package/esm/gradients/LinearGradient.js +1 -2
- package/esm/gradients/__stories__/LinearGradient.stories.js +0 -14
- package/esm/hooks/useDimensions.js +4 -2
- package/esm/hooks/useDotPinStyles.js +25 -0
- package/esm/hooks/useHasNotch.js +6 -2
- package/esm/hooks/useScrollTo.js +1 -1
- package/esm/hooks/useStatusBarHeight.js +7 -30
- package/esm/icons/Icon.js +3 -1
- package/esm/icons/TextIcon.js +3 -1
- package/esm/jest.d.js +11 -2
- package/esm/layout/Box.js +11 -7
- package/esm/layout/Spacer.js +19 -17
- package/esm/media/Avatar.js +56 -8
- package/esm/media/Carousel/Carousel.js +3 -2
- package/esm/media/RemoteImage.js +10 -10
- package/esm/media/RemoteImageGroup.js +3 -1
- package/esm/media/__stories__/Avatar.stories.js +1 -0
- package/esm/navigation/NavigationTitleSelect.js +30 -22
- package/esm/navigation/TopNavBar.js +1 -1
- package/esm/overlays/Alert.js +1 -1
- package/esm/overlays/PortalProvider.js +22 -0
- package/esm/overlays/Toast.js +7 -5
- package/esm/overlays/__stories__/TrayPromotional.stories.js +3 -1
- package/esm/overlays/drawer/Drawer.js +14 -5
- package/esm/overlays/drawer/DrawerStatusBar.js +4 -0
- package/esm/overlays/modal/Modal.js +2 -1
- package/esm/overlays/modal/ModalFooter.js +5 -5
- package/esm/overlays/overlay/Overlay.js +7 -4
- package/esm/overlays/tooltip/__figma__/Tooltip.figma.js +5 -3
- package/esm/overlays/tooltip/useTooltipPosition.js +12 -3
- package/esm/overlays/useModal.js +1 -1
- package/esm/page/__stories__/PageFooterInPage.stories.js +3 -1
- package/esm/page/__stories__/PageHeader.stories.js +3 -1
- package/esm/page/__stories__/PageHeaderInErrorEmptyState.stories.js +1 -2
- package/esm/page/__stories__/PageHeaderInPage.stories.js +5 -4
- package/esm/stepper/DefaultStepperHeaderHorizontal.js +47 -31
- package/esm/stepper/DefaultStepperProgressHorizontal.js +18 -5
- package/esm/stepper/DefaultStepperProgressVertical.js +26 -22
- package/esm/stepper/DefaultStepperStepHorizontal.js +5 -5
- package/esm/stepper/DefaultStepperStepVertical.js +4 -4
- package/esm/stepper/Stepper.js +60 -70
- package/esm/stepper/__stories__/StepperHorizontal.stories.js +23 -0
- package/esm/stepper/__stories__/StepperVertical.stories.js +36 -0
- package/esm/styles/styleProps.js +5 -3
- package/esm/system/AndroidNavigationBar.js +18 -0
- package/esm/system/PressableOpacity.js +3 -2
- package/esm/system/ThemeProvider.js +32 -13
- package/esm/system/__stories__/AndroidNavigationBar.stories.js +61 -0
- package/esm/system/__stories__/Palette.stories.js +3 -1
- package/esm/system/__stories__/Pressable.stories.js +6 -2
- package/esm/system/__stories__/Spectrum.stories.js +6 -2
- package/esm/tabs/TabLabel.js +5 -5
- package/esm/tabs/Tabs.js +4 -1
- package/esm/tabs/__stories__/SegmentedTabs.stories.js +3 -5
- package/esm/tabs/hooks/useDotAnimation.js +53 -1
- package/esm/tag/Tag.js +6 -2
- package/esm/tour/DefaultTourMask.js +22 -7
- package/esm/tour/Tour.js +15 -3
- package/esm/tour/TourStep.js +5 -1
- package/esm/typography/Text.js +8 -3
- package/esm/typography/TextBody.js +14 -0
- package/esm/typography/TextCaption.js +14 -0
- package/esm/typography/TextDisplay1.js +14 -0
- package/esm/typography/TextDisplay2.js +14 -0
- package/esm/typography/TextDisplay3.js +14 -0
- package/esm/typography/TextHeadline.js +14 -0
- package/esm/typography/TextInherited.js +14 -0
- package/esm/typography/TextLabel1.js +14 -0
- package/esm/typography/TextLabel2.js +14 -0
- package/esm/typography/TextLegal.js +14 -0
- package/esm/typography/TextTitle1.js +14 -0
- package/esm/typography/TextTitle2.js +14 -0
- package/esm/typography/TextTitle3.js +14 -0
- package/esm/typography/TextTitle4.js +14 -0
- package/esm/typography/__stories__/Link.stories.js +2 -2
- package/esm/typography/__stories__/Text.stories.js +53 -39
- package/esm/utils/testHelpers.js +19 -1
- package/esm/visualizations/ProgressBar.js +3 -1
- package/esm/visualizations/chart/CartesianChart.js +455 -0
- package/esm/visualizations/chart/ChartContextBridge.js +159 -0
- package/esm/visualizations/chart/ChartProvider.js +10 -0
- package/esm/visualizations/chart/Path.js +248 -0
- package/esm/visualizations/chart/PeriodSelector.js +140 -0
- package/esm/visualizations/chart/__stories__/CartesianChart.stories.js +657 -0
- package/esm/visualizations/chart/__stories__/ChartAccessibility.stories.js +720 -0
- package/esm/visualizations/chart/__stories__/ChartTransitions.stories.js +693 -0
- package/esm/visualizations/chart/__stories__/PeriodSelector.stories.js +422 -0
- package/esm/visualizations/chart/area/Area.js +85 -0
- package/esm/visualizations/chart/area/AreaChart.js +153 -0
- package/esm/visualizations/chart/area/DottedArea.js +92 -0
- package/esm/visualizations/chart/area/GradientArea.js +63 -0
- package/esm/visualizations/chart/area/SolidArea.js +45 -0
- package/esm/visualizations/chart/area/__stories__/AreaChart.stories.js +328 -0
- package/esm/visualizations/chart/area/index.js +7 -0
- package/esm/visualizations/chart/axis/Axis.js +9 -0
- package/esm/visualizations/chart/axis/DefaultAxisTickLabel.js +11 -0
- package/esm/visualizations/chart/axis/XAxis.js +256 -0
- package/esm/visualizations/chart/axis/YAxis.js +255 -0
- package/esm/visualizations/chart/axis/__stories__/Axis.stories.js +552 -0
- package/esm/visualizations/chart/axis/index.js +6 -0
- package/esm/visualizations/chart/bar/Bar.js +71 -0
- package/esm/visualizations/chart/bar/BarChart.js +123 -0
- package/esm/visualizations/chart/bar/BarPlot.js +106 -0
- package/esm/visualizations/chart/bar/BarStack.js +173 -0
- package/esm/visualizations/chart/bar/BarStackGroup.js +89 -0
- package/esm/visualizations/chart/bar/DefaultBar.js +79 -0
- package/esm/visualizations/chart/bar/DefaultBarStack.js +68 -0
- package/esm/visualizations/chart/bar/PercentageBarChart.js +99 -0
- package/esm/visualizations/chart/bar/__stories__/BarChart.stories.js +1410 -0
- package/esm/visualizations/chart/bar/__stories__/PercentageBarChart.stories.js +832 -0
- package/esm/visualizations/chart/bar/index.js +10 -0
- package/esm/visualizations/chart/gradient/Gradient.js +147 -0
- package/esm/visualizations/chart/gradient/index.js +1 -0
- package/esm/visualizations/chart/index.js +17 -0
- package/esm/visualizations/chart/legend/DefaultLegendEntry.js +42 -0
- package/esm/visualizations/chart/legend/DefaultLegendShape.js +64 -0
- package/esm/visualizations/chart/legend/Legend.js +59 -0
- package/esm/visualizations/chart/legend/__stories__/Legend.stories.js +574 -0
- package/esm/visualizations/chart/legend/index.js +3 -0
- package/esm/visualizations/chart/line/DefaultReferenceLineLabel.js +66 -0
- package/esm/visualizations/chart/line/DottedLine.js +57 -0
- package/esm/visualizations/chart/line/Line.js +180 -0
- package/esm/visualizations/chart/line/LineChart.js +150 -0
- package/esm/visualizations/chart/line/ReferenceLine.js +132 -0
- package/esm/visualizations/chart/line/SolidLine.js +53 -0
- package/esm/visualizations/chart/line/__stories__/LineChart.stories.js +2029 -0
- package/esm/visualizations/chart/line/__stories__/ReferenceLine.stories.js +226 -0
- package/esm/visualizations/chart/line/index.js +8 -0
- package/esm/visualizations/chart/point/DefaultPointLabel.js +40 -0
- package/esm/visualizations/chart/point/Point.js +187 -0
- package/esm/visualizations/chart/point/index.js +2 -0
- package/esm/visualizations/chart/scrubber/DefaultScrubberBeacon.js +182 -0
- package/esm/visualizations/chart/scrubber/DefaultScrubberBeaconLabel.js +43 -0
- package/esm/visualizations/chart/scrubber/DefaultScrubberLabel.js +44 -0
- package/esm/visualizations/chart/scrubber/Scrubber.js +200 -0
- package/esm/visualizations/chart/scrubber/ScrubberAccessibilityView.js +177 -0
- package/esm/visualizations/chart/scrubber/ScrubberBeaconGroup.js +169 -0
- package/esm/visualizations/chart/scrubber/ScrubberBeaconLabelGroup.js +231 -0
- package/esm/visualizations/chart/scrubber/ScrubberProvider.js +140 -0
- package/esm/visualizations/chart/scrubber/__stories__/Scrubber.stories.js +945 -0
- package/esm/visualizations/chart/scrubber/index.js +4 -0
- package/esm/visualizations/chart/text/ChartText.js +305 -0
- package/esm/visualizations/chart/text/ChartTextGroup.js +211 -0
- package/esm/visualizations/chart/text/index.js +4 -0
- package/esm/visualizations/chart/utils/axis.js +664 -0
- package/esm/visualizations/chart/utils/bar.js +906 -0
- package/esm/visualizations/chart/utils/chart.js +329 -0
- package/esm/visualizations/chart/utils/context.js +22 -0
- package/esm/visualizations/chart/utils/gradient.js +319 -0
- package/esm/visualizations/chart/utils/index.js +12 -0
- package/esm/visualizations/chart/utils/path.js +307 -0
- package/esm/visualizations/chart/utils/point.js +282 -0
- package/esm/visualizations/chart/utils/scale.js +288 -0
- package/esm/visualizations/chart/utils/scrubber.js +146 -0
- package/esm/visualizations/chart/utils/transition.js +241 -0
- package/esm/visualizations/index.js +3 -1
- package/esm/visualizations/sparkline/Counter.js +45 -0
- package/esm/visualizations/sparkline/Sparkline.js +165 -0
- package/esm/visualizations/sparkline/SparklineArea.js +20 -0
- package/esm/visualizations/sparkline/SparklineAreaPattern.js +38 -0
- package/esm/visualizations/sparkline/SparklineGradient.js +77 -0
- package/esm/visualizations/sparkline/__figma__/Sparkline.figma.js +22 -0
- package/esm/visualizations/sparkline/__stories__/Sparkline.stories.js +124 -0
- package/esm/visualizations/sparkline/__stories__/SparklineGradient.stories.js +126 -0
- package/esm/visualizations/sparkline/generateSparklineWithId.js +7 -0
- package/esm/visualizations/sparkline/index.js +5 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineAccessibleView.js +75 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractive.js +308 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.js +116 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.js +131 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.js +99 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +83 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractiveMinMax.js +104 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.js +104 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractivePaths.js +57 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.js +125 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractiveProvider.js +80 -0
- package/esm/visualizations/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.js +109 -0
- package/esm/visualizations/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +85 -0
- package/esm/visualizations/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +526 -0
- package/esm/visualizations/sparkline/sparkline-interactive/useInterruptiblePathAnimation.js +58 -0
- package/esm/visualizations/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.js +37 -0
- package/esm/visualizations/sparkline/sparkline-interactive/useMinMaxTransform.js +56 -0
- package/esm/visualizations/sparkline/sparkline-interactive/useOpacityAnimation.js +23 -0
- package/esm/visualizations/sparkline/sparkline-interactive/useSparklineInteractiveConstants.js +47 -0
- package/esm/visualizations/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.js +34 -0
- package/esm/visualizations/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.js +233 -0
- package/esm/visualizations/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +104 -0
- package/esm/visualizations/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +565 -0
- package/esm/visualizations/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.js +117 -0
- package/package.json +34 -28
- package/dts/system/__figma__/AndroidNavigationBar.figma.d.ts +0 -2
- package/dts/system/__figma__/AndroidNavigationBar.figma.d.ts.map +0 -1
- package/esm/media/__stories__/CarouselAlphaExample.js +0 -93
- package/esm/media/__stories__/CarouselMedia.stories.js +0 -180
- package/esm/system/__figma__/AndroidNavigationBar.figma.js +0 -24
|
@@ -0,0 +1,2029 @@
|
|
|
1
|
+
const _excluded = ["dataX", "dataY"],
|
|
2
|
+
_excluded2 = ["label"],
|
|
3
|
+
_excluded3 = ["style"];
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
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); }
|
|
6
|
+
import { forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { useAnimatedReaction, useDerivedValue, useSharedValue, withDelay, withTiming } from 'react-native-reanimated';
|
|
8
|
+
import { assets, ethBackground } from '@coinbase/cds-common/internal/data/assets';
|
|
9
|
+
import { prices } from '@coinbase/cds-common/internal/data/prices';
|
|
10
|
+
import { sparklineInteractiveData } from '@coinbase/cds-common/internal/visualizations/SparklineInteractiveData';
|
|
11
|
+
import { useTabsContext } from '@coinbase/cds-common/tabs/TabsContext';
|
|
12
|
+
import { NoopFn } from '@coinbase/cds-common/utils/mockUtils';
|
|
13
|
+
import { Circle, FontWeight, Group, Skia, TextAlign } from '@shopify/react-native-skia';
|
|
14
|
+
import { DataCard } from '../../../../alpha/data-card/DataCard';
|
|
15
|
+
import { IconButton } from '../../../../buttons';
|
|
16
|
+
import { ListCell } from '../../../../cells';
|
|
17
|
+
import { Example, ExampleScreen } from '../../../../examples/ExampleScreen';
|
|
18
|
+
import { useTheme } from '../../../../index';
|
|
19
|
+
import { Box, HStack, VStack } from '../../../../layout';
|
|
20
|
+
import { Avatar, RemoteImage } from '../../../../media';
|
|
21
|
+
import { SectionHeader } from '../../../../section-header/SectionHeader';
|
|
22
|
+
import { Pressable } from '../../../../system';
|
|
23
|
+
import { SegmentedTab } from '../../../../tabs/SegmentedTab';
|
|
24
|
+
import { Text } from '../../../../typography';
|
|
25
|
+
import { Area, DottedArea } from '../../area';
|
|
26
|
+
import { DefaultAxisTickLabel, XAxis, YAxis } from '../../axis';
|
|
27
|
+
import { CartesianChart } from '../../CartesianChart';
|
|
28
|
+
import { useCartesianChartContext } from '../../ChartProvider';
|
|
29
|
+
import { PeriodSelector, PeriodSelectorActiveIndicator } from '../../PeriodSelector';
|
|
30
|
+
import { Point } from '../../point';
|
|
31
|
+
import { DefaultScrubberBeacon, Scrubber } from '../../scrubber';
|
|
32
|
+
import { buildTransition, defaultTransition, projectPointWithSerializableScale, unwrapAnimatedValue, useScrubberContext } from '../../utils';
|
|
33
|
+
import { DottedLine, Line, LineChart, ReferenceLine, SolidLine } from '..';
|
|
34
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
35
|
+
function MultipleLine(props) {
|
|
36
|
+
const theme = useTheme();
|
|
37
|
+
const pages = useMemo(() => ['Page A', 'Page B', 'Page C', 'Page D', 'Page E', 'Page F', 'Page G'], []);
|
|
38
|
+
const pageViews = useMemo(() => [2400, 1398, 9800, 3908, 4800, 3800, 4300], []);
|
|
39
|
+
const uniqueVisitors = useMemo(() => [4000, 3000, 2000, 2780, 1890, 2390, 3490], []);
|
|
40
|
+
const chartAccessibilityLabel = "Website visitors across " + pageViews.length + " pages.";
|
|
41
|
+
const chartAccessibilityHint = 'Swipe left or right to hear details for each page.';
|
|
42
|
+
const getScrubberAccessibilityLabel = useCallback(index => pages[index] + " has " + pageViews[index] + " views and " + uniqueVisitors[index] + " unique visitors.", [pages, pageViews, uniqueVisitors]);
|
|
43
|
+
const numberFormatter = useCallback(value => new Intl.NumberFormat('en-US', {
|
|
44
|
+
maximumFractionDigits: 0
|
|
45
|
+
}).format(value), []);
|
|
46
|
+
return /*#__PURE__*/_jsx(LineChart, _extends({
|
|
47
|
+
enableScrubbing: true,
|
|
48
|
+
showArea: true,
|
|
49
|
+
showXAxis: true,
|
|
50
|
+
showYAxis: true,
|
|
51
|
+
accessibilityHint: chartAccessibilityHint,
|
|
52
|
+
accessibilityLabel: chartAccessibilityLabel + " " + chartAccessibilityHint,
|
|
53
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
54
|
+
height: 200,
|
|
55
|
+
series: [{
|
|
56
|
+
id: 'pageViews',
|
|
57
|
+
data: pageViews,
|
|
58
|
+
color: theme.color.accentBoldGreen,
|
|
59
|
+
// Label will render next to scrubber beacon
|
|
60
|
+
label: 'Page Views'
|
|
61
|
+
}, {
|
|
62
|
+
id: 'uniqueVisitors',
|
|
63
|
+
data: uniqueVisitors,
|
|
64
|
+
color: theme.color.accentBoldPurple,
|
|
65
|
+
label: 'Unique Visitors',
|
|
66
|
+
// Default area is gradient
|
|
67
|
+
areaType: 'dotted'
|
|
68
|
+
}],
|
|
69
|
+
xAxis: {
|
|
70
|
+
// Used on the x-axis to provide context for each index from the series data array
|
|
71
|
+
data: pages
|
|
72
|
+
},
|
|
73
|
+
yAxis: {
|
|
74
|
+
showGrid: true,
|
|
75
|
+
tickLabelFormatter: numberFormatter
|
|
76
|
+
}
|
|
77
|
+
}, props, {
|
|
78
|
+
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
function DataFormat() {
|
|
82
|
+
const yData = useMemo(() => [2, 5.5, 2, 8.5, 1.5, 5], []);
|
|
83
|
+
const xData = useMemo(() => [1, 2, 3, 5, 8, 10], []);
|
|
84
|
+
const chartAccessibilityLabel = "Chart with custom X and Y data. " + yData.length + " data points";
|
|
85
|
+
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": X value " + xData[index] + ", Y value " + yData[index], [xData, yData]);
|
|
86
|
+
return /*#__PURE__*/_jsx(LineChart, {
|
|
87
|
+
enableScrubbing: true,
|
|
88
|
+
points: true,
|
|
89
|
+
showArea: true,
|
|
90
|
+
showXAxis: true,
|
|
91
|
+
showYAxis: true,
|
|
92
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
93
|
+
curve: "natural",
|
|
94
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
95
|
+
height: 200,
|
|
96
|
+
inset: {
|
|
97
|
+
top: 16,
|
|
98
|
+
right: 16,
|
|
99
|
+
bottom: 0,
|
|
100
|
+
left: 0
|
|
101
|
+
},
|
|
102
|
+
series: [{
|
|
103
|
+
id: 'line',
|
|
104
|
+
data: yData
|
|
105
|
+
}],
|
|
106
|
+
xAxis: {
|
|
107
|
+
data: xData,
|
|
108
|
+
showLine: true,
|
|
109
|
+
showTickMarks: true,
|
|
110
|
+
showGrid: true
|
|
111
|
+
},
|
|
112
|
+
yAxis: {
|
|
113
|
+
domain: {
|
|
114
|
+
min: 0
|
|
115
|
+
},
|
|
116
|
+
position: 'left',
|
|
117
|
+
showLine: true,
|
|
118
|
+
showTickMarks: true,
|
|
119
|
+
showGrid: true
|
|
120
|
+
},
|
|
121
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
122
|
+
hideOverlay: true
|
|
123
|
+
})
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function LiveUpdates() {
|
|
127
|
+
const scrubberRef = useRef(null);
|
|
128
|
+
const initialData = useMemo(() => {
|
|
129
|
+
return sparklineInteractiveData.hour.map(d => d.value);
|
|
130
|
+
}, []);
|
|
131
|
+
const [priceData, setPriceData] = useState(initialData);
|
|
132
|
+
const chartAccessibilityLabel = "Live price chart with " + priceData.length + " data points.";
|
|
133
|
+
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": " + priceData[index], [priceData]);
|
|
134
|
+
const lastDataPointTimeRef = useRef(Date.now());
|
|
135
|
+
const updateCountRef = useRef(0);
|
|
136
|
+
const intervalSeconds = 3600 / initialData.length;
|
|
137
|
+
const maxPercentChange = Math.abs(initialData[initialData.length - 1] - initialData[0]) * 0.05;
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
const priceUpdateInterval = setInterval(() => {
|
|
140
|
+
var _scrubberRef$current;
|
|
141
|
+
setPriceData(currentData => {
|
|
142
|
+
const newData = [...currentData];
|
|
143
|
+
const lastPrice = newData[newData.length - 1];
|
|
144
|
+
const priceChange = (Math.random() - 0.5) * maxPercentChange;
|
|
145
|
+
const newPrice = Math.round((lastPrice + priceChange) * 100) / 100;
|
|
146
|
+
|
|
147
|
+
// Check if we should roll over to a new data point
|
|
148
|
+
const currentTime = Date.now();
|
|
149
|
+
const timeSinceLastPoint = (currentTime - lastDataPointTimeRef.current) / 1000;
|
|
150
|
+
if (timeSinceLastPoint >= intervalSeconds) {
|
|
151
|
+
// Time for a new data point - remove first, add new at end
|
|
152
|
+
lastDataPointTimeRef.current = currentTime;
|
|
153
|
+
newData.shift(); // Remove oldest data point
|
|
154
|
+
newData.push(newPrice); // Add new data point
|
|
155
|
+
updateCountRef.current = 0;
|
|
156
|
+
} else {
|
|
157
|
+
// Just update the last data point
|
|
158
|
+
newData[newData.length - 1] = newPrice;
|
|
159
|
+
updateCountRef.current++;
|
|
160
|
+
}
|
|
161
|
+
return newData;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Pulse the scrubber on each update
|
|
165
|
+
(_scrubberRef$current = scrubberRef.current) == null || _scrubberRef$current.pulse();
|
|
166
|
+
}, 2000 + Math.random() * 1000);
|
|
167
|
+
return () => clearInterval(priceUpdateInterval);
|
|
168
|
+
}, [intervalSeconds, maxPercentChange]);
|
|
169
|
+
return /*#__PURE__*/_jsx(LineChart, {
|
|
170
|
+
enableScrubbing: true,
|
|
171
|
+
showArea: true,
|
|
172
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
173
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
174
|
+
height: 200,
|
|
175
|
+
inset: {
|
|
176
|
+
right: 64
|
|
177
|
+
},
|
|
178
|
+
series: [{
|
|
179
|
+
id: 'btc',
|
|
180
|
+
data: priceData,
|
|
181
|
+
color: assets.btc.color
|
|
182
|
+
}],
|
|
183
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
184
|
+
ref: scrubberRef
|
|
185
|
+
})
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function MissingData() {
|
|
189
|
+
const theme = useTheme();
|
|
190
|
+
const pages = useMemo(() => ['Page A', 'Page B', 'Page C', 'Page D', 'Page E', 'Page F', 'Page G'], []);
|
|
191
|
+
const pageViews = useMemo(() => [2400, 1398, null, 3908, 4800, 3800, 4300], []);
|
|
192
|
+
const uniqueVisitors = useMemo(() => [4000, 3000, null, 2780, 1890, 2390, 3490], []);
|
|
193
|
+
const chartAccessibilityLabel = "Website visitors across " + pages.length + " pages. Some data points are missing.";
|
|
194
|
+
const getScrubberAccessibilityLabel = useCallback(index => {
|
|
195
|
+
const pv = pageViews[index];
|
|
196
|
+
const uv = uniqueVisitors[index];
|
|
197
|
+
const pvStr = pv != null ? pv : 'no data';
|
|
198
|
+
const uvStr = uv != null ? uv : 'no data';
|
|
199
|
+
return pages[index] + ": " + pvStr + " views, " + uvStr + " unique visitors.";
|
|
200
|
+
}, [pages, pageViews, uniqueVisitors]);
|
|
201
|
+
const numberFormatter = useCallback(value => new Intl.NumberFormat('en-US', {
|
|
202
|
+
maximumFractionDigits: 0
|
|
203
|
+
}).format(value), []);
|
|
204
|
+
return /*#__PURE__*/_jsx(LineChart, {
|
|
205
|
+
enableScrubbing: true,
|
|
206
|
+
points: true,
|
|
207
|
+
showArea: true,
|
|
208
|
+
showXAxis: true,
|
|
209
|
+
showYAxis: true,
|
|
210
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
211
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
212
|
+
height: 200,
|
|
213
|
+
series: [{
|
|
214
|
+
id: 'pageViews',
|
|
215
|
+
data: pageViews,
|
|
216
|
+
color: theme.color.accentBoldGreen,
|
|
217
|
+
// Label will render next to scrubber beacon
|
|
218
|
+
label: 'Page Views',
|
|
219
|
+
connectNulls: true
|
|
220
|
+
}, {
|
|
221
|
+
id: 'uniqueVisitors',
|
|
222
|
+
data: uniqueVisitors,
|
|
223
|
+
color: theme.color.accentBoldPurple,
|
|
224
|
+
label: 'Unique Visitors'
|
|
225
|
+
}],
|
|
226
|
+
xAxis: {
|
|
227
|
+
// Used on the x-axis to provide context for each index from the series data array
|
|
228
|
+
data: pages
|
|
229
|
+
},
|
|
230
|
+
yAxis: {
|
|
231
|
+
showGrid: true,
|
|
232
|
+
tickLabelFormatter: numberFormatter
|
|
233
|
+
},
|
|
234
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
235
|
+
overlayOffset: 6
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function Interaction() {
|
|
240
|
+
const [scrubberPosition, setScrubberPosition] = useState();
|
|
241
|
+
const data = useMemo(() => [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58], []);
|
|
242
|
+
const chartAccessibilityLabel = "Price chart with " + data.length + " data points. Swipe to navigate.";
|
|
243
|
+
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": " + data[index], [data]);
|
|
244
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
245
|
+
gap: 2,
|
|
246
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
247
|
+
font: "label1",
|
|
248
|
+
children: scrubberPosition !== undefined ? "Scrubber position: " + scrubberPosition : 'Not scrubbing'
|
|
249
|
+
}), /*#__PURE__*/_jsx(LineChart, {
|
|
250
|
+
enableScrubbing: true,
|
|
251
|
+
showArea: true,
|
|
252
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
253
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
254
|
+
height: 200,
|
|
255
|
+
onScrubberPositionChange: setScrubberPosition,
|
|
256
|
+
series: [{
|
|
257
|
+
id: 'prices',
|
|
258
|
+
data
|
|
259
|
+
}],
|
|
260
|
+
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
261
|
+
})]
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function Points() {
|
|
265
|
+
const theme = useTheme();
|
|
266
|
+
const keyMarketShiftIndices = [4, 6, 7, 9, 10];
|
|
267
|
+
const data = [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58];
|
|
268
|
+
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
269
|
+
height: 200,
|
|
270
|
+
series: [{
|
|
271
|
+
id: 'prices',
|
|
272
|
+
data: data
|
|
273
|
+
}],
|
|
274
|
+
children: [/*#__PURE__*/_jsx(Area, {
|
|
275
|
+
fill: "rgb(" + theme.spectrum.blue5 + ")",
|
|
276
|
+
seriesId: "prices"
|
|
277
|
+
}), /*#__PURE__*/_jsx(Line, {
|
|
278
|
+
points: _ref => {
|
|
279
|
+
let {
|
|
280
|
+
dataX,
|
|
281
|
+
dataY
|
|
282
|
+
} = _ref,
|
|
283
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
284
|
+
return keyMarketShiftIndices.includes(dataX) ? _extends({}, props, {
|
|
285
|
+
strokeWidth: 2,
|
|
286
|
+
stroke: theme.color.bg,
|
|
287
|
+
radius: 5,
|
|
288
|
+
onClick: () => alert("You have clicked a key market shift at position " + (dataX + 1) + " with value " + dataY + "!"),
|
|
289
|
+
accessibilityLabel: "Key market shift point at position " + (dataX + 1) + ", value " + dataY + ". Click to view details."
|
|
290
|
+
}) : false;
|
|
291
|
+
},
|
|
292
|
+
seriesId: "prices"
|
|
293
|
+
})]
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function Transitions() {
|
|
297
|
+
const theme = useTheme();
|
|
298
|
+
const dataCount = 20;
|
|
299
|
+
const maxDataOffset = 15000;
|
|
300
|
+
const minStepOffset = 2500;
|
|
301
|
+
const maxStepOffset = 10000;
|
|
302
|
+
const domainLimit = 20000;
|
|
303
|
+
const updateInterval = 500;
|
|
304
|
+
const myTransitionConfig = {
|
|
305
|
+
type: 'spring',
|
|
306
|
+
stiffness: 700,
|
|
307
|
+
damping: 20
|
|
308
|
+
};
|
|
309
|
+
const negativeColor = "rgb(" + theme.spectrum.gray15 + ")";
|
|
310
|
+
const positiveColor = theme.color.fgPositive;
|
|
311
|
+
function generateNextValue(previousValue) {
|
|
312
|
+
const range = maxStepOffset - minStepOffset;
|
|
313
|
+
const offset = Math.random() * range + minStepOffset;
|
|
314
|
+
let direction;
|
|
315
|
+
if (previousValue >= maxDataOffset) {
|
|
316
|
+
direction = -1;
|
|
317
|
+
} else if (previousValue <= -maxDataOffset) {
|
|
318
|
+
direction = 1;
|
|
319
|
+
} else {
|
|
320
|
+
direction = Math.random() < 0.5 ? -1 : 1;
|
|
321
|
+
}
|
|
322
|
+
let newValue = previousValue + offset * direction;
|
|
323
|
+
newValue = Math.max(-maxDataOffset, Math.min(maxDataOffset, newValue));
|
|
324
|
+
return newValue;
|
|
325
|
+
}
|
|
326
|
+
function generateInitialData() {
|
|
327
|
+
const data = [];
|
|
328
|
+
let previousValue = Math.random() * 2 * maxDataOffset - maxDataOffset;
|
|
329
|
+
data.push(previousValue);
|
|
330
|
+
for (let i = 1; i < dataCount; i++) {
|
|
331
|
+
const newValue = generateNextValue(previousValue);
|
|
332
|
+
data.push(newValue);
|
|
333
|
+
previousValue = newValue;
|
|
334
|
+
}
|
|
335
|
+
return data;
|
|
336
|
+
}
|
|
337
|
+
const MyGradient = /*#__PURE__*/memo(props => {
|
|
338
|
+
const areaGradient = {
|
|
339
|
+
stops: _ref2 => {
|
|
340
|
+
let {
|
|
341
|
+
min,
|
|
342
|
+
max
|
|
343
|
+
} = _ref2;
|
|
344
|
+
return [{
|
|
345
|
+
offset: min,
|
|
346
|
+
color: negativeColor,
|
|
347
|
+
opacity: 1
|
|
348
|
+
}, {
|
|
349
|
+
offset: 0,
|
|
350
|
+
color: negativeColor,
|
|
351
|
+
opacity: 0
|
|
352
|
+
}, {
|
|
353
|
+
offset: 0,
|
|
354
|
+
color: positiveColor,
|
|
355
|
+
opacity: 0
|
|
356
|
+
}, {
|
|
357
|
+
offset: max,
|
|
358
|
+
color: positiveColor,
|
|
359
|
+
opacity: 1
|
|
360
|
+
}];
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
return /*#__PURE__*/_jsx(DottedArea, _extends({}, props, {
|
|
364
|
+
gradient: areaGradient
|
|
365
|
+
}));
|
|
366
|
+
});
|
|
367
|
+
function CustomTransitionsChart() {
|
|
368
|
+
const [data, setData] = useState(generateInitialData);
|
|
369
|
+
useEffect(() => {
|
|
370
|
+
const intervalId = setInterval(() => {
|
|
371
|
+
setData(currentData => {
|
|
372
|
+
var _currentData;
|
|
373
|
+
const lastValue = (_currentData = currentData[currentData.length - 1]) != null ? _currentData : 0;
|
|
374
|
+
const newValue = generateNextValue(lastValue);
|
|
375
|
+
return [...currentData.slice(1), newValue];
|
|
376
|
+
});
|
|
377
|
+
}, updateInterval);
|
|
378
|
+
return () => clearInterval(intervalId);
|
|
379
|
+
}, []);
|
|
380
|
+
const tickLabelFormatter = useCallback(value => new Intl.NumberFormat('en-US', {
|
|
381
|
+
style: 'currency',
|
|
382
|
+
currency: 'USD',
|
|
383
|
+
maximumFractionDigits: 0
|
|
384
|
+
}).format(value), []);
|
|
385
|
+
const valueAtIndexFormatter = useCallback(dataIndex => new Intl.NumberFormat('en-US', {
|
|
386
|
+
style: 'currency',
|
|
387
|
+
currency: 'USD'
|
|
388
|
+
}).format(data[dataIndex]), [data]);
|
|
389
|
+
const lineGradient = {
|
|
390
|
+
stops: [{
|
|
391
|
+
offset: 0,
|
|
392
|
+
color: negativeColor
|
|
393
|
+
}, {
|
|
394
|
+
offset: 0,
|
|
395
|
+
color: positiveColor
|
|
396
|
+
}]
|
|
397
|
+
};
|
|
398
|
+
const chartAccessibilityLabel = "Price chart with " + data.length + " data points. Swipe to navigate.";
|
|
399
|
+
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": " + valueAtIndexFormatter(index), [valueAtIndexFormatter]);
|
|
400
|
+
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
401
|
+
enableScrubbing: true,
|
|
402
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
403
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
404
|
+
height: 200,
|
|
405
|
+
inset: {
|
|
406
|
+
top: 32,
|
|
407
|
+
bottom: 32,
|
|
408
|
+
left: 16,
|
|
409
|
+
right: 16
|
|
410
|
+
},
|
|
411
|
+
series: [{
|
|
412
|
+
id: 'prices',
|
|
413
|
+
data: data,
|
|
414
|
+
gradient: lineGradient
|
|
415
|
+
}],
|
|
416
|
+
yAxis: {
|
|
417
|
+
domain: {
|
|
418
|
+
min: -domainLimit,
|
|
419
|
+
max: domainLimit
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
children: [/*#__PURE__*/_jsx(YAxis, {
|
|
423
|
+
showGrid: true,
|
|
424
|
+
requestedTickCount: 2,
|
|
425
|
+
tickLabelFormatter: tickLabelFormatter
|
|
426
|
+
}), /*#__PURE__*/_jsx(Line, {
|
|
427
|
+
showArea: true,
|
|
428
|
+
AreaComponent: MyGradient,
|
|
429
|
+
seriesId: "prices",
|
|
430
|
+
strokeWidth: 3,
|
|
431
|
+
transition: myTransitionConfig
|
|
432
|
+
}), /*#__PURE__*/_jsx(Scrubber, {
|
|
433
|
+
hideOverlay: true,
|
|
434
|
+
beaconTransitions: {
|
|
435
|
+
update: myTransitionConfig
|
|
436
|
+
},
|
|
437
|
+
label: valueAtIndexFormatter
|
|
438
|
+
})]
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
return /*#__PURE__*/_jsx(CustomTransitionsChart, {});
|
|
442
|
+
}
|
|
443
|
+
function BasicAccessible() {
|
|
444
|
+
const data = useMemo(() => [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58], []);
|
|
445
|
+
|
|
446
|
+
// Chart-level accessibility label provides overview
|
|
447
|
+
const chartAccessibilityLabel = useMemo(() => {
|
|
448
|
+
const currentPrice = data[data.length - 1];
|
|
449
|
+
return "Price chart showing trend over " + data.length + " data points. Current value: " + currentPrice + ". Use arrow keys to adjust view";
|
|
450
|
+
}, [data]);
|
|
451
|
+
const getScrubberAccessibilityLabel = useCallback(index => "Price at position " + (index + 1) + " of " + data.length + ": " + data[index], [data]);
|
|
452
|
+
return /*#__PURE__*/_jsx(LineChart, {
|
|
453
|
+
enableScrubbing: true,
|
|
454
|
+
showArea: true,
|
|
455
|
+
showYAxis: true,
|
|
456
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
457
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
458
|
+
height: 200,
|
|
459
|
+
series: [{
|
|
460
|
+
id: 'prices',
|
|
461
|
+
data: data
|
|
462
|
+
}],
|
|
463
|
+
yAxis: {
|
|
464
|
+
showGrid: true
|
|
465
|
+
},
|
|
466
|
+
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
function Gradients() {
|
|
470
|
+
const theme = useTheme();
|
|
471
|
+
const spectrumColors = ['blue', 'green', 'orange', 'yellow', 'gray', 'indigo', 'pink', 'purple', 'red', 'teal', 'chartreuse'];
|
|
472
|
+
const data = [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58];
|
|
473
|
+
const [currentSpectrumColor, setCurrentSpectrumColor] = useState('pink');
|
|
474
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
475
|
+
gap: 2,
|
|
476
|
+
children: [/*#__PURE__*/_jsx(HStack, {
|
|
477
|
+
flexWrap: "wrap",
|
|
478
|
+
gap: 1,
|
|
479
|
+
justifyContent: "flex-end",
|
|
480
|
+
children: spectrumColors.map(color => /*#__PURE__*/_jsx(Pressable, {
|
|
481
|
+
accessibilityLabel: "Select " + color,
|
|
482
|
+
height: 16,
|
|
483
|
+
onPress: () => setCurrentSpectrumColor(color),
|
|
484
|
+
style: {
|
|
485
|
+
backgroundColor: "rgb(" + theme.spectrum[color + "20"] + ")",
|
|
486
|
+
borderColor: "rgb(" + theme.spectrum[color + "50"] + ")",
|
|
487
|
+
borderWidth: 2
|
|
488
|
+
},
|
|
489
|
+
width: 16
|
|
490
|
+
}, color))
|
|
491
|
+
}), /*#__PURE__*/_jsx(LineChart, {
|
|
492
|
+
points: true,
|
|
493
|
+
showYAxis: true,
|
|
494
|
+
height: 200,
|
|
495
|
+
series: [{
|
|
496
|
+
id: 'continuousGradient',
|
|
497
|
+
data: data,
|
|
498
|
+
gradient: {
|
|
499
|
+
stops: [{
|
|
500
|
+
offset: 0,
|
|
501
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "80"] + ")"
|
|
502
|
+
}, {
|
|
503
|
+
offset: Math.max(...data),
|
|
504
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "20"] + ")"
|
|
505
|
+
}]
|
|
506
|
+
}
|
|
507
|
+
}, {
|
|
508
|
+
id: 'discreteGradient',
|
|
509
|
+
data: data.map(d => d + 50),
|
|
510
|
+
// You can create a "discrete" gradient by having multiple stops at the same offset
|
|
511
|
+
gradient: {
|
|
512
|
+
stops: _ref3 => {
|
|
513
|
+
let {
|
|
514
|
+
min,
|
|
515
|
+
max
|
|
516
|
+
} = _ref3;
|
|
517
|
+
return [
|
|
518
|
+
// Allows a function which accepts min/max or direct array
|
|
519
|
+
{
|
|
520
|
+
offset: min,
|
|
521
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "80"] + ")"
|
|
522
|
+
}, {
|
|
523
|
+
offset: min + (max - min) / 3,
|
|
524
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "80"] + ")"
|
|
525
|
+
}, {
|
|
526
|
+
offset: min + (max - min) / 3,
|
|
527
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "50"] + ")"
|
|
528
|
+
}, {
|
|
529
|
+
offset: min + (max - min) / 3 * 2,
|
|
530
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "50"] + ")"
|
|
531
|
+
}, {
|
|
532
|
+
offset: min + (max - min) / 3 * 2,
|
|
533
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "20"] + ")"
|
|
534
|
+
}, {
|
|
535
|
+
offset: max,
|
|
536
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "20"] + ")"
|
|
537
|
+
}];
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}, {
|
|
541
|
+
id: 'xAxisGradient',
|
|
542
|
+
data: data.map(d => d + 100),
|
|
543
|
+
gradient: {
|
|
544
|
+
// You can also configure by the x-axis.
|
|
545
|
+
axis: 'x',
|
|
546
|
+
stops: _ref4 => {
|
|
547
|
+
let {
|
|
548
|
+
min,
|
|
549
|
+
max
|
|
550
|
+
} = _ref4;
|
|
551
|
+
return [{
|
|
552
|
+
offset: min,
|
|
553
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "80"] + ")",
|
|
554
|
+
opacity: 0
|
|
555
|
+
}, {
|
|
556
|
+
offset: max,
|
|
557
|
+
color: "rgb(" + theme.spectrum[currentSpectrumColor + "20"] + ")",
|
|
558
|
+
opacity: 1
|
|
559
|
+
}];
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}],
|
|
563
|
+
strokeWidth: 4,
|
|
564
|
+
yAxis: {
|
|
565
|
+
showGrid: true
|
|
566
|
+
}
|
|
567
|
+
})]
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
function GainLossChart() {
|
|
571
|
+
const theme = useTheme();
|
|
572
|
+
const data = useMemo(() => [-40, -28, -21, -5, 48, -5, -28, 2, -29, -46, 16, -30, -29, 8], []);
|
|
573
|
+
const negativeColor = "rgb(" + theme.spectrum.gray15 + ")";
|
|
574
|
+
const positiveColor = theme.color.fgPositive;
|
|
575
|
+
const tickLabelFormatter = useCallback(value => new Intl.NumberFormat('en-US', {
|
|
576
|
+
style: 'currency',
|
|
577
|
+
currency: 'USD',
|
|
578
|
+
maximumFractionDigits: 0
|
|
579
|
+
}).format(value), []);
|
|
580
|
+
|
|
581
|
+
// Line gradient: hard color change at 0 (full opacity for line)
|
|
582
|
+
const lineGradient = {
|
|
583
|
+
stops: [{
|
|
584
|
+
offset: 0,
|
|
585
|
+
color: negativeColor
|
|
586
|
+
}, {
|
|
587
|
+
offset: 0,
|
|
588
|
+
color: positiveColor
|
|
589
|
+
}]
|
|
590
|
+
};
|
|
591
|
+
const GradientDottedArea = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(DottedArea, _extends({}, props, {
|
|
592
|
+
gradient: {
|
|
593
|
+
stops: _ref5 => {
|
|
594
|
+
let {
|
|
595
|
+
min,
|
|
596
|
+
max
|
|
597
|
+
} = _ref5;
|
|
598
|
+
return [{
|
|
599
|
+
offset: min,
|
|
600
|
+
color: negativeColor,
|
|
601
|
+
opacity: 0.4
|
|
602
|
+
}, {
|
|
603
|
+
offset: 0,
|
|
604
|
+
color: negativeColor,
|
|
605
|
+
opacity: 0
|
|
606
|
+
}, {
|
|
607
|
+
offset: 0,
|
|
608
|
+
color: positiveColor,
|
|
609
|
+
opacity: 0
|
|
610
|
+
}, {
|
|
611
|
+
offset: max,
|
|
612
|
+
color: positiveColor,
|
|
613
|
+
opacity: 0.4
|
|
614
|
+
}];
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
})));
|
|
618
|
+
const chartAccessibilityLabel = "Price chart with " + data.length + " data points. Swipe to navigate.";
|
|
619
|
+
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": " + tickLabelFormatter(data[index]), [data, tickLabelFormatter]);
|
|
620
|
+
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
621
|
+
enableScrubbing: true,
|
|
622
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
623
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
624
|
+
height: 200,
|
|
625
|
+
series: [{
|
|
626
|
+
id: 'prices',
|
|
627
|
+
data: data,
|
|
628
|
+
gradient: lineGradient
|
|
629
|
+
}],
|
|
630
|
+
children: [/*#__PURE__*/_jsx(YAxis, {
|
|
631
|
+
showGrid: true,
|
|
632
|
+
requestedTickCount: 2,
|
|
633
|
+
tickLabelFormatter: tickLabelFormatter
|
|
634
|
+
}), /*#__PURE__*/_jsx(Line, {
|
|
635
|
+
showArea: true,
|
|
636
|
+
AreaComponent: GradientDottedArea,
|
|
637
|
+
seriesId: "prices",
|
|
638
|
+
strokeWidth: 3
|
|
639
|
+
}), /*#__PURE__*/_jsx(Scrubber, {
|
|
640
|
+
hideOverlay: true
|
|
641
|
+
})]
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
function HighLowPrice() {
|
|
645
|
+
const data = [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58];
|
|
646
|
+
const minPrice = Math.min(...data);
|
|
647
|
+
const maxPrice = Math.max(...data);
|
|
648
|
+
const minPriceIndex = data.indexOf(minPrice);
|
|
649
|
+
const maxPriceIndex = data.indexOf(maxPrice);
|
|
650
|
+
const formatPrice = useCallback(price => {
|
|
651
|
+
return "$" + price.toLocaleString('en-US', {
|
|
652
|
+
minimumFractionDigits: 2,
|
|
653
|
+
maximumFractionDigits: 2
|
|
654
|
+
});
|
|
655
|
+
}, []);
|
|
656
|
+
return /*#__PURE__*/_jsxs(LineChart, {
|
|
657
|
+
showArea: true,
|
|
658
|
+
height: 200,
|
|
659
|
+
series: [{
|
|
660
|
+
id: 'prices',
|
|
661
|
+
data: data
|
|
662
|
+
}],
|
|
663
|
+
children: [/*#__PURE__*/_jsx(Point, {
|
|
664
|
+
dataX: minPriceIndex,
|
|
665
|
+
dataY: minPrice,
|
|
666
|
+
label: formatPrice(minPrice),
|
|
667
|
+
labelPosition: "bottom"
|
|
668
|
+
}), /*#__PURE__*/_jsx(Point, {
|
|
669
|
+
dataX: maxPriceIndex,
|
|
670
|
+
dataY: maxPrice,
|
|
671
|
+
label: formatPrice(maxPrice),
|
|
672
|
+
labelPosition: "top"
|
|
673
|
+
})]
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
function StylingScrubber() {
|
|
677
|
+
const theme = useTheme();
|
|
678
|
+
const pages = useMemo(() => ['Page A', 'Page B', 'Page C', 'Page D', 'Page E', 'Page F', 'Page G'], []);
|
|
679
|
+
const pageViews = useMemo(() => [2400, 1398, 9800, 3908, 4800, 3800, 4300], []);
|
|
680
|
+
const uniqueVisitors = useMemo(() => [4000, 3000, 2000, 2780, 1890, 2390, 3490], []);
|
|
681
|
+
const chartAccessibilityLabel = "Website visitors across " + pageViews.length + " pages.";
|
|
682
|
+
const getScrubberAccessibilityLabel = useCallback(index => pages[index] + ": " + pageViews[index] + " views, " + uniqueVisitors[index] + " unique visitors.", [pages, pageViews, uniqueVisitors]);
|
|
683
|
+
const numberFormatter = useCallback(value => new Intl.NumberFormat('en-US', {
|
|
684
|
+
maximumFractionDigits: 0
|
|
685
|
+
}).format(value), []);
|
|
686
|
+
return /*#__PURE__*/_jsx(LineChart, {
|
|
687
|
+
enableScrubbing: true,
|
|
688
|
+
showArea: true,
|
|
689
|
+
showXAxis: true,
|
|
690
|
+
showYAxis: true,
|
|
691
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
692
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
693
|
+
height: 200,
|
|
694
|
+
series: [{
|
|
695
|
+
id: 'pageViews',
|
|
696
|
+
data: pageViews,
|
|
697
|
+
color: theme.color.accentBoldGreen,
|
|
698
|
+
// Label will render next to scrubber beacon
|
|
699
|
+
label: 'Page Views'
|
|
700
|
+
}, {
|
|
701
|
+
id: 'uniqueVisitors',
|
|
702
|
+
data: uniqueVisitors,
|
|
703
|
+
color: theme.color.accentBoldPurple,
|
|
704
|
+
label: 'Unique Visitors',
|
|
705
|
+
// Default area is gradient
|
|
706
|
+
areaType: 'dotted'
|
|
707
|
+
}],
|
|
708
|
+
xAxis: {
|
|
709
|
+
// Used on the x-axis to provide context for each index from the series data array
|
|
710
|
+
data: pages
|
|
711
|
+
},
|
|
712
|
+
yAxis: {
|
|
713
|
+
showGrid: true,
|
|
714
|
+
tickLabelFormatter: numberFormatter
|
|
715
|
+
},
|
|
716
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
717
|
+
idlePulse: true,
|
|
718
|
+
LineComponent: SolidLine,
|
|
719
|
+
seriesIds: ['pageViews']
|
|
720
|
+
})
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
function Compact() {
|
|
724
|
+
const theme = useTheme();
|
|
725
|
+
const dimensions = {
|
|
726
|
+
width: 62,
|
|
727
|
+
height: 18
|
|
728
|
+
};
|
|
729
|
+
const sparklineData = prices.map(price => parseFloat(price)).filter((price, index) => index % 10 === 0);
|
|
730
|
+
const positiveFloor = Math.min(...sparklineData) - 10;
|
|
731
|
+
const negativeData = sparklineData.map(price => -1 * price).reverse();
|
|
732
|
+
const negativeCeiling = Math.max(...negativeData) + 10;
|
|
733
|
+
const formatPrice = useCallback(price => {
|
|
734
|
+
return "$" + price.toLocaleString('en-US', {
|
|
735
|
+
minimumFractionDigits: 2,
|
|
736
|
+
maximumFractionDigits: 2
|
|
737
|
+
});
|
|
738
|
+
}, []);
|
|
739
|
+
const CompactChart = /*#__PURE__*/memo(_ref6 => {
|
|
740
|
+
let {
|
|
741
|
+
data,
|
|
742
|
+
showArea,
|
|
743
|
+
color,
|
|
744
|
+
referenceY
|
|
745
|
+
} = _ref6;
|
|
746
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
747
|
+
style: {
|
|
748
|
+
padding: 1
|
|
749
|
+
},
|
|
750
|
+
children: /*#__PURE__*/_jsx(LineChart, _extends({}, dimensions, {
|
|
751
|
+
enableScrubbing: false,
|
|
752
|
+
inset: 0,
|
|
753
|
+
series: [{
|
|
754
|
+
id: 'btc',
|
|
755
|
+
data,
|
|
756
|
+
color
|
|
757
|
+
}],
|
|
758
|
+
showArea: showArea,
|
|
759
|
+
children: /*#__PURE__*/_jsx(ReferenceLine, {
|
|
760
|
+
dataY: referenceY
|
|
761
|
+
})
|
|
762
|
+
}))
|
|
763
|
+
});
|
|
764
|
+
});
|
|
765
|
+
const ChartCell = /*#__PURE__*/memo(_ref7 => {
|
|
766
|
+
let {
|
|
767
|
+
data,
|
|
768
|
+
showArea,
|
|
769
|
+
color,
|
|
770
|
+
referenceY,
|
|
771
|
+
subdetail
|
|
772
|
+
} = _ref7;
|
|
773
|
+
return /*#__PURE__*/_jsx(ListCell, {
|
|
774
|
+
accessibilityLabel: "Compact chart cell",
|
|
775
|
+
detail: formatPrice(parseFloat(prices[0])),
|
|
776
|
+
intermediary: /*#__PURE__*/_jsx(CompactChart, {
|
|
777
|
+
color: color,
|
|
778
|
+
data: data,
|
|
779
|
+
referenceY: referenceY,
|
|
780
|
+
showArea: showArea
|
|
781
|
+
}),
|
|
782
|
+
media: /*#__PURE__*/_jsx(Avatar, {
|
|
783
|
+
src: assets.btc.imageUrl
|
|
784
|
+
}),
|
|
785
|
+
onPress: () => console.log('clicked'),
|
|
786
|
+
spacingVariant: "condensed",
|
|
787
|
+
style: {
|
|
788
|
+
padding: 0
|
|
789
|
+
},
|
|
790
|
+
subdetail: subdetail
|
|
791
|
+
});
|
|
792
|
+
});
|
|
793
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
794
|
+
children: [/*#__PURE__*/_jsx(ChartCell, {
|
|
795
|
+
color: assets.btc.color,
|
|
796
|
+
data: sparklineData,
|
|
797
|
+
referenceY: parseFloat(prices[Math.floor(prices.length / 4)]),
|
|
798
|
+
subdetail: "-4.55%"
|
|
799
|
+
}), /*#__PURE__*/_jsx(ChartCell, {
|
|
800
|
+
showArea: true,
|
|
801
|
+
color: assets.btc.color,
|
|
802
|
+
data: sparklineData,
|
|
803
|
+
referenceY: parseFloat(prices[Math.floor(prices.length / 4)]),
|
|
804
|
+
subdetail: "-4.55%"
|
|
805
|
+
}), /*#__PURE__*/_jsx(ChartCell, {
|
|
806
|
+
showArea: true,
|
|
807
|
+
color: theme.color.fgPositive,
|
|
808
|
+
data: sparklineData,
|
|
809
|
+
referenceY: positiveFloor,
|
|
810
|
+
subdetail: "+0.25%"
|
|
811
|
+
}), /*#__PURE__*/_jsx(ChartCell, {
|
|
812
|
+
showArea: true,
|
|
813
|
+
color: theme.color.fgNegative,
|
|
814
|
+
data: negativeData,
|
|
815
|
+
referenceY: negativeCeiling,
|
|
816
|
+
subdetail: "-4.55%"
|
|
817
|
+
})]
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
function AssetPriceWithDottedArea() {
|
|
821
|
+
const fontMgr = useMemo(() => {
|
|
822
|
+
const fontProvider = Skia.TypefaceFontProvider.Make();
|
|
823
|
+
// Register system fonts if available, otherwise Skia will use defaults
|
|
824
|
+
return fontProvider;
|
|
825
|
+
}, []);
|
|
826
|
+
const BTCTab = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref8, ref) => {
|
|
827
|
+
let {
|
|
828
|
+
label
|
|
829
|
+
} = _ref8,
|
|
830
|
+
props = _objectWithoutPropertiesLoose(_ref8, _excluded2);
|
|
831
|
+
const {
|
|
832
|
+
activeTab
|
|
833
|
+
} = useTabsContext();
|
|
834
|
+
const isActive = (activeTab == null ? void 0 : activeTab.id) === props.id;
|
|
835
|
+
return /*#__PURE__*/_jsx(SegmentedTab, _extends({
|
|
836
|
+
ref: ref,
|
|
837
|
+
label: /*#__PURE__*/_jsx(Text, {
|
|
838
|
+
font: "label1",
|
|
839
|
+
style: {
|
|
840
|
+
color: isActive ? assets.btc.color : undefined
|
|
841
|
+
},
|
|
842
|
+
children: label
|
|
843
|
+
})
|
|
844
|
+
}, props));
|
|
845
|
+
}));
|
|
846
|
+
const BTCActiveIndicator = /*#__PURE__*/memo(_ref9 => {
|
|
847
|
+
let {
|
|
848
|
+
style
|
|
849
|
+
} = _ref9,
|
|
850
|
+
props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
|
|
851
|
+
return /*#__PURE__*/_jsx(PeriodSelectorActiveIndicator, _extends({}, props, {
|
|
852
|
+
style: [style, {
|
|
853
|
+
backgroundColor: assets.btc.color + "1A"
|
|
854
|
+
}]
|
|
855
|
+
}));
|
|
856
|
+
});
|
|
857
|
+
const AssetPriceDotted = /*#__PURE__*/memo(() => {
|
|
858
|
+
const theme = useTheme();
|
|
859
|
+
const currentPrice = sparklineInteractiveData.hour[sparklineInteractiveData.hour.length - 1].value;
|
|
860
|
+
const tabs = useMemo(() => [{
|
|
861
|
+
id: 'hour',
|
|
862
|
+
label: '1H'
|
|
863
|
+
}, {
|
|
864
|
+
id: 'day',
|
|
865
|
+
label: '1D'
|
|
866
|
+
}, {
|
|
867
|
+
id: 'week',
|
|
868
|
+
label: '1W'
|
|
869
|
+
}, {
|
|
870
|
+
id: 'month',
|
|
871
|
+
label: '1M'
|
|
872
|
+
}, {
|
|
873
|
+
id: 'year',
|
|
874
|
+
label: '1Y'
|
|
875
|
+
}, {
|
|
876
|
+
id: 'all',
|
|
877
|
+
label: 'All'
|
|
878
|
+
}], []);
|
|
879
|
+
const [timePeriod, setTimePeriod] = useState(tabs[0]);
|
|
880
|
+
const sparklineTimePeriodData = useMemo(() => {
|
|
881
|
+
return sparklineInteractiveData[timePeriod.id];
|
|
882
|
+
}, [timePeriod]);
|
|
883
|
+
const sparklineTimePeriodDataValues = useMemo(() => {
|
|
884
|
+
return sparklineTimePeriodData.map(d => d.value);
|
|
885
|
+
}, [sparklineTimePeriodData]);
|
|
886
|
+
const sparklineTimePeriodDataTimestamps = useMemo(() => {
|
|
887
|
+
return sparklineTimePeriodData.map(d => d.date);
|
|
888
|
+
}, [sparklineTimePeriodData]);
|
|
889
|
+
const onPeriodChange = useCallback(period => {
|
|
890
|
+
setTimePeriod(period || tabs[0]);
|
|
891
|
+
}, [tabs, setTimePeriod]);
|
|
892
|
+
const priceFormatter = useMemo(() => new Intl.NumberFormat('en-US', {
|
|
893
|
+
style: 'currency',
|
|
894
|
+
currency: 'USD'
|
|
895
|
+
}), []);
|
|
896
|
+
const formatPrice = useCallback(price => {
|
|
897
|
+
return priceFormatter.format(price);
|
|
898
|
+
}, [priceFormatter]);
|
|
899
|
+
const formatDate = useCallback(date => {
|
|
900
|
+
const dayOfWeek = date.toLocaleDateString('en-US', {
|
|
901
|
+
weekday: 'short'
|
|
902
|
+
});
|
|
903
|
+
const monthDay = date.toLocaleDateString('en-US', {
|
|
904
|
+
month: 'short',
|
|
905
|
+
day: 'numeric'
|
|
906
|
+
});
|
|
907
|
+
const time = date.toLocaleTimeString('en-US', {
|
|
908
|
+
hour: 'numeric',
|
|
909
|
+
minute: '2-digit',
|
|
910
|
+
hour12: true
|
|
911
|
+
});
|
|
912
|
+
return dayOfWeek + ", " + monthDay + ", " + time;
|
|
913
|
+
}, []);
|
|
914
|
+
const chartAccessibilityLabel = "Bitcoin price chart for " + timePeriod.label + " period. Current price: " + formatPrice(currentPrice) + ".";
|
|
915
|
+
const getScrubberAccessibilityLabel = useCallback(index => {
|
|
916
|
+
const price = formatPrice(sparklineTimePeriodDataValues[index]);
|
|
917
|
+
const date = formatDate(sparklineTimePeriodDataTimestamps[index]);
|
|
918
|
+
return price + " " + date;
|
|
919
|
+
}, [formatDate, formatPrice, sparklineTimePeriodDataTimestamps, sparklineTimePeriodDataValues]);
|
|
920
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
921
|
+
gap: 2,
|
|
922
|
+
children: [/*#__PURE__*/_jsx(SectionHeader, {
|
|
923
|
+
balance: /*#__PURE__*/_jsx(Text, {
|
|
924
|
+
font: "title2",
|
|
925
|
+
children: formatPrice(currentPrice)
|
|
926
|
+
}),
|
|
927
|
+
end: /*#__PURE__*/_jsx(VStack, {
|
|
928
|
+
justifyContent: "center",
|
|
929
|
+
children: /*#__PURE__*/_jsx(RemoteImage, {
|
|
930
|
+
shape: "circle",
|
|
931
|
+
size: "xl",
|
|
932
|
+
source: assets.btc.imageUrl
|
|
933
|
+
})
|
|
934
|
+
}),
|
|
935
|
+
title: /*#__PURE__*/_jsx(Text, {
|
|
936
|
+
font: "title1",
|
|
937
|
+
children: "Bitcoin"
|
|
938
|
+
})
|
|
939
|
+
}), /*#__PURE__*/_jsx(LineChart, {
|
|
940
|
+
enableScrubbing: true,
|
|
941
|
+
showArea: true,
|
|
942
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
943
|
+
areaType: "dotted",
|
|
944
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
945
|
+
height: 200,
|
|
946
|
+
inset: {
|
|
947
|
+
top: 52
|
|
948
|
+
},
|
|
949
|
+
series: [{
|
|
950
|
+
id: 'btc',
|
|
951
|
+
data: sparklineTimePeriodDataValues,
|
|
952
|
+
color: assets.btc.color
|
|
953
|
+
}],
|
|
954
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
955
|
+
idlePulse: true,
|
|
956
|
+
labelElevated: true,
|
|
957
|
+
label: d => {
|
|
958
|
+
const date = formatDate(sparklineTimePeriodDataTimestamps[d]);
|
|
959
|
+
const price = formatPrice(sparklineTimePeriodDataValues[d]);
|
|
960
|
+
const regularStyle = {
|
|
961
|
+
fontFamilies: ['Inter'],
|
|
962
|
+
fontSize: 14,
|
|
963
|
+
fontStyle: {
|
|
964
|
+
weight: FontWeight.Normal
|
|
965
|
+
},
|
|
966
|
+
color: Skia.Color(theme.color.fgMuted)
|
|
967
|
+
};
|
|
968
|
+
const boldStyle = _extends({
|
|
969
|
+
fontFamilies: ['Inter']
|
|
970
|
+
}, regularStyle, {
|
|
971
|
+
fontStyle: {
|
|
972
|
+
weight: FontWeight.Bold
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
// 3. Use the ParagraphBuilder
|
|
977
|
+
const builder = Skia.ParagraphBuilder.Make({
|
|
978
|
+
textAlign: TextAlign.Left
|
|
979
|
+
}, fontMgr);
|
|
980
|
+
builder.pushStyle(boldStyle);
|
|
981
|
+
builder.addText(price);
|
|
982
|
+
builder.pushStyle(regularStyle);
|
|
983
|
+
builder.addText(" " + date);
|
|
984
|
+
const para = builder.build();
|
|
985
|
+
para.layout(512);
|
|
986
|
+
return para;
|
|
987
|
+
}
|
|
988
|
+
})
|
|
989
|
+
}), /*#__PURE__*/_jsx(PeriodSelector, {
|
|
990
|
+
TabComponent: BTCTab,
|
|
991
|
+
TabsActiveIndicatorComponent: BTCActiveIndicator,
|
|
992
|
+
activeTab: timePeriod,
|
|
993
|
+
onChange: onPeriodChange,
|
|
994
|
+
tabs: tabs
|
|
995
|
+
})]
|
|
996
|
+
});
|
|
997
|
+
});
|
|
998
|
+
return /*#__PURE__*/_jsx(AssetPriceDotted, {});
|
|
999
|
+
}
|
|
1000
|
+
const LegendDot = /*#__PURE__*/memo(props => {
|
|
1001
|
+
return /*#__PURE__*/_jsx(Box, _extends({
|
|
1002
|
+
borderRadius: 1000,
|
|
1003
|
+
height: 10,
|
|
1004
|
+
width: 10
|
|
1005
|
+
}, props));
|
|
1006
|
+
});
|
|
1007
|
+
const LegendEntry = /*#__PURE__*/memo(_ref0 => {
|
|
1008
|
+
let {
|
|
1009
|
+
color = assets.btc.color,
|
|
1010
|
+
label,
|
|
1011
|
+
value
|
|
1012
|
+
} = _ref0;
|
|
1013
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
1014
|
+
alignItems: "center",
|
|
1015
|
+
flexDirection: "row",
|
|
1016
|
+
gap: 0.5,
|
|
1017
|
+
children: [/*#__PURE__*/_jsx(LegendDot, {
|
|
1018
|
+
style: {
|
|
1019
|
+
backgroundColor: color
|
|
1020
|
+
}
|
|
1021
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
1022
|
+
font: "label2",
|
|
1023
|
+
children: label
|
|
1024
|
+
}), value && /*#__PURE__*/_jsx(Text, {
|
|
1025
|
+
color: "fgMuted",
|
|
1026
|
+
font: "label2",
|
|
1027
|
+
style: {
|
|
1028
|
+
fontWeight: 'bold'
|
|
1029
|
+
},
|
|
1030
|
+
children: value
|
|
1031
|
+
})]
|
|
1032
|
+
});
|
|
1033
|
+
});
|
|
1034
|
+
const PerformanceHeader = /*#__PURE__*/memo(_ref1 => {
|
|
1035
|
+
let {
|
|
1036
|
+
scrubberPosition,
|
|
1037
|
+
sparklineTimePeriodDataValues
|
|
1038
|
+
} = _ref1;
|
|
1039
|
+
const theme = useTheme();
|
|
1040
|
+
const formatPriceThousands = useCallback(price => {
|
|
1041
|
+
return new Intl.NumberFormat('en-US', {
|
|
1042
|
+
style: 'currency',
|
|
1043
|
+
currency: 'USD',
|
|
1044
|
+
minimumFractionDigits: 0,
|
|
1045
|
+
maximumFractionDigits: 0
|
|
1046
|
+
}).format(price / 1000) + "k";
|
|
1047
|
+
}, []);
|
|
1048
|
+
const shownPosition = scrubberPosition !== undefined ? scrubberPosition : sparklineTimePeriodDataValues.length - 1;
|
|
1049
|
+
return /*#__PURE__*/_jsxs(HStack, {
|
|
1050
|
+
gap: 1,
|
|
1051
|
+
paddingX: 1,
|
|
1052
|
+
children: [/*#__PURE__*/_jsx(LegendEntry, {
|
|
1053
|
+
color: theme.color.fgPositive,
|
|
1054
|
+
label: "High Price",
|
|
1055
|
+
value: formatPriceThousands(sparklineTimePeriodDataValues[shownPosition] * 1.2)
|
|
1056
|
+
}), /*#__PURE__*/_jsx(LegendEntry, {
|
|
1057
|
+
color: assets.btc.color,
|
|
1058
|
+
label: "Actual Price",
|
|
1059
|
+
value: formatPriceThousands(sparklineTimePeriodDataValues[shownPosition])
|
|
1060
|
+
}), /*#__PURE__*/_jsx(LegendEntry, {
|
|
1061
|
+
color: theme.color.fgNegative,
|
|
1062
|
+
label: "Low Price",
|
|
1063
|
+
value: formatPriceThousands(sparklineTimePeriodDataValues[shownPosition] * 0.8)
|
|
1064
|
+
})]
|
|
1065
|
+
});
|
|
1066
|
+
});
|
|
1067
|
+
const PerformanceChart = /*#__PURE__*/memo(_ref10 => {
|
|
1068
|
+
let {
|
|
1069
|
+
timePeriod,
|
|
1070
|
+
onScrubberPositionChange
|
|
1071
|
+
} = _ref10;
|
|
1072
|
+
const theme = useTheme();
|
|
1073
|
+
const sparklineTimePeriodData = useMemo(() => {
|
|
1074
|
+
return sparklineInteractiveData[timePeriod.id];
|
|
1075
|
+
}, [timePeriod]);
|
|
1076
|
+
const sparklineTimePeriodDataValues = useMemo(() => {
|
|
1077
|
+
return sparklineTimePeriodData.map(d => d.value);
|
|
1078
|
+
}, [sparklineTimePeriodData]);
|
|
1079
|
+
const sparklineTimePeriodDataTimestamps = useMemo(() => {
|
|
1080
|
+
return sparklineTimePeriodData.map(d => d.date);
|
|
1081
|
+
}, [sparklineTimePeriodData]);
|
|
1082
|
+
const formatPriceThousands = useCallback(price => {
|
|
1083
|
+
return new Intl.NumberFormat('en-US', {
|
|
1084
|
+
style: 'currency',
|
|
1085
|
+
currency: 'USD',
|
|
1086
|
+
minimumFractionDigits: 0,
|
|
1087
|
+
maximumFractionDigits: 0
|
|
1088
|
+
}).format(price / 1000) + "k";
|
|
1089
|
+
}, []);
|
|
1090
|
+
const formatDate = useCallback(date => {
|
|
1091
|
+
const dayOfWeek = date.toLocaleDateString('en-US', {
|
|
1092
|
+
weekday: 'short'
|
|
1093
|
+
});
|
|
1094
|
+
const monthDay = date.toLocaleDateString('en-US', {
|
|
1095
|
+
month: 'short',
|
|
1096
|
+
day: 'numeric'
|
|
1097
|
+
});
|
|
1098
|
+
const time = date.toLocaleTimeString('en-US', {
|
|
1099
|
+
hour: 'numeric',
|
|
1100
|
+
minute: '2-digit',
|
|
1101
|
+
hour12: true
|
|
1102
|
+
});
|
|
1103
|
+
return dayOfWeek + ", " + monthDay + ", " + time;
|
|
1104
|
+
}, []);
|
|
1105
|
+
const getScrubberLabel = useCallback(d => formatDate(sparklineTimePeriodDataTimestamps[d]), [formatDate, sparklineTimePeriodDataTimestamps]);
|
|
1106
|
+
const chartAccessibilityLabel = "Bitcoin price chart with high, actual, and low series. " + sparklineTimePeriodDataValues.length + " data points. Swipe to navigate.";
|
|
1107
|
+
const getScrubberAccessibilityLabel = useCallback(index => {
|
|
1108
|
+
const price = formatPriceThousands(sparklineTimePeriodDataValues[index]);
|
|
1109
|
+
const date = formatDate(sparklineTimePeriodDataTimestamps[index]);
|
|
1110
|
+
return "Point " + (index + 1) + ": " + price + ", " + date;
|
|
1111
|
+
}, [formatDate, formatPriceThousands, sparklineTimePeriodDataTimestamps, sparklineTimePeriodDataValues]);
|
|
1112
|
+
return /*#__PURE__*/_jsx(LineChart, {
|
|
1113
|
+
enableScrubbing: true,
|
|
1114
|
+
showArea: true,
|
|
1115
|
+
showYAxis: true,
|
|
1116
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
1117
|
+
areaType: "dotted",
|
|
1118
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
1119
|
+
height: 300,
|
|
1120
|
+
inset: {
|
|
1121
|
+
top: 52,
|
|
1122
|
+
left: 0,
|
|
1123
|
+
right: 0
|
|
1124
|
+
},
|
|
1125
|
+
onScrubberPositionChange: onScrubberPositionChange,
|
|
1126
|
+
series: [{
|
|
1127
|
+
id: 'high',
|
|
1128
|
+
data: sparklineTimePeriodDataValues.map(d => d * 1.2),
|
|
1129
|
+
color: theme.color.fgPositive,
|
|
1130
|
+
label: 'High Price'
|
|
1131
|
+
}, {
|
|
1132
|
+
id: 'btc',
|
|
1133
|
+
data: sparklineTimePeriodDataValues,
|
|
1134
|
+
color: assets.btc.color,
|
|
1135
|
+
label: 'Actual Price'
|
|
1136
|
+
}, {
|
|
1137
|
+
id: 'low',
|
|
1138
|
+
data: sparklineTimePeriodDataValues.map(d => d * 0.8),
|
|
1139
|
+
color: theme.color.fgNegative,
|
|
1140
|
+
label: 'Low Price'
|
|
1141
|
+
}],
|
|
1142
|
+
yAxis: {
|
|
1143
|
+
showGrid: true,
|
|
1144
|
+
tickLabelFormatter: formatPriceThousands
|
|
1145
|
+
},
|
|
1146
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
1147
|
+
idlePulse: true,
|
|
1148
|
+
label: getScrubberLabel
|
|
1149
|
+
})
|
|
1150
|
+
});
|
|
1151
|
+
});
|
|
1152
|
+
function Performance() {
|
|
1153
|
+
const tabs = useMemo(() => [{
|
|
1154
|
+
id: 'hour',
|
|
1155
|
+
label: '1H'
|
|
1156
|
+
}, {
|
|
1157
|
+
id: 'day',
|
|
1158
|
+
label: '1D'
|
|
1159
|
+
}, {
|
|
1160
|
+
id: 'week',
|
|
1161
|
+
label: '1W'
|
|
1162
|
+
}, {
|
|
1163
|
+
id: 'month',
|
|
1164
|
+
label: '1M'
|
|
1165
|
+
}, {
|
|
1166
|
+
id: 'year',
|
|
1167
|
+
label: '1Y'
|
|
1168
|
+
}, {
|
|
1169
|
+
id: 'all',
|
|
1170
|
+
label: 'All'
|
|
1171
|
+
}], []);
|
|
1172
|
+
const [timePeriod, setTimePeriod] = useState(tabs[0]);
|
|
1173
|
+
const [scrubberPosition, setScrubberPosition] = useState();
|
|
1174
|
+
const sparklineTimePeriodData = useMemo(() => {
|
|
1175
|
+
return sparklineInteractiveData[timePeriod.id];
|
|
1176
|
+
}, [timePeriod]);
|
|
1177
|
+
const sparklineTimePeriodDataValues = useMemo(() => {
|
|
1178
|
+
return sparklineTimePeriodData.map(d => d.value);
|
|
1179
|
+
}, [sparklineTimePeriodData]);
|
|
1180
|
+
const onPeriodChange = useCallback(period => {
|
|
1181
|
+
setTimePeriod(period || tabs[0]);
|
|
1182
|
+
}, [tabs]);
|
|
1183
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
1184
|
+
gap: 2,
|
|
1185
|
+
style: {
|
|
1186
|
+
marginLeft: -8,
|
|
1187
|
+
marginRight: -8
|
|
1188
|
+
},
|
|
1189
|
+
children: [/*#__PURE__*/_jsx(PerformanceHeader, {
|
|
1190
|
+
scrubberPosition: scrubberPosition,
|
|
1191
|
+
sparklineTimePeriodDataValues: sparklineTimePeriodDataValues
|
|
1192
|
+
}), /*#__PURE__*/_jsx(PerformanceChart, {
|
|
1193
|
+
onScrubberPositionChange: setScrubberPosition,
|
|
1194
|
+
timePeriod: timePeriod
|
|
1195
|
+
}), /*#__PURE__*/_jsx(PeriodSelector, {
|
|
1196
|
+
activeTab: timePeriod,
|
|
1197
|
+
onChange: onPeriodChange,
|
|
1198
|
+
tabs: tabs
|
|
1199
|
+
})]
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
function MonotoneAssetPrice() {
|
|
1203
|
+
const theme = useTheme();
|
|
1204
|
+
const prices = sparklineInteractiveData.hour;
|
|
1205
|
+
const fontMgr = useMemo(() => {
|
|
1206
|
+
const fontProvider = Skia.TypefaceFontProvider.Make();
|
|
1207
|
+
// Register system fonts if available, otherwise Skia will use defaults
|
|
1208
|
+
return fontProvider;
|
|
1209
|
+
}, []);
|
|
1210
|
+
const priceFormatter = useMemo(() => new Intl.NumberFormat('en-US', {
|
|
1211
|
+
style: 'currency',
|
|
1212
|
+
currency: 'USD'
|
|
1213
|
+
}), []);
|
|
1214
|
+
const scrubberPriceFormatter = useMemo(() => new Intl.NumberFormat('en-US', {
|
|
1215
|
+
minimumFractionDigits: 2,
|
|
1216
|
+
maximumFractionDigits: 2
|
|
1217
|
+
}), []);
|
|
1218
|
+
const formatPrice = useCallback(price => {
|
|
1219
|
+
return priceFormatter.format(price);
|
|
1220
|
+
}, [priceFormatter]);
|
|
1221
|
+
const formatDate = useCallback(date => {
|
|
1222
|
+
const dayOfWeek = date.toLocaleDateString('en-US', {
|
|
1223
|
+
weekday: 'short'
|
|
1224
|
+
});
|
|
1225
|
+
const monthDay = date.toLocaleDateString('en-US', {
|
|
1226
|
+
month: 'short',
|
|
1227
|
+
day: 'numeric'
|
|
1228
|
+
});
|
|
1229
|
+
const time = date.toLocaleTimeString('en-US', {
|
|
1230
|
+
hour: 'numeric',
|
|
1231
|
+
minute: '2-digit',
|
|
1232
|
+
hour12: true
|
|
1233
|
+
});
|
|
1234
|
+
return dayOfWeek + ", " + monthDay + ", " + time;
|
|
1235
|
+
}, []);
|
|
1236
|
+
const scrubberLabel = useCallback(index => {
|
|
1237
|
+
const price = scrubberPriceFormatter.format(prices[index].value);
|
|
1238
|
+
const date = formatDate(prices[index].date);
|
|
1239
|
+
const regularStyle = {
|
|
1240
|
+
fontFamilies: ['Inter'],
|
|
1241
|
+
fontSize: 14,
|
|
1242
|
+
fontStyle: {
|
|
1243
|
+
weight: FontWeight.Normal
|
|
1244
|
+
},
|
|
1245
|
+
color: Skia.Color(theme.color.fgMuted)
|
|
1246
|
+
};
|
|
1247
|
+
const boldStyle = _extends({
|
|
1248
|
+
fontFamilies: ['Inter']
|
|
1249
|
+
}, regularStyle, {
|
|
1250
|
+
fontStyle: {
|
|
1251
|
+
weight: FontWeight.Bold
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
const builder = Skia.ParagraphBuilder.Make({
|
|
1255
|
+
textAlign: TextAlign.Left
|
|
1256
|
+
}, fontMgr);
|
|
1257
|
+
builder.pushStyle(boldStyle);
|
|
1258
|
+
builder.addText(price + " USD");
|
|
1259
|
+
builder.pushStyle(regularStyle);
|
|
1260
|
+
builder.addText(" " + date);
|
|
1261
|
+
const para = builder.build();
|
|
1262
|
+
para.layout(512);
|
|
1263
|
+
return para;
|
|
1264
|
+
}, [scrubberPriceFormatter, prices, formatDate, theme.color.fgMuted, fontMgr]);
|
|
1265
|
+
const formatAxisLabelPrice = useCallback(price => {
|
|
1266
|
+
return formatPrice(price);
|
|
1267
|
+
}, [formatPrice]);
|
|
1268
|
+
|
|
1269
|
+
// Custom tick label component with offset positioning
|
|
1270
|
+
const CustomYAxisTickLabel = useCallback(props => /*#__PURE__*/_jsx(DefaultAxisTickLabel, _extends({}, props, {
|
|
1271
|
+
dx: 4,
|
|
1272
|
+
dy: -12,
|
|
1273
|
+
horizontalAlignment: "left"
|
|
1274
|
+
})), []);
|
|
1275
|
+
const chartAccessibilityLabel = "Price chart with " + prices.length + " data points. Swipe to navigate.";
|
|
1276
|
+
const getScrubberAccessibilityLabel = useCallback(index => {
|
|
1277
|
+
const price = scrubberPriceFormatter.format(prices[index].value);
|
|
1278
|
+
const date = formatDate(prices[index].date);
|
|
1279
|
+
return price + " USD " + date;
|
|
1280
|
+
}, [formatDate, prices, scrubberPriceFormatter]);
|
|
1281
|
+
const CustomScrubberBeacon = /*#__PURE__*/memo(_ref11 => {
|
|
1282
|
+
let {
|
|
1283
|
+
dataX,
|
|
1284
|
+
dataY,
|
|
1285
|
+
seriesId,
|
|
1286
|
+
isIdle,
|
|
1287
|
+
animate = true
|
|
1288
|
+
} = _ref11;
|
|
1289
|
+
const {
|
|
1290
|
+
getSeries,
|
|
1291
|
+
getXSerializableScale,
|
|
1292
|
+
getYSerializableScale
|
|
1293
|
+
} = useCartesianChartContext();
|
|
1294
|
+
const targetSeries = useMemo(() => getSeries(seriesId), [getSeries, seriesId]);
|
|
1295
|
+
const xScale = useMemo(() => getXSerializableScale(), [getXSerializableScale]);
|
|
1296
|
+
const yScale = useMemo(() => getYSerializableScale(targetSeries == null ? void 0 : targetSeries.yAxisId), [getYSerializableScale, targetSeries == null ? void 0 : targetSeries.yAxisId]);
|
|
1297
|
+
const animatedX = useSharedValue(0);
|
|
1298
|
+
const animatedY = useSharedValue(0);
|
|
1299
|
+
|
|
1300
|
+
// Calculate the target point position - project data to pixels
|
|
1301
|
+
const targetPoint = useDerivedValue(() => {
|
|
1302
|
+
if (!xScale || !yScale) return {
|
|
1303
|
+
x: 0,
|
|
1304
|
+
y: 0
|
|
1305
|
+
};
|
|
1306
|
+
return projectPointWithSerializableScale({
|
|
1307
|
+
x: unwrapAnimatedValue(dataX),
|
|
1308
|
+
y: unwrapAnimatedValue(dataY),
|
|
1309
|
+
xScale,
|
|
1310
|
+
yScale
|
|
1311
|
+
});
|
|
1312
|
+
}, [dataX, dataY, xScale, yScale]);
|
|
1313
|
+
useAnimatedReaction(() => {
|
|
1314
|
+
return {
|
|
1315
|
+
point: targetPoint.value,
|
|
1316
|
+
isIdle: unwrapAnimatedValue(isIdle)
|
|
1317
|
+
};
|
|
1318
|
+
}, (current, previous) => {
|
|
1319
|
+
// When animation is disabled, on initial render, or when we are starting,
|
|
1320
|
+
// continuing, or finishing scrubbing we should immediately transition
|
|
1321
|
+
if (!animate || previous === null || !previous.isIdle || !current.isIdle) {
|
|
1322
|
+
animatedX.value = current.point.x;
|
|
1323
|
+
animatedY.value = current.point.y;
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
animatedX.value = buildTransition(current.point.x, defaultTransition);
|
|
1327
|
+
animatedY.value = buildTransition(current.point.y, defaultTransition);
|
|
1328
|
+
}, [animate]);
|
|
1329
|
+
|
|
1330
|
+
// Create animated point using the animated values
|
|
1331
|
+
const animatedPoint = useDerivedValue(() => {
|
|
1332
|
+
return {
|
|
1333
|
+
x: animatedX.value,
|
|
1334
|
+
y: animatedY.value
|
|
1335
|
+
};
|
|
1336
|
+
}, [animatedX, animatedY]);
|
|
1337
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
1338
|
+
children: [/*#__PURE__*/_jsx(Circle, {
|
|
1339
|
+
c: animatedPoint,
|
|
1340
|
+
color: theme.color.bg,
|
|
1341
|
+
r: 5
|
|
1342
|
+
}), /*#__PURE__*/_jsx(Circle, {
|
|
1343
|
+
c: animatedPoint,
|
|
1344
|
+
color: theme.color.fg,
|
|
1345
|
+
r: 5,
|
|
1346
|
+
strokeWidth: 3,
|
|
1347
|
+
style: "stroke"
|
|
1348
|
+
})]
|
|
1349
|
+
});
|
|
1350
|
+
});
|
|
1351
|
+
return /*#__PURE__*/_jsx(LineChart, {
|
|
1352
|
+
enableScrubbing: true,
|
|
1353
|
+
showYAxis: true,
|
|
1354
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
1355
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
1356
|
+
height: 200,
|
|
1357
|
+
inset: {
|
|
1358
|
+
top: 64
|
|
1359
|
+
},
|
|
1360
|
+
series: [{
|
|
1361
|
+
id: 'btc',
|
|
1362
|
+
data: prices.map(price => price.value),
|
|
1363
|
+
color: theme.color.fg,
|
|
1364
|
+
gradient: {
|
|
1365
|
+
axis: 'x',
|
|
1366
|
+
stops: _ref12 => {
|
|
1367
|
+
let {
|
|
1368
|
+
min
|
|
1369
|
+
} = _ref12;
|
|
1370
|
+
return [{
|
|
1371
|
+
offset: min,
|
|
1372
|
+
color: theme.color.fg,
|
|
1373
|
+
opacity: 0
|
|
1374
|
+
}, {
|
|
1375
|
+
offset: 32,
|
|
1376
|
+
color: theme.color.fg,
|
|
1377
|
+
opacity: 1
|
|
1378
|
+
}];
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}],
|
|
1382
|
+
xAxis: {
|
|
1383
|
+
range: _ref13 => {
|
|
1384
|
+
let {
|
|
1385
|
+
max
|
|
1386
|
+
} = _ref13;
|
|
1387
|
+
return {
|
|
1388
|
+
min: 96,
|
|
1389
|
+
max
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
yAxis: {
|
|
1394
|
+
position: 'left',
|
|
1395
|
+
width: 0,
|
|
1396
|
+
showGrid: true,
|
|
1397
|
+
tickLabelFormatter: formatAxisLabelPrice,
|
|
1398
|
+
TickLabelComponent: CustomYAxisTickLabel
|
|
1399
|
+
},
|
|
1400
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
1401
|
+
hideOverlay: true,
|
|
1402
|
+
labelElevated: true,
|
|
1403
|
+
BeaconComponent: CustomScrubberBeacon,
|
|
1404
|
+
LineComponent: SolidLine,
|
|
1405
|
+
label: scrubberLabel
|
|
1406
|
+
})
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
function ServiceAvailability() {
|
|
1410
|
+
const theme = useTheme();
|
|
1411
|
+
const availabilityEvents = useMemo(() => [{
|
|
1412
|
+
date: new Date('2022-01-01'),
|
|
1413
|
+
availability: 79
|
|
1414
|
+
}, {
|
|
1415
|
+
date: new Date('2022-01-03'),
|
|
1416
|
+
availability: 81
|
|
1417
|
+
}, {
|
|
1418
|
+
date: new Date('2022-01-04'),
|
|
1419
|
+
availability: 82
|
|
1420
|
+
}, {
|
|
1421
|
+
date: new Date('2022-01-06'),
|
|
1422
|
+
availability: 91
|
|
1423
|
+
}, {
|
|
1424
|
+
date: new Date('2022-01-07'),
|
|
1425
|
+
availability: 92
|
|
1426
|
+
}, {
|
|
1427
|
+
date: new Date('2022-01-10'),
|
|
1428
|
+
availability: 86
|
|
1429
|
+
}], []);
|
|
1430
|
+
const chartAccessibilityLabel = "Service availability chart with " + availabilityEvents.length + " data points. Swipe to navigate.";
|
|
1431
|
+
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": " + availabilityEvents[index].availability + "% availability on " + availabilityEvents[index].date.toLocaleDateString(), [availabilityEvents]);
|
|
1432
|
+
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
1433
|
+
enableScrubbing: true,
|
|
1434
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
1435
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
1436
|
+
height: 200,
|
|
1437
|
+
series: [{
|
|
1438
|
+
id: 'availability',
|
|
1439
|
+
data: availabilityEvents.map(event => event.availability),
|
|
1440
|
+
gradient: {
|
|
1441
|
+
stops: _ref14 => {
|
|
1442
|
+
let {
|
|
1443
|
+
min,
|
|
1444
|
+
max
|
|
1445
|
+
} = _ref14;
|
|
1446
|
+
return [{
|
|
1447
|
+
offset: min,
|
|
1448
|
+
color: theme.color.fgNegative
|
|
1449
|
+
}, {
|
|
1450
|
+
offset: 85,
|
|
1451
|
+
color: theme.color.fgNegative
|
|
1452
|
+
}, {
|
|
1453
|
+
offset: 85,
|
|
1454
|
+
color: theme.color.fgWarning
|
|
1455
|
+
}, {
|
|
1456
|
+
offset: 90,
|
|
1457
|
+
color: theme.color.fgWarning
|
|
1458
|
+
}, {
|
|
1459
|
+
offset: 90,
|
|
1460
|
+
color: theme.color.fgPositive
|
|
1461
|
+
}, {
|
|
1462
|
+
offset: max,
|
|
1463
|
+
color: theme.color.fgPositive
|
|
1464
|
+
}];
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
}],
|
|
1468
|
+
xAxis: {
|
|
1469
|
+
data: availabilityEvents.map(event => event.date.getTime())
|
|
1470
|
+
},
|
|
1471
|
+
yAxis: {
|
|
1472
|
+
domain: _ref15 => {
|
|
1473
|
+
let {
|
|
1474
|
+
min,
|
|
1475
|
+
max
|
|
1476
|
+
} = _ref15;
|
|
1477
|
+
return {
|
|
1478
|
+
min: Math.max(min - 2, 0),
|
|
1479
|
+
max: Math.min(max + 2, 100)
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
children: [/*#__PURE__*/_jsx(XAxis, {
|
|
1484
|
+
showGrid: true,
|
|
1485
|
+
showLine: true,
|
|
1486
|
+
showTickMarks: true,
|
|
1487
|
+
tickLabelFormatter: value => new Date(value).toLocaleDateString()
|
|
1488
|
+
}), /*#__PURE__*/_jsx(YAxis, {
|
|
1489
|
+
showGrid: true,
|
|
1490
|
+
showLine: true,
|
|
1491
|
+
showTickMarks: true,
|
|
1492
|
+
position: "left",
|
|
1493
|
+
tickLabelFormatter: value => value + "%"
|
|
1494
|
+
}), /*#__PURE__*/_jsx(Line, {
|
|
1495
|
+
curve: "stepAfter",
|
|
1496
|
+
points: props => _extends({}, props, {
|
|
1497
|
+
fill: theme.color.bg,
|
|
1498
|
+
stroke: props.fill
|
|
1499
|
+
}),
|
|
1500
|
+
seriesId: "availability"
|
|
1501
|
+
}), /*#__PURE__*/_jsx(Scrubber, {
|
|
1502
|
+
hideOverlay: true
|
|
1503
|
+
})]
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
function ForecastAssetPrice() {
|
|
1507
|
+
const startYear = 2020;
|
|
1508
|
+
const data = useMemo(() => [50, 45, 47, 46, 54, 54, 60, 61, 63, 66, 70], []);
|
|
1509
|
+
const currentIndex = 6;
|
|
1510
|
+
const strokeWidth = 3;
|
|
1511
|
+
// To prevent cutting off the edge of our lines
|
|
1512
|
+
const clipOffset = strokeWidth;
|
|
1513
|
+
const axisFormatter = useCallback(dataIndex => {
|
|
1514
|
+
return "" + (startYear + dataIndex);
|
|
1515
|
+
}, [startYear]);
|
|
1516
|
+
const HistoricalLineComponent = /*#__PURE__*/memo(props => {
|
|
1517
|
+
const {
|
|
1518
|
+
drawingArea,
|
|
1519
|
+
getXScale
|
|
1520
|
+
} = useCartesianChartContext();
|
|
1521
|
+
const xScale = getXScale();
|
|
1522
|
+
const historicalClipPath = useMemo(() => {
|
|
1523
|
+
if (!xScale || !drawingArea) return null;
|
|
1524
|
+
const currentX = xScale(currentIndex);
|
|
1525
|
+
if (currentX === undefined) return null;
|
|
1526
|
+
|
|
1527
|
+
// Create clip path for historical data (left side)
|
|
1528
|
+
const clip = Skia.Path.Make();
|
|
1529
|
+
clip.addRect({
|
|
1530
|
+
x: drawingArea.x - clipOffset,
|
|
1531
|
+
y: drawingArea.y - clipOffset,
|
|
1532
|
+
width: currentX + clipOffset - drawingArea.x,
|
|
1533
|
+
height: drawingArea.height + clipOffset * 2
|
|
1534
|
+
});
|
|
1535
|
+
return clip;
|
|
1536
|
+
}, [xScale, drawingArea]);
|
|
1537
|
+
if (!historicalClipPath) return null;
|
|
1538
|
+
return /*#__PURE__*/_jsx(Group, {
|
|
1539
|
+
clip: historicalClipPath,
|
|
1540
|
+
children: /*#__PURE__*/_jsx(SolidLine, _extends({
|
|
1541
|
+
strokeWidth: strokeWidth
|
|
1542
|
+
}, props))
|
|
1543
|
+
});
|
|
1544
|
+
});
|
|
1545
|
+
|
|
1546
|
+
// Since the solid and dotted line have different curves,
|
|
1547
|
+
// we need two separate line components. Otherwise we could
|
|
1548
|
+
// have one line component with SolidLine and DottedLine inside
|
|
1549
|
+
// of it and two clipPaths.
|
|
1550
|
+
const ForecastLineComponent = /*#__PURE__*/memo(props => {
|
|
1551
|
+
const {
|
|
1552
|
+
drawingArea,
|
|
1553
|
+
getXScale
|
|
1554
|
+
} = useCartesianChartContext();
|
|
1555
|
+
const xScale = getXScale();
|
|
1556
|
+
const forecastClipPath = useMemo(() => {
|
|
1557
|
+
if (!xScale || !drawingArea) return null;
|
|
1558
|
+
const currentX = xScale(currentIndex);
|
|
1559
|
+
if (currentX === undefined) return null;
|
|
1560
|
+
|
|
1561
|
+
// Create clip path for forecast data (right side)
|
|
1562
|
+
const clip = Skia.Path.Make();
|
|
1563
|
+
clip.addRect({
|
|
1564
|
+
x: currentX,
|
|
1565
|
+
y: drawingArea.y - clipOffset,
|
|
1566
|
+
width: drawingArea.x + drawingArea.width - currentX + clipOffset * 2,
|
|
1567
|
+
height: drawingArea.height + clipOffset * 2
|
|
1568
|
+
});
|
|
1569
|
+
return clip;
|
|
1570
|
+
}, [xScale, drawingArea]);
|
|
1571
|
+
if (!forecastClipPath) return null;
|
|
1572
|
+
return /*#__PURE__*/_jsx(Group, {
|
|
1573
|
+
clip: forecastClipPath,
|
|
1574
|
+
children: /*#__PURE__*/_jsx(DottedLine, _extends({
|
|
1575
|
+
dashIntervals: [0, strokeWidth * 2],
|
|
1576
|
+
strokeWidth: strokeWidth
|
|
1577
|
+
}, props))
|
|
1578
|
+
});
|
|
1579
|
+
});
|
|
1580
|
+
const CustomScrubber = /*#__PURE__*/memo(() => {
|
|
1581
|
+
const {
|
|
1582
|
+
scrubberPosition
|
|
1583
|
+
} = useScrubberContext();
|
|
1584
|
+
const idleScrubberOpacity = useDerivedValue(() => scrubberPosition.value === undefined ? 1 : 0, [scrubberPosition]);
|
|
1585
|
+
const scrubberOpacity = useDerivedValue(() => scrubberPosition.value !== undefined ? 1 : 0, [scrubberPosition]);
|
|
1586
|
+
|
|
1587
|
+
// Fade in animation for the Scrubber
|
|
1588
|
+
const fadeInOpacity = useSharedValue(0);
|
|
1589
|
+
useEffect(() => {
|
|
1590
|
+
fadeInOpacity.value = withDelay(350, withTiming(1, {
|
|
1591
|
+
duration: 150
|
|
1592
|
+
}));
|
|
1593
|
+
}, [fadeInOpacity]);
|
|
1594
|
+
return /*#__PURE__*/_jsxs(Group, {
|
|
1595
|
+
opacity: fadeInOpacity,
|
|
1596
|
+
children: [/*#__PURE__*/_jsx(Group, {
|
|
1597
|
+
opacity: scrubberOpacity,
|
|
1598
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
1599
|
+
hideOverlay: true
|
|
1600
|
+
})
|
|
1601
|
+
}), /*#__PURE__*/_jsx(Group, {
|
|
1602
|
+
opacity: idleScrubberOpacity,
|
|
1603
|
+
children: /*#__PURE__*/_jsx(DefaultScrubberBeacon, {
|
|
1604
|
+
isIdle: true,
|
|
1605
|
+
dataX: currentIndex,
|
|
1606
|
+
dataY: data[currentIndex],
|
|
1607
|
+
seriesId: "price"
|
|
1608
|
+
})
|
|
1609
|
+
})]
|
|
1610
|
+
});
|
|
1611
|
+
});
|
|
1612
|
+
const chartAccessibilityLabel = "Forecast chart with " + data.length + " data points. Swipe to navigate.";
|
|
1613
|
+
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": " + axisFormatter(index) + ", value " + data[index], [axisFormatter, data]);
|
|
1614
|
+
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
1615
|
+
enableScrubbing: true,
|
|
1616
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
1617
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
1618
|
+
height: 200,
|
|
1619
|
+
series: [{
|
|
1620
|
+
id: 'price',
|
|
1621
|
+
data,
|
|
1622
|
+
color: assets.btc.color
|
|
1623
|
+
}],
|
|
1624
|
+
children: [/*#__PURE__*/_jsx(Line, {
|
|
1625
|
+
LineComponent: HistoricalLineComponent,
|
|
1626
|
+
curve: "linear",
|
|
1627
|
+
seriesId: "price"
|
|
1628
|
+
}), /*#__PURE__*/_jsx(Line, {
|
|
1629
|
+
LineComponent: ForecastLineComponent,
|
|
1630
|
+
curve: "monotone",
|
|
1631
|
+
seriesId: "price",
|
|
1632
|
+
type: "dotted"
|
|
1633
|
+
}), /*#__PURE__*/_jsx(XAxis, {
|
|
1634
|
+
position: "bottom",
|
|
1635
|
+
requestedTickCount: 3,
|
|
1636
|
+
tickLabelFormatter: axisFormatter
|
|
1637
|
+
}), /*#__PURE__*/_jsx(CustomScrubber, {})]
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
function DataCardWithLineChart() {
|
|
1641
|
+
const {
|
|
1642
|
+
spectrum
|
|
1643
|
+
} = useTheme();
|
|
1644
|
+
const exampleThumbnail = /*#__PURE__*/_jsx(RemoteImage, {
|
|
1645
|
+
accessibilityLabel: "Ethereum",
|
|
1646
|
+
shape: "circle",
|
|
1647
|
+
size: "xl",
|
|
1648
|
+
source: ethBackground,
|
|
1649
|
+
testID: "thumbnail"
|
|
1650
|
+
});
|
|
1651
|
+
const getLineChartSeries = useCallback(() => [{
|
|
1652
|
+
id: 'price',
|
|
1653
|
+
data: prices.slice(0, 30).map(price => parseFloat(price)),
|
|
1654
|
+
color: "rgb(" + spectrum.green70 + ")"
|
|
1655
|
+
}], [spectrum.green70]);
|
|
1656
|
+
const lineChartSeries = useMemo(() => getLineChartSeries(), [getLineChartSeries]);
|
|
1657
|
+
const lineChartSeries2 = useMemo(() => getLineChartSeries(), [getLineChartSeries]);
|
|
1658
|
+
const ref = useRef(null);
|
|
1659
|
+
return /*#__PURE__*/_jsxs(VStack, {
|
|
1660
|
+
gap: 2,
|
|
1661
|
+
children: [/*#__PURE__*/_jsx(DataCard, {
|
|
1662
|
+
layout: "vertical",
|
|
1663
|
+
subtitle: "Price trend",
|
|
1664
|
+
thumbnail: exampleThumbnail,
|
|
1665
|
+
title: "Line Chart Card",
|
|
1666
|
+
children: /*#__PURE__*/_jsx(LineChart, {
|
|
1667
|
+
showArea: true,
|
|
1668
|
+
accessibilityLabel: "Ethereum price chart",
|
|
1669
|
+
areaType: "dotted",
|
|
1670
|
+
height: 120,
|
|
1671
|
+
inset: 0,
|
|
1672
|
+
series: lineChartSeries
|
|
1673
|
+
})
|
|
1674
|
+
}), /*#__PURE__*/_jsx(DataCard, {
|
|
1675
|
+
layout: "vertical",
|
|
1676
|
+
subtitle: "Price trend",
|
|
1677
|
+
thumbnail: exampleThumbnail,
|
|
1678
|
+
title: "Line Chart with Tag",
|
|
1679
|
+
titleAccessory: /*#__PURE__*/_jsx(Text, {
|
|
1680
|
+
font: "label1",
|
|
1681
|
+
style: {
|
|
1682
|
+
color: "rgb(" + spectrum.green70 + ")"
|
|
1683
|
+
},
|
|
1684
|
+
children: "\u2197 25.25%"
|
|
1685
|
+
}),
|
|
1686
|
+
children: /*#__PURE__*/_jsx(LineChart, {
|
|
1687
|
+
showArea: true,
|
|
1688
|
+
accessibilityLabel: "Ethereum price chart",
|
|
1689
|
+
areaType: "dotted",
|
|
1690
|
+
height: 100,
|
|
1691
|
+
inset: 0,
|
|
1692
|
+
series: lineChartSeries
|
|
1693
|
+
})
|
|
1694
|
+
}), /*#__PURE__*/_jsx(DataCard, {
|
|
1695
|
+
ref: ref,
|
|
1696
|
+
renderAsPressable: true,
|
|
1697
|
+
layout: "vertical",
|
|
1698
|
+
onPress: NoopFn,
|
|
1699
|
+
subtitle: "Clickable line chart card",
|
|
1700
|
+
thumbnail: exampleThumbnail,
|
|
1701
|
+
title: "Actionable Line Chart",
|
|
1702
|
+
titleAccessory: /*#__PURE__*/_jsx(Text, {
|
|
1703
|
+
font: "label1",
|
|
1704
|
+
style: {
|
|
1705
|
+
color: "rgb(" + spectrum.green70 + ")"
|
|
1706
|
+
},
|
|
1707
|
+
children: "\u2197 8.5%"
|
|
1708
|
+
}),
|
|
1709
|
+
children: /*#__PURE__*/_jsx(LineChart, {
|
|
1710
|
+
showArea: true,
|
|
1711
|
+
accessibilityLabel: "Ethereum price chart",
|
|
1712
|
+
areaType: "dotted",
|
|
1713
|
+
height: 120,
|
|
1714
|
+
inset: 0,
|
|
1715
|
+
series: lineChartSeries,
|
|
1716
|
+
showXAxis: false,
|
|
1717
|
+
showYAxis: false
|
|
1718
|
+
})
|
|
1719
|
+
}), /*#__PURE__*/_jsx(DataCard, {
|
|
1720
|
+
layout: "vertical",
|
|
1721
|
+
subtitle: "Price trend",
|
|
1722
|
+
thumbnail: /*#__PURE__*/_jsx(RemoteImage, {
|
|
1723
|
+
accessibilityLabel: "Bitcoin",
|
|
1724
|
+
shape: "circle",
|
|
1725
|
+
size: "xl",
|
|
1726
|
+
source: assets.btc.imageUrl,
|
|
1727
|
+
testID: "thumbnail"
|
|
1728
|
+
}),
|
|
1729
|
+
title: "Card with Line Chart",
|
|
1730
|
+
titleAccessory: /*#__PURE__*/_jsx(Text, {
|
|
1731
|
+
font: "label1",
|
|
1732
|
+
style: {
|
|
1733
|
+
color: "rgb(" + spectrum.green70 + ")"
|
|
1734
|
+
},
|
|
1735
|
+
children: "\u2197 25.25%"
|
|
1736
|
+
}),
|
|
1737
|
+
children: /*#__PURE__*/_jsx(LineChart, {
|
|
1738
|
+
showArea: true,
|
|
1739
|
+
accessibilityLabel: "Price chart",
|
|
1740
|
+
areaType: "dotted",
|
|
1741
|
+
height: 100,
|
|
1742
|
+
inset: 0,
|
|
1743
|
+
series: lineChartSeries2,
|
|
1744
|
+
showXAxis: false,
|
|
1745
|
+
showYAxis: false
|
|
1746
|
+
})
|
|
1747
|
+
})]
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
function HorizontalLayoutLineChart() {
|
|
1751
|
+
const symbols = ['BTC', 'ETH', 'SOL', 'DOGE', 'ADA'];
|
|
1752
|
+
const allocations = [72, 46, 33, 21, 14];
|
|
1753
|
+
return /*#__PURE__*/_jsx(LineChart, {
|
|
1754
|
+
points: true,
|
|
1755
|
+
showArea: true,
|
|
1756
|
+
showXAxis: true,
|
|
1757
|
+
showYAxis: true,
|
|
1758
|
+
height: 240,
|
|
1759
|
+
layout: "horizontal",
|
|
1760
|
+
series: [{
|
|
1761
|
+
id: 'allocations',
|
|
1762
|
+
data: allocations,
|
|
1763
|
+
color: assets.btc.color
|
|
1764
|
+
}],
|
|
1765
|
+
xAxis: {
|
|
1766
|
+
domain: {
|
|
1767
|
+
min: 0,
|
|
1768
|
+
max: 80
|
|
1769
|
+
},
|
|
1770
|
+
tickLabelFormatter: value => value + "%"
|
|
1771
|
+
},
|
|
1772
|
+
yAxis: {
|
|
1773
|
+
data: symbols,
|
|
1774
|
+
scaleType: 'band'
|
|
1775
|
+
}
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
function ExampleNavigator() {
|
|
1779
|
+
const theme = useTheme();
|
|
1780
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
1781
|
+
const examples = useMemo(() => [{
|
|
1782
|
+
title: 'Basic',
|
|
1783
|
+
component: /*#__PURE__*/_jsx(LineChart, {
|
|
1784
|
+
showArea: true,
|
|
1785
|
+
height: 200,
|
|
1786
|
+
series: [{
|
|
1787
|
+
id: 'prices',
|
|
1788
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58]
|
|
1789
|
+
}]
|
|
1790
|
+
})
|
|
1791
|
+
}, {
|
|
1792
|
+
title: 'Horizontal Layout',
|
|
1793
|
+
component: /*#__PURE__*/_jsx(HorizontalLayoutLineChart, {})
|
|
1794
|
+
}, {
|
|
1795
|
+
title: 'Multiple Lines',
|
|
1796
|
+
component: /*#__PURE__*/_jsx(MultipleLine, {})
|
|
1797
|
+
}, {
|
|
1798
|
+
title: 'Multiple Lines No Animations',
|
|
1799
|
+
component: /*#__PURE__*/_jsx(MultipleLine, {
|
|
1800
|
+
animate: false
|
|
1801
|
+
})
|
|
1802
|
+
}, {
|
|
1803
|
+
title: 'Data Format',
|
|
1804
|
+
component: /*#__PURE__*/_jsx(DataFormat, {})
|
|
1805
|
+
}, {
|
|
1806
|
+
title: 'Live Updates',
|
|
1807
|
+
component: /*#__PURE__*/_jsx(LiveUpdates, {})
|
|
1808
|
+
}, {
|
|
1809
|
+
title: 'Missing Data',
|
|
1810
|
+
component: /*#__PURE__*/_jsx(MissingData, {})
|
|
1811
|
+
}, {
|
|
1812
|
+
title: 'Empty State',
|
|
1813
|
+
component: /*#__PURE__*/_jsx(LineChart, {
|
|
1814
|
+
height: 200,
|
|
1815
|
+
series: [{
|
|
1816
|
+
id: 'line',
|
|
1817
|
+
color: "rgb(" + theme.spectrum.gray50 + ")",
|
|
1818
|
+
data: [1, 1],
|
|
1819
|
+
showArea: true
|
|
1820
|
+
}],
|
|
1821
|
+
yAxis: {
|
|
1822
|
+
domain: {
|
|
1823
|
+
min: -1,
|
|
1824
|
+
max: 3
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
})
|
|
1828
|
+
}, {
|
|
1829
|
+
title: 'Scales',
|
|
1830
|
+
component: /*#__PURE__*/_jsx(LineChart, {
|
|
1831
|
+
showArea: true,
|
|
1832
|
+
showYAxis: true,
|
|
1833
|
+
height: 200,
|
|
1834
|
+
series: [{
|
|
1835
|
+
id: 'prices',
|
|
1836
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58]
|
|
1837
|
+
}],
|
|
1838
|
+
yAxis: {
|
|
1839
|
+
scaleType: 'log',
|
|
1840
|
+
showGrid: true,
|
|
1841
|
+
ticks: [1, 10, 100]
|
|
1842
|
+
}
|
|
1843
|
+
})
|
|
1844
|
+
}, {
|
|
1845
|
+
title: 'Interaction',
|
|
1846
|
+
component: /*#__PURE__*/_jsx(Interaction, {})
|
|
1847
|
+
}, {
|
|
1848
|
+
title: 'Points',
|
|
1849
|
+
component: /*#__PURE__*/_jsx(Points, {})
|
|
1850
|
+
}, {
|
|
1851
|
+
title: 'Transitions',
|
|
1852
|
+
component: /*#__PURE__*/_jsx(Transitions, {})
|
|
1853
|
+
}, {
|
|
1854
|
+
title: 'Basic Accessible',
|
|
1855
|
+
component: /*#__PURE__*/_jsx(BasicAccessible, {})
|
|
1856
|
+
}, {
|
|
1857
|
+
title: 'Styling Axes',
|
|
1858
|
+
component: /*#__PURE__*/_jsx(LineChart, {
|
|
1859
|
+
showArea: true,
|
|
1860
|
+
showXAxis: true,
|
|
1861
|
+
showYAxis: true,
|
|
1862
|
+
height: 200,
|
|
1863
|
+
series: [{
|
|
1864
|
+
id: 'prices',
|
|
1865
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58]
|
|
1866
|
+
}],
|
|
1867
|
+
xAxis: {
|
|
1868
|
+
showGrid: true,
|
|
1869
|
+
showLine: true,
|
|
1870
|
+
showTickMarks: true,
|
|
1871
|
+
tickLabelFormatter: dataX => "Day " + dataX
|
|
1872
|
+
},
|
|
1873
|
+
yAxis: {
|
|
1874
|
+
showGrid: true,
|
|
1875
|
+
showLine: true,
|
|
1876
|
+
showTickMarks: true
|
|
1877
|
+
}
|
|
1878
|
+
})
|
|
1879
|
+
}, {
|
|
1880
|
+
title: 'Gradients',
|
|
1881
|
+
component: /*#__PURE__*/_jsx(Gradients, {})
|
|
1882
|
+
}, {
|
|
1883
|
+
title: 'Gain/Loss',
|
|
1884
|
+
component: /*#__PURE__*/_jsx(GainLossChart, {})
|
|
1885
|
+
}, {
|
|
1886
|
+
title: 'Styling Lines',
|
|
1887
|
+
component: /*#__PURE__*/_jsx(LineChart, {
|
|
1888
|
+
height: 200,
|
|
1889
|
+
series: [{
|
|
1890
|
+
id: 'top',
|
|
1891
|
+
data: [15, 28, 32, 44, 46, 36, 40, 45, 48, 38]
|
|
1892
|
+
}, {
|
|
1893
|
+
id: 'upperMiddle',
|
|
1894
|
+
data: [12, 23, 21, 29, 34, 28, 31, 38, 42, 35],
|
|
1895
|
+
color: '#ef4444',
|
|
1896
|
+
type: 'dotted'
|
|
1897
|
+
}, {
|
|
1898
|
+
id: 'lowerMiddle',
|
|
1899
|
+
data: [8, 15, 14, 25, 20, 18, 22, 28, 24, 30],
|
|
1900
|
+
color: '#f59e0b',
|
|
1901
|
+
curve: 'natural',
|
|
1902
|
+
gradient: {
|
|
1903
|
+
axis: 'x',
|
|
1904
|
+
stops: [{
|
|
1905
|
+
offset: 0,
|
|
1906
|
+
color: '#E3D74D'
|
|
1907
|
+
}, {
|
|
1908
|
+
offset: 9,
|
|
1909
|
+
color: '#F7931A'
|
|
1910
|
+
}]
|
|
1911
|
+
},
|
|
1912
|
+
strokeWidth: 6
|
|
1913
|
+
}, {
|
|
1914
|
+
id: 'bottom',
|
|
1915
|
+
data: [4, 8, 11, 15, 16, 14, 16, 10, 12, 14],
|
|
1916
|
+
color: '#800080',
|
|
1917
|
+
curve: 'step',
|
|
1918
|
+
AreaComponent: DottedArea,
|
|
1919
|
+
showArea: true
|
|
1920
|
+
}]
|
|
1921
|
+
})
|
|
1922
|
+
}, {
|
|
1923
|
+
title: 'Styling Reference Lines',
|
|
1924
|
+
component: /*#__PURE__*/_jsxs(LineChart, {
|
|
1925
|
+
enableScrubbing: true,
|
|
1926
|
+
showArea: true,
|
|
1927
|
+
accessibilityLabel: "Price chart with reference line. 14 data points. Swipe to navigate.",
|
|
1928
|
+
getScrubberAccessibilityLabel: index => "Point " + (index + 1),
|
|
1929
|
+
height: 200,
|
|
1930
|
+
series: [{
|
|
1931
|
+
id: 'prices',
|
|
1932
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
1933
|
+
color: theme.color.fgPositive
|
|
1934
|
+
}],
|
|
1935
|
+
xAxis: {
|
|
1936
|
+
// Give space before the end of the chart for the scrubber
|
|
1937
|
+
range: _ref16 => {
|
|
1938
|
+
let {
|
|
1939
|
+
min,
|
|
1940
|
+
max
|
|
1941
|
+
} = _ref16;
|
|
1942
|
+
return {
|
|
1943
|
+
min,
|
|
1944
|
+
max: max - 24
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1947
|
+
},
|
|
1948
|
+
children: [/*#__PURE__*/_jsx(ReferenceLine, {
|
|
1949
|
+
LineComponent: props => /*#__PURE__*/_jsx(DottedLine, _extends({}, props, {
|
|
1950
|
+
dashIntervals: [0, 16],
|
|
1951
|
+
strokeWidth: 3
|
|
1952
|
+
})),
|
|
1953
|
+
dataY: 10,
|
|
1954
|
+
stroke: theme.color.fg
|
|
1955
|
+
}), /*#__PURE__*/_jsx(Scrubber, {})]
|
|
1956
|
+
})
|
|
1957
|
+
}, {
|
|
1958
|
+
title: 'High/Low Price',
|
|
1959
|
+
component: /*#__PURE__*/_jsx(HighLowPrice, {})
|
|
1960
|
+
}, {
|
|
1961
|
+
title: 'Styling Scrubber',
|
|
1962
|
+
component: /*#__PURE__*/_jsx(StylingScrubber, {})
|
|
1963
|
+
}, {
|
|
1964
|
+
title: 'Compact',
|
|
1965
|
+
component: /*#__PURE__*/_jsx(Compact, {})
|
|
1966
|
+
}, {
|
|
1967
|
+
title: 'Asset Price With Dotted Area',
|
|
1968
|
+
component: /*#__PURE__*/_jsx(AssetPriceWithDottedArea, {})
|
|
1969
|
+
}, {
|
|
1970
|
+
title: 'Performance',
|
|
1971
|
+
component: /*#__PURE__*/_jsx(Performance, {})
|
|
1972
|
+
}, {
|
|
1973
|
+
title: 'Monotone Asset Price',
|
|
1974
|
+
component: /*#__PURE__*/_jsx(MonotoneAssetPrice, {})
|
|
1975
|
+
}, {
|
|
1976
|
+
title: 'Service Availability',
|
|
1977
|
+
component: /*#__PURE__*/_jsx(ServiceAvailability, {})
|
|
1978
|
+
}, {
|
|
1979
|
+
title: 'Forecast Asset Price',
|
|
1980
|
+
component: /*#__PURE__*/_jsx(ForecastAssetPrice, {})
|
|
1981
|
+
}, {
|
|
1982
|
+
title: 'In DataCard',
|
|
1983
|
+
component: /*#__PURE__*/_jsx(DataCardWithLineChart, {})
|
|
1984
|
+
}], [theme.color.fg, theme.color.fgPositive, theme.spectrum.gray50]);
|
|
1985
|
+
const currentExample = examples[currentIndex];
|
|
1986
|
+
const handlePrevious = useCallback(() => {
|
|
1987
|
+
setCurrentIndex(prev => (prev - 1 + examples.length) % examples.length);
|
|
1988
|
+
}, [examples.length]);
|
|
1989
|
+
const handleNext = useCallback(() => {
|
|
1990
|
+
setCurrentIndex(prev => (prev + 1 + examples.length) % examples.length);
|
|
1991
|
+
}, [examples.length]);
|
|
1992
|
+
return /*#__PURE__*/_jsx(ExampleScreen, {
|
|
1993
|
+
paddingX: 0,
|
|
1994
|
+
children: /*#__PURE__*/_jsxs(VStack, {
|
|
1995
|
+
gap: 4,
|
|
1996
|
+
children: [/*#__PURE__*/_jsxs(HStack, {
|
|
1997
|
+
alignItems: "center",
|
|
1998
|
+
justifyContent: "space-between",
|
|
1999
|
+
padding: 2,
|
|
2000
|
+
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
2001
|
+
accessibilityHint: "Navigate to previous example",
|
|
2002
|
+
accessibilityLabel: "Previous",
|
|
2003
|
+
name: "arrowLeft",
|
|
2004
|
+
onPress: handlePrevious,
|
|
2005
|
+
variant: "secondary"
|
|
2006
|
+
}), /*#__PURE__*/_jsxs(VStack, {
|
|
2007
|
+
alignItems: "center",
|
|
2008
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
2009
|
+
font: "title3",
|
|
2010
|
+
children: currentExample.title
|
|
2011
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
2012
|
+
color: "fgMuted",
|
|
2013
|
+
font: "label1",
|
|
2014
|
+
children: [currentIndex + 1, " / ", examples.length]
|
|
2015
|
+
})]
|
|
2016
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
2017
|
+
accessibilityHint: "Navigate to next example",
|
|
2018
|
+
accessibilityLabel: "Next",
|
|
2019
|
+
name: "arrowRight",
|
|
2020
|
+
onPress: handleNext,
|
|
2021
|
+
variant: "secondary"
|
|
2022
|
+
})]
|
|
2023
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
2024
|
+
children: currentExample.component
|
|
2025
|
+
})]
|
|
2026
|
+
})
|
|
2027
|
+
});
|
|
2028
|
+
}
|
|
2029
|
+
export default ExampleNavigator;
|