@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,204 @@
|
|
|
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 { buildFractionPartsWithSubscript } from './subscript';
|
|
7
|
+
const splitDigitsIntoParts = (digitsStr, type) => {
|
|
8
|
+
return digitsStr.split('').map(d => ({
|
|
9
|
+
type,
|
|
10
|
+
value: parseInt(d)
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
const keyParts = (parts, generateKey, direction) => {
|
|
14
|
+
const seq = direction === 'rtl' ? [...parts].reverse() : parts;
|
|
15
|
+
const keyed = seq.map(p => _objectSpread(_objectSpread({}, p), {}, {
|
|
16
|
+
key: generateKey(p.type)
|
|
17
|
+
}));
|
|
18
|
+
return direction === 'rtl' ? keyed.reverse() : keyed;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Lightweight wrapper around the built-in Intl.NumberFormat that standardizes
|
|
23
|
+
* number formatting across CDS and provides a structure optimized for animated
|
|
24
|
+
* rendering in RollingNumber components.
|
|
25
|
+
*
|
|
26
|
+
* Responsibilities:
|
|
27
|
+
* - Create and cache an Intl.NumberFormat instance for given value, options, and locale
|
|
28
|
+
* - Expose a simple `format()` that returns the fully formatted string
|
|
29
|
+
* - Expose `formatToParts()` that returns logically grouped and keyed parts
|
|
30
|
+
* (pre/integer/fraction/post) so UI layers can animate digits and symbols
|
|
31
|
+
* - Optionally supports subscript notation for leading fractional zeros
|
|
32
|
+
*
|
|
33
|
+
* Notes:
|
|
34
|
+
* - Keys produced by `formatToParts()` are stable and direction-aware so that
|
|
35
|
+
* animations (e.g., per-digit transitions) can be deterministic
|
|
36
|
+
* - If the environment lacks `Intl.NumberFormat.prototype.formatToParts`, the
|
|
37
|
+
* method will throw and callers should polyfill it.
|
|
38
|
+
*/
|
|
39
|
+
export class IntlNumberFormat {
|
|
40
|
+
constructor(props) {
|
|
41
|
+
this.value = props.value;
|
|
42
|
+
this.formatOptions = props.format;
|
|
43
|
+
this.locale = props.locale;
|
|
44
|
+
this.formatter = new Intl.NumberFormat(this.locale, this.formatOptions);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns the formatted string.
|
|
49
|
+
*/
|
|
50
|
+
format() {
|
|
51
|
+
return this.formatter.format(this.value);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns the number parts for RollingNumber with groupings and keys for animations
|
|
56
|
+
* Examples
|
|
57
|
+
*
|
|
58
|
+
* Example 1 — basic currency
|
|
59
|
+
* Input:
|
|
60
|
+
* ```json
|
|
61
|
+
* {
|
|
62
|
+
* "value": 98345.67,
|
|
63
|
+
* "format": {
|
|
64
|
+
* "style": "currency",
|
|
65
|
+
* "currency": "USD",
|
|
66
|
+
* "minimumFractionDigits": 2,
|
|
67
|
+
* "maximumFractionDigits": 5
|
|
68
|
+
* },
|
|
69
|
+
* "locale": "en-US",
|
|
70
|
+
* "prefix": "+",
|
|
71
|
+
* "suffix": " BTC"
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* Output:
|
|
76
|
+
* ```json
|
|
77
|
+
* {
|
|
78
|
+
* "pre": [
|
|
79
|
+
* { "type": "currency", "value": "$", "key": "currency:0" }
|
|
80
|
+
* ],
|
|
81
|
+
* "integer": [
|
|
82
|
+
* { "type": "integer", "value": 9, "key": "integer:4" },
|
|
83
|
+
* { "type": "integer", "value": 8, "key": "integer:3" },
|
|
84
|
+
* { "type": "group", "value": ",", "key": "group:0" },
|
|
85
|
+
* { "type": "integer", "value": 3, "key": "integer:2" },
|
|
86
|
+
* { "type": "integer", "value": 4, "key": "integer:1" },
|
|
87
|
+
* { "type": "integer", "value": 5, "key": "integer:0" }
|
|
88
|
+
* ],
|
|
89
|
+
* "fraction": [
|
|
90
|
+
* { "type": "decimal", "value": ".", "key": "decimal:0" },
|
|
91
|
+
* { "type": "fraction", "value": 6, "key": "fraction:0" },
|
|
92
|
+
* { "type": "fraction", "value": 7, "key": "fraction:1" }
|
|
93
|
+
* ],
|
|
94
|
+
* "post": [],
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* Example 2 — subscript notation enabled
|
|
99
|
+
* Input:
|
|
100
|
+
* ```json
|
|
101
|
+
* {
|
|
102
|
+
* "value": 1e-10,
|
|
103
|
+
* "format": {
|
|
104
|
+
* "minimumFractionDigits": 2,
|
|
105
|
+
* "maximumFractionDigits": 25
|
|
106
|
+
* },
|
|
107
|
+
* "locale": "en-US",
|
|
108
|
+
* "enableSubscriptNotation": true
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* Output:
|
|
113
|
+
* ```json
|
|
114
|
+
* {
|
|
115
|
+
* "pre": [],
|
|
116
|
+
* "integer": [
|
|
117
|
+
* { "type": "integer", "value": 0, "key": "integer:0" }
|
|
118
|
+
* ],
|
|
119
|
+
* "fraction": [
|
|
120
|
+
* { "type": "decimal", "value": ".", "key": "decimal:0" },
|
|
121
|
+
* { "type": "fraction", "value": 0, "key": "fraction:0" },
|
|
122
|
+
* { "type": "subscript", "value": "₉", "key": "subscript:0" },
|
|
123
|
+
* { "type": "fraction", "value": 1, "key": "fraction:1" }
|
|
124
|
+
* ],
|
|
125
|
+
* "post": [],
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
formatToParts() {
|
|
130
|
+
let {
|
|
131
|
+
enableSubscriptNotation
|
|
132
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
133
|
+
if (!Intl.NumberFormat.prototype.formatToParts) {
|
|
134
|
+
throw new Error('Intl.NumberFormat.prototype.formatToParts is undefined, please ensure Intl.NumberFormat is polyfilled.');
|
|
135
|
+
}
|
|
136
|
+
const parts = this.formatter.formatToParts(this.value);
|
|
137
|
+
const pre = [];
|
|
138
|
+
const integerUnkeyed = [];
|
|
139
|
+
const fractionUnkeyed = [];
|
|
140
|
+
const post = [];
|
|
141
|
+
const counts = {};
|
|
142
|
+
const generateKey = type => {
|
|
143
|
+
var _counts$type;
|
|
144
|
+
return "".concat(type, ":").concat(counts[type] = ((_counts$type = counts[type]) !== null && _counts$type !== void 0 ? _counts$type : -1) + 1);
|
|
145
|
+
};
|
|
146
|
+
let didParseNumberPart = false;
|
|
147
|
+
for (const part of parts) {
|
|
148
|
+
const {
|
|
149
|
+
type,
|
|
150
|
+
value
|
|
151
|
+
} = part;
|
|
152
|
+
switch (type) {
|
|
153
|
+
case 'integer':
|
|
154
|
+
{
|
|
155
|
+
didParseNumberPart = true;
|
|
156
|
+
integerUnkeyed.push(...splitDigitsIntoParts(value, type));
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
case 'fraction':
|
|
160
|
+
{
|
|
161
|
+
didParseNumberPart = true;
|
|
162
|
+
const fractionParts = enableSubscriptNotation ? buildFractionPartsWithSubscript(value) : splitDigitsIntoParts(value, type);
|
|
163
|
+
fractionUnkeyed.push(...fractionParts);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case 'group':
|
|
167
|
+
{
|
|
168
|
+
didParseNumberPart = true;
|
|
169
|
+
integerUnkeyed.push({
|
|
170
|
+
type,
|
|
171
|
+
value
|
|
172
|
+
});
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
case 'decimal':
|
|
176
|
+
{
|
|
177
|
+
didParseNumberPart = true;
|
|
178
|
+
fractionUnkeyed.push({
|
|
179
|
+
type,
|
|
180
|
+
value
|
|
181
|
+
});
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
default:
|
|
185
|
+
{
|
|
186
|
+
(didParseNumberPart ? post : pre).push({
|
|
187
|
+
type,
|
|
188
|
+
value,
|
|
189
|
+
key: generateKey(type)
|
|
190
|
+
});
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const integer = keyParts(integerUnkeyed, generateKey, 'rtl');
|
|
196
|
+
const fraction = keyParts(fractionUnkeyed, generateKey, 'ltr');
|
|
197
|
+
return {
|
|
198
|
+
pre,
|
|
199
|
+
integer,
|
|
200
|
+
fraction,
|
|
201
|
+
post
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const numberSubscriptMap = {
|
|
2
|
+
'0': '₀',
|
|
3
|
+
'1': '₁',
|
|
4
|
+
'2': '₂',
|
|
5
|
+
'3': '₃',
|
|
6
|
+
'4': '₄',
|
|
7
|
+
'5': '₅',
|
|
8
|
+
'6': '₆',
|
|
9
|
+
'7': '₇',
|
|
10
|
+
'8': '₈',
|
|
11
|
+
'9': '₉'
|
|
12
|
+
};
|
|
13
|
+
export const toSubscriptNumber = n => String(n).split('').map(d => {
|
|
14
|
+
var _numberSubscriptMap$d;
|
|
15
|
+
return (_numberSubscriptMap$d = numberSubscriptMap[d]) !== null && _numberSubscriptMap$d !== void 0 ? _numberSubscriptMap$d : d;
|
|
16
|
+
}).join('');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Builds parts for the fractional digits with subscript applied to leading zeros.
|
|
20
|
+
*/
|
|
21
|
+
export function buildFractionPartsWithSubscript(fractionDigits) {
|
|
22
|
+
const match = /^(0+)(.*)$/.exec(fractionDigits);
|
|
23
|
+
if (!match) {
|
|
24
|
+
return fractionDigits.split('').map(d => ({
|
|
25
|
+
type: 'fraction',
|
|
26
|
+
value: parseInt(d, 10)
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
const [, matchedZeros, restOfDigits] = match;
|
|
30
|
+
// no need to add subscript for single zero or no zeros, 0.0 -> 0.0, 0.912 -> 0.912
|
|
31
|
+
if (matchedZeros.length <= 1) {
|
|
32
|
+
return fractionDigits.split('').map(d => ({
|
|
33
|
+
type: 'fraction',
|
|
34
|
+
value: parseInt(d, 10)
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
const parts = [];
|
|
38
|
+
parts.push({
|
|
39
|
+
type: 'fraction',
|
|
40
|
+
value: 0
|
|
41
|
+
});
|
|
42
|
+
parts.push({
|
|
43
|
+
type: 'subscript',
|
|
44
|
+
value: toSubscriptNumber(matchedZeros.length)
|
|
45
|
+
});
|
|
46
|
+
for (let i = 0; i < restOfDigits.length; i++) {
|
|
47
|
+
parts.push({
|
|
48
|
+
type: 'fraction',
|
|
49
|
+
value: parseInt(restOfDigits[i], 10)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return parts;
|
|
53
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const ModalContext = /*#__PURE__*/createContext({
|
|
3
|
+
visible: false,
|
|
4
|
+
onRequestClose: () => {},
|
|
5
|
+
hideDividers: false,
|
|
6
|
+
hideCloseButton: false
|
|
7
|
+
});
|
|
8
|
+
export const useModalContext = () => useContext(ModalContext);
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { createContext, useContext, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
// WARNING: If you add a new key to this type, you should also update the
|
|
9
|
+
// useOverlayContentContext hook's `derivedContext.isOverlay` expression!
|
|
10
|
+
|
|
11
|
+
export const OverlayContentContext = /*#__PURE__*/createContext({});
|
|
12
|
+
export const useOverlayContentContext = () => {
|
|
13
|
+
const context = useContext(OverlayContentContext);
|
|
14
|
+
// userOverlayContentContext does not throw an error when used outside a provider
|
|
15
|
+
// so that any component may check if it's being rendered as overlay content, even
|
|
16
|
+
// if it's not wrapped in an OverlayContentContext.Provider.
|
|
17
|
+
|
|
18
|
+
// If context.isOverlay was not explicitly defined then we derive it from the other values.
|
|
19
|
+
const derivedContext = useMemo(() => _objectSpread(_objectSpread({}, context), {}, {
|
|
20
|
+
isOverlay: context.isModal || context.isDrawer || context.isTour
|
|
21
|
+
}), [context]);
|
|
22
|
+
if ((context === null || context === void 0 ? void 0 : context.isOverlay) === undefined) return derivedContext;
|
|
23
|
+
return context;
|
|
24
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { cloneElement, createContext, isValidElement, useMemo } from 'react';
|
|
2
|
+
import { useToastQueue } from './useToastQueue';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The data structure managed by the ToastProvider.
|
|
6
|
+
* It composes together the Toast element requested to be rendered and the duration for which it should be displayed.
|
|
7
|
+
*/
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export const ToastContext = /*#__PURE__*/createContext({
|
|
10
|
+
activeToast: undefined,
|
|
11
|
+
addToast: () => {},
|
|
12
|
+
removeToast: () => {},
|
|
13
|
+
hideToast: () => {},
|
|
14
|
+
clearToastQueue: () => {},
|
|
15
|
+
pauseTimer: () => {},
|
|
16
|
+
resumeTimer: () => {}
|
|
17
|
+
});
|
|
18
|
+
export const ToastProvider = _ref => {
|
|
19
|
+
var _element$props$bottom;
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
toastBottomOffset
|
|
23
|
+
} = _ref;
|
|
24
|
+
const {
|
|
25
|
+
activeToast,
|
|
26
|
+
addToast,
|
|
27
|
+
removeToast,
|
|
28
|
+
hideToast,
|
|
29
|
+
clearToastQueue,
|
|
30
|
+
pauseTimer,
|
|
31
|
+
resumeTimer
|
|
32
|
+
} = useToastQueue();
|
|
33
|
+
const element = activeToast === null || activeToast === void 0 ? void 0 : activeToast.element;
|
|
34
|
+
const memoizedContextValue = useMemo(() => ({
|
|
35
|
+
addToast,
|
|
36
|
+
removeToast,
|
|
37
|
+
hideToast,
|
|
38
|
+
clearToastQueue,
|
|
39
|
+
pauseTimer,
|
|
40
|
+
resumeTimer
|
|
41
|
+
}), [addToast, removeToast, hideToast, clearToastQueue, pauseTimer, resumeTimer]);
|
|
42
|
+
return /*#__PURE__*/_jsxs(ToastContext.Provider, {
|
|
43
|
+
value: memoizedContextValue,
|
|
44
|
+
children: [children, /*#__PURE__*/isValidElement(element) && toastBottomOffset ?
|
|
45
|
+
/*#__PURE__*/
|
|
46
|
+
// props level offset should have higher specificity
|
|
47
|
+
cloneElement(element, {
|
|
48
|
+
bottomOffset: (_element$props$bottom = element.props.bottomOffset) !== null && _element$props$bottom !== void 0 ? _element$props$bottom : toastBottomOffset
|
|
49
|
+
}) : element]
|
|
50
|
+
});
|
|
51
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useOverlay } from './useOverlay';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use the visible and onRequestClose props as outlined in the docs here https://cds.coinbase.com/components/modal#get-started
|
|
6
|
+
*/
|
|
7
|
+
export const useModal = () => {
|
|
8
|
+
const {
|
|
9
|
+
open,
|
|
10
|
+
close
|
|
11
|
+
} = useOverlay('modal_');
|
|
12
|
+
return useMemo(() => ({
|
|
13
|
+
openModal: open,
|
|
14
|
+
closeModal: close
|
|
15
|
+
}), [open, close]);
|
|
16
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cloneElement, useCallback, useId, useMemo } from 'react';
|
|
2
|
+
import { usePortal } from './usePortal';
|
|
3
|
+
export const useOverlay = idPrefix => {
|
|
4
|
+
const {
|
|
5
|
+
addNode,
|
|
6
|
+
removeNode
|
|
7
|
+
} = usePortal();
|
|
8
|
+
const randomId = useId();
|
|
9
|
+
const id = useMemo(() => "".concat(idPrefix, "-").concat(randomId), [idPrefix, randomId]);
|
|
10
|
+
const open = useCallback(content => {
|
|
11
|
+
const element = /*#__PURE__*/cloneElement(content, {
|
|
12
|
+
// TODO react docs recommend _not_ using useId for keys
|
|
13
|
+
// follow up with a solution that doesn't use useId
|
|
14
|
+
// @link https://react.dev/reference/react/useId#usage
|
|
15
|
+
key: id,
|
|
16
|
+
visible: true
|
|
17
|
+
});
|
|
18
|
+
addNode(id, element);
|
|
19
|
+
return id;
|
|
20
|
+
}, [addNode, id]);
|
|
21
|
+
const close = useCallback(() => {
|
|
22
|
+
removeNode(id);
|
|
23
|
+
}, [removeNode, id]);
|
|
24
|
+
return useMemo(() => ({
|
|
25
|
+
open,
|
|
26
|
+
close
|
|
27
|
+
}), [open, close]);
|
|
28
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { isProduction } from '@coinbase/cds-utils';
|
|
3
|
+
import { PortalContext } from './PortalContext';
|
|
4
|
+
export const usePortal = () => {
|
|
5
|
+
const context = useContext(PortalContext);
|
|
6
|
+
if (!isProduction() && !context) {
|
|
7
|
+
console.error('Cannot use `usePortal` outside of PortalProvider');
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cloneElement, useCallback, useMemo, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This type defines the basic interface of a Component rendered through the PortalProvider.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This hook is used to manage the state of a set of nodes rendered through the PortalProvider.
|
|
9
|
+
*/
|
|
10
|
+
export const usePortalState = () => {
|
|
11
|
+
const [nodes, setNodes] = useState([]);
|
|
12
|
+
const addNode = useCallback((id, element) => {
|
|
13
|
+
setNodes(prevNodes => {
|
|
14
|
+
const index = prevNodes.findIndex(item => item.id === id);
|
|
15
|
+
// if the id already exists, replace the element
|
|
16
|
+
if (index !== -1) {
|
|
17
|
+
const copy = [...prevNodes];
|
|
18
|
+
copy[index].element = element;
|
|
19
|
+
return copy;
|
|
20
|
+
}
|
|
21
|
+
return [...prevNodes, {
|
|
22
|
+
id,
|
|
23
|
+
element
|
|
24
|
+
}];
|
|
25
|
+
});
|
|
26
|
+
}, []);
|
|
27
|
+
const filterInvisibleNodes = useCallback(() => {
|
|
28
|
+
setNodes(prevNodes => prevNodes.filter(node => node.element.props.visible));
|
|
29
|
+
}, []);
|
|
30
|
+
const removeNode = useCallback(id => {
|
|
31
|
+
setNodes(prevNodes => {
|
|
32
|
+
const index = prevNodes.findIndex(item => item.id === id);
|
|
33
|
+
if (index === -1) return prevNodes;
|
|
34
|
+
const copy = [...prevNodes];
|
|
35
|
+
const nodeMatch = prevNodes[index].element;
|
|
36
|
+
const handleOnDidClose = () => {
|
|
37
|
+
var _nodeMatch$props, _nodeMatch$props$onDi;
|
|
38
|
+
(_nodeMatch$props = nodeMatch.props) === null || _nodeMatch$props === void 0 || (_nodeMatch$props$onDi = _nodeMatch$props.onDidClose) === null || _nodeMatch$props$onDi === void 0 || _nodeMatch$props$onDi.call(_nodeMatch$props);
|
|
39
|
+
filterInvisibleNodes();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// set the visible prop to false to trigger exit animation
|
|
43
|
+
copy[index].element = /*#__PURE__*/cloneElement(nodeMatch, {
|
|
44
|
+
visible: false,
|
|
45
|
+
onDidClose: handleOnDidClose
|
|
46
|
+
});
|
|
47
|
+
return copy;
|
|
48
|
+
});
|
|
49
|
+
}, [filterInvisibleNodes]);
|
|
50
|
+
return useMemo(() => ({
|
|
51
|
+
nodes,
|
|
52
|
+
addNode,
|
|
53
|
+
removeNode
|
|
54
|
+
}), [nodes, addNode, removeNode]);
|
|
55
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { cloneElement, useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
+
import { useTimer } from '../hooks/useTimer';
|
|
8
|
+
export const useToastQueue = () => {
|
|
9
|
+
const [activeToast, setActiveToast] = useState();
|
|
10
|
+
const toastQueue = useRef([]);
|
|
11
|
+
const activeToastRef = useRef(null);
|
|
12
|
+
const hasActiveToast = useRef(false);
|
|
13
|
+
const timer = useTimer();
|
|
14
|
+
hasActiveToast.current = !!activeToast;
|
|
15
|
+
const hideToast = useCallback(async () => {
|
|
16
|
+
var _activeToastRef$curre;
|
|
17
|
+
return (_activeToastRef$curre = activeToastRef.current) === null || _activeToastRef$curre === void 0 ? void 0 : _activeToastRef$curre.hide();
|
|
18
|
+
}, [activeToastRef]);
|
|
19
|
+
const removeToast = useCallback(() => {
|
|
20
|
+
timer.clear();
|
|
21
|
+
setActiveToast(undefined);
|
|
22
|
+
}, [timer, setActiveToast]);
|
|
23
|
+
const setToast = useCallback(toast => {
|
|
24
|
+
if (!toast) return;
|
|
25
|
+
activeToastRef.current = null;
|
|
26
|
+
setActiveToast(_objectSpread(_objectSpread({}, toast), {}, {
|
|
27
|
+
element: /*#__PURE__*/cloneElement(toast.element, {
|
|
28
|
+
ref: activeToastRef
|
|
29
|
+
})
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
// remove toast after duration
|
|
33
|
+
timer.start(() => {
|
|
34
|
+
void hideToast();
|
|
35
|
+
}, toast.duration);
|
|
36
|
+
}, [timer, hideToast]);
|
|
37
|
+
const addToast = useCallback((element, duration) => {
|
|
38
|
+
const toast = {
|
|
39
|
+
element,
|
|
40
|
+
duration
|
|
41
|
+
};
|
|
42
|
+
if (hasActiveToast.current) {
|
|
43
|
+
toastQueue.current.push(toast);
|
|
44
|
+
} else {
|
|
45
|
+
setToast(toast);
|
|
46
|
+
}
|
|
47
|
+
}, [setToast]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
// dequeue toast to active
|
|
50
|
+
if (activeToast === undefined && toastQueue.current.length > 0) {
|
|
51
|
+
setToast(toastQueue.current.shift());
|
|
52
|
+
}
|
|
53
|
+
}, [activeToast, setToast]);
|
|
54
|
+
const clearToastQueue = useCallback(async () => {
|
|
55
|
+
removeToast();
|
|
56
|
+
toastQueue.current.length = 0;
|
|
57
|
+
}, [removeToast]);
|
|
58
|
+
return {
|
|
59
|
+
activeToast,
|
|
60
|
+
addToast,
|
|
61
|
+
removeToast,
|
|
62
|
+
hideToast,
|
|
63
|
+
clearToastQueue,
|
|
64
|
+
pauseTimer: timer.pause,
|
|
65
|
+
resumeTimer: timer.resume
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { flattenSteps } from './utils';
|
|
3
|
+
/**
|
|
4
|
+
* A hook for managing StepperHorizontal or StepperVertical state.
|
|
5
|
+
* Both components can be used on their own, but this hook provides a convenient way to sync state changes to the component props.
|
|
6
|
+
*
|
|
7
|
+
* @param options - The options for the stepper.
|
|
8
|
+
* @param options.steps - The array of steps data.
|
|
9
|
+
* @param options.defaultActiveStepId - The default active step ID. If not provided, the first step will be used.
|
|
10
|
+
* @param options.skipParentSteps - If true, steps containing sub-steps will never be made active.
|
|
11
|
+
* @returns A tuple where the first element is the stepper state and the second element is an API for manipulating the stepper state.
|
|
12
|
+
*/
|
|
13
|
+
export const useStepper = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
steps,
|
|
16
|
+
defaultActiveStepId,
|
|
17
|
+
skipParentSteps
|
|
18
|
+
} = _ref;
|
|
19
|
+
// Flatten the nested steps structure for internal processing
|
|
20
|
+
const flatSteps = useMemo(() => flattenSteps(steps), [steps]);
|
|
21
|
+
const findNextStep = useCallback(fromIndex => {
|
|
22
|
+
for (let i = fromIndex; i < flatSteps.length; i++) {
|
|
23
|
+
const step = flatSteps[i];
|
|
24
|
+
const isParentStep = step.subSteps && step.subSteps.length > 0;
|
|
25
|
+
const canUseStep = !skipParentSteps || !isParentStep;
|
|
26
|
+
if (canUseStep) {
|
|
27
|
+
return step;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}, [flatSteps, skipParentSteps]);
|
|
32
|
+
const findPreviousStep = useCallback(fromIndex => {
|
|
33
|
+
for (let i = fromIndex; i >= 0; i--) {
|
|
34
|
+
const step = flatSteps[i];
|
|
35
|
+
const isParentStep = step.subSteps && step.subSteps.length > 0;
|
|
36
|
+
const canUseStep = !skipParentSteps || !isParentStep;
|
|
37
|
+
if (canUseStep) {
|
|
38
|
+
return step;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}, [flatSteps, skipParentSteps]);
|
|
43
|
+
const getInitialActiveStepId = useCallback(() => {
|
|
44
|
+
if (flatSteps.length === 0 || defaultActiveStepId === null) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
if (defaultActiveStepId) {
|
|
48
|
+
const defaultStepInFlat = flatSteps.find(step => step.id === defaultActiveStepId);
|
|
49
|
+
if (defaultStepInFlat) {
|
|
50
|
+
const isParentStep = defaultStepInFlat.subSteps && defaultStepInFlat.subSteps.length > 0;
|
|
51
|
+
const canUseStep = !skipParentSteps || !isParentStep;
|
|
52
|
+
if (canUseStep) {
|
|
53
|
+
return defaultStepInFlat.id;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// If it's a parent step and we skip parent steps, find next valid step from this position
|
|
57
|
+
const defaultStepIndex = flatSteps.findIndex(step => step.id === defaultActiveStepId);
|
|
58
|
+
const nextValidStep = findNextStep(defaultStepIndex);
|
|
59
|
+
if (nextValidStep) {
|
|
60
|
+
return nextValidStep.id;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Fallback to first valid step
|
|
66
|
+
const firstValidStep = findNextStep(0);
|
|
67
|
+
return firstValidStep ? firstValidStep.id : null;
|
|
68
|
+
}, [defaultActiveStepId, flatSteps, skipParentSteps, findNextStep]);
|
|
69
|
+
const [activeStepId, setActiveStepId] = useState(getInitialActiveStepId());
|
|
70
|
+
const goToStep = useCallback(stepId => {
|
|
71
|
+
const targetIndex = flatSteps.findIndex(step => step.id === stepId);
|
|
72
|
+
if (targetIndex === -1) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const targetStep = flatSteps[targetIndex];
|
|
76
|
+
|
|
77
|
+
// If skipParentSteps is enabled, don't allow navigation to parent steps
|
|
78
|
+
if (skipParentSteps && targetStep.subSteps && targetStep.subSteps.length > 0) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
setActiveStepId(targetStep.id);
|
|
82
|
+
}, [flatSteps, setActiveStepId, skipParentSteps]);
|
|
83
|
+
const goNextStep = useCallback(() => {
|
|
84
|
+
setActiveStepId(currentActiveStepId => {
|
|
85
|
+
if (currentActiveStepId === null) {
|
|
86
|
+
const firstStep = findNextStep(0);
|
|
87
|
+
return firstStep ? firstStep.id : null;
|
|
88
|
+
}
|
|
89
|
+
const activeStepIndex = flatSteps.findIndex(step => step.id === currentActiveStepId);
|
|
90
|
+
const nextStep = findNextStep(activeStepIndex + 1);
|
|
91
|
+
if (nextStep) {
|
|
92
|
+
return nextStep.id;
|
|
93
|
+
} else {
|
|
94
|
+
return currentActiveStepId;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}, [flatSteps, findNextStep]);
|
|
98
|
+
const goPreviousStep = useCallback(() => {
|
|
99
|
+
setActiveStepId(currentActiveStepId => {
|
|
100
|
+
if (currentActiveStepId === null) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const activeStepIndex = flatSteps.findIndex(step => step.id === currentActiveStepId);
|
|
104
|
+
const previousStep = findPreviousStep(activeStepIndex - 1);
|
|
105
|
+
if (previousStep) {
|
|
106
|
+
return previousStep.id;
|
|
107
|
+
}
|
|
108
|
+
return currentActiveStepId;
|
|
109
|
+
});
|
|
110
|
+
}, [flatSteps, findPreviousStep]);
|
|
111
|
+
const reset = useCallback(() => {
|
|
112
|
+
setActiveStepId(getInitialActiveStepId());
|
|
113
|
+
}, [getInitialActiveStepId, setActiveStepId]);
|
|
114
|
+
const state = useMemo(() => ({
|
|
115
|
+
activeStepId
|
|
116
|
+
}), [activeStepId]);
|
|
117
|
+
const api = useMemo(() => ({
|
|
118
|
+
goToStep,
|
|
119
|
+
goNextStep,
|
|
120
|
+
goPreviousStep,
|
|
121
|
+
reset
|
|
122
|
+
}), [goToStep, goNextStep, goPreviousStep, reset]);
|
|
123
|
+
return [state, api];
|
|
124
|
+
};
|