UNPKG

@roochnetwork/rooch-sdk-kit

Version:
147 lines (137 loc) 6.38 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/components/connect-modal/wallet-list/WalletList.tsx var WalletList_exports = {}; __export(WalletList_exports, { WalletList: () => WalletList }); module.exports = __toCommonJS(WalletList_exports); // src/components/connect-modal/wallet-list/WalletList.css.ts var container = "WalletList_container__1wac1dp0"; // src/components/connect-modal/wallet-list/WalletListItem.tsx var import_clsx2 = require("clsx"); // src/components/ui/Heading.tsx var import_react_slot = require("@radix-ui/react-slot"); var import_clsx = __toESM(require("clsx"), 1); var import_react = require("react"); // src/components/ui/Heading.css.ts var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn"); var headingVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "Heading__1v58k1t0", variantClassNames: { size: { sm: "Heading_headingVariants_size_sm__1v58k1t1", md: "Heading_headingVariants_size_md__1v58k1t2", lg: "Heading_headingVariants_size_lg__1v58k1t3", xl: "Heading_headingVariants_size_xl__1v58k1t4" }, weight: { normal: "Heading_headingVariants_weight_normal__1v58k1t5", bold: "Heading_headingVariants_weight_bold__1v58k1t6" }, truncate: { true: "Heading_headingVariants_truncate_true__1v58k1t7" } }, defaultVariants: { size: "lg", weight: "bold" }, compoundVariants: [] }); // src/components/ui/Heading.tsx var import_jsx_runtime = require("react/jsx-runtime"); var Heading = (0, import_react.forwardRef)( ({ children, className, asChild = false, as: Tag = "h1", size, weight, truncate, ...headingProps }, forwardedRef) => { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_react_slot.Slot, { ...headingProps, ref: forwardedRef, className: (0, import_clsx.default)(headingVariants({ size, weight, truncate }), className), children: asChild ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag, { children }) } ); } ); Heading.displayName = "Heading"; // src/components/connect-modal/wallet-list/WalletListItem.css.ts var container2 = "WalletListItem_container__1i3e7c00"; var detectingStatus = "WalletListItem_detectingStatus__1i3e7c07"; var installedStatus = "WalletListItem_installedStatus__1i3e7c05"; var loadingSpinner = "WalletListItem_loadingSpinner__1i3e7c09"; var notInstalledStatus = "WalletListItem_notInstalledStatus__1i3e7c06"; var selectedWalletItem = "WalletListItem_selectedWalletItem__1i3e7c02"; var walletIcon = "WalletListItem_walletIcon__1i3e7c03"; var walletItem = "WalletListItem_walletItem__1i3e7c01"; var walletStatus = "WalletListItem_walletStatus__1i3e7c04"; // src/components/connect-modal/wallet-list/WalletListItem.tsx var import_jsx_runtime2 = require("react/jsx-runtime"); function WalletListItem({ name, icon, onClick, isSelected = false, isInstalled = false, isDetecting = false }) { return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { className: container2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)( "button", { className: (0, import_clsx2.clsx)(walletItem, { [selectedWalletItem]: isSelected }), type: "button", onClick, children: [ icon && typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { className: walletIcon, src: icon, alt: `${name} logo` }) : icon, /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading, { size: "md", truncate: true, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: name }) }), /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( "span", { className: (0, import_clsx2.clsx)(walletStatus, { [installedStatus]: isInstalled && !isDetecting || name === "Local", [notInstalledStatus]: !isInstalled && !isDetecting, [detectingStatus]: isDetecting && name !== "Local" }), children: isDetecting && name !== "Local" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: loadingSpinner }) }) : isInstalled ? "Installed" : "Uninstalled" } ) ] } ) }); } // src/components/connect-modal/wallet-list/WalletList.tsx var import_jsx_runtime3 = require("react/jsx-runtime"); function WalletList({ wallets, selectedWalletName, onSelect, walletStatus: walletStatus2, isDetecting }) { return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: container, children: wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( WalletListItem, { name: wallet.getName(), icon: wallet.getIcon(), isSelected: wallet.getName() === selectedWalletName, isInstalled: walletStatus2.get(wallet.getName()), isDetecting, onClick: () => onSelect(wallet) }, wallet.getName() )) }); } //# sourceMappingURL=WalletList.js.map