UNPKG

@crossed/demo

Version:

A universal & performant styling library for React Native, Next.js & React

83 lines (82 loc) 2.93 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; 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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var styled_html_exports = {}; __export(styled_html_exports, { StyledHtmlDemo: () => StyledHtmlDemo }); module.exports = __toCommonJS(styled_html_exports); var import_jsx_runtime = require("react/jsx-runtime"); var import_styled = require("@crossed/styled"); var import_core = require("@crossed/core"); var import_ui = require("@crossed/ui"); var import_react_native = require("react-native"); const ButtonFrame = (0, import_styled.styled)(import_react_native.Pressable, { "className": ["bg-blue-500", "rounded"], ":hover": { className: ["bg-blue-400"] }, ":active": { className: ["bg-blue-600"] }, ":disabled": { className: ["opacity-50", "pointer-events-none"] }, "props": { role: "button", "aria-disabled": true }, "variants": { size: { xs: { className: ["px-1", "py-0.5"] }, sm: { className: ["p-2"] }, md: { className: ["px-3", "p-2"] }, lg: { className: ["p-4"] }, xl: { className: ["p-5"] } } }, "defaultVariants": { size: "md" } }); const ButtonText = (0, import_styled.styled)(import_react_native.Text, { className: ["text-white"], variants: { size: { xs: { className: ["text-xs"] }, sm: { className: ["text-sm"] }, md: { className: ["text-md"] }, lg: { className: ["text-lg"] }, xl: { className: ["text-xl"] } } } }); const Button = (0, import_core.withStaticProperties)(ButtonFrame, { Text: ButtonText }); const StyledHtmlDemo = ({ space }) => { return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.YBox, { space: "md", children: [ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { size: space, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button.Text, { size: space, children: "Hello" }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { size: space, disabled: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button.Text, { size: space, children: "Disabled" }) }) ] }); }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { StyledHtmlDemo }); //# sourceMappingURL=styled-html.js.map