@astral/ui 4.81.0 → 4.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ConfirmDialog/ConfirmDialog.js +3 -1
- package/components/ConfirmDialog/constants.d.ts +4 -0
- package/components/ConfirmDialog/constants.js +5 -0
- package/components/ConfirmDialog/index.d.ts +1 -0
- package/components/ConfirmDialog/index.js +1 -0
- package/components/ConfirmDialog/public.d.ts +1 -0
- package/components/ConfirmDialog/public.js +1 -0
- package/components/ConfirmDialog/types.d.ts +1 -1
- package/components/NewPopover/NewPopover.d.ts +1 -1
- package/components/NewPopover/NewPopover.js +14 -5
- package/components/NewPopover/constants.d.ts +7 -0
- package/components/NewPopover/constants.js +11 -0
- package/components/NewPopover/styles.d.ts +4 -0
- package/components/NewPopover/styles.js +100 -4
- package/components/NewPopover/types.d.ts +13 -0
- package/components/NewPopover/useLogic/useLogic.d.ts +7 -3
- package/components/NewPopover/useLogic/useLogic.js +15 -1
- package/components/Onboarding/Onboarding.d.ts +35 -0
- package/components/Onboarding/Onboarding.js +46 -0
- package/components/Onboarding/constants.d.ts +34 -0
- package/components/Onboarding/constants.js +34 -0
- package/components/Onboarding/core/ActiveStepStore/ActiveStepStore.d.ts +50 -0
- package/components/Onboarding/core/ActiveStepStore/ActiveStepStore.js +63 -0
- package/components/Onboarding/core/ActiveStepStore/index.d.ts +1 -0
- package/components/Onboarding/core/ActiveStepStore/index.js +1 -0
- package/components/Onboarding/core/ExitController/ExitController.d.ts +46 -0
- package/components/Onboarding/core/ExitController/ExitController.js +56 -0
- package/components/Onboarding/core/ExitController/index.d.ts +1 -0
- package/components/Onboarding/core/ExitController/index.js +1 -0
- package/components/Onboarding/core/OnboardingTour/OnboardingTour.d.ts +101 -0
- package/components/Onboarding/core/OnboardingTour/OnboardingTour.js +262 -0
- package/components/Onboarding/core/OnboardingTour/index.d.ts +1 -0
- package/components/Onboarding/core/OnboardingTour/index.js +1 -0
- package/components/Onboarding/core/ProgressStorage/ProgressStorage.d.ts +22 -0
- package/components/Onboarding/core/ProgressStorage/ProgressStorage.js +58 -0
- package/components/Onboarding/core/ProgressStorage/index.d.ts +1 -0
- package/components/Onboarding/core/ProgressStorage/index.js +1 -0
- package/components/Onboarding/core/StepNavigator/StepNavigator.d.ts +28 -0
- package/components/Onboarding/core/StepNavigator/StepNavigator.js +73 -0
- package/components/Onboarding/core/StepNavigator/index.d.ts +1 -0
- package/components/Onboarding/core/StepNavigator/index.js +1 -0
- package/components/Onboarding/core/StepResolver/StepResolver.d.ts +19 -0
- package/components/Onboarding/core/StepResolver/StepResolver.js +49 -0
- package/components/Onboarding/core/StepResolver/index.d.ts +1 -0
- package/components/Onboarding/core/StepResolver/index.js +1 -0
- package/components/Onboarding/core/StepsController/StepsController.d.ts +16 -0
- package/components/Onboarding/core/StepsController/StepsController.js +35 -0
- package/components/Onboarding/core/StepsController/index.d.ts +1 -0
- package/components/Onboarding/core/StepsController/index.js +1 -0
- package/components/Onboarding/faker.d.ts +27 -0
- package/components/Onboarding/faker.js +79 -0
- package/components/Onboarding/index.d.ts +5 -0
- package/components/Onboarding/index.js +3 -0
- package/components/Onboarding/public.d.ts +5 -0
- package/components/Onboarding/public.js +3 -0
- package/components/Onboarding/services/LocalStorageSaveStrategy/LocalStorageSaveStrategy.d.ts +20 -0
- package/components/Onboarding/services/LocalStorageSaveStrategy/LocalStorageSaveStrategy.js +24 -0
- package/components/Onboarding/services/LocalStorageSaveStrategy/index.d.ts +1 -0
- package/components/Onboarding/services/LocalStorageSaveStrategy/index.js +1 -0
- package/components/Onboarding/types/config.d.ts +18 -0
- package/components/Onboarding/types/config.js +1 -0
- package/components/Onboarding/types/index.d.ts +4 -0
- package/components/Onboarding/types/index.js +4 -0
- package/components/Onboarding/types/progress.d.ts +28 -0
- package/components/Onboarding/types/progress.js +1 -0
- package/components/Onboarding/types/step.d.ts +144 -0
- package/components/Onboarding/types/step.js +1 -0
- package/components/Onboarding/types/tour.d.ts +168 -0
- package/components/Onboarding/types/tour.js +1 -0
- package/components/Onboarding/ui/ConfirmExit/ConfirmExit.d.ts +10 -0
- package/components/Onboarding/ui/ConfirmExit/ConfirmExit.js +6 -0
- package/components/Onboarding/ui/ConfirmExit/index.d.ts +2 -0
- package/components/Onboarding/ui/ConfirmExit/index.js +1 -0
- package/components/Onboarding/ui/ConfirmExit/styles.d.ts +30 -0
- package/components/Onboarding/ui/ConfirmExit/styles.js +11 -0
- package/components/Onboarding/ui/OnboardingContainer/OnboardingContainer.d.ts +12 -0
- package/components/Onboarding/ui/OnboardingContainer/OnboardingContainer.js +15 -0
- package/components/Onboarding/ui/OnboardingContainer/OnboardingErrorBoundary/OnboardingErrorBoundary.d.ts +22 -0
- package/components/Onboarding/ui/OnboardingContainer/OnboardingErrorBoundary/OnboardingErrorBoundary.js +20 -0
- package/components/Onboarding/ui/OnboardingContainer/OnboardingErrorBoundary/index.d.ts +2 -0
- package/components/Onboarding/ui/OnboardingContainer/OnboardingErrorBoundary/index.js +1 -0
- package/components/Onboarding/ui/OnboardingContainer/index.d.ts +1 -0
- package/components/Onboarding/ui/OnboardingContainer/index.js +1 -0
- package/components/Onboarding/ui/OnboardingContainer/useLogic/index.d.ts +1 -0
- package/components/Onboarding/ui/OnboardingContainer/useLogic/index.js +1 -0
- package/components/Onboarding/ui/OnboardingContainer/useLogic/useLogic.d.ts +10 -0
- package/components/Onboarding/ui/OnboardingContainer/useLogic/useLogic.js +14 -0
- package/components/Onboarding/ui/Overlay/Overlay.d.ts +29 -0
- package/components/Onboarding/ui/Overlay/Overlay.js +24 -0
- package/components/Onboarding/ui/Overlay/constants.d.ts +7 -0
- package/components/Onboarding/ui/Overlay/constants.js +8 -0
- package/components/Onboarding/ui/Overlay/index.d.ts +2 -0
- package/components/Onboarding/ui/Overlay/index.js +1 -0
- package/components/Onboarding/ui/Overlay/styles.d.ts +22 -0
- package/components/Onboarding/ui/Overlay/styles.js +57 -0
- package/components/Onboarding/ui/Overlay/useLogic/index.d.ts +1 -0
- package/components/Onboarding/ui/Overlay/useLogic/index.js +1 -0
- package/components/Onboarding/ui/Overlay/useLogic/useLogic.d.ts +13 -0
- package/components/Onboarding/ui/Overlay/useLogic/useLogic.js +10 -0
- package/components/Onboarding/ui/StepStrategy/StepStrategy.d.ts +6 -0
- package/components/Onboarding/ui/StepStrategy/StepStrategy.js +17 -0
- package/components/Onboarding/ui/StepStrategy/index.d.ts +1 -0
- package/components/Onboarding/ui/StepStrategy/index.js +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/HighlightStep.d.ts +6 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/HighlightStep.js +19 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/index.d.ts +2 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/index.js +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.d.ts +25 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.js +56 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/index.d.ts +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/index.js +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/useLogic.d.ts +12 -0
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/useLogic.js +37 -0
- package/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/StandaloneStep.d.ts +6 -0
- package/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/StandaloneStep.js +11 -0
- package/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/index.d.ts +2 -0
- package/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/index.js +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/styles.d.ts +13 -0
- package/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/styles.js +9 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/ProgressDots.d.ts +6 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/ProgressDots.js +15 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/constants.d.ts +4 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/constants.js +5 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/index.d.ts +2 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/index.js +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/styles.d.ts +9 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/styles.js +34 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/StepFooter.d.ts +9 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/StepFooter.js +18 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/constants.d.ts +4 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/constants.js +4 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/index.d.ts +2 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/index.js +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/styles.d.ts +21 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/styles.js +28 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/useLogic/index.d.ts +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/useLogic/index.js +1 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/useLogic/useLogic.d.ts +16 -0
- package/components/Onboarding/ui/StepStrategy/steps/StepFooter/useLogic/useLogic.js +22 -0
- package/components/Onboarding/ui/StepStrategy/steps/types.d.ts +16 -0
- package/components/Onboarding/ui/StepStrategy/steps/types.js +1 -0
- package/components/Onboarding/ui/StepStrategy/useLogic/index.d.ts +1 -0
- package/components/Onboarding/ui/StepStrategy/useLogic/index.js +1 -0
- package/components/Onboarding/ui/StepStrategy/useLogic/useLogic.d.ts +47 -0
- package/components/Onboarding/ui/StepStrategy/useLogic/useLogic.js +51 -0
- package/components/Onboarding/ui/hooks/useActiveStep/index.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useActiveStep/index.js +1 -0
- package/components/Onboarding/ui/hooks/useActiveStep/useActiveStep.d.ts +6 -0
- package/components/Onboarding/ui/hooks/useActiveStep/useActiveStep.js +7 -0
- package/components/Onboarding/ui/hooks/useDelayedActiveStep/index.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useDelayedActiveStep/index.js +1 -0
- package/components/Onboarding/ui/hooks/useDelayedActiveStep/useDelayedActiveStep.d.ts +15 -0
- package/components/Onboarding/ui/hooks/useDelayedActiveStep/useDelayedActiveStep.js +19 -0
- package/components/Onboarding/ui/hooks/useFocusTrap/index.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useFocusTrap/index.js +1 -0
- package/components/Onboarding/ui/hooks/useFocusTrap/useFocusTrap.d.ts +6 -0
- package/components/Onboarding/ui/hooks/useFocusTrap/useFocusTrap.js +33 -0
- package/components/Onboarding/ui/hooks/useKeyboardNav/index.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useKeyboardNav/index.js +1 -0
- package/components/Onboarding/ui/hooks/useKeyboardNav/useKeyboardNav.d.ts +11 -0
- package/components/Onboarding/ui/hooks/useKeyboardNav/useKeyboardNav.js +62 -0
- package/components/Onboarding/ui/hooks/useStepTransition/index.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useStepTransition/index.js +1 -0
- package/components/Onboarding/ui/hooks/useStepTransition/useStepTransition.d.ts +30 -0
- package/components/Onboarding/ui/hooks/useStepTransition/useStepTransition.js +46 -0
- package/components/Onboarding/ui/hooks/useTargetAnchor/index.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useTargetAnchor/index.js +1 -0
- package/components/Onboarding/ui/hooks/useTargetAnchor/useTargetAnchor.d.ts +37 -0
- package/components/Onboarding/ui/hooks/useTargetAnchor/useTargetAnchor.js +56 -0
- package/components/Onboarding/ui/hooks/useTrackedRect/index.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useTrackedRect/index.js +1 -0
- package/components/Onboarding/ui/hooks/useTrackedRect/useTrackedRect.d.ts +5 -0
- package/components/Onboarding/ui/hooks/useTrackedRect/useTrackedRect.js +43 -0
- package/components/Onboarding/ui/hooks/useViewportSize/index.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useViewportSize/index.js +1 -0
- package/components/Onboarding/ui/hooks/useViewportSize/useViewportSize.d.ts +5 -0
- package/components/Onboarding/ui/hooks/useViewportSize/useViewportSize.js +14 -0
- package/components/Onboarding/ui/styles.d.ts +5 -0
- package/components/Onboarding/ui/styles.js +15 -0
- package/components/Onboarding/utils/createVirtualAnchor/createVirtualAnchor.d.ts +12 -0
- package/components/Onboarding/utils/createVirtualAnchor/createVirtualAnchor.js +6 -0
- package/components/Onboarding/utils/createVirtualAnchor/index.d.ts +1 -0
- package/components/Onboarding/utils/createVirtualAnchor/index.js +1 -0
- package/components/Onboarding/utils/geometry/index.d.ts +4 -0
- package/components/Onboarding/utils/geometry/index.js +4 -0
- package/components/Onboarding/utils/geometry/overlayPath/index.d.ts +1 -0
- package/components/Onboarding/utils/geometry/overlayPath/index.js +1 -0
- package/components/Onboarding/utils/geometry/overlayPath/overlayPath.d.ts +6 -0
- package/components/Onboarding/utils/geometry/overlayPath/overlayPath.js +29 -0
- package/components/Onboarding/utils/geometry/parseOffset/index.d.ts +1 -0
- package/components/Onboarding/utils/geometry/parseOffset/index.js +1 -0
- package/components/Onboarding/utils/geometry/parseOffset/parseOffset.d.ts +4 -0
- package/components/Onboarding/utils/geometry/parseOffset/parseOffset.js +5 -0
- package/components/Onboarding/utils/geometry/rect/index.d.ts +2 -0
- package/components/Onboarding/utils/geometry/rect/index.js +1 -0
- package/components/Onboarding/utils/geometry/rect/rect.d.ts +34 -0
- package/components/Onboarding/utils/geometry/rect/rect.js +60 -0
- package/components/Onboarding/utils/geometry/viewport/index.d.ts +2 -0
- package/components/Onboarding/utils/geometry/viewport/index.js +1 -0
- package/components/Onboarding/utils/geometry/viewport/viewport.d.ts +14 -0
- package/components/Onboarding/utils/geometry/viewport/viewport.js +10 -0
- package/components/Onboarding/utils/getScrollParents/getScrollParents.d.ts +7 -0
- package/components/Onboarding/utils/getScrollParents/getScrollParents.js +24 -0
- package/components/Onboarding/utils/getScrollParents/index.d.ts +1 -0
- package/components/Onboarding/utils/getScrollParents/index.js +1 -0
- package/components/Onboarding/utils/getTargetElement/getTargetElement.d.ts +4 -0
- package/components/Onboarding/utils/getTargetElement/getTargetElement.js +9 -0
- package/components/Onboarding/utils/getTargetElement/index.d.ts +1 -0
- package/components/Onboarding/utils/getTargetElement/index.js +1 -0
- package/components/Onboarding/utils/observeRemoval/index.d.ts +1 -0
- package/components/Onboarding/utils/observeRemoval/index.js +1 -0
- package/components/Onboarding/utils/observeRemoval/observeRemoval.d.ts +4 -0
- package/components/Onboarding/utils/observeRemoval/observeRemoval.js +13 -0
- package/components/Onboarding/utils/scrollIntoView/index.d.ts +1 -0
- package/components/Onboarding/utils/scrollIntoView/index.js +1 -0
- package/components/Onboarding/utils/scrollIntoView/scrollIntoView.d.ts +13 -0
- package/components/Onboarding/utils/scrollIntoView/scrollIntoView.js +85 -0
- package/components/Onboarding/utils/waitForElement/index.d.ts +2 -0
- package/components/Onboarding/utils/waitForElement/index.js +1 -0
- package/components/Onboarding/utils/waitForElement/waitForElement.d.ts +21 -0
- package/components/Onboarding/utils/waitForElement/waitForElement.js +45 -0
- package/components/Onboarding/validation/index.d.ts +1 -0
- package/components/Onboarding/validation/index.js +1 -0
- package/components/Onboarding/validation/validateTourConfig/index.d.ts +1 -0
- package/components/Onboarding/validation/validateTourConfig/index.js +1 -0
- package/components/Onboarding/validation/validateTourConfig/validateTourConfig.d.ts +12 -0
- package/components/Onboarding/validation/validateTourConfig/validateTourConfig.js +52 -0
- package/components/TagsList/Tag/Tag.js +3 -2
- package/node/components/ConfirmDialog/ConfirmDialog.js +3 -1
- package/node/components/ConfirmDialog/constants.d.ts +4 -0
- package/node/components/ConfirmDialog/constants.js +8 -0
- package/node/components/ConfirmDialog/index.d.ts +1 -0
- package/node/components/ConfirmDialog/index.js +3 -0
- package/node/components/ConfirmDialog/public.d.ts +1 -0
- package/node/components/ConfirmDialog/public.js +3 -0
- package/node/components/ConfirmDialog/types.d.ts +1 -1
- package/node/components/NewPopover/NewPopover.d.ts +1 -1
- package/node/components/NewPopover/NewPopover.js +12 -3
- package/node/components/NewPopover/constants.d.ts +7 -0
- package/node/components/NewPopover/constants.js +12 -1
- package/node/components/NewPopover/styles.d.ts +4 -0
- package/node/components/NewPopover/styles.js +101 -5
- package/node/components/NewPopover/types.d.ts +13 -0
- package/node/components/NewPopover/useLogic/useLogic.d.ts +7 -3
- package/node/components/NewPopover/useLogic/useLogic.js +15 -1
- package/node/components/Onboarding/Onboarding.d.ts +35 -0
- package/node/components/Onboarding/Onboarding.js +51 -0
- package/node/components/Onboarding/constants.d.ts +34 -0
- package/node/components/Onboarding/constants.js +37 -0
- package/node/components/Onboarding/core/ActiveStepStore/ActiveStepStore.d.ts +50 -0
- package/node/components/Onboarding/core/ActiveStepStore/ActiveStepStore.js +67 -0
- package/node/components/Onboarding/core/ActiveStepStore/index.d.ts +1 -0
- package/node/components/Onboarding/core/ActiveStepStore/index.js +17 -0
- package/node/components/Onboarding/core/ExitController/ExitController.d.ts +46 -0
- package/node/components/Onboarding/core/ExitController/ExitController.js +60 -0
- package/node/components/Onboarding/core/ExitController/index.d.ts +1 -0
- package/node/components/Onboarding/core/ExitController/index.js +17 -0
- package/node/components/Onboarding/core/OnboardingTour/OnboardingTour.d.ts +101 -0
- package/node/components/Onboarding/core/OnboardingTour/OnboardingTour.js +266 -0
- package/node/components/Onboarding/core/OnboardingTour/index.d.ts +1 -0
- package/node/components/Onboarding/core/OnboardingTour/index.js +5 -0
- package/node/components/Onboarding/core/ProgressStorage/ProgressStorage.d.ts +22 -0
- package/node/components/Onboarding/core/ProgressStorage/ProgressStorage.js +62 -0
- package/node/components/Onboarding/core/ProgressStorage/index.d.ts +1 -0
- package/node/components/Onboarding/core/ProgressStorage/index.js +17 -0
- package/node/components/Onboarding/core/StepNavigator/StepNavigator.d.ts +28 -0
- package/node/components/Onboarding/core/StepNavigator/StepNavigator.js +77 -0
- package/node/components/Onboarding/core/StepNavigator/index.d.ts +1 -0
- package/node/components/Onboarding/core/StepNavigator/index.js +17 -0
- package/node/components/Onboarding/core/StepResolver/StepResolver.d.ts +19 -0
- package/node/components/Onboarding/core/StepResolver/StepResolver.js +53 -0
- package/node/components/Onboarding/core/StepResolver/index.d.ts +1 -0
- package/node/components/Onboarding/core/StepResolver/index.js +17 -0
- package/node/components/Onboarding/core/StepsController/StepsController.d.ts +16 -0
- package/node/components/Onboarding/core/StepsController/StepsController.js +39 -0
- package/node/components/Onboarding/core/StepsController/index.d.ts +1 -0
- package/node/components/Onboarding/core/StepsController/index.js +17 -0
- package/node/components/Onboarding/faker.d.ts +27 -0
- package/node/components/Onboarding/faker.js +88 -0
- package/node/components/Onboarding/index.d.ts +5 -0
- package/node/components/Onboarding/index.js +9 -0
- package/node/components/Onboarding/public.d.ts +5 -0
- package/node/components/Onboarding/public.js +9 -0
- package/node/components/Onboarding/services/LocalStorageSaveStrategy/LocalStorageSaveStrategy.d.ts +20 -0
- package/node/components/Onboarding/services/LocalStorageSaveStrategy/LocalStorageSaveStrategy.js +29 -0
- package/node/components/Onboarding/services/LocalStorageSaveStrategy/index.d.ts +1 -0
- package/node/components/Onboarding/services/LocalStorageSaveStrategy/index.js +17 -0
- package/node/components/Onboarding/types/config.d.ts +18 -0
- package/node/components/Onboarding/types/config.js +2 -0
- package/node/components/Onboarding/types/index.d.ts +4 -0
- package/node/components/Onboarding/types/index.js +20 -0
- package/node/components/Onboarding/types/progress.d.ts +28 -0
- package/node/components/Onboarding/types/progress.js +2 -0
- package/node/components/Onboarding/types/step.d.ts +144 -0
- package/node/components/Onboarding/types/step.js +2 -0
- package/node/components/Onboarding/types/tour.d.ts +168 -0
- package/node/components/Onboarding/types/tour.js +2 -0
- package/node/components/Onboarding/ui/ConfirmExit/ConfirmExit.d.ts +10 -0
- package/node/components/Onboarding/ui/ConfirmExit/ConfirmExit.js +10 -0
- package/node/components/Onboarding/ui/ConfirmExit/index.d.ts +2 -0
- package/node/components/Onboarding/ui/ConfirmExit/index.js +5 -0
- package/node/components/Onboarding/ui/ConfirmExit/styles.d.ts +30 -0
- package/node/components/Onboarding/ui/ConfirmExit/styles.js +14 -0
- package/node/components/Onboarding/ui/OnboardingContainer/OnboardingContainer.d.ts +12 -0
- package/node/components/Onboarding/ui/OnboardingContainer/OnboardingContainer.js +19 -0
- package/node/components/Onboarding/ui/OnboardingContainer/OnboardingErrorBoundary/OnboardingErrorBoundary.d.ts +22 -0
- package/node/components/Onboarding/ui/OnboardingContainer/OnboardingErrorBoundary/OnboardingErrorBoundary.js +24 -0
- package/node/components/Onboarding/ui/OnboardingContainer/OnboardingErrorBoundary/index.d.ts +2 -0
- package/node/components/Onboarding/ui/OnboardingContainer/OnboardingErrorBoundary/index.js +5 -0
- package/node/components/Onboarding/ui/OnboardingContainer/index.d.ts +1 -0
- package/node/components/Onboarding/ui/OnboardingContainer/index.js +5 -0
- package/node/components/Onboarding/ui/OnboardingContainer/useLogic/index.d.ts +1 -0
- package/node/components/Onboarding/ui/OnboardingContainer/useLogic/index.js +5 -0
- package/node/components/Onboarding/ui/OnboardingContainer/useLogic/useLogic.d.ts +10 -0
- package/node/components/Onboarding/ui/OnboardingContainer/useLogic/useLogic.js +18 -0
- package/node/components/Onboarding/ui/Overlay/Overlay.d.ts +29 -0
- package/node/components/Onboarding/ui/Overlay/Overlay.js +28 -0
- package/node/components/Onboarding/ui/Overlay/constants.d.ts +7 -0
- package/node/components/Onboarding/ui/Overlay/constants.js +11 -0
- package/node/components/Onboarding/ui/Overlay/index.d.ts +2 -0
- package/node/components/Onboarding/ui/Overlay/index.js +5 -0
- package/node/components/Onboarding/ui/Overlay/styles.d.ts +22 -0
- package/node/components/Onboarding/ui/Overlay/styles.js +60 -0
- package/node/components/Onboarding/ui/Overlay/useLogic/index.d.ts +1 -0
- package/node/components/Onboarding/ui/Overlay/useLogic/index.js +5 -0
- package/node/components/Onboarding/ui/Overlay/useLogic/useLogic.d.ts +13 -0
- package/node/components/Onboarding/ui/Overlay/useLogic/useLogic.js +14 -0
- package/node/components/Onboarding/ui/StepStrategy/StepStrategy.d.ts +6 -0
- package/node/components/Onboarding/ui/StepStrategy/StepStrategy.js +21 -0
- package/node/components/Onboarding/ui/StepStrategy/index.d.ts +1 -0
- package/node/components/Onboarding/ui/StepStrategy/index.js +17 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/HighlightStep.d.ts +6 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/HighlightStep.js +23 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/index.d.ts +2 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/index.js +5 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.d.ts +25 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.js +59 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/index.d.ts +1 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/index.js +5 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/useLogic.d.ts +12 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/useLogic.js +41 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/StandaloneStep.d.ts +6 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/StandaloneStep.js +15 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/index.d.ts +2 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/index.js +5 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/styles.d.ts +13 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/styles.js +12 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/ProgressDots.d.ts +6 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/ProgressDots.js +19 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/constants.d.ts +4 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/constants.js +8 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/index.d.ts +2 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/index.js +5 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/styles.d.ts +9 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/ProgressDots/styles.js +37 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/StepFooter.d.ts +9 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/StepFooter.js +22 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/constants.d.ts +4 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/constants.js +7 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/index.d.ts +2 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/index.js +5 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/styles.d.ts +21 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/styles.js +31 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/useLogic/index.d.ts +1 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/useLogic/index.js +5 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/useLogic/useLogic.d.ts +16 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/StepFooter/useLogic/useLogic.js +26 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/types.d.ts +16 -0
- package/node/components/Onboarding/ui/StepStrategy/steps/types.js +2 -0
- package/node/components/Onboarding/ui/StepStrategy/useLogic/index.d.ts +1 -0
- package/node/components/Onboarding/ui/StepStrategy/useLogic/index.js +5 -0
- package/node/components/Onboarding/ui/StepStrategy/useLogic/useLogic.d.ts +47 -0
- package/node/components/Onboarding/ui/StepStrategy/useLogic/useLogic.js +55 -0
- package/node/components/Onboarding/ui/hooks/useActiveStep/index.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useActiveStep/index.js +5 -0
- package/node/components/Onboarding/ui/hooks/useActiveStep/useActiveStep.d.ts +6 -0
- package/node/components/Onboarding/ui/hooks/useActiveStep/useActiveStep.js +11 -0
- package/node/components/Onboarding/ui/hooks/useDelayedActiveStep/index.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useDelayedActiveStep/index.js +17 -0
- package/node/components/Onboarding/ui/hooks/useDelayedActiveStep/useDelayedActiveStep.d.ts +15 -0
- package/node/components/Onboarding/ui/hooks/useDelayedActiveStep/useDelayedActiveStep.js +23 -0
- package/node/components/Onboarding/ui/hooks/useFocusTrap/index.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useFocusTrap/index.js +5 -0
- package/node/components/Onboarding/ui/hooks/useFocusTrap/useFocusTrap.d.ts +6 -0
- package/node/components/Onboarding/ui/hooks/useFocusTrap/useFocusTrap.js +37 -0
- package/node/components/Onboarding/ui/hooks/useKeyboardNav/index.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useKeyboardNav/index.js +5 -0
- package/node/components/Onboarding/ui/hooks/useKeyboardNav/useKeyboardNav.d.ts +11 -0
- package/node/components/Onboarding/ui/hooks/useKeyboardNav/useKeyboardNav.js +66 -0
- package/node/components/Onboarding/ui/hooks/useStepTransition/index.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useStepTransition/index.js +5 -0
- package/node/components/Onboarding/ui/hooks/useStepTransition/useStepTransition.d.ts +30 -0
- package/node/components/Onboarding/ui/hooks/useStepTransition/useStepTransition.js +50 -0
- package/node/components/Onboarding/ui/hooks/useTargetAnchor/index.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useTargetAnchor/index.js +17 -0
- package/node/components/Onboarding/ui/hooks/useTargetAnchor/useTargetAnchor.d.ts +37 -0
- package/node/components/Onboarding/ui/hooks/useTargetAnchor/useTargetAnchor.js +60 -0
- package/node/components/Onboarding/ui/hooks/useTrackedRect/index.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useTrackedRect/index.js +5 -0
- package/node/components/Onboarding/ui/hooks/useTrackedRect/useTrackedRect.d.ts +5 -0
- package/node/components/Onboarding/ui/hooks/useTrackedRect/useTrackedRect.js +47 -0
- package/node/components/Onboarding/ui/hooks/useViewportSize/index.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useViewportSize/index.js +5 -0
- package/node/components/Onboarding/ui/hooks/useViewportSize/useViewportSize.d.ts +5 -0
- package/node/components/Onboarding/ui/hooks/useViewportSize/useViewportSize.js +18 -0
- package/node/components/Onboarding/ui/styles.d.ts +5 -0
- package/node/components/Onboarding/ui/styles.js +19 -0
- package/node/components/Onboarding/utils/createVirtualAnchor/createVirtualAnchor.d.ts +12 -0
- package/node/components/Onboarding/utils/createVirtualAnchor/createVirtualAnchor.js +10 -0
- package/node/components/Onboarding/utils/createVirtualAnchor/index.d.ts +1 -0
- package/node/components/Onboarding/utils/createVirtualAnchor/index.js +17 -0
- package/node/components/Onboarding/utils/geometry/index.d.ts +4 -0
- package/node/components/Onboarding/utils/geometry/index.js +20 -0
- package/node/components/Onboarding/utils/geometry/overlayPath/index.d.ts +1 -0
- package/node/components/Onboarding/utils/geometry/overlayPath/index.js +5 -0
- package/node/components/Onboarding/utils/geometry/overlayPath/overlayPath.d.ts +6 -0
- package/node/components/Onboarding/utils/geometry/overlayPath/overlayPath.js +33 -0
- package/node/components/Onboarding/utils/geometry/parseOffset/index.d.ts +1 -0
- package/node/components/Onboarding/utils/geometry/parseOffset/index.js +5 -0
- package/node/components/Onboarding/utils/geometry/parseOffset/parseOffset.d.ts +4 -0
- package/node/components/Onboarding/utils/geometry/parseOffset/parseOffset.js +9 -0
- package/node/components/Onboarding/utils/geometry/rect/index.d.ts +2 -0
- package/node/components/Onboarding/utils/geometry/rect/index.js +9 -0
- package/node/components/Onboarding/utils/geometry/rect/rect.d.ts +34 -0
- package/node/components/Onboarding/utils/geometry/rect/rect.js +69 -0
- package/node/components/Onboarding/utils/geometry/viewport/index.d.ts +2 -0
- package/node/components/Onboarding/utils/geometry/viewport/index.js +5 -0
- package/node/components/Onboarding/utils/geometry/viewport/viewport.d.ts +14 -0
- package/node/components/Onboarding/utils/geometry/viewport/viewport.js +14 -0
- package/node/components/Onboarding/utils/getScrollParents/getScrollParents.d.ts +7 -0
- package/node/components/Onboarding/utils/getScrollParents/getScrollParents.js +28 -0
- package/node/components/Onboarding/utils/getScrollParents/index.d.ts +1 -0
- package/node/components/Onboarding/utils/getScrollParents/index.js +5 -0
- package/node/components/Onboarding/utils/getTargetElement/getTargetElement.d.ts +4 -0
- package/node/components/Onboarding/utils/getTargetElement/getTargetElement.js +13 -0
- package/node/components/Onboarding/utils/getTargetElement/index.d.ts +1 -0
- package/node/components/Onboarding/utils/getTargetElement/index.js +5 -0
- package/node/components/Onboarding/utils/observeRemoval/index.d.ts +1 -0
- package/node/components/Onboarding/utils/observeRemoval/index.js +17 -0
- package/node/components/Onboarding/utils/observeRemoval/observeRemoval.d.ts +4 -0
- package/node/components/Onboarding/utils/observeRemoval/observeRemoval.js +17 -0
- package/node/components/Onboarding/utils/scrollIntoView/index.d.ts +1 -0
- package/node/components/Onboarding/utils/scrollIntoView/index.js +5 -0
- package/node/components/Onboarding/utils/scrollIntoView/scrollIntoView.d.ts +13 -0
- package/node/components/Onboarding/utils/scrollIntoView/scrollIntoView.js +89 -0
- package/node/components/Onboarding/utils/waitForElement/index.d.ts +2 -0
- package/node/components/Onboarding/utils/waitForElement/index.js +5 -0
- package/node/components/Onboarding/utils/waitForElement/waitForElement.d.ts +21 -0
- package/node/components/Onboarding/utils/waitForElement/waitForElement.js +49 -0
- package/node/components/Onboarding/validation/index.d.ts +1 -0
- package/node/components/Onboarding/validation/index.js +6 -0
- package/node/components/Onboarding/validation/validateTourConfig/index.d.ts +1 -0
- package/node/components/Onboarding/validation/validateTourConfig/index.js +6 -0
- package/node/components/Onboarding/validation/validateTourConfig/validateTourConfig.d.ts +12 -0
- package/node/components/Onboarding/validation/validateTourConfig/validateTourConfig.js +80 -0
- package/node/components/TagsList/Tag/Tag.js +3 -2
- package/package.json +3 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* Popover шага, z-index над overlay, быстрое закрытие.
|
|
4
|
+
*/
|
|
5
|
+
export declare const StepPopover: import("../../../../../styled").StyledComponent<import("../../../../../NewPopover").NewPopoverProps & {
|
|
6
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
7
|
+
}, {}, {}>;
|
|
8
|
+
export declare const PopoverBody: import("../../../../../styled").StyledComponent<{
|
|
9
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
11
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export declare const CloseButton: import("../../../../../styled").StyledComponent<Omit<import("../../../../..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
|
|
13
|
+
variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
|
|
14
|
+
loading?: boolean | undefined;
|
|
15
|
+
color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
|
|
16
|
+
component?: import("react").ElementType | undefined;
|
|
17
|
+
selected?: boolean | undefined;
|
|
18
|
+
size?: "large" | "medium" | undefined;
|
|
19
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
20
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
export declare const Content: import("../../../../../styled").StyledComponent<{
|
|
23
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
24
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
25
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IconButton } from '../../../../../IconButton';
|
|
2
|
+
import { NewPopover } from '../../../../../NewPopover';
|
|
3
|
+
import { popoverClassnames } from '../../../../../NewPopover/constants';
|
|
4
|
+
import { styled } from '../../../../../styled';
|
|
5
|
+
import { ONBOARDING_Z_INDEX_OFFSET } from '../../../../constants';
|
|
6
|
+
/**
|
|
7
|
+
* Popover шага, z-index над overlay, быстрое закрытие.
|
|
8
|
+
*/
|
|
9
|
+
export const StepPopover = styled(NewPopover) `
|
|
10
|
+
&& {
|
|
11
|
+
z-index: ${({ theme }) => theme.zIndex.tooltip + ONBOARDING_Z_INDEX_OFFSET.popover};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.${popoverClassnames.innerContainer} {
|
|
15
|
+
border-radius: calc(${({ theme }) => theme.shape.medium} * 2);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.${popoverClassnames.animatedWrapper}:not(.${popoverClassnames.animatedWrapperOpen}) {
|
|
19
|
+
animation-duration: ${({ theme }) => theme.transitions.duration.shortest}ms;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
export const PopoverBody = styled.div `
|
|
23
|
+
position: relative;
|
|
24
|
+
|
|
25
|
+
width: 400px;
|
|
26
|
+
padding: ${({ theme }) => theme.spacing(6)};
|
|
27
|
+
|
|
28
|
+
border-radius: calc(${({ theme }) => theme.shape.medium} * 2);
|
|
29
|
+
|
|
30
|
+
/* Фокус-трап ставит фокус на контейнер, браузерную рамку убираем. */
|
|
31
|
+
&:focus {
|
|
32
|
+
outline: none;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
export const CloseButton = styled(IconButton) `
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: ${({ theme }) => theme.spacing(6)};
|
|
38
|
+
right: ${({ theme }) => theme.spacing(6)};
|
|
39
|
+
`;
|
|
40
|
+
export const Content = styled.div `
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: ${({ theme }) => theme.spacing(4)};
|
|
44
|
+
|
|
45
|
+
margin-bottom: ${({ theme }) => theme.spacing(6)};
|
|
46
|
+
|
|
47
|
+
&:last-child {
|
|
48
|
+
margin-bottom: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Резерв справа под крестик — только у верхнего элемента (заголовок, а если
|
|
52
|
+
его нет — текст) */
|
|
53
|
+
& > *:first-of-type {
|
|
54
|
+
padding-right: ${({ theme }) => theme.spacing(10)};
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLogic } from './useLogic';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLogic } from './useLogic';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ActiveStepState } from '../../../../../types';
|
|
2
|
+
import { type OverlayGeometry } from '../../../useLogic';
|
|
3
|
+
export type UseLogicResult = {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
shouldShowPopover: boolean;
|
|
6
|
+
setPopoverNode: (node: HTMLElement | null) => void;
|
|
7
|
+
handleClose: () => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Логика highlight-шага: задержка popover, фокус-трап, закрытие.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useLogic: (activeStep: ActiveStepState, isClosing: boolean, geometry: OverlayGeometry) => UseLogicResult;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { useTheme } from '../../../../../../theme/hooks/useTheme';
|
|
3
|
+
import { useFocusTrap } from '../../../../hooks/useFocusTrap';
|
|
4
|
+
/**
|
|
5
|
+
* Логика highlight-шага: задержка popover, фокус-трап, закрытие.
|
|
6
|
+
*/
|
|
7
|
+
export const useLogic = (activeStep, isClosing, geometry) => {
|
|
8
|
+
const { isInteractive, isConfirming } = activeStep;
|
|
9
|
+
const { anchorEl, element, isTransitioning } = geometry;
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const isOpen = !isClosing;
|
|
12
|
+
// Задержка до появления popover после готовности hole.
|
|
13
|
+
const isHoleReady = anchorEl !== null;
|
|
14
|
+
const [isEntered, setIsEntered] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (isEntered || !isHoleReady) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const timer = setTimeout(() => setIsEntered(true), theme.transitions.duration.shortest);
|
|
20
|
+
return () => clearTimeout(timer);
|
|
21
|
+
}, [isEntered, isHoleReady]);
|
|
22
|
+
const [popoverNode, setPopoverNode] = useState(null);
|
|
23
|
+
const trapNodes = useMemo(() => [popoverNode, isInteractive ? element : null], [popoverNode, isInteractive, element]);
|
|
24
|
+
// Трап выключен при закрытии/подтверждении.
|
|
25
|
+
useFocusTrap(trapNodes, isOpen && !isConfirming);
|
|
26
|
+
const handleClose = useCallback(() => {
|
|
27
|
+
activeStep.requestClose();
|
|
28
|
+
}, [activeStep]);
|
|
29
|
+
// При переходе popover размонтируется; при закрытии — grow-out.
|
|
30
|
+
const shouldShowPopover = !isConfirming && !isTransitioning && isEntered;
|
|
31
|
+
return {
|
|
32
|
+
isOpen,
|
|
33
|
+
shouldShowPopover,
|
|
34
|
+
setPopoverNode,
|
|
35
|
+
handleClose,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DialogContent } from '../../../../../DialogContent';
|
|
3
|
+
import { StepFooter } from '../StepFooter';
|
|
4
|
+
import { Footer, StepDialog } from './styles';
|
|
5
|
+
/**
|
|
6
|
+
* Standalone шаг-модалка.
|
|
7
|
+
*/
|
|
8
|
+
export const StandaloneStep = ({ activeStep, isClosing, }) => {
|
|
9
|
+
const { step, isConfirming, requestClose } = activeStep;
|
|
10
|
+
return (_jsxs(StepDialog, { open: !isConfirming && !isClosing, title: step.title, onClose: requestClose, size: step.dialogSize, disableAutoFocus: true, children: [_jsx(DialogContent, { children: step.content }), _jsx(Footer, { children: _jsx(StepFooter, { activeStep: activeStep }) })] }));
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StandaloneStep } from './StandaloneStep';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StepDialog: import("../../../../../styled").StyledComponent<import("../../../../..").WithoutEmotionSpecific<Omit<import("@mui/material").DialogProps, "title" | "maxWidth">> & {
|
|
3
|
+
title?: string | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[] | undefined;
|
|
4
|
+
disableBackdropClick?: boolean | undefined;
|
|
5
|
+
size?: import("../../../../../Dialog").DialogSize | undefined;
|
|
6
|
+
headerContent?: import("react").ReactNode;
|
|
7
|
+
} & {
|
|
8
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
9
|
+
}, {}, {}>;
|
|
10
|
+
export declare const Footer: import("../../../../../styled").StyledComponent<{
|
|
11
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
12
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
13
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dialog } from '../../../../../Dialog';
|
|
2
|
+
import { styled } from '../../../../../styled';
|
|
3
|
+
import { onboardingModalSurface } from '../../../styles';
|
|
4
|
+
export const StepDialog = styled(Dialog) `
|
|
5
|
+
${({ theme }) => onboardingModalSurface(theme)};
|
|
6
|
+
`;
|
|
7
|
+
export const Footer = styled.div `
|
|
8
|
+
padding: ${({ theme }) => theme.spacing(0, 6, 6)};
|
|
9
|
+
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ActiveStepState } from '../../../../../types';
|
|
2
|
+
export type ProgressDotsProps = Pick<ActiveStepState, 'position' | 'total' | 'onSelectStep'>;
|
|
3
|
+
/**
|
|
4
|
+
* Индикатор прогресса точками
|
|
5
|
+
*/
|
|
6
|
+
export declare const ProgressDots: ({ position, total, onSelectStep, }: ProgressDotsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from '../../../../../../utils/cva';
|
|
3
|
+
import { progressDotClassnames } from './constants';
|
|
4
|
+
import { Dot, Dots } from './styles';
|
|
5
|
+
const dotCva = cva(progressDotClassnames.root, {
|
|
6
|
+
variants: {
|
|
7
|
+
isActive: {
|
|
8
|
+
true: progressDotClassnames.active,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Индикатор прогресса точками
|
|
14
|
+
*/
|
|
15
|
+
export const ProgressDots = ({ position, total, onSelectStep, }) => (_jsx(Dots, { children: Array.from({ length: total }, (_, index) => (_jsx(Dot, { type: "button", className: dotCva({ isActive: index === position }), "aria-label": `Перейти к шагу ${index + 1}`, "aria-current": index === position, onClick: () => onSelectStep(index) }, index))) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressDots } from './ProgressDots';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Dots: import("../../../../../../styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const Dot: import("../../../../../../styled").StyledComponent<{
|
|
7
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
8
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
9
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { styled } from '../../../../../../styled';
|
|
2
|
+
import { progressDotClassnames } from './constants';
|
|
3
|
+
export const Dots = styled.div `
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: ${({ theme }) => theme.spacing(1)};
|
|
6
|
+
align-items: center;
|
|
7
|
+
`;
|
|
8
|
+
export const Dot = styled.button `
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
|
|
11
|
+
width: 8px;
|
|
12
|
+
height: 8px;
|
|
13
|
+
padding: 0;
|
|
14
|
+
|
|
15
|
+
background-color: ${({ theme }) => theme.palette.grey[200]};
|
|
16
|
+
border: none;
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
|
|
19
|
+
transition: background-color 0.2s;
|
|
20
|
+
|
|
21
|
+
&.${progressDotClassnames.active} {
|
|
22
|
+
background-color: ${({ theme }) => theme.palette.grey[600]};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Круглый фокус вместо браузерной рамки. */
|
|
26
|
+
&:focus {
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:focus-visible {
|
|
31
|
+
outline: 2px solid ${({ theme }) => theme.palette.components.focused};
|
|
32
|
+
outline-offset: 2px;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ActiveStepState } from '../../../../types';
|
|
2
|
+
export type StepFooterProps = {
|
|
3
|
+
activeStep: ActiveStepState;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Футер шага: индикатор прогресса и кнопки навигации.
|
|
7
|
+
* Общий для standalone и highlight.
|
|
8
|
+
*/
|
|
9
|
+
export declare const StepFooter: ({ activeStep }: StepFooterProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '../../../../../Button';
|
|
3
|
+
import { Typography } from '../../../../../Typography';
|
|
4
|
+
import { ProgressDots } from './ProgressDots';
|
|
5
|
+
import { CenterSlot, LeftSlot, NavigationRow, RightSlot, Root } from './styles';
|
|
6
|
+
import { useLogic } from './useLogic';
|
|
7
|
+
/**
|
|
8
|
+
* Футер шага: индикатор прогресса и кнопки навигации.
|
|
9
|
+
* Общий для standalone и highlight.
|
|
10
|
+
*/
|
|
11
|
+
export const StepFooter = ({ activeStep }) => {
|
|
12
|
+
const { isPrevVisible, isNextVisible, isDotsVisible, isCounterVisible, position, total, prevButtonText, nextButtonText, nextButtonVariant, onNext, onPrev, onSelectStep, } = useLogic(activeStep);
|
|
13
|
+
// Нечего показывать — не отрисовываем пустой футер
|
|
14
|
+
if (!isPrevVisible && !isNextVisible && !isDotsVisible && !isCounterVisible) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return (_jsx(Root, { children: _jsxs(NavigationRow, { children: [_jsx(LeftSlot, { children: isPrevVisible && (_jsx(Button, { variant: "text", onClick: onPrev, children: prevButtonText })) }), _jsxs(CenterSlot, { children: [isDotsVisible && (_jsx(ProgressDots, { position: position, total: total, onSelectStep: onSelectStep })), isCounterVisible && (_jsxs(Typography, { variant: "caption", color: "grey", colorIntensity: "600", children: [position + 1, " / ", total] }))] }), _jsx(RightSlot, { children: isNextVisible && (_jsx(Button, { "data-focus": "next", variant: nextButtonVariant, onClick: onNext, children: nextButtonText }, nextButtonVariant)) })] }) }));
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StepFooter } from './StepFooter';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Root: import("../../../../../styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
+
export declare const NavigationRow: import("../../../../../styled").StyledComponent<{
|
|
7
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
8
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
9
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
|
+
export declare const LeftSlot: import("../../../../../styled").StyledComponent<{
|
|
11
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
12
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
13
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
|
+
export declare const CenterSlot: import("../../../../../styled").StyledComponent<{
|
|
15
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
16
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
17
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
18
|
+
export declare const RightSlot: import("../../../../../styled").StyledComponent<{
|
|
19
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
20
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
21
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { styled } from '../../../../../styled';
|
|
2
|
+
export const Root = styled.div `
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: ${({ theme }) => theme.spacing(2)};
|
|
6
|
+
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding:0;
|
|
9
|
+
`;
|
|
10
|
+
export const NavigationRow = styled.div `
|
|
11
|
+
display: grid;
|
|
12
|
+
grid-template-columns: 1fr auto 1fr;
|
|
13
|
+
align-items: center;
|
|
14
|
+
`;
|
|
15
|
+
export const LeftSlot = styled.div `
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: flex-start;
|
|
18
|
+
`;
|
|
19
|
+
export const CenterSlot = styled.div `
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: ${({ theme }) => theme.spacing(1)};
|
|
23
|
+
align-items: center;
|
|
24
|
+
`;
|
|
25
|
+
export const RightSlot = styled.div `
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: flex-end;
|
|
28
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLogic } from './useLogic';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLogic } from './useLogic';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ActiveStepState } from '../../../../../types';
|
|
2
|
+
export type UseLogicResult = {
|
|
3
|
+
isPrevVisible: boolean;
|
|
4
|
+
isNextVisible: boolean;
|
|
5
|
+
isDotsVisible: boolean;
|
|
6
|
+
isCounterVisible: boolean;
|
|
7
|
+
position: number;
|
|
8
|
+
total: number;
|
|
9
|
+
prevButtonText: string;
|
|
10
|
+
nextButtonText: string;
|
|
11
|
+
nextButtonVariant: 'text' | 'contained';
|
|
12
|
+
onNext: () => void;
|
|
13
|
+
onPrev: () => void;
|
|
14
|
+
onSelectStep: (position: number) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const useLogic: (activeStep: ActiveStepState) => UseLogicResult;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MAX_PROGRESS_DOTS } from '../constants';
|
|
2
|
+
export const useLogic = (activeStep) => {
|
|
3
|
+
const { step, position, total, hasNext, hasPrev, isDotsVisible, isCounterVisible, buttons, onNext, onPrev, onSelectStep, } = activeStep;
|
|
4
|
+
// Прогресс имеет смысл только при total > 1.
|
|
5
|
+
const hasProgress = total > 1;
|
|
6
|
+
// Последний шаг: кнопка «вперёд» превращается в завершающую.
|
|
7
|
+
const isFinishStep = !hasNext;
|
|
8
|
+
return {
|
|
9
|
+
isPrevVisible: step.isPrevButtonVisible && hasPrev,
|
|
10
|
+
isNextVisible: step.isNextButtonVisible,
|
|
11
|
+
isDotsVisible: isDotsVisible && hasProgress && total <= MAX_PROGRESS_DOTS,
|
|
12
|
+
isCounterVisible: isCounterVisible && hasProgress,
|
|
13
|
+
position,
|
|
14
|
+
total,
|
|
15
|
+
prevButtonText: buttons.prevLabel,
|
|
16
|
+
nextButtonText: isFinishStep ? buttons.finishLabel : buttons.nextLabel,
|
|
17
|
+
nextButtonVariant: isFinishStep ? buttons.finishVariant : 'contained',
|
|
18
|
+
onNext,
|
|
19
|
+
onPrev,
|
|
20
|
+
onSelectStep,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ActiveStepState } from '../../../types';
|
|
2
|
+
import { type OverlayGeometry } from '../useLogic';
|
|
3
|
+
/**
|
|
4
|
+
* Контракт step-view, передаётся стратегией по типу шага.
|
|
5
|
+
*/
|
|
6
|
+
export type StepViewProps = {
|
|
7
|
+
activeStep: ActiveStepState;
|
|
8
|
+
/**
|
|
9
|
+
* Тур в процессе закрытия
|
|
10
|
+
*/
|
|
11
|
+
isClosing: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Геометрия подсветки (единый источник для overlay и popover).
|
|
14
|
+
*/
|
|
15
|
+
geometry: OverlayGeometry;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLogic, type OverlayGeometry } from './useLogic';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useLogic } from './useLogic';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ActiveStepState } from '../../../types';
|
|
2
|
+
import { type VirtualAnchor } from '../../../utils/createVirtualAnchor';
|
|
3
|
+
import { type Rect } from '../../../utils/geometry';
|
|
4
|
+
/**
|
|
5
|
+
* Геометрия подсветки, общая для overlay и popover.
|
|
6
|
+
*/
|
|
7
|
+
export type OverlayGeometry = {
|
|
8
|
+
/**
|
|
9
|
+
* Область hole (null для standalone или пока элемент не найден).
|
|
10
|
+
*/
|
|
11
|
+
hole: Rect | null;
|
|
12
|
+
/**
|
|
13
|
+
* Якорь popover (null пока нет hole).
|
|
14
|
+
*/
|
|
15
|
+
anchorEl: VirtualAnchor | null;
|
|
16
|
+
/**
|
|
17
|
+
* Подсвечиваемый элемент (null для standalone или пока не найден).
|
|
18
|
+
*/
|
|
19
|
+
element: HTMLElement | null;
|
|
20
|
+
/**
|
|
21
|
+
* Hole движется между элементами.
|
|
22
|
+
*/
|
|
23
|
+
isTransitioning: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type UseLogicResult = {
|
|
26
|
+
geometry: OverlayGeometry;
|
|
27
|
+
/**
|
|
28
|
+
* Показывать ли overlay.
|
|
29
|
+
*/
|
|
30
|
+
shouldShowOverlay: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Overlay виден.
|
|
33
|
+
*/
|
|
34
|
+
isVisible: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Hole анимируется.
|
|
37
|
+
*/
|
|
38
|
+
isHoleMoving: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Клик по overlay — запрос выхода.
|
|
41
|
+
*/
|
|
42
|
+
onOverlayClose: () => void;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Логика стратегии: держит единый overlay на весь тур.
|
|
46
|
+
*/
|
|
47
|
+
export declare const useLogic: (activeStep: ActiveStepState, isClosing: boolean) => UseLogicResult;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useCallback, useMemo, useRef } from 'react';
|
|
2
|
+
import { useTheme } from '../../../../theme/hooks/useTheme';
|
|
3
|
+
import { createVirtualAnchor, } from '../../../utils/createVirtualAnchor';
|
|
4
|
+
import { inflateRect, parseOffset } from '../../../utils/geometry';
|
|
5
|
+
import { useStepTransition } from '../../hooks/useStepTransition';
|
|
6
|
+
import { useTargetAnchor } from '../../hooks/useTargetAnchor';
|
|
7
|
+
/**
|
|
8
|
+
* Логика стратегии: держит единый overlay на весь тур.
|
|
9
|
+
*/
|
|
10
|
+
export const useLogic = (activeStep, isClosing) => {
|
|
11
|
+
const { step, onError } = activeStep;
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
const isHighlight = step.type === 'highlight';
|
|
14
|
+
const { element, rect } = useTargetAnchor(step.name, {
|
|
15
|
+
onError,
|
|
16
|
+
// Трекинг только для highlight-шага.
|
|
17
|
+
shouldTrack: isHighlight,
|
|
18
|
+
scrollOnEnter: true,
|
|
19
|
+
timeout: step.waitForTimeout,
|
|
20
|
+
});
|
|
21
|
+
const padding = parseOffset(step.highlightOffset);
|
|
22
|
+
const hole = useMemo(() => (rect ? inflateRect(rect, padding) : null), [rect, padding]);
|
|
23
|
+
const anchorEl = useMemo(() => (hole ? createVirtualAnchor(hole) : null), [hole]);
|
|
24
|
+
const { isPopoverHidden, isHoleMoving } = useStepTransition(step.name, {
|
|
25
|
+
// Popover скрыт пока hole движется.
|
|
26
|
+
popoverHiddenMs: theme.transitions.duration.short,
|
|
27
|
+
holeMovingMs: theme.transitions.duration.short,
|
|
28
|
+
hasHole: isHighlight,
|
|
29
|
+
});
|
|
30
|
+
const onOverlayClose = useCallback(() => {
|
|
31
|
+
activeStep.requestClose();
|
|
32
|
+
}, [activeStep]);
|
|
33
|
+
// Overlay залипает на весь тур после первого показа (без моргания).
|
|
34
|
+
const wantsOverlay = hole !== null || !isHighlight;
|
|
35
|
+
const hasShownOverlayRef = useRef(false);
|
|
36
|
+
if (wantsOverlay) {
|
|
37
|
+
hasShownOverlayRef.current = true;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
geometry: {
|
|
41
|
+
hole,
|
|
42
|
+
anchorEl,
|
|
43
|
+
element,
|
|
44
|
+
isTransitioning: isPopoverHidden,
|
|
45
|
+
},
|
|
46
|
+
shouldShowOverlay: hasShownOverlayRef.current,
|
|
47
|
+
isVisible: !isClosing,
|
|
48
|
+
isHoleMoving,
|
|
49
|
+
onOverlayClose,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useActiveStep } from './useActiveStep';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useActiveStep } from './useActiveStep';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ActiveStepStore } from '../../../core/ActiveStepStore';
|
|
2
|
+
import { type ActiveStepState } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Подписка на активный шаг из store экземпляра.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useActiveStep: (store: ActiveStepStore) => ActiveStepState | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// TODO После ухода с React 17 — заменить импорт на `react` и убрать use-sync-external-store.
|
|
2
|
+
// https://track.astral.ru/soft/browse/UIKIT-3285
|
|
3
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
4
|
+
/**
|
|
5
|
+
* Подписка на активный шаг из store экземпляра.
|
|
6
|
+
*/
|
|
7
|
+
export const useActiveStep = (store) => useSyncExternalStore(store.subscribe, store.getActiveStep, store.getActiveStep);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDelayedActiveStep';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDelayedActiveStep';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ActiveStepState } from '../../../types';
|
|
2
|
+
export type DelayedActiveStep = {
|
|
3
|
+
/**
|
|
4
|
+
* Шаг, удержанный на экране на время закрытия.
|
|
5
|
+
*/
|
|
6
|
+
active: ActiveStepState | null;
|
|
7
|
+
/**
|
|
8
|
+
* Анимация закрытия в процессе.
|
|
9
|
+
*/
|
|
10
|
+
isClosing: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Откладывает обнуление шага на время закрытия анимаций.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useDelayedActiveStep: (active: ActiveStepState | null, exitDurationMs: number) => DelayedActiveStep;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Откладывает обнуление шага на время закрытия анимаций.
|
|
4
|
+
*/
|
|
5
|
+
export const useDelayedActiveStep = (active, exitDurationMs) => {
|
|
6
|
+
const [displayedStep, setDisplayedStep] = useState(active);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (active) {
|
|
9
|
+
setDisplayedStep(active);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const timer = setTimeout(() => setDisplayedStep(null), exitDurationMs);
|
|
13
|
+
return () => clearTimeout(timer);
|
|
14
|
+
}, [active, exitDurationMs]);
|
|
15
|
+
return {
|
|
16
|
+
active: displayedStep,
|
|
17
|
+
isClosing: displayedStep !== null && active === null,
|
|
18
|
+
};
|
|
19
|
+
};
|