@declarion/react 0.446.0 → 0.517.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 (43) hide show
  1. package/dist-lib/components/agents/AgentChatPanel.impl.js +349 -332
  2. package/dist-lib/components/detail-layout/DetailAuditStrip.js +1 -1
  3. package/dist-lib/components/detail-layout/EvidenceBlock.js +36 -24
  4. package/dist-lib/components/detail-layout/FieldRow.js +56 -60
  5. package/dist-lib/components/detail-layout/FieldsBlock.js +48 -47
  6. package/dist-lib/components/detail-layout/PropertiesBlock.js +42 -41
  7. package/dist-lib/components/detail-layout/labelLayout.js +35 -0
  8. package/dist-lib/components/fields/JsonField.js +128 -125
  9. package/dist-lib/components/fields/StringField.js +10 -25
  10. package/dist-lib/components/fields/StructureField.js +125 -167
  11. package/dist-lib/components/fields/ValueRows.js +114 -0
  12. package/dist-lib/components/fields/cells/factories/id.js +10 -0
  13. package/dist-lib/components/fields/cells/factories/nextRun.js +18 -27
  14. package/dist-lib/components/fields/cells/factories/refLink.js +15 -41
  15. package/dist-lib/components/fields/cells/registry.js +25 -23
  16. package/dist-lib/components/file-widgets/DocumentCard.js +142 -142
  17. package/dist-lib/components/file-widgets/helpers.js +32 -19
  18. package/dist-lib/components/file-widgets/host.js +4 -1
  19. package/dist-lib/components/list/PeekFieldCell.js +57 -55
  20. package/dist-lib/components/list/QuickPeek.js +109 -121
  21. package/dist-lib/components/pages/SmartDetailPage.impl.js +403 -400
  22. package/dist-lib/components/pages/SmartListPage.impl.js +260 -260
  23. package/dist-lib/components/pages/list/ListCardRow.js +101 -100
  24. package/dist-lib/components/pages/list/cardProjection.js +117 -112
  25. package/dist-lib/components/pages/list/useListQuery.js +1 -1
  26. package/dist-lib/components/pages/list/useListRowInteraction.js +68 -65
  27. package/dist-lib/components/primitives/IdBadge.js +27 -0
  28. package/dist-lib/components/primitives/RowField.js +11 -43
  29. package/dist-lib/components/shared/CopyButton.js +13 -18
  30. package/dist-lib/components/shared/RefChip.js +33 -0
  31. package/dist-lib/declarion-react.css +1 -1
  32. package/dist-lib/hooks/useAgentConversation.js +134 -110
  33. package/dist-lib/hooks/useCopy.js +18 -0
  34. package/dist-lib/index.d.ts +55 -20
  35. package/dist-lib/index.js +116 -111
  36. package/dist-lib/lib/realtime-reconcile.js +70 -59
  37. package/dist-lib/lib/reference.js +52 -34
  38. package/dist-lib/lib/short-id.js +12 -0
  39. package/dist-lib/testing.d.ts +1 -1
  40. package/dist-lib/types/schema.js +84 -80
  41. package/dist-lib/{useResponsiveMode-3hOLBkey.d.ts → useResponsiveMode-BObVfNyN.d.ts} +7 -2
  42. package/package.json +6 -1
  43. package/dist-lib/components/primitives/RecordIdBadge.js +0 -25
@@ -1,7 +1,7 @@
1
1
  import { renderSchemaField as e } from "../file-widgets/host.js";
2
2
  import { AuditMetaStrip as t } from "../chrome/AuditMetaStrip.js";
3
3
  import { useText as n } from "../../hooks/useText.js";
4
- import { RecordIdBadge as r } from "../primitives/RecordIdBadge.js";
4
+ import { IdBadge as r } from "../primitives/IdBadge.js";
5
5
  import { jsx as i } from "react/jsx-runtime";
6
6
  // src/components/detail-layout/DetailAuditStrip.tsx
7
7
  function a({ screen: a, entity: o, entityCode: s, record: c, recordId: l, refs: u, schema: d }) {
@@ -1,23 +1,30 @@
1
1
  import { Pill as e } from "../primitives/Pill.js";
2
- import { evidenceVerdictPill as t } from "../../lib/evidence-verdict.js";
3
- import { useSchema as n } from "../../hooks/useSchema.js";
4
- import { useText as r } from "../../hooks/useText.js";
5
- import { formatOffsetTimestamp as i } from "../../lib/timestamp.js";
6
- import { messageText as a } from "../../lib/message.js";
7
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
2
+ import { bucketReference as t } from "../../lib/reference.js";
3
+ import { RefChip as n } from "../shared/RefChip.js";
4
+ import { evidenceVerdictPill as r } from "../../lib/evidence-verdict.js";
5
+ import { useSchema as i } from "../../hooks/useSchema.js";
6
+ import { useText as a } from "../../hooks/useText.js";
7
+ import { formatOffsetTimestamp as o } from "../../lib/timestamp.js";
8
+ import { messageText as s } from "../../lib/message.js";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
10
  // src/components/detail-layout/EvidenceBlock.tsx
9
- function c(e, t) {
10
- if (e && !Number.isNaN(new Date(e).getTime())) return i(e, { zone: t });
11
+ var u = "$evidence@evidence_record";
12
+ function d(e, t) {
13
+ if (e && !Number.isNaN(new Date(e).getTime())) return o(e, { zone: t });
11
14
  }
12
- function l({ evidence: i }) {
13
- let l = r(), { data: u } = n(), d = t(l, u?.enums, i?.verdict ?? "unverified"), f = c(i?.verified_at, l.timeZone), p = a(l, i?.reason), m = [];
14
- return i?.seq && m.push(l("record.evidence.chain", "chain #{seq}", { seq: i.seq })), i?.generation && m.push(l("record.evidence.generation", "generation {number}", { number: i.generation })), /* @__PURE__ */ s("div", {
15
+ function f({ evidence: o, refs: f }) {
16
+ let p = a(), { data: m } = i(), h = r(p, m?.enums, o?.verdict ?? "unverified"), g = d(o?.verified_at, p.timeZone), _ = s(p, o?.reason), v = o?.record_id ? t({
17
+ entities: m?.entities,
18
+ screens: m?.screens,
19
+ t: p
20
+ }, f, u, "evidence_record", o.record_id) : void 0, y = [];
21
+ return o?.seq && !v?.resolved && y.push(p("record.evidence.chain", "chain #{seq}", { seq: o.seq })), o?.generation && y.push(p("record.evidence.generation", "generation {number}", { number: o.generation })), /* @__PURE__ */ l("div", {
15
22
  style: {
16
23
  display: "flex",
17
24
  flexDirection: "column",
18
25
  gap: 6
19
26
  },
20
- children: [/* @__PURE__ */ s("div", {
27
+ children: [/* @__PURE__ */ l("div", {
21
28
  style: {
22
29
  display: "flex",
23
30
  alignItems: "center",
@@ -25,42 +32,47 @@ function l({ evidence: i }) {
25
32
  flexWrap: "wrap"
26
33
  },
27
34
  children: [
28
- /* @__PURE__ */ o("span", {
35
+ /* @__PURE__ */ c("span", {
29
36
  style: {
30
37
  fontSize: 12,
31
38
  fontWeight: 600,
32
39
  color: "var(--muted-foreground)"
33
40
  },
34
- children: l("record.evidence.title", "Evidence")
41
+ children: p("record.evidence.title", "Evidence")
35
42
  }),
36
- m.length > 0 && /* @__PURE__ */ o("span", {
43
+ v?.resolved && /* @__PURE__ */ c(n, {
44
+ label: v.label,
45
+ href: v.href,
46
+ icon: v.icon
47
+ }),
48
+ y.length > 0 && /* @__PURE__ */ c("span", {
37
49
  style: {
38
50
  fontSize: 12,
39
51
  color: "var(--muted-foreground)"
40
52
  },
41
- children: m.join(" · ")
53
+ children: y.join(" · ")
42
54
  }),
43
- /* @__PURE__ */ o(e, {
44
- tone: d.tone,
55
+ /* @__PURE__ */ c(e, {
56
+ tone: h.tone,
45
57
  size: "sm",
46
58
  dot: !0,
47
- children: d.label
59
+ children: h.label
48
60
  }),
49
- f && /* @__PURE__ */ o("span", {
61
+ g && /* @__PURE__ */ c("span", {
50
62
  style: {
51
63
  fontSize: 12,
52
64
  color: "var(--muted-foreground)"
53
65
  },
54
- children: l("record.evidence.verified", "Checked {when}", { when: f })
66
+ children: p("record.evidence.verified", "Checked {when}", { when: g })
55
67
  })
56
68
  ]
57
- }), p && /* @__PURE__ */ o("span", {
69
+ }), _ && /* @__PURE__ */ c("span", {
58
70
  style: {
59
71
  fontSize: 12,
60
72
  color: "var(--destructive)"
61
73
  },
62
- children: p
74
+ children: _
63
75
  })]
64
76
  });
65
77
  }
66
- export { l as EvidenceBlock };
78
+ export { u as EVIDENCE_RECORD_BUCKET, f as EvidenceBlock };
@@ -2,27 +2,25 @@ import { Icon as e } from "../primitives/Icons.js";
2
2
  import { CopyButton as t } from "../shared/CopyButton.js";
3
3
  import { useText as n } from "../../hooks/useText.js";
4
4
  import { coerceDisplayString as r } from "../../lib/display-value.js";
5
- import { createContext as i, useContext as a, useLayoutEffect as o, useRef as s, useState as c } from "react";
6
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ import { LABEL_TEXT_STYLE as i, LabelLayoutContext as a, NestedBlock as o, useLabelLayout as s } from "./labelLayout.js";
6
+ import { useLayoutEffect as c, useRef as l, useState as u } from "react";
7
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
7
8
  // src/components/detail-layout/FieldRow.tsx
8
- var d = 150, f = 560, p = 374, m = "20px", h = 4;
9
- function g(e, t) {
10
- if ((e?.copyable || e?.type === "uuid") && t != null && t !== "") return r(t);
9
+ var p = 560, m = 374, h = "20px", g = 4;
10
+ function _(e, t) {
11
+ if (e?.copyable && e.display?.widget !== "id" && t != null && t !== "") return r(t);
11
12
  }
12
- var _ = /* @__PURE__ */ new Set([
13
+ var v = /* @__PURE__ */ new Set(["json", "structure"]), y = /* @__PURE__ */ new Set([
13
14
  "text",
14
15
  "rich_text",
15
16
  "json",
16
17
  "structure",
17
18
  "multilang_text",
18
19
  "multilang_array"
19
- ]), v = i({
20
- columns: 2,
21
- stackPairs: !1
22
- });
23
- function y({ columns: e = 2, children: t }) {
24
- let n = s(null), [r, i] = c(null);
25
- o(() => {
20
+ ]);
21
+ function b({ columns: e = 2, children: t }) {
22
+ let n = l(null), [r, i] = u(null);
23
+ c(() => {
26
24
  let e = n.current;
27
25
  if (!e) return;
28
26
  let t = (e) => i(e > 0 ? e : null);
@@ -32,17 +30,17 @@ function y({ columns: e = 2, children: t }) {
32
30
  });
33
31
  return r.observe(e), () => r.disconnect();
34
32
  }, []);
35
- let a = e === 1 || r !== null && r < f ? 1 : e, u = r === null ? null : (r - (a - 1) * 24) / a, d = u !== null && u < p;
36
- return /* @__PURE__ */ l(v.Provider, {
33
+ let o = e === 1 || r !== null && r < p ? 1 : e, s = r === null ? null : (r - (o - 1) * 24) / o, f = s !== null && s < m;
34
+ return /* @__PURE__ */ d(a.Provider, {
37
35
  value: {
38
- columns: a,
39
- stackPairs: d
36
+ columns: o,
37
+ stackPairs: f
40
38
  },
41
- children: /* @__PURE__ */ l("div", {
39
+ children: /* @__PURE__ */ d("div", {
42
40
  ref: n,
43
41
  style: {
44
42
  display: "grid",
45
- gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))`,
43
+ gridTemplateColumns: `repeat(${o}, minmax(0, 1fr))`,
46
44
  columnGap: 24,
47
45
  rowGap: 2
48
46
  },
@@ -50,43 +48,41 @@ function y({ columns: e = 2, children: t }) {
50
48
  })
51
49
  });
52
50
  }
53
- function b({ label: r, children: i, span: o = !1, required: s, error: c, hint: f, actions: p, copyValue: g, mode: _ = "display", htmlFor: y, labelId: b, labelTitle: x, "data-testid": S }) {
54
- let C = n(), w = a(v), T = o || w.stackPairs, E = !!c;
55
- return /* @__PURE__ */ u("div", {
51
+ function x({ label: r, children: a, span: c = !1, nested: l = !1, required: u, error: p, hint: m, actions: _, copyValue: v, mode: y = "display", htmlFor: b, labelId: x, labelTitle: S, "data-testid": C }) {
52
+ let w = n(), T = s(), E = c || T.stackPairs, D = !!p;
53
+ return /* @__PURE__ */ f("div", {
56
54
  className: "detail-row",
57
- "data-error": E || void 0,
58
- "data-testid": S,
55
+ "data-error": D || void 0,
56
+ "data-testid": C,
59
57
  style: {
60
58
  display: "flex",
61
- flexDirection: T ? "column" : "row",
62
- gap: T ? 4 : 16,
63
- alignItems: T ? "stretch" : "flex-start",
59
+ flexDirection: E ? "column" : "row",
60
+ gap: E ? 4 : 16,
61
+ alignItems: E ? "stretch" : "flex-start",
64
62
  padding: "6px 0",
65
- ...o ? { gridColumn: "1 / -1" } : null
63
+ ...c ? { gridColumn: "1 / -1" } : null
66
64
  },
67
- children: [/* @__PURE__ */ u("div", {
65
+ children: [/* @__PURE__ */ f("div", {
68
66
  style: {
69
- width: T ? "auto" : d,
67
+ width: E ? "auto" : 150,
70
68
  flexShrink: 0,
71
- paddingTop: T ? 0 : h,
72
- fontSize: 12,
73
- lineHeight: m,
74
- fontWeight: 500,
75
- color: "var(--text-3)",
69
+ paddingTop: E ? 0 : g,
70
+ ...i,
71
+ lineHeight: h,
76
72
  display: "flex",
77
73
  alignItems: "flex-start",
78
74
  gap: 2
79
75
  },
80
- children: [y ? /* @__PURE__ */ l("label", {
81
- id: b,
82
- htmlFor: y,
83
- title: x || void 0,
76
+ children: [b ? /* @__PURE__ */ d("label", {
77
+ id: x,
78
+ htmlFor: b,
79
+ title: S || void 0,
84
80
  children: r
85
- }) : /* @__PURE__ */ l("span", {
86
- id: b,
87
- title: x || void 0,
81
+ }) : /* @__PURE__ */ d("span", {
82
+ id: x,
83
+ title: S || void 0,
88
84
  children: r
89
- }), s && _ === "edit" && /* @__PURE__ */ l("span", {
85
+ }), u && y === "edit" && /* @__PURE__ */ d("span", {
90
86
  "aria-hidden": "true",
91
87
  style: {
92
88
  color: "var(--danger)",
@@ -94,7 +90,7 @@ function b({ label: r, children: i, span: o = !1, required: s, error: c, hint: f
94
90
  },
95
91
  children: "*"
96
92
  })]
97
- }), /* @__PURE__ */ u("div", {
93
+ }), /* @__PURE__ */ f("div", {
98
94
  style: {
99
95
  flex: 1,
100
96
  minWidth: 0,
@@ -102,31 +98,31 @@ function b({ label: r, children: i, span: o = !1, required: s, error: c, hint: f
102
98
  flexDirection: "column",
103
99
  gap: 3
104
100
  },
105
- children: [/* @__PURE__ */ u("div", {
101
+ children: [/* @__PURE__ */ f("div", {
106
102
  style: {
107
103
  display: "flex",
108
104
  alignItems: "flex-start",
109
105
  gap: 6,
110
106
  minHeight: 24
111
107
  },
112
- children: [/* @__PURE__ */ l("div", {
108
+ children: [/* @__PURE__ */ d("div", {
113
109
  style: {
114
110
  flex: 1,
115
111
  minWidth: 0,
116
112
  fontSize: 13,
117
- lineHeight: m,
113
+ lineHeight: h,
118
114
  color: "var(--text)",
119
115
  overflowWrap: "anywhere",
120
- paddingTop: _ === "display" && !T ? h : 0
116
+ paddingTop: y === "display" && !E ? g : 0
121
117
  },
122
- children: E && _ === "edit" ? /* @__PURE__ */ l("div", {
118
+ children: D && y === "edit" ? /* @__PURE__ */ d("div", {
123
119
  style: {
124
120
  borderRadius: "var(--radius-md)",
125
121
  boxShadow: "0 0 0 1.5px var(--danger)"
126
122
  },
127
- children: i
128
- }) : i
129
- }), (g || p) && /* @__PURE__ */ u("div", {
123
+ children: a
124
+ }) : l && y === "display" ? /* @__PURE__ */ d(o, { children: a }) : a
125
+ }), (v || _) && /* @__PURE__ */ f("div", {
130
126
  className: "detail-row-action",
131
127
  style: {
132
128
  display: "flex",
@@ -134,24 +130,24 @@ function b({ label: r, children: i, span: o = !1, required: s, error: c, hint: f
134
130
  flexShrink: 0,
135
131
  marginTop: -2
136
132
  },
137
- children: [g && /* @__PURE__ */ l(t, {
138
- value: g,
133
+ children: [v && /* @__PURE__ */ d(t, {
134
+ value: v,
139
135
  size: "sm",
140
- title: C("record.field.copy_value", "Copy value")
141
- }), p]
136
+ title: w("record.field.copy_value", "Copy value")
137
+ }), _]
142
138
  })]
143
- }), (E || f != null) && /* @__PURE__ */ u("div", {
139
+ }), (D || m != null) && /* @__PURE__ */ f("div", {
144
140
  style: {
145
141
  fontSize: 11.5,
146
142
  lineHeight: 1.4,
147
- color: E ? "var(--danger)" : "var(--text-3)",
143
+ color: D ? "var(--danger)" : "var(--text-3)",
148
144
  display: "flex",
149
145
  alignItems: "center",
150
146
  gap: 4
151
147
  },
152
- children: [E && /* @__PURE__ */ l(e.warning, { size: 11 }), /* @__PURE__ */ l("span", { children: E ? c : f })]
148
+ children: [D && /* @__PURE__ */ d(e.warning, { size: 11 }), /* @__PURE__ */ d("span", { children: D ? p : m })]
153
149
  })]
154
150
  })]
155
151
  });
156
152
  }
157
- export { b as FieldRow, y as FieldsGrid, _ as SPAN_FIELD_TYPES, g as copyableValue };
153
+ export { x as FieldRow, b as FieldsGrid, v as NESTED_FIELD_TYPES, y as SPAN_FIELD_TYPES, _ as copyableValue };
@@ -2,75 +2,76 @@ import { ActionButton as e } from "../actions/ActionButton.js";
2
2
  import { renderSchemaField as t, resolveSchemaFieldLabel as n, schemaFieldHasValue as r } from "../file-widgets/host.js";
3
3
  import { ClassifiedFieldLocked as i } from "../primitives/ClassifiedFieldLocked.js";
4
4
  import { classificationTier as a, fieldAccessInfo as o } from "../../lib/field-classification.js";
5
- import { FieldRow as s, FieldsGrid as c, SPAN_FIELD_TYPES as l, copyableValue as u } from "./FieldRow.js";
6
- import { useText as d } from "../../hooks/useText.js";
7
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
5
+ import { FieldRow as s, FieldsGrid as c, NESTED_FIELD_TYPES as l, SPAN_FIELD_TYPES as u, copyableValue as d } from "./FieldRow.js";
6
+ import { useText as f } from "../../hooks/useText.js";
7
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
8
8
  // src/components/detail-layout/FieldsBlock.tsx
9
- function h({ fields: r, ctx: h }) {
10
- let _ = d(), { entity: v, entityCode: y, record: b, mode: x, onFieldChange: S, schema: C, isNew: w } = h, T = h.columns ?? 2, E = r.filter((e) => g(h, e.code)), D = T === 1 && r.length === 1;
11
- return E.length === 0 ? null : /* @__PURE__ */ p(c, {
12
- columns: T,
13
- children: E.map((r) => {
14
- let c = r.code, d = `${y ?? "field"}-${c}`, g = `${d}-label`, T = v.fields.get(c), E = !!(T?.auto || T?.readonly || T?.source || T?.immutable && !w), O = o(v, c), k = O?.read === "denied", A = O?.write === "denied", j = x === "display" ? k : A || k, M = E || x === "edit" && A ? "display" : x, N = j ? /* @__PURE__ */ p(i, {
15
- tier: O.classification,
16
- tierDef: a(C, v, c),
17
- requiredPermission: O?.required_permission,
18
- variant: M === "edit" ? "input" : "value"
9
+ function g({ fields: r, ctx: g }) {
10
+ let v = f(), { entity: y, entityCode: b, record: x, mode: S, onFieldChange: C, schema: w, isNew: T } = g, E = g.columns ?? 2, D = r.filter((e) => _(g, e.code)), O = E === 1 && r.length === 1;
11
+ return D.length === 0 ? null : /* @__PURE__ */ m(c, {
12
+ columns: E,
13
+ children: D.map((r) => {
14
+ let c = r.code, f = `${b ?? "field"}-${c}`, _ = `${f}-label`, E = y.fields.get(c), D = !!(E?.auto || E?.readonly || E?.source || E?.immutable && !T), k = o(y, c), A = k?.read === "denied", j = k?.write === "denied", M = S === "display" ? A : j || A, N = D || S === "edit" && j ? "display" : S, P = M ? /* @__PURE__ */ m(i, {
15
+ tier: k.classification,
16
+ tierDef: a(w, y, c),
17
+ requiredPermission: k?.required_permission,
18
+ variant: N === "edit" ? "input" : "value"
19
19
  }) : t({
20
- entity: v,
21
- entityCode: y,
20
+ entity: y,
21
+ entityCode: b,
22
22
  fieldName: c,
23
- record: b,
24
- mode: M,
25
- onChange: S && !E ? (e) => S(c, e) : void 0,
26
- refs: h.refs,
27
- entities: C?.entities,
28
- screens: C?.screens,
29
- t: _,
30
- fieldId: d,
31
- labelId: g,
23
+ record: x,
24
+ mode: N,
25
+ onChange: C && !D ? (e) => C(c, e) : void 0,
26
+ refs: g.refs,
27
+ entities: w?.entities,
28
+ screens: w?.screens,
29
+ t: v,
30
+ fieldId: f,
31
+ labelId: _,
32
32
  structure: r.structure,
33
33
  detailScreen: r.detail_screen
34
34
  });
35
- if (!N) return null;
36
- let P = x === "display" && r.actions && r.actions.length > 0 ? /* @__PURE__ */ p(f, { children: r.actions.map((t, n) => /* @__PURE__ */ p(e, {
35
+ if (!P) return null;
36
+ let F = S === "display" && r.actions && r.actions.length > 0 ? /* @__PURE__ */ m(p, { children: r.actions.map((t, n) => /* @__PURE__ */ m(e, {
37
37
  actionCode: `${c}.action[${n}]`,
38
38
  action: t,
39
- entityCode: y,
40
- row: b,
39
+ entityCode: b,
40
+ row: x,
41
41
  variant: "ghost",
42
42
  size: "icon"
43
- }, n)) }) : void 0, F = !!T && l.has(T.type), I = M === "display" ? u(T, b?.[c]) : void 0, L = _(T?.display?.description);
44
- return D && (F || r.structure || v.files?.get(c)) ? /* @__PURE__ */ m("div", {
43
+ }, n)) }) : void 0, I = !!E && u.has(E.type), L = N === "display" ? d(E, x?.[c]) : void 0, R = v(E?.display?.description);
44
+ return O && (I || r.structure || y.files?.get(c)) ? /* @__PURE__ */ h("div", {
45
45
  style: { gridColumn: "1 / -1" },
46
- children: [N, M === "edit" && L && /* @__PURE__ */ p("div", {
46
+ children: [P, N === "edit" && R && /* @__PURE__ */ m("div", {
47
47
  style: {
48
48
  fontSize: 11.5,
49
49
  lineHeight: 1.4,
50
50
  color: "var(--text-3)",
51
51
  marginTop: 3
52
52
  },
53
- children: L
53
+ children: R
54
54
  })]
55
- }, c) : /* @__PURE__ */ p(s, {
55
+ }, c) : /* @__PURE__ */ m(s, {
56
56
  "data-testid": `field-${c}`,
57
- label: n(_, v, c, C.entities),
58
- htmlFor: M === "edit" ? d : void 0,
59
- labelId: g,
60
- labelTitle: L || void 0,
61
- required: T?.required ?? !1,
62
- mode: M,
63
- span: F,
64
- error: h.fieldErrors?.[c],
65
- hint: M === "edit" && L ? L : void 0,
66
- actions: P,
67
- copyValue: I,
68
- children: N
57
+ label: n(v, y, c, w.entities),
58
+ htmlFor: N === "edit" ? f : void 0,
59
+ labelId: _,
60
+ labelTitle: R || void 0,
61
+ required: E?.required ?? !1,
62
+ mode: N,
63
+ span: I,
64
+ nested: !!E && (l.has(E.type) || !!r.structure),
65
+ error: g.fieldErrors?.[c],
66
+ hint: N === "edit" && R ? R : void 0,
67
+ actions: F,
68
+ copyValue: L,
69
+ children: P
69
70
  }, c);
70
71
  })
71
72
  });
72
73
  }
73
- function g(e, t) {
74
+ function _(e, t) {
74
75
  return e.mode === "display" ? e.headerFields?.has(t) ? !1 : !e.hideEmptyFields || r(e.entity, e.record, t) : !0;
75
76
  }
76
- export { h as FieldsBlock, g as displaysField };
77
+ export { g as FieldsBlock, _ as displaysField };
@@ -2,13 +2,13 @@ import { renderField as e } from "../fields/index.js";
2
2
  import { propertyToField as t } from "../../types/schema.js";
3
3
  import { ClassifiedFieldLocked as n } from "../primitives/ClassifiedFieldLocked.js";
4
4
  import { classificationTier as r, fieldAccessInfo as i } from "../../lib/field-classification.js";
5
- import { FieldRow as a, FieldsGrid as o, SPAN_FIELD_TYPES as s } from "./FieldRow.js";
6
- import { useText as c } from "../../hooks/useText.js";
7
- import { SectionCard as l } from "../primitives/SectionCard.js";
8
- import { useCallback as u, useEffect as d, useRef as f } from "react";
9
- import { jsx as p } from "react/jsx-runtime";
5
+ import { FieldRow as a, FieldsGrid as o, NESTED_FIELD_TYPES as s, SPAN_FIELD_TYPES as c } from "./FieldRow.js";
6
+ import { useText as l } from "../../hooks/useText.js";
7
+ import { SectionCard as u } from "../primitives/SectionCard.js";
8
+ import { useCallback as d, useEffect as f, useRef as p } from "react";
9
+ import { jsx as m } from "react/jsx-runtime";
10
10
  // src/components/detail-layout/PropertiesBlock.tsx
11
- var m = /* @__PURE__ */ new Set([
11
+ var h = /* @__PURE__ */ new Set([
12
12
  "string",
13
13
  "text",
14
14
  "int",
@@ -16,22 +16,22 @@ var m = /* @__PURE__ */ new Set([
16
16
  "decimal",
17
17
  "email",
18
18
  "url"
19
- ]), h = 500;
20
- function g({ node: e, ctx: n }) {
21
- let { entity: r, objectProperties: i, onSetProperty: a, isNew: s, mode: u, refs: d } = n, f = c(), m = r.properties ?? {};
19
+ ]), g = 500;
20
+ function _({ node: e, ctx: n }) {
21
+ let { entity: r, objectProperties: i, onSetProperty: a, isNew: s, mode: c, refs: d } = n, f = l(), p = r.properties ?? {};
22
22
  if (s) return null;
23
- let h = e.properties === !0 || e.properties, g = h === !0 ? Object.entries(m).sort(([e], [t]) => e.localeCompare(t)) : h.filter((e) => m[e] != null).map((e) => [e, m[e]]);
23
+ let h = e.properties === !0 || e.properties, g = h === !0 ? Object.entries(p).sort(([e], [t]) => e.localeCompare(t)) : h.filter((e) => p[e] != null).map((e) => [e, p[e]]);
24
24
  if (g.length === 0) return null;
25
- let v = /* @__PURE__ */ p(o, {
25
+ let _ = /* @__PURE__ */ m(o, {
26
26
  columns: 2,
27
27
  children: g.map(([e, o]) => {
28
- let s = i?.find((t) => t.property_code === e), c = t(o), l = o.readonly || !a ? "display" : u;
29
- return /* @__PURE__ */ p(_, {
28
+ let s = i?.find((t) => t.property_code === e), l = t(o), u = o.readonly || !a ? "display" : c;
29
+ return /* @__PURE__ */ m(v, {
30
30
  propCode: e,
31
31
  prop: o,
32
- field: c,
32
+ field: l,
33
33
  value: s?.value,
34
- mode: l,
34
+ mode: u,
35
35
  onSetProperty: a,
36
36
  refs: d,
37
37
  entity: r,
@@ -39,41 +39,42 @@ function g({ node: e, ctx: n }) {
39
39
  }, e);
40
40
  })
41
41
  });
42
- return n.withinCard ? v : /* @__PURE__ */ p(l, {
42
+ return n.withinCard ? _ : /* @__PURE__ */ m(u, {
43
43
  title: f("record.properties", "Properties"),
44
- children: v
44
+ children: _
45
45
  });
46
46
  }
47
- function _({ propCode: t, prop: o, field: l, value: g, mode: _, onSetProperty: v, refs: y, entity: b, schema: x }) {
48
- let S = c(), C = f(null);
49
- d(() => () => {
50
- C.current && clearTimeout(C.current);
47
+ function v({ propCode: t, prop: o, field: u, value: _, mode: v, onSetProperty: y, refs: b, entity: x, schema: S }) {
48
+ let C = l(), w = p(null);
49
+ f(() => () => {
50
+ w.current && clearTimeout(w.current);
51
51
  }, []);
52
- let w = u((e) => {
53
- v && (m.has(o.type) ? (C.current && clearTimeout(C.current), C.current = setTimeout(() => v(t, e), h)) : v(t, e));
52
+ let T = d((e) => {
53
+ y && (h.has(o.type) ? (w.current && clearTimeout(w.current), w.current = setTimeout(() => y(t, e), g)) : y(t, e));
54
54
  }, [
55
55
  t,
56
56
  o.type,
57
- v
58
- ]), T = i(b, t), E = T?.read === "denied", D = T?.write === "denied", O = _ === "display" ? E : D || E, k = _ === "edit" && D ? "display" : _;
59
- return /* @__PURE__ */ p(a, {
60
- label: S(o.display?.name ?? o.name),
61
- mode: k,
62
- span: s.has(o.type),
63
- children: O ? /* @__PURE__ */ p(n, {
64
- tier: T.classification,
65
- tierDef: r(x, b, t),
66
- requiredPermission: T?.required_permission,
67
- variant: k === "edit" ? "input" : "value"
57
+ y
58
+ ]), E = i(x, t), D = E?.read === "denied", O = E?.write === "denied", k = v === "display" ? D : O || D, A = v === "edit" && O ? "display" : v;
59
+ return /* @__PURE__ */ m(a, {
60
+ label: C(o.display?.name ?? o.name),
61
+ mode: A,
62
+ span: c.has(o.type),
63
+ nested: s.has(o.type),
64
+ children: k ? /* @__PURE__ */ m(n, {
65
+ tier: E.classification,
66
+ tierDef: r(S, x, t),
67
+ requiredPermission: E?.required_permission,
68
+ variant: A === "edit" ? "input" : "value"
68
69
  }) : e({
69
- field: l,
70
+ field: u,
70
71
  fieldName: t,
71
- value: g,
72
- mode: k,
73
- onChange: k === "edit" ? w : void 0,
74
- refs: y,
75
- t: S
72
+ value: _,
73
+ mode: A,
74
+ onChange: A === "edit" ? T : void 0,
75
+ refs: b,
76
+ t: C
76
77
  })
77
78
  });
78
79
  }
79
- export { g as PropertiesBlock };
80
+ export { _ as PropertiesBlock };
@@ -0,0 +1,35 @@
1
+ import { createContext as e, useContext as t } from "react";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ var r = {
4
+ fontSize: 12,
5
+ fontWeight: 500,
6
+ color: "var(--text-3)",
7
+ overflowWrap: "break-word"
8
+ }, i = 2, a = 10, o = 6, s = e({
9
+ columns: 2,
10
+ stackPairs: !1
11
+ });
12
+ function c() {
13
+ return t(s);
14
+ }
15
+ var l = e(0);
16
+ function u() {
17
+ return 150 - Math.min(t(l), o) * 12;
18
+ }
19
+ function d({ children: e }) {
20
+ let r = t(l);
21
+ return /* @__PURE__ */ n("div", {
22
+ style: r < o ? {
23
+ borderLeftWidth: i,
24
+ borderLeftStyle: "solid",
25
+ borderLeftColor: "var(--border)",
26
+ paddingLeft: a,
27
+ minWidth: 0
28
+ } : { minWidth: 0 },
29
+ children: /* @__PURE__ */ n(l.Provider, {
30
+ value: r + 1,
31
+ children: e
32
+ })
33
+ });
34
+ }
35
+ export { r as LABEL_TEXT_STYLE, s as LabelLayoutContext, d as NestedBlock, c as useLabelLayout, u as useNestedLabelWidth };