@0xsquid/ui 2.4.2 → 2.4.3
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 +23 -11
- package/dist/cjs/types/components/badges/ImageGroup.d.ts +3 -1
- package/dist/cjs/types/components/lists/ListItem.d.ts +2 -1
- package/dist/cjs/types/stories/badges/ImageGroup.stories.d.ts +2 -1
- package/dist/cjs/types/stories/lists/ListItem.stories.d.ts +1 -0
- package/dist/esm/index.js +23 -11
- package/dist/esm/types/components/badges/ImageGroup.d.ts +3 -1
- package/dist/esm/types/components/lists/ListItem.d.ts +2 -1
- package/dist/esm/types/stories/badges/ImageGroup.stories.d.ts +2 -1
- package/dist/esm/types/stories/lists/ListItem.stories.d.ts +1 -0
- package/dist/index.d.ts +5 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3501,7 +3501,7 @@ exports.ImageState = void 0;
|
|
|
3501
3501
|
ImageState[ImageState["LOADED"] = 1] = "LOADED";
|
|
3502
3502
|
ImageState[ImageState["ERROR"] = 2] = "ERROR";
|
|
3503
3503
|
})(exports.ImageState || (exports.ImageState = {}));
|
|
3504
|
-
const sizeClassMap = {
|
|
3504
|
+
const sizeClassMap$1 = {
|
|
3505
3505
|
small: "tw-w-squid-s",
|
|
3506
3506
|
medium: "tw-w-squid-m",
|
|
3507
3507
|
large: "tw-w-squid-l",
|
|
@@ -3544,7 +3544,7 @@ const borderClassMap = {
|
|
|
3544
3544
|
};
|
|
3545
3545
|
function Image$1(_a) {
|
|
3546
3546
|
var { src, size = "medium", className: propsClassName, placeholderImageUrl, border = "none", rounded = "xxs", shadow = false, children, containerProps } = _a, props = __rest$1(_a, ["src", "size", "className", "placeholderImageUrl", "border", "rounded", "shadow", "children", "containerProps"]);
|
|
3547
|
-
const className = cn("tw-object-cover tw-aspect-square tw-relative tw-duration-300 tw-transition-[width,height] tw-max-w-full tw-bg-grey-500", sizeClassMap[size], propsClassName, roundedClassMap$1[rounded], shadow && boxShadowClassMap[size], borderClassMap[border]);
|
|
3547
|
+
const className = cn("tw-object-cover tw-aspect-square tw-relative tw-duration-300 tw-transition-[width,height] tw-max-w-full tw-bg-grey-500", sizeClassMap$1[size], propsClassName, roundedClassMap$1[rounded], shadow && boxShadowClassMap[size], borderClassMap[border]);
|
|
3548
3548
|
const [imageState, setImageState] = React$1.useState(exports.ImageState.LOADED);
|
|
3549
3549
|
return (jsxRuntime.jsxs("div", Object.assign({}, containerProps, { className: cn("tw-relative", containerProps === null || containerProps === void 0 ? void 0 : containerProps.className), children: [border === "gradient" && (jsxRuntime.jsx("span", { style: {
|
|
3550
3550
|
borderRadius: gradientRoundedClassMap[rounded],
|
|
@@ -3635,12 +3635,24 @@ function IconLabel({ src, children, rounded }) {
|
|
|
3635
3635
|
return (jsxRuntime.jsxs("div", { className: "tw-inline-flex tw-items-center tw-gap-squid-xxs", children: [src && jsxRuntime.jsx(Image$1, { src: src, rounded: rounded, size: "medium" }), typeof children === "string" ? (jsxRuntime.jsx(CaptionText, { children: children })) : (children)] }));
|
|
3636
3636
|
}
|
|
3637
3637
|
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3638
|
+
const sizeClassMap = {
|
|
3639
|
+
large: "tw-h-squid-xxl tw-w-squid-xxl tw-rounded-squid-s",
|
|
3640
|
+
small: "tw-h-squid-xl tw-w-squid-xl tw-rounded-squid-xs",
|
|
3641
|
+
};
|
|
3642
|
+
const customImageStylesMap = {
|
|
3643
|
+
large: {
|
|
3644
|
+
width: "24px",
|
|
3645
|
+
height: "24px",
|
|
3646
|
+
borderRadius: "7.5px",
|
|
3647
|
+
},
|
|
3648
|
+
small: {
|
|
3649
|
+
width: "16px",
|
|
3650
|
+
height: "16px",
|
|
3651
|
+
borderRadius: "5px",
|
|
3652
|
+
},
|
|
3653
|
+
};
|
|
3654
|
+
function ImageGroup({ imageUrls, badge, size = "large", }) {
|
|
3655
|
+
return (jsxRuntime.jsxs("div", { className: cn("tw-relative tw-flex tw-flex-shrink-0 tw-flex-wrap tw-content-center tw-items-center tw-justify-center tw-gap-0.5 tw-border tw-border-solid tw-border-material-light-thin tw-bg-grey-700", sizeClassMap[size]), children: [imageUrls.map((url) => (jsxRuntime.jsx(Image$1, { src: url, size: "medium", rounded: "xxs", style: customImageStylesMap[size] }, url))), badge != null && size !== "small" && (jsxRuntime.jsx("div", { className: "tw-absolute -tw-bottom-[1px] -tw-right-[1px]", children: jsxRuntime.jsx(Image$1, Object.assign({}, badge, { border: "outline-lg", size: "medium" })) }))] }));
|
|
3644
3656
|
}
|
|
3645
3657
|
|
|
3646
3658
|
function Approve() {
|
|
@@ -19327,7 +19339,7 @@ const collapsedListItemClassMap = {
|
|
|
19327
19339
|
large: "tw-w-[80px]",
|
|
19328
19340
|
};
|
|
19329
19341
|
function ListItem(_a) {
|
|
19330
|
-
var { itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size = "large", mainIcon, className, isSelected = false, onDetailClick, showDetailOnHoverOnly, rounded = "xxs", detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding = true, itemsContainerRef, dropdownMenuContent } = _a, props = __rest$1(_a, ["itemTitle", "mainImageUrl", "subtitle", "subtitleOnHover", "detail", "icon", "secondaryImageUrl", "placeholderImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps", "compactOnMobile", "extraPadding", "itemsContainerRef", "dropdownMenuContent"]);
|
|
19342
|
+
var { itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size = "large", mainIcon, className, isSelected = false, onDetailClick, showDetailOnHoverOnly, rounded = "xxs", detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding = true, itemsContainerRef, dropdownMenuContent, imageGroup } = _a, props = __rest$1(_a, ["itemTitle", "mainImageUrl", "subtitle", "subtitleOnHover", "detail", "icon", "secondaryImageUrl", "placeholderImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps", "compactOnMobile", "extraPadding", "itemsContainerRef", "dropdownMenuContent", "imageGroup"]);
|
|
19331
19343
|
const { isDropdownOpen, dropdownRef, openDropdown, closeDropdown, openDropdownButtonRef, itemRef, menuRef, dropdownStyles, } = useDropdownMenu({
|
|
19332
19344
|
itemsContainerRef,
|
|
19333
19345
|
});
|
|
@@ -19382,7 +19394,7 @@ function ListItem(_a) {
|
|
|
19382
19394
|
};
|
|
19383
19395
|
return (jsxRuntime.jsxs("li", Object.assign({}, containerProps, { ref: itemRef, className: cn("tw-relative tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300 tw-highlight-adjacent", listItemSizeMap[size], extraPadding && "tw-px-squid-xs", compactOnMobile
|
|
19384
19396
|
? `${collapsedListItemClassMap[size]} mobile-lg:tw-w-full`
|
|
19385
|
-
: "tw-w-full", className), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { onClick: handleItemClick, className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "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 !== null && mainIcon !== void 0 ? mainIcon : (jsxRuntime.jsx(BadgeImage, { image: {
|
|
19397
|
+
: "tw-w-full", className), children: [jsxRuntime.jsxs(ItemTag, Object.assign({}, itemProps, { onClick: handleItemClick, className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "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 !== null && mainIcon !== void 0 ? mainIcon : (imageGroup != null ? (jsxRuntime.jsx(ImageGroup, { size: "small", imageUrls: imageGroup })) : (jsxRuntime.jsx(BadgeImage, { image: {
|
|
19386
19398
|
src: mainImageUrl,
|
|
19387
19399
|
placeholderImageUrl,
|
|
19388
19400
|
size: "xlarge",
|
|
@@ -19394,7 +19406,7 @@ function ListItem(_a) {
|
|
|
19394
19406
|
size: "medium",
|
|
19395
19407
|
border: "outline-lg",
|
|
19396
19408
|
}
|
|
19397
|
-
: undefined })) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon !== null && mainIcon !== void 0 ? mainIcon : (jsxRuntime.jsx(Image$1, { size: "large", src: mainImageUrl, placeholderImageUrl: placeholderImageUrl, rounded: rounded })) })), 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",
|
|
19409
|
+
: undefined }))) })) : (jsxRuntime.jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon !== null && mainIcon !== void 0 ? mainIcon : (jsxRuntime.jsx(Image$1, { size: "large", src: mainImageUrl, placeholderImageUrl: placeholderImageUrl, rounded: rounded })) })), 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",
|
|
19398
19410
|
// 'large' variant has extra padding
|
|
19399
19411
|
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]", compactOnMobile ? "tw-hidden mobile-lg:tw-block" : "tw-block"), children: itemTitle })) : (itemTitle), size === "large" &&
|
|
19400
19412
|
((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
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ImageProps } from "./Image";
|
|
2
|
+
type ImageGroupSize = "small" | "large";
|
|
2
3
|
interface ImageGroupProps {
|
|
3
4
|
imageUrls: string[];
|
|
4
5
|
badge?: Omit<ImageProps, "border" | "size">;
|
|
6
|
+
size?: ImageGroupSize;
|
|
5
7
|
}
|
|
6
|
-
export declare function ImageGroup({ imageUrls, badge }: ImageGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ImageGroup({ imageUrls, badge, size, }: ImageGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -25,9 +25,10 @@ interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
25
25
|
extraPadding?: boolean;
|
|
26
26
|
dropdownMenuContent?: React.ReactNode;
|
|
27
27
|
itemsContainerRef?: React.RefObject<HTMLElement>;
|
|
28
|
+
imageGroup?: string[];
|
|
28
29
|
}
|
|
29
30
|
type ListItemSize = "small" | "large";
|
|
30
|
-
export declare function ListItem({ itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size, mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded, detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding, itemsContainerRef, dropdownMenuContent, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function ListItem({ itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size, mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded, detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding, itemsContainerRef, dropdownMenuContent, imageGroup, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
31
32
|
export declare const ListItemActionsButton: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
32
33
|
isActive?: boolean | undefined;
|
|
33
34
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -3,6 +3,7 @@ import { ImageGroup } from "../../components/badges/ImageGroup";
|
|
|
3
3
|
declare const meta: Meta<typeof ImageGroup>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Large: Story;
|
|
7
|
+
export declare const Small: Story;
|
|
7
8
|
export declare const Badge: Story;
|
|
8
9
|
export declare const CustomBadgeContent: Story;
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof ListItem>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Large: Story;
|
|
7
|
+
export declare const LargeWithImageGroup: Story;
|
|
7
8
|
export declare const LargeInteractive: Story;
|
|
8
9
|
export declare const LargeWithLongTitle: Story;
|
|
9
10
|
export declare const LargeWithLongTitleAndSubtitle: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -3481,7 +3481,7 @@ var ImageState;
|
|
|
3481
3481
|
ImageState[ImageState["LOADED"] = 1] = "LOADED";
|
|
3482
3482
|
ImageState[ImageState["ERROR"] = 2] = "ERROR";
|
|
3483
3483
|
})(ImageState || (ImageState = {}));
|
|
3484
|
-
const sizeClassMap = {
|
|
3484
|
+
const sizeClassMap$1 = {
|
|
3485
3485
|
small: "tw-w-squid-s",
|
|
3486
3486
|
medium: "tw-w-squid-m",
|
|
3487
3487
|
large: "tw-w-squid-l",
|
|
@@ -3524,7 +3524,7 @@ const borderClassMap = {
|
|
|
3524
3524
|
};
|
|
3525
3525
|
function Image$1(_a) {
|
|
3526
3526
|
var { src, size = "medium", className: propsClassName, placeholderImageUrl, border = "none", rounded = "xxs", shadow = false, children, containerProps } = _a, props = __rest$1(_a, ["src", "size", "className", "placeholderImageUrl", "border", "rounded", "shadow", "children", "containerProps"]);
|
|
3527
|
-
const className = cn("tw-object-cover tw-aspect-square tw-relative tw-duration-300 tw-transition-[width,height] tw-max-w-full tw-bg-grey-500", sizeClassMap[size], propsClassName, roundedClassMap$1[rounded], shadow && boxShadowClassMap[size], borderClassMap[border]);
|
|
3527
|
+
const className = cn("tw-object-cover tw-aspect-square tw-relative tw-duration-300 tw-transition-[width,height] tw-max-w-full tw-bg-grey-500", sizeClassMap$1[size], propsClassName, roundedClassMap$1[rounded], shadow && boxShadowClassMap[size], borderClassMap[border]);
|
|
3528
3528
|
const [imageState, setImageState] = useState(ImageState.LOADED);
|
|
3529
3529
|
return (jsxs("div", Object.assign({}, containerProps, { className: cn("tw-relative", containerProps === null || containerProps === void 0 ? void 0 : containerProps.className), children: [border === "gradient" && (jsx("span", { style: {
|
|
3530
3530
|
borderRadius: gradientRoundedClassMap[rounded],
|
|
@@ -3615,12 +3615,24 @@ function IconLabel({ src, children, rounded }) {
|
|
|
3615
3615
|
return (jsxs("div", { className: "tw-inline-flex tw-items-center tw-gap-squid-xxs", children: [src && jsx(Image$1, { src: src, rounded: rounded, size: "medium" }), typeof children === "string" ? (jsx(CaptionText, { children: children })) : (children)] }));
|
|
3616
3616
|
}
|
|
3617
3617
|
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3618
|
+
const sizeClassMap = {
|
|
3619
|
+
large: "tw-h-squid-xxl tw-w-squid-xxl tw-rounded-squid-s",
|
|
3620
|
+
small: "tw-h-squid-xl tw-w-squid-xl tw-rounded-squid-xs",
|
|
3621
|
+
};
|
|
3622
|
+
const customImageStylesMap = {
|
|
3623
|
+
large: {
|
|
3624
|
+
width: "24px",
|
|
3625
|
+
height: "24px",
|
|
3626
|
+
borderRadius: "7.5px",
|
|
3627
|
+
},
|
|
3628
|
+
small: {
|
|
3629
|
+
width: "16px",
|
|
3630
|
+
height: "16px",
|
|
3631
|
+
borderRadius: "5px",
|
|
3632
|
+
},
|
|
3633
|
+
};
|
|
3634
|
+
function ImageGroup({ imageUrls, badge, size = "large", }) {
|
|
3635
|
+
return (jsxs("div", { className: cn("tw-relative tw-flex tw-flex-shrink-0 tw-flex-wrap tw-content-center tw-items-center tw-justify-center tw-gap-0.5 tw-border tw-border-solid tw-border-material-light-thin tw-bg-grey-700", sizeClassMap[size]), children: [imageUrls.map((url) => (jsx(Image$1, { src: url, size: "medium", rounded: "xxs", style: customImageStylesMap[size] }, url))), badge != null && size !== "small" && (jsx("div", { className: "tw-absolute -tw-bottom-[1px] -tw-right-[1px]", children: jsx(Image$1, Object.assign({}, badge, { border: "outline-lg", size: "medium" })) }))] }));
|
|
3624
3636
|
}
|
|
3625
3637
|
|
|
3626
3638
|
function Approve() {
|
|
@@ -19307,7 +19319,7 @@ const collapsedListItemClassMap = {
|
|
|
19307
19319
|
large: "tw-w-[80px]",
|
|
19308
19320
|
};
|
|
19309
19321
|
function ListItem(_a) {
|
|
19310
|
-
var { itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size = "large", mainIcon, className, isSelected = false, onDetailClick, showDetailOnHoverOnly, rounded = "xxs", detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding = true, itemsContainerRef, dropdownMenuContent } = _a, props = __rest$1(_a, ["itemTitle", "mainImageUrl", "subtitle", "subtitleOnHover", "detail", "icon", "secondaryImageUrl", "placeholderImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps", "compactOnMobile", "extraPadding", "itemsContainerRef", "dropdownMenuContent"]);
|
|
19322
|
+
var { itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size = "large", mainIcon, className, isSelected = false, onDetailClick, showDetailOnHoverOnly, rounded = "xxs", detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding = true, itemsContainerRef, dropdownMenuContent, imageGroup } = _a, props = __rest$1(_a, ["itemTitle", "mainImageUrl", "subtitle", "subtitleOnHover", "detail", "icon", "secondaryImageUrl", "placeholderImageUrl", "size", "mainIcon", "className", "isSelected", "onDetailClick", "showDetailOnHoverOnly", "rounded", "detailButtonClassName", "loading", "containerProps", "compactOnMobile", "extraPadding", "itemsContainerRef", "dropdownMenuContent", "imageGroup"]);
|
|
19311
19323
|
const { isDropdownOpen, dropdownRef, openDropdown, closeDropdown, openDropdownButtonRef, itemRef, menuRef, dropdownStyles, } = useDropdownMenu({
|
|
19312
19324
|
itemsContainerRef,
|
|
19313
19325
|
});
|
|
@@ -19362,7 +19374,7 @@ function ListItem(_a) {
|
|
|
19362
19374
|
};
|
|
19363
19375
|
return (jsxs("li", Object.assign({}, containerProps, { ref: itemRef, className: cn("tw-relative tw-flex tw-max-w-full tw-bg-grey-900 tw-text-grey-300 tw-highlight-adjacent", listItemSizeMap[size], extraPadding && "tw-px-squid-xs", compactOnMobile
|
|
19364
19376
|
? `${collapsedListItemClassMap[size]} mobile-lg:tw-w-full`
|
|
19365
|
-
: "tw-w-full", className), children: [jsxs(ItemTag, Object.assign({}, itemProps, { onClick: handleItemClick, className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "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 !== null && mainIcon !== void 0 ? mainIcon : (jsx(BadgeImage, { image: {
|
|
19377
|
+
: "tw-w-full", className), children: [jsxs(ItemTag, Object.assign({}, itemProps, { onClick: handleItemClick, className: cn("tw-group/list-item tw-peer/list-item tw-relative tw-flex tw-w-full tw-max-w-full tw-items-center tw-justify-start tw-gap-squid-xs tw-rounded-squid-s tw-px-squid-xs tw-py-squid-xxs", (isSelected || isDropdownOpen) && "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 !== null && mainIcon !== void 0 ? mainIcon : (imageGroup != null ? (jsx(ImageGroup, { size: "small", imageUrls: imageGroup })) : (jsx(BadgeImage, { image: {
|
|
19366
19378
|
src: mainImageUrl,
|
|
19367
19379
|
placeholderImageUrl,
|
|
19368
19380
|
size: "xlarge",
|
|
@@ -19374,7 +19386,7 @@ function ListItem(_a) {
|
|
|
19374
19386
|
size: "medium",
|
|
19375
19387
|
border: "outline-lg",
|
|
19376
19388
|
}
|
|
19377
|
-
: undefined })) })) : (jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon !== null && mainIcon !== void 0 ? mainIcon : (jsx(Image$1, { size: "large", src: mainImageUrl, placeholderImageUrl: placeholderImageUrl, rounded: rounded })) })), 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",
|
|
19389
|
+
: undefined }))) })) : (jsx("div", { className: "tw-flex tw-min-h-[30px] tw-min-w-[30px] tw-items-center tw-justify-center", children: mainIcon !== null && mainIcon !== void 0 ? mainIcon : (jsx(Image$1, { size: "large", src: mainImageUrl, placeholderImageUrl: placeholderImageUrl, rounded: rounded })) })), 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",
|
|
19378
19390
|
// 'large' variant has extra padding
|
|
19379
19391
|
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]", compactOnMobile ? "tw-hidden mobile-lg:tw-block" : "tw-block"), children: itemTitle })) : (itemTitle), size === "large" &&
|
|
19380
19392
|
((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
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ImageProps } from "./Image";
|
|
2
|
+
type ImageGroupSize = "small" | "large";
|
|
2
3
|
interface ImageGroupProps {
|
|
3
4
|
imageUrls: string[];
|
|
4
5
|
badge?: Omit<ImageProps, "border" | "size">;
|
|
6
|
+
size?: ImageGroupSize;
|
|
5
7
|
}
|
|
6
|
-
export declare function ImageGroup({ imageUrls, badge }: ImageGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ImageGroup({ imageUrls, badge, size, }: ImageGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -25,9 +25,10 @@ interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
25
25
|
extraPadding?: boolean;
|
|
26
26
|
dropdownMenuContent?: React.ReactNode;
|
|
27
27
|
itemsContainerRef?: React.RefObject<HTMLElement>;
|
|
28
|
+
imageGroup?: string[];
|
|
28
29
|
}
|
|
29
30
|
type ListItemSize = "small" | "large";
|
|
30
|
-
export declare function ListItem({ itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size, mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded, detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding, itemsContainerRef, dropdownMenuContent, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function ListItem({ itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size, mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded, detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding, itemsContainerRef, dropdownMenuContent, imageGroup, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
31
32
|
export declare const ListItemActionsButton: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
32
33
|
isActive?: boolean | undefined;
|
|
33
34
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -3,6 +3,7 @@ import { ImageGroup } from "../../components/badges/ImageGroup";
|
|
|
3
3
|
declare const meta: Meta<typeof ImageGroup>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const Large: Story;
|
|
7
|
+
export declare const Small: Story;
|
|
7
8
|
export declare const Badge: Story;
|
|
8
9
|
export declare const CustomBadgeContent: Story;
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof ListItem>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
export declare const Large: Story;
|
|
7
|
+
export declare const LargeWithImageGroup: Story;
|
|
7
8
|
export declare const LargeInteractive: Story;
|
|
8
9
|
export declare const LargeWithLongTitle: Story;
|
|
9
10
|
export declare const LargeWithLongTitleAndSubtitle: Story;
|
package/dist/index.d.ts
CHANGED
|
@@ -84,11 +84,13 @@ interface IconLabelProps {
|
|
|
84
84
|
}
|
|
85
85
|
declare function IconLabel({ src, children, rounded }: IconLabelProps): react_jsx_runtime.JSX.Element;
|
|
86
86
|
|
|
87
|
+
type ImageGroupSize = "small" | "large";
|
|
87
88
|
interface ImageGroupProps {
|
|
88
89
|
imageUrls: string[];
|
|
89
90
|
badge?: Omit<ImageProps, "border" | "size">;
|
|
91
|
+
size?: ImageGroupSize;
|
|
90
92
|
}
|
|
91
|
-
declare function ImageGroup({ imageUrls, badge }: ImageGroupProps): react_jsx_runtime.JSX.Element;
|
|
93
|
+
declare function ImageGroup({ imageUrls, badge, size, }: ImageGroupProps): react_jsx_runtime.JSX.Element;
|
|
92
94
|
|
|
93
95
|
declare const LoadingProvider: react.Provider<boolean | null>;
|
|
94
96
|
interface LoadingSkeletonProps {
|
|
@@ -2136,9 +2138,10 @@ interface ListItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
2136
2138
|
extraPadding?: boolean;
|
|
2137
2139
|
dropdownMenuContent?: React.ReactNode;
|
|
2138
2140
|
itemsContainerRef?: React.RefObject<HTMLElement>;
|
|
2141
|
+
imageGroup?: string[];
|
|
2139
2142
|
}
|
|
2140
2143
|
type ListItemSize = "small" | "large";
|
|
2141
|
-
declare function ListItem({ itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size, mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded, detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding, itemsContainerRef, dropdownMenuContent, ...props }: ListItemProps): react_jsx_runtime.JSX.Element;
|
|
2144
|
+
declare function ListItem({ itemTitle, mainImageUrl, subtitle, subtitleOnHover, detail, icon, secondaryImageUrl, placeholderImageUrl, size, mainIcon, className, isSelected, onDetailClick, showDetailOnHoverOnly, rounded, detailButtonClassName, loading, containerProps, compactOnMobile, extraPadding, itemsContainerRef, dropdownMenuContent, imageGroup, ...props }: ListItemProps): react_jsx_runtime.JSX.Element;
|
|
2142
2145
|
declare const ListItemActionsButton: react.ForwardRefExoticComponent<Omit<react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
2143
2146
|
isActive?: boolean | undefined;
|
|
2144
2147
|
}, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|