@crossed/demo
Version:
A universal & performant styling library for React Native, Next.js & React
114 lines (113 loc) • 4.46 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 separator_native_exports = {};
__export(separator_native_exports, {
CreateListWithSeparatorNativeDemo: () => CreateListWithSeparatorNativeDemo
});
module.exports = __toCommonJS(separator_native_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_primitive = require("@crossed/primitive");
var import_styled = require("@crossed/styled");
var import_ui = require("@crossed/ui");
var import_react = require("react");
var import_react_native = require("react-native");
const List = (0, import_primitive.createList)({
Root: ({ children, ...props }) => {
const id = (0, import_react.useId)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_native.View,
{
...props,
style: [
{
borderWidth: 1,
borderColor: "gray",
borderRadius: 5
},
props.style
],
children: Array.isArray(children) ? children.map((c, i) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
c,
i + 1 !== children.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_native.View,
{
role: "separator",
style: { borderTopWidth: 1, borderColor: "gray" }
}
)
] }, `${id}-${i}`);
}) : children
}
);
},
Item: (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_native.View,
{
...props,
style: [
{
paddingVertical: 8,
paddingHorizontal: 12
},
props.style
]
}
);
},
SubTitle: (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Text, { ...props, style: [{ color: "gray" }, props.style] });
},
Title: (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_native.Text,
{
...props,
style: [{ color: "white", fontWeight: "700" }, props.style]
}
);
},
Divider: (0, import_styled.styled)(import_react_native.View, { className: ["border-t border-neutral-800"] }),
Label: (0, import_styled.styled)(import_react_native.Text, {
className: ["text-neutral-500 text-base font-bold", "px-3 py-1.5"],
variants: { danger: { true: { className: ["text-red-800"] } } }
})
});
const CreateListWithSeparatorNativeDemo = () => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.YBox, { space: "md", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(List, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(List.Item, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List.Title, { children: "Number 1" }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List.SubTitle, { children: "Description Number 1" })
] }),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(List.Item, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List.Title, { children: "Number 2" }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List.SubTitle, { children: "Description 2" })
] }),
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(List.Item, { children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List.Title, { children: "Number 3" }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List.SubTitle, { children: "Number 3 have description" })
] })
] }) });
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CreateListWithSeparatorNativeDemo
});
//# sourceMappingURL=separator.native.js.map