@onepercentio/one-ui 0.19.2 → 0.19.3
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/.babelrc +17 -0
- package/.prod.babelrc +22 -0
- package/dist/assets/styles/variables.scss +1 -0
- package/dist/components/AdaptiveButton/AdaptiveButton.js +24 -25
- package/dist/components/AdaptiveButton/index.js +12 -8
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js +95 -114
- package/dist/components/AdaptiveContainer/index.js +12 -8
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js +85 -65
- package/dist/components/AdaptiveDialog/index.js +12 -8
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +84 -76
- package/dist/components/AdaptiveSidebar/index.js +12 -8
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js +155 -160
- package/dist/components/AnchoredTooltip/index.js +12 -8
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js +172 -139
- package/dist/components/AnimatedEntrance/index.js +26 -10
- package/dist/components/AsyncWrapper/AsyncWrapper.js +33 -21
- package/dist/components/AsyncWrapper/index.js +12 -8
- package/dist/components/Avatar/Avatar.js +34 -40
- package/dist/components/Avatar/index.js +12 -8
- package/dist/components/BucketFill/BucketFill.js +47 -58
- package/dist/components/BucketFill/index.js +12 -8
- package/dist/components/Button/Button.js +32 -49
- package/dist/components/Button/README.md +8 -0
- package/dist/components/Button/index.js +12 -8
- package/dist/components/Card/Card.js +16 -11
- package/dist/components/Card/index.js +12 -8
- package/dist/components/Chart/Chart.logic.js +10 -10
- package/dist/components/Chart/Chart.types.js +4 -2
- package/dist/components/Chart/Chart.view.js +212 -131
- package/dist/components/Chart/index.js +12 -8
- package/dist/components/CheckBox/CheckBox.d.ts +3 -1
- package/dist/components/CheckBox/CheckBox.js +43 -30
- package/dist/components/CheckBox/CheckBox.module.scss +4 -0
- package/dist/components/CheckBox/index.js +12 -8
- package/dist/components/Collapsable/Collapsable.d.ts +26 -27
- package/dist/components/Collapsable/Collapsable.js +173 -143
- package/dist/components/Collapsable/index.js +12 -8
- package/dist/components/Countdown/Countdown.js +87 -100
- package/dist/components/Countdown/index.js +12 -8
- package/dist/components/Divider/Divider.js +15 -12
- package/dist/components/Divider/index.js +12 -8
- package/dist/components/EmailInput/EmailInput.d.ts +4 -3
- package/dist/components/EmailInput/EmailInput.js +45 -43
- package/dist/components/EmailInput/README.md +10 -0
- package/dist/components/EmailInput/index.js +20 -9
- package/dist/components/FadeIn/FadeIn.js +62 -69
- package/dist/components/FadeIn/index.js +12 -8
- package/dist/components/FileInput/FileInput.d.ts +25 -9
- package/dist/components/FileInput/FileInput.js +41 -70
- package/dist/components/FileInput/FileInput.module.scss +0 -21
- package/dist/components/FileInput/View/BigFactory/BigFactory.d.ts +6 -0
- package/dist/components/FileInput/View/BigFactory/BigFactory.js +46 -0
- package/dist/components/FileInput/View/BigFactory/BigFactory.module.scss +20 -0
- package/dist/components/FileInput/View/BigFactory/index.d.ts +1 -0
- package/dist/components/FileInput/View/BigFactory/index.js +13 -0
- package/dist/components/FileInput/View/Compact/Compact.d.ts +5 -0
- package/dist/components/FileInput/View/Compact/Compact.js +88 -0
- package/dist/components/FileInput/View/Compact/Compact.module.scss +59 -0
- package/dist/components/FileInput/View/Compact/index.d.ts +1 -0
- package/dist/components/FileInput/View/Compact/index.js +13 -0
- package/dist/components/FileInput/View/View.types.d.ts +8 -0
- package/dist/components/FileInput/View/View.types.js +5 -0
- package/dist/components/FileInput/index.js +12 -8
- package/dist/components/FlowController/FlowController.js +60 -29
- package/dist/components/FlowController/README.md +13 -0
- package/dist/components/FlowController/index.js +12 -8
- package/dist/components/Form/Form.js +157 -96
- package/dist/components/Form/index.js +12 -8
- package/dist/components/Freeze/Freeze.js +11 -10
- package/dist/components/Freeze/index.js +12 -8
- package/dist/components/HSForms/HSForms.js +48 -68
- package/dist/components/HSForms/index.js +12 -8
- package/dist/components/Header/Header.js +100 -69
- package/dist/components/Header/index.js +12 -8
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js +17 -13
- package/dist/components/HeaderCloseBtn/index.js +12 -8
- package/dist/components/InfinityScroll/InfinityScroll.js +137 -117
- package/dist/components/InfinityScroll/index.js +12 -8
- package/dist/components/Input/Input.d.ts +8 -6
- package/dist/components/Input/Input.js +105 -90
- package/dist/components/Input/Input.module.scss +4 -2
- package/dist/components/Input/README.md +10 -0
- package/dist/components/Input/index.js +12 -8
- package/dist/components/InstantCounter/InstantCounter.js +61 -52
- package/dist/components/InstantCounter/index.js +12 -8
- package/dist/components/LavaLamp/LavaLamp.data.js +95 -87
- package/dist/components/LavaLamp/LavaLamp.js +107 -70
- package/dist/components/LavaLamp/index.js +12 -8
- package/dist/components/LavaLamp/v2/LavaLamp.js +200 -182
- package/dist/components/LinkToId/LinkToId.js +42 -28
- package/dist/components/LinkToId/index.js +20 -9
- package/dist/components/Loader/Loader.js +20 -26
- package/dist/components/Loader/index.js +12 -8
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js +34 -37
- package/dist/components/LoaderDotsIndicator/index.js +12 -8
- package/dist/components/LoopableVideo/LoopableVideo.js +29 -30
- package/dist/components/LoopableVideo/index.js +12 -8
- package/dist/components/MainGrid/MainGrid.js +44 -50
- package/dist/components/MainGrid/index.js +12 -8
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +26 -26
- package/dist/components/MutableHamburgerButton/index.js +12 -8
- package/dist/components/Notification/Notification.js +16 -12
- package/dist/components/Notification/index.js +12 -8
- package/dist/components/OrderableList/OrderableList.js +406 -374
- package/dist/components/OrderableList/index.js +12 -8
- package/dist/components/PaginationIndicator/PaginationIndicator.js +230 -196
- package/dist/components/PaginationIndicator/index.js +12 -8
- package/dist/components/Parallax/Parallax.js +164 -161
- package/dist/components/Parallax/index.js +12 -8
- package/dist/components/Parallax/math/helpers.js +128 -217
- package/dist/components/PasswordInput/PasswordInput.d.ts +4 -3
- package/dist/components/PasswordInput/PasswordInput.js +120 -97
- package/dist/components/PasswordInput/index.js +12 -8
- package/dist/components/PixelatedScan/PixelatedScan.js +140 -97
- package/dist/components/PixelatedScan/index.js +12 -8
- package/dist/components/Portal/Portal.js +54 -64
- package/dist/components/Portal/index.js +20 -9
- package/dist/components/ProgressBar/ProgressBar.js +48 -45
- package/dist/components/ProgressBar/index.js +20 -9
- package/dist/components/ProgressTexts/ProgressTexts.js +42 -34
- package/dist/components/ProgressTexts/README.md +12 -0
- package/dist/components/ProgressTexts/index.js +12 -8
- package/dist/components/Radio/Radio.d.ts +13 -0
- package/dist/components/Radio/Radio.js +47 -0
- package/dist/components/Radio/Radio.module.scss +33 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/index.js +13 -0
- package/dist/components/SectionContainer/SectionContainer.js +35 -39
- package/dist/components/SectionContainer/index.js +12 -8
- package/dist/components/Select/Select.d.ts +2 -1
- package/dist/components/Select/Select.js +133 -82
- package/dist/components/Select/Select.module.scss +14 -2
- package/dist/components/Select/index.js +12 -8
- package/dist/components/Skeleton/Skeleton.js +21 -15
- package/dist/components/Skeleton/index.js +12 -8
- package/dist/components/Spacing/Spacing.js +14 -11
- package/dist/components/Spacing/index.js +12 -8
- package/dist/components/StaticScroller/StaticScroller.js +61 -81
- package/dist/components/StaticScroller/index.js +12 -8
- package/dist/components/Switch/Switch.js +29 -25
- package/dist/components/Switch/index.js +12 -8
- package/dist/components/Table/Table.js +111 -80
- package/dist/components/Table/index.js +12 -8
- package/dist/components/Tabs/Tabs.js +42 -52
- package/dist/components/Tabs/index.js +12 -8
- package/dist/components/Text/Text.js +31 -50
- package/dist/components/Text/index.js +12 -8
- package/dist/components/Transition/MasksFactory/DiagonalReveal.js +46 -22
- package/dist/components/Transition/MasksFactory/DiagonalSquareToBalls.js +71 -57
- package/dist/components/Transition/MasksFactory/PhysicsSquares.js +97 -80
- package/dist/components/Transition/MasksFactory/SquareToBalls.js +59 -50
- package/dist/components/Transition/MasksFactory/utils.js +25 -28
- package/dist/components/Transition/Transition.js +316 -309
- package/dist/components/Transition/index.js +20 -9
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js +110 -86
- package/dist/components/UncontrolledTransition/index.js +12 -8
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +116 -105
- package/dist/components/WalletConnectionWrapper/index.js +20 -9
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +51 -69
- package/dist/components/utilitary/ScrollAndFocusLock/index.js +12 -8
- package/dist/context/AsyncProcess.js +77 -63
- package/dist/context/CustomBrowserRouter.js +40 -52
- package/dist/context/OneUIProvider.d.ts +8 -2
- package/dist/context/OneUIProvider.js +90 -104
- package/dist/hooks/logs/README.md +3 -0
- package/dist/hooks/logs/useDependencyChangeDetection.js +17 -17
- package/dist/hooks/logs/useIsMounting.js +10 -8
- package/dist/hooks/persistence/useLocalStorage.js +40 -30
- package/dist/hooks/shims/ObjectWatchShim.d.ts +1 -0
- package/dist/hooks/shims/ObjectWatchShim.js +49 -46
- package/dist/hooks/ui/useAdaptiveImage.js +43 -35
- package/dist/hooks/ui/useBreakpoint.js +34 -19
- package/dist/hooks/ui/useCustomScrollbar.js +26 -21
- package/dist/hooks/ui/useMouseHover.js +29 -16
- package/dist/hooks/ui/usePaginationControls.d.ts +0 -4
- package/dist/hooks/ui/usePaginationControls.e2e.d.ts +4 -0
- package/dist/hooks/ui/usePaginationControls.js +125 -153
- package/dist/hooks/ui/useTilt.js +156 -128
- package/dist/hooks/ui/useZoomable.js +114 -138
- package/dist/hooks/useAsyncControl.js +82 -47
- package/dist/hooks/useContainedRepositioning.js +75 -72
- package/dist/hooks/useCustomHistory.js +21 -13
- package/dist/hooks/useElementFit.js +42 -34
- package/dist/hooks/useFirestoreWatch.js +54 -35
- package/dist/hooks/useForm.js +47 -22
- package/dist/hooks/useFreeze.js +11 -9
- package/dist/hooks/useHero.d.ts +4 -0
- package/dist/hooks/useHero.js +171 -159
- package/dist/hooks/useIntersection.js +33 -27
- package/dist/hooks/useMergeRefs.js +26 -23
- package/dist/hooks/useObserve.js +28 -15
- package/dist/hooks/usePagination.js +151 -129
- package/dist/hooks/usePooledOperation.js +43 -58
- package/dist/hooks/usePooling.js +62 -48
- package/dist/hooks/useRebound.js +36 -22
- package/dist/hooks/useShortIntl.js +79 -51
- package/dist/hooks/utility/useEvents.js +28 -22
- package/dist/hooks/utility/useModule.js +21 -10
- package/dist/hooks/utility/useQuery.js +14 -8
- package/dist/models/DebugLogger.js +7 -6
- package/dist/models/GenericContract.js +39 -12
- package/dist/reac-app-env.d.js +1 -0
- package/dist/storybook/assets/video/txt-reversed.mp4 +0 -0
- package/dist/storybookUtils/index.js +42 -24
- package/dist/type-utils.js +4 -2
- package/dist/types.js +4 -2
- package/dist/utility.d.js +17 -0
- package/dist/utils/blockchain.js +60 -54
- package/dist/utils/flatten.js +23 -13
- package/dist/utils/html.utils.js +9 -6
- package/dist/utils/ownEvent.js +9 -8
- package/package.json +13 -8
- package/tsconfig.json +3 -2
- package/cypress/support/commands.ts +0 -49
- package/cypress/support/component-index.html +0 -30
- package/cypress/support/component.ts +0 -39
- package/cypress/support/e2e.js +0 -49
- package/dist/components/AdaptiveButton/AdaptiveButton.js.map +0 -1
- package/dist/components/AdaptiveButton/index.js.map +0 -1
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js.map +0 -1
- package/dist/components/AdaptiveContainer/index.js.map +0 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js.map +0 -1
- package/dist/components/AdaptiveDialog/index.js.map +0 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js.map +0 -1
- package/dist/components/AdaptiveSidebar/index.js.map +0 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js.map +0 -1
- package/dist/components/AnchoredTooltip/index.js.map +0 -1
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js.map +0 -1
- package/dist/components/AnimatedEntrance/index.js.map +0 -1
- package/dist/components/AsyncWrapper/AsyncWrapper.js.map +0 -1
- package/dist/components/AsyncWrapper/index.js.map +0 -1
- package/dist/components/Avatar/Avatar.js.map +0 -1
- package/dist/components/Avatar/index.js.map +0 -1
- package/dist/components/BucketFill/BucketFill.js.map +0 -1
- package/dist/components/BucketFill/index.js.map +0 -1
- package/dist/components/Button/Button.js.map +0 -1
- package/dist/components/Button/index.js.map +0 -1
- package/dist/components/Card/Card.js.map +0 -1
- package/dist/components/Card/index.js.map +0 -1
- package/dist/components/Chart/Chart.e2e.js +0 -9
- package/dist/components/Chart/Chart.e2e.js.map +0 -1
- package/dist/components/Chart/Chart.logic.js.map +0 -1
- package/dist/components/Chart/Chart.types.js.map +0 -1
- package/dist/components/Chart/Chart.view.js.map +0 -1
- package/dist/components/Chart/index.js.map +0 -1
- package/dist/components/CheckBox/CheckBox.js.map +0 -1
- package/dist/components/CheckBox/index.js.map +0 -1
- package/dist/components/Collapsable/Collapsable.js.map +0 -1
- package/dist/components/Collapsable/index.js.map +0 -1
- package/dist/components/Countdown/Countdown.js.map +0 -1
- package/dist/components/Countdown/index.js.map +0 -1
- package/dist/components/Divider/Divider.js.map +0 -1
- package/dist/components/Divider/index.js.map +0 -1
- package/dist/components/EmailInput/EmailInput.js.map +0 -1
- package/dist/components/EmailInput/index.js.map +0 -1
- package/dist/components/FadeIn/FadeIn.js.map +0 -1
- package/dist/components/FadeIn/index.js.map +0 -1
- package/dist/components/FileInput/FileInput.js.map +0 -1
- package/dist/components/FileInput/index.js.map +0 -1
- package/dist/components/FlowController/FlowController.js.map +0 -1
- package/dist/components/FlowController/index.js.map +0 -1
- package/dist/components/Form/Form.js.map +0 -1
- package/dist/components/Form/index.js.map +0 -1
- package/dist/components/Freeze/Freeze.js.map +0 -1
- package/dist/components/Freeze/index.js.map +0 -1
- package/dist/components/HSForms/HSForms.js.map +0 -1
- package/dist/components/HSForms/index.js.map +0 -1
- package/dist/components/Header/Header.js.map +0 -1
- package/dist/components/Header/index.js.map +0 -1
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js.map +0 -1
- package/dist/components/HeaderCloseBtn/index.js.map +0 -1
- package/dist/components/InfinityScroll/InfinityScroll.js.map +0 -1
- package/dist/components/InfinityScroll/index.js.map +0 -1
- package/dist/components/Input/Input.js.map +0 -1
- package/dist/components/Input/index.js.map +0 -1
- package/dist/components/InstantCounter/InstantCounter.js.map +0 -1
- package/dist/components/InstantCounter/index.js.map +0 -1
- package/dist/components/LavaLamp/LavaLamp.data.js.map +0 -1
- package/dist/components/LavaLamp/LavaLamp.js.map +0 -1
- package/dist/components/LavaLamp/index.js.map +0 -1
- package/dist/components/LavaLamp/v2/LavaLamp.js.map +0 -1
- package/dist/components/LinkToId/LinkToId.js.map +0 -1
- package/dist/components/LinkToId/index.js.map +0 -1
- package/dist/components/Loader/Loader.js.map +0 -1
- package/dist/components/Loader/index.js.map +0 -1
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js.map +0 -1
- package/dist/components/LoaderDotsIndicator/index.js.map +0 -1
- package/dist/components/LoopableVideo/LoopableVideo.js.map +0 -1
- package/dist/components/LoopableVideo/index.js.map +0 -1
- package/dist/components/MainGrid/MainGrid.js.map +0 -1
- package/dist/components/MainGrid/index.js.map +0 -1
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js.map +0 -1
- package/dist/components/MutableHamburgerButton/index.js.map +0 -1
- package/dist/components/Notification/Notification.js.map +0 -1
- package/dist/components/Notification/index.js.map +0 -1
- package/dist/components/OrderableList/OrderableList.js.map +0 -1
- package/dist/components/OrderableList/index.js.map +0 -1
- package/dist/components/PaginationIndicator/PaginationIndicator.js.map +0 -1
- package/dist/components/PaginationIndicator/index.js.map +0 -1
- package/dist/components/Parallax/Parallax.js.map +0 -1
- package/dist/components/Parallax/index.js.map +0 -1
- package/dist/components/Parallax/math/helpers.js.map +0 -1
- package/dist/components/PasswordInput/PasswordInput.js.map +0 -1
- package/dist/components/PasswordInput/index.js.map +0 -1
- package/dist/components/PixelatedScan/PixelatedScan.js.map +0 -1
- package/dist/components/PixelatedScan/index.js.map +0 -1
- package/dist/components/Portal/Portal.js.map +0 -1
- package/dist/components/Portal/index.js.map +0 -1
- package/dist/components/ProgressBar/ProgressBar.js.map +0 -1
- package/dist/components/ProgressBar/index.js.map +0 -1
- package/dist/components/ProgressTexts/ProgressTexts.js.map +0 -1
- package/dist/components/ProgressTexts/index.js.map +0 -1
- package/dist/components/SectionContainer/SectionContainer.js.map +0 -1
- package/dist/components/SectionContainer/index.js.map +0 -1
- package/dist/components/Select/Select.js.map +0 -1
- package/dist/components/Select/index.js.map +0 -1
- package/dist/components/Skeleton/Skeleton.js.map +0 -1
- package/dist/components/Skeleton/index.js.map +0 -1
- package/dist/components/Spacing/Spacing.js.map +0 -1
- package/dist/components/Spacing/index.js.map +0 -1
- package/dist/components/StaticScroller/StaticScroller.js.map +0 -1
- package/dist/components/StaticScroller/index.js.map +0 -1
- package/dist/components/Switch/Switch.js.map +0 -1
- package/dist/components/Switch/index.js.map +0 -1
- package/dist/components/Table/Table.js.map +0 -1
- package/dist/components/Table/index.js.map +0 -1
- package/dist/components/Tabs/Tabs.js.map +0 -1
- package/dist/components/Tabs/index.js.map +0 -1
- package/dist/components/Text/Text.js.map +0 -1
- package/dist/components/Text/index.js.map +0 -1
- package/dist/components/Transition/MasksFactory/DiagonalReveal.js.map +0 -1
- package/dist/components/Transition/MasksFactory/DiagonalSquareToBalls.js.map +0 -1
- package/dist/components/Transition/MasksFactory/PhysicsSquares.js.map +0 -1
- package/dist/components/Transition/MasksFactory/SquareToBalls.js.map +0 -1
- package/dist/components/Transition/MasksFactory/utils.js.map +0 -1
- package/dist/components/Transition/Transition.js.map +0 -1
- package/dist/components/Transition/index.js.map +0 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js.map +0 -1
- package/dist/components/UncontrolledTransition/index.js.map +0 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js.map +0 -1
- package/dist/components/WalletConnectionWrapper/index.js.map +0 -1
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js.map +0 -1
- package/dist/components/utilitary/ScrollAndFocusLock/index.js.map +0 -1
- package/dist/context/AsyncProcess.js.map +0 -1
- package/dist/context/CustomBrowserRouter.js.map +0 -1
- package/dist/context/OneUIProvider.js.map +0 -1
- package/dist/hooks/logs/useDependencyChangeDetection.js.map +0 -1
- package/dist/hooks/logs/useIsMounting.js.map +0 -1
- package/dist/hooks/persistence/useLocalStorage.js.map +0 -1
- package/dist/hooks/shims/ObjectWatchShim.js.map +0 -1
- package/dist/hooks/ui/useAdaptiveImage.js.map +0 -1
- package/dist/hooks/ui/useBreakpoint.js.map +0 -1
- package/dist/hooks/ui/useCustomScrollbar.js.map +0 -1
- package/dist/hooks/ui/useMouseHover.js.map +0 -1
- package/dist/hooks/ui/usePaginationControls.js.map +0 -1
- package/dist/hooks/ui/useTilt.js.map +0 -1
- package/dist/hooks/ui/useZoomable.js.map +0 -1
- package/dist/hooks/useAsyncControl.js.map +0 -1
- package/dist/hooks/useContainedRepositioning.js.map +0 -1
- package/dist/hooks/useCustomHistory.js.map +0 -1
- package/dist/hooks/useElementFit.js.map +0 -1
- package/dist/hooks/useFirestoreWatch.js.map +0 -1
- package/dist/hooks/useForm.js.map +0 -1
- package/dist/hooks/useFreeze.js.map +0 -1
- package/dist/hooks/useHero.js.map +0 -1
- package/dist/hooks/useHero.module.scss +0 -5
- package/dist/hooks/useIntersection.js.map +0 -1
- package/dist/hooks/useMergeRefs.js.map +0 -1
- package/dist/hooks/useObserve.js.map +0 -1
- package/dist/hooks/usePagination.js.map +0 -1
- package/dist/hooks/usePooledOperation.js.map +0 -1
- package/dist/hooks/usePooling.js.map +0 -1
- package/dist/hooks/useRebound.js.map +0 -1
- package/dist/hooks/useShortIntl.js.map +0 -1
- package/dist/hooks/utility/useEvents.js.map +0 -1
- package/dist/hooks/utility/useModule.js.map +0 -1
- package/dist/hooks/utility/useQuery.js.map +0 -1
- package/dist/models/DebugLogger.js.map +0 -1
- package/dist/models/GenericContract.js.map +0 -1
- package/dist/storybookUtils/index.js.map +0 -1
- package/dist/type-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/blockchain.js.map +0 -1
- package/dist/utils/flatten.js.map +0 -1
- package/dist/utils/html.utils.js.map +0 -1
- package/dist/utils/ownEvent.js.map +0 -1
|
@@ -1,396 +1,428 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
17
6
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
7
|
+
exports.OrderableListReorderMode = void 0;
|
|
8
|
+
exports.default = OrderableList;
|
|
9
|
+
exports.useOrderableEvents = useOrderableEvents;
|
|
10
|
+
exports.useOrderableListAnchor = useOrderableListAnchor;
|
|
11
|
+
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
12
|
+
var _UncontrolledTransition = _interopRequireDefault(require("../UncontrolledTransition"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _useHero2 = _interopRequireDefault(require("../../hooks/useHero"));
|
|
15
|
+
var _AnimatedEntrance = _interopRequireDefault(require("../AnimatedEntrance"));
|
|
16
|
+
var _Transition = require("../Transition");
|
|
17
|
+
var _OrderableListModule = _interopRequireDefault(require("./OrderableList.module.scss"));
|
|
18
|
+
var _useEvents = _interopRequireDefault(require("../../hooks/utility/useEvents"));
|
|
19
|
+
var _ownEvent = _interopRequireDefault(require("../../utils/ownEvent"));
|
|
20
|
+
const _excluded = ["children", "className", "mode", "shrinkToOnOrder", "reorderingClassName", "cloneClassName"];
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
29
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
30
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
31
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
32
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
33
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
36
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
37
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
38
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
39
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
40
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
41
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
42
|
+
const OrderableListContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
43
|
+
let OrderableListReorderMode = /*#__PURE__*/function (OrderableListReorderMode) {
|
|
44
|
+
OrderableListReorderMode["VERTICAL"] = "v";
|
|
45
|
+
OrderableListReorderMode["TWO_DIMENSIONS"] = "hv";
|
|
46
|
+
return OrderableListReorderMode;
|
|
47
|
+
}({});
|
|
48
|
+
exports.OrderableListReorderMode = OrderableListReorderMode;
|
|
56
49
|
function cleanKeys(keys) {
|
|
57
|
-
|
|
50
|
+
return keys.map(function (a) {
|
|
51
|
+
return a.split(";")[0];
|
|
52
|
+
});
|
|
58
53
|
}
|
|
54
|
+
|
|
59
55
|
/**
|
|
60
56
|
* This component receives a list of keyed elements and orders it based of the order provided via the prop "keyOrder"
|
|
61
57
|
**/
|
|
62
|
-
function OrderableList(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
function OrderableList(_ref) {
|
|
59
|
+
let children = _ref.children,
|
|
60
|
+
_ref$className = _ref.className,
|
|
61
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
62
|
+
_ref$mode = _ref.mode,
|
|
63
|
+
mode = _ref$mode === void 0 ? OrderableListReorderMode.VERTICAL : _ref$mode,
|
|
64
|
+
shrinkToOnOrder = _ref.shrinkToOnOrder,
|
|
65
|
+
reorderingClassName = _ref.reorderingClassName,
|
|
66
|
+
cloneClassName = _ref.cloneClassName,
|
|
67
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
68
|
+
const _useRef = (0, _react.useRef)([]),
|
|
69
|
+
anchorsList = _useRef.current;
|
|
70
|
+
const eventEmitter = (0, _useEvents.default)();
|
|
71
|
+
const currentClone = (0, _react.useRef)(null);
|
|
72
|
+
const currentWorkingKey = (0, _react.useRef)();
|
|
73
|
+
const availableKeys = children.map(function (a) {
|
|
74
|
+
return a.key;
|
|
75
|
+
});
|
|
76
|
+
const rootRef = (0, _react.useRef)(null);
|
|
77
|
+
const _useState = (0, _react.useState)(function () {
|
|
78
|
+
const missingOrderKeys = "keyOrder" in props && props.keyOrder ? availableKeys.filter(function (a) {
|
|
79
|
+
return !props.keyOrder.includes(a);
|
|
80
|
+
}) : [];
|
|
81
|
+
return ("keyOrder" in props && props.keyOrder ? [].concat(_toConsumableArray(props.keyOrder), _toConsumableArray(missingOrderKeys)) : undefined) || availableKeys;
|
|
82
|
+
}),
|
|
83
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
84
|
+
_order = _useState2[0],
|
|
85
|
+
setOrder = _useState2[1];
|
|
86
|
+
const order = (0, _react.useMemo)(function () {
|
|
87
|
+
return ("currentOrder" in props ? props.currentOrder || _order : _order).filter(function (o) {
|
|
88
|
+
return o.includes(";") || availableKeys.includes(o);
|
|
77
89
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
}, [props.currentOrder, _order]);
|
|
91
|
+
const cleanOrder = (0, _react.useMemo)(function () {
|
|
92
|
+
return order.map(function (a) {
|
|
93
|
+
return a.split(";")[0];
|
|
94
|
+
});
|
|
95
|
+
}, [order]);
|
|
96
|
+
const orderId = (0, _react.useMemo)(function () {
|
|
97
|
+
return "key-" + cleanOrder.join("");
|
|
98
|
+
}, [cleanOrder]);
|
|
99
|
+
const findParentElement = function findParentElement(target) {
|
|
100
|
+
let parent = target;
|
|
101
|
+
while (parent.parentElement !== rootRef.current) {
|
|
102
|
+
if (parent.parentElement === null) break;
|
|
103
|
+
parent = parent.parentElement;
|
|
104
|
+
}
|
|
105
|
+
if (process.env.NODE_ENV === "development" && parent === null) throw new Error("It seems like we could not find a relation between this element and the root list. Are you using portals maybe?");
|
|
106
|
+
return parent;
|
|
107
|
+
};
|
|
108
|
+
(0, _react.useLayoutEffect)(function () {
|
|
109
|
+
if (shrinkToOnOrder) rootRef.current.style.setProperty("--shrink-to", "".concat(shrinkToOnOrder, "px"));
|
|
110
|
+
}, [shrinkToOnOrder]);
|
|
111
|
+
const calculateReordering = (0, _react.useMemo)(function () {
|
|
112
|
+
return (0, _throttle.default)(function (e, els, currentOrder) {
|
|
113
|
+
if (els.length > currentOrder.length || !currentWorkingKey.current) return;
|
|
114
|
+
const parent = findParentElement(e.target);
|
|
115
|
+
const indexOfKeyInCleanOrder = els.indexOf(parent);
|
|
116
|
+
const keyOfTheOverElement = currentOrder[indexOfKeyInCleanOrder];
|
|
117
|
+
const isDraggingOwnElement = currentWorkingKey.current === keyOfTheOverElement;
|
|
118
|
+
if (indexOfKeyInCleanOrder === -1 || keyOfTheOverElement === undefined) return;
|
|
119
|
+
if (!isDraggingOwnElement) {
|
|
120
|
+
const distanceFromTop = e.offsetY;
|
|
121
|
+
const heightOfEl = parent.clientHeight;
|
|
122
|
+
const offset = heightOfEl * 0.25;
|
|
123
|
+
const isAfter = distanceFromTop > heightOfEl - offset;
|
|
124
|
+
const isBefore = distanceFromTop < offset;
|
|
125
|
+
const checkIfCanMove = function checkIfCanMove(keyOfOverElement) {
|
|
126
|
+
return keyOfOverElement === undefined || keyOfOverElement !== currentWorkingKey.current;
|
|
127
|
+
};
|
|
128
|
+
const indexOfTheNewElement = indexOfKeyInCleanOrder + (isAfter ? 1 : -1);
|
|
129
|
+
const shouldTriggerReordering = (isAfter || isBefore) && checkIfCanMove(currentOrder[indexOfTheNewElement]);
|
|
130
|
+
if (shouldTriggerReordering) {
|
|
131
|
+
setOrder(function (p) {
|
|
132
|
+
const previousIndex = currentOrder.indexOf(currentWorkingKey.current);
|
|
133
|
+
const indexOfKeyInProvidedOrder = cleanKeys(p).indexOf(keyOfTheOverElement);
|
|
134
|
+
let indexOfTheNewElement = indexOfKeyInProvidedOrder + (isBefore ? -1 : 0);
|
|
135
|
+
if (previousIndex > indexOfTheNewElement) indexOfTheNewElement++;
|
|
136
|
+
const orderWithoutCurrent = p.filter(function (a) {
|
|
137
|
+
if (a.startsWith("".concat(currentWorkingKey.current, ";"))) return false;
|
|
138
|
+
return a !== currentWorkingKey.current;
|
|
139
|
+
});
|
|
140
|
+
orderWithoutCurrent.splice(indexOfTheNewElement, 0, "".concat(currentWorkingKey.current, ";").concat(Date.now()));
|
|
141
|
+
return orderWithoutCurrent;
|
|
142
|
+
});
|
|
89
143
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
144
|
+
}
|
|
145
|
+
}, 1000 / 60);
|
|
146
|
+
}, []);
|
|
147
|
+
(0, _react.useEffect)(function () {
|
|
148
|
+
const els = Array.from(rootRef.current.children);
|
|
149
|
+
const calculateReorderingCall = function calculateReorderingCall(e) {
|
|
150
|
+
const els = Array.from(rootRef.current.children);
|
|
151
|
+
calculateReordering(e, els, cleanOrder);
|
|
93
152
|
};
|
|
94
|
-
(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
for (let el of els) el.addEventListener("mousemove", calculateReorderingCall);
|
|
154
|
+
return function () {
|
|
155
|
+
for (let el of els) el.removeEventListener("mousemove", calculateReorderingCall);
|
|
156
|
+
};
|
|
157
|
+
}, [cleanOrder]);
|
|
158
|
+
(0, _react.useEffect)(function () {
|
|
159
|
+
if ("onChangeKeyOrder" in props) props.onChangeKeyOrder(cleanKeys(_order));
|
|
160
|
+
}, [_order]);
|
|
161
|
+
const cleanOrderRef = (0, _react.useRef)(cleanOrder);
|
|
162
|
+
(0, _react.useEffect)(function () {
|
|
163
|
+
cleanOrderRef.current = cleanOrder;
|
|
164
|
+
}, [cleanOrder]);
|
|
165
|
+
const onAnchorClick = (0, _react.useCallback)(function (_ref2) {
|
|
166
|
+
let anchor = _ref2.target;
|
|
167
|
+
let offset;
|
|
168
|
+
const orderableListItemForAnchor = findParentElement(anchor);
|
|
169
|
+
const box = orderableListItemForAnchor.getBoundingClientRect();
|
|
170
|
+
const els = Array.from(rootRef.current.children);
|
|
171
|
+
const elIndex = els.indexOf(orderableListItemForAnchor);
|
|
172
|
+
const clone = orderableListItemForAnchor.cloneNode(true);
|
|
173
|
+
currentClone.current = clone;
|
|
174
|
+
if (process.env.NODE_ENV === "development") clone.setAttribute("data-testid", "orderable-list-clone");
|
|
175
|
+
clone.setAttribute("data-orderableid", "orderable-list-clone");
|
|
176
|
+
clone.style.width = "".concat(box.width, "px");
|
|
177
|
+
clone.style.height = "".concat(box.height, "px");
|
|
178
|
+
clone.style.top = "".concat(box.top, "px");
|
|
179
|
+
clone.style.left = "".concat(box.left, "px");
|
|
180
|
+
clone.classList.add(_OrderableListModule.default.clone);
|
|
181
|
+
if (shrinkToOnOrder) clone.style.maxHeight = "".concat(box.height, "px");
|
|
182
|
+
setTimeout(function () {
|
|
183
|
+
if (cloneClassName) clone.classList.add(cloneClassName);
|
|
184
|
+
if (shrinkToOnOrder) clone.style.maxHeight = "".concat(shrinkToOnOrder, "px");
|
|
185
|
+
}, 0);
|
|
186
|
+
orderableListItemForAnchor.classList.add(_OrderableListModule.default.currentOrdering);
|
|
187
|
+
orderableListItemForAnchor.classList.remove(_OrderableListModule.default.visible);
|
|
188
|
+
const movementControl = function movementControl(e) {
|
|
189
|
+
const _ref3 = "touches" in e ? {
|
|
190
|
+
x: e.touches[0].pageX,
|
|
191
|
+
y: e.touches[0].pageY
|
|
192
|
+
} : e,
|
|
193
|
+
x1 = _ref3.x,
|
|
194
|
+
y1 = _ref3.y;
|
|
195
|
+
if (!offset) offset = [x1 - box.left, y1 - box.top];
|
|
196
|
+
const _offset = offset,
|
|
197
|
+
_offset2 = _slicedToArray(_offset, 2),
|
|
198
|
+
offsetX = _offset2[0],
|
|
199
|
+
offsetY = _offset2[1];
|
|
200
|
+
clone.style.top = "".concat(y1 - offsetY, "px");
|
|
201
|
+
clone.style.left = "".concat(x1 - offsetX, "px");
|
|
202
|
+
};
|
|
203
|
+
document.body.appendChild(clone);
|
|
204
|
+
const deleteClone = function deleteClone() {
|
|
205
|
+
window.removeEventListener("mousemove", movementControl);
|
|
206
|
+
window.removeEventListener("touchmove", movementControl);
|
|
207
|
+
window.removeEventListener("touchend", deleteClone);
|
|
208
|
+
window.removeEventListener("mouseup", deleteClone);
|
|
209
|
+
orderableListItemForAnchor.style.visibility = "initial";
|
|
210
|
+
currentWorkingKey.current = undefined;
|
|
211
|
+
window.document.body.classList.remove(_OrderableListModule.default.unselectable);
|
|
212
|
+
{
|
|
213
|
+
let cleanUp = function cleanUp() {
|
|
214
|
+
if (shrinkToOnOrder) {
|
|
215
|
+
rootRef.current.style.removeProperty("padding-top");
|
|
216
|
+
rootRef.current.style.removeProperty("min-height");
|
|
217
|
+
}
|
|
218
|
+
eventEmitter.dispatcher("order-stop");
|
|
219
|
+
rootRef.current.classList.remove(_OrderableListModule.default.ordering);
|
|
220
|
+
if (reorderingClassName) rootRef.current.classList.remove(reorderingClassName);
|
|
221
|
+
for (let el of els) el.classList.remove(_OrderableListModule.default.visible);
|
|
222
|
+
clone.remove();
|
|
223
|
+
currentClone.current = null;
|
|
224
|
+
for (let el of Array.from(elInvisible.children)) el.style.height = "";
|
|
151
225
|
};
|
|
152
|
-
}, [cleanOrder]);
|
|
153
|
-
(0, react_1.useEffect)(() => {
|
|
154
|
-
if ("onChangeKeyOrder" in props)
|
|
155
|
-
props.onChangeKeyOrder(cleanKeys(_order));
|
|
156
|
-
}, [_order]);
|
|
157
|
-
const cleanOrderRef = (0, react_1.useRef)(cleanOrder);
|
|
158
|
-
(0, react_1.useEffect)(() => {
|
|
159
|
-
cleanOrderRef.current = cleanOrder;
|
|
160
|
-
}, [cleanOrder]);
|
|
161
|
-
const onAnchorClick = (0, react_1.useCallback)(({ target: anchor }) => {
|
|
162
|
-
let offset;
|
|
163
|
-
const orderableListItemForAnchor = findParentElement(anchor);
|
|
164
|
-
const box = orderableListItemForAnchor.getBoundingClientRect();
|
|
165
226
|
const els = Array.from(rootRef.current.children);
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (process.env.NODE_ENV === "development")
|
|
170
|
-
clone.setAttribute("data-testid", "orderable-list-clone");
|
|
171
|
-
clone.setAttribute("data-orderableid", "orderable-list-clone");
|
|
172
|
-
clone.style.width = `${box.width}px`;
|
|
173
|
-
clone.style.height = `${box.height}px`;
|
|
174
|
-
clone.style.top = `${box.top}px`;
|
|
175
|
-
clone.style.left = `${box.left}px`;
|
|
176
|
-
clone.classList.add(OrderableList_module_scss_1.default.clone);
|
|
177
|
-
if (shrinkToOnOrder)
|
|
178
|
-
clone.style.maxHeight = `${box.height}px`;
|
|
179
|
-
setTimeout(() => {
|
|
180
|
-
if (cloneClassName)
|
|
181
|
-
clone.classList.add(cloneClassName);
|
|
182
|
-
if (shrinkToOnOrder)
|
|
183
|
-
clone.style.maxHeight = `${shrinkToOnOrder}px`;
|
|
184
|
-
}, 0);
|
|
185
|
-
orderableListItemForAnchor.classList.add(OrderableList_module_scss_1.default.currentOrdering);
|
|
186
|
-
orderableListItemForAnchor.classList.remove(OrderableList_module_scss_1.default.visible);
|
|
187
|
-
const movementControl = (e) => {
|
|
188
|
-
const { x: x1, y: y1 } = "touches" in e ? { x: e.touches[0].pageX, y: e.touches[0].pageY } : e;
|
|
189
|
-
if (!offset)
|
|
190
|
-
offset = [x1 - box.left, y1 - box.top];
|
|
191
|
-
const [offsetX, offsetY] = offset;
|
|
192
|
-
clone.style.top = `${y1 - offsetY}px`;
|
|
193
|
-
clone.style.left = `${x1 - offsetX}px`;
|
|
194
|
-
};
|
|
195
|
-
document.body.appendChild(clone);
|
|
196
|
-
const deleteClone = () => {
|
|
197
|
-
window.removeEventListener("mousemove", movementControl);
|
|
198
|
-
window.removeEventListener("touchmove", movementControl);
|
|
199
|
-
window.removeEventListener("touchend", deleteClone);
|
|
200
|
-
window.removeEventListener("mouseup", deleteClone);
|
|
201
|
-
orderableListItemForAnchor.style.visibility = "initial";
|
|
202
|
-
currentWorkingKey.current = undefined;
|
|
203
|
-
window.document.body.classList.remove(OrderableList_module_scss_1.default.unselectable);
|
|
204
|
-
{
|
|
205
|
-
const els = Array.from(rootRef.current.children);
|
|
206
|
-
const elInvisible = els.find((a) => !a.classList.contains(OrderableList_module_scss_1.default.visible) &&
|
|
207
|
-
a.style.maxHeight !== "0px");
|
|
208
|
-
if (shrinkToOnOrder) {
|
|
209
|
-
const child = elInvisible.lastElementChild;
|
|
210
|
-
child.style.maxHeight = `${child.scrollHeight}px`;
|
|
211
|
-
child.classList.add(OrderableList_module_scss_1.default.transitionHeight);
|
|
212
|
-
const onEnd = (0, ownEvent_1.default)(() => {
|
|
213
|
-
child.removeEventListener("transitionend", onEnd);
|
|
214
|
-
child.style.maxHeight = `initial`;
|
|
215
|
-
child.classList.remove(OrderableList_module_scss_1.default.transitionHeight);
|
|
216
|
-
});
|
|
217
|
-
child.addEventListener("transitionend", onEnd);
|
|
218
|
-
}
|
|
219
|
-
const box = elInvisible.getBoundingClientRect();
|
|
220
|
-
function cleanUp() {
|
|
221
|
-
if (shrinkToOnOrder) {
|
|
222
|
-
rootRef.current.style.removeProperty("padding-top");
|
|
223
|
-
rootRef.current.style.removeProperty("min-height");
|
|
224
|
-
}
|
|
225
|
-
eventEmitter.dispatcher("order-stop");
|
|
226
|
-
rootRef.current.classList.remove(OrderableList_module_scss_1.default.ordering);
|
|
227
|
-
if (reorderingClassName)
|
|
228
|
-
rootRef.current.classList.remove(reorderingClassName);
|
|
229
|
-
for (let el of els)
|
|
230
|
-
el.classList.remove(OrderableList_module_scss_1.default.visible);
|
|
231
|
-
clone.remove();
|
|
232
|
-
currentClone.current = null;
|
|
233
|
-
for (let el of Array.from(elInvisible.children))
|
|
234
|
-
el.style.height = "";
|
|
235
|
-
}
|
|
236
|
-
if (clone.style.top.startsWith(Math.floor(box.top).toString()) &&
|
|
237
|
-
clone.style.left.startsWith(Math.floor(box.left).toString())) {
|
|
238
|
-
cleanUp();
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
clone.style.top = `${box.top}px`;
|
|
242
|
-
clone.style.left = `${box.left}px`;
|
|
243
|
-
clone.style.transition = `top 500ms linear, left 500ms linear`;
|
|
244
|
-
clone.addEventListener("transitionend", () => {
|
|
245
|
-
cleanUp();
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
for (let el of els) {
|
|
251
|
-
el.classList.add(OrderableList_module_scss_1.default.visible);
|
|
252
|
-
}
|
|
227
|
+
const elInvisible = els.find(function (a) {
|
|
228
|
+
return !a.classList.contains(_OrderableListModule.default.visible) && a.style.maxHeight !== "0px";
|
|
229
|
+
});
|
|
253
230
|
if (shrinkToOnOrder) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
231
|
+
const child = elInvisible.lastElementChild;
|
|
232
|
+
child.style.maxHeight = "".concat(child.scrollHeight, "px");
|
|
233
|
+
child.classList.add(_OrderableListModule.default.transitionHeight);
|
|
234
|
+
const onEnd = (0, _ownEvent.default)(function () {
|
|
235
|
+
child.removeEventListener("transitionend", onEnd);
|
|
236
|
+
child.style.maxHeight = "initial";
|
|
237
|
+
child.classList.remove(_OrderableListModule.default.transitionHeight);
|
|
238
|
+
});
|
|
239
|
+
child.addEventListener("transitionend", onEnd);
|
|
261
240
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
window.addEventListener("touchend", deleteClone);
|
|
273
|
-
window.addEventListener("touchmove", movementControl);
|
|
274
|
-
}, []);
|
|
275
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
276
|
-
if (currentClone.current) {
|
|
277
|
-
const els = Array.from(rootRef.current.children);
|
|
278
|
-
const elInvisible = els.find((a) => !a.classList.contains(OrderableList_module_scss_1.default.visible) && a.style.maxHeight !== "0px");
|
|
279
|
-
elInvisible.children[0].style.height = `${currentClone.current.clientHeight}px`;
|
|
280
|
-
setTimeout(() => {
|
|
281
|
-
elInvisible.children[1].style.height = `${currentClone.current.clientHeight}px`;
|
|
282
|
-
}, 150);
|
|
241
|
+
const box = elInvisible.getBoundingClientRect();
|
|
242
|
+
if (clone.style.top.startsWith(Math.floor(box.top).toString()) && clone.style.left.startsWith(Math.floor(box.left).toString())) {
|
|
243
|
+
cleanUp();
|
|
244
|
+
} else {
|
|
245
|
+
clone.style.top = "".concat(box.top, "px");
|
|
246
|
+
clone.style.left = "".concat(box.left, "px");
|
|
247
|
+
clone.style.transition = "top 500ms linear, left 500ms linear";
|
|
248
|
+
clone.addEventListener("transitionend", function () {
|
|
249
|
+
cleanUp();
|
|
250
|
+
});
|
|
283
251
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
for (let el of els) {
|
|
255
|
+
el.classList.add(_OrderableListModule.default.visible);
|
|
256
|
+
}
|
|
257
|
+
if (shrinkToOnOrder) {
|
|
258
|
+
for (let el of els) el.style.maxHeight = "".concat(el.scrollHeight, "px");
|
|
259
|
+
const targetHeight = elIndex * shrinkToOnOrder;
|
|
260
|
+
const currentHeight = orderableListItemForAnchor.offsetTop - els[0].offsetTop;
|
|
261
|
+
const paddingTop = currentHeight - targetHeight;
|
|
262
|
+
rootRef.current.style.paddingTop = "".concat(paddingTop, "px");
|
|
263
|
+
rootRef.current.style.minHeight = "".concat(rootRef.current.clientHeight, "px");
|
|
264
|
+
}
|
|
265
|
+
orderableListItemForAnchor.style.visibility = "hidden";
|
|
266
|
+
orderableListItemForAnchor.classList.remove(_OrderableListModule.default.visible);
|
|
267
|
+
rootRef.current.classList.add(_OrderableListModule.default.ordering);
|
|
268
|
+
if (reorderingClassName) rootRef.current.classList.add(reorderingClassName);
|
|
269
|
+
currentWorkingKey.current = cleanOrderRef.current[elIndex];
|
|
270
|
+
eventEmitter.dispatcher("order-start");
|
|
271
|
+
window.document.body.classList.add(_OrderableListModule.default.unselectable);
|
|
272
|
+
window.addEventListener("mouseup", deleteClone);
|
|
273
|
+
window.addEventListener("mousemove", movementControl);
|
|
274
|
+
window.addEventListener("touchend", deleteClone);
|
|
275
|
+
window.addEventListener("touchmove", movementControl);
|
|
276
|
+
}, []);
|
|
277
|
+
(0, _react.useLayoutEffect)(function () {
|
|
278
|
+
if (currentClone.current) {
|
|
279
|
+
const els = Array.from(rootRef.current.children);
|
|
280
|
+
const elInvisible = els.find(function (a) {
|
|
281
|
+
return !a.classList.contains(_OrderableListModule.default.visible) && a.style.maxHeight !== "0px";
|
|
282
|
+
});
|
|
283
|
+
elInvisible.children[0].style.height = "".concat(currentClone.current.clientHeight, "px");
|
|
284
|
+
setTimeout(function () {
|
|
285
|
+
elInvisible.children[1].style.height = "".concat(currentClone.current.clientHeight, "px");
|
|
286
|
+
}, 150);
|
|
287
|
+
}
|
|
288
|
+
}, [cleanOrder]);
|
|
289
|
+
const toSpread = _objectSpread({}, props);
|
|
290
|
+
delete toSpread.keyOrder;
|
|
291
|
+
delete toSpread.onChangeKeyOrder;
|
|
292
|
+
const childrenToRender = _toConsumableArray(children).filter(function (a) {
|
|
293
|
+
return cleanOrder.includes(a.key);
|
|
294
|
+
}).sort(function (a, b) {
|
|
295
|
+
return cleanOrder.indexOf(a.key) - cleanOrder.indexOf(b.key);
|
|
296
|
+
}).map(function (a, i) {
|
|
297
|
+
return _objectSpread(_objectSpread({}, a), {}, {
|
|
298
|
+
key: order[i]
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
(0, _react.useLayoutEffect)(function () {
|
|
302
|
+
rootRef.current.addEventListener("touchstart", function (e) {
|
|
303
|
+
const relatedAnchor = anchorsList.find(function (anchor) {
|
|
304
|
+
return anchor.contains(e.target);
|
|
305
|
+
});
|
|
306
|
+
if (relatedAnchor) {
|
|
307
|
+
e.preventDefault();
|
|
308
|
+
onAnchorClick({
|
|
309
|
+
target: relatedAnchor
|
|
332
310
|
});
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
.forEach((img) => (img.style.visibility = ""));
|
|
364
|
-
},
|
|
311
|
+
const moveCb = (0, _throttle.default)(function () {
|
|
312
|
+
const els = Array.from(rootRef.current.children);
|
|
313
|
+
const currentElementIdx = els.findIndex(function (c) {
|
|
314
|
+
const rect = c === null || c === void 0 ? void 0 : c.getBoundingClientRect();
|
|
315
|
+
if (!rect) return false;
|
|
316
|
+
return rect.top < y && rect.top + rect.height > y;
|
|
317
|
+
});
|
|
318
|
+
if (currentElementIdx !== -1) {
|
|
319
|
+
const el = els[currentElementIdx];
|
|
320
|
+
const rect = el.getBoundingClientRect();
|
|
321
|
+
calculateReordering({
|
|
322
|
+
target: el,
|
|
323
|
+
offsetY: y - rect.top
|
|
324
|
+
}, els, cleanOrderRef.current);
|
|
325
|
+
}
|
|
326
|
+
}, 500);
|
|
327
|
+
const t = e.target;
|
|
328
|
+
const touchMoveCb = function touchMoveCb(e) {
|
|
329
|
+
e.stopPropagation();
|
|
330
|
+
window.dispatchEvent(new TouchEvent(e.type, e));
|
|
331
|
+
moveCb(e);
|
|
332
|
+
};
|
|
333
|
+
const removeCb = function removeCb(e) {
|
|
334
|
+
t.removeEventListener("touchmove", touchMoveCb);
|
|
335
|
+
t.removeEventListener("touchend", removeCb);
|
|
336
|
+
window.dispatchEvent(new TouchEvent(e.type, e));
|
|
337
|
+
};
|
|
338
|
+
t.addEventListener("touchmove", touchMoveCb);
|
|
339
|
+
t.addEventListener("touchend", removeCb);
|
|
340
|
+
}
|
|
365
341
|
});
|
|
366
|
-
|
|
342
|
+
}, []);
|
|
343
|
+
const e = (0, _react.useMemo)(function () {
|
|
344
|
+
return {
|
|
345
|
+
bindAnchor: function bindAnchor(el) {
|
|
346
|
+
el.addEventListener("mousedown", onAnchorClick);
|
|
347
|
+
anchorsList.push(el);
|
|
348
|
+
},
|
|
349
|
+
unbindAnchor: function unbindAnchor(el) {
|
|
350
|
+
el.removeEventListener("mousedown", onAnchorClick);
|
|
351
|
+
anchorsList.splice(anchorsList.indexOf(el), 1);
|
|
352
|
+
},
|
|
353
|
+
on: eventEmitter.subscriber
|
|
354
|
+
};
|
|
355
|
+
}, []);
|
|
356
|
+
return /*#__PURE__*/_react.default.createElement(OrderableListContext.Provider, {
|
|
357
|
+
value: e
|
|
358
|
+
}, /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
359
|
+
ref: rootRef,
|
|
360
|
+
className: "".concat(_OrderableListModule.default.root, " ").concat(className, " ").concat(shrinkToOnOrder ? _OrderableListModule.default.shrinkable : "")
|
|
361
|
+
}, toSpread), mode === OrderableListReorderMode.VERTICAL ? /*#__PURE__*/_react.default.createElement(_AnimatedEntrance.default, null, childrenToRender) : /*#__PURE__*/_react.default.createElement(_UncontrolledTransition.default, {
|
|
362
|
+
className: _OrderableListModule.default.transition,
|
|
363
|
+
transitionType: _Transition.TransitionAnimationTypes.FADE,
|
|
364
|
+
contentClassName: "".concat(className)
|
|
365
|
+
}, /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
366
|
+
key: orderId
|
|
367
|
+
}, _toConsumableArray(children).filter(function (a) {
|
|
368
|
+
return cleanOrder.includes(a.key);
|
|
369
|
+
}).sort(function (a, b) {
|
|
370
|
+
return cleanOrder.indexOf(a.key) - cleanOrder.indexOf(b.key);
|
|
371
|
+
}).map(function (a, i) {
|
|
372
|
+
return /*#__PURE__*/_react.default.createElement(HeroWrapper, {
|
|
373
|
+
key: i,
|
|
374
|
+
id: a.key
|
|
375
|
+
}, a);
|
|
376
|
+
})))));
|
|
377
|
+
}
|
|
378
|
+
function HeroWrapper(_ref5) {
|
|
379
|
+
let children = _ref5.children,
|
|
380
|
+
id = _ref5.id;
|
|
381
|
+
const _useHero = (0, _useHero2.default)(id, undefined, {
|
|
382
|
+
onHeroStart: function onHeroStart(_c, _o, t) {
|
|
383
|
+
t.querySelectorAll("img").forEach(function (img) {
|
|
384
|
+
return img.style.visibility = "hidden";
|
|
385
|
+
});
|
|
386
|
+
},
|
|
387
|
+
onHeroEnd: function onHeroEnd() {
|
|
388
|
+
if (heroRef.current) heroRef.current.querySelectorAll("img").forEach(function (img) {
|
|
389
|
+
return img.style.visibility = "";
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}),
|
|
393
|
+
heroRef = _useHero.heroRef;
|
|
394
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
395
|
+
ref: heroRef
|
|
396
|
+
}, children);
|
|
367
397
|
}
|
|
368
398
|
function useOrderableListAnchor() {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return {
|
|
379
|
-
anchorRef: ctx ? anchorRef : undefined,
|
|
399
|
+
const anchorRef = (0, _react.useRef)(null);
|
|
400
|
+
const ctx = (0, _react.useContext)(OrderableListContext);
|
|
401
|
+
(0, _react.useLayoutEffect)(function () {
|
|
402
|
+
if (!ctx) return;
|
|
403
|
+
const bindAnchor = ctx.bindAnchor,
|
|
404
|
+
unbindAnchor = ctx.unbindAnchor;
|
|
405
|
+
bindAnchor(anchorRef.current);
|
|
406
|
+
return function () {
|
|
407
|
+
return unbindAnchor(anchorRef.current);
|
|
380
408
|
};
|
|
409
|
+
}, []);
|
|
410
|
+
return {
|
|
411
|
+
anchorRef: ctx ? anchorRef : undefined
|
|
412
|
+
};
|
|
381
413
|
}
|
|
382
|
-
exports.useOrderableListAnchor = useOrderableListAnchor;
|
|
383
414
|
function useOrderableEvents(events) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
415
|
+
const _useContext = (0, _react.useContext)(OrderableListContext),
|
|
416
|
+
on = _useContext.on;
|
|
417
|
+
(0, _react.useEffect)(function () {
|
|
418
|
+
const unsubscribers = [];
|
|
419
|
+
for (let eventName in events) {
|
|
420
|
+
unsubscribers.push(on(eventName, events[eventName]));
|
|
421
|
+
}
|
|
422
|
+
return function () {
|
|
423
|
+
unsubscribers.forEach(function (u) {
|
|
424
|
+
return u();
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
}, [events]);
|
|
428
|
+
}
|