@declarion/react 0.446.0 → 0.516.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 +1 -1
  43. package/dist-lib/components/primitives/RecordIdBadge.js +0 -25
@@ -4,232 +4,190 @@ import { Icon as n } from "../primitives/Icons.js";
4
4
  import { IconBtn as r } from "../primitives/IconBtn.js";
5
5
  import { useSchema as i } from "../../hooks/useSchema.js";
6
6
  import { renderField as a } from "./index.js";
7
- import { JsonField as o } from "./JsonField.js";
8
- import { useText as s } from "../../hooks/useText.js";
9
- import { useId as c } from "react";
10
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
+ import { JsonField as o, isNestable as s, jsonRows as c, parseJsonText as l } from "./JsonField.js";
8
+ import { ValueRows as u, flattenRows as d, keySegment as f } from "./ValueRows.js";
9
+ import { EMPTY_CELL as p } from "./cells/factories/emptyCell.js";
10
+ import { useText as m } from "../../hooks/useText.js";
11
+ import { useId as h, useRef as g } from "react";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
11
13
  // src/components/fields/StructureField.tsx
12
- function d(e) {
13
- let { field: t, value: n, mode: r, onChange: a, fieldId: s, labelId: c, nested: u, refs: d, entities: m } = e, { data: h } = i(), g = t.structure ? h?.structures?.[t.structure] : void 0;
14
- return g ? t.array ? /* @__PURE__ */ l(p, {
15
- structDef: g,
14
+ function y(e) {
15
+ let { field: t, value: n, mode: r, onChange: a, fieldId: s, labelId: c, refs: l, entities: d } = e, f = m(), { data: h } = i(), g = h?.structures, v = t.structure ? g?.[t.structure] : void 0;
16
+ if (!v) return /* @__PURE__ */ _(o, { ...e });
17
+ if (r === "display") {
18
+ let e = b(v, n, !!t.array, {
19
+ t: f,
20
+ refs: l,
21
+ entities: d,
22
+ structures: g
23
+ });
24
+ return e.length === 0 ? p : /* @__PURE__ */ _(u, {
25
+ rows: e,
26
+ flat: t.display?.flatten === !0
27
+ });
28
+ }
29
+ return t.array ? /* @__PURE__ */ _(S, {
30
+ structDef: v,
16
31
  value: n,
17
- mode: r,
18
32
  onChange: a,
19
33
  fieldId: s,
20
- labelId: c,
21
- nested: u,
22
- refs: d,
23
- entities: m
24
- }) : /* @__PURE__ */ l(f, {
25
- structDef: g,
34
+ labelId: c
35
+ }) : /* @__PURE__ */ _(x, {
36
+ structDef: v,
26
37
  value: n,
27
- mode: r,
28
38
  onChange: a,
29
39
  fieldId: s,
30
- labelId: c,
31
- nested: u,
32
- refs: d,
33
- entities: m
34
- }) : /* @__PURE__ */ l(o, { ...e });
40
+ labelId: c
41
+ });
42
+ }
43
+ function b(e, t, n, r) {
44
+ if (n) {
45
+ let n = Array.isArray(t) ? t : [];
46
+ return n.length === 1 ? b(e, n[0], !1, r) : n.map((t, n) => {
47
+ let i = b(e, t, !1, r), a = String(n + 1);
48
+ return i.length > 0 ? {
49
+ key: a,
50
+ label: a,
51
+ rows: i
52
+ } : {
53
+ key: a,
54
+ label: a,
55
+ value: p
56
+ };
57
+ });
58
+ }
59
+ let i = typeof t == "object" && t && !Array.isArray(t) ? t : {};
60
+ return e.fields.names().flatMap((t) => {
61
+ let n = e.fields.get(t), o = i[t];
62
+ if (!n || o == null || o === "") return [];
63
+ let u = {
64
+ key: f(t),
65
+ label: n.display ? r.t(n.display.name) : t,
66
+ title: r.t(n.display?.description) || void 0
67
+ }, p = n.type === "structure" && n.structure ? r.structures?.[n.structure] : void 0, m = n.type === "json" ? l(o) ?? o : void 0, h = p ? b(p, o, !!n.array, r) : s(m) ? c(m) : void 0;
68
+ return h ? h.length === 0 ? [] : [{
69
+ ...u,
70
+ rows: n.display?.flatten ? d(h) : h
71
+ }] : [{
72
+ ...u,
73
+ value: a({
74
+ field: n,
75
+ fieldName: t,
76
+ value: o,
77
+ mode: "display",
78
+ t: r.t,
79
+ refs: r.refs,
80
+ entities: r.entities
81
+ })
82
+ }];
83
+ });
35
84
  }
36
- function f({ structDef: e, value: n, mode: r, onChange: i, fieldId: o, labelId: f, nested: p = !1, refs: h, entities: g }) {
37
- let _ = s(), v = c(), y = o ?? v, b = typeof n == "object" && n && !Array.isArray(n) ? n : {}, x = e.fields.names(), S = {
85
+ function x({ structDef: e, value: n, onChange: r, fieldId: i, labelId: o }) {
86
+ let s = m(), c = h(), l = i ?? c, u = typeof n == "object" && n && !Array.isArray(n) ? n : {}, d = e.fields.names(), f = {
38
87
  display: "flex",
39
88
  flexDirection: "column",
40
- gap: r === "display" ? 8 : 12,
89
+ gap: 12,
41
90
  border: "1px solid var(--border)",
42
91
  borderRadius: "var(--radius-md)",
43
92
  padding: 12,
44
93
  background: "var(--surface-2)"
45
- };
46
- if (r === "display") return x.some((e) => b[e] != null && b[e] !== "") ? /* @__PURE__ */ l("div", {
47
- style: p ? m : S,
48
- children: x.map((t) => {
49
- let n = e.fields.get(t);
50
- if (!n) return null;
51
- let r = b[t];
52
- return r == null ? null : /* @__PURE__ */ u("div", {
53
- style: {
54
- display: "flex",
55
- flexWrap: "wrap",
56
- alignItems: "baseline",
57
- gap: 8
58
- },
59
- children: [/* @__PURE__ */ l("span", {
60
- style: {
61
- fontSize: 11.5,
62
- fontWeight: 500,
63
- color: "var(--text-3)",
64
- width: 120,
65
- flexShrink: 0,
66
- overflowWrap: "anywhere"
67
- },
68
- title: _(n.display?.description) || void 0,
69
- children: n.display ? _(n.display.name) : t
70
- }), /* @__PURE__ */ l("div", {
71
- style: {
72
- minWidth: 0,
73
- flex: "1 1 14rem",
74
- overflowWrap: "anywhere"
75
- },
76
- children: n.type === "structure" && n.structure ? /* @__PURE__ */ l(d, {
77
- field: n,
78
- fieldName: t,
79
- value: r,
80
- mode: "display",
81
- t: _,
82
- nested: !0,
83
- refs: h,
84
- entities: g
85
- }) : a({
86
- field: n,
87
- fieldName: t,
88
- value: r,
89
- mode: "display",
90
- t: _,
91
- refs: h,
92
- entities: g
93
- })
94
- })]
95
- }, t);
96
- })
97
- }) : /* @__PURE__ */ l("span", {
98
- style: {
99
- fontSize: 12.5,
100
- color: "var(--text-4)"
101
- },
102
- children: "—"
103
- });
104
- let C = (e) => (t) => {
105
- i?.({
106
- ...b,
94
+ }, p = (e) => (t) => {
95
+ r?.({
96
+ ...u,
107
97
  [e]: t
108
98
  });
109
99
  };
110
- return /* @__PURE__ */ l("div", {
111
- style: S,
112
- id: o,
100
+ return /* @__PURE__ */ _("div", {
101
+ style: f,
102
+ id: i,
113
103
  role: "group",
114
- "aria-labelledby": f,
115
- children: x.map((n) => {
104
+ "aria-labelledby": o,
105
+ children: d.map((n) => {
116
106
  let r = e.fields.get(n);
117
107
  if (!r) return null;
118
- let i = r.type === "structure" && !!r.structure, o = `${y}-${n}`, s = `${o}-label`;
119
- return /* @__PURE__ */ u("div", {
108
+ let i = r.type === "structure" && !!r.structure, o = `${l}-${n}`, c = `${o}-label`;
109
+ return /* @__PURE__ */ v("div", {
120
110
  style: {
121
111
  display: "flex",
122
112
  flexDirection: "column",
123
113
  gap: 2
124
114
  },
125
- children: [/* @__PURE__ */ l(t, {
115
+ children: [/* @__PURE__ */ _(t, {
126
116
  required: r.required,
127
- id: s,
117
+ id: c,
128
118
  htmlFor: i ? void 0 : o,
129
- children: r.display ? _(r.display.name) : n
130
- }), i ? /* @__PURE__ */ l(d, {
119
+ children: r.display ? s(r.display.name) : n
120
+ }), i ? /* @__PURE__ */ _(y, {
131
121
  field: r,
132
- t: _,
122
+ t: s,
133
123
  fieldName: n,
134
- value: b[n],
124
+ value: u[n],
135
125
  mode: "edit",
136
- onChange: C(n),
126
+ onChange: p(n),
137
127
  fieldId: o,
138
- labelId: s
128
+ labelId: c
139
129
  }) : a({
140
130
  field: r,
141
131
  fieldName: n,
142
- value: b[n],
132
+ value: u[n],
143
133
  mode: "edit",
144
- onChange: C(n),
134
+ onChange: p(n),
145
135
  fieldId: o,
146
- labelId: s,
147
- t: _
136
+ labelId: c,
137
+ t: s
148
138
  })]
149
139
  }, n);
150
140
  })
151
141
  });
152
142
  }
153
- function p({ structDef: t, value: i, mode: a, onChange: o, fieldId: d, labelId: p, nested: m = !1, refs: h, entities: g }) {
154
- let _ = s(), v = c(), y = d ?? v, b = Array.isArray(i) ? i : [];
155
- if (a === "display") return b.length === 0 ? /* @__PURE__ */ l("span", {
156
- style: {
157
- fontSize: 12.5,
158
- color: "var(--text-4)"
159
- },
160
- children: "—"
161
- }) : /* @__PURE__ */ l("div", {
162
- style: {
163
- display: "flex",
164
- flexDirection: "column",
165
- gap: 8
166
- },
167
- children: b.map((e, n) => /* @__PURE__ */ l("div", {
168
- style: m && n > 0 ? {
169
- borderTop: "1px solid var(--border)",
170
- paddingTop: 8
171
- } : void 0,
172
- children: /* @__PURE__ */ l(f, {
173
- structDef: t,
174
- value: e,
175
- mode: "display",
176
- nested: m,
177
- refs: h,
178
- entities: g
179
- })
180
- }, n))
181
- });
182
- let x = (e) => (t) => {
183
- let n = [...b];
184
- n[e] = t, o?.(n);
185
- }, S = () => {
186
- o?.([...b, {}]);
187
- }, C = (e) => () => {
188
- let t = b.filter((t, n) => n !== e);
189
- o?.(t);
143
+ function S({ structDef: t, value: i, onChange: a, fieldId: o, labelId: s }) {
144
+ let c = m(), l = h(), u = o ?? l, d = Array.isArray(i) ? i : [], f = g(0), p = g([]);
145
+ for (; p.current.length < d.length;) p.current.push(f.current++);
146
+ p.current.length = d.length;
147
+ let y = (e) => (t) => {
148
+ let n = [...d];
149
+ n[e] = t, a?.(n);
150
+ }, b = () => {
151
+ a?.([...d, {}]);
152
+ }, S = (e) => () => {
153
+ p.current.splice(e, 1);
154
+ let t = d.filter((t, n) => n !== e);
155
+ a?.(t);
190
156
  };
191
- return /* @__PURE__ */ u("div", {
157
+ return /* @__PURE__ */ v("div", {
192
158
  style: {
193
159
  display: "flex",
194
160
  flexDirection: "column",
195
161
  gap: 8
196
162
  },
197
- id: d,
163
+ id: o,
198
164
  role: "group",
199
- "aria-labelledby": p,
200
- children: [b.map((e, i) => /* @__PURE__ */ u("div", {
165
+ "aria-labelledby": s,
166
+ children: [d.map((e, i) => /* @__PURE__ */ v("div", {
201
167
  style: { position: "relative" },
202
- children: [/* @__PURE__ */ l(f, {
168
+ children: [/* @__PURE__ */ _(x, {
203
169
  structDef: t,
204
170
  value: e,
205
- mode: "edit",
206
- onChange: x(i),
207
- fieldId: `${y}-${i}`
208
- }), /* @__PURE__ */ l("div", {
171
+ onChange: y(i),
172
+ fieldId: `${u}-${i}`
173
+ }), /* @__PURE__ */ _("div", {
209
174
  style: {
210
175
  position: "absolute",
211
176
  top: 6,
212
177
  right: 6
213
178
  },
214
- children: /* @__PURE__ */ l(r, {
179
+ children: /* @__PURE__ */ _(r, {
215
180
  size: 24,
216
- icon: /* @__PURE__ */ l(n.trash, { size: 12 }),
217
- onClick: C(i),
218
- title: _("field.structure.remove", "Remove")
181
+ icon: /* @__PURE__ */ _(n.trash, { size: 12 }),
182
+ onClick: S(i),
183
+ title: c("field.structure.remove", "Remove")
219
184
  })
220
185
  })]
221
- }, i)), /* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(e, {
222
- icon: /* @__PURE__ */ l(n.plus, { size: 13 }),
223
- onClick: S,
224
- children: _("field.array.add", "Add")
186
+ }, p.current[i])), /* @__PURE__ */ _("div", { children: /* @__PURE__ */ _(e, {
187
+ icon: /* @__PURE__ */ _(n.plus, { size: 13 }),
188
+ onClick: b,
189
+ children: c("field.array.add", "Add")
225
190
  }) })]
226
191
  });
227
192
  }
228
- var m = {
229
- display: "flex",
230
- flexDirection: "column",
231
- gap: 8,
232
- paddingLeft: 10,
233
- borderLeft: "2px solid var(--border)"
234
- };
235
- export { d as StructureField };
193
+ export { y as StructureField };
@@ -0,0 +1,114 @@
1
+ import { Icon as e } from "../primitives/Icons.js";
2
+ import { LABEL_TEXT_STYLE as t, NestedBlock as n, useLabelLayout as r, useNestedLabelWidth as i } from "../detail-layout/labelLayout.js";
3
+ import { useText as a } from "../../hooks/useText.js";
4
+ import { Fragment as o, useState as s } from "react";
5
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ // src/components/fields/ValueRows.tsx
7
+ function d({ rows: e, flat: n = !1 }) {
8
+ let { stackPairs: a } = r(), o = n ? m(e) : e, s = i();
9
+ return /* @__PURE__ */ l("div", {
10
+ style: {
11
+ display: "flex",
12
+ flexDirection: "column",
13
+ gap: 6,
14
+ minWidth: 0
15
+ },
16
+ children: o.map((e) => e.rows ? /* @__PURE__ */ l(f, {
17
+ row: e,
18
+ rows: e.rows
19
+ }, e.key) : a ? /* @__PURE__ */ u("div", {
20
+ style: {
21
+ display: "flex",
22
+ flexDirection: "column",
23
+ gap: 2
24
+ },
25
+ children: [/* @__PURE__ */ l("span", {
26
+ style: t,
27
+ title: e.title,
28
+ children: /* @__PURE__ */ l(p, { text: e.label })
29
+ }), /* @__PURE__ */ l("div", {
30
+ style: {
31
+ minWidth: 0,
32
+ fontSize: 13,
33
+ overflowWrap: "anywhere"
34
+ },
35
+ children: e.value
36
+ })]
37
+ }, e.key) : /* @__PURE__ */ u("div", {
38
+ style: {
39
+ display: "flex",
40
+ alignItems: "baseline",
41
+ columnGap: 16
42
+ },
43
+ children: [/* @__PURE__ */ l("span", {
44
+ style: {
45
+ ...t,
46
+ width: s,
47
+ flexShrink: 0
48
+ },
49
+ title: e.title,
50
+ children: /* @__PURE__ */ l(p, { text: e.label })
51
+ }), /* @__PURE__ */ l("div", {
52
+ style: {
53
+ minWidth: 0,
54
+ flex: 1,
55
+ fontSize: 13,
56
+ overflowWrap: "anywhere"
57
+ },
58
+ children: e.value
59
+ })]
60
+ }, e.key))
61
+ });
62
+ }
63
+ function f({ row: r, rows: i }) {
64
+ let o = a(), [c, f] = s(!0);
65
+ return /* @__PURE__ */ u("div", {
66
+ style: {
67
+ display: "flex",
68
+ flexDirection: "column",
69
+ gap: 6
70
+ },
71
+ children: [/* @__PURE__ */ u("button", {
72
+ type: "button",
73
+ "aria-expanded": c,
74
+ onClick: (e) => {
75
+ e.stopPropagation(), f((e) => !e);
76
+ },
77
+ title: c ? o("control.collapse", "Collapse") : o("control.expand", "Expand"),
78
+ style: {
79
+ ...t,
80
+ display: "inline-flex",
81
+ alignItems: "center",
82
+ gap: 4,
83
+ alignSelf: "flex-start",
84
+ padding: 0,
85
+ border: 0,
86
+ background: "none",
87
+ cursor: "pointer",
88
+ textAlign: "left"
89
+ },
90
+ children: [/* @__PURE__ */ l("span", {
91
+ title: r.title,
92
+ children: /* @__PURE__ */ l(p, { text: r.label })
93
+ }), l(c ? e.down : e.right, { size: 11 })]
94
+ }), c ? /* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(d, { rows: i }) }) : null]
95
+ });
96
+ }
97
+ function p({ text: e }) {
98
+ let t = e.split(/(?<=[_./:-])/);
99
+ return /* @__PURE__ */ l(c, { children: t.map((e, t) => /* @__PURE__ */ u(o, { children: [t > 0 ? /* @__PURE__ */ l("wbr", {}) : null, e] }, t)) });
100
+ }
101
+ function m(e, t) {
102
+ return e.flatMap((e) => {
103
+ let n = t ? {
104
+ ...e,
105
+ key: `${t.key}/${e.key}`,
106
+ label: `${t.label} · ${e.label}`
107
+ } : e;
108
+ return e.rows ? m(e.rows, n) : [n];
109
+ });
110
+ }
111
+ function h(e) {
112
+ return encodeURIComponent(e);
113
+ }
114
+ export { d as ValueRows, m as flattenRows, h as keySegment };
@@ -0,0 +1,10 @@
1
+ import { IdBadge as e } from "../../../primitives/IdBadge.js";
2
+ import { coerceDisplayString as t } from "../../../../lib/display-value.js";
3
+ import { EMPTY_CELL as n } from "./emptyCell.js";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ // src/components/fields/cells/factories/id.tsx
6
+ var i = () => (i) => {
7
+ let a = t(i);
8
+ return a ? /* @__PURE__ */ r(e, { value: a }) : n;
9
+ };
10
+ export { i as idFactory };
@@ -3,43 +3,34 @@ import { coerceDisplayString as t } from "../../../../lib/display-value.js";
3
3
  import { formatOffsetTimestamp as n } from "../../../../lib/timestamp.js";
4
4
  import { jsx as r } from "react/jsx-runtime";
5
5
  // src/components/fields/cells/factories/nextRun.tsx
6
- var i = 6e4, a = 3e5, o = 1440, s = 43200, c = 525600;
7
- function l(e, t) {
8
- let n = Math.abs(e) / 6e4, r, i;
9
- return n < 1 ? [r, i] = ["second", Math.round(Math.abs(e) / 1e3)] : n < 60 ? [r, i] = ["minute", Math.round(n)] : n < o ? [r, i] = ["hour", Math.round(n / 60)] : n < s ? [r, i] = ["day", Math.round(n / o)] : n < c ? [r, i] = ["month", Math.round(n / s)] : [r, i] = ["year", Math.round(n / c)], r === "month" && i === 12 && ([r, i] = ["year", 1]), new Intl.NumberFormat(t, {
6
+ var i = 1440, a = 43200, o = 525600;
7
+ function s(e, t) {
8
+ let n = Math.abs(e) / 6e4, r, s;
9
+ return n < 1 ? [r, s] = ["second", Math.round(Math.abs(e) / 1e3)] : n < 60 ? [r, s] = ["minute", Math.round(n)] : n < i ? [r, s] = ["hour", Math.round(n / 60)] : n < a ? [r, s] = ["day", Math.round(n / i)] : n < o ? [r, s] = ["month", Math.round(n / a)] : [r, s] = ["year", Math.round(n / o)], r === "month" && s === 12 && ([r, s] = ["year", 1]), new Intl.NumberFormat(t, {
10
10
  style: "unit",
11
11
  unit: r,
12
12
  unitDisplay: "long"
13
- }).format(i);
13
+ }).format(s);
14
14
  }
15
- var u = ({ t: o }) => (s) => {
16
- if (s == null || s === "") return "—";
17
- let c = typeof s == "string" ? s : t(s), u = new Date(c);
18
- if (isNaN(u.getTime())) return c;
19
- let d = n(c, { zone: o.timeZone }), f = Date.now() - u.getTime();
20
- if (f <= 0) {
21
- let e = l(f, o.language);
15
+ var c = ({ t: i }) => (a) => {
16
+ if (a == null || a === "") return "—";
17
+ let o = typeof a == "string" ? a : t(a), c = new Date(o);
18
+ if (isNaN(c.getTime())) return o;
19
+ let l = n(o, { zone: i.timeZone }), u = Date.now() - c.getTime();
20
+ if (u <= 0) {
21
+ let e = s(u, i.language);
22
22
  return /* @__PURE__ */ r("span", {
23
- title: d,
24
- children: o("field.next_run.in", "in {distance}", { distance: e })
23
+ title: l,
24
+ children: i("field.next_run.in", "in {distance}", { distance: e })
25
25
  });
26
26
  }
27
- if (f <= i) return /* @__PURE__ */ r("span", {
28
- title: d,
29
- children: /* @__PURE__ */ r(e, {
30
- tone: "slate",
31
- size: "xs",
32
- children: o("field.next_run.due", "due")
33
- })
34
- });
35
- let p = l(f, o.language);
36
27
  return /* @__PURE__ */ r("span", {
37
- title: d,
28
+ title: l,
38
29
  children: /* @__PURE__ */ r(e, {
39
- tone: f <= a ? "amber" : "rose",
30
+ tone: "slate",
40
31
  size: "xs",
41
- children: o("field.next_run.overdue", "overdue {distance}", { distance: p })
32
+ children: i("field.next_run.waiting", "waiting for its check")
42
33
  })
43
34
  });
44
35
  };
45
- export { u as nextRunFactory };
36
+ export { c as nextRunFactory };
@@ -1,52 +1,26 @@
1
- import { DynamicIcon as e } from "../../../shared/DynamicIcon.js";
1
+ import { RefChip as e } from "../../../shared/RefChip.js";
2
2
  import { referenceResolver as t } from "../../../../lib/reference.js";
3
- import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
3
+ import { jsx as n } from "react/jsx-runtime";
4
4
  // src/components/fields/cells/factories/refLink.tsx
5
- var a = (a) => {
6
- let { field: o, refs: s, surface: c } = a, l = typeof s == "function" ? s : () => s, u = c === "detail", d = t(a);
7
- return (t, a) => {
5
+ var r = (r) => {
6
+ let { field: i, refs: a, surface: o } = r, s = typeof a == "function" ? a : () => a, c = o === "detail", l = t(r);
7
+ return (t, r) => {
8
8
  if (t == null || t === "") return "—";
9
- let { label: s, resolved: c, icon: f, href: p } = d(t, a, l());
10
- if (o.ref?.entity_field && !c) return s;
11
- if (u) {
12
- let t = /* @__PURE__ */ i(n, { children: [f && /* @__PURE__ */ r("span", {
13
- style: {
14
- color: "var(--text-3)",
15
- display: "flex",
16
- flexShrink: 0
17
- },
18
- children: /* @__PURE__ */ r(e, {
19
- name: f,
20
- size: 13
21
- })
22
- }), /* @__PURE__ */ r("span", {
23
- style: {
24
- overflow: "hidden",
25
- textOverflow: "ellipsis",
26
- whiteSpace: "nowrap"
27
- },
28
- children: s
29
- })] });
30
- return p ? /* @__PURE__ */ r("a", {
31
- href: p,
32
- rel: "noopener noreferrer",
33
- className: "detail-ref-chip",
34
- children: t
35
- }) : /* @__PURE__ */ r("span", {
36
- className: "detail-ref-chip",
37
- children: t
38
- });
39
- }
40
- return p ? /* @__PURE__ */ r("a", {
41
- href: p,
9
+ let { label: a, resolved: o, icon: u, href: d } = l(t, r, s());
10
+ return i.ref?.entity_field && !o ? a : c ? /* @__PURE__ */ n(e, {
11
+ label: a,
12
+ href: d,
13
+ icon: u
14
+ }) : d ? /* @__PURE__ */ n("a", {
15
+ href: d,
42
16
  rel: "noopener noreferrer",
43
17
  style: {
44
18
  color: "inherit",
45
19
  textDecoration: "underline",
46
20
  textUnderlineOffset: 2
47
21
  },
48
- children: s
49
- }) : s;
22
+ children: a
23
+ }) : a;
50
24
  };
51
25
  };
52
- export { a as refLinkFactory };
26
+ export { r as refLinkFactory };