UNPKG

@azure-utils/storybooks

Version:

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

68 lines (66 loc) 2.33 kB
const require_chunk = require('./chunk-DWy1uDak.cjs'); const require_store = require('./store-CYxr095K.cjs'); //#region src/components/table.tsx var import_jsx_runtime = require_chunk.__toESM(require_store.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 Object.defineProperty(exports, 'Table', { enumerable: true, get: function () { return Table; } });