@0xsquid/ui 0.11.1 → 0.13.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 +42 -30
- package/dist/cjs/types/components/icons/Arrow.d.ts +2 -1
- package/dist/cjs/types/components/icons/EmojiSad.d.ts +4 -0
- package/dist/cjs/types/components/lists/HistoryItem.d.ts +4 -2
- package/dist/cjs/types/stories/lists/HistoryItem.stories.d.ts +2 -0
- package/dist/cjs/types/stories/lists/SwapStepItem.stories.d.ts +2 -1
- package/dist/cjs/types/types/config.d.ts +2 -0
- package/dist/esm/index.js +42 -30
- package/dist/esm/types/components/icons/Arrow.d.ts +2 -1
- package/dist/esm/types/components/icons/EmojiSad.d.ts +4 -0
- package/dist/esm/types/components/lists/HistoryItem.d.ts +4 -2
- package/dist/esm/types/stories/lists/HistoryItem.stories.d.ts +2 -0
- package/dist/esm/types/stories/lists/SwapStepItem.stories.d.ts +2 -1
- package/dist/esm/types/types/config.d.ts +2 -0
- package/dist/index.css +35 -30
- package/dist/index.d.ts +5 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2668,8 +2668,8 @@ function ChevronArrowIcon({ size = '16', className, }) {
|
|
|
2668
2668
|
function ArrowTriangle() {
|
|
2669
2669
|
return (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M2.87921 5.55701C2.21562 4.22933 3.18052 2.6665 4.66531 2.6665H11.3348C12.8196 2.6665 13.7845 4.22933 13.1209 5.55701L9.78615 12.229C9.05029 13.7012 6.94983 13.7012 6.21397 12.229L2.87921 5.55701Z", fill: "currentColor" }) }));
|
|
2670
2670
|
}
|
|
2671
|
-
function ChevronLargeDownIcon({ size = '24' }) {
|
|
2672
|
-
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M3 10.5L11.0287 14.9604C11.6328 15.296 12.3672 15.296 12.9713 14.9604L21 10.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2671
|
+
function ChevronLargeDownIcon({ size = '24', className, }) {
|
|
2672
|
+
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsxRuntime.jsx("path", { d: "M3 10.5L11.0287 14.9604C11.6328 15.296 12.3672 15.296 12.9713 14.9604L21 10.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2673
2673
|
}
|
|
2674
2674
|
function ChevronLargeRightIcon({ size = '16', className, }) {
|
|
2675
2675
|
return (jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsxRuntime.jsx("path", { d: "M6.66675 14L9.64035 8.64754C9.86407 8.24484 9.86407 7.75519 9.64035 7.35249L6.66675 2", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
@@ -2758,6 +2758,9 @@ const themeTypesKeys = {
|
|
|
2758
2758
|
'status-positive': {
|
|
2759
2759
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-positive`,
|
|
2760
2760
|
},
|
|
2761
|
+
'status-partial': {
|
|
2762
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-partial`,
|
|
2763
|
+
},
|
|
2761
2764
|
};
|
|
2762
2765
|
|
|
2763
2766
|
function PlusIcon() {
|
|
@@ -3125,6 +3128,9 @@ function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessa
|
|
|
3125
3128
|
function EmojiSadIcon({ className }) {
|
|
3126
3129
|
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", className: className, children: jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM13.5341 12.4645C11.5815 10.5118 8.41568 10.5118 6.46306 12.4645C6.07254 12.855 6.07254 13.4882 6.46306 13.8787C6.85358 14.2692 7.48675 14.2692 7.87727 13.8787C9.04885 12.7071 10.9483 12.7071 12.1199 13.8787C12.5104 14.2692 13.1436 14.2692 13.5341 13.8787C13.9247 13.4882 13.9247 12.855 13.5341 12.4645ZM8.5 7.5C8.5 8.32843 7.94036 9 7.25 9C6.55964 9 6 8.32843 6 7.5C6 6.67157 6.55964 6 7.25 6C7.94036 6 8.5 6.67157 8.5 7.5ZM12.75 9C13.4404 9 14 8.32843 14 7.5C14 6.67157 13.4404 6 12.75 6C12.0596 6 11.5 6.67157 11.5 7.5C11.5 8.32843 12.0596 9 12.75 9Z", fill: "currentColor" }) }));
|
|
3127
3130
|
}
|
|
3131
|
+
function EmojiMeh({ className, size = '20', }) {
|
|
3132
|
+
return (jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsxRuntime.jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM7.25 9C7.94036 9 8.5 8.32843 8.5 7.5C8.5 6.67157 7.94036 6 7.25 6C6.55964 6 6 6.67157 6 7.5C6 8.32843 6.55964 9 7.25 9ZM14 7.5C14 8.32843 13.4404 9 12.75 9C12.0596 9 11.5 8.32843 11.5 7.5C11.5 6.67157 12.0596 6 12.75 6C13.4404 6 14 6.67157 14 7.5ZM7 12C6.44772 12 6 12.4477 6 13C6 13.5523 6.44772 14 7 14H13C13.5523 14 14 13.5523 14 13C14 12.4477 13.5523 12 13 12H7Z", fill: "currentColor" }) }));
|
|
3133
|
+
}
|
|
3128
3134
|
|
|
3129
3135
|
function ErrorMessage({ message, showIcon = true }) {
|
|
3130
3136
|
return (jsxRuntime.jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [showIcon ? jsxRuntime.jsx(EmojiSadIcon, {}) : null, jsxRuntime.jsx(CaptionText, { children: message })] }));
|
|
@@ -3147,7 +3153,7 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3147
3153
|
return 'full';
|
|
3148
3154
|
}, [errorMessage, isLoading, isEmpty]);
|
|
3149
3155
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3150
|
-
return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsxRuntime.jsx(ChevronLargeDownIcon, {}) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
3156
|
+
return (jsxRuntime.jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsxRuntime.jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsxRuntime.jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsxRuntime.jsx(Loader, { size: "32" })) : (jsxRuntime.jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-group/arrow-button tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsxRuntime.jsx(ChevronLargeDownIcon, { className: "tw-transition-transform tw-duration-150 group-hover/arrow-button:tw-rotate-180" }) })) }), jsxRuntime.jsx("div", { className: detailClassName, children: jsxRuntime.jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
3151
3157
|
}
|
|
3152
3158
|
|
|
3153
3159
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -3204,37 +3210,31 @@ const statusBadge = {
|
|
|
3204
3210
|
containerClassName: 'tw-bg-royal-400',
|
|
3205
3211
|
},
|
|
3206
3212
|
failed: {
|
|
3207
|
-
badge: (jsxRuntime.jsx("span", { className: "
|
|
3213
|
+
badge: (jsxRuntime.jsx("span", { className: "tw-bg-grey-900", children: jsxRuntime.jsx(EmojiSadIcon, { className: "tw-text-status-negative" }) })),
|
|
3208
3214
|
containerClassName: 'tw-bg-status-negative',
|
|
3209
3215
|
},
|
|
3216
|
+
warning: {
|
|
3217
|
+
badge: (jsxRuntime.jsx("span", { className: "tw-bg-grey-900", children: jsxRuntime.jsx(EmojiMeh, { className: "tw-text-status-partial" }) })),
|
|
3218
|
+
containerClassName: 'tw-bg-status-partial',
|
|
3219
|
+
},
|
|
3210
3220
|
};
|
|
3211
|
-
function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, }) {
|
|
3221
|
+
function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, warningLabel, onClick, }) {
|
|
3212
3222
|
const { isDropdownOpen, dropdownRef, openDropdownButtonRef, openDropdown } = useDropdownMenu();
|
|
3213
3223
|
const [dropdownPosition, setDropdownPosition] = react.useState(null);
|
|
3214
3224
|
const itemRef = react.useRef(null);
|
|
3215
3225
|
const menuRef = react.useRef(null);
|
|
3216
|
-
const
|
|
3226
|
+
const statusLabel = react.useMemo(() => {
|
|
3217
3227
|
switch (status) {
|
|
3218
3228
|
case 'completed':
|
|
3219
|
-
return {
|
|
3220
|
-
label: dateCompleted,
|
|
3221
|
-
className: '',
|
|
3222
|
-
};
|
|
3229
|
+
return jsxRuntime.jsx(CaptionText, { children: dateCompleted });
|
|
3223
3230
|
case 'pending':
|
|
3224
|
-
return {
|
|
3225
|
-
label: 'Pending',
|
|
3226
|
-
className: 'tw-text-royal-400',
|
|
3227
|
-
};
|
|
3231
|
+
return jsxRuntime.jsx(CaptionText, { className: "tw-text-royal-400", children: "Pending" });
|
|
3228
3232
|
case 'failed':
|
|
3229
|
-
return {
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
};
|
|
3233
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(CaptionText, { className: "tw-text-status-negative", children: "Fail" }), jsxRuntime.jsx(CaptionText, { children: dateCompleted })] }));
|
|
3234
|
+
case 'warning':
|
|
3235
|
+
return (jsxRuntime.jsx(CaptionText, { className: "tw-text-status-partial", children: warningLabel }));
|
|
3233
3236
|
default:
|
|
3234
|
-
return
|
|
3235
|
-
label: '',
|
|
3236
|
-
className: '',
|
|
3237
|
-
};
|
|
3237
|
+
return null;
|
|
3238
3238
|
}
|
|
3239
3239
|
}, [status, dateCompleted]);
|
|
3240
3240
|
// Effect to find the best position for the dropdown menu, so it's always visible for the user
|
|
@@ -3281,10 +3281,17 @@ function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount,
|
|
|
3281
3281
|
setDropdownPosition('top');
|
|
3282
3282
|
}
|
|
3283
3283
|
}, [isDropdownOpen, menuRef, dropdownPosition, itemRef]);
|
|
3284
|
-
|
|
3285
|
-
|
|
3284
|
+
const isInteractive = !!onClick;
|
|
3285
|
+
const ItemTag = isInteractive ? 'button' : 'div';
|
|
3286
|
+
const itemTagProps = isInteractive
|
|
3287
|
+
? {
|
|
3288
|
+
onClick,
|
|
3289
|
+
}
|
|
3290
|
+
: {};
|
|
3291
|
+
return (jsxRuntime.jsx("li", { ref: itemRef, className: "tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", children: jsxRuntime.jsxs(ItemTag, Object.assign({}, itemTagProps, { className: cn('tw-group/history-item tw-relative tw-flex tw-w-full tw-flex-shrink-0 tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs', isInteractive && 'hover:tw-bg-material-light-thin'), children: [jsxRuntime.jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [!!statusBadge[status].badge && (jsxRuntime.jsx("span", { className: cn('tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-10 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-overflow-hidden tw-rounded-full tw-border tw-border-grey-900 tw-p-0.5', statusBadge[status].containerClassName), children: statusBadge[status].badge })), jsxRuntime.jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsxRuntime.jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxRuntime.jsxs("div", { className: "tw-flex tw-items-center", children: [jsxRuntime.jsx(CaptionText, { children: fromLabel }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronRightSmallIcon, {}) }), jsxRuntime.jsx(CaptionText, { children: toLabel })] }), !!dropdownMenuItems && (jsxRuntime.jsx("button", { className: "tw-peer tw-absolute tw-right-squid-xxs tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-bg-material-light-thin tw-p-2 tw-text-grey-300 tw-opacity-0 tw-transition-opacity focus:tw-opacity-100 group-hover/history-item:tw-opacity-100", onClick: openDropdown, ref: openDropdownButtonRef, children: jsxRuntime.jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })), jsxRuntime.jsx("div", { className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs', !!dropdownMenuItems &&
|
|
3292
|
+
'tw-transition-opacity group-hover/history-item:tw-hidden group-hover/history-item:tw-opacity-0 peer-focus:tw-hidden peer-focus:tw-opacity-0'), children: statusLabel })] }), jsxRuntime.jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsxRuntime.jsx(BodyText, { size: "small", children: fromAmount }), jsxRuntime.jsx("span", { className: "tw-text-grey-600", children: jsxRuntime.jsx(ChevronLargeRightIcon, {}) }), jsxRuntime.jsx(BodyText, { size: "small", children: toAmount })] })] }), isDropdownOpen && !!dropdownMenuItems ? (jsxRuntime.jsx(DropdownMenu, { menuRef: menuRef,
|
|
3286
3293
|
// only show dropdown menu if there is a position defined for it
|
|
3287
|
-
isHidden: !dropdownPosition, className: cn(!!dropdownPosition && dropdownPositionClassMap[dropdownPosition]), dropdownRef: dropdownRef, items: dropdownMenuItems })) : null] }) }));
|
|
3294
|
+
isHidden: !dropdownPosition, className: cn(!!dropdownPosition && dropdownPositionClassMap[dropdownPosition]), dropdownRef: dropdownRef, items: dropdownMenuItems })) : null] })) }));
|
|
3288
3295
|
}
|
|
3289
3296
|
|
|
3290
3297
|
const listItemSizeMap = {
|
|
@@ -3295,10 +3302,10 @@ function ListItem(_a) {
|
|
|
3295
3302
|
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded = false, detailButtonClassName, loading, containerProps } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps"]);
|
|
3296
3303
|
// 'small' variant does not have detail
|
|
3297
3304
|
const showDetail = size === 'large' && (!!detail || !!icon || showDetailOnHoverOnly);
|
|
3298
|
-
return (jsxRuntime.jsx("li", Object.assign({}, containerProps, { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxRuntime.jsxs("button", Object.assign({}, props, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-cursor-pointer tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin', isSelected && 'tw-bg-material-light-thin'), children: [size === 'large' ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: rounded })) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-
|
|
3305
|
+
return (jsxRuntime.jsx("li", Object.assign({}, containerProps, { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxRuntime.jsxs("button", Object.assign({}, props, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-cursor-pointer tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin', isSelected && 'tw-bg-material-light-thin'), children: [size === 'large' ? (jsxRuntime.jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: rounded })) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsxRuntime.jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxRuntime.jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs',
|
|
3299
3306
|
// 'large' variant has extra padding
|
|
3300
|
-
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsxRuntime.jsx(BodyText, { size: "small", className:
|
|
3301
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsxRuntime.jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsxRuntime.jsx(CaptionText, { className: "tw-h-
|
|
3307
|
+
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsxRuntime.jsx(BodyText, { size: "small", className: cn('tw-max-w-full tw-truncate', subtitle && 'tw-h-[17px] !tw-leading-[17px]'), children: itemTitle })) : (itemTitle), size === 'large' &&
|
|
3308
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsxRuntime.jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsxRuntime.jsx(CaptionText, { className: "tw-h-[14px] tw-max-w-full tw-truncate !tw-leading-[16px] tw-text-grey-500", children: subtitle })) : null)] }), showDetail && (jsxRuntime.jsxs("button", { onClick: (event) => {
|
|
3302
3309
|
// prevent click event from bubbling up to parent
|
|
3303
3310
|
event.stopPropagation();
|
|
3304
3311
|
onDetailClick === null || onDetailClick === void 0 ? void 0 : onDetailClick();
|
|
@@ -3369,13 +3376,13 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3369
3376
|
value
|
|
3370
3377
|
.trim()
|
|
3371
3378
|
.split(' ')
|
|
3372
|
-
.map((word, i) => (jsxRuntime.jsx(BodyText, { size: "small", className: "tw-leading-[
|
|
3379
|
+
.map((word, i) => (jsxRuntime.jsx(BodyText, { size: "small", className: "!tw-leading-[13px]", children: word }, i))));
|
|
3373
3380
|
}
|
|
3374
3381
|
else if (type === 'image') {
|
|
3375
3382
|
return (jsxRuntime.jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }, index));
|
|
3376
3383
|
}
|
|
3377
3384
|
return null;
|
|
3378
|
-
}) })
|
|
3385
|
+
}) })] })] }));
|
|
3379
3386
|
}
|
|
3380
3387
|
|
|
3381
3388
|
function DropdownMenu({ dropdownRef, items, className, menuRef, isHidden = false, listClassName, }) {
|
|
@@ -3550,6 +3557,7 @@ const lightTheme = {
|
|
|
3550
3557
|
// status
|
|
3551
3558
|
'status-positive': '#11D421',
|
|
3552
3559
|
'status-negative': '#FF5B4D',
|
|
3560
|
+
'status-warning': '#EC9213',
|
|
3553
3561
|
// transparent
|
|
3554
3562
|
'transparent-light-thin': '#17191C1A', // 10% opacity
|
|
3555
3563
|
'transparent-light-average': '#17191C54', // 33% opacity
|
|
@@ -3572,6 +3580,10 @@ const themeKeysToReplace = [
|
|
|
3572
3580
|
userKey: 'transparent',
|
|
3573
3581
|
internalKey: 'material',
|
|
3574
3582
|
},
|
|
3583
|
+
{
|
|
3584
|
+
userKey: 'status-warning',
|
|
3585
|
+
internalKey: 'status-partial',
|
|
3586
|
+
},
|
|
3575
3587
|
];
|
|
3576
3588
|
/**
|
|
3577
3589
|
* Parsing the user readable config to css variables
|
|
@@ -5,8 +5,9 @@ export declare function ChevronArrowIcon({ size, className, }: {
|
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare function ArrowTriangle(): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare function ChevronTopSmallIcon(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function ChevronLargeDownIcon({ size }: {
|
|
8
|
+
export declare function ChevronLargeDownIcon({ size, className, }: {
|
|
9
9
|
size?: string;
|
|
10
|
+
className?: string;
|
|
10
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export declare function ChevronTopIcon(): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export declare function ChevronLargeRightIcon({ size, className, }: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DropdownMenuItemProps } from './DropdownMenuItem';
|
|
3
|
-
type HistoryItemStatus = 'completed' | 'pending' | 'failed';
|
|
3
|
+
type HistoryItemStatus = 'completed' | 'pending' | 'failed' | 'warning';
|
|
4
4
|
interface HistoryItemProps {
|
|
5
5
|
firstImageUrl: string;
|
|
6
6
|
secondImageUrl: string;
|
|
@@ -12,6 +12,8 @@ interface HistoryItemProps {
|
|
|
12
12
|
toAmount: string;
|
|
13
13
|
dropdownMenuItems?: DropdownMenuItemProps[];
|
|
14
14
|
itemsContainerRef?: React.RefObject<HTMLElement>;
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
warningLabel?: string;
|
|
15
17
|
}
|
|
16
|
-
export declare function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, warningLabel, onClick, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -6,4 +6,6 @@ type Story = StoryObj<typeof meta>;
|
|
|
6
6
|
export declare const Completed: Story;
|
|
7
7
|
export declare const Pending: Story;
|
|
8
8
|
export declare const Failed: Story;
|
|
9
|
+
export declare const Warning: Story;
|
|
9
10
|
export declare const WithActions: Story;
|
|
11
|
+
export declare const IsClickable: Story;
|
|
@@ -8,6 +8,7 @@ export declare const Pending: Story;
|
|
|
8
8
|
export declare const Progress: Story;
|
|
9
9
|
export declare const CustomDescription: Story;
|
|
10
10
|
export declare const ShowSeparator: Story;
|
|
11
|
+
export declare const Link: Story;
|
|
11
12
|
export declare const LongDescription: Story;
|
|
12
13
|
export declare const LongDescriptionWithSeparator: Story;
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const LongDescriptionWithSeparatorAndLink: Story;
|
|
@@ -16,6 +16,7 @@ export interface InternalSquidTheme {
|
|
|
16
16
|
'royal-500': string;
|
|
17
17
|
'status-positive': string;
|
|
18
18
|
'status-negative': string;
|
|
19
|
+
'status-partial': string;
|
|
19
20
|
'material-light-thin': string;
|
|
20
21
|
'material-light-average': string;
|
|
21
22
|
'material-light-thick': string;
|
|
@@ -37,6 +38,7 @@ export type SquidTheme = {
|
|
|
37
38
|
'accent-500': string;
|
|
38
39
|
'status-positive': string;
|
|
39
40
|
'status-negative': string;
|
|
41
|
+
'status-warning': string;
|
|
40
42
|
'transparent-light-thin': string;
|
|
41
43
|
'transparent-light-average': string;
|
|
42
44
|
'transparent-light-thick': string;
|
package/dist/esm/index.js
CHANGED
|
@@ -2666,8 +2666,8 @@ function ChevronArrowIcon({ size = '16', className, }) {
|
|
|
2666
2666
|
function ArrowTriangle() {
|
|
2667
2667
|
return (jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M2.87921 5.55701C2.21562 4.22933 3.18052 2.6665 4.66531 2.6665H11.3348C12.8196 2.6665 13.7845 4.22933 13.1209 5.55701L9.78615 12.229C9.05029 13.7012 6.94983 13.7012 6.21397 12.229L2.87921 5.55701Z", fill: "currentColor" }) }));
|
|
2668
2668
|
}
|
|
2669
|
-
function ChevronLargeDownIcon({ size = '24' }) {
|
|
2670
|
-
return (jsx("svg", { width: size, height: size, viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M3 10.5L11.0287 14.9604C11.6328 15.296 12.3672 15.296 12.9713 14.9604L21 10.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2669
|
+
function ChevronLargeDownIcon({ size = '24', className, }) {
|
|
2670
|
+
return (jsx("svg", { width: size, height: size, viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsx("path", { d: "M3 10.5L11.0287 14.9604C11.6328 15.296 12.3672 15.296 12.9713 14.9604L21 10.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
2671
2671
|
}
|
|
2672
2672
|
function ChevronLargeRightIcon({ size = '16', className, }) {
|
|
2673
2673
|
return (jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: jsx("path", { d: "M6.66675 14L9.64035 8.64754C9.86407 8.24484 9.86407 7.75519 9.64035 7.35249L6.66675 2", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
@@ -2756,6 +2756,9 @@ const themeTypesKeys = {
|
|
|
2756
2756
|
'status-positive': {
|
|
2757
2757
|
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-positive`,
|
|
2758
2758
|
},
|
|
2759
|
+
'status-partial': {
|
|
2760
|
+
cssVariable: `${SQUID_THEME_CSS_VARIABLE_PREFIX}status-partial`,
|
|
2761
|
+
},
|
|
2759
2762
|
};
|
|
2760
2763
|
|
|
2761
2764
|
function PlusIcon() {
|
|
@@ -3123,6 +3126,9 @@ function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessa
|
|
|
3123
3126
|
function EmojiSadIcon({ className }) {
|
|
3124
3127
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", className: className, children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM13.5341 12.4645C11.5815 10.5118 8.41568 10.5118 6.46306 12.4645C6.07254 12.855 6.07254 13.4882 6.46306 13.8787C6.85358 14.2692 7.48675 14.2692 7.87727 13.8787C9.04885 12.7071 10.9483 12.7071 12.1199 13.8787C12.5104 14.2692 13.1436 14.2692 13.5341 13.8787C13.9247 13.4882 13.9247 12.855 13.5341 12.4645ZM8.5 7.5C8.5 8.32843 7.94036 9 7.25 9C6.55964 9 6 8.32843 6 7.5C6 6.67157 6.55964 6 7.25 6C7.94036 6 8.5 6.67157 8.5 7.5ZM12.75 9C13.4404 9 14 8.32843 14 7.5C14 6.67157 13.4404 6 12.75 6C12.0596 6 11.5 6.67157 11.5 7.5C11.5 8.32843 12.0596 9 12.75 9Z", fill: "currentColor" }) }));
|
|
3125
3128
|
}
|
|
3129
|
+
function EmojiMeh({ className, size = '20', }) {
|
|
3130
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM7.25 9C7.94036 9 8.5 8.32843 8.5 7.5C8.5 6.67157 7.94036 6 7.25 6C6.55964 6 6 6.67157 6 7.5C6 8.32843 6.55964 9 7.25 9ZM14 7.5C14 8.32843 13.4404 9 12.75 9C12.0596 9 11.5 8.32843 11.5 7.5C11.5 6.67157 12.0596 6 12.75 6C13.4404 6 14 6.67157 14 7.5ZM7 12C6.44772 12 6 12.4477 6 13C6 13.5523 6.44772 14 7 14H13C13.5523 14 14 13.5523 14 13C14 12.4477 13.5523 12 13 12H7Z", fill: "currentColor" }) }));
|
|
3131
|
+
}
|
|
3126
3132
|
|
|
3127
3133
|
function ErrorMessage({ message, showIcon = true }) {
|
|
3128
3134
|
return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [showIcon ? jsx(EmojiSadIcon, {}) : null, jsx(CaptionText, { children: message })] }));
|
|
@@ -3145,7 +3151,7 @@ function DetailsToolbar({ errorMessage, boostMode = 'normal', onToggleBoostMode,
|
|
|
3145
3151
|
return 'full';
|
|
3146
3152
|
}, [errorMessage, isLoading, isEmpty]);
|
|
3147
3153
|
const detailClassName = cn('tw-w-[190px]', detailStateClassMap[state]);
|
|
3148
|
-
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, {}) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
3154
|
+
return (jsx("aside", { className: cn('tw-flex tw-h-[50px] tw-w-[480px] tw-items-center tw-justify-around tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-py-squid-xxs tw-text-grey-500', state === 'error' ? 'tw-px-squid-l' : 'tw-px-squid-m'), children: state === 'error' && errorMessage ? (jsxs(Fragment, { children: [jsx(ErrorMessage, { message: errorMessage }), helpButton ? (jsx(Button, { onClick: helpButton.onClick, size: "md", variant: "tertiary", label: helpButton.label })) : null] })) : (jsxs(Fragment, { children: [jsx("div", { className: detailClassName, children: jsx(FeeButton, { feeInUsd: feeInUsd, onClick: onFeeButtonClick }) }), jsx("div", { className: "tw-flex tw-h-squid-xl tw-w-squid-xxl tw-items-center tw-justify-center", children: state === 'loading' ? (jsx(Loader, { size: "32" })) : (jsx(Button, { variant: "tertiary", size: "md", onClick: onInvertSwapButtonClick, className: "tw-group/arrow-button tw-border-transparent tw-bg-transparent hover:tw-bg-material-light-thin", icon: jsx(ChevronLargeDownIcon, { className: "tw-transition-transform tw-duration-150 group-hover/arrow-button:tw-rotate-180" }) })) }), jsx("div", { className: detailClassName, children: jsx(Boost, { estimatedTime: estimatedTime !== null && estimatedTime !== void 0 ? estimatedTime : '0s', boostMode: boostMode, onToggleBoostMode: onToggleBoostMode, canToggleBoostMode: state === 'loading' ? false : canToggleBoostMode, boostDisabledMessage: boostDisabledMessage, boostTooltipDisplayDelayMs: boostTooltipDisplayDelayMs }) })] })) }));
|
|
3149
3155
|
}
|
|
3150
3156
|
|
|
3151
3157
|
function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }) {
|
|
@@ -3202,37 +3208,31 @@ const statusBadge = {
|
|
|
3202
3208
|
containerClassName: 'tw-bg-royal-400',
|
|
3203
3209
|
},
|
|
3204
3210
|
failed: {
|
|
3205
|
-
badge: (jsx("span", { className: "
|
|
3211
|
+
badge: (jsx("span", { className: "tw-bg-grey-900", children: jsx(EmojiSadIcon, { className: "tw-text-status-negative" }) })),
|
|
3206
3212
|
containerClassName: 'tw-bg-status-negative',
|
|
3207
3213
|
},
|
|
3214
|
+
warning: {
|
|
3215
|
+
badge: (jsx("span", { className: "tw-bg-grey-900", children: jsx(EmojiMeh, { className: "tw-text-status-partial" }) })),
|
|
3216
|
+
containerClassName: 'tw-bg-status-partial',
|
|
3217
|
+
},
|
|
3208
3218
|
};
|
|
3209
|
-
function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, }) {
|
|
3219
|
+
function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, warningLabel, onClick, }) {
|
|
3210
3220
|
const { isDropdownOpen, dropdownRef, openDropdownButtonRef, openDropdown } = useDropdownMenu();
|
|
3211
3221
|
const [dropdownPosition, setDropdownPosition] = useState(null);
|
|
3212
3222
|
const itemRef = useRef(null);
|
|
3213
3223
|
const menuRef = useRef(null);
|
|
3214
|
-
const
|
|
3224
|
+
const statusLabel = useMemo(() => {
|
|
3215
3225
|
switch (status) {
|
|
3216
3226
|
case 'completed':
|
|
3217
|
-
return {
|
|
3218
|
-
label: dateCompleted,
|
|
3219
|
-
className: '',
|
|
3220
|
-
};
|
|
3227
|
+
return jsx(CaptionText, { children: dateCompleted });
|
|
3221
3228
|
case 'pending':
|
|
3222
|
-
return {
|
|
3223
|
-
label: 'Pending',
|
|
3224
|
-
className: 'tw-text-royal-400',
|
|
3225
|
-
};
|
|
3229
|
+
return jsx(CaptionText, { className: "tw-text-royal-400", children: "Pending" });
|
|
3226
3230
|
case 'failed':
|
|
3227
|
-
return {
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
};
|
|
3231
|
+
return (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-text-status-negative", children: "Fail" }), jsx(CaptionText, { children: dateCompleted })] }));
|
|
3232
|
+
case 'warning':
|
|
3233
|
+
return (jsx(CaptionText, { className: "tw-text-status-partial", children: warningLabel }));
|
|
3231
3234
|
default:
|
|
3232
|
-
return
|
|
3233
|
-
label: '',
|
|
3234
|
-
className: '',
|
|
3235
|
-
};
|
|
3235
|
+
return null;
|
|
3236
3236
|
}
|
|
3237
3237
|
}, [status, dateCompleted]);
|
|
3238
3238
|
// Effect to find the best position for the dropdown menu, so it's always visible for the user
|
|
@@ -3279,10 +3279,17 @@ function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount,
|
|
|
3279
3279
|
setDropdownPosition('top');
|
|
3280
3280
|
}
|
|
3281
3281
|
}, [isDropdownOpen, menuRef, dropdownPosition, itemRef]);
|
|
3282
|
-
|
|
3283
|
-
|
|
3282
|
+
const isInteractive = !!onClick;
|
|
3283
|
+
const ItemTag = isInteractive ? 'button' : 'div';
|
|
3284
|
+
const itemTagProps = isInteractive
|
|
3285
|
+
? {
|
|
3286
|
+
onClick,
|
|
3287
|
+
}
|
|
3288
|
+
: {};
|
|
3289
|
+
return (jsx("li", { ref: itemRef, className: "tw-h-list-item-large tw-min-w-list-item-small tw-self-stretch tw-bg-grey-900 tw-px-squid-xs tw-text-grey-300", children: jsxs(ItemTag, Object.assign({}, itemTagProps, { className: cn('tw-group/history-item tw-relative tw-flex tw-w-full tw-flex-shrink-0 tw-items-center tw-gap-squid-xs tw-self-stretch tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs', isInteractive && 'hover:tw-bg-material-light-thin'), children: [jsxs("div", { className: "tw-relative tw-h-10 tw-w-[60px]", children: [!!statusBadge[status].badge && (jsx("span", { className: cn('tw-absolute -tw-left-[5px] tw-bottom-0 tw-z-10 tw-flex tw-h-squid-m tw-w-squid-m tw-items-center tw-justify-center tw-overflow-hidden tw-rounded-full tw-border tw-border-grey-900 tw-p-0.5', statusBadge[status].containerClassName), children: statusBadge[status].badge })), jsx("img", { src: firstImageUrl, className: "tw-absolute tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" }), jsx("img", { src: secondImageUrl, className: "tw-absolute tw-left-5 tw-h-10 tw-w-10 tw-rounded-full tw-border tw-border-grey-900" })] }), jsxs("div", { className: "tw-flex tw-h-10 tw-flex-1 tw-flex-col tw-self-stretch", children: [jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-justify-between tw-text-grey-500", children: [jsxs("div", { className: "tw-flex tw-items-center", children: [jsx(CaptionText, { children: fromLabel }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronRightSmallIcon, {}) }), jsx(CaptionText, { children: toLabel })] }), !!dropdownMenuItems && (jsx("button", { className: "tw-peer tw-absolute tw-right-squid-xxs tw-top-squid-xxs tw-flex tw-h-squid-xl tw-w-squid-xl tw-items-center tw-justify-center tw-rounded-squid-xs tw-bg-material-light-thin tw-p-2 tw-text-grey-300 tw-opacity-0 tw-transition-opacity focus:tw-opacity-100 group-hover/history-item:tw-opacity-100", onClick: openDropdown, ref: openDropdownButtonRef, children: jsx(DotGrid1x3HorizontalIcon, { size: "24" }) })), jsx("div", { className: cn('tw-flex tw-items-center tw-justify-center tw-gap-squid-xxs', !!dropdownMenuItems &&
|
|
3290
|
+
'tw-transition-opacity group-hover/history-item:tw-hidden group-hover/history-item:tw-opacity-0 peer-focus:tw-hidden peer-focus:tw-opacity-0'), children: statusLabel })] }), jsxs("div", { className: "tw-flex tw-h-5 tw-items-center tw-gap-squid-xxs tw-text-grey-300", children: [jsx(BodyText, { size: "small", children: fromAmount }), jsx("span", { className: "tw-text-grey-600", children: jsx(ChevronLargeRightIcon, {}) }), jsx(BodyText, { size: "small", children: toAmount })] })] }), isDropdownOpen && !!dropdownMenuItems ? (jsx(DropdownMenu, { menuRef: menuRef,
|
|
3284
3291
|
// only show dropdown menu if there is a position defined for it
|
|
3285
|
-
isHidden: !dropdownPosition, className: cn(!!dropdownPosition && dropdownPositionClassMap[dropdownPosition]), dropdownRef: dropdownRef, items: dropdownMenuItems })) : null] }) }));
|
|
3292
|
+
isHidden: !dropdownPosition, className: cn(!!dropdownPosition && dropdownPositionClassMap[dropdownPosition]), dropdownRef: dropdownRef, items: dropdownMenuItems })) : null] })) }));
|
|
3286
3293
|
}
|
|
3287
3294
|
|
|
3288
3295
|
const listItemSizeMap = {
|
|
@@ -3293,10 +3300,10 @@ function ListItem(_a) {
|
|
|
3293
3300
|
var { itemTitle, mainImageUrl, subtitle, detail, icon, secondaryImageUrl, size = 'large', mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded = false, detailButtonClassName, loading, containerProps } = _a, props = __rest(_a, ["itemTitle", "mainImageUrl", "subtitle", "detail", "icon", "secondaryImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps"]);
|
|
3294
3301
|
// 'small' variant does not have detail
|
|
3295
3302
|
const showDetail = size === 'large' && (!!detail || !!icon || showDetailOnHoverOnly);
|
|
3296
|
-
return (jsx("li", Object.assign({}, containerProps, { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxs("button", Object.assign({}, props, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-cursor-pointer tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin', isSelected && 'tw-bg-material-light-thin'), children: [size === 'large' ? (jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: rounded })) })) : (jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-
|
|
3303
|
+
return (jsx("li", Object.assign({}, containerProps, { className: cn('tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300', listItemSizeMap[size], className), children: jsxs("button", Object.assign({}, props, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-cursor-pointer tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs hover:tw-bg-material-light-thin', isSelected && 'tw-bg-material-light-thin'), children: [size === 'large' ? (jsx("div", { className: "tw-h-10 tw-w-10", children: mainIcon ? (mainIcon) : (jsx(BadgeImage, { extraMarginForBadge: false, imageUrl: mainImageUrl, badgeUrl: secondaryImageUrl, size: "md", rounded: rounded })) })) : (jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon ? (mainIcon) : (jsx("img", { src: mainImageUrl, className: "tw-h-[30px] tw-w-[30px] tw-rounded-squid-xs" })) })), jsxs("div", { className: cn('tw-flex tw-h-[40px] tw-flex-1 tw-flex-col tw-items-start tw-justify-center tw-gap-squid-xxs',
|
|
3297
3304
|
// 'large' variant has extra padding
|
|
3298
|
-
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsx(BodyText, { size: "small", className:
|
|
3299
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsx(CaptionText, { className: "tw-h-
|
|
3305
|
+
size === 'large' ? 'tw-w-[56%] tw-pl-squid-xxs' : 'tw-w-[67%]'), children: [typeof itemTitle === 'string' ? (jsx(BodyText, { size: "small", className: cn('tw-max-w-full tw-truncate', subtitle && 'tw-h-[17px] !tw-leading-[17px]'), children: itemTitle })) : (itemTitle), size === 'large' &&
|
|
3306
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (jsx(LoadingSkeleton, { className: "-tw-translate-x-6 tw-text-grey-500", height: "10" })) : subtitle ? (jsx(CaptionText, { className: "tw-h-[14px] tw-max-w-full tw-truncate !tw-leading-[16px] tw-text-grey-500", children: subtitle })) : null)] }), showDetail && (jsxs("button", { onClick: (event) => {
|
|
3300
3307
|
// prevent click event from bubbling up to parent
|
|
3301
3308
|
event.stopPropagation();
|
|
3302
3309
|
onDetailClick === null || onDetailClick === void 0 ? void 0 : onDetailClick();
|
|
@@ -3367,13 +3374,13 @@ function SwapStepItem({ descriptionBlocks, chipContent, showStepSeparator = fals
|
|
|
3367
3374
|
value
|
|
3368
3375
|
.trim()
|
|
3369
3376
|
.split(' ')
|
|
3370
|
-
.map((word, i) => (jsx(BodyText, { size: "small", className: "tw-leading-[
|
|
3377
|
+
.map((word, i) => (jsx(BodyText, { size: "small", className: "!tw-leading-[13px]", children: word }, i))));
|
|
3371
3378
|
}
|
|
3372
3379
|
else if (type === 'image') {
|
|
3373
3380
|
return (jsx("img", { src: value, className: "tw-h-squid-m tw-w-squid-m tw-rounded-full" }, index));
|
|
3374
3381
|
}
|
|
3375
3382
|
return null;
|
|
3376
|
-
}) })
|
|
3383
|
+
}) })] })] }));
|
|
3377
3384
|
}
|
|
3378
3385
|
|
|
3379
3386
|
function DropdownMenu({ dropdownRef, items, className, menuRef, isHidden = false, listClassName, }) {
|
|
@@ -3548,6 +3555,7 @@ const lightTheme = {
|
|
|
3548
3555
|
// status
|
|
3549
3556
|
'status-positive': '#11D421',
|
|
3550
3557
|
'status-negative': '#FF5B4D',
|
|
3558
|
+
'status-warning': '#EC9213',
|
|
3551
3559
|
// transparent
|
|
3552
3560
|
'transparent-light-thin': '#17191C1A', // 10% opacity
|
|
3553
3561
|
'transparent-light-average': '#17191C54', // 33% opacity
|
|
@@ -3570,6 +3578,10 @@ const themeKeysToReplace = [
|
|
|
3570
3578
|
userKey: 'transparent',
|
|
3571
3579
|
internalKey: 'material',
|
|
3572
3580
|
},
|
|
3581
|
+
{
|
|
3582
|
+
userKey: 'status-warning',
|
|
3583
|
+
internalKey: 'status-partial',
|
|
3584
|
+
},
|
|
3573
3585
|
];
|
|
3574
3586
|
/**
|
|
3575
3587
|
* Parsing the user readable config to css variables
|
|
@@ -5,8 +5,9 @@ export declare function ChevronArrowIcon({ size, className, }: {
|
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare function ArrowTriangle(): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare function ChevronTopSmallIcon(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function ChevronLargeDownIcon({ size }: {
|
|
8
|
+
export declare function ChevronLargeDownIcon({ size, className, }: {
|
|
9
9
|
size?: string;
|
|
10
|
+
className?: string;
|
|
10
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export declare function ChevronTopIcon(): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export declare function ChevronLargeRightIcon({ size, className, }: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DropdownMenuItemProps } from './DropdownMenuItem';
|
|
3
|
-
type HistoryItemStatus = 'completed' | 'pending' | 'failed';
|
|
3
|
+
type HistoryItemStatus = 'completed' | 'pending' | 'failed' | 'warning';
|
|
4
4
|
interface HistoryItemProps {
|
|
5
5
|
firstImageUrl: string;
|
|
6
6
|
secondImageUrl: string;
|
|
@@ -12,6 +12,8 @@ interface HistoryItemProps {
|
|
|
12
12
|
toAmount: string;
|
|
13
13
|
dropdownMenuItems?: DropdownMenuItemProps[];
|
|
14
14
|
itemsContainerRef?: React.RefObject<HTMLElement>;
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
warningLabel?: string;
|
|
15
17
|
}
|
|
16
|
-
export declare function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, warningLabel, onClick, }: HistoryItemProps): import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -6,4 +6,6 @@ type Story = StoryObj<typeof meta>;
|
|
|
6
6
|
export declare const Completed: Story;
|
|
7
7
|
export declare const Pending: Story;
|
|
8
8
|
export declare const Failed: Story;
|
|
9
|
+
export declare const Warning: Story;
|
|
9
10
|
export declare const WithActions: Story;
|
|
11
|
+
export declare const IsClickable: Story;
|
|
@@ -8,6 +8,7 @@ export declare const Pending: Story;
|
|
|
8
8
|
export declare const Progress: Story;
|
|
9
9
|
export declare const CustomDescription: Story;
|
|
10
10
|
export declare const ShowSeparator: Story;
|
|
11
|
+
export declare const Link: Story;
|
|
11
12
|
export declare const LongDescription: Story;
|
|
12
13
|
export declare const LongDescriptionWithSeparator: Story;
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const LongDescriptionWithSeparatorAndLink: Story;
|
|
@@ -16,6 +16,7 @@ export interface InternalSquidTheme {
|
|
|
16
16
|
'royal-500': string;
|
|
17
17
|
'status-positive': string;
|
|
18
18
|
'status-negative': string;
|
|
19
|
+
'status-partial': string;
|
|
19
20
|
'material-light-thin': string;
|
|
20
21
|
'material-light-average': string;
|
|
21
22
|
'material-light-thick': string;
|
|
@@ -37,6 +38,7 @@ export type SquidTheme = {
|
|
|
37
38
|
'accent-500': string;
|
|
38
39
|
'status-positive': string;
|
|
39
40
|
'status-negative': string;
|
|
41
|
+
'status-warning': string;
|
|
40
42
|
'transparent-light-thin': string;
|
|
41
43
|
'transparent-light-average': string;
|
|
42
44
|
'transparent-light-thick': string;
|
package/dist/index.css
CHANGED
|
@@ -832,10 +832,6 @@ video {
|
|
|
832
832
|
margin-right: 1px;
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
-
.tw-mr-squid-xxs {
|
|
836
|
-
margin-right: 0.3125rem;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
835
|
.tw-mt-1 {
|
|
840
836
|
margin-top: 0.25rem;
|
|
841
837
|
}
|
|
@@ -896,10 +892,18 @@ video {
|
|
|
896
892
|
height: 10px;
|
|
897
893
|
}
|
|
898
894
|
|
|
895
|
+
.tw-h-\[14px\] {
|
|
896
|
+
height: 14px;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
899
|
.tw-h-\[160px\] {
|
|
900
900
|
height: 160px;
|
|
901
901
|
}
|
|
902
902
|
|
|
903
|
+
.tw-h-\[17px\] {
|
|
904
|
+
height: 17px;
|
|
905
|
+
}
|
|
906
|
+
|
|
903
907
|
.tw-h-\[195px\] {
|
|
904
908
|
height: 195px;
|
|
905
909
|
}
|
|
@@ -1000,10 +1004,6 @@ video {
|
|
|
1000
1004
|
height: 2.5rem;
|
|
1001
1005
|
}
|
|
1002
1006
|
|
|
1003
|
-
.tw-h-squid-xs {
|
|
1004
|
-
height: 0.625rem;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
1007
|
.tw-h-squid-xxl {
|
|
1008
1008
|
height: 3.75rem;
|
|
1009
1009
|
}
|
|
@@ -1188,6 +1188,10 @@ video {
|
|
|
1188
1188
|
width: 480px;
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
1191
|
+
.tw-w-\[500px\] {
|
|
1192
|
+
width: 500px;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1191
1195
|
.tw-w-\[52px\] {
|
|
1192
1196
|
width: 52px;
|
|
1193
1197
|
}
|
|
@@ -1921,6 +1925,10 @@ video {
|
|
|
1921
1925
|
background-color: var(--squid-theme-status-negative);
|
|
1922
1926
|
}
|
|
1923
1927
|
|
|
1928
|
+
.tw-bg-status-partial {
|
|
1929
|
+
background-color: var(--squid-theme-status-partial);
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1924
1932
|
.tw-bg-status-positive {
|
|
1925
1933
|
background-color: var(--squid-theme-status-positive);
|
|
1926
1934
|
}
|
|
@@ -2316,14 +2324,14 @@ video {
|
|
|
2316
2324
|
line-height: 10px !important;
|
|
2317
2325
|
}
|
|
2318
2326
|
|
|
2319
|
-
.\!tw-leading-\[11px\] {
|
|
2320
|
-
line-height: 11px !important;
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
2327
|
.\!tw-leading-\[13px\] {
|
|
2324
2328
|
line-height: 13px !important;
|
|
2325
2329
|
}
|
|
2326
2330
|
|
|
2331
|
+
.\!tw-leading-\[16px\] {
|
|
2332
|
+
line-height: 16px !important;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2327
2335
|
.\!tw-leading-\[17px\] {
|
|
2328
2336
|
line-height: 17px !important;
|
|
2329
2337
|
}
|
|
@@ -2352,10 +2360,6 @@ video {
|
|
|
2352
2360
|
line-height: 13px;
|
|
2353
2361
|
}
|
|
2354
2362
|
|
|
2355
|
-
.tw-leading-\[20px\] {
|
|
2356
|
-
line-height: 20px;
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
2363
|
.tw-leading-body-large {
|
|
2360
2364
|
line-height: 39.34px;
|
|
2361
2365
|
}
|
|
@@ -2465,6 +2469,10 @@ video {
|
|
|
2465
2469
|
color: var(--squid-theme-status-negative);
|
|
2466
2470
|
}
|
|
2467
2471
|
|
|
2472
|
+
.tw-text-status-partial {
|
|
2473
|
+
color: var(--squid-theme-status-partial);
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2468
2476
|
.tw-text-status-positive {
|
|
2469
2477
|
color: var(--squid-theme-status-positive);
|
|
2470
2478
|
}
|
|
@@ -2582,6 +2590,10 @@ video {
|
|
|
2582
2590
|
transition-duration: 100ms;
|
|
2583
2591
|
}
|
|
2584
2592
|
|
|
2593
|
+
.tw-duration-150 {
|
|
2594
|
+
transition-duration: 150ms;
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2585
2597
|
.tw-duration-200 {
|
|
2586
2598
|
transition-duration: 200ms;
|
|
2587
2599
|
}
|
|
@@ -2646,16 +2658,8 @@ li {
|
|
|
2646
2658
|
);
|
|
2647
2659
|
}
|
|
2648
2660
|
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
a {
|
|
2652
|
-
outline: 2px solid transparent;
|
|
2653
|
-
outline-offset: -1px;
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2656
|
-
button:focus,
|
|
2657
|
-
input:focus,
|
|
2658
|
-
a:focus {
|
|
2661
|
+
:focus-visible {
|
|
2662
|
+
outline-style: solid;
|
|
2659
2663
|
outline-width: 2px;
|
|
2660
2664
|
outline-color: var(--squid-theme-royal-500);
|
|
2661
2665
|
}
|
|
@@ -2757,14 +2761,15 @@ input[type='number'] {
|
|
|
2757
2761
|
opacity: 0.6;
|
|
2758
2762
|
}
|
|
2759
2763
|
|
|
2760
|
-
.tw-group\/swap-step-item:hover .group-hover\/swap-step-item\:tw-block {
|
|
2761
|
-
display: block;
|
|
2762
|
-
}
|
|
2763
|
-
|
|
2764
2764
|
.tw-group\/history-item:hover .group-hover\/history-item\:tw-hidden {
|
|
2765
2765
|
display: none;
|
|
2766
2766
|
}
|
|
2767
2767
|
|
|
2768
|
+
.tw-group\/arrow-button:hover .group-hover\/arrow-button\:tw-rotate-180 {
|
|
2769
|
+
--tw-rotate: 180deg;
|
|
2770
|
+
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));
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2768
2773
|
.tw-group\/swap-step-item-button:hover .group-hover\/swap-step-item-button\:tw-from-grey-700 {
|
|
2769
2774
|
--tw-gradient-from: var(--squid-theme-grey-700) var(--tw-gradient-from-position);
|
|
2770
2775
|
--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);
|
package/dist/index.d.ts
CHANGED
|
@@ -200,7 +200,7 @@ interface DropdownMenuItemProps {
|
|
|
200
200
|
}
|
|
201
201
|
declare function DropdownMenuItem({ label, imageUrl, icon, labelClassName, onClick, }: DropdownMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
202
202
|
|
|
203
|
-
type HistoryItemStatus = 'completed' | 'pending' | 'failed';
|
|
203
|
+
type HistoryItemStatus = 'completed' | 'pending' | 'failed' | 'warning';
|
|
204
204
|
interface HistoryItemProps {
|
|
205
205
|
firstImageUrl: string;
|
|
206
206
|
secondImageUrl: string;
|
|
@@ -212,8 +212,10 @@ interface HistoryItemProps {
|
|
|
212
212
|
toAmount: string;
|
|
213
213
|
dropdownMenuItems?: DropdownMenuItemProps[];
|
|
214
214
|
itemsContainerRef?: React.RefObject<HTMLElement>;
|
|
215
|
+
onClick?: () => void;
|
|
216
|
+
warningLabel?: string;
|
|
215
217
|
}
|
|
216
|
-
declare function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, }: HistoryItemProps): react_jsx_runtime.JSX.Element;
|
|
218
|
+
declare function HistoryItem({ firstImageUrl, secondImageUrl, dateCompleted, fromAmount, fromLabel, toAmount, toLabel, dropdownMenuItems, itemsContainerRef, status, warningLabel, onClick, }: HistoryItemProps): react_jsx_runtime.JSX.Element;
|
|
217
219
|
|
|
218
220
|
interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
219
221
|
itemTitle: string | React.ReactNode;
|
|
@@ -474,6 +476,7 @@ type SquidTheme = {
|
|
|
474
476
|
'accent-500': string;
|
|
475
477
|
'status-positive': string;
|
|
476
478
|
'status-negative': string;
|
|
479
|
+
'status-warning': string;
|
|
477
480
|
'transparent-light-thin': string;
|
|
478
481
|
'transparent-light-average': string;
|
|
479
482
|
'transparent-light-thick': string;
|