@crossed/demo
Version:
A universal & performant styling library for React Native, Next.js & React
86 lines (85 loc) • 2.95 kB
JavaScript
;
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_exports = {};
__export(styled_exports, {
StyledDemo: () => StyledDemo
});
module.exports = __toCommonJS(styled_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_react_native = require("react-native");
var import_styled = require("@crossed/styled");
var import_core = require("@crossed/core");
var import_ui = require("@crossed/ui");
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: {
"aria-disabled": true
}
},
"props": {
role: "button"
},
"variants": {
size: {
xs: {
className: ["px-1", "py-0.5"],
props: { as: "div" }
},
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 StyledDemo = ({ 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 = {
StyledDemo
});
//# sourceMappingURL=styled.js.map