@0xsquid/ui 0.15.6 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +67 -19
- package/dist/cjs/types/components/controls/Input.d.ts +8 -3
- package/dist/cjs/types/components/controls/SettingsSlider.d.ts +5 -4
- package/dist/cjs/types/components/lists/SettingsItem.d.ts +8 -7
- package/dist/cjs/types/stories/controls/Input.stories.d.ts +1 -1
- package/dist/cjs/types/stories/controls/SettingsSlider.stories.d.ts +4 -0
- package/dist/esm/index.js +67 -19
- package/dist/esm/types/components/controls/Input.d.ts +8 -3
- package/dist/esm/types/components/controls/SettingsSlider.d.ts +5 -4
- package/dist/esm/types/components/lists/SettingsItem.d.ts +8 -7
- package/dist/esm/types/stories/controls/Input.stories.d.ts +1 -1
- package/dist/esm/types/stories/controls/SettingsSlider.stories.d.ts +4 -0
- package/dist/index.css +20 -39
- package/dist/index.d.ts +20 -14
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2918,11 +2918,12 @@ function SearchIcon() {
|
|
|
2918
2918
|
}
|
|
2919
2919
|
|
|
2920
2920
|
function Input(_a) {
|
|
2921
|
-
var { placeholder = 'Search', showIcon = true,
|
|
2922
|
-
|
|
2921
|
+
var { placeholder = 'Search', showIcon = true, className, icon, isError = false, containerClassName, actionButtonProps } = _a, props = __rest(_a, ["placeholder", "showIcon", "className", "icon", "isError", "containerClassName", "actionButtonProps"]);
|
|
2922
|
+
const showActionButton = !!actionButtonProps;
|
|
2923
|
+
return (jsxRuntime.jsxs("div", { className: cn('tw-relative tw-w-full tw-text-grey-600', containerClassName), children: [jsxRuntime.jsx("input", Object.assign({}, props, { "aria-invalid": isError, className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-typography-regular tw-text-grey-300 placeholder:tw-text-grey-600 invalid:tw-outline-status-negative', showIcon ? 'tw-pl-[40px]' : 'tw-px-2.5', showActionButton ? 'tw-pr-[70px]' : 'tw-pr-2.5', isError && '!tw-outline-status-negative', className), placeholder: placeholder })), showIcon ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsxRuntime.jsx(SearchIcon, {}) })) : null, showActionButton ? (jsxRuntime.jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsxRuntime.jsx(InputActionButton, Object.assign({}, actionButtonProps)) })) : null] }));
|
|
2923
2924
|
}
|
|
2924
|
-
const
|
|
2925
|
-
return (jsxRuntime.jsx(Button, { size: "md", variant:
|
|
2925
|
+
const InputActionButton = ({ onClick, variant = 'tertiary', label = 'Paste', }) => {
|
|
2926
|
+
return (jsxRuntime.jsx(Button, { size: "md", variant: variant, onClick: onClick, className: "!tw-h-[30px] !tw-w-fit !tw-min-w-0", children: jsxRuntime.jsx(CaptionText, { children: label }) }));
|
|
2926
2927
|
};
|
|
2927
2928
|
|
|
2928
2929
|
/*
|
|
@@ -6713,8 +6714,8 @@ function SettingsItem({ icon, label, control, link, transparent = false, helpToo
|
|
|
6713
6714
|
const helpIcon = !!helpTooltip && (jsxRuntime.jsx(HelpIcon, { className: "tw-cursor-help tw-text-grey-600 hover:tw-text-grey-400" }));
|
|
6714
6715
|
const showDetailsBorder = !!control && !link && !(control.type === 'switch');
|
|
6715
6716
|
return (jsxRuntime.jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-800'), children: jsxRuntime.jsxs(ContentTag, Object.assign({ className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xs tw-text-grey-300', link && 'hover:tw-bg-material-light-thin') }, contentTagProps, { children: [icon, jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsxRuntime.jsx(BodyText, { size: "small", children: label }), helpTooltip ? (jsxRuntime.jsx(Tooltip, Object.assign({}, helpTooltip, { children: helpIcon }))) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: helpIcon }))] }), jsxRuntime.jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', showDetailsBorder &&
|
|
6716
|
-
'tw-rounded-squid-xs tw-border tw-border-solid tw-border-material-light-thin tw-bg-material-dark-thin'), children: !!link ? (jsxRuntime.jsx(SquareArrowTopRight2Icon, { className: "tw-text-material-light-average" })) : (!!control && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [control.type === 'amount' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SettingsButton, { onClick: () => control.onChange(control.resetValueControl.value), label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value }), control.options.map(({ value }, index, _controls) => (jsxRuntime.jsx(SettingsButton, { label: '$' + value, isSelected: control.value === value, onClick: () => control.onChange(value) }, index))), jsxRuntime.jsx(SettingsSlider, { type: control.type, value: control.value, onChange: control.onChange,
|
|
6717
|
-
(control.tooltip ? (jsxRuntime.jsx(Tooltip, Object.assign({}, control.tooltip, { children: jsxRuntime.jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }) }))) : (jsxRuntime.jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }))), control.type === 'percentage' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value, onClick: control.resetValueControl.onSelect }), jsxRuntime.jsx(SettingsSlider, { onChange: control.onChange, value: control.value, type: "percentage",
|
|
6717
|
+
'tw-rounded-squid-xs tw-border tw-border-solid tw-border-material-light-thin tw-bg-material-dark-thin'), children: !!link ? (jsxRuntime.jsx(SquareArrowTopRight2Icon, { className: "tw-text-material-light-average" })) : (!!control && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [control.type === 'amount' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SettingsButton, { onClick: () => control.onChange(control.resetValueControl.value), label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value }), control.options.map(({ value }, index, _controls) => (jsxRuntime.jsx(SettingsButton, { label: '$' + value, isSelected: control.value === value, onClick: () => control.onChange(value) }, index))), jsxRuntime.jsx(SettingsSlider, { type: control.type, value: control.value, isSelected: control.value !== control.resetValueControl.value, onChange: control.onChange, decimalsFormat: control.decimalsFormat, max: 999 })] })), control.type === 'switch' &&
|
|
6718
|
+
(control.tooltip ? (jsxRuntime.jsx(Tooltip, Object.assign({}, control.tooltip, { children: jsxRuntime.jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }) }))) : (jsxRuntime.jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }))), control.type === 'percentage' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value, onClick: control.resetValueControl.onSelect }), jsxRuntime.jsx(SettingsSlider, { onChange: control.onChange, value: control.value, type: "percentage", isSelected: control.value !== control.resetValueControl.value, decimalsFormat: control.decimalsFormat, max: control.max, min: control.min })] }))] }))) })] })) }));
|
|
6718
6719
|
}
|
|
6719
6720
|
|
|
6720
6721
|
function SwapDetailListItem({ label, detail, icon, isLoading = false, }) {
|
|
@@ -7154,18 +7155,65 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
7154
7155
|
: amountFormatted }), ' ', jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxRuntime.jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsxRuntime.jsx(ArrowTriangle, {}), jsxRuntime.jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxRuntime.jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsxs(CaptionText, { children: [balanceFormatted, " ", token.symbol] }), jsxRuntime.jsx(MaxIcon, {})] })] }))] }));
|
|
7155
7156
|
}
|
|
7156
7157
|
|
|
7157
|
-
function SettingsSlider({ value, type, onChange,
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7158
|
+
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
|
|
7159
|
+
const [isInputVisible, setIsInputVisible] = React.useState(false);
|
|
7160
|
+
const [inputValue, setInputValue] = React.useState(String(value !== null && value !== void 0 ? value : 0));
|
|
7161
|
+
React.useEffect(() => {
|
|
7162
|
+
if (!isInputVisible)
|
|
7163
|
+
return;
|
|
7164
|
+
const handleOutsideClick = (event) => {
|
|
7165
|
+
var _a;
|
|
7166
|
+
const clickedElementIsDifferentThanMenu = event.target !== menuRef.current;
|
|
7167
|
+
const clickedElementIsDifferentThanSlider = event.target !== sliderRef.current;
|
|
7168
|
+
const sliderContainsClickedElement = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target);
|
|
7169
|
+
const hideInput = clickedElementIsDifferentThanMenu &&
|
|
7170
|
+
(!clickedElementIsDifferentThanSlider || !sliderContainsClickedElement);
|
|
7171
|
+
if (hideInput) {
|
|
7172
|
+
handleCloseInput();
|
|
7173
|
+
}
|
|
7174
|
+
};
|
|
7175
|
+
document.addEventListener('click', handleOutsideClick);
|
|
7176
|
+
return () => {
|
|
7177
|
+
document.removeEventListener('click', handleOutsideClick);
|
|
7178
|
+
};
|
|
7179
|
+
}, [isInputVisible]);
|
|
7180
|
+
const menuRef = React.useRef(null);
|
|
7181
|
+
const sliderRef = React.useRef(null);
|
|
7182
|
+
const handleSubmit = React.useCallback((value) => {
|
|
7183
|
+
handleCloseInput();
|
|
7184
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value === '' ? undefined : Number(value));
|
|
7185
|
+
}, [onChange]);
|
|
7186
|
+
const handleKeyDown = React.useCallback((e) => {
|
|
7187
|
+
// block unwanted (but still valid) characters
|
|
7188
|
+
if (['e', 'E', '+', '-'].includes(e.key))
|
|
7189
|
+
return e.preventDefault();
|
|
7190
|
+
// close input when pressing escape
|
|
7191
|
+
if (e.key === 'Escape')
|
|
7192
|
+
return handleCloseInput();
|
|
7193
|
+
}, []);
|
|
7194
|
+
const handleOpenInput = React.useCallback(() => {
|
|
7195
|
+
setIsInputVisible(true);
|
|
7196
|
+
}, []);
|
|
7197
|
+
const handleCloseInput = React.useCallback(() => {
|
|
7198
|
+
setIsInputVisible(false);
|
|
7199
|
+
}, []);
|
|
7200
|
+
return (jsxRuntime.jsxs("div", { ref: sliderRef, className: "tw-relative tw-flex tw-h-[30px] tw-items-center tw-justify-center tw-rounded-squid-xs", children: [jsxRuntime.jsxs("button", { className: cn('tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-p-squid-xs tw-pr-[40px] tw-text-left tw-text-caption !tw-font-medium tw-leading-[10px] placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', value === 0 || value === undefined
|
|
7201
|
+
? 'tw-text-grey-600'
|
|
7202
|
+
: 'tw-text-grey-300', isInputVisible ? 'tw-bg-material-light-thin' : 'tw-bg-transparent', isSelected && 'tw-outline tw-outline-2 tw-outline-royal-500'), children: [value !== null && value !== void 0 ? value : 0, jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: type === 'percentage' ? '%' : '$' })] }), jsxRuntime.jsx("button", { onClick: handleOpenInput, className: "tw-absolute tw-right-squid-xs tw-flex tw-h-[26px] tw-w-[26px] tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-xxs !tw-font-medium tw-leading-[10px] hover:tw-bg-material-light-thin", children: jsxRuntime.jsx(Chip, { icon: jsxRuntime.jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) }) }), isInputVisible && (jsxRuntime.jsx(Menu, { menuRef: menuRef, containerClassName: "tw-absolute tw-bottom-full tw-z-10 tw-pb-squid-m tw-w-[160px]", children: jsxRuntime.jsx("form", { onSubmit: (e) => {
|
|
7203
|
+
e.preventDefault();
|
|
7204
|
+
handleSubmit(inputValue);
|
|
7205
|
+
}, children: jsxRuntime.jsx(Input, { autoFocus: true, min: min, max: max, onKeyDown: handleKeyDown, step: decimalsFormat, placeholder: "0", type: "number", defaultValue: value, value: inputValue, onChange: (e) => {
|
|
7206
|
+
const isValid = e.target.checkValidity();
|
|
7207
|
+
if (!isValid)
|
|
7208
|
+
return;
|
|
7209
|
+
setInputValue(e.target.value);
|
|
7210
|
+
}, showIcon: false, actionButtonProps: {
|
|
7211
|
+
label: 'Ok',
|
|
7212
|
+
onClick: () => {
|
|
7213
|
+
handleSubmit(inputValue);
|
|
7214
|
+
},
|
|
7215
|
+
variant: 'primary',
|
|
7216
|
+
} }) }) }))] }));
|
|
7169
7217
|
}
|
|
7170
7218
|
|
|
7171
7219
|
const switchSizeClassMap = {
|
|
@@ -7251,7 +7299,7 @@ function generateMarkerLines(count) {
|
|
|
7251
7299
|
}
|
|
7252
7300
|
|
|
7253
7301
|
function SettingsButton({ label, isSelected = false, onClick, }) {
|
|
7254
|
-
return (jsxRuntime.jsx("button", { onClick: onClick, className: cn('tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline-royal-500'), children: jsxRuntime.jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
7302
|
+
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 hover:tw-bg-material-light-thin focus: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 }) }));
|
|
7255
7303
|
}
|
|
7256
7304
|
|
|
7257
7305
|
var v$5 = "5.10.0";
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonVariant } from '../../types/components';
|
|
2
3
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
4
|
placeholder?: string;
|
|
4
5
|
showIcon?: boolean;
|
|
5
|
-
showPasteButton?: boolean;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
isError?: boolean;
|
|
8
|
-
onPasteButtonClick?: () => void;
|
|
9
8
|
containerClassName?: string;
|
|
9
|
+
actionButtonProps?: InputActionButtonProps;
|
|
10
10
|
}
|
|
11
|
-
export declare function Input({ placeholder, showIcon,
|
|
11
|
+
export declare function Input({ placeholder, showIcon, className, icon, isError, containerClassName, actionButtonProps, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
type InputActionButtonProps = {
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
label?: string;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export interface SettingsSliderProps {
|
|
2
|
-
value: number;
|
|
2
|
+
value: number | undefined;
|
|
3
3
|
type: 'percentage' | 'amount';
|
|
4
|
-
onChange?: (value: number) => void;
|
|
5
|
-
|
|
4
|
+
onChange?: (value: number | undefined) => void;
|
|
5
|
+
decimalsFormat?: number;
|
|
6
6
|
min?: number;
|
|
7
7
|
max?: number;
|
|
8
|
+
isSelected?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare function SettingsSlider({ value, type, onChange,
|
|
10
|
+
export declare function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }: SettingsSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
import { TooltipProps } from '../controls';
|
|
3
3
|
export type SettingsControl = {
|
|
4
4
|
type: 'percentage';
|
|
5
|
-
value: number;
|
|
6
|
-
onChange: (value: number) => void;
|
|
5
|
+
value: number | undefined;
|
|
6
|
+
onChange: (value: number | undefined) => void;
|
|
7
7
|
min?: number;
|
|
8
8
|
max?: number;
|
|
9
|
-
|
|
9
|
+
decimalsFormat?: number;
|
|
10
10
|
resetValueControl: {
|
|
11
11
|
label: string;
|
|
12
12
|
onSelect: () => void;
|
|
13
|
-
value: number;
|
|
13
|
+
value: number | undefined;
|
|
14
14
|
};
|
|
15
15
|
} | {
|
|
16
16
|
type: 'amount';
|
|
17
|
-
value: number;
|
|
18
|
-
onChange: (value: number) => void;
|
|
17
|
+
value: number | undefined;
|
|
18
|
+
onChange: (value: number | undefined) => void;
|
|
19
19
|
options: {
|
|
20
20
|
value: number;
|
|
21
21
|
}[];
|
|
22
|
+
decimalsFormat?: number;
|
|
22
23
|
resetValueControl: {
|
|
23
24
|
label: string;
|
|
24
|
-
value: number;
|
|
25
|
+
value: number | undefined;
|
|
25
26
|
};
|
|
26
27
|
} | {
|
|
27
28
|
type: 'switch';
|
|
@@ -5,5 +5,5 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const WithoutIcon: Story;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const WithActionButton: Story;
|
|
9
9
|
export declare const Error: Story;
|
|
@@ -5,3 +5,7 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Percentage: Story;
|
|
7
7
|
export declare const Amount: Story;
|
|
8
|
+
export declare const PercentageWith1DecimalPlaceAllowed: Story;
|
|
9
|
+
export declare const AmountWith2DecimalPlacesAllowed: Story;
|
|
10
|
+
export declare const PercentageMax50: Story;
|
|
11
|
+
export declare const AmountMax999: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -2898,11 +2898,12 @@ function SearchIcon() {
|
|
|
2898
2898
|
}
|
|
2899
2899
|
|
|
2900
2900
|
function Input(_a) {
|
|
2901
|
-
var { placeholder = 'Search', showIcon = true,
|
|
2902
|
-
|
|
2901
|
+
var { placeholder = 'Search', showIcon = true, className, icon, isError = false, containerClassName, actionButtonProps } = _a, props = __rest(_a, ["placeholder", "showIcon", "className", "icon", "isError", "containerClassName", "actionButtonProps"]);
|
|
2902
|
+
const showActionButton = !!actionButtonProps;
|
|
2903
|
+
return (jsxs("div", { className: cn('tw-relative tw-w-full tw-text-grey-600', containerClassName), children: [jsx("input", Object.assign({}, props, { "aria-invalid": isError, className: cn('tw-relative tw-h-10 tw-w-full tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-900 tw-text-body-small tw-font-typography-regular tw-text-grey-300 placeholder:tw-text-grey-600 invalid:tw-outline-status-negative', showIcon ? 'tw-pl-[40px]' : 'tw-px-2.5', showActionButton ? 'tw-pr-[70px]' : 'tw-pr-2.5', isError && '!tw-outline-status-negative', className), placeholder: placeholder })), showIcon ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-left-0 tw-flex tw-h-full tw-w-[44px] tw-items-center tw-justify-center tw-px-squid-xs", children: icon || jsx(SearchIcon, {}) })) : null, showActionButton ? (jsx("div", { className: "tw-absolute tw-inset-y-0 tw-right-1.5 tw-flex tw-items-center tw-justify-center", children: jsx(InputActionButton, Object.assign({}, actionButtonProps)) })) : null] }));
|
|
2903
2904
|
}
|
|
2904
|
-
const
|
|
2905
|
-
return (jsx(Button, { size: "md", variant:
|
|
2905
|
+
const InputActionButton = ({ onClick, variant = 'tertiary', label = 'Paste', }) => {
|
|
2906
|
+
return (jsx(Button, { size: "md", variant: variant, onClick: onClick, className: "!tw-h-[30px] !tw-w-fit !tw-min-w-0", children: jsx(CaptionText, { children: label }) }));
|
|
2906
2907
|
};
|
|
2907
2908
|
|
|
2908
2909
|
/*
|
|
@@ -6693,8 +6694,8 @@ function SettingsItem({ icon, label, control, link, transparent = false, helpToo
|
|
|
6693
6694
|
const helpIcon = !!helpTooltip && (jsx(HelpIcon, { className: "tw-cursor-help tw-text-grey-600 hover:tw-text-grey-400" }));
|
|
6694
6695
|
const showDetailsBorder = !!control && !link && !(control.type === 'switch');
|
|
6695
6696
|
return (jsx("li", { className: cn('tw-h-[50px] tw-self-stretch tw-px-squid-xs', transparent ? 'tw-bg-transparent' : 'tw-bg-grey-800'), children: jsxs(ContentTag, Object.assign({ className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xs tw-text-grey-300', link && 'hover:tw-bg-material-light-thin') }, contentTagProps, { children: [icon, jsxs("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-self-stretch", children: [jsx(BodyText, { size: "small", children: label }), helpTooltip ? (jsx(Tooltip, Object.assign({}, helpTooltip, { children: helpIcon }))) : (jsx(Fragment, { children: helpIcon }))] }), jsx("div", { className: cn('tw-flex tw-h-squid-l tw-items-center tw-justify-center tw-rounded-squid-xs', showDetailsBorder &&
|
|
6696
|
-
'tw-rounded-squid-xs tw-border tw-border-solid tw-border-material-light-thin tw-bg-material-dark-thin'), children: !!link ? (jsx(SquareArrowTopRight2Icon, { className: "tw-text-material-light-average" })) : (!!control && (jsxs(Fragment, { children: [control.type === 'amount' && (jsxs(Fragment, { children: [jsx(SettingsButton, { onClick: () => control.onChange(control.resetValueControl.value), label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value }), control.options.map(({ value }, index, _controls) => (jsx(SettingsButton, { label: '$' + value, isSelected: control.value === value, onClick: () => control.onChange(value) }, index))), jsx(SettingsSlider, { type: control.type, value: control.value, onChange: control.onChange,
|
|
6697
|
-
(control.tooltip ? (jsx(Tooltip, Object.assign({}, control.tooltip, { children: jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }) }))) : (jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }))), control.type === 'percentage' && (jsxs(Fragment, { children: [jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value, onClick: control.resetValueControl.onSelect }), jsx(SettingsSlider, { onChange: control.onChange, value: control.value, type: "percentage",
|
|
6697
|
+
'tw-rounded-squid-xs tw-border tw-border-solid tw-border-material-light-thin tw-bg-material-dark-thin'), children: !!link ? (jsx(SquareArrowTopRight2Icon, { className: "tw-text-material-light-average" })) : (!!control && (jsxs(Fragment, { children: [control.type === 'amount' && (jsxs(Fragment, { children: [jsx(SettingsButton, { onClick: () => control.onChange(control.resetValueControl.value), label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value }), control.options.map(({ value }, index, _controls) => (jsx(SettingsButton, { label: '$' + value, isSelected: control.value === value, onClick: () => control.onChange(value) }, index))), jsx(SettingsSlider, { type: control.type, value: control.value, isSelected: control.value !== control.resetValueControl.value, onChange: control.onChange, decimalsFormat: control.decimalsFormat, max: 999 })] })), control.type === 'switch' &&
|
|
6698
|
+
(control.tooltip ? (jsx(Tooltip, Object.assign({}, control.tooltip, { children: jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }) }))) : (jsx(Switch, { size: "large", checked: control.checked, onChange: control.onChange, disabled: control.disabled }))), control.type === 'percentage' && (jsxs(Fragment, { children: [jsx(SettingsButton, { label: control.resetValueControl.label, isSelected: control.resetValueControl.value === control.value, onClick: control.resetValueControl.onSelect }), jsx(SettingsSlider, { onChange: control.onChange, value: control.value, type: "percentage", isSelected: control.value !== control.resetValueControl.value, decimalsFormat: control.decimalsFormat, max: control.max, min: control.min })] }))] }))) })] })) }));
|
|
6698
6699
|
}
|
|
6699
6700
|
|
|
6700
6701
|
function SwapDetailListItem({ label, detail, icon, isLoading = false, }) {
|
|
@@ -7134,18 +7135,65 @@ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPri
|
|
|
7134
7135
|
: amountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxs(CaptionText, { children: [balanceFormatted, " ", token.symbol] }), jsx(MaxIcon, {})] })] }))] }));
|
|
7135
7136
|
}
|
|
7136
7137
|
|
|
7137
|
-
function SettingsSlider({ value, type, onChange,
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7138
|
+
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }) {
|
|
7139
|
+
const [isInputVisible, setIsInputVisible] = useState(false);
|
|
7140
|
+
const [inputValue, setInputValue] = useState(String(value !== null && value !== void 0 ? value : 0));
|
|
7141
|
+
useEffect(() => {
|
|
7142
|
+
if (!isInputVisible)
|
|
7143
|
+
return;
|
|
7144
|
+
const handleOutsideClick = (event) => {
|
|
7145
|
+
var _a;
|
|
7146
|
+
const clickedElementIsDifferentThanMenu = event.target !== menuRef.current;
|
|
7147
|
+
const clickedElementIsDifferentThanSlider = event.target !== sliderRef.current;
|
|
7148
|
+
const sliderContainsClickedElement = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target);
|
|
7149
|
+
const hideInput = clickedElementIsDifferentThanMenu &&
|
|
7150
|
+
(!clickedElementIsDifferentThanSlider || !sliderContainsClickedElement);
|
|
7151
|
+
if (hideInput) {
|
|
7152
|
+
handleCloseInput();
|
|
7153
|
+
}
|
|
7154
|
+
};
|
|
7155
|
+
document.addEventListener('click', handleOutsideClick);
|
|
7156
|
+
return () => {
|
|
7157
|
+
document.removeEventListener('click', handleOutsideClick);
|
|
7158
|
+
};
|
|
7159
|
+
}, [isInputVisible]);
|
|
7160
|
+
const menuRef = useRef(null);
|
|
7161
|
+
const sliderRef = useRef(null);
|
|
7162
|
+
const handleSubmit = useCallback((value) => {
|
|
7163
|
+
handleCloseInput();
|
|
7164
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value === '' ? undefined : Number(value));
|
|
7165
|
+
}, [onChange]);
|
|
7166
|
+
const handleKeyDown = useCallback((e) => {
|
|
7167
|
+
// block unwanted (but still valid) characters
|
|
7168
|
+
if (['e', 'E', '+', '-'].includes(e.key))
|
|
7169
|
+
return e.preventDefault();
|
|
7170
|
+
// close input when pressing escape
|
|
7171
|
+
if (e.key === 'Escape')
|
|
7172
|
+
return handleCloseInput();
|
|
7173
|
+
}, []);
|
|
7174
|
+
const handleOpenInput = useCallback(() => {
|
|
7175
|
+
setIsInputVisible(true);
|
|
7176
|
+
}, []);
|
|
7177
|
+
const handleCloseInput = useCallback(() => {
|
|
7178
|
+
setIsInputVisible(false);
|
|
7179
|
+
}, []);
|
|
7180
|
+
return (jsxs("div", { ref: sliderRef, className: "tw-relative tw-flex tw-h-[30px] tw-items-center tw-justify-center tw-rounded-squid-xs", children: [jsxs("button", { className: cn('tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-p-squid-xs tw-pr-[40px] tw-text-left tw-text-caption !tw-font-medium tw-leading-[10px] placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', value === 0 || value === undefined
|
|
7181
|
+
? 'tw-text-grey-600'
|
|
7182
|
+
: 'tw-text-grey-300', isInputVisible ? 'tw-bg-material-light-thin' : 'tw-bg-transparent', isSelected && 'tw-outline tw-outline-2 tw-outline-royal-500'), children: [value !== null && value !== void 0 ? value : 0, jsx(CaptionText, { className: "!tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: type === 'percentage' ? '%' : '$' })] }), jsx("button", { onClick: handleOpenInput, className: "tw-absolute tw-right-squid-xs tw-flex tw-h-[26px] tw-w-[26px] tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-xxs !tw-font-medium tw-leading-[10px] hover:tw-bg-material-light-thin", children: jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) }) }), isInputVisible && (jsx(Menu, { menuRef: menuRef, containerClassName: "tw-absolute tw-bottom-full tw-z-10 tw-pb-squid-m tw-w-[160px]", children: jsx("form", { onSubmit: (e) => {
|
|
7183
|
+
e.preventDefault();
|
|
7184
|
+
handleSubmit(inputValue);
|
|
7185
|
+
}, children: jsx(Input, { autoFocus: true, min: min, max: max, onKeyDown: handleKeyDown, step: decimalsFormat, placeholder: "0", type: "number", defaultValue: value, value: inputValue, onChange: (e) => {
|
|
7186
|
+
const isValid = e.target.checkValidity();
|
|
7187
|
+
if (!isValid)
|
|
7188
|
+
return;
|
|
7189
|
+
setInputValue(e.target.value);
|
|
7190
|
+
}, showIcon: false, actionButtonProps: {
|
|
7191
|
+
label: 'Ok',
|
|
7192
|
+
onClick: () => {
|
|
7193
|
+
handleSubmit(inputValue);
|
|
7194
|
+
},
|
|
7195
|
+
variant: 'primary',
|
|
7196
|
+
} }) }) }))] }));
|
|
7149
7197
|
}
|
|
7150
7198
|
|
|
7151
7199
|
const switchSizeClassMap = {
|
|
@@ -7231,7 +7279,7 @@ function generateMarkerLines(count) {
|
|
|
7231
7279
|
}
|
|
7232
7280
|
|
|
7233
7281
|
function SettingsButton({ label, isSelected = false, onClick, }) {
|
|
7234
|
-
return (jsx("button", { onClick: onClick, className: cn('tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline-royal-500'), children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
7282
|
+
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 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline tw-outline-2 tw-outline-royal-500'), children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
|
|
7235
7283
|
}
|
|
7236
7284
|
|
|
7237
7285
|
var v$5 = "5.10.0";
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonVariant } from '../../types/components';
|
|
2
3
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
4
|
placeholder?: string;
|
|
4
5
|
showIcon?: boolean;
|
|
5
|
-
showPasteButton?: boolean;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
isError?: boolean;
|
|
8
|
-
onPasteButtonClick?: () => void;
|
|
9
8
|
containerClassName?: string;
|
|
9
|
+
actionButtonProps?: InputActionButtonProps;
|
|
10
10
|
}
|
|
11
|
-
export declare function Input({ placeholder, showIcon,
|
|
11
|
+
export declare function Input({ placeholder, showIcon, className, icon, isError, containerClassName, actionButtonProps, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
type InputActionButtonProps = {
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
label?: string;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export interface SettingsSliderProps {
|
|
2
|
-
value: number;
|
|
2
|
+
value: number | undefined;
|
|
3
3
|
type: 'percentage' | 'amount';
|
|
4
|
-
onChange?: (value: number) => void;
|
|
5
|
-
|
|
4
|
+
onChange?: (value: number | undefined) => void;
|
|
5
|
+
decimalsFormat?: number;
|
|
6
6
|
min?: number;
|
|
7
7
|
max?: number;
|
|
8
|
+
isSelected?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare function SettingsSlider({ value, type, onChange,
|
|
10
|
+
export declare function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }: SettingsSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
import { TooltipProps } from '../controls';
|
|
3
3
|
export type SettingsControl = {
|
|
4
4
|
type: 'percentage';
|
|
5
|
-
value: number;
|
|
6
|
-
onChange: (value: number) => void;
|
|
5
|
+
value: number | undefined;
|
|
6
|
+
onChange: (value: number | undefined) => void;
|
|
7
7
|
min?: number;
|
|
8
8
|
max?: number;
|
|
9
|
-
|
|
9
|
+
decimalsFormat?: number;
|
|
10
10
|
resetValueControl: {
|
|
11
11
|
label: string;
|
|
12
12
|
onSelect: () => void;
|
|
13
|
-
value: number;
|
|
13
|
+
value: number | undefined;
|
|
14
14
|
};
|
|
15
15
|
} | {
|
|
16
16
|
type: 'amount';
|
|
17
|
-
value: number;
|
|
18
|
-
onChange: (value: number) => void;
|
|
17
|
+
value: number | undefined;
|
|
18
|
+
onChange: (value: number | undefined) => void;
|
|
19
19
|
options: {
|
|
20
20
|
value: number;
|
|
21
21
|
}[];
|
|
22
|
+
decimalsFormat?: number;
|
|
22
23
|
resetValueControl: {
|
|
23
24
|
label: string;
|
|
24
|
-
value: number;
|
|
25
|
+
value: number | undefined;
|
|
25
26
|
};
|
|
26
27
|
} | {
|
|
27
28
|
type: 'switch';
|
|
@@ -5,5 +5,5 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const WithoutIcon: Story;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const WithActionButton: Story;
|
|
9
9
|
export declare const Error: Story;
|
|
@@ -5,3 +5,7 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Percentage: Story;
|
|
7
7
|
export declare const Amount: Story;
|
|
8
|
+
export declare const PercentageWith1DecimalPlaceAllowed: Story;
|
|
9
|
+
export declare const AmountWith2DecimalPlacesAllowed: Story;
|
|
10
|
+
export declare const PercentageMax50: Story;
|
|
11
|
+
export declare const AmountMax999: Story;
|
package/dist/index.css
CHANGED
|
@@ -693,10 +693,6 @@ video {
|
|
|
693
693
|
left: 1.875rem;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
-
.tw-left-squid-xs {
|
|
697
|
-
left: 0.625rem;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
696
|
.tw-right-0 {
|
|
701
697
|
right: 0px;
|
|
702
698
|
}
|
|
@@ -928,6 +924,10 @@ video {
|
|
|
928
924
|
height: 240px;
|
|
929
925
|
}
|
|
930
926
|
|
|
927
|
+
.tw-h-\[26px\] {
|
|
928
|
+
height: 26px;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
931
|
.tw-h-\[30px\] {
|
|
932
932
|
height: 30px;
|
|
933
933
|
}
|
|
@@ -1157,6 +1157,10 @@ video {
|
|
|
1157
1157
|
width: 150px;
|
|
1158
1158
|
}
|
|
1159
1159
|
|
|
1160
|
+
.tw-w-\[160px\] {
|
|
1161
|
+
width: 160px;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1160
1164
|
.tw-w-\[180px\] {
|
|
1161
1165
|
width: 180px;
|
|
1162
1166
|
}
|
|
@@ -1169,6 +1173,10 @@ video {
|
|
|
1169
1173
|
width: 22px;
|
|
1170
1174
|
}
|
|
1171
1175
|
|
|
1176
|
+
.tw-w-\[26px\] {
|
|
1177
|
+
width: 26px;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1172
1180
|
.tw-w-\[299px\] {
|
|
1173
1181
|
width: 299px;
|
|
1174
1182
|
}
|
|
@@ -1229,14 +1237,6 @@ video {
|
|
|
1229
1237
|
width: 72px;
|
|
1230
1238
|
}
|
|
1231
1239
|
|
|
1232
|
-
.tw-w-\[80px\] {
|
|
1233
|
-
width: 80px;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
.tw-w-\[84px\] {
|
|
1237
|
-
width: 84px;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
1240
|
.tw-w-\[90px\] {
|
|
1241
1241
|
width: 90px;
|
|
1242
1242
|
}
|
|
@@ -1287,8 +1287,8 @@ video {
|
|
|
1287
1287
|
width: 3.75rem;
|
|
1288
1288
|
}
|
|
1289
1289
|
|
|
1290
|
-
|
|
1291
|
-
min-width: 0px;
|
|
1290
|
+
.\!tw-min-w-0 {
|
|
1291
|
+
min-width: 0px !important;
|
|
1292
1292
|
}
|
|
1293
1293
|
|
|
1294
1294
|
.tw-min-w-96 {
|
|
@@ -1378,11 +1378,6 @@ video {
|
|
|
1378
1378
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1379
1379
|
}
|
|
1380
1380
|
|
|
1381
|
-
.tw-translate-y-\[0\.5px\] {
|
|
1382
|
-
--tw-translate-y: 0.5px;
|
|
1383
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
1381
|
.tw-rotate-180 {
|
|
1387
1382
|
--tw-rotate: 180deg;
|
|
1388
1383
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -2037,11 +2032,6 @@ video {
|
|
|
2037
2032
|
padding: 3.75rem;
|
|
2038
2033
|
}
|
|
2039
2034
|
|
|
2040
|
-
.\!tw-px-2 {
|
|
2041
|
-
padding-left: 0.5rem !important;
|
|
2042
|
-
padding-right: 0.5rem !important;
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
2035
|
.\!tw-px-4 {
|
|
2046
2036
|
padding-left: 1rem !important;
|
|
2047
2037
|
padding-right: 1rem !important;
|
|
@@ -2082,11 +2072,6 @@ video {
|
|
|
2082
2072
|
padding-right: 3px;
|
|
2083
2073
|
}
|
|
2084
2074
|
|
|
2085
|
-
.tw-px-\[70px\] {
|
|
2086
|
-
padding-left: 70px;
|
|
2087
|
-
padding-right: 70px;
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
2075
|
.tw-px-squid-l {
|
|
2091
2076
|
padding-left: 1.875rem;
|
|
2092
2077
|
padding-right: 1.875rem;
|
|
@@ -2188,16 +2173,12 @@ video {
|
|
|
2188
2173
|
padding-left: 0.25rem;
|
|
2189
2174
|
}
|
|
2190
2175
|
|
|
2191
|
-
.tw-pl-\[20px\] {
|
|
2192
|
-
padding-left: 20px;
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
2176
|
.tw-pl-\[33px\] {
|
|
2196
2177
|
padding-left: 33px;
|
|
2197
2178
|
}
|
|
2198
2179
|
|
|
2199
|
-
.tw-pl-\[
|
|
2200
|
-
padding-left:
|
|
2180
|
+
.tw-pl-\[40px\] {
|
|
2181
|
+
padding-left: 40px;
|
|
2201
2182
|
}
|
|
2202
2183
|
|
|
2203
2184
|
.tw-pl-\[7px\] {
|
|
@@ -2228,12 +2209,12 @@ video {
|
|
|
2228
2209
|
padding-right: 1rem;
|
|
2229
2210
|
}
|
|
2230
2211
|
|
|
2231
|
-
.tw-pr-\[
|
|
2232
|
-
padding-right:
|
|
2212
|
+
.tw-pr-\[40px\] {
|
|
2213
|
+
padding-right: 40px;
|
|
2233
2214
|
}
|
|
2234
2215
|
|
|
2235
|
-
.tw-pr-\[
|
|
2236
|
-
padding-right:
|
|
2216
|
+
.tw-pr-\[70px\] {
|
|
2217
|
+
padding-right: 70px;
|
|
2237
2218
|
}
|
|
2238
2219
|
|
|
2239
2220
|
.tw-pr-squid-m {
|
package/dist/index.d.ts
CHANGED
|
@@ -124,13 +124,17 @@ declare function SettingsButton({ label, isSelected, onClick, }: SettingsButtonP
|
|
|
124
124
|
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
125
125
|
placeholder?: string;
|
|
126
126
|
showIcon?: boolean;
|
|
127
|
-
showPasteButton?: boolean;
|
|
128
127
|
icon?: React.ReactNode;
|
|
129
128
|
isError?: boolean;
|
|
130
|
-
onPasteButtonClick?: () => void;
|
|
131
129
|
containerClassName?: string;
|
|
130
|
+
actionButtonProps?: InputActionButtonProps;
|
|
132
131
|
}
|
|
133
|
-
declare function Input({ placeholder, showIcon,
|
|
132
|
+
declare function Input({ placeholder, showIcon, className, icon, isError, containerClassName, actionButtonProps, ...props }: InputProps): react_jsx_runtime.JSX.Element;
|
|
133
|
+
type InputActionButtonProps = {
|
|
134
|
+
onClick?: () => void;
|
|
135
|
+
variant?: ButtonVariant;
|
|
136
|
+
label?: string;
|
|
137
|
+
};
|
|
134
138
|
|
|
135
139
|
interface Token$1 {
|
|
136
140
|
price: number;
|
|
@@ -163,14 +167,15 @@ interface NumericInputProps {
|
|
|
163
167
|
declare function NumericInput({ priceImpactPercentage, balance, error, criticalPriceImpactPercentage, token, onAmountChange, forcedAmount, maxDecimals, formatIfVerySmall, showDetails, isLoading, direction, amountUsd, }: NumericInputProps): react_jsx_runtime.JSX.Element;
|
|
164
168
|
|
|
165
169
|
interface SettingsSliderProps {
|
|
166
|
-
value: number;
|
|
170
|
+
value: number | undefined;
|
|
167
171
|
type: 'percentage' | 'amount';
|
|
168
|
-
onChange?: (value: number) => void;
|
|
169
|
-
|
|
172
|
+
onChange?: (value: number | undefined) => void;
|
|
173
|
+
decimalsFormat?: number;
|
|
170
174
|
min?: number;
|
|
171
175
|
max?: number;
|
|
176
|
+
isSelected?: boolean;
|
|
172
177
|
}
|
|
173
|
-
declare function SettingsSlider({ value, type, onChange,
|
|
178
|
+
declare function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected, }: SettingsSliderProps): react_jsx_runtime.JSX.Element;
|
|
174
179
|
|
|
175
180
|
interface SwitchProps {
|
|
176
181
|
checked?: boolean;
|
|
@@ -297,26 +302,27 @@ declare function SectionTitle({ title, icon, accessory, actionIcon, className, .
|
|
|
297
302
|
|
|
298
303
|
type SettingsControl = {
|
|
299
304
|
type: 'percentage';
|
|
300
|
-
value: number;
|
|
301
|
-
onChange: (value: number) => void;
|
|
305
|
+
value: number | undefined;
|
|
306
|
+
onChange: (value: number | undefined) => void;
|
|
302
307
|
min?: number;
|
|
303
308
|
max?: number;
|
|
304
|
-
|
|
309
|
+
decimalsFormat?: number;
|
|
305
310
|
resetValueControl: {
|
|
306
311
|
label: string;
|
|
307
312
|
onSelect: () => void;
|
|
308
|
-
value: number;
|
|
313
|
+
value: number | undefined;
|
|
309
314
|
};
|
|
310
315
|
} | {
|
|
311
316
|
type: 'amount';
|
|
312
|
-
value: number;
|
|
313
|
-
onChange: (value: number) => void;
|
|
317
|
+
value: number | undefined;
|
|
318
|
+
onChange: (value: number | undefined) => void;
|
|
314
319
|
options: {
|
|
315
320
|
value: number;
|
|
316
321
|
}[];
|
|
322
|
+
decimalsFormat?: number;
|
|
317
323
|
resetValueControl: {
|
|
318
324
|
label: string;
|
|
319
|
-
value: number;
|
|
325
|
+
value: number | undefined;
|
|
320
326
|
};
|
|
321
327
|
} | {
|
|
322
328
|
type: 'switch';
|