@coinbase/cds-common 0.0.0 → 8.13.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/README.md +3 -0
- package/dts/accordion/AccordionProvider.d.ts +24 -0
- package/dts/accordion/AccordionProvider.d.ts.map +1 -0
- package/dts/accordion/__tests__/AccordionProvider.test.d.ts +2 -0
- package/dts/accordion/__tests__/AccordionProvider.test.d.ts.map +1 -0
- package/dts/animation/accordion.d.ts +4 -0
- package/dts/animation/accordion.d.ts.map +1 -0
- package/dts/animation/border.d.ts +4 -0
- package/dts/animation/border.d.ts.map +1 -0
- package/dts/animation/carousel.d.ts +8 -0
- package/dts/animation/carousel.d.ts.map +1 -0
- package/dts/animation/collapsible.d.ts +15 -0
- package/dts/animation/collapsible.d.ts.map +1 -0
- package/dts/animation/dot.d.ts +6 -0
- package/dts/animation/dot.d.ts.map +1 -0
- package/dts/animation/drawer.d.ts +20 -0
- package/dts/animation/drawer.d.ts.map +1 -0
- package/dts/animation/dropdown.d.ts +27 -0
- package/dts/animation/dropdown.d.ts.map +1 -0
- package/dts/animation/fullscreenModal.d.ts +12 -0
- package/dts/animation/fullscreenModal.d.ts.map +1 -0
- package/dts/animation/likeButton.d.ts +6 -0
- package/dts/animation/likeButton.d.ts.map +1 -0
- package/dts/animation/menu.d.ts +29 -0
- package/dts/animation/menu.d.ts.map +1 -0
- package/dts/animation/modal.d.ts +10 -0
- package/dts/animation/modal.d.ts.map +1 -0
- package/dts/animation/overlay.d.ts +6 -0
- package/dts/animation/overlay.d.ts.map +1 -0
- package/dts/animation/paddle.d.ts +7 -0
- package/dts/animation/paddle.d.ts.map +1 -0
- package/dts/animation/progress.d.ts +3 -0
- package/dts/animation/progress.d.ts.map +1 -0
- package/dts/animation/rotate.d.ts +3 -0
- package/dts/animation/rotate.d.ts.map +1 -0
- package/dts/animation/select.d.ts +4 -0
- package/dts/animation/select.d.ts.map +1 -0
- package/dts/animation/sparkline.d.ts +7 -0
- package/dts/animation/sparkline.d.ts.map +1 -0
- package/dts/animation/tabs.d.ts +5 -0
- package/dts/animation/tabs.d.ts.map +1 -0
- package/dts/animation/toast.d.ts +12 -0
- package/dts/animation/toast.d.ts.map +1 -0
- package/dts/animation/tooltip.d.ts +18 -0
- package/dts/animation/tooltip.d.ts.map +1 -0
- package/dts/cards/getCardBodySpacingProps.d.ts +5 -0
- package/dts/cards/getCardBodySpacingProps.d.ts.map +1 -0
- package/dts/color/__tests__/blendColors.test.d.ts +2 -0
- package/dts/color/__tests__/blendColors.test.d.ts.map +1 -0
- package/dts/color/__tests__/isLightOrDarkColor.test.d.ts +2 -0
- package/dts/color/__tests__/isLightOrDarkColor.test.d.ts.map +1 -0
- package/dts/color/__tests__/overrideAlpha.test.d.ts +2 -0
- package/dts/color/__tests__/overrideAlpha.test.d.ts.map +1 -0
- package/dts/color/blendColors.d.ts +21 -0
- package/dts/color/blendColors.d.ts.map +1 -0
- package/dts/color/colorToHex.d.ts +7 -0
- package/dts/color/colorToHex.d.ts.map +1 -0
- package/dts/color/darkenColor.d.ts +2 -0
- package/dts/color/darkenColor.d.ts.map +1 -0
- package/dts/color/getAccessibleForegroundGradient.d.ts +13 -0
- package/dts/color/getAccessibleForegroundGradient.d.ts.map +1 -0
- package/dts/color/getBlendedColor.d.ts +114 -0
- package/dts/color/getBlendedColor.d.ts.map +1 -0
- package/dts/color/getContrastRatio.d.ts +6 -0
- package/dts/color/getContrastRatio.d.ts.map +1 -0
- package/dts/color/getLuminance.d.ts +13 -0
- package/dts/color/getLuminance.d.ts.map +1 -0
- package/dts/color/isAccessibleColor.d.ts +18 -0
- package/dts/color/isAccessibleColor.d.ts.map +1 -0
- package/dts/color/isLightOrDarkColor.d.ts +2 -0
- package/dts/color/isLightOrDarkColor.d.ts.map +1 -0
- package/dts/color/overrideAlpha.d.ts +8 -0
- package/dts/color/overrideAlpha.d.ts.map +1 -0
- package/dts/core/theme.d.ts +286 -0
- package/dts/core/theme.d.ts.map +1 -0
- package/dts/dates/DateInputValidationError.d.ts +6 -0
- package/dts/dates/DateInputValidationError.d.ts.map +1 -0
- package/dts/dates/IntlDateFormat.d.ts +45 -0
- package/dts/dates/IntlDateFormat.d.ts.map +1 -0
- package/dts/dates/__tests__/IntlDateFormat.test.d.ts +2 -0
- package/dts/dates/__tests__/IntlDateFormat.test.d.ts.map +1 -0
- package/dts/dates/__tests__/useDateInput.test.d.ts +2 -0
- package/dts/dates/__tests__/useDateInput.test.d.ts.map +1 -0
- package/dts/dates/generateCalendarMonth.d.ts +5 -0
- package/dts/dates/generateCalendarMonth.d.ts.map +1 -0
- package/dts/dates/getISOStringLocal.d.ts +5 -0
- package/dts/dates/getISOStringLocal.d.ts.map +1 -0
- package/dts/dates/getMidnightDate.d.ts +5 -0
- package/dts/dates/getMidnightDate.d.ts.map +1 -0
- package/dts/dates/getTimesFromDatesAndRanges.d.ts +5 -0
- package/dts/dates/getTimesFromDatesAndRanges.d.ts.map +1 -0
- package/dts/dates/useDateInput.d.ts +23 -0
- package/dts/dates/useDateInput.d.ts.map +1 -0
- package/dts/dates/useDateInputValidation.d.ts +46 -0
- package/dts/dates/useDateInputValidation.d.ts.map +1 -0
- package/dts/hooks/__tests__/useFallbackShape.test.d.ts +2 -0
- package/dts/hooks/__tests__/useFallbackShape.test.d.ts.map +1 -0
- package/dts/hooks/__tests__/usePrefixedId.test.d.ts +2 -0
- package/dts/hooks/__tests__/usePrefixedId.test.d.ts.map +1 -0
- package/dts/hooks/__tests__/usePreviousValue.test.d.ts +2 -0
- package/dts/hooks/__tests__/usePreviousValue.test.d.ts.map +1 -0
- package/dts/hooks/__tests__/useRefMap.test.d.ts +2 -0
- package/dts/hooks/__tests__/useRefMap.test.d.ts.map +1 -0
- package/dts/hooks/__tests__/useSort.test.d.ts +2 -0
- package/dts/hooks/__tests__/useSort.test.d.ts.map +1 -0
- package/dts/hooks/__tests__/useTimer.test.d.ts +2 -0
- package/dts/hooks/__tests__/useTimer.test.d.ts.map +1 -0
- package/dts/hooks/useEventHandler.d.ts +3 -0
- package/dts/hooks/useEventHandler.d.ts.map +1 -0
- package/dts/hooks/useFallbackShape.d.ts +10 -0
- package/dts/hooks/useFallbackShape.d.ts.map +1 -0
- package/dts/hooks/useGroupToggler.d.ts +23 -0
- package/dts/hooks/useGroupToggler.d.ts.map +1 -0
- package/dts/hooks/useHasMounted.d.ts +2 -0
- package/dts/hooks/useHasMounted.d.ts.map +1 -0
- package/dts/hooks/useIndexCounter.d.ts +18 -0
- package/dts/hooks/useIndexCounter.d.ts.map +1 -0
- package/dts/hooks/useInputVariant.d.ts +3 -0
- package/dts/hooks/useInputVariant.d.ts.map +1 -0
- package/dts/hooks/useLogo.d.ts +26 -0
- package/dts/hooks/useLogo.d.ts.map +1 -0
- package/dts/hooks/useMergeRefs.d.ts +2 -0
- package/dts/hooks/useMergeRefs.d.ts.map +1 -0
- package/dts/hooks/usePrefixedId.d.ts +12 -0
- package/dts/hooks/usePrefixedId.d.ts.map +1 -0
- package/dts/hooks/usePreviousValue.d.ts +2 -0
- package/dts/hooks/usePreviousValue.d.ts.map +1 -0
- package/dts/hooks/usePreviousValues.d.ts +5 -0
- package/dts/hooks/usePreviousValues.d.ts.map +1 -0
- package/dts/hooks/useRefMap.d.ts +13 -0
- package/dts/hooks/useRefMap.d.ts.map +1 -0
- package/dts/hooks/useSort.d.ts +19 -0
- package/dts/hooks/useSort.d.ts.map +1 -0
- package/dts/hooks/useSubBrandLogo.d.ts +62 -0
- package/dts/hooks/useSubBrandLogo.d.ts.map +1 -0
- package/dts/hooks/useTimer.d.ts +7 -0
- package/dts/hooks/useTimer.d.ts.map +1 -0
- package/dts/hooks/useToggler.d.ts +10 -0
- package/dts/hooks/useToggler.d.ts.map +1 -0
- package/dts/hooks/useValueChanges.d.ts +8 -0
- package/dts/hooks/useValueChanges.d.ts.map +1 -0
- package/dts/index.d.ts +8 -0
- package/dts/index.d.ts.map +1 -0
- package/dts/internal/data/accounts.d.ts +359 -0
- package/dts/internal/data/accounts.d.ts.map +1 -0
- package/dts/internal/data/announcementCards.d.ts +10 -0
- package/dts/internal/data/announcementCards.d.ts.map +1 -0
- package/dts/internal/data/asset.d.ts +171 -0
- package/dts/internal/data/asset.d.ts.map +1 -0
- package/dts/internal/data/assets.d.ts +78 -0
- package/dts/internal/data/assets.d.ts.map +1 -0
- package/dts/internal/data/avatars.d.ts +3 -0
- package/dts/internal/data/avatars.d.ts.map +1 -0
- package/dts/internal/data/dataCards.d.ts +23 -0
- package/dts/internal/data/dataCards.d.ts.map +1 -0
- package/dts/internal/data/featureEntryCards.d.ts +17 -0
- package/dts/internal/data/featureEntryCards.d.ts.map +1 -0
- package/dts/internal/data/feedImages.d.ts +2 -0
- package/dts/internal/data/feedImages.d.ts.map +1 -0
- package/dts/internal/data/iconData.d.ts +2 -0
- package/dts/internal/data/iconData.d.ts.map +1 -0
- package/dts/internal/data/loremIpsum.d.ts +2 -0
- package/dts/internal/data/loremIpsum.d.ts.map +1 -0
- package/dts/internal/data/navigation.d.ts +7 -0
- package/dts/internal/data/navigation.d.ts.map +1 -0
- package/dts/internal/data/prices.d.ts +7 -0
- package/dts/internal/data/prices.d.ts.map +1 -0
- package/dts/internal/data/product.d.ts +25 -0
- package/dts/internal/data/product.d.ts.map +1 -0
- package/dts/internal/data/tabs.d.ts +15 -0
- package/dts/internal/data/tabs.d.ts.map +1 -0
- package/dts/internal/data/users.d.ts +10 -0
- package/dts/internal/data/users.d.ts.map +1 -0
- package/dts/internal/utils/storyBuilder.d.ts +113 -0
- package/dts/internal/utils/storyBuilder.d.ts.map +1 -0
- package/dts/internal/visualizations/SparklineInteractiveData.d.ts +13 -0
- package/dts/internal/visualizations/SparklineInteractiveData.d.ts.map +1 -0
- package/dts/jest/timeTravel.d.ts +15 -0
- package/dts/jest/timeTravel.d.ts.map +1 -0
- package/dts/lottie/lottieUtils.d.ts +11 -0
- package/dts/lottie/lottieUtils.d.ts.map +1 -0
- package/dts/lottie/lottieUtils.test.d.ts +2 -0
- package/dts/lottie/lottieUtils.test.d.ts.map +1 -0
- package/dts/lottie/useStatusAnimationPoller.d.ts +12 -0
- package/dts/lottie/useStatusAnimationPoller.d.ts.map +1 -0
- package/dts/media/getAvatarFallbackColor.d.ts +7 -0
- package/dts/media/getAvatarFallbackColor.d.ts.map +1 -0
- package/dts/media/remoteImageFallbackSrc.d.ts +6 -0
- package/dts/media/remoteImageFallbackSrc.d.ts.map +1 -0
- package/dts/motion/animatedCaret.d.ts +3 -0
- package/dts/motion/animatedCaret.d.ts.map +1 -0
- package/dts/motion/checkbox.d.ts +81 -0
- package/dts/motion/checkbox.d.ts.map +1 -0
- package/dts/motion/dot.d.ts +81 -0
- package/dts/motion/dot.d.ts.map +1 -0
- package/dts/motion/hint.d.ts +48 -0
- package/dts/motion/hint.d.ts.map +1 -0
- package/dts/motion/switch.d.ts +7 -0
- package/dts/motion/switch.d.ts.map +1 -0
- package/dts/motion/tokens.d.ts +422 -0
- package/dts/motion/tokens.d.ts.map +1 -0
- package/dts/motion/utils.d.ts +15 -0
- package/dts/motion/utils.d.ts.map +1 -0
- package/dts/numbers/IntlNumberFormat.d.ts +131 -0
- package/dts/numbers/IntlNumberFormat.d.ts.map +1 -0
- package/dts/numbers/__tests__/formatToParts.test.d.ts +2 -0
- package/dts/numbers/__tests__/formatToParts.test.d.ts.map +1 -0
- package/dts/numbers/__tests__/subscript.test.d.ts +2 -0
- package/dts/numbers/__tests__/subscript.test.d.ts.map +1 -0
- package/dts/numbers/subscript.d.ts +7 -0
- package/dts/numbers/subscript.d.ts.map +1 -0
- package/dts/overlays/ModalContext.d.ts +25 -0
- package/dts/overlays/ModalContext.d.ts.map +1 -0
- package/dts/overlays/OverlayContentContext.d.ts +13 -0
- package/dts/overlays/OverlayContentContext.d.ts.map +1 -0
- package/dts/overlays/PortalContext.d.ts +8 -0
- package/dts/overlays/PortalContext.d.ts.map +1 -0
- package/dts/overlays/ToastProvider.d.ts +73 -0
- package/dts/overlays/ToastProvider.d.ts.map +1 -0
- package/dts/overlays/__tests__/useOverlay.test.d.ts +2 -0
- package/dts/overlays/__tests__/useOverlay.test.d.ts.map +1 -0
- package/dts/overlays/__tests__/useToastQueue.test.d.ts +2 -0
- package/dts/overlays/__tests__/useToastQueue.test.d.ts.map +1 -0
- package/dts/overlays/useAlert.d.ts +8 -0
- package/dts/overlays/useAlert.d.ts.map +1 -0
- package/dts/overlays/useModal.d.ts +8 -0
- package/dts/overlays/useModal.d.ts.map +1 -0
- package/dts/overlays/useOverlay.d.ts +6 -0
- package/dts/overlays/useOverlay.d.ts.map +1 -0
- package/dts/overlays/usePortal.d.ts +2 -0
- package/dts/overlays/usePortal.d.ts.map +1 -0
- package/dts/overlays/usePortalState.d.ts +24 -0
- package/dts/overlays/usePortalState.d.ts.map +1 -0
- package/dts/overlays/useToastQueue.d.ts +11 -0
- package/dts/overlays/useToastQueue.d.ts.map +1 -0
- package/dts/stepper/__tests__/useStepper.test.d.ts +2 -0
- package/dts/stepper/__tests__/useStepper.test.d.ts.map +1 -0
- package/dts/stepper/__tests__/utils.test.d.ts +2 -0
- package/dts/stepper/__tests__/utils.test.d.ts.map +1 -0
- package/dts/stepper/useStepper.d.ts +41 -0
- package/dts/stepper/useStepper.d.ts.map +1 -0
- package/dts/stepper/utils.d.ts +22 -0
- package/dts/stepper/utils.d.ts.map +1 -0
- package/dts/system/EventHandlerProvider.d.ts +31 -0
- package/dts/system/EventHandlerProvider.d.ts.map +1 -0
- package/dts/system/LocaleProvider.d.ts +12 -0
- package/dts/system/LocaleProvider.d.ts.map +1 -0
- package/dts/system/RefMapContext.d.ts +10 -0
- package/dts/system/RefMapContext.d.ts.map +1 -0
- package/dts/system/__tests__/EventHandlerProvider.test.d.ts +2 -0
- package/dts/system/__tests__/EventHandlerProvider.test.d.ts.map +1 -0
- package/dts/tabs/TabsContext.d.ts +5 -0
- package/dts/tabs/TabsContext.d.ts.map +1 -0
- package/dts/tabs/__tests__/TabsContext.test.d.ts +2 -0
- package/dts/tabs/__tests__/TabsContext.test.d.ts.map +1 -0
- package/dts/tabs/__tests__/useTabs.test.d.ts +2 -0
- package/dts/tabs/__tests__/useTabs.test.d.ts.map +1 -0
- package/dts/tabs/useTabs.d.ts +29 -0
- package/dts/tabs/useTabs.d.ts.map +1 -0
- package/dts/tokens/accordion.d.ts +7 -0
- package/dts/tokens/accordion.d.ts.map +1 -0
- package/dts/tokens/appSwitcher.d.ts +4 -0
- package/dts/tokens/appSwitcher.d.ts.map +1 -0
- package/dts/tokens/avatar.d.ts +14 -0
- package/dts/tokens/avatar.d.ts.map +1 -0
- package/dts/tokens/banner.d.ts +15 -0
- package/dts/tokens/banner.d.ts.map +1 -0
- package/dts/tokens/borderRadius.d.ts +3 -0
- package/dts/tokens/borderRadius.d.ts.map +1 -0
- package/dts/tokens/button.d.ts +65 -0
- package/dts/tokens/button.d.ts.map +1 -0
- package/dts/tokens/card.d.ts +29 -0
- package/dts/tokens/card.d.ts.map +1 -0
- package/dts/tokens/cell.d.ts +27 -0
- package/dts/tokens/cell.d.ts.map +1 -0
- package/dts/tokens/chip.d.ts +2 -0
- package/dts/tokens/chip.d.ts.map +1 -0
- package/dts/tokens/dot.d.ts +12 -0
- package/dts/tokens/dot.d.ts.map +1 -0
- package/dts/tokens/drawer.d.ts +12 -0
- package/dts/tokens/drawer.d.ts.map +1 -0
- package/dts/tokens/illustrations.d.ts +28 -0
- package/dts/tokens/illustrations.d.ts.map +1 -0
- package/dts/tokens/input.d.ts +6 -0
- package/dts/tokens/input.d.ts.map +1 -0
- package/dts/tokens/interactable.d.ts +5 -0
- package/dts/tokens/interactable.d.ts.map +1 -0
- package/dts/tokens/interactableHeight.d.ts +5 -0
- package/dts/tokens/interactableHeight.d.ts.map +1 -0
- package/dts/tokens/menu.d.ts +3 -0
- package/dts/tokens/menu.d.ts.map +1 -0
- package/dts/tokens/multiContentModule.d.ts +2 -0
- package/dts/tokens/multiContentModule.d.ts.map +1 -0
- package/dts/tokens/navigation.d.ts +2 -0
- package/dts/tokens/navigation.d.ts.map +1 -0
- package/dts/tokens/overlays.d.ts +2 -0
- package/dts/tokens/overlays.d.ts.map +1 -0
- package/dts/tokens/page.d.ts +3 -0
- package/dts/tokens/page.d.ts.map +1 -0
- package/dts/tokens/select.d.ts +7 -0
- package/dts/tokens/select.d.ts.map +1 -0
- package/dts/tokens/sidebar.d.ts +3 -0
- package/dts/tokens/sidebar.d.ts.map +1 -0
- package/dts/tokens/sizing.d.ts +3 -0
- package/dts/tokens/sizing.d.ts.map +1 -0
- package/dts/tokens/sparkline.d.ts +11 -0
- package/dts/tokens/sparkline.d.ts.map +1 -0
- package/dts/tokens/tags.d.ts +12 -0
- package/dts/tokens/tags.d.ts.map +1 -0
- package/dts/tokens/tile.d.ts +4 -0
- package/dts/tokens/tile.d.ts.map +1 -0
- package/dts/tokens/toast.d.ts +5 -0
- package/dts/tokens/toast.d.ts.map +1 -0
- package/dts/tokens/tooltip.d.ts +4 -0
- package/dts/tokens/tooltip.d.ts.map +1 -0
- package/dts/tokens/zIndex.d.ts +14 -0
- package/dts/tokens/zIndex.d.ts.map +1 -0
- package/dts/tour/TourContext.d.ts +6 -0
- package/dts/tour/TourContext.d.ts.map +1 -0
- package/dts/tour/__tests__/TourContext.test.d.ts +2 -0
- package/dts/tour/__tests__/TourContext.test.d.ts.map +1 -0
- package/dts/tour/__tests__/useTour.test.d.ts +2 -0
- package/dts/tour/__tests__/useTour.test.d.ts.map +1 -0
- package/dts/tour/useTour.d.ts +98 -0
- package/dts/tour/useTour.d.ts.map +1 -0
- package/dts/types/AvatarBaseProps.d.ts +6 -0
- package/dts/types/AvatarBaseProps.d.ts.map +1 -0
- package/dts/types/AvatarSize.d.ts +2 -0
- package/dts/types/AvatarSize.d.ts.map +1 -0
- package/dts/types/BannerBaseProps.d.ts +3 -0
- package/dts/types/BannerBaseProps.d.ts.map +1 -0
- package/dts/types/BoxBaseProps.d.ts +62 -0
- package/dts/types/BoxBaseProps.d.ts.map +1 -0
- package/dts/types/ButtonBaseProps.d.ts +2 -0
- package/dts/types/ButtonBaseProps.d.ts.map +1 -0
- package/dts/types/CardHeaderProps.d.ts +12 -0
- package/dts/types/CardHeaderProps.d.ts.map +1 -0
- package/dts/types/CardMediaProps.d.ts +27 -0
- package/dts/types/CardMediaProps.d.ts.map +1 -0
- package/dts/types/CardRemoteImageProps.d.ts +18 -0
- package/dts/types/CardRemoteImageProps.d.ts.map +1 -0
- package/dts/types/CdsPlatform.d.ts +2 -0
- package/dts/types/CdsPlatform.d.ts.map +1 -0
- package/dts/types/CellBaseProps.d.ts +8 -0
- package/dts/types/CellBaseProps.d.ts.map +1 -0
- package/dts/types/Chart.d.ts +27 -0
- package/dts/types/Chart.d.ts.map +1 -0
- package/dts/types/CollapsibleBaseProps.d.ts +2 -0
- package/dts/types/CollapsibleBaseProps.d.ts.map +1 -0
- package/dts/types/Color.d.ts +6 -0
- package/dts/types/Color.d.ts.map +1 -0
- package/dts/types/ComponentEventHandlerProps.d.ts +6 -0
- package/dts/types/ComponentEventHandlerProps.d.ts.map +1 -0
- package/dts/types/DimensionStyles.d.ts +24 -0
- package/dts/types/DimensionStyles.d.ts.map +1 -0
- package/dts/types/Display.d.ts +2 -0
- package/dts/types/Display.d.ts.map +1 -0
- package/dts/types/DotBaseProps.d.ts +5 -0
- package/dts/types/DotBaseProps.d.ts.map +1 -0
- package/dts/types/DotCountBaseProps.d.ts +5 -0
- package/dts/types/DotCountBaseProps.d.ts.map +1 -0
- package/dts/types/ElevationLevels.d.ts +7 -0
- package/dts/types/ElevationLevels.d.ts.map +1 -0
- package/dts/types/FallbackBaseProps.d.ts +10 -0
- package/dts/types/FallbackBaseProps.d.ts.map +1 -0
- package/dts/types/Grid.d.ts +2 -0
- package/dts/types/Grid.d.ts.map +1 -0
- package/dts/types/Helpers.d.ts +4 -0
- package/dts/types/Helpers.d.ts.map +1 -0
- package/dts/types/IconButtonBaseProps.d.ts +3 -0
- package/dts/types/IconButtonBaseProps.d.ts.map +1 -0
- package/dts/types/IconName.d.ts +3 -0
- package/dts/types/IconName.d.ts.map +1 -0
- package/dts/types/IconSize.d.ts +3 -0
- package/dts/types/IconSize.d.ts.map +1 -0
- package/dts/types/IllustrationNames.d.ts +8 -0
- package/dts/types/IllustrationNames.d.ts.map +1 -0
- package/dts/types/IllustrationProps.d.ts +15 -0
- package/dts/types/IllustrationProps.d.ts.map +1 -0
- package/dts/types/InputBaseProps.d.ts +19 -0
- package/dts/types/InputBaseProps.d.ts.map +1 -0
- package/dts/types/LottiePlayer.d.ts +9 -0
- package/dts/types/LottiePlayer.d.ts.map +1 -0
- package/dts/types/LottieSource.d.ts +30 -0
- package/dts/types/LottieSource.d.ts.map +1 -0
- package/dts/types/LottieStatusAnimationProps.d.ts +24 -0
- package/dts/types/LottieStatusAnimationProps.d.ts.map +1 -0
- package/dts/types/Motion.d.ts +34 -0
- package/dts/types/Motion.d.ts.map +1 -0
- package/dts/types/OverlayLifecycleProps.d.ts +19 -0
- package/dts/types/OverlayLifecycleProps.d.ts.map +1 -0
- package/dts/types/Palette.d.ts +5 -0
- package/dts/types/Palette.d.ts.map +1 -0
- package/dts/types/Placement.d.ts +3 -0
- package/dts/types/Placement.d.ts.map +1 -0
- package/dts/types/Position.d.ts +2 -0
- package/dts/types/Position.d.ts.map +1 -0
- package/dts/types/ProgressContainerWithButtonsProps.d.ts +8 -0
- package/dts/types/ProgressContainerWithButtonsProps.d.ts.map +1 -0
- package/dts/types/PulseBaseProps.d.ts +2 -0
- package/dts/types/PulseBaseProps.d.ts.map +1 -0
- package/dts/types/React.d.ts +3 -0
- package/dts/types/React.d.ts.map +1 -0
- package/dts/types/Rect.d.ts +8 -0
- package/dts/types/Rect.d.ts.map +1 -0
- package/dts/types/Responsive.d.ts +3 -0
- package/dts/types/Responsive.d.ts.map +1 -0
- package/dts/types/ResponsiveProps.d.ts +24 -0
- package/dts/types/ResponsiveProps.d.ts.map +1 -0
- package/dts/types/SectionHeaderProps.d.ts +18 -0
- package/dts/types/SectionHeaderProps.d.ts.map +1 -0
- package/dts/types/Shape.d.ts +3 -0
- package/dts/types/Shape.d.ts.map +1 -0
- package/dts/types/SharedAccessibilityProps.d.ts +34 -0
- package/dts/types/SharedAccessibilityProps.d.ts.map +1 -0
- package/dts/types/SharedProps.d.ts +9 -0
- package/dts/types/SharedProps.d.ts.map +1 -0
- package/dts/types/SpacingProps.d.ts +46 -0
- package/dts/types/SpacingProps.d.ts.map +1 -0
- package/dts/types/SparklineInteractiveHeaderBaseProps.d.ts +3 -0
- package/dts/types/SparklineInteractiveHeaderBaseProps.d.ts.map +1 -0
- package/dts/types/SpreadPropsSafely.d.ts +28 -0
- package/dts/types/SpreadPropsSafely.d.ts.map +1 -0
- package/dts/types/StickyFooterProps.d.ts +22 -0
- package/dts/types/StickyFooterProps.d.ts.map +1 -0
- package/dts/types/TagBaseProps.d.ts +4 -0
- package/dts/types/TagBaseProps.d.ts.map +1 -0
- package/dts/types/TextBaseProps.d.ts +10 -0
- package/dts/types/TextBaseProps.d.ts.map +1 -0
- package/dts/types/TooltipBaseProps.d.ts +2 -0
- package/dts/types/TooltipBaseProps.d.ts.map +1 -0
- package/dts/types/TypeOrNumber.d.ts +3 -0
- package/dts/types/TypeOrNumber.d.ts.map +1 -0
- package/dts/types/Visibility.d.ts +5 -0
- package/dts/types/Visibility.d.ts.map +1 -0
- package/dts/types/Weight.d.ts +2 -0
- package/dts/types/Weight.d.ts.map +1 -0
- package/dts/types/index.d.ts +57 -0
- package/dts/types/index.d.ts.map +1 -0
- package/dts/utils/__tests__/cell.test.d.ts +2 -0
- package/dts/utils/__tests__/cell.test.d.ts.map +1 -0
- package/dts/utils/__tests__/chart.test.d.ts +2 -0
- package/dts/utils/__tests__/chart.test.d.ts.map +1 -0
- package/dts/utils/__tests__/flattenNodes.test.d.ts +2 -0
- package/dts/utils/__tests__/flattenNodes.test.d.ts.map +1 -0
- package/dts/utils/__tests__/formatCount.test.d.ts +2 -0
- package/dts/utils/__tests__/formatCount.test.d.ts.map +1 -0
- package/dts/utils/__tests__/getRectWidthVariant.test.d.ts +2 -0
- package/dts/utils/__tests__/getRectWidthVariant.test.d.ts.map +1 -0
- package/dts/utils/cell.d.ts +3 -0
- package/dts/utils/cell.d.ts.map +1 -0
- package/dts/utils/chart.d.ts +2 -0
- package/dts/utils/chart.d.ts.map +1 -0
- package/dts/utils/circle.d.ts +4 -0
- package/dts/utils/circle.d.ts.map +1 -0
- package/dts/utils/convertDimensionToAspectRatio.d.ts +4 -0
- package/dts/utils/convertDimensionToAspectRatio.d.ts.map +1 -0
- package/dts/utils/convertDimensionToSize.d.ts +8 -0
- package/dts/utils/convertDimensionToSize.d.ts.map +1 -0
- package/dts/utils/convertSizeWithMultiplier.d.ts +9 -0
- package/dts/utils/convertSizeWithMultiplier.d.ts.map +1 -0
- package/dts/utils/debounce.d.ts +2 -0
- package/dts/utils/debounce.d.ts.map +1 -0
- package/dts/utils/delay.d.ts +5 -0
- package/dts/utils/delay.d.ts.map +1 -0
- package/dts/utils/flattenNodes.d.ts +5 -0
- package/dts/utils/flattenNodes.d.ts.map +1 -0
- package/dts/utils/formatCount.d.ts +26 -0
- package/dts/utils/formatCount.d.ts.map +1 -0
- package/dts/utils/getAccessibleColor.d.ts +28 -0
- package/dts/utils/getAccessibleColor.d.ts.map +1 -0
- package/dts/utils/getButtonSpacingProps.d.ts +16 -0
- package/dts/utils/getButtonSpacingProps.d.ts.map +1 -0
- package/dts/utils/getDefaultAspectRatioForIllustration.d.ts +4 -0
- package/dts/utils/getDefaultAspectRatioForIllustration.d.ts.map +1 -0
- package/dts/utils/getDefaultSizeObjectForIllustration.d.ts +4 -0
- package/dts/utils/getDefaultSizeObjectForIllustration.d.ts.map +1 -0
- package/dts/utils/getRectWidthVariant.d.ts +2 -0
- package/dts/utils/getRectWidthVariant.d.ts.map +1 -0
- package/dts/utils/getWidthInEm.d.ts +6 -0
- package/dts/utils/getWidthInEm.d.ts.map +1 -0
- package/dts/utils/join.d.ts +6 -0
- package/dts/utils/join.d.ts.map +1 -0
- package/dts/utils/mergeProps.d.ts +3 -0
- package/dts/utils/mergeProps.d.ts.map +1 -0
- package/dts/utils/mockUtils.d.ts +2 -0
- package/dts/utils/mockUtils.d.ts.map +1 -0
- package/dts/utils/modulate.d.ts +9 -0
- package/dts/utils/modulate.d.ts.map +1 -0
- package/dts/utils/parseDotCountMaxOverflow.d.ts +3 -0
- package/dts/utils/parseDotCountMaxOverflow.d.ts.map +1 -0
- package/dts/visualizations/__tests__/getSparklineRange.test.d.ts +2 -0
- package/dts/visualizations/__tests__/getSparklineRange.test.d.ts.map +1 -0
- package/dts/visualizations/__tests__/largestTriangleThreeBucket.test.d.ts +2 -0
- package/dts/visualizations/__tests__/largestTriangleThreeBucket.test.d.ts.map +1 -0
- package/dts/visualizations/__tests__/useCounter.test.d.ts +2 -0
- package/dts/visualizations/__tests__/useCounter.test.d.ts.map +1 -0
- package/dts/visualizations/__tests__/useSparklineArea.test.d.ts +2 -0
- package/dts/visualizations/__tests__/useSparklineArea.test.d.ts.map +1 -0
- package/dts/visualizations/__tests__/useSparklineCoordinates.test.d.ts +2 -0
- package/dts/visualizations/__tests__/useSparklineCoordinates.test.d.ts.map +1 -0
- package/dts/visualizations/__tests__/useSparklinePath.test.d.ts +2 -0
- package/dts/visualizations/__tests__/useSparklinePath.test.d.ts.map +1 -0
- package/dts/visualizations/getProgressCircleParams.d.ts +15 -0
- package/dts/visualizations/getProgressCircleParams.d.ts.map +1 -0
- package/dts/visualizations/getSparklineRange.d.ts +9 -0
- package/dts/visualizations/getSparklineRange.d.ts.map +1 -0
- package/dts/visualizations/getSparklineTransform.d.ts +4 -0
- package/dts/visualizations/getSparklineTransform.d.ts.map +1 -0
- package/dts/visualizations/largestTriangleThreeBucket.d.ts +16 -0
- package/dts/visualizations/largestTriangleThreeBucket.d.ts.map +1 -0
- package/dts/visualizations/useCounter.d.ts +7 -0
- package/dts/visualizations/useCounter.d.ts.map +1 -0
- package/dts/visualizations/useDateLookup.d.ts +8 -0
- package/dts/visualizations/useDateLookup.d.ts.map +1 -0
- package/dts/visualizations/useProgressSize.d.ts +3 -0
- package/dts/visualizations/useProgressSize.d.ts.map +1 -0
- package/dts/visualizations/useSparklineArea.d.ts +3 -0
- package/dts/visualizations/useSparklineArea.d.ts.map +1 -0
- package/dts/visualizations/useSparklineAreaOpacity.d.ts +2 -0
- package/dts/visualizations/useSparklineAreaOpacity.d.ts.map +1 -0
- package/dts/visualizations/useSparklineCoordinates.d.ts +21 -0
- package/dts/visualizations/useSparklineCoordinates.d.ts.map +1 -0
- package/dts/visualizations/useSparklinePath.d.ts +3 -0
- package/dts/visualizations/useSparklinePath.d.ts.map +1 -0
- package/dts/visualizations/useSparklinePathGenerator.d.ts +18 -0
- package/dts/visualizations/useSparklinePathGenerator.d.ts.map +1 -0
- package/dts/visualizations/useTimeseriesPaths.d.ts +11 -0
- package/dts/visualizations/useTimeseriesPaths.d.ts.map +1 -0
- package/dts/visualizations/useVisualizationDimensions.d.ts +15 -0
- package/dts/visualizations/useVisualizationDimensions.d.ts.map +1 -0
- package/esm/accordion/AccordionProvider.js +38 -0
- package/esm/animation/accordion.js +3 -0
- package/esm/animation/border.js +10 -0
- package/esm/animation/carousel.js +21 -0
- package/esm/animation/collapsible.js +75 -0
- package/esm/animation/dot.js +15 -0
- package/esm/animation/drawer.js +19 -0
- package/esm/animation/dropdown.js +31 -0
- package/esm/animation/fullscreenModal.js +39 -0
- package/esm/animation/likeButton.js +18 -0
- package/esm/animation/menu.js +31 -0
- package/esm/animation/modal.js +32 -0
- package/esm/animation/overlay.js +16 -0
- package/esm/animation/paddle.js +17 -0
- package/esm/animation/progress.js +4 -0
- package/esm/animation/rotate.js +5 -0
- package/esm/animation/select.js +16 -0
- package/esm/animation/sparkline.js +8 -0
- package/esm/animation/tabs.js +5 -0
- package/esm/animation/toast.js +36 -0
- package/esm/animation/tooltip.js +87 -0
- package/esm/cards/getCardBodySpacingProps.js +25 -0
- package/esm/color/blendColors.js +44 -0
- package/esm/color/colorToHex.js +11 -0
- package/esm/color/darkenColor.js +5 -0
- package/esm/color/getAccessibleForegroundGradient.js +32 -0
- package/esm/color/getBlendedColor.js +202 -0
- package/esm/color/getContrastRatio.js +11 -0
- package/esm/color/getLuminance.js +28 -0
- package/esm/color/isAccessibleColor.js +31 -0
- package/esm/color/isLightOrDarkColor.js +21 -0
- package/esm/color/overrideAlpha.js +15 -0
- package/esm/core/theme.js +26 -0
- package/esm/dates/DateInputValidationError.js +7 -0
- package/esm/dates/IntlDateFormat.js +66 -0
- package/esm/dates/generateCalendarMonth.js +22 -0
- package/esm/dates/getISOStringLocal.js +8 -0
- package/esm/dates/getMidnightDate.js +4 -0
- package/esm/dates/getTimesFromDatesAndRanges.js +16 -0
- package/esm/dates/useDateInput.js +105 -0
- package/esm/dates/useDateInputValidation.js +50 -0
- package/esm/hooks/useEventHandler.js +54 -0
- package/esm/hooks/useFallbackShape.js +29 -0
- package/esm/hooks/useGroupToggler.js +105 -0
- package/esm/hooks/useHasMounted.js +6 -0
- package/esm/hooks/useIndexCounter.js +47 -0
- package/esm/hooks/useInputVariant.js +4 -0
- package/esm/hooks/useLogo.js +60 -0
- package/esm/hooks/useMergeRefs.js +14 -0
- package/esm/hooks/usePrefixedId.js +25 -0
- package/esm/hooks/usePreviousValue.js +16 -0
- package/esm/hooks/usePreviousValues.js +26 -0
- package/esm/hooks/useRefMap.js +17 -0
- package/esm/hooks/useSort.js +26 -0
- package/esm/hooks/useSubBrandLogo.js +244 -0
- package/esm/hooks/useTimer.js +51 -0
- package/esm/hooks/useToggler.js +24 -0
- package/esm/hooks/useValueChanges.js +15 -0
- package/esm/index.js +7 -0
- package/esm/internal/data/accounts.js +1838 -0
- package/esm/internal/data/announcementCards.js +23 -0
- package/esm/internal/data/asset.js +6345 -0
- package/esm/internal/data/assets.js +82 -0
- package/esm/internal/data/avatars.js +2 -0
- package/esm/internal/data/dataCards.js +22 -0
- package/esm/internal/data/featureEntryCards.js +28 -0
- package/esm/internal/data/feedImages.js +1 -0
- package/esm/internal/data/iconData.js +1 -0
- package/esm/internal/data/loremIpsum.js +1 -0
- package/esm/internal/data/navigation.js +11 -0
- package/esm/internal/data/prices.js +7 -0
- package/esm/internal/data/product.js +24 -0
- package/esm/internal/data/tabs.js +58 -0
- package/esm/internal/data/users.js +9 -0
- package/esm/internal/utils/storyBuilder.js +102 -0
- package/esm/internal/visualizations/SparklineInteractiveData.js +67 -0
- package/esm/jest/timeTravel.js +42 -0
- package/esm/lottie/lottieUtils.js +20 -0
- package/esm/lottie/lottieUtils.test.js +44 -0
- package/esm/lottie/useStatusAnimationPoller.js +67 -0
- package/esm/media/getAvatarFallbackColor.js +50 -0
- package/esm/media/remoteImageFallbackSrc.js +11 -0
- package/esm/motion/animatedCaret.js +6 -0
- package/esm/motion/checkbox.js +9 -0
- package/esm/motion/dot.js +9 -0
- package/esm/motion/hint.js +19 -0
- package/esm/motion/switch.js +8 -0
- package/esm/motion/tokens.js +71 -0
- package/esm/motion/utils.js +17 -0
- package/esm/numbers/IntlNumberFormat.js +204 -0
- package/esm/numbers/subscript.js +53 -0
- package/esm/overlays/ModalContext.js +8 -0
- package/esm/overlays/OverlayContentContext.js +24 -0
- package/esm/overlays/PortalContext.js +6 -0
- package/esm/overlays/ToastProvider.js +51 -0
- package/esm/overlays/useAlert.js +8 -0
- package/esm/overlays/useModal.js +16 -0
- package/esm/overlays/useOverlay.js +28 -0
- package/esm/overlays/usePortal.js +10 -0
- package/esm/overlays/usePortalState.js +55 -0
- package/esm/overlays/useToastQueue.js +67 -0
- package/esm/stepper/useStepper.js +124 -0
- package/esm/stepper/utils.js +45 -0
- package/esm/system/EventHandlerProvider.js +24 -0
- package/esm/system/LocaleProvider.js +19 -0
- package/esm/system/RefMapContext.js +7 -0
- package/esm/tabs/TabsContext.js +7 -0
- package/esm/tabs/useTabs.js +43 -0
- package/esm/tokens/accordion.js +6 -0
- package/esm/tokens/appSwitcher.js +3 -0
- package/esm/tokens/avatar.js +13 -0
- package/esm/tokens/banner.js +39 -0
- package/esm/tokens/borderRadius.js +7 -0
- package/esm/tokens/button.js +64 -0
- package/esm/tokens/card.js +29 -0
- package/esm/tokens/cell.js +40 -0
- package/esm/tokens/chip.js +1 -0
- package/esm/tokens/dot.js +31 -0
- package/esm/tokens/drawer.js +11 -0
- package/esm/tokens/illustrations.js +28 -0
- package/esm/tokens/input.js +5 -0
- package/esm/tokens/interactable.js +4 -0
- package/esm/tokens/interactableHeight.js +4 -0
- package/esm/tokens/menu.js +2 -0
- package/esm/tokens/multiContentModule.js +1 -0
- package/esm/tokens/navigation.js +1 -0
- package/esm/tokens/overlays.js +1 -0
- package/esm/tokens/page.js +2 -0
- package/esm/tokens/select.js +26 -0
- package/esm/tokens/sidebar.js +2 -0
- package/esm/tokens/sizing.js +2 -0
- package/esm/tokens/sparkline.js +24 -0
- package/esm/tokens/tags.js +66 -0
- package/esm/tokens/tile.js +9 -0
- package/esm/tokens/toast.js +4 -0
- package/esm/tokens/tooltip.js +5 -0
- package/esm/tokens/zIndex.js +15 -0
- package/esm/tour/TourContext.js +7 -0
- package/esm/tour/useTour.js +84 -0
- package/esm/types/AvatarBaseProps.js +1 -0
- package/esm/types/AvatarSize.js +1 -0
- package/esm/types/BannerBaseProps.js +1 -0
- package/esm/types/BoxBaseProps.js +1 -0
- package/esm/types/ButtonBaseProps.js +1 -0
- package/esm/types/CardHeaderProps.js +1 -0
- package/esm/types/CardMediaProps.js +1 -0
- package/esm/types/CardRemoteImageProps.js +1 -0
- package/esm/types/CdsPlatform.js +1 -0
- package/esm/types/CellBaseProps.js +1 -0
- package/esm/types/Chart.js +1 -0
- package/esm/types/CollapsibleBaseProps.js +1 -0
- package/esm/types/Color.js +1 -0
- package/esm/types/ComponentEventHandlerProps.js +1 -0
- package/esm/types/DimensionStyles.js +1 -0
- package/esm/types/Display.js +1 -0
- package/esm/types/DotBaseProps.js +1 -0
- package/esm/types/DotCountBaseProps.js +1 -0
- package/esm/types/ElevationLevels.js +1 -0
- package/esm/types/FallbackBaseProps.js +1 -0
- package/esm/types/Grid.js +1 -0
- package/esm/types/Helpers.js +1 -0
- package/esm/types/IconButtonBaseProps.js +1 -0
- package/esm/types/IconName.js +1 -0
- package/esm/types/IconSize.js +1 -0
- package/esm/types/IllustrationNames.js +1 -0
- package/esm/types/IllustrationProps.js +1 -0
- package/esm/types/InputBaseProps.js +1 -0
- package/esm/types/LottiePlayer.js +1 -0
- package/esm/types/LottieSource.js +1 -0
- package/esm/types/LottieStatusAnimationProps.js +1 -0
- package/esm/types/Motion.js +1 -0
- package/esm/types/OverlayLifecycleProps.js +1 -0
- package/esm/types/Palette.js +1 -0
- package/esm/types/Placement.js +1 -0
- package/esm/types/Position.js +1 -0
- package/esm/types/ProgressContainerWithButtonsProps.js +1 -0
- package/esm/types/PulseBaseProps.js +1 -0
- package/esm/types/React.js +1 -0
- package/esm/types/Rect.js +6 -0
- package/esm/types/Responsive.js +1 -0
- package/esm/types/ResponsiveProps.js +1 -0
- package/esm/types/SectionHeaderProps.js +1 -0
- package/esm/types/Shape.js +1 -0
- package/esm/types/SharedAccessibilityProps.js +1 -0
- package/esm/types/SharedProps.js +1 -0
- package/esm/types/SpacingProps.js +1 -0
- package/esm/types/SparklineInteractiveHeaderBaseProps.js +1 -0
- package/esm/types/SpreadPropsSafely.js +1 -0
- package/esm/types/StickyFooterProps.js +1 -0
- package/esm/types/TagBaseProps.js +1 -0
- package/esm/types/TextBaseProps.js +1 -0
- package/esm/types/TooltipBaseProps.js +1 -0
- package/esm/types/TypeOrNumber.js +1 -0
- package/esm/types/Visibility.js +1 -0
- package/esm/types/Weight.js +1 -0
- package/esm/types/index.js +58 -0
- package/esm/utils/cell.js +5 -0
- package/esm/utils/chart.js +14 -0
- package/esm/utils/circle.js +12 -0
- package/esm/utils/convertDimensionToAspectRatio.js +5 -0
- package/esm/utils/convertDimensionToSize.js +9 -0
- package/esm/utils/convertSizeWithMultiplier.js +7 -0
- package/esm/utils/debounce.js +16 -0
- package/esm/utils/delay.js +6 -0
- package/esm/utils/flattenNodes.js +33 -0
- package/esm/utils/formatCount.js +43 -0
- package/esm/utils/getAccessibleColor.js +50 -0
- package/esm/utils/getButtonSpacingProps.js +24 -0
- package/esm/utils/getDefaultAspectRatioForIllustration.js +6 -0
- package/esm/utils/getDefaultSizeObjectForIllustration.js +7 -0
- package/esm/utils/getRectWidthVariant.js +1 -0
- package/esm/utils/getWidthInEm.js +13 -0
- package/esm/utils/join.js +11 -0
- package/esm/utils/mergeProps.js +25 -0
- package/esm/utils/mockUtils.js +1 -0
- package/esm/utils/modulate.js +32 -0
- package/esm/utils/parseDotCountMaxOverflow.js +7 -0
- package/esm/visualizations/getProgressCircleParams.js +18 -0
- package/esm/visualizations/getSparklineRange.js +13 -0
- package/esm/visualizations/getSparklineTransform.js +19 -0
- package/esm/visualizations/largestTriangleThreeBucket.js +57 -0
- package/esm/visualizations/useCounter.js +52 -0
- package/esm/visualizations/useDateLookup.js +18 -0
- package/esm/visualizations/useProgressSize.js +15 -0
- package/esm/visualizations/useSparklineArea.js +30 -0
- package/esm/visualizations/useSparklineAreaOpacity.js +3 -0
- package/esm/visualizations/useSparklineCoordinates.js +73 -0
- package/esm/visualizations/useSparklinePath.js +22 -0
- package/esm/visualizations/useSparklinePathGenerator.js +38 -0
- package/esm/visualizations/useTimeseriesPaths.js +41 -0
- package/esm/visualizations/useVisualizationDimensions.js +27 -0
- package/package.json +61 -5
- package/index.js +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
export function mergeProps(prev, next) {
|
|
7
|
+
const result = _objectSpread({}, prev);
|
|
8
|
+
Object.entries(next).forEach(_ref => {
|
|
9
|
+
let [key, value] = _ref;
|
|
10
|
+
if (key === 'className' && typeof prev[key] === 'string' && typeof next[key] === 'string') {
|
|
11
|
+
result[key] += " ".concat(value);
|
|
12
|
+
} else if (/^on[A-Z]/.test(key) && typeof prev[key] === 'function' && typeof next[key] === 'function') {
|
|
13
|
+
result[key] = function () {
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
prev[key](...args);
|
|
18
|
+
next[key](...args);
|
|
19
|
+
};
|
|
20
|
+
} else if (value !== undefined) {
|
|
21
|
+
result[key] = value;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const NoopFn = () => {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// copied from https://medium.com/the-school-of-do/framer-cheat-sheets-utils-modulate-b88e359fdcc6
|
|
2
|
+
// typescriptified by @KatMartinez
|
|
3
|
+
|
|
4
|
+
/** create incremental transformations based on user interaction */
|
|
5
|
+
export const modulate = (value, _ref) => {
|
|
6
|
+
let {
|
|
7
|
+
inputRange,
|
|
8
|
+
outputRange,
|
|
9
|
+
clamp = false
|
|
10
|
+
} = _ref;
|
|
11
|
+
const [fromLow, fromHigh] = inputRange;
|
|
12
|
+
const [toLow, toHigh] = outputRange;
|
|
13
|
+
const result = toLow + (value - fromLow) / (fromHigh - fromLow) * (toHigh - toLow);
|
|
14
|
+
if (clamp) {
|
|
15
|
+
if (toLow < toHigh) {
|
|
16
|
+
if (result < toLow) {
|
|
17
|
+
return toLow;
|
|
18
|
+
}
|
|
19
|
+
if (result > toHigh) {
|
|
20
|
+
return toHigh;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
if (result > toLow) {
|
|
24
|
+
return toLow;
|
|
25
|
+
}
|
|
26
|
+
if (result < toHigh) {
|
|
27
|
+
return toHigh;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// If a badge count is greater than max (optional, defaults at 99), it should
|
|
2
|
+
// truncate the numbers so its x+.
|
|
3
|
+
export const MAX_OVERFLOW_COUNT = 99;
|
|
4
|
+
export const parseDotCountMaxOverflow = function (count) {
|
|
5
|
+
let max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MAX_OVERFLOW_COUNT;
|
|
6
|
+
return count <= max ? count : "".concat(max, "+");
|
|
7
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getCenter, getRadius } from '../utils/circle';
|
|
2
|
+
export const getProgressCircleParams = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
size,
|
|
5
|
+
strokeWidth,
|
|
6
|
+
stroke
|
|
7
|
+
} = _ref;
|
|
8
|
+
const radius = getRadius(size, strokeWidth);
|
|
9
|
+
const center = getCenter(size);
|
|
10
|
+
return {
|
|
11
|
+
stroke,
|
|
12
|
+
cx: center,
|
|
13
|
+
cy: center,
|
|
14
|
+
r: radius,
|
|
15
|
+
strokeWidth,
|
|
16
|
+
fill: 'none'
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const getSparklineRange = _ref => {
|
|
2
|
+
let {
|
|
3
|
+
height,
|
|
4
|
+
width,
|
|
5
|
+
yAxisScalingFactor = 1.0
|
|
6
|
+
} = _ref;
|
|
7
|
+
const xRange = [2, width - 2];
|
|
8
|
+
const yRange = [Math.max(2 + 1, (height - 2) * yAxisScalingFactor), 2];
|
|
9
|
+
return {
|
|
10
|
+
xRange,
|
|
11
|
+
yRange
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getSparklineRange } from './getSparklineRange';
|
|
2
|
+
|
|
3
|
+
// This transform vertically centers a scaled down path in the middle of the svg
|
|
4
|
+
export function getSparklineTransform(width, height, yAxisScalingFactor) {
|
|
5
|
+
const translateProps = {};
|
|
6
|
+
if (Number.isFinite(yAxisScalingFactor)) {
|
|
7
|
+
const {
|
|
8
|
+
yRange
|
|
9
|
+
} = getSparklineRange({
|
|
10
|
+
height,
|
|
11
|
+
width,
|
|
12
|
+
yAxisScalingFactor
|
|
13
|
+
});
|
|
14
|
+
const pathHeight = Math.abs(yRange[0] - yRange[1]);
|
|
15
|
+
const yTranslate = height / 2 - pathHeight / 2;
|
|
16
|
+
translateProps.transform = "translate(0, ".concat(yTranslate, ")");
|
|
17
|
+
}
|
|
18
|
+
return translateProps;
|
|
19
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Downsampling timeseries data using the "Largest-Triangle-Three-Buckets algorithm" (LTTB) as described in Sveinn Steinarsson's 2013 Master's thesis Downsampling Time Series for Visual Representation.
|
|
3
|
+
*
|
|
4
|
+
* The algorithm is based on the technique of forming triangles between adjacent data points and using the area of the triangles to determine the perceptual importance of the individual points.
|
|
5
|
+
* This helps to retain the visual characteristics of the original path whilst greatly reducing the number of points representing it.
|
|
6
|
+
*
|
|
7
|
+
* The threshold parameter for the algorithm is set at half the current width of the svg in pixels - so at most there is one point in the input domain represented for every two pixels in the output range.
|
|
8
|
+
*
|
|
9
|
+
* Using this method helps to avoid any alising issues that occur when a high number of points are drawn in a low number of pixels.
|
|
10
|
+
* @param data
|
|
11
|
+
* @param threshold
|
|
12
|
+
* @returns number[]
|
|
13
|
+
* @example https://bl.ocks.org/FraserChapman/649f1aba28f6bc941d5c
|
|
14
|
+
*/
|
|
15
|
+
export const largestTriangleThreeBucket = (data, threshold) => {
|
|
16
|
+
const m = Math.floor;
|
|
17
|
+
const y = Math.abs;
|
|
18
|
+
const f = data.length;
|
|
19
|
+
if (threshold >= f || threshold === 0) {
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
const n = [];
|
|
23
|
+
let t = 0;
|
|
24
|
+
const p = (f - 2) / (threshold - 2);
|
|
25
|
+
let c = 0;
|
|
26
|
+
let v = 0;
|
|
27
|
+
let u = 0;
|
|
28
|
+
let w = 0;
|
|
29
|
+
n[t++] = data[c];
|
|
30
|
+
for (let e = 0; e < threshold - 2; e++) {
|
|
31
|
+
let g = 0;
|
|
32
|
+
let h = 0;
|
|
33
|
+
let a = m((e + 1) * p) + 1;
|
|
34
|
+
let d = m((e + 2) * p) + 1;
|
|
35
|
+
d = d < f ? d : f;
|
|
36
|
+
let k = d - a;
|
|
37
|
+
for (; a < d; a++) {
|
|
38
|
+
g += +a;
|
|
39
|
+
h += +data[a];
|
|
40
|
+
}
|
|
41
|
+
g /= k;
|
|
42
|
+
h /= k;
|
|
43
|
+
a = m((e + 0) * p) + 1;
|
|
44
|
+
d = m((e + 1) * p) + 1;
|
|
45
|
+
k = +c;
|
|
46
|
+
const x = +data[c];
|
|
47
|
+
c = -1;
|
|
48
|
+
for (; a < d; a++) {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
50
|
+
typeof data[a] !== 'undefined' && (u = 0.5 * y((k - g) * (data[a] - x) - (k - a) * (h - x)), u > c && (c = u, v = data[a], w = a));
|
|
51
|
+
}
|
|
52
|
+
n[t++] = v;
|
|
53
|
+
c = w;
|
|
54
|
+
}
|
|
55
|
+
n[t++] = data[f - 1];
|
|
56
|
+
return n;
|
|
57
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { isStorybook } from '@coinbase/cds-utils';
|
|
3
|
+
export const useCounter = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
startNum,
|
|
6
|
+
endNum,
|
|
7
|
+
durationInMillis
|
|
8
|
+
} = _ref;
|
|
9
|
+
const skipAnimation = isStorybook();
|
|
10
|
+
const [count, setCount] = useState(skipAnimation ? endNum : startNum);
|
|
11
|
+
const timeoutRef = useRef();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const clearTimeoutRef = () => {
|
|
14
|
+
clearTimeout(timeoutRef.current);
|
|
15
|
+
};
|
|
16
|
+
if (skipAnimation) {
|
|
17
|
+
return clearTimeoutRef;
|
|
18
|
+
}
|
|
19
|
+
const startTime = Date.now();
|
|
20
|
+
const endTime = startTime + durationInMillis;
|
|
21
|
+
clearTimeoutRef();
|
|
22
|
+
let currCount = startNum;
|
|
23
|
+
function runUpdateAfterTimer() {
|
|
24
|
+
if (currCount === endNum) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const currTime = Date.now();
|
|
28
|
+
const timeLeft = endTime - currTime;
|
|
29
|
+
const incrementTime = timeLeft / Math.abs(endNum - currCount); // durationInMillis / Math.abs(endNum - startNum);
|
|
30
|
+
|
|
31
|
+
timeoutRef.current = setTimeout(() => {
|
|
32
|
+
if (currCount === endNum) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const percentDone = (currTime - startTime) / Math.abs(endTime - startTime);
|
|
36
|
+
const increment = Math.ceil(percentDone * Math.abs(endNum - startNum));
|
|
37
|
+
if (endNum > startNum) {
|
|
38
|
+
currCount = Math.min(startNum + increment, endNum);
|
|
39
|
+
} else {
|
|
40
|
+
currCount = Math.max(startNum - increment, endNum);
|
|
41
|
+
}
|
|
42
|
+
setCount(currCount);
|
|
43
|
+
runUpdateAfterTimer();
|
|
44
|
+
}, incrementTime);
|
|
45
|
+
}
|
|
46
|
+
if (currCount !== endNum) {
|
|
47
|
+
runUpdateAfterTimer();
|
|
48
|
+
}
|
|
49
|
+
return clearTimeoutRef;
|
|
50
|
+
}, [startNum, endNum, durationInMillis, skipAnimation]);
|
|
51
|
+
return count;
|
|
52
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
export function useDateLookup(_ref) {
|
|
3
|
+
let {
|
|
4
|
+
getMarker,
|
|
5
|
+
formatDate,
|
|
6
|
+
selectedPeriod
|
|
7
|
+
} = _ref;
|
|
8
|
+
return useCallback(xPos => {
|
|
9
|
+
var _getMarker;
|
|
10
|
+
const {
|
|
11
|
+
date
|
|
12
|
+
} = (_getMarker = getMarker(xPos)) !== null && _getMarker !== void 0 ? _getMarker : {};
|
|
13
|
+
if (!date) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
return formatDate(date, selectedPeriod);
|
|
17
|
+
}, [formatDate, getMarker, selectedPeriod]);
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
export const useProgressSize = weight => {
|
|
3
|
+
return useMemo(() => {
|
|
4
|
+
switch (weight) {
|
|
5
|
+
case 'semiheavy':
|
|
6
|
+
return 8;
|
|
7
|
+
case 'heavy':
|
|
8
|
+
return 12;
|
|
9
|
+
case 'thin':
|
|
10
|
+
return 2;
|
|
11
|
+
default:
|
|
12
|
+
return 4;
|
|
13
|
+
}
|
|
14
|
+
}, [weight]);
|
|
15
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const _excluded = ["height"];
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
|
+
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; }
|
|
9
|
+
import { useCallback } from 'react';
|
|
10
|
+
import { area, curveBasis } from 'd3-shape';
|
|
11
|
+
import { useSparklinePathGenerator } from './useSparklinePathGenerator';
|
|
12
|
+
export const useSparklineArea = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
height
|
|
15
|
+
} = _ref,
|
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
|
+
const generator = useCallback(_ref2 => {
|
|
18
|
+
var _area$curve$x$y0$y;
|
|
19
|
+
let {
|
|
20
|
+
xFunction,
|
|
21
|
+
yFunction,
|
|
22
|
+
data
|
|
23
|
+
} = _ref2;
|
|
24
|
+
return (_area$curve$x$y0$y = area().curve(curveBasis).x((_, i) => xFunction(i)).y0(height).y1(y => yFunction(y))(data)) !== null && _area$curve$x$y0$y !== void 0 ? _area$curve$x$y0$y : '';
|
|
25
|
+
}, [height]);
|
|
26
|
+
return useSparklinePathGenerator(_objectSpread({
|
|
27
|
+
generator,
|
|
28
|
+
height
|
|
29
|
+
}, props));
|
|
30
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { bisector, extent } from 'd3-array';
|
|
8
|
+
import * as d3Scale from 'd3-scale';
|
|
9
|
+
import { area, line } from 'd3-shape';
|
|
10
|
+
import { getSparklineRange } from './getSparklineRange';
|
|
11
|
+
const {
|
|
12
|
+
scaleLinear,
|
|
13
|
+
scaleTime
|
|
14
|
+
} = d3Scale;
|
|
15
|
+
export const useSparklineCoordinates = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
data,
|
|
18
|
+
width,
|
|
19
|
+
height,
|
|
20
|
+
yAxisScalingFactor
|
|
21
|
+
} = _ref;
|
|
22
|
+
return useMemo(() => {
|
|
23
|
+
var _createSparklineArea;
|
|
24
|
+
const {
|
|
25
|
+
xRange,
|
|
26
|
+
yRange
|
|
27
|
+
} = getSparklineRange({
|
|
28
|
+
height,
|
|
29
|
+
width,
|
|
30
|
+
yAxisScalingFactor
|
|
31
|
+
});
|
|
32
|
+
const xDomain = extent(data, item => item.date);
|
|
33
|
+
const xFunction = scaleTime() // the x-axis is date
|
|
34
|
+
.domain(xDomain).range(xRange);
|
|
35
|
+
const yDomain = extent(data, item => item.value);
|
|
36
|
+
const yFunction = scaleLinear() // the y-axis is value
|
|
37
|
+
.domain(yDomain).range(yRange);
|
|
38
|
+
const createSparklinePath = line().x(item => xFunction(item.date)).y(item => yFunction(item.value));
|
|
39
|
+
const createSparklineArea = area().x(item => xFunction(item.date)).y0(height).y1(item => yFunction(item.value));
|
|
40
|
+
|
|
41
|
+
// Bisector goes from x coordinate to index of data array
|
|
42
|
+
const bisect = bisector(item => item.date).left;
|
|
43
|
+
const getMarker = xPos => {
|
|
44
|
+
const date = xFunction.invert(xPos);
|
|
45
|
+
const idx = bisect(data, date);
|
|
46
|
+
const point = data[idx];
|
|
47
|
+
if (!point) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
return _objectSpread({
|
|
51
|
+
x: xFunction(point.date),
|
|
52
|
+
y: yFunction(point.value)
|
|
53
|
+
}, point);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
This is a hack that will only support straight lines when 2 data points are passed. When this is true, we append `M-10,10` to the path.
|
|
58
|
+
We do not do this for all lines because it warps the transition between time periods, which is visual jank. This provides a solution for straight lines, while minimizing impact for most charts.
|
|
59
|
+
We apply M-10,10 so that the browser recognizes data for straight, horizontal lines. This does not impact non-straight lines.
|
|
60
|
+
This is due to a browser bug which refuses to acknowledge a line if the height remains exactly the same, and therefore renders the "height" of the path as 0 (invisible).
|
|
61
|
+
"M", or move to, will simply move the cursor. Since we're appending two moves (the beginning of the path generate is always M), no line will be drawn but the browser will be activated.
|
|
62
|
+
Stack overflow: https://stackoverflow.com/questions/19708943/svg-straight-path-with-clip-path-not-visible-in-chrome/19709615#19709615
|
|
63
|
+
*/
|
|
64
|
+
const isAStraightLine = data.length < 5 && data.filter(dataPoint => dataPoint.value === data[0].value).length === data.length;
|
|
65
|
+
return {
|
|
66
|
+
xFunction,
|
|
67
|
+
yFunction,
|
|
68
|
+
path: "".concat(isAStraightLine ? 'M-10,10' : '').concat(createSparklinePath(data)),
|
|
69
|
+
area: (_createSparklineArea = createSparklineArea(data)) !== null && _createSparklineArea !== void 0 ? _createSparklineArea : '',
|
|
70
|
+
getMarker
|
|
71
|
+
};
|
|
72
|
+
}, [data, height, width, yAxisScalingFactor]);
|
|
73
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
import { curveBasis, line } from 'd3-shape';
|
|
8
|
+
import { useSparklinePathGenerator } from './useSparklinePathGenerator';
|
|
9
|
+
export const useSparklinePath = props => {
|
|
10
|
+
const generator = useCallback(_ref => {
|
|
11
|
+
var _line$curve$x$y;
|
|
12
|
+
let {
|
|
13
|
+
xFunction,
|
|
14
|
+
yFunction,
|
|
15
|
+
data
|
|
16
|
+
} = _ref;
|
|
17
|
+
return (_line$curve$x$y = line().curve(curveBasis).x((_, i) => xFunction(i)).y(y => yFunction(y))(data)) !== null && _line$curve$x$y !== void 0 ? _line$curve$x$y : '';
|
|
18
|
+
}, []);
|
|
19
|
+
return useSparklinePathGenerator(_objectSpread({
|
|
20
|
+
generator
|
|
21
|
+
}, props));
|
|
22
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { extent } from 'd3-array';
|
|
3
|
+
import * as d3Scale from 'd3-scale';
|
|
4
|
+
import { getSparklineRange } from './getSparklineRange';
|
|
5
|
+
import { largestTriangleThreeBucket } from './largestTriangleThreeBucket';
|
|
6
|
+
const {
|
|
7
|
+
scaleLinear
|
|
8
|
+
} = d3Scale;
|
|
9
|
+
export const useSparklinePathGenerator = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
data,
|
|
12
|
+
height,
|
|
13
|
+
width,
|
|
14
|
+
yAxisScalingFactor = 1.0,
|
|
15
|
+
generator
|
|
16
|
+
} = _ref;
|
|
17
|
+
const dataList = useMemo(() => data.map(Number), [data]);
|
|
18
|
+
return useMemo(() => {
|
|
19
|
+
const {
|
|
20
|
+
xRange,
|
|
21
|
+
yRange
|
|
22
|
+
} = getSparklineRange({
|
|
23
|
+
height,
|
|
24
|
+
width,
|
|
25
|
+
yAxisScalingFactor
|
|
26
|
+
});
|
|
27
|
+
const downsampledData = largestTriangleThreeBucket(dataList, width / 3);
|
|
28
|
+
const xDomain = [0, downsampledData.length];
|
|
29
|
+
const xFunction = scaleLinear().domain(xDomain).range(xRange);
|
|
30
|
+
const yDomain = extent(downsampledData);
|
|
31
|
+
const yFunction = scaleLinear().domain(yDomain).range(yRange);
|
|
32
|
+
return generator({
|
|
33
|
+
xFunction,
|
|
34
|
+
yFunction,
|
|
35
|
+
data: downsampledData
|
|
36
|
+
});
|
|
37
|
+
}, [height, width, yAxisScalingFactor, dataList, generator]);
|
|
38
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { extent } from 'd3-array';
|
|
3
|
+
import * as d3Scale from 'd3-scale';
|
|
4
|
+
import { area, line } from 'd3-shape';
|
|
5
|
+
import { getSparklineRange } from './getSparklineRange';
|
|
6
|
+
const {
|
|
7
|
+
scaleLinear,
|
|
8
|
+
scaleTime
|
|
9
|
+
} = d3Scale;
|
|
10
|
+
// returns a line and area generator that is compatible with a list of timeseries
|
|
11
|
+
export function useTimeseriesPaths(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
data,
|
|
14
|
+
width,
|
|
15
|
+
height
|
|
16
|
+
} = _ref;
|
|
17
|
+
return useMemo(() => {
|
|
18
|
+
const points = data.reduce((previousValue, currentValue) => {
|
|
19
|
+
return previousValue.concat(currentValue.points);
|
|
20
|
+
}, []);
|
|
21
|
+
const {
|
|
22
|
+
xRange,
|
|
23
|
+
yRange
|
|
24
|
+
} = getSparklineRange({
|
|
25
|
+
width,
|
|
26
|
+
height
|
|
27
|
+
});
|
|
28
|
+
const yDomain = extent(points, item => item.value);
|
|
29
|
+
const yFunction = scaleLinear() // the y-axis is value
|
|
30
|
+
.domain(yDomain).range(yRange);
|
|
31
|
+
const xDomain = extent(points, item => item.date);
|
|
32
|
+
const xFunction = scaleTime() // the x-axis is date
|
|
33
|
+
.domain(xDomain).range(xRange);
|
|
34
|
+
const lineFn = line().x(item => xFunction(item.date)).y(item => yFunction(item.value));
|
|
35
|
+
const areaFn = area().x(item => xFunction(item.date)).y0(height).y1(item => yFunction(item.value));
|
|
36
|
+
return {
|
|
37
|
+
lineFn,
|
|
38
|
+
areaFn
|
|
39
|
+
};
|
|
40
|
+
}, [data, width, height]);
|
|
41
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
export const useVisualizationDimensions = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
userDefinedWidth,
|
|
5
|
+
userDefinedHeight,
|
|
6
|
+
calculatedWidth,
|
|
7
|
+
calculatedHeight
|
|
8
|
+
} = _ref;
|
|
9
|
+
return useMemo(() => {
|
|
10
|
+
let width = calculatedWidth;
|
|
11
|
+
let height = calculatedHeight;
|
|
12
|
+
let shouldObserve = true;
|
|
13
|
+
// if the user has passed in a static width and height then we don't need to wait for the dimension calculation
|
|
14
|
+
if (Number.isFinite(userDefinedWidth) && Number.isFinite(userDefinedHeight)) {
|
|
15
|
+
// we know it is a number from the number check
|
|
16
|
+
width = userDefinedWidth;
|
|
17
|
+
height = userDefinedHeight;
|
|
18
|
+
shouldObserve = false;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
circleSize: Math.min(height, width),
|
|
24
|
+
shouldObserve
|
|
25
|
+
};
|
|
26
|
+
}, [calculatedHeight, calculatedWidth, userDefinedHeight, userDefinedWidth]);
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-common",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
"version": "8.13.1",
|
|
4
|
+
"description": "Coinbase Design System - Common",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git@github.com:coinbase/cds-staging.git",
|
|
8
|
+
"directory": "packages/common"
|
|
9
|
+
},
|
|
10
|
+
"react-native": "./src/index.ts",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./esm/index.js",
|
|
13
|
+
"types": "./dts/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": "./package.json",
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dts/index.d.ts",
|
|
18
|
+
"default": "./esm/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./types": {
|
|
21
|
+
"types": "./dts/types/index.d.ts",
|
|
22
|
+
"default": "./esm/types/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./*": {
|
|
25
|
+
"types": "./dts/*.d.ts",
|
|
26
|
+
"default": "./esm/*.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"files": [
|
|
31
|
+
"dts",
|
|
32
|
+
"esm",
|
|
33
|
+
"mcp-docs",
|
|
34
|
+
"CHANGELOG"
|
|
35
|
+
],
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": "^18.3.1",
|
|
38
|
+
"react-dom": "^18.3.1"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@coinbase/cds-icons": "workspace:^",
|
|
42
|
+
"@coinbase/cds-illustrations": "workspace:^",
|
|
43
|
+
"@coinbase/cds-mcp-server": "workspace:^",
|
|
44
|
+
"@coinbase/cds-utils": "workspace:^",
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.13.1",
|
|
46
|
+
"d3-array": "^3.2.4",
|
|
47
|
+
"d3-color": "^3.1.0",
|
|
48
|
+
"d3-interpolate": "^3.0.1",
|
|
49
|
+
"d3-scale": "^4.0.2",
|
|
50
|
+
"d3-shape": "^3.2.0",
|
|
51
|
+
"lodash": "^4.17.21",
|
|
52
|
+
"react-is": "^17.0.2",
|
|
53
|
+
"type-fest": "^2.19.0",
|
|
54
|
+
"zod": "^3.23.8"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@babel/core": "^7.28.0",
|
|
58
|
+
"@babel/preset-env": "^7.28.0",
|
|
59
|
+
"@babel/preset-react": "^7.27.1",
|
|
60
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
61
|
+
"@types/react": "^18.3.12",
|
|
62
|
+
"jest-date-mock": "^1.0.8"
|
|
63
|
+
}
|
|
8
64
|
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log("Temporary package");
|