@ai-matrx/design-system 0.21.14 → 0.22.0

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 (37) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/data-table/copy-helpers.d.cts +2 -1
  3. package/dist/data-table/copy-helpers.d.ts +2 -1
  4. package/dist/data-table/filter-engine.d.cts +2 -1
  5. package/dist/data-table/filter-engine.d.ts +2 -1
  6. package/dist/data-table/host.d.cts +2 -1
  7. package/dist/data-table/host.d.ts +2 -1
  8. package/dist/data-table/index.cjs +1525 -398
  9. package/dist/data-table/index.cjs.map +1 -1
  10. package/dist/data-table/index.d.cts +91 -3
  11. package/dist/data-table/index.d.ts +91 -3
  12. package/dist/data-table/index.js +1526 -395
  13. package/dist/data-table/index.js.map +1 -1
  14. package/dist/data-table/infer-filter.d.cts +2 -1
  15. package/dist/data-table/infer-filter.d.ts +2 -1
  16. package/dist/data-table/layered-filters.d.cts +2 -1
  17. package/dist/data-table/layered-filters.d.ts +2 -1
  18. package/dist/data-table/query-control.d.cts +2 -1
  19. package/dist/data-table/query-control.d.ts +2 -1
  20. package/dist/data-table/types.cjs.map +1 -1
  21. package/dist/data-table/types.d.cts +2 -1
  22. package/dist/data-table/types.d.ts +2 -1
  23. package/dist/data-table/url-state.d.cts +2 -1
  24. package/dist/data-table/url-state.d.ts +2 -1
  25. package/dist/data-table/xlsx.d.cts +2 -1
  26. package/dist/data-table/xlsx.d.ts +2 -1
  27. package/dist/field-formats/index.cjs +741 -0
  28. package/dist/field-formats/index.cjs.map +1 -0
  29. package/dist/field-formats/index.d.cts +45 -0
  30. package/dist/field-formats/index.d.ts +45 -0
  31. package/dist/field-formats/index.js +723 -0
  32. package/dist/field-formats/index.js.map +1 -0
  33. package/dist/types-BdbvlF9-.d.cts +204 -0
  34. package/dist/types-BdbvlF9-.d.ts +204 -0
  35. package/dist/{types-emLxze_m.d.ts → types-D-flTpK0.d.ts} +230 -1
  36. package/dist/{types-BgqIKbhq.d.cts → types-Sn249eoy.d.cts} +230 -1
  37. package/package.json +11 -1
@@ -31,32 +31,61 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/data-table/index.ts
32
32
  var data_table_exports = {};
33
33
  __export(data_table_exports, {
34
+ BOOLEAN_TRUE_COLOR: () => BOOLEAN_TRUE_COLOR,
35
+ CELL_TINT_CLASS: () => CELL_TINT_CLASS,
36
+ COLOR_RULE_OPS: () => COLOR_RULE_OPS,
37
+ COLOR_RULE_OP_LABELS: () => COLOR_RULE_OP_LABELS,
34
38
  DataRowInspector: () => DataRowInspector,
35
39
  DataRowWindow: () => DataRowWindow,
40
+ EMPTY_TABLE_STYLE: () => EMPTY_TABLE_STYLE,
41
+ FORMAT_MISMATCH_CLASS: () => FORMAT_MISMATCH_CLASS,
42
+ FormattedCell: () => FormattedCell,
36
43
  GenericTablePagination: () => GenericTablePagination,
37
44
  MatrxDataTable: () => MatrxDataTable,
38
45
  MatrxDataTableProvider: () => MatrxDataTableProvider,
39
46
  MatrxTableRowAlchemyProvider: () => MatrxTableRowAlchemyProvider,
40
47
  MatrxUuidCell: () => MatrxUuidCell,
48
+ NO_FROZEN_COLUMNS: () => NO_FROZEN_COLUMNS,
49
+ OPS_WITH_VALUE: () => OPS_WITH_VALUE,
50
+ ROW_TINT_CLASS: () => ROW_TINT_CLASS,
51
+ STYLE_COLORS: () => STYLE_COLORS,
52
+ STYLE_COLOR_LABELS: () => STYLE_COLOR_LABELS,
53
+ SWATCH_CLASS: () => SWATCH_CLASS,
41
54
  SavedViewsControl: () => SavedViewsControl,
55
+ TABLE_STYLE_METADATA_KEY: () => TABLE_STYLE_METADATA_KEY,
56
+ TABLE_STYLE_VERSION: () => TABLE_STYLE_VERSION,
42
57
  TableTitleRow: () => TableTitleRow,
43
58
  TableViewTabs: () => TableViewTabs,
59
+ alignForFormat: () => alignForFormat,
60
+ applyStylePath: () => applyStylePath,
44
61
  buildRowAgentInput: () => buildRowAgentInput,
45
62
  buildViewAgentInput: () => buildViewAgentInput,
46
63
  buildViewHuman: () => buildViewHuman,
47
64
  collectSelectOptions: () => collectSelectOptions,
65
+ colorForChoice: () => colorForChoice,
48
66
  downloadTableAsXlsx: () => downloadTableAsXlsx,
67
+ evaluateRule: () => evaluateRule,
49
68
  filterKindLabel: () => filterKindLabel,
69
+ formatColumnValue: () => formatColumnValue,
50
70
  inferTableSearchRole: () => inferTableSearchRole,
71
+ isStyleColor: () => isStyleColor,
72
+ parseTableStyle: () => parseTableStyle,
51
73
  parseTableViewSnapshot: () => parseTableViewSnapshot,
74
+ pixelWidth: () => pixelWidth,
52
75
  rankTableSearchRows: () => rankTableSearchRows,
76
+ resolveCellColor: () => resolveCellColor,
53
77
  resolveColumnMarker: () => resolveColumnMarker,
54
78
  resolveFilterKind: () => resolveFilterKind,
79
+ resolveFrozenColumns: () => resolveFrozenColumns,
80
+ resolveRowColor: () => resolveRowColor,
55
81
  resolveTableSearchScopes: () => resolveTableSearchScopes,
56
82
  rowsToCsvFromColumns: () => rowsToCsvFromColumns,
57
83
  rowsToMarkdownTable: () => rowsToMarkdownTable,
58
84
  rowsToRecordsFromColumns: () => rowsToRecordsFromColumns,
59
85
  shortUuid: () => shortUuid,
86
+ stylePath: () => stylePath,
87
+ tableStyleFromMetadata: () => tableStyleFromMetadata,
88
+ tableStyleIsEmpty: () => tableStyleIsEmpty,
60
89
  tableUrlParamPrefix: () => tableUrlParamPrefix,
61
90
  useMatrxDataTableHost: () => useMatrxDataTableHost,
62
91
  useMatrxTableRowAlchemy: () => useMatrxTableRowAlchemy,
@@ -284,7 +313,7 @@ function useColumnReorderAnimation(tableRef, order, dragging) {
284
313
  }
285
314
 
286
315
  // src/data-table/MatrxDataTable.tsx
287
- var import_format3 = require("@ai-matrx/kit/format");
316
+ var import_format5 = require("@ai-matrx/kit/format");
288
317
 
289
318
  // src/checkbox.tsx
290
319
  var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
@@ -7017,6 +7046,295 @@ function ColumnManagerDragHandle({ id, label }) {
7017
7046
 
7018
7047
  // src/data-table/saved-view-snapshot.ts
7019
7048
  var import_zod2 = require("zod");
7049
+
7050
+ // src/data-table/table-style.ts
7051
+ var TABLE_STYLE_VERSION = 1;
7052
+ var STYLE_COLORS = [
7053
+ "slate",
7054
+ "green",
7055
+ "amber",
7056
+ "red",
7057
+ "blue",
7058
+ "violet",
7059
+ "teal"
7060
+ ];
7061
+ function isStyleColor(v) {
7062
+ return typeof v === "string" && STYLE_COLORS.includes(v);
7063
+ }
7064
+ var COLOR_RULE_OPS = [
7065
+ "is",
7066
+ "is_not",
7067
+ "contains",
7068
+ "is_empty",
7069
+ "not_empty",
7070
+ "is_true",
7071
+ "is_false",
7072
+ "gt",
7073
+ "gte",
7074
+ "lt",
7075
+ "lte"
7076
+ ];
7077
+ var OPS_WITH_VALUE = [
7078
+ "is",
7079
+ "is_not",
7080
+ "contains",
7081
+ "gt",
7082
+ "gte",
7083
+ "lt",
7084
+ "lte"
7085
+ ];
7086
+ var COLOR_RULE_OP_LABELS = {
7087
+ is: "is",
7088
+ is_not: "is not",
7089
+ contains: "contains",
7090
+ is_empty: "is empty",
7091
+ not_empty: "is not empty",
7092
+ is_true: "is checked",
7093
+ is_false: "is unchecked",
7094
+ gt: "is greater than",
7095
+ gte: "is at least",
7096
+ lt: "is less than",
7097
+ lte: "is at most"
7098
+ };
7099
+ var EMPTY_TABLE_STYLE = { version: TABLE_STYLE_VERSION };
7100
+ var TABLE_STYLE_METADATA_KEY = "style";
7101
+ function tableStyleIsEmpty(style) {
7102
+ return !style.colorBy && (style.rules?.length ?? 0) === 0 && Object.keys(style.rows ?? {}).length === 0 && Object.keys(style.cells ?? {}).length === 0 && Object.keys(style.columns ?? {}).length === 0;
7103
+ }
7104
+ function isRecord(v) {
7105
+ return typeof v === "object" && v !== null && !Array.isArray(v);
7106
+ }
7107
+ function parseColorMap(raw) {
7108
+ const out = {};
7109
+ if (!isRecord(raw)) return out;
7110
+ for (const [k, v] of Object.entries(raw)) if (isStyleColor(v)) out[k] = v;
7111
+ return out;
7112
+ }
7113
+ function parseRule(raw) {
7114
+ if (!isRecord(raw)) return null;
7115
+ const { id, field, op, value, color, target } = raw;
7116
+ if (typeof id !== "string" || typeof field !== "string") return null;
7117
+ if (typeof op !== "string" || !COLOR_RULE_OPS.includes(op)) return null;
7118
+ if (!isStyleColor(color)) return null;
7119
+ if (target !== "row" && target !== "cell") return null;
7120
+ return {
7121
+ id,
7122
+ field,
7123
+ op,
7124
+ color,
7125
+ target,
7126
+ ...typeof value === "string" || typeof value === "number" ? { value: String(value) } : {}
7127
+ };
7128
+ }
7129
+ function parseTableStyle(raw) {
7130
+ if (!isRecord(raw)) return { ...EMPTY_TABLE_STYLE };
7131
+ const style = { version: TABLE_STYLE_VERSION };
7132
+ const colorBy = raw.colorBy;
7133
+ if (isRecord(colorBy) && typeof colorBy.field === "string" && (colorBy.target === "row" || colorBy.target === "cell")) {
7134
+ style.colorBy = { field: colorBy.field, target: colorBy.target };
7135
+ }
7136
+ if (Array.isArray(raw.rules)) {
7137
+ const rules = raw.rules.map(parseRule).filter((r) => r !== null);
7138
+ if (rules.length > 0) style.rules = rules;
7139
+ }
7140
+ const rows = parseColorMap(raw.rows);
7141
+ if (Object.keys(rows).length > 0) style.rows = rows;
7142
+ const columns = parseColorMap(raw.columns);
7143
+ if (Object.keys(columns).length > 0) style.columns = columns;
7144
+ if (isRecord(raw.cells)) {
7145
+ const cells = {};
7146
+ for (const [rowId, byField] of Object.entries(raw.cells)) {
7147
+ const parsed = parseColorMap(byField);
7148
+ if (Object.keys(parsed).length > 0) cells[rowId] = parsed;
7149
+ }
7150
+ if (Object.keys(cells).length > 0) style.cells = cells;
7151
+ }
7152
+ return style;
7153
+ }
7154
+ function tableStyleFromMetadata(metadata) {
7155
+ return parseTableStyle(isRecord(metadata) ? metadata[TABLE_STYLE_METADATA_KEY] : null);
7156
+ }
7157
+ function cellText(value) {
7158
+ if (value === null || value === void 0) return "";
7159
+ if (Array.isArray(value)) return value.map((v) => String(v)).join(", ");
7160
+ if (typeof value === "object") return JSON.stringify(value);
7161
+ return String(value);
7162
+ }
7163
+ function isEmptyValue(value) {
7164
+ if (value === null || value === void 0) return true;
7165
+ if (typeof value === "string") return value.trim() === "";
7166
+ if (Array.isArray(value)) return value.length === 0;
7167
+ return false;
7168
+ }
7169
+ function evaluateRule(rule, value) {
7170
+ switch (rule.op) {
7171
+ case "is_empty":
7172
+ return isEmptyValue(value);
7173
+ case "not_empty":
7174
+ return !isEmptyValue(value);
7175
+ case "is_true":
7176
+ return value === true;
7177
+ case "is_false":
7178
+ return value === false;
7179
+ case "is": {
7180
+ const want = (rule.value ?? "").trim().toLowerCase();
7181
+ if (Array.isArray(value)) {
7182
+ return value.some((v) => cellText(v).trim().toLowerCase() === want);
7183
+ }
7184
+ return cellText(value).trim().toLowerCase() === want;
7185
+ }
7186
+ case "is_not": {
7187
+ const want = (rule.value ?? "").trim().toLowerCase();
7188
+ if (Array.isArray(value)) {
7189
+ return !value.some((v) => cellText(v).trim().toLowerCase() === want);
7190
+ }
7191
+ return cellText(value).trim().toLowerCase() !== want;
7192
+ }
7193
+ case "contains": {
7194
+ const want = (rule.value ?? "").trim().toLowerCase();
7195
+ if (!want) return false;
7196
+ return cellText(value).toLowerCase().includes(want);
7197
+ }
7198
+ case "gt":
7199
+ case "gte":
7200
+ case "lt":
7201
+ case "lte": {
7202
+ const left = typeof value === "number" ? value : Number(cellText(value));
7203
+ const right = Number(rule.value);
7204
+ if (!Number.isFinite(left) || !Number.isFinite(right)) return false;
7205
+ if (rule.op === "gt") return left > right;
7206
+ if (rule.op === "gte") return left >= right;
7207
+ if (rule.op === "lt") return left < right;
7208
+ return left <= right;
7209
+ }
7210
+ }
7211
+ }
7212
+ function colorForChoice(choices, value) {
7213
+ if (!choices || choices.length === 0) return void 0;
7214
+ const wanted = String(value);
7215
+ const index = choices.findIndex((c) => c.value === wanted);
7216
+ if (index === -1) return void 0;
7217
+ const declared = choices[index]?.color;
7218
+ if (isStyleColor(declared)) return declared;
7219
+ return STYLE_COLORS[index % STYLE_COLORS.length];
7220
+ }
7221
+ var BOOLEAN_TRUE_COLOR = "green";
7222
+ function colorByFor(style, target, data, choiceColorFor) {
7223
+ const cb = style.colorBy;
7224
+ if (!cb || cb.target !== target) return null;
7225
+ const value = data[cb.field];
7226
+ if (value === true) return BOOLEAN_TRUE_COLOR;
7227
+ if (value === false || isEmptyValue(value)) return null;
7228
+ const first = Array.isArray(value) ? value[0] : value;
7229
+ return choiceColorFor(cb.field, first) ?? null;
7230
+ }
7231
+ function ruleColorFor(style, target, data, fieldName) {
7232
+ for (const rule of style.rules ?? []) {
7233
+ if (rule.target !== target) continue;
7234
+ if (target === "cell" && rule.field !== fieldName) continue;
7235
+ if (evaluateRule(rule, data[rule.field])) return rule.color;
7236
+ }
7237
+ return null;
7238
+ }
7239
+ function resolveRowColor(style, row, choiceColorFor) {
7240
+ return style.rows?.[row.id] ?? ruleColorFor(style, "row", row.data) ?? colorByFor(style, "row", row.data, choiceColorFor);
7241
+ }
7242
+ function resolveCellColor(style, row, fieldName, choiceColorFor) {
7243
+ const manual = style.cells?.[row.id]?.[fieldName];
7244
+ if (manual) return manual;
7245
+ const rule = ruleColorFor(style, "cell", row.data, fieldName);
7246
+ if (rule) return rule;
7247
+ if (style.colorBy?.target === "cell" && style.colorBy.field === fieldName) {
7248
+ const cb = colorByFor(style, "cell", row.data, choiceColorFor);
7249
+ if (cb) return cb;
7250
+ }
7251
+ return style.columns?.[fieldName] ?? null;
7252
+ }
7253
+ var ROW_TINT_CLASS = {
7254
+ slate: "bg-slate-100/70 dark:bg-slate-800/40",
7255
+ green: "bg-green-50 dark:bg-green-950/40",
7256
+ amber: "bg-amber-50 dark:bg-amber-950/40",
7257
+ red: "bg-red-50 dark:bg-red-950/40",
7258
+ blue: "bg-blue-50 dark:bg-blue-950/40",
7259
+ violet: "bg-violet-50 dark:bg-violet-950/40",
7260
+ teal: "bg-teal-50 dark:bg-teal-950/40"
7261
+ };
7262
+ var CELL_TINT_CLASS = {
7263
+ slate: "bg-slate-200/70 dark:bg-slate-700/50",
7264
+ green: "bg-green-100 dark:bg-green-900/50",
7265
+ amber: "bg-amber-100 dark:bg-amber-900/50",
7266
+ red: "bg-red-100 dark:bg-red-900/50",
7267
+ blue: "bg-blue-100 dark:bg-blue-900/50",
7268
+ violet: "bg-violet-100 dark:bg-violet-900/50",
7269
+ teal: "bg-teal-100 dark:bg-teal-900/50"
7270
+ };
7271
+ var SWATCH_CLASS = {
7272
+ slate: "bg-slate-400",
7273
+ green: "bg-green-500",
7274
+ amber: "bg-amber-400",
7275
+ red: "bg-red-500",
7276
+ blue: "bg-blue-500",
7277
+ violet: "bg-violet-500",
7278
+ teal: "bg-teal-500"
7279
+ };
7280
+ var STYLE_COLOR_LABELS = {
7281
+ slate: "Gray",
7282
+ green: "Green",
7283
+ amber: "Amber",
7284
+ red: "Red",
7285
+ blue: "Blue",
7286
+ violet: "Violet",
7287
+ teal: "Teal"
7288
+ };
7289
+ var stylePath = {
7290
+ colorBy: () => ["colorBy"],
7291
+ rules: () => ["rules"],
7292
+ row: (rowId) => ["rows", rowId],
7293
+ cell: (rowId, fieldName) => ["cells", rowId, fieldName],
7294
+ column: (fieldName) => ["columns", fieldName]
7295
+ };
7296
+ function applyStylePath(style, path2, value) {
7297
+ const next = { ...style };
7298
+ const [head, a, b] = path2;
7299
+ switch (head) {
7300
+ case "colorBy":
7301
+ next.colorBy = value === null ? null : parseTableStyle({ colorBy: value }).colorBy ?? null;
7302
+ break;
7303
+ case "rules":
7304
+ next.rules = value === null ? [] : parseTableStyle({ rules: value }).rules ?? [];
7305
+ break;
7306
+ case "rows": {
7307
+ const rows = { ...style.rows ?? {} };
7308
+ if (a === void 0) break;
7309
+ if (isStyleColor(value)) rows[a] = value;
7310
+ else delete rows[a];
7311
+ next.rows = rows;
7312
+ break;
7313
+ }
7314
+ case "columns": {
7315
+ const columns = { ...style.columns ?? {} };
7316
+ if (a === void 0) break;
7317
+ if (isStyleColor(value)) columns[a] = value;
7318
+ else delete columns[a];
7319
+ next.columns = columns;
7320
+ break;
7321
+ }
7322
+ case "cells": {
7323
+ if (a === void 0 || b === void 0) break;
7324
+ const cells = { ...style.cells ?? {} };
7325
+ const byField = { ...cells[a] ?? {} };
7326
+ if (isStyleColor(value)) byField[b] = value;
7327
+ else delete byField[b];
7328
+ if (Object.keys(byField).length === 0) delete cells[a];
7329
+ else cells[a] = byField;
7330
+ next.cells = cells;
7331
+ break;
7332
+ }
7333
+ }
7334
+ return next;
7335
+ }
7336
+
7337
+ // src/data-table/saved-view-snapshot.ts
7020
7338
  var filterSchema = import_zod2.z.union([
7021
7339
  import_zod2.z.object({ kind: import_zod2.z.literal("text"), value: import_zod2.z.string(), mode: import_zod2.z.enum(["contains", "empty", "not_empty", "null", "not_null"]).optional(), negated: import_zod2.z.boolean().optional() }),
7022
7340
  import_zod2.z.object({ kind: import_zod2.z.literal("select"), value: import_zod2.z.string(), values: import_zod2.z.array(import_zod2.z.string()).optional(), negated: import_zod2.z.boolean().optional() }),
@@ -7034,7 +7352,13 @@ var snapshotSchema = import_zod2.z.object({
7034
7352
  }),
7035
7353
  hidden: import_zod2.z.array(import_zod2.z.string().min(1)),
7036
7354
  widths: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.number().finite().positive()).optional()
7037
- })
7355
+ }),
7356
+ // The style is read by `parseTableStyle`, not described again here. That
7357
+ // reader is tolerant BY DESIGN — an unknown key, a retired color name or a
7358
+ // malformed rule is dropped, never thrown — and a Zod mirror of it would
7359
+ // reject a whole saved view over one stale rule, which is the opposite of
7360
+ // what a table must do when its colors go out of date.
7361
+ style: import_zod2.z.unknown().optional()
7038
7362
  });
7039
7363
  function normalizeFilters(raw) {
7040
7364
  const filters = {};
@@ -7051,6 +7375,7 @@ function parseTableViewSnapshot(raw) {
7051
7375
  const parsed = snapshotSchema.safeParse(raw);
7052
7376
  if (!parsed.success) return null;
7053
7377
  const { query, columns } = parsed.data;
7378
+ const style = parsed.data.style === void 0 ? null : parseTableStyle(parsed.data.style);
7054
7379
  return {
7055
7380
  __kind: "matrx-table-view",
7056
7381
  version: 1,
@@ -7068,7 +7393,8 @@ function parseTableViewSnapshot(raw) {
7068
7393
  order: columns.order,
7069
7394
  hidden: columns.hidden,
7070
7395
  ...columns.widths === void 0 ? {} : { widths: columns.widths }
7071
- }
7396
+ },
7397
+ ...style === null || tableStyleIsEmpty(style) ? {} : { style }
7072
7398
  };
7073
7399
  }
7074
7400
 
@@ -7527,8 +7853,736 @@ function defaultRowTitle(row, columns) {
7527
7853
  return value ? isUuidValue(value) ? value.slice(0, 8) : value : "Details";
7528
7854
  }
7529
7855
 
7530
- // src/data-table/DirtySavePill.tsx
7856
+ // src/data-table/frozen-columns.ts
7857
+ var NO_FROZEN_COLUMNS = {
7858
+ offsets: {},
7859
+ active: false,
7860
+ selectionOffset: null
7861
+ };
7862
+ function resolveFrozenColumns(ids, isFrozen, widthOf, leadingWidth) {
7863
+ const run = [];
7864
+ for (const id of ids) {
7865
+ if (!isFrozen(id)) break;
7866
+ run.push(id);
7867
+ }
7868
+ if (run.length === 0) return NO_FROZEN_COLUMNS;
7869
+ if (leadingWidth === void 0) return NO_FROZEN_COLUMNS;
7870
+ const base = leadingWidth ?? 0;
7871
+ const offsets = {};
7872
+ let cursor = base;
7873
+ for (let i = 0; i < run.length; i += 1) {
7874
+ const id = run[i];
7875
+ offsets[id] = cursor;
7876
+ if (i === run.length - 1) break;
7877
+ const w = widthOf(id);
7878
+ if (w === void 0 || !Number.isFinite(w) || w <= 0) return NO_FROZEN_COLUMNS;
7879
+ cursor += w;
7880
+ }
7881
+ return {
7882
+ offsets,
7883
+ active: true,
7884
+ selectionOffset: leadingWidth === null ? null : 0
7885
+ };
7886
+ }
7887
+ function pixelWidth(width) {
7888
+ if (typeof width === "number") return Number.isFinite(width) ? width : void 0;
7889
+ if (typeof width === "string") {
7890
+ const m = /^(\d+(?:\.\d+)?)px$/.exec(width.trim());
7891
+ if (m) return Number(m[1]);
7892
+ }
7893
+ return void 0;
7894
+ }
7895
+ var FROZEN_CELL_CLASS = "sm:sticky sm:left-[var(--matrx-frozen-left)] sm:z-20 sm:bg-inherit";
7896
+ var FROZEN_HEADER_CLASS = "sm:sticky sm:left-[var(--matrx-frozen-left)] sm:z-30";
7897
+ var FROZEN_EDGE_CLASS = "sm:shadow-[inset_-1px_0_0_var(--border)]";
7898
+
7899
+ // src/field-formats/registry.ts
7900
+ var import_format3 = require("@ai-matrx/kit/format");
7901
+ function formatSignedDuration(totalSeconds) {
7902
+ return (0, import_format3.formatDurationSeconds)(totalSeconds, { signed: true });
7903
+ }
7904
+ function toNumber(value) {
7905
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
7906
+ if (typeof value === "string") {
7907
+ const cleaned = value.replace(/[,\s$€£¥%]/g, "");
7908
+ if (cleaned === "") return null;
7909
+ const n = Number(cleaned);
7910
+ return Number.isFinite(n) ? n : null;
7911
+ }
7912
+ return null;
7913
+ }
7914
+ function toText(value) {
7915
+ if (typeof value === "string") return value;
7916
+ if (typeof value === "number" || typeof value === "boolean")
7917
+ return String(value);
7918
+ return null;
7919
+ }
7920
+ function toDate(value) {
7921
+ if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;
7922
+ if (typeof value === "number") {
7923
+ const d = new Date(value);
7924
+ return Number.isNaN(d.getTime()) ? null : d;
7925
+ }
7926
+ if (typeof value === "string" && value.trim()) {
7927
+ const d = new Date(value);
7928
+ return Number.isNaN(d.getTime()) ? null : d;
7929
+ }
7930
+ return null;
7931
+ }
7932
+ function toList(value) {
7933
+ if (Array.isArray(value)) return value;
7934
+ if (typeof value === "string") {
7935
+ const trimmed = value.trim();
7936
+ if (trimmed.startsWith("[")) {
7937
+ try {
7938
+ const parsed = JSON.parse(trimmed);
7939
+ if (Array.isArray(parsed)) return parsed;
7940
+ } catch {
7941
+ }
7942
+ }
7943
+ if (trimmed === "") return [];
7944
+ return trimmed.split(",").map((s) => s.trim());
7945
+ }
7946
+ return null;
7947
+ }
7948
+ function groupedNumber(n, options) {
7949
+ return new Intl.NumberFormat(void 0, {
7950
+ useGrouping: options.useGrouping !== false,
7951
+ ...options.precision != null ? {
7952
+ minimumFractionDigits: options.precision,
7953
+ maximumFractionDigits: options.precision
7954
+ } : { maximumFractionDigits: 10 }
7955
+ }).format(n);
7956
+ }
7957
+ function affix(text, options) {
7958
+ return `${options.prefix ?? ""}${text}${options.suffix ?? ""}`;
7959
+ }
7960
+ var DURATION_TO_SECONDS = { milliseconds: 1e-3, seconds: 1, minutes: 60, hours: 3600 };
7961
+ function findChoice(choices, value) {
7962
+ if (!choices || choices.length === 0) return void 0;
7963
+ const exact = choices.find((c) => c.value === value);
7964
+ if (exact) return exact;
7965
+ const lowered = value.toLowerCase();
7966
+ return choices.find((c) => c.value.toLowerCase() === lowered);
7967
+ }
7968
+ var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
7969
+ var URL_RE = /^(?:[a-z][a-z0-9+.-]*:\/\/\S+|(?:[a-z0-9-]+\.)+[a-z]{2,}(?:[:/?#]\S*)?)$/i;
7970
+ var HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
7971
+ var DEFS = [
7972
+ // ── Text ──────────────────────────────────────────────────────────────────
7973
+ {
7974
+ id: "text",
7975
+ label: "Text",
7976
+ description: "Plain single-line text",
7977
+ group: "Text",
7978
+ base: "string",
7979
+ editor: "text",
7980
+ // Deliberately no optionKeys — plain text is the default for every string
7981
+ // column, and giving it prefix/suffix controls puts an options row under
7982
+ // every column in the settings dialog for a setting almost nobody wants.
7983
+ format: (v, o) => {
7984
+ const t = toText(v);
7985
+ return t === null ? null : affix(t, o);
7986
+ },
7987
+ parse: (raw) => raw === "" || raw == null ? null : String(raw)
7988
+ },
7989
+ {
7990
+ id: "long_text",
7991
+ label: "Long text",
7992
+ description: "Multi-line text, edited in a larger box",
7993
+ group: "Text",
7994
+ base: "string",
7995
+ editor: "textarea",
7996
+ format: (v) => toText(v),
7997
+ parse: (raw) => raw === "" || raw == null ? null : String(raw)
7998
+ },
7999
+ {
8000
+ id: "markdown",
8001
+ label: "Markdown",
8002
+ description: "Rich text written as Markdown",
8003
+ group: "Text",
8004
+ base: "string",
8005
+ editor: "textarea",
8006
+ rich: true,
8007
+ format: (v) => toText(v),
8008
+ parse: (raw) => raw === "" || raw == null ? null : String(raw)
8009
+ },
8010
+ {
8011
+ id: "email",
8012
+ label: "Email",
8013
+ description: "Email address \u2014 click to compose",
8014
+ group: "Text",
8015
+ base: "string",
8016
+ editor: "email",
8017
+ rich: true,
8018
+ format: (v) => {
8019
+ const t = toText(v)?.trim();
8020
+ if (!t) return null;
8021
+ return EMAIL_RE.test(t) ? t : null;
8022
+ },
8023
+ parse: (raw) => raw === "" || raw == null ? null : String(raw).trim()
8024
+ },
8025
+ {
8026
+ id: "url",
8027
+ label: "Link",
8028
+ description: "Web address \u2014 click to open",
8029
+ group: "Text",
8030
+ base: "string",
8031
+ editor: "url",
8032
+ rich: true,
8033
+ format: (v) => {
8034
+ const t = toText(v)?.trim();
8035
+ if (!t) return null;
8036
+ if (/\s/.test(t)) return null;
8037
+ if (!URL_RE.test(t)) return null;
8038
+ try {
8039
+ new URL(t.includes("://") ? t : `https://${t}`);
8040
+ return t;
8041
+ } catch {
8042
+ return null;
8043
+ }
8044
+ },
8045
+ parse: (raw) => raw === "" || raw == null ? null : String(raw).trim()
8046
+ },
8047
+ {
8048
+ id: "phone",
8049
+ label: "Phone",
8050
+ description: "Phone number \u2014 click to call",
8051
+ group: "Text",
8052
+ base: "string",
8053
+ editor: "tel",
8054
+ rich: true,
8055
+ format: (v) => {
8056
+ const t = toText(v)?.trim();
8057
+ if (!t) return null;
8058
+ return (t.match(/\d/g) ?? []).length >= 7 ? t : null;
8059
+ },
8060
+ parse: (raw) => raw === "" || raw == null ? null : String(raw).trim()
8061
+ },
8062
+ {
8063
+ id: "color",
8064
+ label: "Color",
8065
+ description: "Hex color with a swatch",
8066
+ group: "Text",
8067
+ base: "string",
8068
+ editor: "color",
8069
+ rich: true,
8070
+ format: (v) => {
8071
+ const t = toText(v)?.trim();
8072
+ if (!t) return null;
8073
+ return HEX_RE.test(t) ? t.toLowerCase() : null;
8074
+ },
8075
+ parse: (raw) => raw === "" || raw == null ? null : String(raw).trim()
8076
+ },
8077
+ // ── Numbers ───────────────────────────────────────────────────────────────
8078
+ {
8079
+ id: "number",
8080
+ label: "Number",
8081
+ description: "Plain number",
8082
+ group: "Numbers",
8083
+ base: "number",
8084
+ alsoAccepts: ["integer"],
8085
+ editor: "number",
8086
+ numericAlign: true,
8087
+ optionKeys: ["useGrouping", "precision", "prefix", "suffix"],
8088
+ format: (v, o) => {
8089
+ const n = toNumber(v);
8090
+ return n === null ? null : affix(groupedNumber(n, o), o);
8091
+ },
8092
+ parse: (raw) => toNumber(raw)
8093
+ },
8094
+ {
8095
+ id: "decimal",
8096
+ label: "Decimal",
8097
+ description: "Number with fixed decimal places",
8098
+ group: "Numbers",
8099
+ base: "number",
8100
+ alsoAccepts: ["integer"],
8101
+ editor: "number",
8102
+ numericAlign: true,
8103
+ optionKeys: ["precision", "useGrouping", "prefix", "suffix"],
8104
+ format: (v, o) => {
8105
+ const n = toNumber(v);
8106
+ if (n === null) return null;
8107
+ return affix(groupedNumber(n, { ...o, precision: o.precision ?? 2 }), o);
8108
+ },
8109
+ parse: (raw) => toNumber(raw)
8110
+ },
8111
+ {
8112
+ id: "currency",
8113
+ label: "Currency",
8114
+ description: "Money \u2014 stored as a plain number, shown with a symbol",
8115
+ group: "Numbers",
8116
+ base: "number",
8117
+ alsoAccepts: ["integer"],
8118
+ editor: "number",
8119
+ numericAlign: true,
8120
+ optionKeys: ["currency", "precision"],
8121
+ format: (v, o) => {
8122
+ const n = toNumber(v);
8123
+ if (n === null) return null;
8124
+ const currency = (o.currency || "USD").toUpperCase();
8125
+ try {
8126
+ return new Intl.NumberFormat(void 0, {
8127
+ style: "currency",
8128
+ currency,
8129
+ ...o.precision != null ? {
8130
+ minimumFractionDigits: o.precision,
8131
+ maximumFractionDigits: o.precision
8132
+ } : {}
8133
+ }).format(n);
8134
+ } catch {
8135
+ return `${groupedNumber(n, { precision: o.precision ?? 2 })} ${currency}`;
8136
+ }
8137
+ },
8138
+ parse: (raw) => toNumber(raw)
8139
+ },
8140
+ {
8141
+ id: "percent",
8142
+ label: "Percent",
8143
+ description: "Percentage \u2014 stored as a plain number",
8144
+ group: "Numbers",
8145
+ base: "number",
8146
+ alsoAccepts: ["integer"],
8147
+ editor: "number",
8148
+ numericAlign: true,
8149
+ optionKeys: ["percentScale", "precision"],
8150
+ format: (v, o) => {
8151
+ const n = toNumber(v);
8152
+ if (n === null) return null;
8153
+ const shown = o.percentScale === "fraction" ? n * 100 : n;
8154
+ return `${groupedNumber(shown, o.precision === void 0 ? {} : { precision: o.precision })}%`;
8155
+ },
8156
+ parse: (raw) => toNumber(raw)
8157
+ },
8158
+ {
8159
+ id: "duration",
8160
+ label: "Duration",
8161
+ description: "Length of time, shown as h:mm:ss",
8162
+ group: "Numbers",
8163
+ base: "number",
8164
+ alsoAccepts: ["integer"],
8165
+ editor: "number",
8166
+ numericAlign: true,
8167
+ optionKeys: ["durationUnit"],
8168
+ format: (v, o) => {
8169
+ const n = toNumber(v);
8170
+ if (n === null) return null;
8171
+ return formatSignedDuration(n * DURATION_TO_SECONDS[o.durationUnit ?? "seconds"]);
8172
+ },
8173
+ parse: (raw) => toNumber(raw)
8174
+ },
8175
+ {
8176
+ id: "integer",
8177
+ label: "Whole number",
8178
+ description: "Integer with no decimal part",
8179
+ group: "Numbers",
8180
+ base: "integer",
8181
+ alsoAccepts: ["number"],
8182
+ editor: "number",
8183
+ numericAlign: true,
8184
+ optionKeys: ["useGrouping", "prefix", "suffix"],
8185
+ format: (v, o) => {
8186
+ const n = toNumber(v);
8187
+ if (n === null) return null;
8188
+ return affix(groupedNumber(Math.trunc(n), { ...o, precision: 0 }), o);
8189
+ },
8190
+ parse: (raw) => {
8191
+ const n = toNumber(raw);
8192
+ return n === null ? null : Math.trunc(n);
8193
+ }
8194
+ },
8195
+ {
8196
+ id: "rating",
8197
+ label: "Rating",
8198
+ description: "Score out of a maximum, shown as stars",
8199
+ group: "Numbers",
8200
+ base: "integer",
8201
+ alsoAccepts: ["number"],
8202
+ editor: "rating",
8203
+ rich: true,
8204
+ optionKeys: ["ratingMax"],
8205
+ format: (v, o) => {
8206
+ const n = toNumber(v);
8207
+ if (n === null) return null;
8208
+ const max = o.ratingMax ?? 5;
8209
+ if (n < 0 || n > max) return null;
8210
+ return `${n} / ${max}`;
8211
+ },
8212
+ parse: (raw) => {
8213
+ const n = toNumber(raw);
8214
+ return n === null ? null : Math.round(n);
8215
+ }
8216
+ },
8217
+ {
8218
+ id: "file_size",
8219
+ label: "File size",
8220
+ description: "Byte count shown as KB / MB / GB",
8221
+ group: "Numbers",
8222
+ base: "integer",
8223
+ alsoAccepts: ["number"],
8224
+ editor: "number",
8225
+ numericAlign: true,
8226
+ format: (v) => {
8227
+ const n = toNumber(v);
8228
+ return n === null ? null : (0, import_format3.formatFileSize)(n);
8229
+ },
8230
+ parse: (raw) => {
8231
+ const n = toNumber(raw);
8232
+ return n === null ? null : Math.trunc(n);
8233
+ }
8234
+ },
8235
+ // ── Choice ────────────────────────────────────────────────────────────────
8236
+ {
8237
+ id: "boolean",
8238
+ label: "Yes / No",
8239
+ description: "True or false",
8240
+ group: "Choice",
8241
+ base: "boolean",
8242
+ editor: "checkbox",
8243
+ format: (v) => {
8244
+ if (typeof v === "boolean") return v ? "Yes" : "No";
8245
+ if (v === "true" || v === 1) return "Yes";
8246
+ if (v === "false" || v === 0) return "No";
8247
+ return null;
8248
+ },
8249
+ parse: (raw) => {
8250
+ if (typeof raw === "boolean") return raw;
8251
+ if (raw == null || raw === "") return null;
8252
+ return String(raw).toLowerCase() === "true" || raw === 1;
8253
+ }
8254
+ },
8255
+ // ── Dates ─────────────────────────────────────────────────────────────────
8256
+ {
8257
+ id: "date",
8258
+ label: "Date",
8259
+ description: "Calendar date",
8260
+ group: "Dates",
8261
+ base: "date",
8262
+ alsoAccepts: ["datetime", "string"],
8263
+ editor: "date",
8264
+ optionKeys: ["dateStyle"],
8265
+ format: (v, o) => {
8266
+ const d = toDate(v);
8267
+ if (!d) return null;
8268
+ return d.toLocaleDateString(void 0, {
8269
+ dateStyle: o.dateStyle ?? "medium"
8270
+ });
8271
+ },
8272
+ parse: (raw) => raw === "" || raw == null ? null : String(raw)
8273
+ },
8274
+ {
8275
+ id: "datetime",
8276
+ label: "Date & time",
8277
+ description: "Calendar date with a time of day",
8278
+ group: "Dates",
8279
+ base: "datetime",
8280
+ alsoAccepts: ["date", "string"],
8281
+ editor: "datetime",
8282
+ optionKeys: ["dateStyle"],
8283
+ format: (v, o) => {
8284
+ const d = toDate(v);
8285
+ if (!d) return null;
8286
+ return d.toLocaleString(void 0, {
8287
+ dateStyle: o.dateStyle ?? "medium",
8288
+ timeStyle: "short"
8289
+ });
8290
+ },
8291
+ parse: (raw) => raw === "" || raw == null ? null : String(raw)
8292
+ },
8293
+ {
8294
+ id: "relative_time",
8295
+ label: "Relative time",
8296
+ description: 'Shown as "3 days ago"',
8297
+ group: "Dates",
8298
+ base: "datetime",
8299
+ alsoAccepts: ["date", "string"],
8300
+ editor: "datetime",
8301
+ format: (v) => {
8302
+ const d = toDate(v);
8303
+ return d ? (0, import_format3.formatRelativeTime)(d, { style: "intl" }) : null;
8304
+ },
8305
+ parse: (raw) => raw === "" || raw == null ? null : String(raw)
8306
+ },
8307
+ // ── Structured ────────────────────────────────────────────────────────────
8308
+ {
8309
+ id: "json",
8310
+ label: "JSON",
8311
+ description: "Structured object",
8312
+ group: "Structured",
8313
+ base: "json",
8314
+ alsoAccepts: ["array"],
8315
+ editor: "json",
8316
+ format: (v) => {
8317
+ if (v === null || v === void 0) return null;
8318
+ if (typeof v === "object") return JSON.stringify(v);
8319
+ return toText(v);
8320
+ },
8321
+ parse: (raw) => {
8322
+ if (raw == null || raw === "") return null;
8323
+ if (typeof raw !== "string") return raw;
8324
+ try {
8325
+ return JSON.parse(raw);
8326
+ } catch {
8327
+ return raw;
8328
+ }
8329
+ }
8330
+ },
8331
+ {
8332
+ id: "array",
8333
+ label: "List",
8334
+ description: "List of values",
8335
+ group: "Structured",
8336
+ base: "array",
8337
+ alsoAccepts: ["json"],
8338
+ editor: "json",
8339
+ format: (v) => {
8340
+ const list = toList(v);
8341
+ return list === null ? null : list.map((i) => String(i)).join(", ");
8342
+ },
8343
+ parse: (raw) => {
8344
+ if (raw == null || raw === "") return null;
8345
+ if (Array.isArray(raw)) return raw;
8346
+ return toList(raw) ?? raw;
8347
+ }
8348
+ },
8349
+ {
8350
+ id: "tags",
8351
+ label: "Tags",
8352
+ description: "List of values shown as chips",
8353
+ group: "Structured",
8354
+ base: "array",
8355
+ alsoAccepts: ["json", "string"],
8356
+ editor: "json",
8357
+ rich: true,
8358
+ format: (v) => {
8359
+ const list = toList(v);
8360
+ return list === null ? null : list.map((i) => String(i)).join(", ");
8361
+ },
8362
+ parse: (raw) => {
8363
+ if (raw == null || raw === "") return null;
8364
+ if (Array.isArray(raw)) return raw;
8365
+ return toList(raw) ?? raw;
8366
+ }
8367
+ },
8368
+ // ─── Choice ────────────────────────────────────────────────────────────────
8369
+ //
8370
+ // An enum WITHOUT a database enum. The column stays `string` (or `array` for
8371
+ // multi), the database enforces nothing, and stripping the format leaves
8372
+ // every stored value exactly as it was. Options are a UI layer — the same
8373
+ // trick `percent` plays on a number.
8374
+ //
8375
+ // The fallback law is the whole reason this is safe to switch on over live
8376
+ // data: a value not in the option list is NOT an error and is NEVER blanked.
8377
+ // `format()` returns null for it, `<FormattedFieldValue>` renders it in amber
8378
+ // with the reason, and the user can fix it or adopt it. Declaring the options
8379
+ // is therefore how you FIND your stray values, not how you lose them.
8380
+ //
8381
+ // Options resolve through `choices.ts` — inline `options.choices`, or a
8382
+ // structured list via `options.structuredList`. This def only ever sees
8383
+ // whatever the caller resolved into `options.choices`, so it stays pure and
8384
+ // synchronous like every other format.
8385
+ {
8386
+ id: "choice",
8387
+ label: "Choice",
8388
+ description: "One value from a list of options",
8389
+ group: "Choice",
8390
+ base: "string",
8391
+ alsoAccepts: ["number", "integer", "boolean"],
8392
+ editor: "select",
8393
+ rich: true,
8394
+ optionKeys: ["choices", "structuredList", "allowOther"],
8395
+ format: (v, options) => {
8396
+ const text = toText(v);
8397
+ if (text === null) return null;
8398
+ const trimmed = text.trim();
8399
+ if (trimmed === "") return "";
8400
+ const match = findChoice(options.choices, trimmed);
8401
+ if (!options.choices || options.choices.length === 0) return trimmed;
8402
+ return match ? match.label ?? match.value : null;
8403
+ },
8404
+ parse: (raw) => {
8405
+ if (raw == null) return null;
8406
+ const text = toText(raw);
8407
+ if (text === null) return raw;
8408
+ const trimmed = text.trim();
8409
+ return trimmed === "" ? null : trimmed;
8410
+ }
8411
+ },
8412
+ {
8413
+ id: "multi_choice",
8414
+ label: "Multi-choice",
8415
+ description: "Any number of values from a list of options",
8416
+ group: "Choice",
8417
+ base: "array",
8418
+ alsoAccepts: ["string", "json"],
8419
+ editor: "multiselect",
8420
+ rich: true,
8421
+ optionKeys: ["choices", "structuredList", "allowOther"],
8422
+ format: (v, options) => {
8423
+ const list = toList(v);
8424
+ if (list === null) return null;
8425
+ if (list.length === 0) return "";
8426
+ const labels = [];
8427
+ let anyOffList = false;
8428
+ for (const entry of list) {
8429
+ const text = toText(entry);
8430
+ if (text === null) {
8431
+ anyOffList = true;
8432
+ continue;
8433
+ }
8434
+ const match = findChoice(options.choices, text.trim());
8435
+ if (match) labels.push(match.label ?? match.value);
8436
+ else {
8437
+ labels.push(text.trim());
8438
+ anyOffList = true;
8439
+ }
8440
+ }
8441
+ const haveOptions = !!options.choices && options.choices.length > 0;
8442
+ if (haveOptions && anyOffList) return null;
8443
+ return labels.join(", ");
8444
+ },
8445
+ parse: (raw) => {
8446
+ if (raw == null || raw === "") return null;
8447
+ if (Array.isArray(raw)) return raw;
8448
+ return toList(raw) ?? raw;
8449
+ }
8450
+ },
8451
+ // ─── Computed ──────────────────────────────────────────────────────────────
8452
+ //
8453
+ // A formula column stores NOTHING. `metadata.format.options.formula` holds
8454
+ // the expression; the stored cell is always null; the value is computed on
8455
+ // read from the other columns of the same row
8456
+ // (`features/data-tables/formulas.ts`). Grouped under Structured on purpose
8457
+ // — the picker's groups are a fixed vocabulary, and a formula is structure
8458
+ // over a plain string column, not a sixth family.
8459
+ //
8460
+ // `format()` here is handed the COMPUTED value, never a stored one, and its
8461
+ // only job is to render it: through `resultFormat`'s own `format()` when the
8462
+ // column declares one (a computed total shown as Currency, a computed date
8463
+ // shown as a Date), and plainly otherwise. It never returns null for an
8464
+ // empty value, because a formula legitimately produces BLANK.
8465
+ //
8466
+ // No `optionKeys`: the expression is authored in its own editor, not in the
8467
+ // generic option rail, and listing a key the picker has no control for would
8468
+ // open an empty options section under every formula column.
8469
+ {
8470
+ id: "formula",
8471
+ label: "Formula",
8472
+ description: "Computed from the other columns in the row \u2014 never typed in",
8473
+ group: "Structured",
8474
+ base: "string",
8475
+ editor: "computed",
8476
+ format: (v, o) => {
8477
+ const target = o.formula?.resultFormat;
8478
+ if (target && target !== "formula") {
8479
+ const delegate = FIELD_FORMATS[target];
8480
+ if (delegate) {
8481
+ const rendered = delegate.format(v, o);
8482
+ if (rendered !== null) return rendered;
8483
+ }
8484
+ }
8485
+ if (v === null || v === void 0) return "";
8486
+ if (typeof v === "boolean") return v ? "Yes" : "No";
8487
+ if (typeof v === "number") return groupedNumber(v, o);
8488
+ return toText(v);
8489
+ },
8490
+ // Nothing is ever stored in a formula column. Returning the raw input here
8491
+ // would be the one way a computed cell could acquire a value of its own.
8492
+ parse: () => null
8493
+ }
8494
+ ];
8495
+ var FIELD_FORMATS = Object.freeze(
8496
+ Object.fromEntries(DEFS.map((d) => [d.id, d]))
8497
+ );
8498
+ var FIELD_FORMAT_LIST = Object.freeze(DEFS);
8499
+ var FIELD_FORMAT_IDS = DEFS.map((d) => d.id);
8500
+ function getFieldFormat(id) {
8501
+ if (!id) return null;
8502
+ return FIELD_FORMATS[id] ?? null;
8503
+ }
8504
+ function defaultFormatForBase(base) {
8505
+ switch (base) {
8506
+ case "number":
8507
+ return "number";
8508
+ case "integer":
8509
+ return "integer";
8510
+ case "boolean":
8511
+ return "boolean";
8512
+ case "date":
8513
+ return "date";
8514
+ case "datetime":
8515
+ return "datetime";
8516
+ case "json":
8517
+ return "json";
8518
+ case "array":
8519
+ return "array";
8520
+ default:
8521
+ return "text";
8522
+ }
8523
+ }
8524
+
8525
+ // src/field-formats/format.ts
8526
+ function isEmpty(value) {
8527
+ return value === null || value === void 0 || value === "";
8528
+ }
8529
+ function baseText(value) {
8530
+ if (isEmpty(value)) return "";
8531
+ if (typeof value === "object") {
8532
+ try {
8533
+ return JSON.stringify(value);
8534
+ } catch {
8535
+ return String(value);
8536
+ }
8537
+ }
8538
+ return String(value);
8539
+ }
8540
+ function formatFieldValue(value, config, dataType) {
8541
+ if (isEmpty(value)) return { ok: true, text: "", empty: true };
8542
+ const def = config ? getFieldFormat(config.id) : null;
8543
+ const effective = def ?? FIELD_FORMATS[defaultFormatForBase(dataType ?? "string")];
8544
+ let formatted;
8545
+ try {
8546
+ formatted = effective.format(value, config?.options ?? {});
8547
+ } catch {
8548
+ formatted = null;
8549
+ }
8550
+ if (formatted !== null) return { ok: true, text: formatted, empty: false };
8551
+ return {
8552
+ ok: false,
8553
+ text: baseText(value),
8554
+ empty: false,
8555
+ reason: `This value is not a valid ${effective.label.toLowerCase()} \u2014 showing the stored value instead.`
8556
+ };
8557
+ }
8558
+
8559
+ // src/data-table/column-format.tsx
7531
8560
  var import_jsx_runtime37 = require("react/jsx-runtime");
8561
+ function formatColumnValue(col, value) {
8562
+ if (!col.format) return null;
8563
+ return formatFieldValue(value, col.format);
8564
+ }
8565
+ function alignForFormat(col) {
8566
+ if (col.align) return col.align;
8567
+ if (!col.format) return void 0;
8568
+ const def = getFieldFormat(col.format.id);
8569
+ if (!def) return void 0;
8570
+ return def.numericAlign ? "right" : void 0;
8571
+ }
8572
+ var FORMAT_MISMATCH_CLASS = "text-amber-600 underline decoration-dotted underline-offset-2 dark:text-amber-400";
8573
+ function FormattedCell({ result }) {
8574
+ if (result.empty) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
8575
+ if (result.ok) {
8576
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "block truncate text-sm text-foreground", children: result.text });
8577
+ }
8578
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Tooltip, { children: [
8579
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: cn("block truncate text-sm", FORMAT_MISMATCH_CLASS), children: result.text }) }),
8580
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipContent, { className: "max-w-md whitespace-pre-wrap break-words", children: result.reason ?? "This value does not fit the format this column declares." })
8581
+ ] });
8582
+ }
8583
+
8584
+ // src/data-table/DirtySavePill.tsx
8585
+ var import_jsx_runtime38 = require("react/jsx-runtime");
7532
8586
  function DirtySavePill({
7533
8587
  changeCount,
7534
8588
  saving,
@@ -7537,20 +8591,20 @@ function DirtySavePill({
7537
8591
  className
7538
8592
  }) {
7539
8593
  if (changeCount <= 0) return null;
7540
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8594
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7541
8595
  "div",
7542
8596
  {
7543
8597
  className: cn(
7544
8598
  "pointer-events-none fixed inset-x-0 bottom-6 z-50 flex justify-center pb-safe",
7545
8599
  className
7546
8600
  ),
7547
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "pointer-events-auto flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 shadow-lg elevation-2", children: [
7548
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "px-1 text-xs font-medium text-muted-foreground", children: [
8601
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "pointer-events-auto flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 shadow-lg elevation-2", children: [
8602
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "px-1 text-xs font-medium text-muted-foreground", children: [
7549
8603
  changeCount,
7550
8604
  " unsaved change",
7551
8605
  changeCount === 1 ? "" : "s"
7552
8606
  ] }),
7553
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
8607
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
7554
8608
  Button,
7555
8609
  {
7556
8610
  type: "button",
@@ -7560,12 +8614,12 @@ function DirtySavePill({
7560
8614
  disabled: saving,
7561
8615
  onClick: onCancel,
7562
8616
  children: [
7563
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(X, { className: "h-3.5 w-3.5" }),
8617
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(X, { className: "h-3.5 w-3.5" }),
7564
8618
  "Cancel"
7565
8619
  ]
7566
8620
  }
7567
8621
  ),
7568
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
8622
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
7569
8623
  Button,
7570
8624
  {
7571
8625
  type: "button",
@@ -7574,7 +8628,7 @@ function DirtySavePill({
7574
8628
  disabled: saving,
7575
8629
  onClick: onSave,
7576
8630
  children: [
7577
- saving ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Save, { className: "h-3.5 w-3.5" }),
8631
+ saving ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Save, { className: "h-3.5 w-3.5" }),
7578
8632
  "Save"
7579
8633
  ]
7580
8634
  }
@@ -7586,7 +8640,7 @@ function DirtySavePill({
7586
8640
 
7587
8641
  // src/data-table/EditableTableCell.tsx
7588
8642
  var import_react18 = require("react");
7589
- var import_jsx_runtime38 = require("react/jsx-runtime");
8643
+ var import_jsx_runtime39 = require("react/jsx-runtime");
7590
8644
  function CellEditShell({
7591
8645
  href,
7592
8646
  display,
@@ -7595,8 +8649,8 @@ function CellEditShell({
7595
8649
  editButton
7596
8650
  }) {
7597
8651
  const { Link: HostLink } = useMatrxDataTableHost();
7598
- const Link = HostLink ?? ((props) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("a", { ...props }));
7599
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
8652
+ const Link = HostLink ?? ((props) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("a", { ...props }));
8653
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
7600
8654
  "span",
7601
8655
  {
7602
8656
  className: cn(
@@ -7608,7 +8662,7 @@ function CellEditShell({
7608
8662
  className
7609
8663
  ),
7610
8664
  children: [
7611
- href ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8665
+ href ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7612
8666
  Link,
7613
8667
  {
7614
8668
  href,
@@ -7616,7 +8670,7 @@ function CellEditShell({
7616
8670
  className: "min-w-0 flex-1 overflow-hidden truncate rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
7617
8671
  children: display
7618
8672
  }
7619
- ) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "block min-w-0 flex-1 overflow-hidden", children: display }),
8673
+ ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "block min-w-0 flex-1 overflow-hidden", children: display }),
7620
8674
  editButton
7621
8675
  ]
7622
8676
  }
@@ -7641,7 +8695,7 @@ function EditableTableCell({
7641
8695
  }, [editRequest]);
7642
8696
  const usePencil = Boolean(href) || editTrigger === "pencil";
7643
8697
  if (editType === "string") {
7644
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8698
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7645
8699
  InlineStringEditor,
7646
8700
  {
7647
8701
  value: stringifyCellValue(value),
@@ -7655,30 +8709,30 @@ function EditableTableCell({
7655
8709
  }
7656
8710
  );
7657
8711
  }
7658
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
7659
- usePencil ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8712
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
8713
+ usePencil ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7660
8714
  CellEditShell,
7661
8715
  {
7662
8716
  ...href === void 0 ? {} : { href },
7663
8717
  display,
7664
8718
  ...dirty === void 0 ? {} : { dirty },
7665
8719
  ...className === void 0 ? {} : { className },
7666
- editButton: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Tooltip, { children: [
7667
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8720
+ editButton: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
8721
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7668
8722
  "button",
7669
8723
  {
7670
8724
  type: "button",
7671
8725
  "aria-label": "Edit",
7672
8726
  onClick: (e) => e.stopPropagation(),
7673
8727
  className: CELL_PENCIL_CLASS,
7674
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Pencil, { className: "h-3 w-3" })
8728
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Pencil, { className: "h-3 w-3" })
7675
8729
  }
7676
8730
  ) }) }),
7677
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipContent, { children: "Edit" })
8731
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: "Edit" })
7678
8732
  ] })
7679
8733
  }
7680
- ) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Tooltip, { children: [
7681
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
8734
+ ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
8735
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
7682
8736
  "button",
7683
8737
  {
7684
8738
  type: "button",
@@ -7689,20 +8743,20 @@ function EditableTableCell({
7689
8743
  className
7690
8744
  ),
7691
8745
  children: [
7692
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "min-w-0 flex-1 overflow-hidden", children: display }),
7693
- editType === "select" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { className: "h-3 w-3 shrink-0 text-muted-foreground/70 transition-colors group-hover/cell-select:text-foreground" }) : null
8746
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "min-w-0 flex-1 overflow-hidden", children: display }),
8747
+ editType === "select" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronDown, { className: "h-3 w-3 shrink-0 text-muted-foreground/70 transition-colors group-hover/cell-select:text-foreground" }) : null
7694
8748
  ]
7695
8749
  }
7696
8750
  ) }) }),
7697
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipContent, { children: "Edit value" })
8751
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: "Edit value" })
7698
8752
  ] }),
7699
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8753
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7700
8754
  PopoverContent,
7701
8755
  {
7702
8756
  align: "start",
7703
8757
  className: "w-56 p-2",
7704
8758
  onClick: (e) => e.stopPropagation(),
7705
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8759
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7706
8760
  TypedEditor,
7707
8761
  {
7708
8762
  editType,
@@ -7740,15 +8794,15 @@ function InlineStringEditor({
7740
8794
  }, [editRequest, value]);
7741
8795
  if (!editing) {
7742
8796
  if (usePencil) {
7743
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8797
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7744
8798
  CellEditShell,
7745
8799
  {
7746
8800
  ...href === void 0 ? {} : { href },
7747
8801
  display,
7748
8802
  ...dirty === void 0 ? {} : { dirty },
7749
8803
  ...className === void 0 ? {} : { className },
7750
- editButton: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Tooltip, { children: [
7751
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8804
+ editButton: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
8805
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7752
8806
  "button",
7753
8807
  {
7754
8808
  type: "button",
@@ -7759,16 +8813,16 @@ function InlineStringEditor({
7759
8813
  setEditing(true);
7760
8814
  },
7761
8815
  className: CELL_PENCIL_CLASS,
7762
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Pencil, { className: "h-3 w-3" })
8816
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Pencil, { className: "h-3 w-3" })
7763
8817
  }
7764
8818
  ) }),
7765
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipContent, { children: "Edit" })
8819
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: "Edit" })
7766
8820
  ] })
7767
8821
  }
7768
8822
  );
7769
8823
  }
7770
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Tooltip, { children: [
7771
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8824
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
8825
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7772
8826
  "button",
7773
8827
  {
7774
8828
  type: "button",
@@ -7785,10 +8839,10 @@ function InlineStringEditor({
7785
8839
  children: display
7786
8840
  }
7787
8841
  ) }),
7788
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipContent, { children: "Click to edit" })
8842
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: "Click to edit" })
7789
8843
  ] });
7790
8844
  }
7791
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8845
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7792
8846
  Input,
7793
8847
  {
7794
8848
  autoFocus: true,
@@ -7824,9 +8878,9 @@ function TypedEditor({
7824
8878
  }) {
7825
8879
  if (editType === "boolean") {
7826
8880
  const checked = Boolean(value);
7827
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
7828
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-xs font-medium", children: "Value" }),
7829
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8881
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
8882
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-xs font-medium", children: "Value" }),
8883
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7830
8884
  Checkbox,
7831
8885
  {
7832
8886
  checked,
@@ -7836,7 +8890,7 @@ function TypedEditor({
7836
8890
  ] });
7837
8891
  }
7838
8892
  if (editType === "number") {
7839
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8893
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7840
8894
  NumberEditor,
7841
8895
  {
7842
8896
  value: typeof value === "number" ? value : Number(value) || 0,
@@ -7846,7 +8900,7 @@ function TypedEditor({
7846
8900
  );
7847
8901
  }
7848
8902
  if (editType === "tags") {
7849
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8903
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7850
8904
  TagsEditor,
7851
8905
  {
7852
8906
  value: Array.isArray(value) ? value.map(String) : [],
@@ -7857,19 +8911,19 @@ function TypedEditor({
7857
8911
  );
7858
8912
  }
7859
8913
  if (editType === "select") {
7860
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
8914
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
7861
8915
  Select,
7862
8916
  {
7863
8917
  value: stringifyCellValue(value),
7864
8918
  onValueChange: (v) => onCommit(v),
7865
8919
  children: [
7866
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectValue, {}) }),
7867
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectContent, { children: editOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SelectItem, { value: o.value, children: o.label }, o.value)) })
8920
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectValue, {}) }),
8921
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectContent, { children: editOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SelectItem, { value: o.value, children: o.label }, o.value)) })
7868
8922
  ]
7869
8923
  }
7870
8924
  );
7871
8925
  }
7872
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8926
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7873
8927
  Input,
7874
8928
  {
7875
8929
  type: "date",
@@ -7899,11 +8953,11 @@ function TagsEditor({
7899
8953
  const matches = suggestions.filter(
7900
8954
  (s) => !tags.includes(s.value) && s.value !== "__none__" && (!draft || s.label.toLowerCase().includes(draft.trim().toLowerCase()))
7901
8955
  ).slice(0, 6);
7902
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "space-y-2", onClick: (e) => e.stopPropagation(), children: [
7903
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
7904
- tags.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-xs text-muted-foreground", children: "No tags" }),
7905
- tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Tooltip, { children: [
7906
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
8956
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "space-y-2", onClick: (e) => e.stopPropagation(), children: [
8957
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
8958
+ tags.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-xs text-muted-foreground", children: "No tags" }),
8959
+ tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
8960
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
7907
8961
  "button",
7908
8962
  {
7909
8963
  type: "button",
@@ -7912,17 +8966,17 @@ function TagsEditor({
7912
8966
  className: "inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px] hover:border-destructive hover:text-destructive",
7913
8967
  children: [
7914
8968
  tag,
7915
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(X, { className: "h-2.5 w-2.5" })
8969
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(X, { className: "h-2.5 w-2.5" })
7916
8970
  ]
7917
8971
  }
7918
8972
  ) }),
7919
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(TooltipContent, { children: [
8973
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(TooltipContent, { children: [
7920
8974
  "Remove ",
7921
8975
  tag
7922
8976
  ] })
7923
8977
  ] }, tag))
7924
8978
  ] }),
7925
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8979
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7926
8980
  Input,
7927
8981
  {
7928
8982
  autoFocus: true,
@@ -7943,7 +8997,7 @@ function TagsEditor({
7943
8997
  className: "h-8 text-xs"
7944
8998
  }
7945
8999
  ),
7946
- matches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-wrap gap-1", children: matches.map((s) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
9000
+ matches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex flex-wrap gap-1", children: matches.map((s) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
7947
9001
  "button",
7948
9002
  {
7949
9003
  type: "button",
@@ -7956,8 +9010,8 @@ function TagsEditor({
7956
9010
  },
7957
9011
  s.value
7958
9012
  )) }),
7959
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-end gap-1 pt-1", children: [
7960
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9013
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-end gap-1 pt-1", children: [
9014
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7961
9015
  Button,
7962
9016
  {
7963
9017
  size: "sm",
@@ -7965,17 +9019,17 @@ function TagsEditor({
7965
9019
  className: "h-7 px-2",
7966
9020
  "aria-label": "Cancel edit",
7967
9021
  onClick: onCancel,
7968
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(X, { className: "h-3.5 w-3.5" })
9022
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(X, { className: "h-3.5 w-3.5" })
7969
9023
  }
7970
9024
  ),
7971
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9025
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7972
9026
  Button,
7973
9027
  {
7974
9028
  size: "sm",
7975
9029
  className: "h-7 px-2",
7976
9030
  "aria-label": "Apply tags",
7977
9031
  onClick: () => onCommit(tags),
7978
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Check, { className: "h-3.5 w-3.5" })
9032
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Check, { className: "h-3.5 w-3.5" })
7979
9033
  }
7980
9034
  )
7981
9035
  ] })
@@ -7987,8 +9041,8 @@ function NumberEditor({
7987
9041
  onCancel
7988
9042
  }) {
7989
9043
  const [draft, setDraft] = (0, import_react18.useState)(String(value));
7990
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-2", children: [
7991
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9044
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-col gap-2", children: [
9045
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7992
9046
  Input,
7993
9047
  {
7994
9048
  autoFocus: true,
@@ -8005,8 +9059,8 @@ function NumberEditor({
8005
9059
  }
8006
9060
  }
8007
9061
  ),
8008
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex justify-end gap-1", children: [
8009
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9062
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-end gap-1", children: [
9063
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8010
9064
  Button,
8011
9065
  {
8012
9066
  type: "button",
@@ -8015,10 +9069,10 @@ function NumberEditor({
8015
9069
  className: "h-7",
8016
9070
  "aria-label": "Cancel edit",
8017
9071
  onClick: onCancel,
8018
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(X, { className: "h-3.5 w-3.5" })
9072
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(X, { className: "h-3.5 w-3.5" })
8019
9073
  }
8020
9074
  ),
8021
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9075
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8022
9076
  Button,
8023
9077
  {
8024
9078
  type: "button",
@@ -8029,7 +9083,7 @@ function NumberEditor({
8029
9083
  const n = Number(draft);
8030
9084
  if (Number.isFinite(n)) onCommit(n);
8031
9085
  },
8032
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Check, { className: "h-3.5 w-3.5" })
9086
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Check, { className: "h-3.5 w-3.5" })
8033
9087
  }
8034
9088
  )
8035
9089
  ] })
@@ -8037,24 +9091,24 @@ function NumberEditor({
8037
9091
  }
8038
9092
 
8039
9093
  // src/data-table/ToolbarFacets.tsx
8040
- var import_jsx_runtime39 = require("react/jsx-runtime");
9094
+ var import_jsx_runtime40 = require("react/jsx-runtime");
8041
9095
  function ToolbarFacets({ facets }) {
8042
9096
  if (facets.length === 0) return null;
8043
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: facets.map((facet) => {
9097
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: facets.map((facet) => {
8044
9098
  if (facet.type === "custom") {
8045
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: facet.render() }, facet.id);
9099
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: facet.render() }, facet.id);
8046
9100
  }
8047
9101
  const defaultValue = facet.defaultValue ?? facet.options[0]?.value ?? "";
8048
9102
  const isNonDefault = facet.value !== defaultValue;
8049
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
9103
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
8050
9104
  "div",
8051
9105
  {
8052
9106
  className: "flex flex-wrap items-center gap-1.5 max-sm:grid max-sm:w-full max-sm:grid-cols-3",
8053
9107
  children: [
8054
- facet.label ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "mr-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: facet.label }) : null,
9108
+ facet.label ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "mr-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: facet.label }) : null,
8055
9109
  facet.options.map((opt) => {
8056
9110
  const active = facet.value === opt.value;
8057
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
9111
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
8058
9112
  Button,
8059
9113
  {
8060
9114
  type: "button",
@@ -8068,8 +9122,8 @@ function ToolbarFacets({ facets }) {
8068
9122
  children: [
8069
9123
  opt.icon,
8070
9124
  opt.label,
8071
- active && isNonDefault ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
8072
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
9125
+ active && isNonDefault ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Tooltip, { children: [
9126
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
8073
9127
  "span",
8074
9128
  {
8075
9129
  role: "button",
@@ -8087,10 +9141,10 @@ function ToolbarFacets({ facets }) {
8087
9141
  facet.onChange(defaultValue);
8088
9142
  }
8089
9143
  },
8090
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(X, { className: "h-3 w-3" })
9144
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(X, { className: "h-3 w-3" })
8091
9145
  }
8092
9146
  ) }),
8093
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { side: "top", children: "Clear this filter" })
9147
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipContent, { side: "top", children: "Clear this filter" })
8094
9148
  ] }) }) : null
8095
9149
  ]
8096
9150
  },
@@ -8117,7 +9171,7 @@ function resetToolbarFacets(facets) {
8117
9171
 
8118
9172
  // src/data-table/LayeredFilterBuilder.tsx
8119
9173
  var import_react19 = require("react");
8120
- var import_jsx_runtime40 = require("react/jsx-runtime");
9174
+ var import_jsx_runtime41 = require("react/jsx-runtime");
8121
9175
  function moveRule(rules, from, to) {
8122
9176
  if (from === to || to < 0 || to >= rules.length) return [...rules];
8123
9177
  const next = [...rules];
@@ -8163,8 +9217,8 @@ function LayeredFilterBuilder({
8163
9217
  const reorder = (from, to) => {
8164
9218
  onChange(moveRule(rules, from, to));
8165
9219
  };
8166
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [
8167
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9220
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [
9221
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8168
9222
  Popover,
8169
9223
  {
8170
9224
  open,
@@ -8176,7 +9230,7 @@ function LayeredFilterBuilder({
8176
9230
  }
8177
9231
  },
8178
9232
  children: [
8179
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9233
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8180
9234
  Button,
8181
9235
  {
8182
9236
  type: "button",
@@ -8185,25 +9239,25 @@ function LayeredFilterBuilder({
8185
9239
  className: "h-8 gap-1.5 px-2 text-xs",
8186
9240
  "aria-label": label,
8187
9241
  children: [
8188
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
8189
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "hidden sm:inline", children: rules.length > 0 ? `${rules.length} layers` : "Advanced" }),
8190
- rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "sm:hidden", children: rules.length }) : null
9242
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
9243
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "hidden sm:inline", children: rules.length > 0 ? `${rules.length} layers` : "Advanced" }),
9244
+ rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "sm:hidden", children: rules.length }) : null
8191
9245
  ]
8192
9246
  }
8193
9247
  ) }),
8194
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9248
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8195
9249
  PopoverContent,
8196
9250
  {
8197
9251
  align: "start",
8198
9252
  sideOffset: 6,
8199
9253
  className: "w-[min(46rem,calc(100vw-1rem))] p-0",
8200
9254
  children: [
8201
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5", children: [
8202
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
8203
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-sm font-semibold text-foreground", children: "Narrow these results" }),
8204
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xs text-muted-foreground", children: "Every layer must match. Drag layers to put them in the order that makes sense to you." })
9255
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5", children: [
9256
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
9257
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm font-semibold text-foreground", children: "Narrow these results" }),
9258
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-xs text-muted-foreground", children: "Every layer must match. Drag layers to put them in the order that makes sense to you." })
8205
9259
  ] }),
8206
- rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9260
+ rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8207
9261
  Button,
8208
9262
  {
8209
9263
  type: "button",
@@ -8215,10 +9269,10 @@ function LayeredFilterBuilder({
8215
9269
  }
8216
9270
  ) : null
8217
9271
  ] }),
8218
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "max-h-[min(28rem,65dvh)] space-y-1.5 overflow-y-auto p-2.5 scrollbar-thin", children: rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "rounded-md border border-dashed border-border px-3 py-5 text-center", children: [
8219
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-sm font-medium text-foreground", children: "Start with one simple layer" }),
8220
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "For example: Keyword contains ITAD, then Keyword doesn't have the word \u201Cwhat\u201D." })
8221
- ] }) : rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9272
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "max-h-[min(28rem,65dvh)] space-y-1.5 overflow-y-auto p-2.5 scrollbar-thin", children: rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "rounded-md border border-dashed border-border px-3 py-5 text-center", children: [
9273
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm font-medium text-foreground", children: "Start with one simple layer" }),
9274
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "For example: Keyword contains ITAD, then Keyword doesn't have the word \u201Cwhat\u201D." })
9275
+ ] }) : rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8222
9276
  LayeredRuleRow,
8223
9277
  {
8224
9278
  index,
@@ -8238,9 +9292,9 @@ function LayeredFilterBuilder({
8238
9292
  },
8239
9293
  rule.id
8240
9294
  )) }),
8241
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between gap-2 border-t border-border px-3 py-2", children: [
8242
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "The regular search still works and is applied before these layers." }),
8243
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9295
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between gap-2 border-t border-border px-3 py-2", children: [
9296
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "The regular search still works and is applied before these layers." }),
9297
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8244
9298
  Button,
8245
9299
  {
8246
9300
  type: "button",
@@ -8250,7 +9304,7 @@ function LayeredFilterBuilder({
8250
9304
  disabled: rules.length >= maxRules,
8251
9305
  onClick: addRule,
8252
9306
  children: [
8253
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Plus, { className: "h-3.5 w-3.5" }),
9307
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Plus, { className: "h-3.5 w-3.5" }),
8254
9308
  " Add layer"
8255
9309
  ]
8256
9310
  }
@@ -8262,7 +9316,7 @@ function LayeredFilterBuilder({
8262
9316
  ]
8263
9317
  }
8264
9318
  ),
8265
- rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9319
+ rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8266
9320
  "span",
8267
9321
  {
8268
9322
  className: cn(
@@ -8270,7 +9324,7 @@ function LayeredFilterBuilder({
8270
9324
  isCompleteLayeredFilterRule(rule) ? "border-border bg-muted/50 text-foreground" : "border-dashed border-warning/50 bg-warning/10 text-warning"
8271
9325
  ),
8272
9326
  children: [
8273
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9327
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8274
9328
  "button",
8275
9329
  {
8276
9330
  type: "button",
@@ -8278,19 +9332,19 @@ function LayeredFilterBuilder({
8278
9332
  onClick: () => setOpen(true),
8279
9333
  title: isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : `Layer ${index + 1} needs a value`,
8280
9334
  children: [
8281
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "mr-1 text-muted-foreground", children: index + 1 }),
9335
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "mr-1 text-muted-foreground", children: index + 1 }),
8282
9336
  isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : "Choose a value"
8283
9337
  ]
8284
9338
  }
8285
9339
  ),
8286
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9340
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8287
9341
  "button",
8288
9342
  {
8289
9343
  type: "button",
8290
9344
  className: "shrink-0 rounded-full p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",
8291
9345
  "aria-label": `Remove filter layer ${index + 1}`,
8292
9346
  onClick: () => removeRule(index),
8293
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(X, { className: "h-3 w-3" })
9347
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(X, { className: "h-3 w-3" })
8294
9348
  }
8295
9349
  )
8296
9350
  ]
@@ -8320,7 +9374,7 @@ function LayeredRuleRow({
8320
9374
  event.preventDefault();
8321
9375
  onKeyboardMove(event.key === "ArrowUp" ? -1 : 1);
8322
9376
  };
8323
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9377
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8324
9378
  "div",
8325
9379
  {
8326
9380
  className: cn(
@@ -8333,7 +9387,7 @@ function LayeredRuleRow({
8333
9387
  onDrop(index);
8334
9388
  },
8335
9389
  children: [
8336
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9390
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8337
9391
  "button",
8338
9392
  {
8339
9393
  type: "button",
@@ -8347,10 +9401,10 @@ function LayeredRuleRow({
8347
9401
  },
8348
9402
  onDragEnd,
8349
9403
  onKeyDown: handleMoveKey,
8350
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
9404
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
8351
9405
  }
8352
9406
  ),
8353
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9407
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8354
9408
  Select,
8355
9409
  {
8356
9410
  value: field.id,
@@ -8368,16 +9422,16 @@ function LayeredRuleRow({
8368
9422
  });
8369
9423
  },
8370
9424
  children: [
8371
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9425
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8372
9426
  SelectTrigger,
8373
9427
  {
8374
9428
  size: "sm",
8375
9429
  className: "h-7 w-full text-xs max-sm:col-span-1",
8376
9430
  "aria-label": `Filter layer ${index + 1} field`,
8377
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SelectValue, {})
9431
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectValue, {})
8378
9432
  }
8379
9433
  ),
8380
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SelectContent, { children: fields.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9434
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectContent, { children: fields.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8381
9435
  SelectItem,
8382
9436
  {
8383
9437
  value: candidate.id,
@@ -8389,7 +9443,7 @@ function LayeredRuleRow({
8389
9443
  ]
8390
9444
  }
8391
9445
  ),
8392
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9446
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8393
9447
  Select,
8394
9448
  {
8395
9449
  value: rule.operator,
@@ -8401,35 +9455,35 @@ function LayeredRuleRow({
8401
9455
  });
8402
9456
  },
8403
9457
  children: [
8404
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9458
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8405
9459
  SelectTrigger,
8406
9460
  {
8407
9461
  size: "sm",
8408
9462
  className: "h-7 w-full text-xs max-sm:col-start-2",
8409
9463
  "aria-label": `Filter layer ${index + 1} operator`,
8410
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SelectValue, {})
9464
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectValue, {})
8411
9465
  }
8412
9466
  ),
8413
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SelectContent, { children: operators.map((operator) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SelectItem, { value: operator, className: "text-xs", children: LAYERED_FILTER_OPERATOR_LABELS[operator] }, operator)) })
9467
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectContent, { children: operators.map((operator) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectItem, { value: operator, className: "text-xs", children: LAYERED_FILTER_OPERATOR_LABELS[operator] }, operator)) })
8414
9468
  ]
8415
9469
  }
8416
9470
  ),
8417
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "min-w-0 max-sm:col-span-3 max-sm:col-start-1", children: !needsValue ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "flex h-7 items-center px-2 text-xs text-muted-foreground", children: "No value needed" }) : field.kind === "select" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
9471
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "min-w-0 max-sm:col-span-3 max-sm:col-start-1", children: !needsValue ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "flex h-7 items-center px-2 text-xs text-muted-foreground", children: "No value needed" }) : field.kind === "select" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
8418
9472
  Select,
8419
9473
  {
8420
9474
  value: rule.value,
8421
9475
  onValueChange: (value) => onChange({ value }),
8422
9476
  children: [
8423
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9477
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8424
9478
  SelectTrigger,
8425
9479
  {
8426
9480
  size: "sm",
8427
9481
  className: "h-7 w-full text-xs",
8428
9482
  "aria-label": `Filter layer ${index + 1} value`,
8429
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SelectValue, {})
9483
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectValue, {})
8430
9484
  }
8431
9485
  ),
8432
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SelectContent, { children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9486
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectContent, { children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8433
9487
  SelectItem,
8434
9488
  {
8435
9489
  value: option.value,
@@ -8440,8 +9494,8 @@ function LayeredRuleRow({
8440
9494
  )) })
8441
9495
  ]
8442
9496
  }
8443
- ) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-1", children: [
8444
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9497
+ ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-1", children: [
9498
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8445
9499
  Input,
8446
9500
  {
8447
9501
  value: rule.value,
@@ -8452,9 +9506,9 @@ function LayeredRuleRow({
8452
9506
  "aria-label": `Filter layer ${index + 1} value`
8453
9507
  }
8454
9508
  ),
8455
- rule.operator === "between" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
8456
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "and" }),
8457
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9509
+ rule.operator === "between" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
9510
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "and" }),
9511
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8458
9512
  Input,
8459
9513
  {
8460
9514
  value: rule.valueTo ?? "",
@@ -8467,7 +9521,7 @@ function LayeredRuleRow({
8467
9521
  )
8468
9522
  ] }) : null
8469
9523
  ] }) }),
8470
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
9524
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8471
9525
  Button,
8472
9526
  {
8473
9527
  type: "button",
@@ -8476,7 +9530,7 @@ function LayeredRuleRow({
8476
9530
  className: "h-7 w-7 p-0 text-muted-foreground hover:text-destructive max-sm:col-start-3 max-sm:row-start-1",
8477
9531
  "aria-label": `Remove filter layer ${index + 1}`,
8478
9532
  onClick: onRemove,
8479
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Trash2, { className: "h-3.5 w-3.5" })
9533
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Trash2, { className: "h-3.5 w-3.5" })
8480
9534
  }
8481
9535
  )
8482
9536
  ]
@@ -8589,7 +9643,7 @@ function safeQueryPage(requestedPage, totalItems, pageSize) {
8589
9643
  }
8590
9644
 
8591
9645
  // src/data-table/MatrxDataTable.tsx
8592
- var import_jsx_runtime41 = require("react/jsx-runtime");
9646
+ var import_jsx_runtime42 = require("react/jsx-runtime");
8593
9647
  function TableToolbarAction({
8594
9648
  HostAction,
8595
9649
  ariaLabel,
@@ -8600,10 +9654,10 @@ function TableToolbarAction({
8600
9654
  children
8601
9655
  }) {
8602
9656
  if (HostAction) {
8603
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-matrx-table-toolbar-action": true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(HostAction, { ariaLabel, tooltip, disabled, busy, onClick, children }) });
9657
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-matrx-table-toolbar-action": true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(HostAction, { ariaLabel, tooltip, disabled, busy, onClick, children }) });
8604
9658
  }
8605
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
8606
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-matrx-table-toolbar-action": true, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
9659
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
9660
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-matrx-table-toolbar-action": true, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8607
9661
  Button,
8608
9662
  {
8609
9663
  type: "button",
@@ -8618,7 +9672,7 @@ function TableToolbarAction({
8618
9672
  children: (0, import_react20.isValidElement)(children) ? (0, import_react20.cloneElement)(children, { className: cn("h-5 w-5", children.props.className) }) : children
8619
9673
  }
8620
9674
  ) }) }),
8621
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: tooltip ?? ariaLabel })
9675
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: tooltip ?? ariaLabel })
8622
9676
  ] });
8623
9677
  }
8624
9678
  function hasSameRowReferences(previous, next) {
@@ -8635,7 +9689,7 @@ function TableRowCopyControl({
8635
9689
  sourceId,
8636
9690
  defaultColumns
8637
9691
  }) {
8638
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(CopyButtons, { size, ...tableRowCopyProps(copy, row, sourceId, defaultColumns) });
9692
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CopyButtons, { size, ...tableRowCopyProps(copy, row, sourceId, defaultColumns) });
8639
9693
  }
8640
9694
  function tableRowCopyProps(copy, row, sourceId, defaultColumns) {
8641
9695
  const aiVariants = copy.rowAiVariants?.(row);
@@ -8659,8 +9713,8 @@ function isStringArray(value) {
8659
9713
  }
8660
9714
  var activeUrlTableIds = /* @__PURE__ */ new Set();
8661
9715
  function MatrxDataTable(props) {
8662
- if (!props.urlState) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MatrxDataTableCore, { ...props });
8663
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MatrxDataTableWithUrlState, { ...props, urlState: props.urlState });
9716
+ if (!props.urlState) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MatrxDataTableCore, { ...props });
9717
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MatrxDataTableWithUrlState, { ...props, urlState: props.urlState });
8664
9718
  }
8665
9719
  function MatrxDataTableWithUrlState({
8666
9720
  urlState,
@@ -8715,7 +9769,7 @@ function MatrxDataTableWithUrlState({
8715
9769
  props.selection?.onSelectedIdsChange(ids);
8716
9770
  }
8717
9771
  } : props.selection;
8718
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
9772
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8719
9773
  MatrxDataTableCore,
8720
9774
  {
8721
9775
  ...props,
@@ -8767,7 +9821,7 @@ function opensRowHref(event) {
8767
9821
  return event.metaKey || event.ctrlKey || event.shiftKey || event.button === 1;
8768
9822
  }
8769
9823
  function TableContextPassthrough({ children }) {
8770
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
9824
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children });
8771
9825
  }
8772
9826
  function MatrxDataTableCore({
8773
9827
  data: suppliedData,
@@ -8808,6 +9862,8 @@ function MatrxDataTableCore({
8808
9862
  rowActions,
8809
9863
  footerRows = [],
8810
9864
  rowClassName,
9865
+ cellClassName,
9866
+ tableStyle,
8811
9867
  highlightedIndex,
8812
9868
  onViewChange,
8813
9869
  rowWrapper,
@@ -9405,6 +10461,48 @@ function MatrxDataTableCore({
9405
10461
  setFixedTableGeometry(geometry);
9406
10462
  }, [resolvedDensity, measureFixedTableGeometry, usesMeasuredFixedLayout]);
9407
10463
  const fixedLayoutActive = usesMeasuredFixedLayout && fixedTableGeometry !== null;
10464
+ const frozenColumns = (0, import_react20.useMemo)(() => {
10465
+ if (!visibleColumns.some((column) => column.frozen)) return NO_FROZEN_COLUMNS;
10466
+ const ids = visibleColumns.map(columnId);
10467
+ const byId = new Map(visibleColumns.map((column) => [columnId(column), column]));
10468
+ return resolveFrozenColumns(
10469
+ ids,
10470
+ (id) => byId.get(id)?.frozen === true,
10471
+ (id) => effectiveColumnWidths[id] ?? pixelWidth(byId.get(id)?.width),
10472
+ selection ? fixedTableGeometry?.selectionWidth : null
10473
+ );
10474
+ }, [visibleColumns, effectiveColumnWidths, selection, fixedTableGeometry]);
10475
+ const frozenStyle = (id) => {
10476
+ const left = frozenColumns.offsets[id];
10477
+ if (left === void 0) return void 0;
10478
+ return { "--matrx-frozen-left": `${left}px` };
10479
+ };
10480
+ const frozenEdgeId = (() => {
10481
+ const ids = Object.keys(frozenColumns.offsets);
10482
+ return ids.length === 0 ? null : ids[ids.length - 1];
10483
+ })();
10484
+ const styleFieldOf = tableStyle?.fieldOf ?? ((id) => id);
10485
+ const styleDocumentOf = tableStyle?.documentOf ?? ((row) => row);
10486
+ const noChoiceColor = () => void 0;
10487
+ const rowTintClass = (row, id) => {
10488
+ if (!tableStyle) return void 0;
10489
+ const color = resolveRowColor(
10490
+ tableStyle.style,
10491
+ { id, data: styleDocumentOf(row) },
10492
+ tableStyle.choiceColorFor ?? noChoiceColor
10493
+ );
10494
+ return color ? ROW_TINT_CLASS[color] : void 0;
10495
+ };
10496
+ const cellTintClass = (row, id, colId) => {
10497
+ if (!tableStyle) return void 0;
10498
+ const color = resolveCellColor(
10499
+ tableStyle.style,
10500
+ { id, data: styleDocumentOf(row) },
10501
+ styleFieldOf(colId),
10502
+ tableStyle.choiceColorFor ?? noChoiceColor
10503
+ );
10504
+ return color ? CELL_TINT_CLASS[color] : void 0;
10505
+ };
9408
10506
  const declaredVisibleCopyColumns = (0, import_react20.useMemo)(
9409
10507
  () => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
9410
10508
  [visibleColumns]
@@ -9612,9 +10710,9 @@ function MatrxDataTableCore({
9612
10710
  const showToolbarCopy = effectiveCopy !== void 0 && effectiveCopy.showToolbar !== false;
9613
10711
  const renderRowActions = (row, controls) => {
9614
10712
  const actions = rowActions?.(row, controls);
9615
- const scopedActions = /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MatrxTableRowControlsScope, { value: controls, children: actions });
10713
+ const scopedActions = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MatrxTableRowControlsScope, { value: controls, children: actions });
9616
10714
  if (!effectiveCopy || !showRowCopy) return scopedActions;
9617
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
10715
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
9618
10716
  MatrxTableRowAlchemyProvider,
9619
10717
  {
9620
10718
  copy: tableRowCopyProps(effectiveCopy, row, `${tableCopySourceNamespace}:row:${getRowId(row)}`, copy === void 0 ? declaredVisibleCopyColumns : void 0),
@@ -9711,7 +10809,7 @@ function MatrxDataTableCore({
9711
10809
  const renderedEmptyState = remoteQuery === null && data.length > 0 && hasActiveFilters ? {
9712
10810
  title: "No matching rows",
9713
10811
  description: "No rows match the current search or filters.",
9714
- action: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Button, { type: "button", variant: "outline", size: "sm", onClick: clearAllFilters, children: "Clear filters" }),
10812
+ action: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { type: "button", variant: "outline", size: "sm", onClick: clearAllFilters, children: "Clear filters" }),
9715
10813
  icon: void 0
9716
10814
  } : emptyState;
9717
10815
  const commitCell = (rowId, field, next) => {
@@ -10083,7 +11181,7 @@ function MatrxDataTableCore({
10083
11181
  const display = renderCell(applyRowEdits(row, rowEdits), col, index);
10084
11182
  const href = col.href?.(row) ?? void 0;
10085
11183
  if (editEnabled && col.editable && (col.editableIf?.(row) ?? true)) {
10086
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11184
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10087
11185
  EditableTableCell,
10088
11186
  {
10089
11187
  value: rowEdits && field in rowEdits ? rowEdits[field] : getCellValue(row, col),
@@ -10098,7 +11196,7 @@ function MatrxDataTableCore({
10098
11196
  }
10099
11197
  );
10100
11198
  }
10101
- return href ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Link, { href, onClick: (event) => event.stopPropagation(), className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring", children: display }) : display;
11199
+ return href ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Link, { href, onClick: (event) => event.stopPropagation(), className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring", children: display }) : display;
10102
11200
  };
10103
11201
  const currentViewSnapshot = (0, import_react20.useMemo)(
10104
11202
  () => ({
@@ -10204,7 +11302,7 @@ function MatrxDataTableCore({
10204
11302
  },
10205
11303
  [columns, commitColumnState, commitColumnWidths, controlledQuery, intelligentSearchEnabled, intelligentSearchScopes, toolbar]
10206
11304
  );
10207
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ContextMenuBoundary, { label: tableId ?? "Data table", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11305
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ContextMenuBoundary, { label: tableId ?? "Data table", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10208
11306
  import_core3.DndContext,
10209
11307
  {
10210
11308
  id: tableDndContextId,
@@ -10297,7 +11395,7 @@ function MatrxDataTableCore({
10297
11395
  commitColumnState(order, effectiveHiddenColumnIds);
10298
11396
  },
10299
11397
  children: [
10300
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11398
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10301
11399
  "div",
10302
11400
  {
10303
11401
  ref: rootRef,
@@ -10312,14 +11410,14 @@ function MatrxDataTableCore({
10312
11410
  ),
10313
11411
  children: [
10314
11412
  notice,
10315
- savedViewError ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: savedViewError }) : null,
10316
- toolbarActionError ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: toolbarActionError }) : null,
10317
- !hideToolbar && (viewTabs || toolbar?.title || showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || toolbar?.refresh || toolbar?.add || tableId && SavedViews || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11413
+ savedViewError ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: savedViewError }) : null,
11414
+ toolbarActionError ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: toolbarActionError }) : null,
11415
+ !hideToolbar && (viewTabs || toolbar?.title || showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || toolbar?.refresh || toolbar?.add || tableId && SavedViews || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10318
11416
  TableTitleRow,
10319
11417
  {
10320
- tabs: viewTabs ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TableViewWorkspace, { snapshot: currentViewSnapshot, onApply: applySavedView, related: relatedTableActions }, tableId ?? "table") : void 0,
11418
+ tabs: viewTabs ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TableViewWorkspace, { snapshot: currentViewSnapshot, onApply: applySavedView, related: relatedTableActions }, tableId ?? "table") : void 0,
10321
11419
  ...toolbar?.title === void 0 ? {} : { title: toolbar.title },
10322
- context: tableId && SavedViews ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-matrx-table-view-control": true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11420
+ context: tableId && SavedViews ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-matrx-table-view-control": true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10323
11421
  SavedViews,
10324
11422
  {
10325
11423
  tableId,
@@ -10328,7 +11426,7 @@ function MatrxDataTableCore({
10328
11426
  onApply: applySavedView
10329
11427
  }
10330
11428
  ) }) : void 0,
10331
- search: showSearch ? intelligentSearchEnabled ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11429
+ search: showSearch ? intelligentSearchEnabled ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10332
11430
  TableSearch,
10333
11431
  {
10334
11432
  value: searchValue,
@@ -10338,7 +11436,7 @@ function MatrxDataTableCore({
10338
11436
  scopes: intelligentSearchScopes,
10339
11437
  ...toolbar?.searchPlaceholder === void 0 ? {} : { placeholder: toolbar.searchPlaceholder }
10340
11438
  }
10341
- ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11439
+ ) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10342
11440
  "div",
10343
11441
  {
10344
11442
  "data-matrx-table-search": true,
@@ -10347,9 +11445,9 @@ function MatrxDataTableCore({
10347
11445
  toolbar?.searchMatch ? "sm:max-w-md" : "sm:max-w-xs"
10348
11446
  ),
10349
11447
  children: [
10350
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
10351
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Search, { className: "absolute left-2 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground" }),
10352
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11448
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
11449
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Search, { className: "absolute left-2 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground" }),
11450
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10353
11451
  Input,
10354
11452
  {
10355
11453
  value: searchValue,
@@ -10362,22 +11460,22 @@ function MatrxDataTableCore({
10362
11460
  style: { fontSize: "16px" }
10363
11461
  }
10364
11462
  ),
10365
- searchValue ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
10366
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11463
+ searchValue ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
11464
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10367
11465
  "button",
10368
11466
  {
10369
11467
  type: "button",
10370
11468
  "aria-label": "Clear search",
10371
11469
  className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
10372
11470
  onClick: () => setSearchValue(""),
10373
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(X, { className: "h-5 w-5" })
11471
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(X, { className: "h-5 w-5" })
10374
11472
  }
10375
11473
  ) }),
10376
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: "Clear search" })
11474
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "Clear search" })
10377
11475
  ] }) : null
10378
11476
  ] }),
10379
- toolbar?.searchMatch ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
10380
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11477
+ toolbar?.searchMatch ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
11478
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10381
11479
  Button,
10382
11480
  {
10383
11481
  type: "button",
@@ -10390,18 +11488,18 @@ function MatrxDataTableCore({
10390
11488
  searchMatchMode === "whole_words" ? "contains" : "whole_words"
10391
11489
  ),
10392
11490
  children: [
10393
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(WholeWord, { className: "h-5 w-5" }),
11491
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(WholeWord, { className: "h-5 w-5" }),
10394
11492
  searchMatchMode === "whole_words" ? "Whole words" : "Contains"
10395
11493
  ]
10396
11494
  }
10397
11495
  ) }),
10398
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: searchMatchMode === "whole_words" ? "Whole words \u2014 click to match text anywhere" : "Contains text \u2014 click to require whole words" })
11496
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: searchMatchMode === "whole_words" ? "Whole words \u2014 click to match text anywhere" : "Contains text \u2014 click to require whole words" })
10399
11497
  ] }) : null
10400
11498
  ]
10401
11499
  }
10402
11500
  ) : null,
10403
11501
  children: [
10404
- toolbar?.layeredFilters ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11502
+ toolbar?.layeredFilters ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10405
11503
  LayeredFilterBuilder,
10406
11504
  {
10407
11505
  fields: toolbar.layeredFilters.fields,
@@ -10411,9 +11509,9 @@ function MatrxDataTableCore({
10411
11509
  label: toolbar.layeredFilters.label
10412
11510
  }
10413
11511
  ) : null,
10414
- toolbar?.anyOf ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "relative w-full max-w-xs", children: [
10415
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Search, { className: "absolute left-2 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground" }),
10416
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11512
+ toolbar?.anyOf ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative w-full max-w-xs", children: [
11513
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Search, { className: "absolute left-2 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground" }),
11514
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10417
11515
  Input,
10418
11516
  {
10419
11517
  value: anyOfValue,
@@ -10423,22 +11521,22 @@ function MatrxDataTableCore({
10423
11521
  style: { fontSize: "16px" }
10424
11522
  }
10425
11523
  ),
10426
- anyOfValue ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
10427
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11524
+ anyOfValue ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
11525
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10428
11526
  "button",
10429
11527
  {
10430
11528
  type: "button",
10431
11529
  "aria-label": "Clear match-any search",
10432
11530
  className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
10433
11531
  onClick: () => setAnyOfValue(""),
10434
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(X, { className: "h-5 w-5" })
11532
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(X, { className: "h-5 w-5" })
10435
11533
  }
10436
11534
  ) }),
10437
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: "Clear match-any search" })
11535
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "Clear match-any search" })
10438
11536
  ] }) : null
10439
11537
  ] }) : null,
10440
- renderedFacets ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ToolbarFacets, { facets: renderedFacets }) : null,
10441
- toolbar?.leading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11538
+ renderedFacets ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ToolbarFacets, { facets: renderedFacets }) : null,
11539
+ toolbar?.leading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10442
11540
  "div",
10443
11541
  {
10444
11542
  "data-matrx-table-toolbar-extras": true,
@@ -10446,13 +11544,13 @@ function MatrxDataTableCore({
10446
11544
  children: toolbar.leading
10447
11545
  }
10448
11546
  ) : null,
10449
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11547
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10450
11548
  "div",
10451
11549
  {
10452
11550
  "data-matrx-table-actions": true,
10453
11551
  className: "ml-auto flex min-w-0 flex-wrap items-center gap-0",
10454
11552
  children: [
10455
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11553
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10456
11554
  TableToolbarAction,
10457
11555
  {
10458
11556
  HostAction: host.ToolbarAction,
@@ -10460,10 +11558,10 @@ function MatrxDataTableCore({
10460
11558
  tooltip: hasActiveFilters ? "Clear search and filters; keep columns and sort" : "No search or filters to clear",
10461
11559
  disabled: !hasActiveFilters,
10462
11560
  onClick: clearAllFilters,
10463
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Eraser, {})
11561
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Eraser, {})
10464
11562
  }
10465
11563
  ),
10466
- showToolbarCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11564
+ showToolbarCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10467
11565
  CopyButtons,
10468
11566
  {
10469
11567
  size: "toolbar",
@@ -10506,17 +11604,17 @@ function MatrxDataTableCore({
10506
11604
  }
10507
11605
  }
10508
11606
  ) : null,
10509
- columns.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11607
+ columns.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10510
11608
  TableToolbarAction,
10511
11609
  {
10512
11610
  HostAction: host.ToolbarAction,
10513
11611
  ariaLabel: "Columns",
10514
11612
  tooltip: "Show, hide, or reorder columns",
10515
11613
  onClick: () => setColumnManagerOpen(true),
10516
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SlidersHorizontal, {})
11614
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SlidersHorizontal, {})
10517
11615
  }
10518
11616
  ) : null,
10519
- toolbar?.refresh ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11617
+ toolbar?.refresh ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10520
11618
  TableToolbarAction,
10521
11619
  {
10522
11620
  HostAction: host.ToolbarAction,
@@ -10538,10 +11636,10 @@ function MatrxDataTableCore({
10538
11636
  setToolbarActionPending((current) => ({ ...current, refresh: false }));
10539
11637
  });
10540
11638
  },
10541
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(RefreshControlIcon, { spinning: isFetching || toolbarActionPending.refresh })
11639
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RefreshControlIcon, { spinning: isFetching || toolbarActionPending.refresh })
10542
11640
  }
10543
11641
  ) : null,
10544
- toolbar?.add ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11642
+ toolbar?.add ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10545
11643
  TableToolbarAction,
10546
11644
  {
10547
11645
  HostAction: host.ToolbarAction,
@@ -10563,7 +11661,7 @@ function MatrxDataTableCore({
10563
11661
  setToolbarActionPending((current) => ({ ...current, add: false }));
10564
11662
  });
10565
11663
  },
10566
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Plus, {})
11664
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Plus, {})
10567
11665
  }
10568
11666
  ) : null,
10569
11667
  toolbar?.actions
@@ -10573,15 +11671,15 @@ function MatrxDataTableCore({
10573
11671
  ]
10574
11672
  }
10575
11673
  ),
10576
- selection && selectionCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex shrink-0 flex-wrap items-center gap-2 rounded-md border border-primary/30 bg-primary/5 px-2 py-1.5", children: [
10577
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "text-xs font-medium text-foreground", children: [
10578
- (0, import_format3.formatCount)(selectionCount),
11674
+ selection && selectionCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex shrink-0 flex-wrap items-center gap-2 rounded-md border border-primary/30 bg-primary/5 px-2 py-1.5", children: [
11675
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "text-xs font-medium text-foreground", children: [
11676
+ (0, import_format5.formatCount)(selectionCount),
10579
11677
  " ",
10580
11678
  selectionNoun,
10581
11679
  selectionCount === 1 ? "" : "s",
10582
11680
  " selected"
10583
11681
  ] }),
10584
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11682
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10585
11683
  Button,
10586
11684
  {
10587
11685
  type: "button",
@@ -10593,13 +11691,13 @@ function MatrxDataTableCore({
10593
11691
  selection.onSelectedIdsChange([]);
10594
11692
  },
10595
11693
  children: [
10596
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(X, { className: "h-3.5 w-3.5" }),
11694
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(X, { className: "h-3.5 w-3.5" }),
10597
11695
  "Clear"
10598
11696
  ]
10599
11697
  }
10600
11698
  ),
10601
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "ml-auto flex flex-wrap items-center gap-1.5", children: [
10602
- effectiveCopy && selectedRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11699
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "ml-auto flex flex-wrap items-center gap-1.5", children: [
11700
+ effectiveCopy && selectedRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10603
11701
  CopyButtons,
10604
11702
  {
10605
11703
  size: "icon",
@@ -10632,9 +11730,9 @@ function MatrxDataTableCore({
10632
11730
  selection.actions?.(selectedRows, selection.selectedIds)
10633
11731
  ] })
10634
11732
  ] }) : null,
10635
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { "data-matrx-table-body-region": true, className: "flex min-h-0 flex-1 flex-col gap-2", children: [
10636
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "relative min-h-0 flex-1", children: [
10637
- mobileCards ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11733
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { "data-matrx-table-body-region": true, className: "flex min-h-0 flex-1 flex-col gap-2", children: [
11734
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative min-h-0 flex-1", children: [
11735
+ mobileCards ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10638
11736
  "div",
10639
11737
  {
10640
11738
  ref: cardsScrollRef,
@@ -10646,34 +11744,34 @@ function MatrxDataTableCore({
10646
11744
  mobileCardsClass
10647
11745
  ),
10648
11746
  children: [
10649
- isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11747
+ isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10650
11748
  "div",
10651
11749
  {
10652
11750
  role: "status",
10653
11751
  className: "pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 overflow-hidden bg-primary/15",
10654
11752
  children: [
10655
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
10656
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
11753
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
11754
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
10657
11755
  ]
10658
11756
  }
10659
11757
  ) : null,
10660
- isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11758
+ isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10661
11759
  Skeleton,
10662
11760
  {
10663
11761
  className: "h-52 w-full shrink-0 rounded-lg"
10664
11762
  },
10665
11763
  `mobile-card-sk-${index}`
10666
- )) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex min-h-48 flex-1 items-center justify-center px-4 py-12 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex max-w-sm flex-col items-center gap-2", children: [
11764
+ )) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex min-h-48 flex-1 items-center justify-center px-4 py-12 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex max-w-sm flex-col items-center gap-2", children: [
10667
11765
  renderedEmptyState?.icon,
10668
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm font-medium text-foreground", children: renderedEmptyState?.title ?? "No rows" }),
10669
- renderedEmptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-xs text-muted-foreground", children: renderedEmptyState.description }) : null,
11766
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-sm font-medium text-foreground", children: renderedEmptyState?.title ?? "No rows" }),
11767
+ renderedEmptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs text-muted-foreground", children: renderedEmptyState.description }) : null,
10670
11768
  renderedEmptyState?.action
10671
11769
  ] }) }) : paginated.map((row, index) => {
10672
11770
  const id = getRowId(row);
10673
11771
  const displayRow = applyRowEdits(row, edits[id]);
10674
11772
  const controls = buildRecordControls(displayRow);
10675
11773
  const selectable = selection?.isRowSelectable?.(row) ?? Boolean(selection);
10676
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { "data-row-id": id, className: "contents", children: mobileCards(displayRow, index, {
11774
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { "data-row-id": id, className: "contents", children: mobileCards(displayRow, index, {
10677
11775
  renderCell: (columnKey) => {
10678
11776
  const column = columns.find((candidate) => columnId(candidate) === columnKey);
10679
11777
  return column ? renderRecordCell(row, column, index) : null;
@@ -10689,14 +11787,14 @@ function MatrxDataTableCore({
10689
11787
  else next.delete(id);
10690
11788
  setSelectedIds(next);
10691
11789
  },
10692
- actions: showInlineRowCopy || rowActions ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11790
+ actions: showInlineRowCopy || rowActions ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10693
11791
  "div",
10694
11792
  {
10695
11793
  "data-matrx-table-row-actions": true,
10696
11794
  className: "inline-flex items-center justify-end gap-0",
10697
11795
  onClick: (event) => event.stopPropagation(),
10698
11796
  children: [
10699
- showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11797
+ showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10700
11798
  TableRowCopyControl,
10701
11799
  {
10702
11800
  size: "toolbar",
@@ -10717,7 +11815,7 @@ function MatrxDataTableCore({
10717
11815
  expandedDetail: expandedDetail && isRowExpanded(row) ? expandedDetail.render(displayRow, controls) : null
10718
11816
  }) }, id);
10719
11817
  }),
10720
- appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11818
+ appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10721
11819
  "div",
10722
11820
  {
10723
11821
  "data-matrx-table-append-loading-card": true,
@@ -10725,7 +11823,7 @@ function MatrxDataTableCore({
10725
11823
  "aria-live": "polite",
10726
11824
  className: "sticky bottom-0 z-20 flex h-16 w-full max-w-[100cqw] shrink-0 items-center justify-center gap-2 rounded-md border border-border bg-card/95 px-3 text-sm font-medium text-foreground shadow-sm backdrop-blur-sm",
10727
11825
  children: [
10728
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11826
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10729
11827
  Loader2,
10730
11828
  {
10731
11829
  "aria-hidden": "true",
@@ -10739,7 +11837,7 @@ function MatrxDataTableCore({
10739
11837
  ]
10740
11838
  }
10741
11839
  ) : null,
10742
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11840
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10743
11841
  "div",
10744
11842
  {
10745
11843
  ref: scrollRef,
@@ -10753,32 +11851,32 @@ function MatrxDataTableCore({
10753
11851
  tableClassName
10754
11852
  ),
10755
11853
  children: [
10756
- hierarchy && draggedRow ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11854
+ hierarchy && draggedRow ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10757
11855
  HierarchyRootDropTarget,
10758
11856
  {
10759
11857
  label: hierarchy.rootDropLabel ?? "Drop here to move to the top level",
10760
11858
  draggedLabel: hierarchy.itemLabel?.(draggedRow) ?? "Moving row"
10761
11859
  }
10762
11860
  ) : null,
10763
- hierarchy && draggedRowId ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11861
+ hierarchy && draggedRowId ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10764
11862
  HierarchyDragIndicatorLayer,
10765
11863
  {
10766
11864
  scrollRef,
10767
11865
  resolve: resolveHierarchyMove
10768
11866
  }
10769
11867
  ) : null,
10770
- isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11868
+ isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10771
11869
  "div",
10772
11870
  {
10773
11871
  role: "status",
10774
11872
  className: "pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 overflow-hidden bg-primary/15",
10775
11873
  children: [
10776
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
10777
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
11874
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
11875
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
10778
11876
  ]
10779
11877
  }
10780
11878
  ) : null,
10781
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11879
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10782
11880
  "table",
10783
11881
  {
10784
11882
  ref: tableRef,
@@ -10796,7 +11894,7 @@ function MatrxDataTableCore({
10796
11894
  fixedLayoutActive && "sm:table-fixed sm:max-w-none sm:w-[var(--matrx-resized-table-width)]"
10797
11895
  ),
10798
11896
  children: [
10799
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11897
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10800
11898
  "thead",
10801
11899
  {
10802
11900
  ref: tableHeaderRef,
@@ -10805,14 +11903,14 @@ function MatrxDataTableCore({
10805
11903
  "z-10 border-b border-border bg-muted/90 shadow-[0_1px_0_0_var(--border)] backdrop-blur-sm",
10806
11904
  stickyHeader && (documentStickyHeader ? "relative translate-y-[var(--matrx-document-sticky-offset)]" : "sticky top-0")
10807
11905
  ),
10808
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("tr", { children: [
10809
- selection ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11906
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tr", { children: [
11907
+ selection ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10810
11908
  "th",
10811
11909
  {
10812
11910
  "data-matrx-table-selection-column": true,
10813
11911
  className: "h-9 w-9 px-2 text-left align-middle",
10814
11912
  style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth),
10815
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11913
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10816
11914
  "div",
10817
11915
  {
10818
11916
  "data-matrx-table-selection-target": true,
@@ -10821,7 +11919,7 @@ function MatrxDataTableCore({
10821
11919
  event.currentTarget.querySelector('[role="checkbox"]')?.click();
10822
11920
  }
10823
11921
  },
10824
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11922
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10825
11923
  Checkbox,
10826
11924
  {
10827
11925
  className: CHECKBOX_TAP_AREA,
@@ -10847,7 +11945,7 @@ function MatrxDataTableCore({
10847
11945
  const compact = col.compact || marker !== void 0;
10848
11946
  const width = marker && col.width === void 0 ? 40 : col.width;
10849
11947
  const minWidth = marker && col.minWidth === void 0 ? 40 : col.minWidth;
10850
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
11948
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10851
11949
  "th",
10852
11950
  {
10853
11951
  "data-matrx-table-column-id": id,
@@ -10872,12 +11970,17 @@ function MatrxDataTableCore({
10872
11970
  (width !== void 0 || columnResizable) && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)]",
10873
11971
  col.headerClassName,
10874
11972
  isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
10875
- col.align === "center" && "text-center",
10876
- col.align === "right" && "text-right"
11973
+ alignForFormat(col) === "center" && "text-center",
11974
+ alignForFormat(col) === "right" && "text-right",
11975
+ frozenColumns.offsets[id] !== void 0 && FROZEN_HEADER_CLASS,
11976
+ frozenEdgeId === id && FROZEN_EDGE_CLASS
10877
11977
  ),
10878
- style: columnWidthVar(width, effectiveColumnWidths[id], id, columnResizable),
11978
+ style: {
11979
+ ...columnWidthVar(width, effectiveColumnWidths[id], id, columnResizable),
11980
+ ...frozenStyle(id)
11981
+ },
10879
11982
  children: [
10880
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ColumnHeaderDropZone, { id, enabled: reorderableColumns, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
11983
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ColumnHeaderDropZone, { id, enabled: reorderableColumns, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10881
11984
  ColumnHeaderCell,
10882
11985
  {
10883
11986
  label: col.header,
@@ -10916,7 +12019,7 @@ function MatrxDataTableCore({
10916
12019
  reorderColumn: reorderableColumns ? { id, label: headerLabel } : void 0
10917
12020
  }
10918
12021
  ) }),
10919
- columnResizable ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12022
+ columnResizable ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10920
12023
  ColumnResizeHandle,
10921
12024
  {
10922
12025
  columnId: id,
@@ -10937,22 +12040,22 @@ function MatrxDataTableCore({
10937
12040
  id
10938
12041
  );
10939
12042
  }),
10940
- showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12043
+ showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10941
12044
  "th",
10942
12045
  {
10943
12046
  "data-matrx-table-actions-column": true,
10944
12047
  className: "h-9 w-px whitespace-nowrap px-2 text-right align-middle text-xs font-semibold uppercase tracking-wide text-muted-foreground",
10945
12048
  style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
10946
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-matrx-table-actions-label": true, className: "inline-block whitespace-nowrap", children: "Actions" })
12049
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-matrx-table-actions-label": true, className: "inline-block whitespace-nowrap", children: "Actions" })
10947
12050
  }
10948
12051
  )
10949
12052
  ] })
10950
12053
  }
10951
12054
  ),
10952
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("tbody", { children: [
10953
- isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("tr", { className: "border-b border-border/60", children: [
10954
- selection ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("td", { className: "px-2 py-2", style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Skeleton, { className: "h-3.5 w-3.5" }) }) : null,
10955
- visibleColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12055
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tbody", { children: [
12056
+ isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tr", { className: "border-b border-border/60", children: [
12057
+ selection ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", { className: "px-2 py-2", style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { className: "h-3.5 w-3.5" }) }) : null,
12058
+ visibleColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10956
12059
  "td",
10957
12060
  {
10958
12061
  className: cn(
@@ -10960,20 +12063,20 @@ function MatrxDataTableCore({
10960
12063
  col.compact || resolveColumnMarker(col) !== void 0 ? "px-1" : "px-2",
10961
12064
  col.mobileHidden && "max-sm:hidden"
10962
12065
  ),
10963
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Skeleton, { className: "h-5 w-full" })
12066
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { className: "h-5 w-full" })
10964
12067
  },
10965
12068
  columnId(col)
10966
12069
  )),
10967
- showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("td", { className: "text-right align-middle", style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Skeleton, { className: "ml-auto h-5 w-10" }) })
10968
- ] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12070
+ showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", { className: "text-right align-middle", style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Skeleton, { className: "ml-auto h-5 w-10" }) })
12071
+ ] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
10969
12072
  "td",
10970
12073
  {
10971
12074
  colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
10972
12075
  className: "px-0 py-12 text-center",
10973
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { "data-matrx-table-empty-state": true, className: "sticky left-0 flex flex-col items-center gap-2 whitespace-normal px-4", style: { width: "100cqw", maxWidth: "100%" }, children: [
12076
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { "data-matrx-table-empty-state": true, className: "sticky left-0 flex flex-col items-center gap-2 whitespace-normal px-4", style: { width: "100cqw", maxWidth: "100%" }, children: [
10974
12077
  renderedEmptyState?.icon,
10975
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm font-medium text-foreground", children: renderedEmptyState?.title ?? "No rows" }),
10976
- renderedEmptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-xs text-muted-foreground", children: renderedEmptyState.description }) : null,
12078
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-sm font-medium text-foreground", children: renderedEmptyState?.title ?? "No rows" }),
12079
+ renderedEmptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs text-muted-foreground", children: renderedEmptyState.description }) : null,
10977
12080
  renderedEmptyState?.action
10978
12081
  ] })
10979
12082
  }
@@ -10984,7 +12087,7 @@ function MatrxDataTableCore({
10984
12087
  const displayRow = applyRowEdits(row, rowEdits);
10985
12088
  const controls = buildRecordControls(displayRow);
10986
12089
  const isChecked = selectedIdSet.has(id);
10987
- const rowNode = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12090
+ const rowNode = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
10988
12091
  "tr",
10989
12092
  {
10990
12093
  "data-row-id": id,
@@ -11017,16 +12120,28 @@ function MatrxDataTableCore({
11017
12120
  highlightedIndex === index && "bg-muted ring-1 ring-inset ring-primary/60",
11018
12121
  rowClassName?.(row, index),
11019
12122
  draggedRowId === id && "opacity-40",
11020
- zebra && index % 2 === 1 && !isSelected && !isChecked && "sm:bg-muted/20"
12123
+ zebra && index % 2 === 1 && !isSelected && !isChecked && "sm:bg-muted/20",
12124
+ // LAST so a colored row STAYS colored while selected
12125
+ // and on an odd zebra stripe — `cn` is tailwind-merge
12126
+ // and keeps the last background of a group. The
12127
+ // checkbox already says the row is selected; the tint
12128
+ // is the only thing saying WHY the row matters.
12129
+ rowTintClass(row, id)
11021
12130
  ),
11022
12131
  children: [
11023
- selection ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12132
+ selection ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11024
12133
  "td",
11025
12134
  {
11026
- className: "px-2 py-1.5 align-middle lg:py-0.5",
12135
+ className: cn(
12136
+ "px-2 py-1.5 align-middle lg:py-0.5",
12137
+ // When a data column is frozen the checkbox
12138
+ // column has to freeze with it, or the first
12139
+ // frozen column slides over the checkboxes.
12140
+ frozenColumns.selectionOffset !== null && "sm:sticky sm:left-0 sm:z-20 sm:bg-inherit"
12141
+ ),
11027
12142
  style: fixedUtilityWidth(fixedTableGeometry?.selectionWidth),
11028
12143
  onClick: (e) => e.stopPropagation(),
11029
- children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12144
+ children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11030
12145
  "div",
11031
12146
  {
11032
12147
  "data-matrx-table-selection-target": true,
@@ -11035,7 +12150,7 @@ function MatrxDataTableCore({
11035
12150
  event.currentTarget.querySelector('[role="checkbox"]')?.click();
11036
12151
  }
11037
12152
  },
11038
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12153
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11039
12154
  Checkbox,
11040
12155
  {
11041
12156
  className: CHECKBOX_TAP_AREA,
@@ -11050,7 +12165,7 @@ function MatrxDataTableCore({
11050
12165
  ) : null,
11051
12166
  visibleColumns.map((col, colIdx) => {
11052
12167
  const isColumnDragShadow = columnDragPreview?.draggedId === columnId(col) && columnDragPreview.targetId !== null;
11053
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12168
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11054
12169
  "td",
11055
12170
  {
11056
12171
  "data-matrx-table-column-id": columnId(col),
@@ -11065,23 +12180,33 @@ function MatrxDataTableCore({
11065
12180
  ((resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width) !== void 0 || resizableColumns && col.resizable !== false) && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)] sm:max-w-[var(--matrx-col-w)]",
11066
12181
  col.className,
11067
12182
  isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
11068
- col.align === "center" && "text-center",
11069
- col.align === "right" && "text-right"
11070
- ),
11071
- style: columnWidthVar(
11072
- resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width,
11073
- effectiveColumnWidths[columnId(col)],
11074
- columnId(col),
11075
- resizableColumns && col.resizable !== false
12183
+ alignForFormat(col) === "center" && "text-center",
12184
+ alignForFormat(col) === "right" && "text-right",
12185
+ frozenColumns.offsets[columnId(col)] !== void 0 && FROZEN_CELL_CLASS,
12186
+ frozenEdgeId === columnId(col) && FROZEN_EDGE_CLASS,
12187
+ // A cell tint paints OVER the row tint beneath
12188
+ // it, and the consumer's own hook comes last so
12189
+ // it can always win.
12190
+ cellTintClass(row, id, columnId(col)),
12191
+ cellClassName?.(row, columnId(col), index)
11076
12192
  ),
11077
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12193
+ style: {
12194
+ ...columnWidthVar(
12195
+ resolveColumnMarker(col) && col.width === void 0 ? 40 : col.width,
12196
+ effectiveColumnWidths[columnId(col)],
12197
+ columnId(col),
12198
+ resizableColumns && col.resizable !== false
12199
+ ),
12200
+ ...frozenStyle(columnId(col))
12201
+ },
12202
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11078
12203
  "div",
11079
12204
  {
11080
12205
  className: cn(
11081
12206
  colIdx === 0 && hierarchy && "flex min-w-0 items-center"
11082
12207
  ),
11083
12208
  children: [
11084
- colIdx === 0 && hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12209
+ colIdx === 0 && hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11085
12210
  HierarchyDragHandle,
11086
12211
  {
11087
12212
  id,
@@ -11089,7 +12214,7 @@ function MatrxDataTableCore({
11089
12214
  disabled: !(hierarchy.canReparent?.(row) ?? true)
11090
12215
  }
11091
12216
  ) : null,
11092
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12217
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11093
12218
  "div",
11094
12219
  {
11095
12220
  "data-matrx-cell-content": true,
@@ -11104,20 +12229,20 @@ function MatrxDataTableCore({
11104
12229
  columnId(col)
11105
12230
  );
11106
12231
  }),
11107
- showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12232
+ showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11108
12233
  "td",
11109
12234
  {
11110
12235
  "data-matrx-table-row-action-cell": true,
11111
12236
  className: "text-right align-middle",
11112
12237
  style: fixedUtilityWidth(fixedTableGeometry?.actionsWidth),
11113
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12238
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11114
12239
  "div",
11115
12240
  {
11116
12241
  "data-matrx-table-row-actions": true,
11117
12242
  className: "inline-flex items-center justify-end gap-0",
11118
12243
  onClick: (e) => e.stopPropagation(),
11119
12244
  children: [
11120
- showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12245
+ showInlineRowCopy && effectiveCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11121
12246
  TableRowCopyControl,
11122
12247
  {
11123
12248
  size: "toolbar",
@@ -11128,8 +12253,8 @@ function MatrxDataTableCore({
11128
12253
  }
11129
12254
  ) : null,
11130
12255
  renderRowActions(displayRow, controls),
11131
- windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11132
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12256
+ windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
12257
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11133
12258
  Button,
11134
12259
  {
11135
12260
  type: "button",
@@ -11143,10 +12268,10 @@ function MatrxDataTableCore({
11143
12268
  if (windowConfig?.openOnRowClick === true) openDetail(row);
11144
12269
  else openWindow(row);
11145
12270
  },
11146
- children: opensWindowOnRowClick ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRightOpen, { className: "h-5 w-5" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { className: "h-5 w-5" })
12271
+ children: opensWindowOnRowClick ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRightOpen, { className: "h-5 w-5" }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRight, { className: "h-5 w-5" })
11147
12272
  }
11148
12273
  ) }),
11149
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window" })
12274
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: windowConfig?.openOnRowClick === true ? "Open in side panel" : "Open in window" })
11150
12275
  ] }) : null
11151
12276
  ]
11152
12277
  }
@@ -11158,12 +12283,12 @@ function MatrxDataTableCore({
11158
12283
  id
11159
12284
  );
11160
12285
  const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
11161
- const inlineDetail = expandedDetail && isRowExpanded(row) ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12286
+ const inlineDetail = expandedDetail && isRowExpanded(row) ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11162
12287
  "tr",
11163
12288
  {
11164
12289
  "data-matrx-table-expanded-detail": id,
11165
12290
  className: cn("bg-muted/20", expandedDetail.className),
11166
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12291
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11167
12292
  "td",
11168
12293
  {
11169
12294
  colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
@@ -11174,8 +12299,8 @@ function MatrxDataTableCore({
11174
12299
  },
11175
12300
  `${id}:expanded-detail`
11176
12301
  ) : null;
11177
- return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react20.Fragment, { children: [
11178
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12302
+ return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react20.Fragment, { children: [
12303
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11179
12304
  HierarchyDroppableRow,
11180
12305
  {
11181
12306
  id,
@@ -11184,24 +12309,24 @@ function MatrxDataTableCore({
11184
12309
  }
11185
12310
  ),
11186
12311
  inlineDetail
11187
- ] }, id) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react20.Fragment, { children: [
12312
+ ] }, id) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react20.Fragment, { children: [
11188
12313
  wrappedRow,
11189
12314
  inlineDetail
11190
12315
  ] }, id);
11191
12316
  }),
11192
- appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12317
+ appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11193
12318
  "td",
11194
12319
  {
11195
12320
  colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
11196
12321
  className: "sticky bottom-0 z-20 h-16 border-y border-border bg-card/95 px-0 py-0 text-left shadow-sm backdrop-blur-sm",
11197
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12322
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11198
12323
  "div",
11199
12324
  {
11200
12325
  role: "status",
11201
12326
  "aria-live": "polite",
11202
12327
  className: "sticky left-0 flex h-16 w-fit max-w-[100cqw] items-center justify-center gap-2 px-3 text-sm font-medium text-foreground",
11203
12328
  children: [
11204
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12329
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11205
12330
  Loader2,
11206
12331
  {
11207
12332
  "aria-hidden": "true",
@@ -11215,9 +12340,9 @@ function MatrxDataTableCore({
11215
12340
  }
11216
12341
  ) }) : null
11217
12342
  ] }),
11218
- footerRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tfoot", { className: "border-t-2 border-border bg-muted/50 font-semibold", children: footerRows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("tr", { children: [
11219
- selection ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("td", { className: "px-2 py-2" }) : null,
11220
- visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12343
+ footerRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tfoot", { className: "border-t-2 border-border bg-muted/50 font-semibold", children: footerRows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("tr", { children: [
12344
+ selection ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", { className: "px-2 py-2" }) : null,
12345
+ visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11221
12346
  "td",
11222
12347
  {
11223
12348
  className: cn(
@@ -11237,7 +12362,7 @@ function MatrxDataTableCore({
11237
12362
  },
11238
12363
  columnId(column)
11239
12364
  )),
11240
- showActionsCol ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("td", {}) : null
12365
+ showActionsCol ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("td", {}) : null
11241
12366
  ] }, `footer-${index}`)) }) : null
11242
12367
  ]
11243
12368
  }
@@ -11245,8 +12370,8 @@ function MatrxDataTableCore({
11245
12370
  ]
11246
12371
  }
11247
12372
  ),
11248
- scrollHintLeft ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11249
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12373
+ scrollHintLeft ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
12374
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11250
12375
  Button,
11251
12376
  {
11252
12377
  type: "button",
@@ -11257,13 +12382,13 @@ function MatrxDataTableCore({
11257
12382
  "data-matrx-table-scroll-control": "left",
11258
12383
  className: "absolute left-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
11259
12384
  onClick: () => scrollTableHorizontally("left"),
11260
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronLeft, { className: "h-5 w-5" })
12385
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ChevronLeft, { className: "h-5 w-5" })
11261
12386
  }
11262
12387
  ) }),
11263
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: "More columns to the left" })
12388
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "More columns to the left" })
11264
12389
  ] }) : null,
11265
- scrollHintRight ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11266
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12390
+ scrollHintRight ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
12391
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11267
12392
  Button,
11268
12393
  {
11269
12394
  type: "button",
@@ -11274,26 +12399,26 @@ function MatrxDataTableCore({
11274
12399
  "data-matrx-table-scroll-control": "right",
11275
12400
  className: "absolute right-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
11276
12401
  onClick: () => scrollTableHorizontally("right"),
11277
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ChevronRight, { className: "h-5 w-5" })
12402
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ChevronRight, { className: "h-5 w-5" })
11278
12403
  }
11279
12404
  ) }),
11280
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: "More columns to the right" })
12405
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "More columns to the right" })
11281
12406
  ] }) : null
11282
12407
  ] }),
11283
- appendQuery ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12408
+ appendQuery ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11284
12409
  "div",
11285
12410
  {
11286
12411
  "data-matrx-table-footer": true,
11287
12412
  className: "flex min-h-8 shrink-0 flex-wrap items-center gap-2 border-t border-border",
11288
12413
  "aria-busy": isLoading || isFetching,
11289
12414
  children: [
11290
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12415
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11291
12416
  "div",
11292
12417
  {
11293
12418
  ...isFetching && !isLoading ? {} : { role: "status", "aria-live": "polite" },
11294
12419
  className: "flex w-full min-w-0 items-center gap-2 text-xs text-muted-foreground sm:w-auto sm:flex-1",
11295
12420
  children: [
11296
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12421
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11297
12422
  Loader2,
11298
12423
  {
11299
12424
  "data-matrx-table-append-loader": true,
@@ -11301,21 +12426,21 @@ function MatrxDataTableCore({
11301
12426
  className: "h-5 w-5 shrink-0 animate-spin text-primary motion-reduce:animate-none"
11302
12427
  }
11303
12428
  ) : null,
11304
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2", children: [
11305
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "min-w-0 break-words font-medium text-foreground", children: isLoading ? "Loading rows\u2026" : appendQuery.pagination.sourceRecords ? `${(0, import_format3.formatCount)(processed.length)} ${appendQuery.pagination.sourceRecords.rowLabel}${appendQuery.pagination.sourceRecords.matchedRecords === void 0 ? "" : ` (${(0, import_format3.formatCount)(appendQuery.pagination.sourceRecords.matchedRecords)} matching ${appendQuery.pagination.sourceRecords.label})`} \xB7 ${(0, import_format3.formatCount)(appendQuery.pagination.sourceRecords.loaded)}${appendQuery.pagination.sourceRecords.total === void 0 ? "" : ` / ${(0, import_format3.formatCount)(appendQuery.pagination.sourceRecords.total)}`} ${appendQuery.pagination.sourceRecords.label} loaded` : `${(0, import_format3.formatCount)(data.length)} loaded${appendQuery.pagination.totalItems === void 0 ? "" : ` of ${(0, import_format3.formatCount)(appendQuery.pagination.totalItems)}`}` }),
11306
- appendQuery.pagination.sourceUntil || appendUsesLocalProcessing ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11307
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", "aria-label": "Source coverage", className: "shrink-0 text-xs text-muted-foreground underline decoration-dotted underline-offset-4", children: "Source info" }) }),
11308
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(TooltipContent, { children: [
11309
- appendQuery.pagination.sourceUntil ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { children: [
12429
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2", children: [
12430
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "min-w-0 break-words font-medium text-foreground", children: isLoading ? "Loading rows\u2026" : appendQuery.pagination.sourceRecords ? `${(0, import_format5.formatCount)(processed.length)} ${appendQuery.pagination.sourceRecords.rowLabel}${appendQuery.pagination.sourceRecords.matchedRecords === void 0 ? "" : ` (${(0, import_format5.formatCount)(appendQuery.pagination.sourceRecords.matchedRecords)} matching ${appendQuery.pagination.sourceRecords.label})`} \xB7 ${(0, import_format5.formatCount)(appendQuery.pagination.sourceRecords.loaded)}${appendQuery.pagination.sourceRecords.total === void 0 ? "" : ` / ${(0, import_format5.formatCount)(appendQuery.pagination.sourceRecords.total)}`} ${appendQuery.pagination.sourceRecords.label} loaded` : `${(0, import_format5.formatCount)(data.length)} loaded${appendQuery.pagination.totalItems === void 0 ? "" : ` of ${(0, import_format5.formatCount)(appendQuery.pagination.totalItems)}`}` }),
12431
+ appendQuery.pagination.sourceUntil || appendUsesLocalProcessing ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
12432
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", "aria-label": "Source coverage", className: "shrink-0 text-xs text-muted-foreground underline decoration-dotted underline-offset-4", children: "Source info" }) }),
12433
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(TooltipContent, { children: [
12434
+ appendQuery.pagination.sourceUntil ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { children: [
11310
12435
  "Source fixed through ",
11311
12436
  new Date(appendQuery.pagination.sourceUntil).toLocaleString(),
11312
12437
  "."
11313
12438
  ] }) : null,
11314
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { children: !isLoading && !isFetching && !appendQuery.pagination.loadAll?.isLoading && !scrollPagination.error && !appendQuery.pagination.hasNextPage && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? "All source rows are loaded." : appendUsesLocalProcessing ? "Local search and filters cover loaded rows." : "Source paging is active." })
12439
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { children: !isLoading && !isFetching && !appendQuery.pagination.loadAll?.isLoading && !scrollPagination.error && !appendQuery.pagination.hasNextPage && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? "All source rows are loaded." : appendUsesLocalProcessing ? "Local search and filters cover loaded rows." : "Source paging is active." })
11315
12440
  ] })
11316
12441
  ] }) : null,
11317
- scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "alert", className: "text-destructive", children: scrollPagination.error.message }) : null,
11318
- appendScrollPolicy?.mode === "suspended" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { role: "status", children: [
12442
+ scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { role: "alert", className: "text-destructive", children: scrollPagination.error.message }) : null,
12443
+ appendScrollPolicy?.mode === "suspended" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { role: "status", children: [
11319
12444
  appendScrollPolicy.reason,
11320
12445
  " Load more remains available."
11321
12446
  ] }) : null
@@ -11323,26 +12448,26 @@ function MatrxDataTableCore({
11323
12448
  ]
11324
12449
  }
11325
12450
  ),
11326
- appendQuery.pagination.sourcePageSize ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12451
+ appendQuery.pagination.sourcePageSize ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11327
12452
  Select,
11328
12453
  {
11329
12454
  value: String(appendQuery.pagination.sourcePageSize.value),
11330
12455
  onValueChange: (value) => appendQuery.pagination.sourcePageSize?.onChange(Number(value)),
11331
12456
  children: [
11332
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12457
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11333
12458
  SelectTrigger,
11334
12459
  {
11335
12460
  "aria-label": "Rows per load",
11336
12461
  className: "h-8 min-w-20 shrink-0 rounded-md border border-border bg-card px-3 text-sm [&_svg]:size-5",
11337
12462
  disabled: isLoading || isFetching || appendQuery.pagination.loadAll?.isLoading,
11338
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectValue, {})
12463
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectValue, {})
11339
12464
  }
11340
12465
  ),
11341
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectContent, { children: appendQuery.pagination.sourcePageSize.options.map((size) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectItem, { value: String(size), children: size }, size)) })
12466
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectContent, { children: appendQuery.pagination.sourcePageSize.options.map((size) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SelectItem, { value: String(size), children: size }, size)) })
11342
12467
  ]
11343
12468
  }
11344
12469
  ) : null,
11345
- appendQuery.pagination.loadAll?.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12470
+ appendQuery.pagination.loadAll?.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11346
12471
  Button,
11347
12472
  {
11348
12473
  type: "button",
@@ -11351,7 +12476,7 @@ function MatrxDataTableCore({
11351
12476
  onClick: appendQuery.pagination.loadAll.stop,
11352
12477
  children: "Stop loading"
11353
12478
  }
11354
- ) : scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12479
+ ) : scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11355
12480
  Button,
11356
12481
  {
11357
12482
  type: "button",
@@ -11360,8 +12485,8 @@ function MatrxDataTableCore({
11360
12485
  onClick: appendQuery.pagination.retrySource ?? (appendQuery.pagination.hasNextPage ? appendQuery.pagination.loadNextPage : appendQuery.pagination.refresh),
11361
12486
  children: appendQuery.pagination.retrySource ? "Retry source" : appendQuery.pagination.hasNextPage ? "Retry" : "Reload rows"
11362
12487
  }
11363
- ) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-w-0 max-w-full flex-wrap gap-0", children: [
11364
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12488
+ ) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex min-w-0 max-w-full flex-wrap gap-0", children: [
12489
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11365
12490
  Button,
11366
12491
  {
11367
12492
  type: "button",
@@ -11372,7 +12497,7 @@ function MatrxDataTableCore({
11372
12497
  children: "Load more"
11373
12498
  }
11374
12499
  ),
11375
- appendQuery.pagination.loadAll ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12500
+ appendQuery.pagination.loadAll ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11376
12501
  Button,
11377
12502
  {
11378
12503
  type: "button",
@@ -11383,14 +12508,14 @@ function MatrxDataTableCore({
11383
12508
  children: "Load all"
11384
12509
  }
11385
12510
  ) : null
11386
- ] }) : !isLoading && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "min-w-0 max-w-full break-words whitespace-normal px-3 text-xs text-muted-foreground sm:text-sm", children: "All rows loaded" }) : null
12511
+ ] }) : !isLoading && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "min-w-0 max-w-full break-words whitespace-normal px-3 text-xs text-muted-foreground sm:text-sm", children: "All rows loaded" }) : null
11387
12512
  ]
11388
12513
  }
11389
- ) : !hidePagination && (totalItems > 0 || sourceTotal !== void 0) ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12514
+ ) : !hidePagination && (totalItems > 0 || sourceTotal !== void 0) ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11390
12515
  GenericTablePagination,
11391
12516
  {
11392
12517
  totalItems,
11393
- ...sourceTotal === void 0 ? {} : { labelFormat: (start, end, total) => `${(0, import_format3.formatCount)(start)}\u2013${(0, import_format3.formatCount)(end)} of ${(0, import_format3.formatCount)(total)} matching \xB7 ${(0, import_format3.formatCount)(data.length)} / ${(0, import_format3.formatCount)(sourceTotal)} loaded` },
12518
+ ...sourceTotal === void 0 ? {} : { labelFormat: (start, end, total) => `${(0, import_format5.formatCount)(start)}\u2013${(0, import_format5.formatCount)(end)} of ${(0, import_format5.formatCount)(total)} matching \xB7 ${(0, import_format5.formatCount)(data.length)} / ${(0, import_format5.formatCount)(sourceTotal)} loaded` },
11394
12519
  ...localProgressiveEnabled ? { progressive: {
11395
12520
  shownCount: progressiveRows.shownCount,
11396
12521
  loadedCount: data.length,
@@ -11413,7 +12538,7 @@ function MatrxDataTableCore({
11413
12538
  }
11414
12539
  ) }) : null
11415
12540
  ] }),
11416
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12541
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11417
12542
  ColumnManager,
11418
12543
  {
11419
12544
  open: columnManagerOpen,
@@ -11424,7 +12549,7 @@ function MatrxDataTableCore({
11424
12549
  onApply: commitColumnState
11425
12550
  }
11426
12551
  ),
11427
- detailEnabled && selectedRow ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12552
+ detailEnabled && selectedRow ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11428
12553
  SidePanelSurface,
11429
12554
  {
11430
12555
  title: resolveStringTitle(
@@ -11435,8 +12560,8 @@ function MatrxDataTableCore({
11435
12560
  description: detail?.description?.(selectedRow),
11436
12561
  onClose: () => setSelectedId(null),
11437
12562
  defaultWidth: detail?.defaultWidth ?? 480,
11438
- headerActions: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-1", children: [
11439
- effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12563
+ headerActions: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-1", children: [
12564
+ effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11440
12565
  TableRowCopyControl,
11441
12566
  {
11442
12567
  size: "icon",
@@ -11448,8 +12573,8 @@ function MatrxDataTableCore({
11448
12573
  }
11449
12574
  ) : null,
11450
12575
  detail?.headerActions?.(selectedRow),
11451
- windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11452
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12576
+ windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
12577
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11453
12578
  Button,
11454
12579
  {
11455
12580
  type: "button",
@@ -11459,10 +12584,10 @@ function MatrxDataTableCore({
11459
12584
  className: "h-7 w-7",
11460
12585
  "aria-label": "Open in window",
11461
12586
  onClick: () => openWindow(selectedRow),
11462
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRight, { className: "h-5 w-5" })
12587
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRight, { className: "h-5 w-5" })
11463
12588
  }
11464
12589
  ) }),
11465
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: "Open in window" })
12590
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "Open in window" })
11466
12591
  ] }) : null
11467
12592
  ] }),
11468
12593
  children: detail?.render ? (
@@ -11473,7 +12598,7 @@ function MatrxDataTableCore({
11473
12598
  // fixes the whole class at once — a custom body that already
11474
12599
  // scrolls (`h-full` + `overflow-y-auto` root) still resolves to
11475
12600
  // this container's height, so no second scrollbar appears.
11476
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "h-full min-h-0 overflow-y-auto", children: detail.render(selectedRow, {
12601
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "h-full min-h-0 overflow-y-auto", children: detail.render(selectedRow, {
11477
12602
  closeDetail: () => setSelectedId(null),
11478
12603
  openDetail: () => openDetail(selectedRow),
11479
12604
  openWindow: () => openWindow(selectedRow),
@@ -11481,7 +12606,7 @@ function MatrxDataTableCore({
11481
12606
  hasPendingEdits: Boolean(edits[getRowId(selectedRow)]),
11482
12607
  discardPendingEdits: () => discardRowEdits(getRowId(selectedRow))
11483
12608
  }) })
11484
- ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12609
+ ) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11485
12610
  DataRowInspector,
11486
12611
  {
11487
12612
  row: selectedRow,
@@ -11493,7 +12618,7 @@ function MatrxDataTableCore({
11493
12618
  )
11494
12619
  }
11495
12620
  ) : null,
11496
- windowRow ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12621
+ windowRow ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11497
12622
  DataRowWindow,
11498
12623
  {
11499
12624
  isOpen: true,
@@ -11504,9 +12629,9 @@ function MatrxDataTableCore({
11504
12629
  height: windowConfig?.height,
11505
12630
  windowId: `matrx-data-row-${urlState?.id ?? "local"}-${getRowId(windowRow)}`,
11506
12631
  defaultTab: windowConfig?.defaultTab,
11507
- headerActions: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-1", children: [
11508
- windowConfig?.openOnRowClick === true && detail?.enabled === true ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11509
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12632
+ headerActions: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-1", children: [
12633
+ windowConfig?.openOnRowClick === true && detail?.enabled === true ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
12634
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11510
12635
  Button,
11511
12636
  {
11512
12637
  type: "button",
@@ -11519,12 +12644,12 @@ function MatrxDataTableCore({
11519
12644
  closeWindow();
11520
12645
  openDetail(windowRow);
11521
12646
  },
11522
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PanelRightOpen, { className: "h-5 w-5" })
12647
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PanelRightOpen, { className: "h-5 w-5" })
11523
12648
  }
11524
12649
  ) }),
11525
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: "Open in side panel" })
12650
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: "Open in side panel" })
11526
12651
  ] }) : null,
11527
- effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12652
+ effectiveCopy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11528
12653
  TableRowCopyControl,
11529
12654
  {
11530
12655
  size: "icon",
@@ -11543,7 +12668,7 @@ function MatrxDataTableCore({
11543
12668
  closeWindow,
11544
12669
  hasPendingEdits: Boolean(edits[getRowId(windowRow)]),
11545
12670
  discardPendingEdits: () => discardRowEdits(getRowId(windowRow))
11546
- }) ?? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12671
+ }) ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11547
12672
  DataRowInspector,
11548
12673
  {
11549
12674
  row: windowRow,
@@ -11579,15 +12704,15 @@ function MatrxDataTableCore({
11579
12704
  })
11580
12705
  }
11581
12706
  ) : null,
11582
- editEnabled ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
11583
- foreignDrafts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12707
+ editEnabled ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
12708
+ foreignDrafts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11584
12709
  "div",
11585
12710
  {
11586
12711
  "data-matrx-foreign-drafts": true,
11587
12712
  className: "fixed inset-x-3 bottom-20 z-50 flex flex-wrap items-center justify-center gap-2 rounded-lg border border-amber-500/40 bg-card px-3 py-2 text-xs shadow-lg sm:inset-x-auto sm:left-1/2 sm:-translate-x-1/2 sm:flex-nowrap",
11588
12713
  children: [
11589
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Unsaved edits from previous results" }),
11590
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12714
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: "Unsaved edits from previous results" }),
12715
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11591
12716
  CopyButtons,
11592
12717
  {
11593
12718
  size: "xs",
@@ -11596,11 +12721,11 @@ function MatrxDataTableCore({
11596
12721
  json: () => foreignDraftPayload
11597
12722
  }
11598
12723
  ),
11599
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 text-xs text-destructive", onClick: () => setConfirmForeignDraftDiscard(true), children: "Discard drafts" })
12724
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 text-xs text-destructive", onClick: () => setConfirmForeignDraftDiscard(true), children: "Discard drafts" })
11600
12725
  ]
11601
12726
  }
11602
12727
  ) : null,
11603
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12728
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11604
12729
  ConfirmDialog,
11605
12730
  {
11606
12731
  open: confirmForeignDraftDiscard,
@@ -11620,7 +12745,7 @@ function MatrxDataTableCore({
11620
12745
  }
11621
12746
  }
11622
12747
  ),
11623
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12748
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11624
12749
  DirtySavePill,
11625
12750
  {
11626
12751
  changeCount,
@@ -11633,11 +12758,11 @@ function MatrxDataTableCore({
11633
12758
  ]
11634
12759
  }
11635
12760
  ),
11636
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_core3.DragOverlay, { children: draggedRow ? (
12761
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_core3.DragOverlay, { children: draggedRow ? (
11637
12762
  // w-max: the overlay inherits the ACTIVE node's size, and the active
11638
12763
  // node is the 16px grip handle — without it the label wraps to one
11639
12764
  // character per line.
11640
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "w-max max-w-xs truncate rounded border border-border bg-card px-2.5 py-1.5 text-sm font-medium text-foreground shadow-md", children: hierarchy?.itemLabel?.(draggedRow) ?? "Moving row" })
12765
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "w-max max-w-xs truncate rounded border border-border bg-card px-2.5 py-1.5 text-sm font-medium text-foreground shadow-md", children: hierarchy?.itemLabel?.(draggedRow) ?? "Moving row" })
11641
12766
  ) : null })
11642
12767
  ]
11643
12768
  }
@@ -11652,7 +12777,7 @@ function HierarchyDragHandle({
11652
12777
  id,
11653
12778
  disabled
11654
12779
  });
11655
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12780
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11656
12781
  "button",
11657
12782
  {
11658
12783
  ref: setNodeRef,
@@ -11664,7 +12789,7 @@ function HierarchyDragHandle({
11664
12789
  onClick: (event) => event.stopPropagation(),
11665
12790
  ...attributes,
11666
12791
  ...listeners,
11667
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
12792
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
11668
12793
  }
11669
12794
  );
11670
12795
  }
@@ -11673,7 +12798,7 @@ function HierarchyRootDropTarget({
11673
12798
  draggedLabel
11674
12799
  }) {
11675
12800
  const { isOver, setNodeRef } = (0, import_core3.useDroppable)({ id: "__root__" });
11676
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12801
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11677
12802
  "div",
11678
12803
  {
11679
12804
  ref: setNodeRef,
@@ -11683,8 +12808,8 @@ function HierarchyRootDropTarget({
11683
12808
  isOver && "border-solid bg-primary/20 shadow-md shadow-primary/25"
11684
12809
  ),
11685
12810
  children: [
11686
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "truncate", children: draggedLabel }),
11687
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-primary/75", children: label })
12811
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "truncate", children: draggedLabel }),
12812
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "text-primary/75", children: label })
11688
12813
  ]
11689
12814
  }
11690
12815
  );
@@ -11733,7 +12858,7 @@ function HierarchyDragIndicatorLayer({
11733
12858
  const { preview: preview2 } = indicator;
11734
12859
  const indent = indicator.left + 10 + preview2.depth * 12;
11735
12860
  if (preview2.position === "inside") {
11736
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12861
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11737
12862
  "div",
11738
12863
  {
11739
12864
  "aria-hidden": "true",
@@ -11745,7 +12870,7 @@ function HierarchyDragIndicatorLayer({
11745
12870
  width: Math.max(0, indicator.width - 4),
11746
12871
  height: indicator.height
11747
12872
  },
11748
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12873
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11749
12874
  "span",
11750
12875
  {
11751
12876
  className: "absolute top-1/2 -translate-y-1/2 whitespace-nowrap rounded bg-card/95 px-1.5 py-0.5 text-[10px] font-medium text-primary",
@@ -11760,7 +12885,7 @@ function HierarchyDragIndicatorLayer({
11760
12885
  );
11761
12886
  }
11762
12887
  const lineTop = preview2.position === "before" ? indicator.top - 1 : indicator.top + indicator.height - 1;
11763
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12888
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11764
12889
  "div",
11765
12890
  {
11766
12891
  "aria-hidden": "true",
@@ -11771,9 +12896,9 @@ function HierarchyDragIndicatorLayer({
11771
12896
  left: indent,
11772
12897
  width: Math.max(0, indicator.left + indicator.width - indent - 8)
11773
12898
  },
11774
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "relative h-0.5 rounded-full bg-primary", children: [
11775
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "absolute -left-1 top-1/2 h-2 w-2 -translate-y-1/2 rounded-full border-2 border-primary bg-card" }),
11776
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
12899
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative h-0.5 rounded-full bg-primary", children: [
12900
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "absolute -left-1 top-1/2 h-2 w-2 -translate-y-1/2 rounded-full border-2 border-primary bg-card" }),
12901
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
11777
12902
  "span",
11778
12903
  {
11779
12904
  className: cn(
@@ -11814,7 +12939,7 @@ function ColumnHeaderDropZone({
11814
12939
  disabled: !enabled,
11815
12940
  data: { matrxDragKind: "column-header", columnId: id }
11816
12941
  });
11817
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { ref: setNodeRef, className: "flex min-w-0 items-center", children });
12942
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { ref: setNodeRef, className: "flex min-w-0 items-center", children });
11818
12943
  }
11819
12944
  function fixedUtilityWidth(width) {
11820
12945
  return width === void 0 ? void 0 : { width: `${width}px`, minWidth: `${width}px`, maxWidth: `${width}px` };
@@ -11848,9 +12973,9 @@ function DefaultJsonCell({ value }) {
11848
12973
  const Viewer = host.JsonViewer;
11849
12974
  const text = JSON.stringify(value, null, 2);
11850
12975
  const summary = Array.isArray(value) ? `${value.length} items` : Object.keys(value).slice(0, 3).join(", ") || "Empty object";
11851
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
11852
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11853
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("button", { type: "button", className: "block max-w-full truncate text-left text-sm text-foreground", onClick: (event) => {
12976
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
12977
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
12978
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("button", { type: "button", className: "block max-w-full truncate text-left text-sm text-foreground", onClick: (event) => {
11854
12979
  event.stopPropagation();
11855
12980
  setOpen(true);
11856
12981
  }, style: { display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", whiteSpace: "normal", overflowWrap: "anywhere" }, "aria-label": "Open JSON value", children: [
@@ -11858,9 +12983,9 @@ function DefaultJsonCell({ value }) {
11858
12983
  " ",
11859
12984
  summary
11860
12985
  ] }) }),
11861
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { className: "max-w-md max-h-80 overflow-auto whitespace-pre-wrap break-words", children: text })
12986
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { className: "max-w-md max-h-80 overflow-auto whitespace-pre-wrap break-words", children: text })
11862
12987
  ] }),
11863
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DataRowWindow, { isOpen: open, onClose: () => setOpen(false), title: "JSON value", row: value, viewContent: Viewer ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Viewer, { data: value }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("pre", { className: "overflow-auto whitespace-pre-wrap p-3 text-xs", children: text }) })
12988
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DataRowWindow, { isOpen: open, onClose: () => setOpen(false), title: "JSON value", row: value, viewContent: Viewer ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Viewer, { data: value }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("pre", { className: "overflow-auto whitespace-pre-wrap p-3 text-xs", children: text }) })
11864
12989
  ] });
11865
12990
  }
11866
12991
  function DefaultMarkerCell({
@@ -11869,8 +12994,8 @@ function DefaultMarkerCell({
11869
12994
  }) {
11870
12995
  const label = marker === "favorite" ? value ? "Favorite" : "Not favorite" : value ? "Pinned" : "Not pinned";
11871
12996
  const Icon3 = marker === "favorite" ? Star : Pin;
11872
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11873
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12997
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
12998
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11874
12999
  "span",
11875
13000
  {
11876
13001
  role: "img",
@@ -11879,21 +13004,23 @@ function DefaultMarkerCell({
11879
13004
  "inline-flex size-5 items-center justify-center",
11880
13005
  value ? "text-amber-500" : "text-muted-foreground/45"
11881
13006
  ),
11882
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Icon3, { className: "size-4", ...value ? { fill: "currentColor" } : {} })
13007
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon3, { className: "size-4", ...value ? { fill: "currentColor" } : {} })
11883
13008
  }
11884
13009
  ) }),
11885
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { children: label })
13010
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { children: label })
11886
13011
  ] });
11887
13012
  }
11888
13013
  function renderCell(row, col, index) {
11889
13014
  if (col.cell) return col.cell(row, index);
11890
13015
  const raw = getCellValue(row, col);
13016
+ const formattedByDeclaration = formatColumnValue(col, raw);
13017
+ if (formattedByDeclaration) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FormattedCell, { result: formattedByDeclaration });
11891
13018
  const kind = col.cellKind ?? "auto";
11892
13019
  const asUuid = kind === "uuid" || kind === "fk" || kind === "auto" && isUuidValue(raw);
11893
13020
  if (asUuid && typeof raw === "string") {
11894
13021
  const forbidden = typeof col.fk?.forbidden === "function" ? col.fk.forbidden(raw, row) : Boolean(col.fk?.forbidden);
11895
13022
  const declaredToken = typeof col.fk?.token === "function" ? col.fk.token(row) : col.fk?.token;
11896
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
13023
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
11897
13024
  MatrxUuidCell,
11898
13025
  {
11899
13026
  value: raw,
@@ -11905,16 +13032,16 @@ function renderCell(row, col, index) {
11905
13032
  }
11906
13033
  );
11907
13034
  }
11908
- if (raw !== null && typeof raw === "object" && !(raw instanceof Date)) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DefaultJsonCell, { value: raw });
13035
+ if (raw !== null && typeof raw === "object" && !(raw instanceof Date)) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DefaultJsonCell, { value: raw });
11909
13036
  if (typeof raw === "boolean") {
11910
13037
  const marker = resolveColumnMarker(col);
11911
- if (marker) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DefaultMarkerCell, { marker, value: raw });
11912
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: raw ? "rounded bg-emerald-500/10 px-1.5 py-0.5 text-xs text-emerald-600" : "rounded bg-slate-500/10 px-1.5 py-0.5 text-xs text-muted-foreground", children: raw ? "Yes" : "No" });
13038
+ if (marker) return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DefaultMarkerCell, { marker, value: raw });
13039
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: raw ? "rounded bg-emerald-500/10 px-1.5 py-0.5 text-xs text-emerald-600" : "rounded bg-slate-500/10 px-1.5 py-0.5 text-xs text-muted-foreground", children: raw ? "Yes" : "No" });
11913
13040
  }
11914
13041
  const formatted = formatTableDisplayValue(raw);
11915
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
11916
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "block text-sm text-foreground", style: { display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", overflowWrap: "anywhere" }, children: formatted }) }),
11917
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { className: "max-w-md whitespace-pre-wrap break-words max-h-80 overflow-auto", children: typeof raw === "object" && raw !== null ? JSON.stringify(raw, null, 2) : formatted })
13042
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Tooltip, { children: [
13043
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "block text-sm text-foreground", style: { display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", overflowWrap: "anywhere" }, children: formatted }) }),
13044
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipContent, { className: "max-w-md whitespace-pre-wrap break-words max-h-80 overflow-auto", children: typeof raw === "object" && raw !== null ? JSON.stringify(raw, null, 2) : formatted })
11918
13045
  ] });
11919
13046
  }
11920
13047
  function resolveStringTitle(title, fallback) {
@@ -11929,14 +13056,14 @@ var import_react21 = require("react");
11929
13056
  // src/dropdown-menu.tsx
11930
13057
  var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
11931
13058
  var React17 = __toESM(require("react"), 1);
11932
- var import_jsx_runtime42 = require("react/jsx-runtime");
13059
+ var import_jsx_runtime43 = require("react/jsx-runtime");
11933
13060
  var DropdownMenu = DropdownMenuPrimitive.Root;
11934
13061
  var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
11935
13062
  var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
11936
13063
  var MENU_SURFACE_CLASS = "z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground";
11937
13064
  var MENU_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
11938
13065
  var MENU_INDICATOR_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
11939
- var DropdownMenuSubTrigger = React17.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
13066
+ var DropdownMenuSubTrigger = React17.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
11940
13067
  DropdownMenuPrimitive.SubTrigger,
11941
13068
  {
11942
13069
  ref,
@@ -11949,12 +13076,12 @@ var DropdownMenuSubTrigger = React17.forwardRef(({ className, inset, children, .
11949
13076
  ...props,
11950
13077
  children: [
11951
13078
  children,
11952
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
13079
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
11953
13080
  ]
11954
13081
  }
11955
13082
  ));
11956
13083
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
11957
- var DropdownMenuSubContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
13084
+ var DropdownMenuSubContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11958
13085
  DropdownMenuPrimitive.SubContent,
11959
13086
  {
11960
13087
  ref,
@@ -11966,7 +13093,7 @@ var DropdownMenuSubContent = React17.forwardRef(({ className, ...props }, ref) =
11966
13093
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
11967
13094
  var DropdownMenuContent = React17.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
11968
13095
  const portalContainer = usePortalContainer(container);
11969
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
13096
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11970
13097
  DropdownMenuPrimitive.Content,
11971
13098
  {
11972
13099
  ref,
@@ -11983,7 +13110,7 @@ var DropdownMenuContent = React17.forwardRef(({ className, sideOffset = 4, conta
11983
13110
  ) });
11984
13111
  });
11985
13112
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
11986
- var DropdownMenuItem = React17.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
13113
+ var DropdownMenuItem = React17.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
11987
13114
  DropdownMenuPrimitive.Item,
11988
13115
  {
11989
13116
  ref,
@@ -11993,7 +13120,7 @@ var DropdownMenuItem = React17.forwardRef(({ className, inset, ...props }, ref)
11993
13120
  }
11994
13121
  ));
11995
13122
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
11996
- var DropdownMenuCheckboxItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
13123
+ var DropdownMenuCheckboxItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
11997
13124
  DropdownMenuPrimitive.CheckboxItem,
11998
13125
  {
11999
13126
  ref,
@@ -12001,13 +13128,13 @@ var DropdownMenuCheckboxItem = React17.forwardRef(({ className, children, ...pro
12001
13128
  className: cn(MENU_INDICATOR_ITEM_CLASS, className),
12002
13129
  ...props,
12003
13130
  children: [
12004
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
13131
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
12005
13132
  children
12006
13133
  ]
12007
13134
  }
12008
13135
  ));
12009
13136
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
12010
- var DropdownMenuRadioItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
13137
+ var DropdownMenuRadioItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
12011
13138
  DropdownMenuPrimitive.RadioItem,
12012
13139
  {
12013
13140
  ref,
@@ -12015,13 +13142,13 @@ var DropdownMenuRadioItem = React17.forwardRef(({ className, children, ...props
12015
13142
  className: cn(MENU_INDICATOR_ITEM_CLASS, className),
12016
13143
  ...props,
12017
13144
  children: [
12018
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
13145
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
12019
13146
  children
12020
13147
  ]
12021
13148
  }
12022
13149
  ));
12023
13150
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
12024
- var DropdownMenuLabel = React17.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
13151
+ var DropdownMenuLabel = React17.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12025
13152
  DropdownMenuPrimitive.Label,
12026
13153
  {
12027
13154
  ref,
@@ -12031,7 +13158,7 @@ var DropdownMenuLabel = React17.forwardRef(({ className, inset, ...props }, ref)
12031
13158
  }
12032
13159
  ));
12033
13160
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
12034
- var DropdownMenuSeparator = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
13161
+ var DropdownMenuSeparator = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12035
13162
  DropdownMenuPrimitive.Separator,
12036
13163
  {
12037
13164
  ref,
@@ -12044,7 +13171,7 @@ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
12044
13171
  var DropdownMenuShortcut = ({
12045
13172
  className,
12046
13173
  ...props
12047
- }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
13174
+ }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12048
13175
  "span",
12049
13176
  {
12050
13177
  "data-slot": "dropdown-menu-shortcut",
@@ -12055,7 +13182,7 @@ var DropdownMenuShortcut = ({
12055
13182
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
12056
13183
 
12057
13184
  // src/data-table/SavedViewsControl.tsx
12058
- var import_jsx_runtime43 = require("react/jsx-runtime");
13185
+ var import_jsx_runtime44 = require("react/jsx-runtime");
12059
13186
  function SavedViewsControl({
12060
13187
  views,
12061
13188
  activeId = null,
@@ -12113,10 +13240,10 @@ function SavedViewsControl({
12113
13240
  }
12114
13241
  };
12115
13242
  const activeName = activeId ? views.find((view) => view.id === activeId)?.name : void 0;
12116
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1", "data-matrx-table-saved-views": true, children: [
12117
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(DropdownMenu, { children: [
12118
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Tooltip, { children: [
12119
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
13243
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1", "data-matrx-table-saved-views": true, children: [
13244
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DropdownMenu, { children: [
13245
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Tooltip, { children: [
13246
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
12120
13247
  Button,
12121
13248
  {
12122
13249
  type: "button",
@@ -12127,38 +13254,38 @@ function SavedViewsControl({
12127
13254
  "aria-describedby": dirty ? unsavedChangesId : void 0,
12128
13255
  disabled: saving,
12129
13256
  children: [
12130
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 flex-1 truncate", children: loading ? "Loading views\u2026" : activeName ?? "Default view" }),
12131
- dirty ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { "aria-hidden": "true", className: "size-1.5 shrink-0 rounded-full bg-amber-500" }) : null,
12132
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ChevronDown, { className: "size-3.5 shrink-0" })
13257
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "min-w-0 flex-1 truncate", children: loading ? "Loading views\u2026" : activeName ?? "Default view" }),
13258
+ dirty ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { "aria-hidden": "true", className: "size-1.5 shrink-0 rounded-full bg-amber-500" }) : null,
13259
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChevronDown, { className: "size-3.5 shrink-0" })
12133
13260
  ]
12134
13261
  }
12135
13262
  ) }) }),
12136
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TooltipContent, { children: "Choose or save a table view" })
13263
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TooltipContent, { children: "Choose or save a table view" })
12137
13264
  ] }),
12138
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(DropdownMenuContent, { align: "end", children: [
12139
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuLabel, { children: "Views" }),
12140
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(DropdownMenuRadioGroup, { value: activeId ?? "__default__", onValueChange: (value) => onSelect(value === "__default__" ? null : value), children: [
12141
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuRadioItem, { value: "__default__", children: "Default view" }),
12142
- views.map((view) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuRadioItem, { value: view.id, children: view.name }, view.id))
13265
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DropdownMenuContent, { align: "end", children: [
13266
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuLabel, { children: "Views" }),
13267
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DropdownMenuRadioGroup, { value: activeId ?? "__default__", onValueChange: (value) => onSelect(value === "__default__" ? null : value), children: [
13268
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuRadioItem, { value: "__default__", children: "Default view" }),
13269
+ views.map((view) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuRadioItem, { value: view.id, children: view.name }, view.id))
12143
13270
  ] }),
12144
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuSeparator, {}),
12145
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuItem, { disabled: saving, onSelect: () => {
13271
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuSeparator, {}),
13272
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuItem, { disabled: saving, onSelect: () => {
12146
13273
  setActionError(null);
12147
13274
  setSaveOpen(true);
12148
13275
  }, children: "Save current view\u2026" }),
12149
- activeId && onUpdate ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuItem, { disabled: saving, onSelect: () => void update(), children: "Update current view" }) : null,
12150
- onReload ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DropdownMenuItem, { disabled: saving || loading, onSelect: () => void reload(), children: "Reload views" }) : null
13276
+ activeId && onUpdate ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuItem, { disabled: saving, onSelect: () => void update(), children: "Update current view" }) : null,
13277
+ onReload ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DropdownMenuItem, { disabled: saving || loading, onSelect: () => void reload(), children: "Reload views" }) : null
12151
13278
  ] })
12152
13279
  ] }),
12153
- dirty ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { id: unsavedChangesId, className: "sr-only", children: "This table view has unsaved changes. Open the view menu to save or update it." }) : null,
12154
- visibleError ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "basis-full break-words text-xs text-destructive", children: visibleError }) : null,
12155
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Dialog, { open: saveOpen, onOpenChange: setSaveOpen, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(DialogContent, { children: [
12156
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DialogTitle, { children: "Save current view" }) }),
12157
- visibleError ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { role: "alert", className: "text-sm text-destructive", children: visibleError }) : null,
12158
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Input, { "aria-label": "View name", value: name, onChange: (event) => setName(event.target.value), placeholder: "View name", autoFocus: true }),
12159
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(DialogFooter, { children: [
12160
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Button, { type: "button", variant: "outline", onClick: () => setSaveOpen(false), children: "Cancel" }),
12161
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Button, { type: "button", disabled: !name.trim() || saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save view" })
13280
+ dirty ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { id: unsavedChangesId, className: "sr-only", children: "This table view has unsaved changes. Open the view menu to save or update it." }) : null,
13281
+ visibleError ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "basis-full break-words text-xs text-destructive", children: visibleError }) : null,
13282
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Dialog, { open: saveOpen, onOpenChange: setSaveOpen, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DialogContent, { children: [
13283
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DialogTitle, { children: "Save current view" }) }),
13284
+ visibleError ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "text-sm text-destructive", children: visibleError }) : null,
13285
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Input, { "aria-label": "View name", value: name, onChange: (event) => setName(event.target.value), placeholder: "View name", autoFocus: true }),
13286
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DialogFooter, { children: [
13287
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Button, { type: "button", variant: "outline", onClick: () => setSaveOpen(false), children: "Cancel" }),
13288
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Button, { type: "button", disabled: !name.trim() || saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save view" })
12162
13289
  ] })
12163
13290
  ] }) })
12164
13291
  ] });