@deframe-sdk/components 0.1.6 → 0.1.7

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/dist/index.mjs CHANGED
@@ -3,8 +3,9 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import * as React6 from 'react';
4
4
  import React6__default, { useState, useEffect, useMemo } from 'react';
5
5
  import { motion, AnimatePresence } from 'framer-motion';
6
- import { MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdClose } from 'react-icons/md';
6
+ import { MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdClose, MdOutlineSearch, MdOutlineSearchOff, MdOutlineSwapHoriz } from 'react-icons/md';
7
7
  import { HiChevronUp, HiChevronDown, HiChevronLeft, HiXMark, HiArrowRight } from 'react-icons/hi2';
8
+ import { IoAlertCircleOutline, IoTimeOutline, IoCheckmarkOutline } from 'react-icons/io5';
8
9
 
9
10
  var __defProp = Object.defineProperty;
10
11
  var __defProps = Object.defineProperties;
@@ -2537,7 +2538,841 @@ var StrategyDetailsView = ({
2537
2538
  /* @__PURE__ */ jsx("div", { "data-test-id": "strategy-details-footer", className: "sticky bottom-0 left-0 right-0 border-t border-border-subtle dark:border-border-subtle-dark px-md py-md", children: /* @__PURE__ */ jsx(PrimaryButton, { onClick: onDeposit, className: "w-full", children: depositButtonLabel }) })
2538
2539
  ] });
2539
2540
  };
2541
+ var ProgressIndicator = ({
2542
+ progress,
2543
+ className = ""
2544
+ }) => {
2545
+ const clampedProgress = Math.min(100, Math.max(0, progress));
2546
+ return /* @__PURE__ */ jsx("div", { className: `relative h-[12px] w-full ${className}`, children: /* @__PURE__ */ jsxs("div", { className: "absolute left-0 right-0 top-1/2 -translate-y-1/2 flex items-center", children: [
2547
+ /* @__PURE__ */ jsx(
2548
+ "div",
2549
+ {
2550
+ className: "h-[4px] bg-brand-primary rounded-lg transition-all duration-300",
2551
+ style: { width: `${clampedProgress}%` }
2552
+ }
2553
+ ),
2554
+ /* @__PURE__ */ jsx("div", { className: "flex-1 h-[4px] bg-bg-muted dark:bg-bg-muted-dark rounded-lg ml-1" })
2555
+ ] }) });
2556
+ };
2557
+ var LoadingDots = ({ className = "" }) => {
2558
+ return /* @__PURE__ */ jsxs("span", { className: `flex gap-0.5 ${className}`, children: [
2559
+ /* @__PURE__ */ jsx("span", { className: "animate-bounce", style: { animationDelay: "0ms", animationDuration: "1.4s" }, children: "." }),
2560
+ /* @__PURE__ */ jsx("span", { className: "animate-bounce", style: { animationDelay: "200ms", animationDuration: "1.4s" }, children: "." }),
2561
+ /* @__PURE__ */ jsx("span", { className: "animate-bounce", style: { animationDelay: "400ms", animationDuration: "1.4s" }, children: "." })
2562
+ ] });
2563
+ };
2564
+ var SearchInput = ({
2565
+ placeholder = "Search",
2566
+ value: controlledValue,
2567
+ disabled = false,
2568
+ onChange,
2569
+ onSearch,
2570
+ className = "",
2571
+ inputClassName,
2572
+ autoFocus = false,
2573
+ containerTestId,
2574
+ inputTestId
2575
+ }) => {
2576
+ const [internalValue, setInternalValue] = useState(controlledValue || "");
2577
+ useEffect(() => {
2578
+ if (controlledValue !== void 0) {
2579
+ setInternalValue(controlledValue);
2580
+ }
2581
+ }, [controlledValue]);
2582
+ const handleInputChange = (newValue) => {
2583
+ setInternalValue(newValue);
2584
+ onChange == null ? void 0 : onChange(newValue);
2585
+ onSearch == null ? void 0 : onSearch(newValue);
2586
+ };
2587
+ return /* @__PURE__ */ jsxs("div", { className: `flex-1 flex items-center relative ${className}`, "data-testid": containerTestId, children: [
2588
+ /* @__PURE__ */ jsx(
2589
+ "input",
2590
+ {
2591
+ "data-testid": inputTestId,
2592
+ type: "text",
2593
+ value: internalValue,
2594
+ placeholder,
2595
+ disabled,
2596
+ autoFocus,
2597
+ onChange: (e) => handleInputChange(e.target.value),
2598
+ className: [
2599
+ "w-full h-full rounded p-4 pr-12 leading-normal tracking-wide",
2600
+ !inputClassName ? "bg-bg-subtle dark:bg-bg-subtle-dark" : "",
2601
+ "placeholder:text-text-disabled dark:placeholder:text-text-disabled-dark text-text-primary dark:text-text-primary-dark",
2602
+ "focus:outline-none focus:ring-2 focus:ring-brand-primary",
2603
+ disabled ? "cursor-not-allowed opacity-50" : "",
2604
+ inputClassName || ""
2605
+ ].filter(Boolean).join(" ")
2606
+ }
2607
+ ),
2608
+ /* @__PURE__ */ jsx(MdOutlineSearch, { className: "w-4 h-4 text-text-secondary absolute right-4" })
2609
+ ] });
2610
+ };
2611
+ var SearchEmptyState = ({
2612
+ title,
2613
+ description
2614
+ }) => {
2615
+ return /* @__PURE__ */ jsx("div", { className: "w-full py-md bg-bg-default dark:bg-bg-default-dark rounded-lg flex flex-col justify-center items-center gap-sm h-full", children: /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col justify-center items-center gap-md py-20", children: [
2616
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center items-center gap-md text-center", children: [
2617
+ /* @__PURE__ */ jsx("div", { className: "w-20 h-20 bg-bg-muted dark:bg-bg-muted-dark rounded-full flex justify-center items-center", children: /* @__PURE__ */ jsx(MdOutlineSearchOff, { className: "w-10 h-10 text-text-tertiary dark:text-text-tertiary-dark" }) }),
2618
+ /* @__PURE__ */ jsx(TextHeading_default, { variant: "h3", children: title })
2619
+ ] }),
2620
+ /* @__PURE__ */ jsx("div", { className: "self-stretch text-center", children: /* @__PURE__ */ jsx(TextBody_default, { variant: "text-small", children: description }) })
2621
+ ] }) });
2622
+ };
2623
+ var CollapsibleSection = ({
2624
+ title,
2625
+ subtitle,
2626
+ children,
2627
+ defaultOpen = false,
2628
+ open: controlledOpen,
2629
+ onOpenChange,
2630
+ className = "",
2631
+ collapseText,
2632
+ expandText
2633
+ }) => {
2634
+ const [internalOpen, setInternalOpen] = React6__default.useState(defaultOpen);
2635
+ const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
2636
+ const handleToggle = () => {
2637
+ const newOpenState = !isOpen;
2638
+ if (controlledOpen === void 0) {
2639
+ setInternalOpen(newOpenState);
2640
+ }
2641
+ onOpenChange == null ? void 0 : onOpenChange(newOpenState);
2642
+ };
2643
+ return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-sm w-full ${className}`, children: [
2644
+ /* @__PURE__ */ jsxs(
2645
+ "button",
2646
+ {
2647
+ type: "button",
2648
+ onClick: handleToggle,
2649
+ className: "flex items-center justify-between w-full text-left cursor-pointer",
2650
+ "aria-expanded": isOpen,
2651
+ "aria-label": `${isOpen ? collapseText : expandText} ${title}`,
2652
+ children: [
2653
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-xs", children: /* @__PURE__ */ jsx(TextBody_default, { className: "text-white font-medium", children: title }) }),
2654
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-xs", children: [
2655
+ subtitle && /* @__PURE__ */ jsx(TextBody_default, { variant: "text-small", children: subtitle }),
2656
+ /* @__PURE__ */ jsx(
2657
+ motion.svg,
2658
+ {
2659
+ className: "w-5 h-5 text-gray-400",
2660
+ fill: "none",
2661
+ stroke: "currentColor",
2662
+ viewBox: "0 0 24 24",
2663
+ animate: { rotate: isOpen ? 180 : 0 },
2664
+ transition: { duration: 0.2, ease: "easeInOut" },
2665
+ children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 9l7 7 7-7" })
2666
+ }
2667
+ )
2668
+ ] })
2669
+ ]
2670
+ }
2671
+ ),
2672
+ /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsx(
2673
+ motion.div,
2674
+ {
2675
+ initial: { height: 0, opacity: 0 },
2676
+ animate: { height: "auto", opacity: 1 },
2677
+ exit: { height: 0, opacity: 0 },
2678
+ transition: { duration: 0.2, ease: "easeInOut" },
2679
+ style: { overflow: "hidden" },
2680
+ children
2681
+ }
2682
+ ) })
2683
+ ] });
2684
+ };
2685
+ var TransactionScreenIcon = ({
2686
+ type,
2687
+ gradient = "linear-gradient(135deg, #F6A700 0%, #F59E0B 100%)"
2688
+ }) => {
2689
+ if (type === "success") {
2690
+ return /* @__PURE__ */ jsx("div", { className: "relative w-20 h-20", children: /* @__PURE__ */ jsx("div", { className: "w-full h-full rounded-full bg-brand-primary flex items-center justify-center", children: /* @__PURE__ */ jsx("svg", { className: "w-8 h-8 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) }) }) });
2691
+ }
2692
+ if (type === "warning") {
2693
+ return /* @__PURE__ */ jsx("div", { className: "relative w-[83px] h-[83px]", children: /* @__PURE__ */ jsx("div", { className: "w-full h-full rounded-full flex items-center justify-center", style: { background: gradient }, children: /* @__PURE__ */ jsx("svg", { className: "w-8 h-8 text-bg-default dark:text-bg-default-dark", fill: "currentColor", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M16 5.33334C15.6444 5.33334 15.3111 5.51112 15.1111 5.8L5.11112 21.8C4.91112 22.0889 4.91112 22.4667 5.11112 22.7556C5.31112 23.0444 5.64445 23.2222 6.00001 23.2222H26C26.3556 23.2222 26.6889 23.0444 26.8889 22.7556C27.0889 22.4667 27.0889 22.0889 26.8889 21.8L16.8889 5.8C16.6889 5.51112 16.3556 5.33334 16 5.33334ZM16 10.6667C16.5333 10.6667 17 11.1333 17 11.6667V16C17 16.5333 16.5333 17 16 17C15.4667 17 15 16.5333 15 16V11.6667C15 11.1333 15.4667 10.6667 16 10.6667ZM16 19.3333C16.7333 19.3333 17.3333 19.9333 17.3333 20.6667C17.3333 21.4 16.7333 22 16 22C15.2667 22 14.6667 21.4 14.6667 20.6667C14.6667 19.9333 15.2667 19.3333 16 19.3333Z" }) }) }) });
2694
+ }
2695
+ return /* @__PURE__ */ jsx("div", { className: "relative w-[83px] h-[83px]", children: /* @__PURE__ */ jsx("div", { className: "w-full h-full rounded-full flex items-center justify-center", style: { background: gradient }, children: /* @__PURE__ */ jsx("svg", { width: "11", height: "10", viewBox: "0 0 11 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "w-8 h-8 text-white", children: /* @__PURE__ */ jsx("path", { d: "M3.66659 8.33301H7.33325V7.08301C7.33325 6.62468 7.15374 6.23231 6.79471 5.90593C6.43568 5.57954 6.00409 5.41634 5.49992 5.41634C4.99575 5.41634 4.56415 5.57954 4.20513 5.90593C3.8461 6.23231 3.66659 6.62468 3.66659 7.08301V8.33301ZM5.49992 4.58301C6.00409 4.58301 6.43568 4.41981 6.79471 4.09342C7.15374 3.76704 7.33325 3.37467 7.33325 2.91634V1.66634H3.66659V2.91634C3.66659 3.37467 3.8461 3.76704 4.20513 4.09342C4.56415 4.41981 4.99575 4.58301 5.49992 4.58301ZM2.29159 9.16634C2.16172 9.16634 2.05287 9.12641 1.96502 9.04655C1.87718 8.96669 1.83325 8.86773 1.83325 8.74968C1.83325 8.63162 1.87718 8.53266 1.96502 8.4528C2.05287 8.37294 2.16172 8.33301 2.29159 8.33301H2.74992V7.08301C2.74992 6.6594 2.85877 6.26183 3.07648 5.8903C3.29419 5.51877 3.59784 5.2219 3.98742 4.99967C3.59784 4.77745 3.29419 4.48058 3.07648 4.10905C2.85877 3.73752 2.74992 3.33995 2.74992 2.91634V1.66634H2.29159C2.16172 1.66634 2.05287 1.62641 1.96502 1.54655C1.87718 1.46669 1.83325 1.36773 1.83325 1.24967C1.83325 1.13162 1.87718 1.03266 1.96502 0.952799C2.05287 0.872938 2.16172 0.833008 2.29159 0.833008H8.70825C8.83811 0.833008 8.94697 0.872938 9.03481 0.952799C9.12266 1.03266 9.16659 1.13162 9.16659 1.24967C9.16659 1.36773 9.12266 1.46669 9.03481 1.54655C8.94697 1.62641 8.83811 1.66634 8.70825 1.66634H8.24992V2.91634C8.24992 3.33995 8.14106 3.73752 7.92336 4.10905C7.70565 4.48058 7.402 4.77745 7.01242 4.99967C7.402 5.2219 7.70565 5.51877 7.92336 5.8903C8.14106 6.26183 8.24992 6.6594 8.24992 7.08301V8.33301H8.70825C8.83811 8.33301 8.94697 8.37294 9.03481 8.4528C9.12266 8.53266 9.16659 8.63162 9.16659 8.74968C9.16659 8.86773 9.12266 8.96669 9.03481 9.04655C8.94697 9.12641 8.83811 9.16634 8.70825 9.16634H2.29159Z", fill: "currentColor" }) }) }) });
2696
+ };
2697
+ var TransactionScreen = ({
2698
+ progress,
2699
+ iconType,
2700
+ iconGradient,
2701
+ title,
2702
+ description,
2703
+ onClose,
2704
+ onBack,
2705
+ backTitle = "",
2706
+ actions,
2707
+ children,
2708
+ testId
2709
+ }) => {
2710
+ return /* @__PURE__ */ jsx(BackgroundContainer, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
2711
+ onBack && /* @__PURE__ */ jsx(DetailsHeader, { title: backTitle, onBack }),
2712
+ onClose && /* @__PURE__ */ jsx("div", { "data-testid": testId, className: "flex justify-start px-md pt-md", children: /* @__PURE__ */ jsx(CloseButton, { onClick: onClose }) }),
2713
+ /* @__PURE__ */ jsx("div", { className: "w-full px-md pt-sm", children: /* @__PURE__ */ jsx(ProgressIndicator, { progress }) }),
2714
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto px-md py-lg flex flex-col gap-lg", children: [
2715
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-md pt-lg", children: [
2716
+ /* @__PURE__ */ jsx(TransactionScreenIcon, { type: iconType, gradient: iconGradient }),
2717
+ /* @__PURE__ */ jsx(TextHeading_default, { variant: "h-large", children: title }),
2718
+ /* @__PURE__ */ jsx("div", { className: "text-text-md-mobile font-poppins text-text-secondary dark:text-text-secondary-dark text-center", style: { maxWidth: "350px" }, children: description })
2719
+ ] }),
2720
+ children,
2721
+ /* @__PURE__ */ jsx("div", { className: "flex-1" })
2722
+ ] }),
2723
+ actions && /* @__PURE__ */ jsx("div", { className: "px-md pb-md", children: actions })
2724
+ ] }) });
2725
+ };
2726
+ var TransactionScreenInvestmentCard = ({
2727
+ strategyName,
2728
+ apyLabel,
2729
+ apyValue,
2730
+ iconSrc,
2731
+ iconAlt,
2732
+ amountUSD,
2733
+ amountToken
2734
+ }) => {
2735
+ const [hasImageError, setHasImageError] = React6__default.useState(false);
2736
+ React6__default.useEffect(() => {
2737
+ setHasImageError(false);
2738
+ }, [iconSrc]);
2739
+ const shouldShowImage = Boolean(iconSrc) && !hasImageError;
2740
+ const fallbackLabel = (iconAlt || "?").slice(0, 1).toUpperCase();
2741
+ return /* @__PURE__ */ jsx(SectionCard, { className: "!p-[22px]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2742
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-xs", children: [
2743
+ /* @__PURE__ */ jsx("div", { className: "text-accent-lg-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: strategyName }),
2744
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
2745
+ apyLabel,
2746
+ " ",
2747
+ /* @__PURE__ */ jsx(TextBody_default, { as: "span", className: "text-state-success", children: apyValue })
2748
+ ] })
2749
+ ] }),
2750
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-sm", children: [
2751
+ /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-full bg-bg-muted dark:bg-bg-muted-dark flex items-center justify-center", children: shouldShowImage ? /* @__PURE__ */ jsx("img", { src: iconSrc, alt: iconAlt, className: "w-6 h-6 rounded-full", onError: () => setHasImageError(true) }) : /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-text-secondary dark:text-text-secondary-dark", children: fallbackLabel }) }),
2752
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end", children: [
2753
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: amountUSD }),
2754
+ /* @__PURE__ */ jsx("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: amountToken })
2755
+ ] })
2756
+ ] })
2757
+ ] }) });
2758
+ };
2759
+ function StepStatusIcon({ status }) {
2760
+ switch (status) {
2761
+ case "completed":
2762
+ return /* @__PURE__ */ jsx("div", { className: "w-6 h-6 rounded-full bg-bg-muted dark:bg-bg-muted-dark flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx(IoCheckmarkOutline, { className: "w-4 h-4", style: { color: "var(--color-state-success, #2BA176)" } }) });
2763
+ case "processing":
2764
+ return /* @__PURE__ */ jsx("div", { className: "w-6 h-6 rounded-full bg-bg-muted dark:bg-bg-muted-dark flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx(IoTimeOutline, { className: "w-4 h-4", style: { color: "var(--color-state-warning, #F6A700)" } }) });
2765
+ case "failed":
2766
+ return /* @__PURE__ */ jsx("div", { className: "w-6 h-6 rounded-full bg-bg-muted dark:bg-bg-muted-dark flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx(IoAlertCircleOutline, { className: "w-4 h-4", style: { color: "var(--color-state-error, #FF4D4F)" } }) });
2767
+ }
2768
+ }
2769
+ function StepStatusText({
2770
+ step,
2771
+ completedText,
2772
+ processingText,
2773
+ failedText,
2774
+ viewOnExplorerText
2775
+ }) {
2776
+ if (step.statusText) {
2777
+ const textColorClass2 = step.status === "completed" ? "text-text-primary dark:text-text-primary-dark" : step.status === "processing" ? "text-text-secondary dark:text-text-secondary-dark" : step.status === "failed" ? "text-state-error" : "text-text-disabled dark:text-text-disabled-dark";
2778
+ return /* @__PURE__ */ jsx("span", { className: `text-sm ${textColorClass2}`, children: step.statusText });
2779
+ }
2780
+ if (step.status === "completed" && step.explorerUrl) {
2781
+ return /* @__PURE__ */ jsx(
2782
+ "a",
2783
+ {
2784
+ href: step.explorerUrl,
2785
+ target: "_blank",
2786
+ rel: "noopener noreferrer",
2787
+ className: "text-sm text-brand-primary dark:text-brand-primary-dark underline hover:no-underline",
2788
+ children: viewOnExplorerText
2789
+ }
2790
+ );
2791
+ }
2792
+ const defaultText = step.status === "completed" ? completedText : step.status === "processing" ? processingText : failedText;
2793
+ const textColorClass = step.status === "completed" ? "text-text-primary dark:text-text-primary-dark" : step.status === "processing" ? "text-text-secondary dark:text-text-secondary-dark" : "text-state-error";
2794
+ return /* @__PURE__ */ jsx("span", { className: `text-sm ${textColorClass}`, children: defaultText });
2795
+ }
2796
+ function StepDisplay({ step, completedText, processingText, failedText, viewOnExplorerText }) {
2797
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4 w-full", children: [
2798
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-text-primary dark:text-text-primary-dark font-medium", children: step.label }) }),
2799
+ /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: step.value ? /* @__PURE__ */ jsx("span", { className: "text-sm text-text-secondary dark:text-text-secondary-dark", children: step.value }) : /* @__PURE__ */ jsx(StepStatusText, { step, completedText, processingText, failedText, viewOnExplorerText }) })
2800
+ ] });
2801
+ }
2802
+ function TransactionProcessingDetails({
2803
+ steps,
2804
+ className = "bg-bg-subtle dark:bg-bg-subtle-dark lg:!bg-bg-raised",
2805
+ defaultOpen = true,
2806
+ labels
2807
+ }) {
2808
+ if (!steps || steps.length === 0) {
2809
+ return null;
2810
+ }
2811
+ const getProcessingSteps = () => {
2812
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col w-full", children: steps.map((step, index) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
2813
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
2814
+ step.status && /* @__PURE__ */ jsx(StepStatusIcon, { status: step.status }),
2815
+ index < steps.length - 1 && step.status && /* @__PURE__ */ jsx("div", { className: "w-px flex-1 min-h-[16px] bg-white my-1" })
2816
+ ] }),
2817
+ /* @__PURE__ */ jsx("div", { className: "flex-1 pb-2 min-w-0", children: /* @__PURE__ */ jsx(StepDisplay, { step, completedText: labels.completedText, processingText: labels.processingText, failedText: labels.failedText, viewOnExplorerText: labels.viewOnExplorerText }) })
2818
+ ] }, `step-${index}`)) });
2819
+ };
2820
+ const items = [
2821
+ {
2822
+ label: "",
2823
+ value: getProcessingSteps(),
2824
+ valueClassName: "flex flex-col gap-0 w-full"
2825
+ }
2826
+ ];
2827
+ return /* @__PURE__ */ jsx(
2828
+ SummaryDetails,
2829
+ {
2830
+ title: labels.title,
2831
+ items,
2832
+ defaultOpen,
2833
+ className
2834
+ }
2835
+ );
2836
+ }
2837
+ var TokenWithChainBadge = ({
2838
+ tokenLogoUrl,
2839
+ tokenAlt,
2840
+ chainLogoUrl,
2841
+ chainName
2842
+ }) => {
2843
+ const fallbackText = encodeURIComponent((tokenAlt || "TOK").slice(0, 3).toUpperCase());
2844
+ const fallbackSrc = `https://placehold.co/40x40?text=${fallbackText}`;
2845
+ return /* @__PURE__ */ jsxs("div", { className: "relative w-10 h-10", children: [
2846
+ /* @__PURE__ */ jsx(
2847
+ "img",
2848
+ {
2849
+ src: tokenLogoUrl || fallbackSrc,
2850
+ alt: tokenAlt || "",
2851
+ className: "object-cover w-10 h-10 rounded-full",
2852
+ onError: (e) => {
2853
+ e.target.src = fallbackSrc;
2854
+ }
2855
+ }
2856
+ ),
2857
+ chainLogoUrl && /* @__PURE__ */ jsx(
2858
+ "img",
2859
+ {
2860
+ src: chainLogoUrl,
2861
+ alt: chainName,
2862
+ className: "absolute object-cover w-6 h-6 p-px bg-white border rounded-full -bottom-1 -right-1 border-bg-default",
2863
+ onError: (e) => {
2864
+ e.target.style.display = "none";
2865
+ }
2866
+ }
2867
+ )
2868
+ ] });
2869
+ };
2870
+ var SwapProcessingView = ({
2871
+ fromTokenSymbol,
2872
+ fromTokenIcon,
2873
+ toTokenSymbol,
2874
+ toTokenIcon,
2875
+ formattedInputAmount,
2876
+ formattedOutputAmount,
2877
+ formattedInputAmountUSD,
2878
+ formattedOutputAmountUSD,
2879
+ progress,
2880
+ transactionSteps,
2881
+ onClose,
2882
+ onGoToHistory,
2883
+ titleText,
2884
+ descriptionPrefix,
2885
+ activityHistoryText,
2886
+ processingDetailsLabels
2887
+ }) => {
2888
+ return /* @__PURE__ */ jsxs(
2889
+ TransactionScreen,
2890
+ {
2891
+ testId: "swap-processing-screen",
2892
+ onClose,
2893
+ progress,
2894
+ iconType: "processing",
2895
+ title: /* @__PURE__ */ jsx("span", { "data-testid": "swap-processing-title", children: titleText }),
2896
+ description: /* @__PURE__ */ jsxs(Fragment, { children: [
2897
+ descriptionPrefix,
2898
+ " ",
2899
+ /* @__PURE__ */ jsxs(
2900
+ "span",
2901
+ {
2902
+ className: "font-semibold underline underline-offset-2 cursor-pointer text-brand-primary",
2903
+ onClick: onGoToHistory,
2904
+ children: [
2905
+ activityHistoryText,
2906
+ "."
2907
+ ]
2908
+ }
2909
+ )
2910
+ ] }),
2911
+ children: [
2912
+ /* @__PURE__ */ jsx(SectionCard, { className: "!p-[22px]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full relative px-md", children: [
2913
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
2914
+ /* @__PURE__ */ jsx("img", { src: fromTokenIcon, alt: fromTokenSymbol, className: "w-8 h-8 rounded-full" }),
2915
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
2916
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
2917
+ formattedInputAmount,
2918
+ " ",
2919
+ fromTokenSymbol
2920
+ ] }),
2921
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedInputAmountUSD })
2922
+ ] })
2923
+ ] }),
2924
+ /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-brand-secondary rounded-full p-2 shadow-md z-10", children: /* @__PURE__ */ jsx(MdOutlineSwapHoriz, { className: "w-5 h-5" }) }),
2925
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
2926
+ /* @__PURE__ */ jsx("img", { src: toTokenIcon, alt: toTokenSymbol, className: "w-8 h-8 rounded-full" }),
2927
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
2928
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
2929
+ "~",
2930
+ formattedOutputAmount,
2931
+ " ",
2932
+ toTokenSymbol
2933
+ ] }),
2934
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedOutputAmountUSD })
2935
+ ] })
2936
+ ] })
2937
+ ] }) }),
2938
+ /* @__PURE__ */ jsx(
2939
+ TransactionProcessingDetails,
2940
+ {
2941
+ steps: transactionSteps,
2942
+ className: "bg-bg-subtle dark:bg-bg-subtle-dark lg:!bg-bg-raised dark:lg:!bg-bg-raised-dark",
2943
+ labels: processingDetailsLabels
2944
+ }
2945
+ )
2946
+ ]
2947
+ }
2948
+ );
2949
+ };
2950
+ var SwapCrossChainProcessingView = ({
2951
+ fromTokenSymbol,
2952
+ fromTokenIcon,
2953
+ toTokenSymbol,
2954
+ toTokenIcon,
2955
+ originChainId,
2956
+ destinationChainId,
2957
+ originChainLogoUrl,
2958
+ originChainName,
2959
+ destinationChainLogoUrl,
2960
+ destinationChainName,
2961
+ formattedInputAmount,
2962
+ formattedOutputAmount,
2963
+ formattedInputAmountUSD,
2964
+ formattedOutputAmountUSD,
2965
+ progress,
2966
+ title,
2967
+ description,
2968
+ transactionSteps,
2969
+ onClose,
2970
+ onGoToHistory,
2971
+ viewHistoryText,
2972
+ processingDetailsLabels
2973
+ }) => {
2974
+ return /* @__PURE__ */ jsxs(
2975
+ TransactionScreen,
2976
+ {
2977
+ onClose,
2978
+ progress,
2979
+ iconType: "processing",
2980
+ title,
2981
+ description: /* @__PURE__ */ jsxs(Fragment, { children: [
2982
+ description,
2983
+ " ",
2984
+ /* @__PURE__ */ jsx(
2985
+ "span",
2986
+ {
2987
+ className: "font-semibold underline cursor-pointer underline-offset-2 text-brand-primary",
2988
+ onClick: onGoToHistory,
2989
+ children: viewHistoryText
2990
+ }
2991
+ ),
2992
+ "."
2993
+ ] }),
2994
+ children: [
2995
+ /* @__PURE__ */ jsx(SectionCard, { className: "!p-[22px]", children: /* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-between w-full px-md", children: [
2996
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
2997
+ /* @__PURE__ */ jsx(
2998
+ TokenWithChainBadge,
2999
+ {
3000
+ tokenLogoUrl: fromTokenIcon,
3001
+ tokenAlt: fromTokenSymbol,
3002
+ chainId: originChainId,
3003
+ chainLogoUrl: originChainLogoUrl,
3004
+ chainName: originChainName
3005
+ }
3006
+ ),
3007
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
3008
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
3009
+ formattedInputAmount,
3010
+ " ",
3011
+ fromTokenSymbol
3012
+ ] }),
3013
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedInputAmountUSD })
3014
+ ] })
3015
+ ] }),
3016
+ /* @__PURE__ */ jsx("div", { className: "absolute z-10 p-2 -translate-x-1/2 -translate-y-1/2 rounded-full shadow-md left-1/2 top-1/2 bg-brand-secondary", children: /* @__PURE__ */ jsx(MdOutlineSwapHoriz, { className: "w-5 h-5" }) }),
3017
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
3018
+ /* @__PURE__ */ jsx(
3019
+ TokenWithChainBadge,
3020
+ {
3021
+ tokenLogoUrl: toTokenIcon,
3022
+ tokenAlt: toTokenSymbol,
3023
+ chainId: destinationChainId,
3024
+ chainLogoUrl: destinationChainLogoUrl,
3025
+ chainName: destinationChainName
3026
+ }
3027
+ ),
3028
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
3029
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
3030
+ "~",
3031
+ formattedOutputAmount,
3032
+ " ",
3033
+ toTokenSymbol
3034
+ ] }),
3035
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedOutputAmountUSD })
3036
+ ] })
3037
+ ] })
3038
+ ] }) }),
3039
+ /* @__PURE__ */ jsx(
3040
+ TransactionProcessingDetails,
3041
+ {
3042
+ steps: transactionSteps,
3043
+ className: "bg-bg-subtle dark:bg-bg-subtle-dark lg:!bg-bg-raised dark:lg:!bg-bg-raised-dark",
3044
+ labels: processingDetailsLabels
3045
+ }
3046
+ )
3047
+ ]
3048
+ }
3049
+ );
3050
+ };
3051
+ var SwapSignatureWarningView = ({
3052
+ fromTokenSymbol,
3053
+ fromTokenIcon,
3054
+ toTokenSymbol,
3055
+ toTokenIcon,
3056
+ formattedInputAmount,
3057
+ formattedOutputAmount,
3058
+ formattedInputAmountUSD,
3059
+ formattedOutputAmountUSD,
3060
+ progress,
3061
+ errorTitle,
3062
+ errorDescription,
3063
+ transactionSteps,
3064
+ onCancel,
3065
+ onTryAgain,
3066
+ cancelButtonText,
3067
+ retryButtonText,
3068
+ processingDetailsLabels
3069
+ }) => {
3070
+ return /* @__PURE__ */ jsxs(
3071
+ TransactionScreen,
3072
+ {
3073
+ testId: "swap-signature-warning-screen",
3074
+ onClose: onCancel,
3075
+ progress,
3076
+ iconType: "warning",
3077
+ title: /* @__PURE__ */ jsx("span", { "data-testid": "swap-signature-warning-title", children: errorTitle }),
3078
+ description: errorDescription,
3079
+ actions: /* @__PURE__ */ jsxs("div", { "data-testid": "swap-signature-warning-actions", className: "flex gap-sm w-full", children: [
3080
+ /* @__PURE__ */ jsx(SecondaryButton, { "data-testid": "swap-signature-warning-cancel", className: "flex-1", onClick: onCancel, children: cancelButtonText }),
3081
+ /* @__PURE__ */ jsx(PrimaryButton, { "data-testid": "swap-signature-warning-retry", className: "flex-1", onClick: onTryAgain, children: retryButtonText })
3082
+ ] }),
3083
+ children: [
3084
+ /* @__PURE__ */ jsx(SectionCard, { className: "!p-[22px]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full relative px-md", children: [
3085
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
3086
+ /* @__PURE__ */ jsx("img", { src: fromTokenIcon, alt: fromTokenSymbol, className: "w-8 h-8 rounded-full" }),
3087
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
3088
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
3089
+ formattedInputAmount,
3090
+ " ",
3091
+ fromTokenSymbol
3092
+ ] }),
3093
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedInputAmountUSD })
3094
+ ] })
3095
+ ] }),
3096
+ /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-brand-secondary rounded-full p-2 shadow-md z-10", children: /* @__PURE__ */ jsx(MdOutlineSwapHoriz, { className: "w-5 h-5" }) }),
3097
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
3098
+ /* @__PURE__ */ jsx("img", { src: toTokenIcon, alt: toTokenSymbol, className: "w-8 h-8 rounded-full" }),
3099
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
3100
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
3101
+ "~",
3102
+ formattedOutputAmount,
3103
+ " ",
3104
+ toTokenSymbol
3105
+ ] }),
3106
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedOutputAmountUSD })
3107
+ ] })
3108
+ ] })
3109
+ ] }) }),
3110
+ /* @__PURE__ */ jsx(
3111
+ TransactionProcessingDetails,
3112
+ {
3113
+ steps: transactionSteps,
3114
+ defaultOpen: true,
3115
+ className: "bg-bg-subtle dark:bg-bg-subtle-dark lg:!bg-bg-raised dark:lg:!bg-bg-raised-dark",
3116
+ labels: processingDetailsLabels
3117
+ }
3118
+ )
3119
+ ]
3120
+ }
3121
+ );
3122
+ };
3123
+ var SwapSuccessView = ({
3124
+ fromTokenSymbol,
3125
+ fromTokenIcon,
3126
+ toTokenSymbol,
3127
+ toTokenIcon,
3128
+ formattedInputAmount,
3129
+ formattedOutputAmount,
3130
+ formattedInputAmountUSD,
3131
+ formattedOutputAmountUSD,
3132
+ transactionSteps,
3133
+ onClose,
3134
+ onStartNewSwap,
3135
+ onGoToWallet,
3136
+ labels,
3137
+ processingDetailsLabels
3138
+ }) => {
3139
+ return /* @__PURE__ */ jsxs(
3140
+ TransactionScreen,
3141
+ {
3142
+ testId: "swap-success-screen",
3143
+ onClose,
3144
+ progress: 100,
3145
+ iconType: "success",
3146
+ title: /* @__PURE__ */ jsx("span", { "data-testid": "swap-success-title", children: labels.title }),
3147
+ description: /* @__PURE__ */ jsxs(Fragment, { children: [
3148
+ labels.descriptionPrefix,
3149
+ " ",
3150
+ /* @__PURE__ */ jsxs("strong", { className: "font-semibold", children: [
3151
+ formattedInputAmount,
3152
+ " ",
3153
+ fromTokenSymbol
3154
+ ] }),
3155
+ " ",
3156
+ labels.descriptionMiddle,
3157
+ " ",
3158
+ /* @__PURE__ */ jsxs("strong", { className: "font-semibold", children: [
3159
+ formattedOutputAmount,
3160
+ " ",
3161
+ toTokenSymbol
3162
+ ] }),
3163
+ /* @__PURE__ */ jsx("br", {}),
3164
+ labels.descriptionSuffix,
3165
+ " ",
3166
+ /* @__PURE__ */ jsx("strong", { className: "font-semibold text-brand-primary cursor-pointer", onClick: onGoToWallet, children: labels.walletLinkText })
3167
+ ] }),
3168
+ actions: /* @__PURE__ */ jsx("div", { "data-testid": "swap-start-new-wrapper", className: "w-full", children: /* @__PURE__ */ jsx(PrimaryButton, { "data-testid": "swap-start-new-button", className: "w-full", onClick: onStartNewSwap, children: labels.startNewSwapButton }) }),
3169
+ children: [
3170
+ /* @__PURE__ */ jsx(SectionCard, { className: "!p-[22px]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full relative px-md", children: [
3171
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
3172
+ /* @__PURE__ */ jsx("img", { src: fromTokenIcon, alt: fromTokenSymbol, className: "w-8 h-8 rounded-full" }),
3173
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
3174
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
3175
+ formattedInputAmount,
3176
+ " ",
3177
+ fromTokenSymbol
3178
+ ] }),
3179
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedInputAmountUSD })
3180
+ ] })
3181
+ ] }),
3182
+ /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-brand-secondary rounded-full p-2 shadow-md z-10", children: /* @__PURE__ */ jsx(MdOutlineSwapHoriz, { className: "w-5 h-5" }) }),
3183
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
3184
+ /* @__PURE__ */ jsx("img", { src: toTokenIcon, alt: toTokenSymbol, className: "w-8 h-8 rounded-full" }),
3185
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
3186
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
3187
+ "~",
3188
+ formattedOutputAmount,
3189
+ " ",
3190
+ toTokenSymbol
3191
+ ] }),
3192
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedOutputAmountUSD })
3193
+ ] })
3194
+ ] })
3195
+ ] }) }),
3196
+ /* @__PURE__ */ jsx(
3197
+ TransactionProcessingDetails,
3198
+ {
3199
+ steps: transactionSteps,
3200
+ defaultOpen: true,
3201
+ className: "bg-bg-subtle dark:bg-bg-subtle-dark lg:!bg-bg-raised dark:lg:!bg-bg-raised-dark",
3202
+ labels: processingDetailsLabels
3203
+ }
3204
+ )
3205
+ ]
3206
+ }
3207
+ );
3208
+ };
3209
+ var SwapTransactionFailedView = ({
3210
+ fromTokenSymbol,
3211
+ fromTokenIcon,
3212
+ toTokenSymbol,
3213
+ toTokenIcon,
3214
+ formattedInputAmount,
3215
+ formattedOutputAmount,
3216
+ formattedInputAmountUSD,
3217
+ formattedOutputAmountUSD,
3218
+ progress,
3219
+ errorTitle,
3220
+ errorDescription,
3221
+ transactionSteps,
3222
+ hasExplorerLink,
3223
+ onBack,
3224
+ onViewExplorer,
3225
+ onTryAgain,
3226
+ viewOnExplorerText,
3227
+ retryButtonText,
3228
+ processingDetailsLabels
3229
+ }) => {
3230
+ return /* @__PURE__ */ jsxs(
3231
+ TransactionScreen,
3232
+ {
3233
+ testId: "swap-failed-screen",
3234
+ onClose: onBack,
3235
+ progress,
3236
+ iconType: "warning",
3237
+ iconGradient: "linear-gradient(135deg, #EF4444 0%, #DC2626 100%)",
3238
+ title: /* @__PURE__ */ jsx("span", { "data-testid": "swap-failed-title", children: errorTitle }),
3239
+ description: errorDescription,
3240
+ actions: /* @__PURE__ */ jsxs("div", { "data-testid": "swap-failed-actions", className: "flex gap-sm w-full", children: [
3241
+ /* @__PURE__ */ jsx(SecondaryButton, { "data-testid": "swap-failed-view-explorer", className: "flex-1", onClick: onViewExplorer, disabled: !hasExplorerLink, children: viewOnExplorerText }),
3242
+ /* @__PURE__ */ jsx(PrimaryButton, { "data-testid": "swap-failed-retry", className: "flex-1", onClick: onTryAgain, children: retryButtonText })
3243
+ ] }),
3244
+ children: [
3245
+ /* @__PURE__ */ jsx(SectionCard, { className: "!p-[22px]", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full relative px-md", children: [
3246
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
3247
+ /* @__PURE__ */ jsx("img", { src: fromTokenIcon, alt: fromTokenSymbol, className: "w-8 h-8 rounded-full" }),
3248
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
3249
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
3250
+ "~",
3251
+ formattedInputAmount,
3252
+ " ",
3253
+ fromTokenSymbol
3254
+ ] }),
3255
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedInputAmountUSD })
3256
+ ] })
3257
+ ] }),
3258
+ /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-brand-secondary rounded-full p-2 shadow-md z-10", children: /* @__PURE__ */ jsx(MdOutlineSwapHoriz, { className: "w-5 h-5" }) }),
3259
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-sm", children: [
3260
+ /* @__PURE__ */ jsx("img", { src: toTokenIcon, alt: toTokenSymbol, className: "w-8 h-8 rounded-full" }),
3261
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-xs", children: [
3262
+ /* @__PURE__ */ jsxs("div", { className: "text-text-sm-mobile font-poppins text-text-secondary dark:text-text-secondary-dark", children: [
3263
+ "~",
3264
+ formattedOutputAmount,
3265
+ " ",
3266
+ toTokenSymbol
3267
+ ] }),
3268
+ /* @__PURE__ */ jsx("div", { className: "text-h2-mobile font-extrabold font-poppins text-text-primary dark:text-text-primary-dark", children: formattedOutputAmountUSD })
3269
+ ] })
3270
+ ] })
3271
+ ] }) }),
3272
+ /* @__PURE__ */ jsx(
3273
+ TransactionProcessingDetails,
3274
+ {
3275
+ steps: transactionSteps,
3276
+ defaultOpen: true,
3277
+ className: "bg-bg-subtle dark:bg-bg-subtle-dark lg:!bg-bg-raised dark:lg:!bg-bg-raised-dark",
3278
+ labels: processingDetailsLabels
3279
+ }
3280
+ )
3281
+ ]
3282
+ }
3283
+ );
3284
+ };
3285
+ var ChooseAnAssetSwapView = ({
3286
+ actionSheetId,
3287
+ isOpen,
3288
+ currentActionSheetId,
3289
+ onClose,
3290
+ onSearch,
3291
+ autoFocus,
3292
+ displayedTokens,
3293
+ hasMore,
3294
+ onLoadMore,
3295
+ findBalance,
3296
+ isFetching,
3297
+ onAssetClick,
3298
+ labels,
3299
+ formatTokenAmount,
3300
+ formatCurrencyValue
3301
+ }) => {
3302
+ const [searchValue, setSearchValue] = React6__default.useState("");
3303
+ const handleSearch = (value) => {
3304
+ setSearchValue(value);
3305
+ onSearch(value);
3306
+ };
3307
+ return /* @__PURE__ */ jsx("div", { className: "flex justify-center", "data-testid": `swap-token-actionsheet-wrapper-${actionSheetId}`, children: /* @__PURE__ */ jsx(
3308
+ ActionSheet,
3309
+ {
3310
+ id: actionSheetId,
3311
+ currentActionSheetId,
3312
+ isOpen,
3313
+ onClose,
3314
+ position: "bottom",
3315
+ height: "full",
3316
+ contentClassName: "w-full max-w-[620px] mx-auto",
3317
+ children: /* @__PURE__ */ jsxs(BackgroundContainer, { className: "flex flex-col h-full", children: [
3318
+ /* @__PURE__ */ jsx(Navbar, { children: /* @__PURE__ */ jsx(CloseButton, { testId: `swap-token-actionsheet-close-${actionSheetId}`, onClick: onClose }) }),
3319
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 w-full p-6 overflow-hidden", children: [
3320
+ /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0", children: [
3321
+ /* @__PURE__ */ jsx(TextHeading_default, { children: labels.title }),
3322
+ /* @__PURE__ */ jsx("br", {}),
3323
+ /* @__PURE__ */ jsx(
3324
+ SearchInput,
3325
+ {
3326
+ onSearch: handleSearch,
3327
+ placeholder: labels.searchPlaceholder,
3328
+ autoFocus,
3329
+ inputClassName: "bg-bg-subtle dark:bg-bg-subtle-dark lg:!bg-bg-raised lg:dark:!bg-bg-raised-dark",
3330
+ containerTestId: `swap-token-search-container-${actionSheetId}`,
3331
+ inputTestId: `swap-token-search-input-${actionSheetId}`
3332
+ }
3333
+ )
3334
+ ] }),
3335
+ searchValue && displayedTokens.length === 0 && !isFetching ? /* @__PURE__ */ jsx(SearchEmptyState, { title: labels.searchEmptyTitle, description: labels.searchEmptyDescription }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 w-full mt-4 overflow-y-auto flex-1 min-h-0", children: [
3336
+ isFetching && /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center w-full py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
3337
+ /* @__PURE__ */ jsx(TextBody_default, { variant: "text-small", className: "text-text-secondary dark:text-text-secondary-dark", children: labels.searchingText }),
3338
+ /* @__PURE__ */ jsx(LoadingDots, {})
3339
+ ] }) }),
3340
+ displayedTokens.map((token, index) => {
3341
+ const balance = findBalance(token);
3342
+ const tokenPriceUSD = Number(balance == null ? void 0 : balance.priceUSD) || 0;
3343
+ const formattedBalance = (balance == null ? void 0 : balance.amountUI) ? formatTokenAmount(balance.amountUI, tokenPriceUSD, 2) : "0";
3344
+ return /* @__PURE__ */ jsxs(
3345
+ ListItem,
3346
+ {
3347
+ className: "w-full flex-shrink-0",
3348
+ onClick: () => onAssetClick(token),
3349
+ "data-testid": `swap-token-item-${token.symbol.toLowerCase()}-${token.chainId}`,
3350
+ "data-address": token.address,
3351
+ "data-chain-id": token.chainId,
3352
+ "data-symbol": token.symbol,
3353
+ children: [
3354
+ /* @__PURE__ */ jsx(ListItemLeftSide, { children: /* @__PURE__ */ jsx("img", { src: token.logoURI || "", alt: token.name, className: "w-10 h-10 rounded-full" }) }),
3355
+ /* @__PURE__ */ jsxs(ListItemContent, { children: [
3356
+ /* @__PURE__ */ jsx(TextBody_default, { children: token.name }),
3357
+ /* @__PURE__ */ jsx(TextBody_default, { variant: "text-small", children: token.symbol })
3358
+ ] }),
3359
+ /* @__PURE__ */ jsxs(ListItemRightSide, { children: [
3360
+ /* @__PURE__ */ jsx(TextBody_default, { children: formattedBalance }),
3361
+ /* @__PURE__ */ jsx(TextBody_default, { variant: "text-small", children: formatCurrencyValue(Number(balance == null ? void 0 : balance.amountInUSD) || 0) })
3362
+ ] })
3363
+ ]
3364
+ },
3365
+ `token-${token.address}-${index}`
3366
+ );
3367
+ }),
3368
+ hasMore && /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center w-full py-4 flex-shrink-0", children: /* @__PURE__ */ jsx(TertiaryButton, { onClick: onLoadMore, children: labels.loadMoreButton }) })
3369
+ ] })
3370
+ ] })
3371
+ ] })
3372
+ }
3373
+ ) });
3374
+ };
2540
3375
 
2541
- export { ActionButton, ActionSheet, AddressDisplay, BackgroundContainer, BannerNotification, ChooseAStrategyActionsheetView, CloseButton, CollapsibleInfoRow, ConnectWalletList, Currency, DeframeComponentsProvider, DetailsHeader, Currency as Fiat, FlexCol, FlexRow, HighRiskBadge, HistoryDepositDetailsView, HistoryWithdrawDetailsView, InfoLabel, InfoRow, InfoRowIconLabel, InfoRowIconValue, InfoRowWithIcon, InfoValue, Input, Link, ListItem, ListItemContent, ListItemLeftSide, ListItemRightSide, LowRiskBadge, MediumRiskBadge, Navbar, PercentageButton, PrimaryButton, ScrollableContent, SecondaryButton, SectionCard, Select, SelectContent, SelectItem, SelectTrigger, Skeleton, StrategyDetailsView, SummaryDetails, SummaryDetailsCryptoControlV2, SwapAmountInputView, SwapNetworkSelectorView, SwapOutputAmountView, SwapQuoteBlockchainCostsView, SwapQuoteErrorsView, SwapQuoteHeaderView, SwapSlippageToleranceButtonsView, SwapTokenSelectorView, Tabs, TabsContent, TabsList, TabsTrigger, TertiaryButton, Text_default as Text, TextAccent_default as TextAccent, TextBody_default as TextBody, TextHeading_default as TextHeading, Title, WalletItem, ConnectWalletList as WalletList, WalletListContainer, cryptocontrolThemeColors, darkThemeColors, defaultThemeColors, themeToCSS };
3376
+ export { ActionButton, ActionSheet, AddressDisplay, BackgroundContainer, BannerNotification, ChooseAStrategyActionsheetView, ChooseAnAssetSwapView, CloseButton, CollapsibleInfoRow, CollapsibleSection, ConnectWalletList, Currency, DeframeComponentsProvider, DetailsHeader, Currency as Fiat, FlexCol, FlexRow, HighRiskBadge, HistoryDepositDetailsView, HistoryWithdrawDetailsView, InfoLabel, InfoRow, InfoRowIconLabel, InfoRowIconValue, InfoRowWithIcon, InfoValue, Input, Link, ListItem, ListItemContent, ListItemLeftSide, ListItemRightSide, LoadingDots, LowRiskBadge, MediumRiskBadge, Navbar, PercentageButton, PrimaryButton, ProgressIndicator, ScrollableContent, SearchEmptyState, SearchInput, SecondaryButton, SectionCard, Select, SelectContent, SelectItem, SelectTrigger, Skeleton, StepDisplay, StepStatusIcon, StepStatusText, StrategyDetailsView, SummaryDetails, SummaryDetailsCryptoControlV2, SwapAmountInputView, SwapCrossChainProcessingView, SwapNetworkSelectorView, SwapOutputAmountView, SwapProcessingView, SwapQuoteBlockchainCostsView, SwapQuoteErrorsView, SwapQuoteHeaderView, SwapSignatureWarningView, SwapSlippageToleranceButtonsView, SwapSuccessView, SwapTokenSelectorView, SwapTransactionFailedView, Tabs, TabsContent, TabsList, TabsTrigger, TertiaryButton, Text_default as Text, TextAccent_default as TextAccent, TextBody_default as TextBody, TextHeading_default as TextHeading, Title, TokenWithChainBadge, TransactionProcessingDetails, TransactionScreen, TransactionScreenIcon, TransactionScreenInvestmentCard, WalletItem, ConnectWalletList as WalletList, WalletListContainer, cryptocontrolThemeColors, darkThemeColors, defaultThemeColors, themeToCSS };
2542
3377
  //# sourceMappingURL=index.mjs.map
2543
3378
  //# sourceMappingURL=index.mjs.map