@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.
- package/dist/components/data-table-fit.js +33 -3
- package/dist/components/data-table-fit.js.map +1 -1
- package/dist/components/legal-labels.js +2 -1
- package/dist/components/legal-labels.js.map +1 -1
- package/dist/components/legal-page.d.ts +18 -3
- package/dist/components/legal-page.js +9 -0
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +10 -1
- package/dist/components/legal.js +2 -0
- package/dist/components/legal.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/i18n/german.js +2 -1
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/locales/en.js +2 -1
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/es.js +2 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +2 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +2 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +2 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +2 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +2 -0
- package/dist/i18n/review.js.map +1 -1
- package/package.json +1 -1
- package/src/components/data-table-fit.ts +54 -4
- package/src/components/legal-labels.ts +2 -1
- package/src/components/legal-page.tsx +33 -2
- package/src/components/legal.tsx +11 -0
- package/src/i18n/german.ts +2 -1
- package/src/i18n/locales/es.ts +2 -1
- package/src/i18n/locales/fr.ts +2 -1
- package/src/i18n/locales/hu.ts +2 -1
- package/src/i18n/locales/it.ts +2 -1
- package/src/i18n/locales/zh.ts +2 -1
- package/src/i18n/review.ts +2 -0
|
@@ -89,8 +89,19 @@ function useColumnFit({
|
|
|
89
89
|
lastShown.current = { avail, rooms };
|
|
90
90
|
setHidden(current2.slice(0, n));
|
|
91
91
|
}, [headRefs]);
|
|
92
|
+
const observer = useRef(null);
|
|
93
|
+
const watched = useRef(null);
|
|
94
|
+
const watchTable = useCallback(() => {
|
|
95
|
+
const ro = observer.current;
|
|
96
|
+
const table = latest.current.scroller()?.querySelector("table") ?? null;
|
|
97
|
+
if (!ro || table === (watched.current?.table ?? null)) return;
|
|
98
|
+
if (watched.current) ro.unobserve(watched.current.table);
|
|
99
|
+
watched.current = table ? { table, width: table.offsetWidth } : null;
|
|
100
|
+
if (table) ro.observe(table);
|
|
101
|
+
}, []);
|
|
92
102
|
const lastContent = useRef(null);
|
|
93
103
|
useLayoutEffect(() => {
|
|
104
|
+
watchTable();
|
|
94
105
|
const now = content ? [...content, order, current, growKey, active] : null;
|
|
95
106
|
const prev = lastContent.current;
|
|
96
107
|
lastContent.current = now;
|
|
@@ -100,10 +111,29 @@ function useColumnFit({
|
|
|
100
111
|
useEffect(() => {
|
|
101
112
|
const el = latest.current.scroller();
|
|
102
113
|
if (!active || !el || typeof ResizeObserver === "undefined") return;
|
|
103
|
-
const ro = new ResizeObserver(() =>
|
|
114
|
+
const ro = new ResizeObserver((entries) => {
|
|
115
|
+
let changed = false;
|
|
116
|
+
for (const entry of entries) {
|
|
117
|
+
if (entry.target === el) changed = true;
|
|
118
|
+
else if (watched.current && entry.target === watched.current.table) {
|
|
119
|
+
const width = entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;
|
|
120
|
+
if (Math.abs(width - watched.current.width) > 0.5) {
|
|
121
|
+
watched.current.width = width;
|
|
122
|
+
changed = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (changed) measure();
|
|
127
|
+
});
|
|
104
128
|
ro.observe(el);
|
|
105
|
-
|
|
106
|
-
|
|
129
|
+
observer.current = ro;
|
|
130
|
+
watchTable();
|
|
131
|
+
return () => {
|
|
132
|
+
ro.disconnect();
|
|
133
|
+
observer.current = null;
|
|
134
|
+
watched.current = null;
|
|
135
|
+
};
|
|
136
|
+
}, [active, measure, watchTable]);
|
|
107
137
|
const keep = useCallback((key, on) => {
|
|
108
138
|
setKept((s) => {
|
|
109
139
|
if (s.has(key) === on) return s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/data-table-fit.ts"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { DataTableColumn } from \"./data-table\";\n\n// DataTable's fit to its own width (0.48, keksdose live #451: \"On expanded sidebar for\n// desktop the table scrolls horizontally. On collapsed sidebar it fits […] Compute the\n// width selectively\"). Two column options, both opt-in:\n//\n// - `grow`: the column takes what the others leave and ellipsises (`w-full max-w-0` on\n// its cells: in an auto table layout that is \"the rest of the row\", never its content's\n// width), so one long title can no longer widen the table.\n// - `fitPriority`: while the table is wider than its scroller — or, with a `grow` column,\n// while that column would get less than {@link GROW_MIN_REM} — the table leaves out\n// its `fitPriority` columns, the LOWEST number first (ties: the later column first),\n// and brings them back in the reverse order as soon as the table, as it is NOW, has\n// room for them (its need re-measured, plus the column's own header width from when\n// it was left out), so narrower content (a filter, another page) counts as much as a\n// wider scroller. The scroller's own width, through a ResizeObserver: a sidebar, a\n// narrower window, the Columns drawer and Large text all count the same. A column\n// whose return the very next measure undoes stays out until the table has more room\n// for it than it had then (0.48.3, keksdose B2: see the bring-back in `measure`).\n\n/** The least a `grow` column keeps before the table starts leaving columns out: about\n * a sentence of a title. In rem, so Large text asks for more. */\nexport const GROW_MIN_REM = 10;\n\n/** The `<th>`/`<td>` classes of a `grow` column. `truncate-until-large`: one line and an\n * ellipsis at Normal, a wrap from Large up (text size §10.17), as every kit title. The\n * header's `min-w-[10rem]` ({@link GROW_MIN_REM}) is the floor once no `fitPriority`\n * column is left to leave out: the table then scrolls sideways rather than crushing the\n * column it exists for (Kurvenschmiede S1, 0.48: Subject was 24px at 1100px). */\nexport const GROW_HEAD_CLASS = \"w-full max-w-0 min-w-[10rem]\";\nexport const GROW_CELL_CLASS = \"w-full max-w-0 truncate-until-large\";\n\n/** Every OTHER cell of a table with a `grow` column (kastlan S2, 0.48). A `w-full` column\n * squeezes the rest to their min-content width, so any text with a space broke in two\n * even at 1920px (\"CHF 2'568.38\", \"Peter Mueller\", a date with its time). One line at\n * Normal, so a column is never narrower than its text and `fitPriority` measures what\n * the columns really need; from Large up the cell wraps as before (§10.17). The headers\n * are `whitespace-nowrap` already. A column whose prose should wrap anyway passes\n * `not-large:whitespace-normal` in its `className`. */\nexport const GROW_PEER_CELL_CLASS = \"not-large:whitespace-nowrap\";\n\n// A cell's own flex-wrap row (chips) is left to wrap beside a `grow` column: a row of\n// badges reads as well stacked, and held to one line it widened the user roster's Status\n// until kastlan's admin pane scrolled 21px at 1280px (0.48 build review 2, kastlan S1).\n\n/** The auto-hide order: lowest `fitPriority` first, the later column first on a tie. */\nexport function fitHideOrder<T>(columns: DataTableColumn<T>[]): DataTableColumn<T>[] {\n return columns\n .map((col, index) => ({ col, index }))\n .filter(({ col }) => col.fitPriority != null)\n .sort((a, b) => a.col.fitPriority! - b.col.fitPriority! || b.index - a.index)\n .map(({ col }) => col);\n}\n\n/**\n * Which columns the table leaves out for width, and the Columns panel's \"keep it\".\n *\n * A column the user TICKS in the Columns panel is theirs: it is never left out for width\n * again while the table is mounted (`keep`): the table makes room by leaving out the next\n * candidate, and scrolls sideways once none is left — what they asked for. Unticking it hides it as before (the persisted `hiddenCols`) and\n * drops the keep. Keeps are not persisted: on the next visit the table fits again.\n */\nexport function useColumnFit<T>({\n columns,\n hiddenCols,\n headRefs,\n scroller,\n enabled,\n content,\n}: {\n columns: DataTableColumn<T>[];\n /** The user's hidden columns: never candidates (they are out already). */\n hiddenCols: Set<string>;\n headRefs: Map<string, HTMLTableCellElement>;\n /** The desktop scroller, read after render (it is declared below the call). */\n scroller: () => HTMLElement | null;\n /** The wide layout. On a phone (the card list) nothing is left out for width. */\n enabled: boolean;\n /**\n * What can change the columns' widths besides the scroller (0.48.2): the rows on\n * screen, the columns, the stored widths, the text size. Compared item by item after\n * each render, and the table is measured only when one changed — a selection tick no\n * longer forces a layout of the whole table. Without it, every render measures.\n */\n content?: readonly unknown[];\n}): {\n /** The columns left out for width now — empty while off. */\n autoHidden: Set<string>;\n /** The user's choice in the Columns panel: `true` keeps the column in whatever the width. */\n keep: (key: string, on: boolean) => void;\n} {\n const [kept, setKept] = useState<ReadonlySet<string>>(() => new Set());\n const [hidden, setHidden] = useState<string[]>([]);\n // A column's own header width, written when it is left out: it comes back once the\n // table's need as it is now, plus this, fits the scroller (keksdose S3, 0.48: not the\n // whole table's need at hide time, which went stale when the content narrowed).\n const ownWidth = useRef(new Map<string, number>());\n // A column whose return the very next measure undid, at the same scroller width: the\n // room the table had for it when it came back (keksdose B2, 0.48.3). It stays out\n // until the table has more. Dropped once the column is no longer left out for width.\n const stuck = useRef(new Map<string, number>());\n // What the last measure brought back, each column with the room it had then, and at\n // which scroller width: read (and cleared) by the measure right after it.\n const lastShown = useRef<{ avail: number; rooms: Map<string, number> } | null>(null);\n\n const hasFit = columns.some((c) => c.fitPriority != null);\n const active = enabled && hasFit;\n const order = useMemo(\n () => fitHideOrder(columns).filter((c) => !hiddenCols.has(c.key) && !kept.has(c.key)),\n [columns, hiddenCols, kept],\n );\n // Only the candidates still in play, in hide order — a column the user hid or kept\n // since, or one the app dropped, is no longer \"hidden for width\".\n const current = useMemo(\n () => (active ? order.filter((c) => hidden.includes(c.key)).map((c) => c.key) : []),\n [active, order, hidden],\n );\n const growKey = columns.find((c) => c.grow && !hiddenCols.has(c.key))?.key;\n\n // What `measure` reads, refreshed after each render (before the measure below runs):\n // the ResizeObserver's callback is set up once and must see the current columns.\n const latest = useRef({ order, current, growKey, active, scroller });\n useLayoutEffect(() => {\n latest.current = { order, current, growKey, active, scroller };\n });\n\n const measure = useCallback(() => {\n const { order, current, growKey, active, scroller } = latest.current;\n // Only the measure right after a bring-back can undo it.\n const flip = lastShown.current;\n lastShown.current = null;\n for (const k of stuck.current.keys()) if (!current.includes(k)) stuck.current.delete(k);\n const el = scroller();\n if (!active || !el) return;\n const table = el.querySelector(\"table\");\n const avail = el.clientWidth;\n // Not laid out (display:none, jsdom): nothing to fit to.\n if (!table || avail <= 0) return;\n const growTh = growKey ? headRefs.get(growKey) : undefined;\n const rem = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n let need = growTh\n ? table.offsetWidth - growTh.offsetWidth + GROW_MIN_REM * rem\n : table.offsetWidth;\n if (!growTh && need <= avail + 0.5 && current.length > 0) {\n // A `w-full` table is at least the scroller's width, which says nothing about how\n // much room its content leaves: probe its content's width (what it takes once it\n // overflows) for the bring-back below. Read and put back in one layout pass.\n const before = table.style.width;\n table.style.width = \"min-content\";\n need = table.offsetWidth;\n table.style.width = before;\n }\n if (need > avail + 0.5) {\n // Leave out, in order, until the rest fits: each column saves its header's width\n // (the others are at their content's width while a `grow` column takes the rest).\n const next = [...current];\n for (const col of order) {\n if (need <= avail + 0.5) break;\n if (next.includes(col.key)) continue;\n const w = headRefs.get(col.key)?.offsetWidth ?? 0;\n ownWidth.current.set(col.key, w);\n need -= w;\n next.push(col.key);\n }\n if (next.length === current.length) return;\n // The last measure brought these back at this same width, and the table cannot\n // hold them: their header width fell short of what they cost drawn (see below).\n if (flip && Math.abs(flip.avail - avail) <= 0.5)\n for (const k of next.slice(current.length)) {\n const room = flip.rooms.get(k);\n if (room != null) stuck.current.set(k, room);\n }\n setHidden(next);\n return;\n }\n // Bring back, the last left out first, while the table as it is now has room for\n // them by their recorded header width. A column that costs more drawn than that is\n // left out again by the next measure, before paint. That alone does not settle it:\n // the re-hide records its header's width again, and the header can measure the same\n // while the column costs more (`virtualize`'s locked widths, keksdose B2, 0.48.3: the\n // drawn column cost the table ~80–110px more than its header), so it came back, went, came back … until React's\n // update limit (#185). So a column whose return the next measure undid, at the same\n // scroller width, waits for more room than it had then: a wider scroller or narrower\n // content. Whatever the error in its width, that is one invisible flip per room it is\n // tried at.\n let n = current.length;\n const rooms = new Map<string, number>();\n while (n > 0) {\n const k = current[n - 1];\n const w = ownWidth.current.get(k);\n if (w == null || need + w > avail + 0.5) break;\n const room = stuck.current.get(k);\n if (room != null && avail - need <= room + 0.5) break;\n rooms.set(k, avail - need);\n need += w;\n n--;\n }\n if (n === current.length) return;\n lastShown.current = { avail, rooms };\n setHidden(current.slice(0, n));\n }, [headRefs]);\n\n // After a render that changed what is drawn: rows, a filter or a page can widen a\n // column as much as a resize. Before paint, so a column the table cannot hold is never\n // drawn first. A render that changed none of it (a ticked box, a focused row) skips the\n // measure, which forces a layout of the whole table (0.48.2, keksdose dev #632).\n const lastContent = useRef<readonly unknown[] | null>(null);\n useLayoutEffect(() => {\n const now = content ? [...content, order, current, growKey, active] : null;\n const prev = lastContent.current;\n lastContent.current = now;\n if (now && prev && prev.length === now.length && prev.every((v, i) => Object.is(v, now[i]))) return;\n measure();\n });\n\n useEffect(() => {\n const el = latest.current.scroller();\n if (!active || !el || typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(() => measure());\n ro.observe(el);\n return () => ro.disconnect();\n }, [active, measure]);\n\n const keep = useCallback((key: string, on: boolean) => {\n setKept((s) => {\n if (s.has(key) === on) return s;\n const next = new Set(s);\n if (on) next.add(key);\n else next.delete(key);\n return next;\n });\n }, []);\n\n const autoHidden = useMemo(() => new Set(current), [current]);\n return { autoHidden, keep };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AAuB5E,MAAM,eAAe;AAOrB,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AASxB,MAAM,uBAAuB;AAO7B,SAAS,aAAgB,SAAqD;AACnF,SAAO,QACJ,IAAI,CAAC,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,EACpC,OAAO,CAAC,EAAE,IAAI,MAAM,IAAI,eAAe,IAAI,EAC3C,KAAK,CAAC,GAAG,MAAM,EAAE,IAAI,cAAe,EAAE,IAAI,eAAgB,EAAE,QAAQ,EAAE,KAAK,EAC3E,IA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,OAAgB;AACrD,YAAQ,CAAC,MAAM;AACb,UAAI,EAAE,IAAI,GAAG,MAAM,GAAI,QAAO;AAC9B,YAAM,OAAO,IAAI,IAAI,CAAC;AACtB,UAAI,GAAI,MAAK,IAAI,GAAG;AAAA,UACf,MAAK,OAAO,GAAG;AACpB,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,aAAa,QAAQ,MAAM,IAAI,IAAI,OAAO,GAAG,CAAC,OAAO,CAAC;AAC5D,SAAO,EAAE,YAAY,KAAK;AAC5B;","names":["order","current","growKey","active","scroller"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/data-table-fit.ts"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { DataTableColumn } from \"./data-table\";\n\n// DataTable's fit to its own width (0.48, keksdose live #451: \"On expanded sidebar for\n// desktop the table scrolls horizontally. On collapsed sidebar it fits […] Compute the\n// width selectively\"). Two column options, both opt-in:\n//\n// - `grow`: the column takes what the others leave and ellipsises (`w-full max-w-0` on\n// its cells: in an auto table layout that is \"the rest of the row\", never its content's\n// width), so one long title can no longer widen the table.\n// - `fitPriority`: while the table is wider than its scroller — or, with a `grow` column,\n// while that column would get less than {@link GROW_MIN_REM} — the table leaves out\n// its `fitPriority` columns, the LOWEST number first (ties: the later column first),\n// and brings them back in the reverse order as soon as the table, as it is NOW, has\n// room for them (its need re-measured, plus the column's own header width from when\n// it was left out), so narrower content (a filter, another page) counts as much as a\n// wider scroller. The scroller's own width, through a ResizeObserver: a sidebar, a\n// narrower window, the Columns drawer and Large text all count the same. A column\n// whose return the very next measure undoes stays out until the table has more room\n// for it than it had then (0.48.3, keksdose B2: see the bring-back in `measure`). And\n// the TABLE's own width, through the same observer (0.51.2): anything that widens it\n// after a measure — rows drawn a frame later, `virtualize` locking its column widths —\n// is measured again, so the table never stays wider than its scroller.\n\n/** The least a `grow` column keeps before the table starts leaving columns out: about\n * a sentence of a title. In rem, so Large text asks for more. */\nexport const GROW_MIN_REM = 10;\n\n/** The `<th>`/`<td>` classes of a `grow` column. `truncate-until-large`: one line and an\n * ellipsis at Normal, a wrap from Large up (text size §10.17), as every kit title. The\n * header's `min-w-[10rem]` ({@link GROW_MIN_REM}) is the floor once no `fitPriority`\n * column is left to leave out: the table then scrolls sideways rather than crushing the\n * column it exists for (Kurvenschmiede S1, 0.48: Subject was 24px at 1100px). */\nexport const GROW_HEAD_CLASS = \"w-full max-w-0 min-w-[10rem]\";\nexport const GROW_CELL_CLASS = \"w-full max-w-0 truncate-until-large\";\n\n/** Every OTHER cell of a table with a `grow` column (kastlan S2, 0.48). A `w-full` column\n * squeezes the rest to their min-content width, so any text with a space broke in two\n * even at 1920px (\"CHF 2'568.38\", \"Peter Mueller\", a date with its time). One line at\n * Normal, so a column is never narrower than its text and `fitPriority` measures what\n * the columns really need; from Large up the cell wraps as before (§10.17). The headers\n * are `whitespace-nowrap` already. A column whose prose should wrap anyway passes\n * `not-large:whitespace-normal` in its `className`. */\nexport const GROW_PEER_CELL_CLASS = \"not-large:whitespace-nowrap\";\n\n// A cell's own flex-wrap row (chips) is left to wrap beside a `grow` column: a row of\n// badges reads as well stacked, and held to one line it widened the user roster's Status\n// until kastlan's admin pane scrolled 21px at 1280px (0.48 build review 2, kastlan S1).\n\n/** The auto-hide order: lowest `fitPriority` first, the later column first on a tie. */\nexport function fitHideOrder<T>(columns: DataTableColumn<T>[]): DataTableColumn<T>[] {\n return columns\n .map((col, index) => ({ col, index }))\n .filter(({ col }) => col.fitPriority != null)\n .sort((a, b) => a.col.fitPriority! - b.col.fitPriority! || b.index - a.index)\n .map(({ col }) => col);\n}\n\n/**\n * Which columns the table leaves out for width, and the Columns panel's \"keep it\".\n *\n * A column the user TICKS in the Columns panel is theirs: it is never left out for width\n * again while the table is mounted (`keep`): the table makes room by leaving out the next\n * candidate, and scrolls sideways once none is left — what they asked for. Unticking it hides it as before (the persisted `hiddenCols`) and\n * drops the keep. Keeps are not persisted: on the next visit the table fits again.\n */\nexport function useColumnFit<T>({\n columns,\n hiddenCols,\n headRefs,\n scroller,\n enabled,\n content,\n}: {\n columns: DataTableColumn<T>[];\n /** The user's hidden columns: never candidates (they are out already). */\n hiddenCols: Set<string>;\n headRefs: Map<string, HTMLTableCellElement>;\n /** The desktop scroller, read after render (it is declared below the call). */\n scroller: () => HTMLElement | null;\n /** The wide layout. On a phone (the card list) nothing is left out for width. */\n enabled: boolean;\n /**\n * What can change the columns' widths besides the scroller (0.48.2): the rows on\n * screen, the columns, the stored widths, the text size. Compared item by item after\n * each render, and the table is measured only when one changed — a selection tick no\n * longer forces a layout of the whole table. Without it, every render measures.\n */\n content?: readonly unknown[];\n}): {\n /** The columns left out for width now — empty while off. */\n autoHidden: Set<string>;\n /** The user's choice in the Columns panel: `true` keeps the column in whatever the width. */\n keep: (key: string, on: boolean) => void;\n} {\n const [kept, setKept] = useState<ReadonlySet<string>>(() => new Set());\n const [hidden, setHidden] = useState<string[]>([]);\n // A column's own header width, written when it is left out: it comes back once the\n // table's need as it is now, plus this, fits the scroller (keksdose S3, 0.48: not the\n // whole table's need at hide time, which went stale when the content narrowed).\n const ownWidth = useRef(new Map<string, number>());\n // A column whose return the very next measure undid, at the same scroller width: the\n // room the table had for it when it came back (keksdose B2, 0.48.3). It stays out\n // until the table has more. Dropped once the column is no longer left out for width.\n const stuck = useRef(new Map<string, number>());\n // What the last measure brought back, each column with the room it had then, and at\n // which scroller width: read (and cleared) by the measure right after it.\n const lastShown = useRef<{ avail: number; rooms: Map<string, number> } | null>(null);\n\n const hasFit = columns.some((c) => c.fitPriority != null);\n const active = enabled && hasFit;\n const order = useMemo(\n () => fitHideOrder(columns).filter((c) => !hiddenCols.has(c.key) && !kept.has(c.key)),\n [columns, hiddenCols, kept],\n );\n // Only the candidates still in play, in hide order — a column the user hid or kept\n // since, or one the app dropped, is no longer \"hidden for width\".\n const current = useMemo(\n () => (active ? order.filter((c) => hidden.includes(c.key)).map((c) => c.key) : []),\n [active, order, hidden],\n );\n const growKey = columns.find((c) => c.grow && !hiddenCols.has(c.key))?.key;\n\n // What `measure` reads, refreshed after each render (before the measure below runs):\n // the ResizeObserver's callback is set up once and must see the current columns.\n const latest = useRef({ order, current, growKey, active, scroller });\n useLayoutEffect(() => {\n latest.current = { order, current, growKey, active, scroller };\n });\n\n const measure = useCallback(() => {\n const { order, current, growKey, active, scroller } = latest.current;\n // Only the measure right after a bring-back can undo it.\n const flip = lastShown.current;\n lastShown.current = null;\n for (const k of stuck.current.keys()) if (!current.includes(k)) stuck.current.delete(k);\n const el = scroller();\n if (!active || !el) return;\n const table = el.querySelector(\"table\");\n const avail = el.clientWidth;\n // Not laid out (display:none, jsdom): nothing to fit to.\n if (!table || avail <= 0) return;\n const growTh = growKey ? headRefs.get(growKey) : undefined;\n const rem = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n let need = growTh\n ? table.offsetWidth - growTh.offsetWidth + GROW_MIN_REM * rem\n : table.offsetWidth;\n if (!growTh && need <= avail + 0.5 && current.length > 0) {\n // A `w-full` table is at least the scroller's width, which says nothing about how\n // much room its content leaves: probe its content's width (what it takes once it\n // overflows) for the bring-back below. Read and put back in one layout pass.\n const before = table.style.width;\n table.style.width = \"min-content\";\n need = table.offsetWidth;\n table.style.width = before;\n }\n if (need > avail + 0.5) {\n // Leave out, in order, until the rest fits: each column saves its header's width\n // (the others are at their content's width while a `grow` column takes the rest).\n const next = [...current];\n for (const col of order) {\n if (need <= avail + 0.5) break;\n if (next.includes(col.key)) continue;\n const w = headRefs.get(col.key)?.offsetWidth ?? 0;\n ownWidth.current.set(col.key, w);\n need -= w;\n next.push(col.key);\n }\n if (next.length === current.length) return;\n // The last measure brought these back at this same width, and the table cannot\n // hold them: their header width fell short of what they cost drawn (see below).\n if (flip && Math.abs(flip.avail - avail) <= 0.5)\n for (const k of next.slice(current.length)) {\n const room = flip.rooms.get(k);\n if (room != null) stuck.current.set(k, room);\n }\n setHidden(next);\n return;\n }\n // Bring back, the last left out first, while the table as it is now has room for\n // them by their recorded header width. A column that costs more drawn than that is\n // left out again by the next measure, before paint. That alone does not settle it:\n // the re-hide records its header's width again, and the header can measure the same\n // while the column costs more (`virtualize`'s locked widths, keksdose B2, 0.48.3: the\n // drawn column cost the table ~80–110px more than its header), so it came back, went, came back … until React's\n // update limit (#185). So a column whose return the next measure undid, at the same\n // scroller width, waits for more room than it had then: a wider scroller or narrower\n // content. Whatever the error in its width, that is one invisible flip per room it is\n // tried at.\n let n = current.length;\n const rooms = new Map<string, number>();\n while (n > 0) {\n const k = current[n - 1];\n const w = ownWidth.current.get(k);\n if (w == null || need + w > avail + 0.5) break;\n const room = stuck.current.get(k);\n if (room != null && avail - need <= room + 0.5) break;\n rooms.set(k, avail - need);\n need += w;\n n--;\n }\n if (n === current.length) return;\n lastShown.current = { avail, rooms };\n setHidden(current.slice(0, n));\n }, [headRefs]);\n\n // The table the observer below watches, kept to this render's.\n const observer = useRef<ResizeObserver | null>(null);\n const watched = useRef<{ table: Element; width: number } | null>(null);\n const watchTable = useCallback(() => {\n const ro = observer.current;\n const table = latest.current.scroller()?.querySelector(\"table\") ?? null;\n if (!ro || table === (watched.current?.table ?? null)) return;\n if (watched.current) ro.unobserve(watched.current.table);\n // Its width now, as the measure that just ran saw it: a report of the same width is\n // not news, one that differs is (it may come a frame later, rows drawn by then).\n watched.current = table ? { table, width: (table as HTMLElement).offsetWidth } : null;\n if (table) ro.observe(table);\n }, []);\n\n // After a render that changed what is drawn: rows, a filter or a page can widen a\n // column as much as a resize. Before paint, so a column the table cannot hold is never\n // drawn first. A render that changed none of it (a ticked box, a focused row) skips the\n // measure, which forces a layout of the whole table (0.48.2, keksdose dev #632).\n const lastContent = useRef<readonly unknown[] | null>(null);\n useLayoutEffect(() => {\n // The table the observer watches is this render's (a table drawn after a loading\n // state, or remounted, is a new element).\n watchTable();\n const now = content ? [...content, order, current, growKey, active] : null;\n const prev = lastContent.current;\n lastContent.current = now;\n if (now && prev && prev.length === now.length && prev.every((v, i) => Object.is(v, now[i]))) return;\n measure();\n });\n\n // The scroller, and the table in it (0.51.2, keksdose's register). The fit measured\n // after a render that changed `content` and when the SCROLLER changed size, but the table\n // also widens on its own after that: under `virtualize` the rows actually drawn are the\n // window's, set a frame later, and its column-width lock lands a frame later still —\n // neither is `content`, and the scroller keeps its size. A load whose first measure saw\n // the table before its rows were in kept every `fitPriority` column and then overflowed\n // for good (893px in 757 at 1124, 1058 in 913 at 1280, on 0.50.1 as on 0.51). Watched,\n // a table that grows past what was measured is measured again. Only a WIDTH change of\n // the table counts: its height moves with every row the window draws, and each measure\n // lays the whole table out.\n useEffect(() => {\n const el = latest.current.scroller();\n if (!active || !el || typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver((entries) => {\n let changed = false;\n for (const entry of entries) {\n if (entry.target === el) changed = true;\n else if (watched.current && entry.target === watched.current.table) {\n // The border box, as `offsetWidth` reads it (the content rect leaves the border out).\n const width = entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;\n if (Math.abs(width - watched.current.width) > 0.5) {\n watched.current.width = width;\n changed = true;\n }\n }\n }\n if (changed) measure();\n });\n ro.observe(el);\n observer.current = ro;\n watchTable();\n return () => {\n ro.disconnect();\n observer.current = null;\n watched.current = null;\n };\n }, [active, measure, watchTable]);\n\n const keep = useCallback((key: string, on: boolean) => {\n setKept((s) => {\n if (s.has(key) === on) return s;\n const next = new Set(s);\n if (on) next.add(key);\n else next.delete(key);\n return next;\n });\n }, []);\n\n const autoHidden = useMemo(() => new Set(current), [current]);\n return { autoHidden, keep };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AA0B5E,MAAM,eAAe;AAOrB,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AASxB,MAAM,uBAAuB;AAO7B,SAAS,aAAgB,SAAqD;AACnF,SAAO,QACJ,IAAI,CAAC,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,EACpC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AAG;AACpB,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,aAAa,QAAQ,MAAM,IAAI,IAAI,OAAO,GAAG,CAAC,OAAO,CAAC;AAC5D,SAAO,EAAE,YAAY,KAAK;AAC5B;","names":["order","current","growKey","active","scroller"]}
|
|
@@ -21,6 +21,7 @@ const DEFAULT_LEGAL_LABELS = {
|
|
|
21
21
|
note: (o) => `This is a translation for your convenience. The ${o.bindingLanguage} version is binding.`,
|
|
22
22
|
show: (o) => `Show the ${o.bindingLanguage} version`
|
|
23
23
|
},
|
|
24
|
+
updated: (date) => `Last updated: ${date}`,
|
|
24
25
|
sections: {
|
|
25
26
|
impressum: {
|
|
26
27
|
operator: {
|
|
@@ -81,7 +82,7 @@ The full postal address is supplied on request to data subjects and supervisory
|
|
|
81
82
|
},
|
|
82
83
|
changes: {
|
|
83
84
|
title: "Changes to these terms",
|
|
84
|
-
body: "
|
|
85
|
+
body: "We may update these terms as the service evolves. We announce a material change at least 30 days before it takes effect, by email and in the app, together with the new text. If you do not agree, you can object or delete your account before that date, and you can export your data until then. If you keep using the service after that date, the changed terms apply."
|
|
85
86
|
},
|
|
86
87
|
language: {
|
|
87
88
|
title: "Language",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/legal-labels.ts"],"sourcesContent":["// The English words of ./legal, in a module with no component code: the English catalogue\n// (src/i18n/defaults.ts) imports them without the component, so `en` loads as one chunk\n// like the other languages (0.34, KS U8). ./legal re-exports them.\n\nimport type { LegalLabels } from \"./legal\";\n\nexport const DEFAULT_LEGAL_LABELS: LegalLabels = {\n navLabel: \"Legal\",\n links: {\n impressum: \"Imprint\",\n privacy: \"Privacy Policy\",\n terms: \"Terms\",\n },\n titles: {\n impressum: \"Imprint\",\n privacy: \"Privacy Policy\",\n terms: \"Terms of Service\",\n },\n backHome: \"Back to home\",\n accept: \"I accept the {terms} and the {privacy}\",\n notice: {\n beta: \"Closed beta. These texts have not been reviewed by a lawyer yet and will be before a public launch.\",\n privacy:\n \"Closed beta. The legal wording below has not been reviewed by a lawyer yet and will be before a public launch. The technical descriptions — what is stored, where, and who can read it — describe what the software actually does today, and are meant to be checked against it.\",\n },\n translation: {\n note: (o) =>\n `This is a translation for your convenience. The ${o.bindingLanguage} version is binding.`,\n show: (o) => `Show the ${o.bindingLanguage} version`,\n },\n sections: {\n impressum: {\n operator: {\n title: \"Operator\",\n body: (o) =>\n `${o.name}\\n${o.postalCode} ${o.city}\\n${o.country}\\n\\nThe full postal address is supplied on request to anyone with a legitimate legal interest; write to the contact address below.`,\n },\n contact: {\n title: \"Contact\",\n body: (o) => `Email: ${o.email}`,\n },\n disclaimer: {\n title: \"Liability for content and links\",\n body: \"This is a private, non-commercial project offered during a closed beta, without warranty. External sites we link to are the responsibility of their respective operators; we have no control over their content.\",\n commercial:\n \"This is a commercial service. Paid plans are sold by our reseller, which acts as the Merchant of Record: it sells the subscription in its own name, takes the payment, issues the invoice and handles VAT, and its terms of sale apply to the purchase. We take care that the content of this service is accurate, but cannot guarantee that it is complete or up to date. External sites we link to are the responsibility of their respective operators; we have no control over their content.\",\n },\n },\n privacy: {\n controller: {\n title: \"Controller\",\n body: (o) =>\n `The party responsible for processing personal data in this service is:\\n${o.name}\\n${o.postalCode} ${o.city}, ${o.country}\\nEmail: ${o.email}\\n\\nThe full postal address is supplied on request to data subjects and supervisory authorities.`,\n },\n legal_basis: {\n title: \"Legal basis\",\n body: \"As the operator is based in Switzerland, processing is governed by the Swiss Federal Act on Data Protection (FADP). Where the EU General Data Protection Regulation (GDPR) applies to you, we rely on the performance of a contract to provide the service (Art. 6(1)(b) GDPR) and our legitimate interest in operating and securing it (Art. 6(1)(f) GDPR).\",\n },\n browser: {\n title: \"What your browser stores\",\n lead: \"No cookies. The app keeps the following in your browser's storage:\",\n tail: \"None of it is used to track you. Entries waiting to be sent are sent to us as soon as they can be; everything else stays on your device. All of it disappears when you clear the site's data, and signing out removes the sign-in tokens.\",\n },\n rights: {\n title: \"Your rights\",\n lead: \"You have the right to access, rectification, erasure, restriction, data portability and objection.\",\n tail: \"If you are in Switzerland you may contact the Federal Data Protection and Information Commissioner (FDPIC); if you are in the EU you may lodge a complaint with your local supervisory authority.\",\n },\n contact: {\n title: \"Contact for data protection\",\n body: (o) => `For any privacy request, contact: ${o.email}`,\n },\n },\n terms: {\n warranty: {\n title: \"No warranty\",\n body: 'The service is provided \"as is\" and \"as available\", without warranties of any kind to the extent permitted by law. As a beta it may contain errors, change, or be interrupted at any time — keep your own backups of important data.',\n },\n liability: {\n title: \"Limitation of liability\",\n body: \"To the extent permitted by applicable law, the operator is not liable for any indirect or consequential damage arising from the use of, or inability to use, the service. Nothing here limits liability that cannot be limited by law.\",\n },\n changes: {\n title: \"Changes to these terms\",\n body: \"
|
|
1
|
+
{"version":3,"sources":["../../src/components/legal-labels.ts"],"sourcesContent":["// The English words of ./legal, in a module with no component code: the English catalogue\n// (src/i18n/defaults.ts) imports them without the component, so `en` loads as one chunk\n// like the other languages (0.34, KS U8). ./legal re-exports them.\n\nimport type { LegalLabels } from \"./legal\";\n\nexport const DEFAULT_LEGAL_LABELS: LegalLabels = {\n navLabel: \"Legal\",\n links: {\n impressum: \"Imprint\",\n privacy: \"Privacy Policy\",\n terms: \"Terms\",\n },\n titles: {\n impressum: \"Imprint\",\n privacy: \"Privacy Policy\",\n terms: \"Terms of Service\",\n },\n backHome: \"Back to home\",\n accept: \"I accept the {terms} and the {privacy}\",\n notice: {\n beta: \"Closed beta. These texts have not been reviewed by a lawyer yet and will be before a public launch.\",\n privacy:\n \"Closed beta. The legal wording below has not been reviewed by a lawyer yet and will be before a public launch. The technical descriptions — what is stored, where, and who can read it — describe what the software actually does today, and are meant to be checked against it.\",\n },\n translation: {\n note: (o) =>\n `This is a translation for your convenience. The ${o.bindingLanguage} version is binding.`,\n show: (o) => `Show the ${o.bindingLanguage} version`,\n },\n updated: (date) => `Last updated: ${date}`,\n sections: {\n impressum: {\n operator: {\n title: \"Operator\",\n body: (o) =>\n `${o.name}\\n${o.postalCode} ${o.city}\\n${o.country}\\n\\nThe full postal address is supplied on request to anyone with a legitimate legal interest; write to the contact address below.`,\n },\n contact: {\n title: \"Contact\",\n body: (o) => `Email: ${o.email}`,\n },\n disclaimer: {\n title: \"Liability for content and links\",\n body: \"This is a private, non-commercial project offered during a closed beta, without warranty. External sites we link to are the responsibility of their respective operators; we have no control over their content.\",\n commercial:\n \"This is a commercial service. Paid plans are sold by our reseller, which acts as the Merchant of Record: it sells the subscription in its own name, takes the payment, issues the invoice and handles VAT, and its terms of sale apply to the purchase. We take care that the content of this service is accurate, but cannot guarantee that it is complete or up to date. External sites we link to are the responsibility of their respective operators; we have no control over their content.\",\n },\n },\n privacy: {\n controller: {\n title: \"Controller\",\n body: (o) =>\n `The party responsible for processing personal data in this service is:\\n${o.name}\\n${o.postalCode} ${o.city}, ${o.country}\\nEmail: ${o.email}\\n\\nThe full postal address is supplied on request to data subjects and supervisory authorities.`,\n },\n legal_basis: {\n title: \"Legal basis\",\n body: \"As the operator is based in Switzerland, processing is governed by the Swiss Federal Act on Data Protection (FADP). Where the EU General Data Protection Regulation (GDPR) applies to you, we rely on the performance of a contract to provide the service (Art. 6(1)(b) GDPR) and our legitimate interest in operating and securing it (Art. 6(1)(f) GDPR).\",\n },\n browser: {\n title: \"What your browser stores\",\n lead: \"No cookies. The app keeps the following in your browser's storage:\",\n tail: \"None of it is used to track you. Entries waiting to be sent are sent to us as soon as they can be; everything else stays on your device. All of it disappears when you clear the site's data, and signing out removes the sign-in tokens.\",\n },\n rights: {\n title: \"Your rights\",\n lead: \"You have the right to access, rectification, erasure, restriction, data portability and objection.\",\n tail: \"If you are in Switzerland you may contact the Federal Data Protection and Information Commissioner (FDPIC); if you are in the EU you may lodge a complaint with your local supervisory authority.\",\n },\n contact: {\n title: \"Contact for data protection\",\n body: (o) => `For any privacy request, contact: ${o.email}`,\n },\n },\n terms: {\n warranty: {\n title: \"No warranty\",\n body: 'The service is provided \"as is\" and \"as available\", without warranties of any kind to the extent permitted by law. As a beta it may contain errors, change, or be interrupted at any time — keep your own backups of important data.',\n },\n liability: {\n title: \"Limitation of liability\",\n body: \"To the extent permitted by applicable law, the operator is not liable for any indirect or consequential damage arising from the use of, or inability to use, the service. Nothing here limits liability that cannot be limited by law.\",\n },\n changes: {\n title: \"Changes to these terms\",\n body: \"We may update these terms as the service evolves. We announce a material change at least 30 days before it takes effect, by email and in the app, together with the new text. If you do not agree, you can object or delete your account before that date, and you can export your data until then. If you keep using the service after that date, the changed terms apply.\",\n },\n language: {\n title: \"Language\",\n body: (o) =>\n `These terms are written in ${o.bindingLanguage}. Translations into other languages are provided for convenience only; where a translation differs, the ${o.bindingLanguage} version prevails.`,\n },\n law: {\n title: \"Governing law\",\n body: (o) =>\n `These terms are governed by Swiss law, excluding its conflict-of-laws rules. As far as legally permissible, the place of jurisdiction is ${o.city} (${o.region}), ${o.country}.`,\n },\n },\n },\n};\n"],"mappings":";AAMO,MAAM,uBAAoC;AAAA,EAC/C,UAAU;AAAA,EACV,OAAO;AAAA,IACL,WAAW;AAAA,IACX,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,EACJ;AAAA,EACA,aAAa;AAAA,IACX,MAAM,CAAC,MACL,mDAAmD,EAAE,eAAe;AAAA,IACtE,MAAM,CAAC,MAAM,YAAY,EAAE,eAAe;AAAA,EAC5C;AAAA,EACA,SAAS,CAAC,SAAS,iBAAiB,IAAI;AAAA,EACxC,UAAU;AAAA,IACR,WAAW;AAAA,MACT,UAAU;AAAA,QACR,OAAO;AAAA,QACP,MAAM,CAAC,MACL,GAAG,EAAE,IAAI;AAAA,EAAK,EAAE,UAAU,IAAI,EAAE,IAAI;AA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F;AACF;","names":[]}
|
|
@@ -138,6 +138,18 @@ export interface LegalPageProps {
|
|
|
138
138
|
/** Default: the kit's beta notice on the imprint and the terms, its privacy notice on
|
|
139
139
|
* the privacy policy (§3.2). `null` for none. */
|
|
140
140
|
notice?: ReactNode;
|
|
141
|
+
/**
|
|
142
|
+
* 0.51.3: the day this page's text last changed, "YYYY-MM-DD" (legal benchmark
|
|
143
|
+
* 2026-10-29, gap 8). Shown under the title as `legal.updated` — "Last updated:
|
|
144
|
+
* 29 October 2026", "Stand: 29. Oktober 2026" — with the date written out in `locale`,
|
|
145
|
+
* so it follows the page's language like every other kit word, the switch to the
|
|
146
|
+
* binding version included. Left out, no line. One date per page: the imprint, the
|
|
147
|
+
* privacy policy and the terms change on their own days.
|
|
148
|
+
*
|
|
149
|
+
* An app that records which terms someone accepted (keksdose) stores the terms page's
|
|
150
|
+
* date: it is the version the reader saw.
|
|
151
|
+
*/
|
|
152
|
+
updated?: string;
|
|
141
153
|
/**
|
|
142
154
|
* 0.28.1: switches the app to the operator's `bindingLanguage` — the button after the
|
|
143
155
|
* translation note on a page read in another language. Without it the note stands
|
|
@@ -172,6 +184,7 @@ export interface LegalPageProps {
|
|
|
172
184
|
*
|
|
173
185
|
* What it adds to the column:
|
|
174
186
|
* - the title, from `legal.titles`, and "← Back to home" pointing at `homeHref`;
|
|
187
|
+
* - the as-of line under the title, from `updated` (0.51.3);
|
|
175
188
|
* - the default notice per page — the beta notice, or the privacy notice on the privacy
|
|
176
189
|
* policy, whose technical sections describe running code (§3.2, §7.3);
|
|
177
190
|
* - numbers: the privacy and terms sections are "N. Title" in render order, the
|
|
@@ -184,7 +197,7 @@ export interface LegalPageProps {
|
|
|
184
197
|
* (see `children` for what that asks of the tree);
|
|
185
198
|
* - `useNoIndex()`.
|
|
186
199
|
*/
|
|
187
|
-
export declare function LegalPage({ page, operator, children, header, footer, homeHref, notice, onShowBindingLanguage, locale: localeProp, headingAs, landmark, noIndex, className, labels: labelsProp, }: LegalPageProps): import("react").JSX.Element;
|
|
200
|
+
export declare function LegalPage({ page, operator, children, header, footer, homeHref, notice, updated, onShowBindingLanguage, locale: localeProp, headingAs, landmark, noIndex, className, labels: labelsProp, }: LegalPageProps): import("react").JSX.Element;
|
|
188
201
|
export interface LegalAcceptCheckboxProps extends Omit<CheckboxProps, "label" | "checked" | "onCheckedChange" | "required"> {
|
|
189
202
|
checked: boolean;
|
|
190
203
|
onCheckedChange: (checked: boolean) => void;
|
|
@@ -201,8 +214,10 @@ export interface LegalAcceptCheckboxProps extends Omit<CheckboxProps, "label" |
|
|
|
201
214
|
*
|
|
202
215
|
* A REQUIRED kit `Checkbox` — not a Switch: a form answer that waits for the submit
|
|
203
216
|
* button. The app keeps its submit disabled while it is unticked, so there is never a
|
|
204
|
-
* failed attempt and no `error` to show.
|
|
205
|
-
*
|
|
217
|
+
* failed attempt and no `error` to show. The checkbox itself sends nothing and asks for
|
|
218
|
+
* no re-acceptance (Marcel, §2.4). An app that records which terms someone accepted
|
|
219
|
+
* stores, with the account, the terms page's `updated` date — the version the reader
|
|
220
|
+
* saw — on its own (keksdose since 2026-10-29; §3.4).
|
|
206
221
|
*
|
|
207
222
|
* The label is ONE template, `legal.accept`, so a language puts the links where its
|
|
208
223
|
* grammar needs them, articles included — fr "J’accepte les {terms} et la {privacy}",
|
|
@@ -5,6 +5,8 @@ import { ArrowLeft } from "lucide-react";
|
|
|
5
5
|
import { UiKitProvider, useKitLocale } from "../i18n/kit-labels.js";
|
|
6
6
|
import { useNoIndex } from "../hooks/use-noindex.js";
|
|
7
7
|
import { cn } from "../lib/cn.js";
|
|
8
|
+
import { parseIsoDate } from "../lib/dates.js";
|
|
9
|
+
import { formatDate } from "../lib/format.js";
|
|
8
10
|
import { Checkbox } from "./checkbox.js";
|
|
9
11
|
import {
|
|
10
12
|
DEFAULT_LEGAL_LABELS,
|
|
@@ -185,6 +187,7 @@ function LegalPage({
|
|
|
185
187
|
footer,
|
|
186
188
|
homeHref = "/",
|
|
187
189
|
notice,
|
|
190
|
+
updated,
|
|
188
191
|
onShowBindingLanguage,
|
|
189
192
|
locale: localeProp,
|
|
190
193
|
headingAs = "h1",
|
|
@@ -218,6 +221,11 @@ function LegalPage({
|
|
|
218
221
|
/* @__PURE__ */ jsx(Button, { type: "button", variant: "link", size: "sm", className: "h-auto p-0 align-baseline", onClick: onShowBindingLanguage, children: labels.translation.show(operatorText) })
|
|
219
222
|
] })
|
|
220
223
|
] }) : void 0;
|
|
224
|
+
const updatedValid = updated !== void 0 && parseIsoDate(updated) !== null;
|
|
225
|
+
if (updated !== void 0 && !updatedValid) {
|
|
226
|
+
warnLegalOnce(`LegalPage: updated="${updated}" is not a "YYYY-MM-DD" date; no "Last updated" line is shown.`);
|
|
227
|
+
}
|
|
228
|
+
const updatedLine = updatedValid ? /* @__PURE__ */ jsx("time", { dateTime: updated, children: (labels.updated ?? DEFAULT_LEGAL_LABELS.updated)(formatDate(updated, "long", { locale })) }) : void 0;
|
|
221
229
|
return /* @__PURE__ */ jsx(UiKitProvider, { labels: overrides, children: /* @__PURE__ */ jsxs("div", { className: cn("flex min-h-full flex-col", className), children: [
|
|
222
230
|
header,
|
|
223
231
|
/* @__PURE__ */ jsx(Main, { className: "flex-1", children: /* @__PURE__ */ jsx(LegalPageContext.Provider, { value: context, children: /* @__PURE__ */ jsx(
|
|
@@ -226,6 +234,7 @@ function LegalPage({
|
|
|
226
234
|
back: /* @__PURE__ */ jsx(TextLink, { href: homeHref, icon: ArrowLeft, children: labels.backHome }),
|
|
227
235
|
title: labels.titles[page],
|
|
228
236
|
notice: shownNotice,
|
|
237
|
+
updated: updatedLine,
|
|
229
238
|
translationNote,
|
|
230
239
|
headingAs,
|
|
231
240
|
children: nodes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/legal-page.tsx"],"sourcesContent":["import { Fragment, isValidElement, useContext, useMemo } from \"react\";\nimport type { ReactNode, Ref } from \"react\";\nimport { ArrowLeft } from \"lucide-react\";\n\nimport { UiKitProvider, useKitLocale } from \"../i18n/kit-labels\";\nimport type { LabelOverride, UiKitLabelOverrides } from \"../i18n/kit-labels\";\nimport { useNoIndex } from \"../hooks/use-noindex\";\nimport { cn } from \"../lib/cn\";\nimport { Checkbox } from \"./checkbox\";\nimport type { CheckboxProps } from \"./checkbox\";\nimport {\n DEFAULT_LEGAL_LABELS,\n LEGAL_HREFS,\n baseLanguage,\n LegalFooter,\n LegalLayout,\n LegalPageContext,\n LegalSection,\n LegalSlotContext,\n LegalText,\n legalOperatorText,\n useLegalLabels,\n warnLegalOnce,\n} from \"./legal\";\nimport type {\n LegalDisclaimerSectionLabels,\n LegalFramedSectionLabels,\n LegalLabels,\n LegalOperator,\n LegalOperatorSectionLabels,\n LegalOperatorText,\n LegalPageContextValue,\n LegalPageKey,\n LegalRefTarget,\n LegalSectionProps,\n LegalTextSectionLabels,\n} from \"./legal\";\nimport { TextLink } from \"./text-link\";\nimport { Button } from \"./button\";\n\n/**\n * The legal pages' frame and the kit's own sections — docs/legal-harmonization.md §3\n * and §4, the 0.28 round. The labels, the column, `LegalSection`, the links and the\n * footer are in `./legal`.\n */\n\n// ── The skeleton (§4.2) ───────────────────────────────────────────────────────\n\n/** Who writes a section: the kit's wording, the app's own, or the kit's wording with an\n * app paragraph in a fixed slot. */\nexport type LegalSectionOwner = \"kit\" | \"app\" | \"kit+app\";\n\nexport interface LegalSkeletonEntry {\n /** The section key — its `id` and its catalogue key. `\"*\"` is the slot where the\n * app's own sections go (zero or more: keksdose's `credits`, `price_pool`, …). */\n key: string;\n owner: LegalSectionOwner;\n}\n\nexport interface LegalSkeletonPage {\n /** Whether the page numbers its sections (\"3. Legal basis\"). The imprint does not. */\n numbered: boolean;\n /** The sections in their order. */\n sections: readonly LegalSkeletonEntry[];\n}\n\n/**\n * The section order every app's legal pages follow (§4.2), as data — so an app's test\n * can assert that its pages do, and so the order lives in one place, not in three apps'\n * reading of a table. `LegalPage` reads `numbered` from it.\n *\n * An app's test, given the section ids its page rendered in order:\n *\n * const fixed = LEGAL_SKELETON.privacy.sections.map((s) => s.key).filter((k) => k !== \"*\");\n * expect(ids.filter((id) => fixed.includes(id))).toEqual(fixed);\n *\n * Every fixed key is there, in the skeleton's order; the ids that are not in it are the\n * app's own sections, which belong where `\"*\"` stands.\n */\nexport const LEGAL_SKELETON: Readonly<Record<LegalPageKey, LegalSkeletonPage>> = Object.freeze({\n impressum: Object.freeze({\n numbered: false,\n sections: Object.freeze([\n { key: \"operator\", owner: \"kit\" },\n { key: \"contact\", owner: \"kit\" },\n { key: \"disclaimer\", owner: \"kit\" },\n { key: \"*\", owner: \"app\" },\n ] as const),\n }),\n privacy: Object.freeze({\n numbered: true,\n sections: Object.freeze([\n { key: \"controller\", owner: \"kit\" },\n { key: \"data\", owner: \"app\" },\n { key: \"legal_basis\", owner: \"kit+app\" },\n { key: \"third_parties\", owner: \"app\" },\n { key: \"*\", owner: \"app\" },\n { key: \"browser\", owner: \"kit+app\" },\n { key: \"transfers\", owner: \"app\" },\n { key: \"retention\", owner: \"app\" },\n { key: \"rights\", owner: \"kit+app\" },\n { key: \"contact\", owner: \"kit\" },\n ] as const),\n }),\n terms: Object.freeze({\n numbered: true,\n sections: Object.freeze([\n { key: \"scope\", owner: \"app\" },\n { key: \"no_advice\", owner: \"app\" },\n { key: \"*\", owner: \"app\" },\n { key: \"warranty\", owner: \"kit\" },\n { key: \"liability\", owner: \"kit\" },\n { key: \"changes\", owner: \"kit\" },\n // 0.28.1: which language's version prevails (the operator's `bindingLanguage`).\n { key: \"language\", owner: \"kit\" },\n { key: \"law\", owner: \"kit\" },\n ] as const),\n }),\n});\n\n/** The sections the kit writes (§4.3), on whichever page they sit. `contact` is on two\n * pages, with two texts; the page decides which. */\nexport type LegalKitSectionKey =\n | \"operator\"\n | \"contact\"\n | \"disclaimer\"\n | \"controller\"\n | \"legal_basis\"\n | \"browser\"\n | \"rights\"\n | \"warranty\"\n | \"liability\"\n | \"changes\"\n | \"language\"\n | \"law\";\n\n/** The kit's sections of one page, in the skeleton's order. */\nfunction kitSectionsOf(page: LegalPageKey): string[] {\n return LEGAL_SKELETON[page].sections.filter((s) => s.owner !== \"app\").map((s) => s.key);\n}\n\nconst PAGES: readonly LegalPageKey[] = [\"impressum\", \"privacy\", \"terms\"];\n\n// ── Kit sections ──────────────────────────────────────────────────────────────\n\ninterface LegalKitSectionBase {\n /** Default: the enclosing {@link LegalPage}'s page — needed outside one, and for\n * `contact` only (it is on two pages). */\n page?: LegalPageKey;\n /** Default: the enclosing {@link LegalPage}'s operator — needed outside one, by the\n * sections that name it (operator, both contacts, controller, law). */\n operator?: LegalOperator;\n /** Default: one level below the page's title (`h2` under an `h1`). */\n headingAs?: \"h2\" | \"h3\";\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * One of the kit's sections, by key. `children` is the app's paragraph where §4.2 says\n * \"kit + app\" — and only there, which the type holds an app to: the other sections'\n * wording is identical in every app, and an app that needs to say more says it in a\n * section of its own. `browser` takes the app's list of what it keeps, as `entries`.\n */\nexport type LegalKitSectionProps = LegalKitSectionBase &\n (\n | {\n section: \"browser\";\n variant?: never;\n /** What this app keeps in the browser, one entry per item — rendered as a `<ul>`\n * between the kit's two sentences. The app's words, in every language it serves. */\n entries: readonly string[];\n /** After the kit's text: what sign-out removes beyond the tokens, what stays. */\n children?: ReactNode;\n }\n | {\n section: \"legal_basis\" | \"rights\";\n variant?: never;\n entries?: never;\n /** `legal_basis`: after the kit's paragraph (consent, where an app relies on\n * it). `rights`: between the list of rights and the supervisory authorities\n * (how to export, how to delete). A plain string keeps its line breaks and has\n * its `{ref:key}` tokens resolved. */\n children?: ReactNode;\n }\n | {\n section: \"disclaimer\";\n /**\n * 0.32.0 (docs/billing-harmonization.md §8, legal decision 7): which disclaimer.\n * `non-commercial` (default) is the beta's \"private, non-commercial project\";\n * `commercial` is for an app that charges, sold through a Merchant of Record —\n * chosen per app, in the release that turns its billing on.\n */\n variant?: LegalDisclaimerVariant;\n entries?: never;\n children?: never;\n }\n | {\n section: Exclude<LegalKitSectionKey, \"browser\" | \"legal_basis\" | \"rights\" | \"disclaimer\">;\n variant?: never;\n entries?: never;\n children?: never;\n }\n );\n\n/** 0.32.0: the imprint disclaimer's two texts — see {@link LegalKitSectionProps}. */\nexport type LegalDisclaimerVariant = \"non-commercial\" | \"commercial\";\n\n/** The app's paragraph: a plain string as running text (line breaks kept, refs\n * resolved), anything else as it is. */\nfunction appPart(children: ReactNode): ReactNode {\n if (children === undefined || children === null || children === false) return null;\n if (typeof children === \"string\") return <LegalText key=\"app\" text={children} />;\n return <Fragment key=\"app\">{children}</Fragment>;\n}\n\n/**\n * One of the kit's sections (§4.3) — `<LegalKitSection section=\"warranty\" />` — with its\n * heading, its `id` (the key: `/terms#warranty`) and, on a numbered page, its number.\n *\n * The words are the kit's, in the `legal` labels, filled in with the operator; an app\n * adds only what §4.2 gives it a slot for. Inside a {@link LegalPage} the page and the\n * operator come from it, so a page reads as its section list:\n *\n * <LegalPage page=\"privacy\" operator={OPERATOR}>\n * <LegalKitSection section=\"controller\" />\n * <LegalSection key=\"data\" heading={t(\"legal.privacy.data.title\")} body={…} />\n * <LegalKitSection section=\"legal_basis\">{t(\"legal.privacy.legal_basis.app\")}</LegalKitSection>\n * …\n * </LegalPage>\n *\n * A key that is not one of the page's kit sections throws, naming the ones that are: it\n * is a typo in code, not a state a user can reach.\n */\nexport function LegalKitSection(props: LegalKitSectionProps) {\n const { section, headingAs, labels: labelsProp } = props;\n const context = useContext(LegalPageContext);\n const labels = useLegalLabels(labelsProp);\n const kitLocale = useKitLocale();\n\n const page = props.page ?? context?.page ?? onlyPageOf(section);\n const kitSections = kitSectionsOf(page);\n if (!kitSections.includes(section)) {\n throw new Error(\n `LegalKitSection: \"${section}\" is not one of the kit's sections of the ${page} page (${kitSections.join(\", \")}).`,\n );\n }\n const entry = (labels.sections[page] as Record<string, SectionLabels>)[section];\n const operator = props.operator ? legalOperatorText(props.operator, kitLocale) : context?.operator;\n const fill = (body: string | ((o: LegalOperatorText) => string)): string => {\n if (typeof body === \"string\") return body;\n if (!operator) {\n throw new Error(\n `LegalKitSection \"${section}\" names the operator: render it inside <LegalPage operator={…}>, or pass operator.`,\n );\n }\n if (section === \"language\" && !operator.bindingLanguage) {\n throw new Error(\n `LegalKitSection \"language\" names the binding language: give the operator a bindingLanguage (\"de-CH\").`,\n );\n }\n return body(operator);\n };\n\n const app = appPart(props.children);\n let parts: ReactNode[];\n if (\"lead\" in entry) {\n const lead = <LegalText key=\"lead\" text={entry.lead} />;\n const tail = <LegalText key=\"tail\" text={entry.tail} />;\n if (props.section === \"browser\") {\n const list =\n props.entries.length > 0 ? (\n <ul key=\"entries\" className=\"list-disc space-y-1 ps-5\">\n {props.entries.map((item, i) => (\n <li key={i}>{item}</li>\n ))}\n </ul>\n ) : null;\n parts = [lead, list, tail, app];\n } else {\n // `rights`: the app's paragraph sits between the rights and the authorities.\n parts = [lead, app, tail];\n }\n } else {\n // The imprint's commercial disclaimer (0.32.0): its own body under the same title.\n const commercial =\n props.section === \"disclaimer\" && props.variant === \"commercial\"\n ? ((entry as LegalDisclaimerSectionLabels).commercial ??\n DEFAULT_LEGAL_LABELS.sections.impressum.disclaimer.commercial)\n : undefined;\n parts = [<LegalText key=\"body\" text={commercial ?? fill(entry.body)} />, app];\n }\n\n return (\n <LegalSection id={section} heading={entry.title} headingAs={headingAs}>\n <div className=\"space-y-[1lh]\">{parts}</div>\n </LegalSection>\n );\n}\n\ntype SectionLabels = LegalTextSectionLabels | LegalOperatorSectionLabels | LegalFramedSectionLabels;\n\n/** The one page a kit section key is on; `contact` is on two, so it needs the page. */\nfunction onlyPageOf(section: string): LegalPageKey {\n const pages = PAGES.filter((p) => kitSectionsOf(p).includes(section));\n if (pages.length === 1) return pages[0];\n throw new Error(\n pages.length === 0\n ? `LegalKitSection: \"${section}\" is not one of the kit's sections.`\n : `LegalKitSection: \"${section}\" is on more than one page (${pages.join(\", \")}) — render it inside a LegalPage, or pass page.`,\n );\n}\n\n// ── The page ──────────────────────────────────────────────────────────────────\n\nexport interface LegalPageProps {\n /** Which page: the title, the default notice, whether the sections are numbered. */\n page: LegalPageKey;\n /** Who runs the app — the values the kit's sections name. The same in every app's\n * three pages; the kit holds none (§5). */\n operator: LegalOperator;\n /**\n * The sections, in reading order: {@link LegalKitSection}s and {@link LegalSection}s.\n *\n * They must be DIRECT children — or inside fragments, or in an array\n * (`SECTIONS.map(…)`). The page reads them before they render, to know every\n * section's number in advance: that is what lets a `{ref:key}` point forward\n * (keksdose's section 2 refers to section 10). A section wrapped in a component of the\n * app's own is invisible to that walk and renders unnumbered, with no key.\n */\n children: ReactNode;\n /** The app's public header — the one a signed-out visitor already sees (keksdose's\n * `LandingHeader`, Kurvenschmiede's `AppTopBar` without the shell). */\n header?: ReactNode;\n /** Default: `<LegalFooter />` with this page marked. `null` for none. */\n footer?: ReactNode;\n /** The back link's target. Default `/`, which takes a signed-in user into the app and\n * a signed-out one to the landing or sign-in page. */\n homeHref?: string;\n /** Default: the kit's beta notice on the imprint and the terms, its privacy notice on\n * the privacy policy (§3.2). `null` for none. */\n notice?: ReactNode;\n /**\n * 0.28.1: switches the app to the operator's `bindingLanguage` — the button after the\n * translation note on a page read in another language. Without it the note stands\n * alone; the app's own language switcher is in its header anyway.\n */\n onShowBindingLanguage?: () => void;\n /** The language the operator's country is named in. Default: the `<UiKitProvider\n * locale>`, else English. */\n locale?: string;\n /** The title's element. Default `h1`; `h2` for a page shown inside another (a\n * preview), whose sections then take `h3`. */\n headingAs?: \"h1\" | \"h2\";\n /** `false` draws the column as a `<div>` instead of `<main>` — for a page embedded in\n * one that has its own `<main>`. Default true. */\n landmark?: boolean;\n /** Default true: {@link useNoIndex}. `false` only where the page is not the page — a\n * preview inside another page. */\n noIndex?: boolean;\n /** On the outermost element (a full-height column). */\n className?: string;\n /** The `legal` labels for this page and everything in it — sections, footer,\n * checkbox — on top of the provider's. */\n labels?: LabelOverride<LegalLabels>;\n}\n\ninterface FlatNode {\n node: ReactNode;\n /** A stable React key from the node's place in the tree the app wrote. */\n path: string;\n}\n\n/** The children as a flat list, arrays and fragments opened — the sections the page can\n * see, in render order. */\nfunction flatten(node: ReactNode, path: string, out: FlatNode[]): void {\n if (node === null || node === undefined || typeof node === \"boolean\") return;\n if (isValidElement(node)) {\n if (node.type === Fragment) {\n flatten((node.props as { children?: ReactNode }).children, path, out);\n } else {\n out.push({ node, path: path || \"/\" });\n }\n return;\n }\n if (typeof node === \"object\" && Symbol.iterator in node) {\n Array.from(node as Iterable<ReactNode>).forEach((child, i) => {\n const step = isValidElement(child) && child.key !== null ? `$${child.key}` : `#${i}`;\n flatten(child, `${path}/${step}`, out);\n });\n return;\n }\n out.push({ node, path: path || \"/\" });\n}\n\n/** A section the walk found: its key (`undefined` when it has none) and heading. */\nfunction sectionOf(\n node: ReactNode,\n page: LegalPageKey,\n labels: LegalLabels,\n): { key: string | undefined; heading: ReactNode } | null {\n if (!isValidElement(node)) return null;\n if (node.type === LegalKitSection) {\n const { section } = node.props as LegalKitSectionProps;\n const entry = (labels.sections[page] as Record<string, SectionLabels | undefined>)[section];\n return { key: section, heading: entry?.title ?? section };\n }\n if (node.type === LegalSection) {\n const props = node.props as LegalSectionProps;\n return { key: props.id ?? node.key ?? undefined, heading: props.heading };\n }\n return null;\n}\n\n/**\n * The page's sections, each in a slot that tells it its key and number, and the map a\n * `{ref:key}` is resolved from — built from the children BEFORE they render.\n */\nfunction slotSections(\n children: ReactNode,\n page: LegalPageKey,\n labels: LegalLabels,\n): { nodes: ReactNode[]; targets: Map<string, LegalRefTarget> } {\n const flat: FlatNode[] = [];\n flatten(children, \"\", flat);\n const numbered = LEGAL_SKELETON[page].numbered;\n const targets = new Map<string, LegalRefTarget>();\n let count = 0;\n const nodes = flat.map(({ node, path }) => {\n const section = sectionOf(node, page, labels);\n if (!section) return <Fragment key={path}>{node}</Fragment>;\n count += 1;\n const number = numbered ? count : undefined;\n if (section.key !== undefined) {\n if (targets.has(section.key)) {\n warnLegalOnce(`two sections of the ${page} page share the key \"${section.key}\"; {ref:${section.key}} names the first.`);\n } else {\n targets.set(section.key, { number, heading: section.heading });\n }\n }\n return (\n <LegalSlotContext.Provider key={path} value={{ id: section.key, number }}>\n {node}\n </LegalSlotContext.Provider>\n );\n });\n return { nodes, targets };\n}\n\n/**\n * A legal page — Imprint, Privacy Policy or Terms — in the frame every app uses (§3.2):\n * the app's public header, the kit's column (back link, title, notice, sections) and the\n * public footer. keksdose's `features/legal/legal-layout.tsx`, the reference: its\n * `LegalPage` drew exactly this around the kit's `LegalLayout`, and kastlan and\n * Kurvenschmiede each drew a different frame (an auth card, the signed-in app shell).\n * Signed-in users see the same frame: the pages are public and outside the app shell.\n *\n * What it adds to the column:\n * - the title, from `legal.titles`, and \"← Back to home\" pointing at `homeHref`;\n * - the default notice per page — the beta notice, or the privacy notice on the privacy\n * policy, whose technical sections describe running code (§3.2, §7.3);\n * - numbers: the privacy and terms sections are \"N. Title\" in render order, the\n * imprint's are not (§4.1). The titles in the catalogues carry no number, so a\n * section added in the middle renumbers the rest instead of leaving them wrong;\n * - ids: every section's `id` is its key (`/privacy#rights`), which keeps\n * Kurvenschmiede's deep links working;\n * - `{ref:key}` in a section's text becomes that section's number, linked — forward\n * references included, since the page knows the order before any section renders\n * (see `children` for what that asks of the tree);\n * - `useNoIndex()`.\n */\nexport function LegalPage({\n page,\n operator,\n children,\n header,\n footer,\n homeHref = \"/\",\n notice,\n onShowBindingLanguage,\n locale: localeProp,\n headingAs = \"h1\",\n landmark = true,\n noIndex = true,\n className,\n labels: labelsProp,\n}: LegalPageProps) {\n useNoIndex(noIndex);\n const labels = useLegalLabels(labelsProp);\n const locale = useKitLocale(localeProp) ?? \"en\";\n // Not memoised: `countryName` keeps one `Intl.DisplayNames` per locale, so naming the\n // country again is a lookup, and the context is rebuilt with the children anyway.\n const operatorText = legalOperatorText(operator, locale);\n const overrides = useMemo<UiKitLabelOverrides | undefined>(\n () => (labelsProp ? { legal: labelsProp } : undefined),\n [labelsProp],\n );\n\n const { nodes, targets } = slotSections(children, page, labels);\n const context: LegalPageContextValue = {\n page,\n operator: operatorText,\n sectionHeading: headingAs === \"h1\" ? \"h2\" : \"h3\",\n targets,\n };\n const Main = landmark ? \"main\" : \"div\";\n const shownNotice =\n notice !== undefined ? notice : page === \"privacy\" ? labels.notice.privacy : labels.notice.beta;\n // 0.28.1 (Marcel): one language is binding and the lawyer reviews that one; a page read\n // in any other says so, with a way to the binding version.\n const translated =\n operator.bindingLanguage !== undefined && baseLanguage(operator.bindingLanguage) !== baseLanguage(locale);\n const translationNote = translated ? (\n <p className=\"text-sm text-secondary\">\n {labels.translation.note(operatorText)}\n {onShowBindingLanguage && (\n <>\n {\" \"}\n <Button type=\"button\" variant=\"link\" size=\"sm\" className=\"h-auto p-0 align-baseline\" onClick={onShowBindingLanguage}>\n {labels.translation.show(operatorText)}\n </Button>\n </>\n )}\n </p>\n ) : undefined;\n\n return (\n <UiKitProvider labels={overrides}>\n <div className={cn(\"flex min-h-full flex-col\", className)}>\n {header}\n <Main className=\"flex-1\">\n <LegalPageContext.Provider value={context}>\n <LegalLayout\n back={\n <TextLink href={homeHref} icon={ArrowLeft}>\n {labels.backHome}\n </TextLink>\n }\n title={labels.titles[page]}\n notice={shownNotice}\n translationNote={translationNote}\n headingAs={headingAs}\n >\n {nodes}\n </LegalLayout>\n </LegalPageContext.Provider>\n </Main>\n {footer === undefined ? <LegalFooter currentHref={LEGAL_HREFS[page]} /> : footer}\n </div>\n </UiKitProvider>\n );\n}\n\n// ── Terms acceptance (§3.4) ───────────────────────────────────────────────────\n\nexport interface LegalAcceptCheckboxProps\n extends Omit<CheckboxProps, \"label\" | \"checked\" | \"onCheckedChange\" | \"required\"> {\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n /** Default `/terms`. */\n termsHref?: string;\n /** Default `/privacy`. */\n privacyHref?: string;\n labels?: LabelOverride<LegalLabels>;\n ref?: Ref<HTMLInputElement>;\n}\n\n/** `legal.accept` with its `{terms}` and `{privacy}` as links named by the page titles.\n * Split, not interpolated: the text between the placeholders is the template's own,\n * to the character — nothing is added around a link. */\nfunction acceptLabel(labels: LegalLabels, termsHref: string, privacyHref: string): ReactNode[] {\n const template = labels.accept;\n for (const placeholder of [\"{terms}\", \"{privacy}\"]) {\n if (!template.includes(placeholder)) warnLegalOnce(`legal.accept has no ${placeholder}: \"${template}\".`);\n }\n return template\n .split(/(\\{terms\\}|\\{privacy\\})/)\n .filter((part) => part !== \"\")\n .map((part, i) =>\n part === \"{terms}\" ? (\n <TextLink key={i} href={termsHref} tone=\"primary\">\n {labels.titles.terms}\n </TextLink>\n ) : part === \"{privacy}\" ? (\n <TextLink key={i} href={privacyHref} tone=\"primary\">\n {labels.titles.privacy}\n </TextLink>\n ) : (\n part\n ),\n );\n}\n\n/**\n * The register page's \"I accept the [Terms of Service] and the [Privacy Policy]\" (§3.4):\n * keksdose's checkbox (features/auth/register-page.tsx), for every app.\n *\n * A REQUIRED kit `Checkbox` — not a Switch: a form answer that waits for the submit\n * button. The app keeps its submit disabled while it is unticked, so there is never a\n * failed attempt and no `error` to show. Nothing is sent to the backend: no stored\n * version, no re-acceptance (Marcel, §2.4).\n *\n * The label is ONE template, `legal.accept`, so a language puts the links where its\n * grammar needs them, articles included — fr \"J’accepte les {terms} et la {privacy}\",\n * it \"Accetto le {terms} e l’{privacy}\" with no space after the elided article. The link\n * texts are the page titles (`legal.titles`), as on the pages themselves.\n */\nexport function LegalAcceptCheckbox({\n checked,\n onCheckedChange,\n termsHref = LEGAL_HREFS.terms,\n privacyHref = LEGAL_HREFS.privacy,\n labels: labelsProp,\n ref,\n ...rest\n}: LegalAcceptCheckboxProps) {\n const labels = useLegalLabels(labelsProp);\n return (\n <Checkbox\n {...rest}\n ref={ref}\n checked={checked}\n onCheckedChange={onCheckedChange}\n required\n label={acceptLabel(labels, termsHref, privacyHref)}\n />\n );\n}\n"],"mappings":";AAmN2C,SAgTnC,UAhTmC,KAgTnC,YAhTmC;AAnN3C,SA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AAEJ;AAmBA,SAAS,YAAY,QAAqB,WAAmB,aAAkC;AAC7F,QAAM,WAAW,OAAO;AACxB,aAAW,eAAe,CAAC,WAAW,WAAW,GAAG;AAClD,QAAI,CAAC,SAAS,SAAS,WAAW,EAAG,eAAc,uBAAuB,WAAW,MAAM,QAAQ,IAAI;AAAA,EACzG;AACA,SAAO,SACJ,MAAM,yBAAyB,EAC/B,OAAO,CAAC,SAAS,SAAS,EAAE,EAC5B;AAAA,IAAI,CAAC,MAAM,MACV,SAAS,YACP,oBAAC,YAAiB,MAAM,WAAW,MAAK,WACrC,iBAAO,OAAO,SADF,CAEf,IACE,SAAS,cACX,oBAAC,YAAiB,MAAM,aAAa,MAAK,WACvC,iBAAO,OAAO,WADF,CAEf,IAEA;AAAA,EAEJ;AACJ;AAgBO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,YAAY,YAAY;AAAA,EACxB,cAAc,YAAY;AAAA,EAC1B,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA6B;AAC3B,QAAM,SAAS,eAAe,UAAU;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAQ;AAAA,MACR,OAAO,YAAY,QAAQ,WAAW,WAAW;AAAA;AAAA,EACnD;AAEJ;","names":["Fragment"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/legal-page.tsx"],"sourcesContent":["import { Fragment, isValidElement, useContext, useMemo } from \"react\";\nimport type { ReactNode, Ref } from \"react\";\nimport { ArrowLeft } from \"lucide-react\";\n\nimport { UiKitProvider, useKitLocale } from \"../i18n/kit-labels\";\nimport type { LabelOverride, UiKitLabelOverrides } from \"../i18n/kit-labels\";\nimport { useNoIndex } from \"../hooks/use-noindex\";\nimport { cn } from \"../lib/cn\";\nimport { parseIsoDate } from \"../lib/dates\";\nimport { formatDate } from \"../lib/format\";\nimport { Checkbox } from \"./checkbox\";\nimport type { CheckboxProps } from \"./checkbox\";\nimport {\n DEFAULT_LEGAL_LABELS,\n LEGAL_HREFS,\n baseLanguage,\n LegalFooter,\n LegalLayout,\n LegalPageContext,\n LegalSection,\n LegalSlotContext,\n LegalText,\n legalOperatorText,\n useLegalLabels,\n warnLegalOnce,\n} from \"./legal\";\nimport type {\n LegalDisclaimerSectionLabels,\n LegalFramedSectionLabels,\n LegalLabels,\n LegalOperator,\n LegalOperatorSectionLabels,\n LegalOperatorText,\n LegalPageContextValue,\n LegalPageKey,\n LegalRefTarget,\n LegalSectionProps,\n LegalTextSectionLabels,\n} from \"./legal\";\nimport { TextLink } from \"./text-link\";\nimport { Button } from \"./button\";\n\n/**\n * The legal pages' frame and the kit's own sections — docs/legal-harmonization.md §3\n * and §4, the 0.28 round. The labels, the column, `LegalSection`, the links and the\n * footer are in `./legal`.\n */\n\n// ── The skeleton (§4.2) ───────────────────────────────────────────────────────\n\n/** Who writes a section: the kit's wording, the app's own, or the kit's wording with an\n * app paragraph in a fixed slot. */\nexport type LegalSectionOwner = \"kit\" | \"app\" | \"kit+app\";\n\nexport interface LegalSkeletonEntry {\n /** The section key — its `id` and its catalogue key. `\"*\"` is the slot where the\n * app's own sections go (zero or more: keksdose's `credits`, `price_pool`, …). */\n key: string;\n owner: LegalSectionOwner;\n}\n\nexport interface LegalSkeletonPage {\n /** Whether the page numbers its sections (\"3. Legal basis\"). The imprint does not. */\n numbered: boolean;\n /** The sections in their order. */\n sections: readonly LegalSkeletonEntry[];\n}\n\n/**\n * The section order every app's legal pages follow (§4.2), as data — so an app's test\n * can assert that its pages do, and so the order lives in one place, not in three apps'\n * reading of a table. `LegalPage` reads `numbered` from it.\n *\n * An app's test, given the section ids its page rendered in order:\n *\n * const fixed = LEGAL_SKELETON.privacy.sections.map((s) => s.key).filter((k) => k !== \"*\");\n * expect(ids.filter((id) => fixed.includes(id))).toEqual(fixed);\n *\n * Every fixed key is there, in the skeleton's order; the ids that are not in it are the\n * app's own sections, which belong where `\"*\"` stands.\n */\nexport const LEGAL_SKELETON: Readonly<Record<LegalPageKey, LegalSkeletonPage>> = Object.freeze({\n impressum: Object.freeze({\n numbered: false,\n sections: Object.freeze([\n { key: \"operator\", owner: \"kit\" },\n { key: \"contact\", owner: \"kit\" },\n { key: \"disclaimer\", owner: \"kit\" },\n { key: \"*\", owner: \"app\" },\n ] as const),\n }),\n privacy: Object.freeze({\n numbered: true,\n sections: Object.freeze([\n { key: \"controller\", owner: \"kit\" },\n { key: \"data\", owner: \"app\" },\n { key: \"legal_basis\", owner: \"kit+app\" },\n { key: \"third_parties\", owner: \"app\" },\n { key: \"*\", owner: \"app\" },\n { key: \"browser\", owner: \"kit+app\" },\n { key: \"transfers\", owner: \"app\" },\n { key: \"retention\", owner: \"app\" },\n { key: \"rights\", owner: \"kit+app\" },\n { key: \"contact\", owner: \"kit\" },\n ] as const),\n }),\n terms: Object.freeze({\n numbered: true,\n sections: Object.freeze([\n { key: \"scope\", owner: \"app\" },\n { key: \"no_advice\", owner: \"app\" },\n { key: \"*\", owner: \"app\" },\n { key: \"warranty\", owner: \"kit\" },\n { key: \"liability\", owner: \"kit\" },\n { key: \"changes\", owner: \"kit\" },\n // 0.28.1: which language's version prevails (the operator's `bindingLanguage`).\n { key: \"language\", owner: \"kit\" },\n { key: \"law\", owner: \"kit\" },\n ] as const),\n }),\n});\n\n/** The sections the kit writes (§4.3), on whichever page they sit. `contact` is on two\n * pages, with two texts; the page decides which. */\nexport type LegalKitSectionKey =\n | \"operator\"\n | \"contact\"\n | \"disclaimer\"\n | \"controller\"\n | \"legal_basis\"\n | \"browser\"\n | \"rights\"\n | \"warranty\"\n | \"liability\"\n | \"changes\"\n | \"language\"\n | \"law\";\n\n/** The kit's sections of one page, in the skeleton's order. */\nfunction kitSectionsOf(page: LegalPageKey): string[] {\n return LEGAL_SKELETON[page].sections.filter((s) => s.owner !== \"app\").map((s) => s.key);\n}\n\nconst PAGES: readonly LegalPageKey[] = [\"impressum\", \"privacy\", \"terms\"];\n\n// ── Kit sections ──────────────────────────────────────────────────────────────\n\ninterface LegalKitSectionBase {\n /** Default: the enclosing {@link LegalPage}'s page — needed outside one, and for\n * `contact` only (it is on two pages). */\n page?: LegalPageKey;\n /** Default: the enclosing {@link LegalPage}'s operator — needed outside one, by the\n * sections that name it (operator, both contacts, controller, law). */\n operator?: LegalOperator;\n /** Default: one level below the page's title (`h2` under an `h1`). */\n headingAs?: \"h2\" | \"h3\";\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * One of the kit's sections, by key. `children` is the app's paragraph where §4.2 says\n * \"kit + app\" — and only there, which the type holds an app to: the other sections'\n * wording is identical in every app, and an app that needs to say more says it in a\n * section of its own. `browser` takes the app's list of what it keeps, as `entries`.\n */\nexport type LegalKitSectionProps = LegalKitSectionBase &\n (\n | {\n section: \"browser\";\n variant?: never;\n /** What this app keeps in the browser, one entry per item — rendered as a `<ul>`\n * between the kit's two sentences. The app's words, in every language it serves. */\n entries: readonly string[];\n /** After the kit's text: what sign-out removes beyond the tokens, what stays. */\n children?: ReactNode;\n }\n | {\n section: \"legal_basis\" | \"rights\";\n variant?: never;\n entries?: never;\n /** `legal_basis`: after the kit's paragraph (consent, where an app relies on\n * it). `rights`: between the list of rights and the supervisory authorities\n * (how to export, how to delete). A plain string keeps its line breaks and has\n * its `{ref:key}` tokens resolved. */\n children?: ReactNode;\n }\n | {\n section: \"disclaimer\";\n /**\n * 0.32.0 (docs/billing-harmonization.md §8, legal decision 7): which disclaimer.\n * `non-commercial` (default) is the beta's \"private, non-commercial project\";\n * `commercial` is for an app that charges, sold through a Merchant of Record —\n * chosen per app, in the release that turns its billing on.\n */\n variant?: LegalDisclaimerVariant;\n entries?: never;\n children?: never;\n }\n | {\n section: Exclude<LegalKitSectionKey, \"browser\" | \"legal_basis\" | \"rights\" | \"disclaimer\">;\n variant?: never;\n entries?: never;\n children?: never;\n }\n );\n\n/** 0.32.0: the imprint disclaimer's two texts — see {@link LegalKitSectionProps}. */\nexport type LegalDisclaimerVariant = \"non-commercial\" | \"commercial\";\n\n/** The app's paragraph: a plain string as running text (line breaks kept, refs\n * resolved), anything else as it is. */\nfunction appPart(children: ReactNode): ReactNode {\n if (children === undefined || children === null || children === false) return null;\n if (typeof children === \"string\") return <LegalText key=\"app\" text={children} />;\n return <Fragment key=\"app\">{children}</Fragment>;\n}\n\n/**\n * One of the kit's sections (§4.3) — `<LegalKitSection section=\"warranty\" />` — with its\n * heading, its `id` (the key: `/terms#warranty`) and, on a numbered page, its number.\n *\n * The words are the kit's, in the `legal` labels, filled in with the operator; an app\n * adds only what §4.2 gives it a slot for. Inside a {@link LegalPage} the page and the\n * operator come from it, so a page reads as its section list:\n *\n * <LegalPage page=\"privacy\" operator={OPERATOR}>\n * <LegalKitSection section=\"controller\" />\n * <LegalSection key=\"data\" heading={t(\"legal.privacy.data.title\")} body={…} />\n * <LegalKitSection section=\"legal_basis\">{t(\"legal.privacy.legal_basis.app\")}</LegalKitSection>\n * …\n * </LegalPage>\n *\n * A key that is not one of the page's kit sections throws, naming the ones that are: it\n * is a typo in code, not a state a user can reach.\n */\nexport function LegalKitSection(props: LegalKitSectionProps) {\n const { section, headingAs, labels: labelsProp } = props;\n const context = useContext(LegalPageContext);\n const labels = useLegalLabels(labelsProp);\n const kitLocale = useKitLocale();\n\n const page = props.page ?? context?.page ?? onlyPageOf(section);\n const kitSections = kitSectionsOf(page);\n if (!kitSections.includes(section)) {\n throw new Error(\n `LegalKitSection: \"${section}\" is not one of the kit's sections of the ${page} page (${kitSections.join(\", \")}).`,\n );\n }\n const entry = (labels.sections[page] as Record<string, SectionLabels>)[section];\n const operator = props.operator ? legalOperatorText(props.operator, kitLocale) : context?.operator;\n const fill = (body: string | ((o: LegalOperatorText) => string)): string => {\n if (typeof body === \"string\") return body;\n if (!operator) {\n throw new Error(\n `LegalKitSection \"${section}\" names the operator: render it inside <LegalPage operator={…}>, or pass operator.`,\n );\n }\n if (section === \"language\" && !operator.bindingLanguage) {\n throw new Error(\n `LegalKitSection \"language\" names the binding language: give the operator a bindingLanguage (\"de-CH\").`,\n );\n }\n return body(operator);\n };\n\n const app = appPart(props.children);\n let parts: ReactNode[];\n if (\"lead\" in entry) {\n const lead = <LegalText key=\"lead\" text={entry.lead} />;\n const tail = <LegalText key=\"tail\" text={entry.tail} />;\n if (props.section === \"browser\") {\n const list =\n props.entries.length > 0 ? (\n <ul key=\"entries\" className=\"list-disc space-y-1 ps-5\">\n {props.entries.map((item, i) => (\n <li key={i}>{item}</li>\n ))}\n </ul>\n ) : null;\n parts = [lead, list, tail, app];\n } else {\n // `rights`: the app's paragraph sits between the rights and the authorities.\n parts = [lead, app, tail];\n }\n } else {\n // The imprint's commercial disclaimer (0.32.0): its own body under the same title.\n const commercial =\n props.section === \"disclaimer\" && props.variant === \"commercial\"\n ? ((entry as LegalDisclaimerSectionLabels).commercial ??\n DEFAULT_LEGAL_LABELS.sections.impressum.disclaimer.commercial)\n : undefined;\n parts = [<LegalText key=\"body\" text={commercial ?? fill(entry.body)} />, app];\n }\n\n return (\n <LegalSection id={section} heading={entry.title} headingAs={headingAs}>\n <div className=\"space-y-[1lh]\">{parts}</div>\n </LegalSection>\n );\n}\n\ntype SectionLabels = LegalTextSectionLabels | LegalOperatorSectionLabels | LegalFramedSectionLabels;\n\n/** The one page a kit section key is on; `contact` is on two, so it needs the page. */\nfunction onlyPageOf(section: string): LegalPageKey {\n const pages = PAGES.filter((p) => kitSectionsOf(p).includes(section));\n if (pages.length === 1) return pages[0];\n throw new Error(\n pages.length === 0\n ? `LegalKitSection: \"${section}\" is not one of the kit's sections.`\n : `LegalKitSection: \"${section}\" is on more than one page (${pages.join(\", \")}) — render it inside a LegalPage, or pass page.`,\n );\n}\n\n// ── The page ──────────────────────────────────────────────────────────────────\n\nexport interface LegalPageProps {\n /** Which page: the title, the default notice, whether the sections are numbered. */\n page: LegalPageKey;\n /** Who runs the app — the values the kit's sections name. The same in every app's\n * three pages; the kit holds none (§5). */\n operator: LegalOperator;\n /**\n * The sections, in reading order: {@link LegalKitSection}s and {@link LegalSection}s.\n *\n * They must be DIRECT children — or inside fragments, or in an array\n * (`SECTIONS.map(…)`). The page reads them before they render, to know every\n * section's number in advance: that is what lets a `{ref:key}` point forward\n * (keksdose's section 2 refers to section 10). A section wrapped in a component of the\n * app's own is invisible to that walk and renders unnumbered, with no key.\n */\n children: ReactNode;\n /** The app's public header — the one a signed-out visitor already sees (keksdose's\n * `LandingHeader`, Kurvenschmiede's `AppTopBar` without the shell). */\n header?: ReactNode;\n /** Default: `<LegalFooter />` with this page marked. `null` for none. */\n footer?: ReactNode;\n /** The back link's target. Default `/`, which takes a signed-in user into the app and\n * a signed-out one to the landing or sign-in page. */\n homeHref?: string;\n /** Default: the kit's beta notice on the imprint and the terms, its privacy notice on\n * the privacy policy (§3.2). `null` for none. */\n notice?: ReactNode;\n /**\n * 0.51.3: the day this page's text last changed, \"YYYY-MM-DD\" (legal benchmark\n * 2026-10-29, gap 8). Shown under the title as `legal.updated` — \"Last updated:\n * 29 October 2026\", \"Stand: 29. Oktober 2026\" — with the date written out in `locale`,\n * so it follows the page's language like every other kit word, the switch to the\n * binding version included. Left out, no line. One date per page: the imprint, the\n * privacy policy and the terms change on their own days.\n *\n * An app that records which terms someone accepted (keksdose) stores the terms page's\n * date: it is the version the reader saw.\n */\n updated?: string;\n /**\n * 0.28.1: switches the app to the operator's `bindingLanguage` — the button after the\n * translation note on a page read in another language. Without it the note stands\n * alone; the app's own language switcher is in its header anyway.\n */\n onShowBindingLanguage?: () => void;\n /** The language the operator's country is named in. Default: the `<UiKitProvider\n * locale>`, else English. */\n locale?: string;\n /** The title's element. Default `h1`; `h2` for a page shown inside another (a\n * preview), whose sections then take `h3`. */\n headingAs?: \"h1\" | \"h2\";\n /** `false` draws the column as a `<div>` instead of `<main>` — for a page embedded in\n * one that has its own `<main>`. Default true. */\n landmark?: boolean;\n /** Default true: {@link useNoIndex}. `false` only where the page is not the page — a\n * preview inside another page. */\n noIndex?: boolean;\n /** On the outermost element (a full-height column). */\n className?: string;\n /** The `legal` labels for this page and everything in it — sections, footer,\n * checkbox — on top of the provider's. */\n labels?: LabelOverride<LegalLabels>;\n}\n\ninterface FlatNode {\n node: ReactNode;\n /** A stable React key from the node's place in the tree the app wrote. */\n path: string;\n}\n\n/** The children as a flat list, arrays and fragments opened — the sections the page can\n * see, in render order. */\nfunction flatten(node: ReactNode, path: string, out: FlatNode[]): void {\n if (node === null || node === undefined || typeof node === \"boolean\") return;\n if (isValidElement(node)) {\n if (node.type === Fragment) {\n flatten((node.props as { children?: ReactNode }).children, path, out);\n } else {\n out.push({ node, path: path || \"/\" });\n }\n return;\n }\n if (typeof node === \"object\" && Symbol.iterator in node) {\n Array.from(node as Iterable<ReactNode>).forEach((child, i) => {\n const step = isValidElement(child) && child.key !== null ? `$${child.key}` : `#${i}`;\n flatten(child, `${path}/${step}`, out);\n });\n return;\n }\n out.push({ node, path: path || \"/\" });\n}\n\n/** A section the walk found: its key (`undefined` when it has none) and heading. */\nfunction sectionOf(\n node: ReactNode,\n page: LegalPageKey,\n labels: LegalLabels,\n): { key: string | undefined; heading: ReactNode } | null {\n if (!isValidElement(node)) return null;\n if (node.type === LegalKitSection) {\n const { section } = node.props as LegalKitSectionProps;\n const entry = (labels.sections[page] as Record<string, SectionLabels | undefined>)[section];\n return { key: section, heading: entry?.title ?? section };\n }\n if (node.type === LegalSection) {\n const props = node.props as LegalSectionProps;\n return { key: props.id ?? node.key ?? undefined, heading: props.heading };\n }\n return null;\n}\n\n/**\n * The page's sections, each in a slot that tells it its key and number, and the map a\n * `{ref:key}` is resolved from — built from the children BEFORE they render.\n */\nfunction slotSections(\n children: ReactNode,\n page: LegalPageKey,\n labels: LegalLabels,\n): { nodes: ReactNode[]; targets: Map<string, LegalRefTarget> } {\n const flat: FlatNode[] = [];\n flatten(children, \"\", flat);\n const numbered = LEGAL_SKELETON[page].numbered;\n const targets = new Map<string, LegalRefTarget>();\n let count = 0;\n const nodes = flat.map(({ node, path }) => {\n const section = sectionOf(node, page, labels);\n if (!section) return <Fragment key={path}>{node}</Fragment>;\n count += 1;\n const number = numbered ? count : undefined;\n if (section.key !== undefined) {\n if (targets.has(section.key)) {\n warnLegalOnce(`two sections of the ${page} page share the key \"${section.key}\"; {ref:${section.key}} names the first.`);\n } else {\n targets.set(section.key, { number, heading: section.heading });\n }\n }\n return (\n <LegalSlotContext.Provider key={path} value={{ id: section.key, number }}>\n {node}\n </LegalSlotContext.Provider>\n );\n });\n return { nodes, targets };\n}\n\n/**\n * A legal page — Imprint, Privacy Policy or Terms — in the frame every app uses (§3.2):\n * the app's public header, the kit's column (back link, title, notice, sections) and the\n * public footer. keksdose's `features/legal/legal-layout.tsx`, the reference: its\n * `LegalPage` drew exactly this around the kit's `LegalLayout`, and kastlan and\n * Kurvenschmiede each drew a different frame (an auth card, the signed-in app shell).\n * Signed-in users see the same frame: the pages are public and outside the app shell.\n *\n * What it adds to the column:\n * - the title, from `legal.titles`, and \"← Back to home\" pointing at `homeHref`;\n * - the as-of line under the title, from `updated` (0.51.3);\n * - the default notice per page — the beta notice, or the privacy notice on the privacy\n * policy, whose technical sections describe running code (§3.2, §7.3);\n * - numbers: the privacy and terms sections are \"N. Title\" in render order, the\n * imprint's are not (§4.1). The titles in the catalogues carry no number, so a\n * section added in the middle renumbers the rest instead of leaving them wrong;\n * - ids: every section's `id` is its key (`/privacy#rights`), which keeps\n * Kurvenschmiede's deep links working;\n * - `{ref:key}` in a section's text becomes that section's number, linked — forward\n * references included, since the page knows the order before any section renders\n * (see `children` for what that asks of the tree);\n * - `useNoIndex()`.\n */\nexport function LegalPage({\n page,\n operator,\n children,\n header,\n footer,\n homeHref = \"/\",\n notice,\n updated,\n onShowBindingLanguage,\n locale: localeProp,\n headingAs = \"h1\",\n landmark = true,\n noIndex = true,\n className,\n labels: labelsProp,\n}: LegalPageProps) {\n useNoIndex(noIndex);\n const labels = useLegalLabels(labelsProp);\n const locale = useKitLocale(localeProp) ?? \"en\";\n // Not memoised: `countryName` keeps one `Intl.DisplayNames` per locale, so naming the\n // country again is a lookup, and the context is rebuilt with the children anyway.\n const operatorText = legalOperatorText(operator, locale);\n const overrides = useMemo<UiKitLabelOverrides | undefined>(\n () => (labelsProp ? { legal: labelsProp } : undefined),\n [labelsProp],\n );\n\n const { nodes, targets } = slotSections(children, page, labels);\n const context: LegalPageContextValue = {\n page,\n operator: operatorText,\n sectionHeading: headingAs === \"h1\" ? \"h2\" : \"h3\",\n targets,\n };\n const Main = landmark ? \"main\" : \"div\";\n const shownNotice =\n notice !== undefined ? notice : page === \"privacy\" ? labels.notice.privacy : labels.notice.beta;\n // 0.28.1 (Marcel): one language is binding and the lawyer reviews that one; a page read\n // in any other says so, with a way to the binding version.\n const translated =\n operator.bindingLanguage !== undefined && baseLanguage(operator.bindingLanguage) !== baseLanguage(locale);\n const translationNote = translated ? (\n <p className=\"text-sm text-secondary\">\n {labels.translation.note(operatorText)}\n {onShowBindingLanguage && (\n <>\n {\" \"}\n <Button type=\"button\" variant=\"link\" size=\"sm\" className=\"h-auto p-0 align-baseline\" onClick={onShowBindingLanguage}>\n {labels.translation.show(operatorText)}\n </Button>\n </>\n )}\n </p>\n ) : undefined;\n // A calendar day, written out in the page's language; `formatDate` reads a bare\n // \"YYYY-MM-DD\" as that day in every zone. A malformed date shows no line rather than a\n // made-up one (\"2026-02-30\" would roll over into March).\n const updatedValid = updated !== undefined && parseIsoDate(updated) !== null;\n if (updated !== undefined && !updatedValid) {\n warnLegalOnce(`LegalPage: updated=\"${updated}\" is not a \"YYYY-MM-DD\" date; no \"Last updated\" line is shown.`);\n }\n const updatedLine = updatedValid ? (\n <time dateTime={updated}>\n {(labels.updated ?? DEFAULT_LEGAL_LABELS.updated!)(formatDate(updated, \"long\", { locale }))}\n </time>\n ) : undefined;\n\n return (\n <UiKitProvider labels={overrides}>\n <div className={cn(\"flex min-h-full flex-col\", className)}>\n {header}\n <Main className=\"flex-1\">\n <LegalPageContext.Provider value={context}>\n <LegalLayout\n back={\n <TextLink href={homeHref} icon={ArrowLeft}>\n {labels.backHome}\n </TextLink>\n }\n title={labels.titles[page]}\n notice={shownNotice}\n updated={updatedLine}\n translationNote={translationNote}\n headingAs={headingAs}\n >\n {nodes}\n </LegalLayout>\n </LegalPageContext.Provider>\n </Main>\n {footer === undefined ? <LegalFooter currentHref={LEGAL_HREFS[page]} /> : footer}\n </div>\n </UiKitProvider>\n );\n}\n\n// ── Terms acceptance (§3.4) ───────────────────────────────────────────────────\n\nexport interface LegalAcceptCheckboxProps\n extends Omit<CheckboxProps, \"label\" | \"checked\" | \"onCheckedChange\" | \"required\"> {\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n /** Default `/terms`. */\n termsHref?: string;\n /** Default `/privacy`. */\n privacyHref?: string;\n labels?: LabelOverride<LegalLabels>;\n ref?: Ref<HTMLInputElement>;\n}\n\n/** `legal.accept` with its `{terms}` and `{privacy}` as links named by the page titles.\n * Split, not interpolated: the text between the placeholders is the template's own,\n * to the character — nothing is added around a link. */\nfunction acceptLabel(labels: LegalLabels, termsHref: string, privacyHref: string): ReactNode[] {\n const template = labels.accept;\n for (const placeholder of [\"{terms}\", \"{privacy}\"]) {\n if (!template.includes(placeholder)) warnLegalOnce(`legal.accept has no ${placeholder}: \"${template}\".`);\n }\n return template\n .split(/(\\{terms\\}|\\{privacy\\})/)\n .filter((part) => part !== \"\")\n .map((part, i) =>\n part === \"{terms}\" ? (\n <TextLink key={i} href={termsHref} tone=\"primary\">\n {labels.titles.terms}\n </TextLink>\n ) : part === \"{privacy}\" ? (\n <TextLink key={i} href={privacyHref} tone=\"primary\">\n {labels.titles.privacy}\n </TextLink>\n ) : (\n part\n ),\n );\n}\n\n/**\n * The register page's \"I accept the [Terms of Service] and the [Privacy Policy]\" (§3.4):\n * keksdose's checkbox (features/auth/register-page.tsx), for every app.\n *\n * A REQUIRED kit `Checkbox` — not a Switch: a form answer that waits for the submit\n * button. The app keeps its submit disabled while it is unticked, so there is never a\n * failed attempt and no `error` to show. The checkbox itself sends nothing and asks for\n * no re-acceptance (Marcel, §2.4). An app that records which terms someone accepted\n * stores, with the account, the terms page's `updated` date — the version the reader\n * saw — on its own (keksdose since 2026-10-29; §3.4).\n *\n * The label is ONE template, `legal.accept`, so a language puts the links where its\n * grammar needs them, articles included — fr \"J’accepte les {terms} et la {privacy}\",\n * it \"Accetto le {terms} e l’{privacy}\" with no space after the elided article. The link\n * texts are the page titles (`legal.titles`), as on the pages themselves.\n */\nexport function LegalAcceptCheckbox({\n checked,\n onCheckedChange,\n termsHref = LEGAL_HREFS.terms,\n privacyHref = LEGAL_HREFS.privacy,\n labels: labelsProp,\n ref,\n ...rest\n}: LegalAcceptCheckboxProps) {\n const labels = useLegalLabels(labelsProp);\n return (\n <Checkbox\n {...rest}\n ref={ref}\n checked={checked}\n onCheckedChange={onCheckedChange}\n required\n label={acceptLabel(labels, termsHref, privacyHref)}\n />\n );\n}\n"],"mappings":";AAqN2C,SA8TnC,UA9TmC,KA8TnC,YA9TmC;AArN3C,SAAS,YAAAA,WAAU,gBAAgB,YAAY,eAAe;AAE9D,SAAS,iBAAiB;AAE1B,SAAS,eAAe,oBAAoB;AAE5C,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AAEzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAcP,SAAS,gBAAgB;AACzB,SAAS,cAAc;AAyChB,MAAM,iBAAoE,OAAO,OAAO;AAAA,EAC7F,WAAW,OAAO,OAAO;AAAA,IACvB,UAAU;AAAA,IACV,UAAU,OAAO,OAAO;AAAA,MACtB,EAAE,KAAK,YAAY,OAAO,MAAM;AAAA,MAChC,EAAE,KAAK,WAAW,OAAO,MAAM;AAAA,MAC/B,EAAE,KAAK,cAAc,OAAO,MA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E,EAC5B;AAAA,IAAI,CAAC,MAAM,MACV,SAAS,YACP,oBAAC,YAAiB,MAAM,WAAW,MAAK,WACrC,iBAAO,OAAO,SADF,CAEf,IACE,SAAS,cACX,oBAAC,YAAiB,MAAM,aAAa,MAAK,WACvC,iBAAO,OAAO,WADF,CAEf,IAEA;AAAA,EAEJ;AACJ;AAkBO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,YAAY,YAAY;AAAA,EACxB,cAAc,YAAY;AAAA,EAC1B,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA6B;AAC3B,QAAM,SAAS,eAAe,UAAU;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAQ;AAAA,MACR,OAAO,YAAY,QAAQ,WAAW,WAAW;AAAA;AAAA,EACnD;AAEJ;","names":["Fragment"]}
|
|
@@ -150,6 +150,13 @@ export interface LegalLabels {
|
|
|
150
150
|
note: (o: LegalOperatorText) => string;
|
|
151
151
|
show: (o: LegalOperatorText) => string;
|
|
152
152
|
};
|
|
153
|
+
/**
|
|
154
|
+
* 0.51.3: the as-of line under the title (§3.2), "Last updated: 29 October 2026" —
|
|
155
|
+
* {@link LegalPage}'s `updated`, called with the date already written out in the page's
|
|
156
|
+
* locale. OPTIONAL, as every key added to a namespace an app may annotate: left out,
|
|
157
|
+
* the provider's, then English.
|
|
158
|
+
*/
|
|
159
|
+
updated?: (date: string) => string;
|
|
153
160
|
/** The kit's sections (§4.3), by page and section key. */
|
|
154
161
|
sections: {
|
|
155
162
|
impressum: {
|
|
@@ -335,6 +342,8 @@ export interface LegalLayoutProps {
|
|
|
335
342
|
* than the others (its technical sections describe running code).
|
|
336
343
|
*/
|
|
337
344
|
notice?: ReactNode;
|
|
345
|
+
/** 0.51.3: right under the title — {@link LegalPage}'s "Last updated: …" line. */
|
|
346
|
+
updated?: ReactNode;
|
|
338
347
|
/** 0.28.1: under the title, before the notice — {@link LegalPage}'s note that this
|
|
339
348
|
* page is a translation and which language is binding. */
|
|
340
349
|
translationNote?: ReactNode;
|
|
@@ -350,4 +359,4 @@ export interface LegalLayoutProps {
|
|
|
350
359
|
className?: string;
|
|
351
360
|
labels?: LabelOverride<LegalLabels>;
|
|
352
361
|
}
|
|
353
|
-
export declare function LegalLayout({ title, back, notice, translationNote, children, links, currentHref, headingAs: Heading, className, labels, }: LegalLayoutProps): import("react").JSX.Element;
|
|
362
|
+
export declare function LegalLayout({ title, back, notice, updated, translationNote, children, links, currentHref, headingAs: Heading, className, labels, }: LegalLayoutProps): import("react").JSX.Element;
|
package/dist/components/legal.js
CHANGED
|
@@ -141,6 +141,7 @@ function LegalLayout({
|
|
|
141
141
|
title,
|
|
142
142
|
back,
|
|
143
143
|
notice,
|
|
144
|
+
updated,
|
|
144
145
|
translationNote,
|
|
145
146
|
children,
|
|
146
147
|
links,
|
|
@@ -152,6 +153,7 @@ function LegalLayout({
|
|
|
152
153
|
return /* @__PURE__ */ jsxs("article", { className: cn("mx-auto w-full max-w-3xl px-4 py-12", className), children: [
|
|
153
154
|
back !== void 0 && /* @__PURE__ */ jsx("div", { className: "mb-4 text-sm", children: back }),
|
|
154
155
|
/* @__PURE__ */ jsx(Heading, { className: "text-3xl font-bold tracking-tight break-words text-primary", children: title }),
|
|
156
|
+
updated !== void 0 && updated !== null && /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted", children: updated }),
|
|
155
157
|
translationNote !== void 0 && translationNote !== null && /* @__PURE__ */ jsx("div", { className: "mt-3", children: translationNote }),
|
|
156
158
|
notice !== void 0 && notice !== null && /* @__PURE__ */ jsx(AlertBanner, { tone: "warning", role: "note", className: "mt-4", children: notice }),
|
|
157
159
|
/* @__PURE__ */ jsx("div", { className: "mt-8 space-y-8", children }),
|