@0xsquid/ui 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +33 -24
- package/dist/cjs/types/components/buttons/index.d.ts +2 -0
- package/dist/cjs/types/components/controls/NumericInput.d.ts +3 -2
- package/dist/esm/index.js +33 -25
- package/dist/esm/types/components/buttons/index.d.ts +2 -0
- package/dist/esm/types/components/controls/NumericInput.d.ts +3 -2
- package/dist/index.d.ts +8 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -18578,7 +18578,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp
|
|
|
18578
18578
|
? walletButton === null || walletButton === void 0 ? void 0 : walletButton.address
|
|
18579
18579
|
: (_a = walletButton === null || walletButton === void 0 ? void 0 : walletButton.emptyAddressLabel) !== null && _a !== void 0 ? _a : 'Connect wallet' }), jsxRuntime.jsx(ChevronArrowIcon, { className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18580
18580
|
? 'tw-text-grey-600'
|
|
18581
|
-
: 'tw-text-royal-400' })] })] }))] }) })) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, Object.assign({}, assetsButton, { chain: chain, token: token, isLoading: isLoading })) }), isFetching && (jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-2 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsxRuntime.jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsxRuntime.jsx(NumericInput, { token: {
|
|
18581
|
+
: 'tw-text-royal-400' })] })] }))] }) })) }), jsxRuntime.jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsxRuntime.jsx(AssetsButton, Object.assign({}, assetsButton, { chain: chain, token: token, isLoading: isLoading })) }), isFetching && (jsxRuntime.jsx("div", { className: "tw-absolute tw-bottom-2 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsxRuntime.jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsxRuntime.jsx(NumericInput, { inputMode: "decimal", pattern: "[0-9.,]*", token: {
|
|
18582
18582
|
decimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18,
|
|
18583
18583
|
symbol: (_c = token === null || token === void 0 ? void 0 : token.symbol) !== null && _c !== void 0 ? _c : '',
|
|
18584
18584
|
price: tokenPrice,
|
|
@@ -25968,18 +25968,19 @@ const RegExpNonZeroValue = /[^0.]/;
|
|
|
25968
25968
|
const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
|
|
25969
25969
|
const notInteractiveChipClassName = 'tw-cursor-not-allowed';
|
|
25970
25970
|
const loadingClassName = 'tw-opacity-50';
|
|
25971
|
-
var
|
|
25972
|
-
(function (
|
|
25973
|
-
|
|
25974
|
-
|
|
25975
|
-
})(
|
|
25976
|
-
function NumericInput(
|
|
25977
|
-
|
|
25978
|
-
|
|
25979
|
-
|
|
25980
|
-
|
|
25971
|
+
var UserInputType;
|
|
25972
|
+
(function (UserInputType) {
|
|
25973
|
+
UserInputType[UserInputType["TOKEN"] = 0] = "TOKEN";
|
|
25974
|
+
UserInputType[UserInputType["USD"] = 1] = "USD";
|
|
25975
|
+
})(UserInputType || (UserInputType = {}));
|
|
25976
|
+
function NumericInput(_a) {
|
|
25977
|
+
var _b;
|
|
25978
|
+
var { priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
25979
|
+
token: '0.001',
|
|
25980
|
+
usd: '0.01',
|
|
25981
|
+
}, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton } = _a, props = __rest$1(_a, ["priceImpactPercentage", "balance", "error", "criticalPriceImpactPercentage", "token", "onAmountChange", "forcedAmount", "maxUsdDecimals", "formatIfVerySmall", "showDetails", "isLoading", "direction", "inputModeButton", "isInteractive", "balanceButton"]);
|
|
25981
25982
|
const [inputValue, setInputValue] = React$1.useState('');
|
|
25982
|
-
const [
|
|
25983
|
+
const [userInputType, setUserInputType] = React$1.useState(UserInputType.TOKEN);
|
|
25983
25984
|
const balanceChipClickable = isInteractive && parseFloat(balance) > 0;
|
|
25984
25985
|
React$1.useEffect(() => {
|
|
25985
25986
|
if (forcedAmount !== undefined) {
|
|
@@ -25988,11 +25989,11 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
25988
25989
|
}, [forcedAmount]);
|
|
25989
25990
|
const updateInputValue = React$1.useCallback((newValue) => {
|
|
25990
25991
|
const safeNewValue = trimExtraDecimals(newValue, token.decimals);
|
|
25991
|
-
const formattedAmount =
|
|
25992
|
+
const formattedAmount = userInputType === UserInputType.TOKEN
|
|
25992
25993
|
? safeNewValue
|
|
25993
25994
|
: convertTokenAmountToUSD(safeNewValue, token.price, maxUsdDecimals);
|
|
25994
25995
|
setInputValue(formattedAmount);
|
|
25995
|
-
}, [
|
|
25996
|
+
}, [userInputType, token.price, direction, token.decimals]);
|
|
25996
25997
|
const onBalanceButtonClick = React$1.useCallback(() => {
|
|
25997
25998
|
if (balanceChipClickable) {
|
|
25998
25999
|
updateInputValue(balance);
|
|
@@ -26004,7 +26005,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26004
26005
|
]);
|
|
26005
26006
|
const handleInputChange = (e) => {
|
|
26006
26007
|
let value = e.target.value.replace(/,/g, '.'); // Replace commas with dots
|
|
26007
|
-
const maxDecimalsForInputType =
|
|
26008
|
+
const maxDecimalsForInputType = userInputType === UserInputType.TOKEN ? token.decimals : maxUsdDecimals;
|
|
26008
26009
|
const isValidAmount = new RegExp(`^\\d*\\.?\\d{0,${maxDecimalsForInputType}}$`).test(value);
|
|
26009
26010
|
if (isValidAmount) {
|
|
26010
26011
|
setInputValue(value);
|
|
@@ -26023,12 +26024,14 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26023
26024
|
const handleSwitchInputMode = () => {
|
|
26024
26025
|
var _a;
|
|
26025
26026
|
if (inputValue !== '') {
|
|
26026
|
-
const convertedAmount =
|
|
26027
|
+
const convertedAmount = userInputType === UserInputType.TOKEN
|
|
26027
26028
|
? convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals)
|
|
26028
26029
|
: convertUSDToTokenAmount(inputValue, token.price, token.decimals);
|
|
26029
26030
|
setInputValue(convertedAmount);
|
|
26030
26031
|
}
|
|
26031
|
-
|
|
26032
|
+
setUserInputType((prevMode) => prevMode === UserInputType.TOKEN
|
|
26033
|
+
? UserInputType.USD
|
|
26034
|
+
: UserInputType.TOKEN);
|
|
26032
26035
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
26033
26036
|
};
|
|
26034
26037
|
const getRawAmounts = (amount) => {
|
|
@@ -26039,7 +26042,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26039
26042
|
isTokenAmountVerySmall: false,
|
|
26040
26043
|
isUsdAmountVerySmall: false,
|
|
26041
26044
|
};
|
|
26042
|
-
if (
|
|
26045
|
+
if (userInputType === UserInputType.TOKEN) {
|
|
26043
26046
|
const usdRawAmount = convertTokenAmountToUSD(amount, token.price, maxUsdDecimals);
|
|
26044
26047
|
const tokenRawAmount = amount;
|
|
26045
26048
|
const isTokenAmountVerySmall = !!tokenRawAmount &&
|
|
@@ -26079,7 +26082,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26079
26082
|
var _a;
|
|
26080
26083
|
if (isNaN(Number(inputValue)) || inputValue === '')
|
|
26081
26084
|
return '0';
|
|
26082
|
-
if (
|
|
26085
|
+
if (userInputType === UserInputType.TOKEN) {
|
|
26083
26086
|
if (direction === 'from') {
|
|
26084
26087
|
return formatAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals));
|
|
26085
26088
|
}
|
|
@@ -26092,13 +26095,13 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26092
26095
|
}
|
|
26093
26096
|
}, [
|
|
26094
26097
|
inputValue,
|
|
26095
|
-
|
|
26098
|
+
userInputType,
|
|
26096
26099
|
token.price,
|
|
26097
26100
|
direction,
|
|
26098
26101
|
inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd,
|
|
26099
26102
|
]);
|
|
26100
26103
|
const AmountChip = isInteractive ? 'button' : 'div';
|
|
26101
|
-
const priceImpactClass = ((
|
|
26104
|
+
const priceImpactClass = ((_b = Number(priceImpactPercentage)) !== null && _b !== void 0 ? _b : 0) > Number(criticalPriceImpactPercentage)
|
|
26102
26105
|
? 'tw-text-status-negative'
|
|
26103
26106
|
: 'tw-text-grey-300';
|
|
26104
26107
|
const BalanceChipTag = balanceChipClickable ? 'button' : 'div';
|
|
@@ -26109,13 +26112,13 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26109
26112
|
const inputRef = React$1.useRef(null);
|
|
26110
26113
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isInteractive && !isLoading ? (jsxRuntime.jsxs("form", { className: containerClassname, onSubmit: (e) => {
|
|
26111
26114
|
e.preventDefault();
|
|
26112
|
-
}, children: [
|
|
26115
|
+
}, children: [userInputType === UserInputType.USD && (jsxRuntime.jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsxRuntime.jsx("input", Object.assign({ ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', userInputType === UserInputType.USD && 'tw-pl-[33px]') }, props))] })) : (jsxRuntime.jsx("div", { className: cn(containerClassname, (isLoading || Number(inputValue || 0) === 0) && loadingClassName), children: jsxRuntime.jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300 mobile-sm-height:tw-h-[65px]", children: jsxRuntime.jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxRuntime.jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: [error ? (jsxRuntime.jsx("div", { className: "tw-px-squid-xs", children: jsxRuntime.jsx(ErrorMessage, { message: error.message }) })) : (jsxRuntime.jsx(Tooltip, Object.assign({}, (isLoading
|
|
26113
26116
|
? undefined
|
|
26114
|
-
:
|
|
26117
|
+
: userInputType === UserInputType.TOKEN
|
|
26115
26118
|
? inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.tokenModeTooltip
|
|
26116
26119
|
: inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.usdModeTooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxRuntime.jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive
|
|
26117
26120
|
? interactiveChipClassName
|
|
26118
|
-
: notInteractiveChipClassName), children: [jsxRuntime.jsx(SwapInputsIcon, {}),
|
|
26121
|
+
: notInteractiveChipClassName), children: [jsxRuntime.jsx(SwapInputsIcon, {}), userInputType === UserInputType.TOKEN ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxRuntime.jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsxRuntime.jsx(CaptionText, { children: isUsdAmountVerySmall
|
|
26119
26122
|
? formatIfVerySmall.token
|
|
26120
26123
|
: amountFormatted })] }) })) : (jsxRuntime.jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsxRuntime.jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
26121
26124
|
? formatIfVerySmall.token
|
|
@@ -26418,6 +26421,11 @@ function SettingsButton({ label, isSelected = false, onClick, }) {
|
|
|
26418
26421
|
return (jsxRuntime.jsx("button", { onClick: onClick, className: cn('tw-flex tw-h-[30px] tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs -tw-outline-offset-2 hover:tw-bg-material-light-thin', isSelected && 'tw-outline tw-outline-2 tw-outline-royal-500'), children: jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
26419
26422
|
}
|
|
26420
26423
|
|
|
26424
|
+
const IconButton = (_a) => {
|
|
26425
|
+
var { icon } = _a, props = __rest$1(_a, ["icon"]);
|
|
26426
|
+
return (jsxRuntime.jsx("button", Object.assign({}, props, { className: cn('tw-flex tw-h-8 tw-w-8 tw-min-w-8 tw-items-center tw-justify-center tw-rounded-squid-xs hover:tw-bg-material-light-thin', props.disabled ? 'tw-text-grey-600' : 'tw-text-grey-300', props.className), children: icon })));
|
|
26427
|
+
};
|
|
26428
|
+
|
|
26421
26429
|
function ArrowRotate() {
|
|
26422
26430
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none", viewBox: "0 0 16 16", children: jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "M3.333 2.667v2c0 .368.299.666.667.666h1.833m6.841 8v-2a.667.667 0 00-.666-.666h-2M2.667 8A5.333 5.333 0 008 13.333c1.757 0 3.353-.85 4.333-2.161m1-3.172A5.333 5.333 0 008 2.667c-1.758 0-3.354.85-4.333 2.161" }) }));
|
|
26423
26431
|
}
|
|
@@ -62171,6 +62179,7 @@ exports.HeartSmallIcon = HeartSmallIcon;
|
|
|
62171
62179
|
exports.HelpIcon = HelpIcon;
|
|
62172
62180
|
exports.HistoryItem = HistoryItem;
|
|
62173
62181
|
exports.HomeIcon = HomeIcon;
|
|
62182
|
+
exports.IconButton = IconButton;
|
|
62174
62183
|
exports.IconLabel = IconLabel;
|
|
62175
62184
|
exports.ImageIcon = ImageIcon;
|
|
62176
62185
|
exports.ImageSparkle = ImageSparkle;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SwapDirection } from '../../types/components';
|
|
2
3
|
import { TooltipProps } from './Tooltip';
|
|
3
4
|
interface Token {
|
|
@@ -5,7 +6,7 @@ interface Token {
|
|
|
5
6
|
symbol: string;
|
|
6
7
|
decimals: number;
|
|
7
8
|
}
|
|
8
|
-
interface NumericInputProps {
|
|
9
|
+
interface NumericInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
9
10
|
token: Token;
|
|
10
11
|
onAmountChange: (tokenAmount: string) => void;
|
|
11
12
|
forcedAmount?: string;
|
|
@@ -33,5 +34,5 @@ interface NumericInputProps {
|
|
|
33
34
|
tooltip?: Omit<TooltipProps, 'children'>;
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, ...props }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
37
38
|
export {};
|
package/dist/esm/index.js
CHANGED
|
@@ -18558,7 +18558,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp
|
|
|
18558
18558
|
? walletButton === null || walletButton === void 0 ? void 0 : walletButton.address
|
|
18559
18559
|
: (_a = walletButton === null || walletButton === void 0 ? void 0 : walletButton.emptyAddressLabel) !== null && _a !== void 0 ? _a : 'Connect wallet' }), jsx(ChevronArrowIcon, { className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
18560
18560
|
? 'tw-text-grey-600'
|
|
18561
|
-
: 'tw-text-royal-400' })] })] }))] }) })) }), jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsx(AssetsButton, Object.assign({}, assetsButton, { chain: chain, token: token, isLoading: isLoading })) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-2 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
|
|
18561
|
+
: 'tw-text-royal-400' })] })] }))] }) })) }), jsx("div", { className: "tw-px-squid-m mobile-lg:tw-px-squid-l", children: jsx(AssetsButton, Object.assign({}, assetsButton, { chain: chain, token: token, isLoading: isLoading })) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-2 tw-left-squid-m tw-z-10 tw-overflow-hidden mobile-lg:tw-left-squid-l", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { inputMode: "decimal", pattern: "[0-9.,]*", token: {
|
|
18562
18562
|
decimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18,
|
|
18563
18563
|
symbol: (_c = token === null || token === void 0 ? void 0 : token.symbol) !== null && _c !== void 0 ? _c : '',
|
|
18564
18564
|
price: tokenPrice,
|
|
@@ -25948,18 +25948,19 @@ const RegExpNonZeroValue = /[^0.]/;
|
|
|
25948
25948
|
const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
|
|
25949
25949
|
const notInteractiveChipClassName = 'tw-cursor-not-allowed';
|
|
25950
25950
|
const loadingClassName = 'tw-opacity-50';
|
|
25951
|
-
var
|
|
25952
|
-
(function (
|
|
25953
|
-
|
|
25954
|
-
|
|
25955
|
-
})(
|
|
25956
|
-
function NumericInput(
|
|
25957
|
-
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
|
|
25951
|
+
var UserInputType;
|
|
25952
|
+
(function (UserInputType) {
|
|
25953
|
+
UserInputType[UserInputType["TOKEN"] = 0] = "TOKEN";
|
|
25954
|
+
UserInputType[UserInputType["USD"] = 1] = "USD";
|
|
25955
|
+
})(UserInputType || (UserInputType = {}));
|
|
25956
|
+
function NumericInput(_a) {
|
|
25957
|
+
var _b;
|
|
25958
|
+
var { priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
25959
|
+
token: '0.001',
|
|
25960
|
+
usd: '0.01',
|
|
25961
|
+
}, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton } = _a, props = __rest$1(_a, ["priceImpactPercentage", "balance", "error", "criticalPriceImpactPercentage", "token", "onAmountChange", "forcedAmount", "maxUsdDecimals", "formatIfVerySmall", "showDetails", "isLoading", "direction", "inputModeButton", "isInteractive", "balanceButton"]);
|
|
25961
25962
|
const [inputValue, setInputValue] = useState('');
|
|
25962
|
-
const [
|
|
25963
|
+
const [userInputType, setUserInputType] = useState(UserInputType.TOKEN);
|
|
25963
25964
|
const balanceChipClickable = isInteractive && parseFloat(balance) > 0;
|
|
25964
25965
|
useEffect(() => {
|
|
25965
25966
|
if (forcedAmount !== undefined) {
|
|
@@ -25968,11 +25969,11 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
25968
25969
|
}, [forcedAmount]);
|
|
25969
25970
|
const updateInputValue = useCallback((newValue) => {
|
|
25970
25971
|
const safeNewValue = trimExtraDecimals(newValue, token.decimals);
|
|
25971
|
-
const formattedAmount =
|
|
25972
|
+
const formattedAmount = userInputType === UserInputType.TOKEN
|
|
25972
25973
|
? safeNewValue
|
|
25973
25974
|
: convertTokenAmountToUSD(safeNewValue, token.price, maxUsdDecimals);
|
|
25974
25975
|
setInputValue(formattedAmount);
|
|
25975
|
-
}, [
|
|
25976
|
+
}, [userInputType, token.price, direction, token.decimals]);
|
|
25976
25977
|
const onBalanceButtonClick = useCallback(() => {
|
|
25977
25978
|
if (balanceChipClickable) {
|
|
25978
25979
|
updateInputValue(balance);
|
|
@@ -25984,7 +25985,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
25984
25985
|
]);
|
|
25985
25986
|
const handleInputChange = (e) => {
|
|
25986
25987
|
let value = e.target.value.replace(/,/g, '.'); // Replace commas with dots
|
|
25987
|
-
const maxDecimalsForInputType =
|
|
25988
|
+
const maxDecimalsForInputType = userInputType === UserInputType.TOKEN ? token.decimals : maxUsdDecimals;
|
|
25988
25989
|
const isValidAmount = new RegExp(`^\\d*\\.?\\d{0,${maxDecimalsForInputType}}$`).test(value);
|
|
25989
25990
|
if (isValidAmount) {
|
|
25990
25991
|
setInputValue(value);
|
|
@@ -26003,12 +26004,14 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26003
26004
|
const handleSwitchInputMode = () => {
|
|
26004
26005
|
var _a;
|
|
26005
26006
|
if (inputValue !== '') {
|
|
26006
|
-
const convertedAmount =
|
|
26007
|
+
const convertedAmount = userInputType === UserInputType.TOKEN
|
|
26007
26008
|
? convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals)
|
|
26008
26009
|
: convertUSDToTokenAmount(inputValue, token.price, token.decimals);
|
|
26009
26010
|
setInputValue(convertedAmount);
|
|
26010
26011
|
}
|
|
26011
|
-
|
|
26012
|
+
setUserInputType((prevMode) => prevMode === UserInputType.TOKEN
|
|
26013
|
+
? UserInputType.USD
|
|
26014
|
+
: UserInputType.TOKEN);
|
|
26012
26015
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
26013
26016
|
};
|
|
26014
26017
|
const getRawAmounts = (amount) => {
|
|
@@ -26019,7 +26022,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26019
26022
|
isTokenAmountVerySmall: false,
|
|
26020
26023
|
isUsdAmountVerySmall: false,
|
|
26021
26024
|
};
|
|
26022
|
-
if (
|
|
26025
|
+
if (userInputType === UserInputType.TOKEN) {
|
|
26023
26026
|
const usdRawAmount = convertTokenAmountToUSD(amount, token.price, maxUsdDecimals);
|
|
26024
26027
|
const tokenRawAmount = amount;
|
|
26025
26028
|
const isTokenAmountVerySmall = !!tokenRawAmount &&
|
|
@@ -26059,7 +26062,7 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26059
26062
|
var _a;
|
|
26060
26063
|
if (isNaN(Number(inputValue)) || inputValue === '')
|
|
26061
26064
|
return '0';
|
|
26062
|
-
if (
|
|
26065
|
+
if (userInputType === UserInputType.TOKEN) {
|
|
26063
26066
|
if (direction === 'from') {
|
|
26064
26067
|
return formatAmount(convertTokenAmountToUSD(inputValue, token.price, maxUsdDecimals));
|
|
26065
26068
|
}
|
|
@@ -26072,13 +26075,13 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26072
26075
|
}
|
|
26073
26076
|
}, [
|
|
26074
26077
|
inputValue,
|
|
26075
|
-
|
|
26078
|
+
userInputType,
|
|
26076
26079
|
token.price,
|
|
26077
26080
|
direction,
|
|
26078
26081
|
inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.amountUsd,
|
|
26079
26082
|
]);
|
|
26080
26083
|
const AmountChip = isInteractive ? 'button' : 'div';
|
|
26081
|
-
const priceImpactClass = ((
|
|
26084
|
+
const priceImpactClass = ((_b = Number(priceImpactPercentage)) !== null && _b !== void 0 ? _b : 0) > Number(criticalPriceImpactPercentage)
|
|
26082
26085
|
? 'tw-text-status-negative'
|
|
26083
26086
|
: 'tw-text-grey-300';
|
|
26084
26087
|
const BalanceChipTag = balanceChipClickable ? 'button' : 'div';
|
|
@@ -26089,13 +26092,13 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
26089
26092
|
const inputRef = useRef(null);
|
|
26090
26093
|
return (jsxs(Fragment, { children: [isInteractive && !isLoading ? (jsxs("form", { className: containerClassname, onSubmit: (e) => {
|
|
26091
26094
|
e.preventDefault();
|
|
26092
|
-
}, children: [
|
|
26095
|
+
}, children: [userInputType === UserInputType.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", Object.assign({ ref: inputRef, type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', userInputType === UserInputType.USD && 'tw-pl-[33px]') }, props))] })) : (jsx("div", { className: cn(containerClassname, (isLoading || Number(inputValue || 0) === 0) && loadingClassName), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300 mobile-sm-height:tw-h-[65px]", children: jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m', isLoading && loadingClassName), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsx(Tooltip, Object.assign({}, (isLoading
|
|
26093
26096
|
? undefined
|
|
26094
|
-
:
|
|
26097
|
+
: userInputType === UserInputType.TOKEN
|
|
26095
26098
|
? inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.tokenModeTooltip
|
|
26096
26099
|
: inputModeButton === null || inputModeButton === void 0 ? void 0 : inputModeButton.usdModeTooltip), { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive
|
|
26097
26100
|
? interactiveChipClassName
|
|
26098
|
-
: notInteractiveChipClassName), children: [jsx(SwapInputsIcon, {}),
|
|
26101
|
+
: notInteractiveChipClassName), children: [jsx(SwapInputsIcon, {}), userInputType === UserInputType.TOKEN ? (jsx(Fragment, { children: jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsx(CaptionText, { children: isUsdAmountVerySmall
|
|
26099
26102
|
? formatIfVerySmall.token
|
|
26100
26103
|
: amountFormatted })] }) })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
26101
26104
|
? formatIfVerySmall.token
|
|
@@ -26398,6 +26401,11 @@ function SettingsButton({ label, isSelected = false, onClick, }) {
|
|
|
26398
26401
|
return (jsx("button", { onClick: onClick, className: cn('tw-flex tw-h-[30px] tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs -tw-outline-offset-2 hover:tw-bg-material-light-thin', isSelected && 'tw-outline tw-outline-2 tw-outline-royal-500'), children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
26399
26402
|
}
|
|
26400
26403
|
|
|
26404
|
+
const IconButton = (_a) => {
|
|
26405
|
+
var { icon } = _a, props = __rest$1(_a, ["icon"]);
|
|
26406
|
+
return (jsx("button", Object.assign({}, props, { className: cn('tw-flex tw-h-8 tw-w-8 tw-min-w-8 tw-items-center tw-justify-center tw-rounded-squid-xs hover:tw-bg-material-light-thin', props.disabled ? 'tw-text-grey-600' : 'tw-text-grey-300', props.className), children: icon })));
|
|
26407
|
+
};
|
|
26408
|
+
|
|
26401
26409
|
function ArrowRotate() {
|
|
26402
26410
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none", viewBox: "0 0 16 16", children: jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "M3.333 2.667v2c0 .368.299.666.667.666h1.833m6.841 8v-2a.667.667 0 00-.666-.666h-2M2.667 8A5.333 5.333 0 008 13.333c1.757 0 3.353-.85 4.333-2.161m1-3.172A5.333 5.333 0 008 2.667c-1.758 0-3.354.85-4.333 2.161" }) }));
|
|
26403
26411
|
}
|
|
@@ -62037,4 +62045,4 @@ function SquidConfigProvider({ theme = lightTheme, children, themeType = 'light'
|
|
|
62037
62045
|
return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-h-screen tw-font-geist mobile-lg:tw-h-auto", children: children }));
|
|
62038
62046
|
}
|
|
62039
62047
|
|
|
62040
|
-
export { ActionLayout, ActionLineOutRow, ActionProperties, ActionRow, ActionStatusRow, ActionWrapper, AddressButton, AnimationWrapper, AppContainer, Approve, ApproveAction, ArrowBottomTopIcon, ArrowButton, ArrowCornerDownRightIcon, ArrowLeftIcon, ArrowOutOfBoxIcon, ArrowRightDownCircleIcon, ArrowRightDownIcon, ArrowRightIcon, ArrowRightUpCircleIcon, ArrowRightUpIcon, ArrowRotate, ArrowTriangle, ArrowUpIcon, ArrowWallDownIcon, ArrowsSwapIcon, AssetsButton, AssetsView, BackpackIcon, BadgeImage, BankIcon, BlockSkeleton, BodyText, Boost, BoostBadge, BoostButton, BorderedContainer, Breadcrumb, BridgeAction, BridgeHeader, BridgeProperties, BridgeTransactionView, BrokenHeartIcon, BubblesIcon, Button$1 as Button, BuyNFTHeader, BuyNFTProperties, BuyNFTTransactionView, CSS_VARS, Calendar, CaptionText, ChainLink, Checkmark1Icon, Checkmark2Icon, ChevronArrowIcon, ChevronGrabberVerticalIcon, ChevronLargeDownIcon, ChevronLargeRightIcon, ChevronRightSmallIcon, ChevronTopIcon, ChevronTopSmallIcon, Chip, CircleMinusIcon, CirclePlusIcon, CircleX, CircleXFilledIcon, ClockIcon, ClockOutlineIcon, CoinsAddIcon, CoinsIcon, Collapse, CollapsibleMenu, CollectionIcon, ColorPaletteIcon, CompassRound, ConsoleIcon, Copy, CrossAnimatedIcon, DashboardFast, DescriptionBlocks, DetailsToolbar, DiscordIcon, DockIconAnalytics, DockIconCheckout, DockIconHelp, DockIconProfile, DockIconScan, DockIconSwap, DockSwapIcon, Dollar, DotGrid1x3HorizontalIcon, DropdownMenu, DropdownMenuItem, EmojiMeh, EmojiSadIcon, EmptyHeartIcon, ErrorMessage, EthereumIcon, ExplosionIcon, FeeButton, FeesAction, FeesLines, FeesTotal, FilledHeartIcon, FilterButton, FilterIcon, GasIcon, GithubIcon, HashLink, HeadingText, HeartSmallIcon, HelpIcon, HistoryItem, HomeIcon, IconLabel, ImageIcon, ImageSparkle, IncompleteAction, InfinityIcon, InfoBox, Inline, Input, InteractionHeader, InteractionProperties, InteractionTransactionView, Join, LightningIcon, LinkIcon, List, ListItem, Loader, LoadingProvider, LoadingSkeleton, MEDIA_QUERIES, MainView, MaxIcon, Menu, MenuItem, MenuSwapIcon, MirrorIcon, Modal, ModalContent, ModalContentDivider, MoonIcon, NavigationBar, NotAllowedIcon, NumericInput, PathSquareIcon, PercentIcon, PieChartIcon, PipeSeparator, PlusIcon, PowerIcon, ProductCard, ProfileHeader, ProfileHeaderBackground, PropertiesLayout, PropertyListItem, PunkIcon, RangeInput, ReceiptBillIcon, ReceiveNFTAction, ReceiveTokensAction, RecipientView, RefreshIcon, ReorderIcon, STEP_ITEM_HEIGHT, SearchIcon, SectionTitle, SendTokensAction, SettingsButton, SettingsGearIcon, SettingsItem, SettingsSlider, ShoppingBagIcon, SizeTransition, SmileIcon, SnapIcon, SortIcon, SparkleIcon, SparklesIcon, SquareArrowCenter, SquareArrowTopLeftIcon, SquareArrowTopRight2Icon, SquidConfigProvider, SquidLogo, StakeAction, StartAction, StocksIcon, SuccessAction, SunIcon, SunriseIcon, SwapAction, SwapConfiguration, SwapDetailsView, SwapErrorIcon, SwapHeader, SwapIcon, SwapInputsIcon, SwapProgressView, SwapProgressViewHeader, SwapProperties, SwapStepItem, SwapStepSeparator, SwapStepsCollapsed, SwapSuccessIcon, SwapTransactionView, SwapWarningIcon, Switch, TagIcon, TagIconFilled, TextSkeleton, ThumbsUp, Tick, TimeFliesIcon, Timeline, Timestamp, Toast, TokenPair, Tooltip, TradingViewStepsIcon, TransactionAction, TransactionFilters, TransactionHeader, TransactionHeaderLayout, TransactionItem, TransactionProperties, TransactionSearch, TransactionState, TransactionView, TransactionViewLayout, Transfer, TranslateIcon, TriangleExclamation, UsdAmount, WalletFilledIcon, WalletIcon, WalletLink, WalletsView, WrapAction, XSocial, baseTailwindConfig, cn, darkTheme, lightTheme, linkActionTimelineProps, statusTextClassMap, useCollapsibleMenu, useDropdownMenu, useMediaQuery, useOnResize, useRect, useTimer, useVersion };
|
|
62048
|
+
export { ActionLayout, ActionLineOutRow, ActionProperties, ActionRow, ActionStatusRow, ActionWrapper, AddressButton, AnimationWrapper, AppContainer, Approve, ApproveAction, ArrowBottomTopIcon, ArrowButton, ArrowCornerDownRightIcon, ArrowLeftIcon, ArrowOutOfBoxIcon, ArrowRightDownCircleIcon, ArrowRightDownIcon, ArrowRightIcon, ArrowRightUpCircleIcon, ArrowRightUpIcon, ArrowRotate, ArrowTriangle, ArrowUpIcon, ArrowWallDownIcon, ArrowsSwapIcon, AssetsButton, AssetsView, BackpackIcon, BadgeImage, BankIcon, BlockSkeleton, BodyText, Boost, BoostBadge, BoostButton, BorderedContainer, Breadcrumb, BridgeAction, BridgeHeader, BridgeProperties, BridgeTransactionView, BrokenHeartIcon, BubblesIcon, Button$1 as Button, BuyNFTHeader, BuyNFTProperties, BuyNFTTransactionView, CSS_VARS, Calendar, CaptionText, ChainLink, Checkmark1Icon, Checkmark2Icon, ChevronArrowIcon, ChevronGrabberVerticalIcon, ChevronLargeDownIcon, ChevronLargeRightIcon, ChevronRightSmallIcon, ChevronTopIcon, ChevronTopSmallIcon, Chip, CircleMinusIcon, CirclePlusIcon, CircleX, CircleXFilledIcon, ClockIcon, ClockOutlineIcon, CoinsAddIcon, CoinsIcon, Collapse, CollapsibleMenu, CollectionIcon, ColorPaletteIcon, CompassRound, ConsoleIcon, Copy, CrossAnimatedIcon, DashboardFast, DescriptionBlocks, DetailsToolbar, DiscordIcon, DockIconAnalytics, DockIconCheckout, DockIconHelp, DockIconProfile, DockIconScan, DockIconSwap, DockSwapIcon, Dollar, DotGrid1x3HorizontalIcon, DropdownMenu, DropdownMenuItem, EmojiMeh, EmojiSadIcon, EmptyHeartIcon, ErrorMessage, EthereumIcon, ExplosionIcon, FeeButton, FeesAction, FeesLines, FeesTotal, FilledHeartIcon, FilterButton, FilterIcon, GasIcon, GithubIcon, HashLink, HeadingText, HeartSmallIcon, HelpIcon, HistoryItem, HomeIcon, IconButton, IconLabel, ImageIcon, ImageSparkle, IncompleteAction, InfinityIcon, InfoBox, Inline, Input, InteractionHeader, InteractionProperties, InteractionTransactionView, Join, LightningIcon, LinkIcon, List, ListItem, Loader, LoadingProvider, LoadingSkeleton, MEDIA_QUERIES, MainView, MaxIcon, Menu, MenuItem, MenuSwapIcon, MirrorIcon, Modal, ModalContent, ModalContentDivider, MoonIcon, NavigationBar, NotAllowedIcon, NumericInput, PathSquareIcon, PercentIcon, PieChartIcon, PipeSeparator, PlusIcon, PowerIcon, ProductCard, ProfileHeader, ProfileHeaderBackground, PropertiesLayout, PropertyListItem, PunkIcon, RangeInput, ReceiptBillIcon, ReceiveNFTAction, ReceiveTokensAction, RecipientView, RefreshIcon, ReorderIcon, STEP_ITEM_HEIGHT, SearchIcon, SectionTitle, SendTokensAction, SettingsButton, SettingsGearIcon, SettingsItem, SettingsSlider, ShoppingBagIcon, SizeTransition, SmileIcon, SnapIcon, SortIcon, SparkleIcon, SparklesIcon, SquareArrowCenter, SquareArrowTopLeftIcon, SquareArrowTopRight2Icon, SquidConfigProvider, SquidLogo, StakeAction, StartAction, StocksIcon, SuccessAction, SunIcon, SunriseIcon, SwapAction, SwapConfiguration, SwapDetailsView, SwapErrorIcon, SwapHeader, SwapIcon, SwapInputsIcon, SwapProgressView, SwapProgressViewHeader, SwapProperties, SwapStepItem, SwapStepSeparator, SwapStepsCollapsed, SwapSuccessIcon, SwapTransactionView, SwapWarningIcon, Switch, TagIcon, TagIconFilled, TextSkeleton, ThumbsUp, Tick, TimeFliesIcon, Timeline, Timestamp, Toast, TokenPair, Tooltip, TradingViewStepsIcon, TransactionAction, TransactionFilters, TransactionHeader, TransactionHeaderLayout, TransactionItem, TransactionProperties, TransactionSearch, TransactionState, TransactionView, TransactionViewLayout, Transfer, TranslateIcon, TriangleExclamation, UsdAmount, WalletFilledIcon, WalletIcon, WalletLink, WalletsView, WrapAction, XSocial, baseTailwindConfig, cn, darkTheme, lightTheme, linkActionTimelineProps, statusTextClassMap, useCollapsibleMenu, useDropdownMenu, useMediaQuery, useOnResize, useRect, useTimer, useVersion };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SwapDirection } from '../../types/components';
|
|
2
3
|
import { TooltipProps } from './Tooltip';
|
|
3
4
|
interface Token {
|
|
@@ -5,7 +6,7 @@ interface Token {
|
|
|
5
6
|
symbol: string;
|
|
6
7
|
decimals: number;
|
|
7
8
|
}
|
|
8
|
-
interface NumericInputProps {
|
|
9
|
+
interface NumericInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
9
10
|
token: Token;
|
|
10
11
|
onAmountChange: (tokenAmount: string) => void;
|
|
11
12
|
forcedAmount?: string;
|
|
@@ -33,5 +34,5 @@ interface NumericInputProps {
|
|
|
33
34
|
tooltip?: Omit<TooltipProps, 'children'>;
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, ...props }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
37
38
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -171,7 +171,7 @@ interface Token$1 {
|
|
|
171
171
|
symbol: string;
|
|
172
172
|
decimals: number;
|
|
173
173
|
}
|
|
174
|
-
interface NumericInputProps {
|
|
174
|
+
interface NumericInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
175
175
|
token: Token$1;
|
|
176
176
|
onAmountChange: (tokenAmount: string) => void;
|
|
177
177
|
forcedAmount?: string;
|
|
@@ -199,7 +199,7 @@ interface NumericInputProps {
|
|
|
199
199
|
tooltip?: Omit<TooltipProps, 'children'>;
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
|
-
declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, }: NumericInputProps): react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, inputModeButton, isInteractive, balanceButton, ...props }: NumericInputProps): react_jsx_runtime.JSX.Element;
|
|
203
203
|
|
|
204
204
|
interface SettingsSliderProps {
|
|
205
205
|
value: number | undefined;
|
|
@@ -295,6 +295,11 @@ interface SettingsButtonProps {
|
|
|
295
295
|
}
|
|
296
296
|
declare function SettingsButton({ label, isSelected, onClick, }: SettingsButtonProps): react_jsx_runtime.JSX.Element;
|
|
297
297
|
|
|
298
|
+
interface IconButtonProps extends React.ComponentProps<'button'> {
|
|
299
|
+
icon: React.ReactNode;
|
|
300
|
+
}
|
|
301
|
+
declare const IconButton: ({ icon, ...props }: IconButtonProps) => react_jsx_runtime.JSX.Element;
|
|
302
|
+
|
|
298
303
|
declare function Approve(): react_jsx_runtime.JSX.Element;
|
|
299
304
|
|
|
300
305
|
declare function ArrowRightIcon(): react_jsx_runtime.JSX.Element;
|
|
@@ -2520,4 +2525,4 @@ declare const baseTailwindConfig: Config;
|
|
|
2520
2525
|
*/
|
|
2521
2526
|
declare const cn: (...inputs: ClassValue[]) => string;
|
|
2522
2527
|
|
|
2523
|
-
export { type ActionButton, ActionLayout, ActionLineOutRow, ActionProperties, ActionRow, type ActionStatus, ActionStatusRow, ActionWrapper, AddressButton, AnimationWrapper, AppContainer, Approve, ApproveAction, ArrowBottomTopIcon, ArrowButton, ArrowCornerDownRightIcon, ArrowLeftIcon, ArrowOutOfBoxIcon, ArrowRightDownCircleIcon, ArrowRightDownIcon, ArrowRightIcon, ArrowRightUpCircleIcon, ArrowRightUpIcon, ArrowRotate, ArrowTriangle, ArrowUpIcon, ArrowWallDownIcon, ArrowsSwapIcon, AssetsButton, type AssetsButtonVariant, AssetsView, BackpackIcon, BadgeImage, BankIcon, type BaseActionProps, type BaseTransactionViewProps, BlockSkeleton, BodyText, Boost, BoostBadge, BoostButton, BorderedContainer, Breadcrumb, BridgeAction, BridgeHeader, BridgeProperties, BridgeTransactionView, BrokenHeartIcon, BubblesIcon, Button, BuyNFTHeader, BuyNFTProperties, BuyNFTTransactionView, CSS_VARS, Calendar, CaptionText, ChainLink, Checkmark1Icon, Checkmark2Icon, ChevronArrowIcon, ChevronGrabberVerticalIcon, ChevronLargeDownIcon, ChevronLargeRightIcon, ChevronRightSmallIcon, ChevronTopIcon, ChevronTopSmallIcon, Chip, type ChipProps, CircleMinusIcon, CirclePlusIcon, CircleX, CircleXFilledIcon, ClockIcon, ClockOutlineIcon, CoinsAddIcon, CoinsIcon, Collapse, CollapsibleMenu, CollectionIcon, ColorPaletteIcon, CompassRound, ConsoleIcon, Copy, CrossAnimatedIcon, DashboardFast, DescriptionBlocks, DetailsToolbar, DiscordIcon, DockIconAnalytics, DockIconCheckout, DockIconHelp, DockIconProfile, DockIconScan, DockIconSwap, DockSwapIcon, Dollar, DotGrid1x3HorizontalIcon, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, EmojiMeh, EmojiSadIcon, EmptyHeartIcon, ErrorMessage, EthereumIcon, ExplosionIcon, FeeButton, FeesAction, type FeesActionProps, FeesLines, FeesTotal, FilledHeartIcon, FilterButton, FilterIcon, GasIcon, GithubIcon, HashLink, HeadingText, HeartSmallIcon, HelpIcon, HistoryItem, type HistoryItemStatus, HomeIcon, IconLabel, ImageIcon, ImageSparkle, IncompleteAction, InfinityIcon, InfoBox, Inline, Input, InteractionHeader, InteractionProperties, InteractionTransactionView, Join, LightningIcon, LinkIcon, List, ListItem, Loader, LoadingProvider, LoadingSkeleton, MEDIA_QUERIES, MainView, MaxIcon, Menu, MenuItem, MenuSwapIcon, MirrorIcon, Modal, ModalContent, ModalContentDivider, MoonIcon, NavigationBar, NotAllowedIcon, NumericInput, PathSquareIcon, PercentIcon, PieChartIcon, PipeSeparator, PlusIcon, PowerIcon, ProductCard, ProfileHeader, ProfileHeaderBackground, PropertiesLayout, PropertyListItem, type PropertyListItemProps, PunkIcon, RangeInput, ReceiptBillIcon, ReceiveNFTAction, ReceiveTokensAction, RecipientView, RefreshIcon, ReorderIcon, STEP_ITEM_HEIGHT, SearchIcon, SectionTitle, SendTokensAction, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsGearIcon, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, ShoppingBagIcon, SizeTransition, SmileIcon, SnapIcon, SortIcon, SparkleIcon, SparklesIcon, SquareArrowCenter, SquareArrowTopLeftIcon, SquareArrowTopRight2Icon, SquidConfigProvider, SquidLogo, type SquidTheme, StakeAction, StartAction, StocksIcon, SuccessAction, SunIcon, SunriseIcon, SwapAction, SwapConfiguration, SwapDetailsView, SwapErrorIcon, SwapHeader, type SwapHeaderProps, SwapIcon, SwapInputsIcon, SwapProgressView, SwapProgressViewHeader, SwapProperties, type SwapPropertiesProps, SwapState, type SwapStep, SwapStepItem, SwapStepSeparator, SwapStepsCollapsed, type SwapStepsCollapsedFooterButton, SwapSuccessIcon, SwapTransactionView, SwapWarningIcon, Switch, TagIcon, TagIconFilled, TextSkeleton, type ThemeType, ThumbsUp, Tick, TimeFliesIcon, Timeline, Timestamp, Toast, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, TradingViewStepsIcon, TransactionAction, type TransactionActionProps, type TransactionActionType, TransactionFilters, TransactionHeader, TransactionHeaderLayout, type TransactionHeaderProps, type TransactionHeaderType, TransactionItem, TransactionProperties, type TransactionPropertiesProps, type TransactionPropertiesType, TransactionSearch, TransactionState, TransactionView, TransactionViewLayout, type TransactionViewProps, type TransactionViewType, Transfer, TranslateIcon, TriangleExclamation, UsdAmount, WalletFilledIcon, WalletIcon, WalletLink, WalletsView, WrapAction, XSocial, baseTailwindConfig, cn, darkTheme, lightTheme, linkActionTimelineProps, statusTextClassMap, useCollapsibleMenu, useDropdownMenu, useMediaQuery, useOnResize, useRect, useTimer, useVersion };
|
|
2528
|
+
export { type ActionButton, ActionLayout, ActionLineOutRow, ActionProperties, ActionRow, type ActionStatus, ActionStatusRow, ActionWrapper, AddressButton, AnimationWrapper, AppContainer, Approve, ApproveAction, ArrowBottomTopIcon, ArrowButton, ArrowCornerDownRightIcon, ArrowLeftIcon, ArrowOutOfBoxIcon, ArrowRightDownCircleIcon, ArrowRightDownIcon, ArrowRightIcon, ArrowRightUpCircleIcon, ArrowRightUpIcon, ArrowRotate, ArrowTriangle, ArrowUpIcon, ArrowWallDownIcon, ArrowsSwapIcon, AssetsButton, type AssetsButtonVariant, AssetsView, BackpackIcon, BadgeImage, BankIcon, type BaseActionProps, type BaseTransactionViewProps, BlockSkeleton, BodyText, Boost, BoostBadge, BoostButton, BorderedContainer, Breadcrumb, BridgeAction, BridgeHeader, BridgeProperties, BridgeTransactionView, BrokenHeartIcon, BubblesIcon, Button, BuyNFTHeader, BuyNFTProperties, BuyNFTTransactionView, CSS_VARS, Calendar, CaptionText, ChainLink, Checkmark1Icon, Checkmark2Icon, ChevronArrowIcon, ChevronGrabberVerticalIcon, ChevronLargeDownIcon, ChevronLargeRightIcon, ChevronRightSmallIcon, ChevronTopIcon, ChevronTopSmallIcon, Chip, type ChipProps, CircleMinusIcon, CirclePlusIcon, CircleX, CircleXFilledIcon, ClockIcon, ClockOutlineIcon, CoinsAddIcon, CoinsIcon, Collapse, CollapsibleMenu, CollectionIcon, ColorPaletteIcon, CompassRound, ConsoleIcon, Copy, CrossAnimatedIcon, DashboardFast, DescriptionBlocks, DetailsToolbar, DiscordIcon, DockIconAnalytics, DockIconCheckout, DockIconHelp, DockIconProfile, DockIconScan, DockIconSwap, DockSwapIcon, Dollar, DotGrid1x3HorizontalIcon, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, EmojiMeh, EmojiSadIcon, EmptyHeartIcon, ErrorMessage, EthereumIcon, ExplosionIcon, FeeButton, FeesAction, type FeesActionProps, FeesLines, FeesTotal, FilledHeartIcon, FilterButton, FilterIcon, GasIcon, GithubIcon, HashLink, HeadingText, HeartSmallIcon, HelpIcon, HistoryItem, type HistoryItemStatus, HomeIcon, IconButton, IconLabel, ImageIcon, ImageSparkle, IncompleteAction, InfinityIcon, InfoBox, Inline, Input, InteractionHeader, InteractionProperties, InteractionTransactionView, Join, LightningIcon, LinkIcon, List, ListItem, Loader, LoadingProvider, LoadingSkeleton, MEDIA_QUERIES, MainView, MaxIcon, Menu, MenuItem, MenuSwapIcon, MirrorIcon, Modal, ModalContent, ModalContentDivider, MoonIcon, NavigationBar, NotAllowedIcon, NumericInput, PathSquareIcon, PercentIcon, PieChartIcon, PipeSeparator, PlusIcon, PowerIcon, ProductCard, ProfileHeader, ProfileHeaderBackground, PropertiesLayout, PropertyListItem, type PropertyListItemProps, PunkIcon, RangeInput, ReceiptBillIcon, ReceiveNFTAction, ReceiveTokensAction, RecipientView, RefreshIcon, ReorderIcon, STEP_ITEM_HEIGHT, SearchIcon, SectionTitle, SendTokensAction, SettingsButton, type SettingsButtonProps, type SettingsControl, SettingsGearIcon, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, ShoppingBagIcon, SizeTransition, SmileIcon, SnapIcon, SortIcon, SparkleIcon, SparklesIcon, SquareArrowCenter, SquareArrowTopLeftIcon, SquareArrowTopRight2Icon, SquidConfigProvider, SquidLogo, type SquidTheme, StakeAction, StartAction, StocksIcon, SuccessAction, SunIcon, SunriseIcon, SwapAction, SwapConfiguration, SwapDetailsView, SwapErrorIcon, SwapHeader, type SwapHeaderProps, SwapIcon, SwapInputsIcon, SwapProgressView, SwapProgressViewHeader, SwapProperties, type SwapPropertiesProps, SwapState, type SwapStep, SwapStepItem, SwapStepSeparator, SwapStepsCollapsed, type SwapStepsCollapsedFooterButton, SwapSuccessIcon, SwapTransactionView, SwapWarningIcon, Switch, TagIcon, TagIconFilled, TextSkeleton, type ThemeType, ThumbsUp, Tick, TimeFliesIcon, Timeline, Timestamp, Toast, TokenPair, Tooltip, type TooltipProps, type TooltipThreshold, type TooltipWidth, TradingViewStepsIcon, TransactionAction, type TransactionActionProps, type TransactionActionType, TransactionFilters, TransactionHeader, TransactionHeaderLayout, type TransactionHeaderProps, type TransactionHeaderType, TransactionItem, TransactionProperties, type TransactionPropertiesProps, type TransactionPropertiesType, TransactionSearch, TransactionState, TransactionView, TransactionViewLayout, type TransactionViewProps, type TransactionViewType, Transfer, TranslateIcon, TriangleExclamation, UsdAmount, WalletFilledIcon, WalletIcon, WalletLink, WalletsView, WrapAction, XSocial, baseTailwindConfig, cn, darkTheme, lightTheme, linkActionTimelineProps, statusTextClassMap, useCollapsibleMenu, useDropdownMenu, useMediaQuery, useOnResize, useRect, useTimer, useVersion };
|