@deframe-sdk/components 0.1.72 → 0.1.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.
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +162 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +163 -88
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +21 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1535,6 +1535,7 @@ interface ChooseAnAssetSwapViewProps {
|
|
|
1535
1535
|
onClose: () => void;
|
|
1536
1536
|
onSearch: (value: string) => void;
|
|
1537
1537
|
autoFocus: boolean;
|
|
1538
|
+
closeOnBackdropClick?: boolean;
|
|
1538
1539
|
displayedTokens: TokenData[];
|
|
1539
1540
|
hasMore: boolean;
|
|
1540
1541
|
onLoadMore: () => void;
|
|
@@ -1705,6 +1706,8 @@ interface SwapFormViewProps {
|
|
|
1705
1706
|
onHistoryClick: () => void;
|
|
1706
1707
|
onSwitchTokens: () => void;
|
|
1707
1708
|
switchTokensAriaLabel: string;
|
|
1709
|
+
showHistoryTooltip?: boolean;
|
|
1710
|
+
directionButtonSpacing?: 'default' | 'compact';
|
|
1708
1711
|
fromCard: SwapFromCardViewProps;
|
|
1709
1712
|
toCard: SwapToCardViewProps;
|
|
1710
1713
|
advancedSettings: SwapAdvancedSettingsViewProps;
|
|
@@ -1799,12 +1802,13 @@ interface ChooseNetworkAndAssetViewSimpleProps {
|
|
|
1799
1802
|
onAssetClick: (token: TokenData) => void;
|
|
1800
1803
|
onSearch: (value: string) => void;
|
|
1801
1804
|
autoFocus?: boolean;
|
|
1805
|
+
closeOnBackdropClick?: boolean;
|
|
1802
1806
|
hasMore: boolean;
|
|
1803
1807
|
onLoadMore: () => void;
|
|
1804
1808
|
isFetching: boolean;
|
|
1805
1809
|
labels: ChooseNetworkAndAssetLabels;
|
|
1806
1810
|
}
|
|
1807
|
-
declare function ChooseNetworkAndAssetViewSimple({ isOpen, onClose, networks, selectedNetwork, onNetworkSelect, displayedTokens, findBalance, formatTokenAmount, formatCurrencyValue, onAssetClick, onSearch, autoFocus, hasMore, onLoadMore, isFetching, labels, }: ChooseNetworkAndAssetViewSimpleProps): react_jsx_runtime.JSX.Element;
|
|
1811
|
+
declare function ChooseNetworkAndAssetViewSimple({ isOpen, onClose, networks, selectedNetwork, onNetworkSelect, displayedTokens, findBalance, formatTokenAmount, formatCurrencyValue, onAssetClick, onSearch, autoFocus, closeOnBackdropClick, hasMore, onLoadMore, isFetching, labels, }: ChooseNetworkAndAssetViewSimpleProps): react_jsx_runtime.JSX.Element;
|
|
1808
1812
|
|
|
1809
1813
|
type HistoryListItemStatus = 'SUCCESS' | 'PENDING' | 'FAILED' | 'REFUNDED' | 'INITIAL';
|
|
1810
1814
|
type HistoryListItemType = 'SAMECHAIN_SWAP' | 'CROSSCHAIN_SWAP' | 'TRANSFER_IN' | 'TRANSFER_OUT' | 'ON_RAMP_FIAT' | 'OFF_RAMP_FIAT' | 'SAMECHAIN_INVESTMENT_DEPOSIT' | 'SAMECHAIN_INVESTMENT_WITHDRAW' | 'CROSSCHAIN_INVESTMENT_DEPOSIT' | 'CROSSCHAIN_INVESTMENT_WITHDRAW';
|
package/dist/index.d.ts
CHANGED
|
@@ -1535,6 +1535,7 @@ interface ChooseAnAssetSwapViewProps {
|
|
|
1535
1535
|
onClose: () => void;
|
|
1536
1536
|
onSearch: (value: string) => void;
|
|
1537
1537
|
autoFocus: boolean;
|
|
1538
|
+
closeOnBackdropClick?: boolean;
|
|
1538
1539
|
displayedTokens: TokenData[];
|
|
1539
1540
|
hasMore: boolean;
|
|
1540
1541
|
onLoadMore: () => void;
|
|
@@ -1705,6 +1706,8 @@ interface SwapFormViewProps {
|
|
|
1705
1706
|
onHistoryClick: () => void;
|
|
1706
1707
|
onSwitchTokens: () => void;
|
|
1707
1708
|
switchTokensAriaLabel: string;
|
|
1709
|
+
showHistoryTooltip?: boolean;
|
|
1710
|
+
directionButtonSpacing?: 'default' | 'compact';
|
|
1708
1711
|
fromCard: SwapFromCardViewProps;
|
|
1709
1712
|
toCard: SwapToCardViewProps;
|
|
1710
1713
|
advancedSettings: SwapAdvancedSettingsViewProps;
|
|
@@ -1799,12 +1802,13 @@ interface ChooseNetworkAndAssetViewSimpleProps {
|
|
|
1799
1802
|
onAssetClick: (token: TokenData) => void;
|
|
1800
1803
|
onSearch: (value: string) => void;
|
|
1801
1804
|
autoFocus?: boolean;
|
|
1805
|
+
closeOnBackdropClick?: boolean;
|
|
1802
1806
|
hasMore: boolean;
|
|
1803
1807
|
onLoadMore: () => void;
|
|
1804
1808
|
isFetching: boolean;
|
|
1805
1809
|
labels: ChooseNetworkAndAssetLabels;
|
|
1806
1810
|
}
|
|
1807
|
-
declare function ChooseNetworkAndAssetViewSimple({ isOpen, onClose, networks, selectedNetwork, onNetworkSelect, displayedTokens, findBalance, formatTokenAmount, formatCurrencyValue, onAssetClick, onSearch, autoFocus, hasMore, onLoadMore, isFetching, labels, }: ChooseNetworkAndAssetViewSimpleProps): react_jsx_runtime.JSX.Element;
|
|
1811
|
+
declare function ChooseNetworkAndAssetViewSimple({ isOpen, onClose, networks, selectedNetwork, onNetworkSelect, displayedTokens, findBalance, formatTokenAmount, formatCurrencyValue, onAssetClick, onSearch, autoFocus, closeOnBackdropClick, hasMore, onLoadMore, isFetching, labels, }: ChooseNetworkAndAssetViewSimpleProps): react_jsx_runtime.JSX.Element;
|
|
1808
1812
|
|
|
1809
1813
|
type HistoryListItemStatus = 'SUCCESS' | 'PENDING' | 'FAILED' | 'REFUNDED' | 'INITIAL';
|
|
1810
1814
|
type HistoryListItemType = 'SAMECHAIN_SWAP' | 'CROSSCHAIN_SWAP' | 'TRANSFER_IN' | 'TRANSFER_OUT' | 'ON_RAMP_FIAT' | 'OFF_RAMP_FIAT' | 'SAMECHAIN_INVESTMENT_DEPOSIT' | 'SAMECHAIN_INVESTMENT_WITHDRAW' | 'CROSSCHAIN_INVESTMENT_DEPOSIT' | 'CROSSCHAIN_INVESTMENT_WITHDRAW';
|
package/dist/index.js
CHANGED
|
@@ -2130,8 +2130,8 @@ var ActionSheet = ({
|
|
|
2130
2130
|
document.addEventListener("keydown", handleEscape);
|
|
2131
2131
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
2132
2132
|
}, [isThisSheetActive, onClose]);
|
|
2133
|
-
const handleBackdropClick = (
|
|
2134
|
-
if (closeOnBackdropClick
|
|
2133
|
+
const handleBackdropClick = () => {
|
|
2134
|
+
if (closeOnBackdropClick) {
|
|
2135
2135
|
onClose == null ? void 0 : onClose();
|
|
2136
2136
|
}
|
|
2137
2137
|
};
|
|
@@ -2213,6 +2213,7 @@ var ActionSheet = ({
|
|
|
2213
2213
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2214
2214
|
framerMotion.motion.div,
|
|
2215
2215
|
{
|
|
2216
|
+
onClick: (e) => e.stopPropagation(),
|
|
2216
2217
|
className: tailwindMerge.twMerge(
|
|
2217
2218
|
"relative w-full bg-[var(--deframe-widget-color-bg-secondary)] shadow-[0_20px_50px_color-mix(in_srgb,var(--deframe-widget-color-text-primary)_28%,transparent)] overflow-hidden",
|
|
2218
2219
|
position === "bottom" ? "max-w-full rounded-t-[var(--deframe-widget-size-radius-xl)]" : "max-w-lg rounded-[var(--deframe-widget-size-radius-xl)] mx-[var(--deframe-widget-size-gap-md)]",
|
|
@@ -4433,11 +4434,20 @@ var SearchInput = ({
|
|
|
4433
4434
|
inputTestId
|
|
4434
4435
|
}) => {
|
|
4435
4436
|
const [internalValue, setInternalValue] = React6.useState(controlledValue || "");
|
|
4437
|
+
const inputRef = React6__namespace.default.useRef(null);
|
|
4436
4438
|
React6.useEffect(() => {
|
|
4437
4439
|
if (controlledValue !== void 0) {
|
|
4438
4440
|
setInternalValue(controlledValue);
|
|
4439
4441
|
}
|
|
4440
4442
|
}, [controlledValue]);
|
|
4443
|
+
React6.useEffect(() => {
|
|
4444
|
+
if (!autoFocus || disabled) return;
|
|
4445
|
+
const frameId = requestAnimationFrame(() => {
|
|
4446
|
+
var _a;
|
|
4447
|
+
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
4448
|
+
});
|
|
4449
|
+
return () => cancelAnimationFrame(frameId);
|
|
4450
|
+
}, [autoFocus, disabled]);
|
|
4441
4451
|
const handleInputChange = (newValue) => {
|
|
4442
4452
|
setInternalValue(newValue);
|
|
4443
4453
|
onChange == null ? void 0 : onChange(newValue);
|
|
@@ -4447,6 +4457,7 @@ var SearchInput = ({
|
|
|
4447
4457
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4448
4458
|
"input",
|
|
4449
4459
|
{
|
|
4460
|
+
ref: inputRef,
|
|
4450
4461
|
"data-testid": inputTestId,
|
|
4451
4462
|
type: "text",
|
|
4452
4463
|
value: internalValue,
|
|
@@ -6344,6 +6355,7 @@ var ChooseAnAssetSwapView = ({
|
|
|
6344
6355
|
onClose,
|
|
6345
6356
|
onSearch,
|
|
6346
6357
|
autoFocus,
|
|
6358
|
+
closeOnBackdropClick = true,
|
|
6347
6359
|
displayedTokens,
|
|
6348
6360
|
hasMore,
|
|
6349
6361
|
onLoadMore,
|
|
@@ -6368,6 +6380,7 @@ var ChooseAnAssetSwapView = ({
|
|
|
6368
6380
|
onClose,
|
|
6369
6381
|
position: "bottom",
|
|
6370
6382
|
height: "full",
|
|
6383
|
+
closeOnBackdropClick,
|
|
6371
6384
|
contentClassName: "w-full max-w-[620px] mx-auto",
|
|
6372
6385
|
children: /* @__PURE__ */ jsxRuntime.jsxs(BackgroundContainer, { className: "flex flex-col h-full", children: [
|
|
6373
6386
|
/* @__PURE__ */ jsxRuntime.jsx(Navbar, { children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton_default, { testId: `swap-token-actionsheet-close-${actionSheetId}`, onClick: onClose }) }),
|
|
@@ -6989,6 +7002,7 @@ var SwapFormView = ({
|
|
|
6989
7002
|
onHistoryClick,
|
|
6990
7003
|
onSwitchTokens,
|
|
6991
7004
|
switchTokensAriaLabel,
|
|
7005
|
+
showHistoryTooltip = false,
|
|
6992
7006
|
fromCard,
|
|
6993
7007
|
toCard,
|
|
6994
7008
|
advancedSettings,
|
|
@@ -6996,6 +7010,8 @@ var SwapFormView = ({
|
|
|
6996
7010
|
priceImpactWarning,
|
|
6997
7011
|
confirmButton
|
|
6998
7012
|
}) => {
|
|
7013
|
+
const historyTooltipId = React6__namespace.default.useId();
|
|
7014
|
+
const historyTooltipProps = showHistoryTooltip ? { "aria-describedby": historyTooltipId, title: labels.historyAriaLabel } : {};
|
|
6999
7015
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7000
7016
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7001
7017
|
"div",
|
|
@@ -7008,17 +7024,29 @@ var SwapFormView = ({
|
|
|
7008
7024
|
/* @__PURE__ */ jsxRuntime.jsx(TextHeading, { variant: "h5", className: "!text-[21px]", children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "swap-flow-title", children: labels.title }) }),
|
|
7009
7025
|
labels.subtitle && /* @__PURE__ */ jsxRuntime.jsx(TextBody, { variant: "text-small", className: "!text-[14px]", children: labels.subtitle })
|
|
7010
7026
|
] }),
|
|
7011
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7027
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative inline-flex group", children: [
|
|
7028
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7029
|
+
"button",
|
|
7030
|
+
__spreadProps(__spreadValues({
|
|
7031
|
+
"data-testid": "swap-history-button",
|
|
7032
|
+
type: "button",
|
|
7033
|
+
onClick: onHistoryClick,
|
|
7034
|
+
className: "flex items-center justify-center w-12 h-12 transition-colors rounded-full cursor-pointer text-[color:var(--deframe-widget-color-text-secondary)] dark:text-[color:var(--deframe-widget-color-text-secondary-dark)] hover:text-brand-primary",
|
|
7035
|
+
"aria-label": labels.historyAriaLabel
|
|
7036
|
+
}, historyTooltipProps), {
|
|
7037
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(md.MdHistory, { className: "w-6 h-6" })
|
|
7038
|
+
})
|
|
7039
|
+
),
|
|
7040
|
+
showHistoryTooltip && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7041
|
+
"span",
|
|
7042
|
+
{
|
|
7043
|
+
id: historyTooltipId,
|
|
7044
|
+
role: "tooltip",
|
|
7045
|
+
className: "pointer-events-none absolute right-0 top-full z-10 mt-1 whitespace-nowrap rounded-[var(--deframe-widget-size-radius-xs)] bg-[var(--deframe-widget-color-bg-tertiary)] px-2 py-1 text-xs text-[color:var(--deframe-widget-color-text-primary)] opacity-0 shadow-lg transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
7046
|
+
children: labels.historyAriaLabel
|
|
7047
|
+
}
|
|
7048
|
+
)
|
|
7049
|
+
] })
|
|
7022
7050
|
] }),
|
|
7023
7051
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col items-stretch gap-sm", children: [
|
|
7024
7052
|
/* @__PURE__ */ jsxRuntime.jsx(SwapFromCardView, __spreadValues({}, fromCard)),
|
|
@@ -7938,6 +7966,10 @@ var ConfirmSwapButtonViewSimple = ({
|
|
|
7938
7966
|
}
|
|
7939
7967
|
) });
|
|
7940
7968
|
};
|
|
7969
|
+
var simpleDirectionRowClassNames = {
|
|
7970
|
+
default: "flex justify-center relative -my-[16px] z-[1]",
|
|
7971
|
+
compact: "flex justify-center relative -my-[12px] z-[1]"
|
|
7972
|
+
};
|
|
7941
7973
|
var SwapFormViewSimple = ({
|
|
7942
7974
|
onSubmit,
|
|
7943
7975
|
formRef,
|
|
@@ -7945,6 +7977,8 @@ var SwapFormViewSimple = ({
|
|
|
7945
7977
|
onHistoryClick,
|
|
7946
7978
|
onSwitchTokens,
|
|
7947
7979
|
switchTokensAriaLabel,
|
|
7980
|
+
showHistoryTooltip = false,
|
|
7981
|
+
directionButtonSpacing = "default",
|
|
7948
7982
|
fromCard,
|
|
7949
7983
|
toCard,
|
|
7950
7984
|
advancedSettings,
|
|
@@ -7955,6 +7989,7 @@ var SwapFormViewSimple = ({
|
|
|
7955
7989
|
const containerRef = React6.useRef(null);
|
|
7956
7990
|
const [panelPos, setPanelPos] = React6.useState(null);
|
|
7957
7991
|
const [showPanel, setShowPanel] = React6.useState(false);
|
|
7992
|
+
const directionRowClassName = simpleDirectionRowClassNames[directionButtonSpacing];
|
|
7958
7993
|
React6.useEffect(() => {
|
|
7959
7994
|
if (!advancedSettings.isOpen) setShowPanel(false);
|
|
7960
7995
|
}, [advancedSettings.isOpen]);
|
|
@@ -8004,7 +8039,7 @@ var SwapFormViewSimple = ({
|
|
|
8004
8039
|
{
|
|
8005
8040
|
"data-test-id": "swap-form-simple-top-row",
|
|
8006
8041
|
className: "flex items-center justify-end mb-[var(--deframe-widget-size-gap-sm)]",
|
|
8007
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { onClick: onHistoryClick, ariaLabel: labels.historyAriaLabel })
|
|
8042
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { onClick: onHistoryClick, ariaLabel: labels.historyAriaLabel, showTooltip: showHistoryTooltip })
|
|
8008
8043
|
}
|
|
8009
8044
|
),
|
|
8010
8045
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8023,7 +8058,7 @@ var SwapFormViewSimple = ({
|
|
|
8023
8058
|
"div",
|
|
8024
8059
|
{
|
|
8025
8060
|
"data-test-id": "swap-form-simple-direction-row",
|
|
8026
|
-
className:
|
|
8061
|
+
className: directionRowClassName,
|
|
8027
8062
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8028
8063
|
SwapDirectionButton,
|
|
8029
8064
|
{
|
|
@@ -8112,48 +8147,72 @@ var SwapFormViewSimple = ({
|
|
|
8112
8147
|
}
|
|
8113
8148
|
);
|
|
8114
8149
|
};
|
|
8115
|
-
function HistoryButton({ onClick, ariaLabel }) {
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
"
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8150
|
+
function HistoryButton({ onClick, ariaLabel, showTooltip }) {
|
|
8151
|
+
const tooltipId = React6.useId();
|
|
8152
|
+
const tooltipProps = showTooltip ? { "aria-describedby": tooltipId, title: ariaLabel } : {};
|
|
8153
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative inline-flex group", children: [
|
|
8154
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8155
|
+
"button",
|
|
8156
|
+
__spreadProps(__spreadValues({
|
|
8157
|
+
"data-test-id": "swap-form-simple-history-button",
|
|
8158
|
+
type: "button",
|
|
8159
|
+
onClick,
|
|
8160
|
+
"aria-label": ariaLabel
|
|
8161
|
+
}, tooltipProps), {
|
|
8162
|
+
className: tailwindMerge.twMerge(
|
|
8163
|
+
"inline-flex items-center justify-center",
|
|
8164
|
+
"w-9 h-9",
|
|
8165
|
+
"rounded-[var(--deframe-widget-size-radius-sm)]",
|
|
8166
|
+
"border-none",
|
|
8167
|
+
"cursor-pointer",
|
|
8168
|
+
"bg-transparent",
|
|
8169
|
+
"hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_92%,transparent)]",
|
|
8170
|
+
"transition-[background] duration-150",
|
|
8171
|
+
"flex-shrink-0",
|
|
8172
|
+
"outline-none",
|
|
8173
|
+
"text-[color:var(--deframe-widget-color-text-secondary)]"
|
|
8174
|
+
),
|
|
8175
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8176
|
+
"svg",
|
|
8177
|
+
{
|
|
8178
|
+
"data-test-id": "swap-form-simple-history-icon",
|
|
8179
|
+
viewBox: "0 0 24 24",
|
|
8180
|
+
width: "20",
|
|
8181
|
+
height: "20",
|
|
8182
|
+
fill: "none",
|
|
8183
|
+
stroke: "currentColor",
|
|
8184
|
+
strokeWidth: "2",
|
|
8185
|
+
strokeLinecap: "round",
|
|
8186
|
+
strokeLinejoin: "round",
|
|
8187
|
+
"aria-hidden": "true",
|
|
8188
|
+
children: [
|
|
8189
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
8190
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "12 6 12 12 16 14" })
|
|
8191
|
+
]
|
|
8192
|
+
}
|
|
8193
|
+
)
|
|
8194
|
+
})
|
|
8195
|
+
),
|
|
8196
|
+
showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8197
|
+
"span",
|
|
8198
|
+
{
|
|
8199
|
+
id: tooltipId,
|
|
8200
|
+
role: "tooltip",
|
|
8201
|
+
className: tailwindMerge.twMerge(
|
|
8202
|
+
"pointer-events-none absolute right-0 top-full z-10 mt-[6px]",
|
|
8203
|
+
"rounded-[var(--deframe-widget-size-radius-xs)]",
|
|
8204
|
+
"bg-[var(--deframe-widget-color-bg-tertiary)]",
|
|
8205
|
+
"px-[8px] py-[5px]",
|
|
8206
|
+
"text-[12px] [font-weight:var(--deframe-widget-font-weight-medium)]",
|
|
8207
|
+
"text-[color:var(--deframe-widget-color-text-primary)]",
|
|
8208
|
+
"whitespace-nowrap shadow-[0px_4px_16px_0px_#00000066]",
|
|
8209
|
+
"opacity-0 transition-opacity duration-150",
|
|
8210
|
+
"group-hover:opacity-100 group-focus-within:opacity-100"
|
|
8211
|
+
),
|
|
8212
|
+
children: ariaLabel
|
|
8213
|
+
}
|
|
8214
|
+
)
|
|
8215
|
+
] });
|
|
8157
8216
|
}
|
|
8158
8217
|
function SwapDirectionButton({ onClick, ariaLabel }) {
|
|
8159
8218
|
const [isHovered, setIsHovered] = React6.useState(false);
|
|
@@ -9100,6 +9159,7 @@ function ChooseNetworkAndAssetViewSimple({
|
|
|
9100
9159
|
onAssetClick,
|
|
9101
9160
|
onSearch,
|
|
9102
9161
|
autoFocus,
|
|
9162
|
+
closeOnBackdropClick = true,
|
|
9103
9163
|
hasMore,
|
|
9104
9164
|
onLoadMore,
|
|
9105
9165
|
isFetching,
|
|
@@ -9116,6 +9176,9 @@ function ChooseNetworkAndAssetViewSimple({
|
|
|
9116
9176
|
setQuery(q);
|
|
9117
9177
|
onSearch(q);
|
|
9118
9178
|
}, [onSearch]);
|
|
9179
|
+
const handleBackdropClick = React6__namespace.useCallback(() => {
|
|
9180
|
+
if (closeOnBackdropClick) onClose();
|
|
9181
|
+
}, [closeOnBackdropClick, onClose]);
|
|
9119
9182
|
const handleNetworkSelect = React6__namespace.useCallback((network) => {
|
|
9120
9183
|
var _a2;
|
|
9121
9184
|
setQuery("");
|
|
@@ -9206,7 +9269,7 @@ function ChooseNetworkAndAssetViewSimple({
|
|
|
9206
9269
|
animate: { opacity: 1 },
|
|
9207
9270
|
exit: { opacity: 0 },
|
|
9208
9271
|
transition: { duration: 0.2 },
|
|
9209
|
-
onClick:
|
|
9272
|
+
onClick: handleBackdropClick,
|
|
9210
9273
|
"data-test-id": "backdrop",
|
|
9211
9274
|
className: "fixed inset-0 bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-primary)_88%,transparent)] backdrop-blur-[4px] z-50 flex flex-col justify-end",
|
|
9212
9275
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -9330,7 +9393,7 @@ function ChooseNetworkAndAssetViewSimple({
|
|
|
9330
9393
|
animate: { opacity: 1 },
|
|
9331
9394
|
exit: { opacity: 0 },
|
|
9332
9395
|
transition: { duration: 0.2 },
|
|
9333
|
-
onClick:
|
|
9396
|
+
onClick: handleBackdropClick,
|
|
9334
9397
|
"data-test-id": "backdrop",
|
|
9335
9398
|
className: "fixed inset-0 bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-primary)_88%,transparent)] backdrop-blur-[4px] z-50 flex items-center justify-center px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)]",
|
|
9336
9399
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -9692,20 +9755,29 @@ var SwapHistoryView = ({
|
|
|
9692
9755
|
isLoading,
|
|
9693
9756
|
items,
|
|
9694
9757
|
onItemClick,
|
|
9758
|
+
onClose,
|
|
9695
9759
|
pageSize = 10
|
|
9696
9760
|
}) => {
|
|
9761
|
+
var _a;
|
|
9697
9762
|
const [visibleCount, setVisibleCount] = React6__namespace.default.useState(pageSize);
|
|
9763
|
+
const backHeader = onClose ? /* @__PURE__ */ jsxRuntime.jsx(DetailsHeader, { title: (_a = labels.title) != null ? _a : "", onBack: onClose, backAriaLabel: labels.closeAriaLabel, className: "px-0 pt-0" }) : null;
|
|
9698
9764
|
if (isLoading) {
|
|
9699
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
9765
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(BackgroundContainer, { className: "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)] flex flex-col min-h-0 flex-1", children: [
|
|
9766
|
+
backHeader,
|
|
9767
|
+
/* @__PURE__ */ jsxRuntime.jsx(LoadingSkeleton, {})
|
|
9768
|
+
] });
|
|
9700
9769
|
}
|
|
9701
9770
|
if (items.length === 0) {
|
|
9702
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9771
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(BackgroundContainer, { className: "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)] flex flex-col min-h-0 flex-1", children: [
|
|
9772
|
+
backHeader,
|
|
9773
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9774
|
+
EmptyState,
|
|
9775
|
+
{
|
|
9776
|
+
title: labels.emptyTitle,
|
|
9777
|
+
description: labels.emptyDescription
|
|
9778
|
+
}
|
|
9779
|
+
)
|
|
9780
|
+
] });
|
|
9709
9781
|
}
|
|
9710
9782
|
const visibleItems = items.slice(0, visibleCount);
|
|
9711
9783
|
const grouped = /* @__PURE__ */ new Map();
|
|
@@ -9720,26 +9792,29 @@ var SwapHistoryView = ({
|
|
|
9720
9792
|
}
|
|
9721
9793
|
const sortedDates = Array.from(grouped.keys()).sort((a, b) => b.localeCompare(a));
|
|
9722
9794
|
const hasMore = items.length > visibleCount;
|
|
9723
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9795
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(BackgroundContainer, { className: "px-[var(--deframe-widget-size-padding-x-md)] py-[var(--deframe-widget-size-padding-y-md)] flex flex-col min-h-0 flex-1", children: [
|
|
9796
|
+
backHeader,
|
|
9797
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "self-stretch flex flex-col gap-[16px]", children: [
|
|
9798
|
+
sortedDates.map((dateKey) => {
|
|
9799
|
+
const groupItems = grouped.get(dateKey);
|
|
9800
|
+
const dateLabel = historyFormatDate(groupItems[0].createdAt, labels.locale);
|
|
9801
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "self-stretch flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
|
|
9802
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "[font-size:var(--deframe-widget-font-size-sm)] [line-height:var(--deframe-widget-font-leading-sm)] text-[color:var(--deframe-widget-color-text-secondary)]", children: dateLabel }),
|
|
9803
|
+
groupItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9804
|
+
HistoryListItem,
|
|
9805
|
+
{
|
|
9806
|
+
item,
|
|
9807
|
+
labels: labels.historyItem,
|
|
9808
|
+
onClick: onItemClick ? () => onItemClick(item.id) : void 0,
|
|
9809
|
+
className: "!rounded-[var(--deframe-widget-size-radius-xs)] !border-0 !min-h-[72px]"
|
|
9810
|
+
},
|
|
9811
|
+
item.id
|
|
9812
|
+
))
|
|
9813
|
+
] }, dateKey);
|
|
9814
|
+
}),
|
|
9815
|
+
hasMore && labels.loadMoreLabel && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center pt-[var(--deframe-widget-size-padding-y-sm)]", children: /* @__PURE__ */ jsxRuntime.jsx(TertiaryButton, { onClick: () => setVisibleCount((c) => c + pageSize), children: labels.loadMoreLabel }) })
|
|
9816
|
+
] })
|
|
9817
|
+
] });
|
|
9743
9818
|
};
|
|
9744
9819
|
var variantStyles2 = {
|
|
9745
9820
|
SUCCESS: {
|