ec27228a8e
Em dashes (—) and en dashes (–) had spread across comments, docs, tests, and a few UI strings, reading as AI-generated boilerplate rather than house style. Replaced each with punctuation matching its context: colon for explanatory clauses, comma for asides, plain hyphen for numeric/legal ranges (e.g. "21-23§"), "to"/"till" for date ranges, parentheses for paired-dash asides. messages/en.json and messages/sv.json were fixed by hand together to keep sv/en in sync. Left untouched where the dash is the functional subject rather than decorative punctuation: date-range-parser.ts's separator regex, charset-repair.ts's CP1252 byte-mapping table (and its test), the SIE encoding mojibake docs, generic-csv.ts's minus-sign normalizer, the agent system-prompt files that already instruct against em dashes, and a golden iXBRL test fixture compared byte-for-byte. Also fixes two bugs surfaced along the way: an off-by-one in ApiKeysPanel's scope-label split (a leftover from an earlier partial pass), and a charset-repair test that had lost the literal en-dash it exists to verify. Regenerated the agent atom seed migration (skills:generate) since 27 SKILL.md files changed. Added a CLAUDE.md rule against em/en dashes, with an explicit carve-out for the functional-dash cases above. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
'use client'
|
|
|
|
import { cn } from '@/lib/utils'
|
|
|
|
interface Props {
|
|
// When true, render the dot. The parent owns the "did this value come from
|
|
// AI extraction?" question: usually by comparing the current input value
|
|
// against the originally-prefilled value, and clearing the flag once the
|
|
// user edits the field.
|
|
active: boolean
|
|
// Visible label next to the dot. Defaults to none (just the dot, with
|
|
// tooltip text on hover). Set to "AI-fyllt" or similar when the field
|
|
// has room.
|
|
label?: string
|
|
className?: string
|
|
// Tooltip / aria-label for the dot.
|
|
title?: string
|
|
}
|
|
|
|
// Tiny indicator that a form field's value was pre-filled by the AI
|
|
// extraction pipeline. Sits to the right of the field label or inside the
|
|
// input's right padding. Fades when the user edits the field: see how
|
|
// supplier-invoices/new wires it.
|
|
//
|
|
// Design: a small filled dot, success color when the extraction succeeded.
|
|
// Optional uppercase micro-label for forms where space allows.
|
|
export default function AiFilledIndicator({ active, label, className, title }: Props) {
|
|
if (!active) return null
|
|
return (
|
|
<span
|
|
title={title ?? 'Värdet är ifyllt av AI baserat på dokumentet'}
|
|
className={cn(
|
|
'inline-flex items-center gap-1 text-[10px] uppercase tracking-wider text-muted-foreground',
|
|
className,
|
|
)}
|
|
>
|
|
<span aria-hidden className="inline-block h-1.5 w-1.5 rounded-full bg-success" />
|
|
{label ?? <span className="sr-only">AI-fyllt</span>}
|
|
</span>
|
|
)
|
|
}
|