@ai-matrx/detail 0.1.1 → 0.1.3
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 +23 -0
- package/dist/react.cjs +47 -19
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +49 -21
- package/dist/react.js.map +1 -1
- package/package.json +3 -3
package/dist/react.js
CHANGED
|
@@ -877,7 +877,7 @@ 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
|
|
@@ -894,7 +894,7 @@ function formatWhen(iso) {
|
|
|
894
894
|
|
|
895
895
|
// src/react/DetailPresentationPane.tsx
|
|
896
896
|
import { useEffect as useEffect6, useRef as useRef5, useState as useState4 } from "react";
|
|
897
|
-
import { cn as cn2 } from "@ai-matrx/design-system";
|
|
897
|
+
import { cn as cn2, ErrorActions } from "@ai-matrx/design-system";
|
|
898
898
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
899
899
|
var WORD = {
|
|
900
900
|
window: "a window",
|
|
@@ -972,20 +972,26 @@ function DetailPresentationPane({ core }) {
|
|
|
972
972
|
}, [open, save, registerSave]);
|
|
973
973
|
if (!save) return null;
|
|
974
974
|
if (!open) {
|
|
975
|
-
return /* @__PURE__ */ jsxs3(
|
|
976
|
-
"
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
"
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
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
|
+
] });
|
|
989
995
|
}
|
|
990
996
|
return /* @__PURE__ */ jsxs3(
|
|
991
997
|
"section",
|
|
@@ -1067,11 +1073,15 @@ function DetailPresentationPane({ core }) {
|
|
|
1067
1073
|
}
|
|
1068
1074
|
)
|
|
1069
1075
|
] }),
|
|
1070
|
-
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,
|
|
1071
1080
|
setting.error ? /* @__PURE__ */ jsxs3("p", { className: "text-xs text-muted-foreground", children: [
|
|
1072
1081
|
"The saved setting could not be read here (",
|
|
1073
1082
|
setting.error,
|
|
1074
|
-
"), 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 })
|
|
1075
1085
|
] }) : null
|
|
1076
1086
|
]
|
|
1077
1087
|
}
|
|
@@ -1231,10 +1241,25 @@ function FieldsSection({ core }) {
|
|
|
1231
1241
|
return /* @__PURE__ */ jsx5(LoadingFields, { core, label });
|
|
1232
1242
|
}
|
|
1233
1243
|
if (core.status === "not-found") {
|
|
1234
|
-
|
|
1244
|
+
const sentence = `This ${label} couldn't be found \u2014 it may have been moved, deleted, or isn't shared with you.`;
|
|
1245
|
+
return /* @__PURE__ */ jsxs4(Notice, { tone: "warn", children: [
|
|
1246
|
+
sentence,
|
|
1247
|
+
/* @__PURE__ */ jsx5(
|
|
1248
|
+
ErrorActions2,
|
|
1249
|
+
{
|
|
1250
|
+
origin: "detail/DetailBody",
|
|
1251
|
+
operation: `Open this ${label}`,
|
|
1252
|
+
message: sentence,
|
|
1253
|
+
records: [{ type: core.ref.type, id: core.ref.id }]
|
|
1254
|
+
}
|
|
1255
|
+
)
|
|
1256
|
+
] });
|
|
1235
1257
|
}
|
|
1236
1258
|
if (core.status === "error") {
|
|
1237
|
-
return /* @__PURE__ */
|
|
1259
|
+
return /* @__PURE__ */ jsxs4(Notice, { tone: "error", children: [
|
|
1260
|
+
`Couldn't load the details for this ${label}. ${core.errorMessage ?? ""}`.trim(),
|
|
1261
|
+
/* @__PURE__ */ jsx5(ErrorActions2, { origin: "detail/DetailBody", operation: `Load this ${label}`, error: core.errorMessage })
|
|
1262
|
+
] });
|
|
1238
1263
|
}
|
|
1239
1264
|
if (core.status === "none") {
|
|
1240
1265
|
return /* @__PURE__ */ jsx5(Notice, { tone: "muted", children: `Nothing more about this ${label} is stored here, so there is nothing else to show. ` + whatTheControlsDo(core) });
|
|
@@ -1349,7 +1374,10 @@ function HistorySection({ core }) {
|
|
|
1349
1374
|
state.status === "loading" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-1.5", "aria-busy": "true", "aria-label": "Loading history", children: [
|
|
1350
1375
|
/* @__PURE__ */ jsx5(Skeleton, { className: "h-3.5 w-2/3" }),
|
|
1351
1376
|
/* @__PURE__ */ jsx5(Skeleton, { className: "h-3.5 w-1/2" })
|
|
1352
|
-
] }) : state.status === "error" ? /* @__PURE__ */
|
|
1377
|
+
] }) : state.status === "error" ? /* @__PURE__ */ jsxs4("p", { className: "text-xs text-muted-foreground", children: [
|
|
1378
|
+
state.message.toLowerCase().includes("access denied") ? "History is only shown to people who can view this record." : `History could not be read: ${state.message}`,
|
|
1379
|
+
/* @__PURE__ */ jsx5(ErrorActions2, { origin: "detail/DetailBody", operation: "Read the history", error: state.message })
|
|
1380
|
+
] }) : 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(
|
|
1353
1381
|
"li",
|
|
1354
1382
|
{
|
|
1355
1383
|
className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs",
|