@ai-matrx/records-ui 0.116.28 → 0.116.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/dist/{chunk-5EFM2G2O.js → chunk-2SI7LSP3.js} +9 -7
- package/dist/chunk-2SI7LSP3.js.map +1 -0
- package/dist/index.cjs +128 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +121 -135
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +7 -6
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-5EFM2G2O.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -9295,8 +9295,8 @@ function colorPairContrast(pair, format, context) {
|
|
|
9295
9295
|
}
|
|
9296
9296
|
return out;
|
|
9297
9297
|
}
|
|
9298
|
-
function ContrastMark({ ratio }) {
|
|
9299
|
-
const level = (0, import_field_formats.contrastLevel)(ratio);
|
|
9298
|
+
function ContrastMark({ ratio, min }) {
|
|
9299
|
+
const level = (0, import_field_formats.contrastLevel)(ratio, min);
|
|
9300
9300
|
const said2 = `${ratio}:1`;
|
|
9301
9301
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
9302
9302
|
"span",
|
|
@@ -9319,12 +9319,12 @@ function ColorPairView({ value, format }) {
|
|
|
9319
9319
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
9320
9320
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Swatch, { color: pair.light }),
|
|
9321
9321
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { className: "font-mono text-xs uppercase", children: pair.light }),
|
|
9322
|
-
contrast.light !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContrastMark, { ratio: contrast.light }) : null
|
|
9322
|
+
contrast.light !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContrastMark, { ratio: contrast.light, min: pair.min }) : null
|
|
9323
9323
|
] }),
|
|
9324
9324
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
9325
9325
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Swatch, { color: pair.dark ?? pair.light }),
|
|
9326
9326
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { className: (0, import_design_system2.cn)("font-mono text-xs uppercase", !pair.dark && "text-muted-foreground"), children: pair.dark ?? "Inherits light" }),
|
|
9327
|
-
contrast.dark !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContrastMark, { ratio: contrast.dark }) : null
|
|
9327
|
+
contrast.dark !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContrastMark, { ratio: contrast.dark, min: pair.min }) : null
|
|
9328
9328
|
] })
|
|
9329
9329
|
] });
|
|
9330
9330
|
}
|
|
@@ -9426,14 +9426,15 @@ function colorPairChecks(value, format, context) {
|
|
|
9426
9426
|
const out = [];
|
|
9427
9427
|
for (const part of ["light", "dark"]) {
|
|
9428
9428
|
const ratio = contrast[part];
|
|
9429
|
-
if (ratio === void 0 || (0, import_field_formats.contrastLevel)(ratio) === "pass") continue;
|
|
9429
|
+
if (ratio === void 0 || (0, import_field_formats.contrastLevel)(ratio, pair.min) === "pass") continue;
|
|
9430
9430
|
const color = part === "light" ? pair.light : pair.dark ?? pair.light;
|
|
9431
|
+
const need = pair.min ?? import_field_formats.TEXT_CONTRAST;
|
|
9431
9432
|
out.push({
|
|
9432
9433
|
part,
|
|
9433
9434
|
message: `hard to read on ${ground}`,
|
|
9434
9435
|
fix: {
|
|
9435
9436
|
label: "Fix with AI",
|
|
9436
|
-
ask: `The ${part} color ${color} reads at ${ratio}:1 on ${ground}. Suggest the nearest color that reaches
|
|
9437
|
+
ask: `The ${part} color ${color} reads at ${ratio}:1 on ${ground}. Suggest the nearest color that reaches ${need}:1 and keeps its hue.`
|
|
9437
9438
|
}
|
|
9438
9439
|
});
|
|
9439
9440
|
}
|
|
@@ -44176,16 +44177,81 @@ function ListRow({
|
|
|
44176
44177
|
);
|
|
44177
44178
|
}
|
|
44178
44179
|
|
|
44180
|
+
// src/pivot.ts
|
|
44181
|
+
var import_records56 = require("@ai-matrx/records");
|
|
44182
|
+
var PIVOT_OPS = ["count", "sum", "avg", "min", "max"];
|
|
44183
|
+
var isPivotOp = (v) => PIVOT_OPS.includes(v ?? "");
|
|
44184
|
+
var PIVOT_OP_LABEL = { count: "Count", sum: "Sum", avg: "Average", min: "Min", max: "Max" };
|
|
44185
|
+
var PIVOT_CELL_LIMIT = 1e3;
|
|
44186
|
+
var NUMBER_TYPES = /* @__PURE__ */ new Set(["number", "integer", "decimal", "money", "currency", "percent", "percentage", "range"]);
|
|
44187
|
+
var isNumberField = (f) => {
|
|
44188
|
+
if (!NUMBER_TYPES.has(String(f.type))) return false;
|
|
44189
|
+
const kind2 = String((f.config ?? {})["kind"] ?? "number");
|
|
44190
|
+
return kind2 !== "date" && kind2 !== "datetime";
|
|
44191
|
+
};
|
|
44192
|
+
function pivotQuestion(view, fields) {
|
|
44193
|
+
const has = (key) => key && fields.some((f) => f.key === key) ? key : null;
|
|
44194
|
+
const rowKey = has(view.groupField);
|
|
44195
|
+
const colKey = has(view.columnField) !== rowKey ? has(view.columnField) : null;
|
|
44196
|
+
const op2 = isPivotOp(view.pivotMeasure) ? view.pivotMeasure : "count";
|
|
44197
|
+
const field2 = view.measure ? fields.find((f) => f.key === view.measure && isNumberField(f)) : void 0;
|
|
44198
|
+
const fellBack = op2 !== "count" && !field2;
|
|
44199
|
+
const measure = op2 !== "count" && field2 ? { op: op2, key: field2.key } : { op: "count" };
|
|
44200
|
+
return { rowKey, colKey, op: fellBack ? "count" : op2, measure, fellBack };
|
|
44201
|
+
}
|
|
44202
|
+
var NONE3 = "\0none";
|
|
44203
|
+
function groupId(value) {
|
|
44204
|
+
return value === null || value === void 0 || value === "" ? NONE3 : String(value);
|
|
44205
|
+
}
|
|
44206
|
+
function byValue(a, b) {
|
|
44207
|
+
if (a.id === NONE3 || b.id === NONE3) return a.id === b.id ? 0 : a.id === NONE3 ? 1 : -1;
|
|
44208
|
+
const x = typeof a.value === "number" ? a.value : null;
|
|
44209
|
+
const y = typeof b.value === "number" ? b.value : null;
|
|
44210
|
+
if (x !== null && y !== null) return x - y;
|
|
44211
|
+
return a.label.localeCompare(b.label, void 0, { numeric: true, sensitivity: "base" });
|
|
44212
|
+
}
|
|
44213
|
+
function pivotTable(q, answers2, label, limit = PIVOT_CELL_LIMIT) {
|
|
44214
|
+
const m = (0, import_records56.measureKey)(q.measure);
|
|
44215
|
+
const read = (r) => r ? { value: typeof r.measures?.[m] === "number" ? r.measures[m] : null, n: r.row_count } : null;
|
|
44216
|
+
const axis = (key, sources) => {
|
|
44217
|
+
if (!key) return [{ id: NONE3, value: null, label: "" }];
|
|
44218
|
+
const seen = /* @__PURE__ */ new Map();
|
|
44219
|
+
for (const rows2 of sources)
|
|
44220
|
+
for (const r of rows2) {
|
|
44221
|
+
const raw = r.groups?.[key];
|
|
44222
|
+
const id = groupId(raw);
|
|
44223
|
+
if (!seen.has(id)) seen.set(id, { id, value: id === NONE3 ? null : raw, label: id === NONE3 ? "\u2014" : label(key, raw) });
|
|
44224
|
+
}
|
|
44225
|
+
return [...seen.values()].sort(byValue);
|
|
44226
|
+
};
|
|
44227
|
+
const rows = axis(q.rowKey, [answers2.rowTotals, answers2.cells]);
|
|
44228
|
+
const cols = axis(q.colKey, [answers2.colTotals, answers2.cells]);
|
|
44229
|
+
const cellAt = /* @__PURE__ */ new Map();
|
|
44230
|
+
for (const r of answers2.cells) cellAt.set(`${groupId(q.rowKey ? r.groups?.[q.rowKey] : null)}${groupId(q.colKey ? r.groups?.[q.colKey] : null)}`, r);
|
|
44231
|
+
const rowAt = new Map(answers2.rowTotals.map((r) => [groupId(q.rowKey ? r.groups?.[q.rowKey] : null), r]));
|
|
44232
|
+
const colAt = new Map(answers2.colTotals.map((r) => [groupId(q.colKey ? r.groups?.[q.colKey] : null), r]));
|
|
44233
|
+
return {
|
|
44234
|
+
rows,
|
|
44235
|
+
cols,
|
|
44236
|
+
// With no row Field every cell is the one row; with no column Field, the one column.
|
|
44237
|
+
cell: (rowId, colId) => read(cellAt.get(`${rowId}${colId}`)),
|
|
44238
|
+
rowTotal: (rowId) => read(rowAt.get(rowId)),
|
|
44239
|
+
colTotal: (colId) => read(colAt.get(colId)),
|
|
44240
|
+
grand: read(answers2.grand[0]),
|
|
44241
|
+
cut: answers2.cells.length >= limit
|
|
44242
|
+
};
|
|
44243
|
+
}
|
|
44244
|
+
|
|
44179
44245
|
// src/ChartLayout.tsx
|
|
44180
44246
|
var import_react263 = require("react");
|
|
44181
44247
|
var import_react264 = require("@ai-matrx/records/react");
|
|
44182
|
-
var
|
|
44248
|
+
var import_records58 = require("@ai-matrx/records");
|
|
44183
44249
|
var import_design_system127 = require("@ai-matrx/design-system");
|
|
44184
44250
|
|
|
44185
44251
|
// src/ChartBlock.tsx
|
|
44186
44252
|
var import_react262 = require("react");
|
|
44187
44253
|
var import_recharts = require("recharts");
|
|
44188
|
-
var
|
|
44254
|
+
var import_records57 = require("@ai-matrx/records");
|
|
44189
44255
|
var import_core21 = require("@ai-matrx/records/core");
|
|
44190
44256
|
var import_design_system126 = require("@ai-matrx/design-system");
|
|
44191
44257
|
var import_format11 = require("@ai-matrx/kit/format");
|
|
@@ -44766,7 +44832,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
44766
44832
|
const kind2 = shape ? BASE_KIND_OF_SHAPE[shape] : block.kind;
|
|
44767
44833
|
const tableId = block.table_id ?? subject;
|
|
44768
44834
|
const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
|
|
44769
|
-
const primary = (0,
|
|
44835
|
+
const primary = (0, import_records57.measureKey)(measures[0]);
|
|
44770
44836
|
const windows = kind2 === "stuck" ? null : block.compare ?? null;
|
|
44771
44837
|
const compared = !!windows;
|
|
44772
44838
|
const grain = block.bucket?.by ?? null;
|
|
@@ -44776,7 +44842,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
44776
44842
|
const measureFields = useMeasureFields(primary, source ? void 0 : tableId);
|
|
44777
44843
|
const measureName = useMeasureWords(primary, tableId);
|
|
44778
44844
|
const numberFormat = (0, import_react262.useMemo)(() => source ? null : chartFormatFor(primary, measureFields), [source, primary, measureFields]);
|
|
44779
|
-
const yKey = drawn === "scatter" && measures[1] ? (0,
|
|
44845
|
+
const yKey = drawn === "scatter" && measures[1] ? (0, import_records57.measureKey)(measures[1]) : null;
|
|
44780
44846
|
const yName = useMeasureWords(yKey ?? primary, tableId);
|
|
44781
44847
|
const points = (0, import_react262.useMemo)(() => {
|
|
44782
44848
|
if (kind2 === "stuck") return [];
|
|
@@ -45490,13 +45556,12 @@ var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
|
45490
45556
|
var KIND_LABEL = { bar: "Bars", line: "Line", area: "Area", donut: "Donut", pie: "Pie", stacked: "Stacked bars", scatter: "Scatter" };
|
|
45491
45557
|
var BASE_SHAPES = ["bar", "line", "donut"];
|
|
45492
45558
|
var MEASURE_LABEL2 = { count: "Count", sum: "Sum", avg: "Average" };
|
|
45493
|
-
var NUMBER_TYPES = /* @__PURE__ */ new Set(["number", "integer", "decimal", "money", "currency", "percent", "percentage"]);
|
|
45494
45559
|
var DATE_TYPES = /* @__PURE__ */ new Set(["date", "datetime", "timestamp"]);
|
|
45495
45560
|
var isChartKind = (v) => Object.prototype.hasOwnProperty.call(KIND_LABEL, v ?? "");
|
|
45496
45561
|
var isChartMeasure = (v) => v === "count" || v === "sum" || v === "avg";
|
|
45497
45562
|
function defaultChartGroup(fields) {
|
|
45498
45563
|
return fields.find((f) => {
|
|
45499
|
-
const kind2 = (0,
|
|
45564
|
+
const kind2 = (0, import_records58.fieldKindFor)(f);
|
|
45500
45565
|
return kind2 === "select" || kind2 === "multi_select";
|
|
45501
45566
|
})?.key ?? null;
|
|
45502
45567
|
}
|
|
@@ -45548,7 +45613,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
45548
45613
|
return;
|
|
45549
45614
|
}
|
|
45550
45615
|
const wholeRow = overall && overall.ok ? (overall.data ?? [])[0] : void 0;
|
|
45551
|
-
const wholeValue = wholeRow ? wholeRow.measures[(0,
|
|
45616
|
+
const wholeValue = wholeRow ? wholeRow.measures[(0, import_records58.measureKey)(question.measure)] : void 0;
|
|
45552
45617
|
setState({
|
|
45553
45618
|
error: null,
|
|
45554
45619
|
...question.kind === "donut" ? { total: typeof wholeValue === "number" ? wholeValue : null } : {},
|
|
@@ -45568,8 +45633,8 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
45568
45633
|
};
|
|
45569
45634
|
}, [client, view.subject, view.name, qKey, filterKey]);
|
|
45570
45635
|
const groupable = fields.filter((f) => !["attachment", "file", "formula", "button"].includes(String(f.type)));
|
|
45571
|
-
const numeric = fields.filter(
|
|
45572
|
-
const pickMeasure = (0,
|
|
45636
|
+
const numeric = fields.filter(isNumberField);
|
|
45637
|
+
const pickMeasure = (0, import_records58.measureKey)(q.measure);
|
|
45573
45638
|
const dataLabels = view.presentation?.chartLabels === true;
|
|
45574
45639
|
const legend = view.presentation?.chartLegend !== false;
|
|
45575
45640
|
const setLook = (patch) => onChange({ presentation: { ...view.presentation, ...patch } });
|
|
@@ -45636,69 +45701,6 @@ var import_design_system128 = require("@ai-matrx/design-system");
|
|
|
45636
45701
|
var import_skeleton2 = require("@ai-matrx/design-system/skeleton");
|
|
45637
45702
|
init_host();
|
|
45638
45703
|
init_names();
|
|
45639
|
-
|
|
45640
|
-
// src/pivot.ts
|
|
45641
|
-
var import_records58 = require("@ai-matrx/records");
|
|
45642
|
-
var PIVOT_OPS = ["count", "sum", "avg", "min", "max"];
|
|
45643
|
-
var isPivotOp = (v) => PIVOT_OPS.includes(v ?? "");
|
|
45644
|
-
var PIVOT_OP_LABEL = { count: "Count", sum: "Sum", avg: "Average", min: "Min", max: "Max" };
|
|
45645
|
-
var PIVOT_CELL_LIMIT = 2e3;
|
|
45646
|
-
var NUMBER_TYPES2 = /* @__PURE__ */ new Set(["number", "integer", "decimal", "money", "currency", "percent", "percentage"]);
|
|
45647
|
-
var isNumberField = (f) => NUMBER_TYPES2.has(String(f.type));
|
|
45648
|
-
function pivotQuestion(view, fields) {
|
|
45649
|
-
const has = (key) => key && fields.some((f) => f.key === key) ? key : null;
|
|
45650
|
-
const rowKey = has(view.groupField);
|
|
45651
|
-
const colKey = has(view.columnField) !== rowKey ? has(view.columnField) : null;
|
|
45652
|
-
const op2 = isPivotOp(view.pivotMeasure) ? view.pivotMeasure : "count";
|
|
45653
|
-
const field2 = view.measure ? fields.find((f) => f.key === view.measure && isNumberField(f)) : void 0;
|
|
45654
|
-
const fellBack = op2 !== "count" && !field2;
|
|
45655
|
-
const measure = op2 !== "count" && field2 ? { op: op2, key: field2.key } : { op: "count" };
|
|
45656
|
-
return { rowKey, colKey, op: fellBack ? "count" : op2, measure, fellBack };
|
|
45657
|
-
}
|
|
45658
|
-
var NONE3 = "\0none";
|
|
45659
|
-
function groupId(value) {
|
|
45660
|
-
return value === null || value === void 0 || value === "" ? NONE3 : String(value);
|
|
45661
|
-
}
|
|
45662
|
-
function byValue(a, b) {
|
|
45663
|
-
if (a.id === NONE3 || b.id === NONE3) return a.id === b.id ? 0 : a.id === NONE3 ? 1 : -1;
|
|
45664
|
-
const x = typeof a.value === "number" ? a.value : null;
|
|
45665
|
-
const y = typeof b.value === "number" ? b.value : null;
|
|
45666
|
-
if (x !== null && y !== null) return x - y;
|
|
45667
|
-
return a.label.localeCompare(b.label, void 0, { numeric: true, sensitivity: "base" });
|
|
45668
|
-
}
|
|
45669
|
-
function pivotTable(q, answers2, label, limit = PIVOT_CELL_LIMIT) {
|
|
45670
|
-
const m = (0, import_records58.measureKey)(q.measure);
|
|
45671
|
-
const read = (r) => r ? { value: typeof r.measures?.[m] === "number" ? r.measures[m] : null, n: r.row_count } : null;
|
|
45672
|
-
const axis = (key, sources) => {
|
|
45673
|
-
if (!key) return [{ id: NONE3, value: null, label: "" }];
|
|
45674
|
-
const seen = /* @__PURE__ */ new Map();
|
|
45675
|
-
for (const rows2 of sources)
|
|
45676
|
-
for (const r of rows2) {
|
|
45677
|
-
const raw = r.groups?.[key];
|
|
45678
|
-
const id = groupId(raw);
|
|
45679
|
-
if (!seen.has(id)) seen.set(id, { id, value: id === NONE3 ? null : raw, label: id === NONE3 ? "\u2014" : label(key, raw) });
|
|
45680
|
-
}
|
|
45681
|
-
return [...seen.values()].sort(byValue);
|
|
45682
|
-
};
|
|
45683
|
-
const rows = axis(q.rowKey, [answers2.rowTotals, answers2.cells]);
|
|
45684
|
-
const cols = axis(q.colKey, [answers2.colTotals, answers2.cells]);
|
|
45685
|
-
const cellAt = /* @__PURE__ */ new Map();
|
|
45686
|
-
for (const r of answers2.cells) cellAt.set(`${groupId(q.rowKey ? r.groups?.[q.rowKey] : null)}${groupId(q.colKey ? r.groups?.[q.colKey] : null)}`, r);
|
|
45687
|
-
const rowAt = new Map(answers2.rowTotals.map((r) => [groupId(q.rowKey ? r.groups?.[q.rowKey] : null), r]));
|
|
45688
|
-
const colAt = new Map(answers2.colTotals.map((r) => [groupId(q.colKey ? r.groups?.[q.colKey] : null), r]));
|
|
45689
|
-
return {
|
|
45690
|
-
rows,
|
|
45691
|
-
cols,
|
|
45692
|
-
// With no row Field every cell is the one row; with no column Field, the one column.
|
|
45693
|
-
cell: (rowId, colId) => read(cellAt.get(`${rowId}${colId}`)),
|
|
45694
|
-
rowTotal: (rowId) => read(rowAt.get(rowId)),
|
|
45695
|
-
colTotal: (colId) => read(colAt.get(colId)),
|
|
45696
|
-
grand: read(answers2.grand[0]),
|
|
45697
|
-
cut: answers2.cells.length >= limit
|
|
45698
|
-
};
|
|
45699
|
-
}
|
|
45700
|
-
|
|
45701
|
-
// src/PivotLayout.tsx
|
|
45702
45704
|
init_Refusal();
|
|
45703
45705
|
var import_jsx_runtime152 = require("react/jsx-runtime");
|
|
45704
45706
|
var PIVOT_BOX = "min-h-[16rem]";
|
|
@@ -45868,9 +45870,9 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
45868
45870
|
] }) }) : null
|
|
45869
45871
|
] }) }),
|
|
45870
45872
|
table.cut ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("p", { className: "text-xs text-muted-foreground", "data-records-pivot-cut": "", children: [
|
|
45871
|
-
"
|
|
45873
|
+
"First ",
|
|
45872
45874
|
PIVOT_CELL_LIMIT.toLocaleString(),
|
|
45873
|
-
" cells
|
|
45875
|
+
" cells only. Narrow the filter to see the rest."
|
|
45874
45876
|
] }) : null
|
|
45875
45877
|
] })
|
|
45876
45878
|
] });
|
|
@@ -45883,9 +45885,9 @@ var import_design_system129 = require("@ai-matrx/design-system");
|
|
|
45883
45885
|
init_host();
|
|
45884
45886
|
|
|
45885
45887
|
// src/mapPins.ts
|
|
45886
|
-
var
|
|
45888
|
+
var NUMBER_TYPES2 = /* @__PURE__ */ new Set(["number", "integer", "decimal", "money", "currency", "percent", "percentage", "range"]);
|
|
45887
45889
|
function isNumberField2(field2) {
|
|
45888
|
-
if (!
|
|
45890
|
+
if (!NUMBER_TYPES2.has(String(field2.type))) return false;
|
|
45889
45891
|
const kind2 = String((field2.config ?? {})["kind"] ?? "number");
|
|
45890
45892
|
return kind2 !== "date" && kind2 !== "datetime";
|
|
45891
45893
|
}
|
|
@@ -46516,8 +46518,6 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
46516
46518
|
cancelled = true;
|
|
46517
46519
|
};
|
|
46518
46520
|
}, [client, ruleId, pageSize]);
|
|
46519
|
-
const asked4 = (0, import_records60.stableFilterKey)(filter ?? null);
|
|
46520
|
-
const fromView = asked4 !== "{}" && (asked4 === (0, import_records60.stableFilterKey)(view.where ?? null) || asked4 === (0, import_records60.stableFilterKey)(view.filters ?? null));
|
|
46521
46521
|
const tableRows = (0, import_react270.useMemo)(() => table.data?.rows ?? [], [table.data]);
|
|
46522
46522
|
const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
|
|
46523
46523
|
const hand = useHandOrderRows({
|
|
@@ -46569,7 +46569,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
46569
46569
|
// sat over every board and gallery. A view of the whole table says nothing about it; a narrowed
|
|
46570
46570
|
// one says how, in words a person uses.
|
|
46571
46571
|
membership: [
|
|
46572
|
-
|
|
46572
|
+
// A person sees the rows; the screen does not narrate why they are the rows.
|
|
46573
46573
|
manual ? HAND_ORDER_NOTE : ""
|
|
46574
46574
|
].filter(Boolean).join(" ")
|
|
46575
46575
|
};
|
|
@@ -63126,6 +63126,7 @@ var import_react361 = require("@ai-matrx/records/react");
|
|
|
63126
63126
|
var import_design_system181 = require("@ai-matrx/design-system");
|
|
63127
63127
|
var import_icons3 = require("@ai-matrx/design-system/icons");
|
|
63128
63128
|
var import_field_formats12 = require("@ai-matrx/design-system/field-formats");
|
|
63129
|
+
var import_controls14 = require("@ai-matrx/design-system/controls");
|
|
63129
63130
|
init_names();
|
|
63130
63131
|
init_plainWords();
|
|
63131
63132
|
|
|
@@ -63522,7 +63523,7 @@ function ChecksLine({ checks, onFix }) {
|
|
|
63522
63523
|
if (checks.length === 0) return null;
|
|
63523
63524
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("span", { className: "flex flex-col items-start gap-1", children: [
|
|
63524
63525
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs text-warning-ink", children: check.message }),
|
|
63525
|
-
check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63526
|
+
check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "button", variant: "outline", onClick: () => onFix(check), children: check.fix.label }) : null
|
|
63526
63527
|
] }, i)) });
|
|
63527
63528
|
}
|
|
63528
63529
|
function ValueCell({
|
|
@@ -63531,7 +63532,8 @@ function ValueCell({
|
|
|
63531
63532
|
editable,
|
|
63532
63533
|
save,
|
|
63533
63534
|
onFix,
|
|
63534
|
-
context
|
|
63535
|
+
context,
|
|
63536
|
+
stacked
|
|
63535
63537
|
}) {
|
|
63536
63538
|
const { field: field2, format } = column;
|
|
63537
63539
|
const stored = (row.document ?? {})[field2.key];
|
|
@@ -63544,11 +63546,12 @@ function ValueCell({
|
|
|
63544
63546
|
if (format?.id === "color_pair") {
|
|
63545
63547
|
const pair = (0, import_field_formats12.readColorPair)(value) ?? null;
|
|
63546
63548
|
const contrast = pair ? colorPairContrast(pair, format, context) : {};
|
|
63547
|
-
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: stacked ? "flex min-w-0 flex-col gap-1.5" : "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63548
63550
|
const side = part === "light" ? pair?.light : pair?.dark ?? void 0;
|
|
63549
63551
|
const ratio = contrast[part];
|
|
63550
|
-
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "min-w-0 px-3", children: [
|
|
63552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: stacked ? "min-w-0" : "min-w-0 px-3", children: [
|
|
63551
63553
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
63554
|
+
stacked ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "w-9 shrink-0 text-xs text-muted-foreground", children: part === "light" ? "Light" : "Dark" }) : null,
|
|
63552
63555
|
editable ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63553
63556
|
ColorWell,
|
|
63554
63557
|
{
|
|
@@ -63564,7 +63567,7 @@ function ValueCell({
|
|
|
63564
63567
|
}
|
|
63565
63568
|
}
|
|
63566
63569
|
) : /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
|
|
63567
|
-
ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ContrastMark, { ratio }) : null
|
|
63570
|
+
ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ContrastMark, { ratio, min: pair?.min }) : null
|
|
63568
63571
|
] }),
|
|
63569
63572
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
|
|
63570
63573
|
] }, part);
|
|
@@ -63575,25 +63578,28 @@ function ValueCell({
|
|
|
63575
63578
|
const ownDark = typeof value === "string" && value.includes('"dark"');
|
|
63576
63579
|
const pack = (l) => l.length === 1 ? l[0] : { layers: l };
|
|
63577
63580
|
const write = (light, dark) => change(JSON.stringify(dark ? { light: pack(light), dark: pack(dark) } : pack(light)));
|
|
63578
|
-
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: stacked ? "flex min-w-0 flex-col gap-1.5" : "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63579
63582
|
const layers = pair ? pair[part] : null;
|
|
63580
63583
|
const words2 = !layers ? "Set" : part === "dark" && !ownDark ? "Same as light" : (0, import_field_formats12.shadowWords)(layers);
|
|
63581
63584
|
const inner2 = /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
63582
63585
|
layers ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ShadowSwatch, { layers, theme: part }) : null,
|
|
63583
63586
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: (0, import_design_system181.cn)("truncate text-xs", part === "dark" && !ownDark ? "text-muted-foreground" : "text-foreground"), children: words2 })
|
|
63584
63587
|
] });
|
|
63585
|
-
return /* @__PURE__ */ (0, import_jsx_runtime207.
|
|
63586
|
-
|
|
63587
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.
|
|
63588
|
-
|
|
63589
|
-
{
|
|
63590
|
-
|
|
63591
|
-
|
|
63592
|
-
|
|
63593
|
-
|
|
63594
|
-
|
|
63595
|
-
|
|
63596
|
-
|
|
63588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: stacked ? "flex min-w-0 items-center gap-2" : "min-w-0 px-3", children: [
|
|
63589
|
+
stacked ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "w-9 shrink-0 text-xs text-muted-foreground", children: part === "light" ? "Light" : "Dark" }) : null,
|
|
63590
|
+
editable ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { children: [
|
|
63591
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("button", { type: "button", "aria-label": `${fieldName(field2)} ${part}`, className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: inner2 }) }),
|
|
63592
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverContent, { align: "start", className: "w-80", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63593
|
+
ShadowLayersEditor,
|
|
63594
|
+
{
|
|
63595
|
+
layers: layers ?? [{ x: 0, y: 4, blur: 12, spread: 0, color: "#0000001f" }],
|
|
63596
|
+
id: `${id}-${part}`,
|
|
63597
|
+
label: `${fieldName(field2)} ${part}`,
|
|
63598
|
+
onChange: (next) => part === "light" ? write(next, ownDark && pair ? pair.dark : null) : write(pair ? pair.light : next, next)
|
|
63599
|
+
}
|
|
63600
|
+
) })
|
|
63601
|
+
] }) : inner2
|
|
63602
|
+
] }, part);
|
|
63597
63603
|
}) });
|
|
63598
63604
|
}
|
|
63599
63605
|
const look = fieldLookFor(format?.id);
|
|
@@ -63678,20 +63684,15 @@ function groundOf(row, rows, keys) {
|
|
|
63678
63684
|
}
|
|
63679
63685
|
function RowComments({ tableId, row, count, onClosed }) {
|
|
63680
63686
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { onOpenChange: (open) => !open && onClosed(), children: [
|
|
63681
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.
|
|
63682
|
-
|
|
63687
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63688
|
+
import_controls14.Button,
|
|
63683
63689
|
{
|
|
63684
63690
|
type: "button",
|
|
63691
|
+
variant: "quiet",
|
|
63692
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.MessageSquareIcon, {}),
|
|
63693
|
+
badge: count,
|
|
63685
63694
|
"aria-label": count > 0 ? `${count} open comment${count === 1 ? "" : "s"}` : "Comment",
|
|
63686
|
-
"data-records-row-comments": count
|
|
63687
|
-
className: (0, import_design_system181.cn)(
|
|
63688
|
-
"inline-flex h-7 min-w-7 items-center justify-center gap-0.5 rounded-md px-1 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
63689
|
-
count > 0 ? "text-foreground" : "text-muted-foreground"
|
|
63690
|
-
),
|
|
63691
|
-
children: [
|
|
63692
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.MessageSquareIcon, { className: "h-3.5 w-3.5" }),
|
|
63693
|
-
count > 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs tabular-nums", children: count }) : null
|
|
63694
|
-
]
|
|
63695
|
+
"data-records-row-comments": count
|
|
63695
63696
|
}
|
|
63696
63697
|
) }),
|
|
63697
63698
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverContent, { align: "end", className: "w-96 p-0", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(CommentThread, { tableId, recordId: row.id, className: "max-h-[70dvh] overflow-y-auto p-3" }) })
|
|
@@ -63704,16 +63705,14 @@ function NoteButton({ row, noteField, editable, save }) {
|
|
|
63704
63705
|
const has = text.trim() !== "";
|
|
63705
63706
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { children: [
|
|
63706
63707
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63707
|
-
|
|
63708
|
+
import_controls14.Button,
|
|
63708
63709
|
{
|
|
63709
63710
|
type: "button",
|
|
63711
|
+
variant: "quiet",
|
|
63712
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.StickyNoteIcon, {}),
|
|
63713
|
+
pressed: has,
|
|
63710
63714
|
"aria-label": has ? `${fieldName(noteField)}: ${text}` : `Add ${fieldName(noteField).toLowerCase()}`,
|
|
63711
|
-
title: has ? text : fieldName(noteField)
|
|
63712
|
-
className: (0, import_design_system181.cn)(
|
|
63713
|
-
"inline-flex h-7 w-7 items-center justify-center rounded-md hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
63714
|
-
has ? "text-foreground" : "text-muted-foreground"
|
|
63715
|
-
),
|
|
63716
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.StickyNoteIcon, { className: "h-4 w-4" })
|
|
63715
|
+
title: has ? text : fieldName(noteField)
|
|
63717
63716
|
}
|
|
63718
63717
|
) }),
|
|
63719
63718
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverContent, { align: "end", className: "w-72", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
@@ -63827,8 +63826,8 @@ function AddDialog({
|
|
|
63827
63826
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.BasicTextarea, { id: "section-add-note", rows: 2, placeholder: name.trim() ? `When should ${name.trim()} be used?` : "When should it be used?", value: note, onChange: (e) => setNote(e.target.value) })
|
|
63828
63827
|
] }) : null,
|
|
63829
63828
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
63830
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63831
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63829
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "button", variant: "quiet", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
63830
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "submit", variant: "primary", disabled: !ready, children: "Add" })
|
|
63832
63831
|
] })
|
|
63833
63832
|
]
|
|
63834
63833
|
}
|
|
@@ -63907,27 +63906,15 @@ function TableSectionCard(props) {
|
|
|
63907
63906
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("section", { ref: sectionRef, "data-records-section-card": "", "data-narrow": narrow ? "" : void 0, className: (0, import_design_system181.cn)("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
|
|
63908
63907
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("header", { className: "flex items-start justify-between gap-4 px-5 pt-5 pb-3 sm:px-6", children: [
|
|
63909
63908
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "min-w-0", children: [
|
|
63910
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("h2", { className: "
|
|
63909
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("h2", { className: "type-heading truncate text-foreground", children: title || "\xA0" }),
|
|
63911
63910
|
props.description ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("p", { className: "mt-1 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
|
|
63912
63911
|
] }),
|
|
63913
|
-
mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime207.
|
|
63914
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, { className: "h-3.5 w-3.5" }),
|
|
63915
|
-
"Add"
|
|
63916
|
-
] }) : null
|
|
63912
|
+
mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "button", variant: "outline", icon: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, {}), onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED2), children: "Add" }) : null
|
|
63917
63913
|
] }),
|
|
63918
63914
|
refused ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("p", { className: "px-5 pb-5 text-sm text-muted-foreground sm:px-6", children: refusalSentence(refused) }) : !fieldsRead.data || page.loading && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "flex flex-col gap-1.5 px-5 pb-5 sm:px-6", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "h-9 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("p", { className: "px-5 pb-5 text-sm text-muted-foreground sm:px-6", children: "Nothing here yet." }) : /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: (0, import_design_system181.cn)("-mb-px", !narrow && "overflow-x-auto"), children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { "data-records-section-group": group.key, className: "", children: [
|
|
63919
63915
|
cols.group ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex items-center justify-between border-y border-border px-5 py-1 sm:px-6", children: [
|
|
63920
63916
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs font-semibold text-foreground", children: group.key || "No group" }),
|
|
63921
|
-
mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63922
|
-
"button",
|
|
63923
|
-
{
|
|
63924
|
-
type: "button",
|
|
63925
|
-
"aria-label": `Add to ${group.key || "no group"}`,
|
|
63926
|
-
className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
63927
|
-
onClick: () => setAdding(group.key),
|
|
63928
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, { className: "h-4 w-4" })
|
|
63929
|
-
}
|
|
63930
|
-
) : null
|
|
63917
|
+
mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "button", variant: "quiet", icon: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, {}), "aria-label": `Add to ${group.key || "no group"}`, onClick: () => setAdding(group.key) }) : null
|
|
63931
63918
|
] }) : null,
|
|
63932
63919
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { role: "table", "aria-label": group.key || title, className: narrow ? "" : "min-w-[36rem]", children: [
|
|
63933
63920
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { role: "row", style: gridStyle, className: (0, import_design_system181.cn)("grid border-b border-border text-xs text-muted-foreground", narrow && "hidden"), children: [
|
|
@@ -63967,7 +63954,7 @@ function TableSectionCard(props) {
|
|
|
63967
63954
|
style: c.part ? { gridColumn: "span 2" } : void 0,
|
|
63968
63955
|
className: narrow ? "min-w-0" : (0, import_design_system181.cn)("min-w-0 py-1", c.part ? "" : "px-3"),
|
|
63969
63956
|
children: [
|
|
63970
|
-
narrow ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "mb-0.5 block text-xs text-muted-foreground", children: cellLabel(c) }) : null,
|
|
63957
|
+
narrow && !c.part ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "mb-0.5 block text-xs text-muted-foreground", children: cellLabel(c) }) : null,
|
|
63971
63958
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63972
63959
|
ValueCell,
|
|
63973
63960
|
{
|
|
@@ -63976,7 +63963,8 @@ function TableSectionCard(props) {
|
|
|
63976
63963
|
editable,
|
|
63977
63964
|
save: rowSave,
|
|
63978
63965
|
onFix,
|
|
63979
|
-
context: c.field.key === readsOnColorKey ? groundOf(row, rows, { name: cols.name, readsOn: cols.readsOn, color: c.field.key }) : void 0
|
|
63966
|
+
context: c.field.key === readsOnColorKey ? groundOf(row, rows, { name: cols.name, readsOn: cols.readsOn, color: c.field.key }) : void 0,
|
|
63967
|
+
stacked: narrow
|
|
63980
63968
|
}
|
|
63981
63969
|
)
|
|
63982
63970
|
]
|