@espressif/dashboard-ui-components 1.10.0 → 1.11.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/CHANGELOG.md +65 -0
- package/dist/_vendor/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/_vendor/@radix-ui/react-checkbox/dist/index.js +185 -0
- package/dist/_vendor/@radix-ui/react-compose-refs/dist/index.js +28 -0
- package/dist/_vendor/@radix-ui/react-context/dist/index.js +68 -0
- package/dist/_vendor/@radix-ui/react-presence/dist/index.js +127 -0
- package/dist/_vendor/@radix-ui/react-primitive/dist/index.js +42 -0
- package/dist/_vendor/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
- package/dist/_vendor/@radix-ui/react-use-layout-effect/dist/index.js +5 -0
- package/dist/_vendor/@radix-ui/react-use-previous/dist/index.js +17 -0
- package/dist/_vendor/@radix-ui/react-use-size/dist/index.js +39 -0
- package/dist/_vendor/lottie-react/build/index.es.js +537 -0
- package/dist/_vendor/lottie-web/build/player/lottie.js +14149 -0
- package/dist/_virtual/_rolldown/runtime.js +24 -0
- package/dist/assets/illustrations/bulb-cloud-drawing.js +4 -0
- package/dist/assets/illustrations/rm-dashboard-update.js +4 -0
- package/dist/assets/illustrations/rm-data-download.js +4 -0
- package/dist/assets/logos/espressif/espressif-no-text.js +4 -0
- package/dist/assets/logos/espressif/espressif-with-text-dm.js +4 -0
- package/dist/assets/logos/espressif/espressif-with-text.js +4 -0
- package/dist/assets/logos/insights/insights-no-text.js +4 -0
- package/dist/assets/logos/insights/insights-with-text-dm.js +4 -0
- package/dist/assets/logos/insights/insights-with-text.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-no-text-dm.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-no-text.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-with-text-dm.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-with-text.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-no-text.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-with-text-dm.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-with-text.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-no-text.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-with-text.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-no-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-no-text.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-with-text.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-no-text.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-with-text.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-no-text.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-with-text-dm.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-with-text.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-no-text.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-with-text-dm.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-with-text.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-no-text.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-with-text-dm.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-with-text.js +4 -0
- package/dist/common/animated-rainmaker-logo/animated-rainmaker-logo.constants.js +18 -0
- package/dist/common/animated-rainmaker-logo/animated-rainmaker-logo.js +24 -0
- package/dist/common/animated-rainmaker-logo/rainmaker-c-logo.js +50 -0
- package/dist/common/animated-rainmaker-logo/use-animated-rainmaker-logo-animation.js +85 -0
- package/dist/common/app-logo/app-logo.js +59 -0
- package/dist/common/app-logo/logo-config.js +297 -0
- package/dist/common/copyright-card/copyright-card.js +39 -0
- package/dist/common/footer-card/footer-card.js +22 -0
- package/dist/common/index.js +8 -8
- package/dist/common/my-account-menu/my-account-menu.js +32 -0
- package/dist/common/page-loader/page-loader.js +21 -0
- package/dist/common/profile-card/profile-card.js +26 -0
- package/dist/components/accordion/accordion.js +52 -0
- package/dist/components/advanced-search-box/advanced-search-box.js +106 -0
- package/dist/components/alert/alert.js +85 -0
- package/dist/components/animated-containers/pop-collection-item.js +28 -0
- package/dist/components/async-multi-select/async-multi-select.js +199 -0
- package/dist/components/avatar/avatar.js +41 -0
- package/dist/components/button/button.js +191 -0
- package/dist/components/button/flash-button.js +110 -0
- package/dist/components/button/invert-button.js +13 -0
- package/dist/components/calendar/calendar.js +105 -0
- package/dist/components/cards/animated-card/animated-card-animations.js +57 -0
- package/dist/components/cards/animated-card/animated-card.js +42 -0
- package/dist/components/cards/basic-details-card.js +46 -0
- package/dist/components/cards/collapsible-card.js +48 -0
- package/dist/components/cards/no-data-card/no-data-card.js +30 -0
- package/dist/components/cards/section-card.js +265 -0
- package/dist/components/cards/simple-card.js +24 -0
- package/dist/components/carousel/carousel.js +158 -0
- package/dist/components/chart/area-chart.js +135 -0
- package/dist/components/chart/bar-chart.js +151 -0
- package/dist/components/chart/chart-colors.js +85 -0
- package/dist/components/chart/chart-series-data.js +53 -0
- package/dist/components/chart/chart.js +147 -0
- package/dist/components/chart/chart.types.js +7 -0
- package/dist/components/chart/composed-chart.js +182 -0
- package/dist/components/chart/donut-chart.js +177 -0
- package/dist/components/chart/line-chart.js +137 -0
- package/dist/components/chart/treemap-chart.js +294 -0
- package/dist/components/circular-progress/circular-progress.js +125 -0
- package/dist/components/code-editor/code-editor.js +235 -0
- package/dist/components/code-editor/code-editor.utils.js +122 -0
- package/dist/components/code-editor/use-code-editor-keys.js +79 -0
- package/dist/components/code-editor/use-highlighted-html.js +102 -0
- package/dist/components/confirmation-dialog/confirmation-dialog.js +72 -0
- package/dist/components/content-container/content-container.js +20 -0
- package/dist/components/copiable-text/copiable-text.js +46 -0
- package/dist/components/data-table/data-table.js +186 -0
- package/dist/components/data-table/responsive-columns.js +65 -0
- package/dist/components/data-table/row-actions.js +27 -0
- package/dist/components/data-table/sticky-columns.js +71 -0
- package/dist/components/data-table/table-body.js +57 -0
- package/dist/components/data-table/table-header.js +21 -0
- package/dist/components/date-picker/date-picker.js +95 -0
- package/dist/components/date-range-picker/date-range-picker.js +301 -0
- package/dist/components/date-range-picker/presets.js +174 -0
- package/dist/components/date-time-picker/date-time-picker.js +144 -0
- package/dist/components/date-time-picker/date-time-picker.utils.js +32 -0
- package/dist/components/device-icon/device-icon.config.js +194 -0
- package/dist/components/device-icon/device-icon.js +17 -0
- package/dist/components/device-icon/icons/air-conditioner.js +22 -0
- package/dist/components/device-icon/icons/blind.js +24 -0
- package/dist/components/device-icon/icons/dimmer.js +14 -0
- package/dist/components/device-icon/icons/extension-board.js +42 -0
- package/dist/components/device-icon/icons/fan.js +14 -0
- package/dist/components/device-icon/icons/knob.js +14 -0
- package/dist/components/device-icon/icons/led-strip.js +22 -0
- package/dist/components/device-icon/icons/light.js +14 -0
- package/dist/components/device-icon/icons/refrigerator.js +18 -0
- package/dist/components/device-icon/icons/retro-switch.js +18 -0
- package/dist/components/device-icon/icons/router.js +20 -0
- package/dist/components/device-icon/icons/sensor.js +20 -0
- package/dist/components/device-icon/icons/socket.js +19 -0
- package/dist/components/device-icon/icons/switch.js +19 -0
- package/dist/components/device-icon/icons/thermostat.js +21 -0
- package/dist/components/device-icon/icons/washing-machine.js +22 -0
- package/dist/components/device-icon/match-device.js +61 -0
- package/dist/components/dynamic-list/dynamic-list.js +445 -0
- package/dist/components/error-display/full-size-error/full-size-error.js +20 -0
- package/dist/components/error-display/inline-error/inline-error.js +12 -0
- package/dist/components/file-input/file-input.js +318 -0
- package/dist/components/file-upload/file-upload.js +317 -0
- package/dist/components/filters-bar/filters-bar.js +36 -0
- package/dist/components/fullscreen-dialog/fullscreen-dialog.js +68 -0
- package/dist/components/icon-avatar/icon-avatar.js +130 -0
- package/dist/components/icon-text-action-card/icon-text-action-card.js +190 -0
- package/dist/components/illustration/illustration-registry.js +37 -0
- package/dist/components/illustration/illustration-variants.js +21 -0
- package/dist/components/illustration/illustration.js +68 -0
- package/dist/components/index.d.ts +0 -20
- package/dist/components/index.js +134 -6
- package/dist/components/key-value-manager/key-value-manager-add-popover.js +126 -0
- package/dist/components/key-value-manager/key-value-manager-field.js +47 -0
- package/dist/components/key-value-manager/key-value-manager-table.js +188 -0
- package/dist/components/key-value-manager/key-value-manager.js +111 -0
- package/dist/components/key-value-manager/key-value-manager.props.js +28 -0
- package/dist/components/key-value-manager/key-value-manager.utils.js +21 -0
- package/dist/components/link/link.js +67 -0
- package/dist/components/list/dropdown-list-item.js +60 -0
- package/dist/components/list/list-item.utils.js +76 -0
- package/dist/components/list/list.js +49 -0
- package/dist/components/list/list.props.js +27 -0
- package/dist/components/list/standard-list-item.js +66 -0
- package/dist/components/list-details/list-details-item-button.js +46 -0
- package/dist/components/list-details/list-details-item-dropdown.js +112 -0
- package/dist/components/list-details/list-details-item-strip.js +125 -0
- package/dist/components/list-details/list-details.js +148 -0
- package/dist/components/lottie-animation-container/lottie-animation-container.js +31 -0
- package/dist/components/lottie-animations/animation-data/access-denied.js +3980 -0
- package/dist/components/lottie-animations/animation-data/active.js +825 -0
- package/dist/components/lottie-animations/animation-data/bar-chart.js +610 -0
- package/dist/components/lottie-animations/animation-data/chart-loading.js +5368 -0
- package/dist/components/lottie-animations/animation-data/cloud-download.js +1660 -0
- package/dist/components/lottie-animations/animation-data/cloud-sync.js +932 -0
- package/dist/components/lottie-animations/animation-data/coud-upload.js +7060 -0
- package/dist/components/lottie-animations/animation-data/cross-throb.js +1506 -0
- package/dist/components/lottie-animations/animation-data/dashboard-loading.js +14330 -0
- package/dist/components/lottie-animations/animation-data/error-spread-out.js +5567 -0
- package/dist/components/lottie-animations/animation-data/error.js +1211 -0
- package/dist/components/lottie-animations/animation-data/green-success.js +14826 -0
- package/dist/components/lottie-animations/animation-data/inactive.js +723 -0
- package/dist/components/lottie-animations/animation-data/light.js +2678 -0
- package/dist/components/lottie-animations/animation-data/lock.js +900 -0
- package/dist/components/lottie-animations/animation-data/lock2.js +1686 -0
- package/dist/components/lottie-animations/animation-data/locked.js +641 -0
- package/dist/components/lottie-animations/animation-data/search-error.js +954 -0
- package/dist/components/lottie-animations/animation-data/security.js +4121 -0
- package/dist/components/lottie-animations/animation-data/success.js +404 -0
- package/dist/components/lottie-animations/animation-data/verification-in-progress.js +10138 -0
- package/dist/components/lottie-animations/animation-data/warning.js +843 -0
- package/dist/components/lottie-animations/verification-in-progress/verification-in-progress.js +19 -0
- package/dist/components/markdown-content/markdown-content.components.js +114 -0
- package/dist/components/markdown-content/markdown-content.js +39 -0
- package/dist/components/menu/menu.js +19 -0
- package/dist/components/monospace-content/monospace-content.js +80 -0
- package/dist/components/nav-bar/nav-bar-details-panel.js +51 -0
- package/dist/components/nav-bar/nav-bar-mobile-menu.js +105 -0
- package/dist/components/nav-bar/nav-bar.js +449 -0
- package/dist/components/nav-bar/use-nav-bar-overflow.js +74 -0
- package/dist/components/nav-bar/use-nav-bar-scroll.js +42 -0
- package/dist/components/overflow-badge-list/overflow-badge-list.js +58 -0
- package/dist/components/page-container/page-container-skeleton.js +72 -0
- package/dist/components/page-container/page-container.js +93 -0
- package/dist/components/pagination/pagination.js +96 -0
- package/dist/components/pagination/pagination.props.js +16 -0
- package/dist/components/progress-bar/progress-bar.js +106 -0
- package/dist/components/radio-group/radio-group.js +41 -0
- package/dist/components/requirement-list/requirement-list.js +83 -0
- package/dist/components/scrollable-sections/scrollable-sections.js +270 -0
- package/dist/components/search-box/search-box.js +54 -0
- package/dist/components/search-field-shell.js +24 -0
- package/dist/components/selectable-card-list/checkbox-card-list.js +85 -0
- package/dist/components/selectable-card-list/radio-card-list.js +99 -0
- package/dist/components/selectable-card-list/selectable-card-list-shared.js +135 -0
- package/dist/components/selectable-card-list/selectable-card-list.js +34 -0
- package/dist/components/sidebar/sidebar.js +344 -0
- package/dist/components/sidebar/types.js +6 -0
- package/dist/components/simple-clickable-card/simple-clickable-card-shared.js +309 -0
- package/dist/components/simple-clickable-card/simple-clickable-card.js +106 -0
- package/dist/components/simple-info-card/simple-info-card.js +154 -0
- package/dist/components/simple-list/simple-list.js +146 -0
- package/dist/components/simple-paginated-list/simple-paginated-list.js +178 -0
- package/dist/components/simplified-date/simplified-date.js +56 -0
- package/dist/components/skeletons/table-skeleton.js +16 -0
- package/dist/components/spinner/spinner.js +25 -0
- package/dist/components/stat-card/stat-card.js +206 -0
- package/dist/components/status-badge/status-badge.js +108 -0
- package/dist/components/status-card-list/status-card-list.js +282 -0
- package/dist/components/tag/tag.js +144 -0
- package/dist/components/tag-input/tag-input.js +161 -0
- package/dist/components/text-effects/glitch-effect/glitch-text.js +115 -0
- package/dist/components/text-effects/gradient-text/gradient-text.js +32 -0
- package/dist/components/text-effects/highlight-text/highlight-text.js +35 -0
- package/dist/components/text-effects/parse-text-markup.js +53 -0
- package/dist/components/text-effects/shimmer-text/shimmer-text.js +67 -0
- package/dist/components/time-picker/time-picker.js +23 -0
- package/dist/components/toast/toast.js +126 -0
- package/dist/components/togglable-items-list/togglable-items-list.js +28 -0
- package/dist/components/tooltip/tooltip.js +21 -0
- package/dist/components/transfer-list/transfer-list.js +413 -0
- package/dist/components/truncated-line-with-tooltip/truncated-line-with-tooltip.js +61 -0
- package/dist/components/typography/typography-variants.js +41 -0
- package/dist/components/typography/typography.js +15 -0
- package/dist/components/user-type-badge/user-type-badge.js +40 -0
- package/dist/components/user-type-badge/user-type-badge.registry.js +17 -0
- package/dist/components/vertical-stepper/vertical-stepper.js +171 -0
- package/dist/core/alert.js +33 -0
- package/dist/core/animate-ui/components/animate/code-header.js +30 -0
- package/dist/core/animate-ui/components/animate/code.js +35 -0
- package/dist/core/animate-ui/components/animate/tabs.js +188 -0
- package/dist/core/animate-ui/components/animate/tooltip.js +39 -0
- package/dist/core/animate-ui/components/base/preview-card.js +29 -0
- package/dist/core/animate-ui/components/base/progress.js +32 -0
- package/dist/core/animate-ui/components/base/radio.js +24 -0
- package/dist/core/animate-ui/components/buttons/copy.js +95 -0
- package/dist/core/animate-ui/components/radix/accordion.js +36 -0
- package/dist/core/animate-ui/components/radix/dialog.js +60 -0
- package/dist/core/animate-ui/components/radix/dropdown-menu.js +129 -0
- package/dist/core/animate-ui/components/radix/sheet.js +110 -0
- package/dist/core/animate-ui/components/radix/sidebar.js +416 -0
- package/dist/core/animate-ui/components/radix/switch.js +34 -0
- package/dist/core/animate-ui/components/radix/toggle-group.js +115 -0
- package/dist/core/animate-ui/components/radix/toggle.js +24 -0
- package/dist/core/animate-ui/primitives/animate/code-block.js +131 -0
- package/dist/core/animate-ui/primitives/animate/escape-html.js +7 -0
- package/dist/core/animate-ui/primitives/animate/shiki-highlighter.js +64 -0
- package/dist/core/animate-ui/primitives/animate/slot.js +39 -0
- package/dist/core/animate-ui/primitives/animate/tabs.js +202 -0
- package/dist/core/animate-ui/primitives/animate/tooltip.js +351 -0
- package/dist/core/animate-ui/primitives/base/preview-card.js +107 -0
- package/dist/core/animate-ui/primitives/base/progress.js +60 -0
- package/dist/core/animate-ui/primitives/base/radio.js +83 -0
- package/dist/core/animate-ui/primitives/buttons/button.js +15 -0
- package/dist/core/animate-ui/primitives/effects/highlight.js +407 -0
- package/dist/core/animate-ui/primitives/radix/accordion.js +76 -0
- package/dist/core/animate-ui/primitives/radix/dialog.js +136 -0
- package/dist/core/animate-ui/primitives/radix/dropdown-menu.js +305 -0
- package/dist/core/animate-ui/primitives/radix/sheet.js +165 -0
- package/dist/core/animate-ui/primitives/radix/switch.js +86 -0
- package/dist/core/animate-ui/primitives/radix/toggle-group.js +100 -0
- package/dist/core/animate-ui/primitives/texts/counting-number.js +75 -0
- package/dist/core/avatar.js +32 -0
- package/dist/core/badge.js +27 -0
- package/dist/core/breadcrumb.js +62 -0
- package/dist/core/button/button.js +43 -0
- package/dist/core/button/craft-button.js +78 -0
- package/dist/core/button-group.js +38 -0
- package/dist/core/button.js +40 -0
- package/dist/core/card.js +42 -0
- package/dist/core/carousel/carousel.js +149 -0
- package/dist/core/checkbox/motion-checkbox.js +103 -0
- package/dist/core/collapsible.js +54 -0
- package/dist/core/combobox/combobox.js +85 -0
- package/dist/core/command.js +61 -0
- package/dist/core/field-end-icons.js +36 -0
- package/dist/core/field-label-row.js +33 -0
- package/dist/core/form.js +92 -0
- package/dist/core/hooks/use-controlled-state.js +27 -0
- package/dist/core/hooks/use-data-state.js +39 -0
- package/dist/core/hooks/use-is-in-view.js +18 -0
- package/dist/core/hooks/use-mobile.js +19 -0
- package/dist/core/hooks/use-reveal-on-scroll-up.js +141 -0
- package/dist/core/hooks/use-scroll-overflow.js +50 -0
- package/dist/core/index.js +18 -52
- package/dist/core/input/input-password.js +30 -0
- package/dist/core/input/input.js +147 -0
- package/dist/core/input-otp/input-otp.js +183 -0
- package/dist/core/label.js +15 -0
- package/dist/core/popover.js +31 -0
- package/dist/core/scroll-area.js +42 -0
- package/dist/core/select.js +121 -0
- package/dist/core/separator.js +40 -0
- package/dist/core/skeleton.js +11 -0
- package/dist/core/table.js +59 -0
- package/dist/core/textarea/textarea.js +97 -0
- package/dist/core/utils/get-strict-context.js +18 -0
- package/dist/index.js +148 -9
- package/dist/layouts/entry-layout/entry-layout-bg.js +4 -0
- package/dist/layouts/entry-layout/entry-layout.js +52 -0
- package/dist/layouts/index.js +7 -6
- package/dist/layouts/workspace-layout/account-menu/account-menu.js +108 -0
- package/dist/layouts/workspace-layout/breadcrumbs/derive-breadcrumbs.js +37 -0
- package/dist/layouts/workspace-layout/breadcrumbs/workspace-breadcrumbs.js +22 -0
- package/dist/layouts/workspace-layout/footer/footer.js +15 -0
- package/dist/layouts/workspace-layout/header/header.js +54 -0
- package/dist/layouts/workspace-layout/workspace-layout.js +157 -0
- package/dist/tailwind-preset.js +3 -4
- package/dist/utils/cn.js +8 -0
- package/dist/utils/color.js +72 -0
- package/dist/utils/index.js +3 -2
- package/dist/utils/path-match.js +17 -0
- package/dist/utils/silver-shine.js +63 -0
- package/dist/utils/variant-gradient-underlay.js +45 -0
- package/dist/utils/variant.js +426 -0
- package/package.json +7 -4
- package/dist/chunk-2GDYZAKR.js +0 -505
- package/dist/chunk-ALCWXFUC.js +0 -733
- package/dist/chunk-CDHBLANU.js +0 -59
- package/dist/chunk-LUESSJAF.js +0 -70068
- package/dist/chunk-TMORRNEB.js +0 -323
- package/dist/chunk-TRTQSARU.js +0 -31
- package/dist/chunk-VU4CZ76T.js +0 -43
- package/dist/chunk-XNLCVHBC.js +0 -364
- package/dist/chunk-Z4776NRY.js +0 -4347
- package/src/assets/illustrations/add-to-group.svg +0 -32
- package/src/assets/illustrations/chip.svg +0 -51
- package/src/assets/illustrations/create-new-group.svg +0 -27
- package/src/assets/illustrations/new-ota.svg +0 -61
- package/src/assets/illustrations/secured-key.svg +0 -48
- /package/dist/assets/{entry-layout-bg-JPI7GJ42.webp → entry-layout-bg-DUM0UhT3.webp} +0 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { __toESM } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_lottie } from "../../lottie-web/build/player/lottie.js";
|
|
3
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
4
|
+
//#region node_modules/lottie-react/build/index.es.js
|
|
5
|
+
var import_lottie = /* @__PURE__ */ __toESM(require_lottie());
|
|
6
|
+
function _arrayLikeToArray(r, a) {
|
|
7
|
+
(null == a || a > r.length) && (a = r.length);
|
|
8
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
function _arrayWithHoles(r) {
|
|
12
|
+
if (Array.isArray(r)) return r;
|
|
13
|
+
}
|
|
14
|
+
function _defineProperty(e, r, t) {
|
|
15
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
16
|
+
value: t,
|
|
17
|
+
enumerable: !0,
|
|
18
|
+
configurable: !0,
|
|
19
|
+
writable: !0
|
|
20
|
+
}) : e[r] = t, e;
|
|
21
|
+
}
|
|
22
|
+
function _iterableToArrayLimit(r, l) {
|
|
23
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
24
|
+
if (null != t) {
|
|
25
|
+
var e, n, i, u, a = [], f = !0, o = !1;
|
|
26
|
+
try {
|
|
27
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
28
|
+
if (Object(t) !== t) return;
|
|
29
|
+
f = !1;
|
|
30
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
31
|
+
} catch (r) {
|
|
32
|
+
o = !0, n = r;
|
|
33
|
+
} finally {
|
|
34
|
+
try {
|
|
35
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
36
|
+
} finally {
|
|
37
|
+
if (o) throw n;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return a;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function _nonIterableRest() {
|
|
44
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
45
|
+
}
|
|
46
|
+
function ownKeys(e, r) {
|
|
47
|
+
var t = Object.keys(e);
|
|
48
|
+
if (Object.getOwnPropertySymbols) {
|
|
49
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
50
|
+
r && (o = o.filter(function(r) {
|
|
51
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
52
|
+
})), t.push.apply(t, o);
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
}
|
|
56
|
+
function _objectSpread2(e) {
|
|
57
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
58
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
59
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
60
|
+
_defineProperty(e, r, t[r]);
|
|
61
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
62
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return e;
|
|
66
|
+
}
|
|
67
|
+
function _objectWithoutProperties(e, t) {
|
|
68
|
+
if (null == e) return {};
|
|
69
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
70
|
+
if (Object.getOwnPropertySymbols) {
|
|
71
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
72
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
73
|
+
}
|
|
74
|
+
return i;
|
|
75
|
+
}
|
|
76
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
77
|
+
if (null == r) return {};
|
|
78
|
+
var t = {};
|
|
79
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
80
|
+
if (e.includes(n)) continue;
|
|
81
|
+
t[n] = r[n];
|
|
82
|
+
}
|
|
83
|
+
return t;
|
|
84
|
+
}
|
|
85
|
+
function _slicedToArray(r, e) {
|
|
86
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
87
|
+
}
|
|
88
|
+
function _toPrimitive(t, r) {
|
|
89
|
+
if ("object" != typeof t || !t) return t;
|
|
90
|
+
var e = t[Symbol.toPrimitive];
|
|
91
|
+
if (void 0 !== e) {
|
|
92
|
+
var i = e.call(t, r || "default");
|
|
93
|
+
if ("object" != typeof i) return i;
|
|
94
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
95
|
+
}
|
|
96
|
+
return ("string" === r ? String : Number)(t);
|
|
97
|
+
}
|
|
98
|
+
function _toPropertyKey(t) {
|
|
99
|
+
var i = _toPrimitive(t, "string");
|
|
100
|
+
return "symbol" == typeof i ? i : i + "";
|
|
101
|
+
}
|
|
102
|
+
function _unsupportedIterableToArray(r, a) {
|
|
103
|
+
if (r) {
|
|
104
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
105
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
106
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
var _excluded$1 = [
|
|
110
|
+
"animationData",
|
|
111
|
+
"loop",
|
|
112
|
+
"autoplay",
|
|
113
|
+
"initialSegment",
|
|
114
|
+
"onComplete",
|
|
115
|
+
"onLoopComplete",
|
|
116
|
+
"onEnterFrame",
|
|
117
|
+
"onSegmentStart",
|
|
118
|
+
"onConfigReady",
|
|
119
|
+
"onDataReady",
|
|
120
|
+
"onDataFailed",
|
|
121
|
+
"onLoadedImages",
|
|
122
|
+
"onDOMLoaded",
|
|
123
|
+
"onDestroy",
|
|
124
|
+
"lottieRef",
|
|
125
|
+
"renderer",
|
|
126
|
+
"name",
|
|
127
|
+
"assetsPath",
|
|
128
|
+
"rendererSettings"
|
|
129
|
+
];
|
|
130
|
+
var useLottie = function useLottie(props, style) {
|
|
131
|
+
var animationData = props.animationData, loop = props.loop, autoplay = props.autoplay, initialSegment = props.initialSegment, onComplete = props.onComplete, onLoopComplete = props.onLoopComplete, onEnterFrame = props.onEnterFrame, onSegmentStart = props.onSegmentStart, onConfigReady = props.onConfigReady, onDataReady = props.onDataReady, onDataFailed = props.onDataFailed, onLoadedImages = props.onLoadedImages, onDOMLoaded = props.onDOMLoaded, onDestroy = props.onDestroy;
|
|
132
|
+
props.lottieRef;
|
|
133
|
+
props.renderer;
|
|
134
|
+
props.name;
|
|
135
|
+
props.assetsPath;
|
|
136
|
+
props.rendererSettings;
|
|
137
|
+
var rest = _objectWithoutProperties(props, _excluded$1);
|
|
138
|
+
var _useState2 = _slicedToArray(useState(false), 2), animationLoaded = _useState2[0], setAnimationLoaded = _useState2[1];
|
|
139
|
+
var animationInstanceRef = useRef();
|
|
140
|
+
var animationContainer = useRef(null);
|
|
141
|
+
/**
|
|
142
|
+
* Play
|
|
143
|
+
*/
|
|
144
|
+
var play = function play() {
|
|
145
|
+
var _a;
|
|
146
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.play();
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Stop
|
|
150
|
+
*/
|
|
151
|
+
var stop = function stop() {
|
|
152
|
+
var _a;
|
|
153
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.stop();
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Pause
|
|
157
|
+
*/
|
|
158
|
+
var pause = function pause() {
|
|
159
|
+
var _a;
|
|
160
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.pause();
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Set animation speed
|
|
164
|
+
* @param speed
|
|
165
|
+
*/
|
|
166
|
+
var setSpeed = function setSpeed(speed) {
|
|
167
|
+
var _a;
|
|
168
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.setSpeed(speed);
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Got to frame and play
|
|
172
|
+
* @param value
|
|
173
|
+
* @param isFrame
|
|
174
|
+
*/
|
|
175
|
+
var goToAndPlay = function goToAndPlay(value, isFrame) {
|
|
176
|
+
var _a;
|
|
177
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.goToAndPlay(value, isFrame);
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Got to frame and stop
|
|
181
|
+
* @param value
|
|
182
|
+
* @param isFrame
|
|
183
|
+
*/
|
|
184
|
+
var goToAndStop = function goToAndStop(value, isFrame) {
|
|
185
|
+
var _a;
|
|
186
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.goToAndStop(value, isFrame);
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Set animation direction
|
|
190
|
+
* @param direction
|
|
191
|
+
*/
|
|
192
|
+
var setDirection = function setDirection(direction) {
|
|
193
|
+
var _a;
|
|
194
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.setDirection(direction);
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Play animation segments
|
|
198
|
+
* @param segments
|
|
199
|
+
* @param forceFlag
|
|
200
|
+
*/
|
|
201
|
+
var playSegments = function playSegments(segments, forceFlag) {
|
|
202
|
+
var _a;
|
|
203
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.playSegments(segments, forceFlag);
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Set sub frames
|
|
207
|
+
* @param useSubFrames
|
|
208
|
+
*/
|
|
209
|
+
var setSubframe = function setSubframe(useSubFrames) {
|
|
210
|
+
var _a;
|
|
211
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.setSubframe(useSubFrames);
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Get animation duration
|
|
215
|
+
* @param inFrames
|
|
216
|
+
*/
|
|
217
|
+
var getDuration = function getDuration(inFrames) {
|
|
218
|
+
var _a;
|
|
219
|
+
return (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.getDuration(inFrames);
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Destroy animation
|
|
223
|
+
*/
|
|
224
|
+
var destroy = function destroy() {
|
|
225
|
+
var _a;
|
|
226
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.destroy();
|
|
227
|
+
animationInstanceRef.current = void 0;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Load a new animation, and if it's the case, destroy the previous one
|
|
231
|
+
* @param {Object} forcedConfigs
|
|
232
|
+
*/
|
|
233
|
+
var loadAnimation = function loadAnimation() {
|
|
234
|
+
var forcedConfigs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
235
|
+
var _a;
|
|
236
|
+
if (!animationContainer.current) return;
|
|
237
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.destroy();
|
|
238
|
+
var config = _objectSpread2(_objectSpread2(_objectSpread2({}, props), forcedConfigs), {}, { container: animationContainer.current });
|
|
239
|
+
animationInstanceRef.current = import_lottie.default.loadAnimation(config);
|
|
240
|
+
setAnimationLoaded(!!animationInstanceRef.current);
|
|
241
|
+
return function() {
|
|
242
|
+
var _a;
|
|
243
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.destroy();
|
|
244
|
+
animationInstanceRef.current = void 0;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* (Re)Initialize when animation data changed
|
|
249
|
+
*/
|
|
250
|
+
useEffect(function() {
|
|
251
|
+
var onUnmount = loadAnimation();
|
|
252
|
+
return function() {
|
|
253
|
+
return onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
|
|
254
|
+
};
|
|
255
|
+
}, [animationData, loop]);
|
|
256
|
+
useEffect(function() {
|
|
257
|
+
if (!animationInstanceRef.current) return;
|
|
258
|
+
animationInstanceRef.current.autoplay = !!autoplay;
|
|
259
|
+
}, [autoplay]);
|
|
260
|
+
useEffect(function() {
|
|
261
|
+
if (!animationInstanceRef.current) return;
|
|
262
|
+
if (!initialSegment) {
|
|
263
|
+
animationInstanceRef.current.resetSegments(true);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (!Array.isArray(initialSegment) || !initialSegment.length) return;
|
|
267
|
+
if (animationInstanceRef.current.currentRawFrame < initialSegment[0] || animationInstanceRef.current.currentRawFrame > initialSegment[1]) animationInstanceRef.current.currentRawFrame = initialSegment[0];
|
|
268
|
+
animationInstanceRef.current.setSegment(initialSegment[0], initialSegment[1]);
|
|
269
|
+
}, [initialSegment]);
|
|
270
|
+
/**
|
|
271
|
+
* Reinitialize listener on change
|
|
272
|
+
*/
|
|
273
|
+
useEffect(function() {
|
|
274
|
+
var listeners = [
|
|
275
|
+
{
|
|
276
|
+
name: "complete",
|
|
277
|
+
handler: onComplete
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "loopComplete",
|
|
281
|
+
handler: onLoopComplete
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: "enterFrame",
|
|
285
|
+
handler: onEnterFrame
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: "segmentStart",
|
|
289
|
+
handler: onSegmentStart
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: "config_ready",
|
|
293
|
+
handler: onConfigReady
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: "data_ready",
|
|
297
|
+
handler: onDataReady
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: "data_failed",
|
|
301
|
+
handler: onDataFailed
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: "loaded_images",
|
|
305
|
+
handler: onLoadedImages
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: "DOMLoaded",
|
|
309
|
+
handler: onDOMLoaded
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: "destroy",
|
|
313
|
+
handler: onDestroy
|
|
314
|
+
}
|
|
315
|
+
].filter(function(listener) {
|
|
316
|
+
return listener.handler != null;
|
|
317
|
+
});
|
|
318
|
+
if (!listeners.length) return;
|
|
319
|
+
var deregisterList = listeners.map(
|
|
320
|
+
/**
|
|
321
|
+
* Handle the process of adding an event listener
|
|
322
|
+
* @param {Listener} listener
|
|
323
|
+
* @return {Function} Function that deregister the listener
|
|
324
|
+
*/
|
|
325
|
+
function(listener) {
|
|
326
|
+
var _a;
|
|
327
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.addEventListener(listener.name, listener.handler);
|
|
328
|
+
return function() {
|
|
329
|
+
var _a;
|
|
330
|
+
(_a = animationInstanceRef.current) === null || _a === void 0 || _a.removeEventListener(listener.name, listener.handler);
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
return function() {
|
|
335
|
+
deregisterList.forEach(function(deregister) {
|
|
336
|
+
return deregister();
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
}, [
|
|
340
|
+
onComplete,
|
|
341
|
+
onLoopComplete,
|
|
342
|
+
onEnterFrame,
|
|
343
|
+
onSegmentStart,
|
|
344
|
+
onConfigReady,
|
|
345
|
+
onDataReady,
|
|
346
|
+
onDataFailed,
|
|
347
|
+
onLoadedImages,
|
|
348
|
+
onDOMLoaded,
|
|
349
|
+
onDestroy
|
|
350
|
+
]);
|
|
351
|
+
return {
|
|
352
|
+
View: /* @__PURE__ */ React.createElement("div", _objectSpread2({
|
|
353
|
+
style,
|
|
354
|
+
ref: animationContainer
|
|
355
|
+
}, rest)),
|
|
356
|
+
play,
|
|
357
|
+
stop,
|
|
358
|
+
pause,
|
|
359
|
+
setSpeed,
|
|
360
|
+
goToAndStop,
|
|
361
|
+
goToAndPlay,
|
|
362
|
+
setDirection,
|
|
363
|
+
playSegments,
|
|
364
|
+
setSubframe,
|
|
365
|
+
getDuration,
|
|
366
|
+
destroy,
|
|
367
|
+
animationContainerRef: animationContainer,
|
|
368
|
+
animationLoaded,
|
|
369
|
+
animationItem: animationInstanceRef.current
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
function getContainerVisibility(container) {
|
|
373
|
+
var _container$getBoundin = container.getBoundingClientRect(), top = _container$getBoundin.top, height = _container$getBoundin.height;
|
|
374
|
+
return (window.innerHeight - top) / (window.innerHeight + height);
|
|
375
|
+
}
|
|
376
|
+
function getContainerCursorPosition(container, cursorX, cursorY) {
|
|
377
|
+
var _container$getBoundin2 = container.getBoundingClientRect(), top = _container$getBoundin2.top, left = _container$getBoundin2.left, width = _container$getBoundin2.width, height = _container$getBoundin2.height;
|
|
378
|
+
return {
|
|
379
|
+
x: (cursorX - left) / width,
|
|
380
|
+
y: (cursorY - top) / height
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
var useInitInteractivity = function useInitInteractivity(_ref) {
|
|
384
|
+
var wrapperRef = _ref.wrapperRef, animationItem = _ref.animationItem, mode = _ref.mode, actions = _ref.actions;
|
|
385
|
+
useEffect(function() {
|
|
386
|
+
var wrapper = wrapperRef.current;
|
|
387
|
+
if (!wrapper || !animationItem || !actions.length) return;
|
|
388
|
+
animationItem.stop();
|
|
389
|
+
var scrollModeHandler = function scrollModeHandler() {
|
|
390
|
+
var assignedSegment = null;
|
|
391
|
+
var scrollHandler = function scrollHandler() {
|
|
392
|
+
var currentPercent = getContainerVisibility(wrapper);
|
|
393
|
+
var action = actions.find(function(_ref2) {
|
|
394
|
+
var visibility = _ref2.visibility;
|
|
395
|
+
return visibility && currentPercent >= visibility[0] && currentPercent <= visibility[1];
|
|
396
|
+
});
|
|
397
|
+
if (!action) return;
|
|
398
|
+
if (action.type === "seek" && action.visibility && action.frames.length === 2) {
|
|
399
|
+
var frameToGo = action.frames[0] + Math.ceil((currentPercent - action.visibility[0]) / (action.visibility[1] - action.visibility[0]) * action.frames[1]);
|
|
400
|
+
//! goToAndStop must be relative to the start of the current segment
|
|
401
|
+
animationItem.goToAndStop(frameToGo - animationItem.firstFrame - 1, true);
|
|
402
|
+
}
|
|
403
|
+
if (action.type === "loop") {
|
|
404
|
+
if (assignedSegment === null) {
|
|
405
|
+
animationItem.playSegments(action.frames, true);
|
|
406
|
+
assignedSegment = action.frames;
|
|
407
|
+
} else if (assignedSegment !== action.frames) {
|
|
408
|
+
animationItem.playSegments(action.frames, true);
|
|
409
|
+
assignedSegment = action.frames;
|
|
410
|
+
} else if (animationItem.isPaused) {
|
|
411
|
+
animationItem.playSegments(action.frames, true);
|
|
412
|
+
assignedSegment = action.frames;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (action.type === "play" && animationItem.isPaused) {
|
|
416
|
+
animationItem.resetSegments(true);
|
|
417
|
+
animationItem.play();
|
|
418
|
+
}
|
|
419
|
+
if (action.type === "stop") animationItem.goToAndStop(action.frames[0] - animationItem.firstFrame - 1, true);
|
|
420
|
+
};
|
|
421
|
+
document.addEventListener("scroll", scrollHandler);
|
|
422
|
+
return function() {
|
|
423
|
+
document.removeEventListener("scroll", scrollHandler);
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
var cursorModeHandler = function cursorModeHandler() {
|
|
427
|
+
var handleCursor = function handleCursor(_x, _y) {
|
|
428
|
+
var x = _x;
|
|
429
|
+
var y = _y;
|
|
430
|
+
if (x !== -1 && y !== -1) {
|
|
431
|
+
var pos = getContainerCursorPosition(wrapper, x, y);
|
|
432
|
+
x = pos.x;
|
|
433
|
+
y = pos.y;
|
|
434
|
+
}
|
|
435
|
+
var action = actions.find(function(_ref3) {
|
|
436
|
+
var position = _ref3.position;
|
|
437
|
+
if (position && Array.isArray(position.x) && Array.isArray(position.y)) return x >= position.x[0] && x <= position.x[1] && y >= position.y[0] && y <= position.y[1];
|
|
438
|
+
if (position && !Number.isNaN(position.x) && !Number.isNaN(position.y)) return x === position.x && y === position.y;
|
|
439
|
+
return false;
|
|
440
|
+
});
|
|
441
|
+
if (!action) return;
|
|
442
|
+
if (action.type === "seek" && action.position && Array.isArray(action.position.x) && Array.isArray(action.position.y) && action.frames.length === 2) {
|
|
443
|
+
var xPercent = (x - action.position.x[0]) / (action.position.x[1] - action.position.x[0]);
|
|
444
|
+
var yPercent = (y - action.position.y[0]) / (action.position.y[1] - action.position.y[0]);
|
|
445
|
+
animationItem.playSegments(action.frames, true);
|
|
446
|
+
animationItem.goToAndStop(Math.ceil((xPercent + yPercent) / 2 * (action.frames[1] - action.frames[0])), true);
|
|
447
|
+
}
|
|
448
|
+
if (action.type === "loop") animationItem.playSegments(action.frames, true);
|
|
449
|
+
if (action.type === "play") {
|
|
450
|
+
if (animationItem.isPaused) animationItem.resetSegments(false);
|
|
451
|
+
animationItem.playSegments(action.frames);
|
|
452
|
+
}
|
|
453
|
+
if (action.type === "stop") animationItem.goToAndStop(action.frames[0], true);
|
|
454
|
+
};
|
|
455
|
+
var mouseMoveHandler = function mouseMoveHandler(ev) {
|
|
456
|
+
handleCursor(ev.clientX, ev.clientY);
|
|
457
|
+
};
|
|
458
|
+
var mouseOutHandler = function mouseOutHandler() {
|
|
459
|
+
handleCursor(-1, -1);
|
|
460
|
+
};
|
|
461
|
+
wrapper.addEventListener("mousemove", mouseMoveHandler);
|
|
462
|
+
wrapper.addEventListener("mouseout", mouseOutHandler);
|
|
463
|
+
return function() {
|
|
464
|
+
wrapper.removeEventListener("mousemove", mouseMoveHandler);
|
|
465
|
+
wrapper.removeEventListener("mouseout", mouseOutHandler);
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
switch (mode) {
|
|
469
|
+
case "scroll": return scrollModeHandler();
|
|
470
|
+
case "cursor": return cursorModeHandler();
|
|
471
|
+
}
|
|
472
|
+
}, [mode, animationItem]);
|
|
473
|
+
};
|
|
474
|
+
var useLottieInteractivity = function useLottieInteractivity(_ref4) {
|
|
475
|
+
var actions = _ref4.actions, mode = _ref4.mode, lottieObj = _ref4.lottieObj;
|
|
476
|
+
var animationItem = lottieObj.animationItem, View = lottieObj.View, animationContainerRef = lottieObj.animationContainerRef;
|
|
477
|
+
useInitInteractivity({
|
|
478
|
+
actions,
|
|
479
|
+
animationItem,
|
|
480
|
+
mode,
|
|
481
|
+
wrapperRef: animationContainerRef
|
|
482
|
+
});
|
|
483
|
+
return View;
|
|
484
|
+
};
|
|
485
|
+
var _excluded = ["style", "interactivity"];
|
|
486
|
+
var Lottie = function Lottie(props) {
|
|
487
|
+
var _a, _b, _c;
|
|
488
|
+
var style = props.style, interactivity = props.interactivity;
|
|
489
|
+
/**
|
|
490
|
+
* Initialize the 'useLottie' hook
|
|
491
|
+
*/
|
|
492
|
+
var _useLottie = useLottie(_objectWithoutProperties(props, _excluded), style), View = _useLottie.View, play = _useLottie.play, stop = _useLottie.stop, pause = _useLottie.pause, setSpeed = _useLottie.setSpeed, goToAndStop = _useLottie.goToAndStop, goToAndPlay = _useLottie.goToAndPlay, setDirection = _useLottie.setDirection, playSegments = _useLottie.playSegments, setSubframe = _useLottie.setSubframe, getDuration = _useLottie.getDuration, destroy = _useLottie.destroy, animationContainerRef = _useLottie.animationContainerRef, animationLoaded = _useLottie.animationLoaded, animationItem = _useLottie.animationItem;
|
|
493
|
+
/**
|
|
494
|
+
* Make the hook variables/methods available through the provided 'lottieRef'
|
|
495
|
+
*/
|
|
496
|
+
useEffect(function() {
|
|
497
|
+
if (props.lottieRef) props.lottieRef.current = {
|
|
498
|
+
play,
|
|
499
|
+
stop,
|
|
500
|
+
pause,
|
|
501
|
+
setSpeed,
|
|
502
|
+
goToAndPlay,
|
|
503
|
+
goToAndStop,
|
|
504
|
+
setDirection,
|
|
505
|
+
playSegments,
|
|
506
|
+
setSubframe,
|
|
507
|
+
getDuration,
|
|
508
|
+
destroy,
|
|
509
|
+
animationContainerRef,
|
|
510
|
+
animationLoaded,
|
|
511
|
+
animationItem
|
|
512
|
+
};
|
|
513
|
+
}, [(_a = props.lottieRef) === null || _a === void 0 ? void 0 : _a.current]);
|
|
514
|
+
return useLottieInteractivity({
|
|
515
|
+
lottieObj: {
|
|
516
|
+
View,
|
|
517
|
+
play,
|
|
518
|
+
stop,
|
|
519
|
+
pause,
|
|
520
|
+
setSpeed,
|
|
521
|
+
goToAndStop,
|
|
522
|
+
goToAndPlay,
|
|
523
|
+
setDirection,
|
|
524
|
+
playSegments,
|
|
525
|
+
setSubframe,
|
|
526
|
+
getDuration,
|
|
527
|
+
destroy,
|
|
528
|
+
animationContainerRef,
|
|
529
|
+
animationLoaded,
|
|
530
|
+
animationItem
|
|
531
|
+
},
|
|
532
|
+
actions: (_b = interactivity === null || interactivity === void 0 ? void 0 : interactivity.actions) !== null && _b !== void 0 ? _b : [],
|
|
533
|
+
mode: (_c = interactivity === null || interactivity === void 0 ? void 0 : interactivity.mode) !== null && _c !== void 0 ? _c : "scroll"
|
|
534
|
+
});
|
|
535
|
+
};
|
|
536
|
+
//#endregion
|
|
537
|
+
export { Lottie as default, useLottie, useLottieInteractivity };
|