@0xsquid/ui 0.18.0 → 0.18.1-beta.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.
- package/dist/cjs/index.js +717 -33
- package/dist/cjs/types/components/controls/Tooltip.d.ts +2 -1
- package/dist/cjs/types/components/layout/Menu.d.ts +2 -1
- package/dist/cjs/types/components/views/SwapDetailsView.d.ts +2 -1
- package/dist/cjs/types/core/index.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/stores/container.d.ts +6 -0
- package/dist/cjs/types/stories/views/SwapDetailsView.stories.d.ts +1 -0
- package/dist/esm/index.js +718 -35
- package/dist/esm/types/components/controls/Tooltip.d.ts +2 -1
- package/dist/esm/types/components/layout/Menu.d.ts +2 -1
- package/dist/esm/types/components/views/SwapDetailsView.d.ts +2 -1
- package/dist/esm/types/core/index.d.ts +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/stores/container.d.ts +6 -0
- package/dist/esm/types/stories/views/SwapDetailsView.stories.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +14 -4
- package/package.json +3 -2
package/dist/cjs/index.js
CHANGED
|
@@ -6871,9 +6871,9 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
6871
6871
|
return 'full';
|
|
6872
6872
|
}, [errorMessage, isLoading, isEmpty]);
|
|
6873
6873
|
const detailClassName = cn('tw-w-[157px] mobile-lg:tw-w-[190px]', detailStateClassMap[state]);
|
|
6874
|
-
return (jsxRuntime.jsx("aside", { className: cn('
|
|
6875
|
-
? '
|
|
6876
|
-
: '
|
|
6874
|
+
return (jsxRuntime.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'
|
|
6875
|
+
? 'tw-px-squid-m mobile-lg:tw-px-squid-l'
|
|
6876
|
+
: 'tw-px-squid-xs mobile-lg:tw-px-squid-m'), 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)
|
|
6877
6877
|
? flipButton.disabledMessage
|
|
6878
6878
|
: 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) &&
|
|
6879
6879
|
'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 }) })] })) }));
|
|
@@ -7435,8 +7435,8 @@ const borderRadiusClassMap = {
|
|
|
7435
7435
|
lg: 'tw-rounded-squid-m',
|
|
7436
7436
|
};
|
|
7437
7437
|
function Menu(_a) {
|
|
7438
|
-
var { children, containerClassName, contentClassName, rounded = 'lg', menuRef } = _a, props = __rest$1(_a, ["children", "containerClassName", "contentClassName", "rounded", "menuRef"]);
|
|
7439
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxRuntime.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' ? (jsxRuntime.jsx(CaptionText, { className: "tw-z-20 tw-self-stretch !tw-leading-[10px]", children: children })) : (jsxRuntime.jsx("div", { className:
|
|
7438
|
+
var { children, containerClassName, contentClassName, rounded = 'lg', menuRef, contentWrapperClassName } = _a, props = __rest$1(_a, ["children", "containerClassName", "contentClassName", "rounded", "menuRef", "contentWrapperClassName"]);
|
|
7439
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxRuntime.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' ? (jsxRuntime.jsx(CaptionText, { className: "tw-z-20 tw-self-stretch !tw-leading-[10px]", children: children })) : (jsxRuntime.jsx("div", { className: cn('tw-z-20 tw-max-w-full tw-text-caption', contentWrapperClassName), children: children })), jsxRuntime.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]) })] }) })));
|
|
7440
7440
|
}
|
|
7441
7441
|
|
|
7442
7442
|
function DropdownMenu({ dropdownRef, items, className, menuRef, isHidden = false, listClassName, }) {
|
|
@@ -7503,8 +7503,571 @@ function NavigationBar({ title, displayBackButton = false, logoUrl, transparent
|
|
|
7503
7503
|
: action.labelOrIcon, onClick: action.onClick }))) })] }), title ? (jsxRuntime.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: jsxRuntime.jsx(HeadingText, { size: "small", children: title }) })) : null] }));
|
|
7504
7504
|
}
|
|
7505
7505
|
|
|
7506
|
+
const createStoreImpl = (createState) => {
|
|
7507
|
+
let state;
|
|
7508
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
7509
|
+
const setState = (partial, replace) => {
|
|
7510
|
+
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
7511
|
+
if (!Object.is(nextState, state)) {
|
|
7512
|
+
const previousState = state;
|
|
7513
|
+
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
7514
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
7515
|
+
}
|
|
7516
|
+
};
|
|
7517
|
+
const getState = () => state;
|
|
7518
|
+
const getInitialState = () => initialState;
|
|
7519
|
+
const subscribe = (listener) => {
|
|
7520
|
+
listeners.add(listener);
|
|
7521
|
+
return () => listeners.delete(listener);
|
|
7522
|
+
};
|
|
7523
|
+
const destroy = () => {
|
|
7524
|
+
if ((undefined ? undefined.MODE : void 0) !== "production") {
|
|
7525
|
+
console.warn(
|
|
7526
|
+
"[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."
|
|
7527
|
+
);
|
|
7528
|
+
}
|
|
7529
|
+
listeners.clear();
|
|
7530
|
+
};
|
|
7531
|
+
const api = { setState, getState, getInitialState, subscribe, destroy };
|
|
7532
|
+
const initialState = state = createState(setState, getState, api);
|
|
7533
|
+
return api;
|
|
7534
|
+
};
|
|
7535
|
+
const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
7536
|
+
|
|
7537
|
+
var withSelector = {exports: {}};
|
|
7538
|
+
|
|
7539
|
+
var withSelector_production_min = {};
|
|
7540
|
+
|
|
7541
|
+
var shim = {exports: {}};
|
|
7542
|
+
|
|
7543
|
+
var useSyncExternalStoreShim_production_min = {};
|
|
7544
|
+
|
|
7545
|
+
/**
|
|
7546
|
+
* @license React
|
|
7547
|
+
* use-sync-external-store-shim.production.min.js
|
|
7548
|
+
*
|
|
7549
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7550
|
+
*
|
|
7551
|
+
* This source code is licensed under the MIT license found in the
|
|
7552
|
+
* LICENSE file in the root directory of this source tree.
|
|
7553
|
+
*/
|
|
7554
|
+
|
|
7555
|
+
var hasRequiredUseSyncExternalStoreShim_production_min;
|
|
7556
|
+
|
|
7557
|
+
function requireUseSyncExternalStoreShim_production_min () {
|
|
7558
|
+
if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
|
|
7559
|
+
hasRequiredUseSyncExternalStoreShim_production_min = 1;
|
|
7560
|
+
var e=React;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}
|
|
7561
|
+
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;
|
|
7562
|
+
return useSyncExternalStoreShim_production_min;
|
|
7563
|
+
}
|
|
7564
|
+
|
|
7565
|
+
var useSyncExternalStoreShim_development = {};
|
|
7566
|
+
|
|
7567
|
+
/**
|
|
7568
|
+
* @license React
|
|
7569
|
+
* use-sync-external-store-shim.development.js
|
|
7570
|
+
*
|
|
7571
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7572
|
+
*
|
|
7573
|
+
* This source code is licensed under the MIT license found in the
|
|
7574
|
+
* LICENSE file in the root directory of this source tree.
|
|
7575
|
+
*/
|
|
7576
|
+
|
|
7577
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
7578
|
+
|
|
7579
|
+
function requireUseSyncExternalStoreShim_development () {
|
|
7580
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
7581
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
7582
|
+
|
|
7583
|
+
if (process.env.NODE_ENV !== "production") {
|
|
7584
|
+
(function() {
|
|
7585
|
+
|
|
7586
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
7587
|
+
if (
|
|
7588
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
7589
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
7590
|
+
'function'
|
|
7591
|
+
) {
|
|
7592
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
7593
|
+
}
|
|
7594
|
+
var React$1 = React;
|
|
7595
|
+
|
|
7596
|
+
var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
7597
|
+
|
|
7598
|
+
function error(format) {
|
|
7599
|
+
{
|
|
7600
|
+
{
|
|
7601
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
7602
|
+
args[_key2 - 1] = arguments[_key2];
|
|
7603
|
+
}
|
|
7604
|
+
|
|
7605
|
+
printWarning('error', format, args);
|
|
7606
|
+
}
|
|
7607
|
+
}
|
|
7608
|
+
}
|
|
7609
|
+
|
|
7610
|
+
function printWarning(level, format, args) {
|
|
7611
|
+
// When changing this logic, you might want to also
|
|
7612
|
+
// update consoleWithStackDev.www.js as well.
|
|
7613
|
+
{
|
|
7614
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
7615
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
7616
|
+
|
|
7617
|
+
if (stack !== '') {
|
|
7618
|
+
format += '%s';
|
|
7619
|
+
args = args.concat([stack]);
|
|
7620
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
7621
|
+
|
|
7622
|
+
|
|
7623
|
+
var argsWithFormat = args.map(function (item) {
|
|
7624
|
+
return String(item);
|
|
7625
|
+
}); // Careful: RN currently depends on this prefix
|
|
7626
|
+
|
|
7627
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
7628
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
7629
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
7630
|
+
|
|
7631
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
7632
|
+
}
|
|
7633
|
+
}
|
|
7634
|
+
|
|
7635
|
+
/**
|
|
7636
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
7637
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
7638
|
+
*/
|
|
7639
|
+
function is(x, y) {
|
|
7640
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
7641
|
+
;
|
|
7642
|
+
}
|
|
7643
|
+
|
|
7644
|
+
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
7645
|
+
|
|
7646
|
+
// dispatch for CommonJS interop named imports.
|
|
7647
|
+
|
|
7648
|
+
var useState = React$1.useState,
|
|
7649
|
+
useEffect = React$1.useEffect,
|
|
7650
|
+
useLayoutEffect = React$1.useLayoutEffect,
|
|
7651
|
+
useDebugValue = React$1.useDebugValue;
|
|
7652
|
+
var didWarnOld18Alpha = false;
|
|
7653
|
+
var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
|
|
7654
|
+
// because of a very particular set of implementation details and assumptions
|
|
7655
|
+
// -- change any one of them and it will break. The most important assumption
|
|
7656
|
+
// is that updates are always synchronous, because concurrent rendering is
|
|
7657
|
+
// only available in versions of React that also have a built-in
|
|
7658
|
+
// useSyncExternalStore API. And we only use this shim when the built-in API
|
|
7659
|
+
// does not exist.
|
|
7660
|
+
//
|
|
7661
|
+
// Do not assume that the clever hacks used by this hook also work in general.
|
|
7662
|
+
// The point of this shim is to replace the need for hacks by other libraries.
|
|
7663
|
+
|
|
7664
|
+
function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
7665
|
+
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
7666
|
+
// will need to track that themselves and return the correct value
|
|
7667
|
+
// from `getSnapshot`.
|
|
7668
|
+
getServerSnapshot) {
|
|
7669
|
+
{
|
|
7670
|
+
if (!didWarnOld18Alpha) {
|
|
7671
|
+
if (React$1.startTransition !== undefined) {
|
|
7672
|
+
didWarnOld18Alpha = true;
|
|
7673
|
+
|
|
7674
|
+
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.');
|
|
7675
|
+
}
|
|
7676
|
+
}
|
|
7677
|
+
} // Read the current snapshot from the store on every render. Again, this
|
|
7678
|
+
// breaks the rules of React, and only works here because of specific
|
|
7679
|
+
// implementation details, most importantly that updates are
|
|
7680
|
+
// always synchronous.
|
|
7681
|
+
|
|
7682
|
+
|
|
7683
|
+
var value = getSnapshot();
|
|
7684
|
+
|
|
7685
|
+
{
|
|
7686
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
7687
|
+
var cachedValue = getSnapshot();
|
|
7688
|
+
|
|
7689
|
+
if (!objectIs(value, cachedValue)) {
|
|
7690
|
+
error('The result of getSnapshot should be cached to avoid an infinite loop');
|
|
7691
|
+
|
|
7692
|
+
didWarnUncachedGetSnapshot = true;
|
|
7693
|
+
}
|
|
7694
|
+
}
|
|
7695
|
+
} // Because updates are synchronous, we don't queue them. Instead we force a
|
|
7696
|
+
// re-render whenever the subscribed state changes by updating an some
|
|
7697
|
+
// arbitrary useState hook. Then, during render, we call getSnapshot to read
|
|
7698
|
+
// the current value.
|
|
7699
|
+
//
|
|
7700
|
+
// Because we don't actually use the state returned by the useState hook, we
|
|
7701
|
+
// can save a bit of memory by storing other stuff in that slot.
|
|
7702
|
+
//
|
|
7703
|
+
// To implement the early bailout, we need to track some things on a mutable
|
|
7704
|
+
// object. Usually, we would put that in a useRef hook, but we can stash it in
|
|
7705
|
+
// our useState hook instead.
|
|
7706
|
+
//
|
|
7707
|
+
// To force a re-render, we call forceUpdate({inst}). That works because the
|
|
7708
|
+
// new object always fails an equality check.
|
|
7709
|
+
|
|
7710
|
+
|
|
7711
|
+
var _useState = useState({
|
|
7712
|
+
inst: {
|
|
7713
|
+
value: value,
|
|
7714
|
+
getSnapshot: getSnapshot
|
|
7715
|
+
}
|
|
7716
|
+
}),
|
|
7717
|
+
inst = _useState[0].inst,
|
|
7718
|
+
forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
|
|
7719
|
+
// in the layout phase so we can access it during the tearing check that
|
|
7720
|
+
// happens on subscribe.
|
|
7721
|
+
|
|
7722
|
+
|
|
7723
|
+
useLayoutEffect(function () {
|
|
7724
|
+
inst.value = value;
|
|
7725
|
+
inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
|
|
7726
|
+
// commit phase if there was an interleaved mutation. In concurrent mode
|
|
7727
|
+
// this can happen all the time, but even in synchronous mode, an earlier
|
|
7728
|
+
// effect may have mutated the store.
|
|
7729
|
+
|
|
7730
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
7731
|
+
// Force a re-render.
|
|
7732
|
+
forceUpdate({
|
|
7733
|
+
inst: inst
|
|
7734
|
+
});
|
|
7735
|
+
}
|
|
7736
|
+
}, [subscribe, value, getSnapshot]);
|
|
7737
|
+
useEffect(function () {
|
|
7738
|
+
// Check for changes right before subscribing. Subsequent changes will be
|
|
7739
|
+
// detected in the subscription handler.
|
|
7740
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
7741
|
+
// Force a re-render.
|
|
7742
|
+
forceUpdate({
|
|
7743
|
+
inst: inst
|
|
7744
|
+
});
|
|
7745
|
+
}
|
|
7746
|
+
|
|
7747
|
+
var handleStoreChange = function () {
|
|
7748
|
+
// TODO: Because there is no cross-renderer API for batching updates, it's
|
|
7749
|
+
// up to the consumer of this library to wrap their subscription event
|
|
7750
|
+
// with unstable_batchedUpdates. Should we try to detect when this isn't
|
|
7751
|
+
// the case and print a warning in development?
|
|
7752
|
+
// The store changed. Check if the snapshot changed since the last time we
|
|
7753
|
+
// read from the store.
|
|
7754
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
7755
|
+
// Force a re-render.
|
|
7756
|
+
forceUpdate({
|
|
7757
|
+
inst: inst
|
|
7758
|
+
});
|
|
7759
|
+
}
|
|
7760
|
+
}; // Subscribe to the store and return a clean-up function.
|
|
7761
|
+
|
|
7762
|
+
|
|
7763
|
+
return subscribe(handleStoreChange);
|
|
7764
|
+
}, [subscribe]);
|
|
7765
|
+
useDebugValue(value);
|
|
7766
|
+
return value;
|
|
7767
|
+
}
|
|
7768
|
+
|
|
7769
|
+
function checkIfSnapshotChanged(inst) {
|
|
7770
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
7771
|
+
var prevValue = inst.value;
|
|
7772
|
+
|
|
7773
|
+
try {
|
|
7774
|
+
var nextValue = latestGetSnapshot();
|
|
7775
|
+
return !objectIs(prevValue, nextValue);
|
|
7776
|
+
} catch (error) {
|
|
7777
|
+
return true;
|
|
7778
|
+
}
|
|
7779
|
+
}
|
|
7780
|
+
|
|
7781
|
+
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
7782
|
+
// Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
7783
|
+
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
7784
|
+
// will need to track that themselves and return the correct value
|
|
7785
|
+
// from `getSnapshot`.
|
|
7786
|
+
return getSnapshot();
|
|
7787
|
+
}
|
|
7788
|
+
|
|
7789
|
+
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
7790
|
+
|
|
7791
|
+
var isServerEnvironment = !canUseDOM;
|
|
7792
|
+
|
|
7793
|
+
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
7794
|
+
var useSyncExternalStore$2 = React$1.useSyncExternalStore !== undefined ? React$1.useSyncExternalStore : shim;
|
|
7795
|
+
|
|
7796
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
7797
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
7798
|
+
if (
|
|
7799
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
7800
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
7801
|
+
'function'
|
|
7802
|
+
) {
|
|
7803
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
7804
|
+
}
|
|
7805
|
+
|
|
7806
|
+
})();
|
|
7807
|
+
}
|
|
7808
|
+
return useSyncExternalStoreShim_development;
|
|
7809
|
+
}
|
|
7810
|
+
|
|
7811
|
+
var hasRequiredShim;
|
|
7812
|
+
|
|
7813
|
+
function requireShim () {
|
|
7814
|
+
if (hasRequiredShim) return shim.exports;
|
|
7815
|
+
hasRequiredShim = 1;
|
|
7816
|
+
|
|
7817
|
+
if (process.env.NODE_ENV === 'production') {
|
|
7818
|
+
shim.exports = requireUseSyncExternalStoreShim_production_min();
|
|
7819
|
+
} else {
|
|
7820
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
7821
|
+
}
|
|
7822
|
+
return shim.exports;
|
|
7823
|
+
}
|
|
7824
|
+
|
|
7825
|
+
/**
|
|
7826
|
+
* @license React
|
|
7827
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
7828
|
+
*
|
|
7829
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7830
|
+
*
|
|
7831
|
+
* This source code is licensed under the MIT license found in the
|
|
7832
|
+
* LICENSE file in the root directory of this source tree.
|
|
7833
|
+
*/
|
|
7834
|
+
|
|
7835
|
+
var hasRequiredWithSelector_production_min;
|
|
7836
|
+
|
|
7837
|
+
function requireWithSelector_production_min () {
|
|
7838
|
+
if (hasRequiredWithSelector_production_min) return withSelector_production_min;
|
|
7839
|
+
hasRequiredWithSelector_production_min = 1;
|
|
7840
|
+
var h=React,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;
|
|
7841
|
+
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]);
|
|
7842
|
+
u(function(){f.hasValue=!0;f.value=d;},[d]);w(d);return d};
|
|
7843
|
+
return withSelector_production_min;
|
|
7844
|
+
}
|
|
7845
|
+
|
|
7846
|
+
var withSelector_development = {};
|
|
7847
|
+
|
|
7848
|
+
/**
|
|
7849
|
+
* @license React
|
|
7850
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
7851
|
+
*
|
|
7852
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7853
|
+
*
|
|
7854
|
+
* This source code is licensed under the MIT license found in the
|
|
7855
|
+
* LICENSE file in the root directory of this source tree.
|
|
7856
|
+
*/
|
|
7857
|
+
|
|
7858
|
+
var hasRequiredWithSelector_development;
|
|
7859
|
+
|
|
7860
|
+
function requireWithSelector_development () {
|
|
7861
|
+
if (hasRequiredWithSelector_development) return withSelector_development;
|
|
7862
|
+
hasRequiredWithSelector_development = 1;
|
|
7863
|
+
|
|
7864
|
+
if (process.env.NODE_ENV !== "production") {
|
|
7865
|
+
(function() {
|
|
7866
|
+
|
|
7867
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
7868
|
+
if (
|
|
7869
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
7870
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
7871
|
+
'function'
|
|
7872
|
+
) {
|
|
7873
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
7874
|
+
}
|
|
7875
|
+
var React$1 = React;
|
|
7876
|
+
var shim = requireShim();
|
|
7877
|
+
|
|
7878
|
+
/**
|
|
7879
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
7880
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
7881
|
+
*/
|
|
7882
|
+
function is(x, y) {
|
|
7883
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
7884
|
+
;
|
|
7885
|
+
}
|
|
7886
|
+
|
|
7887
|
+
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
7888
|
+
|
|
7889
|
+
var useSyncExternalStore = shim.useSyncExternalStore;
|
|
7890
|
+
|
|
7891
|
+
// for CommonJS interop.
|
|
7892
|
+
|
|
7893
|
+
var useRef = React$1.useRef,
|
|
7894
|
+
useEffect = React$1.useEffect,
|
|
7895
|
+
useMemo = React$1.useMemo,
|
|
7896
|
+
useDebugValue = React$1.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
|
|
7897
|
+
|
|
7898
|
+
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
7899
|
+
// Use this to track the rendered snapshot.
|
|
7900
|
+
var instRef = useRef(null);
|
|
7901
|
+
var inst;
|
|
7902
|
+
|
|
7903
|
+
if (instRef.current === null) {
|
|
7904
|
+
inst = {
|
|
7905
|
+
hasValue: false,
|
|
7906
|
+
value: null
|
|
7907
|
+
};
|
|
7908
|
+
instRef.current = inst;
|
|
7909
|
+
} else {
|
|
7910
|
+
inst = instRef.current;
|
|
7911
|
+
}
|
|
7912
|
+
|
|
7913
|
+
var _useMemo = useMemo(function () {
|
|
7914
|
+
// Track the memoized state using closure variables that are local to this
|
|
7915
|
+
// memoized instance of a getSnapshot function. Intentionally not using a
|
|
7916
|
+
// useRef hook, because that state would be shared across all concurrent
|
|
7917
|
+
// copies of the hook/component.
|
|
7918
|
+
var hasMemo = false;
|
|
7919
|
+
var memoizedSnapshot;
|
|
7920
|
+
var memoizedSelection;
|
|
7921
|
+
|
|
7922
|
+
var memoizedSelector = function (nextSnapshot) {
|
|
7923
|
+
if (!hasMemo) {
|
|
7924
|
+
// The first time the hook is called, there is no memoized result.
|
|
7925
|
+
hasMemo = true;
|
|
7926
|
+
memoizedSnapshot = nextSnapshot;
|
|
7927
|
+
|
|
7928
|
+
var _nextSelection = selector(nextSnapshot);
|
|
7929
|
+
|
|
7930
|
+
if (isEqual !== undefined) {
|
|
7931
|
+
// Even if the selector has changed, the currently rendered selection
|
|
7932
|
+
// may be equal to the new selection. We should attempt to reuse the
|
|
7933
|
+
// current value if possible, to preserve downstream memoizations.
|
|
7934
|
+
if (inst.hasValue) {
|
|
7935
|
+
var currentSelection = inst.value;
|
|
7936
|
+
|
|
7937
|
+
if (isEqual(currentSelection, _nextSelection)) {
|
|
7938
|
+
memoizedSelection = currentSelection;
|
|
7939
|
+
return currentSelection;
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
}
|
|
7943
|
+
|
|
7944
|
+
memoizedSelection = _nextSelection;
|
|
7945
|
+
return _nextSelection;
|
|
7946
|
+
} // We may be able to reuse the previous invocation's result.
|
|
7947
|
+
|
|
7948
|
+
|
|
7949
|
+
// We may be able to reuse the previous invocation's result.
|
|
7950
|
+
var prevSnapshot = memoizedSnapshot;
|
|
7951
|
+
var prevSelection = memoizedSelection;
|
|
7952
|
+
|
|
7953
|
+
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
7954
|
+
// The snapshot is the same as last time. Reuse the previous selection.
|
|
7955
|
+
return prevSelection;
|
|
7956
|
+
} // The snapshot has changed, so we need to compute a new selection.
|
|
7957
|
+
|
|
7958
|
+
|
|
7959
|
+
// The snapshot has changed, so we need to compute a new selection.
|
|
7960
|
+
var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
|
|
7961
|
+
// has changed. If it hasn't, return the previous selection. That signals
|
|
7962
|
+
// to React that the selections are conceptually equal, and we can bail
|
|
7963
|
+
// out of rendering.
|
|
7964
|
+
|
|
7965
|
+
// If a custom isEqual function is provided, use that to check if the data
|
|
7966
|
+
// has changed. If it hasn't, return the previous selection. That signals
|
|
7967
|
+
// to React that the selections are conceptually equal, and we can bail
|
|
7968
|
+
// out of rendering.
|
|
7969
|
+
if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
|
|
7970
|
+
return prevSelection;
|
|
7971
|
+
}
|
|
7972
|
+
|
|
7973
|
+
memoizedSnapshot = nextSnapshot;
|
|
7974
|
+
memoizedSelection = nextSelection;
|
|
7975
|
+
return nextSelection;
|
|
7976
|
+
}; // Assigning this to a constant so that Flow knows it can't change.
|
|
7977
|
+
|
|
7978
|
+
|
|
7979
|
+
// Assigning this to a constant so that Flow knows it can't change.
|
|
7980
|
+
var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
|
|
7981
|
+
|
|
7982
|
+
var getSnapshotWithSelector = function () {
|
|
7983
|
+
return memoizedSelector(getSnapshot());
|
|
7984
|
+
};
|
|
7985
|
+
|
|
7986
|
+
var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
|
|
7987
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
7988
|
+
};
|
|
7989
|
+
return [getSnapshotWithSelector, getServerSnapshotWithSelector];
|
|
7990
|
+
}, [getSnapshot, getServerSnapshot, selector, isEqual]),
|
|
7991
|
+
getSelection = _useMemo[0],
|
|
7992
|
+
getServerSelection = _useMemo[1];
|
|
7993
|
+
|
|
7994
|
+
var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
7995
|
+
useEffect(function () {
|
|
7996
|
+
inst.hasValue = true;
|
|
7997
|
+
inst.value = value;
|
|
7998
|
+
}, [value]);
|
|
7999
|
+
useDebugValue(value);
|
|
8000
|
+
return value;
|
|
8001
|
+
}
|
|
8002
|
+
|
|
8003
|
+
withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
|
|
8004
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
8005
|
+
if (
|
|
8006
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
8007
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
8008
|
+
'function'
|
|
8009
|
+
) {
|
|
8010
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
8011
|
+
}
|
|
8012
|
+
|
|
8013
|
+
})();
|
|
8014
|
+
}
|
|
8015
|
+
return withSelector_development;
|
|
8016
|
+
}
|
|
8017
|
+
|
|
8018
|
+
if (process.env.NODE_ENV === 'production') {
|
|
8019
|
+
withSelector.exports = requireWithSelector_production_min();
|
|
8020
|
+
} else {
|
|
8021
|
+
withSelector.exports = requireWithSelector_development();
|
|
8022
|
+
}
|
|
8023
|
+
|
|
8024
|
+
var withSelectorExports = withSelector.exports;
|
|
8025
|
+
var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelectorExports);
|
|
8026
|
+
|
|
8027
|
+
const { useDebugValue } = React;
|
|
8028
|
+
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
|
|
8029
|
+
let didWarnAboutEqualityFn = false;
|
|
8030
|
+
const identity = (arg) => arg;
|
|
8031
|
+
function useStore(api, selector = identity, equalityFn) {
|
|
8032
|
+
if ((undefined ? undefined.MODE : void 0) !== "production" && equalityFn && !didWarnAboutEqualityFn) {
|
|
8033
|
+
console.warn(
|
|
8034
|
+
"[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"
|
|
8035
|
+
);
|
|
8036
|
+
didWarnAboutEqualityFn = true;
|
|
8037
|
+
}
|
|
8038
|
+
const slice = useSyncExternalStoreWithSelector(
|
|
8039
|
+
api.subscribe,
|
|
8040
|
+
api.getState,
|
|
8041
|
+
api.getServerState || api.getInitialState,
|
|
8042
|
+
selector,
|
|
8043
|
+
equalityFn
|
|
8044
|
+
);
|
|
8045
|
+
useDebugValue(slice);
|
|
8046
|
+
return slice;
|
|
8047
|
+
}
|
|
8048
|
+
const createImpl = (createState) => {
|
|
8049
|
+
if ((undefined ? undefined.MODE : void 0) !== "production" && typeof createState !== "function") {
|
|
8050
|
+
console.warn(
|
|
8051
|
+
"[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`."
|
|
8052
|
+
);
|
|
8053
|
+
}
|
|
8054
|
+
const api = typeof createState === "function" ? createStore(createState) : createState;
|
|
8055
|
+
const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
|
|
8056
|
+
Object.assign(useBoundStore, api);
|
|
8057
|
+
return useBoundStore;
|
|
8058
|
+
};
|
|
8059
|
+
const create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
8060
|
+
|
|
8061
|
+
const useContainerStore = create(() => ({
|
|
8062
|
+
containerRef: undefined,
|
|
8063
|
+
}));
|
|
8064
|
+
|
|
7506
8065
|
function ProductCard({ children }) {
|
|
7507
|
-
|
|
8066
|
+
const containerRef = React.useRef(null);
|
|
8067
|
+
React.useEffect(() => {
|
|
8068
|
+
useContainerStore.setState({ containerRef });
|
|
8069
|
+
}, [containerRef]);
|
|
8070
|
+
return (jsxRuntime.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: jsxRuntime.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 }) }));
|
|
7508
8071
|
}
|
|
7509
8072
|
function BorderedContainer({ children, className, }) {
|
|
7510
8073
|
return (jsxRuntime.jsx("section", { className: cn('tw-border-t tw-border-t-material-light-thin', className), children: children }));
|
|
@@ -13616,7 +14179,7 @@ function TransactionSearch({ query, setQuery, children, className, }) {
|
|
|
13616
14179
|
}
|
|
13617
14180
|
|
|
13618
14181
|
function Toast({ headerContent, actionsContent, description, chipLabel, title, }) {
|
|
13619
|
-
return (jsxRuntime.jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs", rounded: "sm", children: [headerContent, jsxRuntime.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: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsxRuntime.jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsxRuntime.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 && (jsxRuntime.jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
|
|
14182
|
+
return (jsxRuntime.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, jsxRuntime.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: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-100", children: title }) }), jsxRuntime.jsx(CaptionText, { className: "tw-text-center tw-text-material-light-thick", children: description }), jsxRuntime.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 && (jsxRuntime.jsx(Chip, { label: chipLabel, className: "tw-absolute tw-right-squid-xs tw-top-squid-xs" }))] }));
|
|
13620
14183
|
}
|
|
13621
14184
|
|
|
13622
14185
|
const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
|
|
@@ -13867,28 +14430,142 @@ const tooltipWidthClassMap = {
|
|
|
13867
14430
|
container: 'tw-w-full',
|
|
13868
14431
|
};
|
|
13869
14432
|
const tooltipThresholdClassMap = {
|
|
13870
|
-
xxs: 'tw-
|
|
13871
|
-
xs: 'tw-
|
|
13872
|
-
s: 'tw-
|
|
13873
|
-
m: 'tw-
|
|
13874
|
-
l: 'tw-
|
|
13875
|
-
xl: 'tw-
|
|
13876
|
-
xxl: 'tw-
|
|
14433
|
+
xxs: 'tw-py-squid-xxs',
|
|
14434
|
+
xs: 'tw-py-squid-xs',
|
|
14435
|
+
s: 'tw-py-squid-s',
|
|
14436
|
+
m: 'tw-py-squid-m',
|
|
14437
|
+
l: 'tw-py-squid-l',
|
|
14438
|
+
xl: 'tw-py-squid-xl',
|
|
14439
|
+
xxl: 'tw-py-squid-xxl',
|
|
13877
14440
|
};
|
|
13878
|
-
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, }) {
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
14441
|
+
function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, containerRef: _containerRef, }) {
|
|
14442
|
+
const containerRefState = useContainerStore((state) => state.containerRef);
|
|
14443
|
+
const containerRef = (containerRefState === null || containerRefState === void 0 ? void 0 : containerRefState.current)
|
|
14444
|
+
? containerRefState
|
|
14445
|
+
: _containerRef;
|
|
14446
|
+
const [tooltipPositionStyle, setTooltipPositionStyle] = React.useState({});
|
|
14447
|
+
const [isTooltipVisible, setIsTooltipVisible] = React.useState(false);
|
|
14448
|
+
const tooltipRef = React.useRef(null);
|
|
14449
|
+
const tooltipTriggerRef = React.useRef(null);
|
|
14450
|
+
React.useEffect(() => {
|
|
14451
|
+
const adjustTooltipPosition = () => {
|
|
14452
|
+
if (!(containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) ||
|
|
14453
|
+
!tooltipRef.current ||
|
|
14454
|
+
!tooltipTriggerRef.current) {
|
|
14455
|
+
// try to center it
|
|
14456
|
+
return setTooltipPositionStyle({
|
|
14457
|
+
top: '-100%',
|
|
14458
|
+
left: '50%',
|
|
14459
|
+
transform: 'translateX(-50%)',
|
|
14460
|
+
});
|
|
14461
|
+
}
|
|
14462
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
14463
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
14464
|
+
const tooltipTriggerRect = tooltipTriggerRef.current.getBoundingClientRect();
|
|
14465
|
+
const tooltipFitsBelow = containerRect.bottom - tooltipTriggerRect.bottom > tooltipRect.height;
|
|
14466
|
+
const tooltipFitsAbove = tooltipTriggerRect.top - containerRect.top > tooltipRect.height;
|
|
14467
|
+
const fitsInLeft = tooltipTriggerRect.left - containerRect.left >= tooltipRect.width;
|
|
14468
|
+
const fitsInRight = tooltipTriggerRect.left + tooltipRect.width - containerRect.left <
|
|
14469
|
+
containerRect.width / 2 - tooltipRect.width / 2;
|
|
14470
|
+
const fitsInMiddle = tooltipTriggerRect.left +
|
|
14471
|
+
tooltipTriggerRect.width / 2 -
|
|
14472
|
+
containerRect.left >=
|
|
14473
|
+
tooltipRect.width / 2 &&
|
|
14474
|
+
containerRect.right -
|
|
14475
|
+
(tooltipTriggerRect.right - tooltipTriggerRect.width / 2) >=
|
|
14476
|
+
tooltipRect.width / 2;
|
|
14477
|
+
if (tooltipFitsAbove || !tooltipFitsBelow) {
|
|
14478
|
+
const top = -tooltipRect.height;
|
|
14479
|
+
if (fitsInMiddle || (!fitsInLeft && !fitsInRight)) {
|
|
14480
|
+
const left = tooltipTriggerRect.width / 2 - tooltipRect.width / 2;
|
|
14481
|
+
const leftOverflowsContainer = tooltipTriggerRect.left - tooltipRect.width / 2 < containerRect.left;
|
|
14482
|
+
// if doesn't fit in either side, set to top center
|
|
14483
|
+
setTooltipPositionStyle({
|
|
14484
|
+
top: top,
|
|
14485
|
+
// if the defined left position is too far to the left, set to the left of the container
|
|
14486
|
+
left: leftOverflowsContainer
|
|
14487
|
+
? containerRect.left - tooltipTriggerRect.left
|
|
14488
|
+
: left,
|
|
14489
|
+
});
|
|
14490
|
+
}
|
|
14491
|
+
else if (fitsInLeft) {
|
|
14492
|
+
setTooltipPositionStyle({
|
|
14493
|
+
top: top,
|
|
14494
|
+
right: -(containerRect.right - tooltipTriggerRect.right),
|
|
14495
|
+
});
|
|
14496
|
+
}
|
|
14497
|
+
else if (fitsInRight) {
|
|
14498
|
+
setTooltipPositionStyle({
|
|
14499
|
+
top: top,
|
|
14500
|
+
});
|
|
14501
|
+
}
|
|
14502
|
+
}
|
|
14503
|
+
else if (tooltipFitsBelow) {
|
|
14504
|
+
const top = tooltipTriggerRect.height;
|
|
14505
|
+
if (fitsInLeft) {
|
|
14506
|
+
setTooltipPositionStyle({
|
|
14507
|
+
top: top,
|
|
14508
|
+
right: -(containerRect.right - tooltipTriggerRect.right),
|
|
14509
|
+
});
|
|
14510
|
+
}
|
|
14511
|
+
else if (fitsInRight) {
|
|
14512
|
+
setTooltipPositionStyle({
|
|
14513
|
+
top: top,
|
|
14514
|
+
});
|
|
14515
|
+
}
|
|
14516
|
+
else {
|
|
14517
|
+
const left = -(tooltipRect.width / 2);
|
|
14518
|
+
const leftOverflowsContainer = tooltipTriggerRect.left - tooltipRect.width / 2 < containerRect.left;
|
|
14519
|
+
// if doesn't fit in either side, set to top center
|
|
14520
|
+
setTooltipPositionStyle({
|
|
14521
|
+
top: top,
|
|
14522
|
+
// if the defined left position is too far to the left, set to the left of the container
|
|
14523
|
+
left: leftOverflowsContainer
|
|
14524
|
+
? containerRect.left - tooltipTriggerRect.left
|
|
14525
|
+
: left,
|
|
14526
|
+
});
|
|
14527
|
+
}
|
|
14528
|
+
}
|
|
14529
|
+
};
|
|
14530
|
+
adjustTooltipPosition();
|
|
14531
|
+
const timeoutId = setTimeout(() => {
|
|
14532
|
+
adjustTooltipPosition();
|
|
14533
|
+
}, 300);
|
|
14534
|
+
window.addEventListener('resize', adjustTooltipPosition);
|
|
14535
|
+
return () => {
|
|
14536
|
+
clearTimeout(timeoutId);
|
|
14537
|
+
window.removeEventListener('resize', adjustTooltipPosition);
|
|
14538
|
+
};
|
|
14539
|
+
}, [
|
|
14540
|
+
containerRef,
|
|
14541
|
+
tooltipContent,
|
|
14542
|
+
threshold,
|
|
14543
|
+
tooltipWidth,
|
|
14544
|
+
displayDelayMs,
|
|
14545
|
+
isTooltipVisible,
|
|
14546
|
+
]);
|
|
14547
|
+
return (jsxRuntime.jsxs("div", { className: cn('tw-relative', containerClassName), onMouseMove: (e) => {
|
|
14548
|
+
var _a;
|
|
14549
|
+
if (e.target === tooltipRef.current ||
|
|
14550
|
+
((_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
14551
|
+
return;
|
|
14552
|
+
}
|
|
14553
|
+
setIsTooltipVisible(true);
|
|
14554
|
+
}, onMouseLeave: () => {
|
|
14555
|
+
setIsTooltipVisible(false);
|
|
14556
|
+
}, children: [jsxRuntime.jsx("div", { ref: tooltipTriggerRef, className: childrenClassName, children: children }), tooltipContent ? (jsxRuntime.jsx(Menu, { style: Object.assign({ [CSS_VARS.DISPLAY_DELAYED_DURATION]: `${displayDelayMs}ms` }, tooltipPositionStyle), menuRef: tooltipRef, containerClassName: cn('tw-absolute tw-z-40',
|
|
14557
|
+
// 'tw-animate-hide peer-hover:tw-animate-display-delayed hover:tw-animate-display-delayed',
|
|
14558
|
+
// we can't hide the tooltip when it's not visible (i.e using display: none)
|
|
14559
|
+
// because we need to gets its rect to calculate the position
|
|
14560
|
+
isTooltipVisible
|
|
14561
|
+
? 'tw-opacity-100'
|
|
14562
|
+
: 'tw-opacity-0 -tw-z-40 tw-select-none tw-pointer-events-none', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
|
|
13886
14563
|
}
|
|
13887
14564
|
|
|
13888
14565
|
function BoostButton({ boostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, boostIndicatorRef, }) {
|
|
13889
14566
|
return (jsxRuntime.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: jsxRuntime.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: [jsxRuntime.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 &&
|
|
13890
14567
|
'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxRuntime.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 &&
|
|
13891
|
-
'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxRuntime.jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "
|
|
14568
|
+
'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxRuntime.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: [jsxRuntime.jsx("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxRuntime.jsxs("div", { className: "tw-w-[70px] tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsxRuntime.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: {
|
|
13892
14569
|
boxShadow: generateMarkerLines(40),
|
|
13893
14570
|
} })] }), jsxRuntime.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: {
|
|
13894
14571
|
transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
|
|
@@ -13967,7 +14644,11 @@ function MainView() {
|
|
|
13967
14644
|
bgColor: '#627eea',
|
|
13968
14645
|
textColor: '#fff',
|
|
13969
14646
|
decimals: 18,
|
|
13970
|
-
}, priceImpactPercentage: '0.3', balance: '4.57', address: "so-so.eth" }), jsxRuntime.jsx(DetailsToolbar, { canToggleBoostMode:
|
|
14647
|
+
}, priceImpactPercentage: '0.3', balance: '4.57', address: "so-so.eth" }), jsxRuntime.jsx(DetailsToolbar, { canToggleBoostMode: false, flipButton: {
|
|
14648
|
+
isDisabled: true,
|
|
14649
|
+
disabledMessage: 'Not enough USDC to flip the swap',
|
|
14650
|
+
tooltipDisplayDelayMs: 0,
|
|
14651
|
+
} }), jsxRuntime.jsx(SwapConfiguration, { isFetching: true, direction: "to", chain: {
|
|
13971
14652
|
iconUrl: 'https://raw.githubusercontent.com/0xsquid/assets/main/images/tokens/avax.svg',
|
|
13972
14653
|
bgColor: '#e84142',
|
|
13973
14654
|
}, token: {
|
|
@@ -14013,25 +14694,27 @@ function LightningIcon({ size = '24', className = '', }) {
|
|
|
14013
14694
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.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" }) }));
|
|
14014
14695
|
}
|
|
14015
14696
|
|
|
14016
|
-
function SwapDetailsView({ isLoading }) {
|
|
14697
|
+
function SwapDetailsView({ isLoading, canToggleBoostMode = true, }) {
|
|
14017
14698
|
const [isModalOpen, setIsModalOpen] = React.useState(true);
|
|
14018
14699
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Modal, { isOpen: isModalOpen, onBackdropClick: () => {
|
|
14019
14700
|
setIsModalOpen(false);
|
|
14020
|
-
}, children: [jsxRuntime.jsxs(ModalContent, { children: [jsxRuntime.jsx(Settings, {}), jsxRuntime.jsxs("ul", { className: "tw-flex tw-flex-col tw-items-start tw-gap-squid-xxs tw-self-stretch tw-py-squid-xs", children: [jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ClockOutlineIcon, {}), label: "Estimated time to complete", detail: "~20s" }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ArrowBottomTopIcon, {}), label: "Exchange rate", detail: "1 ETH = 4,031.05 USDC" }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ArrowWallDownIcon, {}), label: "Receive minimum", detail: "750.5 USDC" }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(GasIcon, {}), label: "Cross-chain gas fees", detail: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { children: "0.02534 ETH" }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-500", children: "$9.92" })] }) }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ReorderIcon, {}), label: "Expected gas refund", detail: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { children: "-0.06336 ETH" }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-500", children: "-$2.48" })] }) }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ReceiptBillIcon, {}), label: "Total fee", detail: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { children: "0.0177 ETH" }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-500", children: "$7.43" })] }) })] }), jsxRuntime.jsx(InfoBox, { icon: jsxRuntime.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." })] }), jsxRuntime.jsx(Button$1, { size: "lg", variant: "secondary", label: "Close", onClick: () => {
|
|
14701
|
+
}, children: [jsxRuntime.jsxs(ModalContent, { children: [jsxRuntime.jsx(Settings, { canToggleBoostMode: canToggleBoostMode }), jsxRuntime.jsxs("ul", { className: "tw-flex tw-flex-col tw-items-start tw-gap-squid-xxs tw-self-stretch tw-py-squid-xs", children: [jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ClockOutlineIcon, {}), label: "Estimated time to complete", detail: "~20s" }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ArrowBottomTopIcon, {}), label: "Exchange rate", detail: "1 ETH = 4,031.05 USDC" }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ArrowWallDownIcon, {}), label: "Receive minimum", detail: "750.5 USDC" }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(GasIcon, {}), label: "Cross-chain gas fees", detail: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { children: "0.02534 ETH" }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-500", children: "$9.92" })] }) }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ReorderIcon, {}), label: "Expected gas refund", detail: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { children: "-0.06336 ETH" }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-500", children: "-$2.48" })] }) }), jsxRuntime.jsx(PropertyListItem, { isLoading: isLoading, icon: jsxRuntime.jsx(ReceiptBillIcon, {}), label: "Total fee", detail: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { children: "0.0177 ETH" }), jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-500", children: "$7.43" })] }) })] }), jsxRuntime.jsx(InfoBox, { icon: jsxRuntime.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." })] }), jsxRuntime.jsx(Button$1, { size: "lg", variant: "secondary", label: "Close", onClick: () => {
|
|
14021
14702
|
setIsModalOpen(false);
|
|
14022
14703
|
} })] }) }));
|
|
14023
14704
|
}
|
|
14024
|
-
function Settings() {
|
|
14705
|
+
function Settings({ canToggleBoostMode }) {
|
|
14025
14706
|
return (jsxRuntime.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: jsxRuntime.jsx(SettingsItem, { icon: jsxRuntime.jsx(LightningIcon, { className: "tw-text-grey-500" }), label: "Boost", control: {
|
|
14026
14707
|
type: 'switch',
|
|
14027
14708
|
checked: false,
|
|
14709
|
+
disabled: !canToggleBoostMode,
|
|
14028
14710
|
onChange: console.log,
|
|
14029
|
-
tooltip:
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
|
|
14711
|
+
tooltip: canToggleBoostMode
|
|
14712
|
+
? undefined
|
|
14713
|
+
: {
|
|
14714
|
+
tooltipWidth: 'max',
|
|
14715
|
+
containerClassName: 'tw-h-[30px]',
|
|
14716
|
+
tooltipContent: 'Boost not supported for this route',
|
|
14717
|
+
},
|
|
14035
14718
|
}, transparent: true, helpTooltip: {
|
|
14036
14719
|
tooltipWidth: 'max',
|
|
14037
14720
|
tooltipClassName: 'tw-left-[15px]',
|
|
@@ -49450,6 +50133,7 @@ exports.List = List;
|
|
|
49450
50133
|
exports.ListItem = ListItem;
|
|
49451
50134
|
exports.LoadingProvider = LoadingProvider;
|
|
49452
50135
|
exports.LoadingSkeleton = LoadingSkeleton;
|
|
50136
|
+
exports.MEDIA_QUERIES = MEDIA_QUERIES;
|
|
49453
50137
|
exports.MainView = MainView;
|
|
49454
50138
|
exports.Menu = Menu;
|
|
49455
50139
|
exports.MenuItem = MenuItem;
|