@ai-matrx/records-ui 0.101.2 → 0.101.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.101.7
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.101.2..npm/records-ui/v0.101.7 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.101.6
10
+
11
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
12
+ `git diff npm/records-ui/v0.101.2..npm/records-ui/v0.101.6 -- apps/shared/records-ui`).
13
+ No source changes intended and no consumer action required.
14
+
15
+ ## 0.101.5
16
+
17
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
18
+ `git diff npm/records-ui/v0.101.2..npm/records-ui/v0.101.5 -- apps/shared/records-ui`).
19
+ No source changes intended and no consumer action required.
20
+
21
+ ## 0.101.4
22
+
23
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
24
+ `git diff npm/records-ui/v0.101.2..npm/records-ui/v0.101.4 -- apps/shared/records-ui`).
25
+ No source changes intended and no consumer action required.
26
+
27
+ ## 0.101.3
28
+
29
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
30
+ `git diff npm/records-ui/v0.101.2..npm/records-ui/v0.101.3 -- apps/shared/records-ui`).
31
+ No source changes intended and no consumer action required.
32
+
3
33
  ## 0.101.2
4
34
 
5
35
  `TablesHome`: "Start from a template" (`templatesHref`) also shows while a new table is being named, so a
package/dist/index.cjs CHANGED
@@ -269,6 +269,7 @@ __export(src_exports, {
269
269
  TableSettings: () => TableSettings,
270
270
  TableToolbarSlotContext: () => TableToolbarSlotContext,
271
271
  TablesHome: () => TablesHome,
272
+ TemplatePreview: () => TemplatePreview,
272
273
  TimelineView: () => TimelineView,
273
274
  UNREAD_RECORD_LABEL: () => UNREAD_RECORD_LABEL,
274
275
  VIEW_ADDRESS_KEYS: () => VIEW_ADDRESS_KEYS,
@@ -550,6 +551,7 @@ __export(src_exports, {
550
551
  useTableRights: () => useTableRights,
551
552
  useTableToolbarSlot: () => useTableToolbarSlot,
552
553
  useTablesAnywhere: () => useTablesAnywhere,
554
+ useTemplatePreview: () => useTemplatePreview,
553
555
  useViewRecords: () => useViewRecords,
554
556
  useWhoChanged: () => useWhoChanged,
555
557
  viewActions: () => viewActions,
@@ -46054,4 +46056,44 @@ function Decision({ approvalId, onDecided }) {
46054
46056
  error ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(RefusalLine, { error }) : null
46055
46057
  ] });
46056
46058
  }
46059
+
46060
+ // src/TemplatePreview.tsx
46061
+ var import_react263 = require("react");
46062
+ var import_memory = require("@ai-matrx/records/memory");
46063
+ var import_jsx_runtime152 = require("react/jsx-runtime");
46064
+ function useTemplatePreview(spec, today) {
46065
+ return (0, import_react263.useMemo)(() => (0, import_memory.templatePreview)(spec, today ? { today } : {}), [spec, today]);
46066
+ }
46067
+ function TemplatePreview({ spec, today, initialTable, host, aside, className }) {
46068
+ const preview = useTemplatePreview(spec, today);
46069
+ const first = preview.tables.find((t) => t.token === initialTable) ?? preview.tables[0];
46070
+ const [active, setActive] = (0, import_react263.useState)(first?.id ?? null);
46071
+ const table = preview.tables.find((t) => t.id === active) ?? first;
46072
+ if (!table) return null;
46073
+ return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
46074
+ preview.tables.length > 1 || aside ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
46075
+ preview.tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
46076
+ "button",
46077
+ {
46078
+ type: "button",
46079
+ role: "tab",
46080
+ "aria-selected": t.id === table.id,
46081
+ "data-template-preview-table": t.token,
46082
+ onClick: () => setActive(t.id),
46083
+ className: [
46084
+ "inline-flex h-8 items-center gap-1.5 rounded-md border px-3 text-sm",
46085
+ t.id === table.id ? "border-primary bg-primary/10 text-foreground" : "border-border text-muted-foreground hover:text-foreground"
46086
+ ].join(" "),
46087
+ children: [
46088
+ t.name,
46089
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
46090
+ ]
46091
+ },
46092
+ t.id
46093
+ )),
46094
+ aside ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "ml-auto", children: aside }) : null
46095
+ ] }) : null,
46096
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(RecordsMount, { config: preview.config, host, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TablePage, { tableId: table.id }, table.id) }) })
46097
+ ] });
46098
+ }
46057
46099
  //# sourceMappingURL=index.cjs.map