@ogygie/ui 0.18.0 → 0.19.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogygie/ui",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Ogygie front socle: the five prescribed patterns (DataTable, EmptyState, ErrorBanner, ContractForm, VarianceChart), one screen-state component (ScreenState), fetchContract and EditableText. Ships TypeScript sources — Ogygie products run Vite/tsx/vitest by construction (D1); a product imports them, it no longer copies them (D39).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "./variance-chart": "./src/VarianceChart.tsx"
20
20
  },
21
21
  "dependencies": {
22
- "@ogygie/core": "0.18.0"
22
+ "@ogygie/core": "0.19.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@tanstack/react-table": "^9.0.0",
@@ -11,7 +11,7 @@ export function CharacterCount({ length, max }: { length: number; max: number })
11
11
  data-pattern="CharacterCount"
12
12
  className={`ml-2 text-xs tabular-nums ${length >= max ? "text-warning" : "text-text-muted"}`}
13
13
  >
14
- {length} / {max}
14
+ {length.toLocaleString()} / {max.toLocaleString()}
15
15
  </span>
16
16
  );
17
17
  }
@@ -28,4 +28,9 @@ describe("failures", () => {
28
28
  expect(messageOf(new OgygieFailure(payload, 403))).toBe(payload.message);
29
29
  expect(failureOf({ error: { code: "x" } })).toBeNull();
30
30
  });
31
+ it("croit sur parole une OgygieFailure par sa classe, même quand son corps ne passerait pas le schéma", () => {
32
+ const failure = new OgygieFailure({ ogygie: true, code: "CHECK_IN_EMPTY", message: "m", file: null, cause: "text=''", suggestedFix: "f", details: {}, timestamp: new Date(0).toISOString() }, 400);
33
+ expect(failureOf(failure)?.code).toBe("CHECK_IN_EMPTY");
34
+ expect(messageOf(failure)).toBe("m");
35
+ });
31
36
  });
package/src/failures.ts CHANGED
@@ -8,10 +8,12 @@
8
8
  * lose the code and the suggested fix, the only two things a reader can act
9
9
  * on. Anything else degrades to its message.
10
10
  */
11
- import { OgygieErrorSchema, type OgygieError } from "@ogygie/core/errors";
11
+ import { OgygieErrorSchema, OgygieFailure, type OgygieError } from "@ogygie/core/errors";
12
12
 
13
13
  /** The OgygieError a failure carries, or null when the thrown value is not one. */
14
14
  export function failureOf(error: unknown): OgygieError | null {
15
+ // A failure our own code built answers for its body: read as it is — a test's short message is not a foreign object (astorg-ai-pdlc, 2026-10-18).
16
+ if (error instanceof OgygieFailure) return error.error;
15
17
  if (typeof error !== "object" || error === null || !("error" in error)) return null;
16
18
  const parsed = OgygieErrorSchema.safeParse((error as { error: unknown }).error);
17
19
  return parsed.success ? parsed.data : null;