@arbidocs/blocks 0.4.95 → 0.4.97

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.
Files changed (106) hide show
  1. package/dist/agents/index.cjs +283 -283
  2. package/dist/agents/index.js +7 -7
  3. package/dist/chat/index.cjs +127 -127
  4. package/dist/chat/index.js +4 -4
  5. package/dist/{chunk-DCZGYCN2.cjs → chunk-3US5OIDQ.cjs} +5 -5
  6. package/dist/{chunk-DCZGYCN2.cjs.map → chunk-3US5OIDQ.cjs.map} +1 -1
  7. package/dist/{chunk-QQH2NI5U.js → chunk-5NQIBJPP.js} +8 -8
  8. package/dist/{chunk-QQH2NI5U.js.map → chunk-5NQIBJPP.js.map} +1 -1
  9. package/dist/{chunk-KBPHLW2R.cjs → chunk-B4SRYJLM.cjs} +3 -3
  10. package/dist/{chunk-KBPHLW2R.cjs.map → chunk-B4SRYJLM.cjs.map} +1 -1
  11. package/dist/chunk-D54JXTPG.cjs +164 -0
  12. package/dist/chunk-D54JXTPG.cjs.map +1 -0
  13. package/dist/{chunk-VQ65UHTV.cjs → chunk-DDYXFALG.cjs} +47 -47
  14. package/dist/{chunk-VQ65UHTV.cjs.map → chunk-DDYXFALG.cjs.map} +1 -1
  15. package/dist/{chunk-RZGVMV6B.cjs → chunk-EHB7J6SR.cjs} +5 -5
  16. package/dist/{chunk-RZGVMV6B.cjs.map → chunk-EHB7J6SR.cjs.map} +1 -1
  17. package/dist/{chunk-EJAYB7PP.js → chunk-EWSEQEPL.js} +4 -4
  18. package/dist/{chunk-EJAYB7PP.js.map → chunk-EWSEQEPL.js.map} +1 -1
  19. package/dist/{chunk-3OXWJ3CZ.cjs → chunk-GVOTXXZG.cjs} +5 -5
  20. package/dist/{chunk-3OXWJ3CZ.cjs.map → chunk-GVOTXXZG.cjs.map} +1 -1
  21. package/dist/{chunk-CKYA2IG5.cjs → chunk-HBF4BDRU.cjs} +3 -3
  22. package/dist/{chunk-CKYA2IG5.cjs.map → chunk-HBF4BDRU.cjs.map} +1 -1
  23. package/dist/{chunk-E2AAIMXO.cjs → chunk-HGJGALLN.cjs} +832 -219
  24. package/dist/chunk-HGJGALLN.cjs.map +1 -0
  25. package/dist/{chunk-24CS7JWU.js → chunk-HOXKR26S.js} +3 -3
  26. package/dist/{chunk-24CS7JWU.js.map → chunk-HOXKR26S.js.map} +1 -1
  27. package/dist/{chunk-PDEHIGJ5.js → chunk-ICBAFX5B.js} +3 -3
  28. package/dist/{chunk-PDEHIGJ5.js.map → chunk-ICBAFX5B.js.map} +1 -1
  29. package/dist/{chunk-OYMYNYFV.cjs → chunk-IF6VAYIA.cjs} +5 -5
  30. package/dist/{chunk-OYMYNYFV.cjs.map → chunk-IF6VAYIA.cjs.map} +1 -1
  31. package/dist/{chunk-TOVSTC2M.cjs → chunk-LENXDIMY.cjs} +5 -5
  32. package/dist/{chunk-TOVSTC2M.cjs.map → chunk-LENXDIMY.cjs.map} +1 -1
  33. package/dist/{chunk-VYKMBLDX.cjs → chunk-MP6FK43E.cjs} +8 -8
  34. package/dist/{chunk-VYKMBLDX.cjs.map → chunk-MP6FK43E.cjs.map} +1 -1
  35. package/dist/{chunk-HUFLBZWI.js → chunk-PGDL26TQ.js} +4 -4
  36. package/dist/{chunk-HUFLBZWI.js.map → chunk-PGDL26TQ.js.map} +1 -1
  37. package/dist/{chunk-WXLKMEMB.js → chunk-QIEEFBZ5.js} +834 -221
  38. package/dist/chunk-QIEEFBZ5.js.map +1 -0
  39. package/dist/{chunk-YPKSLTL5.js → chunk-RSUOOMPT.js} +3 -3
  40. package/dist/{chunk-YPKSLTL5.js.map → chunk-RSUOOMPT.js.map} +1 -1
  41. package/dist/{chunk-UMY6Y6BM.js → chunk-VLOPZHFH.js} +3 -3
  42. package/dist/{chunk-UMY6Y6BM.js.map → chunk-VLOPZHFH.js.map} +1 -1
  43. package/dist/{chunk-GNHOB2ZB.cjs → chunk-XMBYDLZQ.cjs} +4 -4
  44. package/dist/{chunk-GNHOB2ZB.cjs.map → chunk-XMBYDLZQ.cjs.map} +1 -1
  45. package/dist/{chunk-YG7DGGCA.js → chunk-XQDM6T6C.js} +3 -3
  46. package/dist/{chunk-YG7DGGCA.js.map → chunk-XQDM6T6C.js.map} +1 -1
  47. package/dist/{chunk-ZNDAXSDP.js → chunk-YH6SSJDW.js} +3 -3
  48. package/dist/{chunk-ZNDAXSDP.js.map → chunk-YH6SSJDW.js.map} +1 -1
  49. package/dist/{chunk-EOEDGJ75.js → chunk-Z3G65XHZ.js} +3 -3
  50. package/dist/{chunk-EOEDGJ75.js.map → chunk-Z3G65XHZ.js.map} +1 -1
  51. package/dist/chunk-ZCOVDK2E.js +153 -0
  52. package/dist/chunk-ZCOVDK2E.js.map +1 -0
  53. package/dist/components/DetailPanel.d.ts +106 -0
  54. package/dist/connect/docx.cjs +6 -6
  55. package/dist/connect/docx.js +4 -4
  56. package/dist/connect/index.cjs +47 -47
  57. package/dist/connect/index.js +17 -17
  58. package/dist/databases/DatabaseRowDetail.d.ts +32 -0
  59. package/dist/databases/DatabaseTable.d.ts +3 -1
  60. package/dist/databases/DatabaseToolbar.d.ts +9 -1
  61. package/dist/databases/PickCellEditor.d.ts +8 -1
  62. package/dist/databases/SelectCellEditor.d.ts +6 -1
  63. package/dist/databases/column-types.d.ts +5 -0
  64. package/dist/databases/databaseColumns.d.ts +7 -0
  65. package/dist/databases/index.cjs +381 -11
  66. package/dist/databases/index.cjs.map +1 -1
  67. package/dist/databases/index.d.ts +7 -5
  68. package/dist/databases/index.js +379 -14
  69. package/dist/databases/index.js.map +1 -1
  70. package/dist/databases/linkCells.d.ts +4 -2
  71. package/dist/docx/NativeDocxEditor.d.ts +3 -1
  72. package/dist/docx/RibbonMenu.d.ts +15 -0
  73. package/dist/docx/StyleGallery.d.ts +9 -0
  74. package/dist/docx/WordReferences.d.ts +21 -0
  75. package/dist/docx/index.cjs +24 -24
  76. package/dist/docx/index.js +3 -3
  77. package/dist/docx/review/DocxEditorReview.d.ts +4 -2
  78. package/dist/docx/review/commentText.d.ts +7 -0
  79. package/dist/docx/wordStyles.d.ts +21 -0
  80. package/dist/facts/index.cjs +5 -5
  81. package/dist/facts/index.js +2 -2
  82. package/dist/files/index.cjs +308 -0
  83. package/dist/files/index.cjs.map +1 -1
  84. package/dist/files/index.js +298 -2
  85. package/dist/files/index.js.map +1 -1
  86. package/dist/files/views/gridViews.d.ts +80 -0
  87. package/dist/files/views/index.d.ts +2 -0
  88. package/dist/files/views/useGridViews.d.ts +38 -0
  89. package/dist/index.cjs +1237 -1237
  90. package/dist/index.cjs.map +1 -1
  91. package/dist/index.d.ts +1 -0
  92. package/dist/index.js +100 -139
  93. package/dist/index.js.map +1 -1
  94. package/dist/settings/index.cjs +1 -1
  95. package/dist/settings/index.js +1 -1
  96. package/dist/shell/index.cjs +67 -67
  97. package/dist/shell/index.js +3 -3
  98. package/dist/studio/index.cjs +7 -7
  99. package/dist/studio/index.js +6 -6
  100. package/dist/tags/TagDetail.d.ts +1 -0
  101. package/dist/workflow-canvas/index.cjs +51 -51
  102. package/dist/workflow-canvas/index.js +8 -8
  103. package/package.json +4 -4
  104. package/src/docx/styles.css +564 -91
  105. package/dist/chunk-E2AAIMXO.cjs.map +0 -1
  106. package/dist/chunk-WXLKMEMB.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
+ var chunkD54JXTPG_cjs = require('../chunk-D54JXTPG.cjs');
4
5
  var chunkIXALYQT7_cjs = require('../chunk-IXALYQT7.cjs');
5
6
  require('../chunk-FX3K6LNZ.cjs');
6
7
  var chunkMHVNT4J3_cjs = require('../chunk-MHVNT4J3.cjs');
@@ -141,6 +142,10 @@ function compareCells(a, b, type, titlesA, titlesB) {
141
142
  const tb = shown ? formatCell(b, type, void 0, titlesB) : String(b);
142
143
  return ta.localeCompare(tb, void 0, { sensitivity: "base", numeric: true });
143
144
  }
145
+ function rowTitle(row, columns, locale) {
146
+ const first = columns[0];
147
+ return first ? formatCell(row.values[first.id], first.type, locale, row.titles) : "";
148
+ }
144
149
  var CHIP = "inline-flex h-[22px] min-w-0 max-w-[14rem] shrink-0 items-center gap-1 rounded-md border border-border bg-muted/50 px-1.5 text-xs text-foreground";
145
150
  function initials(name) {
146
151
  const parts = name.trim().split(/\s+/).filter(Boolean);
@@ -192,8 +197,17 @@ function LinkChip({
192
197
  }
193
198
  );
194
199
  }
195
- function ChipRow({ children }) {
196
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-full min-w-0 items-center gap-1 overflow-hidden", children });
200
+ function ChipRow({ children, wrap }) {
201
+ return /* @__PURE__ */ jsxRuntime.jsx(
202
+ "span",
203
+ {
204
+ className: ui.cn(
205
+ "flex min-w-0 items-center gap-1",
206
+ wrap ? "flex-wrap py-0.5" : "h-full overflow-hidden"
207
+ ),
208
+ children
209
+ }
210
+ );
197
211
  }
198
212
  function PersonCell({ value, titles }) {
199
213
  const [id] = cellIds(value);
@@ -203,11 +217,12 @@ function LinkChipsCell({
203
217
  value,
204
218
  titles,
205
219
  kind,
206
- onOpenDocument
220
+ onOpenDocument,
221
+ wrap
207
222
  }) {
208
223
  const ids = cellIds(value);
209
224
  if (ids.length === 0) return null;
210
- return /* @__PURE__ */ jsxRuntime.jsx(ChipRow, { children: ids.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
225
+ return /* @__PURE__ */ jsxRuntime.jsx(ChipRow, { wrap, children: ids.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
211
226
  LinkChip,
212
227
  {
213
228
  label: titleOf(id, titles),
@@ -221,11 +236,12 @@ function LinkChipsCell({
221
236
  function LookupCell({
222
237
  value,
223
238
  titles,
224
- locale
239
+ locale,
240
+ wrap
225
241
  }) {
226
242
  const values = cellList(value);
227
243
  if (values.length === 0) return null;
228
- return /* @__PURE__ */ jsxRuntime.jsx(ChipRow, { children: values.map((v, i) => {
244
+ return /* @__PURE__ */ jsxRuntime.jsx(ChipRow, { wrap, children: values.map((v, i) => {
229
245
  const text = formatLookupValue(v, titles, locale);
230
246
  const key = `${i}-${text}`;
231
247
  if (typeof v === "string" && /^doc-/.test(v))
@@ -494,9 +510,11 @@ function SelectCellEditor(props) {
494
510
  var DEFAULT_DATABASE_COLUMN_LABELS = {
495
511
  addColumn: "Add a column",
496
512
  columnSettings: (name) => `${name} column settings`,
497
- computed: "Computed from a relation (read-only)"
513
+ computed: "Computed from a relation (read-only)",
514
+ openRow: "Open row"
498
515
  };
499
516
  var ADD_COLUMN_COL_ID = "__add_column";
517
+ var OPEN_ROW_COL_ID = "__open_row";
500
518
  var COLUMN_TYPE_ICONS = {
501
519
  text: lucideReact.Type,
502
520
  number: lucideReact.Hash,
@@ -554,7 +572,7 @@ function columnWidth(column) {
554
572
  const header = Math.round(column.name.length * 8) + 76 + (isComputedColumn(column) ? 16 : 0);
555
573
  return Math.min(320, Math.max(WIDTHS[column.type], header));
556
574
  }
557
- function canEdit(column, sources) {
575
+ function canEditColumn(column, sources) {
558
576
  if (isComputedColumn(column)) return false;
559
577
  if (column.type === "person") return Boolean(sources?.members);
560
578
  if (column.type === "document") return Boolean(sources?.documents);
@@ -650,8 +668,43 @@ function rendererFor(column, locale, sources) {
650
668
  }
651
669
  }
652
670
  function createDatabaseColumns(columns, options = {}) {
653
- const { readOnly, onEditColumn, onAddColumn, locale, sources } = options;
671
+ const { readOnly, onEditColumn, onAddColumn, onOpenRow, locale, sources } = options;
654
672
  const l = { ...DEFAULT_DATABASE_COLUMN_LABELS, ...options.labels };
673
+ const openRow = onOpenRow && columns.length > 0 ? [
674
+ {
675
+ colId: OPEN_ROW_COL_ID,
676
+ headerName: "",
677
+ width: 40,
678
+ minWidth: 40,
679
+ maxWidth: 40,
680
+ resizable: false,
681
+ sortable: false,
682
+ editable: false,
683
+ suppressMovable: true,
684
+ // Pinned: the button stays in view however far the table scrolls.
685
+ pinned: "left",
686
+ lockPinned: true,
687
+ lockPosition: "left",
688
+ cellClass: "flex items-center justify-center !px-0",
689
+ valueGetter: () => null,
690
+ cellRenderer: (p) => p.data ? /* @__PURE__ */ jsxRuntime.jsx(
691
+ "button",
692
+ {
693
+ type: "button",
694
+ "aria-label": l.openRow,
695
+ title: l.openRow,
696
+ "data-testid": `database-open-row-${p.data.id}`,
697
+ onClick: (e) => {
698
+ e.stopPropagation();
699
+ if (p.data) onOpenRow(p.data);
700
+ },
701
+ onDoubleClick: (e) => e.stopPropagation(),
702
+ className: "flex size-6 items-center justify-center rounded text-muted-foreground/70 hover:bg-muted hover:text-foreground",
703
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize2, { className: "size-3.5" })
704
+ }
705
+ ) : null
706
+ }
707
+ ] : [];
655
708
  const defs = columns.map((column) => ({
656
709
  colId: column.id,
657
710
  headerName: column.name,
@@ -659,7 +712,7 @@ function createDatabaseColumns(columns, options = {}) {
659
712
  minWidth: 90,
660
713
  resizable: true,
661
714
  sortable: true,
662
- editable: !readOnly && canEdit(column, sources),
715
+ editable: !readOnly && canEditColumn(column, sources),
663
716
  // The grid's own type inference must not second-guess the database's column type.
664
717
  cellDataType: false,
665
718
  headerComponentParams: {
@@ -689,6 +742,7 @@ function createDatabaseColumns(columns, options = {}) {
689
742
  ...editorFor(column, sources),
690
743
  ...rendererFor(column, locale, sources)
691
744
  }));
745
+ defs.unshift(...openRow);
692
746
  if (!readOnly && onAddColumn) {
693
747
  defs.push({
694
748
  colId: ADD_COLUMN_COL_ID,
@@ -938,6 +992,313 @@ function RollupFields({
938
992
  ] })
939
993
  ] });
940
994
  }
995
+ var DEFAULT_DATABASE_ROW_DETAIL_LABELS = {
996
+ untitled: "Untitled",
997
+ fields: "Fields",
998
+ documents: "Linked documents",
999
+ noDocuments: "No document is linked to this row.",
1000
+ empty: "Empty",
1001
+ deleteRow: "Delete row",
1002
+ close: "Close",
1003
+ computed: "Computed from a relation"
1004
+ };
1005
+ function DraftInput({
1006
+ value,
1007
+ type,
1008
+ onCommit,
1009
+ testId,
1010
+ label
1011
+ }) {
1012
+ const [draft, setDraft] = react.useState(value);
1013
+ react.useEffect(() => setDraft(value), [value]);
1014
+ return /* @__PURE__ */ jsxRuntime.jsx(
1015
+ ui.Input,
1016
+ {
1017
+ type,
1018
+ value: draft,
1019
+ "aria-label": label,
1020
+ onChange: (e) => setDraft(e.target.value),
1021
+ onBlur: () => draft !== value && onCommit(draft),
1022
+ onKeyDown: (e) => {
1023
+ if (e.key === "Enter") e.currentTarget.blur();
1024
+ if (e.key === "Escape") {
1025
+ setDraft(value);
1026
+ requestAnimationFrame(() => e.target.blur());
1027
+ }
1028
+ },
1029
+ className: "h-8",
1030
+ "data-testid": testId
1031
+ }
1032
+ );
1033
+ }
1034
+ function PopoverField({
1035
+ display,
1036
+ emptyLabel,
1037
+ testId,
1038
+ label,
1039
+ renderEditor,
1040
+ onCommit
1041
+ }) {
1042
+ const [open, setOpen] = react.useState(false);
1043
+ const pending = react.useRef(null);
1044
+ const cancelled = react.useRef(false);
1045
+ const close = (keep) => {
1046
+ setOpen(false);
1047
+ const change = pending.current;
1048
+ pending.current = null;
1049
+ if (change && !cancelled.current) onCommit(change.value);
1050
+ cancelled.current = false;
1051
+ };
1052
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1053
+ ui.Popover,
1054
+ {
1055
+ open,
1056
+ onOpenChange: (next) => {
1057
+ if (next) {
1058
+ pending.current = null;
1059
+ cancelled.current = false;
1060
+ setOpen(true);
1061
+ } else close();
1062
+ },
1063
+ children: [
1064
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1065
+ "div",
1066
+ {
1067
+ role: "button",
1068
+ tabIndex: 0,
1069
+ "aria-label": label,
1070
+ "aria-haspopup": "dialog",
1071
+ onKeyDown: (e) => {
1072
+ if (e.target === e.currentTarget && (e.key === "Enter" || e.key === " ")) {
1073
+ e.preventDefault();
1074
+ setOpen(true);
1075
+ }
1076
+ },
1077
+ className: "flex min-h-8 w-full min-w-0 cursor-pointer items-center rounded-md border border-input bg-transparent px-2 py-1 text-left text-sm outline-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring",
1078
+ "data-testid": testId,
1079
+ children: display ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: emptyLabel })
1080
+ }
1081
+ ) }),
1082
+ /* @__PURE__ */ jsxRuntime.jsx(
1083
+ ui.PopoverContent,
1084
+ {
1085
+ align: "start",
1086
+ className: "w-auto border-0 bg-transparent p-0 shadow-none",
1087
+ onEscapeKeyDown: () => {
1088
+ cancelled.current = true;
1089
+ },
1090
+ children: renderEditor({
1091
+ onValueChange: (value) => {
1092
+ pending.current = { value };
1093
+ },
1094
+ stopEditing: () => close()
1095
+ })
1096
+ }
1097
+ )
1098
+ ]
1099
+ }
1100
+ );
1101
+ }
1102
+ function DatabaseRowDetail({
1103
+ row,
1104
+ columns,
1105
+ onChange,
1106
+ sources,
1107
+ onDelete,
1108
+ onClose,
1109
+ readOnly = false,
1110
+ locale,
1111
+ labels,
1112
+ className,
1113
+ testId = "database-row-detail"
1114
+ }) {
1115
+ const l = { ...DEFAULT_DATABASE_ROW_DETAIL_LABELS, ...labels };
1116
+ const title = row ? rowTitle(row, columns, locale) || l.untitled : "";
1117
+ const commit = (column, value) => {
1118
+ if (!row || !onChange) return;
1119
+ const next = toApiValue(value, column.type);
1120
+ if (sameCellValue(next, row.values[column.id])) return;
1121
+ onChange(row, column.id, next);
1122
+ };
1123
+ const fieldEditor = (column) => {
1124
+ if (!row) return null;
1125
+ const value = row.values[column.id];
1126
+ const id = `${testId}-input-${column.id}`;
1127
+ const editable = !readOnly && Boolean(onChange) && canEditColumn(column, sources);
1128
+ const display = () => {
1129
+ switch (column.type) {
1130
+ case "select":
1131
+ return typeof value === "string" && value ? /* @__PURE__ */ jsxRuntime.jsx(SelectChip, { value }) : null;
1132
+ case "person":
1133
+ return cellIds(value).length ? /* @__PURE__ */ jsxRuntime.jsx(PersonCell, { value, titles: row.titles }) : null;
1134
+ case "document":
1135
+ case "relation":
1136
+ return cellIds(value).length ? /* @__PURE__ */ jsxRuntime.jsx(
1137
+ LinkChipsCell,
1138
+ {
1139
+ value,
1140
+ titles: row.titles,
1141
+ kind: column.type,
1142
+ onOpenDocument: sources?.onOpenDocument,
1143
+ wrap: true
1144
+ }
1145
+ ) : null;
1146
+ case "lookup":
1147
+ return /* @__PURE__ */ jsxRuntime.jsx(LookupCell, { value, titles: row.titles, locale, wrap: true });
1148
+ default: {
1149
+ const text = formatCell(value, column.type, locale, row.titles);
1150
+ return text ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "break-words", children: text }) : null;
1151
+ }
1152
+ }
1153
+ };
1154
+ if (!editable) {
1155
+ const shown = display();
1156
+ return /* @__PURE__ */ jsxRuntime.jsx(
1157
+ "div",
1158
+ {
1159
+ className: ui.cn(
1160
+ "flex min-h-8 min-w-0 items-center py-1 text-sm",
1161
+ isComputedColumn(column) && "text-muted-foreground"
1162
+ ),
1163
+ title: isComputedColumn(column) ? l.computed : void 0,
1164
+ "data-testid": id,
1165
+ children: shown ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2014" })
1166
+ }
1167
+ );
1168
+ }
1169
+ switch (column.type) {
1170
+ case "checkbox":
1171
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-8 items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
1172
+ ui.Checkbox,
1173
+ {
1174
+ checked: value === true,
1175
+ "aria-label": column.name,
1176
+ onCheckedChange: (checked) => commit(column, checked === true),
1177
+ "data-testid": id
1178
+ }
1179
+ ) });
1180
+ case "number":
1181
+ case "date":
1182
+ case "text": {
1183
+ const text = value == null ? "" : column.type === "date" ? String(value).slice(0, 10) : String(value);
1184
+ return /* @__PURE__ */ jsxRuntime.jsx(
1185
+ DraftInput,
1186
+ {
1187
+ value: text,
1188
+ type: column.type,
1189
+ label: column.name,
1190
+ onCommit: (next) => commit(column, next),
1191
+ testId: id
1192
+ }
1193
+ );
1194
+ }
1195
+ case "select":
1196
+ return /* @__PURE__ */ jsxRuntime.jsx(
1197
+ PopoverField,
1198
+ {
1199
+ display: display(),
1200
+ emptyLabel: l.empty,
1201
+ label: column.name,
1202
+ testId: id,
1203
+ onCommit: (next) => commit(column, next),
1204
+ renderEditor: (editor) => /* @__PURE__ */ jsxRuntime.jsx(SelectCellEditor, { ...editor, value, options: column.options ?? [] })
1205
+ }
1206
+ );
1207
+ case "person":
1208
+ case "document":
1209
+ case "relation": {
1210
+ const target = column.relation?.database_id;
1211
+ const searchRows = sources?.searchRows;
1212
+ return /* @__PURE__ */ jsxRuntime.jsx(
1213
+ PopoverField,
1214
+ {
1215
+ display: display(),
1216
+ emptyLabel: l.empty,
1217
+ label: column.name,
1218
+ testId: id,
1219
+ onCommit: (next) => commit(column, next),
1220
+ renderEditor: (editor) => /* @__PURE__ */ jsxRuntime.jsx(
1221
+ PickCellEditor,
1222
+ {
1223
+ ...editor,
1224
+ value,
1225
+ data: row,
1226
+ kind: column.type,
1227
+ options: column.type === "person" ? sources?.members : column.type === "document" ? sources?.documents : void 0,
1228
+ search: column.type === "relation" && target && searchRows ? (q) => searchRows(target, q) : void 0
1229
+ }
1230
+ )
1231
+ }
1232
+ );
1233
+ }
1234
+ default:
1235
+ return null;
1236
+ }
1237
+ };
1238
+ const documents = /* @__PURE__ */ new Map();
1239
+ if (row) {
1240
+ for (const column of columns) {
1241
+ if (column.type !== "document") continue;
1242
+ for (const id of cellIds(row.values[column.id])) {
1243
+ documents.set(id, [...documents.get(id) ?? [], column.name]);
1244
+ }
1245
+ }
1246
+ }
1247
+ const openDocument = sources?.onOpenDocument;
1248
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1249
+ chunkD54JXTPG_cjs.DetailPanel,
1250
+ {
1251
+ title,
1252
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Rows3, { className: "size-4" }),
1253
+ isLoading: !row,
1254
+ onClose,
1255
+ labels: { close: l.close },
1256
+ className,
1257
+ testId,
1258
+ actions: row && onDelete && !readOnly ? /* @__PURE__ */ jsxRuntime.jsx(
1259
+ ui.Button,
1260
+ {
1261
+ variant: "ghost",
1262
+ size: "icon",
1263
+ className: "size-8 text-red-text",
1264
+ onClick: () => onDelete(row),
1265
+ "aria-label": l.deleteRow,
1266
+ title: l.deleteRow,
1267
+ "data-testid": `${testId}-delete`,
1268
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-4" })
1269
+ }
1270
+ ) : void 0,
1271
+ children: [
1272
+ /* @__PURE__ */ jsxRuntime.jsx(chunkD54JXTPG_cjs.DetailSection, { title: l.fields, testId: `${testId}-fields`, children: /* @__PURE__ */ jsxRuntime.jsx(chunkD54JXTPG_cjs.DetailFields, { children: columns.map((column) => {
1273
+ const Icon = COLUMN_TYPE_ICONS[column.type];
1274
+ return /* @__PURE__ */ jsxRuntime.jsx(
1275
+ chunkD54JXTPG_cjs.DetailField,
1276
+ {
1277
+ label: column.name,
1278
+ icon: Icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-3.5" }) : void 0,
1279
+ testId: `${testId}-field-${column.id}`,
1280
+ children: fieldEditor(column)
1281
+ },
1282
+ column.id
1283
+ );
1284
+ }) }) }),
1285
+ columns.some((c) => c.type === "document") && /* @__PURE__ */ jsxRuntime.jsx(chunkD54JXTPG_cjs.DetailSection, { title: l.documents, count: documents.size, testId: `${testId}-documents`, children: documents.size ? /* @__PURE__ */ jsxRuntime.jsx(chunkD54JXTPG_cjs.DetailLinkList, { children: [...documents].map(([id, via]) => /* @__PURE__ */ jsxRuntime.jsx(
1286
+ chunkD54JXTPG_cjs.DetailLinkItem,
1287
+ {
1288
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "size-4" }),
1289
+ onClick: openDocument ? () => openDocument(id) : void 0,
1290
+ testId: `${testId}-doc-${id}`,
1291
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
1292
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate font-medium", children: titleOf(id, row?.titles) }),
1293
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-muted-foreground", children: via.join(", ") })
1294
+ ] })
1295
+ },
1296
+ id
1297
+ )) }) : /* @__PURE__ */ jsxRuntime.jsx(chunkD54JXTPG_cjs.DetailEmpty, { children: l.noDocuments }) })
1298
+ ]
1299
+ }
1300
+ );
1301
+ }
941
1302
  var escapeHtml = (text) => text.replace(/[&<>"']/g, (ch) => `&#${ch.charCodeAt(0)};`);
942
1303
  var DEFAULT_DATABASE_TABLE_LABELS = {
943
1304
  newRow: "New row",
@@ -954,6 +1315,7 @@ function DatabaseTable({
954
1315
  onAddRow,
955
1316
  onAddColumn,
956
1317
  onEditColumn,
1318
+ onOpenRow,
957
1319
  sources,
958
1320
  onSelectionChange,
959
1321
  selected,
@@ -974,11 +1336,12 @@ function DatabaseTable({
974
1336
  readOnly,
975
1337
  onEditColumn,
976
1338
  onAddColumn,
1339
+ onOpenRow,
977
1340
  sources,
978
1341
  locale,
979
1342
  labels: columnLabels
980
1343
  }),
981
- [columns, readOnly, onEditColumn, onAddColumn, sources, locale, columnLabels]
1344
+ [columns, readOnly, onEditColumn, onAddColumn, onOpenRow, sources, locale, columnLabels]
982
1345
  );
983
1346
  const noColumns = columns.length === 0;
984
1347
  const emptyState = {
@@ -1094,6 +1457,7 @@ function DatabaseToolbar({
1094
1457
  onExport,
1095
1458
  onDeleteDatabase,
1096
1459
  readOnly = false,
1460
+ views,
1097
1461
  labels
1098
1462
  }) {
1099
1463
  const l = { ...DEFAULT_DATABASE_TOOLBAR_LABELS, ...labels };
@@ -1184,6 +1548,7 @@ function DatabaseToolbar({
1184
1548
  )
1185
1549
  ] }),
1186
1550
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1" }),
1551
+ views,
1187
1552
  !readOnly && selectedCount > 0 && onDeleteSelected && /* @__PURE__ */ jsxRuntime.jsxs(
1188
1553
  ui.Button,
1189
1554
  {
@@ -1776,12 +2141,14 @@ exports.DEFAULT_DATABASE_COLUMN_DIALOG_LABELS = DEFAULT_DATABASE_COLUMN_DIALOG_L
1776
2141
  exports.DEFAULT_DATABASE_COLUMN_LABELS = DEFAULT_DATABASE_COLUMN_LABELS;
1777
2142
  exports.DEFAULT_DATABASE_COLUMN_TYPE_LABELS = DEFAULT_DATABASE_COLUMN_TYPE_LABELS;
1778
2143
  exports.DEFAULT_DATABASE_LIST_LABELS = DEFAULT_DATABASE_LIST_LABELS;
2144
+ exports.DEFAULT_DATABASE_ROW_DETAIL_LABELS = DEFAULT_DATABASE_ROW_DETAIL_LABELS;
1779
2145
  exports.DEFAULT_DATABASE_TABLE_LABELS = DEFAULT_DATABASE_TABLE_LABELS;
1780
2146
  exports.DEFAULT_DATABASE_TOOLBAR_LABELS = DEFAULT_DATABASE_TOOLBAR_LABELS;
1781
2147
  exports.DEFAULT_NEW_DATABASE_DIALOG_LABELS = DEFAULT_NEW_DATABASE_DIALOG_LABELS;
1782
2148
  exports.DEFAULT_PICK_CELL_EDITOR_LABELS = DEFAULT_PICK_CELL_EDITOR_LABELS;
1783
2149
  exports.DatabaseColumnDialog = DatabaseColumnDialog;
1784
2150
  exports.DatabaseList = DatabaseList;
2151
+ exports.DatabaseRowDetail = DatabaseRowDetail;
1785
2152
  exports.DatabaseTable = DatabaseTable;
1786
2153
  exports.DatabaseToolbar = DatabaseToolbar;
1787
2154
  exports.LINK_COLUMN_TYPES = LINK_COLUMN_TYPES;
@@ -1789,11 +2156,13 @@ exports.LinkChip = LinkChip;
1789
2156
  exports.LinkChipsCell = LinkChipsCell;
1790
2157
  exports.LookupCell = LookupCell;
1791
2158
  exports.NewDatabaseDialog = NewDatabaseDialog;
2159
+ exports.OPEN_ROW_COL_ID = OPEN_ROW_COL_ID;
1792
2160
  exports.PersonCell = PersonCell;
1793
2161
  exports.PersonChip = PersonChip;
1794
2162
  exports.PickCellEditor = PickCellEditor;
1795
2163
  exports.SelectCellEditor = SelectCellEditor;
1796
2164
  exports.SelectChip = SelectChip;
2165
+ exports.canEditColumn = canEditColumn;
1797
2166
  exports.cellIds = cellIds;
1798
2167
  exports.cellList = cellList;
1799
2168
  exports.columnWidth = columnWidth;
@@ -1805,6 +2174,7 @@ exports.formatLookupValue = formatLookupValue;
1805
2174
  exports.formatNumberValue = formatNumberValue;
1806
2175
  exports.isComputedColumn = isComputedColumn;
1807
2176
  exports.optionTone = optionTone;
2177
+ exports.rowTitle = rowTitle;
1808
2178
  exports.sameCellValue = sameCellValue;
1809
2179
  exports.titleOf = titleOf;
1810
2180
  exports.toApiValue = toApiValue;