@blockend/widget 1.0.31 → 1.0.33

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.
Files changed (161) hide show
  1. package/dist/AllRoutes-B04uZfaa.js +2209 -0
  2. package/dist/Box-BWDJCGbI.js +55 -0
  3. package/dist/EstGas-QSPrdq3Y.js +12863 -0
  4. package/dist/Grow-37t11tle.js +1656 -0
  5. package/dist/InputComp-bKVjlcbT.js +106 -0
  6. package/dist/LoadRoute-C3vokLk0.js +126 -0
  7. package/dist/QuotesProgress-DlgLQ2zo.js +28 -0
  8. package/dist/SwapAsset-tD6wSJDD.js +64 -0
  9. package/dist/Tooltip-BqYgFn1F.js +572 -0
  10. package/dist/TxnButton-DefErcCE.js +207 -0
  11. package/dist/WidgetForm.module-QHJ0-m5f.js +9 -0
  12. package/dist/{add-B8AfyNIx.js → add-D32G_xKI.js} +3 -3
  13. package/dist/{all-wallets-BaLLU39i.js → all-wallets-LjjqiTnJ.js} +3 -3
  14. package/dist/{app-store-DNpoABj1.js → app-store-S7C23kTz.js} +3 -3
  15. package/dist/{apple-DzzHtaL4.js → apple-DMd4RArz.js} +3 -3
  16. package/dist/{arrow-bottom-D2c13c51.js → arrow-bottom-C0cVMl2n.js} +3 -3
  17. package/dist/{arrow-bottom-circle-ls9OCLx1.js → arrow-bottom-circle-veMvHYVR.js} +3 -3
  18. package/dist/{arrow-left-BI3rQkNI.js → arrow-left-B6VdOxSY.js} +3 -3
  19. package/dist/{arrow-right-rnMzhVod.js → arrow-right-CyrokJyU.js} +3 -3
  20. package/dist/{arrow-top-CfA6PVMz.js → arrow-top-S8qh5z92.js} +3 -3
  21. package/dist/{bank-CmpAmHgg.js → bank-B9ySjxm-.js} +3 -3
  22. package/dist/basic-BXha5sM_.js +5783 -0
  23. package/dist/{browser-mEcjgS1H.js → browser-CWmyZDF1.js} +3 -3
  24. package/dist/{card-DkgIWcMc.js → card-TzoSVbiE.js} +3 -3
  25. package/dist/ccip-B97isPV8.js +228 -0
  26. package/dist/{checkmark-B_A013n2.js → checkmark-Be4tNZY8.js} +3 -3
  27. package/dist/{checkmark-bold-DestuG2T.js → checkmark-bold-sAoooMoy.js} +3 -3
  28. package/dist/{chevron-bottom-Di3S86dj.js → chevron-bottom-Cdd52Yir.js} +3 -3
  29. package/dist/{chevron-left-A9Wj-3tj.js → chevron-left-Dp8rM2qD.js} +3 -3
  30. package/dist/{chevron-right-UFxJogOZ.js → chevron-right-kH3Pgt8h.js} +3 -3
  31. package/dist/{chevron-top-BbZs3eaC.js → chevron-top-lx-9iWm1.js} +3 -3
  32. package/dist/{chrome-store-B4F6hJmy.js → chrome-store-BGxPgdkC.js} +3 -3
  33. package/dist/{clock-BbAQ09uV.js → clock-B3r9UiFY.js} +3 -3
  34. package/dist/clockIcon-C2W5xvyt.js +76 -0
  35. package/dist/{close-CY3oZP_D.js → close-Cc6SJ0A9.js} +3 -3
  36. package/dist/{coinPlaceholder-DpfsobZT.js → coinPlaceholder-DqH2n2v1.js} +3 -3
  37. package/dist/{compass-CHS7RZFk.js → compass-CiKYczAi.js} +3 -3
  38. package/dist/{copy-CEd4nGhs.js → copy-DR0dlbF5.js} +3 -3
  39. package/dist/core-D9oRINim.js +14967 -0
  40. package/dist/{cursor-transparent-Tm6k6Ws4.js → cursor-transparent-BABlb938.js} +3 -3
  41. package/dist/cursor-vv-pXAzC.js +7 -0
  42. package/dist/{desktop-CrSyXZkL.js → desktop-aFWdAU4O.js} +3 -3
  43. package/dist/{disconnect-BooT10E1.js → disconnect-Cz0MwjuJ.js} +3 -3
  44. package/dist/{discord-B982Qaml.js → discord-BkNiORDh.js} +3 -3
  45. package/dist/down-BAe_uoMx.js +606 -0
  46. package/dist/{etherscan-CFL0IcNl.js → etherscan-4wT3rhj5.js} +3 -3
  47. package/dist/ethertousd-CC_ezooz.js +6 -0
  48. package/dist/{exclamation-triangle-BBeGXYgt.js → exclamation-triangle-CSv7sjYs.js} +3 -3
  49. package/dist/{extension-C5WqJw73.js → extension-B4acJb16.js} +3 -3
  50. package/dist/{external-link-CcSxVDcd.js → external-link-zFdRyGh8.js} +3 -3
  51. package/dist/{facebook-DF0v9ED8.js → facebook-D2h4REjy.js} +3 -3
  52. package/dist/{farcaster-Boq7M4VK.js → farcaster-acRwWMSn.js} +3 -3
  53. package/dist/{filters-DfeymbPx.js → filters-DE1yHCJy.js} +3 -3
  54. package/dist/getChainIds-B4BLdhKd.js +1888 -0
  55. package/dist/getCosmosAddress-BfMdDDaH.js +9565 -0
  56. package/dist/{github-DQ8FV4bD.js → github-BrCBPjDS.js} +3 -3
  57. package/dist/{google-Dm8FDDZR.js → google-DYC6Um96.js} +3 -3
  58. package/dist/hamburger-sg42nvNd.js +3915 -0
  59. package/dist/{help-circle-CbgiAebR.js → help-circle-CKvIeM4J.js} +3 -3
  60. package/dist/{id-CzqxUksI.js → id-FXzF1V3L.js} +3 -3
  61. package/dist/{image-CsCGTIN-.js → image-rOZMtN9o.js} +3 -3
  62. package/dist/index-B0E-rGOh.js +159 -0
  63. package/dist/index-B5gV3APh.js +992 -0
  64. package/dist/index-CDq3vNnP.js +22 -0
  65. package/dist/index-CIjTGwYH.js +9 -0
  66. package/dist/index-Cmj3dp3U.js +473 -0
  67. package/dist/index-DEovHqJS.js +3010 -0
  68. package/dist/index-DOcwHfd3.js +13583 -0
  69. package/dist/index-DSlXIHtr.js +28701 -0
  70. package/dist/index-DTish3yr.js +1014 -0
  71. package/dist/index-PIAjHNgG.js +18613 -0
  72. package/dist/index-SiMIoFT9.js +331 -0
  73. package/dist/index-Y94UWILI.js +1460 -0
  74. package/dist/index-baetUfmH.js +252 -0
  75. package/dist/index.es-D6RvS0tB.js +366 -0
  76. package/dist/index.es-TLoHC_Sf.js +11678 -0
  77. package/dist/index.es.js +4 -4
  78. package/dist/{info-circle-Bt350Yzj.js → info-circle-BYfEprqC.js} +3 -3
  79. package/dist/{info-fKCfLW0k.js → info-dh7qmm_R.js} +3 -3
  80. package/dist/{lightbulb-BL9YBxiA.js → lightbulb-3S8w5B31.js} +3 -3
  81. package/dist/{mail-_g6CHQeQ.js → mail-DgcPoOPs.js} +3 -3
  82. package/dist/{mobile-B-EQ4IcH.js → mobile-C8egRR0V.js} +3 -3
  83. package/dist/{more-C3rpOdUy.js → more-CU_oPwwY.js} +3 -3
  84. package/dist/{network-placeholder-D9Ak7Xj_.js → network-placeholder-CqjaxlS7.js} +3 -3
  85. package/dist/{nftPlaceholder-CIIm2V_o.js → nftPlaceholder-D6mZlZmz.js} +3 -3
  86. package/dist/{off-DZjgI0eE.js → off-DHeUICx6.js} +3 -3
  87. package/dist/{play-store-DvRnagoF.js → play-store-DyGxjYv5.js} +3 -3
  88. package/dist/{plus-C2jN2huZ.js → plus-k4hEdLAH.js} +3 -3
  89. package/dist/{qr-code-B64HnZgi.js → qr-code-CkavLc0Z.js} +3 -3
  90. package/dist/{recycle-horizontal-CovcJGa_.js → recycle-horizontal-YzkyX2fY.js} +3 -3
  91. package/dist/{refresh-J1Vw6QMA.js → refresh-E1vpdqCO.js} +3 -3
  92. package/dist/{reown-logo-BsXoZ3KT.js → reown-logo-BZbc_-R6.js} +3 -3
  93. package/dist/{search-BC86wYXR.js → search-B9vQkIsQ.js} +3 -3
  94. package/dist/{send-BPA1bK5G.js → send-C9ROxhya.js} +3 -3
  95. package/dist/shareicon-CLveBf8l.js +262 -0
  96. package/dist/{sortDown-cDA6MpOw.js → sortDown-CjBaDQTU.js} +13 -13
  97. package/dist/{swapHorizontal-47_8ePle.js → swapHorizontal-BhLDDuiL.js} +3 -3
  98. package/dist/{swapHorizontalBold-CJ7TzeQP.js → swapHorizontalBold-B1IxJLem.js} +3 -3
  99. package/dist/{swapHorizontalMedium-CTACgUR9.js → swapHorizontalMedium--fvn_6KH.js} +3 -3
  100. package/dist/{swapHorizontalRoundedBold-Ht3_LABp.js → swapHorizontalRoundedBold-fZowAp5m.js} +3 -3
  101. package/dist/{swapVertical-DlS0V6DD.js → swapVertical-CDwndQ4s.js} +3 -3
  102. package/dist/{telegram-UZ00kvIE.js → telegram-BLbguJ3E.js} +3 -3
  103. package/dist/{three-dots-D9zVXr1j.js → three-dots-DyIG0Aiq.js} +3 -3
  104. package/dist/truncate-D9t92mVX.js +7 -0
  105. package/dist/{twitch-CP6rpz4m.js → twitch-054mPrps.js} +3 -3
  106. package/dist/{twitterIcon-Cm3I3FRU.js → twitterIcon-DrlgKmas.js} +3 -3
  107. package/dist/unsupportedProp-Dr6Tadlk.js +10 -0
  108. package/dist/useRegisterError-C52MuupC.js +9857 -0
  109. package/dist/validError-CDlJpg_f.js +6 -0
  110. package/dist/{verify-filled-CfgydKPa.js → verify-filled-Dw1_4VEj.js} +3 -3
  111. package/dist/{verify-DuUE85WT.js → verify-uz7q7EMX.js} +3 -3
  112. package/dist/w3m-modal-CJM8um8G.js +1471 -0
  113. package/dist/{wallet-BC2LSDlF.js → wallet-a9cCMI05.js} +3 -3
  114. package/dist/{wallet-placeholder-DugEJ7xM.js → wallet-placeholder-Cqiz2_rA.js} +3 -3
  115. package/dist/{walletconnect-wayCaYfk.js → walletconnect-96twp7MP.js} +7 -9
  116. package/dist/{warning-circle-Cy9YuvwU.js → warning-circle-C4mV6fIZ.js} +3 -3
  117. package/dist/{x-jggPFiy-.js → x-vRe7FHUS.js} +3 -3
  118. package/package.json +7 -19
  119. package/dist/AllRoutes-Bdi5ZW8W.js +0 -2604
  120. package/dist/Box-e4gA-y_H.js +0 -60
  121. package/dist/EstGas-C5ihS0Mw.js +0 -17108
  122. package/dist/Grow-B4K-I-E-.js +0 -2212
  123. package/dist/InputComp-C_UUZxNU.js +0 -114
  124. package/dist/LoadRoute-CnDhVKdh.js +0 -142
  125. package/dist/QuotesProgress-DxgPgPJE.js +0 -29
  126. package/dist/SwapAsset-CmmuxeQF.js +0 -65
  127. package/dist/Tooltip-D8YjOOKU.js +0 -718
  128. package/dist/TxnButton-CF-TLZrD.js +0 -302
  129. package/dist/WidgetForm.module-DhUUlwZP.js +0 -13
  130. package/dist/basic-Cx2xxgd9.js +0 -7109
  131. package/dist/ccip-BKpquA5i.js +0 -250
  132. package/dist/clockIcon-jSNFFrLy.js +0 -76
  133. package/dist/core-C-gr9X18.js +0 -17217
  134. package/dist/cursor-BTtIlTHP.js +0 -7
  135. package/dist/down-DDk8OoJG.js +0 -809
  136. package/dist/ethertousd-BOknTgU4.js +0 -7
  137. package/dist/getChainIds-6iugk2h0.js +0 -2431
  138. package/dist/getCosmosAddress-BgD5iV6f.js +0 -13998
  139. package/dist/hamburger-BYe_G11E.js +0 -4562
  140. package/dist/index-BAmjBHYR.js +0 -1087
  141. package/dist/index-BxHeZ9IF.js +0 -543
  142. package/dist/index-C7cb2O7r.js +0 -16078
  143. package/dist/index-CF9p4S_X.js +0 -11
  144. package/dist/index-C_vo1L7p.js +0 -24384
  145. package/dist/index-Ch7w83dW.js +0 -4217
  146. package/dist/index-Crhenmgw.js +0 -188
  147. package/dist/index-Cz5Dosd2.js +0 -412
  148. package/dist/index-D5OnT-__.js +0 -35858
  149. package/dist/index-DArR1lwi.js +0 -1759
  150. package/dist/index-hEJSpZe-.js +0 -308
  151. package/dist/index-m2O0cbD8.js +0 -1883
  152. package/dist/index-sLx4Edw4.js +0 -22
  153. package/dist/index.es-DIbGJsfa.js +0 -475
  154. package/dist/index.es-t6sHlseh.js +0 -12916
  155. package/dist/secp256k1-BkBK0mD5.js +0 -1681
  156. package/dist/shareicon-C88Wx-AM.js +0 -314
  157. package/dist/truncate-DSxFWEga.js +0 -7
  158. package/dist/unsupportedProp-DkeDzLfM.js +0 -14
  159. package/dist/useRegisterError-W_UfecIN.js +0 -19288
  160. package/dist/validError-rariWQ7G.js +0 -14
  161. package/dist/w3m-modal-Bl-DPlah.js +0 -1721
@@ -1,22 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- function RoundedButton({
3
- classnames,
4
- styles,
5
- children,
6
- callback
7
- }) {
8
- return /* @__PURE__ */ jsx(
9
- "button",
10
- {
11
- onClick: () => {
12
- callback && callback();
13
- },
14
- className: `${classnames} hover:bw-opacity-70 bw-rounded-[50%] bw-p-2`,
15
- style: { ...styles },
16
- children
17
- }
18
- );
19
- }
20
- export {
21
- RoundedButton as R
22
- };
@@ -1,475 +0,0 @@
1
- import { M as Lottie$1 } from "./useRegisterError-W_UfecIN.js";
2
- import React__default, { useEffect, useState, useRef } from "react";
3
- function _arrayLikeToArray(r, a) {
4
- (null == a || a > r.length) && (a = r.length);
5
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6
- return n;
7
- }
8
- function _arrayWithHoles(r) {
9
- if (Array.isArray(r)) return r;
10
- }
11
- function _defineProperty(e, r, t) {
12
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
13
- value: t,
14
- enumerable: true,
15
- configurable: true,
16
- writable: true
17
- }) : e[r] = t, e;
18
- }
19
- function _iterableToArrayLimit(r, l) {
20
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
21
- if (null != t) {
22
- var e, n, i, u, a = [], f = true, o = false;
23
- try {
24
- if (i = (t = t.call(r)).next, 0 === l) ;
25
- else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
26
- } catch (r2) {
27
- o = true, n = r2;
28
- } finally {
29
- try {
30
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
31
- } finally {
32
- if (o) throw n;
33
- }
34
- }
35
- return a;
36
- }
37
- }
38
- function _nonIterableRest() {
39
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
40
- }
41
- function ownKeys(e, r) {
42
- var t = Object.keys(e);
43
- if (Object.getOwnPropertySymbols) {
44
- var o = Object.getOwnPropertySymbols(e);
45
- r && (o = o.filter(function(r2) {
46
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
47
- })), t.push.apply(t, o);
48
- }
49
- return t;
50
- }
51
- function _objectSpread2(e) {
52
- for (var r = 1; r < arguments.length; r++) {
53
- var t = null != arguments[r] ? arguments[r] : {};
54
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
55
- _defineProperty(e, r2, t[r2]);
56
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
57
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
58
- });
59
- }
60
- return e;
61
- }
62
- function _objectWithoutProperties(e, t) {
63
- if (null == e) return {};
64
- var o, r, i = _objectWithoutPropertiesLoose(e, t);
65
- if (Object.getOwnPropertySymbols) {
66
- var s = Object.getOwnPropertySymbols(e);
67
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
68
- }
69
- return i;
70
- }
71
- function _objectWithoutPropertiesLoose(r, e) {
72
- if (null == r) return {};
73
- var t = {};
74
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
75
- if (e.includes(n)) continue;
76
- t[n] = r[n];
77
- }
78
- return t;
79
- }
80
- function _slicedToArray(r, e) {
81
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
82
- }
83
- function _toPrimitive(t, r) {
84
- if ("object" != typeof t || !t) return t;
85
- var e = t[Symbol.toPrimitive];
86
- if (void 0 !== e) {
87
- var i = e.call(t, r);
88
- if ("object" != typeof i) return i;
89
- throw new TypeError("@@toPrimitive must return a primitive value.");
90
- }
91
- return ("string" === r ? String : Number)(t);
92
- }
93
- function _toPropertyKey(t) {
94
- var i = _toPrimitive(t, "string");
95
- return "symbol" == typeof i ? i : i + "";
96
- }
97
- function _unsupportedIterableToArray(r, a) {
98
- if (r) {
99
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
100
- var t = {}.toString.call(r).slice(8, -1);
101
- 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;
102
- }
103
- }
104
- var _excluded$1 = ["animationData", "loop", "autoplay", "initialSegment", "onComplete", "onLoopComplete", "onEnterFrame", "onSegmentStart", "onConfigReady", "onDataReady", "onDataFailed", "onLoadedImages", "onDOMLoaded", "onDestroy", "lottieRef", "renderer", "name", "assetsPath", "rendererSettings"];
105
- var useLottie = function useLottie2(props, style) {
106
- 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;
107
- props.lottieRef;
108
- props.renderer;
109
- props.name;
110
- props.assetsPath;
111
- props.rendererSettings;
112
- var rest = _objectWithoutProperties(props, _excluded$1);
113
- var _useState = useState(false), _useState2 = _slicedToArray(_useState, 2), animationLoaded = _useState2[0], setAnimationLoaded = _useState2[1];
114
- var animationInstanceRef = useRef();
115
- var animationContainer = useRef(null);
116
- var play = function play2() {
117
- var _a;
118
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.play();
119
- };
120
- var stop = function stop2() {
121
- var _a;
122
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.stop();
123
- };
124
- var pause = function pause2() {
125
- var _a;
126
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.pause();
127
- };
128
- var setSpeed = function setSpeed2(speed) {
129
- var _a;
130
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setSpeed(speed);
131
- };
132
- var goToAndPlay = function goToAndPlay2(value, isFrame) {
133
- var _a;
134
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.goToAndPlay(value, isFrame);
135
- };
136
- var goToAndStop = function goToAndStop2(value, isFrame) {
137
- var _a;
138
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.goToAndStop(value, isFrame);
139
- };
140
- var setDirection = function setDirection2(direction) {
141
- var _a;
142
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setDirection(direction);
143
- };
144
- var playSegments = function playSegments2(segments, forceFlag) {
145
- var _a;
146
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.playSegments(segments, forceFlag);
147
- };
148
- var setSubframe = function setSubframe2(useSubFrames) {
149
- var _a;
150
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.setSubframe(useSubFrames);
151
- };
152
- var getDuration = function getDuration2(inFrames) {
153
- var _a;
154
- return (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.getDuration(inFrames);
155
- };
156
- var destroy = function destroy2() {
157
- var _a;
158
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
159
- animationInstanceRef.current = void 0;
160
- };
161
- var loadAnimation = function loadAnimation2() {
162
- var forcedConfigs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
163
- var _a;
164
- if (!animationContainer.current) {
165
- return;
166
- }
167
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
168
- var config = _objectSpread2(_objectSpread2(_objectSpread2({}, props), forcedConfigs), {}, {
169
- container: animationContainer.current
170
- });
171
- animationInstanceRef.current = Lottie$1.loadAnimation(config);
172
- setAnimationLoaded(!!animationInstanceRef.current);
173
- return function() {
174
- var _a2;
175
- (_a2 = animationInstanceRef.current) === null || _a2 === void 0 ? void 0 : _a2.destroy();
176
- animationInstanceRef.current = void 0;
177
- };
178
- };
179
- useEffect(function() {
180
- var onUnmount = loadAnimation();
181
- return function() {
182
- return onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
183
- };
184
- }, [animationData, loop]);
185
- useEffect(function() {
186
- if (!animationInstanceRef.current) {
187
- return;
188
- }
189
- animationInstanceRef.current.autoplay = !!autoplay;
190
- }, [autoplay]);
191
- useEffect(function() {
192
- if (!animationInstanceRef.current) {
193
- return;
194
- }
195
- if (!initialSegment) {
196
- animationInstanceRef.current.resetSegments(true);
197
- return;
198
- }
199
- if (!Array.isArray(initialSegment) || !initialSegment.length) {
200
- return;
201
- }
202
- if (animationInstanceRef.current.currentRawFrame < initialSegment[0] || animationInstanceRef.current.currentRawFrame > initialSegment[1]) {
203
- animationInstanceRef.current.currentRawFrame = initialSegment[0];
204
- }
205
- animationInstanceRef.current.setSegment(initialSegment[0], initialSegment[1]);
206
- }, [initialSegment]);
207
- useEffect(function() {
208
- var partialListeners = [{
209
- name: "complete",
210
- handler: onComplete
211
- }, {
212
- name: "loopComplete",
213
- handler: onLoopComplete
214
- }, {
215
- name: "enterFrame",
216
- handler: onEnterFrame
217
- }, {
218
- name: "segmentStart",
219
- handler: onSegmentStart
220
- }, {
221
- name: "config_ready",
222
- handler: onConfigReady
223
- }, {
224
- name: "data_ready",
225
- handler: onDataReady
226
- }, {
227
- name: "data_failed",
228
- handler: onDataFailed
229
- }, {
230
- name: "loaded_images",
231
- handler: onLoadedImages
232
- }, {
233
- name: "DOMLoaded",
234
- handler: onDOMLoaded
235
- }, {
236
- name: "destroy",
237
- handler: onDestroy
238
- }];
239
- var listeners = partialListeners.filter(function(listener) {
240
- return listener.handler != null;
241
- });
242
- if (!listeners.length) {
243
- return;
244
- }
245
- var deregisterList = listeners.map(
246
- /**
247
- * Handle the process of adding an event listener
248
- * @param {Listener} listener
249
- * @return {Function} Function that deregister the listener
250
- */
251
- function(listener) {
252
- var _a;
253
- (_a = animationInstanceRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener(listener.name, listener.handler);
254
- return function() {
255
- var _a2;
256
- (_a2 = animationInstanceRef.current) === null || _a2 === void 0 ? void 0 : _a2.removeEventListener(listener.name, listener.handler);
257
- };
258
- }
259
- );
260
- return function() {
261
- deregisterList.forEach(function(deregister) {
262
- return deregister();
263
- });
264
- };
265
- }, [onComplete, onLoopComplete, onEnterFrame, onSegmentStart, onConfigReady, onDataReady, onDataFailed, onLoadedImages, onDOMLoaded, onDestroy]);
266
- var View = /* @__PURE__ */ React__default.createElement("div", _objectSpread2({
267
- style,
268
- ref: animationContainer
269
- }, rest));
270
- return {
271
- View,
272
- play,
273
- stop,
274
- pause,
275
- setSpeed,
276
- goToAndStop,
277
- goToAndPlay,
278
- setDirection,
279
- playSegments,
280
- setSubframe,
281
- getDuration,
282
- destroy,
283
- animationContainerRef: animationContainer,
284
- animationLoaded,
285
- animationItem: animationInstanceRef.current
286
- };
287
- };
288
- function getContainerVisibility(container) {
289
- var _container$getBoundin = container.getBoundingClientRect(), top = _container$getBoundin.top, height = _container$getBoundin.height;
290
- var current = window.innerHeight - top;
291
- var max = window.innerHeight + height;
292
- return current / max;
293
- }
294
- function getContainerCursorPosition(container, cursorX, cursorY) {
295
- var _container$getBoundin2 = container.getBoundingClientRect(), top = _container$getBoundin2.top, left = _container$getBoundin2.left, width = _container$getBoundin2.width, height = _container$getBoundin2.height;
296
- var x = (cursorX - left) / width;
297
- var y = (cursorY - top) / height;
298
- return {
299
- x,
300
- y
301
- };
302
- }
303
- var useInitInteractivity = function useInitInteractivity2(_ref) {
304
- var wrapperRef = _ref.wrapperRef, animationItem = _ref.animationItem, mode = _ref.mode, actions = _ref.actions;
305
- useEffect(function() {
306
- var wrapper = wrapperRef.current;
307
- if (!wrapper || !animationItem || !actions.length) {
308
- return;
309
- }
310
- animationItem.stop();
311
- var scrollModeHandler = function scrollModeHandler2() {
312
- var assignedSegment = null;
313
- var scrollHandler = function scrollHandler2() {
314
- var currentPercent = getContainerVisibility(wrapper);
315
- var action = actions.find(function(_ref2) {
316
- var visibility = _ref2.visibility;
317
- return visibility && currentPercent >= visibility[0] && currentPercent <= visibility[1];
318
- });
319
- if (!action) {
320
- return;
321
- }
322
- if (action.type === "seek" && action.visibility && action.frames.length === 2) {
323
- var frameToGo = action.frames[0] + Math.ceil((currentPercent - action.visibility[0]) / (action.visibility[1] - action.visibility[0]) * action.frames[1]);
324
- animationItem.goToAndStop(frameToGo - animationItem.firstFrame - 1, true);
325
- }
326
- if (action.type === "loop") {
327
- if (assignedSegment === null) {
328
- animationItem.playSegments(action.frames, true);
329
- assignedSegment = action.frames;
330
- } else {
331
- if (assignedSegment !== action.frames) {
332
- animationItem.playSegments(action.frames, true);
333
- assignedSegment = action.frames;
334
- } else if (animationItem.isPaused) {
335
- animationItem.playSegments(action.frames, true);
336
- assignedSegment = action.frames;
337
- }
338
- }
339
- }
340
- if (action.type === "play" && animationItem.isPaused) {
341
- animationItem.resetSegments(true);
342
- animationItem.play();
343
- }
344
- if (action.type === "stop") {
345
- animationItem.goToAndStop(action.frames[0] - animationItem.firstFrame - 1, true);
346
- }
347
- };
348
- document.addEventListener("scroll", scrollHandler);
349
- return function() {
350
- document.removeEventListener("scroll", scrollHandler);
351
- };
352
- };
353
- var cursorModeHandler = function cursorModeHandler2() {
354
- var handleCursor = function handleCursor2(_x, _y) {
355
- var x = _x;
356
- var y = _y;
357
- if (x !== -1 && y !== -1) {
358
- var pos = getContainerCursorPosition(wrapper, x, y);
359
- x = pos.x;
360
- y = pos.y;
361
- }
362
- var action = actions.find(function(_ref3) {
363
- var position = _ref3.position;
364
- if (position && Array.isArray(position.x) && Array.isArray(position.y)) {
365
- return x >= position.x[0] && x <= position.x[1] && y >= position.y[0] && y <= position.y[1];
366
- }
367
- if (position && !Number.isNaN(position.x) && !Number.isNaN(position.y)) {
368
- return x === position.x && y === position.y;
369
- }
370
- return false;
371
- });
372
- if (!action) {
373
- return;
374
- }
375
- if (action.type === "seek" && action.position && Array.isArray(action.position.x) && Array.isArray(action.position.y) && action.frames.length === 2) {
376
- var xPercent = (x - action.position.x[0]) / (action.position.x[1] - action.position.x[0]);
377
- var yPercent = (y - action.position.y[0]) / (action.position.y[1] - action.position.y[0]);
378
- animationItem.playSegments(action.frames, true);
379
- animationItem.goToAndStop(Math.ceil((xPercent + yPercent) / 2 * (action.frames[1] - action.frames[0])), true);
380
- }
381
- if (action.type === "loop") {
382
- animationItem.playSegments(action.frames, true);
383
- }
384
- if (action.type === "play") {
385
- if (animationItem.isPaused) {
386
- animationItem.resetSegments(false);
387
- }
388
- animationItem.playSegments(action.frames);
389
- }
390
- if (action.type === "stop") {
391
- animationItem.goToAndStop(action.frames[0], true);
392
- }
393
- };
394
- var mouseMoveHandler = function mouseMoveHandler2(ev) {
395
- handleCursor(ev.clientX, ev.clientY);
396
- };
397
- var mouseOutHandler = function mouseOutHandler2() {
398
- handleCursor(-1, -1);
399
- };
400
- wrapper.addEventListener("mousemove", mouseMoveHandler);
401
- wrapper.addEventListener("mouseout", mouseOutHandler);
402
- return function() {
403
- wrapper.removeEventListener("mousemove", mouseMoveHandler);
404
- wrapper.removeEventListener("mouseout", mouseOutHandler);
405
- };
406
- };
407
- switch (mode) {
408
- case "scroll":
409
- return scrollModeHandler();
410
- case "cursor":
411
- return cursorModeHandler();
412
- }
413
- }, [mode, animationItem]);
414
- };
415
- var useLottieInteractivity = function useLottieInteractivity2(_ref4) {
416
- var actions = _ref4.actions, mode = _ref4.mode, lottieObj = _ref4.lottieObj;
417
- var animationItem = lottieObj.animationItem, View = lottieObj.View, animationContainerRef = lottieObj.animationContainerRef;
418
- useInitInteractivity({
419
- actions,
420
- animationItem,
421
- mode,
422
- wrapperRef: animationContainerRef
423
- });
424
- return View;
425
- };
426
- var _excluded = ["style", "interactivity"];
427
- var Lottie = function Lottie2(props) {
428
- var _a, _b, _c;
429
- var style = props.style, interactivity = props.interactivity, lottieProps = _objectWithoutProperties(props, _excluded);
430
- var _useLottie = useLottie(lottieProps, 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;
431
- useEffect(function() {
432
- if (props.lottieRef) {
433
- props.lottieRef.current = {
434
- play,
435
- stop,
436
- pause,
437
- setSpeed,
438
- goToAndPlay,
439
- goToAndStop,
440
- setDirection,
441
- playSegments,
442
- setSubframe,
443
- getDuration,
444
- destroy,
445
- animationContainerRef,
446
- animationLoaded,
447
- animationItem
448
- };
449
- }
450
- }, [(_a = props.lottieRef) === null || _a === void 0 ? void 0 : _a.current]);
451
- return useLottieInteractivity({
452
- lottieObj: {
453
- View,
454
- play,
455
- stop,
456
- pause,
457
- setSpeed,
458
- goToAndStop,
459
- goToAndPlay,
460
- setDirection,
461
- playSegments,
462
- setSubframe,
463
- getDuration,
464
- destroy,
465
- animationContainerRef,
466
- animationLoaded,
467
- animationItem
468
- },
469
- actions: (_b = interactivity === null || interactivity === void 0 ? void 0 : interactivity.actions) !== null && _b !== void 0 ? _b : [],
470
- mode: (_c = interactivity === null || interactivity === void 0 ? void 0 : interactivity.mode) !== null && _c !== void 0 ? _c : "scroll"
471
- });
472
- };
473
- export {
474
- Lottie as L
475
- };