@0xsquid/ui 3.4.0-beta.0 → 3.4.1-beta-interactive-to-amount.0

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/esm/index.js CHANGED
@@ -5172,7 +5172,7 @@ function useConstant(init) {
5172
5172
 
5173
5173
  const isBrowser$1 = typeof window !== "undefined";
5174
5174
 
5175
- const useIsomorphicLayoutEffect$1 = isBrowser$1 ? useLayoutEffect : useEffect;
5175
+ const useIsomorphicLayoutEffect$2 = isBrowser$1 ? useLayoutEffect : useEffect;
5176
5176
 
5177
5177
  /**
5178
5178
  * @public
@@ -5477,7 +5477,7 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
5477
5477
  */
5478
5478
  const [diffedChildren, setDiffedChildren] = useState(presentChildren);
5479
5479
  const [renderedChildren, setRenderedChildren] = useState(presentChildren);
5480
- useIsomorphicLayoutEffect$1(() => {
5480
+ useIsomorphicLayoutEffect$2(() => {
5481
5481
  isInitialRender.current = false;
5482
5482
  pendingPresentChildren.current = presentChildren;
5483
5483
  /**
@@ -5576,7 +5576,7 @@ const DeprecatedLayoutGroupContext = createContext(null);
5576
5576
 
5577
5577
  function useIsMounted() {
5578
5578
  const isMounted = useRef(false);
5579
- useIsomorphicLayoutEffect$1(() => {
5579
+ useIsomorphicLayoutEffect$2(() => {
5580
5580
  isMounted.current = true;
5581
5581
  return () => {
5582
5582
  isMounted.current = false;
@@ -6221,7 +6221,7 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
6221
6221
  const wantsHandoff = useRef(Boolean(optimisedAppearId) &&
6222
6222
  !window.MotionHandoffIsComplete?.(optimisedAppearId) &&
6223
6223
  window.MotionHasOptimisedAnimation?.(optimisedAppearId));
6224
- useIsomorphicLayoutEffect$1(() => {
6224
+ useIsomorphicLayoutEffect$2(() => {
6225
6225
  if (!visualElement)
6226
6226
  return;
6227
6227
  isMounted.current = true;
@@ -19600,7 +19600,7 @@ var UserInputType;
19600
19600
  UserInputType[UserInputType["TOKEN"] = 0] = "TOKEN";
19601
19601
  UserInputType[UserInputType["USD"] = 1] = "USD";
19602
19602
  })(UserInputType || (UserInputType = {}));
19603
- function useNumericInput({ onAmountChange, token, balance, debounceInput, forcedAmount, formatIfVerySmall, inputModeButton, maxUsdDecimals, direction, initialInputMode = UserInputType.TOKEN, }) {
19603
+ function useNumericInput({ onAmountChange, token, balance, debounceInput, forcedAmount, formatIfVerySmall, inputModeButton, maxUsdDecimals, initialInputMode = UserInputType.TOKEN, }) {
19604
19604
  const [inputValue, setInputValue] = useState("");
19605
19605
  const [userInputType, setUserInputType] = useState(initialInputMode);
19606
19606
  useEffect(() => {
@@ -19698,16 +19698,8 @@ function useNumericInput({ onAmountChange, token, balance, debounceInput, forced
19698
19698
  if (isNaN(Number(inputValue)) || inputValue === "")
19699
19699
  return "0";
19700
19700
  if (userInputType === UserInputType.TOKEN) {
19701
- if (direction === "from") {
19702
- return formatUsdAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals), {
19703
- includeSign: false,
19704
- });
19705
- }
19706
- else {
19707
- return formatUsdAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : "0", {
19708
- includeSign: false,
19709
- });
19710
- }
19701
+ const usdAmount = (_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals);
19702
+ return formatUsdAmount(usdAmount, { includeSign: false });
19711
19703
  }
19712
19704
  else {
19713
19705
  return formatTokenAmount(convertUSDToTokenAmount(inputValue, token.price, token.decimals));
@@ -19715,7 +19707,6 @@ function useNumericInput({ onAmountChange, token, balance, debounceInput, forced
19715
19707
  }, [
19716
19708
  inputValue,
19717
19709
  userInputType,
19718
- direction,
19719
19710
  token.price,
19720
19711
  maxUsdDecimals,
19721
19712
  inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd,
@@ -39375,10 +39366,11 @@ const Card = ({ variant = "transparent", className, children, }) => {
39375
39366
  return (jsx("div", { className: cn("tw-rounded-squid-l tw-border tw-border-material-dark-average tw-bg-material-dark-average tw-backdrop-blur/10", className), children: children }));
39376
39367
  };
39377
39368
 
39369
+ const useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
39378
39370
  function useOnResize(ref, callback) {
39379
39371
  const callbackRef = useRef(callback);
39380
39372
  callbackRef.current = callback;
39381
- useLayoutEffect(() => {
39373
+ useIsomorphicLayoutEffect$1(() => {
39382
39374
  if (!ref.current)
39383
39375
  return;
39384
39376
  const observer = new ResizeObserver(([entry]) => {
@@ -39391,8 +39383,13 @@ function useOnResize(ref, callback) {
39391
39383
  return () => observer.disconnect();
39392
39384
  }, [ref.current]);
39393
39385
  }
39386
+ const EMPTY_RECT = {
39387
+ x: 0, y: 0, width: 0, height: 0,
39388
+ top: 0, left: 0, right: 0, bottom: 0,
39389
+ toJSON: () => ({}),
39390
+ };
39394
39391
  function useRect(ref) {
39395
- const [rect, setRect] = useState(() => new DOMRectReadOnly());
39392
+ const [rect, setRect] = useState(EMPTY_RECT);
39396
39393
  useOnResize(ref, setRect);
39397
39394
  return rect;
39398
39395
  }
@@ -39904,10 +39901,6 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp
39904
39901
  });
39905
39902
  // Save previous amount between renders for transition animation.
39906
39903
  useEffect(() => {
39907
- if (direction === "from") {
39908
- setForcedAmount(amount);
39909
- return;
39910
- }
39911
39904
  const { amount: prevAmount, chain: prevChain, token: prevToken, } = prevRef.current;
39912
39905
  const currentChain = JSON.stringify(chain);
39913
39906
  const currentToken = JSON.stringify(token);
@@ -39930,7 +39923,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp
39930
39923
  }, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
39931
39924
  token: "0.001",
39932
39925
  usd: "0.01",
39933
- }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: showNumericInputDetails, direction: direction, forcedAmount: forcedAmount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading, debounceInput: debounceInput })] }));
39926
+ }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: showNumericInputDetails, forcedAmount: forcedAmount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading, debounceInput: debounceInput })] }));
39934
39927
  }
39935
39928
 
39936
39929
  function AccountListItem({ isConnected, imageUrls = [], imageUrl, badgeUrl, actions, subtitle, title, }) {
@@ -40087,7 +40080,7 @@ const useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;
40087
40080
  * // Use `isSmallScreen` to conditionally apply styles or logic based on the screen size.
40088
40081
  * ```
40089
40082
  */
40090
- function useMediaQuery(query, { defaultValue = false, initializeWithValue = true, } = {}) {
40083
+ function useMediaQuery(query, { defaultValue = false, initializeWithValue = false, } = {}) {
40091
40084
  const getMatches = (query) => {
40092
40085
  if (IS_SERVER) {
40093
40086
  return defaultValue;
@@ -40175,6 +40168,8 @@ function useUserTheme() {
40175
40168
  const [themePreference, setThemePreference] = useState(getInitialTheme);
40176
40169
  const [themeType, setThemeType] = useState(getEffectiveTheme(themePreference));
40177
40170
  useEffect(() => {
40171
+ if (typeof window === "undefined")
40172
+ return;
40178
40173
  const handleThemeChange = (e) => {
40179
40174
  setThemePreference(e.detail);
40180
40175
  };
@@ -40184,6 +40179,8 @@ function useUserTheme() {
40184
40179
  };
40185
40180
  }, []);
40186
40181
  useEffect(() => {
40182
+ if (typeof window === "undefined")
40183
+ return;
40187
40184
  const mediaQuery = window.matchMedia(THEME_MEDIA_QUERY);
40188
40185
  const handleChange = () => {
40189
40186
  if (themePreference === ThemePreference.SYSTEM) {
@@ -40201,6 +40198,8 @@ function useUserTheme() {
40201
40198
  }, [themePreference]);
40202
40199
  const setThemeManually = (theme) => {
40203
40200
  setThemePreference(theme);
40201
+ if (typeof window === "undefined")
40202
+ return;
40204
40203
  localStorage.setItem(THEME_STORAGE_KEY, theme);
40205
40204
  window.dispatchEvent(new CustomEvent(THEME_CHANGE_EVENT, { detail: theme }));
40206
40205
  };
@@ -40222,6 +40221,8 @@ function getInitialTheme() {
40222
40221
  function getEffectiveTheme(themeType) {
40223
40222
  if (themeType !== ThemePreference.SYSTEM)
40224
40223
  return themeType;
40224
+ if (typeof window === "undefined")
40225
+ return "dark";
40225
40226
  return window.matchMedia(THEME_MEDIA_QUERY).matches ? "light" : "dark";
40226
40227
  }
40227
40228
 
@@ -41441,7 +41442,7 @@ function FilterSection({ title, children, collapsed = false, handleCollapse, han
41441
41442
  maxHeight: 0,
41442
41443
  },
41443
41444
  expanded: {
41444
- maxHeight: Math.min(height, window.innerHeight - 40) + "px",
41445
+ maxHeight: Math.min(height, (typeof window !== "undefined" ? window.innerHeight : height) - 40) + "px",
41445
41446
  },
41446
41447
  }), [height]);
41447
41448
  return (jsxs("div", { className: "tw-flex tw-min-h-10 tw-flex-col", children: [jsxs("div", { className: "tw-flex tw-min-h-squid-xl tw-shrink-0 tw-cursor-pointer tw-items-center tw-justify-between tw-px-squid-m tw-text-grey-300", onClick: () => {
@@ -41549,7 +41550,7 @@ function NumericInput(_a) {
41549
41550
  var { priceImpactPercentage, balance = "0", error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 2, formatIfVerySmall = {
41550
41551
  token: "0.001",
41551
41552
  usd: "0.01",
41552
- }, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton, debounceInput = true, initialInputMode = UserInputType.TOKEN, customSymbol, hideControls = false, hideBalance = false, containerClassName, inputClassName } = _a, props = __rest(_a, ["priceImpactPercentage", "balance", "error", "criticalPriceImpactPercentage", "token", "onAmountChange", "forcedAmount", "maxUsdDecimals", "formatIfVerySmall", "showDetails", "isLoading", "direction", "inputModeButton", "isInteractive", "balanceButton", "debounceInput", "initialInputMode", "customSymbol", "hideControls", "hideBalance", "containerClassName", "inputClassName"]);
41553
+ }, showDetails = true, isLoading = false, inputModeButton, isInteractive = false, balanceButton, debounceInput = true, initialInputMode = UserInputType.TOKEN, customSymbol, hideControls = false, hideBalance = false, containerClassName, inputClassName } = _a, props = __rest(_a, ["priceImpactPercentage", "balance", "error", "criticalPriceImpactPercentage", "token", "onAmountChange", "forcedAmount", "maxUsdDecimals", "formatIfVerySmall", "showDetails", "isLoading", "inputModeButton", "isInteractive", "balanceButton", "debounceInput", "initialInputMode", "customSymbol", "hideControls", "hideBalance", "containerClassName", "inputClassName"]);
41553
41554
  const { userInputType, inputValue, handleInputChange, handleSwitchInputMode, isTokenAmountVerySmall, isUsdAmountVerySmall, amountFormatted, onBalanceButtonClick, balanceFormatted, } = useNumericInput({
41554
41555
  onAmountChange,
41555
41556
  token,
@@ -41559,7 +41560,6 @@ function NumericInput(_a) {
41559
41560
  formatIfVerySmall,
41560
41561
  inputModeButton,
41561
41562
  maxUsdDecimals,
41562
- direction,
41563
41563
  initialInputMode,
41564
41564
  });
41565
41565
  const balanceChipClickable = isInteractive && parseFloat(balance) > 0;
@@ -41587,7 +41587,7 @@ function NumericInput(_a) {
41587
41587
  const totalPadding = Math.ceil(symbolWidth) + basePadding;
41588
41588
  return `${totalPadding}px`;
41589
41589
  };
41590
- return (jsxs("div", { className: "tw-relative tw-flex tw-w-full tw-flex-col", children: [isLoading && (jsx("div", { className: "tw-pointer-events-none tw-absolute tw-inset-0 tw-top-squid-xxs tw-z-10 tw-overflow-hidden", children: jsx("div", { className: "tw-h-full tw-w-[78.75rem] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), isInteractive && !isLoading ? (jsx("form", { className: cn(containerClassname, containerClassName), onSubmit: (e) => {
41590
+ return (jsxs("div", { className: "tw-relative tw-flex tw-w-full tw-flex-col", children: [isLoading && (jsx("div", { className: "tw-pointer-events-none tw-absolute tw-inset-0 tw-top-squid-xxs tw-z-10 tw-overflow-hidden", children: jsx("div", { className: "tw-h-full tw-w-[78.75rem] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx("form", { className: cn(containerClassname, containerClassName), onSubmit: (e) => {
41591
41591
  e.preventDefault();
41592
41592
  }, children: jsxs("span", { className: "tw-relative tw-w-full", children: [displaySymbol && (jsx("span", { ref: symbolRef, style: {
41593
41593
  transform: "translateY(-50%)",
@@ -41595,25 +41595,23 @@ function NumericInput(_a) {
41595
41595
  ? {
41596
41596
  paddingLeft: getInputPadding(),
41597
41597
  }
41598
- : undefined, className: cn("tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-500 focus:tw-outline-none", displaySymbol ? "tw-pr-squid-xs" : "tw-px-squid-xs", inputClassName) }, props))] }) })) : (jsx("div", { className: cn(containerClassname, (isLoading || Number(inputValue || 0) === 0) && loadingClassName, containerClassName), children: jsx("div", { className: "tw-font-regular tw-flex tw-h-[55px] tw-w-full tw-cursor-default tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-text-grey-300", children: jsx(AnimateNumber, { isLoading: isLoading, number: inputValue || "0", showMask: true }) }) })), !showDetails || hideControls ? null : (jsxs("footer", { className: cn("tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m", isLoading && loadingClassName), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsx(Tooltip, Object.assign({}, (isLoading
41599
- ? undefined
41600
- : userInputType === UserInputType.TOKEN
41601
- ? inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.tokenModeTooltip
41602
- : inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.usdModeTooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(AmountChip, { onClick: isInteractive
41603
- ? () => {
41604
- var _a;
41605
- handleSwitchInputMode();
41606
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
41607
- }
41608
- : undefined, className: cn(buttonClassName, isInteractive
41609
- ? interactiveChipClassName
41610
- : notInteractiveChipClassName), children: [jsx(SwapInputsIcon, {}), userInputType === UserInputType.TOKEN ? (jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? "<" : "", "$"] }), jsx(CaptionText, { children: isUsdAmountVerySmall
41611
- ? formatIfVerySmall.token
41612
- : amountFormatted })] })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? "<" : "", jsx(CaptionText, { children: isTokenAmountVerySmall
41613
- ? formatIfVerySmall.token
41614
- : amountFormatted }), " ", jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === "to" ? (jsxs("span", { className: cn("tw-flex tw-items-center", priceImpactClass), children: [jsx(ArrowTriangle, { className: Number(priceImpactPercentage) === 0
41615
- ? "tw-opacity-0"
41616
- : "" }), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat("%") })] })) : null] }) }))), !hideBalance && (jsx(Tooltip, Object.assign({}, (isLoading ? undefined : balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.tooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(BalanceChipTag, { disabled: !balanceChipClickable, onClick: balanceChipClickable ? onBalanceButtonClick : undefined, className: cn(buttonClassName, balanceChipClickable
41598
+ : undefined, className: cn("tw-peer tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-py-squid-s tw-text-transparent placeholder:tw-text-grey-600 placeholder:tw-opacity-0 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-500 focus:tw-outline-none focus:placeholder:tw-opacity-100", displaySymbol ? "tw-pr-squid-xs" : "tw-px-squid-xs", inputClassName) }, props)), jsx("div", { className: cn("tw-pointer-events-none tw-absolute tw-inset-0 tw-flex tw-items-center tw-rounded-squid-s tw-text-heading-small tw-text-grey-300 peer-focus:tw-opacity-0", displaySymbol ? "tw-pr-squid-xs" : "tw-px-squid-xs", (isLoading || Number(inputValue || 0) === 0) && loadingClassName), style: displaySymbol ? { paddingLeft: getInputPadding() } : undefined, children: jsx(AnimateNumber, { isLoading: isLoading, number: inputValue || "0", showMask: true }) })] }) }), !showDetails || hideControls ? null : (jsxs("footer", { className: cn("tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m", isLoading && loadingClassName), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsxs("div", { className: "tw-flex tw-h-squid-l tw-items-center tw-gap-1.5", children: [jsx(Tooltip, Object.assign({}, (isLoading
41599
+ ? undefined
41600
+ : userInputType === UserInputType.TOKEN
41601
+ ? inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.tokenModeTooltip
41602
+ : inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.usdModeTooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(AmountChip, { onClick: isInteractive
41603
+ ? () => {
41604
+ var _a;
41605
+ handleSwitchInputMode();
41606
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
41607
+ }
41608
+ : undefined, className: cn(buttonClassName, isInteractive
41609
+ ? interactiveChipClassName
41610
+ : notInteractiveChipClassName), children: [jsx(SwapInputsIcon, {}), userInputType === UserInputType.TOKEN ? (jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? "<" : "", "$"] }), jsx(CaptionText, { children: isUsdAmountVerySmall
41611
+ ? formatIfVerySmall.token
41612
+ : amountFormatted })] })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? "<" : "", jsx(CaptionText, { children: isTokenAmountVerySmall
41613
+ ? formatIfVerySmall.token
41614
+ : amountFormatted }), " ", jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] }))] }) })), priceImpactPercentage ? (jsxs("span", { className: cn("tw-flex tw-items-center", priceImpactClass), children: [Number(priceImpactPercentage) !== 0 && jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat("%") })] })) : null] })), !hideBalance && (jsx(Tooltip, Object.assign({}, (isLoading ? undefined : balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.tooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(BalanceChipTag, { disabled: !balanceChipClickable, onClick: balanceChipClickable ? onBalanceButtonClick : undefined, className: cn(buttonClassName, balanceChipClickable
41617
41615
  ? interactiveChipClassName
41618
41616
  : notInteractiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxs("div", { children: [userInputType === UserInputType.USD && (jsx(CaptionText, { className: "tw-opacity-66", children: "$" })), jsx(CaptionText, { children: balanceFormatted })] }), !(balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.hideMaxChip) && jsx(Chip, { label: "Max" })] }) })))] }))] }));
41619
41617
  }
@@ -83696,11 +83694,6 @@ function LinkButton({ href, label }) {
83696
83694
  return (jsxs("a", { href: href, target: "_blank", className: "tw-flex tw-items-center tw-gap-0.5", rel: "noreferrer", children: [label, jsx("div", { className: "tw-ml-0.5 tw-rounded-squid-xs tw-p-0.5 tw-text-royal-500 hover:tw-bg-material-light-thin", children: jsx(SquareArrowTopRightIcon, {}) })] }));
83697
83695
  }
83698
83696
 
83699
- const RefundedProperty = ({ token, amount, link, showGradientBg, }) => {
83700
- const detail = (jsx(IconLabel, { src: token.logoURI, rounded: "full", children: jsx(BodyText, { size: "small", children: amount }) }));
83701
- return (jsx(PropertyListItem, { variant: "large", showGradientBg: showGradientBg, label: `Refunded ${token.symbol}`, icon: jsx(SwapIcon, {}), detail: link ? jsx(LinkButton, { href: link, label: detail }) : detail }));
83702
- };
83703
-
83704
83697
  const TokenLink = ({ logoURI, amount, }) => {
83705
83698
  return (jsx(IconLabel, { src: logoURI, rounded: "full", children: amount ? (jsx(BodyText, { size: "small", children: amount })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })) }));
83706
83699
  };
@@ -83708,16 +83701,16 @@ const TokenProperty = ({ icon, label, token, link, amount, showGradientBg, }) =>
83708
83701
  return (jsx(PropertyListItem, { variant: "large", icon: icon, label: label, showGradientBg: showGradientBg, detail: token ? (link ? (jsx(LinkButton, { href: link, label: jsx(TokenLink, { logoURI: token.logoURI, amount: amount }) })) : (jsx(TokenLink, { logoURI: token.logoURI, amount: amount }))) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })) }));
83709
83702
  };
83710
83703
 
83711
- function SwapTransactionView({ title = "Swap", hash, toLink, fromLink, status, url, fromAmount, fromToken, toAmount, toToken, fromChain, toChain, fromAddress, toAddress, exchangeRate, timeToComplete, timestamp, actions, fees, isLoading, refundHash, refundLink, }) {
83704
+ function SwapTransactionView({ title = "Swap", hash, toLink, fromLink, status, url, fromAmount, fromToken, toAmount, toToken, fromChain, toChain, fromAddress, toAddress, exchangeRate, timeToComplete, timestamp, actions, fees, isLoading, }) {
83712
83705
  if (isLoading)
83713
83706
  return jsx(TransactionViewLayout, { isLoading: isLoading });
83714
- return (jsx(TransactionViewLayout, { header: jsx(TransactionHeaderLayout, { title: title, status: status, media: jsx(Drip, { direction: "horizontal", from: fromToken, to: toToken }), children: jsxs("div", { className: "tw-flex tw-items-center tw-gap-squid-xs tw-text-grey-500", children: [jsx(Chip, { label: "TX" }), jsx(HashLink, { hash: hash, url: url, showCopyButton: true, formattedHash: formatHash(hash) })] }) }), properties: jsxs(PropertiesLayout, { children: [jsx(TokenProperty, { token: fromToken, link: fromLink, amount: fromAmount, icon: jsx(ArrowRightDownCircleIcon, {}), label: jsxs(BodyText, { size: "small", children: ["Swap ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.symbol] }), showGradientBg: false }), jsx(TokenProperty, { token: toToken, link: toLink, amount: toAmount, icon: jsx(ArrowRightDownCircleIcon, {}), label: jsxs(BodyText, { size: "small", children: ["Receive ", toToken === null || toToken === void 0 ? void 0 : toToken.symbol] }) }), jsx(PropertyListItem, { variant: "large", showGradientBg: false, icon: jsx(ChainLink, { size: "24" }), label: "Chain", detail: jsx(Transfer, { from: fromChain ? (jsx(IconLabel, { src: fromChain.logoURI, children: jsx(BodyText, { size: "small", children: fromChain.name }) })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })), to: toChain ? (jsx(IconLabel, { src: toChain.logoURI, children: jsx(BodyText, { size: "small", children: toChain.name }) })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })) }) }), jsx(PropertyListItem, { variant: "large", icon: jsx(WalletFilledIcon, {}), label: "Wallet", detail: jsx(Transfer, { from: jsx(BodyText, { size: "small", children: jsx(CopyButton, { copyText: fromAddress, label: jsx(HashLink, { hash: fromAddress, formattedHash: formatHash(fromAddress) }) }) }), to: jsx(BodyText, { size: "small", children: jsx(CopyButton, { copyText: toAddress, label: jsx(HashLink, { hash: toAddress, formattedHash: formatHash(toAddress) }) }) }) }) }), jsx(PropertyListItem, { variant: "large", showGradientBg: false, icon: jsx(ArrowsSwapIcon, {}), label: "Exchange rate", detail: jsx(Transfer, { from: fromToken ? (jsxs(BodyText, { size: "small", children: ["1 ", fromToken.symbol] })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })), to: toToken && exchangeRate ? (jsxs(BodyText, { size: "small", children: [exchangeRate, " ", toToken.symbol] })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })) }) }), refundHash && status === "refunded" ? (jsx(RefundedProperty, { token: fromToken, amount: fromAmount, link: refundLink })) : (jsx(TimeToCompleteProperty, { timeToComplete: timeToComplete }))] }), actions: actions, fees: fees }));
83707
+ return (jsx(TransactionViewLayout, { header: jsx(TransactionHeaderLayout, { title: title, status: status, media: jsx(Drip, { direction: "horizontal", from: fromToken, to: toToken }), children: jsxs("div", { className: "tw-flex tw-items-center tw-gap-squid-xs tw-text-grey-500", children: [jsx(Chip, { label: "TX" }), jsx(HashLink, { hash: hash, url: url, showCopyButton: true, formattedHash: formatHash(hash) })] }) }), properties: jsxs(PropertiesLayout, { children: [jsx(TokenProperty, { token: fromToken, link: fromLink, amount: fromAmount, icon: jsx(ArrowRightDownCircleIcon, {}), label: jsxs(BodyText, { size: "small", children: ["Swap ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.symbol] }), showGradientBg: false }), jsx(TokenProperty, { token: toToken, link: toLink, amount: toAmount, icon: jsx(ArrowRightDownCircleIcon, {}), label: jsxs(BodyText, { size: "small", children: ["Receive ", toToken === null || toToken === void 0 ? void 0 : toToken.symbol] }) }), jsx(PropertyListItem, { variant: "large", showGradientBg: false, icon: jsx(ChainLink, { size: "24" }), label: "Chain", detail: jsx(Transfer, { from: fromChain ? (jsx(IconLabel, { src: fromChain.logoURI, children: jsx(BodyText, { size: "small", children: fromChain.name }) })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })), to: toChain ? (jsx(IconLabel, { src: toChain.logoURI, children: jsx(BodyText, { size: "small", children: toChain.name }) })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })) }) }), jsx(PropertyListItem, { variant: "large", icon: jsx(WalletFilledIcon, {}), label: "Wallet", detail: jsx(Transfer, { from: jsx(BodyText, { size: "small", children: jsx(CopyButton, { copyText: fromAddress, label: jsx(HashLink, { hash: fromAddress, formattedHash: formatHash(fromAddress) }) }) }), to: jsx(BodyText, { size: "small", children: jsx(CopyButton, { copyText: toAddress, label: jsx(HashLink, { hash: toAddress, formattedHash: formatHash(toAddress) }) }) }) }) }), jsx(PropertyListItem, { variant: "large", showGradientBg: false, icon: jsx(ArrowsSwapIcon, {}), label: "Exchange rate", detail: jsx(Transfer, { from: fromToken ? (jsxs(BodyText, { size: "small", children: ["1 ", fromToken.symbol] })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })), to: toToken && exchangeRate ? (jsxs(BodyText, { size: "small", children: [exchangeRate, " ", toToken.symbol] })) : (jsx(LoadingSkeleton, { className: "tw-bg-grey-700 tw-text-transparent" })) }) }), jsx(TimeToCompleteProperty, { timeToComplete: timeToComplete })] }), actions: actions, fees: fees }));
83715
83708
  }
83716
83709
 
83717
- function BridgeTransactionView({ title = "Bridge", hash, fromLink, toLink, status, url, fromAmount, toAmount, fromToken, toToken, fromChain, toChain, fromAddress, toAddress, actions, fees, timeToComplete, timestamp, isLoading, refundHash, refundLink, }) {
83710
+ function BridgeTransactionView({ title = "Bridge", hash, fromLink, toLink, status, url, fromAmount, toAmount, fromToken, toToken, fromChain, toChain, fromAddress, toAddress, actions, fees, timeToComplete, timestamp, isLoading, }) {
83718
83711
  if (isLoading)
83719
83712
  return jsx(TransactionViewLayout, { isLoading: isLoading });
83720
- return (jsx(TransactionViewLayout, { isLoading: isLoading, header: jsx(TransactionHeaderLayout, { title: title, status: status, media: jsxs("div", { className: "tw-relative", children: [jsx(Image$2, { src: fromChain.logoURI, size: "xlarge", rounded: "full" }), toChain ? (jsx("div", { className: "tw-absolute -tw-bottom-[1px] -tw-right-[1px] tw-rounded-md tw-border tw-border-white", children: jsx(Image$2, { src: toChain.logoURI, size: "medium" }) })) : (jsx("div", { className: "tw-absolute -tw-bottom-[1px] -tw-right-[1px] tw-w-squid-m tw-overflow-hidden tw-rounded-md", children: jsx(LoadingSkeleton, { className: "tw-bg-grey-600 tw-text-transparent" }) }))] }), children: jsxs("div", { className: "tw-flex tw-items-center tw-gap-squid-xs tw-text-grey-500", children: [jsx(Chip, { label: "TX" }), jsx(HashLink, { hash: hash, url: url, showCopyButton: true, formattedHash: formatHash(hash) })] }) }), properties: jsxs(PropertiesLayout, { children: [jsx(TokenProperty, { token: fromToken, amount: fromAmount, link: fromLink, icon: jsx(ArrowRightUpCircleIcon, {}), label: jsxs(BodyText, { size: "small", children: ["Bridge ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.symbol] }), showGradientBg: false }), jsx(TokenProperty, { token: toToken, amount: toAmount, link: toLink, icon: jsx(ArrowRightDownCircleIcon, {}), label: jsxs(BodyText, { size: "small", children: ["Receive ", toToken === null || toToken === void 0 ? void 0 : toToken.symbol] }) }), jsx(PropertyListItem, { variant: "large", showGradientBg: false, icon: jsx(ChainLink, { size: "24" }), label: "Chain", detail: jsx(Transfer, { from: jsx(IconLabel, { src: fromChain.logoURI, children: jsx(BodyText, { size: "small", children: fromChain.name }) }), to: toChain ? (jsx(IconLabel, { src: toChain.logoURI, children: jsx(BodyText, { size: "small", children: toChain.name }) })) : (jsx(LoadingSkeleton, {})) }) }), jsx(PropertyListItem, { variant: "large", icon: jsx(WalletFilledIcon, {}), label: "Wallet", detail: jsx(Transfer, { from: jsx(BodyText, { size: "small", children: jsx(CopyButton, { copyText: fromAddress, label: jsx(HashLink, { hash: fromAddress, formattedHash: formatHash(fromAddress) }) }) }), to: jsx(BodyText, { size: "small", children: jsx(CopyButton, { copyText: toAddress, label: jsx(HashLink, { hash: toAddress, formattedHash: formatHash(toAddress) }) }) }) }) }), refundHash && status === "refunded" ? (jsx(RefundedProperty, { token: fromToken, amount: fromAmount, link: refundLink })) : (jsx(TimeToCompleteProperty, { timeToComplete: timeToComplete }))] }), actions: actions, fees: fees }));
83713
+ return (jsx(TransactionViewLayout, { isLoading: isLoading, header: jsx(TransactionHeaderLayout, { title: title, status: status, media: jsxs("div", { className: "tw-relative", children: [jsx(Image$2, { src: fromChain.logoURI, size: "xlarge", rounded: "full" }), toChain ? (jsx("div", { className: "tw-absolute -tw-bottom-[1px] -tw-right-[1px] tw-rounded-md tw-border tw-border-white", children: jsx(Image$2, { src: toChain.logoURI, size: "medium" }) })) : (jsx("div", { className: "tw-absolute -tw-bottom-[1px] -tw-right-[1px] tw-w-squid-m tw-overflow-hidden tw-rounded-md", children: jsx(LoadingSkeleton, { className: "tw-bg-grey-600 tw-text-transparent" }) }))] }), children: jsxs("div", { className: "tw-flex tw-items-center tw-gap-squid-xs tw-text-grey-500", children: [jsx(Chip, { label: "TX" }), jsx(HashLink, { hash: hash, url: url, showCopyButton: true, formattedHash: formatHash(hash) })] }) }), properties: jsxs(PropertiesLayout, { children: [jsx(TokenProperty, { token: fromToken, amount: fromAmount, link: fromLink, icon: jsx(ArrowRightUpCircleIcon, {}), label: jsxs(BodyText, { size: "small", children: ["Bridge ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.symbol] }), showGradientBg: false }), jsx(TokenProperty, { token: toToken, amount: toAmount, link: toLink, icon: jsx(ArrowRightDownCircleIcon, {}), label: jsxs(BodyText, { size: "small", children: ["Receive ", toToken === null || toToken === void 0 ? void 0 : toToken.symbol] }) }), jsx(PropertyListItem, { variant: "large", showGradientBg: false, icon: jsx(ChainLink, { size: "24" }), label: "Chain", detail: jsx(Transfer, { from: jsx(IconLabel, { src: fromChain.logoURI, children: jsx(BodyText, { size: "small", children: fromChain.name }) }), to: toChain ? (jsx(IconLabel, { src: toChain.logoURI, children: jsx(BodyText, { size: "small", children: toChain.name }) })) : (jsx(LoadingSkeleton, {})) }) }), jsx(PropertyListItem, { variant: "large", icon: jsx(WalletFilledIcon, {}), label: "Wallet", detail: jsx(Transfer, { from: jsx(BodyText, { size: "small", children: jsx(CopyButton, { copyText: fromAddress, label: jsx(HashLink, { hash: fromAddress, formattedHash: formatHash(fromAddress) }) }) }), to: jsx(BodyText, { size: "small", children: jsx(CopyButton, { copyText: toAddress, label: jsx(HashLink, { hash: toAddress, formattedHash: formatHash(toAddress) }) }) }) }) }), jsx(TimeToCompleteProperty, { timeToComplete: timeToComplete })] }), actions: actions, fees: fees }));
83721
83714
  }
83722
83715
 
83723
83716
  function TransactionView({ type, isLoading, data, }) {
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { UserInputType } from "../../hooks/useNumericInput";
3
- import { type SwapDirection } from "../../types/components";
4
3
  import { type TooltipProps } from "./Tooltip";
5
4
  export interface Token {
6
5
  price: number;
@@ -35,7 +34,6 @@ export interface NumericInputProps {
35
34
  inputClassName?: string;
36
35
  }
37
36
  export interface Props extends NumericInputProps, React.InputHTMLAttributes<HTMLInputElement> {
38
- direction?: SwapDirection;
39
37
  showDetails?: boolean;
40
38
  isLoading?: boolean;
41
39
  isInteractive?: boolean;
@@ -45,4 +43,4 @@ export interface Props extends NumericInputProps, React.InputHTMLAttributes<HTML
45
43
  message: string;
46
44
  };
47
45
  }
48
- export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, debounceInput, initialInputMode, customSymbol, hideControls, hideBalance, containerClassName, inputClassName, ...props }: Props): import("react/jsx-runtime").JSX.Element;
46
+ export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, inputModeButton, isInteractive, balanceButton, debounceInput, initialInputMode, customSymbol, hideControls, hideBalance, containerClassName, inputClassName, ...props }: Props): import("react/jsx-runtime").JSX.Element;
@@ -29,6 +29,4 @@ export interface BaseTransactionViewProps {
29
29
  fees: FeesActionProps;
30
30
  timeToComplete: string;
31
31
  timestamp: number;
32
- refundHash?: string;
33
- refundLink?: string;
34
32
  }
@@ -34,5 +34,5 @@ type BridgeTransactionViewProps = (BaseBridgeTransactionViewProps & {
34
34
  }) | (Partial<Omit<BaseBridgeTransactionViewProps, keyof BaseTransactionViewProps>> & BaseTransactionViewProps & {
35
35
  isLoading: true;
36
36
  });
37
- export declare function BridgeTransactionView({ title, hash, fromLink, toLink, status, url, fromAmount, toAmount, fromToken, toToken, fromChain, toChain, fromAddress, toAddress, actions, fees, timeToComplete, timestamp, isLoading, refundHash, refundLink, }: BridgeTransactionViewProps): import("react/jsx-runtime").JSX.Element;
37
+ export declare function BridgeTransactionView({ title, hash, fromLink, toLink, status, url, fromAmount, toAmount, fromToken, toToken, fromChain, toChain, fromAddress, toAddress, actions, fees, timeToComplete, timestamp, isLoading, }: BridgeTransactionViewProps): import("react/jsx-runtime").JSX.Element;
38
38
  export {};
@@ -32,5 +32,5 @@ type SwapTransactionViewProps = (BaseSwapTransactionViewProps & {
32
32
  }) | (Partial<Omit<BaseSwapTransactionViewProps, keyof BaseTransactionViewProps>> & BaseTransactionViewProps & {
33
33
  isLoading: true;
34
34
  });
35
- export declare function SwapTransactionView({ title, hash, toLink, fromLink, status, url, fromAmount, fromToken, toAmount, toToken, fromChain, toChain, fromAddress, toAddress, exchangeRate, timeToComplete, timestamp, actions, fees, isLoading, refundHash, refundLink, }: SwapTransactionViewProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function SwapTransactionView({ title, hash, toLink, fromLink, status, url, fromAmount, fromToken, toAmount, toToken, fromChain, toChain, fromAddress, toAddress, exchangeRate, timeToComplete, timestamp, actions, fees, isLoading, }: SwapTransactionViewProps): import("react/jsx-runtime").JSX.Element;
36
36
  export {};
@@ -1,4 +1,4 @@
1
- type UseMediaQueryOptions = {
1
+ interface UseMediaQueryOptions {
2
2
  /**
3
3
  * The default value to return if the hook is being run on the server.
4
4
  * @default false
@@ -9,7 +9,7 @@ type UseMediaQueryOptions = {
9
9
  * @default true
10
10
  */
11
11
  initializeWithValue?: boolean;
12
- };
12
+ }
13
13
  /**
14
14
  * Custom hook that tracks the state of a media query using the [`Match Media API`](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia).
15
15
  * @param {string} query - The media query to track.
@@ -18,10 +18,9 @@ interface UseNumericInputOptions {
18
18
  };
19
19
  maxUsdDecimals?: number;
20
20
  debounceInput?: boolean;
21
- direction?: "from" | "to";
22
21
  initialInputMode?: UserInputType;
23
22
  }
24
- export declare function useNumericInput({ onAmountChange, token, balance, debounceInput, forcedAmount, formatIfVerySmall, inputModeButton, maxUsdDecimals, direction, initialInputMode, }: UseNumericInputOptions): {
23
+ export declare function useNumericInput({ onAmountChange, token, balance, debounceInput, forcedAmount, formatIfVerySmall, inputModeButton, maxUsdDecimals, initialInputMode, }: UseNumericInputOptions): {
25
24
  userInputType: UserInputType;
26
25
  inputValue: string;
27
26
  handleInputChange: (e: ChangeEvent<HTMLInputElement>) => void;
@@ -956,55 +956,3 @@ export declare const BridgeMissingToToken: {
956
956
  };
957
957
  };
958
958
  };
959
- export declare const BridgeRefunded: {
960
- args: {
961
- type: string;
962
- data: {
963
- title: string;
964
- hash: string;
965
- url: string;
966
- status: string;
967
- fromAmount: string;
968
- toAmount: string;
969
- fromToken: {
970
- logoURI: string;
971
- bgColor: string;
972
- symbol: string;
973
- };
974
- toToken: {
975
- logoURI: string;
976
- bgColor: string;
977
- symbol: string;
978
- };
979
- fromChain: {
980
- logoURI: string;
981
- name: string;
982
- bgColor: string;
983
- };
984
- toChain: {
985
- logoURI: string;
986
- name: string;
987
- bgColor: string;
988
- };
989
- fromAddress: string;
990
- toAddress: string;
991
- fromLink: string;
992
- timeToComplete: string;
993
- refundHash: string;
994
- refundLink: string;
995
- fees: {
996
- status: string;
997
- total: {
998
- label: string;
999
- usd: number;
1000
- };
1001
- lines: {
1002
- label: string;
1003
- usd: number;
1004
- amount: string;
1005
- symbol: string;
1006
- }[];
1007
- };
1008
- };
1009
- };
1010
- };