834cc4d0e8
* fix(dialogs): kill horizontal overflow in dialogs and cut the worst modal copy Overflow hardening: - DialogTitle/DialogDescription and SheetTitle/SheetDescription get break-words at the primitive, so long unbroken interpolated strings (emails, product names, org numbers) can no longer widen any dialog. - AccountCombobox's non-flat dropdown is portaled to document.body with viewport-clamped geometry (new pure helper account-combobox-position.ts, unit-tested), the same fix info-tooltip.tsx applies to TooltipContent: the 34rem panel inside a scrollable DialogContent was the root cause of sideways-scrolling dialogs. Outside-click checks the portaled node, position tracks scroll/resize (capture phase), wheel/touchmove stop at the panel so react-remove-scroll's modal lock cannot block its scrolling, and DialogContent/SheetContent treat data-dialog-companion nodes as inside interactions so clicking the panel never dismisses the dialog. The flat variant is unchanged. - StrikeLinesDialog/CorrectionEntryDialog line rows switch bare 1fr grid tracks to minmax(0,1fr) and wrap the sm:contents-promoted AccountCombobox in a min-w-0 cell (SendInvoiceDialog's pattern). - New dialog-overflow-risk ratchet in no-new-antipatterns.mjs: bare fr tracks in dialog hosts, whitespace-nowrap inside DialogContent regions outside an allowlist, and unportaled >=20rem overlays; baselined at the post-fix 7 files. Copy reduction (convention 7, MatchVoucherDialog precedent): - New shared RattelseExplainer (HelpPopover) carries the "a posted verifikat cannot be edited directly" framing once; CorrectionEntryDialog, StrikeLinesDialog, RecordateEntryDialog and CorrectMetadataDialog drop their permanent inline explainer boxes and keep at most one sentence inline (hardcoded Swedish: verifikat surface). - SendInvoiceDialog keeps the actual addresses inline and moves the fixed CC/BCC framing plus the extra-address rules behind a HelpPopover (recipient_additional_hint replaced by recipient_help_fixed and recipient_help_additional in both messages files). - HelpPopover panels gain pointer-events-auto and the companion marker so they are actually interactive inside modal dialogs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(bookkeeping): mechanism-accurate rattelse copy and calmer dropdown repositioning The shared RattelseExplainer claimed every rattelse is logged with who/when in the verifikat's rattelsehistorik, which is only true for the inline strike-and-replace track (StrikeLinesDialog, CorrectMetadataDialog). The storno dialogs (CorrectionEntryDialog, RecordateEntryDialog) never write that log: their BFL 5 kap 5 trail is the storno chain. The shared component now keeps only the universally true framing sentence, and each dialog's popover carries the trail sentence matching its own mechanism. AccountCombobox's capture-phase scroll/resize handler now skips setState when the recomputed position is shallow-equal to the current one (isSameDropdownPosition in the pure position helper, unit-tested) and ignores scroll events originating inside the portaled panel itself, so scrolling the account list no longer churns re-renders. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
40 lines
1.6 KiB
TypeScript
40 lines
1.6 KiB
TypeScript
'use client'
|
|
|
|
import { HelpPopover } from '@/components/ui/help-popover'
|
|
|
|
interface RattelseExplainerProps {
|
|
/** Per-dialog specifics, rendered after the shared framing paragraph. */
|
|
children: React.ReactNode
|
|
className?: string
|
|
}
|
|
|
|
/**
|
|
* Shared "?" help for the rättelse family of dialogs (CorrectionEntryDialog,
|
|
* StrikeLinesDialog, RecordateEntryDialog, CorrectMetadataDialog): one place
|
|
* for the "a posted verifikat cannot be edited directly" framing, so the four
|
|
* dialogs stop maintaining near-duplicate inline paragraphs. Rendered next to
|
|
* the DialogTitle per UI-migration convention 7 (help lives behind a "?",
|
|
* not in the dialog flow: see MatchVoucherDialog). Stays Swedish
|
|
* (verifikat surface, .claude/rules/i18n.md).
|
|
*
|
|
* Only the universally true framing lives here. The audit-trail sentence is
|
|
* mechanism-specific (BFL 5 kap 5 §: two distinct correction tracks) and must
|
|
* come from each dialog's children: the inline strike-and-replace dialogs
|
|
* (StrikeLinesDialog, CorrectMetadataDialog) write the who/when
|
|
* rättelsehistorik log, while the storno dialogs (CorrectionEntryDialog,
|
|
* RecordateEntryDialog) never touch that log: their trail is the storno chain
|
|
* of linked verifikat. Claiming the rättelsehistorik here would be false for
|
|
* the storno paths.
|
|
*/
|
|
export default function RattelseExplainer({ children, className }: RattelseExplainerProps) {
|
|
return (
|
|
<HelpPopover className={className}>
|
|
<p>
|
|
En bokförd verifikation kan inte ändras direkt: enligt bokföringslagen
|
|
måste varje rättelse vara spårbar i efterhand.
|
|
</p>
|
|
<div className="mt-2 space-y-2">{children}</div>
|
|
</HelpPopover>
|
|
)
|
|
}
|