@declarion/react 0.254.0 → 0.255.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.
@@ -1,5 +1,6 @@
1
1
  import { Pill as e } from "../primitives/Pill.js";
2
- import { verdictLabel as t, verdictTone as n } from "../../lib/evidence-verdict.js";
2
+ import { evidenceVerdictPill as t } from "../../lib/evidence-verdict.js";
3
+ import { useSchema as n } from "../../hooks/useSchema.js";
3
4
  import { useText as r } from "../../hooks/useText.js";
4
5
  import { formatOffsetTimestamp as i } from "../../lib/timestamp.js";
5
6
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
@@ -8,8 +9,8 @@ function s(e, t) {
8
9
  if (e && !Number.isNaN(new Date(e).getTime())) return i(e, { zone: t });
9
10
  }
10
11
  function c({ evidence: i }) {
11
- let c = r(), l = i?.verdict ?? "unverified", u = s(i?.verified_at, c.timeZone), d = [];
12
- return i?.seq && d.push(c("record.evidence.chain", "chain #{seq}", { seq: i.seq })), i?.generation && d.push(c("record.evidence.generation", "generation {number}", { number: i.generation })), /* @__PURE__ */ o("div", {
12
+ let c = r(), { data: l } = n(), u = t(c, l?.enums, i?.verdict ?? "unverified"), d = s(i?.verified_at, c.timeZone), f = [];
13
+ return i?.seq && f.push(c("record.evidence.chain", "chain #{seq}", { seq: i.seq })), i?.generation && f.push(c("record.evidence.generation", "generation {number}", { number: i.generation })), /* @__PURE__ */ o("div", {
13
14
  style: {
14
15
  display: "flex",
15
16
  flexDirection: "column",
@@ -31,25 +32,25 @@ function c({ evidence: i }) {
31
32
  },
32
33
  children: c("record.evidence.title", "Evidence")
33
34
  }),
34
- d.length > 0 && /* @__PURE__ */ a("span", {
35
+ f.length > 0 && /* @__PURE__ */ a("span", {
35
36
  style: {
36
37
  fontSize: 12,
37
38
  color: "var(--muted-foreground)"
38
39
  },
39
- children: d.join(" · ")
40
+ children: f.join(" · ")
40
41
  }),
41
42
  /* @__PURE__ */ a(e, {
42
- tone: n(l),
43
+ tone: u.tone,
43
44
  size: "sm",
44
45
  dot: !0,
45
- children: t(c, l)
46
+ children: u.label
46
47
  }),
47
- u && /* @__PURE__ */ a("span", {
48
+ d && /* @__PURE__ */ a("span", {
48
49
  style: {
49
50
  fontSize: 12,
50
51
  color: "var(--muted-foreground)"
51
52
  },
52
- children: c("record.evidence.verified", "Checked {when}", { when: u })
53
+ children: c("record.evidence.verified", "Checked {when}", { when: d })
53
54
  })
54
55
  ]
55
56
  }), i?.reason && /* @__PURE__ */ a("span", {
@@ -46,7 +46,9 @@ function m({ value: e, mode: t, onChange: n, fieldId: r }) {
46
46
  });
47
47
  }
48
48
  var h = {
49
- position: "relative",
49
+ display: "flex",
50
+ flexDirection: "column",
51
+ gap: 6,
50
52
  border: "1px solid var(--border)",
51
53
  borderRadius: "var(--radius-md)",
52
54
  padding: 12,
@@ -77,9 +79,8 @@ var h = {
77
79
  fontSize: 12.5,
78
80
  overflowWrap: "anywhere"
79
81
  }, x = {
80
- position: "absolute",
81
- top: 6,
82
- right: 6
82
+ display: "flex",
83
+ justifyContent: "flex-end"
83
84
  };
84
85
  function S({ value: r }) {
85
86
  let a = n(), [s, f] = o(!1), p = s ? a("field.json.hide_source", "Hide JSON") : a("field.json.show_source", "Show JSON");
@@ -90,7 +91,9 @@ function S({ value: r }) {
90
91
  children: /* @__PURE__ */ c(e, {
91
92
  size: 22,
92
93
  icon: /* @__PURE__ */ c(t.code, { size: 13 }),
93
- onClick: () => f((e) => !e),
94
+ onClick: (e) => {
95
+ e.stopPropagation(), f((e) => !e);
96
+ },
94
97
  title: p,
95
98
  "aria-label": p,
96
99
  "aria-pressed": s
@@ -5,29 +5,29 @@ import { resolveCellRenderer as r } from "../../fields/cells/registry.js";
5
5
  import { fieldDisplayName as i } from "../../../types/schema.js";
6
6
  import { fieldAccessInfo as a, isFieldReadable as o } from "../../../lib/field-classification.js";
7
7
  import { coerceDisplayString as s } from "../../../lib/display-value.js";
8
- import { verdictLabel as c, verdictTone as l } from "../../../lib/evidence-verdict.js";
9
- import { renderSchemaField as u, resolveSchemaFieldLabel as d } from "../../file-widgets/host.js";
10
- import { RowActionsCell as f } from "./RowActionsCell.js";
11
- import { MAX_COL_WIDTH as p } from "../../../stores/list-layout.js";
12
- import { createElement as m } from "react";
8
+ import { evidenceVerdictPill as c } from "../../../lib/evidence-verdict.js";
9
+ import { renderSchemaField as l, resolveSchemaFieldLabel as u } from "../../file-widgets/host.js";
10
+ import { RowActionsCell as d } from "./RowActionsCell.js";
11
+ import { MAX_COL_WIDTH as f } from "../../../stores/list-layout.js";
12
+ import { createElement as p } from "react";
13
13
  // src/components/pages/list/columns.ts
14
- function h(e, n, r, i, o) {
14
+ function m(e, n, r, i, o) {
15
15
  let s = a(r, i);
16
- if (!s || s.read !== "denied") return o ? m("span", { title: o }, n) : n;
16
+ if (!s || s.read !== "denied") return o ? p("span", { title: o }, n) : n;
17
17
  let c = s.required_permission ? e("list.columns.locked_permission", "Locked column: requires \"{permission}\"", { permission: s.required_permission }) : e("list.columns.locked_classification", "Locked column: {classification} classification", { classification: s.classification });
18
- return m("span", {
18
+ return p("span", {
19
19
  title: c,
20
20
  "aria-label": c,
21
21
  className: "inline-flex items-center gap-1"
22
- }, m(t.lock, { size: 12 }), n);
22
+ }, p(t.lock, { size: 12 }), n);
23
23
  }
24
- function g(e) {
24
+ function h(e) {
25
25
  return {
26
26
  minSize: Math.min(60, e),
27
- maxSize: Math.max(p, e)
27
+ maxSize: Math.max(f, e)
28
28
  };
29
29
  }
30
- var _ = 150, v = {
30
+ var g = 150, _ = {
31
31
  date: 104,
32
32
  time: 84,
33
33
  bool: 80,
@@ -38,146 +38,146 @@ var _ = 150, v = {
38
38
  enum: 130,
39
39
  uuid: 110,
40
40
  text: 240
41
- }, y = 7, b = 40;
42
- function x(e) {
41
+ }, v = 7, y = 40;
42
+ function b(e) {
43
43
  let t = Math.max(0, ...e.map((e) => e.length));
44
- return Math.max(140, t * y + b);
44
+ return Math.max(140, t * v + y);
45
45
  }
46
- function S(t) {
47
- let { visibleCols: a, entity: p, screen: y, schema: b, entityCode: S, rowActions: C, hasBatchActions: w, hasExplicitRowActions: T, canUpdate: E, canDelete: D, peekEnabled: O, hasDetailTarget: k, t: A, tabNavigate: j, refsRef: M, rowSelectionKey: N, setPeekRow: P } = t;
48
- if (a.length === 0 || !p) return [];
49
- let F = [];
50
- w && F.push({
46
+ function x(t) {
47
+ let { visibleCols: a, entity: f, screen: v, schema: y, entityCode: x, rowActions: S, hasBatchActions: C, hasExplicitRowActions: w, canUpdate: T, canDelete: E, peekEnabled: D, hasDetailTarget: O, t: k, tabNavigate: A, refsRef: j, rowSelectionKey: M, setPeekRow: N } = t;
48
+ if (a.length === 0 || !f) return [];
49
+ let P = [];
50
+ C && P.push({
51
51
  id: "_select",
52
52
  enableResizing: !1,
53
- header: ({ table: t }) => m(e, {
53
+ header: ({ table: t }) => p(e, {
54
54
  checked: t.getIsAllRowsSelected(),
55
55
  indeterminate: t.getIsSomeRowsSelected(),
56
56
  onChange: () => t.toggleAllRowsSelected()
57
57
  }),
58
58
  size: 34,
59
- cell: ({ row: t }) => m("span", { "data-testid": "row-select-checkbox" }, m(e, {
59
+ cell: ({ row: t }) => p("span", { "data-testid": "row-select-checkbox" }, p(e, {
60
60
  checked: t.getIsSelected(),
61
61
  onChange: () => t.toggleSelected()
62
62
  }))
63
63
  });
64
64
  for (let e of a) {
65
65
  if (e.startsWith("$status.")) {
66
- let t = e.slice(8), r = p.status_groups?.[t];
66
+ let t = e.slice(8), r = f.status_groups?.[t];
67
67
  if (!r) continue;
68
- let i = new Map(r.statuses.map((e) => [e.code, e])), a = x(r.statuses.map((e) => A(e.name) || e.code));
69
- F.push({
68
+ let i = new Map(r.statuses.map((e) => [e.code, e])), a = b(r.statuses.map((e) => k(e.name) || e.code));
69
+ P.push({
70
70
  id: e,
71
- header: A(r.name) || t,
71
+ header: k(r.name) || t,
72
72
  size: a,
73
- ...g(a),
73
+ ...h(a),
74
74
  cell: ({ row: e }) => {
75
75
  let r = e.original.$statuses?.find((e) => e.group_code === t);
76
- if (!r) return m("span", { className: "text-sm text-muted-foreground" }, "-");
76
+ if (!r) return p("span", { className: "text-sm text-muted-foreground" }, "-");
77
77
  let a = i.get(r.status_code);
78
- return m(n, {
78
+ return p(n, {
79
79
  tone: a?.color ?? "slate",
80
80
  size: "xs"
81
- }, A(a?.name) || r.status_code);
81
+ }, k(a?.name) || r.status_code);
82
82
  }
83
83
  });
84
84
  continue;
85
85
  }
86
86
  if (e.startsWith("$property.")) {
87
- let t = e.slice(10), n = p.properties?.[t];
87
+ let t = e.slice(10), n = f.properties?.[t];
88
88
  if (!n) continue;
89
- F.push({
89
+ P.push({
90
90
  id: e,
91
- header: () => h(A, A(n.name) || t, p, t, A(n.description) || void 0),
91
+ header: () => m(k, k(n.name) || t, f, t, k(n.description) || void 0),
92
92
  size: 150,
93
- ...g(150),
93
+ ...h(150),
94
94
  enableSorting: !1,
95
95
  cell: ({ row: e }) => {
96
96
  let n = e.original.$properties?.find((e) => e.property_code === t);
97
- return !n || n.value == null ? m("span", { className: "text-sm text-muted-foreground" }, "-") : m("span", { className: "text-sm" }, s(n.value));
97
+ return !n || n.value == null ? p("span", { className: "text-sm text-muted-foreground" }, "-") : p("span", { className: "text-sm" }, s(n.value));
98
98
  }
99
99
  });
100
100
  continue;
101
101
  }
102
102
  if (e === "$evidence") {
103
- F.push({
103
+ P.push({
104
104
  id: e,
105
- header: A("list.columns.evidence", "Evidence"),
105
+ header: k("list.columns.evidence", "Evidence"),
106
106
  size: 140,
107
- ...g(140),
107
+ ...h(140),
108
108
  enableSorting: !1,
109
109
  cell: ({ row: e }) => {
110
- let t = e.original.$evidence?.verdict ?? "unverified";
111
- return m(n, {
112
- tone: l(t),
110
+ let t = e.original.$evidence, r = c(k, y?.enums, t?.verdict ?? "unverified");
111
+ return p(n, {
112
+ tone: r.tone,
113
113
  size: "xs",
114
114
  dot: !0
115
- }, c(A, t));
115
+ }, r.label);
116
116
  }
117
117
  });
118
118
  continue;
119
119
  }
120
- if (p.files?.get(e)) {
121
- F.push({
120
+ if (f.files?.get(e)) {
121
+ P.push({
122
122
  id: e,
123
123
  accessorFn: (t) => t.$files?.[e] ?? null,
124
- header: () => h(A, d(A, p, e, b?.entities), p, e),
124
+ header: () => m(k, u(k, f, e, y?.entities), f, e),
125
125
  size: 150,
126
- ...g(150),
127
- cell: ({ row: t }) => u({
128
- entity: p,
129
- entityCode: S,
126
+ ...h(150),
127
+ cell: ({ row: t }) => l({
128
+ entity: f,
129
+ entityCode: x,
130
130
  fieldName: e,
131
131
  record: t.original,
132
132
  mode: "display",
133
133
  surface: "list",
134
- refs: M.current,
135
- t: A
134
+ refs: j.current,
135
+ t: k
136
136
  })
137
137
  });
138
138
  continue;
139
139
  }
140
- let t = p.fields.get(e);
140
+ let t = f.fields.get(e);
141
141
  if (!t) continue;
142
- let a = i(A, t, e, b?.entities), f = t.display?.width ?? v[t.type] ?? _, y = r({
142
+ let a = i(k, t, e, y?.entities), d = t.display?.width ?? _[t.type] ?? g, v = r({
143
143
  field: t,
144
144
  fieldName: e,
145
145
  surface: "list",
146
- entity: p,
147
- entityCode: S,
148
- entities: b?.entities,
149
- screens: b?.screens,
150
- refs: () => M.current,
151
- t: A
146
+ entity: f,
147
+ entityCode: x,
148
+ entities: y?.entities,
149
+ screens: y?.screens,
150
+ refs: () => j.current,
151
+ t: k
152
152
  });
153
- F.push({
153
+ P.push({
154
154
  id: e,
155
155
  accessorKey: e,
156
- header: () => h(A, a, p, e, A(t.display?.description) || void 0),
157
- enableSorting: t.type !== "json" && o(p, e),
158
- size: f,
159
- ...g(f),
160
- cell: ({ getValue: e, row: t }) => y(e(), t.original)
156
+ header: () => m(k, a, f, e, k(t.display?.description) || void 0),
157
+ enableSorting: t.type !== "json" && o(f, e),
158
+ size: d,
159
+ ...h(d),
160
+ cell: ({ getValue: e, row: t }) => v(e(), t.original)
161
161
  });
162
162
  }
163
- return (!T && E || !T && D || C.length > 0) && F.push({
163
+ return (!w && T || !w && E || S.length > 0) && P.push({
164
164
  id: "_actions",
165
165
  enableResizing: !1,
166
166
  header: "",
167
167
  size: 40,
168
- cell: ({ row: e }) => m(f, {
168
+ cell: ({ row: e }) => p(d, {
169
169
  row: e.original,
170
- rowId: N(p, e.original),
171
- screen: y,
172
- fullScreen: y,
173
- entity: p,
174
- entityCode: S,
175
- rowActions: C,
176
- tabNavigate: j,
177
- peekAllowed: O,
178
- hasDetailTarget: k,
179
- onPeek: P
170
+ rowId: M(f, e.original),
171
+ screen: v,
172
+ fullScreen: v,
173
+ entity: f,
174
+ entityCode: x,
175
+ rowActions: S,
176
+ tabNavigate: A,
177
+ peekAllowed: D,
178
+ hasDetailTarget: O,
179
+ onPeek: N
180
180
  })
181
- }), F;
181
+ }), P;
182
182
  }
183
- export { S as buildListColumns };
183
+ export { x as buildListColumns };
@@ -8,6 +8,9 @@ var n = e(function({ kind: e = "default", size: n = "sm", icon: r, iconRight: i,
8
8
  gap: 6,
9
9
  height: n === "xs" ? 24 : n === "sm" ? 28 : n === "md" ? 32 : 36,
10
10
  padding: `0 ${n === "xs" ? 8 : n === "sm" ? 10 : n === "md" ? 12 : 14}px`,
11
+ minWidth: "var(--touch-target-min-size)",
12
+ minHeight: "var(--touch-target-min-size)",
13
+ justifyContent: "center",
11
14
  borderRadius: "var(--radius-md)",
12
15
  fontSize: n === "xs" ? 11.5 : 12.5,
13
16
  fontWeight: 500,
@@ -15,8 +15,8 @@ var n = e(function({ icon: e, onClick: n, title: r, size: i = 28, active: a, dis
15
15
  justifyContent: "center",
16
16
  width: i,
17
17
  height: i,
18
- minWidth: "var(--icon-button-min-size)",
19
- minHeight: "var(--icon-button-min-size)",
18
+ minWidth: "var(--touch-target-min-size)",
19
+ minHeight: "var(--touch-target-min-size)",
20
20
  borderRadius: "var(--radius-md)",
21
21
  border: "1px solid transparent",
22
22
  background: a ? "var(--surface-3)" : "transparent",