@getpara/react-sdk-lite 2.0.0-alpha.72 → 2.0.0-alpha.73

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 (47) hide show
  1. package/dist/cli/cli.mjs +26 -1
  2. package/dist/modal/components/Account/Account.js +39 -2
  3. package/dist/modal/components/Account/AccountSend/AccountSendAsset.d.ts +1 -0
  4. package/dist/modal/components/Account/AccountSend/AccountSendAsset.js +94 -0
  5. package/dist/modal/components/Account/AccountSend/AccountSendForm.d.ts +1 -0
  6. package/dist/modal/components/Account/AccountSend/AccountSendForm.js +343 -0
  7. package/dist/modal/components/Account/AccountSend/AccountSendNetwork.d.ts +1 -0
  8. package/dist/modal/components/Account/AccountSend/AccountSendNetwork.js +53 -0
  9. package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.d.ts +1 -0
  10. package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.js +56 -0
  11. package/dist/modal/components/Account/AccountSend/AssetNetwork.d.ts +5 -0
  12. package/dist/modal/components/Account/AccountSend/AssetNetwork.js +36 -0
  13. package/dist/modal/components/Account/AccountSend/context.d.ts +38 -0
  14. package/dist/modal/components/Account/AccountSend/context.js +418 -0
  15. package/dist/modal/components/Account/AccountSend/index.d.ts +4 -0
  16. package/dist/modal/components/Account/AccountSend/index.js +67 -0
  17. package/dist/modal/components/AddFunds/AddFundsAsset.js +1 -2
  18. package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -2
  19. package/dist/modal/components/AddFunds/AddFundsSettings.js +12 -52
  20. package/dist/modal/components/AddFunds/common.d.ts +0 -14
  21. package/dist/modal/components/AddFunds/common.js +1 -8
  22. package/dist/modal/components/Body/Body.js +12 -2
  23. package/dist/modal/components/Header/hooks/useStepTitle.js +4 -1
  24. package/dist/modal/components/QuantityInput.d.ts +9 -0
  25. package/dist/modal/components/QuantityInput.js +91 -0
  26. package/dist/modal/components/SearchableButtonList.d.ts +34 -0
  27. package/dist/modal/components/SearchableButtonList.js +223 -0
  28. package/dist/modal/components/WalletSelectOld/WalletSelectOld.d.ts +7 -1
  29. package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +16 -7
  30. package/dist/modal/components/common.d.ts +4 -1
  31. package/dist/modal/components/common.js +14 -1
  32. package/dist/modal/hooks/index.d.ts +4 -0
  33. package/dist/modal/hooks/index.js +5 -0
  34. package/dist/modal/hooks/useDebounce.d.ts +4 -0
  35. package/dist/modal/hooks/useDebounce.js +16 -0
  36. package/dist/modal/stores/modal/actions.js +2 -1
  37. package/dist/modal/stores/modal/useModalStore.d.ts +3 -1
  38. package/dist/modal/stores/modal/useModalStore.js +2 -1
  39. package/dist/modal/utils/countryCodes.js +11 -1
  40. package/dist/modal/utils/steps.d.ts +8 -2
  41. package/dist/modal/utils/steps.js +13 -1
  42. package/dist/provider/hooks/queries/useProfileBalance.d.ts +4 -0
  43. package/dist/provider/hooks/queries/useProfileBalance.js +10 -5
  44. package/dist/provider/hooks/utils/useEventListeners.js +4 -1
  45. package/dist/provider/hooks/utils/useWalletState.d.ts +1 -0
  46. package/dist/provider/hooks/utils/useWalletState.js +2 -1
  47. package/package.json +8 -8
@@ -6,13 +6,21 @@ import {
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useEffect, useMemo, useState } from "react";
8
8
  import { useAddFunds } from "./AddFundsContext.js";
9
- import { CpslButton, CpslIcon, CpslInput, CpslRow, CpslText } from "@getpara/react-components";
10
- import { AssetIcon, HeaderSelect, HeaderSelectContainer, HeaderSelectItem, NetworkIcon } from "../common.js";
9
+ import { CpslButton, CpslIcon, CpslRow, CpslText } from "@getpara/react-components";
10
+ import {
11
+ AssetIcon,
12
+ contentMotionProps,
13
+ HeaderSelect,
14
+ HeaderSelectContainer,
15
+ HeaderSelectItem,
16
+ NetworkIcon
17
+ } from "../common.js";
18
+ import { QuantityInput } from "../QuantityInput.js";
11
19
  import { EnabledFlow, getOnRampNetworks, OnRampPurchaseType } from "@getpara/web-sdk";
12
20
  import { OnRampStep, useModalStore } from "../../stores/index.js";
13
21
  import { useStore } from "../../../provider/stores/useStore.js";
14
22
  import { safeStyled, getAssetCode, getNetworkName } from "@getpara/react-common";
15
- import { contentMotionProps, NoProviders } from "./common.js";
23
+ import { NoProviders } from "./common.js";
16
24
  import { AnimatePresence, motion, useIsPresent } from "framer-motion";
17
25
  import { AddFundsAsset } from "./AddFundsAsset.js";
18
26
  function NetworkPill({
@@ -117,40 +125,7 @@ function AddFundsSettings() {
117
125
  ) : network ? /* @__PURE__ */ jsx(NetworkPill, { network, start: NetworkLabel, fix: true }) : null })
118
126
  ] }),
119
127
  /* @__PURE__ */ jsxs(CpslRow, { col: true, gap: "16px", children: [
120
- /* @__PURE__ */ jsx(
121
- Input,
122
- {
123
- value: value || "",
124
- fitContent: true,
125
- autoselect: true,
126
- onKeyDown: (e) => {
127
- if (!/^(\d|\.)$/.test(e.key) && !["Delete", "Backspace", "Tab", "Shift"].includes(e.key)) {
128
- e.preventDefault();
129
- }
130
- },
131
- onChange: (e) => {
132
- var _a;
133
- const numericValue = (((_a = e.currentTarget) == null ? void 0 : _a.value) || "").replace(/[^0-9.]/g, "");
134
- if (numericValue !== "") {
135
- const formattedValue = parseFloat(numericValue).toFixed(2);
136
- setValue(formattedValue);
137
- } else {
138
- setValue(null);
139
- }
140
- },
141
- onBlur: (e) => {
142
- const numericValue = (e.currentTarget.value || "").replace(/[^0-9.]/g, "");
143
- if (numericValue === "") {
144
- setValue(null);
145
- } else {
146
- setValue(parseFloat(numericValue).toFixed(2));
147
- }
148
- },
149
- placeholder: "0",
150
- children: /* @__PURE__ */ jsx(CurrencySign, { slot: "start", children: "$" })
151
- },
152
- value || ""
153
- ),
128
+ /* @__PURE__ */ jsx(QuantityInput, { value, onChange: setValue, symbol: "$" }),
154
129
  /* @__PURE__ */ jsx(CpslRow, { style: { width: "100%" }, children: ["25", "50", "100"].map((quantity) => {
155
130
  return /* @__PURE__ */ jsxs(PresetButton, { fullWidth: true, variant: "secondary", onClick: () => setValue(`${quantity}.00`), children: [
156
131
  "$",
@@ -206,12 +181,6 @@ const Container = safeStyled(motion.div)`
206
181
  const AssetContainer = safeStyled(Container)`
207
182
  gap: 8px;
208
183
  `;
209
- const CurrencySign = safeStyled.div`
210
- font-size: 72px;
211
- color: var(--cpsl-color-text-primary);
212
- position: relative;
213
- right: -16px;
214
- `;
215
184
  const PresetButton = safeStyled(CpslButton)`
216
185
  --button-color: var(--cpsl-color-text-contrast);
217
186
  --button-font-size: 24px;
@@ -222,15 +191,6 @@ const PresetButton = safeStyled(CpslButton)`
222
191
  --button-secondary-hover-border-color: var(--cpsl-color-background-16);
223
192
  flex: 1;
224
193
  `;
225
- const Input = safeStyled(CpslInput)`
226
- --container-background-color: transparent;
227
- --container-height: 90px;
228
- --container-border-width: 0;
229
- --input-background-color: transparent;
230
- --input-font-size: 72px;
231
- --input-text-align: center;
232
- --input-width: 100%;
233
- `;
234
194
  export {
235
195
  AddFundsSettings
236
196
  };
@@ -1,17 +1,3 @@
1
- export declare const contentMotionProps: {
2
- transition: {
3
- duration: number;
4
- };
5
- initial: {
6
- opacity: number;
7
- };
8
- animate: {
9
- opacity: number;
10
- };
11
- exit: {
12
- opacity: number;
13
- };
14
- };
15
1
  export declare const NoProviders: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
16
2
  ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
17
3
  }, {
@@ -2,12 +2,6 @@
2
2
  import "../../../chunk-MMUBH76A.js";
3
3
  import { CpslText } from "@getpara/react-components";
4
4
  import { safeStyled } from "@getpara/react-common";
5
- const contentMotionProps = {
6
- transition: { duration: 0.2 },
7
- initial: { opacity: 0 },
8
- animate: { opacity: 1 },
9
- exit: { opacity: 0 }
10
- };
11
5
  const NoProviders = safeStyled(CpslText)`
12
6
  width: 100%;
13
7
  text-align: center;
@@ -19,6 +13,5 @@ const NoProviders = safeStyled(CpslText)`
19
13
  transition: visibility 0.2s;
20
14
  `;
21
15
  export {
22
- NoProviders,
23
- contentMotionProps
16
+ NoProviders
24
17
  };
@@ -46,6 +46,7 @@ import { SwitchWalletsStep } from "../SwitchWalletsStep/SwitchWalletsStep.js";
46
46
  import { Footer } from "../Footer/Footer.js";
47
47
  import { renderTextWithLinks } from "../../utils/renderTextWithLinks.js";
48
48
  import { AccountWallet } from "../Account/AccountWallet.js";
49
+ import { AccountSend } from "../Account/AccountSend/index.js";
49
50
  const MIN_HEIGHT = {
50
51
  [ModalStep.ADD_FUNDS_AWAITING]: "680px"
51
52
  };
@@ -214,6 +215,15 @@ const Body = ({
214
215
  case ModalStep.SWITCH_WALLETS: {
215
216
  return /* @__PURE__ */ jsx(SwitchWalletsStep, {});
216
217
  }
218
+ case ModalStep.ACCOUNT_SEND: {
219
+ return /* @__PURE__ */ jsx(AccountSend, { step: "SEND_FORM" });
220
+ }
221
+ case ModalStep.ACCOUNT_SEND_ASSET: {
222
+ return /* @__PURE__ */ jsx(AccountSend, { step: "SEND_ASSET" });
223
+ }
224
+ case ModalStep.ACCOUNT_SEND_NETWORK: {
225
+ return /* @__PURE__ */ jsx(AccountSend, { step: "SEND_NETWORK" });
226
+ }
217
227
  default: {
218
228
  if (IFrameSteps.includes(currentStep)) {
219
229
  return null;
@@ -273,7 +283,7 @@ const Body = ({
273
283
  $step: currentStep,
274
284
  $isIFrameStep: IFrameSteps.includes(currentStep),
275
285
  children: [
276
- /* @__PURE__ */ jsx(NetworkSpeedBanner, { fontSize: "12px", iconSize: "16px" }),
286
+ !IFrameSteps.includes(currentStep) && /* @__PURE__ */ jsx(NetworkSpeedBanner, { fontSize: "12px", iconSize: "16px" }),
277
287
  Content(),
278
288
  (onRampConfig == null ? void 0 : onRampConfig.testMode) && [
279
289
  ModalStep.ADD_FUNDS_BUY,
@@ -295,7 +305,7 @@ const Body = ({
295
305
  modalError && /* @__PURE__ */ jsx(WarningBanner, { onClose: () => setModalError(void 0), children: renderTextWithLinks(modalError) })
296
306
  ]
297
307
  },
298
- ["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
308
+ ["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : ["ACCOUNT_SEND", "ACCOUNT_SEND_ASSET", "ACCOUNT_SEND_NETWORK"].includes(currentStep) ? "ACCOUNT_SEND" : currentStep
299
309
  )
300
310
  }
301
311
  ),
@@ -81,7 +81,10 @@ const useStepTitle = () => {
81
81
  [ModalStep.ADD_EX_WALLET_SELECTED]: "Add Wallet",
82
82
  [ModalStep.EXTERNAL_WALLET_VERIFICATION]: "Verify Wallet",
83
83
  [ModalStep.AWAITING_ACCOUNT]: isLogin ? "Login" : "Sign Up",
84
- [ModalStep.ACCOUNT_WALLET]: (_a2 = profileWallet == null ? void 0 : profileWallet.displayName) != null ? _a2 : "Wallet Settings"
84
+ [ModalStep.ACCOUNT_WALLET]: (_a2 = profileWallet == null ? void 0 : profileWallet.displayName) != null ? _a2 : "Wallet Settings",
85
+ [ModalStep.ACCOUNT_SEND]: "Send",
86
+ [ModalStep.ACCOUNT_SEND_ASSET]: "Send",
87
+ [ModalStep.ACCOUNT_SEND_NETWORK]: "Send"
85
88
  };
86
89
  },
87
90
  [isLogin, chainId, hideWallets, authStepTitle]
@@ -0,0 +1,9 @@
1
+ export declare function QuantityInput({ value, onChange, onFocus, onBlur, placeholder, size, symbol, }: {
2
+ value: string | null;
3
+ onFocus?: () => void;
4
+ onBlur?: () => void;
5
+ onChange: (_: string | null) => void;
6
+ placeholder?: string;
7
+ size?: string;
8
+ symbol?: string;
9
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,91 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { safeStyled } from "@getpara/react-common";
5
+ function QuantityInput({
6
+ value,
7
+ onChange,
8
+ onFocus,
9
+ onBlur,
10
+ placeholder,
11
+ size = "72px",
12
+ symbol
13
+ }) {
14
+ return /* @__PURE__ */ jsxs(Container, { style: { fontSize: size, position: "relative" }, children: [
15
+ symbol && /* @__PURE__ */ jsx(CurrencySign, { slot: "start", children: symbol }),
16
+ /* @__PURE__ */ jsx(
17
+ Input,
18
+ {
19
+ value: value != null ? value : "",
20
+ onFocus: (e) => {
21
+ e.currentTarget.select();
22
+ onFocus == null ? void 0 : onFocus();
23
+ },
24
+ onKeyDown: (e) => {
25
+ if (!/^(\d|\.)$/.test(e.key) && !["Delete", "Backspace", "Tab", "Shift", "ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) {
26
+ e.preventDefault();
27
+ }
28
+ },
29
+ onChange: (e) => {
30
+ const rawValue = e.currentTarget.value;
31
+ if (rawValue === "") {
32
+ onChange(null);
33
+ return;
34
+ }
35
+ const numericValue = rawValue.replace(/[^0-9.]/g, "");
36
+ if (numericValue === "") {
37
+ onChange(null);
38
+ return;
39
+ }
40
+ const isValidNumberFormat = /^\d*\.?\d*$/.test(numericValue);
41
+ if (isValidNumberFormat) {
42
+ onChange(numericValue);
43
+ } else {
44
+ onChange(null);
45
+ }
46
+ },
47
+ onBlur: (e) => {
48
+ const numericValue = (e.currentTarget.value || "").replace(/[^0-9.]/g, "");
49
+ if (numericValue === "") {
50
+ onChange(null);
51
+ } else {
52
+ const parsed = parseFloat(numericValue);
53
+ if (!isNaN(parsed)) {
54
+ onChange(parsed.toString());
55
+ } else {
56
+ onChange(null);
57
+ }
58
+ }
59
+ onBlur == null ? void 0 : onBlur();
60
+ },
61
+ placeholder: placeholder || "0"
62
+ }
63
+ )
64
+ ] });
65
+ }
66
+ const Container = safeStyled.div`
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ font-family: var(--cpsl-font-family);
71
+ color: var(--cpsl-color-text-primary);
72
+ `;
73
+ const CurrencySign = safeStyled.div`
74
+ position: relative;
75
+ left: 0px;
76
+ `;
77
+ const Input = safeStyled.input`
78
+ font-family: var(--cpsl-font-family);
79
+ font-size: inherit;
80
+ color: inherit;
81
+ background-color: transparent;
82
+ height: auto;
83
+ border-width: 0;
84
+ text-align: center;
85
+ width: 100%;
86
+ outline: none;
87
+ field-sizing: content;
88
+ `;
89
+ export {
90
+ QuantityInput
91
+ };
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from 'react';
2
+ type AssetItem = {
3
+ key: string;
4
+ icon: ReactNode;
5
+ text: ReactNode;
6
+ textSecondary?: ReactNode;
7
+ endText?: ReactNode;
8
+ endTextSecondary?: ReactNode;
9
+ };
10
+ export declare const contentMotionProps: {
11
+ transition: {
12
+ duration: number;
13
+ };
14
+ initial: {
15
+ opacity: number;
16
+ };
17
+ animate: {
18
+ opacity: number;
19
+ };
20
+ exit: {
21
+ opacity: number;
22
+ };
23
+ };
24
+ export declare function SearchableButtonList<T>({ items, transformItem, searchFilter, searchPlaceholder, onSelect, }: {
25
+ items: T[];
26
+ transformItem: (_: T) => AssetItem;
27
+ searchFilter?: (_: {
28
+ item: T;
29
+ searchStr: string;
30
+ }) => boolean;
31
+ searchPlaceholder?: string;
32
+ onSelect: (_: T) => void;
33
+ }): import("react/jsx-runtime").JSX.Element;
34
+ export {};
@@ -0,0 +1,223 @@
1
+ "use client";
2
+ import {
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "../../chunk-MMUBH76A.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import * as comp from "@getpara/react-components";
8
+ import { safeStyled } from "@getpara/react-common";
9
+ import { useState, useMemo, useRef, useEffect } from "react";
10
+ import { GradientScroll } from "./common.js";
11
+ import { AnimatePresence, motion } from "framer-motion";
12
+ const contentMotionProps = {
13
+ transition: { duration: 0.2 },
14
+ initial: { opacity: 0 },
15
+ animate: { opacity: 1 },
16
+ exit: { opacity: 0 }
17
+ };
18
+ const ESTIMATED_ITEM_HEIGHT = 72;
19
+ const VISIBILITY_BUFFER = 3;
20
+ function SearchableButtonList({
21
+ items,
22
+ transformItem,
23
+ searchFilter,
24
+ searchPlaceholder = "Search for an asset",
25
+ onSelect
26
+ }) {
27
+ const [searchStr, setSearchStr] = useState("");
28
+ const outerContainerRef = useRef(null);
29
+ const scrollContainerRef = useRef(null);
30
+ const [scrollTop, setScrollTop] = useState(0);
31
+ const [containerHeight, setContainerHeight] = useState(0);
32
+ const [contentHeight, setContentHeight] = useState(0);
33
+ const [renderedRange, setRenderedRange] = useState({ start: 0, end: 0 });
34
+ const transformedAndFiltered = useMemo(() => {
35
+ return items.filter((item) => !searchFilter || searchFilter({ item, searchStr })).map((item) => ({
36
+ assetItem: transformItem(item),
37
+ originalItem: item
38
+ }));
39
+ }, [items, searchFilter, searchStr, transformItem]);
40
+ useEffect(() => {
41
+ setRenderedRange({ start: 0, end: 0 });
42
+ }, [items, searchStr]);
43
+ const desiredRange = useMemo(() => {
44
+ if (containerHeight === 0) {
45
+ return { start: 0, end: transformedAndFiltered.length };
46
+ }
47
+ const startIndex = Math.max(0, Math.floor(scrollTop / ESTIMATED_ITEM_HEIGHT) - VISIBILITY_BUFFER);
48
+ const endIndex = Math.min(
49
+ transformedAndFiltered.length,
50
+ Math.ceil((scrollTop + containerHeight) / ESTIMATED_ITEM_HEIGHT) + VISIBILITY_BUFFER
51
+ );
52
+ return { start: startIndex, end: endIndex };
53
+ }, [scrollTop, containerHeight, transformedAndFiltered.length]);
54
+ useEffect(() => {
55
+ setRenderedRange((prev) => ({
56
+ start: Math.min(desiredRange.start, prev.start),
57
+ end: Math.max(desiredRange.end, prev.end)
58
+ }));
59
+ }, [desiredRange]);
60
+ const visibleRange = renderedRange;
61
+ const visibleItems = useMemo(() => {
62
+ return transformedAndFiltered.slice(visibleRange.start, visibleRange.end);
63
+ }, [transformedAndFiltered, visibleRange.start, visibleRange.end]);
64
+ useEffect(() => {
65
+ var _a, _b;
66
+ const container = (_b = (_a = scrollContainerRef.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.parentElement;
67
+ if (!container) return;
68
+ const updateDimensions = () => {
69
+ setContainerHeight(container.clientHeight);
70
+ setContentHeight(container.scrollHeight);
71
+ };
72
+ let scrollTimeout;
73
+ const handleScroll = () => {
74
+ if (scrollTimeout) {
75
+ cancelAnimationFrame(scrollTimeout);
76
+ }
77
+ scrollTimeout = requestAnimationFrame(() => {
78
+ setScrollTop(container.scrollTop);
79
+ });
80
+ };
81
+ updateDimensions();
82
+ container.addEventListener("scroll", handleScroll, { passive: true });
83
+ const resizeObserver = new ResizeObserver(updateDimensions);
84
+ resizeObserver.observe(container);
85
+ const contentDiv = scrollContainerRef.current;
86
+ if (contentDiv) {
87
+ const contentResizeObserver = new ResizeObserver(updateDimensions);
88
+ contentResizeObserver.observe(contentDiv);
89
+ return () => {
90
+ if (scrollTimeout) {
91
+ cancelAnimationFrame(scrollTimeout);
92
+ }
93
+ container.removeEventListener("scroll", handleScroll);
94
+ resizeObserver.disconnect();
95
+ contentResizeObserver.disconnect();
96
+ };
97
+ }
98
+ return () => {
99
+ if (scrollTimeout) {
100
+ cancelAnimationFrame(scrollTimeout);
101
+ }
102
+ container.removeEventListener("scroll", handleScroll);
103
+ resizeObserver.disconnect();
104
+ };
105
+ }, []);
106
+ const paddingTop = visibleRange.start * ESTIMATED_ITEM_HEIGHT;
107
+ const paddingBottom = Math.max(0, (transformedAndFiltered.length - visibleRange.end) * ESTIMATED_ITEM_HEIGHT);
108
+ const MAX_CONTAINER_HEIGHT = 480;
109
+ useEffect(() => {
110
+ var _a, _b;
111
+ const container = (_b = (_a = scrollContainerRef.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.parentElement;
112
+ if (container) {
113
+ requestAnimationFrame(() => {
114
+ setContentHeight(container.scrollHeight);
115
+ });
116
+ }
117
+ }, [visibleRange.start, visibleRange.end, transformedAndFiltered.length]);
118
+ const outerContainerHeight = useMemo(() => {
119
+ if (contentHeight === 0) {
120
+ return MAX_CONTAINER_HEIGHT;
121
+ }
122
+ const searchInputHeight = items.length >= 4 && !!searchFilter ? 56 : 0;
123
+ const totalNeededHeight = contentHeight + searchInputHeight;
124
+ if (totalNeededHeight < MAX_CONTAINER_HEIGHT) {
125
+ return totalNeededHeight + 4;
126
+ }
127
+ return MAX_CONTAINER_HEIGHT;
128
+ }, [contentHeight, items.length, searchFilter]);
129
+ return /* @__PURE__ */ jsxs(
130
+ "div",
131
+ {
132
+ ref: outerContainerRef,
133
+ style: {
134
+ display: "flex",
135
+ flexDirection: "column",
136
+ height: `${outerContainerHeight}px`,
137
+ maxHeight: `${MAX_CONTAINER_HEIGHT}px`,
138
+ overflow: "hidden"
139
+ },
140
+ children: [
141
+ items.length >= 4 && !!searchFilter && /* @__PURE__ */ jsx(
142
+ SearchInput,
143
+ {
144
+ placeholder: searchPlaceholder,
145
+ value: searchStr,
146
+ onCpslInput: (e) => {
147
+ setSearchStr(e.detail.value);
148
+ },
149
+ style: { marginBottom: "8px" },
150
+ children: /* @__PURE__ */ jsx(comp.CpslIcon, { icon: "search", slot: "start" })
151
+ }
152
+ ),
153
+ /* @__PURE__ */ jsx(GradientScroll, { height: "100%", gap: "8px", children: /* @__PURE__ */ jsx("div", { ref: scrollContainerRef, children: /* @__PURE__ */ jsx(List, { style: { paddingTop, paddingBottom }, children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "sync", children: visibleItems.map(({ assetItem, originalItem }) => {
154
+ const { key, icon, text, textSecondary, endText, endTextSecondary } = assetItem;
155
+ return /* @__PURE__ */ jsx(motion.li, __spreadProps(__spreadValues({ style: { width: "100%" } }, contentMotionProps), { children: /* @__PURE__ */ jsxs(AssetButton, { fullWidth: true, variant: "secondary", onClick: () => onSelect(originalItem), children: [
156
+ icon,
157
+ /* @__PURE__ */ jsxs(Info, { children: [
158
+ /* @__PURE__ */ jsx(Code, { color: "contrast", variant: "bodyL", children: text }),
159
+ textSecondary && /* @__PURE__ */ jsx(Name, { color: "contrast", variant: "bodyS", children: textSecondary })
160
+ ] }),
161
+ endText && /* @__PURE__ */ jsxs(End, { children: [
162
+ /* @__PURE__ */ jsx(EndText, { color: "primary", variant: "bodyM", children: endText }),
163
+ endTextSecondary && /* @__PURE__ */ jsx(EndTextSecondary, { color: "contrast", variant: "bodyS", children: endTextSecondary })
164
+ ] })
165
+ ] }) }), key);
166
+ }) }) }) }) })
167
+ ]
168
+ }
169
+ );
170
+ }
171
+ const List = safeStyled.ul`
172
+ display: flex;
173
+ flex-direction: column;
174
+ width: 100%;
175
+ gap: 8px;
176
+ list-style: none;
177
+ padding-inline-start: 0;
178
+ padding-inline-end: 0;
179
+ margin: 0;
180
+ `;
181
+ const AssetButton = safeStyled(comp.CpslButton)`
182
+ display: flex;
183
+ justify-content: center;
184
+ align-items: center;
185
+ gap: 8px;
186
+ --button-secondary-background-color: var(--cpsl-color-background-8);
187
+ --button-secondary-border-color: var(--cpsl-color-background-8);
188
+ --button-secondary-hover-background-color: var(--cpsl-color-background-16);
189
+ --button-secondary-hover-border-color: var(--cpsl-color-background-16);
190
+ `;
191
+ const Info = safeStyled(comp.CpslCol)`
192
+ text-align: left;
193
+ min-width: 0;
194
+ `, Code = comp.CpslText, Name = safeStyled(comp.CpslText)`
195
+ display: flex;
196
+ align-items: flex-start;
197
+ overflow: hidden;
198
+ text-overflow: ellipsis;
199
+ white-space: nowrap;
200
+ min-width: 0;
201
+ height: 20px;
202
+ `, EndText = safeStyled(comp.CpslText)`
203
+ overflow: hidden;
204
+ text-overflow: ellipsis;
205
+ white-space: nowrap;
206
+ min-width: 0;
207
+ `, EndTextSecondary = safeStyled(comp.CpslText)`
208
+ overflow: hidden;
209
+ `;
210
+ const End = safeStyled(comp.CpslCol)`
211
+ text-align: right;
212
+ align-items: flex-end;
213
+ gap: 4px;
214
+ min-width: 0;
215
+ `;
216
+ const SearchInput = safeStyled(comp.CpslInput)`
217
+ --container-background-color: var(--cpsl-color-background-8);
218
+ --input-background-color: transparent;
219
+ `;
220
+ export {
221
+ SearchableButtonList,
222
+ contentMotionProps
223
+ };
@@ -1,4 +1,10 @@
1
- export declare const WalletSelectOld: () => import("react/jsx-runtime").JSX.Element;
1
+ import { TWalletType } from '@getpara/web-sdk';
2
+ export declare const WalletSelectOld: ({ style, noTitle, types, isEmbeddedOnly, }: {
3
+ style?: React.CSSProperties;
4
+ noTitle?: boolean;
5
+ types?: TWalletType[];
6
+ isEmbeddedOnly?: boolean;
7
+ }) => import("react/jsx-runtime").JSX.Element;
2
8
  export declare const Select: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
3
9
  ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
4
10
  }, {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "../../../chunk-MMUBH76A.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- import { useEffect, useRef } from "react";
4
+ import { useEffect, useMemo, useRef } from "react";
5
5
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
6
6
  import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
7
7
  import { MOBILE_SIZE, safeStyled, useCopyToClipboard, WalletTypeIcon as WalletTypeIconBase } from "@getpara/react-common";
@@ -45,13 +45,21 @@ const Wallet = ({
45
45
  )
46
46
  ] });
47
47
  };
48
- const WalletSelectOld = () => {
48
+ const WalletSelectOld = ({
49
+ style,
50
+ noTitle,
51
+ types,
52
+ isEmbeddedOnly
53
+ }) => {
49
54
  const containerRef = useRef(null);
50
55
  const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
51
56
  const { setSelectedWallet } = useWalletState();
52
57
  const { data: activeWallet } = useWallet();
53
58
  const { embedded } = useAccount();
54
- const availableWallets = embedded == null ? void 0 : embedded.wallets;
59
+ const availableWallets = useMemo(() => {
60
+ var _a;
61
+ return (_a = embedded == null ? void 0 : embedded.wallets) == null ? void 0 : _a.filter((wallet) => !isEmbeddedOnly || !wallet.isExternal);
62
+ }, [embedded, isEmbeddedOnly]);
55
63
  const isMultiWallet = availableWallets && availableWallets.length > 1;
56
64
  const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsx(Wallet, { withCopy: true, wallet: activeWallet, slot: "selected-item", withIcon: true }) : null;
57
65
  useEffect(() => {
@@ -59,9 +67,9 @@ const WalletSelectOld = () => {
59
67
  resize();
60
68
  }
61
69
  }, [activeWallet, availableWallets, dropdownMaxHeight]);
62
- return /* @__PURE__ */ jsxs(Container, { children: [
63
- isMultiWallet && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "semiBold", children: "Select Wallet" }),
64
- /* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "addressInputContainerOld", children: /* @__PURE__ */ jsxs(
70
+ return /* @__PURE__ */ jsxs(Container, { style, children: [
71
+ isMultiWallet && !noTitle && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "semiBold", children: "Select Wallet" }),
72
+ /* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "addressInputContainerOld", style: { width: "100%" }, children: /* @__PURE__ */ jsxs(
65
73
  Select,
66
74
  {
67
75
  selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
@@ -78,9 +86,10 @@ const WalletSelectOld = () => {
78
86
  selectedItemVariant: "bodyXS",
79
87
  icon: isMultiWallet ? "chevronUp" : null,
80
88
  disabled: !isMultiWallet,
89
+ style: { width: "100%" },
81
90
  children: [
82
91
  activeWallet && ActiveWalletNode,
83
- (availableWallets || []).map((wallet) => {
92
+ (availableWallets || []).filter((wallet) => !types || !wallet.type || types.includes(wallet.type)).map((wallet) => {
84
93
  const key = getValue(wallet.id, wallet.type);
85
94
  return /* @__PURE__ */ jsx(SelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsx(Wallet, { wallet, withIcon: true }) }, key);
86
95
  })
@@ -10,7 +10,7 @@ export declare const FullWidthFilledDisabledInput: typeof CpslInput;
10
10
  export declare const CenteredText: typeof CpslText;
11
11
  export declare const InnerStepContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
12
12
  export declare const StepContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
13
- ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
13
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
14
14
  }, {
15
15
  $wide?: boolean;
16
16
  }>> & string;
@@ -59,3 +59,6 @@ export declare function GradientScroll({ height, gap, children }: PropsWithChild
59
59
  export declare const HeroGenericIcon: ({ accountType }: {
60
60
  accountType: "EMAIL" | "PHONE";
61
61
  }) => import("react/jsx-runtime").JSX.Element;
62
+ export * from './SearchableButtonList.js';
63
+ export * from './QuantityInput.js';
64
+ export { AnimatedHeightWrapper } from './Body/AnimatedHeightWrapper.js';
@@ -217,7 +217,7 @@ function GradientScroll({ height, gap, children }) {
217
217
  const onScroll = () => {
218
218
  if (ref.current) {
219
219
  const { scrollTop, scrollHeight, clientHeight } = ref.current;
220
- if (height && scrollHeight <= parseInt(height)) {
220
+ if (scrollHeight <= clientHeight) {
221
221
  setIsNotAtTop(false);
222
222
  setIsNotAtBottom(false);
223
223
  } else {
@@ -228,6 +228,15 @@ function GradientScroll({ height, gap, children }) {
228
228
  };
229
229
  useEffect(() => {
230
230
  onScroll();
231
+ const resizeObserver = new ResizeObserver(() => {
232
+ onScroll();
233
+ });
234
+ if (ref.current) {
235
+ resizeObserver.observe(ref.current);
236
+ }
237
+ return () => {
238
+ resizeObserver.disconnect();
239
+ };
231
240
  }, []);
232
241
  return /* @__PURE__ */ jsx(
233
242
  GradientScrollContainer,
@@ -267,8 +276,12 @@ const Avatar = safeStyled.div`
267
276
  justify-content: center;
268
277
  background-color: var(--cpsl-color-background-8);
269
278
  `;
279
+ export * from "./SearchableButtonList.js";
280
+ export * from "./QuantityInput.js";
281
+ import { AnimatedHeightWrapper } from "./Body/AnimatedHeightWrapper.js";
270
282
  export {
271
283
  AccountTypeIcon,
284
+ AnimatedHeightWrapper,
272
285
  AssetIcon,
273
286
  CenteredText,
274
287
  ErrorContainer,