@0xsquid/ui 0.19.2 → 0.19.3
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 +3 -4
- package/dist/cjs/types/components/controls/NumericInput.d.ts +1 -1
- package/dist/cjs/types/stories/layout/SwapConfiguration.stories.d.ts +2 -1
- package/dist/esm/index.js +3 -4
- package/dist/esm/types/components/controls/NumericInput.d.ts +1 -1
- package/dist/esm/types/stories/layout/SwapConfiguration.stories.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -24261,11 +24261,10 @@ var InputMode;
|
|
|
24261
24261
|
function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
24262
24262
|
token: '0.001',
|
|
24263
24263
|
usd: '0.01',
|
|
24264
|
-
}, showDetails = true, isLoading = false, direction, amountUsd, isInteractive
|
|
24264
|
+
}, showDetails = true, isLoading = false, direction, amountUsd, isInteractive = false, }) {
|
|
24265
24265
|
var _a;
|
|
24266
24266
|
const [inputValue, setInputValue] = React.useState('');
|
|
24267
24267
|
const [inputMode, setInputMode] = React.useState(InputMode.TOKEN);
|
|
24268
|
-
const isInteractive = isInteractiveProp && !isLoading;
|
|
24269
24268
|
const balanceChipClickable = isInteractive && parseFloat(balance) > 0;
|
|
24270
24269
|
React.useEffect(() => {
|
|
24271
24270
|
if (forcedAmount !== undefined) {
|
|
@@ -24382,9 +24381,9 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24382
24381
|
const balanceFormatted = React.useMemo(() => {
|
|
24383
24382
|
return formatAmount(balance !== null && balance !== void 0 ? balance : '0');
|
|
24384
24383
|
}, [balance]);
|
|
24385
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isInteractive ? (jsxRuntime.jsxs("form", { className: "tw-relative tw-h-[80.6px] tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-h-[75px] mobile-lg:tw-px-squid-m", onSubmit: (e) => {
|
|
24384
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isInteractive && !isLoading ? (jsxRuntime.jsxs("form", { className: "tw-relative tw-h-[80.6px] tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-h-[75px] mobile-lg:tw-px-squid-m", onSubmit: (e) => {
|
|
24386
24385
|
e.preventDefault();
|
|
24387
|
-
}, children: [inputMode === InputMode.USD && (jsxRuntime.jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsxRuntime.jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsxRuntime.jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m',
|
|
24386
|
+
}, children: [inputMode === InputMode.USD && (jsxRuntime.jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsxRuntime.jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsxRuntime.jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && notInteractiveClassName), children: jsxRuntime.jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsxRuntime.jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxRuntime.jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m', isLoading && notInteractiveClassName), children: [error ? (jsxRuntime.jsx("div", { className: "tw-px-squid-xs", children: jsxRuntime.jsx(ErrorMessage, { message: error.message }) })) : (jsxRuntime.jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsxRuntime.jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxRuntime.jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsxRuntime.jsx(CaptionText, { children: isUsdAmountVerySmall
|
|
24388
24387
|
? formatIfVerySmall.token
|
|
24389
24388
|
: amountFormatted })] }) })) : (jsxRuntime.jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsxRuntime.jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
24390
24389
|
? formatIfVerySmall.token
|
|
@@ -25,5 +25,5 @@ interface NumericInputProps {
|
|
|
25
25
|
maxUsdDecimals?: number;
|
|
26
26
|
isInteractive?: boolean;
|
|
27
27
|
}
|
|
28
|
-
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive
|
|
28
|
+
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
export {};
|
|
@@ -6,8 +6,9 @@ type Story = StoryObj<typeof meta>;
|
|
|
6
6
|
export declare const EmptyVariantPrimary: Story;
|
|
7
7
|
export declare const EmptyVariantAccent: Story;
|
|
8
8
|
export declare const Loading: Story;
|
|
9
|
-
export declare const InputNotInteractive: Story;
|
|
10
9
|
export declare const LoadingWithAllProps: Story;
|
|
10
|
+
export declare const InputNotInteractive: Story;
|
|
11
|
+
export declare const InputNotInteractiveWithAllProps: Story;
|
|
11
12
|
export declare const ChainOnly: Story;
|
|
12
13
|
export declare const ChainAndToken: Story;
|
|
13
14
|
export declare const WithSwapAmountUsd: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -24241,11 +24241,10 @@ var InputMode;
|
|
|
24241
24241
|
function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 4, formatIfVerySmall = {
|
|
24242
24242
|
token: '0.001',
|
|
24243
24243
|
usd: '0.01',
|
|
24244
|
-
}, showDetails = true, isLoading = false, direction, amountUsd, isInteractive
|
|
24244
|
+
}, showDetails = true, isLoading = false, direction, amountUsd, isInteractive = false, }) {
|
|
24245
24245
|
var _a;
|
|
24246
24246
|
const [inputValue, setInputValue] = useState('');
|
|
24247
24247
|
const [inputMode, setInputMode] = useState(InputMode.TOKEN);
|
|
24248
|
-
const isInteractive = isInteractiveProp && !isLoading;
|
|
24249
24248
|
const balanceChipClickable = isInteractive && parseFloat(balance) > 0;
|
|
24250
24249
|
useEffect(() => {
|
|
24251
24250
|
if (forcedAmount !== undefined) {
|
|
@@ -24362,9 +24361,9 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
24362
24361
|
const balanceFormatted = useMemo(() => {
|
|
24363
24362
|
return formatAmount(balance !== null && balance !== void 0 ? balance : '0');
|
|
24364
24363
|
}, [balance]);
|
|
24365
|
-
return (jsxs(Fragment, { children: [isInteractive ? (jsxs("form", { className: "tw-relative tw-h-[80.6px] tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-h-[75px] mobile-lg:tw-px-squid-m", onSubmit: (e) => {
|
|
24364
|
+
return (jsxs(Fragment, { children: [isInteractive && !isLoading ? (jsxs("form", { className: "tw-relative tw-h-[80.6px] tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular mobile-lg:tw-h-[75px] mobile-lg:tw-px-squid-m", onSubmit: (e) => {
|
|
24366
24365
|
e.preventDefault();
|
|
24367
|
-
}, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m',
|
|
24366
|
+
}, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-5 tw-top-[11px] tw-leading-[43px] tw-text-grey-600 mobile-lg:tw-left-[30px]", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-xs tw-pb-[15px] tw-pt-[5px] mobile-lg:tw-px-squid-m', isLoading && notInteractiveClassName), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: inputValue || 0 }) }) })), !showDetails ? null : (jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-xs tw-text-grey-500 mobile-lg:tw-px-squid-m', isLoading && notInteractiveClassName), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsx(Fragment, { children: jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsx(CaptionText, { children: isUsdAmountVerySmall
|
|
24368
24367
|
? formatIfVerySmall.token
|
|
24369
24368
|
: amountFormatted })] }) })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsx(CaptionText, { children: isTokenAmountVerySmall
|
|
24370
24369
|
? formatIfVerySmall.token
|
|
@@ -25,5 +25,5 @@ interface NumericInputProps {
|
|
|
25
25
|
maxUsdDecimals?: number;
|
|
26
26
|
isInteractive?: boolean;
|
|
27
27
|
}
|
|
28
|
-
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive
|
|
28
|
+
export declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
export {};
|
|
@@ -6,8 +6,9 @@ type Story = StoryObj<typeof meta>;
|
|
|
6
6
|
export declare const EmptyVariantPrimary: Story;
|
|
7
7
|
export declare const EmptyVariantAccent: Story;
|
|
8
8
|
export declare const Loading: Story;
|
|
9
|
-
export declare const InputNotInteractive: Story;
|
|
10
9
|
export declare const LoadingWithAllProps: Story;
|
|
10
|
+
export declare const InputNotInteractive: Story;
|
|
11
|
+
export declare const InputNotInteractiveWithAllProps: Story;
|
|
11
12
|
export declare const ChainOnly: Story;
|
|
12
13
|
export declare const ChainAndToken: Story;
|
|
13
14
|
export declare const WithSwapAmountUsd: Story;
|
package/dist/index.d.ts
CHANGED
|
@@ -235,7 +235,7 @@ interface NumericInputProps {
|
|
|
235
235
|
maxUsdDecimals?: number;
|
|
236
236
|
isInteractive?: boolean;
|
|
237
237
|
}
|
|
238
|
-
declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive
|
|
238
|
+
declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxUsdDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, isInteractive, }: NumericInputProps): react_jsx_runtime.JSX.Element;
|
|
239
239
|
|
|
240
240
|
interface SettingsSliderProps {
|
|
241
241
|
value: number | undefined;
|