@astral/ui 4.82.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/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/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFocusTrap } from './useFocusTrap';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFocusTrap } from './useFocusTrap';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createFocusTrap } from 'focus-trap';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Мульти-контейнерный фокус-трап для highlight-шага.
|
|
5
|
+
* @param nodes контейнеры
|
|
6
|
+
* @param isActive включение трапа
|
|
7
|
+
*/
|
|
8
|
+
export const useFocusTrap = (nodes, isActive = true) => {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const containers = nodes.filter((node) => node !== null);
|
|
11
|
+
if (!isActive || containers.length === 0) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const trap = createFocusTrap(containers, {
|
|
15
|
+
escapeDeactivates: false,
|
|
16
|
+
clickOutsideDeactivates: false,
|
|
17
|
+
allowOutsideClick: true,
|
|
18
|
+
returnFocusOnDeactivate: false,
|
|
19
|
+
fallbackFocus: containers[0],
|
|
20
|
+
initialFocus: () => containers[0],
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
trap.activate();
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Нет фокусируемых узлов.
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
return () => {
|
|
30
|
+
trap.deactivate();
|
|
31
|
+
};
|
|
32
|
+
}, [nodes, isActive]);
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useKeyboardNav } from './useKeyboardNav';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useKeyboardNav } from './useKeyboardNav';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ActiveStepState } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Клавиатурная навигация по туру.
|
|
4
|
+
*
|
|
5
|
+
* → / ← — next/prev, Esc — единая точка выхода `requestClose()`.
|
|
6
|
+
* Слушатель вешается только при активном туре и снимается при закрытии.
|
|
7
|
+
*
|
|
8
|
+
* Слушаем в capture-фазе на window, чтобы перехватить стрелки/Esc раньше
|
|
9
|
+
* вложенных обработчиков и не зависеть от фокуса.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useKeyboardNav: (activeStep: ActiveStepState | null) => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
const isEditableTarget = (target) => {
|
|
3
|
+
if (!(target instanceof HTMLElement)) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
const tag = target.tagName;
|
|
7
|
+
return (tag === 'INPUT' ||
|
|
8
|
+
tag === 'TEXTAREA' ||
|
|
9
|
+
tag === 'SELECT' ||
|
|
10
|
+
target.isContentEditable);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Стрелки игнорируются при фокусе в поле ввода (чтобы свободно двигать каретку) и при
|
|
14
|
+
* скрытой кнопке навигации.
|
|
15
|
+
*/
|
|
16
|
+
const goNext = (activeStep, event) => {
|
|
17
|
+
if (isEditableTarget(event.target) || !activeStep.step.isNextButtonVisible) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
activeStep.onNext();
|
|
22
|
+
};
|
|
23
|
+
const goPrev = (activeStep, event) => {
|
|
24
|
+
if (isEditableTarget(event.target) || !activeStep.step.isPrevButtonVisible) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
activeStep.onPrev();
|
|
29
|
+
};
|
|
30
|
+
const requestExit = (activeStep, event) => {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
activeStep.requestClose();
|
|
33
|
+
};
|
|
34
|
+
const KEY_HANDLERS = {
|
|
35
|
+
ArrowRight: goNext,
|
|
36
|
+
ArrowLeft: goPrev,
|
|
37
|
+
Escape: requestExit,
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Клавиатурная навигация по туру.
|
|
41
|
+
*
|
|
42
|
+
* → / ← — next/prev, Esc — единая точка выхода `requestClose()`.
|
|
43
|
+
* Слушатель вешается только при активном туре и снимается при закрытии.
|
|
44
|
+
*
|
|
45
|
+
* Слушаем в capture-фазе на window, чтобы перехватить стрелки/Esc раньше
|
|
46
|
+
* вложенных обработчиков и не зависеть от фокуса.
|
|
47
|
+
*/
|
|
48
|
+
export const useKeyboardNav = (activeStep) => {
|
|
49
|
+
const isActive = Boolean(activeStep) && !activeStep?.isConfirming;
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!activeStep || !isActive) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const handleKeyDown = (event) => {
|
|
55
|
+
KEY_HANDLERS[event.key]?.(activeStep, event);
|
|
56
|
+
};
|
|
57
|
+
window.addEventListener('keydown', handleKeyDown, true);
|
|
58
|
+
return () => {
|
|
59
|
+
window.removeEventListener('keydown', handleKeyDown, true);
|
|
60
|
+
};
|
|
61
|
+
}, [activeStep, isActive]);
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStepTransition } from './useStepTransition';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStepTransition } from './useStepTransition';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type StepTransitionDurations = {
|
|
2
|
+
/**
|
|
3
|
+
* Время скрытия popover при смене шага (не меньше `holeMovingMs`).
|
|
4
|
+
*/
|
|
5
|
+
popoverHiddenMs: number;
|
|
6
|
+
/**
|
|
7
|
+
* Время движения hole к новому элементу.
|
|
8
|
+
*/
|
|
9
|
+
holeMovingMs: number;
|
|
10
|
+
/**
|
|
11
|
+
* Есть ли hole в текущем шаге (highlight). Скрытие popover нужно только для
|
|
12
|
+
* переезда hole (highlight → highlight).
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
hasHole?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type StepTransitionPhase = {
|
|
18
|
+
/**
|
|
19
|
+
* Popover скрыт, пока hole движется.
|
|
20
|
+
*/
|
|
21
|
+
isPopoverHidden: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Идёт анимированный переезд hole.
|
|
24
|
+
*/
|
|
25
|
+
isHoleMoving: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Координирует скрытие popover и движение hole при переходе между highlight-шагами.
|
|
29
|
+
*/
|
|
30
|
+
export declare const useStepTransition: (stepKey: string, { popoverHiddenMs, holeMovingMs, hasHole }: StepTransitionDurations) => StepTransitionPhase;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
const IDLE_PHASE = {
|
|
3
|
+
isPopoverHidden: false,
|
|
4
|
+
isHoleMoving: false,
|
|
5
|
+
};
|
|
6
|
+
const HIDDEN_PHASE = {
|
|
7
|
+
isPopoverHidden: true,
|
|
8
|
+
isHoleMoving: true,
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Координирует скрытие popover и движение hole при переходе между highlight-шагами.
|
|
12
|
+
*/
|
|
13
|
+
export const useStepTransition = (stepKey, { popoverHiddenMs, holeMovingMs, hasHole = true }) => {
|
|
14
|
+
const [phase, setPhase] = useState(IDLE_PHASE);
|
|
15
|
+
const prevKey = useRef(stepKey);
|
|
16
|
+
const prevHadHole = useRef(hasHole);
|
|
17
|
+
// Триггер для эффекта: `prevKey` мутируется во время render, поэтому в эффекте не сравнить.
|
|
18
|
+
const [transitionId, setTransitionId] = useState(0);
|
|
19
|
+
// Скрываем popover синхронно во время render, иначе виден «прыжок» позиции.
|
|
20
|
+
if (prevKey.current !== stepKey) {
|
|
21
|
+
// Прячем popover только для переезда hole (highlight → highlight).
|
|
22
|
+
const isHoleTravel = prevHadHole.current && hasHole;
|
|
23
|
+
prevKey.current = stepKey;
|
|
24
|
+
prevHadHole.current = hasHole;
|
|
25
|
+
if (isHoleTravel) {
|
|
26
|
+
setPhase(HIDDEN_PHASE);
|
|
27
|
+
setTransitionId((id) => id + 1);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
setPhase(IDLE_PHASE);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
// Первый render (mount) — переход не запускаем.
|
|
35
|
+
if (transitionId === 0) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const popoverTimer = setTimeout(() => setPhase((prev) => ({ ...prev, isPopoverHidden: false })), popoverHiddenMs);
|
|
39
|
+
const holeTimer = setTimeout(() => setPhase((prev) => ({ ...prev, isHoleMoving: false })), holeMovingMs);
|
|
40
|
+
return () => {
|
|
41
|
+
clearTimeout(popoverTimer);
|
|
42
|
+
clearTimeout(holeTimer);
|
|
43
|
+
};
|
|
44
|
+
}, [transitionId, popoverHiddenMs, holeMovingMs]);
|
|
45
|
+
return phase;
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useTargetAnchor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useTargetAnchor';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Rect } from '../../../utils/geometry';
|
|
2
|
+
type UseTargetAnchorOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Обратный вызов при ошибке (элемент не найден за timeout).
|
|
5
|
+
*/
|
|
6
|
+
onError: (error: Error) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Отслеживать ли элемент.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
shouldTrack?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Прокрутить к элементу при его появлении.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
scrollOnEnter?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Тайм-аут ожидания появления элемента (мс).
|
|
19
|
+
* @default DEFAULT_WAIT_ELEMENT_TIMEOUT_MS
|
|
20
|
+
*/
|
|
21
|
+
timeout?: number;
|
|
22
|
+
};
|
|
23
|
+
type UseTargetAnchorResult = {
|
|
24
|
+
/**
|
|
25
|
+
* Найденный элемент.
|
|
26
|
+
*/
|
|
27
|
+
element: HTMLElement | null;
|
|
28
|
+
/**
|
|
29
|
+
* Область элемента (синхронизируется при scroll/resize).
|
|
30
|
+
*/
|
|
31
|
+
rect: Rect | null;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Находит элемент по `data-tour-id` и синхронизирует его область.
|
|
35
|
+
*/
|
|
36
|
+
export declare const useTargetAnchor: (targetName: string, { onError, shouldTrack, scrollOnEnter, timeout, }: UseTargetAnchorOptions) => UseTargetAnchorResult;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { getTargetElement } from '../../../utils/getTargetElement';
|
|
3
|
+
import { observeRemoval } from '../../../utils/observeRemoval';
|
|
4
|
+
import { scrollIntoView } from '../../../utils/scrollIntoView';
|
|
5
|
+
import { waitForElement } from '../../../utils/waitForElement';
|
|
6
|
+
import { useTrackedRect } from '../useTrackedRect';
|
|
7
|
+
/**
|
|
8
|
+
* Находит элемент по `data-tour-id` и синхронизирует его область.
|
|
9
|
+
*/
|
|
10
|
+
export const useTargetAnchor = (targetName, { onError, shouldTrack = true, scrollOnEnter = false, timeout, }) => {
|
|
11
|
+
const [element, setElement] = useState(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!shouldTrack) {
|
|
14
|
+
// Очищаем элемент, чтобы useTrackedRect не отслеживал его.
|
|
15
|
+
setElement(null);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let isCancelled = false;
|
|
19
|
+
let stopRemovalWatch;
|
|
20
|
+
const track = () => {
|
|
21
|
+
// Устанавливаем найденный элемент сразу, без задержки.
|
|
22
|
+
setElement(getTargetElement(targetName));
|
|
23
|
+
waitForElement(targetName, { timeout })
|
|
24
|
+
.then(async (target) => {
|
|
25
|
+
if (isCancelled) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (scrollOnEnter) {
|
|
29
|
+
await scrollIntoView(target);
|
|
30
|
+
}
|
|
31
|
+
if (isCancelled) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setElement(target);
|
|
35
|
+
stopRemovalWatch = observeRemoval(target, () => {
|
|
36
|
+
if (!isCancelled) {
|
|
37
|
+
setElement(null);
|
|
38
|
+
track();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
})
|
|
42
|
+
.catch((error) => {
|
|
43
|
+
if (!isCancelled) {
|
|
44
|
+
onError(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
track();
|
|
49
|
+
return () => {
|
|
50
|
+
isCancelled = true;
|
|
51
|
+
stopRemovalWatch?.();
|
|
52
|
+
};
|
|
53
|
+
}, [targetName, onError, shouldTrack, scrollOnEnter, timeout]);
|
|
54
|
+
const rect = useTrackedRect(element);
|
|
55
|
+
return { element, rect };
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTrackedRect } from './useTrackedRect';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTrackedRect } from './useTrackedRect';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { clampToScrollParents, getViewport, isSameRect, rectFromDomRect, } from '../../../utils/geometry';
|
|
3
|
+
import { getScrollParents } from '../../../utils/getScrollParents';
|
|
4
|
+
/**
|
|
5
|
+
* Отслеживает область элемента для hole overlay и якоря popover.
|
|
6
|
+
*/
|
|
7
|
+
export const useTrackedRect = (element) => {
|
|
8
|
+
const [rect, setRect] = useState(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!element) {
|
|
11
|
+
setRect(null);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// ID текущей рAF-очереди обновления.
|
|
15
|
+
let frame = 0;
|
|
16
|
+
const scrollParents = getScrollParents(element);
|
|
17
|
+
const update = () => {
|
|
18
|
+
const elementRect = rectFromDomRect(element.getBoundingClientRect());
|
|
19
|
+
const viewport = getViewport();
|
|
20
|
+
const next = clampToScrollParents(elementRect, scrollParents.map((parent) => rectFromDomRect(parent.getBoundingClientRect())), viewport);
|
|
21
|
+
setRect((prev) => (isSameRect(prev, next) ? prev : next));
|
|
22
|
+
};
|
|
23
|
+
const scheduleUpdate = () => {
|
|
24
|
+
cancelAnimationFrame(frame);
|
|
25
|
+
frame = requestAnimationFrame(update);
|
|
26
|
+
};
|
|
27
|
+
update();
|
|
28
|
+
const scrollOptions = { passive: true };
|
|
29
|
+
scrollParents.forEach((parent) => parent.addEventListener('scroll', scheduleUpdate, scrollOptions));
|
|
30
|
+
window.addEventListener('scroll', scheduleUpdate, scrollOptions);
|
|
31
|
+
window.addEventListener('resize', scheduleUpdate);
|
|
32
|
+
const resizeObserver = new ResizeObserver(scheduleUpdate);
|
|
33
|
+
resizeObserver.observe(element);
|
|
34
|
+
return () => {
|
|
35
|
+
cancelAnimationFrame(frame);
|
|
36
|
+
resizeObserver.disconnect();
|
|
37
|
+
scrollParents.forEach((parent) => parent.removeEventListener('scroll', scheduleUpdate, scrollOptions));
|
|
38
|
+
window.removeEventListener('scroll', scheduleUpdate, scrollOptions);
|
|
39
|
+
window.removeEventListener('resize', scheduleUpdate);
|
|
40
|
+
};
|
|
41
|
+
}, [element]);
|
|
42
|
+
return rect;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useViewportSize } from './useViewportSize';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useViewportSize } from './useViewportSize';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { getViewport } from '../../../utils/geometry';
|
|
3
|
+
/**
|
|
4
|
+
* Синхронизирует размеры viewport без полос прокрутки окна.
|
|
5
|
+
*/
|
|
6
|
+
export const useViewportSize = () => {
|
|
7
|
+
const [viewport, setViewport] = useState(getViewport);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const handleResize = () => setViewport(getViewport());
|
|
10
|
+
window.addEventListener('resize', handleResize);
|
|
11
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
12
|
+
}, []);
|
|
13
|
+
return viewport;
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { backdropClasses } from '@mui/material/Backdrop';
|
|
2
|
+
import { css } from '../../styled';
|
|
3
|
+
import { ONBOARDING_Z_INDEX_OFFSET } from '../constants';
|
|
4
|
+
/**
|
|
5
|
+
* Каркас модальных поверхностей: прозрачный backdrop, приподнятый z-index.
|
|
6
|
+
*/
|
|
7
|
+
export const onboardingModalSurface = (theme) => css `
|
|
8
|
+
&& {
|
|
9
|
+
z-index: ${theme.zIndex.tooltip + ONBOARDING_Z_INDEX_OFFSET.base};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&& .${backdropClasses.root} {
|
|
13
|
+
background-color: transparent;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Rect } from '../geometry';
|
|
2
|
+
/**
|
|
3
|
+
* Виртуальный anchor для NewPopover — объект с `getBoundingClientRect`,
|
|
4
|
+
* который MUI Popper внутри NewPopover принимает вместо реального узла.
|
|
5
|
+
*/
|
|
6
|
+
export type VirtualAnchor = {
|
|
7
|
+
getBoundingClientRect: () => DOMRect;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Превращает область hole в anchor для позиционирования popover.
|
|
11
|
+
*/
|
|
12
|
+
export declare const createVirtualAnchor: (hole: Rect) => VirtualAnchor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createVirtualAnchor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createVirtualAnchor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildOverlayPath } from './overlayPath';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildOverlayPath } from './overlayPath';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG-путь скруглённой области (по часовой стрелке).
|
|
3
|
+
*/
|
|
4
|
+
const roundedRectPath = (rect, radius) => {
|
|
5
|
+
const r = Math.max(0, Math.min(radius, rect.width / 2, rect.height / 2));
|
|
6
|
+
const { x, y, width, height } = rect;
|
|
7
|
+
return [
|
|
8
|
+
`M${x + r},${y}`,
|
|
9
|
+
`H${x + width - r}`,
|
|
10
|
+
`A${r},${r} 0 0 1 ${x + width},${y + r}`,
|
|
11
|
+
`V${y + height - r}`,
|
|
12
|
+
`A${r},${r} 0 0 1 ${x + width - r},${y + height}`,
|
|
13
|
+
`H${x + r}`,
|
|
14
|
+
`A${r},${r} 0 0 1 ${x},${y + height - r}`,
|
|
15
|
+
`V${y + r}`,
|
|
16
|
+
`A${r},${r} 0 0 1 ${x + r},${y}`,
|
|
17
|
+
'Z',
|
|
18
|
+
].join(' ');
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* SVG-путь overlay: viewport + hole-отверстие.
|
|
22
|
+
*/
|
|
23
|
+
export const buildOverlayPath = (viewport, hole, radius) => {
|
|
24
|
+
const outer = `M0,0 H${viewport.width} V${viewport.height} H0 Z`;
|
|
25
|
+
if (!hole) {
|
|
26
|
+
return outer;
|
|
27
|
+
}
|
|
28
|
+
return `${outer} ${roundedRectPath(hole, radius)}`;
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parseOffset } from './parseOffset';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parseOffset } from './parseOffset';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { clampToScrollParents, clampToViewport, inflateRect, isSameRect, rectFromDomRect, } from './rect';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Viewport } from '../viewport';
|
|
2
|
+
/**
|
|
3
|
+
* Область hole/элемента в координатах viewport.
|
|
4
|
+
*/
|
|
5
|
+
export type Rect = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Приводит нативный `DOMRect` к нашему `Rect` (только позиция и размеры).
|
|
13
|
+
*/
|
|
14
|
+
export declare const rectFromDomRect: (domRect: DOMRect) => Rect;
|
|
15
|
+
/**
|
|
16
|
+
* Равны ли области покомпонентно.
|
|
17
|
+
*/
|
|
18
|
+
export declare const isSameRect: (a: Rect | null, b: Rect) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Расширяет область на padding во все стороны.
|
|
21
|
+
*/
|
|
22
|
+
export declare const inflateRect: (rect: Rect, padding: number) => Rect;
|
|
23
|
+
/**
|
|
24
|
+
* Обрезает область hole по границам viewport.
|
|
25
|
+
*/
|
|
26
|
+
export declare const clampToViewport: (rect: Rect, viewport: Viewport) => Rect;
|
|
27
|
+
export declare const isViewportSizedRect: (rect: Rect, viewport: Viewport) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Обрезает область элемента видимой областью каждого scroll-предка.
|
|
30
|
+
* Если элемент лежит во вложенном scroll-контейнере и частично уехал за его
|
|
31
|
+
* границу — и hole overlay, и якорь popover считаются уже по видимой
|
|
32
|
+
* части, а не по полной области элемента.
|
|
33
|
+
*/
|
|
34
|
+
export declare const clampToScrollParents: (rect: Rect, scrollParents: readonly Rect[], viewport: Viewport) => Rect;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Приводит нативный `DOMRect` к нашему `Rect` (только позиция и размеры).
|
|
3
|
+
*/
|
|
4
|
+
export const rectFromDomRect = (domRect) => ({
|
|
5
|
+
x: domRect.left,
|
|
6
|
+
y: domRect.top,
|
|
7
|
+
width: domRect.width,
|
|
8
|
+
height: domRect.height,
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* Равны ли области покомпонентно.
|
|
12
|
+
*/
|
|
13
|
+
export const isSameRect = (a, b) => a !== null &&
|
|
14
|
+
a.x === b.x &&
|
|
15
|
+
a.y === b.y &&
|
|
16
|
+
a.width === b.width &&
|
|
17
|
+
a.height === b.height;
|
|
18
|
+
/**
|
|
19
|
+
* Расширяет область на padding во все стороны.
|
|
20
|
+
*/
|
|
21
|
+
export const inflateRect = (rect, padding) => ({
|
|
22
|
+
x: rect.x - padding,
|
|
23
|
+
y: rect.y - padding,
|
|
24
|
+
width: rect.width + padding * 2,
|
|
25
|
+
height: rect.height + padding * 2,
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Пересечение двух областей. Не пересекаются — ширина/высота 0.
|
|
29
|
+
*/
|
|
30
|
+
const intersectRect = (a, b) => {
|
|
31
|
+
const x = Math.max(a.x, b.x);
|
|
32
|
+
const y = Math.max(a.y, b.y);
|
|
33
|
+
const right = Math.min(a.x + a.width, b.x + b.width);
|
|
34
|
+
const bottom = Math.min(a.y + a.height, b.y + b.height);
|
|
35
|
+
return {
|
|
36
|
+
x,
|
|
37
|
+
y,
|
|
38
|
+
width: Math.max(0, right - x),
|
|
39
|
+
height: Math.max(0, bottom - y),
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Обрезает область hole по границам viewport.
|
|
44
|
+
*/
|
|
45
|
+
export const clampToViewport = (rect, viewport) => intersectRect(rect, {
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0,
|
|
48
|
+
width: viewport.width,
|
|
49
|
+
height: viewport.height,
|
|
50
|
+
});
|
|
51
|
+
export const isViewportSizedRect = (rect, viewport) => rect.width >= viewport.width - 1 && rect.height >= viewport.height - 1;
|
|
52
|
+
/**
|
|
53
|
+
* Обрезает область элемента видимой областью каждого scroll-предка.
|
|
54
|
+
* Если элемент лежит во вложенном scroll-контейнере и частично уехал за его
|
|
55
|
+
* границу — и hole overlay, и якорь popover считаются уже по видимой
|
|
56
|
+
* части, а не по полной области элемента.
|
|
57
|
+
*/
|
|
58
|
+
export const clampToScrollParents = (rect, scrollParents, viewport) => scrollParents
|
|
59
|
+
.filter((parent) => !isViewportSizedRect(parent, viewport))
|
|
60
|
+
.reduce(intersectRect, rect);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getViewport } from './viewport';
|