@0xsquid/ui 2.6.3 → 2.6.5
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 +333 -148
- package/dist/cjs/types/components/buttons/Button.d.ts +4 -1
- package/dist/cjs/types/components/buttons/Chip.d.ts +1 -1
- package/dist/cjs/types/components/controls/LargeNumericInput.d.ts +6 -0
- package/dist/cjs/types/components/controls/NumericInput.d.ts +2 -1
- package/dist/cjs/types/components/controls/Switch.d.ts +1 -1
- package/dist/cjs/types/components/controls/index.d.ts +2 -1
- package/dist/cjs/types/components/icons/Generic.d.ts +8 -0
- package/dist/cjs/types/components/layout/AnimationWrapper.d.ts +3 -0
- package/dist/cjs/types/components/layout/ModalTitle.d.ts +5 -0
- package/dist/cjs/types/components/layout/SwapConfiguration.d.ts +3 -1
- package/dist/cjs/types/components/layout/index.d.ts +1 -0
- package/dist/cjs/types/components/lists/ListItem.d.ts +4 -1
- package/dist/cjs/types/core/utils.d.ts +7 -0
- package/dist/cjs/types/hooks/useColorFromSeed.d.ts +1 -0
- package/dist/cjs/types/stories/buttons/AssetsButton.stories.d.ts +1 -0
- package/dist/cjs/types/stories/buttons/Button.stories.d.ts +30 -15
- package/dist/cjs/types/stories/buttons/Chip.stories.d.ts +2 -1
- package/dist/cjs/types/stories/controls/Switch.stories.d.ts +5 -3
- package/dist/cjs/types/stories/lists/ListItem.stories.d.ts +3 -0
- package/dist/cjs/types/types/components.d.ts +1 -1
- package/dist/cjs/types/types/config.d.ts +3 -3
- package/dist/cjs/types/types/index.d.ts +1 -1
- package/dist/esm/index.js +329 -150
- package/dist/esm/types/components/buttons/Button.d.ts +4 -1
- package/dist/esm/types/components/buttons/Chip.d.ts +1 -1
- package/dist/esm/types/components/controls/LargeNumericInput.d.ts +6 -0
- package/dist/esm/types/components/controls/NumericInput.d.ts +2 -1
- package/dist/esm/types/components/controls/Switch.d.ts +1 -1
- package/dist/esm/types/components/controls/index.d.ts +2 -1
- package/dist/esm/types/components/icons/Generic.d.ts +8 -0
- package/dist/esm/types/components/layout/AnimationWrapper.d.ts +3 -0
- package/dist/esm/types/components/layout/ModalTitle.d.ts +5 -0
- package/dist/esm/types/components/layout/SwapConfiguration.d.ts +3 -1
- package/dist/esm/types/components/layout/index.d.ts +1 -0
- package/dist/esm/types/components/lists/ListItem.d.ts +4 -1
- package/dist/esm/types/core/utils.d.ts +7 -0
- package/dist/esm/types/hooks/useColorFromSeed.d.ts +1 -0
- package/dist/esm/types/stories/buttons/AssetsButton.stories.d.ts +1 -0
- package/dist/esm/types/stories/buttons/Button.stories.d.ts +30 -15
- package/dist/esm/types/stories/buttons/Chip.stories.d.ts +2 -1
- package/dist/esm/types/stories/controls/Switch.stories.d.ts +5 -3
- package/dist/esm/types/stories/lists/ListItem.stories.d.ts +3 -0
- package/dist/esm/types/types/components.d.ts +1 -1
- package/dist/esm/types/types/config.d.ts +3 -3
- package/dist/esm/types/types/index.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +51 -20
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -117,6 +117,13 @@ const THEME_COLOR_KEYS = [
|
|
|
117
117
|
"button-md-secondary-text",
|
|
118
118
|
"button-md-tertiary-bg",
|
|
119
119
|
"button-md-tertiary-text",
|
|
120
|
+
// sm button variant colors
|
|
121
|
+
"button-sm-primary-bg",
|
|
122
|
+
"button-sm-primary-text",
|
|
123
|
+
"button-sm-secondary-bg",
|
|
124
|
+
"button-sm-secondary-text",
|
|
125
|
+
"button-sm-tertiary-bg",
|
|
126
|
+
"button-sm-tertiary-text",
|
|
120
127
|
// input colors
|
|
121
128
|
"input-placeholder",
|
|
122
129
|
"input-text",
|
|
@@ -146,12 +153,18 @@ const THEME_COLOR_KEYS = [
|
|
|
146
153
|
"material-light-blend-grey-800",
|
|
147
154
|
];
|
|
148
155
|
const THEME_BORDER_RADIUS_KEYS = [
|
|
156
|
+
// lg button
|
|
149
157
|
"button-lg-primary",
|
|
150
158
|
"button-lg-secondary",
|
|
151
159
|
"button-lg-tertiary",
|
|
160
|
+
// md button
|
|
152
161
|
"button-md-primary",
|
|
153
162
|
"button-md-secondary",
|
|
154
163
|
"button-md-tertiary",
|
|
164
|
+
// sm button
|
|
165
|
+
"button-sm-primary",
|
|
166
|
+
"button-sm-secondary",
|
|
167
|
+
"button-sm-tertiary",
|
|
155
168
|
"container",
|
|
156
169
|
"input",
|
|
157
170
|
"menu-sm",
|
|
@@ -2953,6 +2966,19 @@ function mapToCssVariables(obj) {
|
|
|
2953
2966
|
return acc;
|
|
2954
2967
|
}, {});
|
|
2955
2968
|
}
|
|
2969
|
+
/**
|
|
2970
|
+
* Simple hash function to create a deterministic index from a given string.
|
|
2971
|
+
* @param {string} str - The input string to hash.
|
|
2972
|
+
* @param {number} max - The maximum value for the hash.
|
|
2973
|
+
* @returns {number} - The index within the array.
|
|
2974
|
+
*/
|
|
2975
|
+
function hashStringToIndex(str, max) {
|
|
2976
|
+
let index = 0;
|
|
2977
|
+
for (let i = 0; i < str.length; i++) {
|
|
2978
|
+
index = (index * 31 + str.charCodeAt(i)) % max;
|
|
2979
|
+
}
|
|
2980
|
+
return index;
|
|
2981
|
+
}
|
|
2956
2982
|
|
|
2957
2983
|
const spacing$1 = {
|
|
2958
2984
|
"squid-xxs": "0.3125rem", // 5px
|
|
@@ -3347,12 +3373,18 @@ const defaultFontFamily = {
|
|
|
3347
3373
|
"squid-main": "Geist, sans-serif",
|
|
3348
3374
|
};
|
|
3349
3375
|
const defaultBorderRadius = {
|
|
3376
|
+
// lg button
|
|
3350
3377
|
"button-lg-primary": spacing$1["squid-xxl"],
|
|
3351
3378
|
"button-lg-secondary": spacing$1["squid-xxl"],
|
|
3352
3379
|
"button-lg-tertiary": spacing$1["squid-xxl"],
|
|
3380
|
+
// md button
|
|
3353
3381
|
"button-md-primary": spacing$1["squid-m"],
|
|
3354
3382
|
"button-md-secondary": spacing$1["squid-m"],
|
|
3355
3383
|
"button-md-tertiary": spacing$1["squid-m"],
|
|
3384
|
+
// sm button
|
|
3385
|
+
"button-sm-primary": spacing$1["squid-m"],
|
|
3386
|
+
"button-sm-secondary": spacing$1["squid-m"],
|
|
3387
|
+
"button-sm-tertiary": spacing$1["squid-m"],
|
|
3356
3388
|
container: spacing$1["squid-l"],
|
|
3357
3389
|
input: "9999px",
|
|
3358
3390
|
"menu-sm": spacing$1["squid-s"],
|
|
@@ -3394,18 +3426,27 @@ const lightTheme = {
|
|
|
3394
3426
|
"animation-bg": "#B893EC",
|
|
3395
3427
|
"animation-text": "#FBFBFD",
|
|
3396
3428
|
// buttons
|
|
3429
|
+
// lg button
|
|
3397
3430
|
"button-lg-primary-bg": "#B893EC",
|
|
3398
3431
|
"button-lg-primary-text": "#FBFBFD",
|
|
3399
3432
|
"button-lg-secondary-bg": "#17191C",
|
|
3400
3433
|
"button-lg-secondary-text": "#EDEEF3",
|
|
3401
3434
|
"button-lg-tertiary-bg": "#EDEEF3",
|
|
3402
3435
|
"button-lg-tertiary-text": "#292C32",
|
|
3436
|
+
// md button
|
|
3403
3437
|
"button-md-primary-bg": "#B893EC",
|
|
3404
3438
|
"button-md-primary-text": "#FBFBFD",
|
|
3405
3439
|
"button-md-secondary-bg": "#17191C",
|
|
3406
3440
|
"button-md-secondary-text": "#EDEEF3",
|
|
3407
3441
|
"button-md-tertiary-bg": "#EDEEF3",
|
|
3408
3442
|
"button-md-tertiary-text": "#292C32",
|
|
3443
|
+
// sm button
|
|
3444
|
+
"button-sm-primary-bg": "#B893EC",
|
|
3445
|
+
"button-sm-primary-text": "#FBFBFD",
|
|
3446
|
+
"button-sm-secondary-bg": "#17191C",
|
|
3447
|
+
"button-sm-secondary-text": "#EDEEF3",
|
|
3448
|
+
"button-sm-tertiary-bg": "#EDEEF3",
|
|
3449
|
+
"button-sm-tertiary-text": "#292C32",
|
|
3409
3450
|
// input
|
|
3410
3451
|
"input-bg": "#FBFBFD",
|
|
3411
3452
|
"input-placeholder": "#A7ABBE",
|
|
@@ -3454,18 +3495,27 @@ const darkTheme = {
|
|
|
3454
3495
|
"animation-bg": "#9E79D2",
|
|
3455
3496
|
"animation-text": "#FBFBFD",
|
|
3456
3497
|
// buttons
|
|
3498
|
+
// lg button
|
|
3457
3499
|
"button-lg-primary-bg": "#9E79D2",
|
|
3458
3500
|
"button-lg-primary-text": "#FBFBFD",
|
|
3459
3501
|
"button-lg-secondary-bg": "#FBFBFD",
|
|
3460
3502
|
"button-lg-secondary-text": "#292C32",
|
|
3461
3503
|
"button-lg-tertiary-bg": "#292C32",
|
|
3462
3504
|
"button-lg-tertiary-text": "#D1D6E0",
|
|
3505
|
+
// md button
|
|
3463
3506
|
"button-md-primary-bg": "#9E79D2",
|
|
3464
3507
|
"button-md-primary-text": "#FBFBFD",
|
|
3465
3508
|
"button-md-secondary-bg": "#FBFBFD",
|
|
3466
3509
|
"button-md-secondary-text": "#292C32",
|
|
3467
3510
|
"button-md-tertiary-bg": "#292C32",
|
|
3468
3511
|
"button-md-tertiary-text": "#D1D6E0",
|
|
3512
|
+
// sm button
|
|
3513
|
+
"button-sm-primary-bg": "#9E79D2",
|
|
3514
|
+
"button-sm-primary-text": "#FBFBFD",
|
|
3515
|
+
"button-sm-secondary-bg": "#FBFBFD",
|
|
3516
|
+
"button-sm-secondary-text": "#292C32",
|
|
3517
|
+
"button-sm-tertiary-bg": "#292C32",
|
|
3518
|
+
"button-sm-tertiary-text": "#D1D6E0",
|
|
3469
3519
|
// input
|
|
3470
3520
|
"input-bg": "#17191C",
|
|
3471
3521
|
"input-placeholder": "#676B7E",
|
|
@@ -3544,7 +3594,7 @@ const boxShadowClassMap = {
|
|
|
3544
3594
|
xlarge: "tw-shadow-elevation-light-2",
|
|
3545
3595
|
xxlarge: "tw-shadow-elevation-dark-1",
|
|
3546
3596
|
};
|
|
3547
|
-
const roundedClassMap
|
|
3597
|
+
const roundedClassMap = {
|
|
3548
3598
|
xxs: "tw-rounded-squid-xxs",
|
|
3549
3599
|
xs: "tw-rounded-squid-xs",
|
|
3550
3600
|
s: "tw-rounded-squid-s",
|
|
@@ -3573,7 +3623,7 @@ const borderClassMap = {
|
|
|
3573
3623
|
};
|
|
3574
3624
|
function Image$1(_a) {
|
|
3575
3625
|
var { src, size = "medium", className: propsClassName, placeholderImageUrl, border = "none", rounded = "xxs", shadow = false, children, containerProps } = _a, props = __rest$1(_a, ["src", "size", "className", "placeholderImageUrl", "border", "rounded", "shadow", "children", "containerProps"]);
|
|
3576
|
-
const className = cn("tw-object-cover tw-aspect-square tw-relative tw-duration-300 tw-transition-[width,height] tw-max-w-full tw-bg-grey-500", sizeClassMap$1[size], propsClassName, roundedClassMap
|
|
3626
|
+
const className = cn("tw-object-cover tw-aspect-square tw-relative tw-duration-300 tw-transition-[width,height] tw-max-w-full tw-bg-grey-500", sizeClassMap$1[size], propsClassName, roundedClassMap[rounded], shadow && boxShadowClassMap[size], borderClassMap[border]);
|
|
3577
3627
|
const [imageState, setImageState] = React$1.useState(exports.ImageState.LOADED);
|
|
3578
3628
|
return (jsxRuntime.jsxs("div", Object.assign({}, containerProps, { className: cn("tw-relative", containerProps === null || containerProps === void 0 ? void 0 : containerProps.className), children: [border === "gradient" && (jsxRuntime.jsx("span", { style: {
|
|
3579
3629
|
borderRadius: gradientRoundedClassMap[rounded],
|
|
@@ -4032,6 +4082,12 @@ function ArrowExpandIcon({ className, size = "24", }) {
|
|
|
4032
4082
|
function MoneyBagIcon({ className, size = "24", }) {
|
|
4033
4083
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M9.5 8H14.5M9.5 8C9.5 8 3.99996 11 4 16C4.00003 20.0207 7.97931 21 12 21C16.0207 21 20 20.0207 20 16C20 11 14.5 8 14.5 8M9.5 8L8.55725 5.48601C8.23089 4.6157 8.56249 3.64123 9.45158 3.37016C10.1074 3.1702 10.9686 3 12 3C13.0314 3 13.8926 3.1702 14.5484 3.37016C15.4375 3.64123 15.7691 4.6157 15.4427 5.48601L14.5 8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
4034
4084
|
}
|
|
4085
|
+
function PluginIcon({ size = "16", className, }) {
|
|
4086
|
+
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M6.66675 1.99998C6.66675 1.63179 6.36827 1.33331 6.00008 1.33331C5.63189 1.33331 5.33341 1.63179 5.33341 1.99998V3.99998H4.66675C3.56218 3.99998 2.66675 4.89541 2.66675 5.99998V9.33331C2.66675 11.1743 4.15913 12.6666 6.00008 12.6666H7.33341V14C7.33341 14.3682 7.63189 14.6666 8.00008 14.6666C8.36827 14.6666 8.66675 14.3682 8.66675 14V12.6666H10.0001C11.841 12.6666 13.3334 11.1743 13.3334 9.33331V5.99998C13.3334 4.89541 12.438 3.99998 11.3334 3.99998H10.6667V1.99998C10.6667 1.63179 10.3683 1.33331 10.0001 1.33331C9.63189 1.33331 9.33341 1.63179 9.33341 1.99998V3.99998H6.66675V1.99998Z", fill: "currentColor" }) }));
|
|
4087
|
+
}
|
|
4088
|
+
function CircleCheckIcon({ className, size = "24", }) {
|
|
4089
|
+
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM15.774 10.1333C16.1237 9.70582 16.0607 9.0758 15.6332 8.72607C15.2058 8.37635 14.5758 8.43935 14.226 8.86679L10.4258 13.5116L9.20711 12.2929C8.81658 11.9024 8.18342 11.9024 7.79289 12.2929C7.40237 12.6834 7.40237 13.3166 7.79289 13.7071L9.79289 15.7071C9.99267 15.9069 10.2676 16.0129 10.5498 15.9988C10.832 15.9847 11.095 15.8519 11.274 15.6333L15.774 10.1333Z", fill: "currentColor" }) }));
|
|
4090
|
+
}
|
|
4035
4091
|
|
|
4036
4092
|
function EmptyHeartIcon({ className }) {
|
|
4037
4093
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", className: className, children: jsxRuntime.jsx("path", { d: "M21 10C21 15.75 12.75 20 12 20C11.25 20 3 15.75 3 10C3 6 5.5 4 8 4C10.5 4 12 5.5 12 5.5C12 5.5 13.5 4 16 4C18.5 4 21 6 21 10Z", stroke: "currentColor", strokeWidth: "2", strokeLinejoin: "round" }) }));
|
|
@@ -4395,19 +4451,28 @@ function ImageStack(_a) {
|
|
|
4395
4451
|
|
|
4396
4452
|
function Chip(_a) {
|
|
4397
4453
|
var { label, icon } = _a, props = __rest$1(_a, ["label", "icon"]);
|
|
4398
|
-
|
|
4454
|
+
const isInteractive = !!props.onClick;
|
|
4455
|
+
const ChipTag = isInteractive ? "button" : "div";
|
|
4456
|
+
return (jsxRuntime.jsx(ChipTag, Object.assign({}, props, { className: cn("tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900", icon && "tw-w-squid-m", isInteractive && "hover:tw-bg-grey-300", props.className), children: label ? (jsxRuntime.jsx(CaptionText, { className: "tw-min-w-squid-xl tw-text-nowrap tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
|
|
4399
4457
|
}
|
|
4400
4458
|
|
|
4459
|
+
const loaderSizeMap = {
|
|
4460
|
+
sm: "16px",
|
|
4461
|
+
md: "24px",
|
|
4462
|
+
lg: "36px",
|
|
4463
|
+
};
|
|
4401
4464
|
const baseButtonClassName = "tw-border tw-relative tw-overflow-hidden tw-group/base-button tw-flex tw-items-center tw-justify-center";
|
|
4402
4465
|
const buttonWidthClassnameMap = {
|
|
4466
|
+
sm: "tw-w-max",
|
|
4403
4467
|
md: "tw-min-w-[60px]",
|
|
4404
4468
|
lg: "tw-w-full",
|
|
4405
4469
|
};
|
|
4406
4470
|
const buttonSizeClassMap = {
|
|
4407
4471
|
md: "tw-px-squid-xs tw-py-squid-xxs tw-h-squid-xl",
|
|
4408
4472
|
lg: "tw-p-1 tw-h-button",
|
|
4473
|
+
sm: "tw-h-squid-l tw-px-squid-xs",
|
|
4409
4474
|
};
|
|
4410
|
-
const
|
|
4475
|
+
const buttonRoundedClassMap = {
|
|
4411
4476
|
lg: {
|
|
4412
4477
|
primary: "tw-rounded-button-lg-primary",
|
|
4413
4478
|
secondary: "tw-rounded-button-lg-secondary",
|
|
@@ -4418,6 +4483,11 @@ const roundedClassMap = {
|
|
|
4418
4483
|
secondary: "tw-rounded-button-md-secondary",
|
|
4419
4484
|
tertiary: "tw-rounded-button-md-tertiary",
|
|
4420
4485
|
},
|
|
4486
|
+
sm: {
|
|
4487
|
+
primary: "tw-rounded-button-sm-primary",
|
|
4488
|
+
secondary: "tw-rounded-button-sm-secondary",
|
|
4489
|
+
tertiary: "tw-rounded-button-sm-tertiary",
|
|
4490
|
+
},
|
|
4421
4491
|
};
|
|
4422
4492
|
const buttonVariantClassMap = {
|
|
4423
4493
|
lg: {
|
|
@@ -4430,22 +4500,24 @@ const buttonVariantClassMap = {
|
|
|
4430
4500
|
secondary: "tw-bg-button-md-secondary-bg tw-text-button-md-secondary-text",
|
|
4431
4501
|
tertiary: "tw-bg-button-md-tertiary-bg tw-text-button-md-tertiary-text",
|
|
4432
4502
|
},
|
|
4503
|
+
sm: {
|
|
4504
|
+
primary: "tw-bg-button-sm-primary-bg tw-text-button-sm-primary-text",
|
|
4505
|
+
secondary: "tw-bg-button-sm-secondary-bg tw-text-button-sm-secondary-text",
|
|
4506
|
+
tertiary: "tw-bg-button-sm-tertiary-bg tw-text-button-sm-tertiary-text",
|
|
4507
|
+
},
|
|
4433
4508
|
};
|
|
4434
4509
|
// right now all variants have the same disabled styles
|
|
4435
4510
|
// in the future, we can add more disabled styles for different variants
|
|
4436
4511
|
const buttonDisabledClass = "!tw-bg-grey-800 !tw-text-grey-600 tw-cursor-not-allowed";
|
|
4437
4512
|
const loadingClassname = "tw-invisible tw-opacity-0";
|
|
4438
4513
|
function Button$1(_a) {
|
|
4439
|
-
var { label, disabled = false, size, variant, icon, link, isLoading = false, showLoader = false, chip, containerClassName, anchorRef, buttonRef } = _a, props = __rest$1(_a, ["label", "disabled", "size", "variant", "icon", "link", "isLoading", "showLoader", "chip", "containerClassName", "anchorRef", "buttonRef"]);
|
|
4514
|
+
var { label, disabled = false, size, variant, icon, link, isLoading = false, showLoader = false, loaderSize = "md", chip, containerClassName, anchorRef, buttonRef } = _a, props = __rest$1(_a, ["label", "disabled", "size", "variant", "icon", "link", "isLoading", "showLoader", "loaderSize", "chip", "containerClassName", "anchorRef", "buttonRef"]);
|
|
4440
4515
|
const chipElement = chip != null ? (jsxRuntime.jsx(Chip, Object.assign({}, chip, { className: cn("tw-absolute -tw-right-squid-xxs -tw-top-squid-xxs tw-z-10", chip.className) }))) : null;
|
|
4441
|
-
const children = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!disabled && !isLoading && (jsxRuntime.jsx(ButtonHoverOverlay, { className:
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
// icon and label
|
|
4447
|
-
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [icon, jsxRuntime.jsx(BodyText, { className: "tw-pr-1", size: "small", children: label })] }))) : null })] }));
|
|
4448
|
-
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonWidthClassnameMap[size], buttonVariantClassMap[size][variant], "tw-border-material-light-thin", !disabled && !isLoading && "hover:tw-border-material-light-average", roundedClassMap[size][variant],
|
|
4516
|
+
const children = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!disabled && !isLoading && (jsxRuntime.jsx(ButtonHoverOverlay, { className: buttonRoundedClassMap[size][variant] })), jsxRuntime.jsx("div", { className: "tw-relative tw-z-[5] tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs", children: label == null && icon == null && !showLoader ? (props.children) : (jsxRuntime.jsxs("span", { className: cn("tw-flex tw-items-center tw-justify-center", size === "lg"
|
|
4517
|
+
? "tw-gap-squid-xs tw-px-squid-m"
|
|
4518
|
+
: "tw-gap-squid-xxs"), children: [showLoader && jsxRuntime.jsx(Loader, { size: loaderSizeMap[loaderSize] }), !isLoading && icon, label != null &&
|
|
4519
|
+
(size === "sm" ? (jsxRuntime.jsx(CaptionText, { className: cn(isLoading && loadingClassname, icon != null && "tw-pr-1"), children: label })) : (jsxRuntime.jsx(BodyText, { className: cn(isLoading && loadingClassname, icon != null && "tw-pr-1"), size: size === "lg" ? "medium" : "small", children: label })))] })) })] }));
|
|
4520
|
+
const className = cn(baseButtonClassName, buttonSizeClassMap[size], buttonWidthClassnameMap[size], buttonVariantClassMap[size][variant], "tw-border-material-light-thin", !disabled && !isLoading && "hover:tw-border-material-light-average", buttonRoundedClassMap[size][variant],
|
|
4449
4521
|
// disabled styles
|
|
4450
4522
|
disabled && buttonDisabledClass, isLoading && "tw-cursor-not-allowed",
|
|
4451
4523
|
// custom classes from props
|
|
@@ -4463,7 +4535,7 @@ function Button$1(_a) {
|
|
|
4463
4535
|
const ButtonHoverOverlay = ({ className }) => {
|
|
4464
4536
|
return (jsxRuntime.jsx("span", { className: cn("tw-absolute tw-inset-0 tw-z-0 tw-hidden tw-h-full tw-w-full tw-bg-material-light-thin group-hover/base-button:tw-block", className) }));
|
|
4465
4537
|
};
|
|
4466
|
-
const ButtonWrapper = ({ children, size, variant, className, }) => (jsxRuntime.jsx("div", { className: cn("tw-relative", buttonWidthClassnameMap[size],
|
|
4538
|
+
const ButtonWrapper = ({ children, size, variant, className, }) => (jsxRuntime.jsx("div", { className: cn("tw-relative", buttonWidthClassnameMap[size], buttonRoundedClassMap[size][variant], className), children: children }));
|
|
4467
4539
|
|
|
4468
4540
|
function AccountsButton(_a) {
|
|
4469
4541
|
var { imageUrls } = _a, props = __rest$1(_a, ["imageUrls"]);
|
|
@@ -4489,6 +4561,26 @@ function ArrowButton(_a) {
|
|
|
4489
4561
|
"aria-disabled:tw-bg-grey-600 aria-disabled:tw-text-grey-800"), children: jsxRuntime.jsx(ArrowRightIcon, {}) })] })));
|
|
4490
4562
|
}
|
|
4491
4563
|
|
|
4564
|
+
const colors = [
|
|
4565
|
+
"#D94E41",
|
|
4566
|
+
"#E58845",
|
|
4567
|
+
"#D9BA21",
|
|
4568
|
+
"#B1CC29",
|
|
4569
|
+
"#66CC33",
|
|
4570
|
+
"#19A654",
|
|
4571
|
+
"#56BFB6",
|
|
4572
|
+
"#45B0E5",
|
|
4573
|
+
"#3973E5",
|
|
4574
|
+
"#7562D9",
|
|
4575
|
+
"#B167E5",
|
|
4576
|
+
"#E573BF",
|
|
4577
|
+
];
|
|
4578
|
+
function useColorFromSeed(seed) {
|
|
4579
|
+
return React$1.useMemo(() => {
|
|
4580
|
+
return colors[hashStringToIndex(seed, colors.length)];
|
|
4581
|
+
}, [seed]);
|
|
4582
|
+
}
|
|
4583
|
+
|
|
4492
4584
|
function Input(_a) {
|
|
4493
4585
|
var { placeholder = "Search", showIcon = true, className, icon, isError = false, isWarning = false, containerClassName, actionButtonProps, autoFocusTimeout, inputRef: inputRefProp } = _a, props = __rest$1(_a, ["placeholder", "showIcon", "className", "icon", "isError", "isWarning", "containerClassName", "actionButtonProps", "autoFocusTimeout", "inputRef"]);
|
|
4494
4586
|
const showActionButton = actionButtonProps != null;
|
|
@@ -4511,6 +4603,40 @@ const InputActionButton = ({ onClick, variant = "tertiary", label = "Paste", })
|
|
|
4511
4603
|
return (jsxRuntime.jsx(Button$1, { size: "md", variant: variant, onClick: onClick, className: "!tw-h-[30px] !tw-w-fit !tw-min-w-0 !tw-rounded-input", children: jsxRuntime.jsx(CaptionText, { children: label }) }));
|
|
4512
4604
|
};
|
|
4513
4605
|
|
|
4606
|
+
const placeholder = "0";
|
|
4607
|
+
const suggestedAmounts = ["100", "500", "1000"];
|
|
4608
|
+
function LargeNumericInput({ onChange, value }) {
|
|
4609
|
+
const inputRef = React$1.useRef(null);
|
|
4610
|
+
const inputValueSpyRef = React$1.useRef(null);
|
|
4611
|
+
React$1.useEffect(() => {
|
|
4612
|
+
const observer = new ResizeObserver((entries) => {
|
|
4613
|
+
var _a;
|
|
4614
|
+
if (!inputRef.current)
|
|
4615
|
+
return;
|
|
4616
|
+
// update input width to match the width of the invisible span
|
|
4617
|
+
// this is needed to center the input
|
|
4618
|
+
inputRef.current.style.width = `${(_a = entries[0]) === null || _a === void 0 ? void 0 : _a.contentRect.width}px`;
|
|
4619
|
+
});
|
|
4620
|
+
if (inputValueSpyRef.current) {
|
|
4621
|
+
observer.observe(inputValueSpyRef.current);
|
|
4622
|
+
}
|
|
4623
|
+
return () => {
|
|
4624
|
+
observer.disconnect();
|
|
4625
|
+
};
|
|
4626
|
+
}, []);
|
|
4627
|
+
const handleInputChange = React$1.useCallback((event) => {
|
|
4628
|
+
// Replace commas with dots
|
|
4629
|
+
const value = event.target.value.replace(/,/g, ".");
|
|
4630
|
+
// Check that the input value is a valid number
|
|
4631
|
+
const isValidAmount = /^\d*\.?\d{0,6}$/.test(value);
|
|
4632
|
+
if (isValidAmount)
|
|
4633
|
+
onChange(value || "");
|
|
4634
|
+
}, [onChange]);
|
|
4635
|
+
return (jsxRuntime.jsxs("section", { className: "tw-flex tw-flex-1 tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-px-squid-l tw-pb-squid-m", children: [jsxRuntime.jsxs("div", { className: "tw-relative tw-flex tw-w-full tw-flex-1 tw-items-center tw-justify-center tw-self-stretch tw-text-7xl tw-text-royal-500", children: [jsxRuntime.jsx("span", { ref: inputValueSpyRef, className: "tw-pointer-events-none tw-absolute tw-opacity-0", children: value || placeholder }), jsxRuntime.jsx("span", { children: "$" }), jsxRuntime.jsx("input", { inputMode: "decimal", pattern: "[0-9.,]*", ref: inputRef, value: value, onChange: handleInputChange, className: "tw-max-w-full tw-bg-transparent tw-placeholder-royal-500 tw-outline-none focus:tw-outline-none", placeholder: placeholder })] }), jsxRuntime.jsx("footer", { className: "tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-gap-squid-xxs tw-self-stretch", children: suggestedAmounts.map((amount) => (jsxRuntime.jsx(Chip, { label: `$${amount}`, onClick: () => {
|
|
4636
|
+
onChange(amount);
|
|
4637
|
+
} }, amount))) })] }));
|
|
4638
|
+
}
|
|
4639
|
+
|
|
4514
4640
|
/*
|
|
4515
4641
|
* bignumber.js v9.1.2
|
|
4516
4642
|
* A JavaScript library for arbitrary-precision arithmetic.
|
|
@@ -8639,6 +8765,12 @@ const AnimationWrapper = (playerProps) => {
|
|
|
8639
8765
|
}, []);
|
|
8640
8766
|
return (jsxRuntime.jsx("div", { id: "squid-lottie-animation", className: clsx("tw-h-full [&>*]:tw-h-full", "tw-transition-all", display ? "tw-opacity-100" : "tw-opacity-0"), children: showAnimation && jsxRuntime.jsx(Player, Object.assign({}, playerProps)) }));
|
|
8641
8767
|
};
|
|
8768
|
+
function AnimationCard({ children }) {
|
|
8769
|
+
return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-[130px] tw-w-full tw-items-center tw-justify-center tw-rounded-tl-modal tw-rounded-tr-modal tw-bg-animation-bg tw-py-squid-s tw-text-material-light-thin mobile-xs-height:tw-h-[160px]", style: {
|
|
8770
|
+
// box shadow simulating bottom outline (we do not use css outline because cannot apply it to only one side)
|
|
8771
|
+
boxShadow: "0 1px 0 currentColor",
|
|
8772
|
+
}, children: children }));
|
|
8773
|
+
}
|
|
8642
8774
|
|
|
8643
8775
|
const borderRadiusClassMap = {
|
|
8644
8776
|
sm: "tw-rounded-menu-sm before:tw-rounded-menu-sm",
|
|
@@ -18935,6 +19067,10 @@ function ModalContentDivider() {
|
|
|
18935
19067
|
return (jsxRuntime.jsx("svg", { width: "100%", height: "11", viewBox: "0 0 400 11", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("rect", { x: "1", y: "5", width: "398", height: "1", fill: "currentColor" }) }));
|
|
18936
19068
|
}
|
|
18937
19069
|
|
|
19070
|
+
function ModalTitle({ title }) {
|
|
19071
|
+
return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xxl tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-px-squid-m tw-py-squid-xs", children: jsxRuntime.jsx(BodyText, { size: "small", children: title }) }));
|
|
19072
|
+
}
|
|
19073
|
+
|
|
18938
19074
|
function NavigationBar(_a) {
|
|
18939
19075
|
var { title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, actions, isLoading = false, subtitle, paddingRight = 0 } = _a, props = __rest$1(_a, ["title", "displayBackButton", "logoUrl", "transparent", "displayButtonShadows", "onBackButtonClick", "actions", "isLoading", "subtitle", "paddingRight"]);
|
|
18940
19076
|
return (jsxRuntime.jsxs("nav", Object.assign({}, props, { className: cn("tw-flex tw-max-h-[120px] tw-flex-row-reverse tw-text-grey-300 mobile-xs-height:tw-flex-col", transparent ? "tw-bg-transparent" : "tw-bg-grey-900", props.className), children: [jsxRuntime.jsxs("div", { className: cn("tw-flex tw-h-squid-xxl tw-items-center tw-justify-end tw-gap-x-squid-xs tw-pl-squid-m", displayBackButton
|
|
@@ -18992,7 +19128,7 @@ function LogoContainer({ children }) {
|
|
|
18992
19128
|
return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
|
|
18993
19129
|
}
|
|
18994
19130
|
|
|
18995
|
-
function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = "from", onAmountChange, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, maxUsdDecimals, isInputInteractive = true, isLoading = false, inputModeButton, balanceButton, assetsButton, walletButton, showNumericInputDetails = true, }) {
|
|
19131
|
+
function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp = false, chain, token, direction = "from", onAmountChange, balance, criticalPriceImpactPercentage, error, priceImpactPercentage, maxUsdDecimals, isInputInteractive = true, isLoading = false, inputModeButton, balanceButton, assetsButton, walletButton, showNumericInputDetails = true, fullHeight = true, debounceInput = true, }) {
|
|
18996
19132
|
var _a, _b;
|
|
18997
19133
|
const isWalletButtonInteractive = !isLoading && !!(walletButton === null || walletButton === void 0 ? void 0 : walletButton.onClick);
|
|
18998
19134
|
const WalletButtonTag = isWalletButtonInteractive ? "button" : "div";
|
|
@@ -19001,7 +19137,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp
|
|
|
19001
19137
|
!(walletButton === null || walletButton === void 0 ? void 0 : walletButton.disabled) &&
|
|
19002
19138
|
!!token &&
|
|
19003
19139
|
(!!(walletButton === null || walletButton === void 0 ? void 0 : walletButton.address) || !!(walletButton === null || walletButton === void 0 ? void 0 : walletButton.emptyAddressLabel));
|
|
19004
|
-
return (jsxRuntime.jsxs("section", { className: "tw-relative tw-flex tw-
|
|
19140
|
+
return (jsxRuntime.jsxs("section", { className: cn("tw-relative tw-flex tw-w-full tw-flex-col tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 mobile-lg:tw-w-card-large", fullHeight && "tw-h-full tw-pb-squid-m"), children: [jsxRuntime.jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-m tw-py-squid-xs tw-leading-5 tw-text-grey-300 mobile-lg:tw-px-squid-l", children: jsxRuntime.jsx(Tooltip, Object.assign({}, walletButton === null || walletButton === void 0 ? void 0 : walletButton.tooltip, { tooltipWidth: "max", childrenClassName: "tw-rounded-squid-s", containerClassName: "tw-rounded-squid-s", children: jsxRuntime.jsxs(WalletButtonTag, { onClick: isWalletButtonInteractive ? walletButton === null || walletButton === void 0 ? void 0 : walletButton.onClick : undefined, className: cn("-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600", isWalletButtonInteractive && "hover:tw-bg-material-light-thin", isLoading && "tw-opacity-50"), children: [jsxRuntime.jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === "from" ? "Pay" : "Receive" }), showWalletButtonLabel && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(BodyText, { size: "small", children: ":" }), jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsxRuntime.jsx(BodyText, { size: "small", className: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
19005
19141
|
? "tw-text-grey-300"
|
|
19006
19142
|
: "tw-text-royal-500", children: (walletButton === null || walletButton === void 0 ? void 0 : walletButton.address)
|
|
19007
19143
|
? walletButton === null || walletButton === void 0 ? void 0 : walletButton.address
|
|
@@ -19016,7 +19152,7 @@ function SwapConfiguration({ amount, tokenPrice = 0, isFetching: isFetchingProp
|
|
|
19016
19152
|
}, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
|
|
19017
19153
|
token: "0.001",
|
|
19018
19154
|
usd: "0.01",
|
|
19019
|
-
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: showNumericInputDetails, direction: direction, forcedAmount: amount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading })] }));
|
|
19155
|
+
}, maxUsdDecimals: maxUsdDecimals, isLoading: isFetching, priceImpactPercentage: priceImpactPercentage, showDetails: showNumericInputDetails, direction: direction, forcedAmount: amount, inputModeButton: inputModeButton, balanceButton: balanceButton, isInteractive: isInputInteractive && !isLoading, debounceInput: debounceInput })] }));
|
|
19020
19156
|
}
|
|
19021
19157
|
|
|
19022
19158
|
function AccountListItem({ isConnected, imageUrls = [], imageUrl, badgeUrl, actions, subtitle, title, }) {
|
|
@@ -19382,7 +19518,7 @@ const collapsedListItemClassMap = {
|
|
|
19382
19518
|
large: "tw-w-[80px]",
|
|
19383
19519
|
};
|
|
19384
19520
|
function ListItem(_a) {
|
|
19385
|
-
var { itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size = "large", mainIcon, className, isSelected = false, onDetailClick, showDetailOnHoverOnly, rounded = "xxs", detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding = true, itemsContainerRef, dropdownMenuContent, imageGroup, multilineSubtitle = false } = _a, props = __rest$1(_a, ["itemTitle", "mainImageUrl", "subtitle", "subtitleOnHover", "detail", "icon", "secondaryImageUrl", "placeholderImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps", "compactOnMobile", "extraPadding", "itemsContainerRef", "dropdownMenuContent", "imageGroup", "multilineSubtitle"]);
|
|
19521
|
+
var { itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size = "large", mainIcon, className, isSelected = false, onDetailClick, showDetailOnHoverOnly, rounded = "xxs", detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding = true, itemsContainerRef, dropdownMenuContent, imageGroup, multilineSubtitle = false, control } = _a, props = __rest$1(_a, ["itemTitle", "mainImageUrl", "subtitle", "subtitleOnHover", "detail", "icon", "secondaryImageUrl", "placeholderImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps", "compactOnMobile", "extraPadding", "itemsContainerRef", "dropdownMenuContent", "imageGroup", "multilineSubtitle", "control"]);
|
|
19386
19522
|
const { isDropdownOpen, dropdownRef, openDropdown, closeDropdown, openDropdownButtonRef, itemRef, menuRef, dropdownStyles, } = useDropdownMenu({
|
|
19387
19523
|
itemsContainerRef,
|
|
19388
19524
|
});
|
|
@@ -19418,9 +19554,11 @@ function ListItem(_a) {
|
|
|
19418
19554
|
}
|
|
19419
19555
|
return null;
|
|
19420
19556
|
};
|
|
19421
|
-
const isInteractive = !!props.onClick;
|
|
19422
|
-
const ItemTag = isInteractive ? "button" : "div";
|
|
19423
|
-
const itemProps = isInteractive
|
|
19557
|
+
const isInteractive = !!props.onClick || !!control;
|
|
19558
|
+
const ItemTag = isInteractive ? (control ? "label" : "button") : "div";
|
|
19559
|
+
const itemProps = isInteractive
|
|
19560
|
+
? props
|
|
19561
|
+
: {};
|
|
19424
19562
|
const handleInteraction = (e) => {
|
|
19425
19563
|
var _a;
|
|
19426
19564
|
e.preventDefault();
|
|
@@ -19437,9 +19575,9 @@ function ListItem(_a) {
|
|
|
19437
19575
|
};
|
|
19438
19576
|
return (jsxRuntime.jsxs("li", Object.assign({}, containerProps, { ref: itemRef, className: cn("tw-relative tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300 tw-highlight-adjacent", !multilineSubtitle && listItemSizeMap[size], extraPadding && "tw-px-squid-xs", compactOnMobile
|
|
19439
19577
|
? `${collapsedListItemClassMap[size]} mobile-lg:tw-w-full`
|
|
19440
|
-
: "tw-w-full", className), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { onClick: handleItemClick, className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs", !multilineSubtitle
|
|
19578
|
+
: "tw-w-full", className), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { onClick: control == null ? handleItemClick : undefined, className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs", !multilineSubtitle
|
|
19441
19579
|
? "tw-items-center tw-py-squid-xxs"
|
|
19442
|
-
: "tw-py-squid-xs", (isSelected || isDropdownOpen) && "tw-bg-material-light-thin", isInteractive && "hover:tw-bg-material-light-thin", isInteractive && "tw-text-left tw-normal-case"), children: [size === "large" ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon !== null && mainIcon !== void 0 ? mainIcon : (imageGroup != null ? (jsxRuntime.jsx(ImageGroup, { size: "small", imageUrls: imageGroup })) : (jsxRuntime.jsx(BadgeImage, { image: {
|
|
19580
|
+
: "tw-py-squid-xs", (isSelected || isDropdownOpen) && "tw-bg-material-light-thin", isInteractive && control == null && "hover:tw-bg-material-light-thin", isInteractive && "tw-text-left tw-normal-case"), children: [size === "large" ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon !== null && mainIcon !== void 0 ? mainIcon : (imageGroup != null ? (jsxRuntime.jsx(ImageGroup, { size: "small", imageUrls: imageGroup })) : (jsxRuntime.jsx(BadgeImage, { image: {
|
|
19443
19581
|
src: mainImageUrl,
|
|
19444
19582
|
placeholderImageUrl,
|
|
19445
19583
|
size: "xlarge",
|
|
@@ -19459,7 +19597,7 @@ function ListItem(_a) {
|
|
|
19459
19597
|
: "tw-flex", isDetailInteractive && "hover:tw-bg-material-light-thin", detailButtonClassName), children: [!!detail && (jsxRuntime.jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] }))), !!dropdownMenuContent && (jsxRuntime.jsx(ListItemActionsButton, { ref: openDropdownButtonRef, onClick: (e) => {
|
|
19460
19598
|
e.stopPropagation();
|
|
19461
19599
|
isDropdownOpen ? closeDropdown() : openDropdown();
|
|
19462
|
-
}, isActive: isDropdownOpen, className: "tw-z-20 peer-hover/list-item:tw-opacity-100" }))] })), isDropdownOpen && !!dropdownMenuContent ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef, isHidden: !dropdownStyles, className: cn(!!dropdownStyles &&
|
|
19600
|
+
}, isActive: isDropdownOpen, className: "tw-z-20 peer-hover/list-item:tw-opacity-100" })), control] })), isDropdownOpen && !!dropdownMenuContent ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef, isHidden: !dropdownStyles, className: cn(!!dropdownStyles &&
|
|
19463
19601
|
dropdownPositionClassMap$1[dropdownStyles.position]), dropdownRef: dropdownRef, children: dropdownMenuContent })) : null] })));
|
|
19464
19602
|
}
|
|
19465
19603
|
const ListItemActionsButton = React$1.forwardRef((_a, ref) => {
|
|
@@ -27301,7 +27439,7 @@ function NumericInput(_a) {
|
|
|
27301
27439
|
var { priceImpactPercentage, balance = "0", error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxUsdDecimals = 2, formatIfVerySmall = {
|
|
27302
27440
|
token: "0.001",
|
|
27303
27441
|
usd: "0.01",
|
|
27304
|
-
}, 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"]);
|
|
27442
|
+
}, showDetails = true, isLoading = false, direction, inputModeButton, isInteractive = false, balanceButton, debounceInput = true } = _a, props = __rest$1(_a, ["priceImpactPercentage", "balance", "error", "criticalPriceImpactPercentage", "token", "onAmountChange", "forcedAmount", "maxUsdDecimals", "formatIfVerySmall", "showDetails", "isLoading", "direction", "inputModeButton", "isInteractive", "balanceButton", "debounceInput"]);
|
|
27305
27443
|
const [inputValue, setInputValue] = React$1.useState("");
|
|
27306
27444
|
const [userInputType, setUserInputType] = React$1.useState(UserInputType.TOKEN);
|
|
27307
27445
|
const balanceChipClickable = isInteractive && parseFloat(balance) > 0;
|
|
@@ -27316,16 +27454,14 @@ function NumericInput(_a) {
|
|
|
27316
27454
|
? safeNewValue
|
|
27317
27455
|
: convertTokenAmountToUSD(safeNewValue, token.price, maxUsdDecimals);
|
|
27318
27456
|
setInputValue(formattedAmount);
|
|
27319
|
-
}, [userInputType, token.price,
|
|
27457
|
+
}, [userInputType, token.price, token.decimals]);
|
|
27320
27458
|
const onBalanceButtonClick = React$1.useCallback(() => {
|
|
27321
27459
|
if (balanceChipClickable) {
|
|
27322
27460
|
updateInputValue(balance);
|
|
27323
27461
|
onAmountChange(balance);
|
|
27324
27462
|
}
|
|
27325
|
-
}, [balance,
|
|
27326
|
-
const onAmountChangeDebounced = React$1.useCallback(debounce$1(onAmountChange, 1000), [
|
|
27327
|
-
onAmountChange,
|
|
27328
|
-
]);
|
|
27463
|
+
}, [balance, onAmountChange, updateInputValue]);
|
|
27464
|
+
const onAmountChangeDebounced = React$1.useCallback(debounce$1(onAmountChange, debounceInput ? 1000 : 0), [onAmountChange]);
|
|
27329
27465
|
const handleInputChange = (e) => {
|
|
27330
27466
|
const value = e.target.value.replace(/,/g, "."); // Replace commas with dots
|
|
27331
27467
|
const maxDecimalsForInputType = userInputType === UserInputType.TOKEN ? token.decimals : maxUsdDecimals;
|
|
@@ -27465,110 +27601,6 @@ function NumericInput(_a) {
|
|
|
27465
27601
|
: notInteractiveChipClassName), children: [jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxRuntime.jsxs("div", { children: [userInputType === UserInputType.USD && (jsxRuntime.jsx(CaptionText, { className: "tw-opacity-66", children: "$" })), jsxRuntime.jsx(CaptionText, { children: balanceFormatted })] }), !(balanceButton === null || balanceButton === void 0 ? void 0 : balanceButton.hideMaxChip) && jsxRuntime.jsx(Chip, { label: "Max" })] }) }))] }))] }));
|
|
27466
27602
|
}
|
|
27467
27603
|
|
|
27468
|
-
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected = false, }) {
|
|
27469
|
-
const [isInputVisible, setIsInputVisible] = React$1.useState(false);
|
|
27470
|
-
const [inputValue, setInputValue] = React$1.useState(String(value !== null && value !== void 0 ? value : 0));
|
|
27471
|
-
React$1.useEffect(() => {
|
|
27472
|
-
if (!isInputVisible)
|
|
27473
|
-
return;
|
|
27474
|
-
const handleOutsideClick = (event) => {
|
|
27475
|
-
var _a;
|
|
27476
|
-
const clickedElementIsDifferentThanMenu = event.target !== menuRef.current;
|
|
27477
|
-
const clickedElementIsDifferentThanSlider = event.target !== sliderRef.current;
|
|
27478
|
-
const sliderContainsClickedElement = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target);
|
|
27479
|
-
const hideInput = clickedElementIsDifferentThanMenu &&
|
|
27480
|
-
(!clickedElementIsDifferentThanSlider || !sliderContainsClickedElement);
|
|
27481
|
-
if (hideInput) {
|
|
27482
|
-
handleCloseInput();
|
|
27483
|
-
}
|
|
27484
|
-
};
|
|
27485
|
-
document.addEventListener("click", handleOutsideClick);
|
|
27486
|
-
return () => {
|
|
27487
|
-
document.removeEventListener("click", handleOutsideClick);
|
|
27488
|
-
};
|
|
27489
|
-
}, [isInputVisible]);
|
|
27490
|
-
const menuRef = React$1.useRef(null);
|
|
27491
|
-
const sliderRef = React$1.useRef(null);
|
|
27492
|
-
const handleSubmit = React$1.useCallback((value) => {
|
|
27493
|
-
handleCloseInput();
|
|
27494
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value === "" ? undefined : Number(value));
|
|
27495
|
-
}, [onChange]);
|
|
27496
|
-
const handleKeyDown = React$1.useCallback((e) => {
|
|
27497
|
-
// block unwanted (but still valid) characters
|
|
27498
|
-
if (["e", "E", "+", "-"].includes(e.key)) {
|
|
27499
|
-
e.preventDefault();
|
|
27500
|
-
return;
|
|
27501
|
-
}
|
|
27502
|
-
// close input when pressing escape
|
|
27503
|
-
if (e.key === "Escape") {
|
|
27504
|
-
handleCloseInput();
|
|
27505
|
-
}
|
|
27506
|
-
}, []);
|
|
27507
|
-
const handleOpenInput = React$1.useCallback(() => {
|
|
27508
|
-
setIsInputVisible(true);
|
|
27509
|
-
}, []);
|
|
27510
|
-
const handleCloseInput = React$1.useCallback(() => {
|
|
27511
|
-
setIsInputVisible(false);
|
|
27512
|
-
}, []);
|
|
27513
|
-
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-caption tw-leading-[10px] -tw-outline-offset-2 placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin", value === 0 || value === undefined
|
|
27514
|
-
? "tw-text-grey-600"
|
|
27515
|
-
: "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) => {
|
|
27516
|
-
e.preventDefault();
|
|
27517
|
-
handleSubmit(inputValue);
|
|
27518
|
-
}, children: jsxRuntime.jsx(Input, { autoFocus: true, min: min, max: max, onKeyDown: handleKeyDown, step: decimalsFormat, placeholder: "0", type: "number", defaultValue: value, value: inputValue, onChange: (e) => {
|
|
27519
|
-
const isValid = e.target.checkValidity();
|
|
27520
|
-
if (!isValid)
|
|
27521
|
-
return;
|
|
27522
|
-
setInputValue(e.target.value);
|
|
27523
|
-
}, showIcon: false, actionButtonProps: {
|
|
27524
|
-
label: "Ok",
|
|
27525
|
-
onClick: () => {
|
|
27526
|
-
handleSubmit(inputValue);
|
|
27527
|
-
},
|
|
27528
|
-
variant: "primary",
|
|
27529
|
-
} }) }) }))] }));
|
|
27530
|
-
}
|
|
27531
|
-
|
|
27532
|
-
const switchSizeClassMap = {
|
|
27533
|
-
small: "tw-w-[36px] tw-h-squid-m tw-p-0.5",
|
|
27534
|
-
large: "tw-w-[54px] tw-h-squid-l tw-p-[3px]",
|
|
27535
|
-
};
|
|
27536
|
-
const switchKnobSizeClassMap = {
|
|
27537
|
-
small: "tw-w-4 tw-h-4",
|
|
27538
|
-
large: "tw-w-6 tw-h-6",
|
|
27539
|
-
};
|
|
27540
|
-
const switchKnobCheckedClassMap = {
|
|
27541
|
-
large: {
|
|
27542
|
-
checked: "tw-left-[26px]",
|
|
27543
|
-
unchecked: "tw-left-[2px]",
|
|
27544
|
-
},
|
|
27545
|
-
small: {
|
|
27546
|
-
checked: "tw-left-[17px]",
|
|
27547
|
-
unchecked: "tw-left-[1px]",
|
|
27548
|
-
},
|
|
27549
|
-
};
|
|
27550
|
-
function Switch({ checked = false, onChange, size, disabled = false, inputProps, }) {
|
|
27551
|
-
return (
|
|
27552
|
-
// Switch container
|
|
27553
|
-
jsxRuntime.jsxs("label", { className: clsx("tw-relative tw-inline-flex tw-items-center tw-justify-end tw-overflow-hidden tw-rounded-squid-m tw-border tw-border-material-light-thin tw-transition-colors",
|
|
27554
|
-
// size styles
|
|
27555
|
-
switchSizeClassMap[size],
|
|
27556
|
-
// checked styles
|
|
27557
|
-
checked ? "tw-bg-status-positive" : "tw-bg-grey-800",
|
|
27558
|
-
// disabled styles
|
|
27559
|
-
disabled ? "tw-cursor-not-allowed" : "tw-cursor-pointer",
|
|
27560
|
-
// Focus visible styles
|
|
27561
|
-
"tw-focus-visible-within-outline"), children: [jsxRuntime.jsx("input", Object.assign({}, inputProps, { disabled: disabled, checked: checked, onChange: disabled ? undefined : (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" })), jsxRuntime.jsx("span", { style: {
|
|
27562
|
-
filter: "drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.33)) drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))",
|
|
27563
|
-
}, className: clsx("tw-absolute tw-rounded-full tw-border tw-border-material-light-thin tw-transition-all",
|
|
27564
|
-
// size styles
|
|
27565
|
-
switchKnobSizeClassMap[size],
|
|
27566
|
-
// checked styles
|
|
27567
|
-
switchKnobCheckedClassMap[size][checked ? "checked" : "unchecked"], checked
|
|
27568
|
-
? "group-data-[squid-theme-type=dark]:tw-bg-grey-100 group-data-[squid-theme-type=light]:tw-bg-grey-900"
|
|
27569
|
-
: "tw-bg-grey-500") })] }));
|
|
27570
|
-
}
|
|
27571
|
-
|
|
27572
27604
|
function RangeInput({ label, initialValue, onChange, min = 0, max = 99, isWarning = false, }) {
|
|
27573
27605
|
const [pressedButton, setPressedButton] = React$1.useState(null);
|
|
27574
27606
|
const inputRef = React$1.useRef(null);
|
|
@@ -27680,7 +27712,116 @@ function RangeInput({ label, initialValue, onChange, min = 0, max = 99, isWarnin
|
|
|
27680
27712
|
}, onMouseLeave: handleUpdateValue, 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-xxs tw-text-left tw-text-caption tw-font-caption tw-leading-[10px] placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin"), children: jsxRuntime.jsx(CirclePlusIcon, {}) })] })] }) }));
|
|
27681
27713
|
}
|
|
27682
27714
|
|
|
27683
|
-
|
|
27715
|
+
function SettingsSlider({ value, type, onChange, decimalsFormat, max, min, isSelected = false, }) {
|
|
27716
|
+
const [isInputVisible, setIsInputVisible] = React$1.useState(false);
|
|
27717
|
+
const [inputValue, setInputValue] = React$1.useState(String(value !== null && value !== void 0 ? value : 0));
|
|
27718
|
+
React$1.useEffect(() => {
|
|
27719
|
+
if (!isInputVisible)
|
|
27720
|
+
return;
|
|
27721
|
+
const handleOutsideClick = (event) => {
|
|
27722
|
+
var _a;
|
|
27723
|
+
const clickedElementIsDifferentThanMenu = event.target !== menuRef.current;
|
|
27724
|
+
const clickedElementIsDifferentThanSlider = event.target !== sliderRef.current;
|
|
27725
|
+
const sliderContainsClickedElement = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target);
|
|
27726
|
+
const hideInput = clickedElementIsDifferentThanMenu &&
|
|
27727
|
+
(!clickedElementIsDifferentThanSlider || !sliderContainsClickedElement);
|
|
27728
|
+
if (hideInput) {
|
|
27729
|
+
handleCloseInput();
|
|
27730
|
+
}
|
|
27731
|
+
};
|
|
27732
|
+
document.addEventListener("click", handleOutsideClick);
|
|
27733
|
+
return () => {
|
|
27734
|
+
document.removeEventListener("click", handleOutsideClick);
|
|
27735
|
+
};
|
|
27736
|
+
}, [isInputVisible]);
|
|
27737
|
+
const menuRef = React$1.useRef(null);
|
|
27738
|
+
const sliderRef = React$1.useRef(null);
|
|
27739
|
+
const handleSubmit = React$1.useCallback((value) => {
|
|
27740
|
+
handleCloseInput();
|
|
27741
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value === "" ? undefined : Number(value));
|
|
27742
|
+
}, [onChange]);
|
|
27743
|
+
const handleKeyDown = React$1.useCallback((e) => {
|
|
27744
|
+
// block unwanted (but still valid) characters
|
|
27745
|
+
if (["e", "E", "+", "-"].includes(e.key)) {
|
|
27746
|
+
e.preventDefault();
|
|
27747
|
+
return;
|
|
27748
|
+
}
|
|
27749
|
+
// close input when pressing escape
|
|
27750
|
+
if (e.key === "Escape") {
|
|
27751
|
+
handleCloseInput();
|
|
27752
|
+
}
|
|
27753
|
+
}, []);
|
|
27754
|
+
const handleOpenInput = React$1.useCallback(() => {
|
|
27755
|
+
setIsInputVisible(true);
|
|
27756
|
+
}, []);
|
|
27757
|
+
const handleCloseInput = React$1.useCallback(() => {
|
|
27758
|
+
setIsInputVisible(false);
|
|
27759
|
+
}, []);
|
|
27760
|
+
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-caption tw-leading-[10px] -tw-outline-offset-2 placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin", value === 0 || value === undefined
|
|
27761
|
+
? "tw-text-grey-600"
|
|
27762
|
+
: "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) => {
|
|
27763
|
+
e.preventDefault();
|
|
27764
|
+
handleSubmit(inputValue);
|
|
27765
|
+
}, children: jsxRuntime.jsx(Input, { autoFocus: true, min: min, max: max, onKeyDown: handleKeyDown, step: decimalsFormat, placeholder: "0", type: "number", defaultValue: value, value: inputValue, onChange: (e) => {
|
|
27766
|
+
const isValid = e.target.checkValidity();
|
|
27767
|
+
if (!isValid)
|
|
27768
|
+
return;
|
|
27769
|
+
setInputValue(e.target.value);
|
|
27770
|
+
}, showIcon: false, actionButtonProps: {
|
|
27771
|
+
label: "Ok",
|
|
27772
|
+
onClick: () => {
|
|
27773
|
+
handleSubmit(inputValue);
|
|
27774
|
+
},
|
|
27775
|
+
variant: "primary",
|
|
27776
|
+
} }) }) }))] }));
|
|
27777
|
+
}
|
|
27778
|
+
|
|
27779
|
+
const switchSizeClassMap = {
|
|
27780
|
+
small: "tw-w-[36px] tw-h-squid-m tw-p-0.5",
|
|
27781
|
+
large: "tw-w-[54px] tw-h-squid-l tw-p-[3px]",
|
|
27782
|
+
};
|
|
27783
|
+
const switchKnobSizeClassMap = {
|
|
27784
|
+
small: "tw-w-4 tw-h-4",
|
|
27785
|
+
large: "tw-w-6 tw-h-6",
|
|
27786
|
+
};
|
|
27787
|
+
const switchKnobCheckedClassMap = {
|
|
27788
|
+
large: {
|
|
27789
|
+
checked: "tw-left-[26px]",
|
|
27790
|
+
unchecked: "tw-left-[2px]",
|
|
27791
|
+
},
|
|
27792
|
+
small: {
|
|
27793
|
+
checked: "tw-left-[17px]",
|
|
27794
|
+
unchecked: "tw-left-[1px]",
|
|
27795
|
+
},
|
|
27796
|
+
};
|
|
27797
|
+
function Switch({ checked = false, onChange, size, disabled = false, inputProps, }) {
|
|
27798
|
+
return (
|
|
27799
|
+
// Switch container
|
|
27800
|
+
jsxRuntime.jsxs("label", { className: clsx("tw-relative tw-inline-flex tw-items-center tw-justify-end tw-overflow-hidden tw-rounded-squid-m tw-border tw-border-material-light-thin tw-transition-colors",
|
|
27801
|
+
// size styles
|
|
27802
|
+
switchSizeClassMap[size],
|
|
27803
|
+
// checked styles
|
|
27804
|
+
disabled || !checked ? "tw-bg-grey-800" : "tw-bg-status-positive",
|
|
27805
|
+
// disabled styles
|
|
27806
|
+
disabled ? "tw-cursor-not-allowed" : "tw-cursor-pointer",
|
|
27807
|
+
// Focus visible styles
|
|
27808
|
+
"tw-focus-visible-within-outline"), children: [jsxRuntime.jsx("input", Object.assign({}, inputProps, { disabled: disabled, checked: checked, onChange: disabled ? undefined : (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" })), jsxRuntime.jsx("span", { style: {
|
|
27809
|
+
filter: disabled
|
|
27810
|
+
? "drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.10)) drop-shadow(0px 1px 5px rgba(0, 0, 0, 0.10))"
|
|
27811
|
+
: "drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.33)) drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))",
|
|
27812
|
+
}, className: clsx("tw-absolute tw-rounded-full tw-border tw-border-material-light-thin tw-transition-all",
|
|
27813
|
+
// size styles
|
|
27814
|
+
switchKnobSizeClassMap[size],
|
|
27815
|
+
// checked styles
|
|
27816
|
+
switchKnobCheckedClassMap[size][checked ? "checked" : "unchecked"], disabled
|
|
27817
|
+
? "group-data-[squid-theme-type=dark]:tw-bg-grey-700 group-data-[squid-theme-type=light]:tw-bg-grey-900"
|
|
27818
|
+
: checked
|
|
27819
|
+
? "group-data-[squid-theme-type=dark]:tw-bg-grey-100 group-data-[squid-theme-type=light]:tw-bg-grey-900"
|
|
27820
|
+
: "tw-bg-grey-500") })] }));
|
|
27821
|
+
}
|
|
27822
|
+
|
|
27823
|
+
const imageWrapperClassName = "tw-w-[40px] tw-aspect-square tw-flex tw-items-center tw-justify-center";
|
|
27824
|
+
const tokenImageClassName = "tw-absolute tw-h-squid-xl tw-w-squid-xl tw-rounded-full tw-object-cover";
|
|
27684
27825
|
const themeKeyVariantMap = {
|
|
27685
27826
|
primary: "grey-800",
|
|
27686
27827
|
accent: "royal-500",
|
|
@@ -27700,6 +27841,12 @@ var AssetsButtonState;
|
|
|
27700
27841
|
AssetsButtonState[AssetsButtonState["EMPTY"] = 2] = "EMPTY";
|
|
27701
27842
|
AssetsButtonState[AssetsButtonState["LOADING"] = 3] = "LOADING";
|
|
27702
27843
|
})(AssetsButtonState || (AssetsButtonState = {}));
|
|
27844
|
+
var ImageLoadingState;
|
|
27845
|
+
(function (ImageLoadingState) {
|
|
27846
|
+
ImageLoadingState[ImageLoadingState["LOADING"] = 0] = "LOADING";
|
|
27847
|
+
ImageLoadingState[ImageLoadingState["LOADED"] = 1] = "LOADED";
|
|
27848
|
+
ImageLoadingState[ImageLoadingState["ERROR"] = 2] = "ERROR";
|
|
27849
|
+
})(ImageLoadingState || (ImageLoadingState = {}));
|
|
27703
27850
|
const outlineWidthMap = {
|
|
27704
27851
|
[AssetsButtonState.LOADING]: {
|
|
27705
27852
|
inner: 75,
|
|
@@ -27719,7 +27866,9 @@ const outlineWidthMap = {
|
|
|
27719
27866
|
},
|
|
27720
27867
|
};
|
|
27721
27868
|
function AssetsButton({ chain, token, onClick, variant = "primary", isLoading = false, tooltip, emptyTokenLabel = "Select token", }) {
|
|
27722
|
-
var _a, _b;
|
|
27869
|
+
var _a, _b, _c, _d;
|
|
27870
|
+
const [tokenImageLoadingState, setTokenImageLoadingState] = React$1.useState(ImageLoadingState.LOADING);
|
|
27871
|
+
const fallbackBgColor = useColorFromSeed((_a = token === null || token === void 0 ? void 0 : token.symbol) !== null && _a !== void 0 ? _a : "");
|
|
27723
27872
|
const state = React$1.useMemo(() => {
|
|
27724
27873
|
if (chain != null && !isLoading) {
|
|
27725
27874
|
if (token != null) {
|
|
@@ -27734,10 +27883,27 @@ function AssetsButton({ chain, token, onClick, variant = "primary", isLoading =
|
|
|
27734
27883
|
}, [token, chain, isLoading]);
|
|
27735
27884
|
const defaultBgColor = `var(${themeKeysToCssVariables.color[themeKeyVariantMap[variant]].cssVariable})`;
|
|
27736
27885
|
const outlineWidth = outlineWidthMap[state];
|
|
27737
|
-
const chainBgColor = (
|
|
27738
|
-
const
|
|
27739
|
-
?
|
|
27740
|
-
:
|
|
27886
|
+
const chainBgColor = (_b = chain === null || chain === void 0 ? void 0 : chain.bgColor) !== null && _b !== void 0 ? _b : defaultBgColor;
|
|
27887
|
+
const tokenTextColor = tokenImageLoadingState === ImageLoadingState.ERROR
|
|
27888
|
+
? "#fff"
|
|
27889
|
+
: token === null || token === void 0 ? void 0 : token.textColor;
|
|
27890
|
+
const tokenBgColor = React$1.useMemo(() => {
|
|
27891
|
+
if (state !== AssetsButtonState.FULL) {
|
|
27892
|
+
return defaultBgColor;
|
|
27893
|
+
}
|
|
27894
|
+
if (tokenImageLoadingState === ImageLoadingState.ERROR) {
|
|
27895
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
27896
|
+
return fallbackBgColor || defaultBgColor;
|
|
27897
|
+
}
|
|
27898
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
27899
|
+
return (token === null || token === void 0 ? void 0 : token.bgColor) || defaultBgColor;
|
|
27900
|
+
}, [
|
|
27901
|
+
state,
|
|
27902
|
+
token === null || token === void 0 ? void 0 : token.bgColor,
|
|
27903
|
+
defaultBgColor,
|
|
27904
|
+
tokenImageLoadingState,
|
|
27905
|
+
fallbackBgColor,
|
|
27906
|
+
]);
|
|
27741
27907
|
const bgGradient = React$1.useMemo(() => {
|
|
27742
27908
|
switch (state) {
|
|
27743
27909
|
case AssetsButtonState.EMPTY:
|
|
@@ -27755,12 +27921,22 @@ function AssetsButton({ chain, token, onClick, variant = "primary", isLoading =
|
|
|
27755
27921
|
? "tw-cursor-not-allowed"
|
|
27756
27922
|
: "tw-group/assets-button"), children: [jsxRuntime.jsx("svg", { className: "tw-absolute tw-left-0 tw-z-10 tw-h-[40px] tw-w-[72px] tw-text-material-light-thin", viewBox: "0 0 72 40", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "m57.86 5.86c-.53.53-1.05 1.06-1.56 1.59-3.29 3.38-6.37 6.55-10.3 6.55s-7.01-3.17-10.3-6.55c-.51-.53-1.03-1.06-1.56-1.59-3.9-3.91-9.02-5.86-14.14-5.86s-10.24 1.95-14.14 5.86c-3.91 3.9-5.86 9.02-5.86 14.14s1.95 10.24 5.86 14.14c3.91 3.91 9.02 5.86 14.14 5.86s10.24-1.95 14.14-5.86c.52-.53 1.04-1.06 1.55-1.58 3.29-3.39 6.37-6.56 10.31-6.56s7.02 3.17 10.31 6.56c.51.53 1.03 1.06 1.55 1.58 3.91 3.91 9.02 5.86 14.14 5.86v-40c-5.12 0-10.24 1.95-14.14 5.86zm14.14 33.14c-5.07 0-9.85-1.98-13.43-5.56-.52-.52-1.02-1.04-1.54-1.57-3.43-3.53-6.67-6.86-11.02-6.86s-7.6 3.33-11.04 6.88c-.5.52-1.01 1.04-1.53 1.56-3.59 3.59-8.36 5.57-13.44 5.57s-9.85-1.98-13.43-5.57c-3.59-3.59-5.56-8.36-5.56-13.43s1.98-9.85 5.56-13.44c3.58-3.6 8.35-5.58 13.43-5.58s9.85 1.98 13.44 5.57c.52.52 1.04 1.05 1.55 1.58 3.43 3.53 6.66 6.86 11.02 6.86s7.59-3.33 11.02-6.86c.51-.52 1.02-1.05 1.55-1.58 3.59-3.59 8.36-5.56 13.43-5.56v38z" }) }), jsxRuntime.jsxs("svg", { className: "tw-absolute -tw-left-[2px] -tw-top-[2px] tw-z-20 tw-hidden group-hover/assets-button:tw-block", xmlns: "http://www.w3.org/2000/svg", width: outlineWidth.inner, height: "44", viewBox: `0 0 ${outlineWidth.inner} 44`, fill: "none", children: [jsxRuntime.jsx("clipPath", { id: "halfClip1", children: jsxRuntime.jsx("rect", { x: "0", y: "0", width: outlineWidth.inner, height: "44" }) }), jsxRuntime.jsx("path", { d: "M59.1506 36.849L59.1508 36.8492C63.2511 40.9496 68.6272 43 74.0001 43H145C156.598 43 166 33.598 166 22C166 10.402 156.598 1 145 1H74.0001C68.6272 0.999977 63.2511 3.05042 59.1508 7.15076C58.6183 7.68325 58.0958 8.22097 57.5842 8.74755L57.5817 8.75009C55.9228 10.4574 54.3925 12.0283 52.8031 13.1834C51.2282 14.3279 49.6791 15 48 15C46.3209 15 44.7718 14.3279 43.1969 13.1834C41.6075 12.0283 40.0772 10.4574 38.4183 8.75009L38.4159 8.74759C37.9042 8.22101 37.3817 7.68327 36.8492 7.15076C32.7489 3.05042 27.3728 0.999977 21.9999 1C16.6271 1.00002 11.251 3.05047 7.15076 7.15076C3.05045 11.2511 1 16.6272 1 22C1 27.3728 3.05045 32.7489 7.15076 36.8492C11.251 40.9495 16.6271 43 21.9999 43C27.3728 43 32.7489 40.9496 36.8492 36.8492L36.8494 36.849C37.3794 36.3188 37.8994 35.7834 38.4088 35.2589L38.4108 35.2569C40.0704 33.5483 41.6019 31.9756 43.1928 30.8191C44.7691 29.6731 46.3197 29 48 29C49.6803 29 51.2309 29.6731 52.8072 30.8191C54.3981 31.9756 55.9296 33.5483 57.5892 35.2569L57.5912 35.2589C58.1006 35.7834 58.6206 36.3188 59.1506 36.849Z", stroke: "currentColor", className: "tw-text-grey-900", strokeWidth: "2", clipPath: "url(#halfClip1)" })] }), jsxRuntime.jsxs("svg", { className: "tw-absolute -tw-left-[4px] -tw-top-[4px] tw-z-10 tw-hidden group-hover/assets-button:tw-block", xmlns: "http://www.w3.org/2000/svg", width: outlineWidth.outer, height: "48", viewBox: `0 0 ${outlineWidth.outer} 48`, fill: "none", children: [jsxRuntime.jsx("clipPath", { id: "halfClip2", children: jsxRuntime.jsx("rect", { x: "0", y: "0", width: outlineWidth.outer, height: "48" }) }), jsxRuntime.jsx("path", { d: "M60.4432 39.5559L60.4437 39.5564C64.7391 43.8517 70.3729 46 76.0001 46H147C159.15 46 169 36.1503 169 24C169 11.8497 159.15 2 147 2H76.0001C70.3729 1.99998 64.7391 4.14825 60.4437 8.44365C59.9062 8.98109 59.3797 9.52298 58.8697 10.0479L58.8645 10.0532C57.1905 11.7761 55.7217 13.2796 54.2152 14.3745C52.7378 15.4481 51.3923 16 50 16C48.6077 16 47.2622 15.4481 45.7848 14.3745C44.2783 13.2796 42.8095 11.7761 41.1355 10.0532L41.1305 10.0481C40.6205 9.52314 40.0939 8.98117 39.5563 8.44365C35.2609 4.14825 29.6271 1.99998 23.9999 2C18.3727 2.00002 12.739 4.1483 8.44365 8.44365C4.14827 12.739 2 18.3728 2 24C2 29.6272 4.14827 35.261 8.44365 39.5564C12.739 43.8517 18.3727 46 23.9999 46C29.6271 46 35.2609 43.8517 39.5563 39.5564L39.5568 39.5559C40.0917 39.0207 40.6159 38.481 41.1237 37.9582L41.1281 37.9537C42.8028 36.2295 44.2728 34.7243 45.7808 33.6279C47.2597 32.5528 48.6066 32 50 32C51.3934 32 52.7403 32.5528 54.2192 33.6279C55.7272 34.7243 57.1972 36.2295 58.8719 37.9537L58.8763 37.9582C59.3841 38.481 59.9083 39.0207 60.4432 39.5559Z", stroke: "currentColor", className: "tw-text-material-light-average", strokeWidth: "4", clipPath: "url(#halfClip2)" })] }), jsxRuntime.jsx("div", { className: cn("tw-assets-button-mask tw-flex tw-h-squid-xl tw-w-[92px] tw-items-center tw-justify-between", state !== AssetsButtonState.FULL && "!tw-w-[72px]"), style: {
|
|
27757
27923
|
backgroundImage: bgGradient,
|
|
27758
|
-
}, children: jsxRuntime.jsx("div", { className: clsx(
|
|
27759
|
-
state === AssetsButtonState.FULL ? (jsxRuntime.jsx("img", { src: chain === null || chain === void 0 ? void 0 : chain.iconUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl tw-rounded-full tw-object-cover" })) : (state !== AssetsButtonState.LOADING && (jsxRuntime.jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsxRuntime.jsx(PlusIcon, {}) }))) }) }), state === AssetsButtonState.FULL ? (jsxRuntime.jsxs("div", { className: clsx(
|
|
27924
|
+
}, children: jsxRuntime.jsx("div", { className: clsx(imageWrapperClassName), children: state === AssetsButtonState.CHAIN_ONLY ||
|
|
27925
|
+
state === AssetsButtonState.FULL ? (jsxRuntime.jsx("img", { src: chain === null || chain === void 0 ? void 0 : chain.iconUrl, alt: "", className: "tw-h-squid-xl tw-w-squid-xl tw-rounded-full tw-object-cover" })) : (state !== AssetsButtonState.LOADING && (jsxRuntime.jsx("span", { className: emptyChainIconTextClassNameMap[variant], children: jsxRuntime.jsx(PlusIcon, {}) }))) }) }), state === AssetsButtonState.FULL ? (jsxRuntime.jsxs("div", { className: clsx(imageWrapperClassName, "tw-absolute tw-left-[54px] tw-z-[5] tw-h-squid-xl tw-overflow-hidden"), children: [jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px]", style: {
|
|
27760
27926
|
backgroundColor: tokenBgColor,
|
|
27761
|
-
} }),
|
|
27927
|
+
} }), tokenImageLoadingState === ImageLoadingState.ERROR && (
|
|
27928
|
+
// show fallback
|
|
27929
|
+
jsxRuntime.jsx("div", { style: { color: tokenTextColor }, className: cn(tokenImageClassName, "tw-flex tw-items-center tw-justify-center tw-text-body-small"), children: (_d = (_c = token === null || token === void 0 ? void 0 : token.symbol) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.toUpperCase() })), jsxRuntime.jsx("img", { onLoad: () => {
|
|
27930
|
+
setTokenImageLoadingState(ImageLoadingState.LOADED);
|
|
27931
|
+
}, onError: () => {
|
|
27932
|
+
setTokenImageLoadingState(ImageLoadingState.ERROR);
|
|
27933
|
+
}, src: token === null || token === void 0 ? void 0 : token.iconUrl, alt: token === null || token === void 0 ? void 0 : token.symbol, className: cn(tokenImageClassName,
|
|
27934
|
+
// when image load failed, hide it with opacity: 0 instead of display: none
|
|
27935
|
+
// so new images can load and update the loading state
|
|
27936
|
+
tokenImageLoadingState === ImageLoadingState.ERROR &&
|
|
27937
|
+
"tw-opacity-0") }), jsxRuntime.jsx("div", { className: "tw-absolute tw-right-0 tw-h-full tw-w-[22px] tw-border-b\n tw-border-t tw-border-material-light-thin" })] })) : null, jsxRuntime.jsxs("div", { className: cn("tw-relative tw-flex tw-h-squid-xl tw-w-fit tw-min-w-fit tw-items-center tw-gap-squid-xxs tw-rounded-br-full tw-rounded-tr-full tw-border tw-border-l-0 tw-border-material-light-thin tw-py-squid-xs tw-pr-squid-xs before:tw-absolute before:-tw-inset-[3px] before:tw-z-[1] before:tw-w-[calc(100%+3px)] before:tw-translate-x-[3px] before:tw-rounded-br-full before:tw-rounded-tr-full before:tw-border-2 before:tw-border-l-0 before:tw-border-transparent after:tw-absolute after:-tw-inset-[5px] after:tw-z-0 after:tw-w-[calc(100%+4px)] after:tw-translate-x-[6px] after:tw-rounded-br-full after:tw-rounded-tr-full after:tw-border-4 after:tw-border-l-0 after:tw-border-transparent group-hover/assets-button:before:tw-border-grey-900 group-hover/assets-button:after:tw-border-material-light-average", state === AssetsButtonState.FULL && "tw-pl-[7px]"), style: {
|
|
27762
27938
|
backgroundColor: tokenBgColor,
|
|
27763
|
-
color:
|
|
27939
|
+
color: tokenTextColor,
|
|
27764
27940
|
}, children: [jsxRuntime.jsx(BodyText, { size: "small", className: cn("tw-leading-[13px]", state === AssetsButtonState.LOADING && "tw-min-w-[135px]"), children: state === AssetsButtonState.FULL
|
|
27765
27941
|
? token === null || token === void 0 ? void 0 : token.symbol
|
|
27766
27942
|
: state !== AssetsButtonState.LOADING && emptyTokenLabel }), state !== AssetsButtonState.LOADING && (jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-w-4 tw-min-w-4 tw-opacity-66" }))] })] }) })));
|
|
@@ -69278,10 +69454,7 @@ function SwapProgressView({ steps, isOpen = true, handleClose, handleComplete, s
|
|
|
69278
69454
|
? ""
|
|
69279
69455
|
: showSwapInfoSection
|
|
69280
69456
|
? "tw-animate-scale-and-fade-up"
|
|
69281
|
-
: "tw-animate-scale-and-fade-down"), children: [jsxRuntime.jsx(
|
|
69282
|
-
// box shadow simulating bottom outline (we do not use css outline because cannot apply it to only one side)
|
|
69283
|
-
boxShadow: "0 1px 0 currentColor",
|
|
69284
|
-
}, children: jsxRuntime.jsx(AnimationWrapper, { style: {
|
|
69457
|
+
: "tw-animate-scale-and-fade-down"), children: [jsxRuntime.jsx(AnimationCard, { children: jsxRuntime.jsx(AnimationWrapper, { style: {
|
|
69285
69458
|
height: "100%",
|
|
69286
69459
|
maxHeight: "100%",
|
|
69287
69460
|
width: "auto",
|
|
@@ -69618,6 +69791,12 @@ const parseSquidTheme = (userTheme, themeType) => {
|
|
|
69618
69791
|
"button-md-secondary-text": fullPublicTheme.color["grey-800"],
|
|
69619
69792
|
"button-md-tertiary-bg": fullPublicTheme.color["grey-800"],
|
|
69620
69793
|
"button-md-tertiary-text": fullPublicTheme.color["grey-300"],
|
|
69794
|
+
"button-sm-primary-bg": fullPublicTheme.color["royal-500"],
|
|
69795
|
+
"button-sm-primary-text": fullPublicTheme.color[themeType === "light" ? "grey-900" : "grey-100"],
|
|
69796
|
+
"button-sm-secondary-bg": fullPublicTheme.color["grey-100"],
|
|
69797
|
+
"button-sm-secondary-text": fullPublicTheme.color["grey-800"],
|
|
69798
|
+
"button-sm-tertiary-bg": fullPublicTheme.color["grey-800"],
|
|
69799
|
+
"button-sm-tertiary-text": fullPublicTheme.color["grey-300"],
|
|
69621
69800
|
};
|
|
69622
69801
|
const defaultInputColors = {
|
|
69623
69802
|
"input-placeholder": fullPublicTheme.color["grey-600"],
|
|
@@ -69783,6 +69962,7 @@ exports.ActionRow = ActionRow;
|
|
|
69783
69962
|
exports.ActionStatusRow = ActionStatusRow;
|
|
69784
69963
|
exports.ActionWrapper = ActionWrapper;
|
|
69785
69964
|
exports.AddressButton = AddressButton;
|
|
69965
|
+
exports.AnimationCard = AnimationCard;
|
|
69786
69966
|
exports.AnimationWrapper = AnimationWrapper;
|
|
69787
69967
|
exports.Announcement = Announcement;
|
|
69788
69968
|
exports.AppContainer = AppContainer;
|
|
@@ -69845,6 +70025,7 @@ exports.ChevronRightSmallIcon = ChevronRightSmallIcon;
|
|
|
69845
70025
|
exports.ChevronTopIcon = ChevronTopIcon;
|
|
69846
70026
|
exports.ChevronTopSmallIcon = ChevronTopSmallIcon;
|
|
69847
70027
|
exports.Chip = Chip;
|
|
70028
|
+
exports.CircleCheckIcon = CircleCheckIcon;
|
|
69848
70029
|
exports.CircleMinusIcon = CircleMinusIcon;
|
|
69849
70030
|
exports.CirclePlusIcon = CirclePlusIcon;
|
|
69850
70031
|
exports.CircleX = CircleX;
|
|
@@ -69932,6 +70113,7 @@ exports.InteractionProperties = InteractionProperties;
|
|
|
69932
70113
|
exports.InteractionTransactionView = InteractionTransactionView;
|
|
69933
70114
|
exports.Join = Join;
|
|
69934
70115
|
exports.LaptopIcon = LaptopIcon;
|
|
70116
|
+
exports.LargeNumericInput = LargeNumericInput;
|
|
69935
70117
|
exports.LightningIcon = LightningIcon;
|
|
69936
70118
|
exports.LimitIcon = LimitIcon;
|
|
69937
70119
|
exports.LinkIcon = LinkIcon;
|
|
@@ -69950,6 +70132,7 @@ exports.MirrorIcon = MirrorIcon;
|
|
|
69950
70132
|
exports.Modal = Modal;
|
|
69951
70133
|
exports.ModalContent = ModalContent;
|
|
69952
70134
|
exports.ModalContentDivider = ModalContentDivider;
|
|
70135
|
+
exports.ModalTitle = ModalTitle;
|
|
69953
70136
|
exports.MoneyBagIcon = MoneyBagIcon;
|
|
69954
70137
|
exports.MoonIcon = MoonIcon;
|
|
69955
70138
|
exports.NavigationBar = NavigationBar;
|
|
@@ -69963,6 +70146,7 @@ exports.PercentIcon = PercentIcon;
|
|
|
69963
70146
|
exports.PhoneIcon = PhoneIcon;
|
|
69964
70147
|
exports.PieChartIcon = PieChartIcon;
|
|
69965
70148
|
exports.PipeSeparator = PipeSeparator;
|
|
70149
|
+
exports.PluginIcon = PluginIcon;
|
|
69966
70150
|
exports.PlusIcon = PlusIcon;
|
|
69967
70151
|
exports.PoopIcon = PoopIcon;
|
|
69968
70152
|
exports.PowerIcon = PowerIcon;
|
|
@@ -70070,6 +70254,7 @@ exports.XSocialIcon = XSocialIcon;
|
|
|
70070
70254
|
exports.adjustColorForContrast = adjustColorForContrast;
|
|
70071
70255
|
exports.baseTailwindConfig = baseTailwindConfig;
|
|
70072
70256
|
exports.blendColors = blendColors;
|
|
70257
|
+
exports.buttonRoundedClassMap = buttonRoundedClassMap;
|
|
70073
70258
|
exports.cn = cn;
|
|
70074
70259
|
exports.darkTheme = darkTheme;
|
|
70075
70260
|
exports.getColorBrightness = getColorBrightness;
|