@crossed/demo
Version:
A universal & performant styling library for React Native, Next.js & React
86 lines (85 loc) • 3.74 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_exports = {};
__export(separator_exports, {
CreateListWithSeparatorDemo: () => CreateListWithSeparatorDemo
});
module.exports = __toCommonJS(separator_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_styled = require("@crossed/styled");
var import_primitive = require("@crossed/primitive");
var import_ui = require("@crossed/ui");
var import_react = require("react");
const List = (0, import_primitive.createList)({
Root: ({ children, ...props }) => {
const id = (0, import_react.useId)();
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"ul",
{
...props,
className: (0, import_styled.merge)(
"flex flex-col border border-neutral-800 rounded-md",
props.className
),
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)("div", { className: "border-t border-neutral-800" })
] }, `${id}-${i}`);
}) : children
}
);
},
Item: (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { ...props, className: (0, import_styled.merge)("px-3 py-2", props.className) });
},
SubTitle: (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"div",
{
...props,
className: (0, import_styled.merge)("text-sm text-neutral-500", props.className)
}
);
},
Title: (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...props, className: (0, import_styled.merge)("font-bold", props.className) });
}
});
const CreateListWithSeparatorDemo = () => {
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 = {
CreateListWithSeparatorDemo
});
//# sourceMappingURL=separator.js.map