UNPKG

@roochnetwork/rooch-sdk-kit

Version:
136 lines (125 loc) 5.98 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/ui/View.tsx var View_exports = {}; __export(View_exports, { View: () => View }); module.exports = __toCommonJS(View_exports); // src/components/ui/View.css.ts var actionButtonContainer = "View_actionButtonContainer__1lnj8w33"; var container = "View_container__1lnj8w30"; var content = "View_content__1lnj8w32"; var title = "View_title__1lnj8w31"; // 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/ui/Button.tsx var import_react_slot2 = require("@radix-ui/react-slot"); var import_clsx2 = __toESM(require("clsx"), 1); var import_react2 = require("react"); // src/components/ui/Button.css.ts var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn"); var buttonVariants = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "Button_buttonVariants__1vdhm2g0", variantClassNames: { variant: { primary: "Button_buttonVariants_variant_primary__1vdhm2g1", outline: "Button_buttonVariants_variant_outline__1vdhm2g2" }, size: { md: "Button_buttonVariants_size_md__1vdhm2g3", lg: "Button_buttonVariants_size_lg__1vdhm2g4" } }, defaultVariants: { variant: "primary", size: "md" }, compoundVariants: [] }); // src/components/ui/Button.tsx var import_jsx_runtime2 = require("react/jsx-runtime"); var Button = (0, import_react2.forwardRef)( ({ className, variant, size, asChild = false, ...props }, forwardedRef) => { const Comp = asChild ? import_react_slot2.Slot : "button"; return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( Comp, { ...props, className: (0, import_clsx2.default)(buttonVariants({ variant, size }), className), ref: forwardedRef } ); } ); Button.displayName = "Button"; // src/components/ProgressProvider.tsx var import_react3 = require("react"); var import_jsx_runtime3 = require("react/jsx-runtime"); var ProgressProviderContext = (0, import_react3.createContext)(null); var useProgress = () => { const ctx = (0, import_react3.useContext)(ProgressProviderContext); if (!ctx) { throw new Error("useSubscribeToError must be used within a GlobalProvider"); } return ctx; }; // src/components/ui/View.tsx var import_jsx_runtime4 = require("react/jsx-runtime"); function View({ title: title2, disabledAction, actionText, actionOnClick, children }) { const { loading } = useProgress(); return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: container, children: [ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Heading, { as: "h2", className: title, children: title2 }), /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: content, children }), actionText && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: actionButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)( Button, { disabled: loading || disabledAction, type: "button", variant: "outline", onClick: actionOnClick, children: actionText } ) }) ] }); } //# sourceMappingURL=View.js.map