@0xsquid/ui 0.7.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +48 -15
- package/dist/cjs/types/components/icons/Arrow.d.ts +4 -1
- package/dist/cjs/types/components/layout/SwapStepsCollapsed.d.ts +1 -1
- package/dist/cjs/types/components/lists/SwapStepItem.d.ts +4 -2
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/stories/lists/SwapStepItem.stories.d.ts +4 -1
- package/dist/cjs/types/types/components.d.ts +2 -0
- package/dist/esm/index.js +48 -16
- package/dist/esm/types/components/icons/Arrow.d.ts +4 -1
- package/dist/esm/types/components/layout/SwapStepsCollapsed.d.ts +1 -1
- package/dist/esm/types/components/lists/SwapStepItem.d.ts +4 -2
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/stories/lists/SwapStepItem.stories.d.ts +4 -1
- package/dist/esm/types/types/components.d.ts +2 -0
- package/dist/index.css +99 -18
- package/dist/index.d.ts +17 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2652,8 +2652,8 @@ function ChevronLargeRightIcon({ size = '16', className, }) {
|
|
|
2652
2652
|
function ChevronRightSmallIcon() {
|
|
2653
2653
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: jsxRuntime.jsx("path", { d: "M6.66675 10.6667L8.86201 8.47141C9.12236 8.21106 9.12236 7.78896 8.86201 7.52861L6.66675 5.33334", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2654
2654
|
}
|
|
2655
|
-
function ArrowLeftIcon() {
|
|
2656
|
-
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width:
|
|
2655
|
+
function ArrowLeftIcon({ className, size = '24', }) {
|
|
2656
|
+
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: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2657
2657
|
}
|
|
2658
2658
|
function ChevronGrabberVerticalIcon({ size = '16', className, }) {
|
|
2659
2659
|
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: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
@@ -3132,7 +3132,7 @@ function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
|
|
|
3132
3132
|
}
|
|
3133
3133
|
|
|
3134
3134
|
function useModal(props) {
|
|
3135
|
-
const [isModalOpen, setIsModalOpen] = react.useState(Boolean(void 0 ));
|
|
3135
|
+
const [isModalOpen, setIsModalOpen] = react.useState(Boolean(props === null || props === void 0 ? void 0 : props.initialIsModalOpen));
|
|
3136
3136
|
const modalRef = react.useRef(null);
|
|
3137
3137
|
const openModalButtonRef = react.useRef(null);
|
|
3138
3138
|
react.useEffect(() => {
|
|
@@ -3245,8 +3245,23 @@ function SwapStepSeparator() {
|
|
|
3245
3245
|
return (jsxRuntime.jsx("span", { className: "tw-flex tw-h-squid-m tw-w-squid-xxl tw-items-center tw-justify-center tw-self-stretch tw-py-0.5", children: jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "4", height: "21", viewBox: "0 0 4 21", fill: "none", children: jsxRuntime.jsx("path", { d: "M2 2.5V18.5", stroke: "currentColor", "stroke-width": "4", "stroke-linecap": "round" }) }) }));
|
|
3246
3246
|
}
|
|
3247
3247
|
|
|
3248
|
-
|
|
3249
|
-
|
|
3248
|
+
const statusTextClassMap = {
|
|
3249
|
+
executed: 'tw-text-grey-300',
|
|
3250
|
+
progress: 'tw-text-royal-400',
|
|
3251
|
+
pending: 'tw-text-grey-600',
|
|
3252
|
+
};
|
|
3253
|
+
const statusBgClassMap = {
|
|
3254
|
+
executed: '!tw-bg-grey-300',
|
|
3255
|
+
progress: '!tw-bg-royal-400',
|
|
3256
|
+
pending: '!tw-bg-grey-600',
|
|
3257
|
+
};
|
|
3258
|
+
const separatorClassMap = {
|
|
3259
|
+
executed: 'tw-text-grey-300',
|
|
3260
|
+
progress: 'tw-text-grey-600',
|
|
3261
|
+
pending: 'tw-text-grey-600',
|
|
3262
|
+
};
|
|
3263
|
+
function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = false, link, status = 'pending', }) {
|
|
3264
|
+
return (jsxRuntime.jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-bg-grey-800 tw-text-grey-300", children: [showStepSeparator && (jsxRuntime.jsx("span", { className: separatorClassMap[status], children: jsxRuntime.jsx(SwapStepSeparator, {}) })), jsxRuntime.jsxs("a", { href: link, target: "_blank", className: cn('tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs', !!link && 'hover:tw-bg-material-light-thin', statusTextClassMap[status]), children: [jsxRuntime.jsx("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, { className: cn('tw-w-squid-xl', statusBgClassMap[status]), icon: typeof chipContent === 'string' ? (jsxRuntime.jsx(CaptionText, { children: chipContent })) : (chipContent) }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map(({ type, value }, index) => {
|
|
3250
3265
|
if (type === 'string') {
|
|
3251
3266
|
return (
|
|
3252
3267
|
// Instead of displaying the string into a single <BodyText />
|
|
@@ -3261,7 +3276,7 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3261
3276
|
return (jsxRuntime.jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }, index));
|
|
3262
3277
|
}
|
|
3263
3278
|
return null;
|
|
3264
|
-
}) })] })] }));
|
|
3279
|
+
}) }), !!link && (jsxRuntime.jsx(ChevronLargeRightIcon, { className: "tw-mr-squid-xxs tw-hidden tw-text-material-light-average group-hover/swap-step-item:tw-block" }))] })] }));
|
|
3265
3280
|
}
|
|
3266
3281
|
|
|
3267
3282
|
function DropdownMenu({ dropdownRef, items, className, }) {
|
|
@@ -3317,11 +3332,20 @@ function SwapProgressViewHeader({ title, description, }) {
|
|
|
3317
3332
|
return (jsxRuntime.jsxs("header", { className: "tw-flex tw-h-[95px] tw-w-full tw-flex-col tw-gap-squid-s tw-bg-grey-800 tw-px-squid-m tw-py-squid-s", children: [jsxRuntime.jsx(BodyText, { size: "large", className: "tw-h-squid-m !tw-leading-[20px] tw-text-grey-300", children: title }), jsxRuntime.jsx(CaptionText, { className: "tw-h-squid-l tw-text-grey-500", children: description })] }));
|
|
3318
3333
|
}
|
|
3319
3334
|
|
|
3320
|
-
function SwapStepsCollapsed({ steps, currentStepIndex:
|
|
3321
|
-
|
|
3335
|
+
function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }) {
|
|
3336
|
+
const newStepIndex = Math.round(_newStepIndex);
|
|
3337
|
+
const [currentStepIndex, setCurrentStepIndex] = react.useState(newStepIndex);
|
|
3338
|
+
react.useEffect(() => {
|
|
3339
|
+
const timeoutId = setTimeout(() => {
|
|
3340
|
+
setCurrentStepIndex(Math.round(newStepIndex));
|
|
3341
|
+
}, 400);
|
|
3342
|
+
return () => {
|
|
3343
|
+
clearTimeout(timeoutId);
|
|
3344
|
+
};
|
|
3345
|
+
}, [newStepIndex]);
|
|
3346
|
+
// handles whether route component is mounted
|
|
3322
3347
|
const [isRouteVisible, setIsRouteVisible] = react.useState(false);
|
|
3323
|
-
|
|
3324
|
-
// handles if route component is animating to show
|
|
3348
|
+
// handles whether route component is animating to show
|
|
3325
3349
|
const [isShowRouteAnimationRunning, setIsShowRouteAnimationRunning] = react.useState(false);
|
|
3326
3350
|
const currentStep = steps[currentStepIndex];
|
|
3327
3351
|
const isLastStep = currentStepIndex === steps.length - 1;
|
|
@@ -3339,16 +3363,24 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _currentStepIndex, }) {
|
|
|
3339
3363
|
};
|
|
3340
3364
|
}, [isShowRouteAnimationRunning]);
|
|
3341
3365
|
const collapseRouteSteps = () => setIsShowRouteAnimationRunning(false);
|
|
3342
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full
|
|
3366
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full", childrenClassName: "tw-w-full tw-rounded-full", children: jsxRuntime.jsxs("button", { className: "tw-relative tw-max-h-button tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800", onClick: () => {
|
|
3343
3367
|
// mount route component and start animation
|
|
3344
3368
|
setIsRouteVisible(true);
|
|
3345
3369
|
setIsShowRouteAnimationRunning(true);
|
|
3346
|
-
},
|
|
3370
|
+
}, children: [newStepIndex > currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-animate-translate-to-bottom tw-absolute -tw-top-full tw-left-0 tw-w-full", children: jsxRuntime.jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsxRuntime.jsx(CurrentStep, { className: cn(newStepIndex > currentStepIndex &&
|
|
3371
|
+
'tw-animate-translate-to-bottom', newStepIndex < currentStepIndex && 'tw-animate-translate-to-top'), currentStep: currentStep, isFirstStep: isFirstStep, isLastStep: isLastStep }), newStepIndex < currentStepIndex && (jsxRuntime.jsx("div", { className: "tw-animate-translate-to-top tw-absolute tw-left-0 tw-top-full tw-w-full", children: jsxRuntime.jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsxRuntime.jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-20 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800" }), jsxRuntime.jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-20 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800" })] }) }), isRouteVisible && (jsxRuntime.jsxs("div", { className: "tw-absolute tw-top-0 tw-z-20 tw-flex tw-h-[536px] tw-w-full tw-flex-col tw-justify-end tw-gap-squid-xxs", children: [jsxRuntime.jsx("div", { className: cn('tw-absolute tw-top-0 tw-h-[536px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-opacity-0 tw-backdrop-blur/10', isShowRouteAnimationRunning
|
|
3347
3372
|
? 'tw-animate-fade-in'
|
|
3348
3373
|
: 'tw-animate-fade-out'), onClick: collapseRouteSteps }), jsxRuntime.jsxs("div", { className: cn('tw-flex tw-max-h-[536px] tw-w-full tw-flex-col tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
|
|
3349
3374
|
? 'tw-animate-slide-to-top'
|
|
3350
|
-
: 'tw-animate-slide-to-bottom'), children: [jsxRuntime.jsx("div", { className: "tw-flex tw-h-[52px] tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-xs", children: jsxRuntime.jsx("button", { onClick: collapseRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsxRuntime.jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsxRuntime.jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsxRuntime.jsx("ul", { className: "tw-flex tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs", children: steps.map((step, index) => (jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1)
|
|
3351
|
-
|
|
3375
|
+
: 'tw-animate-slide-to-bottom'), children: [jsxRuntime.jsx("div", { className: "tw-flex tw-h-[52px] tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-xs", children: jsxRuntime.jsx("button", { onClick: collapseRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsxRuntime.jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsxRuntime.jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsxRuntime.jsx("ul", { className: "tw-flex tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs", children: steps.map((step, index) => (jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1), link: step.link, status: currentStepIndex < index
|
|
3376
|
+
? 'pending'
|
|
3377
|
+
: currentStepIndex > index
|
|
3378
|
+
? 'executed'
|
|
3379
|
+
: 'progress' }, index))) }), jsxRuntime.jsx("footer", { className: "tw-flex tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsxRuntime.jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] })] }))] }));
|
|
3380
|
+
}
|
|
3381
|
+
const CurrentStep = ({ currentStep, isFirstStep, isLastStep, className, }) => {
|
|
3382
|
+
return (jsxRuntime.jsxs("div", { className: cn('tw-relative tw-z-10 tw-flex tw-min-h-button tw-w-full tw-items-center tw-overflow-hidden tw-rounded-squid-xxl tw-px-squid-xs tw-text-grey-300', className), children: [!isLastStep && (jsxRuntime.jsx("span", { className: "tw-absolute -tw-top-1.5 tw-z-0", children: jsxRuntime.jsx(SwapStepSeparator, {}) })), currentStep && (jsxRuntime.jsx(SwapStepItem, { descriptionBlocks: currentStep.descriptionBlocks, chipContent: currentStep.chipContent, status: "progress" })), !isFirstStep && (jsxRuntime.jsx("span", { className: "tw-absolute -tw-bottom-1.5 tw-z-0", children: jsxRuntime.jsx(SwapStepSeparator, {}) }))] }));
|
|
3383
|
+
};
|
|
3352
3384
|
|
|
3353
3385
|
function TokenPair({ firstToken, secondToken }) {
|
|
3354
3386
|
return (jsxRuntime.jsxs("div", { className: "tw-relative tw-h-[42px] tw-w-[94px]", children: [jsxRuntime.jsxs("svg", { width: "94", height: "42", viewBox: "0 0 94 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "tw-absolute tw-z-10 tw-text-material-light-average", children: [jsxRuntime.jsx("g", { filter: "url(#filter0_b_457_51391)", children: jsxRuntime.jsx("path", { d: "M58.5042 35.4956L58.5043 35.4957C62.5071 39.4985 67.7544 41.5 73.0001 41.5C84.3219 41.5 93.5 32.3218 93.5 21C93.5 9.67822 84.3219 0.5 73.0001 0.5C67.7544 0.499977 62.5071 2.50151 58.5043 6.50431C57.9743 7.03437 57.4538 7.57007 56.9412 8.09756L56.9403 8.09852C55.2889 9.79812 53.7279 11.4027 52.097 12.5879C50.4734 13.7678 48.8225 14.5 47 14.5C45.1775 14.5 43.5266 13.7678 41.903 12.5879C40.2721 11.4027 38.7111 9.79812 37.0597 8.09852L37.0589 8.09766C36.5463 7.57013 36.0258 7.03441 35.4957 6.50431C31.4929 2.50151 26.2456 0.499977 20.9999 0.5C15.7543 0.500023 10.5071 2.50156 6.50431 6.50431C2.50153 10.5071 0.5 15.7544 0.5 21C0.5 26.2456 2.50153 31.4929 6.50431 35.4957C10.5071 39.4984 15.7543 41.5 20.9999 41.5C26.2456 41.5 31.4929 39.4985 35.4957 35.4957L35.4958 35.4956C36.023 34.968 36.5408 34.4349 37.0508 33.9099L37.0521 33.9086C38.7042 32.2077 40.2665 30.6013 41.8988 29.4147C43.5238 28.2333 45.1763 27.5 47 27.5C48.8237 27.5 50.4762 28.2333 52.1012 29.4147C53.7335 30.6013 55.2958 32.2077 56.9479 33.9086L56.9492 33.9099C57.4592 34.4349 57.977 34.968 58.5042 35.4956Z", stroke: "currentColor" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs("filter", { id: "filter0_b_457_51391", x: "-20", y: "-20", width: "134", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsxRuntime.jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsxRuntime.jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsxRuntime.jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_51391" }), jsxRuntime.jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_51391", result: "shape" })] }) })] }), jsxRuntime.jsxs("div", { className: "tw-token-pair-mask tw-z-10 tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between", style: {
|
|
@@ -3411,7 +3443,7 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
3411
3443
|
|
|
3412
3444
|
function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
3413
3445
|
const parsedStyle = getParsedStyle(theme);
|
|
3414
|
-
return (jsxRuntime.jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className:
|
|
3446
|
+
return (jsxRuntime.jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
|
|
3415
3447
|
}
|
|
3416
3448
|
|
|
3417
3449
|
exports.AddressButton = AddressButton;
|
|
@@ -3453,3 +3485,4 @@ exports.Switch = Switch;
|
|
|
3453
3485
|
exports.TokenPair = TokenPair;
|
|
3454
3486
|
exports.Tooltip = Tooltip;
|
|
3455
3487
|
exports.UsdAmount = UsdAmount;
|
|
3488
|
+
exports.useModal = useModal;
|
|
@@ -14,7 +14,10 @@ export declare function ChevronLargeRightIcon({ size, className, }: {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
}): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export declare function ChevronRightSmallIcon(): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare function ArrowLeftIcon(
|
|
17
|
+
export declare function ArrowLeftIcon({ className, size, }: {
|
|
18
|
+
className?: string;
|
|
19
|
+
size?: string;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
21
|
export declare function ArrowRightUpCircleIcon(): import("react/jsx-runtime").JSX.Element;
|
|
19
22
|
export declare function ArrowOutOfBoxIcon(): import("react/jsx-runtime").JSX.Element;
|
|
20
23
|
export declare function ChevronGrabberVerticalIcon({ size, className, }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SwapStep } from '../../types/components';
|
|
2
|
-
export declare function SwapStepsCollapsed({ steps, currentStepIndex:
|
|
2
|
+
export declare function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }: {
|
|
3
3
|
steps: SwapStep[];
|
|
4
4
|
currentStepIndex: number;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SwapStepDescriptionBlock } from '../../types/components';
|
|
2
|
+
import { SwapStepDescriptionBlock, SwapStepItemStatus } from '../../types/components';
|
|
3
3
|
interface SwapStepItemProps {
|
|
4
4
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
5
5
|
chipContent: React.ReactNode;
|
|
6
6
|
showStepSeparator?: boolean;
|
|
7
|
+
link?: string;
|
|
8
|
+
status?: SwapStepItemStatus;
|
|
7
9
|
}
|
|
8
|
-
export declare function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator, }: SwapStepItemProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator, link, status, }: SwapStepItemProps): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -3,8 +3,11 @@ import { SwapStepItem } from '../../components/lists/SwapStepItem';
|
|
|
3
3
|
declare const meta: Meta<typeof SwapStepItem>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Executed: Story;
|
|
7
|
+
export declare const Pending: Story;
|
|
8
|
+
export declare const Progress: Story;
|
|
7
9
|
export declare const CustomDescription: Story;
|
|
8
10
|
export declare const ShowSeparator: Story;
|
|
9
11
|
export declare const LongDescription: Story;
|
|
10
12
|
export declare const LongDescriptionWithSeparator: Story;
|
|
13
|
+
export declare const Link: Story;
|
|
@@ -12,6 +12,8 @@ export type SwapStepDescriptionBlock = {
|
|
|
12
12
|
export type SwapStep = {
|
|
13
13
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
14
14
|
chipContent: React.ReactNode;
|
|
15
|
+
link?: string;
|
|
15
16
|
};
|
|
16
17
|
export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
17
18
|
export type ThemeType = 'light' | 'dark';
|
|
19
|
+
export type SwapStepItemStatus = 'executed' | 'progress' | 'pending';
|
package/dist/esm/index.js
CHANGED
|
@@ -2650,8 +2650,8 @@ function ChevronLargeRightIcon({ size = '16', className, }) {
|
|
|
2650
2650
|
function ChevronRightSmallIcon() {
|
|
2651
2651
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: jsx("path", { d: "M6.66675 10.6667L8.86201 8.47141C9.12236 8.21106 9.12236 7.78896 8.86201 7.52861L6.66675 5.33334", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2652
2652
|
}
|
|
2653
|
-
function ArrowLeftIcon() {
|
|
2654
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width:
|
|
2653
|
+
function ArrowLeftIcon({ className, size = '24', }) {
|
|
2654
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", className: className, children: jsx("path", { d: "M10 6L4 12L10 18M5 12H20", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
2655
2655
|
}
|
|
2656
2656
|
function ChevronGrabberVerticalIcon({ size = '16', className, }) {
|
|
2657
2657
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 16 16", fill: "none", className: className, children: jsx("path", { d: "M5.33301 6.00002L7.52827 3.80476C7.78862 3.54441 8.21073 3.54441 8.47108 3.80476L10.6663 6.00002M5.33301 10L7.52827 12.1953C7.78862 12.4556 8.21073 12.4556 8.47108 12.1953L10.6663 10", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
@@ -3130,7 +3130,7 @@ function DropdownMenuItem({ label, imageUrl, icon, labelClassName, }) {
|
|
|
3130
3130
|
}
|
|
3131
3131
|
|
|
3132
3132
|
function useModal(props) {
|
|
3133
|
-
const [isModalOpen, setIsModalOpen] = useState(Boolean(void 0 ));
|
|
3133
|
+
const [isModalOpen, setIsModalOpen] = useState(Boolean(props === null || props === void 0 ? void 0 : props.initialIsModalOpen));
|
|
3134
3134
|
const modalRef = useRef(null);
|
|
3135
3135
|
const openModalButtonRef = useRef(null);
|
|
3136
3136
|
useEffect(() => {
|
|
@@ -3243,8 +3243,23 @@ function SwapStepSeparator() {
|
|
|
3243
3243
|
return (jsx("span", { className: "tw-flex tw-h-squid-m tw-w-squid-xxl tw-items-center tw-justify-center tw-self-stretch tw-py-0.5", children: jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "4", height: "21", viewBox: "0 0 4 21", fill: "none", children: jsx("path", { d: "M2 2.5V18.5", stroke: "currentColor", "stroke-width": "4", "stroke-linecap": "round" }) }) }));
|
|
3244
3244
|
}
|
|
3245
3245
|
|
|
3246
|
-
|
|
3247
|
-
|
|
3246
|
+
const statusTextClassMap = {
|
|
3247
|
+
executed: 'tw-text-grey-300',
|
|
3248
|
+
progress: 'tw-text-royal-400',
|
|
3249
|
+
pending: 'tw-text-grey-600',
|
|
3250
|
+
};
|
|
3251
|
+
const statusBgClassMap = {
|
|
3252
|
+
executed: '!tw-bg-grey-300',
|
|
3253
|
+
progress: '!tw-bg-royal-400',
|
|
3254
|
+
pending: '!tw-bg-grey-600',
|
|
3255
|
+
};
|
|
3256
|
+
const separatorClassMap = {
|
|
3257
|
+
executed: 'tw-text-grey-300',
|
|
3258
|
+
progress: 'tw-text-grey-600',
|
|
3259
|
+
pending: 'tw-text-grey-600',
|
|
3260
|
+
};
|
|
3261
|
+
function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = false, link, status = 'pending', }) {
|
|
3262
|
+
return (jsxs("li", { className: "tw-flex tw-w-list-item-large tw-flex-col tw-items-start tw-bg-grey-800 tw-text-grey-300", children: [showStepSeparator && (jsx("span", { className: separatorClassMap[status], children: jsx(SwapStepSeparator, {}) })), jsxs("a", { href: link, target: "_blank", className: cn('tw-group/swap-step-item tw-flex tw-w-full tw-items-center tw-rounded-squid-xs', !!link && 'hover:tw-bg-material-light-thin', statusTextClassMap[status]), children: [jsx("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: jsx(Chip, { className: cn('tw-w-squid-xl', statusBgClassMap[status]), icon: typeof chipContent === 'string' ? (jsx(CaptionText, { children: chipContent })) : (chipContent) }) }), jsx("div", { className: "tw-flex tw-min-h-squid-l tw-flex-1 tw-flex-wrap tw-items-center tw-justify-start tw-gap-squid-xxs tw-py-squid-xxs", children: descriptionBlocks.map(({ type, value }, index) => {
|
|
3248
3263
|
if (type === 'string') {
|
|
3249
3264
|
return (
|
|
3250
3265
|
// Instead of displaying the string into a single <BodyText />
|
|
@@ -3259,7 +3274,7 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3259
3274
|
return (jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }, index));
|
|
3260
3275
|
}
|
|
3261
3276
|
return null;
|
|
3262
|
-
}) })] })] }));
|
|
3277
|
+
}) }), !!link && (jsx(ChevronLargeRightIcon, { className: "tw-mr-squid-xxs tw-hidden tw-text-material-light-average group-hover/swap-step-item:tw-block" }))] })] }));
|
|
3263
3278
|
}
|
|
3264
3279
|
|
|
3265
3280
|
function DropdownMenu({ dropdownRef, items, className, }) {
|
|
@@ -3315,11 +3330,20 @@ function SwapProgressViewHeader({ title, description, }) {
|
|
|
3315
3330
|
return (jsxs("header", { className: "tw-flex tw-h-[95px] tw-w-full tw-flex-col tw-gap-squid-s tw-bg-grey-800 tw-px-squid-m tw-py-squid-s", children: [jsx(BodyText, { size: "large", className: "tw-h-squid-m !tw-leading-[20px] tw-text-grey-300", children: title }), jsx(CaptionText, { className: "tw-h-squid-l tw-text-grey-500", children: description })] }));
|
|
3316
3331
|
}
|
|
3317
3332
|
|
|
3318
|
-
function SwapStepsCollapsed({ steps, currentStepIndex:
|
|
3319
|
-
|
|
3333
|
+
function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }) {
|
|
3334
|
+
const newStepIndex = Math.round(_newStepIndex);
|
|
3335
|
+
const [currentStepIndex, setCurrentStepIndex] = useState(newStepIndex);
|
|
3336
|
+
useEffect(() => {
|
|
3337
|
+
const timeoutId = setTimeout(() => {
|
|
3338
|
+
setCurrentStepIndex(Math.round(newStepIndex));
|
|
3339
|
+
}, 400);
|
|
3340
|
+
return () => {
|
|
3341
|
+
clearTimeout(timeoutId);
|
|
3342
|
+
};
|
|
3343
|
+
}, [newStepIndex]);
|
|
3344
|
+
// handles whether route component is mounted
|
|
3320
3345
|
const [isRouteVisible, setIsRouteVisible] = useState(false);
|
|
3321
|
-
|
|
3322
|
-
// handles if route component is animating to show
|
|
3346
|
+
// handles whether route component is animating to show
|
|
3323
3347
|
const [isShowRouteAnimationRunning, setIsShowRouteAnimationRunning] = useState(false);
|
|
3324
3348
|
const currentStep = steps[currentStepIndex];
|
|
3325
3349
|
const isLastStep = currentStepIndex === steps.length - 1;
|
|
@@ -3337,16 +3361,24 @@ function SwapStepsCollapsed({ steps, currentStepIndex: _currentStepIndex, }) {
|
|
|
3337
3361
|
};
|
|
3338
3362
|
}, [isShowRouteAnimationRunning]);
|
|
3339
3363
|
const collapseRouteSteps = () => setIsShowRouteAnimationRunning(false);
|
|
3340
|
-
return (jsxs(Fragment, { children: [jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full
|
|
3364
|
+
return (jsxs(Fragment, { children: [jsx(Tooltip, { tooltipContent: "View route", tooltipWidth: "max", containerClassName: "tw-w-full", childrenClassName: "tw-w-full tw-rounded-full", children: jsxs("button", { className: "tw-relative tw-max-h-button tw-overflow-hidden tw-rounded-full tw-border tw-border-material-light-thin tw-bg-grey-800", onClick: () => {
|
|
3341
3365
|
// mount route component and start animation
|
|
3342
3366
|
setIsRouteVisible(true);
|
|
3343
3367
|
setIsShowRouteAnimationRunning(true);
|
|
3344
|
-
},
|
|
3368
|
+
}, children: [newStepIndex > currentStepIndex && (jsx("div", { className: "tw-animate-translate-to-bottom tw-absolute -tw-top-full tw-left-0 tw-w-full", children: jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsx(CurrentStep, { className: cn(newStepIndex > currentStepIndex &&
|
|
3369
|
+
'tw-animate-translate-to-bottom', newStepIndex < currentStepIndex && 'tw-animate-translate-to-top'), currentStep: currentStep, isFirstStep: isFirstStep, isLastStep: isLastStep }), newStepIndex < currentStepIndex && (jsx("div", { className: "tw-animate-translate-to-top tw-absolute tw-left-0 tw-top-full tw-w-full", children: jsx(CurrentStep, { currentStep: steps[newStepIndex], isFirstStep: newStepIndex === 0, isLastStep: newStepIndex === steps.length - 1 }) })), jsx("span", { className: "tw-absolute tw-left-0 tw-top-0 tw-z-20 tw-h-[21px] tw-w-full tw-bg-gradient-to-b tw-from-grey-800" }), jsx("span", { className: "tw-absolute tw-bottom-0 tw-left-0 tw-z-20 tw-h-[21px] tw-w-full tw-bg-gradient-to-t tw-from-grey-800" })] }) }), isRouteVisible && (jsxs("div", { className: "tw-absolute tw-top-0 tw-z-20 tw-flex tw-h-[536px] tw-w-full tw-flex-col tw-justify-end tw-gap-squid-xxs", children: [jsx("div", { className: cn('tw-absolute tw-top-0 tw-h-[536px] tw-w-full tw-rounded-squid-l tw-bg-material-dark-thick tw-opacity-0 tw-backdrop-blur/10', isShowRouteAnimationRunning
|
|
3345
3370
|
? 'tw-animate-fade-in'
|
|
3346
3371
|
: 'tw-animate-fade-out'), onClick: collapseRouteSteps }), jsxs("div", { className: cn('tw-flex tw-max-h-[536px] tw-w-full tw-flex-col tw-gap-squid-xxs tw-overflow-hidden tw-rounded-squid-l tw-border tw-border-material-light-thin tw-bg-grey-800 tw-backdrop-blur-2xl', isShowRouteAnimationRunning
|
|
3347
3372
|
? 'tw-animate-slide-to-top'
|
|
3348
|
-
: 'tw-animate-slide-to-bottom'), children: [jsx("div", { className: "tw-flex tw-h-[52px] tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-xs", children: jsx("button", { onClick: collapseRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsx("ul", { className: "tw-flex tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs", children: steps.map((step, index) => (jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1)
|
|
3349
|
-
|
|
3373
|
+
: 'tw-animate-slide-to-bottom'), children: [jsx("div", { className: "tw-flex tw-h-[52px] tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-xs", children: jsx("button", { onClick: collapseRouteSteps, className: "tw-flex tw-h-squid-xl tw-w-40 tw-items-center tw-justify-center tw-rounded-squid-xs tw-px-10 hover:tw-bg-material-light-thin", children: jsx("span", { className: "tw-flex tw-h-8 tw-w-8 tw-items-center tw-justify-center tw-text-grey-300", children: jsx(ChevronLargeDownIcon, { size: "32" }) }) }) }), jsx("ul", { className: "tw-flex tw-w-[400px] tw-flex-1 tw-flex-col-reverse tw-items-center tw-self-stretch tw-overflow-y-auto tw-overflow-x-hidden tw-px-squid-xs", children: steps.map((step, index) => (jsx(SwapStepItem, { descriptionBlocks: step.descriptionBlocks, chipContent: step.chipContent, showStepSeparator: !(index === steps.length - 1), link: step.link, status: currentStepIndex < index
|
|
3374
|
+
? 'pending'
|
|
3375
|
+
: currentStepIndex > index
|
|
3376
|
+
? 'executed'
|
|
3377
|
+
: 'progress' }, index))) }), jsx("footer", { className: "tw-flex tw-items-end tw-justify-center tw-gap-squid-xs tw-self-stretch tw-p-squid-s", children: jsx(Button, { size: "md", variant: "secondary", label: "View on Squidscan", className: "tw-w-full" }) })] })] }))] }));
|
|
3378
|
+
}
|
|
3379
|
+
const CurrentStep = ({ currentStep, isFirstStep, isLastStep, className, }) => {
|
|
3380
|
+
return (jsxs("div", { className: cn('tw-relative tw-z-10 tw-flex tw-min-h-button tw-w-full tw-items-center tw-overflow-hidden tw-rounded-squid-xxl tw-px-squid-xs tw-text-grey-300', className), children: [!isLastStep && (jsx("span", { className: "tw-absolute -tw-top-1.5 tw-z-0", children: jsx(SwapStepSeparator, {}) })), currentStep && (jsx(SwapStepItem, { descriptionBlocks: currentStep.descriptionBlocks, chipContent: currentStep.chipContent, status: "progress" })), !isFirstStep && (jsx("span", { className: "tw-absolute -tw-bottom-1.5 tw-z-0", children: jsx(SwapStepSeparator, {}) }))] }));
|
|
3381
|
+
};
|
|
3350
3382
|
|
|
3351
3383
|
function TokenPair({ firstToken, secondToken }) {
|
|
3352
3384
|
return (jsxs("div", { className: "tw-relative tw-h-[42px] tw-w-[94px]", children: [jsxs("svg", { width: "94", height: "42", viewBox: "0 0 94 42", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "tw-absolute tw-z-10 tw-text-material-light-average", children: [jsx("g", { filter: "url(#filter0_b_457_51391)", children: jsx("path", { d: "M58.5042 35.4956L58.5043 35.4957C62.5071 39.4985 67.7544 41.5 73.0001 41.5C84.3219 41.5 93.5 32.3218 93.5 21C93.5 9.67822 84.3219 0.5 73.0001 0.5C67.7544 0.499977 62.5071 2.50151 58.5043 6.50431C57.9743 7.03437 57.4538 7.57007 56.9412 8.09756L56.9403 8.09852C55.2889 9.79812 53.7279 11.4027 52.097 12.5879C50.4734 13.7678 48.8225 14.5 47 14.5C45.1775 14.5 43.5266 13.7678 41.903 12.5879C40.2721 11.4027 38.7111 9.79812 37.0597 8.09852L37.0589 8.09766C36.5463 7.57013 36.0258 7.03441 35.4957 6.50431C31.4929 2.50151 26.2456 0.499977 20.9999 0.5C15.7543 0.500023 10.5071 2.50156 6.50431 6.50431C2.50153 10.5071 0.5 15.7544 0.5 21C0.5 26.2456 2.50153 31.4929 6.50431 35.4957C10.5071 39.4984 15.7543 41.5 20.9999 41.5C26.2456 41.5 31.4929 39.4985 35.4957 35.4957L35.4958 35.4956C36.023 34.968 36.5408 34.4349 37.0508 33.9099L37.0521 33.9086C38.7042 32.2077 40.2665 30.6013 41.8988 29.4147C43.5238 28.2333 45.1763 27.5 47 27.5C48.8237 27.5 50.4762 28.2333 52.1012 29.4147C53.7335 30.6013 55.2958 32.2077 56.9479 33.9086L56.9492 33.9099C57.4592 34.4349 57.977 34.968 58.5042 35.4956Z", stroke: "currentColor" }) }), jsx("defs", { children: jsxs("filter", { id: "filter0_b_457_51391", x: "-20", y: "-20", width: "134", height: "82", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB", children: [jsx("feFlood", { "flood-opacity": "0", result: "BackgroundImageFix" }), jsx("feGaussianBlur", { in: "BackgroundImageFix", stdDeviation: "10" }), jsx("feComposite", { in2: "SourceAlpha", operator: "in", result: "effect1_backgroundBlur_457_51391" }), jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_backgroundBlur_457_51391", result: "shape" })] }) })] }), jsxs("div", { className: "tw-token-pair-mask tw-z-10 tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between", style: {
|
|
@@ -3409,7 +3441,7 @@ function getHexColorFromOpacityPercentage(color, opacity) {
|
|
|
3409
3441
|
|
|
3410
3442
|
function SquidConfigProvider({ theme, children, themeType = 'light', }) {
|
|
3411
3443
|
const parsedStyle = getParsedStyle(theme);
|
|
3412
|
-
return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className:
|
|
3444
|
+
return (jsx("div", { style: parsedStyle, "data-squid-theme-type": themeType, className: "tw-group tw-relative tw-font-geist", children: children }));
|
|
3413
3445
|
}
|
|
3414
3446
|
|
|
3415
|
-
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount };
|
|
3447
|
+
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, ErrorMessage, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, SectionTitle, SettingsButton, SettingsItem, SettingsSlider, SquidConfigProvider, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, UsdAmount, useModal };
|
|
@@ -14,7 +14,10 @@ export declare function ChevronLargeRightIcon({ size, className, }: {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
}): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export declare function ChevronRightSmallIcon(): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare function ArrowLeftIcon(
|
|
17
|
+
export declare function ArrowLeftIcon({ className, size, }: {
|
|
18
|
+
className?: string;
|
|
19
|
+
size?: string;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
21
|
export declare function ArrowRightUpCircleIcon(): import("react/jsx-runtime").JSX.Element;
|
|
19
22
|
export declare function ArrowOutOfBoxIcon(): import("react/jsx-runtime").JSX.Element;
|
|
20
23
|
export declare function ChevronGrabberVerticalIcon({ size, className, }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SwapStep } from '../../types/components';
|
|
2
|
-
export declare function SwapStepsCollapsed({ steps, currentStepIndex:
|
|
2
|
+
export declare function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }: {
|
|
3
3
|
steps: SwapStep[];
|
|
4
4
|
currentStepIndex: number;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SwapStepDescriptionBlock } from '../../types/components';
|
|
2
|
+
import { SwapStepDescriptionBlock, SwapStepItemStatus } from '../../types/components';
|
|
3
3
|
interface SwapStepItemProps {
|
|
4
4
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
5
5
|
chipContent: React.ReactNode;
|
|
6
6
|
showStepSeparator?: boolean;
|
|
7
|
+
link?: string;
|
|
8
|
+
status?: SwapStepItemStatus;
|
|
7
9
|
}
|
|
8
|
-
export declare function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator, }: SwapStepItemProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator, link, status, }: SwapStepItemProps): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -3,8 +3,11 @@ import { SwapStepItem } from '../../components/lists/SwapStepItem';
|
|
|
3
3
|
declare const meta: Meta<typeof SwapStepItem>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Executed: Story;
|
|
7
|
+
export declare const Pending: Story;
|
|
8
|
+
export declare const Progress: Story;
|
|
7
9
|
export declare const CustomDescription: Story;
|
|
8
10
|
export declare const ShowSeparator: Story;
|
|
9
11
|
export declare const LongDescription: Story;
|
|
10
12
|
export declare const LongDescriptionWithSeparator: Story;
|
|
13
|
+
export declare const Link: Story;
|
|
@@ -12,6 +12,8 @@ export type SwapStepDescriptionBlock = {
|
|
|
12
12
|
export type SwapStep = {
|
|
13
13
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
14
14
|
chipContent: React.ReactNode;
|
|
15
|
+
link?: string;
|
|
15
16
|
};
|
|
16
17
|
export type DetailsToolbarState = 'full' | 'loading' | 'empty' | 'error';
|
|
17
18
|
export type ThemeType = 'light' | 'dark';
|
|
19
|
+
export type SwapStepItemStatus = 'executed' | 'progress' | 'pending';
|
package/dist/index.css
CHANGED
|
@@ -589,6 +589,10 @@ video {
|
|
|
589
589
|
bottom: -0.375rem;
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
+
.-tw-bottom-20 {
|
|
593
|
+
bottom: -5rem;
|
|
594
|
+
}
|
|
595
|
+
|
|
592
596
|
.-tw-left-\[2px\] {
|
|
593
597
|
left: -2px;
|
|
594
598
|
}
|
|
@@ -629,6 +633,10 @@ video {
|
|
|
629
633
|
top: -4px;
|
|
630
634
|
}
|
|
631
635
|
|
|
636
|
+
.-tw-top-full {
|
|
637
|
+
top: -100%;
|
|
638
|
+
}
|
|
639
|
+
|
|
632
640
|
.tw-bottom-0 {
|
|
633
641
|
bottom: 0px;
|
|
634
642
|
}
|
|
@@ -637,10 +645,6 @@ video {
|
|
|
637
645
|
bottom: 0.125rem;
|
|
638
646
|
}
|
|
639
647
|
|
|
640
|
-
.tw-bottom-1 {
|
|
641
|
-
bottom: 0.25rem;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
648
|
.tw-bottom-2 {
|
|
645
649
|
bottom: 0.5rem;
|
|
646
650
|
}
|
|
@@ -701,18 +705,22 @@ video {
|
|
|
701
705
|
top: 0px;
|
|
702
706
|
}
|
|
703
707
|
|
|
704
|
-
.tw-top-1 {
|
|
705
|
-
top: 0.25rem;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
708
|
.tw-top-7 {
|
|
709
709
|
top: 1.75rem;
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
+
.tw-top-full {
|
|
713
|
+
top: 100%;
|
|
714
|
+
}
|
|
715
|
+
|
|
712
716
|
.tw-top-squid-xxs {
|
|
713
717
|
top: 0.3125rem;
|
|
714
718
|
}
|
|
715
719
|
|
|
720
|
+
.tw-z-0 {
|
|
721
|
+
z-index: 0;
|
|
722
|
+
}
|
|
723
|
+
|
|
716
724
|
.tw-z-10 {
|
|
717
725
|
z-index: 10;
|
|
718
726
|
}
|
|
@@ -747,6 +755,11 @@ video {
|
|
|
747
755
|
margin-right: 0.3125rem;
|
|
748
756
|
}
|
|
749
757
|
|
|
758
|
+
.tw-my-4 {
|
|
759
|
+
margin-top: 1rem;
|
|
760
|
+
margin-bottom: 1rem;
|
|
761
|
+
}
|
|
762
|
+
|
|
750
763
|
.-tw-mb-1 {
|
|
751
764
|
margin-bottom: -0.25rem;
|
|
752
765
|
}
|
|
@@ -783,6 +796,10 @@ video {
|
|
|
783
796
|
margin-right: 1px;
|
|
784
797
|
}
|
|
785
798
|
|
|
799
|
+
.tw-mr-squid-xxs {
|
|
800
|
+
margin-right: 0.3125rem;
|
|
801
|
+
}
|
|
802
|
+
|
|
786
803
|
.tw-mt-1 {
|
|
787
804
|
margin-top: 0.25rem;
|
|
788
805
|
}
|
|
@@ -859,6 +876,10 @@ video {
|
|
|
859
876
|
height: 205px;
|
|
860
877
|
}
|
|
861
878
|
|
|
879
|
+
.tw-h-\[21px\] {
|
|
880
|
+
height: 21px;
|
|
881
|
+
}
|
|
882
|
+
|
|
862
883
|
.tw-h-\[22px\] {
|
|
863
884
|
height: 22px;
|
|
864
885
|
}
|
|
@@ -999,6 +1020,10 @@ video {
|
|
|
999
1020
|
max-height: 80px;
|
|
1000
1021
|
}
|
|
1001
1022
|
|
|
1023
|
+
.tw-max-h-button {
|
|
1024
|
+
max-height: 3.75rem;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1002
1027
|
.tw-max-h-list-item-small {
|
|
1003
1028
|
max-height: 2.5rem;
|
|
1004
1029
|
}
|
|
@@ -1316,6 +1341,11 @@ video {
|
|
|
1316
1341
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1317
1342
|
}
|
|
1318
1343
|
|
|
1344
|
+
.tw-rotate-180 {
|
|
1345
|
+
--tw-rotate: 180deg;
|
|
1346
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1319
1349
|
.tw-rotate-90 {
|
|
1320
1350
|
--tw-rotate: 90deg;
|
|
1321
1351
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -1401,6 +1431,34 @@ video {
|
|
|
1401
1431
|
animation: tw-slide-to-top 0.35s ease-out both;
|
|
1402
1432
|
}
|
|
1403
1433
|
|
|
1434
|
+
@keyframes tw-translate-to-bottom {
|
|
1435
|
+
0% {
|
|
1436
|
+
transform: translateY(0);
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
100% {
|
|
1440
|
+
transform: translateY(58.5px);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
.tw-animate-translate-to-bottom {
|
|
1445
|
+
animation: tw-translate-to-bottom 0.4s ease-in-out both;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
@keyframes tw-translate-to-top {
|
|
1449
|
+
0% {
|
|
1450
|
+
transform: translateY(0);
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
100% {
|
|
1454
|
+
transform: translateY(-58.5px);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
.tw-animate-translate-to-top {
|
|
1459
|
+
animation: tw-translate-to-top 0.4s ease-in-out both;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1404
1462
|
.tw-cursor-not-allowed {
|
|
1405
1463
|
cursor: not-allowed;
|
|
1406
1464
|
}
|
|
@@ -1707,6 +1765,23 @@ video {
|
|
|
1707
1765
|
border-top-color: var(--squid-theme-material-light-thin);
|
|
1708
1766
|
}
|
|
1709
1767
|
|
|
1768
|
+
.\!tw-bg-grey-300 {
|
|
1769
|
+
background-color: var(--squid-theme-grey-300) !important;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
.\!tw-bg-grey-600 {
|
|
1773
|
+
background-color: var(--squid-theme-grey-600) !important;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
.\!tw-bg-royal-400 {
|
|
1777
|
+
background-color: var(--squid-theme-royal-400) !important;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
.tw-bg-blue-950 {
|
|
1781
|
+
--tw-bg-opacity: 1;
|
|
1782
|
+
background-color: rgb(23 37 84 / var(--tw-bg-opacity));
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1710
1785
|
.tw-bg-grey-100 {
|
|
1711
1786
|
background-color: var(--squid-theme-grey-100);
|
|
1712
1787
|
}
|
|
@@ -1785,6 +1860,10 @@ video {
|
|
|
1785
1860
|
background-image: linear-gradient(to right, var(--tw-gradient-stops));
|
|
1786
1861
|
}
|
|
1787
1862
|
|
|
1863
|
+
.tw-bg-gradient-to-t {
|
|
1864
|
+
background-image: linear-gradient(to top, var(--tw-gradient-stops));
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1788
1867
|
.tw-bg-royal-dark {
|
|
1789
1868
|
background-image: linear-gradient(180deg, #BF91F2 0%, #A577D8 100%);
|
|
1790
1869
|
}
|
|
@@ -1805,16 +1884,6 @@ video {
|
|
|
1805
1884
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
1806
1885
|
}
|
|
1807
1886
|
|
|
1808
|
-
.tw-from-transparent {
|
|
1809
|
-
--tw-gradient-from: transparent var(--tw-gradient-from-position);
|
|
1810
|
-
--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);
|
|
1811
|
-
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
.tw-to-grey-800 {
|
|
1815
|
-
--tw-gradient-to: var(--squid-theme-grey-800) var(--tw-gradient-to-position);
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
1887
|
.tw-to-transparent {
|
|
1819
1888
|
--tw-gradient-to: transparent var(--tw-gradient-to-position);
|
|
1820
1889
|
}
|
|
@@ -1839,6 +1908,10 @@ video {
|
|
|
1839
1908
|
padding: 0.5rem;
|
|
1840
1909
|
}
|
|
1841
1910
|
|
|
1911
|
+
.tw-p-4 {
|
|
1912
|
+
padding: 1rem;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1842
1915
|
.tw-p-8 {
|
|
1843
1916
|
padding: 2rem;
|
|
1844
1917
|
}
|
|
@@ -2495,6 +2568,14 @@ li {
|
|
|
2495
2568
|
color: var(--squid-theme-grey-600);
|
|
2496
2569
|
}
|
|
2497
2570
|
|
|
2571
|
+
.disabled\:tw-opacity-60:disabled {
|
|
2572
|
+
opacity: 0.6;
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
.tw-group\/swap-step-item:hover .group-hover\/swap-step-item\:tw-block {
|
|
2576
|
+
display: block;
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2498
2579
|
.tw-group\/list-item:hover .group-hover\/list-item\:tw-flex {
|
|
2499
2580
|
display: flex;
|
|
2500
2581
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -55,8 +55,10 @@ type SwapStepDescriptionBlock = {
|
|
|
55
55
|
type SwapStep = {
|
|
56
56
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
57
57
|
chipContent: React.ReactNode;
|
|
58
|
+
link?: string;
|
|
58
59
|
};
|
|
59
60
|
type ThemeType = 'light' | 'dark';
|
|
61
|
+
type SwapStepItemStatus = 'executed' | 'progress' | 'pending';
|
|
60
62
|
|
|
61
63
|
interface BoostButtonProps {
|
|
62
64
|
boostMode: BoostMode;
|
|
@@ -251,8 +253,10 @@ interface SwapStepItemProps {
|
|
|
251
253
|
descriptionBlocks: SwapStepDescriptionBlock[];
|
|
252
254
|
chipContent: React.ReactNode;
|
|
253
255
|
showStepSeparator?: boolean;
|
|
256
|
+
link?: string;
|
|
257
|
+
status?: SwapStepItemStatus;
|
|
254
258
|
}
|
|
255
|
-
declare function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator, }: SwapStepItemProps): react_jsx_runtime.JSX.Element;
|
|
259
|
+
declare function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator, link, status, }: SwapStepItemProps): react_jsx_runtime.JSX.Element;
|
|
256
260
|
|
|
257
261
|
interface DropdownMenuProps {
|
|
258
262
|
dropdownRef?: React.RefObject<HTMLDivElement>;
|
|
@@ -333,7 +337,7 @@ interface SwapProgressViewHeaderProps {
|
|
|
333
337
|
}
|
|
334
338
|
declare function SwapProgressViewHeader({ title, description, }: SwapProgressViewHeaderProps): react_jsx_runtime.JSX.Element;
|
|
335
339
|
|
|
336
|
-
declare function SwapStepsCollapsed({ steps, currentStepIndex:
|
|
340
|
+
declare function SwapStepsCollapsed({ steps, currentStepIndex: _newStepIndex, }: {
|
|
337
341
|
steps: SwapStep[];
|
|
338
342
|
currentStepIndex: number;
|
|
339
343
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -411,4 +415,14 @@ declare function SquidConfigProvider({ theme, children, themeType, }: {
|
|
|
411
415
|
themeType?: ThemeType;
|
|
412
416
|
}): react_jsx_runtime.JSX.Element;
|
|
413
417
|
|
|
414
|
-
|
|
418
|
+
declare function useModal(props?: {
|
|
419
|
+
initialIsModalOpen?: boolean;
|
|
420
|
+
}): {
|
|
421
|
+
isModalOpen: boolean;
|
|
422
|
+
openModal: () => void;
|
|
423
|
+
closeModal: () => void;
|
|
424
|
+
modalRef: React.RefObject<HTMLDivElement>;
|
|
425
|
+
openModalButtonRef: React.RefObject<HTMLButtonElement>;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
export { AddressButton, ArrowButton, AssetsButton, BadgeImage, BodyText, Boost, BoostButton, Button, CaptionText, Chip, DetailsToolbar, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, ErrorMessage, FeeButton, HeadingText, HistoryItem, Input, ListItem, Menu, MenuItem, Modal, NavigationBar, NumericInput, ProductCard, SectionTitle, SettingsButton, type SettingsButtonProps, SettingsItem, type SettingsItemProps, SettingsSlider, type SettingsSliderProps, SquidConfigProvider, type SquidTheme, SwapConfiguration, SwapDetailListItem, SwapProgressViewHeader, SwapStepItem, SwapStepsCollapsed, Switch, TokenPair, Tooltip, type TooltipThreshold, type TooltipWidth, UsdAmount, useModal };
|