@deframe-sdk/components 0.1.72 → 0.1.74

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
@@ -2,7 +2,7 @@ import { twMerge } from 'tailwind-merge';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { HiXMark, HiChevronUp, HiChevronDown, HiChevronLeft, HiOutlineClock, HiArrowRight, HiArrowLeft } from 'react-icons/hi2';
4
4
  import * as React6 from 'react';
5
- import React6__default, { useMemo, useState, useEffect, useRef, useCallback } from 'react';
5
+ import React6__default, { useMemo, useState, useEffect, useRef, useCallback, useId } from 'react';
6
6
  import { motion, AnimatePresence } from 'framer-motion';
7
7
  import { MdClose, MdOutlineSearch, MdOutlineSearchOff, MdOutlineSwapHoriz, MdHistory, MdOutlineSwapVert, MdArrowRight, MdArrowDropDown, MdOutlineArrowBack, MdOutlineArrowDropDown, MdOutlineClose, MdContentCopy, MdOutlineExpandMore, MdQrCodeScanner, MdOutlineArrowUpward, MdOutlineArrowDownward, MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdAccessTime, MdArrowUpward, MdArrowDownward } from 'react-icons/md';
8
8
  import { IoAlertCircleOutline, IoTimeOutline, IoCheckmarkOutline } from 'react-icons/io5';
@@ -2106,8 +2106,8 @@ var ActionSheet = ({
2106
2106
  document.addEventListener("keydown", handleEscape);
2107
2107
  return () => document.removeEventListener("keydown", handleEscape);
2108
2108
  }, [isThisSheetActive, onClose]);
2109
- const handleBackdropClick = (e) => {
2110
- if (closeOnBackdropClick && e.target === e.currentTarget) {
2109
+ const handleBackdropClick = () => {
2110
+ if (closeOnBackdropClick) {
2111
2111
  onClose == null ? void 0 : onClose();
2112
2112
  }
2113
2113
  };
@@ -2189,6 +2189,7 @@ var ActionSheet = ({
2189
2189
  /* @__PURE__ */ jsx(
2190
2190
  motion.div,
2191
2191
  {
2192
+ onClick: (e) => e.stopPropagation(),
2192
2193
  className: twMerge(
2193
2194
  "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",
2194
2195
  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)]",
@@ -4409,11 +4410,20 @@ var SearchInput = ({
4409
4410
  inputTestId
4410
4411
  }) => {
4411
4412
  const [internalValue, setInternalValue] = useState(controlledValue || "");
4413
+ const inputRef = React6__default.useRef(null);
4412
4414
  useEffect(() => {
4413
4415
  if (controlledValue !== void 0) {
4414
4416
  setInternalValue(controlledValue);
4415
4417
  }
4416
4418
  }, [controlledValue]);
4419
+ useEffect(() => {
4420
+ if (!autoFocus || disabled) return;
4421
+ const frameId = requestAnimationFrame(() => {
4422
+ var _a;
4423
+ return (_a = inputRef.current) == null ? void 0 : _a.focus();
4424
+ });
4425
+ return () => cancelAnimationFrame(frameId);
4426
+ }, [autoFocus, disabled]);
4417
4427
  const handleInputChange = (newValue) => {
4418
4428
  setInternalValue(newValue);
4419
4429
  onChange == null ? void 0 : onChange(newValue);
@@ -4423,6 +4433,7 @@ var SearchInput = ({
4423
4433
  /* @__PURE__ */ jsx(
4424
4434
  "input",
4425
4435
  {
4436
+ ref: inputRef,
4426
4437
  "data-testid": inputTestId,
4427
4438
  type: "text",
4428
4439
  value: internalValue,
@@ -6320,6 +6331,7 @@ var ChooseAnAssetSwapView = ({
6320
6331
  onClose,
6321
6332
  onSearch,
6322
6333
  autoFocus,
6334
+ closeOnBackdropClick = true,
6323
6335
  displayedTokens,
6324
6336
  hasMore,
6325
6337
  onLoadMore,
@@ -6344,6 +6356,7 @@ var ChooseAnAssetSwapView = ({
6344
6356
  onClose,
6345
6357
  position: "bottom",
6346
6358
  height: "full",
6359
+ closeOnBackdropClick,
6347
6360
  contentClassName: "w-full max-w-[620px] mx-auto",
6348
6361
  children: /* @__PURE__ */ jsxs(BackgroundContainer, { className: "flex flex-col h-full", children: [
6349
6362
  /* @__PURE__ */ jsx(Navbar, { children: /* @__PURE__ */ jsx(CloseButton_default, { testId: `swap-token-actionsheet-close-${actionSheetId}`, onClick: onClose }) }),
@@ -6965,6 +6978,7 @@ var SwapFormView = ({
6965
6978
  onHistoryClick,
6966
6979
  onSwitchTokens,
6967
6980
  switchTokensAriaLabel,
6981
+ showHistoryTooltip = false,
6968
6982
  fromCard,
6969
6983
  toCard,
6970
6984
  advancedSettings,
@@ -6972,6 +6986,8 @@ var SwapFormView = ({
6972
6986
  priceImpactWarning,
6973
6987
  confirmButton
6974
6988
  }) => {
6989
+ const historyTooltipId = React6__default.useId();
6990
+ const historyTooltipProps = showHistoryTooltip ? { "aria-describedby": historyTooltipId, title: labels.historyAriaLabel } : {};
6975
6991
  return /* @__PURE__ */ jsxs(Fragment, { children: [
6976
6992
  /* @__PURE__ */ jsx(
6977
6993
  "div",
@@ -6984,17 +7000,29 @@ var SwapFormView = ({
6984
7000
  /* @__PURE__ */ jsx(TextHeading, { variant: "h5", className: "!text-[21px]", children: /* @__PURE__ */ jsx("span", { "data-testid": "swap-flow-title", children: labels.title }) }),
6985
7001
  labels.subtitle && /* @__PURE__ */ jsx(TextBody, { variant: "text-small", className: "!text-[14px]", children: labels.subtitle })
6986
7002
  ] }),
6987
- /* @__PURE__ */ jsx(
6988
- "button",
6989
- {
6990
- "data-testid": "swap-history-button",
6991
- type: "button",
6992
- onClick: onHistoryClick,
6993
- 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",
6994
- "aria-label": labels.historyAriaLabel,
6995
- children: /* @__PURE__ */ jsx(MdHistory, { className: "w-6 h-6" })
6996
- }
6997
- )
7003
+ /* @__PURE__ */ jsxs("div", { className: "relative inline-flex group", children: [
7004
+ /* @__PURE__ */ jsx(
7005
+ "button",
7006
+ __spreadProps(__spreadValues({
7007
+ "data-testid": "swap-history-button",
7008
+ type: "button",
7009
+ onClick: onHistoryClick,
7010
+ 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",
7011
+ "aria-label": labels.historyAriaLabel
7012
+ }, historyTooltipProps), {
7013
+ children: /* @__PURE__ */ jsx(MdHistory, { className: "w-6 h-6" })
7014
+ })
7015
+ ),
7016
+ showHistoryTooltip && /* @__PURE__ */ jsx(
7017
+ "span",
7018
+ {
7019
+ id: historyTooltipId,
7020
+ role: "tooltip",
7021
+ 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",
7022
+ children: labels.historyAriaLabel
7023
+ }
7024
+ )
7025
+ ] })
6998
7026
  ] }),
6999
7027
  /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col items-stretch gap-sm", children: [
7000
7028
  /* @__PURE__ */ jsx(SwapFromCardView, __spreadValues({}, fromCard)),
@@ -7914,6 +7942,10 @@ var ConfirmSwapButtonViewSimple = ({
7914
7942
  }
7915
7943
  ) });
7916
7944
  };
7945
+ var simpleDirectionRowClassNames = {
7946
+ default: "flex justify-center relative -my-[16px] z-[1]",
7947
+ compact: "flex justify-center relative -my-[12px] z-[1]"
7948
+ };
7917
7949
  var SwapFormViewSimple = ({
7918
7950
  onSubmit,
7919
7951
  formRef,
@@ -7921,6 +7953,8 @@ var SwapFormViewSimple = ({
7921
7953
  onHistoryClick,
7922
7954
  onSwitchTokens,
7923
7955
  switchTokensAriaLabel,
7956
+ showHistoryTooltip = false,
7957
+ directionButtonSpacing = "default",
7924
7958
  fromCard,
7925
7959
  toCard,
7926
7960
  advancedSettings,
@@ -7931,6 +7965,7 @@ var SwapFormViewSimple = ({
7931
7965
  const containerRef = useRef(null);
7932
7966
  const [panelPos, setPanelPos] = useState(null);
7933
7967
  const [showPanel, setShowPanel] = useState(false);
7968
+ const directionRowClassName = simpleDirectionRowClassNames[directionButtonSpacing];
7934
7969
  useEffect(() => {
7935
7970
  if (!advancedSettings.isOpen) setShowPanel(false);
7936
7971
  }, [advancedSettings.isOpen]);
@@ -7980,7 +8015,7 @@ var SwapFormViewSimple = ({
7980
8015
  {
7981
8016
  "data-test-id": "swap-form-simple-top-row",
7982
8017
  className: "flex items-center justify-end mb-[var(--deframe-widget-size-gap-sm)]",
7983
- children: /* @__PURE__ */ jsx(HistoryButton, { onClick: onHistoryClick, ariaLabel: labels.historyAriaLabel })
8018
+ children: /* @__PURE__ */ jsx(HistoryButton, { onClick: onHistoryClick, ariaLabel: labels.historyAriaLabel, showTooltip: showHistoryTooltip })
7984
8019
  }
7985
8020
  ),
7986
8021
  /* @__PURE__ */ jsx(
@@ -7999,7 +8034,7 @@ var SwapFormViewSimple = ({
7999
8034
  "div",
8000
8035
  {
8001
8036
  "data-test-id": "swap-form-simple-direction-row",
8002
- className: "flex justify-center relative -my-[16px] z-[1]",
8037
+ className: directionRowClassName,
8003
8038
  children: /* @__PURE__ */ jsx(
8004
8039
  SwapDirectionButton,
8005
8040
  {
@@ -8088,48 +8123,72 @@ var SwapFormViewSimple = ({
8088
8123
  }
8089
8124
  );
8090
8125
  };
8091
- function HistoryButton({ onClick, ariaLabel }) {
8092
- return /* @__PURE__ */ jsx(
8093
- "button",
8094
- {
8095
- "data-test-id": "swap-form-simple-history-button",
8096
- type: "button",
8097
- onClick,
8098
- "aria-label": ariaLabel,
8099
- className: twMerge(
8100
- "inline-flex items-center justify-center",
8101
- "w-9 h-9",
8102
- "rounded-[var(--deframe-widget-size-radius-sm)]",
8103
- "border-none",
8104
- "cursor-pointer",
8105
- "bg-transparent",
8106
- "hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_92%,transparent)]",
8107
- "transition-[background] duration-150",
8108
- "flex-shrink-0",
8109
- "outline-none",
8110
- "text-[color:var(--deframe-widget-color-text-secondary)]"
8111
- ),
8112
- children: /* @__PURE__ */ jsxs(
8113
- "svg",
8114
- {
8115
- "data-test-id": "swap-form-simple-history-icon",
8116
- viewBox: "0 0 24 24",
8117
- width: "20",
8118
- height: "20",
8119
- fill: "none",
8120
- stroke: "currentColor",
8121
- strokeWidth: "2",
8122
- strokeLinecap: "round",
8123
- strokeLinejoin: "round",
8124
- "aria-hidden": "true",
8125
- children: [
8126
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
8127
- /* @__PURE__ */ jsx("polyline", { points: "12 6 12 12 16 14" })
8128
- ]
8129
- }
8130
- )
8131
- }
8132
- );
8126
+ function HistoryButton({ onClick, ariaLabel, showTooltip }) {
8127
+ const tooltipId = useId();
8128
+ const tooltipProps = showTooltip ? { "aria-describedby": tooltipId, title: ariaLabel } : {};
8129
+ return /* @__PURE__ */ jsxs("div", { className: "relative inline-flex group", children: [
8130
+ /* @__PURE__ */ jsx(
8131
+ "button",
8132
+ __spreadProps(__spreadValues({
8133
+ "data-test-id": "swap-form-simple-history-button",
8134
+ type: "button",
8135
+ onClick,
8136
+ "aria-label": ariaLabel
8137
+ }, tooltipProps), {
8138
+ className: twMerge(
8139
+ "inline-flex items-center justify-center",
8140
+ "w-9 h-9",
8141
+ "rounded-[var(--deframe-widget-size-radius-sm)]",
8142
+ "border-none",
8143
+ "cursor-pointer",
8144
+ "bg-transparent",
8145
+ "hover:bg-[color:color-mix(in_srgb,var(--deframe-widget-color-bg-tertiary)_92%,transparent)]",
8146
+ "transition-[background] duration-150",
8147
+ "flex-shrink-0",
8148
+ "outline-none",
8149
+ "text-[color:var(--deframe-widget-color-text-secondary)]"
8150
+ ),
8151
+ children: /* @__PURE__ */ jsxs(
8152
+ "svg",
8153
+ {
8154
+ "data-test-id": "swap-form-simple-history-icon",
8155
+ viewBox: "0 0 24 24",
8156
+ width: "20",
8157
+ height: "20",
8158
+ fill: "none",
8159
+ stroke: "currentColor",
8160
+ strokeWidth: "2",
8161
+ strokeLinecap: "round",
8162
+ strokeLinejoin: "round",
8163
+ "aria-hidden": "true",
8164
+ children: [
8165
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
8166
+ /* @__PURE__ */ jsx("polyline", { points: "12 6 12 12 16 14" })
8167
+ ]
8168
+ }
8169
+ )
8170
+ })
8171
+ ),
8172
+ showTooltip && /* @__PURE__ */ jsx(
8173
+ "span",
8174
+ {
8175
+ id: tooltipId,
8176
+ role: "tooltip",
8177
+ className: twMerge(
8178
+ "pointer-events-none absolute right-0 top-full z-10 mt-[6px]",
8179
+ "rounded-[var(--deframe-widget-size-radius-xs)]",
8180
+ "bg-[var(--deframe-widget-color-bg-tertiary)]",
8181
+ "px-[8px] py-[5px]",
8182
+ "text-[12px] [font-weight:var(--deframe-widget-font-weight-medium)]",
8183
+ "text-[color:var(--deframe-widget-color-text-primary)]",
8184
+ "whitespace-nowrap shadow-[0px_4px_16px_0px_#00000066]",
8185
+ "opacity-0 transition-opacity duration-150",
8186
+ "group-hover:opacity-100 group-focus-within:opacity-100"
8187
+ ),
8188
+ children: ariaLabel
8189
+ }
8190
+ )
8191
+ ] });
8133
8192
  }
8134
8193
  function SwapDirectionButton({ onClick, ariaLabel }) {
8135
8194
  const [isHovered, setIsHovered] = useState(false);
@@ -8283,14 +8342,6 @@ function AdvancedPanelContent({ advancedSettings, transactionDetails }) {
8283
8342
  ]
8284
8343
  }
8285
8344
  ),
8286
- transactionDetails.exchangeRateFormatted && /* @__PURE__ */ jsx(
8287
- "p",
8288
- {
8289
- "data-test-id": "swap-form-simple-advanced-panel-subtitle",
8290
- className: "text-[13px] text-[color:var(--deframe-widget-color-text-secondary)] m-0 mb-[var(--deframe-widget-size-gap-sm)] leading-[1.4] font-[inherit]",
8291
- children: transactionDetails.exchangeRateFormatted
8292
- }
8293
- ),
8294
8345
  /* @__PURE__ */ jsx(
8295
8346
  "div",
8296
8347
  {
@@ -8299,9 +8350,15 @@ function AdvancedPanelContent({ advancedSettings, transactionDetails }) {
8299
8350
  }
8300
8351
  ),
8301
8352
  /* @__PURE__ */ jsx(DetailRow, { label: transactionDetails.labels.exchangeRateLabel, value: transactionDetails.exchangeRateFormatted }),
8302
- /* @__PURE__ */ jsx(DetailRow, { label: transactionDetails.labels.blockchainCostsLabel, value: transactionDetails.totalCostFormatted }),
8303
- /* @__PURE__ */ jsx(DetailRow, { label: transactionDetails.labels.networkGasLabel, value: transactionDetails.gasCostFormatted }),
8304
- /* @__PURE__ */ jsx(DetailRow, { label: transactionDetails.labels.protocolFeeLabel, value: transactionDetails.protocolFee }),
8353
+ /* @__PURE__ */ jsx(DetailRow, { label: transactionDetails.labels.blockchainCostsLabel, value: `- ${transactionDetails.totalCostFormatted}`, valueColor: "negative" }),
8354
+ /* @__PURE__ */ jsx(
8355
+ DetailRow,
8356
+ {
8357
+ label: transactionDetails.labels.priceImpactLabel,
8358
+ value: transactionDetails.priceImpactFormatted,
8359
+ valueColor: transactionDetails.priceImpactIsPositive ? "positive" : "negative"
8360
+ }
8361
+ ),
8305
8362
  /* @__PURE__ */ jsx(
8306
8363
  SlippageDetailRow,
8307
8364
  {
@@ -8318,7 +8375,12 @@ function AdvancedPanelContent({ advancedSettings, transactionDetails }) {
8318
8375
  }
8319
8376
  );
8320
8377
  }
8321
- function DetailRow({ label, value }) {
8378
+ var valueColorClassNames = {
8379
+ default: "text-[color:var(--deframe-widget-color-text-primary)]",
8380
+ negative: "text-[color:var(--deframe-widget-color-state-error)]",
8381
+ positive: "text-[color:var(--deframe-widget-color-state-success)]"
8382
+ };
8383
+ function DetailRow({ label, value, valueColor = "default" }) {
8322
8384
  if (!label && !value) return null;
8323
8385
  return /* @__PURE__ */ jsxs(
8324
8386
  "div",
@@ -8338,7 +8400,7 @@ function DetailRow({ label, value }) {
8338
8400
  "span",
8339
8401
  {
8340
8402
  "data-test-id": "swap-form-simple-detail-row-value",
8341
- className: "text-[13px] [font-weight:var(--deframe-widget-font-weight-semibold)] text-right font-[var(--deframe-widget-font-family)] text-[color:var(--deframe-widget-color-text-primary)]",
8403
+ className: twMerge("text-[13px] [font-weight:var(--deframe-widget-font-weight-semibold)] text-right font-[var(--deframe-widget-font-family)]", valueColorClassNames[valueColor]),
8342
8404
  children: value
8343
8405
  }
8344
8406
  )
@@ -9076,6 +9138,7 @@ function ChooseNetworkAndAssetViewSimple({
9076
9138
  onAssetClick,
9077
9139
  onSearch,
9078
9140
  autoFocus,
9141
+ closeOnBackdropClick = true,
9079
9142
  hasMore,
9080
9143
  onLoadMore,
9081
9144
  isFetching,
@@ -9092,6 +9155,9 @@ function ChooseNetworkAndAssetViewSimple({
9092
9155
  setQuery(q);
9093
9156
  onSearch(q);
9094
9157
  }, [onSearch]);
9158
+ const handleBackdropClick = React6.useCallback(() => {
9159
+ if (closeOnBackdropClick) onClose();
9160
+ }, [closeOnBackdropClick, onClose]);
9095
9161
  const handleNetworkSelect = React6.useCallback((network) => {
9096
9162
  var _a2;
9097
9163
  setQuery("");
@@ -9182,7 +9248,7 @@ function ChooseNetworkAndAssetViewSimple({
9182
9248
  animate: { opacity: 1 },
9183
9249
  exit: { opacity: 0 },
9184
9250
  transition: { duration: 0.2 },
9185
- onClick: onClose,
9251
+ onClick: handleBackdropClick,
9186
9252
  "data-test-id": "backdrop",
9187
9253
  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",
9188
9254
  children: /* @__PURE__ */ jsxs(
@@ -9306,7 +9372,7 @@ function ChooseNetworkAndAssetViewSimple({
9306
9372
  animate: { opacity: 1 },
9307
9373
  exit: { opacity: 0 },
9308
9374
  transition: { duration: 0.2 },
9309
- onClick: onClose,
9375
+ onClick: handleBackdropClick,
9310
9376
  "data-test-id": "backdrop",
9311
9377
  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)]",
9312
9378
  children: /* @__PURE__ */ jsxs(
@@ -9668,20 +9734,29 @@ var SwapHistoryView = ({
9668
9734
  isLoading,
9669
9735
  items,
9670
9736
  onItemClick,
9737
+ onClose,
9671
9738
  pageSize = 10
9672
9739
  }) => {
9740
+ var _a;
9673
9741
  const [visibleCount, setVisibleCount] = React6__default.useState(pageSize);
9742
+ const backHeader = onClose ? /* @__PURE__ */ jsx(DetailsHeader, { title: (_a = labels.title) != null ? _a : "", onBack: onClose, backAriaLabel: labels.closeAriaLabel, className: "px-0 pt-0" }) : null;
9674
9743
  if (isLoading) {
9675
- return /* @__PURE__ */ jsx(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: /* @__PURE__ */ jsx(LoadingSkeleton, {}) });
9744
+ return /* @__PURE__ */ 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: [
9745
+ backHeader,
9746
+ /* @__PURE__ */ jsx(LoadingSkeleton, {})
9747
+ ] });
9676
9748
  }
9677
9749
  if (items.length === 0) {
9678
- return /* @__PURE__ */ jsx(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: /* @__PURE__ */ jsx(
9679
- EmptyState,
9680
- {
9681
- title: labels.emptyTitle,
9682
- description: labels.emptyDescription
9683
- }
9684
- ) });
9750
+ return /* @__PURE__ */ 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: [
9751
+ backHeader,
9752
+ /* @__PURE__ */ jsx(
9753
+ EmptyState,
9754
+ {
9755
+ title: labels.emptyTitle,
9756
+ description: labels.emptyDescription
9757
+ }
9758
+ )
9759
+ ] });
9685
9760
  }
9686
9761
  const visibleItems = items.slice(0, visibleCount);
9687
9762
  const grouped = /* @__PURE__ */ new Map();
@@ -9696,26 +9771,29 @@ var SwapHistoryView = ({
9696
9771
  }
9697
9772
  const sortedDates = Array.from(grouped.keys()).sort((a, b) => b.localeCompare(a));
9698
9773
  const hasMore = items.length > visibleCount;
9699
- return /* @__PURE__ */ jsx(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: /* @__PURE__ */ jsxs("div", { className: "self-stretch flex flex-col gap-[16px]", children: [
9700
- sortedDates.map((dateKey) => {
9701
- const groupItems = grouped.get(dateKey);
9702
- const dateLabel = historyFormatDate(groupItems[0].createdAt, labels.locale);
9703
- return /* @__PURE__ */ jsxs("div", { className: "self-stretch flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
9704
- /* @__PURE__ */ 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 }),
9705
- groupItems.map((item) => /* @__PURE__ */ jsx(
9706
- HistoryListItem,
9707
- {
9708
- item,
9709
- labels: labels.historyItem,
9710
- onClick: onItemClick ? () => onItemClick(item.id) : void 0,
9711
- className: "!rounded-[var(--deframe-widget-size-radius-xs)] !border-0 !min-h-[72px]"
9712
- },
9713
- item.id
9714
- ))
9715
- ] }, dateKey);
9716
- }),
9717
- hasMore && labels.loadMoreLabel && /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-[var(--deframe-widget-size-padding-y-sm)]", children: /* @__PURE__ */ jsx(TertiaryButton, { onClick: () => setVisibleCount((c) => c + pageSize), children: labels.loadMoreLabel }) })
9718
- ] }) });
9774
+ return /* @__PURE__ */ 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: [
9775
+ backHeader,
9776
+ /* @__PURE__ */ jsxs("div", { className: "self-stretch flex flex-col gap-[16px]", children: [
9777
+ sortedDates.map((dateKey) => {
9778
+ const groupItems = grouped.get(dateKey);
9779
+ const dateLabel = historyFormatDate(groupItems[0].createdAt, labels.locale);
9780
+ return /* @__PURE__ */ jsxs("div", { className: "self-stretch flex flex-col gap-[var(--deframe-widget-size-gap-sm)]", children: [
9781
+ /* @__PURE__ */ 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 }),
9782
+ groupItems.map((item) => /* @__PURE__ */ jsx(
9783
+ HistoryListItem,
9784
+ {
9785
+ item,
9786
+ labels: labels.historyItem,
9787
+ onClick: onItemClick ? () => onItemClick(item.id) : void 0,
9788
+ className: "!rounded-[var(--deframe-widget-size-radius-xs)] !border-0 !min-h-[72px]"
9789
+ },
9790
+ item.id
9791
+ ))
9792
+ ] }, dateKey);
9793
+ }),
9794
+ hasMore && labels.loadMoreLabel && /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-[var(--deframe-widget-size-padding-y-sm)]", children: /* @__PURE__ */ jsx(TertiaryButton, { onClick: () => setVisibleCount((c) => c + pageSize), children: labels.loadMoreLabel }) })
9795
+ ] })
9796
+ ] });
9719
9797
  };
9720
9798
  var variantStyles2 = {
9721
9799
  SUCCESS: {