UNPKG

@azure-utils/storybooks

Version:

Utils to upload and manage Storybooks via Azure Functions and storage.

63 lines (61 loc) 2.22 kB
import { __toESM, require_jsx_runtime } from "./store-BL4RNiEp.mjs"; //#region src/components/table.tsx var import_jsx_runtime = __toESM(require_jsx_runtime()); function Table({ caption: safeCaption, columns, data, toolbar: safeToolbar }) { const cols = columns.filter(Boolean); return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "end", margin: 0, gap: "1rem" }, children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: "1.25em", fontWeight: "bold", paddingLeft: "1rem" }, children: safeCaption }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: safeToolbar })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { style: { flex: 1 }, children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { safe: true, children: String(col.header || col.id) })) }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: data.map((item) => { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: cols.map((col) => { const value = col.cell?.(item) || item[col.id]; if (!value) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {}); if (typeof value === "string") { const safeValue = value; return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { style: col.style, children: safeValue }); } if (typeof value === "object") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { safe: true, style: col.style, children: JSON.stringify(value) }); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { safe: true, style: col.style, children: String(value) }); }) }); }) })] })] }); } //#endregion export { Table }; //# sourceMappingURL=table-CFLDF1bd.mjs.map