@0xsquid/ui 2.2.9 → 2.2.11
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 +76 -42
- package/dist/cjs/types/components/badges/PriceChange.d.ts +4 -3
- package/dist/cjs/types/components/layout/ImageStack.d.ts +3 -1
- package/dist/cjs/types/components/layout/Modal.d.ts +2 -1
- package/dist/cjs/types/components/layout/TokenDetailsView.d.ts +6 -5
- package/dist/cjs/types/components/lists/TokenGroup.d.ts +6 -5
- package/dist/cjs/types/core/index.d.ts +1 -1
- package/dist/cjs/types/stories/badges/PriceChange.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/ImageStack.stories.d.ts +1 -0
- package/dist/cjs/types/stories/layout/TokenDetailsView.stories.d.ts +1 -0
- package/dist/cjs/types/types/components.d.ts +0 -4
- package/dist/esm/index.js +76 -43
- package/dist/esm/types/components/badges/PriceChange.d.ts +4 -3
- package/dist/esm/types/components/layout/ImageStack.d.ts +3 -1
- package/dist/esm/types/components/layout/Modal.d.ts +2 -1
- package/dist/esm/types/components/layout/TokenDetailsView.d.ts +6 -5
- package/dist/esm/types/components/lists/TokenGroup.d.ts +6 -5
- package/dist/esm/types/core/index.d.ts +1 -1
- package/dist/esm/types/stories/badges/PriceChange.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/ImageStack.stories.d.ts +1 -0
- package/dist/esm/types/stories/layout/TokenDetailsView.stories.d.ts +1 -0
- package/dist/esm/types/types/components.d.ts +0 -4
- package/dist/index.css +1 -1
- package/dist/index.d.ts +28 -17
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4186,10 +4186,26 @@ function CrossedOutSunSolidIcon({ size = "20", className, }) {
|
|
|
4186
4186
|
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: [jsxRuntime.jsx("g", { clipPath: "url(#clip0_3313_9942)", children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10 0.833313C10.4603 0.833313 10.8334 1.20641 10.8334 1.66665V2.49998C10.8334 2.96022 10.4603 3.33331 10 3.33331C9.5398 3.33331 9.16671 2.96022 9.16671 2.49998V1.66665C9.16671 1.20641 9.5398 0.833313 10 0.833313ZM10 16.6667C10.4603 16.6667 10.8334 17.0398 10.8334 17.5V18.3333C10.8334 18.7936 10.4603 19.1667 10 19.1667C9.5398 19.1667 9.16671 18.7936 9.16671 18.3333V17.5C9.16671 17.0398 9.5398 16.6667 10 16.6667ZM16.6667 10C16.6667 9.53976 17.0398 9.16666 17.5 9.16666H18.3334C18.7936 9.16666 19.1667 9.53976 19.1667 10C19.1667 10.4602 18.7936 10.8333 18.3334 10.8333H17.5C17.0398 10.8333 16.6667 10.4602 16.6667 10ZM0.833374 10C0.833374 9.53976 1.20647 9.16666 1.66671 9.16666H2.50004C2.96028 9.16666 3.33337 9.53976 3.33337 10C3.33337 10.4602 2.96028 10.8333 2.50004 10.8333H1.66671C1.20647 10.8333 0.833374 10.4602 0.833374 10ZM14.7107 14.7107C15.0361 14.3853 15.5637 14.3853 15.8892 14.7107L16.4808 15.3024C16.8063 15.6278 16.8063 16.1554 16.4808 16.4809C16.1554 16.8063 15.6278 16.8063 15.3023 16.4809L14.7107 15.8892C14.3852 15.5638 14.3852 15.0361 14.7107 14.7107ZM3.51925 3.5191C3.84469 3.19366 4.37232 3.19366 4.69776 3.5191L5.28943 4.11077C5.61486 4.43621 5.61486 4.96384 5.28943 5.28928C4.96399 5.61472 4.43635 5.61472 4.11091 5.28928L3.51925 4.69761C3.19381 4.37218 3.19381 3.84454 3.51925 3.5191ZM6.46451 6.46445C7.91429 5.01466 10.0329 4.64131 11.8271 5.34441L5.34447 11.8271C4.64137 10.0328 5.01472 7.91423 6.46451 6.46445ZM8.17288 14.6555L14.6556 8.17282C15.3587 9.96708 14.9854 12.0857 13.5356 13.5355C12.0858 14.9853 9.96714 15.3587 8.17288 14.6555ZM17.2071 4.20709C17.5976 3.81657 17.5976 3.1834 17.2071 2.79288C16.8166 2.40235 16.1834 2.40235 15.7929 2.79288L2.79289 15.7929C2.40237 16.1834 2.40237 16.8166 2.79289 17.2071C3.18342 17.5976 3.81658 17.5976 4.20711 17.2071L17.2071 4.20709Z", fill: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_3313_9942", children: jsxRuntime.jsx("rect", { width: size, height: size, fill: "currentColor" }) }) })] }));
|
|
4187
4187
|
}
|
|
4188
4188
|
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4189
|
+
const valueWrapperClassName = "!tw-leading-[10px]";
|
|
4190
|
+
var PriceChangeSign;
|
|
4191
|
+
(function (PriceChangeSign) {
|
|
4192
|
+
PriceChangeSign[PriceChangeSign["POSITIVE"] = 0] = "POSITIVE";
|
|
4193
|
+
PriceChangeSign[PriceChangeSign["NEGATIVE"] = 1] = "NEGATIVE";
|
|
4194
|
+
PriceChangeSign[PriceChangeSign["NEUTRAL"] = 2] = "NEUTRAL";
|
|
4195
|
+
})(PriceChangeSign || (PriceChangeSign = {}));
|
|
4196
|
+
const priceChangeSignToIconMap = {
|
|
4197
|
+
[PriceChangeSign.POSITIVE]: (jsxRuntime.jsx(ArrowTriangle, { className: "tw-rotate-180 tw-text-status-positive" })),
|
|
4198
|
+
[PriceChangeSign.NEGATIVE]: (jsxRuntime.jsx(ArrowTriangle, { className: "tw-text-status-negative" })),
|
|
4199
|
+
[PriceChangeSign.NEUTRAL]: jsxRuntime.jsx(PauseIcon, {}),
|
|
4200
|
+
};
|
|
4201
|
+
function PriceChange({ value: rawValue, variant = "small", }) {
|
|
4202
|
+
const valueFormatted = Math.abs(Number(rawValue)).toFixed(2);
|
|
4203
|
+
const sign = Number(rawValue) > 0
|
|
4204
|
+
? PriceChangeSign.POSITIVE
|
|
4205
|
+
: Number(rawValue) < 0
|
|
4206
|
+
? PriceChangeSign.NEGATIVE
|
|
4207
|
+
: PriceChangeSign.NEUTRAL;
|
|
4208
|
+
return (jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xs tw-items-center tw-justify-end tw-text-grey-500", children: jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center tw-justify-center", children: [variant === "small" ? (jsxRuntime.jsx(CaptionText, { className: valueWrapperClassName, children: valueFormatted })) : (jsxRuntime.jsx(BodyText, { size: "small", className: valueWrapperClassName, children: valueFormatted })), jsxRuntime.jsx(CaptionText, { className: "!tw-leading-[10px] tw-text-grey-600", children: "%" }), priceChangeSignToIconMap[sign]] }) }));
|
|
4193
4209
|
}
|
|
4194
4210
|
|
|
4195
4211
|
const statusBgClassMap$1 = {
|
|
@@ -18742,7 +18758,7 @@ const modalWidthClassMap = {
|
|
|
18742
18758
|
large: "mobile-lg:tw-w-modal-large",
|
|
18743
18759
|
"extra-large": "mobile-lg:tw-w-modal-extra-large",
|
|
18744
18760
|
};
|
|
18745
|
-
function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, maxHeight = false, width = "large", }) {
|
|
18761
|
+
function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, maxHeight = false, width = "large", animateOpacity = false, }) {
|
|
18746
18762
|
const [isOpen, setIsOpen] = React$1.useState(_isOpen);
|
|
18747
18763
|
React$1.useEffect(() => {
|
|
18748
18764
|
if (_isOpen) {
|
|
@@ -18770,7 +18786,10 @@ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, m
|
|
|
18770
18786
|
}, className: cn("tw-absolute tw-inset-0 tw-z-40 tw-flex tw-items-start tw-justify-center tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m", _isOpen ? "tw-animate-blur-in" : "tw-animate-blur-out"), children: jsxRuntime.jsx("div", { style: {
|
|
18771
18787
|
[CSS_VARS.SLIDE_TO_TOP_DURATION]: `${ANIMATION_DURATIONS.SHOW_MODAL}ms`,
|
|
18772
18788
|
[CSS_VARS.SLIDE_TO_BOTTOM_DURATION]: `${ANIMATION_DURATIONS.HIDE_MODAL}ms`,
|
|
18773
|
-
|
|
18789
|
+
[CSS_VARS.FADE_IN_DURATION]: `${ANIMATION_DURATIONS.SHOW_MODAL}ms`,
|
|
18790
|
+
[CSS_VARS.FADE_OUT_DURATION]: `${ANIMATION_DURATIONS.HIDE_MODAL}ms`,
|
|
18791
|
+
}, className: cn("tw-relative tw-flex tw-max-h-modal-compact tw-max-w-full tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end mobile-xs:tw-w-modal-compact mobile-lg:tw-max-h-modal-large", className, _isOpen ? "tw-animate-slide-to-top" : "tw-animate-slide-to-bottom", animateOpacity &&
|
|
18792
|
+
(_isOpen ? "tw-animate-fade-in" : "tw-animate-fade-out"), maxHeight && "tw-h-full", modalWidthClassMap[width]), children: children }) })));
|
|
18774
18793
|
}
|
|
18775
18794
|
|
|
18776
18795
|
const borderTypeClassMap = {
|
|
@@ -19183,11 +19202,20 @@ function DropdownMenuTitle({ title }) {
|
|
|
19183
19202
|
return (jsxRuntime.jsx("div", { className: "tw-flex tw-items-center tw-gap-squid-xs tw-self-stretch tw-p-squid-xs tw-pb-squid-xxs tw-text-material-light-average", children: jsxRuntime.jsx(CaptionText, { children: title }) }));
|
|
19184
19203
|
}
|
|
19185
19204
|
|
|
19205
|
+
const extraPaddingMap = {
|
|
19206
|
+
"outline-sm": "1px",
|
|
19207
|
+
"outline-lg": "3px",
|
|
19208
|
+
};
|
|
19186
19209
|
function ImageStack(_a) {
|
|
19187
|
-
var { imageUrls, spacing, stackOnTop = true } = _a, imageProps = __rest$1(_a, ["imageUrls", "spacing", "stackOnTop"]);
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19210
|
+
var { imageUrls, spacing, stackOnTop = true, addExtraPadding, removeDuplicates = false } = _a, imageProps = __rest$1(_a, ["imageUrls", "spacing", "stackOnTop", "addExtraPadding", "removeDuplicates"]);
|
|
19211
|
+
const imagesToRender = removeDuplicates ? [...new Set(imageUrls)] : imageUrls;
|
|
19212
|
+
return (jsxRuntime.jsx("div", { style: {
|
|
19213
|
+
// @ts-expect-error Custom CSS property
|
|
19214
|
+
"--image-stack-spacing": spacing,
|
|
19215
|
+
padding: addExtraPadding && imageProps.border
|
|
19216
|
+
? extraPaddingMap[imageProps.border]
|
|
19217
|
+
: undefined,
|
|
19218
|
+
}, className: "tw-flex tw-items-center tw-space-x-[--image-stack-spacing]", children: imagesToRender.map((url, index, self) => (jsxRuntime.jsx(Image$1, Object.assign({ src: url, containerProps: stackOnTop
|
|
19191
19219
|
? {
|
|
19192
19220
|
style: {
|
|
19193
19221
|
zIndex: self.length - index,
|
|
@@ -19470,13 +19498,13 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
|
|
|
19470
19498
|
}, className: "tw-relative tw-flex tw-w-full tw-flex-col tw-items-start tw-justify-center tw-text-grey-300 tw-transition-colors tw-duration-1000", children: jsxRuntime.jsxs("a", { href: link, target: "_blank", style: Object.assign(Object.assign({}, transitionStyle), { maxHeight: `${STEP_ITEM_HEIGHT}px` }), className: cn("tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs tw-py-squid-xxs", !!link && "hover:tw-bg-material-light-thin", statusTextClass), rel: "noreferrer", children: [jsxRuntime.jsxs("span", { className: "tw-relative tw-flex tw-min-h-squid-l tw-items-center tw-justify-center tw-gap-squid-xxs tw-px-squid-xs", children: [jsxRuntime.jsx(Chip, { style: transitionStyle, className: cn("tw-w-squid-xl", statusBgClassMap[status]), icon: chipContent }), showStepSeparator && (jsxRuntime.jsx("span", { className: cn(separatorClassMap[status], "tw-absolute tw-left-0 tw-top-full tw-mt-0.5"), style: transitionStyle, children: jsxRuntime.jsx(SwapStepSeparator, {}) }))] }), jsxRuntime.jsx(DescriptionBlocks, { className: "tw-min-h-squid-l tw-py-squid-xxs tw-pr-squid-xs", blocks: descriptionBlocks })] }) }));
|
|
19471
19499
|
}
|
|
19472
19500
|
|
|
19473
|
-
const
|
|
19501
|
+
const MAX_PREVIEW_ITEMS = 5;
|
|
19474
19502
|
const mainImageSizeMap = {
|
|
19475
19503
|
compact: "medium",
|
|
19476
19504
|
large: "xxlarge",
|
|
19477
19505
|
small: "xlarge",
|
|
19478
19506
|
};
|
|
19479
|
-
function TokenGroup({ isSelected = false, tokenItems, priceChange, balance, balanceUsd, extraSpacing = true, chainImageUrl, imageUrl, symbol, name, onClick,
|
|
19507
|
+
function TokenGroup({ isSelected = false, tokenItems, priceChange, balance, balanceUsd, extraSpacing = true, chainImageUrl, imageUrl, symbol, name, onClick, variant = "large", className, onChildClick, }) {
|
|
19480
19508
|
var _a;
|
|
19481
19509
|
const [isCollapsed, setIsCollapsed] = React$1.useState(true);
|
|
19482
19510
|
const isCollapsible = tokenItems && tokenItems.length > 0;
|
|
@@ -19489,36 +19517,41 @@ function TokenGroup({ isSelected = false, tokenItems, priceChange, balance, bala
|
|
|
19489
19517
|
setIsCollapsed((prev) => !prev);
|
|
19490
19518
|
}, []);
|
|
19491
19519
|
return (jsxRuntime.jsxs("li", { className: cn("tw-w-full tw-self-stretch", extraSpacing && "tw-px-squid-xs tw-pt-squid-xs", !isCollapsed &&
|
|
19492
|
-
"tw-border-y tw-border-solid tw-border-y-material-light-thin tw-py-squid-xs"), children: [jsxRuntime.jsxs(ContentTag, { onClick: (event) => {
|
|
19520
|
+
"tw-border-y tw-border-solid tw-border-y-material-light-thin tw-py-squid-xs", className), children: [jsxRuntime.jsxs(ContentTag, { onClick: (event) => {
|
|
19493
19521
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
19494
19522
|
if (isCollapsible)
|
|
19495
19523
|
handleToggleCollapsed();
|
|
19496
|
-
},
|
|
19524
|
+
}, style: isCollapsible
|
|
19525
|
+
? {
|
|
19526
|
+
transition: `${ANIMATION_DURATIONS.GENERIC}ms ${ANIMATION_TIMINGS.GENERIC}`,
|
|
19527
|
+
transitionProperty: "height",
|
|
19528
|
+
}
|
|
19529
|
+
: undefined, className: cn("tw-flex tw-w-full tw-items-center tw-rounded-squid-s tw-px-squid-xs", isSelected && "tw-bg-material-light-thin", isInteractive && "hover:tw-bg-material-light-thin", isLargeVariant
|
|
19497
19530
|
? isCollapsed
|
|
19498
19531
|
? "tw-h-[80px] tw-gap-squid-s"
|
|
19499
19532
|
: "tw-h-squid-xl tw-gap-squid-xxs"
|
|
19500
19533
|
: isSmallVariant
|
|
19501
19534
|
? "tw-h-[50px] tw-gap-squid-s tw-py-squid-xxs"
|
|
19502
|
-
: "tw-h-squid-xl tw-gap-squid-xxs"), children: [jsxRuntime.jsx(
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
(isSmallVariant ? "tw-gap-squid-xs" : "tw-gap-squid-xxs"), isSmallVariant && "tw-h-[45px]"), children: [jsxRuntime.jsxs("div", { className: cn("tw-flex tw-
|
|
19535
|
+
: "tw-h-squid-xl tw-gap-squid-xxs"), children: [jsxRuntime.jsxs("div", { className: "tw-relative", children: [jsxRuntime.jsx(Image$1, { src: imageUrl, size: isLargeVariant && !isCollapsed
|
|
19536
|
+
? "medium"
|
|
19537
|
+
: (_a = mainImageSizeMap[variant]) !== null && _a !== void 0 ? _a : "medium", rounded: isCompactVariant ? "xxs" : "full", style: {
|
|
19538
|
+
transition: `${ANIMATION_DURATIONS.GENERIC}ms ${ANIMATION_TIMINGS.GENERIC}`,
|
|
19539
|
+
transitionProperty: "width, height",
|
|
19540
|
+
} }), isLargeVariant && (jsxRuntime.jsx("div", { style: isCollapsible
|
|
19541
|
+
? {
|
|
19542
|
+
transition: `${ANIMATION_DURATIONS.GENERIC / 4}ms ${ANIMATION_TIMINGS.GENERIC}`,
|
|
19543
|
+
transitionProperty: "opacity",
|
|
19544
|
+
transitionDelay: isCollapsed
|
|
19545
|
+
? `${ANIMATION_DURATIONS.GENERIC / 10}ms`
|
|
19546
|
+
: undefined,
|
|
19547
|
+
opacity: isCollapsed ? 1 : 0,
|
|
19548
|
+
}
|
|
19549
|
+
: undefined, className: cn("tw-absolute", isCollapsible
|
|
19550
|
+
? "-tw-bottom-0 -tw-right-0"
|
|
19551
|
+
: "-tw-bottom-[3px] -tw-right-[3px]"), children: jsxRuntime.jsx(ImageStack, { spacing: "-10px", removeDuplicates: true, addExtraPadding: !isCollapsible, size: "medium", rounded: "xxs", border: "outline-lg", imageUrls: isCollapsible
|
|
19552
|
+
? tokenItems === null || tokenItems === void 0 ? void 0 : tokenItems.slice(0, MAX_PREVIEW_ITEMS).map((item) => item.chainImageUrl)
|
|
19553
|
+
: [chainImageUrl] }) }))] }), jsxRuntime.jsxs("div", { className: cn("tw-flex tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-text-grey-300", isCollapsed &&
|
|
19554
|
+
(isSmallVariant ? "tw-gap-squid-xs" : "tw-gap-squid-xxs"), isSmallVariant && "tw-h-[45px]"), children: [jsxRuntime.jsxs("div", { className: cn("tw-flex tw-gap-squid-xxs tw-self-stretch", isSmallVariant ? "tw-h-[13px] tw-items-end" : "tw-items-center", isLargeVariant && "tw-h-squid-m"), children: [jsxRuntime.jsx(BodyText, { size: "small", className: "tw-h-fit !tw-leading-[13px]", children: name }), (!isCollapsed || isCompactVariant) && (jsxRuntime.jsx(ChevronTopIcon, { className: cn("tw-text-grey-500", isCollapsed ? "tw-rotate-90" : "tw-rotate-180") })), balanceUsd ? (jsxRuntime.jsx("span", { className: cn("tw-flex tw-flex-1 tw-items-center tw-justify-end", isCollapsed ? "tw-text-grey-300" : "tw-text-grey-500"), children: isSmallVariant ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "!tw-leading-[10px] tw-opacity-66", children: "$" }), jsxRuntime.jsx(CaptionText, { className: "!tw-leading-[10px]", children: balanceUsd })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(BodyText, { size: "small", className: "!tw-leading-[10px] tw-opacity-66", children: "$" }), jsxRuntime.jsx(BodyText, { size: "small", className: "!tw-leading-[10px]", children: balanceUsd })] })) })) : null] }), !isCompactVariant && (jsxRuntime.jsx(Collapse, { collapsed: !isCollapsed, contentsClassName: "tw-flex tw-w-full tw-items-start tw-justify-between", className: "tw-w-full", children: jsxRuntime.jsxs("div", { className: cn("tw-flex tw-w-full tw-items-center tw-justify-between tw-self-stretch", isLargeVariant && "tw-h-squid-m"), children: [jsxRuntime.jsx("div", { className: "tw-flex tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-grey-400", children: jsxRuntime.jsxs(CaptionText, { className: "!tw-leading-[10px]", children: [balance, symbol] }) }), priceChange && jsxRuntime.jsx(PriceChange, { value: priceChange })] }) }))] })] }), jsxRuntime.jsx(Collapse, { collapsed: isCollapsed, children: jsxRuntime.jsx("ul", { className: cn("tw-flex tw-flex-col tw-items-start tw-justify-end tw-self-stretch", isCompactVariant && "tw-gap-squid-xs tw-pt-squid-xs"), children: tokenItems === null || tokenItems === void 0 ? void 0 : tokenItems.map((token) => (jsxRuntime.jsx(TokenGroup, Object.assign({}, token, { extraSpacing: false, variant: isCompactVariant ? "small" : "large", onClick: () => onChildClick === null || onChildClick === void 0 ? void 0 : onChildClick(token) }), token.chainImageUrl))) }) })] }));
|
|
19522
19555
|
}
|
|
19523
19556
|
|
|
19524
19557
|
function ActionLayout({ lineCap = jsxRuntime.jsx(Timeline.CapTop, {}), status = "executed", showTimeline = true, showBody = true, nextStatus, statusIcon, description, title, icon, children, }) {
|
|
@@ -19781,19 +19814,19 @@ function Toast({ headerContent, actionsContent, description, chipLabel, title, }
|
|
|
19781
19814
|
|
|
19782
19815
|
const DEFAULT_TIMEFRAME = "1D";
|
|
19783
19816
|
const DefaultChart = ({ timeframe, }) => (jsxRuntime.jsx("div", { className: "tw-flex tw-h-full tw-w-full tw-items-center tw-justify-center", children: jsxRuntime.jsxs(BodyText, { size: "small", children: ["Chart (", timeframe, ")"] }) }));
|
|
19784
|
-
const TokenModalHeader = ({ token, chain, onLikeToken, onClose, }) => (jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-start tw-justify-between", children: [jsxRuntime.jsx("div", { className: "tw-flex tw-items-center tw-gap-squid-xs tw-pb-squid-xs", children: jsxRuntime.jsx(BadgeImage, { image: {
|
|
19817
|
+
const TokenModalHeader = ({ token, chain, onLikeToken, onClose, isFavorite, }) => (jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-items-start tw-justify-between", children: [jsxRuntime.jsx("div", { className: "tw-flex tw-items-center tw-gap-squid-xs tw-pb-squid-xs", children: jsxRuntime.jsx(BadgeImage, { image: {
|
|
19785
19818
|
src: token.image,
|
|
19786
19819
|
size: "xxlarge",
|
|
19787
19820
|
rounded: "full",
|
|
19788
19821
|
shadow: true,
|
|
19789
19822
|
}, badge: {
|
|
19790
19823
|
src: chain.image,
|
|
19791
|
-
size: "
|
|
19824
|
+
size: "medium",
|
|
19792
19825
|
rounded: "xxs",
|
|
19793
|
-
border: "outline-
|
|
19794
|
-
} }) }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(IconButton, { className: "tw-text-grey-300", onClick: onLikeToken, icon: jsxRuntime.jsx(EmptyHeartIcon, {}) }), jsxRuntime.jsx(IconButton, { className: "tw-text-grey-300", onClick: onClose, icon: jsxRuntime.jsx(CircleXFilledIcon, {}) })] })] }));
|
|
19795
|
-
const TokenInfo = ({ token, tokenPrice, priceChange, loading, }) => (jsxRuntime.jsxs("div", { children: [jsxRuntime.
|
|
19796
|
-
const BalanceInfo = ({ balance, balanceUSD, token, loading, }) => (jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-col", children: [jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-400", children: "Balance" }), jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-row tw-justify-between", children: [jsxRuntime.jsxs("span", { className: "tw-flex tw-flex-row tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx("img", { src: token.image, alt: token.name, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }), jsxRuntime.jsxs(BodyText, { size: "small", loading: { isLoading: loading, width: "80px" }, children: [balance
|
|
19826
|
+
border: "outline-lg",
|
|
19827
|
+
} }) }), jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(IconButton, { className: "tw-group/token-detail-fav-icon tw-text-grey-300", onClick: onLikeToken, icon: isFavorite ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(FilledHeartIcon, { className: "tw-block group-hover/token-detail-fav-icon:tw-hidden" }), jsxRuntime.jsx(BrokenHeartIcon, { className: "tw-hidden group-hover/token-detail-fav-icon:tw-block" })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(EmptyHeartIcon, { className: "tw-block group-hover/token-detail-fav-icon:tw-hidden" }), jsxRuntime.jsx(FilledHeartIcon, { className: "tw-hidden group-hover/token-detail-fav-icon:tw-block" })] })) }), jsxRuntime.jsx(IconButton, { className: "tw-text-grey-300", onClick: onClose, icon: jsxRuntime.jsx(CircleXFilledIcon, {}) })] })] }));
|
|
19828
|
+
const TokenInfo = ({ token, tokenPrice, priceChange, loading, }) => (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(BodyText, { size: "large", loading: { isLoading: loading, width: "100px" }, children: tokenPrice.toLocaleString() }), jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-row tw-justify-between", children: [jsxRuntime.jsx(BodyText, { size: "small", children: token.name }), jsxRuntime.jsx(PriceChange, { value: priceChange, variant: "large" })] })] }));
|
|
19829
|
+
const BalanceInfo = ({ balance, balanceUSD, token, loading, }) => (jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-col", children: [jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-400", children: "Balance" }), jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-row tw-justify-between", children: [jsxRuntime.jsxs("span", { className: "tw-flex tw-flex-row tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx("img", { src: token.image, alt: token.name, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }), jsxRuntime.jsxs(BodyText, { size: "small", loading: { isLoading: loading, width: "80px" }, children: [balance, " ", token.symbol] })] }), jsxRuntime.jsxs(CaptionText, { className: "tw-text-grey-500", loading: { isLoading: loading, width: "60px" }, children: [jsxRuntime.jsx("span", { className: "tw-opacity-66", children: "$" }), balanceUSD] })] })] }));
|
|
19797
19830
|
const MarketDataItem = ({ label, value, showDollar, loading, }) => (jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-col", children: [jsxRuntime.jsx(CaptionText, { className: "tw-text-grey-500", children: label }), jsxRuntime.jsxs(CaptionText, { loading: { isLoading: loading, width: "60px" }, children: [showDollar && jsxRuntime.jsx("span", { className: "tw-text-grey-500", children: "$" }), value] })] }));
|
|
19798
19831
|
const TokenMarketData = ({ volume24h, marketCap, totalSupply, loading, }) => (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-full tw-w-full tw-flex-row tw-items-center tw-justify-between", children: [jsxRuntime.jsx(MarketDataItem, { label: "24h volume", value: volume24h, showDollar: true, loading: loading }), jsxRuntime.jsx(MarketDataItem, { label: "Market cap", value: marketCap, showDollar: true, loading: loading }), jsxRuntime.jsx(MarketDataItem, { label: "Total supply", value: totalSupply, loading: loading })] }));
|
|
19799
19832
|
const SwapButton = ({ label, color, icon, onClick, textColor, }) => (jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-1 tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs", children: [jsxRuntime.jsx(IconButton, { icon: icon, className: "tw-text-grey-900", style: {
|
|
@@ -19817,13 +19850,13 @@ const ChartTimeframeSelector = ({ selectedTimeframe, onTimeframeChange, }) => {
|
|
|
19817
19850
|
onTimeframeChange(timeframe);
|
|
19818
19851
|
} }, timeframe))) }));
|
|
19819
19852
|
};
|
|
19820
|
-
const TokenDetailsView = ({ isOpen, onClose, token, chain, tokenPrice, priceChange, balance, balanceUSD, volume24h, marketCap, totalSupply, loading, onLikeToken, Chart = DefaultChart, initialTimeframe = DEFAULT_TIMEFRAME, onTimeframeChange = () => { }, onSwapFrom, onSwapTo, }) => {
|
|
19853
|
+
const TokenDetailsView = ({ isOpen, onClose, token, chain, tokenPrice, priceChange, balance, balanceUSD, volume24h, marketCap, totalSupply, loading, onLikeToken, isFavorite, Chart = DefaultChart, initialTimeframe = DEFAULT_TIMEFRAME, onTimeframeChange = () => { }, onSwapFrom, onSwapTo, }) => {
|
|
19821
19854
|
const [selectedTimeframe, setSelectedTimeframe] = React$1.useState(initialTimeframe);
|
|
19822
19855
|
const handleTimeframeChange = (timeframe) => {
|
|
19823
19856
|
setSelectedTimeframe(timeframe);
|
|
19824
19857
|
onTimeframeChange(timeframe);
|
|
19825
19858
|
};
|
|
19826
|
-
return (jsxRuntime.jsx(Modal, { isOpen: isOpen, onBackdropClick: onClose, width: "extra-large", className: "tw-my-auto", children: jsxRuntime.jsxs(ModalContent, { className: "tw-flex tw-min-h-[631px] tw-flex-col !tw-bg-grey-900 tw-pt-squid-m", children: [jsxRuntime.jsxs("div", { className: "tw-px-squid-m", children: [jsxRuntime.jsx(TokenModalHeader, { token: token, chain: chain,
|
|
19859
|
+
return (jsxRuntime.jsx(Modal, { animateOpacity: true, isOpen: isOpen, onBackdropClick: onClose, width: "extra-large", className: "tw-my-auto", children: jsxRuntime.jsxs(ModalContent, { className: "tw-flex tw-min-h-[631px] tw-flex-col !tw-bg-grey-900 tw-pt-squid-m", children: [jsxRuntime.jsxs("div", { className: "tw-px-squid-m", children: [jsxRuntime.jsx(TokenModalHeader, { token: token, chain: chain, onLikeToken: onLikeToken, isFavorite: isFavorite, onClose: onClose }), jsxRuntime.jsx(TokenInfo, { token: token, tokenPrice: tokenPrice, priceChange: priceChange, loading: loading })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-w-full tw-grow tw-flex-col tw-justify-between tw-text-center", children: [jsxRuntime.jsx("span", { className: "tw-flex tw-h-full tw-grow tw-items-center tw-justify-center", children: loading ? jsxRuntime.jsx(Loader, {}) : jsxRuntime.jsx(Chart, { timeframe: selectedTimeframe }) }), jsxRuntime.jsx(ChartTimeframeSelector, { selectedTimeframe: selectedTimeframe, onTimeframeChange: handleTimeframeChange })] }), jsxRuntime.jsx("hr", { className: "tw-my-squid-xs tw-h-px tw-border-0 tw-bg-material-light-thin" }), jsxRuntime.jsxs("div", { className: "tw-flex tw-flex-col", children: [jsxRuntime.jsxs("div", { className: "tw-gap-squid-sm tw-flex tw-flex-col tw-px-squid-m", children: [jsxRuntime.jsx(BalanceInfo, { balance: balance, balanceUSD: balanceUSD, token: token, loading: loading }), jsxRuntime.jsx("hr", { className: "tw-my-squid-xs tw-h-px tw-border-0 tw-bg-material-light-thin" }), jsxRuntime.jsx(TokenMarketData, { volume24h: volume24h, marketCap: marketCap, totalSupply: totalSupply, loading: loading })] }), jsxRuntime.jsx("hr", { className: "tw-my-squid-xs tw-h-px tw-border-0 tw-bg-material-light-thin" }), jsxRuntime.jsx(SwapButtons, { token: token, onSwapFrom: onSwapFrom, onSwapTo: onSwapTo })] })] }) }));
|
|
19827
19860
|
};
|
|
19828
19861
|
|
|
19829
19862
|
const WIDTH_SM = "69";
|
|
@@ -69581,6 +69614,7 @@ function ThemeProvider(_a) {
|
|
|
69581
69614
|
return (jsxRuntime.jsx("div", Object.assign({}, props, { style: Object.assign(Object.assign({}, props.style), parsedStyle), "data-squid-theme-type": themeType, className: cn("tw-group tw-relative tw-flex tw-font-squid-main tw-h-d-screen mobile-lg:tw-h-auto", props.className), children: children })));
|
|
69582
69615
|
}
|
|
69583
69616
|
|
|
69617
|
+
exports.ANIMATION_DURATIONS = ANIMATION_DURATIONS;
|
|
69584
69618
|
exports.ActionLayout = ActionLayout;
|
|
69585
69619
|
exports.ActionLineOutRow = ActionLineOutRow;
|
|
69586
69620
|
exports.ActionProperties = ActionProperties;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface PriceChangeProps {
|
|
2
|
+
variant?: "small" | "large";
|
|
3
|
+
value: string | number;
|
|
3
4
|
}
|
|
4
|
-
export declare function PriceChange({
|
|
5
|
+
export declare function PriceChange({ value: rawValue, variant, }: PriceChangeProps): import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type ImageProps } from "../badges";
|
|
2
|
-
export declare function ImageStack({ imageUrls, spacing, stackOnTop, ...imageProps }: {
|
|
2
|
+
export declare function ImageStack({ imageUrls, spacing, stackOnTop, addExtraPadding, removeDuplicates, ...imageProps }: {
|
|
3
3
|
imageUrls: string[];
|
|
4
4
|
spacing: string;
|
|
5
5
|
border?: ImageProps["border"];
|
|
6
6
|
rounded?: ImageProps["rounded"];
|
|
7
7
|
size?: ImageProps["size"];
|
|
8
8
|
stackOnTop?: boolean;
|
|
9
|
+
addExtraPadding?: boolean;
|
|
10
|
+
removeDuplicates?: boolean;
|
|
9
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,7 @@ interface ModalProps {
|
|
|
7
7
|
isOpen?: boolean;
|
|
8
8
|
maxHeight?: boolean;
|
|
9
9
|
width?: ModalWidth;
|
|
10
|
+
animateOpacity?: boolean;
|
|
10
11
|
}
|
|
11
|
-
export declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, maxHeight, width, }: ModalProps): false | import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, maxHeight, width, animateOpacity, }: ModalProps): false | import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -18,15 +18,16 @@ interface TokenDetailsViewProps {
|
|
|
18
18
|
onClose: () => void;
|
|
19
19
|
token: Token;
|
|
20
20
|
chain: Chain;
|
|
21
|
-
tokenPrice:
|
|
22
|
-
priceChange: number;
|
|
23
|
-
balance:
|
|
24
|
-
balanceUSD:
|
|
21
|
+
tokenPrice: string;
|
|
22
|
+
priceChange: string | number;
|
|
23
|
+
balance: string;
|
|
24
|
+
balanceUSD: string;
|
|
25
25
|
volume24h: string;
|
|
26
26
|
marketCap: string;
|
|
27
27
|
totalSupply: string;
|
|
28
28
|
loading: boolean;
|
|
29
29
|
onLikeToken: () => void;
|
|
30
|
+
isFavorite?: boolean;
|
|
30
31
|
Chart?: React.ComponentType<{
|
|
31
32
|
timeframe: Timeframe;
|
|
32
33
|
}>;
|
|
@@ -35,5 +36,5 @@ interface TokenDetailsViewProps {
|
|
|
35
36
|
onSwapFrom: (token: Pick<Token, "address" | "chainId">) => void;
|
|
36
37
|
onSwapTo: (token: Pick<Token, "address" | "chainId">) => void;
|
|
37
38
|
}
|
|
38
|
-
export declare const TokenDetailsView: ({ isOpen, onClose, token, chain, tokenPrice, priceChange, balance, balanceUSD, volume24h, marketCap, totalSupply, loading, onLikeToken, Chart, initialTimeframe, onTimeframeChange, onSwapFrom, onSwapTo, }: TokenDetailsViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const TokenDetailsView: ({ isOpen, onClose, token, chain, tokenPrice, priceChange, balance, balanceUSD, volume24h, marketCap, totalSupply, loading, onLikeToken, isFavorite, Chart, initialTimeframe, onTimeframeChange, onSwapFrom, onSwapTo, }: TokenDetailsViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
40
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type PriceChange as TPriceChange } from "../../types/components";
|
|
3
2
|
type TokenGroupVariant = "compact" | "large" | "small";
|
|
4
|
-
export interface TokenGroupProps {
|
|
3
|
+
export interface TokenGroupProps<T extends TokenGroupProps<T>> {
|
|
5
4
|
isSelected?: boolean;
|
|
6
5
|
imageUrl: string;
|
|
7
6
|
symbol: string;
|
|
@@ -9,12 +8,14 @@ export interface TokenGroupProps {
|
|
|
9
8
|
chainImageUrl: string;
|
|
10
9
|
balance?: string;
|
|
11
10
|
balanceUsd?: string;
|
|
12
|
-
priceChange?:
|
|
13
|
-
tokenItems?:
|
|
11
|
+
priceChange?: string | number;
|
|
12
|
+
tokenItems?: T[];
|
|
14
13
|
extraSpacing?: boolean;
|
|
15
14
|
onClick?: (event: React.MouseEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
16
15
|
maxPreviewItems?: number;
|
|
17
16
|
variant?: TokenGroupVariant;
|
|
17
|
+
className?: string;
|
|
18
|
+
onChildClick?: (tokenProps: T) => void;
|
|
18
19
|
}
|
|
19
|
-
export declare function TokenGroup({ isSelected, tokenItems, priceChange, balance, balanceUsd, extraSpacing, chainImageUrl, imageUrl, symbol, name, onClick,
|
|
20
|
+
export declare function TokenGroup<T extends TokenGroupProps<T>>({ isSelected, tokenItems, priceChange, balance, balanceUsd, extraSpacing, chainImageUrl, imageUrl, symbol, name, onClick, variant, className, onChildClick, }: TokenGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MEDIA_QUERIES, CSS_VARS } from "./constants";
|
|
1
|
+
export { MEDIA_QUERIES, CSS_VARS, ANIMATION_DURATIONS } from "./constants";
|
|
2
2
|
export { darkTheme, lightTheme } from "./themes";
|
|
3
3
|
export { baseTailwindConfig, spacing } from "./design-system";
|
|
4
4
|
export { cn } from "./utils";
|
|
@@ -4,5 +4,6 @@ declare const meta: Meta<typeof ImageStack>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const RemoveDuplicates: Story;
|
|
7
8
|
export declare const NegativeSpacing: Story;
|
|
8
9
|
export declare const LargeImages: Story;
|
|
@@ -43,7 +43,3 @@ export type StatusFilter = "success" | "ongoing" | "error";
|
|
|
43
43
|
export type AssetsButtonVariant = "primary" | "accent";
|
|
44
44
|
export type PropertyListItemSize = "small" | "large";
|
|
45
45
|
export type DropdownPosition = "top" | "bottom" | "center";
|
|
46
|
-
export interface PriceChange {
|
|
47
|
-
value: string;
|
|
48
|
-
sign: "positive" | "negative" | "neutral";
|
|
49
|
-
}
|