@krizaka/ui 4.1.0 → 4.2.1
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/dist/analysis-report.d.ts +44 -2
- package/dist/analysis-report.js +37 -16
- package/dist/analysis-report.js.map +1 -1
- package/dist/filter-bar.d.ts +3 -3
- package/dist/map.d.ts +6 -6
- package/dist/media-gallery.d.ts +3 -3
- package/dist/media-player.d.ts +3 -3
- package/dist/native.d.ts +8 -0
- package/dist/native.js +10 -2
- package/dist/native.js.map +1 -1
- package/dist/virtual.d.ts +3 -3
- package/package.json +5 -5
- package/registry/account-settings.json +1 -1
- package/registry/analysis-report.json +59 -5
- package/registry/app-frame.json +1 -1
- package/registry/examples/account-settings/patterns.js +1 -1
- package/registry/examples/account-settings/patterns.tsx +1 -1
- package/registry/examples/analysis-report/authenticity.d.ts +4 -0
- package/registry/examples/analysis-report/authenticity.js +50 -0
- package/registry/examples/analysis-report/authenticity.tsx +33 -0
- package/registry/examples/analysis-report/lease-review.d.ts +4 -0
- package/registry/examples/analysis-report/lease-review.js +51 -0
- package/registry/examples/analysis-report/lease-review.tsx +33 -0
- package/registry/examples/analysis-report/long-address.d.ts +4 -0
- package/registry/examples/analysis-report/long-address.js +42 -0
- package/registry/examples/analysis-report/long-address.tsx +27 -0
- package/registry/examples/markdown/wide-table.js +1 -1
- package/registry/examples/markdown/wide-table.tsx +1 -1
- package/registry/index.json +8 -8
- package/registry/map.json +1 -1
- package/registry/markdown.json +1 -1
- package/registry/nav-bar.json +1 -1
- package/registry/rail-nav.json +1 -1
- package/registry/shop.json +1 -1
- package/registry/site-footer.json +1 -1
package/dist/virtual.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import * as React from 'react';
|
|
|
6
6
|
declare const virtual: tailwind_variants.TVReturnType<{
|
|
7
7
|
[key: string]: {
|
|
8
8
|
[key: string]: tailwind_variants.ClassValue | {
|
|
9
|
-
list?: tailwind_variants.ClassValue;
|
|
10
9
|
viewport?: tailwind_variants.ClassValue;
|
|
10
|
+
list?: tailwind_variants.ClassValue;
|
|
11
11
|
item?: tailwind_variants.ClassValue;
|
|
12
12
|
row?: tailwind_variants.ClassValue;
|
|
13
13
|
empty?: tailwind_variants.ClassValue;
|
|
@@ -16,8 +16,8 @@ declare const virtual: tailwind_variants.TVReturnType<{
|
|
|
16
16
|
} | {
|
|
17
17
|
[x: string]: {
|
|
18
18
|
[x: string]: tailwind_variants.ClassValue | {
|
|
19
|
-
list?: tailwind_variants.ClassValue;
|
|
20
19
|
viewport?: tailwind_variants.ClassValue;
|
|
20
|
+
list?: tailwind_variants.ClassValue;
|
|
21
21
|
item?: tailwind_variants.ClassValue;
|
|
22
22
|
row?: tailwind_variants.ClassValue;
|
|
23
23
|
empty?: tailwind_variants.ClassValue;
|
|
@@ -32,8 +32,8 @@ declare const virtual: tailwind_variants.TVReturnType<{
|
|
|
32
32
|
}, undefined, {
|
|
33
33
|
[key: string]: {
|
|
34
34
|
[key: string]: tailwind_variants.ClassValue | {
|
|
35
|
-
list?: tailwind_variants.ClassValue;
|
|
36
35
|
viewport?: tailwind_variants.ClassValue;
|
|
36
|
+
list?: tailwind_variants.ClassValue;
|
|
37
37
|
item?: tailwind_variants.ClassValue;
|
|
38
38
|
row?: tailwind_variants.ClassValue;
|
|
39
39
|
empty?: tailwind_variants.ClassValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krizaka/ui",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "The Krizaka front-end platform's components: the primitives (button, card, dialog, toast, menu, field, tabs, chip, switch, slider, command palette, theme, countdown…) on the semantic --kz-* tokens, the animated marks (Krizaka, Sovkora, Verikora, Folioviv) and the motion signature — web and /native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"krizaka",
|
|
@@ -1012,7 +1012,7 @@
|
|
|
1012
1012
|
],
|
|
1013
1013
|
"peerDependencies": {
|
|
1014
1014
|
"@krizaka/query": ">=0.3.0",
|
|
1015
|
-
"@krizaka/tailwind": ">=4.1
|
|
1015
|
+
"@krizaka/tailwind": ">=4.2.1",
|
|
1016
1016
|
"@maplibre/maplibre-react-native": ">=11",
|
|
1017
1017
|
"@shopify/flash-list": ">=2",
|
|
1018
1018
|
"expo-camera": ">=16",
|
|
@@ -3480,10 +3480,10 @@
|
|
|
3480
3480
|
"sonner": "^2.0.8",
|
|
3481
3481
|
"tailwind-variants": "^3.3.1",
|
|
3482
3482
|
"zod": "^4.6.7",
|
|
3483
|
-
"@krizaka/
|
|
3483
|
+
"@krizaka/pacer": "^0.2.0",
|
|
3484
|
+
"@krizaka/tokens": "^4.2.1",
|
|
3484
3485
|
"@krizaka/intl": "^0.4.1",
|
|
3485
|
-
"@krizaka/
|
|
3486
|
-
"@krizaka/pacer": "^0.2.0"
|
|
3486
|
+
"@krizaka/icons": "^0.10.0"
|
|
3487
3487
|
},
|
|
3488
3488
|
"scripts": {
|
|
3489
3489
|
"build": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});for(const f of fs.readdirSync('registry/examples',{recursive:true}))if(/\\.(js|d\\.ts)$/.test(f))fs.rmSync('registry/examples/'+f)\" && tsup && node -e \"require('node:fs').copyFileSync('src/motion.css','dist/motion.css');require('node:fs').copyFileSync('src/blocks.css','dist/blocks.css');require('node:fs').copyFileSync('src/story.css','dist/story.css')\" && node scripts/build-registry.mjs",
|
|
@@ -554,7 +554,7 @@
|
|
|
554
554
|
"description": "Security, subscription, storage and my data as flat sections of rows.",
|
|
555
555
|
"path": "examples/account-settings/patterns.tsx",
|
|
556
556
|
"module": "@krizaka/ui/registry/examples/account-settings/patterns",
|
|
557
|
-
"code": "import { Button } from \"@krizaka/ui/button\";\nimport { ConfirmButton } from \"@krizaka/ui/confirm-button\";\nimport { Meter } from \"@krizaka/ui/meter\";\nimport { SettingsRow, SettingsSection } from \"@krizaka/ui/settings-layout\";\n\n// The four other sections of an account page, each a flat SettingsSection of rows: security, subscription (the billing\n// portal is one link), storage (a Meter), « my data » (export, and a delete that asks twice).\nexport default function AccountSectionPatterns() {\n return (\n <div className=\"flex w-full max-w-2xl flex-col gap-10\">\n <SettingsSection variant=\"flat\" title=\"Sécurité\" description=\"Comment vous vous connectez.\">\n <SettingsRow label=\"Courriel\" description=\"Un lien de confirmation est envoyé à la nouvelle adresse.\">\n eric@example.com <Button variant=\"secondary\" size=\"sm\">Changer</Button>\n </SettingsRow>\n <SettingsRow label=\"Mot de passe\" description=\"Modifié il y a 3 mois.\">\n <Button variant=\"secondary\" size=\"sm\">Changer</Button>\n </SettingsRow>\n </SettingsSection>\n <SettingsSection variant=\"flat\" title=\"Abonnement\" description=\"Votre forfait et vos factures.\">\n <SettingsRow label=\"Forfait Solo\" description=\"Renouvelé le 1er novembre.\">\n <Button variant=\"secondary\" size=\"sm\" asChild><a href=\"https://
|
|
557
|
+
"code": "import { Button } from \"@krizaka/ui/button\";\nimport { ConfirmButton } from \"@krizaka/ui/confirm-button\";\nimport { Meter } from \"@krizaka/ui/meter\";\nimport { SettingsRow, SettingsSection } from \"@krizaka/ui/settings-layout\";\n\n// The four other sections of an account page, each a flat SettingsSection of rows: security, subscription (the billing\n// portal is one link), storage (a Meter), « my data » (export, and a delete that asks twice).\nexport default function AccountSectionPatterns() {\n return (\n <div className=\"flex w-full max-w-2xl flex-col gap-10\">\n <SettingsSection variant=\"flat\" title=\"Sécurité\" description=\"Comment vous vous connectez.\">\n <SettingsRow label=\"Courriel\" description=\"Un lien de confirmation est envoyé à la nouvelle adresse.\">\n eric@example.com <Button variant=\"secondary\" size=\"sm\">Changer</Button>\n </SettingsRow>\n <SettingsRow label=\"Mot de passe\" description=\"Modifié il y a 3 mois.\">\n <Button variant=\"secondary\" size=\"sm\">Changer</Button>\n </SettingsRow>\n </SettingsSection>\n <SettingsSection variant=\"flat\" title=\"Abonnement\" description=\"Votre forfait et vos factures.\">\n <SettingsRow label=\"Forfait Solo\" description=\"Renouvelé le 1er novembre.\">\n <Button variant=\"secondary\" size=\"sm\" asChild><a href=\"https://example.com\">Ouvrir le portail de facturation</a></Button>\n </SettingsRow>\n </SettingsSection>\n <SettingsSection variant=\"flat\" title=\"Stockage\" description=\"L'espace utilisé par vos documents.\">\n <SettingsRow label=\"Documents\">\n <Meter className=\"w-56\" label=\"Stockage\" value={18} max={50} valueText=\"18 Go sur 50 Go\" showLabel />\n </SettingsRow>\n </SettingsSection>\n <SettingsSection variant=\"flat\" title=\"Mes données\" description=\"Ce que vous pouvez emporter ou effacer.\">\n <SettingsRow label=\"Exporter\" description=\"Une archive de tout ce que vous avez téléversé.\">\n <Button variant=\"secondary\" size=\"sm\">Demander l'export</Button>\n </SettingsRow>\n <SettingsRow label=\"Supprimer mon compte\" description=\"Vos documents et votre compte disparaissent, sans retour.\">\n <ConfirmButton variant=\"danger\" size=\"sm\" confirmLabel=\"Supprimer pour de bon ?\" onConfirm={() => {}}>Supprimer</ConfirmButton>\n </SettingsRow>\n </SettingsSection>\n </div>\n );\n}\n"
|
|
558
558
|
}
|
|
559
559
|
]
|
|
560
560
|
},
|
|
@@ -46,13 +46,15 @@
|
|
|
46
46
|
"Pass every word through `labels` from your messages (`@krizaka/i18n`); the package ships none.",
|
|
47
47
|
"While the run is open, set `streaming`: findings are announced politely as they arrive.",
|
|
48
48
|
"Give `onLocate` to scroll a document viewer to a finding's place; without it the location is plain text.",
|
|
49
|
+
"Quote the passage the finding rests on (`quote`) and cite the rule (`reference`, with an `href` when it is public): the reader checks the source without opening the document.",
|
|
50
|
+
"Fold the calm groups (`folded`) and the provenance (`provenanceFolded`): the serious findings stay in view, the rest is one tap away.",
|
|
49
51
|
"Examples and tests use demo data only."
|
|
50
52
|
],
|
|
51
53
|
"accessibility": {
|
|
52
54
|
"keyboard": [
|
|
53
55
|
{
|
|
54
56
|
"keys": "Tab / Enter",
|
|
55
|
-
"action": "Reaches the copy buttons, the locations and the
|
|
57
|
+
"action": "Reaches the copy buttons, the locations, the references and the folds; Enter or Space opens a fold."
|
|
56
58
|
}
|
|
57
59
|
],
|
|
58
60
|
"notes": [
|
|
@@ -111,6 +113,13 @@
|
|
|
111
113
|
"description": "The studio's name (« Document validation »).",
|
|
112
114
|
"required": true
|
|
113
115
|
},
|
|
116
|
+
{
|
|
117
|
+
"name": "folded",
|
|
118
|
+
"type": "readonly (\"inconsistent\" | \"attention\" | \"unverified\" | \"consistent\")[]",
|
|
119
|
+
"default": null,
|
|
120
|
+
"description": "Status groups closed by default (a native `details`, the count in its summary): « respected », « not applicable ».",
|
|
121
|
+
"required": false
|
|
122
|
+
},
|
|
114
123
|
{
|
|
115
124
|
"name": "hideActions",
|
|
116
125
|
"type": "boolean",
|
|
@@ -153,6 +162,13 @@
|
|
|
153
162
|
"description": "Where the result comes from: model, run id, duration, version.",
|
|
154
163
|
"required": false
|
|
155
164
|
},
|
|
165
|
+
{
|
|
166
|
+
"name": "provenanceFolded",
|
|
167
|
+
"type": "boolean",
|
|
168
|
+
"default": null,
|
|
169
|
+
"description": "The provenance (run id, ruleset, version) in one closed fold, titled `labels.provenance`.",
|
|
170
|
+
"required": false
|
|
171
|
+
},
|
|
156
172
|
{
|
|
157
173
|
"name": "streaming",
|
|
158
174
|
"type": "boolean",
|
|
@@ -177,6 +193,30 @@
|
|
|
177
193
|
"module": "@krizaka/ui/registry/examples/analysis-report/document-validation",
|
|
178
194
|
"code": "import { AnalysisReport, type AnalysisReportLabels } from \"@krizaka/ui/analysis-report\";\n\n// The words come from the app's messages (demo wording here).\nconst labels: AnalysisReportLabels = {\n status: { inconsistent: \"Inconsistent\", attention: \"Needs attention\", unverified: \"Not verified\", consistent: \"Consistent\" },\n findings: \"Findings\", mayIndicate: \"May indicate\", location: \"Where:\", evidence: \"Evidence\", details: \"Details\",\n limits: \"What this report did not examine\", nextSteps: \"Next steps\", provenance: \"Provenance\",\n model: \"Model\", runId: \"Run\", duration: \"Duration\", version: \"Version\",\n copyJson: \"Copy JSON\", copyMarkdown: \"Copy Markdown\", copied: \"Copied\", streaming: \"Findings are arriving\", noFindings: \"No finding.\",\n};\n\nexport default function AnalysisReportDocumentValidation() {\n return (\n <AnalysisReport\n labels={labels}\n title=\"Document validation\"\n summary=\"Two signals disagree with the document's own dates.\"\n status=\"inconsistent\"\n findings={[\n { id: \"1\", status: \"inconsistent\", code: \"PDF-META-002\", title: \"Modified after it was signed\", observation: \"The file was saved 12 days after the signature date.\", mayIndicate: \"An edit after signing, or a re-export. Not proof of tampering.\", location: \"metadata\", evidence: \"CreationDate: 2026-03-02\\nModDate: 2026-03-14\" },\n { id: \"2\", status: \"attention\", code: \"PDF-FONT-001\", title: \"Two fonts on one line\", observation: \"A single line mixes two typefaces.\", location: \"page 2\" },\n { id: \"3\", status: \"consistent\", code: \"PDF-PAGE-001\", title: \"Page count matches\", observation: \"4 pages, as the footer says.\" },\n ]}\n limits={[\"Handwritten signatures were not compared.\", \"The sender's identity was not checked.\"]}\n nextSteps={[\"Ask the sender for the original file.\", \"Compare with the copy on record.\"]}\n provenance={{ model: \"demo-model-1\", runId: \"run_8f3a21\", duration: \"4.2 s\", version: \"1.3.0\" }}\n />\n );\n}\n"
|
|
179
195
|
},
|
|
196
|
+
{
|
|
197
|
+
"name": "lease-review",
|
|
198
|
+
"title": "A lease review",
|
|
199
|
+
"description": "Each finding quotes the passage and cites its article of law; the respected and unverified groups and the provenance are folded.",
|
|
200
|
+
"path": "examples/analysis-report/lease-review.tsx",
|
|
201
|
+
"module": "@krizaka/ui/registry/examples/analysis-report/lease-review",
|
|
202
|
+
"code": "import { AnalysisReport, type AnalysisReportLabels } from \"@krizaka/ui/analysis-report\";\n\n// The words come from the app's messages (demo wording here).\nconst labels: AnalysisReportLabels = {\n status: { inconsistent: \"Not compliant\", attention: \"To check\", unverified: \"Not applicable\", consistent: \"Respected\" },\n findings: \"Findings\", mayIndicate: \"May indicate\", location: \"Where:\", evidence: \"Evidence\", details: \"Details\",\n limits: \"What this report did not examine\", nextSteps: \"Next steps\", provenance: \"Provenance\",\n model: \"Ruleset\", runId: \"Run\", duration: \"Duration\", version: \"Version\",\n copyJson: \"Copy JSON\", copyMarkdown: \"Copy Markdown\", copied: \"Copied\", streaming: \"Findings are arriving\", noFindings: \"No finding.\",\n};\n\nexport default function AnalysisReportLeaseReview() {\n return (\n <AnalysisReport\n labels={labels}\n title=\"Lease review\"\n summary=\"One clause goes against the Civil Code; two others are worth a second look.\"\n status=\"inconsistent\"\n folded={[\"consistent\", \"unverified\"]}\n provenanceFolded\n hideActions\n findings={[\n { id: \"1\", status: \"inconsistent\", title: \"Deposit requested\", quote: \"The tenant pays a deposit of one month's rent on signing.\", reference: { label: \"C.c.Q., art. 1904, al. 1\", href: \"https://www.legisquebec.gouv.qc.ca/en/document/cs/CCQ-1991\" }, location: \"clause 6\" },\n { id: \"2\", status: \"attention\", title: \"Notice to change the rent\", quote: \"The landlord may revise the rent with a notice of 30 days.\", reference: { label: \"C.c.Q., art. 1942\" }, location: \"clause 9\" },\n { id: \"3\", status: \"consistent\", title: \"Term of the lease\", quote: \"The lease runs for twelve months from July 1.\", reference: { label: \"C.c.Q., art. 1851\" } },\n { id: \"4\", status: \"unverified\", title: \"Parking space\", observation: \"The lease does not mention a parking space.\" },\n ]}\n limits={[\"The building's by-laws were not provided.\"]}\n nextSteps={[\"Ask the landlord to remove the deposit clause.\"]}\n provenance={{ model: \"lease-rules\", runId: \"run_5c20be\", version: \"2026.11\" }}\n />\n );\n}\n"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "long-address",
|
|
206
|
+
"title": "A long unbroken token",
|
|
207
|
+
"description": "An address, a URL or an identifier with no space wraps in the finding text, the quote and the reference at phone width.",
|
|
208
|
+
"path": "examples/analysis-report/long-address.tsx",
|
|
209
|
+
"module": "@krizaka/ui/registry/examples/analysis-report/long-address",
|
|
210
|
+
"code": "import { AnalysisReport, type AnalysisReportLabels } from \"@krizaka/ui/analysis-report\";\n\n// The words come from the app's messages (demo wording here).\nconst labels: AnalysisReportLabels = {\n status: { inconsistent: \"Fails\", attention: \"Check\", unverified: \"Unknown\", consistent: \"Passes\" },\n findings: \"Results\", mayIndicate: \"Could mean\", location: \"At:\", evidence: \"Proof\", details: \"More\",\n limits: \"Not examined\", nextSteps: \"What to do\", provenance: \"Origin\",\n model: \"Rules\", runId: \"Id\", duration: \"Time\", version: \"Build\",\n copyJson: \"JSON\", copyMarkdown: \"Markdown\", copied: \"Done\", streaming: \"Loading\", noFindings: \"Nothing.\",\n};\n\n\nconst address = \"1234-rue-Sainte-Catherine-Ouest-appartement-5-Montreal-Quebec-H3B1A7-Canada-adresse-du-logement-loue-sans-espace-ni-tiret-final\";\n\n// A token with no space (an address, a URL, an identifier) wraps inside the card instead of leaving the screen.\nexport default function AnalysisReportLongAddress() {\n return (\n <AnalysisReport\n labels={labels}\n title=\"Lease review\"\n summary=\"The address of the dwelling is read as one long token.\"\n status=\"attention\"\n hideActions\n findings={[{ id: \"1\", status: \"attention\", title: \"Address to confirm\", observation: address, quote: address, reference: { label: address } }]}\n />\n );\n}\n"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "authenticity",
|
|
214
|
+
"title": "An authenticity check",
|
|
215
|
+
"description": "Three levels (authentic, doubtful, altered) mapped to the existing statuses, quoted passages, the calm group folded.",
|
|
216
|
+
"path": "examples/analysis-report/authenticity.tsx",
|
|
217
|
+
"module": "@krizaka/ui/registry/examples/analysis-report/authenticity",
|
|
218
|
+
"code": "import { AnalysisReport, type AnalysisReportLabels } from \"@krizaka/ui/analysis-report\";\n\n// The words come from the app's messages (demo wording here).\nconst labels: AnalysisReportLabels = {\n status: { inconsistent: \"Altered\", attention: \"Doubtful\", unverified: \"Not checked\", consistent: \"Authentic\" },\n findings: \"Signs found\", mayIndicate: \"Could mean\", location: \"Seen at:\", evidence: \"Raw data\", details: \"More\",\n limits: \"Outside this check\", nextSteps: \"What to do\", provenance: \"Where this comes from\",\n model: \"Rules\", runId: \"Run id\", duration: \"Took\", version: \"Rules version\",\n copyJson: \"Copy as JSON\", copyMarkdown: \"Copy as Markdown\", copied: \"Copied\", streaming: \"Signs are arriving\", noFindings: \"No sign found.\",\n};\n\n// Three levels of authenticity map to the existing statuses: authentic → consistent, doubtful → attention, altered → inconsistent.\nexport default function AnalysisReportAuthenticity() {\n return (\n <AnalysisReport\n labels={labels}\n title=\"Authenticity check\"\n summary=\"The pay stub shows one sign of alteration and one doubtful detail.\"\n status=\"inconsistent\"\n folded={[\"consistent\"]}\n provenanceFolded\n hideActions\n findings={[\n { id: \"1\", status: \"inconsistent\", title: \"Amount edited\", quote: \"Net pay: 2 480,00 $\", observation: \"The digits sit on a different background than the line around them.\", mayIndicate: \"A retouched figure. Not proof of fraud.\", location: \"page 1\" },\n { id: \"2\", status: \"attention\", title: \"Employer name spacing\", quote: \"Atelier Dumont inc.\", location: \"header\" },\n { id: \"3\", status: \"consistent\", title: \"File history\", observation: \"One save, by the issuing software.\" },\n ]}\n limits={[\"The employer was not contacted.\"]}\n nextSteps={[\"Ask for the original from the employer.\"]}\n provenance={{ model: \"authenticity-rules\", runId: \"run_77d1a0\", version: \"1.0.0\" }}\n />\n );\n}\n"
|
|
219
|
+
},
|
|
180
220
|
{
|
|
181
221
|
"name": "streaming",
|
|
182
222
|
"title": "While the run is open",
|
|
@@ -317,19 +357,19 @@
|
|
|
317
357
|
"files": [
|
|
318
358
|
{
|
|
319
359
|
"path": "analysis-report/analysis-report.tsx",
|
|
320
|
-
"content": "// Client (the copy buttons, the folds). The result of an AI analysis, read in five seconds then deeper on demand: a header\n// (studio, one sentence, overall status, counts), findings grouped by status (the most serious first), the limits and the\n// next steps as a calm two-column section, a provenance footer, and copy as JSON / Markdown. Words arrive as props.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { Badge } from \"../badge/badge\";\nimport { Button } from \"../button/button\";\nimport {\n type AnalysisExport,\n type AnalysisFinding,\n type AnalysisReportData,\n type AnalysisReportLabels,\n type AnalysisStatus,\n countByStatus,\n exportReport,\n groupFindings,\n} from \"./model\";\n\nexport const analysisReportStyles = tv({\n slots: {\n root: \"flex w-full flex-col gap-6 text-fg\",\n header: \"flex items-start gap-4\",\n headText: \"flex min-w-0 flex-1 flex-col gap-2\",\n title: \"font-display text-xl font-bold tracking-tight text-fg\",\n summary: \"text-base text-fg-secondary\",\n counts: \"flex flex-wrap items-center gap-2\",\n actions: \"flex flex-wrap gap-2\",\n group: \"flex flex-col gap-3\",\n groupTitle: \"text-sm font-semibold text-fg-secondary\",\n list: \"flex flex-col gap-3\",\n finding: \"flex min-w-0 flex-col gap-2 rounded-lg border border-border-default bg-surface-1 p-4\",\n findingHead: \"flex flex-wrap items-center gap-2\",\n code: \"font-mono text-xs text-fg-secondary\",\n findingTitle: \"text-base font-semibold text-fg\",\n muted: \"text-sm text-fg-secondary\",\n locate: \"w-fit\",\n fold: \"text-sm text-fg-secondary\",\n evidence: \"mt-2 overflow-x-auto rounded-md border border-border-default bg-surface-2 p-3 font-mono text-xs text-fg focus-visible:focus-ring\",\n foldSummary: \"w-fit cursor-pointer rounded-sm font-semibold text-fg-accent focus-visible:focus-ring\",\n columns: \"grid gap-6 border-t border-border-default pt-6 @lg:grid-cols-2\",\n column: \"flex flex-col gap-2\",\n columnTitle: \"text-sm font-semibold text-fg\",\n items: \"flex list-disc flex-col gap-1 pl-5 text-sm text-fg-secondary\",\n provenance: \"flex flex-wrap gap-x-6 gap-y-1 border-t border-border-default pt-4 text-xs text-fg-secondary\",\n term: \"font-semibold text-fg\",\n live: \"text-sm text-fg-secondary\",\n },\n});\n\nconst TONE = { inconsistent: \"danger\", attention: \"warning\", unverified: \"neutral\", consistent: \"success\" } as const satisfies Record<AnalysisStatus, string>;\n\nexport type AnalysisReportProps = Omit<React.ComponentProps<\"section\">, \"title\" | \"children\"> &\n AnalysisReportData & {\n /** Every word the report prints, passed translated (statuses, section titles, buttons). */\n labels: AnalysisReportLabels;\n /** The pack's bird (a mark of `@krizaka/ui/mascots`), shown beside the studio's name. */\n mark?: React.ReactNode;\n /** Findings are still arriving: the list is announced politely and marked busy. */\n streaming?: boolean;\n /** Makes a finding's location a button (scroll a document viewer to it). */\n onLocate?: (finding: AnalysisFinding) => void;\n /** Called after the report is copied (`json` or `markdown`), with the copied text. Without a clipboard, the app can copy it here. */\n onCopy?: (kind: AnalysisExport, text: string) => void;\n /** Hides the copy buttons (a read-only embed). */\n hideActions?: boolean;\n };\n\nfunction FindingCard({ finding, labels, onLocate }: { finding: AnalysisFinding; labels: AnalysisReportLabels; onLocate?: AnalysisReportProps[\"onLocate\"] }) {\n const s = analysisReportStyles();\n return (\n <li className={s.finding()}>\n <div className={s.findingHead()}>\n <Badge tone={TONE[finding.status]} dot>\n {labels.status[finding.status]}\n </Badge>\n {finding.code ? <span className={s.code()}>{finding.code}</span> : null}\n </div>\n <h4 className={s.findingTitle()}>{finding.title}</h4>\n {finding.observation ? <p className={s.muted()}>{finding.observation}</p> : null}\n {finding.mayIndicate ? (\n <p className={s.muted()}>\n <span className={s.term()}>{labels.mayIndicate}</span> {finding.mayIndicate}\n </p>\n ) : null}\n {finding.location ? (\n onLocate ? (\n <Button variant=\"ghost\" size=\"sm\" className={s.locate()} onClick={() => onLocate(finding)}>\n {labels.location} {finding.location}\n </Button>\n ) : (\n <p className={s.muted()}>\n <span className={s.term()}>{labels.location}</span> {finding.location}\n </p>\n )\n ) : null}\n {finding.evidence ? (\n <details className={s.fold()}>\n <summary className={s.foldSummary()}>{labels.evidence}</summary>\n <pre tabIndex={0} className={s.evidence()}>\n <code>{finding.evidence}</code>\n </pre>\n </details>\n ) : null}\n </li>\n );\n}\n\nfunction TextColumn({ title, items }: { title: string; items: readonly string[] | undefined }) {\n const s = analysisReportStyles();\n if (!items?.length) return null;\n return (\n <section className={s.column()}>\n <h3 className={s.columnTitle()}>{title}</h3>\n <ul className={s.items()}>\n {items.map((i) => (\n <li key={i}>{i}</li>\n ))}\n </ul>\n </section>\n );\n}\n\nfunction Provenance({ data, labels }: { data: NonNullable<AnalysisReportData[\"provenance\"]>; labels: AnalysisReportLabels }) {\n const s = analysisReportStyles();\n const rows = [\n [labels.model, data.model],\n [labels.runId, data.runId],\n [labels.duration, data.duration],\n [labels.version, data.version],\n ].filter((r): r is [string, string] => Boolean(r[1]));\n if (!rows.length) return null;\n return (\n <dl aria-label={labels.provenance} className={s.provenance()}>\n {rows.map(([k, v]) => (\n <div key={k} className=\"flex gap-1.5\">\n <dt className={s.term()}>{k}</dt>\n <dd className=\"font-mono\">{v}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\n/** The result of an AI analysis: summary, findings by status, limits, next steps, provenance, copy as JSON or Markdown. */\nexport function AnalysisReport({ title, summary, status, findings, limits, nextSteps, provenance, labels, mark, streaming, onLocate, onCopy, hideActions, className, ...props }: AnalysisReportProps) {\n const s = analysisReportStyles();\n const [copied, setCopied] = React.useState<AnalysisExport | null>(null);\n const report: AnalysisReportData = { title, summary, status, findings, limits, nextSteps, provenance };\n const counts = countByStatus(findings);\n const heading = React.useId();\n const copy = (kind: AnalysisExport) => {\n const text = exportReport(kind, report, labels);\n void navigator.clipboard?.writeText(text).then(() => setCopied(kind));\n onCopy?.(kind, text);\n };\n return (\n <section aria-labelledby={heading} aria-busy={streaming || undefined} className={s.root({ className })} {...props}>\n <header className={s.header()}>\n {mark}\n <div className={s.headText()}>\n <h2 id={heading} className={s.title()}>\n {title}\n </h2>\n <p className={s.summary()}>{summary}</p>\n <div className={s.counts()}>\n <Badge tone={TONE[status]} size=\"md\" dot>\n {labels.status[status]}\n </Badge>\n {(Object.keys(counts) as AnalysisStatus[])\n .filter((k) => counts[k] > 0)\n .map((k) => (\n <Badge key={k} tone={TONE[k]}>\n {counts[k]} {labels.status[k]}\n </Badge>\n ))}\n </div>\n </div>\n {hideActions ? null : (\n <div className={s.actions()}>\n <Button variant=\"outline\" size=\"sm\" onClick={() => copy(\"json\")}>\n {labels.copyJson}\n </Button>\n <Button variant=\"outline\" size=\"sm\" onClick={() => copy(\"markdown\")}>\n {labels.copyMarkdown}\n </Button>\n </div>\n )}\n </header>\n <p role=\"status\" className=\"sr-only\">\n {copied ? labels.copied : streaming ? labels.streaming : \"\"}\n </p>\n <div aria-live={streaming ? \"polite\" : undefined} className=\"flex flex-col gap-6\">\n {findings.length === 0 && !streaming ? <p className={s.live()}>{labels.noFindings}</p> : null}\n {groupFindings(findings).map((g) => (\n <section key={g.status} className={s.group()} aria-label={`${labels.findings}: ${labels.status[g.status]}`}>\n <h3 className={s.groupTitle()}>\n {labels.status[g.status]} · {g.findings.length}\n </h3>\n <ul className={s.list()}>\n {g.findings.map((f) => (\n <FindingCard key={f.id} finding={f} labels={labels} onLocate={onLocate} />\n ))}\n </ul>\n </section>\n ))}\n </div>\n {limits?.length || nextSteps?.length ? (\n <div className=\"@container\">\n <div className={s.columns()}>\n <TextColumn title={labels.limits} items={limits} />\n <TextColumn title={labels.nextSteps} items={nextSteps} />\n </div>\n </div>\n ) : null}\n {provenance ? <Provenance data={provenance} labels={labels} /> : null}\n </section>\n );\n}\n"
|
|
360
|
+
"content": "// Client (the copy buttons, the folds). The result of an AI analysis, read in five seconds then deeper on demand: a header\n// (studio, one sentence, overall status, counts), findings grouped by status (the most serious first), the limits and the\n// next steps as a calm two-column section, a provenance footer, and copy as JSON / Markdown. Words arrive as props.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { Badge } from \"../badge/badge\";\nimport { Button } from \"../button/button\";\nimport {\n type AnalysisExport,\n type AnalysisFinding,\n type AnalysisReportData,\n type AnalysisReportLabels,\n type AnalysisStatus,\n countByStatus,\n exportReport,\n groupFindings,\n} from \"./model\";\n\nexport const analysisReportStyles = tv({\n slots: {\n root: \"flex w-full min-w-0 flex-col gap-6 wrap-anywhere text-fg\",\n header: \"flex items-start gap-4\",\n headText: \"flex min-w-0 flex-1 flex-col gap-2\",\n title: \"font-display text-xl font-bold tracking-tight text-fg\",\n summary: \"text-base text-fg-secondary\",\n counts: \"flex flex-wrap items-center gap-2\",\n actions: \"flex flex-wrap gap-2\",\n group: \"flex flex-col gap-3\",\n groupTitle: \"text-sm font-semibold text-fg-secondary\",\n list: \"flex flex-col gap-3\",\n finding: \"flex min-w-0 flex-col wrap-anywhere gap-2 rounded-lg border border-border-default bg-surface-1 p-4\",\n findingHead: \"flex flex-wrap items-center gap-2\",\n code: \"font-mono text-xs text-fg-secondary\",\n findingTitle: \"text-base font-semibold text-fg\",\n muted: \"text-sm text-fg-secondary\",\n locate: \"w-fit\",\n fold: \"text-sm text-fg-secondary\",\n quote: \"m-0 wrap-anywhere text-sm text-fg-secondary\",\n reference: \"w-fit max-w-full wrap-anywhere text-sm font-semibold text-fg-accent\",\n referenceLink: \"rounded-sm underline underline-offset-2 focus-visible:focus-ring\",\n evidence: \"mt-2 overflow-x-auto rounded-md border border-border-default bg-surface-2 p-3 font-mono text-xs text-fg focus-visible:focus-ring\",\n foldSummary: \"w-fit cursor-pointer rounded-sm font-semibold text-fg-accent focus-visible:focus-ring\",\n columns: \"grid gap-6 border-t border-border-default pt-6 @lg:grid-cols-2\",\n column: \"flex flex-col gap-2\",\n columnTitle: \"text-sm font-semibold text-fg\",\n items: \"flex min-w-0 list-disc wrap-anywhere flex-col gap-1 pl-5 text-sm text-fg-secondary\",\n provenance: \"flex flex-wrap gap-x-6 gap-y-1 border-t border-border-default pt-4 text-xs text-fg-secondary\",\n provenanceFold: \"border-t border-border-default pt-4 text-xs text-fg-secondary\",\n provenanceList: \"mt-2 flex flex-wrap gap-x-6 gap-y-1\",\n term: \"font-semibold text-fg\",\n live: \"text-sm text-fg-secondary\",\n },\n});\n\nconst TONE = { inconsistent: \"danger\", attention: \"warning\", unverified: \"neutral\", consistent: \"success\" } as const satisfies Record<AnalysisStatus, string>;\n\nexport type AnalysisReportProps = Omit<React.ComponentProps<\"section\">, \"title\" | \"children\"> &\n AnalysisReportData & {\n /** Every word the report prints, passed translated (statuses, section titles, buttons). */\n labels: AnalysisReportLabels;\n /** The pack's bird (a mark of `@krizaka/ui/mascots`), shown beside the studio's name. */\n mark?: React.ReactNode;\n /** Findings are still arriving: the list is announced politely and marked busy. */\n streaming?: boolean;\n /** Makes a finding's location a button (scroll a document viewer to it). */\n onLocate?: (finding: AnalysisFinding) => void;\n /** Called after the report is copied (`json` or `markdown`), with the copied text. Without a clipboard, the app can copy it here. */\n onCopy?: (kind: AnalysisExport, text: string) => void;\n /** Hides the copy buttons (a read-only embed). */\n hideActions?: boolean;\n /** Status groups closed by default (a native `details`, the count in its summary): « respected », « not applicable ». */\n folded?: readonly AnalysisStatus[];\n /** The provenance (run id, ruleset, version) in one closed fold, titled `labels.provenance`. */\n provenanceFolded?: boolean;\n };\n\nfunction FindingCard({ finding, labels, onLocate }: { finding: AnalysisFinding; labels: AnalysisReportLabels; onLocate?: AnalysisReportProps[\"onLocate\"] }) {\n const s = analysisReportStyles();\n return (\n <li className={s.finding()}>\n <div className={s.findingHead()}>\n <Badge tone={TONE[finding.status]} dot>\n {labels.status[finding.status]}\n </Badge>\n {finding.code ? <span className={s.code()}>{finding.code}</span> : null}\n </div>\n <h4 className={s.findingTitle()}>{finding.title}</h4>\n {finding.observation ? <p className={s.muted()}>{finding.observation}</p> : null}\n {finding.mayIndicate ? (\n <p className={s.muted()}>\n <span className={s.term()}>{labels.mayIndicate}</span> {finding.mayIndicate}\n </p>\n ) : null}\n {finding.quote ? <p className={s.quote()}>« {finding.quote} »</p> : null}\n {finding.reference ? (\n <p className={s.reference()}>\n {finding.reference.href ? (\n <a href={finding.reference.href} className={s.referenceLink()}>\n {finding.reference.label}\n </a>\n ) : (\n finding.reference.label\n )}\n </p>\n ) : null}\n {finding.location ? (\n onLocate ? (\n <Button variant=\"ghost\" size=\"sm\" className={s.locate()} onClick={() => onLocate(finding)}>\n {labels.location} {finding.location}\n </Button>\n ) : (\n <p className={s.muted()}>\n <span className={s.term()}>{labels.location}</span> {finding.location}\n </p>\n )\n ) : null}\n {finding.evidence ? (\n <details className={s.fold()}>\n <summary className={s.foldSummary()}>{labels.evidence}</summary>\n <pre tabIndex={0} className={s.evidence()}>\n <code>{finding.evidence}</code>\n </pre>\n </details>\n ) : null}\n </li>\n );\n}\n\nfunction TextColumn({ title, items }: { title: string; items: readonly string[] | undefined }) {\n const s = analysisReportStyles();\n if (!items?.length) return null;\n return (\n <section className={s.column()}>\n <h3 className={s.columnTitle()}>{title}</h3>\n <ul className={s.items()}>\n {items.map((i) => (\n <li key={i}>{i}</li>\n ))}\n </ul>\n </section>\n );\n}\n\nfunction Provenance({ data, labels, folded }: { data: NonNullable<AnalysisReportData[\"provenance\"]>; labels: AnalysisReportLabels; folded?: boolean }) {\n const s = analysisReportStyles();\n const rows = [\n [labels.model, data.model],\n [labels.runId, data.runId],\n [labels.duration, data.duration],\n [labels.version, data.version],\n ].filter((r): r is [string, string] => Boolean(r[1]));\n if (!rows.length) return null;\n const list = (\n <dl aria-label={folded ? undefined : labels.provenance} className={folded ? s.provenanceList() : s.provenance()}>\n {rows.map(([k, v]) => (\n <div key={k} className=\"flex min-w-0 gap-1.5\">\n <dt className={s.term()}>{k}</dt>\n <dd className=\"min-w-0 break-all font-mono\">{v}</dd>\n </div>\n ))}\n </dl>\n );\n if (!folded) return list;\n return (\n <details className={s.provenanceFold()}>\n <summary className={s.foldSummary()}>{labels.provenance}</summary>\n {list}\n </details>\n );\n}\n\n/** The result of an AI analysis: summary, findings by status, limits, next steps, provenance, copy as JSON or Markdown. */\nexport function AnalysisReport({ title, summary, status, findings, limits, nextSteps, provenance, labels, mark, streaming, onLocate, onCopy, hideActions, folded, provenanceFolded, className, ...props }: AnalysisReportProps) {\n const s = analysisReportStyles();\n const [copied, setCopied] = React.useState<AnalysisExport | null>(null);\n const report: AnalysisReportData = { title, summary, status, findings, limits, nextSteps, provenance };\n const counts = countByStatus(findings);\n const heading = React.useId();\n const copy = (kind: AnalysisExport) => {\n const text = exportReport(kind, report, labels);\n void navigator.clipboard?.writeText(text).then(() => setCopied(kind));\n onCopy?.(kind, text);\n };\n return (\n <section aria-labelledby={heading} aria-busy={streaming || undefined} className={s.root({ className })} {...props}>\n <header className={s.header()}>\n {mark}\n <div className={s.headText()}>\n <h2 id={heading} className={s.title()}>\n {title}\n </h2>\n <p className={s.summary()}>{summary}</p>\n <div className={s.counts()}>\n <Badge tone={TONE[status]} size=\"md\" dot>\n {labels.status[status]}\n </Badge>\n {(Object.keys(counts) as AnalysisStatus[])\n .filter((k) => counts[k] > 0)\n .map((k) => (\n <Badge key={k} tone={TONE[k]}>\n {counts[k]} {labels.status[k]}\n </Badge>\n ))}\n </div>\n </div>\n {hideActions ? null : (\n <div className={s.actions()}>\n <Button variant=\"outline\" size=\"sm\" onClick={() => copy(\"json\")}>\n {labels.copyJson}\n </Button>\n <Button variant=\"outline\" size=\"sm\" onClick={() => copy(\"markdown\")}>\n {labels.copyMarkdown}\n </Button>\n </div>\n )}\n </header>\n <p role=\"status\" className=\"sr-only\">\n {copied ? labels.copied : streaming ? labels.streaming : \"\"}\n </p>\n <div aria-live={streaming ? \"polite\" : undefined} className=\"flex flex-col gap-6\">\n {findings.length === 0 && !streaming ? <p className={s.live()}>{labels.noFindings}</p> : null}\n {groupFindings(findings).map((g) => {\n const title = `${labels.status[g.status]} · ${g.findings.length}`;\n const list = (\n <ul className={s.list()}>\n {g.findings.map((f) => (\n <FindingCard key={f.id} finding={f} labels={labels} onLocate={onLocate} />\n ))}\n </ul>\n );\n return folded?.includes(g.status) ? (\n <details key={g.status} className={s.group()} aria-label={`${labels.findings}: ${labels.status[g.status]}`}>\n <summary className={s.foldSummary()}>{title}</summary>\n <div className=\"mt-3\">{list}</div>\n </details>\n ) : (\n <section key={g.status} className={s.group()} aria-label={`${labels.findings}: ${labels.status[g.status]}`}>\n <h3 className={s.groupTitle()}>{title}</h3>\n {list}\n </section>\n );\n })}\n </div>\n {limits?.length || nextSteps?.length ? (\n <div className=\"@container\">\n <div className={s.columns()}>\n <TextColumn title={labels.limits} items={limits} />\n <TextColumn title={labels.nextSteps} items={nextSteps} />\n </div>\n </div>\n ) : null}\n {provenance ? <Provenance data={provenance} labels={labels} folded={provenanceFolded} /> : null}\n </section>\n );\n}\n"
|
|
321
361
|
},
|
|
322
362
|
{
|
|
323
363
|
"path": "analysis-report/index.ts",
|
|
324
|
-
"content": "/** @krizaka/ui/analysis-report — `AnalysisReport`, the result of an AI analysis (summary, findings, limits, next steps, provenance, copy as JSON / Markdown), and its rules. Client. */\nexport { AnalysisReport, type AnalysisReportProps, analysisReportStyles } from \"./analysis-report\";\nexport {\n ANALYSIS_STATUSES,\n type AnalysisExport,\n type AnalysisFinding,\n type AnalysisProvenance,\n type AnalysisReportData,\n type AnalysisReportLabels,\n type AnalysisStatus,\n countByStatus,\n exportReport,\n groupFindings,\n reportToJson,\n reportToMarkdown,\n} from \"./model\";\n"
|
|
364
|
+
"content": "/** @krizaka/ui/analysis-report — `AnalysisReport`, the result of an AI analysis (summary, findings, limits, next steps, provenance, copy as JSON / Markdown), and its rules. Client. */\nexport { AnalysisReport, type AnalysisReportProps, analysisReportStyles } from \"./analysis-report\";\nexport {\n ANALYSIS_STATUSES,\n type AnalysisExport,\n type AnalysisFinding,\n type AnalysisProvenance,\n type AnalysisReference,\n type AnalysisReportData,\n type AnalysisReportLabels,\n type AnalysisStatus,\n countByStatus,\n exportReport,\n groupFindings,\n reportToJson,\n reportToMarkdown,\n} from \"./model\";\n"
|
|
325
365
|
},
|
|
326
366
|
{
|
|
327
367
|
"path": "analysis-report/meta.ts",
|
|
328
|
-
"content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Analysis report\",\n summary:\n \"The result of an AI analysis, honest and calm: one sentence and an overall status, findings grouped by status with what was observed and what it may indicate, what the report did not examine, the next steps and where the result comes from.\",\n status: \"beta\",\n category: \"blocks\",\n domain: \"conversation\",\n platforms: \"both\",\n parity: { desktop: \"web\" },\n whenToUse: [\n \"Showing what an Sovkora analysis found in a document, a lease, an identity check or a moderated item, in any product.\",\n \"Any result that has findings of different gravity, a list of limits and a provenance the reader may need to cite.\",\n ],\n whenNotToUse: [\n { when: \"A single yes / no outcome with no findings.\", use: \"alert\" },\n { when: \"A chat answer that streams as prose.\", use: \"chat\" },\n { when: \"A log of what happened in order.\", use: \"activity-feed\" },\n ],\n bestPractices: [\n \"Order is the point: the most serious group comes first, then the calmer ones; never sort by code.\",\n \"Keep « may indicate » honest: it carries the caveat (« not proof of tampering »), never a verdict.\",\n \"Say what the report did not examine, in the same weight as the findings; the limits are part of the result.\",\n \"Pass every word through `labels` from your messages (`@krizaka/i18n`); the package ships none.\",\n \"While the run is open, set `streaming`: findings are announced politely as they arrive.\",\n \"Give `onLocate` to scroll a document viewer to a finding's place; without it the location is plain text.\",\n \"Examples and tests use demo data only.\",\n ],\n accessibility: {\n keyboard: [{ keys: \"Tab / Enter\", action: \"Reaches the copy buttons, the locations and the
|
|
368
|
+
"content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Analysis report\",\n summary:\n \"The result of an AI analysis, honest and calm: one sentence and an overall status, findings grouped by status with what was observed and what it may indicate, what the report did not examine, the next steps and where the result comes from.\",\n status: \"beta\",\n category: \"blocks\",\n domain: \"conversation\",\n platforms: \"both\",\n parity: { desktop: \"web\" },\n whenToUse: [\n \"Showing what an Sovkora analysis found in a document, a lease, an identity check or a moderated item, in any product.\",\n \"Any result that has findings of different gravity, a list of limits and a provenance the reader may need to cite.\",\n ],\n whenNotToUse: [\n { when: \"A single yes / no outcome with no findings.\", use: \"alert\" },\n { when: \"A chat answer that streams as prose.\", use: \"chat\" },\n { when: \"A log of what happened in order.\", use: \"activity-feed\" },\n ],\n bestPractices: [\n \"Order is the point: the most serious group comes first, then the calmer ones; never sort by code.\",\n \"Keep « may indicate » honest: it carries the caveat (« not proof of tampering »), never a verdict.\",\n \"Say what the report did not examine, in the same weight as the findings; the limits are part of the result.\",\n \"Pass every word through `labels` from your messages (`@krizaka/i18n`); the package ships none.\",\n \"While the run is open, set `streaming`: findings are announced politely as they arrive.\",\n \"Give `onLocate` to scroll a document viewer to a finding's place; without it the location is plain text.\",\n \"Quote the passage the finding rests on (`quote`) and cite the rule (`reference`, with an `href` when it is public): the reader checks the source without opening the document.\",\n \"Fold the calm groups (`folded`) and the provenance (`provenanceFolded`): the serious findings stay in view, the rest is one tap away.\",\n \"Examples and tests use demo data only.\",\n ],\n accessibility: {\n keyboard: [{ keys: \"Tab / Enter\", action: \"Reaches the copy buttons, the locations, the references and the folds; Enter or Space opens a fold.\" }],\n notes: [\n \"A section named by the studio's title; each status group is a labelled section with a heading, each finding a list item.\",\n \"A status is always a word with its dot, never a colour alone.\",\n \"The copy result and the streaming state are said in a polite status region; the list is `aria-busy` while streaming.\",\n \"The evidence is a native `details`: it works without script and keeps the focus on its summary.\",\n ],\n },\n related: [\"badge\", \"decision-list\", \"mascot-quote\", \"alert\"],\n web: {\n imports: [\"AnalysisReport\", \"groupFindings\", \"countByStatus\", \"reportToMarkdown\", \"reportToJson\"],\n examples: [\n { name: \"document-validation\", title: \"A document validation\", description: \"Header, findings grouped by status, limits and next steps in two columns, provenance, copy as JSON or Markdown.\" },\n { name: \"lease-review\", title: \"A lease review\", description: \"Each finding quotes the passage and cites its article of law; the respected and unverified groups and the provenance are folded.\" },\n { name: \"long-address\", title: \"A long unbroken token\", description: \"An address, a URL or an identifier with no space wraps in the finding text, the quote and the reference at phone width.\" },\n { name: \"authenticity\", title: \"An authenticity check\", description: \"Three levels (authentic, doubtful, altered) mapped to the existing statuses, quoted passages, the calm group folded.\" },\n { name: \"streaming\", title: \"While the run is open\", description: \"`streaming` marks the report busy and announces each finding as it arrives; the copy actions are hidden.\" },\n ],\n },\n native: {\n imports: [\"AnalysisReport\"],\n differences: [\n \"There is no clipboard in the package: `onCopy` receives the text and the app copies it.\",\n \"The evidence unfolds in place (a pressable summary) instead of a native `details`.\",\n ],\n examples: [{ name: \"document-validation\", title: \"A document validation\", description: \"The same report on the phone: findings by status, limits, next steps.\" }],\n },\n} satisfies ComponentMeta;\n"
|
|
329
369
|
},
|
|
330
370
|
{
|
|
331
371
|
"path": "analysis-report/model.ts",
|
|
332
|
-
"content": "// The rules of an analysis report, shared by the web entry and tested alone: the order of the statuses, the grouping of the\n// findings (the most serious first), the counts, and the two exports (JSON, Markdown). No words of its own: the labels arrive.\n\n/** How a finding or a whole report reads, from the most serious to the calmest. */\nexport const ANALYSIS_STATUSES = [\"inconsistent\", \"attention\", \"unverified\", \"consistent\"] as const;\nexport type AnalysisStatus = (typeof ANALYSIS_STATUSES)[number];\n\nexport type AnalysisFinding = {\n id: string;\n status: AnalysisStatus;\n /** The rule's identifier, in mono (`PDF-META-002`). */\n code?: string;\n title: string;\n /** What was observed. */\n observation?: string;\n /** What it may indicate, with its honest caveat. */\n mayIndicate?: string;\n /** Where in the document: « metadata », « page 3 ». `onLocate` receives the finding. */\n location?: string;\n /** The raw evidence, shown in a code block. */\n evidence?: string;\n};\n\nexport type AnalysisProvenance = { model?: string; runId?: string; duration?: string; version?: string };\n\nexport type AnalysisReportData = {\n /** The studio's name (« Document validation »). */\n title: string;\n /** One sentence: the answer. */\n summary: string;\n /** The overall status of the report. */\n status: AnalysisStatus;\n /** The findings, in any order: the report groups them by status, the most serious first. */\n findings: readonly AnalysisFinding[];\n /** « What this report did not examine ». */\n limits?: readonly string[];\n /** What to do next, one step per item. */\n nextSteps?: readonly string[];\n /** Where the result comes from: model, run id, duration, version. */\n provenance?: AnalysisProvenance;\n};\n\n/** Every word the report prints, passed translated (the package ships none). */\nexport type AnalysisReportLabels = {\n status: Record<AnalysisStatus, string>;\n findings: string;\n mayIndicate: string;\n location: string;\n evidence: string;\n details: string;\n limits: string;\n nextSteps: string;\n provenance: string;\n model: string;\n runId: string;\n duration: string;\n version: string;\n copyJson: string;\n copyMarkdown: string;\n copied: string;\n /** Said while findings are still arriving. */\n streaming: string;\n /** Said when the report has no finding. */\n noFindings: string;\n};\n\nexport type AnalysisExport = \"json\" | \"markdown\";\n\n/** The findings grouped by status, the most serious group first; empty groups are left out. */\nexport function groupFindings(findings: readonly AnalysisFinding[]): { status: AnalysisStatus; findings: AnalysisFinding[] }[] {\n return ANALYSIS_STATUSES.map((status) => ({ status, findings: findings.filter((f) => f.status === status) })).filter((g) => g.findings.length > 0);\n}\n\n/** How many findings wear each status (zero included, so a count row is stable). */\nexport function countByStatus(findings: readonly AnalysisFinding[]): Record<AnalysisStatus, number> {\n const counts = { inconsistent: 0, attention: 0, unverified: 0, consistent: 0 } satisfies Record<AnalysisStatus, number>;\n for (const f of findings) counts[f.status] += 1;\n return counts;\n}\n\nexport function reportToJson(report: AnalysisReportData): string {\n return JSON.stringify(report, null, 2);\n}\n\nconst bullets = (items: readonly string[]) => items.map((i) => `- ${i}`);\n\nfunction findingLines(f: AnalysisFinding, labels: AnalysisReportLabels): string[] {\n const head = `### ${f.code ? `\\`${f.code}\\` · ` : \"\"}${f.title}`;\n return [\n head,\n ...(f.observation ? [\"\", f.observation] : []),\n ...(f.mayIndicate ? [\"\", `**${labels.mayIndicate}** ${f.mayIndicate}`] : []),\n ...(f.location ? [\"\", `**${labels.location}** ${f.location}`] : []),\n ...(f.evidence ? [\"\", \"```\", f.evidence, \"```\"] : []),\n \"\",\n ];\n}\n\nfunction provenanceLines(p: AnalysisProvenance | undefined, labels: AnalysisReportLabels): string[] {\n const rows: [string, string | undefined][] = [\n [labels.model, p?.model],\n [labels.runId, p?.runId],\n [labels.duration, p?.duration],\n [labels.version, p?.version],\n ];\n return rows.filter((r): r is [string, string] => Boolean(r[1])).map(([k, v]) => `- ${k}: ${v}`);\n}\n\n/** The report as Markdown, in the same order as the page. */\nexport function reportToMarkdown(report: AnalysisReportData, labels: AnalysisReportLabels): string {\n const sections: string[][] = [\n [`# ${report.title}`, \"\", `**${labels.status[report.status]}** — ${report.summary}`],\n ...groupFindings(report.findings).map((g) => [`## ${labels.status[g.status]}`, \"\", ...g.findings.flatMap((f) => findingLines(f, labels))]),\n ...(report.limits?.length ? [[`## ${labels.limits}`, \"\", ...bullets(report.limits)]] : []),\n ...(report.nextSteps?.length ? [[`## ${labels.nextSteps}`, \"\", ...bullets(report.nextSteps)]] : []),\n ...(provenanceLines(report.provenance, labels).length ? [[`## ${labels.provenance}`, \"\", ...provenanceLines(report.provenance, labels)]] : []),\n ];\n return sections.map((s) => s.join(\"\\n\").trimEnd()).join(\"\\n\\n\") + \"\\n\";\n}\n\n/** The text of an export. */\nexport function exportReport(kind: AnalysisExport, report: AnalysisReportData, labels: AnalysisReportLabels): string {\n return kind === \"json\" ? reportToJson(report) : reportToMarkdown(report, labels);\n}\n"
|
|
372
|
+
"content": "// The rules of an analysis report, shared by the web entry and tested alone: the order of the statuses, the grouping of the\n// findings (the most serious first), the counts, and the two exports (JSON, Markdown). No words of its own: the labels arrive.\n\n/** How a finding or a whole report reads, from the most serious to the calmest. */\nexport const ANALYSIS_STATUSES = [\"inconsistent\", \"attention\", \"unverified\", \"consistent\"] as const;\nexport type AnalysisStatus = (typeof ANALYSIS_STATUSES)[number];\n\nexport type AnalysisFinding = {\n id: string;\n status: AnalysisStatus;\n /** The rule's identifier, in mono (`PDF-META-002`). */\n code?: string;\n title: string;\n /** What was observed. */\n observation?: string;\n /** What it may indicate, with its honest caveat. */\n mayIndicate?: string;\n /** Where in the document: « metadata », « page 3 ». `onLocate` receives the finding. */\n location?: string;\n /** The raw evidence, shown in a code block. */\n evidence?: string;\n /** The passage of the document the finding rests on, shown as a « » line (prose, not code: `evidence` stays for code). */\n quote?: string;\n /** The article of law or rule the finding cites (« C.c.Q., art. 1904, al. 1 »); `href` makes it a link. */\n reference?: AnalysisReference;\n};\n\nexport type AnalysisReference = { label: string; href?: string };\n\nexport type AnalysisProvenance = { model?: string; runId?: string; duration?: string; version?: string };\n\nexport type AnalysisReportData = {\n /** The studio's name (« Document validation »). */\n title: string;\n /** One sentence: the answer. */\n summary: string;\n /** The overall status of the report. */\n status: AnalysisStatus;\n /** The findings, in any order: the report groups them by status, the most serious first. */\n findings: readonly AnalysisFinding[];\n /** « What this report did not examine ». */\n limits?: readonly string[];\n /** What to do next, one step per item. */\n nextSteps?: readonly string[];\n /** Where the result comes from: model, run id, duration, version. */\n provenance?: AnalysisProvenance;\n};\n\n/** Every word the report prints, passed translated (the package ships none). */\nexport type AnalysisReportLabels = {\n status: Record<AnalysisStatus, string>;\n findings: string;\n mayIndicate: string;\n location: string;\n evidence: string;\n details: string;\n limits: string;\n nextSteps: string;\n provenance: string;\n model: string;\n runId: string;\n duration: string;\n version: string;\n copyJson: string;\n copyMarkdown: string;\n copied: string;\n /** Said while findings are still arriving. */\n streaming: string;\n /** Said when the report has no finding. */\n noFindings: string;\n};\n\nexport type AnalysisExport = \"json\" | \"markdown\";\n\n/** The findings grouped by status, the most serious group first; empty groups are left out. */\nexport function groupFindings(findings: readonly AnalysisFinding[]): { status: AnalysisStatus; findings: AnalysisFinding[] }[] {\n return ANALYSIS_STATUSES.map((status) => ({ status, findings: findings.filter((f) => f.status === status) })).filter((g) => g.findings.length > 0);\n}\n\n/** How many findings wear each status (zero included, so a count row is stable). */\nexport function countByStatus(findings: readonly AnalysisFinding[]): Record<AnalysisStatus, number> {\n const counts = { inconsistent: 0, attention: 0, unverified: 0, consistent: 0 } satisfies Record<AnalysisStatus, number>;\n for (const f of findings) counts[f.status] += 1;\n return counts;\n}\n\nexport function reportToJson(report: AnalysisReportData): string {\n return JSON.stringify(report, null, 2);\n}\n\nconst bullets = (items: readonly string[]) => items.map((i) => `- ${i}`);\n\nfunction findingLines(f: AnalysisFinding, labels: AnalysisReportLabels): string[] {\n const head = `### ${f.code ? `\\`${f.code}\\` · ` : \"\"}${f.title}`;\n return [\n head,\n ...(f.observation ? [\"\", f.observation] : []),\n ...(f.mayIndicate ? [\"\", `**${labels.mayIndicate}** ${f.mayIndicate}`] : []),\n ...(f.quote ? [\"\", `> « ${f.quote} »`] : []),\n ...(f.reference ? [\"\", f.reference.href ? `[${f.reference.label}](${f.reference.href})` : f.reference.label] : []),\n ...(f.location ? [\"\", `**${labels.location}** ${f.location}`] : []),\n ...(f.evidence ? [\"\", \"```\", f.evidence, \"```\"] : []),\n \"\",\n ];\n}\n\nfunction provenanceLines(p: AnalysisProvenance | undefined, labels: AnalysisReportLabels): string[] {\n const rows: [string, string | undefined][] = [\n [labels.model, p?.model],\n [labels.runId, p?.runId],\n [labels.duration, p?.duration],\n [labels.version, p?.version],\n ];\n return rows.filter((r): r is [string, string] => Boolean(r[1])).map(([k, v]) => `- ${k}: ${v}`);\n}\n\n/** The report as Markdown, in the same order as the page. */\nexport function reportToMarkdown(report: AnalysisReportData, labels: AnalysisReportLabels): string {\n const sections: string[][] = [\n [`# ${report.title}`, \"\", `**${labels.status[report.status]}** — ${report.summary}`],\n ...groupFindings(report.findings).map((g) => [`## ${labels.status[g.status]}`, \"\", ...g.findings.flatMap((f) => findingLines(f, labels))]),\n ...(report.limits?.length ? [[`## ${labels.limits}`, \"\", ...bullets(report.limits)]] : []),\n ...(report.nextSteps?.length ? [[`## ${labels.nextSteps}`, \"\", ...bullets(report.nextSteps)]] : []),\n ...(provenanceLines(report.provenance, labels).length ? [[`## ${labels.provenance}`, \"\", ...provenanceLines(report.provenance, labels)]] : []),\n ];\n return sections.map((s) => s.join(\"\\n\").trimEnd()).join(\"\\n\\n\") + \"\\n\";\n}\n\n/** The text of an export. */\nexport function exportReport(kind: AnalysisExport, report: AnalysisReportData, labels: AnalysisReportLabels): string {\n return kind === \"json\" ? reportToJson(report) : reportToMarkdown(report, labels);\n}\n"
|
|
333
373
|
},
|
|
334
374
|
{
|
|
335
375
|
"path": "meta.ts",
|
|
@@ -387,6 +427,13 @@
|
|
|
387
427
|
"description": "The studio's name (« Document validation »).",
|
|
388
428
|
"required": true
|
|
389
429
|
},
|
|
430
|
+
{
|
|
431
|
+
"name": "folded",
|
|
432
|
+
"type": "readonly (\"inconsistent\" | \"attention\" | \"unverified\" | \"consistent\")[]",
|
|
433
|
+
"default": null,
|
|
434
|
+
"description": "Status groups closed by default (a native `details`, the count in its summary): « respected », « not applicable ».",
|
|
435
|
+
"required": false
|
|
436
|
+
},
|
|
390
437
|
{
|
|
391
438
|
"name": "hideActions",
|
|
392
439
|
"type": "boolean",
|
|
@@ -429,6 +476,13 @@
|
|
|
429
476
|
"description": "Where the result comes from: model, run id, duration, version.",
|
|
430
477
|
"required": false
|
|
431
478
|
},
|
|
479
|
+
{
|
|
480
|
+
"name": "provenanceFolded",
|
|
481
|
+
"type": "boolean",
|
|
482
|
+
"default": null,
|
|
483
|
+
"description": "The provenance (run id, ruleset, version) in one closed fold, titled `labels.provenance`.",
|
|
484
|
+
"required": false
|
|
485
|
+
},
|
|
432
486
|
{
|
|
433
487
|
"name": "streaming",
|
|
434
488
|
"type": "boolean",
|
package/registry/app-frame.json
CHANGED
|
@@ -15,7 +15,7 @@ function AccountSectionPatterns() {
|
|
|
15
15
|
] }),
|
|
16
16
|
/* @__PURE__ */ jsx(SettingsRow, { label: "Mot de passe", description: "Modifi\xE9 il y a 3 mois.", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "sm", children: "Changer" }) })
|
|
17
17
|
] }),
|
|
18
|
-
/* @__PURE__ */ jsx(SettingsSection, { variant: "flat", title: "Abonnement", description: "Votre forfait et vos factures.", children: /* @__PURE__ */ jsx(SettingsRow, { label: "Forfait Solo", description: "Renouvel\xE9 le 1er novembre.", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "sm", asChild: true, children: /* @__PURE__ */ jsx("a", { href: "https://
|
|
18
|
+
/* @__PURE__ */ jsx(SettingsSection, { variant: "flat", title: "Abonnement", description: "Votre forfait et vos factures.", children: /* @__PURE__ */ jsx(SettingsRow, { label: "Forfait Solo", description: "Renouvel\xE9 le 1er novembre.", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "sm", asChild: true, children: /* @__PURE__ */ jsx("a", { href: "https://example.com", children: "Ouvrir le portail de facturation" }) }) }) }),
|
|
19
19
|
/* @__PURE__ */ jsx(SettingsSection, { variant: "flat", title: "Stockage", description: "L'espace utilis\xE9 par vos documents.", children: /* @__PURE__ */ jsx(SettingsRow, { label: "Documents", children: /* @__PURE__ */ jsx(Meter, { className: "w-56", label: "Stockage", value: 18, max: 50, valueText: "18 Go sur 50 Go", showLabel: true }) }) }),
|
|
20
20
|
/* @__PURE__ */ jsxs(SettingsSection, { variant: "flat", title: "Mes donn\xE9es", description: "Ce que vous pouvez emporter ou effacer.", children: [
|
|
21
21
|
/* @__PURE__ */ jsx(SettingsRow, { label: "Exporter", description: "Une archive de tout ce que vous avez t\xE9l\xE9vers\xE9.", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "sm", children: "Demander l'export" }) }),
|
|
@@ -18,7 +18,7 @@ export default function AccountSectionPatterns() {
|
|
|
18
18
|
</SettingsSection>
|
|
19
19
|
<SettingsSection variant="flat" title="Abonnement" description="Votre forfait et vos factures.">
|
|
20
20
|
<SettingsRow label="Forfait Solo" description="Renouvelé le 1er novembre.">
|
|
21
|
-
<Button variant="secondary" size="sm" asChild><a href="https://
|
|
21
|
+
<Button variant="secondary" size="sm" asChild><a href="https://example.com">Ouvrir le portail de facturation</a></Button>
|
|
22
22
|
</SettingsRow>
|
|
23
23
|
</SettingsSection>
|
|
24
24
|
<SettingsSection variant="flat" title="Stockage" description="L'espace utilisé par vos documents.">
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/analysis-report/authenticity.tsx
|
|
4
|
+
import { AnalysisReport } from "@krizaka/ui/analysis-report";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var labels = {
|
|
7
|
+
status: { inconsistent: "Altered", attention: "Doubtful", unverified: "Not checked", consistent: "Authentic" },
|
|
8
|
+
findings: "Signs found",
|
|
9
|
+
mayIndicate: "Could mean",
|
|
10
|
+
location: "Seen at:",
|
|
11
|
+
evidence: "Raw data",
|
|
12
|
+
details: "More",
|
|
13
|
+
limits: "Outside this check",
|
|
14
|
+
nextSteps: "What to do",
|
|
15
|
+
provenance: "Where this comes from",
|
|
16
|
+
model: "Rules",
|
|
17
|
+
runId: "Run id",
|
|
18
|
+
duration: "Took",
|
|
19
|
+
version: "Rules version",
|
|
20
|
+
copyJson: "Copy as JSON",
|
|
21
|
+
copyMarkdown: "Copy as Markdown",
|
|
22
|
+
copied: "Copied",
|
|
23
|
+
streaming: "Signs are arriving",
|
|
24
|
+
noFindings: "No sign found."
|
|
25
|
+
};
|
|
26
|
+
function AnalysisReportAuthenticity() {
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
AnalysisReport,
|
|
29
|
+
{
|
|
30
|
+
labels,
|
|
31
|
+
title: "Authenticity check",
|
|
32
|
+
summary: "The pay stub shows one sign of alteration and one doubtful detail.",
|
|
33
|
+
status: "inconsistent",
|
|
34
|
+
folded: ["consistent"],
|
|
35
|
+
provenanceFolded: true,
|
|
36
|
+
hideActions: true,
|
|
37
|
+
findings: [
|
|
38
|
+
{ id: "1", status: "inconsistent", title: "Amount edited", quote: "Net pay: 2 480,00 $", observation: "The digits sit on a different background than the line around them.", mayIndicate: "A retouched figure. Not proof of fraud.", location: "page 1" },
|
|
39
|
+
{ id: "2", status: "attention", title: "Employer name spacing", quote: "Atelier Dumont inc.", location: "header" },
|
|
40
|
+
{ id: "3", status: "consistent", title: "File history", observation: "One save, by the issuing software." }
|
|
41
|
+
],
|
|
42
|
+
limits: ["The employer was not contacted."],
|
|
43
|
+
nextSteps: ["Ask for the original from the employer."],
|
|
44
|
+
provenance: { model: "authenticity-rules", runId: "run_77d1a0", version: "1.0.0" }
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
AnalysisReportAuthenticity as default
|
|
50
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AnalysisReport, type AnalysisReportLabels } from "@krizaka/ui/analysis-report";
|
|
2
|
+
|
|
3
|
+
// The words come from the app's messages (demo wording here).
|
|
4
|
+
const labels: AnalysisReportLabels = {
|
|
5
|
+
status: { inconsistent: "Altered", attention: "Doubtful", unverified: "Not checked", consistent: "Authentic" },
|
|
6
|
+
findings: "Signs found", mayIndicate: "Could mean", location: "Seen at:", evidence: "Raw data", details: "More",
|
|
7
|
+
limits: "Outside this check", nextSteps: "What to do", provenance: "Where this comes from",
|
|
8
|
+
model: "Rules", runId: "Run id", duration: "Took", version: "Rules version",
|
|
9
|
+
copyJson: "Copy as JSON", copyMarkdown: "Copy as Markdown", copied: "Copied", streaming: "Signs are arriving", noFindings: "No sign found.",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// Three levels of authenticity map to the existing statuses: authentic → consistent, doubtful → attention, altered → inconsistent.
|
|
13
|
+
export default function AnalysisReportAuthenticity() {
|
|
14
|
+
return (
|
|
15
|
+
<AnalysisReport
|
|
16
|
+
labels={labels}
|
|
17
|
+
title="Authenticity check"
|
|
18
|
+
summary="The pay stub shows one sign of alteration and one doubtful detail."
|
|
19
|
+
status="inconsistent"
|
|
20
|
+
folded={["consistent"]}
|
|
21
|
+
provenanceFolded
|
|
22
|
+
hideActions
|
|
23
|
+
findings={[
|
|
24
|
+
{ id: "1", status: "inconsistent", title: "Amount edited", quote: "Net pay: 2 480,00 $", observation: "The digits sit on a different background than the line around them.", mayIndicate: "A retouched figure. Not proof of fraud.", location: "page 1" },
|
|
25
|
+
{ id: "2", status: "attention", title: "Employer name spacing", quote: "Atelier Dumont inc.", location: "header" },
|
|
26
|
+
{ id: "3", status: "consistent", title: "File history", observation: "One save, by the issuing software." },
|
|
27
|
+
]}
|
|
28
|
+
limits={["The employer was not contacted."]}
|
|
29
|
+
nextSteps={["Ask for the original from the employer."]}
|
|
30
|
+
provenance={{ model: "authenticity-rules", runId: "run_77d1a0", version: "1.0.0" }}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/analysis-report/lease-review.tsx
|
|
4
|
+
import { AnalysisReport } from "@krizaka/ui/analysis-report";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var labels = {
|
|
7
|
+
status: { inconsistent: "Not compliant", attention: "To check", unverified: "Not applicable", consistent: "Respected" },
|
|
8
|
+
findings: "Findings",
|
|
9
|
+
mayIndicate: "May indicate",
|
|
10
|
+
location: "Where:",
|
|
11
|
+
evidence: "Evidence",
|
|
12
|
+
details: "Details",
|
|
13
|
+
limits: "What this report did not examine",
|
|
14
|
+
nextSteps: "Next steps",
|
|
15
|
+
provenance: "Provenance",
|
|
16
|
+
model: "Ruleset",
|
|
17
|
+
runId: "Run",
|
|
18
|
+
duration: "Duration",
|
|
19
|
+
version: "Version",
|
|
20
|
+
copyJson: "Copy JSON",
|
|
21
|
+
copyMarkdown: "Copy Markdown",
|
|
22
|
+
copied: "Copied",
|
|
23
|
+
streaming: "Findings are arriving",
|
|
24
|
+
noFindings: "No finding."
|
|
25
|
+
};
|
|
26
|
+
function AnalysisReportLeaseReview() {
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
AnalysisReport,
|
|
29
|
+
{
|
|
30
|
+
labels,
|
|
31
|
+
title: "Lease review",
|
|
32
|
+
summary: "One clause goes against the Civil Code; two others are worth a second look.",
|
|
33
|
+
status: "inconsistent",
|
|
34
|
+
folded: ["consistent", "unverified"],
|
|
35
|
+
provenanceFolded: true,
|
|
36
|
+
hideActions: true,
|
|
37
|
+
findings: [
|
|
38
|
+
{ id: "1", status: "inconsistent", title: "Deposit requested", quote: "The tenant pays a deposit of one month's rent on signing.", reference: { label: "C.c.Q., art. 1904, al. 1", href: "https://www.legisquebec.gouv.qc.ca/en/document/cs/CCQ-1991" }, location: "clause 6" },
|
|
39
|
+
{ id: "2", status: "attention", title: "Notice to change the rent", quote: "The landlord may revise the rent with a notice of 30 days.", reference: { label: "C.c.Q., art. 1942" }, location: "clause 9" },
|
|
40
|
+
{ id: "3", status: "consistent", title: "Term of the lease", quote: "The lease runs for twelve months from July 1.", reference: { label: "C.c.Q., art. 1851" } },
|
|
41
|
+
{ id: "4", status: "unverified", title: "Parking space", observation: "The lease does not mention a parking space." }
|
|
42
|
+
],
|
|
43
|
+
limits: ["The building's by-laws were not provided."],
|
|
44
|
+
nextSteps: ["Ask the landlord to remove the deposit clause."],
|
|
45
|
+
provenance: { model: "lease-rules", runId: "run_5c20be", version: "2026.11" }
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
AnalysisReportLeaseReview as default
|
|
51
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AnalysisReport, type AnalysisReportLabels } from "@krizaka/ui/analysis-report";
|
|
2
|
+
|
|
3
|
+
// The words come from the app's messages (demo wording here).
|
|
4
|
+
const labels: AnalysisReportLabels = {
|
|
5
|
+
status: { inconsistent: "Not compliant", attention: "To check", unverified: "Not applicable", consistent: "Respected" },
|
|
6
|
+
findings: "Findings", mayIndicate: "May indicate", location: "Where:", evidence: "Evidence", details: "Details",
|
|
7
|
+
limits: "What this report did not examine", nextSteps: "Next steps", provenance: "Provenance",
|
|
8
|
+
model: "Ruleset", runId: "Run", duration: "Duration", version: "Version",
|
|
9
|
+
copyJson: "Copy JSON", copyMarkdown: "Copy Markdown", copied: "Copied", streaming: "Findings are arriving", noFindings: "No finding.",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function AnalysisReportLeaseReview() {
|
|
13
|
+
return (
|
|
14
|
+
<AnalysisReport
|
|
15
|
+
labels={labels}
|
|
16
|
+
title="Lease review"
|
|
17
|
+
summary="One clause goes against the Civil Code; two others are worth a second look."
|
|
18
|
+
status="inconsistent"
|
|
19
|
+
folded={["consistent", "unverified"]}
|
|
20
|
+
provenanceFolded
|
|
21
|
+
hideActions
|
|
22
|
+
findings={[
|
|
23
|
+
{ id: "1", status: "inconsistent", title: "Deposit requested", quote: "The tenant pays a deposit of one month's rent on signing.", reference: { label: "C.c.Q., art. 1904, al. 1", href: "https://www.legisquebec.gouv.qc.ca/en/document/cs/CCQ-1991" }, location: "clause 6" },
|
|
24
|
+
{ id: "2", status: "attention", title: "Notice to change the rent", quote: "The landlord may revise the rent with a notice of 30 days.", reference: { label: "C.c.Q., art. 1942" }, location: "clause 9" },
|
|
25
|
+
{ id: "3", status: "consistent", title: "Term of the lease", quote: "The lease runs for twelve months from July 1.", reference: { label: "C.c.Q., art. 1851" } },
|
|
26
|
+
{ id: "4", status: "unverified", title: "Parking space", observation: "The lease does not mention a parking space." },
|
|
27
|
+
]}
|
|
28
|
+
limits={["The building's by-laws were not provided."]}
|
|
29
|
+
nextSteps={["Ask the landlord to remove the deposit clause."]}
|
|
30
|
+
provenance={{ model: "lease-rules", runId: "run_5c20be", version: "2026.11" }}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/analysis-report/long-address.tsx
|
|
4
|
+
import { AnalysisReport } from "@krizaka/ui/analysis-report";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var labels = {
|
|
7
|
+
status: { inconsistent: "Fails", attention: "Check", unverified: "Unknown", consistent: "Passes" },
|
|
8
|
+
findings: "Results",
|
|
9
|
+
mayIndicate: "Could mean",
|
|
10
|
+
location: "At:",
|
|
11
|
+
evidence: "Proof",
|
|
12
|
+
details: "More",
|
|
13
|
+
limits: "Not examined",
|
|
14
|
+
nextSteps: "What to do",
|
|
15
|
+
provenance: "Origin",
|
|
16
|
+
model: "Rules",
|
|
17
|
+
runId: "Id",
|
|
18
|
+
duration: "Time",
|
|
19
|
+
version: "Build",
|
|
20
|
+
copyJson: "JSON",
|
|
21
|
+
copyMarkdown: "Markdown",
|
|
22
|
+
copied: "Done",
|
|
23
|
+
streaming: "Loading",
|
|
24
|
+
noFindings: "Nothing."
|
|
25
|
+
};
|
|
26
|
+
var address = "1234-rue-Sainte-Catherine-Ouest-appartement-5-Montreal-Quebec-H3B1A7-Canada-adresse-du-logement-loue-sans-espace-ni-tiret-final";
|
|
27
|
+
function AnalysisReportLongAddress() {
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
AnalysisReport,
|
|
30
|
+
{
|
|
31
|
+
labels,
|
|
32
|
+
title: "Lease review",
|
|
33
|
+
summary: "The address of the dwelling is read as one long token.",
|
|
34
|
+
status: "attention",
|
|
35
|
+
hideActions: true,
|
|
36
|
+
findings: [{ id: "1", status: "attention", title: "Address to confirm", observation: address, quote: address, reference: { label: address } }]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
AnalysisReportLongAddress as default
|
|
42
|
+
};
|