@ai-matrx/detail 0.1.0 → 0.1.2
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 +13 -0
- package/dist/react.cjs +37 -20
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +39 -22
- package/dist/react.js.map +1 -1
- package/package.json +7 -6
package/dist/react.js
CHANGED
|
@@ -877,12 +877,13 @@ function DetailActions({ core }) {
|
|
|
877
877
|
|
|
878
878
|
// src/react/DetailBody.tsx
|
|
879
879
|
import { useEffect as useEffect7, useRef as useRef6, useState as useState5 } from "react";
|
|
880
|
-
import { cn as cn3, Skeleton } from "@ai-matrx/design-system";
|
|
880
|
+
import { cn as cn3, ErrorActions as ErrorActions2, Skeleton } from "@ai-matrx/design-system";
|
|
881
881
|
import {
|
|
882
882
|
ASSOCIATION_TARGET_TYPES,
|
|
883
883
|
isEntityTypeToken
|
|
884
884
|
} from "@ai-matrx/associations";
|
|
885
885
|
import { AssociationCardGrid, PrimaryEntityProvider } from "@ai-matrx/associations/react";
|
|
886
|
+
import { formatDurationMs } from "@ai-matrx/kit/format";
|
|
886
887
|
|
|
887
888
|
// src/format.ts
|
|
888
889
|
function formatWhen(iso) {
|
|
@@ -893,7 +894,7 @@ function formatWhen(iso) {
|
|
|
893
894
|
|
|
894
895
|
// src/react/DetailPresentationPane.tsx
|
|
895
896
|
import { useEffect as useEffect6, useRef as useRef5, useState as useState4 } from "react";
|
|
896
|
-
import { cn as cn2 } from "@ai-matrx/design-system";
|
|
897
|
+
import { cn as cn2, ErrorActions } from "@ai-matrx/design-system";
|
|
897
898
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
898
899
|
var WORD = {
|
|
899
900
|
window: "a window",
|
|
@@ -971,20 +972,26 @@ function DetailPresentationPane({ core }) {
|
|
|
971
972
|
}, [open, save, registerSave]);
|
|
972
973
|
if (!save) return null;
|
|
973
974
|
if (!open) {
|
|
974
|
-
return /* @__PURE__ */ jsxs3(
|
|
975
|
-
"
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
"
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
975
|
+
return /* @__PURE__ */ jsxs3("div", { className: "w-full", children: [
|
|
976
|
+
setting.error ? /* @__PURE__ */ jsxs3("p", { className: "px-1 pt-1 text-[11px] text-muted-foreground", children: [
|
|
977
|
+
`Your "open details as" setting could not be read (${setting.error}) \u2014 details are opening as ${WORD[core.presentation]}.`,
|
|
978
|
+
/* @__PURE__ */ jsx4(ErrorActions, { origin: "detail/DetailPresentationPane", operation: "Read the open-details-as setting", error: setting.error })
|
|
979
|
+
] }) : null,
|
|
980
|
+
/* @__PURE__ */ jsxs3(
|
|
981
|
+
"button",
|
|
982
|
+
{
|
|
983
|
+
type: "button",
|
|
984
|
+
onClick: () => setOpen(true),
|
|
985
|
+
className: "flex w-full items-center gap-1.5 rounded-md px-1 py-1 text-left text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
986
|
+
"data-detail-presentation-pane": "collapsed",
|
|
987
|
+
children: [
|
|
988
|
+
/* @__PURE__ */ jsx4(Settings2Icon, { className: "h-3 w-3 shrink-0" }),
|
|
989
|
+
setting.error ? null : /* @__PURE__ */ jsx4("span", { children: `Details open as ${WORD[effective]}.` }),
|
|
990
|
+
/* @__PURE__ */ jsx4("span", { className: "underline underline-offset-2", children: "Change" })
|
|
991
|
+
]
|
|
992
|
+
}
|
|
993
|
+
)
|
|
994
|
+
] });
|
|
988
995
|
}
|
|
989
996
|
return /* @__PURE__ */ jsxs3(
|
|
990
997
|
"section",
|
|
@@ -1066,11 +1073,15 @@ function DetailPresentationPane({ core }) {
|
|
|
1066
1073
|
}
|
|
1067
1074
|
)
|
|
1068
1075
|
] }),
|
|
1069
|
-
state.status === "refused" ? /* @__PURE__ */
|
|
1076
|
+
state.status === "refused" ? /* @__PURE__ */ jsxs3("p", { className: "text-xs text-destructive", "data-detail-presentation-refusal": true, children: [
|
|
1077
|
+
state.reason,
|
|
1078
|
+
/* @__PURE__ */ jsx4(ErrorActions, { origin: "detail/DetailPresentationPane", operation: "Change how details open", message: state.reason })
|
|
1079
|
+
] }) : null,
|
|
1070
1080
|
setting.error ? /* @__PURE__ */ jsxs3("p", { className: "text-xs text-muted-foreground", children: [
|
|
1071
1081
|
"The saved setting could not be read here (",
|
|
1072
1082
|
setting.error,
|
|
1073
|
-
"), so this shows what this detail is actually doing."
|
|
1083
|
+
"), so this shows what this detail is actually doing.",
|
|
1084
|
+
/* @__PURE__ */ jsx4(ErrorActions, { origin: "detail/DetailPresentationPane", operation: "Read the open-details-as setting", error: setting.error })
|
|
1074
1085
|
] }) : null
|
|
1075
1086
|
]
|
|
1076
1087
|
}
|
|
@@ -1233,7 +1244,10 @@ function FieldsSection({ core }) {
|
|
|
1233
1244
|
return /* @__PURE__ */ jsx5(Notice, { tone: "warn", children: `This ${label} couldn't be found \u2014 it may have been moved, deleted, or isn't shared with you.` });
|
|
1234
1245
|
}
|
|
1235
1246
|
if (core.status === "error") {
|
|
1236
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ jsxs4(Notice, { tone: "error", children: [
|
|
1248
|
+
`Couldn't load the details for this ${label}. ${core.errorMessage ?? ""}`.trim(),
|
|
1249
|
+
/* @__PURE__ */ jsx5(ErrorActions2, { origin: "detail/DetailBody", operation: `Load this ${label}`, error: core.errorMessage })
|
|
1250
|
+
] });
|
|
1237
1251
|
}
|
|
1238
1252
|
if (core.status === "none") {
|
|
1239
1253
|
return /* @__PURE__ */ jsx5(Notice, { tone: "muted", children: `Nothing more about this ${label} is stored here, so there is nothing else to show. ` + whatTheControlsDo(core) });
|
|
@@ -1284,8 +1298,8 @@ function LoadingFields({ core, label }) {
|
|
|
1284
1298
|
label,
|
|
1285
1299
|
" \u2014 the read has been running for more than",
|
|
1286
1300
|
" ",
|
|
1287
|
-
|
|
1288
|
-
"
|
|
1301
|
+
formatDurationMs(SLOW_LOAD_NOTICE_MS, { style: "long" }),
|
|
1302
|
+
". If nothing appears, the record may be unreachable from here; closing and reopening it starts a fresh read."
|
|
1289
1303
|
] }) : null,
|
|
1290
1304
|
Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsxs4("div", { className: "space-y-1.5", children: [
|
|
1291
1305
|
/* @__PURE__ */ jsx5(Skeleton, { className: "h-2.5 w-20" }),
|
|
@@ -1348,7 +1362,10 @@ function HistorySection({ core }) {
|
|
|
1348
1362
|
state.status === "loading" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-1.5", "aria-busy": "true", "aria-label": "Loading history", children: [
|
|
1349
1363
|
/* @__PURE__ */ jsx5(Skeleton, { className: "h-3.5 w-2/3" }),
|
|
1350
1364
|
/* @__PURE__ */ jsx5(Skeleton, { className: "h-3.5 w-1/2" })
|
|
1351
|
-
] }) : state.status === "error" ? /* @__PURE__ */
|
|
1365
|
+
] }) : state.status === "error" ? /* @__PURE__ */ jsxs4("p", { className: "text-xs text-muted-foreground", children: [
|
|
1366
|
+
state.message.toLowerCase().includes("access denied") ? "History is only shown to people who can view this record." : `History could not be read: ${state.message}`,
|
|
1367
|
+
/* @__PURE__ */ jsx5(ErrorActions2, { origin: "detail/DetailBody", operation: "Read the history", error: state.message })
|
|
1368
|
+
] }) : state.entries.length === 0 ? /* @__PURE__ */ jsx5("p", { className: "text-xs text-muted-foreground", children: "No recorded changes yet." }) : /* @__PURE__ */ jsx5("ol", { className: "space-y-1", children: state.entries.map((entry) => /* @__PURE__ */ jsxs4(
|
|
1352
1369
|
"li",
|
|
1353
1370
|
{
|
|
1354
1371
|
className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs",
|