"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "ListTile", {
    enumerable: true,
    get: function() {
        return ListTile;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = require("react");
const _networkImage = require("../icon/networkImage");
const _css = require("../utils/css");
const ListTile = (props)=>{
    const leading = (0, _react.useMemo)(()=>{
        if (!props.avatar) {
            return null;
        }
        if (typeof props.avatar === "object" && (props.avatar.type === "token" || props.avatar.type === "chain")) {
            return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                className: "orderly-flex orderly-items-center",
                children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_networkImage.NetworkImage, {
                    ...props.avatar
                })
            });
        }
        if (typeof props.avatar === "string") {
            return /*#__PURE__*/ (0, _jsxruntime.jsx)("img", {
                src: props.avatar,
                className: "orderly-w-10 orderly-h-10 orderly-rounded-full"
            });
        }
        return props.avatar;
    }, [
        [
            props.avatar
        ]
    ]);
    const children = (0, _react.useMemo)(()=>{
        if (props.title || props.subtitle) {
            return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex orderly-flex-col orderly-gap-1",
                children: [
                    props.title && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                        className: "orderly-font-semibold",
                        children: props.title
                    }, "title"),
                    props.subtitle && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                        className: "orderly-text-3xs desktop:orderly-text-2xs orderly-text-base-contrast-54",
                        children: props.subtitle
                    }, "subtitle")
                ]
            });
        }
        return props.children;
    }, [
        props.title,
        props.subtitle,
        props.children
    ]);
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
        className: (0, _css.cn)("orderly-py-3 orderly-flex orderly-gap-3 active:orderly-bg-base-100", props.className, props.disabled && "orderly-opacity-60 orderly-cursor-not-allowed"),
        onClick: props.onClick,
        children: [
            leading,
            /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                className: "orderly-flex-1",
                children: children
            }),
            props.tailing
        ]
    });
};

//# sourceMappingURL=listTile.js.map