@0xsquid/ui 0.16.1 → 0.16.2
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 +16 -3
- package/dist/cjs/types/components/badges/LoadingSkeleton.d.ts +2 -1
- package/dist/cjs/types/components/lists/ListItem.d.ts +1 -1
- package/dist/esm/index.js +16 -3
- package/dist/esm/types/components/badges/LoadingSkeleton.d.ts +2 -1
- package/dist/esm/types/components/lists/ListItem.d.ts +1 -1
- package/dist/index.css +0 -5
- package/dist/index.d.ts +3 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2591,8 +2591,8 @@ function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, roun
|
|
|
2591
2591
|
imagesLoadState.badgeLoaded ? 'tw-block' : 'tw-hidden') })] })) : null] })) : null;
|
|
2592
2592
|
}
|
|
2593
2593
|
|
|
2594
|
-
function LoadingSkeleton({ className, height = '20', }) {
|
|
2595
|
-
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width:
|
|
2594
|
+
function LoadingSkeleton({ className, height = '20', width = '100', }) {
|
|
2595
|
+
return (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, viewBox: "0 0 100 20", fill: "none", className: className, children: [jsxRuntime.jsx("g", { clipPath: "url(#clip0_1246_29063)", children: jsxRuntime.jsx("rect", { width: "100", height: "20", fill: "url(#paint0_linear_1246_29063)" }) }), jsxRuntime.jsxs("defs", { children: [jsxRuntime.jsxs("linearGradient", { id: "paint0_linear_1246_29063", x1: "0", y1: "10", x2: "100", y2: "10", gradientUnits: "userSpaceOnUse", className: "tw-animate-loading-gradient tw-text-material-light-thin", children: [jsxRuntime.jsx("stop", { stopColor: "currentColor" }), jsxRuntime.jsx("stop", { offset: "0.395881", stopColor: "currentColor" }), jsxRuntime.jsx("stop", { offset: "0.597867", stopColor: "currentColor", className: "group-data-[squid-theme-type=dark]:tw-text-material-light-average group-data-[squid-theme-type=light]:tw-text-transparent" }), jsxRuntime.jsx("stop", { offset: "0.697004", stopColor: "currentColor" })] }), jsxRuntime.jsx("clipPath", { id: "clip0_1246_29063", children: jsxRuntime.jsx("path", { d: "M0 10C0 4.47715 4.47715 0 10 0H90C95.5228 0 100 4.47715 100 10C100 15.5228 95.5229 20 90 20H10C4.47716 20 0 15.5228 0 10Z", fill: "white" }) })] }), ' '] }));
|
|
2596
2596
|
}
|
|
2597
2597
|
|
|
2598
2598
|
/******************************************************************************
|
|
@@ -6679,13 +6679,26 @@ function ListItem(_a) {
|
|
|
6679
6679
|
},
|
|
6680
6680
|
}
|
|
6681
6681
|
: {};
|
|
6682
|
+
// There are two possible ways to handle loading state:
|
|
6683
|
+
// Can be boolean or string
|
|
6684
|
+
// If boolean and true, it will show a full loading skeleton
|
|
6685
|
+
// If it's a non empty string, means that we want to display the skeleton + some text
|
|
6686
|
+
const loadingComponent = () => {
|
|
6687
|
+
if ((loading === null || loading === void 0 ? void 0 : loading.subtitle) === true) {
|
|
6688
|
+
return (jsxRuntime.jsx(LoadingSkeleton, { className: "tw-text-grey-500", height: "10", width: "50" }));
|
|
6689
|
+
}
|
|
6690
|
+
if (typeof (loading === null || loading === void 0 ? void 0 : loading.subtitle) === 'string' && loading.subtitle.length > 0) {
|
|
6691
|
+
return (jsxRuntime.jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsxRuntime.jsx(LoadingSkeleton, { className: "tw-text-grey-500", width: "50" }), jsxRuntime.jsx(CaptionText, { className: subtitleClassName, children: loading.subtitle })] }));
|
|
6692
|
+
}
|
|
6693
|
+
return null;
|
|
6694
|
+
};
|
|
6682
6695
|
const isInteractive = !!props.onClick;
|
|
6683
6696
|
const ItemTag = isInteractive ? 'button' : 'div';
|
|
6684
6697
|
const itemProps = isInteractive ? props : {};
|
|
6685
6698
|
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(ItemTag, Object.assign({}, itemProps, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs', isSelected && 'tw-bg-material-light-thin', isInteractive && 'hover: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',
|
|
6686
6699
|
// 'large' variant has extra padding
|
|
6687
6700
|
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' &&
|
|
6688
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (
|
|
6701
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (loadingComponent()) : subtitle ? (jsxRuntime.jsxs(CaptionText, { className: subtitleClassName, children: [subtitleOnHover && (jsxRuntime.jsx(CaptionText, { className: cn(subtitleClassName, 'tw-hidden group-hover/list-item:tw-block'), children: subtitleOnHover })), subtitle] })) : null)] }), showDetail && (jsxRuntime.jsxs(DetailTag, Object.assign({}, detailProps, { className: cn('tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
6689
6702
|
? 'tw-opacity-0 hover:tw-opacity-100 focus:tw-opacity-100 group-hover/list-item:tw-opacity-100 group-focus/list-item:tw-opacity-100'
|
|
6690
6703
|
: 'tw-flex', isDetailInteractive && 'hover:tw-bg-material-light-thin', detailButtonClassName), children: [!!detail && (jsxRuntime.jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsxRuntime.jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] })))] })) })));
|
|
6691
6704
|
}
|
|
@@ -16,7 +16,7 @@ interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
16
16
|
rounded?: boolean;
|
|
17
17
|
detailButtonClassName?: string;
|
|
18
18
|
loading?: {
|
|
19
|
-
subtitle?: boolean;
|
|
19
|
+
subtitle?: boolean | string;
|
|
20
20
|
};
|
|
21
21
|
containerProps?: React.HTMLAttributes<HTMLLIElement>;
|
|
22
22
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -2571,8 +2571,8 @@ function BadgeImage({ imageUrl, badgeUrl, size = 'sm', extraMarginForBadge, roun
|
|
|
2571
2571
|
imagesLoadState.badgeLoaded ? 'tw-block' : 'tw-hidden') })] })) : null] })) : null;
|
|
2572
2572
|
}
|
|
2573
2573
|
|
|
2574
|
-
function LoadingSkeleton({ className, height = '20', }) {
|
|
2575
|
-
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width:
|
|
2574
|
+
function LoadingSkeleton({ className, height = '20', width = '100', }) {
|
|
2575
|
+
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: width, height: height, viewBox: "0 0 100 20", fill: "none", className: className, children: [jsx("g", { clipPath: "url(#clip0_1246_29063)", children: jsx("rect", { width: "100", height: "20", fill: "url(#paint0_linear_1246_29063)" }) }), jsxs("defs", { children: [jsxs("linearGradient", { id: "paint0_linear_1246_29063", x1: "0", y1: "10", x2: "100", y2: "10", gradientUnits: "userSpaceOnUse", className: "tw-animate-loading-gradient tw-text-material-light-thin", children: [jsx("stop", { stopColor: "currentColor" }), jsx("stop", { offset: "0.395881", stopColor: "currentColor" }), jsx("stop", { offset: "0.597867", stopColor: "currentColor", className: "group-data-[squid-theme-type=dark]:tw-text-material-light-average group-data-[squid-theme-type=light]:tw-text-transparent" }), jsx("stop", { offset: "0.697004", stopColor: "currentColor" })] }), jsx("clipPath", { id: "clip0_1246_29063", children: jsx("path", { d: "M0 10C0 4.47715 4.47715 0 10 0H90C95.5228 0 100 4.47715 100 10C100 15.5228 95.5229 20 90 20H10C4.47716 20 0 15.5228 0 10Z", fill: "white" }) })] }), ' '] }));
|
|
2576
2576
|
}
|
|
2577
2577
|
|
|
2578
2578
|
/******************************************************************************
|
|
@@ -6659,13 +6659,26 @@ function ListItem(_a) {
|
|
|
6659
6659
|
},
|
|
6660
6660
|
}
|
|
6661
6661
|
: {};
|
|
6662
|
+
// There are two possible ways to handle loading state:
|
|
6663
|
+
// Can be boolean or string
|
|
6664
|
+
// If boolean and true, it will show a full loading skeleton
|
|
6665
|
+
// If it's a non empty string, means that we want to display the skeleton + some text
|
|
6666
|
+
const loadingComponent = () => {
|
|
6667
|
+
if ((loading === null || loading === void 0 ? void 0 : loading.subtitle) === true) {
|
|
6668
|
+
return (jsx(LoadingSkeleton, { className: "tw-text-grey-500", height: "10", width: "50" }));
|
|
6669
|
+
}
|
|
6670
|
+
if (typeof (loading === null || loading === void 0 ? void 0 : loading.subtitle) === 'string' && loading.subtitle.length > 0) {
|
|
6671
|
+
return (jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(LoadingSkeleton, { className: "tw-text-grey-500", width: "50" }), jsx(CaptionText, { className: subtitleClassName, children: loading.subtitle })] }));
|
|
6672
|
+
}
|
|
6673
|
+
return null;
|
|
6674
|
+
};
|
|
6662
6675
|
const isInteractive = !!props.onClick;
|
|
6663
6676
|
const ItemTag = isInteractive ? 'button' : 'div';
|
|
6664
6677
|
const itemProps = isInteractive ? props : {};
|
|
6665
6678
|
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(ItemTag, Object.assign({}, itemProps, { className: cn('tw-group/list-item tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs', isSelected && 'tw-bg-material-light-thin', isInteractive && 'hover: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',
|
|
6666
6679
|
// 'large' variant has extra padding
|
|
6667
6680
|
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' &&
|
|
6668
|
-
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (
|
|
6681
|
+
((loading === null || loading === void 0 ? void 0 : loading.subtitle) ? (loadingComponent()) : subtitle ? (jsxs(CaptionText, { className: subtitleClassName, children: [subtitleOnHover && (jsx(CaptionText, { className: cn(subtitleClassName, 'tw-hidden group-hover/list-item:tw-block'), children: subtitleOnHover })), subtitle] })) : null)] }), showDetail && (jsxs(DetailTag, Object.assign({}, detailProps, { className: cn('tw-flex tw-w-fit tw-items-center tw-justify-center tw-rounded-squid-xs', size === 'large' ? 'tw-h-squid-xl' : 'tw-h-squid-l', showDetailOnHoverOnly
|
|
6669
6682
|
? 'tw-opacity-0 hover:tw-opacity-100 focus:tw-opacity-100 group-hover/list-item:tw-opacity-100 group-focus/list-item:tw-opacity-100'
|
|
6670
6683
|
: 'tw-flex', isDetailInteractive && 'hover:tw-bg-material-light-thin', detailButtonClassName), children: [!!detail && (jsx(CaptionText, { className: "min-tw-w-4 min-tw-h-4 tw-px-squid-xxs tw-leading-[10px]", children: detail })), icon ? (jsx("span", { className: "tw-flex tw-items-center tw-justify-center tw-px-[3px] tw-py-2", children: icon })) : null] })))] })) })));
|
|
6671
6684
|
}
|
|
@@ -16,7 +16,7 @@ interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
16
16
|
rounded?: boolean;
|
|
17
17
|
detailButtonClassName?: string;
|
|
18
18
|
loading?: {
|
|
19
|
-
subtitle?: boolean;
|
|
19
|
+
subtitle?: boolean | string;
|
|
20
20
|
};
|
|
21
21
|
containerProps?: React.HTMLAttributes<HTMLLIElement>;
|
|
22
22
|
}
|
package/dist/index.css
CHANGED
|
@@ -1373,11 +1373,6 @@ video {
|
|
|
1373
1373
|
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));
|
|
1374
1374
|
}
|
|
1375
1375
|
|
|
1376
|
-
.-tw-translate-x-6 {
|
|
1377
|
-
--tw-translate-x: -1.5rem;
|
|
1378
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
1376
|
.tw-rotate-180 {
|
|
1382
1377
|
--tw-rotate: 180deg;
|
|
1383
1378
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,10 @@ interface BadgeImageProps {
|
|
|
13
13
|
type BadgeSize = 'sm' | 'md';
|
|
14
14
|
declare function BadgeImage({ imageUrl, badgeUrl, size, extraMarginForBadge, rounded, }: BadgeImageProps): react_jsx_runtime.JSX.Element | null;
|
|
15
15
|
|
|
16
|
-
declare function LoadingSkeleton({ className, height, }: {
|
|
16
|
+
declare function LoadingSkeleton({ className, height, width, }: {
|
|
17
17
|
className?: string;
|
|
18
18
|
height?: string;
|
|
19
|
+
width?: string;
|
|
19
20
|
}): react_jsx_runtime.JSX.Element;
|
|
20
21
|
|
|
21
22
|
interface UsdAmountProps {
|
|
@@ -277,7 +278,7 @@ interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
277
278
|
rounded?: boolean;
|
|
278
279
|
detailButtonClassName?: string;
|
|
279
280
|
loading?: {
|
|
280
|
-
subtitle?: boolean;
|
|
281
|
+
subtitle?: boolean | string;
|
|
281
282
|
};
|
|
282
283
|
containerProps?: React.HTMLAttributes<HTMLLIElement>;
|
|
283
284
|
}
|