@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,15 +1,16 @@
1
1
  import { Check as e } from "../../primitives/Check.js";
2
- import { Pill as t, pillColor as n } from "../../primitives/Pill.js";
3
- import { getSchemaFieldValue as r, renderSchemaField as i, resolveSchemaFieldLabel as a } from "../../file-widgets/host.js";
4
- import { coerceDisplayString as o } from "../../../lib/display-value.js";
5
- import { effectiveScreenForRecord as s } from "../../../lib/variants.js";
6
- import { getDisplayValue as c } from "../../../types/schema.js";
7
- import { RowActionsCell as l } from "./RowActionsCell.js";
8
- import { resolveCard as u } from "./cardProjection.js";
9
- import { useText as d } from "../../../hooks/useText.js";
10
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
2
+ import { IdBadge as t } from "../../primitives/IdBadge.js";
3
+ import { Pill as n, pillColor as r } from "../../primitives/Pill.js";
4
+ import { getSchemaFieldValue as i, renderSchemaField as a, resolveSchemaFieldLabel as o } from "../../file-widgets/host.js";
5
+ import { coerceDisplayString as s } from "../../../lib/display-value.js";
6
+ import { effectiveScreenForRecord as c } from "../../../lib/variants.js";
7
+ import { getDisplayValue as l } from "../../../types/schema.js";
8
+ import { RowActionsCell as u } from "./RowActionsCell.js";
9
+ import { resolveCard as d } from "./cardProjection.js";
10
+ import { useText as f } from "../../../hooks/useText.js";
11
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
11
12
  // src/components/pages/list/ListCardRow.tsx
12
- function m(e, t, n, r) {
13
+ function h(e, t, n, r) {
13
14
  if (t.startsWith("$status.")) {
14
15
  let r = t.slice(8), i = n.status_groups?.[r];
15
16
  return i ? e(i.name) || r : t;
@@ -18,140 +19,140 @@ function m(e, t, n, r) {
18
19
  let r = t.slice(10), i = n.properties?.[r];
19
20
  return i ? e(i.name) || r : t;
20
21
  }
21
- return a(e, n, t, r);
22
+ return o(e, n, t, r);
22
23
  }
23
- function h(e, t, n) {
24
+ function g(e, t, n) {
24
25
  if (e.startsWith("$status.")) {
25
26
  let n = e.slice(8), r = t.$statuses;
26
27
  return Array.isArray(r) && r.some((e) => e.group_code === n);
27
28
  }
28
29
  if (e.startsWith("$property.")) {
29
30
  let n = e.slice(10), r = t.$properties, i = Array.isArray(r) ? r.find((e) => e.property_code === n) : void 0;
30
- return i?.value != null && o(i.value) !== "";
31
+ return i?.value != null && s(i.value) !== "";
31
32
  }
32
- let i = r(n, t, e);
33
- return i != null && o(i) !== "";
33
+ let r = i(n, t, e);
34
+ return r != null && s(r) !== "";
34
35
  }
35
- function g(e, r, a) {
36
- let { entity: s, entityCode: c, refs: l, t: u, renderers: d } = a;
36
+ function _(e, t, i) {
37
+ let { entity: o, entityCode: c, refs: l, t: u, renderers: d } = i;
37
38
  if (e.startsWith("$status.")) {
38
- let i = e.slice(8), a = s.status_groups?.[i], o = r.$statuses, c = Array.isArray(o) ? o.find((e) => e.group_code === i) : void 0;
39
- if (!a || !c) return /* @__PURE__ */ f("span", {
39
+ let i = e.slice(8), a = o.status_groups?.[i], s = t.$statuses, c = Array.isArray(s) ? s.find((e) => e.group_code === i) : void 0;
40
+ if (!a || !c) return /* @__PURE__ */ p("span", {
40
41
  style: { color: "var(--text-3)" },
41
42
  children: "-"
42
43
  });
43
44
  let l = a.statuses.find((e) => e.code === c.status_code);
44
- return /* @__PURE__ */ f(t, {
45
- tone: n(l?.color),
45
+ return /* @__PURE__ */ p(n, {
46
+ tone: r(l?.color),
46
47
  size: "xs",
47
48
  children: u(l?.name) || c.status_code
48
49
  });
49
50
  }
50
51
  if (e.startsWith("$property.")) {
51
- let t = e.slice(10), n = r.$properties, i = Array.isArray(n) ? n.find((e) => e.property_code === t) : void 0;
52
- return !i || i.value == null ? /* @__PURE__ */ f("span", {
52
+ let n = e.slice(10), r = t.$properties, i = Array.isArray(r) ? r.find((e) => e.property_code === n) : void 0;
53
+ return !i || i.value == null ? /* @__PURE__ */ p("span", {
53
54
  style: { color: "var(--text-3)" },
54
55
  children: "-"
55
- }) : /* @__PURE__ */ f("span", { children: o(i.value) });
56
+ }) : /* @__PURE__ */ p("span", { children: s(i.value) });
56
57
  }
57
- if (s.files?.get(e)) return i({
58
- entity: s,
58
+ if (o.files?.get(e)) return a({
59
+ entity: o,
59
60
  entityCode: c,
60
61
  fieldName: e,
61
- record: r,
62
+ record: t,
62
63
  mode: "display",
63
64
  surface: "list",
64
65
  refs: l,
65
66
  t: u
66
67
  });
67
- let p = d.get(e);
68
- if (!p) {
69
- let t = r[e];
70
- return o(t) || /* @__PURE__ */ f("span", {
68
+ let f = d.get(e);
69
+ if (!f) {
70
+ let n = t[e];
71
+ return s(n) || /* @__PURE__ */ p("span", {
71
72
  style: { color: "var(--text-3)" },
72
73
  children: "-"
73
74
  });
74
75
  }
75
- return p(r[e], r);
76
+ return f(t[e], t);
76
77
  }
77
- function _({ row: t, rowIndex: n, entity: r, screen: i, entityCode: a, entities: o, savedViewColumns: _, refs: v, renderers: y, rowActions: b, tabNavigate: x, interaction: S, hasSoftDelete: C, zebra: w, hasBatchActions: T, hasDetailTarget: E, rowKey: D, measureElement: O }) {
78
- let k = d(), A = {
79
- entity: r,
80
- entityCode: a,
81
- refs: v,
82
- t: k,
83
- renderers: y
84
- }, j = t.original, M = s(r, i, j), N = u({
85
- entity: r,
86
- screen: M,
87
- savedViewColumns: _
88
- }), P = C && j[r.soft_delete] != null, F = t.getIsSelected(), I = w && n % 2 == 1, L = E || S.peekAllowed, R = (N.titleUsesDisplay ? c(k, j, r) ?? (N.titleField ? null : D(j)) : null) || (N.titleField ? g(N.titleField, j, A) : D(j)), z = N.subtitleField && (N.explicit || h(N.subtitleField, j, r)) ? N.subtitleField : void 0, B = N.badgeFields.filter((e) => !N.hideEmptyFields || h(e, j, r)), V = N.bodyFields.filter((e) => !N.hideEmptyFields || h(e, j, r)), H = N.metaFields.filter((e) => !N.hideEmptyFields || h(e, j, r));
89
- return /* @__PURE__ */ f("div", {
90
- "data-index": n,
78
+ function v({ row: n, rowIndex: r, entity: i, screen: a, entityCode: o, entities: s, savedViewColumns: v, refs: y, renderers: b, rowActions: x, tabNavigate: S, interaction: C, hasSoftDelete: w, zebra: T, hasBatchActions: E, hasDetailTarget: D, rowKey: O, measureElement: k }) {
79
+ let A = f(), j = {
80
+ entity: i,
81
+ entityCode: o,
82
+ refs: y,
83
+ t: A,
84
+ renderers: b
85
+ }, M = n.original, N = c(i, a, M), P = d({
86
+ entity: i,
87
+ screen: N,
88
+ savedViewColumns: v
89
+ }), F = w && M[i.soft_delete] != null, I = n.getIsSelected(), L = T && r % 2 == 1, R = D || C.peekAllowed, z = (P.titleUsesDisplay ? l(A, M, i) : null) || (P.titleField ? _(P.titleField, M, j) : /* @__PURE__ */ p(t, { value: O(M) })), B = P.subtitleField && (P.explicit || g(P.subtitleField, M, i)) ? P.subtitleField : void 0, V = P.badgeFields.filter((e) => !P.hideEmptyFields || g(e, M, i)), H = P.bodyFields.filter((e) => !P.hideEmptyFields || g(e, M, i)), U = P.metaFields.filter((e) => !P.hideEmptyFields || g(e, M, i));
90
+ return /* @__PURE__ */ p("div", {
91
+ "data-index": r,
91
92
  "data-testid": "list-card",
92
- ref: (e) => O(e),
93
+ ref: (e) => k(e),
93
94
  style: {
94
95
  padding: "6px 10px",
95
96
  boxSizing: "border-box"
96
97
  },
97
- children: /* @__PURE__ */ p("div", {
98
+ children: /* @__PURE__ */ m("div", {
98
99
  className: "sl-list-card-surface",
99
- "data-row-stripe": I ? "" : void 0,
100
- "aria-selected": F,
100
+ "data-row-stripe": L ? "" : void 0,
101
+ "aria-selected": I,
101
102
  style: {
102
103
  display: "grid",
103
- gridTemplateColumns: T ? "28px minmax(0, 1fr) auto" : "minmax(0, 1fr) auto",
104
+ gridTemplateColumns: E ? "28px minmax(0, 1fr) auto" : "minmax(0, 1fr) auto",
104
105
  gap: 8,
105
106
  alignItems: "start",
106
107
  width: "100%",
107
108
  boxSizing: "border-box",
108
109
  borderRadius: "var(--radius-md)",
109
- opacity: P ? .56 : 1,
110
- fontStyle: P ? "italic" : "normal",
110
+ opacity: F ? .56 : 1,
111
+ fontStyle: F ? "italic" : "normal",
111
112
  padding: "12px",
112
- cursor: L ? "pointer" : "default"
113
+ cursor: R ? "pointer" : "default"
113
114
  },
114
- tabIndex: L ? 0 : void 0,
115
- onClick: L ? (e) => S.onRowClick(e, j) : void 0,
116
- onKeyDown: L ? (e) => {
117
- e.key === "Enter" && (e.preventDefault(), S.peekAllowed ? S.setPeekRow(j) : S.navigateToDetail(j));
115
+ tabIndex: R ? 0 : void 0,
116
+ onClick: R ? (e) => C.onRowClick(e, M) : void 0,
117
+ onKeyDown: R ? (e) => {
118
+ e.key === "Enter" && (e.preventDefault(), C.peekAllowed ? C.setPeekRow(M) : C.navigateToDetail(M));
118
119
  } : void 0,
119
120
  onContextMenu: (e) => {
120
- e.preventDefault(), S.setContextMenu({
121
+ e.preventDefault(), C.setContextMenu({
121
122
  x: e.clientX,
122
123
  y: e.clientY,
123
- row: j
124
+ row: M
124
125
  });
125
126
  },
126
- ...S.longPress.handlers,
127
+ ...C.longPress.handlers,
127
128
  onPointerDown: (e) => {
128
- S.pressedRow.current = j, S.longPress.handlers.onPointerDown(e);
129
+ C.pressedRow.current = M, C.longPress.handlers.onPointerDown(e);
129
130
  },
130
131
  children: [
131
- T && /* @__PURE__ */ f("span", {
132
+ E && /* @__PURE__ */ p("span", {
132
133
  "data-testid": "row-select-checkbox",
133
134
  style: { paddingTop: 2 },
134
- children: /* @__PURE__ */ f(e, {
135
- checked: F,
136
- onChange: () => t.toggleSelected()
135
+ children: /* @__PURE__ */ p(e, {
136
+ checked: I,
137
+ onChange: () => n.toggleSelected()
137
138
  })
138
139
  }),
139
- /* @__PURE__ */ p("div", {
140
+ /* @__PURE__ */ m("div", {
140
141
  style: { minWidth: 0 },
141
142
  children: [
142
- /* @__PURE__ */ f("div", {
143
+ /* @__PURE__ */ p("div", {
143
144
  style: {
144
145
  display: "flex",
145
146
  alignItems: "flex-start",
146
147
  gap: 8,
147
148
  minWidth: 0
148
149
  },
149
- children: /* @__PURE__ */ p("div", {
150
+ children: /* @__PURE__ */ m("div", {
150
151
  style: {
151
152
  minWidth: 0,
152
153
  flex: 1
153
154
  },
154
- children: [/* @__PURE__ */ f("div", {
155
+ children: [/* @__PURE__ */ p("div", {
155
156
  style: {
156
157
  fontSize: 14,
157
158
  lineHeight: 1.25,
@@ -159,8 +160,8 @@ function _({ row: t, rowIndex: n, entity: r, screen: i, entityCode: a, entities:
159
160
  color: "var(--text)",
160
161
  overflowWrap: "anywhere"
161
162
  },
162
- children: R
163
- }), z && /* @__PURE__ */ f("div", {
163
+ children: z
164
+ }), B && /* @__PURE__ */ p("div", {
164
165
  style: {
165
166
  marginTop: 3,
166
167
  fontSize: 12.5,
@@ -168,26 +169,26 @@ function _({ row: t, rowIndex: n, entity: r, screen: i, entityCode: a, entities:
168
169
  color: "var(--text-3)",
169
170
  overflowWrap: "anywhere"
170
171
  },
171
- children: g(z, j, A)
172
+ children: _(B, M, j)
172
173
  })]
173
174
  })
174
175
  }),
175
- B.length > 0 && /* @__PURE__ */ f("div", {
176
+ V.length > 0 && /* @__PURE__ */ p("div", {
176
177
  style: {
177
178
  display: "flex",
178
179
  flexWrap: "wrap",
179
180
  gap: 6,
180
181
  marginTop: 10
181
182
  },
182
- children: B.map((e) => /* @__PURE__ */ f("span", {
183
+ children: V.map((e) => /* @__PURE__ */ p("span", {
183
184
  style: {
184
185
  display: "inline-flex",
185
186
  minWidth: 0
186
187
  },
187
- children: g(e, j, A)
188
+ children: _(e, M, j)
188
189
  }, e))
189
190
  }),
190
- V.length > 0 && /* @__PURE__ */ f("dl", {
191
+ H.length > 0 && /* @__PURE__ */ p("dl", {
191
192
  style: {
192
193
  display: "grid",
193
194
  gridTemplateColumns: "minmax(84px, max-content) minmax(0, 1fr)",
@@ -196,23 +197,23 @@ function _({ row: t, rowIndex: n, entity: r, screen: i, entityCode: a, entities:
196
197
  fontSize: 12.5,
197
198
  lineHeight: 1.35
198
199
  },
199
- children: V.map((e) => /* @__PURE__ */ p("div", {
200
+ children: H.map((e) => /* @__PURE__ */ m("div", {
200
201
  style: { display: "contents" },
201
- children: [/* @__PURE__ */ f("dt", {
202
+ children: [/* @__PURE__ */ p("dt", {
202
203
  style: { color: "var(--text-3)" },
203
- children: m(k, e, r, o)
204
- }), /* @__PURE__ */ f("dd", {
204
+ children: h(A, e, i, s)
205
+ }), /* @__PURE__ */ p("dd", {
205
206
  style: {
206
207
  margin: 0,
207
208
  color: "var(--text-2)",
208
209
  minWidth: 0,
209
210
  overflowWrap: "anywhere"
210
211
  },
211
- children: g(e, j, A)
212
+ children: _(e, M, j)
212
213
  })]
213
214
  }, e))
214
215
  }),
215
- H.length > 0 && /* @__PURE__ */ f("div", {
216
+ U.length > 0 && /* @__PURE__ */ p("div", {
216
217
  style: {
217
218
  display: "flex",
218
219
  flexWrap: "wrap",
@@ -221,35 +222,35 @@ function _({ row: t, rowIndex: n, entity: r, screen: i, entityCode: a, entities:
221
222
  color: "var(--text-3)",
222
223
  fontSize: 11.5
223
224
  },
224
- children: H.map((e) => /* @__PURE__ */ p("span", {
225
+ children: U.map((e) => /* @__PURE__ */ m("span", {
225
226
  style: {
226
227
  minWidth: 0,
227
228
  overflowWrap: "anywhere"
228
229
  },
229
230
  children: [
230
- m(k, e, r, o),
231
+ h(A, e, i, s),
231
232
  ": ",
232
- g(e, j, A)
233
+ _(e, M, j)
233
234
  ]
234
235
  }, e))
235
236
  })
236
237
  ]
237
238
  }),
238
- /* @__PURE__ */ f(l, {
239
- row: j,
240
- rowId: D(j),
241
- screen: i,
242
- fullScreen: i,
243
- entity: r,
244
- entityCode: a,
245
- rowActions: b,
246
- tabNavigate: x,
247
- peekAllowed: S.peekAllowed,
248
- hasDetailTarget: E,
249
- onPeek: S.setPeekRow
239
+ /* @__PURE__ */ p(u, {
240
+ row: M,
241
+ rowId: O(M),
242
+ screen: a,
243
+ fullScreen: a,
244
+ entity: i,
245
+ entityCode: o,
246
+ rowActions: x,
247
+ tabNavigate: S,
248
+ peekAllowed: C.peekAllowed,
249
+ hasDetailTarget: D,
250
+ onPeek: C.setPeekRow
250
251
  })
251
252
  ]
252
253
  })
253
- }, t.id);
254
+ }, n.id);
254
255
  }
255
- export { _ as ListCardRow };
256
+ export { v as ListCardRow };