@0xsquid/ui 0.27.2-beta.0 → 0.27.3-alpha.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/README.md +4 -4
- package/dist/cjs/index.js +38 -181
- package/dist/cjs/types/components/icons/Generic.d.ts +0 -28
- package/dist/cjs/types/components/icons/Weather.d.ts +0 -4
- package/dist/cjs/types/components/layout/AppContainer.d.ts +1 -0
- package/dist/cjs/types/components/layout/PipeSeparator.d.ts +1 -1
- package/dist/cjs/types/components/views/SwapProgressView.d.ts +2 -2
- package/dist/cjs/types/hooks/index.d.ts +0 -1
- package/dist/cjs/types/providers/SquidConfigProvider.d.ts +9 -0
- package/dist/cjs/types/providers/index.d.ts +1 -1
- package/dist/cjs/types/types/components.d.ts +2 -2
- package/dist/cjs/types/types/index.d.ts +1 -1
- package/dist/esm/index.js +32 -166
- package/dist/esm/types/components/icons/Generic.d.ts +0 -28
- package/dist/esm/types/components/icons/Weather.d.ts +0 -4
- package/dist/esm/types/components/layout/AppContainer.d.ts +1 -0
- package/dist/esm/types/components/layout/PipeSeparator.d.ts +1 -1
- package/dist/esm/types/components/views/SwapProgressView.d.ts +2 -2
- package/dist/esm/types/hooks/index.d.ts +0 -1
- package/dist/esm/types/providers/SquidConfigProvider.d.ts +9 -0
- package/dist/esm/types/providers/index.d.ts +1 -1
- package/dist/esm/types/types/components.d.ts +2 -2
- package/dist/esm/types/types/index.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +9 -54
- package/package.json +5 -3
- package/dist/cjs/types/core/numbers.d.ts +0 -23
- package/dist/cjs/types/hooks/useUserTheme.d.ts +0 -13
- package/dist/cjs/types/providers/ThemeProvider.d.ts +0 -11
- package/dist/esm/types/core/numbers.d.ts +0 -23
- package/dist/esm/types/hooks/useUserTheme.d.ts +0 -13
- package/dist/esm/types/providers/ThemeProvider.d.ts +0 -11
package/README.md
CHANGED
|
@@ -17,16 +17,16 @@ Import styles in your entry point:
|
|
|
17
17
|
import "@0xsquid/ui/dist/index.css";
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Wrap your app with our theme provider `<
|
|
20
|
+
Wrap your app with our theme provider `<SquidConfigProvider />` and specify your theme:
|
|
21
21
|
|
|
22
22
|
```jsx
|
|
23
|
-
import {
|
|
23
|
+
import { SquidConfigProvider, Button } from "@0xsquid/ui";
|
|
24
24
|
|
|
25
25
|
function App() {
|
|
26
26
|
return (
|
|
27
|
-
<
|
|
27
|
+
<SquidConfigProvider theme={yourTheme}>
|
|
28
28
|
<Button label="Hello world" variant="primary" size="md" />
|
|
29
|
-
</
|
|
29
|
+
</SquidConfigProvider>
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
```
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React$1 = require('react');
|
|
5
|
+
var reactHooks = require('@0xsquid/react-hooks');
|
|
5
6
|
|
|
6
7
|
function _interopNamespaceDefault(e) {
|
|
7
8
|
var n = Object.create(null);
|
|
@@ -6595,59 +6596,6 @@ var debounce_1 = debounce;
|
|
|
6595
6596
|
|
|
6596
6597
|
var debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(debounce_1);
|
|
6597
6598
|
|
|
6598
|
-
/**
|
|
6599
|
-
* Convert token amount to USD
|
|
6600
|
-
* @param {string|number} tokenAmount - The amount of tokens
|
|
6601
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
6602
|
-
* @returns {BigNumber} - The equivalent amount in USD
|
|
6603
|
-
*/
|
|
6604
|
-
function convertTokenAmountToUSD(tokenAmount, tokenPrice, maxDecimals = 2) {
|
|
6605
|
-
if (!tokenAmount || !tokenPrice)
|
|
6606
|
-
return "";
|
|
6607
|
-
const amount = new BigNumber(tokenAmount);
|
|
6608
|
-
const price = new BigNumber(tokenPrice);
|
|
6609
|
-
return amount.multipliedBy(price).decimalPlaces(maxDecimals).toString();
|
|
6610
|
-
}
|
|
6611
|
-
/**
|
|
6612
|
-
* Convert USD to token amount
|
|
6613
|
-
* @param {string|number} usdAmount - The amount in USD
|
|
6614
|
-
* @param {string|number} tokenPrice - The price of one token in USD
|
|
6615
|
-
* @param {number} maxDecimals - The maximum number of decimals
|
|
6616
|
-
* @returns {BigNumber} - The equivalent amount of tokens
|
|
6617
|
-
*/
|
|
6618
|
-
function convertUSDToTokenAmount(usdAmount, tokenPrice, maxDecimals) {
|
|
6619
|
-
if (!usdAmount || !tokenPrice || !maxDecimals)
|
|
6620
|
-
return "0";
|
|
6621
|
-
const amount = new BigNumber(usdAmount);
|
|
6622
|
-
const price = new BigNumber(tokenPrice);
|
|
6623
|
-
return amount.dividedBy(price).decimalPlaces(maxDecimals).toString();
|
|
6624
|
-
}
|
|
6625
|
-
const INTL_NUMBER_FORMATTER = new Intl.NumberFormat("en-US", {
|
|
6626
|
-
minimumFractionDigits: 2,
|
|
6627
|
-
maximumFractionDigits: 5,
|
|
6628
|
-
});
|
|
6629
|
-
/**
|
|
6630
|
-
* Formats a number to the en-US number format
|
|
6631
|
-
*
|
|
6632
|
-
* @param amount - The number to format
|
|
6633
|
-
* @returns The formatted string
|
|
6634
|
-
*/
|
|
6635
|
-
function formatAmount(amount) {
|
|
6636
|
-
return INTL_NUMBER_FORMATTER.format(amount);
|
|
6637
|
-
}
|
|
6638
|
-
function trimExtraDecimals(value, maxDecimals) {
|
|
6639
|
-
var _a;
|
|
6640
|
-
const split = value.split(".");
|
|
6641
|
-
if (split.length > 1) {
|
|
6642
|
-
const decimals = (_a = split[1]) !== null && _a !== void 0 ? _a : "";
|
|
6643
|
-
if (maxDecimals && decimals.length > maxDecimals) {
|
|
6644
|
-
const newValue = `${split[0]}.${decimals.slice(0, maxDecimals)}`;
|
|
6645
|
-
return newValue;
|
|
6646
|
-
}
|
|
6647
|
-
}
|
|
6648
|
-
return value;
|
|
6649
|
-
}
|
|
6650
|
-
|
|
6651
6599
|
function SwapInputsIcon() {
|
|
6652
6600
|
return (jsxRuntime.jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("g", { clipPath: "url(#clip0_40_7936)", children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM8.38268 4.57612C8.75636 4.7309 9 5.09554 9 5.5V15.5C9 16.0523 8.55228 16.5 8 16.5C7.44772 16.5 7 16.0523 7 15.5V7.91421L5.70711 9.20711C5.31658 9.59763 4.68342 9.59763 4.29289 9.20711C3.90237 8.81658 3.90237 8.18342 4.29289 7.79289L7.29289 4.79289C7.57889 4.5069 8.00901 4.42134 8.38268 4.57612ZM11 15.5C11 15.9045 11.2436 16.2691 11.6173 16.4239C11.991 16.5787 12.4211 16.4931 12.7071 16.2071L15.7071 13.2071C16.0976 12.8166 16.0976 12.1834 15.7071 11.7929C15.3166 11.4024 14.6834 11.4024 14.2929 11.7929L13 13.0858V5.5C13 4.94771 12.5523 4.5 12 4.5C11.4477 4.5 11 4.94771 11 5.5V15.5Z", fill: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_40_7936", children: jsxRuntime.jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
|
|
6653
6601
|
}
|
|
@@ -17227,9 +17175,6 @@ function SunIcon({ size = "24", className, }) {
|
|
|
17227
17175
|
function MoonIcon({ size = "20", className, }) {
|
|
17228
17176
|
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsxRuntime.jsx("path", { d: "M10.0463 2.99972C10.2292 2.73432 10.2427 2.38723 10.0809 2.10846C9.91903 1.8297 9.61096 1.66925 9.28979 1.69647C5.02109 2.05816 1.66992 5.63639 1.66992 9.9982C1.66992 14.5997 5.40018 18.33 10.0017 18.33C14.3636 18.33 17.9419 14.9787 18.3035 10.7098C18.3307 10.3887 18.1702 10.0806 17.8914 9.91879C17.6127 9.75698 17.2656 9.77044 17.0002 9.95336C16.1951 10.5083 15.2201 10.8331 14.1667 10.8331C11.4052 10.8331 9.16667 8.59452 9.16667 5.8331C9.16667 4.77977 9.49145 3.80481 10.0463 2.99972Z", fill: "currentColor" }) }));
|
|
17229
17177
|
}
|
|
17230
|
-
function SunOutlinedIcon({ size = "24", className, }) {
|
|
17231
|
-
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: "M12 3V2M12 22V21M18.3598 5.64005L19.0698 4.93005M4.93016 19.07L5.64016 18.36M21 12H22M2 12H3M18.3598 18.36L19.0698 19.07M4.93016 4.93005L5.64016 5.64005M15.5355 8.46447C17.4882 10.4171 17.4882 13.5829 15.5355 15.5355C13.5829 17.4882 10.4171 17.4882 8.46447 15.5355C6.51185 13.5829 6.51185 10.4171 8.46447 8.46447C10.4171 6.51185 13.5829 6.51185 15.5355 8.46447Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
17232
|
-
}
|
|
17233
17178
|
|
|
17234
17179
|
const dockIconClassname = "tw-text-grey-900";
|
|
17235
17180
|
const dockIconSelectedClassname = "group-data-[squid-theme-type=dark]:tw-text-royal-700 group-data-[squid-theme-type=light]:tw-text-volt-700";
|
|
@@ -17285,27 +17230,6 @@ function ImageIcon({ size = "20", className, }) {
|
|
|
17285
17230
|
function FilterTimelineIcon({ size = "20", className, }) {
|
|
17286
17231
|
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsxRuntime.jsx("path", { d: "M5.00117 3.33325C5.46141 3.33325 5.8345 3.70635 5.8345 4.16659V13.8206L6.91042 12.7442C7.23577 12.4186 7.76341 12.4185 8.08894 12.7438C8.41446 13.0692 8.4146 13.5968 8.08925 13.9224L5.59058 16.4224C5.43434 16.5787 5.22241 16.6665 5.00139 16.6666C4.78038 16.6666 4.56839 16.5789 4.41207 16.4227L1.91074 13.9227C1.58521 13.5973 1.58507 13.0697 1.91042 12.7442C2.23577 12.4186 2.76341 12.4185 3.08894 12.7438L4.16784 13.8222V4.16659C4.16784 3.70635 4.54093 3.33325 5.00117 3.33325Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M9.99984 4.99992C9.5396 4.99992 9.1665 5.37301 9.1665 5.83325C9.1665 6.29349 9.5396 6.66659 9.99984 6.66659H16.6665C17.1267 6.66659 17.4998 6.29349 17.4998 5.83325C17.4998 5.37301 17.1267 4.99992 16.6665 4.99992H9.99984Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M13.3332 13.3333C12.8729 13.3333 12.4998 13.7063 12.4998 14.1666C12.4998 14.6268 12.8729 14.9999 13.3332 14.9999H16.6665C17.1267 14.9999 17.4998 14.6268 17.4998 14.1666C17.4998 13.7063 17.1267 13.3333 16.6665 13.3333H13.3332Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M10.8332 9.99992C10.8332 9.53968 11.2063 9.16659 11.6665 9.16659H16.6665C17.1267 9.16659 17.4998 9.53968 17.4998 9.99992C17.4998 10.4602 17.1267 10.8333 16.6665 10.8333H11.6665C11.2063 10.8333 10.8332 10.4602 10.8332 9.99992Z", fill: "currentColor" })] }));
|
|
17287
17232
|
}
|
|
17288
|
-
function PhoneIcon({ size = "24", className, }) {
|
|
17289
|
-
return (jsxRuntime.jsx("svg", { className: className, xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 25 24", fill: "none", children: jsxRuntime.jsx("path", { d: "M10.5 19H14.5M8.5 22H16.5C17.6046 22 18.5 21.1046 18.5 20V4C18.5 2.89543 17.6046 2 16.5 2H8.5C7.39543 2 6.5 2.89543 6.5 4V20C6.5 21.1046 7.39543 22 8.5 22Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
17290
|
-
}
|
|
17291
|
-
function LaptopIcon({ size = "24", className, }) {
|
|
17292
|
-
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 25 24", fill: "none", className: className, children: [jsxRuntime.jsx("path", { d: "M4.5 6C4.5 4.89543 5.39543 4 6.5 4H18.5C19.6046 4 20.5 4.89543 20.5 6V15C20.5 15.5523 20.0523 16 19.5 16H5.5C4.94772 16 4.5 15.5523 4.5 15V6Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "square", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M2.5 16H22.5V18C22.5 19.1046 21.6046 20 20.5 20H4.5C3.39543 20 2.5 19.1046 2.5 18V16Z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "square", strokeLinejoin: "round" })] }));
|
|
17293
|
-
}
|
|
17294
|
-
function CopyIcon({ size = "20", className, }) {
|
|
17295
|
-
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 21 20", fill: "none", className: className, children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.16663 6.66666V3.54166C7.16663 2.50612 8.00609 1.66666 9.04163 1.66666H16.9583C17.9938 1.66666 18.8333 2.50612 18.8333 3.54166V11.4583C18.8333 12.4939 17.9938 13.3333 16.9583 13.3333H13.8333V16.4583C13.8333 17.4939 12.9938 18.3333 11.9583 18.3333H4.04163C3.00609 18.3333 2.16663 17.4939 2.16663 16.4583V8.54166C2.16663 7.50612 3.00609 6.66666 4.04163 6.66666H7.16663ZM9.04163 13.3333C8.00609 13.3333 7.16663 12.4939 7.16663 11.4583V8.33332H4.04163C3.92657 8.33332 3.83329 8.4266 3.83329 8.54166V16.4583C3.83329 16.5734 3.92657 16.6667 4.04163 16.6667H11.9583C12.0734 16.6667 12.1666 16.5734 12.1666 16.4583V13.3333H9.04163Z", fill: "currentColor" }) }));
|
|
17296
|
-
}
|
|
17297
|
-
function FileDownloadIcon({ size = "20", className, }) {
|
|
17298
|
-
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 21 20", fill: "none", children: [jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M6.33337 1.66666H10.5V5.83332C10.5 7.21404 11.6193 8.33332 13 8.33332H17.1667V15.8333C17.1667 17.214 16.0474 18.3333 14.6667 18.3333H6.33337C4.95266 18.3333 3.83337 17.214 3.83337 15.8333V4.16666C3.83337 2.78594 4.95266 1.66666 6.33337 1.66666ZM13.1726 14.3392L11.0893 16.4226C10.7639 16.748 10.2362 16.748 9.91079 16.4226L7.82745 14.3392C7.50201 14.0138 7.50201 13.4862 7.82745 13.1607C8.15289 12.8353 8.68053 12.8353 9.00596 13.1607L9.66671 13.8215V10.8333C9.66671 10.3731 10.0398 9.99999 10.5 9.99999C10.9603 9.99999 11.3334 10.3731 11.3334 10.8333V13.8215L11.9941 13.1607C12.3196 12.8353 12.8472 12.8353 13.1726 13.1607C13.4981 13.4862 13.4981 14.0138 13.1726 14.3392Z", fill: "currentColor" }), jsxRuntime.jsx("path", { d: "M12.1667 2.15481L16.6786 6.66666H13C12.5398 6.66666 12.1667 6.29356 12.1667 5.83332V2.15481Z", fill: "currentColor" })] }));
|
|
17299
|
-
}
|
|
17300
|
-
function CodeSolidSquareIcon({ size = "24", className, }) {
|
|
17301
|
-
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 25 24", fill: "none", className: className, children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.5 6C3.5 4.34315 4.84315 3 6.5 3H18.5C20.1569 3 21.5 4.34315 21.5 6V18C21.5 19.6569 20.1569 21 18.5 21H6.5C4.84315 21 3.5 19.6569 3.5 18V6ZM11.2071 8.79289C11.5976 9.18342 11.5976 9.81658 11.2071 10.2071L9.41421 12L11.2071 13.7929C11.5976 14.1834 11.5976 14.8166 11.2071 15.2071C10.8166 15.5976 10.1834 15.5976 9.79289 15.2071L8 13.4142C7.21895 12.6332 7.21895 11.3668 8 10.5858L9.79289 8.79289C10.1834 8.40237 10.8166 8.40237 11.2071 8.79289ZM15.2071 8.79289C14.8166 8.40237 14.1834 8.40237 13.7929 8.79289C13.4024 9.18342 13.4024 9.81658 13.7929 10.2071L15.5858 12L13.7929 13.7929C13.4024 14.1834 13.4024 14.8166 13.7929 15.2071C14.1834 15.5976 14.8166 15.5976 15.2071 15.2071L17 13.4142C17.781 12.6332 17.781 11.3668 17 10.5858L15.2071 8.79289Z", fill: "currentColor" }) }));
|
|
17302
|
-
}
|
|
17303
|
-
function CodeBracketsIcon({ size = "20", className, }) {
|
|
17304
|
-
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.8688 2.5249C12.3153 2.63652 12.5867 3.08896 12.4751 3.53546L9.14178 16.8688C9.03015 17.3153 8.57771 17.5868 8.13121 17.4752C7.68472 17.3635 7.41325 16.9111 7.52487 16.4646L10.8582 3.13123C10.9698 2.68474 11.4223 2.41327 11.8688 2.5249ZM5.58925 6.07746C5.91469 6.4029 5.91469 6.93053 5.58925 7.25597L3.43443 9.41079C3.10899 9.73623 3.10899 10.2639 3.43443 10.5893L5.58925 12.7441C5.91469 13.0696 5.91469 13.5972 5.58925 13.9226C5.26381 14.2481 4.73617 14.2481 4.41074 13.9226L2.25591 11.7678C1.2796 10.7915 1.27961 9.20859 2.25592 8.23228L4.41074 6.07746C4.73617 5.75202 5.26381 5.75202 5.58925 6.07746ZM14.4107 6.07746C14.7362 5.75202 15.2638 5.75202 15.5892 6.07746L17.7441 8.23228C18.7204 9.20859 18.7204 10.7915 17.7441 11.7678L15.5892 13.9226C15.2638 14.2481 14.7362 14.2481 14.4107 13.9226C14.0853 13.5972 14.0853 13.0696 14.4107 12.7441L16.5656 10.5893C16.891 10.2639 16.891 9.73623 16.5656 9.41079L14.4107 7.25597C14.0853 6.93053 14.0853 6.4029 14.4107 6.07746Z", fill: "currentColor" }) }));
|
|
17305
|
-
}
|
|
17306
|
-
function CommandIcon({ size = "22", className, }) {
|
|
17307
|
-
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 22 22", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M8 17V17C8 16.0219 8.28951 15.0657 8.83205 14.2519L13.1679 7.74808C13.7105 6.93427 14 5.97808 14 5V5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
17308
|
-
}
|
|
17309
17233
|
|
|
17310
17234
|
function FeeButton(_a) {
|
|
17311
17235
|
var { feeInUsd = "0", chipLabel = "Fee", className, tooltip } = _a, props = __rest$1(_a, ["feeInUsd", "chipLabel", "className", "tooltip"]);
|
|
@@ -17753,6 +17677,9 @@ const baseTailwindConfig = {
|
|
|
17753
17677
|
".highlight-adjacent:has(*:hover) .hide-on-parent-hover": {
|
|
17754
17678
|
opacity: "0",
|
|
17755
17679
|
},
|
|
17680
|
+
".h-d-screen": {
|
|
17681
|
+
height: "100dvh",
|
|
17682
|
+
},
|
|
17756
17683
|
});
|
|
17757
17684
|
}),
|
|
17758
17685
|
],
|
|
@@ -17890,9 +17817,8 @@ function NavigationBar(_a) {
|
|
|
17890
17817
|
: "tw-flex"), children: jsxRuntime.jsx(HeadingText, { size: "small", children: title }) })) : null] })));
|
|
17891
17818
|
}
|
|
17892
17819
|
|
|
17893
|
-
function PipeSeparator(
|
|
17894
|
-
|
|
17895
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn("tw-h-[0.8em] tw-w-[2px] tw-rounded-full tw-bg-[currentColor]", className) })));
|
|
17820
|
+
function PipeSeparator(props) {
|
|
17821
|
+
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn("tw-h-[0.8em] tw-w-[2px] tw-rounded-full tw-bg-[currentColor]", props.className) })));
|
|
17896
17822
|
}
|
|
17897
17823
|
|
|
17898
17824
|
function CollapsibleMenu({ children, menuRef, isOpen, transitionDuration, size, className, }) {
|
|
@@ -18725,69 +18651,6 @@ const useTimer = ({ immediateStart = true, }) => {
|
|
|
18725
18651
|
return { timer, stopTimer, startTimer };
|
|
18726
18652
|
};
|
|
18727
18653
|
|
|
18728
|
-
exports.ThemePreference = void 0;
|
|
18729
|
-
(function (ThemePreference) {
|
|
18730
|
-
ThemePreference["LIGHT"] = "light";
|
|
18731
|
-
ThemePreference["DARK"] = "dark";
|
|
18732
|
-
ThemePreference["SYSTEM"] = "system";
|
|
18733
|
-
})(exports.ThemePreference || (exports.ThemePreference = {}));
|
|
18734
|
-
const THEME_STORAGE_KEY = "__squid-app-theme-type__";
|
|
18735
|
-
const THEME_CHANGE_EVENT = "squid-app-theme-change";
|
|
18736
|
-
const THEME_MEDIA_QUERY = "(prefers-color-scheme: light)";
|
|
18737
|
-
function useUserTheme() {
|
|
18738
|
-
const [themePreference, setThemePreference] = React$1.useState(getInitialTheme);
|
|
18739
|
-
const [themeType, setThemeType] = React$1.useState(getEffectiveTheme(themePreference));
|
|
18740
|
-
React$1.useEffect(() => {
|
|
18741
|
-
const handleThemeChange = (e) => {
|
|
18742
|
-
setThemePreference(e.detail);
|
|
18743
|
-
};
|
|
18744
|
-
window.addEventListener(THEME_CHANGE_EVENT, handleThemeChange);
|
|
18745
|
-
return () => {
|
|
18746
|
-
window.removeEventListener(THEME_CHANGE_EVENT, handleThemeChange);
|
|
18747
|
-
};
|
|
18748
|
-
}, []);
|
|
18749
|
-
React$1.useEffect(() => {
|
|
18750
|
-
const mediaQuery = window.matchMedia(THEME_MEDIA_QUERY);
|
|
18751
|
-
const handleChange = () => {
|
|
18752
|
-
if (themePreference === exports.ThemePreference.SYSTEM) {
|
|
18753
|
-
setThemeType(mediaQuery.matches ? "light" : "dark");
|
|
18754
|
-
}
|
|
18755
|
-
};
|
|
18756
|
-
mediaQuery.addEventListener("change", handleChange);
|
|
18757
|
-
handleChange();
|
|
18758
|
-
return () => {
|
|
18759
|
-
mediaQuery.removeEventListener("change", handleChange);
|
|
18760
|
-
};
|
|
18761
|
-
}, [themePreference]);
|
|
18762
|
-
React$1.useEffect(() => {
|
|
18763
|
-
setThemeType(getEffectiveTheme(themePreference));
|
|
18764
|
-
}, [themePreference]);
|
|
18765
|
-
const setThemeManually = (theme) => {
|
|
18766
|
-
setThemePreference(theme);
|
|
18767
|
-
localStorage.setItem(THEME_STORAGE_KEY, theme);
|
|
18768
|
-
window.dispatchEvent(new CustomEvent(THEME_CHANGE_EVENT, { detail: theme }));
|
|
18769
|
-
};
|
|
18770
|
-
const isDarkMode = React$1.useMemo(() => themeType === "dark", [themeType]);
|
|
18771
|
-
return {
|
|
18772
|
-
themePreference,
|
|
18773
|
-
themeType,
|
|
18774
|
-
theme: isDarkMode ? darkTheme : lightTheme,
|
|
18775
|
-
setThemeManually,
|
|
18776
|
-
isDarkMode,
|
|
18777
|
-
};
|
|
18778
|
-
}
|
|
18779
|
-
function getInitialTheme() {
|
|
18780
|
-
var _a;
|
|
18781
|
-
if (typeof window === "undefined")
|
|
18782
|
-
return exports.ThemePreference.SYSTEM;
|
|
18783
|
-
return ((_a = localStorage.getItem(THEME_STORAGE_KEY)) !== null && _a !== void 0 ? _a : exports.ThemePreference.SYSTEM);
|
|
18784
|
-
}
|
|
18785
|
-
function getEffectiveTheme(themeType) {
|
|
18786
|
-
if (themeType !== exports.ThemePreference.SYSTEM)
|
|
18787
|
-
return themeType;
|
|
18788
|
-
return window.matchMedia(THEME_MEDIA_QUERY).matches ? "light" : "dark";
|
|
18789
|
-
}
|
|
18790
|
-
|
|
18791
18654
|
function BaseDropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, link, control, detail, isSelected, itemRef, children, contentRef, }) {
|
|
18792
18655
|
const ContentTag = link
|
|
18793
18656
|
? "a"
|
|
@@ -18880,7 +18743,7 @@ function ListItem(_a) {
|
|
|
18880
18743
|
});
|
|
18881
18744
|
return (jsxRuntime.jsxs("li", Object.assign({}, containerProps, { ref: itemRef, className: cn("tw-relative tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300 tw-highlight-adjacent", listItemSizeMap[size], extraPadding && "tw-px-squid-xs", compactOnMobile
|
|
18882
18745
|
? `${collapsedListItemClassMap[size]} mobile-lg:tw-w-full`
|
|
18883
|
-
: "tw-w-full", className), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "tw-bg-material-light-thin", isInteractive && "hover:tw-bg-material-light-thin"), children: [size === "large" ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon
|
|
18746
|
+
: "tw-w-full", className), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "tw-bg-material-light-thin", isInteractive && "hover:tw-bg-material-light-thin"), children: [size === "large" ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon || (jsxRuntime.jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, placeholderImageUrl: placeholderImageUrl, size: "md", rounded: rounded })) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon || (jsxRuntime.jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxRuntime.jsxs("div", { className: cn("tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs",
|
|
18884
18747
|
// 'large' variant has extra padding
|
|
18885
18748
|
size === "large" ? "tw-w-[56%] tw-pl-squid-xxs" : "tw-w-[67%]"), children: [typeof itemTitle === "string" ? (jsxRuntime.jsx(BodyText, { size: "small", className: cn("tw-max-w-full tw-truncate", subtitle && "tw-h-[17px] !tw-leading-[17px]", compactOnMobile ? "tw-hidden mobile-lg:tw-block" : "tw-block"), children: itemTitle })) : (itemTitle), size === "large" &&
|
|
18886
18749
|
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (loadingComponent()) : subtitle ? (jsxRuntime.jsxs(CaptionText, { className: subtitleClassName, children: [subtitleOnHover && (jsxRuntime.jsx(CaptionText, { className: cn(subtitleClassName, "tw-hidden group-hover/list-item:tw-block"), children: subtitleOnHover })), subtitle] })) : null)] }), showDetail && (jsxRuntime.jsxs(DetailTag, Object.assign({}, detailProps, { className: cn("tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs", size === "large" ? "tw-h-squid-xl" : "tw-h-squid-l", showDetailOnHoverOnly
|
|
@@ -18888,10 +18751,9 @@ function ListItem(_a) {
|
|
|
18888
18751
|
: "tw-flex", isDetailInteractive && "hover:tw-bg-material-light-thin", detailButtonClassName), children: [!!detail && (jsxRuntime.jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] })))] })), !!dropdownMenuContent && (jsxRuntime.jsx(ListItemActionsButton, { ref: openDropdownButtonRef, onClick: openDropdown, isActive: isDropdownOpen, className: "peer-hover/list-item:tw-opacity-100" })), isDropdownOpen && !!dropdownMenuContent ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef, isHidden: !dropdownStyles, className: cn(!!dropdownStyles &&
|
|
18889
18752
|
dropdownPositionClassMap$1[dropdownStyles.position]), dropdownRef: dropdownRef, children: dropdownMenuContent })) : null] })));
|
|
18890
18753
|
}
|
|
18891
|
-
const ListItemActionsButton = React$1.forwardRef((
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
: "tw-opacity-0", props.className), children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })));
|
|
18754
|
+
const ListItemActionsButton = React$1.forwardRef((_a, ref) => {
|
|
18755
|
+
var { isActive, className } = _a, props = __rest$1(_a, ["isActive", "className"]);
|
|
18756
|
+
return (jsxRuntime.jsx("button", Object.assign({}, props, { ref: ref, className: cn("tw-peer tw-absolute tw-right-squid-s tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-p-2 tw-text-grey-300 hover:tw-bg-material-light-thin hover:tw-opacity-100 focus-visible:tw-opacity-100", isActive ? "tw-bg-material-light-thin tw-opacity-100" : "tw-opacity-0", className), children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })));
|
|
18895
18757
|
});
|
|
18896
18758
|
|
|
18897
18759
|
const dropdownPositionClassMap = {
|
|
@@ -18939,7 +18801,7 @@ function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount,
|
|
|
18939
18801
|
onClick,
|
|
18940
18802
|
}
|
|
18941
18803
|
: {};
|
|
18942
|
-
return (jsxRuntime.jsxs("li", { ref: itemRef, className: cn("tw-relative tw-flex tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", !!dropdownMenuContent && "tw-highlight-adjacent"), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemTagProps, { className: cn("tw-group/history-item tw-peer/history-item tw-relative tw-flex tw-w-full tw-flex-shrink-0 tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", isInteractive && "hover:tw-bg-material-light-thin"), children: [jsxRuntime.jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [!!statusBadge[status].badge && (jsxRuntime.jsx("span", { className: cn("tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-10 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-overflow-hidden tw-rounded-full tw-border tw-border-grey-900 tw-p-0.5", statusBadge[status].containerClassName), children: statusBadge[status].badge })), jsxRuntime.jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsxRuntime.jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center", children: [jsxRuntime.jsx(CaptionText, { children: fromLabel }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronRightSmallIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toLabel })] }), jsxRuntime.jsx("div", { className: cn("tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs
|
|
18804
|
+
return (jsxRuntime.jsxs("li", { ref: itemRef, className: cn("tw-relative tw-flex tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", !!dropdownMenuContent && "tw-highlight-adjacent"), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemTagProps, { className: cn("tw-group/history-item tw-peer/history-item tw-relative tw-flex tw-w-full tw-flex-shrink-0 tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", isInteractive && "hover:tw-bg-material-light-thin"), children: [jsxRuntime.jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [!!statusBadge[status].badge && (jsxRuntime.jsx("span", { className: cn("tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-10 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-overflow-hidden tw-rounded-full tw-border tw-border-grey-900 tw-p-0.5", statusBadge[status].containerClassName), children: statusBadge[status].badge })), jsxRuntime.jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsxRuntime.jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center", children: [jsxRuntime.jsx(CaptionText, { children: fromLabel }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronRightSmallIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toLabel })] }), jsxRuntime.jsx("div", { className: cn("tw-hide-on-parent-hover tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", !!dropdownMenuContent &&
|
|
18943
18805
|
"tw-transition-opacity group-hover/history-item:tw-hidden group-hover/history-item:tw-opacity-0 peer-focus:tw-hidden peer-focus:tw-opacity-0", isDropdownOpen && "tw-opacity-0"), children: statusLabel })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx(BodyText, { size: "small", children: fromAmount }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(BodyText, { size: "small", children: toAmount })] })] })] })), !!dropdownMenuContent && (jsxRuntime.jsx(ListItemActionsButton, { ref: openDropdownButtonRef, onClick: openDropdown, isActive: isDropdownOpen, className: "peer-hover/history-item:tw-opacity-100" })), isDropdownOpen && !!dropdownMenuContent ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef, isHidden: !dropdownStyles, className: cn(!!dropdownStyles &&
|
|
18944
18806
|
dropdownPositionClassMap[dropdownStyles.position]), dropdownRef: dropdownRef, children: dropdownMenuContent })) : null] }));
|
|
18945
18807
|
}
|
|
@@ -19307,6 +19169,7 @@ const SwapStepsCollapsed = React$1.forwardRef((props, ref) => {
|
|
|
19307
19169
|
// show separator for all steps except the first one
|
|
19308
19170
|
showStepSeparator: index > 0, link: step.link, status: newStepIndex < index ? "pending" : step.status }, index))) }), jsxRuntime.jsx("footer", { className: "tw-flex tw-max-h-[55px] tw-min-h-[55px] tw-w-full tw-justify-center tw-gap-squid-xs tw-self-stretch tw-px-squid-s tw-pb-squid-s", children: jsxRuntime.jsx(Button$1, { size: "md", variant: "secondary", onClick: footerButton === null || footerButton === void 0 ? void 0 : footerButton.onClick, link: footerButton === null || footerButton === void 0 ? void 0 : footerButton.link, label: footerButton === null || footerButton === void 0 ? void 0 : footerButton.label, className: "tw-w-full", containerClassName: "tw-w-full" }) })] }) })] }) }) }));
|
|
19309
19171
|
});
|
|
19172
|
+
SwapStepsCollapsed.displayName = "SwapStepsCollapsed";
|
|
19310
19173
|
|
|
19311
19174
|
const WIDTH_SM = "69";
|
|
19312
19175
|
const HEIGHT_SM = "31";
|
|
@@ -25262,7 +25125,9 @@ function PopLayout(props) {
|
|
|
25262
25125
|
}
|
|
25263
25126
|
|
|
25264
25127
|
function Toast({ headerContent, actionsContent, description, chipLabel, title, }) {
|
|
25265
|
-
return (jsxRuntime.jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs",
|
|
25128
|
+
return (jsxRuntime.jsxs(Menu, { contentClassName: "tw-px-squid-m tw-pb-squid-s tw-pt-squid-xxs", contentWrapperProps: {
|
|
25129
|
+
className: "tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs",
|
|
25130
|
+
}, 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" }))] }));
|
|
25266
25131
|
}
|
|
25267
25132
|
|
|
25268
25133
|
var lib = {};
|
|
@@ -26376,10 +26241,7 @@ const tooltipThresholdPaddingMap = {
|
|
|
26376
26241
|
xl: "40px",
|
|
26377
26242
|
xxl: "60px",
|
|
26378
26243
|
};
|
|
26379
|
-
const TooltipContainer = (
|
|
26380
|
-
var { className } = _a, props = __rest$1(_a, ["className"]);
|
|
26381
|
-
return (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn("tw-relative", className) })));
|
|
26382
|
-
};
|
|
26244
|
+
const TooltipContainer = (props) => (jsxRuntime.jsx("div", Object.assign({}, props, { className: cn("tw-relative", props.className) })));
|
|
26383
26245
|
const TooltipTriggerWrapper = (_a) => {
|
|
26384
26246
|
var { elementRef } = _a, props = __rest$1(_a, ["elementRef"]);
|
|
26385
26247
|
return jsxRuntime.jsx("div", Object.assign({}, props, { ref: elementRef }));
|
|
@@ -26570,10 +26432,10 @@ function NumericInput(_a) {
|
|
|
26570
26432
|
}
|
|
26571
26433
|
}, [forcedAmount]);
|
|
26572
26434
|
const updateInputValue = React$1.useCallback((newValue) => {
|
|
26573
|
-
const safeNewValue = trimExtraDecimals(newValue, token.decimals);
|
|
26435
|
+
const safeNewValue = reactHooks.trimExtraDecimals(newValue, token.decimals);
|
|
26574
26436
|
const formattedAmount = userInputType === UserInputType.TOKEN
|
|
26575
26437
|
? safeNewValue
|
|
26576
|
-
: convertTokenAmountToUSD(safeNewValue, token.price, maxUsdDecimals);
|
|
26438
|
+
: reactHooks.convertTokenAmountToUSD(safeNewValue, token.price, maxUsdDecimals);
|
|
26577
26439
|
setInputValue(formattedAmount);
|
|
26578
26440
|
}, [userInputType, token.price, direction, token.decimals]);
|
|
26579
26441
|
const onBalanceButtonClick = React$1.useCallback(() => {
|
|
@@ -26586,7 +26448,7 @@ function NumericInput(_a) {
|
|
|
26586
26448
|
onAmountChange,
|
|
26587
26449
|
]);
|
|
26588
26450
|
const handleInputChange = (e) => {
|
|
26589
|
-
|
|
26451
|
+
const value = e.target.value.replace(/,/g, "."); // Replace commas with dots
|
|
26590
26452
|
const maxDecimalsForInputType = userInputType === UserInputType.TOKEN ? token.decimals : maxUsdDecimals;
|
|
26591
26453
|
const isValidAmount = new RegExp(`^\\d*\\.?\\d{0,${maxDecimalsForInputType}}$`).test(value);
|
|
26592
26454
|
if (isValidAmount) {
|
|
@@ -26607,8 +26469,8 @@ function NumericInput(_a) {
|
|
|
26607
26469
|
var _a;
|
|
26608
26470
|
if (inputValue !== "") {
|
|
26609
26471
|
const convertedAmount = userInputType === UserInputType.TOKEN
|
|
26610
|
-
? convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals)
|
|
26611
|
-
: convertUSDToTokenAmount(inputValue, token.price, token.decimals);
|
|
26472
|
+
? reactHooks.convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals)
|
|
26473
|
+
: reactHooks.convertUSDToTokenAmount(inputValue, token.price, token.decimals);
|
|
26612
26474
|
setInputValue(convertedAmount);
|
|
26613
26475
|
}
|
|
26614
26476
|
setUserInputType((prevMode) => prevMode === UserInputType.TOKEN
|
|
@@ -26625,7 +26487,7 @@ function NumericInput(_a) {
|
|
|
26625
26487
|
isUsdAmountVerySmall: false,
|
|
26626
26488
|
};
|
|
26627
26489
|
if (userInputType === UserInputType.TOKEN) {
|
|
26628
|
-
const usdRawAmount = convertTokenAmountToUSD(amount, token.price, maxUsdDecimals);
|
|
26490
|
+
const usdRawAmount = reactHooks.convertTokenAmountToUSD(amount, token.price, maxUsdDecimals);
|
|
26629
26491
|
const tokenRawAmount = amount;
|
|
26630
26492
|
const isTokenAmountVerySmall = !!tokenRawAmount &&
|
|
26631
26493
|
RegExpNonZeroValue.test(tokenRawAmount) &&
|
|
@@ -26642,7 +26504,7 @@ function NumericInput(_a) {
|
|
|
26642
26504
|
};
|
|
26643
26505
|
}
|
|
26644
26506
|
else {
|
|
26645
|
-
const tokenRawAmount = convertUSDToTokenAmount(amount, token.price, token.decimals);
|
|
26507
|
+
const tokenRawAmount = reactHooks.convertUSDToTokenAmount(amount, token.price, token.decimals);
|
|
26646
26508
|
const usdRawAmount = amount;
|
|
26647
26509
|
const isUsdAmountVerySmall = (!!usdRawAmount &&
|
|
26648
26510
|
RegExpNonZeroValue.test(usdRawAmount) &&
|
|
@@ -26666,14 +26528,18 @@ function NumericInput(_a) {
|
|
|
26666
26528
|
return "0";
|
|
26667
26529
|
if (userInputType === UserInputType.TOKEN) {
|
|
26668
26530
|
if (direction === "from") {
|
|
26669
|
-
return
|
|
26531
|
+
return reactHooks.formatUsdAmount(reactHooks.convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals), {
|
|
26532
|
+
includeSign: false,
|
|
26533
|
+
});
|
|
26670
26534
|
}
|
|
26671
26535
|
else {
|
|
26672
|
-
return
|
|
26536
|
+
return reactHooks.formatUsdAmount((_a = inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd) !== null && _a !== void 0 ? _a : "0", {
|
|
26537
|
+
includeSign: false,
|
|
26538
|
+
});
|
|
26673
26539
|
}
|
|
26674
26540
|
}
|
|
26675
26541
|
else {
|
|
26676
|
-
return
|
|
26542
|
+
return reactHooks.formatTokenAmount(reactHooks.convertUSDToTokenAmount(inputValue, token.price, token.decimals));
|
|
26677
26543
|
}
|
|
26678
26544
|
}, [
|
|
26679
26545
|
inputValue,
|
|
@@ -26690,7 +26556,7 @@ function NumericInput(_a) {
|
|
|
26690
26556
|
: "tw-text-grey-300";
|
|
26691
26557
|
const BalanceChipTag = balanceChipClickable ? "button" : "div";
|
|
26692
26558
|
const balanceFormatted = React$1.useMemo(() => {
|
|
26693
|
-
return
|
|
26559
|
+
return reactHooks.formatTokenAmount(balance !== null && balance !== void 0 ? balance : "0");
|
|
26694
26560
|
}, [balance]);
|
|
26695
26561
|
const containerClassname = "tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-px-squid-m tw-relative tw-h-[65px] mobile-sm-height:tw-h-[75px]";
|
|
26696
26562
|
const inputRef = React$1.useRef(null);
|
|
@@ -62092,7 +61958,7 @@ const getSwapProgressTitle = ({ fromToken, toToken, swapState, }) => {
|
|
|
62092
61958
|
return "Needs gas on destination";
|
|
62093
61959
|
}
|
|
62094
61960
|
};
|
|
62095
|
-
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, toAddressFormatted, }) => {
|
|
61961
|
+
const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, toAddressFormatted, refundTokenSymbol, }) => {
|
|
62096
61962
|
switch (swapState) {
|
|
62097
61963
|
case SwapState.CONFIRM: {
|
|
62098
61964
|
return "Authenticate the transaction in your wallet.";
|
|
@@ -62113,7 +61979,7 @@ const getSwapProgressDescriptions = ({ swapState, toAmount, toChain, toToken, to
|
|
|
62113
61979
|
return "You declined the transaction in your wallet.";
|
|
62114
61980
|
}
|
|
62115
61981
|
case SwapState.PARTIAL_SUCCESS: {
|
|
62116
|
-
return `You received a refund of
|
|
61982
|
+
return `You received a refund of ${refundTokenSymbol} to your wallet ${toAddressFormatted} on ${toChain === null || toChain === void 0 ? void 0 : toChain.networkName}.`;
|
|
62117
61983
|
}
|
|
62118
61984
|
case SwapState.NEEDS_GAS: {
|
|
62119
61985
|
return "Add gas to the transaction via Axelarscan to complete the swap";
|
|
@@ -62130,7 +61996,7 @@ const swapProgressButtonTexts = {
|
|
|
62130
61996
|
[SwapState.PARTIAL_SUCCESS]: "Cancel",
|
|
62131
61997
|
[SwapState.NEEDS_GAS]: "Go to Axelarscan",
|
|
62132
61998
|
};
|
|
62133
|
-
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }) {
|
|
61999
|
+
function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, }) {
|
|
62134
62000
|
const [showSwapInfoSection, setShowSwapInfoSection] = React$1.useState(true);
|
|
62135
62001
|
const isFirstRenderRef = React$1.useRef(true);
|
|
62136
62002
|
const { timer, stopTimer, startTimer } = useTimer({
|
|
@@ -62160,6 +62026,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
62160
62026
|
toChain,
|
|
62161
62027
|
toToken,
|
|
62162
62028
|
toAddressFormatted,
|
|
62029
|
+
refundTokenSymbol,
|
|
62163
62030
|
});
|
|
62164
62031
|
return {
|
|
62165
62032
|
headerTitle,
|
|
@@ -62465,10 +62332,9 @@ function blendColors(foreground, background) {
|
|
|
62465
62332
|
return rgbToHex(r, g, b);
|
|
62466
62333
|
}
|
|
62467
62334
|
|
|
62468
|
-
function
|
|
62469
|
-
var { theme = lightTheme, children, themeType = "light" } = _a, props = __rest$1(_a, ["theme", "children", "themeType"]);
|
|
62335
|
+
function SquidConfigProvider({ theme = lightTheme, children, themeType = "light", }) {
|
|
62470
62336
|
const parsedStyle = parseSquidTheme(theme);
|
|
62471
|
-
return (jsxRuntime.jsx("div",
|
|
62337
|
+
return (jsxRuntime.jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-h-d-screen tw-group tw-relative tw-flex tw-font-geist mobile-lg:tw-h-auto", children: children }));
|
|
62472
62338
|
}
|
|
62473
62339
|
|
|
62474
62340
|
exports.ActionLayout = ActionLayout;
|
|
@@ -62544,20 +62410,16 @@ exports.CircleX = CircleX;
|
|
|
62544
62410
|
exports.CircleXFilledIcon = CircleXFilledIcon;
|
|
62545
62411
|
exports.ClockOutlineIcon = ClockOutlineIcon;
|
|
62546
62412
|
exports.ClockSolidIcon = ClockSolidIcon;
|
|
62547
|
-
exports.CodeBracketsIcon = CodeBracketsIcon;
|
|
62548
|
-
exports.CodeSolidSquareIcon = CodeSolidSquareIcon;
|
|
62549
62413
|
exports.CoinsAddIcon = CoinsAddIcon;
|
|
62550
62414
|
exports.CoinsIcon = CoinsIcon;
|
|
62551
62415
|
exports.Collapse = Collapse;
|
|
62552
62416
|
exports.CollapsibleMenu = CollapsibleMenu;
|
|
62553
62417
|
exports.CollectionIcon = CollectionIcon;
|
|
62554
62418
|
exports.ColorPaletteIcon = ColorPaletteIcon;
|
|
62555
|
-
exports.CommandIcon = CommandIcon;
|
|
62556
62419
|
exports.CompassRoundOutlinedIcon = CompassRoundOutlinedIcon;
|
|
62557
62420
|
exports.CompassRoundSolidIcon = CompassRoundSolidIcon;
|
|
62558
62421
|
exports.ConsoleIcon = ConsoleIcon;
|
|
62559
62422
|
exports.Copy = Copy;
|
|
62560
|
-
exports.CopyIcon = CopyIcon;
|
|
62561
62423
|
exports.CrossAnimatedIcon = CrossAnimatedIcon;
|
|
62562
62424
|
exports.DashboardFast = DashboardFast;
|
|
62563
62425
|
exports.DescriptionBlocks = DescriptionBlocks;
|
|
@@ -62587,7 +62449,6 @@ exports.FeeButton = FeeButton;
|
|
|
62587
62449
|
exports.FeesAction = FeesAction;
|
|
62588
62450
|
exports.FeesLines = FeesLines;
|
|
62589
62451
|
exports.FeesTotal = FeesTotal;
|
|
62590
|
-
exports.FileDownloadIcon = FileDownloadIcon;
|
|
62591
62452
|
exports.FilledHeartIcon = FilledHeartIcon;
|
|
62592
62453
|
exports.FilterAscendingIcon = FilterAscendingIcon;
|
|
62593
62454
|
exports.FilterButton = FilterButton;
|
|
@@ -62616,7 +62477,6 @@ exports.InteractionHeader = InteractionHeader;
|
|
|
62616
62477
|
exports.InteractionProperties = InteractionProperties;
|
|
62617
62478
|
exports.InteractionTransactionView = InteractionTransactionView;
|
|
62618
62479
|
exports.Join = Join;
|
|
62619
|
-
exports.LaptopIcon = LaptopIcon;
|
|
62620
62480
|
exports.LightningIcon = LightningIcon;
|
|
62621
62481
|
exports.LimitIcon = LimitIcon;
|
|
62622
62482
|
exports.LinkIcon = LinkIcon;
|
|
@@ -62642,7 +62502,6 @@ exports.NotAllowedIcon = NotAllowedIcon;
|
|
|
62642
62502
|
exports.NumericInput = NumericInput;
|
|
62643
62503
|
exports.PathSquareIcon = PathSquareIcon;
|
|
62644
62504
|
exports.PercentIcon = PercentIcon;
|
|
62645
|
-
exports.PhoneIcon = PhoneIcon;
|
|
62646
62505
|
exports.PieChartIcon = PieChartIcon;
|
|
62647
62506
|
exports.PipeSeparator = PipeSeparator;
|
|
62648
62507
|
exports.PlusIcon = PlusIcon;
|
|
@@ -62681,13 +62540,13 @@ exports.SparklesIcon = SparklesIcon;
|
|
|
62681
62540
|
exports.SquareArrowCenter = SquareArrowCenter;
|
|
62682
62541
|
exports.SquareArrowTopLeftIcon = SquareArrowTopLeftIcon;
|
|
62683
62542
|
exports.SquareArrowTopRight2Icon = SquareArrowTopRight2Icon;
|
|
62543
|
+
exports.SquidConfigProvider = SquidConfigProvider;
|
|
62684
62544
|
exports.SquidLogo = SquidLogo;
|
|
62685
62545
|
exports.StakeAction = StakeAction;
|
|
62686
62546
|
exports.StartAction = StartAction;
|
|
62687
62547
|
exports.StocksIcon = StocksIcon;
|
|
62688
62548
|
exports.SuccessAction = SuccessAction;
|
|
62689
62549
|
exports.SunIcon = SunIcon;
|
|
62690
|
-
exports.SunOutlinedIcon = SunOutlinedIcon;
|
|
62691
62550
|
exports.SunriseIcon = SunriseIcon;
|
|
62692
62551
|
exports.SwapAction = SwapAction;
|
|
62693
62552
|
exports.SwapConfiguration = SwapConfiguration;
|
|
@@ -62709,7 +62568,6 @@ exports.Switch = Switch;
|
|
|
62709
62568
|
exports.TagIcon = TagIcon;
|
|
62710
62569
|
exports.TagIconFilled = TagIconFilled;
|
|
62711
62570
|
exports.TextSkeleton = TextSkeleton;
|
|
62712
|
-
exports.ThemeProvider = ThemeProvider;
|
|
62713
62571
|
exports.ThumbsUp = ThumbsUp;
|
|
62714
62572
|
exports.Tick = Tick;
|
|
62715
62573
|
exports.TimeFliesIcon = TimeFliesIcon;
|
|
@@ -62751,5 +62609,4 @@ exports.useMediaQuery = useMediaQuery;
|
|
|
62751
62609
|
exports.useOnResize = useOnResize;
|
|
62752
62610
|
exports.useRect = useRect;
|
|
62753
62611
|
exports.useTimer = useTimer;
|
|
62754
|
-
exports.useUserTheme = useUserTheme;
|
|
62755
62612
|
exports.useVersion = useVersion;
|
|
@@ -38,31 +38,3 @@ export declare function FilterTimelineIcon({ size, className, }: {
|
|
|
38
38
|
size?: string;
|
|
39
39
|
className?: string;
|
|
40
40
|
}): import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
export declare function PhoneIcon({ size, className, }: {
|
|
42
|
-
size?: string;
|
|
43
|
-
className?: string;
|
|
44
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
45
|
-
export declare function LaptopIcon({ size, className, }: {
|
|
46
|
-
size?: string;
|
|
47
|
-
className?: string;
|
|
48
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
49
|
-
export declare function CopyIcon({ size, className, }: {
|
|
50
|
-
size?: string;
|
|
51
|
-
className?: string;
|
|
52
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
export declare function FileDownloadIcon({ size, className, }: {
|
|
54
|
-
size?: string;
|
|
55
|
-
className?: string;
|
|
56
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
57
|
-
export declare function CodeSolidSquareIcon({ size, className, }: {
|
|
58
|
-
size?: string;
|
|
59
|
-
className?: string;
|
|
60
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
61
|
-
export declare function CodeBracketsIcon({ size, className, }: {
|
|
62
|
-
size?: string;
|
|
63
|
-
className?: string;
|
|
64
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
65
|
-
export declare function CommandIcon({ size, className, }: {
|
|
66
|
-
size?: string;
|
|
67
|
-
className?: string;
|
|
68
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,3 @@ export declare function MoonIcon({ size, className, }: {
|
|
|
10
10
|
size?: string;
|
|
11
11
|
className?: string;
|
|
12
12
|
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export declare function SunOutlinedIcon({ size, className, }: {
|
|
14
|
-
size?: string;
|
|
15
|
-
className?: string;
|
|
16
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
export declare function PipeSeparator(
|
|
2
|
+
export declare function PipeSeparator(props: ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,14 +3,13 @@ import { SwapStepsCollapsedFooterButton } from "../layout/SwapStepsCollapsed";
|
|
|
3
3
|
type ChainData = {
|
|
4
4
|
networkName: string;
|
|
5
5
|
logoUrl: string;
|
|
6
|
-
bgColor: string;
|
|
7
6
|
};
|
|
8
7
|
type Token = {
|
|
9
8
|
symbol: string;
|
|
10
9
|
logoUrl: string;
|
|
11
10
|
bgColor: string;
|
|
12
11
|
};
|
|
13
|
-
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, }: {
|
|
12
|
+
export declare function SwapProgressView({ steps, isOpen, handleClose, handleComplete, socialLink, supportLink, fromAmount, fromChain, fromToken, toAmount, toChain, toToken, fromAddressFormatted, toAddressFormatted, swapState, estimatedTimeToComplete, footerButton, refundTokenSymbol, }: {
|
|
14
13
|
steps: SwapStep[];
|
|
15
14
|
handleClose?: (swapState: SwapState) => void;
|
|
16
15
|
handleComplete?: () => void;
|
|
@@ -28,5 +27,6 @@ export declare function SwapProgressView({ steps, isOpen, handleClose, handleCom
|
|
|
28
27
|
swapState: SwapState;
|
|
29
28
|
estimatedTimeToComplete?: string;
|
|
30
29
|
footerButton?: SwapStepsCollapsedFooterButton;
|
|
30
|
+
refundTokenSymbol?: string;
|
|
31
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "../styles/compiled-tailwind.css";
|
|
3
|
+
import { ThemeType } from "../types/components";
|
|
4
|
+
import { SquidTheme } from "../types/config";
|
|
5
|
+
export declare function SquidConfigProvider({ theme, children, themeType, }: {
|
|
6
|
+
theme?: SquidTheme;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
themeType?: ThemeType;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./SquidConfigProvider";
|
|
@@ -13,11 +13,11 @@ export type DescriptionBlock = {
|
|
|
13
13
|
value: string;
|
|
14
14
|
rounded?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export interface SwapStep {
|
|
17
17
|
descriptionBlocks: DescriptionBlock[];
|
|
18
18
|
link?: string;
|
|
19
19
|
status: ActionStatus;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
export declare enum SwapState {
|
|
22
22
|
CONFIRM = 0,
|
|
23
23
|
PROGRESS = 1,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { SquidTheme } from "./config";
|
|
2
2
|
export * from "./utils";
|
|
3
|
-
export type { SwapState, ThemeType, SwapStep, HistoryItemStatus, ActionStatus, AssetsButtonVariant, } from "./components";
|
|
3
|
+
export type { SwapState, ThemeType, SwapStep, HistoryItemStatus, ActionStatus, AssetsButtonVariant, DescriptionBlock, } from "./components";
|