@eifi1/ui-kit 0.51.1 → 0.51.3

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.
Files changed (39) hide show
  1. package/dist/components/data-table-fit.js +33 -3
  2. package/dist/components/data-table-fit.js.map +1 -1
  3. package/dist/components/legal-labels.js +2 -1
  4. package/dist/components/legal-labels.js.map +1 -1
  5. package/dist/components/legal-page.d.ts +18 -3
  6. package/dist/components/legal-page.js +9 -0
  7. package/dist/components/legal-page.js.map +1 -1
  8. package/dist/components/legal.d.ts +10 -1
  9. package/dist/components/legal.js +2 -0
  10. package/dist/components/legal.js.map +1 -1
  11. package/dist/eslint/index.js +1 -1
  12. package/dist/i18n/german.js +2 -1
  13. package/dist/i18n/german.js.map +1 -1
  14. package/dist/i18n/locales/en.js +2 -1
  15. package/dist/i18n/locales/en.js.map +2 -2
  16. package/dist/i18n/locales/es.js +2 -1
  17. package/dist/i18n/locales/es.js.map +1 -1
  18. package/dist/i18n/locales/fr.js +2 -1
  19. package/dist/i18n/locales/fr.js.map +1 -1
  20. package/dist/i18n/locales/hu.js +2 -1
  21. package/dist/i18n/locales/hu.js.map +1 -1
  22. package/dist/i18n/locales/it.js +2 -1
  23. package/dist/i18n/locales/it.js.map +1 -1
  24. package/dist/i18n/locales/zh.js +2 -1
  25. package/dist/i18n/locales/zh.js.map +1 -1
  26. package/dist/i18n/review.js +2 -0
  27. package/dist/i18n/review.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/data-table-fit.ts +54 -4
  30. package/src/components/legal-labels.ts +2 -1
  31. package/src/components/legal-page.tsx +33 -2
  32. package/src/components/legal.tsx +11 -0
  33. package/src/i18n/german.ts +2 -1
  34. package/src/i18n/locales/es.ts +2 -1
  35. package/src/i18n/locales/fr.ts +2 -1
  36. package/src/i18n/locales/hu.ts +2 -1
  37. package/src/i18n/locales/it.ts +2 -1
  38. package/src/i18n/locales/zh.ts +2 -1
  39. package/src/i18n/review.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/legal.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { countryName } from \"../lib/countries\";\nimport { AlertBanner } from \"./alert-banner\";\nimport { TextLink } from \"./text-link\";\nimport { DEFAULT_LEGAL_LABELS } from \"./legal-labels\";\n\n/**\n * The legal pages — Imprint, Privacy Policy, Terms — for every app.\n *\n * 0.19 (docs/i18n-harmonization.md H10): keksdose and kastlan each carried the same\n * shell, written twice: a back link, the title, a \"closed beta, not yet reviewed by a\n * lawyer\" notice, sections of heading + running text, and kastlan's row of links to the\n * three pages with the current one marked. That shape moved here; the words stayed in\n * each app.\n *\n * 0.28 (docs/legal-harmonization.md) reverses the second half: the wording that is the\n * same in all three apps is the kit's too, in all seven languages, so there is ONE text\n * to change after the lawyer's review instead of three apps drifting apart sentence by\n * sentence. This module holds the labels (every kit-owned legal word, §4.3/§4.4), the\n * column (`LegalLayout`), the section (`LegalSection`, now numbered and cross-referenced\n * inside a `LegalPage`), the links row and the public footer. The page frame, the\n * kit-owned sections and the terms checkbox are in `./legal-page`.\n *\n * `LegalLayout` stays a CONTENT COLUMN, not a page: before 0.28 keksdose showed it inside\n * its public landing header and footer and kastlan inside `AuthLayout`. `LegalPage` is\n * the frame around it that the contract (§3.2) settled on — keksdose's.\n */\n\n// ── The operator ──────────────────────────────────────────────────────────────\n\n/** The three pages, by the key every app uses for them (§4.1). Kurvenschmiede's\n * `imprint` became `impressum`. */\nexport type LegalPageKey = \"impressum\" | \"privacy\" | \"terms\";\n\n/** The three routes (§3.1): one per page, the language from i18n, no per-language URLs. */\nexport const LEGAL_HREFS: Readonly<Record<LegalPageKey, string>> = Object.freeze({\n impressum: \"/impressum\",\n privacy: \"/privacy\",\n terms: \"/terms\",\n});\n\n/**\n * Who runs the app — the values the kit's legal sections are filled in with (§5).\n *\n * The kit holds NO personal data: every app passes the same values once, to\n * {@link LegalPage}'s `operator`. Plain strings, so the app's config or env can hold them.\n */\nexport interface LegalOperator {\n /** The operator's name, as the imprint prints it. */\n name: string;\n /** \"9470\"-shaped; printed before the city. */\n postalCode: string;\n /** The place — the imprint's address line and the terms' place of jurisdiction. */\n city: string;\n /** The canton or state, abbreviated as the place of jurisdiction writes it: \"SG\". */\n region: string;\n /**\n * ISO 3166-1 alpha-2: \"CH\". A CODE, not a name — the kit names it in the page's\n * language (`Intl.DisplayNames`, see `countryName`), so \"Switzerland\", \"Schweiz\",\n * \"Suisse\" and \"瑞士\" all come from one value.\n */\n country: string;\n /** The contact address the imprint and the privacy policy print. */\n email: string;\n /**\n * The language whose version of the legal texts is BINDING (\"de-CH\"), a BCP 47 code\n * (0.28.1, Marcel 2026-10-05). The lawyer reviews that one; the others are translations\n * for convenience. With it, {@link LegalPage} shows a note on every page read in\n * another language, and the terms' `language` section says which version prevails.\n * Only the language subtag counts: \"de-CH\" and \"de\" are the same language here.\n */\n bindingLanguage?: string;\n}\n\n/**\n * The operator as the kit's texts read it: {@link LegalOperator} with `country` already\n * NAMED in the page's language (\"Schweiz\", not \"CH\").\n *\n * The label functions take this rather than the code so they stay pure string functions\n * of plain values, like every other function label in the kit: a catalogue never calls\n * `Intl`, and a review row can be rendered from placeholders (`{{country}}`).\n */\nexport type LegalOperatorText = Readonly<Record<keyof LegalOperator, string>>;\n\n/** The language subtag of a BCP 47 code, lower-cased: \"de-CH\" → \"de\". */\nexport function baseLanguage(code: string): string {\n return code.split(/[-_]/)[0]!.toLowerCase();\n}\n\nconst languageNamers = new Map<string, Intl.DisplayNames | null>();\n\n/** The name of a language in `locale` — \"Deutsch\", \"German\", \"allemand\", \"德语\" — from its\n * language subtag, so \"de-CH\" is plain \"German\", not \"Swiss High German\". The code itself\n * when the runtime cannot name it. */\nfunction languageName(code: string, locale: string): string {\n let namer = languageNamers.get(locale);\n if (namer === undefined) {\n try {\n namer = new Intl.DisplayNames([locale], { type: \"language\" });\n } catch {\n namer = null;\n }\n languageNamers.set(locale, namer);\n }\n const base = baseLanguage(code);\n try {\n return namer?.of(base) ?? base;\n } catch {\n return base;\n }\n}\n\n/** @internal The operator as the texts read it: its country named in `locale` (English\n * without one — `countryName`'s rule, so an app that set no locale reads English). */\nexport function legalOperatorText(operator: LegalOperator, locale: string = \"en\"): LegalOperatorText {\n return {\n ...operator,\n country: countryName(operator.country, locale),\n bindingLanguage: operator.bindingLanguage ? languageName(operator.bindingLanguage, locale) : \"\",\n };\n}\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\n/** A kit section whose text is fixed: a heading and one body. */\nexport interface LegalTextSectionLabels {\n title: string;\n body: string;\n}\n\n/**\n * 0.32.0: the imprint's disclaimer, with the body of its COMMERCIAL variant\n * (docs/billing-harmonization.md §8; legal decision 7). The title is the same in both:\n * liability for content and links is the subject either way.\n */\nexport interface LegalDisclaimerSectionLabels extends LegalTextSectionLabels {\n /**\n * The body for `<LegalKitSection section=\"disclaimer\" variant=\"commercial\">`: a paid\n * service sold through a Merchant of Record, which sells in its own name (§2.2), so the\n * \"private, non-commercial … closed beta\" of `body` would be untrue. OPTIONAL, as every\n * key added to a namespace an app may annotate: left out, the provider's, then English.\n */\n commercial?: string;\n}\n\n/** A kit section whose text names the operator (§4.3 `{name}`, `{email}`, …). */\nexport interface LegalOperatorSectionLabels {\n title: string;\n /** Called with the operator, its country already named in the page's language. Line\n * breaks are kept (`white-space: pre-line`): an address is plain lines. */\n body: (operator: LegalOperatorText) => string;\n}\n\n/** A kit section with an app slot (or a list) between its two parts. */\nexport interface LegalFramedSectionLabels {\n title: string;\n /** Before the app's part. */\n lead: string;\n /** After it. */\n tail: string;\n}\n\n/**\n * Every word of the legal pages that is the kit's — docs/legal-harmonization.md §4.3 and\n * §4.4, verbatim. English, British spelling; the other six languages are in the\n * catalogues (`@eifi1/ui-kit/i18n/<code>`).\n *\n * Keys follow the contract: `sections.<page>.<section key>`, the section keys being\n * keksdose's (`legal_basis`, not `legalBasis`), because the same key is the section's\n * `id` (`/privacy#legal_basis`) and the app's own sections sit beside these under the\n * same names in its catalogue. Titles carry NO number: {@link LegalPage} numbers the\n * privacy and terms sections in render order (§4.1).\n */\nexport interface LegalLabels {\n /** The accessible name of {@link LegalLinks}' and {@link LegalFooter}'s `<nav>`. */\n navLabel: string;\n /** The short labels of the three links, everywhere the links appear (§3.3). */\n links: Record<LegalPageKey, string>;\n /** The pages' titles — the `<h1>`, and the links of the terms checkbox. */\n titles: Record<LegalPageKey, string>;\n /** The back link above the title: \"← Back to home\". */\n backHome: string;\n /**\n * The terms checkbox (§3.4) — ONE template with `{terms}` and `{privacy}`, which\n * become the links (named with `titles`). Not a prefix plus a joiner: a language puts\n * the links where its grammar wants them, articles included, and nothing is added\n * around a placeholder — Italian elides, \"e l’{privacy}\", with no space.\n */\n accept: string;\n /** The notice under the title (§3.2): `beta` on the imprint and the terms, `privacy`\n * on the privacy policy. */\n notice: {\n beta: string;\n privacy: string;\n };\n /**\n * 0.28.1: on a page read in another language than the operator's `bindingLanguage` —\n * `note` under the title, `show` on the button that switches to the binding version\n * (when the app passes `onShowBindingLanguage`). `o.bindingLanguage` is the binding\n * language's NAME in the reader's language (\"German\", \"allemand\").\n */\n translation: {\n note: (o: LegalOperatorText) => string;\n show: (o: LegalOperatorText) => string;\n };\n /** The kit's sections (§4.3), by page and section key. */\n sections: {\n impressum: {\n operator: LegalOperatorSectionLabels;\n contact: LegalOperatorSectionLabels;\n /** `body` is the default, non-commercial text; `commercial` the 0.32 variant. */\n disclaimer: LegalDisclaimerSectionLabels;\n };\n privacy: {\n controller: LegalOperatorSectionLabels;\n /** The app's paragraph follows the body (§4.2): consent, where an app relies on it. */\n legal_basis: LegalTextSectionLabels;\n /** `lead`, then the app's entries as a list, then `tail`, then the app's paragraph. */\n browser: LegalFramedSectionLabels;\n /** `lead` (the rights), then the app's paragraph (export, deletion), then `tail`\n * (the supervisory authorities). */\n rights: LegalFramedSectionLabels;\n contact: LegalOperatorSectionLabels;\n };\n terms: {\n warranty: LegalTextSectionLabels;\n liability: LegalTextSectionLabels;\n changes: LegalTextSectionLabels;\n /** 0.28.1: which language's version prevails — `o.bindingLanguage`, named. */\n language: LegalOperatorSectionLabels;\n /** The place of jurisdiction is the operator's `{city} ({region}), {country}`. */\n law: LegalOperatorSectionLabels;\n };\n };\n}\n\n// Defined in ./legal-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_LEGAL_LABELS };\n\n/** The `legal` namespace, resolved: defaults < provider < `labels` prop. The prop may be\n * partial at every depth (`{ titles: { terms: \"…\" } }`), as the provider's is. */\nexport function useLegalLabels(labels?: LabelOverride<LegalLabels>): LegalLabels {\n return useKitLabels(\"legal\", DEFAULT_LEGAL_LABELS, labels);\n}\n\n// ── What a LegalPage tells the sections inside it ─────────────────────────────\n\n/** Where a `{ref:key}` points: the section's number on a numbered page, else its heading. */\nexport interface LegalRefTarget {\n number?: number;\n heading: ReactNode;\n}\n\n/** @internal Set by `LegalPage` around its column; `null` outside one. */\nexport interface LegalPageContextValue {\n page: LegalPageKey;\n /** The operator with its country named — what the kit sections are filled in with. */\n operator: LegalOperatorText;\n /** The heading level of a section that does not choose one: one below the title. */\n sectionHeading: \"h2\" | \"h3\";\n /** Every section's key, in render order — known BEFORE any section renders, so a\n * reference can point forward (keksdose's section 2 refers to section 10). */\n targets: ReadonlyMap<string, LegalRefTarget>;\n}\n\n/** @internal */\nexport const LegalPageContext = createContext<LegalPageContextValue | null>(null);\n\n/** @internal The place `LegalPage` gave one section: its key and its number. Reset to\n * `null` inside a section, so a section nested in another's children takes neither. */\nexport interface LegalSectionSlot {\n id?: string;\n number?: number;\n}\n\n/** @internal */\nexport const LegalSlotContext = createContext<LegalSectionSlot | null>(null);\n\n/** @internal `{ref:retention}`. A key is a section key: letters, digits, `_` and `-`. */\nconst REF_TOKEN = /\\{ref:([A-Za-z0-9_-]+)\\}/g;\n\n/**\n * A development build's console note — never in production (the consumer's bundler\n * makes `import.meta.env.DEV` false) and never under vitest. Optional-chained:\n * `import.meta.env` is a Vite injection, absent under plain Node.\n */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\nconst warned = new Set<string>();\n/** @internal Once per message. */\nexport function warnLegalOnce(message: string): void {\n if (!devWarnings() || warned.has(message)) return;\n warned.add(message);\n console.warn(`[ui-kit] ${message}`);\n}\n\n/**\n * `text` with every `{ref:key}` replaced by a link to `#key` that reads the section's\n * number — the words around it stay the app's (\"see section {ref:retention}\", \"siehe\n * Abschnitt {ref:retention}\"), so each language keeps its grammar (§4.1). On the imprint,\n * which is not numbered, the link reads the section's heading instead.\n *\n * Outside a {@link LegalPage} the text is returned as it is: there is no order to count.\n * A key the page has no section for stays visible as the raw token — a broken reference\n * an app test can find (`not.toHaveTextContent(\"{ref:\")`), not a silently wrong number.\n */\nexport function resolveLegalRefs(text: string, page: LegalPageContextValue | null): ReactNode {\n if (!page || !text.includes(\"{ref:\")) return text;\n const out: ReactNode[] = [];\n let last = 0;\n for (const match of text.matchAll(REF_TOKEN)) {\n const at = match.index ?? 0;\n if (at > last) out.push(text.slice(last, at));\n const key = match[1];\n const target = page.targets.get(key);\n if (target) {\n out.push(\n <TextLink key={`${key}@${at}`} href={`#${key}`}>\n {target.number ?? target.heading}\n </TextLink>,\n );\n } else {\n warnLegalOnce(`{ref:${key}} on the ${page.page} page points at no section of it.`);\n out.push(match[0]);\n }\n last = at + match[0].length;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\n/** @internal Running text — one translation string — with its line breaks kept and its\n * `{ref:key}` tokens resolved. */\nexport function LegalText({ text, className }: { text: string; className?: string }) {\n const page = useContext(LegalPageContext);\n // `break-words`: an address, an email or a URL in a translation is one long word, and\n // on a 390px phone it would push the column wider than the screen.\n return <p className={cn(\"whitespace-pre-line break-words\", className)}>{resolveLegalRefs(text, page)}</p>;\n}\n\n// ── Links ─────────────────────────────────────────────────────────────────────\n\nexport interface LegalLink {\n href: string;\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n label: ReactNode;\n}\n\nexport interface LegalLinksProps {\n /** Default (0.28): the three routes, `/impressum`, `/privacy` and `/terms`, with the\n * kit's short link labels (`legal.links`), in the contract's order. */\n links?: readonly LegalLink[];\n /** The page being shown; its link is marked `aria-current=\"page\"`. Usually the\n * router's pathname. */\n currentHref?: string;\n /** `false` renders the links without the `<nav>` landmark — inside `AuthLayout`'s\n * `footer` or `TopBarActionMenu`'s `footer`, which are named `<nav>`s already. The row\n * keeps its spacing and `className` either way (0.27.1: it used to return the bare\n * links, so in a plain container — Kurvenschmiede's account-menu `<li>` — they ran\n * together as \"ImpressumDatenschutzerklärungNutz…\" and overflowed). Default true. */\n nav?: boolean;\n /** Called on a click on any of the links, before it navigates — an account menu closes\n * itself here (0.28.1, keksdose: it had to catch the click on a wrapping `<div>`). */\n onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n labels?: LabelOverride<LegalLabels>;\n className?: string;\n}\n\n/** The default links: the three routes under the kit's short labels. */\nfunction defaultLinks(labels: LegalLabels): LegalLink[] {\n return ([\"impressum\", \"privacy\", \"terms\"] as const).map((page) => ({\n href: LEGAL_HREFS[page],\n label: labels.links[page],\n }));\n}\n\n/**\n * The legal pages as a row of quiet links, the one you are on marked (kastlan's\n * `LegalLinks`). Wraps on a phone.\n *\n * 0.28: `·` separators between the links, keksdose's footer style, wherever the links\n * appear — the account menu included (§3.3). The dots are `aria-hidden`: a screen reader\n * already hears three links, and \"middle dot\" between them is noise. They are flex items\n * of the row like the links, so the row's gap spaces them evenly.\n */\nexport function LegalLinks({\n links,\n currentHref,\n nav = true,\n onLinkClick,\n labels: labelsProp,\n className,\n}: LegalLinksProps) {\n const labels = useLegalLabels(labelsProp);\n const shown = links ?? defaultLinks(labels);\n const items = shown.flatMap((link, i) => [\n ...(i > 0 ? [<span key={`sep-${link.href}`} aria-hidden=\"true\">·</span>] : []),\n <TextLink key={link.href} href={link.href} tone=\"muted\" current={link.href === currentHref} onClick={onLinkClick}>\n {link.label}\n </TextLink>,\n ]);\n const rowClass = cn(\"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs\", className);\n if (!nav) return <div className={rowClass}>{items}</div>;\n return (\n <nav aria-label={labels.navLabel} className={rowClass}>\n {items}\n </nav>\n );\n}\n\n// ── Footer ────────────────────────────────────────────────────────────────────\n\nexport interface LegalFooterProps {\n /** Under the links, centred — the app's tagline (keksdose: \"Self-hosted household\n * budgeting & bookkeeping.\"). */\n children?: ReactNode;\n /** Default: the three routes with the kit's link labels — see {@link LegalLinks}. */\n links?: readonly LegalLink[];\n /** Marks that link `aria-current=\"page\"`. {@link LegalPage}'s default footer passes\n * its own page. */\n currentHref?: string;\n /**\n * Default true: the footer is a `<footer>`. `false` draws a `<div>` — for a host that is\n * a footer already: `AuthLayout`'s `footer` slot is one, and HTML forbids a footer inside\n * a footer (0.28.1, kastlan). On an `AuthLayout` page the usual choice is simpler still:\n * `footer={<LegalLinks nav={false} />}` with `footerLabel` set to the kit's `navLabel`\n * ({@link useLegalLabels}).\n */\n landmark?: boolean;\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * The public footer (§3.3): the three links, centred, with their separators, in a\n * `<nav aria-label=\"Legal\">` — on the landing or home page, every signed-out page the app\n * has, the legal pages and the 404. The rule behind it: from every page a signed-out\n * visitor can reach, the three links are one click away.\n *\n * keksdose's `SiteFooter` (features/landing/site-footer.tsx), which carried them on its\n * landing, auth, legal and 404 pages; kastlan and Kurvenschmiede had them on some pages\n * only. Its palette classes (`border-slate-200 bg-white dark:…`) became the surface and\n * border tokens, so it follows the theme like the rest of the kit.\n */\nexport function LegalFooter({ children, links, currentHref, landmark = true, className, labels }: LegalFooterProps) {\n const Root = landmark ? \"footer\" : \"div\";\n return (\n <Root className={cn(\"border-t border-subtle bg-surface\", className)}>\n <div className=\"mx-auto max-w-5xl px-4 py-8 text-sm text-muted\">\n <LegalLinks\n links={links}\n currentHref={currentHref}\n labels={labels}\n className=\"justify-center gap-y-2 text-sm\"\n />\n {children !== undefined && children !== null && <p className=\"mt-4 text-center\">{children}</p>}\n </div>\n </Root>\n );\n}\n\n// ── Section ───────────────────────────────────────────────────────────────────\n\nexport interface LegalSectionProps {\n heading: ReactNode;\n /** Running text. Line breaks in it are kept (`white-space: pre-line`), so a\n * translation can hold an address or a list as plain lines. Inside a\n * {@link LegalPage}, `{ref:key}` becomes the number of section `key`, linked. */\n body?: string;\n /** Anything richer than plain text — links, a list — after `body`. A plain string\n * here has its `{ref:key}` tokens resolved too. */\n children?: ReactNode;\n /**\n * The section's `id`, for a link to it from elsewhere. Inside a {@link LegalPage} it\n * defaults to the element's React `key` — keksdose's\n * `SECTIONS.map((s) => <LegalSection key={s} … />)` gets `id=\"retention\"` with\n * nothing added — and it is the key a `{ref:…}` names.\n */\n id?: string;\n /** The heading's element. Default `h2` under the layout's `h1` (inside a\n * `LegalPage`, one level below its title). */\n headingAs?: \"h2\" | \"h3\";\n}\n\n/**\n * One section: heading and running text.\n *\n * 0.28, inside a {@link LegalPage}: its `id` (the `key` unless given), its number on the\n * privacy policy and the terms (\"3. Legal basis\" — titles carry no number, §4.1), and\n * `{ref:key}` resolution in `body`. Outside one it is exactly the 0.19 section.\n */\nexport function LegalSection({ heading, body, children, id: idProp, headingAs }: LegalSectionProps) {\n const page = useContext(LegalPageContext);\n const slot = useContext(LegalSlotContext);\n const id = idProp ?? slot?.id;\n const number = slot?.number;\n const Heading = headingAs ?? page?.sectionHeading ?? \"h2\";\n return (\n <section id={id} className=\"scroll-mt-20\">\n <Heading className=\"text-lg font-semibold break-words text-primary\">\n {number !== undefined && `${number}. `}\n {heading}\n </Heading>\n <LegalSlotContext.Provider value={null}>\n {body !== undefined && (\n <LegalText text={body} className=\"mt-2 text-sm leading-relaxed text-secondary\" />\n )}\n {children !== undefined && (\n <div className=\"mt-2 text-sm leading-relaxed break-words text-secondary\">\n {typeof children === \"string\" ? resolveLegalRefs(children, page) : children}\n </div>\n )}\n </LegalSlotContext.Provider>\n </section>\n );\n}\n\n// ── Layout ────────────────────────────────────────────────────────────────────\n\nexport interface LegalLayoutProps {\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n title: ReactNode;\n /** Above the title — the app's \"← Back\" link (`<TextLink icon={ArrowLeft}>`). Inside\n * a {@link LegalPage}, \"← Back to home\". */\n back?: ReactNode;\n /**\n * A notice under the title, as a warning banner with `role=\"note\"` — page furniture,\n * not an alert. Per page, not per layout: the privacy page says something more precise\n * than the others (its technical sections describe running code).\n */\n notice?: ReactNode;\n /** 0.28.1: under the title, before the notice — {@link LegalPage}'s note that this\n * page is a translation and which language is binding. */\n translationNote?: ReactNode;\n /** The sections — {@link LegalSection}s. */\n children: ReactNode;\n /** The three pages, linked at the end of the column with the current one marked.\n * Leave out when the page's chrome already shows them (a {@link LegalFooter}). */\n links?: readonly LegalLink[];\n currentHref?: string;\n /** Default `h1`: the page's heading. */\n headingAs?: \"h1\" | \"h2\";\n /** Extra classes on the column — `px-0 py-0` inside a chrome that pads already. */\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\nexport function LegalLayout({\n title,\n back,\n notice,\n translationNote,\n children,\n links,\n currentHref,\n headingAs: Heading = \"h1\",\n className,\n labels,\n}: LegalLayoutProps) {\n return (\n <article className={cn(\"mx-auto w-full max-w-3xl px-4 py-12\", className)}>\n {back !== undefined && <div className=\"mb-4 text-sm\">{back}</div>}\n <Heading className=\"text-3xl font-bold tracking-tight break-words text-primary\">{title}</Heading>\n {translationNote !== undefined && translationNote !== null && <div className=\"mt-3\">{translationNote}</div>}\n {notice !== undefined && notice !== null && (\n <AlertBanner tone=\"warning\" role=\"note\" className=\"mt-4\">\n {notice}\n </AlertBanner>\n )}\n <div className=\"mt-8 space-y-8\">{children}</div>\n {links !== undefined && links.length > 0 && (\n <LegalLinks links={links} currentHref={currentHref} labels={labels} className=\"mt-12 border-t border-subtle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gBAAgB;AACxC,QAAM,KAAK,UAAU,MAAM;AAC3B,QAAM,SAAS,MAAM;AACrB,QAAM,UAAU,aAAa,MAAM,kBAAkB;AACrD,SACE,qBAAC,aAAQ,IAAQ,WAAU,gBACzB;AAAA,yBAAC,WAAQ,WAAU,kDAChB;AAAA,iBAAW,UAAa,GAAG,MAAM;AAAA,MACjC;AAAA,OACH;AAAA,IACA,qBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAC/B;AAAA,eAAS,UACR,oBAAC,aAAU,MAAM,MAAM,WAAU,+CAA8C;AAAA,MAEhF,aAAa,UACZ,oBAAC,SAAI,WAAU,2DACZ,iBAAO,aAAa,WAAW,iBAAiB,UAAU,IAAI,IAAI,UACrE;AAAA,OAEJ;AAAA,KACF;AAEJ;AAgCO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW,UAAU;AAAA,EACrB;AAAA,EACA;AACF,GAAqB;AACnB,SACE,qBAAC,aAAQ,WAAW,GAAG,uCAAuC,SAAS,GACpE;AAAA,aAAS,UAAa,oBAAC,SAAI,WAAU,gBAAgB,gBAAK;AAAA,IAC3D,oBAAC,WAAQ,WAAU,8DAA8D,iBAAM;AAAA,IACtF,oBAAoB,UAAa,oBAAoB,QAAQ,oBAAC,SAAI,WAAU,QAAQ,2BAAgB;AAAA,IACpG,WAAW,UAAa,WAAW,QAClC,oBAAC,eAAY,MAAK,WAAU,MAAK,QAAO,WAAU,QAC/C,kBACH;AAAA,IAEF,oBAAC,SAAI,WAAU,kBAAkB,UAAS;AAAA,IACzC,UAAU,UAAa,MAAM,SAAS,KACrC,oBAAC,cAAW,OAAc,aAA0B,QAAgB,WAAU,qCAAoC;AAAA,KAEtH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/legal.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { countryName } from \"../lib/countries\";\nimport { AlertBanner } from \"./alert-banner\";\nimport { TextLink } from \"./text-link\";\nimport { DEFAULT_LEGAL_LABELS } from \"./legal-labels\";\n\n/**\n * The legal pages — Imprint, Privacy Policy, Terms — for every app.\n *\n * 0.19 (docs/i18n-harmonization.md H10): keksdose and kastlan each carried the same\n * shell, written twice: a back link, the title, a \"closed beta, not yet reviewed by a\n * lawyer\" notice, sections of heading + running text, and kastlan's row of links to the\n * three pages with the current one marked. That shape moved here; the words stayed in\n * each app.\n *\n * 0.28 (docs/legal-harmonization.md) reverses the second half: the wording that is the\n * same in all three apps is the kit's too, in all seven languages, so there is ONE text\n * to change after the lawyer's review instead of three apps drifting apart sentence by\n * sentence. This module holds the labels (every kit-owned legal word, §4.3/§4.4), the\n * column (`LegalLayout`), the section (`LegalSection`, now numbered and cross-referenced\n * inside a `LegalPage`), the links row and the public footer. The page frame, the\n * kit-owned sections and the terms checkbox are in `./legal-page`.\n *\n * `LegalLayout` stays a CONTENT COLUMN, not a page: before 0.28 keksdose showed it inside\n * its public landing header and footer and kastlan inside `AuthLayout`. `LegalPage` is\n * the frame around it that the contract (§3.2) settled on — keksdose's.\n */\n\n// ── The operator ──────────────────────────────────────────────────────────────\n\n/** The three pages, by the key every app uses for them (§4.1). Kurvenschmiede's\n * `imprint` became `impressum`. */\nexport type LegalPageKey = \"impressum\" | \"privacy\" | \"terms\";\n\n/** The three routes (§3.1): one per page, the language from i18n, no per-language URLs. */\nexport const LEGAL_HREFS: Readonly<Record<LegalPageKey, string>> = Object.freeze({\n impressum: \"/impressum\",\n privacy: \"/privacy\",\n terms: \"/terms\",\n});\n\n/**\n * Who runs the app — the values the kit's legal sections are filled in with (§5).\n *\n * The kit holds NO personal data: every app passes the same values once, to\n * {@link LegalPage}'s `operator`. Plain strings, so the app's config or env can hold them.\n */\nexport interface LegalOperator {\n /** The operator's name, as the imprint prints it. */\n name: string;\n /** \"9470\"-shaped; printed before the city. */\n postalCode: string;\n /** The place — the imprint's address line and the terms' place of jurisdiction. */\n city: string;\n /** The canton or state, abbreviated as the place of jurisdiction writes it: \"SG\". */\n region: string;\n /**\n * ISO 3166-1 alpha-2: \"CH\". A CODE, not a name — the kit names it in the page's\n * language (`Intl.DisplayNames`, see `countryName`), so \"Switzerland\", \"Schweiz\",\n * \"Suisse\" and \"瑞士\" all come from one value.\n */\n country: string;\n /** The contact address the imprint and the privacy policy print. */\n email: string;\n /**\n * The language whose version of the legal texts is BINDING (\"de-CH\"), a BCP 47 code\n * (0.28.1, Marcel 2026-10-05). The lawyer reviews that one; the others are translations\n * for convenience. With it, {@link LegalPage} shows a note on every page read in\n * another language, and the terms' `language` section says which version prevails.\n * Only the language subtag counts: \"de-CH\" and \"de\" are the same language here.\n */\n bindingLanguage?: string;\n}\n\n/**\n * The operator as the kit's texts read it: {@link LegalOperator} with `country` already\n * NAMED in the page's language (\"Schweiz\", not \"CH\").\n *\n * The label functions take this rather than the code so they stay pure string functions\n * of plain values, like every other function label in the kit: a catalogue never calls\n * `Intl`, and a review row can be rendered from placeholders (`{{country}}`).\n */\nexport type LegalOperatorText = Readonly<Record<keyof LegalOperator, string>>;\n\n/** The language subtag of a BCP 47 code, lower-cased: \"de-CH\" → \"de\". */\nexport function baseLanguage(code: string): string {\n return code.split(/[-_]/)[0]!.toLowerCase();\n}\n\nconst languageNamers = new Map<string, Intl.DisplayNames | null>();\n\n/** The name of a language in `locale` — \"Deutsch\", \"German\", \"allemand\", \"德语\" — from its\n * language subtag, so \"de-CH\" is plain \"German\", not \"Swiss High German\". The code itself\n * when the runtime cannot name it. */\nfunction languageName(code: string, locale: string): string {\n let namer = languageNamers.get(locale);\n if (namer === undefined) {\n try {\n namer = new Intl.DisplayNames([locale], { type: \"language\" });\n } catch {\n namer = null;\n }\n languageNamers.set(locale, namer);\n }\n const base = baseLanguage(code);\n try {\n return namer?.of(base) ?? base;\n } catch {\n return base;\n }\n}\n\n/** @internal The operator as the texts read it: its country named in `locale` (English\n * without one — `countryName`'s rule, so an app that set no locale reads English). */\nexport function legalOperatorText(operator: LegalOperator, locale: string = \"en\"): LegalOperatorText {\n return {\n ...operator,\n country: countryName(operator.country, locale),\n bindingLanguage: operator.bindingLanguage ? languageName(operator.bindingLanguage, locale) : \"\",\n };\n}\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\n/** A kit section whose text is fixed: a heading and one body. */\nexport interface LegalTextSectionLabels {\n title: string;\n body: string;\n}\n\n/**\n * 0.32.0: the imprint's disclaimer, with the body of its COMMERCIAL variant\n * (docs/billing-harmonization.md §8; legal decision 7). The title is the same in both:\n * liability for content and links is the subject either way.\n */\nexport interface LegalDisclaimerSectionLabels extends LegalTextSectionLabels {\n /**\n * The body for `<LegalKitSection section=\"disclaimer\" variant=\"commercial\">`: a paid\n * service sold through a Merchant of Record, which sells in its own name (§2.2), so the\n * \"private, non-commercial … closed beta\" of `body` would be untrue. OPTIONAL, as every\n * key added to a namespace an app may annotate: left out, the provider's, then English.\n */\n commercial?: string;\n}\n\n/** A kit section whose text names the operator (§4.3 `{name}`, `{email}`, …). */\nexport interface LegalOperatorSectionLabels {\n title: string;\n /** Called with the operator, its country already named in the page's language. Line\n * breaks are kept (`white-space: pre-line`): an address is plain lines. */\n body: (operator: LegalOperatorText) => string;\n}\n\n/** A kit section with an app slot (or a list) between its two parts. */\nexport interface LegalFramedSectionLabels {\n title: string;\n /** Before the app's part. */\n lead: string;\n /** After it. */\n tail: string;\n}\n\n/**\n * Every word of the legal pages that is the kit's — docs/legal-harmonization.md §4.3 and\n * §4.4, verbatim. English, British spelling; the other six languages are in the\n * catalogues (`@eifi1/ui-kit/i18n/<code>`).\n *\n * Keys follow the contract: `sections.<page>.<section key>`, the section keys being\n * keksdose's (`legal_basis`, not `legalBasis`), because the same key is the section's\n * `id` (`/privacy#legal_basis`) and the app's own sections sit beside these under the\n * same names in its catalogue. Titles carry NO number: {@link LegalPage} numbers the\n * privacy and terms sections in render order (§4.1).\n */\nexport interface LegalLabels {\n /** The accessible name of {@link LegalLinks}' and {@link LegalFooter}'s `<nav>`. */\n navLabel: string;\n /** The short labels of the three links, everywhere the links appear (§3.3). */\n links: Record<LegalPageKey, string>;\n /** The pages' titles — the `<h1>`, and the links of the terms checkbox. */\n titles: Record<LegalPageKey, string>;\n /** The back link above the title: \"← Back to home\". */\n backHome: string;\n /**\n * The terms checkbox (§3.4) — ONE template with `{terms}` and `{privacy}`, which\n * become the links (named with `titles`). Not a prefix plus a joiner: a language puts\n * the links where its grammar wants them, articles included, and nothing is added\n * around a placeholder — Italian elides, \"e l’{privacy}\", with no space.\n */\n accept: string;\n /** The notice under the title (§3.2): `beta` on the imprint and the terms, `privacy`\n * on the privacy policy. */\n notice: {\n beta: string;\n privacy: string;\n };\n /**\n * 0.28.1: on a page read in another language than the operator's `bindingLanguage` —\n * `note` under the title, `show` on the button that switches to the binding version\n * (when the app passes `onShowBindingLanguage`). `o.bindingLanguage` is the binding\n * language's NAME in the reader's language (\"German\", \"allemand\").\n */\n translation: {\n note: (o: LegalOperatorText) => string;\n show: (o: LegalOperatorText) => string;\n };\n /**\n * 0.51.3: the as-of line under the title (§3.2), \"Last updated: 29 October 2026\" —\n * {@link LegalPage}'s `updated`, called with the date already written out in the page's\n * locale. OPTIONAL, as every key added to a namespace an app may annotate: left out,\n * the provider's, then English.\n */\n updated?: (date: string) => string;\n /** The kit's sections (§4.3), by page and section key. */\n sections: {\n impressum: {\n operator: LegalOperatorSectionLabels;\n contact: LegalOperatorSectionLabels;\n /** `body` is the default, non-commercial text; `commercial` the 0.32 variant. */\n disclaimer: LegalDisclaimerSectionLabels;\n };\n privacy: {\n controller: LegalOperatorSectionLabels;\n /** The app's paragraph follows the body (§4.2): consent, where an app relies on it. */\n legal_basis: LegalTextSectionLabels;\n /** `lead`, then the app's entries as a list, then `tail`, then the app's paragraph. */\n browser: LegalFramedSectionLabels;\n /** `lead` (the rights), then the app's paragraph (export, deletion), then `tail`\n * (the supervisory authorities). */\n rights: LegalFramedSectionLabels;\n contact: LegalOperatorSectionLabels;\n };\n terms: {\n warranty: LegalTextSectionLabels;\n liability: LegalTextSectionLabels;\n changes: LegalTextSectionLabels;\n /** 0.28.1: which language's version prevails — `o.bindingLanguage`, named. */\n language: LegalOperatorSectionLabels;\n /** The place of jurisdiction is the operator's `{city} ({region}), {country}`. */\n law: LegalOperatorSectionLabels;\n };\n };\n}\n\n// Defined in ./legal-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_LEGAL_LABELS };\n\n/** The `legal` namespace, resolved: defaults < provider < `labels` prop. The prop may be\n * partial at every depth (`{ titles: { terms: \"…\" } }`), as the provider's is. */\nexport function useLegalLabels(labels?: LabelOverride<LegalLabels>): LegalLabels {\n return useKitLabels(\"legal\", DEFAULT_LEGAL_LABELS, labels);\n}\n\n// ── What a LegalPage tells the sections inside it ─────────────────────────────\n\n/** Where a `{ref:key}` points: the section's number on a numbered page, else its heading. */\nexport interface LegalRefTarget {\n number?: number;\n heading: ReactNode;\n}\n\n/** @internal Set by `LegalPage` around its column; `null` outside one. */\nexport interface LegalPageContextValue {\n page: LegalPageKey;\n /** The operator with its country named — what the kit sections are filled in with. */\n operator: LegalOperatorText;\n /** The heading level of a section that does not choose one: one below the title. */\n sectionHeading: \"h2\" | \"h3\";\n /** Every section's key, in render order — known BEFORE any section renders, so a\n * reference can point forward (keksdose's section 2 refers to section 10). */\n targets: ReadonlyMap<string, LegalRefTarget>;\n}\n\n/** @internal */\nexport const LegalPageContext = createContext<LegalPageContextValue | null>(null);\n\n/** @internal The place `LegalPage` gave one section: its key and its number. Reset to\n * `null` inside a section, so a section nested in another's children takes neither. */\nexport interface LegalSectionSlot {\n id?: string;\n number?: number;\n}\n\n/** @internal */\nexport const LegalSlotContext = createContext<LegalSectionSlot | null>(null);\n\n/** @internal `{ref:retention}`. A key is a section key: letters, digits, `_` and `-`. */\nconst REF_TOKEN = /\\{ref:([A-Za-z0-9_-]+)\\}/g;\n\n/**\n * A development build's console note — never in production (the consumer's bundler\n * makes `import.meta.env.DEV` false) and never under vitest. Optional-chained:\n * `import.meta.env` is a Vite injection, absent under plain Node.\n */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\nconst warned = new Set<string>();\n/** @internal Once per message. */\nexport function warnLegalOnce(message: string): void {\n if (!devWarnings() || warned.has(message)) return;\n warned.add(message);\n console.warn(`[ui-kit] ${message}`);\n}\n\n/**\n * `text` with every `{ref:key}` replaced by a link to `#key` that reads the section's\n * number — the words around it stay the app's (\"see section {ref:retention}\", \"siehe\n * Abschnitt {ref:retention}\"), so each language keeps its grammar (§4.1). On the imprint,\n * which is not numbered, the link reads the section's heading instead.\n *\n * Outside a {@link LegalPage} the text is returned as it is: there is no order to count.\n * A key the page has no section for stays visible as the raw token — a broken reference\n * an app test can find (`not.toHaveTextContent(\"{ref:\")`), not a silently wrong number.\n */\nexport function resolveLegalRefs(text: string, page: LegalPageContextValue | null): ReactNode {\n if (!page || !text.includes(\"{ref:\")) return text;\n const out: ReactNode[] = [];\n let last = 0;\n for (const match of text.matchAll(REF_TOKEN)) {\n const at = match.index ?? 0;\n if (at > last) out.push(text.slice(last, at));\n const key = match[1];\n const target = page.targets.get(key);\n if (target) {\n out.push(\n <TextLink key={`${key}@${at}`} href={`#${key}`}>\n {target.number ?? target.heading}\n </TextLink>,\n );\n } else {\n warnLegalOnce(`{ref:${key}} on the ${page.page} page points at no section of it.`);\n out.push(match[0]);\n }\n last = at + match[0].length;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\n/** @internal Running text — one translation string — with its line breaks kept and its\n * `{ref:key}` tokens resolved. */\nexport function LegalText({ text, className }: { text: string; className?: string }) {\n const page = useContext(LegalPageContext);\n // `break-words`: an address, an email or a URL in a translation is one long word, and\n // on a 390px phone it would push the column wider than the screen.\n return <p className={cn(\"whitespace-pre-line break-words\", className)}>{resolveLegalRefs(text, page)}</p>;\n}\n\n// ── Links ─────────────────────────────────────────────────────────────────────\n\nexport interface LegalLink {\n href: string;\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n label: ReactNode;\n}\n\nexport interface LegalLinksProps {\n /** Default (0.28): the three routes, `/impressum`, `/privacy` and `/terms`, with the\n * kit's short link labels (`legal.links`), in the contract's order. */\n links?: readonly LegalLink[];\n /** The page being shown; its link is marked `aria-current=\"page\"`. Usually the\n * router's pathname. */\n currentHref?: string;\n /** `false` renders the links without the `<nav>` landmark — inside `AuthLayout`'s\n * `footer` or `TopBarActionMenu`'s `footer`, which are named `<nav>`s already. The row\n * keeps its spacing and `className` either way (0.27.1: it used to return the bare\n * links, so in a plain container — Kurvenschmiede's account-menu `<li>` — they ran\n * together as \"ImpressumDatenschutzerklärungNutz…\" and overflowed). Default true. */\n nav?: boolean;\n /** Called on a click on any of the links, before it navigates — an account menu closes\n * itself here (0.28.1, keksdose: it had to catch the click on a wrapping `<div>`). */\n onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n labels?: LabelOverride<LegalLabels>;\n className?: string;\n}\n\n/** The default links: the three routes under the kit's short labels. */\nfunction defaultLinks(labels: LegalLabels): LegalLink[] {\n return ([\"impressum\", \"privacy\", \"terms\"] as const).map((page) => ({\n href: LEGAL_HREFS[page],\n label: labels.links[page],\n }));\n}\n\n/**\n * The legal pages as a row of quiet links, the one you are on marked (kastlan's\n * `LegalLinks`). Wraps on a phone.\n *\n * 0.28: `·` separators between the links, keksdose's footer style, wherever the links\n * appear — the account menu included (§3.3). The dots are `aria-hidden`: a screen reader\n * already hears three links, and \"middle dot\" between them is noise. They are flex items\n * of the row like the links, so the row's gap spaces them evenly.\n */\nexport function LegalLinks({\n links,\n currentHref,\n nav = true,\n onLinkClick,\n labels: labelsProp,\n className,\n}: LegalLinksProps) {\n const labels = useLegalLabels(labelsProp);\n const shown = links ?? defaultLinks(labels);\n const items = shown.flatMap((link, i) => [\n ...(i > 0 ? [<span key={`sep-${link.href}`} aria-hidden=\"true\">·</span>] : []),\n <TextLink key={link.href} href={link.href} tone=\"muted\" current={link.href === currentHref} onClick={onLinkClick}>\n {link.label}\n </TextLink>,\n ]);\n const rowClass = cn(\"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs\", className);\n if (!nav) return <div className={rowClass}>{items}</div>;\n return (\n <nav aria-label={labels.navLabel} className={rowClass}>\n {items}\n </nav>\n );\n}\n\n// ── Footer ────────────────────────────────────────────────────────────────────\n\nexport interface LegalFooterProps {\n /** Under the links, centred — the app's tagline (keksdose: \"Self-hosted household\n * budgeting & bookkeeping.\"). */\n children?: ReactNode;\n /** Default: the three routes with the kit's link labels — see {@link LegalLinks}. */\n links?: readonly LegalLink[];\n /** Marks that link `aria-current=\"page\"`. {@link LegalPage}'s default footer passes\n * its own page. */\n currentHref?: string;\n /**\n * Default true: the footer is a `<footer>`. `false` draws a `<div>` — for a host that is\n * a footer already: `AuthLayout`'s `footer` slot is one, and HTML forbids a footer inside\n * a footer (0.28.1, kastlan). On an `AuthLayout` page the usual choice is simpler still:\n * `footer={<LegalLinks nav={false} />}` with `footerLabel` set to the kit's `navLabel`\n * ({@link useLegalLabels}).\n */\n landmark?: boolean;\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * The public footer (§3.3): the three links, centred, with their separators, in a\n * `<nav aria-label=\"Legal\">` — on the landing or home page, every signed-out page the app\n * has, the legal pages and the 404. The rule behind it: from every page a signed-out\n * visitor can reach, the three links are one click away.\n *\n * keksdose's `SiteFooter` (features/landing/site-footer.tsx), which carried them on its\n * landing, auth, legal and 404 pages; kastlan and Kurvenschmiede had them on some pages\n * only. Its palette classes (`border-slate-200 bg-white dark:…`) became the surface and\n * border tokens, so it follows the theme like the rest of the kit.\n */\nexport function LegalFooter({ children, links, currentHref, landmark = true, className, labels }: LegalFooterProps) {\n const Root = landmark ? \"footer\" : \"div\";\n return (\n <Root className={cn(\"border-t border-subtle bg-surface\", className)}>\n <div className=\"mx-auto max-w-5xl px-4 py-8 text-sm text-muted\">\n <LegalLinks\n links={links}\n currentHref={currentHref}\n labels={labels}\n className=\"justify-center gap-y-2 text-sm\"\n />\n {children !== undefined && children !== null && <p className=\"mt-4 text-center\">{children}</p>}\n </div>\n </Root>\n );\n}\n\n// ── Section ───────────────────────────────────────────────────────────────────\n\nexport interface LegalSectionProps {\n heading: ReactNode;\n /** Running text. Line breaks in it are kept (`white-space: pre-line`), so a\n * translation can hold an address or a list as plain lines. Inside a\n * {@link LegalPage}, `{ref:key}` becomes the number of section `key`, linked. */\n body?: string;\n /** Anything richer than plain text — links, a list — after `body`. A plain string\n * here has its `{ref:key}` tokens resolved too. */\n children?: ReactNode;\n /**\n * The section's `id`, for a link to it from elsewhere. Inside a {@link LegalPage} it\n * defaults to the element's React `key` — keksdose's\n * `SECTIONS.map((s) => <LegalSection key={s} … />)` gets `id=\"retention\"` with\n * nothing added — and it is the key a `{ref:…}` names.\n */\n id?: string;\n /** The heading's element. Default `h2` under the layout's `h1` (inside a\n * `LegalPage`, one level below its title). */\n headingAs?: \"h2\" | \"h3\";\n}\n\n/**\n * One section: heading and running text.\n *\n * 0.28, inside a {@link LegalPage}: its `id` (the `key` unless given), its number on the\n * privacy policy and the terms (\"3. Legal basis\" — titles carry no number, §4.1), and\n * `{ref:key}` resolution in `body`. Outside one it is exactly the 0.19 section.\n */\nexport function LegalSection({ heading, body, children, id: idProp, headingAs }: LegalSectionProps) {\n const page = useContext(LegalPageContext);\n const slot = useContext(LegalSlotContext);\n const id = idProp ?? slot?.id;\n const number = slot?.number;\n const Heading = headingAs ?? page?.sectionHeading ?? \"h2\";\n return (\n <section id={id} className=\"scroll-mt-20\">\n <Heading className=\"text-lg font-semibold break-words text-primary\">\n {number !== undefined && `${number}. `}\n {heading}\n </Heading>\n <LegalSlotContext.Provider value={null}>\n {body !== undefined && (\n <LegalText text={body} className=\"mt-2 text-sm leading-relaxed text-secondary\" />\n )}\n {children !== undefined && (\n <div className=\"mt-2 text-sm leading-relaxed break-words text-secondary\">\n {typeof children === \"string\" ? resolveLegalRefs(children, page) : children}\n </div>\n )}\n </LegalSlotContext.Provider>\n </section>\n );\n}\n\n// ── Layout ────────────────────────────────────────────────────────────────────\n\nexport interface LegalLayoutProps {\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n title: ReactNode;\n /** Above the title — the app's \"← Back\" link (`<TextLink icon={ArrowLeft}>`). Inside\n * a {@link LegalPage}, \"← Back to home\". */\n back?: ReactNode;\n /**\n * A notice under the title, as a warning banner with `role=\"note\"` — page furniture,\n * not an alert. Per page, not per layout: the privacy page says something more precise\n * than the others (its technical sections describe running code).\n */\n notice?: ReactNode;\n /** 0.51.3: right under the title — {@link LegalPage}'s \"Last updated: …\" line. */\n updated?: ReactNode;\n /** 0.28.1: under the title, before the notice — {@link LegalPage}'s note that this\n * page is a translation and which language is binding. */\n translationNote?: ReactNode;\n /** The sections — {@link LegalSection}s. */\n children: ReactNode;\n /** The three pages, linked at the end of the column with the current one marked.\n * Leave out when the page's chrome already shows them (a {@link LegalFooter}). */\n links?: readonly LegalLink[];\n currentHref?: string;\n /** Default `h1`: the page's heading. */\n headingAs?: \"h1\" | \"h2\";\n /** Extra classes on the column — `px-0 py-0` inside a chrome that pads already. */\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\nexport function LegalLayout({\n title,\n back,\n notice,\n updated,\n translationNote,\n children,\n links,\n currentHref,\n headingAs: Heading = \"h1\",\n className,\n labels,\n}: LegalLayoutProps) {\n return (\n <article className={cn(\"mx-auto w-full max-w-3xl px-4 py-12\", className)}>\n {back !== undefined && <div className=\"mb-4 text-sm\">{back}</div>}\n <Heading className=\"text-3xl font-bold tracking-tight break-words text-primary\">{title}</Heading>\n {updated !== undefined && updated !== null && <p className=\"mt-2 text-sm text-muted\">{updated}</p>}\n {translationNote !== undefined && translationNote !== null && <div className=\"mt-3\">{translationNote}</div>}\n {notice !== undefined && notice !== null && (\n <AlertBanner tone=\"warning\" role=\"note\" className=\"mt-4\">\n {notice}\n </AlertBanner>\n )}\n <div className=\"mt-8 space-y-8\">{children}</div>\n {links !== undefined && links.length > 0 && (\n <LegalLinks links={links} currentHref={currentHref} labels={labels} className=\"mt-12 border-t border-subtle pt-4\" />\n )}\n </article>\n );\n}\n"],"mappings":";AA0UQ,cAmIF,YAnIE;AA1UR,SAAS,eAAe,kBAAkB;AAG1C,SAAS,oBAAoB;AAE7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AA+B9B,MAAM,cAAsD,OAAO,OAAO;AAAA,EAC/E,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AACT,CAAC;AA8CM,SAAS,aAAa,MAAsB;AACjD,SAAO,KAAK,MAAM,MAAM,EAAE,CAAC,EAAG,YAAY;AAC5C;AAEA,MAAM,iBAAiB,oBAAI,IAAsC;AAKjE,SAAS,aAAa,MAAc,QAAwB;AAC1D,MAAI,QAAQ,eAAe,IAAI,MAAM;AACrC,MAAI,UAAU,QAAW;AACvB,QAAI;AACF,cAAQ,IAAI,KAAK,aAAa,CAAC,MAAM,GAAG,EAAE,MAAM,WAAW,CAAC;AAAA,IAC9D,QAAQ;AACN,cAAQ;AAAA,IACV;AACA,mBAAe,IAAI,QAAQ,KAAK;AAAA,EAClC;AACA,QAAM,OAAO,aAAa,IAAI;AAC9B,MAAI;AACF,WAAO,OAAO,GAAG,IAAI,KAAK;AAAA,EAC5B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAIO,SAAS,kBAAkB,UAAyB,SAAiB,MAAyB;AACnG,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS,YAAY,SAAS,SAAS,MAAM;AAAA,IAC7C,iBAAiB,SAAS,kBAAkB,aAAa,SAAS,iBAAiB,MAAM,IAAI;AAAA,EAC/F;AACF;AAgIO,SAAS,eAAe,QAAkD;AAC/E,SAA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EF,oBAAC,SAAI,WAAU,kBAAkB,UAAS;AAAA,IACzC,UAAU,UAAa,MAAM,SAAS,KACrC,oBAAC,cAAW,OAAc,aAA0B,QAAgB,WAAU,qCAAoC;AAAA,KAEtH;AAEJ;","names":[]}
@@ -47,7 +47,7 @@ const roleUtilities = {
47
47
  };
48
48
  }
49
49
  };
50
- const VERSION = true ? "0.51.1" : "0.0.0-source";
50
+ const VERSION = true ? "0.51.3" : "0.0.0-source";
51
51
  const recommended = {
52
52
  name: "@eifi1/ui-kit/recommended",
53
53
  // Not the tests, as check:tokens skips the kit's: a test names the old class to assert it
@@ -886,6 +886,7 @@ function germanLabels(numberLocale) {
886
886
  note: (o) => `Dies ist eine \xDCbersetzung zu Ihrer Information. Massgebend ist die Fassung auf ${o.bindingLanguage}.`,
887
887
  show: (o) => `Fassung auf ${o.bindingLanguage} anzeigen`
888
888
  },
889
+ updated: (date) => `Stand: ${date}`,
889
890
  sections: {
890
891
  impressum: {
891
892
  operator: {
@@ -948,7 +949,7 @@ Die vollst\xE4ndige Postanschrift wird betroffenen Personen und Aufsichtsbeh\xF6
948
949
  },
949
950
  changes: {
950
951
  title: "\xC4nderungen dieser Bedingungen",
951
- body: "Diese Bedingungen k\xF6nnen im Zuge der Weiterentwicklung des Dienstes angepasst werden. Wesentliche \xC4nderungen werden per E-Mail oder in der App angek\xFCndigt; die weitere Nutzung nach einer \xC4nderung gilt als Zustimmung."
952
+ body: "Wir k\xF6nnen diese Bedingungen im Zuge der Weiterentwicklung des Dienstes anpassen. Wesentliche \xC4nderungen k\xFCndigen wir mindestens 30 Tage vor ihrem Inkrafttreten per E-Mail und in der App an, zusammen mit dem neuen Text. Wenn Sie nicht einverstanden sind, k\xF6nnen Sie vor diesem Datum widersprechen oder Ihr Konto l\xF6schen und bis dahin Ihre Daten exportieren. Nutzen Sie den Dienst nach diesem Datum weiter, gelten die ge\xE4nderten Bedingungen."
952
953
  },
953
954
  language: {
954
955
  title: "Sprache",