@0xsquid/ui 0.19.0 → 0.19.1

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.
Files changed (26) hide show
  1. package/dist/cjs/index.js +39 -30
  2. package/dist/cjs/types/components/buttons/AssetsButton.d.ts +2 -1
  3. package/dist/cjs/types/components/buttons/Button.d.ts +2 -1
  4. package/dist/cjs/types/components/layout/NavigationBar.d.ts +2 -1
  5. package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +1 -1
  6. package/dist/cjs/types/components/views/MainView.d.ts +3 -1
  7. package/dist/cjs/types/stories/buttons/AssetsButton.stories.d.ts +2 -0
  8. package/dist/cjs/types/stories/buttons/Button.stories.d.ts +5 -0
  9. package/dist/cjs/types/stories/layout/DetailsToolbar.stories.d.ts +1 -0
  10. package/dist/cjs/types/stories/layout/NavigationBar.stories.d.ts +1 -0
  11. package/dist/cjs/types/stories/layout/SwapConfiguration.stories.d.ts +2 -0
  12. package/dist/cjs/types/stories/views/MainView.stories.d.ts +1 -0
  13. package/dist/esm/index.js +39 -30
  14. package/dist/esm/types/components/buttons/AssetsButton.d.ts +2 -1
  15. package/dist/esm/types/components/buttons/Button.d.ts +2 -1
  16. package/dist/esm/types/components/layout/NavigationBar.d.ts +2 -1
  17. package/dist/esm/types/components/layout/SwapConfiguration.d.ts +1 -1
  18. package/dist/esm/types/components/views/MainView.d.ts +3 -1
  19. package/dist/esm/types/stories/buttons/AssetsButton.stories.d.ts +2 -0
  20. package/dist/esm/types/stories/buttons/Button.stories.d.ts +5 -0
  21. package/dist/esm/types/stories/layout/DetailsToolbar.stories.d.ts +1 -0
  22. package/dist/esm/types/stories/layout/NavigationBar.stories.d.ts +1 -0
  23. package/dist/esm/types/stories/layout/SwapConfiguration.stories.d.ts +2 -0
  24. package/dist/esm/types/stories/views/MainView.stories.d.ts +1 -0
  25. package/dist/index.d.ts +10 -5
  26. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -2986,24 +2986,25 @@ const buttonVariantClassMap = {
2986
2986
  // right now all variants have the same disabled styles
2987
2987
  // in the future, we can add more disabled styles for different variants
2988
2988
  const buttonDisabledClass = '!tw-bg-grey-800 !tw-text-grey-600 tw-cursor-not-allowed';
2989
+ const loadingClassname = 'tw-invisible tw-opacity-0';
2989
2990
  function Button$1(_a) {
2990
- var { label, disabled, size, variant, icon, link } = _a, props = __rest$1(_a, ["label", "disabled", "size", "variant", "icon", "link"]);
2991
- const children = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!disabled && jsxRuntime.jsx(ButtonHoverOverlay, { className: roundedClassMap[size] }), jsxRuntime.jsx("div", { className: "tw-relative tw-z-[5] tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: !label && !icon ? (props.children) : size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
2991
+ var { label, disabled, size, variant, icon, link, isLoading = false } = _a, props = __rest$1(_a, ["label", "disabled", "size", "variant", "icon", "link", "isLoading"]);
2992
+ const children = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!disabled && !isLoading && (jsxRuntime.jsx(ButtonHoverOverlay, { className: roundedClassMap[size] })), jsxRuntime.jsx("div", { className: "tw-relative tw-z-[5] tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: !label && !icon ? (props.children) : size === 'lg' ? (jsxRuntime.jsx("span", { className: "tw-px-squid-m", children: jsxRuntime.jsx(BodyText, { className: isLoading ? loadingClassname : '', size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
2992
2993
  // label only
2993
- jsxRuntime.jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
2994
+ jsxRuntime.jsx(BodyText, { className: isLoading ? loadingClassname : '', size: "small", children: label })) : !label && icon ? (
2994
2995
  // icon only
2995
- icon) : (
2996
+ isLoading ? null : (icon)) : (
2996
2997
  // icon and label
2997
2998
  jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })] }));
2998
- const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], 'tw-border-material-light-thin', !disabled && 'hover:tw-border-material-light-average', roundedClassMap[size],
2999
+ const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], 'tw-border-material-light-thin', !disabled && !isLoading && 'hover:tw-border-material-light-average', roundedClassMap[size],
2999
3000
  // disabled styles
3000
- disabled && buttonDisabledClass,
3001
+ disabled && buttonDisabledClass, isLoading && 'tw-cursor-not-allowed',
3001
3002
  // custom classes from props
3002
3003
  props.className);
3003
3004
  if (link) {
3004
3005
  return (jsxRuntime.jsx("a", { "aria-disabled": disabled, href: disabled ? undefined : link, target: "_blank", className: className, children: children }));
3005
3006
  }
3006
- return (jsxRuntime.jsx("button", Object.assign({}, props, { "aria-disabled": disabled, className: className, disabled: disabled, children: children })));
3007
+ return (jsxRuntime.jsx("button", Object.assign({}, props, { "aria-disabled": disabled || isLoading, className: className, disabled: disabled || isLoading, children: children })));
3007
3008
  }
3008
3009
  const ButtonHoverOverlay = ({ className }) => {
3009
3010
  return (jsxRuntime.jsx("span", { className: cn('tw-absolute tw-inset-0 tw-z-0 tw-hidden tw-h-full tw-w-full tw-bg-material-light-thin group-hover/base-button:tw-block', className) }));
@@ -3111,28 +3112,33 @@ const emptyChainIconTextClassNameMap = {
3111
3112
  primary: 'tw-text-grey-100',
3112
3113
  accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
3113
3114
  };
3114
- function AssetsButton({ chain, token, onClick, variant = 'primary', }) {
3115
- var _a, _b;
3115
+ function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, }) {
3116
+ var _a;
3116
3117
  const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
3117
3118
  const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
3118
- const tokenBgColor = (_b = (chain && token && token.bgColor)) !== null && _b !== void 0 ? _b : defaultBgColor;
3119
+ const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
3119
3120
  const bgGradient = React.useMemo(() => {
3120
- if (!chain) {
3121
+ if (!chain || isLoading) {
3121
3122
  return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
3122
3123
  }
3123
3124
  if (!token) {
3124
3125
  return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
3125
3126
  }
3126
3127
  return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
3127
- }, [chainBgColor, tokenBgColor, chain, token]);
3128
- return (jsxRuntime.jsxs("button", { onClick: onClick, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant]), children: [jsxRuntime.jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-cursor-pointer tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsxRuntime.jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-cursor-pointer tw-items-center tw-justify-between', chain && token ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
3128
+ }, [chainBgColor, tokenBgColor, chain, token, isLoading]);
3129
+ const ButtonTag = isLoading ? 'div' : 'button';
3130
+ return (jsxRuntime.jsxs(ButtonTag, { onClick: isLoading ? undefined : onClick, disabled: isLoading, "aria-disabled": isLoading, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant], isLoading && 'tw-cursor-not-allowed'), children: [jsxRuntime.jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsxRuntime.jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-items-center tw-justify-between', chain && token && !isLoading
3131
+ ? 'tw-w-[90px]'
3132
+ : 'tw-w-full tw-max-w-[72px]'), style: {
3129
3133
  backgroundImage: bgGradient,
3130
- }, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chain ? (jsxRuntime.jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (jsxRuntime.jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsxRuntime.jsx(PlusIcon, {}) })) }) }), chain && token ? (jsxRuntime.jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-cursor-pointer tw-overflow-hidden'), children: [jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
3134
+ }, children: jsxRuntime.jsx("div", { className: clsx(imageClass), children: chain && !isLoading ? (jsxRuntime.jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (!isLoading && (jsxRuntime.jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsxRuntime.jsx(PlusIcon, {}) }))) }) }), chain && token && !isLoading ? (jsxRuntime.jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-overflow-hidden'), children: [jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
3131
3135
  backgroundColor: tokenBgColor,
3132
- } }), jsxRuntime.jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', chain && token && 'tw-pl-[7px]'), style: {
3136
+ } }), jsxRuntime.jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', chain && token && !isLoading && 'tw-pl-[7px]'), style: {
3133
3137
  backgroundColor: tokenBgColor,
3134
3138
  color: token === null || token === void 0 ? void 0 : token.textColor,
3135
- }, children: [jsxRuntime.jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain) && 'tw-w-[135px]'), children: chain && token ? token.symbol : 'Select token' }), jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
3139
+ }, children: [jsxRuntime.jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
3140
+ ? token.symbol
3141
+ : !isLoading && 'Select token' }), !isLoading && jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
3136
3142
  }
3137
3143
 
3138
3144
  const CSS_VARS = {
@@ -16896,16 +16902,16 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
16896
16902
  const state = React.useMemo(() => {
16897
16903
  if (errorMessage)
16898
16904
  return 'error';
16899
- if (isLoading)
16900
- return 'loading';
16901
16905
  if (isEmpty)
16902
16906
  return 'empty';
16907
+ if (isLoading)
16908
+ return 'loading';
16903
16909
  return 'full';
16904
16910
  }, [errorMessage, isLoading, isEmpty]);
16905
16911
  const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
16906
16912
  return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-full tw-items-center tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500 mobile-lg:tw-w-card-large', state === 'error'
16907
16913
  ? 'tw-px-squid-m mobile-lg:tw-px-squid-l'
16908
- : 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button$1, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Tooltip, { tooltipContent: (flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled)
16914
+ : 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button$1, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: isLoading ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Tooltip, { tooltipContent: (flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled)
16909
16915
  ? flipButton.disabledMessage
16910
16916
  : undefined, tooltipWidth: "max", displayDelayMs: flipButton === null || flipButton === void 0 ? void 0 : flipButton.tooltipDisplayDelayMs, children: jsxRuntime.jsx("button", { disabled: flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled, onClick: onInvertSwapButtonClick, className: "tw-group/flip-button tw-flex tw-h-squid-xl tw-min-w-[60px] tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-transparent tw-px-squid-xs tw-py-squid-xxs tw-text-grey-300 hover:tw-bg-material-light-thin disabled:tw-cursor-not-allowed", children: jsxRuntime.jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !(flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled) &&
16911
16917
  'group-hover/flip-button:tw-rotate-180') }) }) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
@@ -17522,12 +17528,12 @@ function ModalContentDivider() {
17522
17528
  return (jsxRuntime.jsx("svg", { width: "100%", height: "11", viewBox: "0 0 400 11", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("rect", { x: "1", y: "5", width: "398", height: "1", fill: "currentColor" }) }));
17523
17529
  }
17524
17530
 
17525
- function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, }) {
17531
+ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, isLoading = false, }) {
17526
17532
  return (jsxRuntime.jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-text-grey-300', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900'), children: [jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton
17527
17533
  ? 'tw-px-squid-m'
17528
17534
  : 'tw-pl-squid-m tw-pr-squid-m mobile-lg:tw-pl-squid-l'), children: [displayBackButton ? (jsxRuntime.jsx(Button$1, { className: displayButtonShadows
17529
17535
  ? 'group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2'
17530
- : undefined, variant: "tertiary", size: "md", icon: jsxRuntime.jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsxRuntime.jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsxRuntime.jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsxRuntime.jsx(Button$1, { size: "md", variant: "tertiary", label: typeof action.labelOrIcon === 'string'
17536
+ : undefined, variant: "tertiary", size: "md", isLoading: isLoading, icon: jsxRuntime.jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsxRuntime.jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsxRuntime.jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsxRuntime.jsx(Button$1, { size: "md", variant: "tertiary", isLoading: isLoading, label: typeof action.labelOrIcon === 'string'
17531
17537
  ? action.labelOrIcon
17532
17538
  : undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
17533
17539
  ? null
@@ -18120,9 +18126,11 @@ function LogoContainer({ children }) {
18120
18126
  return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
18121
18127
  }
18122
18128
 
18123
- function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive = true, isLoading = true, }) {
18129
+ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = 'from', onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive = true, isLoading = false, }) {
18124
18130
  var _a, _b;
18125
- return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsxRuntime.jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxRuntime.jsxs("button", { onClick: onWalletButtonClick, className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600 hover:tw-bg-material-light-thin", children: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsxRuntime.jsx(BodyText, { size: "small", children: ":" }), jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsxRuntime.jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsxRuntime.jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] })] }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, { onClick: onAssetsButtonClick, chain: chain, token: token, variant: assetsButtonVariant }) }), isFetching && (jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsxRuntime.jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsxRuntime.jsx(NumericInput, { token: {
18131
+ const WalletButtonTag = isLoading ? 'div' : 'button';
18132
+ const isFetching = isFetchingProp || isLoading;
18133
+ return (jsxRuntime.jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsxRuntime.jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxRuntime.jsxs(WalletButtonTag, { onClick: isLoading ? undefined : onWalletButtonClick, className: cn('-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600', isLoading ? 'tw-opacity-50' : 'hover:tw-bg-material-light-thin'), children: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsxRuntime.jsx(BodyText, { size: "small", children: ":" }), !isLoading && (jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsxRuntime.jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsxRuntime.jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] }))] }) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, { onClick: onAssetsButtonClick, chain: chain, token: token, isLoading: isLoading, variant: assetsButtonVariant }) }), isFetching && (jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsxRuntime.jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsxRuntime.jsx(NumericInput, { token: {
18126
18134
  decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
18127
18135
  symbol: (_b = token === null || token === void 0 ? void 0 : token.symbol) !== null && _b !== void 0 ? _b : '',
18128
18136
  price: tokenPrice,
@@ -18131,7 +18139,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain,
18131
18139
  }, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
18132
18140
  token: '0.001',
18133
18141
  usd: '0.01',
18134
- }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, amountUsd: amountUsd, isInteractive: isInputInteractive })] }));
18142
+ }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, amountUsd: amountUsd, isInteractive: isInputInteractive && !isLoading })] }));
18135
18143
  }
18136
18144
 
18137
18145
  function SwapProgressViewHeader({ title, description, }) {
@@ -24243,6 +24251,7 @@ const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-roun
24243
24251
  // checks that the value includes at least one character different than `0` (zero), or `.` (dot)
24244
24252
  const RegExpNonZeroValue = /[^0.]/;
24245
24253
  const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
24254
+ const loadingClassName = 'tw-opacity-50';
24246
24255
  var InputMode;
24247
24256
  (function (InputMode) {
24248
24257
  InputMode[InputMode["TOKEN"] = 0] = "TOKEN";
@@ -24373,7 +24382,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
24373
24382
  }, [balance]);
24374
24383
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isInteractive ? (jsxRuntime.jsxs("form", { className: "tw-relative tw-h-[80.6px] tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-h-[75px] mobile-lg:tw-px-squid-m", onSubmit: (e) => {
24375
24384
  e.preventDefault();
24376
- }, children: [inputMode === InputMode.USD && (jsxRuntime.jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsxRuntime.jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs 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-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsxRuntime.jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && 'tw-opacity-50'), children: jsxRuntime.jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsxRuntime.jsx("span", { children: inputValue }) }) })), !showDetails ? null : (jsxRuntime.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 && 'tw-opacity-50'), children: [error ? (jsxRuntime.jsx("div", { className: "tw-px-squid-xs", children: jsxRuntime.jsx(ErrorMessage, { message: error.message }) })) : (jsxRuntime.jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsxRuntime.jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxRuntime.jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsxRuntime.jsx(CaptionText, { children: isUsdAmountVerySmall
24385
+ }, children: [inputMode === InputMode.USD && (jsxRuntime.jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsxRuntime.jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs 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-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsxRuntime.jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: jsxRuntime.jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsxRuntime.jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxRuntime.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 ? (jsxRuntime.jsx("div", { className: "tw-px-squid-xs", children: jsxRuntime.jsx(ErrorMessage, { message: error.message }) })) : (jsxRuntime.jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsxRuntime.jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxRuntime.jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsxRuntime.jsx(CaptionText, { children: isUsdAmountVerySmall
24377
24386
  ? formatIfVerySmall.token
24378
24387
  : amountFormatted })] }) })) : (jsxRuntime.jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsxRuntime.jsx(CaptionText, { children: isTokenAmountVerySmall
24379
24388
  ? formatIfVerySmall.token
@@ -24691,8 +24700,8 @@ const List = ({ children }) => {
24691
24700
  return (jsxRuntime.jsx("ul", { className: "tw-flex tw-flex-col tw-gap-squid-xxs tw-pb-squid-xs", children: children }));
24692
24701
  };
24693
24702
 
24694
- function MainView() {
24695
- return (jsxRuntime.jsxs(ProductCard, { children: [jsxRuntime.jsx(NavigationBar, { title: "Swap", actions: [
24703
+ function MainView({ isLoading }) {
24704
+ return (jsxRuntime.jsxs(ProductCard, { children: [jsxRuntime.jsx(NavigationBar, { isLoading: isLoading, title: "Swap", actions: [
24696
24705
  {
24697
24706
  labelOrIcon: jsxRuntime.jsx(ClockOutlineIcon, {}),
24698
24707
  id: 'history',
@@ -24701,7 +24710,7 @@ function MainView() {
24701
24710
  labelOrIcon: jsxRuntime.jsx(SettingsGearIcon, {}),
24702
24711
  id: 'settings',
24703
24712
  },
24704
- ] }), jsxRuntime.jsx(SwapConfiguration, { direction: "from", chain: {
24713
+ ] }), jsxRuntime.jsx(SwapConfiguration, { isLoading: isLoading, direction: "from", chain: {
24705
24714
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/blast.svg',
24706
24715
  bgColor: '#fcfc03',
24707
24716
  }, token: {
@@ -24714,7 +24723,7 @@ function MainView() {
24714
24723
  isDisabled: true,
24715
24724
  disabledMessage: 'Not enough USDC to flip the swap',
24716
24725
  tooltipDisplayDelayMs: 0,
24717
- }, boostDisabledMessage: "Boost not supported for this route" }), jsxRuntime.jsx(SwapConfiguration, { isFetching: true, direction: "to", chain: {
24726
+ }, boostDisabledMessage: "Boost not supported for this route", isLoading: isLoading, isEmpty: isLoading }), jsxRuntime.jsx(SwapConfiguration, { isLoading: isLoading, direction: "to", chain: {
24718
24727
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
24719
24728
  bgColor: '#e84142',
24720
24729
  }, token: {
@@ -24723,7 +24732,7 @@ function MainView() {
24723
24732
  bgColor: '#2775ca',
24724
24733
  textColor: '#fff',
24725
24734
  decimals: 6,
24726
- }, priceImpactPercentage: '7.2', balance: '2854', address: "so-so.eth", amount: "100" }), jsxRuntime.jsx("div", { className: "tw-h-full tw-max-h-[80px] tw-px-squid-m tw-pb-squid-m", children: jsxRuntime.jsx(Button$1, { variant: "primary", size: "lg", label: "Swap" }) })] }));
24735
+ }, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854', address: "so-so.eth", amount: isLoading ? undefined : '100' }), jsxRuntime.jsx("div", { className: "tw-h-full tw-max-h-[80px] tw-px-squid-m tw-pb-squid-m", children: jsxRuntime.jsx(Button$1, { variant: isLoading ? 'tertiary' : 'primary', size: "lg", label: "Swap", isLoading: isLoading }) })] }));
24727
24736
  }
24728
24737
 
24729
24738
  function PunkIcon({ size = '16' }) {
@@ -12,6 +12,7 @@ interface AssetsButtonProps {
12
12
  };
13
13
  onClick?: () => void;
14
14
  variant?: AssetsButtonVariant;
15
+ isLoading?: boolean;
15
16
  }
16
- export declare function AssetsButton({ chain, token, onClick, variant, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function AssetsButton({ chain, token, onClick, variant, isLoading, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
17
18
  export {};
@@ -7,6 +7,7 @@ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
7
7
  size: ButtonSize;
8
8
  disabled?: boolean;
9
9
  link?: string;
10
+ isLoading?: boolean;
10
11
  }
11
- export declare function Button({ label, disabled, size, variant, icon, link, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function Button({ label, disabled, size, variant, icon, link, isLoading, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
12
13
  export {};
@@ -12,6 +12,7 @@ interface NavigationBarProps {
12
12
  displayButtonShadows?: boolean;
13
13
  onBackButtonClick?: () => void;
14
14
  actions?: ActionButton[];
15
+ isLoading?: boolean;
15
16
  }
16
- export declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick, actions, }: NavigationBarProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick, actions, isLoading, }: NavigationBarProps): import("react/jsx-runtime").JSX.Element;
17
18
  export {};
@@ -33,5 +33,5 @@ interface SwapConfigurationProps {
33
33
  isInputInteractive?: boolean;
34
34
  isLoading?: boolean;
35
35
  }
36
- export declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
36
+ export declare function SwapConfiguration({ amount, tokenPrice, isFetching: isFetchingProp, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
37
37
  export {};
@@ -1 +1,3 @@
1
- export declare function MainView(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function MainView({ isLoading }: {
2
+ isLoading?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,8 @@ import { AssetsButton } from '../../components/buttons/AssetsButton';
3
3
  declare const meta: Meta<typeof AssetsButton>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
+ export declare const PrimaryVariantLoading: Story;
7
+ export declare const AccentVariantLoading: Story;
6
8
  export declare const PrimaryVariantEmpty: Story;
7
9
  export declare const AccentVariantEmpty: Story;
8
10
  export declare const ChainOnly: Story;
@@ -23,3 +23,8 @@ export declare const LargeTertiary: Story;
23
23
  export declare const LargeDisabled: Story;
24
24
  export declare const LargeAndLink: Story;
25
25
  export declare const LargeAndLinkDisabled: Story;
26
+ export declare const MediumWithIconLoading: Story;
27
+ export declare const MediumWithLabelLoading: Story;
28
+ export declare const MediumWithLongLabelLoading: Story;
29
+ export declare const LargeWithLabelLoading: Story;
30
+ export declare const LargeWithLongLabelLoading: Story;
@@ -6,6 +6,7 @@ type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const Loading: Story;
8
8
  export declare const Empty: Story;
9
+ export declare const EmptyLoading: Story;
9
10
  export declare const Error: Story;
10
11
  export declare const ErrorHelpButton: Story;
11
12
  export declare const BoostDisabled: Story;
@@ -9,4 +9,5 @@ export declare const BackButton: Story;
9
9
  export declare const Logo: Story;
10
10
  export declare const WithActions: Story;
11
11
  export declare const AllProps: Story;
12
+ export declare const Loading: Story;
12
13
  export declare const Transparent: Story;
@@ -5,6 +5,8 @@ export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const EmptyVariantPrimary: Story;
7
7
  export declare const EmptyVariantAccent: Story;
8
+ export declare const Loading: Story;
9
+ export declare const LoadingWithAllProps: Story;
8
10
  export declare const ChainOnly: Story;
9
11
  export declare const ChainAndToken: Story;
10
12
  export declare const WithSwapAmountUsd: Story;
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof MainView>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
+ export declare const Loading: Story;
package/dist/esm/index.js CHANGED
@@ -2966,24 +2966,25 @@ const buttonVariantClassMap = {
2966
2966
  // right now all variants have the same disabled styles
2967
2967
  // in the future, we can add more disabled styles for different variants
2968
2968
  const buttonDisabledClass = '!tw-bg-grey-800 !tw-text-grey-600 tw-cursor-not-allowed';
2969
+ const loadingClassname = 'tw-invisible tw-opacity-0';
2969
2970
  function Button$1(_a) {
2970
- var { label, disabled, size, variant, icon, link } = _a, props = __rest$1(_a, ["label", "disabled", "size", "variant", "icon", "link"]);
2971
- const children = (jsxs(Fragment, { children: [!disabled && jsx(ButtonHoverOverlay, { className: roundedClassMap[size] }), jsx("div", { className: "tw-relative tw-z-[5] tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: !label && !icon ? (props.children) : size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
2971
+ var { label, disabled, size, variant, icon, link, isLoading = false } = _a, props = __rest$1(_a, ["label", "disabled", "size", "variant", "icon", "link", "isLoading"]);
2972
+ const children = (jsxs(Fragment, { children: [!disabled && !isLoading && (jsx(ButtonHoverOverlay, { className: roundedClassMap[size] })), jsx("div", { className: "tw-relative tw-z-[5] tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: !label && !icon ? (props.children) : size === 'lg' ? (jsx("span", { className: "tw-px-squid-m", children: jsx(BodyText, { className: isLoading ? loadingClassname : '', size: "medium", children: label }) })) : size === 'md' ? (label && !icon ? (
2972
2973
  // label only
2973
- jsx(BodyText, { size: "small", children: label })) : !label && icon ? (
2974
+ jsx(BodyText, { className: isLoading ? loadingClassname : '', size: "small", children: label })) : !label && icon ? (
2974
2975
  // icon only
2975
- icon) : (
2976
+ isLoading ? null : (icon)) : (
2976
2977
  // icon and label
2977
2978
  jsxs(Fragment, { children: [icon, jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })] }));
2978
- const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], 'tw-border-material-light-thin', !disabled && 'hover:tw-border-material-light-average', roundedClassMap[size],
2979
+ const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonVariantClassMap[variant], 'tw-border-material-light-thin', !disabled && !isLoading && 'hover:tw-border-material-light-average', roundedClassMap[size],
2979
2980
  // disabled styles
2980
- disabled && buttonDisabledClass,
2981
+ disabled && buttonDisabledClass, isLoading && 'tw-cursor-not-allowed',
2981
2982
  // custom classes from props
2982
2983
  props.className);
2983
2984
  if (link) {
2984
2985
  return (jsx("a", { "aria-disabled": disabled, href: disabled ? undefined : link, target: "_blank", className: className, children: children }));
2985
2986
  }
2986
- return (jsx("button", Object.assign({}, props, { "aria-disabled": disabled, className: className, disabled: disabled, children: children })));
2987
+ return (jsx("button", Object.assign({}, props, { "aria-disabled": disabled || isLoading, className: className, disabled: disabled || isLoading, children: children })));
2987
2988
  }
2988
2989
  const ButtonHoverOverlay = ({ className }) => {
2989
2990
  return (jsx("span", { className: cn('tw-absolute tw-inset-0 tw-z-0 tw-hidden tw-h-full tw-w-full tw-bg-material-light-thin group-hover/base-button:tw-block', className) }));
@@ -3091,28 +3092,33 @@ const emptyChainIconTextClassNameMap = {
3091
3092
  primary: 'tw-text-grey-100',
3092
3093
  accent: 'group-data-[squid-theme-type=dark]:tw-text-grey-100 group-data-[squid-theme-type=light]:tw-text-grey-900',
3093
3094
  };
3094
- function AssetsButton({ chain, token, onClick, variant = 'primary', }) {
3095
- var _a, _b;
3095
+ function AssetsButton({ chain, token, onClick, variant = 'primary', isLoading = false, }) {
3096
+ var _a;
3096
3097
  const defaultBgColor = `var(${themeTypesKeys[themeKeyVariantMap[variant]].cssVariable})`;
3097
3098
  const chainBgColor = (_a = (chain && chain.bgColor)) !== null && _a !== void 0 ? _a : defaultBgColor;
3098
- const tokenBgColor = (_b = (chain && token && token.bgColor)) !== null && _b !== void 0 ? _b : defaultBgColor;
3099
+ const tokenBgColor = (chain && token && !isLoading && token.bgColor) || defaultBgColor;
3099
3100
  const bgGradient = useMemo(() => {
3100
- if (!chain) {
3101
+ if (!chain || isLoading) {
3101
3102
  return `linear-gradient(to right, ${defaultBgColor}, ${defaultBgColor})`;
3102
3103
  }
3103
3104
  if (!token) {
3104
3105
  return `linear-gradient(90deg, ${chainBgColor} 54.86%, ${tokenBgColor} 95.83%)`;
3105
3106
  }
3106
3107
  return `linear-gradient(to right, ${chainBgColor} 43.5%, ${tokenBgColor} 56.55%)`;
3107
- }, [chainBgColor, tokenBgColor, chain, token]);
3108
- return (jsxs("button", { onClick: onClick, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant]), children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-cursor-pointer tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-cursor-pointer tw-items-center tw-justify-between', chain && token ? 'tw-w-[90px]' : 'tw-w-full tw-max-w-[72px]'), style: {
3108
+ }, [chainBgColor, tokenBgColor, chain, token, isLoading]);
3109
+ const ButtonTag = isLoading ? 'div' : 'button';
3110
+ return (jsxs(ButtonTag, { onClick: isLoading ? undefined : onClick, disabled: isLoading, "aria-disabled": isLoading, className: cn('tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-items-center focus:tw-outline-none', buttonTextClassNameMap[variant], isLoading && 'tw-cursor-not-allowed'), children: [jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsx("div", { className: cn('tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-items-center tw-justify-between', chain && token && !isLoading
3111
+ ? 'tw-w-[90px]'
3112
+ : 'tw-w-full tw-max-w-[72px]'), style: {
3109
3113
  backgroundImage: bgGradient,
3110
- }, children: jsx("div", { className: clsx(imageClass), children: chain ? (jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsx(PlusIcon, {}) })) }) }), chain && token ? (jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-cursor-pointer tw-overflow-hidden'), children: [jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
3114
+ }, children: jsx("div", { className: clsx(imageClass), children: chain && !isLoading ? (jsx("img", { src: chain.iconUrl, alt: "", className: "tw-rounded-full" })) : (!isLoading && (jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsx(PlusIcon, {}) }))) }) }), chain && token && !isLoading ? (jsxs("div", { className: clsx(imageClass, 'tw-absolute tw-left-[54px] tw-h-squid-xl tw-overflow-hidden'), children: [jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
3111
3115
  backgroundColor: tokenBgColor,
3112
- } }), jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-cursor-pointer tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', chain && token && 'tw-pl-[7px]'), style: {
3116
+ } }), jsx("img", { src: token.iconUrl, alt: token.symbol, className: "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full" }), jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxs("div", { className: cn('tw-flex tw-h-squid-xl tw-w-fit tw-min-w-squid-xl tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border-b tw-border-r tw-border-t tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs', chain && token && !isLoading && 'tw-pl-[7px]'), style: {
3113
3117
  backgroundColor: tokenBgColor,
3114
3118
  color: token === null || token === void 0 ? void 0 : token.textColor,
3115
- }, children: [jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain) && 'tw-w-[135px]'), children: chain && token ? token.symbol : 'Select token' }), jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
3119
+ }, children: [jsx(BodyText, { size: "small", className: cn('tw-leading-[13px]', (!token || !chain || isLoading) && 'tw-w-[135px]'), children: chain && token && !isLoading
3120
+ ? token.symbol
3121
+ : !isLoading && 'Select token' }), !isLoading && jsx(ChevronLargeRightIcon, { className: "tw-opacity-66" })] })] }));
3116
3122
  }
3117
3123
 
3118
3124
  const CSS_VARS = {
@@ -16876,16 +16882,16 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
16876
16882
  const state = useMemo(() => {
16877
16883
  if (errorMessage)
16878
16884
  return 'error';
16879
- if (isLoading)
16880
- return 'loading';
16881
16885
  if (isEmpty)
16882
16886
  return 'empty';
16887
+ if (isLoading)
16888
+ return 'loading';
16883
16889
  return 'full';
16884
16890
  }, [errorMessage, isLoading, isEmpty]);
16885
16891
  const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
16886
16892
  return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-full tw-items-center tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500 mobile-lg:tw-w-card-large', state === 'error'
16887
16893
  ? 'tw-px-squid-m mobile-lg:tw-px-squid-l'
16888
- : 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button$1, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Tooltip, { tooltipContent: (flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled)
16894
+ : 'tw-px-squid-xs mobile-lg:tw-px-squid-m', isEmpty ? 'tw-justify-center' : 'tw-justify-between'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button$1, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: isLoading ? (jsx(Loader, { size: "32" })) : (jsx(Tooltip, { tooltipContent: (flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled)
16889
16895
  ? flipButton.disabledMessage
16890
16896
  : undefined, tooltipWidth: "max", displayDelayMs: flipButton === null || flipButton === void 0 ? void 0 : flipButton.tooltipDisplayDelayMs, children: jsx("button", { disabled: flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled, onClick: onInvertSwapButtonClick, className: "tw-group/flip-button tw-flex tw-h-squid-xl tw-min-w-[60px] tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-transparent tw-px-squid-xs tw-py-squid-xxs tw-text-grey-300 hover:tw-bg-material-light-thin disabled:tw-cursor-not-allowed", children: jsx(ChevronLargeDownIcon, { className: cn('tw-transition-transform tw-duration-150', !(flipButton === null || flipButton === void 0 ? void 0 : flipButton.isDisabled) &&
16891
16897
  'group-hover/flip-button:tw-rotate-180') }) }) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
@@ -17502,12 +17508,12 @@ function ModalContentDivider() {
17502
17508
  return (jsx("svg", { width: "100%", height: "11", viewBox: "0 0 400 11", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("rect", { x: "1", y: "5", width: "398", height: "1", fill: "currentColor" }) }));
17503
17509
  }
17504
17510
 
17505
- function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, }) {
17511
+ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, isLoading = false, }) {
17506
17512
  return (jsxs("nav", { className: cn('tw-flex tw-max-h-[120px] tw-min-w-96 tw-flex-col tw-text-grey-300', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-900'), children: [jsxs("div", { className: cn('tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs', displayBackButton
17507
17513
  ? 'tw-px-squid-m'
17508
17514
  : 'tw-pl-squid-m tw-pr-squid-m mobile-lg:tw-pl-squid-l'), children: [displayBackButton ? (jsx(Button$1, { className: displayButtonShadows
17509
17515
  ? 'group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2'
17510
- : undefined, variant: "tertiary", size: "md", icon: jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsx(Button$1, { size: "md", variant: "tertiary", label: typeof action.labelOrIcon === 'string'
17516
+ : undefined, variant: "tertiary", size: "md", isLoading: isLoading, icon: jsx(ArrowLeftIcon, {}), onClick: onBackButtonClick })) : null, logoUrl ? (jsx("img", { src: logoUrl, className: "tw-h-squid-xl tw-min-w-squid-xl" })) : null, jsx("span", { className: "tw-flex tw-flex-1 tw-items-center tw-justify-end tw-gap-squid-xxs", children: actions === null || actions === void 0 ? void 0 : actions.map((action) => (jsx(Button$1, { size: "md", variant: "tertiary", isLoading: isLoading, label: typeof action.labelOrIcon === 'string'
17511
17517
  ? action.labelOrIcon
17512
17518
  : undefined, className: "tw-text-grey-300", icon: typeof action.labelOrIcon === 'string'
17513
17519
  ? null
@@ -18100,9 +18106,11 @@ function LogoContainer({ children }) {
18100
18106
  return (jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
18101
18107
  }
18102
18108
 
18103
- function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive = true, isLoading = true, }) {
18109
+ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = 'from', onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive = true, isLoading = false, }) {
18104
18110
  var _a, _b;
18105
- return (jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxs("button", { onClick: onWalletButtonClick, className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600 hover:tw-bg-material-light-thin", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] })] }) }), jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsx(AssetsButton, { onClick: onAssetsButtonClick, chain: chain, token: token, variant: assetsButtonVariant }) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
18111
+ const WalletButtonTag = isLoading ? 'div' : 'button';
18112
+ const isFetching = isFetchingProp || isLoading;
18113
+ return (jsxs("section", { className: "tw-relative tw-h-[211px] tw-max-h-[211px] tw-w-full tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m mobile-lg:tw-h-[205px] mobile-lg:tw-max-h-[205px] mobile-lg:tw-w-card-large", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxs(WalletButtonTag, { onClick: isLoading ? undefined : onWalletButtonClick, className: cn('-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600', isLoading ? 'tw-opacity-50' : 'hover:tw-bg-material-light-thin'), children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), !isLoading && (jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] }))] }) }), jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsx(AssetsButton, { onClick: onAssetsButtonClick, chain: chain, token: token, isLoading: isLoading, variant: assetsButtonVariant }) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
18106
18114
  decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
18107
18115
  symbol: (_b = token === null || token === void 0 ? void 0 : token.symbol) !== null && _b !== void 0 ? _b : '',
18108
18116
  price: tokenPrice,
@@ -18111,7 +18119,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain,
18111
18119
  }, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
18112
18120
  token: '0.001',
18113
18121
  usd: '0.01',
18114
- }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, amountUsd: amountUsd, isInteractive: isInputInteractive })] }));
18122
+ }, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: !!token, direction: direction, forcedAmount: amount, amountUsd: amountUsd, isInteractive: isInputInteractive && !isLoading })] }));
18115
18123
  }
18116
18124
 
18117
18125
  function SwapProgressViewHeader({ title, description, }) {
@@ -24223,6 +24231,7 @@ const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-roun
24223
24231
  // checks that the value includes at least one character different than `0` (zero), or `.` (dot)
24224
24232
  const RegExpNonZeroValue = /[^0.]/;
24225
24233
  const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
24234
+ const loadingClassName = 'tw-opacity-50';
24226
24235
  var InputMode;
24227
24236
  (function (InputMode) {
24228
24237
  InputMode[InputMode["TOKEN"] = 0] = "TOKEN";
@@ -24353,7 +24362,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
24353
24362
  }, [balance]);
24354
24363
  return (jsxs(Fragment, { children: [isInteractive ? (jsxs("form", { className: "tw-relative tw-h-[80.6px] tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-h-[75px] mobile-lg:tw-px-squid-m", onSubmit: (e) => {
24355
24364
  e.preventDefault();
24356
- }, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs 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-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && 'tw-opacity-50'), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: inputValue }) }) })), !showDetails ? 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 && 'tw-opacity-50'), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsx(Fragment, { children: 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
24365
+ }, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs 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-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? 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(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsx(Fragment, { children: 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
24357
24366
  ? formatIfVerySmall.token
24358
24367
  : amountFormatted })] }) })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsx(CaptionText, { children: isTokenAmountVerySmall
24359
24368
  ? formatIfVerySmall.token
@@ -24671,8 +24680,8 @@ const List = ({ children }) => {
24671
24680
  return (jsx("ul", { className: "tw-flex tw-flex-col tw-gap-squid-xxs tw-pb-squid-xs", children: children }));
24672
24681
  };
24673
24682
 
24674
- function MainView() {
24675
- return (jsxs(ProductCard, { children: [jsx(NavigationBar, { title: "Swap", actions: [
24683
+ function MainView({ isLoading }) {
24684
+ return (jsxs(ProductCard, { children: [jsx(NavigationBar, { isLoading: isLoading, title: "Swap", actions: [
24676
24685
  {
24677
24686
  labelOrIcon: jsx(ClockOutlineIcon, {}),
24678
24687
  id: 'history',
@@ -24681,7 +24690,7 @@ function MainView() {
24681
24690
  labelOrIcon: jsx(SettingsGearIcon, {}),
24682
24691
  id: 'settings',
24683
24692
  },
24684
- ] }), jsx(SwapConfiguration, { direction: "from", chain: {
24693
+ ] }), jsx(SwapConfiguration, { isLoading: isLoading, direction: "from", chain: {
24685
24694
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/blast.svg',
24686
24695
  bgColor: '#fcfc03',
24687
24696
  }, token: {
@@ -24694,7 +24703,7 @@ function MainView() {
24694
24703
  isDisabled: true,
24695
24704
  disabledMessage: 'Not enough USDC to flip the swap',
24696
24705
  tooltipDisplayDelayMs: 0,
24697
- }, boostDisabledMessage: "Boost not supported for this route" }), jsx(SwapConfiguration, { isFetching: true, direction: "to", chain: {
24706
+ }, boostDisabledMessage: "Boost not supported for this route", isLoading: isLoading, isEmpty: isLoading }), jsx(SwapConfiguration, { isLoading: isLoading, direction: "to", chain: {
24698
24707
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
24699
24708
  bgColor: '#e84142',
24700
24709
  }, token: {
@@ -24703,7 +24712,7 @@ function MainView() {
24703
24712
  bgColor: '#2775ca',
24704
24713
  textColor: '#fff',
24705
24714
  decimals: 6,
24706
- }, priceImpactPercentage: '7.2', balance: '2854', address: "so-so.eth", amount: "100" }), jsx("div", { className: "tw-h-full tw-max-h-[80px] tw-px-squid-m tw-pb-squid-m", children: jsx(Button$1, { variant: "primary", size: "lg", label: "Swap" }) })] }));
24715
+ }, priceImpactPercentage: isLoading ? undefined : '7.2', balance: '2854', address: "so-so.eth", amount: isLoading ? undefined : '100' }), jsx("div", { className: "tw-h-full tw-max-h-[80px] tw-px-squid-m tw-pb-squid-m", children: jsx(Button$1, { variant: isLoading ? 'tertiary' : 'primary', size: "lg", label: "Swap", isLoading: isLoading }) })] }));
24707
24716
  }
24708
24717
 
24709
24718
  function PunkIcon({ size = '16' }) {
@@ -12,6 +12,7 @@ interface AssetsButtonProps {
12
12
  };
13
13
  onClick?: () => void;
14
14
  variant?: AssetsButtonVariant;
15
+ isLoading?: boolean;
15
16
  }
16
- export declare function AssetsButton({ chain, token, onClick, variant, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function AssetsButton({ chain, token, onClick, variant, isLoading, }: AssetsButtonProps): import("react/jsx-runtime").JSX.Element;
17
18
  export {};
@@ -7,6 +7,7 @@ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
7
7
  size: ButtonSize;
8
8
  disabled?: boolean;
9
9
  link?: string;
10
+ isLoading?: boolean;
10
11
  }
11
- export declare function Button({ label, disabled, size, variant, icon, link, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function Button({ label, disabled, size, variant, icon, link, isLoading, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
12
13
  export {};
@@ -12,6 +12,7 @@ interface NavigationBarProps {
12
12
  displayButtonShadows?: boolean;
13
13
  onBackButtonClick?: () => void;
14
14
  actions?: ActionButton[];
15
+ isLoading?: boolean;
15
16
  }
16
- export declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick, actions, }: NavigationBarProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick, actions, isLoading, }: NavigationBarProps): import("react/jsx-runtime").JSX.Element;
17
18
  export {};
@@ -33,5 +33,5 @@ interface SwapConfigurationProps {
33
33
  isInputInteractive?: boolean;
34
34
  isLoading?: boolean;
35
35
  }
36
- export declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
36
+ export declare function SwapConfiguration({ amount, tokenPrice, isFetching: isFetchingProp, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): import("react/jsx-runtime").JSX.Element;
37
37
  export {};
@@ -1 +1,3 @@
1
- export declare function MainView(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function MainView({ isLoading }: {
2
+ isLoading?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,8 @@ import { AssetsButton } from '../../components/buttons/AssetsButton';
3
3
  declare const meta: Meta<typeof AssetsButton>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
+ export declare const PrimaryVariantLoading: Story;
7
+ export declare const AccentVariantLoading: Story;
6
8
  export declare const PrimaryVariantEmpty: Story;
7
9
  export declare const AccentVariantEmpty: Story;
8
10
  export declare const ChainOnly: Story;
@@ -23,3 +23,8 @@ export declare const LargeTertiary: Story;
23
23
  export declare const LargeDisabled: Story;
24
24
  export declare const LargeAndLink: Story;
25
25
  export declare const LargeAndLinkDisabled: Story;
26
+ export declare const MediumWithIconLoading: Story;
27
+ export declare const MediumWithLabelLoading: Story;
28
+ export declare const MediumWithLongLabelLoading: Story;
29
+ export declare const LargeWithLabelLoading: Story;
30
+ export declare const LargeWithLongLabelLoading: Story;
@@ -6,6 +6,7 @@ type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const Loading: Story;
8
8
  export declare const Empty: Story;
9
+ export declare const EmptyLoading: Story;
9
10
  export declare const Error: Story;
10
11
  export declare const ErrorHelpButton: Story;
11
12
  export declare const BoostDisabled: Story;
@@ -9,4 +9,5 @@ export declare const BackButton: Story;
9
9
  export declare const Logo: Story;
10
10
  export declare const WithActions: Story;
11
11
  export declare const AllProps: Story;
12
+ export declare const Loading: Story;
12
13
  export declare const Transparent: Story;
@@ -5,6 +5,8 @@ export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const EmptyVariantPrimary: Story;
7
7
  export declare const EmptyVariantAccent: Story;
8
+ export declare const Loading: Story;
9
+ export declare const LoadingWithAllProps: Story;
8
10
  export declare const ChainOnly: Story;
9
11
  export declare const ChainAndToken: Story;
10
12
  export declare const WithSwapAmountUsd: Story;
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof MainView>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
+ export declare const Loading: Story;
package/dist/index.d.ts CHANGED
@@ -143,8 +143,9 @@ interface AssetsButtonProps {
143
143
  };
144
144
  onClick?: () => void;
145
145
  variant?: AssetsButtonVariant;
146
+ isLoading?: boolean;
146
147
  }
147
- declare function AssetsButton({ chain, token, onClick, variant, }: AssetsButtonProps): react_jsx_runtime.JSX.Element;
148
+ declare function AssetsButton({ chain, token, onClick, variant, isLoading, }: AssetsButtonProps): react_jsx_runtime.JSX.Element;
148
149
 
149
150
  interface BoostButtonProps {
150
151
  boostMode: BoostMode;
@@ -162,8 +163,9 @@ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
162
163
  size: ButtonSize;
163
164
  disabled?: boolean;
164
165
  link?: string;
166
+ isLoading?: boolean;
165
167
  }
166
- declare function Button({ label, disabled, size, variant, icon, link, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
168
+ declare function Button({ label, disabled, size, variant, icon, link, isLoading, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
167
169
 
168
170
  interface ChipProps extends React.HTMLAttributes<HTMLDivElement> {
169
171
  label?: string;
@@ -1371,8 +1373,9 @@ interface NavigationBarProps {
1371
1373
  displayButtonShadows?: boolean;
1372
1374
  onBackButtonClick?: () => void;
1373
1375
  actions?: ActionButton[];
1376
+ isLoading?: boolean;
1374
1377
  }
1375
- declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick, actions, }: NavigationBarProps): react_jsx_runtime.JSX.Element;
1378
+ declare function NavigationBar({ title, displayBackButton, logoUrl, transparent, displayButtonShadows, onBackButtonClick, actions, isLoading, }: NavigationBarProps): react_jsx_runtime.JSX.Element;
1376
1379
 
1377
1380
  declare function PipeSeparator({ className, ...props }: ComponentProps<'div'>): react_jsx_runtime.JSX.Element;
1378
1381
 
@@ -1418,7 +1421,7 @@ interface SwapConfigurationProps {
1418
1421
  isInputInteractive?: boolean;
1419
1422
  isLoading?: boolean;
1420
1423
  }
1421
- declare function SwapConfiguration({ amount, tokenPrice, isFetching, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
1424
+ declare function SwapConfiguration({ amount, tokenPrice, isFetching: isFetchingProp, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, assetsButtonVariant, maxUsdDecimals, isInputInteractive, isLoading, }: SwapConfigurationProps): react_jsx_runtime.JSX.Element;
1422
1425
 
1423
1426
  interface SwapProgressViewHeaderProps {
1424
1427
  title: string;
@@ -1747,7 +1750,9 @@ interface AssetsViewProps {
1747
1750
  declare function AssetsView({ chains, favoriteTokens, popularTokens, userTokens, }: AssetsViewProps): react_jsx_runtime.JSX.Element;
1748
1751
  declare const List: ({ children }: react__default.PropsWithChildren) => react_jsx_runtime.JSX.Element;
1749
1752
 
1750
- declare function MainView(): react_jsx_runtime.JSX.Element;
1753
+ declare function MainView({ isLoading }: {
1754
+ isLoading?: boolean;
1755
+ }): react_jsx_runtime.JSX.Element;
1751
1756
 
1752
1757
  type WalletViewType = 'paymentMethod' | 'recipientEmpty' | 'recipientTypingEns' | 'recipientTypingAddress';
1753
1758
  interface WalletsViewProps {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/0xsquid/squid-ui.git"
6
6
  },
7
7
  "description": "Squid's UI components",
8
- "version": "0.19.0",
8
+ "version": "0.19.1",
9
9
  "author": "",
10
10
  "license": "MIT",
11
11
  "resolutions": {