@0xsquid/ui 0.18.0 → 0.18.1-beta.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
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { forwardRef, createElement, useState, createContext, useContext, useMemo, useRef, useEffect, Children, Fragment as Fragment$1, isValidElement, useLayoutEffect, cloneElement, useCallback, useImperativeHandle, useId as useId$1 } from 'react';
3
+ import React__default, { forwardRef, createElement, useState, createContext, useContext, useMemo, useRef, useEffect, Children, Fragment as Fragment$1, isValidElement, useLayoutEffect, cloneElement, useCallback, useImperativeHandle, useId as useId$1 } from 'react';
4
4
 
5
5
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
6
6
 
@@ -6851,9 +6851,9 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
6851
6851
  return 'full';
6852
6852
  }, [errorMessage, isLoading, isEmpty]);
6853
6853
  const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
6854
- return (jsx("aside", { className: cn('mobile-lg:tw-w-card-large tw-flex tw-h-[50px] tw-w-full tw-items-center tw-justify-between tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error'
6855
- ? 'mobile-lg:tw-px-squid-l tw-px-squid-m'
6856
- : 'mobile-lg:tw-px-squid-m tw-px-squid-xs'), 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)
6854
+ return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-full tw-items-center tw-justify-between 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'
6855
+ ? 'tw-px-squid-m mobile-lg:tw-px-squid-l'
6856
+ : 'tw-px-squid-xs mobile-lg:tw-px-squid-m'), 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)
6857
6857
  ? flipButton.disabledMessage
6858
6858
  : 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) &&
6859
6859
  '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 }) })] })) }));
@@ -7415,8 +7415,8 @@ const borderRadiusClassMap = {
7415
7415
  lg: 'tw-rounded-squid-m',
7416
7416
  };
7417
7417
  function Menu(_a) {
7418
- var { children, containerClassName, contentClassName, rounded = 'lg', menuRef } = _a, props = __rest$1(_a, ["children", "containerClassName", "contentClassName", "rounded", "menuRef"]);
7419
- return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-xs tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch !tw-leading-[10px]", children: children })) : (jsx("div", { className: "tw-z-20 tw-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-text-caption", children: children })), jsx("div", { className: cn('tw-absolute tw-inset-0 tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
7418
+ var { children, containerClassName, contentClassName, rounded = 'lg', menuRef, contentWrapperClassName } = _a, props = __rest$1(_a, ["children", "containerClassName", "contentClassName", "rounded", "menuRef", "contentWrapperClassName"]);
7419
+ return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-xs tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch !tw-leading-[10px]", children: children })) : (jsx("div", { className: cn('tw-z-20 tw-max-w-full tw-text-caption', contentWrapperClassName), children: children })), jsx("div", { className: cn('tw-absolute tw-inset-0 tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
7420
7420
  }
7421
7421
 
7422
7422
  function DropdownMenu({ dropdownRef, items, className, menuRef, isHidden = false, listClassName, }) {
@@ -7483,8 +7483,571 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
7483
7483
  : action.labelOrIcon, onClick: action.onClick }))) })] }), title ? (jsx("div", { className: "mobile-lg:tw-px-squid-l tw-flex tw-h-squid-xxl tw-items-center tw-px-squid-m tw-py-squid-xxs", children: jsx(HeadingText, { size: "small", children: title }) })) : null] }));
7484
7484
  }
7485
7485
 
7486
+ const createStoreImpl = (createState) => {
7487
+ let state;
7488
+ const listeners = /* @__PURE__ */ new Set();
7489
+ const setState = (partial, replace) => {
7490
+ const nextState = typeof partial === "function" ? partial(state) : partial;
7491
+ if (!Object.is(nextState, state)) {
7492
+ const previousState = state;
7493
+ state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
7494
+ listeners.forEach((listener) => listener(state, previousState));
7495
+ }
7496
+ };
7497
+ const getState = () => state;
7498
+ const getInitialState = () => initialState;
7499
+ const subscribe = (listener) => {
7500
+ listeners.add(listener);
7501
+ return () => listeners.delete(listener);
7502
+ };
7503
+ const destroy = () => {
7504
+ if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production") {
7505
+ console.warn(
7506
+ "[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
7507
+ );
7508
+ }
7509
+ listeners.clear();
7510
+ };
7511
+ const api = { setState, getState, getInitialState, subscribe, destroy };
7512
+ const initialState = state = createState(setState, getState, api);
7513
+ return api;
7514
+ };
7515
+ const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
7516
+
7517
+ var withSelector = {exports: {}};
7518
+
7519
+ var withSelector_production_min = {};
7520
+
7521
+ var shim = {exports: {}};
7522
+
7523
+ var useSyncExternalStoreShim_production_min = {};
7524
+
7525
+ /**
7526
+ * @license React
7527
+ * use-sync-external-store-shim.production.min.js
7528
+ *
7529
+ * Copyright (c) Facebook, Inc. and its affiliates.
7530
+ *
7531
+ * This source code is licensed under the MIT license found in the
7532
+ * LICENSE file in the root directory of this source tree.
7533
+ */
7534
+
7535
+ var hasRequiredUseSyncExternalStoreShim_production_min;
7536
+
7537
+ function requireUseSyncExternalStoreShim_production_min () {
7538
+ if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
7539
+ hasRequiredUseSyncExternalStoreShim_production_min = 1;
7540
+ var e=React__default;function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c});},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c});})},[a]);p(d);return d}
7541
+ function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return !k(a,d)}catch(f){return !0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;useSyncExternalStoreShim_production_min.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;
7542
+ return useSyncExternalStoreShim_production_min;
7543
+ }
7544
+
7545
+ var useSyncExternalStoreShim_development = {};
7546
+
7547
+ /**
7548
+ * @license React
7549
+ * use-sync-external-store-shim.development.js
7550
+ *
7551
+ * Copyright (c) Facebook, Inc. and its affiliates.
7552
+ *
7553
+ * This source code is licensed under the MIT license found in the
7554
+ * LICENSE file in the root directory of this source tree.
7555
+ */
7556
+
7557
+ var hasRequiredUseSyncExternalStoreShim_development;
7558
+
7559
+ function requireUseSyncExternalStoreShim_development () {
7560
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
7561
+ hasRequiredUseSyncExternalStoreShim_development = 1;
7562
+
7563
+ if (process.env.NODE_ENV !== "production") {
7564
+ (function() {
7565
+
7566
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
7567
+ if (
7568
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
7569
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
7570
+ 'function'
7571
+ ) {
7572
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
7573
+ }
7574
+ var React = React__default;
7575
+
7576
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
7577
+
7578
+ function error(format) {
7579
+ {
7580
+ {
7581
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
7582
+ args[_key2 - 1] = arguments[_key2];
7583
+ }
7584
+
7585
+ printWarning('error', format, args);
7586
+ }
7587
+ }
7588
+ }
7589
+
7590
+ function printWarning(level, format, args) {
7591
+ // When changing this logic, you might want to also
7592
+ // update consoleWithStackDev.www.js as well.
7593
+ {
7594
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
7595
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
7596
+
7597
+ if (stack !== '') {
7598
+ format += '%s';
7599
+ args = args.concat([stack]);
7600
+ } // eslint-disable-next-line react-internal/safe-string-coercion
7601
+
7602
+
7603
+ var argsWithFormat = args.map(function (item) {
7604
+ return String(item);
7605
+ }); // Careful: RN currently depends on this prefix
7606
+
7607
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
7608
+ // breaks IE9: https://github.com/facebook/react/issues/13610
7609
+ // eslint-disable-next-line react-internal/no-production-logging
7610
+
7611
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
7612
+ }
7613
+ }
7614
+
7615
+ /**
7616
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
7617
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
7618
+ */
7619
+ function is(x, y) {
7620
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
7621
+ ;
7622
+ }
7623
+
7624
+ var objectIs = typeof Object.is === 'function' ? Object.is : is;
7625
+
7626
+ // dispatch for CommonJS interop named imports.
7627
+
7628
+ var useState = React.useState,
7629
+ useEffect = React.useEffect,
7630
+ useLayoutEffect = React.useLayoutEffect,
7631
+ useDebugValue = React.useDebugValue;
7632
+ var didWarnOld18Alpha = false;
7633
+ var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
7634
+ // because of a very particular set of implementation details and assumptions
7635
+ // -- change any one of them and it will break. The most important assumption
7636
+ // is that updates are always synchronous, because concurrent rendering is
7637
+ // only available in versions of React that also have a built-in
7638
+ // useSyncExternalStore API. And we only use this shim when the built-in API
7639
+ // does not exist.
7640
+ //
7641
+ // Do not assume that the clever hacks used by this hook also work in general.
7642
+ // The point of this shim is to replace the need for hacks by other libraries.
7643
+
7644
+ function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
7645
+ // React do not expose a way to check if we're hydrating. So users of the shim
7646
+ // will need to track that themselves and return the correct value
7647
+ // from `getSnapshot`.
7648
+ getServerSnapshot) {
7649
+ {
7650
+ if (!didWarnOld18Alpha) {
7651
+ if (React.startTransition !== undefined) {
7652
+ didWarnOld18Alpha = true;
7653
+
7654
+ error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
7655
+ }
7656
+ }
7657
+ } // Read the current snapshot from the store on every render. Again, this
7658
+ // breaks the rules of React, and only works here because of specific
7659
+ // implementation details, most importantly that updates are
7660
+ // always synchronous.
7661
+
7662
+
7663
+ var value = getSnapshot();
7664
+
7665
+ {
7666
+ if (!didWarnUncachedGetSnapshot) {
7667
+ var cachedValue = getSnapshot();
7668
+
7669
+ if (!objectIs(value, cachedValue)) {
7670
+ error('The result of getSnapshot should be cached to avoid an infinite loop');
7671
+
7672
+ didWarnUncachedGetSnapshot = true;
7673
+ }
7674
+ }
7675
+ } // Because updates are synchronous, we don't queue them. Instead we force a
7676
+ // re-render whenever the subscribed state changes by updating an some
7677
+ // arbitrary useState hook. Then, during render, we call getSnapshot to read
7678
+ // the current value.
7679
+ //
7680
+ // Because we don't actually use the state returned by the useState hook, we
7681
+ // can save a bit of memory by storing other stuff in that slot.
7682
+ //
7683
+ // To implement the early bailout, we need to track some things on a mutable
7684
+ // object. Usually, we would put that in a useRef hook, but we can stash it in
7685
+ // our useState hook instead.
7686
+ //
7687
+ // To force a re-render, we call forceUpdate({inst}). That works because the
7688
+ // new object always fails an equality check.
7689
+
7690
+
7691
+ var _useState = useState({
7692
+ inst: {
7693
+ value: value,
7694
+ getSnapshot: getSnapshot
7695
+ }
7696
+ }),
7697
+ inst = _useState[0].inst,
7698
+ forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
7699
+ // in the layout phase so we can access it during the tearing check that
7700
+ // happens on subscribe.
7701
+
7702
+
7703
+ useLayoutEffect(function () {
7704
+ inst.value = value;
7705
+ inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
7706
+ // commit phase if there was an interleaved mutation. In concurrent mode
7707
+ // this can happen all the time, but even in synchronous mode, an earlier
7708
+ // effect may have mutated the store.
7709
+
7710
+ if (checkIfSnapshotChanged(inst)) {
7711
+ // Force a re-render.
7712
+ forceUpdate({
7713
+ inst: inst
7714
+ });
7715
+ }
7716
+ }, [subscribe, value, getSnapshot]);
7717
+ useEffect(function () {
7718
+ // Check for changes right before subscribing. Subsequent changes will be
7719
+ // detected in the subscription handler.
7720
+ if (checkIfSnapshotChanged(inst)) {
7721
+ // Force a re-render.
7722
+ forceUpdate({
7723
+ inst: inst
7724
+ });
7725
+ }
7726
+
7727
+ var handleStoreChange = function () {
7728
+ // TODO: Because there is no cross-renderer API for batching updates, it's
7729
+ // up to the consumer of this library to wrap their subscription event
7730
+ // with unstable_batchedUpdates. Should we try to detect when this isn't
7731
+ // the case and print a warning in development?
7732
+ // The store changed. Check if the snapshot changed since the last time we
7733
+ // read from the store.
7734
+ if (checkIfSnapshotChanged(inst)) {
7735
+ // Force a re-render.
7736
+ forceUpdate({
7737
+ inst: inst
7738
+ });
7739
+ }
7740
+ }; // Subscribe to the store and return a clean-up function.
7741
+
7742
+
7743
+ return subscribe(handleStoreChange);
7744
+ }, [subscribe]);
7745
+ useDebugValue(value);
7746
+ return value;
7747
+ }
7748
+
7749
+ function checkIfSnapshotChanged(inst) {
7750
+ var latestGetSnapshot = inst.getSnapshot;
7751
+ var prevValue = inst.value;
7752
+
7753
+ try {
7754
+ var nextValue = latestGetSnapshot();
7755
+ return !objectIs(prevValue, nextValue);
7756
+ } catch (error) {
7757
+ return true;
7758
+ }
7759
+ }
7760
+
7761
+ function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
7762
+ // Note: The shim does not use getServerSnapshot, because pre-18 versions of
7763
+ // React do not expose a way to check if we're hydrating. So users of the shim
7764
+ // will need to track that themselves and return the correct value
7765
+ // from `getSnapshot`.
7766
+ return getSnapshot();
7767
+ }
7768
+
7769
+ var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
7770
+
7771
+ var isServerEnvironment = !canUseDOM;
7772
+
7773
+ var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
7774
+ var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
7775
+
7776
+ useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
7777
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
7778
+ if (
7779
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
7780
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
7781
+ 'function'
7782
+ ) {
7783
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
7784
+ }
7785
+
7786
+ })();
7787
+ }
7788
+ return useSyncExternalStoreShim_development;
7789
+ }
7790
+
7791
+ var hasRequiredShim;
7792
+
7793
+ function requireShim () {
7794
+ if (hasRequiredShim) return shim.exports;
7795
+ hasRequiredShim = 1;
7796
+
7797
+ if (process.env.NODE_ENV === 'production') {
7798
+ shim.exports = requireUseSyncExternalStoreShim_production_min();
7799
+ } else {
7800
+ shim.exports = requireUseSyncExternalStoreShim_development();
7801
+ }
7802
+ return shim.exports;
7803
+ }
7804
+
7805
+ /**
7806
+ * @license React
7807
+ * use-sync-external-store-shim/with-selector.production.min.js
7808
+ *
7809
+ * Copyright (c) Facebook, Inc. and its affiliates.
7810
+ *
7811
+ * This source code is licensed under the MIT license found in the
7812
+ * LICENSE file in the root directory of this source tree.
7813
+ */
7814
+
7815
+ var hasRequiredWithSelector_production_min;
7816
+
7817
+ function requireWithSelector_production_min () {
7818
+ if (hasRequiredWithSelector_production_min) return withSelector_production_min;
7819
+ hasRequiredWithSelector_production_min = 1;
7820
+ var h=React__default,n=requireShim();function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
7821
+ withSelector_production_min.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f;}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return [function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);
7822
+ u(function(){f.hasValue=!0;f.value=d;},[d]);w(d);return d};
7823
+ return withSelector_production_min;
7824
+ }
7825
+
7826
+ var withSelector_development = {};
7827
+
7828
+ /**
7829
+ * @license React
7830
+ * use-sync-external-store-shim/with-selector.development.js
7831
+ *
7832
+ * Copyright (c) Facebook, Inc. and its affiliates.
7833
+ *
7834
+ * This source code is licensed under the MIT license found in the
7835
+ * LICENSE file in the root directory of this source tree.
7836
+ */
7837
+
7838
+ var hasRequiredWithSelector_development;
7839
+
7840
+ function requireWithSelector_development () {
7841
+ if (hasRequiredWithSelector_development) return withSelector_development;
7842
+ hasRequiredWithSelector_development = 1;
7843
+
7844
+ if (process.env.NODE_ENV !== "production") {
7845
+ (function() {
7846
+
7847
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
7848
+ if (
7849
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
7850
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
7851
+ 'function'
7852
+ ) {
7853
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
7854
+ }
7855
+ var React = React__default;
7856
+ var shim = requireShim();
7857
+
7858
+ /**
7859
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
7860
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
7861
+ */
7862
+ function is(x, y) {
7863
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
7864
+ ;
7865
+ }
7866
+
7867
+ var objectIs = typeof Object.is === 'function' ? Object.is : is;
7868
+
7869
+ var useSyncExternalStore = shim.useSyncExternalStore;
7870
+
7871
+ // for CommonJS interop.
7872
+
7873
+ var useRef = React.useRef,
7874
+ useEffect = React.useEffect,
7875
+ useMemo = React.useMemo,
7876
+ useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
7877
+
7878
+ function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
7879
+ // Use this to track the rendered snapshot.
7880
+ var instRef = useRef(null);
7881
+ var inst;
7882
+
7883
+ if (instRef.current === null) {
7884
+ inst = {
7885
+ hasValue: false,
7886
+ value: null
7887
+ };
7888
+ instRef.current = inst;
7889
+ } else {
7890
+ inst = instRef.current;
7891
+ }
7892
+
7893
+ var _useMemo = useMemo(function () {
7894
+ // Track the memoized state using closure variables that are local to this
7895
+ // memoized instance of a getSnapshot function. Intentionally not using a
7896
+ // useRef hook, because that state would be shared across all concurrent
7897
+ // copies of the hook/component.
7898
+ var hasMemo = false;
7899
+ var memoizedSnapshot;
7900
+ var memoizedSelection;
7901
+
7902
+ var memoizedSelector = function (nextSnapshot) {
7903
+ if (!hasMemo) {
7904
+ // The first time the hook is called, there is no memoized result.
7905
+ hasMemo = true;
7906
+ memoizedSnapshot = nextSnapshot;
7907
+
7908
+ var _nextSelection = selector(nextSnapshot);
7909
+
7910
+ if (isEqual !== undefined) {
7911
+ // Even if the selector has changed, the currently rendered selection
7912
+ // may be equal to the new selection. We should attempt to reuse the
7913
+ // current value if possible, to preserve downstream memoizations.
7914
+ if (inst.hasValue) {
7915
+ var currentSelection = inst.value;
7916
+
7917
+ if (isEqual(currentSelection, _nextSelection)) {
7918
+ memoizedSelection = currentSelection;
7919
+ return currentSelection;
7920
+ }
7921
+ }
7922
+ }
7923
+
7924
+ memoizedSelection = _nextSelection;
7925
+ return _nextSelection;
7926
+ } // We may be able to reuse the previous invocation's result.
7927
+
7928
+
7929
+ // We may be able to reuse the previous invocation's result.
7930
+ var prevSnapshot = memoizedSnapshot;
7931
+ var prevSelection = memoizedSelection;
7932
+
7933
+ if (objectIs(prevSnapshot, nextSnapshot)) {
7934
+ // The snapshot is the same as last time. Reuse the previous selection.
7935
+ return prevSelection;
7936
+ } // The snapshot has changed, so we need to compute a new selection.
7937
+
7938
+
7939
+ // The snapshot has changed, so we need to compute a new selection.
7940
+ var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
7941
+ // has changed. If it hasn't, return the previous selection. That signals
7942
+ // to React that the selections are conceptually equal, and we can bail
7943
+ // out of rendering.
7944
+
7945
+ // If a custom isEqual function is provided, use that to check if the data
7946
+ // has changed. If it hasn't, return the previous selection. That signals
7947
+ // to React that the selections are conceptually equal, and we can bail
7948
+ // out of rendering.
7949
+ if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
7950
+ return prevSelection;
7951
+ }
7952
+
7953
+ memoizedSnapshot = nextSnapshot;
7954
+ memoizedSelection = nextSelection;
7955
+ return nextSelection;
7956
+ }; // Assigning this to a constant so that Flow knows it can't change.
7957
+
7958
+
7959
+ // Assigning this to a constant so that Flow knows it can't change.
7960
+ var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
7961
+
7962
+ var getSnapshotWithSelector = function () {
7963
+ return memoizedSelector(getSnapshot());
7964
+ };
7965
+
7966
+ var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
7967
+ return memoizedSelector(maybeGetServerSnapshot());
7968
+ };
7969
+ return [getSnapshotWithSelector, getServerSnapshotWithSelector];
7970
+ }, [getSnapshot, getServerSnapshot, selector, isEqual]),
7971
+ getSelection = _useMemo[0],
7972
+ getServerSelection = _useMemo[1];
7973
+
7974
+ var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
7975
+ useEffect(function () {
7976
+ inst.hasValue = true;
7977
+ inst.value = value;
7978
+ }, [value]);
7979
+ useDebugValue(value);
7980
+ return value;
7981
+ }
7982
+
7983
+ withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
7984
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
7985
+ if (
7986
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
7987
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
7988
+ 'function'
7989
+ ) {
7990
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
7991
+ }
7992
+
7993
+ })();
7994
+ }
7995
+ return withSelector_development;
7996
+ }
7997
+
7998
+ if (process.env.NODE_ENV === 'production') {
7999
+ withSelector.exports = requireWithSelector_production_min();
8000
+ } else {
8001
+ withSelector.exports = requireWithSelector_development();
8002
+ }
8003
+
8004
+ var withSelectorExports = withSelector.exports;
8005
+ var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelectorExports);
8006
+
8007
+ const { useDebugValue } = React__default;
8008
+ const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
8009
+ let didWarnAboutEqualityFn = false;
8010
+ const identity = (arg) => arg;
8011
+ function useStore(api, selector = identity, equalityFn) {
8012
+ if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && equalityFn && !didWarnAboutEqualityFn) {
8013
+ console.warn(
8014
+ "[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"
8015
+ );
8016
+ didWarnAboutEqualityFn = true;
8017
+ }
8018
+ const slice = useSyncExternalStoreWithSelector(
8019
+ api.subscribe,
8020
+ api.getState,
8021
+ api.getServerState || api.getInitialState,
8022
+ selector,
8023
+ equalityFn
8024
+ );
8025
+ useDebugValue(slice);
8026
+ return slice;
8027
+ }
8028
+ const createImpl = (createState) => {
8029
+ if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production" && typeof createState !== "function") {
8030
+ console.warn(
8031
+ "[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`."
8032
+ );
8033
+ }
8034
+ const api = typeof createState === "function" ? createStore(createState) : createState;
8035
+ const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
8036
+ Object.assign(useBoundStore, api);
8037
+ return useBoundStore;
8038
+ };
8039
+ const create = (createState) => createState ? createImpl(createState) : createImpl;
8040
+
8041
+ const useContainerStore = create(() => ({
8042
+ containerRef: undefined,
8043
+ }));
8044
+
7486
8045
  function ProductCard({ children }) {
7487
- return (jsx("div", { className: "tw-flex tw-h-full tw-max-w-[100vw] tw-flex-col tw-justify-center tw-overflow-hidden tw-bg-grey-900 tw-text-grey-300 tw-outline tw-outline-1 tw-outline-material-light-thin group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-3 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-3 mobile-lg:tw-max-w-card-large mobile-lg:tw-rounded-squid-l", children: jsx("div", { className: "tw-relative tw-h-card-compact tw-min-h-card-compact tw-w-full mobile-lg:tw-h-card-large mobile-lg:tw-min-h-card-large mobile-lg:tw-w-card-large", children: children }) }));
8046
+ const containerRef = useRef(null);
8047
+ useEffect(() => {
8048
+ useContainerStore.setState({ containerRef });
8049
+ }, [containerRef]);
8050
+ return (jsx("div", { className: "tw-flex tw-h-full tw-max-w-[100vw] tw-flex-col tw-justify-center tw-overflow-hidden tw-bg-grey-900 tw-text-grey-300 tw-outline tw-outline-1 tw-outline-material-light-thin group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-3 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-3 mobile-lg:tw-max-w-card-large mobile-lg:tw-rounded-squid-l", children: jsx("div", { ref: containerRef, className: "tw-relative tw-h-card-compact tw-min-h-card-compact tw-w-full mobile-lg:tw-h-card-large mobile-lg:tw-min-h-card-large mobile-lg:tw-w-card-large", children: children }) }));
7488
8051
  }
7489
8052
  function BorderedContainer({ children, className, }) {
7490
8053
  return (jsx("section", { className: cn('tw-border-t tw-border-t-material-light-thin', className), children: children }));
@@ -13596,7 +14159,7 @@ function TransactionSearch({ query, setQuery, children, className, }) {
13596
14159
  }
13597
14160
 
13598
14161
  function Toast({ headerContent, actionsContent, description, chipLabel, title, }) {
13599
- return (jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs", rounded: "sm", children: [headerContent, jsx("header", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-px-0 tw-py-squid-xxs", children: jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsx("menu", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: actionsContent }), chipLabel && (jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
14162
+ return (jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs", contentWrapperClassName: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs", rounded: "sm", children: [headerContent, jsx("header", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-px-0 tw-py-squid-xxs", children: jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsx("menu", { className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: actionsContent }), chipLabel && (jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
13600
14163
  }
13601
14164
 
13602
14165
  const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
@@ -13847,28 +14410,140 @@ const tooltipWidthClassMap = {
13847
14410
  container: 'tw-w-full',
13848
14411
  };
13849
14412
  const tooltipThresholdClassMap = {
13850
- xxs: 'tw-pb-squid-xxs',
13851
- xs: 'tw-pb-squid-xs',
13852
- s: 'tw-pb-squid-s',
13853
- m: 'tw-pb-squid-m',
13854
- l: 'tw-pb-squid-l',
13855
- xl: 'tw-pb-squid-xl',
13856
- xxl: 'tw-pb-squid-xxl',
14413
+ xxs: 'tw-py-squid-xxs',
14414
+ xs: 'tw-py-squid-xs',
14415
+ s: 'tw-py-squid-s',
14416
+ m: 'tw-py-squid-m',
14417
+ l: 'tw-py-squid-l',
14418
+ xl: 'tw-py-squid-xl',
14419
+ xxl: 'tw-py-squid-xxl',
13857
14420
  };
13858
- function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, }) {
13859
- return (jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (jsx(Menu, { style: {
13860
- [CSS_VARS.DISPLAY_DELAYED_DURATION]: `${displayDelayMs}ms`,
13861
- }, containerClassName: cn(
13862
- // general styles
13863
- 'tw-absolute tw-z-40 tw-bottom-full tw-left-1/2 -tw-translate-x-1/2',
13864
- // visibility styles. Display only on hover
13865
- 'tw-animate-hide peer-hover:tw-animate-display-delayed hover:tw-animate-display-delayed', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
14421
+ function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, containerRef: _containerRef, }) {
14422
+ const containerRefState = useContainerStore((state) => state.containerRef);
14423
+ const containerRef = (containerRefState === null || containerRefState === void 0 ? void 0 : containerRefState.current)
14424
+ ? containerRefState
14425
+ : _containerRef;
14426
+ const [tooltipPositionStyle, setTooltipPositionStyle] = useState({});
14427
+ const [isTooltipVisible, setIsTooltipVisible] = useState(false);
14428
+ const tooltipRef = useRef(null);
14429
+ const tooltipTriggerRef = useRef(null);
14430
+ useEffect(() => {
14431
+ const adjustTooltipPosition = () => {
14432
+ if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
14433
+ !tooltipRef.current ||
14434
+ !tooltipTriggerRef.current) {
14435
+ // try to center it
14436
+ return setTooltipPositionStyle({
14437
+ top: '-100%',
14438
+ left: '50%',
14439
+ transform: 'translateX(-50%)',
14440
+ });
14441
+ }
14442
+ const containerRect = containerRef.current.getBoundingClientRect();
14443
+ const tooltipRect = tooltipRef.current.getBoundingClientRect();
14444
+ const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
14445
+ const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
14446
+ const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
14447
+ const fitsInLeft = tooltipTriggerRect.left - containerRect.left >= tooltipRect.width;
14448
+ const fitsInRight = tooltipTriggerRect.left + tooltipRect.width - containerRect.left <
14449
+ containerRect.width / 2 - tooltipRect.width / 2;
14450
+ const fitsInMiddle = tooltipTriggerRect.left +
14451
+ tooltipTriggerRect.width / 2 -
14452
+ containerRect.left >=
14453
+ tooltipRect.width / 2 &&
14454
+ containerRect.right -
14455
+ (tooltipTriggerRect.right - tooltipTriggerRect.width / 2) >=
14456
+ tooltipRect.width / 2;
14457
+ if (tooltipFitsAbove || !tooltipFitsBelow) {
14458
+ const top = -tooltipRect.height;
14459
+ if (fitsInMiddle || (!fitsInLeft && !fitsInRight)) {
14460
+ const left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
14461
+ const leftOverflowsContainer = tooltipTriggerRect.left - tooltipRect.width / 2 < containerRect.left;
14462
+ // if doesn't fit in either side, set to top center
14463
+ setTooltipPositionStyle({
14464
+ top: top,
14465
+ // if the defined left position is too far to the left, set to the left of the container
14466
+ left: leftOverflowsContainer
14467
+ ? containerRect.left - tooltipTriggerRect.left
14468
+ : left,
14469
+ });
14470
+ }
14471
+ else if (fitsInLeft) {
14472
+ setTooltipPositionStyle({
14473
+ top: top,
14474
+ right: -(containerRect.right - tooltipTriggerRect.right),
14475
+ });
14476
+ }
14477
+ else if (fitsInRight) {
14478
+ setTooltipPositionStyle({
14479
+ top: top,
14480
+ });
14481
+ }
14482
+ }
14483
+ else if (tooltipFitsBelow) {
14484
+ const top = tooltipTriggerRect.height;
14485
+ if (fitsInLeft) {
14486
+ setTooltipPositionStyle({
14487
+ top: top,
14488
+ right: -(containerRect.right - tooltipTriggerRect.right),
14489
+ });
14490
+ }
14491
+ else if (fitsInRight) {
14492
+ setTooltipPositionStyle({
14493
+ top: top,
14494
+ });
14495
+ }
14496
+ else {
14497
+ const left = -(tooltipRect.width / 2);
14498
+ const leftOverflowsContainer = tooltipTriggerRect.left - tooltipRect.width / 2 < containerRect.left;
14499
+ // if doesn't fit in either side, set to top center
14500
+ setTooltipPositionStyle({
14501
+ top: top,
14502
+ // if the defined left position is too far to the left, set to the left of the container
14503
+ left: leftOverflowsContainer
14504
+ ? containerRect.left - tooltipTriggerRect.left
14505
+ : left,
14506
+ });
14507
+ }
14508
+ }
14509
+ };
14510
+ adjustTooltipPosition();
14511
+ const timeoutId = setTimeout(() => {
14512
+ adjustTooltipPosition();
14513
+ }, 300);
14514
+ window.addEventListener('resize', adjustTooltipPosition);
14515
+ return () => {
14516
+ clearTimeout(timeoutId);
14517
+ window.removeEventListener('resize', adjustTooltipPosition);
14518
+ };
14519
+ }, [
14520
+ containerRef,
14521
+ tooltipContent,
14522
+ threshold,
14523
+ tooltipWidth,
14524
+ displayDelayMs,
14525
+ isTooltipVisible,
14526
+ ]);
14527
+ return (jsxs("div", { className: cn('tw-relative', containerClassName), onMouseMove: (e) => {
14528
+ var _a;
14529
+ if (e.target === tooltipRef.current ||
14530
+ ((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
14531
+ return;
14532
+ }
14533
+ setIsTooltipVisible(true);
14534
+ }, onMouseLeave: () => {
14535
+ setIsTooltipVisible(false);
14536
+ }, children: [jsx("div", { ref: tooltipTriggerRef, className: childrenClassName, children: children }), tooltipContent ? (jsx(Menu, { style: Object.assign({ [CSS_VARS.DISPLAY_DELAYED_DURATION]: `${displayDelayMs}ms` }, tooltipPositionStyle), menuRef: tooltipRef, containerClassName: cn('tw-absolute tw-z-40',
14537
+ // 'tw-animate-hide peer-hover:tw-animate-display-delayed hover:tw-animate-display-delayed',
14538
+ // we can't hide the tooltip when it's not visible (i.e using display: none)
14539
+ // because we need to gets its rect to calculate the position
14540
+ isTooltipVisible ? 'tw-opacity-100' : 'tw-opacity-0', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
13866
14541
  }
13867
14542
 
13868
14543
  function BoostButton({ boostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, boostIndicatorRef, }) {
13869
14544
  return (jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, containerClassName: "tw-pr-squid-xxs mobile-lg:tw-w-[140px] tw-w-[106.5px]", tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-w-full tw-flex-col tw-justify-between tw-overflow-hidden tw-rounded-squid-m tw-pb-squid-xxs tw-text-grey-300 focus:tw-outline-none", children: [jsx("span", { className: cn('tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
13870
14545
  'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsx("span", { className: cn('tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
13871
- 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "mobile-lg:-tw-left-[3px] tw-group tw-peer tw-relative -tw-left-[20px] tw-flex tw-h-full tw-w-[140px] tw-items-center tw-justify-between tw-transition-transform group-disabled/boost-toggle:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
14546
+ 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-relative -tw-left-[20px] tw-flex tw-h-full tw-w-[140px] tw-items-center tw-justify-between tw-transition-transform group-disabled/boost-toggle:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce mobile-lg:-tw-left-[3px]", children: [jsx("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
13872
14547
  boxShadow: generateMarkerLines(40),
13873
14548
  } })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-2px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors group-disabled/boost-toggle:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
13874
14549
  transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
@@ -13947,7 +14622,11 @@ function MainView() {
13947
14622
  bgColor: '#627eea',
13948
14623
  textColor: '#fff',
13949
14624
  decimals: 18,
13950
- }, priceImpactPercentage: '0.3', balance: '4.57', address: "so-so.eth" }), jsx(DetailsToolbar, { canToggleBoostMode: true }), jsx(SwapConfiguration, { isFetching: true, direction: "to", chain: {
14625
+ }, priceImpactPercentage: '0.3', balance: '4.57', address: "so-so.eth" }), jsx(DetailsToolbar, { canToggleBoostMode: false, flipButton: {
14626
+ isDisabled: true,
14627
+ disabledMessage: 'Not enough USDC to flip the swap',
14628
+ tooltipDisplayDelayMs: 0,
14629
+ } }), jsx(SwapConfiguration, { isFetching: true, direction: "to", chain: {
13951
14630
  iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
13952
14631
  bgColor: '#e84142',
13953
14632
  }, token: {
@@ -13993,25 +14672,27 @@ function LightningIcon({ size = '24', className = '', }) {
13993
14672
  return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsx("path", { d: "M4.11178 12.2764L8.61178 3.27639C8.69648 3.107 8.86961 3 9.05899 3H17.1169C17.5055 3 17.7456 3.42399 17.5456 3.75725L15.4543 7.24275C15.2544 7.57602 15.4944 8 15.8831 8H20.6868C21.1463 8 21.3625 8.56776 21.0193 8.87338L7.37702 21.0236C6.99619 21.3628 6.41153 20.981 6.56886 20.4959L8.78779 13.6543C8.89255 13.3312 8.65175 13 8.31218 13H4.55899C4.1873 13 3.94556 12.6088 4.11178 12.2764Z", stroke: "currentColor", strokeWidth: "2.25", strokeLinecap: "round", strokeLinejoin: "round" }) }));
13994
14673
  }
13995
14674
 
13996
- function SwapDetailsView({ isLoading }) {
14675
+ function SwapDetailsView({ isLoading, canToggleBoostMode = true, }) {
13997
14676
  const [isModalOpen, setIsModalOpen] = useState(true);
13998
14677
  return (jsx(Fragment, { children: jsxs(Modal, { isOpen: isModalOpen, onBackdropClick: () => {
13999
14678
  setIsModalOpen(false);
14000
- }, children: [jsxs(ModalContent, { children: [jsx(Settings, {}), jsxs("ul", { className: "tw-flex tw-flex-col tw-items-start tw-gap-squid-xxs tw-self-stretch tw-py-squid-xs", children: [jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ClockOutlineIcon, {}), label: "Estimated time to complete", detail: "~20s" }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ArrowBottomTopIcon, {}), label: "Exchange rate", detail: "1 ETH = 4,031.05 USDC" }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ArrowWallDownIcon, {}), label: "Receive minimum", detail: "750.5 USDC" }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(GasIcon, {}), label: "Cross-chain gas fees", detail: jsxs(Fragment, { children: [jsx(CaptionText, { children: "0.02534 ETH" }), jsx(CaptionText, { className: "tw-text-grey-500", children: "$9.92" })] }) }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ReorderIcon, {}), label: "Expected gas refund", detail: jsxs(Fragment, { children: [jsx(CaptionText, { children: "-0.06336 ETH" }), jsx(CaptionText, { className: "tw-text-grey-500", children: "-$2.48" })] }) }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ReceiptBillIcon, {}), label: "Total fee", detail: jsxs(Fragment, { children: [jsx(CaptionText, { children: "0.0177 ETH" }), jsx(CaptionText, { className: "tw-text-grey-500", children: "$7.43" })] }) })] }), jsx(InfoBox, { icon: jsx(SnapIcon, {}), title: "Squid\u2019s price commitment", description: "In case of market price fluctuating significantly, your transaction may revert and you will receive axlUSDC on the destination chain instead." })] }), jsx(Button$1, { size: "lg", variant: "secondary", label: "Close", onClick: () => {
14679
+ }, children: [jsxs(ModalContent, { children: [jsx(Settings, { canToggleBoostMode: canToggleBoostMode }), jsxs("ul", { className: "tw-flex tw-flex-col tw-items-start tw-gap-squid-xxs tw-self-stretch tw-py-squid-xs", children: [jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ClockOutlineIcon, {}), label: "Estimated time to complete", detail: "~20s" }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ArrowBottomTopIcon, {}), label: "Exchange rate", detail: "1 ETH = 4,031.05 USDC" }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ArrowWallDownIcon, {}), label: "Receive minimum", detail: "750.5 USDC" }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(GasIcon, {}), label: "Cross-chain gas fees", detail: jsxs(Fragment, { children: [jsx(CaptionText, { children: "0.02534 ETH" }), jsx(CaptionText, { className: "tw-text-grey-500", children: "$9.92" })] }) }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ReorderIcon, {}), label: "Expected gas refund", detail: jsxs(Fragment, { children: [jsx(CaptionText, { children: "-0.06336 ETH" }), jsx(CaptionText, { className: "tw-text-grey-500", children: "-$2.48" })] }) }), jsx(PropertyListItem, { isLoading: isLoading, icon: jsx(ReceiptBillIcon, {}), label: "Total fee", detail: jsxs(Fragment, { children: [jsx(CaptionText, { children: "0.0177 ETH" }), jsx(CaptionText, { className: "tw-text-grey-500", children: "$7.43" })] }) })] }), jsx(InfoBox, { icon: jsx(SnapIcon, {}), title: "Squid\u2019s price commitment", description: "In case of market price fluctuating significantly, your transaction may revert and you will receive axlUSDC on the destination chain instead." })] }), jsx(Button$1, { size: "lg", variant: "secondary", label: "Close", onClick: () => {
14001
14680
  setIsModalOpen(false);
14002
14681
  } })] }) }));
14003
14682
  }
14004
- function Settings() {
14683
+ function Settings({ canToggleBoostMode }) {
14005
14684
  return (jsx("div", { className: "tw-flex tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs tw-self-stretch tw-py-squid-xxs", children: jsx(SettingsItem, { icon: jsx(LightningIcon, { className: "tw-text-grey-500" }), label: "Boost", control: {
14006
14685
  type: 'switch',
14007
14686
  checked: false,
14687
+ disabled: !canToggleBoostMode,
14008
14688
  onChange: console.log,
14009
- tooltip: {
14010
- tooltipWidth: 'max',
14011
- containerClassName: 'tw-h-[30px]',
14012
- tooltipClassName: 'tw-left-[-14px]',
14013
- tooltipContent: 'Boost not supported for this route',
14014
- },
14689
+ tooltip: canToggleBoostMode
14690
+ ? undefined
14691
+ : {
14692
+ tooltipWidth: 'max',
14693
+ containerClassName: 'tw-h-[30px]',
14694
+ tooltipContent: 'Boost not supported for this route',
14695
+ },
14015
14696
  }, transparent: true, helpTooltip: {
14016
14697
  tooltipWidth: 'max',
14017
14698
  tooltipClassName: 'tw-left-[15px]',
@@ -49372,4 +50053,4 @@ function SquidConfigProvider({ theme = lightTheme, children, themeType = 'light'
49372
50053
  return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-h-screen tw-font-geist mobile-lg:tw-h-auto", children: children }));
49373
50054
  }
49374
50055
 
49375
- export { ActionLayout, ActionLineOutRow, ActionProperties, ActionRow, ActionStatusRow, ActionWrapper, AddressButton, AnimationWrapper, ApproveAction, ArrowButton, AssetsButton, AssetsView, BadgeImage, BodyText, Boost, BoostButton, BorderedContainer, Breadcrumb, BridgeAction, BridgeHeader, BridgeProperties, BridgeTransactionView, Button$1 as Button, BuyNFTHeader, BuyNFTProperties, BuyNFTTransactionView, CaptionText, Chip, Collapse, DescriptionBlocks, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, ExploreLayout, ExploreNav, FeeButton, FeesAction, FeesLines, FeesTotal, FilterButton, HashLink, HeadingText, HistoryItem, IconLabel, ImageIcon, IncompleteAction, InfoBox, Inline, Input, InteractionHeader, InteractionProperties, InteractionTransactionView, Join, List, ListItem, LoadingProvider, LoadingSkeleton, MainView, Menu, MenuItem, Modal, ModalContent, ModalContentDivider, NavigationBar, NumericInput, ProductCard, ProfileHeader, ProfileHeaderBackground, PropertiesLayout, PropertyListItem, ReceiveNFTAction, ReceiveTokensAction, RecipientView, STEP_ITEM_HEIGHT, SectionTitle, SendTokensAction, SettingsButton, SettingsItem, SettingsSlider, SizeTransition, SquidConfigProvider, StakeAction, StartAction, SuccessAction, SwapAction, SwapConfiguration, SwapDetailsView, SwapHeader, SwapProgressView, SwapProgressViewHeader, SwapProperties, SwapStepItem, SwapStepsCollapsed, SwapTransactionView, Switch, Timestamp, Toast, TokenPair, Tooltip, TransactionAction, TransactionFilters, TransactionHeader, TransactionHeaderLayout, TransactionItem, TransactionProperties, TransactionSearch, TransactionState, TransactionView, TransactionViewLayout, Transfer, UsdAmount, WalletLink, WalletsView, WrapAction, linkActionTimelineProps, statusBgClassMap$1 as statusBgClassMap, statusColorClassMap, statusTextClassMap, useDropdownMenu, useMediaQuery };
50056
+ export { ActionLayout, ActionLineOutRow, ActionProperties, ActionRow, ActionStatusRow, ActionWrapper, AddressButton, AnimationWrapper, ApproveAction, ArrowButton, AssetsButton, AssetsView, BadgeImage, BodyText, Boost, BoostButton, BorderedContainer, Breadcrumb, BridgeAction, BridgeHeader, BridgeProperties, BridgeTransactionView, Button$1 as Button, BuyNFTHeader, BuyNFTProperties, BuyNFTTransactionView, CaptionText, Chip, Collapse, DescriptionBlocks, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, ExploreLayout, ExploreNav, FeeButton, FeesAction, FeesLines, FeesTotal, FilterButton, HashLink, HeadingText, HistoryItem, IconLabel, ImageIcon, IncompleteAction, InfoBox, Inline, Input, InteractionHeader, InteractionProperties, InteractionTransactionView, Join, List, ListItem, LoadingProvider, LoadingSkeleton, MEDIA_QUERIES, MainView, Menu, MenuItem, Modal, ModalContent, ModalContentDivider, NavigationBar, NumericInput, ProductCard, ProfileHeader, ProfileHeaderBackground, PropertiesLayout, PropertyListItem, ReceiveNFTAction, ReceiveTokensAction, RecipientView, STEP_ITEM_HEIGHT, SectionTitle, SendTokensAction, SettingsButton, SettingsItem, SettingsSlider, SizeTransition, SquidConfigProvider, StakeAction, StartAction, SuccessAction, SwapAction, SwapConfiguration, SwapDetailsView, SwapHeader, SwapProgressView, SwapProgressViewHeader, SwapProperties, SwapStepItem, SwapStepsCollapsed, SwapTransactionView, Switch, Timestamp, Toast, TokenPair, Tooltip, TransactionAction, TransactionFilters, TransactionHeader, TransactionHeaderLayout, TransactionItem, TransactionProperties, TransactionSearch, TransactionState, TransactionView, TransactionViewLayout, Transfer, UsdAmount, WalletLink, WalletsView, WrapAction, linkActionTimelineProps, statusBgClassMap$1 as statusBgClassMap, statusColorClassMap, statusTextClassMap, useDropdownMenu, useMediaQuery };