@declarion/react 0.375.0 → 0.377.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.
@@ -3,20 +3,21 @@ import { evidenceVerdictPill as t } from "../../lib/evidence-verdict.js";
3
3
  import { useSchema as n } from "../../hooks/useSchema.js";
4
4
  import { useText as r } from "../../hooks/useText.js";
5
5
  import { formatOffsetTimestamp as i } from "../../lib/timestamp.js";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ import { messageText as a } from "../../lib/message.js";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
8
  // src/components/detail-layout/EvidenceBlock.tsx
8
- function s(e, t) {
9
+ function c(e, t) {
9
10
  if (e && !Number.isNaN(new Date(e).getTime())) return i(e, { zone: t });
10
11
  }
11
- function c({ evidence: i }) {
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", {
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", {
14
15
  style: {
15
16
  display: "flex",
16
17
  flexDirection: "column",
17
18
  gap: 6
18
19
  },
19
- children: [/* @__PURE__ */ o("div", {
20
+ children: [/* @__PURE__ */ s("div", {
20
21
  style: {
21
22
  display: "flex",
22
23
  alignItems: "center",
@@ -24,42 +25,42 @@ function c({ evidence: i }) {
24
25
  flexWrap: "wrap"
25
26
  },
26
27
  children: [
27
- /* @__PURE__ */ a("span", {
28
+ /* @__PURE__ */ o("span", {
28
29
  style: {
29
30
  fontSize: 12,
30
31
  fontWeight: 600,
31
32
  color: "var(--muted-foreground)"
32
33
  },
33
- children: c("record.evidence.title", "Evidence")
34
+ children: l("record.evidence.title", "Evidence")
34
35
  }),
35
- f.length > 0 && /* @__PURE__ */ a("span", {
36
+ m.length > 0 && /* @__PURE__ */ o("span", {
36
37
  style: {
37
38
  fontSize: 12,
38
39
  color: "var(--muted-foreground)"
39
40
  },
40
- children: f.join(" · ")
41
+ children: m.join(" · ")
41
42
  }),
42
- /* @__PURE__ */ a(e, {
43
- tone: u.tone,
43
+ /* @__PURE__ */ o(e, {
44
+ tone: d.tone,
44
45
  size: "sm",
45
46
  dot: !0,
46
- children: u.label
47
+ children: d.label
47
48
  }),
48
- d && /* @__PURE__ */ a("span", {
49
+ f && /* @__PURE__ */ o("span", {
49
50
  style: {
50
51
  fontSize: 12,
51
52
  color: "var(--muted-foreground)"
52
53
  },
53
- children: c("record.evidence.verified", "Checked {when}", { when: d })
54
+ children: l("record.evidence.verified", "Checked {when}", { when: f })
54
55
  })
55
56
  ]
56
- }), i?.reason && /* @__PURE__ */ a("span", {
57
+ }), p && /* @__PURE__ */ o("span", {
57
58
  style: {
58
59
  fontSize: 12,
59
60
  color: "var(--destructive)"
60
61
  },
61
- children: i.reason
62
+ children: p
62
63
  })]
63
64
  });
64
65
  }
65
- export { c as EvidenceBlock };
66
+ export { l as EvidenceBlock };
@@ -0,0 +1,11 @@
1
+ import { useText as e } from "../../../../hooks/useText.js";
2
+ import { messageText as t } from "../../../../lib/message.js";
3
+ import { EMPTY_CELL as n } from "./emptyCell.js";
4
+ import { Fragment as r, jsx as i } from "react/jsx-runtime";
5
+ // src/components/fields/cells/factories/message.tsx
6
+ function a({ value: n }) {
7
+ let a = e();
8
+ return /* @__PURE__ */ i(r, { children: t(a, n) });
9
+ }
10
+ var o = () => (e) => e == null || e === "" ? n : /* @__PURE__ */ i(a, { value: e });
11
+ export { o as messageFactory };
@@ -22,8 +22,9 @@ import { richTextPreviewFactory as S } from "./factories/richTextPreview.js";
22
22
  import { multilangInlineFactory as C } from "./factories/multilangInline.js";
23
23
  import { fileReferenceFactory as w } from "./factories/fileReference.js";
24
24
  import { errorFactory as T } from "./factories/errorTitle.js";
25
+ import { messageFactory as E } from "./factories/message.js";
25
26
  // src/components/fields/cells/registry.ts
26
- var E = {
27
+ var D = {
27
28
  text: e,
28
29
  bool_pill: t,
29
30
  badge: n,
@@ -50,12 +51,13 @@ var E = {
50
51
  password_mask: x,
51
52
  rich_text_preview: S,
52
53
  multilang_inline: C,
53
- error: T
54
+ error: T,
55
+ message: E
54
56
  };
55
- Object.keys(E).sort();
56
- function D(e) {
57
- let t = e.field.display?.widget ?? "text", n = E[t];
57
+ Object.keys(D).sort();
58
+ function O(e) {
59
+ let t = e.field.display?.widget ?? "text", n = D[t];
58
60
  if (!n) throw Error(`resolveCellRenderer: no factory registered for widget "${t}" (field "${e.fieldName}"). The engine must stamp a smart default at YAML-load time; an unknown widget here indicates an out-of-sync allow-list.`);
59
61
  return n(e);
60
62
  }
61
- export { D as resolveCellRenderer };
63
+ export { O as resolveCellRenderer };
@@ -1,4 +1,4 @@
1
- import { $ as Action, $t as FileFieldValue, A as EnrichedRow, At as resolveDetailRoute, B as Refs, Bt as FilterURLState, C as ApiErrorBody, Ct as extractPkValues, D as CURSOR_SEMANTICS_MISMATCH, Dt as pkValuesFromId, E as CURSOR_LANGUAGE_CHANGED, Et as pkValuePartsToId, F as LoginResponse, Ft as pickLocalized, G as V2ListParams, Gt as hasOrGroups, H as StatusInfo, Ht as NO_VALUE_OPS, I as ParamLookup, It as pluralText, J as V2ParamInstance, Jt as setFiltersInURL, K as V2ListResponse, Kt as parseFilterURLState, L as PropertyValue, Lt as textWithNodes, M as ListMeta, Mt as TextFn, N as ListParams, Nt as TextVars, O as CheckSetupResponse, Ot as pkValuesToDetailId, P as ListResponse, Pt as makeTextFn, Q as isCursorStaleError, Qt as FileFieldMode, R as PublicParam, Rt as FilterNode, S as ApiError, St as buildRowDetailHref, T as BrandingIdentity, Tt as getPrimaryKeyFields, U as Tenant, Ut as OP_LABELS, V as SignupResponse, Vt as FilterValueResolver, W as TenantEnv, Wt as countActiveFilters, X as V2StatusInstance, Xt as FileFieldDef, Y as V2PropertyInstance, Yt as FileAddress, Z as errorCodeOf, Zt as FileFieldDisplay, _ as executeAction, _t as StatusDef, a as ResponsiveMode, at as EnumDef, b as AggregateParams, bt as buildDetailHrefFromId, c as resolveViewportCategory, ct as LocalizedString, d as ActionExecuteResponse, dt as PkValues, en as HydratedFile, et as AreaDef, f as ActionItemError, ft as PropertyDef, g as deleteObject, gt as SpecialValue, h as buildActionBody, ht as Screen, i as ResponsiveBreakpoints, it as EntityField, j as ImpersonationInfo, jt as MANDATORY_LANGUAGE, k as DataResponse, kt as pkValuesToId, l as ActionBatchError, lt as NavNode, m as GetEntityOptions, mt as Schema, n as useResponsiveMode, nn as UploadedFile, nt as ClassificationTierDef, o as ResponsiveViewport, ot as FieldAccessInfo, p as ActionItemSkip, pt as RefConfig, q as V2Meta, qt as parseFiltersFromURL, r as DEFAULT_RESPONSIVE_BREAKPOINTS, rn as OrderedMap, rt as Entity, s as ViewportCategory, st as LanguageDef, t as ResponsiveModeProvider, tn as UploadProgress, tt as ChildRelation, u as ActionExecuteRequest, ut as ParameterDef, v as restoreObject, vt as StatusGroupDef, w as AuthUser, wt as fieldDisplayName, x as AggregateResponse, xt as buildEntityDetailHref, y as AggregateGroup, yt as StructureDef, z as PublicParamsResponse, zt as FilterOp } from "./useResponsiveMode-CBSHZBY5.js";
1
+ import { $ as Action, $t as FileFieldValue, A as EnrichedRow, At as resolveDetailRoute, B as Refs, Bt as FilterURLState, C as ApiErrorBody, Ct as extractPkValues, D as CURSOR_SEMANTICS_MISMATCH, Dt as pkValuesFromId, E as CURSOR_LANGUAGE_CHANGED, Et as pkValuePartsToId, F as LoginResponse, Ft as pickLocalized, G as V2ListParams, Gt as hasOrGroups, H as StatusInfo, Ht as NO_VALUE_OPS, I as ParamLookup, It as pluralText, J as V2ParamInstance, Jt as setFiltersInURL, K as V2ListResponse, Kt as parseFilterURLState, L as PropertyValue, Lt as textWithNodes, M as ListMeta, Mt as TextFn, N as ListParams, Nt as TextVars, O as CheckSetupResponse, Ot as pkValuesToDetailId, P as ListResponse, Pt as makeTextFn, Q as isCursorStaleError, Qt as FileFieldMode, R as PublicParam, Rt as FilterNode, S as ApiError, St as buildRowDetailHref, T as BrandingIdentity, Tt as getPrimaryKeyFields, U as Tenant, Ut as OP_LABELS, V as SignupResponse, Vt as FilterValueResolver, W as TenantEnv, Wt as countActiveFilters, X as V2StatusInstance, Xt as FileFieldDef, Y as V2PropertyInstance, Yt as FileAddress, Z as errorCodeOf, Zt as FileFieldDisplay, _ as executeAction, _t as StatusDef, a as ResponsiveMode, at as EnumDef, b as AggregateParams, bt as buildDetailHrefFromId, c as resolveViewportCategory, ct as LocalizedString, d as ActionExecuteResponse, dt as PkValues, en as HydratedFile, et as AreaDef, f as ActionItemError, ft as PropertyDef, g as deleteObject, gt as SpecialValue, h as buildActionBody, ht as Screen, i as ResponsiveBreakpoints, it as EntityField, j as ImpersonationInfo, jt as MANDATORY_LANGUAGE, k as DataResponse, kt as pkValuesToId, l as ActionBatchError, lt as NavNode, m as GetEntityOptions, mt as Schema, n as useResponsiveMode, nn as UploadedFile, nt as ClassificationTierDef, o as ResponsiveViewport, ot as FieldAccessInfo, p as ActionItemSkip, pt as RefConfig, q as V2Meta, qt as parseFiltersFromURL, r as DEFAULT_RESPONSIVE_BREAKPOINTS, rn as OrderedMap, rt as Entity, s as ViewportCategory, st as LanguageDef, t as ResponsiveModeProvider, tn as UploadProgress, tt as ChildRelation, u as ActionExecuteRequest, ut as ParameterDef, v as restoreObject, vt as StatusGroupDef, w as AuthUser, wt as fieldDisplayName, x as AggregateResponse, xt as buildEntityDetailHref, y as AggregateGroup, yt as StructureDef, z as PublicParamsResponse, zt as FilterOp } from "./useResponsiveMode-DW7OD59J.js";
2
2
  import { i as setIconRegistry, n as getIcon, t as IconDef } from "./icon-registry-BY2tt-GF.js";
3
3
  import { i as DynamicIcon, n as IconName, r as IconProps, t as Icon } from "./Icons-BdXCxyw3.js";
4
4
  import { ButtonHTMLAttributes, CSSProperties, ComponentType, InputHTMLAttributes, MouseEvent, ReactNode, RefObject } from "react";
@@ -0,0 +1,17 @@
1
+ // src/lib/message.ts
2
+ function e(e) {
3
+ return typeof e == "object" && !!e && typeof e.code == "string";
4
+ }
5
+ function t(t) {
6
+ let n = t;
7
+ if (typeof t == "string") try {
8
+ n = JSON.parse(t);
9
+ } catch {
10
+ return [];
11
+ }
12
+ return Array.isArray(n) ? n.filter(e) : e(n) ? [n] : [];
13
+ }
14
+ function n(e, n) {
15
+ return t(n).map((t) => e(t.code, t.code, t.values)).join(" ");
16
+ }
17
+ export { t as messageParts, n as messageText };
@@ -1,4 +1,4 @@
1
- import { B as Refs, M as ListMeta, Mt as TextFn, P as ListResponse, ct as LocalizedString, d as ActionExecuteResponse, k as DataResponse, mt as Schema, o as ResponsiveViewport, u as ActionExecuteRequest } from "./useResponsiveMode-CBSHZBY5.js";
1
+ import { B as Refs, M as ListMeta, Mt as TextFn, P as ListResponse, ct as LocalizedString, d as ActionExecuteResponse, k as DataResponse, mt as Schema, o as ResponsiveViewport, u as ActionExecuteRequest } from "./useResponsiveMode-DW7OD59J.js";
2
2
  import { ReactElement, ReactNode } from "react";
3
3
  import { QueryClient } from "@tanstack/react-query";
4
4
  import { RenderResult } from "@testing-library/react";
@@ -1262,6 +1262,10 @@ interface ClassificationTierDef {
1262
1262
  */
1263
1263
  sod_protected?: boolean;
1264
1264
  }
1265
+ interface MessagePart {
1266
+ code: string;
1267
+ values?: Record<string, string>;
1268
+ }
1265
1269
  interface ListMeta {
1266
1270
  /**
1267
1271
  * Total matching rows. Present only when the request asked for a count
@@ -1580,7 +1584,7 @@ interface V2PropertyInstance {
1580
1584
  interface EvidenceVerdict {
1581
1585
  verdict: string;
1582
1586
  verified_at?: string;
1583
- reason?: string;
1587
+ reason?: MessagePart[];
1584
1588
  seq?: number;
1585
1589
  generation?: number;
1586
1590
  covered: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.375.0",
3
+ "version": "0.377.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",