@deframe-sdk/components 0.1.22 → 0.1.23

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
@@ -4,9 +4,10 @@ import { HiXMark, HiChevronUp, HiChevronDown, HiChevronLeft, HiOutlineClock, HiA
4
4
  import * as React6 from 'react';
5
5
  import React6__default, { useState, useEffect, useRef, useCallback } from 'react';
6
6
  import { motion, AnimatePresence } from 'framer-motion';
7
- import { MdClose, MdOutlineSearch, MdOutlineSearchOff, MdOutlineSwapHoriz, MdHistory, MdOutlineSwapVert, MdArrowRight, MdArrowDropDown, MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdArrowUpward, MdArrowDownward } from 'react-icons/md';
7
+ import { MdClose, MdOutlineSearch, MdOutlineSearchOff, MdOutlineSwapHoriz, MdHistory, MdOutlineSwapVert, MdArrowRight, MdArrowDropDown, MdQrCodeScanner, MdOutlineArrowUpward, MdOutlineArrowDownward, MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdArrowUpward, MdArrowDownward } from 'react-icons/md';
8
8
  import { IoAlertCircleOutline, IoTimeOutline, IoCheckmarkOutline } from 'react-icons/io5';
9
9
  import { PiClockCountdownBold } from 'react-icons/pi';
10
+ import Link2 from 'next/link';
10
11
 
11
12
  var __defProp = Object.defineProperty;
12
13
  var __defProps = Object.defineProperties;
@@ -9090,7 +9091,472 @@ var EarnWithdrawFailedView = ({
9090
9091
  }
9091
9092
  );
9092
9093
  };
9094
+ var DashboardCard = ({ children, className }) => {
9095
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "dashboard-card", className: twMerge("bg-[var(--deframe-widget-color-bg-subtle)] rounded", className), children });
9096
+ };
9097
+ var DashboardTransactionsPlaceholder = () => {
9098
+ return /* @__PURE__ */ jsxs("div", { "data-test-id": "dashboard-transactions-placeholder", className: "flex flex-col items-center justify-center py-16 gap-4", children: [
9099
+ /* @__PURE__ */ jsx("div", { className: "w-20 h-20 bg-[var(--deframe-widget-color-bg-muted)] rounded-full flex justify-center items-center", children: /* @__PURE__ */ jsx(PiClockCountdownBold, { className: "w-10 h-10 text-[var(--deframe-widget-color-text-tertiary)]" }) }),
9100
+ /* @__PURE__ */ jsx(TextHeading, { variant: "h3", children: "Nenhuma transa\xE7\xE3o ainda" }),
9101
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-medium", className: "text-center text-[var(--deframe-widget-color-text-secondary)]", children: "Assim que voc\xEA come\xE7ar a movimentar fundos, seu hist\xF3rico de transa\xE7\xF5es aparecer\xE1 aqui." })
9102
+ ] });
9103
+ };
9104
+ var DashboardBalancesBreakdown = ({
9105
+ isLoadingBalances,
9106
+ formattedTokenPositions,
9107
+ formattedEarnPositions,
9108
+ layout = "vertical"
9109
+ }) => {
9110
+ if (layout === "horizontal") {
9111
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "dashboard-balances-breakdown-horizontal", className: "hidden lg:block w-full mt-8", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full gap-4 items-stretch", children: [
9112
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 basis-0 min-w-0 bg-[var(--deframe-widget-color-bg-secondary)] rounded p-4 flex flex-col", children: [
9113
+ /* @__PURE__ */ jsx(Text_default, { children: "Cripto" }),
9114
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isLoadingBalances ? /* @__PURE__ */ jsx("div", { className: "h-5 bg-[var(--deframe-widget-color-bg-muted)] rounded w-32 animate-pulse mt-2" }, "skeleton-crypto") : /* @__PURE__ */ jsx(
9115
+ motion.div,
9116
+ {
9117
+ initial: { opacity: 0, x: 10 },
9118
+ animate: { opacity: 1, x: 0 },
9119
+ exit: { opacity: 0, x: -10 },
9120
+ transition: { duration: 0.4, delay: 0.1, ease: "easeOut" },
9121
+ className: "mt-2",
9122
+ children: /* @__PURE__ */ jsx(Text_default, { children: formattedTokenPositions })
9123
+ },
9124
+ "crypto-value"
9125
+ ) })
9126
+ ] }),
9127
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 basis-0 min-w-0 bg-[var(--deframe-widget-color-bg-secondary)] rounded p-4 flex flex-col", children: [
9128
+ /* @__PURE__ */ jsx(Text_default, { children: "Investimentos" }),
9129
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isLoadingBalances ? /* @__PURE__ */ jsx("div", { className: "h-5 bg-[var(--deframe-widget-color-bg-muted)] rounded w-32 animate-pulse mt-2" }, "skeleton-earn") : /* @__PURE__ */ jsx(
9130
+ motion.div,
9131
+ {
9132
+ initial: { opacity: 0, x: 10 },
9133
+ animate: { opacity: 1, x: 0 },
9134
+ exit: { opacity: 0, x: -10 },
9135
+ transition: { duration: 0.4, delay: 0.2, ease: "easeOut" },
9136
+ className: "mt-2",
9137
+ children: /* @__PURE__ */ jsx(Text_default, { children: formattedEarnPositions })
9138
+ },
9139
+ "earn-value"
9140
+ ) })
9141
+ ] })
9142
+ ] }) });
9143
+ }
9144
+ return /* @__PURE__ */ jsxs("div", { "data-test-id": "dashboard-balances-breakdown-vertical", className: "lg:hidden w-full mt-8", children: [
9145
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center w-full mb-6", children: [
9146
+ /* @__PURE__ */ jsx(Text_default, { children: "Cripto" }),
9147
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isLoadingBalances ? /* @__PURE__ */ jsx("div", { className: "h-5 bg-[var(--deframe-widget-color-bg-muted)] rounded w-32 animate-pulse" }, "skeleton-crypto") : /* @__PURE__ */ jsx(
9148
+ motion.div,
9149
+ {
9150
+ initial: { opacity: 0, x: 10 },
9151
+ animate: { opacity: 1, x: 0 },
9152
+ exit: { opacity: 0, x: -10 },
9153
+ transition: { duration: 0.4, delay: 0.1, ease: "easeOut" },
9154
+ children: /* @__PURE__ */ jsx(Text_default, { children: formattedTokenPositions })
9155
+ },
9156
+ "crypto-value"
9157
+ ) })
9158
+ ] }),
9159
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center w-full", children: [
9160
+ /* @__PURE__ */ jsx(Text_default, { children: "Investimentos" }),
9161
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isLoadingBalances ? /* @__PURE__ */ jsx("div", { className: "h-5 bg-[var(--deframe-widget-color-bg-muted)] rounded w-32 animate-pulse" }, "skeleton-earn") : /* @__PURE__ */ jsx(
9162
+ motion.div,
9163
+ {
9164
+ initial: { opacity: 0, x: 10 },
9165
+ animate: { opacity: 1, x: 0 },
9166
+ exit: { opacity: 0, x: -10 },
9167
+ transition: { duration: 0.4, delay: 0.2, ease: "easeOut" },
9168
+ children: /* @__PURE__ */ jsx(Text_default, { children: formattedEarnPositions })
9169
+ },
9170
+ "earn-value"
9171
+ ) })
9172
+ ] })
9173
+ ] });
9174
+ };
9175
+ var DashboardTokenListView = ({
9176
+ tokens,
9177
+ isLoading,
9178
+ className,
9179
+ showCard = true,
9180
+ onDepositClick
9181
+ }) => {
9182
+ const [searchQuery, setSearchQuery] = useState("");
9183
+ const filteredTokens = tokens.filter((token) => {
9184
+ if (isNaN(token.amountInUSD) || token.amountInUSD < 0.01) return false;
9185
+ if (!searchQuery) return true;
9186
+ const query = searchQuery.toLowerCase();
9187
+ return token.symbol.toLowerCase().includes(query) || token.name.toLowerCase().includes(query);
9188
+ });
9189
+ const content = /* @__PURE__ */ jsxs("div", { "data-test-id": "dashboard-token-list", children: [
9190
+ showCard && /* @__PURE__ */ jsx(TextBody, { className: "mb-6", children: "Seus tokens" }),
9191
+ !isLoading && tokens.length > 0 && /* @__PURE__ */ jsx("div", { "data-test-id": "dashboard-token-search", className: `${showCard ? "mb-6" : "mt-6 mb-6"} h-14 bg-[var(--deframe-widget-color-bg-raised)] flex items-center justify-center w-full border border-[var(--deframe-widget-color-border-default)] px-2 py-0.5 rounded gap-1`, children: /* @__PURE__ */ jsxs("div", { className: "flex-1 flex items-center relative", children: [
9192
+ /* @__PURE__ */ jsx(
9193
+ Input2,
9194
+ {
9195
+ "data-test-id": "dashboard-token-search-input",
9196
+ type: "text",
9197
+ placeholder: "Pesquisar aqui...",
9198
+ value: searchQuery,
9199
+ onChange: (e) => setSearchQuery(e.target.value),
9200
+ className: "w-full h-full p-4 pr-12"
9201
+ }
9202
+ ),
9203
+ /* @__PURE__ */ jsx(MdOutlineSearch, { className: "w-4 h-4 text-[var(--deframe-widget-color-text-secondary)] absolute right-4" })
9204
+ ] }) }),
9205
+ /* @__PURE__ */ jsx("div", { children: isLoading ? /* @__PURE__ */ jsx("div", { className: "space-y-4", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 p-2", children: [
9206
+ /* @__PURE__ */ jsx(Skeleton, { variant: "circle", width: "40px", height: "40px", shimmer: true }),
9207
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
9208
+ /* @__PURE__ */ jsx(Skeleton, { width: "80px", height: "16px", shimmer: true, className: "mb-2" }),
9209
+ /* @__PURE__ */ jsx(Skeleton, { width: "128px", height: "12px", shimmer: true })
9210
+ ] }),
9211
+ /* @__PURE__ */ jsx(Skeleton, { width: "64px", height: "16px", shimmer: true })
9212
+ ] }, i)) }) : filteredTokens.length > 0 ? filteredTokens.map((token, index) => /* @__PURE__ */ jsx(
9213
+ motion.div,
9214
+ {
9215
+ initial: { opacity: 0, y: 20 },
9216
+ animate: { opacity: 1, y: 0 },
9217
+ transition: {
9218
+ duration: 0.4,
9219
+ delay: index * 0.1,
9220
+ ease: "easeOut"
9221
+ },
9222
+ children: /* @__PURE__ */ jsxs(
9223
+ ListItem,
9224
+ {
9225
+ "data-test-id": `dashboard-token-item-${token.symbol.toLowerCase()}`,
9226
+ containerClassName: `p-2 ${index > 0 ? "mt-4" : ""} bg-[var(--deframe-widget-color-bg-raised)] cursor-pointer`,
9227
+ children: [
9228
+ /* @__PURE__ */ jsx(ListItemLeftSide, { children: /* @__PURE__ */ jsxs("div", { className: "relative w-10 h-10", children: [
9229
+ /* @__PURE__ */ jsx(
9230
+ "img",
9231
+ {
9232
+ src: token.logoUrl,
9233
+ alt: token.name,
9234
+ className: "w-10 h-10 rounded-full object-cover"
9235
+ }
9236
+ ),
9237
+ token.networkLogoUrl && /* @__PURE__ */ jsx(
9238
+ "img",
9239
+ {
9240
+ src: token.networkLogoUrl,
9241
+ alt: token.networkName || "",
9242
+ className: "absolute -bottom-1 border border-bg-default p-px -right-1 w-6 h-6 rounded-full object-cover bg-white"
9243
+ }
9244
+ )
9245
+ ] }) }),
9246
+ /* @__PURE__ */ jsxs(ListItemContent, { className: "ml-4", children: [
9247
+ /* @__PURE__ */ jsx(TextBody, { children: token.symbol }),
9248
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", className: "text-[var(--deframe-widget-color-text-secondary)]", children: token.name })
9249
+ ] }),
9250
+ /* @__PURE__ */ jsx(ListItemRightSide, { className: "flex flex-col items-end", children: token.isUpdating ? /* @__PURE__ */ jsx(LoadingDots, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
9251
+ /* @__PURE__ */ jsx(TextBody, { className: "font-semibold", children: token.formattedFiatValue }),
9252
+ /* @__PURE__ */ jsxs(TextBody, { variant: "text-small", className: "text-[var(--deframe-widget-color-text-secondary)]", children: [
9253
+ token.formattedAmount,
9254
+ " ",
9255
+ token.symbol
9256
+ ] })
9257
+ ] }) })
9258
+ ]
9259
+ }
9260
+ )
9261
+ },
9262
+ token.id || index
9263
+ )) : /* @__PURE__ */ jsx(
9264
+ motion.div,
9265
+ {
9266
+ initial: { opacity: 0, y: 20 },
9267
+ animate: { opacity: 1, y: 0 },
9268
+ transition: { duration: 0.4 },
9269
+ className: "flex flex-col items-center justify-center",
9270
+ children: searchQuery ? /* @__PURE__ */ jsxs(Fragment, { children: [
9271
+ /* @__PURE__ */ jsx("div", { className: "w-20 h-20 rounded-full bg-[var(--deframe-widget-color-bg-muted)] flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx(MdOutlineSearch, { className: "w-10 h-10 text-[var(--deframe-widget-color-text-secondary)]" }) }),
9272
+ /* @__PURE__ */ jsx(TextHeading, { className: "text-center mb-4", children: "Nenhum token encontrado" }),
9273
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-large", className: "text-center mb-4", children: "Tente buscar por outro nome ou s\xEDmbolo." })
9274
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9275
+ /* @__PURE__ */ jsx("div", { className: "w-20 h-20 rounded-full bg-[var(--deframe-widget-color-bg-muted)] flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx(MdQrCodeScanner, { className: "w-10 h-10 text-[var(--deframe-widget-color-text-secondary)]" }) }),
9276
+ /* @__PURE__ */ jsx(TextHeading, { className: "text-center mb-4", children: "Deposite e comece a usar a wallet" }),
9277
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-large", className: "text-center mb-4", children: "Use Pix para adicionar saldo instantaneamente na sua carteira." }),
9278
+ onDepositClick && /* @__PURE__ */ jsx("button", { type: "button", onClick: onDepositClick, children: /* @__PURE__ */ jsx(PrimaryButton, { children: "Depositar via Pix" }) })
9279
+ ] })
9280
+ }
9281
+ ) })
9282
+ ] });
9283
+ if (showCard) {
9284
+ return /* @__PURE__ */ jsx(DashboardCard, { className: `p-6 bg-[var(--deframe-widget-color-bg-subtle)] ${className || ""}`, children: content });
9285
+ }
9286
+ return /* @__PURE__ */ jsx("div", { className, children: content });
9287
+ };
9288
+ var DashboardStrategiesListView = ({
9289
+ strategies,
9290
+ isLoading,
9291
+ searchQuery = "",
9292
+ limit = 5,
9293
+ onStrategyClick
9294
+ }) => {
9295
+ if (isLoading) {
9296
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "dashboard-strategies-list-loading", className: "space-y-4", children: Array.from({ length: limit }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 p-2", children: [
9297
+ /* @__PURE__ */ jsx("div", { className: "w-10 h-10 rounded-full bg-[var(--deframe-widget-color-bg-muted)] animate-pulse" }),
9298
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
9299
+ /* @__PURE__ */ jsx("div", { className: "h-4 bg-[var(--deframe-widget-color-bg-muted)] rounded w-20 mb-2 animate-pulse" }),
9300
+ /* @__PURE__ */ jsx("div", { className: "h-3 bg-[var(--deframe-widget-color-bg-muted)] rounded w-32 animate-pulse" })
9301
+ ] }),
9302
+ /* @__PURE__ */ jsx("div", { className: "h-4 bg-[var(--deframe-widget-color-bg-muted)] rounded w-16 animate-pulse" })
9303
+ ] }, i)) });
9304
+ }
9305
+ const query = searchQuery.trim().toLowerCase();
9306
+ const filteredStrategies = strategies.filter((strategy) => {
9307
+ if (!query) return true;
9308
+ return strategy.assetName.toLowerCase().includes(query) || strategy.protocol.toLowerCase().includes(query);
9309
+ });
9310
+ const displayStrategies = filteredStrategies.slice(0, limit);
9311
+ if (displayStrategies.length === 0) {
9312
+ return /* @__PURE__ */ jsx(
9313
+ motion.div,
9314
+ {
9315
+ initial: { opacity: 0, y: 20 },
9316
+ animate: { opacity: 1, y: 0 },
9317
+ transition: { duration: 0.4 },
9318
+ className: "flex flex-col items-center justify-center py-12",
9319
+ children: /* @__PURE__ */ jsx(TextBody, { className: "text-[var(--deframe-widget-color-text-secondary)]", children: searchQuery ? "Nenhuma estrat\xE9gia encontrada" : "Nenhum investimento encontrado" })
9320
+ }
9321
+ );
9322
+ }
9323
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "dashboard-strategies-list", children: displayStrategies.map((strategy, index) => /* @__PURE__ */ jsx(
9324
+ motion.div,
9325
+ {
9326
+ initial: { opacity: 0, y: 20 },
9327
+ animate: { opacity: 1, y: 0 },
9328
+ transition: {
9329
+ duration: 0.4,
9330
+ delay: index * 0.1,
9331
+ ease: "easeOut"
9332
+ },
9333
+ children: /* @__PURE__ */ jsxs(
9334
+ ListItem,
9335
+ {
9336
+ containerClassName: `${index > 0 ? "mt-4" : ""}`,
9337
+ onClick: () => onStrategyClick(strategy.id),
9338
+ children: [
9339
+ /* @__PURE__ */ jsx(ListItemLeftSide, { children: /* @__PURE__ */ jsx(
9340
+ "img",
9341
+ {
9342
+ src: strategy.logoUrl,
9343
+ alt: strategy.assetName,
9344
+ className: "w-10 h-10 rounded-full object-cover"
9345
+ }
9346
+ ) }),
9347
+ /* @__PURE__ */ jsxs(ListItemContent, { className: "ml-4", children: [
9348
+ /* @__PURE__ */ jsxs(TextBody, { children: [
9349
+ "Rendimento ",
9350
+ strategy.assetName
9351
+ ] }),
9352
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", className: "text-[var(--deframe-widget-color-text-secondary)]", children: strategy.protocol })
9353
+ ] }),
9354
+ /* @__PURE__ */ jsxs(ListItemRightSide, { className: "flex flex-col items-end", children: [
9355
+ /* @__PURE__ */ jsx(TextBody, { className: "text-[var(--deframe-widget-color-text-secondary)]" }),
9356
+ strategy.apyFormatted !== void 0 && /* @__PURE__ */ jsxs(TextBody, { variant: "text-small", className: "text-[var(--deframe-widget-color-brand-primary)]", children: [
9357
+ "APY ",
9358
+ strategy.apyFormatted
9359
+ ] })
9360
+ ] })
9361
+ ]
9362
+ }
9363
+ )
9364
+ },
9365
+ strategy.id || index
9366
+ )) });
9367
+ };
9368
+ var DashboardPortfolioView = ({
9369
+ formattedTotalValue,
9370
+ isLoading,
9371
+ onDepositClick,
9372
+ onWithdrawClick,
9373
+ onSwapClick,
9374
+ formattedTokenPositions,
9375
+ formattedEarnPositions
9376
+ }) => {
9377
+ return /* @__PURE__ */ jsx(DashboardCard, { className: "p-6 bg-[var(--deframe-widget-color-bg-subtle)]", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col w-full h-full", children: [
9378
+ /* @__PURE__ */ jsx(TextBody, { className: "mb-6", children: "Portf\xF3lio" }),
9379
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isLoading ? /* @__PURE__ */ jsx("div", { className: "h-8 bg-[var(--deframe-widget-color-bg-muted)] rounded w-64 animate-pulse" }, "skeleton") : /* @__PURE__ */ jsx(
9380
+ motion.p,
9381
+ {
9382
+ initial: { opacity: 0, y: 10 },
9383
+ animate: { opacity: 1, y: 0 },
9384
+ exit: { opacity: 0, y: -10 },
9385
+ transition: { duration: 0.5, ease: "easeOut" },
9386
+ className: "text-2xl font-bold text-[var(--deframe-widget-color-text-primary)] flex items-center gap-2",
9387
+ children: formattedTotalValue
9388
+ },
9389
+ "value"
9390
+ ) }) }),
9391
+ /* @__PURE__ */ jsxs("div", { className: "flex lg:hidden flex-row gap-2 sm:gap-4 mt-6 w-full", children: [
9392
+ /* @__PURE__ */ jsx(Link2, { "data-testid": "dashboard-quick-action-deposit-mobile", href: "/dashboard/deposit", className: "flex-1 min-w-0 cursor-pointer", onClick: onDepositClick, children: /* @__PURE__ */ jsxs(PrimaryButton, { children: [
9393
+ /* @__PURE__ */ jsx(MdOutlineArrowUpward, { className: "w-4 h-4 shrink-0" }),
9394
+ "Depositar"
9395
+ ] }) }),
9396
+ /* @__PURE__ */ jsx(Link2, { "data-testid": "dashboard-quick-action-withdraw-mobile", href: "/dashboard/withdraw", className: "flex-1 min-w-0 cursor-pointer", onClick: onWithdrawClick, children: /* @__PURE__ */ jsxs(PrimaryButton, { children: [
9397
+ /* @__PURE__ */ jsx(MdOutlineArrowDownward, { className: "w-4 h-4 shrink-0" }),
9398
+ "Sacar"
9399
+ ] }) }),
9400
+ /* @__PURE__ */ jsx(Link2, { "data-testid": "dashboard-quick-action-swap-mobile", href: "/dashboard/swap", className: "flex-1 min-w-0 cursor-pointer", onClick: onSwapClick, children: /* @__PURE__ */ jsxs(PrimaryButton, { children: [
9401
+ /* @__PURE__ */ jsx(MdOutlineSwapHoriz, { className: "w-4 h-4 shrink-0" }),
9402
+ "Trocar"
9403
+ ] }) })
9404
+ ] }),
9405
+ /* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx(
9406
+ DashboardBalancesBreakdown,
9407
+ {
9408
+ isLoadingBalances: isLoading,
9409
+ formattedTokenPositions,
9410
+ formattedEarnPositions,
9411
+ layout: "vertical"
9412
+ }
9413
+ ) }),
9414
+ /* @__PURE__ */ jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ jsx(
9415
+ DashboardBalancesBreakdown,
9416
+ {
9417
+ isLoadingBalances: isLoading,
9418
+ formattedTokenPositions,
9419
+ formattedEarnPositions,
9420
+ layout: "horizontal"
9421
+ }
9422
+ ) })
9423
+ ] }) });
9424
+ };
9425
+ var DashboardTokensView = ({
9426
+ sortedRegularTokens,
9427
+ regularTokens,
9428
+ isLoadingBalances,
9429
+ activeTab,
9430
+ onTabChange,
9431
+ strategiesContent
9432
+ }) => {
9433
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
9434
+ /* @__PURE__ */ jsx(DashboardTokenListView, { tokens: sortedRegularTokens, isLoading: isLoadingBalances, className: "hidden lg:block" }),
9435
+ /* @__PURE__ */ jsx(DashboardCard, { className: "lg:hidden p-6 bg-[var(--deframe-widget-color-bg-subtle)]", children: /* @__PURE__ */ jsxs(
9436
+ Tabs,
9437
+ {
9438
+ value: activeTab,
9439
+ onValueChange: (value) => onTabChange(value),
9440
+ children: [
9441
+ /* @__PURE__ */ jsxs(TabsList, { className: "w-full mb-3 flex justify-center", children: [
9442
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "tokens", children: "Cripto" }),
9443
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "strategies", children: "Investimentos" })
9444
+ ] }),
9445
+ /* @__PURE__ */ jsxs(TabsContent, { value: "tokens", children: [
9446
+ /* @__PURE__ */ jsx(TextBody, { className: "mb-6", children: "Seus tokens" }),
9447
+ /* @__PURE__ */ jsx(DashboardTokenListView, { tokens: regularTokens, isLoading: isLoadingBalances, showCard: false })
9448
+ ] }),
9449
+ /* @__PURE__ */ jsx(TabsContent, { value: "strategies", children: strategiesContent })
9450
+ ]
9451
+ }
9452
+ ) })
9453
+ ] });
9454
+ };
9455
+ var DashboardRecentTransactionsView = ({
9456
+ isLoading,
9457
+ isEmpty,
9458
+ transactions,
9459
+ onViewAllClick
9460
+ }) => {
9461
+ return /* @__PURE__ */ jsx(DashboardCard, { className: "p-6 bg-[var(--deframe-widget-color-bg-subtle)]", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
9462
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
9463
+ /* @__PURE__ */ jsx(TextBody, { className: "mb-6", children: "Transa\xE7\xF5es recentes" }),
9464
+ /* @__PURE__ */ jsx(Link2, { href: "/dashboard/history", onClick: onViewAllClick, children: /* @__PURE__ */ jsx(TextBody, { className: "text-[var(--deframe-widget-color-brand-primary)] cursor-pointer hover:underline", children: "Ver todas" }) })
9465
+ ] }),
9466
+ /* @__PURE__ */ jsx("div", { className: "space-y-2 mt-[-16px]", children: isLoading ? /* @__PURE__ */ jsx("div", { className: "space-y-4", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 p-2", children: [
9467
+ /* @__PURE__ */ jsx(Skeleton, { variant: "circle", width: "40px", height: "40px", shimmer: true }),
9468
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
9469
+ /* @__PURE__ */ jsx(Skeleton, { width: "160px", height: "14px", shimmer: true, className: "mb-2" }),
9470
+ /* @__PURE__ */ jsx(Skeleton, { width: "220px", height: "12px", shimmer: true })
9471
+ ] }),
9472
+ /* @__PURE__ */ jsx(Skeleton, { width: "96px", height: "14px", shimmer: true })
9473
+ ] }, i)) }) : isEmpty ? /* @__PURE__ */ jsx(DashboardTransactionsPlaceholder, {}) : transactions.map((item) => {
9474
+ const MainIcon = item.mainIcon;
9475
+ const TypeIcon = item.typeIcon;
9476
+ return /* @__PURE__ */ jsxs(
9477
+ ListItem,
9478
+ {
9479
+ containerClassName: "p-2 mt-4 bg-[var(--deframe-widget-color-bg-secondary)] cursor-pointer",
9480
+ onClick: () => item.onClick(),
9481
+ children: [
9482
+ /* @__PURE__ */ jsx(ListItemLeftSide, { children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
9483
+ /* @__PURE__ */ jsx("div", { className: `w-10 h-10 rounded-full ${item.iconBgColor} flex items-center justify-center`, children: /* @__PURE__ */ jsx(MainIcon, { className: `${item.iconColor}`, size: 20 }) }),
9484
+ /* @__PURE__ */ jsx("div", { className: "absolute -bottom-1 -right-1 w-5 h-5 rounded-full bg-[var(--deframe-widget-color-bg-secondary)] flex items-center justify-center border border-[var(--deframe-widget-color-border-secondary)]", children: /* @__PURE__ */ jsx(TypeIcon, { className: `${item.iconColor}`, size: 12 }) })
9485
+ ] }) }),
9486
+ /* @__PURE__ */ jsxs(ListItemContent, { className: "ml-4", children: [
9487
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", children: item.formattedDate }),
9488
+ /* @__PURE__ */ jsx(TextBody, { className: "text-xs text-[var(--deframe-widget-color-text-secondary)]", children: item.label })
9489
+ ] }),
9490
+ /* @__PURE__ */ jsxs(ListItemRightSide, { className: "text-right", children: [
9491
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-small", children: item.rightPrimary }),
9492
+ /* @__PURE__ */ jsx(TextBody, { className: "text-xs text-[var(--deframe-widget-color-text-secondary)]", children: item.rightSecondary })
9493
+ ] })
9494
+ ]
9495
+ },
9496
+ item.id
9497
+ );
9498
+ }) })
9499
+ ] }) });
9500
+ };
9501
+ var DashboardInvestmentOpportunitiesView = ({
9502
+ isLoadingBalances,
9503
+ formattedTotalProfit,
9504
+ strategiesContent,
9505
+ onViewAllStrategiesClick
9506
+ }) => {
9507
+ return /* @__PURE__ */ jsx(DashboardCard, { className: "hidden lg:block p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-4", children: [
9508
+ /* @__PURE__ */ jsx(TextBody, { variant: "text-large", children: "Oportunidades de investimento" }),
9509
+ /* @__PURE__ */ jsxs(DashboardCard, { className: "bg-[var(--deframe-widget-color-bg-secondary)] flex flex-col space-y-2 p-4", children: [
9510
+ /* @__PURE__ */ jsx(TextBody, { children: "Rendimentos" }),
9511
+ isLoadingBalances ? /* @__PURE__ */ jsx("div", { className: "flex items-baseline gap-2", children: /* @__PURE__ */ jsx(Skeleton, { width: "80px", height: "24px", shimmer: true }) }) : /* @__PURE__ */ jsx("div", { className: "flex items-baseline gap-2", children: /* @__PURE__ */ jsx(TextBody, { variant: "text-large", children: formattedTotalProfit }) })
9512
+ ] }),
9513
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: strategiesContent }),
9514
+ /* @__PURE__ */ jsx(Link2, { href: "/dashboard/earn", className: "w-full", onClick: onViewAllStrategiesClick, children: /* @__PURE__ */ jsx(SecondaryButton, { children: "Ver todas as estrat\xE9gias" }) })
9515
+ ] }) });
9516
+ };
9517
+ var DashboardView = ({
9518
+ portfolio,
9519
+ tokens,
9520
+ recentTransactions,
9521
+ investmentOpportunities,
9522
+ quickActions,
9523
+ banner
9524
+ }) => {
9525
+ return /* @__PURE__ */ jsx("div", { "data-test-id": "dashboard-page", className: "w-full relative overflow-hidden mx-auto rounded p-6 lg:p-12", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6 max-w-[1400px] mx-auto", children: [
9526
+ /* @__PURE__ */ jsxs("div", { className: "lg:col-span-2 space-y-6", children: [
9527
+ /* @__PURE__ */ jsx(DashboardPortfolioView, __spreadValues({}, portfolio)),
9528
+ /* @__PURE__ */ jsx(DashboardCard, { "data-testid": "dashboard-quick-actions-card", className: "hidden lg:block p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-3", children: [
9529
+ /* @__PURE__ */ jsx(TextBody, { className: "mb-6", children: "A\xE7\xF5es r\xE1pidas" }),
9530
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-4 w-full", children: [
9531
+ /* @__PURE__ */ jsx(Link2, { "data-testid": "dashboard-quick-action-deposit", href: "/dashboard/deposit", className: "flex-1 min-w-0 cursor-pointer", onClick: () => quickActions.onDepositClick(), children: /* @__PURE__ */ jsxs(PrimaryButton, { children: [
9532
+ /* @__PURE__ */ jsx(MdOutlineArrowUpward, { className: "w-4 h-4 shrink-0" }),
9533
+ "Depositar"
9534
+ ] }) }),
9535
+ /* @__PURE__ */ jsx(Link2, { "data-testid": "dashboard-quick-action-withdraw", href: "/dashboard/withdraw", className: "flex-1 min-w-0 cursor-pointer", onClick: () => quickActions.onWithdrawClick(), children: /* @__PURE__ */ jsxs(PrimaryButton, { children: [
9536
+ /* @__PURE__ */ jsx(MdOutlineArrowDownward, { className: "w-4 h-4 shrink-0" }),
9537
+ "Sacar"
9538
+ ] }) }),
9539
+ /* @__PURE__ */ jsx(Link2, { "data-testid": "dashboard-quick-action-swap", href: "/dashboard/swap", className: "flex-1 min-w-0 cursor-pointer", onClick: () => quickActions.onSwapClick(), children: /* @__PURE__ */ jsxs(PrimaryButton, { children: [
9540
+ /* @__PURE__ */ jsx(MdOutlineSwapHoriz, { className: "w-4 h-4 shrink-0" }),
9541
+ "Trocar"
9542
+ ] }) })
9543
+ ] })
9544
+ ] }) }),
9545
+ /* @__PURE__ */ jsx("div", { className: "w-full bg-[#002608] rounded shadow-[0px_1px_3px_0px_rgba(0,0,0,0.1)] flex items-center justify-between cursor-pointer", children: /* @__PURE__ */ jsx(
9546
+ "img",
9547
+ {
9548
+ src: banner.imageUrl,
9549
+ alt: banner.altText,
9550
+ className: "w-full h-[90%] object-cover rounded"
9551
+ }
9552
+ ) }),
9553
+ /* @__PURE__ */ jsx(DashboardTokensView, __spreadValues({}, tokens)),
9554
+ /* @__PURE__ */ jsx(DashboardRecentTransactionsView, __spreadValues({}, recentTransactions))
9555
+ ] }),
9556
+ /* @__PURE__ */ jsx("div", { className: "lg:col-span-1 space-y-6", children: /* @__PURE__ */ jsx(DashboardInvestmentOpportunitiesView, __spreadValues({}, investmentOpportunities)) })
9557
+ ] }) });
9558
+ };
9093
9559
 
9094
- export { ActionButton, ActionSheet, AddressDisplay, ApyRange, BackButton, BackgroundContainer, BannerNotification, ChooseANetworkView, ChooseAStrategyActionsheetView, ChooseAnAssetSwapView, ChooseNetworkAndAssetViewSimple, CloseButton_default as CloseButton, CollapsibleInfoRow, CollapsibleSection, ConfirmSwapButtonView, ConfirmSwapButtonViewSimple, ConnectWalletList, Currency, DeframeComponentsProvider, DetailsHeader, EarnAmountInputView, EarnBalanceCard, EarnBytecodeErrorView, EarnDepositFailedView, EarnDepositFormView, EarnDepositProcessingView, EarnDepositSuccessView, EarnDepositWarningView, EarnDesktopView, EarnExploreGridView, EarnInvestedSectionView, EarnInvestmentDetailsView, EarnInvestmentSummaryView, EarnNoBalanceNotificationView, EarnPercentageButtonsView, EarnPositionCardView, EarnRecentTransactionsView, EarnTokenSelectorView, EarnTxStatusCardView, EarnWithdrawFailedView, EarnWithdrawFormView, EarnWithdrawProcessingView, EarnWithdrawSuccessView, EarnWithdrawTokenSelectorView, EarnWithdrawWarningView, Currency as Fiat, FlexCol, FlexRow, GroupedStrategyListView, HighRiskBadge, HistoryDepositDetailsView, HistoryListSkeleton, HistoryListView, HistorySwapDetailsView, HistoryTabEmpty, HistoryWithdrawDetailsView, InfoLabel, InfoRow, InfoRowIconLabel, InfoRowIconValue, InfoRowWithIcon, InfoValue, Input2 as Input, InvestmentCrossChainProcessingView, Label, Link, ListItem, ListItemContent, ListItemLeftSide, ListItemRightSide, LoadingDots, LowRiskBadge, MediumRiskBadge, Navbar, PercentageButton, PrimaryButton, ProcessingBadge, ProgressIndicator, ScrollableContent, SearchEmptyState, SearchInput, SecondaryButton, SectionCard, Select, SelectContent, SelectItem, SelectTrigger, Skeleton, StepDisplay, StepStatusIcon, StepStatusText, StrategyDetailsView, StrategyGridCard, SummaryDetails, SummaryDetailsCryptoControlV2, SwapAdvancedSettingsView, SwapAmountInputView, SwapCrossChainProcessingView, SwapFormView, SwapFormViewSimple, SwapFromCardView, SwapFromCardViewSimple, SwapHistoryView, SwapProcessingView, SwapProcessingViewSimple, SwapQuoteDetailsView, SwapSignatureWarningView, SwapSignatureWarningViewSimple, SwapSuccessView, SwapSuccessViewSimple, SwapToCardView, SwapToCardViewSimple, SwapTransactionFailedView, SwapTransactionFailedViewSimple, SwapWidgetFallbackView, Tabs, TabsContent, TabsList, TabsTrigger, TertiaryButton, Text_default as Text, TextAccent, TextBody, TextHeading, Title, TokenWithChainBadge, TransactionProcessingDetails, TransactionScreen, TransactionScreenIcon, TransactionScreenInvestmentCard, WalletBalances, WalletConnectPanel, WalletItem, ConnectWalletList as WalletList, WalletListContainer };
9560
+ export { ActionButton, ActionSheet, AddressDisplay, ApyRange, BackButton, BackgroundContainer, BannerNotification, ChooseANetworkView, ChooseAStrategyActionsheetView, ChooseAnAssetSwapView, ChooseNetworkAndAssetViewSimple, CloseButton_default as CloseButton, CollapsibleInfoRow, CollapsibleSection, ConfirmSwapButtonView, ConfirmSwapButtonViewSimple, ConnectWalletList, Currency, DashboardBalancesBreakdown, DashboardCard, DashboardInvestmentOpportunitiesView, DashboardPortfolioView, DashboardRecentTransactionsView, DashboardStrategiesListView, DashboardTokenListView, DashboardTokensView, DashboardTransactionsPlaceholder, DashboardView, DeframeComponentsProvider, DetailsHeader, EarnAmountInputView, EarnBalanceCard, EarnBytecodeErrorView, EarnDepositFailedView, EarnDepositFormView, EarnDepositProcessingView, EarnDepositSuccessView, EarnDepositWarningView, EarnDesktopView, EarnExploreGridView, EarnInvestedSectionView, EarnInvestmentDetailsView, EarnInvestmentSummaryView, EarnNoBalanceNotificationView, EarnPercentageButtonsView, EarnPositionCardView, EarnRecentTransactionsView, EarnTokenSelectorView, EarnTxStatusCardView, EarnWithdrawFailedView, EarnWithdrawFormView, EarnWithdrawProcessingView, EarnWithdrawSuccessView, EarnWithdrawTokenSelectorView, EarnWithdrawWarningView, Currency as Fiat, FlexCol, FlexRow, GroupedStrategyListView, HighRiskBadge, HistoryDepositDetailsView, HistoryListSkeleton, HistoryListView, HistorySwapDetailsView, HistoryTabEmpty, HistoryWithdrawDetailsView, InfoLabel, InfoRow, InfoRowIconLabel, InfoRowIconValue, InfoRowWithIcon, InfoValue, Input2 as Input, InvestmentCrossChainProcessingView, Label, Link, ListItem, ListItemContent, ListItemLeftSide, ListItemRightSide, LoadingDots, LowRiskBadge, MediumRiskBadge, Navbar, PercentageButton, PrimaryButton, ProcessingBadge, ProgressIndicator, ScrollableContent, SearchEmptyState, SearchInput, SecondaryButton, SectionCard, Select, SelectContent, SelectItem, SelectTrigger, Skeleton, StepDisplay, StepStatusIcon, StepStatusText, StrategyDetailsView, StrategyGridCard, SummaryDetails, SummaryDetailsCryptoControlV2, SwapAdvancedSettingsView, SwapAmountInputView, SwapCrossChainProcessingView, SwapFormView, SwapFormViewSimple, SwapFromCardView, SwapFromCardViewSimple, SwapHistoryView, SwapProcessingView, SwapProcessingViewSimple, SwapQuoteDetailsView, SwapSignatureWarningView, SwapSignatureWarningViewSimple, SwapSuccessView, SwapSuccessViewSimple, SwapToCardView, SwapToCardViewSimple, SwapTransactionFailedView, SwapTransactionFailedViewSimple, SwapWidgetFallbackView, Tabs, TabsContent, TabsList, TabsTrigger, TertiaryButton, Text_default as Text, TextAccent, TextBody, TextHeading, Title, TokenWithChainBadge, TransactionProcessingDetails, TransactionScreen, TransactionScreenIcon, TransactionScreenInvestmentCard, WalletBalances, WalletConnectPanel, WalletItem, ConnectWalletList as WalletList, WalletListContainer };
9095
9561
  //# sourceMappingURL=index.mjs.map
9096
9562
  //# sourceMappingURL=index.mjs.map